| | |
| | | import com.stylefeng.guns.modular.system.service.IUserService; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | |
| | | public class EmbeddedPageController { |
| | | |
| | | private static final String EMBEDDED_IFRAME_VIEW = "/system/embedded/iframe.html"; |
| | | private static final String ROUTE_SWITCH_URL = "http://192.168.110.22:8087/#/?token="; |
| | | private static final String STATISTICAL_TABLE_URL = "http://192.168.110.22:8087/#/statistical-table?token="; |
| | | |
| | | @Value("${embedded.route-switch-url}") |
| | | private String routeSwitchUrl; |
| | | |
| | | @Value("${embedded.statistical-table-url}") |
| | | private String statisticalTableUrl; |
| | | |
| | | @Autowired |
| | | private IMenuEntryConfigService menuEntryConfigService; |
| | |
| | | @RequestMapping("/embedded/route-switch") |
| | | public String routeSwitch(Model model) throws UnsupportedEncodingException { |
| | | model.addAttribute("title", "路由切换页"); |
| | | model.addAttribute("iframeSrc", ROUTE_SWITCH_URL + generateCurrentUserToken()); |
| | | model.addAttribute("iframeSrc", buildTokenUrl(routeSwitchUrl)); |
| | | return EMBEDDED_IFRAME_VIEW; |
| | | } |
| | | |
| | | @RequestMapping("/embedded/statistical-table") |
| | | public String statisticalTable(Model model) throws UnsupportedEncodingException { |
| | | model.addAttribute("title", "统计板"); |
| | | model.addAttribute("iframeSrc", STATISTICAL_TABLE_URL + generateCurrentUserToken()); |
| | | model.addAttribute("iframeSrc", buildTokenUrl(statisticalTableUrl)); |
| | | return EMBEDDED_IFRAME_VIEW; |
| | | } |
| | | |
| | |
| | | return null; |
| | | } |
| | | |
| | | private String buildTokenUrl(String baseUrl) throws UnsupportedEncodingException { |
| | | return baseUrl + generateCurrentUserToken(); |
| | | } |
| | | |
| | | private String generateCurrentUserToken() throws UnsupportedEncodingException { |
| | | ShiroUser user = ShiroKit.getUser(); |
| | | if (user == null || user.getId() == null) { |