Browse Source

首页-电梯日历

黄远 5 năm trước cách đây
mục cha
commit
f96f3b942d

+ 2 - 2
lift-system-service/src/main/java/cn/com/ty/lift/system/homepage/controller/PlatformCalendarController.java

@@ -39,8 +39,8 @@ public class PlatformCalendarController {
      * @date 2020/2/14 7:01 下午
      */
     @RequestMapping("/taskLiftNum")
-    public RestResponse taskLiftNum() {
-        return platformCalendarService.taskLiftNum();
+    public RestResponse taskLiftNum(@RequestBody PlatformCalendarRequest platformCalendarRequest) {
+        return platformCalendarService.taskLiftNum(platformCalendarRequest);
     }
 
 }

+ 5 - 0
lift-system-service/src/main/java/cn/com/ty/lift/system/homepage/dao/dto/request/PlatformCalendarRequest.java

@@ -19,6 +19,11 @@ public class PlatformCalendarRequest {
      */
     private String requestDateStr;
 
+    /**
+     * 日期 年+月+日
+     */
+    private String requestDateDayStr;
+
     /**
      * 月初时间 年月日
      */

+ 22 - 0
lift-system-service/src/main/java/cn/com/ty/lift/system/homepage/dao/model/AnnualInspectionDataModel.java

@@ -32,4 +32,26 @@ public class AnnualInspectionDataModel extends CalendarLiftDataModel{
      */
     private Integer status;
 
+    /**
+     * stepStatus  :年检阶段状态
+     * 未开始0,第一阶段 1-2,第二阶段 3,第三阶段 4-7,第四阶段 8-10
+     *
+     1  维保工确认年检计划
+     2  维保工上传自检报告,选择自检时间 或者 文员设置 是否检查限速器和荷载年检设置,
+     文员也可以上传自检报告或者确认自检报告和自检时间,自检时间以最后设置的为准
+     --------------------------------
+     3  企业文员确认现场检验时间
+     录入人员信息,政府质检,企业质检,联系电话
+     --------------------------------
+     4	维保工上传检验结果
+     5	企业文员确认检验结果-合格
+     6	企业文员确认检验结果-整改
+     7	企业文员确认检验结果-不合格
+     --------------------------------
+     8	维保工上传年检报告和合格证
+     9	企业文员确认年检报告和合格证-合格
+     10	企业文员确认年检报告和合格证-不合格
+     */
+    private Integer stepStatus;
+
 }

+ 26 - 0
lift-system-service/src/main/java/cn/com/ty/lift/system/homepage/dao/model/CalendarLiftDataModel.java

@@ -33,4 +33,30 @@ public class CalendarLiftDataModel {
      * 维保工
      */
     private String workerName;
+
+    /**
+     * 电梯维保状态 1: 待保养, 2: 保养中 3: 保养完成
+     */
+    private Integer maintenanceStatus;
+
+    /**
+     * 电梯急修状态 4: 召修待完成 5: 急修中 6: 急修完成
+     */
+    private Integer emergencyStatus;
+
+    /**
+     * 电梯年检状态 7: 计划年检 8: 年检中 9: 年检完成
+     */
+    private Integer annualInspectionStatus;
+
+    public CalendarLiftDataModel(){}
+
+    public CalendarLiftDataModel(Long liftId, String projectName, String registrationCode,
+                                 String liftCode, String workerName){
+        this.liftId = liftId;
+        this.projectName = projectName;
+        this.registrationCode = registrationCode;
+        this.liftCode = liftCode;
+        this.workerName = workerName;
+    }
 }

+ 3 - 2
lift-system-service/src/main/java/cn/com/ty/lift/system/homepage/dao/model/MtRecordDataModel.java

@@ -13,9 +13,10 @@ import java.time.LocalDate;
 public class MtRecordDataModel extends CalendarLiftDataModel {
 
     /**
-     * 维保计划状态
+     * 状态 -1:待审核,0:待处理,1:已签到,保养中,2:完成保养,待评价,3:完成。
+     * -2:已补录工单(缺少维保项),可以继续填写
      */
-    private Integer status;
+    private String status;
 
     /**
      * 实际保养时间

+ 346 - 11
lift-system-service/src/main/java/cn/com/ty/lift/system/homepage/service/PlatformCalendarService.java

@@ -4,17 +4,16 @@ import cn.com.ty.lift.common.constants.ApiConstants;
 import cn.com.ty.lift.system.constants.CommonConstants;
 import cn.com.ty.lift.system.homepage.dao.dto.request.PlatformCalendarRequest;
 import cn.com.ty.lift.system.homepage.dao.mapper.CommonDataMapper;
-import cn.com.ty.lift.system.homepage.dao.model.AnnualInspectionDataModel;
-import cn.com.ty.lift.system.homepage.dao.model.EmergencyRecordDataModel;
-import cn.com.ty.lift.system.homepage.dao.model.MtPlanDataModel;
-import cn.com.ty.lift.system.homepage.dao.model.MtRecordDataModel;
+import cn.com.ty.lift.system.homepage.dao.model.*;
 import cn.com.ty.lift.system.utils.CommonUtil;
 import cn.com.xwy.boot.web.dto.RestResponse;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
-import java.util.List;
-import java.util.Map;
+import java.time.LocalDate;
+import java.util.*;
+import java.util.stream.Collectors;
 
 /**
  * @author huangyuan
@@ -36,31 +35,367 @@ public class PlatformCalendarService {
     public RestResponse taskNum(PlatformCalendarRequest platformCalendarRequest) {
         Map<Integer, Map<Integer, Long>> dayToLiftDataToNum = CommonUtil.initCalendarMapData(
                 platformCalendarRequest.getRequestDateStr(), CommonConstants.PlatformCalendarConstants.REQUEST_DATE_FORMAT);
+        //获取日期数 -> 电梯信息 (不同电梯状态 -> 电梯数据)
+        Map<Integer, Map<Integer, List<CalendarLiftDataModel>>> dayToCalendarLift = getDayToCalendarLift(
+                platformCalendarRequest);
+        //循环设置不同状态的电梯数量
+        dayToCalendarLift.forEach((day, dayToCalendarLiftMap) -> {
+            if (dayToCalendarLiftMap != null) {
+                //循环设置不同状态的电梯数量
+                Map<Integer, Long> statusToLiftNum = new HashMap<>();
+                dayToCalendarLiftMap.forEach((status, calendarLiftList) -> {
+                    if (calendarLiftList != null) {
+                        statusToLiftNum.put(status, calendarLiftList.stream().count());
+                    }
+                });
+                dayToLiftDataToNum.put(day, statusToLiftNum);
+            }
+        });
+        return RestResponse.success(dayToLiftDataToNum, ApiConstants.RESULT_SUCCESS, "获取任务数成功");
+    }
+
+    /**
+     * @param
+     * @return
+     * @description 任务电梯列表
+     * @date 2020/2/14 7:01 下午
+     */
+    public RestResponse taskLiftNum(PlatformCalendarRequest platformCalendarRequest) {
+        List<CalendarLiftDataModel> calendarLiftDataModelList = new ArrayList<>();
+        //获取日期数 -> 电梯信息 (不同电梯状态 -> 电梯数据)
+        Map<Integer, Map<Integer, List<CalendarLiftDataModel>>> dayToCalendarLift = getDayToCalendarLift(
+                platformCalendarRequest);
+        //获取指定日期的电梯数据
+        Map<Integer, List<CalendarLiftDataModel>> statusToLiftData = dayToCalendarLift.get(CommonUtil.getDateStrDayValue(
+                platformCalendarRequest.getRequestDateDayStr(), CommonConstants.PlatformCalendarConstants.TRANS_DATE_FORMAT));
+        if (statusToLiftData != null && statusToLiftData.size() > 0) {
+            statusToLiftData.forEach((status, calendarLiftList) -> {
+                calendarLiftDataModelList.addAll(calendarLiftDataModelList);
+            });
+        }
+        //去除id相同的电梯数据
+        removeDuplicationLift(calendarLiftDataModelList);
+        return RestResponse.success(calendarLiftDataModelList, ApiConstants.RESULT_SUCCESS, "获取任务数成功");
+    }
+
+    /**
+     * @param
+     * @return
+     * @description 获取日期对应的电梯数据 天 -> 电梯数据(电梯状态 -> 电梯数据)
+     * @date 2020/2/21 11:12 上午
+     */
+    private Map<Integer, Map<Integer, List<CalendarLiftDataModel>>> getDayToCalendarLift(PlatformCalendarRequest platformCalendarRequest) {
         //时间转化
         CommonUtil.setMonthDate(platformCalendarRequest);
+        Map<Integer, Map<Integer, List<CalendarLiftDataModel>>> dayToCalendarLift = new HashMap<>();
+        //获取维保记录数据,并将维保记录数据转化为 天 -> 维保记录(电梯id -> 维保记录)
+        Map<Integer, Map<Long, List<MtRecordDataModel>>> dayToMtRecord = getDayToMtRecord(platformCalendarRequest);
+        //获取维保计划,并将维保计划信息转化为 天 -> 维保计划(电梯id -> 维保计划)
+        Map<Integer, Map<Long, List<MtPlanDataModel>>> dayToMtPlan = getDayToMtPlan(platformCalendarRequest);
+        //获取急修记录,并将急修记录转化为 天 -> 急修数据(电梯id -> 急修数据)
+        Map<Integer, Map<Long, List<EmergencyRecordDataModel>>> dayToEmergencyRecord = getDayToEmergencyRecord(
+                platformCalendarRequest);
+        //获取年检记录,并将年检记录转化为 天 -> 年检数据(电梯 -> 年检数据)
+        Map<Integer, Map<Long, List<AnnualInspectionDataModel>>> dayToAnnualInspection = getDayToAnnualInspection(
+                platformCalendarRequest);
+        //循环设置每日的数据
+        for (int day = 1; day <= LocalDate.now().getDayOfMonth(); day++) {
+            addCalendarLift(dayToCalendarLift, dayToMtRecord, dayToMtPlan, dayToEmergencyRecord, dayToAnnualInspection, day);
+        }
+        return dayToCalendarLift;
+    }
+
+    /**
+     * @param
+     * @return
+     * @description 向对应状态中添加电梯信息
+     * @date 2020/2/21 3:05 下午
+     */
+    private void addCalendarLift(Map<Integer, Map<Integer, List<CalendarLiftDataModel>>> dayToCalendarLift,
+                                 Map<Integer, Map<Long, List<MtRecordDataModel>>> dayToMtRecord,
+                                 Map<Integer, Map<Long, List<MtPlanDataModel>>> dayToMtPlan,
+                                 Map<Integer, Map<Long, List<EmergencyRecordDataModel>>> dayToEmergencyRecord,
+                                 Map<Integer, Map<Long, List<AnnualInspectionDataModel>>> dayToAnnualInspection, int day) {
+        //获取每天的维保记录数据
+        Map<Long, List<MtRecordDataModel>> liftIdToMtRecord = dayToMtRecord.get(day);
+        //获取每天的维保计划数据
+        Map<Long, List<MtPlanDataModel>> liftIdToMtPlan = dayToMtPlan.get(day);
+        //获取每天的急修记录数据
+        Map<Long, List<EmergencyRecordDataModel>> liftIdToEmergencyRecord = dayToEmergencyRecord.get(day);
+        //获取每天的年检记录数据
+        Map<Long, List<AnnualInspectionDataModel>> liftIdToAnnualInspection = dayToAnnualInspection.get(day);
+        //获取电梯id集合
+        Set<Long> liftIdSet = getLiftIdSet(liftIdToMtRecord, liftIdToMtPlan, liftIdToEmergencyRecord,
+                liftIdToAnnualInspection);
+        //状态 -> 电梯列表
+        Map<Integer, List<CalendarLiftDataModel>> statusToCalendarLift = new HashMap<>();
+        if (liftIdSet.size() > 0) {
+            List<CalendarLiftDataModel> calendarLiftDataModelList = new ArrayList<>();
+            liftIdSet.forEach(liftId -> {
+                //封装维保的电梯信息
+                addMaintenanceStatusLift(liftIdToMtRecord, liftIdToMtPlan, calendarLiftDataModelList, liftId);
+                //封装急修信息
+                addEmergencyStatusLift(liftIdToEmergencyRecord, calendarLiftDataModelList, liftId);
+                //封装年检信息
+                addAnnualInspectionLift(liftIdToAnnualInspection, calendarLiftDataModelList, liftId);
+                //分类封装电梯数据
+                classifyStatusPutLIftData(statusToCalendarLift, calendarLiftDataModelList);
+            });
+        }
+        dayToCalendarLift.put(day, statusToCalendarLift);
+    }
+
+    /**
+     * @param
+     * @return
+     * @description 分类封装电梯数据
+     * @date 2020/2/21 4:01 下午
+     */
+    private void classifyStatusPutLIftData(Map<Integer, List<CalendarLiftDataModel>> statusToCalendarLift, List<CalendarLiftDataModel> calendarLiftDataModelList) {
+        if (calendarLiftDataModelList.size() > 0) {
+            //通过维保状态来分类电梯信息
+            Map<Integer, List<CalendarLiftDataModel>> statusToMtCalendarLift = calendarLiftDataModelList.stream()
+                    .collect(Collectors.groupingBy(calendarLiftDataModel -> {
+                        if (calendarLiftDataModel.getMaintenanceStatus() != null) {
+                            return calendarLiftDataModel.getMaintenanceStatus();
+                        }
+                        return 0;
+                    }));
+            statusToCalendarLift.putAll(statusToMtCalendarLift);
+            //通过急修状态来分类电梯信息
+            Map<Integer, List<CalendarLiftDataModel>> statusToMtEmergencyLift = calendarLiftDataModelList.stream()
+                    .collect(Collectors.groupingBy(calendarLiftDataModel -> {
+                        if (calendarLiftDataModel.getEmergencyStatus() != null) {
+                            return calendarLiftDataModel.getEmergencyStatus();
+                        }
+                        return 0;
+                    }));
+            statusToCalendarLift.putAll(statusToMtEmergencyLift);
+            //通过年检状态来分类电梯信息
+            Map<Integer, List<CalendarLiftDataModel>> statusToAnnualLift = calendarLiftDataModelList.stream()
+                    .collect(Collectors.groupingBy(calendarLiftDataModel -> {
+                        if (calendarLiftDataModel.getAnnualInspectionStatus() != null) {
+                            return calendarLiftDataModel.getAnnualInspectionStatus();
+                        }
+                        return 0;
+                    }));
+            statusToCalendarLift.putAll(statusToAnnualLift);
+        }
+    }
+
+    /**
+     * @param
+     * @return
+     * @description 封装维保的电梯信息
+     * @date 2020/2/21 2:55 下午
+     */
+    private void addMaintenanceStatusLift(Map<Long, List<MtRecordDataModel>> liftIdToMtRecord, Map<Long, List<MtPlanDataModel>> liftIdToMtPlan, List<CalendarLiftDataModel> calendarLiftDataModelList, Long liftId) {
+        //获取保养记录数据
+        List<MtRecordDataModel> mtRecordDataModelList = liftIdToMtRecord.get(liftId);
+        //获取保养计划数据
+        List<MtPlanDataModel> mtPlanDataModelList = liftIdToMtPlan.get(liftId);
+        if (mtRecordDataModelList != null && mtRecordDataModelList.size() > 0) {
+            MtRecordDataModel mtRecordDataModel = mtRecordDataModelList.get(0);
+            CalendarLiftDataModel calendarLiftDataModel = new CalendarLiftDataModel(
+                    mtRecordDataModel.getLiftId(), mtRecordDataModel.getProjectName(),
+                    mtRecordDataModel.getRegistrationCode(), mtRecordDataModel.getLiftCode(),
+                    mtRecordDataModel.getWorkerName());
+            //默认是维保已完成
+            calendarLiftDataModel.setMaintenanceStatus(3);
+            if (StringUtils.isNotBlank(mtRecordDataModel.getStatus())) {
+                switch (mtRecordDataModel.getStatus()) {
+                    case "-2":
+                    case "-1":
+                    case "0":
+                        calendarLiftDataModel.setMaintenanceStatus(1);
+                        break;
+                    case "1":
+                        calendarLiftDataModel.setMaintenanceStatus(2);
+                        break;
+                }
+            }
+            calendarLiftDataModelList.add(calendarLiftDataModel);
+        } else if (mtPlanDataModelList != null && mtPlanDataModelList.size() > 0) {
+            //有计划 则说明有待保养的电梯
+            MtPlanDataModel mtPlanDataModel = mtPlanDataModelList.get(0);
+            CalendarLiftDataModel calendarLiftDataModel = new CalendarLiftDataModel(
+                    mtPlanDataModel.getLiftId(), mtPlanDataModel.getProjectName(),
+                    mtPlanDataModel.getRegistrationCode(), mtPlanDataModel.getLiftCode(),
+                    mtPlanDataModel.getWorkerName());
+            calendarLiftDataModel.setMaintenanceStatus(1);
+            calendarLiftDataModelList.add(calendarLiftDataModel);
+        }
+    }
+
+    /**
+     * @param
+     * @return
+     * @description 封装急修电梯信息
+     * @date 2020/2/21 2:59 下午
+     */
+    private void addEmergencyStatusLift(Map<Long, List<EmergencyRecordDataModel>> liftIdToEmergencyRecord,
+                                        List<CalendarLiftDataModel> calendarLiftDataModelList, Long liftId) {
+        //获取急修记录数
+        List<EmergencyRecordDataModel> emergencyRecordDataModelList = liftIdToEmergencyRecord.get(liftId);
+        if (emergencyRecordDataModelList != null && emergencyRecordDataModelList.size() > 0) {
+            EmergencyRecordDataModel emergencyRecordDataModel = emergencyRecordDataModelList.get(0);
+            CalendarLiftDataModel calendarLiftDataModel = new CalendarLiftDataModel(
+                    emergencyRecordDataModel.getLiftId(), emergencyRecordDataModel.getProjectName(),
+                    emergencyRecordDataModel.getRegistrationCode(), emergencyRecordDataModel.getLiftCode(),
+                    emergencyRecordDataModel.getWorkerName());
+            //急修默认状态是 待急修
+            calendarLiftDataModel.setEmergencyStatus(4);
+            if (emergencyRecordDataModel.getStatus() != null) {
+                switch (emergencyRecordDataModel.getStatus()) {
+                    case 1:
+                    case 3:
+                        calendarLiftDataModel.setEmergencyStatus(5);
+                        break;
+                    case 2:
+                        calendarLiftDataModel.setEmergencyStatus(6);
+                }
+            }
+            calendarLiftDataModelList.add(calendarLiftDataModel);
+        }
+    }
+
+    /**
+     * @param
+     * @return
+     * @description 封装年检电梯信息
+     * @date 2020/2/21 3:03 下午
+     */
+    private void addAnnualInspectionLift(Map<Long, List<AnnualInspectionDataModel>> liftIdToAnnualInspection,
+                                         List<CalendarLiftDataModel> calendarLiftDataModelList, Long liftId) {
+        //获取年检记录
+        List<AnnualInspectionDataModel> annualInspectionDataModelList = liftIdToAnnualInspection.get(liftId);
+        if (annualInspectionDataModelList != null && annualInspectionDataModelList.size() > 0) {
+            AnnualInspectionDataModel annualInspectionDataModel = annualInspectionDataModelList.get(0);
+            CalendarLiftDataModel calendarLiftDataModel = new CalendarLiftDataModel(
+                    annualInspectionDataModel.getLiftId(), annualInspectionDataModel.getProjectName(),
+                    annualInspectionDataModel.getRegistrationCode(), annualInspectionDataModel.getLiftCode(),
+                    annualInspectionDataModel.getWorkerName());
+            //年检默认状态 默认 计划年检
+            calendarLiftDataModel.setAnnualInspectionStatus(7);
+            if (annualInspectionDataModel.getStatus() != null) {
+                if (annualInspectionDataModel.getStatus() == 1) {
+                    calendarLiftDataModel.setAnnualInspectionStatus(9);
+                } else {
+                    if (annualInspectionDataModel.getStepStatus() != null &&
+                            annualInspectionDataModel.getStepStatus() != 1) {
+                        calendarLiftDataModel.setAnnualInspectionStatus(8);
+                    }
+                }
+            }
+        }
+    }
+
+    /**
+     * @param
+     * @return
+     * @description 获取维保记录信息,并将信息转化为 天 -> 维保记录(电梯id -> 维保记录)
+     * @date 2020/2/21 10:46 上午
+     */
+    private Map<Integer, Map<Long, List<MtRecordDataModel>>> getDayToMtRecord(PlatformCalendarRequest platformCalendarRequest) {
         //获取当前公司的维保记录 传递时间值 月初时间 - 当前时间
         List<MtRecordDataModel> mtRecordDataModelList = commonDataMapper
                 .getMonthBeginToNowMtRecord(platformCalendarRequest);
+        //将维保记录数据转化为 天 -> 维保记录(电梯id -> 维保记录)
+        return CommonUtil.getDayToDataMap(mtRecordDataModelList,
+                "workDate");
+    }
+
+    /**
+     * @param
+     * @return
+     * @description 获取维保计划, 并将维保计划信息转化为 天 -> 维保计划(电梯id -> 维保计划)
+     * @date 2020/2/21 10:48 上午
+     */
+    private Map<Integer, Map<Long, List<MtPlanDataModel>>> getDayToMtPlan(PlatformCalendarRequest platformCalendarRequest) {
         //获取当前公司的维保计划 传递时间值 当前时间 - 月末时间
         List<MtPlanDataModel> mtPlanDataModelList = commonDataMapper
                 .getMonthNowToEndMtPlan(platformCalendarRequest);
+        //将维保计划数据转化为 天 -> 维保计划(电梯id -> 维保计划)
+        return CommonUtil.getDayToDataMap(mtPlanDataModelList,
+                "planDate");
+    }
+
+    /**
+     * @param
+     * @return
+     * @description 获取急修记录, 并将急修记录转化为 天 -> 急修数据(电梯id -> 急修数据)
+     * @date 2020/2/21 10:51 上午
+     */
+    private Map<Integer, Map<Long, List<EmergencyRecordDataModel>>> getDayToEmergencyRecord(PlatformCalendarRequest platformCalendarRequest) {
         //获取当前公司的急修记录 传递时间值 月初时间 - 当前时间
         List<EmergencyRecordDataModel> emergencyRecordDataModelList = commonDataMapper
                 .getMonthBeginToNowEmergencyRecord(platformCalendarRequest);
+        //将急修记录数据转化为 天 -> 急修数据(电梯id -> 急修数据)
+        return CommonUtil.getDayToDataMap(emergencyRecordDataModelList, "callerDate");
+    }
+
+    /**
+     * @param
+     * @return
+     * @description 获取年检记录, 并将年检记录转化为 天 -> 年检数据(电梯 -> 年检数据)
+     * @date 2020/2/21 10:53 上午
+     */
+    private Map<Integer, Map<Long, List<AnnualInspectionDataModel>>> getDayToAnnualInspection(PlatformCalendarRequest platformCalendarRequest) {
         //获取当前公司的年检记录 传递时间值 月初时间 - 月末时间
         List<AnnualInspectionDataModel> annualInspectionDataModelList = commonDataMapper
                 .getMonthBeginToEndAnnualInspectionRecord(platformCalendarRequest);
+        //将年检数据转化为 天 -> 年检数据(电梯id -> 年检数据)
+        return CommonUtil.getDayToDataMap(
+                annualInspectionDataModelList, "planDate");
+    }
 
-        return RestResponse.success(dayToLiftDataToNum, ApiConstants.RESULT_SUCCESS, "获取任务数成功");
+    /**
+     * @param
+     * @return
+     * @description 去除id相同的电梯数据
+     * @date 2020/2/21 11:40 上午
+     */
+    private void removeDuplicationLift(List<CalendarLiftDataModel> calendarLiftDataModelList) {
+        List<CalendarLiftDataModel> noDuplicationLiftList = new ArrayList<>();
+        if (calendarLiftDataModelList != null && calendarLiftDataModelList.size() > 0) {
+            //存放电梯id的map
+            Map<Long, Integer> liftIdToLiftNum = new HashMap<>();
+            calendarLiftDataModelList.forEach(calendarLiftDataModel -> {
+                //如果电梯id不存在,就向电梯list中添加电梯,存在就跳过
+                if (liftIdToLiftNum.get(calendarLiftDataModel.getLiftId()) == null) {
+                    noDuplicationLiftList.add(calendarLiftDataModel);
+                    liftIdToLiftNum.put(calendarLiftDataModel.getLiftId(), 1);
+                }
+            });
+        }
     }
 
     /**
      * @param
      * @return
-     * @description 任务电梯列表
-     * @date 2020/2/14 7:01 下午
+     * @description 获取电梯id集合
+     * @date 2020/2/21 1:16 下午
      */
-    public RestResponse taskLiftNum() {
-        return RestResponse.success(ApiConstants.RESULT_SUCCESS, "获取任务数成功");
+    private Set<Long> getLiftIdSet(Map<Long, List<MtRecordDataModel>> liftIdToMtRecord,
+                                   Map<Long, List<MtPlanDataModel>> liftIdToMtPlan,
+                                   Map<Long, List<EmergencyRecordDataModel>> liftIdToEmergencyRecord,
+                                   Map<Long, List<AnnualInspectionDataModel>> liftIdToAnnualInspection) {
+        //数据集合数组
+        Map[] dataMapArray = {
+                liftIdToMtRecord,
+                liftIdToMtPlan,
+                liftIdToEmergencyRecord,
+                liftIdToAnnualInspection
+        };
+        //获取当天所有电梯数据
+        Set<Long> liftIdSet = new HashSet<>();
+        //循环设置电梯id
+        for (Map dataMap : dataMapArray) {
+            if (dataMap != null && dataMap.size() > 0) {
+                liftIdSet.addAll(dataMap.keySet());
+            }
+        }
+        return liftIdSet;
     }
+
 }

+ 71 - 1
lift-system-service/src/main/java/cn/com/ty/lift/system/utils/CommonUtil.java

@@ -1,7 +1,9 @@
 package cn.com.ty.lift.system.utils;
 
+import cn.com.ty.lift.common.utils.PojoUtils;
 import cn.com.ty.lift.system.constants.CommonConstants;
 import cn.com.ty.lift.system.homepage.dao.dto.request.PlatformCalendarRequest;
+import org.apache.commons.lang3.StringUtils;
 
 import javax.servlet.http.HttpServletRequest;
 import java.time.Duration;
@@ -10,7 +12,9 @@ import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
 import java.time.temporal.TemporalAdjusters;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
+import java.util.stream.Collectors;
 
 /**
  * @author huangyuan
@@ -105,7 +109,7 @@ public class CommonUtil {
 
     /**
      * @param timeDateStr 传递时间
-     * @param timeFormat 时间格式
+     * @param timeFormat  时间格式
      * @return
      * @description 初始化日列数据
      */
@@ -125,4 +129,70 @@ public class CommonUtil {
         return dayToLiftStatusToNum;
     }
 
+    /**
+     * @param time 时间值
+     * @return
+     * @description 获取时间的天数值
+     */
+    public static int getDateDayValue(LocalDate time) {
+        if (time != null) {
+            return time.getDayOfMonth();
+        }
+        return 0;
+    }
+
+    /**
+     * @param timeStr 时间值 - 字符串
+     * @param timeFormat 时间格式
+     * @return
+     * @description 获取日期的天数值
+     */
+    public static int getDateStrDayValue(String timeStr, String timeFormat) {
+        if(StringUtils.isNotBlank(timeStr)) {
+            LocalDate time = LocalDate.parse(timeStr, DateTimeFormatter.ofPattern(timeFormat));
+            return getDateDayValue(time);
+        }
+        return 0;
+    }
+
+    /**
+     * @param dataList     数据集
+     * @param dateAttrName 对应的属性名称,类型LocalDate
+     * @return
+     * @description 将数据转化为map 日期天 -> 数据集合
+     */
+    public static Map getDayToDataModel(List dataList, String dateAttrName) {
+        Map dayToDataModel = new HashMap();
+        if (dataList != null && dataList.size() > 0) {
+            dayToDataModel = (Map) dataList.stream()
+                    .collect(Collectors.groupingBy(obj -> {
+                        try {
+                            return getDateDayValue((LocalDate) obj.getClass()
+                                    .getMethod(PojoUtils.attrGetMethodName(dateAttrName)).invoke(obj, null));
+                        } catch (Exception e) {
+                            e.printStackTrace();
+                            return null;
+                        }
+                    }));
+        }
+        return dayToDataModel;
+    }
+
+    /**
+     * @param dataList     数据集合
+     * @param dateAttrName 日期数据
+     * @return
+     * @description 将数据转化为map 天 -> 数据集合(数据集合 map: 电梯id -> 数据集合)
+     */
+    public static Map getDayToDataMap(List dataList, String dateAttrName) {
+        Map dayToDataMap = new HashMap();
+        //将数据转化为map 日期天 -> 数据集合
+        Map dayToDataModel = getDayToDataModel(dataList, dateAttrName);
+        //将map集合转化为 liftId -> 数据集合
+        dayToDataModel.forEach((dayValue, dataModelList) -> {
+            dayToDataMap.put(dayValue, getDayToDataModel((List) dataModelList, "liftId"));
+        });
+        return dayToDataMap;
+    }
+
 }