TextbookStudentClaimController.java 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. package com.xjrsoft.module.textbook.controller;
  2. import cn.dev33.satoken.annotation.SaCheckPermission;
  3. import cn.dev33.satoken.stp.StpUtil;
  4. import cn.hutool.core.bean.BeanUtil;
  5. import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
  6. import com.baomidou.mybatisplus.core.metadata.IPage;
  7. import com.github.yulichang.wrapper.MPJLambdaWrapper;
  8. import com.xjrsoft.common.model.result.RT;
  9. import com.xjrsoft.common.page.ConventPage;
  10. import com.xjrsoft.common.page.PageOutput;
  11. import com.xjrsoft.common.utils.VoToColumnUtil;
  12. import com.xjrsoft.module.textbook.dto.*;
  13. import com.xjrsoft.module.textbook.entity.TextbookStudentClaim;
  14. import com.xjrsoft.module.textbook.service.ITextbookStudentClaimService;
  15. import com.xjrsoft.module.textbook.vo.*;
  16. import io.swagger.annotations.Api;
  17. import io.swagger.annotations.ApiOperation;
  18. import lombok.AllArgsConstructor;
  19. import org.springframework.web.bind.annotation.DeleteMapping;
  20. import org.springframework.web.bind.annotation.GetMapping;
  21. import org.springframework.web.bind.annotation.PostMapping;
  22. import org.springframework.web.bind.annotation.PutMapping;
  23. import org.springframework.web.bind.annotation.RequestBody;
  24. import org.springframework.web.bind.annotation.RequestMapping;
  25. import org.springframework.web.bind.annotation.RequestParam;
  26. import org.springframework.web.bind.annotation.RestController;
  27. import javax.validation.Valid;
  28. import java.util.Date;
  29. import java.util.List;
  30. /**
  31. * @title: 学生教材认领记录
  32. * @Author szs
  33. * @Date: 2023-12-26
  34. * @Version 1.0
  35. */
  36. @RestController
  37. @RequestMapping("/textbook" + "/textbookStudentClaim")
  38. @Api(value = "/textbook" + "/textbookStudentClaim",tags = "学生教材认领记录代码")
  39. @AllArgsConstructor
  40. public class TextbookStudentClaimController {
  41. private final ITextbookStudentClaimService textbookStudentClaimService;
  42. @GetMapping(value = "/head-tea-look-class-book-semester")
  43. @ApiOperation(value="班主任查看班级教材学期页面")
  44. @SaCheckPermission("textbookstudentclaim:detail")
  45. public RT<List<HeadTeaLookClassBookSemesterVo>> headTeaLookClassBookSemester(){
  46. return RT.ok(textbookStudentClaimService.headTeaLookClassBookSemester());
  47. }
  48. @GetMapping(value = "/head-tea-look-class-book")
  49. @ApiOperation(value="班主任查看班级教材页面")
  50. @SaCheckPermission("textbookstudentclaim:detail")
  51. public RT<HeadTeaLookClassBookVo> headTeaLookClassBook(@Valid HeadTeaLookClassBookDto dto){
  52. return RT.ok(textbookStudentClaimService.headTeaLookClassBook(dto));
  53. }
  54. @GetMapping(value = "/page")
  55. @ApiOperation(value="学生确认教材领取记录列表(分页)")
  56. @SaCheckPermission("textbookstudentclaim:detail")
  57. public RT<PageOutput<TextbookStudentClaimPageVo>> page(@Valid TextbookStudentClaimPageDto dto){
  58. LambdaQueryWrapper<TextbookStudentClaim> queryWrapper = new LambdaQueryWrapper<>();
  59. queryWrapper
  60. .orderByDesc(TextbookStudentClaim::getId)
  61. .select(TextbookStudentClaim.class,x -> VoToColumnUtil.fieldsToColumns(TextbookStudentClaimPageVo.class).contains(x.getProperty()))
  62. .eq(dto.getStudentUserId() != null, TextbookStudentClaim::getStudentUserId, dto.getStudentUserId())
  63. .eq(TextbookStudentClaim::getIsClaim, 1)
  64. ;
  65. IPage<TextbookStudentClaim> page = textbookStudentClaimService.page(ConventPage.getPage(dto), queryWrapper);
  66. PageOutput<TextbookStudentClaimPageVo> pageOutput = ConventPage.getPageOutput(page, TextbookStudentClaimPageVo.class);
  67. return RT.ok(pageOutput);
  68. }
  69. @GetMapping(value = "/student-confirm-list")
  70. @ApiOperation(value="学生确定教材领取页面")
  71. @SaCheckPermission("textbookstudentclaim:detail")
  72. public RT<TextbookClaimStudentConfirmVo> studentConfirmList(@Valid TextbookClaimStudentConfirmDto dto){
  73. TextbookClaimStudentConfirmVo textbookClaimStudentConfirmVo = textbookStudentClaimService.getStudentConfirmList(dto);
  74. return RT.ok(textbookClaimStudentConfirmVo);
  75. }
  76. @GetMapping(value = "/student-semester-list")
  77. @ApiOperation(value="学生确定教材领取学期页面")
  78. @SaCheckPermission("textbookstudentclaim:detail")
  79. public RT<List<TextbookStudentSemesterVo>> studentSemesterList(){
  80. List<TextbookStudentSemesterVo> textbookStudentSemesterVoList = textbookStudentClaimService.getStudentSemesterList();
  81. return RT.ok(textbookStudentSemesterVoList);
  82. }
  83. @GetMapping(value = "/teacher-check-byClass-list")
  84. @ApiOperation(value="班主任确认教材领取按班级查看页面")
  85. @SaCheckPermission("textbookstudentclaim:detail")
  86. public RT<PageOutput<TeacherCheckByclassVo>> teacherCheckByClassList(@Valid TeacherCheckByclassDto dto){
  87. IPage<TeacherCheckByclassVo> page = textbookStudentClaimService.getTeacherCheckByclassList(dto);
  88. PageOutput<TeacherCheckByclassVo> pageOutput = ConventPage.getPageOutput(page, TeacherCheckByclassVo.class);
  89. return RT.ok(pageOutput);
  90. }
  91. @GetMapping(value = "/teacher-check-byStu-list")
  92. @ApiOperation(value="班主任确认教材领取按学生查看页面")
  93. @SaCheckPermission("textbookstudentclaim:detail")
  94. public RT<PageOutput<TeacherCheckByStuVo>> teacherCheckByStuList(@Valid TeacherCheckByStuDto dto){
  95. IPage<TeacherCheckByStuVo> page = textbookStudentClaimService.getTeacherCheckByStuList(dto);
  96. PageOutput<TeacherCheckByStuVo> pageOutput = ConventPage.getPageOutput(page, TeacherCheckByStuVo.class);
  97. return RT.ok(pageOutput);
  98. }
  99. @GetMapping(value = "/teacher-check-stu-claim-list")
  100. @ApiOperation(value="教师查看一本教材的学生领取情况页面")
  101. @SaCheckPermission("textbookstudentclaim:detail")
  102. public RT<List<TeacherCheckStuClaimVo>> teacherCheckStuClaimList(@Valid TeacherCheckStuClaimDto dto){
  103. List<TeacherCheckStuClaimVo> teacherCheckStuClaimList = textbookStudentClaimService.getTeacherCheckStuClaimList(dto);
  104. return RT.ok(teacherCheckStuClaimList);
  105. }
  106. @GetMapping(value = "/teacher-get-stu-noClaim-list")
  107. @ApiOperation(value="班主任获取班上某个学生没有认领的教材记录")
  108. @SaCheckPermission("textbookstudentclaim:detail")
  109. public RT<List<TextbookClaimVO>> teacherGetStuNoClaimList(@RequestParam Long studentUserId){
  110. List<TextbookClaimVO> textbookClaimVOList = textbookStudentClaimService.getTeacherGetStuNoClaimList(studentUserId);
  111. return RT.ok(textbookClaimVOList);
  112. }
  113. @PutMapping("/confirm")
  114. @ApiOperation(value = "学生自己确认已经领取")
  115. @SaCheckPermission("textbookstudentclaim:edit")
  116. public RT<Boolean> confirm(@Valid @RequestBody List<Long> textbookStudentClaimIds){
  117. return RT.ok(textbookStudentClaimService.updateByIds(textbookStudentClaimIds));
  118. }
  119. @PutMapping("/teacher-confirm")
  120. @ApiOperation(value = "教师帮助学生确认已经领取")
  121. @SaCheckPermission("textbookstudentclaim:edit")
  122. public RT<Boolean> teacherConfirm(@Valid @RequestBody List<TeacherConfirmDto> teacherConfirmDtoList){
  123. return RT.ok( textbookStudentClaimService.teacherConfirm(teacherConfirmDtoList));
  124. }
  125. @GetMapping(value = "/teacher-confirm-batch-textbook-list")
  126. @ApiOperation(value="教师根据教材帮助学生批量确认已经领取教材列表")
  127. @SaCheckPermission("textbookstudentclaim:detail")
  128. public RT<List<TeacherConfirmBatchTextbookListVo>> teacherConfirmBatchTextbookList(@Valid TeacherConfirmBatchTextbookListDto dto){
  129. return RT.ok(textbookStudentClaimService.teacherConfirmBatchTextbookList(dto));
  130. }
  131. @PutMapping("/teacher-confirm-batch-by-textbook")
  132. @ApiOperation(value = "教师根据教材帮助学生批量确认已经领取")
  133. @SaCheckPermission("textbookstudentclaim:edit")
  134. public RT<Boolean> teacherConfirmBatchBytTextbook(@Valid @RequestBody TeacherConfirmBatchByTextbookDto dto){
  135. return RT.ok(textbookStudentClaimService.teacherConfirmBatchBytTextbook(dto));
  136. }
  137. @GetMapping(value = "/info")
  138. @ApiOperation(value="根据id查询学生教材认领记录信息")
  139. @SaCheckPermission("textbookstudentclaim:detail")
  140. public RT<TextbookStudentClaimVo> info(@RequestParam Long id){
  141. TextbookStudentClaim textbookStudentClaim = textbookStudentClaimService.getById(id);
  142. if (textbookStudentClaim == null) {
  143. return RT.error("找不到此数据!");
  144. }
  145. return RT.ok(BeanUtil.toBean(textbookStudentClaim, TextbookStudentClaimVo.class));
  146. }
  147. @PostMapping
  148. @ApiOperation(value = "新增学生教材认领记录")
  149. @SaCheckPermission("textbookstudentclaim:add")
  150. public RT<Boolean> add(@Valid @RequestBody AddTextbookStudentClaimDto dto){
  151. TextbookStudentClaim textbookStudentClaim = BeanUtil.toBean(dto, TextbookStudentClaim.class);
  152. boolean isSuccess = textbookStudentClaimService.save(textbookStudentClaim);
  153. return RT.ok(isSuccess);
  154. }
  155. @PutMapping
  156. @ApiOperation(value = "修改学生教材认领记录")
  157. @SaCheckPermission("textbookstudentclaim:edit")
  158. public RT<Boolean> update(@Valid @RequestBody UpdateTextbookStudentClaimDto dto){
  159. TextbookStudentClaim textbookStudentClaim = BeanUtil.toBean(dto, TextbookStudentClaim.class);
  160. return RT.ok(textbookStudentClaimService.updateById(textbookStudentClaim));
  161. }
  162. @DeleteMapping
  163. @ApiOperation(value = "删除学生教材认领记录")
  164. @SaCheckPermission("textbookstudentclaim:delete")
  165. public RT<Boolean> delete(@Valid @RequestBody List<Long> ids){
  166. return RT.ok(textbookStudentClaimService.removeBatchByIds(ids));
  167. }
  168. }