设备程序版本分页程序
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -115,4 +115,9 @@ public class CsEquipmentDeliveryDTO {
|
||||
* 日志等级(NORMAL、DEBUG、WARN、ERROR)
|
||||
*/
|
||||
private String devLogLevel;
|
||||
|
||||
/**
|
||||
* 设备软件信息id
|
||||
*/
|
||||
private String softinfoId;
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
@@ -147,5 +147,4 @@ public class CsEquipmentDeliveryPO extends BaseEntity {
|
||||
*/
|
||||
@TableField(value = "associated_project")
|
||||
private String associatedProject;
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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<CsEquipmentDeliveryPO> addEquipmentDelivery(@RequestBody @Validated CsEquipmentDeliveryAddParm csEquipmentDeliveryAddParm){
|
||||
public HttpResult<CsEquipmentDeliveryPO> 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<Boolean> AuditEquipmentDelivery(@RequestParam("id")String id ){
|
||||
public HttpResult<Boolean> 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<Boolean> updateEquipmentDelivery(@RequestBody @Validated CsEquipmentDeliveryAuditParm csEquipmentDeliveryAuditParm ){
|
||||
public HttpResult<Boolean> 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<CsEquipmentDeliveryVO> queryEquipmentByndid(@RequestParam("ndid")String ndid){
|
||||
public HttpResult<CsEquipmentDeliveryVO> 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<IPage<ProjectEquipmentVO>> queryEquipmentByProject(@RequestBody ProjectEquipmentQueryParm projectEquipmentQueryParm){
|
||||
public HttpResult<IPage<ProjectEquipmentVO>> queryEquipmentByProject(@RequestBody ProjectEquipmentQueryParm projectEquipmentQueryParm) {
|
||||
String methodDescribe = getMethodDescribe("queryEquipmentByProject");
|
||||
IPage<ProjectEquipmentVO> projectEquipmentVos = csEquipmentDeliveryService.queryEquipmentByProject(projectEquipmentQueryParm);
|
||||
IPage<ProjectEquipmentVO> 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<Boolean> updateStatusBynDid(@RequestParam("nDId") String nDid,@RequestParam("status") Integer status){
|
||||
public HttpResult<Boolean> 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<List<CsEquipmentDeliveryDTO>> queryEquipmentById(@RequestParam List<String> ids){
|
||||
public HttpResult<List<CsEquipmentDeliveryDTO>> queryEquipmentById(@RequestParam List<String> 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<Page<CsEquipmentDeliveryVO>> list(@RequestBody CsEquipmentDeliveryQueryParm param){
|
||||
public HttpResult<Page<CsEquipmentDeliveryVO>> list(@RequestBody CsEquipmentDeliveryQueryParm param) {
|
||||
String methodDescribe = getMethodDescribe("list");
|
||||
Page<CsEquipmentDeliveryVO> 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<DeviceManagerVO> getDeviceData(@RequestParam String deviceId,@RequestParam String type,@RequestParam String lineId){
|
||||
public HttpResult<DeviceManagerVO> 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<Boolean> updateSoftInfoBynDid(@RequestParam("nDId") String nDid,@RequestParam("id") String id,@RequestParam("module") Integer module){
|
||||
public HttpResult<Boolean> 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<CsEquipmentDeliveryPO> findDevByNDid(@RequestParam("nDid")String nDid){
|
||||
public HttpResult<CsEquipmentDeliveryPO> 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<DeviceExcelTemplete>());
|
||||
List<SysDicTreePO> deviceType = dictTreeFeignClient.queryByCodeList(DicDataTypeEnum.DEVICE_TYPE.getCode()).getData();
|
||||
if(!CollectionUtils.isEmpty(deviceType)){
|
||||
if (!CollectionUtils.isEmpty(deviceType)) {
|
||||
List<String> collect = deviceType.get(0).getChildren().stream().map(SysDicTreePO::getName).collect(Collectors.toList());
|
||||
ExcelUtil.selectList(workbook, 2, 2, collect.toArray(new String[]{}));
|
||||
List<String> 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<String> importEquipment(@ApiParam(value = "文件", required = true) @RequestPart("file") MultipartFile file, HttpServletResponse response) {
|
||||
String methodDescribe = getMethodDescribe("importEquipment");
|
||||
List<CsEquipmentDeliveryPO> 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<String> testCompletion(@RequestParam("deviceId") String deviceId,@RequestParam("type") Integer type,@RequestParam("remark") String remark){
|
||||
public HttpResult<String> 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<String> deleteTest(@RequestParam("deviceId") String deviceId,@RequestParam("type") Integer type,@RequestParam("remark") String remark){
|
||||
public HttpResult<String> 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<String> updateSoftInfo(@RequestParam("nDid") String nDid,@RequestParam("id") String id){
|
||||
public HttpResult<String> 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<String> updateModuleNumber(@RequestParam("nDid") String nDid,@RequestParam("number") Integer number){
|
||||
public HttpResult<String> 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<String> rebootDevice(@RequestParam("nDid") String nDid){
|
||||
public HttpResult<String> 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<List<CsEquipmentDeliveryPO>> getAll(){
|
||||
public HttpResult<List<CsEquipmentDeliveryPO>> getAll() {
|
||||
String methodDescribe = getMethodDescribe("getAll");
|
||||
List<CsEquipmentDeliveryPO> 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<Boolean> judgeDevModel(@RequestParam("nDid") String nDid){
|
||||
public HttpResult<Boolean> 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<CsEquipmentDeliveryPO> getDevByLineId(@RequestParam("lineId") String lineId){
|
||||
public HttpResult<CsEquipmentDeliveryPO> 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<CsEquipmentDeliveryPO> addCldDev(@RequestBody @Validated CsEquipmentDeliveryAddParm param){
|
||||
public HttpResult<CsEquipmentDeliveryPO> 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<Boolean> delCldDev(@RequestParam("id") String id){
|
||||
public HttpResult<Boolean> 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<Boolean> updateCldDev(@RequestBody @Validated CsEquipmentDeliveryAuditParm param){
|
||||
public HttpResult<Boolean> 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<Boolean> updateCldDevStatus(@RequestParam("nodeId") String nodeId, @RequestParam("processNo") Integer processNo){
|
||||
public HttpResult<Boolean> 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<Boolean> flipCldDevStatus(@RequestParam("date") String date, @RequestParam("devId") String devId, @RequestParam("status") Integer status){
|
||||
public HttpResult<Boolean> 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<List<CsEquipmentDeliveryPO>> getRunPortableDev(@RequestParam("userId") String userId){
|
||||
public HttpResult<List<CsEquipmentDeliveryPO>> getRunPortableDev(@RequestParam("userId") String userId) {
|
||||
String methodDescribe = getMethodDescribe("getRunPortableDev");
|
||||
List<CsEquipmentDeliveryPO> 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<IPage<DevVersionVO>> versionPage(@RequestBody BaseParam baseParam) {
|
||||
String methodDescribe = getMethodDescribe("versionPage");
|
||||
|
||||
IPage<DevVersionVO> list = csEquipmentDeliveryService.versionPage(baseParam);
|
||||
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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<CsEdDataMapper, CsEdDataPO>
|
||||
@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<CsEdDataVO> queryEdDataPage(CsEdDataQueryParm csEdDataQueryParm) {
|
||||
Page<CsEdDataVO> returnpage = new Page<> (csEdDataQueryParm.getPageNum ( ), csEdDataQueryParm.getPageSize ( ));
|
||||
Page<CsEdDataVO> 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<CsEdDataMapper, CsEdDataPO>
|
||||
public CsEdDataVO findByDevTypeId(String devType) {
|
||||
CsEdDataPO csEdDataPo = new CsEdDataPO();
|
||||
LambdaQueryWrapper<CsEdDataPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(CsEdDataPO::getDevType,devType);
|
||||
lambdaQueryWrapper.eq(CsEdDataPO::getStatus,1);
|
||||
lambdaQueryWrapper.eq(CsEdDataPO::getDevType, devType);
|
||||
lambdaQueryWrapper.eq(CsEdDataPO::getStatus, 1);
|
||||
List<CsEdDataPO> 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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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<CsEquipmentDeliveryMapper, CsEquipmentDeliveryPO> implements CsEquipmentDeliveryService{
|
||||
public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliveryMapper, CsEquipmentDeliveryPO> implements CsEquipmentDeliveryService {
|
||||
private final CsDevModelRelationService csDevModelRelationService;
|
||||
private final ICsDataSetService csDataSetService;
|
||||
private final ICsLedgerService csLedgerService;
|
||||
@@ -99,7 +104,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
private final DicDataFeignClient dicDataFeignClient;
|
||||
private final FileStorageUtil fileStorageUtil;
|
||||
private final DictTreeFeignClient dictTreeFeignClient;
|
||||
private final CsEquipmentProcessPOService csEquipmentProcessPOService;
|
||||
private final CsEquipmentProcessPOService csEquipmentProcessPOService;
|
||||
private final AskDeviceDataFeignClient askDeviceDataFeignClient;
|
||||
private final RedisUtil redisUtil;
|
||||
private final CsSoftInfoMapper csSoftInfoMapper;
|
||||
@@ -112,15 +117,19 @@ 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;
|
||||
|
||||
@Override
|
||||
public void refreshDeviceDataCache() {
|
||||
LambdaQueryWrapper<CsEquipmentDeliveryPO> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.ne(CsEquipmentDeliveryPO::getRunStatus,0);
|
||||
queryWrapper.ne(CsEquipmentDeliveryPO::getRunStatus, 0);
|
||||
List<CsEquipmentDeliveryPO> 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<CsEquipmentDeliv
|
||||
.ne(CsEquipmentDeliveryPO::getRunStatus, 0)
|
||||
.eq(CsEquipmentDeliveryPO::getDevAccessMethod, "MQTT")
|
||||
.list();
|
||||
if(CollUtil.isNotEmpty(one)){
|
||||
throw new BusinessException ("设备名称不能重复");
|
||||
if (CollUtil.isNotEmpty(one)) {
|
||||
throw new BusinessException("设备名称不能重复");
|
||||
}
|
||||
StringUtil.containsSpecialCharacters(csEquipmentDeliveryAddParm.getNdid());
|
||||
CsEquipmentDeliveryPO po = this.queryEquipmentPOByndid (csEquipmentDeliveryAddParm.getNdid());
|
||||
if(!Objects.isNull (po)){
|
||||
throw new BusinessException (AlgorithmResponseEnum.NDID_ERROR);
|
||||
CsEquipmentDeliveryPO po = this.queryEquipmentPOByndid(csEquipmentDeliveryAddParm.getNdid());
|
||||
if (!Objects.isNull(po)) {
|
||||
throw new BusinessException(AlgorithmResponseEnum.NDID_ERROR);
|
||||
}
|
||||
CsEquipmentDeliveryPO csEquipmentDeliveryPo = new CsEquipmentDeliveryPO();
|
||||
BeanUtils.copyProperties (csEquipmentDeliveryAddParm,csEquipmentDeliveryPo);
|
||||
csEquipmentDeliveryPo.setStatus (1);
|
||||
BeanUtils.copyProperties(csEquipmentDeliveryAddParm, csEquipmentDeliveryPo);
|
||||
csEquipmentDeliveryPo.setStatus(1);
|
||||
csEquipmentDeliveryPo.setRunStatus(1);
|
||||
csEquipmentDeliveryPo.setUsageStatus(1);
|
||||
// String code = dictTreeFeignClient.queryById(csEquipmentDeliveryAddParm.getDevType()).getData().getCode();
|
||||
@@ -182,36 +191,36 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
CsEquipmentDeliveryPO one = this.lambdaQuery().eq(CsEquipmentDeliveryPO::getId, id).one();
|
||||
//物理删除
|
||||
QueryWrapper<CsEquipmentDeliveryPO> wrapper = new QueryWrapper();
|
||||
wrapper.eq ("id", id);
|
||||
boolean update = this.remove (wrapper);
|
||||
wrapper.eq("id", id);
|
||||
boolean update = this.remove(wrapper);
|
||||
//删除deviceuser表里的设备,游客数据设备,删除监测点相关数据
|
||||
List<CsLedger> list = csLedgerService.lambdaQuery().eq(CsLedger::getPid, id).list();
|
||||
if(!CollectionUtils.isEmpty(list)){
|
||||
if (!CollectionUtils.isEmpty(list)) {
|
||||
List<String> collect = list.stream().map(CsLedger::getId).collect(Collectors.toList());
|
||||
LambdaQueryWrapper<CsLinePO> csLinePOLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
csLinePOLambdaQueryWrapper.in(CsLinePO::getLineId,collect);
|
||||
LambdaQueryWrapper<CsLinePO> csLinePOLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
csLinePOLambdaQueryWrapper.in(CsLinePO::getLineId, collect);
|
||||
csLinePOService.remove(csLinePOLambdaQueryWrapper);
|
||||
QueryWrapper<AppLineTopologyDiagramPO> 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<CsLedger> csLedgerLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
LambdaQueryWrapper<CsLedger> 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<CsTouristDataPO> 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<CsEquipmentDeliv
|
||||
@Override
|
||||
public CsEquipmentDeliveryVO queryEquipmentByndid(String ndid) {
|
||||
CsEquipmentDeliveryVO result = new CsEquipmentDeliveryVO();
|
||||
CsEquipmentDeliveryPO csEquipmentDeliveryPO = queryEquipmentPOByndid (ndid);
|
||||
if(Objects.isNull (csEquipmentDeliveryPO)){
|
||||
CsEquipmentDeliveryPO csEquipmentDeliveryPO = queryEquipmentPOByndid(ndid);
|
||||
if (Objects.isNull(csEquipmentDeliveryPO)) {
|
||||
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());
|
||||
@@ -237,20 +247,20 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
|
||||
public CsEquipmentDeliveryPO queryEquipmentPOByndid(String ndid) {
|
||||
QueryWrapper<CsEquipmentDeliveryPO> 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<ProjectEquipmentVO> queryEquipmentByProject(ProjectEquipmentQueryParm projectEquipmentQueryParm) {
|
||||
Page<ProjectEquipmentVO> returnpage = new Page<> (projectEquipmentQueryParm.getPageNum ( ), projectEquipmentQueryParm.getPageSize ( ));
|
||||
Page<ProjectEquipmentVO> returnpage = new Page<>(projectEquipmentQueryParm.getPageNum(), projectEquipmentQueryParm.getPageSize());
|
||||
List<String> device = roleEngineerDevService.getDevice();
|
||||
if(CollectionUtils.isEmpty(device)){
|
||||
if (CollectionUtils.isEmpty(device)) {
|
||||
return returnpage;
|
||||
}
|
||||
Page<ProjectEquipmentVO> list = this.baseMapper.queryProjectEquipmentVO(returnpage,projectEquipmentQueryParm,device);
|
||||
Page<ProjectEquipmentVO> list = this.baseMapper.queryProjectEquipmentVO(returnpage, projectEquipmentQueryParm, device);
|
||||
//根据设备id获取监测点id集合
|
||||
List<CsLinePO> lineIds = csLinePOService.getLineByDev(device);
|
||||
//根据设备获取当日是否存在未读取的暂态事件
|
||||
@@ -315,8 +325,8 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
StringUtil.containsSpecialCharacters(csEquipmentDeliveryAuditParm.getNdid());
|
||||
boolean result;
|
||||
LambdaQueryWrapper<CsEquipmentDeliveryPO> 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<CsEquipmentDeliv
|
||||
.ne(CsEquipmentDeliveryPO::getNdid, csEquipmentDeliveryAuditParm.getNdid())
|
||||
.eq(CsEquipmentDeliveryPO::getName, csEquipmentDeliveryAuditParm.getName())
|
||||
.ne(CsEquipmentDeliveryPO::getRunStatus, 0).list();
|
||||
if(!CollectionUtils.isEmpty (list)){
|
||||
throw new BusinessException ("设备名称不能重复");
|
||||
if (!CollectionUtils.isEmpty(list)) {
|
||||
throw new BusinessException("设备名称不能重复");
|
||||
}
|
||||
CsEquipmentDeliveryPO csEquipmentDeliveryPo = new CsEquipmentDeliveryPO();
|
||||
BeanUtils.copyProperties (csEquipmentDeliveryAuditParm, csEquipmentDeliveryPo);
|
||||
BeanUtils.copyProperties(csEquipmentDeliveryAuditParm, csEquipmentDeliveryPo);
|
||||
result = this.updateById(csEquipmentDeliveryPo);
|
||||
//如果是已经接入的设备需要修改台账树中的设备名称
|
||||
CsLedger csLedger = csLedgerService.findDataById(csEquipmentDeliveryAuditParm.getId());
|
||||
if (ObjectUtil.isNotNull(csLedger)) {
|
||||
CsLedgerParam.Update csLedgerParam = new CsLedgerParam.Update();
|
||||
BeanUtils.copyProperties (csLedger, csLedgerParam);
|
||||
BeanUtils.copyProperties(csLedger, csLedgerParam);
|
||||
csLedgerParam.setName(csEquipmentDeliveryAuditParm.getName());
|
||||
csLedgerService.updateLedgerTree(csLedgerParam);
|
||||
}
|
||||
if (result) {
|
||||
refreshDeviceDataCache();
|
||||
if (!Objects.equals(po.getUsageStatus(),csEquipmentDeliveryAuditParm.getUsageStatus())) {
|
||||
if (!Objects.equals(po.getUsageStatus(), csEquipmentDeliveryAuditParm.getUsageStatus())) {
|
||||
DeviceLogDTO dto = new DeviceLogDTO();
|
||||
dto.setUserName(RequestUtil.getUsername());
|
||||
dto.setOperate("设备使用状态被修改");
|
||||
@@ -360,10 +370,10 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateStatusBynDid(String nDId,Integer status) {
|
||||
public void updateStatusBynDid(String nDId, Integer status) {
|
||||
boolean result;
|
||||
LambdaUpdateWrapper<CsEquipmentDeliveryPO> 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<CsEquipmentDeliv
|
||||
|
||||
@Override
|
||||
public Page<CsEquipmentDeliveryVO> list(CsEquipmentDeliveryQueryParm queryParam) {
|
||||
Page<CsEquipmentDeliveryVO> page = new Page<> ();
|
||||
Page<CsEquipmentDeliveryVO> 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<CsEquipmentDeliveryVO> 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<CsEquipmentDeliv
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeviceManagerVO getDeviceData(String deviceId, String type, String lineId) {
|
||||
public DeviceManagerVO getDeviceData(String deviceId, String type, String lineId) {
|
||||
DeviceManagerVO deviceManagerVo = new DeviceManagerVO();
|
||||
List<DeviceManagerVO.DataSetVO> 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<CsEquipmentDeliv
|
||||
List<CsDataSet> dataSet = new ArrayList<>();
|
||||
//如果没有传lineId(测点ID) 则根据设备ID获取对应的模板 select modelId from cs_dev_model_relation where dev_id = ?
|
||||
List<CsDevModelRelationPO> 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<CsEquipmentDeliv
|
||||
String modelId = "";
|
||||
List<CsDataSet> 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<CsDataSet> dataSet = new ArrayList<>();
|
||||
List<CsDevModelRelationPO> 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<CsDataSet> dataSet = new ArrayList<>();
|
||||
List<CsDevModelRelationPO> 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<CsEquipmentDeliv
|
||||
}
|
||||
deviceManagerVo.setDataSetList(dataSetList);
|
||||
List<CsLinePO> csLinePOS = csLinePOService.findByNdid(csEquipmentDeliveryPo.getNdid());
|
||||
if(!csLinePOS.isEmpty()){
|
||||
if (!csLinePOS.isEmpty()) {
|
||||
Optional<CsLinePO> 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<CsEquipmentDeliv
|
||||
public void updateSoftInfoBynDid(String nDid, String id, Integer module) {
|
||||
boolean result;
|
||||
LambdaUpdateWrapper<CsEquipmentDeliveryPO> 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<CsEquipmentDeliv
|
||||
|
||||
@Override
|
||||
public CsEquipmentDeliveryPO findDevByNDid(String nDid) {
|
||||
return this.lambdaQuery().eq(CsEquipmentDeliveryPO::getNdid,nDid).ne(CsEquipmentDeliveryPO::getRunStatus,0).one();
|
||||
return this.lambdaQuery().eq(CsEquipmentDeliveryPO::getNdid, nDid).ne(CsEquipmentDeliveryPO::getRunStatus, 0).one();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public List<CsEquipmentDeliveryPO> 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<CsEquipmentDeliv
|
||||
params.setSheetNum(1);
|
||||
String regex = "^[A-Za-z0-9]{6,32}$";
|
||||
try {
|
||||
ExcelImportResult<DeviceExcelTemplete> terminalBaseList = ExcelImportUtil.importExcelMore (file.getInputStream ( ), DeviceExcelTemplete.class, params);
|
||||
ExcelImportResult<DeviceExcelTemplete> terminalBaseList = ExcelImportUtil.importExcelMore(file.getInputStream(), DeviceExcelTemplete.class, params);
|
||||
//如果存在非法数据,将不合格的数据导出
|
||||
List<DeviceExcelTemplete> trueCollect = new ArrayList<> ( );
|
||||
List<DeviceExcelTemplete.IllegalityDeviceExcelTemplete> falseCollect = new ArrayList<> ( );
|
||||
for (int i = 0; i < terminalBaseList.getList ( ).size ( ); i++) {
|
||||
DeviceExcelTemplete deviceExcelTemplete = terminalBaseList.getList ( ).get (i);
|
||||
if(!deviceExcelTemplete.getNdid().matches(regex)){
|
||||
List<DeviceExcelTemplete> trueCollect = new ArrayList<>();
|
||||
List<DeviceExcelTemplete.IllegalityDeviceExcelTemplete> 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<CsEquipmentDeliv
|
||||
Map<String, SysDicTreePO> map = children.stream().collect(Collectors.toMap(SysDicTreePO::getName, dictTreeVO -> dictTreeVO));
|
||||
List<SysDicTreePO> 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<SysDicTreePO> children1 = sysDicTreePO.getChildren();
|
||||
Map<String, SysDicTreePO> map2 = children1.stream().collect(Collectors.toMap(SysDicTreePO::getName, dictTreeVO -> dictTreeVO));
|
||||
List<SysDicTreePO> 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<CsEquipmentProcessPO> collect1 = new ArrayList<>();
|
||||
List<CsEquipmentDeliveryPO> collect = trueCollect.stream ( ).map (temp -> {
|
||||
CsEquipmentDeliveryPO csEquipmentDeliveryPO = new CsEquipmentDeliveryPO ( );
|
||||
BeanUtils.copyProperties (temp, csEquipmentDeliveryPO);
|
||||
List<CsEquipmentDeliveryPO> 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<CsEquipmentDeliv
|
||||
csEquipmentProcess.setStatus(1);
|
||||
collect1.add(csEquipmentProcess);
|
||||
return csEquipmentDeliveryPO;
|
||||
}).collect (Collectors.toList ( ));
|
||||
csEquipmentProcessPOService.saveBatch(collect1,500);
|
||||
this.saveOrUpdateBatch (collect, 500);
|
||||
}).collect(Collectors.toList());
|
||||
csEquipmentProcessPOService.saveBatch(collect1, 500);
|
||||
this.saveOrUpdateBatch(collect, 500);
|
||||
return collect;
|
||||
}
|
||||
if (!CollectionUtils.isEmpty (falseCollect)) {
|
||||
ExportParams exportExcel = new ExportParams ("批量导入模板(请严格按照模板标准填入数据)", "非法设备信息");
|
||||
Workbook workbook = ExcelExportUtil.exportExcel (exportExcel, DeviceExcelTemplete.IllegalityDeviceExcelTemplete.class, falseCollect);
|
||||
ExcelStyleUtil.exportFileByWorkbook (workbook, "非法设备信息.xlsx", response);
|
||||
if (!CollectionUtils.isEmpty(falseCollect)) {
|
||||
ExportParams exportExcel = new ExportParams("批量导入模板(请严格按照模板标准填入数据)", "非法设备信息");
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(exportExcel, DeviceExcelTemplete.IllegalityDeviceExcelTemplete.class, falseCollect);
|
||||
ExcelStyleUtil.exportFileByWorkbook(workbook, "非法设备信息.xlsx", response);
|
||||
return null;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace ( );
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -683,29 +693,29 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
* 删除设备
|
||||
*/
|
||||
csLedgerQueryWrapper.clear();
|
||||
csLedgerQueryWrapper.eq("id",devId);
|
||||
csLedgerQueryWrapper.eq("id", devId);
|
||||
csLedgerService.remove(csLedgerQueryWrapper);
|
||||
csLedgerQueryWrapper.clear();
|
||||
csLedgerQueryWrapper.eq("pid",devId);
|
||||
csLedgerQueryWrapper.eq("pid", devId);
|
||||
List<CsLedger> list = csLedgerService.list(csLedgerQueryWrapper);
|
||||
List<String> collect = list.stream().map(CsLedger::getId).collect(Collectors.toList());
|
||||
csLedgerService.remove(csLedgerQueryWrapper);
|
||||
QueryWrapper<CsDevModelRelationPO> csDevModelRelationPOQueryWrapper = new QueryWrapper<>();
|
||||
csDevModelRelationPOQueryWrapper.clear();
|
||||
csDevModelRelationPOQueryWrapper.eq("dev_id",devId);
|
||||
csDevModelRelationPOQueryWrapper.eq("dev_id", devId);
|
||||
csDevModelRelationService.remove(csDevModelRelationPOQueryWrapper);
|
||||
QueryWrapper<CsDeviceUserPO> csDeviceUserPOQueryWrapper = new QueryWrapper<>();
|
||||
csDeviceUserPOQueryWrapper.clear();
|
||||
csDeviceUserPOQueryWrapper.eq("device_id",devId);
|
||||
csDeviceUserPOQueryWrapper.eq("device_id", devId);
|
||||
csDeviceUserPOService.remove(csDeviceUserPOQueryWrapper);
|
||||
if (!CollectionUtils.isEmpty(collect)) {
|
||||
QueryWrapper<CsLinePO> csLinePOQueryWrapper = new QueryWrapper<>();
|
||||
csLinePOQueryWrapper.clear();
|
||||
csLinePOQueryWrapper.in("line_id",collect);
|
||||
csLinePOQueryWrapper.in("line_id", collect);
|
||||
csLinePOService.remove(csLinePOQueryWrapper);
|
||||
QueryWrapper<AppLineTopologyDiagramPO> 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<CsEquipmentDeliv
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void testCompletion(String deviceId,Integer type,String remark) {
|
||||
public void testCompletion(String deviceId, Integer type, String remark) {
|
||||
CsEquipmentDeliveryPO one = this.lambdaQuery().eq(CsEquipmentDeliveryPO::getId, deviceId).one();
|
||||
this.lambdaUpdate().eq(CsEquipmentDeliveryPO::getId,deviceId).
|
||||
set(CsEquipmentDeliveryPO::getStatus,1).
|
||||
set(CsEquipmentDeliveryPO::getRunStatus,1).
|
||||
set(CsEquipmentDeliveryPO::getProcess,type+1).update();
|
||||
this.lambdaUpdate().eq(CsEquipmentDeliveryPO::getId, deviceId).
|
||||
set(CsEquipmentDeliveryPO::getStatus, 1).
|
||||
set(CsEquipmentDeliveryPO::getRunStatus, 1).
|
||||
set(CsEquipmentDeliveryPO::getProcess, type + 1).update();
|
||||
this.delete(deviceId);
|
||||
List<CsEquipmentProcessPO> 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<CsEquipmentProcessPO> 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<CsEquipmentDeliv
|
||||
public void updateSoftInfo(String nDid, String id) {
|
||||
boolean result;
|
||||
LambdaUpdateWrapper<CsEquipmentDeliveryPO> 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<CsEquipmentDeliv
|
||||
public void updateModuleNumber(String nDid, Integer number) {
|
||||
boolean result;
|
||||
LambdaUpdateWrapper<CsEquipmentDeliveryPO> 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<CsEquipmentDeliv
|
||||
Object object = redisUtil.getObjectByKey(key);
|
||||
if (Objects.nonNull(object)) {
|
||||
String value = object.toString();
|
||||
if (Objects.equals(value,"success")) {
|
||||
if (Objects.equals(value, "success")) {
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
@@ -798,14 +808,14 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
|
||||
@Override
|
||||
public List<CsEquipmentDeliveryPO> getAll() {
|
||||
return this.lambdaQuery().ne(CsEquipmentDeliveryPO::getRunStatus,0).list();
|
||||
return this.lambdaQuery().ne(CsEquipmentDeliveryPO::getRunStatus, 0).list();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CsEquipmentDeliveryPO> 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<CsEquipmentDeliv
|
||||
CsEquipmentDeliveryPO po = findDevByNDid(nDid);
|
||||
//设备类型
|
||||
String code = dictTreeFeignClient.queryById(po.getDevType()).getData().getCode();
|
||||
if (Objects.equals(DicDataEnum.DEV_CLD.getCode(),code) || Objects.equals(DicDataEnum.CONNECT_DEV.getCode(),code)) {
|
||||
if (Objects.equals(DicDataEnum.DEV_CLD.getCode(), code) || Objects.equals(DicDataEnum.CONNECT_DEV.getCode(), code)) {
|
||||
result = true;
|
||||
}
|
||||
return result;
|
||||
@@ -826,20 +836,25 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
@Override
|
||||
public CsEquipmentDeliveryPO getDevByLineId(String lineId) {
|
||||
CsLinePO linePO = csLinePOService.getById(lineId);
|
||||
return this.lambdaQuery().eq(CsEquipmentDeliveryPO::getId,linePO.getDeviceId()).ne(CsEquipmentDeliveryPO::getRunStatus,0).one();
|
||||
return this.lambdaQuery().eq(CsEquipmentDeliveryPO::getId, linePO.getDeviceId()).ne(CsEquipmentDeliveryPO::getRunStatus, 0).one();
|
||||
}
|
||||
|
||||
@Override
|
||||
@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)){
|
||||
throw new BusinessException (AlgorithmResponseEnum.NDID_ERROR);
|
||||
CsEquipmentDeliveryPO po = this.queryEquipmentPOByndid(param.getNdid());
|
||||
if (!Objects.isNull(po)) {
|
||||
throw new BusinessException(AlgorithmResponseEnum.NDID_ERROR);
|
||||
}
|
||||
CsEquipmentDeliveryPO csEquipmentDeliveryPo = new CsEquipmentDeliveryPO();
|
||||
BeanUtils.copyProperties (param,csEquipmentDeliveryPo);
|
||||
BeanUtils.copyProperties(param, csEquipmentDeliveryPo);
|
||||
csEquipmentDeliveryPo.setStatus(3);
|
||||
csEquipmentDeliveryPo.setRunStatus(1);
|
||||
csEquipmentDeliveryPo.setUsageStatus(1);
|
||||
@@ -852,10 +867,10 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
Node node = nodeService.getNodeById(param.getNodeId());
|
||||
List<CsEquipmentDeliveryPO> 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<CsEquipmentDeliv
|
||||
public Boolean delCldDev(String id) {
|
||||
CsEquipmentDeliveryPO one = this.lambdaQuery().eq(CsEquipmentDeliveryPO::getId, id).one();
|
||||
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getId,id);
|
||||
lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getId, id);
|
||||
boolean update = this.remove(lambdaQueryWrapper);
|
||||
List<CsLedger> list = csLedgerService.lambdaQuery().eq(CsLedger::getPid, id).list();
|
||||
if(!CollectionUtils.isEmpty(list)){
|
||||
if (!CollectionUtils.isEmpty(list)) {
|
||||
List<String> collect = list.stream().map(CsLedger::getId).collect(Collectors.toList());
|
||||
LambdaQueryWrapper<CsLinePO> csLinePOLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
csLinePOLambdaQueryWrapper.in(CsLinePO::getLineId,collect);
|
||||
LambdaQueryWrapper<CsLinePO> csLinePOLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
csLinePOLambdaQueryWrapper.in(CsLinePO::getLineId, collect);
|
||||
csLinePOService.remove(csLinePOLambdaQueryWrapper);
|
||||
}
|
||||
LambdaQueryWrapper<CsLedger> 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<CsEquipmentDeliv
|
||||
StringUtil.containsSpecialCharacters(param.getNdid());
|
||||
boolean result;
|
||||
LambdaQueryWrapper<CsEquipmentDeliveryPO> 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<CsEquipmentDeliv
|
||||
.ne(CsEquipmentDeliveryPO::getNdid, param.getNdid())
|
||||
.eq(CsEquipmentDeliveryPO::getName, param.getName())
|
||||
.ne(CsEquipmentDeliveryPO::getRunStatus, 0).list();
|
||||
if(!CollectionUtils.isEmpty (list)){
|
||||
throw new BusinessException ("设备名称不能重复");
|
||||
if (!CollectionUtils.isEmpty(list)) {
|
||||
throw new BusinessException("设备名称不能重复");
|
||||
}
|
||||
CsEquipmentDeliveryPO csEquipmentDeliveryPo = new CsEquipmentDeliveryPO();
|
||||
BeanUtils.copyProperties (param, csEquipmentDeliveryPo);
|
||||
BeanUtils.copyProperties(param, csEquipmentDeliveryPo);
|
||||
String path = this.createPath(param.getNdid());
|
||||
csEquipmentDeliveryPo.setMac(path);
|
||||
result = this.updateById(csEquipmentDeliveryPo);
|
||||
@@ -968,13 +983,13 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
CsLedger csLedger = csLedgerService.findDataById(param.getId());
|
||||
if (!Objects.isNull(csLedger)) {
|
||||
CsLedgerParam.Update csLedgerParam = new CsLedgerParam.Update();
|
||||
BeanUtils.copyProperties (csLedger, csLedgerParam);
|
||||
BeanUtils.copyProperties(csLedger, csLedgerParam);
|
||||
csLedgerParam.setName(param.getName());
|
||||
csLedgerService.updateLedgerTree(csLedgerParam);
|
||||
}
|
||||
if (result) {
|
||||
refreshDeviceDataCache();
|
||||
if (!Objects.equals(po.getUsageStatus(),param.getUsageStatus())) {
|
||||
if (!Objects.equals(po.getUsageStatus(), param.getUsageStatus())) {
|
||||
DeviceLogDTO dto = new DeviceLogDTO();
|
||||
dto.setUserName(RequestUtil.getUsername());
|
||||
dto.setOperate("设备使用状态被修改");
|
||||
@@ -1018,14 +1033,14 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
public void updateCldDevStatus(String nodeId, Integer processNo) {
|
||||
//获取需要修改的设备信息
|
||||
LambdaQueryWrapper<CsEquipmentDeliveryPO> 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<CsEquipmentDeliveryPO> 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<CsEquipmentDeliv
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void flipCldDevStatus(String time, String devId, Integer status) {
|
||||
LambdaQueryWrapper<CsEquipmentDeliveryPO> 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<CsEquipmentDeliv
|
||||
@Override
|
||||
public List<CsEquipmentDeliveryPO> getDevListByProjectId(String projectId) {
|
||||
QueryWrapper<CsLedger> csLedgerQueryWrapper = new QueryWrapper();
|
||||
csLedgerQueryWrapper.lambda().eq(CsLedger::getPid, projectId).eq(CsLedger::getState,1);
|
||||
csLedgerQueryWrapper.lambda().eq(CsLedger::getPid, projectId).eq(CsLedger::getState, 1);
|
||||
List<CsLedger> csLedgers = csLedgerMapper.selectList(csLedgerQueryWrapper);
|
||||
if (CollectionUtil.isEmpty(csLedgers)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
List<String> 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<CsEquipmentDeliveryPO> getDataByNodeIdAndProcessNo(String nodeId, Integer processNo) {
|
||||
LambdaQueryWrapper<CsEquipmentDeliveryPO> 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<CsEquipmentDeliveryPO> getListByIds(List<String> devList) {
|
||||
return this.lambdaQuery().in(CsEquipmentDeliveryPO::getId,devList).list();
|
||||
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
|
||||
@@ -1097,20 +1165,20 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
throw new BusinessException("便携式设备类型字典缺失");
|
||||
}
|
||||
LambdaQueryWrapper<CsEquipmentDeliveryPO> 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<String> 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<CsLedger> queryWrapper = new LambdaQueryWrapper<>();
|
||||
List<String> ids = result.stream().map(CsEquipmentDeliveryPO::getId).collect(Collectors.toList());
|
||||
queryWrapper.in(CsLedger::getId,ids);
|
||||
queryWrapper.in(CsLedger::getId, ids);
|
||||
List<CsLedger> list = csLedgerService.list(queryWrapper);
|
||||
if (CollectionUtil.isNotEmpty(list)) {
|
||||
Set<String> idSet = list.stream()
|
||||
@@ -1130,8 +1198,8 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
//根据前置机id获取装置数量
|
||||
public List<CsEquipmentDeliveryPO> getListByNodeId(String nodeId) {
|
||||
LambdaQueryWrapper<CsEquipmentDeliveryPO> 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 ServiceImpl<CsEquipmentDeliv
|
||||
|
||||
/**
|
||||
* 根据ndid生成二维码
|
||||
*
|
||||
* @param ndid
|
||||
* @return
|
||||
*/
|
||||
private String createQr(String ndid){
|
||||
String filePath ="";
|
||||
private String createQr(String ndid) {
|
||||
String filePath = "";
|
||||
//生成二维码文件
|
||||
try {
|
||||
QrParam qrParam = new QrParam();
|
||||
@@ -1162,7 +1231,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
BufferedImage bufferedImage = QRCodeUtil.getBufferedImage(JSONObject.toJSONString(qrParam));
|
||||
InputStream inputStream = bufferedImageToInputStream(bufferedImage);
|
||||
String fileName = ndid + ".png";
|
||||
filePath = fileStorageUtil.uploadStream(inputStream,OssPath.APP_DEVICE_QR,fileName);
|
||||
filePath = fileStorageUtil.uploadStream(inputStream, OssPath.APP_DEVICE_QR, fileName);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
4
pom.xml
4
pom.xml
@@ -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>-->
|
||||
|
||||
Reference in New Issue
Block a user