Prechádzať zdrojové kódy

物管端日常保养功能

wang-hai-cheng 5 rokov pred
rodič
commit
15f3b9f0d4

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

@@ -1,27 +1,38 @@
 package cn.com.ty.lift.business.maintenance.controller;
 
 import cn.com.ty.lift.business.maintenance.dao.entity.model.request.PropertyMtRequest;
+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.xwy.boot.web.dto.RestResponse;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import lombok.AllArgsConstructor;
 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 java.util.List;
+
 @RestController
 @AllArgsConstructor
 @RequestMapping("property")
 public class PropertyMaintenanceController {
     private final MaintenancePlanMapper maintenancePlanMapper;
     private final MaintenanceRecordMapper maintenanceRecordMapper;
+    private final PropertyMaintenanceMapper propertyMaintenanceMapper;
 
     @PostMapping("maintenance")
     public RestResponse maintenance(@RequestBody PropertyMtRequest propertyMtRequest) {
+        Page<PropertyMtResponse> propertyMtResponsePage = new Page<>(propertyMtRequest.getPageNum(), propertyMtRequest.getPageSize());
         //todo
         return RestResponse.success("待实现");
     }
 
-
+    public Page<PropertyMtResponse> propertyMtResponsePage(Page<PropertyMtResponse> propertyMtResponsePage, PropertyMtRequest propertyMtRequest) {
+        Page<PropertyMtResponse> propertyMtResponses =
+                propertyMaintenanceMapper.queryMaintenance(propertyMtResponsePage, propertyMtRequest.getUserId());
+        return propertyMtResponses;
+    }
 }

+ 4 - 2
lift-business-service/src/main/java/cn/com/ty/lift/business/maintenance/dao/entity/model/request/PropertyMtRequest.java

@@ -15,9 +15,11 @@ public class PropertyMtRequest {
      */
     private Integer type;
 
+    private Long userId;
+
     /**
      * 分页
      */
-    private Long pageNum;
-    private Long pageSize;
+    private Long pageNum = 1L;
+    private Long pageSize = 10L;
 }

+ 16 - 0
lift-business-service/src/main/java/cn/com/ty/lift/business/maintenance/dao/entity/model/response/PropertyMtResponse.java

@@ -0,0 +1,16 @@
+package cn.com.ty.lift.business.maintenance.dao.entity.model.response;
+
+import lombok.Data;
+
+import java.time.LocalDateTime;
+
+@Data
+public class PropertyMtResponse {
+    private String projectName;
+    private String registrationCode;
+    private String devicePosition;
+    private Object liftType;
+    private Object category;
+    private String workerName;
+    private LocalDateTime planDate;
+}

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

@@ -0,0 +1,13 @@
+package cn.com.ty.lift.business.maintenance.dao.mapper;
+
+import cn.com.ty.lift.business.maintenance.dao.entity.model.response.PropertyMtResponse;
+import cn.com.ty.lift.common.constants.ApiConstants;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import org.apache.ibatis.annotations.Select;
+
+import java.util.List;
+
+public interface PropertyMaintenanceMapper {
+    @Select(ApiConstants.SQL.QUERY_MAINTENANCE)
+    Page<PropertyMtResponse> queryMaintenance(Page<PropertyMtResponse> page, Long userId);
+}

+ 25 - 0
lift-common/src/main/java/cn.com.ty.lift.common/constants/ApiConstants.java

@@ -334,4 +334,29 @@ public class ApiConstants {
     public interface Faq {
         Integer TITLE_TYPE = 2;
     }
+
+    public interface Maintenance {
+        Integer STATUS_UNFINISHED = 1;
+    }
+
+    public interface SQL {
+        String QUERY_MAINTENANCE = "select p.project_name projectName," +
+                "       l.registration_code registrationCode," +
+                "       l.device_position devicePosition," +
+                "       l.lift_type liftType," +
+                "       l.category category," +
+                "       ui.name workerName," +
+                "       mp.plan_date planDate," +
+                "       from maintenance_plan mp" +
+                "         left join lift l on mp.lift_id = l.id" +
+                "         left join project_lift_relevance plr" +
+                "                   on l.id = plr.lift_id" +
+                "                       and plr.project_id in (select project_id" +
+                "                                              from project_user" +
+                "                                              where user_id = #{userId})" +
+                "         left join project p on mp.project_id = p.id" +
+                "         left join user_info ui on ui.user_id = mp.worker_id" +
+                "        where DATE_FORMAT(mp.plan_date, '%Y%m') = DATE_FORMAT(CURDATE(), '%Y%m')" +
+                "  and mp.status = '1'";
+    }
 }