|
|
|
@ -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); |
|
|
|
// } |
|
|
|
} |
|
|
|
} |
|
|
|
|