Compare commits
31 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a27eb7e462 | ||
|
|
f68d5da31e | ||
|
|
2d889b07f7 | ||
|
|
417a53a835 | ||
| 9ecfe4f59b | |||
|
|
0d80e33d13 | ||
|
|
a2f7b1b9de | ||
| ee96b8e56b | |||
|
|
6c88c54982 | ||
| b2ff27b15c | |||
| 35a47b2fa3 | |||
|
|
4c0816a829 | ||
|
|
1eb64fadae | ||
|
|
3ceb73d601 | ||
|
|
9d701ad55e | ||
| 8453b1da95 | |||
|
|
ba2fec5ac0 | ||
| 46a2e2068b | |||
| 7336a0aaa8 | |||
|
|
a67c5de69d | ||
|
|
95d5396759 | ||
| 858fc9aa05 | |||
|
|
55793dcecd | ||
| c9ac33864a | |||
| 6e4bbfc383 | |||
|
|
cb4d8d502a | ||
| 067f2235a7 | |||
| b42ede2853 | |||
| 9a4ef6abb5 | |||
|
|
af2b080ff5 | ||
|
|
0e056a7de1 |
@@ -3,13 +3,10 @@ package com.njcn.gather.detection.controller;
|
|||||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
import com.njcn.gather.detection.handler.SocketDevResponseService;
|
import com.njcn.gather.detection.pojo.param.ContrastDetectionParam;
|
||||||
import com.njcn.gather.detection.pojo.param.PreDetectionParam;
|
import com.njcn.gather.detection.pojo.param.PreDetectionParam;
|
||||||
import com.njcn.gather.detection.pojo.param.SimulateDetectionParam;
|
import com.njcn.gather.detection.pojo.param.SimulateDetectionParam;
|
||||||
import com.njcn.gather.detection.service.PreDetectionService;
|
import com.njcn.gather.detection.service.PreDetectionService;
|
||||||
import com.njcn.gather.detection.service.impl.DetectionServiceImpl;
|
|
||||||
import com.njcn.gather.device.service.IPqDevService;
|
|
||||||
import com.njcn.gather.script.service.IPqScriptDtlsService;
|
|
||||||
import com.njcn.web.controller.BaseController;
|
import com.njcn.web.controller.BaseController;
|
||||||
import com.njcn.web.utils.HttpResultUtil;
|
import com.njcn.web.utils.HttpResultUtil;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
@@ -35,6 +32,7 @@ public class PreDetectionController extends BaseController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 开始检测通用入口
|
* 开始检测通用入口
|
||||||
|
*
|
||||||
* @param param 实体参数
|
* @param param 实体参数
|
||||||
*/
|
*/
|
||||||
@PostMapping("/startPreTest")
|
@PostMapping("/startPreTest")
|
||||||
@@ -47,6 +45,7 @@ public class PreDetectionController extends BaseController {
|
|||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 程控源-源通讯校验
|
* 程控源-源通讯校验
|
||||||
*
|
*
|
||||||
@@ -129,4 +128,18 @@ public class PreDetectionController extends BaseController {
|
|||||||
preDetectionService.restartTemTest(param);
|
preDetectionService.restartTemTest(param);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开始比对检测(包括预检测、正式检测)通用入口
|
||||||
|
*/
|
||||||
|
@PostMapping("/startContrastTest")
|
||||||
|
@OperateInfo
|
||||||
|
@ApiOperation("开始比对检测")
|
||||||
|
@ApiImplicitParam(name = "param", value = "查询参数", required = true)
|
||||||
|
public HttpResult<String> startContrastTest(@RequestBody @Validated ContrastDetectionParam param) {
|
||||||
|
String methodDescribe = getMethodDescribe("startContrastTest");
|
||||||
|
preDetectionService.startContrastTest(param);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -17,11 +17,13 @@ import com.njcn.gather.detection.pojo.po.IcdCheckData;
|
|||||||
import com.njcn.gather.detection.pojo.po.SourceCompareDev;
|
import com.njcn.gather.detection.pojo.po.SourceCompareDev;
|
||||||
import com.njcn.gather.detection.pojo.vo.*;
|
import com.njcn.gather.detection.pojo.vo.*;
|
||||||
import com.njcn.gather.detection.service.impl.DetectionServiceImpl;
|
import com.njcn.gather.detection.service.impl.DetectionServiceImpl;
|
||||||
|
import com.njcn.gather.detection.util.DetectionUtil;
|
||||||
import com.njcn.gather.detection.util.socket.*;
|
import com.njcn.gather.detection.util.socket.*;
|
||||||
import com.njcn.gather.device.pojo.enums.CommonEnum;
|
import com.njcn.gather.device.pojo.enums.CommonEnum;
|
||||||
import com.njcn.gather.device.pojo.po.PqDev;
|
import com.njcn.gather.device.pojo.po.PqDevSub;
|
||||||
import com.njcn.gather.device.pojo.vo.PreDetection;
|
import com.njcn.gather.device.pojo.vo.PreDetection;
|
||||||
import com.njcn.gather.device.service.IPqDevService;
|
import com.njcn.gather.device.service.IPqDevService;
|
||||||
|
import com.njcn.gather.device.service.IPqDevSubService;
|
||||||
import com.njcn.gather.plan.pojo.po.AdPlan;
|
import com.njcn.gather.plan.pojo.po.AdPlan;
|
||||||
import com.njcn.gather.plan.service.IAdPlanService;
|
import com.njcn.gather.plan.service.IAdPlanService;
|
||||||
import com.njcn.gather.script.pojo.param.PqScriptCheckDataParam;
|
import com.njcn.gather.script.pojo.param.PqScriptCheckDataParam;
|
||||||
@@ -30,10 +32,10 @@ import com.njcn.gather.script.pojo.po.SourceIssue;
|
|||||||
import com.njcn.gather.script.service.IPqScriptCheckDataService;
|
import com.njcn.gather.script.service.IPqScriptCheckDataService;
|
||||||
import com.njcn.gather.script.service.IPqScriptDtlsService;
|
import com.njcn.gather.script.service.IPqScriptDtlsService;
|
||||||
import com.njcn.gather.storage.pojo.param.StorageParam;
|
import com.njcn.gather.storage.pojo.param.StorageParam;
|
||||||
import com.njcn.gather.storage.pojo.po.AdHarmonicResult;
|
import com.njcn.gather.storage.pojo.po.SimAndDigHarmonicResult;
|
||||||
import com.njcn.gather.storage.pojo.po.AdNonHarmonicResult;
|
import com.njcn.gather.storage.pojo.po.SimAndDigNonHarmonicResult;
|
||||||
import com.njcn.gather.storage.service.AdHarmonicService;
|
|
||||||
import com.njcn.gather.storage.service.DetectionDataDealService;
|
import com.njcn.gather.storage.service.DetectionDataDealService;
|
||||||
|
import com.njcn.gather.storage.service.SimAndDigHarmonicService;
|
||||||
import com.njcn.gather.system.cfg.service.ISysTestConfigService;
|
import com.njcn.gather.system.cfg.service.ISysTestConfigService;
|
||||||
import com.njcn.gather.system.dictionary.pojo.enums.DictDataEnum;
|
import com.njcn.gather.system.dictionary.pojo.enums.DictDataEnum;
|
||||||
import com.njcn.gather.system.dictionary.pojo.po.DictData;
|
import com.njcn.gather.system.dictionary.pojo.po.DictData;
|
||||||
@@ -48,10 +50,7 @@ import java.lang.reflect.Field;
|
|||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.ZoneId;
|
|
||||||
import java.time.ZonedDateTime;
|
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.time.format.DateTimeParseException;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
@@ -64,13 +63,6 @@ import static com.njcn.gather.detection.util.socket.FormalTestManager.harmonicRe
|
|||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class SocketDevResponseService {
|
public class SocketDevResponseService {
|
||||||
|
|
||||||
private final String handlerStr = "_Dev";
|
|
||||||
private final String handlerSourceStr = "_Source";
|
|
||||||
private final String stepTag = "&&";
|
|
||||||
private final String splitTag = "_";
|
|
||||||
private final String stepBegin = "_Start";
|
|
||||||
private final String stepEnd = "_End";
|
|
||||||
// ISO 8601格式
|
// ISO 8601格式
|
||||||
private final DateTimeFormatter formatter = DateTimeFormatter.ISO_DATE_TIME;
|
private final DateTimeFormatter formatter = DateTimeFormatter.ISO_DATE_TIME;
|
||||||
|
|
||||||
@@ -83,6 +75,7 @@ public class SocketDevResponseService {
|
|||||||
|
|
||||||
|
|
||||||
private final IPqDevService iPqDevService;
|
private final IPqDevService iPqDevService;
|
||||||
|
private final IPqDevSubService iPqDevSubService;
|
||||||
private final IPqScriptDtlsService scriptDtlsService;
|
private final IPqScriptDtlsService scriptDtlsService;
|
||||||
private final IPqScriptDtlsService pqScriptDtlsService;
|
private final IPqScriptDtlsService pqScriptDtlsService;
|
||||||
private final DetectionServiceImpl detectionServiceImpl;
|
private final DetectionServiceImpl detectionServiceImpl;
|
||||||
@@ -90,15 +83,13 @@ public class SocketDevResponseService {
|
|||||||
private final ISysRegResService iSysRegResService;
|
private final ISysRegResService iSysRegResService;
|
||||||
private final IPqScriptCheckDataService iPqScriptCheckDataService;
|
private final IPqScriptCheckDataService iPqScriptCheckDataService;
|
||||||
private final ISysTestConfigService sysTestConfigService;
|
private final ISysTestConfigService sysTestConfigService;
|
||||||
private final AdHarmonicService adHarmonicService;
|
private final SimAndDigHarmonicService adHarmonicService;
|
||||||
private final IAdPlanService adPlanService;
|
private final IAdPlanService adPlanService;
|
||||||
private final IPqScriptCheckDataService pqScriptCheckDataService;
|
private final IPqScriptCheckDataService pqScriptCheckDataService;
|
||||||
private final IDictDataService dictDataService;
|
private final IDictDataService dictDataService;
|
||||||
@Value("${phaseAngle.isEnable}")
|
@Value("${phaseAngle.isEnable}")
|
||||||
private Boolean isPhaseAngle;
|
private Boolean isPhaseAngle;
|
||||||
|
|
||||||
// private final ExecutorService executorPool = Executors.newFixedThreadPool(10);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 存储的装置相序数据
|
* 存储的装置相序数据
|
||||||
@@ -131,7 +122,7 @@ public class SocketDevResponseService {
|
|||||||
//标识当前检测小项是否结束
|
//标识当前检测小项是否结束
|
||||||
public void deal(PreDetectionParam param, String msg) throws Exception {
|
public void deal(PreDetectionParam param, String msg) throws Exception {
|
||||||
SocketDataMsg socketDataMsg = MsgUtil.socketDataMsg(msg);
|
SocketDataMsg socketDataMsg = MsgUtil.socketDataMsg(msg);
|
||||||
String[] tem = socketDataMsg.getRequestId().split(stepTag);
|
String[] tem = socketDataMsg.getRequestId().split(CnSocketUtil.STEP_TAG);
|
||||||
SourceOperateCodeEnum sourceOperateCodeEnum = SourceOperateCodeEnum.getDictDataEnumByCode(tem[0]);
|
SourceOperateCodeEnum sourceOperateCodeEnum = SourceOperateCodeEnum.getDictDataEnumByCode(tem[0]);
|
||||||
|
|
||||||
switch (Objects.requireNonNull(sourceOperateCodeEnum)) {
|
switch (Objects.requireNonNull(sourceOperateCodeEnum)) {
|
||||||
@@ -161,12 +152,12 @@ public class SocketDevResponseService {
|
|||||||
SourceResponseCodeEnum dictDataEnumByCode = SourceResponseCodeEnum.getDictDataEnumByCode(socketDataMsg.getCode());
|
SourceResponseCodeEnum dictDataEnumByCode = SourceResponseCodeEnum.getDictDataEnumByCode(socketDataMsg.getCode());
|
||||||
switch (Objects.requireNonNull(dictDataEnumByCode)) {
|
switch (Objects.requireNonNull(dictDataEnumByCode)) {
|
||||||
case SUCCESS:
|
case SUCCESS:
|
||||||
SocketManager.removeUser(param.getUserPageId() + handlerStr);
|
SocketManager.removeUser(param.getUserPageId() + CnSocketUtil.DEV_TAG);
|
||||||
break;
|
break;
|
||||||
case UNPROCESSED_BUSINESS:
|
case UNPROCESSED_BUSINESS:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
SocketManager.removeUser(param.getUserPageId() + handlerStr);
|
SocketManager.removeUser(param.getUserPageId() + CnSocketUtil.DEV_TAG);
|
||||||
System.out.println(socketDataMsg);
|
System.out.println(socketDataMsg);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -204,7 +195,7 @@ public class SocketDevResponseService {
|
|||||||
xiSocket.setRequestId(SourceOperateCodeEnum.Coefficient_Check.getValue());
|
xiSocket.setRequestId(SourceOperateCodeEnum.Coefficient_Check.getValue());
|
||||||
xiSocket.setOperateCode(SourceOperateCodeEnum.OPER_GATHER.getValue());
|
xiSocket.setOperateCode(SourceOperateCodeEnum.OPER_GATHER.getValue());
|
||||||
xiSocket.setData(JSON.toJSONString(XiNumberManager.xiSourceIssueList.get(0)));
|
xiSocket.setData(JSON.toJSONString(XiNumberManager.xiSourceIssueList.get(0)));
|
||||||
SocketManager.sendMsg(param.getUserPageId() + handlerSourceStr, JSON.toJSONString(xiSocket));
|
SocketManager.sendMsg(param.getUserPageId() + CnSocketUtil.SOURCE_TAG, JSON.toJSONString(xiSocket));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -234,7 +225,7 @@ public class SocketDevResponseService {
|
|||||||
if (CollUtil.isNotEmpty(XiNumberManager.devXiList)) {
|
if (CollUtil.isNotEmpty(XiNumberManager.devXiList)) {
|
||||||
xiSocket.setOperateCode(SourceOperateCodeEnum.DATA_CHNFACTOR$02.getValue());
|
xiSocket.setOperateCode(SourceOperateCodeEnum.DATA_CHNFACTOR$02.getValue());
|
||||||
xiSocket.setData(JSON.toJSONString(XiNumberManager.devXiNumDataMap.get(XiNumberManager.devXiList.get(0))));
|
xiSocket.setData(JSON.toJSONString(XiNumberManager.devXiNumDataMap.get(XiNumberManager.devXiList.get(0))));
|
||||||
SocketManager.sendMsg(param.getUserPageId() + handlerStr, JSON.toJSONString(xiSocket));
|
SocketManager.sendMsg(param.getUserPageId() + CnSocketUtil.DEV_TAG, JSON.toJSONString(xiSocket));
|
||||||
} else {
|
} else {
|
||||||
if (XiNumberManager.stepNumber == 0) {
|
if (XiNumberManager.stepNumber == 0) {
|
||||||
//为空则认为所有装置都已经下发,开始进行小电压的申请,步骤进行+1
|
//为空则认为所有装置都已经下发,开始进行小电压的申请,步骤进行+1
|
||||||
@@ -245,7 +236,7 @@ public class SocketDevResponseService {
|
|||||||
System.out.println("第一步结束开始配置小电压电流参数下发给源----------------------");
|
System.out.println("第一步结束开始配置小电压电流参数下发给源----------------------");
|
||||||
xiSocket.setOperateCode(SourceOperateCodeEnum.OPER_GATHER.getValue());
|
xiSocket.setOperateCode(SourceOperateCodeEnum.OPER_GATHER.getValue());
|
||||||
xiSocket.setData(JSON.toJSONString(XiNumberManager.xiSourceIssueList.get(1)));
|
xiSocket.setData(JSON.toJSONString(XiNumberManager.xiSourceIssueList.get(1)));
|
||||||
SocketManager.sendMsg(param.getUserPageId() + handlerSourceStr, JSON.toJSONString(xiSocket));
|
SocketManager.sendMsg(param.getUserPageId() + CnSocketUtil.SOURCE_TAG, JSON.toJSONString(xiSocket));
|
||||||
} else if (XiNumberManager.stepNumber == 1) {
|
} else if (XiNumberManager.stepNumber == 1) {
|
||||||
//小电流系数下发完毕;开始重新测试一次大电压
|
//小电流系数下发完毕;开始重新测试一次大电压
|
||||||
sendWebSocket(param.getUserPageId(), SourceOperateCodeEnum.Coefficient_Check.getValue(), SourceOperateCodeEnum.small_end.getValue(), XiNumberManager.devParameterList.get(0));
|
sendWebSocket(param.getUserPageId(), SourceOperateCodeEnum.Coefficient_Check.getValue(), SourceOperateCodeEnum.small_end.getValue(), XiNumberManager.devParameterList.get(0));
|
||||||
@@ -253,7 +244,7 @@ public class SocketDevResponseService {
|
|||||||
|
|
||||||
xiSocket.setOperateCode(SourceOperateCodeEnum.OPER_GATHER.getValue());
|
xiSocket.setOperateCode(SourceOperateCodeEnum.OPER_GATHER.getValue());
|
||||||
xiSocket.setData(JSON.toJSONString(XiNumberManager.xiSourceIssueList.get(0)));
|
xiSocket.setData(JSON.toJSONString(XiNumberManager.xiSourceIssueList.get(0)));
|
||||||
SocketManager.sendMsg(param.getUserPageId() + handlerSourceStr, JSON.toJSONString(xiSocket));
|
SocketManager.sendMsg(param.getUserPageId() + CnSocketUtil.SOURCE_TAG, JSON.toJSONString(xiSocket));
|
||||||
XiNumberManager.stepNumber = 2;
|
XiNumberManager.stepNumber = 2;
|
||||||
}
|
}
|
||||||
FormalTestManager.realDataXiList.clear();
|
FormalTestManager.realDataXiList.clear();
|
||||||
@@ -326,7 +317,7 @@ public class SocketDevResponseService {
|
|||||||
|
|
||||||
private void processData(PreDetectionParam param, SocketMsg<String> xiSocket) {
|
private void processData(PreDetectionParam param, SocketMsg<String> xiSocket) {
|
||||||
System.out.println(XiNumberManager.stepNumber + "从装置中已经完成获取测试数据,准备开始计算----------------------");
|
System.out.println(XiNumberManager.stepNumber + "从装置中已经完成获取测试数据,准备开始计算----------------------");
|
||||||
Map<String, List<DevData>> realDataXiMap = FormalTestManager.realDataXiList.stream().collect(Collectors.groupingBy(it -> it.getId().split(splitTag)[0]));
|
Map<String, List<DevData>> realDataXiMap = FormalTestManager.realDataXiList.stream().collect(Collectors.groupingBy(it -> it.getId().split(CnSocketUtil.SPLIT_TAG)[0]));
|
||||||
realDataXiMap.forEach((devIp, dataList) -> processDeviceData(devIp, dataList, param));
|
realDataXiMap.forEach((devIp, dataList) -> processDeviceData(devIp, dataList, param));
|
||||||
|
|
||||||
handleStep(XiNumberManager.stepNumber, param, xiSocket);
|
handleStep(XiNumberManager.stepNumber, param, xiSocket);
|
||||||
@@ -357,7 +348,7 @@ public class SocketDevResponseService {
|
|||||||
xiSocket.setRequestId(SourceOperateCodeEnum.Coefficient_Check.getValue());
|
xiSocket.setRequestId(SourceOperateCodeEnum.Coefficient_Check.getValue());
|
||||||
xiSocket.setOperateCode(SourceOperateCodeEnum.DATA_CHNFACTOR$02.getValue());
|
xiSocket.setOperateCode(SourceOperateCodeEnum.DATA_CHNFACTOR$02.getValue());
|
||||||
xiSocket.setData(JSON.toJSONString(XiNumberManager.devXiNumDataMap.get(XiNumberManager.devXiList.get(0))));
|
xiSocket.setData(JSON.toJSONString(XiNumberManager.devXiNumDataMap.get(XiNumberManager.devXiList.get(0))));
|
||||||
SocketManager.sendMsg(param.getUserPageId() + handlerStr, JSON.toJSONString(xiSocket));
|
SocketManager.sendMsg(param.getUserPageId() + CnSocketUtil.DEV_TAG, JSON.toJSONString(xiSocket));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleSmallVoltageStep(PreDetectionParam param, SocketMsg<String> xiSocket) {
|
private void handleSmallVoltageStep(PreDetectionParam param, SocketMsg<String> xiSocket) {
|
||||||
@@ -374,7 +365,7 @@ public class SocketDevResponseService {
|
|||||||
if (CollUtil.isNotEmpty(XiNumberManager.devXiList)) {
|
if (CollUtil.isNotEmpty(XiNumberManager.devXiList)) {
|
||||||
xiSocket.setOperateCode(SourceOperateCodeEnum.DATA_CHNFACTOR$02.getValue());
|
xiSocket.setOperateCode(SourceOperateCodeEnum.DATA_CHNFACTOR$02.getValue());
|
||||||
xiSocket.setData(JSON.toJSONString(XiNumberManager.devXiNumDataMap.get(XiNumberManager.devXiList.get(0))));
|
xiSocket.setData(JSON.toJSONString(XiNumberManager.devXiNumDataMap.get(XiNumberManager.devXiList.get(0))));
|
||||||
SocketManager.sendMsg(param.getUserPageId() + handlerStr, JSON.toJSONString(xiSocket));
|
SocketManager.sendMsg(param.getUserPageId() + CnSocketUtil.DEV_TAG, JSON.toJSONString(xiSocket));
|
||||||
} else {
|
} else {
|
||||||
//存在小电压系数在误差范围内情况,直接结束。
|
//存在小电压系数在误差范围内情况,直接结束。
|
||||||
sendWebSocket(param.getUserPageId(), SourceOperateCodeEnum.Coefficient_Check.getValue(), SourceOperateCodeEnum.small_end.getValue(), XiNumberManager.devParameterList.get(1));
|
sendWebSocket(param.getUserPageId(), SourceOperateCodeEnum.Coefficient_Check.getValue(), SourceOperateCodeEnum.small_end.getValue(), XiNumberManager.devParameterList.get(1));
|
||||||
@@ -382,7 +373,7 @@ public class SocketDevResponseService {
|
|||||||
//小电流系数下发完毕;开始重新测试一次大电压
|
//小电流系数下发完毕;开始重新测试一次大电压
|
||||||
xiSocket.setOperateCode(SourceOperateCodeEnum.OPER_GATHER.getValue());
|
xiSocket.setOperateCode(SourceOperateCodeEnum.OPER_GATHER.getValue());
|
||||||
xiSocket.setData(JSON.toJSONString(XiNumberManager.xiSourceIssueList.get(0)));
|
xiSocket.setData(JSON.toJSONString(XiNumberManager.xiSourceIssueList.get(0)));
|
||||||
SocketManager.sendMsg(param.getUserPageId() + handlerSourceStr, JSON.toJSONString(xiSocket));
|
SocketManager.sendMsg(param.getUserPageId() + CnSocketUtil.SOURCE_TAG, JSON.toJSONString(xiSocket));
|
||||||
XiNumberManager.stepNumber = 2;
|
XiNumberManager.stepNumber = 2;
|
||||||
FormalTestManager.realDataXiList.clear();
|
FormalTestManager.realDataXiList.clear();
|
||||||
successComm.clear();
|
successComm.clear();
|
||||||
@@ -397,7 +388,7 @@ public class SocketDevResponseService {
|
|||||||
|
|
||||||
xiSocket.setOperateCode(SourceOperateCodeEnum.OPER_GATHER.getValue());
|
xiSocket.setOperateCode(SourceOperateCodeEnum.OPER_GATHER.getValue());
|
||||||
xiSocket.setData(JSON.toJSONString(XiNumberManager.xiSourceIssueList.get(1)));
|
xiSocket.setData(JSON.toJSONString(XiNumberManager.xiSourceIssueList.get(1)));
|
||||||
SocketManager.sendMsg(param.getUserPageId() + handlerSourceStr, JSON.toJSONString(xiSocket));
|
SocketManager.sendMsg(param.getUserPageId() + CnSocketUtil.SOURCE_TAG, JSON.toJSONString(xiSocket));
|
||||||
XiNumberManager.stepNumber = 3;
|
XiNumberManager.stepNumber = 3;
|
||||||
FormalTestManager.realDataXiList.clear();
|
FormalTestManager.realDataXiList.clear();
|
||||||
successComm.clear();
|
successComm.clear();
|
||||||
@@ -460,12 +451,12 @@ public class SocketDevResponseService {
|
|||||||
SocketManager.initMap(sourceIssueMap);
|
SocketManager.initMap(sourceIssueMap);
|
||||||
|
|
||||||
socketMsg.setData(JSON.toJSONString(sourceIssues.get(0)));
|
socketMsg.setData(JSON.toJSONString(sourceIssues.get(0)));
|
||||||
socketMsg.setRequestId(SourceOperateCodeEnum.FORMAL_REAL.getValue() + stepTag + sourceIssues.get(0).getType());
|
socketMsg.setRequestId(SourceOperateCodeEnum.FORMAL_REAL.getValue() + CnSocketUtil.STEP_TAG + sourceIssues.get(0).getType());
|
||||||
SocketManager.sendMsg(param.getUserPageId() + handlerSourceStr, JSON.toJSONString(socketMsg));
|
SocketManager.sendMsg(param.getUserPageId() + CnSocketUtil.SOURCE_TAG, JSON.toJSONString(socketMsg));
|
||||||
|
|
||||||
//告诉前端当前项开始了
|
//告诉前端当前项开始了
|
||||||
WebSocketVO<Object> webSocketVO = new WebSocketVO<>();
|
WebSocketVO<Object> webSocketVO = new WebSocketVO<>();
|
||||||
webSocketVO.setRequestId(sourceIssues.get(0).getType() + stepBegin);
|
webSocketVO.setRequestId(sourceIssues.get(0).getType() + CnSocketUtil.START_TAG);
|
||||||
webSocketVO.setDesc(null);
|
webSocketVO.setDesc(null);
|
||||||
WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(webSocketVO));
|
WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(webSocketVO));
|
||||||
} else {
|
} else {
|
||||||
@@ -474,14 +465,14 @@ public class SocketDevResponseService {
|
|||||||
//修改设备表Factor_Check_Result字段
|
//修改设备表Factor_Check_Result字段
|
||||||
XiNumberManager.devXiNumDataMap.forEach((key, val) -> {
|
XiNumberManager.devXiNumDataMap.forEach((key, val) -> {
|
||||||
DevXiNumData small = XiNumberManager.smallDevXiNumDataMap.get(key);
|
DevXiNumData small = XiNumberManager.smallDevXiNumDataMap.get(key);
|
||||||
LambdaUpdateWrapper<PqDev> updateWrapper = new LambdaUpdateWrapper<>();
|
LambdaUpdateWrapper<PqDevSub> updateWrapper = new LambdaUpdateWrapper<>();
|
||||||
updateWrapper.eq(PqDev::getId, FormalTestManager.devIdMapComm.get(key));
|
updateWrapper.eq(PqDevSub::getDevId, FormalTestManager.devIdMapComm.get(key));
|
||||||
if (val.getResultFlag() == 0 || small.getResultFlag() == 0) {
|
if (val.getResultFlag() == 0 || small.getResultFlag() == 0) {
|
||||||
updateWrapper.set(PqDev::getFactorCheckResult, 0);
|
updateWrapper.set(PqDevSub::getFactorCheckResult, 0);
|
||||||
} else {
|
} else {
|
||||||
updateWrapper.set(PqDev::getFactorCheckResult, 1);
|
updateWrapper.set(PqDevSub::getFactorCheckResult, 1);
|
||||||
}
|
}
|
||||||
iPqDevService.update(updateWrapper);
|
iPqDevSubService.update(updateWrapper);
|
||||||
updateWrapper.clear();
|
updateWrapper.clear();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -550,7 +541,7 @@ public class SocketDevResponseService {
|
|||||||
DevXiNumData.F F = new DevXiNumData.F();
|
DevXiNumData.F F = new DevXiNumData.F();
|
||||||
CoefficientVO.DevParameter devParameter = getDevParameter();
|
CoefficientVO.DevParameter devParameter = getDevParameter();
|
||||||
|
|
||||||
assemblyEntity(list, F, gfMap.get(Integer.parseInt(monitorId.split(splitTag)[1]) - 1), coefficientVO, devParameter);
|
assemblyEntity(list, F, gfMap.get(Integer.parseInt(monitorId.split(CnSocketUtil.SPLIT_TAG)[1]) - 1), coefficientVO, devParameter);
|
||||||
if (Objects.nonNull(coefficientVO.getResultFlag()) && coefficientVO.getResultFlag() == 0) {
|
if (Objects.nonNull(coefficientVO.getResultFlag()) && coefficientVO.getResultFlag() == 0) {
|
||||||
xiFlag.set(false);
|
xiFlag.set(false);
|
||||||
}
|
}
|
||||||
@@ -566,7 +557,7 @@ public class SocketDevResponseService {
|
|||||||
|
|
||||||
private CoefficientVO createCoefficientVO(String monitorId) {
|
private CoefficientVO createCoefficientVO(String monitorId) {
|
||||||
CoefficientVO coefficientVO = new CoefficientVO();
|
CoefficientVO coefficientVO = new CoefficientVO();
|
||||||
String[] splitStr = monitorId.split(splitTag);
|
String[] splitStr = monitorId.split(CnSocketUtil.SPLIT_TAG);
|
||||||
if (XiNumberManager.stepNumber == 0 || XiNumberManager.stepNumber == 2) {
|
if (XiNumberManager.stepNumber == 0 || XiNumberManager.stepNumber == 2) {
|
||||||
coefficientVO.setType("big");
|
coefficientVO.setType("big");
|
||||||
} else {
|
} else {
|
||||||
@@ -584,7 +575,7 @@ public class SocketDevResponseService {
|
|||||||
|
|
||||||
private DevXiNumData.GF createGFItem(String monitorId, DevXiNumData.F F) {
|
private DevXiNumData.GF createGFItem(String monitorId, DevXiNumData.F F) {
|
||||||
DevXiNumData.GF gfItem = new DevXiNumData.GF();
|
DevXiNumData.GF gfItem = new DevXiNumData.GF();
|
||||||
gfItem.setUMonitorPoint(Integer.parseInt(monitorId.split(splitTag)[1]) - 1);
|
gfItem.setUMonitorPoint(Integer.parseInt(monitorId.split(CnSocketUtil.SPLIT_TAG)[1]) - 1);
|
||||||
gfItem.setF(F);
|
gfItem.setF(F);
|
||||||
return gfItem;
|
return gfItem;
|
||||||
}
|
}
|
||||||
@@ -713,25 +704,24 @@ public class SocketDevResponseService {
|
|||||||
*/
|
*/
|
||||||
private void devComm(SocketDataMsg socketDataMsg, PreDetectionParam param, String msg) {
|
private void devComm(SocketDataMsg socketDataMsg, PreDetectionParam param, String msg) {
|
||||||
SourceResponseCodeEnum dictDataEnumByCode = SourceResponseCodeEnum.getDictDataEnumByCode(socketDataMsg.getCode());
|
SourceResponseCodeEnum dictDataEnumByCode = SourceResponseCodeEnum.getDictDataEnumByCode(socketDataMsg.getCode());
|
||||||
String s = param.getUserPageId() + handlerStr;
|
String s = param.getUserPageId() + CnSocketUtil.DEV_TAG;
|
||||||
SocketMsg<String> socketMsg = new SocketMsg<>();
|
SocketMsg<String> socketMsg = new SocketMsg<>();
|
||||||
switch (Objects.requireNonNull(dictDataEnumByCode)) {
|
switch (Objects.requireNonNull(dictDataEnumByCode)) {
|
||||||
case SUCCESS:
|
case SUCCESS:
|
||||||
String result = socketDataMsg.getData();
|
String result = socketDataMsg.getData();
|
||||||
successComm.add(result);
|
successComm.add(result);
|
||||||
//通讯校验成功
|
//单个测点通讯成功
|
||||||
if (!param.getOperateType().equals(SourceOperateCodeEnum.TEST_TEM_START.getValue())) {
|
WebServiceManager.sendMsg(param.getUserPageId(), MsgUtil.msgToWebData(socketDataMsg, FormalTestManager.devNameMapComm, 1));
|
||||||
WebServiceManager.sendMsg(param.getUserPageId(), MsgUtil.msgToWebData(socketDataMsg, FormalTestManager.devNameMapComm, 1));
|
|
||||||
}
|
|
||||||
System.out.println("设备通讯校验!" + successComm.size() + "=====" + FormalTestManager.monitorIdListComm.size());
|
System.out.println("设备通讯校验!" + successComm.size() + "=====" + FormalTestManager.monitorIdListComm.size());
|
||||||
if (successComm.size() == FormalTestManager.monitorIdListComm.size()) {
|
if (successComm.size() == FormalTestManager.monitorIdListComm.size()) {
|
||||||
if (!param.getOperateType().equals(SourceOperateCodeEnum.TEST_TEM_START.getValue())) {
|
// 通知前端整个装置通讯检测过程成功
|
||||||
SocketDataMsg temMsg = new SocketDataMsg();
|
SocketDataMsg temMsg = new SocketDataMsg();
|
||||||
temMsg.setCode(SourceResponseCodeEnum.DEV_COMM_ALL_SUCCESS.getCode());
|
temMsg.setCode(SourceResponseCodeEnum.DEV_COMM_ALL_SUCCESS.getCode());
|
||||||
temMsg.setOperateCode(SourceOperateCodeEnum.DEV_INIT_GATHER_01.getValue());
|
temMsg.setOperateCode(SourceOperateCodeEnum.DEV_INIT_GATHER_01.getValue());
|
||||||
temMsg.setRequestId(SourceOperateCodeEnum.YJC_SBTXJY.getValue());
|
temMsg.setRequestId(SourceOperateCodeEnum.YJC_SBTXJY.getValue());
|
||||||
WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(temMsg));
|
WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(temMsg));
|
||||||
}
|
|
||||||
//开始进行协议校验
|
//开始进行协议校验
|
||||||
successComm.clear();
|
successComm.clear();
|
||||||
failComm.clear();
|
failComm.clear();
|
||||||
@@ -800,7 +790,7 @@ public class SocketDevResponseService {
|
|||||||
private void protocolDeal(SocketDataMsg socketDataMsg, PreDetectionParam param, String msg) {
|
private void protocolDeal(SocketDataMsg socketDataMsg, PreDetectionParam param, String msg) {
|
||||||
SourceResponseCodeEnum dictDataEnumByCode = SourceResponseCodeEnum.getDictDataEnumByCode(socketDataMsg.getCode());
|
SourceResponseCodeEnum dictDataEnumByCode = SourceResponseCodeEnum.getDictDataEnumByCode(socketDataMsg.getCode());
|
||||||
SocketMsg<String> socketMsg = new SocketMsg<>();
|
SocketMsg<String> socketMsg = new SocketMsg<>();
|
||||||
String s = param.getUserPageId() + handlerStr;
|
String s = param.getUserPageId() + CnSocketUtil.DEV_TAG;
|
||||||
switch (Objects.requireNonNull(dictDataEnumByCode)) {
|
switch (Objects.requireNonNull(dictDataEnumByCode)) {
|
||||||
case SUCCESS:
|
case SUCCESS:
|
||||||
|
|
||||||
@@ -904,7 +894,7 @@ public class SocketDevResponseService {
|
|||||||
sourceIssues = pqScriptDtlsService.listSourceIssue(issueParam);
|
sourceIssues = pqScriptDtlsService.listSourceIssue(issueParam);
|
||||||
socketMsg.setRequestId(SourceOperateCodeEnum.YJC_XUJY.getValue());
|
socketMsg.setRequestId(SourceOperateCodeEnum.YJC_XUJY.getValue());
|
||||||
socketMsg.setData(JSON.toJSONString(sourceIssues.get(0)));
|
socketMsg.setData(JSON.toJSONString(sourceIssues.get(0)));
|
||||||
SocketManager.sendMsg(param.getUserPageId() + handlerSourceStr, JSON.toJSONString(socketMsg));
|
SocketManager.sendMsg(param.getUserPageId() + CnSocketUtil.SOURCE_TAG, JSON.toJSONString(socketMsg));
|
||||||
} else if (param.getTestItemList().get(2)) {
|
} else if (param.getTestItemList().get(2)) {
|
||||||
// 后续做正式检测
|
// 后续做正式检测
|
||||||
if (param.getOperateType().equals(SourceOperateCodeEnum.RE_ERROR_TEST.getValue())) {
|
if (param.getOperateType().equals(SourceOperateCodeEnum.RE_ERROR_TEST.getValue())) {
|
||||||
@@ -944,12 +934,12 @@ public class SocketDevResponseService {
|
|||||||
SocketManager.initMap(sourceIssueMap);
|
SocketManager.initMap(sourceIssueMap);
|
||||||
|
|
||||||
socketMsg.setData(JSON.toJSONString(sourceIssues.get(0)));
|
socketMsg.setData(JSON.toJSONString(sourceIssues.get(0)));
|
||||||
socketMsg.setRequestId(SourceOperateCodeEnum.FORMAL_REAL.getValue() + stepTag + sourceIssues.get(0).getType());
|
socketMsg.setRequestId(SourceOperateCodeEnum.FORMAL_REAL.getValue() + CnSocketUtil.STEP_TAG + sourceIssues.get(0).getType());
|
||||||
SocketManager.sendMsg(param.getUserPageId() + handlerSourceStr, JSON.toJSONString(socketMsg));
|
SocketManager.sendMsg(param.getUserPageId() + CnSocketUtil.SOURCE_TAG, JSON.toJSONString(socketMsg));
|
||||||
|
|
||||||
//告诉前端当前项开始了
|
//告诉前端当前项开始了
|
||||||
WebSocketVO<Object> webSocketVO = new WebSocketVO<>();
|
WebSocketVO<Object> webSocketVO = new WebSocketVO<>();
|
||||||
webSocketVO.setRequestId(sourceIssues.get(0).getType() + stepBegin);
|
webSocketVO.setRequestId(sourceIssues.get(0).getType() + CnSocketUtil.START_TAG);
|
||||||
webSocketVO.setDesc(null);
|
webSocketVO.setDesc(null);
|
||||||
WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(webSocketVO));
|
WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(webSocketVO));
|
||||||
}
|
}
|
||||||
@@ -958,10 +948,10 @@ public class SocketDevResponseService {
|
|||||||
// System.out.println("进入暂停后的继续检测》》》》》》》》》》》》》》》》》》》》》》》》》》》" + "剩余检测小项" + SocketManager.getSourceList().size());
|
// System.out.println("进入暂停后的继续检测》》》》》》》》》》》》》》》》》》》》》》》》》》》" + "剩余检测小项" + SocketManager.getSourceList().size());
|
||||||
// if (CollUtil.isNotEmpty(SocketManager.getSourceList())) {
|
// if (CollUtil.isNotEmpty(SocketManager.getSourceList())) {
|
||||||
// SourceIssue sourceIssue = SocketManager.getSourceList().get(0);
|
// SourceIssue sourceIssue = SocketManager.getSourceList().get(0);
|
||||||
// socketMsg.setRequestId(SourceOperateCodeEnum.FORMAL_REAL.getValue() + stepTag + sourceIssue.getType());
|
// socketMsg.setRequestId(SourceOperateCodeEnum.FORMAL_REAL.getValue() + CnSocketUtil.STEP_TAG + sourceIssue.getType());
|
||||||
// socketMsg.setOperateCode(SourceOperateCodeEnum.OPER_GATHER.getValue());
|
// socketMsg.setOperateCode(SourceOperateCodeEnum.OPER_GATHER.getValue());
|
||||||
// socketMsg.setData(JSON.toJSONString(sourceIssue));
|
// socketMsg.setData(JSON.toJSONString(sourceIssue));
|
||||||
// SocketManager.sendMsg(param.getUserPageId() + handlerSourceStr, JSON.toJSONString(socketMsg));
|
// SocketManager.sendMsg(param.getUserPageId() + CnSocketUtil.SOURCE_TAG, JSON.toJSONString(socketMsg));
|
||||||
// }
|
// }
|
||||||
// } else {
|
// } else {
|
||||||
//
|
//
|
||||||
@@ -1018,7 +1008,7 @@ public class SocketDevResponseService {
|
|||||||
* @param list
|
* @param list
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private Integer getErrorType(String desc, DevData.SqlDataDTO.ListDTO list) {
|
public static Integer getErrorType(String desc, DevData.SqlDataDTO.ListDTO list) {
|
||||||
if (ObjectUtil.isNotNull(list)) {
|
if (ObjectUtil.isNotNull(list)) {
|
||||||
if (DetectionCodeEnum.MAG.getCode().equals(desc) || DetectionCodeEnum.DUR.getCode().equals(desc)) {
|
if (DetectionCodeEnum.MAG.getCode().equals(desc) || DetectionCodeEnum.DUR.getCode().equals(desc)) {
|
||||||
if (ObjectUtil.isNull(list.getA()) && ObjectUtil.isNull(list.getB()) && ObjectUtil.isNull(list.getC()) && ObjectUtil.isNull(list.getT())) {
|
if (ObjectUtil.isNull(list.getA()) && ObjectUtil.isNull(list.getB()) && ObjectUtil.isNull(list.getC()) && ObjectUtil.isNull(list.getT())) {
|
||||||
@@ -1077,7 +1067,7 @@ public class SocketDevResponseService {
|
|||||||
dataMsg.setCode(SourceResponseCodeEnum.SUCCESS.getCode());
|
dataMsg.setCode(SourceResponseCodeEnum.SUCCESS.getCode());
|
||||||
|
|
||||||
for (SourceCompareDev sourceCompareDev : info) {
|
for (SourceCompareDev sourceCompareDev : info) {
|
||||||
dataMsg.setData(sourceCompareDev.getDevName() + splitTag + sourceCompareDev.getLineNum() + "校验结果:" + sourceCompareDev.getDesc());
|
dataMsg.setData(sourceCompareDev.getDevName() + CnSocketUtil.SPLIT_TAG + sourceCompareDev.getLineNum() + "校验结果:" + sourceCompareDev.getDesc());
|
||||||
WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(dataMsg));
|
WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(dataMsg));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1120,7 +1110,7 @@ public class SocketDevResponseService {
|
|||||||
map.put("devIP", preDetection.getDevIP());
|
map.put("devIP", preDetection.getDevIP());
|
||||||
map.put("chnNum", preDetection.getDevChns());
|
map.put("chnNum", preDetection.getDevChns());
|
||||||
socketMsg.setData(JSON.toJSONString(map));
|
socketMsg.setData(JSON.toJSONString(map));
|
||||||
SocketManager.sendMsg(param.getUserPageId() + handlerStr, JSON.toJSONString(socketMsg));
|
SocketManager.sendMsg(param.getUserPageId() + CnSocketUtil.DEV_TAG, JSON.toJSONString(socketMsg));
|
||||||
|
|
||||||
|
|
||||||
XiNumberManager.stepNumber = 0;
|
XiNumberManager.stepNumber = 0;
|
||||||
@@ -1174,13 +1164,13 @@ public class SocketDevResponseService {
|
|||||||
SocketManager.initMap(sourceIssueMap);
|
SocketManager.initMap(sourceIssueMap);
|
||||||
|
|
||||||
socketMsg.setData(JSON.toJSONString(sourceIssues.get(0)));
|
socketMsg.setData(JSON.toJSONString(sourceIssues.get(0)));
|
||||||
socketMsg.setRequestId(SourceOperateCodeEnum.FORMAL_REAL.getValue() + stepTag + sourceIssues.get(0).getType());
|
socketMsg.setRequestId(SourceOperateCodeEnum.FORMAL_REAL.getValue() + CnSocketUtil.STEP_TAG + sourceIssues.get(0).getType());
|
||||||
socketMsg.setOperateCode(SourceOperateCodeEnum.OPER_GATHER.getValue());
|
socketMsg.setOperateCode(SourceOperateCodeEnum.OPER_GATHER.getValue());
|
||||||
SocketManager.sendMsg(param.getUserPageId() + handlerSourceStr, JSON.toJSONString(socketMsg));
|
SocketManager.sendMsg(param.getUserPageId() + CnSocketUtil.SOURCE_TAG, JSON.toJSONString(socketMsg));
|
||||||
|
|
||||||
//告诉前端当前项开始了
|
//告诉前端当前项开始了
|
||||||
WebSocketVO<Object> webSocketVO = new WebSocketVO<>();
|
WebSocketVO<Object> webSocketVO = new WebSocketVO<>();
|
||||||
webSocketVO.setRequestId(sourceIssues.get(0).getType() + stepBegin);
|
webSocketVO.setRequestId(sourceIssues.get(0).getType() + CnSocketUtil.START_TAG);
|
||||||
webSocketVO.setDesc(null);
|
webSocketVO.setDesc(null);
|
||||||
WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(webSocketVO));
|
WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(webSocketVO));
|
||||||
} else {
|
} else {
|
||||||
@@ -1197,7 +1187,6 @@ public class SocketDevResponseService {
|
|||||||
case UNPROCESSED_BUSINESS:
|
case UNPROCESSED_BUSINESS:
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NORMAL_RESPONSE:
|
case NORMAL_RESPONSE:
|
||||||
if (devData.getResult()) {
|
if (devData.getResult()) {
|
||||||
devInfo.add(devData);
|
devInfo.add(devData);
|
||||||
@@ -1250,7 +1239,7 @@ public class SocketDevResponseService {
|
|||||||
|
|
||||||
//当成功的通道数量和检测通道数量相同时进入
|
//当成功的通道数量和检测通道数量相同时进入
|
||||||
if (successComm.size() == FormalTestManager.monitorIdListComm.size()) {
|
if (successComm.size() == FormalTestManager.monitorIdListComm.size()) {
|
||||||
System.out.println(sourceIssue.getType() + splitTag + sourceIssue.getIndex() + "当前测试小项读取数据已经全部结束。。。。。。。。。");
|
System.out.println(sourceIssue.getType() + CnSocketUtil.SPLIT_TAG + sourceIssue.getIndex() + "当前测试小项读取数据已经全部结束。。。。。。。。。");
|
||||||
//修改装置为监测中
|
//修改装置为监测中
|
||||||
// adPlanService.updateTestState(param.getPlanId(), param.getDevIds());
|
// adPlanService.updateTestState(param.getPlanId(), param.getDevIds());
|
||||||
//开启线程进行入库原始数据操作
|
//开启线程进行入库原始数据操作
|
||||||
@@ -1265,7 +1254,7 @@ public class SocketDevResponseService {
|
|||||||
|
|
||||||
//当小项结束后需要删除集合中的小项
|
//当小项结束后需要删除集合中的小项
|
||||||
SocketManager.delSource(sourceIssue.getIndex());
|
SocketManager.delSource(sourceIssue.getIndex());
|
||||||
System.out.println("当前小项结束进行删除============" + sourceIssue.getType() + splitTag + sourceIssue.getIndex());
|
System.out.println("当前小项结束进行删除============" + sourceIssue.getType() + CnSocketUtil.SPLIT_TAG + sourceIssue.getIndex());
|
||||||
|
|
||||||
//小项检测完后小项数减一,并更新map
|
//小项检测完后小项数减一,并更新map
|
||||||
long residueCount = SocketManager.getSourceTarget(sourceIssue.getType()) - 1;
|
long residueCount = SocketManager.getSourceTarget(sourceIssue.getType()) - 1;
|
||||||
@@ -1293,7 +1282,7 @@ public class SocketDevResponseService {
|
|||||||
resultList.add(devTem);
|
resultList.add(devTem);
|
||||||
});
|
});
|
||||||
allDevTestList.clear();
|
allDevTestList.clear();
|
||||||
CnSocketUtil.sendToWebSocket(param.getUserPageId(), socketDataMsg.getRequestId().split(stepTag)[1] + stepEnd, null, resultList, null);
|
CnSocketUtil.sendToWebSocket(param.getUserPageId(), socketDataMsg.getRequestId().split(CnSocketUtil.STEP_TAG)[1] + CnSocketUtil.END_TAG, null, resultList, null);
|
||||||
}
|
}
|
||||||
//在这一步判断是否已经触发暂停按钮
|
//在这一步判断是否已经触发暂停按钮
|
||||||
if (FormalTestManager.stopFlag && CollUtil.isNotEmpty(SocketManager.getSourceList())) {
|
if (FormalTestManager.stopFlag && CollUtil.isNotEmpty(SocketManager.getSourceList())) {
|
||||||
@@ -1311,15 +1300,15 @@ public class SocketDevResponseService {
|
|||||||
SourceIssue sourceIssues = SocketManager.getSourceList().get(0);
|
SourceIssue sourceIssues = SocketManager.getSourceList().get(0);
|
||||||
// 如果上一个大项检测完成,则检测下一个大项,并向前端推送消息
|
// 如果上一个大项检测完成,则检测下一个大项,并向前端推送消息
|
||||||
if (residueCount == 0) {
|
if (residueCount == 0) {
|
||||||
CnSocketUtil.sendToWebSocket(param.getUserPageId(), sourceIssues.getType() + stepBegin, null, new ArrayList<>(), null);
|
CnSocketUtil.sendToWebSocket(param.getUserPageId(), sourceIssues.getType() + CnSocketUtil.START_TAG, null, new ArrayList<>(), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
//控源下发下一个小项脚本
|
//控源下发下一个小项脚本
|
||||||
SocketMsg<String> xuMsg = new SocketMsg<>();
|
SocketMsg<String> xuMsg = new SocketMsg<>();
|
||||||
xuMsg.setOperateCode(SourceOperateCodeEnum.OPER_GATHER.getValue());
|
xuMsg.setOperateCode(SourceOperateCodeEnum.OPER_GATHER.getValue());
|
||||||
xuMsg.setData(JSON.toJSONString(sourceIssues));
|
xuMsg.setData(JSON.toJSONString(sourceIssues));
|
||||||
xuMsg.setRequestId(SourceOperateCodeEnum.FORMAL_REAL.getValue() + stepTag + sourceIssues.getType());
|
xuMsg.setRequestId(SourceOperateCodeEnum.FORMAL_REAL.getValue() + CnSocketUtil.STEP_TAG + sourceIssues.getType());
|
||||||
SocketManager.sendMsg(param.getUserPageId() + handlerSourceStr, JSON.toJSONString(xuMsg));
|
SocketManager.sendMsg(param.getUserPageId() + CnSocketUtil.SOURCE_TAG, JSON.toJSONString(xuMsg));
|
||||||
} else {
|
} else {
|
||||||
//TODO 是否最终检测完成需要推送给用户
|
//TODO 是否最终检测完成需要推送给用户
|
||||||
PqScriptCheckDataParam checkDataParam = new PqScriptCheckDataParam();
|
PqScriptCheckDataParam checkDataParam = new PqScriptCheckDataParam();
|
||||||
@@ -1381,7 +1370,7 @@ public class SocketDevResponseService {
|
|||||||
List<Integer> resultFlagList = new ArrayList<>();
|
List<Integer> resultFlagList = new ArrayList<>();
|
||||||
List<PreDetection.MonitorListDTO> monitorListDTOList = dev.getMonitorList();
|
List<PreDetection.MonitorListDTO> monitorListDTOList = dev.getMonitorList();
|
||||||
for (PreDetection.MonitorListDTO point : monitorListDTOList) {
|
for (PreDetection.MonitorListDTO point : monitorListDTOList) {
|
||||||
Integer resultFlag = textResult.get(dev.getDevIP() + splitTag + point.getLine());
|
Integer resultFlag = textResult.get(dev.getDevIP() + CnSocketUtil.SPLIT_TAG + point.getLine());
|
||||||
resultFlagList.add(resultFlag);
|
resultFlagList.add(resultFlag);
|
||||||
}
|
}
|
||||||
devLineTestResult.setChnResult(resultFlagList.toArray(new Integer[monitorListDTOList.size()]));
|
devLineTestResult.setChnResult(resultFlagList.toArray(new Integer[monitorListDTOList.size()]));
|
||||||
@@ -1396,7 +1385,7 @@ public class SocketDevResponseService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
WebSocketVO<List<DevLineTestResult>> webSocketVO = new WebSocketVO<>();
|
WebSocketVO<List<DevLineTestResult>> webSocketVO = new WebSocketVO<>();
|
||||||
webSocketVO.setRequestId(socketDataMsg.getRequestId().split(stepTag)[1] + stepEnd);
|
webSocketVO.setRequestId(socketDataMsg.getRequestId().split(CnSocketUtil.STEP_TAG)[1] + CnSocketUtil.END_TAG);
|
||||||
webSocketVO.setDesc(sourceIssue.getDesc());
|
webSocketVO.setDesc(sourceIssue.getDesc());
|
||||||
webSocketVO.setData(devListRes);
|
webSocketVO.setData(devListRes);
|
||||||
WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(webSocketVO));
|
WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(webSocketVO));
|
||||||
@@ -1455,7 +1444,7 @@ public class SocketDevResponseService {
|
|||||||
SourceResponseCodeEnum dictDataEnumByCode = SourceResponseCodeEnum.getDictDataEnumByCode(socketDataMsg.getCode());
|
SourceResponseCodeEnum dictDataEnumByCode = SourceResponseCodeEnum.getDictDataEnumByCode(socketDataMsg.getCode());
|
||||||
SourceOperateCodeEnum operateCodeEnum = SourceOperateCodeEnum.getDictDataEnumByCode(socketDataMsg.getOperateCode());
|
SourceOperateCodeEnum operateCodeEnum = SourceOperateCodeEnum.getDictDataEnumByCode(socketDataMsg.getOperateCode());
|
||||||
SocketMsg<String> socketMsg = new SocketMsg<>();
|
SocketMsg<String> socketMsg = new SocketMsg<>();
|
||||||
String s = param.getUserPageId() + handlerStr;
|
String s = param.getUserPageId() + CnSocketUtil.DEV_TAG;
|
||||||
|
|
||||||
switch (Objects.requireNonNull(dictDataEnumByCode)) {
|
switch (Objects.requireNonNull(dictDataEnumByCode)) {
|
||||||
case SUCCESS:
|
case SUCCESS:
|
||||||
@@ -1486,7 +1475,7 @@ public class SocketDevResponseService {
|
|||||||
switch (operateCodeEnum) {
|
switch (operateCodeEnum) {
|
||||||
case QUIT_INIT_01:
|
case QUIT_INIT_01:
|
||||||
SocketManager.removeUser(s);
|
SocketManager.removeUser(s);
|
||||||
CnSocketUtil.quitSendSource(param);
|
// CnSocketUtil.quitSendSource(param);
|
||||||
break;
|
break;
|
||||||
case QUIT_INIT_02:
|
case QUIT_INIT_02:
|
||||||
socketMsg.setRequestId(SourceOperateCodeEnum.QUITE.getValue());
|
socketMsg.setRequestId(SourceOperateCodeEnum.QUITE.getValue());
|
||||||
@@ -1593,7 +1582,7 @@ public class SocketDevResponseService {
|
|||||||
List<DevData.SqlDataDTO> dataV = sqlData.stream().filter(x -> type.get(0).equals(x.getDesc())).collect(Collectors.toList());
|
List<DevData.SqlDataDTO> dataV = sqlData.stream().filter(x -> type.get(0).equals(x.getDesc())).collect(Collectors.toList());
|
||||||
List<DevData.SqlDataDTO> dataVPhase = sqlData.stream().filter(x -> type.get(1).equals(x.getDesc())).collect(Collectors.toList());
|
List<DevData.SqlDataDTO> dataVPhase = sqlData.stream().filter(x -> type.get(1).equals(x.getDesc())).collect(Collectors.toList());
|
||||||
SourceCompareDev compareDev = new SourceCompareDev();
|
SourceCompareDev compareDev = new SourceCompareDev();
|
||||||
String[] split = key.split(splitTag);
|
String[] split = key.split(CnSocketUtil.SPLIT_TAG);
|
||||||
String devName = null;
|
String devName = null;
|
||||||
if (FormalTestManager.devNameMapComm.containsKey(split[0])) {
|
if (FormalTestManager.devNameMapComm.containsKey(split[0])) {
|
||||||
devName = FormalTestManager.devNameMapComm.get(split[0]);
|
devName = FormalTestManager.devNameMapComm.get(split[0]);
|
||||||
@@ -1632,21 +1621,22 @@ public class SocketDevResponseService {
|
|||||||
Boolean c = getaBoolean(sourceMap.get(type + "c"), CollUtil.isNotEmpty(data) ? data.get(0).getList().getC() : null,
|
Boolean c = getaBoolean(sourceMap.get(type + "c"), CollUtil.isNotEmpty(data) ? data.get(0).getList().getC() : null,
|
||||||
CollUtil.isNotEmpty(dataPhase) ? dataPhase.get(0).getList().getC() : null);
|
CollUtil.isNotEmpty(dataPhase) ? dataPhase.get(0).getList().getC() : null);
|
||||||
compareDev.setIsQualified(a && b && c);
|
compareDev.setIsQualified(a && b && c);
|
||||||
compareDev.setDesc(name + (compareDev.getIsQualified() ? "合格->" : "不合格->") + stepTag + desc + stepTag + devMessage(type, data, dataPhase));
|
compareDev.setDesc(name + (compareDev.getIsQualified() ? "合格->" : "不合格->") + CnSocketUtil.STEP_TAG + desc + CnSocketUtil.STEP_TAG + devMessage(type, data, dataPhase));
|
||||||
return compareDev;
|
return compareDev;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 相须校验-从幅值、相角两个维度判断是否合格
|
* 相须校验-从幅值、相角两个维度判断是否合格
|
||||||
*
|
*
|
||||||
* @param channelListDTO
|
* @param channelListDTO 源下发的脚本
|
||||||
* @param devData
|
* @param devData 装置返回幅值数据
|
||||||
* @param devPhase
|
* @param devPhase 装置返回相角数据
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private Boolean getaBoolean(SourceIssue.ChannelListDTO channelListDTO, Double devData, Double devPhase) {
|
private Boolean getaBoolean(SourceIssue.ChannelListDTO channelListDTO, Double devData, Double devPhase) {
|
||||||
Boolean isDev = false;
|
Boolean isDev = false;
|
||||||
Boolean isPhase = false;
|
Boolean isPhase = false;
|
||||||
|
|
||||||
if (ObjectUtil.isNotNull(devData)) {
|
if (ObjectUtil.isNotNull(devData)) {
|
||||||
isDev = NumberUtil.isIn(BigDecimal.valueOf(devData),
|
isDev = NumberUtil.isIn(BigDecimal.valueOf(devData),
|
||||||
BigDecimal.valueOf(channelListDTO.getFAmp() * 0.95),
|
BigDecimal.valueOf(channelListDTO.getFAmp() * 0.95),
|
||||||
@@ -1672,26 +1662,10 @@ public class SocketDevResponseService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private Boolean phaseBoolean(SourceIssue.ChannelListDTO channelListDTO, Double devPhase) {
|
private Boolean phaseBoolean(SourceIssue.ChannelListDTO channelListDTO, Double devPhase) {
|
||||||
Double phase = devPhase;
|
devPhase = DetectionUtil.adjustPhase(devPhase);
|
||||||
if (devPhase < -180) {
|
|
||||||
phase = devPhase + 360;
|
|
||||||
}
|
|
||||||
if (devPhase > 180) {
|
|
||||||
phase = devPhase - 360;
|
|
||||||
}
|
|
||||||
|
|
||||||
Double fPhase = channelListDTO.getFPhase();
|
Double fPhase = channelListDTO.getFPhase();
|
||||||
if (fPhase < -180) {
|
fPhase = DetectionUtil.adjustPhase(fPhase);
|
||||||
fPhase = fPhase + 360;
|
return NumberUtil.isIn(BigDecimal.valueOf(devPhase), BigDecimal.valueOf(fPhase - 1), BigDecimal.valueOf(fPhase + 1));
|
||||||
}
|
|
||||||
if (fPhase > 180) {
|
|
||||||
fPhase = fPhase - 360;
|
|
||||||
}
|
|
||||||
return
|
|
||||||
NumberUtil.isIn(BigDecimal.valueOf(phase),
|
|
||||||
BigDecimal.valueOf(fPhase - 1),
|
|
||||||
BigDecimal.valueOf(fPhase + 1));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1817,19 +1791,19 @@ public class SocketDevResponseService {
|
|||||||
// Runnable runnable = () -> {
|
// Runnable runnable = () -> {
|
||||||
|
|
||||||
System.out.println("原始数据插入数据库开始执行=========================================");
|
System.out.println("原始数据插入数据库开始执行=========================================");
|
||||||
List<AdNonHarmonicResult> adNonHarmonicResultList = new ArrayList<>();
|
List<SimAndDigNonHarmonicResult> simAndDigNonHarmonicResultList = new ArrayList<>();
|
||||||
List<AdHarmonicResult> adHarmonicResultList = new ArrayList<>();
|
List<SimAndDigHarmonicResult> adHarmonicResultList = new ArrayList<>();
|
||||||
for (DevData data : devDataList) {
|
for (DevData data : devDataList) {
|
||||||
LocalDateTime localDateTime = timeFormat(data.getTime(), formatter);
|
LocalDateTime localDateTime = DetectionUtil.timeFormat(data.getTime(), formatter);
|
||||||
if (Objects.nonNull(localDateTime)) {
|
if (Objects.nonNull(localDateTime)) {
|
||||||
|
|
||||||
String[] splitArr = data.getId().split(splitTag);
|
String[] splitArr = data.getId().split(CnSocketUtil.SPLIT_TAG);
|
||||||
String temId = FormalTestManager.devIdMapComm.get(splitArr[0]) + splitTag + splitArr[1];
|
String temId = FormalTestManager.devIdMapComm.get(splitArr[0]) + CnSocketUtil.SPLIT_TAG + splitArr[1];
|
||||||
|
|
||||||
if (nonHarmonicList.contains(sourceIssue.getType())) {
|
if (nonHarmonicList.contains(sourceIssue.getType())) {
|
||||||
for (DevData.SqlDataDTO sqlDataDTO : data.getSqlData()) {
|
for (DevData.SqlDataDTO sqlDataDTO : data.getSqlData()) {
|
||||||
DevData.SqlDataDTO.ListDTO listDTO = sqlDataDTO.getList();
|
DevData.SqlDataDTO.ListDTO listDTO = sqlDataDTO.getList();
|
||||||
AdNonHarmonicResult adNonHarmonicResult = new AdNonHarmonicResult();
|
SimAndDigNonHarmonicResult adNonHarmonicResult = new SimAndDigNonHarmonicResult();
|
||||||
adNonHarmonicResult.setTimeId(localDateTime);
|
adNonHarmonicResult.setTimeId(localDateTime);
|
||||||
adNonHarmonicResult.setMonitorId(temId);
|
adNonHarmonicResult.setMonitorId(temId);
|
||||||
adNonHarmonicResult.setScriptId(param.getScriptId());
|
adNonHarmonicResult.setScriptId(param.getScriptId());
|
||||||
@@ -1854,14 +1828,14 @@ public class SocketDevResponseService {
|
|||||||
if (Objects.nonNull(d)) {
|
if (Objects.nonNull(d)) {
|
||||||
adNonHarmonicResult.setTValue(String.format("%.7f", d));
|
adNonHarmonicResult.setTValue(String.format("%.7f", d));
|
||||||
}
|
}
|
||||||
adNonHarmonicResultList.add(adNonHarmonicResult);
|
simAndDigNonHarmonicResultList.add(adNonHarmonicResult);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
for (int j = 0; j < data.getSqlDataHarm().size(); j++) {
|
for (int j = 0; j < data.getSqlDataHarm().size(); j++) {
|
||||||
DevData.SqlDataHarmDTO sqlDataDTO = data.getSqlDataHarm().get(j);
|
DevData.SqlDataHarmDTO sqlDataDTO = data.getSqlDataHarm().get(j);
|
||||||
String dui = harmonicRelationMap.get(sqlDataDTO.getDesc());
|
String dui = harmonicRelationMap.get(sqlDataDTO.getDesc());
|
||||||
AdHarmonicResult adHarmonicResult = new AdHarmonicResult();
|
SimAndDigHarmonicResult adHarmonicResult = new SimAndDigHarmonicResult();
|
||||||
adHarmonicResult.setTimeId(localDateTime);
|
adHarmonicResult.setTimeId(localDateTime);
|
||||||
|
|
||||||
adHarmonicResult.setMonitorId(temId);
|
adHarmonicResult.setMonitorId(temId);
|
||||||
@@ -1894,7 +1868,7 @@ public class SocketDevResponseService {
|
|||||||
List<String> b = tem.getB();
|
List<String> b = tem.getB();
|
||||||
List<String> c = tem.getC();
|
List<String> c = tem.getC();
|
||||||
|
|
||||||
Class<AdHarmonicResult> example = (Class<AdHarmonicResult>) adHarmonicResult.getClass();
|
Class<SimAndDigHarmonicResult> example = (Class<SimAndDigHarmonicResult>) adHarmonicResult.getClass();
|
||||||
if (DicDataEnum.HSV.getCode().equals(sourceIssue.getType()) || DicDataEnum.HSI.getCode().equals(sourceIssue.getType())) {
|
if (DicDataEnum.HSV.getCode().equals(sourceIssue.getType()) || DicDataEnum.HSI.getCode().equals(sourceIssue.getType())) {
|
||||||
for (int i = 1; i < a.size() + 1; i++) {
|
for (int i = 1; i < a.size() + 1; i++) {
|
||||||
try {
|
try {
|
||||||
@@ -1936,9 +1910,9 @@ public class SocketDevResponseService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CollUtil.isNotEmpty(adNonHarmonicResultList)) {
|
if (CollUtil.isNotEmpty(simAndDigNonHarmonicResultList)) {
|
||||||
Map<String, List<AdNonHarmonicResult>> map = adNonHarmonicResultList.stream().collect(Collectors.groupingBy(x -> x.getMonitorId() + x.getTimeId() + x.getScriptId() + x.getSort() + x.getAdType() + x.getDataType()));
|
Map<String, List<SimAndDigNonHarmonicResult>> map = simAndDigNonHarmonicResultList.stream().collect(Collectors.groupingBy(x -> x.getMonitorId() + x.getTimeId() + x.getScriptId() + x.getSort() + x.getAdType() + x.getDataType()));
|
||||||
List<AdNonHarmonicResult> info = new ArrayList<>();
|
List<SimAndDigNonHarmonicResult> info = new ArrayList<>();
|
||||||
map.forEach((key, value) -> {
|
map.forEach((key, value) -> {
|
||||||
if (value.size() > 1) {
|
if (value.size() > 1) {
|
||||||
System.err.println("重复时间戳->" + key + value);
|
System.err.println("重复时间戳->" + key + value);
|
||||||
@@ -1950,8 +1924,8 @@ public class SocketDevResponseService {
|
|||||||
detectionDataDealService.acceptAdNon(info, param.getCode());
|
detectionDataDealService.acceptAdNon(info, param.getCode());
|
||||||
}
|
}
|
||||||
if (CollUtil.isNotEmpty(adHarmonicResultList)) {
|
if (CollUtil.isNotEmpty(adHarmonicResultList)) {
|
||||||
Map<String, List<AdHarmonicResult>> map = adHarmonicResultList.stream().collect(Collectors.groupingBy(x -> x.getMonitorId() + x.getTimeId() + x.getScriptId() + x.getSort() + x.getAdType() + x.getDataType()));
|
Map<String, List<SimAndDigHarmonicResult>> map = adHarmonicResultList.stream().collect(Collectors.groupingBy(x -> x.getMonitorId() + x.getTimeId() + x.getScriptId() + x.getSort() + x.getAdType() + x.getDataType()));
|
||||||
List<AdHarmonicResult> info = new ArrayList<>();
|
List<SimAndDigHarmonicResult> info = new ArrayList<>();
|
||||||
map.forEach((key, value) -> {
|
map.forEach((key, value) -> {
|
||||||
if (value.size() > 1) {
|
if (value.size() > 1) {
|
||||||
System.err.println("重复时间戳->" + key + value);
|
System.err.println("重复时间戳->" + key + value);
|
||||||
@@ -1967,18 +1941,6 @@ public class SocketDevResponseService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private LocalDateTime timeFormat(String dateTimeStr, DateTimeFormatter formatter) {
|
|
||||||
try {
|
|
||||||
ZonedDateTime zonedDateTime = ZonedDateTime.parse(dateTimeStr, formatter.withZone(ZoneId.of("UTC")));
|
|
||||||
LocalDateTime localDateTime = zonedDateTime.toLocalDateTime();
|
|
||||||
return localDateTime;
|
|
||||||
} catch (DateTimeParseException e) {
|
|
||||||
System.err.println("日期时间字符串格式错误: " + e.getMessage());
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 向前端推送消息
|
* 向前端推送消息
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -33,18 +33,9 @@ public class SocketSourceResponseService {
|
|||||||
/**
|
/**
|
||||||
* 向webSocket客户端发送消息
|
* 向webSocket客户端发送消息
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private final SocketDevResponseService socketDevResponseService;
|
private final SocketDevResponseService socketDevResponseService;
|
||||||
private final IPqDevService iPqDevService;
|
private final IPqDevService iPqDevService;
|
||||||
|
|
||||||
private final String DEV = "_Dev";
|
|
||||||
private final String source = "_Source";
|
|
||||||
|
|
||||||
private final String stepTag = "&&";
|
|
||||||
private final String stepBegin = "_Start";
|
|
||||||
private final String stepEnd = "_End";
|
|
||||||
|
|
||||||
|
|
||||||
@Value("${socket.device.ip}")
|
@Value("${socket.device.ip}")
|
||||||
private String ip;
|
private String ip;
|
||||||
|
|
||||||
@@ -57,7 +48,7 @@ public class SocketSourceResponseService {
|
|||||||
|
|
||||||
public void deal(PreDetectionParam param, String msg) throws Exception {
|
public void deal(PreDetectionParam param, String msg) throws Exception {
|
||||||
SocketDataMsg socketDataMsg = MsgUtil.socketDataMsg(msg);
|
SocketDataMsg socketDataMsg = MsgUtil.socketDataMsg(msg);
|
||||||
String[] tem = socketDataMsg.getRequestId().split(stepTag);
|
String[] tem = socketDataMsg.getRequestId().split(CnSocketUtil.STEP_TAG);
|
||||||
SourceOperateCodeEnum enumByCode = SourceOperateCodeEnum.getDictDataEnumByCode(tem[0]);
|
SourceOperateCodeEnum enumByCode = SourceOperateCodeEnum.getDictDataEnumByCode(tem[0]);
|
||||||
if (ObjectUtil.isNotNull(enumByCode)) {
|
if (ObjectUtil.isNotNull(enumByCode)) {
|
||||||
switch (enumByCode) {
|
switch (enumByCode) {
|
||||||
@@ -192,7 +183,7 @@ public class SocketSourceResponseService {
|
|||||||
//向前端推送信息
|
//向前端推送信息
|
||||||
WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(socketDataMsg));
|
WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(socketDataMsg));
|
||||||
|
|
||||||
String s = param.getUserPageId() + DEV;
|
String s = param.getUserPageId() + CnSocketUtil.DEV_TAG;
|
||||||
socketMsg.setRequestId(SourceOperateCodeEnum.Coefficient_Check.getValue());
|
socketMsg.setRequestId(SourceOperateCodeEnum.Coefficient_Check.getValue());
|
||||||
socketMsg.setOperateCode(SourceOperateCodeEnum.DEV_DATA_REQUEST_02.getValue());
|
socketMsg.setOperateCode(SourceOperateCodeEnum.DEV_DATA_REQUEST_02.getValue());
|
||||||
DevPhaseSequenceParam phaseSequenceParam = new DevPhaseSequenceParam();
|
DevPhaseSequenceParam phaseSequenceParam = new DevPhaseSequenceParam();
|
||||||
@@ -233,7 +224,7 @@ public class SocketSourceResponseService {
|
|||||||
case SUCCESS:
|
case SUCCESS:
|
||||||
//todo 前端推送收到的消息暂未处理好
|
//todo 前端推送收到的消息暂未处理好
|
||||||
WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(socketDataMsg));
|
WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(socketDataMsg));
|
||||||
String s = param.getUserPageId() + DEV;
|
String s = param.getUserPageId() + CnSocketUtil.DEV_TAG;
|
||||||
//开始设备通讯检测(发送设备初始化)
|
//开始设备通讯检测(发送设备初始化)
|
||||||
//List<PreDetection> devList = iPqDevService.getDevInfo(param.getDevIds());
|
//List<PreDetection> devList = iPqDevService.getDevInfo(param.getDevIds());
|
||||||
Map<String, List<PreDetection>> map = new HashMap<>(1);
|
Map<String, List<PreDetection>> map = new HashMap<>(1);
|
||||||
@@ -303,7 +294,7 @@ public class SocketSourceResponseService {
|
|||||||
//向前端推送信息
|
//向前端推送信息
|
||||||
WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(socketDataMsg));
|
WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(socketDataMsg));
|
||||||
|
|
||||||
String s = param.getUserPageId() + DEV;
|
String s = param.getUserPageId() + CnSocketUtil.DEV_TAG;
|
||||||
socketMsg.setRequestId(SourceOperateCodeEnum.YJC_XUJY.getValue());
|
socketMsg.setRequestId(SourceOperateCodeEnum.YJC_XUJY.getValue());
|
||||||
socketMsg.setOperateCode(SourceOperateCodeEnum.DEV_DATA_REQUEST_02.getValue());
|
socketMsg.setOperateCode(SourceOperateCodeEnum.DEV_DATA_REQUEST_02.getValue());
|
||||||
List<PreDetection> pqDevList = iPqDevService.getDevInfo(param.getDevIds());
|
List<PreDetection> pqDevList = iPqDevService.getDevInfo(param.getDevIds());
|
||||||
@@ -352,11 +343,11 @@ public class SocketSourceResponseService {
|
|||||||
//向前端推送信息
|
//向前端推送信息
|
||||||
// webSocketHandler.sendMsgToUser(param.getUserPageId(), JSON.toJSONString(socketDataMsg));
|
// webSocketHandler.sendMsgToUser(param.getUserPageId(), JSON.toJSONString(socketDataMsg));
|
||||||
|
|
||||||
String s = param.getUserPageId() + DEV;
|
String s = param.getUserPageId() + CnSocketUtil.DEV_TAG;
|
||||||
SourceIssue sourceIssue = SocketManager.getSourceList().get(0);
|
SourceIssue sourceIssue = SocketManager.getSourceList().get(0);
|
||||||
List<String> comm = sourceIssue.getDevValueTypeList(); //形如:类型&小项code这种形式。例如:real$VRMS、real$IRMS
|
List<String> comm = sourceIssue.getDevValueTypeList(); //形如:类型&小项code这种形式。例如:real$VRMS、real$IRMS
|
||||||
System.out.println("向装置下发的参数>>>>>>>>" + comm);
|
System.out.println("向装置下发的参数>>>>>>>>" + comm);
|
||||||
socketMsg.setRequestId(SourceOperateCodeEnum.FORMAL_REAL.getValue() + stepTag + sourceIssue.getType());
|
socketMsg.setRequestId(SourceOperateCodeEnum.FORMAL_REAL.getValue() + CnSocketUtil.STEP_TAG + sourceIssue.getType());
|
||||||
int ignoreCount;
|
int ignoreCount;
|
||||||
int readData;
|
int readData;
|
||||||
if (DicDataEnum.F.getCode().equals(sourceIssue.getType())) {
|
if (DicDataEnum.F.getCode().equals(sourceIssue.getType())) {
|
||||||
@@ -397,7 +388,7 @@ public class SocketSourceResponseService {
|
|||||||
});
|
});
|
||||||
|
|
||||||
WebSocketVO<Object> webSocketVO = new WebSocketVO<>();
|
WebSocketVO<Object> webSocketVO = new WebSocketVO<>();
|
||||||
webSocketVO.setRequestId(socketDataMsg.getRequestId().split(stepTag)[1] + stepBegin);
|
webSocketVO.setRequestId(socketDataMsg.getRequestId().split(CnSocketUtil.STEP_TAG)[1] + CnSocketUtil.START_TAG);
|
||||||
webSocketVO.setDesc(SocketManager.getSourceList().get(0).getDesc());
|
webSocketVO.setDesc(SocketManager.getSourceList().get(0).getDesc());
|
||||||
webSocketVO.setData(devListRes);
|
webSocketVO.setData(devListRes);
|
||||||
WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(webSocketVO));
|
WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(webSocketVO));
|
||||||
@@ -425,16 +416,16 @@ public class SocketSourceResponseService {
|
|||||||
switch (Objects.requireNonNull(dictDataEnumByCode)) {
|
switch (Objects.requireNonNull(dictDataEnumByCode)) {
|
||||||
case SUCCESS:
|
case SUCCESS:
|
||||||
//通讯校验成功
|
//通讯校验成功
|
||||||
SocketManager.removeUser(param.getUserPageId() + source);
|
SocketManager.removeUser(param.getUserPageId() + CnSocketUtil.SOURCE_TAG);
|
||||||
WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(socketDataMsg));
|
WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(socketDataMsg));
|
||||||
break;
|
break;
|
||||||
case UNPROCESSED_BUSINESS:
|
case UNPROCESSED_BUSINESS:
|
||||||
break;
|
break;
|
||||||
case MESSAGE_PARSING_ERROR:
|
case MESSAGE_PARSING_ERROR:
|
||||||
SocketManager.removeUser(param.getUserPageId() + source);
|
SocketManager.removeUser(param.getUserPageId() + CnSocketUtil.SOURCE_TAG);
|
||||||
break;
|
break;
|
||||||
case UNABLE_TO_RESPOND:
|
case UNABLE_TO_RESPOND:
|
||||||
SocketManager.removeUser(param.getUserPageId() + source);
|
SocketManager.removeUser(param.getUserPageId() + CnSocketUtil.SOURCE_TAG);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
CnSocketUtil.quitSendSource(param);
|
CnSocketUtil.quitSendSource(param);
|
||||||
|
|||||||
@@ -28,17 +28,13 @@ public enum DetectionCodeEnum {
|
|||||||
V_UNBAN("V_UNBAN", "三相电压负序不平衡度"),
|
V_UNBAN("V_UNBAN", "三相电压负序不平衡度"),
|
||||||
I_UNBAN("I_UNBAN", "三相电流负序不平衡度"),
|
I_UNBAN("I_UNBAN", "三相电流负序不平衡度"),
|
||||||
PST("PST", "短时间闪变"),
|
PST("PST", "短时间闪变"),
|
||||||
P("P", "功率"),
|
P_FUND("P_FUND", "功率"),
|
||||||
|
|
||||||
|
|
||||||
I1("I1", "基波电流"),
|
I1("I1", "基波电流"),
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
UNKNOWN_ERROR("-1", "未知异常"),
|
UNKNOWN_ERROR("-1", "未知异常"),
|
||||||
|
|
||||||
;
|
|
||||||
|
STAR("Star","星型接线"),
|
||||||
|
DELTA("Delta","角型接线");
|
||||||
|
|
||||||
private final String code;
|
private final String code;
|
||||||
private final String message;
|
private final String message;
|
||||||
|
|||||||
@@ -48,6 +48,8 @@ public enum SourceOperateCodeEnum {
|
|||||||
YJC_SBTXJY("yjc_sbtxjy", "设备通讯检测"),
|
YJC_SBTXJY("yjc_sbtxjy", "设备通讯检测"),
|
||||||
YJC_XYJY("yjc_xyjy", "协议校验"),
|
YJC_XYJY("yjc_xyjy", "协议校验"),
|
||||||
YJC_XUJY("YJC_xujy", "相序校验"),
|
YJC_XUJY("YJC_xujy", "相序校验"),
|
||||||
|
YJC_ALIGN("YJC_align","实时数据对齐校验"),
|
||||||
|
YJC_MXYZXJY("YJC_mxyzxjy", "模型一致性校验"),
|
||||||
FORMAL_REAL("formal_real","正式检测"),
|
FORMAL_REAL("formal_real","正式检测"),
|
||||||
// SIMULATE_REAL("simulate_real","模拟检测"),
|
// SIMULATE_REAL("simulate_real","模拟检测"),
|
||||||
Coefficient_Check("Coefficient_Check","系数校验"),
|
Coefficient_Check("Coefficient_Check","系数校验"),
|
||||||
@@ -78,7 +80,6 @@ public enum SourceOperateCodeEnum {
|
|||||||
// TEST_TEM_STOP("5","临时停止"),
|
// TEST_TEM_STOP("5","临时停止"),
|
||||||
ALL_TEST("1","全部检测"),
|
ALL_TEST("1","全部检测"),
|
||||||
RE_ERROR_TEST("2","不合格项复检"),
|
RE_ERROR_TEST("2","不合格项复检"),
|
||||||
TEST_TEM_START("3","继续检测"),
|
|
||||||
SIMULATE_TEST("4","模拟检测"),
|
SIMULATE_TEST("4","模拟检测"),
|
||||||
//TEST_STOP("7","停止检测"),
|
//TEST_STOP("7","停止检测"),
|
||||||
//FAST_TEST("10","一键检测"),
|
//FAST_TEST("10","一键检测"),
|
||||||
@@ -99,10 +100,7 @@ public enum SourceOperateCodeEnum {
|
|||||||
/**
|
/**
|
||||||
* ftp文件传送指令
|
* ftp文件传送指令
|
||||||
*/
|
*/
|
||||||
FTP_SEND_01("FTP_SEND$01", "发送文件")
|
FTP_SEND_01("FTP_SEND$01", "发送文件"),;
|
||||||
|
|
||||||
|
|
||||||
;
|
|
||||||
|
|
||||||
private final String value;
|
private final String value;
|
||||||
private final String msg;
|
private final String msg;
|
||||||
|
|||||||
@@ -0,0 +1,44 @@
|
|||||||
|
package com.njcn.gather.detection.pojo.param;
|
||||||
|
|
||||||
|
import com.njcn.gather.pojo.constant.DetectionValidMessage;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author caozehui
|
||||||
|
* @data 2025-07-18
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ContrastDetectionParam {
|
||||||
|
|
||||||
|
@ApiModelProperty("检测计划ID")
|
||||||
|
@NotBlank(message = DetectionValidMessage.PLAN_ID_NOT_BLANK)
|
||||||
|
private String planId;
|
||||||
|
|
||||||
|
@ApiModelProperty("用户ID,唯一标识")
|
||||||
|
private String userId;
|
||||||
|
|
||||||
|
@ApiModelProperty("被检设备ID列表")
|
||||||
|
@NotEmpty(message = DetectionValidMessage.DEV_IDS_NOT_EMPTY)
|
||||||
|
private List<String> devIds;
|
||||||
|
|
||||||
|
@ApiModelProperty("标准设备ID列表")
|
||||||
|
@NotEmpty(message = DetectionValidMessage.STANDARD_DEV_IDS_NOT_EMPTY)
|
||||||
|
private List<String> standardDevIds;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* key为 标准设备ID_检测点序号、value为 被检设备ID_检测点序号
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("配对关系")
|
||||||
|
@NotEmpty(message = DetectionValidMessage.PAIRS_NOT_EMPTY)
|
||||||
|
private Map<String,String> pairs;
|
||||||
|
/**
|
||||||
|
* 检测项列表。第一个元素为预检测、第二个元素为系数校准、第三个元素为正式检测
|
||||||
|
*/
|
||||||
|
private List<Boolean> testItemList;
|
||||||
|
}
|
||||||
@@ -18,6 +18,9 @@ public class DevData {
|
|||||||
@JSONField(name = "Time", ordinal = 1)
|
@JSONField(name = "Time", ordinal = 1)
|
||||||
private String time;
|
private String time;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备ip_通道号 这种形式
|
||||||
|
*/
|
||||||
@JSONField(name = "ID", ordinal = 2)
|
@JSONField(name = "ID", ordinal = 2)
|
||||||
private String id;
|
private String id;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.njcn.gather.detection.service;
|
package com.njcn.gather.detection.service;
|
||||||
|
|
||||||
|
import com.njcn.gather.detection.pojo.param.ContrastDetectionParam;
|
||||||
import com.njcn.gather.detection.pojo.param.PreDetectionParam;
|
import com.njcn.gather.detection.pojo.param.PreDetectionParam;
|
||||||
import com.njcn.gather.detection.pojo.param.SimulateDetectionParam;
|
import com.njcn.gather.detection.pojo.param.SimulateDetectionParam;
|
||||||
|
|
||||||
@@ -49,4 +50,10 @@ public interface PreDetectionService {
|
|||||||
* @param param
|
* @param param
|
||||||
*/
|
*/
|
||||||
void closeTestSimulate(SimulateDetectionParam param);
|
void closeTestSimulate(SimulateDetectionParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param param
|
||||||
|
*/
|
||||||
|
void startContrastTest(ContrastDetectionParam param);
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,16 +1,19 @@
|
|||||||
package com.njcn.gather.detection.service.impl;
|
package com.njcn.gather.detection.service.impl;
|
||||||
|
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
|
import com.njcn.gather.detection.handler.SocketContrastResponseService;
|
||||||
import com.njcn.gather.detection.handler.SocketDevResponseService;
|
import com.njcn.gather.detection.handler.SocketDevResponseService;
|
||||||
import com.njcn.gather.detection.handler.SocketSourceResponseService;
|
import com.njcn.gather.detection.handler.SocketSourceResponseService;
|
||||||
import com.njcn.gather.detection.pojo.constant.DetectionCommunicateConstant;
|
import com.njcn.gather.detection.pojo.constant.DetectionCommunicateConstant;
|
||||||
import com.njcn.gather.detection.pojo.enums.DetectionResponseEnum;
|
import com.njcn.gather.detection.pojo.enums.DetectionResponseEnum;
|
||||||
import com.njcn.gather.detection.pojo.enums.SourceOperateCodeEnum;
|
import com.njcn.gather.detection.pojo.enums.SourceOperateCodeEnum;
|
||||||
|
import com.njcn.gather.detection.pojo.param.ContrastDetectionParam;
|
||||||
import com.njcn.gather.detection.pojo.param.PreDetectionParam;
|
import com.njcn.gather.detection.pojo.param.PreDetectionParam;
|
||||||
import com.njcn.gather.detection.pojo.param.SimulateDetectionParam;
|
import com.njcn.gather.detection.pojo.param.SimulateDetectionParam;
|
||||||
import com.njcn.gather.detection.pojo.vo.SocketMsg;
|
import com.njcn.gather.detection.pojo.vo.SocketMsg;
|
||||||
@@ -21,8 +24,10 @@ import com.njcn.gather.detection.util.socket.FormalTestManager;
|
|||||||
import com.njcn.gather.detection.util.socket.SocketManager;
|
import com.njcn.gather.detection.util.socket.SocketManager;
|
||||||
import com.njcn.gather.detection.util.socket.WebServiceManager;
|
import com.njcn.gather.detection.util.socket.WebServiceManager;
|
||||||
import com.njcn.gather.detection.util.socket.cilent.NettyClient;
|
import com.njcn.gather.detection.util.socket.cilent.NettyClient;
|
||||||
|
import com.njcn.gather.detection.util.socket.cilent.NettyContrastClientHandler;
|
||||||
import com.njcn.gather.detection.util.socket.cilent.NettySourceClientHandler;
|
import com.njcn.gather.detection.util.socket.cilent.NettySourceClientHandler;
|
||||||
import com.njcn.gather.device.pojo.po.PqDev;
|
import com.njcn.gather.device.pojo.po.PqDev;
|
||||||
|
import com.njcn.gather.device.pojo.vo.PreDetection;
|
||||||
import com.njcn.gather.device.service.IPqDevService;
|
import com.njcn.gather.device.service.IPqDevService;
|
||||||
import com.njcn.gather.plan.pojo.po.AdPlan;
|
import com.njcn.gather.plan.pojo.po.AdPlan;
|
||||||
import com.njcn.gather.plan.pojo.po.AdPlanSource;
|
import com.njcn.gather.plan.pojo.po.AdPlanSource;
|
||||||
@@ -43,7 +48,10 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@@ -65,6 +73,7 @@ public class PreDetectionServiceImpl implements PreDetectionService {
|
|||||||
|
|
||||||
private final SocketDevResponseService socketDevResponseService;
|
private final SocketDevResponseService socketDevResponseService;
|
||||||
private final SocketSourceResponseService socketSourceResponseService;
|
private final SocketSourceResponseService socketSourceResponseService;
|
||||||
|
private final SocketContrastResponseService socketContrastResponseService;
|
||||||
private final IPqScriptCheckDataService iPqScriptCheckDataService;
|
private final IPqScriptCheckDataService iPqScriptCheckDataService;
|
||||||
|
|
||||||
@Value("${socket.source.ip:192.168.1.138}")
|
@Value("${socket.source.ip:192.168.1.138}")
|
||||||
@@ -73,13 +82,13 @@ public class PreDetectionServiceImpl implements PreDetectionService {
|
|||||||
@Value("${socket.source.port:61000}")
|
@Value("${socket.source.port:61000}")
|
||||||
private Integer port;
|
private Integer port;
|
||||||
|
|
||||||
private final SocketSourceResponseService sourceResponseService;
|
//private final SocketSourceResponseService sourceResponseService;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sourceCommunicationCheck(PreDetectionParam param) {
|
public void sourceCommunicationCheck(PreDetectionParam param) {
|
||||||
// 参数校验,目前仅检查IP是否重复,后续可在里面扩展
|
// 参数校验,目前仅检查IP是否重复,后续可在里面扩展
|
||||||
checkDevIp(param);
|
checkDevIp(param.getDevIds());
|
||||||
//用于处理异常导致的socket通道未关闭,socket交互异常
|
//用于处理异常导致的socket通道未关闭,socket交互异常
|
||||||
DetectionCommunicateUtil.checkCommunicateChannel(param);
|
DetectionCommunicateUtil.checkCommunicateChannel(param);
|
||||||
/*
|
/*
|
||||||
@@ -126,7 +135,8 @@ public class PreDetectionServiceImpl implements PreDetectionService {
|
|||||||
msg.setOperateCode(SourceOperateCodeEnum.INIT_GATHER.getValue());
|
msg.setOperateCode(SourceOperateCodeEnum.INIT_GATHER.getValue());
|
||||||
msg.setData(JSON.toJSONString(sourceParam));
|
msg.setData(JSON.toJSONString(sourceParam));
|
||||||
param.setSourceId(sourceParam.getSourceId());
|
param.setSourceId(sourceParam.getSourceId());
|
||||||
NettyClient.socketClient(ip, port, param, JSON.toJSONString(msg), new NettySourceClientHandler(param, sourceResponseService));
|
// NettyClient.socketClient(ip, port, param, JSON.toJSONString(msg), new NettySourceClientHandler(param, sourceResponseService));
|
||||||
|
NettyClient.socketClient(ip, port, param, JSON.toJSONString(msg), new NettySourceClientHandler(param, socketSourceResponseService));
|
||||||
} else {
|
} else {
|
||||||
throw new BusinessException(DetectionResponseEnum.SOURCE_INFO_NOT);
|
throw new BusinessException(DetectionResponseEnum.SOURCE_INFO_NOT);
|
||||||
}
|
}
|
||||||
@@ -152,7 +162,8 @@ public class PreDetectionServiceImpl implements PreDetectionService {
|
|||||||
socketMsg.setOperateCode(SourceOperateCodeEnum.INIT_GATHER.getValue());
|
socketMsg.setOperateCode(SourceOperateCodeEnum.INIT_GATHER.getValue());
|
||||||
socketMsg.setData(JSON.toJSONString(sourceParam));
|
socketMsg.setData(JSON.toJSONString(sourceParam));
|
||||||
//建立与源控程序的socket连接,
|
//建立与源控程序的socket连接,
|
||||||
NettyClient.socketClient(ip, port, param, JSON.toJSONString(socketMsg), new NettySourceClientHandler(param, sourceResponseService));
|
// NettyClient.socketClient(ip, port, param, JSON.toJSONString(socketMsg), new NettySourceClientHandler(param, sourceResponseService));
|
||||||
|
NettyClient.socketClient(ip, port, param, JSON.toJSONString(socketMsg), new NettySourceClientHandler(param, socketSourceResponseService));
|
||||||
} else {
|
} else {
|
||||||
throw new BusinessException(DetectionResponseEnum.SOURCE_INFO_NOT);
|
throw new BusinessException(DetectionResponseEnum.SOURCE_INFO_NOT);
|
||||||
}
|
}
|
||||||
@@ -170,7 +181,7 @@ public class PreDetectionServiceImpl implements PreDetectionService {
|
|||||||
socketMsg.setRequestId(SourceOperateCodeEnum.YJC_YTXJY.getValue());
|
socketMsg.setRequestId(SourceOperateCodeEnum.YJC_YTXJY.getValue());
|
||||||
socketMsg.setOperateCode(SourceOperateCodeEnum.INIT_GATHER.getValue());
|
socketMsg.setOperateCode(SourceOperateCodeEnum.INIT_GATHER.getValue());
|
||||||
socketMsg.setData(JSON.toJSONString(sourceParam));
|
socketMsg.setData(JSON.toJSONString(sourceParam));
|
||||||
NettyClient.socketClient(ip, port, param, JSON.toJSONString(socketMsg), new NettySourceClientHandler(param, sourceResponseService));
|
NettyClient.socketClient(ip, port, param, JSON.toJSONString(socketMsg), new NettySourceClientHandler(param, socketSourceResponseService));
|
||||||
} else {
|
} else {
|
||||||
throw new BusinessException(DetectionResponseEnum.SOURCE_INFO_NOT);
|
throw new BusinessException(DetectionResponseEnum.SOURCE_INFO_NOT);
|
||||||
}
|
}
|
||||||
@@ -267,14 +278,64 @@ public class PreDetectionServiceImpl implements PreDetectionService {
|
|||||||
WebServiceManager.removePreDetectionParam();
|
WebServiceManager.removePreDetectionParam();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void startContrastTest(ContrastDetectionParam param) {
|
||||||
|
// 参数校验,目前仅检查IP是否重复,后续可在里面扩展
|
||||||
|
checkDevIp(param.getDevIds());
|
||||||
|
//用于处理异常导致的socket通道未关闭,socket交互异常
|
||||||
|
DetectionCommunicateUtil.checkContrastCommunicateChannel(param.getUserId());
|
||||||
|
socketContrastResponseService.init(param);
|
||||||
|
|
||||||
|
// 和通信模块进行连接
|
||||||
|
this.sendContrastSocket(param);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 比对式-与通信模块进行连接
|
||||||
|
*
|
||||||
|
* @param param
|
||||||
|
*/
|
||||||
|
private void sendContrastSocket(ContrastDetectionParam param) {
|
||||||
|
String s = param.getUserId() + CnSocketUtil.DEV_TAG;
|
||||||
|
|
||||||
|
Map<String, List<PreDetection>> map = new HashMap<>(1);
|
||||||
|
List<PreDetection> preDetections = BeanUtil.copyToList(FormalTestManager.devList, PreDetection.class);
|
||||||
|
preDetections.addAll(BeanUtil.copyToList(FormalTestManager.standardDevList, PreDetection.class));
|
||||||
|
preDetections.forEach(x -> {
|
||||||
|
x.setDevType(x.getIcdType());
|
||||||
|
x.getMonitorList().forEach(y -> {
|
||||||
|
|
||||||
|
String pt = y.getPt();
|
||||||
|
int i = pt.indexOf(":");
|
||||||
|
y.setPt(BigDecimal.valueOf(Double.parseDouble(pt.substring(0, i))).divide(BigDecimal.valueOf(Double.parseDouble(pt.substring(i + 1))), 5, BigDecimal.ROUND_HALF_UP) + "");
|
||||||
|
|
||||||
|
String ct = y.getCt();
|
||||||
|
i = ct.indexOf(":");
|
||||||
|
y.setCt(BigDecimal.valueOf(Double.parseDouble(ct.substring(0, i))).divide(BigDecimal.valueOf(Double.parseDouble(ct.substring(i + 1))), 5, BigDecimal.ROUND_HALF_UP) + "");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
map.put("deviceList", preDetections);
|
||||||
|
String jsonString = JSON.toJSONString(map);
|
||||||
|
|
||||||
|
SocketMsg<String> socketMsg = new SocketMsg<>();
|
||||||
|
socketMsg.setRequestId(SourceOperateCodeEnum.YJC_SBTXJY.getValue());
|
||||||
|
socketMsg.setOperateCode(SourceOperateCodeEnum.DEV_INIT_GATHER_01.getValue());
|
||||||
|
socketMsg.setData(jsonString);
|
||||||
|
String json = JSON.toJSONString(socketMsg);
|
||||||
|
SocketManager.sendMsg(s, json);
|
||||||
|
|
||||||
|
PreDetectionParam preDetectionParam = new PreDetectionParam();
|
||||||
|
preDetectionParam.setUserPageId(param.getUserId());
|
||||||
|
NettyClient.socketClient(ip, port, preDetectionParam, json, new NettyContrastClientHandler(preDetectionParam, socketContrastResponseService));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 校验被检设备中是否存在IP重复的
|
* 校验被检设备中是否存在IP重复的
|
||||||
*/
|
*/
|
||||||
private void checkDevIp(PreDetectionParam param) {
|
private void checkDevIp(List<String> devIds) {
|
||||||
List<PqDev> pqDevList = iPqDevService.listByIds(param.getDevIds());
|
List<PqDev> pqDevList = iPqDevService.listByIds(devIds);
|
||||||
List<String> ipList = pqDevList.stream().map(PqDev::getIp).distinct().collect(Collectors.toList());
|
List<String> ipList = pqDevList.stream().map(PqDev::getIp).distinct().collect(Collectors.toList());
|
||||||
if (ipList.size() != param.getDevIds().size()) {
|
if (ipList.size() != devIds.size()) {
|
||||||
throw new BusinessException(DetectionResponseEnum.PLAN_DEV_IP_HAS);
|
throw new BusinessException(DetectionResponseEnum.PLAN_DEV_IP_HAS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,219 @@
|
|||||||
|
package com.njcn.gather.detection.util;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import com.njcn.gather.detection.pojo.po.DevData;
|
||||||
|
import com.njcn.gather.detection.service.impl.DetectionServiceImpl;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.ZoneId;
|
||||||
|
import java.time.ZonedDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.time.format.DateTimeParseException;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author caozehui
|
||||||
|
* @data 2025-07-28
|
||||||
|
*/
|
||||||
|
public class DetectionUtil {
|
||||||
|
/**
|
||||||
|
* 相角矫正到统一个区间
|
||||||
|
*
|
||||||
|
* @param phase
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static Double adjustPhase(Double phase) {
|
||||||
|
if (phase < -180) {
|
||||||
|
return phase + 360;
|
||||||
|
}
|
||||||
|
if (phase > 180) {
|
||||||
|
return phase - 360;
|
||||||
|
}
|
||||||
|
return phase;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断数据是否对齐
|
||||||
|
*
|
||||||
|
* @param devData 被检设备数据
|
||||||
|
* @param standardDevData 标准设备数据
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static boolean isAlignData(DevData devData, DevData standardDevData) {
|
||||||
|
if (ObjectUtil.isNotNull(devData) && ObjectUtil.isNotNull(standardDevData)) {
|
||||||
|
|
||||||
|
long devMillis = getMillis(devData.getTime());
|
||||||
|
long standardMillis = getMillis(standardDevData.getTime());
|
||||||
|
if (BigDecimal.valueOf(devMillis).divide(BigDecimal.valueOf(10), 0, BigDecimal.ROUND_HALF_UP).compareTo(BigDecimal.valueOf(standardMillis).divide(BigDecimal.valueOf(10), 0, BigDecimal.ROUND_HALF_UP)) == 0) {
|
||||||
|
return true;
|
||||||
|
} else if (Math.abs(devMillis - standardMillis) < 100) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将字符串日期时间转换为指定格式的LocalDateTime
|
||||||
|
*
|
||||||
|
* @param dateTimeStr
|
||||||
|
* @param formatter
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static LocalDateTime timeFormat(String dateTimeStr, DateTimeFormatter formatter) {
|
||||||
|
try {
|
||||||
|
ZonedDateTime zonedDateTime = ZonedDateTime.parse(dateTimeStr, formatter.withZone(ZoneId.of("UTC")));
|
||||||
|
LocalDateTime localDateTime = zonedDateTime.toLocalDateTime();
|
||||||
|
return localDateTime;
|
||||||
|
} catch (DateTimeParseException e) {
|
||||||
|
System.err.println("日期时间字符串格式错误: " + e.getMessage());
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取字符串日期时间对应的毫秒数
|
||||||
|
*
|
||||||
|
* @param dateTimeStr
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static long getMillis(String dateTimeStr) {
|
||||||
|
LocalDateTime localDateTime = timeFormat(dateTimeStr, DateTimeFormatter.ISO_DATE_TIME);
|
||||||
|
return getMillis(localDateTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取LocalDateTime的所对应的毫秒数
|
||||||
|
*
|
||||||
|
* @param localDateTime
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static long getMillis(LocalDateTime localDateTime) {
|
||||||
|
return localDateTime.atZone(ZoneId.of("UTC")).toInstant().toEpochMilli();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断value是否为0
|
||||||
|
* @param value
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static boolean isZero(Double value) {
|
||||||
|
BigDecimal bd = BigDecimal.valueOf(value);
|
||||||
|
if(bd.subtract(BigDecimal.ZERO).abs().compareTo(BigDecimal.valueOf(0.001)) < 0){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取CP95值
|
||||||
|
*
|
||||||
|
* @param t
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static List<Double> getCP95Doubles(List<Double> t) {
|
||||||
|
if (CollUtil.isNotEmpty(t)) {
|
||||||
|
if (t.size() < 21) {
|
||||||
|
if (t.size() == 1) {
|
||||||
|
return t;
|
||||||
|
}
|
||||||
|
if (t.size() > 1) {
|
||||||
|
return t.subList(1, 2);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
int v = (int) (t.size() * 0.5);
|
||||||
|
return t.subList(v, v + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return t;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取CP95值所在索引
|
||||||
|
*
|
||||||
|
* @param t
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static int getCP95Idx(List<Double> t) {
|
||||||
|
if (CollUtil.isNotEmpty(t)) {
|
||||||
|
if (t.size() < 21) {
|
||||||
|
if (t.size() == 1) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (t.size() > 1) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
int v = (int) (t.size() * 0.5);
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取部分值
|
||||||
|
*
|
||||||
|
* @param t
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static List<Double> getSectionValueDoubles(List<Double> t) {
|
||||||
|
if (CollUtil.isNotEmpty(t)) {
|
||||||
|
if (t.size() > 2) {
|
||||||
|
Double max = Collections.max(t);
|
||||||
|
Double min = Collections.min(t);
|
||||||
|
t.remove(max);
|
||||||
|
t.remove(min);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return t;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取平均值
|
||||||
|
*
|
||||||
|
* @param t
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static List<Double> getAvgDoubles(List<Double> t) {
|
||||||
|
if (CollUtil.isNotEmpty(t)) {
|
||||||
|
t = Arrays.asList(t.stream().mapToDouble(Double::doubleValue).average().orElse(0.0));
|
||||||
|
}
|
||||||
|
return t;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 对list进行从大到小排序,并返回排序后的索引序列
|
||||||
|
*
|
||||||
|
* @param list
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static List<Integer> sort(List<Double> list) {
|
||||||
|
List<Integer> indexList = Stream.iterate(0, i -> i + 1).limit(list.size()).collect(Collectors.toList());
|
||||||
|
for (int i = 0; i < list.size(); i++) {
|
||||||
|
int maxIdx = i;
|
||||||
|
for (int j = i + 1; j < list.size(); j++) {
|
||||||
|
if (list.get(j) > list.get(maxIdx)) {
|
||||||
|
maxIdx = j;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (maxIdx != i) {
|
||||||
|
double temp = list.get(i);
|
||||||
|
list.set(i, list.get(maxIdx));
|
||||||
|
list.set(maxIdx, temp);
|
||||||
|
|
||||||
|
int tempIdx = indexList.get(i);
|
||||||
|
indexList.set(i, indexList.get(maxIdx));
|
||||||
|
indexList.set(maxIdx, tempIdx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return indexList;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -54,4 +54,30 @@ public class DetectionCommunicateUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 比对式-检测是否存在已有的Socket通道,有则强行关闭
|
||||||
|
*
|
||||||
|
* @param userId
|
||||||
|
*/
|
||||||
|
public static void checkContrastCommunicateChannel(String userId) {
|
||||||
|
Channel channel = SocketManager.getChannelByUserId(userId);
|
||||||
|
|
||||||
|
if (Objects.nonNull(channel) && channel.isActive()) {
|
||||||
|
System.out.println("存在已有的Socket通道,强行关闭。。。。。。。。");
|
||||||
|
CnSocketUtil.contrastSendquit(userId);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
Thread.sleep(4000);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
log.error(e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
SocketManager.removeUser(userId);
|
||||||
|
try {
|
||||||
|
Thread.sleep(2000);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
log.error(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,8 +14,17 @@ import com.njcn.gather.detection.pojo.vo.WebSocketVO;
|
|||||||
*/
|
*/
|
||||||
public class CnSocketUtil {
|
public class CnSocketUtil {
|
||||||
|
|
||||||
private final static String devTag = "_Dev";
|
public final static String DEV_TAG = "_Dev";
|
||||||
private final static String sourceTag = "_Source";
|
|
||||||
|
public final static String SOURCE_TAG = "_Source";
|
||||||
|
|
||||||
|
public final static String START_TAG = "_Start";
|
||||||
|
|
||||||
|
public final static String END_TAG = "_End";
|
||||||
|
|
||||||
|
public final static String STEP_TAG = "&&";
|
||||||
|
|
||||||
|
public final static String SPLIT_TAG = "_";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 退出检测
|
* 退出检测
|
||||||
@@ -24,7 +33,7 @@ public class CnSocketUtil {
|
|||||||
SocketMsg<String> socketMsg = new SocketMsg<>();
|
SocketMsg<String> socketMsg = new SocketMsg<>();
|
||||||
socketMsg.setRequestId(SourceOperateCodeEnum.QUITE.getValue());
|
socketMsg.setRequestId(SourceOperateCodeEnum.QUITE.getValue());
|
||||||
socketMsg.setOperateCode(SourceOperateCodeEnum.QUIT_INIT_03.getValue());
|
socketMsg.setOperateCode(SourceOperateCodeEnum.QUIT_INIT_03.getValue());
|
||||||
SocketManager.sendMsg(param.getUserPageId() + devTag, JSON.toJSONString(socketMsg));
|
SocketManager.sendMsg(param.getUserPageId() + DEV_TAG, JSON.toJSONString(socketMsg));
|
||||||
WebServiceManager.removePreDetectionParam();
|
WebServiceManager.removePreDetectionParam();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -38,31 +47,44 @@ public class CnSocketUtil {
|
|||||||
JSONObject jsonObject = new JSONObject();
|
JSONObject jsonObject = new JSONObject();
|
||||||
jsonObject.put("sourceId", param.getSourceId());
|
jsonObject.put("sourceId", param.getSourceId());
|
||||||
socketMsg.setData(jsonObject.toJSONString());
|
socketMsg.setData(jsonObject.toJSONString());
|
||||||
SocketManager.sendMsg(param.getUserPageId() + sourceTag, JSON.toJSONString(socketMsg));
|
SocketManager.sendMsg(param.getUserPageId() + SOURCE_TAG, JSON.toJSONString(socketMsg));
|
||||||
WebServiceManager.removePreDetectionParam();
|
WebServiceManager.removePreDetectionParam();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 推送webSocket数据
|
* 推送webSocket数据
|
||||||
*/
|
*/
|
||||||
public static void sendToWebSocket(String userId, String requestId, String operatorType, Object data, String desc){
|
public static void sendToWebSocket(String userId, String requestId, String operatorType, Object data, String desc) {
|
||||||
WebSocketVO<Object> webSocketVO = new WebSocketVO<>();
|
WebSocketVO<Object> webSocketVO = new WebSocketVO<>();
|
||||||
webSocketVO.setRequestId(requestId);
|
webSocketVO.setRequestId(requestId);
|
||||||
webSocketVO.setOperateCode(operatorType);
|
webSocketVO.setOperateCode(operatorType);
|
||||||
webSocketVO.setData(data);
|
webSocketVO.setData(data);
|
||||||
webSocketVO.setDesc(desc);
|
webSocketVO.setDesc(desc);
|
||||||
WebServiceManager.sendMessage(userId,webSocketVO);
|
WebServiceManager.sendMessage(userId, webSocketVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 推送未知异常的webSocket数据
|
* 推送未知异常的webSocket数据
|
||||||
*/
|
*/
|
||||||
public static void sendUnSocket(String userId){
|
public static void sendUnSocket(String userId) {
|
||||||
WebSocketVO<Object> webSocketVO = new WebSocketVO<>();
|
WebSocketVO<Object> webSocketVO = new WebSocketVO<>();
|
||||||
webSocketVO.setRequestId(SourceOperateCodeEnum.UNKNOWN_OPERATE.getValue());
|
webSocketVO.setRequestId(SourceOperateCodeEnum.UNKNOWN_OPERATE.getValue());
|
||||||
webSocketVO.setData(SourceOperateCodeEnum.UNKNOWN_OPERATE.getMsg());
|
webSocketVO.setData(SourceOperateCodeEnum.UNKNOWN_OPERATE.getMsg());
|
||||||
webSocketVO.setOperateCode(SourceOperateCodeEnum.UNKNOWN_OPERATE.getMsg());
|
webSocketVO.setOperateCode(SourceOperateCodeEnum.UNKNOWN_OPERATE.getMsg());
|
||||||
WebServiceManager.sendMessage(userId,webSocketVO);
|
WebServiceManager.sendMessage(userId, webSocketVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 比对式-退出检测
|
||||||
|
*/
|
||||||
|
public static void contrastSendquit(String userId) {
|
||||||
|
System.out.println("比对式-发送关闭备通讯模块指令。。。。。。。。");
|
||||||
|
SocketMsg<String> socketMsg = new SocketMsg<>();
|
||||||
|
socketMsg.setRequestId(SourceOperateCodeEnum.QUITE.getValue());
|
||||||
|
socketMsg.setOperateCode(SourceOperateCodeEnum.QUIT_INIT_03.getValue());
|
||||||
|
SocketManager.sendMsg(userId + DEV_TAG, JSON.toJSONString(socketMsg));
|
||||||
|
WebServiceManager.removePreDetectionParam();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,11 @@
|
|||||||
package com.njcn.gather.detection.util.socket;
|
package com.njcn.gather.detection.util.socket;
|
||||||
|
|
||||||
|
import com.google.common.collect.HashBiMap;
|
||||||
import com.njcn.gather.detection.pojo.po.DevData;
|
import com.njcn.gather.detection.pojo.po.DevData;
|
||||||
|
import com.njcn.gather.device.pojo.po.PqStandardDev;
|
||||||
import com.njcn.gather.device.pojo.vo.PreDetection;
|
import com.njcn.gather.device.pojo.vo.PreDetection;
|
||||||
|
import com.njcn.gather.plan.pojo.po.AdPlan;
|
||||||
|
import com.njcn.gather.system.dictionary.pojo.enums.DictDataEnum;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -12,64 +16,98 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||||||
/**
|
/**
|
||||||
* @Author: cdf
|
* @Author: cdf
|
||||||
* @CreateTime: 2025-01-08
|
* @CreateTime: 2025-01-08
|
||||||
* @Description: 正式检测对象管理
|
* @Description: 正式(预)检测对象管理
|
||||||
*/
|
*/
|
||||||
public class FormalTestManager {
|
public class FormalTestManager {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* key:设备ip,value:当前设备下面的通道序号
|
* key:设备ip,value:当前设备下面的通道号
|
||||||
*/
|
*/
|
||||||
public static Map<String,List<String>> devMapMonitorNum = new ConcurrentHashMap<>();
|
public static Map<String, List<String>> devMapMonitorNum = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 所有参与检测的装置
|
* 所有参与检测的被检设备
|
||||||
*/
|
*/
|
||||||
public static List<PreDetection> devList = new ArrayList<>();
|
public static List<PreDetection> devList = new ArrayList<>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 所有参与检测的标准设备
|
||||||
|
*/
|
||||||
|
public static List<PreDetection> standardDevList = new ArrayList<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 所有参与检测的监测点
|
* 所有参与检测的监测点
|
||||||
*/
|
*/
|
||||||
public static List<String> monitorIdListComm = new ArrayList<>();
|
public static List<String> monitorIdListComm = new ArrayList<>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 所有参与检测的监测点。key:监测点id(ip_通道号),value:检测点实体
|
||||||
|
*/
|
||||||
|
public static Map<String, PreDetection.MonitorListDTO> monitorMap = new HashMap<>();
|
||||||
|
|
||||||
|
/**
|
||||||
//用于存储所有测点的实时数据
|
* 用于存储所有测点的实时数据
|
||||||
|
*/
|
||||||
public static List<DevData> realDataXiList = new ArrayList<>();
|
public static List<DevData> realDataXiList = new ArrayList<>();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* key:设备ip,value:装置名称
|
* key:设备ip,value:装置名称
|
||||||
*/
|
*/
|
||||||
public static Map<String, String> devNameMapComm = new HashMap<>();
|
public static Map<String, String> devNameMapComm = new HashMap<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* key:设备ip,value:装置id
|
* key:设备ip,value:装置id
|
||||||
*/
|
*/
|
||||||
public static Map<String, String> devIdMapComm = new HashMap<>();
|
public static Map<String, String> devIdMapComm = new HashMap<>();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 停止触发标识
|
* 停止触发标识
|
||||||
*/
|
*/
|
||||||
public static Boolean stopFlag = false;
|
public static Boolean stopFlag = false;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 已经暂停后的标识
|
* 已经暂停后的标识
|
||||||
*/
|
*/
|
||||||
public static Boolean hasStopFlag = false;
|
public static Boolean hasStopFlag = false;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 暂停后的超时计时时间
|
* 暂停后的超时计时时间
|
||||||
*/
|
*/
|
||||||
public static Integer stopTime = 0;
|
public static Integer stopTime = 0;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 强行赋值关系
|
* 强行赋值关系
|
||||||
*/
|
*/
|
||||||
public static Map<String,String> harmonicRelationMap = new HashMap<>();
|
public static Map<String, String> harmonicRelationMap = new HashMap<>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 当前正在检测的计划
|
||||||
|
*/
|
||||||
|
public static AdPlan currentTestPlan;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 比对式检测-检测项。
|
||||||
|
*/
|
||||||
|
public static List<String> testItemCodeList = new ArrayList<>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据处理原则
|
||||||
|
*/
|
||||||
|
public static DictDataEnum dataRule;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 所有参与比对式检测的被检设备、标准设备配对关系。key:标准设备id_通道号,value:被检设备id_通道号
|
||||||
|
*/
|
||||||
|
public static Map<String, String> pairsMap = HashBiMap.create();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 被检设备的数据。key:设备ip_通道号,value:DevData数据集合
|
||||||
|
*/
|
||||||
|
public static Map<String, List<DevData>> devDataMap = new HashMap<>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 标准设备的数据。key:设备ip_通道号,value:DevData数据集合
|
||||||
|
*/
|
||||||
|
public static Map<String, List<DevData>> standardDevDataMap = new HashMap<>();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.njcn.gather.detection.util.socket;
|
package com.njcn.gather.detection.util.socket;
|
||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import com.njcn.gather.plan.pojo.enums.DataSourceEnum;
|
||||||
import com.njcn.gather.script.pojo.po.SourceIssue;
|
import com.njcn.gather.script.pojo.po.SourceIssue;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
import io.netty.channel.nio.NioEventLoopGroup;
|
import io.netty.channel.nio.NioEventLoopGroup;
|
||||||
@@ -94,6 +95,10 @@ public class SocketManager {
|
|||||||
*/
|
*/
|
||||||
public static volatile Map<Integer,Long> clockMap = new ConcurrentHashMap<>();
|
public static volatile Map<Integer,Long> clockMap = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用于存储比对式测试时间。
|
||||||
|
*/
|
||||||
|
public static volatile Map<DataSourceEnum, Long> contrastClockMap = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -10,54 +10,54 @@ import java.util.Arrays;
|
|||||||
* @date 2025/3/27 14:58
|
* @date 2025/3/27 14:58
|
||||||
*/
|
*/
|
||||||
public class UnitUtil {
|
public class UnitUtil {
|
||||||
public static String unit(String code, Integer fly) {
|
// public static String unit(String code, Integer fly) {
|
||||||
String unit = "";
|
// String unit = "";
|
||||||
if (Arrays.asList(0, 1).contains(fly)) {
|
// if (Arrays.asList(0, 1).contains(fly)) {
|
||||||
if (DetectionCodeEnum.FREQ.getCode().equals(code)) {
|
// if (DetectionCodeEnum.FREQ.getCode().equals(code)) {
|
||||||
unit = "Hz";
|
// unit = "Hz";
|
||||||
}
|
// }
|
||||||
if (DetectionCodeEnum.VRMS.getCode().equals(code)) {
|
// if (DetectionCodeEnum.VRMS.getCode().equals(code)) {
|
||||||
unit = "V";
|
// unit = "V";
|
||||||
}
|
// }
|
||||||
if (DetectionCodeEnum.IRMS.getCode().equals(code)) {
|
// if (DetectionCodeEnum.IRMS.getCode().equals(code)) {
|
||||||
unit = "A";
|
// unit = "A";
|
||||||
}
|
// }
|
||||||
if (DetectionCodeEnum.V2_50.getCode().equals(code) ||
|
// if (DetectionCodeEnum.V2_50.getCode().equals(code) ||
|
||||||
DetectionCodeEnum.SV_1_49.getCode().equals(code)||
|
// DetectionCodeEnum.SV_1_49.getCode().equals(code)||
|
||||||
DetectionCodeEnum.V_UNBAN.getCode().equals(code) ||
|
// DetectionCodeEnum.V_UNBAN.getCode().equals(code) ||
|
||||||
DetectionCodeEnum.I_UNBAN.getCode().equals(code)
|
// DetectionCodeEnum.I_UNBAN.getCode().equals(code)
|
||||||
) {
|
// ) {
|
||||||
unit = "%";
|
// unit = "%";
|
||||||
}
|
// }
|
||||||
if (DetectionCodeEnum.I2_50.getCode().equals(code) ||
|
// if (DetectionCodeEnum.I2_50.getCode().equals(code) ||
|
||||||
DetectionCodeEnum.SI_1_49.getCode().equals(code)
|
// DetectionCodeEnum.SI_1_49.getCode().equals(code)
|
||||||
) {
|
// ) {
|
||||||
unit = "A";
|
// unit = "A";
|
||||||
}
|
// }
|
||||||
if (DetectionCodeEnum.P2_50.getCode().equals(code)) {
|
// if (DetectionCodeEnum.P2_50.getCode().equals(code)) {
|
||||||
unit = "W";
|
// unit = "W";
|
||||||
}
|
// }
|
||||||
if (DetectionCodeEnum.P.getCode().equals(code)) {
|
// if (DetectionCodeEnum.P.getCode().equals(code)) {
|
||||||
unit = "P";
|
// unit = "P";
|
||||||
}
|
// }
|
||||||
if (DetectionCodeEnum.MAG.getCode().equals(code)) {
|
// if (DetectionCodeEnum.MAG.getCode().equals(code)) {
|
||||||
unit = "V";
|
// unit = "V";
|
||||||
}
|
// }
|
||||||
if (DetectionCodeEnum.DUR.getCode().equals(code)) {
|
// if (DetectionCodeEnum.DUR.getCode().equals(code)) {
|
||||||
unit = "s";
|
// unit = "s";
|
||||||
}
|
// }
|
||||||
if (DetectionCodeEnum.VA.getCode().equals(code) ||
|
// if (DetectionCodeEnum.VA.getCode().equals(code) ||
|
||||||
DetectionCodeEnum.IA.getCode().equals(code)
|
// DetectionCodeEnum.IA.getCode().equals(code)
|
||||||
) {
|
// ) {
|
||||||
unit = "°";
|
// unit = "°";
|
||||||
}
|
// }
|
||||||
if (DetectionCodeEnum.DELTA_V.getCode().equals(code)
|
// if (DetectionCodeEnum.DELTA_V.getCode().equals(code)
|
||||||
) {
|
// ) {
|
||||||
unit = "%";
|
// unit = "%";
|
||||||
}
|
// }
|
||||||
}else{
|
// }else{
|
||||||
unit = "%";
|
// unit = "%";
|
||||||
}
|
// }
|
||||||
return unit;
|
// return unit;
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,13 +23,8 @@ import java.util.concurrent.TimeUnit;
|
|||||||
* @Description: 心跳处理类
|
* @Description: 心跳处理类
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
public class HeartbeatHandler extends SimpleChannelInboundHandler<String> {
|
public class HeartbeatHandler extends SimpleChannelInboundHandler<String> {
|
||||||
private final ScheduledExecutorService heartbeatExecutor = Executors.newScheduledThreadPool(1);
|
private final ScheduledExecutorService heartbeatExecutor = Executors.newScheduledThreadPool(1);
|
||||||
|
|
||||||
private final String dev = "_Dev";
|
|
||||||
private final String sourceTag = "_Source";
|
|
||||||
|
|
||||||
private final PreDetectionParam param;
|
private final PreDetectionParam param;
|
||||||
private final String handlerType;
|
private final String handlerType;
|
||||||
|
|
||||||
@@ -58,7 +53,7 @@ public class HeartbeatHandler extends SimpleChannelInboundHandler<String> {
|
|||||||
super.channelInactive(ctx);
|
super.channelInactive(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 每30秒发送一次心跳
|
// 每10秒发送一次心跳
|
||||||
private void scheduleHeartbeat(ChannelHandlerContext ctx) {
|
private void scheduleHeartbeat(ChannelHandlerContext ctx) {
|
||||||
heartbeatExecutor.scheduleAtFixedRate(() -> {
|
heartbeatExecutor.scheduleAtFixedRate(() -> {
|
||||||
if (ctx.channel().isActive()) {
|
if (ctx.channel().isActive()) {
|
||||||
@@ -74,7 +69,7 @@ public class HeartbeatHandler extends SimpleChannelInboundHandler<String> {
|
|||||||
if (consecutiveHeartbeatMisses >= MAX_HEARTBEAT_MISSES) {
|
if (consecutiveHeartbeatMisses >= MAX_HEARTBEAT_MISSES) {
|
||||||
// 连续三次未收到心跳响应,断开连接
|
// 连续三次未收到心跳响应,断开连接
|
||||||
System.out.println(handlerType + "连续三次未收到心跳响应,断开连接");
|
System.out.println(handlerType + "连续三次未收到心跳响应,断开连接");
|
||||||
if (dev.equals(handlerType)) {
|
if (CnSocketUtil.DEV_TAG.equals(handlerType)) {
|
||||||
//CnSocketUtil.sendToWebSocket(param.getUserPageId(),);
|
//CnSocketUtil.sendToWebSocket(param.getUserPageId(),);
|
||||||
CnSocketUtil.quitSend(param);
|
CnSocketUtil.quitSend(param);
|
||||||
} else {
|
} else {
|
||||||
@@ -86,7 +81,7 @@ public class HeartbeatHandler extends SimpleChannelInboundHandler<String> {
|
|||||||
Thread.currentThread().interrupt();
|
Thread.currentThread().interrupt();
|
||||||
System.err.println("线程中断异常: " + e.getMessage());
|
System.err.println("线程中断异常: " + e.getMessage());
|
||||||
}
|
}
|
||||||
String key = dev.equals(handlerType) ? param.getUserPageId() + dev : param.getUserPageId() + sourceTag;
|
String key = CnSocketUtil.DEV_TAG.equals(handlerType) ? param.getUserPageId() + CnSocketUtil.DEV_TAG : param.getUserPageId() + CnSocketUtil.SOURCE_TAG;
|
||||||
SocketManager.removeUser(key);
|
SocketManager.removeUser(key);
|
||||||
consecutiveHeartbeatMisses = 0; // 重置连续心跳丢失次数
|
consecutiveHeartbeatMisses = 0; // 重置连续心跳丢失次数
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,9 +31,6 @@ import java.util.concurrent.TimeUnit;
|
|||||||
@Getter
|
@Getter
|
||||||
public class NettyClient {
|
public class NettyClient {
|
||||||
|
|
||||||
private static final String dev = "_Dev";
|
|
||||||
private static final String source = "_Source";
|
|
||||||
|
|
||||||
public static void socketClient(String ip, Integer port, PreDetectionParam param, String msg, SimpleChannelInboundHandler<String> handler) {
|
public static void socketClient(String ip, Integer port, PreDetectionParam param, String msg, SimpleChannelInboundHandler<String> handler) {
|
||||||
NioEventLoopGroup group = new NioEventLoopGroup();
|
NioEventLoopGroup group = new NioEventLoopGroup();
|
||||||
Bootstrap bootstrap = new Bootstrap();
|
Bootstrap bootstrap = new Bootstrap();
|
||||||
@@ -52,7 +49,7 @@ public class NettyClient {
|
|||||||
// .addLast(new IdleStateHandler(0, 10, 0, TimeUnit.SECONDS))
|
// .addLast(new IdleStateHandler(0, 10, 0, TimeUnit.SECONDS))
|
||||||
.addLast(new StringDecoder(CharsetUtil.UTF_8))
|
.addLast(new StringDecoder(CharsetUtil.UTF_8))
|
||||||
.addLast(new StringEncoder(CharsetUtil.UTF_8))
|
.addLast(new StringEncoder(CharsetUtil.UTF_8))
|
||||||
.addLast(new HeartbeatHandler(param, source))
|
.addLast(new HeartbeatHandler(param, CnSocketUtil.SOURCE_TAG))
|
||||||
.addLast(handler);
|
.addLast(handler);
|
||||||
} else {
|
} else {
|
||||||
ch.pipeline()
|
ch.pipeline()
|
||||||
@@ -61,8 +58,11 @@ public class NettyClient {
|
|||||||
.addLast(new LineBasedFrameDecoder(10240))
|
.addLast(new LineBasedFrameDecoder(10240))
|
||||||
.addLast(new StringDecoder(CharsetUtil.UTF_8))
|
.addLast(new StringDecoder(CharsetUtil.UTF_8))
|
||||||
.addLast(new StringEncoder(CharsetUtil.UTF_8))
|
.addLast(new StringEncoder(CharsetUtil.UTF_8))
|
||||||
.addLast(new HeartbeatHandler(param, dev))
|
.addLast(new HeartbeatHandler(param, CnSocketUtil.DEV_TAG))
|
||||||
//空闲状态的handler
|
//空闲状态的handler
|
||||||
|
//readerIdleTimeSeconds:在指定的秒数内如果没有读取到任何数据,则触发IdleState.READER_IDLE事件。
|
||||||
|
//writerIdleTimeSeconds:在指定的秒数内如果没有写入任何数据,则触发IdleState.WRITER_IDLE事件。
|
||||||
|
//allIdleTimeSeconds:在指定的秒数内如果没有发生任何读取或写入操作,则触发IdleState.ALL_IDLE事件。
|
||||||
.addLast(new IdleStateHandler(60, 0, 0, TimeUnit.SECONDS))
|
.addLast(new IdleStateHandler(60, 0, 0, TimeUnit.SECONDS))
|
||||||
.addLast(handler);
|
.addLast(handler);
|
||||||
}
|
}
|
||||||
@@ -78,17 +78,17 @@ public class NettyClient {
|
|||||||
} else {
|
} else {
|
||||||
System.out.println("链接服务端成功...");
|
System.out.println("链接服务端成功...");
|
||||||
if (handler instanceof NettySourceClientHandler) {
|
if (handler instanceof NettySourceClientHandler) {
|
||||||
NioEventLoopGroup groupByUserId = SocketManager.getGroupByUserId(param.getUserPageId() + source);
|
NioEventLoopGroup groupByUserId = SocketManager.getGroupByUserId(param.getUserPageId() + CnSocketUtil.SOURCE_TAG);
|
||||||
if(ObjectUtil.isNotNull(groupByUserId)){
|
if (ObjectUtil.isNotNull(groupByUserId)) {
|
||||||
groupByUserId.shutdownGracefully().sync();
|
groupByUserId.shutdownGracefully().sync();
|
||||||
}
|
}
|
||||||
SocketManager.addGroup(param.getUserPageId() + source, group);
|
SocketManager.addGroup(param.getUserPageId() + CnSocketUtil.SOURCE_TAG, group);
|
||||||
} else {
|
} else {
|
||||||
NioEventLoopGroup groupByUserId = SocketManager.getGroupByUserId(param.getUserPageId() + dev);
|
NioEventLoopGroup groupByUserId = SocketManager.getGroupByUserId(param.getUserPageId() + CnSocketUtil.DEV_TAG);
|
||||||
if(ObjectUtil.isNotNull(groupByUserId)){
|
if (ObjectUtil.isNotNull(groupByUserId)) {
|
||||||
groupByUserId.shutdownGracefully().sync();
|
groupByUserId.shutdownGracefully().sync();
|
||||||
}
|
}
|
||||||
SocketManager.addGroup(param.getUserPageId() + dev, group);
|
SocketManager.addGroup(param.getUserPageId() + CnSocketUtil.DEV_TAG, group);
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println("客户端向服务端发送消息:" + port + msg);
|
System.out.println("客户端向服务端发送消息:" + port + msg);
|
||||||
@@ -106,9 +106,12 @@ public class NettyClient {
|
|||||||
socketDataMsg.setRequestId("connect");
|
socketDataMsg.setRequestId("connect");
|
||||||
if (handler instanceof NettySourceClientHandler) {
|
if (handler instanceof NettySourceClientHandler) {
|
||||||
socketDataMsg.setOperateCode("Source");
|
socketDataMsg.setOperateCode("Source");
|
||||||
} else {
|
} else if (handler instanceof NettyDevClientHandler) {
|
||||||
CnSocketUtil.quitSendSource(param);
|
CnSocketUtil.quitSendSource(param);
|
||||||
socketDataMsg.setOperateCode("Dev");
|
socketDataMsg.setOperateCode("Dev");
|
||||||
|
} else {
|
||||||
|
socketDataMsg.setOperateCode("Dev");
|
||||||
|
CnSocketUtil.quitSend(param);
|
||||||
}
|
}
|
||||||
WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(socketDataMsg));
|
WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(socketDataMsg));
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
@@ -0,0 +1,181 @@
|
|||||||
|
package com.njcn.gather.detection.util.socket.cilent;
|
||||||
|
|
||||||
|
import com.njcn.gather.detection.handler.SocketContrastResponseService;
|
||||||
|
import com.njcn.gather.detection.pojo.enums.SourceOperateCodeEnum;
|
||||||
|
import com.njcn.gather.detection.pojo.param.PreDetectionParam;
|
||||||
|
import com.njcn.gather.detection.util.socket.CnSocketUtil;
|
||||||
|
import com.njcn.gather.detection.util.socket.SocketManager;
|
||||||
|
import com.njcn.gather.plan.pojo.enums.DataSourceEnum;
|
||||||
|
import io.netty.channel.Channel;
|
||||||
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
|
import io.netty.channel.SimpleChannelInboundHandler;
|
||||||
|
import io.netty.handler.timeout.IdleState;
|
||||||
|
import io.netty.handler.timeout.IdleStateEvent;
|
||||||
|
import io.netty.handler.timeout.TimeoutException;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.ConnectException;
|
||||||
|
import java.net.ProtocolException;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author caozehui
|
||||||
|
* @data 2025-07-25
|
||||||
|
*/
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class NettyContrastClientHandler extends SimpleChannelInboundHandler<String> {
|
||||||
|
|
||||||
|
|
||||||
|
private final PreDetectionParam param;
|
||||||
|
private final SocketContrastResponseService socketContrastResponseService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void channelActive(ChannelHandlerContext ctx) throws Exception {
|
||||||
|
System.out.println("客户端通道已建立" + ctx.channel().id());
|
||||||
|
Channel channel = SocketManager.getChannelByUserId(param.getUserPageId() + CnSocketUtil.DEV_TAG);
|
||||||
|
if (Objects.nonNull(channel)) {
|
||||||
|
try {
|
||||||
|
channel.close().sync();
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SocketManager.addUser(param.getUserPageId() + CnSocketUtil.DEV_TAG, ctx.channel());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void channelRead0(ChannelHandlerContext ctx, String msg) throws InterruptedException {
|
||||||
|
System.out.println("contrastClientHandler接收server端数据>>>>>>" + msg);
|
||||||
|
try {
|
||||||
|
socketContrastResponseService.deal(param, msg);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
CnSocketUtil.quitSend(param);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
|
||||||
|
System.out.println("与通信模块端断线");
|
||||||
|
ctx.close();
|
||||||
|
SocketManager.removeUser(param.getUserPageId() + CnSocketUtil.DEV_TAG);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户事件的回调方法(自定义事件用于心跳机制)
|
||||||
|
*
|
||||||
|
* @param ctx
|
||||||
|
* @param evt
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) {
|
||||||
|
if (evt instanceof IdleStateEvent) { //IdleState.在一段时间内没有收到任何消息时,会触发该事件
|
||||||
|
if (((IdleStateEvent) evt).state() == IdleState.READER_IDLE) {
|
||||||
|
System.out.println(LocalDateTime.now() + "contrastClientHandler触发读超时函数**************************************");
|
||||||
|
SocketManager.contrastClockMap.put(DataSourceEnum.REAL_DATA, SocketManager.contrastClockMap.get(DataSourceEnum.REAL_DATA) + 60L);
|
||||||
|
|
||||||
|
//实时数据
|
||||||
|
if (SocketManager.contrastClockMap.get(DataSourceEnum.REAL_DATA) >= 60) {
|
||||||
|
CnSocketUtil.quitSend(param);
|
||||||
|
System.out.println("超时处理-----》" + "实时数据已超时----------------关闭");
|
||||||
|
timeoutSend();
|
||||||
|
}
|
||||||
|
// if (!FormalTestManager.hasStopFlag) {
|
||||||
|
// if (CollUtil.isNotEmpty(SocketManager.getSourceList())) {
|
||||||
|
// SourceIssue sourceIssue = SocketManager.getSourceList().get(0);
|
||||||
|
// if (SocketManager.clockMap.containsKey(sourceIssue.getIndex())) {
|
||||||
|
// SocketManager.clockMap.put(sourceIssue.getIndex(), SocketManager.clockMap.get(sourceIssue.getIndex()) + 60L);
|
||||||
|
// } else {
|
||||||
|
// SocketManager.clockMap.put(sourceIssue.getIndex(), 60L);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if (sourceIssue.getType().equals(DicDataEnum.F.getCode())) {
|
||||||
|
// //闪变,正常抛一轮最大等待20分钟超时
|
||||||
|
// if (SocketManager.clockMap.get(sourceIssue.getIndex()) > 1300) {
|
||||||
|
// fly = true;
|
||||||
|
// System.out.println("超时处理-----》" + sourceIssue.getType() + "已超时----------------关闭");
|
||||||
|
// CnSocketUtil.quitSend(param);
|
||||||
|
// timeoutSend(sourceIssue);
|
||||||
|
// }
|
||||||
|
// } else if (sourceIssue.getType().equals(DicDataEnum.VOLTAGE.getCode()) || sourceIssue.getType().equals(DicDataEnum.HP.getCode())) {
|
||||||
|
// //统计数据项,正常抛一轮数据,超时
|
||||||
|
// if (SocketManager.clockMap.get(sourceIssue.getIndex()) > 180) {
|
||||||
|
// fly = true;
|
||||||
|
// CnSocketUtil.quitSend(param);
|
||||||
|
// System.out.println("超时处理-----》" + sourceIssue.getType() + "已超时----------------关闭");
|
||||||
|
// timeoutSend(sourceIssue);
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// //实时数据
|
||||||
|
// if (SocketManager.clockMap.get(sourceIssue.getIndex()) > 60) {
|
||||||
|
// fly = true;
|
||||||
|
// CnSocketUtil.quitSend(param);
|
||||||
|
// System.out.println("超时处理-----》" + sourceIssue.getType() + "已超时----------------关闭");
|
||||||
|
// timeoutSend(sourceIssue);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// fly = true;
|
||||||
|
// //为空则认为是常规步骤,设定一分钟超时
|
||||||
|
// CnSocketUtil.quitSend(param);
|
||||||
|
// CnSocketUtil.sendToWebSocket(param.getUserPageId(), SourceOperateCodeEnum.SOCKET_TIMEOUT.getValue(), SourceOperateCodeEnum.SOCKET_TIMEOUT.getValue(), SourceOperateCodeEnum.SOCKET_TIMEOUT.getMsg(), null);
|
||||||
|
// }
|
||||||
|
// if (fly) {
|
||||||
|
// socketContrastResponseService.backCheckState(param);
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// //如果是暂停操作后
|
||||||
|
// FormalTestManager.stopTime += 60;
|
||||||
|
// System.out.println("当前进入暂停操作超时函数-----------------" + FormalTestManager.stopTime);
|
||||||
|
// if (FormalTestManager.stopTime > 600) {
|
||||||
|
// CnSocketUtil.quitSend(param);
|
||||||
|
// CnSocketUtil.sendToWebSocket(param.getUserPageId(), SourceOperateCodeEnum.FORMAL_REAL.getValue(), SourceOperateCodeEnum.STOP_TIMEOUT.getValue(), SourceOperateCodeEnum.STOP_TIMEOUT.getMsg(), null);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handlerAdded(ChannelHandlerContext ctx) {
|
||||||
|
System.out.println("有通道准备接入" + ctx.channel());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
|
||||||
|
System.out.println("捕获到通信模块服务异常。。。。。。。");
|
||||||
|
// 处理异常,例如记录日志、关闭连接等
|
||||||
|
cause.printStackTrace();
|
||||||
|
// 根据异常类型进行不同的处理
|
||||||
|
if (cause instanceof ConnectException) {
|
||||||
|
System.out.println("连接socket服务端异常");
|
||||||
|
} else if (cause instanceof IOException) {
|
||||||
|
System.out.println("IOException caught: There was an I/O error.");
|
||||||
|
CnSocketUtil.sendToWebSocket(param.getUserPageId(), SourceOperateCodeEnum.DEVICE_ERROR.getValue(), SourceOperateCodeEnum.DEVICE_ERROR.getValue(), SourceOperateCodeEnum.DEVICE_ERROR.getMsg(), null);
|
||||||
|
} else if (cause instanceof TimeoutException) {
|
||||||
|
System.out.println("TimeoutException caught: Operation timed out.");
|
||||||
|
} else if (cause instanceof ProtocolException) {
|
||||||
|
System.out.println("ProtocolException caught: Invalid protocol message.");
|
||||||
|
} else {
|
||||||
|
// 处理其他类型的异常
|
||||||
|
System.out.println("Unknown exception caught: " + cause.getMessage());
|
||||||
|
CnSocketUtil.sendToWebSocket(param.getUserPageId(), SourceOperateCodeEnum.DEVICE_ERROR.getValue(), SourceOperateCodeEnum.DEVICE_ERROR.getValue(), SourceOperateCodeEnum.DEVICE_ERROR.getMsg(), null);
|
||||||
|
}
|
||||||
|
CnSocketUtil.quitSend(param);
|
||||||
|
// socketContrastResponseService.backCheckState(param);
|
||||||
|
ctx.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 接收数据超时处理
|
||||||
|
*/
|
||||||
|
private void timeoutSend() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -6,10 +6,11 @@ import com.njcn.gather.detection.handler.SocketDevResponseService;
|
|||||||
import com.njcn.gather.detection.pojo.enums.SourceOperateCodeEnum;
|
import com.njcn.gather.detection.pojo.enums.SourceOperateCodeEnum;
|
||||||
import com.njcn.gather.detection.pojo.param.PreDetectionParam;
|
import com.njcn.gather.detection.pojo.param.PreDetectionParam;
|
||||||
import com.njcn.gather.detection.pojo.vo.DevLineTestResult;
|
import com.njcn.gather.detection.pojo.vo.DevLineTestResult;
|
||||||
import com.njcn.gather.detection.pojo.vo.SocketDataMsg;
|
|
||||||
import com.njcn.gather.detection.pojo.vo.SocketMsg;
|
|
||||||
import com.njcn.gather.detection.pojo.vo.WebSocketVO;
|
import com.njcn.gather.detection.pojo.vo.WebSocketVO;
|
||||||
import com.njcn.gather.detection.util.socket.*;
|
import com.njcn.gather.detection.util.socket.CnSocketUtil;
|
||||||
|
import com.njcn.gather.detection.util.socket.FormalTestManager;
|
||||||
|
import com.njcn.gather.detection.util.socket.SocketManager;
|
||||||
|
import com.njcn.gather.detection.util.socket.WebServiceManager;
|
||||||
import com.njcn.gather.device.pojo.vo.PreDetection;
|
import com.njcn.gather.device.pojo.vo.PreDetection;
|
||||||
import com.njcn.gather.script.pojo.po.SourceIssue;
|
import com.njcn.gather.script.pojo.po.SourceIssue;
|
||||||
import com.njcn.gather.system.pojo.enums.DicDataEnum;
|
import com.njcn.gather.system.pojo.enums.DicDataEnum;
|
||||||
@@ -25,11 +26,9 @@ import java.io.IOException;
|
|||||||
import java.net.ConnectException;
|
import java.net.ConnectException;
|
||||||
import java.net.ProtocolException;
|
import java.net.ProtocolException;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
import java.util.List;
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.Objects;
|
||||||
import java.util.concurrent.ScheduledThreadPoolExecutor;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -41,8 +40,6 @@ import java.util.concurrent.TimeUnit;
|
|||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class NettyDevClientHandler extends SimpleChannelInboundHandler<String> {
|
public class NettyDevClientHandler extends SimpleChannelInboundHandler<String> {
|
||||||
|
|
||||||
private final String dev = "_Dev";
|
|
||||||
|
|
||||||
private final PreDetectionParam param;
|
private final PreDetectionParam param;
|
||||||
|
|
||||||
private final SocketDevResponseService socketResponseService;
|
private final SocketDevResponseService socketResponseService;
|
||||||
@@ -56,7 +53,7 @@ public class NettyDevClientHandler extends SimpleChannelInboundHandler<String> {
|
|||||||
@Override
|
@Override
|
||||||
public void channelActive(ChannelHandlerContext ctx) throws Exception {
|
public void channelActive(ChannelHandlerContext ctx) throws Exception {
|
||||||
System.out.println("客户端通道已建立" + ctx.channel().id());
|
System.out.println("客户端通道已建立" + ctx.channel().id());
|
||||||
Channel channel = SocketManager.getChannelByUserId(param.getUserPageId() + dev);
|
Channel channel = SocketManager.getChannelByUserId(param.getUserPageId() + CnSocketUtil.DEV_TAG);
|
||||||
if (Objects.nonNull(channel)) {
|
if (Objects.nonNull(channel)) {
|
||||||
try {
|
try {
|
||||||
channel.close().sync();
|
channel.close().sync();
|
||||||
@@ -64,7 +61,7 @@ public class NettyDevClientHandler extends SimpleChannelInboundHandler<String> {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SocketManager.addUser(param.getUserPageId() + dev, ctx.channel());
|
SocketManager.addUser(param.getUserPageId() + CnSocketUtil.DEV_TAG, ctx.channel());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -79,8 +76,6 @@ public class NettyDevClientHandler extends SimpleChannelInboundHandler<String> {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
CnSocketUtil.quitSend(param);
|
CnSocketUtil.quitSend(param);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -92,7 +87,7 @@ public class NettyDevClientHandler extends SimpleChannelInboundHandler<String> {
|
|||||||
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
|
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
|
||||||
System.out.println("设备通讯客户端断线");
|
System.out.println("设备通讯客户端断线");
|
||||||
ctx.close();
|
ctx.close();
|
||||||
SocketManager.removeUser(param.getUserPageId() + dev);
|
SocketManager.removeUser(param.getUserPageId() + CnSocketUtil.DEV_TAG);
|
||||||
CnSocketUtil.quitSendSource(param);
|
CnSocketUtil.quitSendSource(param);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -105,7 +100,7 @@ public class NettyDevClientHandler extends SimpleChannelInboundHandler<String> {
|
|||||||
@Override
|
@Override
|
||||||
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) {
|
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) {
|
||||||
Boolean fly = false;
|
Boolean fly = false;
|
||||||
if (evt instanceof IdleStateEvent) {
|
if (evt instanceof IdleStateEvent) { //IdleState.在一段时间内没有收到任何消息时,会触发该事件
|
||||||
if (((IdleStateEvent) evt).state() == IdleState.READER_IDLE) {
|
if (((IdleStateEvent) evt).state() == IdleState.READER_IDLE) {
|
||||||
System.out.println(LocalDateTime.now() + "devHandler触发读超时函数**************************************");
|
System.out.println(LocalDateTime.now() + "devHandler触发读超时函数**************************************");
|
||||||
if (!FormalTestManager.hasStopFlag) {
|
if (!FormalTestManager.hasStopFlag) {
|
||||||
@@ -243,7 +238,7 @@ public class NettyDevClientHandler extends SimpleChannelInboundHandler<String> {
|
|||||||
devListRes.add(devLineTestResult);
|
devListRes.add(devLineTestResult);
|
||||||
});
|
});
|
||||||
WebSocketVO<List<DevLineTestResult>> socketVO = new WebSocketVO<>();
|
WebSocketVO<List<DevLineTestResult>> socketVO = new WebSocketVO<>();
|
||||||
socketVO.setRequestId(sourceIssue.getType() + "_End");
|
socketVO.setRequestId(sourceIssue.getType() + CnSocketUtil.END_TAG);
|
||||||
socketVO.setOperateCode(sourceIssue.getType());
|
socketVO.setOperateCode(sourceIssue.getType());
|
||||||
socketVO.setData(devListRes);
|
socketVO.setData(devListRes);
|
||||||
WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(socketVO));
|
WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(socketVO));
|
||||||
|
|||||||
@@ -1,16 +1,10 @@
|
|||||||
package com.njcn.gather.detection.util.socket.cilent;
|
package com.njcn.gather.detection.util.socket.cilent;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
|
||||||
import com.njcn.gather.detection.handler.SocketSourceResponseService;
|
import com.njcn.gather.detection.handler.SocketSourceResponseService;
|
||||||
import com.njcn.gather.detection.pojo.enums.SourceOperateCodeEnum;
|
import com.njcn.gather.detection.pojo.enums.SourceOperateCodeEnum;
|
||||||
import com.njcn.gather.detection.pojo.param.PreDetectionParam;
|
import com.njcn.gather.detection.pojo.param.PreDetectionParam;
|
||||||
import com.njcn.gather.detection.pojo.vo.SocketDataMsg;
|
|
||||||
import com.njcn.gather.detection.pojo.vo.SocketMsg;
|
|
||||||
import com.njcn.gather.detection.pojo.vo.WebSocketVO;
|
|
||||||
import com.njcn.gather.detection.util.socket.CnSocketUtil;
|
import com.njcn.gather.detection.util.socket.CnSocketUtil;
|
||||||
import com.njcn.gather.detection.util.socket.MsgUtil;
|
|
||||||
import com.njcn.gather.detection.util.socket.SocketManager;
|
import com.njcn.gather.detection.util.socket.SocketManager;
|
||||||
import io.netty.channel.Channel;
|
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.SimpleChannelInboundHandler;
|
import io.netty.channel.SimpleChannelInboundHandler;
|
||||||
import io.netty.handler.timeout.IdleState;
|
import io.netty.handler.timeout.IdleState;
|
||||||
@@ -21,7 +15,6 @@ import lombok.RequiredArgsConstructor;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.ConnectException;
|
import java.net.ConnectException;
|
||||||
import java.net.ProtocolException;
|
import java.net.ProtocolException;
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -71,10 +64,10 @@ public class NettySourceClientHandler extends SimpleChannelInboundHandler<String
|
|||||||
* @param ctx
|
* @param ctx
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void channelInactive(ChannelHandlerContext ctx) throws Exception{
|
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
|
||||||
System.out.println("源通讯客户端断线");
|
System.out.println("源通讯客户端断线");
|
||||||
ctx.close();
|
ctx.close();
|
||||||
SocketManager.removeUser(webUser.getUserPageId()+sourceTag);
|
SocketManager.removeUser(webUser.getUserPageId() + sourceTag);
|
||||||
// System.out.println("断线了......" + ctx.channel());
|
// System.out.println("断线了......" + ctx.channel());
|
||||||
// ctx.channel().eventLoop().schedule(() -> {
|
// ctx.channel().eventLoop().schedule(() -> {
|
||||||
// System.out.println("断线重连......");
|
// System.out.println("断线重连......");
|
||||||
@@ -125,7 +118,7 @@ public class NettySourceClientHandler extends SimpleChannelInboundHandler<String
|
|||||||
|
|
||||||
} else if (cause instanceof IOException) {
|
} else if (cause instanceof IOException) {
|
||||||
// 处理I/O异常,例如读写错误
|
// 处理I/O异常,例如读写错误
|
||||||
CnSocketUtil.sendToWebSocket(webUser.getUserPageId(),SourceOperateCodeEnum.SERVER_ERROR.getValue(),SourceOperateCodeEnum.SERVER_ERROR.getValue(),SourceOperateCodeEnum.SERVER_ERROR.getMsg(),null );
|
CnSocketUtil.sendToWebSocket(webUser.getUserPageId(), SourceOperateCodeEnum.SERVER_ERROR.getValue(), SourceOperateCodeEnum.SERVER_ERROR.getValue(), SourceOperateCodeEnum.SERVER_ERROR.getMsg(), null);
|
||||||
|
|
||||||
// 例如,可以记录更详细的I/O错误信息
|
// 例如,可以记录更详细的I/O错误信息
|
||||||
} else if (cause instanceof TimeoutException) {
|
} else if (cause instanceof TimeoutException) {
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package com.njcn.gather.device.controller;
|
package com.njcn.gather.device.controller;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
|
||||||
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.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
@@ -11,10 +10,11 @@ import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
|||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
import com.njcn.common.utils.LogUtil;
|
import com.njcn.common.utils.LogUtil;
|
||||||
|
import com.njcn.gather.device.pojo.enums.CommonEnum;
|
||||||
import com.njcn.gather.device.pojo.param.PqDevParam;
|
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.PqDevVO;
|
||||||
import com.njcn.gather.device.service.IPqDevService;
|
import com.njcn.gather.device.service.IPqDevService;
|
||||||
|
import com.njcn.gather.plan.pojo.po.AdPlan;
|
||||||
import com.njcn.gather.type.pojo.po.DevType;
|
import com.njcn.gather.type.pojo.po.DevType;
|
||||||
import com.njcn.gather.type.service.IDevTypeService;
|
import com.njcn.gather.type.service.IDevTypeService;
|
||||||
import com.njcn.web.controller.BaseController;
|
import com.njcn.web.controller.BaseController;
|
||||||
@@ -129,8 +129,8 @@ public class PqDevController extends BaseController {
|
|||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.DOWNLOAD)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.DOWNLOAD)
|
||||||
@PostMapping("/downloadTemplate")
|
@PostMapping("/downloadTemplate")
|
||||||
@ApiOperation("下载被检设备导入文件模板")
|
@ApiOperation("下载被检设备导入文件模板")
|
||||||
public void downloadTemplate() {
|
public void downloadTemplate(@RequestBody PqDevParam pqDevParam) {
|
||||||
pqDevService.downloadTemplate();
|
pqDevService.downloadTemplate(pqDevParam.getPattern());
|
||||||
}
|
}
|
||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.UPLOAD)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.UPLOAD)
|
||||||
@@ -140,15 +140,22 @@ public class PqDevController extends BaseController {
|
|||||||
@ApiImplicitParam(name = "file", value = "被检设备数据文件", required = true),
|
@ApiImplicitParam(name = "file", value = "被检设备数据文件", required = true),
|
||||||
@ApiImplicitParam(name = "patternId", value = "模式id", 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, @RequestParam("planId") String planId, HttpServletResponse response) {
|
||||||
String methodDescribe = getMethodDescribe("importDev");
|
String methodDescribe = getMethodDescribe("importDev");
|
||||||
LogUtil.njcnDebug(log, "{},上传文件为:{}", methodDescribe, file.getOriginalFilename());
|
LogUtil.njcnDebug(log, "{},上传文件为:{}", methodDescribe, file.getOriginalFilename());
|
||||||
boolean fileType = FileUtil.judgeFileIsExcel(file.getOriginalFilename());
|
boolean fileType = FileUtil.judgeFileIsExcel(file.getOriginalFilename());
|
||||||
if (!fileType) {
|
if (!fileType) {
|
||||||
throw new BusinessException(CommonResponseEnum.FILE_XLSX_ERROR);
|
throw new BusinessException(CommonResponseEnum.FILE_XLSX_ERROR);
|
||||||
}
|
}
|
||||||
pqDevService.importDev(file, patternId, null, response);
|
if("null".equals(planId)){
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
planId = null;
|
||||||
|
}
|
||||||
|
Boolean result = pqDevService.importDev(file, patternId, planId, response);
|
||||||
|
if (result) {
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||||
|
} else {
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@@ -162,24 +169,12 @@ public class PqDevController extends BaseController {
|
|||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo
|
||||||
@PostMapping("/listByPlanId")
|
@GetMapping("/getSelectOptions")
|
||||||
@ApiOperation("查询出所有已绑定的设备")
|
@ApiOperation("根据历史记录信息来获取下拉框内容")
|
||||||
@ApiImplicitParam(name = "planId", value = "计划id", required = true)
|
public HttpResult<Map<String, List<String>>> getSelectOptions(@RequestParam("pattern") String pattern) {
|
||||||
public HttpResult<List<PqDevVO>> listByPlanId(@RequestBody @Validated PqDevParam.QueryParam param) {
|
String methodDescribe = getMethodDescribe("getSelectOptions");
|
||||||
String methodDescribe = getMethodDescribe("listByPlanId");
|
Map<String, List<String>> result = pqDevService.listSelectOptions(pattern);
|
||||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, param);
|
|
||||||
List<PqDev> pqDevList = pqDevService.listByPlanId(param);
|
|
||||||
|
|
||||||
List<PqDevVO> result = BeanUtil.copyToList(pqDevList, PqDevVO.class);
|
|
||||||
result.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, result, methodDescribe);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,164 @@
|
|||||||
|
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.DataStateEnum;
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
@OperateInfo
|
||||||
|
@GetMapping("/getAll")
|
||||||
|
@ApiOperation("获取所有标准设备")
|
||||||
|
public HttpResult<List<PqStandardDev>> getAll() {
|
||||||
|
String methodDescribe = getMethodDescribe("getAll");
|
||||||
|
LogUtil.njcnDebug(log, "{},查询所有数据", methodDescribe);
|
||||||
|
List<PqStandardDev> result = pqStandardDevService.lambdaQuery().eq(PqStandardDev::getState, DataStateEnum.ENABLE.getCode()).list();
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/listByPlanId")
|
||||||
|
@ApiOperation("查询出指定计划已关联的标准设备")
|
||||||
|
@ApiImplicitParam(name = "planId", value = "计划id", required = true)
|
||||||
|
public HttpResult<List<PqStandardDev>> listByPlanId(@RequestParam("planId") String planId) {
|
||||||
|
String methodDescribe = getMethodDescribe("listByPlanId");
|
||||||
|
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, planId);
|
||||||
|
List<PqStandardDev> pqDevVOList = pqStandardDevService.listByPlanId(planId);
|
||||||
|
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, pqDevVOList, methodDescribe);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -1,7 +1,9 @@
|
|||||||
package com.njcn.gather.device.mapper;
|
package com.njcn.gather.device.mapper;
|
||||||
|
|
||||||
import com.github.yulichang.base.MPJBaseMapper;
|
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.po.PqDev;
|
||||||
|
import com.njcn.gather.device.pojo.vo.PqDevVO;
|
||||||
import com.njcn.gather.device.pojo.vo.PreDetection;
|
import com.njcn.gather.device.pojo.vo.PreDetection;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
@@ -47,6 +49,12 @@ public interface PqDevMapper extends MPJBaseMapper<PqDev> {
|
|||||||
*
|
*
|
||||||
* @param planId
|
* @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,18 @@
|
|||||||
|
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
|
||||||
|
* @date 2025-05-09
|
||||||
|
*/
|
||||||
|
public interface PqStandardDevMapper extends MPJBaseMapper<PqStandardDev> {
|
||||||
|
|
||||||
|
List<PreDetection> listStandardDevPreDetection(@Param("devIds") List<String> ids);
|
||||||
|
}
|
||||||
|
|
||||||
@@ -4,17 +4,17 @@
|
|||||||
|
|
||||||
<!-- 通用查询映射结果 -->
|
<!-- 通用查询映射结果 -->
|
||||||
<resultMap id="DevResultMap" type="com.njcn.gather.device.pojo.vo.PreDetection">
|
<resultMap id="DevResultMap" type="com.njcn.gather.device.pojo.vo.PreDetection">
|
||||||
<id column="Id" property="devId" />
|
<id column="Id" property="devId"/>
|
||||||
<id column="Name" property="devName" />
|
<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"/>
|
||||||
<result column="Series" property="devCode" />
|
<result column="Series" property="devCode"/>
|
||||||
<result column="Dev_Key" property="devKey" />
|
<result column="Dev_Key" property="devKey"/>
|
||||||
<result column="icdType" property="icdType" />
|
<result column="icdType" property="icdType"/>
|
||||||
<result column="Dev_Chns" property="devChns" />
|
<result column="Dev_Chns" property="devChns"/>
|
||||||
<result column="Dev_Volt" property="devVolt" />
|
<result column="Dev_Volt" property="devVolt"/>
|
||||||
<result column="Dev_Curr" property="devCurr" />
|
<result column="Dev_Curr" property="devCurr"/>
|
||||||
|
|
||||||
<collection
|
<collection
|
||||||
property="monitorList"
|
property="monitorList"
|
||||||
@@ -50,24 +50,84 @@
|
|||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<update id="finishPlan" >
|
<update id="finishPlan">
|
||||||
update ad_plan set Test_State = 2 where id = #{planId}
|
update ad_plan
|
||||||
|
set Test_State = 2
|
||||||
|
where id = #{planId}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<update id="updateReportState" >
|
<update id="updateReportState">
|
||||||
update pq_dev set Report_State = 1 where id = #{id}
|
update pq_dev
|
||||||
|
set Report_State = 1
|
||||||
|
where id = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<update id="updatePlanCheckResult">
|
<update id="updatePlanCheckResult">
|
||||||
update ad_plan set Result = #{checkResult} where id = #{planId}
|
update ad_plan
|
||||||
|
set Result = #{checkResult}
|
||||||
|
where id = #{planId}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<update id="updatePlanTestState">
|
<update id="updatePlanTestState">
|
||||||
update ad_plan set Test_State = #{testState} where id = #{planId}
|
update ad_plan
|
||||||
|
set Test_State = #{testState}
|
||||||
|
where id = #{planId}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<select id="getScriptIdByPlanId" resultType="java.lang.String">
|
<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="planIdList!= null and planIdList.size!=0">
|
||||||
|
AND dev.Plan_Id in
|
||||||
|
<foreach collection="planIdList" open="(" close=")" item="item" separator=",">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
</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>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?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">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.njcn.gather.storage.mapper.AdNonHarmonicMapper">
|
<mapper namespace="com.njcn.gather.device.mapper.PqDevSubMapper">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
<?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">
|
||||||
|
|
||||||
|
<!-- 通用查询映射结果 -->
|
||||||
|
<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>
|
||||||
|
|
||||||
@@ -6,12 +6,14 @@ import com.njcn.gather.pojo.constant.DetectionValidMessage;
|
|||||||
import com.njcn.web.pojo.annotation.DateTimeStrValid;
|
import com.njcn.web.pojo.annotation.DateTimeStrValid;
|
||||||
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;
|
||||||
import org.hibernate.validator.constraints.Range;
|
import org.hibernate.validator.constraints.Range;
|
||||||
|
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
import javax.validation.constraints.*;
|
import javax.validation.constraints.*;
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -30,7 +32,7 @@ public class PqDevParam {
|
|||||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.PATTERN_FORMAT_ERROR)
|
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.PATTERN_FORMAT_ERROR)
|
||||||
private String pattern;
|
private String pattern;
|
||||||
|
|
||||||
@ApiModelProperty(value = "设备类型,字典表", required = true)
|
@ApiModelProperty(value = "设备类型", required = true)
|
||||||
@NotBlank(message = DetectionValidMessage.DEV_TYPE_NOT_BLANK)
|
@NotBlank(message = DetectionValidMessage.DEV_TYPE_NOT_BLANK)
|
||||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.DEV_TYPE_FORMAT_ERROR)
|
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.DEV_TYPE_FORMAT_ERROR)
|
||||||
private String devType;
|
private String devType;
|
||||||
@@ -98,13 +100,13 @@ public class PqDevParam {
|
|||||||
@ApiModelProperty("报告路径")
|
@ApiModelProperty("报告路径")
|
||||||
private String reportPath;
|
private String reportPath;
|
||||||
|
|
||||||
@ApiModelProperty("设备关键信息二维码")
|
// @ApiModelProperty("设备关键信息二维码")
|
||||||
private String qrCode;
|
// private String qrCode;
|
||||||
|
|
||||||
@ApiModelProperty(value = "检测次数,默认为0", required = true)
|
// @ApiModelProperty(value = "检测次数,默认为0", required = true)
|
||||||
@NotNull(message = DetectionValidMessage.RECHECK_NUM_NOT_NULL)
|
// @NotNull(message = DetectionValidMessage.RECHECK_NUM_NOT_NULL)
|
||||||
@Min(value = 0, message = DetectionValidMessage.RECHECK_NUM_FORMAT_ERROR)
|
// @Min(value = 0, message = DetectionValidMessage.RECHECK_NUM_FORMAT_ERROR)
|
||||||
private Integer reCheckNum;
|
// private Integer reCheckNum;
|
||||||
|
|
||||||
@ApiModelProperty("是否支持系数校准")
|
@ApiModelProperty("是否支持系数校准")
|
||||||
private Integer factorFlag;
|
private Integer factorFlag;
|
||||||
@@ -122,6 +124,19 @@ public class PqDevParam {
|
|||||||
@ApiModelProperty("委托方")
|
@ApiModelProperty("委托方")
|
||||||
private String delegate;
|
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;
|
||||||
/**
|
/**
|
||||||
* 更新操作实体
|
* 更新操作实体
|
||||||
*/
|
*/
|
||||||
@@ -151,7 +166,7 @@ public class PqDevParam {
|
|||||||
private String manufacturer;
|
private String manufacturer;
|
||||||
|
|
||||||
@ApiModelProperty("检测计划ID")
|
@ApiModelProperty("检测计划ID")
|
||||||
private String planId;
|
private List<String> planIdList;
|
||||||
|
|
||||||
@ApiModelProperty("检测状态列表")
|
@ApiModelProperty("检测状态列表")
|
||||||
private List<
|
private List<
|
||||||
@@ -168,6 +183,20 @@ public class PqDevParam {
|
|||||||
@Max(value = 2, message = DetectionValidMessage.REPORT_STATE_FORMAT_ERROR)
|
@Max(value = 2, message = DetectionValidMessage.REPORT_STATE_FORMAT_ERROR)
|
||||||
private Integer reportState;
|
private Integer reportState;
|
||||||
|
|
||||||
|
@ApiModelProperty("所属地市名称")
|
||||||
|
private String cityName;
|
||||||
|
|
||||||
|
@ApiModelProperty("所属供电公司名称")
|
||||||
|
private String gdName;
|
||||||
|
|
||||||
|
@ApiModelProperty("所属电站名称")
|
||||||
|
private String subName;
|
||||||
|
|
||||||
|
@ApiModelProperty("地市")
|
||||||
|
private String region;
|
||||||
|
|
||||||
|
@ApiModelProperty("是否分配")
|
||||||
|
private Integer assign;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@@ -184,12 +213,15 @@ public class PqDevParam {
|
|||||||
@Data
|
@Data
|
||||||
public static class BindPlanParam {
|
public static class BindPlanParam {
|
||||||
@ApiModelProperty("检测计划ID")
|
@ApiModelProperty("检测计划ID")
|
||||||
@NotNull(message = DetectionValidMessage.PLAN_ID_NOT_NULL)
|
@NotBlank(message = DetectionValidMessage.PLAN_ID_NOT_BLANK)
|
||||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.PLAN_ID_FORMAT_ERROR)
|
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.PLAN_ID_FORMAT_ERROR)
|
||||||
private String planId;
|
private String planId;
|
||||||
|
|
||||||
@ApiModelProperty("被检设备ID列表")
|
@ApiModelProperty("被检设备ID列表")
|
||||||
@NotNull(message = DetectionValidMessage.PQ_DEV_IDS_NOT_NULL)
|
@NotNull(message = DetectionValidMessage.PQ_DEV_IDS_NOT_NULL)
|
||||||
private List<String> pqDevIds;
|
private List<String> devIds;
|
||||||
|
|
||||||
|
@ApiModelProperty("0-解绑、1-绑定")
|
||||||
|
private Integer bindFlag;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
package com.njcn.gather.device.pojo.po;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||||
import com.baomidou.mybatisplus.annotation.FieldStrategy;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
@@ -15,7 +14,6 @@ import lombok.EqualsAndHashCode;
|
|||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author caozehui
|
* @author caozehui
|
||||||
@@ -115,7 +113,6 @@ public class PqDev extends BaseEntity implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 送样日期
|
* 送样日期
|
||||||
*/
|
*/
|
||||||
@TableField(updateStrategy = FieldStrategy.IGNORED)
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||||
@JsonSerialize(using = LocalDateSerializer.class)
|
@JsonSerialize(using = LocalDateSerializer.class)
|
||||||
@@ -136,84 +133,58 @@ public class PqDev extends BaseEntity implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private String subName;
|
private String subName;
|
||||||
|
|
||||||
/**
|
|
||||||
* 检测状态
|
|
||||||
*/
|
|
||||||
private Integer checkState;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 检测结果
|
|
||||||
*/
|
|
||||||
private Integer checkResult;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 报告状态
|
|
||||||
*/
|
|
||||||
private Integer reportState;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 报告路径
|
* 报告路径
|
||||||
*/
|
*/
|
||||||
private String reportPath;
|
private String reportPath;
|
||||||
|
|
||||||
/**
|
|
||||||
* 设备关键信息二维码
|
|
||||||
*/
|
|
||||||
private String qrCode;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 检测次数,默认为0
|
|
||||||
*/
|
|
||||||
@TableField(value = "ReCheck_Num")
|
|
||||||
private Integer reCheckNum;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 状态:0-删除 1-正常
|
|
||||||
*/
|
|
||||||
private Integer state;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 检测计划id
|
* 检测计划id
|
||||||
*/
|
*/
|
||||||
private String planId;
|
private String planId;
|
||||||
|
|
||||||
/**
|
|
||||||
* 守时检测结果(0:不合格, 1:合格)
|
|
||||||
*/
|
|
||||||
private Integer timeCheckResult;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否支持系数校准(0:不支持,1:支持)
|
* 是否支持系数校准(0:不支持,1:支持)
|
||||||
*/
|
*/
|
||||||
private Integer factorFlag;
|
private Integer factorFlag;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 系数校准结果(0:不合格,1:合格)
|
* 预投计划
|
||||||
*/
|
*/
|
||||||
private Integer factorCheckResult;
|
|
||||||
|
|
||||||
@TableField("Check_Time")
|
|
||||||
private LocalDateTime checkTime;
|
|
||||||
|
|
||||||
@TableField("Check_By")
|
|
||||||
private String checkBy;
|
|
||||||
|
|
||||||
@TableField("Preinvestment_Plan")
|
@TableField("Preinvestment_Plan")
|
||||||
private String preinvestmentPlan;
|
private String preinvestmentPlan;
|
||||||
|
|
||||||
/**
|
|
||||||
* 温度
|
|
||||||
*/
|
|
||||||
private Float temperature;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 相对湿度
|
|
||||||
*/
|
|
||||||
private Float humidity;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 委托方
|
* 委托方
|
||||||
*/
|
*/
|
||||||
private String delegate;
|
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,100 @@
|
|||||||
|
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 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 {
|
||||||
|
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@Excel(name = "所属地市*", width = 30, needMerge = true, orderNum = "1")
|
||||||
|
private String cityName;
|
||||||
|
|
||||||
|
@Excel(name = "所属供电公司*", width = 30, needMerge = true, orderNum = "2")
|
||||||
|
private String gdName;
|
||||||
|
|
||||||
|
@Excel(name = "所属电站*", width = 30, needMerge = true, orderNum = "3")
|
||||||
|
private String subName;
|
||||||
|
|
||||||
|
@Excel(name = "设备名称*", width = 20, needMerge = true, 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, needMerge = true, orderNum = "5")
|
||||||
|
@NotBlank(message = DetectionValidMessage.FACTORYNO_NOT_BLANK)
|
||||||
|
private String createId;
|
||||||
|
|
||||||
|
@Excel(name = "设备类型*", width = 20, needMerge = true, orderNum = "6")
|
||||||
|
@NotBlank(message = DetectionValidMessage.DEV_TYPE_NOT_BLANK)
|
||||||
|
private String devType;
|
||||||
|
|
||||||
|
@Excel(name = "设备厂家*", width = 20, needMerge = true, orderNum = "7")
|
||||||
|
@NotBlank(message = DetectionValidMessage.MANUFACTURER_NOT_BLANK)
|
||||||
|
private String manufacturer;
|
||||||
|
|
||||||
|
// @Excel(name = "被检通道", width = 20, needMerge = true, orderNum = "8")
|
||||||
|
// private String inspectChannel;
|
||||||
|
|
||||||
|
@Excel(name = "固件版本", width = 15, needMerge = true, orderNum = "8")
|
||||||
|
private String hardwareVersion;
|
||||||
|
|
||||||
|
@Excel(name = "软件版本", width = 15, needMerge = true, orderNum = "9")
|
||||||
|
private String softwareVersion;
|
||||||
|
|
||||||
|
@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 = "11")
|
||||||
|
@NotNull(message = DetectionValidMessage.ENCRYPTION_NOT_NULL)
|
||||||
|
private Integer encryptionFlag;
|
||||||
|
|
||||||
|
@Excel(name = "识别码(当加密时必填)", width = 30, needMerge = true, orderNum = "12")
|
||||||
|
private String series;
|
||||||
|
|
||||||
|
@Excel(name = "秘钥(当加密时必填)", width = 30, needMerge = true, orderNum = "13")
|
||||||
|
private String devKey;
|
||||||
|
|
||||||
|
@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 = "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 = "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 = "17", format = "yyyy-MM-dd")
|
||||||
|
@NotNull(message = DetectionValidMessage.INSPECT_DATE_NOT_NULL)
|
||||||
|
private LocalDate inspectDate;
|
||||||
|
|
||||||
|
@Excel(name = "谐波系统设备id*", width = 30, needMerge = true, orderNum = "18")
|
||||||
|
@NotBlank(message = DetectionValidMessage.HARM_SYS_ID_NOT_BLANK)
|
||||||
|
private String harmSysId;
|
||||||
|
|
||||||
|
@ExcelCollection(name = "监测点信息", orderNum = "19")
|
||||||
|
private List<PqMonitorExcel> pqMonitorExcelList;
|
||||||
|
}
|
||||||
@@ -1,15 +1,9 @@
|
|||||||
package com.njcn.gather.device.pojo.vo;
|
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.device.pojo.po.PqDev;
|
||||||
import com.njcn.gather.monitor.pojo.po.PqMonitor;
|
import com.njcn.gather.monitor.pojo.po.PqMonitor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -27,4 +21,94 @@ public class PqDevVO extends PqDev {
|
|||||||
private Double devCurr;
|
private Double devCurr;
|
||||||
|
|
||||||
private List<PqMonitor> monitorList;
|
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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 绑定的计划名称
|
||||||
|
*/
|
||||||
|
private String boundPlanName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否已经分配。0-未分配、1-已分配、2-所有
|
||||||
|
*/
|
||||||
|
private Integer assign;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
|
}
|
||||||
@@ -18,7 +18,7 @@ import java.util.List;
|
|||||||
public class PreDetection {
|
public class PreDetection {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 装置ip
|
* 装置id
|
||||||
*/
|
*/
|
||||||
@JSONField(serialize = false)
|
@JSONField(serialize = false)
|
||||||
private String devId;
|
private String devId;
|
||||||
@@ -95,16 +95,28 @@ public class PreDetection {
|
|||||||
private Integer line;
|
private Integer line;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 监测点线路号
|
* pt
|
||||||
*/
|
*/
|
||||||
@JSONField(name = "pt")
|
@JSONField(name = "pt")
|
||||||
private Integer pt;
|
private String pt;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 监测点线路号
|
* ct
|
||||||
*/
|
*/
|
||||||
@JSONField(name = "pt") //todo 是否改为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() {
|
public String getDevKey() {
|
||||||
|
|||||||
@@ -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.enums.TimeCheckResultEnum;
|
||||||
import com.njcn.gather.device.pojo.param.PqDevParam;
|
import com.njcn.gather.device.pojo.param.PqDevParam;
|
||||||
import com.njcn.gather.device.pojo.po.PqDev;
|
import com.njcn.gather.device.pojo.po.PqDev;
|
||||||
import com.njcn.gather.device.pojo.vo.CNDevExcel;
|
import com.njcn.gather.device.pojo.vo.*;
|
||||||
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 org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
@@ -64,36 +61,6 @@ public interface IPqDevService extends IService<PqDev> {
|
|||||||
*/
|
*/
|
||||||
boolean updatePqDevTimeCheckResult(List<String> ids, TimeCheckResultEnum result);
|
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
|
* @param param 计划id
|
||||||
* @return 绑定的设备列表
|
* @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);
|
void updatePqDevReportState(String devId, int i);
|
||||||
|
|
||||||
int countUnReportDev(String planId);
|
long countUnReportDev(String planId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据计划id列表获取设备列表
|
* 根据计划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 planId 计划Id
|
||||||
* @param response 响应
|
* @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 planId 计划Id
|
||||||
* @param response 响应
|
* @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 patternId
|
||||||
* @param planId
|
* @param planId
|
||||||
*/
|
*/
|
||||||
void importCNDev(List<CNDevExcel> cnDevExcelList, String patternId, String planId);
|
boolean importCNDev(List<CNDevExcel> cnDevExcelList, String patternId, String planId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 可视化-灿能二楼设备
|
* 可视化-灿能二楼设备
|
||||||
*
|
*
|
||||||
* @param pqDevs
|
* @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 planId 计划Id
|
||||||
* @param response 响应
|
* @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 patternId
|
||||||
* @param planId
|
* @param planId
|
||||||
*/
|
*/
|
||||||
void importProvinceDev(List<ProvinceDevExcel> proviceDevExcelList, String patternId, String planId);
|
boolean importProvinceDev(List<ProvinceDevExcel> proviceDevExcelList, String patternId, String planId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 可视化-省级平台设备
|
* 可视化-省级平台设备
|
||||||
*
|
*
|
||||||
* @param pqDevs
|
* @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
|
* @return
|
||||||
*/
|
*/
|
||||||
List<PullDown> getProvinceDevPullDownList(int startCol);
|
List<PullDown> getProvinceDevPullDownList(int startCol);
|
||||||
@@ -267,4 +237,46 @@ public interface IPqDevService extends IService<PqDev> {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<PullDown> getCNDevPullDownList(int startCol);
|
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> contrastDevExcelList, String patternId, String planId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取比对式设备导出、导出文件模板的下拉列表
|
||||||
|
*
|
||||||
|
* @param startCol
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<PullDown> getContrastDevPullDownList(int startCol);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据历史记录来获取下拉框内容
|
||||||
|
*
|
||||||
|
* @param pattern
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Map<String, List<String>> listSelectOptions(String pattern);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取比对式设备导出数据
|
||||||
|
*
|
||||||
|
* @param pqDevVOList 设备id列表
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<ContrastDevExcel> getExportContrastDevData(List<PqDevVO> pqDevVOList);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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,94 @@
|
|||||||
|
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 com.njcn.gather.device.pojo.vo.PreDetection;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询出指定计划以关联的标准设备列表
|
||||||
|
*
|
||||||
|
* @param planId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<PqStandardDev> listByPlanId(String planId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询出标准设备所需的检测信息
|
||||||
|
*
|
||||||
|
* @param ids
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<PreDetection> listStandardDevPreDetection(List<String> ids);
|
||||||
|
}
|
||||||
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,303 @@
|
|||||||
|
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.pojo.vo.PreDetection;
|
||||||
|
import com.njcn.gather.device.service.IPqStandardDevService;
|
||||||
|
import com.njcn.gather.plan.mapper.AdPlanStandardDevMapper;
|
||||||
|
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;
|
||||||
|
private final AdPlanStandardDevMapper adPlanStandardDevMapper;
|
||||||
|
|
||||||
|
@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);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<PqStandardDev> listByPlanId(String planId) {
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导入数据
|
||||||
|
*
|
||||||
|
* @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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -139,5 +139,16 @@ public class PqErrSysController extends BaseController {
|
|||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OperateInfo
|
||||||
|
@GetMapping("/getTestItems")
|
||||||
|
@ApiOperation("根据误差体系id获取测试项")
|
||||||
|
@ApiImplicitParam(name = "id", value = "误差体系id", required = true)
|
||||||
|
public HttpResult<List<Map<String, String>>> getTestItems(@RequestParam("id") String id) {
|
||||||
|
String methodDescribe = getMethodDescribe("getTestItems");
|
||||||
|
LogUtil.njcnDebug(log, "{},获取测试项ID为:{}", methodDescribe, id);
|
||||||
|
List<Map<String, String>> result = pqErrSysService.getTestItems(id);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -57,4 +57,10 @@ public interface IPqErrSysDtlsService extends IService<PqErrSysDtls> {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<ErrDtlsCheckDataVO> listByPqErrSysIdAndTypes(PqErrSysParam.DetectionParam param);
|
List<ErrDtlsCheckDataVO> listByPqErrSysIdAndTypes(PqErrSysParam.DetectionParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据误差体系id和脚本类型查询脚本类型
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<PqErrSysDtls> listPqErrSysDtlsByPqErrSysIdAndScriptType(String errSysId, String scriptType);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,4 +79,12 @@ public interface IPqErrSysService extends IService<PqErrSys> {
|
|||||||
* @return 成功返回true,失败返回false
|
* @return 成功返回true,失败返回false
|
||||||
*/
|
*/
|
||||||
boolean copyPqErrSys(String id);
|
boolean copyPqErrSys(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id获取测试项列表
|
||||||
|
*
|
||||||
|
* @param id 误差体系id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<Map<String, String>> getTestItems(String id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -155,4 +155,14 @@ public class PqErrSysDtlsServiceImpl extends ServiceImpl<PqErrSysDtlsMapper, PqE
|
|||||||
}
|
}
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<PqErrSysDtls> listPqErrSysDtlsByPqErrSysIdAndScriptType(String errSysId, String scriptType) {
|
||||||
|
MPJLambdaWrapper<PqErrSysDtls> wrapper = new MPJLambdaWrapper<>();
|
||||||
|
wrapper.selectAll(PqErrSysDtls.class)
|
||||||
|
.leftJoin(DictTree.class, DictTree::getId, PqErrSysDtls::getScriptType)
|
||||||
|
.eq(PqErrSysDtls::getErrorSysId, errSysId)
|
||||||
|
.eq(DictTree::getId, scriptType);
|
||||||
|
return this.list(wrapper);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -208,6 +208,11 @@ public class PqErrSysServiceImpl extends ServiceImpl<PqErrSysMapper, PqErrSys> i
|
|||||||
return this.save(pqErrSys);
|
return this.save(pqErrSys);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Map<String, String>> getTestItems(String id) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 检查重复
|
* 检查重复
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1,13 +1,26 @@
|
|||||||
package com.njcn.gather.monitor.controller;
|
package com.njcn.gather.monitor.controller;
|
||||||
|
|
||||||
|
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||||
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
|
import com.njcn.common.utils.LogUtil;
|
||||||
|
import com.njcn.gather.monitor.pojo.param.PqMonitorParam;
|
||||||
|
import com.njcn.gather.monitor.pojo.po.PqMonitor;
|
||||||
import com.njcn.gather.monitor.service.IPqMonitorService;
|
import com.njcn.gather.monitor.service.IPqMonitorService;
|
||||||
import com.njcn.web.controller.BaseController;
|
import com.njcn.web.controller.BaseController;
|
||||||
|
import com.njcn.web.utils.HttpResultUtil;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author caozehui
|
* @author caozehui
|
||||||
@@ -21,5 +34,15 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
public class PqMonitorController extends BaseController {
|
public class PqMonitorController extends BaseController {
|
||||||
private final IPqMonitorService pqMonitorService;
|
private final IPqMonitorService pqMonitorService;
|
||||||
|
|
||||||
|
@OperateInfo
|
||||||
|
@PostMapping("/list")
|
||||||
|
@ApiOperation("查询监测点")
|
||||||
|
@ApiImplicitParam(name = "queryParam", value = "查询参数", required = true)
|
||||||
|
public HttpResult<List<PqMonitor>> list(@RequestBody PqMonitorParam.QueryParam queryParam) {
|
||||||
|
String methodDescribe = getMethodDescribe("list");
|
||||||
|
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, queryParam);
|
||||||
|
List<PqMonitor> result = pqMonitorService.listPqMonitorByDevId(queryParam.getDevId());
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,15 +4,16 @@
|
|||||||
|
|
||||||
<select id="selectMonitorInfo"
|
<select id="selectMonitorInfo"
|
||||||
resultType="com.njcn.gather.device.pojo.vo.PreDetection$MonitorListDTO">
|
resultType="com.njcn.gather.device.pojo.vo.PreDetection$MonitorListDTO">
|
||||||
SELECT
|
SELECT CONCAT(pq_dev.IP, '_', Num) as lineId,
|
||||||
Id as lineId,
|
Num as line,
|
||||||
Num as line,
|
pt as pt,
|
||||||
pt as pt,
|
ct as ct,
|
||||||
ct as ct
|
Stat_Interval,
|
||||||
FROM
|
sys_dict_data.Code as `Connection`
|
||||||
pq_monitor
|
FROM pq_monitor
|
||||||
WHERE
|
inner join sys_dict_data on pq_monitor.Connection = sys_dict_data.id
|
||||||
dev_id = #{devId}
|
inner join pq_dev on pq_monitor.Dev_Id = pq_dev.Id
|
||||||
|
WHERE Dev_Id = #{devId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import com.njcn.common.pojo.constant.PatternRegex;
|
|||||||
import com.njcn.gather.pojo.constant.DetectionValidMessage;
|
import com.njcn.gather.pojo.constant.DetectionValidMessage;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
@@ -16,28 +17,63 @@ import javax.validation.constraints.Pattern;
|
|||||||
@Data
|
@Data
|
||||||
public class PqMonitorParam {
|
public class PqMonitorParam {
|
||||||
|
|
||||||
@ApiModelProperty(value = "谐波系统监测点ID")
|
@ApiModelProperty(value = "所属设备id")
|
||||||
private String code;
|
@NotBlank(message = DetectionValidMessage.DEVICE_ID_NOT_BLANK)
|
||||||
|
private String devId;
|
||||||
|
|
||||||
@ApiModelProperty(value = "所属母线")
|
@ApiModelProperty(value = "所属母线")
|
||||||
@NotBlank(message = DetectionValidMessage.BELONG_LINE_NOT_BLANK)
|
@NotBlank(message = DetectionValidMessage.BELONG_LINE_NOT_BLANK)
|
||||||
|
private String busbar;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "监测点名称")
|
||||||
|
@NotBlank(message = DetectionValidMessage.MONITOR_NAME_NOT_BLANK)
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@ApiModelProperty(value = "监测点序号")
|
@ApiModelProperty(value = "线路号(监测点序号)")
|
||||||
@NotNull(message = DetectionValidMessage.MONITOR_NUM_NOT_NULL)
|
@NotNull(message = DetectionValidMessage.MONITOR_NUM_NOT_NULL)
|
||||||
private Integer num;
|
private Integer num;
|
||||||
|
|
||||||
@ApiModelProperty(value = "PT变比")
|
@ApiModelProperty(value = "PT变比")
|
||||||
@NotNull(message = DetectionValidMessage.PT_NOT_NULL)
|
@NotBlank(message = DetectionValidMessage.PT_NOT_BLANK)
|
||||||
private Float pt;
|
private String pt;
|
||||||
|
|
||||||
@ApiModelProperty(value = "CT变比")
|
@ApiModelProperty(value = "CT变比")
|
||||||
@NotNull(message = DetectionValidMessage.CT_NOT_NULL)
|
@NotBlank(message = DetectionValidMessage.CT_NOT_BLANK)
|
||||||
private Float ct;
|
private String ct;
|
||||||
|
|
||||||
@ApiModelProperty(value = "接线方式")
|
@ApiModelProperty(value = "接线方式")
|
||||||
@NotBlank(message = DetectionValidMessage.WIRING_TYPE_NOT_BLANK)
|
@NotBlank(message = DetectionValidMessage.CONNECTION_NOT_BLANK)
|
||||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.WIRING_TYPE_FORMAT_ERROR)
|
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.CONNECTION_FORMAT_ERROR)
|
||||||
private String ptType;
|
private String connection;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "统计间隔")
|
||||||
|
@NotNull(message = DetectionValidMessage.STAT_INTERVAL_NOT_NULL)
|
||||||
|
private Integer statInterval;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "谐波系统监测点id")
|
||||||
|
@NotBlank(message = DetectionValidMessage.MONITOR_ID_NOT_BLANK)
|
||||||
|
private String harmSysId;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询实体
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public static class QueryParam {
|
||||||
|
@ApiModelProperty(value = "所属设备id")
|
||||||
|
@NotBlank(message = DetectionValidMessage.DEVICE_ID_NOT_BLANK)
|
||||||
|
private String devId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改实体
|
||||||
|
*/
|
||||||
|
// @Data
|
||||||
|
// @EqualsAndHashCode(callSuper = true)
|
||||||
|
// public static class UpdateParam extends PqMonitorParam {
|
||||||
|
// @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,9 +1,7 @@
|
|||||||
package com.njcn.gather.monitor.pojo.po;
|
package com.njcn.gather.monitor.pojo.po;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.njcn.db.mybatisplus.bo.BaseEntity;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
@@ -20,40 +18,49 @@ public class PqMonitor implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private String id;
|
private String id;
|
||||||
|
|
||||||
/**
|
|
||||||
* 默认与谐波系统监测点ID相同
|
|
||||||
*/
|
|
||||||
private String code;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 所属设备ID
|
* 所属设备ID
|
||||||
*/
|
*/
|
||||||
private String devId;
|
private String devId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 所属母线
|
* 监测点名称
|
||||||
*/
|
*/
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 监测点序号
|
* 所属母线
|
||||||
|
*/
|
||||||
|
private String busbar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 线路号(监测点序号)
|
||||||
*/
|
*/
|
||||||
private Integer num;
|
private Integer num;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PT变比
|
* PT变比
|
||||||
*/
|
*/
|
||||||
private Float pt;
|
private String pt;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CT变比
|
* CT变比
|
||||||
*/
|
*/
|
||||||
private Float ct;
|
private String ct;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 统计间隔
|
||||||
|
*/
|
||||||
|
private Integer statInterval;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 接线方式,字典表
|
* 接线方式,字典表
|
||||||
*/
|
*/
|
||||||
private String ptType;
|
private String connection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 谐波系统监测点id
|
||||||
|
*/
|
||||||
|
private String harmSysId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +1,11 @@
|
|||||||
package com.njcn.gather.monitor.pojo.vo;
|
package com.njcn.gather.monitor.pojo.vo;
|
||||||
|
|
||||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||||
import com.njcn.common.pojo.constant.PatternRegex;
|
|
||||||
import com.njcn.gather.pojo.constant.DetectionValidMessage;
|
import com.njcn.gather.pojo.constant.DetectionValidMessage;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
|
|
||||||
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
import javax.validation.constraints.Pattern;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author caozehui
|
* @author caozehui
|
||||||
@@ -17,36 +14,35 @@ import javax.validation.constraints.Pattern;
|
|||||||
@Data
|
@Data
|
||||||
public class PqMonitorExcel {
|
public class PqMonitorExcel {
|
||||||
|
|
||||||
@Excel(name = "监测点序号", width = 20, orderNum = "1")
|
@Excel(name = "谐波系统监测点ID*", width = 20, orderNum = "1")
|
||||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.MONITOR_NUM_FORMAT_ERROR)
|
@NotBlank(message = DetectionValidMessage.MONITOR_ID_NOT_BLANK)
|
||||||
private Integer num;
|
private String harmSysId;
|
||||||
|
|
||||||
@Excel(name = "所属母线", width = 20, orderNum = "2")
|
@Excel(name = "所属母线*", width = 20, orderNum = "2")
|
||||||
@NotBlank(message = DetectionValidMessage.BELONG_LINE_NOT_BLANK)
|
@NotBlank(message = DetectionValidMessage.BELONG_LINE_NOT_BLANK)
|
||||||
|
private String busbar;
|
||||||
|
|
||||||
|
@Excel(name = "监测点名称*", width = 20, orderNum = "3")
|
||||||
|
@NotBlank(message = DetectionValidMessage.MONITOR_NAME_NOT_BLANK)
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@Excel(name = "PT变比", width = 20, orderNum = "3")
|
@Excel(name = "线路号(监测点序号)*", width = 20, orderNum = "4")
|
||||||
@NotNull(message = DetectionValidMessage.PT_NOT_NULL)
|
@NotNull(message = DetectionValidMessage.MONITOR_NUM_NOT_NULL)
|
||||||
private Float pt;
|
private Integer num;
|
||||||
|
|
||||||
@Excel(name = "CT变比", width = 20, orderNum = "4")
|
@Excel(name = "PT变比(pt1:pt2)*", width = 20, orderNum = "5")
|
||||||
@NotNull(message = DetectionValidMessage.CT_NOT_NULL)
|
@NotBlank(message = DetectionValidMessage.PT_NOT_BLANK)
|
||||||
private Float ct;
|
private String pt;
|
||||||
|
|
||||||
@Excel(name = "接线方式", width = 20, orderNum = "5")
|
@Excel(name = "CT变比(ct1:ct2)*", width = 20, orderNum = "6")
|
||||||
@NotBlank(message = DetectionValidMessage.WIRING_TYPE_NOT_BLANK)
|
@NotBlank(message = DetectionValidMessage.CT_NOT_BLANK)
|
||||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.WIRING_TYPE_FORMAT_ERROR)
|
private String ct;
|
||||||
private String ptType;
|
|
||||||
|
|
||||||
@Data
|
@Excel(name = "接线方式*", width = 20, orderNum = "7")
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@NotBlank(message = DetectionValidMessage.CONNECTION_NOT_BLANK)
|
||||||
public static class ImportData extends PqMonitorExcel {
|
private String connection;
|
||||||
|
|
||||||
}
|
@Excel(name = "统计间隔*", width = 10, orderNum = "8")
|
||||||
|
@NotNull(message = DetectionValidMessage.STAT_INTERVAL_NOT_NULL)
|
||||||
@Data
|
private Integer statInterval;
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
public static class ExportData extends PqMonitorExcel {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.njcn.gather.monitor.service;
|
package com.njcn.gather.monitor.service;
|
||||||
|
|
||||||
|
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.gather.device.pojo.po.PqDev;
|
|
||||||
import com.njcn.gather.monitor.pojo.param.PqMonitorParam;
|
import com.njcn.gather.monitor.pojo.param.PqMonitorParam;
|
||||||
import com.njcn.gather.monitor.pojo.po.PqMonitor;
|
import com.njcn.gather.monitor.pojo.po.PqMonitor;
|
||||||
|
|
||||||
@@ -13,6 +13,8 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public interface IPqMonitorService extends IService<PqMonitor> {
|
public interface IPqMonitorService extends IService<PqMonitor> {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据设备id获取所有监测点信息
|
* 根据设备id获取所有监测点信息
|
||||||
*
|
*
|
||||||
@@ -22,28 +24,42 @@ public interface IPqMonitorService extends IService<PqMonitor> {
|
|||||||
List<PqMonitor> listPqMonitorByDevId(String devId);
|
List<PqMonitor> listPqMonitorByDevId(String devId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量新增监测点信息
|
* 根据设备id批量新增监测点信息
|
||||||
*
|
*
|
||||||
* @param devId 被检设备id
|
* @param devId
|
||||||
* @param pqMonitorParamList 监测点信息列表
|
* @param monitorList
|
||||||
* @return 新增成功返回true,否则返回false
|
* @return
|
||||||
*/
|
*/
|
||||||
boolean addPqMonitorByDevId(String devId, List<PqMonitorParam> pqMonitorParamList);
|
boolean addPqMonitorByDevId(String devId, List<PqMonitorParam> monitorList);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量删除监测点信息
|
* 根据设备id批量修改监测点信息
|
||||||
*
|
*
|
||||||
* @param devId 被检设备id
|
* @param devId
|
||||||
* @return 删除成功返回true,否则返回false
|
* @param paramList
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
boolean updatePqMonitorByDevId(String devId, List<PqMonitorParam> paramList);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据设备id删除监测点信息
|
||||||
|
*
|
||||||
|
* @param devId
|
||||||
|
* @return
|
||||||
*/
|
*/
|
||||||
boolean deletePqMonitorByDevId(String devId);
|
boolean deletePqMonitorByDevId(String devId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改监测点信息
|
* 可视化监测点
|
||||||
*
|
*
|
||||||
* @param devId 被检设备id
|
* @param monitorList
|
||||||
* @param paramList 监测点信息
|
|
||||||
* @return 修改成功返回true,否则返回false
|
|
||||||
*/
|
*/
|
||||||
boolean updatePqMonitorByDevId(String devId, List<PqMonitorParam> paramList);
|
void visualizeMonitor(List<PqMonitor> monitorList);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 逆向可视化监测点
|
||||||
|
*
|
||||||
|
* @param monitorList
|
||||||
|
*/
|
||||||
|
void reverseVisualizeMonitor(List<PqMonitor> monitorList);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,16 @@
|
|||||||
package com.njcn.gather.monitor.service.impl;
|
package com.njcn.gather.monitor.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.gather.monitor.mapper.PqMonitorMapper;
|
import com.njcn.gather.monitor.mapper.PqMonitorMapper;
|
||||||
import com.njcn.gather.monitor.pojo.param.PqMonitorParam;
|
import com.njcn.gather.monitor.pojo.param.PqMonitorParam;
|
||||||
import com.njcn.gather.monitor.pojo.po.PqMonitor;
|
import com.njcn.gather.monitor.pojo.po.PqMonitor;
|
||||||
import com.njcn.gather.monitor.service.IPqMonitorService;
|
import com.njcn.gather.monitor.service.IPqMonitorService;
|
||||||
|
import com.njcn.gather.pojo.enums.DetectionResponseEnum;
|
||||||
|
import com.njcn.gather.system.dictionary.pojo.po.DictData;
|
||||||
import com.njcn.gather.system.dictionary.service.IDictDataService;
|
import com.njcn.gather.system.dictionary.service.IDictDataService;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -32,21 +36,12 @@ public class PqMonitorServiceImpl extends ServiceImpl<PqMonitorMapper, PqMonitor
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
public boolean addPqMonitorByDevId(String devId, List<PqMonitorParam> monitorList) {
|
||||||
public boolean addPqMonitorByDevId(String devId, List<PqMonitorParam> pqMonitorParamList) {
|
List<PqMonitor> pqMonitorList = BeanUtil.copyToList(monitorList, PqMonitor.class);
|
||||||
List<PqMonitor> pqMonitorList = BeanUtil.copyToList(pqMonitorParamList, PqMonitor.class);
|
|
||||||
pqMonitorList.forEach(pqMonitor -> pqMonitor.setDevId(devId));
|
pqMonitorList.forEach(pqMonitor -> pqMonitor.setDevId(devId));
|
||||||
return this.saveBatch(pqMonitorList);
|
return this.saveBatch(pqMonitorList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
@Transactional
|
|
||||||
public boolean deletePqMonitorByDevId(String devId) {
|
|
||||||
QueryWrapper<PqMonitor> wrapper = new QueryWrapper<>();
|
|
||||||
wrapper.eq("pq_monitor.Dev_Id", devId);
|
|
||||||
return this.remove(wrapper);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public boolean updatePqMonitorByDevId(String devId, List<PqMonitorParam> paramList) {
|
public boolean updatePqMonitorByDevId(String devId, List<PqMonitorParam> paramList) {
|
||||||
@@ -58,4 +53,35 @@ public class PqMonitorServiceImpl extends ServiceImpl<PqMonitorMapper, PqMonitor
|
|||||||
return this.saveBatch(pqMonitorList);
|
return this.saveBatch(pqMonitorList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public boolean deletePqMonitorByDevId(String devId) {
|
||||||
|
QueryWrapper<PqMonitor> wrapper = new QueryWrapper<>();
|
||||||
|
wrapper.eq("pq_monitor.Dev_Id", devId);
|
||||||
|
return this.remove(wrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visualizeMonitor(List<PqMonitor> monitorList) {
|
||||||
|
monitorList.forEach(monitor -> {
|
||||||
|
DictData dictData = dictDataService.getDictDataById(monitor.getConnection());
|
||||||
|
if (ObjectUtil.isNotNull(dictData)) {
|
||||||
|
monitor.setConnection(dictData.getName());
|
||||||
|
} else {
|
||||||
|
throw new BusinessException(DetectionResponseEnum.CONNECTION_NOT_EXIST);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void reverseVisualizeMonitor(List<PqMonitor> monitorList) {
|
||||||
|
monitorList.forEach(monitor -> {
|
||||||
|
DictData dictData = dictDataService.getDictDataByName(monitor.getConnection());
|
||||||
|
if (ObjectUtil.isNotNull(dictData)) {
|
||||||
|
monitor.setConnection(dictData.getId());
|
||||||
|
} else {
|
||||||
|
throw new BusinessException(DetectionResponseEnum.CONNECTION_NOT_EXIST);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,17 +1,27 @@
|
|||||||
package com.njcn.gather.plan.controller;
|
package com.njcn.gather.plan.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||||
import com.njcn.common.pojo.constant.OperateType;
|
import com.njcn.common.pojo.constant.OperateType;
|
||||||
|
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
import com.njcn.common.utils.LogUtil;
|
import com.njcn.common.utils.LogUtil;
|
||||||
|
import com.njcn.gather.device.pojo.enums.CommonEnum;
|
||||||
|
import com.njcn.gather.device.pojo.param.PqDevParam;
|
||||||
|
import com.njcn.gather.device.pojo.po.PqStandardDev;
|
||||||
|
import com.njcn.gather.device.pojo.vo.PqDevVO;
|
||||||
|
import com.njcn.gather.device.service.IPqDevService;
|
||||||
import com.njcn.gather.plan.pojo.param.AdPlanParam;
|
import com.njcn.gather.plan.pojo.param.AdPlanParam;
|
||||||
|
import com.njcn.gather.plan.pojo.po.AdPlan;
|
||||||
import com.njcn.gather.plan.pojo.vo.AdPlanVO;
|
import com.njcn.gather.plan.pojo.vo.AdPlanVO;
|
||||||
import com.njcn.gather.plan.service.IAdPlanService;
|
import com.njcn.gather.plan.service.IAdPlanService;
|
||||||
|
import com.njcn.gather.type.pojo.po.DevType;
|
||||||
|
import com.njcn.gather.type.service.IDevTypeService;
|
||||||
import com.njcn.web.controller.BaseController;
|
import com.njcn.web.controller.BaseController;
|
||||||
import com.njcn.web.utils.FileUtil;
|
import com.njcn.web.utils.FileUtil;
|
||||||
import com.njcn.web.utils.HttpResultUtil;
|
import com.njcn.web.utils.HttpResultUtil;
|
||||||
@@ -28,7 +38,7 @@ import org.springframework.web.multipart.MultipartFile;
|
|||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author caozehui
|
* @author caozehui
|
||||||
@@ -42,15 +52,17 @@ import java.util.Map;
|
|||||||
public class AdPlanController extends BaseController {
|
public class AdPlanController extends BaseController {
|
||||||
|
|
||||||
private final IAdPlanService adPlanService;
|
private final IAdPlanService adPlanService;
|
||||||
|
private final IPqDevService pqDevService;
|
||||||
|
private final IDevTypeService devTypeService;
|
||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
@ApiOperation("分页查询检测计划")
|
@ApiOperation("分页查询检测计划")
|
||||||
@ApiImplicitParam(name = "queryParam", value = "查询参数", required = true)
|
@ApiImplicitParam(name = "queryParam", value = "查询参数", required = true)
|
||||||
public HttpResult<Page<AdPlanVO>> list(@RequestBody @Validated AdPlanParam.QueryParam queryParam) {
|
public HttpResult<List<AdPlanVO>> list(@RequestBody @Validated AdPlanParam.QueryParam queryParam) {
|
||||||
String methodDescribe = getMethodDescribe("list");
|
String methodDescribe = getMethodDescribe("list");
|
||||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, queryParam);
|
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, queryParam);
|
||||||
Page<AdPlanVO> result = adPlanService.listAdPlan(queryParam);
|
List<AdPlanVO> result = adPlanService.listAdPlan(queryParam);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,6 +89,7 @@ public class AdPlanController extends BaseController {
|
|||||||
String methodDescribe = getMethodDescribe("update");
|
String methodDescribe = getMethodDescribe("update");
|
||||||
LogUtil.njcnDebug(log, "{},修改数据为:{}", methodDescribe, updateParam);
|
LogUtil.njcnDebug(log, "{},修改数据为:{}", methodDescribe, updateParam);
|
||||||
boolean result = adPlanService.updateAdPlan(updateParam);
|
boolean result = adPlanService.updateAdPlan(updateParam);
|
||||||
|
|
||||||
if (result) {
|
if (result) {
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||||
} else {
|
} else {
|
||||||
@@ -87,11 +100,11 @@ public class AdPlanController extends BaseController {
|
|||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.DELETE)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.DELETE)
|
||||||
@PostMapping("/delete")
|
@PostMapping("/delete")
|
||||||
@ApiOperation("删除检测计划")
|
@ApiOperation("删除检测计划")
|
||||||
@ApiImplicitParam(name = "ids", value = "检测计划id", required = true)
|
@ApiImplicitParam(name = "ids", value = "计划id列表", required = true)
|
||||||
public HttpResult<Boolean> delete(@RequestBody List<String> ids) {
|
public HttpResult<Boolean> delete(@RequestBody List<String> ids, @RequestParam("pattern") String pattern) {
|
||||||
String methodDescribe = getMethodDescribe("delete");
|
String methodDescribe = getMethodDescribe("delete");
|
||||||
LogUtil.njcnDebug(log, "{},删除ID数据为:{}", methodDescribe, String.join(StrUtil.COMMA, ids));
|
LogUtil.njcnDebug(log, "{},删除ID数据为:{}", methodDescribe, String.join(StrUtil.COMMA, ids), pattern);
|
||||||
boolean result = adPlanService.deleteAdPlan(ids);
|
boolean result = adPlanService.deleteAdPlan(ids, pattern);
|
||||||
if (result) {
|
if (result) {
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||||
} else {
|
} else {
|
||||||
@@ -99,7 +112,6 @@ public class AdPlanController extends BaseController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@GetMapping("/listByPattern")
|
@GetMapping("/listByPattern")
|
||||||
@ApiOperation("按照模式查询检测计划")
|
@ApiOperation("按照模式查询检测计划")
|
||||||
@@ -125,8 +137,8 @@ public class AdPlanController extends BaseController {
|
|||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.DOWNLOAD)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.DOWNLOAD)
|
||||||
@PostMapping("/downloadTemplate")
|
@PostMapping("/downloadTemplate")
|
||||||
@ApiOperation("下载检测计划导出模板")
|
@ApiOperation("下载检测计划导出模板")
|
||||||
public void downloadTemplate(@RequestBody AdPlanParam.QueryParam queryParam) {
|
public void downloadTemplate(@RequestBody AdPlanParam param) {
|
||||||
adPlanService.downloadTemplate(queryParam.getPatternId());
|
adPlanService.downloadTemplate(param.getPattern());
|
||||||
}
|
}
|
||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.UPLOAD)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.UPLOAD)
|
||||||
@@ -136,7 +148,7 @@ public class AdPlanController extends BaseController {
|
|||||||
@ApiImplicitParam(name = "file", value = "检测计划数据文件", required = true),
|
@ApiImplicitParam(name = "file", value = "检测计划数据文件", required = true),
|
||||||
@ApiImplicitParam(name = "pattern", value = "模式Id", required = true)
|
@ApiImplicitParam(name = "pattern", value = "模式Id", required = true)
|
||||||
})
|
})
|
||||||
public HttpResult<Object> importPlan(@RequestParam("file") MultipartFile file, @RequestParam("patternId") String patternId, HttpServletResponse response) {
|
public HttpResult<Boolean> importPlan(@RequestParam("file") MultipartFile file, @RequestParam("patternId") String patternId, HttpServletResponse response) {
|
||||||
String methodDescribe = getMethodDescribe("importCNPlan");
|
String methodDescribe = getMethodDescribe("importCNPlan");
|
||||||
LogUtil.njcnDebug(log, "{},上传文件为:{}", methodDescribe, file.getOriginalFilename());
|
LogUtil.njcnDebug(log, "{},上传文件为:{}", methodDescribe, file.getOriginalFilename());
|
||||||
|
|
||||||
@@ -144,8 +156,12 @@ public class AdPlanController extends BaseController {
|
|||||||
if (!fileType) {
|
if (!fileType) {
|
||||||
throw new BusinessException(CommonResponseEnum.FILE_XLSX_ERROR);
|
throw new BusinessException(CommonResponseEnum.FILE_XLSX_ERROR);
|
||||||
}
|
}
|
||||||
adPlanService.importPlan(file, patternId, response);
|
boolean result = adPlanService.importPlan(file, patternId, response);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
if (result) {
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||||
|
} else {
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@@ -168,5 +184,176 @@ public class AdPlanController extends BaseController {
|
|||||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, String.join(StrUtil.COMMA, ids));
|
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, String.join(StrUtil.COMMA, ids));
|
||||||
adPlanService.analyse(ids);
|
adPlanService.analyse(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/listByPlanId")
|
||||||
|
@ApiOperation("查询出所有已绑定的设备")
|
||||||
|
@ApiImplicitParam(name = "planId", value = "计划id", required = true)
|
||||||
|
public HttpResult<List<PqDevVO>> listByPlanId(@RequestBody @Validated PqDevParam.QueryParam param) {
|
||||||
|
String methodDescribe = getMethodDescribe("listByPlanId");
|
||||||
|
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, param);
|
||||||
|
|
||||||
|
AdPlan plan = adPlanService.getById(param.getPlanIdList().get(0));
|
||||||
|
if (CommonEnum.FATHER_ID.getValue().equals(plan.getFatherPlanId())) {
|
||||||
|
List<AdPlan> planList = adPlanService.lambdaQuery().eq(AdPlan::getFatherPlanId, param.getPlanIdList().get(0)).list();
|
||||||
|
List<String> planIdList = planList.stream().map(AdPlan::getId).collect(Collectors.toList());
|
||||||
|
param.getPlanIdList().addAll(planIdList);
|
||||||
|
}
|
||||||
|
List<PqDevVO> pqDevVOList = pqDevService.listByPlanId(param);
|
||||||
|
List<AdPlan> planList = adPlanService.listByIds(param.getPlanIdList());
|
||||||
|
|
||||||
|
pqDevVOList.forEach(pqDevVO -> {
|
||||||
|
DevType devType = devTypeService.getById(pqDevVO.getDevType());
|
||||||
|
if (ObjectUtil.isNotNull(devType)) {
|
||||||
|
pqDevVO.setDevType(devType.getName());
|
||||||
|
pqDevVO.setDevVolt(devType.getDevVolt());
|
||||||
|
pqDevVO.setDevCurr(devType.getDevCurr());
|
||||||
|
pqDevVO.setDevChns(devType.getDevChns());
|
||||||
|
}
|
||||||
|
if (StrUtil.isNotBlank(pqDevVO.getPlanId())) {
|
||||||
|
AdPlan plan1 = planList.stream().filter(p -> p.getId().equals(pqDevVO.getPlanId())).findFirst().get();
|
||||||
|
if (ObjectUtil.isNotNull(plan1) && plan.getId().equals(plan1.getFatherPlanId())) {
|
||||||
|
pqDevVO.setBoundPlanName(plan1.getName());
|
||||||
|
pqDevVO.setAssign(DataStateEnum.ENABLE.getCode());
|
||||||
|
} else {
|
||||||
|
pqDevVO.setAssign(DataStateEnum.DELETED.getCode());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
pqDevVO.setAssign(DataStateEnum.DELETED.getCode());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, pqDevVOList, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/listDevByPlanId")
|
||||||
|
@ApiOperation("根据计划id分页查询被检设备")
|
||||||
|
@ApiImplicitParam(name = "queryParam", value = "查询参数", required = true)
|
||||||
|
public HttpResult<Page<PqDevVO>> listDevByPlanId(@RequestBody @Validated PqDevParam.QueryParam param) {
|
||||||
|
String methodDescribe = getMethodDescribe("listDevByPlanId");
|
||||||
|
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, param);
|
||||||
|
|
||||||
|
AdPlan plan = adPlanService.getById(param.getPlanIdList().get(0));
|
||||||
|
if (CommonEnum.FATHER_ID.getValue().equals(plan.getFatherPlanId())) {
|
||||||
|
List<AdPlan> planList = adPlanService.lambdaQuery().eq(AdPlan::getFatherPlanId, param.getPlanIdList().get(0)).list();
|
||||||
|
List<String> planIdList = planList.stream().map(AdPlan::getId).collect(Collectors.toList());
|
||||||
|
param.getPlanIdList().addAll(planIdList);
|
||||||
|
}
|
||||||
|
Page<PqDevVO> pqDevVOPage = pqDevService.listPqDevs(param);
|
||||||
|
|
||||||
|
List<AdPlan> planList = adPlanService.listByIds(param.getPlanIdList());
|
||||||
|
for (PqDevVO pqDevVO : pqDevVOPage.getRecords()) {
|
||||||
|
if (StrUtil.isNotBlank(pqDevVO.getPlanId())) {
|
||||||
|
AdPlan plan1 = planList.stream().filter(p -> p.getId().equals(pqDevVO.getPlanId())).findFirst().get();
|
||||||
|
if (ObjectUtil.isNotNull(plan1) && plan.getId().equals(plan1.getFatherPlanId())) {
|
||||||
|
pqDevVO.setBoundPlanName(plan1.getName());
|
||||||
|
pqDevVO.setAssign(DataStateEnum.ENABLE.getCode());
|
||||||
|
} else {
|
||||||
|
pqDevVO.setAssign(DataStateEnum.DELETED.getCode());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
pqDevVO.setAssign(DataStateEnum.DELETED.getCode());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, pqDevVOPage, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.UPDATE)
|
||||||
|
@GetMapping("/updateSubPlanName")
|
||||||
|
@ApiOperation("修改子计划名称")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "planId", value = "计划id", required = true),
|
||||||
|
@ApiImplicitParam(name = "name", value = "计划名称", required = true)
|
||||||
|
})
|
||||||
|
public HttpResult<Boolean> updateSubPlanName(@RequestParam("planId") String planId, @RequestParam("name") String name) {
|
||||||
|
String methodDescribe = getMethodDescribe("updateSubPlanName");
|
||||||
|
LogUtil.njcnDebug(log, "{},修改数据为:{}", methodDescribe, planId, name);
|
||||||
|
boolean result = adPlanService.updateSubPlanName(planId, name);
|
||||||
|
if (result) {
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||||
|
} else {
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@GetMapping("/getUnBoundStandardDev")
|
||||||
|
@ApiOperation("根据父计划ID获取未被子计划绑定的标准设备")
|
||||||
|
@ApiImplicitParam(name = "fatherPlanId", value = "父计划ID", required = true)
|
||||||
|
public HttpResult<List<PqStandardDev>> getUnBoundStandardDev(@RequestParam("fatherPlanId") String fatherPlanId) {
|
||||||
|
String methodDescribe = getMethodDescribe("getUnBoundStandardDev");
|
||||||
|
LogUtil.njcnDebug(log, "{},父计划ID为:{}", methodDescribe, fatherPlanId);
|
||||||
|
List<PqStandardDev> result = adPlanService.getUnBoundStandardDev(fatherPlanId);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@GetMapping("/getBoundStandardDev")
|
||||||
|
@ApiOperation("根据计划ID获取已绑定的标准设备")
|
||||||
|
@ApiImplicitParam(name = "planId", value = "计划ID", required = true)
|
||||||
|
public HttpResult<List<PqStandardDev>> getBoundStandardDev(@RequestParam("planId") String planId) {
|
||||||
|
String methodDescribe = getMethodDescribe("getUnBoundStandardDev");
|
||||||
|
LogUtil.njcnDebug(log, "{},计划ID为:{}", methodDescribe, planId);
|
||||||
|
List<PqStandardDev> result = adPlanService.getBoundStandardDev(planId);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/updateBindStandardDev")
|
||||||
|
@ApiOperation("子计划绑定/解绑标准设备")
|
||||||
|
@ApiImplicitParam(name = "param", value = "绑定/解绑参数", required = true)
|
||||||
|
public HttpResult<Boolean> updateBindStandardDev(@RequestBody @Validated PqDevParam.BindPlanParam param) {
|
||||||
|
String methodDescribe = getMethodDescribe("updateBindStandardDev");
|
||||||
|
LogUtil.njcnDebug(log, "{},绑定/解绑参数为:{}", methodDescribe, param);
|
||||||
|
|
||||||
|
boolean result = adPlanService.updateBindStandardDev(param.getPlanId(), param.getDevIds());
|
||||||
|
if (result) {
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||||
|
} else {
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/updateBindDev")
|
||||||
|
@ApiOperation("子计划绑定/解绑被检设备")
|
||||||
|
@ApiImplicitParam(name = "param", value = "绑定/解绑参数", required = true)
|
||||||
|
public HttpResult<Boolean> updateBindDev(@RequestBody @Validated PqDevParam.BindPlanParam param) {
|
||||||
|
String methodDescribe = getMethodDescribe("updateBindDev");
|
||||||
|
LogUtil.njcnDebug(log, "{},绑定/解绑参数为:{}", methodDescribe, param);
|
||||||
|
|
||||||
|
boolean result = adPlanService.updateBindDev(param);
|
||||||
|
if (result) {
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||||
|
} else {
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// @OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.DELETE)
|
||||||
|
// @PostMapping("/deleteSubPlan")
|
||||||
|
// @ApiOperation("删除子计划")
|
||||||
|
// @ApiImplicitParam(name = "ids", value = "子计划id列表", required = true)
|
||||||
|
// public HttpResult<Boolean> deleteSubPlan(@RequestBody List<String> ids) {
|
||||||
|
// String methodDescribe = getMethodDescribe("deleteSubPlan");
|
||||||
|
// LogUtil.njcnDebug(log, "{},删除ID数据为:{}", methodDescribe, String.join(StrUtil.COMMA, ids));
|
||||||
|
// boolean result = adPlanService.deleteAdPlan(ids);
|
||||||
|
// if (result) {
|
||||||
|
// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||||
|
// } else {
|
||||||
|
// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
@OperateInfo(operateType = OperateType.DOWNLOAD)
|
||||||
|
@PostMapping("/exportSubPlan")
|
||||||
|
@ApiOperation("导出子计划")
|
||||||
|
@ApiImplicitParam(name = "planId", value = "子计划id", required = true)
|
||||||
|
public void exportSubPlan(@RequestParam("planId") String planId, HttpServletResponse response) {
|
||||||
|
String methodDescribe = getMethodDescribe("exportSubPlan");
|
||||||
|
LogUtil.njcnDebug(log, "{},导出ID数据为:{}", methodDescribe, planId);
|
||||||
|
adPlanService.exportSubPlan(planId, response);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package com.njcn.gather.plan.mapper;
|
||||||
|
|
||||||
|
import com.github.yulichang.base.MPJBaseMapper;
|
||||||
|
import com.njcn.gather.device.pojo.po.PqStandardDev;
|
||||||
|
import com.njcn.gather.plan.pojo.po.AdPlanStandardDev;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author caozehui
|
||||||
|
* @date 2025-07-16
|
||||||
|
*/
|
||||||
|
public interface AdPlanStandardDevMapper extends MPJBaseMapper<AdPlanStandardDev> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据计划id查询标准设备列表
|
||||||
|
*
|
||||||
|
* @param planIdList
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<PqStandardDev> listByPlanId(@Param("planIdList") List<String> planIdList);
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
<?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.plan.mapper.AdPlanStandardDevMapper">
|
||||||
|
|
||||||
|
|
||||||
|
<select id="listByPlanId" resultType="com.njcn.gather.device.pojo.po.PqStandardDev">
|
||||||
|
select standard_dev.*
|
||||||
|
from ad_plan_standard_dev plan_std_dev left join pq_standard_dev standard_dev on plan_std_dev.Standard_Dev_Id = standard_dev.Id
|
||||||
|
<if test="planIdList!= null and planIdList.size() != 0">
|
||||||
|
where plan_std_dev.Plan_Id in
|
||||||
|
<foreach collection="planIdList" item="item" open="(" separator="," close=")">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
</mapper>
|
||||||
|
|
||||||
@@ -8,7 +8,7 @@ import lombok.Getter;
|
|||||||
*/
|
*/
|
||||||
@Getter
|
@Getter
|
||||||
public enum DataSourceEnum {
|
public enum DataSourceEnum {
|
||||||
THREE_SENSE_ACTUAL_TIME_DATA("real", "3s实时数据"),
|
REAL_DATA("real", "3s实时数据"),
|
||||||
|
|
||||||
MINUTE_STATISTICS_MAX("max", "分钟统计数据-最大"),
|
MINUTE_STATISTICS_MAX("max", "分钟统计数据-最大"),
|
||||||
MINUTE_STATISTICS_MIN("min", "分钟统计数据-最小"),
|
MINUTE_STATISTICS_MIN("min", "分钟统计数据-最小"),
|
||||||
|
|||||||
@@ -27,12 +27,7 @@ public class AdPlanParam {
|
|||||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.PATTERN_FORMAT_ERROR)
|
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.PATTERN_FORMAT_ERROR)
|
||||||
private String pattern;
|
private String pattern;
|
||||||
|
|
||||||
// @ApiModelProperty(value = "父计划ID")
|
|
||||||
// @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DeviceValidMessage.PATTERN_FORMAT_ERROR)
|
|
||||||
// private String fatherPlanId;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "检测源ID列表", required = true)
|
@ApiModelProperty(value = "检测源ID列表", required = true)
|
||||||
@NotEmpty(message = DetectionValidMessage.SOURCE_IDS_NOT_EMPTY)
|
|
||||||
private List<@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.SOURCE_ID_FORMAT_ERROR) String> sourceIds;
|
private List<@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.SOURCE_ID_FORMAT_ERROR) String> sourceIds;
|
||||||
|
|
||||||
@ApiModelProperty(value = "数据源ID列表", required = true)
|
@ApiModelProperty(value = "数据源ID列表", required = true)
|
||||||
@@ -40,8 +35,6 @@ public class AdPlanParam {
|
|||||||
private List<String> datasourceIds;
|
private List<String> datasourceIds;
|
||||||
|
|
||||||
@ApiModelProperty(value = "检测脚本ID", required = true)
|
@ApiModelProperty(value = "检测脚本ID", required = true)
|
||||||
@NotBlank(message = DetectionValidMessage.SCRIPT_ID_NOT_BLANK)
|
|
||||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.SCRIPT_ID_FORMAT_ERROR)
|
|
||||||
private String scriptId;
|
private String scriptId;
|
||||||
|
|
||||||
@ApiModelProperty(value = "误差体系ID", required = true)
|
@ApiModelProperty(value = "误差体系ID", required = true)
|
||||||
@@ -56,7 +49,6 @@ public class AdPlanParam {
|
|||||||
private Integer timeCheck;
|
private Integer timeCheck;
|
||||||
|
|
||||||
@ApiModelProperty("被检设备ID列表")
|
@ApiModelProperty("被检设备ID列表")
|
||||||
@NotNull(message = DetectionValidMessage.PQ_DEV_IDS_NOT_NULL)
|
|
||||||
private List<String> devIds;
|
private List<String> devIds;
|
||||||
|
|
||||||
@ApiModelProperty(value = "是否关联报告")
|
@ApiModelProperty(value = "是否关联报告")
|
||||||
@@ -70,6 +62,16 @@ public class AdPlanParam {
|
|||||||
@NotBlank(message = DetectionValidMessage.DATA_RULE_NOT_BLANK)
|
@NotBlank(message = DetectionValidMessage.DATA_RULE_NOT_BLANK)
|
||||||
private String dataRule;
|
private String dataRule;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "父计划ID")
|
||||||
|
private String fatherPlanId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "标准设备ID列表")
|
||||||
|
private List<String> standardDevIds;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "测试项ID列表")
|
||||||
|
private List<@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.SOURCE_ID_FORMAT_ERROR)String> testItems;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询实体
|
* 分页查询实体
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -90,14 +90,25 @@ public class AdPlan extends BaseEntity implements Serializable {
|
|||||||
@TableField(updateStrategy = FieldStrategy.IGNORED)
|
@TableField(updateStrategy = FieldStrategy.IGNORED)
|
||||||
private String reportTemplateId;
|
private String reportTemplateId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据处理原则。任意值、部分值、所有值、cp95值、平均值
|
||||||
|
*/
|
||||||
|
private String dataRule;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 状态:0-删除 1-正常
|
* 状态:0-删除 1-正常
|
||||||
*/
|
*/
|
||||||
private Integer state;
|
private Integer state;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据处理原则。任意值、部分值、所有值、cp95值、平均值
|
* 检测项ID,中间使用英文逗号分割
|
||||||
*/
|
*/
|
||||||
private String dataRule;
|
private String testItem;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 来源
|
||||||
|
*/
|
||||||
|
private String origin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package com.njcn.gather.plan.pojo.po;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author caozehui
|
||||||
|
* @date 2025-07-16
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName("ad_plan_standard_dev")
|
||||||
|
public class AdPlanStandardDev implements Serializable {
|
||||||
|
private static final long serialVersionUID = 153286652772158825L;
|
||||||
|
/**
|
||||||
|
* 检测计划id
|
||||||
|
*/
|
||||||
|
private String planId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 标准设备id
|
||||||
|
*/
|
||||||
|
private String standardDevId;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@@ -41,7 +41,7 @@ public class AdPlanExcel {
|
|||||||
@NotNull(message = DetectionValidMessage.TIMECHECK_NOT_NULL)
|
@NotNull(message = DetectionValidMessage.TIMECHECK_NOT_NULL)
|
||||||
private Integer timeCheck;
|
private Integer timeCheck;
|
||||||
|
|
||||||
@Excel(name = "关联报告模版*", width = 20, replace = {"否_0", "是_1"}, needMerge = true, orderNum = "7")
|
@Excel(name = "关联报告模板*", width = 20, replace = {"否_0", "是_1"}, needMerge = true, orderNum = "7")
|
||||||
@NotNull(message = DetectionValidMessage.ASSOCIATE_REPORT_NOT_NULL)
|
@NotNull(message = DetectionValidMessage.ASSOCIATE_REPORT_NOT_NULL)
|
||||||
private Integer associateReport;
|
private Integer associateReport;
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
package com.njcn.gather.plan.pojo.vo;
|
package com.njcn.gather.plan.pojo.vo;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import com.njcn.gather.device.pojo.vo.PqDevVO;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author caozehui
|
* @author caozehui
|
||||||
@@ -109,5 +110,43 @@ public class AdPlanVO {
|
|||||||
*/
|
*/
|
||||||
private String reportTemplateName;
|
private String reportTemplateName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据处理原则
|
||||||
|
*/
|
||||||
private String dataRule;
|
private String dataRule;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检测进度
|
||||||
|
*/
|
||||||
|
private Float progress;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 标准设备ID列表
|
||||||
|
*/
|
||||||
|
private Map<String, Integer> standardDevMap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 标准设备名称
|
||||||
|
*/
|
||||||
|
private String standardDevNameStr;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 测试项id列表
|
||||||
|
*/
|
||||||
|
private List<String> testItems;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 测试项name列表
|
||||||
|
*/
|
||||||
|
private String testItemNameStr;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计划绑定的被检设备列表
|
||||||
|
*/
|
||||||
|
private List<PqDevVO> pqDevVOList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 来源
|
||||||
|
*/
|
||||||
|
private String origin;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package com.njcn.gather.plan.pojo.vo;
|
||||||
|
|
||||||
|
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||||
|
import com.baomidou.mybatisplus.annotation.FieldStrategy;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author caozehui
|
||||||
|
* @data 2025-07-16
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ContrastPlanExcel {
|
||||||
|
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@Excel(name = "名称*", width = 30, orderNum = "1")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Excel(name = "标准设备*", width = 50, orderNum = "2")
|
||||||
|
private String standardDev;
|
||||||
|
|
||||||
|
@Excel(name = "数据源*", width = 50, orderNum = "3")
|
||||||
|
private String datasourceId;
|
||||||
|
|
||||||
|
@Excel(name = "检测项*", width = 50, orderNum = "4")
|
||||||
|
private String testItem;
|
||||||
|
|
||||||
|
@Excel(name = "误差体系*", width = 50, orderNum = "5")
|
||||||
|
private String errorSysId;
|
||||||
|
|
||||||
|
@Excel(name = "数据处理原则*", width = 20, orderNum = "6")
|
||||||
|
private String dataRule;
|
||||||
|
|
||||||
|
@Excel(name = "是否做守时检测*", width = 30, orderNum = "7")
|
||||||
|
private Integer timeCheck;
|
||||||
|
|
||||||
|
@Excel(name = "关联报告模板*", width = 30, orderNum = "8", replace = {"否_0", "是_1"})
|
||||||
|
private Integer associateReport;
|
||||||
|
|
||||||
|
@Excel(name = "报告模版(当关联报告模版为是时必填)", width = 40, orderNum = "9")
|
||||||
|
private String reportTemplateId;
|
||||||
|
}
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
package com.njcn.gather.plan.pojo.vo;
|
package com.njcn.gather.plan.pojo.vo;
|
||||||
|
|
||||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
|
||||||
import cn.afterturn.easypoi.excel.annotation.ExcelCollection;
|
import cn.afterturn.easypoi.excel.annotation.ExcelCollection;
|
||||||
import com.njcn.gather.device.pojo.vo.ProvinceDevExcel;
|
import com.njcn.gather.device.pojo.vo.ProvinceDevExcel;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ package com.njcn.gather.plan.service;
|
|||||||
|
|
||||||
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.gather.device.pojo.param.PqDevParam;
|
||||||
|
import com.njcn.gather.device.pojo.po.PqStandardDev;
|
||||||
import com.njcn.gather.plan.pojo.param.AdPlanParam;
|
import com.njcn.gather.plan.pojo.param.AdPlanParam;
|
||||||
import com.njcn.gather.plan.pojo.po.AdPlan;
|
import com.njcn.gather.plan.pojo.po.AdPlan;
|
||||||
import com.njcn.gather.plan.pojo.vo.AdPlanExcel;
|
import com.njcn.gather.plan.pojo.vo.AdPlanExcel;
|
||||||
@@ -24,7 +26,7 @@ public interface IAdPlanService extends IService<AdPlan> {
|
|||||||
* @param queryParam 分页查询参数
|
* @param queryParam 分页查询参数
|
||||||
* @return 分页查询结果
|
* @return 分页查询结果
|
||||||
*/
|
*/
|
||||||
Page<AdPlanVO> listAdPlan(AdPlanParam.QueryParam queryParam);
|
List<AdPlanVO> listAdPlan(AdPlanParam.QueryParam queryParam);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增检测计划
|
* 新增检测计划
|
||||||
@@ -46,9 +48,11 @@ public interface IAdPlanService extends IService<AdPlan> {
|
|||||||
* 删除检测计划
|
* 删除检测计划
|
||||||
*
|
*
|
||||||
* @param ids 检测计划id列表
|
* @param ids 检测计划id列表
|
||||||
|
* @param pattern 模式Id
|
||||||
|
*
|
||||||
* @return 删除成功则返回true,否则返回false
|
* @return 删除成功则返回true,否则返回false
|
||||||
*/
|
*/
|
||||||
boolean deleteAdPlan(List<String> ids);
|
boolean deleteAdPlan(List<String> ids,String pattern);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据模式查询检测计划
|
* 根据模式查询检测计划
|
||||||
@@ -82,7 +86,7 @@ public interface IAdPlanService extends IService<AdPlan> {
|
|||||||
* @param devIds
|
* @param devIds
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
boolean updateTestState(String planId, List<String> devIds);
|
//boolean updateTestState(String planId, List<String> devIds);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据状态回退
|
* 数据状态回退
|
||||||
@@ -123,5 +127,58 @@ public interface IAdPlanService extends IService<AdPlan> {
|
|||||||
* @param patternId
|
* @param patternId
|
||||||
* @param response
|
* @param response
|
||||||
*/
|
*/
|
||||||
void importPlan(MultipartFile file, String patternId, HttpServletResponse response);
|
boolean importPlan(MultipartFile file, String patternId, HttpServletResponse response);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据父计划Id获取未被子计划绑定的标准设备
|
||||||
|
*
|
||||||
|
* @param fatherPlanId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<PqStandardDev> getUnBoundStandardDev(String fatherPlanId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据计划Id获取已绑定标准设备
|
||||||
|
*
|
||||||
|
* @param planId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<PqStandardDev> getBoundStandardDev(String planId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改子计划名称
|
||||||
|
*
|
||||||
|
* @param planId
|
||||||
|
* @param name
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
boolean updateSubPlanName(String planId, String name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 子计划绑定/解绑被检设备
|
||||||
|
*
|
||||||
|
* @param planId
|
||||||
|
* @param pqDevIds
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
boolean updateBindDev(PqDevParam.BindPlanParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 子计划绑定/解绑标准设备
|
||||||
|
*
|
||||||
|
* @param planId
|
||||||
|
* @param standardDevIds
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
boolean updateBindStandardDev(String planId, List<String> standardDevIds);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据计划Id导出子计划数据
|
||||||
|
*
|
||||||
|
* @param planId
|
||||||
|
* @param response
|
||||||
|
*/
|
||||||
|
void exportSubPlan(String planId, HttpServletResponse response);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,65 @@
|
|||||||
|
package com.njcn.gather.plan.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.njcn.gather.plan.pojo.po.AdPlanStandardDev;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author caozehui
|
||||||
|
* @date 2025-07-16
|
||||||
|
*/
|
||||||
|
public interface IAdPlanStandardDevService extends IService<AdPlanStandardDev> {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加检测计划-标准设备关联关系
|
||||||
|
*
|
||||||
|
* @param planId
|
||||||
|
* @param standardDevIds
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
boolean addAdPlanStandardDev(String planId, List<String> standardDevIds);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改检测计划-标准设备关联关系
|
||||||
|
*
|
||||||
|
* @param planId
|
||||||
|
* @param standardDevIds
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
boolean updateAdPlanStandardDev(String planId, List<String> standardDevIds);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除检测计划-标准设备关联关系
|
||||||
|
*
|
||||||
|
* @param planIds
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
boolean deleteAdPlanStandardDev(List<String> planIds);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除检测计划-标准设备关联关系
|
||||||
|
*
|
||||||
|
* @param planId
|
||||||
|
* @param standardDevIds
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
boolean deleteAdPlanStandardDev(String planId, List<String> standardDevIds);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据检测计划id获取标准设备名称字符串
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
String getStandardDevNameStrByPlanId(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据检测计划id获取关联关系
|
||||||
|
*
|
||||||
|
* @param planIds
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<AdPlanStandardDev> listByPlanId(List<String> planIds);
|
||||||
|
}
|
||||||
@@ -10,32 +10,40 @@ import cn.hutool.core.util.CharsetUtil;
|
|||||||
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;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
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.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.common.pojo.poi.PullDown;
|
import com.njcn.common.pojo.poi.PullDown;
|
||||||
|
import com.njcn.gather.device.mapper.PqDevMapper;
|
||||||
import com.njcn.gather.device.pojo.enums.*;
|
import com.njcn.gather.device.pojo.enums.*;
|
||||||
import com.njcn.gather.device.pojo.param.PqDevParam;
|
import com.njcn.gather.device.pojo.param.PqDevParam;
|
||||||
import com.njcn.gather.device.pojo.po.PqDev;
|
import com.njcn.gather.device.pojo.po.PqDev;
|
||||||
|
import com.njcn.gather.device.pojo.po.PqDevSub;
|
||||||
|
import com.njcn.gather.device.pojo.po.PqStandardDev;
|
||||||
import com.njcn.gather.device.pojo.vo.CNDevExcel;
|
import com.njcn.gather.device.pojo.vo.CNDevExcel;
|
||||||
|
import com.njcn.gather.device.pojo.vo.ContrastDevExcel;
|
||||||
|
import com.njcn.gather.device.pojo.vo.PqDevVO;
|
||||||
import com.njcn.gather.device.pojo.vo.ProvinceDevExcel;
|
import com.njcn.gather.device.pojo.vo.ProvinceDevExcel;
|
||||||
import com.njcn.gather.device.service.IPqDevService;
|
import com.njcn.gather.device.service.IPqDevService;
|
||||||
|
import com.njcn.gather.device.service.IPqDevSubService;
|
||||||
import com.njcn.gather.err.pojo.po.PqErrSys;
|
import com.njcn.gather.err.pojo.po.PqErrSys;
|
||||||
import com.njcn.gather.err.service.IPqErrSysService;
|
import com.njcn.gather.err.service.IPqErrSysService;
|
||||||
import com.njcn.gather.plan.mapper.AdPlanMapper;
|
import com.njcn.gather.plan.mapper.AdPlanMapper;
|
||||||
|
import com.njcn.gather.plan.mapper.AdPlanStandardDevMapper;
|
||||||
import com.njcn.gather.plan.pojo.enums.DataSourceEnum;
|
import com.njcn.gather.plan.pojo.enums.DataSourceEnum;
|
||||||
import com.njcn.gather.plan.pojo.enums.PlanReportStateEnum;
|
import com.njcn.gather.plan.pojo.enums.PlanReportStateEnum;
|
||||||
import com.njcn.gather.plan.pojo.param.AdPlanParam;
|
import com.njcn.gather.plan.pojo.param.AdPlanParam;
|
||||||
import com.njcn.gather.plan.pojo.po.AdPlan;
|
import com.njcn.gather.plan.pojo.po.AdPlan;
|
||||||
|
import com.njcn.gather.plan.pojo.po.AdPlanStandardDev;
|
||||||
import com.njcn.gather.plan.pojo.vo.AdPlanVO;
|
import com.njcn.gather.plan.pojo.vo.AdPlanVO;
|
||||||
import com.njcn.gather.plan.pojo.vo.CNPlanExcel;
|
import com.njcn.gather.plan.pojo.vo.CNPlanExcel;
|
||||||
|
import com.njcn.gather.plan.pojo.vo.ContrastPlanExcel;
|
||||||
import com.njcn.gather.plan.pojo.vo.ProvincePlanExcel;
|
import com.njcn.gather.plan.pojo.vo.ProvincePlanExcel;
|
||||||
import com.njcn.gather.plan.service.IAdPlanService;
|
import com.njcn.gather.plan.service.IAdPlanService;
|
||||||
import com.njcn.gather.plan.service.IAdPlanSourceService;
|
import com.njcn.gather.plan.service.IAdPlanSourceService;
|
||||||
|
import com.njcn.gather.plan.service.IAdPlanStandardDevService;
|
||||||
import com.njcn.gather.pojo.enums.DetectionResponseEnum;
|
import com.njcn.gather.pojo.enums.DetectionResponseEnum;
|
||||||
import com.njcn.gather.report.pojo.po.PqReport;
|
import com.njcn.gather.report.pojo.po.PqReport;
|
||||||
import com.njcn.gather.script.pojo.po.PqScript;
|
import com.njcn.gather.script.pojo.po.PqScript;
|
||||||
@@ -45,7 +53,7 @@ import com.njcn.gather.script.service.IPqScriptService;
|
|||||||
import com.njcn.gather.source.pojo.po.PqSource;
|
import com.njcn.gather.source.pojo.po.PqSource;
|
||||||
import com.njcn.gather.source.service.IPqSourceService;
|
import com.njcn.gather.source.service.IPqSourceService;
|
||||||
import com.njcn.gather.storage.pojo.param.StorageParam;
|
import com.njcn.gather.storage.pojo.param.StorageParam;
|
||||||
import com.njcn.gather.storage.service.AdHarmonicService;
|
import com.njcn.gather.storage.service.SimAndDigHarmonicService;
|
||||||
import com.njcn.gather.storage.service.TableGenService;
|
import com.njcn.gather.storage.service.TableGenService;
|
||||||
import com.njcn.gather.system.cfg.pojo.enums.SceneEnum;
|
import com.njcn.gather.system.cfg.pojo.enums.SceneEnum;
|
||||||
import com.njcn.gather.system.cfg.pojo.po.SysTestConfig;
|
import com.njcn.gather.system.cfg.pojo.po.SysTestConfig;
|
||||||
@@ -58,7 +66,6 @@ import com.njcn.gather.system.dictionary.service.IDictTreeService;
|
|||||||
import com.njcn.gather.system.dictionary.service.IDictTypeService;
|
import com.njcn.gather.system.dictionary.service.IDictTypeService;
|
||||||
import com.njcn.gather.type.pojo.po.DevType;
|
import com.njcn.gather.type.pojo.po.DevType;
|
||||||
import com.njcn.gather.type.service.IDevTypeService;
|
import com.njcn.gather.type.service.IDevTypeService;
|
||||||
import com.njcn.web.factory.PageFactory;
|
|
||||||
import com.njcn.web.utils.ExcelUtil;
|
import com.njcn.web.utils.ExcelUtil;
|
||||||
import com.njcn.web.utils.HttpServletUtil;
|
import com.njcn.web.utils.HttpServletUtil;
|
||||||
import com.njcn.web.utils.PoiUtil;
|
import com.njcn.web.utils.PoiUtil;
|
||||||
@@ -103,55 +110,118 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
|||||||
private final ISysTestConfigService sysTestConfigService;
|
private final ISysTestConfigService sysTestConfigService;
|
||||||
private final IDevTypeService devTypeService;
|
private final IDevTypeService devTypeService;
|
||||||
private final IDictTypeService dictTypeService;
|
private final IDictTypeService dictTypeService;
|
||||||
private final AdHarmonicService adHarmonicService;
|
private final SimAndDigHarmonicService adHarmonicService;
|
||||||
|
private final PqDevMapper pqDevMapper;
|
||||||
|
private final IPqDevSubService pqDevSubService;
|
||||||
|
private final IAdPlanStandardDevService adPlanStandardDevService;
|
||||||
|
private final AdPlanStandardDevMapper adPlanStandardDevMapper;
|
||||||
|
private final IAdPlanStandardDevService adPlanContrastStandardDevService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<AdPlanVO> listAdPlan(AdPlanParam.QueryParam queryParam) {
|
public List<AdPlanVO> listAdPlan(AdPlanParam.QueryParam queryParam) {
|
||||||
Page<AdPlan> page1 = this.page(new Page<>(PageFactory.getPageNum(queryParam), PageFactory.getPageSize(queryParam)), this.getQueryWrapper(queryParam));
|
// Page<AdPlan> page1 = this.page(new Page<>(PageFactory.getPageNum(queryParam), PageFactory.getPageSize(queryParam)), );
|
||||||
List<AdPlan> adPlans = page1.getRecords();
|
// List<AdPlan> adPlans = page1.getRecords();
|
||||||
List<AdPlanVO> adPlanVOList = adPlans.stream().map(adPlan -> {
|
// List<AdPlanVO> adPlanVOList = adPlans.stream().map(adPlan -> {
|
||||||
|
// AdPlanVO adPlanVO = new AdPlanVO();
|
||||||
|
// BeanUtil.copyProperties(adPlan, adPlanVO);
|
||||||
|
// this.setAdPlanVO(adPlanVO, adPlan);
|
||||||
|
// return adPlanVO;
|
||||||
|
// }).collect(Collectors.toList());
|
||||||
|
//
|
||||||
|
// Page<AdPlanVO> page2 = new Page<>(PageFactory.getPageNum(queryParam), PageFactory.getPageSize(queryParam));
|
||||||
|
// page2.setTotal(page1.getTotal());
|
||||||
|
// page2.setOrders(page1.orders());
|
||||||
|
// page2.setPages(page1.getPages());
|
||||||
|
// page2.setRecords(adPlanVOList);
|
||||||
|
List<AdPlan> adPlanList = this.list(this.getQueryWrapper(queryParam));
|
||||||
|
List<AdPlanVO> planVOList = adPlanList.stream().map(adPlan -> {
|
||||||
AdPlanVO adPlanVO = new AdPlanVO();
|
AdPlanVO adPlanVO = new AdPlanVO();
|
||||||
BeanUtil.copyProperties(adPlan, adPlanVO);
|
BeanUtil.copyProperties(adPlan, adPlanVO);
|
||||||
adPlanVO.setCreateTime(adPlanVO.getCreateTime().replace("T", " "));
|
this.setAdPlanVO(adPlanVO, adPlan);
|
||||||
adPlanVO.setDatasourceIds(Arrays.asList(adPlan.getDatasourceId().split(StrUtil.COMMA)));
|
|
||||||
if (StrUtil.isNotBlank(adPlan.getReportTemplateId())) {
|
|
||||||
PqReport report = this.baseMapper.getPqReportById(adPlan.getReportTemplateId());
|
|
||||||
adPlanVO.setReportTemplateName(report.getName() + "_" + report.getVersion());
|
|
||||||
}
|
|
||||||
return adPlanVO;
|
return adPlanVO;
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
adPlanVOList.forEach(adPlanVO -> {
|
return planVOList;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setAdPlanVO(AdPlanVO adPlanVO, AdPlan adPlan) {
|
||||||
|
adPlanVO.setCreateTime(adPlanVO.getCreateTime().replace("T", " "));
|
||||||
|
adPlanVO.setDatasourceIds(Arrays.asList(adPlan.getDatasourceId().split(StrUtil.COMMA)));
|
||||||
|
if (StrUtil.isNotBlank(adPlan.getReportTemplateId())) {
|
||||||
|
PqReport report = this.baseMapper.getPqReportById(adPlan.getReportTemplateId());
|
||||||
|
adPlanVO.setReportTemplateName(report.getName() + "_" + report.getVersion());
|
||||||
|
}
|
||||||
|
if (StrUtil.isNotBlank(adPlanVO.getScriptId())) {
|
||||||
adPlanVO.setScriptName(pqScriptService.getPqScriptById(adPlanVO.getScriptId()).getName());
|
adPlanVO.setScriptName(pqScriptService.getPqScriptById(adPlanVO.getScriptId()).getName());
|
||||||
adPlanVO.setErrorSysName(pqErrSysService.getPqErrSysById(adPlanVO.getErrorSysId()).getName());
|
}
|
||||||
|
adPlanVO.setErrorSysName(pqErrSysService.getPqErrSysById(adPlanVO.getErrorSysId()).getName());
|
||||||
|
|
||||||
List<PqSource> pqSourceList = adPlanSourceService.listPqSourceByPlanId(adPlanVO.getId());
|
List<PqSource> pqSourceList = adPlanSourceService.listPqSourceByPlanId(adPlanVO.getId());
|
||||||
adPlanVO.setSourceIds(pqSourceList.stream().map(PqSource::getId).collect(Collectors.toList()));
|
adPlanVO.setSourceIds(pqSourceList.stream().map(PqSource::getId).collect(Collectors.toList()));
|
||||||
adPlanVO.setSourceName(pqSourceList.stream().map(PqSource::getName).collect(Collectors.toList()));
|
adPlanVO.setSourceName(pqSourceList.stream().map(PqSource::getName).collect(Collectors.toList()));
|
||||||
});
|
|
||||||
|
|
||||||
Page<AdPlanVO> page2 = new Page<>(PageFactory.getPageNum(queryParam), PageFactory.getPageSize(queryParam));
|
PqDevParam.QueryParam queryParam1 = new PqDevParam.QueryParam();
|
||||||
page2.setTotal(page1.getTotal());
|
queryParam1.setPlanIdList(Arrays.asList(adPlan.getId()));
|
||||||
page2.setOrders(page1.orders());
|
|
||||||
page2.setPages(page1.getPages());
|
List<PqDevVO> pqDevVOList = pqDevMapper.selectByQueryParam(queryParam1);
|
||||||
page2.setRecords(adPlanVOList);
|
if (CollUtil.isNotEmpty(pqDevVOList)) {
|
||||||
return page2;
|
long count = pqDevVOList.stream().filter(pqDev -> CheckStateEnum.CHECKED.getValue().equals(pqDev.getCheckState())).count();
|
||||||
|
adPlanVO.setProgress((float) count / pqDevVOList.size());
|
||||||
|
} else {
|
||||||
|
adPlanVO.setProgress(0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (StrUtil.isNotBlank(adPlan.getTestItem())) {
|
||||||
|
adPlanVO.setTestItems(Arrays.asList(adPlan.getTestItem().split(StrUtil.COMMA)));
|
||||||
|
List<DictTree> dictTreeList = dictTreeService.listByIds(adPlanVO.getTestItems());
|
||||||
|
adPlanVO.setTestItemNameStr(dictTreeList.stream().map(DictTree::getName).reduce((a, b) -> a + "," + b).orElse(""));
|
||||||
|
}
|
||||||
|
|
||||||
|
List<String> planIdList = new ArrayList<>();
|
||||||
|
planIdList.add(adPlan.getId());
|
||||||
|
List<PqStandardDev> pqStandardDevs = adPlanStandardDevMapper.listByPlanId(planIdList);
|
||||||
|
adPlanVO.setStandardDevMap(pqStandardDevs.stream().collect(Collectors.toMap(PqStandardDev::getId, obj -> 0)));
|
||||||
|
adPlanVO.setStandardDevNameStr(pqStandardDevs.stream().map(PqStandardDev::getName).reduce((a, b) -> a + "," + b).orElse(""));
|
||||||
|
|
||||||
|
if (CommonEnum.FATHER_ID.getValue().equals(adPlan.getFatherPlanId())) {
|
||||||
|
List<AdPlan> childrenPlan = this.lambdaQuery().eq(AdPlan::getFatherPlanId, adPlan.getId()).eq(AdPlan::getState, DataStateEnum.ENABLE.getCode()).list();
|
||||||
|
List<String> childrenPlanIds = childrenPlan.stream().map(AdPlan::getId).collect(Collectors.toList());
|
||||||
|
if (CollUtil.isNotEmpty(childrenPlanIds)) {
|
||||||
|
pqStandardDevs = adPlanStandardDevMapper.listByPlanId(childrenPlanIds);
|
||||||
|
} else {
|
||||||
|
pqStandardDevs.clear();
|
||||||
|
}
|
||||||
|
Map<String, Integer> standardDevIds = adPlanVO.getStandardDevMap();
|
||||||
|
standardDevIds.putAll(pqStandardDevs.stream().collect(Collectors.toMap(PqStandardDev::getId, obj -> 1)));
|
||||||
|
// adPlanVO.setStandardDevNameStr(adPlanVO.getStandardDevNameStr() + pqStandardDevs.stream().map(PqStandardDev::getName).reduce((a, b) -> a + "," + b).orElse(""));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public boolean addAdPlan(AdPlanParam param) {
|
public boolean addAdPlan(AdPlanParam param) {
|
||||||
this.checkRepeat(param, false);
|
param.setName(param.getName().trim());
|
||||||
|
this.checkRepeat(param, false, CommonEnum.FATHER_ID.getValue());
|
||||||
AdPlan adPlan = new AdPlan();
|
AdPlan adPlan = new AdPlan();
|
||||||
BeanUtil.copyProperties(param, adPlan);
|
BeanUtil.copyProperties(param, adPlan);
|
||||||
adPlan.setName(param.getName().trim());
|
|
||||||
|
|
||||||
String planId = UUID.randomUUID().toString().replaceAll("-", "");
|
String planId = UUID.randomUUID().toString().replaceAll("-", "");
|
||||||
adPlan.setId(planId);
|
adPlan.setId(planId);
|
||||||
adPlan.setDatasourceId(String.join(StrUtil.COMMA, param.getDatasourceIds()));
|
adPlan.setDatasourceId(String.join(StrUtil.COMMA, param.getDatasourceIds()));
|
||||||
|
|
||||||
adPlan.setState(DataStateEnum.ENABLE.getCode());
|
adPlan.setState(DataStateEnum.ENABLE.getCode());
|
||||||
|
|
||||||
// 默认为顶级检测计划
|
// 默认为顶级检测计划
|
||||||
adPlan.setFatherPlanId(CommonEnum.FATHER_ID.getValue());
|
adPlan.setFatherPlanId(CommonEnum.FATHER_ID.getValue());
|
||||||
|
|
||||||
|
|
||||||
|
if (StrUtil.isBlank(param.getFatherPlanId())) {
|
||||||
|
// 默认为顶级检测计划
|
||||||
|
adPlan.setFatherPlanId(CommonEnum.FATHER_ID.getValue());
|
||||||
|
} else {
|
||||||
|
AdPlan plan = this.getById(param.getFatherPlanId());
|
||||||
|
adPlan.setFatherPlanId(param.getFatherPlanId());
|
||||||
|
adPlan.setOrigin(plan.getName());
|
||||||
|
}
|
||||||
adPlan.setTestState(CheckStateEnum.UNCHECKED.getValue());
|
adPlan.setTestState(CheckStateEnum.UNCHECKED.getValue());
|
||||||
adPlan.setReportState(PlanReportStateEnum.REPORT_STATE_NOT_GENERATED.getValue());
|
adPlan.setReportState(PlanReportStateEnum.REPORT_STATE_NOT_GENERATED.getValue());
|
||||||
adPlan.setResult(CheckResultEnum.UNCHECKED.getValue());
|
adPlan.setResult(CheckResultEnum.UNCHECKED.getValue());
|
||||||
@@ -165,9 +235,7 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
|||||||
adPlan.setReportTemplateId(reportId);
|
adPlan.setReportTemplateId(reportId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 绑定被检设备
|
||||||
// 新增检测计划、检测源关联
|
|
||||||
adPlanSourceService.addAdPlanSource(planId, param.getSourceIds());
|
|
||||||
if (ObjectUtil.isNotEmpty(param.getDevIds())) {
|
if (ObjectUtil.isNotEmpty(param.getDevIds())) {
|
||||||
// 新增时,绑定设备
|
// 新增时,绑定设备
|
||||||
pqDevService.bind(planId, param.getDevIds());
|
pqDevService.bind(planId, param.getDevIds());
|
||||||
@@ -176,10 +244,26 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
|||||||
pqDevService.updatePqDevTimeCheckResult(param.getDevIds(), TimeCheckResultEnum.UNKNOWN);
|
pqDevService.updatePqDevTimeCheckResult(param.getDevIds(), TimeCheckResultEnum.UNKNOWN);
|
||||||
}
|
}
|
||||||
|
|
||||||
//新增相关计划
|
//检测项
|
||||||
|
if (CollUtil.isNotEmpty(param.getTestItems())) {
|
||||||
|
adPlan.setTestItem(String.join(StrUtil.COMMA, param.getTestItems()));
|
||||||
|
}
|
||||||
this.save(adPlan);
|
this.save(adPlan);
|
||||||
|
|
||||||
|
DictData dictData = dictDataService.getDictDataById(param.getPattern());
|
||||||
|
if (PatternEnum.CONTRAST.getValue().equals(dictData.getCode())) {
|
||||||
|
// 关联标准设备
|
||||||
|
if (CollUtil.isNotEmpty(param.getStandardDevIds())) {
|
||||||
|
adPlanStandardDevService.deleteAdPlanStandardDev(param.getFatherPlanId(), param.getStandardDevIds());
|
||||||
|
adPlanStandardDevService.addAdPlanStandardDev(planId, param.getStandardDevIds());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 关联检测源
|
||||||
|
adPlanSourceService.addAdPlanSource(planId, param.getSourceIds());
|
||||||
|
}
|
||||||
tableGenService.deleteTable(Arrays.asList(adPlan.getCode().toString()));
|
tableGenService.deleteTable(Arrays.asList(adPlan.getCode().toString()));
|
||||||
tableGenService.genAdNonHarmonicTable(adPlan.getCode().toString());
|
tableGenService.genTable(adPlan.getCode().toString(), PatternEnum.CONTRAST.getValue().equals(dictData.getCode()));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -187,7 +271,7 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
|||||||
@Transactional
|
@Transactional
|
||||||
public boolean updateAdPlan(AdPlanParam.UpdateParam param) {
|
public boolean updateAdPlan(AdPlanParam.UpdateParam param) {
|
||||||
param.setName(param.getName().trim());
|
param.setName(param.getName().trim());
|
||||||
this.checkRepeat(param, true);
|
this.checkRepeat(param, true, CommonEnum.FATHER_ID.getValue());
|
||||||
AdPlan plan1 = this.getById(param.getId());
|
AdPlan plan1 = this.getById(param.getId());
|
||||||
AdPlan plan2 = new AdPlan();
|
AdPlan plan2 = new AdPlan();
|
||||||
|
|
||||||
@@ -196,11 +280,6 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
|||||||
String reportTemplateName = param.getReportTemplateName();
|
String reportTemplateName = param.getReportTemplateName();
|
||||||
String[] split = reportTemplateName.split("_");
|
String[] split = reportTemplateName.split("_");
|
||||||
String reportId = this.baseMapper.getReportIdByNameAndVersion(split[0], split[1]);
|
String reportId = this.baseMapper.getReportIdByNameAndVersion(split[0], split[1]);
|
||||||
// if (plan1.getTestState() != CheckStateEnum.UNCHECKED.getValue()) {
|
|
||||||
// if (!reportId.equals(plan1.getReportTemplateId())) {
|
|
||||||
// throw new BusinessException(DetectionResponseEnum.CANNOT_CHANGE_REPORT_WHEN_CHECKING);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
if (StrUtil.isNotBlank(reportId)) {
|
if (StrUtil.isNotBlank(reportId)) {
|
||||||
plan2.setReportTemplateId(reportId);
|
plan2.setReportTemplateId(reportId);
|
||||||
}
|
}
|
||||||
@@ -216,36 +295,83 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
|||||||
if (!plan1.getErrorSysId().equals(param.getErrorSysId())) {
|
if (!plan1.getErrorSysId().equals(param.getErrorSysId())) {
|
||||||
throw new BusinessException(DetectionResponseEnum.CANNOT_CHANGE_ERROR_SYS_WHEN_CHECKING);
|
throw new BusinessException(DetectionResponseEnum.CANNOT_CHANGE_ERROR_SYS_WHEN_CHECKING);
|
||||||
}
|
}
|
||||||
// if (param.getAssociateReport() != null && param.getAssociateReport() != plan1.getAssociateReport()) {
|
|
||||||
// throw new BusinessException(DetectionResponseEnum.CANNOT_CHANGE_REPORT_WHEN_CHECKING);
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BeanUtil.copyProperties(param, plan2);
|
BeanUtil.copyProperties(param, plan2);
|
||||||
plan2.setDatasourceId(String.join(StrUtil.COMMA, param.getDatasourceIds()));
|
plan2.setDatasourceId(String.join(StrUtil.COMMA, param.getDatasourceIds()));
|
||||||
// 修改检测计划、检测源关联
|
if (CollUtil.isNotEmpty(param.getTestItems())) {
|
||||||
adPlanSourceService.updateAdPlanSource(param.getId(), param.getSourceIds());
|
plan2.setTestItem(String.join(StrUtil.COMMA, param.getTestItems()));
|
||||||
plan2.setTestState(pqDevService.bind(param.getId(), param.getDevIds()));
|
}
|
||||||
|
|
||||||
|
DictData dictData = dictDataService.getDictDataById(param.getPattern());
|
||||||
|
if (PatternEnum.CONTRAST.getValue().equals(dictData.getCode())) {
|
||||||
|
List<AdPlan> childrenPlan = this.lambdaQuery().eq(AdPlan::getFatherPlanId, param.getId()).list();
|
||||||
|
List<String> childrenPlanIds = childrenPlan.stream().map(AdPlan::getId).collect(Collectors.toList());
|
||||||
|
|
||||||
|
// 修改与标准设备的关联关系
|
||||||
|
List<AdPlanStandardDev> adPlanStandardDevList = new ArrayList<>();
|
||||||
|
if (CollUtil.isNotEmpty(childrenPlanIds)) {
|
||||||
|
adPlanStandardDevList.addAll(adPlanStandardDevService.lambdaQuery().in(AdPlanStandardDev::getPlanId, childrenPlanIds).list());
|
||||||
|
}
|
||||||
|
|
||||||
|
// if (CollUtil.isNotEmpty(adPlanStandardDevList)) {
|
||||||
|
// throw new BusinessException(DetectionResponseEnum.PLEASE_UNASSIGN_STANDARD_DEV);
|
||||||
|
// }
|
||||||
|
List<String> standardDevIds = adPlanStandardDevList.stream().map(AdPlanStandardDev::getStandardDevId).collect(Collectors.toList());
|
||||||
|
param.getStandardDevIds().removeAll(standardDevIds);
|
||||||
|
adPlanStandardDevService.updateAdPlanStandardDev(param.getId(), param.getStandardDevIds());
|
||||||
|
|
||||||
|
// 修改与被检设备的关联关系
|
||||||
|
PqDevParam.QueryParam param1 = new PqDevParam.QueryParam();
|
||||||
|
param1.setPlanIdList(childrenPlanIds);
|
||||||
|
List<PqDevVO> pqDevVOList = pqDevService.listByPlanId(param1);
|
||||||
|
|
||||||
|
// if (CollUtil.isNotEmpty(pqDevVOList)) {
|
||||||
|
// throw new BusinessException(DetectionResponseEnum.PLEASE_UNASSIGN_DEVICE);
|
||||||
|
// }
|
||||||
|
|
||||||
|
List<String> devIds = pqDevVOList.stream().map(PqDevVO::getId).collect(Collectors.toList());
|
||||||
|
param.getDevIds().removeAll(devIds);
|
||||||
|
} else {
|
||||||
|
// 修改检测计划、检测源关联
|
||||||
|
adPlanSourceService.updateAdPlanSource(param.getId(), param.getSourceIds());
|
||||||
|
}
|
||||||
|
plan2.setTestState(pqDevService.bind(param.getId(), param.getDevIds()));
|
||||||
|
// 若修改了名称,则修改相关子计划的来源字段
|
||||||
|
if (!plan1.getName().equals(param.getName()) && CommonEnum.FATHER_ID.getValue().equals(plan1.getFatherPlanId())) {
|
||||||
|
this.lambdaUpdate().in(AdPlan::getFatherPlanId, plan1.getId()).eq(AdPlan::getState, DataStateEnum.ENABLE.getCode())
|
||||||
|
.set(AdPlan::getOrigin, param.getName()).update();
|
||||||
|
}
|
||||||
return this.updateById(plan2);
|
return this.updateById(plan2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public boolean deleteAdPlan(List<String> ids) {
|
public boolean deleteAdPlan(List<String> ids, String pattern) {
|
||||||
for (String id : ids) {
|
for (String id : ids) {
|
||||||
PqDevParam.QueryParam queryParam = new PqDevParam.QueryParam();
|
PqDevParam.QueryParam queryParam = new PqDevParam.QueryParam();
|
||||||
queryParam.setPlanId(id);
|
queryParam.setPlanIdList(Arrays.asList(id));
|
||||||
if (ObjectUtils.isNotEmpty(pqDevService.listByPlanId(queryParam))) {
|
if (ObjectUtils.isNotEmpty(pqDevService.listByPlanId(queryParam))) {
|
||||||
throw new BusinessException(DetectionResponseEnum.PLAN_HAS_DEVICE_BIND);
|
throw new BusinessException(DetectionResponseEnum.PLAN_HAS_DEVICE_BIND);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 删除检测计划、检测源关联
|
|
||||||
adPlanSourceService.deleteAdPlanSourceByPlanIds(ids);
|
|
||||||
|
|
||||||
// 删除相关检测表格
|
DictData dictData = dictDataService.getDictDataById(pattern);
|
||||||
List<String> codeList = this.listByIds(ids).stream().map(plan -> String.valueOf(plan.getCode())).collect(Collectors.toList());
|
if (PatternEnum.CONTRAST.getValue().equals(dictData.getCode())) {
|
||||||
tableGenService.deleteTable(codeList);
|
List<AdPlan> planList = this.lambdaQuery().in(AdPlan::getFatherPlanId, ids).eq(AdPlan::getState, DataStateEnum.ENABLE.getCode()).list();
|
||||||
|
if (CollUtil.isNotEmpty(planList)) {
|
||||||
|
throw new BusinessException(DetectionResponseEnum.PLAN_HAS_CHILDREN);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除检测计划、标准设备关联
|
||||||
|
adPlanStandardDevService.deleteAdPlanStandardDev(ids);
|
||||||
|
} else {
|
||||||
|
// 删除相关检测表格
|
||||||
|
List<String> codeList = this.listByIds(ids).stream().map(plan -> String.valueOf(plan.getCode())).collect(Collectors.toList());
|
||||||
|
tableGenService.deleteTable(codeList);
|
||||||
|
// 删除检测计划、检测源关联
|
||||||
|
adPlanSourceService.deleteAdPlanSourceByPlanIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
return this.lambdaUpdate().in(AdPlan::getId, ids).set(AdPlan::getState, DataStateEnum.DELETED.getCode()).update();
|
return this.lambdaUpdate().in(AdPlan::getId, ids).set(AdPlan::getState, DataStateEnum.DELETED.getCode()).update();
|
||||||
}
|
}
|
||||||
@@ -275,6 +401,17 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
|||||||
child.put("pid", adPlan.getFatherPlanId());
|
child.put("pid", adPlan.getFatherPlanId());
|
||||||
child.put("name", adPlan.getName());
|
child.put("name", adPlan.getName());
|
||||||
child.put("timeCheck", adPlan.getTimeCheck());
|
child.put("timeCheck", adPlan.getTimeCheck());
|
||||||
|
|
||||||
|
List<PqStandardDev> pqStandardDevs = adPlanStandardDevMapper.listByPlanId(Collections.singletonList(adPlan.getId()));
|
||||||
|
List<String> devTypeIdList = pqStandardDevs.stream().map(PqStandardDev::getDevType).collect(Collectors.toList());
|
||||||
|
if (devTypeIdList.size() > 0) {
|
||||||
|
List<DevType> devTypeList = devTypeService.listByIds(devTypeIdList);
|
||||||
|
pqStandardDevs.forEach(pqStandardDev -> {
|
||||||
|
DevType devType1 = devTypeList.stream().filter(devType -> devType.getId().equals(pqStandardDev.getDevType())).findFirst().get();
|
||||||
|
pqStandardDev.setDevType(devType1.getName());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
child.put("standardDevs", pqStandardDevs);
|
||||||
children.add(child);
|
children.add(child);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -315,6 +452,12 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
|||||||
PqReport report = this.baseMapper.getPqReportById(adPlan.getReportTemplateId());
|
PqReport report = this.baseMapper.getPqReportById(adPlan.getReportTemplateId());
|
||||||
adPlan.setReportTemplateId(report.getName() + "_" + report.getVersion());
|
adPlan.setReportTemplateId(report.getName() + "_" + report.getVersion());
|
||||||
}
|
}
|
||||||
|
if (StrUtil.isNotBlank(adPlan.getTestItem())) {
|
||||||
|
String[] split = adPlan.getTestItem().split(StrUtil.COMMA);
|
||||||
|
List<DictTree> dictTreeList = dictTreeService.list(new QueryWrapper<DictTree>().in("id", split).eq("state", DataStateEnum.DELETED.getCode()));
|
||||||
|
String testItemStr = dictTreeList.stream().map(dictTree -> dictTree.getName()).reduce((a, b) -> a + "," + b).orElse("");
|
||||||
|
adPlan.setTestItem(testItemStr);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -331,13 +474,13 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
|||||||
|
|
||||||
// 不合格项复检
|
// 不合格项复检
|
||||||
if (reCheckType == 0) {
|
if (reCheckType == 0) {
|
||||||
// List<AdBaseResult> allResultList = new ArrayList<>();
|
// List<SimAndDigBaseResult> allResultList = new ArrayList<>();
|
||||||
// allResultList.addAll(adHarmonicService.get(scriptId, null, devId, "-1", adPlan.getCode()));
|
// allResultList.addAll(adHarmonicService.get(scriptId, null, devId, "-1", adPlan.getCode()));
|
||||||
// allResultList.addAll(adNonHarmonicService.get(scriptId, null, devId, "-1", adPlan.getCode()));
|
// allResultList.addAll(adNonHarmonicService.get(scriptId, null, devId, "-1", adPlan.getCode()));
|
||||||
//
|
//
|
||||||
// if (ObjectUtil.isNotEmpty(allResultList)) {
|
// if (ObjectUtil.isNotEmpty(allResultList)) {
|
||||||
// List<AdBaseResult> passList = allResultList.stream().filter(obj -> obj.getResultFlag() == 1).collect(Collectors.toList());
|
// List<SimAndDigBaseResult> passList = allResultList.stream().filter(obj -> obj.getResultFlag() == 1).collect(Collectors.toList());
|
||||||
// TreeSet<Integer> sortSet = passList.stream().map(AdBaseResult::getSort).collect(Collectors.toCollection(TreeSet::new));
|
// TreeSet<Integer> sortSet = passList.stream().map(SimAndDigBaseResult::getSort).collect(Collectors.toCollection(TreeSet::new));
|
||||||
//
|
//
|
||||||
// scriptDtlsList = scriptDtlsList.stream().filter(obj -> !sortSet.contains(obj.getScriptIndex())).collect(Collectors.toList());
|
// scriptDtlsList = scriptDtlsList.stream().filter(obj -> !sortSet.contains(obj.getScriptIndex())).collect(Collectors.toList());
|
||||||
// }
|
// }
|
||||||
@@ -372,42 +515,47 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
// @Override
|
||||||
public boolean updateTestState(String planId, List<String> devIds) {
|
// public boolean updateTestState(String planId, List<String> devIds) {
|
||||||
if (CollUtil.isNotEmpty(devIds)) {
|
// if (CollUtil.isNotEmpty(devIds)) {
|
||||||
pqDevService.update(new LambdaUpdateWrapper<PqDev>()
|
// pqDevService.update(new LambdaUpdateWrapper<PqDev>()
|
||||||
.set(PqDev::getCheckState, CheckStateEnum.CHECKING.getValue())
|
// .set(PqDev::getCheckState, CheckStateEnum.CHECKING.getValue())
|
||||||
.in(PqDev::getId, devIds));
|
// .in(PqDev::getId, devIds));
|
||||||
return this.update(new LambdaUpdateWrapper<AdPlan>()
|
// return this.update(new LambdaUpdateWrapper<AdPlan>()
|
||||||
.set(AdPlan::getTestState, CheckStateEnum.CHECKING.getValue())
|
// .set(AdPlan::getTestState, CheckStateEnum.CHECKING.getValue())
|
||||||
.eq(AdPlan::getId, planId));
|
// .eq(AdPlan::getId, planId));
|
||||||
}
|
// }
|
||||||
return true;
|
// return true;
|
||||||
}
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean updateBackTestState(String planId, List<String> devIds) {
|
public boolean updateBackTestState(String planId, List<String> devIds) {
|
||||||
//当前如果第二次进行测试,则需要将判断之前状态是否不是非检测状态
|
if (CollUtil.isNotEmpty(devIds)) {
|
||||||
List<PqDev> devList = pqDevService.list(new LambdaQueryWrapper<PqDev>().in(PqDev::getId, devIds));
|
//当前如果第二次进行测试,则需要将判断之前状态是否不是非检测状态
|
||||||
if (CollUtil.isNotEmpty(devList)) {
|
List<PqDevVO> pqDevVOList = pqDevMapper.listByDevIds(devIds);
|
||||||
for (PqDev pqDev : devList) {
|
|
||||||
if (!pqDev.getCheckResult().equals(CheckResultEnum.UNCHECKED.getValue())) {
|
if (CollUtil.isNotEmpty(pqDevVOList)) {
|
||||||
pqDevService.update(new LambdaUpdateWrapper<PqDev>()
|
for (PqDevVO pqDevVO : pqDevVOList) {
|
||||||
.set(PqDev::getCheckState, CheckStateEnum.CHECKED.getValue())
|
if (!pqDevVO.getCheckResult().equals(CheckResultEnum.UNCHECKED.getValue())) {
|
||||||
.in(PqDev::getId, devIds));
|
pqDevSubService.update(new LambdaUpdateWrapper<PqDevSub>()
|
||||||
} else {
|
.set(PqDevSub::getCheckState, CheckStateEnum.CHECKED.getValue())
|
||||||
pqDevService.update(new LambdaUpdateWrapper<PqDev>()
|
.in(PqDevSub::getDevId, devIds));
|
||||||
.set(PqDev::getCheckState, CheckStateEnum.UNCHECKED.getValue())
|
} else {
|
||||||
.in(PqDev::getId, devIds));
|
pqDevSubService.update(new LambdaUpdateWrapper<PqDevSub>()
|
||||||
|
.set(PqDevSub::getCheckState, CheckStateEnum.UNCHECKED.getValue())
|
||||||
|
.in(PqDevSub::getDevId, devIds));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
PqDevParam.QueryParam queryParam = new PqDevParam.QueryParam();
|
||||||
List<PqDev> list = pqDevService.list(new LambdaQueryWrapper<PqDev>().in(PqDev::getPlanId, planId));
|
queryParam.setPlanIdList(Arrays.asList(planId));
|
||||||
List<PqDev> collect = list.stream().filter(x -> !x.getCheckState().equals(CheckStateEnum.UNCHECKED.getValue())).collect(Collectors.toList());
|
List<PqDevVO> pqDevVOList1 = pqDevMapper.selectByQueryParam(queryParam);
|
||||||
if (CollUtil.isEmpty(collect)) {
|
List<PqDev> collect = pqDevVOList1.stream().filter(x -> !x.getCheckState().equals(CheckStateEnum.UNCHECKED.getValue())).collect(Collectors.toList());
|
||||||
return this.update(new LambdaUpdateWrapper<AdPlan>()
|
if (CollUtil.isEmpty(collect)) {
|
||||||
.set(AdPlan::getTestState, CheckStateEnum.UNCHECKED.getValue())
|
return this.update(new LambdaUpdateWrapper<AdPlan>()
|
||||||
.eq(AdPlan::getId, planId));
|
.set(AdPlan::getTestState, CheckStateEnum.UNCHECKED.getValue())
|
||||||
|
.eq(AdPlan::getId, planId));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -444,19 +592,19 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
|||||||
|
|
||||||
if (planList.size() > 1) {
|
if (planList.size() > 1) {
|
||||||
StringBuffer allNote = new StringBuffer();
|
StringBuffer allNote = new StringBuffer();
|
||||||
List<PqDev> allDevList = new ArrayList<>();
|
List<PqDevVO> allDevList = new ArrayList<>();
|
||||||
for (AdPlan plan : planList) {
|
for (AdPlan plan : planList) {
|
||||||
PqDevParam.QueryParam queryParam = new PqDevParam.QueryParam();
|
PqDevParam.QueryParam queryParam = new PqDevParam.QueryParam();
|
||||||
queryParam.setPlanId(plan.getId());
|
queryParam.setPlanIdList(Arrays.asList(plan.getId()));
|
||||||
List<PqDev> devList = pqDevService.listByPlanId(queryParam);
|
List<PqDevVO> pqDevVOList = pqDevMapper.selectByQueryParam(queryParam);
|
||||||
devList = devList.stream().filter(x -> !x.getCheckResult().equals(CheckResultEnum.UNCHECKED.getValue())).collect(Collectors.toList());
|
pqDevVOList = pqDevVOList.stream().filter(x -> !x.getCheckResult().equals(CheckResultEnum.UNCHECKED.getValue())).collect(Collectors.toList());
|
||||||
allDevList.addAll(devList);
|
allDevList.addAll(pqDevVOList);
|
||||||
|
|
||||||
allNote.append(plan.getName() + "计划" + devList.size() + "台,");
|
allNote.append(plan.getName() + "计划" + pqDevVOList.size() + "台,");
|
||||||
if (plan.getName().equals("概览")) {
|
if (plan.getName().equals("概览")) {
|
||||||
sheets.put(plan.getName() + "检测计划", getRows(plan.getName(), devList, maxTime, getNote(plan, devList)));
|
sheets.put(plan.getName() + "检测计划", getRows(plan.getName(), pqDevVOList, maxTime, getNote(plan, pqDevVOList)));
|
||||||
} else {
|
} else {
|
||||||
sheets.put(plan.getName(), getRows(plan.getName(), devList, maxTime, getNote(plan, devList)));
|
sheets.put(plan.getName(), getRows(plan.getName(), pqDevVOList, maxTime, getNote(plan, pqDevVOList)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
allNote.insert(0, "说明:总计" + allDevList.size() + "台设备,");
|
allNote.insert(0, "说明:总计" + allDevList.size() + "台设备,");
|
||||||
@@ -465,11 +613,11 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
|||||||
} else {
|
} else {
|
||||||
AdPlan plan = planList.get(0);
|
AdPlan plan = planList.get(0);
|
||||||
PqDevParam.QueryParam queryParam = new PqDevParam.QueryParam();
|
PqDevParam.QueryParam queryParam = new PqDevParam.QueryParam();
|
||||||
queryParam.setPlanId(plan.getId());
|
queryParam.setPlanIdList(Arrays.asList(plan.getId()));
|
||||||
List<PqDev> devList = pqDevService.listByPlanId(queryParam);
|
List<PqDevVO> pqDevVOList = pqDevMapper.selectByQueryParam(queryParam);
|
||||||
devList = devList.stream().filter(x -> !x.getCheckResult().equals(CheckResultEnum.UNCHECKED.getValue())).collect(Collectors.toList());
|
pqDevVOList = pqDevVOList.stream().filter(x -> !x.getCheckResult().equals(CheckResultEnum.UNCHECKED.getValue())).collect(Collectors.toList());
|
||||||
|
|
||||||
sheets.put(plan.getName(), getRows(plan.getName(), devList, maxTime, getNote(plan, devList)));
|
sheets.put(plan.getName(), getRows(plan.getName(), pqDevVOList, maxTime, getNote(plan, pqDevVOList)));
|
||||||
}
|
}
|
||||||
|
|
||||||
exportPassRateExcel("数据分析结果.xlsx", maxTime, sheets);
|
exportPassRateExcel("数据分析结果.xlsx", maxTime, sheets);
|
||||||
@@ -478,22 +626,62 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void exportPlan(AdPlanParam.QueryParam queryParam) {
|
public void exportPlan(AdPlanParam.QueryParam queryParam) {
|
||||||
String currrentScene = sysTestConfigService.getCurrrentScene();
|
DictData dictData = dictDataService.getDictDataById(queryParam.getPatternId());
|
||||||
SceneEnum sceneEnum = SceneEnum.getSceneEnum(currrentScene);
|
if (PatternEnum.CONTRAST.getValue().equals(dictData.getCode())) {
|
||||||
switch (sceneEnum) {
|
this.exportContrastPlan(queryParam);
|
||||||
case PROVINCE_PLATFORM:
|
} else {
|
||||||
this.exportProvincePlan(queryParam);
|
String currrentScene = sysTestConfigService.getCurrrentScene();
|
||||||
break;
|
SceneEnum sceneEnum = SceneEnum.getSceneEnum(currrentScene);
|
||||||
case LEAVE_FACTORY_TEST:
|
switch (sceneEnum) {
|
||||||
this.exportCNPlan(queryParam);
|
case PROVINCE_PLATFORM:
|
||||||
break;
|
this.exportProvincePlan(queryParam);
|
||||||
case SELF_TEST:
|
break;
|
||||||
break;
|
case LEAVE_FACTORY_TEST:
|
||||||
default:
|
this.exportCNPlan(queryParam);
|
||||||
break;
|
break;
|
||||||
|
case SELF_TEST:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void exportContrastPlan(AdPlanParam.QueryParam queryParam) {
|
||||||
|
List<AdPlan> planList = this.list(this.getQueryWrapper(queryParam));
|
||||||
|
this.visualize(planList);
|
||||||
|
List<ContrastPlanExcel> planExcelList = BeanUtil.copyToList(planList, ContrastPlanExcel.class);
|
||||||
|
|
||||||
|
List<Map<String, Object>> sheetsList = new ArrayList<>();
|
||||||
|
planExcelList.forEach(plan -> {
|
||||||
|
Map<String, Object> sheet = new HashMap<>();
|
||||||
|
ExportParams exportParams = new ExportParams();
|
||||||
|
exportParams.setSheetName(plan.getName());
|
||||||
|
sheet.put("title", exportParams);
|
||||||
|
sheet.put("entity", ContrastDevExcel.class);
|
||||||
|
|
||||||
|
PqDevParam.QueryParam param = new PqDevParam.QueryParam();
|
||||||
|
param.setPlanIdList(Arrays.asList(plan.getId()));
|
||||||
|
List<PqDevVO> pqDevVOList = pqDevService.listByPlanId(param);
|
||||||
|
List<ContrastDevExcel> exportContrastDevData = pqDevService.getExportContrastDevData(pqDevVOList);
|
||||||
|
sheet.put("data", exportContrastDevData);
|
||||||
|
sheetsList.add(sheet);
|
||||||
|
|
||||||
|
String standardDevNameStrByPlanId = adPlanContrastStandardDevService.getStandardDevNameStrByPlanId(plan.getId());
|
||||||
|
plan.setStandardDev(standardDevNameStrByPlanId);
|
||||||
|
});
|
||||||
|
|
||||||
|
Map<String, Object> sheet1 = new HashMap<>();
|
||||||
|
ExportParams exportParams1 = new ExportParams();
|
||||||
|
exportParams1.setSheetName("检测计划");
|
||||||
|
sheet1.put("title", exportParams1);
|
||||||
|
sheet1.put("entity", ContrastPlanExcel.class);
|
||||||
|
sheet1.put("data", planExcelList);
|
||||||
|
sheetsList.add(0, sheet1);
|
||||||
|
|
||||||
|
ExcelUtil.exportExcel("检测计划导出数据.xlsx", sheetsList);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void downloadTemplate(String patternId) {
|
public void downloadTemplate(String patternId) {
|
||||||
String currrentScene = sysTestConfigService.getCurrrentScene();
|
String currrentScene = sysTestConfigService.getCurrrentScene();
|
||||||
@@ -513,21 +701,103 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void importPlan(MultipartFile file, String patternId, HttpServletResponse response) {
|
public boolean importPlan(MultipartFile file, String patternId, HttpServletResponse response) {
|
||||||
String currrentScene = sysTestConfigService.getCurrrentScene();
|
String currrentScene = sysTestConfigService.getCurrrentScene();
|
||||||
SceneEnum sceneEnum = SceneEnum.getSceneEnum(currrentScene);
|
SceneEnum sceneEnum = SceneEnum.getSceneEnum(currrentScene);
|
||||||
switch (sceneEnum) {
|
switch (sceneEnum) {
|
||||||
case PROVINCE_PLATFORM:
|
case PROVINCE_PLATFORM:
|
||||||
this.importProvincePlan(file, patternId, response);
|
return this.importProvincePlan(file, patternId, response);
|
||||||
break;
|
|
||||||
case LEAVE_FACTORY_TEST:
|
case LEAVE_FACTORY_TEST:
|
||||||
this.importCNPlan(file, patternId, response);
|
return this.importCNPlan(file, patternId, response);
|
||||||
break;
|
|
||||||
case SELF_TEST:
|
case SELF_TEST:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<PqStandardDev> getUnBoundStandardDev(String fatherPlanId) {
|
||||||
|
return adPlanStandardDevMapper.listByPlanId(Collections.singletonList(fatherPlanId));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<PqStandardDev> getBoundStandardDev(String planId) {
|
||||||
|
return adPlanStandardDevMapper.listByPlanId(Collections.singletonList(planId));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public boolean updateSubPlanName(String planId, String name) {
|
||||||
|
AdPlan plan = this.getById(planId);
|
||||||
|
plan.setName(name);
|
||||||
|
|
||||||
|
return this.updateById(plan);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean updateBindDev(PqDevParam.BindPlanParam param) {
|
||||||
|
|
||||||
|
List<AdPlan> list = new ArrayList<>();
|
||||||
|
AdPlan plan = this.getById(param.getPlanId());
|
||||||
|
AdPlan fatherPlan = this.getById(plan.getFatherPlanId());
|
||||||
|
|
||||||
|
List<PqDev> pqDevList1 = pqDevService.list(new QueryWrapper<PqDev>().eq("Plan_Id", param.getPlanId()).eq("State", DataStateEnum.ENABLE.getCode()));
|
||||||
|
List<String> devIds1 = pqDevList1.stream().map(PqDev::getId).collect(Collectors.toList());
|
||||||
|
|
||||||
|
List<PqDev> pqDevList2 = pqDevService.list(new QueryWrapper<PqDev>().eq("Plan_Id", fatherPlan.getId()).eq("State", DataStateEnum.ENABLE.getCode()));
|
||||||
|
List<String> devIds2 = pqDevList2.stream().map(PqDev::getId).collect(Collectors.toList());
|
||||||
|
|
||||||
|
if (param.getBindFlag().equals(1)) {
|
||||||
|
devIds1.addAll(param.getDevIds());
|
||||||
|
devIds2.removeAll(param.getDevIds());
|
||||||
|
} else {
|
||||||
|
devIds1.removeAll(param.getDevIds());
|
||||||
|
devIds2.addAll(param.getDevIds());
|
||||||
|
}
|
||||||
|
|
||||||
|
plan.setTestState(pqDevService.bind(param.getPlanId(), devIds1));
|
||||||
|
list.add(plan);
|
||||||
|
|
||||||
|
fatherPlan.setTestState(pqDevService.bind(fatherPlan.getId(), devIds2));
|
||||||
|
list.add(fatherPlan);
|
||||||
|
|
||||||
|
return this.updateBatchById(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public boolean updateBindStandardDev(String planId, List<String> standardDevIds) {
|
||||||
|
// 处理已有的
|
||||||
|
List<AdPlanStandardDev> adPlanStandardDevs = adPlanStandardDevService.listByPlanId(Collections.singletonList(planId));
|
||||||
|
// 同时修改父计划的绑定
|
||||||
|
AdPlan plan = this.getById(planId);
|
||||||
|
|
||||||
|
List<String> standardDevIds1 = adPlanStandardDevs.stream().map(AdPlanStandardDev::getStandardDevId).collect(Collectors.toList());
|
||||||
|
adPlanStandardDevService.addAdPlanStandardDev(plan.getFatherPlanId(), standardDevIds1);
|
||||||
|
adPlanStandardDevService.deleteAdPlanStandardDev(plan.getFatherPlanId(), standardDevIds);
|
||||||
|
|
||||||
|
adPlanStandardDevService.updateAdPlanStandardDev(planId, standardDevIds);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void exportSubPlan(String planId, HttpServletResponse response) {
|
||||||
|
// 子计划数据
|
||||||
|
AdPlan subPlan = this.getById(planId);
|
||||||
|
//子计划绑定的标准设备
|
||||||
|
List<PqStandardDev> pqStandardDevs = adPlanStandardDevMapper.listByPlanId(Collections.singletonList(planId));
|
||||||
|
// 子计划绑定的被检设备
|
||||||
|
PqDevParam.QueryParam queryParam = new PqDevParam.QueryParam();
|
||||||
|
queryParam.setPlanIdList(Collections.singletonList(planId));
|
||||||
|
|
||||||
|
List<PqDev> pqDevList = pqDevService.list(new QueryWrapper<PqDev>().eq("Plan_Id", planId));
|
||||||
|
List<PqDevSub> pqDevSubList = new ArrayList<>();
|
||||||
|
if (CollUtil.isNotEmpty(pqDevList)) {
|
||||||
|
pqDevSubList.addAll(pqDevSubService.list(new QueryWrapper<PqDevSub>().in("dev_Id", pqDevList.stream().map(PqDev::getId).collect(Collectors.toList()))));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -544,10 +814,10 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
|||||||
planExcelList.get(i).setSource(pqSources.stream().map(PqSource::getName).collect(Collectors.joining(StrUtil.COMMA)));
|
planExcelList.get(i).setSource(pqSources.stream().map(PqSource::getName).collect(Collectors.joining(StrUtil.COMMA)));
|
||||||
|
|
||||||
PqDevParam.QueryParam queryParam1 = new PqDevParam.QueryParam();
|
PqDevParam.QueryParam queryParam1 = new PqDevParam.QueryParam();
|
||||||
queryParam1.setPlanId(planList.get(i).getId());
|
queryParam1.setPlanIdList(Arrays.asList(planList.get(i).getId()));
|
||||||
List<PqDev> pqDevs = pqDevService.listByPlanId(queryParam1);
|
List<PqDevVO> pqDevVOList = pqDevMapper.selectByQueryParam(queryParam1);
|
||||||
pqDevService.visualizeProvinceDev(pqDevs);
|
pqDevService.visualizeProvinceDev(pqDevVOList);
|
||||||
List<ProvinceDevExcel> deviceExportData = BeanUtil.copyToList(pqDevs, ProvinceDevExcel.class);
|
List<ProvinceDevExcel> deviceExportData = BeanUtil.copyToList(pqDevVOList, ProvinceDevExcel.class);
|
||||||
planExcelList.get(i).setDevices(deviceExportData);
|
planExcelList.get(i).setDevices(deviceExportData);
|
||||||
}
|
}
|
||||||
ExcelUtil.exportExcelPullDown(new ExportParams(), "检测计划导出数据.xlsx", 2, this.getPullDownList(SceneEnum.PROVINCE_PLATFORM, queryParam.getPatternId()), ProvincePlanExcel.class, planExcelList);
|
ExcelUtil.exportExcelPullDown(new ExportParams(), "检测计划导出数据.xlsx", 2, this.getPullDownList(SceneEnum.PROVINCE_PLATFORM, queryParam.getPatternId()), ProvincePlanExcel.class, planExcelList);
|
||||||
@@ -567,8 +837,8 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
|||||||
planExcelList.get(i).setSource(pqSources.stream().map(PqSource::getName).collect(Collectors.joining(StrUtil.COMMA)));
|
planExcelList.get(i).setSource(pqSources.stream().map(PqSource::getName).collect(Collectors.joining(StrUtil.COMMA)));
|
||||||
|
|
||||||
PqDevParam.QueryParam queryParam1 = new PqDevParam.QueryParam();
|
PqDevParam.QueryParam queryParam1 = new PqDevParam.QueryParam();
|
||||||
queryParam1.setPlanId(planList.get(i).getId());
|
queryParam1.setPlanIdList(Arrays.asList(planList.get(i).getId()));
|
||||||
List<PqDev> pqDevs = pqDevService.listByPlanId(queryParam1);
|
List<PqDevVO> pqDevs = pqDevMapper.selectByQueryParam(queryParam1);
|
||||||
pqDevService.visualizeCNDev(pqDevs);
|
pqDevService.visualizeCNDev(pqDevs);
|
||||||
List<CNDevExcel> deviceExportData = BeanUtil.copyToList(pqDevs, CNDevExcel.class);
|
List<CNDevExcel> deviceExportData = BeanUtil.copyToList(pqDevs, CNDevExcel.class);
|
||||||
planExcelList.get(i).setDevices(deviceExportData);
|
planExcelList.get(i).setDevices(deviceExportData);
|
||||||
@@ -577,7 +847,7 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public void importCNPlan(MultipartFile file, String patternId, HttpServletResponse response) {
|
public boolean importCNPlan(MultipartFile file, String patternId, HttpServletResponse response) {
|
||||||
ImportParams params = new ImportParams();
|
ImportParams params = new ImportParams();
|
||||||
params.setStartSheetIndex(0);
|
params.setStartSheetIndex(0);
|
||||||
params.setSheetNum(1);
|
params.setSheetNum(1);
|
||||||
@@ -598,8 +868,9 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
|||||||
throw new BusinessException(DetectionResponseEnum.IMPORT_DATA_FAIL);
|
throw new BusinessException(DetectionResponseEnum.IMPORT_DATA_FAIL);
|
||||||
}
|
}
|
||||||
if (ObjectUtil.isNotEmpty(planExcelList)) {
|
if (ObjectUtil.isNotEmpty(planExcelList)) {
|
||||||
this.importCNPlan(planExcelList, patternId);
|
return this.importCNPlan(planExcelList, patternId);
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -609,7 +880,7 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
|||||||
* @param patternId
|
* @param patternId
|
||||||
*/
|
*/
|
||||||
@Transactional
|
@Transactional
|
||||||
public void importCNPlan(List<CNPlanExcel> planExcelList, String patternId) {
|
public boolean importCNPlan(List<CNPlanExcel> planExcelList, String patternId) {
|
||||||
List<AdPlan> adPlans = BeanUtil.copyToList(planExcelList, AdPlan.class);
|
List<AdPlan> adPlans = BeanUtil.copyToList(planExcelList, AdPlan.class);
|
||||||
|
|
||||||
String patternCode = dictDataService.getDictDataById(patternId).getCode();
|
String patternCode = dictDataService.getDictDataById(patternId).getCode();
|
||||||
@@ -618,7 +889,7 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
|||||||
AdPlanParam adPlanParam = new AdPlanParam();
|
AdPlanParam adPlanParam = new AdPlanParam();
|
||||||
adPlanParam.setName(planExcel.getName());
|
adPlanParam.setName(planExcel.getName());
|
||||||
adPlanParam.setPattern(patternId);
|
adPlanParam.setPattern(patternId);
|
||||||
checkRepeat(adPlanParam, false);
|
checkRepeat(adPlanParam, false, CommonEnum.FATHER_ID.getValue());
|
||||||
|
|
||||||
String planId = UUID.randomUUID().toString().replaceAll("-", "");
|
String planId = UUID.randomUUID().toString().replaceAll("-", "");
|
||||||
adPlans.get(i).setId(planId);
|
adPlans.get(i).setId(planId);
|
||||||
@@ -649,15 +920,15 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
|||||||
pqDevService.importCNDev(cnDevExcelList, patternId, planId);
|
pqDevService.importCNDev(cnDevExcelList, patternId, planId);
|
||||||
|
|
||||||
tableGenService.deleteTable(Arrays.asList(code.toString()));
|
tableGenService.deleteTable(Arrays.asList(code.toString()));
|
||||||
tableGenService.genAdNonHarmonicTable(code.toString());
|
tableGenService.genTable(code.toString(), PatternEnum.CONTRAST.getValue().equals(patternCode));
|
||||||
}
|
}
|
||||||
// 逆向可视化
|
// 逆向可视化
|
||||||
this.reverseVisualize(adPlans);
|
this.reverseVisualize(adPlans);
|
||||||
this.saveBatch(adPlans);
|
return this.saveBatch(adPlans);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public void importProvincePlan(MultipartFile file, String patternId, HttpServletResponse response) {
|
public boolean importProvincePlan(MultipartFile file, String patternId, HttpServletResponse response) {
|
||||||
ImportParams params = new ImportParams();
|
ImportParams params = new ImportParams();
|
||||||
params.setStartSheetIndex(0);
|
params.setStartSheetIndex(0);
|
||||||
params.setSheetNum(1);
|
params.setSheetNum(1);
|
||||||
@@ -678,8 +949,9 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
|||||||
throw new BusinessException(DetectionResponseEnum.IMPORT_DATA_FAIL);
|
throw new BusinessException(DetectionResponseEnum.IMPORT_DATA_FAIL);
|
||||||
}
|
}
|
||||||
if (ObjectUtil.isNotEmpty(planExcelList)) {
|
if (ObjectUtil.isNotEmpty(planExcelList)) {
|
||||||
this.importProvincePlan(planExcelList, patternId);
|
return this.importProvincePlan(planExcelList, patternId);
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -688,7 +960,7 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
|||||||
* @param planExcelList
|
* @param planExcelList
|
||||||
* @param patternId
|
* @param patternId
|
||||||
*/
|
*/
|
||||||
public void importProvincePlan(List<ProvincePlanExcel> planExcelList, String patternId) {
|
public boolean importProvincePlan(List<ProvincePlanExcel> planExcelList, String patternId) {
|
||||||
List<AdPlan> adPlans = BeanUtil.copyToList(planExcelList, AdPlan.class);
|
List<AdPlan> adPlans = BeanUtil.copyToList(planExcelList, AdPlan.class);
|
||||||
|
|
||||||
String patternCode = dictDataService.getDictDataById(patternId).getCode();
|
String patternCode = dictDataService.getDictDataById(patternId).getCode();
|
||||||
@@ -697,7 +969,7 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
|||||||
AdPlanParam adPlanParam = new AdPlanParam();
|
AdPlanParam adPlanParam = new AdPlanParam();
|
||||||
adPlanParam.setName(planExcel.getName());
|
adPlanParam.setName(planExcel.getName());
|
||||||
adPlanParam.setPattern(patternId);
|
adPlanParam.setPattern(patternId);
|
||||||
checkRepeat(adPlanParam, false);
|
checkRepeat(adPlanParam, false, CommonEnum.FATHER_ID.getValue());
|
||||||
|
|
||||||
String planId = UUID.randomUUID().toString().replaceAll("-", "");
|
String planId = UUID.randomUUID().toString().replaceAll("-", "");
|
||||||
adPlans.get(i).setId(planId);
|
adPlans.get(i).setId(planId);
|
||||||
@@ -706,7 +978,7 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
|||||||
adPlans.get(i).setCode(code);
|
adPlans.get(i).setCode(code);
|
||||||
|
|
||||||
tableGenService.deleteTable(Arrays.asList(code.toString()));
|
tableGenService.deleteTable(Arrays.asList(code.toString()));
|
||||||
tableGenService.genAdNonHarmonicTable(code.toString());
|
tableGenService.genTable(code.toString(), PatternEnum.CONTRAST.getValue().equals(patternCode));
|
||||||
|
|
||||||
String source = planExcel.getSource();
|
String source = planExcel.getSource();
|
||||||
String[] sourceNames = source.split(StrUtil.COMMA);
|
String[] sourceNames = source.split(StrUtil.COMMA);
|
||||||
@@ -737,7 +1009,7 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
|||||||
}
|
}
|
||||||
// 逆向可视化
|
// 逆向可视化
|
||||||
this.reverseVisualize(adPlans);
|
this.reverseVisualize(adPlans);
|
||||||
this.saveBatch(adPlans);
|
return this.saveBatch(adPlans);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -766,7 +1038,7 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
|||||||
* @param devList 设备列表
|
* @param devList 设备列表
|
||||||
* @return 备注信息
|
* @return 备注信息
|
||||||
*/
|
*/
|
||||||
private String getNote(AdPlan plan, List<PqDev> devList) {
|
private String getNote(AdPlan plan, List<PqDevVO> devList) {
|
||||||
StringBuffer note = new StringBuffer();
|
StringBuffer note = new StringBuffer();
|
||||||
note.append("说明:本计划共有" + devList.size() + "台设备,");
|
note.append("说明:本计划共有" + devList.size() + "台设备,");
|
||||||
Map<String, List<PqDev>> devTypeMap = devList.stream().collect(Collectors.groupingBy(PqDev::getDevType, Collectors.toList()));
|
Map<String, List<PqDev>> devTypeMap = devList.stream().collect(Collectors.groupingBy(PqDev::getDevType, Collectors.toList()));
|
||||||
@@ -793,7 +1065,7 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
|||||||
* @param note 备注
|
* @param note 备注
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private List<String[]> getRows(String header, List<PqDev> devList, Integer maxTime, String note) {
|
private List<String[]> getRows(String header, List<PqDevVO> devList, Integer maxTime, String note) {
|
||||||
List<String[]> rows = new ArrayList<>();
|
List<String[]> rows = new ArrayList<>();
|
||||||
String[] row1 = new String[]{header};
|
String[] row1 = new String[]{header};
|
||||||
|
|
||||||
@@ -813,7 +1085,7 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
|||||||
for (int i = 1; i <= maxTime; i++) {
|
for (int i = 1; i <= maxTime; i++) {
|
||||||
row2[i] = i + "次检测";
|
row2[i] = i + "次检测";
|
||||||
int tempI = i;
|
int tempI = i;
|
||||||
List<PqDev> tempDevList = devList.stream().filter(dev -> dev.getReCheckNum() <= tempI).collect(Collectors.toList());
|
List<PqDevVO> tempDevList = devList.stream().filter(dev -> dev.getRecheckNum() <= tempI).collect(Collectors.toList());
|
||||||
long passCount = tempDevList.stream().filter(dev -> dev.getCheckResult() == CheckResultEnum.ACCORD.getValue()).count();
|
long passCount = tempDevList.stream().filter(dev -> dev.getCheckResult() == CheckResultEnum.ACCORD.getValue()).count();
|
||||||
row3[i] = passCount + "";
|
row3[i] = passCount + "";
|
||||||
row4[i] = total + "";
|
row4[i] = total + "";
|
||||||
@@ -873,7 +1145,7 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
|||||||
}
|
}
|
||||||
if (adPlan.getAssociateReport().equals(0)) {
|
if (adPlan.getAssociateReport().equals(0)) {
|
||||||
adPlan.setReportTemplateId(null);
|
adPlan.setReportTemplateId(null);
|
||||||
}else if (StrUtil.isNotBlank(adPlan.getReportTemplateId())) {
|
} else if (StrUtil.isNotBlank(adPlan.getReportTemplateId())) {
|
||||||
String[] split = adPlan.getReportTemplateId().split("_");
|
String[] split = adPlan.getReportTemplateId().split("_");
|
||||||
String reportId = this.baseMapper.getReportIdByNameAndVersion(split[0], split[1]);
|
String reportId = this.baseMapper.getReportIdByNameAndVersion(split[0], split[1]);
|
||||||
if (ObjectUtil.isNull(reportId)) {
|
if (ObjectUtil.isNull(reportId)) {
|
||||||
@@ -913,11 +1185,12 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
|||||||
* @param param 计划参数
|
* @param param 计划参数
|
||||||
* @param isExcludeSelf 是否排除自己
|
* @param isExcludeSelf 是否排除自己
|
||||||
*/
|
*/
|
||||||
private void checkRepeat(AdPlanParam param, boolean isExcludeSelf) {
|
private void checkRepeat(AdPlanParam param, boolean isExcludeSelf, String fatherPlanId) {
|
||||||
QueryWrapper<AdPlan> queryWrapper = new QueryWrapper<>();
|
QueryWrapper<AdPlan> queryWrapper = new QueryWrapper<>();
|
||||||
queryWrapper.eq("state", DataStateEnum.ENABLE.getCode())
|
queryWrapper.eq("state", DataStateEnum.ENABLE.getCode())
|
||||||
.eq("Name", param.getName())
|
.eq("Name", param.getName())
|
||||||
.eq("Pattern", param.getPattern());
|
.eq("Pattern", param.getPattern())
|
||||||
|
.eq("Father_Plan_Id", fatherPlanId);
|
||||||
if (isExcludeSelf) {
|
if (isExcludeSelf) {
|
||||||
if (param instanceof AdPlanParam.UpdateParam) {
|
if (param instanceof AdPlanParam.UpdateParam) {
|
||||||
queryWrapper.ne("id", ((AdPlanParam.UpdateParam) param).getId());
|
queryWrapper.ne("id", ((AdPlanParam.UpdateParam) param).getId());
|
||||||
@@ -925,7 +1198,11 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
|||||||
}
|
}
|
||||||
int count = this.count(queryWrapper);
|
int count = this.count(queryWrapper);
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
throw new BusinessException(DetectionResponseEnum.PLAN_REPEATED);
|
if (!CommonEnum.FATHER_ID.getValue().equals(fatherPlanId)) {
|
||||||
|
throw new BusinessException(DetectionResponseEnum.PLAN_REPEATED_IN_SAME_LEVEL);
|
||||||
|
} else {
|
||||||
|
throw new BusinessException(DetectionResponseEnum.PLAN_REPEATED);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1084,12 +1361,26 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
|||||||
List<PullDown> pullDowns = new ArrayList<>();
|
List<PullDown> pullDowns = new ArrayList<>();
|
||||||
|
|
||||||
PullDown pullDown = null;
|
PullDown pullDown = null;
|
||||||
List<Map<String, Object>> maps = pqSourceService.listAllPqSource(patternId);
|
DictData dictData = dictDataService.getDictDataById(patternId);
|
||||||
if (ObjectUtil.isNotEmpty(maps)) {
|
if (PatternEnum.CONTRAST.getValue().equals(dictData.getCode())) {
|
||||||
|
|
||||||
|
} else {
|
||||||
|
List<Map<String, Object>> maps = pqSourceService.listAllPqSource(patternId);
|
||||||
|
if (ObjectUtil.isNotEmpty(maps)) {
|
||||||
|
pullDown = new PullDown();
|
||||||
|
pullDown.setFirstCol(1);
|
||||||
|
pullDown.setLastCol(1);
|
||||||
|
pullDown.setStrings(maps.stream().map(m -> (String) m.get("name")).collect(Collectors.toList()));
|
||||||
|
pullDowns.add(pullDown);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检测脚本
|
||||||
|
List<Map<String, Object>> maps1 = pqScriptService.listAllPqScript(null);
|
||||||
|
List<String> scriptNameList = maps1.stream().map(m -> (String) m.get("name")).collect(Collectors.toList());
|
||||||
pullDown = new PullDown();
|
pullDown = new PullDown();
|
||||||
pullDown.setFirstCol(1);
|
pullDown.setFirstCol(3);
|
||||||
pullDown.setLastCol(1);
|
pullDown.setLastCol(3);
|
||||||
pullDown.setStrings(maps.stream().map(m -> (String) m.get("name")).collect(Collectors.toList()));
|
pullDown.setStrings(scriptNameList);
|
||||||
pullDowns.add(pullDown);
|
pullDowns.add(pullDown);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1105,14 +1396,6 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
|||||||
pullDowns.add(pullDown);
|
pullDowns.add(pullDown);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检测脚本
|
|
||||||
List<Map<String, Object>> maps1 = pqScriptService.listAllPqScript(null);
|
|
||||||
List<String> scriptNameList = maps1.stream().map(m -> (String) m.get("name")).collect(Collectors.toList());
|
|
||||||
pullDown = new PullDown();
|
|
||||||
pullDown.setFirstCol(3);
|
|
||||||
pullDown.setLastCol(3);
|
|
||||||
pullDown.setStrings(scriptNameList);
|
|
||||||
pullDowns.add(pullDown);
|
|
||||||
// 误差体系
|
// 误差体系
|
||||||
List<Map<String, Object>> maps2 = pqErrSysService.listAllPqErrSys();
|
List<Map<String, Object>> maps2 = pqErrSysService.listAllPqErrSys();
|
||||||
List<String> errSysNameList = maps2.stream().map(m -> (String) m.get("name")).collect(Collectors.toList());
|
List<String> errSysNameList = maps2.stream().map(m -> (String) m.get("name")).collect(Collectors.toList());
|
||||||
@@ -1156,30 +1439,14 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
|||||||
pullDown.setStrings(strings);
|
pullDown.setStrings(strings);
|
||||||
pullDowns.add(pullDown);
|
pullDowns.add(pullDown);
|
||||||
|
|
||||||
// 检测状态
|
|
||||||
// pullDown = new PullDown();
|
|
||||||
// pullDown.setFirstCol(9);
|
|
||||||
// pullDown.setLastCol(9);
|
|
||||||
// pullDown.setStrings(Arrays.asList(CheckStateEnum.UNCHECKED.getMsg(), CheckStateEnum.CHECKING.getMsg(), CheckStateEnum.CHECKED.getMsg()));
|
|
||||||
// pullDowns.add(pullDown);
|
|
||||||
|
|
||||||
// 报告生成状态
|
|
||||||
// pullDown = new PullDown();
|
|
||||||
// pullDown.setFirstCol(10);
|
|
||||||
// pullDown.setLastCol(10);
|
|
||||||
// pullDown.setStrings(Arrays.asList(PlanReportStateEnum.REPORT_STATE_NOT_GENERATED.getMsg(), PlanReportStateEnum.REPORT_STATE_PARTIALLY_GENERATED.getMsg(), PlanReportStateEnum.REPORT_STATE_ALL_GENERATED.getMsg()));
|
|
||||||
// pullDowns.add(pullDown);
|
|
||||||
|
|
||||||
//检测结果
|
|
||||||
// pullDown = new PullDown();
|
|
||||||
// pullDown.setFirstCol(11);
|
|
||||||
// pullDown.setLastCol(11);
|
|
||||||
// pullDown.setStrings(Arrays.asList(CheckResultEnum.UNCHECKED.getMsg(), CheckResultEnum.ACCORD.getMsg(), CheckResultEnum.UNCHECKED.getMsg()));
|
|
||||||
// pullDowns.add(pullDown);
|
|
||||||
|
|
||||||
switch (scene) {
|
switch (scene) {
|
||||||
case PROVINCE_PLATFORM:
|
case PROVINCE_PLATFORM:
|
||||||
List<PullDown> provinceDevPullDownList = pqDevService.getProvinceDevPullDownList(9);
|
List<PullDown> provinceDevPullDownList = null;
|
||||||
|
if (PatternEnum.CONTRAST.getValue().equals(dictData.getCode())) {
|
||||||
|
provinceDevPullDownList = pqDevService.getContrastDevPullDownList(9);
|
||||||
|
} else {
|
||||||
|
provinceDevPullDownList = pqDevService.getProvinceDevPullDownList(9);
|
||||||
|
}
|
||||||
pullDowns.addAll(provinceDevPullDownList);
|
pullDowns.addAll(provinceDevPullDownList);
|
||||||
break;
|
break;
|
||||||
case LEAVE_FACTORY_TEST:
|
case LEAVE_FACTORY_TEST:
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.njcn.gather.plan.service.impl;
|
package com.njcn.gather.plan.service.impl;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.njcn.gather.plan.mapper.AdPlanSourceMapper;
|
import com.njcn.gather.plan.mapper.AdPlanSourceMapper;
|
||||||
import com.njcn.gather.plan.pojo.po.AdPlanSource;
|
import com.njcn.gather.plan.pojo.po.AdPlanSource;
|
||||||
@@ -44,9 +45,12 @@ public class AdPlanSourceServiceImpl extends ServiceImpl<AdPlanSourceMapper, AdP
|
|||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public boolean deleteAdPlanSourceByPlanIds(List<String> planIds) {
|
public boolean deleteAdPlanSourceByPlanIds(List<String> planIds) {
|
||||||
QueryWrapper<AdPlanSource> queryWrapper = new QueryWrapper<>();
|
if(CollectionUtils.isNotEmpty(planIds)){
|
||||||
queryWrapper.in("ad_plan_source.Plan_Id", planIds);
|
QueryWrapper<AdPlanSource> queryWrapper = new QueryWrapper<>();
|
||||||
return this.remove(queryWrapper);
|
queryWrapper.in("ad_plan_source.Plan_Id", planIds);
|
||||||
|
return this.remove(queryWrapper);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -0,0 +1,75 @@
|
|||||||
|
package com.njcn.gather.plan.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.njcn.gather.device.pojo.po.PqStandardDev;
|
||||||
|
import com.njcn.gather.plan.mapper.AdPlanStandardDevMapper;
|
||||||
|
import com.njcn.gather.plan.pojo.po.AdPlanStandardDev;
|
||||||
|
import com.njcn.gather.plan.service.IAdPlanStandardDevService;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author caozehui
|
||||||
|
* @date 2025-07-16
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class AdPlanStandardDevServiceImpl extends ServiceImpl<AdPlanStandardDevMapper, AdPlanStandardDev> implements IAdPlanStandardDevService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean addAdPlanStandardDev(String planId, List<String> standardDevIds) {
|
||||||
|
List<AdPlanStandardDev> adPlanStandardDevList = new ArrayList<>();
|
||||||
|
for (String standardDevId : standardDevIds) {
|
||||||
|
AdPlanStandardDev adPlanStandardDev = new AdPlanStandardDev();
|
||||||
|
adPlanStandardDev.setPlanId(planId);
|
||||||
|
adPlanStandardDev.setStandardDevId(standardDevId);
|
||||||
|
adPlanStandardDevList.add(adPlanStandardDev);
|
||||||
|
}
|
||||||
|
return this.saveBatch(adPlanStandardDevList);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean updateAdPlanStandardDev(String planId, List<String> standardDevIds) {
|
||||||
|
this.deleteAdPlanStandardDev(Collections.singletonList(planId));
|
||||||
|
return this.addAdPlanStandardDev(planId, standardDevIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean deleteAdPlanStandardDev(List<String> planIds) {
|
||||||
|
if (CollectionUtil.isNotEmpty(planIds)) {
|
||||||
|
QueryWrapper<AdPlanStandardDev> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.in("Plan_Id", planIds);
|
||||||
|
return this.remove(queryWrapper);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean deleteAdPlanStandardDev(String planId, List<String> standardDevIds) {
|
||||||
|
if (CollectionUtil.isNotEmpty(standardDevIds)) {
|
||||||
|
QueryWrapper<AdPlanStandardDev> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq("Plan_Id", planId).in("Standard_Dev_Id", standardDevIds);
|
||||||
|
return this.remove(queryWrapper);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getStandardDevNameStrByPlanId(String id) {
|
||||||
|
List<PqStandardDev> pqStandardDevs = this.baseMapper.listByPlanId(Collections.singletonList(id));
|
||||||
|
return pqStandardDevs.stream().map(PqStandardDev::getName).reduce((a, b) -> a + "," + b).orElse("");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<AdPlanStandardDev> listByPlanId(List<String> planIds) {
|
||||||
|
return this.lambdaQuery().in(AdPlanStandardDev::getPlanId, planIds).list();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -52,7 +52,7 @@ public interface DetectionValidMessage {
|
|||||||
|
|
||||||
String RECHECK_NUM_NOT_NULL = "检测次数不能为空,请检查reCheckNum参数";
|
String RECHECK_NUM_NOT_NULL = "检测次数不能为空,请检查reCheckNum参数";
|
||||||
|
|
||||||
String PLAN_ID_NOT_NULL = "检测计划ID不能为空,请检查planId参数";
|
String PLAN_ID_NOT_BLANK = "检测计划ID不能为空,请检查planId参数";
|
||||||
|
|
||||||
String PQ_DEV_IDS_NOT_NULL = "设备ID集合不能为null,请检查pqDevIds参数";
|
String PQ_DEV_IDS_NOT_NULL = "设备ID集合不能为null,请检查pqDevIds参数";
|
||||||
|
|
||||||
@@ -62,7 +62,7 @@ public interface DetectionValidMessage {
|
|||||||
|
|
||||||
String RECHECK_NUM_FORMAT_ERROR = "检测次数格式错误,请检查recheckNum参数";
|
String RECHECK_NUM_FORMAT_ERROR = "检测次数格式错误,请检查recheckNum参数";
|
||||||
|
|
||||||
String PATTERN_FORMAT_ERROR = "模式格式错误,请检查patternId参数";
|
String PATTERN_FORMAT_ERROR = "模式格式错误";
|
||||||
|
|
||||||
String SOURCE_IDS_NOT_EMPTY = "检测源ID不能为空,请检查sourceIds参数";
|
String SOURCE_IDS_NOT_EMPTY = "检测源ID不能为空,请检查sourceIds参数";
|
||||||
|
|
||||||
@@ -120,13 +120,13 @@ public interface DetectionValidMessage {
|
|||||||
|
|
||||||
String BELONG_LINE_NOT_BLANK = "所属母线不能为空";
|
String BELONG_LINE_NOT_BLANK = "所属母线不能为空";
|
||||||
|
|
||||||
String PT_NOT_NULL = "PT变比不能为空";
|
String PT_NOT_BLANK = "PT变比不能为空";
|
||||||
|
|
||||||
String CT_NOT_NULL = "CT变比不能为空";
|
String CT_NOT_BLANK = "CT变比不能为空";
|
||||||
|
|
||||||
String WIRING_TYPE_NOT_BLANK = "接线方式不能为空";
|
String CONNECTION_NOT_BLANK = "接线方式不能为空";
|
||||||
|
|
||||||
String WIRING_TYPE_FORMAT_ERROR = "接线方式格式错误";
|
String CONNECTION_FORMAT_ERROR = "接线方式格式错误";
|
||||||
|
|
||||||
String DATASOURCE_ID_NOT_EMPTY = "数据源ID不能为空";
|
String DATASOURCE_ID_NOT_EMPTY = "数据源ID不能为空";
|
||||||
|
|
||||||
@@ -158,7 +158,7 @@ public interface DetectionValidMessage {
|
|||||||
|
|
||||||
String CHECK_RESULT_FORMAT_ERROR = "检测结果格式错误";
|
String CHECK_RESULT_FORMAT_ERROR = "检测结果格式错误";
|
||||||
|
|
||||||
String MONITOR_NUM_NOT_NULL = "监测点序号不能为空";
|
String MONITOR_NUM_NOT_NULL = "线路号不能为空";
|
||||||
|
|
||||||
String FACTOR_FLAG_FORMAT_ERROR = "是否支持系数校准格式错误";
|
String FACTOR_FLAG_FORMAT_ERROR = "是否支持系数校准格式错误";
|
||||||
|
|
||||||
@@ -179,6 +179,24 @@ public interface DetectionValidMessage {
|
|||||||
|
|
||||||
String DEV_TYPE_NAME_FORMAT_ERROR = "设备类型名称格式错误,只能包含字母、数字、中文、下划线、中划线、点号、空格,长度为1-32个字符";
|
String DEV_TYPE_NAME_FORMAT_ERROR = "设备类型名称格式错误,只能包含字母、数字、中文、下划线、中划线、点号、空格,长度为1-32个字符";
|
||||||
String REPORT_NAME_NOT_BLANK = "报告模板不能为空";
|
String REPORT_NAME_NOT_BLANK = "报告模板不能为空";
|
||||||
|
String OPERATION_DATE_FORMAT_ERROR = "投运日期格式错误,请检查operationDate参数";
|
||||||
|
|
||||||
|
String INSPECT_DATE_FORMAT_ERROR = "定检日期格式错误,请检查inspectDate参数";
|
||||||
|
String MONITOR_NAME_NOT_BLANK = "监测点名称不能为空";
|
||||||
|
String MONITOR_ID_NOT_BLANK = "谐波系统监测点ID不能为空";
|
||||||
|
String DEVICE_ID_NOT_BLANK = "所属设备ID不能为空";
|
||||||
|
String STAT_INTERVAL_NOT_NULL = "统计间隔不能为空";
|
||||||
|
String MONITOR_ID_PATTERN = "谐波系统监测点ID格式错误";
|
||||||
String DATA_RULE_NOT_BLANK = "数据处理原则不能为空";
|
String DATA_RULE_NOT_BLANK = "数据处理原则不能为空";
|
||||||
String ASSOCIATE_REPORT_NOT_NULL = "是否关联报告模板不能为空";
|
String ASSOCIATE_REPORT_NOT_NULL = "是否关联报告模板不能为空";
|
||||||
|
String PID_FORMAT_ERROR = "PID格式错误";
|
||||||
|
String INSPECT_CHANNEL_NOT_BLANK = "可检通道不能为空";
|
||||||
|
String INSPECT_CHANNEL_FORMAT_ERROR = "可检通道格式错误";
|
||||||
|
String CREATE_DATE_NOT_NULL = "投运日期不能为空";
|
||||||
|
String INSPECT_DATE_NOT_NULL = "定检日期不能为空";
|
||||||
|
String HARM_SYS_ID_NOT_BLANK = "谐波系统设备id不能为空";
|
||||||
|
String FATHER_PLAN_ID_FORMAT_ERROR = "父计划ID格式错误";
|
||||||
|
String DEV_IDS_NOT_EMPTY = "被检设备不能为空";
|
||||||
|
String STANDARD_DEV_IDS_NOT_EMPTY = "标准设备不能为空";
|
||||||
|
String PAIRS_NOT_EMPTY = "配对关系不能为空";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,8 +61,18 @@ public enum DetectionResponseEnum {
|
|||||||
ERROR_SYSTEM_NOT_EXIST("A02069", "该误差体系不存在,请先添加该误差体系"),
|
ERROR_SYSTEM_NOT_EXIST("A02069", "该误差体系不存在,请先添加该误差体系"),
|
||||||
DATA_RULE_NOT_EXIST("A02070", "该数据处理原则不存在,请先在\"数据处理原则\"字典中添加"),
|
DATA_RULE_NOT_EXIST("A02070", "该数据处理原则不存在,请先在\"数据处理原则\"字典中添加"),
|
||||||
REPORT_TEMPLATE_NOT_EXIST("A02071", "该报告模板不存在,请先添加该报告模板"),
|
REPORT_TEMPLATE_NOT_EXIST("A02071", "该报告模板不存在,请先添加该报告模板"),
|
||||||
LACK_REPORT_TEMPLATE_ID("A02072","当关联报告模板为\"是\"时,报告模板不能为空" ),
|
LACK_REPORT_TEMPLATE_ID("A02072", "当关联报告模板为\"是\"时,报告模板不能为空"),
|
||||||
NAME_OR_CREATEID_REPEAT("A02073","名称或装置编号重复" );
|
NAME_OR_CREATEID_REPEAT("A02073", "名称或装置编号重复"),
|
||||||
|
MONITOR_REPEAT("A02080", "当前设备下已存在相同的监测点"),
|
||||||
|
PQ_STANDARD_DEV_REPEAT("A02090", "已存在同名的标准设备"),
|
||||||
|
IMPORT_FLAG_NOT_UPDATE("A02091", "从谐波系统导入的设备不支持修改"),
|
||||||
|
CONNECTION_NOT_EXIST("A02092", "该连接不存在,请先在\"接线方式\"字典中添加"),
|
||||||
|
MONITOR_NUM_OUT_OF_RANGE("A02093", "检测点线路号超出范围,请检查线路号"),
|
||||||
|
MONITOR_NUM_REPEAT("A02094", "该被检设备下存在相同线路号的监测点"),
|
||||||
|
PLAN_HAS_CHILDREN("A02095", "该计划下存在子计划,请先删除子计划"),
|
||||||
|
PLAN_REPEATED_IN_SAME_LEVEL("A02096", "该父计划下存在同名的子计划"),
|
||||||
|
PLEASE_UNASSIGN_STANDARD_DEV("A02097","存在已分配给子计划的标准设备,请先解除分配" ),
|
||||||
|
PLEASE_UNASSIGN_DEVICE("A02098", "存在已分配给计划的被检设备,请先解除分配");
|
||||||
|
|
||||||
private final String code;
|
private final String code;
|
||||||
|
|
||||||
|
|||||||
@@ -32,11 +32,15 @@ import com.njcn.gather.detection.util.socket.SocketManager;
|
|||||||
import com.njcn.gather.detection.util.socket.cilent.NettyClient;
|
import com.njcn.gather.detection.util.socket.cilent.NettyClient;
|
||||||
import com.njcn.gather.detection.util.socket.cilent.NettyDevClientHandler;
|
import com.njcn.gather.detection.util.socket.cilent.NettyDevClientHandler;
|
||||||
import com.njcn.gather.device.mapper.PqDevMapper;
|
import com.njcn.gather.device.mapper.PqDevMapper;
|
||||||
|
import com.njcn.gather.device.mapper.PqDevSubMapper;
|
||||||
import com.njcn.gather.device.pojo.enums.CheckStateEnum;
|
import com.njcn.gather.device.pojo.enums.CheckStateEnum;
|
||||||
import com.njcn.gather.device.pojo.enums.DevReportStateEnum;
|
import com.njcn.gather.device.pojo.enums.DevReportStateEnum;
|
||||||
|
import com.njcn.gather.device.pojo.param.PqDevParam;
|
||||||
import com.njcn.gather.device.pojo.po.PqDev;
|
import com.njcn.gather.device.pojo.po.PqDev;
|
||||||
|
import com.njcn.gather.device.pojo.po.PqDevSub;
|
||||||
import com.njcn.gather.device.pojo.vo.PqDevVO;
|
import com.njcn.gather.device.pojo.vo.PqDevVO;
|
||||||
import com.njcn.gather.device.service.IPqDevService;
|
import com.njcn.gather.device.service.IPqDevService;
|
||||||
|
import com.njcn.gather.device.service.IPqDevSubService;
|
||||||
import com.njcn.gather.plan.pojo.enums.PlanReportStateEnum;
|
import com.njcn.gather.plan.pojo.enums.PlanReportStateEnum;
|
||||||
import com.njcn.gather.plan.pojo.po.AdPlan;
|
import com.njcn.gather.plan.pojo.po.AdPlan;
|
||||||
import com.njcn.gather.plan.service.IAdPlanService;
|
import com.njcn.gather.plan.service.IAdPlanService;
|
||||||
@@ -58,10 +62,10 @@ import com.njcn.gather.result.service.IResultService;
|
|||||||
import com.njcn.gather.script.pojo.vo.PqScriptDtlDataVO;
|
import com.njcn.gather.script.pojo.vo.PqScriptDtlDataVO;
|
||||||
import com.njcn.gather.script.service.IPqScriptDtlsService;
|
import com.njcn.gather.script.service.IPqScriptDtlsService;
|
||||||
import com.njcn.gather.storage.pojo.param.SingleNonHarmParam;
|
import com.njcn.gather.storage.pojo.param.SingleNonHarmParam;
|
||||||
import com.njcn.gather.storage.pojo.po.AdHarmonicResult;
|
import com.njcn.gather.storage.pojo.po.SimAndDigHarmonicResult;
|
||||||
import com.njcn.gather.storage.pojo.po.AdNonHarmonicResult;
|
import com.njcn.gather.storage.pojo.po.SimAndDigNonHarmonicResult;
|
||||||
import com.njcn.gather.storage.service.AdHarmonicService;
|
import com.njcn.gather.storage.service.SimAndDigHarmonicService;
|
||||||
import com.njcn.gather.storage.service.AdNonHarmonicService;
|
import com.njcn.gather.storage.service.SimAndDigNonHarmonicService;
|
||||||
import com.njcn.gather.system.cfg.pojo.enums.SceneEnum;
|
import com.njcn.gather.system.cfg.pojo.enums.SceneEnum;
|
||||||
import com.njcn.gather.system.cfg.service.ISysTestConfigService;
|
import com.njcn.gather.system.cfg.service.ISysTestConfigService;
|
||||||
import com.njcn.gather.system.dictionary.pojo.po.DictData;
|
import com.njcn.gather.system.dictionary.pojo.po.DictData;
|
||||||
@@ -157,8 +161,10 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
|||||||
@Value("${qr.gcDev.path}")
|
@Value("${qr.gcDev.path}")
|
||||||
private String gcDevPath;
|
private String gcDevPath;
|
||||||
|
|
||||||
|
|
||||||
private final IPqDevService iPqDevService;
|
private final IPqDevService iPqDevService;
|
||||||
private final PqDevMapper pqDevMapper;
|
private final PqDevMapper pqDevMapper;
|
||||||
|
private final IPqDevSubService iPqDevSubService;
|
||||||
|
|
||||||
private final IDictDataService dictDataService;
|
private final IDictDataService dictDataService;
|
||||||
|
|
||||||
@@ -166,9 +172,9 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
|||||||
|
|
||||||
private final IPqScriptDtlsService pqScriptDtlsService;
|
private final IPqScriptDtlsService pqScriptDtlsService;
|
||||||
|
|
||||||
private final AdNonHarmonicService adNonHarmonicService;
|
private final SimAndDigNonHarmonicService adNonHarmonicService;
|
||||||
|
|
||||||
private final AdHarmonicService adHarmonicService;
|
private final SimAndDigHarmonicService adHarmonicService;
|
||||||
|
|
||||||
private final IDevTypeService devTypeService;
|
private final IDevTypeService devTypeService;
|
||||||
|
|
||||||
@@ -178,6 +184,7 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
|||||||
|
|
||||||
private final SocketDevResponseService socketDevResponseService;
|
private final SocketDevResponseService socketDevResponseService;
|
||||||
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private RestTemplateUtil restTemplateUtil;
|
private RestTemplateUtil restTemplateUtil;
|
||||||
|
|
||||||
@@ -1284,7 +1291,7 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
|||||||
// 将改设备的报告生成状态调整为已生成
|
// 将改设备的报告生成状态调整为已生成
|
||||||
iPqDevService.updatePqDevReportState(devId, DevReportStateEnum.GENERATED.getValue());
|
iPqDevService.updatePqDevReportState(devId, DevReportStateEnum.GENERATED.getValue());
|
||||||
// 判断该计划下是否所有设备报告已生成,如果已生成则将计划的报告状态给为已生成
|
// 判断该计划下是否所有设备报告已生成,如果已生成则将计划的报告状态给为已生成
|
||||||
int count = iPqDevService.countUnReportDev(planId);
|
long count = iPqDevService.countUnReportDev(planId);
|
||||||
LambdaUpdateWrapper<AdPlan> updateWrapper = new LambdaUpdateWrapper<>();
|
LambdaUpdateWrapper<AdPlan> updateWrapper = new LambdaUpdateWrapper<>();
|
||||||
updateWrapper.eq(AdPlan::getId, planId);
|
updateWrapper.eq(AdPlan::getId, planId);
|
||||||
if (count == 0) {
|
if (count == 0) {
|
||||||
@@ -1349,44 +1356,43 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
|||||||
@Transactional
|
@Transactional
|
||||||
public boolean documented(List<String> ids) {
|
public boolean documented(List<String> ids) {
|
||||||
if (CollUtil.isNotEmpty(ids)) {
|
if (CollUtil.isNotEmpty(ids)) {
|
||||||
|
List<PqDevVO> pqDevVOList = pqDevMapper.listByDevIds(ids);
|
||||||
List<String> devIds = new ArrayList<>();
|
List<String> devIds = new ArrayList<>();
|
||||||
PqDev tempPqDev = null;
|
PqDevVO tempPqDevVO = null;
|
||||||
for (String id : ids) {
|
PqDevVO pqDevVO = null;
|
||||||
// 只有检测完成的设备才可以进行归档
|
|
||||||
PqDev pqDev = iPqDevService.getById(id);
|
for (int i = 0; i < pqDevVOList.size(); i++) {
|
||||||
if (ObjectUtil.isNotNull(pqDev)) {
|
pqDevVO = pqDevVOList.get(i);
|
||||||
// 只有检测完成、且已生成报告的设备才可以进行归档
|
if (!pqDevVO.getCheckState().equals(CheckStateEnum.CHECKED.getValue())) {
|
||||||
if (!pqDev.getCheckState().equals(CheckStateEnum.CHECKED.getValue())) {
|
throw new BusinessException(DetectionResponseEnum.DEV_UN_CHECKED);
|
||||||
throw new BusinessException(DetectionResponseEnum.DEV_UN_CHECKED);
|
}
|
||||||
}
|
if (!pqDevVO.getReportState().equals(DevReportStateEnum.GENERATED.getValue())) {
|
||||||
if (!pqDev.getReportState().equals(DevReportStateEnum.GENERATED.getValue())) {
|
devIds.add(pqDevVO.getId());
|
||||||
devIds.add(id);
|
tempPqDevVO = pqDevVO;
|
||||||
tempPqDev = pqDev;
|
|
||||||
}
|
|
||||||
boolean update = iPqDevService.lambdaUpdate()
|
|
||||||
.set(PqDev::getCheckState, CheckStateEnum.DOCUMENTED.getValue())
|
|
||||||
.eq(PqDev::getId, id)
|
|
||||||
.update();
|
|
||||||
if (update) {
|
|
||||||
// 判断计划下所有设备是否都已归档,如果是则将计划改为已完成
|
|
||||||
// 查询该计划下所有设备的检测状态,是否有不为归档的
|
|
||||||
LambdaQueryWrapper<PqDev> queryWrapper = new LambdaQueryWrapper<>();
|
|
||||||
queryWrapper.eq(PqDev::getPlanId, pqDev.getPlanId())
|
|
||||||
.eq(PqDev::getState, DataStateEnum.ENABLE.getCode())
|
|
||||||
.ne(PqDev::getCheckState, CheckStateEnum.DOCUMENTED.getValue());
|
|
||||||
int count = iPqDevService.count(queryWrapper);
|
|
||||||
if (count == 0) {
|
|
||||||
// 如果非归档状态的设备数量为0,则更新计划已完成
|
|
||||||
pqDevMapper.finishPlan(pqDev.getPlanId());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
iPqDevSubService.lambdaUpdate()
|
||||||
|
.set(PqDevSub::getCheckState, CheckStateEnum.DOCUMENTED.getValue())
|
||||||
|
.in(PqDevSub::getDevId, ids)
|
||||||
|
.update();
|
||||||
|
// 判断计划下所有设备是否都已归档,如果是则将计划改为已完成
|
||||||
|
// 查询该计划下所有设备的检测状态,是否有不为归档的
|
||||||
|
PqDevParam.QueryParam queryParam = new PqDevParam.QueryParam();
|
||||||
|
queryParam.setPlanIdList(Arrays.asList(tempPqDevVO.getPlanId()));
|
||||||
|
List<PqDevVO> pqDevVOList1 = pqDevMapper.selectByQueryParam(queryParam);
|
||||||
|
|
||||||
|
long count = pqDevVOList1.stream().filter(obj -> !CheckStateEnum.DOCUMENTED.getValue().equals(obj.getCheckState())).count();
|
||||||
|
if (count == 0) {
|
||||||
|
// 如果非归档状态的设备数量为0,则更新计划已完成
|
||||||
|
pqDevMapper.finishPlan(pqDevVO.getPlanId());
|
||||||
|
}
|
||||||
|
|
||||||
if (CollUtil.isNotEmpty(devIds)) {
|
if (CollUtil.isNotEmpty(devIds)) {
|
||||||
DevReportParam devReportParam = new DevReportParam();
|
DevReportParam devReportParam = new DevReportParam();
|
||||||
devReportParam.setDevIdList(devIds);
|
devReportParam.setDevIdList(devIds);
|
||||||
devReportParam.setPlanId(tempPqDev.getPlanId());
|
devReportParam.setPlanId(tempPqDevVO.getPlanId());
|
||||||
AdPlan plan = adPlanService.getById(tempPqDev.getPlanId());
|
AdPlan plan = adPlanService.getById(tempPqDevVO.getPlanId());
|
||||||
devReportParam.setScriptId(plan.getScriptId());
|
devReportParam.setScriptId(plan.getScriptId());
|
||||||
devReportParam.setPlanCode(String.valueOf(plan.getCode()));
|
devReportParam.setPlanCode(String.valueOf(plan.getCode()));
|
||||||
this.generateReport(devReportParam);
|
this.generateReport(devReportParam);
|
||||||
@@ -1498,8 +1504,8 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
|||||||
return obj.substring(index1, obj.indexOf("#", index1));
|
return obj.substring(index1, obj.indexOf("#", index1));
|
||||||
}, Collectors.toSet()))); //key为index,value为该index下所有测试项对应的code
|
}, Collectors.toSet()))); //key为index,value为该index下所有测试项对应的code
|
||||||
|
|
||||||
List<AdNonHarmonicResult> adNonHarmonicResultList = adNonHarmonicService.listAllResultData(devReportParam.getScriptId(), devReportParam.getPlanCode(), devReportParam.getDevId() + "_" + i);
|
List<SimAndDigNonHarmonicResult> simAndDigNonHarmonicResultList = adNonHarmonicService.listSimAndDigBaseResult(devReportParam.getScriptId(), devReportParam.getPlanCode(), devReportParam.getDevId() + "_" + i);
|
||||||
List<AdHarmonicResult> adHarmonicResultList = adHarmonicService.listAllResultData(devReportParam.getScriptId(), devReportParam.getPlanCode(), devReportParam.getDevId() + "_" + i);
|
List<SimAndDigHarmonicResult> adHarmonicResultList = adHarmonicService.listAllResultData(devReportParam.getScriptId(), devReportParam.getPlanCode(), devReportParam.getDevId() + "_" + i);
|
||||||
|
|
||||||
// 填充数据
|
// 填充数据
|
||||||
indexKeysMap.forEach((index, keys) -> {
|
indexKeysMap.forEach((index, keys) -> {
|
||||||
@@ -1510,9 +1516,9 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
|||||||
} else {
|
} else {
|
||||||
// 非谐波类
|
// 非谐波类
|
||||||
if (DetectionCodeEnum.V_UNBAN.getCode().equals(s1) || DetectionCodeEnum.FREQ.getCode().equals(s1)) {
|
if (DetectionCodeEnum.V_UNBAN.getCode().equals(s1) || DetectionCodeEnum.FREQ.getCode().equals(s1)) {
|
||||||
fillMapValueT(adNonHarmonicResultList, dataModelMap, keys, index);
|
fillMapValueT(simAndDigNonHarmonicResultList, dataModelMap, keys, index);
|
||||||
} else {
|
} else {
|
||||||
fillMapValueABC(adNonHarmonicResultList, dataModelMap, keys, index);
|
fillMapValueABC(simAndDigNonHarmonicResultList, dataModelMap, keys, index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -1532,11 +1538,11 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
|||||||
* @param keys
|
* @param keys
|
||||||
* @param index
|
* @param index
|
||||||
*/
|
*/
|
||||||
private void fillMapValueABC(List<AdNonHarmonicResult> allNonHarmonicResultList, Map<String, String> dataModelMap, Set<String> keys, String index) {
|
private void fillMapValueABC(List<SimAndDigNonHarmonicResult> allNonHarmonicResultList, Map<String, String> dataModelMap, Set<String> keys, String index) {
|
||||||
keys.forEach(key -> {
|
keys.forEach(key -> {
|
||||||
List<AdNonHarmonicResult> resultList = allNonHarmonicResultList.stream().filter(obj -> obj.getAdType().equals(key) && obj.getSort().toString().equals(index)).collect(Collectors.toList());
|
List<SimAndDigNonHarmonicResult> resultList = allNonHarmonicResultList.stream().filter(obj -> obj.getAdType().equals(key) && obj.getSort().toString().equals(index)).collect(Collectors.toList());
|
||||||
if (CollectionUtil.isNotEmpty(resultList)) {
|
if (CollectionUtil.isNotEmpty(resultList)) {
|
||||||
AdNonHarmonicResult adNonHarmonicResult = resultList.get(0);
|
SimAndDigNonHarmonicResult adNonHarmonicResult = resultList.get(0);
|
||||||
if (ObjectUtil.isNotNull(adNonHarmonicResult)) {
|
if (ObjectUtil.isNotNull(adNonHarmonicResult)) {
|
||||||
dataModelMap.put("${" + index + "#" + key + "#A}", devValue(adNonHarmonicResult.getAValue(), 1, 1));
|
dataModelMap.put("${" + index + "#" + key + "#A}", devValue(adNonHarmonicResult.getAValue(), 1, 1));
|
||||||
dataModelMap.put("${" + index + "#" + key + "#B}", devValue(adNonHarmonicResult.getBValue(), 1, 1));
|
dataModelMap.put("${" + index + "#" + key + "#B}", devValue(adNonHarmonicResult.getBValue(), 1, 1));
|
||||||
@@ -1554,11 +1560,11 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
|||||||
* @param keys
|
* @param keys
|
||||||
* @param index
|
* @param index
|
||||||
*/
|
*/
|
||||||
private void fillMapValueT(List<AdNonHarmonicResult> allNonHarmonicResultList, Map<String, String> dataModelMap, Set<String> keys, String index) {
|
private void fillMapValueT(List<SimAndDigNonHarmonicResult> allNonHarmonicResultList, Map<String, String> dataModelMap, Set<String> keys, String index) {
|
||||||
keys.forEach(key -> {
|
keys.forEach(key -> {
|
||||||
List<AdNonHarmonicResult> resultList = allNonHarmonicResultList.stream().filter(obj -> obj.getAdType().equals(key) && obj.getSort().toString().equals(index)).collect(Collectors.toList());
|
List<SimAndDigNonHarmonicResult> resultList = allNonHarmonicResultList.stream().filter(obj -> obj.getAdType().equals(key) && obj.getSort().toString().equals(index)).collect(Collectors.toList());
|
||||||
if (CollectionUtil.isNotEmpty(resultList)) {
|
if (CollectionUtil.isNotEmpty(resultList)) {
|
||||||
AdNonHarmonicResult adNonHarmonicResult = resultList.get(0);
|
SimAndDigNonHarmonicResult adNonHarmonicResult = resultList.get(0);
|
||||||
if (ObjectUtil.isNotNull(adNonHarmonicResult)) {
|
if (ObjectUtil.isNotNull(adNonHarmonicResult)) {
|
||||||
dataModelMap.put("${" + index + "#" + key + "#T}", devValue(adNonHarmonicResult.getTValue(), 1, 1));
|
dataModelMap.put("${" + index + "#" + key + "#T}", devValue(adNonHarmonicResult.getTValue(), 1, 1));
|
||||||
}
|
}
|
||||||
@@ -1574,11 +1580,11 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
|||||||
* @param keys
|
* @param keys
|
||||||
* @param index
|
* @param index
|
||||||
*/
|
*/
|
||||||
private void fillMapValueHarm(List<AdHarmonicResult> allHarmonicResultList, Map<String, String> dataModelMap, Set<String> keys, String index) {
|
private void fillMapValueHarm(List<SimAndDigHarmonicResult> allHarmonicResultList, Map<String, String> dataModelMap, Set<String> keys, String index) {
|
||||||
keys.forEach(key -> {
|
keys.forEach(key -> {
|
||||||
List<AdHarmonicResult> resultList = allHarmonicResultList.stream().filter(obj -> obj.getAdType().equals(key) && obj.getSort().toString().equals(index)).collect(Collectors.toList());
|
List<SimAndDigHarmonicResult> resultList = allHarmonicResultList.stream().filter(obj -> obj.getAdType().equals(key) && obj.getSort().toString().equals(index)).collect(Collectors.toList());
|
||||||
if (CollectionUtil.isNotEmpty(resultList)) {
|
if (CollectionUtil.isNotEmpty(resultList)) {
|
||||||
AdHarmonicResult adHarmonicResult = resultList.get(0);
|
SimAndDigHarmonicResult adHarmonicResult = resultList.get(0);
|
||||||
if (Objects.nonNull(adHarmonicResult)) {
|
if (Objects.nonNull(adHarmonicResult)) {
|
||||||
if (DetectionCodeEnum.V2_50.getCode().equals(key) || DetectionCodeEnum.SV_1_49.getCode().equals(key)) {
|
if (DetectionCodeEnum.V2_50.getCode().equals(key) || DetectionCodeEnum.SV_1_49.getCode().equals(key)) {
|
||||||
fillHarm(dataModelMap, adHarmonicResult, index, key, 57.74, 100);
|
fillHarm(dataModelMap, adHarmonicResult, index, key, 57.74, 100);
|
||||||
@@ -1601,7 +1607,7 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
|||||||
* @param baseValue
|
* @param baseValue
|
||||||
* @param percent
|
* @param percent
|
||||||
*/
|
*/
|
||||||
private void fillHarm(Map<String, String> dataModelMap, AdHarmonicResult adHarmonicResult, String index, String key, double baseValue, int percent) {
|
private void fillHarm(Map<String, String> dataModelMap, SimAndDigHarmonicResult adHarmonicResult, String index, String key, double baseValue, int percent) {
|
||||||
// 要处理 2 5 7 11 23 35 43 50
|
// 要处理 2 5 7 11 23 35 43 50
|
||||||
|
|
||||||
String aBase = devValue(adHarmonicResult.getAValue1(), 1, 1);
|
String aBase = devValue(adHarmonicResult.getAValue1(), 1, 1);
|
||||||
@@ -1751,16 +1757,14 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
|||||||
public void uploadReportToCloud(List<String> deviceIds) {
|
public void uploadReportToCloud(List<String> deviceIds) {
|
||||||
log.info("开始批量上传检测报告到云端,设备ID列表:{}", deviceIds);
|
log.info("开始批量上传检测报告到云端,设备ID列表:{}", deviceIds);
|
||||||
|
|
||||||
// 查询条件:报告状态为已生成(1)的设备
|
|
||||||
LambdaQueryWrapper<PqDev> wrapper = new LambdaQueryWrapper<>();
|
|
||||||
wrapper.eq(PqDev::getReportState, DevReportStateEnum.GENERATED.getValue());
|
|
||||||
|
|
||||||
// 如果指定了设备ID列表,则只查询这些设备
|
List<PqDevSub> deviceSubs = iPqDevSubService.lambdaQuery()
|
||||||
if (CollUtil.isNotEmpty(deviceIds)) {
|
.eq(PqDevSub::getReportState, DevReportStateEnum.GENERATED.getValue())
|
||||||
wrapper.in(PqDev::getId, deviceIds);
|
.in(CollUtil.isNotEmpty(deviceIds),PqDevSub::getDevId, deviceIds).list();
|
||||||
}
|
List<String> devIds = deviceSubs.stream().map(PqDevSub::getDevId).collect(Collectors.toList());
|
||||||
|
|
||||||
List<PqDev> devices = iPqDevService.list(wrapper);
|
List<PqDev> devices = iPqDevService.lambdaQuery()
|
||||||
|
.in(CollUtil.isNotEmpty(devIds), PqDev::getId, devIds).list();
|
||||||
|
|
||||||
if (CollUtil.isEmpty(devices)) {
|
if (CollUtil.isEmpty(devices)) {
|
||||||
log.warn("未找到符合条件的设备,无需上传");
|
log.warn("未找到符合条件的设备,无需上传");
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ public enum ResultUnitEnum {
|
|||||||
IMBV("%", "电压不平衡度","IMBV"),
|
IMBV("%", "电压不平衡度","IMBV"),
|
||||||
IMBA("%", "电流不平衡度","IMBA"),
|
IMBA("%", "电流不平衡度","IMBA"),
|
||||||
F("","闪变","F"),
|
F("","闪变","F"),
|
||||||
|
P("W", "功率","P"),
|
||||||
|
|
||||||
UNKNOWN("","未知","UNKNOWN"),
|
UNKNOWN("","未知","UNKNOWN"),
|
||||||
;
|
;
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ public class ResultParam {
|
|||||||
public static class QueryParam {
|
public static class QueryParam {
|
||||||
|
|
||||||
@ApiModelProperty(value = "检测计划Id", required = true)
|
@ApiModelProperty(value = "检测计划Id", required = true)
|
||||||
@NotBlank(message = DetectionValidMessage.PLAN_ID_NOT_NULL)
|
@NotBlank(message = DetectionValidMessage.PLAN_ID_NOT_BLANK)
|
||||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.PLAN_ID_FORMAT_ERROR)
|
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.PLAN_ID_FORMAT_ERROR)
|
||||||
private String planId;
|
private String planId;
|
||||||
|
|
||||||
@@ -68,7 +68,7 @@ public class ResultParam {
|
|||||||
@Data
|
@Data
|
||||||
public static class ChangeErrorSystemParam {
|
public static class ChangeErrorSystemParam {
|
||||||
@ApiModelProperty(value = "检测计划Id", required = true)
|
@ApiModelProperty(value = "检测计划Id", required = true)
|
||||||
@NotBlank(message = DetectionValidMessage.PLAN_ID_NOT_NULL)
|
@NotBlank(message = DetectionValidMessage.PLAN_ID_NOT_BLANK)
|
||||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.PLAN_ID_FORMAT_ERROR)
|
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.PLAN_ID_FORMAT_ERROR)
|
||||||
private String planId;
|
private String planId;
|
||||||
|
|
||||||
|
|||||||
@@ -48,12 +48,12 @@ import com.njcn.gather.script.util.ScriptDtlsDesc;
|
|||||||
import com.njcn.gather.storage.mapper.TableGenMapper;
|
import com.njcn.gather.storage.mapper.TableGenMapper;
|
||||||
import com.njcn.gather.storage.pojo.param.SingleNonHarmParam;
|
import com.njcn.gather.storage.pojo.param.SingleNonHarmParam;
|
||||||
import com.njcn.gather.storage.pojo.param.StorageParam;
|
import com.njcn.gather.storage.pojo.param.StorageParam;
|
||||||
import com.njcn.gather.storage.pojo.po.AdBaseResult;
|
import com.njcn.gather.storage.pojo.po.SimAndDigBaseResult;
|
||||||
import com.njcn.gather.storage.pojo.po.AdHarmonicResult;
|
import com.njcn.gather.storage.pojo.po.SimAndDigHarmonicResult;
|
||||||
import com.njcn.gather.storage.pojo.po.AdNonHarmonicResult;
|
import com.njcn.gather.storage.pojo.po.SimAndDigNonHarmonicResult;
|
||||||
import com.njcn.gather.storage.pojo.vo.RawDataVO;
|
import com.njcn.gather.storage.pojo.vo.RawDataVO;
|
||||||
import com.njcn.gather.storage.service.AdHarmonicService;
|
import com.njcn.gather.storage.service.SimAndDigHarmonicService;
|
||||||
import com.njcn.gather.storage.service.AdNonHarmonicService;
|
import com.njcn.gather.storage.service.SimAndDigNonHarmonicService;
|
||||||
import com.njcn.gather.system.dictionary.pojo.enums.DictDataEnum;
|
import com.njcn.gather.system.dictionary.pojo.enums.DictDataEnum;
|
||||||
import com.njcn.gather.system.dictionary.pojo.po.DictData;
|
import com.njcn.gather.system.dictionary.pojo.po.DictData;
|
||||||
import com.njcn.gather.system.dictionary.pojo.po.DictTree;
|
import com.njcn.gather.system.dictionary.pojo.po.DictTree;
|
||||||
@@ -82,8 +82,8 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
|
|
||||||
private final IAdPlanService adPlanService;
|
private final IAdPlanService adPlanService;
|
||||||
private final IPqDevService pqDevService;
|
private final IPqDevService pqDevService;
|
||||||
private final AdNonHarmonicService adNonHarmonicService;
|
private final SimAndDigNonHarmonicService adNonHarmonicService;
|
||||||
private final AdHarmonicService adHarmonicService;
|
private final SimAndDigHarmonicService adHarmonicService;
|
||||||
private final IPqScriptDtlsService pqScriptDtlsService;
|
private final IPqScriptDtlsService pqScriptDtlsService;
|
||||||
private final PqScriptMapper scriptMapper;
|
private final PqScriptMapper scriptMapper;
|
||||||
private final IDictTreeService dictTreeService;
|
private final IDictTreeService dictTreeService;
|
||||||
@@ -116,7 +116,7 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
|
|
||||||
List<Map<String, String>> chnList = new ArrayList<>();
|
List<Map<String, String>> chnList = new ArrayList<>();
|
||||||
|
|
||||||
List<AdBaseResult> allResultList = new ArrayList<>();
|
List<SimAndDigBaseResult> allResultList = new ArrayList<>();
|
||||||
//只查询指定的脚本类型
|
//只查询指定的脚本类型
|
||||||
if (ObjectUtil.isNotNull(queryParam.getScriptType())) {
|
if (ObjectUtil.isNotNull(queryParam.getScriptType())) {
|
||||||
List<Integer> indexList = pqScriptDtlsService.getIndexList(queryParam.getScriptType(), scriptId);
|
List<Integer> indexList = pqScriptDtlsService.getIndexList(queryParam.getScriptType(), scriptId);
|
||||||
@@ -125,22 +125,22 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
if (HARMONIC_TYPE_CODE.contains(dictTree.getCode())) {
|
if (HARMONIC_TYPE_CODE.contains(dictTree.getCode())) {
|
||||||
allResultList.addAll(adHarmonicService.get(scriptId, indexList, queryParam.getDeviceId(), queryParam.getChnNum(), plan.getCode() + ""));
|
allResultList.addAll(adHarmonicService.get(scriptId, indexList, queryParam.getDeviceId(), queryParam.getChnNum(), plan.getCode() + ""));
|
||||||
} else {
|
} else {
|
||||||
allResultList.addAll(adNonHarmonicService.get(scriptId, indexList, queryParam.getDeviceId(), queryParam.getChnNum(), plan.getCode() + ""));
|
allResultList.addAll(adNonHarmonicService.listSimAndDigBaseResult(scriptId, indexList, queryParam.getDeviceId(), queryParam.getChnNum(), plan.getCode() + ""));
|
||||||
}
|
}
|
||||||
} else { //查询所有的脚本类型
|
} else { //查询所有的脚本类型
|
||||||
allResultList.addAll(adHarmonicService.get(scriptId, null, queryParam.getDeviceId(), queryParam.getChnNum(), plan.getCode() + ""));
|
allResultList.addAll(adHarmonicService.get(scriptId, null, queryParam.getDeviceId(), queryParam.getChnNum(), plan.getCode() + ""));
|
||||||
allResultList.addAll(adNonHarmonicService.get(scriptId, null, queryParam.getDeviceId(), queryParam.getChnNum(), plan.getCode() + ""));
|
allResultList.addAll(adNonHarmonicService.listSimAndDigBaseResult(scriptId, null, queryParam.getDeviceId(), queryParam.getChnNum(), plan.getCode() + ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (ObjectUtil.isNotEmpty(allResultList)) {
|
if (ObjectUtil.isNotEmpty(allResultList)) {
|
||||||
Map<String, List<AdBaseResult>> chnMap = allResultList.stream().collect(
|
Map<String, List<SimAndDigBaseResult>> chnMap = allResultList.stream().collect(
|
||||||
Collectors.groupingBy(obj -> obj.getMonitorId().substring(obj.getMonitorId().lastIndexOf("_") + 1))
|
Collectors.groupingBy(obj -> obj.getMonitorId().substring(obj.getMonitorId().lastIndexOf("_") + 1))
|
||||||
);
|
);
|
||||||
chnMap.forEach((chn, list) -> {
|
chnMap.forEach((chn, list) -> {
|
||||||
Map<String, String> map = new HashMap<>();
|
Map<String, String> map = new HashMap<>();
|
||||||
map.put("value", chn);
|
map.put("value", chn);
|
||||||
Set<Integer> collect = list.stream().filter(obj -> obj.getResultFlag() != 4).map(AdBaseResult::getResultFlag).collect(Collectors.toSet());
|
Set<Integer> collect = list.stream().filter(obj -> obj.getResultFlag() != 4).map(SimAndDigBaseResult::getResultFlag).collect(Collectors.toSet());
|
||||||
map.put("label", conform(collect) + "");
|
map.put("label", conform(collect) + "");
|
||||||
|
|
||||||
chnList.add(map);
|
chnList.add(map);
|
||||||
@@ -164,15 +164,15 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
);
|
);
|
||||||
Map<Integer, Set<Integer>> resultMap = new HashMap<>(5);
|
Map<Integer, Set<Integer>> resultMap = new HashMap<>(5);
|
||||||
if (StrUtil.isNotBlank(param.getDevId())) {
|
if (StrUtil.isNotBlank(param.getDevId())) {
|
||||||
List<AdBaseResult> allResultList = new ArrayList<>();
|
List<SimAndDigBaseResult> allResultList = new ArrayList<>();
|
||||||
List<Integer> indexList = new ArrayList<>();
|
List<Integer> indexList = new ArrayList<>();
|
||||||
if (StrUtil.isNotBlank(param.getScriptType())) {
|
if (StrUtil.isNotBlank(param.getScriptType())) {
|
||||||
indexList = pqScriptDtlsService.getIndexList(param.getScriptType(), param.getScriptId());
|
indexList = pqScriptDtlsService.getIndexList(param.getScriptType(), param.getScriptId());
|
||||||
}
|
}
|
||||||
allResultList.addAll(adNonHarmonicService.get(param.getScriptId(), indexList, param.getDevId(), param.getDevNum(), param.getCode()));
|
allResultList.addAll(adNonHarmonicService.listSimAndDigBaseResult(param.getScriptId(), indexList, param.getDevId(), param.getDevNum(), param.getCode()));
|
||||||
allResultList.addAll(adHarmonicService.get(param.getScriptId(), indexList, param.getDevId(), param.getDevNum(), param.getCode()));
|
allResultList.addAll(adHarmonicService.get(param.getScriptId(), indexList, param.getDevId(), param.getDevNum(), param.getCode()));
|
||||||
if (CollUtil.isNotEmpty(allResultList)) {
|
if (CollUtil.isNotEmpty(allResultList)) {
|
||||||
resultMap = allResultList.stream().collect(Collectors.groupingBy(AdBaseResult::getSort, Collectors.mapping(AdBaseResult::getResultFlag, Collectors.toSet())));
|
resultMap = allResultList.stream().collect(Collectors.groupingBy(SimAndDigBaseResult::getSort, Collectors.mapping(SimAndDigBaseResult::getResultFlag, Collectors.toSet())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -971,7 +971,7 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
List<Map<String, String>> keyFillMapList = new ArrayList<>();
|
List<Map<String, String>> keyFillMapList = new ArrayList<>();
|
||||||
for (Integer sort : indexList) {
|
for (Integer sort : indexList) {
|
||||||
SingleNonHarmParam param = new SingleNonHarmParam(planCode, devId, lineNo, valueTypeList, Collections.singletonList(sort));
|
SingleNonHarmParam param = new SingleNonHarmParam(planCode, devId, lineNo, valueTypeList, Collections.singletonList(sort));
|
||||||
List<AdNonHarmonicResult> nonHarmList = adNonHarmonicService.queryByCondition(param);
|
List<SimAndDigNonHarmonicResult> nonHarmList = adNonHarmonicService.queryByCondition(param);
|
||||||
if (CollUtil.isNotEmpty(nonHarmList)) {
|
if (CollUtil.isNotEmpty(nonHarmList)) {
|
||||||
Map<String, String> keyFillMap = new HashMap<>(16);
|
Map<String, String> keyFillMap = new HashMap<>(16);
|
||||||
fillVoltagePhaseData(nonHarmList, keyFillMap, tableKeys);
|
fillVoltagePhaseData(nonHarmList, keyFillMap, tableKeys);
|
||||||
@@ -996,7 +996,7 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
if (indexList.size() == 1) {
|
if (indexList.size() == 1) {
|
||||||
// 获取谐波数据
|
// 获取谐波数据
|
||||||
SingleNonHarmParam param = new SingleNonHarmParam(planCode, devId, lineNo, valueType, indexList.get(0));
|
SingleNonHarmParam param = new SingleNonHarmParam(planCode, devId, lineNo, valueType, indexList.get(0));
|
||||||
AdHarmonicResult singleResult = adHarmonicService.getSingleResult(param);
|
SimAndDigHarmonicResult singleResult = adHarmonicService.getSingleResult(param);
|
||||||
// 注:如果ABC的标准值一致,则同步到standard中
|
// 注:如果ABC的标准值一致,则同步到standard中
|
||||||
Map<Double, List<PqScriptCheckData>> checkDataHarmNumMap = scriptCheckDataList.stream().collect(Collectors.groupingBy(PqScriptCheckData::getHarmNum));
|
Map<Double, List<PqScriptCheckData>> checkDataHarmNumMap = scriptCheckDataList.stream().collect(Collectors.groupingBy(PqScriptCheckData::getHarmNum));
|
||||||
List<Map<String, String>> keyFillMapList = new ArrayList<>();
|
List<Map<String, String>> keyFillMapList = new ArrayList<>();
|
||||||
@@ -1039,12 +1039,12 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
if (PowerConstant.THREE_PHASE.contains(scriptCode)) {
|
if (PowerConstant.THREE_PHASE.contains(scriptCode)) {
|
||||||
// 获取该三相的数据
|
// 获取该三相的数据
|
||||||
SingleNonHarmParam param = new SingleNonHarmParam(planCode, devId, lineNo, Collections.singletonList(valueType), indexList);
|
SingleNonHarmParam param = new SingleNonHarmParam(planCode, devId, lineNo, Collections.singletonList(valueType), indexList);
|
||||||
List<AdNonHarmonicResult> nonHarmList = adNonHarmonicService.queryByCondition(param);
|
List<SimAndDigNonHarmonicResult> nonHarmList = adNonHarmonicService.queryByCondition(param);
|
||||||
if (CollUtil.isNotEmpty(nonHarmList)) {
|
if (CollUtil.isNotEmpty(nonHarmList)) {
|
||||||
List<Map<String, String>> keyFillMapList = new ArrayList<>();
|
List<Map<String, String>> keyFillMapList = new ArrayList<>();
|
||||||
for (AdNonHarmonicResult adNonHarmonicResult : nonHarmList) {
|
for (SimAndDigNonHarmonicResult SimAndDigNonHarmonicResult : nonHarmList) {
|
||||||
Map<String, String> keyFillMap = new HashMap<>(16);
|
Map<String, String> keyFillMap = new HashMap<>(16);
|
||||||
fillThreePhaseData(adNonHarmonicResult, null, keyFillMap, scriptCode);
|
fillThreePhaseData(SimAndDigNonHarmonicResult, null, keyFillMap, scriptCode);
|
||||||
keyFillMapList.add(keyFillMap);
|
keyFillMapList.add(keyFillMap);
|
||||||
}
|
}
|
||||||
if (CollUtil.isNotEmpty(keyFillMapList)) {
|
if (CollUtil.isNotEmpty(keyFillMapList)) {
|
||||||
@@ -1067,11 +1067,11 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
// 非三相且非暂态,通常只有一个数据,所以直接赋值即可
|
// 非三相且非暂态,通常只有一个数据,所以直接赋值即可
|
||||||
List<Map<String, String>> keyFillMapList = new ArrayList<>();
|
List<Map<String, String>> keyFillMapList = new ArrayList<>();
|
||||||
SingleNonHarmParam param = new SingleNonHarmParam(planCode, devId, lineNo, Collections.singletonList(valueType), indexList);
|
SingleNonHarmParam param = new SingleNonHarmParam(planCode, devId, lineNo, Collections.singletonList(valueType), indexList);
|
||||||
List<AdNonHarmonicResult> nonHarmList = adNonHarmonicService.queryByCondition(param);
|
List<SimAndDigNonHarmonicResult> nonHarmList = adNonHarmonicService.queryByCondition(param);
|
||||||
if (CollUtil.isNotEmpty(nonHarmList)) {
|
if (CollUtil.isNotEmpty(nonHarmList)) {
|
||||||
for (AdNonHarmonicResult adNonHarmonicResult : nonHarmList) {
|
for (SimAndDigNonHarmonicResult simAndDigNonHarmonicResult : nonHarmList) {
|
||||||
Map<String, String> keyFillMap = new HashMap<>(8);
|
Map<String, String> keyFillMap = new HashMap<>(8);
|
||||||
fillTPhaseData(adNonHarmonicResult, null, keyFillMap);
|
fillTPhaseData(simAndDigNonHarmonicResult, null, keyFillMap);
|
||||||
keyFillMapList.add(keyFillMap);
|
keyFillMapList.add(keyFillMap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1286,14 +1286,14 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
* @param keyFillMap 待填充的集合Map
|
* @param keyFillMap 待填充的集合Map
|
||||||
* @param tableKeys 模板表格中的key
|
* @param tableKeys 模板表格中的key
|
||||||
*/
|
*/
|
||||||
private void fillVoltagePhaseData(List<AdNonHarmonicResult> nonHarmList, Map<String, String> keyFillMap, List<String> tableKeys) {
|
private void fillVoltagePhaseData(List<SimAndDigNonHarmonicResult> nonHarmList, Map<String, String> keyFillMap, List<String> tableKeys) {
|
||||||
String standardMag = "/", standardDur = "/",
|
String standardMag = "/", standardDur = "/",
|
||||||
testMag = "/", testDur = "/",
|
testMag = "/", testDur = "/",
|
||||||
errorMag = "/", errorDur = "/",
|
errorMag = "/", errorDur = "/",
|
||||||
resultMag = "/", resultDur = "/", result,
|
resultMag = "/", resultDur = "/", result,
|
||||||
errorScope, errorScopeMag = "/", errorScopeDur = "/",
|
errorScope, errorScopeMag = "/", errorScopeDur = "/",
|
||||||
unitMag = "", unitDur = "";
|
unitMag = "", unitDur = "";
|
||||||
for (AdNonHarmonicResult adNonHarmonicResult : nonHarmList) {
|
for (SimAndDigNonHarmonicResult adNonHarmonicResult : nonHarmList) {
|
||||||
DetectionData tempT = getResultData(adNonHarmonicResult, null, PowerConstant.PHASE_T);
|
DetectionData tempT = getResultData(adNonHarmonicResult, null, PowerConstant.PHASE_T);
|
||||||
// 需要判断adNonHarmonicResult是特征幅值还是持续时间
|
// 需要判断adNonHarmonicResult是特征幅值还是持续时间
|
||||||
String adType = adNonHarmonicResult.getAdType();
|
String adType = adNonHarmonicResult.getAdType();
|
||||||
@@ -1520,7 +1520,7 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
private void createTempResultTable(String code) {
|
private void createTempResultTable(String code) {
|
||||||
this.dropTempResultTable(code);
|
this.dropTempResultTable(code);
|
||||||
String oldCode = code.replace("_temp", "");
|
String oldCode = code.replace("_temp", "");
|
||||||
tableGenMapper.genAdNonHarmonicResultTable(code);
|
tableGenMapper.genNonHarmonicResultTable(code, false);
|
||||||
StringBuilder A = new StringBuilder();
|
StringBuilder A = new StringBuilder();
|
||||||
StringBuilder B = new StringBuilder();
|
StringBuilder B = new StringBuilder();
|
||||||
StringBuilder C = new StringBuilder();
|
StringBuilder C = new StringBuilder();
|
||||||
@@ -1596,12 +1596,12 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
dataRule = DictDataEnum.SECTION_VALUE;
|
dataRule = DictDataEnum.SECTION_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<AdNonHarmonicResult> allNonHarmonicRawData = adNonHarmonicService.listAllRawData(scriptId, oldCode, devId);
|
List<SimAndDigNonHarmonicResult> allNonHarmonicRawData = adNonHarmonicService.listAllSimAndDigRawData(scriptId, oldCode, devId);
|
||||||
LinkedHashMap<Integer, List<AdNonHarmonicResult>> nonHarmonicMap = allNonHarmonicRawData.stream().sorted(Comparator.comparing(AdNonHarmonicResult::getSort))
|
LinkedHashMap<Integer, List<SimAndDigNonHarmonicResult>> nonHarmonicMap = allNonHarmonicRawData.stream().sorted(Comparator.comparing(SimAndDigNonHarmonicResult::getSort))
|
||||||
.collect(Collectors.groupingBy(AdNonHarmonicResult::getSort, LinkedHashMap::new, Collectors.toList()));
|
.collect(Collectors.groupingBy(SimAndDigNonHarmonicResult::getSort, LinkedHashMap::new, Collectors.toList()));
|
||||||
List<AdHarmonicResult> allHarmonicRawData = adHarmonicService.listAllRawData(scriptId, oldCode, devId);
|
List<SimAndDigHarmonicResult> allHarmonicRawData = adHarmonicService.listAllRawData(scriptId, oldCode, devId);
|
||||||
LinkedHashMap<Integer, List<AdHarmonicResult>> harmonicMap = allHarmonicRawData.stream().sorted(Comparator.comparing(AdHarmonicResult::getSort))
|
LinkedHashMap<Integer, List<SimAndDigHarmonicResult>> harmonicMap = allHarmonicRawData.stream().sorted(Comparator.comparing(SimAndDigHarmonicResult::getSort))
|
||||||
.collect(Collectors.groupingBy(AdHarmonicResult::getSort, LinkedHashMap::new, Collectors.toList()));
|
.collect(Collectors.groupingBy(SimAndDigHarmonicResult::getSort, LinkedHashMap::new, Collectors.toList()));
|
||||||
|
|
||||||
PqScriptIssueParam issueParam = new PqScriptIssueParam();
|
PqScriptIssueParam issueParam = new PqScriptIssueParam();
|
||||||
issueParam.setPlanId(planId);
|
issueParam.setPlanId(planId);
|
||||||
@@ -1615,8 +1615,8 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
List<SourceIssue> sourceIssues = pqScriptDtlsService.listSourceIssue(issueParam);
|
List<SourceIssue> sourceIssues = pqScriptDtlsService.listSourceIssue(issueParam);
|
||||||
|
|
||||||
sourceIssues.forEach(sourceIssue -> {
|
sourceIssues.forEach(sourceIssue -> {
|
||||||
List<AdNonHarmonicResult> nonHarmonicResults = nonHarmonicMap.get(sourceIssue.getIndex());
|
List<SimAndDigNonHarmonicResult> nonHarmonicResults = nonHarmonicMap.get(sourceIssue.getIndex());
|
||||||
List<AdHarmonicResult> harmonicResults = harmonicMap.get(sourceIssue.getIndex());
|
List<SimAndDigHarmonicResult> harmonicResults = harmonicMap.get(sourceIssue.getIndex());
|
||||||
List<DevData> realDataXiList = new ArrayList<>();
|
List<DevData> realDataXiList = new ArrayList<>();
|
||||||
if (CollUtil.isNotEmpty(nonHarmonicResults)) {
|
if (CollUtil.isNotEmpty(nonHarmonicResults)) {
|
||||||
realDataXiList.addAll(this.toList(nonHarmonicResults, null, true));
|
realDataXiList.addAll(this.toList(nonHarmonicResults, null, true));
|
||||||
@@ -1640,11 +1640,11 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
iPqDevService.updateResult(param.getDevIds(), valueType, param.getCode(), null, param.getTemperature(), param.getHumidity());
|
iPqDevService.updateResult(param.getDevIds(), valueType, param.getCode(), null, param.getTemperature(), param.getHumidity());
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<DevData> toList(List<AdNonHarmonicResult> nonHarm, List<AdHarmonicResult> harm, boolean containBaseHarm) {
|
private List<DevData> toList(List<SimAndDigNonHarmonicResult> nonHarm, List<SimAndDigHarmonicResult> harm, boolean containBaseHarm) {
|
||||||
List<DevData> info = new ArrayList<>();
|
List<DevData> info = new ArrayList<>();
|
||||||
// if (CollUtil.isNotEmpty(nonHarm)) {
|
// if (CollUtil.isNotEmpty(nonHarm)) {
|
||||||
if (CollUtil.isNotEmpty(nonHarm)) {
|
if (CollUtil.isNotEmpty(nonHarm)) {
|
||||||
Map<String, List<AdNonHarmonicResult>> noHarmMap = nonHarm.stream()
|
Map<String, List<SimAndDigNonHarmonicResult>> noHarmMap = nonHarm.stream()
|
||||||
.collect(Collectors.groupingBy(x -> x.getMonitorId() + "_" + x.getTimeId().format(DateTimeFormatter.ofPattern(DatePattern.UTC_SIMPLE_MS_PATTERN)) + "_" + x.getSort()));
|
.collect(Collectors.groupingBy(x -> x.getMonitorId() + "_" + x.getTimeId().format(DateTimeFormatter.ofPattern(DatePattern.UTC_SIMPLE_MS_PATTERN)) + "_" + x.getSort()));
|
||||||
noHarmMap.forEach((key, value) -> {
|
noHarmMap.forEach((key, value) -> {
|
||||||
String[] split = key.split("_");
|
String[] split = key.split("_");
|
||||||
@@ -1653,7 +1653,7 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
data.setId(split[0] + "_" + split[1]);
|
data.setId(split[0] + "_" + split[1]);
|
||||||
List<DevData.SqlDataDTO> sqlDataDTOS = new ArrayList<>();
|
List<DevData.SqlDataDTO> sqlDataDTOS = new ArrayList<>();
|
||||||
DevData.SqlDataDTO sqlDataDTO;
|
DevData.SqlDataDTO sqlDataDTO;
|
||||||
for (AdNonHarmonicResult result : value) {
|
for (SimAndDigNonHarmonicResult result : value) {
|
||||||
sqlDataDTO = new DevData.SqlDataDTO();
|
sqlDataDTO = new DevData.SqlDataDTO();
|
||||||
sqlDataDTO.setType(result.getDataType());
|
sqlDataDTO.setType(result.getDataType());
|
||||||
sqlDataDTO.setDesc(result.getAdType());
|
sqlDataDTO.setDesc(result.getAdType());
|
||||||
@@ -1670,7 +1670,7 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (CollUtil.isNotEmpty(harm)) {
|
if (CollUtil.isNotEmpty(harm)) {
|
||||||
Map<String, List<AdHarmonicResult>> harmMap = harm.stream()
|
Map<String, List<SimAndDigHarmonicResult>> harmMap = harm.stream()
|
||||||
.collect(Collectors.groupingBy(x -> x.getMonitorId() + "_" + x.getTimeId().format(DateTimeFormatter.ofPattern(DatePattern.UTC_SIMPLE_MS_PATTERN))));
|
.collect(Collectors.groupingBy(x -> x.getMonitorId() + "_" + x.getTimeId().format(DateTimeFormatter.ofPattern(DatePattern.UTC_SIMPLE_MS_PATTERN))));
|
||||||
harmMap.forEach((key, value) -> {
|
harmMap.forEach((key, value) -> {
|
||||||
List<DevData> collect = info.stream().filter(x -> key.equals(x.getId() + "_" + x.getTime())).collect(Collectors.toList());
|
List<DevData> collect = info.stream().filter(x -> key.equals(x.getId() + "_" + x.getTime())).collect(Collectors.toList());
|
||||||
@@ -1678,7 +1678,7 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
DevData.SqlDataDTO sqlDataDTO;
|
DevData.SqlDataDTO sqlDataDTO;
|
||||||
List<DevData.SqlDataHarmDTO> sqlDataHarmDTOS = new ArrayList<>();
|
List<DevData.SqlDataHarmDTO> sqlDataHarmDTOS = new ArrayList<>();
|
||||||
DevData.SqlDataHarmDTO dataHarmDTO;
|
DevData.SqlDataHarmDTO dataHarmDTO;
|
||||||
for (AdHarmonicResult harmonicResult : value) {
|
for (SimAndDigHarmonicResult harmonicResult : value) {
|
||||||
if (containBaseHarm) {
|
if (containBaseHarm) {
|
||||||
sqlDataDTO = new DevData.SqlDataDTO();
|
sqlDataDTO = new DevData.SqlDataDTO();
|
||||||
sqlDataDTO.setType(harmonicResult.getDataType());
|
sqlDataDTO.setType(harmonicResult.getDataType());
|
||||||
@@ -1725,12 +1725,12 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<String> reflectHarmonicValue(String phase, AdHarmonicResult adHarmonicResult, boolean notContainBaseHarm) {
|
private List<String> reflectHarmonicValue(String phase, SimAndDigHarmonicResult adHarmonicResult, boolean notContainBaseHarm) {
|
||||||
List<String> info = new ArrayList<>();
|
List<String> info = new ArrayList<>();
|
||||||
for (int i = notContainBaseHarm ? 2 : 1; i <= 50; i++) {
|
for (int i = notContainBaseHarm ? 2 : 1; i <= 50; i++) {
|
||||||
String fieldName = phase + "Value" + i;
|
String fieldName = phase + "Value" + i;
|
||||||
try {
|
try {
|
||||||
Field idField = AdHarmonicResult.class.getDeclaredField(fieldName);
|
Field idField = SimAndDigHarmonicResult.class.getDeclaredField(fieldName);
|
||||||
idField.setAccessible(true);
|
idField.setAccessible(true);
|
||||||
String value = idField.get(adHarmonicResult) + "";
|
String value = idField.get(adHarmonicResult) + "";
|
||||||
info.add(value);
|
info.add(value);
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|||||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||||
import com.njcn.gather.detection.pojo.enums.DetectionCodeEnum;
|
import com.njcn.gather.detection.pojo.enums.DetectionCodeEnum;
|
||||||
import com.njcn.gather.detection.pojo.enums.SourceOperateCodeEnum;
|
|
||||||
import com.njcn.gather.detection.pojo.param.PreDetectionParam;
|
import com.njcn.gather.detection.pojo.param.PreDetectionParam;
|
||||||
import com.njcn.gather.device.pojo.enums.CommonEnum;
|
import com.njcn.gather.device.pojo.enums.CommonEnum;
|
||||||
import com.njcn.gather.device.pojo.po.PqDev;
|
import com.njcn.gather.device.pojo.po.PqDev;
|
||||||
@@ -437,7 +436,8 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
|
|||||||
channelListDTO.setPid(dictTree.getPid());
|
channelListDTO.setPid(dictTree.getPid());
|
||||||
DetectionCodeEnum codeEnum = DetectionCodeEnum.getDetectionCodeByCode(dictTree.getCode());
|
DetectionCodeEnum codeEnum = DetectionCodeEnum.getDetectionCodeByCode(dictTree.getCode());
|
||||||
List<PqScriptDtlsParam.ChannelListDTO> channelList = sourceIssue.getChannelList();
|
List<PqScriptDtlsParam.ChannelListDTO> channelList = sourceIssue.getChannelList();
|
||||||
List<PqScriptDtlsParam.ChannelListDTO> list;
|
List<PqScriptDtlsParam.ChannelListDTO> channelU;
|
||||||
|
List<PqScriptDtlsParam.ChannelListDTO> channelI;
|
||||||
List<PqScriptCheckData> checkArchive;
|
List<PqScriptCheckData> checkArchive;
|
||||||
if (checkDataOldMap.containsKey(codeEnum.getCode())) {
|
if (checkDataOldMap.containsKey(codeEnum.getCode())) {
|
||||||
checkArchive = checkDataOldMap.get(codeEnum.getCode());
|
checkArchive = checkDataOldMap.get(codeEnum.getCode());
|
||||||
@@ -462,20 +462,20 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
|
|||||||
case U1:
|
case U1:
|
||||||
case VRMS:
|
case VRMS:
|
||||||
if (CollUtil.isNotEmpty(channelList)) {
|
if (CollUtil.isNotEmpty(channelList)) {
|
||||||
list = channelList.stream().filter(x -> x.getChannelType().contains("U")).collect(Collectors.toList());
|
channelU = channelList.stream().filter(x -> x.getChannelType().contains("U")).collect(Collectors.toList());
|
||||||
rmsCheck(info, channelListDTO, list, checkArchive, false);
|
rmsCheck(info, channelListDTO, channelU, checkArchive, false);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case DELTA_V:
|
case DELTA_V:
|
||||||
if (CollUtil.isNotEmpty(channelList)) {
|
if (CollUtil.isNotEmpty(channelList)) {
|
||||||
list = channelList.stream().filter(x -> x.getChannelType().contains("U")).collect(Collectors.toList());
|
channelU = channelList.stream().filter(x -> x.getChannelType().contains("U")).collect(Collectors.toList());
|
||||||
rmsCheck(info, channelListDTO, list, checkArchive, true);
|
rmsCheck(info, channelListDTO, channelU, checkArchive, true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case VA:
|
case VA:
|
||||||
if (CollUtil.isNotEmpty(channelList)) {
|
if (CollUtil.isNotEmpty(channelList)) {
|
||||||
list = channelList.stream().filter(x -> x.getChannelType().contains("U")).collect(Collectors.toList());
|
channelU = channelList.stream().filter(x -> x.getChannelType().contains("U")).collect(Collectors.toList());
|
||||||
for (PqScriptDtlsParam.ChannelListDTO listDTO : list) {
|
for (PqScriptDtlsParam.ChannelListDTO listDTO : channelU) {
|
||||||
if (listDTO.getChannelFlag()) {
|
if (listDTO.getChannelFlag()) {
|
||||||
checkData = new PqScriptDtlsParam.CheckData();
|
checkData = new PqScriptDtlsParam.CheckData();
|
||||||
checkData.setErrorFlag(channelListDTO.getErrorFlag());
|
checkData.setErrorFlag(channelListDTO.getErrorFlag());
|
||||||
@@ -491,23 +491,23 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
|
|||||||
break;
|
break;
|
||||||
case V2_50:
|
case V2_50:
|
||||||
if (CollUtil.isNotEmpty(channelList)) {
|
if (CollUtil.isNotEmpty(channelList)) {
|
||||||
list = channelList.stream().filter(x -> x.getChannelType().contains("U")).collect(Collectors.toList());
|
channelU = channelList.stream().filter(x -> x.getChannelType().contains("U")).collect(Collectors.toList());
|
||||||
harmCheck(info, channelListDTO, list, checkArchive);
|
harmCheck(info, channelListDTO, channelU, checkArchive);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case I2_50:
|
case I2_50:
|
||||||
if (CollUtil.isNotEmpty(channelList)) {
|
if (CollUtil.isNotEmpty(channelList)) {
|
||||||
list = channelList.stream().filter(x -> x.getChannelType().contains("I")).collect(Collectors.toList());
|
channelI = channelList.stream().filter(x -> x.getChannelType().contains("I")).collect(Collectors.toList());
|
||||||
harmCheck(info, channelListDTO, list, checkArchive);
|
harmCheck(info, channelListDTO, channelI, checkArchive);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case P2_50:
|
case P2_50:
|
||||||
List<PqScriptDtlsParam.ChannelListDTO> channelU = channelList.stream().filter(x -> x.getChannelType().contains("U")).collect(Collectors.toList());
|
channelU = channelList.stream().filter(x -> x.getChannelType().contains("U")).collect(Collectors.toList());
|
||||||
if (CollUtil.isNotEmpty(channelU)) {
|
if (CollUtil.isNotEmpty(channelU)) {
|
||||||
for (PqScriptDtlsParam.ChannelListDTO listDTO : channelU) {
|
for (PqScriptDtlsParam.ChannelListDTO listDTO : channelU) {
|
||||||
if (listDTO.getHarmFlag()) {
|
if (listDTO.getHarmFlag()) {
|
||||||
//获取电流通道
|
//获取电流通道
|
||||||
List<PqScriptDtlsParam.ChannelListDTO> channelI = channelList.stream()
|
channelI = channelList.stream()
|
||||||
.filter(PqScriptDtlsParam.ChannelListDTO::getHarmFlag)
|
.filter(PqScriptDtlsParam.ChannelListDTO::getHarmFlag)
|
||||||
.filter(x -> x.getChannelType().contains("I" + listDTO.getChannelType().substring(1, 2)))
|
.filter(x -> x.getChannelType().contains("I" + listDTO.getChannelType().substring(1, 2)))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
@@ -538,19 +538,19 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
|
|||||||
break;
|
break;
|
||||||
case SV_1_49:
|
case SV_1_49:
|
||||||
if (CollUtil.isNotEmpty(channelList)) {
|
if (CollUtil.isNotEmpty(channelList)) {
|
||||||
list = channelList.stream().filter(x -> x.getChannelType().contains("U")).collect(Collectors.toList());
|
channelU = channelList.stream().filter(x -> x.getChannelType().contains("U")).collect(Collectors.toList());
|
||||||
inHarmCheck(info, channelListDTO, list, checkArchive);
|
inHarmCheck(info, channelListDTO, channelU, checkArchive);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SI_1_49:
|
case SI_1_49:
|
||||||
if (CollUtil.isNotEmpty(channelList)) {
|
if (CollUtil.isNotEmpty(channelList)) {
|
||||||
list = channelList.stream().filter(x -> x.getChannelType().contains("I")).collect(Collectors.toList());
|
channelI = channelList.stream().filter(x -> x.getChannelType().contains("I")).collect(Collectors.toList());
|
||||||
inHarmCheck(info, channelListDTO, list, checkArchive);
|
inHarmCheck(info, channelListDTO, channelI, checkArchive);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MAG:
|
case MAG:
|
||||||
list = channelList.stream().filter(x -> x.getChannelType().contains("U")).collect(Collectors.toList());
|
channelU = channelList.stream().filter(x -> x.getChannelType().contains("U")).collect(Collectors.toList());
|
||||||
for (PqScriptDtlsParam.ChannelListDTO listDTO : list) {
|
for (PqScriptDtlsParam.ChannelListDTO listDTO : channelU) {
|
||||||
if (listDTO.getDipFlag()) {
|
if (listDTO.getDipFlag()) {
|
||||||
checkData = new PqScriptDtlsParam.CheckData();
|
checkData = new PqScriptDtlsParam.CheckData();
|
||||||
checkData.setErrorFlag(channelListDTO.getErrorFlag());
|
checkData.setErrorFlag(channelListDTO.getErrorFlag());
|
||||||
@@ -561,8 +561,8 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case DUR:
|
case DUR:
|
||||||
list = channelList.stream().filter(x -> x.getChannelType().contains("U")).collect(Collectors.toList());
|
channelU = channelList.stream().filter(x -> x.getChannelType().contains("U")).collect(Collectors.toList());
|
||||||
for (PqScriptDtlsParam.ChannelListDTO listDTO : list) {
|
for (PqScriptDtlsParam.ChannelListDTO listDTO : channelU) {
|
||||||
if (listDTO.getDipFlag()) {
|
if (listDTO.getDipFlag()) {
|
||||||
checkData = new PqScriptDtlsParam.CheckData();
|
checkData = new PqScriptDtlsParam.CheckData();
|
||||||
checkData.setErrorFlag(channelListDTO.getErrorFlag());
|
checkData.setErrorFlag(channelListDTO.getErrorFlag());
|
||||||
@@ -575,22 +575,22 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
|
|||||||
case IRMS:
|
case IRMS:
|
||||||
case IA:
|
case IA:
|
||||||
if (CollUtil.isNotEmpty(channelList)) {
|
if (CollUtil.isNotEmpty(channelList)) {
|
||||||
list = channelList.stream().filter(x -> x.getChannelType().contains("I")).collect(Collectors.toList());
|
channelI = channelList.stream().filter(x -> x.getChannelType().contains("I")).collect(Collectors.toList());
|
||||||
rmsCheck(info, channelListDTO, list, checkArchive, false);
|
rmsCheck(info, channelListDTO, channelI, checkArchive, false);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case V_UNBAN:
|
case V_UNBAN:
|
||||||
list = channelList.stream().filter(x -> x.getChannelType().contains("U")).collect(Collectors.toList());
|
channelU = channelList.stream().filter(x -> x.getChannelType().contains("U")).collect(Collectors.toList());
|
||||||
unbanCheck(info, channelListDTO, list, checkArchive);
|
unbanCheck(info, channelListDTO, channelU, checkArchive);
|
||||||
break;
|
break;
|
||||||
case I_UNBAN:
|
case I_UNBAN:
|
||||||
list = channelList.stream().filter(x -> x.getChannelType().contains("I")).collect(Collectors.toList());
|
channelI = channelList.stream().filter(x -> x.getChannelType().contains("I")).collect(Collectors.toList());
|
||||||
unbanCheck(info, channelListDTO, list, checkArchive);
|
unbanCheck(info, channelListDTO, channelI, checkArchive);
|
||||||
break;
|
break;
|
||||||
case PST:
|
case PST:
|
||||||
if (CollUtil.isNotEmpty(channelList)) {
|
if (CollUtil.isNotEmpty(channelList)) {
|
||||||
list = channelList.stream().filter(x -> x.getChannelType().contains("U")).collect(Collectors.toList());
|
channelU = channelList.stream().filter(x -> x.getChannelType().contains("U")).collect(Collectors.toList());
|
||||||
for (PqScriptDtlsParam.ChannelListDTO listDTO : list) {
|
for (PqScriptDtlsParam.ChannelListDTO listDTO : channelU) {
|
||||||
if (listDTO.getFlickerFlag()) {
|
if (listDTO.getFlickerFlag()) {
|
||||||
checkData = new PqScriptDtlsParam.CheckData();
|
checkData = new PqScriptDtlsParam.CheckData();
|
||||||
checkData.setErrorFlag(channelListDTO.getErrorFlag());
|
checkData.setErrorFlag(channelListDTO.getErrorFlag());
|
||||||
@@ -605,6 +605,26 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
|
|||||||
break;
|
break;
|
||||||
case I1:
|
case I1:
|
||||||
break;
|
break;
|
||||||
|
case P_FUND:
|
||||||
|
channelU = channelList.stream().filter(x -> x.getChannelType().contains("U")).collect(Collectors.toList());
|
||||||
|
if (CollUtil.isNotEmpty(channelU)) {
|
||||||
|
for (PqScriptDtlsParam.ChannelListDTO listDTO : channelU) {
|
||||||
|
//获取电流通道
|
||||||
|
channelI = channelList.stream()
|
||||||
|
.filter(PqScriptDtlsParam.ChannelListDTO::getHarmFlag)
|
||||||
|
.filter(x -> x.getChannelType().contains("I" + listDTO.getChannelType().substring(1, 2)))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
if (CollUtil.isNotEmpty(channelI)) {
|
||||||
|
checkData = new PqScriptDtlsParam.CheckData();
|
||||||
|
checkData.setErrorFlag(channelListDTO.getErrorFlag());
|
||||||
|
checkData.setEnable(channelListDTO.getEnable());
|
||||||
|
//电压*电流*cos(电压角度-电流角度)
|
||||||
|
checkData.setValue(channelI.get(0).getFAmp() * listDTO.getFAmp() * Math.cos(listDTO.getFPhase() - channelI.get(0).getFPhase()));
|
||||||
|
setCheck(info, checkData, channelListDTO, checkArchive, listDTO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
case UNKNOWN_ERROR:
|
case UNKNOWN_ERROR:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -6,12 +6,12 @@ spring:
|
|||||||
datasource:
|
datasource:
|
||||||
druid:
|
druid:
|
||||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
url: jdbc:mysql://192.168.1.24:13306/pqs9100_2f?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=Asia/Shanghai
|
url: jdbc:mysql://192.168.1.24:13306/pqs9100?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=Asia/Shanghai
|
||||||
username: root
|
username: root
|
||||||
password: njcnpqs
|
password: njcnpqs
|
||||||
# url: jdbc:mysql://localhost:3306/pqs91001?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=CTT
|
# url: jdbc:mysql://localhost:3306/pqs91001?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=CTT
|
||||||
# username: root
|
# username: root
|
||||||
# password: root
|
# password: root
|
||||||
#初始化建立物理连接的个数、最小、最大连接数
|
#初始化建立物理连接的个数、最小、最大连接数
|
||||||
initial-size: 5
|
initial-size: 5
|
||||||
min-idle: 5
|
min-idle: 5
|
||||||
@@ -38,7 +38,7 @@ mybatis-plus:
|
|||||||
#配置sql日志输出
|
#配置sql日志输出
|
||||||
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||||
#关闭日志输出
|
#关闭日志输出
|
||||||
# log-impl: org.apache.ibatis.logging.nologging.NoLoggingImpl
|
# log-impl: org.apache.ibatis.logging.nologging.NoLoggingImpl
|
||||||
global-config:
|
global-config:
|
||||||
db-config:
|
db-config:
|
||||||
#指定主键生成策略
|
#指定主键生成策略
|
||||||
@@ -49,10 +49,10 @@ phaseAngle:
|
|||||||
|
|
||||||
socket:
|
socket:
|
||||||
source:
|
source:
|
||||||
ip: 192.168.1.138
|
ip: 127.0.0.1
|
||||||
port: 62000
|
port: 62000
|
||||||
device:
|
device:
|
||||||
ip: 192.168.1.138
|
ip: 127.0.0.1
|
||||||
port: 61000
|
port: 61000
|
||||||
# source:
|
# source:
|
||||||
# ip: 192.168.1.121
|
# ip: 192.168.1.121
|
||||||
@@ -62,7 +62,7 @@ socket:
|
|||||||
# port: 61000
|
# port: 61000
|
||||||
|
|
||||||
webSocket:
|
webSocket:
|
||||||
port: 7777
|
port: 7777
|
||||||
|
|
||||||
#源参数下发,暂态数据默认值
|
#源参数下发,暂态数据默认值
|
||||||
Dip:
|
Dip:
|
||||||
@@ -102,4 +102,9 @@ qr:
|
|||||||
path: /emmc/qrc.bin
|
path: /emmc/qrc.bin
|
||||||
|
|
||||||
db:
|
db:
|
||||||
type: mysql
|
type: mysql
|
||||||
|
|
||||||
|
detection:
|
||||||
|
xujy:
|
||||||
|
volOrCur: 6
|
||||||
|
phase: 3
|
||||||
@@ -2,9 +2,10 @@
|
|||||||
<configuration scan="true" scanPeriod="20 seconds" debug="false">
|
<configuration scan="true" scanPeriod="20 seconds" debug="false">
|
||||||
<include resource="org/springframework/boot/logging/logback/defaults.xml" />
|
<include resource="org/springframework/boot/logging/logback/defaults.xml" />
|
||||||
|
|
||||||
<springProperty scope="context" name="log.projectName" source="spring.application.name" defaultValue="entrance"/>
|
<!-- 直接使用固定配置,避免Spring配置解析时机问题 -->
|
||||||
<springProperty scope="context" name="logCommonLevel" source="log.commonLevel" defaultValue="info"/>
|
<property name="log.projectName" value="entrance"/>
|
||||||
<springProperty scope="context" name="logHomeDir" source="log.homeDir" defaultValue="D:\logs"/>
|
<property name="logCommonLevel" value="info"/>
|
||||||
|
<property name="logHomeDir" value="D:\logs"/>
|
||||||
|
|
||||||
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter" />
|
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter" />
|
||||||
<conversionRule conversionWord="wex"
|
<conversionRule conversionWord="wex"
|
||||||
|
|||||||
140
entrance/src/test/resources/logback-test.xml
Normal file
140
entrance/src/test/resources/logback-test.xml
Normal file
@@ -0,0 +1,140 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<configuration scan="true" scanPeriod="20 seconds" debug="false">
|
||||||
|
<include resource="org/springframework/boot/logging/logback/defaults.xml" />
|
||||||
|
|
||||||
|
<!-- 测试环境下明确指定日志配置,避免IS_UNDEFINED问题 -->
|
||||||
|
<property name="log.projectName" value="entrance"/>
|
||||||
|
<property name="logHomeDir" value="D:\logs"/>
|
||||||
|
<property name="logCommonLevel" value="info"/>
|
||||||
|
|
||||||
|
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter" />
|
||||||
|
<conversionRule conversionWord="wex"
|
||||||
|
converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter" />
|
||||||
|
<conversionRule conversionWord="ec"
|
||||||
|
converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter" />
|
||||||
|
|
||||||
|
|
||||||
|
<!--日志输出格式-->
|
||||||
|
<property name="log.pattern"
|
||||||
|
value="|-%d{yyyy-MM-dd HH:mm:ss.SSS} ${LOG_LEVEL_PATTERN:-%level} ${log.projectName} -- %t %logger{100}.%M ==> %m%n${Log_EXCEPTION_CONVERSION_WORD:-%ec}}}"/>
|
||||||
|
<property name="log.maxHistory" value="30"/>
|
||||||
|
|
||||||
|
<!--客户端输出日志-->
|
||||||
|
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
|
<encoder>
|
||||||
|
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
|
||||||
|
<charset>UTF-8</charset>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!--系统中常规的debug日志-->
|
||||||
|
<!-- 滚动记录文件,先将日志记录到指定文件,当符合某个条件时,将日志记录到其他文件 RollingFileAppender -->
|
||||||
|
<appender name="DEBUG" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>
|
||||||
|
${logHomeDir}/${log.projectName}/debug/debug.log
|
||||||
|
</file>
|
||||||
|
<!-- 如果日志级别等于配置级别,过滤器会根据onMath 和 onMismatch接收或拒绝日志。 -->
|
||||||
|
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||||
|
<!-- 设置过滤级别 -->
|
||||||
|
<level>DEBUG</level>
|
||||||
|
<!-- 用于配置符合过滤条件的操作 -->
|
||||||
|
<onMatch>ACCEPT</onMatch>
|
||||||
|
<!-- 用于配置不符合过滤条件的操作 -->
|
||||||
|
<onMismatch>DENY</onMismatch>
|
||||||
|
</filter>
|
||||||
|
<!-- 最常用的滚动策略,它根据时间来制定滚动策略.既负责滚动也负责触发滚动 SizeAndTimeBasedRollingPolicy-->
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||||
|
<!--日志输出位置 可相对、和绝对路径 -->
|
||||||
|
<fileNamePattern>
|
||||||
|
${logHomeDir}/${log.projectName}/debug/debug.log.%d{yyyy-MM-dd}.%i.log
|
||||||
|
</fileNamePattern>
|
||||||
|
<maxFileSize>10MB</maxFileSize>
|
||||||
|
<!-- 可选节点,控制保留的归档文件的最大数量,超出数量就删除旧文件,假设设置每个月滚动,且<maxHistory>是6,
|
||||||
|
则只保存最近6个月的文件,删除之前的旧文件。注意,删除旧文件是,那些为了归档而创建的目录也会被删除 -->
|
||||||
|
<maxHistory>${log.maxHistory:-30}</maxHistory>
|
||||||
|
<!--重启清理日志文件-->
|
||||||
|
<!-- <cleanHistoryOnStart>true</cleanHistoryOnStart>-->
|
||||||
|
<!--每个文件最多100MB,保留N天的历史记录,但最多20GB-->
|
||||||
|
<!--<totalSizeCap>20GB</totalSizeCap>-->
|
||||||
|
<!--日志文件最大的大小-->
|
||||||
|
<!--<MaxFileSize>${log.maxSize}</MaxFileSize>-->
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder>
|
||||||
|
<pattern>
|
||||||
|
${log.pattern}
|
||||||
|
</pattern>
|
||||||
|
<charset>UTF-8</charset>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!--系统中常规的info日志-->
|
||||||
|
<appender name="INFO" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||||
|
<level>INFO</level>
|
||||||
|
<onMatch>ACCEPT</onMatch>
|
||||||
|
<onMismatch>DENY</onMismatch>
|
||||||
|
</filter>
|
||||||
|
<file>
|
||||||
|
${logHomeDir}/${log.projectName}/info/info.log
|
||||||
|
</file>
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||||
|
<fileNamePattern>
|
||||||
|
${logHomeDir}/${log.projectName}/info/info.log.%d{yyyy-MM-dd}.%i.log
|
||||||
|
</fileNamePattern>
|
||||||
|
<maxFileSize>10MB</maxFileSize>
|
||||||
|
<maxHistory>${log.maxHistory:-30}</maxHistory>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||||
|
<pattern>
|
||||||
|
${log.pattern}
|
||||||
|
</pattern>
|
||||||
|
<charset>UTF-8</charset>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
|
||||||
|
<!--系统中常规的error日志-->
|
||||||
|
<appender name="ERROR" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>
|
||||||
|
${logHomeDir}/${log.projectName}/error/error.log
|
||||||
|
</file>
|
||||||
|
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||||
|
<level>ERROR</level>
|
||||||
|
<onMatch>ACCEPT</onMatch>
|
||||||
|
<onMismatch>DENY</onMismatch>
|
||||||
|
</filter>
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||||
|
<fileNamePattern>
|
||||||
|
${logHomeDir}/${log.projectName}/error/error.log.%d{yyyy-MM-dd}.%i.log
|
||||||
|
</fileNamePattern>
|
||||||
|
<maxFileSize>10MB</maxFileSize>
|
||||||
|
<maxHistory>${log.maxHistory:-30}</maxHistory>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||||
|
<pattern>
|
||||||
|
${log.pattern}
|
||||||
|
</pattern>
|
||||||
|
<charset>UTF-8</charset>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<logger name="org.apache.catalina.startup.DigesterFactory" level="ERROR"/>
|
||||||
|
<logger name="org.apache.catalina.util.LifecycleBase" level="ERROR"/>
|
||||||
|
<logger name="org.apache.coyote.http11.Http11NioProtocol" level="WARN"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<logger name="com.njcn" level="INFO" additivity="false">
|
||||||
|
<appender-ref ref="CONSOLE"/>
|
||||||
|
<appender-ref ref="DEBUG"/>
|
||||||
|
<appender-ref ref="INFO"/>
|
||||||
|
<appender-ref ref="ERROR"/>
|
||||||
|
</logger>
|
||||||
|
|
||||||
|
<root level="${logCommonLevel}">
|
||||||
|
<appender-ref ref="CONSOLE"/>
|
||||||
|
<appender-ref ref="DEBUG"/>
|
||||||
|
<appender-ref ref="INFO"/>
|
||||||
|
<appender-ref ref="ERROR"/>
|
||||||
|
</root>
|
||||||
|
</configuration>
|
||||||
@@ -18,6 +18,12 @@
|
|||||||
<version>0.0.1</version>
|
<version>0.0.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.njcn</groupId>
|
||||||
|
<artifactId>common-redis</artifactId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
<!-- <dependency>
|
<!-- <dependency>
|
||||||
<groupId>com.njcn</groupId>
|
<groupId>com.njcn</groupId>
|
||||||
|
|||||||
@@ -0,0 +1,68 @@
|
|||||||
|
package com.njcn.gather.event.devcie.config;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.njcn.gather.event.devcie.mapper.PqLineMapper;
|
||||||
|
import com.njcn.gather.event.devcie.pojo.po.PqLine;
|
||||||
|
import com.njcn.gather.event.devcie.pojo.po.PqsDeptsline;
|
||||||
|
import com.njcn.gather.event.devcie.service.PqsDeptslineService;
|
||||||
|
import com.njcn.gather.event.transientes.pojo.po.PqsDepts;
|
||||||
|
import com.njcn.gather.event.transientes.service.PqsDeptsService;
|
||||||
|
import com.njcn.redis.utils.RedisUtil;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
|
import javax.annotation.PreDestroy;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Description:
|
||||||
|
* Date: 2025/07/28 上午 9:32【需求编号】
|
||||||
|
*
|
||||||
|
* @author clam
|
||||||
|
* @version V1.0.0
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
@Slf4j
|
||||||
|
public class PqlineCache {
|
||||||
|
@Autowired
|
||||||
|
private PqLineMapper pqLineMapper;
|
||||||
|
@Autowired
|
||||||
|
private RedisUtil redisUtil;
|
||||||
|
@Autowired
|
||||||
|
private PqsDeptslineService pqsDeptslineService;
|
||||||
|
@Autowired
|
||||||
|
|
||||||
|
private PqsDeptsService pqsDeptsService;
|
||||||
|
private final static String NAME_KEY = "LineCache:";
|
||||||
|
@Value("${SYS_TYPE_ZT}")
|
||||||
|
private String sysTypeZt;
|
||||||
|
@PostConstruct
|
||||||
|
public void init() {
|
||||||
|
log.info("系统启动中。。。加载pqline");
|
||||||
|
List<PqLine> pqLines = pqLineMapper.selectList(null);
|
||||||
|
redisUtil.saveByKey(NAME_KEY + StrUtil.DASHED+"pqLineList",pqLines);
|
||||||
|
List<PqsDepts> list = pqsDeptsService.lambdaQuery().eq(PqsDepts::getState, 1).list();
|
||||||
|
for (PqsDepts pqsDepts : list) {
|
||||||
|
List<String> deptAndChildren = pqsDeptsService.findDeptAndChildren(pqsDepts.getDeptsIndex());
|
||||||
|
List<PqsDeptsline> deptslines = pqsDeptslineService.lambdaQuery().in(PqsDeptsline::getDeptsIndex, deptAndChildren).eq(PqsDeptsline::getSystype, sysTypeZt).list();
|
||||||
|
List<Integer> deptslineIds = deptslines.stream().map(PqsDeptsline::getLineIndex).collect(Collectors.toList());
|
||||||
|
redisUtil.saveByKey(NAME_KEY + StrUtil.DASHED+pqsDepts.getDeptsIndex(),deptslineIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreDestroy
|
||||||
|
public void destroy() {
|
||||||
|
log.info("系统运行结束");
|
||||||
|
redisUtil.deleteKeysByString(NAME_KEY);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
package com.njcn.gather.event.devcie.job;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.njcn.gather.event.devcie.mapper.PqLineMapper;
|
||||||
|
import com.njcn.gather.event.devcie.pojo.po.PqLine;
|
||||||
|
import com.njcn.gather.event.devcie.pojo.po.PqsDeptsline;
|
||||||
|
import com.njcn.gather.event.devcie.service.PqsDeptslineService;
|
||||||
|
import com.njcn.gather.event.transientes.pojo.po.PqsDepts;
|
||||||
|
import com.njcn.gather.event.transientes.service.PqsDeptsService;
|
||||||
|
import com.njcn.redis.utils.RedisUtil;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||||
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Description:
|
||||||
|
* Date: 2025/08/05 上午 10:17【需求编号】
|
||||||
|
*
|
||||||
|
* @author clam
|
||||||
|
* @version V1.0.0
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
@EnableScheduling
|
||||||
|
public class LineCacheJob {
|
||||||
|
@Autowired
|
||||||
|
private PqLineMapper pqLineMapper;
|
||||||
|
@Autowired
|
||||||
|
private RedisUtil redisUtil;
|
||||||
|
@Autowired
|
||||||
|
private PqsDeptslineService pqsDeptslineService;
|
||||||
|
@Autowired
|
||||||
|
|
||||||
|
private PqsDeptsService pqsDeptsService;
|
||||||
|
private final static String NAME_KEY = "LineCache:";
|
||||||
|
@Value("${SYS_TYPE_ZT}")
|
||||||
|
private String sysTypeZt;
|
||||||
|
@Scheduled(cron="0 0 1 * * ?" ) // 每3钟执行一次
|
||||||
|
public void lineCache(){
|
||||||
|
redisUtil.deleteKeysByString(NAME_KEY);
|
||||||
|
|
||||||
|
List<PqLine> pqLines = pqLineMapper.selectList(null);
|
||||||
|
redisUtil.saveByKey(NAME_KEY + StrUtil.DASHED+"pqLineList",pqLines);
|
||||||
|
List<PqsDepts> list = pqsDeptsService.lambdaQuery().eq(PqsDepts::getState, 1).list();
|
||||||
|
for (PqsDepts pqsDepts : list) {
|
||||||
|
List<String> deptAndChildren = pqsDeptsService.findDeptAndChildren(pqsDepts.getDeptsIndex());
|
||||||
|
List<PqsDeptsline> deptslines = pqsDeptslineService.lambdaQuery().in(PqsDeptsline::getDeptsIndex, deptAndChildren).eq(PqsDeptsline::getSystype, sysTypeZt).list();
|
||||||
|
List<Integer> deptslineIds = deptslines.stream().map(PqsDeptsline::getLineIndex).collect(Collectors.toList());
|
||||||
|
redisUtil.saveByKey(NAME_KEY + StrUtil.DASHED+pqsDepts.getDeptsIndex(),deptslineIds);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.njcn.gather.event.devcie.mapper;
|
package com.njcn.gather.event.devcie.mapper;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.njcn.gather.event.devcie.pojo.dto.DeviceDTO;
|
import com.njcn.gather.event.devcie.pojo.dto.DeviceDTO;
|
||||||
import com.njcn.gather.event.devcie.pojo.po.PqDevice;
|
import com.njcn.gather.event.devcie.pojo.po.PqDevice;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
@@ -17,4 +18,10 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public interface PqDeviceMapper extends BaseMapper<PqDevice> {
|
public interface PqDeviceMapper extends BaseMapper<PqDevice> {
|
||||||
List<DeviceDTO> queryListByIds(@Param("ids") List<Integer> ids);
|
List<DeviceDTO> queryListByIds(@Param("ids") List<Integer> ids);
|
||||||
|
|
||||||
|
Page<DeviceDTO> selectDeviceDTOPage(Page<DeviceDTO> pqsEventdetailPage, @Param("searchValue") String searchValue,@Param("devIndexs") List<Integer> devIndexs, @Param("state") String state);
|
||||||
|
|
||||||
|
Page<DeviceDTO> queryListByLineIds(Page<DeviceDTO> pqsEventdetailPage, @Param("searchValue") String searchValue,@Param("lineIds") List<Integer> lineIds);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -35,6 +35,7 @@
|
|||||||
pq_device.UpdateTime updateTime,
|
pq_device.UpdateTime updateTime,
|
||||||
pq_device.DevFlag devFlag,
|
pq_device.DevFlag devFlag,
|
||||||
pq_device.IP ip,
|
pq_device.IP ip,
|
||||||
|
pq_device.status status,
|
||||||
PQ_SUBSTATION.sub_index stationId,
|
PQ_SUBSTATION.sub_index stationId,
|
||||||
PQ_SUBSTATION.name stationName,
|
PQ_SUBSTATION.name stationName,
|
||||||
PQ_GDINFORMATION.Name gdName
|
PQ_GDINFORMATION.Name gdName
|
||||||
@@ -50,4 +51,87 @@
|
|||||||
#{item}
|
#{item}
|
||||||
</foreach>
|
</foreach>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectDeviceDTOPage" resultType="com.njcn.gather.event.devcie.pojo.dto.DeviceDTO">
|
||||||
|
select
|
||||||
|
DISTINCT pq_device.dev_index devId,
|
||||||
|
pq_device.name devName,
|
||||||
|
pq_device.UpdateTime updateTime,
|
||||||
|
pq_device.DevFlag devFlag,
|
||||||
|
pq_device.IP ip,
|
||||||
|
pq_device.status status,
|
||||||
|
PQ_SUBSTATION.sub_index stationId,
|
||||||
|
PQ_SUBSTATION.name stationName,
|
||||||
|
PQ_GDINFORMATION.Name gdName,
|
||||||
|
PQS_DICDATA.DIC_Name MANUFACTURER_Name,
|
||||||
|
PQ_DEVICEDETAIL.ThisTimeCheck thisTimeCheck,
|
||||||
|
PQ_DEVICEDETAIL.NextTimeCheck nextTimeCheck,
|
||||||
|
pq_device.LogonTime logonTime,
|
||||||
|
PQS_DEPTS.DEPTSNAME deptName
|
||||||
|
from
|
||||||
|
PQ_DEVICE,
|
||||||
|
PQ_SUBSTATION,
|
||||||
|
PQ_GDINFORMATION,
|
||||||
|
PQ_DEVICEDETAIL,
|
||||||
|
PQS_DICDATA,
|
||||||
|
PQ_LINE,
|
||||||
|
PQS_DEPTS,
|
||||||
|
PQS_DEPTSLINE
|
||||||
|
where
|
||||||
|
pq_device.SUB_INDEX = PQ_SUBSTATION.SUB_INDEX
|
||||||
|
and pq_device.GD_INDEX =PQ_GDINFORMATION.GD_INDEX
|
||||||
|
and PQ_DEVICEDETAIL.dev_index =pq_device.dev_index
|
||||||
|
and PQ_DEVICEDETAIL.MANUFACTURER = PQS_DICDATA.DIC_INDEX
|
||||||
|
and PQ_LINE.DEV_INDEX = PQ_DEVICE.DEV_INDEX
|
||||||
|
and PQ_LINE.LINE_INDEX = PQS_DEPTSLINE.LINE_INDEX
|
||||||
|
and PQS_DEPTSLINE.DEPTS_INDEX=PQS_DEPTS.DEPTS_INDEX
|
||||||
|
<if test="searchValue!= null and searchValue!= ''">
|
||||||
|
AND (
|
||||||
|
pq_device.name LIKE '%' || #{searchValue} || '%'
|
||||||
|
OR PQ_SUBSTATION.name LIKE '%' || #{searchValue} || '%'
|
||||||
|
OR PQ_GDINFORMATION.Name LIKE '%' || #{searchValue} || '%'
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
<if test="state!= null and state!= ''">
|
||||||
|
and pq_device.status = #{state}
|
||||||
|
</if>
|
||||||
|
and pq_device.DEV_INDEX in
|
||||||
|
<foreach collection="devIndexs" item="item" open="(" close=")" separator=",">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
order by pq_device.updatetime
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<select id="queryListByLineIds" resultType="com.njcn.gather.event.devcie.pojo.dto.DeviceDTO">
|
||||||
|
select distinct
|
||||||
|
pq_device.dev_index devId,
|
||||||
|
pq_device.name devName,
|
||||||
|
pq_device.UpdateTime updateTime,
|
||||||
|
pq_device.DevFlag devFlag,
|
||||||
|
pq_device.IP ip,
|
||||||
|
pq_device.status status,
|
||||||
|
PQ_SUBSTATION.sub_index stationId,
|
||||||
|
PQ_SUBSTATION.name stationName,
|
||||||
|
PQ_GDINFORMATION.Name gdName,
|
||||||
|
PQS_DICDATA.DIC_Name MANUFACTURER_Name
|
||||||
|
from
|
||||||
|
pq_line,
|
||||||
|
pq_device,
|
||||||
|
PQ_DEVICEDETAIL,
|
||||||
|
PQ_SUBSTATION,
|
||||||
|
PQ_GDINFORMATION,
|
||||||
|
PQS_DICDATA
|
||||||
|
where
|
||||||
|
pq_line.DEV_INDEX = pq_device.DEV_INDEX
|
||||||
|
and PQ_DEVICEDETAIL.dev_index =pq_device.dev_index
|
||||||
|
and pq_device.SUB_INDEX = PQ_SUBSTATION.SUB_INDEX
|
||||||
|
and pq_device.GD_INDEX =PQ_GDINFORMATION.GD_INDEX
|
||||||
|
and PQ_DEVICEDETAIL.MANUFACTURER = PQS_DICDATA.DIC_INDEX
|
||||||
|
and pq_line.LINE_INDEX in
|
||||||
|
<foreach collection="lineIds" item="item" open="(" close=")" separator=",">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -31,6 +31,8 @@
|
|||||||
|
|
||||||
<select id="getBaseLineInfo" resultType="com.njcn.gather.event.devcie.pojo.dto.LedgerBaseInfoDTO">
|
<select id="getBaseLineInfo" resultType="com.njcn.gather.event.devcie.pojo.dto.LedgerBaseInfoDTO">
|
||||||
select
|
select
|
||||||
|
PQ_GDINFORMATION.name gdName,
|
||||||
|
pq_line.GD_INDEX gdIndex,
|
||||||
pq_line.line_index lineId,
|
pq_line.line_index lineId,
|
||||||
pq_line.name lineName,
|
pq_line.name lineName,
|
||||||
PQ_LINEDETAIL.objname objName,
|
PQ_LINEDETAIL.objname objName,
|
||||||
@@ -46,11 +48,13 @@
|
|||||||
PQ_LINEDETAIL,
|
PQ_LINEDETAIL,
|
||||||
PQ_SUBVOLTAGE,
|
PQ_SUBVOLTAGE,
|
||||||
pq_device,
|
pq_device,
|
||||||
PQ_SUBSTATION
|
PQ_SUBSTATION,
|
||||||
|
PQ_GDINFORMATION
|
||||||
where pq_line.line_index = PQ_LINEDETAIL.line_index
|
where pq_line.line_index = PQ_LINEDETAIL.line_index
|
||||||
and pq_line.SUBV_INDEX = PQ_SUBVOLTAGE.SUBV_INDEX
|
and pq_line.SUBV_INDEX = PQ_SUBVOLTAGE.SUBV_INDEX
|
||||||
and PQ_SUBVOLTAGE.DEV_INDEX = pq_device.DEV_INDEX
|
and PQ_SUBVOLTAGE.DEV_INDEX = pq_device.DEV_INDEX
|
||||||
and pq_device.SUB_INDEX = PQ_SUBSTATION.SUB_INDEX
|
and pq_device.SUB_INDEX = PQ_SUBSTATION.SUB_INDEX
|
||||||
|
and pq_line.GD_INDEX =PQ_GDINFORMATION.GD_INDEX
|
||||||
and pq_line.line_index in
|
and pq_line.line_index in
|
||||||
<foreach collection="ids" item="item" open="(" close=")" separator=",">
|
<foreach collection="ids" item="item" open="(" close=")" separator=",">
|
||||||
#{item}
|
#{item}
|
||||||
|
|||||||
@@ -18,12 +18,17 @@
|
|||||||
select
|
select
|
||||||
PQ_SUBSTATION.sub_index stationId,
|
PQ_SUBSTATION.sub_index stationId,
|
||||||
PQ_SUBSTATION.name stationName,
|
PQ_SUBSTATION.name stationName,
|
||||||
PQ_GDINFORMATION.Name gdName
|
PQ_GDINFORMATION.Name gdName,
|
||||||
|
PQS_MAP.LATITUDE LATITUDE,
|
||||||
|
PQS_MAP.LONGITUDE LONGITUDE
|
||||||
from
|
from
|
||||||
PQ_SUBSTATION,
|
PQ_SUBSTATION left join
|
||||||
PQ_GDINFORMATION
|
PQS_MAP on PQ_SUBSTATION.SUB_INDEX =PQS_MAP.SUB_INDEX
|
||||||
|
left join
|
||||||
|
PQ_GDINFORMATION on PQ_SUBSTATION.GD_INDEX =PQ_GDINFORMATION.GD_INDEX
|
||||||
|
|
||||||
where
|
where
|
||||||
PQ_SUBSTATION.GD_INDEX =PQ_GDINFORMATION.GD_INDEX
|
PQS_MAP.state=1
|
||||||
and PQ_SUBSTATION.SUB_INDEX in
|
and PQ_SUBSTATION.SUB_INDEX in
|
||||||
<foreach collection="ids" item="item" open="(" close=")" separator=",">
|
<foreach collection="ids" item="item" open="(" close=")" separator=",">
|
||||||
#{item}
|
#{item}
|
||||||
|
|||||||
@@ -23,6 +23,21 @@ public class DeviceDTO {
|
|||||||
private LocalDateTime updateTime;
|
private LocalDateTime updateTime;
|
||||||
private String devFlag;
|
private String devFlag;
|
||||||
private String ip;
|
private String ip;
|
||||||
|
private String manufacturerName;
|
||||||
|
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private LocalDateTime thisTimeCheck;
|
||||||
|
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private LocalDateTime nextTimeCheck;
|
||||||
|
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private LocalDateTime logonTime;
|
||||||
|
|
||||||
|
private String deptName;
|
||||||
//通讯状态
|
//通讯状态
|
||||||
private Integer runFlag=0;
|
private Integer runFlag=0;
|
||||||
|
//装置通讯状态(0:中断;1:正常)
|
||||||
|
private Integer status;
|
||||||
|
private double onLineRate=0.00;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ import lombok.Data;
|
|||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class LedgerBaseInfoDTO {
|
public class LedgerBaseInfoDTO {
|
||||||
|
private String gdName;
|
||||||
|
private String gdIndex;
|
||||||
|
|
||||||
private Integer lineId;
|
private Integer lineId;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,73 @@
|
|||||||
|
package com.njcn.gather.event.devcie.pojo.dto;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Description:
|
||||||
|
* Date: 2025/07/29 下午 3:15【需求编号】
|
||||||
|
*
|
||||||
|
* @author clam
|
||||||
|
* @version V1.0.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class PqsDeptDTO {
|
||||||
|
/**
|
||||||
|
* 部门表Guid
|
||||||
|
*/
|
||||||
|
private String deptsIndex;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门名称
|
||||||
|
*/
|
||||||
|
|
||||||
|
private String deptsname;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 排序
|
||||||
|
*/
|
||||||
|
|
||||||
|
private Integer deptsDesc;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* (关联表PQS_User)用户表Guid
|
||||||
|
*/
|
||||||
|
|
||||||
|
private String userIndex;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
|
||||||
|
private LocalDateTime updatetime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门描述
|
||||||
|
*/
|
||||||
|
|
||||||
|
private String deptsDescription;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 角色状态0:删除;1:正常;
|
||||||
|
*/
|
||||||
|
|
||||||
|
private Integer state;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 行政区域
|
||||||
|
*/
|
||||||
|
|
||||||
|
private String area;
|
||||||
|
|
||||||
|
private String areaName;
|
||||||
|
|
||||||
|
|
||||||
|
private Integer customDept;
|
||||||
|
|
||||||
|
|
||||||
|
private String parentnodeid;
|
||||||
|
}
|
||||||
@@ -15,6 +15,8 @@ public class SubstationDTO {
|
|||||||
private Integer stationId;
|
private Integer stationId;
|
||||||
private String stationName;
|
private String stationName;
|
||||||
private String gdName;
|
private String gdName;
|
||||||
|
private double longitude;
|
||||||
|
private double latitude;
|
||||||
private Integer runFlag=0;;
|
private Integer runFlag=0;;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ public class PqDevice {
|
|||||||
* 靠靠靠(0:靠;1:靠)
|
* 靠靠靠(0:靠;1:靠)
|
||||||
*/
|
*/
|
||||||
@TableField(value = "\"STATUS\"")
|
@TableField(value = "\"STATUS\"")
|
||||||
private Short status;
|
private Integer status;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* (靠縋QS_Dicdata)靠靠Guid
|
* (靠縋QS_Dicdata)靠靠Guid
|
||||||
@@ -87,7 +87,7 @@ public class PqDevice {
|
|||||||
* 靠靠(0:靠;1:靠;2:靠)
|
* 靠靠(0:靠;1:靠;2:靠)
|
||||||
*/
|
*/
|
||||||
@TableField(value = "DEVFLAG")
|
@TableField(value = "DEVFLAG")
|
||||||
private Short devflag;
|
private Integer devflag;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 靠靠?靠3ds靠
|
* 靠靠?靠3ds靠
|
||||||
@@ -111,17 +111,17 @@ public class PqDevice {
|
|||||||
* 靠靠(0:靠靠;1:靠靠)
|
* 靠靠(0:靠靠;1:靠靠)
|
||||||
*/
|
*/
|
||||||
@TableField(value = "DEVMODEL")
|
@TableField(value = "DEVMODEL")
|
||||||
private Short devmodel;
|
private Integer devmodel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 靠靠?
|
* 靠靠?
|
||||||
*/
|
*/
|
||||||
@TableField(value = "CALLFLAG")
|
@TableField(value = "CALLFLAG")
|
||||||
private Short callflag;
|
private Integer callflag;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 靠靠(0:靠靠;1:靠靠;2:靠靠)
|
* 靠靠(0:靠靠;1:靠靠;2:靠靠)
|
||||||
*/
|
*/
|
||||||
@TableField(value = "DATATYPE")
|
@TableField(value = "DATATYPE")
|
||||||
private Short datatype;
|
private Integer datatype;
|
||||||
}
|
}
|
||||||
@@ -110,7 +110,7 @@ public class PqLine {
|
|||||||
* 靠?靠靠靠靠靠靠?
|
* 靠?靠靠靠靠靠靠?
|
||||||
*/
|
*/
|
||||||
@TableField(value = "SUBV_NO")
|
@TableField(value = "SUBV_NO")
|
||||||
private Short subvNo;
|
private Integer subvNo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* (靠PQS_Dictionary?靠靠Guid
|
* (靠PQS_Dictionary?靠靠Guid
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.njcn.gather.event.devcie.service;
|
package com.njcn.gather.event.devcie.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.njcn.gather.event.devcie.pojo.dto.DeviceDTO;
|
import com.njcn.gather.event.devcie.pojo.dto.DeviceDTO;
|
||||||
import com.njcn.gather.event.devcie.pojo.dto.LedgerBaseInfoDTO;
|
|
||||||
import com.njcn.gather.event.devcie.pojo.po.PqDevice;
|
import com.njcn.gather.event.devcie.pojo.po.PqDevice;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
@@ -18,4 +18,6 @@ import java.util.List;
|
|||||||
public interface PqDeviceService extends IService<PqDevice>{
|
public interface PqDeviceService extends IService<PqDevice>{
|
||||||
|
|
||||||
List<DeviceDTO> queryListByIds(List<Integer> lineIds);
|
List<DeviceDTO> queryListByIds(List<Integer> lineIds);
|
||||||
|
|
||||||
|
Page<DeviceDTO> selectDeviceDTOPage(Page<DeviceDTO> pqsEventdetailPage, String searchValue, List<Integer> devIndexs, String state);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
package com.njcn.gather.event.devcie.service.impl;
|
package com.njcn.gather.event.devcie.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.njcn.gather.event.devcie.pojo.dto.DeviceDTO;
|
import com.njcn.gather.event.devcie.pojo.dto.DeviceDTO;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.njcn.gather.event.devcie.pojo.po.PqDevice;
|
import com.njcn.gather.event.devcie.pojo.po.PqDevice;
|
||||||
@@ -23,4 +24,9 @@ public class PqDeviceServiceImpl extends ServiceImpl<PqDeviceMapper, PqDevice> i
|
|||||||
public List<DeviceDTO> queryListByIds(List<Integer> lineIds) {
|
public List<DeviceDTO> queryListByIds(List<Integer> lineIds) {
|
||||||
return this.baseMapper.queryListByIds(lineIds);
|
return this.baseMapper.queryListByIds(lineIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Page<DeviceDTO> selectDeviceDTOPage(Page<DeviceDTO> pqsEventdetailPage, String searchValue, List<Integer> devIndexs, String state) {
|
||||||
|
return this.baseMapper.selectDeviceDTOPage(pqsEventdetailPage,searchValue,devIndexs,state);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil;
|
|||||||
import cn.hutool.core.date.DatePattern;
|
import cn.hutool.core.date.DatePattern;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.json.JSONObject;
|
import cn.hutool.json.JSONObject;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||||
@@ -16,6 +17,8 @@ import com.njcn.gather.event.devcie.pojo.dto.LedgerBaseInfoDTO;
|
|||||||
import com.njcn.gather.event.devcie.pojo.po.PqLine;
|
import com.njcn.gather.event.devcie.pojo.po.PqLine;
|
||||||
import com.njcn.gather.event.devcie.pojo.po.PqsDeptsline;
|
import com.njcn.gather.event.devcie.pojo.po.PqsDeptsline;
|
||||||
import com.njcn.gather.event.devcie.service.PqsDeptslineService;
|
import com.njcn.gather.event.devcie.service.PqsDeptslineService;
|
||||||
|
import com.njcn.gather.event.transientes.mapper.PqUserLedgerMapper;
|
||||||
|
import com.njcn.gather.event.transientes.mapper.PqUserLineAssMapper;
|
||||||
import com.njcn.gather.event.transientes.pojo.param.MonitorTerminalParam;
|
import com.njcn.gather.event.transientes.pojo.param.MonitorTerminalParam;
|
||||||
import com.njcn.gather.event.transientes.pojo.param.SimulationMsgParam;
|
import com.njcn.gather.event.transientes.pojo.param.SimulationMsgParam;
|
||||||
import com.njcn.gather.event.transientes.pojo.po.*;
|
import com.njcn.gather.event.transientes.pojo.po.*;
|
||||||
@@ -55,6 +58,8 @@ import java.util.stream.Stream;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class EventGateController extends BaseController {
|
public class EventGateController extends BaseController {
|
||||||
private final MsgEventInfoServiceImpl msgEventInfoServiceImpl;
|
private final MsgEventInfoServiceImpl msgEventInfoServiceImpl;
|
||||||
|
private final PqUserLineAssMapper pqUserLineAssMapper;
|
||||||
|
private final PqUserLedgerMapper pqUserLedgerMapper;
|
||||||
@Value("${SYS_TYPE_ZT}")
|
@Value("${SYS_TYPE_ZT}")
|
||||||
private String sysTypeZt;
|
private String sysTypeZt;
|
||||||
|
|
||||||
@@ -90,15 +95,65 @@ public class EventGateController extends BaseController {
|
|||||||
JSONObject jsonObject;
|
JSONObject jsonObject;
|
||||||
try {
|
try {
|
||||||
//下面一行代码正式环境需要放开
|
//下面一行代码正式环境需要放开
|
||||||
//jsonObject = new JSONObject(msg);
|
jsonObject = new JSONObject(msg);
|
||||||
|
//下面一行代码正式环境需要放开
|
||||||
|
//jsonObject = test();
|
||||||
|
|
||||||
|
if (msgEventConfigService.getEventType().contains(jsonObject.get("wavetype").toString())) {
|
||||||
|
//过滤重要暂降事件
|
||||||
|
Integer lineId = Integer.valueOf(jsonObject.get("lineid").toString());
|
||||||
|
List<PqUserLineAssPO> assList = pqUserLineAssMapper.selectList(new LambdaQueryWrapper<PqUserLineAssPO>().eq(PqUserLineAssPO::getLineIndex,lineId));
|
||||||
|
|
||||||
|
String str ="/";
|
||||||
|
if(CollUtil.isNotEmpty(assList)){
|
||||||
|
List<String> userIds = assList.stream().map(PqUserLineAssPO::getUserIndex).distinct().collect(Collectors.toList());
|
||||||
|
List<PqUserLedgerPO> poList = pqUserLedgerMapper.selectList(new LambdaQueryWrapper<PqUserLedgerPO>().select(PqUserLedgerPO::getId,PqUserLedgerPO::getCustomerName).in(PqUserLedgerPO::getId,userIds));
|
||||||
|
str = poList.stream().map(PqUserLedgerPO::getCustomerName).collect(Collectors.joining(StrUtil.COMMA));
|
||||||
|
}
|
||||||
|
jsonObject.put("objName",str);
|
||||||
|
webSocketServer.sendMessageToAll(jsonObject.toString());
|
||||||
|
|
||||||
|
//开始发送短信
|
||||||
|
/* try {
|
||||||
|
sendMessage(jsonObject);
|
||||||
|
}catch (Exception e){
|
||||||
|
log.error("短信组装发送失败!失败原因{}",e.getMessage());
|
||||||
|
}*/
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("暂降json格式异常!{}", e.getMessage());
|
||||||
|
}
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@OperateInfo
|
||||||
|
@GetMapping("/testEvent")
|
||||||
|
@ApiOperation("接收远程推送的暂态事件")
|
||||||
|
public HttpResult<Object> testEvent() {
|
||||||
|
String methodDescribe = getMethodDescribe("testEvent");
|
||||||
|
log.info("模拟测试发送暂降事件-------------------------");
|
||||||
|
|
||||||
|
JSONObject jsonObject;
|
||||||
|
try {
|
||||||
//下面一行代码正式环境需要放开
|
//下面一行代码正式环境需要放开
|
||||||
jsonObject = test();
|
jsonObject = test();
|
||||||
|
|
||||||
if (msgEventConfigService.getEventType().contains(jsonObject.get("wavetype").toString())) {
|
if (msgEventConfigService.getEventType().contains(jsonObject.get("wavetype").toString())) {
|
||||||
webSocketServer.sendMessageToAll(jsonObject.toString());
|
webSocketServer.sendMessageToAll(jsonObject.toString());
|
||||||
|
|
||||||
|
//开始发送短信
|
||||||
|
try {
|
||||||
|
sendMessage(jsonObject);
|
||||||
|
}catch (Exception e){
|
||||||
|
log.error("短信组装发送失败!失败原因{}",e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
//开始发送短信
|
|
||||||
sendMessage(jsonObject);
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("暂降json格式异常!{}", e.getMessage());
|
log.error("暂降json格式异常!{}", e.getMessage());
|
||||||
}
|
}
|
||||||
@@ -142,12 +197,8 @@ public class EventGateController extends BaseController {
|
|||||||
Integer[] temArr = new Integer[]{1, 3};
|
Integer[] temArr = new Integer[]{1, 3};
|
||||||
Integer wave = random.nextInt(2);
|
Integer wave = random.nextInt(2);
|
||||||
|
|
||||||
double min = 0.5;
|
|
||||||
double max = 10.0;
|
|
||||||
|
|
||||||
// 生成 (0.5, 10.0) 范围内的随机小数
|
Double per = (double)random.nextInt(5000);
|
||||||
Double perTem = min + (max - min) * Math.random();
|
|
||||||
Double per = new BigDecimal(perTem).setScale(2, RoundingMode.HALF_UP).doubleValue();
|
|
||||||
|
|
||||||
double minV = 0.1;
|
double minV = 0.1;
|
||||||
double maxV = 0.9;
|
double maxV = 0.9;
|
||||||
@@ -169,11 +220,11 @@ public class EventGateController extends BaseController {
|
|||||||
tem.set("bdname", dto.getStationName());
|
tem.set("bdname", dto.getStationName());
|
||||||
tem.set("pointname", dto.getLineName());
|
tem.set("pointname", dto.getLineName());
|
||||||
|
|
||||||
PqsEventdetail pqsEventdetail = createEvent(tem, now);
|
/* PqsEventdetail pqsEventdetail = createEvent(tem, now);
|
||||||
if (msgEventConfigService.getEventType().contains(tem.get("wavetype").toString())) {
|
if (msgEventConfigService.getEventType().contains(tem.get("wavetype").toString())) {
|
||||||
webSocketServer.sendMessageToAll(tem.toString());
|
webSocketServer.sendMessageToAll(tem.toString());
|
||||||
}
|
}
|
||||||
pqsEventdetailService.save(pqsEventdetail);
|
pqsEventdetailService.save(pqsEventdetail);*/
|
||||||
/*----------------------------------------------------------------------------------------*/
|
/*----------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
return tem;
|
return tem;
|
||||||
@@ -199,7 +250,7 @@ public class EventGateController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void sendMessage(JSONObject jsonObject) {
|
private void sendMessage(JSONObject jsonObject) throws Exception{
|
||||||
Integer lineId = Integer.valueOf(jsonObject.get("lineid").toString());
|
Integer lineId = Integer.valueOf(jsonObject.get("lineid").toString());
|
||||||
List<PqsDeptsline> pqLineDept = pqsDeptslineService.lambdaQuery().eq(PqsDeptsline::getLineIndex, lineId).eq(PqsDeptsline::getSystype, sysTypeZt).list();
|
List<PqsDeptsline> pqLineDept = pqsDeptslineService.lambdaQuery().eq(PqsDeptsline::getLineIndex, lineId).eq(PqsDeptsline::getSystype, sysTypeZt).list();
|
||||||
Set<String> deptIds = pqLineDept.stream().map(PqsDeptsline::getDeptsIndex).collect(Collectors.toSet());
|
Set<String> deptIds = pqLineDept.stream().map(PqsDeptsline::getDeptsIndex).collect(Collectors.toSet());
|
||||||
|
|||||||
@@ -0,0 +1,106 @@
|
|||||||
|
package com.njcn.gather.event.transientes.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.date.DatePattern;
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import cn.hutool.json.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||||
|
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||||
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
|
import com.njcn.event.file.pojo.dto.WaveDataDTO;
|
||||||
|
import com.njcn.gather.event.devcie.mapper.PqLineMapper;
|
||||||
|
import com.njcn.gather.event.devcie.pojo.dto.DeviceDTO;
|
||||||
|
import com.njcn.gather.event.devcie.pojo.dto.LedgerBaseInfoDTO;
|
||||||
|
import com.njcn.gather.event.devcie.pojo.po.PqLine;
|
||||||
|
import com.njcn.gather.event.devcie.pojo.po.PqsDeptsline;
|
||||||
|
import com.njcn.gather.event.devcie.service.PqsDeptslineService;
|
||||||
|
import com.njcn.gather.event.transientes.pojo.param.LargeScreenCountParam;
|
||||||
|
import com.njcn.gather.event.transientes.pojo.param.MonitorTerminalParam;
|
||||||
|
import com.njcn.gather.event.transientes.pojo.param.SimulationMsgParam;
|
||||||
|
import com.njcn.gather.event.transientes.pojo.po.*;
|
||||||
|
import com.njcn.gather.event.transientes.pojo.vo.EventDetailVO;
|
||||||
|
import com.njcn.gather.event.transientes.pojo.vo.UserLedgerStatisticVO;
|
||||||
|
import com.njcn.gather.event.transientes.service.*;
|
||||||
|
import com.njcn.gather.event.transientes.service.impl.MsgEventInfoServiceImpl;
|
||||||
|
import com.njcn.gather.event.transientes.websocket.WebSocketServer;
|
||||||
|
import com.njcn.web.controller.BaseController;
|
||||||
|
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.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.math.RoundingMode;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: cdf
|
||||||
|
* @CreateTime: 2025-06-23
|
||||||
|
* @Description:
|
||||||
|
*/
|
||||||
|
@Api(tags = "暂降接收")
|
||||||
|
@RequestMapping("right")
|
||||||
|
@RestController
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Slf4j
|
||||||
|
public class EventRightController extends BaseController {
|
||||||
|
|
||||||
|
private final EventRightService eventRightService;
|
||||||
|
|
||||||
|
|
||||||
|
@OperateInfo
|
||||||
|
@PostMapping("/rightEvent")
|
||||||
|
@ApiOperation("右侧表头")
|
||||||
|
@ApiImplicitParam(name = "largeScreenCountParam", value = "", required = true)
|
||||||
|
public HttpResult<Object> rightEvent(@RequestBody LargeScreenCountParam largeScreenCountParam) {
|
||||||
|
String methodDescribe = getMethodDescribe("rightEvent");
|
||||||
|
UserLedgerStatisticVO userLedgerStatisticVO = eventRightService.userLedgerStatistic(largeScreenCountParam);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, userLedgerStatisticVO, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@OperateInfo
|
||||||
|
@PostMapping("/rightImportUser")
|
||||||
|
@ApiOperation("右侧重要用户")
|
||||||
|
@ApiImplicitParam(name = "largeScreenCountParam", value = "", required = true)
|
||||||
|
public HttpResult<Object> rightImportUser(@RequestBody LargeScreenCountParam largeScreenCountParam) {
|
||||||
|
String methodDescribe = getMethodDescribe("rightImportUser");
|
||||||
|
List<UserLedgerStatisticVO.Inner> result = eventRightService.rightImportUser(largeScreenCountParam);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
@OperateInfo
|
||||||
|
@PostMapping("/rightEventOpen")
|
||||||
|
@ApiOperation("右侧表头点击事件")
|
||||||
|
@ApiImplicitParam(name = "largeScreenCountParam", value = "", required = true)
|
||||||
|
public HttpResult<Object> rightEventOpen(@RequestBody LargeScreenCountParam largeScreenCountParam) {
|
||||||
|
String methodDescribe = getMethodDescribe("rightEventOpen");
|
||||||
|
Page<EventDetailVO> page = eventRightService.rightEventOpen(largeScreenCountParam);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@OperateInfo
|
||||||
|
@PostMapping("/rightEventDevOpen")
|
||||||
|
@ApiOperation("右侧表头终端点击事件")
|
||||||
|
@ApiImplicitParam(name = "largeScreenCountParam", value = "", required = true)
|
||||||
|
public HttpResult<Object> rightEventDevOpen(@RequestBody LargeScreenCountParam largeScreenCountParam) {
|
||||||
|
String methodDescribe = getMethodDescribe("rightEventDevOpen");
|
||||||
|
Page<DeviceDTO> page = eventRightService.rightEventDevOpen(largeScreenCountParam);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user