瀏覽代碼

简易维修

guarantee-lsq 1 年之前
父節點
當前提交
d4283496eb

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

@@ -508,5 +508,6 @@ public class RepairApplicationFormDTO extends BaseDTO implements Serializable {
 
     private List<String> sqlString;
     private String sqlValue;
+    private String tempUserId;
 
 }

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

@@ -109,6 +109,10 @@ public enum RepairApplicationFormStatusEnum {
      * 报修待审
      */
     REPAIR_VERIFYING(24),
+    /**
+     * 验收被拒
+     */
+    VERIFY_REFUSED(25),
     ;
     private final Integer value;
 }

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

@@ -149,6 +149,10 @@
             <if test="verifyRepairUserId != null and verifyRepairUserId != ''">
                 and application.verify_repair_user_id = #{verifyRepairUserId}
             </if>
+            <if test="tempUserId != null and tempUserId != ''">
+                and (application.dispatch_user_id = #{tempUserId} or application.user_id = #{tempUserId}
+                or application.repair_user_id = #{tempUserId})
+            </if>
         </where>
     </select>
     <select id="selectById" parameterType="java.lang.Object"

+ 13 - 0
platform-rest/src/main/java/com/platform/rest/controller/repair/RepairApplicationFormController.java

@@ -233,6 +233,19 @@ public class RepairApplicationFormController {
         return new R<>(pageInfos);
     }
 
+    /**
+     * 获取分页-主管派单型
+     * @param pageNum                  当前页码
+     * @param pageSize                 每页条数
+     * @param repairApplicationFormDTO 保修单DTO
+     * @return R
+     */
+    @GetMapping("/dispatch/page")
+    public R queryDispatch(RepairApplicationFormDTO repairApplicationFormDTO, @RequestParam(defaultValue = "1") int pageNum, @RequestParam(defaultValue = "20") int pageSize) {
+        MyVOPage<RepairApplicationFormVO> pageInfos = repairApplicationFormService.selectPageInfoVO(repairApplicationFormDTO, pageNum, pageSize);
+        return new R<>(pageInfos);
+    }
+
     /**
      * 工单池分页数据
      * @param repairApplicationFormDTO

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

@@ -58,6 +58,16 @@ public interface RepairApplicationFormService extends IBaseService<RepairApplica
      */
     MyVOPage<RepairApplicationFormVO> selectPageInfoVO(RepairApplicationFormDTO record, int pageNum, int pageSize);
 
+    /**
+     * 主管派单分页查询
+     *
+     * @param record   :
+     * @param pageNum  :
+     * @param pageSize :
+     * @return :
+     */
+    MyVOPage<RepairApplicationFormVO> selectPageInfoVODispatch(RepairApplicationFormDTO record, int pageNum, int pageSize);
+
     /**
      * 获取详情
      *

+ 39 - 0
platform-service/src/main/java/com/platform/service/repair/impl/RepairApplicationFormServiceImpl.java

@@ -1028,6 +1028,45 @@ public class RepairApplicationFormServiceImpl extends BaseServiceImpl<RepairAppl
         return new MyVOPage<>(mapper.selectPageList(record));
     }
 
+    @Override
+    public MyVOPage<RepairApplicationFormVO> selectPageInfoVODispatch(RepairApplicationFormDTO record, int pageNum, int pageSize) {
+        PageHelper.startPage(pageNum, pageSize);
+        if(StringUtils.isBlank(record.getSbId())){ // 非获取设备的维修记录
+            UserInfo userInfo = SecurityUtils.getUserInfo();
+            record.setTempUserId(userInfo.getUserId());
+            if(record.getSearchType() != null){
+                List<Integer> statusList = new ArrayList<>();
+                if(record.getSearchType() == 1){ // 待派工单
+                    statusList.add(RepairApplicationFormStatusEnum.NOT_ALLOCATED.getValue());
+                }else if(record.getSearchType() == 2){ // 我的工单
+                    statusList.add(RepairApplicationFormStatusEnum.NOT_ALLOCATED.getValue());
+                    statusList.add(RepairApplicationFormStatusEnum.PROCESSING.getValue());
+                }else if(record.getSearchType() == 3){ // 待审核工单
+                    statusList.add(RepairApplicationFormStatusEnum.WAIT_SUBMIT.getValue());
+                    statusList.add(RepairApplicationFormStatusEnum.NOT_ACCEPTANCE.getValue());
+                }
+
+                record.setStatusList(statusList);
+            }
+            // 排除超级用户
+            String userNames = ConfigCache.getLabelByValueAllowNull(SysConfigEnum.REPAIR_SUPER_USERS.name()); // 超级用户
+            if(StringUtils.isBlank(userNames)){
+                throw new DeniedException("请设置维修菜单的超级用户");
+            }
+            // 维修模式为派工的情况
+            if(userNames.contains(userInfo.getUsername())){
+                record.setRepairUserId(null);
+                record.setDispatchUserId(null);
+                // 超级可以看到所有待审核的工单
+                if(record.getSearchType() != null && record.getSearchType() == 7){
+                    record.setCheckUserId(null);
+                    record.setCheckAllFlag(1);
+                }
+            }
+        }
+        return new MyVOPage<>(mapper.selectPageList(record));
+    }
+
     @Override
     public RepairApplicationFormVO getById(Object id) {
         RepairApplicationForm model = mapper.selectById(id);

+ 42 - 10
platform-service/src/main/java/com/platform/service/repair/strategy/impl/AllocateRepairBaseStrategy.java

@@ -108,7 +108,20 @@ public class AllocateRepairBaseStrategy extends AbstractRepairBaseStrategy {
     @Override
     public RepairApplicationFormDTO sendRepair(RepairApplicationFormDTO model) {
         RepairApplicationFormDTO superModel = super.sendRepair(model);
-        // 自己派工
+        RepairApplicationForm applicationForm = new RepairApplicationForm();
+        applicationForm.setId(model.getId());
+        applicationForm.setRepairUserId(superModel.getRepairUserId());
+        applicationForm.setStatus(RepairApplicationFormStatusEnum.PROCESSING.getValue());
+        if (superModel.getRepairStartTime() == null) {
+            applicationForm.setRepairStartTime(LocalDateTime.now());
+            superModel.setRepairStartTime(LocalDateTime.now());
+        }
+        applicationForm.setReceiveMinutes(DateUtils.getDurationHours(superModel.getApplyTime(), superModel.getRepairStartTime()));
+        applicationForm.setUpdateTime(LocalDateTime.now());
+        repairApplicationFormMapper.updateByPrimaryKeySelective(applicationForm);
+        // 给报修人发送消息
+        sendMessageToRepairCaller(superModel.getId(),superModel.getNo(),superModel.getUserId());
+        /*// 自己派工
         UserInfo userInfo = SecurityUtils.getUserInfo();
         String userNames = ConfigCache.getLabelByValueAllowNull(SysConfigEnum.REPAIR_SUPER_USERS.name()); // 超级用户
         if(StringUtils.isNotBlank(userNames)){
@@ -137,7 +150,7 @@ public class AllocateRepairBaseStrategy extends AbstractRepairBaseStrategy {
                 }
             }
 
-        }
+        }*/
 
         return model;
     }
@@ -159,9 +172,9 @@ public class AllocateRepairBaseStrategy extends AbstractRepairBaseStrategy {
     public RepairApplicationForm submitRepair(RepairApplicationFormDTO model) {
         RepairApplicationForm applicationForm = super.submitRepair(model);
         SbInfoVO sbInfoVO = sbInfoService.getById(applicationForm.getSbId());
-        // 默认的提交审核后的审核人,就是维修主管的角色,每家不同自行实现
-        SysUserVO userVO;
-        SysUserDTO query = new SysUserDTO();
+        // 完成维修提交给生产审核
+        SysUserVO userVO = sysUserService.selectUserVO(applicationForm.getUserId());
+        /*SysUserDTO query = new SysUserDTO();
         query.setRoleCode(SysRoleCodeEnum.REPAIR_EXAMINE.name());
         List<SysUserVO> users = sysUserService.selectDeptRoleUser(query);
         if (CollectionUtil.isNotEmpty(users)) {
@@ -169,7 +182,8 @@ public class AllocateRepairBaseStrategy extends AbstractRepairBaseStrategy {
         } else {
             throw new BusinessException("审核角色:REPAIR_EXAMINE未绑定用户,REPAIR_EXAMINE为维修单最终验收人,请设置用户");
         }
-        applicationForm.setCheckUserId(userVO.getUserId());
+        applicationForm.setCheckUserId(userVO.getUserId());*/
+        applicationForm.setStatus(RepairApplicationFormStatusEnum.NOT_ACCEPTANCE.getValue());
         repairApplicationFormMapper.updateByPrimaryKeySelective(applicationForm);
         // 发送邮件和通知
         String domain = ConfigCache.getLabelByValueAllowNull(SysConfigEnum.SYSTEM_DOMAIN.name());
@@ -267,6 +281,13 @@ public class AllocateRepairBaseStrategy extends AbstractRepairBaseStrategy {
 
     @Override
     public RepairApplicationFormDTO closeRepair(RepairApplicationFormDTO dto) {
+        // 保存维修记录图片和文件
+        sysFileService.saveFile(dto.getId(), SysFileTypeEnum.REPAIR_REPAIR_IMGS.getValue(), dto.getRepairFileList());
+        sysFileService.saveFile(dto.getId(), SysFileTypeEnum.REPAIR_REPAIR_FILES.getValue(), dto.getOpinionFileList());
+        RepairApplicationForm updForm = new RepairApplicationForm();
+        updForm.setId(dto.getId());
+        updForm.setStatus(RepairApplicationFormStatusEnum.MM_REPAIR_CLOSE.getValue());
+        repairApplicationFormMapper.updateByPrimaryKey(updForm);
         return null;
     }
 
@@ -282,7 +303,15 @@ public class AllocateRepairBaseStrategy extends AbstractRepairBaseStrategy {
 
     @Override
     public void verifyRepairByProduce(RepairApplicationFormDTO model) {
-
+        if(model.getStatus() == null || model.getStatus() != RepairApplicationFormStatusEnum.FINISHED.getValue()
+        || model.getStatus() != RepairApplicationFormStatusEnum.VERIFY_REFUSED.getValue()){
+            throw new DeniedException("审核状态有问题");
+        }
+        RepairApplicationForm updForm = new RepairApplicationForm();
+        updForm.setId(model.getId());
+        updForm.setRemark(model.getRemark());
+        updForm.setStatus(model.getStatus());
+        repairApplicationFormMapper.updateByPrimaryKey(updForm);
     }
 
     @Override
@@ -317,11 +346,14 @@ public class AllocateRepairBaseStrategy extends AbstractRepairBaseStrategy {
 
     @Override
     public RepairApplicationFormDTO handleRepair(RepairApplicationFormDTO dto) {
-        super.handleRepair(dto);
+        //super.handleRepair(dto);
         RepairApplicationForm applicationForm = repairApplicationFormMapper.selectById(dto.getId());
+        applicationForm.setRepairEndTime(LocalDateTime.now());
+        applicationForm.setRepairContent(dto.getRepairContent());
+        applicationForm.setStatus(RepairApplicationFormStatusEnum.NOT_ACCEPTANCE.getValue());
         applicationForm.setRepairMinutes(DateUtils.getDurationHours(applicationForm.getRepairStartTime(), applicationForm.getRepairEndTime()));
         // 根据配置判断维修是否超时
-        String hourFirstStr = ConfigCache.getLabelByValueAllowNull(SysConfigEnum.REPAIR_OVERTIME_MINUTE_FIRST.name());
+        /*String hourFirstStr = ConfigCache.getLabelByValueAllowNull(SysConfigEnum.REPAIR_OVERTIME_MINUTE_FIRST.name());
         int hourFirst = 180;// 默认3小时,180分钟
         if (StringUtils.isNotBlank(hourFirstStr)) {
             hourFirst = Integer.valueOf(hourFirstStr) * 60;
@@ -332,7 +364,7 @@ public class AllocateRepairBaseStrategy extends AbstractRepairBaseStrategy {
             applicationForm.setRepairOvertime(false);
         }
         // 保存维修图片
-        sysFileService.saveFile(dto.getId(), SysFileTypeEnum.REPAIR_REPAIR_IMGS.getValue(), dto.getRepairFileList());
+        sysFileService.saveFile(dto.getId(), SysFileTypeEnum.REPAIR_REPAIR_IMGS.getValue(), dto.getRepairFileList());*/
         repairApplicationFormMapper.updateByPrimaryKeySelective(applicationForm);
         return dto;
     }