设备程序版本分页程序

This commit is contained in:
caozehui
2026-04-20 14:19:55 +08:00
parent 353a4cc83b
commit 00ccff18c0
14 changed files with 467 additions and 256 deletions

View File

@@ -59,6 +59,11 @@
<version>4.4.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.eclipse.paho</groupId>
<artifactId>org.eclipse.paho.client.mqttv3</artifactId>
<version>1.2.5</version>
</dependency>
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

View File

@@ -1,12 +1,16 @@
package com.njcn.csdevice.api;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.njcn.common.pojo.constant.ServerInfo;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.csdevice.api.fallback.CsEdDataFeignClientFallbackFactory;
import com.njcn.csdevice.pojo.param.CsEdDataQueryParm;
import com.njcn.csdevice.pojo.po.CsEdDataPO;
import com.njcn.csdevice.pojo.vo.CsEdDataVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;

View File

@@ -115,4 +115,9 @@ public class CsEquipmentDeliveryDTO {
* 日志等级(NORMAL、DEBUG、WARN、ERROR)
*/
private String devLogLevel;
/**
* 设备软件信息id
*/
private String softinfoId;
}

View File

@@ -0,0 +1,15 @@
package com.njcn.csdevice.pojo.param;
import com.njcn.web.pojo.param.BaseParam;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* @author caozehui
* @data 2026-04-07
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class DevVersionParam extends BaseParam {
private String keyword;
}

View File

@@ -10,7 +10,6 @@ import lombok.EqualsAndHashCode;
import java.util.Date;
/**
*
* Description:
* 接口文档访问地址http://serverIP:port/swagger-ui.html
* Date: 2023/4/7 11:29【需求编号】
@@ -88,6 +87,10 @@ public class CsEdDataPO extends BaseEntity {
@TableField(value = "file_path")
private String filePath;
/**
* crc校验
*/
@TableField(value = "crc")
private String crc;
}

View File

@@ -147,5 +147,4 @@ public class CsEquipmentDeliveryPO extends BaseEntity {
*/
@TableField(value = "associated_project")
private String associatedProject;
}

View File

@@ -70,12 +70,11 @@ public class CsEdDataVO extends BaseEntity {
@ApiModelProperty(value = "版本类型")
private String versionType;
@ApiModelProperty(value = "crc信息")
private String crcInfo;
@ApiModelProperty(value = ".bin文件")
private String filePath;
@ApiModelProperty(value = "CRC校验")
private String crc;
}

View File

@@ -0,0 +1,78 @@
package com.njcn.csdevice.pojo.vo;
import lombok.Data;
import java.time.LocalDateTime;
import java.util.Date;
/**
* @author caozehui
* @data 2026-04-07
*/
@Data
public class DevVersionVO {
/**
* 设备Id
*/
private String id;
/**
* 设备名称
*/
private String name;
/**
* 版本号
*/
private String version;
/**
* 协议版本号
*/
private String protocolVersion;
/**
* 版本日期
*/
private Date versionDate;
/**
* 设备型号
*/
private String devModel;
/**
* 设备类型名称
*/
private String devTypeName;
/**
* ICD型号
*/
private String icd;
/**
* 所属工程
*/
private String associatedEngineering;
/**
* 所属项目
*/
private String associatedProject;
/**
* 装置启用状态(0:停用 1:启用)
*/
private Integer status;
/**
* 更新时间
*/
private LocalDateTime updateTime;
/**
* 修改人员
*/
private String updateBy;
}

View File

@@ -14,7 +14,9 @@ import com.njcn.csdevice.enums.DeviceOperate;
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
import com.njcn.csdevice.pojo.param.*;
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
import com.njcn.csdevice.pojo.po.CsLogsPO;
import com.njcn.csdevice.pojo.vo.CsEquipmentDeliveryVO;
import com.njcn.csdevice.pojo.vo.DevVersionVO;
import com.njcn.csdevice.pojo.vo.DeviceManagerVO;
import com.njcn.csdevice.pojo.vo.ProjectEquipmentVO;
import com.njcn.csdevice.service.CsDevModelRelationService;
@@ -28,6 +30,7 @@ import com.njcn.system.enums.DicDataTypeEnum;
import com.njcn.system.pojo.po.SysDicTreePO;
import com.njcn.web.advice.DeviceLog;
import com.njcn.web.controller.BaseController;
import com.njcn.web.pojo.param.BaseParam;
import io.swagger.annotations.*;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@@ -46,6 +49,7 @@ import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* Description:
* 接口文档访问地址http://serverIP:port/swagger-ui.html
@@ -416,4 +420,16 @@ public class EquipmentDeliveryController extends BaseController {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/version/page")
@ApiOperation("查询设备版本信息")
@ApiImplicitParam(name = "baseParam", value = "查询日志参数", required = true)
public HttpResult<IPage<DevVersionVO>> versionPage(@RequestBody BaseParam baseParam) {
String methodDescribe = getMethodDescribe("versionPage");
IPage<DevVersionVO> list = csEquipmentDeliveryService.versionPage(baseParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
}
}

View File

@@ -48,5 +48,13 @@ public interface CsEdDataService extends IService<CsEdDataPO> {
* @author: xuyang
*/
CsEdDataVO findByDevTypeId(String devType);
/**
* @Description: 根据装置型号和版本号获取装置类型
* @param devTypeId 装置型号
* @param versionNo 版本号
* @return
*/
CsEdDataPO findByDevTypeIdAndVersionNo(String devTypeId, String versionNo);
}

View File

@@ -3,14 +3,15 @@ package com.njcn.csdevice.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.njcn.csdevice.pojo.param.CsEquipmentDeliveryAddParm;
import com.njcn.csdevice.pojo.param.CsEquipmentDeliveryAuditParm;
import com.njcn.csdevice.pojo.param.CsEquipmentDeliveryQueryParm;
import com.njcn.csdevice.pojo.param.ProjectEquipmentQueryParm;
import com.njcn.csdevice.pojo.param.*;
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
import com.njcn.csdevice.pojo.po.CsLogsPO;
import com.njcn.csdevice.pojo.vo.CsEquipmentDeliveryVO;
import com.njcn.csdevice.pojo.vo.DevVersionVO;
import com.njcn.csdevice.pojo.vo.DeviceManagerVO;
import com.njcn.csdevice.pojo.vo.ProjectEquipmentVO;
import com.njcn.web.pojo.param.BaseParam;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
@@ -195,4 +196,5 @@ public interface CsEquipmentDeliveryService extends IService<CsEquipmentDelivery
List<CsEquipmentDeliveryPO> getRunPortableDev(String userId);
IPage<DevVersionVO> versionPage(BaseParam baseParam);
}

View File

@@ -1,5 +1,6 @@
package com.njcn.csdevice.service.impl;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -42,7 +43,8 @@ public class CsEdDataServiceImpl extends ServiceImpl<CsEdDataMapper, CsEdDataPO>
public boolean addEdData(CsEdDataAddParm csEdDataAddParm) {
CsEdDataPO csEdDataPO = new CsEdDataPO();
BeanUtils.copyProperties(csEdDataAddParm, csEdDataPO);
String filePath = fileStorageUtil.uploadMultipart (csEdDataAddParm.getFile (), OssPath.EDDATA);
String remoteDir = OssPath.EDDATA + csEdDataAddParm.getDevTypeName() + StrUtil.SLASH + csEdDataAddParm.getVersionNo() + StrUtil.SLASH;
String filePath = fileStorageUtil.uploadMultipart(csEdDataAddParm.getFile(), remoteDir);
csEdDataPO.setFilePath(filePath);
csEdDataPO.setStatus("1");
boolean save = this.save(csEdDataPO);
@@ -84,5 +86,11 @@ public class CsEdDataServiceImpl extends ServiceImpl<CsEdDataMapper, CsEdDataPO>
BeanUtils.copyProperties(csEdDataPo, csEdDataVo);
return csEdDataVo;
}
public CsEdDataPO findByDevTypeIdAndVersionNo(String devTypeId, String versionNo) {
return this.lambdaQuery().eq(CsEdDataPO::getDevType, devTypeId)
.eq(CsEdDataPO::getVersionNo, versionNo)
.eq(CsEdDataPO::getStatus, 1).one();
}
}

View File

@@ -5,11 +5,13 @@ import cn.afterturn.easypoi.excel.ExcelImportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.ImportParams;
import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.text.StrPool;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.nacos.client.naming.utils.CollectionUtils;
@@ -35,6 +37,7 @@ import com.njcn.csdevice.pojo.dto.PqsCommunicateDto;
import com.njcn.csdevice.pojo.param.*;
import com.njcn.csdevice.pojo.po.*;
import com.njcn.csdevice.pojo.vo.CsEquipmentDeliveryVO;
import com.njcn.csdevice.pojo.vo.DevVersionVO;
import com.njcn.csdevice.pojo.vo.DeviceManagerVO;
import com.njcn.csdevice.pojo.vo.ProjectEquipmentVO;
import com.njcn.csdevice.service.*;
@@ -55,6 +58,8 @@ import com.njcn.system.enums.DicDataTypeEnum;
import com.njcn.system.pojo.po.SysDicTreePO;
import com.njcn.system.pojo.vo.DictTreeVO;
import com.njcn.user.enums.AppRoleEnum;
import com.njcn.web.factory.PageFactory;
import com.njcn.web.pojo.param.BaseParam;
import com.njcn.web.utils.RequestUtil;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang.StringUtils;
@@ -76,8 +81,8 @@ import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;
/**
*
* Description:
* 接口文档访问地址http://serverIP:port/swagger-ui.html
* Date: 2023/3/30 16:23【需求编号】
@@ -112,6 +117,10 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
private final CsTerminalLogsMapper csTerminalLogsMapper;
private final ICsCommunicateService csCommunicateService;
private final ICsUserPinsService csUserPinsService;
private final CsEngineeringService csEngineeringService;
private final AppProjectService appProjectService;
private final CsEdDataService csEdDataService;
private final ICsSoftInfoService csSoftInfoService;
private final EngineeringFeignClient engineeringFeignClient;
private final EventUserFeignClient eventUserFeignClient;
@@ -226,6 +235,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
return result;
}
BeanUtils.copyProperties(csEquipmentDeliveryPO, result);
BeanUtils.copyProperties (csEquipmentDeliveryPO,result);
if(!Objects.isNull (csEquipmentDeliveryPO.getAssociatedEngineering()) && !Objects.equals(csEquipmentDeliveryPO.getAssociatedEngineering(),"")) {
result.setAssociatedEngineeringName(csLedgerService.findDataById(csEquipmentDeliveryPO.getAssociatedEngineering()).getName());
}
@@ -833,6 +843,11 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
@Transactional(rollbackFor = Exception.class)
public CsEquipmentDeliveryPO saveCld(CsEquipmentDeliveryAddParm param) {
boolean result;
//设备名称可以重复
//CsEquipmentDeliveryPO one = this.lambdaQuery().eq(CsEquipmentDeliveryPO::getName, param.getName()).ne(CsEquipmentDeliveryPO::getRunStatus, 0).one();
//if(Objects.nonNull (one)){
// throw new BusinessException ("设备名称不能重复");
//}
StringUtil.containsSpecialCharacters(param.getNdid());
CsEquipmentDeliveryPO po = this.queryEquipmentPOByndid(param.getNdid());
if (!Objects.isNull(po)) {
@@ -1089,6 +1104,59 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
return this.lambdaQuery().in(CsEquipmentDeliveryPO::getId, devList).list();
}
@Override
public IPage<DevVersionVO> versionPage(BaseParam baseParam) {
LambdaQueryWrapper<CsEquipmentDeliveryPO> wrapper = new LambdaQueryWrapper<>();
wrapper.ne(CsEquipmentDeliveryPO::getRunStatus, 0)
.like(StrUtil.isNotBlank(baseParam.getSearchValue()), CsEquipmentDeliveryPO::getName, baseParam.getSearchValue());
Page<CsEquipmentDeliveryPO> page = this.page(new Page<>(PageFactory.getPageNum(baseParam), PageFactory.getPageSize(baseParam)), wrapper);
List<DevVersionVO> records = new ArrayList<>();
page.getRecords().forEach(item -> {
DevVersionVO devVersionVO = BeanUtil.copyProperties(item, DevVersionVO.class);
if (StrUtil.isNotBlank(item.getSoftinfoId())) {
// CsEdDataVO csEdDataVO = csEdDataService.findByDevTypeId(item.getDevModel());
CsSoftInfoPO softInfoPO = csSoftInfoService.getById(item.getSoftinfoId());
if (ObjectUtil.isNotNull(softInfoPO)) {
CsEdDataPO csEdDataPO = csEdDataService.findByDevTypeIdAndVersionNo(item.getDevModel(), softInfoPO.getAppVersion());
if (ObjectUtil.isNotNull(csEdDataPO)) {
devVersionVO.setDevTypeName(csEdDataPO.getDevTypeName());
devVersionVO.setVersion(csEdDataPO.getVersionNo());
devVersionVO.setProtocolVersion(csEdDataPO.getVersionAgreement());
devVersionVO.setVersionDate(csEdDataPO.getVersionDate());
}
}
}
devVersionVO.setStatus(item.getUsageStatus());
devVersionVO.setIcd("aaa");
if (StrUtil.isNotBlank(item.getDevModel())) {
SysDicTreePO sysDicTreePO = dictTreeFeignClient.queryById(item.getDevModel()).getData();
if (ObjectUtil.isNotNull(sysDicTreePO)) {
devVersionVO.setDevModel(sysDicTreePO.getName());
}
}
if (StrUtil.isNotBlank(item.getAssociatedEngineering())) {
devVersionVO.setAssociatedEngineering(csEngineeringService.getById(item.getAssociatedEngineering()).getName());
}
if (StrUtil.isNotBlank(item.getAssociatedProject())) {
devVersionVO.setAssociatedProject(appProjectService.getById(item.getAssociatedProject()).getName());
}
records.add(devVersionVO);
});
Page<DevVersionVO> resultPage = new Page<>(PageFactory.getPageNum(baseParam), PageFactory.getPageSize(baseParam));
resultPage.setRecords(records);
resultPage.setTotal(page.getTotal());
resultPage.setMaxLimit(page.getMaxLimit());
resultPage.setPages(page.getPages());
return resultPage;
}
@Override
public List<CsEquipmentDeliveryPO> getRunPortableDev(String userId) {
List<CsEquipmentDeliveryPO> result = new ArrayList<>();
@@ -1150,6 +1218,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
/**
* 根据ndid生成二维码
*
* @param ndid
* @return
*/

View File

@@ -39,10 +39,10 @@
<!-- <nacos.namespace>b0b0dedf-baa9-407f-bef6-988b9e0a640d</nacos.namespace>-->
<middle.server.url>192.168.1.103</middle.server.url>
<service.server.url>192.168.2.126</service.server.url>
<service.server.url>192.168.2.124</service.server.url>
<docker.server.url>192.168.1.103</docker.server.url>
<nacos.url>${middle.server.url}:18848</nacos.url>
<nacos.namespace>72972c43-3c20-4452-a261-66624e17da97</nacos.namespace>
<nacos.namespace>cb3a03dd-47f6-4a83-9408-b3182b3d0619</nacos.namespace>
<!-- <middle.server.url>192.168.1.103</middle.server.url>-->
<!-- <service.server.url>192.168.1.103</service.server.url>-->