This commit is contained in:
wr
2024-12-18 11:40:36 +08:00
parent e9a294acdb
commit e36652f930
4 changed files with 49 additions and 16 deletions

View File

@@ -4,6 +4,8 @@
<!-- 通用查询映射结果 --> <!-- 通用查询映射结果 -->
<resultMap id="DevResultMap" type="com.njcn.gather.device.device.pojo.vo.PreDetection"> <resultMap id="DevResultMap" type="com.njcn.gather.device.device.pojo.vo.PreDetection">
<id column="Id" property="devId" />
<id column="Name" property="devName" />
<id column="IP" property="devIP" /> <id column="IP" property="devIP" />
<result column="Port" property="port" /> <result column="Port" property="port" />
<result column="Dev_Type" property="devType" /> <result column="Dev_Type" property="devType" />
@@ -20,6 +22,7 @@
<select id="selectDevInfo" resultMap="DevResultMap"> <select id="selectDevInfo" resultMap="DevResultMap">
SELECT SELECT
d.Id, d.Id,
d.Name,
d.IP, d.IP,
( select name from sys_dict_data sd where d.Dev_Type= sd.id) as Dev_Type, ( select name from sys_dict_data sd where d.Dev_Type= sd.id) as Dev_Type,
d.Port, d.Port,

View File

@@ -1,6 +1,7 @@
package com.njcn.gather.device.device.pojo.vo; package com.njcn.gather.device.device.pojo.vo;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.njcn.gather.device.device.util.DeviceUtil; import com.njcn.gather.device.device.util.DeviceUtil;
import lombok.Data; import lombok.Data;
@@ -20,44 +21,58 @@ public class PreDetection {
/** /**
* 装置ip * 装置ip
*/ */
@JsonProperty("devIP") @JSONField(serialize = false)
private String devId;
/**
* 装置ip
*/
@JSONField(serialize = false)
private String devName;
/**
* 装置ip
*/
@JSONField(name = "devIP", serialize = false)
private String devIP; private String devIP;
/** /**
* 装置端口 * 装置端口
*/ */
@JsonProperty("port") @JSONField(name = "port")
private Integer port; private Integer port;
/** /**
* 设备类型,字典表 * 设备类型,字典表
*/ */
@JsonProperty("devType") @JSONField(name = "devType")
private String devType; private String devType;
/** /**
* icd设备类型 * icd设备类型
*/ */
@JsonProperty("icdType") @JSONField(name = "icdType")
private String icdType; private String icdType;
/** /**
* 装置识别码3ds加密 * 装置识别码3ds加密
*/ */
@JsonProperty("devCode") @JSONField(name = "devCode")
private String devCode; private String devCode;
/** /**
* 装置秘钥3ds加密 * 装置秘钥3ds加密
*/ */
@JsonProperty("devKey") @JSONField(name = "devKey")
private String devKey; private String devKey;
@JSONField(serialize = false)
private Integer devChns; private Integer devChns;
/** /**
* 监测点信息 * 监测点信息
*/ */
@JsonProperty("monitorList") @JSONField(name = "monitorList")
private List<MonitorListDTO> monitorList; private List<MonitorListDTO> monitorList;
@@ -67,20 +82,20 @@ public class PreDetection {
/** /**
* 监测点id * 监测点id
*/ */
@JsonProperty("lineId") @JSONField(name = "lineId")
private String lineId; private String lineId;
/** /**
* 监测点线路号 * 监测点线路号
*/ */
@JsonProperty("line") @JSONField(name = "line")
private Integer line; private Integer line;
} }
public String getDevKey() { public String getDevKey() {
if(StrUtil.isNotBlank(devKey)){ if (StrUtil.isNotBlank(devKey)) {
String key = DeviceUtil.decoderString(1, devKey); String key = DeviceUtil.decoderString(1, devKey);
if(StrUtil.isNotBlank(key)){ if (StrUtil.isNotBlank(key)) {
return key; return key;
} }
} }
@@ -88,9 +103,9 @@ public class PreDetection {
} }
public String getDevCode() { public String getDevCode() {
if(StrUtil.isNotBlank(devCode)){ if (StrUtil.isNotBlank(devCode)) {
String code= DeviceUtil.decoderString(1,devCode); String code = DeviceUtil.decoderString(1, devCode);
if(StrUtil.isNotBlank(code)){ if (StrUtil.isNotBlank(code)) {
return code; return code;
} }
} }

View File

@@ -1,6 +1,7 @@
package com.njcn.gather.device.device.service.impl; package com.njcn.gather.device.device.service.impl;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.conditions.Wrapper;
@@ -403,7 +404,21 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
@Override @Override
public List<PreDetection> getDevInfo(List<String> devIds) { public List<PreDetection> getDevInfo(List<String> devIds) {
return this.baseMapper.selectDevInfo(devIds); List<PreDetection> preDetections = this.baseMapper.selectDevInfo(devIds);
for (PreDetection preDetection : preDetections) {
List<PreDetection.MonitorListDTO> monitorList = preDetection.getMonitorList();
if(CollUtil.isEmpty(monitorList)){
PreDetection.MonitorListDTO monitorListDTO;
for (int i = 1; i <= preDetection.getDevChns(); i++) {
monitorListDTO=new PreDetection.MonitorListDTO();
monitorListDTO.setLineId(preDetection.getDevIP()+"_"+i);
monitorListDTO.setLine(i);
monitorList.add(monitorListDTO);
}
preDetection.setMonitorList(monitorList);
}
}
return preDetections;
} }
@Override @Override

View File

@@ -27,5 +27,5 @@ public class PqScriptIssueParam {
private Boolean isPhaseSequence; private Boolean isPhaseSequence;
@ApiModelProperty("源id") @ApiModelProperty("源id")
private String sourceId ="111"; private String sourceId;
} }