|
|
|
@ -1162,21 +1162,24 @@ public class PatrolResultServiceImpl implements IPatrolResultService { |
|
|
|
int failNum = 0; |
|
|
|
int confirmNum = 0; |
|
|
|
List<ResultAnalysis> analyses = resultAnalysisMapper.selectResultAnalysisListByMainIdsNew(lineIds, null); |
|
|
|
int totalNum = analyses.size(); |
|
|
|
log.info("lineIds:{},statisticsAnalyseNum analyses:{}", lineIds, analyses); |
|
|
|
for (ResultAnalysis analyse : analyses) { |
|
|
|
String resultType = analyse.getResultType(); |
|
|
|
if ("0".equals(resultType)) { |
|
|
|
++confirmNum; |
|
|
|
} else if (("1").equals(resultType)) { |
|
|
|
++okNum; |
|
|
|
} else if (("2").equals(resultType)) { |
|
|
|
++failNum; |
|
|
|
} |
|
|
|
} |
|
|
|
if ("0".equals(exportReportFlag)) { |
|
|
|
return String.format(messageUtils.get("缺陷点位:%d个。"), confirmNum); |
|
|
|
// 直导缺陷 |
|
|
|
List<ResultAnalysis> qxResultAnalyses = analyses.stream().filter(analysis -> "0".equals(analysis.getResultType())).collect(Collectors.toList()); |
|
|
|
long count = qxResultAnalyses.stream().map(analysis -> analysis.getAlgType() + "|" + analysis.getObjectId()).distinct().count(); |
|
|
|
return String.format(messageUtils.get("缺陷点位:%d个。"), count); |
|
|
|
} else { |
|
|
|
int totalNum = analyses.size(); |
|
|
|
log.info("lineIds:{},statisticsAnalyseNum analyses:{}", lineIds, analyses); |
|
|
|
for (ResultAnalysis analyse : analyses) { |
|
|
|
String resultType = analyse.getResultType(); |
|
|
|
if ("0".equals(resultType)) { |
|
|
|
++confirmNum; |
|
|
|
} else if (("1").equals(resultType)) { |
|
|
|
++okNum; |
|
|
|
} else if (("2").equals(resultType)) { |
|
|
|
++failNum; |
|
|
|
} |
|
|
|
} |
|
|
|
return String.format(messageUtils.get("本次任务巡视总点位:%d个,已检点位:%d个,未检点位:0个,正常点位:%d个,异常点位:%d个,缺陷点位:%d个。"), totalNum, totalNum, okNum, failNum, confirmNum); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -1274,18 +1277,18 @@ public class PatrolResultServiceImpl implements IPatrolResultService { |
|
|
|
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); |
|
|
|
} |
|
|
|
// 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); |
|
|
|
// } |
|
|
|
|
|
|
|
InspectionReport report = new InspectionReport(); |
|
|
|
report.setInspectionDate(new Date()); |
|
|
|
@ -1294,7 +1297,7 @@ public class PatrolResultServiceImpl implements IPatrolResultService { |
|
|
|
report.setInspectionStartTime(startTimes.get(0)); |
|
|
|
report.setInspectionEndTime(DateUtils.parseDate(endTimes.get(endTimes.size() - 1))); |
|
|
|
// report.setTaskId(String.valueOf(task.getTaskId())); |
|
|
|
report.setEnvInfo(StringUtils.join(envoList,",")); |
|
|
|
// report.setEnvInfo(StringUtils.join(envoList,",")); |
|
|
|
// report.setTaskPatrolledId(taskPatrolId); |
|
|
|
report.setInspectionTaskName(taskName); |
|
|
|
report.setDescription(patrolTaskResultMain.getTaskResult()); |
|
|
|
@ -1306,8 +1309,39 @@ public class PatrolResultServiceImpl implements IPatrolResultService { |
|
|
|
report.setStationType(stationType); |
|
|
|
|
|
|
|
if ("0".equals(exportReportFlag)) { |
|
|
|
// 导出缺陷 |
|
|
|
List <PatrolResultRef> resultRefs = new ArrayList<>(); |
|
|
|
// 只导出缺陷 |
|
|
|
patrolResultRefs = patrolResultRefs.stream().filter((item) -> "0".equals(item.getResultType())).collect(Collectors.toList()); |
|
|
|
// 分组,按点位ID和算法类型进行分组 |
|
|
|
Map<GroupKey, List<PatrolResultRef>> groupKeyListMap = patrolResultRefs.stream().collect(Collectors.groupingBy(item -> new GroupKey(item.getDeviceId(), item.getAlgType()))); |
|
|
|
groupKeyListMap.forEach((key, value) -> { |
|
|
|
PatrolResultRef patrolResultRef = new PatrolResultRef(); |
|
|
|
patrolResultRef.setDeviceId(key.objectId); |
|
|
|
patrolResultRef.setAlgType(key.algType); |
|
|
|
patrolResultRef.setDescription(value.stream().map(PatrolResultRef::getDescription).collect(Collectors.joining(","))); |
|
|
|
patrolResultRef.setValue(value.stream().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()); |
|
|
|
} |
|
|
|
} |
|
|
|
patrolResultRef.setDevType(value.stream().map(item -> item.getDevType() != null ? item.getDevType() : "").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; |
|
|
|
} |
|
|
|
|
|
|
|
List<BasePointAreaInfo> basePointAreaInfoList = patrolResultMapper.selectBaseInfoByMainIds(lineIds); |
|
|
|
@ -1401,6 +1435,30 @@ public class PatrolResultServiceImpl implements IPatrolResultService { |
|
|
|
return report; |
|
|
|
} |
|
|
|
|
|
|
|
private static class GroupKey { |
|
|
|
private final String objectId; |
|
|
|
private final String algType; |
|
|
|
|
|
|
|
public GroupKey(String objectId, String algType) { |
|
|
|
this.objectId = objectId; |
|
|
|
this.algType = algType; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public boolean equals(Object o) { |
|
|
|
if (this == o) return true; |
|
|
|
if (o == null || getClass() != o.getClass()) return false; |
|
|
|
GroupKey groupKey = (GroupKey) o; |
|
|
|
return Objects.equals(objectId, groupKey.objectId) && Objects.equals(algType, groupKey.algType); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public int hashCode() { |
|
|
|
return Objects.hash(objectId, algType); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public static void main(String[] args) { |
|
|
|
List<String> students = new ArrayList<>(); |
|
|
|
students.add("s1"); |
|
|
|
|