From 128a05e90afa44dfa57f7895a9d9a12b5769eaae Mon Sep 17 00:00:00 2001 From: "hhb@hotmail.com" Date: Wed, 4 Dec 2024 18:06:11 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E8=B0=83=E6=95=B4=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/service/impl/CommonServiceImpl.java | 21 +++++++++++++++---- .../model/dto/admin/common/GCDto.java | 1 + .../model/dto/admin/teacher/TeacherDto.java | 1 + 3 files changed, 19 insertions(+), 4 deletions(-) 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; }