Browse Source

机构冻结

刘俊驰 1 year ago
parent
commit
1fe6c66da0

+ 14 - 15
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/SmsCodeServiceImpl.java

@@ -133,21 +133,20 @@ public class SmsCodeServiceImpl implements SmsCodeService {
                     }
                 } else if (ClientEnum.TENANT == platform) {
                     TenantStaff tenantStaff = tenantStaffService.getByUserId(userId);
-                    if (tenantStaff == null) {
-                        throw new UsernameNotFoundException("账户不存在");
-                    }
-                    TenantInfo tenantInfo = tenantInfoService.getById(Optional.ofNullable(tenantStaff.getTenantId()).orElse(-1L));
-
-                    if (tenantInfo == null) {
-                        throw new UsernameNotFoundException("账户不存在");
-                    }
-                    if (Boolean.FALSE.equals(tenantInfo.getEnableFlag())) {
-                        // 机构锁定
-                        throw new LockedException("账号已冻结,请联系管理员");
-                    }
-                    if (UserLockFlag.LOCKED.equals(tenantStaff.getStatus())) {
-                        // 账号被锁定
-                        throw new LockedException("账号已冻结,请联系管理员");
+                    if (tenantStaff != null) {
+                        TenantInfo tenantInfo = tenantInfoService.getById(Optional.ofNullable(tenantStaff.getTenantId()).orElse(-1L));
+
+                        if (tenantInfo == null) {
+                            throw new UsernameNotFoundException("账户不存在");
+                        }
+                        if (Boolean.FALSE.equals(tenantInfo.getEnableFlag())) {
+                            // 机构锁定
+                            throw new LockedException("账号已冻结,请联系管理员");
+                        }
+                        if (UserLockFlag.LOCKED.equals(tenantStaff.getStatus())) {
+                            // 账号被锁定
+                            throw new LockedException("账号已冻结,请联系管理员");
+                        }
                     }
                 }
             }