|
|
@ -4,6 +4,7 @@ import cn.estsh.i3plus.core.api.iservice.base.ISystemInitService;
|
|
|
|
import cn.estsh.i3plus.core.api.iservice.base.ISystemLoginService;
|
|
|
|
import cn.estsh.i3plus.core.api.iservice.base.ISystemLoginService;
|
|
|
|
import cn.estsh.i3plus.core.api.iservice.busi.*;
|
|
|
|
import cn.estsh.i3plus.core.api.iservice.busi.*;
|
|
|
|
import cn.estsh.i3plus.platform.common.exception.ImppExceptionEnum;
|
|
|
|
import cn.estsh.i3plus.platform.common.exception.ImppExceptionEnum;
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.platform.common.tool.CookieTool;
|
|
|
|
import cn.estsh.i3plus.platform.common.tool.ServletRequestTool;
|
|
|
|
import cn.estsh.i3plus.platform.common.tool.ServletRequestTool;
|
|
|
|
import cn.estsh.i3plus.platform.common.tool.StringTool;
|
|
|
|
import cn.estsh.i3plus.platform.common.tool.StringTool;
|
|
|
|
import cn.estsh.i3plus.platform.common.tool.TimeTool;
|
|
|
|
import cn.estsh.i3plus.platform.common.tool.TimeTool;
|
|
|
@ -23,6 +24,7 @@ import cn.estsh.impp.framework.boot.util.ResultBean;
|
|
|
|
import cn.estsh.impp.framework.boot.util.ValidatorBean;
|
|
|
|
import cn.estsh.impp.framework.boot.util.ValidatorBean;
|
|
|
|
import io.swagger.annotations.Api;
|
|
|
|
import io.swagger.annotations.Api;
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
import org.apache.shiro.authc.*;
|
|
|
|
import org.apache.shiro.authc.*;
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
@ -32,6 +34,7 @@ import org.springframework.web.bind.annotation.*;
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
|
|
|
import java.util.Arrays;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Map;
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
|
@ -116,20 +119,22 @@ public class WhiteController extends CoreBaseController {
|
|
|
|
|
|
|
|
|
|
|
|
LOGGER.info("用户登陆 loginName:{} loginPwd:{} languageCode:{}",loginName,loginPwd,languageCode);
|
|
|
|
LOGGER.info("用户登陆 loginName:{} loginPwd:{} languageCode:{}",loginName,loginPwd,languageCode);
|
|
|
|
ResultBean result = null;
|
|
|
|
ResultBean result = null;
|
|
|
|
this.startMultiService();
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
ValidatorBean.checkNotNull(loginName,"用户名不能为空");
|
|
|
|
ValidatorBean.checkNotNull(loginName,"用户名不能为空");
|
|
|
|
ValidatorBean.checkNotNull(loginPwd,"密码不能为空");
|
|
|
|
ValidatorBean.checkNotNull(loginPwd,"密码不能为空");
|
|
|
|
ValidatorBean.checkNotNull(languageCode,"语言不能为空");
|
|
|
|
ValidatorBean.checkNotNull(languageCode,"语言不能为空");
|
|
|
|
|
|
|
|
|
|
|
|
logout();
|
|
|
|
logout();
|
|
|
|
SessionUser user = userService.queryUserLogin(loginName.trim(),loginPwd.trim(),languageCode);
|
|
|
|
|
|
|
|
|
|
|
|
SessionUser user = userService.queryUserLogin(loginName.trim(), loginPwd.trim(), languageCode, getLoginPlatform().getValue());
|
|
|
|
|
|
|
|
|
|
|
|
String redisKey = CommonConstWords.USER_LOGIN_ERROR + "_" + user.getUser().getId();
|
|
|
|
String redisKey = CommonConstWords.USER_LOGIN_ERROR + "_" + user.getUser().getId();
|
|
|
|
redisCore.deleteKey(redisKey);
|
|
|
|
redisCore.deleteKey(redisKey);
|
|
|
|
|
|
|
|
|
|
|
|
LOGGER.info("会员登陆:{}",user);
|
|
|
|
LOGGER.info("会员登陆:{}",user);
|
|
|
|
AuthUtil.setSessionObject("languageCode",languageCode);
|
|
|
|
// Session 信息分装
|
|
|
|
|
|
|
|
AuthUtil.setSessionObject(CommonConstWords.SESSION_LOGIN_LANGUAGE_CODE,languageCode);
|
|
|
|
|
|
|
|
AuthUtil.setSessionObject(CommonConstWords.SESSION_LOGIN_PLATFORM, getLoginPlatform().getValue());
|
|
|
|
|
|
|
|
|
|
|
|
result = new ResultBean(true, AuthUtil.getSession().getId().toString(), AuthUtil.getSessionUser());
|
|
|
|
result = new ResultBean(true, AuthUtil.getSession().getId().toString(), AuthUtil.getSessionUser());
|
|
|
|
result.setUrl("/");
|
|
|
|
result.setUrl("/");
|
|
|
|
|
|
|
|
|
|
|
@ -320,4 +325,38 @@ public class WhiteController extends CoreBaseController {
|
|
|
|
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
|
|
|
|
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* @return 处理结果
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
@GetMapping("/sys-login-platform")
|
|
|
|
|
|
|
|
@ApiOperation(value = "登录标识", notes = "登录标识")
|
|
|
|
|
|
|
|
public ResultBean getSysloginPlatforml() {
|
|
|
|
|
|
|
|
return new ResultBean(true, "操作成功",
|
|
|
|
|
|
|
|
Arrays.asList(CommonEnumUtil.LOG_LOGIN_PLATFORM.values()));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 获取登录平台信息
|
|
|
|
|
|
|
|
* @return
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
private CommonEnumUtil.LOG_LOGIN_PLATFORM getLoginPlatform(){
|
|
|
|
|
|
|
|
String value = CookieTool.getCookieValue(request, CommonConstWords.SESSION_LOGIN_PLATFORM);
|
|
|
|
|
|
|
|
if(StringUtils.isBlank(value)){
|
|
|
|
|
|
|
|
value = CommonEnumUtil.LOG_LOGIN_PLATFORM.PC_IMPP_CORE.getValue() + "";
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
Integer.parseInt(value);
|
|
|
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
|
|
|
|
|
|
|
|
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION_FORMAT.getCode())
|
|
|
|
|
|
|
|
.setErrorDetail("平台登录标识转换错误")
|
|
|
|
|
|
|
|
.setErrorSolution("请重新操作")
|
|
|
|
|
|
|
|
.build();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
CommonEnumUtil.LOG_LOGIN_PLATFORM platform = CommonEnumUtil.LOG_LOGIN_PLATFORM.valueOf(Integer.parseInt(value));
|
|
|
|
|
|
|
|
return platform == null ? CommonEnumUtil.LOG_LOGIN_PLATFORM.PC_IMPP_CORE : platform;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|