Compare commits
5 Commits
6bb9d932b8
...
895755b7e1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
895755b7e1 | ||
|
|
87b91382a8 | ||
|
|
3df7d91e4c | ||
|
|
ae220ceeea | ||
|
|
00ccff18c0 |
@@ -59,6 +59,11 @@
|
|||||||
<version>4.4.0</version>
|
<version>4.4.0</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.eclipse.paho</groupId>
|
||||||
|
<artifactId>org.eclipse.paho.client.mqttv3</artifactId>
|
||||||
|
<version>1.2.5</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<properties>
|
<properties>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
|||||||
@@ -1,12 +1,16 @@
|
|||||||
package com.njcn.csdevice.api;
|
package com.njcn.csdevice.api;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.njcn.common.pojo.constant.ServerInfo;
|
import com.njcn.common.pojo.constant.ServerInfo;
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
import com.njcn.csdevice.api.fallback.CsEdDataFeignClientFallbackFactory;
|
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.po.CsEdDataPO;
|
||||||
import com.njcn.csdevice.pojo.vo.CsEdDataVO;
|
import com.njcn.csdevice.pojo.vo.CsEdDataVO;
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
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.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|||||||
@@ -115,4 +115,9 @@ public class CsEquipmentDeliveryDTO {
|
|||||||
* 日志等级(NORMAL、DEBUG、WARN、ERROR)
|
* 日志等级(NORMAL、DEBUG、WARN、ERROR)
|
||||||
*/
|
*/
|
||||||
private String devLogLevel;
|
private String devLogLevel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备软件信息id
|
||||||
|
*/
|
||||||
|
private String softinfoId;
|
||||||
}
|
}
|
||||||
@@ -106,4 +106,9 @@ public class CsEquipmentDeliveryAddParm implements Serializable {
|
|||||||
@ApiModelProperty(value="所属项目")
|
@ApiModelProperty(value="所属项目")
|
||||||
private String associatedProject;
|
private String associatedProject;
|
||||||
|
|
||||||
|
@ApiModelProperty(value="icd")
|
||||||
|
private String icd;
|
||||||
|
|
||||||
|
@ApiModelProperty(value="是否支持升级(0:否 1:是)")
|
||||||
|
private Integer upgrade;
|
||||||
}
|
}
|
||||||
@@ -110,4 +110,10 @@ public class CsEquipmentDeliveryAuditParm {
|
|||||||
|
|
||||||
@ApiModelProperty(value="所属项目")
|
@ApiModelProperty(value="所属项目")
|
||||||
private String associatedProject;
|
private String associatedProject;
|
||||||
|
|
||||||
|
@ApiModelProperty(value="icd")
|
||||||
|
private String icd;
|
||||||
|
|
||||||
|
@ApiModelProperty(value="是否支持升级(0:否 1:是)")
|
||||||
|
private Integer upgrade;
|
||||||
}
|
}
|
||||||
@@ -2,6 +2,7 @@ package com.njcn.csdevice.pojo.param;
|
|||||||
|
|
||||||
import com.njcn.web.pojo.param.BaseParam;
|
import com.njcn.web.pojo.param.BaseParam;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import io.swagger.models.auth.In;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
@@ -40,4 +41,9 @@ public class CsEquipmentDeliveryQueryParm extends BaseParam {
|
|||||||
@ApiModelProperty("物联通讯状态 0:未连接 1:已连接")
|
@ApiModelProperty("物联通讯状态 0:未连接 1:已连接")
|
||||||
private Integer connectStatus;
|
private Integer connectStatus;
|
||||||
|
|
||||||
|
@ApiModelProperty("ICD")
|
||||||
|
private String icd;
|
||||||
|
|
||||||
|
@ApiModelProperty("是否支持升级(0:否 1:是)")
|
||||||
|
private Integer upgrade;
|
||||||
}
|
}
|
||||||
@@ -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;
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* Description:
|
* Description:
|
||||||
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||||
* Date: 2023/4/7 11:29【需求编号】
|
* Date: 2023/4/7 11:29【需求编号】
|
||||||
|
|||||||
@@ -148,4 +148,14 @@ public class CsEquipmentDeliveryPO extends BaseEntity {
|
|||||||
@TableField(value = "associated_project")
|
@TableField(value = "associated_project")
|
||||||
private String associatedProject;
|
private String associatedProject;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* icd模型
|
||||||
|
*/
|
||||||
|
@TableField(value = "icd")
|
||||||
|
private String icd;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否支持升级(0:否 1:是)
|
||||||
|
*/
|
||||||
|
private Integer upgrade;
|
||||||
}
|
}
|
||||||
@@ -70,12 +70,11 @@ public class CsEdDataVO extends BaseEntity {
|
|||||||
@ApiModelProperty(value = "版本类型")
|
@ApiModelProperty(value = "版本类型")
|
||||||
private String versionType;
|
private String versionType;
|
||||||
|
|
||||||
@ApiModelProperty(value = "crc信息")
|
|
||||||
private String crcInfo;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = ".bin文件")
|
@ApiModelProperty(value = ".bin文件")
|
||||||
private String filePath;
|
private String filePath;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "CRC校验")
|
||||||
|
private String crc;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,100 @@
|
|||||||
|
package com.njcn.csdevice.pojo.vo;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
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 devModelName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* icd型号
|
||||||
|
*/
|
||||||
|
private String icd;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 所属工程
|
||||||
|
*/
|
||||||
|
private String associatedEngineering;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 所属项目
|
||||||
|
*/
|
||||||
|
private String associatedProject;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 装置启用状态(0:停用 1:启用)
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改人员
|
||||||
|
*/
|
||||||
|
private String updateBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改人名称
|
||||||
|
*/
|
||||||
|
private String updateByName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备运行状态(0:删除 1:离线 2:在线)
|
||||||
|
*/
|
||||||
|
private Integer runStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否支持升级(0:否 1:是)
|
||||||
|
*/
|
||||||
|
private Integer upgrade;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备与MQTT服务器连接状态 (0:未连接 1:已连接)
|
||||||
|
*/
|
||||||
|
private Integer connectStatus;
|
||||||
|
}
|
||||||
@@ -23,6 +23,8 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Description:
|
* Description:
|
||||||
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||||
@@ -64,7 +66,6 @@ public class DevModelController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/queryDevModelPage")
|
@PostMapping("/queryDevModelPage")
|
||||||
@ApiOperation("设备模板分页查询")
|
@ApiOperation("设备模板分页查询")
|
||||||
@@ -110,5 +111,4 @@ public class DevModelController extends BaseController {
|
|||||||
CsDevModelPO po = csDevModelService.getModelById(id);
|
CsDevModelPO po = csDevModelService.getModelById(id);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, po, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, po, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,9 @@ import com.njcn.csdevice.enums.DeviceOperate;
|
|||||||
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
|
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
|
||||||
import com.njcn.csdevice.pojo.param.*;
|
import com.njcn.csdevice.pojo.param.*;
|
||||||
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
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.CsEquipmentDeliveryVO;
|
||||||
|
import com.njcn.csdevice.pojo.vo.DevVersionVO;
|
||||||
import com.njcn.csdevice.pojo.vo.DeviceManagerVO;
|
import com.njcn.csdevice.pojo.vo.DeviceManagerVO;
|
||||||
import com.njcn.csdevice.pojo.vo.ProjectEquipmentVO;
|
import com.njcn.csdevice.pojo.vo.ProjectEquipmentVO;
|
||||||
import com.njcn.csdevice.service.CsDevModelRelationService;
|
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.system.pojo.po.SysDicTreePO;
|
||||||
import com.njcn.web.advice.DeviceLog;
|
import com.njcn.web.advice.DeviceLog;
|
||||||
import com.njcn.web.controller.BaseController;
|
import com.njcn.web.controller.BaseController;
|
||||||
|
import com.njcn.web.pojo.param.BaseParam;
|
||||||
import io.swagger.annotations.*;
|
import io.swagger.annotations.*;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -46,6 +49,7 @@ import java.util.List;
|
|||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Description:
|
* Description:
|
||||||
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||||
@@ -416,4 +420,16 @@ public class EquipmentDeliveryController extends BaseController {
|
|||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
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 CsEquipmentDeliveryQueryParm 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
|
* @author: xuyang
|
||||||
*/
|
*/
|
||||||
CsEdDataVO findByDevTypeId(String devType);
|
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.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.njcn.csdevice.pojo.param.CsEquipmentDeliveryAddParm;
|
import com.njcn.csdevice.pojo.param.*;
|
||||||
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.po.CsEquipmentDeliveryPO;
|
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.CsEquipmentDeliveryVO;
|
||||||
|
import com.njcn.csdevice.pojo.vo.DevVersionVO;
|
||||||
import com.njcn.csdevice.pojo.vo.DeviceManagerVO;
|
import com.njcn.csdevice.pojo.vo.DeviceManagerVO;
|
||||||
import com.njcn.csdevice.pojo.vo.ProjectEquipmentVO;
|
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 org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
@@ -195,4 +196,5 @@ public interface CsEquipmentDeliveryService extends IService<CsEquipmentDelivery
|
|||||||
|
|
||||||
List<CsEquipmentDeliveryPO> getRunPortableDev(String userId);
|
List<CsEquipmentDeliveryPO> getRunPortableDev(String userId);
|
||||||
|
|
||||||
|
IPage<DevVersionVO> versionPage(CsEquipmentDeliveryQueryParm baseParam);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.njcn.csdevice.service.impl;
|
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.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
@@ -42,7 +43,9 @@ public class CsEdDataServiceImpl extends ServiceImpl<CsEdDataMapper, CsEdDataPO>
|
|||||||
public boolean addEdData(CsEdDataAddParm csEdDataAddParm) {
|
public boolean addEdData(CsEdDataAddParm csEdDataAddParm) {
|
||||||
CsEdDataPO csEdDataPO = new CsEdDataPO();
|
CsEdDataPO csEdDataPO = new CsEdDataPO();
|
||||||
BeanUtils.copyProperties(csEdDataAddParm, csEdDataPO);
|
BeanUtils.copyProperties(csEdDataAddParm, csEdDataPO);
|
||||||
String filePath = fileStorageUtil.uploadMultipart (csEdDataAddParm.getFile (), OssPath.EDDATA);
|
String remoteDir = OssPath.EDDATA + csEdDataAddParm.getDevTypeName() + StrUtil.SLASH + csEdDataAddParm.getVersionNo() + StrUtil.SLASH;
|
||||||
|
String filePath = fileStorageUtil.uploadMultipart(csEdDataAddParm.getFile(), remoteDir);
|
||||||
|
csEdDataPO.setCrc(csEdDataAddParm.getCrcInfo());
|
||||||
csEdDataPO.setFilePath(filePath);
|
csEdDataPO.setFilePath(filePath);
|
||||||
csEdDataPO.setStatus("1");
|
csEdDataPO.setStatus("1");
|
||||||
boolean save = this.save(csEdDataPO);
|
boolean save = this.save(csEdDataPO);
|
||||||
@@ -84,5 +87,11 @@ public class CsEdDataServiceImpl extends ServiceImpl<CsEdDataMapper, CsEdDataPO>
|
|||||||
BeanUtils.copyProperties(csEdDataPo, csEdDataVo);
|
BeanUtils.copyProperties(csEdDataPo, csEdDataVo);
|
||||||
return 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,12 +5,13 @@ import cn.afterturn.easypoi.excel.ExcelImportUtil;
|
|||||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||||
import cn.afterturn.easypoi.excel.entity.ImportParams;
|
import cn.afterturn.easypoi.excel.entity.ImportParams;
|
||||||
import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult;
|
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.CollUtil;
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import cn.hutool.core.date.DatePattern;
|
import cn.hutool.core.date.DatePattern;
|
||||||
import cn.hutool.core.text.StrPool;
|
import cn.hutool.core.text.StrPool;
|
||||||
import cn.hutool.core.util.IdUtil;
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.alibaba.nacos.client.naming.utils.CollectionUtils;
|
import com.alibaba.nacos.client.naming.utils.CollectionUtils;
|
||||||
@@ -25,6 +26,7 @@ import com.njcn.access.utils.MqttUtil;
|
|||||||
import com.njcn.common.pojo.dto.DeviceLogDTO;
|
import com.njcn.common.pojo.dto.DeviceLogDTO;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.csdevice.api.CsLogsFeignClient;
|
import com.njcn.csdevice.api.CsLogsFeignClient;
|
||||||
|
import com.njcn.csdevice.api.EngineeringFeignClient;
|
||||||
import com.njcn.csdevice.constant.DataParam;
|
import com.njcn.csdevice.constant.DataParam;
|
||||||
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
|
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
|
||||||
import com.njcn.csdevice.mapper.CsEquipmentDeliveryMapper;
|
import com.njcn.csdevice.mapper.CsEquipmentDeliveryMapper;
|
||||||
@@ -35,6 +37,7 @@ import com.njcn.csdevice.pojo.dto.PqsCommunicateDto;
|
|||||||
import com.njcn.csdevice.pojo.param.*;
|
import com.njcn.csdevice.pojo.param.*;
|
||||||
import com.njcn.csdevice.pojo.po.*;
|
import com.njcn.csdevice.pojo.po.*;
|
||||||
import com.njcn.csdevice.pojo.vo.CsEquipmentDeliveryVO;
|
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.DeviceManagerVO;
|
||||||
import com.njcn.csdevice.pojo.vo.ProjectEquipmentVO;
|
import com.njcn.csdevice.pojo.vo.ProjectEquipmentVO;
|
||||||
import com.njcn.csdevice.service.*;
|
import com.njcn.csdevice.service.*;
|
||||||
@@ -54,7 +57,10 @@ import com.njcn.system.enums.DicDataEnum;
|
|||||||
import com.njcn.system.enums.DicDataTypeEnum;
|
import com.njcn.system.enums.DicDataTypeEnum;
|
||||||
import com.njcn.system.pojo.po.SysDicTreePO;
|
import com.njcn.system.pojo.po.SysDicTreePO;
|
||||||
import com.njcn.system.pojo.vo.DictTreeVO;
|
import com.njcn.system.pojo.vo.DictTreeVO;
|
||||||
|
import com.njcn.user.api.UserFeignClient;
|
||||||
import com.njcn.user.enums.AppRoleEnum;
|
import com.njcn.user.enums.AppRoleEnum;
|
||||||
|
import com.njcn.user.pojo.po.User;
|
||||||
|
import com.njcn.web.factory.PageFactory;
|
||||||
import com.njcn.web.utils.RequestUtil;
|
import com.njcn.web.utils.RequestUtil;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
@@ -76,8 +82,8 @@ import java.time.LocalDateTime;
|
|||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* Description:
|
* Description:
|
||||||
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||||
* Date: 2023/3/30 16:23【需求编号】
|
* Date: 2023/3/30 16:23【需求编号】
|
||||||
@@ -111,7 +117,13 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
private final CsTerminalLogsMapper csTerminalLogsMapper;
|
private final CsTerminalLogsMapper csTerminalLogsMapper;
|
||||||
private final ICsCommunicateService csCommunicateService;
|
private final ICsCommunicateService csCommunicateService;
|
||||||
private final ICsUserPinsService csUserPinsService;
|
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;
|
private final EventUserFeignClient eventUserFeignClient;
|
||||||
|
private final UserFeignClient userFeignClient;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void refreshDeviceDataCache() {
|
public void refreshDeviceDataCache() {
|
||||||
@@ -125,11 +137,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
@Transactional(rollbackFor = {Exception.class})
|
@Transactional(rollbackFor = {Exception.class})
|
||||||
public CsEquipmentDeliveryPO save(CsEquipmentDeliveryAddParm csEquipmentDeliveryAddParm) {
|
public CsEquipmentDeliveryPO save(CsEquipmentDeliveryAddParm csEquipmentDeliveryAddParm) {
|
||||||
boolean result;
|
boolean result;
|
||||||
List<CsEquipmentDeliveryPO> one = this.lambdaQuery()
|
List<CsEquipmentDeliveryPO> one = this.lambdaQuery().eq(CsEquipmentDeliveryPO::getName, csEquipmentDeliveryAddParm.getName()).ne(CsEquipmentDeliveryPO::getRunStatus, 0).eq(CsEquipmentDeliveryPO::getDevAccessMethod, "MQTT").list();
|
||||||
.eq(CsEquipmentDeliveryPO::getName, csEquipmentDeliveryAddParm.getName())
|
|
||||||
.ne(CsEquipmentDeliveryPO::getRunStatus, 0)
|
|
||||||
.eq(CsEquipmentDeliveryPO::getDevAccessMethod, "MQTT")
|
|
||||||
.list();
|
|
||||||
if (CollUtil.isNotEmpty(one)) {
|
if (CollUtil.isNotEmpty(one)) {
|
||||||
throw new BusinessException("设备名称不能重复");
|
throw new BusinessException("设备名称不能重复");
|
||||||
}
|
}
|
||||||
@@ -241,6 +249,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
BeanUtils.copyProperties(csEquipmentDeliveryPO, result);
|
BeanUtils.copyProperties(csEquipmentDeliveryPO, result);
|
||||||
|
BeanUtils.copyProperties(csEquipmentDeliveryPO, result);
|
||||||
if (!Objects.isNull(csEquipmentDeliveryPO.getAssociatedEngineering()) && !Objects.equals(csEquipmentDeliveryPO.getAssociatedEngineering(), "")) {
|
if (!Objects.isNull(csEquipmentDeliveryPO.getAssociatedEngineering()) && !Objects.equals(csEquipmentDeliveryPO.getAssociatedEngineering(), "")) {
|
||||||
result.setAssociatedEngineeringName(csLedgerService.findDataById(csEquipmentDeliveryPO.getAssociatedEngineering()).getName());
|
result.setAssociatedEngineeringName(csLedgerService.findDataById(csEquipmentDeliveryPO.getAssociatedEngineering()).getName());
|
||||||
}
|
}
|
||||||
@@ -275,10 +284,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
param.setEndTime(LocalDateTime.now().format(DatePattern.NORM_DATETIME_FORMATTER));
|
param.setEndTime(LocalDateTime.now().format(DatePattern.NORM_DATETIME_FORMATTER));
|
||||||
param.setEventIds(lineIds.stream().map(CsLinePO::getLineId).collect(Collectors.toList()));
|
param.setEventIds(lineIds.stream().map(CsLinePO::getLineId).collect(Collectors.toList()));
|
||||||
List<CsEventPO> eventList = eventUserFeignClient.queryTempEventDetail(param).getData();
|
List<CsEventPO> eventList = eventUserFeignClient.queryTempEventDetail(param).getData();
|
||||||
Map<String, List<CsEventPO>> eventMap = Optional.ofNullable(eventList)
|
Map<String, List<CsEventPO>> eventMap = Optional.ofNullable(eventList).orElse(Collections.emptyList()).stream().collect(Collectors.groupingBy(CsEventPO::getDeviceId));
|
||||||
.orElse(Collections.emptyList())
|
|
||||||
.stream()
|
|
||||||
.collect(Collectors.groupingBy(CsEventPO::getDeviceId));
|
|
||||||
|
|
||||||
List<ProjectEquipmentVO> recordList = new ArrayList<>();
|
List<ProjectEquipmentVO> recordList = new ArrayList<>();
|
||||||
list.getRecords().forEach(temp -> {
|
list.getRecords().forEach(temp -> {
|
||||||
@@ -296,10 +302,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
|
|
||||||
//获取用户置顶的设备
|
//获取用户置顶的设备
|
||||||
List<CsUserPins> topList = csUserPinsService.getPinToTopList();
|
List<CsUserPins> topList = csUserPinsService.getPinToTopList();
|
||||||
List<String> targetIdList = topList.stream()
|
List<String> targetIdList = topList.stream().filter(item -> Objects.equals(item.getTargetType(), 1)).map(CsUserPins::getTargetId).collect(Collectors.toList());
|
||||||
.filter(item -> Objects.equals(item.getTargetType(), 1))
|
|
||||||
.map(CsUserPins::getTargetId)
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
if (CollectionUtil.isNotEmpty(targetIdList)) {
|
if (CollectionUtil.isNotEmpty(targetIdList)) {
|
||||||
List<ProjectEquipmentVO> matchedList = new ArrayList<>();
|
List<ProjectEquipmentVO> matchedList = new ArrayList<>();
|
||||||
List<ProjectEquipmentVO> unmatchedList = new ArrayList<>();
|
List<ProjectEquipmentVO> unmatchedList = new ArrayList<>();
|
||||||
@@ -330,9 +333,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
StringUtil.containsSpecialCharacters(csEquipmentDeliveryAuditParm.getNdid());
|
StringUtil.containsSpecialCharacters(csEquipmentDeliveryAuditParm.getNdid());
|
||||||
boolean result;
|
boolean result;
|
||||||
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getNdid,csEquipmentDeliveryAuditParm.getNdid())
|
lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getNdid, csEquipmentDeliveryAuditParm.getNdid()).in(CsEquipmentDeliveryPO::getStatus, Arrays.asList(1, 2, 3)).ne(CsEquipmentDeliveryPO::getId, csEquipmentDeliveryAuditParm.getId());
|
||||||
.in(CsEquipmentDeliveryPO::getStatus,Arrays.asList(1,2,3))
|
|
||||||
.ne(CsEquipmentDeliveryPO::getId, csEquipmentDeliveryAuditParm.getId());
|
|
||||||
int countByAccount = this.count(lambdaQueryWrapper);
|
int countByAccount = this.count(lambdaQueryWrapper);
|
||||||
//大于等于1个则表示重复
|
//大于等于1个则表示重复
|
||||||
if (countByAccount >= 1) {
|
if (countByAccount >= 1) {
|
||||||
@@ -341,11 +342,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper2 = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper2 = new LambdaQueryWrapper<>();
|
||||||
lambdaQueryWrapper2.eq(CsEquipmentDeliveryPO::getId, csEquipmentDeliveryAuditParm.getId());
|
lambdaQueryWrapper2.eq(CsEquipmentDeliveryPO::getId, csEquipmentDeliveryAuditParm.getId());
|
||||||
CsEquipmentDeliveryPO po = this.baseMapper.selectOne(lambdaQueryWrapper2);
|
CsEquipmentDeliveryPO po = this.baseMapper.selectOne(lambdaQueryWrapper2);
|
||||||
List<CsEquipmentDeliveryPO> list = this.lambdaQuery()
|
List<CsEquipmentDeliveryPO> list = this.lambdaQuery().ne(CsEquipmentDeliveryPO::getId, csEquipmentDeliveryAuditParm.getId()).ne(CsEquipmentDeliveryPO::getNdid, csEquipmentDeliveryAuditParm.getNdid()).eq(CsEquipmentDeliveryPO::getName, csEquipmentDeliveryAuditParm.getName()).ne(CsEquipmentDeliveryPO::getRunStatus, 0).list();
|
||||||
.ne(CsEquipmentDeliveryPO::getId, csEquipmentDeliveryAuditParm.getId())
|
|
||||||
.ne(CsEquipmentDeliveryPO::getNdid, csEquipmentDeliveryAuditParm.getNdid())
|
|
||||||
.eq(CsEquipmentDeliveryPO::getName, csEquipmentDeliveryAuditParm.getName())
|
|
||||||
.ne(CsEquipmentDeliveryPO::getRunStatus, 0).list();
|
|
||||||
if (!CollectionUtils.isEmpty(list)) {
|
if (!CollectionUtils.isEmpty(list)) {
|
||||||
throw new BusinessException("设备名称不能重复");
|
throw new BusinessException("设备名称不能重复");
|
||||||
}
|
}
|
||||||
@@ -414,11 +411,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ObjectUtil.isNotNull(queryParam.getConnectStatus())) {
|
if (ObjectUtil.isNotNull(queryParam.getConnectStatus())) {
|
||||||
recordList = recordList.stream()
|
recordList = recordList.stream().filter(item -> queryParam.getConnectStatus() == 0 ? "未连接".equals(item.getConnectStatus()) : "已连接".equals(item.getConnectStatus())).collect(Collectors.toList());
|
||||||
.filter(item -> queryParam.getConnectStatus() == 0
|
|
||||||
? "未连接".equals(item.getConnectStatus())
|
|
||||||
: "已连接".equals(item.getConnectStatus()))
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
}
|
}
|
||||||
page.setTotal(CollectionUtil.isEmpty(recordList) ? 0 : recordList.size());
|
page.setTotal(CollectionUtil.isEmpty(recordList) ? 0 : recordList.size());
|
||||||
page.setRecords(recordList);
|
page.setRecords(recordList);
|
||||||
@@ -521,9 +514,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
//限制角色展示
|
//限制角色展示
|
||||||
String role = RequestUtil.getUserRole();
|
String role = RequestUtil.getUserRole();
|
||||||
List<String> strings = JSONArray.parseArray(role, String.class);
|
List<String> strings = JSONArray.parseArray(role, String.class);
|
||||||
if (strings.contains(AppRoleEnum.ENGINEERING_USER.getCode())
|
if (strings.contains(AppRoleEnum.ENGINEERING_USER.getCode()) || strings.contains(AppRoleEnum.OPERATION_MANAGER.getCode()) || strings.contains(AppRoleEnum.ROOT.getCode())) {
|
||||||
|| strings.contains(AppRoleEnum.OPERATION_MANAGER.getCode())
|
|
||||||
|| strings.contains(AppRoleEnum.ROOT.getCode())) {
|
|
||||||
addDataSet(dataSetList, item, "模块数据", "moduleData");
|
addDataSet(dataSetList, item, "模块数据", "moduleData");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -733,20 +724,12 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
@Transactional(rollbackFor = Exception.class)
|
@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();
|
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 + 1).update();
|
||||||
set(CsEquipmentDeliveryPO::getStatus,1).
|
|
||||||
set(CsEquipmentDeliveryPO::getRunStatus,1).
|
|
||||||
set(CsEquipmentDeliveryPO::getProcess,type+1).update();
|
|
||||||
this.delete(deviceId);
|
this.delete(deviceId);
|
||||||
List<CsEquipmentProcessPO> list = csEquipmentProcessPOService.lambdaQuery().eq(CsEquipmentProcessPO::getDevId, one.getNdid()).
|
List<CsEquipmentProcessPO> list = csEquipmentProcessPOService.lambdaQuery().eq(CsEquipmentProcessPO::getDevId, one.getNdid()).eq(CsEquipmentProcessPO::getProcess, type).orderByDesc(CsEquipmentProcessPO::getStartTime).list();
|
||||||
eq(CsEquipmentProcessPO::getProcess, type).orderByDesc(CsEquipmentProcessPO::getStartTime).list();
|
|
||||||
//获取最新一条数据;
|
//获取最新一条数据;
|
||||||
CsEquipmentProcessPO csEquipmentProcessPO = list.get(0);
|
CsEquipmentProcessPO csEquipmentProcessPO = list.get(0);
|
||||||
csEquipmentProcessPOService.lambdaUpdate().eq(CsEquipmentProcessPO::getId,csEquipmentProcessPO.getId()).
|
csEquipmentProcessPOService.lambdaUpdate().eq(CsEquipmentProcessPO::getId, csEquipmentProcessPO.getId()).set(CsEquipmentProcessPO::getStatus, 1).set(CsEquipmentProcessPO::getEndTime, LocalDateTime.now()).set(CsEquipmentProcessPO::getRemark, remark).update();
|
||||||
set(CsEquipmentProcessPO::getStatus,1).
|
|
||||||
set(CsEquipmentProcessPO::getEndTime,LocalDateTime.now()).
|
|
||||||
set(CsEquipmentProcessPO::getRemark,remark).
|
|
||||||
update();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -757,24 +740,17 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
// set(CsEquipmentDeliveryPO::getRunStatus,1).
|
// set(CsEquipmentDeliveryPO::getRunStatus,1).
|
||||||
set(CsEquipmentDeliveryPO::getProcess, type).update();
|
set(CsEquipmentDeliveryPO::getProcess, type).update();
|
||||||
this.delete(deviceId);
|
this.delete(deviceId);
|
||||||
List<CsEquipmentProcessPO> list = csEquipmentProcessPOService.lambdaQuery().eq(CsEquipmentProcessPO::getDevId, one.getNdid()).
|
List<CsEquipmentProcessPO> list = csEquipmentProcessPOService.lambdaQuery().eq(CsEquipmentProcessPO::getDevId, one.getNdid()).eq(CsEquipmentProcessPO::getProcess, type).orderByDesc(CsEquipmentProcessPO::getStartTime).list();
|
||||||
eq(CsEquipmentProcessPO::getProcess, type).orderByDesc(CsEquipmentProcessPO::getStartTime).list();
|
|
||||||
//获取最新一条数据;
|
//获取最新一条数据;
|
||||||
CsEquipmentProcessPO csEquipmentProcessPO = list.get(0);
|
CsEquipmentProcessPO csEquipmentProcessPO = list.get(0);
|
||||||
csEquipmentProcessPOService.lambdaUpdate().eq(CsEquipmentProcessPO::getId,csEquipmentProcessPO.getId()).
|
csEquipmentProcessPOService.lambdaUpdate().eq(CsEquipmentProcessPO::getId, csEquipmentProcessPO.getId()).set(CsEquipmentProcessPO::getStatus, 0).set(CsEquipmentProcessPO::getEndTime, LocalDateTime.now()).set(CsEquipmentProcessPO::getRemark, remark).update();
|
||||||
set(CsEquipmentProcessPO::getStatus,0).
|
|
||||||
set(CsEquipmentProcessPO::getEndTime,LocalDateTime.now()).
|
|
||||||
set(CsEquipmentProcessPO::getRemark,remark).
|
|
||||||
update();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateSoftInfo(String nDid, String id) {
|
public void updateSoftInfo(String nDid, String id) {
|
||||||
boolean result;
|
boolean result;
|
||||||
LambdaUpdateWrapper<CsEquipmentDeliveryPO> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
|
LambdaUpdateWrapper<CsEquipmentDeliveryPO> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
|
||||||
lambdaUpdateWrapper.eq(CsEquipmentDeliveryPO::getNdid,nDid)
|
lambdaUpdateWrapper.eq(CsEquipmentDeliveryPO::getNdid, nDid).ne(CsEquipmentDeliveryPO::getRunStatus, 0).set(CsEquipmentDeliveryPO::getSoftinfoId, id);
|
||||||
.ne(CsEquipmentDeliveryPO::getRunStatus,0)
|
|
||||||
.set(CsEquipmentDeliveryPO::getSoftinfoId,id);
|
|
||||||
result = this.update(lambdaUpdateWrapper);
|
result = this.update(lambdaUpdateWrapper);
|
||||||
if (result) {
|
if (result) {
|
||||||
refreshDeviceDataCache();
|
refreshDeviceDataCache();
|
||||||
@@ -785,9 +761,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
public void updateModuleNumber(String nDid, Integer number) {
|
public void updateModuleNumber(String nDid, Integer number) {
|
||||||
boolean result;
|
boolean result;
|
||||||
LambdaUpdateWrapper<CsEquipmentDeliveryPO> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
|
LambdaUpdateWrapper<CsEquipmentDeliveryPO> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
|
||||||
lambdaUpdateWrapper.eq(CsEquipmentDeliveryPO::getNdid,nDid)
|
lambdaUpdateWrapper.eq(CsEquipmentDeliveryPO::getNdid, nDid).ne(CsEquipmentDeliveryPO::getRunStatus, 0).set(CsEquipmentDeliveryPO::getModuleNumber, number);
|
||||||
.ne(CsEquipmentDeliveryPO::getRunStatus,0)
|
|
||||||
.set(CsEquipmentDeliveryPO::getModuleNumber,number);
|
|
||||||
result = this.update(lambdaUpdateWrapper);
|
result = this.update(lambdaUpdateWrapper);
|
||||||
if (result) {
|
if (result) {
|
||||||
refreshDeviceDataCache();
|
refreshDeviceDataCache();
|
||||||
@@ -821,11 +795,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<CsEquipmentDeliveryPO> getAllOnline() {
|
public List<CsEquipmentDeliveryPO> getAllOnline() {
|
||||||
return this.lambdaQuery()
|
return this.lambdaQuery().ne(CsEquipmentDeliveryPO::getRunStatus, 0).eq(CsEquipmentDeliveryPO::getUsageStatus, 1).isNotNull(CsEquipmentDeliveryPO::getNodeId).list();
|
||||||
.ne(CsEquipmentDeliveryPO::getRunStatus,0)
|
|
||||||
.eq(CsEquipmentDeliveryPO::getUsageStatus,1)
|
|
||||||
.isNotNull(CsEquipmentDeliveryPO::getNodeId)
|
|
||||||
.list();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -851,6 +821,11 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public CsEquipmentDeliveryPO saveCld(CsEquipmentDeliveryAddParm param) {
|
public CsEquipmentDeliveryPO saveCld(CsEquipmentDeliveryAddParm param) {
|
||||||
boolean result;
|
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());
|
StringUtil.containsSpecialCharacters(param.getNdid());
|
||||||
CsEquipmentDeliveryPO po = this.queryEquipmentPOByndid(param.getNdid());
|
CsEquipmentDeliveryPO po = this.queryEquipmentPOByndid(param.getNdid());
|
||||||
if (!Objects.isNull(po)) {
|
if (!Objects.isNull(po)) {
|
||||||
@@ -932,7 +907,6 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
}
|
}
|
||||||
//新增操作日志
|
//新增操作日志
|
||||||
CsTerminalLogs csTerminalLogs = new CsTerminalLogs();
|
CsTerminalLogs csTerminalLogs = new CsTerminalLogs();
|
||||||
csTerminalLogs.setId(IdUtil.simpleUUID());
|
|
||||||
csTerminalLogs.setDeviceId(id);
|
csTerminalLogs.setDeviceId(id);
|
||||||
csTerminalLogs.setOperateType(2);
|
csTerminalLogs.setOperateType(2);
|
||||||
csTerminalLogs.setIsPush(0);
|
csTerminalLogs.setIsPush(0);
|
||||||
@@ -959,9 +933,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
StringUtil.containsSpecialCharacters(param.getNdid());
|
StringUtil.containsSpecialCharacters(param.getNdid());
|
||||||
boolean result;
|
boolean result;
|
||||||
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getNdid,param.getNdid())
|
lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getNdid, param.getNdid()).in(CsEquipmentDeliveryPO::getStatus, Arrays.asList(1, 2, 3)).ne(CsEquipmentDeliveryPO::getId, param.getId());
|
||||||
.in(CsEquipmentDeliveryPO::getStatus,Arrays.asList(1,2,3))
|
|
||||||
.ne(CsEquipmentDeliveryPO::getId, param.getId());
|
|
||||||
int countByAccount = this.count(lambdaQueryWrapper);
|
int countByAccount = this.count(lambdaQueryWrapper);
|
||||||
//大于等于1个则表示重复
|
//大于等于1个则表示重复
|
||||||
if (countByAccount >= 1) {
|
if (countByAccount >= 1) {
|
||||||
@@ -970,11 +942,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper2 = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper2 = new LambdaQueryWrapper<>();
|
||||||
lambdaQueryWrapper2.eq(CsEquipmentDeliveryPO::getId, param.getId());
|
lambdaQueryWrapper2.eq(CsEquipmentDeliveryPO::getId, param.getId());
|
||||||
CsEquipmentDeliveryPO po = this.baseMapper.selectOne(lambdaQueryWrapper2);
|
CsEquipmentDeliveryPO po = this.baseMapper.selectOne(lambdaQueryWrapper2);
|
||||||
List<CsEquipmentDeliveryPO> list = this.lambdaQuery()
|
List<CsEquipmentDeliveryPO> list = this.lambdaQuery().ne(CsEquipmentDeliveryPO::getId, param.getId()).ne(CsEquipmentDeliveryPO::getNdid, param.getNdid()).eq(CsEquipmentDeliveryPO::getName, param.getName()).ne(CsEquipmentDeliveryPO::getRunStatus, 0).list();
|
||||||
.ne(CsEquipmentDeliveryPO::getId, param.getId())
|
|
||||||
.ne(CsEquipmentDeliveryPO::getNdid, param.getNdid())
|
|
||||||
.eq(CsEquipmentDeliveryPO::getName, param.getName())
|
|
||||||
.ne(CsEquipmentDeliveryPO::getRunStatus, 0).list();
|
|
||||||
if (!CollectionUtils.isEmpty(list)) {
|
if (!CollectionUtils.isEmpty(list)) {
|
||||||
throw new BusinessException("设备名称不能重复");
|
throw new BusinessException("设备名称不能重复");
|
||||||
}
|
}
|
||||||
@@ -1026,9 +994,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
state.add(9);
|
state.add(9);
|
||||||
}
|
}
|
||||||
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getNodeId,id)
|
lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getNodeId, id).in(ObjectUtil.isNotEmpty(state), CsEquipmentDeliveryPO::getUsageStatus, state).eq(CsEquipmentDeliveryPO::getDevAccessMethod, "CLD");
|
||||||
.in(ObjectUtil.isNotEmpty(state),CsEquipmentDeliveryPO::getUsageStatus,state)
|
|
||||||
.eq(CsEquipmentDeliveryPO::getDevAccessMethod,"CLD");
|
|
||||||
return this.list(lambdaQueryWrapper);
|
return this.list(lambdaQueryWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1037,10 +1003,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
public void updateCldDevStatus(String nodeId, Integer processNo) {
|
public void updateCldDevStatus(String nodeId, Integer processNo) {
|
||||||
//获取需要修改的设备信息
|
//获取需要修改的设备信息
|
||||||
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getNodeId,nodeId)
|
lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getNodeId, nodeId).eq(CsEquipmentDeliveryPO::getNodeProcess, processNo).eq(CsEquipmentDeliveryPO::getUsageStatus, 1).eq(CsEquipmentDeliveryPO::getRunStatus, 2);
|
||||||
.eq(CsEquipmentDeliveryPO::getNodeProcess,processNo)
|
|
||||||
.eq(CsEquipmentDeliveryPO::getUsageStatus,1)
|
|
||||||
.eq(CsEquipmentDeliveryPO::getRunStatus,2);
|
|
||||||
List<CsEquipmentDeliveryPO> devList = this.list(lambdaQueryWrapper);
|
List<CsEquipmentDeliveryPO> devList = this.list(lambdaQueryWrapper);
|
||||||
if (CollectionUtil.isNotEmpty(devList)) {
|
if (CollectionUtil.isNotEmpty(devList)) {
|
||||||
//修改设备运行状态
|
//修改设备运行状态
|
||||||
@@ -1056,9 +1019,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void flipCldDevStatus(String time, String devId, Integer status) {
|
public void flipCldDevStatus(String time, String devId, Integer status) {
|
||||||
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getId,devId)
|
lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getId, devId).eq(CsEquipmentDeliveryPO::getUsageStatus, 1).ne(CsEquipmentDeliveryPO::getUsageStatus, 0);
|
||||||
.eq(CsEquipmentDeliveryPO::getUsageStatus,1)
|
|
||||||
.ne(CsEquipmentDeliveryPO::getUsageStatus,0);
|
|
||||||
CsEquipmentDeliveryPO po = this.getOne(lambdaQueryWrapper);
|
CsEquipmentDeliveryPO po = this.getOne(lambdaQueryWrapper);
|
||||||
if (ObjectUtil.isNotNull(po)) {
|
if (ObjectUtil.isNotNull(po)) {
|
||||||
po.setRunStatus(status);
|
po.setRunStatus(status);
|
||||||
@@ -1094,9 +1055,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
@Override
|
@Override
|
||||||
public List<CsEquipmentDeliveryPO> getDataByNodeIdAndProcessNo(String nodeId, Integer processNo) {
|
public List<CsEquipmentDeliveryPO> getDataByNodeIdAndProcessNo(String nodeId, Integer processNo) {
|
||||||
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getNodeId,nodeId)
|
lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getNodeId, nodeId).ne(CsEquipmentDeliveryPO::getRunStatus, 0).eq(CsEquipmentDeliveryPO::getDevAccessMethod, "CLD");
|
||||||
.ne(CsEquipmentDeliveryPO::getRunStatus,0)
|
|
||||||
.eq(CsEquipmentDeliveryPO::getDevAccessMethod,"CLD");
|
|
||||||
if (ObjectUtil.isNotNull(processNo)) {
|
if (ObjectUtil.isNotNull(processNo)) {
|
||||||
lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getNodeProcess, processNo);
|
lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getNodeProcess, processNo);
|
||||||
}
|
}
|
||||||
@@ -1108,6 +1067,77 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
return this.lambdaQuery().in(CsEquipmentDeliveryPO::getId, devList).list();
|
return this.lambdaQuery().in(CsEquipmentDeliveryPO::getId, devList).list();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IPage<DevVersionVO> versionPage(CsEquipmentDeliveryQueryParm baseParam) {
|
||||||
|
LambdaQueryWrapper<CsEquipmentDeliveryPO> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
wrapper.ne(CsEquipmentDeliveryPO::getRunStatus, 0)
|
||||||
|
.eq(StrUtil.isNotBlank(baseParam.getDevModel()), CsEquipmentDeliveryPO::getDevModel, baseParam.getDevModel())
|
||||||
|
.eq(StrUtil.isNotBlank(baseParam.getIcd()), CsEquipmentDeliveryPO::getIcd, baseParam.getIcd())
|
||||||
|
.eq(ObjectUtil.isNotNull(baseParam.getUpgrade()), CsEquipmentDeliveryPO::getUpgrade, baseParam.getUpgrade())
|
||||||
|
.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<>();
|
||||||
|
List<DevVersionVO> finalRecords = records;
|
||||||
|
page.getRecords().forEach(item -> {
|
||||||
|
DevVersionVO devVersionVO = BeanUtil.copyProperties(item, DevVersionVO.class);
|
||||||
|
List<User> userData = userFeignClient.getUserByIdList(Collections.singletonList(item.getUpdateBy())).getData();
|
||||||
|
if (CollectionUtil.isNotEmpty(userData)) {
|
||||||
|
devVersionVO.setUpdateByName(userData.get(0).getName());
|
||||||
|
}
|
||||||
|
if (StrUtil.isNotBlank(item.getSoftinfoId())) {
|
||||||
|
CsSoftInfoPO softInfoPO = csSoftInfoService.getById(item.getSoftinfoId());
|
||||||
|
|
||||||
|
if (ObjectUtil.isNotNull(softInfoPO)) {
|
||||||
|
CsEdDataPO csEdDataPO = csEdDataService.findByDevTypeIdAndVersionNo(item.getDevModel(), softInfoPO.getAppVersion());
|
||||||
|
if (ObjectUtil.isNotNull(csEdDataPO)) {
|
||||||
|
devVersionVO.setVersion(csEdDataPO.getVersionNo());
|
||||||
|
devVersionVO.setProtocolVersion(csEdDataPO.getVersionAgreement());
|
||||||
|
devVersionVO.setVersionDate(csEdDataPO.getVersionDate());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
devVersionVO.setStatus(item.getUsageStatus());
|
||||||
|
devVersionVO.setIcd(item.getIcd());
|
||||||
|
if (StrUtil.isNotBlank(item.getDevModel())) {
|
||||||
|
SysDicTreePO sysDicTreePO = dictTreeFeignClient.queryById(item.getDevModel()).getData();
|
||||||
|
if (ObjectUtil.isNotNull(sysDicTreePO)) {
|
||||||
|
devVersionVO.setDevModelName(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());
|
||||||
|
}
|
||||||
|
|
||||||
|
//判断装置是否已经连接上mqtt服务器
|
||||||
|
String clientName = "NJCN-" + item.getNdid().substring(item.getNdid().length() - 6);
|
||||||
|
boolean mqttClient = mqttUtil.judgeClientOnline(clientName);
|
||||||
|
if (mqttClient) {
|
||||||
|
devVersionVO.setConnectStatus(1);
|
||||||
|
} else {
|
||||||
|
devVersionVO.setConnectStatus(0);
|
||||||
|
}
|
||||||
|
finalRecords.add(devVersionVO);
|
||||||
|
});
|
||||||
|
|
||||||
|
Page<DevVersionVO> resultPage = new Page<>(PageFactory.getPageNum(baseParam), PageFactory.getPageSize(baseParam));
|
||||||
|
if (ObjectUtil.isNotNull(baseParam.getConnectStatus())) {
|
||||||
|
records = records.stream().filter(item -> baseParam.getConnectStatus().equals(item.getConnectStatus())).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
resultPage.setTotal(CollectionUtil.isEmpty(records) ? 0 : records.size());
|
||||||
|
resultPage.setRecords(records);
|
||||||
|
resultPage.setTotal(page.getTotal());
|
||||||
|
resultPage.setMaxLimit(page.getMaxLimit());
|
||||||
|
resultPage.setPages(page.getPages());
|
||||||
|
|
||||||
|
return resultPage;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<CsEquipmentDeliveryPO> getRunPortableDev(String userId) {
|
public List<CsEquipmentDeliveryPO> getRunPortableDev(String userId) {
|
||||||
List<CsEquipmentDeliveryPO> result = new ArrayList<>();
|
List<CsEquipmentDeliveryPO> result = new ArrayList<>();
|
||||||
@@ -1116,9 +1146,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
throw new BusinessException("便携式设备类型字典缺失");
|
throw new BusinessException("便携式设备类型字典缺失");
|
||||||
}
|
}
|
||||||
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getDevType,vo.getId())
|
lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getDevType, vo.getId()).ne(CsEquipmentDeliveryPO::getRunStatus, 0).eq(CsEquipmentDeliveryPO::getUsageStatus, 1);
|
||||||
.ne(CsEquipmentDeliveryPO::getRunStatus,0)
|
|
||||||
.eq(CsEquipmentDeliveryPO::getUsageStatus,1);
|
|
||||||
//获取用户已经绑定的便携式设备
|
//获取用户已经绑定的便携式设备
|
||||||
List<String> devList = csDeviceUserPOService.findDevByUserId(userId);
|
List<String> devList = csDeviceUserPOService.findDevByUserId(userId);
|
||||||
if (CollectionUtil.isNotEmpty(devList)) {
|
if (CollectionUtil.isNotEmpty(devList)) {
|
||||||
@@ -1132,12 +1160,8 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
queryWrapper.in(CsLedger::getId, ids);
|
queryWrapper.in(CsLedger::getId, ids);
|
||||||
List<CsLedger> list = csLedgerService.list(queryWrapper);
|
List<CsLedger> list = csLedgerService.list(queryWrapper);
|
||||||
if (CollectionUtil.isNotEmpty(list)) {
|
if (CollectionUtil.isNotEmpty(list)) {
|
||||||
Set<String> idSet = list.stream()
|
Set<String> idSet = list.stream().map(CsLedger::getId).collect(Collectors.toSet());
|
||||||
.map(CsLedger::getId)
|
return result.stream().filter(data -> idSet.contains(data.getId())).collect(Collectors.toList());
|
||||||
.collect(Collectors.toSet());
|
|
||||||
return result.stream()
|
|
||||||
.filter(data -> idSet.contains(data.getId()))
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
} else {
|
} else {
|
||||||
result.clear();
|
result.clear();
|
||||||
return result;
|
return result;
|
||||||
@@ -1149,26 +1173,22 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
//根据前置机id获取装置数量
|
//根据前置机id获取装置数量
|
||||||
public List<CsEquipmentDeliveryPO> getListByNodeId(String nodeId) {
|
public List<CsEquipmentDeliveryPO> getListByNodeId(String nodeId) {
|
||||||
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getNodeId,nodeId)
|
lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getNodeId, nodeId).in(CsEquipmentDeliveryPO::getRunStatus, Arrays.asList(1, 2));
|
||||||
.in(CsEquipmentDeliveryPO::getRunStatus,Arrays.asList(1,2));
|
|
||||||
return this.list(lambdaQueryWrapper);
|
return this.list(lambdaQueryWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int findLeastFrequentProcess(List<CsEquipmentDeliveryPO> items, Integer process) {
|
public int findLeastFrequentProcess(List<CsEquipmentDeliveryPO> items, Integer process) {
|
||||||
Map<Integer, Long> processCounts = items.stream()
|
Map<Integer, Long> processCounts = items.stream().collect(Collectors.groupingBy(CsEquipmentDeliveryPO::getNodeProcess, Collectors.counting()));
|
||||||
.collect(Collectors.groupingBy(CsEquipmentDeliveryPO::getNodeProcess, Collectors.counting()));
|
|
||||||
for (int i = 1; i <= process; i++) {
|
for (int i = 1; i <= process; i++) {
|
||||||
processCounts.putIfAbsent(i, 0L);
|
processCounts.putIfAbsent(i, 0L);
|
||||||
}
|
}
|
||||||
//如果列表为空,默认返回1
|
//如果列表为空,默认返回1
|
||||||
return processCounts.entrySet().stream()
|
return processCounts.entrySet().stream().min(Comparator.comparingLong(Map.Entry::getValue)).map(Map.Entry::getKey).orElse(1);
|
||||||
.min(Comparator.comparingLong(Map.Entry::getValue))
|
|
||||||
.map(Map.Entry::getKey)
|
|
||||||
.orElse(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据ndid生成二维码
|
* 根据ndid生成二维码
|
||||||
|
*
|
||||||
* @param ndid
|
* @param ndid
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user