Commit aaffb6b7 by 墨竹

Merge remote-tracking branch 'origin/developer' into developer

parents 776656bb 31fc52a0
......@@ -395,15 +395,22 @@ public class EnterpriseController extends WebBaseController {
* @param wxEnterpriseId 企业微信id
*/
@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");
logger.info("好办运维login,host={},gicEnterpriseId={},wxEnterpriseId={}", host,gicEnterpriseId,wxEnterpriseId);
if(org.apache.commons.lang3.StringUtils.isAnyBlank(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();
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);
return this.success(null) ;
}
......
......@@ -181,7 +181,7 @@ public class LoginController extends WebBaseController {
}
}
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)) {
try {
response.sendRedirect(host+"/haoban-3/#/gic-error?errorCode="+code);
......@@ -200,7 +200,7 @@ public class LoginController extends WebBaseController {
@IgnoreLogin
@RequestMapping("yw-login")
public HaobanResponse ywLogin(String wxEnterpriseId, String gicEnterpriseId, String random,
HttpServletResponse response) {
HttpServletResponse response, String operationUserId, String userName) {
// 判断是否存在random
Object o = RedisUtil.getCache(random);
if (o == null) {
......@@ -214,7 +214,8 @@ public class LoginController extends WebBaseController {
if (StringUtils.isBlank(gicSuperPhone)) {
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)) {
return this.fail(this.errMessage(code));
}
......@@ -275,7 +276,12 @@ public class LoginController extends WebBaseController {
new RedirectView("/haoban-3/#/gic-error?errorCode=1001", false, false));
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)) {
ModelAndView model = new ModelAndView(
new RedirectView("/haoban-3/#/gic-error?errorCode=" + errorCode, false, false));
......@@ -311,7 +317,8 @@ public class LoginController extends WebBaseController {
// 登录逻辑
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);
WxApplicationDTO application = wxApplicationApiService.selectByWxEnterpriseIdAndApplicationType(wxEnterpriseId,2);
if (null == application) {
......@@ -365,6 +372,9 @@ public class LoginController extends WebBaseController {
webLoginDTO.setBrandName(en.getBrandName());
webLoginDTO.setSuperAdmin(clerk.getSuperAdmin());
webLoginDTO.setDepartAuth(clerk.getDepartAuth());
//运维登录信息
webLoginDTO.setOperationUserId(operationUserId);
webLoginDTO.setOperationUserName(userName);
String redirectUri = config.getHost() + "index";
redirectUri = redirectUri.replace("haoban-manage3-web", "haoban-3/#");
String token = ToolUtil.randomUUID() + "-" + ToolUtil.randomStringByTime();
......@@ -556,7 +566,7 @@ public class LoginController extends WebBaseController {
*/
@RequestMapping("/gic-login-check")
@IgnoreLogin
public ModelAndView gicLogin(String code, String hbEnt,String hbPage) {
public ModelAndView gicLogin(String code, String hbEnt,String hbPage, String operationUserId, String userName) {
logger.info("gic登录clerkId={},hbEnt={}", code, hbEnt);
PowerClerkDTO clerkDTO = this.userService.haobanLoginBack(code);
if (clerkDTO == null) {
......@@ -572,6 +582,9 @@ public class LoginController extends WebBaseController {
retMap.put("enterpriseId", gicEnterpriseId);
retMap.put("phoneNumber", loginPhoneNumber);
retMap.put("timestamp", System.currentTimeMillis()+"") ;
//运维登录信息
retMap.put("operationUserId", operationUserId) ;
retMap.put("userName", userName) ;
String ret = JSONObject.toJSONString(retMap);
AES aes = SecureUtil.aes(LOGIN_KEY.getBytes());
String random = aes.encryptHex(ret);
......
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