瀏覽代碼

智慧办公楼层概览房间分布

ZhangManMan 2 年之前
父節點
當前提交
ba4f48425f

+ 1 - 1
src/main/java/com/sky/ioc/mapper/AccessSpaceMapper.java

@@ -13,7 +13,7 @@ import java.util.List;
 @Mapper
 public interface AccessSpaceMapper extends BaseMapper<AccessSpace> {
     @Select("<script>" +
-            "SELECT name,company, end_date as endDate" +
+            "SELECT name,company, end_date as endDate,tier" +
             " FROM access_space where 1=1 " +
             "<if test='iocParam!=null  and iocParam.floorId != null  '>" +
             " and tier=#{iocParam.floorId} " +

+ 16 - 2
src/main/java/com/sky/ioc/mapper/BuildingSpaceMapper.java

@@ -7,15 +7,29 @@ import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 
+import java.util.List;
+import java.util.Map;
+
 @Mapper
 public interface BuildingSpaceMapper extends BaseMapper<BuildingSpace> {
 
     @Select("<script>" +
             "SELECT used_station as usedStation,lead_area as leadArea,meeting_area as meetingArea," +
-            "work_area as workArea,print_area as printArea,other_area as otherArea,station_count as stationCount FROM building_space where 1=1 " +
+            "work_area as workArea,print_area as printArea,other_area as otherArea,station_count as stationCount," +
+            "tier as tier FROM building_space where 1=1 " +
             "<if test='iocParam!=null and iocParam.floorId != null  '>" +
             " and tier=#{iocParam.floorId} " +
             "</if>"+
-            "</script>")
+            " limit 1 </script>")
     BuildingSpace getByTier(@Param("iocParam")IocParam iocParam);
+
+    @Select("<script>" +
+            "SELECT used_station as usedStation,lead_area as leadArea,meeting_area as meetingArea," +
+            "work_area as workArea,print_area as printArea,other_area as otherArea,station_count as stationCount," +
+            "tier as tier FROM building_space where 1=1 " +
+            "<if test='iocParam!=null and iocParam.floorId != null  '>" +
+            " and tier=#{iocParam.floorId} " +
+            "</if>"+
+            "</script>")
+    List<BuildingSpace> getListByTier(@Param("iocParam")IocParam iocParam);
 }

+ 68 - 53
src/main/java/com/sky/ioc/service/space/impl/SpaceServiceImpl.java

@@ -19,11 +19,15 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.text.DecimalFormat;
+import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 import java.util.concurrent.ThreadLocalRandom;
 
 /**
  * TODO  空间
+ *
  * @Description
  * @Author LunCe
  * @Date 2023/2/22 11:44
@@ -39,6 +43,7 @@ public class SpaceServiceImpl implements SpaceService {
 
     /**
      * TODO  智能看板 -- 楼宇态势
+     *
      * @Description
      * @Return com.sky.ioc.tool.ReturnMsg
      * @Author LunCe
@@ -47,10 +52,10 @@ public class SpaceServiceImpl implements SpaceService {
     @Override
     public ReturnMsg getBuildingSituation() {
         JSONObject jsonObject = new JSONObject();
-        jsonObject.put("builtArea",112893);
-        jsonObject.put("layersInt",21);
-        jsonObject.put("serviceLife",60);
-        jsonObject.put("constructionPeriod",80);
+        jsonObject.put("builtArea", 112893);
+        jsonObject.put("layersInt", 21);
+        jsonObject.put("serviceLife", 60);
+        jsonObject.put("constructionPeriod", 80);
         return ReturnMsg.ok(jsonObject);
     }
 
@@ -59,24 +64,24 @@ public class SpaceServiceImpl implements SpaceService {
         Indeicator indeicator = new Indeicator();
         List<JSONObject> objects = indeicator.getList();
         BuildingSpace buildingSpace = buildingSpaceMapper.getByTier(iocParam);
-        if(buildingSpace!=null){
-            objects.get(0).put("value",buildingSpace.getUsedStation());
-            objects.get(1).put("value",buildingSpace.getStationCount());
-            objects.get(2).put("value",buildingSpace.getWorkArea());
-            objects.get(3).put("value",buildingSpace.getMeetingArea());
+        if (buildingSpace != null) {
+            objects.get(0).put("value", buildingSpace.getUsedStation());
+            objects.get(1).put("value", buildingSpace.getStationCount());
+            objects.get(2).put("value", buildingSpace.getWorkArea());
+            objects.get(3).put("value", buildingSpace.getMeetingArea());
             objects.add(new JSONObject());
             objects.add(new JSONObject());
-            objects.get(4).put("value",buildingSpace.getLeadArea());
-            objects.get(5).put("value",buildingSpace.getOtherArea());
-        }else {
-            objects.get(0).put("value",0);
-            objects.get(1).put("value",0);
-            objects.get(2).put("value",0);
-            objects.get(3).put("value",0);
+            objects.get(4).put("value", buildingSpace.getLeadArea());
+            objects.get(5).put("value", buildingSpace.getOtherArea());
+        } else {
+            objects.get(0).put("value", 0);
+            objects.get(1).put("value", 0);
+            objects.get(2).put("value", 0);
+            objects.get(3).put("value", 0);
             objects.add(new JSONObject());
             objects.add(new JSONObject());
-            objects.get(4).put("value",0);
-            objects.get(5).put("value",0);
+            objects.get(4).put("value", 0);
+            objects.get(5).put("value", 0);
         }
 
         indeicator.setList(objects);
@@ -91,8 +96,18 @@ public class SpaceServiceImpl implements SpaceService {
 
     @Override
     public ReturnMsg getFloorList(IocParam iocParam) {
-
-        return null;
+        List<BuildingSpace> list = buildingSpaceMapper.getListByTier(iocParam);
+        List<Map<String, String>> lists = new ArrayList<>();
+        for (BuildingSpace buildingSpace:list) {
+                Map<String, String> map = new HashMap();
+                map.put("floor",buildingSpace.getTier()+"");
+                map.put("leader",buildingSpace.getLeadArea()+"");
+                map.put("meeting",buildingSpace.getMeetingArea()+"");
+                map.put("work",buildingSpace.getWorkArea()+"");
+                map.put("print",buildingSpace.getPrintArea()+"");
+                lists.add(map);
+        }
+        return ReturnMsg.ok(lists);
     }
 
     @Override
@@ -118,17 +133,17 @@ public class SpaceServiceImpl implements SpaceService {
 
         objects.get(3).put("value",personDayPrice);
         objects.get(3).put("compare",compare);*/
-        objects.get(0).put("value",95);
-        objects.get(0).put("compare",0.4);
+        objects.get(0).put("value", 95);
+        objects.get(0).put("compare", 0.4);
 
-        objects.get(1).put("value",80);
-        objects.get(1).put("compare",0.4);
+        objects.get(1).put("value", 80);
+        objects.get(1).put("compare", 0.4);
 
-        objects.get(2).put("value",80);
-        objects.get(2).put("compare",0.4);
+        objects.get(2).put("value", 80);
+        objects.get(2).put("compare", 0.4);
 
-        objects.get(3).put("value",8);
-        objects.get(3).put("compare",0.4);
+        objects.get(3).put("value", 8);
+        objects.get(3).put("compare", 0.4);
         indeicator.setWorthAttention("增加会议室");
         indeicator.setList(objects);
         return ReturnMsg.ok(indeicator);
@@ -142,16 +157,16 @@ public class SpaceServiceImpl implements SpaceService {
 
     @Override
     public ReturnMsg getMeetingCostTrend(IocParam iocParam) {
-        String[] param = {"shichang","bangong","chanpin","zhihui","yewu","qita"};
-        String[] labKey = {"1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"};
+        String[] param = {"shichang", "bangong", "chanpin", "zhihui", "yewu", "qita"};
+        String[] labKey = {"1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"};
         List<Label> labels1 = GeneralMethod.getInstance().dataGeneration(param, labKey);
         return ReturnMsg.ok(labels1);
     }
 
     @Override
     public ReturnMsg getSpaceInfo(IocParam iocParam) {
-        String[] param = {"administrativeArea","leisureArea"};
-        String[] labKey = {"1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"};
+        String[] param = {"administrativeArea", "leisureArea"};
+        String[] labKey = {"1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"};
         List<Label> labels1 = GeneralMethod.getInstance().dataGeneration(param, labKey);
         return ReturnMsg.ok(labels1);
     }
@@ -168,26 +183,26 @@ public class SpaceServiceImpl implements SpaceService {
         int fixedCount = random.nextInt(300, 1000);
         int playCount = random.nextInt(100, 500);
         int workCount = random.nextInt(300, 1000);
-        while (playCount>workCount){
+        while (playCount > workCount) {
             playCount = random.nextInt(100, 500);
         }
         float compare = (float) Math.random();
         compare = Float.parseFloat(decimalFormat.format(compare));
 
-        objects.get(0).put("value",siteUsed);
-        objects.get(0).put("compare",compare);
+        objects.get(0).put("value", siteUsed);
+        objects.get(0).put("compare", compare);
 
-        objects.get(1).put("value",meettingUsed);
-        objects.get(1).put("compare",compare);
+        objects.get(1).put("value", meettingUsed);
+        objects.get(1).put("compare", compare);
 
-        objects.get(2).put("value",flowCount);
-        objects.get(2).put("compare",compare);
+        objects.get(2).put("value", flowCount);
+        objects.get(2).put("compare", compare);
 
-        objects.get(3).put("value",fixedCount);
-        objects.get(3).put("compare",compare);
+        objects.get(3).put("value", fixedCount);
+        objects.get(3).put("compare", compare);
         objects.add(new JSONObject());
-        objects.get(4).put("value",playCount+"/"+workCount);
-        objects.get(4).put("compare",compare);
+        objects.get(4).put("value", playCount + "/" + workCount);
+        objects.get(4).put("compare", compare);
 
         indeicator.setWorthAttention("会议室使用率过低,建议出租");
         indeicator.setList(objects);
@@ -198,26 +213,26 @@ public class SpaceServiceImpl implements SpaceService {
     public ReturnMsg getSpaceOverview() {
         JSONArray jsonArray = new JSONArray();
         JSONObject jsonObject = new JSONObject();
-        jsonObject.put("total",2000);
-        jsonObject.put("occupancy",1800);
-        jsonObject.put("percentage",0.75);
+        jsonObject.put("total", 2000);
+        jsonObject.put("occupancy", 1800);
+        jsonObject.put("percentage", 0.75);
 
         JSONObject jsonObject2 = new JSONObject();
-        jsonObject2.put("total",2000);
-        jsonObject2.put("occupancy",1800);
-        jsonObject2.put("percentage",0.97);
+        jsonObject2.put("total", 2000);
+        jsonObject2.put("occupancy", 1800);
+        jsonObject2.put("percentage", 0.97);
 
         JSONObject jsonObject3 = new JSONObject();
-        jsonObject3.put("total",2000);
-        jsonObject3.put("occupancy",1800);
-        jsonObject3.put("percentage",0.93);
+        jsonObject3.put("total", 2000);
+        jsonObject3.put("occupancy", 1800);
+        jsonObject3.put("percentage", 0.93);
         jsonArray.add(jsonObject);
         jsonArray.add(jsonObject2);
         jsonArray.add(jsonObject3);
 
 
         JSONObject jsonObject1 = new JSONObject();
-        jsonObject1.put("data",jsonArray);
+        jsonObject1.put("data", jsonArray);
         return ReturnMsg.ok(jsonObject1);
     }
 }