Переглянути джерело

一键灭火倒计时修改

xuxiaofei 3 роки тому
батько
коміт
3ca7ad5239

+ 8 - 5
zd-modules/zd-algorithm/src/main/java/com/zd/alg/fire/controller/FireDeviceController.java

@@ -273,6 +273,7 @@ public class FireDeviceController extends BaseController {
      */
     @GetMapping(value = "/outfireapp")
     public ResultData outFire(Long subjectId,String deviceCode) throws InterruptedException {
+        Long fireTimeVal=fireTime;
         logger.info("=========小程序端开始一键灭火=======");
         Map<String, Object> map = new HashMap<>();
         //设备是否在线
@@ -292,13 +293,13 @@ public class FireDeviceController extends BaseController {
         vo.setSubjectId(subjectId);
         List<HardwareFireDeviceVO> list = fireDeviceService.selectHardwareFireDeviceList(vo);
         if(list.get(0).getDeviceCountDown()!=null){
-            fireTime= fireTime+list.get(0).getDeviceCountDown();
+            fireTimeVal= fireTimeVal+list.get(0).getDeviceCountDown();
         }
 
         //int waitTime = 5;//倒计时等待时间(秒)
         map.put("online", online);
         map.put("waitTime", countDown);
-        map.put("direTime", fireTime);
+        map.put("direTime", fireTimeVal);
         new Thread(()->startTT(subjectId,deviceCode,countDown)).start();
         return ResultData.success(map);
     }
@@ -334,6 +335,7 @@ public class FireDeviceController extends BaseController {
     @GetMapping(value = "/outfirepc")
     public ResultData outFirePc(Long subjectId,String deviceCode) {
         logger.info("=========PC端开始一键灭火=======");
+        Long fireTimeVal=fireTime;
         Map<String, Object> map = new HashMap<>();
         //设备是否在线
         boolean online=false;
@@ -351,14 +353,15 @@ public class FireDeviceController extends BaseController {
         HardwareFireDeviceVO vo = new HardwareFireDeviceVO();
         vo.setSubjectId(subjectId);
         List<HardwareFireDeviceVO> list = fireDeviceService.selectHardwareFireDeviceList(vo);
+        logger.info("灭火固定时间fireTime:"+fireTime+" ,数据库配置时间:"+list.get(0).getDeviceCountDown());
         if(list.get(0).getDeviceCountDown()!=null){
-            fireTime= fireTime+list.get(0).getDeviceCountDown();
+            fireTimeVal= fireTimeVal+list.get(0).getDeviceCountDown();
         }
 
         //int waitTime = 5;//倒计时等待时间(秒)
         map.put("online", online);
         map.put("waitTime", countDown);
-        map.put("direTime", fireTime);
+        map.put("direTime", fireTimeVal);
         new Thread(()->startTT(subjectId,deviceCode,countDown)).start();
         return ResultData.success(map);
     }
@@ -519,7 +522,7 @@ public class FireDeviceController extends BaseController {
             logger.info("关闭继电器,执行结果:" + o);
         }
         map.put("msg", msg);
-        map.put("flg", true);
+        map.put("flg", flg);
         return map;
     }