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