|
|
|
@ -7,6 +7,7 @@ import com.inspect.analysis.domain.AnalyseResPoint; |
|
|
|
import com.inspect.analysis.domain.ResultAnalysis; |
|
|
|
import com.inspect.analysis.domain.resultList; |
|
|
|
import com.inspect.analysis.mapper.ResultAnalysisMapper; |
|
|
|
import com.inspect.base.core.constant.AlgConstants; |
|
|
|
import com.inspect.base.core.exception.ServiceException; |
|
|
|
import com.inspect.base.core.utils.DateUtils; |
|
|
|
import com.inspect.base.core.utils.StringUtils; |
|
|
|
@ -49,6 +50,9 @@ public class PatrolResultServiceImpl implements IPatrolResultService { |
|
|
|
@Value("${inspect.task.report.voltage:±800kv}") |
|
|
|
private String voltage; |
|
|
|
|
|
|
|
@Value("${inspect.task.report.all:0}") |
|
|
|
private String exportReportFlag; |
|
|
|
|
|
|
|
private final PatrolResultMapper patrolResultMapper; |
|
|
|
final |
|
|
|
PatrolResultDefaultValueMapper patrolResultDefaultvalueMapper; |
|
|
|
@ -63,6 +67,15 @@ public class PatrolResultServiceImpl implements IPatrolResultService { |
|
|
|
@Autowired |
|
|
|
private MessageUtils messageUtils; |
|
|
|
|
|
|
|
private static final Set<String> validAlgTypes = new HashSet<>(Arrays.asList( |
|
|
|
AlgConstants.METER, |
|
|
|
AlgConstants.XB, |
|
|
|
AlgConstants.INFRA_1800, |
|
|
|
AlgConstants.INFRA_YU3, |
|
|
|
AlgConstants.INFRA_CAMERA, |
|
|
|
AlgConstants.INFRA_CAMERA_REVERSE |
|
|
|
));; |
|
|
|
|
|
|
|
public PatrolResultServiceImpl(PatrolResultMapper patrolResultMapper, PatrolResultDefaultValueMapper patrolResultDefaultvalueMapper, PatrolTaskResultMainMapper patrolTaskResultMainMapper, PatrolTaskStatusMapper patrolTaskStatusMapper, PatrolTaskMapper patrolTaskMapper, InspectionReportMapper inspectionReportMapper, InspectionReportImgMapper inspectionReportImgMapper, InspectionReportDataMapper inspectionReportDataMapper, ResultAnalysisMapper resultAnalysisMapper) { |
|
|
|
this.patrolResultMapper = patrolResultMapper; |
|
|
|
this.patrolResultDefaultvalueMapper = patrolResultDefaultvalueMapper; |
|
|
|
@ -375,6 +388,7 @@ public class PatrolResultServiceImpl implements IPatrolResultService { |
|
|
|
Map<String, String> stationMap = patrolResultMapper.selectBasedataStation(); |
|
|
|
String stationName = stationMap.get("station_name"); |
|
|
|
String stationType = stationMap.get("station_type"); |
|
|
|
String voltLevel = stationMap.get("volt_level"); |
|
|
|
for (int i = 0; i < nums.length; i++) { |
|
|
|
InspectionReport report = new InspectionReport(); |
|
|
|
resetReport(report, nums[i], mainId, task, taskStatus); |
|
|
|
@ -385,7 +399,7 @@ public class PatrolResultServiceImpl implements IPatrolResultService { |
|
|
|
report.setCheckPerson(resultMain.getCheckPerson()); |
|
|
|
report.setCheckTime(resultMain.getCheckTime()); |
|
|
|
report.setStationName(stationName); |
|
|
|
report.setVoltLevel(voltage); |
|
|
|
report.setVoltLevel(StringUtils.isEmpty(voltLevel) ? voltage : voltLevel); |
|
|
|
report.setFilter(String.valueOf(i)); |
|
|
|
report.setStationType(stationType); |
|
|
|
inspectionReportMapper.insertInspectionReport(report); |
|
|
|
@ -508,6 +522,11 @@ public class PatrolResultServiceImpl implements IPatrolResultService { |
|
|
|
long startTime = System.currentTimeMillis(); |
|
|
|
// List<PatrolResultRef> patrolResultRefs = patrolResultMapper.selectResultRefByLineId(mainId); |
|
|
|
List<PatrolResultRef> patrolResultRefs = patrolResultMapper.selectResultRefByLineIds(mainIds, filter); |
|
|
|
if ("0".equals(exportReportFlag)) { |
|
|
|
// 导出缺陷 |
|
|
|
patrolResultRefs = patrolResultRefs.stream().filter((item) -> "0".equals(item.getResultType())).collect(Collectors.toList()); |
|
|
|
} |
|
|
|
|
|
|
|
log.info("batchInsertReportData patrolResultRefs:" + patrolResultRefs); |
|
|
|
startTime = PrintUtil.useTime("SELECT RESULT", startTime); |
|
|
|
// List<BasePointAreaInfo> basePointAreaInfoList = patrolResultMapper.selectBaseInfoByMainId(mainId); |
|
|
|
@ -520,7 +539,7 @@ public class PatrolResultServiceImpl implements IPatrolResultService { |
|
|
|
|
|
|
|
long okNum = 1L; |
|
|
|
long failNum = 1L; |
|
|
|
long confirmNum = 1L; |
|
|
|
long defectNum = 1L; |
|
|
|
int index; |
|
|
|
for (index = 0; index < patrolResultRefs.size(); ++index) { |
|
|
|
PatrolResultRef patrolResultRef = patrolResultRefs.get(index); |
|
|
|
@ -542,7 +561,11 @@ public class PatrolResultServiceImpl implements IPatrolResultService { |
|
|
|
reportData.setPointName(basePointAreaInfo.getPatrolPointName()); |
|
|
|
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()); |
|
|
|
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)) { |
|
|
|
@ -584,6 +607,15 @@ public class PatrolResultServiceImpl implements IPatrolResultService { |
|
|
|
} else if (resultType.equals("0")) { |
|
|
|
reportData.setPointStatus(messageUtils.get("缺陷")); |
|
|
|
// 缺陷编号 |
|
|
|
reportData.setCode(defectNum); |
|
|
|
++defectNum; |
|
|
|
} else if (resultType.equals("1")) { |
|
|
|
reportData.setPointStatus(messageUtils.get("正常")); |
|
|
|
reportData.setCode(okNum); |
|
|
|
++okNum; |
|
|
|
} else { |
|
|
|
reportData.setPointStatus(messageUtils.get("异常")); |
|
|
|
// 异常编号 |
|
|
|
reportData.setCode(failNum); |
|
|
|
++failNum; |
|
|
|
} |
|
|
|
|