|
|
@ -56,6 +56,7 @@ import org.apache.poi.hssf.usermodel.HSSFWorkbook; |
|
|
import org.apache.poi.ss.usermodel.*; |
|
|
import org.apache.poi.ss.usermodel.*; |
|
|
import org.apache.poi.xssf.streaming.SXSSFSheet; |
|
|
import org.apache.poi.xssf.streaming.SXSSFSheet; |
|
|
import org.apache.poi.xssf.streaming.SXSSFWorkbook; |
|
|
import org.apache.poi.xssf.streaming.SXSSFWorkbook; |
|
|
|
|
|
import org.checkerframework.checker.nullness.qual.NonNull; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.http.ResponseEntity; |
|
|
import org.springframework.http.ResponseEntity; |
|
|
import org.springframework.web.bind.annotation.*; |
|
|
import org.springframework.web.bind.annotation.*; |
|
|
@ -250,10 +251,26 @@ public class PatrolTaskController extends BaseController { |
|
|
if (taskStatus == null) { |
|
|
if (taskStatus == null) { |
|
|
return getDataTable(2, new ArrayList<>(), new ArrayList<>()); |
|
|
return getDataTable(2, new ArrayList<>(), new ArrayList<>()); |
|
|
} |
|
|
} |
|
|
|
|
|
List<PatrolData> newList = getNewList(patrolTaskStatus, taskStatus.getTaskPatrolledId()); |
|
|
|
|
|
|
|
|
|
|
|
// 10. 分页(仍为内存分页,详见下方说明) |
|
|
|
|
|
PageDomain pageDomain = TableSupport.buildPageRequest(); |
|
|
|
|
|
int pageNum = pageDomain.getPageNum(); |
|
|
|
|
|
int pageSize = pageDomain.getPageSize(); |
|
|
|
|
|
int fromIndex = (pageNum - 1) * pageSize; |
|
|
|
|
|
int toIndex = Math.min(newList.size(), pageNum * pageSize); |
|
|
|
|
|
List<PatrolData> pageList = (fromIndex < newList.size()) |
|
|
|
|
|
? newList.subList(fromIndex, toIndex) |
|
|
|
|
|
: new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
|
|
return getDataTable(0, pageList, newList); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private List<PatrolData> getNewList(PatrolTaskStatus patrolTaskStatus, String taskPatrolledId) { |
|
|
// 查询算法列表 |
|
|
// 查询算法列表 |
|
|
List<AlgInfo> algInfos = patrolResultService.selectAlgInfo(new PatrolResult()); |
|
|
List<AlgInfo> algInfos = patrolResultService.selectAlgInfo(new PatrolResult()); |
|
|
ResultAnalysis resultAnalysis = new ResultAnalysis(); |
|
|
ResultAnalysis resultAnalysis = new ResultAnalysis(); |
|
|
resultAnalysis.setTaskPatrolId(taskStatus.getTaskPatrolledId()); |
|
|
|
|
|
|
|
|
resultAnalysis.setTaskPatrolId(taskPatrolledId); |
|
|
resultAnalysis.setPosType(patrolTaskStatus.getPosType()); |
|
|
resultAnalysis.setPosType(patrolTaskStatus.getPosType()); |
|
|
resultAnalysis.setFilter("1"); |
|
|
resultAnalysis.setFilter("1"); |
|
|
// 初筛数据(filter=1) |
|
|
// 初筛数据(filter=1) |
|
|
@ -291,7 +308,10 @@ public class PatrolTaskController extends BaseController { |
|
|
(a, b) -> a, |
|
|
(a, b) -> a, |
|
|
LinkedHashMap::new |
|
|
LinkedHashMap::new |
|
|
)); |
|
|
)); |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 初筛,大模型 大模型结果为最终缺陷 |
|
|
|
|
|
* 初筛,光明大模型 初筛结果为最终缺陷 |
|
|
|
|
|
*/ |
|
|
for (PatrolData item : newList) { |
|
|
for (PatrolData item : newList) { |
|
|
String key = item.getObjectId() + "_" + item.getAlgType(); |
|
|
String key = item.getObjectId() + "_" + item.getAlgType(); |
|
|
|
|
|
|
|
|
@ -410,18 +430,7 @@ public class PatrolTaskController extends BaseController { |
|
|
} |
|
|
} |
|
|
})); |
|
|
})); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 10. 分页(仍为内存分页,详见下方说明) |
|
|
|
|
|
PageDomain pageDomain = TableSupport.buildPageRequest(); |
|
|
|
|
|
int pageNum = pageDomain.getPageNum(); |
|
|
|
|
|
int pageSize = pageDomain.getPageSize(); |
|
|
|
|
|
int fromIndex = (pageNum - 1) * pageSize; |
|
|
|
|
|
int toIndex = Math.min(newList.size(), pageNum * pageSize); |
|
|
|
|
|
List<PatrolData> pageList = (fromIndex < newList.size()) |
|
|
|
|
|
? newList.subList(fromIndex, toIndex) |
|
|
|
|
|
: new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
|
|
return getDataTable(0, pageList, newList); |
|
|
|
|
|
|
|
|
return newList; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Log( |
|
|
@Log( |
|
|
@ -3100,184 +3109,7 @@ public class PatrolTaskController extends BaseController { |
|
|
public ResponseEntity taskInfoExport(HttpServletResponse response, PatrolTaskStatus patrolTaskStatus) throws Exception { |
|
|
public ResponseEntity taskInfoExport(HttpServletResponse response, PatrolTaskStatus patrolTaskStatus) throws Exception { |
|
|
long start = System.currentTimeMillis(); |
|
|
long start = System.currentTimeMillis(); |
|
|
PatrolTaskStatus patro = this.patrolTaskStatusService.selectPatrolTaskStatusByLineId(patrolTaskStatus.getLineId()); |
|
|
PatrolTaskStatus patro = this.patrolTaskStatusService.selectPatrolTaskStatusByLineId(patrolTaskStatus.getLineId()); |
|
|
ResultAnalysis resultAnalysis = new ResultAnalysis(); |
|
|
|
|
|
resultAnalysis.setTaskPatrolId(patro.getTaskPatrolledId()); |
|
|
|
|
|
resultAnalysis.setFilter("1"); |
|
|
|
|
|
resultAnalysis.setPosType(patrolTaskStatus.getPosType()); |
|
|
|
|
|
List<PatrolData> filterList = patrolResultService.selectPatrolDataResultByTaskCodeV2(resultAnalysis); |
|
|
|
|
|
List<AlgInfo> algInfos = patrolResultService.selectAlgInfo(new PatrolResult()); |
|
|
|
|
|
resultAnalysis.setFilter("0"); |
|
|
|
|
|
List<PatrolData> newList = patrolResultService.selectPatrolDataResultByTaskCodeV2(resultAnalysis); |
|
|
|
|
|
// 光明大模型数据 |
|
|
|
|
|
resultAnalysis.setFilter("2"); |
|
|
|
|
|
List<PatrolData> brightNewList = patrolResultService.selectPatrolDataResultByTaskCodeV2(resultAnalysis); |
|
|
|
|
|
int maxNum = Integer.parseInt(patrolTaskService.selectConfigByKey("MAX_NUM")); |
|
|
|
|
|
for (PatrolData item : newList) { |
|
|
|
|
|
item.setAlgName( |
|
|
|
|
|
algInfos.stream().anyMatch((alg) -> { |
|
|
|
|
|
return alg.getAlgSubtypeCode().equals(item.getAlgType()); |
|
|
|
|
|
}) ? |
|
|
|
|
|
algInfos.stream().filter((alg) -> { |
|
|
|
|
|
return alg.getAlgSubtypeCode().equals(item.getAlgType()); |
|
|
|
|
|
}).findFirst().get().getAlgSubtypeName() : "" |
|
|
|
|
|
); |
|
|
|
|
|
if ("0".equals(item.getFilter())) { |
|
|
|
|
|
List<PatrolData> filterDatas = filterList.stream().filter((data) -> { |
|
|
|
|
|
return data.getObjectId().equals(item.getObjectId()) && data.getAlgType().equals(item.getAlgType()); |
|
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
|
if (!filterDatas.isEmpty()) { |
|
|
|
|
|
item.setImg((filterDatas.get(0)).getImgAnalyse()); |
|
|
|
|
|
item.setFilterDesc((filterDatas.get(0)).getDesc()); |
|
|
|
|
|
if (StringUtils.isEmpty(item.getImageNormalUrlPath())) { |
|
|
|
|
|
item.setImageNormalUrlPath((filterDatas.get(0)).getImageNormalUrlPath()); |
|
|
|
|
|
} |
|
|
|
|
|
// filterList.remove(filterDatas.get(0)); |
|
|
|
|
|
filterList.removeAll(filterDatas); |
|
|
|
|
|
} |
|
|
|
|
|
// 光明大模型数据 |
|
|
|
|
|
List<PatrolData> brightDatas = brightNewList.stream().filter((bright) -> { |
|
|
|
|
|
return bright.getObjectId().equals(item.getObjectId()) && bright.getAlgType().equals(item.getAlgType()); |
|
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
|
if (!brightDatas.isEmpty()) { |
|
|
|
|
|
item.setBrightDesc(brightDatas.get(0).getDesc()); |
|
|
|
|
|
item.setBrightResStatus(brightDatas.get(0).getResStatus()); |
|
|
|
|
|
item.setBrightImgAnalyse(brightDatas.get(0).getImgAnalyse()); |
|
|
|
|
|
// brightNewList.remove(brightDatas.get(0)); |
|
|
|
|
|
brightNewList.removeAll(brightDatas); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
AlgValue algValue = new AlgValue(); |
|
|
|
|
|
if (item.getResValue() != null) { |
|
|
|
|
|
String str = algValue.formatValue(item.getResValue()); |
|
|
|
|
|
if ("meter".equals(item.getAlgType())) { |
|
|
|
|
|
if (str.equals("-1")) { |
|
|
|
|
|
item.setResValue(MessageUtils.get("空值")); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
for (PatrolData item : filterList) { |
|
|
|
|
|
// 光明大模型数据 |
|
|
|
|
|
List<PatrolData> brightDatas = brightNewList.stream().filter((bright) -> { |
|
|
|
|
|
return bright.getObjectId().equals(item.getObjectId()) && bright.getAlgType().equals(item.getAlgType()); |
|
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
|
if (!brightDatas.isEmpty()) { |
|
|
|
|
|
item.setBrightDesc(brightDatas.get(0).getDesc()); |
|
|
|
|
|
item.setBrightResStatus(brightDatas.get(0).getResStatus()); |
|
|
|
|
|
item.setBrightImgAnalyse(brightDatas.get(0).getImgAnalyse()); |
|
|
|
|
|
// brightNewList.remove(brightDatas.get(0)); |
|
|
|
|
|
brightNewList.removeAll(brightDatas); |
|
|
|
|
|
} |
|
|
|
|
|
item.setAlgName( |
|
|
|
|
|
algInfos.stream().anyMatch((alg) -> { |
|
|
|
|
|
return alg.getAlgSubtypeCode().equals(item.getAlgType()); |
|
|
|
|
|
}) ? |
|
|
|
|
|
algInfos.stream().filter((alg) -> { |
|
|
|
|
|
return alg.getAlgSubtypeCode().equals(item.getAlgType()); |
|
|
|
|
|
}).findFirst().get().getAlgSubtypeName() : "" |
|
|
|
|
|
); |
|
|
|
|
|
AlgValue algValue = new AlgValue(); |
|
|
|
|
|
if (item.getResValue() != null) { |
|
|
|
|
|
String str = algValue.formatValue(item.getResValue()); |
|
|
|
|
|
if ("meter".equals(item.getAlgType())) { |
|
|
|
|
|
if (str.equals("-1")) { |
|
|
|
|
|
item.setResValue(MessageUtils.get("空值")); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
item.setFilterDesc(item.getDesc()); |
|
|
|
|
|
item.setDesc(""); |
|
|
|
|
|
} |
|
|
|
|
|
for (PatrolData item : brightNewList) { |
|
|
|
|
|
item.setAlgName( |
|
|
|
|
|
algInfos.stream().anyMatch((alg) -> { |
|
|
|
|
|
return alg.getAlgSubtypeCode().equals(item.getAlgType()); |
|
|
|
|
|
}) ? |
|
|
|
|
|
algInfos.stream().filter((alg) -> { |
|
|
|
|
|
return alg.getAlgSubtypeCode().equals(item.getAlgType()); |
|
|
|
|
|
}).findFirst().get().getAlgSubtypeName() : "" |
|
|
|
|
|
); |
|
|
|
|
|
AlgValue algValue = new AlgValue(); |
|
|
|
|
|
if (item.getResValue() != null) { |
|
|
|
|
|
String str = algValue.formatValue(item.getResValue()); |
|
|
|
|
|
if ("meter".equals(item.getAlgType())) { |
|
|
|
|
|
if (str.equals("-1")) { |
|
|
|
|
|
item.setResValue("空值"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
item.setBrightDesc(item.getDesc()); |
|
|
|
|
|
item.setBrightResStatus(item.getResStatus()); |
|
|
|
|
|
item.setBrightImgAnalyse(item.getImgAnalyse()); |
|
|
|
|
|
item.setDesc(""); |
|
|
|
|
|
} |
|
|
|
|
|
newList.addAll(filterList); |
|
|
|
|
|
newList.addAll(brightNewList); |
|
|
|
|
|
Map<String, PatrolData> keyPatrolData = new LinkedHashMap<>(); |
|
|
|
|
|
for (PatrolData patrolData : newList) { |
|
|
|
|
|
keyPatrolData.putIfAbsent(patrolData.getObjectId() + "_" + patrolData.getAlgType(), patrolData); |
|
|
|
|
|
} |
|
|
|
|
|
newList = new ArrayList<>(keyPatrolData.values()); |
|
|
|
|
|
if (StringUtils.isNotEmpty(patrolTaskStatus.getAlgName())) { |
|
|
|
|
|
newList = newList.stream().filter((element) -> patrolTaskStatus.getAlgName().equals(element.getAlgName())).collect(Collectors.toList()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isNotEmpty(patrolTaskStatus.getFilterDesc())) { |
|
|
|
|
|
newList = newList.stream().filter((element) -> patrolTaskStatus.getFilterDesc().equals(element.getFilterDesc())).collect(Collectors.toList()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isNotEmpty(patrolTaskStatus.getDeviceName())) { |
|
|
|
|
|
newList = newList.stream().filter((element) -> { |
|
|
|
|
|
return patrolTaskStatus.getDeviceName().equals(element.getDeviceName()); |
|
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isNotEmpty(patrolTaskStatus.getPointName())) { |
|
|
|
|
|
newList = newList.stream().filter((element) -> { |
|
|
|
|
|
return patrolTaskStatus.getPointName().equals(element.getPointName()); |
|
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isNotEmpty(patrolTaskStatus.getChannelName())) { |
|
|
|
|
|
newList = newList.stream().filter((element) -> { |
|
|
|
|
|
return patrolTaskStatus.getChannelName().equals(element.getChannelName()); |
|
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isNotEmpty(patrolTaskStatus.getDeviceSource())) { |
|
|
|
|
|
newList = newList.stream().filter((element) -> { |
|
|
|
|
|
return patrolTaskStatus.getDeviceSource().equals(element.getDeviceSource()); |
|
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isNotEmpty(patrolTaskStatus.getPointStatus())) { |
|
|
|
|
|
newList = newList.stream().filter((element) -> { |
|
|
|
|
|
return patrolTaskStatus.getPointStatus().equals(element.getPointStatus()); |
|
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isNotEmpty(patrolTaskStatus.getDesc())) { |
|
|
|
|
|
newList = newList.stream().filter((element) -> { |
|
|
|
|
|
return patrolTaskStatus.getDesc().equals(element.getDesc()); |
|
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isNotEmpty(patrolTaskStatus.getResultType())) { |
|
|
|
|
|
newList = newList.stream().filter((element) -> { |
|
|
|
|
|
return patrolTaskStatus.getResultType().equals(element.getWarnStatus()); |
|
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if ("1".equals(patrolTaskStatus.getAbnormal())) { |
|
|
|
|
|
// 异常置顶 |
|
|
|
|
|
newList.sort(Comparator.comparing(PatrolData::getPointStatus)); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// if (newList.size() > maxNum) { |
|
|
|
|
|
// return ResponseEntity.ok("超过最大导出数量:" + maxNum + "条,请结合查询条件减少导出的数量!"); |
|
|
|
|
|
// } |
|
|
|
|
|
|
|
|
List<PatrolData> newList = getNewList(patrolTaskStatus, patro.getTaskPatrolledId()); |
|
|
logger.info("数据处理耗时: {} ms", (System.currentTimeMillis() - start)); |
|
|
logger.info("数据处理耗时: {} ms", (System.currentTimeMillis() - start)); |
|
|
long startExport = System.currentTimeMillis(); |
|
|
long startExport = System.currentTimeMillis(); |
|
|
exportExcelV2(response, newList); |
|
|
exportExcelV2(response, newList); |
|
|
@ -3544,9 +3376,37 @@ public class PatrolTaskController extends BaseController { |
|
|
row.createCell(col++).setCellValue(item.getPointId()); |
|
|
row.createCell(col++).setCellValue(item.getPointId()); |
|
|
row.createCell(col++).setCellValue(item.getPointName()); |
|
|
row.createCell(col++).setCellValue(item.getPointName()); |
|
|
// 状态 |
|
|
// 状态 |
|
|
String status = "1".equals(item.getPointStatus()) ? MessageUtils.get("正常") : |
|
|
|
|
|
"0".equals(item.getPointStatus()) ? MessageUtils.get("异常") : |
|
|
|
|
|
MessageUtils.get("待人工确认"); |
|
|
|
|
|
|
|
|
String status; |
|
|
|
|
|
if (StringUtils.isNotEmpty(item.getPointStatus())) { |
|
|
|
|
|
switch (item.getPointStatus()) { |
|
|
|
|
|
case "1": |
|
|
|
|
|
status = MessageUtils.get("正常"); |
|
|
|
|
|
break; |
|
|
|
|
|
case "0": |
|
|
|
|
|
status = MessageUtils.get("异常"); |
|
|
|
|
|
break; |
|
|
|
|
|
case "2": |
|
|
|
|
|
status = MessageUtils.get("待人工确认"); |
|
|
|
|
|
break; |
|
|
|
|
|
case "3": |
|
|
|
|
|
status = MessageUtils.get("忽略"); |
|
|
|
|
|
break; |
|
|
|
|
|
case "4": |
|
|
|
|
|
status = MessageUtils.get("跟踪"); |
|
|
|
|
|
break; |
|
|
|
|
|
case "5": |
|
|
|
|
|
status = MessageUtils.get("确认"); |
|
|
|
|
|
break; |
|
|
|
|
|
case "6": |
|
|
|
|
|
status = MessageUtils.get("缺陷"); |
|
|
|
|
|
break; |
|
|
|
|
|
default: |
|
|
|
|
|
status = item.getPointStatus(); // 或默认值 |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
status = ""; // 或默认值 |
|
|
|
|
|
} |
|
|
row.createCell(col++).setCellValue(status); |
|
|
row.createCell(col++).setCellValue(status); |
|
|
// 算法信息 |
|
|
// 算法信息 |
|
|
row.createCell(col++).setCellValue(item.getAlgName()); |
|
|
row.createCell(col++).setCellValue(item.getAlgName()); |
|
|
|