Explorar o código

获取当前周次调整

dzx hai 4 días
pai
achega
f7eb56fd92

+ 3 - 0
src/main/java/com/xjrsoft/module/schedule/controller/ScheduleController.java

@@ -167,6 +167,9 @@ public class ScheduleController {
         List<BaseSemester> semesterList = semesterService.list(new QueryWrapper<BaseSemester>().lambda().orderByDesc(BaseSemester::getStartDate));
         BaseSemester baseSemester = semesterList.get(0);
         LocalDateTime now = LocalDateTime.now();
+        if(dto.getScheduleDate() != null){
+            now = dto.getScheduleDate();
+        }
         //计算本周是第几周
         LocalDateTime startDateTime = LocalDateTime.ofInstant(baseSemester.getStartDate().toInstant(), ZoneId.systemDefault());
         LocalDateTime endDateTime = LocalDateTime.ofInstant(baseSemester.getEndDate().toInstant(), ZoneId.systemDefault());

+ 5 - 0
src/main/java/com/xjrsoft/module/schedule/dto/CourseTableDto.java

@@ -2,6 +2,7 @@ package com.xjrsoft.module.schedule.dto;
 
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
 
 import java.io.Serializable;
 import java.time.LocalDateTime;
@@ -55,4 +56,8 @@ public class CourseTableDto implements Serializable {
     @ApiModelProperty("当前日期")
     private LocalDateTime toDay;
 
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty("当前日期")
+    private LocalDateTime scheduleDate;
+
 }