|
|
@@ -1,5 +1,7 @@
|
|
|
package com.xunmei.auth.service;
|
|
|
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
+import com.xunmei.auth.form.LoginBody;
|
|
|
import com.xunmei.common.core.constant.CacheConstants;
|
|
|
import com.xunmei.common.core.constant.Constants;
|
|
|
import com.xunmei.common.core.constant.SecurityConstants;
|
|
|
@@ -11,6 +13,7 @@ import com.xunmei.common.core.text.Convert;
|
|
|
import com.xunmei.common.core.utils.StringUtils;
|
|
|
import com.xunmei.common.core.utils.ip.IpUtils;
|
|
|
import com.xunmei.common.redis.utils.RedisUtils;
|
|
|
+import com.xunmei.common.security.utils.SecurityUtils;
|
|
|
import com.xunmei.system.api.RemoteUserService;
|
|
|
import com.xunmei.system.api.domain.SysUser;
|
|
|
import com.xunmei.system.api.model.LoginUser;
|
|
|
@@ -33,6 +36,11 @@ public class SysLoginService{
|
|
|
@Autowired
|
|
|
private SysRecordLogService recordLogService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private FJNXLoginService fjnxLoginService;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 登录
|
|
|
*/
|
|
|
@@ -83,7 +91,30 @@ public class SysLoginService{
|
|
|
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "用户已停用,请联系管理员", platformType);
|
|
|
throw new ServiceException("对不起,您的账号:" + username + " 已停用");
|
|
|
}
|
|
|
- passwordService.validate(user, password, platformType);
|
|
|
+ // 如果人员是从统一门户同步过来的人, 先尝试走行方的账号密码验证
|
|
|
+ if(ObjectUtil.equal(userInfo.getSource(),1))
|
|
|
+ {
|
|
|
+ try{
|
|
|
+ LoginBody login=new LoginBody();
|
|
|
+ login.setUsername(username);
|
|
|
+ login.setPassword(SecurityUtils.decryptSm4(password));
|
|
|
+ //登录统一运营
|
|
|
+ String token = fjnxLoginService.webLoginByPass(login);
|
|
|
+ // 如果统一门户验证失败, 再走本系统默认密码验证
|
|
|
+ if(StringUtils.isEmpty(token)){
|
|
|
+ passwordService.validate(user, password, platformType);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 如果统一门户验证失败, 再走本系统默认密码验证
|
|
|
+ catch (Exception e){
|
|
|
+// e.printStackTrace();
|
|
|
+ passwordService.validate(user, password, platformType);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ passwordService.validate(user, password, platformType);
|
|
|
+ }
|
|
|
recordLogService.recordLogininfor(username, Constants.LOGIN_SUCCESS, "登录成功", platformType);
|
|
|
return userInfo;
|
|
|
}
|