Bläddra i källkod

Merge remote-tracking branch 'origin/master'

周箭河 5 år sedan
förälder
incheckning
ad990bf607

+ 25 - 0
mec-teacher/src/main/java/com/ym/mec/teacher/controller/TeacherCourseScheduleController.java

@@ -1,10 +1,12 @@
 package com.ym.mec.teacher.controller;
 
 import com.ym.mec.biz.dal.dto.TeacherRemarkCommitDto;
+
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
 
+import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.HashMap;
@@ -222,6 +224,29 @@ public class TeacherCourseScheduleController extends BaseController {
         return succeed();
     }
 
+    @ApiOperation(value = "对外课时调整")
+    @PostMapping(value = "/updateCourseScheduleOfComm",consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
+    public Object updateCourseScheduleOfComm(CourseSchedule courseSchedule){
+    	CourseSchedule oldCourseSchedule = scheduleService.get(courseSchedule.getId());
+        if(Objects.isNull(oldCourseSchedule)){
+            return failed("未找到指定课程");
+        }
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+		Date date = new Date();
+		String endDateStr = DateUtil.format(oldCourseSchedule.getClassDate(), "yyyy-MM-dd") + " " + DateUtil.format(oldCourseSchedule.getStartClassTime(), "HH:mm:ss");
+		if (DateUtil.stringToDate(endDateStr, sdf).before(date)) {
+			throw new BizException("调整失败,未开始的课程才能调整");
+		}
+		
+        if(Objects.isNull(courseSchedule.getClassGroupId())){
+            courseSchedule.setClassGroupId(oldCourseSchedule.getClassGroupId());
+        }
+        List<CourseSchedule> courseSchedules=new ArrayList<>();
+        courseSchedules.add(courseSchedule);
+        scheduleService.courseAdjust(courseSchedules);
+        return succeed();
+    }
+
     @ApiOperation(value = "课时交换")
     @PostMapping(value = "/courseSwap",consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
     public Object courseSwap(Long courseScheduleId1,Long courseScheduleId2){