MockApplyController.java 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. package com.zhongzheng.controller.mock;
  2. import cn.hutool.core.lang.Validator;
  3. import com.zhongzheng.common.annotation.Log;
  4. import com.zhongzheng.common.core.controller.BaseController;
  5. import com.zhongzheng.common.core.domain.AjaxResult;
  6. import com.zhongzheng.common.core.page.TableDataInfo;
  7. import com.zhongzheng.common.enums.BusinessType;
  8. import com.zhongzheng.common.utils.ServletUtils;
  9. import com.zhongzheng.common.utils.poi.ExcelUtil;
  10. import com.zhongzheng.framework.web.service.WxTokenService;
  11. import com.zhongzheng.modules.course.bo.CourseSectionQueryBo;
  12. import com.zhongzheng.modules.mock.bo.MockApplyAddBo;
  13. import com.zhongzheng.modules.mock.bo.MockApplyEditBo;
  14. import com.zhongzheng.modules.mock.bo.MockApplyQueryBo;
  15. import com.zhongzheng.modules.mock.domain.MockMajorSubject;
  16. import com.zhongzheng.modules.mock.service.IMockApplyService;
  17. import com.zhongzheng.modules.mock.vo.MockApplyVo;
  18. import com.zhongzheng.modules.mock.vo.MockMajorSubjectVo;
  19. import com.zhongzheng.modules.user.entity.ClientLoginUser;
  20. import io.swagger.annotations.Api;
  21. import io.swagger.annotations.ApiOperation;
  22. import lombok.RequiredArgsConstructor;
  23. import org.springframework.beans.factory.annotation.Autowired;
  24. import org.springframework.security.access.prepost.PreAuthorize;
  25. import org.springframework.web.bind.annotation.*;
  26. import java.util.Arrays;
  27. import java.util.List;
  28. /**
  29. * 模考安排Controller
  30. *
  31. * @author ruoyi
  32. * @date 2022-05-24
  33. */
  34. @Api(value = "模考安排控制器", tags = {"模考安排管理"})
  35. @RequiredArgsConstructor(onConstructor_ = @Autowired)
  36. @RestController
  37. @RequestMapping("/mock/apply")
  38. public class MockApplyController extends BaseController {
  39. private final IMockApplyService iMockApplyService;
  40. private final WxTokenService wxTokenService;
  41. /**
  42. * 查询模考安排列表
  43. */
  44. @ApiOperation("查询模考安排列表")
  45. @PreAuthorize("@ss.hasPermi('system:apply:list')")
  46. @GetMapping("/list")
  47. public TableDataInfo<MockApplyVo> list(MockApplyQueryBo bo) {
  48. startPage();
  49. List<MockApplyVo> list = iMockApplyService.queryList(bo);
  50. return getDataTable(list);
  51. }
  52. /**
  53. * 导出模考安排列表
  54. */
  55. @ApiOperation("导出模考安排列表")
  56. @PreAuthorize("@ss.hasPermi('system:apply:export')")
  57. @Log(title = "模考安排", businessType = BusinessType.EXPORT)
  58. @GetMapping("/export")
  59. public AjaxResult<MockApplyVo> export(MockApplyQueryBo bo) {
  60. List<MockApplyVo> list = iMockApplyService.queryList(bo);
  61. ExcelUtil<MockApplyVo> util = new ExcelUtil<MockApplyVo>(MockApplyVo.class);
  62. return util.exportExcel(list, "模考安排");
  63. }
  64. /**
  65. * 获取模考安排详细信息
  66. */
  67. @ApiOperation("获取模考安排详细信息")
  68. @PreAuthorize("@ss.hasPermi('system:apply:query')")
  69. @GetMapping("/{applyId}")
  70. public AjaxResult<MockApplyVo> getInfo(@PathVariable("applyId" ) Long applyId) {
  71. return AjaxResult.success(iMockApplyService.queryById(applyId));
  72. }
  73. /**
  74. * 新增模考安排
  75. */
  76. @ApiOperation("新增模考安排")
  77. @PreAuthorize("@ss.hasPermi('system:apply:add')")
  78. @Log(title = "模考安排", businessType = BusinessType.INSERT)
  79. @PostMapping()
  80. public AjaxResult<Void> add(@RequestBody MockApplyAddBo bo) {
  81. return toAjax(iMockApplyService.insertByAddBo(bo) ? 1 : 0);
  82. }
  83. /**
  84. * 修改模考安排
  85. */
  86. @ApiOperation("修改模考安排")
  87. @PreAuthorize("@ss.hasPermi('system:apply:edit')")
  88. @Log(title = "模考安排", businessType = BusinessType.UPDATE)
  89. @PutMapping()
  90. public AjaxResult<Void> edit(@RequestBody MockApplyEditBo bo) {
  91. return toAjax(iMockApplyService.updateByEditBo(bo) ? 1 : 0);
  92. }
  93. /**
  94. * 删除模考安排
  95. */
  96. @ApiOperation("删除模考安排")
  97. @PreAuthorize("@ss.hasPermi('system:apply:remove')")
  98. @Log(title = "模考安排" , businessType = BusinessType.DELETE)
  99. @DeleteMapping("/{applyIds}")
  100. public AjaxResult<Void> remove(@PathVariable Long[] applyIds) {
  101. return toAjax(iMockApplyService.deleteWithValidByIds(Arrays.asList(applyIds), true) ? 1 : 0);
  102. }
  103. /**
  104. * 查询模考安排列表
  105. */
  106. @ApiOperation("查询模考安排列表")
  107. @PreAuthorize("@ss.hasPermi('system:apply:list')")
  108. @GetMapping("/listApply")
  109. public TableDataInfo<MockApplyVo> listApply(MockApplyQueryBo bo){
  110. startPage();
  111. ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
  112. bo.setUserId(loginUser.getUser().getUserId());
  113. List<MockApplyVo> list = iMockApplyService.queryApplyList(bo);
  114. return getDataTable(list);
  115. }
  116. /**
  117. * 查询模考预约业务层次列表
  118. */
  119. @ApiOperation("查询模考预约业务层次列表")
  120. @PreAuthorize("@ss.hasPermi('system:apply:list')")
  121. @GetMapping("/listApplyBusiness")
  122. public TableDataInfo<MockApplyVo> listApplyBusiness(MockApplyQueryBo bo) {
  123. ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
  124. bo.setUserId(loginUser.getUser().getUserId());
  125. List<MockApplyVo> list = iMockApplyService.listApplyBusiness(bo);
  126. return getDataTable(list);
  127. }
  128. /**
  129. * 查询模考讲解直播列表
  130. */
  131. @ApiOperation("查询模考讲解直播列表")
  132. @PreAuthorize("@ss.hasPermi('system:apply:list')")
  133. @GetMapping("/listMockLive")
  134. public TableDataInfo<MockMajorSubjectVo> listMockLive(MockApplyQueryBo bo) {
  135. Integer pageNum = 0;
  136. Integer pageSize = 0;
  137. if (Validator.isNotEmpty(bo.getPageNum()) && Validator.isNotEmpty(bo.getPageSize())) {
  138. pageNum = bo.getPageNum();
  139. pageSize = bo.getPageSize();
  140. bo.setPageNum(null);
  141. bo.setPageSize(null);
  142. }
  143. List<MockMajorSubjectVo> list = iMockApplyService.listMockLive(bo);
  144. bo.setPageNum(pageNum);
  145. bo.setPageSize(pageSize);
  146. if (Validator.isEmpty(bo.getPageNum()) || Validator.isEmpty(bo.getPageSize())) {
  147. return getDataTable(list);
  148. }
  149. return getDataTable(getPageInfo(pageNum, pageSize, list).getList());
  150. }
  151. /**
  152. * 查询是否有模考讲解直播正在进行
  153. * @return
  154. */
  155. @ApiOperation("查询是否有模考讲解直播正在进行")
  156. @PreAuthorize("@ss.hasPermi('system:apply:list')")
  157. @GetMapping("/mockLiving")
  158. public AjaxResult<CourseSectionQueryBo> mockLiving() {
  159. ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
  160. return AjaxResult.success(iMockApplyService.mockLiving(loginUser.getUser().getUserId()));
  161. }
  162. /**
  163. * 获取模考标题
  164. */
  165. @ApiOperation("获取模考标题")
  166. @PreAuthorize("@ss.hasPermi('system:apply:list')")
  167. @GetMapping("/listApplyName")
  168. public TableDataInfo<MockMajorSubjectVo> listApplyName(MockApplyQueryBo bo) {
  169. List<MockMajorSubjectVo> list = iMockApplyService.listApplyName(bo);
  170. return getDataTable(list);
  171. }
  172. }