From 256b233b4c2401a3df98edd5e5aadd13c7500784 Mon Sep 17 00:00:00 2001 From: winter <2436197699@qq.com> Date: Tue, 9 Jan 2024 14:53:53 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E5=89=8D=E5=8F=B0=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E8=80=81=E5=B8=88=E8=AF=84=E4=BB=B7=E5=80=BC=E5=91=A8?= =?UTF-8?q?=E6=98=8E=E7=BB=86=E6=8E=A5=E5=8F=A3=E5=8F=82=E6=95=B0=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cn/teammodel/controller/frontend/DutyController.java | 2 +- .../cn/teammodel/model/dto/weekDuty/FindDutyRecordDto.java | 4 ++-- src/main/java/cn/teammodel/service/impl/DutyServiceImpl.java | 5 ++++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/cn/teammodel/controller/frontend/DutyController.java b/src/main/java/cn/teammodel/controller/frontend/DutyController.java index 0d7ef8c..704d57f 100644 --- a/src/main/java/cn/teammodel/controller/frontend/DutyController.java +++ b/src/main/java/cn/teammodel/controller/frontend/DutyController.java @@ -82,7 +82,7 @@ public class DutyController { } @PostMapping("/findRecords") - @ApiOperation("多条件查询评价明细") + @ApiOperation(value = "多条件查询评价明细", notes = "只带 periodId 默认查询当前登录老师在本周的评价明细") public R> findRecords(@RequestBody @Valid FindDutyRecordDto findDutyRecordDto) { List items = dutyService.findRecords(findDutyRecordDto); return R.success(items); diff --git a/src/main/java/cn/teammodel/model/dto/weekDuty/FindDutyRecordDto.java b/src/main/java/cn/teammodel/model/dto/weekDuty/FindDutyRecordDto.java index 93a1634..664a302 100644 --- a/src/main/java/cn/teammodel/model/dto/weekDuty/FindDutyRecordDto.java +++ b/src/main/java/cn/teammodel/model/dto/weekDuty/FindDutyRecordDto.java @@ -14,8 +14,8 @@ public class FindDutyRecordDto { @ApiModelProperty(value = "班级 id", notes = "若不携带默认不指定某个班级") private String classId; @ApiModelProperty(required = true) - @NotNull(message = "学年 id 不能为空") - private String academicYearId; + @NotNull(message = "学段 id 不能为空") + private String periodId; @ApiModelProperty(value = "是否加分", notes = "若不携带默认为全部") private Boolean positive; @ApiModelProperty(value = "起始时间", notes = "若不携带默认为当前周") diff --git a/src/main/java/cn/teammodel/service/impl/DutyServiceImpl.java b/src/main/java/cn/teammodel/service/impl/DutyServiceImpl.java index 8c5187b..d6ef3de 100644 --- a/src/main/java/cn/teammodel/service/impl/DutyServiceImpl.java +++ b/src/main/java/cn/teammodel/service/impl/DutyServiceImpl.java @@ -314,7 +314,7 @@ public class DutyServiceImpl implements DutyService { @Override public List findRecords(FindDutyRecordDto findDutyRecordDto) { String classId = StringUtils.isEmpty(findDutyRecordDto.getClassId()) ? null : findDutyRecordDto.getClassId(); - String academicYearId = findDutyRecordDto.getAcademicYearId(); + String periodId = findDutyRecordDto.getPeriodId(); Boolean positive = findDutyRecordDto.getPositive(); Long startTime = findDutyRecordDto.getStartTime(); Long endTime = findDutyRecordDto.getEndTime(); @@ -322,6 +322,9 @@ public class DutyServiceImpl implements DutyService { String schoolId = user.getSchoolId(); String userId = user.getId(); + List semesters = schoolRepository.findSemestersById(schoolId, periodId); + String academicYearId = SchoolDateUtil.calculateAcademicYearId(semesters, LocalDate.now()); + if (startTime == null || endTime == null) { LocalDateTime mondayOfCurWeek = LocalDateTime.now().with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY)) .withHour(0)