Ver Fonte

Merge branch 'huangyuan-user' of lift-manager/lift-server into develop

huangyuan há 5 anos atrás
pai
commit
8ee1c737b7

+ 1 - 1
lift-system-service/src/main/java/cn/com/ty/lift/system/constants/CommonConstants.java

@@ -243,7 +243,7 @@ public class CommonConstants {
          * 9.年检完成电梯
          */
         int[] LIFT_STATUS_ARRAY = {
-                1, 2, 3,
+                -1, 1, 2, 3,
                 4, 5, 6,
                 7, 8, 9
         };

+ 25 - 44
lift-system-service/src/main/java/cn/com/ty/lift/system/homepage/service/PlatformCalendarService.java

@@ -8,7 +8,6 @@ import cn.com.ty.lift.system.homepage.dao.mapper.CommonDataMapper;
 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;
@@ -102,8 +101,6 @@ public class PlatformCalendarService {
         //时间转化
         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 -> 急修数据)
@@ -117,7 +114,7 @@ public class PlatformCalendarService {
                 platformCalendarRequest.getRequestDateStr(), CommonConstants.PlatformCalendarConstants.REQUEST_DATE_FORMAT);
         //循环设置每日的数据
         for (int day = 1; day <= monthDayNum; day++) {
-            addCalendarLift(dayToCalendarLift, dayToMtRecord, dayToMtPlan, dayToEmergencyRecord, dayToAnnualInspection, day);
+            addCalendarLift(dayToCalendarLift, dayToMtPlan, dayToEmergencyRecord, dayToAnnualInspection, day);
         }
         return dayToCalendarLift;
     }
@@ -129,12 +126,9 @@ public class PlatformCalendarService {
      * @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);
         //获取每天的急修记录数据
@@ -142,8 +136,7 @@ public class PlatformCalendarService {
         //获取每天的年检记录数据
         Map<Long, List<AnnualInspectionDataModel>> liftIdToAnnualInspection = dayToAnnualInspection.get(day);
         //获取电梯id集合
-        Set liftIdSet = getLiftIdSet(liftIdToMtRecord, liftIdToMtPlan, liftIdToEmergencyRecord,
-                liftIdToAnnualInspection);
+        Set liftIdSet = getLiftIdSet(liftIdToMtPlan, liftIdToEmergencyRecord, liftIdToAnnualInspection);
         //状态 -> 电梯列表
         Map<Integer, List<CalendarLiftDataModel>> statusToCalendarLift = new HashMap<>();
         if (liftIdSet.size() > 0) {
@@ -151,7 +144,7 @@ public class PlatformCalendarService {
             liftIdSet.forEach(liftId -> {
                 long liftIdLong = Long.parseLong(liftId.toString());
                 //封装维保的电梯信息
-                addMaintenanceStatusLift(liftIdToMtRecord, liftIdToMtPlan, calendarLiftDataModelList, liftIdLong);
+                addMaintenanceStatusLift(liftIdToMtPlan, calendarLiftDataModelList, liftIdLong);
                 //封装急修信息
                 addEmergencyStatusLift(liftIdToEmergencyRecord, calendarLiftDataModelList, liftIdLong);
                 //封装年检信息
@@ -207,48 +200,38 @@ public class PlatformCalendarService {
      * @description 封装维保的电梯信息
      * @date 2020/2/21 2:55 下午
      */
-    private void addMaintenanceStatusLift(Map<Long, List<MtRecordDataModel>> liftIdToMtRecord,
-                                          Map<Long, List<MtPlanDataModel>> liftIdToMtPlan,
+    private void addMaintenanceStatusLift(Map<Long, List<MtPlanDataModel>> liftIdToMtPlan,
                                           List<CalendarLiftDataModel> calendarLiftDataModelList,
                                           Long liftId) {
-        if (liftIdToMtRecord != null) {
-            //获取保养记录数据
-            List<MtRecordDataModel> mtRecordDataModelList = liftIdToMtRecord.get(liftId);
-            if (mtRecordDataModelList != null && mtRecordDataModelList.size() > 0) {
-                MtRecordDataModel mtRecordDataModel = mtRecordDataModelList.get(0);
+        if (liftIdToMtPlan != null) {
+            //获取保养计划数据
+            List<MtPlanDataModel> mtPlanDataModelList = liftIdToMtPlan.get(liftId);
+            if (mtPlanDataModelList != null && mtPlanDataModelList.size() > 0) {
+                MtPlanDataModel mtPlanDataModel = mtPlanDataModelList.get(0);
                 CalendarLiftDataModel calendarLiftDataModel = new CalendarLiftDataModel(
-                        mtRecordDataModel.getLiftId(), mtRecordDataModel.getProjectName(),
-                        mtRecordDataModel.getRegistrationCode(), mtRecordDataModel.getLiftCode(),
-                        mtRecordDataModel.getWorkerName());
+                        mtPlanDataModel.getLiftId(), mtPlanDataModel.getProjectName(),
+                        mtPlanDataModel.getRegistrationCode(), mtPlanDataModel.getLiftCode(),
+                        mtPlanDataModel.getWorkerName());
                 //默认是维保已完成
                 calendarLiftDataModel.setMaintenanceStatus(3);
-                if (StringUtils.isNotBlank(mtRecordDataModel.getStatus())) {
-                    switch (mtRecordDataModel.getStatus()) {
-                        case "-2":
-                        case "-1":
-                        case "0":
+                if (mtPlanDataModel.getStatus() != null) {
+                    switch (mtPlanDataModel.getStatus()) {
+                        case 0:
+                            //待完成
                             calendarLiftDataModel.setMaintenanceStatus(1);
                             break;
-                        case "1":
+                        case 2:
+                            //维保中
                             calendarLiftDataModel.setMaintenanceStatus(2);
                             break;
+                        case -1:
+                            calendarLiftDataModel.setMaintenanceStatus(-1);
+                            break;
                     }
                 }
                 calendarLiftDataModelList.add(calendarLiftDataModel);
             }
-        } else if (liftIdToMtPlan != null) {
-            //获取保养计划数据
-            List<MtPlanDataModel> mtPlanDataModelList = liftIdToMtPlan.get(liftId);
-            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);
-            }
+
         }
     }
 
@@ -405,13 +388,11 @@ public class PlatformCalendarService {
      * @description 获取电梯id集合
      * @date 2020/2/21 1:16 下午
      */
-    private Set getLiftIdSet(Map<Long, List<MtRecordDataModel>> liftIdToMtRecord,
-                                   Map<Long, List<MtPlanDataModel>> liftIdToMtPlan,
-                                   Map<Long, List<EmergencyRecordDataModel>> liftIdToEmergencyRecord,
-                                   Map<Long, List<AnnualInspectionDataModel>> liftIdToAnnualInspection) {
+    private Set getLiftIdSet(Map<Long, List<MtPlanDataModel>> liftIdToMtPlan,
+                             Map<Long, List<EmergencyRecordDataModel>> liftIdToEmergencyRecord,
+                             Map<Long, List<AnnualInspectionDataModel>> liftIdToAnnualInspection) {
         //数据集合数组
         Map[] dataMapArray = {
-                liftIdToMtRecord,
                 liftIdToMtPlan,
                 liftIdToEmergencyRecord,
                 liftIdToAnnualInspection

+ 1 - 0
lift-system-service/src/main/resources/mapper/CommonDataMapper.xml

@@ -155,6 +155,7 @@
         lift l
         on
         mp.lift_id = l.id
+
         <include refid="liftInfoJoinSql"/>
         where
         mp.mt_company_id = #{mtCompanyId}

+ 1 - 1
lift-system-service/src/main/resources/mapper/TodoDataMapper.xml

@@ -83,7 +83,7 @@
 		LEFT JOIN lift l ON plr.lift_id = l.id
 		LEFT JOIN project p ON plr.mt_company_id = p.mt_company_id AND plr.project_id = p.id
 		LEFT JOIN maintenance_plan mp ON plr.mt_company_id = mp.mt_company_id AND plr.project_id = mp.project_id
-		AND mp.status = 0 AND mp.plan_date = (SELECT MIN(plan_date) FROM maintenance_plan WHERE status = 0
+		AND mp.status = -1 AND mp.plan_date = (SELECT MIN(plan_date) FROM maintenance_plan WHERE status = -1
 		AND mt_company_id = #{mtCompanyId,jdbcType=VARCHAR} AND lift_id = plr.lift_id) AND plr.lift_id = mp.lift_id
 		LEFT JOIN user_info ui ON plr.worker_id = ui.user_id
 		LEFT JOIN region r ON p.region_id = r.id