Browse Source

/*增加list_exception接口*/

master
htjcAdmin 8 months ago
parent
commit
93c447926e
9 changed files with 261 additions and 79 deletions
  1. +97
    -0
      inspect-main/inspect-main-task/src/main/java/com/inspect/analysis/controller/ResultAnalysisController.java
  2. +35
    -0
      inspect-main/inspect-main-task/src/main/java/com/inspect/analysis/domain/ModifyDocModel.java
  3. +1
    -0
      inspect-main/inspect-main-task/src/main/java/com/inspect/analysis/service/impl/AnalysisServiceImpl.java
  4. +3
    -1
      inspect-main/inspect-main-task/src/main/java/com/inspect/analysis/service/impl/IspAlgorithmRequestService.java
  5. +75
    -75
      inspect-main/inspect-main-task/src/main/java/com/inspect/partrolresult/controller/PatrolResultController.java
  6. +6
    -2
      inspect-main/inspect-main-task/src/main/java/com/inspect/partrolresult/domain/PatrolResultRef.java
  7. +3
    -0
      inspect-main/inspect-main-task/src/main/java/com/inspect/partrolresult/mapper/PatrolResultMapper.java
  8. +4
    -1
      inspect-main/inspect-main-task/src/main/java/com/inspect/partrolresult/service/AnalyseRemoteService.java
  9. +37
    -0
      inspect-main/inspect-main-task/src/main/resources/mapper/task/PatrolResultMapper.xml

+ 97
- 0
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.inspect.analysis.domain.*;
import com.inspect.analysis.service.IResultAnalysisService;
import com.inspect.base.core.constant.Color;
import com.inspect.base.core.domain.Response;
import com.inspect.base.core.utils.StringUtils;
import com.inspect.base.core.utils.poi.ExcelUtil;
import com.inspect.base.core.web.controller.BaseController;
@ -14,6 +15,8 @@ import com.inspect.common.log.annotation.Log;
import com.inspect.common.log.enums.BizType;
import com.inspect.partrolresult.domain.AlgInfo;
import com.inspect.partrolresult.domain.PatrolResult;
import com.inspect.partrolresult.domain.PatrolResultRef;
import com.inspect.partrolresult.mapper.PatrolResultMapper;
import com.inspect.partrolresult.service.IPatrolResultService;
import com.inspect.task.domain.PatrolData;
import com.inspect.task.service.IPatrolTaskService;
@ -23,6 +26,7 @@ import com.inspect.taskinfo.service.IPatrolTaskInfoService;
import java.util.*;
import java.util.stream.Collectors;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import com.inspect.taskstatus.domain.PatrolTaskStatus;
@ -41,6 +45,9 @@ public class ResultAnalysisController extends BaseController {
private final IPatrolTaskInfoService iPatrolTaskInfoService;
private final IPatrolResultService patrolResultService;
@Resource
private PatrolResultMapper patrolResultMapper;
public ResultAnalysisController(IResultAnalysisService resultAnalysisService, IPatrolTaskService patrolTaskService, IPatrolTaskInfoService iPatrolTaskInfoService, IPatrolResultService patrolResultService) {
this.resultAnalysisService = resultAnalysisService;
this.patrolTaskService = patrolTaskService;
@ -583,6 +590,96 @@ public class ResultAnalysisController extends BaseController {
}
}
@GetMapping({"/list_v3"})
public TableDataInfo listV3(PatrolTaskStatus patrolTaskStatus) {
ResultAnalysis resultAnalysis = new ResultAnalysis();
resultAnalysis.setTaskPatrolId(patrolTaskStatus.getTaskPatrolledId());
resultAnalysis.setResult("0");
List<PatrolData> filterList = patrolResultService.selectPatrolDataResultByTaskCodeV2(resultAnalysis);
startPage();
resultAnalysis.setFilter(patrolTaskStatus.getFilter());
resultAnalysis.setResult("");
List<PatrolData> list = patrolResultService.selectPatrolDataResultByTaskCodeV2(resultAnalysis);
List<AlgInfo> algInfos = patrolResultService.selectAlgInfo(new PatrolResult());
list.forEach((item) -> {
item.setAlgName((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(data.getAlgType());
}).collect(Collectors.toList());
if(!filterDatas.isEmpty()) {
item.setImg((filterDatas.get(0)).getImgAnalyse());
item.setImageNormalUrlPath((filterDatas.get(0)).getImageNormalUrlPath());
} else {
item.setImg("");
}
}
});
Collections.sort(list);
return this.getDataTable(list);
}
@GetMapping({"/list_exception"})
public TableDataInfo listException(PatrolTaskStatus patrolTaskStatus) {
ResultAnalysis resultAnalysis = new ResultAnalysis();
resultAnalysis.setTaskPatrolId(patrolTaskStatus.getTaskPatrolledId());
startPage();
resultAnalysis.setFilter(patrolTaskStatus.getFilter());
resultAnalysis.setResCode("2000");
resultAnalysis.setPosType(patrolTaskStatus.getPosType());
List<PatrolData> list = patrolResultService.selectPatrolDataResultByTaskCodeV2(resultAnalysis);
List<AlgInfo> algInfos = patrolResultService.selectAlgInfo(new PatrolResult());
list.forEach((item) -> {
try {
item.setAlgName((algInfos.stream().filter((alg) -> {
return alg.getAlgSubtypeCode().equals(item.getAlgType());
}).findFirst().get()).getAlgSubtypeName());
} catch (Exception e) {
logger.error("list_exception: algType: {}, exception: {}", item.getAlgType(), e.getMessage());
}
});
Collections.sort(list);
return getDataTable(list);
}
@GetMapping({"/doc"})
public TableDataInfo listDoc(PatrolResult patrolResult) {
List<AlgInfo> algInfos = patrolResultMapper.selectAlgInfo(new PatrolResult());
startPage();
List<PatrolResultRef> patrolResultRefs = patrolResultMapper.selectResultDoc(patrolResult);
for (PatrolResultRef ref : patrolResultRefs) {
ref.setAlgName((algInfos.stream().filter((alg) -> {
return alg.getAlgSubtypeCode().equals(ref.getAlgType());
}).findFirst().get()).getAlgSubtypeName());
}
return getDataTable(patrolResultRefs);
}
@GetMapping({"/doc/detail"})
public Response<PatrolResult> docDetail(PatrolResult patrolResult) {
List<AlgInfo> algInfos = patrolResultMapper.selectAlgInfo(new PatrolResult());
PatrolResultRef result = patrolResultMapper.selectResultDoc(patrolResult).get(0);
result.setAlgName((algInfos.stream().filter((alg) -> {
return alg.getAlgSubtypeCode().equals(result.getAlgType());
}).findFirst().get()).getAlgSubtypeName());
return Response.ok(patrolResult);
}
@PostMapping({"doc"})
public AjaxResult modifyDoc(@RequestBody ModifyDocModel model) {
ResultAnalysis resultAnalysis = resultAnalysisService.selectResultAnalysisByLineId(model.getLineId());
resultAnalysis.setOriginalValue(resultAnalysis.getResValue());
resultAnalysis.setResValue(model.getValue());
resultAnalysisService.updateResultAnalysis(resultAnalysis);
return AjaxResult.success();
}
@GetMapping({"summary/points"})
public TableDataInfo summaryPoints(AnalyseSummaryAlarmModel model) {
this.startPage();


+ 35
- 0
inspect-main/inspect-main-task/src/main/java/com/inspect/analysis/domain/ModifyDocModel.java View File

@ -0,0 +1,35 @@
package com.inspect.analysis.domain;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
import java.util.Objects;
@Getter
@Setter
public class ModifyDocModel implements Serializable {
private Long lineId;
private String value;
@Override
public boolean equals(Object object) {
if (this == object) return true;
if (object == null || getClass() != object.getClass()) return false;
ModifyDocModel that = (ModifyDocModel) object;
return Objects.equals(lineId, that.lineId) && Objects.equals(value, that.value);
}
@Override
public int hashCode() {
return Objects.hash(lineId, value);
}
@Override
public String toString() {
return "ModifyDocModel{" +
"lineId=" + lineId +
", value='" + value + '\'' +
'}';
}
}

+ 1
- 0
inspect-main/inspect-main-task/src/main/java/com/inspect/analysis/service/impl/AnalysisServiceImpl.java View File

@ -85,6 +85,7 @@ public class AnalysisServiceImpl implements IAnalysisService {
if (redisService.hasKey(keyFilterRequest)) { // 初筛结果
analyseResult.setFilter("1"); // 设置初筛标志
analyseRequest = (AnalyseRequest) redisService.redisTemplate.opsForValue().getAndDelete(keyFilterRequest);
log.info("picAnalyseRetNotify analyseRequest IN REDIS: {}", analyseRequest);
AnalyseResPoint analyseResPoint = analyseResult.getResultList().get(0).getResults().get(0);
boolean bDefect = analyseResPoint.isDefect(); // code=2000代表初筛结果返回正常value=1代表有缺陷
log.info("picAnalyseRetNotify FILTER bDefect={}, algorithmType={}", bDefect, analyseResPoint.getType());


+ 3
- 1
inspect-main/inspect-main-task/src/main/java/com/inspect/analysis/service/impl/IspAlgorithmRequestService.java View File

@ -47,7 +47,9 @@ public class IspAlgorithmRequestService {
String filter = "0";
String requestUrl;
if ("1".equals(analyseFilter) && isFilter) {
redisService.setCacheObject(AnalyseConstants.ANALYSE_FILTER_REQUEST.concat(requestId), analyseReq.clone(), 1L, TimeUnit.HOURS);
final String analyzeFilterRequestIdRedisKey = AnalyseConstants.ANALYSE_FILTER_REQUEST.concat(requestId);
log.info("[ALG] sendRequest analyseFilterRequestIdRedisKey: {}, analyseReq: {}", analyzeFilterRequestIdRedisKey, analyseReq);
redisService.setCacheObject(analyzeFilterRequestIdRedisKey, analyseReq.clone(), 1L, TimeUnit.HOURS);
AnalyseReqItem analyseReqItem = analyseReq.getObjectList().get(0);
analyseReqItem.setTypeList(new String[]{"tx_pb"});
analyseReq.setObjectList(Collections.singletonList(analyseReqItem));


+ 75
- 75
inspect-main/inspect-main-task/src/main/java/com/inspect/partrolresult/controller/PatrolResultController.java View File

@ -714,8 +714,8 @@ public class PatrolResultController extends BaseController {
List<AnalyseReqItem> firList = new ArrayList<>();
String image = patrolResult.getFilePath().replace(ftp.getFtpPath() + "/", StringUtils.EMPTY);
String imageType = patrolResult.getFileType();
AnalyseReqItem reqItem = new AnalyseReqItem();
reqItem.setObjectId(patrolResult.getDeviceId());
AnalyseReqItem analyseReqItem = new AnalyseReqItem();
analyseReqItem.setObjectId(patrolResult.getDeviceId());
Map<String, String> map = patrolResultService.selectAlgorithmType(patrolResult.getDeviceId());
String[] strings = new String[1];
List<String> algIds = new ArrayList<>();
@ -746,7 +746,7 @@ public class PatrolResultController extends BaseController {
}
logger.info("callRemoteAlgorithm algInfoList start: {}", algInfoList);
reqItem.setImageUrlList(image.split(StringUtils.COMMA));
analyseReqItem.setImageUrlList(image.split(StringUtils.COMMA));
String pictureFrame = patrolTaskService.selectConfigByKey("PICTURE_FRAME");
logger.info("callRemoteAlgorithm pictureFrame: {}", pictureFrame);
@ -776,9 +776,9 @@ public class PatrolResultController extends BaseController {
}
ids = patrolResult.getLineId() + "";
reqItem.setImageUrlList(typeArr);
reqItem.setTypeList(strings);
firList.add(reqItem.clone());
analyseReqItem.setImageUrlList(typeArr);
analyseReqItem.setTypeList(strings);
firList.add(analyseReqItem.clone());
}
algInfoList.removeAll(infraredList);
@ -804,22 +804,22 @@ public class PatrolResultController extends BaseController {
filePanpath = judgeMap.get("dis_ref_picture_path");
}
reqItem.setImageNormalUrlPath(filePanpath);
analyseReqItem.setImageNormalUrlPath(filePanpath);
List<AlgInfo> judgeList = algInfoList.stream().filter((item) -> {
return item.getAlgName().contains("判别");
}).collect(Collectors.toList());
if (!judgeList.isEmpty()) {
reqItem.setTypeList(judgeList.stream().map(AlgInfo::getAlgSubtypeCode).toArray(String[]::new));
analyseReqItem.setTypeList(judgeList.stream().map(AlgInfo::getAlgSubtypeCode).toArray(String[]::new));
String[] images;
if (image.contains(StringUtils.COMMA)) {
images = image.split(StringUtils.COMMA);
reqItem.setImageUrlList(images);
analyseReqItem.setImageUrlList(images);
} else {
images = new String[]{image};
reqItem.setImageUrlList(images);
analyseReqItem.setImageUrlList(images);
}
bigList.add(reqItem.clone());
bigList.add(analyseReqItem.clone());
}
algInfoList.removeAll(judgeList);
@ -827,8 +827,8 @@ public class PatrolResultController extends BaseController {
return "meter".equals(item.getAlgSubtypeCode());
}).collect(Collectors.toList());
if (!meterList.isEmpty()) {
reqItem.setTypeList(meterList.stream().map(AlgInfo::getAlgSubtypeCode).toArray(String[]::new));
filterList.add(reqItem.clone());
analyseReqItem.setTypeList(meterList.stream().map(AlgInfo::getAlgSubtypeCode).toArray(String[]::new));
filterList.add(analyseReqItem.clone());
}
algInfoList.removeAll(meterList);
@ -836,14 +836,14 @@ public class PatrolResultController extends BaseController {
return "缺陷识别".equals(item.getAlgName());
}).collect(Collectors.toList());
if (!defectList.isEmpty()) {
reqItem.setTypeList(defectList.stream().map(AlgInfo::getAlgSubtypeCode).toArray(String[]::new));
bigList.add(reqItem.clone());
analyseReqItem.setTypeList(defectList.stream().map(AlgInfo::getAlgSubtypeCode).toArray(String[]::new));
bigList.add(analyseReqItem.clone());
}
algInfoList.removeAll(defectList);
if (!algInfoList.isEmpty()) {
reqItem.setTypeList(algInfoList.stream().map(AlgInfo::getAlgSubtypeCode).toArray(String[]::new));
bigList.add(reqItem.clone());
analyseReqItem.setTypeList(algInfoList.stream().map(AlgInfo::getAlgSubtypeCode).toArray(String[]::new));
bigList.add(analyseReqItem.clone());
}
}
@ -1049,7 +1049,7 @@ public class PatrolResultController extends BaseController {
@GetMapping({"/sendMessage"})
public AjaxResult getInfo(String type, String messageBody) {
logger.info("type:" + type + ", messageBody:" + messageBody);
logger.info("[RESULT] type: {}, messageBody: {}", type, messageBody);
PatrolTaskFtp patrolTaskFtp = patrolTaskFtpService.selectPatrolTaskFtpByLineId(2L);
int i = 1;
List<String> patrolDeviceCodeList = new ArrayList<>();
@ -1191,12 +1191,12 @@ public class PatrolResultController extends BaseController {
jsonArray = parseObject.get("Items");
}
List<PatrolResult> eqList = JSONArray.parseArray(jsonArray.toString(), PatrolResult.class);
List<PatrolResult> patrolResultList = JSONArray.parseArray(jsonArray.toString(), PatrolResult.class);
String code;
if (!eqList.isEmpty()) {
if (!patrolResultList.isEmpty()) {
code = "";
for (PatrolResult arr : eqList) {
for (PatrolResult arr : patrolResultList) {
Map<String, String> map = resultAnalysisService.selectPointInfoById(arr.getDeviceId());
if (map == null) {
Map<String, Object> maps = resultAnalysisService.selectPointInfoByCode(arr.getDeviceId());
@ -1215,7 +1215,7 @@ public class PatrolResultController extends BaseController {
if (!tasks.isEmpty()) {
PatrolTaskResultMain taskResultMain = new PatrolTaskResultMain();
taskResultMain.setTaskId(String.valueOf(tasks.get(0).getTaskId()));
taskResultMain.setTaskPatrolledId(eqList.get(0).getTaskPatrolledId());
taskResultMain.setTaskPatrolledId(patrolResultList.get(0).getTaskPatrolledId());
logger.info("taskResultMain: {}", taskResultMain);
listEqpBook = iPatrolTaskResultMainService.selectPatrolTaskResultMainList(taskResultMain);
if (!listEqpBook.isEmpty()) {
@ -1231,8 +1231,8 @@ public class PatrolResultController extends BaseController {
}
patrolTaskResultMain.setFileStatus("0");
patrolTaskResultMain.setTaskPatrolledId(eqList.get(0).getTaskPatrolledId());
int devCount = tasks.get(0).getDevNo().split(",").length;
patrolTaskResultMain.setTaskPatrolledId(patrolResultList.get(0).getTaskPatrolledId());
int devCount = tasks.get(0).getDevNo().split(StringUtils.COMMA).length;
if(devCount > 1) {
PatrolTaskResultMain resultMainQuery = new PatrolTaskResultMain();
resultMainQuery.setTaskId(String.valueOf(tasks.get(0).getTaskId()));
@ -1270,12 +1270,12 @@ public class PatrolResultController extends BaseController {
}
List<PatrolResult> resultList = new ArrayList<>();
for (PatrolResult arr : eqList) {
logger.info(Color.GREEN + "PatrolResult: {}" + Color.END, arr);
for (PatrolResult patrolResult : patrolResultList) {
logger.info(Color.GREEN + "PatrolResult: {}" + Color.END, patrolResult);
datetype = "";
String str;
if (StringUtils.isNotEmpty(arr.getPatrolDeviceCode())) {
Map<String, Object> eqbookMap = resultAnalysisService.selectEqInfoByCode(arr.getPatrolDeviceCode());
if (StringUtils.isNotEmpty(patrolResult.getPatrolDeviceCode())) {
Map<String, Object> eqbookMap = resultAnalysisService.selectEqInfoByCode(patrolResult.getPatrolDeviceCode());
if (eqbookMap != null && eqbookMap.get("type") != null) {
str = eqbookMap.get("type") + "";
if (str.equals("13")) {
@ -1290,26 +1290,26 @@ public class PatrolResultController extends BaseController {
}
PatrolResult patrolResultParam = new PatrolResult();
patrolResultParam.setTaskPatrolledId(arr.getTaskPatrolledId());
patrolResultParam.setTaskPatrolledId(patrolResult.getTaskPatrolledId());
str = parseObject.getString("SendCode");
String strfile;
if ("2".equals(datetype)) {
logger.info("feedback from robot");
Long patrolPointId = baseDataClient.queryPatrolPointId(str + "_" + arr.getDeviceId());
Long patrolPointId = baseDataClient.queryPatrolPointId(str + "_" + patrolResult.getDeviceId());
if (patrolPointId != null) {
arr.setDeviceId(patrolPointId.toString());
patrolResult.setDeviceId(patrolPointId.toString());
}
InputStream is = doGetRequestForInputStream(intranetFtpAddress + arr.getFilePath());
InputStream is = doGetRequestForInputStream(intranetFtpAddress + patrolResult.getFilePath());
logger.info("feedback from robot image size: {}", (is != null));
if (is != null) {
try {
is = ImageUtil.overlaying(is, arr.getRectangle(), arr.getValue());
strfile = arr.getFilePath();
is = ImageUtil.overlaying(is, patrolResult.getRectangle(), patrolResult.getValue());
strfile = patrolResult.getFilePath();
strfile = strfile.substring(0, strfile.lastIndexOf("/"));
String fileName = "modify_" + strfile.substring(strfile.lastIndexOf("/") + 1);
String file = saveFile(is, fileName, strfile);
arr.setFilePath(file);
patrolResult.setFilePath(file);
logger.info("robot image path: {}", file);
} catch (Exception e) {
e.printStackTrace();
@ -1317,61 +1317,61 @@ public class PatrolResultController extends BaseController {
}
}
patrolResultParam.setDeviceId(arr.getDeviceId());
patrolResultParam.setDeviceId(patrolResult.getDeviceId());
patrolResultParam.setDataType(datetype);
List<PatrolResult> results = patrolResultService.selectPatrolResultList(patrolResultParam);
if (!results.isEmpty()) {
PatrolResult patrolResult2 = results.get(0);
if (StringUtils.isNotEmpty(arr.getFilePath())) {
patrolResult2.setFilePath(arr.getFilePath());
if (StringUtils.isNotEmpty(patrolResult.getFilePath())) {
patrolResult2.setFilePath(patrolResult.getFilePath());
}
if (StringUtils.isNotEmpty(arr.getFileType())) {
patrolResult2.setFileType(arr.getFileType());
if (StringUtils.isNotEmpty(patrolResult.getFileType())) {
patrolResult2.setFileType(patrolResult.getFileType());
}
if (StringUtils.isNotEmpty(arr.getTime())) {
patrolResult2.setTime(arr.getTime());
if (StringUtils.isNotEmpty(patrolResult.getTime())) {
patrolResult2.setTime(patrolResult.getTime());
}
if ("2".equals(datetype)) {
if (StringUtils.isNotEmpty(arr.getUnit())) {
patrolResult2.setUnit(arr.getUnit());
if (StringUtils.isNotEmpty(patrolResult.getUnit())) {
patrolResult2.setUnit(patrolResult.getUnit());
}
if (StringUtils.isNotEmpty(arr.getValid())) {
patrolResult2.setValid(arr.getValid());
if (StringUtils.isNotEmpty(patrolResult.getValid())) {
patrolResult2.setValid(patrolResult.getValid());
}
if (StringUtils.isNotEmpty(arr.getValue())) {
patrolResult2.setValue(arr.getValue());
if (StringUtils.isNotEmpty(patrolResult.getValue())) {
patrolResult2.setValue(patrolResult.getValue());
}
if (StringUtils.isNotEmpty(arr.getValueType())) {
patrolResult2.setValueType(arr.getValueType());
if (StringUtils.isNotEmpty(patrolResult.getValueType())) {
patrolResult2.setValueType(patrolResult.getValueType());
}
if (StringUtils.isNotEmpty(arr.getValueUnit())) {
patrolResult2.setValueUnit(arr.getValueUnit());
if (StringUtils.isNotEmpty(patrolResult.getValueUnit())) {
patrolResult2.setValueUnit(patrolResult.getValueUnit());
}
}
Map<String, String> valueMap = patrolResultService.getPatrolResultValue(arr);
Map<String, String> valueMap = patrolResultService.getPatrolResultValue(patrolResult);
if (null != valueMap && !valueMap.isEmpty()) {
logger.info("valueMap:" + valueMap.get("value") + ",value_unit:" + valueMap.get("value_unit"));
if (valueMap.containsKey("value") && null != valueMap.get("value")) {
strfile = valueMap.get("value");
arr.setValue(strfile);
patrolResult.setValue(strfile);
}
if (valueMap.containsKey("value_unit") && null != valueMap.get("value_unit")) {
strfile = valueMap.get("value_unit");
arr.setValueUnit(strfile);
patrolResult.setValueUnit(strfile);
}
}
if (StringUtils.isNotEmpty(arr.getFilePath()) && arr.getFilePath().contains(patrolTaskFtp.getFtpPath())) {
strfile = arr.getFilePath().replaceAll(patrolTaskFtp.getFtpPath().concat(StringUtils.SLASH), StringUtils.EMPTY);
if (StringUtils.isNotEmpty(patrolResult.getFilePath()) && patrolResult.getFilePath().contains(patrolTaskFtp.getFtpPath())) {
strfile = patrolResult.getFilePath().replaceAll(patrolTaskFtp.getFtpPath().concat(StringUtils.SLASH), StringUtils.EMPTY);
if (StringUtils.isNotEmpty(strfile)) {
patrolResult2.setFilePath(strfile);
}
@ -1382,52 +1382,52 @@ public class PatrolResultController extends BaseController {
resultList.add(patrolResult2);
// }
} else {
arr.setMainId(mainID + "");
Map<String, String> stringStringMap = patrolResultService.selectThresholdByPointId(arr.getDeviceId());
patrolResult.setMainId(mainID + "");
Map<String, String> stringStringMap = patrolResultService.selectThresholdByPointId(patrolResult.getDeviceId());
if (stringStringMap != null && StringUtils.isNotEmpty(stringStringMap.get("alarm_threshold"))) {
arr.setThreshold(stringStringMap.get("alarm_threshold"));
patrolResult.setThreshold(stringStringMap.get("alarm_threshold"));
}
arr.setPatrolStatus("0");
if (StringUtils.isNotEmpty(arr.getPatrolDeviceCode())) {
Map<String, Object> valueMap = resultAnalysisService.selectEqInfoByCode(arr.getPatrolDeviceCode());
patrolResult.setPatrolStatus("0");
if (StringUtils.isNotEmpty(patrolResult.getPatrolDeviceCode())) {
Map<String, Object> valueMap = resultAnalysisService.selectEqInfoByCode(patrolResult.getPatrolDeviceCode());
if (valueMap != null && valueMap.get("type") != null) {
strfile = valueMap.get("type") + "";
if (strfile.equals("13")) {
arr.setDataType("3");
patrolResult.setDataType("3");
} else if (!strfile.equals("1") && !strfile.equals("2") && !strfile.equals("3")) {
arr.setDataType(strfile.equals("14") ? "4" : "1");
patrolResult.setDataType(strfile.equals("14") ? "4" : "1");
} else {
arr.setDataType("2");
patrolResult.setDataType("2");
}
}
}
if (StringUtils.isNotEmpty(arr.getFilePath()) && arr.getFilePath().contains(patrolTaskFtp.getFtpPath())) {
strfile = arr.getFilePath().replaceAll(patrolTaskFtp.getFtpPath() + "/", StringUtils.EMPTY);
if (StringUtils.isNotEmpty(patrolResult.getFilePath()) && patrolResult.getFilePath().contains(patrolTaskFtp.getFtpPath())) {
strfile = patrolResult.getFilePath().replaceAll(patrolTaskFtp.getFtpPath() + "/", StringUtils.EMPTY);
if (StringUtils.isNotEmpty(strfile)) {
arr.setFilePath(strfile);
patrolResult.setFilePath(strfile);
}
}
Map<String, String> valueMap = patrolResultService.getPatrolResultValue(arr);
Map<String, String> valueMap = patrolResultService.getPatrolResultValue(patrolResult);
if (null != valueMap && !valueMap.isEmpty()) {
logger.info("valueMap:" + valueMap.get("value") + ",value_unit:" + valueMap.get("value_unit"));
if (valueMap.containsKey("value") && null != valueMap.get("value")) {
strfile = valueMap.get("value");
arr.setValue(strfile);
patrolResult.setValue(strfile);
}
if (valueMap.containsKey("value_unit") && null != valueMap.get("value_unit")) {
strfile = valueMap.get("value_unit");
arr.setValueUnit(strfile);
patrolResult.setValueUnit(strfile);
}
}
i = patrolResultService.insertPatrolResult(arr);//
resultStatistics.compare(arr);
i = patrolResultService.insertPatrolResult(patrolResult);//
resultStatistics.compare(patrolResult);
// if (!"2".equals(Jqtype)) {
resultList.add(arr);
resultList.add(patrolResult);
// }
}
}


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

@ -13,6 +13,8 @@ public class PatrolResultRef {
private String devType;
private String time;
private String value;
private String algType;
private String algName;
private String threshold;
private String filePath;
private String description;
@ -25,12 +27,12 @@ public class PatrolResultRef {
if (this == object) return true;
if (object == null || getClass() != object.getClass()) return false;
PatrolResultRef that = (PatrolResultRef) object;
return Objects.equals(lineId, that.lineId) && Objects.equals(deviceId, that.deviceId) && Objects.equals(devType, that.devType) && Objects.equals(time, that.time) && Objects.equals(value, that.value) && Objects.equals(threshold, that.threshold) && Objects.equals(filePath, that.filePath) && Objects.equals(description, that.description) && Objects.equals(pointStatus, that.pointStatus) && Objects.equals(valueUnit, that.valueUnit) && Objects.equals(resultContent, that.resultContent);
return Objects.equals(lineId, that.lineId) && Objects.equals(deviceId, that.deviceId) && Objects.equals(devType, that.devType) && Objects.equals(time, that.time) && Objects.equals(value, that.value) && Objects.equals(algType, that.algType) && Objects.equals(algName, that.algName) && Objects.equals(threshold, that.threshold) && Objects.equals(filePath, that.filePath) && Objects.equals(description, that.description) && Objects.equals(pointStatus, that.pointStatus) && Objects.equals(valueUnit, that.valueUnit) && Objects.equals(resultContent, that.resultContent);
}
@Override
public int hashCode() {
return Objects.hash(lineId, deviceId, devType, time, value, threshold, filePath, description, pointStatus, valueUnit, resultContent);
return Objects.hash(lineId, deviceId, devType, time, value, algType, algName, threshold, filePath, description, pointStatus, valueUnit, resultContent);
}
@Override
@ -41,6 +43,8 @@ public class PatrolResultRef {
", devType='" + devType + '\'' +
", time='" + time + '\'' +
", value='" + value + '\'' +
", algType='" + algType + '\'' +
", algName='" + algName + '\'' +
", threshold='" + threshold + '\'' +
", filePath='" + filePath + '\'' +
", description='" + description + '\'' +


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

@ -107,4 +107,7 @@ public interface PatrolResultMapper {
List<PatrolResultRef> selectResultRefByLineIds(@Param("mainIds") List<Long> mainIds);
List<BasePointAreaInfo> selectBaseInfoByMainIds(@Param("mainIds") List<Long> mainIds);
List<PatrolResultRef> selectResultDoc(PatrolResult patrolResult);
}

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

@ -2,6 +2,7 @@ package com.inspect.partrolresult.service;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.util.StringUtil;
import com.inspect.analysis.constant.AnalyseConstants;
import com.inspect.analysis.domain.AnalyseLog;
import java.util.Collections;
@ -49,7 +50,9 @@ public class AnalyseRemoteService {
String analyseFilter = patrolTaskService.selectConfigByKey("ANALYSE_IS_FILTER");
String requestUrl;
if ("1".equals(analyseFilter) && isFilter) {
this.redisService.setCacheObject("ANALYSE_FILTER_REQUEST:" + requestId, analyseReq.clone(), 1L, TimeUnit.HOURS);
final String analyzeFilterRequestIdRedisKey = AnalyseConstants.ANALYSE_FILTER_REQUEST.concat(requestId);
log.info("[ALG] sendRequest analyseFilterRequestIdRedisKey: {}, analyseReq: {}", analyzeFilterRequestIdRedisKey, analyseReq);
this.redisService.setCacheObject(analyzeFilterRequestIdRedisKey, analyseReq.clone(), 1L, TimeUnit.HOURS);
AnalyseReqItem analyseReqItem = analyseReq.getObjectList().get(0);
analyseReqItem.setTypeList(typeList);
analyseReq.setObjectList(Collections.singletonList(analyseReqItem));


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

@ -1030,4 +1030,41 @@
</foreach>
ORDER BY main_id,create_time
</select>
<select id="selectResultDoc" parameterType="PatrolResult" resultMap="PatrolResultRef">
select
b.line_id,
a.device_id,
c.dev_type,
a.time,
a.value,
a.threshold,
a.file_path,
b.description,
b.point_status,
b.res_status,
a.value_unit,
b.result_content,
b.res_img_url,
b.res_value,
b.res_desc,
b.alg_type,
a.device_name,
a.patrol_device_name,
a.task_name,
a.data_type,
a.patrol_device_code,
a.task_code,
a.task_patrolled_id,
b.original_value
from patrol_result a
left join result_analysis b on a.line_id = b.business_id
left join patrol_task_info c on a.task_code = c.task_major_id
and a.device_id = c.device_id
and a.patrol_device_code = c.dev_no
where b.result = '1' and b.point_status != '1'
<if test="mainId != null and mainId != ''"> and a.main_id = #{mainId}</if>
<if test="lineId != null and lineId != ''"> and b.line_id = #{lineId}</if>
</select>
</mapper>

Loading…
Cancel
Save