소스 검색

根据上下班时间来给盒子发送是否开启/关闭算法

tjf 1 일 전
부모
커밋
647ee64d62
1개의 변경된 파일13개의 추가작업 그리고 9개의 파일을 삭제
  1. 13 9
      ruoyi-system/src/main/java/com/ruoyi/manage/service/impl/ParameterSetServiceImpl.java

+ 13 - 9
ruoyi-system/src/main/java/com/ruoyi/manage/service/impl/ParameterSetServiceImpl.java

@@ -86,35 +86,39 @@ public class ParameterSetServiceImpl implements IParameterSetService {
         String playRate = parameterSet.getPlayRate();
         if (StringUtils.isNotEmpty(channelRange)) {
             try {
-                CompletableFuture<Void> future = mqttService.publish(DETECTION_RECT, channelId+"_"+channelRange);
+                CompletableFuture<Void> future = mqttService.publish(DETECTION_RECT, channelId + "_" + channelRange);
                 future.get(10, TimeUnit.SECONDS);
             } catch (InterruptedException | ExecutionException | TimeoutException e) {
                 return AjaxResult.error("发布消息失败:" + DETECTION_RECT);
             }
-        } else if (StringUtils.isNotEmpty(leaveTime)) {
+        }
+        if (StringUtils.isNotEmpty(leaveTime)) {
             try {
-                CompletableFuture<Void> future = mqttService.publish(DETECTION_LEAVETIME, channelId+"_"+leaveTime);
+                CompletableFuture<Void> future = mqttService.publish(DETECTION_LEAVETIME, channelId + "_" + leaveTime);
                 future.get(10, TimeUnit.SECONDS);
             } catch (InterruptedException | ExecutionException | TimeoutException e) {
                 return AjaxResult.error("发布消息失败:" + DETECTION_LEAVETIME);
             }
-        } else if (StringUtils.isNotEmpty(playTime)) {
+        }
+        if (StringUtils.isNotEmpty(playTime)) {
             try {
-                CompletableFuture<Void> future = mqttService.publish(DETECTION_PLAYTIME, channelId+"_"+playTime);
+                CompletableFuture<Void> future = mqttService.publish(DETECTION_PLAYTIME, channelId + "_" + playTime);
                 future.get(10, TimeUnit.SECONDS);
             } catch (InterruptedException | ExecutionException | TimeoutException e) {
                 return AjaxResult.error("发布消息失败:" + DETECTION_PLAYTIME);
             }
-        } else if (StringUtils.isNotEmpty(leaveRate)) {
+        }
+        if (StringUtils.isNotEmpty(leaveRate)) {
             try {
-                CompletableFuture<Void> future = mqttService.publish(DETECTION_LEAVERATE, channelId+"_"+leaveRate);
+                CompletableFuture<Void> future = mqttService.publish(DETECTION_LEAVERATE, channelId + "_" + leaveRate);
                 future.get(10, TimeUnit.SECONDS);
             } catch (InterruptedException | ExecutionException | TimeoutException e) {
                 return AjaxResult.error("发布消息失败:" + DETECTION_LEAVERATE);
             }
-        } else if (StringUtils.isNotEmpty(playRate)) {
+        }
+        if (StringUtils.isNotEmpty(playRate)) {
             try {
-                CompletableFuture<Void> future = mqttService.publish(DETECTION_PLAYRATE, channelId+"_"+playRate);
+                CompletableFuture<Void> future = mqttService.publish(DETECTION_PLAYRATE, channelId + "_" + playRate);
                 future.get(10, TimeUnit.SECONDS);
             } catch (InterruptedException | ExecutionException | TimeoutException e) {
                 return AjaxResult.error("发布消息失败:" + DETECTION_PLAYRATE);