Browse Source

接口修改

pengcheng 3 weeks ago
parent
commit
bda51337ab

+ 11 - 12
ruoyi-system/src/main/java/com/ruoyi/clock/listener/EmployeeImportListener.java

@@ -44,8 +44,6 @@ public class EmployeeImportListener extends AnalysisEventListener<EmployeeImport
 
     private final String password;
 
-    private final Boolean isUpdateSupport;
-
     private final String operName;
 
     private int successNum = 0;
@@ -58,9 +56,7 @@ public class EmployeeImportListener extends AnalysisEventListener<EmployeeImport
         this.employeeService = SpringUtils.getBean(IEmployeeService.class);
         this.agentService = SpringUtils.getBean(IAgentService.class);
         this.shopService = SpringUtils.getBean(IShopService.class);
-
         this.password = BCrypt.hashpw(initPassword);
-        this.isUpdateSupport = isUpdateSupport;
         this.operName = LoginHelper.getUsername();
     }
 
@@ -80,35 +76,38 @@ public class EmployeeImportListener extends AnalysisEventListener<EmployeeImport
             }
             if(ObjectUtil.isEmpty(agentName)){
                 failureNum++;
-                failureMsg.append("<br/>").append(failureNum).append("、所属代理商 ").append(" 不能为空");
+                failureMsg.append("<br/>").append(failureNum).append("、姓名 ").append(employeeName).append("、所属代理商 ").append(" 不能为空");
                 return;
             }
             if(ObjectUtil.isEmpty(shopName)){
                 failureNum++;
-                failureMsg.append("<br/>").append(failureNum).append("、所属门店 ").append(" 不能为空");
+                failureMsg.append("<br/>").append(failureNum).append("、姓名 ").append(employeeName).append("、所属门店 ").append(" 不能为空");
                 return;
             }
-
             if(ObjectUtil.isEmpty(phonenumber)){
                 failureNum++;
-                failureMsg.append("<br/>").append(failureNum).append("、手机号码 ").append(" 不能为空");
+                failureMsg.append("<br/>").append(failureNum).append("、姓名 ").append(employeeName).append("、手机号码 ").append(" 不能为空");
                 return;
             }
-
             Agent agent = agentService.getAgentByName(agentName);
             if(ObjectUtil.isEmpty(agent)){
                 failureNum++;
-                failureMsg.append("<br/>").append(failureNum).append("、所属代理商 ").append(agentName).append(" 不存在");
+                failureMsg.append("<br/>").append(failureNum).append("、姓名 ").append(employeeName).append("、所属代理商 ").append(agentName).append(" 不存在");
                 return;
             }
             Shop shop = shopService.getShopByName(shopName);
             if(ObjectUtil.isEmpty(shop)){
                 failureNum++;
-                failureMsg.append("<br/>").append(failureNum).append("、所属门店 ").append(shopName).append(" 不存在");
+                failureMsg.append("<br/>").append(failureNum).append("、姓名 ").append(employeeName).append("、所属门店 ").append(shopName).append(" 不存在");
+                return;
+            }
+            Long shopAgentId = shop.getAgentId();
+            if(!shopAgentId.equals(agent.getAgentId())){
+                failureNum++;
+                failureMsg.append("<br/>").append(failureNum).append("、姓名 ").append(employeeName).append("、所属门店 ").append(shopName).append(" 不属于所属代理商 ").append(agentName);
                 return;
             }
             Employee user = this.employeeService.selectUserByUserName(phonenumber);
-
             // 验证是否存在这个用户
             if (ObjectUtil.isNull(user)) {
                 EmployeeBo employeeBo = new EmployeeBo();