Browse Source

Merge remote-tracking branch 'origin/master'

master
yinhuaiwei 2 weeks ago
parent
commit
096b255fe0
3 changed files with 494 additions and 143 deletions
  1. +1
    -1
      inspect-main/inspect-main-task/src/main/java/com/inspect/partrolresult/service/IPatrolResultService.java
  2. +425
    -69
      inspect-main/inspect-main-task/src/main/java/com/inspect/partrolresult/service/impl/PatrolResultServiceImpl.java
  3. +68
    -73
      inspect-main/inspect-main-task/src/main/java/com/inspect/resultmain/controller/PatrolTaskResultMainController.java

+ 1
- 1
inspect-main/inspect-main-task/src/main/java/com/inspect/partrolresult/service/IPatrolResultService.java View File

@ -86,7 +86,7 @@ public interface IPatrolResultService {
List<Long> saveReportLingzhou_v2(PatrolTaskResultMain resultMain, List<Long> lineIds, Long currentLineId, List<PatrolResult> resultList); List<Long> saveReportLingzhou_v2(PatrolTaskResultMain resultMain, List<Long> lineIds, Long currentLineId, List<PatrolResult> resultList);
List<Long> saveReportShaoxing(PatrolTaskResultMain resultMain, List<Long> lineIds, Long currentLineId, List<PatrolResult> resultList, int aiQxNum, int csQxNum);
List<Long> saveReportShaoxing(PatrolTaskResultMain resultMain, List<Long> lineIds, Long currentLineId, List<PatrolResult> resultList);
List saveReportV2(PatrolTaskResultMain patrolTaskResultMain, List<PatrolResult> patrolResultList); List saveReportV2(PatrolTaskResultMain patrolTaskResultMain, List<PatrolResult> patrolResultList);


+ 425
- 69
inspect-main/inspect-main-task/src/main/java/com/inspect/partrolresult/service/impl/PatrolResultServiceImpl.java View File

@ -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;


+ 68
- 73
inspect-main/inspect-main-task/src/main/java/com/inspect/resultmain/controller/PatrolTaskResultMainController.java View File

@ -281,44 +281,22 @@ public class PatrolTaskResultMainController extends BaseController {
lineIds.addAll(longs); lineIds.addAll(longs);
} }
lineIds = lineIds.stream().distinct().collect(Collectors.toList()); lineIds = lineIds.stream().distinct().collect(Collectors.toList());
PrintUtil.useTime("收集需归档的lineIds", startTime);
logger.info("---归档--lineIds size: {},lineIds:{}", lineIds.size(), lineIds); logger.info("---归档--lineIds size: {},lineIds:{}", lineIds.size(), lineIds);
List<PatrolResult> resultList = patrolResultService.selectPatrolResultListByMainIds(lineIds); List<PatrolResult> resultList = patrolResultService.selectPatrolResultListByMainIds(lineIds);
if (resultList.isEmpty()) { if (resultList.isEmpty()) {
logger.error("[归档]失败, 数据采集中..."); logger.error("[归档]失败, 数据采集中...");
return AjaxResult.error("数据采集中请稍后...."); return AjaxResult.error("数据采集中请稍后....");
} }
startTime = System.currentTimeMillis();
ResultAnalysis resultAnalysis = new ResultAnalysis();
int csQxNum = 0, aiQxNum = 0;
List<String> taskPatrolledIds = resultList.stream().map(PatrolResult::getTaskPatrolledId).distinct().collect(Collectors.toList());
for (String taskPatrolledId : taskPatrolledIds) {
resultAnalysis.setTaskPatrolledId(taskPatrolledId);
ResultAnalysis ras = patrolResultService.selectTaskAbnormalData(resultAnalysis);
csQxNum += ras.getCsQxNum();
aiQxNum += ras.getAiQxNum();
}
if ("0".equals(exportReportFlag) && 0 == aiQxNum && 0 == csQxNum) {
logger.error("[归档]没有缺陷数据, 无需归档!");
return AjaxResult.error("没有缺陷数据, 无需归档!");
}
PrintUtil.useTime("查询统计缺陷数据", startTime);
startTime = System.currentTimeMillis();
// 使用CompletableFuture异步执行saveReport
int finalAiQxNum = aiQxNum;
int finalCsQxNum = csQxNum;
List<Long> finalLineIds = lineIds; List<Long> finalLineIds = lineIds;
startTime = PrintUtil.useTime("查询统计数据", startTime);
CompletableFuture<List<Long>> saveReportFuture = CompletableFuture.supplyAsync(() -> { CompletableFuture<List<Long>> saveReportFuture = CompletableFuture.supplyAsync(() -> {
logger.info("[ARCHIVE] Start saving reports"); logger.info("[ARCHIVE] Start saving reports");
return patrolResultService.saveReportShaoxing(resultMain, finalLineIds, lineId, resultList, finalAiQxNum, finalCsQxNum);
return patrolResultService.saveReportShaoxing(resultMain, finalLineIds, lineId, resultList);
}, executor).exceptionally(ex -> { }, executor).exceptionally(ex -> {
logger.error("Report saving failed", ex); logger.error("Report saving failed", ex);
return Collections.emptyList(); return Collections.emptyList();
}); });
PrintUtil.useTime("保存报告数据", startTime);
startTime = System.currentTimeMillis();
startTime = PrintUtil.useTime("保存报告数据", startTime);
// 当saveReport完成后再异步处理所有导出任务 // 当saveReport完成后再异步处理所有导出任务
saveReportFuture.thenAcceptAsync(reportIds -> { saveReportFuture.thenAcceptAsync(reportIds -> {
logger.info("-----------[ARCHIVE] Saved export reportIds: {}", reportIds); logger.info("-----------[ARCHIVE] Saved export reportIds: {}", reportIds);
@ -607,7 +585,7 @@ public class PatrolTaskResultMainController extends BaseController {
// 点位汇总 // 点位汇总
List<String> statusList = Arrays.asList(MessageUtils.get("异常"), MessageUtils.get("缺陷"), MessageUtils.get("正常"));
List<String> statusList = Arrays.asList(MessageUtils.get("缺陷"), MessageUtils.get("异常"), MessageUtils.get("正常"));
// List<String> statusList = Collections.singletonList(MessageUtils.get("缺陷")); // List<String> statusList = Collections.singletonList(MessageUtils.get("缺陷"));
for (String status : statusList) { for (String status : statusList) {
addStatusSectionLingzhou(doc, report, status, images); addStatusSectionLingzhou(doc, report, status, images);
@ -2861,18 +2839,18 @@ public class PatrolTaskResultMainController extends BaseController {
// } // }
// } // }
InspectionReportData inspection = new InspectionReportData();
List<InspectionReportData> list = new ArrayList(); List<InspectionReportData> list = new ArrayList();
InspectionReportData inspectionReportData = new InspectionReportData();
inspectionReportData.setPointStatus(MessageUtils.get("缺陷"));
list.add(inspectionReportData);
InspectionReportData inspection = new InspectionReportData();
inspection.setPointStatus(MessageUtils.get("异常")); inspection.setPointStatus(MessageUtils.get("异常"));
list.add(inspection); list.add(inspection);
InspectionReportData inspectionReportData = new InspectionReportData();
// inspection.setPointStatus(MessageUtils.get("待人工确认"));
// list.add(inspection);
InspectionReportData inection = new InspectionReportData(); InspectionReportData inection = new InspectionReportData();
inection.setPointStatus(MessageUtils.get("正常")); inection.setPointStatus(MessageUtils.get("正常"));
list.add(inection); list.add(inection);
inspectionReportData.setPointStatus(MessageUtils.get("缺陷"));
list.add(inspectionReportData);
int total = 0; int total = 0;
label186: label186:
@ -3158,11 +3136,11 @@ public class PatrolTaskResultMainController extends BaseController {
CellRangeAddress callRangeAddress33 = new CellRangeAddress(3, 3, 8, 11); CellRangeAddress callRangeAddress33 = new CellRangeAddress(3, 3, 8, 11);
CellRangeAddress callRangeAddress34 = new CellRangeAddress(3, 3, 12, 14); CellRangeAddress callRangeAddress34 = new CellRangeAddress(3, 3, 12, 14);
CellRangeAddress callRangeAddress41 = new CellRangeAddress(4, 4, 0, 3); CellRangeAddress callRangeAddress41 = new CellRangeAddress(4, 4, 0, 3);
CellRangeAddress callRangeAddress42 = new CellRangeAddress(4, 4, 4, 7);
CellRangeAddress callRangeAddress43 = new CellRangeAddress(4, 4, 8, 11);
CellRangeAddress callRangeAddress44 = new CellRangeAddress(4, 4, 12, 14);
CellRangeAddress callRangeAddress42 = new CellRangeAddress(4, 4, 4, 14);
CellRangeAddress callRangeAddress51 = new CellRangeAddress(5, 5, 0, 3); CellRangeAddress callRangeAddress51 = new CellRangeAddress(5, 5, 0, 3);
CellRangeAddress callRangeAddress52 = new CellRangeAddress(5, 5, 4, 14); CellRangeAddress callRangeAddress52 = new CellRangeAddress(5, 5, 4, 14);
CellRangeAddress callRangeAddress61 = new CellRangeAddress(6, 6, 0, 3);
CellRangeAddress callRangeAddress62 = new CellRangeAddress(6, 6, 4, 14);
sheet.addMergedRegion(callRangeAddress01); sheet.addMergedRegion(callRangeAddress01);
sheet.addMergedRegion(callRangeAddress02); sheet.addMergedRegion(callRangeAddress02);
sheet.addMergedRegion(callRangeAddress03); sheet.addMergedRegion(callRangeAddress03);
@ -3178,10 +3156,10 @@ public class PatrolTaskResultMainController extends BaseController {
sheet.addMergedRegion(callRangeAddress34); sheet.addMergedRegion(callRangeAddress34);
sheet.addMergedRegion(callRangeAddress41); sheet.addMergedRegion(callRangeAddress41);
sheet.addMergedRegion(callRangeAddress42); sheet.addMergedRegion(callRangeAddress42);
sheet.addMergedRegion(callRangeAddress43);
sheet.addMergedRegion(callRangeAddress44);
sheet.addMergedRegion(callRangeAddress51); sheet.addMergedRegion(callRangeAddress51);
sheet.addMergedRegion(callRangeAddress52); sheet.addMergedRegion(callRangeAddress52);
sheet.addMergedRegion(callRangeAddress61);
sheet.addMergedRegion(callRangeAddress62);
Row row0 = sheet.createRow(0); Row row0 = sheet.createRow(0);
row0.setHeight((short) 600); row0.setHeight((short) 600);
Cell cell0 = row0.createCell(0); Cell cell0 = row0.createCell(0);
@ -3273,16 +3251,16 @@ public class PatrolTaskResultMainController extends BaseController {
cell62.setCellValue(inspectionReport.getInspectionTaskName()); cell62.setCellValue(inspectionReport.getInspectionTaskName());
cell62.setCellStyle(colStyle2); cell62.setCellStyle(colStyle2);
autoFitRowHeight(sheet, 4, 4, colStyle2); autoFitRowHeight(sheet, 4, 4, colStyle2);
Cell cell63 = row6.createCell(8);
cell63.setCellValue(MessageUtils.get("巡视统计"));
cell63.setCellStyle(colStyle2);
Cell cell64 = row6.createCell(12);
cell64.setCellValue(inspectionReport.getPatrolStatistics());
cell64.setCellStyle(colStyle2);
autoFitRowHeight(sheet, 4, 12, colStyle2);
// Cell cell63 = row6.createCell(8);
// cell63.setCellValue(MessageUtils.get("巡视统计"));
// cell63.setCellStyle(colStyle2);
// Cell cell64 = row6.createCell(12);
// cell64.setCellValue(inspectionReport.getPatrolStatistics());
// cell64.setCellStyle(colStyle2);
// autoFitRowHeight(sheet, 4, 12, colStyle2);
for (int i = 0; i < 15; ++i) { for (int i = 0; i < 15; ++i) {
if (i != 0 && i != 4 && i != 8 && i != 12) {
if (i != 0 && i != 4) {
cell14 = row6.createCell(i); cell14 = row6.createCell(i);
cell14.setCellStyle(colStyle2); cell14.setCellStyle(colStyle2);
} }
@ -3291,10 +3269,10 @@ public class PatrolTaskResultMainController extends BaseController {
Row row7 = sheet.createRow(5); Row row7 = sheet.createRow(5);
row7.setHeight((short) 1000); row7.setHeight((short) 1000);
Cell cell71 = row7.createCell(0); Cell cell71 = row7.createCell(0);
cell71.setCellValue(MessageUtils.get("巡视结论"));
cell71.setCellValue(MessageUtils.get("巡视统计"));
cell71.setCellStyle(colStyle2); cell71.setCellStyle(colStyle2);
Cell cell72 = row7.createCell(4); Cell cell72 = row7.createCell(4);
cell72.setCellValue(inspectionReport.getDescription());
cell72.setCellValue(inspectionReport.getPatrolStatistics());
cell72.setCellStyle(colStyle2); cell72.setCellStyle(colStyle2);
//qinyl //qinyl
@ -3304,26 +3282,43 @@ public class PatrolTaskResultMainController extends BaseController {
cell14.setCellStyle(colStyle2); cell14.setCellStyle(colStyle2);
} }
} }
Row row8 = sheet.createRow(6);
row8.setHeight((short) 1000);
Cell cell81 = row8.createCell(0);
cell81.setCellValue(MessageUtils.get("巡视结论"));
cell81.setCellStyle(colStyle2);
Cell cell82 = row8.createCell(4);
cell82.setCellValue(inspectionReport.getDescription());
cell82.setCellStyle(colStyle2);
//qinyl
for (int j = 0; j < 15; ++j) {
if (j != 0 && j != 4) {
cell14 = row8.createCell(j);
cell14.setCellStyle(colStyle2);
}
}
List<InspectionReportData> list = new ArrayList<>(); List<InspectionReportData> list = new ArrayList<>();
InspectionReportData inspectionReportQxData = new InspectionReportData(); InspectionReportData inspectionReportQxData = new InspectionReportData();
inspectionReportQxData.setPointStatus(MessageUtils.get("缺陷")); inspectionReportQxData.setPointStatus(MessageUtils.get("缺陷"));
list.add(inspectionReportQxData); list.add(inspectionReportQxData);
if ("1".equals(exportReportFlag)) { if ("1".equals(exportReportFlag)) {
InspectionReportData inspectionReportZcData = new InspectionReportData();
inspectionReportZcData.setPointStatus(MessageUtils.get("正常"));
list.add(inspectionReportZcData);
InspectionReportData inspectionReportYcData = new InspectionReportData(); InspectionReportData inspectionReportYcData = new InspectionReportData();
inspectionReportYcData.setPointStatus(MessageUtils.get("异常")); inspectionReportYcData.setPointStatus(MessageUtils.get("异常"));
list.add(inspectionReportYcData); list.add(inspectionReportYcData);
InspectionReportData inspectionReportZcData = new InspectionReportData();
inspectionReportZcData.setPointStatus(MessageUtils.get("正常"));
list.add(inspectionReportZcData);
} }
int total = 0; int total = 0;
label186: label186:
for (Iterator var74 = list.iterator(); var74.hasNext(); total += 2) { for (Iterator var74 = list.iterator(); var74.hasNext(); total += 2) {
InspectionReportData arr = (InspectionReportData) var74.next(); InspectionReportData arr = (InspectionReportData) var74.next();
SXSSFDrawing patriarch = sheet.createDrawingPatriarch(); SXSSFDrawing patriarch = sheet.createDrawingPatriarch();
CellRangeAddress callRangeAddressa1 = new CellRangeAddress(6 + total, 6 + total, 0, 14);
CellRangeAddress callRangeAddressa1 = new CellRangeAddress(7 + total, 7 + total, 0, 14);
sheet.addMergedRegion(callRangeAddressa1); sheet.addMergedRegion(callRangeAddressa1);
Row rowa1 = sheet.createRow(6 + total);
Row rowa1 = sheet.createRow(7 + total);
Cell cella1 = rowa1.createCell(0); Cell cella1 = rowa1.createCell(0);
cella1.setCellValue(arr.getPointStatus() + MessageUtils.get("点位汇总")); cella1.setCellValue(arr.getPointStatus() + MessageUtils.get("点位汇总"));
CellStyle styleab = wb.createCellStyle(); CellStyle styleab = wb.createCellStyle();
@ -3342,12 +3337,12 @@ public class PatrolTaskResultMainController extends BaseController {
} }
} }
CellRangeAddress callRangeAddressa12 = new CellRangeAddress(7 + total, 7 + total, 12, 14);
CellRangeAddress callRangeAddressa12 = new CellRangeAddress(8 + total, 8 + total, 12, 14);
sheet.addMergedRegion(callRangeAddressa12); sheet.addMergedRegion(callRangeAddressa12);
rowa1 = sheet.createRow(7 + total);
sheet.addMergedRegion(new CellRangeAddress(7 + total, 7 + total, 2, 4));
sheet.addMergedRegion(new CellRangeAddress(7 + total, 7 + total, 5, 6));
sheet.addMergedRegion(new CellRangeAddress(7 + total, 7 + total, 9, 10));
rowa1 = sheet.createRow(8 + total);
sheet.addMergedRegion(new CellRangeAddress(8 + total, 8 + total, 2, 4));
sheet.addMergedRegion(new CellRangeAddress(8 + total, 8 + total, 5, 6));
sheet.addMergedRegion(new CellRangeAddress(8 + total, 8 + total, 9, 10));
cella1 = rowa1.createCell(0); cella1 = rowa1.createCell(0);
cella1.setCellValue(MessageUtils.get("编号")); cella1.setCellValue(MessageUtils.get("编号"));
cella1.setCellStyle(colStyle2); cella1.setCellStyle(colStyle2);
@ -3422,9 +3417,9 @@ public class PatrolTaskResultMainController extends BaseController {
imgList = brr.getReportImgList(); imgList = brr.getReportImgList();
} }
CellRangeAddress callRangeAddressa4 = new CellRangeAddress(7 + total, 7 + total, 12, 14);
CellRangeAddress callRangeAddressa4 = new CellRangeAddress(8 + total, 8 + total, 12, 14);
sheet.addMergedRegion(callRangeAddressa4); sheet.addMergedRegion(callRangeAddressa4);
Row rowb1 = sheet.createRow(7 + total);
Row rowb1 = sheet.createRow(8 + total);
if (((List) imgList).size() > 0) { if (((List) imgList).size() > 0) {
rowb1.setHeight((short) 1000); rowb1.setHeight((short) 1000);
} }
@ -3481,22 +3476,22 @@ public class PatrolTaskResultMainController extends BaseController {
cella1 = rowb1.createCell(14); cella1 = rowb1.createCell(14);
cella1.setCellStyle(colStyle); cella1.setCellStyle(colStyle);
if (((List) imgList).size() > 0) { if (((List) imgList).size() > 0) {
sheet.addMergedRegion(new CellRangeAddress(7 + total, 7 + total + ((List) imgList).size(), 0, 0));
sheet.addMergedRegion(new CellRangeAddress(7 + total, 7 + total + ((List) imgList).size(), 1, 1));
sheet.addMergedRegion(new CellRangeAddress(7 + total, 7 + total + ((List) imgList).size(), 2, 4));
sheet.addMergedRegion(new CellRangeAddress(7 + total, 7 + total + ((List) imgList).size(), 5, 6));
sheet.addMergedRegion(new CellRangeAddress(7 + total, 7 + total + ((List) imgList).size(), 7, 7));
sheet.addMergedRegion(new CellRangeAddress(7 + total, 7 + total + ((List) imgList).size(), 8, 8));
sheet.addMergedRegion(new CellRangeAddress(7 + total, 7 + total + ((List) imgList).size(), 9, 10));
sheet.addMergedRegion(new CellRangeAddress(7 + total, 7 + total + ((List) imgList).size(), 11, 11));
sheet.addMergedRegion(new CellRangeAddress(8 + total, 8 + total + ((List) imgList).size(), 0, 0));
sheet.addMergedRegion(new CellRangeAddress(8 + total, 8 + total + ((List) imgList).size(), 1, 1));
sheet.addMergedRegion(new CellRangeAddress(8 + total, 8 + total + ((List) imgList).size(), 2, 4));
sheet.addMergedRegion(new CellRangeAddress(8 + total, 8 + total + ((List) imgList).size(), 5, 6));
sheet.addMergedRegion(new CellRangeAddress(8 + total, 8 + total + ((List) imgList).size(), 7, 7));
sheet.addMergedRegion(new CellRangeAddress(8 + total, 8 + total + ((List) imgList).size(), 8, 8));
sheet.addMergedRegion(new CellRangeAddress(8 + total, 8 + total + ((List) imgList).size(), 9, 10));
sheet.addMergedRegion(new CellRangeAddress(8 + total, 8 + total + ((List) imgList).size(), 11, 11));
Iterator var93 = ((List) imgList).iterator(); Iterator var93 = ((List) imgList).iterator();
while (var93.hasNext()) { while (var93.hasNext()) {
InspectionReportImg crr = (InspectionReportImg) var93.next(); InspectionReportImg crr = (InspectionReportImg) var93.next();
++total; ++total;
CellRangeAddress callRangeAddressb4 = new CellRangeAddress(7 + total, 7 + total, 12, 14);
CellRangeAddress callRangeAddressb4 = new CellRangeAddress(8 + total, 8 + total, 12, 14);
sheet.addMergedRegion(callRangeAddressb4); sheet.addMergedRegion(callRangeAddressb4);
rowb1 = sheet.createRow(7 + total);
rowb1 = sheet.createRow(8 + total);
rowb1.setHeight((short) 1000); rowb1.setHeight((short) 1000);
cella1 = rowb1.createCell(0); cella1 = rowb1.createCell(0);
cella1.setCellStyle(colStyle2); cella1.setCellStyle(colStyle2);
@ -3525,7 +3520,7 @@ public class PatrolTaskResultMainController extends BaseController {
cella1 = rowb1.createCell(12); cella1 = rowb1.createCell(12);
if (crr.getImgType().equals("0")) { if (crr.getImgType().equals("0")) {
try { try {
insertImage(wb, patriarch, this.images(crr.getImg(), inputStreamMap), 7 + total, 0, 2);
insertImage(wb, patriarch, this.images(crr.getImg(), inputStreamMap), 8 + total, 0, 2);
} catch (Exception var97) { } catch (Exception var97) {
var97.printStackTrace(); var97.printStackTrace();
} }
@ -3541,9 +3536,9 @@ public class PatrolTaskResultMainController extends BaseController {
cella1.setCellStyle(colStyle); cella1.setCellStyle(colStyle);
} }
} else { } else {
sheet.addMergedRegion(new CellRangeAddress(7 + total, 7 + total, 2, 4));
sheet.addMergedRegion(new CellRangeAddress(7 + total, 7 + total, 5, 6));
sheet.addMergedRegion(new CellRangeAddress(7 + total, 7 + total, 9, 10));
sheet.addMergedRegion(new CellRangeAddress(8 + total, 8 + total, 2, 4));
sheet.addMergedRegion(new CellRangeAddress(8 + total, 8 + total, 5, 6));
sheet.addMergedRegion(new CellRangeAddress(8 + total, 8 + total, 9, 10));
} }
} }
} }


Loading…
Cancel
Save