Browse Source

fix: 红外算法读取温度失败时,返回分析失败code2002

master
yinhuaiwei 1 month ago
parent
commit
2811d0d6ff
2 changed files with 13 additions and 3 deletions
  1. +12
    -2
      src/main/java/com/inspect/simulator/service/impl/AlgorithmServiceImpl.java
  2. +1
    -1
      src/main/java/com/inspect/simulator/service/impl/HikVisionServiceImpl.java

+ 12
- 2
src/main/java/com/inspect/simulator/service/impl/AlgorithmServiceImpl.java View File

@ -132,6 +132,7 @@ public class AlgorithmServiceImpl implements AlgorithmService {
List<AnalyseResItem> analyseResItems = new ArrayList<>(); List<AnalyseResItem> analyseResItems = new ArrayList<>();
analyseResItems.add(analyseResItem); analyseResItems.add(analyseResItem);
analyseResult.setResultList(analyseResItems); analyseResult.setResultList(analyseResItems);
// 红外算法且配备了红外分析地址
if (MiscUtils.checkInfraredType(typeList) && !"null".equals(infraredPath)) { if (MiscUtils.checkInfraredType(typeList) && !"null".equals(infraredPath)) {
if (testMode) { if (testMode) {
try { try {
@ -162,6 +163,7 @@ public class AlgorithmServiceImpl implements AlgorithmService {
log.error("BIG_MODEL_INFRARED continue to call infrared EXCEPTION: {}", e.getMessage()); log.error("BIG_MODEL_INFRARED continue to call infrared EXCEPTION: {}", e.getMessage());
} }
} }
// 表计算法且配备了表计分析地址
} else if (MiscUtils.checkMeterType(typeList) && !"null".equals(meterPath)) { } else if (MiscUtils.checkMeterType(typeList) && !"null".equals(meterPath)) {
if (testMode) { if (testMode) {
try { try {
@ -184,6 +186,7 @@ public class AlgorithmServiceImpl implements AlgorithmService {
log.error("BIG_MODEL_METER continue to call meter EXCEPTION: {}", e.getMessage()); log.error("BIG_MODEL_METER continue to call meter EXCEPTION: {}", e.getMessage());
} }
} }
// 其他情况
} else { } else {
try { try {
log.info(Color.MAGENTA + "BIG_MODEL_COMMON filterPicAnalyse: nacos file.infraredPath not config, feedback to caller, analyseResult={}" + Color.END, new Gson().toJson(analyseResult)); log.info(Color.MAGENTA + "BIG_MODEL_COMMON filterPicAnalyse: nacos file.infraredPath not config, feedback to caller, analyseResult={}" + Color.END, new Gson().toJson(analyseResult));
@ -274,10 +277,17 @@ public class AlgorithmServiceImpl implements AlgorithmService {
// analyseResPoint.setValue("1");//失败 // analyseResPoint.setValue("1");//失败
// } // }
// analyseResPoint.setConf(String.format("%.2f", (double) infraredInfo.getFrameMax())); // analyseResPoint.setConf(String.format("%.2f", (double) infraredInfo.getFrameMax()));
analyseResPoint.setValue(String.format("%.2f", (double) infraredInfo.getFrameMax()));
analyseResPoint.setResImageUrl(infraredInfo.getOutPath()); analyseResPoint.setResImageUrl(infraredInfo.getOutPath());
analyseResPoint.setType(typeListStr); analyseResPoint.setType(typeListStr);
analyseResPoint.setCode("2000");
if (infraredInfo.getFrameMax() == -1 && infraredInfo.getFrameMin() == -1) {
analyseResPoint.setCode("2002");
analyseResPoint.setValue("--");
analyseResPoint.setDesc("分析失败");
} else {
analyseResPoint.setCode("2000");
analyseResPoint.setDesc("正常");
analyseResPoint.setValue(String.format("%.2f", (double) infraredInfo.getFrameMax()));
}
if (StringUtils.isNotBlank(analyseResPoint.getImageNormalUrlPath())) { if (StringUtils.isNotBlank(analyseResPoint.getImageNormalUrlPath())) {
String imageNormalUrlPath = resultAnalysisMapper.selectImg(patrolPointId); String imageNormalUrlPath = resultAnalysisMapper.selectImg(patrolPointId);
if (StringUtils.isBlank(imageNormalUrlPath)) { if (StringUtils.isBlank(imageNormalUrlPath)) {


+ 1
- 1
src/main/java/com/inspect/simulator/service/impl/HikVisionServiceImpl.java View File

@ -1542,7 +1542,7 @@ public class HikVisionServiceImpl implements HikVisionService {
//画框标注 //画框标注
String s = ImageOverlays(infraPictureInfo, infraredInfo); String s = ImageOverlays(infraPictureInfo, infraredInfo);
infraredInfo.setOutPath(s); infraredInfo.setOutPath(s);
log.info("计算过后最高温{}",infraredInfo.getFrameMax());
log.info("计算过后最高温{}",infraredInfo.getFrameMax(), infraredInfo.getFrameMin());
log.info("计算过后最高温 ->是否等于0.0f{}",infraredInfo.getFrameMax() == 0.0f); log.info("计算过后最高温 ->是否等于0.0f{}",infraredInfo.getFrameMax() == 0.0f);
//温度未取到 //温度未取到
if(StringUtils.isNull(maxTemperature)){ if(StringUtils.isNull(maxTemperature)){


Loading…
Cancel
Save