diff --git a/tzipc-server/tzipc-admin/src/main/java/com/inspur/web/controller/ipc/IpcSensorUpdateFileController.java b/tzipc-server/tzipc-admin/src/main/java/com/inspur/web/controller/ipc/IpcSensorUpdateFileController.java new file mode 100644 index 0000000..8b47bfa --- /dev/null +++ b/tzipc-server/tzipc-admin/src/main/java/com/inspur/web/controller/ipc/IpcSensorUpdateFileController.java @@ -0,0 +1,179 @@ +package com.inspur.web.controller.ipc; + +import java.util.List; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import com.inspur.common.config.TzipcConfig; +import com.inspur.common.constant.Constants; +import com.inspur.common.utils.StringUtils; +import com.inspur.common.utils.file.FileUtils; +import com.inspur.web.controller.common.CommonController; +import org.apache.commons.io.FilenameUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.http.MediaType; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.inspur.common.annotation.Log; +import com.inspur.common.core.controller.BaseController; +import com.inspur.common.core.domain.AjaxResult; +import com.inspur.common.enums.BusinessType; +import com.inspur.ipc.domain.IpcSensorUpdateFile; +import com.inspur.ipc.service.IIpcSensorUpdateFileService; +import com.inspur.common.utils.poi.ExcelUtil; +import com.inspur.common.core.page.TableDataInfo; + +/** + * 传感器升级文件Controller + * + * @author zhanghan11 + * @date 2024-08-12 + */ +@RestController +@RequestMapping("/ipc/sensorUpdateFile") +public class IpcSensorUpdateFileController extends BaseController +{ + private static final Logger log = LoggerFactory.getLogger(CommonController.class); + + @Autowired + private IIpcSensorUpdateFileService ipcSensorUpdateFileService; + + + /** + * 查询传感器升级文件列表 + */ + @PreAuthorize("@ss.hasPermi('ipc:sensorUpdateFile:list')") + @GetMapping("/list") + public TableDataInfo list(IpcSensorUpdateFile ipcSensorUpdateFile) + { + startPage(); + List list = ipcSensorUpdateFileService.selectIpcSensorUpdateFileList(ipcSensorUpdateFile); + return getDataTable(list); + } + + /** + * 导出传感器升级文件列表 + */ + @PreAuthorize("@ss.hasPermi('ipc:sensorUpdateFile:export')") + @Log(title = "传感器升级文件", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, IpcSensorUpdateFile ipcSensorUpdateFile) + { + List list = ipcSensorUpdateFileService.selectIpcSensorUpdateFileList(ipcSensorUpdateFile); + ExcelUtil util = new ExcelUtil(IpcSensorUpdateFile.class); + util.exportExcel(response, list, "传感器升级文件数据"); + } + + /** + * 获取传感器升级文件详细信息 + */ + @PreAuthorize("@ss.hasPermi('ipc:sensorUpdateFile:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return AjaxResult.success(ipcSensorUpdateFileService.selectIpcSensorUpdateFileById(id)); + } + + /** + * 新增传感器升级文件 + */ + @PreAuthorize("@ss.hasPermi('ipc:sensorUpdateFile:add')") + @Log(title = "传感器升级文件", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody IpcSensorUpdateFile ipcSensorUpdateFile) + { + return toAjax(ipcSensorUpdateFileService.insertIpcSensorUpdateFile(ipcSensorUpdateFile)); + } + + /** + * 修改传感器升级文件 + */ + @PreAuthorize("@ss.hasPermi('ipc:sensorUpdateFile:edit')") + @Log(title = "传感器升级文件", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody IpcSensorUpdateFile ipcSensorUpdateFile) + { + return toAjax(ipcSensorUpdateFileService.updateIpcSensorUpdateFile(ipcSensorUpdateFile)); + } + + /** + * 删除传感器升级文件 + */ + @PreAuthorize("@ss.hasPermi('ipc:sensorUpdateFile:remove')") + @Log(title = "传感器升级文件", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) + { + return toAjax(ipcSensorUpdateFileService.deleteIpcSensorUpdateFileByIds(ids)); + } + + /** + * 升级文件下载 + * + */ + @GetMapping("/downloadUpdateFile") + public void fileDownload( HttpServletResponse response, HttpServletRequest request) + { + try + { + String fileName = ipcSensorUpdateFileService.selectLastestIpcSensorUpdateFile().getPath(); + if (!FileUtils.checkAllowDownload(fileName)) + { + throw new Exception(StringUtils.format("文件名称({})非法,不允许下载。 ", fileName)); + } + String filePath = fileName.replace(Constants.RESOURCE_PREFIX,TzipcConfig.getProfile()); + String realFileName = getRealFileName(fileName); + + + response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE); + FileUtils.setAttachmentResponseHeader(response, realFileName); + FileUtils.writeBytes(filePath, response.getOutputStream()); + } + catch (Exception e) + { + log.error("下载文件失败", e); + } + } + + /** + * 通用下载请求 + * + * @param fileName 文件名称 + */ + @GetMapping("/download") + public void fileDownload(String fileName, HttpServletResponse response, HttpServletRequest request) + { + try + { + if (!FileUtils.checkAllowDownload(fileName)) + { + throw new Exception(StringUtils.format("文件名称({})非法,不允许下载。 ", fileName)); + } + String filePath = fileName.replace(Constants.RESOURCE_PREFIX,TzipcConfig.getProfile()); + String realFileName = getRealFileName(fileName); + + response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE); + FileUtils.setAttachmentResponseHeader(response, realFileName); + FileUtils.writeBytes(filePath, response.getOutputStream()); + } + catch (Exception e) + { + log.error("下载文件失败", e); + } + } + + private String getRealFileName(String filePath){ + String fileName = FileUtils.getName(filePath); + String realFileName = fileName.substring(0,fileName.lastIndexOf("_"))+ "." + FilenameUtils.getExtension(fileName); + return realFileName; + } +} diff --git a/tzipc-server/tzipc-common/src/main/java/com/inspur/common/utils/file/MimeTypeUtils.java b/tzipc-server/tzipc-common/src/main/java/com/inspur/common/utils/file/MimeTypeUtils.java index f3a3840..4fecd33 100644 --- a/tzipc-server/tzipc-common/src/main/java/com/inspur/common/utils/file/MimeTypeUtils.java +++ b/tzipc-server/tzipc-common/src/main/java/com/inspur/common/utils/file/MimeTypeUtils.java @@ -2,11 +2,10 @@ package com.inspur.common.utils.file; /** * 媒体类型工具类 - * + * * @author inspur */ -public class MimeTypeUtils -{ +public class MimeTypeUtils { public static final String IMAGE_PNG = "image/png"; public static final String IMAGE_JPG = "image/jpg"; @@ -16,15 +15,15 @@ public class MimeTypeUtils public static final String IMAGE_BMP = "image/bmp"; public static final String IMAGE_GIF = "image/gif"; - - public static final String[] IMAGE_EXTENSION = { "bmp", "gif", "jpg", "jpeg", "png" }; - public static final String[] FLASH_EXTENSION = { "swf", "flv" }; + public static final String[] IMAGE_EXTENSION = {"bmp", "gif", "jpg", "jpeg", "png"}; - public static final String[] MEDIA_EXTENSION = { "swf", "flv", "mp3", "wav", "wma", "wmv", "mid", "avi", "mpg", - "asf", "rm", "rmvb" }; + public static final String[] FLASH_EXTENSION = {"swf", "flv"}; - public static final String[] VIDEO_EXTENSION = { "mp4", "avi", "rmvb" }; + public static final String[] MEDIA_EXTENSION = {"swf", "flv", "mp3", "wav", "wma", "wmv", "mid", "avi", "mpg", + "asf", "rm", "rmvb"}; + + public static final String[] VIDEO_EXTENSION = {"mp4", "avi", "rmvb"}; public static final String[] DEFAULT_ALLOWED_EXTENSION = { // 图片 @@ -36,12 +35,13 @@ public class MimeTypeUtils // 视频格式 "mp4", "avi", "rmvb", // pdf - "pdf" }; + "pdf", + // 传感器升级文件 + "bin" + }; - public static String getExtension(String prefix) - { - switch (prefix) - { + public static String getExtension(String prefix) { + switch (prefix) { case IMAGE_PNG: return "png"; case IMAGE_JPG: diff --git a/tzipc-server/tzipc-framework/src/main/java/com/inspur/framework/config/SecurityConfig.java b/tzipc-server/tzipc-framework/src/main/java/com/inspur/framework/config/SecurityConfig.java index 5d8130a..091596f 100644 --- a/tzipc-server/tzipc-framework/src/main/java/com/inspur/framework/config/SecurityConfig.java +++ b/tzipc-server/tzipc-framework/src/main/java/com/inspur/framework/config/SecurityConfig.java @@ -109,7 +109,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter // 过滤请求 .authorizeRequests() // 对于登录login 注册register 验证码captchaImage 允许匿名访问 - .antMatchers("/login", "/register", "/captchaImage","/systemName","/sharedKeys").anonymous() + .antMatchers("/login", "/register", "/captchaImage","/systemName","/sharedKeys","/ipc/sensorUpdateFile/downloadUpdateFile").anonymous() // 数据接收接口,允许匿名访问 .antMatchers("/ipc/dataReceive/plcData","/ipc/dataReceive/sensorData").permitAll() // 静态资源,可匿名访问 diff --git a/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/domain/IpcBg4gszhp01tempdata.java b/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/domain/IpcBg4gszhp01tempdata.java index 0a76838..753ed56 100644 --- a/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/domain/IpcBg4gszhp01tempdata.java +++ b/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/domain/IpcBg4gszhp01tempdata.java @@ -65,7 +65,6 @@ public class IpcBg4gszhp01tempdata extends BaseEntity private String WData; /** 版本号 */ - // TODO 待确认参数名称 @Excel(name = "版本号") @JsonProperty(value="Ver") private String Ver; diff --git a/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/domain/IpcSensorUpdateFile.java b/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/domain/IpcSensorUpdateFile.java new file mode 100644 index 0000000..ed53577 --- /dev/null +++ b/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/domain/IpcSensorUpdateFile.java @@ -0,0 +1,80 @@ +package com.inspur.ipc.domain; + +import com.inspur.common.annotation.Excel; +import com.inspur.common.core.domain.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +/** + * 传感器升级文件对象 ipc_sensor_update_file + * + * @author zhanghan11 + * @date 2024-08-12 + */ +public class IpcSensorUpdateFile extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 主键 */ + private Long id; + + /** 版本号 */ + @Excel(name = "版本号") + private String ver; + + /** 文件路径 */ + @Excel(name = "文件路径") + private String path; + + /** 是否删除 */ + private String delFlag; + + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + public void setVer(String ver) + { + this.ver = ver; + } + + public String getVer() + { + return ver; + } + public void setPath(String path) + { + this.path = path; + } + + public String getPath() + { + return path; + } + public void setDelFlag(String delFlag) + { + this.delFlag = delFlag; + } + + public String getDelFlag() + { + return delFlag; + } + + @Override + public String toString() { + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("ver", getVer()) + .append("path", getPath()) + .append("remark", getRemark()) + .append("createTime", getCreateTime()) + .append("delFlag", getDelFlag()) + .toString(); + } +} diff --git a/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/mapper/IpcSensorUpdateFileMapper.java b/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/mapper/IpcSensorUpdateFileMapper.java new file mode 100644 index 0000000..640f037 --- /dev/null +++ b/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/mapper/IpcSensorUpdateFileMapper.java @@ -0,0 +1,68 @@ +package com.inspur.ipc.mapper; + +import java.util.List; +import com.inspur.ipc.domain.IpcSensorUpdateFile; + +/** + * 传感器升级文件Mapper接口 + * + * @author zhanghan11 + * @date 2024-08-12 + */ +public interface IpcSensorUpdateFileMapper +{ + /** + * 查询最新传感器升级文件 + * + * @return 传感器升级文件 + */ + public IpcSensorUpdateFile selectLastestIpcSensorUpdateFile(); + + /** + * 查询传感器升级文件 + * + * @param id 传感器升级文件主键 + * @return 传感器升级文件 + */ + public IpcSensorUpdateFile selectIpcSensorUpdateFileById(Long id); + + /** + * 查询传感器升级文件列表 + * + * @param ipcSensorUpdateFile 传感器升级文件 + * @return 传感器升级文件集合 + */ + public List selectIpcSensorUpdateFileList(IpcSensorUpdateFile ipcSensorUpdateFile); + + /** + * 新增传感器升级文件 + * + * @param ipcSensorUpdateFile 传感器升级文件 + * @return 结果 + */ + public int insertIpcSensorUpdateFile(IpcSensorUpdateFile ipcSensorUpdateFile); + + /** + * 修改传感器升级文件 + * + * @param ipcSensorUpdateFile 传感器升级文件 + * @return 结果 + */ + public int updateIpcSensorUpdateFile(IpcSensorUpdateFile ipcSensorUpdateFile); + + /** + * 删除传感器升级文件 + * + * @param id 传感器升级文件主键 + * @return 结果 + */ + public int deleteIpcSensorUpdateFileById(Long id); + + /** + * 批量删除传感器升级文件 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteIpcSensorUpdateFileByIds(Long[] ids); +} diff --git a/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/service/IIpcSensorUpdateFileService.java b/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/service/IIpcSensorUpdateFileService.java new file mode 100644 index 0000000..cf0f041 --- /dev/null +++ b/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/service/IIpcSensorUpdateFileService.java @@ -0,0 +1,68 @@ +package com.inspur.ipc.service; + +import java.util.List; +import com.inspur.ipc.domain.IpcSensorUpdateFile; + +/** + * 传感器升级文件Service接口 + * + * @author zhanghan11 + * @date 2024-08-12 + */ +public interface IIpcSensorUpdateFileService +{ + /** + * 查询最新传感器升级文件 + * + * @return 传感器升级文件 + */ + public IpcSensorUpdateFile selectLastestIpcSensorUpdateFile(); + + /** + * 查询传感器升级文件 + * + * @param id 传感器升级文件主键 + * @return 传感器升级文件 + */ + public IpcSensorUpdateFile selectIpcSensorUpdateFileById(Long id); + + /** + * 查询传感器升级文件列表 + * + * @param ipcSensorUpdateFile 传感器升级文件 + * @return 传感器升级文件集合 + */ + public List selectIpcSensorUpdateFileList(IpcSensorUpdateFile ipcSensorUpdateFile); + + /** + * 新增传感器升级文件 + * + * @param ipcSensorUpdateFile 传感器升级文件 + * @return 结果 + */ + public int insertIpcSensorUpdateFile(IpcSensorUpdateFile ipcSensorUpdateFile); + + /** + * 修改传感器升级文件 + * + * @param ipcSensorUpdateFile 传感器升级文件 + * @return 结果 + */ + public int updateIpcSensorUpdateFile(IpcSensorUpdateFile ipcSensorUpdateFile); + + /** + * 批量删除传感器升级文件 + * + * @param ids 需要删除的传感器升级文件主键集合 + * @return 结果 + */ + public int deleteIpcSensorUpdateFileByIds(Long[] ids); + + /** + * 删除传感器升级文件信息 + * + * @param id 传感器升级文件主键 + * @return 结果 + */ + public int deleteIpcSensorUpdateFileById(Long id); +} diff --git a/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/service/impl/IpcSensorUpdateFileServiceImpl.java b/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/service/impl/IpcSensorUpdateFileServiceImpl.java new file mode 100644 index 0000000..29b7865 --- /dev/null +++ b/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/service/impl/IpcSensorUpdateFileServiceImpl.java @@ -0,0 +1,104 @@ +package com.inspur.ipc.service.impl; + +import java.util.List; +import com.inspur.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.inspur.ipc.mapper.IpcSensorUpdateFileMapper; +import com.inspur.ipc.domain.IpcSensorUpdateFile; +import com.inspur.ipc.service.IIpcSensorUpdateFileService; + +/** + * 传感器升级文件Service业务层处理 + * + * @author zhanghan11 + * @date 2024-08-12 + */ +@Service +public class IpcSensorUpdateFileServiceImpl implements IIpcSensorUpdateFileService +{ + @Autowired + private IpcSensorUpdateFileMapper ipcSensorUpdateFileMapper; + + /** + * 查询最新传感器升级文件 + * + * @return 传感器升级文件 + */ + @Override + public IpcSensorUpdateFile selectLastestIpcSensorUpdateFile(){ + return ipcSensorUpdateFileMapper.selectLastestIpcSensorUpdateFile(); + } + /** + * 查询传感器升级文件 + * + * @param id 传感器升级文件主键 + * @return 传感器升级文件 + */ + @Override + public IpcSensorUpdateFile selectIpcSensorUpdateFileById(Long id) + { + return ipcSensorUpdateFileMapper.selectIpcSensorUpdateFileById(id); + } + + /** + * 查询传感器升级文件列表 + * + * @param ipcSensorUpdateFile 传感器升级文件 + * @return 传感器升级文件 + */ + @Override + public List selectIpcSensorUpdateFileList(IpcSensorUpdateFile ipcSensorUpdateFile) + { + return ipcSensorUpdateFileMapper.selectIpcSensorUpdateFileList(ipcSensorUpdateFile); + } + + /** + * 新增传感器升级文件 + * + * @param ipcSensorUpdateFile 传感器升级文件 + * @return 结果 + */ + @Override + public int insertIpcSensorUpdateFile(IpcSensorUpdateFile ipcSensorUpdateFile) + { + ipcSensorUpdateFile.setCreateTime(DateUtils.getNowDate()); + return ipcSensorUpdateFileMapper.insertIpcSensorUpdateFile(ipcSensorUpdateFile); + } + + /** + * 修改传感器升级文件 + * + * @param ipcSensorUpdateFile 传感器升级文件 + * @return 结果 + */ + @Override + public int updateIpcSensorUpdateFile(IpcSensorUpdateFile ipcSensorUpdateFile) + { + return ipcSensorUpdateFileMapper.updateIpcSensorUpdateFile(ipcSensorUpdateFile); + } + + /** + * 批量删除传感器升级文件 + * + * @param ids 需要删除的传感器升级文件主键 + * @return 结果 + */ + @Override + public int deleteIpcSensorUpdateFileByIds(Long[] ids) + { + return ipcSensorUpdateFileMapper.deleteIpcSensorUpdateFileByIds(ids); + } + + /** + * 删除传感器升级文件信息 + * + * @param id 传感器升级文件主键 + * @return 结果 + */ + @Override + public int deleteIpcSensorUpdateFileById(Long id) + { + return ipcSensorUpdateFileMapper.deleteIpcSensorUpdateFileById(id); + } +} diff --git a/tzipc-server/tzipc-system/src/main/java/com/inspur/system/service/impl/SysConfigServiceImpl.java b/tzipc-server/tzipc-system/src/main/java/com/inspur/system/service/impl/SysConfigServiceImpl.java index 78b8c46..ad4e048 100644 --- a/tzipc-server/tzipc-system/src/main/java/com/inspur/system/service/impl/SysConfigServiceImpl.java +++ b/tzipc-server/tzipc-system/src/main/java/com/inspur/system/service/impl/SysConfigServiceImpl.java @@ -116,14 +116,12 @@ public class SysConfigServiceImpl implements ISysConfigService */ @Override public Map selectSharedKeys(){ - Map parameter = new HashMap<>(); + Map returnMap = new HashMap<>(); Map map = new HashMap<>(); map.put("time",Integer.parseInt(selectConfigByKey("shared.time"))); map.put("otaflag",selectConfigByKey("shared.otaflag")); map.put("ver",selectConfigByKey("shared.ver")); - parameter.put("parameter",map); - Map returnMap = new HashMap<>(); - returnMap.put("shared",parameter); + returnMap.put("shared",map); return returnMap; } diff --git a/tzipc-server/tzipc-system/src/main/resources/mapper/ipc/IpcSensorUpdateFileMapper.xml b/tzipc-server/tzipc-system/src/main/resources/mapper/ipc/IpcSensorUpdateFileMapper.xml new file mode 100644 index 0000000..627a5b1 --- /dev/null +++ b/tzipc-server/tzipc-system/src/main/resources/mapper/ipc/IpcSensorUpdateFileMapper.xml @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + select id, ver, path, remark, create_time, del_flag + from ipc_sensor_update_file + + + + + + + + + + + insert into ipc_sensor_update_file + + id, + ver, + path, + remark, + create_time, + del_flag, + + + #{id}, + #{ver}, + #{path}, + #{remark}, + #{createTime}, + #{delFlag}, + + + + + update ipc_sensor_update_file + + ver = #{ver}, + path = #{path}, + remark = #{remark}, + create_time = #{createTime}, + del_flag = #{delFlag}, + + where id = #{id} + + + + update ipc_sensor_update_file + set del_flag='2' + where id = #{id} + + + + update ipc_sensor_update_file set del_flag='2' where id in + + #{id} + + + diff --git a/tzipc-ui/src/api/ipc/sensorUpdateFile.js b/tzipc-ui/src/api/ipc/sensorUpdateFile.js new file mode 100644 index 0000000..47c4682 --- /dev/null +++ b/tzipc-ui/src/api/ipc/sensorUpdateFile.js @@ -0,0 +1,44 @@ +import request from '@/utils/request' + +// 查询传感器升级文件列表 +export function listSensorUpdateFile(query) { + return request({ + url: '/ipc/sensorUpdateFile/list', + method: 'get', + params: query + }) +} + +// 查询传感器升级文件详细 +export function getSensorUpdateFile(id) { + return request({ + url: '/ipc/sensorUpdateFile/' + id, + method: 'get' + }) +} + +// 新增传感器升级文件 +export function addSensorUpdateFile(data) { + return request({ + url: '/ipc/sensorUpdateFile', + method: 'post', + data: data + }) +} + +// 修改传感器升级文件 +export function updateSensorUpdateFile(data) { + return request({ + url: '/ipc/sensorUpdateFile', + method: 'put', + data: data + }) +} + +// 删除传感器升级文件 +export function delSensorUpdateFile(id) { + return request({ + url: '/ipc/sensorUpdateFile/' + id, + method: 'delete' + }) +} diff --git a/tzipc-ui/src/plugins/download.js b/tzipc-ui/src/plugins/download.js index d807d10..d6ecbb2 100644 --- a/tzipc-ui/src/plugins/download.js +++ b/tzipc-ui/src/plugins/download.js @@ -8,6 +8,24 @@ import { blobValidate } from "@/utils/tzipc"; const baseURL = process.env.VUE_APP_BASE_API; export default { + downloadUpdateFile(name) { + var url = + baseURL + "/ipc/sensorUpdateFile/download?fileName=" + encodeURI(name); + axios({ + method: "get", + url: url, + responseType: "blob", + headers: { Authorization: "Bearer " + getToken() }, + }).then(async (res) => { + const isLogin = await blobValidate(res.data); + if (isLogin) { + const blob = new Blob([res.data]); + this.saveAs(blob, decodeURI(res.headers["download-filename"])); + } else { + this.printErrMsg(res.data); + } + }); + }, name(name, isDelete = true) { var url = baseURL + diff --git a/tzipc-ui/src/views/ipc/sensorUpdateFile/index.vue b/tzipc-ui/src/views/ipc/sensorUpdateFile/index.vue new file mode 100644 index 0000000..54ec24f --- /dev/null +++ b/tzipc-ui/src/views/ipc/sensorUpdateFile/index.vue @@ -0,0 +1,376 @@ + + +