diff --git a/detection/src/main/java/com/njcn/gather/report/pojo/constant/PowerConstant.java b/detection/src/main/java/com/njcn/gather/report/pojo/constant/PowerConstant.java index 9e85a35e..58e3b471 100644 --- a/detection/src/main/java/com/njcn/gather/report/pojo/constant/PowerConstant.java +++ b/detection/src/main/java/com/njcn/gather/report/pojo/constant/PowerConstant.java @@ -21,7 +21,7 @@ public interface PowerConstant { /** * T相指标 */ - List T_PHASE = Arrays.asList("VOLTAGE", "IMBV", "IMBA"); + List T_PHASE = Arrays.asList("VOLTAGE", "IMBV", "IMBA", "FREQ"); /** @@ -32,7 +32,7 @@ public interface PowerConstant { /** * 没有次数的指标 */ - List NO_TIME = Arrays.asList("V", "I", "P", "VOLTAGE", "IMBV", "IMBA", "F"); + List NO_TIME = Arrays.asList("V", "I", "P", "VOLTAGE", "IMBV", "IMBA", "F", "FREQ"); /** * 有数据范围 diff --git a/detection/src/main/java/com/njcn/gather/report/pojo/enums/AffectEnum.java b/detection/src/main/java/com/njcn/gather/report/pojo/enums/AffectEnum.java index 0eaf122d..8908344f 100644 --- a/detection/src/main/java/com/njcn/gather/report/pojo/enums/AffectEnum.java +++ b/detection/src/main/java/com/njcn/gather/report/pojo/enums/AffectEnum.java @@ -15,7 +15,7 @@ public enum AffectEnum { BASE("base", "额定工作条件下的检测"), VOL("vol", "电压对XX测量的影响"), FREQ("freq", "频率对XX测量的影响"), - HARM("single", "谐波对XX测量的影响"); + HARM("harm", "谐波对XX测量的影响"); private String key; diff --git a/detection/src/main/java/com/njcn/gather/report/service/impl/PqReportServiceImpl.java b/detection/src/main/java/com/njcn/gather/report/service/impl/PqReportServiceImpl.java index 5f79ab45..4661229d 100644 --- a/detection/src/main/java/com/njcn/gather/report/service/impl/PqReportServiceImpl.java +++ b/detection/src/main/java/com/njcn/gather/report/service/impl/PqReportServiceImpl.java @@ -72,6 +72,8 @@ import org.docx4j.jaxb.Context; import org.docx4j.openpackaging.packages.WordprocessingMLPackage; import org.docx4j.openpackaging.parts.WordprocessingML.MainDocumentPart; import org.docx4j.wml.*; +import org.docx4j.wml.CTTblLayoutType; +import org.docx4j.wml.STTblLayoutType; import org.openxmlformats.schemas.wordprocessingml.x2006.main.*; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Value; @@ -85,6 +87,7 @@ import javax.xml.bind.JAXBElement; import java.io.*; import java.lang.reflect.Field; import java.math.BigDecimal; +import java.math.BigInteger; import java.math.RoundingMode; import java.nio.file.Files; import java.nio.file.Path; @@ -604,6 +607,8 @@ public class PqReportServiceImpl extends ServiceImpl i // 确保目录存在 ensureDirectoryExists(dirPath); baseModelDocument.save(new File(dirPath.concat(File.separator).concat(pqDevVO.getCreateId()).concat(ReportConstant.DOCX))); + + this.updateDevAndPlanState(devReportParam.getDevId(), devReportParam.getPlanId()); } catch (Exception e) { log.error(ReportResponseEnum.GENERATE_REPORT_ERROR.getMessage(), e); throw new BusinessException(ReportResponseEnum.GENERATE_REPORT_ERROR); @@ -809,7 +814,7 @@ public class PqReportServiceImpl extends ServiceImpl i ObjectFactory factory = new ObjectFactory(); // 读取该计划的检测大项组装数据内容 List pqScriptDtlsList = pqScriptDtlsService.getScriptDtlsDataList(devReportParam.getScriptId()); - Map> scriptMap = pqScriptDtlsList.stream().collect(Collectors.groupingBy(PqScriptDtlDataVO::getScriptCode)); + Map> scriptMap = pqScriptDtlsList.stream().collect(Collectors.groupingBy(PqScriptDtlDataVO::getScriptCode, LinkedHashMap::new, Collectors.toList())); List allContent = detailModelDocument.getContent(); List headingContents = Docx4jUtil.extractHeading5Contents(allContent); Map> contentMap = headingContents.stream().collect(Collectors.groupingBy(Docx4jUtil.HeadingContent::getHeadingText, Collectors.toList())); @@ -825,7 +830,7 @@ public class PqReportServiceImpl extends ServiceImpl i while (iterator.hasNext()) { Map.Entry> next = iterator.next(); String scriptCode = next.getKey(); - List checkckItemList = next.getValue(); + List dtlScriptItemList = next.getValue(); List tempContent = contentMap.get(scriptCode); // 获取需要填充keys,索引0对应的段落key,索引1对应的表格key List> keys = Docx4jUtil.getFillKeys(tempContent); @@ -849,14 +854,14 @@ public class PqReportServiceImpl extends ServiceImpl i } if (PowerConstant.TIME.contains(scriptCode)) { // 谐波类,以scriptIndex区分 - Map> scriptIndexMap = checkckItemList.stream().collect(Collectors.groupingBy(PqScriptDtlDataVO::getScriptIndex)); + Map> scriptIndexMap = dtlScriptItemList.stream().collect(Collectors.groupingBy(PqScriptDtlDataVO::getScriptIndex)); for (List scriptDtlDataItem : scriptIndexMap.values()) { singleTestResult = resultService.getFinalContent(scriptDtlDataItem, devReportParam.getPlanCode(), pqDevVO.getId(), lineNo, tableKeys); position = fillContentInTemplate(singleTestResult.getDetail(), position, tempContent, factory, pKeyValueMap, tableKeys, paragraphs); } } else { // 非谐波类 - singleTestResult = resultService.getFinalContent(checkckItemList, devReportParam.getPlanCode(), pqDevVO.getId(), lineNo, tableKeys); + singleTestResult = resultService.getFinalContent(dtlScriptItemList, devReportParam.getPlanCode(), pqDevVO.getId(), lineNo, tableKeys); position = fillContentInTemplate(singleTestResult.getDetail(), position, tempContent, factory, pKeyValueMap, tableKeys, paragraphs); } if (Objects.nonNull(singleTestResult) && needFill) { @@ -942,13 +947,16 @@ public class PqReportServiceImpl extends ServiceImpl i List rows = tbl.getContent(); boolean isRow = Docx4jUtil.judgeTableCross(rows.get(0)); if (isRow) { - // 删除最后一行,这行用来填模板key的,无需展示 // 获取现有行的样式 Tr existingRow = (Tr) tbl.getContent().get(rows.size() - 1); // 获取现有样式 TrPr trPr = existingRow.getTrPr(); JAXBElement element = (JAXBElement) existingRow.getContent().get(0); TcPr tcPr = element.getValue().getTcPr(); + TblWidth cellWidth = factory.createTblWidth(); + cellWidth.setType("dxa"); + cellWidth.setW(BigInteger.valueOf(5000/tableKeys.size())); + tcPr.setTcW(cellWidth); tbl.getContent().remove(existingRow); // 迭代增加行,需要填充的表格keys在tableKeys集合中 for (Map stringStringMap : value1) { @@ -958,14 +966,16 @@ public class PqReportServiceImpl extends ServiceImpl i } else { // 纵向表格暂不考虑 } - // 插入段落 + // 插入段落,处理下样式 + + + paragraphs.add(position++, copiedTableElement); } } - // 全部渲染完毕后,添加几个换行 P p = factory.createP(); - Docx4jUtil.addBr(factory, p, 2); + Docx4jUtil.addBr(factory, p, 1); paragraphs.add(position++, p); } diff --git a/detection/src/main/java/com/njcn/gather/result/service/impl/ResultServiceImpl.java b/detection/src/main/java/com/njcn/gather/result/service/impl/ResultServiceImpl.java index bb5f1080..5a305ad8 100644 --- a/detection/src/main/java/com/njcn/gather/result/service/impl/ResultServiceImpl.java +++ b/detection/src/main/java/com/njcn/gather/result/service/impl/ResultServiceImpl.java @@ -517,6 +517,8 @@ public class ResultServiceImpl implements IResultService { case VOLTAGE_MAG: case VOLTAGE_DUR: break; + default: + break; } } @@ -596,6 +598,8 @@ public class ResultServiceImpl implements IResultService { case VOLTAGE_MAG: case VOLTAGE_DUR: break; + default: + break; } } @@ -687,6 +691,8 @@ public class ResultServiceImpl implements IResultService { case VOLTAGE_MAG: case VOLTAGE_DUR: break; + default: + break; } } @@ -782,6 +788,8 @@ public class ResultServiceImpl implements IResultService { List dip = dtls.stream().filter(x -> "Dip".equals(x.getValueType())).collect(Collectors.toList()); dtlType.setScriptTypeName("频率=" + dipf.get(0).getValue() + ResultUnitEnum.FREQ.getUnit() + ",特征幅值=" + dip.get(0).getTransValue().intValue() + "%Un,持续时间=" + dip.get(0).getRetainTime().intValue() + "周波"); break; + default: + break; } } @@ -954,382 +962,136 @@ public class ResultServiceImpl implements IResultService { List indexList = scriptDtlDataVOList.stream().map(PqScriptDtlDataVO::getScriptIndex).distinct().collect(Collectors.toList()); List scriptCheckDataList = pqScriptCheckDataService.listCheckData(scriptId, indexList); List valueTypeList = scriptCheckDataList.stream().map(PqScriptCheckData::getValueType).distinct().collect(Collectors.toList()); - // 查询检测结果,区分下表。 - if (PowerConstant.TIME.contains(scriptCode)) { - // 谐波的测试项,肯定是三相的,可能会存在多次的,本处要填充的key全集为:time、standard、standardA、standardB、standardC、testA、testB、testC、errorA、errorB、errorC、result - // 查询结果数据,经过上层处理谐波类此处的scriptIndex确保只有一个 - if (indexList.size() == 1 && valueTypeList.size() == 1) { - // 获取谐波数据 - SingleNonHarmParam param = new SingleNonHarmParam(Integer.parseInt(planCode), devId, lineNo, valueTypeList.get(0), indexList.get(0)); - AdHarmonicResult singleResult = adHarmonicService.getSingleResult(param); - // 注:如果ABC的标准值一致,则同步到standard中 - Map> checkDataHarmNumMap = scriptCheckDataList.stream().collect(Collectors.groupingBy(PqScriptCheckData::getHarmNum)); - List> keyFillMapList = new ArrayList<>(); - checkDataHarmNumMap.forEach((harmNum, dtlsList) -> { - Map keyFillMap = new HashMap<>(); - // 次数需要区分谐波&间谐波 - String time; - if (harmNum % 1 == 0) { - // 谐波,需要转为正数字符串 - time = String.valueOf(harmNum.intValue()); - } else { - // 间谐波,保留小数位转为字符串 - time = String.format("%.1f", harmNum); - } - keyFillMap.put(ItemReportKeyEnum.TIME.getKey(), time); - // 将间谐波次数取整1.5取2,2.5取3 - double timeDouble = Math.round(harmNum); - int timeInt = (int) timeDouble; - DetectionData tempA = getResultData(singleResult, timeInt, PowerConstant.PHASE_A); - DetectionData tempB = getResultData(singleResult, timeInt, PowerConstant.PHASE_B); - DetectionData tempC = getResultData(singleResult, timeInt, PowerConstant.PHASE_C); - // 待填充Key - String standard = "/", standardA = "/", standardB = "/", standardC = "/", - testA = "/", testB = "/", testC = "/", - errorA = "/", errorB = "/", errorC = "/", - resultA = "/", resultB = "/", resultC = "/", result = "/", - errorScope = "/", unit = ""; - - if (Objects.nonNull(tempA) && (PowerConstant.DATA_RANGE.contains(tempA.getIsData()))) { - standardA = PubUtils.doubleRoundStr(4, tempA.getResultData()); - testA = PubUtils.doubleRoundStr(4, tempA.getData()); - errorA = PubUtils.doubleRoundStr(4, tempA.getErrorData().doubleValue()); - resultA = tempA.getIsData() == 1 ? "合格" : "不合格"; - errorScope = tempA.getRadius(); - unit = tempA.getUnit(); - standard = PubUtils.doubleRoundStr(4, tempA.getResultData()); - } - if (Objects.nonNull(tempB) && (PowerConstant.DATA_RANGE.contains(tempB.getIsData()))) { - standardB = PubUtils.doubleRoundStr(4, tempB.getResultData()); - testB = PubUtils.doubleRoundStr(4, tempB.getData()); - errorB = PubUtils.doubleRoundStr(4, tempB.getErrorData().doubleValue()); - resultB = tempB.getIsData() == 1 ? "合格" : "不合格"; - if (errorScope.equals("/")) { - errorScope = tempB.getRadius(); - } - if (StrUtil.isBlank(unit)) { - unit = tempB.getUnit(); - } - if (standard.equals("/")) { - standard = PubUtils.doubleRoundStr(4, tempB.getResultData()); - } - } - if (Objects.nonNull(tempC) && (PowerConstant.DATA_RANGE.contains(tempC.getIsData()))) { - standardC = PubUtils.doubleRoundStr(4, tempC.getResultData()); - testC = PubUtils.doubleRoundStr(4, tempC.getData()); - errorC = PubUtils.doubleRoundStr(4, tempC.getErrorData().doubleValue()); - resultC = tempC.getIsData() == 1 ? "合格" : "不合格"; - if (errorScope.equals("/")) { - errorScope = tempC.getRadius(); - } - if (StrUtil.isBlank(unit)) { - unit = tempC.getUnit(); - } - if (standard.equals("/")) { - standard = PubUtils.doubleRoundStr(4, tempC.getResultData()); - } - } - if (standardA.equals(standardB) && standardA.equals(standardC)) { - standard = standardA; - } - // 标准值 - keyFillMap.put(ItemReportKeyEnum.STANDARD.getKey(), standard); - keyFillMap.put(ItemReportKeyEnum.STANDARD_A.getKey(), standardA); - keyFillMap.put(ItemReportKeyEnum.STANDARD_B.getKey(), standardB); - keyFillMap.put(ItemReportKeyEnum.STANDARD_C.getKey(), standardC); - // 测试值 - keyFillMap.put(ItemReportKeyEnum.TEST_A.getKey(), testA); - keyFillMap.put(ItemReportKeyEnum.TEST_B.getKey(), testB); - keyFillMap.put(ItemReportKeyEnum.TEST_C.getKey(), testC); - // 误差值 - keyFillMap.put(ItemReportKeyEnum.ERROR_A.getKey(), errorA); - keyFillMap.put(ItemReportKeyEnum.ERROR_B.getKey(), errorB); - keyFillMap.put(ItemReportKeyEnum.ERROR_C.getKey(), errorC); - // 结果 - keyFillMap.put(ItemReportKeyEnum.RESULT_A.getKey(), resultA); - keyFillMap.put(ItemReportKeyEnum.RESULT_B.getKey(), resultB); - keyFillMap.put(ItemReportKeyEnum.RESULT_C.getKey(), resultC); - if (resultA.equals("不合格") || resultB.equals("不合格") || resultC.equals("不合格")) { - result = "不合格"; - } else if (!resultA.equals("/") || !resultB.equals("/") || !resultC.equals("/")) { - result = "合格"; - } - keyFillMap.put(ItemReportKeyEnum.RESULT.getKey(), result); - errorScope = dealErrorScope(errorScope).concat(unit); - keyFillMap.put(ItemReportKeyEnum.ERROR_SCOPE.getKey(), errorScope); + // 稍作区分,暂态的脚本同一个scriptIndex可以有两个指标,其余脚本每个checkData的valueType对应一个指标结果 + if (PowerConstant.VOLTAGE.equalsIgnoreCase(scriptCode)) { + // 暂态的valueType通常只有2个,一个特征幅值,一个持续时间 + List> keyFillMapList = new ArrayList<>(); + for (Integer sort : indexList) { + SingleNonHarmParam param = new SingleNonHarmParam(Integer.parseInt(planCode), devId, lineNo, valueTypeList, Collections.singletonList(sort)); + List nonHarmList = adNonHarmonicService.queryByCondition(param); + if (CollUtil.isNotEmpty(nonHarmList)) { + Map keyFillMap = new HashMap<>(16); + fillVoltagePhaseData(nonHarmList, keyFillMap, tableKeys); keyFillMapList.add(keyFillMap); - }); - // 按次数排序 - PubUtils.sortByDoubleValue(keyFillMapList, ItemReportKeyEnum.TIME.getKey()); - // 取出任意一次谐波数据的误差范围作为key - String titleScope = keyFillMapList.get(0).get(ItemReportKeyEnum.ERROR_SCOPE.getKey()); - Map>> errorScoperMap = new HashMap<>(); - errorScoperMap.put(titleScope, keyFillMapList); - List>>> errorScoperMapList = new ArrayList<>(); - errorScoperMapList.add(errorScoperMap); - finalContent.put(affectName, errorScoperMapList); - } else { - log.error("生成谐波类表格数据失败,脚本配置不支持,请核实。"); - throw new BusinessException("生成谐波类表格数据失败,脚本配置不支持,请核实。"); - } - } else { - // 非谐波的需要区分是否为ABC相还是T相 - if (PowerConstant.THREE_PHASE.contains(scriptCode)) { - if (valueTypeList.size() == 1) { - // 获取该三相的数据 - SingleNonHarmParam param = new SingleNonHarmParam(Integer.parseInt(planCode), devId, lineNo, valueTypeList, indexList); - List nonHarmList = adNonHarmonicService.queryByCondition(param); - // 三相的数据通常包含:standard、standardA、standardB、standardC、testA、testB、testC、errorA、errorB、errorC、resultA、resultB、resultC、result、errorScope - if (CollUtil.isNotEmpty(nonHarmList)) { - List> keyFillMapList = new ArrayList<>(); - for (AdNonHarmonicResult adNonHarmonicResult : nonHarmList) { - Map keyFillMap = new HashMap<>(16); - DetectionData tempA = getResultData(adNonHarmonicResult, null, PowerConstant.PHASE_A); - DetectionData tempB = getResultData(adNonHarmonicResult, null, PowerConstant.PHASE_B); - DetectionData tempC = getResultData(adNonHarmonicResult, null, PowerConstant.PHASE_C); - // 待填充Key - String standard = "/", standardA = "/", standardB = "/", standardC = "/", - testA = "/", testB = "/", testC = "/", - errorA = "/", errorB = "/", errorC = "/", - resultA = "/", resultB = "/", resultC = "/", result = "/", - errorScope = "/", unit = ""; - if (Objects.nonNull(tempA) && (PowerConstant.DATA_RANGE.contains(tempA.getIsData()))) { - standardA = PubUtils.doubleRoundStr(4, tempA.getResultData()); - testA = PubUtils.doubleRoundStr(4, tempA.getData()); - errorA = PubUtils.doubleRoundStr(4, tempA.getErrorData().doubleValue()); - resultA = tempA.getIsData() == 1 ? "合格" : "不合格"; - errorScope = tempA.getRadius(); - unit = tempA.getUnit(); - standard = PubUtils.doubleRoundStr(4, tempA.getResultData()); - } - if (Objects.nonNull(tempB) && (PowerConstant.DATA_RANGE.contains(tempB.getIsData()))) { - standardB = PubUtils.doubleRoundStr(4, tempB.getResultData()); - testB = PubUtils.doubleRoundStr(4, tempB.getData()); - errorB = PubUtils.doubleRoundStr(4, tempB.getErrorData().doubleValue()); - resultB = tempB.getIsData() == 1 ? "合格" : "不合格"; - if (errorScope.equals("/")) { - errorScope = tempB.getRadius(); - } - if (StrUtil.isBlank(unit)) { - unit = tempB.getUnit(); - } - if (standard.equals("/")) { - standard = PubUtils.doubleRoundStr(4, tempB.getResultData()); - } - } - if (Objects.nonNull(tempC) && (PowerConstant.DATA_RANGE.contains(tempC.getIsData()))) { - standardC = PubUtils.doubleRoundStr(4, tempC.getResultData()); - testC = PubUtils.doubleRoundStr(4, tempC.getData()); - errorC = PubUtils.doubleRoundStr(4, tempC.getErrorData().doubleValue()); - resultC = tempC.getIsData() == 1 ? "合格" : "不合格"; - if (errorScope.equals("/")) { - errorScope = tempC.getRadius(); - } - if (StrUtil.isBlank(unit)) { - unit = tempC.getUnit(); - } - if (standard.equals("/")) { - standard = PubUtils.doubleRoundStr(4, tempC.getResultData()); - } - } - if (standardA.equals(standardB) && standardA.equals(standardC)) { - standard = standardA; - } - // 标准值 - keyFillMap.put(ItemReportKeyEnum.STANDARD.getKey(), standard); - keyFillMap.put(ItemReportKeyEnum.STANDARD_A.getKey(), standardA); - keyFillMap.put(ItemReportKeyEnum.STANDARD_B.getKey(), standardB); - keyFillMap.put(ItemReportKeyEnum.STANDARD_C.getKey(), standardC); - // 测试值 - keyFillMap.put(ItemReportKeyEnum.TEST_A.getKey(), testA); - keyFillMap.put(ItemReportKeyEnum.TEST_B.getKey(), testB); - keyFillMap.put(ItemReportKeyEnum.TEST_C.getKey(), testC); - // 误差值 - keyFillMap.put(ItemReportKeyEnum.ERROR_A.getKey(), errorA); - keyFillMap.put(ItemReportKeyEnum.ERROR_B.getKey(), errorB); - keyFillMap.put(ItemReportKeyEnum.ERROR_C.getKey(), errorC); - // 结果 - keyFillMap.put(ItemReportKeyEnum.RESULT_A.getKey(), resultA); - keyFillMap.put(ItemReportKeyEnum.RESULT_B.getKey(), resultB); - keyFillMap.put(ItemReportKeyEnum.RESULT_C.getKey(), resultC); - if (resultA.equals("不合格") || resultB.equals("不合格") || resultC.equals("不合格")) { - result = "不合格"; - } else if (!resultA.equals("/") || !resultB.equals("/") || !resultC.equals("/")) { - result = "合格"; - } - keyFillMap.put(ItemReportKeyEnum.RESULT.getKey(), result); - errorScope = dealErrorScope(errorScope).concat(unit); - keyFillMap.put(ItemReportKeyEnum.ERROR_SCOPE.getKey(), errorScope); - keyFillMapList.add(keyFillMap); - } - // 需要对所有的填充进行按误差范围分组 - Map>> errorScoperMap = keyFillMapList.stream() - .collect(Collectors.groupingBy(map -> map.get(ItemReportKeyEnum.ERROR_SCOPE.getKey()))); - // 分组后,还需要针对标准值进行一个升序 - errorScoperMap.forEach((errorScope, maps) -> { - PubUtils.sortByDoubleValue(maps, ItemReportKeyEnum.STANDARD.getKey()); - }); - List>>> errorList = new ArrayList<>(); - errorList.add(errorScoperMap); - // 最后赋值返回 - finalContent.put(affectName, errorList); - } else { - log.error("生成三相类表格数据失败,结果表数据丢失,请核实。"); - } - } else { - log.error("生成三相类表格数据失败,脚本配置不支持,请核实。"); - throw new BusinessException("生成三相类表格数据失败,脚本配置不支持,请核实。"); } - } else { - // 非三相的还需要特殊处理下暂态的 - if (PowerConstant.VOLTAGE.equalsIgnoreCase(scriptCode)) { - // 暂态的valueType通常只有2个,一个特征幅值,一个持续时间 - List> keyFillMapList = new ArrayList<>(); - for (Integer sort : indexList) { - SingleNonHarmParam param = new SingleNonHarmParam(Integer.parseInt(planCode), devId, lineNo, valueTypeList, Collections.singletonList(sort)); - List nonHarmList = adNonHarmonicService.queryByCondition(param); - // 暂态的数据通常包含:standardMag、standardDur、testMag、testDur、errorMag、errorDur、resultMag、resultDur、result、errorScope、errorScopeMag、errorScopeDur - if (CollUtil.isNotEmpty(nonHarmList)) { - String standardMag = "/", standardDur = "/", - testMag = "/", testDur = "/", - errorMag = "/", errorDur = "/", - resultMag = "/", resultDur = "/", result, - errorScope, errorScopeMag = "/", errorScopeDur = "/", - unitMag = "", unitDur = ""; - Map keyFillMap = new HashMap<>(16); - for (AdNonHarmonicResult adNonHarmonicResult : nonHarmList) { - DetectionData tempT = getResultData(adNonHarmonicResult, null, PowerConstant.PHASE_T); - // 需要判断adNonHarmonicResult是特征幅值还是持续时间 - String adType = adNonHarmonicResult.getAdType(); - DictTree temp = dictTreeService.getById(adType); - if (temp.getCode().equalsIgnoreCase("MAG")) { - // 特征幅值 - if (Objects.nonNull(tempT) && PowerConstant.DATA_RANGE.contains(tempT.getIsData())) { - standardMag = PubUtils.doubleRoundStr(4, tempT.getResultData()); - testMag = PubUtils.doubleRoundStr(4, tempT.getData()); - errorMag = PubUtils.doubleRoundStr(4, tempT.getErrorData().doubleValue()); - resultMag = tempT.getIsData() == 1 ? "合格" : "不合格"; - unitMag = tempT.getUnit(); - errorScopeMag = tempT.getRadius(); - } - } else if (temp.getCode().equalsIgnoreCase("DUR")) { - // 持续时间,需要注意时间单位处理,默认是秒 - String timeUnit = "s"; - for (String tableKey : tableKeys) { - if (tableKey.contains(ItemReportKeyEnum.STANDARD_DUR.getKey())) { - //截取单位 - String[] tempStr = tableKey.split(StrPool.UNDERLINE); - if (tempStr.length > 1) { - if (tempStr[1].equalsIgnoreCase("ms")) { - timeUnit = "ms"; - } - } - } - } - standardDur = PubUtils.doubleRoundStr(4, tempT.getResultData()); - testDur = PubUtils.doubleRoundStr(4, tempT.getData()); - errorDur = PubUtils.doubleRoundStr(4, tempT.getErrorData().doubleValue()); - resultDur = tempT.getIsData() == 1 ? "合格" : "不合格"; - unitDur = tempT.getUnit(); - errorScopeDur = tempT.getRadius(); - if (timeUnit.equalsIgnoreCase("ms")) { - // 如果是ms,上述的一些数据需要重新处理 - if (!standardDur.equalsIgnoreCase("/")) { - standardDur = PubUtils.doubleRoundStr(4, Double.parseDouble(standardDur) * 1000); - } - if (!testDur.equalsIgnoreCase("/")) { - testDur = PubUtils.doubleRoundStr(4, Double.parseDouble(testDur) * 1000); - } - if (!errorDur.equalsIgnoreCase("/")) { - errorDur = PubUtils.doubleRoundStr(4, Double.parseDouble(errorDur) * 1000); - } - if(!errorScopeDur.equalsIgnoreCase("/")){ - if(errorScopeDur.contains("~")){ - String[] tempStr = errorScopeDur.split("~"); - errorScopeDur = PubUtils.doubleRoundStr(0, Double.parseDouble(tempStr[0]) * 1000).concat("~").concat(PubUtils.doubleRoundStr(0, Double.parseDouble(tempStr[1]) * 1000)); - } - } - unitDur = "ms"; - } - } + } + // 需要对所有填充进行按误差范围分组 + Map>> errorScoperMap = keyFillMapList.stream() + .collect(Collectors.groupingBy(map -> map.get(ItemReportKeyEnum.ERROR_SCOPE.getKey()))); + // 分组后,还需要针对特征幅值标准值进行一个升序 + errorScoperMap.forEach((errorScope, maps) -> { + PubUtils.sortByDoubleValue(maps, ItemReportKeyEnum.STANDARD_MAG.getKey()); + }); + List>>> errorList = new ArrayList<>(); + errorList.add(errorScoperMap); + // 最后赋值返回 + finalContent.put(affectName, errorList); + } else { + for (String valueType : valueTypeList) { + if (PowerConstant.TIME.contains(scriptCode)) { + // 查询结果数据,经过上层处理谐波类此处的scriptIndex确保只有一个 + if (indexList.size() == 1) { + // 获取谐波数据 + SingleNonHarmParam param = new SingleNonHarmParam(Integer.parseInt(planCode), devId, lineNo, valueType, indexList.get(0)); + AdHarmonicResult singleResult = adHarmonicService.getSingleResult(param); + // 注:如果ABC的标准值一致,则同步到standard中 + Map> checkDataHarmNumMap = scriptCheckDataList.stream().collect(Collectors.groupingBy(PqScriptCheckData::getHarmNum)); + List> keyFillMapList = new ArrayList<>(); + checkDataHarmNumMap.forEach((harmNum, dtlsList) -> { + Map keyFillMap = new HashMap<>(); + // 次数需要区分谐波&间谐波 + String time; + if (harmNum % 1 == 0) { + // 谐波,需要转为正数字符串 + time = String.valueOf(harmNum.intValue()); + } else { + // 间谐波,保留小数位转为字符串 + time = String.format("%.1f", harmNum); } - errorScopeMag = dealErrorScope(errorScopeMag).concat(unitMag); - errorScopeDur = dealErrorScope(errorScopeDur).concat(unitDur); - - errorScope = "特征幅值:".concat(errorScopeMag).concat(StrPool.COMMA).concat("持续时间:").concat(errorScopeDur); - keyFillMap.put(ItemReportKeyEnum.ERROR_SCOPE.getKey(), errorScope); - // 标准值 - keyFillMap.put(ItemReportKeyEnum.STANDARD_MAG.getKey(), standardMag); - keyFillMap.put(ItemReportKeyEnum.STANDARD_DUR.getKey(), standardDur); - // 测试值 - keyFillMap.put(ItemReportKeyEnum.TEST_MAG.getKey(), testMag); - keyFillMap.put(ItemReportKeyEnum.TEST_DUR.getKey(), testDur); - // 误差 - keyFillMap.put(ItemReportKeyEnum.ERROR_MAG.getKey(), errorMag); - keyFillMap.put(ItemReportKeyEnum.ERROR_DUR.getKey(), errorDur); - // 结果 - keyFillMap.put(ItemReportKeyEnum.RESULT_MAG.getKey(), resultMag); - keyFillMap.put(ItemReportKeyEnum.RESULT_DUR.getKey(), resultDur); - // 综合结果 - result = resultMag; - if (!resultDur.equals("/") && result.equals("合格")) { - if (resultDur.equals("不合格")) { - result = "不合格"; - } + keyFillMap.put(ItemReportKeyEnum.TIME.getKey(), time); + // 将间谐波次数取整1.5取2,2.5取3 + double timeDouble = Math.round(harmNum); + int timeInt = (int) timeDouble; + // 填充结果数据 + fillThreePhaseData(singleResult, timeInt, keyFillMap); + if(!keyFillMap.get(ItemReportKeyEnum.ERROR_SCOPE.getKey()).equals("/")){ + keyFillMapList.add(keyFillMap); } - keyFillMap.put(ItemReportKeyEnum.RESULT.getKey(), result); - keyFillMapList.add(keyFillMap); + }); + if(CollUtil.isNotEmpty(keyFillMapList)){ + // 按次数排序 + PubUtils.sortByDoubleValue(keyFillMapList, ItemReportKeyEnum.TIME.getKey()); + // 取出任意一次谐波数据的误差范围作为key + String titleScope = keyFillMapList.get(0).get(ItemReportKeyEnum.ERROR_SCOPE.getKey()); + Map>> errorScoperMap = new HashMap<>(); + errorScoperMap.put(titleScope, keyFillMapList); + List>>> errorScoperMapList = new ArrayList<>(); + errorScoperMapList.add(errorScoperMap); + finalContent.put(affectName, errorScoperMapList); } + } else { + log.error("生成谐波类表格数据失败,脚本配置不支持,请核实。"); + throw new BusinessException("生成谐波类表格数据失败,脚本配置不支持,请核实。"); } - // 需要对所有填充进行按误差范围分组 - Map>> errorScoperMap = keyFillMapList.stream() - .collect(Collectors.groupingBy(map -> map.get(ItemReportKeyEnum.ERROR_SCOPE.getKey()))); - // 分组后,还需要针对特征幅值标准值进行一个升序 - errorScoperMap.forEach((errorScope, maps) -> { - PubUtils.sortByDoubleValue(maps, ItemReportKeyEnum.STANDARD_MAG.getKey()); - }); - List>>> errorList = new ArrayList<>(); - errorList.add(errorScoperMap); - // 最后赋值返回 - finalContent.put(affectName, errorList); } else { - // 非三相且非暂态,通常只有一个数据,所以直接赋值即可 - List> keyFillMapList = new ArrayList<>(); - SingleNonHarmParam param = new SingleNonHarmParam(Integer.parseInt(planCode), devId, lineNo, valueTypeList, indexList); - List nonHarmList = adNonHarmonicService.queryByCondition(param); - if (CollUtil.isNotEmpty(nonHarmList)) { - for (AdNonHarmonicResult adNonHarmonicResult : nonHarmList) { - String standard = "/", test = "/", error = "/", result = "/", errorScope = "/",unit = ""; - Map keyFillMap = new HashMap<>(8); - DetectionData tempT = getResultData(adNonHarmonicResult, null, PowerConstant.PHASE_T); - if (Objects.nonNull(tempT) && PowerConstant.DATA_RANGE.contains(tempT.getIsData())) { - standard = PubUtils.doubleRoundStr(4, tempT.getResultData()); - test = PubUtils.doubleRoundStr(4, tempT.getData()); - error = PubUtils.doubleRoundStr(4, tempT.getErrorData().doubleValue()); - result = tempT.getIsData() == 1 ? "合格" : "不合格"; - unit = tempT.getUnit(); - errorScope = tempT.getRadius(); + // 非谐波的需要区分是否为ABC相还是T相 + if (PowerConstant.THREE_PHASE.contains(scriptCode)) { + // 获取该三相的数据 + SingleNonHarmParam param = new SingleNonHarmParam(Integer.parseInt(planCode), devId, lineNo, Collections.singletonList(valueType), indexList); + List nonHarmList = adNonHarmonicService.queryByCondition(param); + if (CollUtil.isNotEmpty(nonHarmList)) { + List> keyFillMapList = new ArrayList<>(); + for (AdNonHarmonicResult adNonHarmonicResult : nonHarmList) { + Map keyFillMap = new HashMap<>(16); + fillThreePhaseData(adNonHarmonicResult, null, keyFillMap); + if(!keyFillMap.get(ItemReportKeyEnum.ERROR_SCOPE.getKey()).equals("/")){ + keyFillMapList.add(keyFillMap); + } } - keyFillMap.put(ItemReportKeyEnum.STANDARD.getKey(), standard); - keyFillMap.put(ItemReportKeyEnum.TEST.getKey(), test); - keyFillMap.put(ItemReportKeyEnum.ERROR.getKey(), error); - keyFillMap.put(ItemReportKeyEnum.RESULT.getKey(), result); - errorScope = dealErrorScope(errorScope).concat(unit); - keyFillMap.put(ItemReportKeyEnum.ERROR_SCOPE.getKey(), errorScope); - keyFillMapList.add(keyFillMap); + if(CollUtil.isNotEmpty(keyFillMapList)){ + // 需要对所有的填充进行按误差范围分组 + Map>> errorScoperMap = keyFillMapList.stream() + .collect(Collectors.groupingBy(map -> map.get(ItemReportKeyEnum.ERROR_SCOPE.getKey()))); + // 分组后,还需要针对标准值进行一个升序 + errorScoperMap.forEach((errorScope, maps) -> { + PubUtils.sortByDoubleValue(maps, ItemReportKeyEnum.STANDARD.getKey()); + }); + List>>> errorList = new ArrayList<>(); + errorList.add(errorScoperMap); + // 最后赋值返回 + finalContent.put(affectName, errorList); + } + } else { + log.error("生成三相类表格数据失败,结果表数据丢失,请核实。"); + } + } else { + // 非三相且非暂态,通常只有一个数据,所以直接赋值即可 + List> keyFillMapList = new ArrayList<>(); + SingleNonHarmParam param = new SingleNonHarmParam(Integer.parseInt(planCode), devId, lineNo, Collections.singletonList(valueType), indexList); + List nonHarmList = adNonHarmonicService.queryByCondition(param); + if (CollUtil.isNotEmpty(nonHarmList)) { + for (AdNonHarmonicResult adNonHarmonicResult : nonHarmList) { + Map keyFillMap = new HashMap<>(8); + fillTPhaseData(adNonHarmonicResult, null, keyFillMap); + if(!keyFillMap.get(ItemReportKeyEnum.ERROR_SCOPE.getKey()).equals("/")){ + keyFillMapList.add(keyFillMap); + } + } + } + if(CollUtil.isNotEmpty(keyFillMapList)){ + // 需要对所有填充进行按误差范围分组 + Map>> errorScoperMap = keyFillMapList.stream() + .collect(Collectors.groupingBy(map -> map.get(ItemReportKeyEnum.ERROR_SCOPE.getKey()))); + // 分组后,还需要针对特征幅值标准值进行一个升序 + errorScoperMap.forEach((errorScope, maps) -> { + PubUtils.sortByDoubleValue(maps, ItemReportKeyEnum.STANDARD.getKey()); + }); + List>>> errorList = new ArrayList<>(); + errorList.add(errorScoperMap); + // 最后赋值返回 + finalContent.put(affectName, errorList); } } - // 需要对所有填充进行按误差范围分组 - Map>> errorScoperMap = keyFillMapList.stream() - .collect(Collectors.groupingBy(map -> map.get(ItemReportKeyEnum.ERROR_SCOPE.getKey()))); - // 分组后,还需要针对特征幅值标准值进行一个升序 - errorScoperMap.forEach((errorScope, maps) -> { - PubUtils.sortByDoubleValue(maps, ItemReportKeyEnum.STANDARD.getKey()); - }); - List>>> errorList = new ArrayList<>(); - errorList.add(errorScoperMap); - // 最后赋值返回 - finalContent.put(affectName, errorList); } } } @@ -1341,13 +1103,227 @@ public class ResultServiceImpl implements IResultService { } }); } - // 返回之前做下总结性判断 singleTestResult.setQualified(judgeQualified(finalContent)); singleTestResult.setDetail(finalContent); return singleTestResult; } + + /** + * 三相的相关数据处理 + * 包含:谐波、间谐波、电压、电流、功率、闪变 + * + * @param singleResult 可能是谐波类,也有可能是电压电流,需要区分下结果 + * @param timeInt 谐波类需要传指定次数 + * @param keyFillMap 待填充的集合Map + */ + private void fillThreePhaseData(Object singleResult, Integer timeInt, Map keyFillMap) { + DetectionData tempA = getResultData(singleResult, timeInt, PowerConstant.PHASE_A); + DetectionData tempB = getResultData(singleResult, timeInt, PowerConstant.PHASE_B); + DetectionData tempC = getResultData(singleResult, timeInt, PowerConstant.PHASE_C); + // 待填充Key + String standard = "/", standardA = "/", standardB = "/", standardC = "/", + testA = "/", testB = "/", testC = "/", + errorA = "/", errorB = "/", errorC = "/", + resultA = "/", resultB = "/", resultC = "/", result = "/", + errorScope = "/", unit = ""; + + if (Objects.nonNull(tempA) && (PowerConstant.DATA_RANGE.contains(tempA.getIsData()))) { + standardA = PubUtils.doubleRoundStr(4, tempA.getResultData()); + testA = PubUtils.doubleRoundStr(4, tempA.getData()); + errorA = PubUtils.doubleRoundStr(4, tempA.getErrorData().doubleValue()); + resultA = tempA.getIsData() == 1 ? "合格" : "不合格"; + errorScope = tempA.getRadius(); + unit = tempA.getUnit(); + standard = PubUtils.doubleRoundStr(4, tempA.getResultData()); + } + if (Objects.nonNull(tempB) && (PowerConstant.DATA_RANGE.contains(tempB.getIsData()))) { + standardB = PubUtils.doubleRoundStr(4, tempB.getResultData()); + testB = PubUtils.doubleRoundStr(4, tempB.getData()); + errorB = PubUtils.doubleRoundStr(4, tempB.getErrorData().doubleValue()); + resultB = tempB.getIsData() == 1 ? "合格" : "不合格"; + if (errorScope.equals("/")) { + errorScope = tempB.getRadius(); + } + if (StrUtil.isBlank(unit)) { + unit = tempB.getUnit(); + } + if (standard.equals("/")) { + standard = PubUtils.doubleRoundStr(4, tempB.getResultData()); + } + } + if (Objects.nonNull(tempC) && (PowerConstant.DATA_RANGE.contains(tempC.getIsData()))) { + standardC = PubUtils.doubleRoundStr(4, tempC.getResultData()); + testC = PubUtils.doubleRoundStr(4, tempC.getData()); + errorC = PubUtils.doubleRoundStr(4, tempC.getErrorData().doubleValue()); + resultC = tempC.getIsData() == 1 ? "合格" : "不合格"; + if (errorScope.equals("/")) { + errorScope = tempC.getRadius(); + } + if (StrUtil.isBlank(unit)) { + unit = tempC.getUnit(); + } + if (standard.equals("/")) { + standard = PubUtils.doubleRoundStr(4, tempC.getResultData()); + } + } + if (standardA.equals(standardB) && standardA.equals(standardC)) { + standard = standardA; + } + // 标准值 + keyFillMap.put(ItemReportKeyEnum.STANDARD.getKey(), standard); + keyFillMap.put(ItemReportKeyEnum.STANDARD_A.getKey(), standardA); + keyFillMap.put(ItemReportKeyEnum.STANDARD_B.getKey(), standardB); + keyFillMap.put(ItemReportKeyEnum.STANDARD_C.getKey(), standardC); + // 测试值 + keyFillMap.put(ItemReportKeyEnum.TEST_A.getKey(), testA); + keyFillMap.put(ItemReportKeyEnum.TEST_B.getKey(), testB); + keyFillMap.put(ItemReportKeyEnum.TEST_C.getKey(), testC); + // 误差值 + keyFillMap.put(ItemReportKeyEnum.ERROR_A.getKey(), errorA); + keyFillMap.put(ItemReportKeyEnum.ERROR_B.getKey(), errorB); + keyFillMap.put(ItemReportKeyEnum.ERROR_C.getKey(), errorC); + // 结果 + keyFillMap.put(ItemReportKeyEnum.RESULT_A.getKey(), resultA); + keyFillMap.put(ItemReportKeyEnum.RESULT_B.getKey(), resultB); + keyFillMap.put(ItemReportKeyEnum.RESULT_C.getKey(), resultC); + if (resultA.equals("不合格") || resultB.equals("不合格") || resultC.equals("不合格")) { + result = "不合格"; + } else if (!resultA.equals("/") || !resultB.equals("/") || !resultC.equals("/")) { + result = "合格"; + } + keyFillMap.put(ItemReportKeyEnum.RESULT.getKey(), result); + errorScope = dealErrorScope(errorScope).concat(unit); + keyFillMap.put(ItemReportKeyEnum.ERROR_SCOPE.getKey(), errorScope); + } + + + /** + * T相的相关数据处理,非暂态数据 + * 包含:三相电压/电流不平衡度、频率,其中三相电压/电流实际ABC中存了正序/负序/零序电压 + * + * @param singleResult 可能是谐波类,也有可能是电压电流,需要区分下结果 + * @param timeInt 谐波类需要传指定次数 + * @param keyFillMap 待填充的集合Map + */ + private void fillTPhaseData(Object singleResult, Integer timeInt, Map keyFillMap) { + String standard = "/", test = "/", error = "/", result = "/", errorScope = "/", unit = ""; + DetectionData tempT = getResultData(singleResult, timeInt, PowerConstant.PHASE_T); + if (Objects.nonNull(tempT) && PowerConstant.DATA_RANGE.contains(tempT.getIsData())) { + standard = PubUtils.doubleRoundStr(4, tempT.getResultData()); + test = PubUtils.doubleRoundStr(4, tempT.getData()); + error = PubUtils.doubleRoundStr(4, tempT.getErrorData().doubleValue()); + result = tempT.getIsData() == 1 ? "合格" : "不合格"; + unit = tempT.getUnit(); + errorScope = tempT.getRadius(); + } + keyFillMap.put(ItemReportKeyEnum.STANDARD.getKey(), standard); + keyFillMap.put(ItemReportKeyEnum.TEST.getKey(), test); + keyFillMap.put(ItemReportKeyEnum.ERROR.getKey(), error); + keyFillMap.put(ItemReportKeyEnum.RESULT.getKey(), result); + errorScope = dealErrorScope(errorScope).concat(unit); + keyFillMap.put(ItemReportKeyEnum.ERROR_SCOPE.getKey(), errorScope); + } + + /** + * 针对暂态的数据填充 + * + * @param nonHarmList 暂态的结果集 + * @param keyFillMap 待填充的集合Map + * @param tableKeys 模板表格中的key + */ + private void fillVoltagePhaseData(List nonHarmList, Map keyFillMap, List tableKeys) { + String standardMag = "/", standardDur = "/", + testMag = "/", testDur = "/", + errorMag = "/", errorDur = "/", + resultMag = "/", resultDur = "/", result, + errorScope, errorScopeMag = "/", errorScopeDur = "/", + unitMag = "", unitDur = ""; + for (AdNonHarmonicResult adNonHarmonicResult : nonHarmList) { + DetectionData tempT = getResultData(adNonHarmonicResult, null, PowerConstant.PHASE_T); + // 需要判断adNonHarmonicResult是特征幅值还是持续时间 + String adType = adNonHarmonicResult.getAdType(); + DictTree temp = dictTreeService.getById(adType); + if (temp.getCode().equalsIgnoreCase("MAG")) { + // 特征幅值 + if (Objects.nonNull(tempT) && PowerConstant.DATA_RANGE.contains(tempT.getIsData())) { + standardMag = PubUtils.doubleRoundStr(4, tempT.getResultData()); + testMag = PubUtils.doubleRoundStr(4, tempT.getData()); + errorMag = PubUtils.doubleRoundStr(4, tempT.getErrorData().doubleValue()); + resultMag = tempT.getIsData() == 1 ? "合格" : "不合格"; + unitMag = tempT.getUnit(); + errorScopeMag = tempT.getRadius(); + } + } else if (temp.getCode().equalsIgnoreCase("DUR")) { + // 持续时间,需要注意时间单位处理,默认是秒 + String timeUnit = "s"; + for (String tableKey : tableKeys) { + if (tableKey.contains(ItemReportKeyEnum.STANDARD_DUR.getKey())) { + //截取单位 + String[] tempStr = tableKey.split(StrPool.UNDERLINE); + if (tempStr.length > 1) { + if (tempStr[1].equalsIgnoreCase("ms")) { + timeUnit = "ms"; + } + } + } + } + standardDur = PubUtils.doubleRoundStr(4, tempT.getResultData()); + testDur = PubUtils.doubleRoundStr(4, tempT.getData()); + errorDur = PubUtils.doubleRoundStr(4, tempT.getErrorData().doubleValue()); + resultDur = tempT.getIsData() == 1 ? "合格" : "不合格"; + unitDur = tempT.getUnit(); + errorScopeDur = tempT.getRadius(); + if (timeUnit.equalsIgnoreCase("ms")) { + // 如果是ms,上述的一些数据需要重新处理 + if (!standardDur.equalsIgnoreCase("/")) { + standardDur = PubUtils.doubleRoundStr(4, Double.parseDouble(standardDur) * 1000); + } + if (!testDur.equalsIgnoreCase("/")) { + testDur = PubUtils.doubleRoundStr(4, Double.parseDouble(testDur) * 1000); + } + if (!errorDur.equalsIgnoreCase("/")) { + errorDur = PubUtils.doubleRoundStr(4, Double.parseDouble(errorDur) * 1000); + } + if (!errorScopeDur.equalsIgnoreCase("/")) { + if (errorScopeDur.contains("~")) { + String[] tempStr = errorScopeDur.split("~"); + errorScopeDur = PubUtils.doubleRoundStr(0, Double.parseDouble(tempStr[0]) * 1000).concat("~").concat(PubUtils.doubleRoundStr(0, Double.parseDouble(tempStr[1]) * 1000)); + } + } + unitDur = "ms"; + } + } + } + errorScopeMag = dealErrorScope(errorScopeMag).concat(unitMag); + errorScopeDur = dealErrorScope(errorScopeDur).concat(unitDur); + + errorScope = "特征幅值:".concat(errorScopeMag).concat(StrPool.COMMA).concat("持续时间:").concat(errorScopeDur); + keyFillMap.put(ItemReportKeyEnum.ERROR_SCOPE.getKey(), errorScope); + // 标准值 + keyFillMap.put(ItemReportKeyEnum.STANDARD_MAG.getKey(), standardMag); + keyFillMap.put(ItemReportKeyEnum.STANDARD_DUR.getKey(), standardDur); + // 测试值 + keyFillMap.put(ItemReportKeyEnum.TEST_MAG.getKey(), testMag); + keyFillMap.put(ItemReportKeyEnum.TEST_DUR.getKey(), testDur); + // 误差 + keyFillMap.put(ItemReportKeyEnum.ERROR_MAG.getKey(), errorMag); + keyFillMap.put(ItemReportKeyEnum.ERROR_DUR.getKey(), errorDur); + // 结果 + keyFillMap.put(ItemReportKeyEnum.RESULT_MAG.getKey(), resultMag); + keyFillMap.put(ItemReportKeyEnum.RESULT_DUR.getKey(), resultDur); + // 综合结果 + result = resultMag; + if (!resultDur.equals("/") && result.equals("合格")) { + if (resultDur.equals("不合格")) { + result = "不合格"; + } + } + keyFillMap.put(ItemReportKeyEnum.RESULT.getKey(), result); + } + + /** * 处理下误差范围,如果正负数一致时调整为±的形式 * 数据库中一般形式为:-0.1155~0.1155