Quellcode durchsuchen

fixed: 微调抓图

orgycat vor 7 Monaten
Ursprung
Commit
a5b60fdc9e

+ 2 - 3
hazard-admin/src/main/java/com/ozs/web/controller/shotschedule/CaptureStreamListener.java

@@ -89,12 +89,11 @@ public class CaptureStreamListener implements StreamListener<String, ObjectRecor
             StringBuilder fileName = new StringBuilder(cameraCode);
             fileName.append("-");
             fileName.append(DateTime.now().toString("yyyyMMddHHmmss"));
-            String isNormalPath = "normal";
-            if(isAlarm) isNormalPath="alarm";
+            String isNormalPath = isAlarm ? "alarm" : "normal";
             String filePath = dataDict.getStr("address")+"/"+isNormalPath+"/"+railwayName+"/"+installMiles+"/"+ LocalDate.now().getYear() +"/"+ LocalDate.now().getMonthValue() + "/" +fileName + ".jpeg";
             // 超过时间则进行抓拍
             if (now.isAfterOrEquals(nextExecuteTime) && nextExecuteTime.between(now, DateUnit.MINUTE) < 2) {
-                genPictureTaskService.getNormalPicture(cameraCode, dataDict.getStr("channel"),filePath);
+                genPictureTaskService.makePicture(cameraCode, dataDict.getStr("channel"), filePath);
             }
             // 通过RedisTemplate手动确认消息
             stringRedisTemplate.opsForStream().acknowledge(RedisPushService.STREAM_KEY, RedisPushService.STREAM_CONSUMER_GROUP_KEY, recordId.getValue());

+ 2 - 2
hazard-admin/src/main/java/com/ozs/web/controller/shotschedule/GenPictureTaskService.java

@@ -30,7 +30,7 @@ public class GenPictureTaskService {
     @Value("${shot.urlAddress}")
     private String urlAddress;
 
-    public boolean getNormalPicture(String cameraCode, String channel,String filePath) {
+    public boolean makePicture(String cameraCode, String channel, String filePath) {
         long start = System.currentTimeMillis();
         if (!ObjectUtils.isEmpty(cameraCode)) {
             try {
@@ -38,7 +38,7 @@ public class GenPictureTaskService {
 //                    log.debug("请求url======" + urlAddress + cameraCode + "/" + channel);
 //                }
                 URL url = new URL(urlAddress + cameraCode + "/" + channel);
-                System.out.println("fileName:"+filePath);
+                System.out.println("fileName:" + filePath);
 //                if (log.isDebugEnabled()) {
 //                    log.debug("正常摄像头截图开始, url: " + url + ", fileName: " + fileName);
 //                }