ExamApplyController.java 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  1. package com.zhongzheng.controller.exam;
  2. import com.alibaba.fastjson.JSONObject;
  3. import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
  4. import com.baomidou.mybatisplus.core.toolkit.StringUtils;
  5. import com.zhongzheng.common.annotation.Log;
  6. import com.zhongzheng.common.core.controller.BaseController;
  7. import com.zhongzheng.common.core.domain.AjaxResult;
  8. import com.zhongzheng.common.core.page.TableDataInfo;
  9. import com.zhongzheng.common.enums.BusinessType;
  10. import com.zhongzheng.common.exception.CustomException;
  11. import com.zhongzheng.common.utils.poi.EasyPoiUtil;
  12. import com.zhongzheng.modules.base.bo.UserProfileQueryBo;
  13. import com.zhongzheng.modules.exam.bo.*;
  14. import com.zhongzheng.modules.exam.service.IExamApplyGoodsService;
  15. import com.zhongzheng.modules.exam.service.IExamApplyService;
  16. import com.zhongzheng.modules.exam.service.IExamApplySiteService;
  17. import com.zhongzheng.modules.exam.service.IExamApplyUserService;
  18. import com.zhongzheng.modules.exam.vo.*;
  19. import io.swagger.annotations.Api;
  20. import io.swagger.annotations.ApiOperation;
  21. import lombok.RequiredArgsConstructor;
  22. import org.springframework.beans.factory.annotation.Autowired;
  23. import org.springframework.security.access.prepost.PreAuthorize;
  24. import org.springframework.web.bind.annotation.*;
  25. import org.springframework.web.multipart.MultipartFile;
  26. import java.util.List;
  27. /**
  28. * 考试安排Controller
  29. *
  30. * @author ruoyi
  31. * @date 2021-12-07
  32. */
  33. @Api(value = "考试安排控制器", tags = {"考试安排管理"})
  34. @RequiredArgsConstructor(onConstructor_ = @Autowired)
  35. @RestController
  36. @RequestMapping("/system/apply")
  37. public class ExamApplyController extends BaseController {
  38. private final IExamApplyService iExamApplyService;
  39. private final IExamApplySiteService iExamApplySiteService;
  40. private final IExamApplyGoodsService iExamApplyGoodsService;
  41. private final IExamApplyUserService iExamApplyUserService;
  42. /**
  43. * 查询考试安排列表
  44. */
  45. @ApiOperation("查询考试安排列表")
  46. @PreAuthorize("@ss.hasPermi('system:apply:list')")
  47. @GetMapping("/list")
  48. public TableDataInfo<ExamApplyVo> list(ExamApplyQueryBo bo) {
  49. startPage();
  50. List<ExamApplyVo> list = iExamApplyService.queryList(bo);
  51. return getDataTable(list);
  52. }
  53. /**
  54. * 查询考场列表
  55. */
  56. @ApiOperation("查询考场列表")
  57. @GetMapping("/place")
  58. public TableDataInfo<ExamApplyPlaceVo> placeList(ExamApplyRoomQueryBo bo) {
  59. startPage();
  60. List<ExamApplyPlaceVo> list = iExamApplyService.getPlaceList(bo);
  61. return getDataTable(list);
  62. }
  63. /**
  64. * 获取七大员考前需知
  65. */
  66. @ApiOperation("获取七大员考前需知")
  67. @GetMapping("/before/know")
  68. public AjaxResult<ExamBeforeKnowVo> getBeforeKnow() {
  69. return AjaxResult.success(iExamApplyService.getBeforeKnow());
  70. }
  71. /**
  72. * 七大员考前需知新增/修改
  73. */
  74. @ApiOperation("七大员考前需知新增/修改")
  75. @PostMapping("/saveorup/before/know")
  76. public AjaxResult<Void> saveOrUpBeforeKnow(@RequestBody ExamBeforeKnowBo bo) {
  77. return toAjax(iExamApplyService.saveOrUpBeforeKnow(bo)? 1 : 0);
  78. }
  79. /**
  80. * 考场邮件信息
  81. */
  82. @ApiOperation("考场邮件地址")
  83. @GetMapping("/sendmail")
  84. public AjaxResult getSendmailUrl(ExamApplyQueryBo bo) {
  85. String url = iExamApplyService.getSendmailUrl(bo.getIds());
  86. return AjaxResult.success(url);
  87. }
  88. /**
  89. * 考场邮件发送
  90. */
  91. @ApiOperation("考场邮件发送")
  92. @PostMapping("/send")
  93. public AjaxResult<Void> sendmail(@RequestBody ExamApplySendmailBo bo) {
  94. return toAjax(iExamApplyService.sendmail(bo)? 1 : 0);
  95. }
  96. /**
  97. * 获取考试安排详细信息
  98. */
  99. @ApiOperation("获取考试安排详细信息")
  100. @PreAuthorize("@ss.hasPermi('system:apply:query')")
  101. @GetMapping("/{applyId}")
  102. public AjaxResult<ExamApplyVo> getInfo(@PathVariable("applyId" ) Long applyId) {
  103. return AjaxResult.success(iExamApplyService.queryById(applyId));
  104. }
  105. /**
  106. * 获取考试地点 考培地点
  107. */
  108. @ApiOperation("获取考试地点 考培地点")
  109. @PreAuthorize("@ss.hasPermi('system:apply:query')")
  110. @GetMapping("/siteInfo")
  111. public TableDataInfo<ExamApplySiteVo> getSiteInfo(ExamApplyQueryBo bo) {
  112. List<ExamApplySiteVo> examApplySiteVo = iExamApplyService.getSiteInfo(bo);
  113. return getDataTable(examApplySiteVo);
  114. }
  115. /**
  116. * 新增考试安排
  117. */
  118. @ApiOperation("新增考试安排")
  119. @PreAuthorize("@ss.hasPermi('system:apply:add')")
  120. @Log(title = "考试安排", businessType = BusinessType.INSERT)
  121. @PostMapping()
  122. public AjaxResult<Void> add(@RequestBody ExamApplyAddBo bo) {
  123. return toAjax(iExamApplyService.insertByAddBo(bo) ? 1 : 0);
  124. }
  125. /**
  126. * 新增考试安排
  127. */
  128. @ApiOperation("新增考试安排")
  129. @PostMapping("/save")
  130. public AjaxResult<Void> saveExamApply(MultipartFile file, String param) {
  131. if (StringUtils.isBlank(param)){
  132. throw new CustomException("参数有误!");
  133. }
  134. ExamApplyAddBo addBo = JSONObject.parseObject(param, ExamApplyAddBo.class);
  135. if (ObjectUtils.isNotNull(file)){
  136. //学员资料解析
  137. List<ExamApplyUserImportBo> applyUsers = EasyPoiUtil.importExcel(file,0,1,ExamApplyUserImportBo.class);
  138. addBo.setApplyUsers(applyUsers);
  139. }
  140. return toAjax(iExamApplyService.saveExamApply(addBo) ? 1 : 0);
  141. }
  142. /**
  143. * 修改考试安排
  144. */
  145. @ApiOperation("修改考试安排")
  146. @PreAuthorize("@ss.hasPermi('system:apply:edit')")
  147. @Log(title = "考试安排", businessType = BusinessType.UPDATE)
  148. @PostMapping("edit")
  149. public AjaxResult<Void> edit(@RequestBody ExamApplyEditBo bo) {
  150. return toAjax(iExamApplyService.updateByEditBo(bo) ? 1 : 0);
  151. }
  152. /**
  153. * 修改考试安排
  154. */
  155. @ApiOperation("修改考试安排")
  156. @PostMapping("/editApply")
  157. public AjaxResult<Void> editExamApply(MultipartFile file, String param) {
  158. if (StringUtils.isBlank(param)){
  159. throw new CustomException("参数有误!");
  160. }
  161. ExamApplyEditBo editBo = JSONObject.parseObject(param, ExamApplyEditBo.class);
  162. if (ObjectUtils.isNotNull(file)){
  163. //学员资料解析
  164. List<ExamApplyUserImportBo> applyUsers = EasyPoiUtil.importExcel(file,0,1,ExamApplyUserImportBo.class);
  165. editBo.setApplyUsers(applyUsers);
  166. }
  167. return toAjax(iExamApplyService.editExamApply(editBo) ? 1 : 0);
  168. }
  169. /**
  170. * 新增考试安排地点
  171. */
  172. @ApiOperation("新增考试安排地点")
  173. @PreAuthorize("@ss.hasPermi('system:site:add')")
  174. @Log(title = "考试安排地点", businessType = BusinessType.INSERT)
  175. @PostMapping("addSite")
  176. public AjaxResult<Void> addSite(@RequestBody List<ExamApplySiteAddBo> bo) {
  177. return toAjax(iExamApplySiteService.addSite(bo) ? 1 : 0);
  178. }
  179. /**
  180. * 新增考试安排绑定商品
  181. */
  182. @ApiOperation("新增考试安排绑定商品")
  183. @PreAuthorize("@ss.hasPermi('system:goods:add')")
  184. @Log(title = "考试安排绑定商品", businessType = BusinessType.INSERT)
  185. @PostMapping("addGoods")
  186. public AjaxResult<Void> addGoods(@RequestBody ExamApplyGoodsAddBo bo) {
  187. return toAjax(iExamApplyGoodsService.addGoods(bo) ? 1 : 0);
  188. }
  189. /**
  190. * 获取考试地点 考培地点
  191. */
  192. @ApiOperation("查看考试安排绑定商品")
  193. @PreAuthorize("@ss.hasPermi('system:apply:query')")
  194. @GetMapping("/goodsInfo")
  195. public AjaxResult<ExamApplyVo> getGoodsInfo(ExamApplyQueryBo bo) {
  196. ExamApplyVo examApplyVos = iExamApplyService.getGoodsInfo(bo);
  197. return AjaxResult.success(examApplyVos);
  198. }
  199. /**
  200. * 查看考试安排被预约数量
  201. */
  202. @ApiOperation("查看考试安排被预约数量")
  203. @PreAuthorize("@ss.hasPermi('system:apply:query')")
  204. @GetMapping("/countApplySubscribe")
  205. public AjaxResult<Integer> countApplySubscribe(ExamApplyQueryBo bo) {
  206. Integer subNum = iExamApplyService.countApplySubscribe(bo);
  207. return AjaxResult.success(subNum);
  208. }
  209. /**
  210. * 查询考试配置绑定商品列表
  211. */
  212. @ApiOperation("查询考试安排商品列表")
  213. @PreAuthorize("@ss.hasPermi('system:goods:list')")
  214. @GetMapping("/listGoods")
  215. public TableDataInfo<ExamNumberGoodsVo> listGoods(ExamNumberGoodsQueryBo bo) {
  216. startPage();
  217. List<ExamNumberGoodsVo> list = iExamApplyService.listGoods(bo);
  218. return getDataTable(list);
  219. }
  220. /**
  221. * 查询考试配置绑定用户列表
  222. */
  223. @ApiOperation("查询考试配置绑定用户列表")
  224. @PreAuthorize("@ss.hasPermi('system:goods:list')")
  225. @GetMapping("/listUser")
  226. public TableDataInfo<ExamApplyUserVo> listUser(ExamApplyUserQueryBo bo) {
  227. startPage();
  228. List<ExamApplyUserVo> list = iExamApplyUserService.listUser(bo);
  229. return getDataTable(list);
  230. }
  231. /**
  232. * 获取考试关联的前培安排
  233. */
  234. @ApiOperation("获取考试关联的前培安排")
  235. @GetMapping("/getBefore/{applyId}")
  236. public AjaxResult<ExamBeforeVo> getBeforeByApplyId(@PathVariable("applyId" ) Long applyId) {
  237. ExamBeforeVo vo = iExamApplyUserService.getBeforeByApplyId(applyId);
  238. return AjaxResult.success(vo);
  239. }
  240. @ApiOperation("七大员学员资料批量变更")
  241. @PostMapping("/user/profile")
  242. public AjaxResult updateExamUserProfile(MultipartFile file) {
  243. iExamApplyService.updateExamUserProfile(file);
  244. return AjaxResult.success();
  245. }
  246. @ApiOperation("七大员学员资料导出")
  247. @PostMapping("/user/profile/export")
  248. public AjaxResult examUserProfileExport(@RequestBody UserProfileQueryBo bo) {
  249. return AjaxResult.success(iExamApplyService.examUserProfileExport(bo));
  250. }
  251. @ApiOperation("修改考场人数")
  252. @PostMapping ("/update/applyNum")
  253. public AjaxResult updateApplyNum(@RequestBody UpdateApplyNumBo bo) {
  254. return toAjax(iExamApplyService.updateApplyNum(bo) ? 1 : 0);
  255. }
  256. }