|
@@ -4,6 +4,7 @@ import javax.annotation.Resource;
|
|
|
|
|
|
import com.slibra.common.config.ApplicationProperties;
|
|
|
import com.slibra.common.core.domain.model.LoginBody;
|
|
|
+import com.slibra.common.enums.BusinessEnum;
|
|
|
import com.slibra.common.enums.UserStatus;
|
|
|
import com.slibra.common.utils.third.AliSMSUtil;
|
|
|
import com.slibra.common.utils.third.NumUtil;
|
|
@@ -42,6 +43,8 @@ import java.util.HashMap;
|
|
|
import java.util.Map;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
+import static com.slibra.common.constant.MyConstants.LOGIN_TYPE_APPEND;
|
|
|
+
|
|
|
/**
|
|
|
* 登录校验方法
|
|
|
*
|
|
@@ -78,13 +81,18 @@ public class SysLoginService
|
|
|
* @param uuid 唯一标识
|
|
|
* @return 结果
|
|
|
*/
|
|
|
- public String login(String username, String password, String code, String uuid)
|
|
|
+ public String login(String username, String password, String code, String uuid, Integer type)
|
|
|
{
|
|
|
// 验证码校验
|
|
|
// validateCaptcha(username, code, uuid);
|
|
|
+ //做了多环境区分 目前只能在sql层处理了
|
|
|
+ return authUserByNamePwdAndGenToken(username + LOGIN_TYPE_APPEND + type, password);
|
|
|
+ }
|
|
|
+
|
|
|
+ public String authUserByNamePwdAndGenToken(String username, String password) {
|
|
|
// 登录前置校验
|
|
|
loginPreCheck(username, password);
|
|
|
- // 用户验证
|
|
|
+ //认证
|
|
|
Authentication authentication = null;
|
|
|
try
|
|
|
{
|
|
@@ -201,7 +209,9 @@ public class SysLoginService
|
|
|
// 手机号码
|
|
|
phoneNumber = phoneNumber.trim();
|
|
|
// 校验手机号
|
|
|
- SysUser user = userService.selectUserByPhonenumber(phoneNumber);
|
|
|
+// SysUser user = userService.selectUserByPhonenumber(phoneNumber);
|
|
|
+ //多环境区分,目前这些只涉及到前端接口,所以目前在此写死
|
|
|
+ SysUser user = userService.selectUserByPhonenumber(phoneNumber + LOGIN_TYPE_APPEND + BusinessEnum.LoginUserTypeEnum.front.getCode());
|
|
|
if (StringUtils.isNull(user)) {
|
|
|
throw new ServiceException("登录用户:" + phoneNumber+ " 不存在");
|
|
|
}else if (UserStatus.DELETED.getCode().equals(user.getDelFlag())) {
|