Browse Source

绍兴新需求,缺陷合并

master
wangguangyuan 3 months ago
parent
commit
3333e54847
4 changed files with 124 additions and 3 deletions
  1. +87
    -2
      inspect-main/inspect-main-task/src/main/java/com/inspect/analysis/controller/ResultAnalysisController.java
  2. +31
    -1
      inspect-main/inspect-main-task/src/main/java/com/inspect/taskstatus/controller/PatrolTaskStatusController.java
  3. +3
    -0
      inspect-main/inspect-main-task/src/main/java/com/inspect/taskstatus/domain/PatrolTaskStatus.java
  4. +3
    -0
      inspect-main/inspect-main-task/src/main/resources/mapper/task/PatrolResultMapper.xml

+ 87
- 2
inspect-main/inspect-main-task/src/main/java/com/inspect/analysis/controller/ResultAnalysisController.java View File

@ -2,6 +2,7 @@ package com.inspect.analysis.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageInfo;
import com.inspect.analysis.domain.*;
import com.inspect.analysis.service.IResultAnalysisService;
import com.inspect.base.core.constant.Color;
@ -10,7 +11,9 @@ import com.inspect.base.core.utils.StringUtils;
import com.inspect.base.core.utils.poi.ExcelUtil;
import com.inspect.base.core.web.controller.BaseController;
import com.inspect.base.core.web.domain.AjaxResult;
import com.inspect.base.core.web.page.PageDomain;
import com.inspect.base.core.web.page.TableDataInfo;
import com.inspect.base.core.web.page.TableSupport;
import com.inspect.common.log.annotation.Log;
import com.inspect.common.log.enums.BizType;
import com.inspect.message.MessageUtils;
@ -641,8 +644,90 @@ public class ResultAnalysisController extends BaseController {
}
}
});
Collections.sort(filterList);
return getDataTable(filterList);
Map<GroupKey, List<PatrolData>> groupedFilterList = filterList.stream().collect(Collectors.groupingBy(
item -> new GroupKey(item.getObjectId(), item.getAlgType())
));
List<PatrolData> resultList = new ArrayList<>();
groupedFilterList.forEach((key, value) -> {
PatrolData patrolData = new PatrolData();
patrolData.setObjectId(key.objectId);
patrolData.setAlgType(key.algType);
patrolData.setDesc(value.stream().map(PatrolData::getDesc).distinct().collect(Collectors.joining(",")));
for (PatrolData data : value) {
// 初筛有缺陷 展示初筛结果图片
if ("1".equals(data.getFilter()) && StringUtils.isEmpty(patrolData.getImgAnalyse())) {
patrolData.setImgAnalyse(data.getImgAnalyse());
}
// 大模型有缺陷 展示大模型结果图片
if ("0".equals(data.getFilter())) {
patrolData.setImgAnalyse(data.getImgAnalyse());
}
}
patrolData.setImageNormalUrlPath(value.stream().map(item -> item.getImageNormalUrlPath() != null ? item.getImageNormalUrlPath() : "").distinct().findFirst().orElse(""));
patrolData.setAlgName(value.stream().map(item -> item.getAlgName() != null ? item.getAlgName() : "").distinct().findFirst().orElse(""));
patrolData.setAreaName(value.stream().map(item -> item.getAreaName() != null ? item.getAreaName() : "").distinct().findFirst().orElse(""));
patrolData.setBrightDesc(value.stream().map(item -> item.getBrightDesc() != null ? item.getBrightDesc() : "").distinct().findFirst().orElse(""));
patrolData.setBrightImgAnalyse(value.stream().map(item -> item.getBrightImgAnalyse() != null ? item.getBrightImgAnalyse() : "").distinct().findFirst().orElse(""));
patrolData.setBrightResStatus(value.stream().map(item -> item.getBrightResStatus() != null ? item.getBrightResStatus() : "").distinct().findFirst().orElse(""));
patrolData.setChannelName(value.stream().map(item -> item.getChannelName() != null ? item.getChannelName() : "").distinct().findFirst().orElse(""));
patrolData.setDataType(value.stream().map(item -> item.getDataType() != null ? item.getDataType() : "").distinct().findFirst().orElse(""));
patrolData.setDeviceName(value.stream().map(item -> item.getDeviceName() != null ? item.getDeviceName() : "").distinct().findFirst().orElse(""));
patrolData.setDeviceSource(value.stream().map(item -> item.getDeviceSource() != null ? item.getDeviceSource() : "").distinct().findFirst().orElse(""));
patrolData.setImgType(value.stream().map(item -> item.getImgType() != null ? item.getImgType() : "").distinct().findFirst().orElse(""));
patrolData.setLineId(value.stream().map(item -> item.getLineId() != null ? item.getLineId() : "").distinct().findFirst().orElse(""));
patrolData.setPatrolTime(value.stream().map(item -> item.getPatrolTime() != null ? item.getPatrolTime() : "").distinct().findFirst().orElse(""));
patrolData.setPointId(value.stream().map(item -> item.getPointId() != null ? item.getPointId() : "").distinct().findFirst().orElse(""));
patrolData.setPointName(value.stream().map(item -> item.getPointName() != null ? item.getPointName() : "").distinct().findFirst().orElse(""));
patrolData.setPointStatus(value.stream().map(item -> item.getPointStatus() != null ? item.getPointStatus() : "").distinct().findFirst().orElse(""));
patrolData.setRequestId(value.stream().map(item -> item.getRequestId() != null ? item.getRequestId() : "").distinct().findFirst().orElse(""));
patrolData.setResValue(value.stream().map(item -> item.getResValue() != null ? item.getResValue() : "").distinct().findFirst().orElse(""));
patrolData.setResStatus(value.stream().map(item -> item.getResStatus() != null ? item.getResStatus() : "").distinct().findFirst().orElse(""));
patrolData.setSuggestion(value.stream().map(item -> item.getSuggestion() != null ? item.getSuggestion() : "").distinct().findFirst().orElse(""));
patrolData.setWarnStatus(value.stream().map(item -> item.getWarnStatus() != null ? item.getWarnStatus() : "").distinct().findFirst().orElse(""));
resultList.add(patrolData);
});
Collections.sort(resultList);
PageDomain pageDomain = TableSupport.buildPageRequest();
int pageNum = pageDomain.getPageNum();
int pageSize = pageDomain.getPageSize();
int toNum = Math.min(resultList.size(), pageNum * pageSize);
List<PatrolData> pageList = resultList.subList((pageNum - 1) * pageSize, toNum);
TableDataInfo rspData = new TableDataInfo();
rspData.setCode(200);
rspData.setRows(pageList);
rspData.setMsg("查询成功");
rspData.setTotal((new PageInfo<>(resultList)).getTotal());
return rspData;
}
private static class GroupKey {
private final String objectId;
private final String algType;
public GroupKey(String objectId, String algType) {
this.objectId = objectId;
this.algType = algType;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
GroupKey groupKey = (GroupKey) o;
return Objects.equals(objectId, groupKey.objectId) && Objects.equals(algType, groupKey.algType);
}
@Override
public int hashCode() {
return Objects.hash(objectId, algType);
}
}
@GetMapping({"/list_v3"})


+ 31
- 1
inspect-main/inspect-main-task/src/main/java/com/inspect/taskstatus/controller/PatrolTaskStatusController.java View File

@ -181,7 +181,13 @@ public class PatrolTaskStatusController extends BaseController {
item.setAiQxNum(analysisRes == null ? 0 : analysisRes.getAiQxNum());
item.setCsYcNum(analysisRes == null ? 0 : analysisRes.getCsYcNum());
item.setAiYcNum(analysisRes == null ? 0 : analysisRes.getAiYcNum());
resultAnalysis.setResultType("0");
resultAnalysis.setTaskPatrolId(item.getTaskPatrolledId());
List<ResultAnalysis> filterList = resultAnalysisService.selectResultAnalysisList(resultAnalysis);
Map<GroupKey, List<ResultAnalysis>> groupedFilterList = filterList.stream().collect(Collectors.groupingBy(
data -> new GroupKey(data.getObjectId(), data.getAlgType())
));
item.setQxNum(groupedFilterList.size());
if(StringUtils.isEmpty(item.getTaskEstimatedTime())) {
item.setTaskEstimatedTime("0");
}
@ -190,6 +196,30 @@ public class PatrolTaskStatusController extends BaseController {
}
private static class GroupKey {
private final String objectId;
private final String algType;
public GroupKey(String objectId, String algType) {
this.objectId = objectId;
this.algType = algType;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
GroupKey groupKey = (GroupKey) o;
return Objects.equals(objectId, groupKey.objectId) && Objects.equals(algType, groupKey.algType);
}
@Override
public int hashCode() {
return Objects.hash(objectId, algType);
}
}
@Log(title = "任务状态数据", businessType = BizType.EXPORT)
@PostMapping({"/export"})
public void export(HttpServletResponse response, PatrolTaskStatus patrolTaskStatus) {


+ 3
- 0
inspect-main/inspect-main-task/src/main/java/com/inspect/taskstatus/domain/PatrolTaskStatus.java View File

@ -105,6 +105,8 @@ public class PatrolTaskStatus extends BaseEntity {
private int csYcNum;
private int aiQxNum;
private int aiYcNum;
private int qxNum;
private String resultType;
private String pointStatus;
private String algName;
@ -158,6 +160,7 @@ public class PatrolTaskStatus extends BaseEntity {
", csYcNum=" + csYcNum +
", aiQxNum=" + aiQxNum +
", aiYcNum=" + aiYcNum +
", qxNum=" + qxNum +
", resultType='" + resultType + '\'' +
", pointStatus='" + pointStatus + '\'' +
", algName='" + algName + '\'' +


+ 3
- 0
inspect-main/inspect-main-task/src/main/resources/mapper/task/PatrolResultMapper.xml View File

@ -222,6 +222,9 @@
b.description as 'desc',
<if test="filter == 0 ">a.file_path as img,</if>
<if test="filter == 1 ">b.res_img_url as img,</if>
<if test="filter == null or filter ==''">
case when b.filter = 0 then a.file_path else b.res_img_url end as img,
</if>
case when b.image_normal_url_path is null or b.image_normal_url_path = '' then a.file_path else b.image_normal_url_path end as image_normal_url_path,
a.file_type as img_type,
a.data_type,


Loading…
Cancel
Save