|
|
@@ -640,4 +640,31 @@ public class LoginController extends BaseController {
|
|
|
printJsonP(callback, error("404", "未登录"));
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 跨域切换企业
|
|
|
+ * @param spaceUU 企业uu号
|
|
|
+ * @throws IOException
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/change/userspace", method = RequestMethod.GET)
|
|
|
+ @ResponseBody
|
|
|
+ public void changeUserSpace(Long spaceUU) throws IOException {
|
|
|
+ String callback = request.getParameter("callback");
|
|
|
+ response.setContentType("text/html;charset=UTF-8");
|
|
|
+ SSOToken token = SSOHelper.getToken(request);
|
|
|
+ if (token != null) {
|
|
|
+ SSOToken st = SSOHelper.getToken(request);
|
|
|
+ UserAccount user = JSON.parseObject(st.getData(), UserAccount.class);
|
|
|
+ user = userAccountService.findOneByUserUU(user.getAppId(), user.getUserUU(), spaceUU);
|
|
|
+ if (user == null) {
|
|
|
+ printJsonP(callback, error("403", "切换账号失败"));
|
|
|
+ }
|
|
|
+ st.setData(JSON.toJSONString(user));
|
|
|
+ SSOHelper.setSSOCookie(request, response, st, true);
|
|
|
+ printJsonP(callback, success());
|
|
|
+ } else {
|
|
|
+ // 未登录
|
|
|
+ printJsonP(callback, error("404", "未登录"));
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|