|
|
@ -635,207 +635,212 @@ public class PatrolResultServiceImpl implements IPatrolResultService { |
|
|
PatrolTaskStatus taskStatus = taskStatuses.get(0); |
|
|
PatrolTaskStatus taskStatus = taskStatuses.get(0); |
|
|
List<PatrolTask> list = patrolTaskMapper.selectPatrolTaskList(PatrolTask.builder().taskCode(taskCode).build()); |
|
|
List<PatrolTask> list = patrolTaskMapper.selectPatrolTaskList(PatrolTask.builder().taskCode(taskCode).build()); |
|
|
startTime = PrintUtil.useTime("INQUIRY TASK PLAN", startTime); |
|
|
startTime = PrintUtil.useTime("INQUIRY TASK PLAN", startTime); |
|
|
|
|
|
|
|
|
|
|
|
List<Long> reportIds = new ArrayList<>(); |
|
|
|
|
|
PatrolTask task = new PatrolTask(); |
|
|
if (list.isEmpty()) { |
|
|
if (list.isEmpty()) { |
|
|
throw new ServiceException("TASK PLAN LOST: " + taskCode); |
|
|
|
|
|
|
|
|
log.error("TASK PLAN LOST: " + taskCode); |
|
|
} else { |
|
|
} else { |
|
|
List<Long> reportIds = new ArrayList<>(); |
|
|
|
|
|
PatrolTask task = list.get(0); |
|
|
|
|
|
Map<String, String> stationMap = patrolResultMapper.selectBasedataStation(); |
|
|
|
|
|
String stationName = stationMap.get("station_name"); |
|
|
|
|
|
String stationType = stationMap.get("station_type"); |
|
|
|
|
|
String voltLevel = stationMap.get("volt_level"); |
|
|
|
|
|
AjaxResult ajaxResult = feignBasedataAreaService.evnList(); |
|
|
|
|
|
List<JSONObject> jsonObjects = JSONObject.parseArray(JSON.toJSONString(ajaxResult.get("data")), JSONObject.class); |
|
|
|
|
|
log.info("EVN LIST: " + jsonObjects); |
|
|
|
|
|
List<String> envoList = new ArrayList<>(); |
|
|
|
|
|
for (JSONObject jsonObject : jsonObjects) { |
|
|
|
|
|
String typeName = jsonObject.getString("typeName"); |
|
|
|
|
|
String valueUnit = jsonObject.getString("valueUnit"); |
|
|
|
|
|
if (StringUtils.isEmpty(valueUnit) || StringUtils.isEmpty(typeName)) { |
|
|
|
|
|
continue; |
|
|
|
|
|
} |
|
|
|
|
|
envoList.add(typeName + ":" + valueUnit); |
|
|
|
|
|
|
|
|
task = list.get(0); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Map<String, String> stationMap = patrolResultMapper.selectBasedataStation(); |
|
|
|
|
|
String stationName = stationMap.get("station_name"); |
|
|
|
|
|
String stationType = stationMap.get("station_type"); |
|
|
|
|
|
String voltLevel = stationMap.get("volt_level"); |
|
|
|
|
|
AjaxResult ajaxResult = feignBasedataAreaService.evnList(); |
|
|
|
|
|
List<JSONObject> jsonObjects = JSONObject.parseArray(JSON.toJSONString(ajaxResult.get("data")), JSONObject.class); |
|
|
|
|
|
log.info("EVN LIST: " + jsonObjects); |
|
|
|
|
|
List<String> envoList = new ArrayList<>(); |
|
|
|
|
|
for (JSONObject jsonObject : jsonObjects) { |
|
|
|
|
|
String typeName = jsonObject.getString("typeName"); |
|
|
|
|
|
String valueUnit = jsonObject.getString("valueUnit"); |
|
|
|
|
|
if (StringUtils.isEmpty(valueUnit) || StringUtils.isEmpty(typeName)) { |
|
|
|
|
|
continue; |
|
|
} |
|
|
} |
|
|
|
|
|
envoList.add(typeName + ":" + valueUnit); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
List<PatrolResultRef> patrolResultRefs = patrolResultMapper.selectResultRefByLineIds(lineIds, null); |
|
|
|
|
|
Map<GroupKey, List<PatrolResultRef>> groupKeyListMap; |
|
|
|
|
|
if ("0".equals(exportReportFlag)) { |
|
|
|
|
|
List <PatrolResultRef> resultRefs = new ArrayList<>(); |
|
|
|
|
|
// 只导出缺陷 |
|
|
|
|
|
patrolResultRefs = patrolResultRefs.stream().filter((item) -> "0".equals(item.getResultType())).collect(Collectors.toList()); |
|
|
|
|
|
// 分组,按点位ID和算法类型进行分组 |
|
|
|
|
|
groupKeyListMap = patrolResultRefs.stream().collect(Collectors.groupingBy(item -> new GroupKey(item.getDeviceId(), item.getAlgType(), item.getTaskPatrolledId()))); |
|
|
|
|
|
groupKeyListMap.forEach((key, value) -> { |
|
|
|
|
|
PatrolResultRef patrolResultRef = new PatrolResultRef(); |
|
|
|
|
|
patrolResultRef.setDeviceId(key.objectId); |
|
|
|
|
|
patrolResultRef.setAlgType(key.algType); |
|
|
|
|
|
patrolResultRef.setDescription(value.stream().sorted(Comparator.comparing(PatrolResultRef::getFilter).reversed()).map(PatrolResultRef::getDescription).collect(Collectors.joining(","))); |
|
|
|
|
|
patrolResultRef.setValue(value.stream().sorted(Comparator.comparing(PatrolResultRef::getFilter).reversed()).map(PatrolResultRef::getValue).collect(Collectors.joining(","))); |
|
|
|
|
|
for (PatrolResultRef resultRef : value) { |
|
|
|
|
|
// 初筛有缺陷,展示初筛结果 |
|
|
|
|
|
if ("1".equals(resultRef.getFilter()) && StringUtils.isEmpty(patrolResultRef.getResultContent())) { |
|
|
|
|
|
patrolResultRef.setResultContent(resultRef.getResultContent()); |
|
|
|
|
|
} |
|
|
|
|
|
if ("1".equals(resultRef.getFilter()) && StringUtils.isEmpty(patrolResultRef.getFilePath())) { |
|
|
|
|
|
patrolResultRef.setFilePath(resultRef.getFilePath()); |
|
|
|
|
|
} |
|
|
|
|
|
// 大模型有缺陷,展示大模型结果 |
|
|
|
|
|
if ("0".equals(resultRef.getFilter())) { |
|
|
|
|
|
patrolResultRef.setResultContent(resultRef.getResultContent()); |
|
|
|
|
|
patrolResultRef.setFilePath(resultRef.getFilePath()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
List<PatrolResultRef> patrolResultRefs = patrolResultMapper.selectResultRefByLineIds(lineIds, null); |
|
|
|
|
|
Map<GroupKey, List<PatrolResultRef>> groupKeyListMap; |
|
|
|
|
|
if ("0".equals(exportReportFlag)) { |
|
|
|
|
|
List <PatrolResultRef> resultRefs = new ArrayList<>(); |
|
|
|
|
|
// 只导出缺陷 |
|
|
|
|
|
patrolResultRefs = patrolResultRefs.stream().filter((item) -> "0".equals(item.getResultType())).collect(Collectors.toList()); |
|
|
|
|
|
// 分组,按点位ID和算法类型进行分组 |
|
|
|
|
|
groupKeyListMap = patrolResultRefs.stream().collect(Collectors.groupingBy(item -> new GroupKey(item.getDeviceId(), item.getAlgType(), item.getTaskPatrolledId()))); |
|
|
|
|
|
groupKeyListMap.forEach((key, value) -> { |
|
|
|
|
|
PatrolResultRef patrolResultRef = new PatrolResultRef(); |
|
|
|
|
|
patrolResultRef.setDeviceId(key.objectId); |
|
|
|
|
|
patrolResultRef.setAlgType(key.algType); |
|
|
|
|
|
patrolResultRef.setDescription(value.stream().sorted(Comparator.comparing(PatrolResultRef::getFilter).reversed()).map(PatrolResultRef::getDescription).collect(Collectors.joining(","))); |
|
|
|
|
|
patrolResultRef.setValue(value.stream().sorted(Comparator.comparing(PatrolResultRef::getFilter).reversed()).map(PatrolResultRef::getValue).collect(Collectors.joining(","))); |
|
|
|
|
|
for (PatrolResultRef resultRef : value) { |
|
|
|
|
|
// 初筛有缺陷,展示初筛结果 |
|
|
|
|
|
if ("1".equals(resultRef.getFilter()) && StringUtils.isEmpty(patrolResultRef.getResultContent())) { |
|
|
|
|
|
patrolResultRef.setResultContent(resultRef.getResultContent()); |
|
|
} |
|
|
} |
|
|
patrolResultRef.setDevType(value.stream().map(item -> item.getDevType() != null ? item.getDevType() : "").distinct().findFirst().orElse("")); |
|
|
|
|
|
patrolResultRef.setDeviceSource(value.stream().map(item -> item.getDeviceSource() != null ? item.getDeviceSource() : "").distinct().findFirst().orElse("")); |
|
|
|
|
|
patrolResultRef.setTime(value.stream().map(item -> item.getTime() != null ? item.getTime() : "").distinct().findFirst().orElse("")); |
|
|
|
|
|
patrolResultRef.setThreshold(value.stream().map(item -> item.getThreshold() != null ? item.getThreshold() : "").distinct().findFirst().orElse("")); |
|
|
|
|
|
patrolResultRef.setAlgName(value.get(0).getAlgName()); |
|
|
|
|
|
patrolResultRef.setResultType("0"); |
|
|
|
|
|
resultRefs.add(patrolResultRef); |
|
|
|
|
|
}); |
|
|
|
|
|
patrolResultRefs = resultRefs; |
|
|
|
|
|
} else { |
|
|
|
|
|
groupKeyListMap = patrolResultRefs.stream().collect(Collectors.groupingBy(item -> new GroupKey(item.getDeviceId(), item.getAlgType(), item.getTaskPatrolledId()))); |
|
|
|
|
|
List<PatrolResultRef> processedRefs = new ArrayList<>(); |
|
|
|
|
|
for (Map.Entry<GroupKey, List<PatrolResultRef>> entry : groupKeyListMap.entrySet()) { |
|
|
|
|
|
List<PatrolResultRef> value = entry.getValue(); |
|
|
|
|
|
GroupKey key = entry.getKey(); |
|
|
|
|
|
String algType = key.algType; |
|
|
|
|
|
List<PatrolResultRef> filterResults = value.stream().filter(item -> "1".equals(item.getFilter())).collect(Collectors.toList()); |
|
|
|
|
|
List<PatrolResultRef> AIResults = value.stream().filter(item -> "0".equals(item.getFilter())).collect(Collectors.toList()); |
|
|
|
|
|
PatrolResultRef filterResult = filterResults.isEmpty() ? null : filterResults.get(0); |
|
|
|
|
|
PatrolResultRef AIResult = AIResults.isEmpty() ? null : AIResults.get(0); |
|
|
|
|
|
|
|
|
|
|
|
if (AlgConstants.METER.equalsIgnoreCase(algType)) { |
|
|
|
|
|
// 表计处理 |
|
|
|
|
|
if (filterResult != null && AIResult != null) { |
|
|
|
|
|
String filterResultType = filterResult.getResultType(); |
|
|
|
|
|
String AIResultType = AIResult.getResultType(); |
|
|
|
|
|
if ("1".equals(filterResultType)) { // 初筛正常 |
|
|
|
|
|
// 只归档大模型 |
|
|
|
|
|
|
|
|
if ("1".equals(resultRef.getFilter()) && StringUtils.isEmpty(patrolResultRef.getFilePath())) { |
|
|
|
|
|
patrolResultRef.setFilePath(resultRef.getFilePath()); |
|
|
|
|
|
} |
|
|
|
|
|
// 大模型有缺陷,展示大模型结果 |
|
|
|
|
|
if ("0".equals(resultRef.getFilter())) { |
|
|
|
|
|
patrolResultRef.setResultContent(resultRef.getResultContent()); |
|
|
|
|
|
patrolResultRef.setFilePath(resultRef.getFilePath()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
patrolResultRef.setDevType(value.stream().map(item -> item.getDevType() != null ? item.getDevType() : "").distinct().findFirst().orElse("")); |
|
|
|
|
|
patrolResultRef.setDeviceSource(value.stream().map(item -> item.getDeviceSource() != null ? item.getDeviceSource() : "").distinct().findFirst().orElse("")); |
|
|
|
|
|
patrolResultRef.setTime(value.stream().map(item -> item.getTime() != null ? item.getTime() : "").distinct().findFirst().orElse("")); |
|
|
|
|
|
patrolResultRef.setThreshold(value.stream().map(item -> item.getThreshold() != null ? item.getThreshold() : "").distinct().findFirst().orElse("")); |
|
|
|
|
|
patrolResultRef.setAlgName(value.get(0).getAlgName()); |
|
|
|
|
|
patrolResultRef.setResultType("0"); |
|
|
|
|
|
resultRefs.add(patrolResultRef); |
|
|
|
|
|
}); |
|
|
|
|
|
patrolResultRefs = resultRefs; |
|
|
|
|
|
} else { |
|
|
|
|
|
groupKeyListMap = patrolResultRefs.stream().collect(Collectors.groupingBy(item -> new GroupKey(item.getDeviceId(), item.getAlgType(), item.getTaskPatrolledId()))); |
|
|
|
|
|
List<PatrolResultRef> processedRefs = new ArrayList<>(); |
|
|
|
|
|
for (Map.Entry<GroupKey, List<PatrolResultRef>> entry : groupKeyListMap.entrySet()) { |
|
|
|
|
|
List<PatrolResultRef> value = entry.getValue(); |
|
|
|
|
|
GroupKey key = entry.getKey(); |
|
|
|
|
|
String algType = key.algType; |
|
|
|
|
|
List<PatrolResultRef> filterResults = value.stream().filter(item -> "1".equals(item.getFilter())).collect(Collectors.toList()); |
|
|
|
|
|
List<PatrolResultRef> AIResults = value.stream().filter(item -> "0".equals(item.getFilter())).collect(Collectors.toList()); |
|
|
|
|
|
PatrolResultRef filterResult = filterResults.isEmpty() ? null : filterResults.get(0); |
|
|
|
|
|
PatrolResultRef AIResult = AIResults.isEmpty() ? null : AIResults.get(0); |
|
|
|
|
|
|
|
|
|
|
|
if (AlgConstants.BIG_MODEL_ALG_LIST.contains(algType)) { |
|
|
|
|
|
// 表计类处理 |
|
|
|
|
|
if (filterResult != null && AIResult != null) { |
|
|
|
|
|
String filterResultType = filterResult.getResultType(); |
|
|
|
|
|
String AIResultType = AIResult.getResultType(); |
|
|
|
|
|
if ("1".equals(filterResultType)) { // 初筛正常 |
|
|
|
|
|
// 只归档大模型 |
|
|
|
|
|
processedRefs.add(AIResult); |
|
|
|
|
|
} else if ("0".equals(filterResultType)) { // 初筛缺陷 |
|
|
|
|
|
if ("1".equals(AIResultType)) { |
|
|
|
|
|
// 分开:初筛缺陷,大模型正常 |
|
|
|
|
|
processedRefs.add(filterResult); |
|
|
processedRefs.add(AIResult); |
|
|
processedRefs.add(AIResult); |
|
|
} else if ("0".equals(filterResultType)) { // 初筛缺陷 |
|
|
|
|
|
if ("1".equals(AIResultType)) { |
|
|
|
|
|
// 分开:初筛缺陷,大模型正常 |
|
|
|
|
|
processedRefs.add(filterResult); |
|
|
|
|
|
processedRefs.add(AIResult); |
|
|
|
|
|
} else if ("0".equals(AIResultType)) { |
|
|
|
|
|
// 合并:初筛缺陷,大模型缺陷 |
|
|
|
|
|
PatrolResultRef merged = mergePatrolResultRef(filterResult, AIResult, "0"); |
|
|
|
|
|
processedRefs.add(merged); |
|
|
|
|
|
} else if ("2".equals(AIResultType)) { |
|
|
|
|
|
// 分开:初筛缺陷,大模型异常 |
|
|
|
|
|
processedRefs.add(filterResult); |
|
|
|
|
|
processedRefs.add(AIResult); |
|
|
|
|
|
} |
|
|
|
|
|
} else if ("2".equals(filterResultType)) { // 初筛异常 |
|
|
|
|
|
if ("1".equals(AIResultType)) { |
|
|
|
|
|
// 分开:初筛异常,大模型正常 |
|
|
|
|
|
processedRefs.add(filterResult); |
|
|
|
|
|
processedRefs.add(AIResult); |
|
|
|
|
|
} else if ("0".equals(AIResultType)) { |
|
|
|
|
|
// 分开:初筛异常,大模型缺陷 |
|
|
|
|
|
processedRefs.add(filterResult); |
|
|
|
|
|
processedRefs.add(AIResult); |
|
|
|
|
|
} else if ("2".equals(AIResultType)) { |
|
|
|
|
|
// 合并:初筛异常,大模型异常 |
|
|
|
|
|
PatrolResultRef merged = mergePatrolResultRef(filterResult, AIResult, "2"); |
|
|
|
|
|
processedRefs.add(merged); |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
// 未知类型,都添加 |
|
|
|
|
|
|
|
|
} else if ("0".equals(AIResultType)) { |
|
|
|
|
|
// 合并:初筛缺陷,大模型缺陷 |
|
|
|
|
|
PatrolResultRef merged = mergePatrolResultRef(filterResult, AIResult, "0"); |
|
|
|
|
|
processedRefs.add(merged); |
|
|
|
|
|
} else if ("2".equals(AIResultType)) { |
|
|
|
|
|
// 分开:初筛缺陷,大模型异常 |
|
|
|
|
|
processedRefs.add(filterResult); |
|
|
|
|
|
processedRefs.add(AIResult); |
|
|
|
|
|
} |
|
|
|
|
|
} else if ("2".equals(filterResultType)) { // 初筛异常 |
|
|
|
|
|
if ("1".equals(AIResultType)) { |
|
|
|
|
|
// 分开:初筛异常,大模型正常 |
|
|
|
|
|
processedRefs.add(filterResult); |
|
|
|
|
|
processedRefs.add(AIResult); |
|
|
|
|
|
} else if ("0".equals(AIResultType)) { |
|
|
|
|
|
// 分开:初筛异常,大模型缺陷 |
|
|
processedRefs.add(filterResult); |
|
|
processedRefs.add(filterResult); |
|
|
processedRefs.add(AIResult); |
|
|
processedRefs.add(AIResult); |
|
|
|
|
|
} else if ("2".equals(AIResultType)) { |
|
|
|
|
|
// 合并:初筛异常,大模型异常 |
|
|
|
|
|
PatrolResultRef merged = mergePatrolResultRef(filterResult, AIResult, "2"); |
|
|
|
|
|
processedRefs.add(merged); |
|
|
} |
|
|
} |
|
|
} else if (filterResult != null) { |
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
// 未知类型,都添加 |
|
|
processedRefs.add(filterResult); |
|
|
processedRefs.add(filterResult); |
|
|
} else if (AIResult != null) { |
|
|
|
|
|
processedRefs.add(AIResult); |
|
|
processedRefs.add(AIResult); |
|
|
} |
|
|
} |
|
|
} else { |
|
|
|
|
|
// 外观处理 |
|
|
|
|
|
if (filterResult != null && AIResult != null) { |
|
|
|
|
|
String filterResultType = filterResult.getResultType(); |
|
|
|
|
|
String AIResultType = AIResult.getResultType(); |
|
|
|
|
|
if ("0".equals(filterResultType)) { // 初筛缺陷 |
|
|
|
|
|
if ("1".equals(AIResultType)) { |
|
|
|
|
|
// 分开:初筛缺陷,大模型正常 |
|
|
|
|
|
processedRefs.add(filterResult); |
|
|
|
|
|
processedRefs.add(AIResult); |
|
|
|
|
|
} else if ("0".equals(AIResultType)) { |
|
|
|
|
|
// 合并:初筛缺陷,大模型缺陷 |
|
|
|
|
|
PatrolResultRef merged = mergePatrolResultRef(filterResult, AIResult, "0"); |
|
|
|
|
|
processedRefs.add(merged); |
|
|
|
|
|
} else if ("2".equals(AIResultType)) { |
|
|
|
|
|
// 分开:初筛缺陷,大模型异常 |
|
|
|
|
|
processedRefs.add(filterResult); |
|
|
|
|
|
processedRefs.add(AIResult); |
|
|
|
|
|
} else { |
|
|
|
|
|
// 未知,都添加 |
|
|
|
|
|
processedRefs.add(filterResult); |
|
|
|
|
|
processedRefs.add(AIResult); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} else if (filterResult != null) { |
|
|
|
|
|
processedRefs.add(filterResult); |
|
|
|
|
|
} else if (AIResult != null) { |
|
|
|
|
|
processedRefs.add(AIResult); |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
// 外观处理 |
|
|
|
|
|
if (filterResult != null && AIResult != null) { |
|
|
|
|
|
String filterResultType = filterResult.getResultType(); |
|
|
|
|
|
String AIResultType = AIResult.getResultType(); |
|
|
|
|
|
if ("0".equals(filterResultType)) { // 初筛缺陷 |
|
|
|
|
|
if ("1".equals(AIResultType)) { |
|
|
|
|
|
// 分开:初筛缺陷,大模型正常 |
|
|
|
|
|
processedRefs.add(filterResult); |
|
|
|
|
|
processedRefs.add(AIResult); |
|
|
|
|
|
} else if ("0".equals(AIResultType)) { |
|
|
|
|
|
// 合并:初筛缺陷,大模型缺陷 |
|
|
|
|
|
PatrolResultRef merged = mergePatrolResultRef(filterResult, AIResult, "0"); |
|
|
|
|
|
processedRefs.add(merged); |
|
|
|
|
|
} else if ("2".equals(AIResultType)) { |
|
|
|
|
|
// 分开:初筛缺陷,大模型异常 |
|
|
|
|
|
processedRefs.add(filterResult); |
|
|
|
|
|
processedRefs.add(AIResult); |
|
|
} else { |
|
|
} else { |
|
|
// 初筛不是缺陷但有大模型(理论上不应出现),为保数据完整都添加 |
|
|
|
|
|
|
|
|
// 未知,都添加 |
|
|
processedRefs.add(filterResult); |
|
|
processedRefs.add(filterResult); |
|
|
processedRefs.add(AIResult); |
|
|
processedRefs.add(AIResult); |
|
|
} |
|
|
} |
|
|
} else if (filterResult != null) { |
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
// 初筛不是缺陷但有大模型(理论上不应出现),为保数据完整都添加 |
|
|
processedRefs.add(filterResult); |
|
|
processedRefs.add(filterResult); |
|
|
} else if (AIResult != null) { |
|
|
|
|
|
processedRefs.add(AIResult); |
|
|
processedRefs.add(AIResult); |
|
|
} |
|
|
} |
|
|
|
|
|
} else if (filterResult != null) { |
|
|
|
|
|
processedRefs.add(filterResult); |
|
|
|
|
|
} else if (AIResult != null) { |
|
|
|
|
|
processedRefs.add(AIResult); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
patrolResultRefs = processedRefs; |
|
|
|
|
|
} |
|
|
|
|
|
long okNum = 0L; |
|
|
|
|
|
long failNum = 0L; |
|
|
|
|
|
long defectNum = 0L; |
|
|
|
|
|
for (PatrolResultRef patrolResultRef : patrolResultRefs) { |
|
|
|
|
|
String resultType = patrolResultRef.getResultType(); |
|
|
|
|
|
if(resultType == null) { |
|
|
|
|
|
continue; |
|
|
|
|
|
} else if (resultType.equals("0")) { |
|
|
|
|
|
// 缺陷编号 |
|
|
|
|
|
++defectNum; |
|
|
|
|
|
} else if (resultType.equals("1")) { |
|
|
|
|
|
// 正常编号 |
|
|
|
|
|
++okNum; |
|
|
|
|
|
} else { |
|
|
|
|
|
// 异常编号 |
|
|
|
|
|
++failNum; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
String patrolStatistics; |
|
|
|
|
|
if ("0".equals(exportReportFlag)) { |
|
|
|
|
|
patrolStatistics = String.format(messageUtils.get("缺陷数量:%d个。"), defectNum); |
|
|
|
|
|
|
|
|
patrolResultRefs = processedRefs; |
|
|
|
|
|
} |
|
|
|
|
|
long okNum = 0L; |
|
|
|
|
|
long failNum = 0L; |
|
|
|
|
|
long defectNum = 0L; |
|
|
|
|
|
for (PatrolResultRef patrolResultRef : patrolResultRefs) { |
|
|
|
|
|
String resultType = patrolResultRef.getResultType(); |
|
|
|
|
|
if(resultType == null) { |
|
|
|
|
|
continue; |
|
|
|
|
|
} else if (resultType.equals("0")) { |
|
|
|
|
|
// 缺陷编号 |
|
|
|
|
|
++defectNum; |
|
|
|
|
|
} else if (resultType.equals("1")) { |
|
|
|
|
|
// 正常编号 |
|
|
|
|
|
++okNum; |
|
|
} else { |
|
|
} else { |
|
|
patrolStatistics = String.format(messageUtils.get("本次任务巡视总结果数量:%d个,正常结果数量:%d个,异常结果数量:%d个,缺陷结果数量:%d个。"), patrolResultRefs.size(), okNum, failNum, defectNum); |
|
|
|
|
|
|
|
|
// 异常编号 |
|
|
|
|
|
++failNum; |
|
|
} |
|
|
} |
|
|
InspectionReport report = new InspectionReport(); |
|
|
|
|
|
resetReport(report, patrolStatistics, mainId, task, taskStatus); |
|
|
|
|
|
report.setTaskId(String.valueOf(task.getTaskId())); |
|
|
|
|
|
report.setEnvInfo(StringUtils.join(envoList,",")); |
|
|
|
|
|
report.setTaskPatrolledId(taskPatrolId); |
|
|
|
|
|
report.setInspectionTaskName(taskName); |
|
|
|
|
|
report.setDescription(resultMain.getTaskResult()); |
|
|
|
|
|
report.setCheckPerson(resultMain.getCheckPerson()); |
|
|
|
|
|
report.setCheckTime(resultMain.getCheckTime()); |
|
|
|
|
|
report.setStationName(stationName); |
|
|
|
|
|
report.setVoltLevel(StringUtils.isEmpty(voltLevel) ? voltage : voltLevel); |
|
|
|
|
|
report.setFilter("0"); |
|
|
|
|
|
report.setStationType(stationType); |
|
|
|
|
|
inspectionReportMapper.insertInspectionReport(report); |
|
|
|
|
|
PrintUtil.useTime("NEW TASK REPORT", startTime); |
|
|
|
|
|
batchInsertReportData_shaoxing(String.valueOf(report.getLineId()), lineIds, "0", patrolResultRefs); |
|
|
|
|
|
PrintUtil.useTime("BATCH INSERT DETAIL", startTime); |
|
|
|
|
|
log.info("[ARCHIVE] reportId: {}", report.getLineId()); |
|
|
|
|
|
Long lineId = report.getLineId(); |
|
|
|
|
|
reportIds.add(lineId); |
|
|
|
|
|
|
|
|
|
|
|
return reportIds; |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
long total = okNum + defectNum; |
|
|
|
|
|
String patrolStatistics; |
|
|
|
|
|
if ("0".equals(exportReportFlag)) { |
|
|
|
|
|
patrolStatistics = String.format(messageUtils.get("缺陷数量:%d个。"), defectNum); |
|
|
|
|
|
} else { |
|
|
|
|
|
patrolStatistics = String.format(messageUtils.get("本次任务巡视总结果数量:%d个,正常结果数量:%d个,缺陷结果数量:%d个"), total, okNum, defectNum); |
|
|
|
|
|
} |
|
|
|
|
|
InspectionReport report = new InspectionReport(); |
|
|
|
|
|
resetReport(report, patrolStatistics, mainId, task, taskStatus); |
|
|
|
|
|
report.setTaskId(task.getTaskId() == null ? "" : String.valueOf(task.getTaskId())); |
|
|
|
|
|
report.setEnvInfo(StringUtils.join(envoList,",")); |
|
|
|
|
|
report.setTaskPatrolledId(taskPatrolId); |
|
|
|
|
|
report.setInspectionTaskName(taskName); |
|
|
|
|
|
report.setDescription(resultMain.getTaskResult()); |
|
|
|
|
|
report.setCheckPerson(resultMain.getCheckPerson()); |
|
|
|
|
|
report.setCheckTime(resultMain.getCheckTime()); |
|
|
|
|
|
report.setStationName(stationName); |
|
|
|
|
|
report.setVoltLevel(StringUtils.isEmpty(voltLevel) ? voltage : voltLevel); |
|
|
|
|
|
report.setFilter("0"); |
|
|
|
|
|
report.setStationType(stationType); |
|
|
|
|
|
inspectionReportMapper.insertInspectionReport(report); |
|
|
|
|
|
PrintUtil.useTime("NEW TASK REPORT", startTime); |
|
|
|
|
|
batchInsertReportData_shaoxing(String.valueOf(report.getLineId()), lineIds, "0", patrolResultRefs); |
|
|
|
|
|
PrintUtil.useTime("BATCH INSERT DETAIL", startTime); |
|
|
|
|
|
log.info("[ARCHIVE] reportId: {}", report.getLineId()); |
|
|
|
|
|
Long lineId = report.getLineId(); |
|
|
|
|
|
reportIds.add(lineId); |
|
|
|
|
|
|
|
|
|
|
|
return reportIds; |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
@ -1929,7 +1934,7 @@ public class PatrolResultServiceImpl implements IPatrolResultService { |
|
|
PatrolResultRef filterResult = filterResults.isEmpty() ? null : filterResults.get(0); |
|
|
PatrolResultRef filterResult = filterResults.isEmpty() ? null : filterResults.get(0); |
|
|
PatrolResultRef AIResult = AIResults.isEmpty() ? null : AIResults.get(0); |
|
|
PatrolResultRef AIResult = AIResults.isEmpty() ? null : AIResults.get(0); |
|
|
|
|
|
|
|
|
if ("meter".equalsIgnoreCase(algType)) { |
|
|
|
|
|
|
|
|
if (AlgConstants.BIG_MODEL_ALG_LIST.contains(algType)) { |
|
|
// 表计处理 |
|
|
// 表计处理 |
|
|
if (filterResult != null && AIResult != null) { |
|
|
if (filterResult != null && AIResult != null) { |
|
|
String filterResultType = filterResult.getResultType(); |
|
|
String filterResultType = filterResult.getResultType(); |
|
|
@ -2099,10 +2104,11 @@ public class PatrolResultServiceImpl implements IPatrolResultService { |
|
|
reportData.setReportImgList(reportImages); |
|
|
reportData.setReportImgList(reportImages); |
|
|
reportDatas.add(reportData); |
|
|
reportDatas.add(reportData); |
|
|
} |
|
|
} |
|
|
|
|
|
long total = defectNum + okNum; |
|
|
if ("0".equals(exportReportFlag)) { |
|
|
if ("0".equals(exportReportFlag)) { |
|
|
patrolStatistics = String.format(messageUtils.get("缺陷数量:%d个。"), defectNum); |
|
|
patrolStatistics = String.format(messageUtils.get("缺陷数量:%d个。"), defectNum); |
|
|
} else { |
|
|
} else { |
|
|
patrolStatistics = String.format(messageUtils.get("本次任务巡视总结果数量:%d个,正常结果数量:%d个,异常结果数量:%d个,缺陷结果数量:%d个。"), patrolResultRefs.size(), okNum, failNum, defectNum); |
|
|
|
|
|
|
|
|
patrolStatistics = String.format(messageUtils.get("本次任务巡视总结果数量:%d个,正常结果数量:%d个,缺陷结果数量:%d个"), total, okNum, defectNum); |
|
|
} |
|
|
} |
|
|
report.setPatrolStatistics(patrolStatistics); |
|
|
report.setPatrolStatistics(patrolStatistics); |
|
|
report.setReportDatalist(reportDatas); |
|
|
report.setReportDatalist(reportDatas); |
|
|
|