mirror of https://gitee.com/xiaonuobase/snowy
【企业版】修复若干问题
parent
9dd127479a
commit
f79114167e
|
@ -24,6 +24,9 @@ import vip.xiaonuo.common.exception.CommonException;
|
||||||
@Getter
|
@Getter
|
||||||
public enum AuthStrategyWhenNoUserWithPhoneOrEmailEnum {
|
public enum AuthStrategyWhenNoUserWithPhoneOrEmailEnum {
|
||||||
|
|
||||||
|
/** 允许登录(手机或者邮箱存在时) */
|
||||||
|
ALLOW_LOGIN("ALLOW_LOGIN"),
|
||||||
|
|
||||||
/** 不允许登录 */
|
/** 不允许登录 */
|
||||||
NOT_ALLOW_LOGIN("NOT_ALLOW_LOGIN"),
|
NOT_ALLOW_LOGIN("NOT_ALLOW_LOGIN"),
|
||||||
|
|
||||||
|
@ -39,7 +42,7 @@ public enum AuthStrategyWhenNoUserWithPhoneOrEmailEnum {
|
||||||
public static void validate(String value) {
|
public static void validate(String value) {
|
||||||
boolean flag = NOT_ALLOW_LOGIN.getValue().equals(value) || AUTO_CREATE_USER.getValue().equals(value);
|
boolean flag = NOT_ALLOW_LOGIN.getValue().equals(value) || AUTO_CREATE_USER.getValue().equals(value);
|
||||||
if(!flag) {
|
if(!flag) {
|
||||||
throw new CommonException("不支持的手机号或邮箱无对应用户时策略型:{}", value);
|
throw new CommonException("不支持的手机号或邮箱无对应用户时策略类型:{}", value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -194,7 +194,7 @@ public class AuthServiceImpl implements AuthService {
|
||||||
// 验证码请求号
|
// 验证码请求号
|
||||||
String validCodeReqNo = authGetPhoneValidCodeParam.getValidCodeReqNo();
|
String validCodeReqNo = authGetPhoneValidCodeParam.getValidCodeReqNo();
|
||||||
// 校验参数
|
// 校验参数
|
||||||
validPhoneOrEmailValidCodeParam(null, AuthPhoneOrEmailTypeEnum.PHONE.getValue(), validCode, validCodeReqNo, type);
|
validValidCode(null, validCode, validCodeReqNo);
|
||||||
// 生成手机验证码的值,随机6为数字
|
// 生成手机验证码的值,随机6为数字
|
||||||
String phoneValidCode = RandomUtil.randomNumbers(6);
|
String phoneValidCode = RandomUtil.randomNumbers(6);
|
||||||
// 生成手机验证码的请求号
|
// 生成手机验证码的请求号
|
||||||
|
@ -257,7 +257,7 @@ public class AuthServiceImpl implements AuthService {
|
||||||
// 验证码请求号
|
// 验证码请求号
|
||||||
String validCodeReqNo = authGetEmailValidCodeParam.getValidCodeReqNo();
|
String validCodeReqNo = authGetEmailValidCodeParam.getValidCodeReqNo();
|
||||||
// 校验参数
|
// 校验参数
|
||||||
validPhoneOrEmailValidCodeParam(null, AuthPhoneOrEmailTypeEnum.EMAIL.getValue(), validCode, validCodeReqNo, type);
|
validValidCode(null, validCode, validCodeReqNo);
|
||||||
// 生成邮箱验证码的值,随机6为数字
|
// 生成邮箱验证码的值,随机6为数字
|
||||||
String emailValidCode = RandomUtil.randomNumbers(6);
|
String emailValidCode = RandomUtil.randomNumbers(6);
|
||||||
// 生成邮箱验证码的请求号
|
// 生成邮箱验证码的请求号
|
||||||
|
@ -351,59 +351,63 @@ public class AuthServiceImpl implements AuthService {
|
||||||
* @author xuyuxiang
|
* @author xuyuxiang
|
||||||
* @date 2022/8/25 14:29
|
* @date 2022/8/25 14:29
|
||||||
**/
|
**/
|
||||||
private String validPhoneOrEmailValidCodeParam(String phoneOrEmail, String phoneOrEmailType, String validCode,
|
private String validPhoneOrEmailValidCodeParam(String phoneOrEmail, String phoneOrEmailType,
|
||||||
String validCodeReqNo, String type) {
|
String validCode, String validCodeReqNo, String type) {
|
||||||
// 验证码正确则校验手机号格式
|
// 校验手机号或邮箱类型
|
||||||
if(ObjectUtil.isEmpty(phoneOrEmail)) {
|
AuthPhoneOrEmailTypeEnum.validate(phoneOrEmailType);
|
||||||
// 根据手机号或者邮箱获取用户信息,判断用户是否存在,根据B端或C端判断
|
// 校验手机号或邮箱格式
|
||||||
if(SaClientTypeEnum.B.getValue().equals(type)) {
|
if(phoneOrEmailType.equals(AuthPhoneOrEmailTypeEnum.PHONE.getValue())) {
|
||||||
if(phoneOrEmailType.equals(AuthPhoneOrEmailTypeEnum.PHONE.getValue())) {
|
if(!PhoneUtil.isMobile(phoneOrEmail)) {
|
||||||
SaBaseLoginUser saBaseLoginUser = loginUserApi.getUserByPhone(phoneOrEmail);
|
throw new CommonException(AuthExceptionEnum.PHONE_FORMAT_ERROR.getValue());
|
||||||
if(ObjectUtil.isEmpty(saBaseLoginUser)) {
|
|
||||||
// B端手机号无对应用户时策略
|
|
||||||
return devConfigApi.getValueByKey(SNOWY_SYS_DEFAULT_STRATEGY_WHEN_NO_USER_WITH_PHONE_FOR_B_KEY);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
SaBaseLoginUser saBaseLoginUser = loginUserApi.getUserByEmail(phoneOrEmail);
|
|
||||||
if(ObjectUtil.isEmpty(saBaseLoginUser)) {
|
|
||||||
// B端邮箱无对应用户时策略
|
|
||||||
return devConfigApi.getValueByKey(SNOWY_SYS_DEFAULT_STRATEGY_WHEN_NO_USER_WITH_EMAIL_FOR_B_KEY);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if(phoneOrEmailType.equals(AuthPhoneOrEmailTypeEnum.PHONE.getValue())) {
|
|
||||||
SaBaseClientLoginUser saBaseClientLoginUser = clientLoginUserApi.getClientUserByPhone(phoneOrEmail);
|
|
||||||
if(ObjectUtil.isEmpty(saBaseClientLoginUser)) {
|
|
||||||
// C端手机号无对应用户时策略
|
|
||||||
return devConfigApi.getValueByKey(SNOWY_SYS_DEFAULT_STRATEGY_WHEN_NO_USER_WITH_PHONE_FOR_C_KEY);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
SaBaseClientLoginUser saBaseClientLoginUser = clientLoginUserApi.getClientUserByEmail(phoneOrEmail);
|
|
||||||
if(ObjectUtil.isEmpty(saBaseClientLoginUser)) {
|
|
||||||
// BC端邮箱无对应用户时策略
|
|
||||||
return devConfigApi.getValueByKey(SNOWY_SYS_DEFAULT_STRATEGY_WHEN_NO_USER_WITH_EMAIL_FOR_C_KEY);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// 执行校验图形验证码
|
|
||||||
validValidCode(null, validCode, validCodeReqNo);
|
|
||||||
// 返回空值
|
|
||||||
return null;
|
|
||||||
} else {
|
} else {
|
||||||
AuthPhoneOrEmailTypeEnum.validate(phoneOrEmailType);
|
if(CommonEmailUtil.isNotEmail(phoneOrEmail)) {
|
||||||
|
throw new CommonException(AuthExceptionEnum.PHONE_FORMAT_ERROR.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 先校验验证码
|
||||||
|
validValidCode(phoneOrEmail, validCode, validCodeReqNo);
|
||||||
|
// 根据手机号或者邮箱获取用户信息,判断用户是否存在,根据B端或C端判断
|
||||||
|
if(SaClientTypeEnum.B.getValue().equals(type)) {
|
||||||
if(phoneOrEmailType.equals(AuthPhoneOrEmailTypeEnum.PHONE.getValue())) {
|
if(phoneOrEmailType.equals(AuthPhoneOrEmailTypeEnum.PHONE.getValue())) {
|
||||||
if(!PhoneUtil.isMobile(phoneOrEmail)) {
|
SaBaseLoginUser saBaseLoginUser = loginUserApi.getUserByPhone(phoneOrEmail);
|
||||||
throw new CommonException(AuthExceptionEnum.PHONE_FORMAT_ERROR.getValue());
|
if(ObjectUtil.isEmpty(saBaseLoginUser)) {
|
||||||
|
// B端手机号无对应用户时策略
|
||||||
|
return devConfigApi.getValueByKey(SNOWY_SYS_DEFAULT_STRATEGY_WHEN_NO_USER_WITH_PHONE_FOR_B_KEY);
|
||||||
|
} else {
|
||||||
|
// 存在则允许登录
|
||||||
|
return AuthStrategyWhenNoUserWithPhoneOrEmailEnum.ALLOW_LOGIN.getValue();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(CommonEmailUtil.isNotEmail(phoneOrEmail)) {
|
SaBaseLoginUser saBaseLoginUser = loginUserApi.getUserByEmail(phoneOrEmail);
|
||||||
throw new CommonException(AuthExceptionEnum.PHONE_FORMAT_ERROR.getValue());
|
if(ObjectUtil.isEmpty(saBaseLoginUser)) {
|
||||||
|
// B端邮箱无对应用户时策略
|
||||||
|
return devConfigApi.getValueByKey(SNOWY_SYS_DEFAULT_STRATEGY_WHEN_NO_USER_WITH_EMAIL_FOR_B_KEY);
|
||||||
|
} else {
|
||||||
|
// 存在则允许登录
|
||||||
|
return AuthStrategyWhenNoUserWithPhoneOrEmailEnum.ALLOW_LOGIN.getValue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if(phoneOrEmailType.equals(AuthPhoneOrEmailTypeEnum.PHONE.getValue())) {
|
||||||
|
SaBaseClientLoginUser saBaseClientLoginUser = clientLoginUserApi.getClientUserByPhone(phoneOrEmail);
|
||||||
|
if(ObjectUtil.isEmpty(saBaseClientLoginUser)) {
|
||||||
|
// C端手机号无对应用户时策略
|
||||||
|
return devConfigApi.getValueByKey(SNOWY_SYS_DEFAULT_STRATEGY_WHEN_NO_USER_WITH_PHONE_FOR_C_KEY);
|
||||||
|
} else {
|
||||||
|
// 存在则允许登录
|
||||||
|
return AuthStrategyWhenNoUserWithPhoneOrEmailEnum.ALLOW_LOGIN.getValue();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
SaBaseClientLoginUser saBaseClientLoginUser = clientLoginUserApi.getClientUserByEmail(phoneOrEmail);
|
||||||
|
if(ObjectUtil.isEmpty(saBaseClientLoginUser)) {
|
||||||
|
// C端邮箱无对应用户时策略
|
||||||
|
return devConfigApi.getValueByKey(SNOWY_SYS_DEFAULT_STRATEGY_WHEN_NO_USER_WITH_EMAIL_FOR_C_KEY);
|
||||||
|
} else {
|
||||||
|
// 存在则允许登录
|
||||||
|
return AuthStrategyWhenNoUserWithPhoneOrEmailEnum.ALLOW_LOGIN.getValue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 执行校验手机或者邮箱验证码
|
|
||||||
validValidCode(phoneOrEmail, validCode, validCodeReqNo);
|
|
||||||
// 返回空值
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -504,41 +508,53 @@ public class AuthServiceImpl implements AuthService {
|
||||||
}
|
}
|
||||||
// 根据手机号获取用户信息,根据B端或C端判断
|
// 根据手机号获取用户信息,根据B端或C端判断
|
||||||
if(SaClientTypeEnum.B.getValue().equals(type)) {
|
if(SaClientTypeEnum.B.getValue().equals(type)) {
|
||||||
SaBaseLoginUser saBaseLoginUser = loginUserApi.getUserByPhone(phone);
|
// 判断手机号无对应用户时的策略,如果为空则直接抛出异常
|
||||||
if(ObjectUtil.isEmpty(saBaseLoginUser)) {
|
if(ObjectUtil.isEmpty(strategyWhenNoUserWithPhoneOrEmail)) {
|
||||||
// 判断手机号无对应用户时的策略,如果为空则直接抛出异常
|
throw new CommonException("手机号码:{}不存在对应用户", phone);
|
||||||
if(ObjectUtil.isEmpty(strategyWhenNoUserWithPhoneOrEmail)) {
|
} else {
|
||||||
|
// 如果不允许登录,则抛出异常
|
||||||
|
if(AuthStrategyWhenNoUserWithPhoneOrEmailEnum.NOT_ALLOW_LOGIN.getValue().equals(strategyWhenNoUserWithPhoneOrEmail)) {
|
||||||
throw new CommonException("手机号码:{}不存在对应用户", phone);
|
throw new CommonException("手机号码:{}不存在对应用户", phone);
|
||||||
} else {
|
} else {
|
||||||
// 如果不允许登录,则抛出异常
|
// 定义B端用户
|
||||||
if(AuthStrategyWhenNoUserWithPhoneOrEmailEnum.NOT_ALLOW_LOGIN.getValue().equals(strategyWhenNoUserWithPhoneOrEmail)) {
|
SaBaseLoginUser saBaseLoginUser;
|
||||||
throw new CommonException("手机号码:{}不存在对应用户", phone);
|
if(AuthStrategyWhenNoUserWithPhoneOrEmailEnum.ALLOW_LOGIN.getValue().equals(strategyWhenNoUserWithPhoneOrEmail)) {
|
||||||
} else {
|
// 允许登录,即用户存在
|
||||||
|
saBaseLoginUser = loginUserApi.getUserByPhone(phone);
|
||||||
|
}else if(AuthStrategyWhenNoUserWithPhoneOrEmailEnum.AUTO_CREATE_USER.getValue().equals(strategyWhenNoUserWithPhoneOrEmail)) {
|
||||||
// 根据手机号自动创建B端用户
|
// 根据手机号自动创建B端用户
|
||||||
saBaseLoginUser = loginUserApi.createUserWithPhone(phone);
|
saBaseLoginUser = loginUserApi.createUserWithPhone(phone);
|
||||||
|
} else {
|
||||||
|
throw new CommonException("不支持的手机号或邮箱无对应用户时策略类型:{}", strategyWhenNoUserWithPhoneOrEmail);
|
||||||
}
|
}
|
||||||
|
// 执行B端登录
|
||||||
|
return execLoginB(saBaseLoginUser, device);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 执行B端登录
|
|
||||||
return execLoginB(saBaseLoginUser, device);
|
|
||||||
} else {
|
} else {
|
||||||
SaBaseClientLoginUser saBaseClientLoginUser = clientLoginUserApi.getClientUserByPhone(phone);
|
// 判断手机号无对应用户时的策略,如果为空则直接抛出异常
|
||||||
if(ObjectUtil.isEmpty(saBaseClientLoginUser)) {
|
if(ObjectUtil.isEmpty(strategyWhenNoUserWithPhoneOrEmail)) {
|
||||||
// 判断手机号无对应用户时的策略,如果为空则直接抛出异常
|
throw new CommonException("手机号码:{}不存在对应用户", phone);
|
||||||
if(ObjectUtil.isEmpty(strategyWhenNoUserWithPhoneOrEmail)) {
|
} else {
|
||||||
|
// 如果不允许登录,则抛出异常
|
||||||
|
if(AuthStrategyWhenNoUserWithPhoneOrEmailEnum.NOT_ALLOW_LOGIN.getValue().equals(strategyWhenNoUserWithPhoneOrEmail)) {
|
||||||
throw new CommonException("手机号码:{}不存在对应用户", phone);
|
throw new CommonException("手机号码:{}不存在对应用户", phone);
|
||||||
} else {
|
} else {
|
||||||
// 如果不允许登录,则抛出异常
|
// 定义C端用户
|
||||||
if(AuthStrategyWhenNoUserWithPhoneOrEmailEnum.NOT_ALLOW_LOGIN.getValue().equals(strategyWhenNoUserWithPhoneOrEmail)) {
|
SaBaseClientLoginUser saBaseClientLoginUser;
|
||||||
throw new CommonException("手机号码:{}不存在对应用户", phone);
|
if(AuthStrategyWhenNoUserWithPhoneOrEmailEnum.ALLOW_LOGIN.getValue().equals(strategyWhenNoUserWithPhoneOrEmail)) {
|
||||||
} else {
|
// 允许登录,即用户存在
|
||||||
// 根据手机号自动创建C端用户
|
saBaseClientLoginUser = clientLoginUserApi.getClientUserByPhone(phone);
|
||||||
|
}else if(AuthStrategyWhenNoUserWithPhoneOrEmailEnum.AUTO_CREATE_USER.getValue().equals(strategyWhenNoUserWithPhoneOrEmail)) {
|
||||||
|
// 根据手机号自动创建B端用户
|
||||||
saBaseClientLoginUser = clientLoginUserApi.createClientUserWithPhone(phone);
|
saBaseClientLoginUser = clientLoginUserApi.createClientUserWithPhone(phone);
|
||||||
|
} else {
|
||||||
|
throw new CommonException("不支持的手机号或邮箱无对应用户时策略类型:{}", strategyWhenNoUserWithPhoneOrEmail);
|
||||||
}
|
}
|
||||||
|
// 执行C端登录
|
||||||
|
return execLoginC(saBaseClientLoginUser, device);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 执行C端登录
|
|
||||||
return execLoginC(saBaseClientLoginUser, device);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -562,41 +578,53 @@ public class AuthServiceImpl implements AuthService {
|
||||||
}
|
}
|
||||||
// 根据邮箱获取用户信息,根据B端或C端判断
|
// 根据邮箱获取用户信息,根据B端或C端判断
|
||||||
if(SaClientTypeEnum.B.getValue().equals(type)) {
|
if(SaClientTypeEnum.B.getValue().equals(type)) {
|
||||||
SaBaseLoginUser saBaseLoginUser = loginUserApi.getUserByEmail(email);
|
// 判断邮箱无对应用户时的策略,如果为空则直接抛出异常
|
||||||
if(ObjectUtil.isEmpty(saBaseLoginUser)) {
|
if(ObjectUtil.isEmpty(strategyWhenNoUserWithPhoneOrEmail)) {
|
||||||
// 判断邮箱无对应用户时的策略,如果为空则直接抛出异常
|
throw new CommonException("邮箱:{}不存在对应用户", email);
|
||||||
if(ObjectUtil.isEmpty(strategyWhenNoUserWithPhoneOrEmail)) {
|
} else {
|
||||||
|
// 如果不允许登录,则抛出异常
|
||||||
|
if(AuthStrategyWhenNoUserWithPhoneOrEmailEnum.NOT_ALLOW_LOGIN.getValue().equals(strategyWhenNoUserWithPhoneOrEmail)) {
|
||||||
throw new CommonException("邮箱:{}不存在对应用户", email);
|
throw new CommonException("邮箱:{}不存在对应用户", email);
|
||||||
} else {
|
} else {
|
||||||
// 如果不允许登录,则抛出异常
|
// 定义B端用户
|
||||||
if(AuthStrategyWhenNoUserWithPhoneOrEmailEnum.NOT_ALLOW_LOGIN.getValue().equals(strategyWhenNoUserWithPhoneOrEmail)) {
|
SaBaseLoginUser saBaseLoginUser;
|
||||||
throw new CommonException("邮箱:{}不存在对应用户", email);
|
if(AuthStrategyWhenNoUserWithPhoneOrEmailEnum.ALLOW_LOGIN.getValue().equals(strategyWhenNoUserWithPhoneOrEmail)) {
|
||||||
} else {
|
// 允许登录,即用户存在
|
||||||
|
saBaseLoginUser = loginUserApi.getUserByEmail(email);
|
||||||
|
}else if(AuthStrategyWhenNoUserWithPhoneOrEmailEnum.AUTO_CREATE_USER.getValue().equals(strategyWhenNoUserWithPhoneOrEmail)) {
|
||||||
// 根据邮箱自动创建B端用户
|
// 根据邮箱自动创建B端用户
|
||||||
saBaseLoginUser = loginUserApi.createUserWithEmail(email);
|
saBaseLoginUser = loginUserApi.createUserWithEmail(email);
|
||||||
|
} else {
|
||||||
|
throw new CommonException("不支持的手机号或邮箱无对应用户时策略类型:{}", strategyWhenNoUserWithPhoneOrEmail);
|
||||||
}
|
}
|
||||||
|
// 执行B端登录
|
||||||
|
return execLoginB(saBaseLoginUser, device);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 执行B端登录
|
|
||||||
return execLoginB(saBaseLoginUser, device);
|
|
||||||
} else {
|
} else {
|
||||||
SaBaseClientLoginUser saBaseClientLoginUser = clientLoginUserApi.getClientUserByEmail(email);
|
// 判断邮箱无对应用户时的策略,如果为空则直接抛出异常
|
||||||
if(ObjectUtil.isEmpty(saBaseClientLoginUser)) {
|
if(ObjectUtil.isEmpty(strategyWhenNoUserWithPhoneOrEmail)) {
|
||||||
// 判断邮箱无对应用户时的策略,如果为空则直接抛出异常
|
throw new CommonException("邮箱:{}不存在对应用户", email);
|
||||||
if(ObjectUtil.isEmpty(strategyWhenNoUserWithPhoneOrEmail)) {
|
} else {
|
||||||
|
// 如果不允许登录,则抛出异常
|
||||||
|
if(AuthStrategyWhenNoUserWithPhoneOrEmailEnum.NOT_ALLOW_LOGIN.getValue().equals(strategyWhenNoUserWithPhoneOrEmail)) {
|
||||||
throw new CommonException("邮箱:{}不存在对应用户", email);
|
throw new CommonException("邮箱:{}不存在对应用户", email);
|
||||||
} else {
|
} else {
|
||||||
// 如果不允许登录,则抛出异常
|
// 定义C端用户
|
||||||
if(AuthStrategyWhenNoUserWithPhoneOrEmailEnum.NOT_ALLOW_LOGIN.getValue().equals(strategyWhenNoUserWithPhoneOrEmail)) {
|
SaBaseClientLoginUser saBaseClientLoginUser;
|
||||||
throw new CommonException("邮箱:{}不存在对应用户", email);
|
if(AuthStrategyWhenNoUserWithPhoneOrEmailEnum.ALLOW_LOGIN.getValue().equals(strategyWhenNoUserWithPhoneOrEmail)) {
|
||||||
|
// 允许登录,即用户存在
|
||||||
|
saBaseClientLoginUser = clientLoginUserApi.getClientUserByEmail(email);
|
||||||
|
}else if(AuthStrategyWhenNoUserWithPhoneOrEmailEnum.AUTO_CREATE_USER.getValue().equals(strategyWhenNoUserWithPhoneOrEmail)) {
|
||||||
|
// 根据邮箱自动创建B端用户
|
||||||
|
saBaseClientLoginUser = loginUserApi.createClientUserWithEmail(email);
|
||||||
} else {
|
} else {
|
||||||
// 根据邮箱自动创建C端用户
|
throw new CommonException("不支持的手机号或邮箱无对应用户时策略类型:{}", strategyWhenNoUserWithPhoneOrEmail);
|
||||||
saBaseClientLoginUser = clientLoginUserApi.createClientUserWithEmail(email);
|
|
||||||
}
|
}
|
||||||
|
// 执行C端登录
|
||||||
|
return execLoginC(saBaseClientLoginUser, device);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 执行C端登录
|
|
||||||
return execLoginC(saBaseClientLoginUser, device);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -924,9 +952,9 @@ public class AuthServiceImpl implements AuthService {
|
||||||
String passwordDecrypt = CommonCryptogramUtil.doSm2Decrypt(password);
|
String passwordDecrypt = CommonCryptogramUtil.doSm2Decrypt(password);
|
||||||
// 根据账号获取用户信息,根据B端或C端判断
|
// 根据账号获取用户信息,根据B端或C端判断
|
||||||
if(SaClientTypeEnum.B.getValue().equals(type)) {
|
if(SaClientTypeEnum.B.getValue().equals(type)) {
|
||||||
clientLoginUserApi.doRegister(account, passwordDecrypt);
|
|
||||||
} else {
|
|
||||||
loginUserApi.doRegister(account, passwordDecrypt);
|
loginUserApi.doRegister(account, passwordDecrypt);
|
||||||
|
} else {
|
||||||
|
clientLoginUserApi.doRegister(account, passwordDecrypt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,10 +48,7 @@ import vip.xiaonuo.common.listener.CommonDataChangeEventCenter;
|
||||||
import vip.xiaonuo.common.page.CommonPageRequest;
|
import vip.xiaonuo.common.page.CommonPageRequest;
|
||||||
import vip.xiaonuo.sys.api.SysRoleApi;
|
import vip.xiaonuo.sys.api.SysRoleApi;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.*;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -117,7 +114,13 @@ public class BizOrgServiceImpl extends ServiceImpl<BizOrgMapper, BizOrg> impleme
|
||||||
} else {
|
} else {
|
||||||
return CollectionUtil.newArrayList();
|
return CollectionUtil.newArrayList();
|
||||||
}
|
}
|
||||||
List<TreeNode<String>> treeNodeList = bizOrgSet.stream().map(bizOrg ->
|
// 先根据排序码排序
|
||||||
|
List<BizOrg> bizOrgArrayList = CollectionUtil.sort(bizOrgSet, Comparator.comparingInt(BizOrg::getSortCode));
|
||||||
|
// 再重置排序码,解决每次相同排序码顺序不一致的问题
|
||||||
|
for (int i = 0; i < bizOrgArrayList.size(); i++) {
|
||||||
|
bizOrgArrayList.get(i).setSortCode(i);
|
||||||
|
}
|
||||||
|
List<TreeNode<String>> treeNodeList = bizOrgArrayList.stream().map(bizOrg ->
|
||||||
new TreeNode<>(bizOrg.getId(), bizOrg.getParentId(),
|
new TreeNode<>(bizOrg.getId(), bizOrg.getParentId(),
|
||||||
bizOrg.getName(), bizOrg.getSortCode()).setExtra(JSONUtil.parseObj(bizOrg)))
|
bizOrg.getName(), bizOrg.getSortCode()).setExtra(JSONUtil.parseObj(bizOrg)))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
|
@ -148,7 +148,7 @@ public class DevPushWorkWechatUtil {
|
||||||
weTalkRequestArticle.setDescription(content);
|
weTalkRequestArticle.setDescription(content);
|
||||||
weTalkRequestArticle.setPicUrl(picUrl);
|
weTalkRequestArticle.setPicUrl(picUrl);
|
||||||
weTalkRequestArticle.setUrl(messageUrl);
|
weTalkRequestArticle.setUrl(messageUrl);
|
||||||
request.setArticleList(CollectionUtil.newArrayList());
|
request.setArticleList(CollectionUtil.newArrayList(weTalkRequestArticle));
|
||||||
Response response = oaSender.sender(request, MessageType.WE_TALK_NEWS);
|
Response response = oaSender.sender(request, MessageType.WE_TALK_NEWS);
|
||||||
if(!response.isSuccess()) {
|
if(!response.isSuccess()) {
|
||||||
throw new CommonException("消息推送错误,返回内容:{}", JSONUtil.toJsonStr(response.getData()));
|
throw new CommonException("消息推送错误,返回内容:{}", JSONUtil.toJsonStr(response.getData()));
|
||||||
|
|
|
@ -243,6 +243,11 @@ public class MobileMenuServiceImpl extends ServiceImpl<MobileMenuMapper, MobileM
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
List<JSONObject> leafMenuList = CollectionUtil.newArrayList();
|
List<JSONObject> leafMenuList = CollectionUtil.newArrayList();
|
||||||
|
MobileMenu rootMobileMenu = new MobileMenu();
|
||||||
|
rootMobileMenu.setId("0");
|
||||||
|
rootMobileMenu.setParentId("-1");
|
||||||
|
rootMobileMenu.setSortCode(-1);
|
||||||
|
mobileMenuList.add(rootMobileMenu);
|
||||||
List<TreeNode<String>> treeNodeList = mobileMenuList.stream().map(mobileMenu ->
|
List<TreeNode<String>> treeNodeList = mobileMenuList.stream().map(mobileMenu ->
|
||||||
new TreeNode<>(mobileMenu.getId(), mobileMenu.getParentId(),
|
new TreeNode<>(mobileMenu.getId(), mobileMenu.getParentId(),
|
||||||
mobileMenu.getTitle(), mobileMenu.getSortCode())).collect(Collectors.toList());
|
mobileMenu.getTitle(), mobileMenu.getSortCode())).collect(Collectors.toList());
|
||||||
|
@ -267,7 +272,7 @@ public class MobileMenuServiceImpl extends ServiceImpl<MobileMenuMapper, MobileM
|
||||||
mobileRoleGrantResourceMenuResult.set("parentName", parentJsonObject.getStr("parentName"));
|
mobileRoleGrantResourceMenuResult.set("parentName", parentJsonObject.getStr("parentName"));
|
||||||
}
|
}
|
||||||
mobileRoleGrantResourceMenuResult.set("button", this.getChildListById(mobileButtonList, mobileMenu.getId(), false)
|
mobileRoleGrantResourceMenuResult.set("button", this.getChildListById(mobileButtonList, mobileMenu.getId(), false)
|
||||||
.stream().map(sysMenuItem -> JSONUtil.createObj().set("id", sysMenuItem.getId()).set("title", sysMenuItem.getTitle()))
|
.stream().map(tempMobileMenu -> JSONUtil.createObj().set("id", tempMobileMenu.getId()).set("title", tempMobileMenu.getTitle()))
|
||||||
.collect(Collectors.toList()));
|
.collect(Collectors.toList()));
|
||||||
leafMenuList.add(mobileRoleGrantResourceMenuResult);
|
leafMenuList.add(mobileRoleGrantResourceMenuResult);
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import vip.xiaonuo.sys.modular.user.entity.SysUserExt;
|
import vip.xiaonuo.sys.modular.user.entity.SysUserExt;
|
||||||
|
import vip.xiaonuo.sys.modular.user.enums.SysUserSourceFromTypeEnum;
|
||||||
import vip.xiaonuo.sys.modular.user.mapper.SysUserExtMapper;
|
import vip.xiaonuo.sys.modular.user.mapper.SysUserExtMapper;
|
||||||
import vip.xiaonuo.sys.modular.user.service.SysUserExtService;
|
import vip.xiaonuo.sys.modular.user.service.SysUserExtService;
|
||||||
|
|
||||||
|
@ -36,6 +37,7 @@ public class SysUserExtServiceImpl extends ServiceImpl<SysUserExtMapper, SysUser
|
||||||
if(ObjectUtil.isEmpty(sysUserExt)){
|
if(ObjectUtil.isEmpty(sysUserExt)){
|
||||||
sysUserExt = new SysUserExt();
|
sysUserExt = new SysUserExt();
|
||||||
sysUserExt.setUserId(userId);
|
sysUserExt.setUserId(userId);
|
||||||
|
sysUserExt.setSourceFromType(SysUserSourceFromTypeEnum.SYSTEM_ADD.getValue());
|
||||||
sysUserExt.setPasswordUpdateTime(DateTime.now());
|
sysUserExt.setPasswordUpdateTime(DateTime.now());
|
||||||
this.save(sysUserExt);
|
this.save(sysUserExt);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue