ad5081d3
孙向锦
初始化项目
|
1
2
3
|
package com.fh.controller.base;
|
fd0087a8
孙向锦
添加英语语言
|
4
|
import javax.servlet.http.Cookie;
|
ad5081d3
孙向锦
初始化项目
|
5
6
|
import javax.servlet.http.HttpServletRequest;
|
92455d76
孙向锦
添加更新到服务器
|
7
|
import org.apache.shiro.session.Session;
|
ad5081d3
孙向锦
初始化项目
|
8
9
10
11
12
|
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.springframework.web.servlet.ModelAndView;
import com.fh.entity.Page;
|
92455d76
孙向锦
添加更新到服务器
|
13
14
15
|
import com.fh.entity.system.User;
import com.fh.util.Const;
import com.fh.util.Jurisdiction;
|
ad5081d3
孙向锦
初始化项目
|
16
17
18
19
20
|
import com.fh.util.Logger;
import com.fh.util.PageData;
import com.fh.util.UuidUtil;
/**
|
ad5081d3
孙向锦
初始化项目
|
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
|
* 修改时间:2015、12、11
*/
public class BaseController {
protected Logger logger = Logger.getLogger(this.getClass());
private static final long serialVersionUID = 6357869213649815390L;
/** new PageData对象
* @return
*/
public PageData getPageData(){
return new PageData(this.getRequest());
}
/**得到ModelAndView
* @return
*/
public ModelAndView getModelAndView(){
return new ModelAndView();
}
/**得到request对象
* @return
*/
public HttpServletRequest getRequest() {
HttpServletRequest request = ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest();
return request;
}
/**得到32位的uuid
* @return
*/
public String get32UUID(){
return UuidUtil.get32UUID();
}
/**得到分页列表的信息
* @return
*/
public Page getPage(){
return new Page();
}
public static void logBefore(Logger logger, String interfaceName){
logger.info("");
logger.info("start");
logger.info(interfaceName);
}
public static void logAfter(Logger logger){
logger.info("end");
logger.info("");
}
|
92455d76
孙向锦
添加更新到服务器
|
76
77
78
79
80
81
82
83
84
|
public String getUsername(){
Session session = Jurisdiction.getSession();
User user = (User)session.getAttribute(Const.SESSION_USER);
if(user != null){
return user.getUSERNAME();
}
return "ERROR";
}
|
338594c8
孙向锦
添加教师端页面
|
85
|
|
a51b67cf
孙向锦
交互第一个版本
|
86
87
88
89
90
91
92
93
94
|
public String getUserID(){
Session session = Jurisdiction.getSession();
User user = (User)session.getAttribute(Const.SESSION_USER);
if(user != null){
return user.getUSER_ID();
}
return "ERROR";
}
|
b9dc59e6
孙向锦
管理员过滤条件
|
95
96
97
98
99
100
|
public String getRole(){
Session session = Jurisdiction.getSession();
String role = (String)session.getAttribute(getUsername() + Const.ROLE_ID);
return role;
}
|
fcd1fe57
孙向锦
报表数据
|
101
|
public String getTeacherID(){
|
c617106f
孙向锦
添加即时测功能
|
102
103
104
105
106
107
108
109
|
Session session = Jurisdiction.getSession();
User user = (User)session.getAttribute(Const.SESSION_USER);
if(user != null){
return user.getTeacherID();
}
return "ERROR";
}
|
a51b67cf
孙向锦
交互第一个版本
|
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
|
public String getSchoolID(){
Session session = Jurisdiction.getSession();
String schoolName = (String)session.getAttribute(getUsername() + Const.SCHOOL_ID);
return schoolName;
}
public String getSchoolName(){
Session session = Jurisdiction.getSession();
String schoolName = (String)session.getAttribute(getUsername() + Const.SCHOOL_NAME);
return schoolName;
}
public String getGradeID(){
Session session = Jurisdiction.getSession();
String schoolName = (String)session.getAttribute(getUsername() + Const.GRADE_ID);
return schoolName;
}
public String getGradeName(){
Session session = Jurisdiction.getSession();
String schoolName = (String)session.getAttribute(getUsername() + Const.GRADE_NAME);
return schoolName;
}
public String getSubjectId(){
Session session = Jurisdiction.getSession();
String schoolName = (String)session.getAttribute(getUsername() + Const.SUBJECT_ID);
return schoolName;
}
public String getSubjectName(){
Session session = Jurisdiction.getSession();
String schoolName = (String)session.getAttribute(getUsername() + Const.SUBJECT_NAME);
return schoolName;
}
public String getClassId(){
Session session = Jurisdiction.getSession();
String schoolName = (String)session.getAttribute(getUsername() + Const.CLASS_ID);
return schoolName;
}
public String getClassName(){
Session session = Jurisdiction.getSession();
String schoolName = (String)session.getAttribute(getUsername() + Const.CLASS_NAME);
return schoolName;
}
|
338594c8
孙向锦
添加教师端页面
|
151
|
|
fd0087a8
孙向锦
添加英语语言
|
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
|
public String getCookieLanguage(){
Cookie[] cookies = getRequest().getCookies();
if (cookies != null) {
for (Cookie cookie : cookies) {
if (cookie.getName().equals("lang")) {
return cookie.getValue();
}
}
}
return null;
}
public String getLang() {
String lang = getCookieLanguage();
if(lang == null){
lang = getRequest().getLocale().getLanguage();
}
return lang;
}
public boolean isChineseLanguageClient(){
String lang = getLang();
if(lang != null && lang.length() >= 2){
lang = lang.substring(0,2);
}
return "zh".equals(getLang());
}
|
a479f295
孙向锦
添加了报表逻辑
|
180
|
|
ad5081d3
孙向锦
初始化项目
|
181
|
}
|