|
@@ -0,0 +1,34 @@
|
|
|
+package com.rtrh.projects.web.controller.passport.api;
|
|
|
+
|
|
|
+import com.rtrh.projects.web.controller.BaseController;
|
|
|
+import com.rtrh.projects.web.util.JwtUtil;
|
|
|
+import com.team.security.TeamShiroUser;
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+
|
|
|
+@RestController
|
|
|
+@RequestMapping("/switch")
|
|
|
+public class SwitchApiController extends BaseController {
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 切换到发改委系统
|
|
|
+ * @param request
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping("/toFgw")
|
|
|
+ public String switchToFgw(HttpServletRequest request) {
|
|
|
+
|
|
|
+ //获取当前用户信息
|
|
|
+ TeamShiroUser curUser = getCurUser();
|
|
|
+ //使用jwt生成token
|
|
|
+ String token = JwtUtil.generateToken(curUser.getLoginName());
|
|
|
+
|
|
|
+ // 拼接 B 系统的 URL
|
|
|
+ String targetUrl = "http://localhost:8090/projects/api/login?token=" + token;
|
|
|
+ return "redirect:" + targetUrl;
|
|
|
+ }
|
|
|
+
|
|
|
+}
|