diff --git a/src/main/java/cn/teammodel/controller/admin/controller/AdminAppraiseController.java b/src/main/java/cn/teammodel/controller/admin/controller/AdminAppraiseController.java index 6392b3d..d27885e 100644 --- a/src/main/java/cn/teammodel/controller/admin/controller/AdminAppraiseController.java +++ b/src/main/java/cn/teammodel/controller/admin/controller/AdminAppraiseController.java @@ -2,7 +2,7 @@ package cn.teammodel.controller.admin.controller; import cn.teammodel.common.R; import cn.teammodel.controller.admin.service.AdminAppraiseService; -import cn.teammodel.model.dto.admin.UpdateAchievementRuleDto; +import cn.teammodel.model.dto.admin.appraise.UpdateAchievementRuleDto; import cn.teammodel.model.entity.appraise.AchievementRule; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; diff --git a/src/main/java/cn/teammodel/controller/admin/controller/AdminDutyController.java b/src/main/java/cn/teammodel/controller/admin/controller/AdminDutyController.java new file mode 100644 index 0000000..8f9c4d0 --- /dev/null +++ b/src/main/java/cn/teammodel/controller/admin/controller/AdminDutyController.java @@ -0,0 +1,35 @@ +package cn.teammodel.controller.admin.controller; + +import cn.teammodel.common.R; +import cn.teammodel.model.dto.admin.weekduty.AdminFindDutyRecordDto; +import cn.teammodel.model.dto.weekDuty.FindDutyRecordDto; +import cn.teammodel.model.vo.weekDuty.DutyRecordVo; +import cn.teammodel.service.DutyService; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; +import javax.validation.Valid; +import java.util.List; + +/** + * @author winter + * @create 2024-01-09 17:59 + */ +@RestController +@RequestMapping("admin/duty") +public class AdminDutyController { + @Resource + private DutyService dutyService; + + @PostMapping("records") + public R> findRecords(@Valid @RequestBody AdminFindDutyRecordDto adminFindDutyRecordDto) { + List res = dutyService.findAdminRecords(adminFindDutyRecordDto); + return R.success(res); + } + + + +} diff --git a/src/main/java/cn/teammodel/controller/admin/controller/IndexController.java b/src/main/java/cn/teammodel/controller/admin/controller/IndexController.java index a35bc06..ddfe710 100644 --- a/src/main/java/cn/teammodel/controller/admin/controller/IndexController.java +++ b/src/main/java/cn/teammodel/controller/admin/controller/IndexController.java @@ -2,7 +2,7 @@ package cn.teammodel.controller.admin.controller; import cn.teammodel.common.R; import cn.teammodel.controller.admin.service.AdminAppraiseService; -import cn.teammodel.model.dto.admin.TimeRangeDto; +import cn.teammodel.model.dto.admin.appraise.TimeRangeDto; import cn.teammodel.model.vo.admin.*; import cn.teammodel.model.vo.appraise.RecordVo; import io.swagger.annotations.Api; diff --git a/src/main/java/cn/teammodel/controller/admin/service/AdminAppraiseService.java b/src/main/java/cn/teammodel/controller/admin/service/AdminAppraiseService.java index 89ed476..0cdbd9c 100644 --- a/src/main/java/cn/teammodel/controller/admin/service/AdminAppraiseService.java +++ b/src/main/java/cn/teammodel/controller/admin/service/AdminAppraiseService.java @@ -1,7 +1,7 @@ package cn.teammodel.controller.admin.service; -import cn.teammodel.model.dto.admin.TimeRangeDto; -import cn.teammodel.model.dto.admin.UpdateAchievementRuleDto; +import cn.teammodel.model.dto.admin.appraise.TimeRangeDto; +import cn.teammodel.model.dto.admin.appraise.UpdateAchievementRuleDto; import cn.teammodel.model.entity.appraise.AchievementRule; import cn.teammodel.model.vo.admin.*; import cn.teammodel.model.vo.appraise.RecordVo; diff --git a/src/main/java/cn/teammodel/controller/admin/service/impl/AdminAppraiseServiceImpl.java b/src/main/java/cn/teammodel/controller/admin/service/impl/AdminAppraiseServiceImpl.java index 7779d46..5d1985b 100644 --- a/src/main/java/cn/teammodel/controller/admin/service/impl/AdminAppraiseServiceImpl.java +++ b/src/main/java/cn/teammodel/controller/admin/service/impl/AdminAppraiseServiceImpl.java @@ -5,8 +5,8 @@ import cn.teammodel.common.PK; import cn.teammodel.config.exception.ServiceException; import cn.teammodel.controller.admin.service.AdminAppraiseService; import cn.teammodel.repository.*; -import cn.teammodel.model.dto.admin.TimeRangeDto; -import cn.teammodel.model.dto.admin.UpdateAchievementRuleDto; +import cn.teammodel.model.dto.admin.appraise.TimeRangeDto; +import cn.teammodel.model.dto.admin.appraise.UpdateAchievementRuleDto; import cn.teammodel.model.entity.User; import cn.teammodel.model.entity.appraise.AchievementRule; import cn.teammodel.model.entity.appraise.Appraise; @@ -250,6 +250,7 @@ public class AdminAppraiseServiceImpl implements AdminAppraiseService { if (rankVoList == null) return null; List names = rankVoList.stream().map(AppraiseNodeRankVo::getName).collect(Collectors.toList()); + if (ObjectUtils.isEmpty(names)) return null; // 去重后的 nodes List nodesByName = appraiseRecordRepository.findAppraiseRecordInNames(String.format(PK.PK_APPRAISE_RECORD, schoolId), academicYearId, names); // 正常情况下 name 一一对应 todo: 临时解决 diff --git a/src/main/java/cn/teammodel/model/dto/admin/TimeRangeDto.java b/src/main/java/cn/teammodel/model/dto/admin/appraise/TimeRangeDto.java similarity index 87% rename from src/main/java/cn/teammodel/model/dto/admin/TimeRangeDto.java rename to src/main/java/cn/teammodel/model/dto/admin/appraise/TimeRangeDto.java index aaa86ae..5720e6b 100644 --- a/src/main/java/cn/teammodel/model/dto/admin/TimeRangeDto.java +++ b/src/main/java/cn/teammodel/model/dto/admin/appraise/TimeRangeDto.java @@ -1,4 +1,4 @@ -package cn.teammodel.model.dto.admin; +package cn.teammodel.model.dto.admin.appraise; import lombok.Data; import javax.validation.constraints.NotNull; diff --git a/src/main/java/cn/teammodel/model/dto/admin/UpdateAchievementRuleDto.java b/src/main/java/cn/teammodel/model/dto/admin/appraise/UpdateAchievementRuleDto.java similarity index 94% rename from src/main/java/cn/teammodel/model/dto/admin/UpdateAchievementRuleDto.java rename to src/main/java/cn/teammodel/model/dto/admin/appraise/UpdateAchievementRuleDto.java index e6e2beb..5bed13c 100644 --- a/src/main/java/cn/teammodel/model/dto/admin/UpdateAchievementRuleDto.java +++ b/src/main/java/cn/teammodel/model/dto/admin/appraise/UpdateAchievementRuleDto.java @@ -1,4 +1,4 @@ -package cn.teammodel.model.dto.admin; +package cn.teammodel.model.dto.admin.appraise; import io.swagger.annotations.ApiModelProperty; import lombok.Data; diff --git a/src/main/java/cn/teammodel/model/dto/admin/weekduty/AdminFindDutyRecordDto.java b/src/main/java/cn/teammodel/model/dto/admin/weekduty/AdminFindDutyRecordDto.java new file mode 100644 index 0000000..2531ceb --- /dev/null +++ b/src/main/java/cn/teammodel/model/dto/admin/weekduty/AdminFindDutyRecordDto.java @@ -0,0 +1,29 @@ +package cn.teammodel.model.dto.admin.weekduty; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; + +/** + * @author winter + * @create 2024-01-15 10:30 + */ +@Data +public class AdminFindDutyRecordDto { + @ApiModelProperty("老师 id") + private String teacherId; + @ApiModelProperty("学生 id") + private String studentId; + @ApiModelProperty(value = "班级 id", notes = "若不携带默认不指定某个班级") + private String classId; + @ApiModelProperty(required = true) + @NotNull(message = "academicYearid 不能为空") + private String academicYearId; + @ApiModelProperty(value = "是否加分", notes = "若不携带默认为全部") + private Boolean positive; + @ApiModelProperty(value = "起始时间", notes = "若不携带默认为当前周") + private Long startTime; + @ApiModelProperty(value = "结束时间", notes = "若不携带默认为当前周") + private Long endTime; +} diff --git a/src/main/java/cn/teammodel/service/DutyService.java b/src/main/java/cn/teammodel/service/DutyService.java index 19723e9..bd9df2d 100644 --- a/src/main/java/cn/teammodel/service/DutyService.java +++ b/src/main/java/cn/teammodel/service/DutyService.java @@ -1,5 +1,6 @@ package cn.teammodel.service; +import cn.teammodel.model.dto.admin.weekduty.AdminFindDutyRecordDto; import cn.teammodel.model.dto.weekDuty.*; import cn.teammodel.model.entity.weekDuty.WeekDuty; import cn.teammodel.model.vo.weekDuty.DutyRecordVo; @@ -28,4 +29,6 @@ public interface DutyService { List findRecords(FindDutyRecordDto findDutyRecordDto); void recallVote(RecallDutyVoteDto recallDutyVoteDto); + + List findAdminRecords(AdminFindDutyRecordDto adminFindDutyRecordDto); } diff --git a/src/main/java/cn/teammodel/service/impl/DutyServiceImpl.java b/src/main/java/cn/teammodel/service/impl/DutyServiceImpl.java index ae86e27..bc1365c 100644 --- a/src/main/java/cn/teammodel/service/impl/DutyServiceImpl.java +++ b/src/main/java/cn/teammodel/service/impl/DutyServiceImpl.java @@ -4,6 +4,7 @@ import cn.hutool.core.lang.UUID; import cn.teammodel.common.ErrorCode; import cn.teammodel.common.PK; import cn.teammodel.config.exception.ServiceException; +import cn.teammodel.model.dto.admin.weekduty.AdminFindDutyRecordDto; import cn.teammodel.model.dto.weekDuty.*; import cn.teammodel.model.entity.User; import cn.teammodel.model.entity.school.ClassInfo; @@ -368,6 +369,11 @@ public class DutyServiceImpl implements DutyService { dutyRecordRepository.save(weekDutyRecord); } + @Override + public List findAdminRecords(AdminFindDutyRecordDto adminFindDutyRecordDto) { + return null; + } + /** * 刷新值周树和 spots 的 id */ diff --git a/src/test/java/cn/teammodel/TeamModelExtensionApplicationTests.java b/src/test/java/cn/teammodel/TeamModelExtensionApplicationTests.java index f6ae1ed..855f9b8 100644 --- a/src/test/java/cn/teammodel/TeamModelExtensionApplicationTests.java +++ b/src/test/java/cn/teammodel/TeamModelExtensionApplicationTests.java @@ -4,8 +4,8 @@ import cn.teammodel.common.PK; import cn.teammodel.controller.admin.service.AdminAppraiseService; import cn.teammodel.repository.*; import cn.teammodel.manager.DingAlertNotifier; -import cn.teammodel.model.dto.admin.TimeRangeDto; -import cn.teammodel.model.dto.admin.UpdateAchievementRuleDto; +import cn.teammodel.model.dto.admin.appraise.TimeRangeDto; +import cn.teammodel.model.dto.admin.appraise.UpdateAchievementRuleDto; import cn.teammodel.model.entity.appraise.*; import cn.teammodel.model.entity.school.School; import cn.teammodel.service.EvaluationService;