瀏覽代碼

Merge branch 'feature-wcz' of lift-manager/lift-server into develop

wucizhong 5 年之前
父節點
當前提交
16b704ec03
共有 17 個文件被更改,包括 422 次插入53 次删除
  1. 8 0
      lift-business-service/src/main/java/cn/com/ty/lift/business/annualinspection/controller/AnnualInspectionController.java
  2. 39 9
      lift-business-service/src/main/java/cn/com/ty/lift/business/emergency/controller/EmergencyRepairController.java
  3. 13 0
      lift-business-service/src/main/java/cn/com/ty/lift/business/emergency/dto/RepairResponse.java
  4. 5 6
      lift-business-service/src/main/java/cn/com/ty/lift/business/emergency/entity/EmergencyRepair.java
  5. 28 29
      lift-business-service/src/main/java/cn/com/ty/lift/business/evaluation/controller/EvaluationController.java
  6. 12 0
      lift-business-service/src/main/java/cn/com/ty/lift/business/evaluation/dao/mapper/EvaluationMapper.java
  7. 14 0
      lift-business-service/src/main/java/cn/com/ty/lift/business/evaluation/service/EvaluationService.java
  8. 8 4
      lift-business-service/src/main/java/cn/com/ty/lift/business/maintenance/controller/MaintenanceRecordController.java
  9. 4 1
      lift-business-service/src/main/resources/mapper/emergency/EmergencyRepairMapper.xml
  10. 4 3
      lift-common/src/main/java/cn.com.ty.lift.common/utils/ValuePool.java
  11. 1 1
      lift-common/src/main/java/cn.com.ty.lift.common/verify/Validator.java
  12. 2 0
      lift-enterprise-service/src/main/java/cn/com/ty/lift/enterprise/oa/controller/AnnouncementController.java
  13. 3 0
      lift-enterprise-service/src/main/java/cn/com/ty/lift/enterprise/oa/controller/AttendanceController.java
  14. 2 0
      lift-enterprise-service/src/main/java/cn/com/ty/lift/enterprise/oa/controller/LiftCertificateController.java
  15. 2 0
      lift-enterprise-service/src/main/java/cn/com/ty/lift/enterprise/oa/dto/LiftCertificateRequest.java
  16. 1 0
      lift-enterprise-service/src/main/java/cn/com/ty/lift/enterprise/oa/entity/LiftCertificate.java
  17. 276 0
      sql/0.delete_duplicate_evaluation.sql

+ 8 - 0
lift-business-service/src/main/java/cn/com/ty/lift/business/annualinspection/controller/AnnualInspectionController.java

@@ -104,6 +104,13 @@ public class AnnualInspectionController {
     @PostMapping("page")
     @Validation(fields = "mtCompanyId")
     public RestResponse page(@Val @RequestBody InspectionRequest request) {
+        //计划与执行: 按年检时间由近及远排序,已完成: 按年检完成时间由近及远排序
+        if(Objects.equals(request.getStatus(), ValuePool.INSPECTION_STATUS_TO_DO)){
+            request.addDesc("plan_date");
+        }
+        if(Objects.equals(request.getStatus(), ValuePool.INSPECTION_STATUS_COMPLETE)){
+            request.addDesc("finish_time");
+        }
         IPage<InspectionResponse> pages = annualInspectionService.pageByCondition(request);
         long count = annualInspectionService.countByCondition(request);
         return RestResponse.success(CountPage.getCountPage(count, pages));
@@ -128,6 +135,7 @@ public class AnnualInspectionController {
     @PostMapping("toConfirm")
     @Validation(fields = {"mtCompanyId"})
     public RestResponse toConfirm(@Val @RequestBody InspectionRequest request){
+        request.addAsc("annual_inspection_date");
         IPage<LiftAnnualInspectionResponse> pages = liftService.toConfirmAnnualInspection(request.getPage(), request.getMtCompanyId(), 45);
         return RestResponse.success(pages);
     }

+ 39 - 9
lift-business-service/src/main/java/cn/com/ty/lift/business/emergency/controller/EmergencyRepairController.java

@@ -208,7 +208,7 @@ public class EmergencyRepairController {
     }
 
     /**
-     * 分页查询急修中的 status = 2
+     * 分页查询急修中的 status = 0, 1
      *
      * @param request RepairRequest
      * @return RestResponse
@@ -216,6 +216,8 @@ public class EmergencyRepairController {
     @PostMapping("list")
     @Validation(fields = "mtCompanyId")
     public RestResponse list(@Val @RequestBody RepairRequest request) {
+        //按状态排序,待修理--修理中;同一状态下按等待时间最长的放在最上面,加一列等待时间列表
+        request.addAsc("status");
         IPage<RepairResponse> pages = emergencyRepairService.pageByRepairing(request);
         long count = pages.getTotal();
         return RestResponse.success(CountPage.getCountPage(count, pages));
@@ -249,6 +251,12 @@ public class EmergencyRepairController {
     @PostMapping("page")
     @Validation(fields = {"status", "mtCompanyId"})
     public RestResponse page(@Val @RequestBody RepairRequest request) {
+        //已完成: 按恢复时间由近及远排序, 已关闭: 按报修时间由近及远排序
+        if (Objects.equals(request.getStatus(), ValuePool.EMERGENCY_STATE_COMPLETE)) {
+            request.addDesc("recovery_date");
+        } else {
+            request.addDesc("caller_date");
+        }
         return pageByCondition(request);
     }
 
@@ -260,6 +268,8 @@ public class EmergencyRepairController {
     @PostMapping("pageCost")
     @Validation(fields = {"mtCompanyId"})
     public RestResponse pageCost(@Val @RequestBody RepairRequest request) {
+        //急修收款: 按结束时间由近及远排序
+        request.addDesc("update_date");
         return pageByCondition(request);
     }
 
@@ -370,7 +380,12 @@ public class EmergencyRepairController {
         Validate.notNull(entity, ValuePool.EMERGENCY_NOT_EXIST);
 
         Validate.equals(entity.getStatus(), ValuePool.EMERGENCY_STATE_TO_DO, ValuePool.EMERGENCY_MUST_TO_DO);
-        entity.setTakingTime(request.getTakingTime());
+        LocalDateTime assignTime = entity.getAssignTime();
+        LocalDateTime takingTime = entity.getTakingTime();
+        if(Objects.nonNull(assignTime)){
+            Validate.isTrue(assignTime.isBefore(takingTime), String.format(ValuePool.EMERGENCY_PROCESS_TIME_ILLEGAL,"派单时间", assignTime, assignTime));
+        }
+        entity.setTakingTime(takingTime);
         //todo:修改电梯的业务状态为急修中,如果存在维保中,要修改
         entity.setStatus(ValuePool.EMERGENCY_STATE_DOING);
         RestResponse result = emergencyRepairService.taking(entity);
@@ -409,7 +424,12 @@ public class EmergencyRepairController {
         Validate.notNull(entity, ValuePool.EMERGENCY_NOT_EXIST);
 
         Validate.equals(entity.getStatus(), ValuePool.EMERGENCY_STATE_DOING, ValuePool.EMERGENCY_MUST_IN_DOING);
-        entity.setArriveTime(request.getArriveTime());
+        LocalDateTime takingTime = entity.getTakingTime();
+        LocalDateTime arriveTime = request.getArriveTime();
+        if(Objects.nonNull(takingTime)){
+            Validate.isTrue(takingTime.isBefore(arriveTime), String.format(ValuePool.EMERGENCY_PROCESS_TIME_ILLEGAL,"接单时间", takingTime, takingTime));
+        }
+        entity.setArriveTime(arriveTime);
         entity.setPosition(request.getPosition());
 
         boolean result = emergencyRepairService.updateById(entity);
@@ -448,7 +468,12 @@ public class EmergencyRepairController {
         Validate.notNull(entity, ValuePool.EMERGENCY_NOT_EXIST);
 
         Validate.equals(entity.getStatus(), ValuePool.EMERGENCY_STATE_DOING, ValuePool.EMERGENCY_MUST_IN_DOING);
-        entity.setStopDate(request.getStopDate());
+        LocalDateTime arriveTime = entity.getArriveTime();
+        LocalDateTime stopDate = request.getStopDate();
+        if(Objects.nonNull(arriveTime)){
+            Validate.isTrue(arriveTime.isBefore(stopDate), String.format(ValuePool.EMERGENCY_PROCESS_TIME_ILLEGAL,"到达时间", arriveTime, arriveTime));
+        }
+        entity.setStopDate(stopDate);
         entity.setSafetyConfirm(request.getSafetyConfirm());
 
         boolean result = emergencyRepairService.updateById(entity);
@@ -605,11 +630,11 @@ public class EmergencyRepairController {
         Validate.notNull(repair, ValuePool.EMERGENCY_NOT_EXIST);
 
         Validate.equals(repair.getStatus(), ValuePool.EMERGENCY_STATE_COMPLETE, ValuePool.EMERGENCY_MUST_COMPLETE);
-        //根据急修中的评价标识判断
+        //1. 根据急修中的评价标识判断
         Validate.notEquals(1, repair.getHasEvaluate(), ValuePool.EMERGENCY_HAD_EVALUATE);
-        //查询急修评价记录判断
-//        int has = evaluationService.countByRecord(entity.getRecordId(), ValuePool.EVALUATE_SOURCE_EMERGENCY);
-//        Validate.notTrue(has > 0, ValuePool.EMERGENCY_HAD_EVALUATE);
+        //2. 查询急修评价记录判断
+        int has = evaluationService.countByRecord(entity.getRecordId(), ValuePool.EVALUATE_SOURCE_EMERGENCY);
+        Validate.notTrue(has > 0, ValuePool.EMERGENCY_HAD_EVALUATE);
         //来源(1 维保;2 急修)
         entity.setSource(ValuePool.EVALUATE_SOURCE_EMERGENCY);
         entity.setLiftId(repair.getLiftId());
@@ -635,6 +660,11 @@ public class EmergencyRepairController {
         EmergencyRepair entity = emergencyRepairService.getById(id);
         Validate.notNull(entity, ValuePool.EMERGENCY_NOT_EXIST);
         Validate.equals(entity.getStatus(), ValuePool.EMERGENCY_STATE_DOING, ValuePool.EMERGENCY_MUST_IN_DOING);
+        LocalDateTime stopDate = entity.getStopDate();
+        LocalDateTime recoveryDate = request.getRecoveryDate();
+        if(Objects.nonNull(stopDate)){
+            Validate.isTrue(stopDate.isBefore(recoveryDate), String.format(ValuePool.EMERGENCY_PROCESS_TIME_ILLEGAL,"停梯时间", stopDate, stopDate));
+        }
         List<ErRecordImg> erRecordImgs = new ArrayList<>();
         List<String> erRecordImg = request.getErRecordImg();
         for (int i = 0; i < erRecordImg.size(); i++) {
@@ -652,7 +682,7 @@ public class EmergencyRepairController {
         entity.setFaultHandle(request.getFaultHandle());
         entity.setFaultNature(request.getFaultNature());
         entity.setFaultDuty(request.getFaultDuty());
-        entity.setRecoveryDate(request.getRecoveryDate());
+        entity.setRecoveryDate(recoveryDate);
         //修改状态已完成
         entity.setStatus(ValuePool.EMERGENCY_STATE_COMPLETE);
         RestResponse result = emergencyRepairService.repairOrder(entity, erRecordImgs);

+ 13 - 0
lift-business-service/src/main/java/cn/com/ty/lift/business/emergency/dto/RepairResponse.java

@@ -96,6 +96,19 @@ public class RepairResponse extends EmergencyRepair{
     public String getRepairDuration() {
         return DateUtil.formatBetween(this.repairDiff, BetweenFormater.Level.SECOND);
     }
+    /**
+     * 接单等待毫秒数
+     */
+    private long waitDiff;
+
+    private String waitDuration;
+    /**
+     * 重写getter方法,换算时长 XX天XX小时XX分XX秒
+     */
+    public String getWaitDuration() {
+        return DateUtil.formatBetween(this.waitDiff, BetweenFormater.Level.SECOND);
+    }
+
     /**
      * 急修评价
      */

+ 5 - 6
lift-business-service/src/main/java/cn/com/ty/lift/business/emergency/entity/EmergencyRepair.java

@@ -105,30 +105,30 @@ public class EmergencyRepair extends BaseEntity {
     /**
      * 停梯时间
      */
-    @PastOrPresent(message = "停梯时间不能早于标准北京时间")
+    @Null(message = "停梯时间必须为空")
     private LocalDateTime stopDate;
 
     /**
      * 派单时间 急修单创建时间
      */
-    @PastOrPresent(message = "派单时间不能早于标准北京时间")
+    @Null(message = "派单时间必须为空")
     private LocalDateTime assignTime;
 
     /**
      * 接单时间 app端维保工确认
      */
-    @PastOrPresent(message = "接单时间不能早于标准北京时间")
+    @Null(message = "接单时间必须为空")
     private LocalDateTime takingTime;
 
     /**
      * 到达时间 app端维保工打卡
      */
-    @PastOrPresent(message = "到达时间不能早于标准北京时间")
+    @Null(message = "到达时间必须为空")
     private LocalDateTime arriveTime;
     /**
      * 恢复时间
      */
-    @PastOrPresent(message = "恢复时间不能早于标准北京时间")
+    @Null(message = "恢复时间必须为空")
     private LocalDateTime recoveryDate;
 
     /**
@@ -290,6 +290,5 @@ public class EmergencyRepair extends BaseEntity {
     /**
      * 是否已经评价 0:未评价,1:已评价
      */
-    @Range(max = 1,message = "评价状态有误")
     private Integer hasEvaluate;
 }

+ 28 - 29
lift-business-service/src/main/java/cn/com/ty/lift/business/evaluation/controller/EvaluationController.java

@@ -4,13 +4,17 @@ package cn.com.ty.lift.business.evaluation.controller;
 import cn.com.ty.lift.business.evaluation.dao.entity.Evaluation;
 import cn.com.ty.lift.business.evaluation.service.EvaluationService;
 import cn.com.xwy.boot.web.dto.RestResponse;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import cn.hutool.core.io.FileUtil;
+import cn.hutool.core.util.StrUtil;
 import lombok.AllArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
 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.io.File;
+import java.util.List;
+
 /**
  * <p>
  * 保养单用户评价 前端控制器
@@ -19,6 +23,7 @@ import org.springframework.web.bind.annotation.RestController;
  * @author huangyuan
  * @since 2019-12-31
  */
+@Slf4j
 @RestController
 @RequestMapping("/evaluation")
 @AllArgsConstructor
@@ -26,34 +31,28 @@ public class EvaluationController {
 
     private final EvaluationService evaluationService;
 
-    /**
-     * @param entity 维保,急修记录
-     * @return RestResponse
-     * @description 保存评价信息
-     * @date 2019-12-31 15:46
-     */
-    @PostMapping("/save")
-    public RestResponse save(@RequestBody Evaluation entity) {
-        if (evaluationService.save(entity)) {
-            return RestResponse.success(null, "成功");
+    @PostMapping("removeDuplicate")
+    public RestResponse removeDuplicate(){
+        List<Evaluation> duplicate = evaluationService.listDuplicateForSameRecord();
+        if(duplicate.isEmpty()){
+            return RestResponse.success(true);
         }
-        return RestResponse.fail();
-    }
-
-    /**
-     * 查看评价信息
-     *
-     * @param entity 维保,急修记录id
-     * @return RestResponse
-     * @date 2020-01-11 09:51
-     */
-    @PostMapping
-    public RestResponse evaluation(@RequestBody Evaluation entity) {
-        Evaluation one = evaluationService.getOne(new QueryWrapper<Evaluation>()
-                .eq(entity.getRecordId() != null, "record_id", entity.getRecordId()));
-        if (null == one) {
-            return RestResponse.success();
+        StringBuilder stringBuilder = new StringBuilder();
+        for (Evaluation evaluation : duplicate) {
+            Long recordId = evaluation.getRecordId();
+            Integer source = evaluation.getSource();
+            log.info("recordId: {}, source: {}", recordId, source);
+            List<Long> toDelete = evaluationService.listToDelete(recordId, source);
+            stringBuilder.append("-- delete recordId: ").append(recordId).append(", source: ").append(source).append("\n");
+            if(toDelete.isEmpty()){
+                Long oneToDelete = evaluationService.findOneToDelete(recordId, source);
+                stringBuilder.append("DELETE FROM evaluation WHERE id = ").append(oneToDelete).append(";\n");
+            }else {
+                stringBuilder.append("DELETE FROM evaluation WHERE id IN (").append(StrUtil.join(",", toDelete.toArray())).append(")").append(";\n");
+            }
         }
-        return RestResponse.success(one);
+        System.err.println(stringBuilder.toString());
+        FileUtil.writeString(stringBuilder.toString(), new File("./sql/0.delete_duplicate_evaluation.sql"), "utf-8");
+        return RestResponse.success(true);
     }
 }

+ 12 - 0
lift-business-service/src/main/java/cn/com/ty/lift/business/evaluation/dao/mapper/EvaluationMapper.java

@@ -2,6 +2,10 @@ package cn.com.ty.lift.business.evaluation.dao.mapper;
 
 import cn.com.ty.lift.business.evaluation.dao.entity.Evaluation;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+
+import java.util.List;
 
 /**
  * <p>
@@ -13,4 +17,12 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
 public interface EvaluationMapper extends BaseMapper<Evaluation> {
 
+    @Select("SELECT ev.record_id, ev.source FROM evaluation ev GROUP BY ev.record_id, ev.source HAVING count(*) > 1")
+    List<Evaluation> listDuplicateForSameRecord();
+
+    @Select("SELECT ev.id FROM evaluation ev WHERE ev.post_date < (SELECT MAX(ev.post_date) FROM evaluation ev WHERE ev.record_id = #{recordId} AND ev.source = #{source}) AND ev.record_id = #{recordId} AND ev.source = #{source}")
+    List<Long> listToDelete(@Param("recordId") Long recordId, @Param("source") int source);
+
+    @Select("SELECT ev.id FROM evaluation ev WHERE ev.record_id = #{recordId} AND ev.source = #{source} LIMIT 1")
+    Long findOneToDelete(@Param("recordId") Long recordId, @Param("source") int source);
 }

+ 14 - 0
lift-business-service/src/main/java/cn/com/ty/lift/business/evaluation/service/EvaluationService.java

@@ -7,6 +7,8 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+
 /**
  * <p>
  * 保养单用户评价 服务实现类
@@ -41,4 +43,16 @@ public class EvaluationService extends ServiceImpl<EvaluationMapper, Evaluation>
         lambdaQueryWrapper.eq(Evaluation::getSource, source);
         return count(lambdaQueryWrapper);
     }
+
+    public List<Evaluation> listDuplicateForSameRecord(){
+        return baseMapper.listDuplicateForSameRecord();
+    }
+
+    public List<Long> listToDelete(Long recordId, int source){
+        return baseMapper.listToDelete(recordId, source);
+    }
+
+    public Long findOneToDelete(Long recordId, int source){
+        return baseMapper.findOneToDelete(recordId, source);
+    }
 }

+ 8 - 4
lift-business-service/src/main/java/cn/com/ty/lift/business/maintenance/controller/MaintenanceRecordController.java

@@ -69,6 +69,8 @@ public class MaintenanceRecordController {
     @PostMapping("pageRecord")
     @Validation(fields = {"mtCompanyId"})
     public RestResponse pageRecord(@Val @RequestBody MtRecordRequest request) {
+        //保养单: 按照执行日期由近及远排序
+        request.addDesc("work_date");
         IPage<MtRecordResponse> pages = maintenanceRecordService.pageRecordByCondition(request);
         long count = maintenanceRecordService.countRecordByCondition(request);
         return RestResponse.success(CountPage.getCountPage(count, pages));
@@ -83,6 +85,8 @@ public class MaintenanceRecordController {
     @PostMapping("pagePlan")
     @Validation(fields = {"mtCompanyId"})
     public RestResponse pagePlan(@Val @RequestBody MtPlanRequest request) {
+        //计划超期:按计划保养时间由近及远排序
+        request.addDesc("plan_date");
         IPage<MtPlanResponse> pages = maintenancePlanService.pagePlanByCondition(request);
         Validate.notNull(pages, ValuePool.MAINTENANCE_PLAN_NOT_EXIST);
         List<MtPlanResponse> records = pages.getRecords();
@@ -339,11 +343,11 @@ public class MaintenanceRecordController {
         Validate.notNull(record, ValuePool.MAINTENANCE_RECORD_NOT_EXIST);
         //状态 -1:待审核,0:待处理,1:已签到,保养中,2:完成保养,待评价,3:完成。
         Validate.isTrue("2".equals(record.getStatus()), ValuePool.MAINTENANCE_RECORD_MUST_COMPLETE);
-        //根据维保记录中的评价标识判断
+        //1. 根据维保记录中的评价标识判断
         Validate.notEquals(1, record.getHasEvaluate(), ValuePool.MAINTENANCE_HAD_EVALUATE);
-        //查询评价记录判断
-//        int has = evaluationService.countByRecord(entity.getRecordId(), ValuePool.EVALUATE_SOURCE_MAINTENANCE);
-//        Validate.notTrue(has > 0, ValuePool.MAINTENANCE_HAD_EVALUATE);
+        //2. 查询评价记录判断
+        int has = evaluationService.countByRecord(entity.getRecordId(), ValuePool.EVALUATE_SOURCE_MAINTENANCE);
+        Validate.notTrue(has > 0, ValuePool.MAINTENANCE_HAD_EVALUATE);
         //来源(1 维保;2 急修)
         entity.setSource(ValuePool.EVALUATE_SOURCE_MAINTENANCE);
         entity.setLiftId(record.getLiftId());

+ 4 - 1
lift-business-service/src/main/resources/mapper/emergency/EmergencyRepairMapper.xml

@@ -65,6 +65,7 @@
         <result column="worker_mobile" property="workerMobile" jdbcType="VARCHAR" />
 		<result column="lift_company_status" property="liftCompanyStatus" jdbcType="VARCHAR" />
 		<result column="repair_diff" property="repairDiff" jdbcType="BIGINT" />
+		<result column="wait_diff" property="waitDiff" jdbcType="BIGINT" />
         <result column="advice" property="advice" jdbcType="VARCHAR" />
         <result column="img_url" property="imgUrl" jdbcType="VARCHAR" />
         <result column="service_level" property="serviceLevel" jdbcType="INTEGER" />
@@ -88,7 +89,8 @@
 				pr.project_name,
                 pr.project_code,
                 pr.address AS project_address,
-				pclr.lift_company_status
+				pclr.lift_company_status,
+                TimeStampDiff(SECOND ,er.assign_time,ifnull(er.taking_time, now())) * 1000 AS wait_diff
 			FROM
 				emergency_repair er
 				LEFT JOIN user_info ui ON ui.user_id = er.creator_id
@@ -100,6 +102,7 @@
 			<if test="cond.mtCompanyId != null and cond.mtCompanyId > 0">
 				AND er.mt_company_id = #{cond.mtCompanyId}
 			</if>
+            ORDER BY wait_diff DESC
 			) t
           LEFT JOIN user_info ui ON ui.user_id = t.worker_id1
     </select>

+ 4 - 3
lift-common/src/main/java/cn.com.ty.lift.common/utils/ValuePool.java

@@ -217,12 +217,13 @@ public interface ValuePool {
     String   EMERGENCY_FAULT_MISSING                  = "缺少电梯故障项";
     String   EMERGENCY_HAVE_REPAIRING                 = "该电梯存在未完成的急修,无法创建";
     String   EMERGENCY_HAD_TAKEN                      = "急修已经接单,不能转派";
-    String   EMERGENCY_MUST_TO_DO                     = "急修才能操作";
-    String   EMERGENCY_MUST_IN_DOING                  = "急修中才能操作";
+    String   EMERGENCY_MUST_TO_DO                     = "急修状态为待处理才能操作";
+    String   EMERGENCY_MUST_IN_DOING                  = "急修状态为处理中才能操作";
     String   EMERGENCY_MUST_COMPLETE                  = "急修完成后才能操作";
     String   EMERGENCY_HAD_EVALUATE                   = "急修已经评价了";
     String   EMERGENCY_COST_INCORRECT_AMOUNT          = "急修收费项金额有误";
-    String   EMERGENCY_LIFT_IS_IN_INSPECTION          = "电梯正在年检中,无法创建";
+    String   EMERGENCY_LIFT_IS_IN_INSPECTION          = "电梯正在年检中,无法创建急修";
+    String   EMERGENCY_PROCESS_TIME_ILLEGAL           = "急修处理时间不能早于上次操作时间(%s: %tF %tT)";
     //===================上传相关状态值和判断方法======================================
     /**
      * 图片上传最大大小10M * 1024 * 1024

+ 1 - 1
lift-common/src/main/java/cn.com.ty.lift.common/verify/Validator.java

@@ -1087,7 +1087,7 @@ public class Validator {
          *
          * @param value      any object value, but only work for {@link CharSequence} and {@link Number}
          * @param annotation the {@link Max} annotation get from the field.
-         * @return if return {@code ture} that the value is less than or equal the minimum, otherwise no.
+         * @return if return {@code true} that the value is less than or equal the minimum, otherwise no.
          */
         private boolean validate(Object value, Min annotation) {
             if (Objects.isNull(annotation)) {

+ 2 - 0
lift-enterprise-service/src/main/java/cn/com/ty/lift/enterprise/oa/controller/AnnouncementController.java

@@ -74,6 +74,8 @@ public class AnnouncementController {
     @PostMapping("list")
     @Validation(fields = "mtCompanyId")
     public RestResponse list(@Val @RequestBody AnnouncementRequest request) {
+        //公告管理: 按发布时间由近及远排序
+        request.addDesc("post_date");
         IPage<AnnouncementResponse> pages = announcementService.pageByCondition(request);
         List<AnnouncementResponse> records = pages.getRecords();
         long count = announcementService.countByMtCompany(request.getMtCompanyId());

+ 3 - 0
lift-enterprise-service/src/main/java/cn/com/ty/lift/enterprise/oa/controller/AttendanceController.java

@@ -93,6 +93,8 @@ public class AttendanceController {
     @PostMapping("list")
     @Validation(fields = "mtCompanyId")
     public RestResponse list(@Val @RequestBody AttendanceRequest request) {
+        //签到管理: 按日期和打卡时间由近及远排序
+        request.addDesc("create_date");
         if (Objects.isNull(request.getClockTime())) {
             request.setBegin(LocalDate.now().plusDays(0 - DateUtils.daysOfYear()));
             request.setEnd(LocalDate.now());
@@ -260,6 +262,7 @@ public class AttendanceController {
     @PostMapping("pageByUser")
     @Validation(fields = {"userId", "clockTime"})
     public RestResponse pageByUser(@Val @RequestBody AttendanceRequest request) {
+        request.addDesc("create_date");
         if (Objects.isNull(request.getClockTime())) {
             request.setBegin(LocalDate.now().plusDays(0 - DateUtils.daysOfYear()));
             request.setEnd(LocalDate.now());

+ 2 - 0
lift-enterprise-service/src/main/java/cn/com/ty/lift/enterprise/oa/controller/LiftCertificateController.java

@@ -57,6 +57,8 @@ public class LiftCertificateController {
     @PostMapping("list")
     @Validation(fields = "mtCompanyId")
     public RestResponse list(@Val @RequestBody LiftCertificateRequest request) {
+        //维保工操作证 :按照有效期,由近及远排序
+        request.addDesc("expiration_date");
         IPage<LiftCertificateResponse> pages = liftCertificateService.pageByCondition(request);
         long count = liftCertificateService.countByCondition(request);
         return RestResponse.success(CountPage.getCountPage(count, pages));

+ 2 - 0
lift-enterprise-service/src/main/java/cn/com/ty/lift/enterprise/oa/dto/LiftCertificateRequest.java

@@ -4,6 +4,7 @@ import cn.com.ty.lift.common.model.PageRequest;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 
+import javax.validation.constraints.Future;
 import javax.validation.constraints.Min;
 import javax.validation.constraints.NotBlank;
 import javax.validation.constraints.NotNull;
@@ -69,6 +70,7 @@ public class LiftCertificateRequest extends PageRequest {
      * 有效期
      */
     @NotNull(message = "缺少操作证有效期")
+    @Future(message = "操作证有效期已过期")
     private LocalDate expirationDate;
 
     /**

+ 1 - 0
lift-enterprise-service/src/main/java/cn/com/ty/lift/enterprise/oa/entity/LiftCertificate.java

@@ -55,6 +55,7 @@ public class LiftCertificate extends BaseEntity {
      * 有效期
      */
     @NotNull(message = "缺少操作证有效期")
+    @Future(message = "操作证有效期已过期")
     private LocalDate expirationDate;
 
     /**

+ 276 - 0
sql/0.delete_duplicate_evaluation.sql

@@ -0,0 +1,276 @@
+-- delete recordId: 1001109110677, source: 1
+DELETE FROM evaluation WHERE id = 1001113105573;
+-- delete recordId: 1001109116468, source: 1
+DELETE FROM evaluation WHERE id = 1001113110796;
+-- delete recordId: 1001109122229, source: 1
+DELETE FROM evaluation WHERE id = 1001113115978;
+-- delete recordId: 1001109124741, source: 1
+DELETE FROM evaluation WHERE id = 1001113118359;
+-- delete recordId: 1001109135104, source: 1
+DELETE FROM evaluation WHERE id = 1001113128171;
+-- delete recordId: 1001109143479, source: 1
+DELETE FROM evaluation WHERE id = 1001113136169;
+-- delete recordId: 1001109157405, source: 1
+DELETE FROM evaluation WHERE id = 1001113149472;
+-- delete recordId: 1001109183699, source: 1
+DELETE FROM evaluation WHERE id = 1001113175022;
+-- delete recordId: 1001109189364, source: 1
+DELETE FROM evaluation WHERE id = 1001113179878;
+-- delete recordId: 1001109205846, source: 1
+DELETE FROM evaluation WHERE id = 1001113194523;
+-- delete recordId: 1001109206348, source: 1
+DELETE FROM evaluation WHERE id = 1001113194952;
+-- delete recordId: 1001109212843, source: 1
+DELETE FROM evaluation WHERE id = 1001113201054;
+-- delete recordId: 1001109219361, source: 1
+DELETE FROM evaluation WHERE id = 1001113207329;
+-- delete recordId: 1001109224933, source: 1
+DELETE FROM evaluation WHERE id = 1001113212558;
+-- delete recordId: 1001109228387, source: 1
+DELETE FROM evaluation WHERE id = 1001113215404;
+-- delete recordId: 1001109240135, source: 1
+DELETE FROM evaluation WHERE id = 1001113227202;
+-- delete recordId: 1001109255735, source: 1
+DELETE FROM evaluation WHERE id = 1001113241140;
+-- delete recordId: 1001109258277, source: 1
+DELETE FROM evaluation WHERE id = 1001113243491;
+-- delete recordId: 1001109298039, source: 1
+DELETE FROM evaluation WHERE id = 1001113280490;
+-- delete recordId: 1001109337814, source: 1
+DELETE FROM evaluation WHERE id = 1001113317134;
+-- delete recordId: 1001109381022, source: 1
+DELETE FROM evaluation WHERE id = 1001113358722;
+-- delete recordId: 1001109410069, source: 1
+DELETE FROM evaluation WHERE id = 1001113386839;
+-- delete recordId: 1001109468263, source: 1
+DELETE FROM evaluation WHERE id = 1001113443674;
+-- delete recordId: 1001109473399, source: 1
+DELETE FROM evaluation WHERE id = 1001113448201;
+-- delete recordId: 1001109568560, source: 1
+DELETE FROM evaluation WHERE id = 1001113538980;
+-- delete recordId: 1001109573009, source: 1
+DELETE FROM evaluation WHERE id = 1001113542953;
+-- delete recordId: 1001109582006, source: 1
+DELETE FROM evaluation WHERE id = 1001113551355;
+-- delete recordId: 1001109647295, source: 1
+DELETE FROM evaluation WHERE id = 1001113613051;
+-- delete recordId: 1001109652266, source: 1
+DELETE FROM evaluation WHERE id = 1001113617942;
+-- delete recordId: 1001109663687, source: 1
+DELETE FROM evaluation WHERE id = 1001113628587;
+-- delete recordId: 1001109671779, source: 1
+DELETE FROM evaluation WHERE id = 1001113636461;
+-- delete recordId: 1001109705483, source: 1
+DELETE FROM evaluation WHERE id = 1001113669253;
+-- delete recordId: 1001109705524, source: 1
+DELETE FROM evaluation WHERE id = 1001113668690;
+-- delete recordId: 1001109735592, source: 1
+DELETE FROM evaluation WHERE id = 1001113697465;
+-- delete recordId: 1001109742836, source: 1
+DELETE FROM evaluation WHERE id = 1001113704810;
+-- delete recordId: 1001109769098, source: 1
+DELETE FROM evaluation WHERE id = 1001113729353;
+-- delete recordId: 1001109770240, source: 1
+DELETE FROM evaluation WHERE id = 1001113730480;
+-- delete recordId: 1001109782570, source: 1
+DELETE FROM evaluation WHERE id = 1001113742202;
+-- delete recordId: 1001109793028, source: 1
+DELETE FROM evaluation WHERE id = 1001113752577;
+-- delete recordId: 1001109810011, source: 1
+DELETE FROM evaluation WHERE id = 1001113768652;
+-- delete recordId: 1001109822320, source: 1
+DELETE FROM evaluation WHERE id = 1001113780486;
+-- delete recordId: 1001109836211, source: 1
+DELETE FROM evaluation WHERE id = 1001113793209;
+-- delete recordId: 1001109839937, source: 1
+DELETE FROM evaluation WHERE id = 1001113797018;
+-- delete recordId: 1001109840175, source: 1
+DELETE FROM evaluation WHERE id = 1001113797203;
+-- delete recordId: 1001109840752, source: 1
+DELETE FROM evaluation WHERE id = 1001113797532;
+-- delete recordId: 1001109841868, source: 1
+DELETE FROM evaluation WHERE id = 1001113798831;
+-- delete recordId: 1001109842250, source: 1
+DELETE FROM evaluation WHERE id = 1001113798834;
+-- delete recordId: 1001109844491, source: 1
+DELETE FROM evaluation WHERE id = 1001113801282;
+-- delete recordId: 1001109845653, source: 1
+DELETE FROM evaluation WHERE id = 1001113802358;
+-- delete recordId: 1001109847552, source: 1
+DELETE FROM evaluation WHERE id = 1001113805620;
+-- delete recordId: 1001109857088, source: 1
+DELETE FROM evaluation WHERE id = 1001113813814;
+-- delete recordId: 1001109859451, source: 1
+DELETE FROM evaluation WHERE id = 1001113815436;
+-- delete recordId: 1001109863779, source: 1
+DELETE FROM evaluation WHERE id = 1001113819644;
+-- delete recordId: 1001109879266, source: 1
+DELETE FROM evaluation WHERE id = 1001113834571;
+-- delete recordId: 1001109879352, source: 1
+DELETE FROM evaluation WHERE id = 1001113834509;
+-- delete recordId: 1001109879491, source: 1
+DELETE FROM evaluation WHERE id = 1001113834505;
+-- delete recordId: 1001109879492, source: 1
+DELETE FROM evaluation WHERE id = 1001113834500;
+-- delete recordId: 1001109879662, source: 1
+DELETE FROM evaluation WHERE id = 1001113834592;
+-- delete recordId: 1001109879776, source: 1
+DELETE FROM evaluation WHERE id = 1001113834637;
+-- delete recordId: 1001109879943, source: 1
+DELETE FROM evaluation WHERE id = 1001113834635;
+-- delete recordId: 1001109880139, source: 1
+DELETE FROM evaluation WHERE id = 1001113834916;
+-- delete recordId: 1001109880684, source: 1
+DELETE FROM evaluation WHERE id = 1001113835901;
+-- delete recordId: 1001109889477, source: 1
+DELETE FROM evaluation WHERE id = 1001113844314;
+-- delete recordId: 1001109890836, source: 1
+DELETE FROM evaluation WHERE id = 1001113845062;
+-- delete recordId: 1001109894452, source: 1
+DELETE FROM evaluation WHERE id = 1001113848630;
+-- delete recordId: 1001109896277, source: 1
+DELETE FROM evaluation WHERE id = 1001113850756;
+-- delete recordId: 1001109898958, source: 1
+DELETE FROM evaluation WHERE id = 1001113852639;
+-- delete recordId: 1001109904163, source: 1
+DELETE FROM evaluation WHERE id = 1001113857759;
+-- delete recordId: 1001109904416, source: 1
+DELETE FROM evaluation WHERE id = 1001113857829;
+-- delete recordId: 1001109911679, source: 1
+DELETE FROM evaluation WHERE id = 1001113865225;
+-- delete recordId: 1001109916797, source: 1
+DELETE FROM evaluation WHERE id = 1001113869958;
+-- delete recordId: 1001109927298, source: 1
+DELETE FROM evaluation WHERE id = 1001113880025;
+-- delete recordId: 1001109931414, source: 1
+DELETE FROM evaluation WHERE id = 1001113884311;
+-- delete recordId: 1001109935678, source: 1
+DELETE FROM evaluation WHERE id = 1001113888322;
+-- delete recordId: 1001109937130, source: 1
+DELETE FROM evaluation WHERE id = 1001113889493;
+-- delete recordId: 1001109937647, source: 1
+DELETE FROM evaluation WHERE id = 1001113890083;
+-- delete recordId: 1001109944704, source: 1
+DELETE FROM evaluation WHERE id = 1001113897296;
+-- delete recordId: 1001109948427, source: 1
+DELETE FROM evaluation WHERE id = 1001113900337;
+-- delete recordId: 1001109949029, source: 1
+DELETE FROM evaluation WHERE id = 1001113900998;
+-- delete recordId: 1001109954504, source: 1
+DELETE FROM evaluation WHERE id = 1001113906172;
+-- delete recordId: 1001109954547, source: 1
+DELETE FROM evaluation WHERE id = 1001113906206;
+-- delete recordId: 1001109958231, source: 1
+DELETE FROM evaluation WHERE id = 1001113910702;
+-- delete recordId: 1001109960452, source: 1
+DELETE FROM evaluation WHERE id = 1001113912024;
+-- delete recordId: 1001109964933, source: 1
+DELETE FROM evaluation WHERE id = 1001113916450;
+-- delete recordId: 1001109966876, source: 1
+DELETE FROM evaluation WHERE id = 1001113918483;
+-- delete recordId: 1001109966879, source: 1
+DELETE FROM evaluation WHERE id = 1001113918257;
+-- delete recordId: 1001109977278, source: 1
+DELETE FROM evaluation WHERE id = 1001113928073;
+-- delete recordId: 1001109977679, source: 1
+DELETE FROM evaluation WHERE id = 1001113928512;
+-- delete recordId: 1001109982249, source: 1
+DELETE FROM evaluation WHERE id = 1001113933362;
+-- delete recordId: 1001109991122, source: 1
+DELETE FROM evaluation WHERE id = 1001113941887;
+-- delete recordId: 1001109994759, source: 1
+DELETE FROM evaluation WHERE id = 1001113945049;
+-- delete recordId: 1001111100005, source: 2
+DELETE FROM evaluation WHERE id IN (1001113100008);
+-- delete recordId: 10011091003426, source: 1
+DELETE FROM evaluation WHERE id = 1001113953260;
+-- delete recordId: 10011091009233, source: 1
+DELETE FROM evaluation WHERE id = 1001113959000;
+-- delete recordId: 10011091017597, source: 1
+DELETE FROM evaluation WHERE id = 1001113967107;
+-- delete recordId: 10011091027464, source: 1
+DELETE FROM evaluation WHERE id = 1001113978492;
+-- delete recordId: 10011091029256, source: 1
+DELETE FROM evaluation WHERE id = 1001113978491;
+-- delete recordId: 10011091029276, source: 1
+DELETE FROM evaluation WHERE id = 1001113978494;
+-- delete recordId: 10011091038969, source: 1
+DELETE FROM evaluation WHERE id = 1001113987991;
+-- delete recordId: 10011091040656, source: 1
+DELETE FROM evaluation WHERE id = 1001113990134;
+-- delete recordId: 10011091051022, source: 1
+DELETE FROM evaluation WHERE id = 1001113999406;
+-- delete recordId: 10011091055647, source: 1
+DELETE FROM evaluation WHERE id = 10011131003956;
+-- delete recordId: 10011091055708, source: 1
+DELETE FROM evaluation WHERE id = 10011131003964;
+-- delete recordId: 10011091072024, source: 1
+DELETE FROM evaluation WHERE id = 10011131019632;
+-- delete recordId: 10011091072038, source: 1
+DELETE FROM evaluation WHERE id = 10011131019555;
+-- delete recordId: 10011091073978, source: 1
+DELETE FROM evaluation WHERE id = 10011131021437;
+-- delete recordId: 10011091076656, source: 1
+DELETE FROM evaluation WHERE id = 10011131024006;
+-- delete recordId: 10011091085336, source: 1
+DELETE FROM evaluation WHERE id = 10011131032482;
+-- delete recordId: 10011091087072, source: 1
+DELETE FROM evaluation WHERE id = 10011131034385;
+-- delete recordId: 10011091088494, source: 1
+DELETE FROM evaluation WHERE id = 10011131036855;
+-- delete recordId: 10011091092292, source: 1
+DELETE FROM evaluation WHERE id = 10011131039294;
+-- delete recordId: 10011091096509, source: 1
+DELETE FROM evaluation WHERE id = 10011131043308;
+-- delete recordId: 10011091096883, source: 1
+DELETE FROM evaluation WHERE id = 10011131044417;
+-- delete recordId: 10011091098121, source: 1
+DELETE FROM evaluation WHERE id = 10011131045293;
+-- delete recordId: 10011091099204, source: 1
+DELETE FROM evaluation WHERE id = 10011131046232;
+-- delete recordId: 10011091105597, source: 1
+DELETE FROM evaluation WHERE id = 10011131052989;
+-- delete recordId: 10011091113205, source: 1
+DELETE FROM evaluation WHERE id = 10011131060900;
+-- delete recordId: 10011091114014, source: 1
+DELETE FROM evaluation WHERE id = 10011131061001;
+-- delete recordId: 10011091117498, source: 1
+DELETE FROM evaluation WHERE id = 10011131063833;
+-- delete recordId: 10011091127514, source: 1
+DELETE FROM evaluation WHERE id = 10011131074352;
+-- delete recordId: 10011091137857, source: 1
+DELETE FROM evaluation WHERE id = 10011131083740;
+-- delete recordId: 10011091138843, source: 1
+DELETE FROM evaluation WHERE id = 10011131087819;
+-- delete recordId: 10011091152809, source: 1
+DELETE FROM evaluation WHERE id = 10011131098806;
+-- delete recordId: 10011091153304, source: 1
+DELETE FROM evaluation WHERE id = 10011131104010;
+-- delete recordId: 10011091154542, source: 1
+DELETE FROM evaluation WHERE id = 10011131100053;
+-- delete recordId: 10011091159701, source: 1
+DELETE FROM evaluation WHERE id = 10011131104893;
+-- delete recordId: 10011091161641, source: 1
+DELETE FROM evaluation WHERE id = 10011131110815;
+-- delete recordId: 10011091181645, source: 1
+DELETE FROM evaluation WHERE id = 10011131126410;
+-- delete recordId: 10011091223945, source: 1
+DELETE FROM evaluation WHERE id = 10011131167824;
+-- delete recordId: 10011091224016, source: 1
+DELETE FROM evaluation WHERE id = 10011131167826;
+-- delete recordId: 10011091232214, source: 1
+DELETE FROM evaluation WHERE id = 10011131175768;
+-- delete recordId: 10011091235606, source: 1
+DELETE FROM evaluation WHERE id = 10011131179121;
+-- delete recordId: 10011091238939, source: 1
+DELETE FROM evaluation WHERE id = 10011131182341;
+-- delete recordId: 10011091243387, source: 1
+DELETE FROM evaluation WHERE id = 10011131186656;
+-- delete recordId: 10011091246576, source: 1
+DELETE FROM evaluation WHERE id = 10011131191218;
+-- delete recordId: 10011091254654, source: 1
+DELETE FROM evaluation WHERE id = 10011131198120;
+-- delete recordId: 10011091276912, source: 1
+DELETE FROM evaluation WHERE id = 10011131220098;
+-- delete recordId: 10011091296516, source: 1
+DELETE FROM evaluation WHERE id = 10011131239461;