diff --git a/src/main/java/cn/teammodel/controller/admin/service/impl/CommonServiceImpl.java b/src/main/java/cn/teammodel/controller/admin/service/impl/CommonServiceImpl.java index 439bc32..7d1a810 100644 --- a/src/main/java/cn/teammodel/controller/admin/service/impl/CommonServiceImpl.java +++ b/src/main/java/cn/teammodel/controller/admin/service/impl/CommonServiceImpl.java @@ -12,11 +12,14 @@ import cn.teammodel.repository.CommentRepository; import cn.teammodel.repository.SchoolRepository; import cn.teammodel.utils.MonthToNumberConverter; import com.azure.cosmos.models.PartitionKey; +import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.time.Instant; +import java.time.LocalDate; import java.time.Month; +import java.time.ZoneId; import java.util.ArrayList; import java.util.List; @@ -38,10 +41,20 @@ public class CommonServiceImpl implements CommonService { //获取当前学校该学段下详细信息 List period = schoolRepository.findPeriodById(gcDto.getSchoolId(), gcDto.getPeriodId()); List classes = classRepository.findClassBySchoolIdAndPeriodId(gcDto.getPeriodId()); - int year = now().getYear(); - Month month = now().getMonth(); - int mon = MonthToNumberConverter.convertMonthToNumber(month.name()); - int day = now().getDayOfMonth(); + int year = 0; + int mon = 0; + int day = 0; + if (gcDto.getTime() != null && gcDto.getTime() != 0L) { + LocalDate date = Instant.ofEpochMilli(gcDto.getTime()).atZone(ZoneId.systemDefault()).toLocalDate(); + year = date.getYear(); + mon = date.getMonthValue(); + day = date.getDayOfMonth(); + }else { + year = now().getYear(); + Month month = now().getMonth(); + mon = MonthToNumberConverter.convertMonthToNumber(month.name()); + day = now().getDayOfMonth(); + } //处理年级ID for (ClassInfo classInfo : classes) { if(period.get(0).getId().equalsIgnoreCase(classInfo.getPeriodId())) { diff --git a/src/main/java/cn/teammodel/model/dto/admin/common/GCDto.java b/src/main/java/cn/teammodel/model/dto/admin/common/GCDto.java index d3afa41..22c8955 100644 --- a/src/main/java/cn/teammodel/model/dto/admin/common/GCDto.java +++ b/src/main/java/cn/teammodel/model/dto/admin/common/GCDto.java @@ -6,4 +6,5 @@ import lombok.Data; public class GCDto { private String schoolId; private String periodId; + private Long time; } diff --git a/src/main/java/cn/teammodel/model/dto/admin/teacher/TeacherDto.java b/src/main/java/cn/teammodel/model/dto/admin/teacher/TeacherDto.java index 86e1c2d..211e1ad 100644 --- a/src/main/java/cn/teammodel/model/dto/admin/teacher/TeacherDto.java +++ b/src/main/java/cn/teammodel/model/dto/admin/teacher/TeacherDto.java @@ -20,4 +20,5 @@ public class TeacherDto { public String grade; @ApiModelProperty("科目信息") public String subjectId; + public String semesterId; }