Blame view

src/com/fh/controller/api/ApiServer.java 12.7 KB
92455d76   孙向锦   添加更新到服务器
1
2
  package com.fh.controller.api;
  
6cdfeaf1   孙向锦   修改相关信息,添加反馈模块
3
  import java.io.File;
c83d0804   孙向锦   添加客服反馈
4
5
  import java.io.FileOutputStream;
  import java.io.OutputStream;
6cdfeaf1   孙向锦   修改相关信息,添加反馈模块
6
  import java.util.Date;
92455d76   孙向锦   添加更新到服务器
7
8
9
  import java.util.List;
  
  import javax.annotation.Resource;
6cdfeaf1   孙向锦   修改相关信息,添加反馈模块
10
  import javax.servlet.http.HttpServletRequest;
92455d76   孙向锦   添加更新到服务器
11
12
13
14
  
  import org.springframework.stereotype.Controller;
  import org.springframework.web.bind.annotation.RequestMapping;
  import org.springframework.web.bind.annotation.ResponseBody;
2480c889   孙向锦   添加软件管理模块。对软件形成统一的管理
15
  import org.springframework.web.multipart.commons.CommonsMultipartFile;
92455d76   孙向锦   添加更新到服务器
16
  
c83d0804   孙向锦   添加客服反馈
17
18
  import Decoder.BASE64Decoder;
  
92455d76   孙向锦   添加更新到服务器
19
  import com.fh.controller.base.BaseController;
6cdfeaf1   孙向锦   修改相关信息,添加反馈模块
20
  import com.fh.service.feedback.feedback.FeedbackManager;
c83d0804   孙向锦   添加客服反馈
21
  import com.fh.service.feedback.problemphenomenon.ProblemPhenomenonManager;
92455d76   孙向锦   添加更新到服务器
22
  import com.fh.service.sunvote.basestation.BasestationManager;
bed6e1fc   孙向锦   添加其他功能
23
24
25
26
27
28
  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;
  import com.fh.service.sunvote.grade.GradeManager;
cb39a12d   孙向锦   更新api接口头信息
29
  import com.fh.service.sunvote.keypad.KeypadManager;
bed6e1fc   孙向锦   添加其他功能
30
31
32
33
34
35
36
37
38
  import com.fh.service.sunvote.keypadcheck.KeypadCheckManager;
  import com.fh.service.sunvote.knowledge.KnowledgeManager;
  import com.fh.service.sunvote.knowledgechapter.KnowledgeChapterManager;
  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;
92455d76   孙向锦   添加更新到服务器
39
  import com.fh.service.sunvote.school.SchoolManager;
bed6e1fc   孙向锦   添加其他功能
40
41
42
43
44
45
  import com.fh.service.sunvote.schoolgradesubject.SchoolGradeSubjectManager;
  import com.fh.service.sunvote.sclass.SClassManager;
  import com.fh.service.sunvote.student.StudentManager;
  import com.fh.service.sunvote.subject.SubjectManager;
  import com.fh.service.sunvote.teacher.TeacherManager;
  import com.fh.service.sunvote.testpaperinfo.TestPaperInfoManager;
92455d76   孙向锦   添加更新到服务器
46
  import com.fh.util.PageData;
6cdfeaf1   孙向锦   修改相关信息,添加反馈模块
47
  import com.fh.util.Tools;
92455d76   孙向锦   添加更新到服务器
48
49
  
  @Controller
6cdfeaf1   孙向锦   修改相关信息,添加反馈模块
50
  @RequestMapping(value = "/api")
92455d76   孙向锦   添加更新到服务器
51
52
  public class ApiServer extends BaseController {
  
6cdfeaf1   孙向锦   修改相关信息,添加反馈模块
53
  	@Resource(name = "schoolService")
92455d76   孙向锦   添加更新到服务器
54
  	private SchoolManager schoolService;
6cdfeaf1   孙向锦   修改相关信息,添加反馈模块
55
56
  
  	@Resource(name = "basestationService")
92455d76   孙向锦   添加更新到服务器
57
  	private BasestationManager basestationService;
bed6e1fc   孙向锦   添加其他功能
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
  	
  	@Resource(name="chapterService")
  	private ChapterManager chapterService;
  	
  	@Resource(name="classbasetationService")
  	private ClassBasetationManager classbasetationService;
  	
  	@Resource(name="classrosterService")
  	private ClassRosterManager classrosterService;
  	
  	@Resource(name="classtypeService")
  	private ClassTypeManager classtypeService;
  	
  	@Resource(name="gradeService")
  	private GradeManager gradeService;
  	
  	@Resource(name="coursemanagementService")
  	private CourseManagementManager coursemanagementService;
6cdfeaf1   孙向锦   修改相关信息,添加反馈模块
76
77
  
  	@Resource(name = "keypadService")
cb39a12d   孙向锦   更新api接口头信息
78
  	private KeypadManager keypadService;
bed6e1fc   孙向锦   添加其他功能
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
  	
  	@Resource(name="keypadcheckService")
  	private KeypadCheckManager keypadcheckService;
  	
  	@Resource(name="knowledgeService")
  	private KnowledgeManager knowledgeService;
  	
  	@Resource(name="knowledgechapterService")
  	private KnowledgeChapterManager knowledgechapterService;
  	
  	@Resource(name="paperService")
  	private PaperManager paperService;
  	
  	@Resource(name="paperclassteacherService")
  	private PaperClassTeacherManager paperclassteacherService;
  	
  	@Resource(name="paperquestionService")
  	private PaperQuestionManager paperquestionService;
  	
  	@Resource(name="papertypeService")
  	private PaperTypeManager papertypeService;
  	
  	@Resource(name="questionService")
  	private QuestionManager questionService;
  	
  	@Resource(name="questiontypeService")
  	private QuestionTypeManager questiontypeService;
  	
  	@Resource(name="schoolgradesubjectService")
  	private SchoolGradeSubjectManager schoolgradesubjectService;
  	
  	@Resource(name="sclassService")
  	private SClassManager sclassService;
  	
  	@Resource(name="studentService")
  	private StudentManager studentService;
  	
  	@Resource(name="subjectService")
  	private SubjectManager subjectService;
  	
  	@Resource(name="teacherService")
  	private TeacherManager teacherService;
  	
  	@Resource(name="testpaperinfoService")
  	private TestPaperInfoManager testpaperinfoService;
6cdfeaf1   孙向锦   修改相关信息,添加反馈模块
124
125
126
127
  
  	@Resource(name = "feedbackService")
  	private FeedbackManager feedbackService;
  
c83d0804   孙向锦   添加客服反馈
128
129
130
  	@Resource(name = "problemphenomenonService")
  	private ProblemPhenomenonManager problemphenomenonService;
  
6cdfeaf1   孙向锦   修改相关信息,添加反馈模块
131
  	@RequestMapping(value = "/school", produces = "application/json;charset=UTF-8")
7db3ebeb   孙向锦   添加一些模块
132
  	@ResponseBody
6cdfeaf1   孙向锦   修改相关信息,添加反馈模块
133
  	public Object schoolDefault() throws Exception {
7db3ebeb   孙向锦   添加一些模块
134
135
  		return schoolList();
  	}
6cdfeaf1   孙向锦   修改相关信息,添加反馈模块
136
137
  
  	@RequestMapping(value = "/school/list", produces = "application/json;charset=UTF-8")
92455d76   孙向锦   添加更新到服务器
138
  	@ResponseBody
6cdfeaf1   孙向锦   修改相关信息,添加反馈模块
139
  	public Object schoolList() throws Exception {
92455d76   孙向锦   添加更新到服务器
140
  		PageData pd = this.getPageData();
b980d59d   孙向锦   修改模板
141
  		String id = pd.getString("ID");
6cdfeaf1   孙向锦   修改相关信息,添加反馈模块
142
  		if (id != null && !"".equals(id)) {
92455d76   孙向锦   添加更新到服务器
143
  			PageData ret = schoolService.findById(pd);
cb39a12d   孙向锦   更新api接口头信息
144
145
146
  			ResponseGson<PageData> res = new ResponseGson();
  			res.setData(ret);
  			return res.toJson();
6cdfeaf1   孙向锦   修改相关信息,添加反馈模块
147
  		} else {
92455d76   孙向锦   添加更新到服务器
148
  			List<PageData> ret = schoolService.listAll(pd);
cb39a12d   孙向锦   更新api接口头信息
149
150
151
  			ResponseGson<List<PageData>> res = new ResponseGson();
  			res.setData(ret);
  			return res.toJson();
92455d76   孙向锦   添加更新到服务器
152
  		}
cb39a12d   孙向锦   更新api接口头信息
153
  	}
6cdfeaf1   孙向锦   修改相关信息,添加反馈模块
154
155
  
  	@RequestMapping(value = "/school/add", produces = "application/json;charset=UTF-8")
cb39a12d   孙向锦   更新api接口头信息
156
  	@ResponseBody
6cdfeaf1   孙向锦   修改相关信息,添加反馈模块
157
  	public Object schoolAdd() throws Exception {
cb39a12d   孙向锦   更新api接口头信息
158
  		PageData pd = this.getPageData();
b980d59d   孙向锦   修改模板
159
  		ResponseGson<Integer> res = new ResponseGson();
cb39a12d   孙向锦   更新api接口头信息
160
  		try {
b980d59d   孙向锦   修改模板
161
162
163
  			if (pd.get("NAME") != null) {
  				Integer id = schoolService.save(pd);
  				res.setData(id);
cb39a12d   孙向锦   更新api接口头信息
164
165
166
  			} else {
  				res.setDataError();
  			}
6cdfeaf1   孙向锦   修改相关信息,添加反馈模块
167
  		} catch (Exception e) {
cb39a12d   孙向锦   更新api接口头信息
168
169
170
171
  			res.setDataError();
  		}
  		return res.toJson();
  	}
6cdfeaf1   孙向锦   修改相关信息,添加反馈模块
172
173
  
  	@RequestMapping(value = "/school/delete", produces = "application/json;charset=UTF-8")
cb39a12d   孙向锦   更新api接口头信息
174
  	@ResponseBody
6cdfeaf1   孙向锦   修改相关信息,添加反馈模块
175
  	public Object schoolDelete() throws Exception {
cb39a12d   孙向锦   更新api接口头信息
176
177
  		ResponseGson<PageData> res = new ResponseGson();
  		PageData pd = this.getPageData();
b980d59d   孙向锦   修改模板
178
  		String id = pd.getString("ID");
6cdfeaf1   孙向锦   修改相关信息,添加反馈模块
179
  		if (id != null && !"".equals(id)) {
b980d59d   孙向锦   修改模板
180
181
182
183
184
  			try {
  				schoolService.delete(pd);
  			} catch (Exception e) {
  				res.setDataError();
  			}
6cdfeaf1   孙向锦   修改相关信息,添加反馈模块
185
  		} else {
cb39a12d   孙向锦   更新api接口头信息
186
187
188
189
  			res.setDataError();
  		}
  		return res.toJson();
  	}
6cdfeaf1   孙向锦   修改相关信息,添加反馈模块
190
191
  
  	@RequestMapping(value = "/school/update", produces = "application/json;charset=UTF-8")
cb39a12d   孙向锦   更新api接口头信息
192
  	@ResponseBody
6cdfeaf1   孙向锦   修改相关信息,添加反馈模块
193
  	public Object schoolUpdate() throws Exception {
cb39a12d   孙向锦   更新api接口头信息
194
195
  		ResponseGson<PageData> res = new ResponseGson();
  		PageData pd = this.getPageData();
b980d59d   孙向锦   修改模板
196
  		String id = pd.getString("ID");
6cdfeaf1   孙向锦   修改相关信息,添加反馈模块
197
  		if (id != null && !"".equals(id)) {
b980d59d   孙向锦   修改模板
198
199
200
201
202
  			try {
  				schoolService.edit(pd);
  			} catch (Exception e) {
  				res.setDataError();
  			}
6cdfeaf1   孙向锦   修改相关信息,添加反馈模块
203
  		} else {
cb39a12d   孙向锦   更新api接口头信息
204
205
206
  			res.setDataError();
  		}
  		return res.toJson();
92455d76   孙向锦   添加更新到服务器
207
  	}
6cdfeaf1   孙向锦   修改相关信息,添加反馈模块
208
209
  
  	@RequestMapping(value = "/basestation/list", produces = "application/json;charset=UTF-8")
92455d76   孙向锦   添加更新到服务器
210
  	@ResponseBody
6cdfeaf1   孙向锦   修改相关信息,添加反馈模块
211
  	public Object basestation() throws Exception {
92455d76   孙向锦   添加更新到服务器
212
  		PageData pd = this.getPageData();
b980d59d   孙向锦   修改模板
213
  		String id = pd.getString("ID");
6cdfeaf1   孙向锦   修改相关信息,添加反馈模块
214
  		if (id != null && !"".equals(id)) {
92455d76   孙向锦   添加更新到服务器
215
216
  			pd.put("BASESTATION_ID", pd.getString("id"));
  			PageData ret = basestationService.findById(pd);
cb39a12d   孙向锦   更新api接口头信息
217
218
219
  			ResponseGson<PageData> res = new ResponseGson();
  			res.setData(ret);
  			return res.toJson();
6cdfeaf1   孙向锦   修改相关信息,添加反馈模块
220
  		} else {
92455d76   孙向锦   添加更新到服务器
221
  			List<PageData> ret = basestationService.listAll(pd);
cb39a12d   孙向锦   更新api接口头信息
222
223
224
225
  			ResponseGson<List<PageData>> res = new ResponseGson();
  			res.setData(ret);
  			return res.toJson();
  		}
6cdfeaf1   孙向锦   修改相关信息,添加反馈模块
226
  
cb39a12d   孙向锦   更新api接口头信息
227
  	}
6cdfeaf1   孙向锦   修改相关信息,添加反馈模块
228
229
  
  	@RequestMapping(value = "/basestation/add", produces = "application/json;charset=UTF-8")
b980d59d   孙向锦   修改模板
230
231
232
233
234
235
236
237
238
239
  	@ResponseBody
  	public Object basestationAdd() throws Exception {
  		ResponseGson<PageData> res = new ResponseGson();
  		PageData pd = this.getPageData();
  		if (pd.getString("NAME") != null) {
  			try {
  				basestationService.edit(pd);
  			} catch (Exception ex) {
  				res.setDataError();
  			}
6cdfeaf1   孙向锦   修改相关信息,添加反馈模块
240
  		} else {
b980d59d   孙向锦   修改模板
241
242
243
244
  			res.setDataError();
  		}
  		return res.toJson();
  	}
6cdfeaf1   孙向锦   修改相关信息,添加反馈模块
245
246
  
  	@RequestMapping(value = "/basestation/delete", produces = "application/json;charset=UTF-8")
b980d59d   孙向锦   修改模板
247
  	@ResponseBody
6cdfeaf1   孙向锦   修改相关信息,添加反馈模块
248
  	public Object basestationDelete() throws Exception {
b980d59d   孙向锦   修改模板
249
250
251
  		PageData pd = this.getPageData();
  		ResponseGson<PageData> res = new ResponseGson();
  		String id = pd.getString("ID");
6cdfeaf1   孙向锦   修改相关信息,添加反馈模块
252
  		if (id != null && !"".equals(id)) {
b980d59d   孙向锦   修改模板
253
254
255
256
257
  			try {
  				basestationService.delete(pd);
  			} catch (Exception e) {
  				res.setDataError();
  			}
6cdfeaf1   孙向锦   修改相关信息,添加反馈模块
258
  		} else {
b980d59d   孙向锦   修改模板
259
260
261
262
  			res.setDataError();
  		}
  		return res.toJson();
  	}
6cdfeaf1   孙向锦   修改相关信息,添加反馈模块
263
264
  
  	@RequestMapping(value = "/basestation/update", produces = "application/json;charset=UTF-8")
b980d59d   孙向锦   修改模板
265
  	@ResponseBody
6cdfeaf1   孙向锦   修改相关信息,添加反馈模块
266
  	public Object basestationUpdate() throws Exception {
b980d59d   孙向锦   修改模板
267
268
269
  		PageData pd = this.getPageData();
  		ResponseGson<PageData> res = new ResponseGson();
  		String id = pd.getString("ID");
6cdfeaf1   孙向锦   修改相关信息,添加反馈模块
270
  		if (id != null && !"".equals(id)) {
b980d59d   孙向锦   修改模板
271
272
273
274
275
  			try {
  				basestationService.edit(pd);
  			} catch (Exception e) {
  				res.setDataError();
  			}
6cdfeaf1   孙向锦   修改相关信息,添加反馈模块
276
  		} else {
b980d59d   孙向锦   修改模板
277
278
279
280
  			res.setDataError();
  		}
  		return res.toJson();
  	}
6cdfeaf1   孙向锦   修改相关信息,添加反馈模块
281
282
  
  	@RequestMapping(value = "/keypad/list", produces = "application/json;charset=UTF-8")
cb39a12d   孙向锦   更新api接口头信息
283
  	@ResponseBody
6cdfeaf1   孙向锦   修改相关信息,添加反馈模块
284
  	public Object keypad() throws Exception {
cb39a12d   孙向锦   更新api接口头信息
285
  		PageData pd = this.getPageData();
b980d59d   孙向锦   修改模板
286
  		String id = pd.getString("ID");
6cdfeaf1   孙向锦   修改相关信息,添加反馈模块
287
  		if (id != null && !"".equals(id)) {
cb39a12d   孙向锦   更新api接口头信息
288
289
290
291
  			PageData ret = keypadService.findById(pd);
  			ResponseGson<PageData> res = new ResponseGson();
  			res.setData(ret);
  			return res.toJson();
6cdfeaf1   孙向锦   修改相关信息,添加反馈模块
292
  		} else {
cb39a12d   孙向锦   更新api接口头信息
293
294
295
296
  			List<PageData> ret = keypadService.listAll(pd);
  			ResponseGson<List<PageData>> res = new ResponseGson();
  			res.setData(ret);
  			return res.toJson();
92455d76   孙向锦   添加更新到服务器
297
  		}
92455d76   孙向锦   添加更新到服务器
298
  	}
6cdfeaf1   孙向锦   修改相关信息,添加反馈模块
299
300
  
  	@RequestMapping(value = "/keypad/add", produces = "application/json;charset=UTF-8")
b980d59d   孙向锦   修改模板
301
302
303
304
305
306
307
308
309
310
311
  	@ResponseBody
  	public Object keypadAdd() throws Exception {
  		PageData pd = this.getPageData();
  		ResponseGson<PageData> res = new ResponseGson();
  		try {
  			keypadService.save(pd);
  		} catch (Exception ex) {
  			res.setDataError();
  		}
  		return res.toJson();
  	}
6cdfeaf1   孙向锦   修改相关信息,添加反馈模块
312
313
  
  	@RequestMapping(value = "/keypad/delete", produces = "application/json;charset=UTF-8")
b980d59d   孙向锦   修改模板
314
  	@ResponseBody
6cdfeaf1   孙向锦   修改相关信息,添加反馈模块
315
  	public Object keypadDelete() throws Exception {
b980d59d   孙向锦   修改模板
316
317
318
  		PageData pd = this.getPageData();
  		ResponseGson<PageData> res = new ResponseGson();
  		String id = pd.getString("ID");
6cdfeaf1   孙向锦   修改相关信息,添加反馈模块
319
  		if (id != null && !"".equals(id)) {
b980d59d   孙向锦   修改模板
320
321
322
323
324
  			try {
  				keypadService.delete(pd);
  			} catch (Exception e) {
  				res.setDataError();
  			}
6cdfeaf1   孙向锦   修改相关信息,添加反馈模块
325
  		} else {
b980d59d   孙向锦   修改模板
326
327
328
329
  			res.setDataError();
  		}
  		return res.toJson();
  	}
6cdfeaf1   孙向锦   修改相关信息,添加反馈模块
330
331
  
  	@RequestMapping(value = "/keypad/update", produces = "application/json;charset=UTF-8")
b980d59d   孙向锦   修改模板
332
  	@ResponseBody
6cdfeaf1   孙向锦   修改相关信息,添加反馈模块
333
  	public Object keypadUpdate() throws Exception {
b980d59d   孙向锦   修改模板
334
335
336
  		PageData pd = this.getPageData();
  		ResponseGson<PageData> res = new ResponseGson();
  		String id = pd.getString("ID");
6cdfeaf1   孙向锦   修改相关信息,添加反馈模块
337
338
  		if (id != null && !"".equals(id)) {
  			try {
b980d59d   孙向锦   修改模板
339
  				keypadService.edit(pd);
6cdfeaf1   孙向锦   修改相关信息,添加反馈模块
340
  			} catch (Exception ex) {
b980d59d   孙向锦   修改模板
341
342
  				res.setDataError();
  			}
6cdfeaf1   孙向锦   修改相关信息,添加反馈模块
343
  		} else {
b980d59d   孙向锦   修改模板
344
345
346
347
  			res.setDataError();
  		}
  		return res.toJson();
  	}
6cdfeaf1   孙向锦   修改相关信息,添加反馈模块
348
349
350
  
  	@RequestMapping(value = "/feedback/add", produces = "application/json;charset=UTF-8")
  	@ResponseBody
9f161055   孙向锦   修改高斯客户反馈
351
352
  	public Object feedbackAdd(HttpServletRequest request)
   throws Exception {
6cdfeaf1   孙向锦   修改相关信息,添加反馈模块
353
354
355
356
  		PageData pd = this.getPageData();
  		ResponseGson<PageData> res = new ResponseGson();
  		String path = request.getSession().getServletContext()
  				.getRealPath("/images");
c83d0804   孙向锦   添加客服反馈
357
  		File pathFile = new File(path);
9f161055   孙向锦   修改高斯客户反馈
358
  		if (!pathFile.exists()) {
c83d0804   孙向锦   添加客服反馈
359
360
361
  			pathFile.mkdirs();
  		}
  		logger.info(path);
9f161055   孙向锦   修改高斯客户反馈
362
363
364
365
366
367
368
369
370
371
372
373
374
  		if (pd.get("PROBLEM_PATH") != null) {
  			String imgStr = pd.getString("PROBLEM_PATH");
  			String[] content = imgStr.split(";base64,");
  			if (content.length >= 2) {
  				String fileType = ".file";
  				if (content[0].contains("image")) {
  					fileType = content[0].substring(11, content[0].length());
  				}
  				String filename = "fb_" + System.currentTimeMillis() + "."
  						+ fileType;
  				File dir = new File(path + File.separator + filename);
  				if (!dir.exists()) {
  					dir.createNewFile();
c83d0804   孙向锦   添加客服反馈
375
  				}
9f161055   孙向锦   修改高斯客户反馈
376
377
  				generateImage(content[1], dir.getAbsolutePath());
  				pd.put("PROBLEM_PATH", filename);
c83d0804   孙向锦   添加客服反馈
378
  			}
6cdfeaf1   孙向锦   修改相关信息,添加反馈模块
379
380
381
382
  		}
  		String id = pd.getString("ID");
  		if (id != null && !"".equals(id)) {
  			try {
c83d0804   孙向锦   添加客服反馈
383
  				logger.info(pd);
6cdfeaf1   孙向锦   修改相关信息,添加反馈模块
384
385
386
387
388
389
390
391
392
393
394
395
396
397
  				feedbackService.edit(pd);
  			} catch (Exception ex) {
  				res.setDataError();
  			}
  		} else {
  			pd.put("CREATE_DATE", Tools.date2Str(new Date()));
  			try {
  				feedbackService.save(pd);
  			} catch (Exception ex) {
  				res.setDataError();
  			}
  		}
  		return res.toJson();
  	}
c83d0804   孙向锦   添加客服反馈
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
  
  	@RequestMapping(value = "/problem", produces = "application/json;charset=UTF-8")
  	@ResponseBody
  	public Object problem() throws Exception {
  		PageData pd = getPageData();
  		List<PageData> ret = null;
  		if (pd.get("TYPE") != null && !"".equals(pd.get("TYPE"))) {
  			ret = problemphenomenonService.listAllByType(pd);
  		} else {
  			ret = problemphenomenonService.listAll(pd);
  		}
  		ResponseGson<List<PageData>> res = new ResponseGson();
  		res.setData(ret);
  		return res.toJson();
  	}
  
  	public static boolean generateImage(String imgStr, String path) {
  		if (imgStr == null)
  			return false;
  		BASE64Decoder decoder = new BASE64Decoder();
  		try {
  			byte[] b = decoder.decodeBuffer(imgStr);
  			// 处理数据
  			for (int i = 0; i < b.length; ++i) {
  				if (b[i] < 0) {
  					b[i] += 256;
  				}
  			}
  			OutputStream out = new FileOutputStream(path);
  			out.write(b);
  			out.flush();
  			out.close();
  			return true;
  		} catch (Exception e) {
  			return false;
  		}
  	}
bed6e1fc   孙向锦   添加其他功能
435
  	
92455d76   孙向锦   添加更新到服务器
436
  }