Browse Source

调课顶课申请相关接口,适应magicapi

dzx 1 year ago
parent
commit
78feacb22c

+ 3 - 2
src/main/java/com/xjrsoft/module/courseTable/service/ICourseTableService.java

@@ -11,6 +11,7 @@ import com.xjrsoft.module.schedule.vo.CourseTableVo;
 
 import java.io.IOException;
 import java.io.InputStream;
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -29,7 +30,7 @@ public interface ICourseTableService extends IService<CourseTable> {
 
     CourseTableVo getList(CourseTableDto dto);
 
-    List<CourseListVo> getAdjustList(Long teacherId, String adjustDate);
+    List<CourseListVo> getAdjustList(Long teacherId, Date adjustDate);
 
-    String getPreCheck(Integer preCheckType, Long courseId, Long swapCourseId, String swapDate, Long subTeacherId);
+    String getPreCheck(Integer preCheckType, Long courseId, Long swapCourseId, Date swapDate, Long subTeacherId);
 }

+ 8 - 7
src/main/java/com/xjrsoft/module/courseTable/service/impl/CourseTableServiceImpl.java

@@ -58,6 +58,7 @@ import java.time.LocalDateTime;
 import java.time.ZoneId;
 import java.time.format.DateTimeFormatter;
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -231,11 +232,10 @@ public class CourseTableServiceImpl extends ServiceImpl<CourseTableMapper, Cours
      * 调课顶课查询
      */
     @Override
-    public List<CourseListVo> getAdjustList(Long teacherId, String adjustDate) {
+    public List<CourseListVo> getAdjustList(Long teacherId, Date adjustDate) {
         CourseTableAdjustDto dto = new CourseTableAdjustDto();
-        if(!StrUtil.isEmpty(adjustDate)){
-            DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss");
-            LocalDateTime localDateTime = LocalDateTime.parse(adjustDate, formatter);
+        if(!ObjectUtil.isEmpty(adjustDate)){
+            LocalDateTime localDateTime = adjustDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
             DayOfWeek dayOfWeek = localDateTime.getDayOfWeek();
             dto.setWeek(dayOfWeek.getValue());
         }
@@ -245,7 +245,7 @@ public class CourseTableServiceImpl extends ServiceImpl<CourseTableMapper, Cours
     }
 
     @Override
-    public String getPreCheck(Integer preCheckType, Long courseId, Long swapCourseId, String swapDate, Long subTeacherId) {
+    public String getPreCheck(Integer preCheckType, Long courseId, Long swapCourseId, Date swapDate, Long subTeacherId) {
         if(preCheckType != null){
             if(preCheckType == 1){
                 CourseTable courseTable = courseTableMapper.selectById(courseId);
@@ -306,7 +306,7 @@ public class CourseTableServiceImpl extends ServiceImpl<CourseTableMapper, Cours
      * @param swapCourseTable 对调的课程
      * @return 检查结果
      */
-    JsonObject getExtendPreCheck(String swapDate, CourseTable courseTable, CourseTable swapCourseTable) throws Exception {
+    JsonObject getExtendPreCheck(Date swapDate, CourseTable courseTable, CourseTable swapCourseTable) throws Exception {
         JsonParser jsonParser = new JsonParser();
         String url = ScheduleUtil.apiUrl + "RescheduleApply/Extend/PreTesting";
         JsonObject jsonObject = new JsonObject();
@@ -316,7 +316,8 @@ public class CourseTableServiceImpl extends ServiceImpl<CourseTableMapper, Cours
 //        jsonObject.addProperty("endDate", "2024-01-31");
 //        jsonObject.addProperty("dayOfweek", 5);
         jsonObject.addProperty("numberOfday", swapCourseTable.getTimeNumber());
-        jsonObject.addProperty("date", swapDate);
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+        jsonObject.addProperty("date", swapDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime().format(formatter));
         jsonObject.addProperty("reschduleId", courseTable.getJianyueId());
 
         //获取时间戳