bed6e1fc
孙向锦
添加其他功能
|
1
2
|
package com.fh.controller.api;
|
338594c8
孙向锦
添加教师端页面
|
3
|
import java.util.ArrayList;
|
bed6e1fc
孙向锦
添加其他功能
|
4
|
import java.util.Date;
|
ce70231e
孙向锦
增加接口
|
5
|
import java.util.Iterator;
|
bed6e1fc
孙向锦
添加其他功能
|
6
|
import java.util.List;
|
ce70231e
孙向锦
增加接口
|
7
|
import java.util.Map;
|
d34f6711
孙向锦
试题
|
8
|
import java.util.Set;
|
bed6e1fc
孙向锦
添加其他功能
|
9
10
|
import javax.annotation.Resource;
|
2480c889
孙向锦
添加软件管理模块。对软件形成统一的管理
|
11
|
import javax.servlet.http.HttpServletRequest;
|
bed6e1fc
孙向锦
添加其他功能
|
12
|
|
338594c8
孙向锦
添加教师端页面
|
13
|
import org.apache.commons.lang.StringUtils;
|
d3d7b2ca
孙向锦
修改表格固定
|
14
|
import org.apache.shiro.crypto.hash.SimpleHash;
|
bed6e1fc
孙向锦
添加其他功能
|
15
|
import org.springframework.stereotype.Controller;
|
bed6e1fc
孙向锦
添加其他功能
|
16
17
18
|
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
|
338594c8
孙向锦
添加教师端页面
|
19
|
import com.fh.bean.Paper;
|
ce70231e
孙向锦
增加接口
|
20
|
import com.fh.bean.Point;
|
338594c8
孙向锦
添加教师端页面
|
21
|
import com.fh.bean.Question;
|
91a745c9
孙向锦
完善后台功能
|
22
23
24
|
import com.fh.bean.StudentAnswer;
import com.fh.bean.TestPaper;
import com.fh.bean.TestPaperInfo;
|
bed6e1fc
孙向锦
添加其他功能
|
25
|
import com.fh.controller.base.BaseController;
|
338594c8
孙向锦
添加教师端页面
|
26
|
import com.fh.controller.sunvote.Myelfun;
|
bed6e1fc
孙向锦
添加其他功能
|
27
28
29
30
|
import com.fh.entity.Page;
import com.fh.service.api.V1Manager;
import com.fh.service.feedback.feedback.FeedbackManager;
import com.fh.service.feedback.problemphenomenon.ProblemPhenomenonManager;
|
2480c889
孙向锦
添加软件管理模块。对软件形成统一的管理
|
31
|
import com.fh.service.software.softwareversion.SoftwareVersionManager;
|
9f161055
孙向锦
修改高斯客户反馈
|
32
|
import com.fh.service.sunvote.attachkeyboard.AttachKeyboardManager;
|
bed6e1fc
孙向锦
添加其他功能
|
33
|
import com.fh.service.sunvote.basestation.BasestationManager;
|
ce70231e
孙向锦
增加接口
|
34
|
import com.fh.service.sunvote.cache.CacheManager;
|
bed6e1fc
孙向锦
添加其他功能
|
35
36
37
38
39
|
import com.fh.service.sunvote.chapter.ChapterManager;
import com.fh.service.sunvote.classbasetation.ClassBasetationManager;
import com.fh.service.sunvote.classroster.ClassRosterManager;
import com.fh.service.sunvote.classtype.ClassTypeManager;
import com.fh.service.sunvote.coursemanagement.CourseManagementManager;
|
9338b563
孙向锦
添加报表
|
40
|
import com.fh.service.sunvote.event.EventManager;
|
bed6e1fc
孙向锦
添加其他功能
|
41
42
43
44
45
|
import com.fh.service.sunvote.grade.GradeManager;
import com.fh.service.sunvote.keypad.KeypadManager;
import com.fh.service.sunvote.keypadcheck.KeypadCheckManager;
import com.fh.service.sunvote.knowledge.KnowledgeManager;
import com.fh.service.sunvote.knowledgechapter.KnowledgeChapterManager;
|
9338b563
孙向锦
添加报表
|
46
|
import com.fh.service.sunvote.networkstatistics.NetworkStatisticsManager;
|
bed6e1fc
孙向锦
添加其他功能
|
47
48
49
50
51
52
53
54
55
|
import com.fh.service.sunvote.paper.PaperManager;
import com.fh.service.sunvote.paperclassteacher.PaperClassTeacherManager;
import com.fh.service.sunvote.paperquestion.PaperQuestionManager;
import com.fh.service.sunvote.papertype.PaperTypeManager;
import com.fh.service.sunvote.question.QuestionManager;
import com.fh.service.sunvote.questiontype.QuestionTypeManager;
import com.fh.service.sunvote.school.SchoolManager;
import com.fh.service.sunvote.schoolgradesubject.SchoolGradeSubjectManager;
import com.fh.service.sunvote.sclass.SClassManager;
|
bed6e1fc
孙向锦
添加其他功能
|
56
|
import com.fh.service.sunvote.student.StudentManager;
|
91a745c9
孙向锦
完善后台功能
|
57
|
import com.fh.service.sunvote.studenttest.StudentTestManager;
|
bed6e1fc
孙向锦
添加其他功能
|
58
|
import com.fh.service.sunvote.subject.SubjectManager;
|
bed6e1fc
孙向锦
添加其他功能
|
59
|
import com.fh.service.sunvote.teacher.TeacherManager;
|
ce70231e
孙向锦
增加接口
|
60
|
import com.fh.service.sunvote.teachingmaterial.TeachingMaterialManager;
|
91a745c9
孙向锦
完善后台功能
|
61
|
import com.fh.service.sunvote.testpaper.TestPaperManager;
|
bed6e1fc
孙向锦
添加其他功能
|
62
|
import com.fh.service.sunvote.testpaperinfo.TestPaperInfoManager;
|
c617106f
孙向锦
添加即时测功能
|
63
|
import com.fh.service.sunvote.textbook.TextbookManager;
|
d3d7b2ca
孙向锦
修改表格固定
|
64
|
import com.fh.service.system.user.UserManager;
|
bed6e1fc
孙向锦
添加其他功能
|
65
|
import com.fh.util.PageData;
|
bed6e1fc
孙向锦
添加其他功能
|
66
67
68
69
70
|
import com.fh.util.Tools;
@Controller
@RequestMapping(value = "/api/v1")
public class V1 extends BaseController {
|
91a745c9
孙向锦
完善后台功能
|
71
|
|
bed6e1fc
孙向锦
添加其他功能
|
72
73
74
75
76
|
@Resource(name = "schoolService")
private SchoolManager schoolService;
@Resource(name = "basestationService")
private BasestationManager basestationService;
|
91a745c9
孙向锦
完善后台功能
|
77
78
|
@Resource(name = "chapterService")
|
bed6e1fc
孙向锦
添加其他功能
|
79
|
private ChapterManager chapterService;
|
91a745c9
孙向锦
完善后台功能
|
80
81
|
@Resource(name = "classbasetationService")
|
bed6e1fc
孙向锦
添加其他功能
|
82
|
private ClassBasetationManager classbasetationService;
|
91a745c9
孙向锦
完善后台功能
|
83
84
|
@Resource(name = "classrosterService")
|
bed6e1fc
孙向锦
添加其他功能
|
85
|
private ClassRosterManager classrosterService;
|
91a745c9
孙向锦
完善后台功能
|
86
87
|
@Resource(name = "classtypeService")
|
c617106f
孙向锦
添加即时测功能
|
88
|
private ClassTypeManager classtypeService;
|
91a745c9
孙向锦
完善后台功能
|
89
90
|
@Resource(name = "gradeService")
|
bed6e1fc
孙向锦
添加其他功能
|
91
|
private GradeManager gradeService;
|
91a745c9
孙向锦
完善后台功能
|
92
93
|
@Resource(name = "coursemanagementService")
|
bed6e1fc
孙向锦
添加其他功能
|
94
95
96
97
|
private CourseManagementManager coursemanagementService;
@Resource(name = "keypadService")
private KeypadManager keypadService;
|
91a745c9
孙向锦
完善后台功能
|
98
99
|
@Resource(name = "keypadcheckService")
|
bed6e1fc
孙向锦
添加其他功能
|
100
|
private KeypadCheckManager keypadcheckService;
|
91a745c9
孙向锦
完善后台功能
|
101
102
|
@Resource(name = "knowledgeService")
|
bed6e1fc
孙向锦
添加其他功能
|
103
|
private KnowledgeManager knowledgeService;
|
91a745c9
孙向锦
完善后台功能
|
104
105
|
@Resource(name = "knowledgechapterService")
|
bed6e1fc
孙向锦
添加其他功能
|
106
|
private KnowledgeChapterManager knowledgechapterService;
|
91a745c9
孙向锦
完善后台功能
|
107
108
|
@Resource(name = "paperService")
|
bed6e1fc
孙向锦
添加其他功能
|
109
|
private PaperManager paperService;
|
91a745c9
孙向锦
完善后台功能
|
110
111
|
@Resource(name = "paperclassteacherService")
|
bed6e1fc
孙向锦
添加其他功能
|
112
|
private PaperClassTeacherManager paperclassteacherService;
|
91a745c9
孙向锦
完善后台功能
|
113
114
|
@Resource(name = "paperquestionService")
|
bed6e1fc
孙向锦
添加其他功能
|
115
|
private PaperQuestionManager paperquestionService;
|
91a745c9
孙向锦
完善后台功能
|
116
117
|
@Resource(name = "papertypeService")
|
bed6e1fc
孙向锦
添加其他功能
|
118
|
private PaperTypeManager papertypeService;
|
91a745c9
孙向锦
完善后台功能
|
119
120
|
@Resource(name = "questionService")
|
bed6e1fc
孙向锦
添加其他功能
|
121
|
private QuestionManager questionService;
|
91a745c9
孙向锦
完善后台功能
|
122
123
|
@Resource(name = "questiontypeService")
|
bed6e1fc
孙向锦
添加其他功能
|
124
|
private QuestionTypeManager questiontypeService;
|
91a745c9
孙向锦
完善后台功能
|
125
126
|
@Resource(name = "schoolgradesubjectService")
|
bed6e1fc
孙向锦
添加其他功能
|
127
|
private SchoolGradeSubjectManager schoolgradesubjectService;
|
91a745c9
孙向锦
完善后台功能
|
128
129
|
@Resource(name = "sclassService")
|
bed6e1fc
孙向锦
添加其他功能
|
130
|
private SClassManager sclassService;
|
91a745c9
孙向锦
完善后台功能
|
131
132
|
@Resource(name = "studentService")
|
bed6e1fc
孙向锦
添加其他功能
|
133
|
private StudentManager studentService;
|
91a745c9
孙向锦
完善后台功能
|
134
135
|
@Resource(name = "subjectService")
|
bed6e1fc
孙向锦
添加其他功能
|
136
|
private SubjectManager subjectService;
|
91a745c9
孙向锦
完善后台功能
|
137
138
|
@Resource(name = "teacherService")
|
bed6e1fc
孙向锦
添加其他功能
|
139
|
private TeacherManager teacherService;
|
91a745c9
孙向锦
完善后台功能
|
140
141
|
@Resource(name = "testpaperinfoService")
|
bed6e1fc
孙向锦
添加其他功能
|
142
143
|
private TestPaperInfoManager testpaperinfoService;
|
91a745c9
孙向锦
完善后台功能
|
144
145
146
147
148
149
|
@Resource(name = "testpaperService")
private TestPaperManager testpaperService;
@Resource(name = "studenttestService")
private StudentTestManager studenttestService;
|
bed6e1fc
孙向锦
添加其他功能
|
150
151
152
153
154
|
@Resource(name = "feedbackService")
private FeedbackManager feedbackService;
@Resource(name = "problemphenomenonService")
private ProblemPhenomenonManager problemphenomenonService;
|
91a745c9
孙向锦
完善后台功能
|
155
|
|
bed6e1fc
孙向锦
添加其他功能
|
156
|
@Resource(name = "v1Service")
|
91a745c9
孙向锦
完善后台功能
|
157
|
private V1Manager v1Service;
|
ce70231e
孙向锦
增加接口
|
158
159
|
@Resource(name = "softwareversionService")
|
2480c889
孙向锦
添加软件管理模块。对软件形成统一的管理
|
160
|
private SoftwareVersionManager softwareversionService;
|
ce70231e
孙向锦
增加接口
|
161
162
|
@Resource(name = "attachkeyboardService")
|
9f161055
孙向锦
修改高斯客户反馈
|
163
|
private AttachKeyboardManager attachkeyboardService;
|
ce70231e
孙向锦
增加接口
|
164
165
|
@Resource(name = "networkstatisticsService")
|
9338b563
孙向锦
添加报表
|
166
|
private NetworkStatisticsManager networkstatisticsService;
|
ce70231e
孙向锦
增加接口
|
167
168
|
@Resource(name = "eventService")
|
9338b563
孙向锦
添加报表
|
169
|
private EventManager eventService;
|
ce70231e
孙向锦
增加接口
|
170
171
|
@Resource(name = "userService")
|
d3d7b2ca
孙向锦
修改表格固定
|
172
|
private UserManager userService;
|
91a745c9
孙向锦
完善后台功能
|
173
|
|
ce70231e
孙向锦
增加接口
|
174
175
|
@Resource(name = "teachingmaterialService")
private TeachingMaterialManager teachingmaterialService;
|
c617106f
孙向锦
添加即时测功能
|
176
177
178
|
@Resource(name = "textbookService")
private TextbookManager textbookService;
|
2ad7ca45
孙向锦
试卷bug修改
|
179
180
|
@Resource(name = "cacheService")
|
ce70231e
孙向锦
增加接口
|
181
182
|
private CacheManager cacheService;
|
2ad7ca45
孙向锦
试卷bug修改
|
183
184
185
186
187
188
189
|
/**
* 登录
* 可以通过账号密码登录、
* 可以通过教师卡登录
* @return
* @throws Exception
*/
|
bed6e1fc
孙向锦
添加其他功能
|
190
191
192
|
@RequestMapping(value = "/login", produces = "application/json;charset=UTF-8")
@ResponseBody
public Object login() throws Exception {
|
3371dbc6
孙向锦
0720 版本
|
193
|
event("apilogin");
|
bed6e1fc
孙向锦
添加其他功能
|
194
195
|
PageData pd = this.getPageData();
ResponseGson<PageData> res = new ResponseGson();
|
91a745c9
孙向锦
完善后台功能
|
196
|
if (!pd.containsKey("ACCOUT")) {
|
bed6e1fc
孙向锦
添加其他功能
|
197
198
|
pd.put("ACCOUT", pd.get("USERNAME"));
}
|
ce70231e
孙向锦
增加接口
|
199
200
201
|
if (((pd.containsKey("USERNAME") || (pd.containsKey("ACCOUT") && pd
.get("ACCOUT") != null)) && pd.containsKey("PASSWORD"))
|| pd.containsKey("KEYPAD_ID")) {
|
bed6e1fc
孙向锦
添加其他功能
|
202
|
PageData pageData = teacherService.getUserInfo(pd);
|
91a745c9
孙向锦
完善后台功能
|
203
204
|
if (pageData != null && pageData.getString("ID") != null) {
pageData.put("PASSWORD", "");// 返回参数中不返回密码
|
bed6e1fc
孙向锦
添加其他功能
|
205
206
207
|
PageData pt = new PageData();
pt.put("TEACHER_ID", pageData.get("ID"));
// 在任课表中查找老师教哪些班级,然后查出班级信息
|
91a745c9
孙向锦
完善后台功能
|
208
209
210
|
List<PageData> classInfoList = v1Service
.getTeacherClassInfo(pt);
|
bed6e1fc
孙向锦
添加其他功能
|
211
212
|
pageData.put("classInfoList", classInfoList);
// 在认可表中查找老师教哪些科目,然后查出科目信息
|
91a745c9
孙向锦
完善后台功能
|
213
214
|
List<PageData> subjectList = v1Service
.getTeacherSubjectInfo(pt);
|
bed6e1fc
孙向锦
添加其他功能
|
215
216
|
// 一个sql语句完成。
pageData.put("subjectList", subjectList);
|
91a745c9
孙向锦
完善后台功能
|
217
|
|
bed6e1fc
孙向锦
添加其他功能
|
218
|
pageData.remove("SUBJECT_IDS");
|
ce70231e
孙向锦
增加接口
|
219
|
|
9338b563
孙向锦
添加报表
|
220
221
222
223
224
|
PageData eventPd = new PageData();
eventPd.put("EVENT_ID", get32UUID());
eventPd.put("EVENT_NAME", "login");
eventPd.put("EVENT_USER", pageData.getString("ID"));
eventPd.put("EVENT_TYPE", "0");
|
ce70231e
孙向锦
增加接口
|
225
226
|
eventPd.put("EVENT_START_TIME", Tools.date2Str(new Date()));
if (pd.getString("CLIENT_ID") != null) {
|
9338b563
孙向锦
添加报表
|
227
|
eventPd.put("CLIENT_ID", pd.getString("CLIENT_ID"));
|
ce70231e
孙向锦
增加接口
|
228
|
} else {
|
9338b563
孙向锦
添加报表
|
229
230
|
eventPd.put("CLIENT_ID", "CLIENT");
}
|
ce70231e
孙向锦
增加接口
|
231
|
eventPd.put("EVENT_IP", getRemoteIp());
|
9338b563
孙向锦
添加报表
|
232
|
eventService.save(eventPd);
|
91a745c9
孙向锦
完善后台功能
|
233
|
|
bed6e1fc
孙向锦
添加其他功能
|
234
235
|
res.setData(pageData);
// 填充数据到返回数据中
|
91a745c9
孙向锦
完善后台功能
|
236
|
} else {
|
bed6e1fc
孙向锦
添加其他功能
|
237
238
|
res.set1Error();
}
|
91a745c9
孙向锦
完善后台功能
|
239
|
} else {
|
bed6e1fc
孙向锦
添加其他功能
|
240
241
|
res.set1Error();
}
|
91a745c9
孙向锦
完善后台功能
|
242
|
|
bed6e1fc
孙向锦
添加其他功能
|
243
244
|
return res.toJson();
}
|
c617106f
孙向锦
添加即时测功能
|
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
|
/**
* 登录
* 可以通过账号密码登录、
* 可以通过教师卡登录
* @return
* @throws Exception
*/
@RequestMapping(value = "/userinfo", produces = "application/json;charset=UTF-8")
@ResponseBody
public Object userinfo() throws Exception {
event("userinfo");
PageData pd = this.getPageData();
ResponseGson<PageData> res = new ResponseGson();
PageData pageData = teacherService.findById(pd);
if (pageData != null && pageData.getString("ID") != null) {
pageData.put("PASSWORD", "");// 返回参数中不返回密码
PageData pt = new PageData();
pt.put("TEACHER_ID", pageData.get("ID"));
// 在任课表中查找老师教哪些班级,然后查出班级信息
List<PageData> classInfoList = v1Service
.getTeacherClassInfo(pt);
pageData.put("classInfoList", classInfoList);
// 在认可表中查找老师教哪些科目,然后查出科目信息
List<PageData> subjectList = v1Service
.getTeacherSubjectInfo(pt);
// 一个sql语句完成。
pageData.put("subjectList", subjectList);
pageData.remove("SUBJECT_IDS");
PageData eventPd = new PageData();
eventPd.put("EVENT_ID", get32UUID());
eventPd.put("EVENT_NAME", "login");
eventPd.put("EVENT_USER", pageData.getString("ID"));
eventPd.put("EVENT_TYPE", "0");
eventPd.put("EVENT_START_TIME", Tools.date2Str(new Date()));
if (pd.getString("CLIENT_ID") != null) {
eventPd.put("CLIENT_ID", pd.getString("CLIENT_ID"));
} else {
eventPd.put("CLIENT_ID", "CLIENT");
}
eventPd.put("EVENT_IP", getRemoteIp());
eventService.save(eventPd);
res.setData(pageData);
// 填充数据到返回数据中
} else {
res.set1Error();
}
return res.toJson();
}
|
91a745c9
孙向锦
完善后台功能
|
299
|
|
2ad7ca45
孙向锦
试卷bug修改
|
300
301
302
303
304
305
|
/**
* 查询班级
* 班级及班级学生详细信息
* @return
* @throws Exception
*/
|
bed6e1fc
孙向锦
添加其他功能
|
306
307
308
|
@RequestMapping(value = "/class", produces = "application/json;charset=UTF-8")
@ResponseBody
public Object sclass() throws Exception {
|
3371dbc6
孙向锦
0720 版本
|
309
|
event("sclass");
|
2480c889
孙向锦
添加软件管理模块。对软件形成统一的管理
|
310
|
long cur = System.currentTimeMillis();
|
bed6e1fc
孙向锦
添加其他功能
|
311
|
PageData pd = this.getPageData();
|
bed6e1fc
孙向锦
添加其他功能
|
312
|
if (pd.containsKey("ID")) {
|
4fd2e08c
孙向锦
修复接口中的bug
|
313
|
ResponseGson<PageData> res = new ResponseGson();
|
bed6e1fc
孙向锦
添加其他功能
|
314
315
316
317
|
PageData pageData = sclassService.findById(pd);
if (pageData != null && pageData.containsKey("ID")) {
PageData pt = new PageData();
pt.put("SCLASS_ID", pageData.get("ID"));
|
91a745c9
孙向锦
完善后台功能
|
318
|
List<PageData> studentList = v1Service.getClassStudent(pt);
|
bed6e1fc
孙向锦
添加其他功能
|
319
|
pageData.put("studentList", studentList);
|
9f161055
孙向锦
修改高斯客户反馈
|
320
|
pt.put("CLASS_ID", pageData.get("ID"));
|
ce70231e
孙向锦
增加接口
|
321
322
|
List<PageData> keyboards = attachkeyboardService
.listAllClassId(pt);
|
9f161055
孙向锦
修改高斯客户反馈
|
323
|
pageData.put("keyboards", keyboards);
|
bed6e1fc
孙向锦
添加其他功能
|
324
325
326
327
|
res.setData(pageData);
} else {
res.set2Error();
}
|
ce70231e
孙向锦
增加接口
|
328
329
|
logger.info("class cost time : "
+ (System.currentTimeMillis() - cur));
|
4fd2e08c
孙向锦
修复接口中的bug
|
330
331
332
333
334
|
return res.toJson();
} else {
ResponseGson<List<PageData>> res = new ResponseGson();
List<PageData> list = sclassService.listAll(pd);
res.setData(list);
|
ce70231e
孙向锦
增加接口
|
335
336
|
logger.info("class cost time : "
+ (System.currentTimeMillis() - cur));
|
4fd2e08c
孙向锦
修复接口中的bug
|
337
|
return res.toJson();
|
4fd2e08c
孙向锦
修复接口中的bug
|
338
339
|
}
}
|
ce70231e
孙向锦
增加接口
|
340
|
|
2ad7ca45
孙向锦
试卷bug修改
|
341
342
343
344
345
|
/**
* 问题类型
* @return
* @throws Exception
*/
|
4fd2e08c
孙向锦
修复接口中的bug
|
346
347
348
|
@RequestMapping(value = "/questiontype", produces = "application/json;charset=UTF-8")
@ResponseBody
public Object questiontype() throws Exception {
|
3371dbc6
孙向锦
0720 版本
|
349
|
event("questiontype");
|
2480c889
孙向锦
添加软件管理模块。对软件形成统一的管理
|
350
|
long cur = System.currentTimeMillis();
|
4fd2e08c
孙向锦
修复接口中的bug
|
351
352
353
354
|
PageData pd = this.getPageData();
ResponseGson<List<PageData>> res = new ResponseGson();
List<PageData> list = questiontypeService.listAll(pd);
res.setData(list);
|
ce70231e
孙向锦
增加接口
|
355
356
|
logger.info("questiontype cost time : "
+ (System.currentTimeMillis() - cur));
|
4fd2e08c
孙向锦
修复接口中的bug
|
357
358
|
return res.toJson();
}
|
ce70231e
孙向锦
增加接口
|
359
|
|
2ad7ca45
孙向锦
试卷bug修改
|
360
361
362
363
364
|
/**
* 班级类型
* @return
* @throws Exception
*/
|
4fd2e08c
孙向锦
修复接口中的bug
|
365
366
367
|
@RequestMapping(value = "/classtype", produces = "application/json;charset=UTF-8")
@ResponseBody
public Object classtype() throws Exception {
|
3371dbc6
孙向锦
0720 版本
|
368
|
event("classtype");
|
2480c889
孙向锦
添加软件管理模块。对软件形成统一的管理
|
369
|
long cur = System.currentTimeMillis();
|
4fd2e08c
孙向锦
修复接口中的bug
|
370
371
372
373
|
PageData pd = this.getPageData();
ResponseGson<List<PageData>> res = new ResponseGson();
List<PageData> list = classtypeService.listAll(pd);
res.setData(list);
|
ce70231e
孙向锦
增加接口
|
374
375
|
logger.info("classtype cost time : "
+ (System.currentTimeMillis() - cur));
|
4fd2e08c
孙向锦
修复接口中的bug
|
376
377
|
return res.toJson();
}
|
ce70231e
孙向锦
增加接口
|
378
|
|
2ad7ca45
孙向锦
试卷bug修改
|
379
380
381
382
383
384
|
/**
* 年级
* 年级类型
* @return
* @throws Exception
*/
|
4fd2e08c
孙向锦
修复接口中的bug
|
385
386
387
|
@RequestMapping(value = "/grade", produces = "application/json;charset=UTF-8")
@ResponseBody
public Object grade() throws Exception {
|
3371dbc6
孙向锦
0720 版本
|
388
|
event("grade");
|
2480c889
孙向锦
添加软件管理模块。对软件形成统一的管理
|
389
|
long cur = System.currentTimeMillis();
|
4fd2e08c
孙向锦
修复接口中的bug
|
390
391
392
393
394
|
PageData pd = this.getPageData();
ResponseGson<List<PageData>> res = new ResponseGson();
if (!pd.containsKey("SCHOOL_ID")) {
List<PageData> list = gradeService.listAll(pd);
res.setData(list);
|
91a745c9
孙向锦
完善后台功能
|
395
|
} else {
|
4fd2e08c
孙向锦
修复接口中的bug
|
396
397
|
List<PageData> list = schoolgradesubjectService.listAllGrade(pd);
res.setData(list);
|
bed6e1fc
孙向锦
添加其他功能
|
398
|
}
|
2480c889
孙向锦
添加软件管理模块。对软件形成统一的管理
|
399
|
logger.info("class cost time : " + (System.currentTimeMillis() - cur));
|
bed6e1fc
孙向锦
添加其他功能
|
400
401
|
return res.toJson();
}
|
ce70231e
孙向锦
增加接口
|
402
|
|
2ad7ca45
孙向锦
试卷bug修改
|
403
404
405
406
407
|
/**
* 科目
* @return
* @throws Exception
*/
|
4fd2e08c
孙向锦
修复接口中的bug
|
408
409
410
|
@RequestMapping(value = "/subject", produces = "application/json;charset=UTF-8")
@ResponseBody
public Object subject() throws Exception {
|
3371dbc6
孙向锦
0720 版本
|
411
|
event("subject");
|
2480c889
孙向锦
添加软件管理模块。对软件形成统一的管理
|
412
|
long cur = System.currentTimeMillis();
|
4fd2e08c
孙向锦
修复接口中的bug
|
413
414
415
416
417
418
419
420
421
|
PageData pd = this.getPageData();
ResponseGson<List<PageData>> res = new ResponseGson();
if (!pd.containsKey("SCHOOL_ID")) {
List<PageData> list = subjectService.listAll(pd);
res.setData(list);
} else {
List<PageData> list = schoolgradesubjectService.listAllSubject(pd);
res.setData(list);
}
|
2480c889
孙向锦
添加软件管理模块。对软件形成统一的管理
|
422
|
logger.info("subject cost time : " + (System.currentTimeMillis() - cur));
|
4fd2e08c
孙向锦
修复接口中的bug
|
423
424
|
return res.toJson();
}
|
c617106f
孙向锦
添加即时测功能
|
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
|
/**
* 科目
* @return
* @throws Exception
*/
@RequestMapping(value = "/subjectname", produces = "application/json;charset=UTF-8")
@ResponseBody
public Object subjectName() throws Exception {
event("subject");
long cur = System.currentTimeMillis();
PageData pd = this.getPageData();
ResponseGson<List<PageData>> res = new ResponseGson();
if (!pd.containsKey("SCHOOL_ID")) {
List<PageData> list = subjectService.listAll(pd);
res.setData(list);
} else {
List<PageData> list = schoolgradesubjectService.listAllSubject(pd);
res.setData(list);
}
logger.info("subject cost time : " + (System.currentTimeMillis() - cur));
return res.toJson();
}
|
91a745c9
孙向锦
完善后台功能
|
448
|
|
2ad7ca45
孙向锦
试卷bug修改
|
449
450
451
452
453
|
/**
* 键盘扫描
* @return
* @throws Exception
*/
|
bed6e1fc
孙向锦
添加其他功能
|
454
455
456
|
@RequestMapping(value = "/keypadscan", produces = "application/json;charset=UTF-8")
@ResponseBody
public Object keypadScan() throws Exception {
|
3371dbc6
孙向锦
0720 版本
|
457
|
event("keypadScan");
|
2480c889
孙向锦
添加软件管理模块。对软件形成统一的管理
|
458
|
long cur = System.currentTimeMillis();
|
bed6e1fc
孙向锦
添加其他功能
|
459
|
PageData pd = this.getPageData();
|
91a745c9
孙向锦
完善后台功能
|
460
461
462
463
464
|
ResponseGson<String> res = new ResponseGson();
String ID = get32UUID();
pd.put("KEYPADCHECK_ID", ID); // 主键
pd.put("CREATE_DATE", Tools.date2Str(new Date())); // 创建时间
try {
|
bed6e1fc
孙向锦
添加其他功能
|
465
|
keypadcheckService.save(pd);
|
91a745c9
孙向锦
完善后台功能
|
466
|
res.setData(ID);
|
bed6e1fc
孙向锦
添加其他功能
|
467
|
res.setSuccess();
|
91a745c9
孙向锦
完善后台功能
|
468
|
} catch (Exception ex) {
|
bed6e1fc
孙向锦
添加其他功能
|
469
470
|
res.setDataError();
}
|
ce70231e
孙向锦
增加接口
|
471
472
|
logger.info("keypadScan cost time : "
+ (System.currentTimeMillis() - cur));
|
bed6e1fc
孙向锦
添加其他功能
|
473
474
|
return res.toJson();
}
|
91a745c9
孙向锦
完善后台功能
|
475
|
|
2ad7ca45
孙向锦
试卷bug修改
|
476
477
478
479
480
481
|
/**
* showcount 数量 currentpage 当前页码
*
* @return
* @throws Exception
*/
|
bed6e1fc
孙向锦
添加其他功能
|
482
483
484
|
@RequestMapping(value = "/paper", produces = "application/json;charset=UTF-8")
@ResponseBody
public Object paper() throws Exception {
|
3371dbc6
孙向锦
0720 版本
|
485
|
event("paper");
|
2480c889
孙向锦
添加软件管理模块。对软件形成统一的管理
|
486
|
long cur = System.currentTimeMillis();
|
bed6e1fc
孙向锦
添加其他功能
|
487
488
|
PageData pd = this.getPageData();
ResponseGson<List<PageData>> res = new ResponseGson<List<PageData>>();
|
91a745c9
孙向锦
完善后台功能
|
489
|
if (pd.containsKey("PAPER_TYPE") && pd.containsKey("USER_ID")) {
|
bed6e1fc
孙向锦
添加其他功能
|
490
491
492
|
Page page = new Page();
page.getPd().put("PAPER_TYPE", pd.get("PAPER_TYPE"));
page.getPd().put("USER_ID", pd.get("USER_ID"));
|
f8d83f1f
孙向锦
添加学校界面
|
493
|
page.getPd().put("SUBJECT_ID", pd.get("SUBJECT_ID"));
|
91a745c9
孙向锦
完善后台功能
|
494
|
if (pd.containsKey("CURRENTPAGE")) {
|
bed6e1fc
孙向锦
添加其他功能
|
495
|
String curpage = pd.getString("CURRENTPAGE");
|
91a745c9
孙向锦
完善后台功能
|
496
|
try {
|
bed6e1fc
孙向锦
添加其他功能
|
497
|
page.setCurrentPage(Integer.parseInt(curpage));
|
91a745c9
孙向锦
完善后台功能
|
498
499
|
} catch (Exception ex) {
}
|
bed6e1fc
孙向锦
添加其他功能
|
500
|
}
|
91a745c9
孙向锦
完善后台功能
|
501
|
if (pd.containsKey("SHOWCOUNT")) {
|
bed6e1fc
孙向锦
添加其他功能
|
502
|
String showCount = pd.getString("SHOWCOUNT");
|
91a745c9
孙向锦
完善后台功能
|
503
|
try {
|
bed6e1fc
孙向锦
添加其他功能
|
504
|
page.setShowCount(Integer.parseInt(showCount));
|
91a745c9
孙向锦
完善后台功能
|
505
506
507
|
} catch (Exception ex) {
}
} else {
|
bed6e1fc
孙向锦
添加其他功能
|
508
509
510
511
|
page.setShowCount(100);
}
List<PageData> pageList = paperService.listAllByType(page);
res.setData(pageList);
|
91a745c9
孙向锦
完善后台功能
|
512
|
} else {
|
338594c8
孙向锦
添加教师端页面
|
513
|
res.setParmError();
|
bed6e1fc
孙向锦
添加其他功能
|
514
|
}
|
2480c889
孙向锦
添加软件管理模块。对软件形成统一的管理
|
515
|
logger.info("paper cost time : " + (System.currentTimeMillis() - cur));
|
bed6e1fc
孙向锦
添加其他功能
|
516
517
|
return res.toJson();
}
|
91a745c9
孙向锦
完善后台功能
|
518
|
|
2ad7ca45
孙向锦
试卷bug修改
|
519
520
521
522
523
|
/**
* 试卷详细信息
* @return
* @throws Exception
*/
|
91a745c9
孙向锦
完善后台功能
|
524
|
@RequestMapping(value = "/paperinfo", produces = "application/json;charset=UTF-8")
|
bed6e1fc
孙向锦
添加其他功能
|
525
|
@ResponseBody
|
91a745c9
孙向锦
完善后台功能
|
526
|
public Object paperInfo() throws Exception {
|
3371dbc6
孙向锦
0720 版本
|
527
|
event("paperInfo");
|
2480c889
孙向锦
添加软件管理模块。对软件形成统一的管理
|
528
|
long cur = System.currentTimeMillis();
|
bed6e1fc
孙向锦
添加其他功能
|
529
|
PageData pd = this.getPageData();
|
d34f6711
孙向锦
试题
|
530
|
ResponseGson<PageData> res = new ResponseGson<PageData>();
|
91a745c9
孙向锦
完善后台功能
|
531
532
533
|
if (pd.containsKey("PAPER_ID")) {
try {
try {
|
91a745c9
孙向锦
完善后台功能
|
534
535
|
PageData ppd = paperService.findById(pd);
if (ppd != null) {
|
91a745c9
孙向锦
完善后台功能
|
536
537
|
List<PageData> questList = v1Service
.getTestPaperInfo(pd);
|
d34f6711
孙向锦
试题
|
538
|
ppd.put("QUESTIONS", questList);
|
91a745c9
孙向锦
完善后台功能
|
539
|
for (PageData qpd : questList) {
|
d34f6711
孙向锦
试题
|
540
541
542
543
544
545
546
547
548
549
550
551
552
|
String optionContent = qpd
.getString("OPTION_CONTENT");
if (optionContent != null
&& optionContent.startsWith("[")
&& optionContent.endsWith("]")) {
String[] options = optionContent.substring(1,
optionContent.length() - 1).split(",");
qpd.put("OPTION_CONTENT", options);
} else {
qpd.put("OPTION_CONTENT",
new String[] { optionContent });
}
|
91a745c9
孙向锦
完善后台功能
|
553
554
|
if ("-1".equals("" + qpd.getString("P_ID"))) {
PageData pidPd = new PageData();
|
d34f6711
孙向锦
试题
|
555
|
pidPd.put("PID", qpd.getString("QUESTION_ID"));
|
91a745c9
孙向锦
完善后台功能
|
556
557
|
List<PageData> qs = v1Service
.getQuestionsByPID(pidPd);
|
d34f6711
孙向锦
试题
|
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
|
for (PageData pcd : qs) {
String optionContent1 = pcd
.getString("OPTION_CONTENT");
if (optionContent1 != null
&& optionContent1.startsWith("[")
&& optionContent1.endsWith("]")) {
String[] options = optionContent1
.substring(
1,
optionContent1.length() - 1)
.split(",");
pcd.put("OPTION_CONTENT", options);
} else {
pcd.put("OPTION_CONTENT",
new String[] { optionContent1 });
}
String[] keys = new String[pcd.keySet().size()];
pcd.keySet().toArray(keys);
Iterator map1it = pcd.entrySet().iterator();
for (String key : keys) {
pcd.put(key.toLowerCase(),pcd.get(key));
pcd.remove(key.toUpperCase());
}
|
91a745c9
孙向锦
完善后台功能
|
581
|
}
|
d34f6711
孙向锦
试题
|
582
|
qpd.put("QUESTIONS", qs);
|
91a745c9
孙向锦
完善后台功能
|
583
|
}
|
d34f6711
孙向锦
试题
|
584
585
586
587
588
589
|
String[] keys = new String[qpd.keySet().size()];
qpd.keySet().toArray(keys);
for (String key : keys) {
qpd.put(key.toLowerCase(), qpd.get(key));
qpd.remove(key.toUpperCase());
|
91a745c9
孙向锦
完善后台功能
|
590
|
}
|
d34f6711
孙向锦
试题
|
591
592
593
594
595
596
597
|
}
String[] keys = new String[ppd.keySet().size()];
ppd.keySet().toArray(keys);
for (String key : keys) {
ppd.put(key.toLowerCase(), ppd.get(key));
ppd.remove(key.toUpperCase());
|
338594c8
孙向锦
添加教师端页面
|
598
|
}
|
91a745c9
孙向锦
完善后台功能
|
599
|
// pd.put("JSON", paper.toJson());
|
d34f6711
孙向锦
试题
|
600
601
|
res.setData(ppd);
logger.info(res.toJson());
|
91a745c9
孙向锦
完善后台功能
|
602
|
|
338594c8
孙向锦
添加教师端页面
|
603
|
}
|
91a745c9
孙向锦
完善后台功能
|
604
605
|
} catch (Exception ex) {
ex.printStackTrace();
|
338594c8
孙向锦
添加教师端页面
|
606
|
}
|
91a745c9
孙向锦
完善后台功能
|
607
|
} catch (Exception ex) {
|
338594c8
孙向锦
添加教师端页面
|
608
609
|
ex.printStackTrace();
res.setError();
|
bed6e1fc
孙向锦
添加其他功能
|
610
|
}
|
91a745c9
孙向锦
完善后台功能
|
611
|
} else {
|
bed6e1fc
孙向锦
添加其他功能
|
612
613
|
res.setOtherError();
}
|
ce70231e
孙向锦
增加接口
|
614
615
|
logger.info("paperInfo cost time : "
+ (System.currentTimeMillis() - cur));
|
bed6e1fc
孙向锦
添加其他功能
|
616
617
|
return res.toJson();
}
|
c617106f
孙向锦
添加即时测功能
|
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
|
/**
* 试卷详细信息
* @return
* @throws Exception
*/
@RequestMapping(value = "/testpaperinfo", produces = "application/json;charset=UTF-8")
@ResponseBody
public Object testpaperinfo() throws Exception {
event("testpaperinfo");
long cur = System.currentTimeMillis();
PageData pd = this.getPageData();
ResponseGson<PageData> res = new ResponseGson();
String paperId = pd.getString("ID");
if (!StringUtils.isEmpty(paperId)) {
try {
pd.put("TESTPAPER_ID", paperId);
PageData testPd = testpaperService.findById(pd);
if (testPd != null) {
PageData testInfof = new PageData();
testInfof.put("PAPER_ID", testPd.getString("PAPER_ID"));
testInfof.put("TEST_ID", paperId);
List<PageData> list = testpaperinfoService.listTestPaperQuestionIDs(testInfof);
for(PageData pad:list){
String optionContent = pad.getString("OPTION_CONTENT");
if(optionContent != null && optionContent.startsWith("[") && optionContent.endsWith("]")){
String[] options = optionContent.substring(1, optionContent.length() -1).split(",");
pad.put("OPTION_CONTENT", options);
}else{
pad.put("OPTION_CONTENT", new String[]{optionContent});
}
}
for(PageData pqd : list){
PageData tpqd = questionService.findById(pqd);
pqd.putAll(tpqd);
pqd.remove("P_ID");
pqd.remove("SUBJECT_ID");
pqd.remove("PROBLEM_TYPE_ID");
pqd.remove("CHAPTER_ID");
pqd.remove("TEACHER_ID");
pqd.remove("SCHOOL_ID");
pqd.remove("SUG_SCORE");
pqd.remove("SUG_PART_SCORE");
pqd.remove("USER_ID");
pqd.remove("CREATE_DATE");
pqd.remove("QUESTION_FROM");
pqd.remove("REMARK");
pqd.put("TEST_ID", paperId);
List<PageData> listinfo = testpaperinfoService.listTestPaperQuestionIDinfo(pqd);
List<PageData> answerInfos = new ArrayList<PageData>();
for(PageData pid : listinfo){
String answer = pid.getString("ANSWER");
PageData answerPd = null;
if(answerInfos.size() > 0){
answerPd = answerInfos.get(answerInfos.size() -1);
if(!answer.equals(answerPd.getString("ANSWER"))){
answerPd = new PageData();
answerPd.put("ANSWER", answer);
answerPd.put("ISRIGHT", pid.getString("RIGHT"));
answerInfos.add(answerPd);
}
}else{
answerPd = new PageData();
answerPd.put("ANSWER", answer);
answerPd.put("ISRIGHT", pid.getString("RIGHT"));
answerInfos.add(answerPd);
}
String strCount = answerPd.getString("COUNT");
int count = 0 ;
if(strCount != null){
try{
count = Integer.parseInt(strCount);
}catch(NumberFormatException ex){}
}
count ++ ;
answerPd.put("COUNT", count);
}
pqd.put("ANSWERINFO", answerInfos);
pqd.remove("TEST_ID");
}
testPd.put("QUESTIONS", list);
}
res.setData(testPd);
} catch (Exception e) {
e.printStackTrace();
res.setError();
}
}
logger.info("testpaperinfo cost time:"
+ (System.currentTimeMillis() - cur));
return res.toJson();
}
/**
* 试卷详细信息
* @return
* @throws Exception
*/
@RequestMapping(value = "/questionintestreportinfo", produces = "application/json;charset=UTF-8")
@ResponseBody
public Object questionInTestReportInfo() throws Exception {
event("testpaperinfo");
long cur = System.currentTimeMillis();
PageData pd = this.getPageData();
ResponseGson<PageData> res = new ResponseGson();
if (pd.getString("QUESTION_ID") != null) {
String questionId = pd.getString("QUESTION_ID");
PageData pqd = new PageData();
pqd.put("QUESTION_ID", questionId);
PageData tpqd = questionService.findById(pqd);
pqd.putAll(tpqd);
pqd.remove("P_ID");
pqd.remove("SUBJECT_ID");
pqd.remove("PROBLEM_TYPE_ID");
pqd.remove("CHAPTER_ID");
pqd.remove("TEACHER_ID");
pqd.remove("SCHOOL_ID");
pqd.remove("SUG_SCORE");
pqd.remove("SUG_PART_SCORE");
pqd.remove("USER_ID");
pqd.remove("CREATE_DATE");
pqd.remove("QUESTION_FROM");
pqd.remove("REMARK");
String optionContent = pqd.getString("OPTION_CONTENT");
if(optionContent != null && optionContent.startsWith("[") && optionContent.endsWith("]")){
String[] options = optionContent.substring(1, optionContent.length() -1).split(",");
pqd.put("OPTION_CONTENT", options);
}else{
pqd.put("OPTION_CONTENT", new String[]{optionContent});
}
if(pd.getString("TEST_ID") != null){
pqd.put("TEST_ID", pd.getString("TEST_ID"));
}
List<PageData> listinfo = testpaperinfoService
.listTestPaperQuestionIDinfo(pqd);
List<PageData> answerInfos = new ArrayList<PageData>();
for (PageData pid : listinfo) {
String answer = pid.getString("ANSWER");
PageData answerPd = null;
if (answerInfos.size() > 0) {
answerPd = answerInfos.get(answerInfos.size() - 1);
if (!answer.equals(answerPd.getString("ANSWER"))) {
answerPd = new PageData();
answerPd.put("ANSWER", answer);
answerPd.put("ISRIGHT", pid.getString("RIGHT"));
answerInfos.add(answerPd);
}
} else {
answerPd = new PageData();
answerPd.put("ANSWER", answer);
answerPd.put("ISRIGHT", pid.getString("RIGHT"));
answerInfos.add(answerPd);
}
String strCount = answerPd.getString("COUNT");
int count = 0;
if (strCount != null) {
try {
count = Integer.parseInt(strCount);
} catch (NumberFormatException ex) {
}
}
count++;
answerPd.put("COUNT", count);
}
pqd.put("ANSWERINFO", answerInfos);
res.setData(pqd);
}else{
res.setDataError();
}
logger.info("testpaperinfo cost time:"
+ (System.currentTimeMillis() - cur));
return res.toJson();
}
|
91a745c9
孙向锦
完善后台功能
|
793
|
|
2ad7ca45
孙向锦
试卷bug修改
|
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
|
/**
* 试卷简要信息
* @return
* @throws Exception
*/
@RequestMapping(value = "/paperbriefinfo", produces = "application/json;charset=UTF-8")
@ResponseBody
public Object paperBriefInfo() throws Exception {
event("paperBriefInfo");
long cur = System.currentTimeMillis();
PageData pd = this.getPageData();
ResponseGson<Paper> res = new ResponseGson<Paper>();
if (pd.containsKey("PAPER_ID")) {
try {
try {
Paper paper = new Paper();
PageData ppd = paperService.findById(pd);
if (ppd != null) {
paper.setTitle(ppd.getString("TITLE"));
paper.setExam_time(ppd.getString("EXAM_TIME"));
paper.setUser_id(ppd.getString("USER_ID"));
paper.setPaper_type(ppd.getString("PAPER_TYPE"));
paper.setSubject_id(ppd.getString("SUBJECT_ID"));
paper.setGrade_id(ppd.getString("GRADE_ID"));
paper.setScore(ppd.getString("SCORE"));
paper.setQuestions(new ArrayList<Question>());
List<PageData> questList = v1Service
.getTestPaperInfo(pd);
for (PageData qpd : questList) {
Question question = new Question();
question.setQuestion_id(qpd
.getString("QUESTION_ID"));
if ("-1".equals("" + qpd.getString("P_ID"))) {
PageData pidPd = new PageData();
pidPd.put("PID", question.getQuestion_id());
question.setQuestions(new ArrayList<Question>());
List<PageData> qs = v1Service
.getQuestionsByPID(pidPd);
for (PageData q : qs) {
Question qq = new Question();
qq.setQuestion_id(q
.getString("QUESTION_ID"));
question.getQuestions().add(qq);
}
}
if ("-1".equals(qpd.getString("P_ID"))
|| "0".equals(qpd.getString("P_ID"))) {
paper.getQuestions().add(question);
}
}
// pd.put("JSON", paper.toJson());
res.setData(paper);
logger.info(paper.toJson());
}
} catch (Exception ex) {
ex.printStackTrace();
}
} catch (Exception ex) {
ex.printStackTrace();
res.setError();
}
} else {
res.setOtherError();
}
logger.info("paperInfo cost time : "
+ (System.currentTimeMillis() - cur));
return res.toBrifJson();
}
/**
* 试卷问题
* @return
* @throws Exception
*/
|
bed6e1fc
孙向锦
添加其他功能
|
871
872
873
|
@RequestMapping(value = "/paperquestion", produces = "application/json;charset=UTF-8")
@ResponseBody
public Object paperQuestion() throws Exception {
|
3371dbc6
孙向锦
0720 版本
|
874
|
event("paperQuestion");
|
2480c889
孙向锦
添加软件管理模块。对软件形成统一的管理
|
875
|
long cur = System.currentTimeMillis();
|
bed6e1fc
孙向锦
添加其他功能
|
876
877
|
PageData pd = this.getPageData();
ResponseGson<PageData> res = new ResponseGson();
|
ce70231e
孙向锦
增加接口
|
878
879
|
logger.info("paperquestion cost time : "
+ (System.currentTimeMillis() - cur));
|
bed6e1fc
孙向锦
添加其他功能
|
880
881
|
return res.toJson();
}
|
ce70231e
孙向锦
增加接口
|
882
|
|
2ad7ca45
孙向锦
试卷bug修改
|
883
884
885
886
887
|
/**
* 问题
* @return
* @throws Exception
*/
|
4fd2e08c
孙向锦
修复接口中的bug
|
888
889
890
|
@RequestMapping(value = "/question", produces = "application/json;charset=UTF-8")
@ResponseBody
public Object question() throws Exception {
|
3371dbc6
孙向锦
0720 版本
|
891
|
event("question");
|
2480c889
孙向锦
添加软件管理模块。对软件形成统一的管理
|
892
|
long cur = System.currentTimeMillis();
|
4fd2e08c
孙向锦
修复接口中的bug
|
893
|
PageData pd = this.getPageData();
|
2ad7ca45
孙向锦
试卷bug修改
|
894
895
|
ResponseGson<List<PageData>> res = new ResponseGson();
List<PageData> list = new ArrayList<PageData>();
|
ce70231e
孙向锦
增加接口
|
896
|
if (pd.containsKey("ID")) {
|
2ad7ca45
孙向锦
试卷bug修改
|
897
898
899
900
901
|
String ids = pd.getString("ID");
String[] id = ids.split(",");
for (String i : id) {
pd.put("QUESTION_ID", i);
PageData data = questionService.findById(pd);
|
c617106f
孙向锦
添加即时测功能
|
902
903
904
905
906
907
908
|
String optionContent = data.getString("OPTION_CONTENT");
if(optionContent != null && optionContent.startsWith("[") && optionContent.endsWith("]")){
String[] options = optionContent.substring(1, optionContent.length() -1).split(",");
data.put("OPTION_CONTENT", options);
}else{
data.put("OPTION_CONTENT", new String[]{optionContent});
}
|
2ad7ca45
孙向锦
试卷bug修改
|
909
910
911
912
913
|
if (data != null) {
list.add(data);
}
}
res.setData(list);
|
ce70231e
孙向锦
增加接口
|
914
|
} else {
|
4fd2e08c
孙向锦
修复接口中的bug
|
915
916
|
res.setDataError();
}
|
ce70231e
孙向锦
增加接口
|
917
918
|
logger.info("question cost time : "
+ (System.currentTimeMillis() - cur));
|
4fd2e08c
孙向锦
修复接口中的bug
|
919
920
|
return res.toJson();
}
|
ce70231e
孙向锦
增加接口
|
921
|
|
2ad7ca45
孙向锦
试卷bug修改
|
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
|
/**
* 查询知识点名称
* @return
* @throws Exception
*/
@RequestMapping(value = "/knowledgename", produces = "application/json;charset=UTF-8")
@ResponseBody
public Object knowledgename() throws Exception {
ResponseGson<List<PageData>> res = new ResponseGson();
List<PageData> list = new ArrayList<PageData>();
PageData pd = getPageData();
if (pd.get("ID") != null) {
String ids = pd.getString("ID");
String[] id = ids.split(",");
for (String i : id) {
pd.put("KNOWLEDGE_ID", i);
PageData data = knowledgeService.findById(pd);
if (data != null) {
PageData t = new PageData();
t.put("KNOWLEDGE_ID", data.get("KNOWLEDGE_ID"));
t.put("NAME", data.get("NAME"));
list.add(t);
}
}
res.setData(list);
}
;
return res;
}
/**
* 章节名称
* @return
* @throws Exception
*/
@RequestMapping(value = "/chaptername", produces = "application/json;charset=UTF-8")
@ResponseBody
public Object chaptername() throws Exception {
ResponseGson<List<PageData>> res = new ResponseGson();
List<PageData> list = new ArrayList<PageData>();
PageData pd = getPageData();
if (pd.get("ID") != null) {
String ids = pd.getString("ID");
String[] id = ids.split(",");
for (String i : id) {
pd.put("ID", i);
PageData data = chapterService.findById(pd);
if (data != null) {
PageData t = new PageData();
t.put("ID", data.get("ID"));
t.put("NAME", data.get("NAME"));
list.add(t);
}
}
res.setData(list);
}
;
return res;
}
/**
* 试题添加
* @return
* @throws Exception
*/
|
4fd2e08c
孙向锦
修复接口中的bug
|
987
988
989
|
@RequestMapping(value = "/question/add", produces = "application/json;charset=UTF-8")
@ResponseBody
public Object questionAdd() throws Exception {
|
3371dbc6
孙向锦
0720 版本
|
990
|
event("questionAdd");
|
2480c889
孙向锦
添加软件管理模块。对软件形成统一的管理
|
991
|
long cur = System.currentTimeMillis();
|
4fd2e08c
孙向锦
修复接口中的bug
|
992
993
994
995
|
PageData pd = this.getPageData();
ResponseGson<PageData> res = new ResponseGson();
pd.put("QUESTION_ID", this.get32UUID());
questionService.save(pd);
|
ce70231e
孙向锦
增加接口
|
996
997
|
logger.info("questionAdd cost time : "
+ (System.currentTimeMillis() - cur));
|
4fd2e08c
孙向锦
修复接口中的bug
|
998
999
|
return res.toJson();
}
|
ce70231e
孙向锦
增加接口
|
1000
|
|
2ad7ca45
孙向锦
试卷bug修改
|
1001
1002
1003
1004
1005
|
/***
* 上传试卷
* @return
* @throws Exception
*/
|
338594c8
孙向锦
添加教师端页面
|
1006
1007
1008
|
@RequestMapping(value = "/uploadpaper", produces = "application/json;charset=UTF-8")
@ResponseBody
public Object uploadpaper() throws Exception {
|
3371dbc6
孙向锦
0720 版本
|
1009
|
event("uploadpaper");
|
2480c889
孙向锦
添加软件管理模块。对软件形成统一的管理
|
1010
|
long cur = System.currentTimeMillis();
|
338594c8
孙向锦
添加教师端页面
|
1011
1012
|
PageData pd = this.getPageData();
ResponseGson<String> res = new ResponseGson();
|
91a745c9
孙向锦
完善后台功能
|
1013
1014
|
if (!StringUtils.isEmpty(pd.getJsonString())) {
|
4fd2e08c
孙向锦
修复接口中的bug
|
1015
|
logger.info(pd.getJsonString());
|
338594c8
孙向锦
添加教师端页面
|
1016
1017
1018
1019
|
Paper paper = Paper.parse(pd.getJsonString());
PageData paperPd = new PageData();
String paperID = this.get32UUID();
res.setData(paperID);
|
91a745c9
孙向锦
完善后台功能
|
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
|
paperPd.put("PAPER_ID", paperID);
paperPd.put("TITLE", paper.getTitle());
paperPd.put("USER_ID", paper.getUser_id());
paperPd.put("PAPER_TYPE", paper.getPaper_type());
paperPd.put("SUBJECT_ID", paper.getSubject_id());
paperPd.put("GRADE_ID", paper.getGrade_id());
paperPd.put("EXAM_TIME", paper.getExam_time());
paperPd.put("SCORE", paper.getScore());
paperPd.put("PAPER_STATE", "0");
paperPd.put("REMARK", "");
|
338594c8
孙向锦
添加教师端页面
|
1030
1031
|
String schoolID = Myelfun.getUserID(paper.getUser_id());
paperPd.put("SCHOOL_ID", schoolID);
|
91a745c9
孙向锦
完善后台功能
|
1032
1033
1034
|
paperPd.put("CREATE_DATE", Tools.date2Str(new Date()));
paperPd.put("MODIFY_DATE", Tools.date2Str(new Date()));
|
ce70231e
孙向锦
增加接口
|
1035
|
int questionNum = 0;
|
91a745c9
孙向锦
完善后台功能
|
1036
|
|
338594c8
孙向锦
添加教师端页面
|
1037
|
List<Question> questions = paper.getQuestions();
|
91a745c9
孙向锦
完善后台功能
|
1038
1039
|
if (questions != null) {
for (Question question : questions) {
|
338594c8
孙向锦
添加教师端页面
|
1040
1041
1042
|
String questionID = this.get32UUID();
PageData qPd = new PageData();
qPd.put("QUESTION_ID", questionID);
|
91a745c9
孙向锦
完善后台功能
|
1043
1044
|
if (question.getQuestions() != null
&& question.getQuestions().size() > 0) {
|
338594c8
孙向锦
添加教师端页面
|
1045
|
qPd.put("P_ID", "-1");
|
91a745c9
孙向锦
完善后台功能
|
1046
|
} else {
|
ce70231e
孙向锦
增加接口
|
1047
|
questionNum++;
|
338594c8
孙向锦
添加教师端页面
|
1048
1049
1050
1051
|
qPd.put("P_ID", "0");
}
qPd.put("SUBJECT_ID", paper.getSubject_id());
qPd.put("CHAPTER_ID", question.getChapter_id());
|
ce70231e
孙向锦
增加接口
|
1052
1053
1054
|
qPd.put("PROBLEM_TYPE_ID",
question.getProblem_type_id() == null ? "1"
: question.getProblem_type_id());
|
338594c8
孙向锦
添加教师端页面
|
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
|
qPd.put("TEACHER_ID", paper.getUser_id());
qPd.put("SCHOOL_ID", schoolID);
qPd.put("KNOWLEDGE_ID", question.getKnowledge_id());
qPd.put("CONTENT", question.getContent());
qPd.put("OPTION_NUM", question.getOption_num());
qPd.put("OPTION_CONTENT", question.getOption_content());
qPd.put("ANSWER", question.getAnswer());
qPd.put("DIFFICULTY", question.getDifficulty());
qPd.put("ANALYSIS", question.getAnalysis());
qPd.put("QUESTION_FROM", question.getQuestion_from());
qPd.put("SUG_SCORE", question.getScore());
qPd.put("SUG_PART_SCORE", question.getPart_score());
qPd.put("USER_ID", paper.getUser_id());
qPd.put("CREATE_DATE", Tools.date2Str(new Date()));
qPd.put("REMARK", "");
questionService.save(qPd);
|
91a745c9
孙向锦
完善后台功能
|
1071
|
|
338594c8
孙向锦
添加教师端页面
|
1072
|
PageData pqPd = new PageData();
|
91a745c9
孙向锦
完善后台功能
|
1073
1074
1075
1076
1077
1078
1079
|
pqPd.put("PAPER_ID", paperID);
pqPd.put("QUESTION_ID", questionID);
pqPd.put("SCORE", question.getScore());
pqPd.put("PART_SCORE", "0");
pqPd.put("RANK", question.getRank());
pqPd.put("NO_NAME", question.getNo_name());
pqPd.put("PAPERQUESTION_ID", this.get32UUID());
|
338594c8
孙向锦
添加教师端页面
|
1080
|
paperquestionService.save(pqPd);
|
91a745c9
孙向锦
完善后台功能
|
1081
1082
|
if (question.getQuestions() != null) {
|
338594c8
孙向锦
添加教师端页面
|
1083
|
List<Question> qs = question.getQuestions();
|
91a745c9
孙向锦
完善后台功能
|
1084
|
for (Question q : qs) {
|
338594c8
孙向锦
添加教师端页面
|
1085
1086
1087
1088
1089
1090
|
String qID = this.get32UUID();
PageData cqPd = new PageData();
cqPd.put("QUESTION_ID", qID);
cqPd.put("P_ID", questionID);
cqPd.put("SUBJECT_ID", paper.getSubject_id());
cqPd.put("CHAPTER_ID", q.getChapter_id());
|
ce70231e
孙向锦
增加接口
|
1091
1092
1093
|
cqPd.put("PROBLEM_TYPE_ID", question
.getProblem_type_id() == null ? "1"
: question.getProblem_type_id());
|
338594c8
孙向锦
添加教师端页面
|
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
|
cqPd.put("TEACHER_ID", paper.getUser_id());
cqPd.put("SCHOOL_ID", schoolID);
cqPd.put("KNOWLEDGE_ID", q.getKnowledge_id());
cqPd.put("CONTENT", q.getContent());
cqPd.put("OPTION_NUM", q.getOption_num());
cqPd.put("OPTION_CONTENT", q.getOption_content());
cqPd.put("ANSWER", q.getAnswer());
cqPd.put("DIFFICULTY", q.getDifficulty());
cqPd.put("ANALYSIS", q.getAnalysis());
cqPd.put("QUESTION_FROM", q.getQuestion_from());
cqPd.put("SUG_SCORE", q.getScore());
cqPd.put("SUG_PART_SCORE", q.getSug_part_score());
cqPd.put("USER_ID", paper.getUser_id());
cqPd.put("CREATE_DATE", Tools.date2Str(new Date()));
cqPd.put("REMARK", "");
|
91a745c9
孙向锦
完善后台功能
|
1109
|
|
338594c8
孙向锦
添加教师端页面
|
1110
|
questionService.save(cqPd);
|
91a745c9
孙向锦
完善后台功能
|
1111
|
|
338594c8
孙向锦
添加教师端页面
|
1112
|
PageData cpqPd = new PageData();
|
91a745c9
孙向锦
完善后台功能
|
1113
1114
1115
1116
1117
1118
1119
1120
|
cpqPd.put("PAPER_ID", paperID);
cpqPd.put("QUESTION_ID", qID);
cpqPd.put("SCORE", q.getScore());
cpqPd.put("PART_SCORE", "0");
cpqPd.put("RANK", q.getRank());
cpqPd.put("NO_NAME", q.getNo_name());
cpqPd.put("PAPERQUESTION_ID", this.get32UUID());
|
338594c8
孙向锦
添加教师端页面
|
1121
|
paperquestionService.save(cpqPd);
|
ce70231e
孙向锦
增加接口
|
1122
|
questionNum++;
|
338594c8
孙向锦
添加教师端页面
|
1123
1124
1125
1126
|
}
}
}
}
|
4fd2e08c
孙向锦
修复接口中的bug
|
1127
1128
|
paperPd.put("QUESTION_NUM", "" + questionNum);
paperService.save(paperPd);
|
91a745c9
孙向锦
完善后台功能
|
1129
1130
|
} else {
|
338594c8
孙向锦
添加教师端页面
|
1131
1132
|
res.setDataError();
}
|
ce70231e
孙向锦
增加接口
|
1133
1134
1135
1136
1137
|
logger.info("uploadpaper cost time : "
+ (System.currentTimeMillis() - cur));
return res.toJson();
}
|
2ad7ca45
孙向锦
试卷bug修改
|
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
|
/**
* 上传试卷,不上传试题详细信息。试题从已有数据库中组卷
* @return
* @throws Exception
*/
@RequestMapping(value = "/publishpaper", produces = "application/json;charset=UTF-8")
@ResponseBody
public Object publishPaper() throws Exception {
event("publishpaper");
long cur = System.currentTimeMillis();
PageData pd = this.getPageData();
ResponseGson<String> res = new ResponseGson();
if (!StringUtils.isEmpty(pd.getJsonString())) {
logger.info(pd.getJsonString());
Paper paper = Paper.parse(pd.getJsonString());
PageData paperPd = new PageData();
String paperID = this.get32UUID();
res.setData(paperID);
paperPd.put("PAPER_ID", paperID);
paperPd.put("TITLE", paper.getTitle());
paperPd.put("USER_ID", paper.getUser_id());
paperPd.put("PAPER_TYPE", paper.getPaper_type());
paperPd.put("SUBJECT_ID", paper.getSubject_id());
paperPd.put("GRADE_ID", paper.getGrade_id());
paperPd.put("EXAM_TIME", paper.getExam_time());
paperPd.put("SCORE", paper.getScore());
paperPd.put("PAPER_STATE", "0");
paperPd.put("REMARK", "");
String schoolID = Myelfun.getUserID(paper.getUser_id());
paperPd.put("SCHOOL_ID", schoolID);
paperPd.put("CREATE_DATE", Tools.date2Str(new Date()));
paperPd.put("MODIFY_DATE", Tools.date2Str(new Date()));
int questionNum = 0;
List<Question> questions = paper.getQuestions();
if (questions != null) {
for (Question question : questions) {
PageData pqPd = new PageData();
pqPd.put("PAPER_ID", paperID);
pqPd.put("QUESTION_ID", question.getQuestion_id());
pqPd.put("SCORE", question.getScore());
pqPd.put("PART_SCORE", "0");
pqPd.put("RANK", question.getRank());
pqPd.put("NO_NAME", question.getNo_name());
pqPd.put("PAPERQUESTION_ID", this.get32UUID());
|
c617106f
孙向锦
添加即时测功能
|
1183
|
pqPd.put("P_ID", "0");
|
2ad7ca45
孙向锦
试卷bug修改
|
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
|
paperquestionService.save(pqPd);
}
}
paperPd.put("QUESTION_NUM", "" + questionNum);
paperService.save(paperPd);
} else {
res.setDataError();
}
logger.info("uploadpaper cost time : "
+ (System.currentTimeMillis() - cur));
return res.toJson();
}
/**
* 上传知识点
* @return
* @throws Exception
*/
|
ce70231e
孙向锦
增加接口
|
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
|
@RequestMapping(value = "/uploadpoint", produces = "application/json;charset=UTF-8")
@ResponseBody
public Object uploadpoint() throws Exception {
event("uploadpoint");
long cur = System.currentTimeMillis();
PageData pd = this.getPageData();
ResponseGson<String> res = new ResponseGson();
if (!StringUtils.isEmpty(pd.getJsonString())) {
try {
ResponseGson<List<Point>> req = ResponseGson.parse(
pd.getJsonString(), Point.class);
List<Point> list = req.getData();
if (list != null && list.size() > 0) {
for (Point point : list) {
savePoint(point, null);
}
}
} catch (Exception e) {
res.setError();
}
} else {
res.setDataError();
}
logger.info("uploadpoint cost time : "
+ (System.currentTimeMillis() - cur));
|
91a745c9
孙向锦
完善后台功能
|
1230
1231
1232
|
return res.toJson();
}
|
2ad7ca45
孙向锦
试卷bug修改
|
1233
1234
1235
1236
|
/**
* 上传测验成绩
* @return
*/
|
91a745c9
孙向锦
完善后台功能
|
1237
1238
1239
|
@RequestMapping(value = "/uploadtestpaper", produces = "application/json;charset=UTF-8")
@ResponseBody
public Object uploadTestpaper() {
|
3371dbc6
孙向锦
0720 版本
|
1240
|
event("uploadTestpaper");
|
4fd2e08c
孙向锦
修复接口中的bug
|
1241
|
long cur = System.currentTimeMillis();
|
91a745c9
孙向锦
完善后台功能
|
1242
1243
1244
|
PageData pd = this.getPageData();
ResponseGson<String> res = new ResponseGson();
if (!StringUtils.isEmpty(pd.getJsonString())) {
|
4fd2e08c
孙向锦
修复接口中的bug
|
1245
|
logger.info(pd.getJsonString());
|
91a745c9
孙向锦
完善后台功能
|
1246
1247
1248
1249
|
TestPaper testPaper = TestPaper.parse(pd.getJsonString());
try {
PageData testPd = new PageData();
String testPaperId = this.get32UUID();
|
91a745c9
孙向锦
完善后台功能
|
1250
|
testPd.put("TEACHER_ID", testPaper.getTeacherId());
|
91a745c9
孙向锦
完善后台功能
|
1251
1252
|
testPd.put("PAPER_ID", testPaper.getPaperId());
testPd.put("SCLASS_ID", testPaper.getClassId());
|
91a745c9
孙向锦
完善后台功能
|
1253
1254
1255
1256
1257
|
testPd.put(
"CREATE_DATE",
testPaper.getCreateDate() == null ? Tools
.date2Str(new Date()) : testPaper
.getCreateDate());
|
2480c889
孙向锦
添加软件管理模块。对软件形成统一的管理
|
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
|
List<PageData> listData = testpaperService.listAll(testPd);
if (!(listData != null && listData.size() > 0)) {
testPd.put("START_DATE", testPaper.getStartDate());
testPd.put("END_DATE", testPaper.getEndDate());
testPd.put("NAME", testPaper.getName());
testPd.put("TESTPAPER_ID", testPaperId);
testPd.put("OTHER_SCORE", testPaper.getOtherScore());
testPd.put("HIGHT_SCORE", testPaper.getHighScore());
testPd.put("LOW_SCORE", testPaper.getLowScore());
testPd.put("AVG_SCORE", testPaper.getAvgScore());
testPd.put("REMARK", testPaper.getRemark());
testpaperService.save(testPd);
if (testPaper.getStudents() != null) {
List<PageData> testInfoPdList = new ArrayList();
PageData testInfoPd = null;
for (StudentAnswer studentAnswer : testPaper
.getStudents()) {
if (studentAnswer.getQuestions() != null) {
PageData studentPageData = new PageData();
studentPageData.put("STUDENTTEST_ID",
get32UUID());
studentPageData.put("STUDENT_ID",
studentAnswer.getStudentId());
studentPageData.put("TEST_ID", testPaperId);
studentPageData.put("PAPER_ID",
testPaper.getPaperId());
studentPageData.put("SCORE",
studentAnswer.getScore());
studentPageData.put("CLASS_ID",
testPaper.getClassId());
studenttestService.save(studentPageData);
for (TestPaperInfo testPaperInfo : studentAnswer
.getQuestions()) {
testInfoPd = new PageData();
testInfoPd.put("TESTPAPERINFO_ID",
this.get32UUID());
testInfoPd.put("PAPER_ID",
testPaper.getPaperId());
testInfoPd.put("STUDENT_ID",
studentAnswer.getStudentId());
testInfoPd.put("TEST_ID", testPaperId);
testInfoPd.put("QUESTION_ID",
testPaperInfo.getQuestionId());
testInfoPd.put("ANSWER",
testPaperInfo.getAnswer());
testInfoPd.put("RIGHT",
testPaperInfo.getRight());
testInfoPd.put("SCORE",
testPaperInfo.getScore());
testInfoPd.put("LIKES",
testPaperInfo.getLikes());
testInfoPd
.put("ANSWER_TYPE",
testPaperInfo
.getAnswerType() == null ? "1"
: testPaperInfo
.getAnswerType());
testInfoPd.put("PRESS_TIME",
testPaperInfo.getPressTime());
testInfoPd.put("RECEIVER_DATE",
testPaperInfo.getReceiverDate());
testInfoPd.put("SUBJECTIVE",
testPaperInfo.getSubjective());
testInfoPd.put("NOTE",
testPaperInfo.getNote());
testInfoPd.put("MARK_NO",
testPaperInfo.getMarkNo());
testInfoPdList.add(testInfoPd);
}
}
}
testpaperinfoService.batchSave(testInfoPdList);
}
|
ce70231e
孙向锦
增加接口
|
1332
|
} else {
|
2480c889
孙向锦
添加软件管理模块。对软件形成统一的管理
|
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
|
testPaperId = listData.get(0).getString("TESTPAPER_ID");
}
res.setData(testPaperId);
} catch (Exception e) {
e.printStackTrace();
res.setError();
res.setMessage(e.getMessage());
}
} else {
res.setDataError();
}
|
ce70231e
孙向锦
增加接口
|
1344
1345
|
logger.info("uploadtestpaper cost time:"
+ (System.currentTimeMillis() - cur));
|
2480c889
孙向锦
添加软件管理模块。对软件形成统一的管理
|
1346
1347
1348
1349
|
return res.toJson();
}
|
ce70231e
孙向锦
增加接口
|
1350
|
|
2ad7ca45
孙向锦
试卷bug修改
|
1351
1352
1353
1354
|
/**
* 上传测验成绩
* @return
*/
|
2480c889
孙向锦
添加软件管理模块。对软件形成统一的管理
|
1355
1356
1357
|
@RequestMapping(value = "/uploadupdatetestpaper", produces = "application/json;charset=UTF-8")
@ResponseBody
public Object uploadupdateTestpaper() {
|
3371dbc6
孙向锦
0720 版本
|
1358
|
event("uploadupdateTestpaper");
|
2480c889
孙向锦
添加软件管理模块。对软件形成统一的管理
|
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
|
long cur = System.currentTimeMillis();
PageData pd = this.getPageData();
ResponseGson<String> res = new ResponseGson();
if (!StringUtils.isEmpty(pd.getJsonString())) {
logger.info(pd.getJsonString());
TestPaper testPaper = TestPaper.parse(pd.getJsonString());
try {
PageData testPd = new PageData();
String testPaperId = this.get32UUID();
testPd.put("TEACHER_ID", testPaper.getTeacherId());
testPd.put("PAPER_ID", testPaper.getPaperId());
testPd.put("SCLASS_ID", testPaper.getClassId());
testPd.put(
"CREATE_DATE",
testPaper.getCreateDate() == null ? Tools
.date2Str(new Date()) : testPaper
.getCreateDate());
List<PageData> listData = testpaperService.listAll(testPd);
if ((listData != null && listData.size() > 0)) {
testPaperId = listData.get(0).getString("TESTPAPER_ID");
testpaperService.deleteList(testPd);
testPd.put("TEST_ID", testPaperId);
testpaperinfoService.delete(testPd);
studenttestService.delete(testPd);
}
testPd.put("START_DATE", testPaper.getStartDate());
testPd.put("END_DATE", testPaper.getEndDate());
testPd.put("NAME", testPaper.getName());
testPd.put("TESTPAPER_ID", testPaperId);
|
91a745c9
孙向锦
完善后台功能
|
1388
1389
1390
1391
|
testPd.put("OTHER_SCORE", testPaper.getOtherScore());
testPd.put("HIGHT_SCORE", testPaper.getHighScore());
testPd.put("LOW_SCORE", testPaper.getLowScore());
testPd.put("AVG_SCORE", testPaper.getAvgScore());
|
03a14c0e
孙向锦
更新报表
|
1392
|
testPd.put("TOTAL_SCORE", testPaper.getTotalScore());
|
91a745c9
孙向锦
完善后台功能
|
1393
1394
1395
|
testPd.put("REMARK", testPaper.getRemark());
testpaperService.save(testPd);
if (testPaper.getStudents() != null) {
|
2480c889
孙向锦
添加软件管理模块。对软件形成统一的管理
|
1396
1397
|
List<PageData> testInfoPdList = new ArrayList();
PageData testInfoPd = null;
|
91a745c9
孙向锦
完善后台功能
|
1398
1399
1400
|
for (StudentAnswer studentAnswer : testPaper.getStudents()) {
if (studentAnswer.getQuestions() != null) {
PageData studentPageData = new PageData();
|
91a745c9
孙向锦
完善后台功能
|
1401
1402
1403
1404
1405
1406
1407
1408
1409
|
studentPageData.put("STUDENT_ID",
studentAnswer.getStudentId());
studentPageData.put("TEST_ID", testPaperId);
studentPageData.put("PAPER_ID",
testPaper.getPaperId());
studentPageData.put("SCORE",
studentAnswer.getScore());
studentPageData.put("CLASS_ID",
testPaper.getClassId());
|
2480c889
孙向锦
添加软件管理模块。对软件形成统一的管理
|
1410
|
studentPageData.put("STUDENTTEST_ID", get32UUID());
|
91a745c9
孙向锦
完善后台功能
|
1411
1412
1413
1414
|
studenttestService.save(studentPageData);
for (TestPaperInfo testPaperInfo : studentAnswer
.getQuestions()) {
|
2480c889
孙向锦
添加软件管理模块。对软件形成统一的管理
|
1415
|
testInfoPd = new PageData();
|
91a745c9
孙向锦
完善后台功能
|
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
|
testInfoPd.put("TESTPAPERINFO_ID",
this.get32UUID());
testInfoPd.put("PAPER_ID",
testPaper.getPaperId());
testInfoPd.put("STUDENT_ID",
studentAnswer.getStudentId());
testInfoPd.put("TEST_ID", testPaperId);
testInfoPd.put("QUESTION_ID",
testPaperInfo.getQuestionId());
testInfoPd.put("ANSWER",
testPaperInfo.getAnswer());
testInfoPd.put("RIGHT",
testPaperInfo.getRight());
testInfoPd.put("SCORE",
testPaperInfo.getScore());
testInfoPd.put("LIKES",
testPaperInfo.getLikes());
|
2480c889
孙向锦
添加软件管理模块。对软件形成统一的管理
|
1433
1434
1435
|
testInfoPd.put("ANSWER_TYPE", testPaperInfo
.getAnswerType() == null ? "1"
: testPaperInfo.getAnswerType());
|
91a745c9
孙向锦
完善后台功能
|
1436
1437
1438
1439
1440
1441
1442
1443
1444
|
testInfoPd.put("PRESS_TIME",
testPaperInfo.getPressTime());
testInfoPd.put("RECEIVER_DATE",
testPaperInfo.getReceiverDate());
testInfoPd.put("SUBJECTIVE",
testPaperInfo.getSubjective());
testInfoPd.put("NOTE", testPaperInfo.getNote());
testInfoPd.put("MARK_NO",
testPaperInfo.getMarkNo());
|
2480c889
孙向锦
添加软件管理模块。对软件形成统一的管理
|
1445
|
testInfoPdList.add(testInfoPd);
|
91a745c9
孙向锦
完善后台功能
|
1446
1447
1448
|
}
}
}
|
2480c889
孙向锦
添加软件管理模块。对软件形成统一的管理
|
1449
|
testpaperinfoService.batchSave(testInfoPdList);
|
91a745c9
孙向锦
完善后台功能
|
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
|
}
res.setData(testPaperId);
} catch (Exception e) {
e.printStackTrace();
res.setError();
res.setMessage(e.getMessage());
}
} else {
res.setDataError();
}
|
2480c889
孙向锦
添加软件管理模块。对软件形成统一的管理
|
1460
1461
|
logger.info("uploadtestpaper cost time:"
+ (System.currentTimeMillis() - cur));
|
91a745c9
孙向锦
完善后台功能
|
1462
1463
1464
1465
1466
|
return res.toJson();
}
|
2ad7ca45
孙向锦
试卷bug修改
|
1467
1468
1469
1470
1471
|
/**
* 查询知识点
* @return
* @throws Exception
*/
|
ce70231e
孙向锦
增加接口
|
1472
1473
1474
1475
|
@RequestMapping(value = "/point", produces = "application/json;charset=UTF-8")
@ResponseBody
public Object point() throws Exception {
ResponseGson<List<PageData>> res = new ResponseGson();
|
2ad7ca45
孙向锦
试卷bug修改
|
1476
|
|
ce70231e
孙向锦
增加接口
|
1477
|
PageData pd = getPageData();
|
2ad7ca45
孙向锦
试卷bug修改
|
1478
|
String key = this.getRequestKey(pd, "point");
|
ce70231e
孙向锦
增加接口
|
1479
1480
|
PageData pagedata = new PageData();
pagedata.put("KEY", key);
|
2ad7ca45
孙向锦
试卷bug修改
|
1481
|
if (!"".equals(key.trim())) {
|
ce70231e
孙向锦
增加接口
|
1482
|
PageData ret = cacheService.findById(pagedata);
|
2ad7ca45
孙向锦
试卷bug修改
|
1483
|
if (ret != null && ret.get("CACHE") != null) {
|
ce70231e
孙向锦
增加接口
|
1484
1485
1486
1487
1488
|
return ret.get("CACHE");
}
}
List<PageData> list = knowledgeService.listAllknowledge(pd);
String depth = pd.getString("DEPTH");
|
2ad7ca45
孙向锦
试卷bug修改
|
1489
1490
1491
|
int end = 3;
if (depth != null) {
try {
|
ce70231e
孙向锦
增加接口
|
1492
|
end = Integer.parseInt(depth);
|
2ad7ca45
孙向锦
试卷bug修改
|
1493
1494
|
} catch (Exception e) {
|
ce70231e
孙向锦
增加接口
|
1495
1496
|
}
}
|
2ad7ca45
孙向锦
试卷bug修改
|
1497
|
roundPointData(list, 1, end);
|
ce70231e
孙向锦
增加接口
|
1498
1499
|
res.setData(list);
String str = res.toJson();
|
2ad7ca45
孙向锦
试卷bug修改
|
1500
|
str = str.replaceAll("[^\\u0000-\\uFFFF]", "");
|
ce70231e
孙向锦
增加接口
|
1501
1502
1503
1504
1505
|
pagedata.put("CACHE", str);
cacheService.save(pagedata);
return str;
}
|
2ad7ca45
孙向锦
试卷bug修改
|
1506
1507
1508
1509
1510
1511
1512
1513
1514
|
/**
* 知识点递归查询
* @param list 查询知识点及子知识点
* @param dept 深度
* @param end 层深
* @throws Exception
*/
private void roundPointData(List<PageData> list, int dept, int end)
throws Exception {
|
ce70231e
孙向锦
增加接口
|
1515
1516
1517
1518
1519
1520
1521
|
if (list != null) {
for (PageData pd : list) {
pd.put("P_ID", pd.getString("KNOWLEDGE_ID"));
if (pd.getString("P_ID") != null
&& !"".equals(pd.getString("P_ID")) && dept < end) {
List<PageData> ret = knowledgeService.listAllknowledge(pd);
if (ret != null && ret.size() > 0) {
|
2ad7ca45
孙向锦
试卷bug修改
|
1522
|
roundPointData(ret, dept + 1, end);
|
ce70231e
孙向锦
增加接口
|
1523
1524
1525
1526
1527
1528
1529
|
pd.put("CHILDREN", ret);
}
}
pd.remove("P_ID");
}
}
}
|
2ad7ca45
孙向锦
试卷bug修改
|
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
|
/**
* 章节递归查询
* @param list 章节
* @param dept 深度
* @param end 递归深度
* @throws Exception
*/
private void roundChapterData(List<PageData> list, int dept, int end)
throws Exception {
if (list != null) {
|
ce70231e
孙向锦
增加接口
|
1541
1542
|
for (PageData pd : list) {
pd.put("P_ID", pd.getString("ID"));
|
2ad7ca45
孙向锦
试卷bug修改
|
1543
1544
1545
1546
1547
1548
1549
1550
|
if (dept < end) {
if (pd.getString("P_ID") != null
&& !"".equals(pd.getString("P_ID"))) {
List<PageData> ret = chapterService.listAllChapter(pd);
if (ret != null && ret.size() > 0) {
roundChapterData(ret, dept + 1, end);
pd.put("CHILDREN", ret);
}
|
ce70231e
孙向锦
增加接口
|
1551
1552
1553
|
}
}
pd.remove("P_ID");
|
2ad7ca45
孙向锦
试卷bug修改
|
1554
|
pd.remove("TEACHINGMATERIAL_ID");
|
ce70231e
孙向锦
增加接口
|
1555
1556
1557
1558
|
}
}
}
|
2ad7ca45
孙向锦
试卷bug修改
|
1559
1560
1561
1562
|
/**
* 下载测验成绩
* @return
*/
|
91a745c9
孙向锦
完善后台功能
|
1563
1564
1565
|
@RequestMapping(value = "/downloadtestpaper", produces = "application/json;charset=UTF-8")
@ResponseBody
public Object downloadTestpaper() {
|
3371dbc6
孙向锦
0720 版本
|
1566
|
event("downloadTestpaper");
|
2480c889
孙向锦
添加软件管理模块。对软件形成统一的管理
|
1567
|
long cur = System.currentTimeMillis();
|
91a745c9
孙向锦
完善后台功能
|
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
|
PageData pd = this.getPageData();
ResponseGson<TestPaper> res = new ResponseGson();
String paperId = pd.getString("ID");
if (!StringUtils.isEmpty(paperId)) {
TestPaper testPaper = new TestPaper();
try {
pd.put("TESTPAPER_ID", paperId);
PageData testPd = testpaperService.findById(pd);
if (testPd != null) {
testPaper.setTestpaperId(paperId);
testPaper.setTeacherId(testPd.getString("TEACHER_ID"));
testPaper.setName(testPd.getString("NAME"));
testPaper.setPaperId(testPd.getString("PAPER_ID"));
testPaper.setClassId(testPd.getString("SCLASS_ID"));
testPaper.setStartDate(testPd.getString("START_DATE"));
testPaper.setEndDate(testPd.getString("END_DATE"));
testPaper.setCreateDate(testPd.getString("CREATE_DATE"));
testPaper.setOtherScore(testPd.getString("OTHER_SCORE"));
testPaper.setHighScore(testPd.getString("HIGHT_SCORE"));
testPaper.setLowScore(testPd.getString("LOW_SCORE"));
testPaper.setAvgScore(testPd.getString("AVG_SCORE"));
testPaper.setRemark(testPd.getString("REMARK"));
PageData testInfof = new PageData();
testInfof.put("TEST_ID", paperId);
List<PageData> studentList = studenttestService
.listAll(testInfof);
for (PageData sPageData : studentList) {
StudentAnswer studentAnswer = new StudentAnswer();
testInfof.put("STDUENT_ID",
sPageData.getString("STDUENT_ID"));
studentAnswer.setScore(sPageData.getString("SCORE"));
List<PageData> list = testpaperinfoService
.listAll(testInfof);
for (PageData testInfoPd : list) {
TestPaperInfo testPaperInfo = new TestPaperInfo();
testPaperInfo.setTestPaperInfoId(testInfoPd
.getString("TESTPAPERINFO_ID"));
testPaperInfo.setQuestionId(testInfoPd
.getString("QUESTION_ID"));
testPaperInfo.setAnswer(testInfoPd
.getString("ANSWER"));
testPaperInfo.setRight(testInfoPd
.getString("RIGHT"));
testPaperInfo.setScore(testInfoPd
.getString("SCORE"));
testPaperInfo.setLikes(testInfoPd
.getString("LIKES"));
testPaperInfo.setAnswerType(testInfoPd
.getString("ANSWER_TYPE"));
testPaperInfo.setPressTime(testInfoPd
.getString("PRESS_TIME"));
testPaperInfo.setReceiverDate(testInfoPd
.getString("RECEIVER_DATE"));
testPaperInfo.setSubjective(testInfoPd
.getString("SUBJECTIVE"));
testPaperInfo.setNote(testInfoPd.getString("NOTE"));
testPaperInfo.setMarkNo(testInfoPd
.getString("MARK_NO"));
testPaperInfo.setRank(testInfoPd.getString("RANK"));
studentAnswer.getQuestions().add(testPaperInfo);
}
testPaper.getStudents().add(studentAnswer);
}
}
res.setData(testPaper);
} catch (Exception e) {
e.printStackTrace();
res.setError();
}
}
|
ce70231e
孙向锦
增加接口
|
1643
1644
|
logger.info("downloadtestpaper cost time:"
+ (System.currentTimeMillis() - cur));
|
338594c8
孙向锦
添加教师端页面
|
1645
|
return res.toJson();
|
91a745c9
孙向锦
完善后台功能
|
1646
|
|
338594c8
孙向锦
添加教师端页面
|
1647
1648
|
}
|
2ad7ca45
孙向锦
试卷bug修改
|
1649
1650
1651
1652
1653
|
/**
*
* 下载测验成绩
* @return
*/
|
91a745c9
孙向锦
完善后台功能
|
1654
1655
1656
|
@RequestMapping(value = "/testpaper", produces = "application/json;charset=UTF-8")
@ResponseBody
public Object testpaper() {
|
3371dbc6
孙向锦
0720 版本
|
1657
|
event("testpaper");
|
2480c889
孙向锦
添加软件管理模块。对软件形成统一的管理
|
1658
|
long cur = System.currentTimeMillis();
|
91a745c9
孙向锦
完善后台功能
|
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
|
PageData pd = this.getPageData();
ResponseGson<List<TestPaper>> res = new ResponseGson();
pd.put("TEACHER_ID", pd.getString("USER_ID"));
try {
List<PageData> pageList = testpaperService.listAll(pd);
List<TestPaper> list = new ArrayList<TestPaper>();
if (pageList != null) {
for (PageData testPd : pageList) {
TestPaper testPaper = new TestPaper();
testPaper.setTestpaperId(testPd.getString("TESTPAPER_ID"));
testPaper.setTeacherId(testPd.getString("TEACHER_ID"));
testPaper.setName(testPd.getString("NAME"));
testPaper.setPaperId(testPd.getString("PAPER_ID"));
testPaper.setClassId(testPd.getString("SCLASS_ID"));
testPaper.setStartDate(testPd.getString("START_DATE"));
testPaper.setEndDate(testPd.getString("END_DATE"));
testPaper.setCreateDate(testPd.getString("CREATE_DATE"));
testPaper.setOtherScore(testPd.getString("OTHER_SCORE"));
testPaper.setHighScore(testPd.getString("HIGHT_SCORE"));
testPaper.setLowScore(testPd.getString("LOW_SCORE"));
testPaper.setAvgScore(testPd.getString("AVG_SCORE"));
testPaper.setRemark(testPd.getString("REMARK"));
list.add(testPaper);
}
}
res.setData(list);
} catch (Exception e) {
res.setError();
res.setMessage(e.getMessage());
e.printStackTrace();
}
|
2480c889
孙向锦
添加软件管理模块。对软件形成统一的管理
|
1690
|
logger.info("testpaper cost time:" + (System.currentTimeMillis() - cur));
|
91a745c9
孙向锦
完善后台功能
|
1691
1692
1693
|
return res.toJson();
}
|
ce70231e
孙向锦
增加接口
|
1694
|
|
2ad7ca45
孙向锦
试卷bug修改
|
1695
1696
1697
|
/***
*
*/
|
4fd2e08c
孙向锦
修复接口中的bug
|
1698
1699
|
@RequestMapping(value = "/schooladmin", produces = "application/json;charset=UTF-8")
@ResponseBody
|
ce70231e
孙向锦
增加接口
|
1700
|
public void schoolAdmin() {
|
3371dbc6
孙向锦
0720 版本
|
1701
|
event("schoolAdmin");
|
4fd2e08c
孙向锦
修复接口中的bug
|
1702
1703
|
PageData pd = this.getPageData();
this.getUserID();
|
4fd2e08c
孙向锦
修复接口中的bug
|
1704
|
}
|
ce70231e
孙向锦
增加接口
|
1705
|
|
2ad7ca45
孙向锦
试卷bug修改
|
1706
1707
1708
1709
1710
1711
|
/***
* 网络
* @return
* @throws Exception
*/
|
9338b563
孙向锦
添加报表
|
1712
1713
|
@RequestMapping(value = "/network", produces = "application/json;charset=UTF-8")
@ResponseBody
|
ce70231e
孙向锦
增加接口
|
1714
|
public Object network() throws Exception {
|
3371dbc6
孙向锦
0720 版本
|
1715
|
event("network");
|
9338b563
孙向锦
添加报表
|
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
|
PageData pd = this.getPageData();
ResponseGson<PageData> res = new ResponseGson();
PageData spd = networkstatisticsService.findByClientID(pd);
String seqStr = pd.getString("SEQ");
if (seqStr != null && pd.getString("CLIENT_ID") != null
&& pd.getString("SESSION_ID") != null) {
int seq = Integer.parseInt(seqStr);
if (spd != null) {
int successCount = Integer.parseInt(spd
.getString("SUCCESS_COUNT"));
spd.put("SUCCESS_COUNT", ++successCount + "");
int fail = seq - successCount;
|
ce70231e
孙向锦
增加接口
|
1728
|
if (fail < 0) {
|
9338b563
孙向锦
添加报表
|
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
|
fail = 0;
}
spd.put("FAIL_COUNT", fail + "");
networkstatisticsService.edit(spd);
spd.remove("NETWORKSTATISTICS_ID");
spd.remove("CLIENT_ID");
spd.remove("SESSION_ID");
res.setData(spd);
} else {
pd.put("NETWORKSTATISTICS_ID", get32UUID());
pd.put("SUCCESS_COUNT", "1");
pd.put("CLIENT_IP", getRemoteIp());
int fail = seq - 1;
|
ce70231e
孙向锦
增加接口
|
1742
|
if (fail < 0) {
|
9338b563
孙向锦
添加报表
|
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
|
fail = 0;
}
pd.put("FAIL_COUNT", fail + "");
networkstatisticsService.save(pd);
pd.remove("JSON");
pd.remove("CLIENT_ID");
pd.remove("SESSION_ID");
pd.remove("SEQ");
pd.remove("NETWORKSTATISTICS_ID");
res.setData(pd);
}
|
ce70231e
孙向锦
增加接口
|
1754
|
} else {
|
9338b563
孙向锦
添加报表
|
1755
1756
1757
1758
|
res.setDataError();
}
return res.toJson();
}
|
ce70231e
孙向锦
增加接口
|
1759
|
|
2ad7ca45
孙向锦
试卷bug修改
|
1760
1761
1762
1763
|
/**
* 获取远端ip地址
* @return
*/
|
ce70231e
孙向锦
增加接口
|
1764
|
public String getRemoteIp() {
|
9338b563
孙向锦
添加报表
|
1765
1766
1767
1768
1769
1770
1771
1772
1773
|
HttpServletRequest request = getRequest();
String ip = "";
if (request.getHeader("x-forwarded-for") == null) {
ip = request.getRemoteAddr();
} else {
ip = request.getHeader("x-forwarded-for");
}
return ip;
}
|
ce70231e
孙向锦
增加接口
|
1774
|
|
2ad7ca45
孙向锦
试卷bug修改
|
1775
1776
1777
1778
1779
1780
|
/**
* 查询新版本信息
* @param request
* @return
* @throws Exception
*/
|
2480c889
孙向锦
添加软件管理模块。对软件形成统一的管理
|
1781
1782
|
@RequestMapping(value = "/newversion", produces = "application/json;charset=UTF-8")
@ResponseBody
|
ce70231e
孙向锦
增加接口
|
1783
|
public Object getNewVersion(HttpServletRequest request) throws Exception {
|
3371dbc6
孙向锦
0720 版本
|
1784
|
event("getNewVersion");
|
2480c889
孙向锦
添加软件管理模块。对软件形成统一的管理
|
1785
1786
1787
|
PageData pd = this.getPageData();
String softId = pd.getString("SOFTID");
String path = request.getContextPath();
|
ce70231e
孙向锦
增加接口
|
1788
1789
|
String basePath = request.getScheme() + "://" + request.getServerName()
+ ":" + request.getServerPort() + path + "/";
|
2480c889
孙向锦
添加软件管理模块。对软件形成统一的管理
|
1790
|
ResponseGson<PageData> res = new ResponseGson();
|
ce70231e
孙向锦
增加接口
|
1791
|
if (softId != null && !"".equals(softId)) {
|
2480c889
孙向锦
添加软件管理模块。对软件形成统一的管理
|
1792
1793
|
pd.put("SOFTWARE_ID", softId);
PageData result = softwareversionService.findNewVersion(pd);
|
ce70231e
孙向锦
增加接口
|
1794
|
if (result != null) {
|
2480c889
孙向锦
添加软件管理模块。对软件形成统一的管理
|
1795
1796
|
result.remove("SOFTWAREVERSION_ID");
result.remove("SOFTWARE_ID");
|
ce70231e
孙向锦
增加接口
|
1797
1798
|
result.put("VERSION_PATH", basePath + "uploadFiles/uploadFile/"
+ result.getString("VERSION_PATH"));
|
2480c889
孙向锦
添加软件管理模块。对软件形成统一的管理
|
1799
|
res.setData(result);
|
ce70231e
孙向锦
增加接口
|
1800
|
} else {
|
2480c889
孙向锦
添加软件管理模块。对软件形成统一的管理
|
1801
1802
|
res.setDataError();
}
|
ce70231e
孙向锦
增加接口
|
1803
|
} else {
|
2480c889
孙向锦
添加软件管理模块。对软件形成统一的管理
|
1804
1805
1806
1807
|
res.setDataError();
}
return res.toJson();
}
|
ce70231e
孙向锦
增加接口
|
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
|
/**
* 获取教材版本
*
* @return
* @throws Exception
*/
@RequestMapping(value = "/teachingmaterial", produces = "application/json;charset=UTF-8")
@ResponseBody
public Object teachingmaterial() throws Exception {
PageData pd = getPageData();
ResponseGson<List<PageData>> ret = new ResponseGson<List<PageData>>();
List<PageData> lpd = new ArrayList<PageData>();
List<PageData> list = teachingmaterialService.listAll(pd);
String subjectID = pd.getString("SUBJECT_ID");
if (subjectID != null && !"".equals(subjectID)) {
for (PageData pad : list) {
String subis = pad.getString("SUBJECT_ID");
if (subis != null) {
String[] subs = subis.split(",");
if (subs != null) {
for (String sub : subs) {
if (subjectID.trim().equals(sub.trim())) {
pad.remove("SUBJECT_ID");
|
2ad7ca45
孙向锦
试卷bug修改
|
1832
1833
|
pad.put("VERSION_CODE",
pad.getString("VERSION_CODE"));
|
ce70231e
孙向锦
增加接口
|
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
|
lpd.add(pad);
break;
}
}
}
}
}
} else {
for (PageData pad : list) {
pad.remove("SUBJECT_ID");
pad.put("VERSION_CODE", pad.getString("VERSION_CODE"));
lpd.add(pad);
}
}
ret.setData(lpd);
return ret.toJson();
}
|
c617106f
孙向锦
添加即时测功能
|
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
|
@RequestMapping(value = "/textbook", produces = "application/json;charset=UTF-8")
@ResponseBody
public Object textbook() throws Exception {
PageData pd = getPageData();
ResponseGson<List<PageData>> ret = new ResponseGson<List<PageData>>();
List<PageData> list = textbookService.listAll(pd);
ret.setData(list);
return ret.toJson();
}
|
2ad7ca45
孙向锦
试卷bug修改
|
1861
|
|
ce70231e
孙向锦
增加接口
|
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
|
/**
* 获取教材版本
*
* @return
* @throws Exception
*/
@RequestMapping(value = "/chapter", produces = "application/json;charset=UTF-8")
@ResponseBody
public Object chapter() throws Exception {
PageData pd = getPageData();
|
2ad7ca45
孙向锦
试卷bug修改
|
1872
|
String key = this.getRequestKey(pd, "chapter");
|
ce70231e
孙向锦
增加接口
|
1873
1874
|
PageData pagedata = new PageData();
pagedata.put("KEY", key);
|
2ad7ca45
孙向锦
试卷bug修改
|
1875
|
if (!"".equals(key.trim())) {
|
ce70231e
孙向锦
增加接口
|
1876
|
PageData ret = cacheService.findById(pagedata);
|
2ad7ca45
孙向锦
试卷bug修改
|
1877
|
if (ret != null && ret.get("CACHE") != null) {
|
ce70231e
孙向锦
增加接口
|
1878
1879
1880
1881
1882
1883
|
return ret.get("CACHE");
}
}
ResponseGson<List<PageData>> res = new ResponseGson<List<PageData>>();
List<PageData> list = chapterService.listAllChapter(pd);
String depth = pd.getString("DEPTH");
|
2ad7ca45
孙向锦
试卷bug修改
|
1884
1885
1886
|
int end = 3;
if (depth != null) {
try {
|
ce70231e
孙向锦
增加接口
|
1887
|
end = Integer.parseInt(depth);
|
2ad7ca45
孙向锦
试卷bug修改
|
1888
1889
|
} catch (Exception e) {
|
ce70231e
孙向锦
增加接口
|
1890
1891
|
}
}
|
2ad7ca45
孙向锦
试卷bug修改
|
1892
|
roundChapterData(list, 1, end);
|
ce70231e
孙向锦
增加接口
|
1893
1894
|
res.setData(list);
String str = res.toJson();
|
ce70231e
孙向锦
增加接口
|
1895
1896
1897
1898
|
pagedata.put("CACHE", str);
cacheService.save(pagedata);
return str;
}
|
2ad7ca45
孙向锦
试卷bug修改
|
1899
|
|
ce70231e
孙向锦
增加接口
|
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
|
/**
* 获取试题
*
* @return
* @throws Exception
*/
@RequestMapping(value = "/questions", produces = "application/json;charset=UTF-8")
@ResponseBody
public Object questions() throws Exception {
PageData pd = getPageData();
ResponseGson<List<PageData>> res = new ResponseGson<List<PageData>>();
String teachingmaterialId = pd.getString("TEACHINGMATERIAL_ID");
String chapterId = pd.getString("CHAPTER_ID");
|
2ad7ca45
孙向锦
试卷bug修改
|
1913
1914
|
if (teachingmaterialId != null && !teachingmaterialId.equals("")
&& chapterId == null) {
|
ce70231e
孙向锦
增加接口
|
1915
1916
|
PageData chapterPd = new PageData();
chapterPd.put("TEACHINGMATERIAL_ID", teachingmaterialId);
|
2ad7ca45
孙向锦
试卷bug修改
|
1917
1918
|
List<PageData> chapterList = chapterService
.listAllChapter(chapterPd);
|
ce70231e
孙向锦
增加接口
|
1919
|
roundChapterData(chapterList, 1, 3);
|
2ad7ca45
孙向锦
试卷bug修改
|
1920
|
List<String> ids = getIds(chapterList, "ID");
|
ce70231e
孙向锦
增加接口
|
1921
|
pd.put("CHAPTER_IDS", ids);
|
2ad7ca45
孙向锦
试卷bug修改
|
1922
|
} else {
|
ce70231e
孙向锦
增加接口
|
1923
|
List<String> ids = new ArrayList<String>();
|
2ad7ca45
孙向锦
试卷bug修改
|
1924
|
if (chapterId != null && !"".equals(chapterId.trim())) {
|
ce70231e
孙向锦
增加接口
|
1925
1926
1927
1928
1929
1930
|
ids.add(chapterId);
}
pd.put("CHAPTER_IDS", ids);
}
pd.remove("CHAPTER_ID");
String knowledge = pd.getString("KNOWLEDGE_ID");
|
2ad7ca45
孙向锦
试卷bug修改
|
1931
|
if (knowledge != null && !"".equals(knowledge.trim())) {
|
ce70231e
孙向锦
增加接口
|
1932
1933
1934
1935
|
PageData knowPd = new PageData();
knowPd.put("P_ID", knowledge);
List<PageData> knowlist = knowledgeService.listAllknowledge(knowPd);
roundPointData(knowlist, 1, 3);
|
2ad7ca45
孙向锦
试卷bug修改
|
1936
|
List<String> ids = getIds(knowlist, "KNOWLEDGE_ID");
|
ce70231e
孙向锦
增加接口
|
1937
|
ids.add(knowledge);
|
2ad7ca45
孙向锦
试卷bug修改
|
1938
|
pd.put("KNOWLEDGE_IDS", ids);
|
ce70231e
孙向锦
增加接口
|
1939
1940
1941
|
pd.remove("KNOWLEDGE_ID");
}
List<PageData> list = questionService.listAllquestion(pd);
|
c617106f
孙向锦
添加即时测功能
|
1942
1943
1944
1945
1946
1947
1948
1949
1950
|
for(PageData pad:list){
String optionContent = pad.getString("OPTION_CONTENT");
if(optionContent != null && optionContent.startsWith("[") && optionContent.endsWith("]")){
String[] options = optionContent.substring(1, optionContent.length() -1).split(",");
pad.put("OPTION_CONTENT", options);
}else{
pad.put("OPTION_CONTENT", new String[]{optionContent});
}
}
|
ce70231e
孙向锦
增加接口
|
1951
1952
1953
|
res.setData(list);
return res.toJson();
}
|
2ad7ca45
孙向锦
试卷bug修改
|
1954
|
|
ce70231e
孙向锦
增加接口
|
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
|
/**
* 随机获取试题
*
* @return
* @throws Exception
*/
@RequestMapping(value = "/randquestions", produces = "application/json;charset=UTF-8")
@ResponseBody
public Object randquestions() throws Exception {
PageData pd = getPageData();
ResponseGson<List<PageData>> res = new ResponseGson<List<PageData>>();
String teachingmaterialId = pd.getString("TEACHINGMATERIAL_ID");
String chapterId = pd.getString("CHAPTER_ID");
|
2ad7ca45
孙向锦
试卷bug修改
|
1968
1969
|
if (teachingmaterialId != null && !teachingmaterialId.equals("")
&& chapterId == null) {
|
ce70231e
孙向锦
增加接口
|
1970
1971
|
PageData chapterPd = new PageData();
chapterPd.put("TEACHINGMATERIAL_ID", teachingmaterialId);
|
2ad7ca45
孙向锦
试卷bug修改
|
1972
1973
|
List<PageData> chapterList = chapterService
.listAllChapter(chapterPd);
|
ce70231e
孙向锦
增加接口
|
1974
|
roundChapterData(chapterList, 1, 3);
|
2ad7ca45
孙向锦
试卷bug修改
|
1975
|
List<String> ids = getIds(chapterList, "ID");
|
ce70231e
孙向锦
增加接口
|
1976
|
pd.put("CHAPTER_IDS", ids);
|
2ad7ca45
孙向锦
试卷bug修改
|
1977
|
} else {
|
ce70231e
孙向锦
增加接口
|
1978
|
List<String> ids = new ArrayList<String>();
|
2ad7ca45
孙向锦
试卷bug修改
|
1979
|
if (chapterId != null && !"".equals(chapterId.trim())) {
|
ce70231e
孙向锦
增加接口
|
1980
1981
1982
1983
1984
1985
|
ids.add(chapterId);
}
pd.put("CHAPTER_IDS", ids);
}
pd.remove("CHAPTER_ID");
String knowledge = pd.getString("KNOWLEDGE_ID");
|
2ad7ca45
孙向锦
试卷bug修改
|
1986
|
if (knowledge != null && !"".equals(knowledge.trim())) {
|
ce70231e
孙向锦
增加接口
|
1987
1988
1989
1990
|
PageData knowPd = new PageData();
knowPd.put("P_ID", knowledge);
List<PageData> knowlist = knowledgeService.listAllknowledge(knowPd);
roundPointData(knowlist, 1, 3);
|
2ad7ca45
孙向锦
试卷bug修改
|
1991
|
List<String> ids = getIds(knowlist, "KNOWLEDGE_ID");
|
ce70231e
孙向锦
增加接口
|
1992
|
ids.add(knowledge);
|
2ad7ca45
孙向锦
试卷bug修改
|
1993
|
pd.put("KNOWLEDGE_IDS", ids);
|
ce70231e
孙向锦
增加接口
|
1994
1995
1996
|
pd.remove("KNOWLEDGE_ID");
}
List<PageData> list = questionService.listAllRandquestion(pd);
|
c617106f
孙向锦
添加即时测功能
|
1997
1998
1999
2000
2001
2002
2003
2004
2005
|
for(PageData pad:list){
String optionContent = pad.getString("OPTION_CONTENT");
if(optionContent != null && optionContent.startsWith("[") && optionContent.endsWith("]")){
String[] options = optionContent.substring(1, optionContent.length() -1).split(",");
pad.put("OPTION_CONTENT", options);
}else{
pad.put("OPTION_CONTENT", new String[]{optionContent});
}
}
|
ce70231e
孙向锦
增加接口
|
2006
2007
2008
|
res.setData(list);
return res.toJson();
}
|
2ad7ca45
孙向锦
试卷bug修改
|
2009
2010
2011
2012
2013
2014
2015
2016
|
/**
*
* @param chapterList
* @param key
* @return
*/
public List<String> getIds(List<PageData> chapterList, String key) {
|
ce70231e
孙向锦
增加接口
|
2017
|
List<String> ids = new ArrayList<String>();
|
2ad7ca45
孙向锦
试卷bug修改
|
2018
2019
|
if (chapterList != null && chapterList.size() > 0) {
for (PageData pd : chapterList) {
|
ce70231e
孙向锦
增加接口
|
2020
|
String chapterid = pd.getString(key);
|
2ad7ca45
孙向锦
试卷bug修改
|
2021
|
if (chapterid != null && !"".equals(chapterid)) {
|
ce70231e
孙向锦
增加接口
|
2022
2023
2024
|
ids.add(chapterid);
}
Object obj = pd.get("CHILDREN");
|
2ad7ca45
孙向锦
试卷bug修改
|
2025
|
if (obj != null && (obj instanceof List)) {
|
ce70231e
孙向锦
增加接口
|
2026
|
@SuppressWarnings("unchecked")
|
2ad7ca45
孙向锦
试卷bug修改
|
2027
2028
2029
|
List<PageData> list = (List<PageData>) obj;
List<String> ret = getIds(list, key);
if (ret != null && ret.size() > 0) {
|
ce70231e
孙向锦
增加接口
|
2030
2031
2032
2033
2034
|
ids.addAll(ret);
}
}
}
}
|
2ad7ca45
孙向锦
试卷bug修改
|
2035
|
|
ce70231e
孙向锦
增加接口
|
2036
|
return ids;
|
2ad7ca45
孙向锦
试卷bug修改
|
2037
|
|
ce70231e
孙向锦
增加接口
|
2038
2039
|
}
|
2ad7ca45
孙向锦
试卷bug修改
|
2040
2041
2042
2043
2044
2045
|
/**
*
* @return
* @throws Exception
*/
|
d3d7b2ca
孙向锦
修改表格固定
|
2046
2047
|
@RequestMapping(value = "/tempcreateUser", produces = "application/json;charset=UTF-8")
@ResponseBody
|
ce70231e
孙向锦
增加接口
|
2048
|
public Object tempCreateUser() throws Exception {
|
d3d7b2ca
孙向锦
修改表格固定
|
2049
2050
2051
2052
|
PageData pd = new PageData();
pd = this.getPageData();
pd.put("ID", this.get32UUID());
teacherService.save(pd);
|
ce70231e
孙向锦
增加接口
|
2053
2054
2055
2056
|
pd.put("USER_ID", pd.getString("ID")); // ID 主键
pd.put("LAST_LOGIN", ""); // 最后登录时间
pd.put("IP", ""); // IP
pd.put("STATUS", "0"); // 状态
|
d3d7b2ca
孙向锦
修改表格固定
|
2057
|
pd.put("SKIN", "default");
|
ce70231e
孙向锦
增加接口
|
2058
|
pd.put("RIGHTS", "");
|
d3d7b2ca
孙向锦
修改表格固定
|
2059
|
pd.put("USERNAME", pd.getString("ACCOUT"));
|
ce70231e
孙向锦
增加接口
|
2060
2061
2062
2063
2064
2065
2066
|
pd.put("ROLE_ID", "57bb1e6f138247a0b05cc721a5da1b64");
pd.put("PASSWORD",
new SimpleHash("SHA-1", pd.getString("ACCOUT"), pd
.getString("PASSWORD")).toString()); // 密码加密
if (null == userService.findByUsername(pd)) { // 判断用户名是否存在
userService.saveU(pd); // 执行保存
|
d3d7b2ca
孙向锦
修改表格固定
|
2067
|
}
|
ce70231e
孙向锦
增加接口
|
2068
2069
2070
|
// ID, TEACHER_ID, CLASS_ID, SUBJECT_ID, START_DATE, END_DATE, GRADE_ID,
// TERM_ID, REMARK
|
d3d7b2ca
孙向锦
修改表格固定
|
2071
2072
2073
2074
|
pd.put("TEACHER_ID", pd.get("ID"));
pd.put("CLASS_ID", "bc33389101ec46e6b7d47daa8adf58ac");
pd.put("SUBJECT_ID", "1");
pd.put("GRADE_ID", "1");
|
ce70231e
孙向锦
增加接口
|
2075
|
pd.put("TERM_ID", "0d8ea2efdef74accbd0d00e9bc07dfbb");
|
d3d7b2ca
孙向锦
修改表格固定
|
2076
|
coursemanagementService.save(pd);
|
ce70231e
孙向锦
增加接口
|
2077
|
|
d3d7b2ca
孙向锦
修改表格固定
|
2078
2079
|
return "{'res':'success'}";
}
|
2480c889
孙向锦
添加软件管理模块。对软件形成统一的管理
|
2080
|
|
2ad7ca45
孙向锦
试卷bug修改
|
2081
2082
2083
2084
|
/**
*
* @param apiName
*/
|
ce70231e
孙向锦
增加接口
|
2085
|
private void event(String apiName) {
|
3371dbc6
孙向锦
0720 版本
|
2086
2087
2088
2089
|
PageData eventPd = new PageData();
eventPd.put("EVENT_ID", get32UUID());
eventPd.put("EVENT_NAME", apiName);
eventPd.put("EVENT_USER", getUsername());
|
67dfaf5c
孙向锦
提交代码
|
2090
|
eventPd.put("EVENT_TYPE", "-1");
|
3371dbc6
孙向锦
0720 版本
|
2091
2092
2093
|
eventPd.put("EVENT_START_TIME", Tools.date2Str(new Date()));
eventPd.put("CLIENT_ID", "SERVER");
eventPd.put("EVENT_IP", getRemoteIp());
|
ce70231e
孙向锦
增加接口
|
2094
|
try {
|
3371dbc6
孙向锦
0720 版本
|
2095
|
eventService.save(eventPd);
|
ce70231e
孙向锦
增加接口
|
2096
2097
2098
2099
2100
2101
2102
|
} catch (Exception e) {
}
}
static int index = 0;
|
2ad7ca45
孙向锦
试卷bug修改
|
2103
2104
2105
2106
2107
|
/**
*
* @param point
* @param pid
*/
|
ce70231e
孙向锦
增加接口
|
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
|
private void savePoint(Point point, String pid) {
List<Point> children = point.getChildren();
if (children != null && children.size() > 0) {
for (Point p : children) {
savePoint(p, point.getCode());
}
}
PageData pageData = new PageData();
pageData.put("KNOWLEDGE_ID", point.getCode());
pageData.put("NAME", point.getName());
pageData.put("P_ID", pid);
pageData.put("RANK", ++index);
try {
knowledgeService.save(pageData);
} catch (Exception e) {
e.printStackTrace();
}
}
|
2ad7ca45
孙向锦
试卷bug修改
|
2127
2128
2129
2130
2131
|
/**
*
* @return
* @throws Exception
*/
|
ce70231e
孙向锦
增加接口
|
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
|
@RequestMapping(value = "/uploadbook", produces = "application/json;charset=UTF-8")
@ResponseBody
public Object uploadbook() throws Exception {
event("uploadbook");
long cur = System.currentTimeMillis();
PageData pd = this.getPageData();
ResponseGson<String> res = new ResponseGson();
if (!StringUtils.isEmpty(pd.getJsonString())) {
try {
ResponseGson<List<Point>> req = ResponseGson.parse(
pd.getJsonString(), Point.class);
List<Point> list = req.getData();
if (list != null && list.size() > 0) {
for (Point point : list) {
saveBook(point);
}
}
} catch (Exception e) {
res.setError();
}
} else {
res.setDataError();
}
logger.info("uploadpoint cost time : "
+ (System.currentTimeMillis() - cur));
return res.toJson();
}
|
2ad7ca45
孙向锦
试卷bug修改
|
2161
2162
2163
2164
|
/**
*
* @param point
*/
|
ce70231e
孙向锦
增加接口
|
2165
2166
2167
2168
2169
2170
2171
2172
2173
|
private void saveBook(Point point) {
PageData pd = new PageData();
pd.put("ID", point.getCode());
pd.put("NAME", point.getName());
pd.put("SUBJECT_ID", point.getSubjectCode());
try {
teachingmaterialService.save(pd);
} catch (Exception e) {
|
ce70231e
孙向锦
增加接口
|
2174
2175
2176
|
e.printStackTrace();
}
}
|
2ad7ca45
孙向锦
试卷bug修改
|
2177
2178
2179
2180
2181
2182
|
/**
*
* @return
* @throws Exception
*/
|
ce70231e
孙向锦
增加接口
|
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
|
@RequestMapping(value = "/uploadyuncelianquestion", produces = "application/json;charset=UTF-8")
@ResponseBody
public Object uploadyuncelianquestion() throws Exception {
event("uploadyuncelianquestion");
long cur = System.currentTimeMillis();
PageData pd = this.getPageData();
ResponseGson<Object> res = new ResponseGson();
if (!StringUtils.isEmpty(pd.getJsonString())) {
try {
|
2ad7ca45
孙向锦
试卷bug修改
|
2193
2194
|
ResponseGson<Object> req = ResponseGson.parse(pd
.getJsonString());
|
ce70231e
孙向锦
增加接口
|
2195
|
Object data = req.getData();
|
2ad7ca45
孙向锦
试卷bug修改
|
2196
2197
2198
2199
2200
2201
|
if (data instanceof List) {
List<Object> list = (List) data;
for (Object obj : list) {
if (obj instanceof Map) {
Map map = (Map) obj;
|
ce70231e
孙向锦
增加接口
|
2202
2203
2204
|
PageData pageData = new PageData();
pageData.put("QUESTION_ID", map.get("id"));
Object cateObj = map.get("cate");
|
2ad7ca45
孙向锦
试卷bug修改
|
2205
|
if (cateObj != null) {
|
ce70231e
孙向锦
增加接口
|
2206
2207
|
String cate = cateObj.toString();
float catef = Float.parseFloat(cate);
|
2ad7ca45
孙向锦
试卷bug修改
|
2208
|
pageData.put("QUESTION_TYPE_ID", (int) catef);
|
ce70231e
孙向锦
增加接口
|
2209
2210
|
}
Object contentObj = map.get("content");
|
2ad7ca45
孙向锦
试卷bug修改
|
2211
|
if (contentObj != null) {
|
ce70231e
孙向锦
增加接口
|
2212
2213
2214
2215
2216
|
String content = contentObj.toString();
content = replaceWebUrl(content);
pageData.put("CONTENT", content);
}
Object subjectCodeObj = map.get("subjectCode");
|
2ad7ca45
孙向锦
试卷bug修改
|
2217
|
if (subjectCodeObj != null) {
|
ce70231e
孙向锦
增加接口
|
2218
|
String subjectCode = subjectCodeObj.toString();
|
2ad7ca45
孙向锦
试卷bug修改
|
2219
|
pageData.put("SUBJECT_ID", subjectCode);
|
ce70231e
孙向锦
增加接口
|
2220
2221
|
}
Object optionsObj = map.get("options");
|
2ad7ca45
孙向锦
试卷bug修改
|
2222
2223
2224
2225
|
if (optionsObj instanceof List) {
List ss = (List) optionsObj;
pageData.put("OPTION_CONTENT",
optionsObj.toString());
|
ce70231e
孙向锦
增加接口
|
2226
2227
2228
|
pageData.put("OPTION_NUM", "" + ss.size());
}
Object answersObj = map.get("answers");
|
2ad7ca45
孙向锦
试卷bug修改
|
2229
2230
|
if (answersObj instanceof List) {
List answers = (List) answersObj;
|
ce70231e
孙向锦
增加接口
|
2231
|
StringBuilder sb = new StringBuilder();
|
2ad7ca45
孙向锦
试卷bug修改
|
2232
|
for (Object as : answers) {
|
ce70231e
孙向锦
增加接口
|
2233
2234
2235
2236
|
sb.append(as.toString());
}
pageData.put("ANSWER", sb.toString());
}
|
2ad7ca45
孙向锦
试卷bug修改
|
2237
2238
|
Object difficulty = map.get("difficulty");
try {
|
ce70231e
孙向锦
增加接口
|
2239
2240
2241
2242
2243
2244
|
if (difficulty != null) {
float fdifficulty = Float
.parseFloat(difficulty.toString());
pageData.put("DIFFICULTY",
(int) fdifficulty);
}
|
2ad7ca45
孙向锦
试卷bug修改
|
2245
|
} catch (Exception ex) {
|
ce70231e
孙向锦
增加接口
|
2246
2247
2248
|
ex.printStackTrace();
}
Object discussObj = map.get("discuss");
|
2ad7ca45
孙向锦
试卷bug修改
|
2249
|
if (discussObj != null) {
|
ce70231e
孙向锦
增加接口
|
2250
2251
2252
2253
2254
|
String discuss = discussObj.toString();
discuss = replaceWebUrl(discuss);
pageData.put("REMARK", discuss);
}
Object analyseObj = map.get("analyse");
|
2ad7ca45
孙向锦
试卷bug修改
|
2255
|
if (analyseObj != null) {
|
ce70231e
孙向锦
增加接口
|
2256
2257
2258
2259
2260
|
String analyse = analyseObj.toString();
analyse = replaceWebUrl(analyse);
pageData.put("ANALYSIS", analyse);
}
Object methodObj = map.get("method");
|
2ad7ca45
孙向锦
试卷bug修改
|
2261
|
if (methodObj != null) {
|
ce70231e
孙向锦
增加接口
|
2262
2263
2264
2265
2266
2267
|
String method = methodObj.toString();
method = replaceWebUrl(method);
pageData.put("METHOD", method);
}
Object points = map.get("points");
StringBuilder sb = new StringBuilder();
|
2ad7ca45
孙向锦
试卷bug修改
|
2268
2269
2270
2271
2272
|
if (points instanceof List) {
List pointsList = (List) points;
for (Object pObject : pointsList) {
if (pObject instanceof Map) {
Map pMap = (Map) pObject;
|
ce70231e
孙向锦
增加接口
|
2273
2274
2275
|
sb.append(pMap.get("code")).append(",");
}
}
|
2ad7ca45
孙向锦
试卷bug修改
|
2276
2277
|
if (sb.toString().length() > 1) {
|
ce70231e
孙向锦
增加接口
|
2278
2279
2280
2281
2282
|
sb.deleteCharAt(sb.length() - 1);
}
pageData.put("KNOWLEDGE_ID", sb.toString());
}
pageData.put("QUESTION_FROM", "101");
|
2ad7ca45
孙向锦
试卷bug修改
|
2283
|
try {
|
ce70231e
孙向锦
增加接口
|
2284
|
questionService.save(pageData);
|
2ad7ca45
孙向锦
试卷bug修改
|
2285
2286
|
} catch (Exception e) {
logger.error("save fail:" + map.get("id"), e);
|
ce70231e
孙向锦
增加接口
|
2287
2288
2289
2290
2291
2292
2293
2294
2295
|
}
}
}
}
} catch (Exception e) {
res.setError();
}
} else {
res.setDataError();
|
3371dbc6
孙向锦
0720 版本
|
2296
|
}
|
ce70231e
孙向锦
增加接口
|
2297
2298
2299
|
logger.info("uploadyuncelianquestion cost time : "
+ (System.currentTimeMillis() - cur));
return res.toJson();
|
3371dbc6
孙向锦
0720 版本
|
2300
|
}
|
ce70231e
孙向锦
增加接口
|
2301
|
|
2ad7ca45
孙向锦
试卷bug修改
|
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
|
/**
*
* @param content
* @return
*/
private String replaceWebUrl(String content) {
if (content != null) {
content = content.replaceAll(
"http://image.yuncelian.com/1/analysis/",
"http://image.yuncelian.com/1/analysis/");
|
ce70231e
孙向锦
增加接口
|
2312
2313
2314
|
}
return content;
}
|
2ad7ca45
孙向锦
试卷bug修改
|
2315
2316
2317
2318
2319
2320
2321
2322
2323
|
/**
*
* @param pd
* @param methodName
* @return
*/
public String getRequestKey(PageData pd, String methodName) {
StringBuilder key = new StringBuilder();
|
ce70231e
孙向锦
增加接口
|
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
|
key.append(methodName).append("{");
if (pd != null) {
Iterator iterator = pd.keySet().iterator();
while (iterator.hasNext()) {
Object obj = iterator.next();
key.append(obj.toString()).append(":")
.append(pd.get(obj).toString()).append(";");
}
}
key.append("}");
|
2ad7ca45
孙向锦
试卷bug修改
|
2334
|
|
ce70231e
孙向锦
增加接口
|
2335
2336
|
return key.toString();
}
|
c617106f
孙向锦
添加即时测功能
|
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
|
/**
* 根据ID,获取科目中文名称
* @param type
* @return
* @throws Exception
*/
@RequestMapping(value = "/subjectename", produces = "application/json;charset=UTF-8")
@ResponseBody
public String findSubjectEName() throws Exception{
PageData pageData = this.getPageData();
ResponseGson<String> res = new ResponseGson<String>();
pageData = subjectService.findById(pageData);
if(pageData != null){
res.setData(pageData.getString("ENAME"));
}else{
res.setDataError();
}
return res.toJson();
}
/**
* 根据ID或者科目英文名称
* @param type
* @return
* @throws Exception
*/
@RequestMapping(value = "/subjectcname", produces = "application/json;charset=UTF-8")
@ResponseBody
public String findSubjectCName() throws Exception{
ResponseGson<String> res = new ResponseGson<String>();
PageData pageData = new PageData();
StringBuilder sb = new StringBuilder();
String type = this.getPageData().getString("ID");
if(type.contains(",")){
String[] types = type.split(",");
for (String t : types) {
pageData.put("ID", t);
pageData = subjectService.findById(pageData);
if (pageData != null) {
sb.append(pageData.getString("CNAME") + "; ");
}
}
sb.delete(sb.length() -3, sb.length());
}else{
pageData.put("ID", type);
pageData = subjectService.findById(pageData);
if (pageData != null) {
sb.append(pageData.getString("CNAME"));
}
}
res.setData(sb.toString());
return res.toJson();
}
/**
* 根据ID班级名称
* @param id
* @return
* @throws Exception
*/
@RequestMapping(value = "/classname", produces = "application/json;charset=UTF-8")
@ResponseBody
public String findClassName() throws Exception {
ResponseGson<String> res = new ResponseGson<String>();
PageData pageData = this.getPageData();
pageData = sclassService.findById(pageData);
String className = "" ;
if(pageData != null){
className = pageData.getString("CLASS_NAME");
}else{
res.setDataError();
}
res.setData(className);
return res.toJson();
}
|
bed6e1fc
孙向锦
添加其他功能
|
2415
|
}
|