微调
This commit is contained in:
@@ -1122,105 +1122,111 @@ public class SocketDevResponseService {
|
||||
|
||||
switch (Objects.requireNonNull(dictDataEnumByCode)) {
|
||||
case SUCCESS:
|
||||
FormalTestManager.realDataXiList.add(devData);
|
||||
successComm.add(devData.getId());
|
||||
if (devData.getResult()) {
|
||||
FormalTestManager.realDataXiList.add(devData);
|
||||
successComm.add(devData.getId());
|
||||
|
||||
if (SocketManager.clockMap.containsKey(sourceIssue.getIndex())) {
|
||||
SocketManager.clockMap.put(sourceIssue.getIndex(), 0L);
|
||||
}
|
||||
if (SocketManager.clockMap.containsKey(sourceIssue.getIndex())) {
|
||||
SocketManager.clockMap.put(sourceIssue.getIndex(), 0L);
|
||||
}
|
||||
|
||||
if (successComm.size() == FormalTestManager.monitorIdListComm.size()) {
|
||||
System.out.println(sourceIssue.getType() + splitTag + sourceIssue.getIndex() + "当前测试小项读取数据已经全部结束。。。。。。。。。");
|
||||
//修改装置为监测中
|
||||
if (successComm.size() == FormalTestManager.monitorIdListComm.size()) {
|
||||
System.out.println(sourceIssue.getType() + splitTag + sourceIssue.getIndex() + "当前测试小项读取数据已经全部结束。。。。。。。。。");
|
||||
//修改装置为监测中
|
||||
// adPlanService.updateTestState(param.getPlanId(), param.getDevIds());
|
||||
//开启线程进行入库原始数据操作
|
||||
baseDataInsert(FormalTestManager.realDataXiList, sourceIssue, param, SocketManager.valueTypeMap);
|
||||
//开启线程进行入库原始数据操作
|
||||
baseDataInsert(FormalTestManager.realDataXiList, sourceIssue, param, SocketManager.valueTypeMap);
|
||||
|
||||
//调用判断方法
|
||||
Map<String, Integer> textResult = detectionServiceImpl.processing(FormalTestManager.realDataXiList, param, FormalTestManager.devIdMapComm, sourceIssue, dataRule);
|
||||
//调用判断方法
|
||||
Map<String, Integer> textResult = detectionServiceImpl.processing(FormalTestManager.realDataXiList, param, FormalTestManager.devIdMapComm, sourceIssue, dataRule);
|
||||
|
||||
System.out.println(textResult);
|
||||
//组装实体推送给前台
|
||||
assWebJson(param, textResult, socketDataMsg, sourceIssue);
|
||||
System.out.println(textResult);
|
||||
//组装实体推送给前台
|
||||
assWebJson(param, textResult, socketDataMsg, sourceIssue);
|
||||
|
||||
//当小项结束后需要删除集合中的小项
|
||||
SocketManager.delSource(sourceIssue.getIndex());
|
||||
System.out.println("当前小项结束进行删除============" + sourceIssue.getType() + splitTag + sourceIssue.getIndex());
|
||||
//当小项结束后需要删除集合中的小项
|
||||
SocketManager.delSource(sourceIssue.getIndex());
|
||||
System.out.println("当前小项结束进行删除============" + sourceIssue.getType() + splitTag + sourceIssue.getIndex());
|
||||
|
||||
long residueCount = SocketManager.getSourceTarget(sourceIssue.getType()) - 1;
|
||||
SocketManager.addTargetMap(sourceIssue.getType(), residueCount);
|
||||
System.out.println("该大项还有" + residueCount + "个小项没有进行检测!!!!!!!!");
|
||||
if (residueCount == 0) {
|
||||
System.out.println(sourceIssue.getType() + sourceIssue.getIndex() + "当前测试大项已经全部结束》》》》》》》》");
|
||||
//当residueCount为0则认为大项中的小项已经全部跑完,开始组装信息推送给前端
|
||||
List<DevLineTestResult> resultList = new ArrayList<>();
|
||||
// 获取当前检测大项的所有设备的检测结果
|
||||
List<DevLineTestResult> allDevTestList = targetTestMap.get(sourceIssue.getType());
|
||||
Map<String, List<DevLineTestResult>> map = allDevTestList.stream().collect(Collectors.groupingBy(DevLineTestResult::getDeviceId));
|
||||
map.forEach((dev, list) -> {
|
||||
DevLineTestResult devTem = new DevLineTestResult();
|
||||
devTem.setDeviceId(dev);
|
||||
devTem.setDeviceName(list.get(0).getDeviceName());
|
||||
Integer[] arr = list.get(0).getChnResult();
|
||||
for (int i = 0; i < arr.length; i++) {
|
||||
List<Integer[]> arrList = list.stream().map(DevLineTestResult::getChnResult).collect(Collectors.toList());
|
||||
Integer[] resultArr = getMaxIntArray(arrList);
|
||||
devTem.setChnResult(resultArr);
|
||||
}
|
||||
resultList.add(devTem);
|
||||
});
|
||||
allDevTestList.clear();
|
||||
CnSocketUtil.sendToWebSocket(param.getUserPageId(), socketDataMsg.getRequestId().split(stepTag)[1] + stepEnd, null, resultList, null);
|
||||
}
|
||||
//在这一步判断是否已经触发暂停按钮
|
||||
if (FormalTestManager.stopFlag && CollUtil.isNotEmpty(SocketManager.getSourceList())) {
|
||||
FormalTestManager.stopTime = 0;
|
||||
FormalTestManager.hasStopFlag = true;
|
||||
successComm.clear();
|
||||
FormalTestManager.realDataXiList.clear();
|
||||
sendWebSocket(param.getUserPageId(), "preStopTest", "stop", null);
|
||||
return;
|
||||
}
|
||||
|
||||
//开始进行下一项检测
|
||||
List<SourceIssue> sourceIssueList = SocketManager.getSourceList();
|
||||
if (CollUtil.isNotEmpty(sourceIssueList)) {
|
||||
SourceIssue sourceIssues = SocketManager.getSourceList().get(0);
|
||||
// 如果上一个大项检测完成,则检测下一个大项,并向前端推送消息
|
||||
long residueCount = SocketManager.getSourceTarget(sourceIssue.getType()) - 1;
|
||||
SocketManager.addTargetMap(sourceIssue.getType(), residueCount);
|
||||
System.out.println("该大项还有" + residueCount + "个小项没有进行检测!!!!!!!!");
|
||||
if (residueCount == 0) {
|
||||
CnSocketUtil.sendToWebSocket(param.getUserPageId(), sourceIssues.getType() + stepBegin, null, new ArrayList<>(), null);
|
||||
System.out.println(sourceIssue.getType() + sourceIssue.getIndex() + "当前测试大项已经全部结束》》》》》》》》");
|
||||
//当residueCount为0则认为大项中的小项已经全部跑完,开始组装信息推送给前端
|
||||
List<DevLineTestResult> resultList = new ArrayList<>();
|
||||
// 获取当前检测大项的所有设备的检测结果
|
||||
List<DevLineTestResult> allDevTestList = targetTestMap.get(sourceIssue.getType());
|
||||
Map<String, List<DevLineTestResult>> map = allDevTestList.stream().collect(Collectors.groupingBy(DevLineTestResult::getDeviceId));
|
||||
map.forEach((dev, list) -> {
|
||||
DevLineTestResult devTem = new DevLineTestResult();
|
||||
devTem.setDeviceId(dev);
|
||||
devTem.setDeviceName(list.get(0).getDeviceName());
|
||||
Integer[] arr = list.get(0).getChnResult();
|
||||
for (int i = 0; i < arr.length; i++) {
|
||||
List<Integer[]> arrList = list.stream().map(DevLineTestResult::getChnResult).collect(Collectors.toList());
|
||||
Integer[] resultArr = getMaxIntArray(arrList);
|
||||
devTem.setChnResult(resultArr);
|
||||
}
|
||||
resultList.add(devTem);
|
||||
});
|
||||
allDevTestList.clear();
|
||||
CnSocketUtil.sendToWebSocket(param.getUserPageId(), socketDataMsg.getRequestId().split(stepTag)[1] + stepEnd, null, resultList, null);
|
||||
}
|
||||
//在这一步判断是否已经触发暂停按钮
|
||||
if (FormalTestManager.stopFlag && CollUtil.isNotEmpty(SocketManager.getSourceList())) {
|
||||
FormalTestManager.stopTime = 0;
|
||||
FormalTestManager.hasStopFlag = true;
|
||||
successComm.clear();
|
||||
FormalTestManager.realDataXiList.clear();
|
||||
sendWebSocket(param.getUserPageId(), "preStopTest", "stop", null);
|
||||
return;
|
||||
}
|
||||
|
||||
SocketMsg<String> xuMsg = new SocketMsg<>();
|
||||
xuMsg.setOperateCode(SourceOperateCodeEnum.OPER_GATHER.getValue());
|
||||
xuMsg.setData(JSON.toJSONString(sourceIssues));
|
||||
xuMsg.setRequestId(SourceOperateCodeEnum.FORMAL_REAL.getValue() + stepTag + sourceIssues.getType());
|
||||
SocketManager.sendMsg(param.getUserPageId() + handlerSourceStr, JSON.toJSONString(xuMsg));
|
||||
} else {
|
||||
//TODO 是否最终检测完成需要推送给用户
|
||||
PqScriptCheckDataParam checkDataParam = new PqScriptCheckDataParam();
|
||||
checkDataParam.setScriptId(param.getScriptId());
|
||||
checkDataParam.setIsValueTypeName(false);
|
||||
List<String> valueType = iPqScriptCheckDataService.getValueType(checkDataParam);
|
||||
//开始进行下一项检测
|
||||
List<SourceIssue> sourceIssueList = SocketManager.getSourceList();
|
||||
if (CollUtil.isNotEmpty(sourceIssueList)) {
|
||||
SourceIssue sourceIssues = SocketManager.getSourceList().get(0);
|
||||
// 如果上一个大项检测完成,则检测下一个大项,并向前端推送消息
|
||||
if (residueCount == 0) {
|
||||
CnSocketUtil.sendToWebSocket(param.getUserPageId(), sourceIssues.getType() + stepBegin, null, new ArrayList<>(), null);
|
||||
}
|
||||
|
||||
SocketMsg<String> xuMsg = new SocketMsg<>();
|
||||
xuMsg.setOperateCode(SourceOperateCodeEnum.OPER_GATHER.getValue());
|
||||
xuMsg.setData(JSON.toJSONString(sourceIssues));
|
||||
xuMsg.setRequestId(SourceOperateCodeEnum.FORMAL_REAL.getValue() + stepTag + sourceIssues.getType());
|
||||
SocketManager.sendMsg(param.getUserPageId() + handlerSourceStr, JSON.toJSONString(xuMsg));
|
||||
} else {
|
||||
//TODO 是否最终检测完成需要推送给用户
|
||||
PqScriptCheckDataParam checkDataParam = new PqScriptCheckDataParam();
|
||||
checkDataParam.setScriptId(param.getScriptId());
|
||||
checkDataParam.setIsValueTypeName(false);
|
||||
List<String> valueType = iPqScriptCheckDataService.getValueType(checkDataParam);
|
||||
|
||||
iPqDevService.updateResult(param.getDevIds(), valueType, param.getCode(), param.getUserId(), param.getTemperature(), param.getHumidity());
|
||||
CnSocketUtil.quitSend(param);
|
||||
}
|
||||
successComm.clear();
|
||||
FormalTestManager.realDataXiList.clear();
|
||||
|
||||
iPqDevService.updateResult(param.getDevIds(), valueType, param.getCode(), param.getUserId(), param.getTemperature(), param.getHumidity());
|
||||
CnSocketUtil.quitSend(param);
|
||||
}
|
||||
successComm.clear();
|
||||
FormalTestManager.realDataXiList.clear();
|
||||
|
||||
} else {
|
||||
System.out.println("被抛除的数据:" + data);
|
||||
}
|
||||
break;
|
||||
|
||||
case UNPROCESSED_BUSINESS:
|
||||
break;
|
||||
|
||||
case NORMAL_RESPONSE:
|
||||
if (SocketManager.clockMap.containsKey(sourceIssue.getIndex())) {
|
||||
SocketManager.clockMap.put(sourceIssue.getIndex(), 0L);
|
||||
if (devData.getResult()) {
|
||||
if (SocketManager.clockMap.containsKey(sourceIssue.getIndex())) {
|
||||
SocketManager.clockMap.put(sourceIssue.getIndex(), 0L);
|
||||
}
|
||||
FormalTestManager.realDataXiList.add(devData);
|
||||
} else {
|
||||
System.out.println("被抛除的数据:" + data);
|
||||
}
|
||||
FormalTestManager.realDataXiList.add(devData);
|
||||
|
||||
break;
|
||||
case DEV_ERROR:
|
||||
|
||||
|
||||
@@ -503,7 +503,7 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
||||
int i;
|
||||
LambdaUpdateWrapper<PqDev> wrapper = new LambdaUpdateWrapper<PqDev>()
|
||||
.set(PqDev::getCheckResult, result.get(pqDev.getId()))
|
||||
.set(PqDev::getCheckBy, userId)
|
||||
.set(StrUtil.isNotBlank(userId), PqDev::getCheckBy, userId)
|
||||
.set(PqDev::getCheckTime, LocalDateTime.now())
|
||||
.eq(PqDev::getId, pqDev.getId());
|
||||
String currrentScene = sysTestConfigService.getCurrrentScene();
|
||||
@@ -1092,7 +1092,7 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
||||
public void visualizeProvinceDev(List<PqDev> pqDevs) {
|
||||
pqDevs.forEach(pqDev -> {
|
||||
pqDev.setDevType(devTypeService.getById(pqDev.getDevType()).getName());
|
||||
if(StrUtil.isNotBlank(pqDev.getManufacturer())){
|
||||
if (StrUtil.isNotBlank(pqDev.getManufacturer())) {
|
||||
pqDev.setManufacturer(dictDataService.getDictDataById(pqDev.getManufacturer()).getName());
|
||||
}
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@ import com.njcn.gather.result.pojo.vo.ResultVO;
|
||||
import com.njcn.gather.result.pojo.vo.TreeDataVO;
|
||||
import com.njcn.gather.result.service.IResultService;
|
||||
import com.njcn.gather.script.mapper.PqScriptMapper;
|
||||
import com.njcn.gather.script.pojo.param.PqScriptCheckDataParam;
|
||||
import com.njcn.gather.script.pojo.param.PqScriptIssueParam;
|
||||
import com.njcn.gather.script.pojo.po.PqScriptCheckData;
|
||||
import com.njcn.gather.script.pojo.po.PqScriptDtls;
|
||||
@@ -81,7 +82,6 @@ import java.util.stream.Collectors;
|
||||
public class ResultServiceImpl implements IResultService {
|
||||
|
||||
private final IAdPlanService adPlanService;
|
||||
private final ISysTestConfigService sysTestConfigService;
|
||||
private final IPqDevService pqDevService;
|
||||
private final AdNonHarmonicService adNonHarmonicService;
|
||||
private final AdHarmonicService adHarmonicService;
|
||||
@@ -92,6 +92,8 @@ public class ResultServiceImpl implements IResultService {
|
||||
private final TableGenMapper tableGenMapper;
|
||||
private final DetectionServiceImpl detectionServiceImpl;
|
||||
private final IDictDataService dictDataService;
|
||||
private final IPqScriptCheckDataService iPqScriptCheckDataService;
|
||||
private final IPqDevService iPqDevService;
|
||||
|
||||
/**
|
||||
* 谐波类code,取树形字典表中的code
|
||||
@@ -1625,6 +1627,13 @@ public class ResultServiceImpl implements IResultService {
|
||||
|
||||
detectionServiceImpl.processing(realDataXiList, param, devIdMapComm, sourceIssue, dataRule);
|
||||
});
|
||||
|
||||
PqScriptCheckDataParam checkDataParam = new PqScriptCheckDataParam();
|
||||
checkDataParam.setScriptId(scriptId);
|
||||
checkDataParam.setIsValueTypeName(false);
|
||||
List<String> valueType = iPqScriptCheckDataService.getValueType(checkDataParam);
|
||||
|
||||
iPqDevService.updateResult(param.getDevIds(), valueType, param.getCode(), null, param.getTemperature(), param.getHumidity());
|
||||
}
|
||||
|
||||
private List<DevData> toList(List<AdNonHarmonicResult> nonHarm, List<AdHarmonicResult> harm, boolean containBaseHarm) {
|
||||
|
||||
Reference in New Issue
Block a user