Przeglądaj źródła

料塔余量修改2

wwh 1 rok temu
rodzic
commit
45b99dc29f

+ 5 - 6
snowy-web-app/src/main/java/vip/xiaonuo/modular/feed/feedingenv/service/impl/FeedingEnvServiceImpl.java

@@ -132,11 +132,6 @@ public class FeedingEnvServiceImpl extends ServiceImpl<FeedingEnvMapper, Feeding
         JSONObject jsonObject = new JSONObject();
         long deviceNum = this.count(new QueryWrapper<FeedingEnv>().lambda().eq(FeedingEnv::getOrgId, orgId));
         if (deviceNum > 0){
-            jsonObject.put("envCount", 0);
-            jsonObject.put("onliveCount", 0);
-            jsonObject.put("offliveCount", 0);
-            jsonObject.put("rank", "0%");
-        }else {
             jsonObject.put("envCount",deviceNum);
             long onDeviceNum = this.count(new QueryWrapper<FeedingEnv>().lambda().eq(FeedingEnv::getDeviceStatus,"1").eq(FeedingEnv::getOrgId, orgId));
             jsonObject.put("onliveCount", onDeviceNum);
@@ -149,7 +144,11 @@ public class FeedingEnvServiceImpl extends ServiceImpl<FeedingEnvMapper, Feeding
             numberFormat.setMaximumFractionDigits(2);
             String onlineRate = numberFormat.format((float)onDeviceNum / (float) deviceNum* 100) + "%";
             jsonObject.put("rank", onlineRate);
-
+        }else {
+            jsonObject.put("envCount", 0);
+            jsonObject.put("onliveCount", 0);
+            jsonObject.put("offliveCount", 0);
+            jsonObject.put("rank", "0%");
         }
         return jsonObject;
     }