1.检测模块:预检测框架提交

2.报文通用装置查询编写
This commit is contained in:
wr
2024-12-12 18:40:58 +08:00
parent e432501e99
commit bc0e93b522
20 changed files with 277 additions and 98 deletions

View File

@@ -17,6 +17,7 @@ import com.njcn.gather.device.device.pojo.param.PqDevParam;
import com.njcn.gather.device.device.pojo.po.PqDev;
import com.njcn.gather.device.device.pojo.vo.PqDevExcel;
import com.njcn.gather.device.device.pojo.vo.PqDevVO;
import com.njcn.gather.device.device.pojo.vo.PreDetection;
import com.njcn.gather.device.device.service.IPqDevService;
import com.njcn.gather.device.pojo.constant.DevConst;
import com.njcn.gather.device.pojo.enums.DevResponseEnum;
@@ -37,6 +38,7 @@ import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@@ -56,6 +58,17 @@ public class PqDevController extends BaseController {
private final IDictDataService dictDataService;
@OperateInfo
@GetMapping("/aaa")
@ApiOperation("分页查询被检设备")
@ApiImplicitParam(name = "queryParam", value = "查询参数", required = true)
public HttpResult<List<PreDetection> > aaa() {
String methodDescribe = getMethodDescribe("list");
List<PreDetection> devInfo = pqDevService.getDevInfo(Arrays.asList("578c142b7e4e4978a35bd6225aa62a23", "393504f55f1f79bce255bfc195cfdb56"));
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, devInfo, methodDescribe);
}
@OperateInfo
@PostMapping("/list")
@ApiOperation("分页查询被检设备")

View File

@@ -2,6 +2,10 @@ package com.njcn.gather.device.device.mapper;
import com.github.yulichang.base.MPJBaseMapper;
import com.njcn.gather.device.device.pojo.po.PqDev;
import com.njcn.gather.device.device.pojo.vo.PreDetection;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @author caozehui
@@ -9,5 +13,13 @@ import com.njcn.gather.device.device.pojo.po.PqDev;
*/
public interface PqDevMapper extends MPJBaseMapper<PqDev> {
/**
* 根据装置id集合获取装置信息
* @param devIds 装置id
* @return: java.util.List<com.njcn.gather.device.device.pojo.vo.PreDetection>
* @Author: wr
* @Date: 2024/12/12 11:46
*/
List<PreDetection> selectDevInfo(@Param("devIds") List<String> devIds);
}

View File

@@ -2,6 +2,39 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.gather.device.device.mapper.PqDevMapper">
<!-- 通用查询映射结果 -->
<resultMap id="DevResultMap" type="com.njcn.gather.device.device.pojo.vo.PreDetection">
<id column="IP" property="devIP" />
<result column="Port" property="port" />
<result column="Dev_Type" property="devType" />
<result column="" property="icdType" />
<result column="Series" property="devCode" />
<result column="Dev_Key" property="devKey" />
<collection
property="monitorList"
column="{ devId = Id}"
select="com.njcn.gather.device.monitor.mapper.PqMonitorMapper.selectMonitorInfo"
>
</collection>
</resultMap>
<select id="selectDevInfo" resultMap="DevResultMap">
SELECT
d.Id,
d.IP,
( select name from sys_dict_data sd where d.Dev_Type= sd.id) as Dev_Type,
d.Port,
d.Series,
d.Dev_Key
FROM
pq_dev d
<where>
<if test="devIds !=null and devIds.size()!=0">
AND d.Id in
<foreach collection="devIds" open="(" close=")" item="item" separator=",">
#{item}
</foreach>
</if>
</where>
</select>
</mapper>

View File

@@ -0,0 +1,98 @@
package com.njcn.gather.device.device.pojo.vo;
import cn.hutool.core.util.StrUtil;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.njcn.gather.device.device.util.DeviceUtil;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* @author wr
* @description 预检测装置报文初始化
* @date 2024/12/12 11:21
*/
@Data
@NoArgsConstructor
public class PreDetection {
/**
* 装置ip
*/
@JsonProperty("devIP")
private String devIP;
/**
* 装置端口
*/
@JsonProperty("port")
private Integer port;
/**
* 设备类型,字典表
*/
@JsonProperty("devType")
private String devType;
/**
* icd设备类型
*/
@JsonProperty("icdType")
private String icdType;
/**
* 装置识别码3ds加密
*/
@JsonProperty("devCode")
private String devCode;
/**
* 装置秘钥3ds加密
*/
@JsonProperty("devKey")
private String devKey;
/**
* 监测点信息
*/
@JsonProperty("monitorList")
private List<MonitorListDTO> monitorList;
@Data
@NoArgsConstructor
public static class MonitorListDTO {
/**
* 监测点id
*/
@JsonProperty("lineId")
private String lineId;
/**
* 监测点线路号
*/
@JsonProperty("line")
private Integer line;
}
public String getDevKey() {
if(StrUtil.isNotBlank(devKey)){
String key = DeviceUtil.decoderString(1, devKey);
if(StrUtil.isNotBlank(key)){
return key;
}
}
return null;
}
public String getDevCode() {
if(StrUtil.isNotBlank(devCode)){
String code= DeviceUtil.decoderString(1,devCode);
if(StrUtil.isNotBlank(code)){
return code;
}
}
return null;
}
}

View File

@@ -7,7 +7,9 @@ import com.njcn.gather.device.device.pojo.param.PqDevParam;
import com.njcn.gather.device.device.pojo.po.PqDev;
import com.njcn.gather.device.device.pojo.vo.PqDevExcel;
import com.njcn.gather.device.device.pojo.vo.PqDevVO;
import com.njcn.gather.device.device.pojo.vo.PreDetection;
import com.njcn.gather.device.plan.pojo.param.AdPlanParam;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
@@ -141,4 +143,13 @@ public interface IPqDevService extends IService<PqDev> {
* @return 所有非未检测状态的设备列表
*/
List<PqDev> listNotUnchecked();
/**
* 获取装置信息和装置下监测点信息
* @param devIds
* @return: java.util.List<com.njcn.gather.device.device.pojo.vo.PreDetection>
* @Author: wr
* @Date: 2024/12/12 15:50
*/
List<PreDetection> getDevInfo(@Param("devIds") List<String> devIds);
}

View File

@@ -17,6 +17,7 @@ import com.njcn.gather.device.device.pojo.param.PqDevParam;
import com.njcn.gather.device.device.pojo.po.PqDev;
import com.njcn.gather.device.device.pojo.vo.PqDevExcel;
import com.njcn.gather.device.device.pojo.vo.PqDevVO;
import com.njcn.gather.device.device.pojo.vo.PreDetection;
import com.njcn.gather.device.device.service.IPqDevService;
import com.njcn.gather.device.device.util.DeviceUtil;
import com.njcn.gather.device.monitor.pojo.po.PqMonitor;
@@ -334,6 +335,11 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
return queryWrapper;
}
@Override
public List<PreDetection> getDevInfo(List<String> devIds) {
return this.baseMapper.selectDevInfo(devIds);
}
/**
* 获取检测状态饼状图数据
*

View File

@@ -1,7 +1,11 @@
package com.njcn.gather.device.monitor.mapper;
import com.github.yulichang.base.MPJBaseMapper;
import com.njcn.gather.device.device.pojo.vo.PreDetection;
import com.njcn.gather.device.monitor.pojo.po.PqMonitor;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @author caozehui
@@ -9,5 +13,13 @@ import com.njcn.gather.device.monitor.pojo.po.PqMonitor;
*/
public interface PqMonitorMapper extends MPJBaseMapper<PqMonitor> {
/**
* 根据终端id获取监测点集合
* @param devId
* @return: java.util.List<com.njcn.gather.device.device.pojo.vo.PreDetection.MonitorListDTO>
* @Author: wr
* @Date: 2024/12/12 13:15
*/
List<PreDetection.MonitorListDTO> selectMonitorInfo(@Param("devId") String devId);
}

View File

@@ -2,6 +2,16 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.gather.device.monitor.mapper.PqMonitorMapper">
<select id="selectMonitorInfo"
resultType="com.njcn.gather.device.device.pojo.vo.PreDetection$MonitorListDTO">
SELECT
Id as lineId,
Num as line
FROM
pq_monitor
WHERE
dev_id = #{devId}
</select>
</mapper>