3254194295 2 years ago
parent
commit
043af21d3f

+ 37 - 16
platform-service/src/main/java/com/platform/service/repair/strategy/impl/AllocateRepairBaseStrategy.java

@@ -110,27 +110,48 @@ public class AllocateRepairBaseStrategy extends AbstractRepairBaseStrategy {
         // 自己派工
         UserInfo userInfo = SecurityUtils.getUserInfo();
         String userNames = ConfigCache.getLabelByValueAllowNull(SysConfigEnum.REPAIR_SUPER_USERS.name()); // 超级用户
-        if(StringUtils.isNotBlank(userNames) && !userNames.contains(userInfo.getUsername())){
-            // 非超级用户,判断是否具有审核派工权限
-            if(!userInfo.getUserId().equals(model.getDispatchUserId())){
-                throw new DeniedException("您不具有派工权限");
+        if(StringUtils.isNotBlank(userNames)){
+            String arr[]=getStringArarry(userNames);
+            for(int i=0;i<arr.length;i++){
+                if(arr[i].equals(userInfo.getUsername())){
+                    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());
+                    }
+                    applicationForm.setReceiveMinutes(DateUtils.getDurationHours(superModel.getApplyTime(), applicationForm.getRepairStartTime()));
+                    applicationForm.setUpdateTime(LocalDateTime.now());
+                    repairApplicationFormMapper.updateByPrimaryKeySelective(applicationForm);
+                    // 给报修人发送消息
+                    sendMessageToRepairCaller(superModel.getId(),superModel.getNo(),superModel.getUserId());
+                }else if(i>=arr.length-1){
+                    // 非超级用户,判断是否具有审核派工权限
+                    if(!userInfo.getUserId().equals(model.getDispatchUserId())){
+                        throw new DeniedException("您不具有派工权限");
+                    }
+                }
             }
+
         }
-        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());
-        }
-        applicationForm.setReceiveMinutes(DateUtils.getDurationHours(superModel.getApplyTime(), applicationForm.getRepairStartTime()));
-        applicationForm.setUpdateTime(LocalDateTime.now());
-        repairApplicationFormMapper.updateByPrimaryKeySelective(applicationForm);
-        // 给报修人发送消息
-        sendMessageToRepairCaller(superModel.getId(),superModel.getNo(),superModel.getUserId());
+
         return model;
     }
 
+    public static String[] getStringArarry(String str){
+        String arr[]=str.split(",");
+        return arr;
+    }
+
+//    public static void main(String[] args) {
+//        String str="asdf,afdasdg,lksd";
+//        String arr[]=getStringArarry(str);
+//        for(String s:arr){
+//            System.out.println(s);
+//        }
+//    }
+
     @Override
     public RepairApplicationForm submitRepair(RepairApplicationFormDTO model) {
         RepairApplicationForm applicationForm = super.submitRepair(model);