比对相关代码

This commit is contained in:
caozehui
2025-08-04 10:27:00 +08:00
parent 417a53a835
commit 2d889b07f7
63 changed files with 3987 additions and 863 deletions

View File

@@ -28,7 +28,6 @@ import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* @author caozehui
* @date 2025-07-02

View File

@@ -2,6 +2,10 @@ package com.njcn.gather.device.mapper;
import com.github.yulichang.base.MPJBaseMapper;
import com.njcn.gather.device.pojo.po.PqStandardDev;
import com.njcn.gather.device.pojo.vo.PreDetection;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @author makejava
@@ -9,5 +13,6 @@ import com.njcn.gather.device.pojo.po.PqStandardDev;
*/
public interface PqStandardDevMapper extends MPJBaseMapper<PqStandardDev> {
List<PreDetection> listStandardDevPreDetection(@Param("devIds") List<String> ids);
}

View File

@@ -2,6 +2,47 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.gather.device.mapper.PqStandardDevMapper">
<!-- 通用查询映射结果 -->
<resultMap id="standardDevResultMap" type="com.njcn.gather.device.pojo.vo.PreDetection">
<id column="Id" property="devId"/>
<id column="Name" property="devName"/>
<id column="IP" property="devIP"/>
<result column="Port" property="port"/>
<result column="Dev_Type" property="devType"/>
<result column="Series" property="devCode"/>
<result column="Dev_Key" property="devKey"/>
<result column="icdType" property="icdType"/>
<result column="Dev_Chns" property="devChns"/>
<result column="Dev_Volt" property="devVolt"/>
<result column="Dev_Curr" property="devCurr"/>
<!-- <collection-->
<!-- property="monitorList"-->
<!-- column="{ devId = Id}"-->
<!-- select="com.njcn.gather.monitor.mapper.PqMonitorMapper.selectMonitorInfo"-->
<!-- >-->
<!-- </collection>-->
</resultMap>
<select id="listStandardDevPreDetection" resultMap="standardDevResultMap">
select
standard_dev.Id,
standard_dev.Name,
standard_dev.IP,
standard_dev.Port,
standard_dev.Dev_Type,
standard_dev.Series,
standard_dev.Dev_Key,
dev_type.icdType,
dev_type.Dev_Chns,
dev_type.Dev_Volt,
dev_type.Dev_Curr
from pq_standard_dev standard_dev
inner join pq_dev_type dev_type on standard_dev.Dev_Type = dev_type.id
where standard_dev.Id in
<foreach collection="ids" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</select>
</mapper>

View File

@@ -125,7 +125,7 @@ public class PqDevParam {
private String delegate;
@ApiModelProperty("被检通道")
private List<String> inspectChannel;
private String inspectChannel;
@ApiModelProperty("投运日期")
@DateTimeStrValid(message = DetectionValidMessage.OPERATION_DATE_FORMAT_ERROR)

View File

@@ -50,51 +50,51 @@ public class ContrastDevExcel implements Serializable {
@NotBlank(message = DetectionValidMessage.MANUFACTURER_NOT_BLANK)
private String manufacturer;
@Excel(name = "被检通道", width = 20, needMerge = true, orderNum = "8")
private String inspectChannel;
// @Excel(name = "被检通道", width = 20, needMerge = true, orderNum = "8")
// private String inspectChannel;
@Excel(name = "固件版本", width = 15, needMerge = true, orderNum = "9")
@Excel(name = "固件版本", width = 15, needMerge = true, orderNum = "8")
private String hardwareVersion;
@Excel(name = "软件版本", width = 15, needMerge = true, orderNum = "10")
@Excel(name = "软件版本", width = 15, needMerge = true, orderNum = "9")
private String softwareVersion;
@Excel(name = "通讯协议*", width = 15, needMerge = true, orderNum = "11")
@Excel(name = "通讯协议*", width = 15, needMerge = true, orderNum = "10")
@NotBlank(message = DetectionValidMessage.PROTOCOL_NOT_BLANK)
private String protocol;
@Excel(name = "是否加密*", width = 20, needMerge = true, replace = {"否_0", "是_1"}, orderNum = "12")
@Excel(name = "是否加密*", width = 20, needMerge = true, replace = {"否_0", "是_1"}, orderNum = "11")
@NotNull(message = DetectionValidMessage.ENCRYPTION_NOT_NULL)
private Integer encryptionFlag;
@Excel(name = "识别码(当加密时必填)", width = 30, needMerge = true, orderNum = "13")
@Excel(name = "识别码(当加密时必填)", width = 30, needMerge = true, orderNum = "12")
private String series;
@Excel(name = "秘钥(当加密时必填)", width = 30, needMerge = true, orderNum = "14")
@Excel(name = "秘钥(当加密时必填)", width = 30, needMerge = true, orderNum = "13")
private String devKey;
@Excel(name = "IP地址*", width = 20, needMerge = true, orderNum = "15")
@Excel(name = "IP地址*", width = 20, needMerge = true, orderNum = "14")
@NotBlank(message = DetectionValidMessage.IP_NOT_BLANK)
@Pattern(regexp = PatternRegex.IP_REGEX, message = DetectionValidMessage.IP_FORMAT_ERROR)
private String ip;
@Excel(name = "端口号*", width = 15, needMerge = true, orderNum = "16")
@Excel(name = "端口号*", width = 15, needMerge = true, orderNum = "15")
@NotNull(message = DetectionValidMessage.PORT_NOT_NULL)
@Range(min = 1, max = 65535, message = DetectionValidMessage.PORT_RANGE_ERROR)
private Integer port;
@Excel(name = "投运日期yyyy-MM-dd*", width = 30, needMerge = true, orderNum = "17", format = "yyyy-MM-dd")
@Excel(name = "投运日期yyyy-MM-dd*", width = 30, needMerge = true, orderNum = "16", format = "yyyy-MM-dd")
@NotNull(message = DetectionValidMessage.CREATE_DATE_NOT_NULL)
private LocalDate createDate;
@Excel(name = "定检日期yyyy-MM-dd*", width = 30, needMerge = true, orderNum = "18", format = "yyyy-MM-dd")
@Excel(name = "定检日期yyyy-MM-dd*", width = 30, needMerge = true, orderNum = "17", format = "yyyy-MM-dd")
@NotNull(message = DetectionValidMessage.INSPECT_DATE_NOT_NULL)
private LocalDate inspectDate;
@Excel(name = "谐波系统设备id*", width = 30, needMerge = true, orderNum = "19")
@Excel(name = "谐波系统设备id*", width = 30, needMerge = true, orderNum = "18")
@NotBlank(message = DetectionValidMessage.HARM_SYS_ID_NOT_BLANK)
private String harmSysId;
@ExcelCollection(name = "监测点信息", orderNum = "22")
@ExcelCollection(name = "监测点信息", orderNum = "19")
private List<PqMonitorExcel> pqMonitorExcelList;
}

View File

@@ -18,7 +18,7 @@ import java.util.List;
public class PreDetection {
/**
* 装置ip
* 装置id
*/
@JSONField(serialize = false)
private String devId;
@@ -95,16 +95,28 @@ public class PreDetection {
private Integer line;
/**
* 监测点线路号
* pt
*/
@JSONField(name = "pt")
private Integer pt;
private String pt;
/**
* 监测点线路号
* ct
*/
@JSONField(name = "ct") //todo 是否改为ct
private Integer ct;
private String ct;
/**
* 统计间隔
*/
@JSONField(name = "statInterval")
private Integer statInterval;
/**
* 接线方式
*/
@JSONField(name = "connection")
private String connection;
}
public String getDevKey() {

View File

@@ -2,12 +2,11 @@ package com.njcn.gather.device.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.njcn.gather.device.pojo.param.PqDevParam;
import com.njcn.gather.device.pojo.param.PqStandardDevParam;
import com.njcn.gather.device.pojo.po.PqStandardDev;
import com.njcn.gather.device.pojo.vo.PreDetection;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
@@ -84,4 +83,12 @@ public interface IPqStandardDevService extends IService<PqStandardDev> {
* @return
*/
List<PqStandardDev> listByPlanId(String planId);
/**
* 查询出标准设备所需的检测信息
*
* @param ids
* @return
*/
List<PreDetection> listStandardDevPreDetection(List<String> ids);
}

View File

@@ -57,6 +57,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.*;
import java.util.regex.Pattern;
@@ -144,7 +145,6 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
if (ObjectUtil.isNotEmpty(pqDevParam.getMonitorList())) {
pqMonitorService.addPqMonitorByDevId(id, pqDevParam.getMonitorList());
}
pqDev.setInspectChannel(String.join(StrUtil.COMMA, pqDevParam.getInspectChannel()));
}
pqDev.setImportFlag(0);
pqDev.setState(DataStateEnum.ENABLE.getCode());
@@ -201,7 +201,6 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
// 比对式设备修改监测点
if (PatternEnum.CONTRAST.getValue().equals(dictDataService.getDictDataById(updateParam.getPattern()).getCode())) {
pqMonitorService.updatePqMonitorByDevId(updateParam.getId(), updateParam.getMonitorList());
pqDev.setInspectChannel(String.join(StrUtil.COMMA, updateParam.getInspectChannel()));
}
return this.updateById(pqDev);
}
@@ -419,8 +418,8 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
monitorListDTO = new PreDetection.MonitorListDTO();
monitorListDTO.setLineId(preDetection.getDevIP() + "_" + i);
monitorListDTO.setLine(i);
monitorListDTO.setPt(1);
monitorListDTO.setCt(1);
monitorListDTO.setPt("1");
monitorListDTO.setCt("1");
monitorList.add(monitorListDTO);
}
preDetection.setMonitorList(monitorList);
@@ -1290,8 +1289,8 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
dictDataList = dictDataService.getDictDataByTypeId(dictType.getId());
pullDown = new PullDown();
pullDown.setFirstCol(startCol + 10);
pullDown.setLastCol(startCol + 10);
pullDown.setFirstCol(startCol + 9);
pullDown.setLastCol(startCol + 9);
pullDown.setStrings(dictDataList.stream().map(DictData::getName).collect(Collectors.toList()));
pullDowns.add(pullDown);
@@ -1299,20 +1298,19 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
// 是否加密
pullDown = new PullDown();
pullDown.setFirstCol(startCol + 11);
pullDown.setLastCol(startCol + 11);
pullDown.setFirstCol(startCol + 10);
pullDown.setLastCol(startCol + 10);
pullDown.setStrings(Arrays.asList("", ""));
pullDowns.add(pullDown);
// 接线方式
dictType = dictTypeService.getByCode("Dev_Connect");
if (ObjectUtil.isNotNull(dictType)) {
dictDataList = dictDataService.getDictDataByTypeId(dictType.getId());
pullDown = new PullDown();
pullDown.setFirstCol(startCol + 25);
pullDown.setLastCol(startCol + 25);
pullDown.setFirstCol(startCol + 24);
pullDown.setLastCol(startCol + 24);
pullDown.setStrings(dictDataList.stream().map(DictData::getName).collect(Collectors.toList()));
pullDowns.add(pullDown);

View File

@@ -20,6 +20,7 @@ import com.njcn.gather.device.mapper.PqStandardDevMapper;
import com.njcn.gather.device.pojo.param.PqStandardDevParam;
import com.njcn.gather.device.pojo.po.PqStandardDev;
import com.njcn.gather.device.pojo.vo.PqStandardDevExcel;
import com.njcn.gather.device.pojo.vo.PreDetection;
import com.njcn.gather.device.service.IPqStandardDevService;
import com.njcn.gather.plan.mapper.AdPlanStandardDevMapper;
import com.njcn.gather.pojo.enums.DetectionResponseEnum;
@@ -155,6 +156,14 @@ public class PqStandardDevServiceImpl extends ServiceImpl<PqStandardDevMapper, P
return adPlanStandardDevMapper.listByPlanId(Collections.singletonList(planId));
}
@Override
public List<PreDetection> listStandardDevPreDetection(List<String> ids) {
if (CollectionUtil.isNotEmpty(ids)) {
return this.baseMapper.listStandardDevPreDetection(ids);
}
return Collections.emptyList();
}
/**
* 导入数据
*