Browse Source

fix:1.联合任务归档task_patrolled_id改成mainId,2.分析失败的结果状态归为异常,3.纠偏的缺陷结果不需要在缺陷详情中展示

master
wangguangyuan 3 weeks ago
parent
commit
4ed94ad548
9 changed files with 47 additions and 16 deletions
  1. +8
    -2
      inspect-main/inspect-main-task/src/main/java/com/inspect/analysis/controller/ResultAnalysisController.java
  2. +1
    -0
      inspect-main/inspect-main-task/src/main/java/com/inspect/analysis/utils/ResultAnalysisUtils.java
  3. +6
    -3
      inspect-main/inspect-main-task/src/main/java/com/inspect/insreport/controller/InspectionReportController.java
  4. +3
    -0
      inspect-main/inspect-main-task/src/main/java/com/inspect/insreportdata/domain/InspectionReportData.java
  5. +2
    -0
      inspect-main/inspect-main-task/src/main/java/com/inspect/partrolresult/domain/PatrolResultRef.java
  6. +19
    -7
      inspect-main/inspect-main-task/src/main/java/com/inspect/partrolresult/service/impl/PatrolResultServiceImpl.java
  7. +1
    -1
      inspect-main/inspect-main-task/src/main/java/com/inspect/task/controller/PatrolTaskController.java
  8. +5
    -3
      inspect-main/inspect-main-task/src/main/resources/mapper/task/InspectionReportDataMapper.xml
  9. +2
    -0
      inspect-main/inspect-main-task/src/main/resources/mapper/task/PatrolResultMapper.xml

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

@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.inspect.analysis.domain.*; import com.inspect.analysis.domain.*;
import com.inspect.analysis.service.IResultAnalysisService; import com.inspect.analysis.service.IResultAnalysisService;
import com.inspect.base.core.constant.AlgConstants;
import com.inspect.base.core.domain.Response; import com.inspect.base.core.domain.Response;
import com.inspect.base.core.enums.PointStatusEnum; import com.inspect.base.core.enums.PointStatusEnum;
import com.inspect.base.core.utils.StringUtils; import com.inspect.base.core.utils.StringUtils;
@ -814,10 +815,15 @@ public class ResultAnalysisController extends BaseController {
item -> new GroupKey(item.getObjectId(), item.getAlgType()) item -> new GroupKey(item.getObjectId(), item.getAlgType())
)); ));
List<PatrolData> resultList = new ArrayList<>(); List<PatrolData> resultList = new ArrayList<>();
groupedFilterList.forEach((key, value) -> {
for (Map.Entry<GroupKey, List<PatrolData>> groupKeyListEntry : groupedFilterList.entrySet()) {
GroupKey key = groupKeyListEntry.getKey();
List<PatrolData> value = groupKeyListEntry.getValue();
PatrolData patrolData = new PatrolData(); PatrolData patrolData = new PatrolData();
patrolData.setObjectId(key.objectId); patrolData.setObjectId(key.objectId);
patrolData.setAlgType(key.algType); patrolData.setAlgType(key.algType);
if (AlgConstants.CORRECTION.equals(key.algType)) {
continue;
}
patrolData.setDesc(value.stream().map(PatrolData::getDesc).distinct().collect(Collectors.joining(","))); patrolData.setDesc(value.stream().map(PatrolData::getDesc).distinct().collect(Collectors.joining(",")));
for (PatrolData data : value) { for (PatrolData data : value) {
// 初筛有缺陷 展示初筛结果图片 // 初筛有缺陷 展示初筛结果图片
@ -857,7 +863,7 @@ public class ResultAnalysisController extends BaseController {
patrolData.setWarnStatus(value.stream().map(item -> item.getWarnStatus() != null ? item.getWarnStatus() : "").distinct().findFirst().orElse("")); patrolData.setWarnStatus(value.stream().map(item -> item.getWarnStatus() != null ? item.getWarnStatus() : "").distinct().findFirst().orElse(""));
resultList.add(patrolData); resultList.add(patrolData);
});
}
Collections.sort(resultList); Collections.sort(resultList);


+ 1
- 0
inspect-main/inspect-main-task/src/main/java/com/inspect/analysis/utils/ResultAnalysisUtils.java View File

@ -441,6 +441,7 @@ public class ResultAnalysisUtils {
} }
if (StringUtils.isNotEmpty(defaultDesc) && defaultDesc.contains(messageUtils.get("分析失败"))) { if (StringUtils.isNotEmpty(defaultDesc) && defaultDesc.contains(messageUtils.get("分析失败"))) {
resultAnalysis.setResultType("2"); resultAnalysis.setResultType("2");
resultAnalysis.setPointStatus(PointStatusEnum.ABNORMAL.getCode());
} }
} }
resultAnalysis.setDescription(defaultDesc); resultAnalysis.setDescription(defaultDesc);


+ 6
- 3
inspect-main/inspect-main-task/src/main/java/com/inspect/insreport/controller/InspectionReportController.java View File

@ -260,18 +260,21 @@ public class InspectionReportController extends BaseController {
if (StringUtils.isEmpty(reportData.getTaskPatrolledId())) { if (StringUtils.isEmpty(reportData.getTaskPatrolledId())) {
reportData.setTaskPatrolledId(inspectionReport.getTaskPatrolledId()); reportData.setTaskPatrolledId(inspectionReport.getTaskPatrolledId());
} }
if (StringUtils.isEmpty(reportData.getTaskResultId())) {
reportData.setTaskResultId(inspectionReport.getTaskResultId());
}
} }
// inspectionReport.setInfo(inspectionReportDataList); // inspectionReport.setInfo(inspectionReportDataList);
Map<String, List<Map<String, List<InspectionReportData>>>> resultTaskInfoMap = new HashMap<>(); Map<String, List<Map<String, List<InspectionReportData>>>> resultTaskInfoMap = new HashMap<>();
// pointStatus 分组再按 taskPatrolledId_taskName 分组
// key: pointStatusvalue: {taskPatrolledId_taskName -> List<InspectionReportData>}
// pointStatus 分组再按 taskResultId_taskName 分组
// key: pointStatusvalue: {taskResultId_taskName -> List<InspectionReportData>}
Map<String, Map<String, List<InspectionReportData>>> detailGrouped = Map<String, Map<String, List<InspectionReportData>>> detailGrouped =
inspectionReportDataList.stream() inspectionReportDataList.stream()
.collect(Collectors.groupingBy( .collect(Collectors.groupingBy(
item -> item.getPointStatus() == null ? "unknown" : item.getPointStatus(), item -> item.getPointStatus() == null ? "unknown" : item.getPointStatus(),
Collectors.groupingBy(item -> item.getTaskPatrolledId() + "_" + item.getTaskName())
Collectors.groupingBy(item -> item.getTaskResultId() + "_" + item.getTaskName())
)); ));
// 将分组结果转换为所需的格式 // 将分组结果转换为所需的格式
for (Map.Entry<String, Map<String, List<InspectionReportData>>> stringMapEntry : detailGrouped.entrySet()) { for (Map.Entry<String, Map<String, List<InspectionReportData>>> stringMapEntry : detailGrouped.entrySet()) {


+ 3
- 0
inspect-main/inspect-main-task/src/main/java/com/inspect/insreportdata/domain/InspectionReportData.java View File

@ -74,6 +74,8 @@ public class InspectionReportData extends BaseEntity {
private String taskPatrolledId; private String taskPatrolledId;
private String taskResultId;
@Override @Override
public boolean equals(Object object) { public boolean equals(Object object) {
if (this == object) return true; if (this == object) return true;
@ -107,6 +109,7 @@ public class InspectionReportData extends BaseEntity {
", algName='" + algName + '\'' + ", algName='" + algName + '\'' +
", taskName='" + taskName + '\'' + ", taskName='" + taskName + '\'' +
", taskPatrolledId='" + taskPatrolledId + '\'' + ", taskPatrolledId='" + taskPatrolledId + '\'' +
", taskResultId='" + taskResultId + '\'' +
'}'; '}';
} }
} }

+ 2
- 0
inspect-main/inspect-main-task/src/main/java/com/inspect/partrolresult/domain/PatrolResultRef.java View File

@ -9,6 +9,7 @@ import java.util.Objects;
@Getter @Getter
public class PatrolResultRef { public class PatrolResultRef {
private String lineId; private String lineId;
private Long mainId;
private String deviceId; private String deviceId;
private String devType; private String devType;
private String deviceSource; private String deviceSource;
@ -55,6 +56,7 @@ public class PatrolResultRef {
public String toString() { public String toString() {
return "PatrolResultRef{" + return "PatrolResultRef{" +
"lineId='" + lineId + '\'' + "lineId='" + lineId + '\'' +
", mainId=" + mainId + '\'' +
", deviceId='" + deviceId + '\'' + ", deviceId='" + deviceId + '\'' +
", devType='" + devType + '\'' + ", devType='" + devType + '\'' +
", deviceSource='" + deviceSource + '\'' + ", deviceSource='" + deviceSource + '\'' +


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

@ -771,7 +771,8 @@ public class PatrolResultServiceImpl implements IPatrolResultService {
report.setFilter("0"); report.setFilter("0");
report.setStationType(stationType); report.setStationType(stationType);
inspectionReportMapper.insertInspectionReport(report); inspectionReportMapper.insertInspectionReport(report);
batchInsertReportData_shaoxing(String.valueOf(report.getLineId()), patrolResultRefs, basePointAreaInfoList, taskPatrolledIds);
// 为每个报告生成数据
batchInsertReportData_shaoxing(String.valueOf(report.getLineId()), patrolResultRefs, basePointAreaInfoList, lineIds);
reportIds.add(report.getLineId()); reportIds.add(report.getLineId());
} }
} }
@ -1264,11 +1265,11 @@ public class PatrolResultServiceImpl implements IPatrolResultService {
} }
} }
public void batchInsertReportData_shaoxing(String reportId, List<PatrolResultRef> patrolResultRefs, List<BasePointAreaInfo> basePointAreaInfoList, List<String> taskPatrolledIds) {
Map<String, Map<String, Long>> taskCounterMap = new HashMap<>();
public void batchInsertReportData_shaoxing(String reportId, List<PatrolResultRef> patrolResultRefs, List<BasePointAreaInfo> basePointAreaInfoList, List<Long> lineIds) {
Map<Long, Map<String, Long>> taskCounterMap = new HashMap<>();
// 为每个任务初始化计数器 // 为每个任务初始化计数器
for (String item : taskPatrolledIds) {
for (Long item : lineIds) {
Map<String, Long> counter = new HashMap<>(); Map<String, Long> counter = new HashMap<>();
counter.put("defect", 0L); counter.put("defect", 0L);
counter.put("ok", 0L); counter.put("ok", 0L);
@ -1290,6 +1291,7 @@ public class PatrolResultServiceImpl implements IPatrolResultService {
// 获取该结果所属的任务名 // 获取该结果所属的任务名
String resultTaskName = patrolResultRef.getTaskName(); String resultTaskName = patrolResultRef.getTaskName();
String taskPatrolledId = patrolResultRef.getTaskPatrolledId(); String taskPatrolledId = patrolResultRef.getTaskPatrolledId();
Long mainId = patrolResultRef.getMainId();
BasePointAreaInfo basePointAreaInfo; BasePointAreaInfo basePointAreaInfo;
try { try {
basePointAreaInfo = basePointAreaInfoList.stream().filter((item) -> item != null && patrolResultRef.getDeviceId().equals(item.getDeviceId())).findFirst().get(); basePointAreaInfo = basePointAreaInfoList.stream().filter((item) -> item != null && patrolResultRef.getDeviceId().equals(item.getDeviceId())).findFirst().get();
@ -1309,6 +1311,7 @@ public class PatrolResultServiceImpl implements IPatrolResultService {
reportData.setAcquisitionTime(DateUtils.parse(DateUtils.yyyyMMddHHmmss2, patrolResultRef.getTime())); reportData.setAcquisitionTime(DateUtils.parse(DateUtils.yyyyMMddHHmmss2, patrolResultRef.getTime()));
reportData.setTaskName(resultTaskName); reportData.setTaskName(resultTaskName);
reportData.setTaskPatrolledId(taskPatrolledId); reportData.setTaskPatrolledId(taskPatrolledId);
reportData.setTaskResultId(String.valueOf(mainId));
if ("1".equals(patrolResultRef.getResultType()) && validAlgTypes.contains(patrolResultRef.getAlgType())) { if ("1".equals(patrolResultRef.getResultType()) && validAlgTypes.contains(patrolResultRef.getAlgType())) {
reportData.setInspectionResults(patrolResultRef.getValue()); reportData.setInspectionResults(patrolResultRef.getValue());
} else { } else {
@ -1339,7 +1342,7 @@ public class PatrolResultServiceImpl implements IPatrolResultService {
} else if (resultType.equals("0")) { } else if (resultType.equals("0")) {
reportData.setPointStatus(messageUtils.get("缺陷")); reportData.setPointStatus(messageUtils.get("缺陷"));
// 按任务统计异常编号 // 按任务统计异常编号
Map<String, Long> counter = taskCounterMap.get(taskPatrolledId);
Map<String, Long> counter = taskCounterMap.get(mainId);
if (counter != null) { if (counter != null) {
counter.put("defect", counter.get("defect") + 1); counter.put("defect", counter.get("defect") + 1);
reportData.setCode(counter.get("defect")); reportData.setCode(counter.get("defect"));
@ -1350,7 +1353,7 @@ public class PatrolResultServiceImpl implements IPatrolResultService {
} else if (resultType.equals("1")) { } else if (resultType.equals("1")) {
reportData.setPointStatus(messageUtils.get("正常")); reportData.setPointStatus(messageUtils.get("正常"));
// 按任务统计异常编号 // 按任务统计异常编号
Map<String, Long> counter = taskCounterMap.get(taskPatrolledId);
Map<String, Long> counter = taskCounterMap.get(mainId);
if (counter != null) { if (counter != null) {
counter.put("ok", counter.get("ok") + 1); counter.put("ok", counter.get("ok") + 1);
reportData.setCode(counter.get("ok")); reportData.setCode(counter.get("ok"));
@ -1361,7 +1364,7 @@ public class PatrolResultServiceImpl implements IPatrolResultService {
} else { } else {
reportData.setPointStatus(messageUtils.get("异常")); reportData.setPointStatus(messageUtils.get("异常"));
// 按任务统计异常编号 // 按任务统计异常编号
Map<String, Long> counter = taskCounterMap.get(taskPatrolledId);
Map<String, Long> counter = taskCounterMap.get(mainId);
if (counter != null) { if (counter != null) {
counter.put("fail", counter.get("fail") + 1); counter.put("fail", counter.get("fail") + 1);
reportData.setCode(counter.get("fail")); reportData.setCode(counter.get("fail"));
@ -2220,6 +2223,15 @@ public class PatrolResultServiceImpl implements IPatrolResultService {
public int hashCode() { public int hashCode() {
return Objects.hash(objectId, algType, taskPatrolled); return Objects.hash(objectId, algType, taskPatrolled);
} }
@Override
public String toString() {
return "GroupKey{" +
"objectId='" + objectId + '\'' +
", algType='" + algType + '\'' +
", taskPatrolled='" + taskPatrolled + '\'' +
'}';
}
} }
public static void main(String[] args) { public static void main(String[] args) {


+ 1
- 1
inspect-main/inspect-main-task/src/main/java/com/inspect/task/controller/PatrolTaskController.java View File

@ -1074,8 +1074,8 @@ public class PatrolTaskController extends BaseController {
Long majorId = patrolTask.getTaskId(); Long majorId = patrolTask.getTaskId();
patrolTask.setTaskCode(patrolTask.getTaskId() + "");
patrolTaskInfoService.deletePatrolTaskInfoByMajorId(majorId); patrolTaskInfoService.deletePatrolTaskInfoByMajorId(majorId);
// 点位信息 // 点位信息
List<String> patrolPointIds = new ArrayList<>(); List<String> patrolPointIds = new ArrayList<>();
if (parseObject.get("patrolPointIds") != null) { if (parseObject.get("patrolPointIds") != null) {


+ 5
- 3
inspect-main/inspect-main-task/src/main/resources/mapper/task/InspectionReportDataMapper.xml View File

@ -21,6 +21,7 @@
<result property="algName" column="alg_name"/> <result property="algName" column="alg_name"/>
<result property="taskName" column="task_name"/> <result property="taskName" column="task_name"/>
<result property="taskPatrolledId" column="task_patrolled_id"/> <result property="taskPatrolledId" column="task_patrolled_id"/>
<result property="taskResultId" column="task_result_id"/>
</resultMap> </resultMap>
<sql id="selectInspectionReportDataVo"> <sql id="selectInspectionReportDataVo">
@ -39,7 +40,8 @@
inspection_img, inspection_img,
alg_name, alg_name,
task_name, task_name,
task_patrolled_id
task_patrolled_id,
task_result_id
from inspection_report_data from inspection_report_data
</sql> </sql>
@ -162,11 +164,11 @@
</delete> </delete>
<insert id="batchInsertInspectionReportData" parameterType="java.util.List"> <insert id="batchInsertInspectionReportData" parameterType="java.util.List">
insert into inspection_report_data insert into inspection_report_data
(line_id,code,report_id,area,time_interval,eq_name,parts,point_name,data_sources,acquisition_time,inspection_results,point_status,inspection_img,alg_name,task_name,task_patrolled_id)
(line_id,code,report_id,area,time_interval,eq_name,parts,point_name,data_sources,acquisition_time,inspection_results,point_status,inspection_img,alg_name,task_name,task_patrolled_id,task_result_id)
values values
<foreach collection="list" item="t" index="index" separator=","> <foreach collection="list" item="t" index="index" separator=",">
(#{t.lineId}, #{t.code}, #{t.reportId}, #{t.area}, #{t.timeInterval}, #{t.eqName}, #{t.parts}, (#{t.lineId}, #{t.code}, #{t.reportId}, #{t.area}, #{t.timeInterval}, #{t.eqName}, #{t.parts},
#{t.pointName},#{t.dataSources},#{t.acquisitionTime},#{t.inspectionResults},#{t.pointStatus},#{t.inspectionImg},#{t.algName},#{t.taskName},#{t.taskPatrolledId})
#{t.pointName},#{t.dataSources},#{t.acquisitionTime},#{t.inspectionResults},#{t.pointStatus},#{t.inspectionImg},#{t.algName},#{t.taskName},#{t.taskPatrolledId},#{t.taskResultId})
</foreach> </foreach>
</insert> </insert>
</mapper> </mapper>

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

@ -615,6 +615,7 @@
</select> </select>
<resultMap type="PatrolResultRef" id="PatrolResultRef"> <resultMap type="PatrolResultRef" id="PatrolResultRef">
<result property="lineId" column="line_id"/> <result property="lineId" column="line_id"/>
<result property="mainId" column="main_id"/>
<result property="deviceId" column="device_id"/> <result property="deviceId" column="device_id"/>
<result property="taskName" column="task_name"/> <result property="taskName" column="task_name"/>
<result property="devType" column="dev_type"/> <result property="devType" column="dev_type"/>
@ -655,6 +656,7 @@
<select id="selectResultRefByLineIds" resultMap="PatrolResultRef"> <select id="selectResultRefByLineIds" resultMap="PatrolResultRef">
select a.line_id, select a.line_id,
a.main_id,
a.device_id, a.device_id,
a.task_name, a.task_name,
c.dev_type, c.dev_type,


Loading…
Cancel
Save