ソースを参照

更新-info接口

wuweihao 3 年 前
コミット
bdddf6d545

+ 71 - 11
gis_cms/src/main/java/com/gis/cms/service/impl/HotelServiceImpl.java

@@ -193,14 +193,71 @@ public class HotelServiceImpl extends ServiceImpl<HotelMapper, HotelEntity> impl
         return this.list(wrapper);
     }
 
+//    @Override
+//    public Result info() {
+//        List<HotelEntity> list = webList();
+//        // status 状态 > 0:可用, 1:储备, 2:应急储备
+//        int total = 0; //酒店总数
+//        int used = 0; // 酒店在用
+//        int store = 0; // 酒店储备
+//        int emergencyStore = 0; //酒店应急储备
+//
+//
+//
+//        int roomTotal = 0; //总房间数
+//        int roomUsed = 0; //房间总入住数量
+//        int roomUsable = 0; //房间总空闲数量
+//        int roomIsolation = 0; //隔离房间数
+//        int touch = 0; //密接人数
+//        int touchSecond = 0; //次密人数数
+//
+//        for (HotelEntity entity : list) {
+//            Integer status = entity.getStatus();
+//            if (status == 0){
+//                used++;
+//            } else if (status == 1) {
+//                store++;
+//            } else {
+//                emergencyStore++;
+//            }
+//
+//            roomTotal = roomTotal + entity.getTotal();
+//            roomUsed = roomUsed + entity.getUsed();
+//            roomUsable = roomUsable + entity.getUsable();
+//            roomIsolation = roomIsolation + entity.getRoomIsolation();
+//            touch = touch + entity.getTouch();
+//            touchSecond = touchSecond + entity.getTouchSecond();
+//        }
+//        total = list.size();
+//
+//        HashMap<Object, Object> map = new HashMap<>();
+//        map.put("total", total);
+//        map.put("used", used);
+//        map.put("store", store);
+//        map.put("emergencyStore", emergencyStore);
+//        map.put("roomTotal", roomTotal);
+//        map.put("roomUsed", roomUsed);
+//        map.put("roomUsable", roomUsable);
+//        map.put("roomIsolation", roomIsolation);
+//        map.put("touch", touch);
+//        map.put("touchSecond", touchSecond);
+//
+//
+//        return Result.success(map);
+//    }
+
+
     @Override
     public Result info() {
         List<HotelEntity> list = webList();
         // status 状态 > 0:可用, 1:储备, 2:应急储备
         int total = 0; //酒店总数
-        int used = 0; // 酒店在用
-        int store = 0; // 酒店储备
-        int emergencyStore = 0; //酒店应急储备
+        // 状态 > 1. 第一梯次启用(12 小时)|  2. 第二梯次启用(24 小时)| 3. 第三梯次启用(48 小时)| 4. 第四梯次启用(72 小时)
+        int status_1 = 0;
+        int status_2 = 0;
+        int status_3 = 0;
+        int status_4 = 0;
+
 
 
 
@@ -213,12 +270,14 @@ public class HotelServiceImpl extends ServiceImpl<HotelMapper, HotelEntity> impl
 
         for (HotelEntity entity : list) {
             Integer status = entity.getStatus();
-            if (status == 0){
-                used++;
-            } else if (status == 1) {
-                store++;
+            if (status == 1){
+                status_1++;
+            } else if (status == 2) {
+                status_2++;
+            } else if (status == 3){
+                status_3++;
             } else {
-                emergencyStore++;
+                status_4++;
             }
 
             roomTotal = roomTotal + entity.getTotal();
@@ -232,9 +291,10 @@ public class HotelServiceImpl extends ServiceImpl<HotelMapper, HotelEntity> impl
 
         HashMap<Object, Object> map = new HashMap<>();
         map.put("total", total);
-        map.put("used", used);
-        map.put("store", store);
-        map.put("emergencyStore", emergencyStore);
+        map.put("status_1", status_1);
+        map.put("status_2", status_2);
+        map.put("status_3", status_3);
+        map.put("status_4", status_4);
         map.put("roomTotal", roomTotal);
         map.put("roomUsed", roomUsed);
         map.put("roomUsable", roomUsable);