比对式标准设备、被检设备、监测点功能
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
package com.njcn.gather.device.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@@ -12,7 +11,6 @@ import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.LogUtil;
|
||||
import com.njcn.gather.device.pojo.param.PqDevParam;
|
||||
import com.njcn.gather.device.pojo.po.PqDev;
|
||||
import com.njcn.gather.device.pojo.vo.PqDevVO;
|
||||
import com.njcn.gather.device.service.IPqDevService;
|
||||
import com.njcn.gather.type.pojo.po.DevType;
|
||||
@@ -129,8 +127,8 @@ public class PqDevController extends BaseController {
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.DOWNLOAD)
|
||||
@PostMapping("/downloadTemplate")
|
||||
@ApiOperation("下载被检设备导入文件模板")
|
||||
public void downloadTemplate() {
|
||||
pqDevService.downloadTemplate();
|
||||
public void downloadTemplate(@RequestBody PqDevParam pqDevParam) {
|
||||
pqDevService.downloadTemplate(pqDevParam.getPattern());
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.UPLOAD)
|
||||
@@ -140,15 +138,19 @@ public class PqDevController extends BaseController {
|
||||
@ApiImplicitParam(name = "file", value = "被检设备数据文件", required = true),
|
||||
@ApiImplicitParam(name = "patternId", value = "模式id", required = true)
|
||||
})
|
||||
public HttpResult<Object> importDev(@RequestParam("file") MultipartFile file, @RequestParam("patternId") String patternId, HttpServletResponse response) {
|
||||
public HttpResult<Boolean> importDev(@RequestParam("file") MultipartFile file, @RequestParam("patternId") String patternId, HttpServletResponse response) {
|
||||
String methodDescribe = getMethodDescribe("importDev");
|
||||
LogUtil.njcnDebug(log, "{},上传文件为:{}", methodDescribe, file.getOriginalFilename());
|
||||
boolean fileType = FileUtil.judgeFileIsExcel(file.getOriginalFilename());
|
||||
if (!fileType) {
|
||||
throw new BusinessException(CommonResponseEnum.FILE_XLSX_ERROR);
|
||||
}
|
||||
pqDevService.importDev(file, patternId, null, response);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
Boolean result = pqDevService.importDev(file, patternId, null, response);
|
||||
if (result) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||
} else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@@ -169,17 +171,14 @@ public class PqDevController extends BaseController {
|
||||
public HttpResult<List<PqDevVO>> listByPlanId(@RequestBody @Validated PqDevParam.QueryParam param) {
|
||||
String methodDescribe = getMethodDescribe("listByPlanId");
|
||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, param);
|
||||
List<PqDev> pqDevList = pqDevService.listByPlanId(param);
|
||||
List<PqDevVO> pqDevVOList = pqDevService.listByPlanId(param);
|
||||
|
||||
List<PqDevVO> result = BeanUtil.copyToList(pqDevList, PqDevVO.class);
|
||||
result.forEach(pqDevVO -> {
|
||||
pqDevVOList.forEach(pqDevVO -> {
|
||||
DevType devType = devTypeService.getById(pqDevVO.getDevType());
|
||||
if (ObjectUtil.isNotNull(devType)) {
|
||||
pqDevVO.setDevChns(devType.getDevChns());
|
||||
pqDevVO.setDevVolt(devType.getDevVolt());
|
||||
pqDevVO.setDevCurr(devType.getDevCurr());
|
||||
}
|
||||
});
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, pqDevVOList, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,142 @@
|
||||
package com.njcn.gather.device.controller;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.constant.OperateType;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.LogUtil;
|
||||
import com.njcn.gather.device.pojo.param.PqStandardDevParam;
|
||||
import com.njcn.gather.device.pojo.po.PqStandardDev;
|
||||
import com.njcn.gather.device.service.IPqStandardDevService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import com.njcn.web.utils.FileUtil;
|
||||
import com.njcn.web.utils.HttpResultUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @date 2025-07-02
|
||||
*/
|
||||
@Slf4j
|
||||
@Api(tags = "标准设备管理")
|
||||
@RestController
|
||||
@RequestMapping("/pqStandardDev")
|
||||
@RequiredArgsConstructor
|
||||
public class PqStandardDevController extends BaseController {
|
||||
private final IPqStandardDevService pqStandardDevService;
|
||||
|
||||
@OperateInfo
|
||||
@PostMapping("/list")
|
||||
@ApiOperation("分页查询标准设备")
|
||||
@ApiImplicitParam(name = "queryParam", value = "查询参数", required = true)
|
||||
public HttpResult<Page<PqStandardDev>> list(@RequestBody PqStandardDevParam.QueryParam queryParam) {
|
||||
String methodDescribe = getMethodDescribe("list");
|
||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, queryParam);
|
||||
Page<PqStandardDev> result = pqStandardDevService.listPqStandardDevs(queryParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo
|
||||
@GetMapping("/getById")
|
||||
@ApiOperation("根据id查询标准设备")
|
||||
@ApiImplicitParam(name = "id", value = "标准设备id", required = true)
|
||||
public HttpResult<PqStandardDev> getById(@RequestParam("id") String id) {
|
||||
String methodDescribe = getMethodDescribe("getById");
|
||||
LogUtil.njcnDebug(log, "{},查询ID为:{}", methodDescribe, id);
|
||||
PqStandardDev result = pqStandardDevService.getPqStandardDevById(id);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(operateType = OperateType.ADD)
|
||||
@PostMapping("/add")
|
||||
@ApiOperation("新增标准设备")
|
||||
@ApiImplicitParam(name = "param", value = "标准设备", required = true)
|
||||
public HttpResult<Boolean> add(@RequestBody @Validated PqStandardDevParam param) {
|
||||
String methodDescribe = getMethodDescribe("add");
|
||||
LogUtil.njcnDebug(log, "{},新增数据为:{}", methodDescribe, param);
|
||||
boolean result = pqStandardDevService.addPqStandardDev(param);
|
||||
if (result) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||
} else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
@OperateInfo(operateType = OperateType.UPDATE)
|
||||
@PostMapping("/update")
|
||||
@ApiOperation("修改标准设备")
|
||||
@ApiImplicitParam(name = "param", value = "标准设备", required = true)
|
||||
public HttpResult<Boolean> update(@RequestBody @Validated PqStandardDevParam.UpdateParam param) {
|
||||
String methodDescribe = getMethodDescribe("update");
|
||||
LogUtil.njcnDebug(log, "{},修改数据为:{}", methodDescribe, param);
|
||||
boolean result = pqStandardDevService.updatePqStandardDev(param);
|
||||
if (result) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||
} else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
@OperateInfo(operateType = OperateType.DELETE)
|
||||
@PostMapping("/delete")
|
||||
@ApiOperation("删除标准设备")
|
||||
@ApiImplicitParam(name = "ids", value = "标准设备id", required = true)
|
||||
public HttpResult<Boolean> delete(@RequestBody List<String> ids) {
|
||||
String methodDescribe = getMethodDescribe("delete");
|
||||
LogUtil.njcnDebug(log, "{},删除ID数据为:{}", methodDescribe, String.join(StrUtil.COMMA, ids));
|
||||
boolean result = pqStandardDevService.deletePqStandardDevs(ids);
|
||||
if (result) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||
} else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.DOWNLOAD)
|
||||
@PostMapping("/export")
|
||||
@ApiOperation("批量导出标准设备")
|
||||
@ApiImplicitParam(name = "queryParam", value = "查询参数", required = true)
|
||||
public void export(@RequestBody PqStandardDevParam.QueryParam queryParam) {
|
||||
String methodDescribe = getMethodDescribe("export");
|
||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, queryParam);
|
||||
pqStandardDevService.export(queryParam);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.DOWNLOAD)
|
||||
@PostMapping("/downloadTemplate")
|
||||
@ApiOperation("下载标准设备导入文件模板")
|
||||
public void downloadTemplate() {
|
||||
pqStandardDevService.downloadTemplate();
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.UPLOAD)
|
||||
@PostMapping("/import")
|
||||
@ApiOperation("导入标准设备")
|
||||
@ApiImplicitParam(name = "file", value = "导入文件", required = true)
|
||||
public HttpResult<Object> importData(@RequestParam("file") MultipartFile file, HttpServletResponse response) {
|
||||
String methodDescribe = getMethodDescribe("importData");
|
||||
LogUtil.njcnDebug(log, "{},导入文件为:{}", methodDescribe, file.getOriginalFilename());
|
||||
boolean fileType = FileUtil.judgeFileIsExcel(file.getOriginalFilename());
|
||||
if (!fileType) {
|
||||
throw new BusinessException(CommonResponseEnum.FILE_XLSX_ERROR);
|
||||
}
|
||||
pqStandardDevService.importData(file, response);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package com.njcn.gather.device.mapper;
|
||||
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import com.njcn.gather.device.pojo.param.PqDevParam;
|
||||
import com.njcn.gather.device.pojo.po.PqDev;
|
||||
import com.njcn.gather.device.pojo.vo.PqDevVO;
|
||||
import com.njcn.gather.device.pojo.vo.PreDetection;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@@ -47,6 +49,12 @@ public interface PqDevMapper extends MPJBaseMapper<PqDev> {
|
||||
*
|
||||
* @param planId
|
||||
*/
|
||||
String getScriptIdByPlanId(String planId);
|
||||
String getScriptIdByPlanId(@Param("planId")String planId);
|
||||
|
||||
List<PqDevVO> selectByQueryParam(PqDevParam.QueryParam param);
|
||||
|
||||
PqDevVO selectByDevId(@Param("devId") String devId);
|
||||
|
||||
List<PqDevVO> listByDevIds(@Param("devIds") List<String> devIds);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.njcn.gather.device.mapper;
|
||||
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import com.njcn.gather.device.pojo.po.PqDevSub;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @date 2025-07-02
|
||||
*/
|
||||
public interface PqDevSubMapper extends MPJBaseMapper<PqDevSub> {
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.njcn.gather.device.mapper;
|
||||
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import com.njcn.gather.device.pojo.po.PqStandardDev;
|
||||
|
||||
/**
|
||||
* @author makejava
|
||||
* @date 2025-05-09
|
||||
*/
|
||||
public interface PqStandardDevMapper extends MPJBaseMapper<PqStandardDev> {
|
||||
|
||||
}
|
||||
|
||||
@@ -4,17 +4,17 @@
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="DevResultMap" 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" />
|
||||
<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"
|
||||
@@ -50,24 +50,81 @@
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<update id="finishPlan" >
|
||||
update ad_plan set Test_State = 2 where id = #{planId}
|
||||
<update id="finishPlan">
|
||||
update ad_plan
|
||||
set Test_State = 2
|
||||
where id = #{planId}
|
||||
</update>
|
||||
|
||||
<update id="updateReportState" >
|
||||
update pq_dev set Report_State = 1 where id = #{id}
|
||||
<update id="updateReportState">
|
||||
update pq_dev
|
||||
set Report_State = 1
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="updatePlanCheckResult">
|
||||
update ad_plan set Result = #{checkResult} where id = #{planId}
|
||||
update ad_plan
|
||||
set Result = #{checkResult}
|
||||
where id = #{planId}
|
||||
</update>
|
||||
|
||||
<update id="updatePlanTestState">
|
||||
update ad_plan set Test_State = #{testState} where id = #{planId}
|
||||
update ad_plan
|
||||
set Test_State = #{testState}
|
||||
where id = #{planId}
|
||||
</update>
|
||||
|
||||
<select id="getScriptIdByPlanId" resultType="java.lang.String">
|
||||
SELECT Script_Id FROM ad_plan WHERE id = #{planId}
|
||||
SELECT Script_Id
|
||||
FROM ad_plan
|
||||
WHERE id = #{planId}
|
||||
</select>
|
||||
|
||||
<select id="selectByQueryParam" resultType="com.njcn.gather.device.pojo.vo.PqDevVO">
|
||||
SELECT dev.*,dev_sub.* FROM pq_dev dev
|
||||
left JOIN pq_dev_sub dev_sub ON dev.Id = dev_sub.Dev_Id
|
||||
<where>
|
||||
dev.state = 1
|
||||
<if test="planId!= null and planId!= ''">
|
||||
AND dev.Plan_Id = #{planId}
|
||||
</if>
|
||||
<if test="name!= null and name!= ''">
|
||||
AND dev.Name LIKE CONCAT('%',#{name},'%')
|
||||
</if>
|
||||
<if test="checkStateList!= null and checkStateList.size()!= 0 ">
|
||||
AND dev_sub.Check_State in
|
||||
<foreach collection="checkStateList" open="(" close=")" item="item" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="checkResult!= null">
|
||||
AND dev_sub.Check_Result = #{checkResult}
|
||||
</if>
|
||||
<if test="reportState!= null">
|
||||
AND dev_sub.Report_State = #{reportState}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY dev.Create_Time DESC,dev.Name
|
||||
</select>
|
||||
|
||||
<select id="selectByDevId" resultType="com.njcn.gather.device.pojo.vo.PqDevVO">
|
||||
SELECT dev.*, dev_sub.*
|
||||
FROM pq_dev dev
|
||||
left JOIN pq_dev_sub dev_sub ON dev.Id = dev_sub.Dev_Id
|
||||
WHERE dev.Id = #{devId}
|
||||
</select>
|
||||
|
||||
<select id="listByDevIds" resultType="com.njcn.gather.device.pojo.vo.PqDevVO">
|
||||
SELECT dev.*, dev_sub.*
|
||||
FROM pq_dev dev
|
||||
left JOIN pq_dev_sub dev_sub ON dev.Id = dev_sub.Dev_Id
|
||||
WHERE dev.state = 1
|
||||
<if test="devIds!= null and devIds.size() != 0">
|
||||
AND dev.Id in
|
||||
<foreach collection="devIds" open="(" close=")" item="item" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!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.PqDevSubMapper">
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!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">
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -6,12 +6,14 @@ import com.njcn.gather.pojo.constant.DetectionValidMessage;
|
||||
import com.njcn.web.pojo.annotation.DateTimeStrValid;
|
||||
import com.njcn.web.pojo.param.BaseParam;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.models.auth.In;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.hibernate.validator.constraints.Range;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.*;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -30,7 +32,7 @@ public class PqDevParam {
|
||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.PATTERN_FORMAT_ERROR)
|
||||
private String pattern;
|
||||
|
||||
@ApiModelProperty(value = "设备类型,字典表", required = true)
|
||||
@ApiModelProperty(value = "设备类型", required = true)
|
||||
@NotBlank(message = DetectionValidMessage.DEV_TYPE_NOT_BLANK)
|
||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.DEV_TYPE_FORMAT_ERROR)
|
||||
private String devType;
|
||||
@@ -98,13 +100,13 @@ public class PqDevParam {
|
||||
@ApiModelProperty("报告路径")
|
||||
private String reportPath;
|
||||
|
||||
@ApiModelProperty("设备关键信息二维码")
|
||||
private String qrCode;
|
||||
// @ApiModelProperty("设备关键信息二维码")
|
||||
// private String qrCode;
|
||||
|
||||
@ApiModelProperty(value = "检测次数,默认为0", required = true)
|
||||
@NotNull(message = DetectionValidMessage.RECHECK_NUM_NOT_NULL)
|
||||
@Min(value = 0, message = DetectionValidMessage.RECHECK_NUM_FORMAT_ERROR)
|
||||
private Integer reCheckNum;
|
||||
// @ApiModelProperty(value = "检测次数,默认为0", required = true)
|
||||
// @NotNull(message = DetectionValidMessage.RECHECK_NUM_NOT_NULL)
|
||||
// @Min(value = 0, message = DetectionValidMessage.RECHECK_NUM_FORMAT_ERROR)
|
||||
// private Integer reCheckNum;
|
||||
|
||||
@ApiModelProperty("是否支持系数校准")
|
||||
private Integer factorFlag;
|
||||
@@ -122,6 +124,19 @@ public class PqDevParam {
|
||||
@ApiModelProperty("委托方")
|
||||
private String delegate;
|
||||
|
||||
@ApiModelProperty("被检通道")
|
||||
private String inspectChannel;
|
||||
|
||||
@ApiModelProperty("投运日期")
|
||||
@DateTimeStrValid(message = DetectionValidMessage.OPERATION_DATE_FORMAT_ERROR)
|
||||
private String operationDate;
|
||||
|
||||
@ApiModelProperty("定验日期")
|
||||
@DateTimeStrValid(message = DetectionValidMessage.INSPECT_DATE_FORMAT_ERROR)
|
||||
private String inspectDate;
|
||||
|
||||
@ApiModelProperty("是否为导入设备")
|
||||
private Integer importFlag;
|
||||
/**
|
||||
* 更新操作实体
|
||||
*/
|
||||
@@ -168,6 +183,14 @@ public class PqDevParam {
|
||||
@Max(value = 2, message = DetectionValidMessage.REPORT_STATE_FORMAT_ERROR)
|
||||
private Integer reportState;
|
||||
|
||||
@ApiModelProperty("所属地市名称")
|
||||
private String cityName;
|
||||
|
||||
@ApiModelProperty("所属供电公司名称")
|
||||
private String gdName;
|
||||
|
||||
@ApiModelProperty("所属电站名称")
|
||||
private String subName;
|
||||
}
|
||||
|
||||
@Data
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
package com.njcn.gather.device.pojo.param;
|
||||
|
||||
import com.njcn.common.pojo.constant.PatternRegex;
|
||||
import com.njcn.gather.pojo.constant.DetectionValidMessage;
|
||||
import com.njcn.web.pojo.param.BaseParam;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.hibernate.validator.constraints.Range;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @data 2025-05-09
|
||||
*/
|
||||
@Data
|
||||
public class PqStandardDevParam {
|
||||
@ApiModelProperty(value = "名称", required = true)
|
||||
@NotBlank(message = DetectionValidMessage.NAME_NOT_BLANK)
|
||||
@Pattern(regexp = PatternRegex.DEV_NAME_REGEX, message = DetectionValidMessage.NAME_FORMAT_ERROR)
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "设备类型", required = true)
|
||||
@NotBlank(message = DetectionValidMessage.DEV_TYPE_NOT_BLANK)
|
||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.DEV_TYPE_FORMAT_ERROR)
|
||||
private String devType;
|
||||
|
||||
@ApiModelProperty(value = "设备厂家", required = true)
|
||||
@NotBlank(message = DetectionValidMessage.MANUFACTURER_NOT_BLANK)
|
||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.MANUFACTURER_FORMAT_ERROR)
|
||||
private String manufacturer;
|
||||
|
||||
@ApiModelProperty(value = "通信协议", required = true)
|
||||
@NotBlank(message = DetectionValidMessage.PROTOCOL_NOT_BLANK)
|
||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.PROTOCOL_FORMAT_ERROR)
|
||||
private String protocol;
|
||||
|
||||
@ApiModelProperty(value = "ip地址", required = true)
|
||||
@NotBlank(message = DetectionValidMessage.IP_NOT_BLANK)
|
||||
@Pattern(regexp = PatternRegex.IP_REGEX, message = DetectionValidMessage.IP_FORMAT_ERROR)
|
||||
private String ip;
|
||||
|
||||
@ApiModelProperty(value = "端口", required = true)
|
||||
@NotNull(message = DetectionValidMessage.PORT_NOT_NULL)
|
||||
@Range(min = 1, max = 65535, message = DetectionValidMessage.PORT_RANGE_ERROR)
|
||||
private Integer port;
|
||||
|
||||
@ApiModelProperty(value = "装置是否为加密版本", required = true)
|
||||
@NotNull(message = DetectionValidMessage.ENCRYPTION_NOT_NULL)
|
||||
@Min(value = 0, message = DetectionValidMessage.ENCRYPTION_FLAG_FORMAT_ERROR)
|
||||
@Max(value = 1, message = DetectionValidMessage.ENCRYPTION_FLAG_FORMAT_ERROR)
|
||||
private Integer encryptionFlag;
|
||||
|
||||
@ApiModelProperty("识别码(3ds加密)")
|
||||
private String series;
|
||||
|
||||
@ApiModelProperty("秘钥(3ds加密)")
|
||||
private String devKey;
|
||||
|
||||
@ApiModelProperty(value = "可检通道", required = true)
|
||||
private String inspectChannel;
|
||||
|
||||
/**
|
||||
* 分页查询实体
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class QueryParam extends BaseParam {
|
||||
@ApiModelProperty(value = "名称", required = true)
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "设备厂家", required = true)
|
||||
private String manufacturer;
|
||||
|
||||
@ApiModelProperty(value = "设备类型", required = true)
|
||||
private String devType;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新操作实体
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class UpdateParam extends PqStandardDevParam {
|
||||
@ApiModelProperty(value = "标准设备id", required = true)
|
||||
@NotBlank(message = DetectionValidMessage.ID_NOT_BLANK)
|
||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.ID_FORMAT_ERROR)
|
||||
private String id;
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.njcn.gather.device.pojo.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.FieldStrategy;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
@@ -15,7 +14,6 @@ import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
@@ -115,7 +113,6 @@ public class PqDev extends BaseEntity implements Serializable {
|
||||
/**
|
||||
* 送样日期
|
||||
*/
|
||||
@TableField(updateStrategy = FieldStrategy.IGNORED)
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
@JsonSerialize(using = LocalDateSerializer.class)
|
||||
@@ -136,84 +133,58 @@ public class PqDev extends BaseEntity implements Serializable {
|
||||
*/
|
||||
private String subName;
|
||||
|
||||
/**
|
||||
* 检测状态
|
||||
*/
|
||||
private Integer checkState;
|
||||
|
||||
/**
|
||||
* 检测结果
|
||||
*/
|
||||
private Integer checkResult;
|
||||
|
||||
/**
|
||||
* 报告状态
|
||||
*/
|
||||
private Integer reportState;
|
||||
|
||||
/**
|
||||
* 报告路径
|
||||
*/
|
||||
private String reportPath;
|
||||
|
||||
/**
|
||||
* 设备关键信息二维码
|
||||
*/
|
||||
private String qrCode;
|
||||
|
||||
/**
|
||||
* 检测次数,默认为0
|
||||
*/
|
||||
@TableField(value = "ReCheck_Num")
|
||||
private Integer reCheckNum;
|
||||
|
||||
/**
|
||||
* 状态:0-删除 1-正常
|
||||
*/
|
||||
private Integer state;
|
||||
|
||||
/**
|
||||
* 检测计划id
|
||||
*/
|
||||
private String planId;
|
||||
|
||||
/**
|
||||
* 守时检测结果(0:不合格, 1:合格)
|
||||
*/
|
||||
private Integer timeCheckResult;
|
||||
|
||||
/**
|
||||
* 是否支持系数校准(0:不支持,1:支持)
|
||||
*/
|
||||
private Integer factorFlag;
|
||||
|
||||
/**
|
||||
* 系数校准结果(0:不合格,1:合格)
|
||||
* 预投计划
|
||||
*/
|
||||
private Integer factorCheckResult;
|
||||
|
||||
@TableField("Check_Time")
|
||||
private LocalDateTime checkTime;
|
||||
|
||||
@TableField("Check_By")
|
||||
private String checkBy;
|
||||
|
||||
@TableField("Preinvestment_Plan")
|
||||
private String preinvestmentPlan;
|
||||
|
||||
/**
|
||||
* 温度
|
||||
*/
|
||||
private Float temperature;
|
||||
|
||||
/**
|
||||
* 相对湿度
|
||||
*/
|
||||
private Float humidity;
|
||||
|
||||
/**
|
||||
* 委托方
|
||||
*/
|
||||
private String delegate;
|
||||
|
||||
/**
|
||||
* 可检通道
|
||||
*/
|
||||
private String inspectChannel;
|
||||
|
||||
/**
|
||||
* 定检日期
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
@JsonSerialize(using = LocalDateSerializer.class)
|
||||
private LocalDate inspectDate;
|
||||
|
||||
/**
|
||||
* 谐波系统设备id
|
||||
*/
|
||||
private String harmSysId;
|
||||
|
||||
/**
|
||||
* 是否为导入设备(比对式使用) 0-否 1-是
|
||||
*/
|
||||
private Integer importFlag;
|
||||
|
||||
/**
|
||||
* 状态:0-删除 1-正常
|
||||
*/
|
||||
private Integer state;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
package com.njcn.gather.device.pojo.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @date 2025-07-04
|
||||
*/
|
||||
@Data
|
||||
@TableName("pq_dev_sub")
|
||||
public class PqDevSub {
|
||||
private static final long serialVersionUID = -93146063424890267L;
|
||||
/**
|
||||
* 关联pq_dev表的id字段
|
||||
*/
|
||||
private String devId;
|
||||
|
||||
/**
|
||||
* 检测状态 0-未检、1检测中、2检测完成、3归档
|
||||
*/
|
||||
private Integer checkState;
|
||||
|
||||
/**
|
||||
* 检测结果 0不符合、1符合、2未检
|
||||
*/
|
||||
private Integer checkResult;
|
||||
|
||||
/**
|
||||
* 报告生成状态 0未生成、1已生成、2未检
|
||||
*/
|
||||
private Integer reportState;
|
||||
|
||||
/**
|
||||
* 检测次数
|
||||
*/
|
||||
@TableField(value = "ReCheck_Num")
|
||||
private Integer recheckNum;
|
||||
|
||||
/**
|
||||
* 守时检测结果 0:不合格, 1:合格,2:/表示没有做守时检测
|
||||
*/
|
||||
private Integer timeCheckResult;
|
||||
|
||||
/**
|
||||
* 系数校准结果 0:不合格,1:合格,2:/表示没有做系数校准
|
||||
*/
|
||||
private Integer factorCheckResult;
|
||||
|
||||
/**
|
||||
* 实时数据结果 0:不合格,1:合格,2:未检
|
||||
*/
|
||||
private Integer realtimeResult;
|
||||
|
||||
/**
|
||||
* 统计数据结果 0:不合格,1:合格,2:未检
|
||||
*/
|
||||
private Integer statisticsResult;
|
||||
|
||||
/**
|
||||
* 录波数据结果 0:不合格,1:合格,2:未检
|
||||
*/
|
||||
private Integer recordedResult;
|
||||
|
||||
/**
|
||||
* 检测人
|
||||
*/
|
||||
private String checkBy;
|
||||
|
||||
/**
|
||||
* 检测时间
|
||||
*/
|
||||
@TableField("Check_Time")
|
||||
private LocalDateTime checkTime;
|
||||
|
||||
/**
|
||||
* 预检测耗时
|
||||
*/
|
||||
private Integer preDetectTime;
|
||||
|
||||
/**
|
||||
* 系数校准耗时
|
||||
*/
|
||||
private Integer coefficientTime;
|
||||
|
||||
/**
|
||||
* 正式检测耗时
|
||||
*/
|
||||
private Integer formalCheckTime;
|
||||
|
||||
/**
|
||||
* 温度
|
||||
*/
|
||||
private Float temperature;
|
||||
|
||||
/**
|
||||
* 相对湿度
|
||||
*/
|
||||
private Float humidity;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.njcn.gather.device.pojo.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.njcn.db.mybatisplus.bo.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author makejava
|
||||
* @date 2025-05-09
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("pq_standard_dev")
|
||||
public class PqStandardDev extends BaseEntity implements Serializable {
|
||||
private static final long serialVersionUID = 932459726326242984L;
|
||||
/**
|
||||
* 标准设备id
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 标准设备-名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 标准设备-设备类型
|
||||
*/
|
||||
private String devType;
|
||||
|
||||
/**
|
||||
* 标准设备-设备厂家
|
||||
*/
|
||||
private String manufacturer;
|
||||
|
||||
/**
|
||||
* 可检通道(可多选,中间使用英文逗号隔开)
|
||||
*/
|
||||
private String inspectChannel;
|
||||
|
||||
/**
|
||||
* 通信协议
|
||||
*/
|
||||
private String protocol;
|
||||
|
||||
/**
|
||||
* IP地址
|
||||
*/
|
||||
private String ip;
|
||||
|
||||
/**
|
||||
* 端口号
|
||||
*/
|
||||
private Integer port;
|
||||
|
||||
/**
|
||||
* 是否加密(0否、1是)
|
||||
*/
|
||||
private Integer encryptionFlag;
|
||||
|
||||
/**
|
||||
* 识别码
|
||||
*/
|
||||
private String series;
|
||||
|
||||
/**
|
||||
* 密钥
|
||||
*/
|
||||
private String devKey;
|
||||
|
||||
private Integer state;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,108 @@
|
||||
package com.njcn.gather.device.pojo.vo;
|
||||
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import cn.afterturn.easypoi.excel.annotation.ExcelCollection;
|
||||
import com.njcn.common.pojo.constant.PatternRegex;
|
||||
import com.njcn.gather.monitor.pojo.vo.PqMonitorExcel;
|
||||
import com.njcn.gather.pojo.constant.DetectionValidMessage;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.hibernate.validator.constraints.Range;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Pattern;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @data 2025-05-07
|
||||
*/
|
||||
@Data
|
||||
public class ContrastDevExcel implements Serializable {
|
||||
|
||||
@Excel(name = "所属地市*", width = 30, orderNum = "1")
|
||||
private String cityName;
|
||||
|
||||
@Excel(name = "所属供电公司*", width = 30, orderNum = "2")
|
||||
private String gdName;
|
||||
|
||||
@Excel(name = "所属电站*", width = 30, orderNum = "3")
|
||||
private String subName;
|
||||
|
||||
@Excel(name = "设备名称*", width = 20, orderNum = "4")
|
||||
@NotBlank(message = DetectionValidMessage.NAME_NOT_BLANK)
|
||||
@Pattern(regexp = PatternRegex.DEV_NAME_REGEX, message = DetectionValidMessage.NAME_FORMAT_ERROR)
|
||||
private String name;
|
||||
|
||||
@Excel(name = "设备类型*", width = 20, orderNum = "6")
|
||||
@NotBlank(message = DetectionValidMessage.DEV_TYPE_NOT_BLANK)
|
||||
private String devType;
|
||||
|
||||
@Excel(name = "设备厂家*", width = 20, orderNum = "7")
|
||||
@NotBlank(message = DetectionValidMessage.MANUFACTURER_NOT_BLANK)
|
||||
private String manufacturer;
|
||||
|
||||
@Excel(name = "通讯协议*", width = 15, orderNum = "11")
|
||||
@NotBlank(message = DetectionValidMessage.PROTOCOL_NOT_BLANK)
|
||||
private String protocol;
|
||||
|
||||
@Excel(name = "是否加密*", width = 20, replace = {"否_0", "是_1"}, orderNum = "12")
|
||||
@NotNull(message = DetectionValidMessage.ENCRYPTION_NOT_NULL)
|
||||
private Integer encryptionFlag;
|
||||
|
||||
@Excel(name = "识别码(当加密时必填)", width = 30, orderNum = "13")
|
||||
private String series;
|
||||
|
||||
@Excel(name = "秘钥(当加密时必填)", width = 30, orderNum = "14")
|
||||
private String devKey;
|
||||
|
||||
@Excel(name = "IP地址*", width = 20, orderNum = "15")
|
||||
@NotBlank(message = DetectionValidMessage.IP_NOT_BLANK)
|
||||
@Pattern(regexp = PatternRegex.IP_REGEX, message = DetectionValidMessage.IP_FORMAT_ERROR)
|
||||
private String ip;
|
||||
|
||||
@Excel(name = "端口号*", width = 15, orderNum = "16")
|
||||
@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, orderNum = "17", format = "yyyy-MM-dd")
|
||||
@NotNull(message = DetectionValidMessage.CREATE_DATE_NOT_NULL)
|
||||
private LocalDate createDate;
|
||||
|
||||
@Excel(name = "定检日期(yyyy-MM-dd)*", width = 30, orderNum = "18", format = "yyyy-MM-dd")
|
||||
@NotNull(message = DetectionValidMessage.INSPECT_DATE_NOT_NULL)
|
||||
private LocalDate inspectDate;
|
||||
|
||||
@Excel(name = "谐波系统设备id*", width = 30, orderNum = "19")
|
||||
@NotBlank(message = DetectionValidMessage.HARM_SYS_ID_NOT_BLANK)
|
||||
private String harmSysId;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class ImportExcel extends ContrastDevExcel {
|
||||
|
||||
@ExcelCollection(name = "监测点信息", orderNum = "22")
|
||||
private List<PqMonitorExcel> pqMonitorExcelList;
|
||||
}
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class ExportExcel extends ContrastDevExcel {
|
||||
@Excel(name = "设备序列号*", width = 20, orderNum = "5")
|
||||
@NotBlank(message = DetectionValidMessage.FACTORYNO_NOT_BLANK)
|
||||
private String createId;
|
||||
|
||||
@Excel(name = "被检通道", width = 20, orderNum = "8")
|
||||
private String inspectChannel;
|
||||
|
||||
@Excel(name = "固件版本", width = 15, orderNum = "9")
|
||||
private String hardwareVersion;
|
||||
|
||||
@Excel(name = "软件版本", width = 15, orderNum = "10")
|
||||
private String softwareVersion;
|
||||
}
|
||||
}
|
||||
@@ -1,15 +1,9 @@
|
||||
package com.njcn.gather.device.pojo.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
|
||||
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
|
||||
import com.njcn.gather.device.pojo.po.PqDev;
|
||||
import com.njcn.gather.monitor.pojo.po.PqMonitor;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@@ -27,4 +21,84 @@ public class PqDevVO extends PqDev {
|
||||
private Double devCurr;
|
||||
|
||||
private List<PqMonitor> monitorList;
|
||||
|
||||
/**
|
||||
* 检测状态 0-未检、1检测中、2检测完成、3归档
|
||||
*/
|
||||
private Integer checkState;
|
||||
|
||||
/**
|
||||
* 检测结果 0不符合、1符合、2未检
|
||||
*/
|
||||
private Integer checkResult;
|
||||
|
||||
/**
|
||||
* 报告生成状态 0未生成、1已生成、2未检
|
||||
*/
|
||||
private Integer reportState;
|
||||
|
||||
/**
|
||||
* 检测次数
|
||||
*/
|
||||
private Integer recheckNum;
|
||||
|
||||
/**
|
||||
* 守时检测结果 0:不合格, 1:合格,2:/表示没有做守时检测
|
||||
*/
|
||||
private Integer timeCheckResult;
|
||||
|
||||
/**
|
||||
* 系数校准结果 0:不合格,1:合格,2:/表示没有做系数校准
|
||||
*/
|
||||
private Integer factorCheckResult;
|
||||
|
||||
/**
|
||||
* 实时数据结果 0:不合格,1:合格,2:未检
|
||||
*/
|
||||
private Integer realtimeResult;
|
||||
|
||||
/**
|
||||
* 统计数据结果 0:不合格,1:合格,2:未检
|
||||
*/
|
||||
private Integer statisticsResult;
|
||||
|
||||
/**
|
||||
* 录波数据结果 0:不合格,1:合格,2:未检
|
||||
*/
|
||||
private Integer recordedResult;
|
||||
|
||||
/**
|
||||
* 检测人
|
||||
*/
|
||||
private String checkBy;
|
||||
|
||||
/**
|
||||
* 检测时间
|
||||
*/
|
||||
private LocalDateTime checkTime;
|
||||
|
||||
/**
|
||||
* 预检测耗时
|
||||
*/
|
||||
private Integer preDetectTime;
|
||||
|
||||
/**
|
||||
* 系数校准耗时
|
||||
*/
|
||||
private Integer coefficientTime;
|
||||
|
||||
/**
|
||||
* 正式检测耗时
|
||||
*/
|
||||
private Integer formalCheckTime;
|
||||
|
||||
/**
|
||||
* 温度
|
||||
*/
|
||||
private Float temperature;
|
||||
|
||||
/**
|
||||
* 相对湿度
|
||||
*/
|
||||
private Float humidity;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.njcn.gather.device.pojo.vo;
|
||||
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import com.njcn.common.pojo.constant.PatternRegex;
|
||||
import com.njcn.gather.pojo.constant.DetectionValidMessage;
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.Range;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Pattern;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @data 2025-07-01
|
||||
*/
|
||||
@Data
|
||||
public class PqStandardDevExcel {
|
||||
|
||||
@Excel(name = "名称*", width = 20, orderNum = "1")
|
||||
@NotBlank(message = DetectionValidMessage.NAME_NOT_BLANK)
|
||||
private String name;
|
||||
|
||||
@Excel(name = "设备类型*", width = 25, orderNum = "2")
|
||||
@NotBlank(message = DetectionValidMessage.DEV_TYPE_NOT_BLANK)
|
||||
private String devType;
|
||||
|
||||
@Excel(name = "设备厂家*", width = 25, orderNum = "3")
|
||||
@NotBlank(message = DetectionValidMessage.MANUFACTURER_NOT_BLANK)
|
||||
private String manufacturer;
|
||||
|
||||
@Excel(name = "可检通道*", width = 25, orderNum = "4")
|
||||
@NotBlank(message = DetectionValidMessage.INSPECT_CHANNEL_NOT_BLANK)
|
||||
private String inspectChannel;
|
||||
|
||||
@Excel(name = "通信协议*", width = 25, orderNum = "5")
|
||||
@NotBlank(message = DetectionValidMessage.PROTOCOL_NOT_BLANK)
|
||||
private String protocol;
|
||||
|
||||
@Excel(name = "IP地址*", width = 25, orderNum = "6")
|
||||
@NotBlank(message = DetectionValidMessage.IP_NOT_BLANK)
|
||||
@Pattern(regexp = PatternRegex.IP_REGEX, message = DetectionValidMessage.IP_FORMAT_ERROR)
|
||||
private String ip;
|
||||
|
||||
@Excel(name = "端口号*", width = 15, orderNum = "7")
|
||||
@NotNull(message = DetectionValidMessage.PORT_NOT_NULL)
|
||||
@Range(min = 1, max = 65535, message = DetectionValidMessage.PORT_RANGE_ERROR)
|
||||
private Integer port;
|
||||
|
||||
@Excel(name = "是否加密*", width = 20, replace = {"否_0", "是_1"}, orderNum = "8")
|
||||
@NotNull(message = DetectionValidMessage.ENCRYPTION_NOT_NULL)
|
||||
private Integer encryptionFlag;
|
||||
|
||||
@Excel(name = "识别码(当加密时必填)", width = 30, orderNum = "9")
|
||||
private String series;
|
||||
|
||||
@Excel(name = "秘钥(当加密时必填)", width = 30, orderNum = "10")
|
||||
private String devKey;
|
||||
}
|
||||
@@ -6,10 +6,7 @@ import com.njcn.common.pojo.poi.PullDown;
|
||||
import com.njcn.gather.device.pojo.enums.TimeCheckResultEnum;
|
||||
import com.njcn.gather.device.pojo.param.PqDevParam;
|
||||
import com.njcn.gather.device.pojo.po.PqDev;
|
||||
import com.njcn.gather.device.pojo.vo.CNDevExcel;
|
||||
import com.njcn.gather.device.pojo.vo.PqDevVO;
|
||||
import com.njcn.gather.device.pojo.vo.PreDetection;
|
||||
import com.njcn.gather.device.pojo.vo.ProvinceDevExcel;
|
||||
import com.njcn.gather.device.pojo.vo.*;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
@@ -64,36 +61,6 @@ public interface IPqDevService extends IService<PqDev> {
|
||||
*/
|
||||
boolean updatePqDevTimeCheckResult(List<String> ids, TimeCheckResultEnum result);
|
||||
|
||||
/**
|
||||
* 获取模拟式||数字式设备导出时所需的数据
|
||||
*
|
||||
* @param queryParam 查询参数
|
||||
* @return
|
||||
*/
|
||||
//List<PqDevExcel.SimulateOrDigitalExportData> getSimulateOrDigitExportData(PqDevParam.QueryParam queryParam);
|
||||
|
||||
/**
|
||||
* 获取比对式设备导出时所需的数据
|
||||
*
|
||||
* @param queryParam 查询参数
|
||||
* @return 比对式设备导出时所需的数据
|
||||
*/
|
||||
//List<PqDevExcel.ContrastExportData> getContrastExportData(PqDevParam.QueryParam queryParam);
|
||||
|
||||
/**
|
||||
* 批量导入被检设备信息
|
||||
*
|
||||
* @param sgEventExcels 批量导入的数据
|
||||
*/
|
||||
//void importContrastData(List<PqDevExcel.ContrastImportData> sgEventExcels);
|
||||
|
||||
/**
|
||||
* 批量导入被检设备信息
|
||||
*
|
||||
* @param sgEventExcels 批量导入的数据
|
||||
*/
|
||||
//void importSimulateAndDigitalData(List<PqDevExcel.SimulateOrDigitalImportData> sgEventExcels);
|
||||
|
||||
/**
|
||||
* 获取所有未绑定的设备
|
||||
*
|
||||
@@ -108,7 +75,7 @@ public interface IPqDevService extends IService<PqDev> {
|
||||
* @param param 计划id
|
||||
* @return 绑定的设备列表
|
||||
*/
|
||||
List<PqDev> listByPlanId(PqDevParam.QueryParam param);
|
||||
List<PqDevVO> listByPlanId(PqDevParam.QueryParam param);
|
||||
|
||||
/**
|
||||
* 绑定计划
|
||||
@@ -153,7 +120,7 @@ public interface IPqDevService extends IService<PqDev> {
|
||||
|
||||
void updatePqDevReportState(String devId, int i);
|
||||
|
||||
int countUnReportDev(String planId);
|
||||
long countUnReportDev(String planId);
|
||||
|
||||
/**
|
||||
* 根据计划id列表获取设备列表
|
||||
@@ -172,8 +139,10 @@ public interface IPqDevService extends IService<PqDev> {
|
||||
|
||||
/**
|
||||
* 下载模板文件
|
||||
*
|
||||
* @param patternId 模式Id
|
||||
*/
|
||||
void downloadTemplate();
|
||||
void downloadTemplate(String patternId);
|
||||
|
||||
/**
|
||||
* 导入设备数据
|
||||
@@ -183,7 +152,7 @@ public interface IPqDevService extends IService<PqDev> {
|
||||
* @param planId 计划Id
|
||||
* @param response 响应
|
||||
*/
|
||||
void importDev(MultipartFile file, String patternId, String planId, HttpServletResponse response);
|
||||
boolean importDev(MultipartFile file, String patternId, String planId, HttpServletResponse response);
|
||||
|
||||
/**
|
||||
* 导入灿能二楼设备数据
|
||||
@@ -193,7 +162,7 @@ public interface IPqDevService extends IService<PqDev> {
|
||||
* @param planId 计划Id
|
||||
* @param response 响应
|
||||
*/
|
||||
void importCNDev(MultipartFile file, String patternId, String planId, HttpServletResponse response);
|
||||
boolean importCNDev(MultipartFile file, String patternId, String planId, HttpServletResponse response);
|
||||
|
||||
/**
|
||||
* 导入灿能二楼设备数据
|
||||
@@ -202,14 +171,14 @@ public interface IPqDevService extends IService<PqDev> {
|
||||
* @param patternId
|
||||
* @param planId
|
||||
*/
|
||||
void importCNDev(List<CNDevExcel> cnDevExcelList, String patternId, String planId);
|
||||
boolean importCNDev(List<CNDevExcel> cnDevExcelList, String patternId, String planId);
|
||||
|
||||
/**
|
||||
* 可视化-灿能二楼设备
|
||||
*
|
||||
* @param pqDevs
|
||||
*/
|
||||
void visualizeCNDev(List<PqDev> pqDevs);
|
||||
void visualizeCNDev(List<PqDevVO> pqDevs);
|
||||
|
||||
/**
|
||||
* 逆向可视化-灿能二楼设备
|
||||
@@ -227,7 +196,7 @@ public interface IPqDevService extends IService<PqDev> {
|
||||
* @param planId 计划Id
|
||||
* @param response 响应
|
||||
*/
|
||||
void importProvinceDev(MultipartFile file, String patternId, String planId, HttpServletResponse response);
|
||||
boolean importProvinceDev(MultipartFile file, String patternId, String planId, HttpServletResponse response);
|
||||
|
||||
/**
|
||||
* 导入省级平台设备数据
|
||||
@@ -236,14 +205,14 @@ public interface IPqDevService extends IService<PqDev> {
|
||||
* @param patternId
|
||||
* @param planId
|
||||
*/
|
||||
void importProvinceDev(List<ProvinceDevExcel> proviceDevExcelList, String patternId, String planId);
|
||||
boolean importProvinceDev(List<ProvinceDevExcel> proviceDevExcelList, String patternId, String planId);
|
||||
|
||||
/**
|
||||
* 可视化-省级平台设备
|
||||
*
|
||||
* @param pqDevs
|
||||
*/
|
||||
void visualizeProvinceDev(List<PqDev> pqDevs);
|
||||
void visualizeProvinceDev(List<PqDevVO> pqDevs);
|
||||
|
||||
/**
|
||||
* 逆向可视化-省级平台设备
|
||||
@@ -256,6 +225,7 @@ public interface IPqDevService extends IService<PqDev> {
|
||||
/**
|
||||
* 获取省级平台设备导出、导出文件模板的下拉列表
|
||||
*
|
||||
* @param startCol 开始列
|
||||
* @return
|
||||
*/
|
||||
List<PullDown> getProvinceDevPullDownList(int startCol);
|
||||
@@ -267,4 +237,31 @@ public interface IPqDevService extends IService<PqDev> {
|
||||
* @return
|
||||
*/
|
||||
List<PullDown> getCNDevPullDownList(int startCol);
|
||||
|
||||
/**
|
||||
* 导入比对式设备数据
|
||||
*
|
||||
* @param file 上传的文件
|
||||
* @param patternId 模式Id
|
||||
* @param planId 计划Id
|
||||
* @param response 响应
|
||||
*/
|
||||
boolean importContrastDev(MultipartFile file, String patternId, String planId, HttpServletResponse response);
|
||||
|
||||
/**
|
||||
* 导入比对式设备数据
|
||||
*
|
||||
* @param contrastDevExcelList
|
||||
* @param patternId
|
||||
*/
|
||||
boolean importContrastDev(List<ContrastDevExcel.ImportExcel> contrastDevExcelList, String patternId);
|
||||
|
||||
/**
|
||||
* 获取比对式设备导出、导出文件模板的下拉列表
|
||||
*
|
||||
* @param startCol
|
||||
* @param isExport 是否是导出模板
|
||||
* @return
|
||||
*/
|
||||
List<PullDown> getContrastDevPullDownList(int startCol, boolean isExport);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.njcn.gather.device.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.gather.device.pojo.po.PqDevSub;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @date 2025-07-04
|
||||
*/
|
||||
public interface IPqDevSubService extends IService<PqDevSub> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
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.PqStandardDevParam;
|
||||
import com.njcn.gather.device.pojo.po.PqStandardDev;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @date 2025-07-02
|
||||
*/
|
||||
public interface IPqStandardDevService extends IService<PqStandardDev> {
|
||||
|
||||
/**
|
||||
* 分页查询标准设备列表
|
||||
*
|
||||
* @param queryParam 分页查询参数
|
||||
* @return
|
||||
*/
|
||||
Page<PqStandardDev> listPqStandardDevs(PqStandardDevParam.QueryParam queryParam);
|
||||
|
||||
/**
|
||||
* 根据id查询标准设备
|
||||
*
|
||||
* @param id 设备id
|
||||
* @return 设备对象
|
||||
*/
|
||||
PqStandardDev getPqStandardDevById(String id);
|
||||
|
||||
/**
|
||||
* 新增标准设备
|
||||
*
|
||||
* @param param 新增参数
|
||||
* @return 新增成功返回true,失败返回false
|
||||
*/
|
||||
boolean addPqStandardDev(PqStandardDevParam param);
|
||||
|
||||
/**
|
||||
* 修改标准设备
|
||||
*
|
||||
* @param param 修改参数
|
||||
* @return 修改成功返回true,失败返回false
|
||||
*/
|
||||
boolean updatePqStandardDev(PqStandardDevParam.UpdateParam param);
|
||||
|
||||
/**
|
||||
* 批量删除标准设备
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
boolean deletePqStandardDevs(List<String> ids);
|
||||
|
||||
/**
|
||||
* 导出标准设备
|
||||
*
|
||||
* @param queryParam
|
||||
*/
|
||||
void export(PqStandardDevParam.QueryParam queryParam);
|
||||
|
||||
/**
|
||||
* 下装标准设备导入模板
|
||||
*/
|
||||
void downloadTemplate();
|
||||
|
||||
/**
|
||||
* 导入标准设备数据
|
||||
*
|
||||
* @param file
|
||||
* @return
|
||||
*/
|
||||
void importData(MultipartFile file, HttpServletResponse response);
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,20 @@
|
||||
package com.njcn.gather.device.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.gather.device.pojo.po.PqDevSub;
|
||||
import com.njcn.gather.device.mapper.PqDevSubMapper;
|
||||
import com.njcn.gather.device.service.IPqDevSubService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @date 2025-07-04
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class PqDevSubServiceImpl extends ServiceImpl<PqDevSubMapper, PqDevSub> implements IPqDevSubService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,287 @@
|
||||
package com.njcn.gather.device.service.impl;
|
||||
|
||||
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.CollectionUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.pojo.poi.PullDown;
|
||||
import com.njcn.common.utils.EncryptionUtil;
|
||||
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.service.IPqStandardDevService;
|
||||
import com.njcn.gather.pojo.enums.DetectionResponseEnum;
|
||||
import com.njcn.gather.system.dictionary.pojo.po.DictData;
|
||||
import com.njcn.gather.system.dictionary.pojo.po.DictType;
|
||||
import com.njcn.gather.system.dictionary.service.IDictDataService;
|
||||
import com.njcn.gather.system.dictionary.service.IDictTypeService;
|
||||
import com.njcn.gather.type.service.IDevTypeService;
|
||||
import com.njcn.web.factory.PageFactory;
|
||||
import com.njcn.web.utils.ExcelUtil;
|
||||
import com.njcn.web.utils.PoiUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author 曹泽辉
|
||||
* @date 2025-07-02
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class PqStandardDevServiceImpl extends ServiceImpl<PqStandardDevMapper, PqStandardDev> implements IPqStandardDevService {
|
||||
private final IDevTypeService devTypeService;
|
||||
private final IDictDataService dictDataService;
|
||||
private final IDictTypeService dictTypeService;
|
||||
|
||||
@Override
|
||||
public Page<PqStandardDev> listPqStandardDevs(PqStandardDevParam.QueryParam queryParam) {
|
||||
QueryWrapper<PqStandardDev> wrapper = new QueryWrapper<>();
|
||||
wrapper.like(StrUtil.isNotBlank(queryParam.getName()), "name", queryParam.getName())
|
||||
.eq(StrUtil.isNotBlank(queryParam.getManufacturer()), "manufacturer", queryParam.getManufacturer())
|
||||
.eq(StrUtil.isNotBlank(queryParam.getDevType()), "dev_type", queryParam.getDevType())
|
||||
.eq("state", DataStateEnum.ENABLE.getCode());
|
||||
return this.page(new Page<>(PageFactory.getPageNum(queryParam), PageFactory.getPageSize(queryParam)), wrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PqStandardDev getPqStandardDevById(String id) {
|
||||
PqStandardDev standardDev = this.getById(id);
|
||||
if (standardDev.getEncryptionFlag() == 1) {
|
||||
standardDev.setSeries(EncryptionUtil.decoderString(1, standardDev.getSeries()));
|
||||
standardDev.setDevKey(EncryptionUtil.decoderString(1, standardDev.getDevKey()));
|
||||
}
|
||||
return standardDev;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean addPqStandardDev(PqStandardDevParam param) {
|
||||
this.checkRepeat(param, false);
|
||||
PqStandardDev pqStandardDev = BeanUtil.copyProperties(param, PqStandardDev.class);
|
||||
pqStandardDev.setState(DataStateEnum.ENABLE.getCode());
|
||||
this.checkEncryption(pqStandardDev);
|
||||
return this.save(pqStandardDev);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean updatePqStandardDev(PqStandardDevParam.UpdateParam param) {
|
||||
this.checkRepeat(param, true);
|
||||
PqStandardDev pqStandardDev = BeanUtil.copyProperties(param, PqStandardDev.class);
|
||||
this.checkEncryption(pqStandardDev);
|
||||
return this.updateById(pqStandardDev);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean deletePqStandardDevs(List<String> ids) {
|
||||
LambdaUpdateWrapper<PqStandardDev> wrapper = new LambdaUpdateWrapper();
|
||||
wrapper.set(PqStandardDev::getState, DataStateEnum.DELETED.getCode())
|
||||
.in(PqStandardDev::getId, ids);
|
||||
return this.update(wrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void export(PqStandardDevParam.QueryParam queryParam) {
|
||||
QueryWrapper<PqStandardDev> wrapper = new QueryWrapper<>();
|
||||
wrapper.like(StrUtil.isNotBlank(queryParam.getName()), "name", queryParam.getName())
|
||||
.eq(StrUtil.isNotBlank(queryParam.getManufacturer()), "manufacturer", queryParam.getManufacturer())
|
||||
.eq(StrUtil.isNotBlank(queryParam.getDevType()), "dev_type", queryParam.getDevType())
|
||||
.eq("state", DataStateEnum.ENABLE.getCode());
|
||||
List<PqStandardDev> pqStandardDevs = this.list(wrapper);
|
||||
this.visualizeStandardDev(pqStandardDevs);
|
||||
List<PqStandardDevExcel> pqStandardDevExcels = BeanUtil.copyToList(pqStandardDevs, PqStandardDevExcel.class);
|
||||
ExcelUtil.exportExcelPullDown(new ExportParams(), "标准设备导出数据.xlsx", 1, this.getStandardDevPullDownList(), PqStandardDevExcel.class, pqStandardDevExcels);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void downloadTemplate() {
|
||||
ExcelUtil.exportExcelPullDown(new ExportParams(), "标准设备导入模板.xlsx", 1, this.getStandardDevPullDownList(), PqStandardDevExcel.class, Collections.emptyList());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void importData(MultipartFile file, HttpServletResponse response) {
|
||||
ImportParams params = new ImportParams();
|
||||
params.setStartSheetIndex(0);
|
||||
params.setSheetNum(1);
|
||||
params.setNeedVerify(true);
|
||||
params.setHeadRows(1);
|
||||
|
||||
List<PqStandardDevExcel> contrastDevExcelList = null;
|
||||
try {
|
||||
ExcelImportResult<PqStandardDevExcel> excelImportResult = ExcelImportUtil.importExcelMore(file.getInputStream(), PqStandardDevExcel.class, params);
|
||||
if (excelImportResult.isVerifyFail()) {
|
||||
// 此处前端要做特殊处理,具体可以参考技术监督的数据导入
|
||||
Workbook failWorkbook = excelImportResult.getFailWorkbook();
|
||||
PoiUtil.exportFileByWorkbook(failWorkbook, "非法被检设备数据.xlsx", response);
|
||||
} else {
|
||||
contrastDevExcelList = excelImportResult.getList();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new BusinessException(DetectionResponseEnum.IMPORT_DATA_FAIL);
|
||||
}
|
||||
this.importData(contrastDevExcelList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
*
|
||||
* @param contrastDevExcelList
|
||||
* @return
|
||||
*/
|
||||
private void importData(List<PqStandardDevExcel> contrastDevExcelList) {
|
||||
if (CollectionUtil.isNotEmpty(contrastDevExcelList)) {
|
||||
List<PqStandardDev> contrastDevs = BeanUtil.copyToList(contrastDevExcelList, PqStandardDev.class);
|
||||
this.reverseVisualizeStandardDev(contrastDevs);
|
||||
this.saveBatch(contrastDevs);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取标准设备导出文件下拉列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private List<PullDown> getStandardDevPullDownList() {
|
||||
List<PullDown> pullDownList = new ArrayList<>();
|
||||
|
||||
PullDown pullDown = new PullDown();
|
||||
|
||||
// 设备类型
|
||||
pullDown.setFirstCol(1);
|
||||
pullDown.setLastCol(1);
|
||||
pullDown.setStrings(devTypeService.listAll().stream().map(devType -> devType.getName()).collect(Collectors.toList()));
|
||||
pullDownList.add(pullDown);
|
||||
|
||||
|
||||
List<DictData> dictDataList = null;
|
||||
// 设备厂家
|
||||
DictType dictType = dictTypeService.getByCode("Dev_Manufacturers");
|
||||
if (ObjectUtil.isNotNull(dictType)) {
|
||||
dictDataList = dictDataService.getDictDataByTypeId(dictType.getId());
|
||||
|
||||
pullDown = new PullDown();
|
||||
pullDown.setFirstCol(2);
|
||||
pullDown.setLastCol(2);
|
||||
pullDown.setStrings(dictDataList.stream().map(DictData::getName).collect(Collectors.toList()));
|
||||
pullDownList.add(pullDown);
|
||||
}
|
||||
|
||||
// 通讯协议
|
||||
dictType = dictTypeService.getByCode("Protocol");
|
||||
if (ObjectUtil.isNotNull(dictType)) {
|
||||
dictDataList = dictDataService.getDictDataByTypeId(dictType.getId());
|
||||
|
||||
pullDown = new PullDown();
|
||||
pullDown.setFirstCol(4);
|
||||
pullDown.setLastCol(4);
|
||||
pullDown.setStrings(dictDataList.stream().map(DictData::getName).collect(Collectors.toList()));
|
||||
pullDownList.add(pullDown);
|
||||
}
|
||||
|
||||
// 是否加密
|
||||
pullDown = new PullDown();
|
||||
pullDown.setFirstCol(7);
|
||||
pullDown.setLastCol(7);
|
||||
pullDown.setStrings(Arrays.asList("否", "是"));
|
||||
pullDownList.add(pullDown);
|
||||
|
||||
return pullDownList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 可视化标准设备
|
||||
*
|
||||
* @param pqStandardDevs
|
||||
*/
|
||||
private void visualizeStandardDev(List<PqStandardDev> pqStandardDevs) {
|
||||
pqStandardDevs.forEach(pqStandardDev -> {
|
||||
pqStandardDev.setDevType(devTypeService.getById(pqStandardDev.getDevType()).getName());
|
||||
pqStandardDev.setManufacturer(dictDataService.getDictDataById(pqStandardDev.getManufacturer()).getName());
|
||||
pqStandardDev.setProtocol(dictDataService.getDictDataById(pqStandardDev.getProtocol()).getName());
|
||||
if (pqStandardDev.getEncryptionFlag() == 1) {
|
||||
pqStandardDev.setSeries(EncryptionUtil.decoderString(1, pqStandardDev.getSeries()));
|
||||
pqStandardDev.setDevKey(EncryptionUtil.decoderString(1, pqStandardDev.getDevKey()));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 逆向可视化标准设备
|
||||
*
|
||||
* @param pqStandardDevs
|
||||
*/
|
||||
private void reverseVisualizeStandardDev(List<PqStandardDev> pqStandardDevs) {
|
||||
pqStandardDevs.forEach(pqStandardDev -> {
|
||||
PqStandardDevParam pqStandardDevParam = BeanUtil.copyProperties(pqStandardDev, PqStandardDevParam.class);
|
||||
this.checkRepeat(pqStandardDevParam, false);
|
||||
this.checkEncryption(pqStandardDev);
|
||||
pqStandardDev.setDevType(devTypeService.getByName(pqStandardDev.getDevType()).getId());
|
||||
pqStandardDev.setManufacturer(dictDataService.getDictDataByName(pqStandardDev.getManufacturer()).getId());
|
||||
pqStandardDev.setProtocol(dictDataService.getDictDataByName(pqStandardDev.getProtocol()).getId());
|
||||
pqStandardDev.setState(DataStateEnum.ENABLE.getCode());
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查是否重复
|
||||
*
|
||||
* @param pqStandardDevParam
|
||||
* @param isExcludeSelf
|
||||
*/
|
||||
private void checkRepeat(PqStandardDevParam pqStandardDevParam, boolean isExcludeSelf) {
|
||||
QueryWrapper<PqStandardDev> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("pq_standard_dev.Name", pqStandardDevParam.getName())
|
||||
.eq("pq_standard_dev.State", DataStateEnum.ENABLE.getCode());
|
||||
if (isExcludeSelf) {
|
||||
if (pqStandardDevParam instanceof PqStandardDevParam.UpdateParam) {
|
||||
wrapper.ne("pq_standard_dev.Id", ((PqStandardDevParam.UpdateParam) pqStandardDevParam).getId());
|
||||
}
|
||||
}
|
||||
int count = this.count(wrapper);
|
||||
if (count > 0) {
|
||||
throw new BusinessException(DetectionResponseEnum.PQ_STANDARD_DEV_REPEAT);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查加密情况
|
||||
*
|
||||
* @param pqStandardDev
|
||||
*/
|
||||
private void checkEncryption(PqStandardDev pqStandardDev) {
|
||||
if (pqStandardDev.getEncryptionFlag() == 1) {
|
||||
if (StrUtil.isNotBlank(pqStandardDev.getSeries()) && StrUtil.isNotBlank(pqStandardDev.getDevKey())) {
|
||||
pqStandardDev.setSeries(EncryptionUtil.encodeString(1, pqStandardDev.getSeries()));
|
||||
pqStandardDev.setDevKey(EncryptionUtil.encodeString(1, pqStandardDev.getDevKey()));
|
||||
} else {
|
||||
throw new BusinessException(DetectionResponseEnum.SERIES_AND_DEVKEY_NOT_BLANK);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user