CourseScheduleController.java 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. package com.ym.mec.education.controller;
  2. import com.ym.mec.auth.api.client.SysUserFeignService;
  3. import com.ym.mec.auth.api.entity.SysUser;
  4. import com.ym.mec.biz.dal.dto.ClassDateAdjustDto;
  5. import com.ym.mec.biz.dal.entity.CourseSchedule;
  6. import com.ym.mec.biz.service.CourseScheduleService;
  7. import com.ym.mec.common.exception.BizException;
  8. import com.ym.mec.education.base.BaseResponse;
  9. import com.ym.mec.education.base.PageResponse;
  10. import com.ym.mec.education.req.ClassGroupReq;
  11. import com.ym.mec.education.req.CourseScheduleReq;
  12. import com.ym.mec.education.resp.CourseScheduleResp;
  13. import com.ym.mec.education.service.ICourseScheduleService;
  14. import io.swagger.annotations.Api;
  15. import io.swagger.annotations.ApiOperation;
  16. import lombok.extern.slf4j.Slf4j;
  17. import org.springframework.beans.factory.annotation.Autowired;
  18. import org.springframework.validation.annotation.Validated;
  19. import org.springframework.web.bind.annotation.*;
  20. import java.util.ArrayList;
  21. import java.util.List;
  22. import java.util.Objects;
  23. /**
  24. * @program: mec
  25. * @description: 课表
  26. * @author: xw
  27. * @create: 2019-09-26 21:04
  28. */
  29. @RestController
  30. @RequestMapping("api/courseSchedule")
  31. @Api(tags = "课表")
  32. @Slf4j
  33. public class CourseScheduleController {
  34. @Autowired
  35. private ICourseScheduleService courseScheduleService;
  36. @Autowired
  37. private CourseScheduleService scheduleService;
  38. @Autowired
  39. private SysUserFeignService sysUserFeignService;
  40. @PostMapping("/list")
  41. @ApiOperation("课表列表")
  42. public PageResponse list(@RequestBody @Validated ClassGroupReq classGroupReq) {
  43. return courseScheduleService.getPage(classGroupReq);
  44. }
  45. @PostMapping("/info")
  46. @ApiOperation("点名详情-头信息")
  47. public BaseResponse<CourseScheduleResp> getInfo(@RequestBody CourseScheduleReq courseScheduleReq) {
  48. return courseScheduleService.getInfo(courseScheduleReq);
  49. }
  50. @PostMapping("/statisticsInfo")
  51. @ApiOperation("历史考勤统计-头信息")
  52. public BaseResponse getStatisticsInfo(@RequestBody ClassGroupReq classGroupReq) {
  53. return courseScheduleService.getStatisticsInfo(classGroupReq);
  54. }
  55. @PostMapping("/courseInfo")
  56. @ApiOperation("课程详情-头信息")
  57. public BaseResponse<CourseScheduleResp> courseInfo(@RequestBody CourseScheduleReq courseScheduleReq) {
  58. return courseScheduleService.courseInfo(courseScheduleReq);
  59. }
  60. public Object getCourseScheduleDateByMonth(@ApiParam(value = "月份", required = true) @RequestParam Date month) {
  61. SysUser user = sysUserFeignService.queryUserInfo();
  62. if (null == user) {
  63. throw new BizException("请登录");
  64. }
  65. }
  66. @ApiOperation(value = "课时调整")
  67. @PostMapping(value = "/classStartDateAdjust")
  68. public Object classStartDateAdjust(ClassDateAdjustDto classDateAdjustDto){
  69. if(Objects.isNull(classDateAdjustDto.getId())){
  70. return BaseResponse.errorParam();
  71. }
  72. List<CourseSchedule> courseSchedules=new ArrayList<>();
  73. courseSchedules.add(classDateAdjustDto);
  74. scheduleService.courseAdjust(courseSchedules);
  75. return BaseResponse.success(null);
  76. }
  77. @ApiOperation(value = "课时交换")
  78. @GetMapping(value = "/courseSwap")
  79. public Object courseSwap(Long courseScheduleId1,Long courseScheduleId2){
  80. if(Objects.isNull(courseScheduleId1)||Objects.isNull(courseScheduleId2)){
  81. return BaseResponse.errorParam();
  82. }
  83. scheduleService.courseSwap(courseScheduleId1,courseScheduleId2);
  84. return BaseResponse.success(null);
  85. }
  86. }