微调
This commit is contained in:
@@ -456,12 +456,12 @@ public class SocketDevResponseService {
|
||||
return percentage <= limit;
|
||||
}
|
||||
|
||||
private BigDecimal rangeNum(double num1, double num2,String type) {
|
||||
private BigDecimal rangeNum(double num1, double num2, String type) {
|
||||
double diff = Math.abs(num1 - num2);
|
||||
double larger = Math.max(num1, num2);
|
||||
if(DicDataEnum.V.getCode().equals(type)){
|
||||
if (DicDataEnum.V.getCode().equals(type)) {
|
||||
return BigDecimal.valueOf(diff / larger).setScale(4, RoundingMode.HALF_UP);
|
||||
}else {
|
||||
} else {
|
||||
return BigDecimal.valueOf(diff / larger).multiply(BigDecimal.valueOf(100)).setScale(4, RoundingMode.HALF_UP);
|
||||
}
|
||||
}
|
||||
@@ -525,12 +525,12 @@ public class SocketDevResponseService {
|
||||
coefficientVO.setBIeXi(isWithinTenPercent(optionalIB, devParameter.getDevCurr(), iLimit) ? "合格" : "不合格");
|
||||
coefficientVO.setCIeXi(isWithinTenPercent(optionalIC, devParameter.getDevCurr(), iLimit) ? "合格" : "不合格");
|
||||
|
||||
coefficientVO.setAV(rangeNum(optionalA, devParameter.getDevVolt(),DicDataEnum.V.getCode()).toString());
|
||||
coefficientVO.setBV(rangeNum(optionalB, devParameter.getDevVolt(),DicDataEnum.V.getCode()).toString());
|
||||
coefficientVO.setCV(rangeNum(optionalC, devParameter.getDevVolt(),DicDataEnum.V.getCode()).toString());
|
||||
coefficientVO.setAI(rangeNum(optionalIA, devParameter.getDevCurr(),DicDataEnum.I.getCode()).toString());
|
||||
coefficientVO.setBI(rangeNum(optionalIB, devParameter.getDevCurr(),DicDataEnum.I.getCode()).toString());
|
||||
coefficientVO.setCI(rangeNum(optionalIC, devParameter.getDevCurr(),DicDataEnum.I.getCode()).toString());
|
||||
coefficientVO.setAV(rangeNum(optionalA, devParameter.getDevVolt(), DicDataEnum.V.getCode()).toString());
|
||||
coefficientVO.setBV(rangeNum(optionalB, devParameter.getDevVolt(), DicDataEnum.V.getCode()).toString());
|
||||
coefficientVO.setCV(rangeNum(optionalC, devParameter.getDevVolt(), DicDataEnum.V.getCode()).toString());
|
||||
coefficientVO.setAI(rangeNum(optionalIA, devParameter.getDevCurr(), DicDataEnum.I.getCode()).toString());
|
||||
coefficientVO.setBI(rangeNum(optionalIB, devParameter.getDevCurr(), DicDataEnum.I.getCode()).toString());
|
||||
coefficientVO.setCI(rangeNum(optionalIC, devParameter.getDevCurr(), DicDataEnum.I.getCode()).toString());
|
||||
|
||||
if ("不合格".equals(coefficientVO.getAVuXi()) || "不合格".equals(coefficientVO.getBVuXi()) || "不合格".equals(coefficientVO.getCVuXi()) || "不合格".equals(coefficientVO.getAIeXi()) || "不合格".equals(coefficientVO.getBIeXi()) || "不合格".equals(coefficientVO.getCIeXi())) {
|
||||
coefficientVO.setResultFlag(0);
|
||||
@@ -908,9 +908,7 @@ public class SocketDevResponseService {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Map<String,List<DevLineTestResult>> targetTestMap = new HashMap<>();
|
||||
Map<String, List<DevLineTestResult>> targetTestMap = new HashMap<>();
|
||||
|
||||
/**
|
||||
* 正式检测
|
||||
@@ -941,7 +939,7 @@ public class SocketDevResponseService {
|
||||
Map<String, Integer> textResult = detectionServiceImpl.processing(realDataXiList, param, FormalTestManager.devIdMapComm, sourceIssue, dataRule);
|
||||
|
||||
//组装实体推送给前台
|
||||
assWebJson(param,textResult,socketDataMsg,sourceIssue);
|
||||
assWebJson(param, textResult, socketDataMsg, sourceIssue);
|
||||
|
||||
//当小项结束后需要删除集合中的小项
|
||||
SocketManager.delSource(sourceIssue.getIndex());
|
||||
@@ -969,7 +967,7 @@ public class SocketDevResponseService {
|
||||
resultList.add(devTem);
|
||||
});
|
||||
allDevTestList.clear();
|
||||
CnSocketUtil.sendToWebSocket(param.getUserPageId(),socketDataMsg.getRequestId().split(stepTag)[1] + stepEnd,null,resultList,null);
|
||||
CnSocketUtil.sendToWebSocket(param.getUserPageId(), socketDataMsg.getRequestId().split(stepTag)[1] + stepEnd, null, resultList, null);
|
||||
}
|
||||
|
||||
//在这一步判断是否已经触发暂停按钮
|
||||
@@ -987,7 +985,7 @@ public class SocketDevResponseService {
|
||||
if (CollUtil.isNotEmpty(sourceIssueList)) {
|
||||
SourceIssue sourceIssues = SocketManager.getSourceList().get(0);
|
||||
if (residueCount == 0) {
|
||||
CnSocketUtil.sendToWebSocket(param.getUserPageId(),sourceIssues.getType() + stepBegin,null,new ArrayList<>(),null);
|
||||
CnSocketUtil.sendToWebSocket(param.getUserPageId(), sourceIssues.getType() + stepBegin, null, new ArrayList<>(), null);
|
||||
}
|
||||
|
||||
SocketMsg<String> xuMsg = new SocketMsg<>();
|
||||
@@ -1038,7 +1036,7 @@ public class SocketDevResponseService {
|
||||
/**
|
||||
* 组装实体推送给前端
|
||||
*/
|
||||
private void assWebJson(PreDetectionParam param,Map<String, Integer> textResult,SocketDataMsg socketDataMsg,SourceIssue sourceIssue){
|
||||
private void assWebJson(PreDetectionParam param, Map<String, Integer> textResult, SocketDataMsg socketDataMsg, SourceIssue sourceIssue) {
|
||||
List<DevLineTestResult> devListRes = new ArrayList<>();
|
||||
FormalTestManager.devList.forEach(dev -> {
|
||||
DevLineTestResult devLineTestResult = new DevLineTestResult();
|
||||
@@ -1055,11 +1053,11 @@ public class SocketDevResponseService {
|
||||
devListRes.add(devLineTestResult);
|
||||
});
|
||||
|
||||
if(targetTestMap.containsKey(sourceIssue.getType())){
|
||||
if (targetTestMap.containsKey(sourceIssue.getType())) {
|
||||
List<DevLineTestResult> devLineTestResultList = targetTestMap.get(sourceIssue.getType());
|
||||
devLineTestResultList.addAll(devListRes);
|
||||
}else {
|
||||
targetTestMap.put(sourceIssue.getType(),devListRes);
|
||||
} else {
|
||||
targetTestMap.put(sourceIssue.getType(), devListRes);
|
||||
}
|
||||
|
||||
WebSocketVO<List<DevLineTestResult>> webSocketVO = new WebSocketVO<>();
|
||||
@@ -1199,8 +1197,8 @@ public class SocketDevResponseService {
|
||||
.sorted(Comparator.comparing(SourceIssue.ChannelListDTO::getChannelType))
|
||||
.collect(Collectors.toList());
|
||||
Map<String, String> sourceMessageMap = sourceMessage(issue);
|
||||
List<String> v = Arrays.asList("VRMS", "VA", "U", "V");
|
||||
List<String> i = Arrays.asList("IRMS", "IA", "I", "I");
|
||||
List<String> v = Arrays.asList("VRMS", "VA", "U", "V", "电压");
|
||||
List<String> i = Arrays.asList("IRMS", "IA", "I", "I", "电流");
|
||||
devMap.forEach((key, value) -> {
|
||||
List<DevData.SqlDataDTO> sqlData = value.stream().flatMap(x -> x.getSqlData().stream()).collect(Collectors.toList());
|
||||
getResult(key, sqlData, sourceMessageMap, sourceV, info, v);
|
||||
@@ -1226,7 +1224,7 @@ public class SocketDevResponseService {
|
||||
}
|
||||
compareDev.setDevName(devName);
|
||||
compareDev.setLineNum(split[1]);
|
||||
getSourceCompareDev(type.get(2), dataV, dataVPhase, compareDev, sourceMessageMap.get(type.get(3)), sourceV);
|
||||
getSourceCompareDev(type.get(2), dataV, dataVPhase, compareDev, sourceMessageMap.get(type.get(3)), sourceV, type.get(4));
|
||||
info.add(compareDev);
|
||||
}
|
||||
|
||||
@@ -1244,16 +1242,18 @@ public class SocketDevResponseService {
|
||||
List<DevData.SqlDataDTO> dataPhase,
|
||||
SourceCompareDev compareDev,
|
||||
String desc,
|
||||
List<SourceIssue.ChannelListDTO> channelList
|
||||
List<SourceIssue.ChannelListDTO> channelList,
|
||||
String name
|
||||
|
||||
) {
|
||||
//源信息
|
||||
Map<String, SourceIssue.ChannelListDTO> sourceMap = channelList.stream()
|
||||
.collect(Collectors.toMap(x -> x.getChannelType(), Function.identity()));
|
||||
compareDev.setIsQualified(getaBoolean(sourceMap.get(type + "a"), data.get(0).getList().getA(), dataPhase.get(0).getList().getA()));
|
||||
compareDev.setIsQualified(getaBoolean(sourceMap.get(type + "b"), data.get(0).getList().getB(), dataPhase.get(0).getList().getB()));
|
||||
compareDev.setIsQualified(getaBoolean(sourceMap.get(type + "c"), data.get(0).getList().getC(), dataPhase.get(0).getList().getC()));
|
||||
compareDev.setDesc((compareDev.getIsQualified() ? "合格->" : "不合格->") + desc + stepTag + devMessage(type, data, dataPhase));
|
||||
Boolean a = getaBoolean(sourceMap.get(type + "a"), data.get(0).getList().getA(), dataPhase.get(0).getList().getA());
|
||||
Boolean b = getaBoolean(sourceMap.get(type + "b"), data.get(0).getList().getB(), dataPhase.get(0).getList().getB());
|
||||
Boolean c = getaBoolean(sourceMap.get(type + "c"), data.get(0).getList().getC(), dataPhase.get(0).getList().getC());
|
||||
compareDev.setIsQualified(a && b && c);
|
||||
compareDev.setDesc(name + (compareDev.getIsQualified() ? "合格->" : "不合格->") + desc + stepTag + devMessage(type, data, dataPhase));
|
||||
return compareDev;
|
||||
}
|
||||
|
||||
@@ -1546,7 +1546,7 @@ public class SocketDevResponseService {
|
||||
}
|
||||
|
||||
public void backCheckState(PreDetectionParam param) {
|
||||
if (CollUtil.isNotEmpty(param.getDevIds()) && StrUtil.isNotBlank(param.getPlanId())) {
|
||||
if (CollUtil.isNotEmpty(param.getDevIds()) && StrUtil.isNotBlank(param.getPlanId())&&"1".equals(param.getOperateType())) {
|
||||
adPlanService.updateBackTestState(param.getPlanId(), param.getDevIds());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user