xiongchao 3 lat temu
rodzic
commit
dfdaf3f8a1

+ 8 - 0
platform-dao/src/main/java/com/platform/dao/dto/repair/RepairApplicationFormDTO.java

@@ -31,6 +31,14 @@ public class RepairApplicationFormDTO extends BaseDTO implements Serializable {
      */
     @Transient
     private Integer searchType;
+    /**
+     * 多长时间修复好
+     */
+    private Double limit_hours;
+    /**
+     * 审核描述
+     */
+    private String examineContent;
     /**
      * 主键
      */

+ 9 - 0
platform-dao/src/main/java/com/platform/dao/entity/repair/RepairApplicationForm.java

@@ -37,9 +37,14 @@ public class RepairApplicationForm implements Serializable {
      * 设备id
      */
     private String sbId;
+    /**
+     * 多长时间修复好
+     */
+    private Double limit_hours;
     /**
      * 设备id
      */
+    @Transient
     private String sbNo;
     /**
      * 设备使用位置
@@ -152,6 +157,10 @@ public class RepairApplicationForm implements Serializable {
      * 验收描述
      */
     private String checkContent;
+    /**
+     * 审核描述
+     */
+    private String examineContent;
     /**
      * 报修图片
      */

+ 9 - 0
platform-dao/src/main/java/com/platform/dao/enums/RepairApplicationFormStatusEnum.java

@@ -36,6 +36,15 @@ public enum RepairApplicationFormStatusEnum {
      * 已完成
      */
     FINISHED(6),
+    /**
+     * 提交检查
+     */
+    EXAMINING(7),
+    /**
+     * 已检查完毕,检查不成功,则返回到已完成状态,可以继续修改内容,然后提交
+     */
+    EXAMINED(8),
+
     ;
     private final Integer value;
 }

+ 4 - 0
platform-dao/src/main/java/com/platform/dao/enums/SysRoleCodeEnum.java

@@ -119,6 +119,10 @@ public enum SysRoleCodeEnum {
      * 询价主管
      */
     XJZG,
+    /**
+     * 报修单最后审核人员
+     */
+    REPAIR_EXAMINE,
     ;
 
 }

+ 1 - 1
platform-dao/src/main/java/com/platform/dao/enums/WorkplaceBacklogDetailTypeEnum.java

@@ -24,7 +24,7 @@ public enum WorkplaceBacklogDetailTypeEnum {
     REPAIR_BACK(5, "维修驳回通知"),
     REPAIR_OK(6, "维修结束通知"),
     REPAIR_RECEIVE(23, "维修接收通知"),
-
+    REPAIR_EXAMINE(24, "维修关闭审核通知"),
     CHECK_RUN_EXPIRE(7, "润滑任务过期通知"),
     CHECK_BAOYANG_EXPIRE(8, "保养任务过期通知"),
 

+ 4 - 0
platform-dao/src/main/java/com/platform/dao/util/MessageTemplateUtil.java

@@ -112,6 +112,10 @@ public class MessageTemplateUtil {
         return String.format("您的报修【%s】已接受,正在处理,请等待", id);
     }
 
+    public static String getReceiveExamine(String id) {
+        return String.format("维修【%s】工单已经完成,等待您审核", id);
+    }
+
     /**
      * 调拨审批通知内容
      *

+ 8 - 1
platform-dao/src/main/java/com/platform/dao/vo/repair/RepairApplicationFormVO.java

@@ -30,7 +30,14 @@ public class RepairApplicationFormVO extends BaseVO implements Serializable {
      * 报修人员id
      */
     private String userId;
-
+    /**
+     * 多长时间修复好
+     */
+    private Double limit_hours;
+    /**
+     * 审核描述
+     */
+    private String examineContent;
     /**
      * 设备使用位置
      */

+ 3 - 0
platform-dao/src/main/resources/mapper/repair/RepairApplicationFormMapper.xml

@@ -39,6 +39,9 @@
             <if test="type != null and type != ''">
                 and application.type = #{type}
             </if>
+            <if test="status != null and status != ''">
+                and application.status = #{status}
+            </if>
             <if test="userId != null and userId != ''">
                 and application.user_id = #{userId}
             </if>

+ 29 - 1
platform-rest/src/main/java/com/platform/rest/controller/repair/RepairApplicationFormController.java

@@ -49,7 +49,7 @@ public class RepairApplicationFormController {
     /**
      * 历史分析记录数量DTO
      *
-     * @param repairReasonDTO 历史分析记录数量DTO
+     * @param repairApplicationFormDTO 历史分析记录数量DTO
      * @return R
      */
     @GetMapping("/num")
@@ -151,6 +151,34 @@ public class RepairApplicationFormController {
         return new R<>();
     }
 
+    /**
+     * 审核维修单:发邮件给牛工进行审核的完成
+     *
+     * @param id 维修单DTO
+     * @return R
+     */
+    @SysLog("提交审核维修单")
+    @PutMapping("/examine/{id}")
+    @PreAuthorize("@pms.hasPermission('repair-application-forms-finish')")
+    public R examineApply (@PathVariable("id") String id) {
+        repairApplicationFormService.examine(id);
+        return new R<>();
+    }
+
+    /**
+     * 审核维修单:进行审核操作
+     *
+     * @param id 维修单DTO
+     * @return R
+     */
+    @SysLog("完成审核维修单")
+    @PutMapping("/examined/{id}/{result}")
+    @PreAuthorize("@pms.hasPermission('repair-application-forms-finish')")
+    public R examined(@PathVariable("id") String id, @PathVariable("result") Integer result, @Validated({UpdateGroup.class}) @RequestBody RepairApplicationFormDTO repairCheckDTO) {
+        repairApplicationFormService.examined(id, result, repairCheckDTO);
+        return new R<>();
+    }
+
     /**
      * 修改记录
      *

+ 8 - 0
platform-service/src/main/java/com/platform/service/repair/RepairApplicationFormService.java

@@ -100,4 +100,12 @@ public interface RepairApplicationFormService extends IBaseService<RepairApplica
      */
     void unFinishNoticeForTimer();
 
+    void examine(String id);
+
+    /**
+     *
+     * @param id
+     * @param result 0 拒绝,1通过
+     */
+    void examined(String id, Integer result, RepairApplicationFormDTO dto );
 }

+ 69 - 31
platform-service/src/main/java/com/platform/service/repair/impl/RepairApplicationFormServiceImpl.java

@@ -112,24 +112,26 @@ public class RepairApplicationFormServiceImpl extends BaseServiceImpl<RepairAppl
         PageHelper.startPage(pageNum, pageSize);
 
         // 获取报修人
-        if (record.getSearchType() == 1) {
-            if (record.getFilter() != null && DataFilterTypeEnum.SELF.getValue() == record.getFilter().intValue()) {
-                UserInfo userInfo = SecurityUtils.getUserInfo();
-                record.setUserId(userInfo.getUserId());
+        if(record.getSearchType() != null){
+            if (record.getSearchType() == 1) {
+                if (record.getFilter() != null && DataFilterTypeEnum.SELF.getValue() == record.getFilter().intValue()) {
+                    UserInfo userInfo = SecurityUtils.getUserInfo();
+                    record.setUserId(userInfo.getUserId());
+                }
             }
-        }
-        // 获取维修人
-        if (record.getSearchType() == 2) {
-            if (record.getFilter() != null && DataFilterTypeEnum.SELF.getValue() == record.getFilter().intValue()) {
-                UserInfo userInfo = SecurityUtils.getUserInfo();
-                record.setRepairUserId(userInfo.getUserId());
+            // 获取维修人
+            if (record.getSearchType() == 2) {
+                if (record.getFilter() != null && DataFilterTypeEnum.SELF.getValue() == record.getFilter().intValue()) {
+                    UserInfo userInfo = SecurityUtils.getUserInfo();
+                    record.setRepairUserId(userInfo.getUserId());
+                }
             }
-        }
-        // 获取验收人
-        if (record.getSearchType() == 3) {
-            if (record.getFilter() != null && DataFilterTypeEnum.SELF.getValue() == record.getFilter().intValue()) {
-                UserInfo userInfo = SecurityUtils.getUserInfo();
-                record.setCheckUserId(userInfo.getUserId());
+            // 获取验收人
+            if (record.getSearchType() == 3) {
+                if (record.getFilter() != null && DataFilterTypeEnum.SELF.getValue() == record.getFilter().intValue()) {
+                    UserInfo userInfo = SecurityUtils.getUserInfo();
+                    record.setCheckUserId(userInfo.getUserId());
+                }
             }
         }
         return new MyVOPage<>(mapper.selectPageList(record));
@@ -341,6 +343,55 @@ public class RepairApplicationFormServiceImpl extends BaseServiceImpl<RepairAppl
         SpringContextHolder.publishEvent(new WorkplaceBacklogEvent(WorkplaceBacklogTypeEnum.RECEIVE.getValue(), WorkplaceBacklogDetailTypeEnum.REPAIR_RECEIVE.getValue(),
                 applicationForm.getId(), MessageTemplateUtil.getReceive(applicationForm.getNo()),
                 applicationForm.getId(), ListUtils.newArrayList(applicationForm.getUserId())));
+
+    }
+
+    /**
+     * 发起审核给领导人,必须完成后的报修单才可以提交审核
+     *
+     * @param id :
+     */
+    @Override
+    public void examine(String id) {
+        RepairApplicationForm applicationForm = mapper.selectById(id);
+        if (!RepairApplicationFormStatusEnum.NOT_ACCEPTANCE.getValue().equals(applicationForm.getStatus())) {
+            throw new BusinessException("未完成的不允许提交审核");
+        }
+        applicationForm.setStatus(RepairApplicationFormStatusEnum.EXAMINING.getValue());
+        applicationForm.setUpdateTime(LocalDateTime.now());
+        super.modModelByPrimaryKey(applicationForm);
+        SysUserDTO query = new SysUserDTO();
+        query.setRoleCode(SysRoleCodeEnum.REPAIR_EXAMINE.name());
+        List<SysUserVO> users = userMapper.selectDeptRoleUser(query);
+        SysUserVO userVO = null;
+        if (CollectionUtil.isNotEmpty(users)) {
+            userVO = users.get(0);
+        }else{
+            throw new BusinessException("审核角色为绑定用户,请设置用户");
+        }
+        SpringContextHolder.publishEvent(new WorkplaceBacklogEvent(WorkplaceBacklogTypeEnum.RECEIVE.getValue(), WorkplaceBacklogDetailTypeEnum.REPAIR_EXAMINE.getValue(),
+                applicationForm.getId(), MessageTemplateUtil.getReceiveExamine(applicationForm.getNo()),
+                applicationForm.getId(), ListUtils.newArrayList(userVO.getUserId()), ListUtils.newArrayList(userVO.getEmail())));}
+
+    /**
+     * 进行维修单审核
+     *
+     * @param id :
+     */
+    @Override
+    public void examined(String id, Integer result, RepairApplicationFormDTO dto) {
+        RepairApplicationForm applicationForm = mapper.selectById(id);
+        if (!RepairApplicationFormStatusEnum.EXAMINING.getValue().equals(applicationForm.getStatus())) {
+            throw new BusinessException("该状态不允许审核,请检查维修单状态");
+        }
+        if(result == 1){
+            applicationForm.setStatus(RepairApplicationFormStatusEnum.EXAMINED.getValue());
+        }else{// 打回,重新完善维修单, 再次提交审核
+            applicationForm.setStatus(RepairApplicationFormStatusEnum.FINISHED.getValue());
+        }
+        applicationForm.setUpdateTime(LocalDateTime.now());
+        applicationForm.setExamineContent(dto.getExamineContent());
+        super.modModelByPrimaryKey(applicationForm);
     }
 
     /**
@@ -428,19 +479,6 @@ public class RepairApplicationFormServiceImpl extends BaseServiceImpl<RepairAppl
             sysFileMapper.insertListforComplex(list);
         }
 
-//        // 获取部门的项目部
-//        SysDeptVO natureDept = UserUtil.getUserNatureDept(DeptNatureEnum.XIANG_MU_BU, userInfo);
-//        // 获取项目部设备主管
-//        List<SysUserVO> users = UserUtil.selectUserByIdentityTypeLikeDeptCode(natureDept.getDeptCode(),
-//                SysUserIdentityType.WXZG.getValue());
-//        SysUserVO checkUser = null;
-//        if (CollectionUtil.isNotEmpty(users)) {
-//            checkUser = users.get(0);
-//        }
-//
-//        if (checkUser == null) {
-//            throw new BusinessException("找不到该项目部的维修主管,项目部名称:" + natureDept.getName());
-//        }
         String userId = applicationForm.getUserId();
         applicationForm.setCheckUserId(userId);
         // 维修人自己发起报修自己验收
@@ -459,10 +497,10 @@ public class RepairApplicationFormServiceImpl extends BaseServiceImpl<RepairAppl
         } else {
             super.modModelByPrimaryKey(applicationForm);
             // 发送通知给主管,主管是验收人,他收到通知,进行调拨给使用人员
-            SysUser checkUser = userMapper.selectByPrimaryKey(applicationForm.getCheckUserId());
+           /* SysUser checkUser = userMapper.selectByPrimaryKey(applicationForm.getCheckUserId());
             SpringContextHolder.publishEvent(new WorkplaceBacklogEvent(WorkplaceBacklogTypeEnum.REPAIR.getValue(), WorkplaceBacklogDetailTypeEnum.REPAIR_FINISH.getValue(),
                     applicationForm.getId(), MessageTemplateUtil.getRepairCheck(applicationForm.getNo()),
-                    applicationForm.getId(), ListUtils.newArrayList(applicationForm.getCheckUserId()), ListUtils.newArrayList(checkUser.getEmail())));
+                    applicationForm.getId(), ListUtils.newArrayList(applicationForm.getCheckUserId()), ListUtils.newArrayList(checkUser.getEmail())));*/
         }
     }