瀏覽代碼

常见问题自动生成答案,物管端代码完善

wanghaicheng 5 年之前
父節點
當前提交
5ee4331864

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

@@ -34,19 +34,19 @@ public class PropertyMaintenanceController {
         switch (propertyMaintenanceVO.getType()) {
             case 1:
                 page = propertyMaintenanceMapper
-                        .queryMaintenanceEveryDay(propertyMtResponsePage, ApiConstants.Maintenance.STATUS_UNFINISHED, propertyMaintenanceVO.getPlanDate(), propertyMaintenanceVO.getUserId());
+                        .queryMaintenancePlanEveryDay(propertyMtResponsePage, ApiConstants.Maintenance.STATUS_UNFINISHED, propertyMaintenanceVO.getPlanDate(), propertyMaintenanceVO.getUserId());
                 break;
             case 2:
-                //todo
-                page = new Page<>();
+                page = propertyMaintenanceMapper
+                        .queryMaintenanceRecordEveryDay(propertyMtResponsePage, propertyMaintenanceVO.getPlanDate(), propertyMaintenanceVO.getUserId());
                 break;
             case 3:
                 page = propertyMaintenanceMapper
-                        .queryMaintenanceEveryDay(propertyMtResponsePage, ApiConstants.Maintenance.STATUS_COMPLETED, propertyMaintenanceVO.getPlanDate(), propertyMaintenanceVO.getUserId());
+                        .queryMaintenancePlanEveryDay(propertyMtResponsePage, ApiConstants.Maintenance.STATUS_COMPLETED, propertyMaintenanceVO.getPlanDate(), propertyMaintenanceVO.getUserId());
                 break;
             case 4:
                 page = propertyMaintenanceMapper
-                        .queryMaintenanceEveryDay(propertyMtResponsePage, ApiConstants.Maintenance.STATUS_EXCEED, propertyMaintenanceVO.getPlanDate(), propertyMaintenanceVO.getUserId());
+                        .queryMaintenancePlanEveryDay(propertyMtResponsePage, ApiConstants.Maintenance.STATUS_EXCEED, propertyMaintenanceVO.getPlanDate(), propertyMaintenanceVO.getUserId());
                 break;
             case 5:
                 //todo

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

@@ -9,6 +9,12 @@ import java.time.LocalDateTime;
 import java.util.List;
 
 public interface PropertyMaintenanceMapper {
-    @Select(ApiConstants.SQL.QUERY_MAINTENANCE_EVERYDAY)
-    Page<PropertyMtResponse> queryMaintenanceEveryDay(Page<PropertyMtResponse> page,Integer type, LocalDateTime planDate, Long userId);
+    @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);
+
+    @Select(ApiConstants.SQL.SELECT_COUNT_FROM_TABLE)
+    Integer selectCount(String table, String condition);
 }

+ 42 - 38
lift-common/src/main/java/cn.com.ty.lift.common/constants/ApiConstants.java

@@ -333,17 +333,18 @@ public class ApiConstants {
 
     public interface Faq {
         Integer TITLE_TYPE = 2;
+        Integer ANSWER_TYPE = 3;
     }
 
     public interface Maintenance {
         Integer STATUS_UNFINISHED = 0;
         Integer STATUS_COMPLETED = 1;
-        Integer STATUS_EXCEED = 2;
+        Integer STATUS_EXCEED = -1;
         Integer STATUS_IN_MAINTENANCE = 1;
     }
 
     public interface SQL {
-        String QUERY_MAINTENANCE_EVERYDAY =
+        String QUERY_MAINTENANCE_PLAN_EVERYDAY =
                 "select p.project_name projectName," +
                         "       l.registration_code registrationCode," +
                         "       l.device_position devicePosition," +
@@ -357,41 +358,44 @@ public class ApiConstants {
                         "           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}";
+
+        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," +
+                        "       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' order by mp.plan_date";
+
     }
-    
-    String QUERY_MAINTENANCE_RECORD = 
-            "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 = '1001101134377')" +
-                    "where DATE_FORMAT(mr.plan_date, '%Y-%m-%d') ='2020-05-08'" +
-                    "  and mr.status = 1";
-
-    String QUERY_MAINTENANCE_MONTH =
-            "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' order by mp.plan_date";
 }

+ 1 - 0
lift-system-service/src/main/java/cn/com/ty/lift/system/faq/service/impl/FaqServiceImpl.java

@@ -78,6 +78,7 @@ public class FaqServiceImpl extends ServiceImpl<FaqMapper, Faq> implements FaqSe
         if (faq.getType().equals(ApiConstants.Faq.TITLE_TYPE)) {
             Faq answer = new Faq();
             answer.setParentId(faq.getId());
+            answer.setType(ApiConstants.Faq.ANSWER_TYPE);
             this.save(answer);
         }
         return true;