|
|
@ -6,7 +6,6 @@ import com.alibaba.fastjson.JSONObject; |
|
|
import com.inspect.analysis.domain.AlgValue; |
|
|
import com.inspect.analysis.domain.AlgValue; |
|
|
import com.inspect.analysis.domain.AnalyseResPoint; |
|
|
import com.inspect.analysis.domain.AnalyseResPoint; |
|
|
import com.inspect.analysis.domain.ResultAnalysis; |
|
|
import com.inspect.analysis.domain.ResultAnalysis; |
|
|
import com.inspect.analysis.domain.resultList; |
|
|
|
|
|
import com.inspect.analysis.mapper.ResultAnalysisMapper; |
|
|
import com.inspect.analysis.mapper.ResultAnalysisMapper; |
|
|
import com.inspect.base.core.constant.AlgConstants; |
|
|
import com.inspect.base.core.constant.AlgConstants; |
|
|
import com.inspect.base.core.exception.ServiceException; |
|
|
import com.inspect.base.core.exception.ServiceException; |
|
|
@ -30,7 +29,6 @@ import com.inspect.patrolresultdefault.mapper.PatrolResultDefaultValueMapper; |
|
|
import com.inspect.resultmain.domain.PatrolTaskResultMain; |
|
|
import com.inspect.resultmain.domain.PatrolTaskResultMain; |
|
|
import com.inspect.resultmain.mapper.PatrolTaskResultMainMapper; |
|
|
import com.inspect.resultmain.mapper.PatrolTaskResultMainMapper; |
|
|
import com.inspect.system.base.openDomain.BasedataEqpBookMoMain; |
|
|
import com.inspect.system.base.openDomain.BasedataEqpBookMoMain; |
|
|
import com.inspect.system.base.openDomain.PatrolTaskDomain; |
|
|
|
|
|
import com.inspect.task.domain.PatrolData; |
|
|
import com.inspect.task.domain.PatrolData; |
|
|
import com.inspect.task.domain.PatrolTask; |
|
|
import com.inspect.task.domain.PatrolTask; |
|
|
import com.inspect.task.mapper.PatrolTaskMapper; |
|
|
import com.inspect.task.mapper.PatrolTaskMapper; |
|
|
@ -503,23 +501,20 @@ public class PatrolResultServiceImpl implements IPatrolResultService { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Transactional |
|
|
@Transactional |
|
|
public List<Long> saveReportShaoxing(PatrolTaskResultMain resultMain, List<Long> lineIds, Long currentLineId, List<PatrolResult> resultList, int aiQxNum, int csQxNum) { |
|
|
|
|
|
|
|
|
public List<Long> saveReportShaoxing(PatrolTaskResultMain resultMain, List<Long> lineIds, Long currentLineId, List<PatrolResult> resultList) { |
|
|
long startTime = System.currentTimeMillis(); |
|
|
long startTime = System.currentTimeMillis(); |
|
|
List<Long> reportIds = new ArrayList<>(); |
|
|
List<Long> reportIds = new ArrayList<>(); |
|
|
// String mainId = String.valueOf(resultMain.getLineId()); |
|
|
|
|
|
for (Long lineId : lineIds) { |
|
|
for (Long lineId : lineIds) { |
|
|
resultMain.setLineId(lineId); |
|
|
resultMain.setLineId(lineId); |
|
|
resultMain.setCheckTime(new Date()); |
|
|
resultMain.setCheckTime(new Date()); |
|
|
resultMain.setFileStatus("1"); |
|
|
resultMain.setFileStatus("1"); |
|
|
this.patrolTaskResultMainMapper.updatePatrolTaskResultMain(resultMain); |
|
|
this.patrolTaskResultMainMapper.updatePatrolTaskResultMain(resultMain); |
|
|
this.patrolResultMapper.updatePatrolResultByMainId(String.valueOf(lineId)); |
|
|
this.patrolResultMapper.updatePatrolResultByMainId(String.valueOf(lineId)); |
|
|
reportIds.addAll(saveReportDataShaoxing(resultList, resultMain, lineIds, aiQxNum, csQxNum)); |
|
|
|
|
|
|
|
|
reportIds.addAll(saveReportDataShaoxing(resultList, resultMain, lineIds)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
PrintUtil.useTime("获取所有报告id", startTime); |
|
|
PrintUtil.useTime("获取所有报告id", startTime); |
|
|
return reportIds; |
|
|
return reportIds; |
|
|
// resultMain.setLineId(currentLineId); |
|
|
|
|
|
// return saveReportData(resultList, resultMain, lineIds); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Transactional |
|
|
@Transactional |
|
|
@ -617,15 +612,9 @@ public class PatrolResultServiceImpl implements IPatrolResultService { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public List<Long> saveReportDataShaoxing(List<PatrolResult> resultList, PatrolTaskResultMain resultMain, List<Long> lineIds, int aiQxNum, int csQxNum) { |
|
|
|
|
|
|
|
|
public List<Long> saveReportDataShaoxing(List<PatrolResult> resultList, PatrolTaskResultMain resultMain, List<Long> lineIds) { |
|
|
long startTime = System.currentTimeMillis(); |
|
|
long startTime = System.currentTimeMillis(); |
|
|
String mainId = String.valueOf(resultMain.getLineId()); |
|
|
String mainId = String.valueOf(resultMain.getLineId()); |
|
|
// String analyseNum = statisticsAnalyseNum(lineIds, resultList.size()); |
|
|
|
|
|
// String filterNum = statisticsAnalyseNumLingZhou(lineIds, "1"); |
|
|
|
|
|
String AiNum = statisticsAnalyseNumShaoxing(lineIds); |
|
|
|
|
|
// String[] nums = new String[]{AiNum, filterNum}; |
|
|
|
|
|
String[] nums = new String[]{AiNum}; |
|
|
|
|
|
startTime = PrintUtil.useTime("STATISTICS ANALYZE DATA", startTime); |
|
|
|
|
|
if (resultList.isEmpty()) { |
|
|
if (resultList.isEmpty()) { |
|
|
throw new ServiceException("LACK INSPECT RESULT: " + mainId); |
|
|
throw new ServiceException("LACK INSPECT RESULT: " + mainId); |
|
|
} else { |
|
|
} else { |
|
|
@ -651,15 +640,6 @@ public class PatrolResultServiceImpl implements IPatrolResultService { |
|
|
} else { |
|
|
} else { |
|
|
List<Long> reportIds = new ArrayList<>(); |
|
|
List<Long> reportIds = new ArrayList<>(); |
|
|
PatrolTask task = list.get(0); |
|
|
PatrolTask task = list.get(0); |
|
|
// List<InspectionReport> reports = inspectionReportMapper.selectInspectionReportList(new InspectionReport(mainId)); |
|
|
|
|
|
// startTime = PrintUtil.useTime("INQUIRY TASK REPORT", startTime); |
|
|
|
|
|
// InspectionReport report; |
|
|
|
|
|
// if (!reports.isEmpty()) { |
|
|
|
|
|
// report = reports.get(0); |
|
|
|
|
|
// resetReport(report, analyseNum, mainId, task, taskStatus); |
|
|
|
|
|
// inspectionReportMapper.updateInspectionReport(report); |
|
|
|
|
|
// PrintUtil.useTime("MODIFY TASK REPORT", startTime); |
|
|
|
|
|
// } else { |
|
|
|
|
|
Map<String, String> stationMap = patrolResultMapper.selectBasedataStation(); |
|
|
Map<String, String> stationMap = patrolResultMapper.selectBasedataStation(); |
|
|
String stationName = stationMap.get("station_name"); |
|
|
String stationName = stationMap.get("station_name"); |
|
|
String stationType = stationMap.get("station_type"); |
|
|
String stationType = stationMap.get("station_type"); |
|
|
@ -676,44 +656,184 @@ public class PatrolResultServiceImpl implements IPatrolResultService { |
|
|
} |
|
|
} |
|
|
envoList.add(typeName + ":" + valueUnit); |
|
|
envoList.add(typeName + ":" + valueUnit); |
|
|
} |
|
|
} |
|
|
for (int i = 0; i < nums.length; i++) { |
|
|
|
|
|
if ("0".equals(exportReportFlag) && aiQxNum == 0 && csQxNum == 0) { |
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
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)) { // 初筛正常 |
|
|
|
|
|
// 只归档大模型 |
|
|
|
|
|
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 { |
|
|
|
|
|
// 未知类型,都添加 |
|
|
|
|
|
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 { |
|
|
|
|
|
// 未知,都添加 |
|
|
|
|
|
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); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
// Map<String,PatrolResultRef> keyPatrolResultRef = new HashMap<>(); |
|
|
|
|
|
List<PatrolResultRef> patrolResultRefs = patrolResultMapper.selectResultRefByLineIds(lineIds, null); |
|
|
|
|
|
// for (PatrolResultRef AIRef : patrolResultRefs) { |
|
|
|
|
|
// keyPatrolResultRef.put(AIRef.getDeviceId() + "_" + AIRef.getAlgType(), AIRef); |
|
|
|
|
|
// } |
|
|
|
|
|
// for (PatrolResultRef filterRef : patrolResultRefsFilter) { |
|
|
|
|
|
// keyPatrolResultRef.putIfAbsent(filterRef.getDeviceId() + "_" + filterRef.getAlgType(), filterRef); |
|
|
|
|
|
// } |
|
|
|
|
|
// patrolResultRefs = new ArrayList<>(keyPatrolResultRef.values()); |
|
|
|
|
|
if (patrolResultRefs.isEmpty()) { |
|
|
|
|
|
|
|
|
patrolResultRefs = processedRefs; |
|
|
|
|
|
} |
|
|
|
|
|
long okNum = 0L; |
|
|
|
|
|
long failNum = 0L; |
|
|
|
|
|
long defectNum = 0L; |
|
|
|
|
|
for (PatrolResultRef patrolResultRef : patrolResultRefs) { |
|
|
|
|
|
String resultType = patrolResultRef.getResultType(); |
|
|
|
|
|
if(resultType == null) { |
|
|
continue; |
|
|
continue; |
|
|
|
|
|
} else if (resultType.equals("0")) { |
|
|
|
|
|
// 缺陷编号 |
|
|
|
|
|
++defectNum; |
|
|
|
|
|
} else if (resultType.equals("1")) { |
|
|
|
|
|
// 正常编号 |
|
|
|
|
|
++okNum; |
|
|
|
|
|
} else { |
|
|
|
|
|
// 异常编号 |
|
|
|
|
|
++failNum; |
|
|
} |
|
|
} |
|
|
InspectionReport report = new InspectionReport(); |
|
|
|
|
|
resetReport(report, nums[i], 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(String.valueOf(i)); |
|
|
|
|
|
report.setStationType(stationType); |
|
|
|
|
|
inspectionReportMapper.insertInspectionReport(report); |
|
|
|
|
|
PrintUtil.useTime("NEW TASK REPORT", startTime); |
|
|
|
|
|
batchInsertReportData(String.valueOf(report.getLineId()), lineIds, String.valueOf(i), patrolResultRefs); |
|
|
|
|
|
PrintUtil.useTime("BATCH INSERT DETAIL", startTime); |
|
|
|
|
|
log.info("[ARCHIVE] reportId: {}", report.getLineId()); |
|
|
|
|
|
Long lineId = report.getLineId(); |
|
|
|
|
|
reportIds.add(lineId); |
|
|
|
|
|
} |
|
|
} |
|
|
// } |
|
|
|
|
|
|
|
|
String patrolStatistics; |
|
|
|
|
|
if ("0".equals(exportReportFlag)) { |
|
|
|
|
|
patrolStatistics = String.format(messageUtils.get("缺陷数量:%d个。"), defectNum); |
|
|
|
|
|
} else { |
|
|
|
|
|
patrolStatistics = String.format(messageUtils.get("本次任务巡视总结果数量:%d个,正常结果数量:%d个,异常结果数量:%d个,缺陷结果数量:%d个。"), patrolResultRefs.size(), okNum, failNum, defectNum); |
|
|
|
|
|
} |
|
|
|
|
|
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; |
|
|
return reportIds; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
@ -1108,6 +1228,124 @@ public class PatrolResultServiceImpl implements IPatrolResultService { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void batchInsertReportData_shaoxing(String reportId, List<Long> mainIds, String filter, List<PatrolResultRef> patrolResultRefs) { |
|
|
|
|
|
log.info("batchInsertReportData reportId:" + reportId + ", mainIds:" + mainIds + ", filter:" + filter); |
|
|
|
|
|
long startTime = System.currentTimeMillis(); |
|
|
|
|
|
|
|
|
|
|
|
List<BasePointAreaInfo> basePointAreaInfoList = patrolResultMapper.selectBaseInfoByMainIds(mainIds); |
|
|
|
|
|
log.info("REPORTS SIZE: {}", patrolResultRefs.size()); |
|
|
|
|
|
List<InspectionReportData> reportDatas = new ArrayList<>(); |
|
|
|
|
|
List<InspectionReportImg> reportImages = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
|
|
long okNum = 0L; |
|
|
|
|
|
long failNum = 0L; |
|
|
|
|
|
long defectNum = 0L; |
|
|
|
|
|
int index; |
|
|
|
|
|
for (index = 0; index < patrolResultRefs.size(); ++index) { |
|
|
|
|
|
PatrolResultRef patrolResultRef = patrolResultRefs.get(index); |
|
|
|
|
|
String devType = patrolResultRef.getDevType(); |
|
|
|
|
|
BasePointAreaInfo basePointAreaInfo; |
|
|
|
|
|
try { |
|
|
|
|
|
basePointAreaInfo = basePointAreaInfoList.stream().filter((item) -> item != null && patrolResultRef.getDeviceId().equals(item.getDeviceId())).findFirst().get(); |
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
log.error("[REPORT DETAIL] The point lacking belonging area: {}", patrolResultRef.getDeviceId()); |
|
|
|
|
|
basePointAreaInfo = new BasePointAreaInfo(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
InspectionReportData reportData = new InspectionReportData(); |
|
|
|
|
|
reportData.setReportId(reportId); |
|
|
|
|
|
reportData.setArea(basePointAreaInfo.getAreaName()); |
|
|
|
|
|
reportData.setTimeInterval(basePointAreaInfo.getJgName()); |
|
|
|
|
|
reportData.setEqName(basePointAreaInfo.getMainName()); |
|
|
|
|
|
reportData.setParts(basePointAreaInfo.getDeviceName()); |
|
|
|
|
|
reportData.setPointName(basePointAreaInfo.getPatrolPointName()); |
|
|
|
|
|
reportData.setDataSources(patrolResultRef.getDeviceSource()); |
|
|
|
|
|
reportData.setAcquisitionTime(DateUtils.parse(DateUtils.yyyyMMddHHmmss2, patrolResultRef.getTime())); |
|
|
|
|
|
if ("1".equals(patrolResultRef.getResultType()) && validAlgTypes.contains(patrolResultRef.getAlgType())) { |
|
|
|
|
|
reportData.setInspectionResults(patrolResultRef.getValue()); |
|
|
|
|
|
} else { |
|
|
|
|
|
reportData.setInspectionResults(patrolResultRef.getDescription()); |
|
|
|
|
|
} |
|
|
|
|
|
reportData.setAlgName(patrolResultRef.getAlgName()); |
|
|
|
|
|
String threshold = patrolResultRef.getThreshold(); |
|
|
|
|
|
if(StringUtils.isBlank(threshold)) { |
|
|
|
|
|
threshold = ""; |
|
|
|
|
|
} |
|
|
|
|
|
if ("1".equals(patrolResultRef.getResultType()) && threshold.contains("sub_53")) { |
|
|
|
|
|
reportData.setInspectionResults(patrolResultRef.getValue()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if ("1".equals(patrolResultRef.getResultType()) && (threshold.contains("sub_52") || threshold.contains("sub_53")) |
|
|
|
|
|
&& !"0".equals(patrolResultRef.getValue()) |
|
|
|
|
|
&& !"1".equals(patrolResultRef.getValue()) |
|
|
|
|
|
&& !"-1".equals(patrolResultRef.getValue()) |
|
|
|
|
|
&& !"check image".equals(patrolResultRef.getValue())) { |
|
|
|
|
|
reportData.setInspectionResults(patrolResultRef.getValue()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
String pointStatus = patrolResultRef.getPointStatus(); |
|
|
|
|
|
String resultType = patrolResultRef.getResultType(); |
|
|
|
|
|
log.info("[RESULT] resultType: {}, patrolResultRef: {}", resultType, patrolResultRef); |
|
|
|
|
|
if(resultType == null) { |
|
|
|
|
|
continue; |
|
|
|
|
|
} else if (resultType.equals("0")) { |
|
|
|
|
|
reportData.setPointStatus(messageUtils.get("缺陷")); |
|
|
|
|
|
// 缺陷编号 |
|
|
|
|
|
++defectNum; |
|
|
|
|
|
reportData.setCode(defectNum); |
|
|
|
|
|
} else if (resultType.equals("1")) { |
|
|
|
|
|
reportData.setPointStatus(messageUtils.get("正常")); |
|
|
|
|
|
++okNum; |
|
|
|
|
|
reportData.setCode(okNum); |
|
|
|
|
|
} else { |
|
|
|
|
|
reportData.setPointStatus(messageUtils.get("异常")); |
|
|
|
|
|
// 异常编号 |
|
|
|
|
|
++failNum; |
|
|
|
|
|
reportData.setCode(failNum); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
final String reportDataId = reportId + "_" + (100000 + index); |
|
|
|
|
|
reportData.setLineId(reportDataId); |
|
|
|
|
|
reportDatas.add(reportData); |
|
|
|
|
|
log.info("batchInsertReportData reportData:" + reportData); |
|
|
|
|
|
String resultContent = patrolResultRef.getResultContent(); |
|
|
|
|
|
//List<resultList> results = JSONObject.parseObject(resultContent).getJSONArray("resultList").toJavaList(resultList.class); |
|
|
|
|
|
//String imgUrl = results.get(0).getResults().get(0).getResImageUrl(); |
|
|
|
|
|
AnalyseResPoint analyseResPoint = JSONObject.parseObject(resultContent, AnalyseResPoint.class); |
|
|
|
|
|
String imgUrl = analyseResPoint.getResImageUrl(); |
|
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isEmpty(imgUrl)) { |
|
|
|
|
|
imgUrl = patrolResultRef.getFilePath().split(StringUtils.COMMA)[0]; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
InspectionReportImg reportImg = new InspectionReportImg(); |
|
|
|
|
|
reportImg.setReportInfoId(reportDataId); |
|
|
|
|
|
reportImg.setImg(imgUrl); |
|
|
|
|
|
reportImg.setImgSrc(imgUrl); |
|
|
|
|
|
reportImg.setImgType("0"); |
|
|
|
|
|
reportImg.setCreatTime(new Date()); |
|
|
|
|
|
reportImages.add(reportImg); |
|
|
|
|
|
log.info("batchInsertReportData reportImg:" + reportImg); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
index = reportDatas.size() / 50; |
|
|
|
|
|
if (reportDatas.size() % 50 > 0) { |
|
|
|
|
|
++index; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
log.info("[REPORT] BATCH INSERT PROGRESS: reportDatas size: {}", reportDatas.size()); |
|
|
|
|
|
for (int j = 0; j < reportDatas.size(); j += 50) { |
|
|
|
|
|
log.info("[REPORT] BATCH INSERT PROGRESS: {}/{}", j / 50 + 1, j % 50 + 1); |
|
|
|
|
|
int end = j + 50; |
|
|
|
|
|
if (end > reportDatas.size() - 1) { |
|
|
|
|
|
end = reportDatas.size(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
inspectionReportDataMapper.batchInsertInspectionReportData(reportDatas.subList(j, end)); |
|
|
|
|
|
inspectionReportImgMapper.batchInsertInspectionReportImg(reportImages.subList(j, end)); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
public void batchInsertReportData_Lingzhou(String reportId, List<BasePointAreaInfo> basePointAreaInfoList, String filter, List<PatrolResultRef> patrolResultRefs) { |
|
|
public void batchInsertReportData_Lingzhou(String reportId, List<BasePointAreaInfo> basePointAreaInfoList, String filter, List<PatrolResultRef> patrolResultRefs) { |
|
|
long startTime = System.currentTimeMillis(); |
|
|
long startTime = System.currentTimeMillis(); |
|
|
if ("0".equals(exportReportFlag)) { |
|
|
if ("0".equals(exportReportFlag)) { |
|
|
@ -1601,7 +1839,7 @@ public class PatrolResultServiceImpl implements IPatrolResultService { |
|
|
public InspectionReport getInspectionReport(List<Long> lineIds, PatrolTaskResultMain patrolTaskResultMain) { |
|
|
public InspectionReport getInspectionReport(List<Long> lineIds, PatrolTaskResultMain patrolTaskResultMain) { |
|
|
List<String> taskPatrolledIds = patrolTaskResultMain.getTaskPatrolledIds(); |
|
|
List<String> taskPatrolledIds = patrolTaskResultMain.getTaskPatrolledIds(); |
|
|
// 巡视统计描述 |
|
|
// 巡视统计描述 |
|
|
String patrolStatistics = statisticsAnalyseNumShaoxing(lineIds); |
|
|
|
|
|
|
|
|
String patrolStatistics = ""; |
|
|
// 查询任务状态信息 |
|
|
// 查询任务状态信息 |
|
|
List<PatrolTaskStatus> patrolTaskStatuses = patrolTaskStatusMapper.selectPatrolTaskStatusListByTaskPatrolledIds(taskPatrolledIds); |
|
|
List<PatrolTaskStatus> patrolTaskStatuses = patrolTaskStatusMapper.selectPatrolTaskStatusListByTaskPatrolledIds(taskPatrolledIds); |
|
|
List<Date> startTimes = patrolTaskStatuses.stream().map(PatrolTaskStatus::getStartTime).sorted().collect(Collectors.toList()); |
|
|
List<Date> startTimes = patrolTaskStatuses.stream().map(PatrolTaskStatus::getStartTime).sorted().collect(Collectors.toList()); |
|
|
@ -1630,8 +1868,6 @@ public class PatrolResultServiceImpl implements IPatrolResultService { |
|
|
|
|
|
|
|
|
InspectionReport report = new InspectionReport(); |
|
|
InspectionReport report = new InspectionReport(); |
|
|
report.setInspectionDate(new Date()); |
|
|
report.setInspectionDate(new Date()); |
|
|
// report.setTaskResultId(mainId); |
|
|
|
|
|
report.setPatrolStatistics(patrolStatistics); |
|
|
|
|
|
report.setInspectionStartTime(startTimes.get(0)); |
|
|
report.setInspectionStartTime(startTimes.get(0)); |
|
|
report.setInspectionEndTime(DateUtils.parseDate(endTimes.get(endTimes.size() - 1))); |
|
|
report.setInspectionEndTime(DateUtils.parseDate(endTimes.get(endTimes.size() - 1))); |
|
|
// report.setTaskId(String.valueOf(task.getTaskId())); |
|
|
// report.setTaskId(String.valueOf(task.getTaskId())); |
|
|
@ -1645,13 +1881,13 @@ public class PatrolResultServiceImpl implements IPatrolResultService { |
|
|
report.setVoltLevel(StringUtils.isEmpty(voltLevel) ? voltage : voltLevel); |
|
|
report.setVoltLevel(StringUtils.isEmpty(voltLevel) ? voltage : voltLevel); |
|
|
// report.setFilter(String.valueOf(i)); |
|
|
// report.setFilter(String.valueOf(i)); |
|
|
report.setStationType(stationType); |
|
|
report.setStationType(stationType); |
|
|
|
|
|
|
|
|
|
|
|
Map<GroupKey, List<PatrolResultRef>> groupKeyListMap; |
|
|
if ("0".equals(exportReportFlag)) { |
|
|
if ("0".equals(exportReportFlag)) { |
|
|
List <PatrolResultRef> resultRefs = new ArrayList<>(); |
|
|
List <PatrolResultRef> resultRefs = new ArrayList<>(); |
|
|
// 只导出缺陷 |
|
|
// 只导出缺陷 |
|
|
patrolResultRefs = patrolResultRefs.stream().filter((item) -> "0".equals(item.getResultType())).collect(Collectors.toList()); |
|
|
patrolResultRefs = patrolResultRefs.stream().filter((item) -> "0".equals(item.getResultType())).collect(Collectors.toList()); |
|
|
// 分组,按点位ID和算法类型进行分组 |
|
|
// 分组,按点位ID和算法类型进行分组 |
|
|
Map<GroupKey, List<PatrolResultRef>> groupKeyListMap = patrolResultRefs.stream().collect(Collectors.groupingBy(item -> new GroupKey(item.getDeviceId(), item.getAlgType(), item.getTaskPatrolledId()))); |
|
|
|
|
|
|
|
|
groupKeyListMap = patrolResultRefs.stream().collect(Collectors.groupingBy(item -> new GroupKey(item.getDeviceId(), item.getAlgType(), item.getTaskPatrolledId()))); |
|
|
groupKeyListMap.forEach((key, value) -> { |
|
|
groupKeyListMap.forEach((key, value) -> { |
|
|
PatrolResultRef patrolResultRef = new PatrolResultRef(); |
|
|
PatrolResultRef patrolResultRef = new PatrolResultRef(); |
|
|
patrolResultRef.setDeviceId(key.objectId); |
|
|
patrolResultRef.setDeviceId(key.objectId); |
|
|
@ -1681,6 +1917,100 @@ public class PatrolResultServiceImpl implements IPatrolResultService { |
|
|
resultRefs.add(patrolResultRef); |
|
|
resultRefs.add(patrolResultRef); |
|
|
}); |
|
|
}); |
|
|
patrolResultRefs = resultRefs; |
|
|
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 ("meter".equalsIgnoreCase(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); |
|
|
|
|
|
} 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 { |
|
|
|
|
|
// 未知类型,都添加 |
|
|
|
|
|
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 { |
|
|
|
|
|
// 未知,都添加 |
|
|
|
|
|
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); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
patrolResultRefs = processedRefs; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
List<BasePointAreaInfo> basePointAreaInfoList = patrolResultMapper.selectBaseInfoByMainIds(lineIds); |
|
|
List<BasePointAreaInfo> basePointAreaInfoList = patrolResultMapper.selectBaseInfoByMainIds(lineIds); |
|
|
@ -1688,9 +2018,9 @@ public class PatrolResultServiceImpl implements IPatrolResultService { |
|
|
log.info("REPORTS SIZE: {}", patrolResultRefs.size()); |
|
|
log.info("REPORTS SIZE: {}", patrolResultRefs.size()); |
|
|
List<InspectionReportData> reportDatas = new ArrayList<>(); |
|
|
List<InspectionReportData> reportDatas = new ArrayList<>(); |
|
|
|
|
|
|
|
|
long okNum = 1L; |
|
|
|
|
|
long failNum = 1L; |
|
|
|
|
|
long defectNum = 1L; |
|
|
|
|
|
|
|
|
long okNum = 0L; |
|
|
|
|
|
long failNum = 0L; |
|
|
|
|
|
long defectNum = 0L; |
|
|
int index; |
|
|
int index; |
|
|
for (index = 0; index < patrolResultRefs.size(); ++index) { |
|
|
for (index = 0; index < patrolResultRefs.size(); ++index) { |
|
|
PatrolResultRef patrolResultRef = patrolResultRefs.get(index); |
|
|
PatrolResultRef patrolResultRef = patrolResultRefs.get(index); |
|
|
@ -1740,19 +2070,18 @@ public class PatrolResultServiceImpl implements IPatrolResultService { |
|
|
} else if (resultType.equals("0")) { |
|
|
} else if (resultType.equals("0")) { |
|
|
reportData.setPointStatus(messageUtils.get("缺陷")); |
|
|
reportData.setPointStatus(messageUtils.get("缺陷")); |
|
|
// 缺陷编号 |
|
|
// 缺陷编号 |
|
|
reportData.setCode(defectNum); |
|
|
|
|
|
++defectNum; |
|
|
++defectNum; |
|
|
|
|
|
reportData.setCode(defectNum); |
|
|
} else if (resultType.equals("1")) { |
|
|
} else if (resultType.equals("1")) { |
|
|
reportData.setPointStatus(messageUtils.get("正常")); |
|
|
reportData.setPointStatus(messageUtils.get("正常")); |
|
|
reportData.setCode(okNum); |
|
|
|
|
|
++okNum; |
|
|
++okNum; |
|
|
|
|
|
reportData.setCode(okNum); |
|
|
} else { |
|
|
} else { |
|
|
reportData.setPointStatus(messageUtils.get("异常")); |
|
|
reportData.setPointStatus(messageUtils.get("异常")); |
|
|
// 异常编号 |
|
|
// 异常编号 |
|
|
reportData.setCode(failNum); |
|
|
|
|
|
++failNum; |
|
|
++failNum; |
|
|
|
|
|
reportData.setCode(failNum); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
String resultContent = patrolResultRef.getResultContent(); |
|
|
String resultContent = patrolResultRef.getResultContent(); |
|
|
AnalyseResPoint analyseResPoint = JSONObject.parseObject(resultContent, AnalyseResPoint.class); |
|
|
AnalyseResPoint analyseResPoint = JSONObject.parseObject(resultContent, AnalyseResPoint.class); |
|
|
String imgUrl = analyseResPoint.getResImageUrl(); |
|
|
String imgUrl = analyseResPoint.getResImageUrl(); |
|
|
@ -1770,10 +2099,37 @@ public class PatrolResultServiceImpl implements IPatrolResultService { |
|
|
reportData.setReportImgList(reportImages); |
|
|
reportData.setReportImgList(reportImages); |
|
|
reportDatas.add(reportData); |
|
|
reportDatas.add(reportData); |
|
|
} |
|
|
} |
|
|
|
|
|
if ("0".equals(exportReportFlag)) { |
|
|
|
|
|
patrolStatistics = String.format(messageUtils.get("缺陷数量:%d个。"), defectNum); |
|
|
|
|
|
} else { |
|
|
|
|
|
patrolStatistics = String.format(messageUtils.get("本次任务巡视总结果数量:%d个,正常结果数量:%d个,异常结果数量:%d个,缺陷结果数量:%d个。"), patrolResultRefs.size(), okNum, failNum, defectNum); |
|
|
|
|
|
} |
|
|
|
|
|
report.setPatrolStatistics(patrolStatistics); |
|
|
report.setReportDatalist(reportDatas); |
|
|
report.setReportDatalist(reportDatas); |
|
|
return report; |
|
|
return report; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private PatrolResultRef mergePatrolResultRef(PatrolResultRef filterResult, PatrolResultRef AIResult, String resultType) { |
|
|
|
|
|
PatrolResultRef merged = new PatrolResultRef(); |
|
|
|
|
|
merged.setDeviceId(filterResult.getDeviceId()); |
|
|
|
|
|
merged.setAlgType(filterResult.getAlgType()); |
|
|
|
|
|
merged.setTaskPatrolledId(filterResult.getTaskPatrolledId()); |
|
|
|
|
|
// 描述和值拼接 |
|
|
|
|
|
merged.setDescription(filterResult.getDescription() + "," + AIResult.getDescription()); |
|
|
|
|
|
merged.setValue(filterResult.getValue() + "," + AIResult.getValue()); |
|
|
|
|
|
// 合并时使用大模型的结果内容和文件路径(因为图片要显示大模型分析后的图) |
|
|
|
|
|
merged.setResultContent(AIResult.getResultContent()); |
|
|
|
|
|
merged.setFilePath(AIResult.getFilePath()); |
|
|
|
|
|
// 其他字段取 filterResult |
|
|
|
|
|
merged.setDevType(filterResult.getDevType()); |
|
|
|
|
|
merged.setDeviceSource(filterResult.getDeviceSource()); |
|
|
|
|
|
merged.setTime(filterResult.getTime()); |
|
|
|
|
|
merged.setThreshold(filterResult.getThreshold()); |
|
|
|
|
|
merged.setAlgName(filterResult.getAlgName()); |
|
|
|
|
|
merged.setResultType(resultType); |
|
|
|
|
|
return merged; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
private static class GroupKey { |
|
|
private static class GroupKey { |
|
|
private final String objectId; |
|
|
private final String objectId; |
|
|
private final String algType; |
|
|
private final String algType; |
|
|
|