Browse Source

Merge branch 'wanghaicheng' of lift-manager/lift-server into develop

wanghaicheng 5 years ago
parent
commit
e9d4225eb5

+ 10 - 12
lift-business-service/src/main/java/cn/com/ty/lift/business/maintenance/controller/PropertyMaintenanceController.java

@@ -2,8 +2,6 @@ package cn.com.ty.lift.business.maintenance.controller;
 
 import cn.com.ty.lift.business.maintenance.dao.entity.model.request.PropertyMaintenanceVO;
 import cn.com.ty.lift.business.maintenance.dao.entity.model.response.PropertyMtResponse;
-import cn.com.ty.lift.business.maintenance.dao.mapper.MaintenancePlanMapper;
-import cn.com.ty.lift.business.maintenance.dao.mapper.MaintenanceRecordMapper;
 import cn.com.ty.lift.business.maintenance.dao.mapper.PropertyMaintenanceMapper;
 import cn.com.ty.lift.common.constants.ApiConstants;
 import cn.com.xwy.boot.web.dto.RestResponse;
@@ -18,8 +16,6 @@ import org.springframework.web.bind.annotation.RestController;
 @AllArgsConstructor
 @RequestMapping("property")
 public class PropertyMaintenanceController {
-    private final MaintenancePlanMapper maintenancePlanMapper;
-    private final MaintenanceRecordMapper maintenanceRecordMapper;
     private final PropertyMaintenanceMapper propertyMaintenanceMapper;
 
     @PostMapping("maintenance")
@@ -31,22 +27,18 @@ public class PropertyMaintenanceController {
 
     public Page<PropertyMtResponse> propertyMtResponsePage(Page<PropertyMtResponse> propertyMtResponsePage, PropertyMaintenanceVO propertyMaintenanceVO) {
         Page<PropertyMtResponse> page;
+        Integer maintenanceStatus = ApiConstants.Maintenance.WAITING_MAINTENANCE;
         switch (propertyMaintenanceVO.getType()) {
             case 1:
-                page = propertyMaintenanceMapper
-                        .queryMaintenancePlanEveryDay(propertyMtResponsePage, ApiConstants.Maintenance.STATUS_UNFINISHED, propertyMaintenanceVO.getPlanDate(), propertyMaintenanceVO.getUserId());
                 break;
             case 2:
-                page = propertyMaintenanceMapper
-                        .queryMaintenanceRecordEveryDay(propertyMtResponsePage, propertyMaintenanceVO.getPlanDate(), propertyMaintenanceVO.getUserId());
+                maintenanceStatus = ApiConstants.Maintenance.MAINTENANCE_DOING;
                 break;
             case 3:
-                page = propertyMaintenanceMapper
-                        .queryMaintenancePlanEveryDay(propertyMtResponsePage, ApiConstants.Maintenance.STATUS_COMPLETED, propertyMaintenanceVO.getPlanDate(), propertyMaintenanceVO.getUserId());
+                maintenanceStatus = ApiConstants.Maintenance.COMPLETE;
                 break;
             case 4:
-                page = propertyMaintenanceMapper
-                        .queryMaintenancePlanEveryDay(propertyMtResponsePage, ApiConstants.Maintenance.STATUS_EXCEED, propertyMaintenanceVO.getPlanDate(), propertyMaintenanceVO.getUserId());
+                maintenanceStatus = ApiConstants.Maintenance.OVERDUE;
                 break;
             case 5:
                 //todo
@@ -55,6 +47,12 @@ public class PropertyMaintenanceController {
             default:
                 page = new Page<>();
         }
+        page = propertyMaintenanceMapper
+                .queryMaintenancePlanEveryDay(
+                        propertyMtResponsePage,
+                        maintenanceStatus,
+                        propertyMaintenanceVO.getPlanDate(),
+                        propertyMaintenanceVO.getUserId());
         return page;
     }
 }

+ 1 - 5
lift-business-service/src/main/java/cn/com/ty/lift/business/maintenance/dao/mapper/PropertyMaintenanceMapper.java

@@ -6,14 +6,10 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import org.apache.ibatis.annotations.Select;
 
 import java.time.LocalDateTime;
-import java.util.List;
 
 public interface PropertyMaintenanceMapper {
     @Select(ApiConstants.SQL.QUERY_MAINTENANCE_PLAN_EVERYDAY)
-    Page<PropertyMtResponse> queryMaintenancePlanEveryDay(Page<PropertyMtResponse> page, Integer type, LocalDateTime planDate, Long userId);
-
-    @Select(ApiConstants.SQL.QUERY_MAINTENANCE_RECORD_EVERYDAY)
-    Page<PropertyMtResponse> queryMaintenanceRecordEveryDay(Page<PropertyMtResponse> page, LocalDateTime planDate, Long userId);
+    Page<PropertyMtResponse> queryMaintenancePlanEveryDay(Page<PropertyMtResponse> page, Integer status, LocalDateTime planDate, Long userId);
 
     @Select(ApiConstants.SQL.SELECT_COUNT_FROM_TABLE)
     Integer selectCount(String table, String condition);

+ 6 - 22
lift-common/src/main/java/cn.com.ty.lift.common/constants/ApiConstants.java

@@ -337,10 +337,10 @@ public class ApiConstants {
     }
 
     public interface Maintenance {
-        Integer STATUS_UNFINISHED = 0;
-        Integer STATUS_COMPLETED = 1;
-        Integer STATUS_EXCEED = -1;
-        Integer STATUS_IN_MAINTENANCE = 1;
+        Integer WAITING_MAINTENANCE = 0;
+        Integer MAINTENANCE_DOING = 2;
+        Integer COMPLETE = 1;
+        Integer OVERDUE = -1;
     }
 
     public interface SQL {
@@ -356,27 +356,11 @@ public class ApiConstants {
                         "           left join lift l on mp.lift_id = l.id" +
                         "           left join user_info ui on mp.worker_id = ui.user_id" +
                         "           left join project p on p.id in (select project_id from project_user where user_id = #{userId})" +
-                        "          where DATE_FORMAT(mp.plan_date, '%Y%m%d') = #{planDate}" +
-                        "       and mp.status = #{type}";
+                        "          where mp.plan_date = #{planDate}" +
+                        "       and mp.status = #{status}";
 
         String SELECT_COUNT_FROM_TABLE = "select count(*) from #{table} where ${condition}";
 
-        String QUERY_MAINTENANCE_RECORD_EVERYDAY =
-                "select p.project_name," +
-                        "       l.registration_code," +
-                        "       l.device_position," +
-                        "       l.lift_type," +
-                        "       l.category," +
-                        "       ui.name," +
-                        "       mr.plan_date," +
-                        "       mr.type" +
-                        "       from maintenance_record mr" +
-                        "         left join lift l on mr.lift_id = l.id" +
-                        "         left join user_info ui on mr.worker_id = ui.user_id" +
-                        "         left join project p on p.id in (select project_id from project_user where user_id = #{userId})" +
-                        "   where DATE_FORMAT(mr.plan_date, '%Y%m%d') = #{planDate}" +
-                        "  and mr.status = '1";
-
         String QUERY_MAINTENANCE_MONTH =
                 "select p.project_name projectName," +
                         "       l.registration_code registrationCode," +