Commit 78b12401 by guojx

运维登录相关信息。新版运维登录、运维登录GIC再登录好办

parent 3bb0f553
...@@ -395,15 +395,22 @@ public class EnterpriseController extends WebBaseController { ...@@ -395,15 +395,22 @@ public class EnterpriseController extends WebBaseController {
* @param wxEnterpriseId 企业微信id * @param wxEnterpriseId 企业微信id
*/ */
@RequestMapping("yw-login") @RequestMapping("yw-login")
public HaobanResponse ywLogin(String wxEnterpriseId, String gicEnterpriseId, HttpServletResponse httpServletResponse) throws IOException { public HaobanResponse ywLogin(String wxEnterpriseId, String gicEnterpriseId, HttpServletResponse httpServletResponse,
HttpServletRequest request) throws IOException {
String host = GlobalVar.ctxPropertiesMap.get("haoban_service_host"); String host = GlobalVar.ctxPropertiesMap.get("haoban_service_host");
logger.info("好办运维login,host={},gicEnterpriseId={},wxEnterpriseId={}", host,gicEnterpriseId,wxEnterpriseId); logger.info("好办运维login,host={},gicEnterpriseId={},wxEnterpriseId={}", host,gicEnterpriseId,wxEnterpriseId);
if(org.apache.commons.lang3.StringUtils.isAnyBlank(wxEnterpriseId,gicEnterpriseId)) { if(org.apache.commons.lang3.StringUtils.isAnyBlank(wxEnterpriseId,gicEnterpriseId)) {
return this.fail("wxEnterpriseId和gicEnterpriseId都不能为空") ; return this.fail("wxEnterpriseId和gicEnterpriseId都不能为空") ;
} }
AuthcenterUserDetails loginUser = (AuthcenterUserDetails) SessionContextUtil.getUser(request) ;
String operationUserId = String.valueOf(loginUser.getId());
//运维信息参数
String operationInfo = "&operationUserId=" + operationUserId + "&userName=" + loginUser.getRealName();
String random = "ywLogin:" + UuidUtil.randomUUID(); String random = "ywLogin:" + UuidUtil.randomUUID();
RedisUtil.setCache(random, 1, 10L); RedisUtil.setCache(random, 1, 10L);
String url = host + LOGIN_URL + "?gicEnterpriseId="+gicEnterpriseId+"&wxEnterpriseId=" + wxEnterpriseId + "&random=" + random; String url = host + LOGIN_URL + "?gicEnterpriseId="+gicEnterpriseId+"&wxEnterpriseId=" + wxEnterpriseId + "&random=" + random
+ operationInfo;
httpServletResponse.sendRedirect(url); httpServletResponse.sendRedirect(url);
return this.success(null) ; return this.success(null) ;
} }
......
...@@ -181,7 +181,7 @@ public class LoginController extends WebBaseController { ...@@ -181,7 +181,7 @@ public class LoginController extends WebBaseController {
} }
} }
logger.info("登录商户={}",gicEnterpriseId); logger.info("登录商户={}",gicEnterpriseId);
String code = this.doLogin(wxEnterpriseId, gicEnterpriseId, loginPhoneNumber, "gic", response); String code = this.doLogin(wxEnterpriseId, gicEnterpriseId, loginPhoneNumber, "gic", response, null, null);
if (StringUtils.isNotBlank(code)) { if (StringUtils.isNotBlank(code)) {
try { try {
response.sendRedirect(host+"/haoban-3/#/gic-error?errorCode="+code); response.sendRedirect(host+"/haoban-3/#/gic-error?errorCode="+code);
...@@ -200,7 +200,7 @@ public class LoginController extends WebBaseController { ...@@ -200,7 +200,7 @@ public class LoginController extends WebBaseController {
@IgnoreLogin @IgnoreLogin
@RequestMapping("yw-login") @RequestMapping("yw-login")
public HaobanResponse ywLogin(String wxEnterpriseId, String gicEnterpriseId, String random, public HaobanResponse ywLogin(String wxEnterpriseId, String gicEnterpriseId, String random,
HttpServletResponse response) { HttpServletResponse response, String operationUserId, String userName) {
// 判断是否存在random // 判断是否存在random
Object o = RedisUtil.getCache(random); Object o = RedisUtil.getCache(random);
if (o == null) { if (o == null) {
...@@ -214,7 +214,8 @@ public class LoginController extends WebBaseController { ...@@ -214,7 +214,8 @@ public class LoginController extends WebBaseController {
if (StringUtils.isBlank(gicSuperPhone)) { if (StringUtils.isBlank(gicSuperPhone)) {
return this.fail("商户超管的手机号未配置"); return this.fail("商户超管的手机号未配置");
} }
String code = this.doLogin(wxEnterpriseId, gicEnterpriseId, gicSuperPhone, "yw", response); //运维单点登录信息:operationUserId userName : 运维realName
String code = this.doLogin(wxEnterpriseId, gicEnterpriseId, gicSuperPhone, "yw", response, operationUserId, userName);
if (StringUtils.isNotBlank(code)) { if (StringUtils.isNotBlank(code)) {
return this.fail(this.errMessage(code)); return this.fail(this.errMessage(code));
} }
...@@ -275,7 +276,12 @@ public class LoginController extends WebBaseController { ...@@ -275,7 +276,12 @@ public class LoginController extends WebBaseController {
new RedirectView("/haoban-3/#/gic-error?errorCode=1001", false, false)); new RedirectView("/haoban-3/#/gic-error?errorCode=1001", false, false));
return model; return model;
} }
String errorCode = this.doLogin(wxEnterpriseId, gicEnterpriseId, loginPhoneNumber, "gic", response);
//运维登录信息
String operationUserId = jsonObject.getString("operationUserId");
String userName = jsonObject.getString("userName");
String errorCode = this.doLogin(wxEnterpriseId, gicEnterpriseId, loginPhoneNumber, "gic", response, operationUserId, userName);
if (StringUtils.isNotBlank(errorCode)) { if (StringUtils.isNotBlank(errorCode)) {
ModelAndView model = new ModelAndView( ModelAndView model = new ModelAndView(
new RedirectView("/haoban-3/#/gic-error?errorCode=" + errorCode, false, false)); new RedirectView("/haoban-3/#/gic-error?errorCode=" + errorCode, false, false));
...@@ -311,7 +317,8 @@ public class LoginController extends WebBaseController { ...@@ -311,7 +317,8 @@ public class LoginController extends WebBaseController {
// 登录逻辑 // 登录逻辑
private String doLogin(String wxEnterpriseId, String gicEnterpriseId, String loginPhoneNumber, String loginChannel, private String doLogin(String wxEnterpriseId, String gicEnterpriseId, String loginPhoneNumber, String loginChannel,
HttpServletResponse response) { HttpServletResponse response, String operationUserId, String userName) {
//运维单点登录信息:operationUserId userName : 运维realName
logger.info("doLogin={},{}",gicEnterpriseId,loginPhoneNumber); logger.info("doLogin={},{}",gicEnterpriseId,loginPhoneNumber);
WxApplicationDTO application = wxApplicationApiService.selectByWxEnterpriseIdAndApplicationType(wxEnterpriseId,2); WxApplicationDTO application = wxApplicationApiService.selectByWxEnterpriseIdAndApplicationType(wxEnterpriseId,2);
if (null == application) { if (null == application) {
...@@ -365,6 +372,9 @@ public class LoginController extends WebBaseController { ...@@ -365,6 +372,9 @@ public class LoginController extends WebBaseController {
webLoginDTO.setBrandName(en.getBrandName()); webLoginDTO.setBrandName(en.getBrandName());
webLoginDTO.setSuperAdmin(clerk.getSuperAdmin()); webLoginDTO.setSuperAdmin(clerk.getSuperAdmin());
webLoginDTO.setDepartAuth(clerk.getDepartAuth()); webLoginDTO.setDepartAuth(clerk.getDepartAuth());
//运维登录信息
webLoginDTO.setOperationUserId(operationUserId);
webLoginDTO.setOperationUserName(userName);
String redirectUri = config.getHost() + "index"; String redirectUri = config.getHost() + "index";
redirectUri = redirectUri.replace("haoban-manage3-web", "haoban-3/#"); redirectUri = redirectUri.replace("haoban-manage3-web", "haoban-3/#");
String token = ToolUtil.randomUUID() + "-" + ToolUtil.randomStringByTime(); String token = ToolUtil.randomUUID() + "-" + ToolUtil.randomStringByTime();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment