|
|
|
@ -305,7 +305,7 @@ public class PatrolResultServiceImpl implements IPatrolResultService { |
|
|
|
} |
|
|
|
|
|
|
|
@Transactional |
|
|
|
public Long saveReport(PatrolTaskResultMain resultMain, List<Long> lineIds, Long currentLineId, List<PatrolResult> resultList) { |
|
|
|
public List<Long> saveReport(PatrolTaskResultMain resultMain, List<Long> lineIds, Long currentLineId, List<PatrolResult> resultList) { |
|
|
|
long startTime = System.currentTimeMillis(); |
|
|
|
// String mainId = String.valueOf(resultMain.getLineId()); |
|
|
|
for (Long lineId : lineIds) { |
|
|
|
@ -333,10 +333,13 @@ public class PatrolResultServiceImpl implements IPatrolResultService { |
|
|
|
return reportIds; |
|
|
|
} |
|
|
|
|
|
|
|
public Long saveReportData(List<PatrolResult> resultList, PatrolTaskResultMain resultMain, List<Long> lineIds) { |
|
|
|
public List<Long> saveReportData(List<PatrolResult> resultList, PatrolTaskResultMain resultMain, List<Long> lineIds) { |
|
|
|
long startTime = System.currentTimeMillis(); |
|
|
|
String mainId = String.valueOf(resultMain.getLineId()); |
|
|
|
String analyseNum = statisticsAnalyseNum(lineIds, resultList.size()); |
|
|
|
// String analyseNum = statisticsAnalyseNum(lineIds, resultList.size()); |
|
|
|
String filterNum = statisticsAnalyseNumV3(lineIds, "1"); |
|
|
|
String AiNum = statisticsAnalyseNumV3(lineIds, "0"); |
|
|
|
String[] nums = new String[]{AiNum, filterNum}; |
|
|
|
startTime = PrintUtil.useTime("STATISTICS ANALYZE DATA", startTime); |
|
|
|
if (resultList.isEmpty()) { |
|
|
|
throw new ServiceException("LACK INSPECT RESULT: " + mainId); |
|
|
|
@ -358,21 +361,23 @@ public class PatrolResultServiceImpl implements IPatrolResultService { |
|
|
|
if (list.isEmpty()) { |
|
|
|
throw new ServiceException("TASK PLAN LOST: " + taskCode); |
|
|
|
} else { |
|
|
|
List<Long> reportIds = new ArrayList<>(); |
|
|
|
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(); |
|
|
|
String stationName = stationMap.get("station_name"); |
|
|
|
String stationType = stationMap.get("station_type"); |
|
|
|
report = new InspectionReport(); |
|
|
|
resetReport(report, analyseNum, mainId, task, taskStatus); |
|
|
|
// 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(); |
|
|
|
String stationName = stationMap.get("station_name"); |
|
|
|
String stationType = stationMap.get("station_type"); |
|
|
|
for (int i = 0; i < nums.length; i++) { |
|
|
|
InspectionReport report = new InspectionReport(); |
|
|
|
resetReport(report, nums[i], mainId, task, taskStatus); |
|
|
|
report.setTaskId(String.valueOf(task.getTaskId())); |
|
|
|
report.setTaskPatrolledId(taskPatrolId); |
|
|
|
report.setInspectionTaskName(task.getTaskName()); |
|
|
|
@ -381,15 +386,18 @@ public class PatrolResultServiceImpl implements IPatrolResultService { |
|
|
|
report.setCheckTime(resultMain.getCheckTime()); |
|
|
|
report.setStationName(stationName); |
|
|
|
report.setVoltLevel(voltage); |
|
|
|
report.setFilter(String.valueOf(i)); |
|
|
|
report.setStationType(stationType); |
|
|
|
inspectionReportMapper.insertInspectionReport(report); |
|
|
|
PrintUtil.useTime("NEW TASK REPORT", startTime); |
|
|
|
batchInsertReportData(String.valueOf(report.getLineId()), lineIds); |
|
|
|
batchInsertReportData(String.valueOf(report.getLineId()), lineIds, String.valueOf(i)); |
|
|
|
PrintUtil.useTime("BATCH INSERT DETAIL", startTime); |
|
|
|
log.info("[ARCHIVE] reportId: {}", report.getLineId()); |
|
|
|
Long lineId = report.getLineId(); |
|
|
|
reportIds.add(lineId); |
|
|
|
} |
|
|
|
|
|
|
|
log.info("[ARCHIVE] reportId: {}", report.getLineId()); |
|
|
|
return report.getLineId(); |
|
|
|
// } |
|
|
|
return reportIds; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@ -495,11 +503,11 @@ public class PatrolResultServiceImpl implements IPatrolResultService { |
|
|
|
report.setInspectionEndTime(DateUtil.parseDateTime(taskStatus.getEndTime())); |
|
|
|
} |
|
|
|
|
|
|
|
public void batchInsertReportData(String reportId, List<Long> mainIds) { |
|
|
|
log.info("batchInsertReportData reportId:" + reportId + ", mainIds:" + mainIds); |
|
|
|
public void batchInsertReportData(String reportId, List<Long> mainIds, String filter) { |
|
|
|
log.info("batchInsertReportData reportId:" + reportId + ", mainIds:" + mainIds + ", filter:" + filter); |
|
|
|
long startTime = System.currentTimeMillis(); |
|
|
|
// List<PatrolResultRef> patrolResultRefs = patrolResultMapper.selectResultRefByLineId(mainId); |
|
|
|
List<PatrolResultRef> patrolResultRefs = patrolResultMapper.selectResultRefByLineIds(mainIds); |
|
|
|
List<PatrolResultRef> patrolResultRefs = patrolResultMapper.selectResultRefByLineIds(mainIds, filter); |
|
|
|
log.info("batchInsertReportData patrolResultRefs:" + patrolResultRefs); |
|
|
|
startTime = PrintUtil.useTime("SELECT RESULT", startTime); |
|
|
|
// List<BasePointAreaInfo> basePointAreaInfoList = patrolResultMapper.selectBaseInfoByMainId(mainId); |
|
|
|
@ -535,6 +543,7 @@ public class PatrolResultServiceImpl implements IPatrolResultService { |
|
|
|
reportData.setDataSources("0".equals(devType) ? messageUtils.get("无人机") : "1".equals(devType) ? messageUtils.get("机器人") : messageUtils.get("高清视频")); |
|
|
|
reportData.setAcquisitionTime(DateUtils.parse(DateUtils.yyyyMMddHHmmss2, patrolResultRef.getTime())); |
|
|
|
reportData.setInspectionResults(patrolResultRef.getDescription()); |
|
|
|
reportData.setAlgName(patrolResultRef.getAlgName()); |
|
|
|
String threshold = patrolResultRef.getThreshold(); |
|
|
|
if(StringUtils.isBlank(threshold)) { |
|
|
|
threshold = ""; |
|
|
|
@ -552,21 +561,31 @@ public class PatrolResultServiceImpl implements IPatrolResultService { |
|
|
|
} |
|
|
|
|
|
|
|
String pointStatus = patrolResultRef.getPointStatus(); |
|
|
|
log.info("[RESULT] pointStatus: {}, patrolResultRef: {}", pointStatus, patrolResultRef); |
|
|
|
if(pointStatus == null) { |
|
|
|
String resultType = patrolResultRef.getResultType(); |
|
|
|
// log.info("[RESULT] pointStatus: {}, patrolResultRef: {}", pointStatus, patrolResultRef); |
|
|
|
// if(pointStatus == null) { |
|
|
|
// continue; |
|
|
|
// } else if (pointStatus.equals("0")) { |
|
|
|
// reportData.setPointStatus(messageUtils.get("异常")); |
|
|
|
// reportData.setCode(failNum); |
|
|
|
// ++failNum; |
|
|
|
// } else if (pointStatus.equals("1")) { |
|
|
|
// reportData.setPointStatus(messageUtils.get("待人工确认")); |
|
|
|
// reportData.setCode(confirmNum); |
|
|
|
// ++confirmNum; |
|
|
|
// } else { |
|
|
|
// reportData.setPointStatus(messageUtils.get("正常")); |
|
|
|
// reportData.setCode(okNum); |
|
|
|
// ++okNum; |
|
|
|
// } |
|
|
|
log.info("[RESULT] resultType: {}, patrolResultRef: {}", resultType, patrolResultRef); |
|
|
|
if(resultType == null) { |
|
|
|
continue; |
|
|
|
} else if (pointStatus.equals("0")) { |
|
|
|
reportData.setPointStatus(messageUtils.get("异常")); |
|
|
|
} else if (resultType.equals("0")) { |
|
|
|
reportData.setPointStatus(messageUtils.get("缺陷")); |
|
|
|
// 缺陷编号 |
|
|
|
reportData.setCode(failNum); |
|
|
|
++failNum; |
|
|
|
} else if (pointStatus.equals("1")) { |
|
|
|
reportData.setPointStatus(messageUtils.get("待人工确认")); |
|
|
|
reportData.setCode(confirmNum); |
|
|
|
++confirmNum; |
|
|
|
} else { |
|
|
|
reportData.setPointStatus(messageUtils.get("正常")); |
|
|
|
reportData.setCode(okNum); |
|
|
|
++okNum; |
|
|
|
} |
|
|
|
|
|
|
|
final String reportDataId = reportId + "_" + (100000 + index); |
|
|
|
@ -772,6 +791,36 @@ public class PatrolResultServiceImpl implements IPatrolResultService { |
|
|
|
return String.format(messageUtils.get("总点位:%d个,已检点位:%d个,未检点位:0个,正常点位:%d个,异常点位:%d个,待人工确认点位:%d个。"), totalNum, totalNum, okNum, failNum, confirmNum); |
|
|
|
} |
|
|
|
|
|
|
|
public String statisticsAnalyseNumV3(List<Long> lineIds, String filter) { |
|
|
|
// int okNum = 0; |
|
|
|
// int failNum = 0; |
|
|
|
// int confirmNum = 0; |
|
|
|
List<ResultAnalysis> analyses = resultAnalysisMapper.selectResultAnalysisListByMainIdsNew(lineIds, filter); |
|
|
|
int totalNum = analyses.size(); |
|
|
|
log.info("lineIds:{},statisticsAnalyseNum analyses:{}", lineIds, analyses); |
|
|
|
// for (ResultAnalysis analyse : analyses) { |
|
|
|
// String pointStatus = analyse.getPointStatus(); |
|
|
|
// if (pointStatus.equals("0")) { |
|
|
|
// ++failNum; |
|
|
|
// } else if (pointStatus.equals("1")) { |
|
|
|
// ++okNum; |
|
|
|
// } else if (pointStatus.equals("2")) { |
|
|
|
// ++confirmNum; |
|
|
|
// } else { |
|
|
|
// log.error("【归档-统计分析数量】异常分析类型:{}", analyse.getPointStatus()); |
|
|
|
// } |
|
|
|
// } |
|
|
|
// |
|
|
|
// int lastNum = totalNum - failNum - confirmNum; |
|
|
|
// if (lastNum != okNum) { |
|
|
|
// okNum = lastNum; |
|
|
|
// } |
|
|
|
|
|
|
|
// return String.format("总点位:%d个,已检点位:%d个,未检点位:0个,正常点位:%d个,异常点位:%d个,待人工确认点位:%d个。", totalNum, totalNum, okNum, failNum, confirmNum); |
|
|
|
// return String.format(messageUtils.get("总点位:%d个,已检点位:%d个,未检点位:0个,正常点位:%d个,异常点位:%d个,待人工确认点位:%d个。"), totalNum, totalNum, okNum, failNum, confirmNum); |
|
|
|
return String.format(messageUtils.get("缺陷总数:%d个"), totalNum); |
|
|
|
} |
|
|
|
|
|
|
|
public String statisticsAnalyseNumV2(String mainId, String filter) { |
|
|
|
int okNum = 0; |
|
|
|
int failNum = 0; |
|
|
|
|