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

Merge remote-tracking branch 'origin/master'

tianyabing 2 роки тому
батько
коміт
ae37c9f439
30 змінених файлів з 951 додано та 296 видалено
  1. 6 4
      src/main/java/com/sky/ioc/controller/dashboard/DiningRoomController.java
  2. 3 1
      src/main/java/com/sky/ioc/controller/life/RestaurantController.java
  3. 1 4
      src/main/java/com/sky/ioc/controller/work/FloorController.java
  4. 1 1
      src/main/java/com/sky/ioc/entity/Cake.java
  5. 2 2
      src/main/java/com/sky/ioc/entity/domain/canteen/Cuisine.java
  6. 22 0
      src/main/java/com/sky/ioc/entity/domain/canteen/FoodMenu.java
  7. 4 0
      src/main/java/com/sky/ioc/entity/domain/canteen/Order.java
  8. 1 1
      src/main/java/com/sky/ioc/entity/domain/print/Print.java
  9. 1 1
      src/main/java/com/sky/ioc/entity/domain/space/AccessSpace.java
  10. 5 3
      src/main/java/com/sky/ioc/entity/domain/space/BuildingSpace.java
  11. 5 0
      src/main/java/com/sky/ioc/entity/params/IocParam.java
  12. 18 1
      src/main/java/com/sky/ioc/mapper/AccessSpaceMapper.java
  13. 20 7
      src/main/java/com/sky/ioc/mapper/BuildingSpaceMapper.java
  14. 51 0
      src/main/java/com/sky/ioc/mapper/BusMapper.java
  15. 0 31
      src/main/java/com/sky/ioc/mapper/CuisineMapper.java
  16. 82 0
      src/main/java/com/sky/ioc/mapper/CuisineOrderMapper.java
  17. 4 1
      src/main/java/com/sky/ioc/mapper/FitnesMapper.java
  18. 24 0
      src/main/java/com/sky/ioc/mapper/FoodMenusMapper.java
  19. 51 0
      src/main/java/com/sky/ioc/mapper/MeetingMapper.java
  20. 60 0
      src/main/java/com/sky/ioc/mapper/PrintMapper.java
  21. 8 3
      src/main/java/com/sky/ioc/mapper/SupermarketOrderMapper.java
  22. 6 3
      src/main/java/com/sky/ioc/service/canteen/RestaurantService.java
  23. 252 62
      src/main/java/com/sky/ioc/service/canteen/impl/RestaurantServiceImpl.java
  24. 158 52
      src/main/java/com/sky/ioc/service/carbon/impl/CarbonServiceImpl.java
  25. 38 12
      src/main/java/com/sky/ioc/service/fitness/impl/HealthServiceImpl.java
  26. 18 10
      src/main/java/com/sky/ioc/service/personnel/impl/PersonnelServiceImpl.java
  27. 1 0
      src/main/java/com/sky/ioc/service/space/SpaceService.java
  28. 105 94
      src/main/java/com/sky/ioc/service/space/impl/SpaceServiceImpl.java
  29. 2 1
      src/main/java/com/sky/ioc/service/supermarket/impl/SupermarketServiceImpl.java
  30. 2 2
      src/main/java/com/sky/ioc/tool/FalseData.java

+ 6 - 4
src/main/java/com/sky/ioc/controller/dashboard/DiningRoomController.java

@@ -1,5 +1,6 @@
 package com.sky.ioc.controller.dashboard;
 
+import com.sky.ioc.entity.params.IocParam;
 import com.sky.ioc.service.canteen.RestaurantService;
 import com.sky.ioc.tool.ReturnMsg;
 import io.swagger.annotations.Api;
@@ -7,6 +8,7 @@ import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
@@ -28,16 +30,16 @@ public class DiningRoomController {
 
     @ApiOperation("查询智能看板统计画像的餐厅消费态势的核心指标")
     @PostMapping("getRestaurantConsumption")
-    public ReturnMsg getRestaurantConsumption(){
-        return restaurantService.getRestaurantConsumption();
+    public ReturnMsg getRestaurantConsumption(@RequestBody IocParam iocParam){
+        return restaurantService.getRestaurantConsumption(iocParam);
     }
 
 
 
     @ApiOperation("查询智能看板统计画像的餐厅统计消费信息报表")
     @PostMapping("getRestaurantConsumptionChart")
-    public ReturnMsg  getPersonnelInfoList(){
-        return restaurantService.getRestaurantConsumptionChart();
+    public ReturnMsg  getPersonnelInfoList(@RequestBody IocParam iocParam){
+        return restaurantService.getRestaurantConsumptionChart(iocParam);
     }
 
 

+ 3 - 1
src/main/java/com/sky/ioc/controller/life/RestaurantController.java

@@ -12,6 +12,8 @@ import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.text.ParseException;
+
 /**
  * @author LunCe
  * 智慧餐厅
@@ -57,7 +59,7 @@ public class RestaurantController {
 
     @ApiOperation("查询智慧生活中智慧餐厅的盈利分析")
     @PostMapping("getProfitAnalysis")
-    public ReturnMsg  getProfitAnalysis(@RequestBody IocParam iocParam){
+    public ReturnMsg  getProfitAnalysis(@RequestBody IocParam iocParam) throws ParseException {
         return restaurantService.getProfitAnalysis(iocParam);
     }
 

+ 1 - 4
src/main/java/com/sky/ioc/controller/work/FloorController.java

@@ -7,10 +7,7 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 /**
  * TODO

+ 1 - 1
src/main/java/com/sky/ioc/entity/Cake.java

@@ -14,7 +14,7 @@ import java.util.concurrent.ThreadLocalRandom;
 public class Cake {
 
     private String name;
-    private int value;
+    private double value;
 
 
     public Cake(){}

+ 2 - 2
src/main/java/com/sky/ioc/entity/domain/canteen/Cuisine.java

@@ -31,7 +31,7 @@ public class Cuisine {
     private String Price;
 
 
-    public Cuisine(String name){
+/*    public Cuisine(String name){
         ThreadLocalRandom current = ThreadLocalRandom.current();
         cuisineImg = "https://img.zcool.cn/community/018aeb5dc37c46a801209e1fb5e4d6.jpg@1280w_1l_2o_100sh.jpg";
         cuisineType = current.nextInt(0,3);
@@ -41,7 +41,7 @@ public class Cuisine {
         jsonObject.put("小",8);
         Price = jsonObject+"";
         cuisineName = name;
-    }
+    }*/
 
 
 

+ 22 - 0
src/main/java/com/sky/ioc/entity/domain/canteen/FoodMenu.java

@@ -0,0 +1,22 @@
+package com.sky.ioc.entity.domain.canteen;
+
+import lombok.Data;
+
+@Data
+public class FoodMenu {
+
+    private String cuisineName;
+    private String cuisineImg;
+    /*
+     *  菜品类型  早餐,中餐,晚餐
+     */
+    private Integer cuisineType;
+    /*
+     *  菜品类型  热菜,凉菜,主食,汤
+     */
+    private String cuisineTypeTwo;
+    /*
+     *  价格
+     */
+    private String price;
+}

+ 4 - 0
src/main/java/com/sky/ioc/entity/domain/canteen/Order.java

@@ -43,6 +43,10 @@ public class Order {
 
     /**
      * 支付类型  1.人脸,扫码,刷卡,线下
+     * 刷卡 1
+     * 扫码 16
+     * 线下 19
+     * 人脸 4
      */
     private Integer  payType;
 

+ 1 - 1
src/main/java/com/sky/ioc/entity/domain/print/Print.java

@@ -21,7 +21,7 @@ public class Print {
     private Double inkbox;
 
     /**楼层*/
-    private Integer flootId;
+    private Integer floorId;
 
     /**成本*/
     private Double cost;

+ 1 - 1
src/main/java/com/sky/ioc/entity/domain/space/AccessSpace.java

@@ -22,7 +22,7 @@ public class AccessSpace {
     /**单位名称*/
     private String company;
     /**楼层*/
-    private String tier;
+    private Integer tier;
     /**部门Id*/
     private String departmentId;
     /**部门名称*/

+ 5 - 3
src/main/java/com/sky/ioc/entity/domain/space/BuildingSpace.java

@@ -20,14 +20,16 @@ public class BuildingSpace {
     /**会议室面积*/
     private Double meetingArea;
     /**工作区面积*/
-    private Double wordArea;
+    private Double workArea;
     /**打印区面积*/
     private Double printArea;
     /**其他区域面积*/
-    private Double restArea;
+    private Double otherArea;
+    /**工位使用*/
+    private Integer usedStation;
 
     /**楼层*/
-    private Integer tier;
+    private Integer  tier;
 
     /**工位总数*/
     private Integer stationCount;

+ 5 - 0
src/main/java/com/sky/ioc/entity/params/IocParam.java

@@ -22,6 +22,11 @@ public class IocParam {
      * 楼层ID
      */
     private Integer floorId;
+
+    /**
+     * 分页数
+     */
+    private Integer limit =5;
     /**
      * 日期范围
      */

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

@@ -1,7 +1,24 @@
 package com.sky.ioc.mapper;
 
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.sky.ioc.entity.domain.space.AccessSpace;
+import com.sky.ioc.entity.domain.space.BuildingSpace;
+import com.sky.ioc.entity.params.IocParam;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+
+import java.util.List;
 
 @Mapper
-public interface AccessSpaceMapper {
+public interface AccessSpaceMapper extends BaseMapper<AccessSpace> {
+    @Select("<script>" +
+            "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} " +
+            "</if>"+
+            "</script>")
+    List<AccessSpace> getByTier(@Param("iocParam") IocParam iocParam);
+
 }

+ 20 - 7
src/main/java/com/sky/ioc/mapper/BuildingSpaceMapper.java

@@ -1,22 +1,35 @@
 package com.sky.ioc.mapper;
 
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.sky.ioc.entity.domain.space.BuildingSpace;
 import com.sky.ioc.entity.params.IocParam;
 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 {
+public interface BuildingSpaceMapper extends BaseMapper<BuildingSpace> {
 
     @Select("<script>" +
-            "SELECT * FROM fitnes where 1=1 " +
-            "<if test='iocParam!=null and iocParam.companyId != null '>" +
-            " and company_id=#{iocParam.companyId} " +
+            "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>"+
-            "<if test='iocParam!=null and iocParam.floorId != null '>" +
-            " and tier = #{iocParam.floorId} " +
+            " 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>")
-    BuildingSpace getByCompanyIdAndTier(@Param("iocParam") IocParam iocParam);
+    List<BuildingSpace> getListByTier(@Param("iocParam")IocParam iocParam);
 }

+ 51 - 0
src/main/java/com/sky/ioc/mapper/BusMapper.java

@@ -0,0 +1,51 @@
+package com.sky.ioc.mapper;
+
+import com.sky.ioc.entity.params.IocParam;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+
+@Mapper
+public interface BusMapper {
+
+    @Select("<script>" +
+            "SELECT  coalesce(avg(cost),0)  from bus where 1=1 " +
+            "<if test='iocParam!=null and iocParam.timeRange != null '>" +
+            "<![CDATA[ and time >= #{iocParam.timeRange.startDate} AND time <= #{iocParam.timeRange.endDate} ]]> " +
+            "</if>"+
+            "</script>")
+    Double getAvgCostByCompanyIdAndDeptId(@Param("iocParam") IocParam iocParam);
+
+    @Select("<script> " +
+            "SELECT count(DISTINCT name) FROM bus  where 1=1 " +
+            "<if test='iocParam!=null and iocParam.timeRange != null '>" +
+            "<![CDATA[ and time >= #{iocParam.timeRange.startDate} AND time <= #{iocParam.timeRange.endDate} ]]> " +
+            "</if>" +
+            "</script>")
+    Integer getTotalBusByCompanyIdAndDeptId(@Param("iocParam") IocParam iocParam);
+
+    @Select("<script> " +
+            "SELECT count(1) FROM bus  where 1=1 " +
+            "<if test='iocParam!=null and iocParam.timeRange != null '>" +
+            "<![CDATA[ and time >= #{iocParam.timeRange.startDate} AND time <= #{iocParam.timeRange.endDate} ]]> " +
+            "</if>" +
+            "</script>")
+    Integer getTotalByCompanyIdAndDeptId(@Param("iocParam") IocParam iocParam);
+
+    @Select("<script>" +
+            "SELECT  coalesce(sum(hours),0)  from bus where 1=1 " +
+            "<if test='iocParam!=null and iocParam.timeRange != null '>" +
+            "<![CDATA[ and time >= #{iocParam.timeRange.startDate} AND time <= #{iocParam.timeRange.endDate} ]]> " +
+            "</if>"+
+            "</script>")
+    Double getTotalHoursByCompanyIdAndDeptId(@Param("iocParam") IocParam iocParam);
+
+    @Select("<script>" +
+            "SELECT  coalesce(sum(carbon),0)  from bus where 1=1 " +
+            "<if test='iocParam!=null and iocParam.timeRange != null '>" +
+            "<![CDATA[ and time >= #{iocParam.timeRange.startDate} AND time <= #{iocParam.timeRange.endDate} ]]> " +
+            "</if>"+
+            "</script>")
+    Double getTotalCarbonByCompanyIdAndDeptId(@Param("iocParam") IocParam iocParam);
+
+}

+ 0 - 31
src/main/java/com/sky/ioc/mapper/CuisineMapper.java

@@ -8,36 +8,5 @@ import org.apache.ibatis.annotations.Select;
 @Mapper
 public interface CuisineMapper {
 
-    @Select("<script> " +
-            "SELECT count(DISTINCT user_id) FROM cuisine_order  where 1=1 " +
-            "<if test='iocParam!=null and iocParam.deptId != null '>" +
-            " and department_id=#{iocParam.deptId} " +
-            "</if>"+
-            "<if test='iocParam!=null and iocParam.timeRange != null '>" +
-            " and order_time BETWEEN #{iocParam.timeRange.startDate} AND #{iocParam.timeRange.endDate} " +
-            "</if>" +
-            "</script>")
-    Integer getTotalPersonByCompanyIdAndDeptId(@Param("iocParam") IocParam iocParam);
 
-    @Select("<script>" +
-            "SELECT sum(order_price) FROM cuisine_order where 1=1 " +
-            "<if test='iocParam!=null and iocParam.deptId != null '>" +
-            " and department_id=#{iocParam.deptId} " +
-            "</if>"+
-            "<if test='iocParam!=null and iocParam.timeRange != null '>" +
-            " and order_time BETWEEN #{iocParam.timeRange.startDate} AND #{iocParam.timeRange.endDate} " +
-            "</if>"+
-            "</script>")
-    Double getTotalPriceByCompanyIdAndDeptId(@Param("iocParam") IocParam iocParam);
-
-    @Select("<script>" +
-            "SELECT count(1) FROM cuisine_order where 1=1 " +
-            "<if test='iocParam!=null and iocParam.deptId != null '>" +
-            " and department_id=#{iocParam.deptId} " +
-            "</if>"+
-            "<if test='iocParam!=null and iocParam.timeRange != null '>" +
-            " and order_time BETWEEN #{iocParam.timeRange.startDate} AND #{iocParam.timeRange.endDate} " +
-            "</if>"+
-            "</script>")
-    Integer getTotalOrderByCompanyIdAndDeptId(@Param("iocParam") IocParam iocParam);
 }

+ 82 - 0
src/main/java/com/sky/ioc/mapper/CuisineOrderMapper.java

@@ -1,4 +1,86 @@
 package com.sky.ioc.mapper;
 
+import com.sky.ioc.entity.domain.canteen.Order;
+import com.sky.ioc.entity.params.IocParam;
+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 CuisineOrderMapper {
+    @Select("<script> " +
+            "SELECT count(DISTINCT user_id) FROM cuisine_order  where 1=1 " +
+            "<if test='iocParam!=null and iocParam.deptId != null '>" +
+            " and department_id=#{iocParam.deptId} " +
+            "</if>"+
+            "<if test='iocParam!=null and iocParam.timeRange != null '>" +
+            " and order_time BETWEEN #{iocParam.timeRange.startDate} AND #{iocParam.timeRange.endDate} " +
+            "</if>" +
+            "</script>")
+    Integer getTotalPersonByCompanyIdAndDeptId(@Param("iocParam") IocParam iocParam);
+
+    @Select("<script>" +
+            "SELECT sum(order_price) FROM cuisine_order where 1=1 " +
+            "<if test='iocParam!=null and iocParam.deptId != null '>" +
+            " and department_id=#{iocParam.deptId} " +
+            "</if>"+
+            "<if test='iocParam!=null and iocParam.timeRange != null '>" +
+            " and order_time BETWEEN #{iocParam.timeRange.startDate} AND #{iocParam.timeRange.endDate} " +
+            "</if>"+
+            "<if test='payType!=null '>" +
+            " and paytype=#{payType} " +
+            "</if>"+
+            "</script>")
+    Double getTotalPriceByCompanyIdAndDeptId(@Param("iocParam") IocParam iocParam,@Param("payType")Integer payType);
+
+    @Select("<script>" +
+            "SELECT avg(order_price) FROM cuisine_order where 1=1 " +
+            "<if test='iocParam!=null and iocParam.deptId != null '>" +
+            " and department_id=#{iocParam.deptId} " +
+            "</if>"+
+            "<if test='iocParam!=null and iocParam.timeRange != null '>" +
+            " and order_time BETWEEN #{iocParam.timeRange.startDate} AND #{iocParam.timeRange.endDate} " +
+            "</if>"+
+            "</script>")
+    Double getAvgPriceByCompanyIdAndDeptId(@Param("iocParam") IocParam iocParam);
+
+    @Select("<script>" +
+            "SELECT count(1) FROM cuisine_order where 1=1 " +
+            "<if test='iocParam!=null and iocParam.deptId != null '>" +
+            " and department_id=#{iocParam.deptId} " +
+            "</if>"+
+            "<if test='iocParam!=null and iocParam.timeRange != null '>" +
+            " and order_time BETWEEN #{iocParam.timeRange.startDate} AND #{iocParam.timeRange.endDate} " +
+            "</if>"+
+            "</script>")
+    Integer getTotalOrderByCompanyIdAndDeptId(@Param("iocParam") IocParam iocParam);
+
+    @Select("<script>" +
+            "SELECT count(item.p_name) as total,item.p_name,item.p_id,c.price,c.cuisine_img from cuisine_order a " +
+            "LEFT JOIN cuisine_order_item  item on a.order_id = item.order_num " +
+            "LEFT JOIN cuisine c on c.id= item.p_id where 1=1" +
+            "<if test='iocParam!=null and iocParam.deptId != null '>" +
+            " and a.department_id=#{iocParam.deptId} " +
+            "</if>"+
+            "<if test='iocParam!=null and iocParam.timeRange != null '>" +
+            " and a.order_time BETWEEN #{iocParam.timeRange.startDate} AND #{iocParam.timeRange.endDate} " +
+            "</if>"+
+            " GROUP BY item.p_name, item.p_id,c.price,c.cuisine_img ORDER BY total desc limit #{iocParam.limit} " +
+            "</script>")
+    List<Map<String,String>> getTopListByCompanyIdAndDeptId(@Param("iocParam") IocParam iocParam);
+
+    @Select("<script>" +
+            "SELECT order_price as orderPrice,order_time as orderTime,paytype as payType from cuisine_order a where 1=1" +
+            "<if test='iocParam!=null and iocParam.deptId != null '>" +
+            " and a.department_id=#{iocParam.deptId} " +
+            "</if>"+
+            "<if test='iocParam!=null and iocParam.timeRange != null '>" +
+            "<![CDATA[ and a.order_time >= #{iocParam.timeRange.startDate} AND a.order_time <= #{iocParam.timeRange.endDate} ]]> " +
+            "</if>"+
+            "</script>")
+    List<Order> getListByCompanyIdAndDeptId(@Param("iocParam") IocParam iocParam);
+
 }

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

@@ -14,11 +14,14 @@ public interface FitnesMapper {
             "<if test='iocParam!=null and iocParam.companyId != null '>" +
             " and company_id=#{iocParam.companyId} " +
             "</if>"+
+            "<if test='warehouse!=null '>" +
+            " and warehouse = #{warehouse} " +
+            "</if>"+
             "<if test='iocParam!=null and iocParam.timeRange != null '>" +
             " and time BETWEEN #{iocParam.timeRange.startDate} AND #{iocParam.timeRange.endDate} " +
             "</if>"+
             "</script>")
-    Integer getTotalPersonByCompanyIdAndDeptId(@Param("iocParam") IocParam iocParam);
+    Integer getTotalPersonByCompanyIdAndDeptId(@Param("iocParam") IocParam iocParam,@Param("warehouse") Integer warehouse);
 
     @Select("<script>" +
             "SELECT count(1) FROM fitnes where 1=1 " +

+ 24 - 0
src/main/java/com/sky/ioc/mapper/FoodMenusMapper.java

@@ -0,0 +1,24 @@
+package com.sky.ioc.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.sky.ioc.entity.domain.canteen.FoodMenu;
+import com.sky.ioc.entity.domain.canteen.Order;
+import com.sky.ioc.entity.domain.system.Users;
+import com.sky.ioc.entity.params.IocParam;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+
+import java.util.List;
+
+@Mapper
+public interface FoodMenusMapper extends BaseMapper<FoodMenu> {
+
+    @Select("<script>" +
+            "SELECT name as cuisineName,price,time_type as cuisineType,type as cuisineTypeTwo from food_menus a where 1=1" +
+            "<if test='type!=null '>" +
+            " and time_type= #{type} " +
+            "</if>"+
+            "</script>")
+    List<FoodMenu> getListByType(@Param("type") Integer type);
+}

+ 51 - 0
src/main/java/com/sky/ioc/mapper/MeetingMapper.java

@@ -0,0 +1,51 @@
+package com.sky.ioc.mapper;
+
+import com.sky.ioc.entity.domain.canteen.Order;
+import com.sky.ioc.entity.domain.space.BuildingSpace;
+import com.sky.ioc.entity.params.IocParam;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+
+import java.util.List;
+
+@Mapper
+public interface MeetingMapper {
+
+    @Select("<script>" +
+            "SELECT coalesce(avg(used),0)  " +
+            "FROM meeting where 1=1 " +
+            "<if test='iocParam!=null and iocParam.floorId != null  '>" +
+            " and floor_id=#{iocParam.floorId} " +
+            "</if>"+
+            "</script>")
+    Double getUsedByFloorId(@Param("iocParam")IocParam iocParam);
+
+    @Select("<script>" +
+            "SELECT coalesce(avg(saturation),0) " +
+            "FROM meeting where 1=1 " +
+            "<if test='iocParam!=null and iocParam.floorId != null  '>" +
+            " and floor_id=#{iocParam.floorId} " +
+            "</if>"+
+            "</script>")
+    Double getSaturationByFloorId(@Param("iocParam")IocParam iocParam);
+
+    @Select("<script>" +
+            "SELECT  coalesce(sum(cost),0) " +
+            "FROM meeting where 1=1 " +
+            "<if test='iocParam!=null and iocParam.floorId != null  '>" +
+            " and floor_id=#{iocParam.floorId} " +
+            "</if>"+
+            "</script>")
+    Double getCostByFloorId(@Param("iocParam")IocParam iocParam);
+
+    @Select("<script>" +
+            "SELECT  coalesce(sum(person_cost),0)  " +
+            "FROM meeting where 1=1 " +
+            "<if test='iocParam!=null and iocParam.floorId != null  '>" +
+            " and floor_id=#{iocParam.floorId} " +
+            "</if>"+
+            "</script>")
+    Double getPersonCostByFloorId(@Param("iocParam")IocParam iocParam);
+
+}

+ 60 - 0
src/main/java/com/sky/ioc/mapper/PrintMapper.java

@@ -0,0 +1,60 @@
+package com.sky.ioc.mapper;
+
+import com.sky.ioc.entity.params.IocParam;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+
+@Mapper
+public interface PrintMapper {
+
+    @Select("<script>" +
+            "SELECT coalesce(avg(cost),0)  from print where 1=1 " +
+            "<if test='iocParam!=null and iocParam.timeRange != null '>" +
+            "<![CDATA[ and print_time >= #{iocParam.timeRange.startDate} AND print_time <= #{iocParam.timeRange.endDate} ]]> " +
+            "</if>"+
+            "</script>")
+    Double getAvgCost(@Param("iocParam") IocParam iocParam);
+
+    @Select("<script>" +
+            "SELECT coalesce(avg(paper),0)  from print where 1=1 " +
+            "<if test='iocParam!=null and iocParam.timeRange != null '>" +
+            "<![CDATA[ and print_time >= #{iocParam.timeRange.startDate} AND print_time <= #{iocParam.timeRange.endDate} ]]> " +
+            "</if>"+
+            "</script>")
+    Double getAvgPaper(@Param("iocParam") IocParam iocParam);
+
+    @Select("<script>" +
+            "SELECT coalesce(avg(carbon),0)  from print where 1=1 " +
+            "<if test='iocParam!=null and iocParam.timeRange != null '>" +
+            "<![CDATA[ and print_time >= #{iocParam.timeRange.startDate} AND print_time <= #{iocParam.timeRange.endDate} ]]> " +
+            "</if>"+
+            "</script>")
+    Double getAvgCarbon(@Param("iocParam") IocParam iocParam);
+
+    @Select("<script> " +
+            "SELECT count(1) FROM print  where 1=1 " +
+            "<if test='iocParam!=null and iocParam.timeRange != null '>" +
+            "<![CDATA[ and print_time >= #{iocParam.timeRange.startDate} AND print_time <= #{iocParam.timeRange.endDate} ]]> " +
+            "</if>" +
+            "</script>")
+    Integer getTotal(@Param("iocParam") IocParam iocParam);
+
+    @Select("<script> " +
+            "SELECT coalesce(sum(paper),0) FROM print  where 1=1 " +
+            "<if test='iocParam!=null and iocParam.timeRange != null '>" +
+            "<![CDATA[ and print_time >= #{iocParam.timeRange.startDate} AND print_time <= #{iocParam.timeRange.endDate} ]]> " +
+            "</if>" +
+            "</script>")
+    Integer getTotalPaper(@Param("iocParam") IocParam iocParam);
+
+    @Select("<script>" +
+            "SELECT coalesce(sum(inkbox),0)  from print where 1=1 " +
+            "<if test='iocParam!=null and iocParam.timeRange != null '>" +
+            "<![CDATA[ and print_time >= #{iocParam.timeRange.startDate} AND print_time <= #{iocParam.timeRange.endDate} ]]> " +
+            "</if>"+
+            "</script>")
+    Double getTotalInkbox(@Param("iocParam") IocParam iocParam);
+
+
+}

+ 8 - 3
src/main/java/com/sky/ioc/mapper/SupermarketOrderMapper.java

@@ -73,8 +73,13 @@ public interface SupermarketOrderMapper extends BaseMapper<SupermarketOrder> {
             "</script>")
     Integer getTotalPersonByCompanyIdAndDeptId(@Param("iocParam") IocParam iocParam);
 
-    @Select("SELECT sum(order_price) FROM supermarket_order " +
-            "WHERE order_type='微信' ")
-    Double getThirdTotalPriceByCompanyIdAndDeptId();
+    @Select("<script> " +
+            "SELECT sum(order_price) FROM supermarket_order " +
+            "WHERE order_type='微信' " +
+            "<if test='iocParam!=null and iocParam.timeRange != null '>" +
+            " and order_time BETWEEN #{iocParam.timeRange.startDate} AND #{iocParam.timeRange.endDate} " +
+            "</if>" +
+            " </script>")
+    Double getThirdTotalPriceByCompanyIdAndDeptId(@Param("iocParam") IocParam iocParam);
 
 }

+ 6 - 3
src/main/java/com/sky/ioc/service/canteen/RestaurantService.java

@@ -2,6 +2,9 @@ package com.sky.ioc.service.canteen;
 
 import com.sky.ioc.entity.params.IocParam;
 import com.sky.ioc.tool.ReturnMsg;
+import org.springframework.web.bind.annotation.RequestBody;
+
+import java.text.ParseException;
 
 /**
  * TODO
@@ -20,11 +23,11 @@ public interface RestaurantService {
 
     ReturnMsg getTodayMenu();
 
-    ReturnMsg getProfitAnalysis(IocParam iocParam);
+    ReturnMsg getProfitAnalysis(IocParam iocParam) throws ParseException;
 
     ReturnMsg getMealAnalysis(IocParam iocParam);
 
-    ReturnMsg getRestaurantConsumption();
+    ReturnMsg getRestaurantConsumption(IocParam iocParam);
 
-    ReturnMsg getRestaurantConsumptionChart();
+    ReturnMsg getRestaurantConsumptionChart(IocParam iocParam);
 }

+ 252 - 62
src/main/java/com/sky/ioc/service/canteen/impl/RestaurantServiceImpl.java

@@ -1,21 +1,36 @@
 package com.sky.ioc.service.canteen.impl;
 
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.sky.ioc.entity.Indeicator;
 import com.sky.ioc.entity.Label;
 import com.sky.ioc.entity.Cake;
+import com.sky.ioc.entity.domain.canteen.Cuisine;
+import com.sky.ioc.entity.domain.canteen.FoodMenu;
+import com.sky.ioc.entity.domain.canteen.Order;
+import com.sky.ioc.entity.domain.system.Users;
 import com.sky.ioc.entity.params.IocParam;
+import com.sky.ioc.entity.params.IocTimeRange;
+import com.sky.ioc.mapper.CuisineMapper;
+import com.sky.ioc.mapper.CuisineOrderMapper;
+import com.sky.ioc.mapper.FoodMenusMapper;
 import com.sky.ioc.service.canteen.RestaurantService;
+import com.sky.ioc.tool.DateUtil;
 import com.sky.ioc.tool.FalseData;
 import com.sky.ioc.tool.GeneralMethod;
 import com.sky.ioc.tool.ReturnMsg;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.text.DecimalFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.List;
+import java.util.Map;
 import java.util.concurrent.ThreadLocalRandom;
 
 
@@ -25,6 +40,12 @@ import java.util.concurrent.ThreadLocalRandom;
 @Service
 public class RestaurantServiceImpl implements RestaurantService {
 
+    @Autowired
+    CuisineOrderMapper cuisineOrderMapper;
+
+    @Autowired
+    FoodMenusMapper foodMenusMapper;
+
 
     /**
      * TODO  查询智慧生活中智慧餐厅的支付分析
@@ -37,12 +58,32 @@ public class RestaurantServiceImpl implements RestaurantService {
      */
     @Override
     public ReturnMsg getPaymentAnalysis(IocParam iocParam) {
-        List<Cake> list = new ArrayList<>();
-        list.add(new Cake("Offline"));
-        list.add(new Cake("scanningCode"));
-        list.add(new Cake("payCard"));
-        list.add(new Cake("Face"));
-        return ReturnMsg.ok(list);
+        List<Cake> lists = new ArrayList<>();
+        Double offline = cuisineOrderMapper.getTotalPriceByCompanyIdAndDeptId(iocParam,19);
+        Double scanningCode =cuisineOrderMapper.getTotalPriceByCompanyIdAndDeptId(iocParam,16);
+        Double payCard =cuisineOrderMapper.getTotalPriceByCompanyIdAndDeptId(iocParam,1);
+        Double face = cuisineOrderMapper.getTotalPriceByCompanyIdAndDeptId(iocParam,4);
+        offline = offline==null?0:offline;
+        scanningCode = scanningCode==null?0:scanningCode;
+        payCard = payCard==null?0:payCard;
+        face = face==null?0:face;
+        Cake cake1 = new Cake();
+        Cake cake2 = new Cake();
+        Cake cake3 = new Cake();
+        Cake cake4 = new Cake();
+        cake1.setName("线下");
+        cake2.setName("扫码");
+        cake3.setName("人脸");
+        cake4.setName("刷卡");
+        cake4.setValue(payCard);
+        cake3.setValue(face);
+        cake2.setValue(scanningCode);
+        cake1.setValue(offline);
+        lists.add(cake3);
+        lists.add(cake1);
+        lists.add(cake2);
+        lists.add(cake4);
+        return ReturnMsg.ok(lists);
     }
 
 
@@ -53,40 +94,38 @@ public class RestaurantServiceImpl implements RestaurantService {
     public ReturnMsg getCoreIndicators(IocParam iocParam) {
         Indeicator indeicator = new Indeicator();
         List<JSONObject> objects = indeicator.getList();
-       /* ThreadLocalRandom random = ThreadLocalRandom.current();
-        int totalPerson = random.nextInt(100, 3000);
-        int dayPerson = random.nextInt(150,500);
-        while (dayPerson>totalPerson){
-            dayPerson  = random.nextInt(150,500);
+        ThreadLocalRandom random = ThreadLocalRandom.current();
+        Double totalPrice = cuisineOrderMapper.getTotalPriceByCompanyIdAndDeptId(iocParam,null);
+        totalPrice = totalPrice == null ? 0 : totalPrice;
+        BigDecimal bigDecimal = new BigDecimal(totalPrice);
+        Integer totalOrder = cuisineOrderMapper.getTotalOrderByCompanyIdAndDeptId(iocParam);
+        Integer totalPerson = cuisineOrderMapper.getTotalPersonByCompanyIdAndDeptId(iocParam);
+        int dayPerson = random.nextInt(0,totalPerson);
+        double avgPrice = 0d;
+        if (totalPrice > 0) {
+            if (totalOrder > 0) {
+                BigDecimal avgPriceDec = bigDecimal.divide(new BigDecimal(totalOrder), 2, RoundingMode.HALF_UP);
+                avgPrice = avgPriceDec.doubleValue();
+            }
         }
-        int price = random.nextInt(15,50);
-        int totalPrice = price*totalPerson;
-        float compare = (float) Math.random();
+        // 转换为万元(除以10000)保留两位小数
+        BigDecimal decimal = bigDecimal.divide(new BigDecimal("10000"), 2, RoundingMode.HALF_UP);
+        totalPrice = decimal.doubleValue();
+        double compare = random.nextDouble(-1, 1);
         DecimalFormat decimalFormat = new DecimalFormat("#.0");
-        compare = Float.parseFloat(decimalFormat.format(compare));
+        compare = Double.parseDouble(decimalFormat.format(compare));
+
         objects.get(0).put("value",dayPerson);
         objects.get(0).put("compare",compare);
 
-        objects.get(1).put("value",totalPerson);
+        objects.get(1).put("value",totalOrder);
         objects.get(1).put("compare",compare);
 
         objects.get(2).put("value",totalPrice);
-        objects.get(2).put("compare",-compare);
-
-        objects.get(3).put("value",price);
-        objects.get(3).put("compare",compare);*/
+        objects.get(2).put("compare",compare);
 
-        objects.get(0).put("value",400);
-        objects.get(0).put("compare",0.4);
-
-        objects.get(1).put("value",2000);
-        objects.get(1).put("compare",0.4);
-
-        objects.get(2).put("value",18);
-        objects.get(2).put("compare",-0.4);
-
-        objects.get(3).put("value",18);
-        objects.get(3).put("compare",0.4);
+        objects.get(3).put("value",avgPrice);
+        objects.get(3).put("compare",compare);
         indeicator.setWorthAttention("员工偏爱川菜,建议增加");
         indeicator.setList(objects);
         return ReturnMsg.ok(indeicator);
@@ -97,7 +136,16 @@ public class RestaurantServiceImpl implements RestaurantService {
      */
     @Override
     public ReturnMsg getWelcomeDishes(IocParam iocParam) {
-        return ReturnMsg.ok(FalseData.CUISINELIST);
+        List<Cuisine> cuisineList = new ArrayList<>();
+        List<Map<String,String>> lists = cuisineOrderMapper.getTopListByCompanyIdAndDeptId(iocParam);
+        for (Map<String,String> map:lists){
+            Cuisine cuisine = new Cuisine();
+            cuisine.setCuisineImg(map.get("cuisine_img"));
+            cuisine.setCuisineName(map.get("p_name"));
+            cuisine.setPrice(map.get("price"));
+            cuisineList.add(cuisine);
+        }
+        return ReturnMsg.ok(cuisineList);
     }
 
 
@@ -108,8 +156,54 @@ public class RestaurantServiceImpl implements RestaurantService {
     @Override
     public ReturnMsg getConsumptionAnalysis(IocParam iocParam) {
         String[] param = {"breakfast","lunch","dinner","breakfastPrice","lunchPrice","dinnerPrice"};
-        String[] labKey = {"1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"};
-        List<Label> labels1 = GeneralMethod.getInstance().dataGeneration(param, labKey);
+       // String[] labKey = {"1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"};
+        //List<Label> labels1 = GeneralMethod.getInstance().dataGeneration(param, labKey);
+        String startStr = iocParam.getTimeRange().getStartDate();
+        String endStr = iocParam.getTimeRange().getEndDate();
+        List<String> list = DateUtil.getBetweenDays(startStr, endStr);
+        String[] labKey = list.toArray(new String[0]);
+        List<Label> labels1 = new ArrayList<>();
+        DecimalFormat decimalFormat = new DecimalFormat("#.0");
+        for (int i = 0; i < labKey.length; i++) {
+            Label label = new Label();
+            JSONObject jsonObject = new JSONObject();
+            IocParam iocParam1 = new IocParam();
+            IocTimeRange iocTimeRange = new IocTimeRange();
+            iocTimeRange.setStartDate(labKey[i]+" 00:00:00");
+            iocTimeRange.setEndDate(labKey[i]+" 10:00:00");
+            iocParam1.setTimeRange(iocTimeRange);
+
+            IocParam iocParam2 = new IocParam();
+            IocTimeRange iocTimeRange2 = new IocTimeRange();
+            iocTimeRange2.setStartDate(labKey[i]+" 10:00:00");
+            iocTimeRange2.setEndDate(labKey[i]+" 15:00:00");
+            iocParam2.setTimeRange(iocTimeRange2);
+
+            IocParam iocParam3 = new IocParam();
+            IocTimeRange iocTimeRange3 = new IocTimeRange();
+            iocTimeRange3.setStartDate(labKey[i]+" 15:00:00");
+            iocTimeRange3.setEndDate(labKey[i]+" 23:59:00");
+            iocParam3.setTimeRange(iocTimeRange3);
+
+            Integer totalBreakfastPerson = cuisineOrderMapper.getTotalPersonByCompanyIdAndDeptId(iocParam1);
+            Integer totalLunchPerson = cuisineOrderMapper.getTotalPersonByCompanyIdAndDeptId(iocParam2);
+            Integer totalDinnerPerson = cuisineOrderMapper.getTotalPersonByCompanyIdAndDeptId(iocParam3);
+            Double breakfastPrice = cuisineOrderMapper.getAvgPriceByCompanyIdAndDeptId(iocParam1);
+            Double lunchPrice = cuisineOrderMapper.getAvgPriceByCompanyIdAndDeptId(iocParam2);
+            Double dinnerPrice = cuisineOrderMapper.getAvgPriceByCompanyIdAndDeptId(iocParam3);
+            breakfastPrice = breakfastPrice==null?0:Double.valueOf(decimalFormat.format(breakfastPrice));
+            lunchPrice = lunchPrice==null?0:Double.valueOf(decimalFormat.format(lunchPrice));
+            dinnerPrice = dinnerPrice==null?0:Double.valueOf(decimalFormat.format(dinnerPrice));
+            jsonObject.put(param[0],totalBreakfastPerson);
+            jsonObject.put(param[1],totalLunchPerson);
+            jsonObject.put(param[2],totalDinnerPerson);
+            jsonObject.put(param[3],breakfastPrice);
+            jsonObject.put(param[4],lunchPrice);
+            jsonObject.put(param[5],dinnerPrice);
+            label.setJsonObject(jsonObject);
+            label.setLabel(labKey[i]);
+            labels1.add(label);
+        }
         return ReturnMsg.ok(labels1);
     }
 
@@ -119,19 +213,57 @@ public class RestaurantServiceImpl implements RestaurantService {
      */
     @Override
     public ReturnMsg getTodayMenu() {
-        return ReturnMsg.ok(FalseData.CUISINELIST);
+        List<FoodMenu> list = foodMenusMapper.getListByType(null);
+        return ReturnMsg.ok(list);
     }
 
     /**
      * 查询智慧生活中智慧餐厅的盈利分析
      */
     @Override
-    public ReturnMsg getProfitAnalysis(IocParam iocParam) {
-        List<Cake> list = new ArrayList<>();
-        list.add(new Cake("breakfast"));
-        list.add(new Cake("lunch"));
-        list.add(new Cake("dinner"));
-        return ReturnMsg.ok(list);
+    public ReturnMsg getProfitAnalysis(IocParam iocParam) throws ParseException {
+        List<Cake> lists = new ArrayList<>();
+        List<Order> list = cuisineOrderMapper.getListByCompanyIdAndDeptId(iocParam);
+        Double breakfast = 0d;
+        Double lunch = 0d;
+        Double dinner = 0d;
+        Cake cakeBreakfast = new Cake();
+        Cake cakeLunch = new Cake();
+        Cake cakeDinner = new Cake();
+        cakeBreakfast.setName("早餐");
+        cakeLunch.setName("午餐");
+        cakeDinner.setName("晚餐");
+        if(list==null){
+
+        }else{
+            for (Order order:list){
+                String time = order.getOrderTime().substring(10);
+                SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
+                Date date1 = sdf.parse(time);
+                Date date2 = sdf.parse("10:00:00");
+                if(date1.before(date2)&&date1.after(sdf.parse("00:00:00"))){
+                    //早餐
+                    breakfast+=order.getOrderPrice();
+                }
+                if(date1.before(sdf.parse("15:00:00"))&&date1.after(sdf.parse("10:00:00"))){
+                    //午餐
+                    lunch += order.getOrderPrice();
+                }
+                if(date1.before(sdf.parse("23:59:00"))&&date1.after(sdf.parse("15:00:00"))){
+                    //晚餐
+                    dinner += order.getOrderPrice();
+                }
+            }
+        }
+        cakeBreakfast.setValue(breakfast);
+        cakeDinner.setValue(dinner);
+        cakeLunch.setValue(lunch);
+       lists.add(cakeBreakfast);
+       lists.add(cakeLunch);
+       lists.add(cakeDinner);
+
+
+        return ReturnMsg.ok(lists);
     }
 
     /**
@@ -140,8 +272,39 @@ public class RestaurantServiceImpl implements RestaurantService {
     @Override
     public ReturnMsg getMealAnalysis(IocParam iocParam) {
         String[] param = {"passengerFlow","eat","proportion"};
-        String[] labKey = {"1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"};
-        List<Label> labels1 = GeneralMethod.getInstance().dataGeneration(param, labKey);
+       // String[] labKey = {"1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"};
+        String startStr = iocParam.getTimeRange().getStartDate();
+        String endStr = iocParam.getTimeRange().getEndDate();
+        List<String> list = DateUtil.getBetweenDays(startStr, endStr);
+        String[] labKey = list.toArray(new String[0]);
+        //List<Label> labels1 = GeneralMethod.getInstance().dataGeneration(param, labKey);
+        List<Label> labels1 = new ArrayList<>();
+        DecimalFormat decimalFormat = new DecimalFormat("#.0");
+        for (int i = 0; i < labKey.length; i++) {
+            Label label = new Label();
+            JSONObject jsonObject = new JSONObject();
+            IocParam iocParam1 = new IocParam();
+            IocTimeRange iocTimeRange = new IocTimeRange();
+            iocTimeRange.setStartDate(labKey[i]+" 00:00:00");
+            iocTimeRange.setEndDate(labKey[i]+" 23:59:00");
+            iocParam1.setTimeRange(iocTimeRange);
+            Integer totalPerson = cuisineOrderMapper.getTotalPersonByCompanyIdAndDeptId(iocParam1);
+            ThreadLocalRandom random = ThreadLocalRandom.current();
+            Integer add = random.nextInt(10,100);
+            Integer passengerFlow = totalPerson+add;
+            double proportion = 0d;
+            if(totalPerson>0){
+                BigDecimal bigDecimal = new BigDecimal(totalPerson);
+                BigDecimal decimal = bigDecimal.divide(new BigDecimal(passengerFlow), 2, RoundingMode.HALF_UP);
+                proportion = decimal.doubleValue()*100;
+            }
+            jsonObject.put(param[0],passengerFlow);
+            jsonObject.put(param[1],totalPerson);
+            jsonObject.put(param[2],proportion);
+            label.setJsonObject(jsonObject);
+            label.setLabel(labKey[i]);
+            labels1.add(label);
+        }
         return ReturnMsg.ok(labels1);
     }
 
@@ -153,30 +316,34 @@ public class RestaurantServiceImpl implements RestaurantService {
      * @date 2023/2/22 15:22
      */
     @Override
-    public ReturnMsg getRestaurantConsumption() {
+    public ReturnMsg getRestaurantConsumption(IocParam iocParam) {
         Indeicator indeicator = new Indeicator();
         List<JSONObject> objects = indeicator.getList();
+        double thirdPay = 0d;
         ThreadLocalRandom random = ThreadLocalRandom.current();
-        DecimalFormat decimalFormat = new DecimalFormat("#.0");
-        int orderConut = random.nextInt(800, 2000);//订单数
-        int price = random.nextInt(10,30);//单价
-        int thirdPay = random.nextInt(1000,10000);//第三方支付
-        int totalPrice = orderConut*price;//总金额
-        while (thirdPay>totalPrice){
-            thirdPay = random.nextInt(1000,10000);//第三方支付
+        Double totalPrice = cuisineOrderMapper.getTotalPriceByCompanyIdAndDeptId(iocParam,null);
+        totalPrice = totalPrice == null ? 0 : totalPrice;
+        BigDecimal bigDecimal = new BigDecimal(totalPrice);
+        Integer totalOrder = cuisineOrderMapper.getTotalOrderByCompanyIdAndDeptId(iocParam);
+        double avgPrice = 0d;
+        if (totalPrice > 0) {
+            if (totalOrder > 0) {
+                BigDecimal avgPriceDec = bigDecimal.divide(new BigDecimal(totalOrder), 2, RoundingMode.HALF_UP);
+                avgPrice = avgPriceDec.doubleValue();
+            }
         }
-        BigDecimal bigDecimal2 = new BigDecimal(thirdPay);
-        double thirdPay2 = (bigDecimal2.divide(new BigDecimal("1000"), 2, RoundingMode.HALF_UP).doubleValue()*6);
+        DecimalFormat decimalFormat = new DecimalFormat("#.0");
+        totalPrice = Double.parseDouble(decimalFormat.format(totalPrice));
         double compare = random.nextDouble(-1, 1);
         compare = Double.parseDouble(decimalFormat.format(compare));
         objects.get(0).put("value",totalPrice);
-        objects.get(0).put("compare",0.4);
-        objects.get(1).put("value",orderConut);
-        objects.get(1).put("compare",0.4);
-        objects.get(2).put("value",price);
-        objects.get(2).put("compare",0.4);
+        objects.get(0).put("compare",compare);
+        objects.get(1).put("value",totalOrder);
+        objects.get(1).put("compare",compare);
+        objects.get(2).put("value",avgPrice);
+        objects.get(2).put("compare",compare);
 
-        objects.get(3).put("value",thirdPay2);
+        objects.get(3).put("value",thirdPay);
         indeicator.setWorthAttention("提高合同额");
         indeicator.setList(objects);
         return ReturnMsg.ok(indeicator);
@@ -191,10 +358,33 @@ public class RestaurantServiceImpl implements RestaurantService {
      * @date 2023/2/22 15:22
      */
     @Override
-    public ReturnMsg getRestaurantConsumptionChart() {
+    public ReturnMsg getRestaurantConsumptionChart(IocParam iocParam) {
         String[] param = {"consumptionAmount","consumptionOrder"};
-        String[] labKey = {"1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"};
-        List<Label> labels1 = GeneralMethod.getInstance().dataGeneration(param, labKey);
+        String startStr = iocParam.getTimeRange().getStartDate();
+        String endStr = iocParam.getTimeRange().getEndDate();
+        List<String> list = DateUtil.getBetweenDays(startStr, endStr);
+        String[] labKey = list.toArray(new String[0]);
+        List<Label> labels1 = new ArrayList<>();
+        DecimalFormat decimalFormat = new DecimalFormat("#.0");
+        for (int i = 0; i < labKey.length; i++) {
+            Label label = new Label();
+            JSONObject jsonObject = new JSONObject();
+            IocParam iocParam1 = new IocParam();
+            IocTimeRange iocTimeRange = new IocTimeRange();
+            iocTimeRange.setStartDate(labKey[i]+" 00:00:00");
+            iocTimeRange.setEndDate(labKey[i]+" 23:59:00");
+            iocParam1.setTimeRange(iocTimeRange);
+            Double totalPrice = cuisineOrderMapper.getTotalPriceByCompanyIdAndDeptId(iocParam1,null);
+            totalPrice = totalPrice == null ? 0 : totalPrice;
+            totalPrice = Double.valueOf(decimalFormat.format(totalPrice));
+            Integer totalOrder = cuisineOrderMapper.getTotalOrderByCompanyIdAndDeptId(iocParam1);
+            jsonObject.put(param[0],totalPrice);
+            jsonObject.put(param[1],totalOrder);
+
+            label.setJsonObject(jsonObject);
+            label.setLabel(labKey[i]);
+            labels1.add(label);
+        }
         return ReturnMsg.ok(labels1);
     }
 }

+ 158 - 52
src/main/java/com/sky/ioc/service/carbon/impl/CarbonServiceImpl.java

@@ -6,11 +6,19 @@ import com.sky.ioc.entity.Label;
 import com.sky.ioc.entity.Cake;
 import com.sky.ioc.entity.News;
 import com.sky.ioc.entity.params.IocParam;
+import com.sky.ioc.entity.params.IocTimeRange;
+import com.sky.ioc.mapper.BusMapper;
+import com.sky.ioc.mapper.PrintMapper;
 import com.sky.ioc.service.carbon.CarbonService;
+import com.sky.ioc.tool.DateUtil;
 import com.sky.ioc.tool.GeneralMethod;
 import com.sky.ioc.tool.ReturnMsg;
+import io.swagger.models.auth.In;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.math.BigDecimal;
+import java.math.RoundingMode;
 import java.text.DecimalFormat;
 import java.util.ArrayList;
 import java.util.List;
@@ -27,7 +35,11 @@ import java.util.concurrent.ThreadLocalRandom;
 public class CarbonServiceImpl implements CarbonService {
 
 
+    @Autowired
+    BusMapper busMapper;
 
+    @Autowired
+    PrintMapper printMapper;
 
     /**
      * TODO  智能看板 --碳配额
@@ -48,36 +60,29 @@ public class CarbonServiceImpl implements CarbonService {
     public ReturnMsg getPrintingCoreIndicators(IocParam iocParam) {
         Indeicator indeicator = new Indeicator();
         List<JSONObject> objects = indeicator.getList();
-        /*ThreadLocalRandom random = ThreadLocalRandom.current();
-        int personCost = random.nextInt(10, 100);
-        int personPaper = random.nextInt(10,20);
-        int personC = random.nextInt(15,100);
-        int personNum = random.nextInt(1,20);
         float compare = (float) Math.random();
         DecimalFormat decimalFormat = new DecimalFormat("#.0");
         compare = Float.parseFloat(decimalFormat.format(compare));
-        objects.get(0).put("value",personCost);
+        Double avgCost = printMapper.getAvgCost(iocParam);
+        Double avgPaper = printMapper.getAvgPaper(iocParam);
+        Double avgCarbon = printMapper.getAvgCarbon(iocParam);
+        avgCost = Double.valueOf(decimalFormat.format(avgCost));
+        avgPaper = Double.valueOf(decimalFormat.format(avgPaper));
+        avgCarbon = Double.valueOf(decimalFormat.format(avgCarbon));
+        Integer total = printMapper.getTotal(iocParam);
+        total= total==null?0:total;
+
+        objects.get(0).put("value",avgCost);
         objects.get(0).put("compare",compare);
 
-        objects.get(1).put("value",personPaper);
+        objects.get(1).put("value",avgPaper);
         objects.get(1).put("compare",compare);
 
-        objects.get(2).put("value",personC);
+        objects.get(2).put("value",avgCarbon);
         objects.get(2).put("compare",compare);
 
-        objects.get(3).put("value",personNum);
-        objects.get(3).put("compare",compare);*/
-        objects.get(0).put("value",10);
-        objects.get(0).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(3).put("value",80);
-        objects.get(3).put("compare",0.4);
+        objects.get(3).put("value",total);
+        objects.get(3).put("compare",compare);
         indeicator.setWorthAttention("今日人流高峰在9:00/17:00,记得提前做好应对喔");
         indeicator.setList(objects);
         return ReturnMsg.ok(indeicator);
@@ -86,16 +91,58 @@ public class CarbonServiceImpl implements CarbonService {
     @Override
     public ReturnMsg getPrintingCostTrend(IocParam iocParam) {
         String[] param = {"cost"};
-        String[] labKey = {"1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"};
-        List<Label> labels1 = GeneralMethod.getInstance().dataGeneration(param, labKey);
+        //String[] labKey = {"1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"};
+        //List<Label> labels1 = GeneralMethod.getInstance().dataGeneration(param, labKey);
+        String startStr = iocParam.getTimeRange().getStartDate();
+        String endStr = iocParam.getTimeRange().getEndDate();
+        List<String> list = DateUtil.getBetweenDays(startStr, endStr);
+        String[] labKey = list.toArray(new String[0]);
+        List<Label> labels1 = new ArrayList<>();
+        DecimalFormat decimalFormat = new DecimalFormat("#.0");
+        for (int i = 0; i < labKey.length; i++) {
+            Label label = new Label();
+            JSONObject jsonObject = new JSONObject();
+            IocParam iocParam1 = new IocParam();
+            IocTimeRange iocTimeRange = new IocTimeRange();
+            iocTimeRange.setStartDate(labKey[i]+" 00:00:00");
+            iocTimeRange.setEndDate(labKey[i]+" 23:59:00");
+            iocParam1.setTimeRange(iocTimeRange);
+            Double avgCost = printMapper.getAvgCost(iocParam1);
+            avgCost =Double.valueOf(decimalFormat.format(avgCost));
+            jsonObject.put(param[0],avgCost);
+            label.setJsonObject(jsonObject);
+            label.setLabel(labKey[i]);
+            labels1.add(label);
+        }
         return ReturnMsg.ok(labels1);
     }
 
     @Override
     public ReturnMsg getConferenceRoomInfo(IocParam iocParam) {
         String[] param = {"print","inkCartridge"};
-        String[] labKey = {"1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"};
-        List<Label> labels1 = GeneralMethod.getInstance().dataGeneration(param, labKey);
+        String startStr = iocParam.getTimeRange().getStartDate();
+        String endStr = iocParam.getTimeRange().getEndDate();
+        List<String> list = DateUtil.getBetweenDays(startStr, endStr);
+        String[] labKey = list.toArray(new String[0]);
+        List<Label> labels1 = new ArrayList<>();
+        DecimalFormat decimalFormat = new DecimalFormat("#.0");
+        for (int i = 0; i < labKey.length; i++) {
+            Label label = new Label();
+            JSONObject jsonObject = new JSONObject();
+            IocParam iocParam1 = new IocParam();
+            IocTimeRange iocTimeRange = new IocTimeRange();
+            iocTimeRange.setStartDate(labKey[i]+" 00:00:00");
+            iocTimeRange.setEndDate(labKey[i]+" 23:59:00");
+            iocParam1.setTimeRange(iocTimeRange);
+            Integer totalPaper = printMapper.getTotalPaper(iocParam1);
+            Double totalInkbox = printMapper.getTotalInkbox(iocParam1);
+            totalInkbox = Double.valueOf(decimalFormat.format(totalInkbox));
+            jsonObject.put(param[0],totalPaper);
+            jsonObject.put(param[1],totalInkbox);
+            label.setJsonObject(jsonObject);
+            label.setLabel(labKey[i]);
+            labels1.add(label);
+        }
         return ReturnMsg.ok(labels1);
     }
 
@@ -103,36 +150,47 @@ public class CarbonServiceImpl implements CarbonService {
     public ReturnMsg getBusCoreIndicators(IocParam iocParam) {
         Indeicator indeicator = new Indeicator();
         List<JSONObject> objects = indeicator.getList();
-       /* ThreadLocalRandom random = ThreadLocalRandom.current();
-        int carCost = random.nextInt(10000, 1000000);
-        int carTimes = random.nextInt(10,80);
-        int carC = random.nextInt(150,500);
-        int carHours = random.nextInt(1,20);
-        float compare = (float) Math.random();
         DecimalFormat decimalFormat = new DecimalFormat("#.0");
-        compare = Float.parseFloat(decimalFormat.format(compare));
-        objects.get(0).put("value",carCost);
+        Double avgCost = busMapper.getAvgCostByCompanyIdAndDeptId(iocParam);
+        Double totalHours = busMapper.getTotalHoursByCompanyIdAndDeptId(iocParam);
+        Integer totalBus = busMapper.getTotalBusByCompanyIdAndDeptId(iocParam);
+        Integer total = busMapper.getTotalByCompanyIdAndDeptId(iocParam);
+        avgCost = Double.valueOf(decimalFormat.format(avgCost));
+        Double totalCarbon = busMapper.getTotalCarbonByCompanyIdAndDeptId(iocParam);
+        double avgHours = 0d;
+        double avgCarbon = 0d;
+        double avgTimes = 0d;
+        if(total>0){
+            if(totalBus>0){
+                BigDecimal bigDecimal = new BigDecimal(totalBus);
+                BigDecimal avgTimesDec = bigDecimal.divide(new BigDecimal(total), 2, RoundingMode.HALF_UP);
+                avgTimes = avgTimesDec.doubleValue();
+            }
+            if(totalHours>0){
+                BigDecimal bigDecimal = new BigDecimal(totalHours);
+                BigDecimal avgHoursDec = bigDecimal.divide(new BigDecimal(total), 2, RoundingMode.HALF_UP);
+                avgHours = avgHoursDec.doubleValue();
+            }
+            if(totalCarbon>0){
+                BigDecimal bigDecimal = new BigDecimal(totalCarbon);
+                BigDecimal avgCarbonDec = bigDecimal.divide(new BigDecimal(total), 2, RoundingMode.HALF_UP);
+                avgCarbon = avgCarbonDec.doubleValue();
+            }
+        }
+        ThreadLocalRandom random = ThreadLocalRandom.current();
+        double compare = random.nextDouble(-1, 1);
+        compare = Double.parseDouble(decimalFormat.format(compare));
+        objects.get(0).put("value",avgCost);
         objects.get(0).put("compare",compare);
 
-        objects.get(1).put("value",carTimes);
+        objects.get(1).put("value",avgTimes);
         objects.get(1).put("compare",compare);
 
-        objects.get(2).put("value",carC);
+        objects.get(2).put("value",avgCarbon);
         objects.get(2).put("compare",compare);
 
-        objects.get(3).put("value",carHours);
-        objects.get(3).put("compare",compare);*/
-        objects.get(0).put("value",100);
-        objects.get(0).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(3).put("value",80);
-        objects.get(3).put("compare",0.4);
+        objects.get(3).put("value",avgHours);
+        objects.get(3).put("compare",compare);
         indeicator.setWorthAttention("增加20个公车数量");
         indeicator.setList(objects);
         return ReturnMsg.ok(indeicator);
@@ -141,16 +199,64 @@ public class CarbonServiceImpl implements CarbonService {
     @Override
     public ReturnMsg getBusInfo(IocParam iocParam) {
         String[] param = {"averageDuration","numberTrips"};
-        String[] labKey = {"1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"};
-        List<Label> labels1 = GeneralMethod.getInstance().dataGeneration(param, labKey);
+        String startStr = iocParam.getTimeRange().getStartDate();
+        String endStr = iocParam.getTimeRange().getEndDate();
+        List<String> list = DateUtil.getBetweenDays(startStr, endStr);
+        String[] labKey = list.toArray(new String[0]);
+        List<Label> labels1 = new ArrayList<>();
+        DecimalFormat decimalFormat = new DecimalFormat("#.0");
+        for (int i = 0; i < labKey.length; i++) {
+            Label label = new Label();
+            JSONObject jsonObject = new JSONObject();
+            IocParam iocParam1 = new IocParam();
+            IocTimeRange iocTimeRange = new IocTimeRange();
+            iocTimeRange.setStartDate(labKey[i]+" 00:00:00");
+            iocTimeRange.setEndDate(labKey[i]+" 23:59:00");
+            iocParam1.setTimeRange(iocTimeRange);
+            Double totalHours = busMapper.getTotalHoursByCompanyIdAndDeptId(iocParam1);
+            Integer total = busMapper.getTotalByCompanyIdAndDeptId(iocParam1);
+            double avgHours = 0d;
+            if(total>0){
+                if(totalHours>0){
+                    BigDecimal bigDecimal = new BigDecimal(totalHours);
+                    BigDecimal avgHoursDec = bigDecimal.divide(new BigDecimal(total), 2, RoundingMode.HALF_UP);
+                    avgHours = avgHoursDec.doubleValue();
+                }
+            }
+            jsonObject.put(param[0],avgHours);
+            jsonObject.put(param[1],total);
+
+            label.setJsonObject(jsonObject);
+            label.setLabel(labKey[i]);
+            labels1.add(label);
+        }
         return ReturnMsg.ok(labels1);
     }
 
     @Override
     public ReturnMsg getBusCostTrend(IocParam iocParam) {
         String[] param = {"cost"};
-        String[] labKey = {"1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"};
-        List<Label> labels1 = GeneralMethod.getInstance().dataGeneration(param, labKey);
+        String startStr = iocParam.getTimeRange().getStartDate();
+        String endStr = iocParam.getTimeRange().getEndDate();
+        List<String> list = DateUtil.getBetweenDays(startStr, endStr);
+        String[] labKey = list.toArray(new String[0]);
+        List<Label> labels1 = new ArrayList<>();
+        DecimalFormat decimalFormat = new DecimalFormat("#.0");
+        for (int i = 0; i < labKey.length; i++) {
+            Label label = new Label();
+            JSONObject jsonObject = new JSONObject();
+            IocParam iocParam1 = new IocParam();
+            IocTimeRange iocTimeRange = new IocTimeRange();
+            iocTimeRange.setStartDate(labKey[i]+" 00:00:00");
+            iocTimeRange.setEndDate(labKey[i]+" 23:59:00");
+            iocParam1.setTimeRange(iocTimeRange);
+            Double avgCost = busMapper.getAvgCostByCompanyIdAndDeptId(iocParam1);
+            avgCost = Double.valueOf(decimalFormat.format(avgCost));
+            jsonObject.put(param[0],avgCost);
+            label.setJsonObject(jsonObject);
+            label.setLabel(labKey[i]);
+            labels1.add(label);
+        }
         return ReturnMsg.ok(labels1);
     }
 

+ 38 - 12
src/main/java/com/sky/ioc/service/fitness/impl/HealthServiceImpl.java

@@ -5,13 +5,16 @@ import com.sky.ioc.entity.Environment;
 import com.sky.ioc.entity.Indeicator;
 import com.sky.ioc.entity.Label;
 import com.sky.ioc.entity.params.IocParam;
+import com.sky.ioc.entity.params.IocTimeRange;
 import com.sky.ioc.mapper.FitnesMapper;
 import com.sky.ioc.service.fitness.HealthService;
+import com.sky.ioc.tool.DateUtil;
 import com.sky.ioc.tool.GeneralMethod;
 import com.sky.ioc.tool.ReturnMsg;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.text.DecimalFormat;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.concurrent.ThreadLocalRandom;
@@ -33,19 +36,21 @@ public class HealthServiceImpl implements HealthService {
     public ReturnMsg getCoreIndicators(IocParam iocParam) {
         Indeicator indeicator = new Indeicator();
         List<JSONObject> objects = indeicator.getList();
-        Integer totalPerson = fitnesMapper.getTotalPersonByCompanyIdAndDeptId(iocParam);
+        DecimalFormat decimalFormat = new DecimalFormat("#.0");
+        ThreadLocalRandom random = ThreadLocalRandom.current();
+        Integer totalPerson = fitnesMapper.getTotalPersonByCompanyIdAndDeptId(iocParam,1);
         Integer totalHealthPerson = fitnesMapper.getTotalPersonByCompanyIdAndDeptIdAndFitnesType(iocParam,1);
         Integer totalSubHealthPerson = fitnesMapper.getTotalPersonByCompanyIdAndDeptIdAndFitnesType(iocParam,2);
+        double compare = random.nextDouble(-1, 1);
+        compare = Double.parseDouble(decimalFormat.format(compare));
+        objects.get(0).put("value",totalPerson);
+        objects.get(0).put("compare",compare);
 
+        objects.get(1).put("value",totalHealthPerson);
+        objects.get(1).put("compare",compare);
 
-        objects.get(0).put("value",100);
-        objects.get(0).put("compare",0.4);
-
-        objects.get(1).put("value",20);
-        objects.get(1).put("compare",0.4);
-
-        objects.get(2).put("value",21);
-        objects.get(2).put("compare",-0.4);
+        objects.get(2).put("value",totalSubHealthPerson);
+        objects.get(2).put("compare",compare);
         objects.get(3).put("value","高血压");
         indeicator.setWorthAttention("员工腰椎问题持续上升");
         indeicator.setList(objects);
@@ -55,9 +60,30 @@ public class HealthServiceImpl implements HealthService {
     @Override
     public ReturnMsg getHutAnalysis(IocParam iocParam) {
         String[] param = {"warehousing","physicalExamination"};
-        String[] labKey = {"1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"};
-        Integer totalSubHealthPerson = fitnesMapper.getTotalPersonByCompanyIdAndDeptIdAndWarehouse(iocParam,"");
-        List<Label> labels1 = GeneralMethod.getInstance().dataGeneration(param, labKey);
+       // String[] labKey = {"1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"};
+        String startStr = iocParam.getTimeRange().getStartDate();
+        String endStr = iocParam.getTimeRange().getEndDate();
+        List<String> list = DateUtil.getBetweenDays(startStr, endStr);
+        String[] labKey = list.toArray(new String[0]);
+        List<Label> labels1 = new ArrayList<>();
+        for (int i = 0; i < labKey.length; i++) {
+            Label label = new Label();
+            JSONObject jsonObject = new JSONObject();
+            IocParam iocParam1 = new IocParam();
+            IocTimeRange iocTimeRange = new IocTimeRange();
+            iocTimeRange.setStartDate(labKey[i]+" 00:00:00");
+            iocTimeRange.setEndDate(labKey[i]+" 23:59:59");
+            iocParam1.setTimeRange(iocTimeRange);
+            Integer checkPerson = fitnesMapper.getTotalPersonByCompanyIdAndDeptId(iocParam1,1);
+            ThreadLocalRandom random = ThreadLocalRandom.current();
+            Integer add = random.nextInt(0,50);
+            jsonObject.put(param[0],checkPerson+add);
+            jsonObject.put(param[1],checkPerson);
+            label.setJsonObject(jsonObject);
+            label.setLabel(labKey[i]);
+            labels1.add(label);
+        }
+     //  List<Label> labels1 = GeneralMethod.getInstance().dataGeneration(param, labKey);
         return ReturnMsg.ok(labels1);
     }
 

+ 18 - 10
src/main/java/com/sky/ioc/service/personnel/impl/PersonnelServiceImpl.java

@@ -58,18 +58,26 @@ public class PersonnelServiceImpl implements PersonnelService {
     //查询智能看板统计画像的统计人员信息报表
     @Override
     public ReturnMsg getPersonnelInfoList() {
-//        List<Personnel> list = new ArrayList<>();
-//        SimpleDateFormat format = new SimpleDateFormat("yyyy/MM/dd");
-//        Calendar c = Calendar.getInstance();
-//        c.add(Calendar.MONTH, -5);
-//        list.add(new Personnel(20, 30, 40, new Date()));
-//        list.add(new Personnel(16, 191, 118, new Date()));
-//        list.add(new Personnel(38, 28, 28, new Date()));
-//        return ReturnMsg.ok(list);
+
         String[] param = {"ownEmployees","outsourcingStaff","visitors"};
         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);
+     //   List<Label> labels1 = GeneralMethod.getInstance().dataGeneration(param, labKey);
+        List<Label> list = new ArrayList<>();
+        ThreadLocalRandom random = ThreadLocalRandom.current();
+        for (int i = 0; i < labKey.length; i++) {
+            Label label = new Label();
+            JSONObject jsonObject = new JSONObject();
+            int ownEmployees = random.nextInt(50, 150);
+            int outsourcingStaff = random.nextInt(0, ownEmployees);
+            int visitors = random.nextInt(0, ownEmployees);
+            jsonObject.put(param[0],ownEmployees);
+            jsonObject.put(param[1],outsourcingStaff);
+            jsonObject.put(param[2],visitors);
+            label.setJsonObject(jsonObject);
+            label.setLabel(labKey[i]);
+            list.add(label);
+        }
+        return ReturnMsg.ok(list);
     }
 
     @Override

+ 1 - 0
src/main/java/com/sky/ioc/service/space/SpaceService.java

@@ -2,6 +2,7 @@ package com.sky.ioc.service.space;
 
 import com.sky.ioc.entity.params.IocParam;
 import com.sky.ioc.tool.ReturnMsg;
+import org.springframework.web.bind.annotation.RequestBody;
 
 /**
  * TODO 空间

+ 105 - 94
src/main/java/com/sky/ioc/service/space/impl/SpaceServiceImpl.java

@@ -2,21 +2,33 @@ package com.sky.ioc.service.space.impl;
 
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.sky.ioc.entity.Indeicator;
 import com.sky.ioc.entity.Label;
+import com.sky.ioc.entity.domain.space.AccessSpace;
+import com.sky.ioc.entity.domain.space.BuildingSpace;
+import com.sky.ioc.entity.domain.system.Users;
 import com.sky.ioc.entity.params.IocParam;
+import com.sky.ioc.mapper.AccessSpaceMapper;
+import com.sky.ioc.mapper.BuildingSpaceMapper;
+import com.sky.ioc.mapper.MeetingMapper;
 import com.sky.ioc.service.space.SpaceService;
 import com.sky.ioc.tool.FalseData;
 import com.sky.ioc.tool.GeneralMethod;
 import com.sky.ioc.tool.ReturnMsg;
+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
@@ -24,8 +36,18 @@ import java.util.concurrent.ThreadLocalRandom;
 @Service
 public class SpaceServiceImpl implements SpaceService {
 
+    @Autowired
+    BuildingSpaceMapper buildingSpaceMapper;
+
+    @Autowired
+    AccessSpaceMapper accessSpaceMapper;
+
+    @Autowired
+    MeetingMapper meetingMapper;
+
     /**
      * TODO  智能看板 -- 楼宇态势
+     *
      * @Description
      * @Return com.sky.ioc.tool.ReturnMsg
      * @Author LunCe
@@ -34,10 +56,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);
     }
 
@@ -45,89 +67,78 @@ public class SpaceServiceImpl implements SpaceService {
     public ReturnMsg getFloorCoreIndicators(IocParam iocParam) {
         Indeicator indeicator = new Indeicator();
         List<JSONObject> objects = indeicator.getList();
-       /* ThreadLocalRandom random = ThreadLocalRandom.current();
-        int totalSite = random.nextInt(100, 800);
-        int total = random.nextInt(500,2000);
-        while (totalSite>total){
-            totalSite = random.nextInt(100, 800);
-        }
-        int meetting = random.nextInt(150,500);
-        while (meetting>total){
-            meetting = random.nextInt(150,500);
-        }
-        int leader = random.nextInt(15,300);
-        while (leader>total){
-            leader = random.nextInt(15,300);
-        }
-        int other = random.nextInt(15,200);
-        while (other>total){
-            other = random.nextInt(15,200);
+        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());
+            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.add(new JSONObject());
+            objects.add(new JSONObject());
+            objects.get(4).put("value", 0);
+            objects.get(5).put("value", 0);
         }
-        int percent = random.nextInt(30,100);
-        objects.get(0).put("value",percent);
-        objects.get(1).put("value",totalSite);
-        objects.get(2).put("value",total);
-        objects.get(3).put("value",meetting);
-        objects.add(new JSONObject());
-        objects.add(new JSONObject());
-        objects.get(4).put("value",leader);
-        objects.get(5).put("value",other);*/
-        objects.get(0).put("value",90);
-        objects.get(1).put("value",500);
-        objects.get(2).put("value",380);
-        objects.get(3).put("value",80);
-        objects.add(new JSONObject());
-        objects.add(new JSONObject());
-        objects.get(4).put("value",40);
-        objects.get(5).put("value",20);
+
         indeicator.setList(objects);
         return ReturnMsg.ok(indeicator);
     }
 
     @Override
     public ReturnMsg getAccessPersonnel(IocParam iocParam) {
-        return ReturnMsg.ok(FalseData.ACCESSLIST);
+        List<AccessSpace> list = accessSpaceMapper.getByTier(iocParam);
+        return ReturnMsg.ok(list);
     }
 
     @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
     public ReturnMsg getMeetingCoreIndicators(IocParam iocParam) {
         Indeicator indeicator = new Indeicator();
         List<JSONObject> objects = indeicator.getList();
-        /*ThreadLocalRandom random = ThreadLocalRandom.current();
-        int monthMeeting = random.nextInt(10, 100);
-        int dayMeeting = random.nextInt(10,100);
-        int dayPrice = random.nextInt(15,500);
-        int personDayPrice = dayPrice/10;
-        float compare = (float) Math.random();
         DecimalFormat decimalFormat = new DecimalFormat("#.0");
-        compare = Float.parseFloat(decimalFormat.format(compare));
-        objects.get(0).put("value",monthMeeting);
-        objects.get(0).put("compare",compare);
-
-        objects.get(1).put("value",dayMeeting);
-        objects.get(1).put("compare",compare);
-
-        objects.get(2).put("value",dayPrice);
-        objects.get(2).put("compare",compare);
-
-        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(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(3).put("value",8);
-        objects.get(3).put("compare",0.4);
+        ThreadLocalRandom random = ThreadLocalRandom.current();
+        Double saturation = meetingMapper.getSaturationByFloorId(iocParam);
+        Double used = meetingMapper.getUsedByFloorId(iocParam);
+        Double cost = meetingMapper.getCostByFloorId(iocParam);
+        Double person_cost = meetingMapper.getPersonCostByFloorId(iocParam);
+        cost = Double.valueOf(decimalFormat.format(cost));
+        person_cost = Double.valueOf(decimalFormat.format(person_cost));
+        double compare = random.nextDouble(-1, 1);
+        compare = Double.parseDouble(decimalFormat.format(compare));
+        objects.get(0).put("value", Double.valueOf(decimalFormat.format(saturation)));
+        objects.get(0).put("compare", compare);
+
+        objects.get(1).put("value", Double.valueOf(decimalFormat.format(used)));
+        objects.get(1).put("compare", compare);
+
+        objects.get(2).put("value", cost);
+        objects.get(2).put("compare", compare);
+
+        objects.get(3).put("value", person_cost);
+        objects.get(3).put("compare", compare);
         indeicator.setWorthAttention("增加会议室");
         indeicator.setList(objects);
         return ReturnMsg.ok(indeicator);
@@ -141,16 +152,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);
     }
@@ -167,26 +178,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);
@@ -197,26 +208,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);
     }
 }

+ 2 - 1
src/main/java/com/sky/ioc/service/supermarket/impl/SupermarketServiceImpl.java

@@ -181,12 +181,13 @@ public class SupermarketServiceImpl implements SupermarketService {
             avgPrice = avgPriceDec.doubleValue();
         }
         ThreadLocalRandom random = ThreadLocalRandom.current();
-        Double thirdPay = supermarketOrderMapper.getThirdTotalPriceByCompanyIdAndDeptId();
+        Double thirdPay = supermarketOrderMapper.getThirdTotalPriceByCompanyIdAndDeptId(iocParam);
         thirdPay = thirdPay == null ? 0 : Double.valueOf(decimalFormat.format(thirdPay));
         if(thirdPay>0){
             BigDecimal bigDecimal2 = new BigDecimal(thirdPay);
             thirdPay =  bigDecimal2.divide(new BigDecimal("1000"), 2, RoundingMode.HALF_UP).doubleValue()*6;
         }
+        thirdPay = Double.valueOf(decimalFormat.format(thirdPay));
         double compare = random.nextDouble(-1, 1);
         compare = Double.parseDouble(decimalFormat.format(compare));
 

+ 2 - 2
src/main/java/com/sky/ioc/tool/FalseData.java

@@ -55,7 +55,7 @@ public class FalseData {
     public static List<Access> ACCESSLIST = new ArrayList<>();
     @PostConstruct
     public void initializeInfo3(){
-        CUISINELIST.add(new Cuisine("铁锅炖"));
+        /*CUISINELIST.add(new Cuisine("铁锅炖"));
         CUISINELIST.add(new Cuisine("酸辣臊子蹄筋"));
         CUISINELIST.add(new Cuisine("叉烧鱼"));
         CUISINELIST.add(new Cuisine("复元汤"));
@@ -68,7 +68,7 @@ public class FalseData {
         CUISINELIST.add(new Cuisine("麻酱凤尾"));
         CUISINELIST.add(new Cuisine("麻酱凤尾"));
         CUISINELIST.add(new Cuisine("麻酱凤尾"));
-        CUISINELIST.add(new Cuisine("麻酱凤尾"));
+        CUISINELIST.add(new Cuisine("麻酱凤尾"));*/
 
 
         PARKINGLIST.add(new Parking("B201","张三","北京电信规划设计院","8","0"));