Commit 54c3da43fd94c86364ea7596b38ae078b9c8b38a
1 parent
2f75c847
Exists in
master
1
Showing
14 changed files
with
869 additions
and
757 deletions
Show diff stats
pom.xml
@@ -19,7 +19,6 @@ | @@ -19,7 +19,6 @@ | ||
19 | <artifactId>httpclient</artifactId> | 19 | <artifactId>httpclient</artifactId> |
20 | <version>4.3</version> | 20 | <version>4.3</version> |
21 | </dependency> | 21 | </dependency> |
22 | - | ||
23 | <dependency> | 22 | <dependency> |
24 | <groupId>com.microsoft.sqlserver</groupId> | 23 | <groupId>com.microsoft.sqlserver</groupId> |
25 | <artifactId>mssql-jdbc</artifactId> | 24 | <artifactId>mssql-jdbc</artifactId> |
@@ -97,6 +96,7 @@ | @@ -97,6 +96,7 @@ | ||
97 | <version>4.1.0</version> | 96 | <version>4.1.0</version> |
98 | </dependency> | 97 | </dependency> |
99 | 98 | ||
99 | + | ||
100 | <!--数据库--> | 100 | <!--数据库--> |
101 | <dependency> | 101 | <dependency> |
102 | <groupId>org.mybatis.spring.boot</groupId> | 102 | <groupId>org.mybatis.spring.boot</groupId> |
src/main/java/com/jevon/controller/InitController.java
@@ -1,421 +0,0 @@ | @@ -1,421 +0,0 @@ | ||
1 | -package com.jevon.controller; | ||
2 | - | ||
3 | -import com.alibaba.fastjson.JSONObject; | ||
4 | -import com.jevon.model.*; | ||
5 | -import com.jevon.service.*; | ||
6 | -import com.jevon.utils.HttpClientUtils; | ||
7 | -import com.jevon.vo.BaseVo; | ||
8 | -import com.jevon.vo.rep.InitRepVo; | ||
9 | -import com.jevon.vo.rep.ScheduleRepVo; | ||
10 | -import com.jevon.vo.req.CreateScheduleReqVo; | ||
11 | -import com.jevon.vo.req.InitTeacherCourseReqVo; | ||
12 | -import com.jevon.vo.req.ScheduleIdReqVo; | ||
13 | -import com.jevon.vo.req.UpdateScheduleReqVo; | ||
14 | -import io.swagger.annotations.Api; | ||
15 | -import io.swagger.annotations.ApiOperation; | ||
16 | -import org.apache.commons.lang3.StringUtils; | ||
17 | -import org.apache.poi.hssf.usermodel.HSSFWorkbook; | ||
18 | -import org.apache.poi.ss.usermodel.*; | ||
19 | -import org.apache.poi.xssf.usermodel.XSSFWorkbook; | ||
20 | -import org.springframework.beans.factory.annotation.Autowired; | ||
21 | -import org.springframework.transaction.annotation.Transactional; | ||
22 | -import org.springframework.web.bind.annotation.RequestBody; | ||
23 | -import org.springframework.web.bind.annotation.RequestMapping; | ||
24 | -import org.springframework.web.bind.annotation.RequestMethod; | ||
25 | -import org.springframework.web.bind.annotation.RestController; | ||
26 | - | ||
27 | -import javax.servlet.http.HttpServletRequest; | ||
28 | -import java.io.File; | ||
29 | -import java.io.FileInputStream; | ||
30 | -import java.util.*; | ||
31 | - | ||
32 | -@RestController | ||
33 | -@RequestMapping(value = "/init") | ||
34 | -@Api(value = "排课表") | ||
35 | -public class InitController { | ||
36 | - | ||
37 | - @Autowired | ||
38 | - ClassModelService classModelService; | ||
39 | - | ||
40 | - @Autowired | ||
41 | - TeacherClassService teacherClassService; | ||
42 | - | ||
43 | - @Autowired | ||
44 | - CourseService courseService ; | ||
45 | - | ||
46 | - @Autowired | ||
47 | - TeacherService teacherService; | ||
48 | - | ||
49 | - @Autowired | ||
50 | - ScheduleService scheduleService; | ||
51 | - | ||
52 | - @Autowired | ||
53 | - TeacherCourseService teacherCourseService; | ||
54 | - | ||
55 | - @Autowired | ||
56 | - JoinClassService joinClassService; | ||
57 | - | ||
58 | - @Autowired | ||
59 | - ClassCourseService classCourseService; | ||
60 | - | ||
61 | - private static String url = "http://60.190.202.57:1000"; | ||
62 | - | ||
63 | - private static String staticUrl = "F://wwwroot//smartcampus"; | ||
64 | - | ||
65 | - @ApiOperation("创建排课计划 ") | ||
66 | - @RequestMapping(value = "createSchedule", method = RequestMethod.POST) | ||
67 | - public ScheduleRepVo createSchedule(@RequestBody CreateScheduleReqVo createScheduleReqVo){ | ||
68 | - ScheduleRepVo baseVo = new ScheduleRepVo(); | ||
69 | - Schedule schedule = new Schedule(); | ||
70 | - schedule.setTeam(createScheduleReqVo.getTeam()); | ||
71 | - schedule.setScheduleName(createScheduleReqVo.getScheduleName()); | ||
72 | - schedule.setSchoolId(createScheduleReqVo.getSchoolId()); | ||
73 | - Schedule temp = scheduleService.selectBySchoolAndTeam(schedule); | ||
74 | - if(temp == null){ | ||
75 | - scheduleService.insert(schedule); | ||
76 | - }else { | ||
77 | - baseVo.setSuccess(false); | ||
78 | - baseVo.setMessage("该学校该学年学期已创建了排课计划"); | ||
79 | - return baseVo; | ||
80 | - } | ||
81 | - temp = scheduleService.selectBySchoolAndTeam(schedule); | ||
82 | - initMessage(schedule.getSchoolId()); | ||
83 | - baseVo.setScheduleId(temp.getId()); | ||
84 | - return baseVo; | ||
85 | - } | ||
86 | - | ||
87 | - @ApiOperation("更新计划") | ||
88 | - @RequestMapping(value = "updateSchedule", method = RequestMethod.POST) | ||
89 | - public BaseVo updateSchedule(@RequestBody UpdateScheduleReqVo updateScheduleReqVo){ | ||
90 | - BaseVo baseVo = new BaseVo(); | ||
91 | - Schedule schedule = scheduleService.selectById(updateScheduleReqVo.getScheduleId()); | ||
92 | - schedule.setScheduleName(updateScheduleReqVo.getScheduleName()); | ||
93 | - schedule.setTeam(updateScheduleReqVo.getTeam()); | ||
94 | - scheduleService.update(schedule); | ||
95 | - return baseVo; | ||
96 | - } | ||
97 | - | ||
98 | - @ApiOperation("复制") | ||
99 | - @RequestMapping(value = "copySchedule", method = RequestMethod.POST) | ||
100 | - public BaseVo copySchedule(@RequestBody UpdateScheduleReqVo updateScheduleReqVo){ | ||
101 | - BaseVo baseVo = new BaseVo(); | ||
102 | - Schedule schedule = scheduleService.selectById(updateScheduleReqVo.getScheduleId()); | ||
103 | - if(schedule == null){ | ||
104 | - baseVo.setMessage("原始课表不存在"); | ||
105 | - baseVo.setSuccess(false); | ||
106 | - return baseVo; | ||
107 | - } | ||
108 | - Schedule temp = new Schedule(); | ||
109 | - temp.setSchoolId(schedule.getSchoolId()); | ||
110 | - temp.setTeam(updateScheduleReqVo.getTeam()); | ||
111 | - Schedule result = scheduleService.selectBySchoolAndTeam(temp); | ||
112 | - if(result != null){ | ||
113 | - baseVo.setMessage("该学年学期已创建课表计划"); | ||
114 | - baseVo.setSuccess(false); | ||
115 | - return baseVo; | ||
116 | - } | ||
117 | - temp.setScheduleName(updateScheduleReqVo.getScheduleName()); | ||
118 | - scheduleService.insert(temp); | ||
119 | - Date date = new Date(); | ||
120 | - //复制 classCourse teacherClass teacherCourse | ||
121 | - List<ClassCourse> classCourses = classCourseService.copyClassCourse(schedule.getSchoolId(),schedule.getTeam()); | ||
122 | - for(ClassCourse classCourse :classCourses){ | ||
123 | - classCourse.setSchoolId(temp.getSchoolId()); | ||
124 | - classCourse.setTeam(temp.getTeam()); | ||
125 | - classCourse.setCreateTime(date); | ||
126 | - } | ||
127 | - classCourseService.insertBatch(classCourses); | ||
128 | - TeacherClass teacherClass = new TeacherClass(); | ||
129 | - teacherClass.setSchoolId(schedule.getSchoolId()); | ||
130 | - teacherClass.setTeam(schedule.getTeam()); | ||
131 | - List<TeacherClass> teacherClasses = teacherClassService.selectBySchoolAndTeam(teacherClass); | ||
132 | - for(TeacherClass teacherClass1 :teacherClasses){ | ||
133 | - teacherClass1.setSchoolId(temp.getSchoolId()); | ||
134 | - teacherClass1.setTeam(temp.getTeam()); | ||
135 | - teacherClass1.setCreateTime(date); | ||
136 | - } | ||
137 | - teacherClassService.insertBatch(teacherClasses); | ||
138 | - | ||
139 | - List<TeacherCourse> teacherCourses = teacherCourseService.selectBySchoolIdAndTeam(schedule.getSchoolId(),schedule.getTeam()); | ||
140 | - for(TeacherCourse teacherCourse : teacherCourses){ | ||
141 | - teacherCourse.setSchoolId(temp.getSchoolId()); | ||
142 | - teacherCourse.setTeam(temp.getTeam()); | ||
143 | - teacherCourse.setCreateTime(date); | ||
144 | - } | ||
145 | - teacherCourseService.insertBatch(teacherCourses); | ||
146 | - return baseVo; | ||
147 | - } | ||
148 | - | ||
149 | - @ApiOperation("删除排课计划") | ||
150 | - @RequestMapping(value = "deleteSchedule", method = RequestMethod.POST) | ||
151 | - public BaseVo deleteSchedule(@RequestBody ScheduleIdReqVo scheduleIdReqVo){ | ||
152 | - BaseVo baseVo = new BaseVo(); | ||
153 | - Schedule schedule = scheduleService.selectById(scheduleIdReqVo.getScheduleId()); | ||
154 | - if(schedule == null){ | ||
155 | - baseVo.setSuccess(false); | ||
156 | - baseVo.setMessage("无排课计划"); | ||
157 | - return baseVo; | ||
158 | - } | ||
159 | - teacherCourseService.deleteBySchoolIdAndTeam(schedule.getSchoolId(),schedule.getTeam()); | ||
160 | - joinClassService.deleteBySchoolIdAndTeam(schedule.getSchoolId(),schedule.getTeam()); | ||
161 | - classCourseService.deleteBySchoolIdAndTeam(schedule.getSchoolId(),schedule.getTeam()); | ||
162 | - TeacherClass teacherClass = new TeacherClass(); | ||
163 | - teacherClass.setSchoolId(schedule.getSchoolId()); | ||
164 | - teacherClass.setTeam(schedule.getTeam()); | ||
165 | - teacherClassService.deleteBySchoolAndTeam(teacherClass); | ||
166 | - courseService.initSchoolId(schedule.getSchoolId()); | ||
167 | - scheduleService.deleteBySchedule(schedule.getId()); | ||
168 | - return baseVo; | ||
169 | - } | ||
170 | - | ||
171 | - @ApiOperation("获取基础信息") | ||
172 | - @RequestMapping(value = "getInitMessage", method = RequestMethod.POST) | ||
173 | - public InitRepVo getInitMessage(@RequestBody ScheduleIdReqVo scheduleIdReqVo){ | ||
174 | - InitRepVo initRepVo = new InitRepVo(); | ||
175 | - Schedule schedule = scheduleService.selectById(scheduleIdReqVo.getScheduleId()); | ||
176 | - if(schedule == null){ | ||
177 | - initRepVo.setSuccess(false); | ||
178 | - initRepVo.setMessage("没有改排课计划"); | ||
179 | - return initRepVo; | ||
180 | - } | ||
181 | - List<Course> courses = courseService.selectBySchoolId(schedule.getSchoolId()); | ||
182 | - List<Teacher> teachers = teacherService.selectBySchoolId(schedule.getSchoolId()); | ||
183 | - List<ClassModel> classModels = classModelService.selectBySchoolId(schedule.getSchoolId()); | ||
184 | - initRepVo.setClassNumber(classModels.size()); | ||
185 | - initRepVo.setCourseNumber(courses.size()); | ||
186 | - initRepVo.setTeacherNumber(teachers.size()); | ||
187 | - return initRepVo; | ||
188 | - } | ||
189 | - | ||
190 | - @Transactional | ||
191 | - @ApiOperation("教师授课信息") | ||
192 | - @RequestMapping(value = "initTeacherCourse", method = RequestMethod.POST) | ||
193 | - public BaseVo initTeacherCourse(@RequestBody InitTeacherCourseReqVo initTeacherCourseReqVo){ | ||
194 | - BaseVo baseVo = new BaseVo(); | ||
195 | - Date date = new Date(); | ||
196 | - try{ | ||
197 | - TeacherClass temp = new TeacherClass(); | ||
198 | - Schedule schedule = scheduleService.selectById(initTeacherCourseReqVo.getScheduleId()); | ||
199 | - if(schedule != null && schedule.getSpeed() == 2) { | ||
200 | - temp.setSchoolId(schedule.getSchoolId()); | ||
201 | - temp.setTeam(schedule.getTeam()); | ||
202 | - List<TeacherClass> list = teacherClassService.selectBySchoolAndTeam(temp); | ||
203 | - if (list != null && list.size() > 0) { | ||
204 | - teacherClassService.deleteBySchoolAndTeam(temp); | ||
205 | - } | ||
206 | - String fileUrl = initTeacherCourseReqVo.getUrl(); | ||
207 | - fileUrl = fileUrl.replace(url, staticUrl); | ||
208 | - File excelFile = new File(fileUrl); | ||
209 | - // 获得工作簿 | ||
210 | - String file = excelFile.getName(); | ||
211 | - Workbook workbook = null; | ||
212 | - if (file.endsWith("xls")) { | ||
213 | - workbook = new HSSFWorkbook(new FileInputStream(excelFile)); | ||
214 | - } else { | ||
215 | - workbook = new XSSFWorkbook(new FileInputStream(excelFile)); | ||
216 | - } | ||
217 | - // 获得工作表 | ||
218 | - Sheet sheet = workbook.getSheetAt(0); | ||
219 | - int rows = sheet.getPhysicalNumberOfRows(); | ||
220 | - Map<Integer, Course> courseTeacherMap = new HashMap<>(); | ||
221 | - int courseNumber = 0; | ||
222 | - List<TeacherClass> teacherClasses = new ArrayList<>(); | ||
223 | - for (int i = 0; i < rows; i++) { | ||
224 | - // 获取第i行数据 | ||
225 | - Row sheetRow = sheet.getRow(i); | ||
226 | - if (i == 0) { | ||
227 | - //获取表头 | ||
228 | - int j = 1; | ||
229 | - while (sheetRow.getCell(2 * j) != null && StringUtils.isNotBlank(sheetRow.getCell(2 * j).getStringCellValue().trim())) { | ||
230 | - Course course = courseService.selectBySchoolIdAndCourseName(schedule.getSchoolId(), sheetRow.getCell(2 * j).getStringCellValue().trim()); | ||
231 | - courseTeacherMap.put(j, course); | ||
232 | - j++; | ||
233 | - } | ||
234 | - courseNumber = j - 1; | ||
235 | - } else { | ||
236 | - if (StringUtils.isBlank(sheetRow.getCell(0).getStringCellValue().trim())) { | ||
237 | - continue; | ||
238 | - } | ||
239 | - String className = sheetRow.getCell(1).getStringCellValue().trim(); | ||
240 | - ClassModel classModel = new ClassModel(); | ||
241 | - classModel.setSchoolId(schedule.getSchoolId()); | ||
242 | - classModel.setClassName(className); | ||
243 | - classModel.setGrade(sheetRow.getCell(0).getStringCellValue().trim()); | ||
244 | - ClassModel resultClass = classModelService.selectBySchoolIdAndClassNameAndGrade(classModel); | ||
245 | - for (int j = 1; j <= courseNumber; j++) { | ||
246 | - Cell cell = sheetRow.getCell(2 * j); | ||
247 | - if (cell != null) { | ||
248 | - cell.setCellType(CellType.STRING); | ||
249 | - String times = sheetRow.getCell(2 * j).getStringCellValue().trim(); | ||
250 | - if (StringUtils.isNotBlank((times))) { | ||
251 | - Course course = courseTeacherMap.get(j); | ||
252 | - String teacherName = sheetRow.getCell(2 * j + 1).getStringCellValue().trim(); | ||
253 | - Teacher teacher = new Teacher(); | ||
254 | - teacher.setTeacherName(teacherName); | ||
255 | - teacher.setSchoolId(schedule.getSchoolId()); | ||
256 | - Teacher resultTeacher = teacherService.selectByTeacher(teacher); | ||
257 | - if (course != null && resultTeacher != null) { | ||
258 | - TeacherClass teacherClass = new TeacherClass(); | ||
259 | - teacherClass.setTeam(schedule.getTeam()); | ||
260 | - teacherClass.setSchoolId(schedule.getSchoolId()); | ||
261 | - teacherClass.setCourseName(course.getCourseName()); | ||
262 | - teacherClass.setTeacherName(resultTeacher.getTeacherName()); | ||
263 | - teacherClass.setTeacherId(resultTeacher.getTeacherId()); | ||
264 | - teacherClass.setGrade(sheetRow.getCell(0).getStringCellValue().trim()); | ||
265 | - teacherClass.setClassId(resultClass.getClassId()); | ||
266 | - String[] msg = times.split("\\+"); | ||
267 | - if (msg.length > 1) { | ||
268 | - //有联课 | ||
269 | - teacherClass.setJoinTimes(Integer.valueOf(msg[1])); | ||
270 | - teacherClass.setTimes(Integer.valueOf(msg[1]) * 2 + Integer.valueOf(msg[0])); | ||
271 | - } else { | ||
272 | - teacherClass.setJoinTimes(0); | ||
273 | - teacherClass.setTimes(Integer.valueOf(msg[0])); | ||
274 | - } | ||
275 | - teacherClass.setStatus(0); | ||
276 | - teacherClass.setCreateTime(date); | ||
277 | - teacherClasses.add(teacherClass); | ||
278 | - } else { | ||
279 | - baseVo.setMessage("课程或老师缺失"); | ||
280 | - baseVo.setSuccess(false); | ||
281 | - return baseVo; | ||
282 | - } | ||
283 | - } | ||
284 | - | ||
285 | - } | ||
286 | - } | ||
287 | - } | ||
288 | - } | ||
289 | - teacherClassService.insertBatch(teacherClasses); | ||
290 | - schedule.setSpeed(3); | ||
291 | - scheduleService.updateSpeed(schedule); | ||
292 | - }else { | ||
293 | - baseVo.setMessage("排课计划不存在或已导入"); | ||
294 | - baseVo.setSuccess(false); | ||
295 | - } | ||
296 | - }catch (Exception e){ | ||
297 | - System.out.println(e); | ||
298 | - baseVo.setSuccess(false); | ||
299 | - } | ||
300 | - return baseVo; | ||
301 | - } | ||
302 | - | ||
303 | - | ||
304 | - private void initMessage(int schoolId){ | ||
305 | - JSONObject teacherList = HttpClientUtils.httpGet(url+"/api/EasyN/GetSchoolTeacher?SchoolId="+schoolId); | ||
306 | - List<JSONObject> openTeacherList = (List<JSONObject>)teacherList.get("data"); | ||
307 | - List<Teacher> teachers = new ArrayList<>(); | ||
308 | - for(JSONObject json :openTeacherList){ | ||
309 | - Teacher teacher = new Teacher(); | ||
310 | - teacher.setSchoolId(Integer.valueOf(json.get("school_id").toString())); | ||
311 | - teacher.setTeacherId(Integer.valueOf(json.get("teacher_id").toString())); | ||
312 | - teacher.setTeacherName(json.get("name").toString()); | ||
313 | - teachers.add(teacher); | ||
314 | - } | ||
315 | - initTeacher(teachers); | ||
316 | - JSONObject classList = HttpClientUtils.httpGet(url+"/api/EasyN/GetSchoolClass?SchoolId="+schoolId); | ||
317 | - List<JSONObject> openClasses = (List<JSONObject>)classList.get("data"); | ||
318 | - List<ClassModel> classModels = new ArrayList<>(); | ||
319 | - for(JSONObject json :openClasses){ | ||
320 | - ClassModel classModel = new ClassModel(); | ||
321 | - classModel.setSchoolId(Integer.valueOf(json.get("school_id").toString())); | ||
322 | - classModel.setClassId(Integer.valueOf(json.get("class_id").toString())); | ||
323 | - classModel.setGrade(json.get("gardeName").toString()); | ||
324 | - classModel.setClassName(json.get("class_name").toString()); | ||
325 | - classModels.add(classModel); | ||
326 | - } | ||
327 | - initClass(classModels); | ||
328 | - JSONObject courseList = HttpClientUtils.httpGet(url+"/api/EasyN/GetSchoolSubject?SchoolId="+schoolId); | ||
329 | - List<JSONObject> openCourses = (List<JSONObject>)courseList.get("data"); | ||
330 | - List<Course> courses = new ArrayList<>(); | ||
331 | - for(JSONObject json :openCourses){ | ||
332 | - Course course = new Course(); | ||
333 | - course.setSchoolId(Integer.valueOf(json.get("school_id").toString())); | ||
334 | - course.setCourseId(Integer.valueOf(json.get("subject_id").toString())); | ||
335 | - course.setCourseName(json.get("subject_name").toString()); | ||
336 | - course.setCourseType(0); | ||
337 | - courses.add(course); | ||
338 | - } | ||
339 | - initCourse(courses); | ||
340 | - } | ||
341 | - public BaseVo initCourse(List<Course> courseList){ | ||
342 | - BaseVo baseVo = new BaseVo(); | ||
343 | - List<Course> list = courseService.selectBySchoolId(courseList.get(0).getSchoolId()); | ||
344 | - if(list != null && list.size() > 0){ | ||
345 | - courseService.deleteSchoolId(courseList.get(0).getSchoolId()); | ||
346 | - } | ||
347 | - for(Course course : courseList){ | ||
348 | - if(course.getCourseId() == 0 || StringUtils.isBlank(course.getCourseName())){ | ||
349 | - baseVo.setSuccess(false); | ||
350 | - baseVo.setMessage("缺少参数"); | ||
351 | - break; | ||
352 | - } | ||
353 | - } | ||
354 | - if(baseVo.isSuccess()){ | ||
355 | - courseService.insertBatch(courseList); | ||
356 | - baseVo.setSuccess(true); | ||
357 | - return baseVo; | ||
358 | - }else { | ||
359 | - return baseVo; | ||
360 | - } | ||
361 | - } | ||
362 | - | ||
363 | - public BaseVo initClass(List<ClassModel> classList){ | ||
364 | - BaseVo baseVo = new BaseVo(); | ||
365 | - List<ClassModel> list = classModelService.selectBySchoolId(classList.get(0).getSchoolId()); | ||
366 | - if(list != null && list.size() > 0){ | ||
367 | - classModelService.deleteSchool(classList.get(0).getSchoolId()); | ||
368 | - } | ||
369 | - for(ClassModel classModel : classList){ | ||
370 | - if(classModel.getClassId() == 0 || StringUtils.isBlank(classModel.getClassName()) || | ||
371 | - StringUtils.isBlank(classModel.getGrade()) || classModel.getSchoolId() == 0){ | ||
372 | - baseVo.setSuccess(false); | ||
373 | - baseVo.setMessage("缺少参数"); | ||
374 | - break; | ||
375 | - } | ||
376 | - } | ||
377 | - if(baseVo.isSuccess()){ | ||
378 | - classModelService.insertBatch(classList); | ||
379 | - baseVo.setSuccess(true); | ||
380 | - return baseVo; | ||
381 | - }else { | ||
382 | - return baseVo; | ||
383 | - } | ||
384 | - } | ||
385 | - | ||
386 | - public BaseVo initTeacher(List<Teacher> teacherList){ | ||
387 | - List<Teacher> result = new ArrayList<>(); | ||
388 | - for(Teacher teacher : teacherList){ | ||
389 | - boolean isExist = false; | ||
390 | - for(Teacher t : result){ | ||
391 | - if(t.getTeacherName().equals(teacher.getTeacherName())){ | ||
392 | - isExist = true; | ||
393 | - } | ||
394 | - } | ||
395 | - if(!isExist){ | ||
396 | - result.add(teacher); | ||
397 | - } | ||
398 | - } | ||
399 | - BaseVo baseVo = new BaseVo(); | ||
400 | - List<Teacher> list = teacherService.selectBySchoolId(result.get(0).getSchoolId()); | ||
401 | - if(list != null && list.size()>0){ | ||
402 | - teacherService.deleteSchool(result.get(0).getSchoolId()); | ||
403 | - } | ||
404 | - for(Teacher teacher : result){ | ||
405 | - if(teacher.getSchoolId() == 0 || StringUtils.isBlank(teacher.getTeacherName()) || | ||
406 | - teacher.getTeacherId() == 0){ | ||
407 | - baseVo.setSuccess(false); | ||
408 | - baseVo.setMessage("缺少参数"); | ||
409 | - break; | ||
410 | - } | ||
411 | - } | ||
412 | - if(baseVo.isSuccess()){ | ||
413 | - teacherService.insertBatch(result); | ||
414 | - baseVo.setSuccess(true); | ||
415 | - return baseVo; | ||
416 | - }else { | ||
417 | - return baseVo; | ||
418 | - } | ||
419 | - } | ||
420 | - | ||
421 | -} |
@@ -0,0 +1,77 @@ | @@ -0,0 +1,77 @@ | ||
1 | +package com.jevon.controller; | ||
2 | + | ||
3 | +import com.jevon.model.*; | ||
4 | +import com.jevon.vo.BaseVo; | ||
5 | +import com.jevon.vo.req.InitAnalyseReqVo; | ||
6 | +import io.swagger.annotations.Api; | ||
7 | +import org.apache.commons.lang3.StringUtils; | ||
8 | +import org.apache.poi.hssf.usermodel.HSSFWorkbook; | ||
9 | +import org.apache.poi.ss.usermodel.*; | ||
10 | +import org.apache.poi.xssf.usermodel.XSSFWorkbook; | ||
11 | +import org.springframework.web.bind.annotation.RequestBody; | ||
12 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
13 | +import org.springframework.web.bind.annotation.RestController; | ||
14 | + | ||
15 | +import java.io.File; | ||
16 | +import java.io.FileInputStream; | ||
17 | +import java.util.*; | ||
18 | + | ||
19 | +/** | ||
20 | + * @author chen | ||
21 | + * @version 1.0 | ||
22 | + * @date 2019/10/17 0017 13:33 | ||
23 | + */ | ||
24 | +@RestController | ||
25 | +@RequestMapping(value = "/learn") | ||
26 | +@Api(value = "学情分析") | ||
27 | +public class LearnController { | ||
28 | + | ||
29 | + | ||
30 | + public BaseVo initAnalyse(@RequestBody InitAnalyseReqVo initAnalyseReqVo){ | ||
31 | + BaseVo baseVo = new BaseVo(); | ||
32 | + Date date = new Date(); | ||
33 | + try{ | ||
34 | + String fileUrl = initAnalyseReqVo.getUrl(); | ||
35 | + File excelFile = new File(fileUrl); | ||
36 | + // 获得工作簿 | ||
37 | + String file = excelFile.getName(); | ||
38 | + Workbook workbook = null; | ||
39 | + if (file.endsWith("xls")) { | ||
40 | + workbook = new HSSFWorkbook(new FileInputStream(excelFile)); | ||
41 | + } else { | ||
42 | + workbook = new XSSFWorkbook(new FileInputStream(excelFile)); | ||
43 | + } | ||
44 | + // 获得工作表 | ||
45 | + Sheet sheet = workbook.getSheetAt(0); | ||
46 | + int rows = sheet.getPhysicalNumberOfRows(); | ||
47 | + int column = 0 ; | ||
48 | + int courseNumber = 0; | ||
49 | + for (int i = 0; i < rows; i++) { | ||
50 | + // 获取第i行数据 | ||
51 | + Row sheetRow = sheet.getRow(i); | ||
52 | + if (i == 0) { | ||
53 | + //获取标题 | ||
54 | + String title = sheetRow.getCell(0).getStringCellValue().trim(); | ||
55 | + }else if(i == 1){ | ||
56 | + //获取表头 | ||
57 | + int j = 0 ; | ||
58 | + while (sheetRow.getCell(j) != null && StringUtils.isNotBlank(sheetRow.getCell(j).getStringCellValue().trim())) { | ||
59 | + j++ ; | ||
60 | + } | ||
61 | + column = j ; | ||
62 | + } else { | ||
63 | + for (int j = 0; j < column; j++) { | ||
64 | + Cell cell = sheetRow.getCell(j); | ||
65 | + if(cell != null){ | ||
66 | + cell.setCellType(CellType.STRING); | ||
67 | + } | ||
68 | + } | ||
69 | + } | ||
70 | + } | ||
71 | + }catch (Exception e){ | ||
72 | + System.out.println(e); | ||
73 | + baseVo.setSuccess(false); | ||
74 | + } | ||
75 | + return baseVo; | ||
76 | + } | ||
77 | +} |
src/main/java/com/jevon/controller/MessageController.java
@@ -1,316 +0,0 @@ | @@ -1,316 +0,0 @@ | ||
1 | -package com.jevon.controller; | ||
2 | - | ||
3 | -import com.jevon.model.*; | ||
4 | -import com.jevon.service.*; | ||
5 | -import com.jevon.utils.ExcelUtils; | ||
6 | -import com.jevon.vo.BaseVo; | ||
7 | -import com.jevon.vo.rep.*; | ||
8 | -import com.jevon.vo.req.CourseClassReqVo; | ||
9 | -import com.jevon.vo.req.GetClassCourseReqVo; | ||
10 | -import com.jevon.vo.req.ScheduleIdReqVo; | ||
11 | -import com.jevon.vo.req.SchoolIdReqVo; | ||
12 | -import io.swagger.annotations.Api; | ||
13 | -import io.swagger.annotations.ApiOperation; | ||
14 | -import org.springframework.beans.factory.annotation.Autowired; | ||
15 | -import org.springframework.web.bind.annotation.RequestBody; | ||
16 | -import org.springframework.web.bind.annotation.RequestMapping; | ||
17 | -import org.springframework.web.bind.annotation.RequestMethod; | ||
18 | -import org.springframework.web.bind.annotation.RestController; | ||
19 | - | ||
20 | -import javax.servlet.http.HttpServletRequest; | ||
21 | -import javax.servlet.http.HttpServletResponse; | ||
22 | -import java.util.ArrayList; | ||
23 | -import java.util.HashMap; | ||
24 | -import java.util.List; | ||
25 | -import java.util.Map; | ||
26 | - | ||
27 | -/** | ||
28 | - * @author chen | ||
29 | - * @version 1.0 | ||
30 | - * @date 2019/10/11 0011 14:00 | ||
31 | - */ | ||
32 | -@RestController | ||
33 | -@Api(value = "获取信息") | ||
34 | -public class MessageController { | ||
35 | - | ||
36 | - @Autowired | ||
37 | - ScheduleService scheduleService; | ||
38 | - | ||
39 | - @Autowired | ||
40 | - CourseService courseService; | ||
41 | - | ||
42 | - @Autowired | ||
43 | - ClassCourseService classCourseService; | ||
44 | - | ||
45 | - @Autowired | ||
46 | - ClassModelService classModelService; | ||
47 | - | ||
48 | - @Autowired | ||
49 | - JoinClassService joinClassService; | ||
50 | - | ||
51 | - @Autowired | ||
52 | - TeacherClassService teacherClassService; | ||
53 | - | ||
54 | - @ApiOperation("获取学校排课计划") | ||
55 | - @RequestMapping(value = "getScheduleList", method = RequestMethod.POST) | ||
56 | - public ScheduleListRepVo getScheduleList(@RequestBody SchoolIdReqVo schoolIdReqVo){ | ||
57 | - ScheduleListRepVo scheduleListRepVo = new ScheduleListRepVo(); | ||
58 | - scheduleListRepVo.setData(scheduleService.selectBySchool(schoolIdReqVo.getSchoolId())); | ||
59 | - return scheduleListRepVo; | ||
60 | - } | ||
61 | - | ||
62 | - @ApiOperation("获取学校下所有班级信息") | ||
63 | - @RequestMapping(value = "getClassList", method = RequestMethod.POST) | ||
64 | - public ClassRepVo getClassList(@RequestBody SchoolIdReqVo schoolIdReqVo){ | ||
65 | - ClassRepVo classRepVo = new ClassRepVo(); | ||
66 | - classRepVo.setData(classModelService.selectBySchoolId(schoolIdReqVo.getSchoolId())); | ||
67 | - return classRepVo; | ||
68 | - } | ||
69 | - | ||
70 | - @ApiOperation("获取学校课程") | ||
71 | - @RequestMapping(value = "getCourseList", method = RequestMethod.POST) | ||
72 | - public CourseRepVo getCourseList(@RequestBody ScheduleIdReqVo scheduleIdReqVo){ | ||
73 | - CourseRepVo courseRepVo = new CourseRepVo(); | ||
74 | - Schedule schedule = scheduleService.selectById(scheduleIdReqVo.getScheduleId()); | ||
75 | - if(schedule == null){ | ||
76 | - courseRepVo.setSuccess(false); | ||
77 | - courseRepVo.setMessage("请先创建计划"); | ||
78 | - return courseRepVo; | ||
79 | - } | ||
80 | - courseRepVo.setData(courseService.selectBySchoolId(schedule.getSchoolId())); | ||
81 | - return courseRepVo; | ||
82 | - } | ||
83 | - | ||
84 | - @ApiOperation("获取要学习某个学科的班级集合") | ||
85 | - @RequestMapping(value = "getCourseClassList", method = RequestMethod.POST) | ||
86 | - public List<GetCourseClassListRepVo> getCourseClassList(@RequestBody CourseClassReqVo courseClassReqVo){ | ||
87 | - List<GetCourseClassListRepVo> repVos = new ArrayList<>(); | ||
88 | - Schedule schedule = scheduleService.selectById(courseClassReqVo.getScheduleId()); | ||
89 | - if(schedule == null){ | ||
90 | - return null; | ||
91 | - } | ||
92 | - TeacherClass search = new TeacherClass(); | ||
93 | - search.setSchoolId(schedule.getSchoolId()); | ||
94 | - search.setTeam(schedule.getTeam()); | ||
95 | - String courseName =courseService.selectBySchoolIdAndCourseId(schedule.getSchoolId(),courseClassReqVo.getCourseId()).getCourseName(); | ||
96 | - search.setCourseName(courseName); | ||
97 | - List<TeacherClass> list = teacherClassService.selectByCourseName(search); | ||
98 | - for(TeacherClass teacherClass : list){ | ||
99 | - GetCourseClassListRepVo repVo = new GetCourseClassListRepVo(); | ||
100 | - repVo.setClassId(teacherClass.getClassId()); | ||
101 | - repVo.setClassName(classModelService.selectByPrimaryKey(teacherClass.getClassId()).getClassName()); | ||
102 | - repVo.setCourseId(courseClassReqVo.getCourseId()); | ||
103 | - repVo.setCourseName(courseName); | ||
104 | - repVo.setTeacherName(teacherClass.getTeacherName()); | ||
105 | - repVos.add(repVo); | ||
106 | - } | ||
107 | - return repVos; | ||
108 | - } | ||
109 | - | ||
110 | - @ApiOperation("获取班级排课课程") | ||
111 | - @RequestMapping(value = "getClassCourseList", method = RequestMethod.POST) | ||
112 | - public ClassCourseRepVo getClassCourseList(@RequestBody GetClassCourseReqVo getClassCourseReqVo){ | ||
113 | - ClassCourseRepVo classCourseRepVo = new ClassCourseRepVo(); | ||
114 | - Schedule schedule = scheduleService.selectById(getClassCourseReqVo.getScheduleId()); | ||
115 | - if(schedule == null){ | ||
116 | - classCourseRepVo.setSuccess(false); | ||
117 | - classCourseRepVo.setMessage("请先创建计划"); | ||
118 | - return classCourseRepVo; | ||
119 | - } | ||
120 | - ClassCourse search = new ClassCourse(); | ||
121 | - search.setClassId(getClassCourseReqVo.getClassId()); | ||
122 | - search.setSingleOrDouble(1); | ||
123 | - search.setTeam(schedule.getTeam()); | ||
124 | - classCourseRepVo.setData(classCourseService.selectByClassIdAndSingleOrDouble(search)); | ||
125 | - return classCourseRepVo; | ||
126 | - } | ||
127 | - | ||
128 | - @ApiOperation("获取合班信息") | ||
129 | - @RequestMapping(value = "getJoinList", method = RequestMethod.POST) | ||
130 | - public JoinRepVo getJoinList(@RequestBody ScheduleIdReqVo scheduleIdReqVo){ | ||
131 | - JoinRepVo joinRepVo = new JoinRepVo(); | ||
132 | - Schedule schedule = scheduleService.selectById(scheduleIdReqVo.getScheduleId()); | ||
133 | - JoinClass joinClass = new JoinClass(); | ||
134 | - joinClass.setSchoolId(schedule.getSchoolId()); | ||
135 | - joinClass.setTeam(schedule.getTeam()); | ||
136 | - List<JoinClass> list = joinClassService.selectByCourse(joinClass); | ||
137 | - List<JoinDetail> joinDetails = new ArrayList<>(); | ||
138 | - for(JoinClass temp : list){ | ||
139 | - boolean flag = false ; | ||
140 | - ClassModel classModel = classModelService.selectByPrimaryKey(temp.getClassId()); | ||
141 | - for(JoinDetail joinDetail : joinDetails){ | ||
142 | - if(temp.getCourseGroup() == joinDetail.getCourseGroup()){ | ||
143 | - flag = true; | ||
144 | - if(!joinDetail.getClassName().contains(classModel.getClassName())){ | ||
145 | - joinDetail.setClassName(joinDetail.getClassName()+","+classModel.getClassName()); | ||
146 | - } | ||
147 | - } | ||
148 | - } | ||
149 | - if(!flag){ | ||
150 | - JoinDetail joinDetail = new JoinDetail(); | ||
151 | - joinDetail.setCourseGroup(temp.getCourseGroup()); | ||
152 | - joinDetail.setClassName(classModel.getClassName()); | ||
153 | - joinDetail.setCourseName(temp.getCourseName()); | ||
154 | - TeacherClass search = new TeacherClass(); | ||
155 | - search.setSchoolId(schedule.getSchoolId()); | ||
156 | - search.setTeam(schedule.getTeam()); | ||
157 | - search.setClassId(temp.getClassId()); | ||
158 | - search.setCourseName(temp.getCourseName()); | ||
159 | - joinDetail.setTeacherName(teacherClassService.selectByCourseAndClass(search).getTeacherName()); | ||
160 | - joinDetails.add(joinDetail); | ||
161 | - } | ||
162 | - } | ||
163 | - joinRepVo.setData(joinDetails); | ||
164 | - return joinRepVo; | ||
165 | - } | ||
166 | - | ||
167 | - @ApiOperation("获取导入任课信息") | ||
168 | - @RequestMapping(value = "getTeacherClassList", method = RequestMethod.POST) | ||
169 | - public TeacherCourseRepVo getTeacherClassList(@RequestBody ScheduleIdReqVo scheduleIdReqVo){ | ||
170 | - TeacherCourseRepVo teacherCourseRepVo = new TeacherCourseRepVo(); | ||
171 | - Schedule schedule = scheduleService.selectById(scheduleIdReqVo.getScheduleId()); | ||
172 | - TeacherClass temp = new TeacherClass(); | ||
173 | - temp.setSchoolId(schedule.getSchoolId()); | ||
174 | - temp.setTeam(schedule.getTeam()); | ||
175 | - List<ClassCourseVO> data = new ArrayList<>(); | ||
176 | - List<String> courseNameList = new ArrayList<>(); | ||
177 | - List<TeacherClass> teacherClasses = teacherClassService.selectBySchoolAndTeam(temp); | ||
178 | - for(TeacherClass teacherClass :teacherClasses){ | ||
179 | - boolean isExist = false; | ||
180 | - if(!courseNameList.contains(teacherClass.getCourseName())){ | ||
181 | - courseNameList.add(teacherClass.getCourseName()); | ||
182 | - } | ||
183 | - for(ClassCourseVO classCourseVO : data){ | ||
184 | - if(classCourseVO.getClassId() == teacherClass.getClassId()){ | ||
185 | - isExist = true ; | ||
186 | - ClassCourseDetailVo classCourseDetailVo = new ClassCourseDetailVo(teacherClass); | ||
187 | - List<ClassCourseDetailVo> classCourseDetailVos = classCourseVO.getList(); | ||
188 | - classCourseDetailVos.add(classCourseDetailVo); | ||
189 | - classCourseVO.setAllCount(classCourseVO.getAllCount()+teacherClass.getTimes()); | ||
190 | - classCourseVO.setList(classCourseDetailVos); | ||
191 | - } | ||
192 | - } | ||
193 | - if(!isExist){ | ||
194 | - ClassCourseVO classCourseVO = new ClassCourseVO(); | ||
195 | - classCourseVO.setClassId(teacherClass.getClassId()); | ||
196 | - classCourseVO.setAllCount(teacherClass.getTimes()); | ||
197 | - classCourseVO.setClassName(classModelService.selectByPrimaryKey(teacherClass.getClassId()).getClassName()); | ||
198 | - List<ClassCourseDetailVo> classCourseDetailVos = new ArrayList<>(); | ||
199 | - classCourseDetailVos.add(new ClassCourseDetailVo(teacherClass)); | ||
200 | - classCourseVO.setList(classCourseDetailVos); | ||
201 | - data.add(classCourseVO); | ||
202 | - } | ||
203 | - } | ||
204 | - teacherCourseRepVo.setData(data); | ||
205 | - teacherCourseRepVo.setCourseNameList(courseNameList); | ||
206 | - return teacherCourseRepVo; | ||
207 | - } | ||
208 | - | ||
209 | - @ApiOperation("获取主课,副科,公共课列表") | ||
210 | - @RequestMapping(value = "getCourseTypeList", method = RequestMethod.POST) | ||
211 | - public GetCourseTypeListRepVo getCourseTypeList(@RequestBody ScheduleIdReqVo scheduleIdReqVo){ | ||
212 | - GetCourseTypeListRepVo getCourseTypeListRepVo = new GetCourseTypeListRepVo(); | ||
213 | - List<CourseTypeListVO> data = new ArrayList<>(); | ||
214 | - Schedule schedule = scheduleService.selectById(scheduleIdReqVo.getScheduleId()); | ||
215 | - if(schedule == null){ | ||
216 | - getCourseTypeListRepVo.setSuccess(false); | ||
217 | - getCourseTypeListRepVo.setMessage("请先创建计划"); | ||
218 | - return getCourseTypeListRepVo; | ||
219 | - } | ||
220 | - for(int i = 1 ; i <=3 ; i++){ | ||
221 | - CourseTypeListVO vo = new CourseTypeListVO(); | ||
222 | - vo.setCourseType(i); | ||
223 | - switch (i){ | ||
224 | - case 1 : | ||
225 | - vo.setCourseTypeName("主课"); | ||
226 | - break; | ||
227 | - case 2: | ||
228 | - vo.setCourseTypeName("副科"); | ||
229 | - break; | ||
230 | - case 3: | ||
231 | - vo.setCourseTypeName("公共课"); | ||
232 | - break; | ||
233 | - } | ||
234 | - Course course = new Course(); | ||
235 | - course.setSchoolId(schedule.getSchoolId()); | ||
236 | - course.setCourseType(i); | ||
237 | - vo.setList(courseService.selectByCourse(course)); | ||
238 | - data.add(vo); | ||
239 | - } | ||
240 | - getCourseTypeListRepVo.setData(data); | ||
241 | - getCourseTypeListRepVo.setScheduleId(schedule.getSchoolId()); | ||
242 | - return getCourseTypeListRepVo; | ||
243 | - } | ||
244 | - | ||
245 | - @ApiOperation("获取未设置学科类型的科目") | ||
246 | - @RequestMapping(value = "getUnCourseList", method = RequestMethod.POST) | ||
247 | - public CourseRepVo getUnCourseList(@RequestBody ScheduleIdReqVo scheduleIdReqVo){ | ||
248 | - CourseRepVo courseRepVo = new CourseRepVo(); | ||
249 | - Schedule schedule = scheduleService.selectById(scheduleIdReqVo.getScheduleId()); | ||
250 | - if(schedule == null){ | ||
251 | - courseRepVo.setSuccess(false); | ||
252 | - courseRepVo.setMessage("请先创建计划"); | ||
253 | - return courseRepVo; | ||
254 | - } | ||
255 | - Course course = new Course(); | ||
256 | - course.setSchoolId(schedule.getSchoolId()); | ||
257 | - course.setCourseType(0); | ||
258 | - courseRepVo.setData(courseService.selectByCourse(course)); | ||
259 | - return courseRepVo; | ||
260 | - } | ||
261 | - | ||
262 | - @ApiOperation("删除设置的 主课 副科 公共课") | ||
263 | - @RequestMapping(value = "deleteCourseType", method = RequestMethod.POST) | ||
264 | - public BaseVo deleteCourseType(@RequestBody CourseClassReqVo courseClassReqVo){ | ||
265 | - BaseVo baseVo = new BaseVo(); | ||
266 | - Schedule schedule = scheduleService.selectById(courseClassReqVo.getScheduleId()); | ||
267 | - if(schedule == null){ | ||
268 | - baseVo.setSuccess(false); | ||
269 | - baseVo.setMessage("请先创建计划"); | ||
270 | - return baseVo; | ||
271 | - } | ||
272 | - if(teacherClassService.selectHasSchedule(schedule.getSchoolId(),schedule.getTeam()) > 0){ | ||
273 | - baseVo.setSuccess(false); | ||
274 | - baseVo.setMessage("已经排课,不能再删除"); | ||
275 | - return baseVo; | ||
276 | - } | ||
277 | - courseService.updateCourseType(courseClassReqVo.getCourseId(),0,schedule.getSchoolId()); | ||
278 | - return baseVo; | ||
279 | - } | ||
280 | - | ||
281 | - @ApiOperation("获取设置的作息 获取排课计划详情") | ||
282 | - @RequestMapping(value = "getSchedule", method = RequestMethod.POST) | ||
283 | - public Schedule getSchedule(@RequestBody ScheduleIdReqVo scheduleIdReqVo){ | ||
284 | - Schedule schedule = scheduleService.selectById(scheduleIdReqVo.getScheduleId()); | ||
285 | - return schedule; | ||
286 | - } | ||
287 | - | ||
288 | - @ApiOperation("导出模板") | ||
289 | - @RequestMapping(value = "export", method = RequestMethod.GET) | ||
290 | - public void export(int scheduleId , HttpServletRequest request, HttpServletResponse response){ | ||
291 | - ExcelUtils excelUtils = new ExcelUtils(); | ||
292 | - List<String> headList = new ArrayList<>(); | ||
293 | - headList.add("年级"); | ||
294 | - headList.add("班级"); | ||
295 | - List<String> heardKey = new ArrayList<>(); | ||
296 | - heardKey.add("grade"); | ||
297 | - heardKey.add("class"); | ||
298 | - List<Map<String , String >> data = new ArrayList<>(); | ||
299 | - Schedule schedule = scheduleService.selectById(scheduleId); | ||
300 | - List<ClassModel> list = classModelService.selectBySchoolId(schedule.getSchoolId()); | ||
301 | - for(ClassModel classModel : list){ | ||
302 | - Map<String ,String> map = new HashMap<>(); | ||
303 | - map.put("grade",classModel.getGrade()); | ||
304 | - map.put("class",classModel.getClassName()); | ||
305 | - data.add(map); | ||
306 | - } | ||
307 | - excelUtils.setHeardList(headList); | ||
308 | - excelUtils.setHeardKey(heardKey); | ||
309 | - excelUtils.setData(data); | ||
310 | - try{ | ||
311 | - excelUtils.exportExport(request,response); | ||
312 | - }catch (Exception e){ | ||
313 | - | ||
314 | - } | ||
315 | - } | ||
316 | -} |
src/main/java/com/jevon/controller/ScheduleController.java
@@ -518,7 +518,7 @@ public class ScheduleController { | @@ -518,7 +518,7 @@ public class ScheduleController { | ||
518 | classCourse.setCourseOpenId(course.getCourseId()); | 518 | classCourse.setCourseOpenId(course.getCourseId()); |
519 | classCourse.setCourseName(teacherClass.getCourseName()); | 519 | classCourse.setCourseName(teacherClass.getCourseName()); |
520 | //判断当天是否已经排该课程 | 520 | //判断当天是否已经排该课程 |
521 | - if(classCourseService.selectCourseByClassIdAndWeek(classCourse) > 0){ | 521 | + if(classCourseService.selectCourseByClassIdAndWeek(classCourse) > 1){ |
522 | break; | 522 | break; |
523 | } | 523 | } |
524 | TeacherCourse searchTeacherCourse = new TeacherCourse(); | 524 | TeacherCourse searchTeacherCourse = new TeacherCourse(); |
@@ -640,7 +640,8 @@ public class ScheduleController { | @@ -640,7 +640,8 @@ public class ScheduleController { | ||
640 | weekChange = weekChange + 5; | 640 | weekChange = weekChange + 5; |
641 | } | 641 | } |
642 | List<ClassCourse> list = classCourseService.selectWeekCourse(classCourse.getClassId(),weekChange,classCourse.getSingleOrDouble(),teacherClass.getCourseName(),teacherClass.getTeam()); | 642 | List<ClassCourse> list = classCourseService.selectWeekCourse(classCourse.getClassId(),weekChange,classCourse.getSingleOrDouble(),teacherClass.getCourseName(),teacherClass.getTeam()); |
643 | - if(list.size() > 0){ | 643 | + //查询当天是否已经有该节课,扩大了 |
644 | + if(list.size() > 1){ | ||
644 | continue; | 645 | continue; |
645 | } | 646 | } |
646 | for(int j = -1 ; j<=1 ; j++){ | 647 | for(int j = -1 ; j<=1 ; j++){ |
src/main/java/com/jevon/controller/ScheduleInitController.java
0 → 100644
@@ -0,0 +1,415 @@ | @@ -0,0 +1,415 @@ | ||
1 | +package com.jevon.controller; | ||
2 | + | ||
3 | +import com.alibaba.fastjson.JSONObject; | ||
4 | +import com.jevon.model.*; | ||
5 | +import com.jevon.service.*; | ||
6 | +import com.jevon.utils.HttpClientUtils; | ||
7 | +import com.jevon.vo.BaseVo; | ||
8 | +import com.jevon.vo.rep.InitRepVo; | ||
9 | +import com.jevon.vo.rep.ScheduleRepVo; | ||
10 | +import com.jevon.vo.req.CreateScheduleReqVo; | ||
11 | +import com.jevon.vo.req.InitTeacherCourseReqVo; | ||
12 | +import com.jevon.vo.req.ScheduleIdReqVo; | ||
13 | +import com.jevon.vo.req.UpdateScheduleReqVo; | ||
14 | +import com.sun.xml.bind.v2.runtime.unmarshaller.IntArrayData; | ||
15 | +import io.swagger.annotations.Api; | ||
16 | +import io.swagger.annotations.ApiOperation; | ||
17 | +import org.apache.commons.lang3.StringUtils; | ||
18 | +import org.apache.poi.hssf.usermodel.HSSFWorkbook; | ||
19 | +import org.apache.poi.ss.usermodel.*; | ||
20 | +import org.apache.poi.xssf.usermodel.XSSFWorkbook; | ||
21 | +import org.springframework.beans.factory.annotation.Autowired; | ||
22 | +import org.springframework.beans.factory.annotation.Value; | ||
23 | +import org.springframework.transaction.annotation.Transactional; | ||
24 | +import org.springframework.web.bind.annotation.RequestBody; | ||
25 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
26 | +import org.springframework.web.bind.annotation.RequestMethod; | ||
27 | +import org.springframework.web.bind.annotation.RestController; | ||
28 | + | ||
29 | +import javax.servlet.http.HttpServletRequest; | ||
30 | +import java.io.File; | ||
31 | +import java.io.FileInputStream; | ||
32 | +import java.util.*; | ||
33 | + | ||
34 | +@RestController | ||
35 | +@RequestMapping(value = "/init") | ||
36 | +@Api(value = "排课表") | ||
37 | +public class ScheduleInitController { | ||
38 | + | ||
39 | + @Autowired | ||
40 | + ClassModelService classModelService; | ||
41 | + | ||
42 | + @Autowired | ||
43 | + TeacherClassService teacherClassService; | ||
44 | + | ||
45 | + @Autowired | ||
46 | + CourseService courseService ; | ||
47 | + | ||
48 | + @Autowired | ||
49 | + TeacherService teacherService; | ||
50 | + | ||
51 | + @Autowired | ||
52 | + ScheduleService scheduleService; | ||
53 | + | ||
54 | + @Autowired | ||
55 | + TeacherCourseService teacherCourseService; | ||
56 | + | ||
57 | + @Autowired | ||
58 | + JoinClassService joinClassService; | ||
59 | + | ||
60 | + @Autowired | ||
61 | + ClassCourseService classCourseService; | ||
62 | + | ||
63 | + @Value("${remoting.url}") | ||
64 | + private String url ; | ||
65 | + @Value("${remoting.prefixFile}") | ||
66 | + private String staticUrl ; | ||
67 | + | ||
68 | + @ApiOperation("创建排课计划 ") | ||
69 | + @RequestMapping(value = "createSchedule", method = RequestMethod.POST) | ||
70 | + public ScheduleRepVo createSchedule(HttpServletRequest request){ | ||
71 | + ScheduleRepVo baseVo = new ScheduleRepVo(); | ||
72 | + Schedule schedule = new Schedule(); | ||
73 | + schedule.setTeam(request.getParameter("team")); | ||
74 | + schedule.setScheduleName(request.getParameter("scheduleName")); | ||
75 | + schedule.setSchoolId(Integer.valueOf(request.getParameter("schoolId"))); | ||
76 | + Schedule temp = scheduleService.selectBySchoolAndTeam(schedule); | ||
77 | + if(temp == null){ | ||
78 | + scheduleService.insert(schedule); | ||
79 | + }else { | ||
80 | + baseVo.setSuccess(false); | ||
81 | + baseVo.setMessage("该学校该学年学期已创建了排课计划"); | ||
82 | + return baseVo; | ||
83 | + } | ||
84 | + temp = scheduleService.selectBySchoolAndTeam(schedule); | ||
85 | + initMessage(schedule.getSchoolId()); | ||
86 | + baseVo.setScheduleId(temp.getId()); | ||
87 | + return baseVo; | ||
88 | + } | ||
89 | + | ||
90 | + @ApiOperation("更新计划") | ||
91 | + @RequestMapping(value = "updateSchedule", method = RequestMethod.POST) | ||
92 | + public BaseVo updateSchedule(@RequestBody UpdateScheduleReqVo updateScheduleReqVo){ | ||
93 | + BaseVo baseVo = new BaseVo(); | ||
94 | + Schedule schedule = scheduleService.selectById(updateScheduleReqVo.getScheduleId()); | ||
95 | + schedule.setScheduleName(updateScheduleReqVo.getScheduleName()); | ||
96 | + schedule.setTeam(updateScheduleReqVo.getTeam()); | ||
97 | + scheduleService.update(schedule); | ||
98 | + return baseVo; | ||
99 | + } | ||
100 | + | ||
101 | + @ApiOperation("复制") | ||
102 | + @RequestMapping(value = "copySchedule", method = RequestMethod.POST) | ||
103 | + public BaseVo copySchedule(@RequestBody UpdateScheduleReqVo updateScheduleReqVo){ | ||
104 | + BaseVo baseVo = new BaseVo(); | ||
105 | + Schedule schedule = scheduleService.selectById(updateScheduleReqVo.getScheduleId()); | ||
106 | + if(schedule == null){ | ||
107 | + baseVo.setMessage("原始课表不存在"); | ||
108 | + baseVo.setSuccess(false); | ||
109 | + return baseVo; | ||
110 | + } | ||
111 | + Schedule temp = new Schedule(); | ||
112 | + temp.setSchoolId(schedule.getSchoolId()); | ||
113 | + temp.setTeam(updateScheduleReqVo.getTeam()); | ||
114 | + Schedule result = scheduleService.selectBySchoolAndTeam(temp); | ||
115 | + if(result != null){ | ||
116 | + baseVo.setMessage("该学年学期已创建课表计划"); | ||
117 | + baseVo.setSuccess(false); | ||
118 | + return baseVo; | ||
119 | + } | ||
120 | + temp.setScheduleName(updateScheduleReqVo.getScheduleName()); | ||
121 | + scheduleService.insert(temp); | ||
122 | + Date date = new Date(); | ||
123 | + //复制 classCourse teacherClass teacherCourse | ||
124 | + List<ClassCourse> classCourses = classCourseService.copyClassCourse(schedule.getSchoolId(),schedule.getTeam()); | ||
125 | + for(ClassCourse classCourse :classCourses){ | ||
126 | + classCourse.setSchoolId(temp.getSchoolId()); | ||
127 | + classCourse.setTeam(temp.getTeam()); | ||
128 | + classCourse.setCreateTime(date); | ||
129 | + } | ||
130 | + classCourseService.insertBatch(classCourses); | ||
131 | + TeacherClass teacherClass = new TeacherClass(); | ||
132 | + teacherClass.setSchoolId(schedule.getSchoolId()); | ||
133 | + teacherClass.setTeam(schedule.getTeam()); | ||
134 | + List<TeacherClass> teacherClasses = teacherClassService.selectBySchoolAndTeam(teacherClass); | ||
135 | + for(TeacherClass teacherClass1 :teacherClasses){ | ||
136 | + teacherClass1.setSchoolId(temp.getSchoolId()); | ||
137 | + teacherClass1.setTeam(temp.getTeam()); | ||
138 | + teacherClass1.setCreateTime(date); | ||
139 | + } | ||
140 | + teacherClassService.insertBatch(teacherClasses); | ||
141 | + | ||
142 | + List<TeacherCourse> teacherCourses = teacherCourseService.selectBySchoolIdAndTeam(schedule.getSchoolId(),schedule.getTeam()); | ||
143 | + for(TeacherCourse teacherCourse : teacherCourses){ | ||
144 | + teacherCourse.setSchoolId(temp.getSchoolId()); | ||
145 | + teacherCourse.setTeam(temp.getTeam()); | ||
146 | + teacherCourse.setCreateTime(date); | ||
147 | + } | ||
148 | + teacherCourseService.insertBatch(teacherCourses); | ||
149 | + return baseVo; | ||
150 | + } | ||
151 | + | ||
152 | + @ApiOperation("删除排课计划") | ||
153 | + @RequestMapping(value = "deleteSchedule", method = RequestMethod.POST) | ||
154 | + public BaseVo deleteSchedule(@RequestBody ScheduleIdReqVo scheduleIdReqVo){ | ||
155 | + BaseVo baseVo = new BaseVo(); | ||
156 | + Schedule schedule = scheduleService.selectById(scheduleIdReqVo.getScheduleId()); | ||
157 | + if(schedule == null){ | ||
158 | + baseVo.setSuccess(false); | ||
159 | + baseVo.setMessage("无排课计划"); | ||
160 | + return baseVo; | ||
161 | + } | ||
162 | + teacherCourseService.deleteBySchoolIdAndTeam(schedule.getSchoolId(),schedule.getTeam()); | ||
163 | + joinClassService.deleteBySchoolIdAndTeam(schedule.getSchoolId(),schedule.getTeam()); | ||
164 | + classCourseService.deleteBySchoolIdAndTeam(schedule.getSchoolId(),schedule.getTeam()); | ||
165 | + TeacherClass teacherClass = new TeacherClass(); | ||
166 | + teacherClass.setSchoolId(schedule.getSchoolId()); | ||
167 | + teacherClass.setTeam(schedule.getTeam()); | ||
168 | + teacherClassService.deleteBySchoolAndTeam(teacherClass); | ||
169 | + courseService.initSchoolId(schedule.getSchoolId()); | ||
170 | + scheduleService.deleteBySchedule(schedule.getId()); | ||
171 | + return baseVo; | ||
172 | + } | ||
173 | + | ||
174 | + @ApiOperation("获取基础信息") | ||
175 | + @RequestMapping(value = "getInitMessage", method = RequestMethod.POST) | ||
176 | + public InitRepVo getInitMessage(@RequestBody ScheduleIdReqVo scheduleIdReqVo){ | ||
177 | + InitRepVo initRepVo = new InitRepVo(); | ||
178 | + Schedule schedule = scheduleService.selectById(scheduleIdReqVo.getScheduleId()); | ||
179 | + if(schedule == null){ | ||
180 | + initRepVo.setSuccess(false); | ||
181 | + initRepVo.setMessage("没有改排课计划"); | ||
182 | + return initRepVo; | ||
183 | + } | ||
184 | + List<Course> courses = courseService.selectBySchoolId2(schedule.getSchoolId()); | ||
185 | + List<Teacher> teachers = teacherService.selectBySchoolId(schedule.getSchoolId()); | ||
186 | + List<ClassModel> classModels = classModelService.selectBySchoolId(schedule.getSchoolId()); | ||
187 | + initRepVo.setClassNumber(classModels.size()); | ||
188 | + initRepVo.setCourseNumber(courses.size()); | ||
189 | + initRepVo.setTeacherNumber(teachers.size()); | ||
190 | + return initRepVo; | ||
191 | + } | ||
192 | + | ||
193 | + @Transactional | ||
194 | + @ApiOperation("教师授课信息") | ||
195 | + @RequestMapping(value = "initTeacherCourse", method = RequestMethod.POST) | ||
196 | + public BaseVo initTeacherCourse(@RequestBody InitTeacherCourseReqVo initTeacherCourseReqVo){ | ||
197 | + BaseVo baseVo = new BaseVo(); | ||
198 | + Date date = new Date(); | ||
199 | + try{ | ||
200 | + TeacherClass temp = new TeacherClass(); | ||
201 | + Schedule schedule = scheduleService.selectById(initTeacherCourseReqVo.getScheduleId()); | ||
202 | + if(schedule != null && schedule.getSpeed() == 2) { | ||
203 | + temp.setSchoolId(schedule.getSchoolId()); | ||
204 | + temp.setTeam(schedule.getTeam()); | ||
205 | + List<TeacherClass> list = teacherClassService.selectBySchoolAndTeam(temp); | ||
206 | + if (list != null && list.size() > 0) { | ||
207 | + teacherClassService.deleteBySchoolAndTeam(temp); | ||
208 | + } | ||
209 | + String fileUrl = initTeacherCourseReqVo.getUrl(); | ||
210 | + fileUrl = fileUrl.replace(url, staticUrl); | ||
211 | + File excelFile = new File(fileUrl); | ||
212 | + // 获得工作簿 | ||
213 | + String file = excelFile.getName(); | ||
214 | + Workbook workbook = null; | ||
215 | + if (file.endsWith("xls")) { | ||
216 | + workbook = new HSSFWorkbook(new FileInputStream(excelFile)); | ||
217 | + } else { | ||
218 | + workbook = new XSSFWorkbook(new FileInputStream(excelFile)); | ||
219 | + } | ||
220 | + // 获得工作表 | ||
221 | + Sheet sheet = workbook.getSheetAt(0); | ||
222 | + int rows = sheet.getPhysicalNumberOfRows(); | ||
223 | + Map<Integer, Course> courseTeacherMap = new HashMap<>(); | ||
224 | + int courseNumber = 0; | ||
225 | + List<TeacherClass> teacherClasses = new ArrayList<>(); | ||
226 | + for (int i = 0; i < rows; i++) { | ||
227 | + // 获取第i行数据 | ||
228 | + Row sheetRow = sheet.getRow(i); | ||
229 | + if (i == 0) { | ||
230 | + //获取表头 | ||
231 | + int j = 1; | ||
232 | + while (sheetRow.getCell(2 * j) != null && StringUtils.isNotBlank(sheetRow.getCell(2 * j).getStringCellValue().trim())) { | ||
233 | + Course course = courseService.selectBySchoolIdAndCourseName(schedule.getSchoolId(), sheetRow.getCell(2 * j).getStringCellValue().trim()); | ||
234 | + courseTeacherMap.put(j, course); | ||
235 | + j++; | ||
236 | + } | ||
237 | + courseNumber = j - 1; | ||
238 | + } else { | ||
239 | + if (StringUtils.isBlank(sheetRow.getCell(0).getStringCellValue().trim())) { | ||
240 | + continue; | ||
241 | + } | ||
242 | + String className = sheetRow.getCell(1).getStringCellValue().trim(); | ||
243 | + ClassModel classModel = new ClassModel(); | ||
244 | + classModel.setSchoolId(schedule.getSchoolId()); | ||
245 | + classModel.setClassName(className); | ||
246 | + classModel.setGrade(sheetRow.getCell(0).getStringCellValue().trim()); | ||
247 | + ClassModel resultClass = classModelService.selectBySchoolIdAndClassNameAndGrade(classModel); | ||
248 | + for (int j = 1; j <= courseNumber; j++) { | ||
249 | + Cell cell = sheetRow.getCell(2 * j); | ||
250 | + if (cell != null) { | ||
251 | + cell.setCellType(CellType.STRING); | ||
252 | + String times = sheetRow.getCell(2 * j).getStringCellValue().trim(); | ||
253 | + if (StringUtils.isNotBlank((times))) { | ||
254 | + Course course = courseTeacherMap.get(j); | ||
255 | + String teacherName = sheetRow.getCell(2 * j + 1).getStringCellValue().trim(); | ||
256 | + Teacher teacher = new Teacher(); | ||
257 | + teacher.setTeacherName(teacherName); | ||
258 | + teacher.setSchoolId(schedule.getSchoolId()); | ||
259 | + Teacher resultTeacher = teacherService.selectByTeacher(teacher); | ||
260 | + if (course != null && resultTeacher != null) { | ||
261 | + TeacherClass teacherClass = new TeacherClass(); | ||
262 | + teacherClass.setTeam(schedule.getTeam()); | ||
263 | + teacherClass.setSchoolId(schedule.getSchoolId()); | ||
264 | + teacherClass.setCourseName(course.getCourseName()); | ||
265 | + teacherClass.setTeacherName(resultTeacher.getTeacherName()); | ||
266 | + teacherClass.setTeacherId(resultTeacher.getTeacherId()); | ||
267 | + teacherClass.setGrade(sheetRow.getCell(0).getStringCellValue().trim()); | ||
268 | + teacherClass.setClassId(resultClass.getClassId()); | ||
269 | + String[] msg = times.split("\\+"); | ||
270 | + if (msg.length > 1) { | ||
271 | + //有联课 | ||
272 | + teacherClass.setJoinTimes(Integer.valueOf(msg[1])); | ||
273 | + teacherClass.setTimes(Integer.valueOf(msg[1]) * 2 + Integer.valueOf(msg[0])); | ||
274 | + } else { | ||
275 | + teacherClass.setJoinTimes(0); | ||
276 | + teacherClass.setTimes(Integer.valueOf(msg[0])); | ||
277 | + } | ||
278 | + teacherClass.setStatus(0); | ||
279 | + teacherClass.setCreateTime(date); | ||
280 | + teacherClasses.add(teacherClass); | ||
281 | + } else { | ||
282 | + baseVo.setMessage("课程或老师缺失"); | ||
283 | + baseVo.setSuccess(false); | ||
284 | + return baseVo; | ||
285 | + } | ||
286 | + } | ||
287 | + | ||
288 | + } | ||
289 | + } | ||
290 | + } | ||
291 | + } | ||
292 | + teacherClassService.insertBatch(teacherClasses); | ||
293 | + schedule.setSpeed(3); | ||
294 | + scheduleService.updateSpeed(schedule); | ||
295 | + }else { | ||
296 | + baseVo.setMessage("排课计划不存在或已导入"); | ||
297 | + baseVo.setSuccess(false); | ||
298 | + } | ||
299 | + }catch (Exception e){ | ||
300 | + System.out.println(e); | ||
301 | + baseVo.setSuccess(false); | ||
302 | + } | ||
303 | + return baseVo; | ||
304 | + } | ||
305 | + | ||
306 | + private void initMessage(int schoolId){ | ||
307 | + JSONObject teacherList = HttpClientUtils.httpGet(url+"/api/EasyN/GetSchoolTeacher?SchoolId="+schoolId); | ||
308 | + List<JSONObject> openTeacherList = (List<JSONObject>)teacherList.get("data"); | ||
309 | + List<Teacher> teachers = new ArrayList<>(); | ||
310 | + for(JSONObject json :openTeacherList){ | ||
311 | + Teacher teacher = new Teacher(); | ||
312 | + teacher.setSchoolId(Integer.valueOf(json.get("school_id").toString())); | ||
313 | + teacher.setTeacherId(Integer.valueOf(json.get("teacher_id").toString())); | ||
314 | + teacher.setTeacherName(json.get("name").toString()); | ||
315 | + teachers.add(teacher); | ||
316 | + } | ||
317 | + initTeacher(teachers); | ||
318 | + JSONObject classList = HttpClientUtils.httpGet(url+"/api/EasyN/GetSchoolClass?SchoolId="+schoolId); | ||
319 | + List<JSONObject> openClasses = (List<JSONObject>)classList.get("data"); | ||
320 | + List<ClassModel> classModels = new ArrayList<>(); | ||
321 | + for(JSONObject json :openClasses){ | ||
322 | + ClassModel classModel = new ClassModel(); | ||
323 | + classModel.setSchoolId(Integer.valueOf(json.get("school_id").toString())); | ||
324 | + classModel.setClassId(Integer.valueOf(json.get("class_id").toString())); | ||
325 | + classModel.setGrade(json.get("gardeName").toString()); | ||
326 | + classModel.setClassName(json.get("class_name").toString()); | ||
327 | + classModels.add(classModel); | ||
328 | + } | ||
329 | + initClass(classModels); | ||
330 | + JSONObject courseList = HttpClientUtils.httpGet(url+"/api/EasyN/GetSchoolSubject?SchoolId="+schoolId); | ||
331 | + List<JSONObject> openCourses = (List<JSONObject>)courseList.get("data"); | ||
332 | + List<Course> courses = new ArrayList<>(); | ||
333 | + for(JSONObject json :openCourses){ | ||
334 | + Course course = new Course(); | ||
335 | + course.setSchoolId(Integer.valueOf(json.get("school_id").toString())); | ||
336 | + course.setCourseId(Integer.valueOf(json.get("subject_id").toString())); | ||
337 | + course.setCourseName(json.get("subject_name").toString()); | ||
338 | + course.setCourseType(0); | ||
339 | + courses.add(course); | ||
340 | + } | ||
341 | + initCourse(courses); | ||
342 | + } | ||
343 | + | ||
344 | + public BaseVo initCourse(List<Course> courseList){ | ||
345 | + BaseVo baseVo = new BaseVo(); | ||
346 | + courseService.deleteSchoolId(courseList.get(0).getSchoolId()); | ||
347 | + for(Course course : courseList){ | ||
348 | + if(course.getCourseId() == 0 || StringUtils.isBlank(course.getCourseName())){ | ||
349 | + baseVo.setSuccess(false); | ||
350 | + baseVo.setMessage("缺少参数"); | ||
351 | + break; | ||
352 | + } | ||
353 | + } | ||
354 | + if(baseVo.isSuccess()){ | ||
355 | + courseService.insertBatch(courseList); | ||
356 | + baseVo.setSuccess(true); | ||
357 | + return baseVo; | ||
358 | + }else { | ||
359 | + return baseVo; | ||
360 | + } | ||
361 | + } | ||
362 | + | ||
363 | + public BaseVo initClass(List<ClassModel> classList){ | ||
364 | + BaseVo baseVo = new BaseVo(); | ||
365 | + classModelService.deleteSchool(classList.get(0).getSchoolId()); | ||
366 | + for(ClassModel classModel : classList){ | ||
367 | + if(classModel.getClassId() == 0 || StringUtils.isBlank(classModel.getClassName()) || | ||
368 | + StringUtils.isBlank(classModel.getGrade()) || classModel.getSchoolId() == 0){ | ||
369 | + baseVo.setSuccess(false); | ||
370 | + baseVo.setMessage("缺少参数"); | ||
371 | + break; | ||
372 | + } | ||
373 | + } | ||
374 | + if(baseVo.isSuccess()){ | ||
375 | + classModelService.insertBatch(classList); | ||
376 | + baseVo.setSuccess(true); | ||
377 | + return baseVo; | ||
378 | + }else { | ||
379 | + return baseVo; | ||
380 | + } | ||
381 | + } | ||
382 | + | ||
383 | + public BaseVo initTeacher(List<Teacher> teacherList){ | ||
384 | + List<Teacher> result = new ArrayList<>(); | ||
385 | + for(Teacher teacher : teacherList){ | ||
386 | + boolean isExist = false; | ||
387 | + for(Teacher t : result){ | ||
388 | + if(t.getTeacherName().equals(teacher.getTeacherName())){ | ||
389 | + isExist = true; | ||
390 | + } | ||
391 | + } | ||
392 | + if(!isExist && StringUtils.isNotBlank(teacher.getTeacherName())){ | ||
393 | + result.add(teacher); | ||
394 | + } | ||
395 | + } | ||
396 | + BaseVo baseVo = new BaseVo(); | ||
397 | + teacherService.deleteSchool(result.get(0).getSchoolId()); | ||
398 | + for(Teacher teacher : result){ | ||
399 | + if(teacher.getSchoolId() == 0 || StringUtils.isBlank(teacher.getTeacherName()) || | ||
400 | + teacher.getTeacherId() == 0){ | ||
401 | + baseVo.setSuccess(false); | ||
402 | + baseVo.setMessage("缺少参数"); | ||
403 | + break; | ||
404 | + } | ||
405 | + } | ||
406 | + if(baseVo.isSuccess()){ | ||
407 | + teacherService.insertBatch(result); | ||
408 | + baseVo.setSuccess(true); | ||
409 | + return baseVo; | ||
410 | + }else { | ||
411 | + return baseVo; | ||
412 | + } | ||
413 | + } | ||
414 | + | ||
415 | +} |
src/main/java/com/jevon/controller/ScheduleMessageController.java
0 → 100644
@@ -0,0 +1,322 @@ | @@ -0,0 +1,322 @@ | ||
1 | +package com.jevon.controller; | ||
2 | + | ||
3 | +import com.jevon.model.*; | ||
4 | +import com.jevon.service.*; | ||
5 | +import com.jevon.utils.ExcelUtils; | ||
6 | +import com.jevon.vo.BaseVo; | ||
7 | +import com.jevon.vo.rep.*; | ||
8 | +import com.jevon.vo.req.CourseClassReqVo; | ||
9 | +import com.jevon.vo.req.GetClassCourseReqVo; | ||
10 | +import com.jevon.vo.req.ScheduleIdReqVo; | ||
11 | +import com.jevon.vo.req.SchoolIdReqVo; | ||
12 | +import io.swagger.annotations.Api; | ||
13 | +import io.swagger.annotations.ApiOperation; | ||
14 | +import org.springframework.beans.factory.annotation.Autowired; | ||
15 | +import org.springframework.web.bind.annotation.RequestBody; | ||
16 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
17 | +import org.springframework.web.bind.annotation.RequestMethod; | ||
18 | +import org.springframework.web.bind.annotation.RestController; | ||
19 | + | ||
20 | +import javax.servlet.http.HttpServletRequest; | ||
21 | +import javax.servlet.http.HttpServletResponse; | ||
22 | +import java.util.ArrayList; | ||
23 | +import java.util.HashMap; | ||
24 | +import java.util.List; | ||
25 | +import java.util.Map; | ||
26 | + | ||
27 | +/** | ||
28 | + * @author chen | ||
29 | + * @version 1.0 | ||
30 | + * @date 2019/10/11 0011 14:00 | ||
31 | + */ | ||
32 | +@RestController | ||
33 | +@Api(value = "获取信息") | ||
34 | +public class ScheduleMessageController { | ||
35 | + | ||
36 | + @Autowired | ||
37 | + ScheduleService scheduleService; | ||
38 | + | ||
39 | + @Autowired | ||
40 | + CourseService courseService; | ||
41 | + | ||
42 | + @Autowired | ||
43 | + ClassCourseService classCourseService; | ||
44 | + | ||
45 | + @Autowired | ||
46 | + ClassModelService classModelService; | ||
47 | + | ||
48 | + @Autowired | ||
49 | + JoinClassService joinClassService; | ||
50 | + | ||
51 | + @Autowired | ||
52 | + TeacherClassService teacherClassService; | ||
53 | + | ||
54 | + @ApiOperation("获取学校排课计划") | ||
55 | + @RequestMapping(value = "getScheduleList", method = RequestMethod.POST) | ||
56 | + public ScheduleListRepVo getScheduleList(@RequestBody SchoolIdReqVo schoolIdReqVo){ | ||
57 | + ScheduleListRepVo scheduleListRepVo = new ScheduleListRepVo(); | ||
58 | + scheduleListRepVo.setData(scheduleService.selectBySchool(schoolIdReqVo.getSchoolId())); | ||
59 | + return scheduleListRepVo; | ||
60 | + } | ||
61 | + | ||
62 | + @ApiOperation("获取学校下所有班级信息") | ||
63 | + @RequestMapping(value = "getClassList", method = RequestMethod.POST) | ||
64 | + public ClassRepVo getClassList(@RequestBody SchoolIdReqVo schoolIdReqVo){ | ||
65 | + ClassRepVo classRepVo = new ClassRepVo(); | ||
66 | + classRepVo.setData(classModelService.selectBySchoolId(schoolIdReqVo.getSchoolId())); | ||
67 | + return classRepVo; | ||
68 | + } | ||
69 | + | ||
70 | + @ApiOperation("获取学校课程") | ||
71 | + @RequestMapping(value = "getCourseList", method = RequestMethod.POST) | ||
72 | + public CourseRepVo getCourseList(@RequestBody ScheduleIdReqVo scheduleIdReqVo){ | ||
73 | + CourseRepVo courseRepVo = new CourseRepVo(); | ||
74 | + Schedule schedule = scheduleService.selectById(scheduleIdReqVo.getScheduleId()); | ||
75 | + if(schedule == null){ | ||
76 | + courseRepVo.setSuccess(false); | ||
77 | + courseRepVo.setMessage("请先创建计划"); | ||
78 | + return courseRepVo; | ||
79 | + } | ||
80 | + courseRepVo.setData(courseService.selectBySchoolId(schedule.getSchoolId())); | ||
81 | + return courseRepVo; | ||
82 | + } | ||
83 | + | ||
84 | + @ApiOperation("获取要学习某个学科的班级集合") | ||
85 | + @RequestMapping(value = "getCourseClassList", method = RequestMethod.POST) | ||
86 | + public List<GetCourseClassListRepVo> getCourseClassList(@RequestBody CourseClassReqVo courseClassReqVo){ | ||
87 | + List<GetCourseClassListRepVo> repVos = new ArrayList<>(); | ||
88 | + Schedule schedule = scheduleService.selectById(courseClassReqVo.getScheduleId()); | ||
89 | + if(schedule == null){ | ||
90 | + return null; | ||
91 | + } | ||
92 | + TeacherClass search = new TeacherClass(); | ||
93 | + search.setSchoolId(schedule.getSchoolId()); | ||
94 | + search.setTeam(schedule.getTeam()); | ||
95 | + String courseName =courseService.selectBySchoolIdAndCourseId(schedule.getSchoolId(),courseClassReqVo.getCourseId()).getCourseName(); | ||
96 | + search.setCourseName(courseName); | ||
97 | + List<TeacherClass> list = teacherClassService.selectByCourseName(search); | ||
98 | + for(TeacherClass teacherClass : list){ | ||
99 | + GetCourseClassListRepVo repVo = new GetCourseClassListRepVo(); | ||
100 | + repVo.setClassId(teacherClass.getClassId()); | ||
101 | + repVo.setClassName(classModelService.selectByPrimaryKey(teacherClass.getClassId()).getClassName()); | ||
102 | + repVo.setCourseId(courseClassReqVo.getCourseId()); | ||
103 | + repVo.setCourseName(courseName); | ||
104 | + repVo.setTeacherName(teacherClass.getTeacherName()); | ||
105 | + repVos.add(repVo); | ||
106 | + } | ||
107 | + return repVos; | ||
108 | + } | ||
109 | + | ||
110 | + @ApiOperation("获取班级排课课程") | ||
111 | + @RequestMapping(value = "getClassCourseList", method = RequestMethod.POST) | ||
112 | + public ClassCourseRepVo getClassCourseList(@RequestBody GetClassCourseReqVo getClassCourseReqVo){ | ||
113 | + ClassCourseRepVo classCourseRepVo = new ClassCourseRepVo(); | ||
114 | + Schedule schedule = scheduleService.selectById(getClassCourseReqVo.getScheduleId()); | ||
115 | + if(schedule == null){ | ||
116 | + classCourseRepVo.setSuccess(false); | ||
117 | + classCourseRepVo.setMessage("请先创建计划"); | ||
118 | + return classCourseRepVo; | ||
119 | + } | ||
120 | + ClassCourse search = new ClassCourse(); | ||
121 | + search.setClassId(getClassCourseReqVo.getClassId()); | ||
122 | + search.setSingleOrDouble(1); | ||
123 | + search.setTeam(schedule.getTeam()); | ||
124 | + classCourseRepVo.setData(classCourseService.selectByClassIdAndSingleOrDouble(search)); | ||
125 | + return classCourseRepVo; | ||
126 | + } | ||
127 | + | ||
128 | + @ApiOperation("获取合班信息") | ||
129 | + @RequestMapping(value = "getJoinList", method = RequestMethod.POST) | ||
130 | + public JoinRepVo getJoinList(@RequestBody ScheduleIdReqVo scheduleIdReqVo){ | ||
131 | + JoinRepVo joinRepVo = new JoinRepVo(); | ||
132 | + Schedule schedule = scheduleService.selectById(scheduleIdReqVo.getScheduleId()); | ||
133 | + JoinClass joinClass = new JoinClass(); | ||
134 | + joinClass.setSchoolId(schedule.getSchoolId()); | ||
135 | + joinClass.setTeam(schedule.getTeam()); | ||
136 | + List<JoinClass> list = joinClassService.selectByCourse(joinClass); | ||
137 | + List<JoinDetail> joinDetails = new ArrayList<>(); | ||
138 | + for(JoinClass temp : list){ | ||
139 | + boolean flag = false ; | ||
140 | + ClassModel classModel = classModelService.selectByPrimaryKey(temp.getClassId()); | ||
141 | + for(JoinDetail joinDetail : joinDetails){ | ||
142 | + if(temp.getCourseGroup() == joinDetail.getCourseGroup()){ | ||
143 | + flag = true; | ||
144 | + if(!joinDetail.getClassName().contains(classModel.getClassName())){ | ||
145 | + joinDetail.setClassName(joinDetail.getClassName()+","+classModel.getClassName()); | ||
146 | + } | ||
147 | + } | ||
148 | + } | ||
149 | + if(!flag){ | ||
150 | + JoinDetail joinDetail = new JoinDetail(); | ||
151 | + joinDetail.setCourseGroup(temp.getCourseGroup()); | ||
152 | + joinDetail.setClassName(classModel.getClassName()); | ||
153 | + joinDetail.setCourseName(temp.getCourseName()); | ||
154 | + TeacherClass search = new TeacherClass(); | ||
155 | + search.setSchoolId(schedule.getSchoolId()); | ||
156 | + search.setTeam(schedule.getTeam()); | ||
157 | + search.setClassId(temp.getClassId()); | ||
158 | + search.setCourseName(temp.getCourseName()); | ||
159 | + joinDetail.setTeacherName(teacherClassService.selectByCourseAndClass(search).getTeacherName()); | ||
160 | + joinDetails.add(joinDetail); | ||
161 | + } | ||
162 | + } | ||
163 | + joinRepVo.setData(joinDetails); | ||
164 | + return joinRepVo; | ||
165 | + } | ||
166 | + | ||
167 | + @ApiOperation("获取导入任课信息") | ||
168 | + @RequestMapping(value = "getTeacherClassList", method = RequestMethod.POST) | ||
169 | + public TeacherCourseRepVo getTeacherClassList(@RequestBody ScheduleIdReqVo scheduleIdReqVo){ | ||
170 | + TeacherCourseRepVo teacherCourseRepVo = new TeacherCourseRepVo(); | ||
171 | + Schedule schedule = scheduleService.selectById(scheduleIdReqVo.getScheduleId()); | ||
172 | + TeacherClass temp = new TeacherClass(); | ||
173 | + temp.setSchoolId(schedule.getSchoolId()); | ||
174 | + temp.setTeam(schedule.getTeam()); | ||
175 | + List<ClassCourseVO> data = new ArrayList<>(); | ||
176 | + List<String> courseNameList = new ArrayList<>(); | ||
177 | + List<TeacherClass> teacherClasses = teacherClassService.selectBySchoolAndTeam(temp); | ||
178 | + for(TeacherClass teacherClass :teacherClasses){ | ||
179 | + boolean isExist = false; | ||
180 | + if(!courseNameList.contains(teacherClass.getCourseName())){ | ||
181 | + courseNameList.add(teacherClass.getCourseName()); | ||
182 | + } | ||
183 | + for(ClassCourseVO classCourseVO : data){ | ||
184 | + if(classCourseVO.getClassId() == teacherClass.getClassId()){ | ||
185 | + isExist = true ; | ||
186 | + ClassCourseDetailVo classCourseDetailVo = new ClassCourseDetailVo(teacherClass); | ||
187 | + List<ClassCourseDetailVo> classCourseDetailVos = classCourseVO.getList(); | ||
188 | + classCourseDetailVos.add(classCourseDetailVo); | ||
189 | + classCourseVO.setAllCount(classCourseVO.getAllCount()+teacherClass.getTimes()); | ||
190 | + classCourseVO.setList(classCourseDetailVos); | ||
191 | + } | ||
192 | + } | ||
193 | + if(!isExist){ | ||
194 | + ClassCourseVO classCourseVO = new ClassCourseVO(); | ||
195 | + classCourseVO.setClassId(teacherClass.getClassId()); | ||
196 | + classCourseVO.setAllCount(teacherClass.getTimes()); | ||
197 | + classCourseVO.setClassName(classModelService.selectByPrimaryKey(teacherClass.getClassId()).getClassName()); | ||
198 | + List<ClassCourseDetailVo> classCourseDetailVos = new ArrayList<>(); | ||
199 | + classCourseDetailVos.add(new ClassCourseDetailVo(teacherClass)); | ||
200 | + classCourseVO.setList(classCourseDetailVos); | ||
201 | + data.add(classCourseVO); | ||
202 | + } | ||
203 | + } | ||
204 | + teacherCourseRepVo.setData(data); | ||
205 | + teacherCourseRepVo.setCourseNameList(courseNameList); | ||
206 | + return teacherCourseRepVo; | ||
207 | + } | ||
208 | + | ||
209 | + @ApiOperation("获取主课,副科,公共课列表") | ||
210 | + @RequestMapping(value = "getCourseTypeList", method = RequestMethod.POST) | ||
211 | + public GetCourseTypeListRepVo getCourseTypeList(@RequestBody ScheduleIdReqVo scheduleIdReqVo){ | ||
212 | + GetCourseTypeListRepVo getCourseTypeListRepVo = new GetCourseTypeListRepVo(); | ||
213 | + List<CourseTypeListVO> data = new ArrayList<>(); | ||
214 | + Schedule schedule = scheduleService.selectById(scheduleIdReqVo.getScheduleId()); | ||
215 | + if(schedule == null){ | ||
216 | + getCourseTypeListRepVo.setSuccess(false); | ||
217 | + getCourseTypeListRepVo.setMessage("请先创建计划"); | ||
218 | + return getCourseTypeListRepVo; | ||
219 | + } | ||
220 | + for(int i = 1 ; i <=3 ; i++){ | ||
221 | + CourseTypeListVO vo = new CourseTypeListVO(); | ||
222 | + vo.setCourseType(i); | ||
223 | + switch (i){ | ||
224 | + case 1 : | ||
225 | + vo.setCourseTypeName("主课"); | ||
226 | + break; | ||
227 | + case 2: | ||
228 | + vo.setCourseTypeName("副科"); | ||
229 | + break; | ||
230 | + case 3: | ||
231 | + vo.setCourseTypeName("公共课"); | ||
232 | + break; | ||
233 | + } | ||
234 | + Course course = new Course(); | ||
235 | + course.setSchoolId(schedule.getSchoolId()); | ||
236 | + course.setCourseType(i); | ||
237 | + vo.setList(courseService.selectByCourse(course)); | ||
238 | + data.add(vo); | ||
239 | + } | ||
240 | + getCourseTypeListRepVo.setData(data); | ||
241 | + getCourseTypeListRepVo.setScheduleId(schedule.getSchoolId()); | ||
242 | + return getCourseTypeListRepVo; | ||
243 | + } | ||
244 | + | ||
245 | + @ApiOperation("获取未设置学科类型的科目") | ||
246 | + @RequestMapping(value = "getUnCourseList", method = RequestMethod.POST) | ||
247 | + public CourseRepVo getUnCourseList(@RequestBody ScheduleIdReqVo scheduleIdReqVo){ | ||
248 | + CourseRepVo courseRepVo = new CourseRepVo(); | ||
249 | + Schedule schedule = scheduleService.selectById(scheduleIdReqVo.getScheduleId()); | ||
250 | + if(schedule == null){ | ||
251 | + courseRepVo.setSuccess(false); | ||
252 | + courseRepVo.setMessage("请先创建计划"); | ||
253 | + return courseRepVo; | ||
254 | + } | ||
255 | + Course course = new Course(); | ||
256 | + course.setSchoolId(schedule.getSchoolId()); | ||
257 | + course.setCourseType(0); | ||
258 | + courseRepVo.setData(courseService.selectByCourse(course)); | ||
259 | + return courseRepVo; | ||
260 | + } | ||
261 | + | ||
262 | + @ApiOperation("删除设置的 主课 副科 公共课") | ||
263 | + @RequestMapping(value = "deleteCourseType", method = RequestMethod.POST) | ||
264 | + public BaseVo deleteCourseType(@RequestBody CourseClassReqVo courseClassReqVo){ | ||
265 | + BaseVo baseVo = new BaseVo(); | ||
266 | + Schedule schedule = scheduleService.selectById(courseClassReqVo.getScheduleId()); | ||
267 | + if(schedule == null){ | ||
268 | + baseVo.setSuccess(false); | ||
269 | + baseVo.setMessage("请先创建计划"); | ||
270 | + return baseVo; | ||
271 | + } | ||
272 | + if(teacherClassService.selectHasSchedule(schedule.getSchoolId(),schedule.getTeam()) > 0){ | ||
273 | + baseVo.setSuccess(false); | ||
274 | + baseVo.setMessage("已经排课,不能再删除"); | ||
275 | + return baseVo; | ||
276 | + } | ||
277 | + courseService.updateCourseType(courseClassReqVo.getCourseId(),0,schedule.getSchoolId()); | ||
278 | + return baseVo; | ||
279 | + } | ||
280 | + | ||
281 | + @ApiOperation("获取设置的作息 获取排课计划详情") | ||
282 | + @RequestMapping(value = "getSchedule", method = RequestMethod.POST) | ||
283 | + public Schedule getSchedule(@RequestBody ScheduleIdReqVo scheduleIdReqVo){ | ||
284 | + Schedule schedule = scheduleService.selectById(scheduleIdReqVo.getScheduleId()); | ||
285 | + return schedule; | ||
286 | + } | ||
287 | + | ||
288 | + @ApiOperation("导出模板") | ||
289 | + @RequestMapping(value = "export", method = RequestMethod.GET) | ||
290 | + public void export(int scheduleId , HttpServletRequest request, HttpServletResponse response){ | ||
291 | + ExcelUtils excelUtils = new ExcelUtils(); | ||
292 | + Schedule schedule = scheduleService.selectById(scheduleId); | ||
293 | + List<String> headList = new ArrayList<>(); | ||
294 | + headList.add("年级"); | ||
295 | + headList.add("班级"); | ||
296 | + List<Course> courses = courseService.selectBySchoolId2(schedule.getSchoolId()); | ||
297 | + for(Course course : courses){ | ||
298 | + headList.add(course.getCourseName()); | ||
299 | + headList.add("任课老师"); | ||
300 | + | ||
301 | + } | ||
302 | + List<String> heardKey = new ArrayList<>(); | ||
303 | + heardKey.add("grade"); | ||
304 | + heardKey.add("class"); | ||
305 | + List<Map<String , String >> data = new ArrayList<>(); | ||
306 | + List<ClassModel> list = classModelService.selectBySchoolId(schedule.getSchoolId()); | ||
307 | + for(ClassModel classModel : list){ | ||
308 | + Map<String ,String> map = new HashMap<>(); | ||
309 | + map.put("grade",classModel.getGrade()); | ||
310 | + map.put("class",classModel.getClassName()); | ||
311 | + data.add(map); | ||
312 | + } | ||
313 | + excelUtils.setHeardList(headList); | ||
314 | + excelUtils.setHeardKey(heardKey); | ||
315 | + excelUtils.setData(data); | ||
316 | + try{ | ||
317 | + excelUtils.exportExport(request,response); | ||
318 | + }catch (Exception e){ | ||
319 | + | ||
320 | + } | ||
321 | + } | ||
322 | +} |
src/main/java/com/jevon/mapper/CourseMapper.java
@@ -15,6 +15,8 @@ public interface CourseMapper { | @@ -15,6 +15,8 @@ public interface CourseMapper { | ||
15 | 15 | ||
16 | List<Course> selectBySchoolId(int schoolId); | 16 | List<Course> selectBySchoolId(int schoolId); |
17 | 17 | ||
18 | + List<Course> selectBySchoolId2(int schoolId); | ||
19 | + | ||
18 | List<Course> selectByCourse(Course course); | 20 | List<Course> selectByCourse(Course course); |
19 | 21 | ||
20 | int updateCourseType(Course course); | 22 | int updateCourseType(Course course); |
src/main/java/com/jevon/service/CourseService.java
@@ -15,6 +15,8 @@ public interface CourseService { | @@ -15,6 +15,8 @@ public interface CourseService { | ||
15 | 15 | ||
16 | List<Course> selectBySchoolId(int schoolId); | 16 | List<Course> selectBySchoolId(int schoolId); |
17 | 17 | ||
18 | + List<Course> selectBySchoolId2(int schoolId); | ||
19 | + | ||
18 | List<Course> selectByCourse(Course course); | 20 | List<Course> selectByCourse(Course course); |
19 | 21 | ||
20 | Course selectBySchoolIdAndCourseId(int schoolId , int courseId); | 22 | Course selectBySchoolIdAndCourseId(int schoolId , int courseId); |
src/main/java/com/jevon/service/impl/CourseServiceImpl.java
@@ -30,6 +30,11 @@ public class CourseServiceImpl implements CourseService { | @@ -30,6 +30,11 @@ public class CourseServiceImpl implements CourseService { | ||
30 | } | 30 | } |
31 | 31 | ||
32 | @Override | 32 | @Override |
33 | + public List<Course> selectBySchoolId2(int schoolId) { | ||
34 | + return courseMapper.selectBySchoolId2(schoolId); | ||
35 | + } | ||
36 | + | ||
37 | + @Override | ||
33 | public List<Course> selectByCourse(Course course) { | 38 | public List<Course> selectByCourse(Course course) { |
34 | return courseMapper.selectByCourse(course); | 39 | return courseMapper.selectByCourse(course); |
35 | } | 40 | } |
@@ -0,0 +1,28 @@ | @@ -0,0 +1,28 @@ | ||
1 | +package com.jevon.vo.req; | ||
2 | + | ||
3 | +/** | ||
4 | + * @author chen | ||
5 | + * @version 1.0 | ||
6 | + * @date 2019/10/17 0017 13:36 | ||
7 | + */ | ||
8 | +public class InitAnalyseReqVo { | ||
9 | + | ||
10 | + private int analyseId ; | ||
11 | + private String url ; | ||
12 | + | ||
13 | + public int getAnalyseId() { | ||
14 | + return analyseId; | ||
15 | + } | ||
16 | + | ||
17 | + public void setAnalyseId(int analyseId) { | ||
18 | + this.analyseId = analyseId; | ||
19 | + } | ||
20 | + | ||
21 | + public String getUrl() { | ||
22 | + return url; | ||
23 | + } | ||
24 | + | ||
25 | + public void setUrl(String url) { | ||
26 | + this.url = url; | ||
27 | + } | ||
28 | +} |
src/main/resources/application.yml
@@ -2,26 +2,13 @@ server: | @@ -2,26 +2,13 @@ server: | ||
2 | port: 8008 | 2 | port: 8008 |
3 | 3 | ||
4 | spring: | 4 | spring: |
5 | - freemarker: | ||
6 | - template-loader-path: classpath:/templates/ | ||
7 | - prefix: | ||
8 | - suffix: .html | ||
9 | - ##是否允许使用request | ||
10 | - allow-request-override: true | ||
11 | - request-context-attribute: request | ||
12 | - | ||
13 | - cache: false | ||
14 | - check-template-location: true | ||
15 | - charset: UTF-8 | ||
16 | - content-type: text/html;charset=UTF-8 | ||
17 | - expose-request-attributes: false | ||
18 | - expose-session-attributes: false | ||
19 | - expose-spring-macro-helpers: false | ||
20 | - | ||
21 | datasource: | 5 | datasource: |
22 | username: SZJXTUSER | 6 | username: SZJXTUSER |
23 | password: xst200919 | 7 | password: xst200919 |
24 | url: jdbc:sqlserver://60.190.202.57:14333;database=SmartPaike | 8 | url: jdbc:sqlserver://60.190.202.57:14333;database=SmartPaike |
9 | +# username: szjxtuser | ||
10 | +# password: RQminVCJota3H1u8bBYH | ||
11 | +# url: jdbc:sqlserver://116.62.155.137:33419;database=SmartCampus_java | ||
25 | driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver | 12 | driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver |
26 | filters: stat | 13 | filters: stat |
27 | maxActive: 20 | 14 | maxActive: 20 |
@@ -52,3 +39,9 @@ pagehelper: | @@ -52,3 +39,9 @@ pagehelper: | ||
52 | Logger: | 39 | Logger: |
53 | level: | 40 | level: |
54 | com.jevon.mapper: info | 41 | com.jevon.mapper: info |
42 | + | ||
43 | +remoting: | ||
44 | + url: http://60.190.202.57:1000 | ||
45 | + prefixFile: F://wwwroot//smartcampus | ||
46 | +# url: http://campus.myjxt.com | ||
47 | +# prefixFile: E://wwwhtdocs//SmartCampus |
src/main/resources/logback.xml
@@ -5,7 +5,7 @@ | @@ -5,7 +5,7 @@ | ||
5 | 5 | ||
6 | <!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径--> | 6 | <!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径--> |
7 | <!-- <property name="LOG_HOME" value="/opt/web/log/" />--> | 7 | <!-- <property name="LOG_HOME" value="/opt/web/log/" />--> |
8 | - <property name="LOG_HOME" value="D://log"/> | 8 | + <property name="LOG_HOME" value="E://smartCampus_java//log"/> |
9 | 9 | ||
10 | <!-- 控制台输出 --> | 10 | <!-- 控制台输出 --> |
11 | <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender"> | 11 | <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender"> |
src/main/resources/mapping/CourseMapper.xml
@@ -22,6 +22,10 @@ | @@ -22,6 +22,10 @@ | ||
22 | and sz_sch_course.course_name in ( select course_name from sz_sch_teacher_class where school_id = #{schoolId}) | 22 | and sz_sch_course.course_name in ( select course_name from sz_sch_teacher_class where school_id = #{schoolId}) |
23 | </select> | 23 | </select> |
24 | 24 | ||
25 | + <select id="selectBySchoolId2" parameterType="java.lang.Integer" resultMap="BaseResultMap"> | ||
26 | + select * from sz_sch_course where school_Id = #{schoolId} | ||
27 | + </select> | ||
28 | + | ||
25 | <delete id="deleteSchoolId" parameterType="java.lang.Integer"> | 29 | <delete id="deleteSchoolId" parameterType="java.lang.Integer"> |
26 | delete from sz_sch_course where school_Id =#{schoolId} | 30 | delete from sz_sch_course where school_Id =#{schoolId} |
27 | </delete> | 31 | </delete> |