diff --git a/cs-device/cs-device-api/pom.xml b/cs-device/cs-device-api/pom.xml index 5903da0..6f83ba7 100644 --- a/cs-device/cs-device-api/pom.xml +++ b/cs-device/cs-device-api/pom.xml @@ -59,6 +59,11 @@ 4.4.0 compile + + org.eclipse.paho + org.eclipse.paho.client.mqttv3 + 1.2.5 + UTF-8 diff --git a/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/api/CsEdDataFeignClient.java b/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/api/CsEdDataFeignClient.java index 903f00a..20d62e3 100644 --- a/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/api/CsEdDataFeignClient.java +++ b/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/api/CsEdDataFeignClient.java @@ -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; diff --git a/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/pojo/dto/CsEquipmentDeliveryDTO.java b/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/pojo/dto/CsEquipmentDeliveryDTO.java index 4fd5e10..0ff068b 100644 --- a/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/pojo/dto/CsEquipmentDeliveryDTO.java +++ b/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/pojo/dto/CsEquipmentDeliveryDTO.java @@ -115,4 +115,9 @@ public class CsEquipmentDeliveryDTO { * 日志等级(NORMAL、DEBUG、WARN、ERROR) */ private String devLogLevel; + + /** + * 设备软件信息id + */ + private String softinfoId; } \ No newline at end of file diff --git a/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/pojo/param/DevVersionParam.java b/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/pojo/param/DevVersionParam.java new file mode 100644 index 0000000..eba5211 --- /dev/null +++ b/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/pojo/param/DevVersionParam.java @@ -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; +} diff --git a/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/pojo/po/CsEdDataPO.java b/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/pojo/po/CsEdDataPO.java index 65656ea..8225d4f 100644 --- a/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/pojo/po/CsEdDataPO.java +++ b/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/pojo/po/CsEdDataPO.java @@ -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; } \ No newline at end of file diff --git a/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/pojo/po/CsEquipmentDeliveryPO.java b/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/pojo/po/CsEquipmentDeliveryPO.java index c862f67..488cf68 100644 --- a/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/pojo/po/CsEquipmentDeliveryPO.java +++ b/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/pojo/po/CsEquipmentDeliveryPO.java @@ -147,5 +147,4 @@ public class CsEquipmentDeliveryPO extends BaseEntity { */ @TableField(value = "associated_project") private String associatedProject; - } \ No newline at end of file diff --git a/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/pojo/vo/CsEdDataVO.java b/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/pojo/vo/CsEdDataVO.java index 5a6f746..2ce6e30 100644 --- a/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/pojo/vo/CsEdDataVO.java +++ b/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/pojo/vo/CsEdDataVO.java @@ -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; } \ No newline at end of file diff --git a/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/pojo/vo/DevVersionVO.java b/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/pojo/vo/DevVersionVO.java new file mode 100644 index 0000000..d702893 --- /dev/null +++ b/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/pojo/vo/DevVersionVO.java @@ -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; +} diff --git a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/controller/equipment/EquipmentDeliveryController.java b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/controller/equipment/EquipmentDeliveryController.java index a927afc..b5bccf6 100644 --- a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/controller/equipment/EquipmentDeliveryController.java +++ b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/controller/equipment/EquipmentDeliveryController.java @@ -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 @@ -63,20 +67,20 @@ public class EquipmentDeliveryController extends BaseController { private final CsEquipmentDeliveryService csEquipmentDeliveryService; private final IMqttUserService mqttUserService; private final CsDevModelRelationService csDevModelRelationService; - private final DictTreeFeignClient dictTreeFeignClient; + private final DictTreeFeignClient dictTreeFeignClient; @OperateInfo(info = LogEnum.BUSINESS_COMMON) @PostMapping("/addEquipmentDelivery") @ApiOperation("新增出厂设备") @ApiImplicitParam(name = "csEquipmentDeliveryAddParm", value = "新增项目参数", required = true) @DeviceLog(operateType = DeviceOperate.ADD) - public HttpResult addEquipmentDelivery(@RequestBody @Validated CsEquipmentDeliveryAddParm csEquipmentDeliveryAddParm){ + public HttpResult addEquipmentDelivery(@RequestBody @Validated CsEquipmentDeliveryAddParm csEquipmentDeliveryAddParm) { String methodDescribe = getMethodDescribe("addEquipmentDelivery"); CsEquipmentDeliveryPO po = csEquipmentDeliveryService.save(csEquipmentDeliveryAddParm); - if (Objects.nonNull(po)){ + if (Objects.nonNull(po)) { //查询mqtt用户名和密码是否存在 boolean result = mqttUserService.findMqttUser(csEquipmentDeliveryAddParm.getNdid()); - if (result){ + if (result) { //初始化装置mqtt连接信息(使用sha256加密) mqttUserService.insertMqttUser(csEquipmentDeliveryAddParm.getNdid()); } @@ -88,7 +92,7 @@ public class EquipmentDeliveryController extends BaseController { @PostMapping("/AuditEquipmentDelivery") @ApiOperation("删除出厂设备") @DeviceLog(operateType = DeviceOperate.DELETE) - public HttpResult AuditEquipmentDelivery(@RequestParam("id")String id ){ + public HttpResult AuditEquipmentDelivery(@RequestParam("id") String id) { String methodDescribe = getMethodDescribe("AuditEquipmentDelivery"); Boolean flag = csEquipmentDeliveryService.AuditEquipmentDelivery(id); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe); @@ -99,13 +103,13 @@ public class EquipmentDeliveryController extends BaseController { @ApiOperation("修改出厂设备") @DeviceLog(operateType = DeviceOperate.UPDATE) @ApiImplicitParam(name = "csEquipmentDeliveryAuditParm", value = "新增项目参数", required = true) - public HttpResult updateEquipmentDelivery(@RequestBody @Validated CsEquipmentDeliveryAuditParm csEquipmentDeliveryAuditParm ){ + public HttpResult updateEquipmentDelivery(@RequestBody @Validated CsEquipmentDeliveryAuditParm csEquipmentDeliveryAuditParm) { String methodDescribe = getMethodDescribe("updateEquipmentDelivery"); Boolean flag = csEquipmentDeliveryService.updateEquipmentDelivery(csEquipmentDeliveryAuditParm); - if (flag){ + if (flag) { //查询mqtt用户名和密码是否存在 boolean result = mqttUserService.findMqttUser(csEquipmentDeliveryAuditParm.getNdid()); - if (result){ + if (result) { //初始化装置mqtt连接信息(使用sha256加密) mqttUserService.insertMqttUser(csEquipmentDeliveryAuditParm.getNdid()); } @@ -117,9 +121,9 @@ public class EquipmentDeliveryController extends BaseController { @PostMapping("/queryEquipmentByndid") @ApiOperation("通过ndid查询出厂设备") @ApiImplicitParam(name = "ndid", value = "网关识别码", required = true) - public HttpResult queryEquipmentByndid(@RequestParam("ndid")String ndid){ + public HttpResult queryEquipmentByndid(@RequestParam("ndid") String ndid) { String methodDescribe = getMethodDescribe("queryEquipmentByndid"); - CsEquipmentDeliveryVO csEquipmentDeliveryVO = csEquipmentDeliveryService.queryEquipmentByndid (ndid); + CsEquipmentDeliveryVO csEquipmentDeliveryVO = csEquipmentDeliveryService.queryEquipmentByndid(ndid); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, csEquipmentDeliveryVO, methodDescribe); } @@ -127,9 +131,9 @@ public class EquipmentDeliveryController extends BaseController { @PostMapping("/queryEquipmentByProject") @ApiOperation("通过项目查询出厂设备") @ApiImplicitParam(name = "projectEquipmentQueryParm", value = "项目信息", required = true) - public HttpResult> queryEquipmentByProject(@RequestBody ProjectEquipmentQueryParm projectEquipmentQueryParm){ + public HttpResult> queryEquipmentByProject(@RequestBody ProjectEquipmentQueryParm projectEquipmentQueryParm) { String methodDescribe = getMethodDescribe("queryEquipmentByProject"); - IPage projectEquipmentVos = csEquipmentDeliveryService.queryEquipmentByProject(projectEquipmentQueryParm); + IPage projectEquipmentVos = csEquipmentDeliveryService.queryEquipmentByProject(projectEquipmentQueryParm); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, projectEquipmentVos, methodDescribe); } @@ -141,9 +145,9 @@ public class EquipmentDeliveryController extends BaseController { @ApiImplicitParam(name = "status", value = "状态", required = true) }) @DeviceLog(operateType = DeviceOperate.UPDATESTATUSBYNDID) - public HttpResult updateStatusBynDid(@RequestParam("nDId") String nDid,@RequestParam("status") Integer status){ + public HttpResult updateStatusBynDid(@RequestParam("nDId") String nDid, @RequestParam("status") Integer status) { String methodDescribe = getMethodDescribe("updateStatusBynDid"); - csEquipmentDeliveryService.updateStatusBynDid(nDid,status); + csEquipmentDeliveryService.updateStatusBynDid(nDid, status); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); } @@ -151,7 +155,7 @@ public class EquipmentDeliveryController extends BaseController { @PostMapping("/queryEquipmentById") @ApiOperation("设备查询通过id获取") @ApiImplicitParam(name = "ids", value = "设备id集合", required = true) - public HttpResult> queryEquipmentById(@RequestParam List ids){ + public HttpResult> queryEquipmentById(@RequestParam List ids) { String methodDescribe = getMethodDescribe("queryEquipmentById"); if (CollectionUtil.isEmpty(ids)) { return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); @@ -171,7 +175,7 @@ public class EquipmentDeliveryController extends BaseController { @PostMapping("/list") @ApiOperation("出厂设备列表") @ApiImplicitParam(name = "param", value = "查询参数", required = true) - public HttpResult> list(@RequestBody CsEquipmentDeliveryQueryParm param){ + public HttpResult> list(@RequestBody CsEquipmentDeliveryQueryParm param) { String methodDescribe = getMethodDescribe("list"); Page page = csEquipmentDeliveryService.list(param); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe); @@ -185,9 +189,9 @@ public class EquipmentDeliveryController extends BaseController { @ApiImplicitParam(name = "type", value = "类型", required = true), @ApiImplicitParam(name = "lineId", value = "监测点id", required = false) }) - public HttpResult getDeviceData(@RequestParam String deviceId,@RequestParam String type,@RequestParam String lineId){ + public HttpResult getDeviceData(@RequestParam String deviceId, @RequestParam String type, @RequestParam String lineId) { String methodDescribe = getMethodDescribe("getDeviceData"); - DeviceManagerVO vo = csEquipmentDeliveryService.getDeviceData(deviceId,type,lineId); + DeviceManagerVO vo = csEquipmentDeliveryService.getDeviceData(deviceId, type, lineId); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, vo, methodDescribe); } @@ -200,9 +204,9 @@ public class EquipmentDeliveryController extends BaseController { @ApiImplicitParam(name = "module", value = "模块个数", required = true) }) @Deprecated - public HttpResult updateSoftInfoBynDid(@RequestParam("nDId") String nDid,@RequestParam("id") String id,@RequestParam("module") Integer module){ + public HttpResult updateSoftInfoBynDid(@RequestParam("nDId") String nDid, @RequestParam("id") String id, @RequestParam("module") Integer module) { String methodDescribe = getMethodDescribe("updateSoftInfoBynDid"); - csEquipmentDeliveryService.updateSoftInfoBynDid(nDid,id,module); + csEquipmentDeliveryService.updateSoftInfoBynDid(nDid, id, module); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); } @@ -210,9 +214,9 @@ public class EquipmentDeliveryController extends BaseController { @PostMapping("/findDevByNDid") @ApiOperation("通过nDid查询设备信息") @ApiImplicitParam(name = "nDid", value = "网关识别码", required = true) - public HttpResult findDevByNDid(@RequestParam("nDid")String nDid){ + public HttpResult findDevByNDid(@RequestParam("nDid") String nDid) { String methodDescribe = getMethodDescribe("findDevByNDid"); - CsEquipmentDeliveryPO po = csEquipmentDeliveryService.findDevByNDid(nDid); + CsEquipmentDeliveryPO po = csEquipmentDeliveryService.findDevByNDid(nDid); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, po, methodDescribe); } @@ -225,13 +229,13 @@ public class EquipmentDeliveryController extends BaseController { exportParams.setStyle(ExcelStyleUtil.class); Workbook workbook = ExcelExportUtil.exportExcel(exportParams, DeviceExcelTemplete.class, new ArrayList()); List deviceType = dictTreeFeignClient.queryByCodeList(DicDataTypeEnum.DEVICE_TYPE.getCode()).getData(); - if(!CollectionUtils.isEmpty(deviceType)){ + if (!CollectionUtils.isEmpty(deviceType)) { List collect = deviceType.get(0).getChildren().stream().map(SysDicTreePO::getName).collect(Collectors.toList()); ExcelUtil.selectList(workbook, 2, 2, collect.toArray(new String[]{})); List collect2 = deviceType.get(0).getChildren().stream().map(SysDicTreePO::getChildren).flatMap(Collection::stream).map(SysDicTreePO::getName).collect(Collectors.toList()); ExcelUtil.selectList(workbook, 3, 3, collect2.toArray(new String[]{})); } - ExcelUtil.selectList(workbook, 4, 4, Stream.of("MQTT","CLD").collect(Collectors.toList()).toArray(new String[]{})); + ExcelUtil.selectList(workbook, 4, 4, Stream.of("MQTT", "CLD").collect(Collectors.toList()).toArray(new String[]{})); String fileName = "设备模板.xlsx"; ExportParams exportExcel = new ExportParams("设备模板", "设备模板"); PoiUtil.exportFileByWorkbook(workbook, fileName, response); @@ -244,11 +248,11 @@ public class EquipmentDeliveryController extends BaseController { public HttpResult importEquipment(@ApiParam(value = "文件", required = true) @RequestPart("file") MultipartFile file, HttpServletResponse response) { String methodDescribe = getMethodDescribe("importEquipment"); List csEquipmentDeliveryPOS = csEquipmentDeliveryService.importEquipment(file, response); - if (!CollectionUtils.isEmpty(csEquipmentDeliveryPOS)){ - csEquipmentDeliveryPOS.forEach(temp->{ + if (!CollectionUtils.isEmpty(csEquipmentDeliveryPOS)) { + csEquipmentDeliveryPOS.forEach(temp -> { //查询mqtt用户名和密码是否存在 boolean result = mqttUserService.findMqttUser(temp.getNdid()); - if (result){ + if (result) { //初始化装置mqtt连接信息(使用sha256加密) mqttUserService.insertMqttUser(temp.getNdid()); } @@ -260,18 +264,18 @@ public class EquipmentDeliveryController extends BaseController { @ResponseBody @ApiOperation("联调完成") @PostMapping(value = "testcompletion") - public HttpResult testCompletion(@RequestParam("deviceId") String deviceId,@RequestParam("type") Integer type,@RequestParam("remark") String remark){ + public HttpResult testCompletion(@RequestParam("deviceId") String deviceId, @RequestParam("type") Integer type, @RequestParam("remark") String remark) { String methodDescribe = getMethodDescribe("testCompletion"); - csEquipmentDeliveryService.testCompletion(deviceId,type, remark); + csEquipmentDeliveryService.testCompletion(deviceId, type, remark); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); } @ResponseBody @ApiOperation("取消联调") @PostMapping(value = "deleteTest") - public HttpResult deleteTest(@RequestParam("deviceId") String deviceId,@RequestParam("type") Integer type,@RequestParam("remark") String remark){ + public HttpResult deleteTest(@RequestParam("deviceId") String deviceId, @RequestParam("type") Integer type, @RequestParam("remark") String remark) { String methodDescribe = getMethodDescribe("deleteTest"); - csEquipmentDeliveryService.deleteTest(deviceId,type, remark); + csEquipmentDeliveryService.deleteTest(deviceId, type, remark); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); } @@ -283,9 +287,9 @@ public class EquipmentDeliveryController extends BaseController { @ApiImplicitParam(name = "id", value = "软件信息id", required = true) }) @ApiIgnore - public HttpResult updateSoftInfo(@RequestParam("nDid") String nDid,@RequestParam("id") String id){ + public HttpResult updateSoftInfo(@RequestParam("nDid") String nDid, @RequestParam("id") String id) { String methodDescribe = getMethodDescribe("updateSoftInfo"); - csEquipmentDeliveryService.updateSoftInfo(nDid,id); + csEquipmentDeliveryService.updateSoftInfo(nDid, id); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); } @@ -297,9 +301,9 @@ public class EquipmentDeliveryController extends BaseController { @ApiImplicitParam(name = "number", value = "模块个数", required = true) }) @ApiIgnore - public HttpResult updateModuleNumber(@RequestParam("nDid") String nDid,@RequestParam("number") Integer number){ + public HttpResult updateModuleNumber(@RequestParam("nDid") String nDid, @RequestParam("number") Integer number) { String methodDescribe = getMethodDescribe("updateModuleNumber"); - csEquipmentDeliveryService.updateModuleNumber(nDid,number); + csEquipmentDeliveryService.updateModuleNumber(nDid, number); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); } @@ -307,7 +311,7 @@ public class EquipmentDeliveryController extends BaseController { @PostMapping("/rebootDevice") @ApiOperation("重启设备") @ApiImplicitParam(name = "nDid", value = "nDid", required = true) - public HttpResult rebootDevice(@RequestParam("nDid") String nDid){ + public HttpResult rebootDevice(@RequestParam("nDid") String nDid) { String methodDescribe = getMethodDescribe("rebootDevice"); boolean result = csEquipmentDeliveryService.rebootDevice(nDid); if (result) { @@ -320,7 +324,7 @@ public class EquipmentDeliveryController extends BaseController { @OperateInfo(info = LogEnum.BUSINESS_COMMON) @PostMapping("/getAll") @ApiOperation("获取所有装置") - public HttpResult> getAll(){ + public HttpResult> getAll() { String methodDescribe = getMethodDescribe("getAll"); List result = csEquipmentDeliveryService.getAll(); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe); @@ -329,7 +333,7 @@ public class EquipmentDeliveryController extends BaseController { @OperateInfo(info = LogEnum.BUSINESS_COMMON) @PostMapping("/judgeDevModel") @ApiOperation("判断设备型号") - public HttpResult judgeDevModel(@RequestParam("nDid") String nDid){ + public HttpResult judgeDevModel(@RequestParam("nDid") String nDid) { String methodDescribe = getMethodDescribe("judgeDevModel"); boolean result = csEquipmentDeliveryService.judgeDevModel(nDid); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe); @@ -338,7 +342,7 @@ public class EquipmentDeliveryController extends BaseController { @OperateInfo(info = LogEnum.BUSINESS_COMMON) @PostMapping("/getDevByLineId") @ApiOperation("根据监测点id查询装置信息") - public HttpResult getDevByLineId(@RequestParam("lineId") String lineId){ + public HttpResult getDevByLineId(@RequestParam("lineId") String lineId) { String methodDescribe = getMethodDescribe("getDevByLineId"); CsEquipmentDeliveryPO po = csEquipmentDeliveryService.getDevByLineId(lineId); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, po, methodDescribe); @@ -349,7 +353,7 @@ public class EquipmentDeliveryController extends BaseController { @ApiOperation("新增云前置设备") @ApiImplicitParam(name = "param", value = "参数", required = true) @DeviceLog(operateType = DeviceOperate.ADD) - public HttpResult addCldDev(@RequestBody @Validated CsEquipmentDeliveryAddParm param){ + public HttpResult addCldDev(@RequestBody @Validated CsEquipmentDeliveryAddParm param) { String methodDescribe = getMethodDescribe("addCldDev"); CsEquipmentDeliveryPO po = csEquipmentDeliveryService.saveCld(param); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, po, methodDescribe); @@ -360,7 +364,7 @@ public class EquipmentDeliveryController extends BaseController { @ApiOperation("删除云前置设备") @ApiImplicitParam(name = "id", value = "id", required = true) @DeviceLog(operateType = DeviceOperate.DELETE) - public HttpResult delCldDev(@RequestParam("id") String id){ + public HttpResult delCldDev(@RequestParam("id") String id) { String methodDescribe = getMethodDescribe("delCldDev"); boolean result = csEquipmentDeliveryService.delCldDev(id); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe); @@ -371,7 +375,7 @@ public class EquipmentDeliveryController extends BaseController { @ApiOperation("修改云前置设备") @ApiImplicitParam(name = "param", value = "参数", required = true) @DeviceLog(operateType = DeviceOperate.UPDATE) - public HttpResult updateCldDev(@RequestBody @Validated CsEquipmentDeliveryAuditParm param){ + public HttpResult updateCldDev(@RequestBody @Validated CsEquipmentDeliveryAuditParm param) { String methodDescribe = getMethodDescribe("updateCldDev"); boolean result = csEquipmentDeliveryService.updateCldDev(param); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe); @@ -385,9 +389,9 @@ public class EquipmentDeliveryController extends BaseController { @ApiImplicitParam(name = "processNo", value = "进程号", required = true) }) @ApiIgnore - public HttpResult updateCldDevStatus(@RequestParam("nodeId") String nodeId, @RequestParam("processNo") Integer processNo){ + public HttpResult updateCldDevStatus(@RequestParam("nodeId") String nodeId, @RequestParam("processNo") Integer processNo) { String methodDescribe = getMethodDescribe("updateCldDevStatus"); - csEquipmentDeliveryService.updateCldDevStatus(nodeId,processNo); + csEquipmentDeliveryService.updateCldDevStatus(nodeId, processNo); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); } @@ -395,14 +399,14 @@ public class EquipmentDeliveryController extends BaseController { @PostMapping("/flipCldDevStatus") @ApiOperation("云前置设备状态翻转") @ApiImplicitParams({ - @ApiImplicitParam(name = "date", value = "时间", required = true), - @ApiImplicitParam(name = "devId", value = "设备id", required = true), - @ApiImplicitParam(name = "status", value = "状态", required = true) + @ApiImplicitParam(name = "date", value = "时间", required = true), + @ApiImplicitParam(name = "devId", value = "设备id", required = true), + @ApiImplicitParam(name = "status", value = "状态", required = true) }) @ApiIgnore - public HttpResult flipCldDevStatus(@RequestParam("date") String date, @RequestParam("devId") String devId, @RequestParam("status") Integer status){ + public HttpResult flipCldDevStatus(@RequestParam("date") String date, @RequestParam("devId") String devId, @RequestParam("status") Integer status) { String methodDescribe = getMethodDescribe("flipCldDevStatus"); - csEquipmentDeliveryService.flipCldDevStatus(date,devId,status); + csEquipmentDeliveryService.flipCldDevStatus(date, devId, status); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); } @@ -410,10 +414,22 @@ public class EquipmentDeliveryController extends BaseController { @PostMapping("/getRunPortableDev") @ApiOperation("获取用户未绑定的在运的便携式设备") @ApiImplicitParam(name = "userId", value = "用户id", required = true) - public HttpResult> getRunPortableDev(@RequestParam("userId") String userId){ + public HttpResult> getRunPortableDev(@RequestParam("userId") String userId) { String methodDescribe = getMethodDescribe("getRunPortableDev"); List result = csEquipmentDeliveryService.getRunPortableDev(userId); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe); } + + @OperateInfo(info = LogEnum.BUSINESS_COMMON) + @PostMapping("/version/page") + @ApiOperation("查询设备版本信息") + @ApiImplicitParam(name = "baseParam", value = "查询日志参数", required = true) + public HttpResult> versionPage(@RequestBody BaseParam baseParam) { + String methodDescribe = getMethodDescribe("versionPage"); + + IPage list = csEquipmentDeliveryService.versionPage(baseParam); + + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe); + } } \ No newline at end of file diff --git a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/CsEdDataService.java b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/CsEdDataService.java index 8edd5af..2fcf74d 100644 --- a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/CsEdDataService.java +++ b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/CsEdDataService.java @@ -48,5 +48,13 @@ public interface CsEdDataService extends IService { * @author: xuyang */ CsEdDataVO findByDevTypeId(String devType); + + /** + * @Description: 根据装置型号和版本号获取装置类型 + * @param devTypeId 装置型号 + * @param versionNo 版本号 + * @return + */ + CsEdDataPO findByDevTypeIdAndVersionNo(String devTypeId, String versionNo); } diff --git a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/CsEquipmentDeliveryService.java b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/CsEquipmentDeliveryService.java index 0d3b88a..5070965 100644 --- a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/CsEquipmentDeliveryService.java +++ b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/CsEquipmentDeliveryService.java @@ -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 getRunPortableDev(String userId); + IPage versionPage(BaseParam baseParam); } diff --git a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/impl/CsEdDataServiceImpl.java b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/impl/CsEdDataServiceImpl.java index 58a8943..a60d24c 100644 --- a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/impl/CsEdDataServiceImpl.java +++ b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/impl/CsEdDataServiceImpl.java @@ -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; @@ -40,33 +41,34 @@ public class CsEdDataServiceImpl extends ServiceImpl @Override @Transactional(rollbackFor = {Exception.class}) public boolean addEdData(CsEdDataAddParm csEdDataAddParm) { - CsEdDataPO csEdDataPO = new CsEdDataPO (); - BeanUtils.copyProperties (csEdDataAddParm, csEdDataPO); - String filePath = fileStorageUtil.uploadMultipart (csEdDataAddParm.getFile (), OssPath.EDDATA); - csEdDataPO.setFilePath (filePath); - csEdDataPO.setStatus ("1"); - boolean save = this.save (csEdDataPO); + CsEdDataPO csEdDataPO = new CsEdDataPO(); + BeanUtils.copyProperties(csEdDataAddParm, csEdDataPO); + 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); return save; } @Override @Transactional(rollbackFor = {Exception.class}) public Boolean auditEdData(CsEdDataAuditParm csEdDataAuditParm) { - CsEdDataPO csEdDataPO = new CsEdDataPO (); - BeanUtils.copyProperties (csEdDataAuditParm, csEdDataPO); - if(!Objects.isNull (csEdDataAuditParm.getFile ())){ - String filePath = fileStorageUtil.uploadMultipart (csEdDataAuditParm.getFile (), OssPath.EDDATA); - csEdDataPO.setFilePath (filePath); + CsEdDataPO csEdDataPO = new CsEdDataPO(); + BeanUtils.copyProperties(csEdDataAuditParm, csEdDataPO); + if (!Objects.isNull(csEdDataAuditParm.getFile())) { + String filePath = fileStorageUtil.uploadMultipart(csEdDataAuditParm.getFile(), OssPath.EDDATA); + csEdDataPO.setFilePath(filePath); } - boolean b = this.updateById (csEdDataPO); + boolean b = this.updateById(csEdDataPO); return b; } @Override public IPage queryEdDataPage(CsEdDataQueryParm csEdDataQueryParm) { - Page returnpage = new Page<> (csEdDataQueryParm.getPageNum ( ), csEdDataQueryParm.getPageSize ( )); + Page returnpage = new Page<>(csEdDataQueryParm.getPageNum(), csEdDataQueryParm.getPageSize()); - returnpage = this.getBaseMapper ().getPage(returnpage,csEdDataQueryParm); + returnpage = this.getBaseMapper().getPage(returnpage, csEdDataQueryParm); return returnpage; } @@ -74,15 +76,21 @@ public class CsEdDataServiceImpl extends ServiceImpl public CsEdDataVO findByDevTypeId(String devType) { CsEdDataPO csEdDataPo = new CsEdDataPO(); LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); - lambdaQueryWrapper.eq(CsEdDataPO::getDevType,devType); - lambdaQueryWrapper.eq(CsEdDataPO::getStatus,1); + lambdaQueryWrapper.eq(CsEdDataPO::getDevType, devType); + lambdaQueryWrapper.eq(CsEdDataPO::getStatus, 1); List list = this.baseMapper.selectList(lambdaQueryWrapper); - if (!CollectionUtils.isEmpty(list)){ + if (!CollectionUtils.isEmpty(list)) { csEdDataPo = list.get(0); } CsEdDataVO csEdDataVo = new CsEdDataVO(); - BeanUtils.copyProperties(csEdDataPo,csEdDataVo); + 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(); + } } diff --git a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/impl/CsEquipmentDeliveryServiceImpl.java b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/impl/CsEquipmentDeliveryServiceImpl.java index 195a2e0..4479229 100644 --- a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/impl/CsEquipmentDeliveryServiceImpl.java +++ b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/impl/CsEquipmentDeliveryServiceImpl.java @@ -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【需求编号】 @@ -87,7 +92,7 @@ import java.util.stream.Collectors; */ @Service @RequiredArgsConstructor -public class CsEquipmentDeliveryServiceImpl extends ServiceImpl implements CsEquipmentDeliveryService{ +public class CsEquipmentDeliveryServiceImpl extends ServiceImpl implements CsEquipmentDeliveryService { private final CsDevModelRelationService csDevModelRelationService; private final ICsDataSetService csDataSetService; private final ICsLedgerService csLedgerService; @@ -99,7 +104,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.ne(CsEquipmentDeliveryPO::getRunStatus,0); + queryWrapper.ne(CsEquipmentDeliveryPO::getRunStatus, 0); List deliveryPOS = this.list(queryWrapper); - redisUtil.saveByKey(AppRedisKey.DEVICE_LIST,deliveryPOS); + redisUtil.saveByKey(AppRedisKey.DEVICE_LIST, deliveryPOS); } @Override @@ -132,17 +141,17 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl wrapper = new QueryWrapper(); - wrapper.eq ("id", id); - boolean update = this.remove (wrapper); + wrapper.eq("id", id); + boolean update = this.remove(wrapper); //删除deviceuser表里的设备,游客数据设备,删除监测点相关数据 List list = csLedgerService.lambdaQuery().eq(CsLedger::getPid, id).list(); - if(!CollectionUtils.isEmpty(list)){ + if (!CollectionUtils.isEmpty(list)) { List collect = list.stream().map(CsLedger::getId).collect(Collectors.toList()); - LambdaQueryWrapper csLinePOLambdaQueryWrapper = new LambdaQueryWrapper<>(); - csLinePOLambdaQueryWrapper.in(CsLinePO::getLineId,collect); + LambdaQueryWrapper csLinePOLambdaQueryWrapper = new LambdaQueryWrapper<>(); + csLinePOLambdaQueryWrapper.in(CsLinePO::getLineId, collect); csLinePOService.remove(csLinePOLambdaQueryWrapper); QueryWrapper appLineTopologyDiagramPOQueryWrapper = new QueryWrapper<>(); appLineTopologyDiagramPOQueryWrapper.clear(); - appLineTopologyDiagramPOQueryWrapper.in("line_id",collect); + appLineTopologyDiagramPOQueryWrapper.in("line_id", collect); appLineTopologyDiagramService.remove(appLineTopologyDiagramPOQueryWrapper); // appLineTopologyDiagramService.lambdaUpdate().in(AppLineTopologyDiagramPO::getLineId,collect).set(AppLineTopologyDiagramPO::getStatus,0).update(); } - LambdaQueryWrapper csLedgerLambdaQueryWrapper = new LambdaQueryWrapper<>(); + LambdaQueryWrapper csLedgerLambdaQueryWrapper = new LambdaQueryWrapper<>(); csLedgerLambdaQueryWrapper.clear(); - csLedgerLambdaQueryWrapper.eq(CsLedger::getId,id); + csLedgerLambdaQueryWrapper.eq(CsLedger::getId, id); csLedgerService.remove(csLedgerLambdaQueryWrapper); csLedgerLambdaQueryWrapper.clear(); - csLedgerLambdaQueryWrapper.eq(CsLedger::getPid,id); + csLedgerLambdaQueryWrapper.eq(CsLedger::getPid, id); csLedgerService.remove(csLedgerLambdaQueryWrapper); - csDeviceUserPOService.lambdaUpdate().eq(CsDeviceUserPO::getDeviceId,id).set(CsDeviceUserPO::getStatus,0).update(); + csDeviceUserPOService.lambdaUpdate().eq(CsDeviceUserPO::getDeviceId, id).set(CsDeviceUserPO::getStatus, 0).update(); QueryWrapper queryWrap = new QueryWrapper<>(); - queryWrap.eq("device_id",id); + queryWrap.eq("device_id", id); csTouristDataPOService.getBaseMapper().delete(queryWrap); /*后续徐那边做处理*/ // CsEquipmentDeliveryPO csEquipmentDeliveryPO = this.getBaseMapper().selectById(id); // mqttUserService.deleteUser(csEquipmentDeliveryPO.getNdid()); - csDevModelRelationService.lambdaUpdate().eq(CsDevModelRelationPO::getDevId,id).set(CsDevModelRelationPO::getStatus,0).update(); + csDevModelRelationService.lambdaUpdate().eq(CsDevModelRelationPO::getDevId, id).set(CsDevModelRelationPO::getStatus, 0).update(); if (update) { refreshDeviceDataCache(); } @@ -221,10 +230,11 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl wrapper = new QueryWrapper(); - wrapper.eq ("ndid", ndid); - wrapper.ne("run_status",0); - CsEquipmentDeliveryPO csEquipmentDeliveryPO = this.baseMapper.selectOne (wrapper); + wrapper.eq("ndid", ndid); + wrapper.ne("run_status", 0); + CsEquipmentDeliveryPO csEquipmentDeliveryPO = this.baseMapper.selectOne(wrapper); return csEquipmentDeliveryPO; } @Override public IPage queryEquipmentByProject(ProjectEquipmentQueryParm projectEquipmentQueryParm) { - Page returnpage = new Page<> (projectEquipmentQueryParm.getPageNum ( ), projectEquipmentQueryParm.getPageSize ( )); + Page returnpage = new Page<>(projectEquipmentQueryParm.getPageNum(), projectEquipmentQueryParm.getPageSize()); List device = roleEngineerDevService.getDevice(); - if(CollectionUtils.isEmpty(device)){ + if (CollectionUtils.isEmpty(device)) { return returnpage; } - Page list = this.baseMapper.queryProjectEquipmentVO(returnpage,projectEquipmentQueryParm,device); + Page list = this.baseMapper.queryProjectEquipmentVO(returnpage, projectEquipmentQueryParm, device); //根据设备id获取监测点id集合 List lineIds = csLinePOService.getLineByDev(device); //根据设备获取当日是否存在未读取的暂态事件 @@ -315,8 +325,8 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl lambdaQueryWrapper = new LambdaQueryWrapper<>(); - lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getNdid,csEquipmentDeliveryAuditParm.getNdid()) - .in(CsEquipmentDeliveryPO::getStatus,Arrays.asList(1,2,3)) + lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getNdid, csEquipmentDeliveryAuditParm.getNdid()) + .in(CsEquipmentDeliveryPO::getStatus, Arrays.asList(1, 2, 3)) .ne(CsEquipmentDeliveryPO::getId, csEquipmentDeliveryAuditParm.getId()); int countByAccount = this.count(lambdaQueryWrapper); //大于等于1个则表示重复 @@ -331,23 +341,23 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl lambdaUpdateWrapper = new LambdaUpdateWrapper<>(); - lambdaUpdateWrapper.set(CsEquipmentDeliveryPO::getStatus,status).eq(CsEquipmentDeliveryPO::getNdid,nDId); + lambdaUpdateWrapper.set(CsEquipmentDeliveryPO::getStatus, status).eq(CsEquipmentDeliveryPO::getNdid, nDId); result = this.update(lambdaUpdateWrapper); if (result) { refreshDeviceDataCache(); @@ -372,16 +382,16 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl list(CsEquipmentDeliveryQueryParm queryParam) { - Page page = new Page<> (); + Page page = new Page<>(); page.setCurrent(queryParam.getPageNum()); page.setSize(queryParam.getPageSize()); - queryParam.setPageNum((queryParam.getPageNum()-1)*queryParam.getPageSize()); + queryParam.setPageNum((queryParam.getPageNum() - 1) * queryParam.getPageSize()); int total = this.baseMapper.getCounts(queryParam); if (total > 0) { List recordList = this.baseMapper.getList(queryParam); //新增逻辑(只针对便携式设备):修改设备中的未注册状态(status = 1)改为5(前端定义的字典也即未接入) - for(CsEquipmentDeliveryVO csEquipmentDeliveryVO : recordList){ - if(DataParam.portableDevType.equals(csEquipmentDeliveryVO.getDevType()) && csEquipmentDeliveryVO.getStatus() == 1){ + for (CsEquipmentDeliveryVO csEquipmentDeliveryVO : recordList) { + if (DataParam.portableDevType.equals(csEquipmentDeliveryVO.getDevType()) && csEquipmentDeliveryVO.getStatus() == 1) { csEquipmentDeliveryVO.setStatus(5); } else if (DataParam.portableDevType.equals(csEquipmentDeliveryVO.getDevType()) && csEquipmentDeliveryVO.getStatus() == 2) { csEquipmentDeliveryVO.setStatus(6); @@ -409,14 +419,14 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl dataSetList = new ArrayList<>(); CsEquipmentDeliveryPO csEquipmentDeliveryPo = this.lambdaQuery().eq(CsEquipmentDeliveryPO::getId, deviceId).one(); //获取装置版本信息 String softInfoId = csEquipmentDeliveryPo.getSoftinfoId(); if (StringUtils.isNotBlank(softInfoId) && ObjectUtil.isNotNull(softInfoId)) { - CsSoftInfoPO po = csSoftInfoMapper.selectById(softInfoId); + CsSoftInfoPO po = csSoftInfoMapper.selectById(softInfoId); deviceManagerVo.setAppVersion(po.getAppVersion()); deviceManagerVo.setAppDate(po.getAppDate()); deviceManagerVo.setAppCheck(po.getAppCheck()); @@ -425,7 +435,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl dataSet = new ArrayList<>(); //如果没有传lineId(测点ID) 则根据设备ID获取对应的模板 select modelId from cs_dev_model_relation where dev_id = ? List modelId = csDevModelRelationService.findModelByDevId(deviceId); - if (CollUtil.isNotEmpty(modelId)){ + if (CollUtil.isNotEmpty(modelId)) { for (CsDevModelRelationPO item : modelId) { //再根据模板ID获取数据集 作为页面展示的Tab项 SELECT * FROM cs_data_set WHERE (pid = ? AND type IN (0,2)) dataSet.addAll(csDataSetService.findDataSetByModelId(item.getModelId())); @@ -441,36 +451,36 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl dataSet = new ArrayList<>(); //治理监测点 - if (Objects.equals(code, DicDataEnum.OUTPUT_SIDE.getCode())){ - modelId = csDevModelRelationService.getModelByType(deviceId,0); - dataSet = csDataSetService.findDataSetByModelId(modelId,0); + if (Objects.equals(code, DicDataEnum.OUTPUT_SIDE.getCode())) { + modelId = csDevModelRelationService.getModelByType(deviceId, 0); + dataSet = csDataSetService.findDataSetByModelId(modelId, 0); } //电网侧监测点 - else if (Objects.equals(code, DicDataEnum.GRID_SIDE.getCode())){ - modelId = csDevModelRelationService.getModelByType(deviceId,1); - dataSet = csDataSetService.findDataSetByModelId(modelId,1); + else if (Objects.equals(code, DicDataEnum.GRID_SIDE.getCode())) { + modelId = csDevModelRelationService.getModelByType(deviceId, 1); + dataSet = csDataSetService.findDataSetByModelId(modelId, 1); } //负载侧监测点 - else if (Objects.equals(code, DicDataEnum.LOAD_SIDE.getCode())){ - modelId = csDevModelRelationService.getModelByType(deviceId,1); - dataSet = csDataSetService.findDataSetByModelId(modelId,2); + else if (Objects.equals(code, DicDataEnum.LOAD_SIDE.getCode())) { + modelId = csDevModelRelationService.getModelByType(deviceId, 1); + dataSet = csDataSetService.findDataSetByModelId(modelId, 2); } setDataSetValues(csEquipmentDeliveryPo, dataSet, dataSetList, type, deviceManagerVo); - } else if(Objects.equals(devTypeCode, DicDataEnum.PORTABLE.getCode())){ + } else if (Objects.equals(devTypeCode, DicDataEnum.PORTABLE.getCode())) { List dataSet = new ArrayList<>(); List modelId = csDevModelRelationService.findModelByDevId(deviceId); - if (CollUtil.isNotEmpty(modelId)){ + if (CollUtil.isNotEmpty(modelId)) { for (CsDevModelRelationPO item : modelId) { - dataSet.addAll(csDataSetService.findDataSetByModelId(item.getModelId(),line.getClDid())); + dataSet.addAll(csDataSetService.findDataSetByModelId(item.getModelId(), line.getClDid())); } setDataSetValues(csEquipmentDeliveryPo, dataSet, dataSetList, type, deviceManagerVo); } - } else if(Objects.equals(devTypeCode, DicDataEnum.DEV_CLD.getCode())){ + } else if (Objects.equals(devTypeCode, DicDataEnum.DEV_CLD.getCode())) { List dataSet = new ArrayList<>(); List modelId = csDevModelRelationService.findModelByDevId(deviceId); - if (CollUtil.isNotEmpty(modelId)){ + if (CollUtil.isNotEmpty(modelId)) { for (CsDevModelRelationPO item : modelId) { - dataSet.addAll(csDataSetService.findDataSetByModelId(item.getModelId(),1)); + dataSet.addAll(csDataSetService.findDataSetByModelId(item.getModelId(), 1)); } setDataSetValues(csEquipmentDeliveryPo, dataSet, dataSetList, type, deviceManagerVo); } @@ -525,7 +535,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl csLinePOS = csLinePOService.findByNdid(csEquipmentDeliveryPo.getNdid()); - if(!csLinePOS.isEmpty()){ + if (!csLinePOS.isEmpty()) { Optional earliest = csLinePOS.stream().min(Comparator.comparing(CsLinePO::getCreateTime)); deviceManagerVo.setTime(earliest.map(CsLinePO::getCreateTime).orElse(null)); } @@ -544,7 +554,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl lambdaUpdateWrapper = new LambdaUpdateWrapper<>(); - lambdaUpdateWrapper.set(CsEquipmentDeliveryPO::getSoftinfoId,id).set(CsEquipmentDeliveryPO::getModuleNumber,module).eq(CsEquipmentDeliveryPO::getNdid,nDid); + lambdaUpdateWrapper.set(CsEquipmentDeliveryPO::getSoftinfoId, id).set(CsEquipmentDeliveryPO::getModuleNumber, module).eq(CsEquipmentDeliveryPO::getNdid, nDid); result = this.update(lambdaUpdateWrapper); if (result) { refreshDeviceDataCache(); @@ -553,13 +563,13 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl importEquipment(MultipartFile file, HttpServletResponse response) { - ImportParams params = new ImportParams ( ); + ImportParams params = new ImportParams(); params.setHeadRows(1); params.setTitleRows(1); //第一个sheet为台账信息 @@ -567,31 +577,31 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl terminalBaseList = ExcelImportUtil.importExcelMore (file.getInputStream ( ), DeviceExcelTemplete.class, params); + ExcelImportResult terminalBaseList = ExcelImportUtil.importExcelMore(file.getInputStream(), DeviceExcelTemplete.class, params); //如果存在非法数据,将不合格的数据导出 - List trueCollect = new ArrayList<> ( ); - List falseCollect = new ArrayList<> ( ); - for (int i = 0; i < terminalBaseList.getList ( ).size ( ); i++) { - DeviceExcelTemplete deviceExcelTemplete = terminalBaseList.getList ( ).get (i); - if(!deviceExcelTemplete.getNdid().matches(regex)){ + List trueCollect = new ArrayList<>(); + List falseCollect = new ArrayList<>(); + for (int i = 0; i < terminalBaseList.getList().size(); i++) { + DeviceExcelTemplete deviceExcelTemplete = terminalBaseList.getList().get(i); + if (!deviceExcelTemplete.getNdid().matches(regex)) { DeviceExcelTemplete.IllegalityDeviceExcelTemplete idlegalityDeviceException = new DeviceExcelTemplete.IllegalityDeviceExcelTemplete(); - BeanUtils.copyProperties(deviceExcelTemplete,idlegalityDeviceException); + BeanUtils.copyProperties(deviceExcelTemplete, idlegalityDeviceException); idlegalityDeviceException.setMsg("网络设备ID只可为数字或字母,长度至少为6位"); falseCollect.add(idlegalityDeviceException); continue; } - CsEquipmentDeliveryPO po = this.queryEquipmentPOByndid (deviceExcelTemplete.getNdid ( )); - if(!Objects.isNull (po)){ + CsEquipmentDeliveryPO po = this.queryEquipmentPOByndid(deviceExcelTemplete.getNdid()); + if (!Objects.isNull(po)) { DeviceExcelTemplete.IllegalityDeviceExcelTemplete idlegalityDeviceException = new DeviceExcelTemplete.IllegalityDeviceExcelTemplete(); - BeanUtils.copyProperties(deviceExcelTemplete,idlegalityDeviceException); + BeanUtils.copyProperties(deviceExcelTemplete, idlegalityDeviceException); idlegalityDeviceException.setMsg("NDID重复"); falseCollect.add(idlegalityDeviceException); continue; } CsEquipmentDeliveryPO one = this.lambdaQuery().eq(CsEquipmentDeliveryPO::getName, deviceExcelTemplete.getName()).ne(CsEquipmentDeliveryPO::getRunStatus, 0).one(); - if(Objects.nonNull (one)){ + if (Objects.nonNull(one)) { DeviceExcelTemplete.IllegalityDeviceExcelTemplete idlegalityDeviceException = new DeviceExcelTemplete.IllegalityDeviceExcelTemplete(); - BeanUtils.copyProperties(deviceExcelTemplete,idlegalityDeviceException); + BeanUtils.copyProperties(deviceExcelTemplete, idlegalityDeviceException); idlegalityDeviceException.setMsg("NDID重复"); falseCollect.add(idlegalityDeviceException); continue; @@ -602,35 +612,35 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl map = children.stream().collect(Collectors.toMap(SysDicTreePO::getName, dictTreeVO -> dictTreeVO)); List collect = children.stream().filter(temp -> Objects.equals(temp.getName(), deviceExcelTemplete.getDevType())).collect(Collectors.toList()); SysDicTreePO sysDicTreePO = map.get(deviceExcelTemplete.getDevType()); - if(CollectionUtils.isEmpty(collect)){ + if (CollectionUtils.isEmpty(collect)) { DeviceExcelTemplete.IllegalityDeviceExcelTemplete idlegalityDeviceException = new DeviceExcelTemplete.IllegalityDeviceExcelTemplete(); - BeanUtils.copyProperties(deviceExcelTemplete,idlegalityDeviceException); + BeanUtils.copyProperties(deviceExcelTemplete, idlegalityDeviceException); idlegalityDeviceException.setMsg("设备类型不正确"); falseCollect.add(idlegalityDeviceException); continue; - }else { + } else { deviceExcelTemplete.setDevType(map.get(deviceExcelTemplete.getDevType()).getId()); } //设备型号 List children1 = sysDicTreePO.getChildren(); Map map2 = children1.stream().collect(Collectors.toMap(SysDicTreePO::getName, dictTreeVO -> dictTreeVO)); List collect2 = children1.stream().filter(temp -> Objects.equals(temp.getName(), deviceExcelTemplete.getDevModel())).collect(Collectors.toList()); - if(CollectionUtils.isEmpty(collect2)){ + if (CollectionUtils.isEmpty(collect2)) { DeviceExcelTemplete.IllegalityDeviceExcelTemplete idlegalityDeviceException = new DeviceExcelTemplete.IllegalityDeviceExcelTemplete(); - BeanUtils.copyProperties(deviceExcelTemplete,idlegalityDeviceException); + BeanUtils.copyProperties(deviceExcelTemplete, idlegalityDeviceException); idlegalityDeviceException.setMsg("设备类型与设备型号不匹配"); falseCollect.add(idlegalityDeviceException); continue; - }else { + } else { deviceExcelTemplete.setDevModel(map2.get(deviceExcelTemplete.getDevModel()).getId()); trueCollect.add(deviceExcelTemplete); } } - if (!CollectionUtils.isEmpty (trueCollect)) { + if (!CollectionUtils.isEmpty(trueCollect)) { List collect1 = new ArrayList<>(); - List collect = trueCollect.stream ( ).map (temp -> { - CsEquipmentDeliveryPO csEquipmentDeliveryPO = new CsEquipmentDeliveryPO ( ); - BeanUtils.copyProperties (temp, csEquipmentDeliveryPO); + List collect = trueCollect.stream().map(temp -> { + CsEquipmentDeliveryPO csEquipmentDeliveryPO = new CsEquipmentDeliveryPO(); + BeanUtils.copyProperties(temp, csEquipmentDeliveryPO); String qr = this.createQr(temp.getNdid()); csEquipmentDeliveryPO.setQrPath(qr); String path = this.createPath(temp.getNdid()); @@ -649,19 +659,19 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl list = csLedgerService.list(csLedgerQueryWrapper); List collect = list.stream().map(CsLedger::getId).collect(Collectors.toList()); csLedgerService.remove(csLedgerQueryWrapper); QueryWrapper csDevModelRelationPOQueryWrapper = new QueryWrapper<>(); csDevModelRelationPOQueryWrapper.clear(); - csDevModelRelationPOQueryWrapper.eq("dev_id",devId); + csDevModelRelationPOQueryWrapper.eq("dev_id", devId); csDevModelRelationService.remove(csDevModelRelationPOQueryWrapper); QueryWrapper csDeviceUserPOQueryWrapper = new QueryWrapper<>(); csDeviceUserPOQueryWrapper.clear(); - csDeviceUserPOQueryWrapper.eq("device_id",devId); + csDeviceUserPOQueryWrapper.eq("device_id", devId); csDeviceUserPOService.remove(csDeviceUserPOQueryWrapper); if (!CollectionUtils.isEmpty(collect)) { QueryWrapper csLinePOQueryWrapper = new QueryWrapper<>(); csLinePOQueryWrapper.clear(); - csLinePOQueryWrapper.in("line_id",collect); + csLinePOQueryWrapper.in("line_id", collect); csLinePOService.remove(csLinePOQueryWrapper); QueryWrapper appLineTopologyDiagramPOQueryWrapper = new QueryWrapper<>(); appLineTopologyDiagramPOQueryWrapper.clear(); - appLineTopologyDiagramPOQueryWrapper.in("line_id",collect); + appLineTopologyDiagramPOQueryWrapper.in("line_id", collect); appLineTopologyDiagramService.remove(appLineTopologyDiagramPOQueryWrapper); } refreshDeviceDataCache(); @@ -713,40 +723,40 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl list = csEquipmentProcessPOService.lambdaQuery().eq(CsEquipmentProcessPO::getDevId, one.getNdid()). eq(CsEquipmentProcessPO::getProcess, type).orderByDesc(CsEquipmentProcessPO::getStartTime).list(); //获取最新一条数据; CsEquipmentProcessPO csEquipmentProcessPO = list.get(0); - csEquipmentProcessPOService.lambdaUpdate().eq(CsEquipmentProcessPO::getId,csEquipmentProcessPO.getId()). - set(CsEquipmentProcessPO::getStatus,1). - set(CsEquipmentProcessPO::getEndTime,LocalDateTime.now()). - set(CsEquipmentProcessPO::getRemark,remark). + csEquipmentProcessPOService.lambdaUpdate().eq(CsEquipmentProcessPO::getId, csEquipmentProcessPO.getId()). + set(CsEquipmentProcessPO::getStatus, 1). + set(CsEquipmentProcessPO::getEndTime, LocalDateTime.now()). + set(CsEquipmentProcessPO::getRemark, remark). update(); } @Override - public void deleteTest(String deviceId, Integer type ,String remark) { + public void deleteTest(String deviceId, Integer type, String remark) { CsEquipmentDeliveryPO one = this.lambdaQuery().eq(CsEquipmentDeliveryPO::getId, deviceId).one(); - this.lambdaUpdate().eq(CsEquipmentDeliveryPO::getId,deviceId). + this.lambdaUpdate().eq(CsEquipmentDeliveryPO::getId, deviceId). // set(CsEquipmentDeliveryPO::getStatus,1). // set(CsEquipmentDeliveryPO::getRunStatus,1). - set(CsEquipmentDeliveryPO::getProcess,type).update(); + set(CsEquipmentDeliveryPO::getProcess, type).update(); this.delete(deviceId); List list = csEquipmentProcessPOService.lambdaQuery().eq(CsEquipmentProcessPO::getDevId, one.getNdid()). eq(CsEquipmentProcessPO::getProcess, type).orderByDesc(CsEquipmentProcessPO::getStartTime).list(); //获取最新一条数据; CsEquipmentProcessPO csEquipmentProcessPO = list.get(0); - csEquipmentProcessPOService.lambdaUpdate().eq(CsEquipmentProcessPO::getId,csEquipmentProcessPO.getId()). - set(CsEquipmentProcessPO::getStatus,0). - set(CsEquipmentProcessPO::getEndTime,LocalDateTime.now()). - set(CsEquipmentProcessPO::getRemark,remark). + csEquipmentProcessPOService.lambdaUpdate().eq(CsEquipmentProcessPO::getId, csEquipmentProcessPO.getId()). + set(CsEquipmentProcessPO::getStatus, 0). + set(CsEquipmentProcessPO::getEndTime, LocalDateTime.now()). + set(CsEquipmentProcessPO::getRemark, remark). update(); } @@ -754,9 +764,9 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl lambdaUpdateWrapper = new LambdaUpdateWrapper<>(); - lambdaUpdateWrapper.eq(CsEquipmentDeliveryPO::getNdid,nDid) - .ne(CsEquipmentDeliveryPO::getRunStatus,0) - .set(CsEquipmentDeliveryPO::getSoftinfoId,id); + lambdaUpdateWrapper.eq(CsEquipmentDeliveryPO::getNdid, nDid) + .ne(CsEquipmentDeliveryPO::getRunStatus, 0) + .set(CsEquipmentDeliveryPO::getSoftinfoId, id); result = this.update(lambdaUpdateWrapper); if (result) { refreshDeviceDataCache(); @@ -767,9 +777,9 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl lambdaUpdateWrapper = new LambdaUpdateWrapper<>(); - lambdaUpdateWrapper.eq(CsEquipmentDeliveryPO::getNdid,nDid) - .ne(CsEquipmentDeliveryPO::getRunStatus,0) - .set(CsEquipmentDeliveryPO::getModuleNumber,number); + lambdaUpdateWrapper.eq(CsEquipmentDeliveryPO::getNdid, nDid) + .ne(CsEquipmentDeliveryPO::getRunStatus, 0) + .set(CsEquipmentDeliveryPO::getModuleNumber, number); result = this.update(lambdaUpdateWrapper); if (result) { refreshDeviceDataCache(); @@ -786,7 +796,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl getAll() { - return this.lambdaQuery().ne(CsEquipmentDeliveryPO::getRunStatus,0).list(); + return this.lambdaQuery().ne(CsEquipmentDeliveryPO::getRunStatus, 0).list(); } @Override public List getAllOnline() { return this.lambdaQuery() - .ne(CsEquipmentDeliveryPO::getRunStatus,0) - .eq(CsEquipmentDeliveryPO::getUsageStatus,1) + .ne(CsEquipmentDeliveryPO::getRunStatus, 0) + .eq(CsEquipmentDeliveryPO::getUsageStatus, 1) .isNotNull(CsEquipmentDeliveryPO::getNodeId) .list(); } @@ -817,7 +827,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl devList = getListByNodeId(param.getNodeId()); if (ObjectUtil.isNotEmpty(devList) && devList.size() >= node.getNodeDevNum()) { - throw new BusinessException (AlgorithmResponseEnum.OVER_MAX_DEV_COUNT); + throw new BusinessException(AlgorithmResponseEnum.OVER_MAX_DEV_COUNT); } //判断2 - int process = findLeastFrequentProcess(devList,node.getMaxProcessNum()); + int process = findLeastFrequentProcess(devList, node.getMaxProcessNum()); csEquipmentDeliveryPo.setNodeProcess(process); result = this.save(csEquipmentDeliveryPo); @@ -892,23 +907,23 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl lambdaQueryWrapper = new LambdaQueryWrapper<>(); - lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getId,id); + lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getId, id); boolean update = this.remove(lambdaQueryWrapper); List list = csLedgerService.lambdaQuery().eq(CsLedger::getPid, id).list(); - if(!CollectionUtils.isEmpty(list)){ + if (!CollectionUtils.isEmpty(list)) { List collect = list.stream().map(CsLedger::getId).collect(Collectors.toList()); - LambdaQueryWrapper csLinePOLambdaQueryWrapper = new LambdaQueryWrapper<>(); - csLinePOLambdaQueryWrapper.in(CsLinePO::getLineId,collect); + LambdaQueryWrapper csLinePOLambdaQueryWrapper = new LambdaQueryWrapper<>(); + csLinePOLambdaQueryWrapper.in(CsLinePO::getLineId, collect); csLinePOService.remove(csLinePOLambdaQueryWrapper); } LambdaQueryWrapper csLedgerLambdaQueryWrapper = new LambdaQueryWrapper<>(); csLedgerLambdaQueryWrapper.clear(); - csLedgerLambdaQueryWrapper.eq(CsLedger::getId,id); + csLedgerLambdaQueryWrapper.eq(CsLedger::getId, id); csLedgerService.remove(csLedgerLambdaQueryWrapper); csLedgerLambdaQueryWrapper.clear(); - csLedgerLambdaQueryWrapper.eq(CsLedger::getPid,id); + csLedgerLambdaQueryWrapper.eq(CsLedger::getPid, id); csLedgerService.remove(csLedgerLambdaQueryWrapper); - csDevModelRelationService.lambdaUpdate().eq(CsDevModelRelationPO::getDevId,id).set(CsDevModelRelationPO::getStatus,0).update(); + csDevModelRelationService.lambdaUpdate().eq(CsDevModelRelationPO::getDevId, id).set(CsDevModelRelationPO::getStatus, 0).update(); if (update) { refreshDeviceDataCache(); } @@ -940,8 +955,8 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl lambdaQueryWrapper = new LambdaQueryWrapper<>(); - lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getNdid,param.getNdid()) - .in(CsEquipmentDeliveryPO::getStatus,Arrays.asList(1,2,3)) + lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getNdid, param.getNdid()) + .in(CsEquipmentDeliveryPO::getStatus, Arrays.asList(1, 2, 3)) .ne(CsEquipmentDeliveryPO::getId, param.getId()); int countByAccount = this.count(lambdaQueryWrapper); //大于等于1个则表示重复 @@ -956,11 +971,11 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl lambdaQueryWrapper = new LambdaQueryWrapper<>(); - lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getNodeId,nodeId) - .eq(CsEquipmentDeliveryPO::getNodeProcess,processNo) - .eq(CsEquipmentDeliveryPO::getUsageStatus,1) - .eq(CsEquipmentDeliveryPO::getRunStatus,2); + lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getNodeId, nodeId) + .eq(CsEquipmentDeliveryPO::getNodeProcess, processNo) + .eq(CsEquipmentDeliveryPO::getUsageStatus, 1) + .eq(CsEquipmentDeliveryPO::getRunStatus, 2); List devList = this.list(lambdaQueryWrapper); if (CollectionUtil.isNotEmpty(devList)) { //修改设备运行状态 - devList.forEach(item->{ + devList.forEach(item -> { item.setRunStatus(1); insertPqsCommunicateRecord(LocalDateTime.now().format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN)), item.getNdid(), 0); }); @@ -1037,9 +1052,9 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl lambdaQueryWrapper = new LambdaQueryWrapper<>(); - lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getId,devId) - .eq(CsEquipmentDeliveryPO::getUsageStatus,1) - .ne(CsEquipmentDeliveryPO::getUsageStatus,0); + lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getId, devId) + .eq(CsEquipmentDeliveryPO::getUsageStatus, 1) + .ne(CsEquipmentDeliveryPO::getUsageStatus, 0); CsEquipmentDeliveryPO po = this.getOne(lambdaQueryWrapper); if (ObjectUtil.isNotNull(po)) { po.setRunStatus(status); @@ -1063,30 +1078,83 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl getDevListByProjectId(String projectId) { QueryWrapper csLedgerQueryWrapper = new QueryWrapper(); - csLedgerQueryWrapper.lambda().eq(CsLedger::getPid, projectId).eq(CsLedger::getState,1); + csLedgerQueryWrapper.lambda().eq(CsLedger::getPid, projectId).eq(CsLedger::getState, 1); List csLedgers = csLedgerMapper.selectList(csLedgerQueryWrapper); if (CollectionUtil.isEmpty(csLedgers)) { return new ArrayList<>(); } List collect = csLedgers.stream().map(CsLedger::getId).collect(Collectors.toList()); - return this.lambdaQuery().in(CsEquipmentDeliveryPO::getId,collect).list(); + return this.lambdaQuery().in(CsEquipmentDeliveryPO::getId, collect).list(); } @Override public List getDataByNodeIdAndProcessNo(String nodeId, Integer processNo) { LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); - lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getNodeId,nodeId) - .ne(CsEquipmentDeliveryPO::getRunStatus,0) - .eq(CsEquipmentDeliveryPO::getDevAccessMethod,"CLD"); + lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getNodeId, nodeId) + .ne(CsEquipmentDeliveryPO::getRunStatus, 0) + .eq(CsEquipmentDeliveryPO::getDevAccessMethod, "CLD"); if (ObjectUtil.isNotNull(processNo)) { - lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getNodeProcess,processNo); + lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getNodeProcess, processNo); } return this.list(lambdaQueryWrapper); } @Override public List getListByIds(List devList) { - return this.lambdaQuery().in(CsEquipmentDeliveryPO::getId,devList).list(); + return this.lambdaQuery().in(CsEquipmentDeliveryPO::getId, devList).list(); + } + + @Override + public IPage versionPage(BaseParam baseParam) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.ne(CsEquipmentDeliveryPO::getRunStatus, 0) + .like(StrUtil.isNotBlank(baseParam.getSearchValue()), CsEquipmentDeliveryPO::getName, baseParam.getSearchValue()); + Page page = this.page(new Page<>(PageFactory.getPageNum(baseParam), PageFactory.getPageSize(baseParam)), wrapper); + + List 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 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 @@ -1097,20 +1165,20 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl lambdaQueryWrapper = new LambdaQueryWrapper<>(); - lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getDevType,vo.getId()) - .ne(CsEquipmentDeliveryPO::getRunStatus,0) - .eq(CsEquipmentDeliveryPO::getUsageStatus,1); + lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getDevType, vo.getId()) + .ne(CsEquipmentDeliveryPO::getRunStatus, 0) + .eq(CsEquipmentDeliveryPO::getUsageStatus, 1); //获取用户已经绑定的便携式设备 List devList = csDeviceUserPOService.findDevByUserId(userId); if (CollectionUtil.isNotEmpty(devList)) { - lambdaQueryWrapper.notIn(CsEquipmentDeliveryPO::getId,devList); + lambdaQueryWrapper.notIn(CsEquipmentDeliveryPO::getId, devList); } result = this.list(lambdaQueryWrapper); if (CollectionUtil.isNotEmpty(result)) { //获取已经接入过系统的设备,未接入的不给分配 LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); List ids = result.stream().map(CsEquipmentDeliveryPO::getId).collect(Collectors.toList()); - queryWrapper.in(CsLedger::getId,ids); + queryWrapper.in(CsLedger::getId, ids); List list = csLedgerService.list(queryWrapper); if (CollectionUtil.isNotEmpty(list)) { Set idSet = list.stream() @@ -1130,8 +1198,8 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl getListByNodeId(String nodeId) { LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); - lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getNodeId,nodeId) - .in(CsEquipmentDeliveryPO::getRunStatus,Arrays.asList(1,2)); + lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getNodeId, nodeId) + .in(CsEquipmentDeliveryPO::getRunStatus, Arrays.asList(1, 2)); return this.list(lambdaQueryWrapper); } @@ -1150,11 +1218,12 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImplb0b0dedf-baa9-407f-bef6-988b9e0a640d--> 192.168.1.103 - 192.168.2.126 + 192.168.2.124 192.168.1.103 ${middle.server.url}:18848 - 72972c43-3c20-4452-a261-66624e17da97 + cb3a03dd-47f6-4a83-9408-b3182b3d0619