Browse Source

Merge branch 'yanyuan' of http://git.ht-atia.cn/qinyanlei/inspect into yanyuan

yanyuan
wangguangyuan 1 week ago
parent
commit
f7d4b63c2e
18 changed files with 316 additions and 421 deletions
  1. +2
    -2
      inspect-base/inspect-base-core/src/main/java/com/inspect/base/core/enums/AnalysisType.java
  2. +20
    -0
      inspect-base/inspect-base-core/src/main/java/com/inspect/base/core/enums/DefectLevel.java
  3. +1
    -1
      inspect-main/inspect-main-api/src/main/java/com/inspect/api/service/AlarmConsumer.java
  4. +84
    -0
      inspect-main/inspect-main-task/src/main/java/com/inspect/analysis/controller/ResultAnalysisController.java
  5. +9
    -1
      inspect-main/inspect-main-task/src/main/java/com/inspect/analysis/domain/AnalyseResPoint.java
  6. +5
    -55
      inspect-main/inspect-main-task/src/main/java/com/inspect/analysis/domain/ResultAnalysis.java
  7. +65
    -98
      inspect-main/inspect-main-task/src/main/java/com/inspect/analysis/service/impl/AnalyseResponseServiceImpl.java
  8. +2
    -0
      inspect-main/inspect-main-task/src/main/java/com/inspect/partrolresult/mapper/PatrolResultMapper.java
  9. +2
    -0
      inspect-main/inspect-main-task/src/main/java/com/inspect/partrolresult/service/IPatrolResultService.java
  10. +5
    -0
      inspect-main/inspect-main-task/src/main/java/com/inspect/partrolresult/service/impl/PatrolResultServiceImpl.java
  11. +23
    -250
      inspect-main/inspect-main-task/src/main/java/com/inspect/task/domain/PatrolData.java
  12. +88
    -0
      inspect-main/inspect-main-task/src/main/resources/mapper/task/PatrolResultMapper.xml
  13. +2
    -1
      inspect-management/src/main/java/com/inspect/system/controller/SysProfileController.java
  14. +2
    -1
      inspect-management/src/main/java/com/inspect/system/controller/SysUserController.java
  15. +1
    -1
      inspect-management/src/main/java/com/inspect/system/mapper/SysUserMapper.java
  16. +1
    -3
      inspect-management/src/main/java/com/inspect/system/service/ISysUserService.java
  17. +3
    -6
      inspect-management/src/main/java/com/inspect/system/service/impl/SysUserServiceImpl.java
  18. +1
    -2
      inspect-management/src/main/resources/mapper/system/SysUserMapper.xml

inspect-base/inspect-base-core/src/main/java/com/inspect/base/core/enums/AnalysisTypeEnum.java → inspect-base/inspect-base-core/src/main/java/com/inspect/base/core/enums/AnalysisType.java View File


+ 20
- 0
inspect-base/inspect-base-core/src/main/java/com/inspect/base/core/enums/DefectLevel.java View File

@ -0,0 +1,20 @@
package com.inspect.base.core.enums;
import lombok.Getter;
@Getter
public enum DefectLevel {
// 0=, 1=紧急, 2=严重, 3=一般
NONE(0, "无"),
URGENT(1, ""),
SERIOUS(2, ""),
NORMAL(3, "");
private final Integer code;
private final String info;
DefectLevel(Integer code, String info) {
this.code = code;
this.info = info;
}
}

+ 1
- 1
inspect-main/inspect-main-api/src/main/java/com/inspect/api/service/AlarmConsumer.java View File

@ -40,7 +40,7 @@ public class AlarmConsumer {
try { try {
Map<String, Object> msg = objectMapper.readValue(message.getBody(), Map<String, Object> msg = objectMapper.readValue(message.getBody(),
new TypeReference<Map<String, Object>>() {}); new TypeReference<Map<String, Object>>() {});
String staticCode = (String) redisService.redisTemplate.opsForValue().get("STATION_CODE");
String staticCode = (String) redisService.redisTemplate.opsForValue().get("sys_config:STATION_CODE");
if (StringUtils.isNotEmpty(staticCode)) { if (StringUtils.isNotEmpty(staticCode)) {
msg.put("stationCode", staticCode); msg.put("stationCode", staticCode);
} }


+ 84
- 0
inspect-main/inspect-main-task/src/main/java/com/inspect/analysis/controller/ResultAnalysisController.java View File

@ -2,10 +2,12 @@ package com.inspect.analysis.controller;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
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.analysis.service.DefectListAggregator; import com.inspect.analysis.service.DefectListAggregator;
import com.inspect.api.service.AlarmPublisher;
import com.inspect.base.core.constant.AlgConstants; 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;
@ -1087,4 +1089,86 @@ public class ResultAnalysisController extends BaseController {
return AjaxResult.success(total); return AjaxResult.success(total);
} }
@Resource
private AlarmPublisher alarmPublisher;
@GetMapping("/test/test")
public AjaxResult testTest() {
String json = "{\n" +
" \"lineId\": 12880539,\n" +
" \"resultType\": \"1\",\n" +
" \"businessId\": \"2514487\",\n" +
" \"resultContent\": \"{\\\"code\\\":\\\"2000\\\",\\\"conf\\\":\\\"0.95\\\",\\\"defect\\\":true,\\\"pos\\\":[],\\\"resImageUrl\\\":\\\"/1/2026/09/09/1776/CCD/1776_20260909142246152_2093939_SVG1.jpg\\\",\\\"type\\\":\\\"meter\\\",\\\"value\\\":\\\"1\\\",\\\"extra\\\":{\\\"avgValue\\\":12.092737,\\\"minValue\\\":4.4596844,\\\"maxValue\\\":25.46292}}\",\n" +
" \"resStatus\": \"0\",\n" +
" \"pointStatus\": \"1\",\n" +
" \"pointStatusList\": null,\n" +
" \"beginTime\": null,\n" +
" \"endTime\": null,\n" +
" \"suggestion\": null,\n" +
" \"objectId\": \"2024070\",\n" +
" \"description\": \"正常\",\n" +
" \"requestId\": \"5403fc4309ee48658f01d8922a9fa83c\",\n" +
" \"areaId\": null,\n" +
" \"mainDevId\": null,\n" +
" \"resValue\": \"1\",\n" +
" \"algType\": \"meter\",\n" +
" \"filter\": \"0\",\n" +
" \"taskPatrolId\": \"1671_20260709170248562\",\n" +
" \"resCode\": \"2000\",\n" +
" \"resImgUrl\": \"/1/2026/09/09/1776/CCD/1776_20260909142246152_2093939_SVG1.jpg\",\n" +
" \"resConf\": \"0.95\",\n" +
" \"resDesc\": null,\n" +
" \"resPos\": \"[]\",\n" +
" \"result\": \"1\",\n" +
" \"algName\": null,\n" +
" \"originalValue\": null,\n" +
" \"imageNormalUrlPath\": null,\n" +
" \"taskPatrolledId\": null,\n" +
" \"posType\": null,\n" +
" \"csQxNum\": 0,\n" +
" \"csYcNum\": 0,\n" +
" \"aiQxNum\": 0,\n" +
" \"aiYcNum\": 0,\n" +
" \"pointName\": null,\n" +
" \"deviceName\": null,\n" +
" \"abnormal\": null,\n" +
" \"channelName\": null,\n" +
" \"deviceSource\": null,\n" +
" \"filterDesc\": null,\n" +
" \"desc\": null\n" +
"}";
try {
ObjectMapper objectMapper = new ObjectMapper();
ResultAnalysis resultAnalysis = objectMapper.readValue(json, ResultAnalysis.class);
PatrolData patrolData = patrolResultService.selectPatrolData(resultAnalysis);
if (patrolData != null) {
if (true || AlgConstants.ALG_INFRARED_LIST.contains(resultAnalysis.getAlgType())) {
JSONObject jsonObject = JSONObject.parseObject(resultAnalysis.getResultContent());
JSONObject extraObject = jsonObject == null ? null : jsonObject.getJSONObject("extra");
if (extraObject != null) {
Object maxTemp = extraObject.get("maxValue");
if (maxTemp != null) {
patrolData.setMaxValue(String.valueOf(maxTemp));
}
Object minTemp = extraObject.get("minValue");
if (minTemp != null) {
patrolData.setMinValue(String.valueOf(minTemp));
}
Object avgTemp = extraObject.get("avgValue");
if (avgTemp != null) {
patrolData.setAvgValue(String.valueOf(avgTemp));
patrolData.setResValue(String.valueOf(avgTemp));
}
}
}
alarmPublisher.publish(patrolData);
return AjaxResult.success();
}
} catch (Exception e) {
logger.error("testTest", e);
}
return AjaxResult.error();
}
} }

+ 9
- 1
inspect-main/inspect-main-task/src/main/java/com/inspect/analysis/domain/AnalyseResPoint.java View File

@ -1,11 +1,14 @@
package com.inspect.analysis.domain; package com.inspect.analysis.domain;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.inspect.analysis.constant.AnalyseConstants; import com.inspect.analysis.constant.AnalyseConstants;
import com.inspect.base.core.utils.StringUtils; import com.inspect.base.core.utils.StringUtils;
import java.io.Serializable; import java.io.Serializable;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.Objects; import java.util.Objects;
public class AnalyseResPoint implements Serializable { public class AnalyseResPoint implements Serializable {
@ -20,7 +23,8 @@ public class AnalyseResPoint implements Serializable {
private String conf; private String conf;
private String desc; private String desc;
private List<Pos> pos; private List<Pos> pos;
@JsonInclude(JsonInclude.Include.NON_NULL)
private Map<String, Object> extra = new HashMap<>();
// public boolean checkSuccess() { // public boolean checkSuccess() {
// return "2000".equals(this.code) && "1".equals(this.value); // return "2000".equals(this.code) && "1".equals(this.value);
// } // }
@ -127,6 +131,10 @@ public class AnalyseResPoint implements Serializable {
this.value2 = value2; this.value2 = value2;
} }
public Map<String, Object> getExtra() { return extra; }
public void setExtra(Map<String, Object> extra) { this.extra = extra; }
@Override @Override
public boolean equals(Object object) { public boolean equals(Object object) {
if (this == object) return true; if (this == object) return true;


+ 5
- 55
inspect-main/inspect-main-task/src/main/java/com/inspect/analysis/domain/ResultAnalysis.java View File

@ -3,19 +3,16 @@ package com.inspect.analysis.domain;
import com.inspect.base.core.annotation.Excel; import com.inspect.base.core.annotation.Excel;
import com.inspect.base.core.utils.StringUtils; import com.inspect.base.core.utils.StringUtils;
import com.inspect.base.core.web.domain.BaseEntity; import com.inspect.base.core.web.domain.BaseEntity;
import lombok.Getter;
import lombok.Setter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import lombok.Data;
import lombok.ToString;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@Setter
@Getter
@Data
@ToString
public class ResultAnalysis extends BaseEntity { public class ResultAnalysis extends BaseEntity {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private final Logger log = LoggerFactory.getLogger(getClass());
private Long lineId; private Long lineId;
@Excel( @Excel(
@ -69,6 +66,7 @@ public class ResultAnalysis extends BaseEntity {
private String deviceName; private String deviceName;
private String abnormal; private String abnormal;
private String channelName; private String channelName;
private String channelCode;
private String deviceSource; private String deviceSource;
private String filterDesc; private String filterDesc;
private String desc; private String desc;
@ -439,52 +437,4 @@ public class ResultAnalysis extends BaseEntity {
// this.setDescription(defaultDesc); // this.setDescription(defaultDesc);
// this.setCreateTime(new Date()); // this.setCreateTime(new Date());
// } // }
@Override
public String toString() {
return "ResultAnalysis{" +
"lineId=" + lineId +
", resultType='" + resultType + '\'' +
", businessId='" + businessId + '\'' +
", resultContent='" + resultContent + '\'' +
", resStatus='" + resStatus + '\'' +
", pointStatus='" + pointStatus + '\'' +
", pointStatusList='" + pointStatusList + '\'' +
", beginTime='" + beginTime + '\'' +
", endTime='" + endTime + '\'' +
", createTime='" + super.getCreateTime() + '\'' +
", suggestion='" + suggestion + '\'' +
", objectId='" + objectId + '\'' +
", description='" + description + '\'' +
", requestId='" + requestId + '\'' +
", areaId='" + areaId + '\'' +
", mainDevId='" + mainDevId + '\'' +
", resValue='" + resValue + '\'' +
", algType='" + algType + '\'' +
", filter='" + filter + '\'' +
", taskPatrolId='" + taskPatrolId + '\'' +
", resCode='" + resCode + '\'' +
", resImgUrl='" + resImgUrl + '\'' +
", resConf='" + resConf + '\'' +
", resDesc='" + resDesc + '\'' +
", resPos='" + resPos + '\'' +
", result='" + result + '\'' +
", algName='" + algName + '\'' +
", originalValue='" + originalValue + '\'' +
", imageNormalUrlPath='" + imageNormalUrlPath + '\'' +
", taskPatrolledId='" + taskPatrolledId + '\'' +
", posType='" + posType + '\'' +
", csQxNum=" + csQxNum +
", csYcNum=" + csYcNum +
", aiQxNum=" + aiQxNum +
", aiYcNum=" + aiYcNum +
", pointName='" + pointName + '\'' +
", deviceName='" + deviceName + '\'' +
", abnormal='" + abnormal + '\'' +
", channelName='" + channelName + '\'' +
", deviceSource='" + deviceSource + '\'' +
", filterDesc='" + filterDesc + '\'' +
", desc='" + desc + '\'' +
'}';
}
} }

+ 65
- 98
inspect-main/inspect-main-task/src/main/java/com/inspect/analysis/service/impl/AnalyseResponseServiceImpl.java View File

@ -12,10 +12,12 @@ import com.inspect.analysis.service.IAnalyseLogService;
import com.inspect.analysis.service.IAnalyseResponseService; import com.inspect.analysis.service.IAnalyseResponseService;
import com.inspect.analysis.service.IResultAnalysisService; import com.inspect.analysis.service.IResultAnalysisService;
import com.inspect.analysis.utils.ResultAnalysisUtils; import com.inspect.analysis.utils.ResultAnalysisUtils;
import com.inspect.api.service.AlarmPublisher;
import com.inspect.base.core.constant.AlgConstants; import com.inspect.base.core.constant.AlgConstants;
import com.inspect.base.core.constant.Color; import com.inspect.base.core.constant.Color;
import com.inspect.base.core.constant.RedisConst; import com.inspect.base.core.constant.RedisConst;
import com.inspect.base.core.constant.Tags; import com.inspect.base.core.constant.Tags;
import com.inspect.base.core.enums.AnalysisType;
import com.inspect.base.core.enums.TaskStatus; import com.inspect.base.core.enums.TaskStatus;
import com.inspect.base.core.utils.BigDecimalUtil; import com.inspect.base.core.utils.BigDecimalUtil;
import com.inspect.base.core.utils.DateUtils; import com.inspect.base.core.utils.DateUtils;
@ -31,6 +33,7 @@ import com.inspect.partrolresult.service.IPatrolResultService;
import com.inspect.resultmain.domain.PatrolTaskResultMain; import com.inspect.resultmain.domain.PatrolTaskResultMain;
import com.inspect.resultmain.service.IPatrolTaskResultMainService; import com.inspect.resultmain.service.IPatrolTaskResultMainService;
import com.inspect.system.base.domain.SysDictData; import com.inspect.system.base.domain.SysDictData;
import com.inspect.task.domain.PatrolData;
import com.inspect.taskinfo.domain.PatrolTaskInfo; import com.inspect.taskinfo.domain.PatrolTaskInfo;
import com.inspect.taskinfo.service.IPatrolTaskInfoService; import com.inspect.taskinfo.service.IPatrolTaskInfoService;
import com.inspect.taskstatus.domain.PatrolTaskStatus; import com.inspect.taskstatus.domain.PatrolTaskStatus;
@ -41,6 +44,7 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.io.IOException; import java.io.IOException;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -81,6 +85,28 @@ public class AnalyseResponseServiceImpl implements IAnalyseResponseService {
@Resource @Resource
private DelayQueueService<String> delayQueueService; private DelayQueueService<String> delayQueueService;
@Resource
private AlarmPublisher alarmPublisher;
public static List<AnalyseResPoint> mergeAnalyseResItem(List<AnalyseResPoint> analyseResPointList) {
String mergedValue = analyseResPointList.stream()
.map(AnalyseResPoint::getValue)
.filter(Objects::nonNull)
.collect(Collectors.joining(StringUtils.COMMA));
AnalyseResPoint first = analyseResPointList.get(0);
AnalyseResPoint mergedPoint = new AnalyseResPoint();
mergedPoint.setType(first.getType());
mergedPoint.setCode(first.getCode());
mergedPoint.setResImageUrl(first.getResImageUrl());
mergedPoint.setImageNormalUrlPath(first.getImageNormalUrlPath());
mergedPoint.setConf(first.getConf());
mergedPoint.setDesc(first.getDesc());
mergedPoint.setPos(first.getPos());
mergedPoint.setValue(mergedValue);
return Collections.singletonList(mergedPoint);
}
@Override @Override
public void picAnalyseRetNotify(AnalyseResult analyseResult) { public void picAnalyseRetNotify(AnalyseResult analyseResult) {
@ -258,7 +284,6 @@ public class AnalyseResponseServiceImpl implements IAnalyseResponseService {
requestId); requestId);
} }
public synchronized void doAlgorithmAnalysis(AnalyseResult analyseResult) { public synchronized void doAlgorithmAnalysis(AnalyseResult analyseResult) {
log.info("doAlgorithmAnalysis analyseResult: {}", analyseResult); log.info("doAlgorithmAnalysis analyseResult: {}", analyseResult);
int size = 0; int size = 0;
@ -829,6 +854,9 @@ public class AnalyseResponseServiceImpl implements IAnalyseResponseService {
} catch (Exception e) { } catch (Exception e) {
log.error("error", e); log.error("error", e);
} }
// ws
uploadResultWS(resultAnalysis);
} }
patrolResult.setValue(valueJoiner.toString()); patrolResult.setValue(valueJoiner.toString());
@ -871,6 +899,41 @@ public class AnalyseResponseServiceImpl implements IAnalyseResponseService {
//this.senWebsocket(websocketDataList); //this.senWebsocket(websocketDataList);
} }
private void uploadResultWS(ResultAnalysis resultAnalysis) {
String requestId = resultAnalysis.getRequestId();
String redisKey = AnalyseConstants.ANALYSE_AI_REQUEST.concat(requestId);
boolean hasKey = redisService.hasKey(redisKey);
log.info("uploadResultWS requestId:{}, hasKey:{}", redisKey, hasKey);
if (AnalysisType.LargeModel.getCode().equals(resultAnalysis.getFilter())) {
PatrolData patrolData = patrolResultService.selectPatrolData(resultAnalysis);
if (patrolData != null) {
if (AlgConstants.ALG_INFRARED_LIST.contains(resultAnalysis.getAlgType())) {
JSONObject jsonObject = JSONObject.parseObject(resultAnalysis.getResultContent());
JSONObject extraObject = jsonObject == null ? null : jsonObject.getJSONObject("extra");
if (extraObject != null) {
BigDecimal maxValue = extraObject.getBigDecimal("maxValue");
if (maxValue != null) {
patrolData.setMaxValue(maxValue.setScale(1, RoundingMode.HALF_UP).toPlainString());
}
BigDecimal minValue = extraObject.getBigDecimal("minValue");
if (minValue != null) {
patrolData.setMinValue(minValue.setScale(1, RoundingMode.HALF_UP).toPlainString());
}
BigDecimal avgValue = extraObject.getBigDecimal("avgValue");
if (avgValue != null) {
String formattedAvgValue = avgValue.setScale(1, RoundingMode.HALF_UP).toPlainString();
patrolData.setAvgValue(formattedAvgValue);
patrolData.setResValue(formattedAvgValue);
}
}
}
alarmPublisher.publish(patrolData);
}
}
}
private ResultAnalysis combineAnalyse( private ResultAnalysis combineAnalyse(
AnalyseResult analyseResult, AnalyseResult analyseResult,
String patrolResultId, String patrolResultId,
@ -905,7 +968,7 @@ public class AnalyseResponseServiceImpl implements IAnalyseResponseService {
// 处理正常结果以及兼容处理无机人表计gis_meter2纠偏correction的异常结果 // 处理正常结果以及兼容处理无机人表计gis_meter2纠偏correction的异常结果
if (resultAnalysisUtils.checkCode(analyseResPoint.getCode(), analyseResPoint.getDesc(), resultAnalysis) if (resultAnalysisUtils.checkCode(analyseResPoint.getCode(), analyseResPoint.getDesc(), resultAnalysis)
|| (AlgConstants.GIS_METER_2.equals(analyseResPoint.getType())) || (AlgConstants.GIS_METER_2.equals(analyseResPoint.getType()))
|| (AlgConstants.CORRECTION.equals(analyseResPoint.getType()) && Arrays.asList("2001", "2002", "2003").contains(analyseResPoint.getCode()) )) {
|| (AlgConstants.CORRECTION.equals(analyseResPoint.getType()) && Arrays.asList("2001", "2002", "2003").contains(analyseResPoint.getCode()))) {
AlgValue algValue = selectAlgMap(objectId, analyseResPoint.getType()); AlgValue algValue = selectAlgMap(objectId, analyseResPoint.getType());
resultAnalysisUtils.parseAlg(analyseResPoint.getType(), algValue, value, analyseResPoint.getDesc(), resultAnalysis); resultAnalysisUtils.parseAlg(analyseResPoint.getType(), algValue, value, analyseResPoint.getDesc(), resultAnalysis);
// 合并辅助值字段 // 合并辅助值字段
@ -1019,100 +1082,4 @@ public class AnalyseResponseServiceImpl implements IAnalyseResponseService {
return algValue; return algValue;
} }
public static final String mergeString = "{\n" +
"\t\"requestId\": \"b00f2fbd1fcc49c6a47ed2b3a77e5028\",\n" +
"\t\"resultsList\": [{\n" +
"\t\t\"objectId\": \"2079991\",\n" +
"\t\t\"results\": [{\n" +
"\t\t\t\"type\": \"switch\",\n" +
"\t\t\t\"value\": \"和\",\n" +
"\t\t\t\"code\": \"2000\",\n" +
"\t\t\t\"resImageUrl\": \"2/2025/12/12/1531/CCD/3038_R100-001_20251212140756.jpg\",\n" +
"\t\t\t\"pos\": [],\n" +
"\t\t\t\"conf\": 0.99,\n" +
"\t\t\t\"desc\": \"\",\n" +
"\t\t\t\"imageNormalUrlPath\": \"1/2025/08/29/1584/CCD/3038_R100-001_20250829123953.jpg\"\n" +
"\t\t}, {\n" +
"\t\t\t\"type\": \"switch\",\n" +
"\t\t\t\"value\": \"和\",\n" +
"\t\t\t\"code\": \"2000\",\n" +
"\t\t\t\"resImageUrl\": \"2/2025/12/12/1531/CCD/3038_R100-001_20251212140756.jpg\",\n" +
"\t\t\t\"pos\": [],\n" +
"\t\t\t\"conf\": 0.99,\n" +
"\t\t\t\"desc\": \"\",\n" +
"\t\t\t\"imageNormalUrlPath\": \"1/2025/08/29/1584/CCD/3038_R100-001_20250829123953.jpg\"\n" +
"\t\t}, {\n" +
"\t\t\t\"type\": \"switch\",\n" +
"\t\t\t\"value\": \"分\",\n" +
"\t\t\t\"code\": \"2000\",\n" +
"\t\t\t\"resImageUrl\": \"2/2025/12/12/1531/CCD/3038_R100-001_20251212140756.jpg\",\n" +
"\t\t\t\"pos\": [],\n" +
"\t\t\t\"conf\": 0.99,\n" +
"\t\t\t\"desc\": \"\",\n" +
"\t\t\t\"imageNormalUrlPath\": \"1/2025/08/29/1584/CCD/3038_R100-001_20250829123953.jpg\"\n" +
"\t\t}, {\n" +
"\t\t\t\"type\": \"switch\",\n" +
"\t\t\t\"value\": \"和\",\n" +
"\t\t\t\"code\": \"2000\",\n" +
"\t\t\t\"resImageUrl\": \"2/2025/12/12/1531/CCD/3038_R100-001_20251212140756.jpg\",\n" +
"\t\t\t\"pos\": [],\n" +
"\t\t\t\"conf\": 0.99,\n" +
"\t\t\t\"desc\": \"\",\n" +
"\t\t\t\"imageNormalUrlPath\": \"1/2025/08/29/1584/CCD/3038_R100-001_20250829123953.jpg\"\n" +
"\t\t}, {\n" +
"\t\t\t\"type\": \"switch\",\n" +
"\t\t\t\"value\": \"分\",\n" +
"\t\t\t\"code\": \"2000\",\n" +
"\t\t\t\"resImageUrl\": \"2/2025/12/12/1531/CCD/3038_R100-001_20251212140756.jpg\",\n" +
"\t\t\t\"pos\": [],\n" +
"\t\t\t\"conf\": 0.99,\n" +
"\t\t\t\"desc\": \"\",\n" +
"\t\t\t\"imageNormalUrlPath\": \"1/2025/08/29/1584/CCD/3038_R100-001_20250829123953.jpg\"\n" +
"\t\t}, {\n" +
"\t\t\t\"type\": \"switch\",\n" +
"\t\t\t\"value\": \"分\",\n" +
"\t\t\t\"code\": \"2000\",\n" +
"\t\t\t\"resImageUrl\": \"2/2025/12/12/1531/CCD/3038_R100-001_20251212140756.jpg\",\n" +
"\t\t\t\"pos\": [],\n" +
"\t\t\t\"conf\": 0.99,\n" +
"\t\t\t\"desc\": \"\",\n" +
"\t\t\t\"imageNormalUrlPath\": \"1/2025/08/29/1584/CCD/3038_R100-001_20250829123953.jpg\"\n" +
"\t\t}],\n" +
"\t\t\"algFactory\": \"yd\"\n" +
"\t}]\n" +
"}";
public static List<AnalyseResPoint> mergeAnalyseResItem(List<AnalyseResPoint> analyseResPointList) {
String mergedValue = analyseResPointList.stream()
.map(AnalyseResPoint::getValue)
.filter(Objects::nonNull)
.collect(Collectors.joining(StringUtils.COMMA));
AnalyseResPoint first = analyseResPointList.get(0);
AnalyseResPoint mergedPoint = new AnalyseResPoint();
mergedPoint.setType(first.getType());
mergedPoint.setCode(first.getCode());
mergedPoint.setResImageUrl(first.getResImageUrl());
mergedPoint.setImageNormalUrlPath(first.getImageNormalUrlPath());
mergedPoint.setConf(first.getConf());
mergedPoint.setDesc(first.getDesc());
mergedPoint.setPos(first.getPos());
mergedPoint.setValue(mergedValue);
return Collections.singletonList(mergedPoint);
}
public static void main(String[] args) {
ObjectMapper mapper = new ObjectMapper();
AnalyseResult analyseResult;
try {
analyseResult = mapper.readValue(mergeString, new TypeReference<AnalyseResult>() {
});
log.info("mergeAnalyseResItem analyseResult: {}", analyseResult);
List<AnalyseResPoint> result = mergeAnalyseResItem(analyseResult.getResultsList().get(0).getResults());
log.info("mergeAnalyseResItem result: {}", result);
} catch (Exception e) {
log.error("mergeAnalyseResItem exception", e);
}
}
} }

+ 2
- 0
inspect-main/inspect-main-task/src/main/java/com/inspect/partrolresult/mapper/PatrolResultMapper.java View File

@ -130,4 +130,6 @@ public interface PatrolResultMapper {
List<AlgInfo> selectPointAlgInfo(String patrolPointId); List<AlgInfo> selectPointAlgInfo(String patrolPointId);
List<AlgInfo> selectAlgInfoByCode(String codes); List<AlgInfo> selectAlgInfoByCode(String codes);
PatrolData selectPatrolData(ResultAnalysis resultAnalysis);
} }

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

@ -112,4 +112,6 @@ public interface IPatrolResultService {
List<AlgInfo> selectAlgInfoByCode(String codes); List<AlgInfo> selectAlgInfoByCode(String codes);
List<String> selectAlgList(String taskCode, String sendCode, String specifiedAlg); List<String> selectAlgList(String taskCode, String sendCode, String specifiedAlg);
PatrolData selectPatrolData(ResultAnalysis resultAnalysis);
} }

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

@ -2276,6 +2276,11 @@ public class PatrolResultServiceImpl implements IPatrolResultService {
return algList; return algList;
} }
@Override
public PatrolData selectPatrolData(ResultAnalysis resultAnalysis) {
return patrolResultMapper.selectPatrolData(resultAnalysis);
}
private PatrolResultRef mergePatrolResultRef(PatrolResultRef filterResult, PatrolResultRef AIResult, String resultType) { private PatrolResultRef mergePatrolResultRef(PatrolResultRef filterResult, PatrolResultRef AIResult, String resultType) {
PatrolResultRef merged = new PatrolResultRef(); PatrolResultRef merged = new PatrolResultRef();
merged.setDeviceId(filterResult.getDeviceId()); merged.setDeviceId(filterResult.getDeviceId());


+ 23
- 250
inspect-main/inspect-main-task/src/main/java/com/inspect/task/domain/PatrolData.java View File

@ -1,10 +1,14 @@
package com.inspect.task.domain; package com.inspect.task.domain;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.inspect.base.core.annotation.Excel; import com.inspect.base.core.annotation.Excel;
import com.inspect.base.core.enums.DefectLevel;
import lombok.Data;
import lombok.ToString; import lombok.ToString;
import java.util.Objects; import java.util.Objects;
@ToString @ToString
@Data
public class PatrolData implements Comparable<PatrolData> { public class PatrolData implements Comparable<PatrolData> {
@Excel( @Excel(
name = "设备" name = "设备"
@ -14,6 +18,7 @@ public class PatrolData implements Comparable<PatrolData> {
name = "相机名" name = "相机名"
) )
private String channelName; private String channelName;
private String channelCode;
@Excel( @Excel(
name = "系统" name = "系统"
) )
@ -86,7 +91,25 @@ public class PatrolData implements Comparable<PatrolData> {
private String originalValue; private String originalValue;
private String taskPatrolId; private String taskPatrolId;
// 缺陷等级
private Integer defectLevel = DefectLevel.NONE.getCode();
@JsonInclude(JsonInclude.Include.NON_NULL)
private String maxValue;
@JsonInclude(JsonInclude.Include.NON_NULL)
private String minValue;
@JsonInclude(JsonInclude.Include.NON_NULL)
private String avgValue;
public void setWarnStatus(String warnStatus) {
this.warnStatus = warnStatus;
if ("0".equals(warnStatus)) {
this.defectLevel = DefectLevel.SERIOUS.getCode();
} else if ("2".equals(warnStatus)) {
this.defectLevel = DefectLevel.NORMAL.getCode();
} else {
this.defectLevel = DefectLevel.NONE.getCode();
}
}
public String warnStatus(String ws) { public String warnStatus(String ws) {
byte var3 = -1; byte var3 = -1;
@ -135,260 +158,10 @@ public class PatrolData implements Comparable<PatrolData> {
return this.requestId != null && this.algType != null && this.requestId.equals(pd.getRequestId()) && this.algType.equals(pd.algType); return this.requestId != null && this.algType != null && this.requestId.equals(pd.getRequestId()) && this.algType.equals(pd.algType);
} }
public String getDeviceName() {
return this.deviceName;
}
public String getChannelName() {
return this.channelName;
}
public String getDeviceSource() {
return this.deviceSource;
}
public String getPointName() {
return this.pointName;
}
public String getPointId() {
return pointId;
}
public String getWarnStatus() {
return this.warnStatus;
}
public String getAlgName() {
return this.algName;
}
public String getResValue() {
return this.resValue;
}
public String getImg() {
return this.img;
}
public String getFilterDesc() {
return this.filterDesc;
}
public String getBrightDesc() {
return this.brightDesc;
}
public String getImgAnalyse() {
return this.imgAnalyse;
}
public String getBrightImgAnalyse() {
return this.brightImgAnalyse;
}
public String getDesc() {
return this.desc;
}
public String getLineId() {
return this.lineId;
}
public String getPatrolTime() {
return this.patrolTime;
}
public String getPointStatus() {
return this.pointStatus;
}
public String getImgType() {
return this.imgType;
}
public String getDataType() {
return this.dataType;
}
public String getFilter() {
return this.filter;
}
public String getRequestId() {
return this.requestId;
}
public String getResStatus() {
return this.resStatus;
}
public String getBrightResStatus() {
return this.brightResStatus;
}
public String getAreaName() {
return this.areaName;
}
public String getAlgType() {
return this.algType;
}
public String getObjectId() {
return this.objectId;
}
public String getImageNormalUrlPath() {
return this.imageNormalUrlPath;
}
public String getFilePath() {
return this.filePath;
}
public String getSuggestion() {
return this.suggestion;
}
public String getOriginalValue() {
return originalValue;
}
public void setDeviceName(String deviceName) {
this.deviceName = deviceName;
}
public void setChannelName(String channelName) {
this.channelName = channelName;
}
public void setDeviceSource(String deviceSource) {
this.deviceSource = deviceSource;
}
public void setPointName(String pointName) {
this.pointName = pointName;
}
public void setPointId(String pointId) {
this.pointId = pointId;
}
public void setWarnStatus(String warnStatus) {
this.warnStatus = warnStatus;
}
public void setAlgName(String algName) {
this.algName = algName;
}
public void setResValue(String resValue) {
this.resValue = resValue;
}
public void setImg(String img) {
this.img = img;
}
public void setFilterDesc(String filterDesc) {
this.filterDesc = filterDesc;
}
public void setBrightDesc(String brightDesc) {
this.brightDesc = brightDesc;
}
public void setImgAnalyse(String imgAnalyse) {
this.imgAnalyse = imgAnalyse;
}
public void setBrightImgAnalyse(String brightImgAnalyse) {
this.brightImgAnalyse = brightImgAnalyse;
}
public void setDesc(String desc) {
this.desc = desc;
}
public void setLineId(String lineId) {
this.lineId = lineId;
}
public void setPatrolTime(String patrolTime) {
this.patrolTime = patrolTime;
}
public void setPointStatus(String pointStatus) {
this.pointStatus = pointStatus;
}
public void setImgType(String imgType) {
this.imgType = imgType;
}
public void setDataType(String dataType) {
this.dataType = dataType;
}
public void setFilter(String filter) {
this.filter = filter;
}
public void setRequestId(String requestId) {
this.requestId = requestId;
}
public void setResStatus(String resStatus) {
this.resStatus = resStatus;
}
public void setBrightResStatus(String brightResStatus) {
this.brightResStatus = brightResStatus;
}
public void setAreaName(String areaName) {
this.areaName = areaName;
}
public void setAlgType(String algType) {
this.algType = algType;
}
public void setObjectId(String objectId) {
this.objectId = objectId;
}
public void setImageNormalUrlPath(String imageNormalUrlPath) {
this.imageNormalUrlPath = imageNormalUrlPath;
}
public void setFilePath(String filePath) {
this.filePath = filePath;
}
public void setSuggestion(String suggestion) {
this.suggestion = suggestion;
}
public void setOriginalValue(String originalValue) {
this.originalValue = originalValue;
}
public String getTaskPatrolId() {
return taskPatrolId;
}
public void setTaskPatrolId(String taskPatrolId) {
this.taskPatrolId = taskPatrolId;
}
public String getAreaId() {
return areaId;
}
public void setAreaId(String areaId) {
this.areaId = areaId;
}
protected boolean canEqual(Object other) { protected boolean canEqual(Object other) {
return other instanceof PatrolData; return other instanceof PatrolData;
} }
@Override @Override
public boolean equals(Object object) { public boolean equals(Object object) {
if (this == object) return true; if (this == object) return true;


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

@ -182,6 +182,7 @@
<result property="resValue" column="res_value"/> <result property="resValue" column="res_value"/>
<result property="deviceSource" column="device_source"/> <result property="deviceSource" column="device_source"/>
<result property="channelName" column="channel_name"/> <result property="channelName" column="channel_name"/>
<result property="channelCode" column="channel_code"/>
<result property="imageNormalUrlPath" column="image_normal_url_path"/> <result property="imageNormalUrlPath" column="image_normal_url_path"/>
<result property="filePath" column="file_path"/> <result property="filePath" column="file_path"/>
<result property="originalValue" column="original_value"/> <result property="originalValue" column="original_value"/>
@ -1479,6 +1480,8 @@
ELSE h.patrol_device_name ELSE h.patrol_device_name
END AS channel_name, END AS channel_name,
IF(s.pos_type = '0', g.channel_code, NULL) AS channel_code,
CASE CASE
WHEN s.pos_type = '0' THEN g.device_source WHEN s.pos_type = '0' THEN g.device_source
ELSE h.device_source ELSE h.device_source
@ -1582,4 +1585,89 @@
LEFT JOIN basedata_alg a ON s.alg_id = a.alg_id LEFT JOIN basedata_alg a ON s.alg_id = a.alg_id
WHERE FIND_IN_SET(s.alg_subtype_code, #{codes}) WHERE FIND_IN_SET(s.alg_subtype_code, #{codes})
</select> </select>
<select id="selectChannelByPointId" parameterType="java.lang.String" resultType="java.util.HashMap">
SELECT
a.eqp_book_id,
a.area_id,
a.patrol_device_code,
a.patrol_device_name,
a.use_mode,
b.channel_code,
b.channel_id,
b.channel_name,
a.device_source
FROM
basedata_eqpbook a
LEFT JOIN basedata_eqpbook_channel b ON a.eqp_book_id = b.eqp_book_id
LEFT JOIN patrol_preset_pos pp ON pp.channel_id = b.channel_id
LEFT JOIN basedata_patrolpoint p ON p.patrol_point_id = pp.patrol_point_id
WHERE
p.patrol_point_id = #{pointId}
</select>
<select id="selectPatrolData" parameterType="ResultAnalysis" resultMap="PatrolDataResult">
SELECT *
FROM (
SELECT
t.*,
ROW_NUMBER() OVER (
PARTITION BY t.point_id, t.task_patrol_id, t.objectId, t.alg_type
ORDER BY t.filter ASC
) AS rn
FROM (
SELECT
b.line_id,
a.device_name AS point_name,
a.device_id AS point_id,
a.create_time AS patrol_time,
b.point_status,
b.result_type AS warn_status,
b.description AS `desc`,
CASE WHEN b.filter = 0 THEN a.file_path ELSE b.res_img_url END AS img,
b.image_normal_url_path,
a.file_path,
a.file_type AS img_type,
a.data_type,
b.filter,
b.request_id,
b.res_img_url AS img_analysis,
b.original_value,
b.res_status,
d.device_name,
e.area_name,
e.area_id,
b.alg_type,
b.objectId,
b.suggestion,
b.res_value,
s.pos_type,
b.task_patrol_id,
CASE
WHEN s.pos_type = '0' THEN g.channel_name
ELSE h.patrol_device_name
END AS channel_name,
IF(s.pos_type = '0', g.channel_code, NULL) AS channel_code,
CASE
WHEN s.pos_type = '0' THEN g.device_source
ELSE h.device_source
END AS device_source
FROM patrol_result a
INNER JOIN result_analysis b ON a.line_id = b.business_id
LEFT JOIN basedata_patrolpoint c ON a.device_id = c.patrol_point_id
LEFT JOIN basedata_device d ON c.device_id = d.device_id
LEFT JOIN basedata_area e ON e.area_id = d.area_id
LEFT JOIN patrol_task_status s ON s.task_patrolled_id = a.task_patrolled_id
LEFT JOIN patrol_preset_pos f1 ON s.pos_type = '0' AND c.patrol_point_id = f1.patrol_point_id
LEFT JOIN basedata_eqpbook_channel g ON f1.channel_id = g.channel_id
LEFT JOIN basedata_patrolpoint_preset f2 ON s.pos_type != '0' AND c.patrol_point_id = f2.patrol_point_id
LEFT JOIN basedata_eqpbook h ON f2.eqp_book_id = h.eqp_book_id
WHERE (g.channel_id IS NOT NULL OR h.eqp_book_id IS NOT NULL)
AND a.task_patrolled_id IN (#{taskPatrolId})
AND b.task_patrol_id IN (#{taskPatrolId})
AND b.objectId = #{objectId}
AND b.alg_type = #{algType}
) t
) ranked
WHERE rn = 1;
</select>
</mapper> </mapper>

+ 2
- 1
inspect-management/src/main/java/com/inspect/system/controller/SysProfileController.java View File

@ -88,13 +88,14 @@ public class SysProfileController extends BaseController {
@PostMapping({"/updatePwd"}) @PostMapping({"/updatePwd"})
public AjaxResult updatePwd(String oldPassword, String newPassword) { public AjaxResult updatePwd(String oldPassword, String newPassword) {
String username = SecurityUtils.getUsername(); String username = SecurityUtils.getUsername();
Long userId = SecurityUtils.getUserId();
SysUser user = this.userService.selectUserByUserName(username); SysUser user = this.userService.selectUserByUserName(username);
String password = user.getPassword(); String password = user.getPassword();
if (!SecurityUtils.matchesPassword(oldPassword, password)) { if (!SecurityUtils.matchesPassword(oldPassword, password)) {
return AjaxResult.error("修改密码失败,旧密码错误"); return AjaxResult.error("修改密码失败,旧密码错误");
} else if (SecurityUtils.matchesPassword(newPassword, password)) { } else if (SecurityUtils.matchesPassword(newPassword, password)) {
return AjaxResult.error("新密码不能与旧密码相同"); return AjaxResult.error("新密码不能与旧密码相同");
} else if (this.userService.resetUserPwd(username, SecurityUtils.encryptPassword(newPassword)) > 0) {
} else if (this.userService.resetUserPwd(userId, SecurityUtils.encryptPassword(newPassword)) > 0) {
LoginUser loginUser = SecurityUtils.getLoginUser(); LoginUser loginUser = SecurityUtils.getLoginUser();
String userKey = this.tokenService.getTokenKey(loginUser.getToken()); String userKey = this.tokenService.getTokenKey(loginUser.getToken());
this.redisService.deleteObject(userKey); this.redisService.deleteObject(userKey);


+ 2
- 1
inspect-management/src/main/java/com/inspect/system/controller/SysUserController.java View File

@ -216,7 +216,8 @@ public class SysUserController extends BaseController {
this.userService.checkUserDataScope(user.getUserId()); this.userService.checkUserDataScope(user.getUserId());
user.setPassword(SecurityUtils.encryptPassword(user.getPassword())); user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
user.setUpdateBy(SecurityUtils.getUsername()); user.setUpdateBy(SecurityUtils.getUsername());
return this.toAjax(this.userService.resetPwd(user));
logger.info("user:{}", user);
return this.toAjax(this.userService.resetUserPwd(user.getUserId(), user.getPassword()));
} }
@RequiresPermissions({"system:user:edit"}) @RequiresPermissions({"system:user:edit"})


+ 1
- 1
inspect-management/src/main/java/com/inspect/system/mapper/SysUserMapper.java View File

@ -25,7 +25,7 @@ public interface SysUserMapper {
int updateUserAvatar(@Param("userName") String userName, @Param("avatar") String avatar); int updateUserAvatar(@Param("userName") String userName, @Param("avatar") String avatar);
int resetUserPwd(@Param("userName") String userName, @Param("password") String password);
int resetUserPwd(@Param("userId") Long userId, @Param("password") String password);
int deleteUserById(Long id); int deleteUserById(Long id);


+ 1
- 3
inspect-management/src/main/java/com/inspect/system/service/ISysUserService.java View File

@ -44,9 +44,7 @@ public interface ISysUserService {
boolean updateUserAvatar(String username, String url); boolean updateUserAvatar(String username, String url);
int resetPwd(SysUser sysUser);
int resetUserPwd(String username, String password);
int resetUserPwd(Long userId, String password);
int deleteUserById(Long userId); int deleteUserById(Long userId);


+ 3
- 6
inspect-management/src/main/java/com/inspect/system/service/impl/SysUserServiceImpl.java View File

@ -183,12 +183,9 @@ public class SysUserServiceImpl implements ISysUserService {
return this.userMapper.updateUserAvatar(userName, avatar) > 0; return this.userMapper.updateUserAvatar(userName, avatar) > 0;
} }
public int resetPwd(SysUser user) {
return this.userMapper.updateUser(user);
}
public int resetUserPwd(String userName, String password) {
return this.userMapper.resetUserPwd(userName, password);
@Override
public int resetUserPwd(Long userId, String password) {
return this.userMapper.resetUserPwd(userId, password);
} }
public void insertUserRole(SysUser user) { public void insertUserRole(SysUser user) {


+ 1
- 2
inspect-management/src/main/resources/mapper/system/SysUserMapper.xml View File

@ -225,7 +225,6 @@
<if test="phonenumber != null ">phonenumber = #{phonenumber},</if> <if test="phonenumber != null ">phonenumber = #{phonenumber},</if>
<if test="sex != null and sex != ''">sex = #{sex},</if> <if test="sex != null and sex != ''">sex = #{sex},</if>
<if test="avatar != null and avatar != ''">avatar = #{avatar},</if> <if test="avatar != null and avatar != ''">avatar = #{avatar},</if>
<if test="password != null and password != ''">password = #{password},</if>
<if test="status != null and status != ''">status = #{status},</if> <if test="status != null and status != ''">status = #{status},</if>
<if test="loginIp != null and loginIp != ''">login_ip = #{loginIp},</if> <if test="loginIp != null and loginIp != ''">login_ip = #{loginIp},</if>
<if test="loginDate != null">login_date = #{loginDate},</if> <if test="loginDate != null">login_date = #{loginDate},</if>
@ -252,7 +251,7 @@
update sys_user update sys_user
set password = #{password}, set password = #{password},
pass_update_time = now() pass_update_time = now()
where user_name = #{userName}
where user_id = #{userId}
</update> </update>
<delete id="deleteUserById" parameterType="Long"> <delete id="deleteUserById" parameterType="Long">


Loading…
Cancel
Save