ClassGroupController.java 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. package com.ym.mec.web.controller;
  2. import com.ym.mec.biz.dal.dto.ClassGroupAdjustDto;
  3. import com.ym.mec.biz.dal.dto.HighClassGroupDto;
  4. import com.ym.mec.biz.dal.entity.ClassGroup;
  5. import com.ym.mec.biz.dal.entity.ClassGroupTeacherMapper;
  6. import com.ym.mec.biz.dal.enums.SalarySettlementTypeEnum;
  7. import com.ym.mec.biz.dal.page.queryMusicGroupCourseScheduleQueryInfo;
  8. import com.ym.mec.biz.service.ClassGroupService;
  9. import com.ym.mec.biz.service.ClassGroupTeacherMapperService;
  10. import com.ym.mec.common.controller.BaseController;
  11. import com.ym.mec.common.entity.HttpResponseResult;
  12. import com.ym.mec.common.page.QueryInfo;
  13. import io.swagger.annotations.*;
  14. import org.apache.commons.lang3.StringUtils;
  15. import org.springframework.beans.factory.annotation.Autowired;
  16. import org.springframework.security.access.prepost.PreAuthorize;
  17. import org.springframework.web.bind.annotation.*;
  18. import java.util.Date;
  19. import java.util.List;
  20. @RequestMapping("classGroup")
  21. @Api(tags = "班级服务")
  22. @RestController
  23. public class ClassGroupController extends BaseController {
  24. @Autowired
  25. private ClassGroupService classGroupService;
  26. @Autowired
  27. private ClassGroupTeacherMapperService classGroupTeacherMapperService;
  28. @ApiOperation(value = "新增单技班班级")
  29. @PostMapping("/add")
  30. @PreAuthorize("@pcs.hasPermissions('classGroup/add')")
  31. public Object add(@RequestBody ClassGroup classGroup) throws Exception {
  32. return succeed(classGroupService.addClassGroup(classGroup));
  33. }
  34. @ApiOperation(value = "新增合奏班")
  35. @PostMapping("/addMixClass")
  36. @PreAuthorize("@pcs.hasPermissions('classGroup/addMixClass')")
  37. public Object addMixClass(@ApiParam(value = "乐团编号", required = true) @RequestParam String musicGroupId,
  38. @ApiParam(value = "班级名称", required = true) String name,
  39. @ApiParam(value = "班级编号,号分割", required = true) String classGroupIds) throws Exception {
  40. return succeed(classGroupService.addMixClassGroup(musicGroupId, name, classGroupIds));
  41. }
  42. @ApiOperation(value = "新增提高班")
  43. @PostMapping("/addHighClass")
  44. @PreAuthorize("@pcs.hasPermissions('classGroup/addHighClass')")
  45. @ApiParam(value = "乐团提高班json", required = true)
  46. public Object addHighClass(@RequestBody List<HighClassGroupDto> highClassGroupDtoList) throws Exception {
  47. if (highClassGroupDtoList.size() <= 0) {
  48. return failed("参数不合法");
  49. }
  50. return succeed(classGroupService.addHighClassGroup(highClassGroupDtoList));
  51. }
  52. @ApiOperation(value = "删除单技班")
  53. @PostMapping("/delSingle")
  54. @PreAuthorize("@pcs.hasPermissions('classGroup/delSingle')")
  55. public Object delSingle(Integer classGroupId) {
  56. classGroupService.delete(classGroupId);
  57. return succeed();
  58. }
  59. @ApiOperation(value = "删除合奏班")
  60. @PostMapping("/delMix")
  61. @PreAuthorize("@pcs.hasPermissions('classGroup/delMix')")
  62. public Object delMix(Integer classGroupId) {
  63. classGroupService.delete(classGroupId);
  64. return succeed();
  65. }
  66. @ApiOperation(value = "修改班级")
  67. @PostMapping("/update")
  68. @PreAuthorize("@pcs.hasPermissions('classGroup/update')")
  69. public Object update(ClassGroup classGroup) {
  70. classGroup.setUpdateTime(new Date());
  71. classGroupService.update(classGroup);
  72. return succeed();
  73. }
  74. @ApiOperation(value = "分页查询班级列表")
  75. @GetMapping("/queryPage")
  76. @PreAuthorize("@pcs.hasPermissions('classGroup/queryPage')")
  77. public Object queryPage(QueryInfo queryInfo) {
  78. return succeed(classGroupService.queryPage(queryInfo));
  79. }
  80. @ApiOperation(value = "合奏班相关班级获取")
  81. @GetMapping("/findClassGroupAboutMix")
  82. @PreAuthorize("@pcs.hasPermissions('classGroup/findClassGroupAboutMix')")
  83. public HttpResponseResult findClassGroupAboutMix(@ApiParam(value = "乐团编号", required = true) @RequestParam String musicGroupId,
  84. @ApiParam(value = "班级编号", required = false) Integer mixClassGroupId) {
  85. return succeed(classGroupService.findClassGroup(musicGroupId, mixClassGroupId));
  86. }
  87. @ApiOperation(value = "乐团单技班列表")
  88. @GetMapping("/findMusicGroupClass")
  89. @PreAuthorize("@pcs.hasPermissions('classGroup/findMusicGroupClass')")
  90. public HttpResponseResult findMusicGroupClass(@ApiParam(value = "乐团编号", required = true) @RequestParam String musicGroupId) {
  91. return succeed(classGroupService.findAllNormalClassGroupByMusicGroupId(musicGroupId));
  92. }
  93. @ApiOperation(value = "获取未分班的单技班列表")
  94. @GetMapping("/findNoClassSubjects")
  95. @PreAuthorize("@pcs.hasPermissions('classGroup/findNoClassSubjects')")
  96. public HttpResponseResult findNoClassSubjects(@ApiParam(value = "乐团编号", required = true) @RequestParam String musicGroupId) {
  97. return succeed(classGroupService.findNoClassSubjects(musicGroupId));
  98. }
  99. @ApiOperation(value = "乐团合奏班列表")
  100. @GetMapping("/findMixMusicGroupClass")
  101. @PreAuthorize("@pcs.hasPermissions('classGroup/findMixMusicGroupClass')")
  102. public HttpResponseResult findMixMusicGroupClass(@ApiParam(value = "乐团编号", required = true) @RequestParam String musicGroupId) {
  103. return succeed(classGroupService.findAllMixClassGroupByMusicGroupId(musicGroupId));
  104. }
  105. @ApiOperation(value = "乐团所有班级列表")
  106. @GetMapping("/findAllClassGroupByMusicGroup")
  107. @PreAuthorize("@pcs.hasPermissions('classGroup/findAllClassGroupByMusicGroup')")
  108. public HttpResponseResult findAllClassGroupByMusicGroup(@ApiParam(value = "乐团编号", required = true) @RequestParam String musicGroupId) {
  109. return succeed(classGroupService.findAllClassGroupByMusicGroup(musicGroupId));
  110. }
  111. @ApiOperation(value = "乐团详情--班级详情列表")
  112. @GetMapping("/queryMusicGroupClassGroup")
  113. @PreAuthorize("@pcs.hasPermissions('classGroup/queryMusicGroupClassGroup')")
  114. public HttpResponseResult queryMusicGroupClassGroup(QueryInfo queryInfo) {
  115. return succeed(classGroupService.queryMusicGroupClassGroup(queryInfo));
  116. }
  117. @ApiOperation(value = "乐团详情--课表详情列表")
  118. @GetMapping("/queryMusicGroupCourseSchedule")
  119. @PreAuthorize("@pcs.hasPermissions('classGroup/queryMusicGroupCourseSchedule')")
  120. public HttpResponseResult queryMusicGroupCourseSchedule(queryMusicGroupCourseScheduleQueryInfo queryInfo) {
  121. return succeed(classGroupService.queryMusicGroupCourseSchedule(queryInfo));
  122. }
  123. @ApiOperation(value = "乐团班级老师设置")
  124. @PostMapping("/addClassGroupTeacher")
  125. @ApiParam(value = "乐团班级老师json", required = true)
  126. @PreAuthorize("@pcs.hasPermissions('classGroup/addClassGroupTeacher')")
  127. public HttpResponseResult addClassGroupTeacher(@RequestBody List<ClassGroupTeacherMapper> classGroupTeacherMapperList) {
  128. if (classGroupTeacherMapperList.size() <= 0) {
  129. return failed("参数不合法");
  130. }
  131. return succeed(classGroupTeacherMapperService.classGroupTeachersInsert(classGroupTeacherMapperList));
  132. }
  133. @ApiOperation(value = "获取乐团班级老师")
  134. @GetMapping("/findMusicGroupClassTeacher")
  135. @PreAuthorize("@pcs.hasPermissions('classGroup/findMusicGroupClassTeacher')")
  136. public HttpResponseResult findMusicGroupClassTeacher(@ApiParam(value = "乐团编号", required = true) @RequestParam String musicGroupId) {
  137. return succeed(classGroupService.getClassGroupAndTeachers(musicGroupId, "NORMAL,MIX"));
  138. }
  139. @ApiOperation(value = "获取乐团班级老师课酬")
  140. @GetMapping("/findMusicGroupClassTeacherSalary")
  141. @PreAuthorize("@pcs.hasPermissions('classGroup/findMusicGroupClassTeacherSalary')")
  142. @ApiImplicitParams({@ApiImplicitParam(name = "musicGroupId", value = "乐团编号", required = true, dataType = "String"),
  143. @ApiImplicitParam(name = "type", value = "结算类型(1-基准课酬,4-梯度课酬)", required = true, dataType = "Integer")})
  144. public HttpResponseResult findMusicGroupClassTeacherSalary(String musicGroupId, SalarySettlementTypeEnum type) {
  145. try {
  146. return succeed(classGroupService.getClassGroupAndTeacherSalary(musicGroupId, type));
  147. } catch (Exception e) {
  148. return failed(e.getMessage());
  149. }
  150. }
  151. @ApiOperation(value = "乐团班级老师课酬确认")
  152. @PostMapping("/setClassGroupTeacherSalary")
  153. @PreAuthorize("@pcs.hasPermissions('classGroup/setClassGroupTeacherSalary')")
  154. @ApiParam(value = "乐团班级老师<包含相应课酬>json", required = true)
  155. public Object setClassGroupTeacherSalary(@RequestBody List<ClassGroupTeacherMapper> classGroupTeacherMapperList) throws Exception {
  156. if (classGroupTeacherMapperList.size() <= 0) {
  157. return failed("参数不合法");
  158. }
  159. return succeed(classGroupTeacherMapperService.classGroupTeacherMapperUpdate(classGroupTeacherMapperList));
  160. }
  161. @ApiOperation(value = "乐团班级设置,成团确认")
  162. @PostMapping("/addMusicGroupTeam")
  163. @PreAuthorize("@pcs.hasPermissions('classGroup/addMusicGroupTeam')")
  164. @ApiImplicitParams({@ApiImplicitParam(name = "musicGroupId", value = "乐团编号", required = true, dataType = "String"),
  165. @ApiImplicitParam(name = "teacherId", value = "老师编号", required = true, dataType = "Integer")})
  166. public Object addMusicGroupTeam(Integer teacherId, String musicGroupId, Integer improventClassesNum) throws Exception {
  167. if (teacherId == null || StringUtils.isEmpty(musicGroupId) || improventClassesNum == null) {
  168. return failed("参数校验错误");
  169. }
  170. classGroupService.addMusicGroupTeam(teacherId, musicGroupId, improventClassesNum);
  171. return succeed();
  172. }
  173. @ApiOperation(value = "调整班级(添加班级)")
  174. @PostMapping("/revisionClassGroup")
  175. @PreAuthorize("@pcs.hasPermissions('classGroup/revisionClassGroup')")
  176. @ApiImplicitParams({@ApiImplicitParam(name = "classGroupIds", value = "班级编号,号分割", required = true, dataType = "String")})
  177. public HttpResponseResult revisionClassGroup(@RequestBody ClassGroupAdjustDto classGroupAdjustDto) throws Exception {
  178. return succeed(classGroupService.classGroupAdjust(classGroupAdjustDto));
  179. }
  180. }