ClassGroupController.java 12 KB

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