Commit 32fd8507c24a64d1cecc6231c042d147f7b4961b
1 parent
6cae848f
1.
Showing
1 changed file
with
93 additions
and
93 deletions
src/main/java/com/bsth/controller/realcontrol/PageForwardingController.java
| 1 | -package com.bsth.controller.realcontrol; | |
| 2 | - | |
| 3 | -import com.bsth.entity.sys.Role; | |
| 4 | -import com.bsth.entity.sys.SysUser; | |
| 5 | -import com.bsth.security.util.SecurityUtils; | |
| 6 | -import org.slf4j.Logger; | |
| 7 | -import org.slf4j.LoggerFactory; | |
| 8 | -import org.springframework.stereotype.Controller; | |
| 9 | -import org.springframework.web.bind.annotation.PathVariable; | |
| 10 | -import org.springframework.web.bind.annotation.RequestMapping; | |
| 11 | -import org.springframework.web.servlet.ModelAndView; | |
| 12 | - | |
| 13 | -import javax.servlet.http.HttpServletResponse; | |
| 14 | -import javax.ws.rs.Path; | |
| 15 | - | |
| 16 | -/** | |
| 17 | - * 线调登入页面转发 | |
| 18 | - * Created by panzhao on 2017/1/21. | |
| 19 | - */ | |
| 20 | -@Controller | |
| 21 | -@RequestMapping("real_control") | |
| 22 | -public class PageForwardingController { | |
| 23 | - | |
| 24 | - Logger logger = LoggerFactory.getLogger(this.getClass()); | |
| 25 | - | |
| 26 | - /*@RequestMapping("/v2") | |
| 27 | - public ModelAndView v2(HttpServletResponse response){ | |
| 28 | - ModelAndView mv = new ModelAndView(); | |
| 29 | - SysUser user = SecurityUtils.getCurrentUser(); | |
| 30 | - | |
| 31 | - //班次管理员 | |
| 32 | - if(user.getUserName().equals("bcgly")){ | |
| 33 | - mv.setViewName("/real_control_v2/sch_manage/sch_imitate.html"); | |
| 34 | - return mv; | |
| 35 | - } | |
| 36 | - | |
| 37 | - try{ | |
| 38 | - //闵行运管所,直接打开地图页面 | |
| 39 | - if(user.getRoles().size() == 1){ | |
| 40 | - for(Role role : user.getRoles()){ | |
| 41 | - if(role.getCodeName().equals("MH_YGS")){ | |
| 42 | - // 直接重定向 | |
| 43 | - response.sendRedirect("/pages/mapmonitor/alone/wrap.html"); | |
| 44 | - return null; | |
| 45 | - } | |
| 46 | - } | |
| 47 | - } | |
| 48 | - }catch (Exception e){ | |
| 49 | - logger.error("", e); | |
| 50 | - } | |
| 51 | - | |
| 52 | - //正常线调主页 | |
| 53 | - mv.setViewName("/real_control_v2/main.html"); | |
| 54 | - return mv; | |
| 55 | - }*/ | |
| 56 | - | |
| 57 | - @RequestMapping("/{type}") | |
| 58 | - public ModelAndView v2(@PathVariable("type") String type, HttpServletResponse response){ | |
| 59 | - ModelAndView mv = new ModelAndView(); | |
| 60 | - SysUser user = SecurityUtils.getCurrentUser(); | |
| 61 | - | |
| 62 | - //班次管理员 | |
| 63 | - if(user.getUserName().equals("bcgly")){ | |
| 64 | - mv.setViewName("/real_control_v2/sch_manage/sch_imitate.html"); | |
| 65 | - return mv; | |
| 66 | - } | |
| 67 | - | |
| 68 | - try{ | |
| 69 | - //闵行运管所,直接打开地图页面 | |
| 70 | - if(user.getRoles().size() == 1){ | |
| 71 | - for(Role role : user.getRoles()){ | |
| 72 | - if(role.getCodeName().equals("MH_YGS")){ | |
| 73 | - // 直接重定向 | |
| 74 | - response.sendRedirect("/pages/mapmonitor/alone/wrap.html"); | |
| 75 | - return null; | |
| 76 | - } | |
| 77 | - } | |
| 78 | - } | |
| 79 | - }catch (Exception e){ | |
| 80 | - logger.error("", e); | |
| 81 | - } | |
| 82 | - | |
| 83 | - | |
| 84 | - if(type.equals("v2_mobile")){ | |
| 85 | - mv.setViewName("/real_control_v2_mobile/main.html"); | |
| 86 | - }else{ | |
| 87 | - //正常线调主页 | |
| 88 | - mv.setViewName("/real_control_v2/main.html"); | |
| 89 | - } | |
| 90 | - | |
| 91 | - return mv; | |
| 92 | - } | |
| 93 | -} | |
| 1 | +package com.bsth.controller.realcontrol; | |
| 2 | + | |
| 3 | +import com.bsth.entity.sys.Role; | |
| 4 | +import com.bsth.entity.sys.SysUser; | |
| 5 | +import com.bsth.security.util.SecurityUtils; | |
| 6 | +import org.slf4j.Logger; | |
| 7 | +import org.slf4j.LoggerFactory; | |
| 8 | +import org.springframework.stereotype.Controller; | |
| 9 | +import org.springframework.web.bind.annotation.PathVariable; | |
| 10 | +import org.springframework.web.bind.annotation.RequestMapping; | |
| 11 | +import org.springframework.web.servlet.ModelAndView; | |
| 12 | + | |
| 13 | +import javax.servlet.http.HttpServletResponse; | |
| 14 | +import javax.ws.rs.Path; | |
| 15 | + | |
| 16 | +/** | |
| 17 | + * 线调登入页面转发 | |
| 18 | + * Created by panzhao on 2017/1/21. | |
| 19 | + */ | |
| 20 | +@Controller | |
| 21 | +@RequestMapping("real_control") | |
| 22 | +public class PageForwardingController { | |
| 23 | + | |
| 24 | + Logger logger = LoggerFactory.getLogger(this.getClass()); | |
| 25 | + | |
| 26 | + /*@RequestMapping("/v2") | |
| 27 | + public ModelAndView v2(HttpServletResponse response){ | |
| 28 | + ModelAndView mv = new ModelAndView(); | |
| 29 | + SysUser user = SecurityUtils.getCurrentUser(); | |
| 30 | + | |
| 31 | + //班次管理员 | |
| 32 | + if(user.getUserName().equals("bcgly")){ | |
| 33 | + mv.setViewName("/real_control_v2/sch_manage/sch_imitate.html"); | |
| 34 | + return mv; | |
| 35 | + } | |
| 36 | + | |
| 37 | + try{ | |
| 38 | + //闵行运管所,直接打开地图页面 | |
| 39 | + if(user.getRoles().size() == 1){ | |
| 40 | + for(Role role : user.getRoles()){ | |
| 41 | + if(role.getCodeName().equals("MH_YGS")){ | |
| 42 | + // 直接重定向 | |
| 43 | + response.sendRedirect("/pages/mapmonitor/alone/wrap.html"); | |
| 44 | + return null; | |
| 45 | + } | |
| 46 | + } | |
| 47 | + } | |
| 48 | + }catch (Exception e){ | |
| 49 | + logger.error("", e); | |
| 50 | + } | |
| 51 | + | |
| 52 | + //正常线调主页 | |
| 53 | + mv.setViewName("/real_control_v2/main.html"); | |
| 54 | + return mv; | |
| 55 | + }*/ | |
| 56 | + | |
| 57 | + @RequestMapping("/{type}") | |
| 58 | + public ModelAndView v2(@PathVariable("type") String type, HttpServletResponse response){ | |
| 59 | + ModelAndView mv = new ModelAndView(); | |
| 60 | + SysUser user = SecurityUtils.getCurrentUser(); | |
| 61 | + | |
| 62 | + //班次管理员 | |
| 63 | + if(user.getUserName().equals("bcgly")){ | |
| 64 | + mv.setViewName("/real_control_v2/sch_manage/sch_imitate"); | |
| 65 | + return mv; | |
| 66 | + } | |
| 67 | + | |
| 68 | + try{ | |
| 69 | + //闵行运管所,直接打开地图页面 | |
| 70 | + if(user.getRoles().size() == 1){ | |
| 71 | + for(Role role : user.getRoles()){ | |
| 72 | + if(role.getCodeName().equals("MH_YGS")){ | |
| 73 | + // 直接重定向 | |
| 74 | + response.sendRedirect("/pages/mapmonitor/alone/wrap"); | |
| 75 | + return null; | |
| 76 | + } | |
| 77 | + } | |
| 78 | + } | |
| 79 | + }catch (Exception e){ | |
| 80 | + logger.error("", e); | |
| 81 | + } | |
| 82 | + | |
| 83 | + | |
| 84 | + if(type.equals("v2_mobile")){ | |
| 85 | + mv.setViewName("/real_control_v2_mobile/main"); | |
| 86 | + }else{ | |
| 87 | + //正常线调主页 | |
| 88 | + mv.setViewName("/real_control_v2/main"); | |
| 89 | + } | |
| 90 | + | |
| 91 | + return mv; | |
| 92 | + } | |
| 93 | +} | ... | ... |