Quellcode durchsuchen

Merge remote-tracking branch 'origin/main' into main

pengzhenggao vor 1 Woche
Ursprung
Commit
339c4e5d42

+ 14 - 5
fuintBackend/fuint-application/src/main/java/com/fuint/module/backendApi/controller/BackendStaffController.java

@@ -128,7 +128,7 @@ public class BackendStaffController extends BaseController {
     public ResponseObject updateStatus(HttpServletRequest request, @RequestBody Map<String, Object> params) throws BusinessCheckException {
         String token = request.getHeader("Access-Token");
         String status = params.get("status") != null ? params.get("status").toString() : StatusEnum.ENABLED.getKey();
-        Long id = Long.valueOf(params.get("id") == null ? 0 : Integer.parseInt(params.get("id").toString()));
+        Long id = params.get("id") == null ? 0 : Long.valueOf(params.get("id").toString());
 
         AccountInfo accountInfo = TokenUtil.getAccountInfoByToken(token);
         if (accountInfo == null) {
@@ -182,21 +182,30 @@ public class BackendStaffController extends BaseController {
         }
         mtStaff.setStoreId(storeId);
         mtStaff.setRealName(realName);
-        if (PhoneFormatCheckUtils.isChinaPhoneLegal(mobile)) {
-            mtStaff.setMobile(mobile);
+        if (!PhoneFormatCheckUtils.isChinaPhoneLegal(mobile)) {
+            return getFailureResult(201, "手机号码格式不正确");
+        }else if (StringUtil.isNotEmpty(mobile)) {
+            MtStaff tempUser = staffService.queryStaffByMobile(mobile);
+            if (tempUser != null && !tempUser.getId().equals(mtStaff.getId())) {
+                return getFailureResult(201, "该手机号码已经存在");
+            }
+        }else if (StringUtil.isEmpty(mobile)) {
+            return getFailureResult(201, "手机号码不能为空");
         }
+        mtStaff.setMobile(mobile);
+
         mtStaff.setAuditedStatus(status);
         mtStaff.setDescription(description);
         mtStaff.setCategory(Integer.parseInt(category));
 
-        if (StringUtil.isEmpty(mtStaff.getMobile())) {
+       /* if (StringUtil.isEmpty(mtStaff.getMobile())) {
             return getFailureResult(201, "手机号码不能为空");
         } else {
             MtStaff tempUser = staffService.queryStaffByMobile(mtStaff.getMobile());
             if (tempUser != null && !tempUser.getId().equals(mtStaff.getId())) {
                 return getFailureResult(201, "该手机号码已经存在");
             }
-        }
+        }*/
         staffService.saveStaff(mtStaff, accountInfo.getAccountName());
         return getSuccessResult(true);
     }