|
|
@ -771,7 +771,8 @@ public class PatrolResultServiceImpl implements IPatrolResultService { |
|
|
report.setFilter("0"); |
|
|
report.setFilter("0"); |
|
|
report.setStationType(stationType); |
|
|
report.setStationType(stationType); |
|
|
inspectionReportMapper.insertInspectionReport(report); |
|
|
inspectionReportMapper.insertInspectionReport(report); |
|
|
batchInsertReportData_shaoxing(String.valueOf(report.getLineId()), patrolResultRefs, basePointAreaInfoList, taskPatrolledIds); |
|
|
|
|
|
|
|
|
// 为每个报告生成数据 |
|
|
|
|
|
batchInsertReportData_shaoxing(String.valueOf(report.getLineId()), patrolResultRefs, basePointAreaInfoList, lineIds); |
|
|
reportIds.add(report.getLineId()); |
|
|
reportIds.add(report.getLineId()); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
@ -1264,11 +1265,11 @@ public class PatrolResultServiceImpl implements IPatrolResultService { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public void batchInsertReportData_shaoxing(String reportId, List<PatrolResultRef> patrolResultRefs, List<BasePointAreaInfo> basePointAreaInfoList, List<String> taskPatrolledIds) { |
|
|
|
|
|
Map<String, Map<String, Long>> taskCounterMap = new HashMap<>(); |
|
|
|
|
|
|
|
|
public void batchInsertReportData_shaoxing(String reportId, List<PatrolResultRef> patrolResultRefs, List<BasePointAreaInfo> basePointAreaInfoList, List<Long> lineIds) { |
|
|
|
|
|
Map<Long, Map<String, Long>> taskCounterMap = new HashMap<>(); |
|
|
|
|
|
|
|
|
// 为每个任务初始化计数器 |
|
|
// 为每个任务初始化计数器 |
|
|
for (String item : taskPatrolledIds) { |
|
|
|
|
|
|
|
|
for (Long item : lineIds) { |
|
|
Map<String, Long> counter = new HashMap<>(); |
|
|
Map<String, Long> counter = new HashMap<>(); |
|
|
counter.put("defect", 0L); |
|
|
counter.put("defect", 0L); |
|
|
counter.put("ok", 0L); |
|
|
counter.put("ok", 0L); |
|
|
@ -1290,6 +1291,7 @@ public class PatrolResultServiceImpl implements IPatrolResultService { |
|
|
// 获取该结果所属的任务名 |
|
|
// 获取该结果所属的任务名 |
|
|
String resultTaskName = patrolResultRef.getTaskName(); |
|
|
String resultTaskName = patrolResultRef.getTaskName(); |
|
|
String taskPatrolledId = patrolResultRef.getTaskPatrolledId(); |
|
|
String taskPatrolledId = patrolResultRef.getTaskPatrolledId(); |
|
|
|
|
|
Long mainId = patrolResultRef.getMainId(); |
|
|
BasePointAreaInfo basePointAreaInfo; |
|
|
BasePointAreaInfo basePointAreaInfo; |
|
|
try { |
|
|
try { |
|
|
basePointAreaInfo = basePointAreaInfoList.stream().filter((item) -> item != null && patrolResultRef.getDeviceId().equals(item.getDeviceId())).findFirst().get(); |
|
|
basePointAreaInfo = basePointAreaInfoList.stream().filter((item) -> item != null && patrolResultRef.getDeviceId().equals(item.getDeviceId())).findFirst().get(); |
|
|
@ -1309,6 +1311,7 @@ public class PatrolResultServiceImpl implements IPatrolResultService { |
|
|
reportData.setAcquisitionTime(DateUtils.parse(DateUtils.yyyyMMddHHmmss2, patrolResultRef.getTime())); |
|
|
reportData.setAcquisitionTime(DateUtils.parse(DateUtils.yyyyMMddHHmmss2, patrolResultRef.getTime())); |
|
|
reportData.setTaskName(resultTaskName); |
|
|
reportData.setTaskName(resultTaskName); |
|
|
reportData.setTaskPatrolledId(taskPatrolledId); |
|
|
reportData.setTaskPatrolledId(taskPatrolledId); |
|
|
|
|
|
reportData.setTaskResultId(String.valueOf(mainId)); |
|
|
if ("1".equals(patrolResultRef.getResultType()) && validAlgTypes.contains(patrolResultRef.getAlgType())) { |
|
|
if ("1".equals(patrolResultRef.getResultType()) && validAlgTypes.contains(patrolResultRef.getAlgType())) { |
|
|
reportData.setInspectionResults(patrolResultRef.getValue()); |
|
|
reportData.setInspectionResults(patrolResultRef.getValue()); |
|
|
} else { |
|
|
} else { |
|
|
@ -1339,7 +1342,7 @@ public class PatrolResultServiceImpl implements IPatrolResultService { |
|
|
} else if (resultType.equals("0")) { |
|
|
} else if (resultType.equals("0")) { |
|
|
reportData.setPointStatus(messageUtils.get("缺陷")); |
|
|
reportData.setPointStatus(messageUtils.get("缺陷")); |
|
|
// 按任务统计异常编号 |
|
|
// 按任务统计异常编号 |
|
|
Map<String, Long> counter = taskCounterMap.get(taskPatrolledId); |
|
|
|
|
|
|
|
|
Map<String, Long> counter = taskCounterMap.get(mainId); |
|
|
if (counter != null) { |
|
|
if (counter != null) { |
|
|
counter.put("defect", counter.get("defect") + 1); |
|
|
counter.put("defect", counter.get("defect") + 1); |
|
|
reportData.setCode(counter.get("defect")); |
|
|
reportData.setCode(counter.get("defect")); |
|
|
@ -1350,7 +1353,7 @@ public class PatrolResultServiceImpl implements IPatrolResultService { |
|
|
} else if (resultType.equals("1")) { |
|
|
} else if (resultType.equals("1")) { |
|
|
reportData.setPointStatus(messageUtils.get("正常")); |
|
|
reportData.setPointStatus(messageUtils.get("正常")); |
|
|
// 按任务统计异常编号 |
|
|
// 按任务统计异常编号 |
|
|
Map<String, Long> counter = taskCounterMap.get(taskPatrolledId); |
|
|
|
|
|
|
|
|
Map<String, Long> counter = taskCounterMap.get(mainId); |
|
|
if (counter != null) { |
|
|
if (counter != null) { |
|
|
counter.put("ok", counter.get("ok") + 1); |
|
|
counter.put("ok", counter.get("ok") + 1); |
|
|
reportData.setCode(counter.get("ok")); |
|
|
reportData.setCode(counter.get("ok")); |
|
|
@ -1361,7 +1364,7 @@ public class PatrolResultServiceImpl implements IPatrolResultService { |
|
|
} else { |
|
|
} else { |
|
|
reportData.setPointStatus(messageUtils.get("异常")); |
|
|
reportData.setPointStatus(messageUtils.get("异常")); |
|
|
// 按任务统计异常编号 |
|
|
// 按任务统计异常编号 |
|
|
Map<String, Long> counter = taskCounterMap.get(taskPatrolledId); |
|
|
|
|
|
|
|
|
Map<String, Long> counter = taskCounterMap.get(mainId); |
|
|
if (counter != null) { |
|
|
if (counter != null) { |
|
|
counter.put("fail", counter.get("fail") + 1); |
|
|
counter.put("fail", counter.get("fail") + 1); |
|
|
reportData.setCode(counter.get("fail")); |
|
|
reportData.setCode(counter.get("fail")); |
|
|
@ -2220,6 +2223,15 @@ public class PatrolResultServiceImpl implements IPatrolResultService { |
|
|
public int hashCode() { |
|
|
public int hashCode() { |
|
|
return Objects.hash(objectId, algType, taskPatrolled); |
|
|
return Objects.hash(objectId, algType, taskPatrolled); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public String toString() { |
|
|
|
|
|
return "GroupKey{" + |
|
|
|
|
|
"objectId='" + objectId + '\'' + |
|
|
|
|
|
", algType='" + algType + '\'' + |
|
|
|
|
|
", taskPatrolled='" + taskPatrolled + '\'' + |
|
|
|
|
|
'}'; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public static void main(String[] args) { |
|
|
public static void main(String[] args) { |
|
|
|