ExamCardController.java 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. package com.qmth.distributed.print.api;
  2. import com.baomidou.mybatisplus.core.metadata.IPage;
  3. import com.qmth.boot.api.constant.ApiConstant;
  4. import com.qmth.distributed.print.business.bean.dto.CardCustDto;
  5. import com.qmth.distributed.print.business.bean.dto.CardDetailDto;
  6. import com.qmth.distributed.print.business.bean.params.ExamCardParams;
  7. import com.qmth.distributed.print.business.bean.params.GenericExamCardParams;
  8. import com.qmth.distributed.print.business.entity.ExamCard;
  9. import com.qmth.distributed.print.business.service.BasicPrintConfigService;
  10. import com.qmth.distributed.print.business.service.ExamCardService;
  11. import com.qmth.teachcloud.common.bean.params.ArraysParams;
  12. import com.qmth.teachcloud.common.contant.SystemConstant;
  13. import com.qmth.teachcloud.common.entity.BasicPrintConfig;
  14. import com.qmth.teachcloud.common.util.Result;
  15. import com.qmth.teachcloud.common.util.ResultUtil;
  16. import io.swagger.annotations.Api;
  17. import io.swagger.annotations.ApiOperation;
  18. import org.springframework.validation.annotation.Validated;
  19. import org.springframework.web.bind.annotation.*;
  20. import javax.annotation.Resource;
  21. import javax.servlet.http.HttpServletResponse;
  22. import javax.validation.constraints.Max;
  23. import javax.validation.constraints.Min;
  24. import java.util.List;
  25. /**
  26. * <p>
  27. * 题卡 前端控制器
  28. * </p>
  29. *
  30. * @author xf
  31. * @since 2021-03-23
  32. */
  33. @Api(tags = "题卡Controller")
  34. @RestController
  35. @RequestMapping(ApiConstant.DEFAULT_URI_PREFIX + "/${prefix.url.exam}/card")
  36. @Validated
  37. public class ExamCardController {
  38. @Resource
  39. private ExamCardService examCardService;
  40. @Resource
  41. private BasicPrintConfigService basicPrintConfigService;
  42. //====================================通卡接口(start)===================================
  43. /**
  44. * 题卡管理(通卡管理)
  45. * @param type 题卡类型(通卡或专卡)
  46. * @param title 题卡名称模糊查询
  47. * @param createMethod 题卡创建方式(上传、自定义)
  48. * @param enable 1正常/0禁用
  49. * @param createStartTime 创建时间(开始)
  50. * @param createEndTime 创建时间(结束)
  51. * @param pageNumber 分页参数
  52. * @param pageSize 分页参数
  53. * @return Result
  54. */
  55. @ApiOperation(value = "分页查询")
  56. @RequestMapping(value = "/page", method = RequestMethod.POST)
  57. public Result page(@RequestParam(value = "type", defaultValue = "GENERIC") String type,
  58. @RequestParam(value = "title", required = false) String title,
  59. @RequestParam(value = "createMethod", required = false) String createMethod,
  60. @RequestParam(value = "enable", required = false) Boolean enable,
  61. @RequestParam(value = "createStartTime", required = false) Long createStartTime,
  62. @RequestParam(value = "createEndTime", required = false) Long createEndTime,
  63. @RequestParam @Min(SystemConstant.PAGE_NUMBER_MIN) Integer pageNumber,
  64. @RequestParam @Min(SystemConstant.PAGE_SIZE_MIN) @Max(SystemConstant.PAGE_SIZE_MAX) Integer pageSize) {
  65. IPage<ExamCard> examCardIPage = examCardService.listPage(type, title, createMethod, enable, createStartTime, createEndTime, pageNumber, pageSize);
  66. return ResultUtil.ok(examCardIPage);
  67. }
  68. /**
  69. * 题卡管理(通卡管理)-新增/修改
  70. * @param params 保存传值参数
  71. * @return Result
  72. */
  73. @ApiOperation(value = "新增/修改")
  74. @RequestMapping(value = "/save_generic", method = RequestMethod.POST)
  75. public Result save(@RequestBody GenericExamCardParams params) throws Exception {
  76. Long id = examCardService.saveGeneric(params);
  77. return ResultUtil.ok(String.valueOf(id),"");
  78. }
  79. /**
  80. * 题卡管理(通卡管理)-删除
  81. * @param id 题卡ID
  82. * @return Result
  83. */
  84. @ApiOperation(value = "删除")
  85. @RequestMapping(value = "/delete_generic", method = RequestMethod.POST)
  86. public Result save(@RequestParam(value = "id") Long id) {
  87. Boolean success = examCardService.deleteGeneric(id);
  88. return ResultUtil.ok(success);
  89. }
  90. //====================================通卡接口↑(end)===================================
  91. /**
  92. * 新建
  93. *
  94. * @param examCardParams
  95. * @return
  96. */
  97. @ApiOperation(value = "新建")
  98. @RequestMapping(value = "/save", method = RequestMethod.POST)
  99. public Result save(@RequestBody ExamCardParams examCardParams) throws Exception {
  100. String cardId = examCardService.saveExamCard(examCardParams);
  101. return ResultUtil.ok(cardId, "");
  102. }
  103. /**
  104. * 客服制卡申请
  105. *
  106. * @param examCardParams
  107. * @return
  108. */
  109. @ApiOperation(value = "客服制卡申请")
  110. @RequestMapping(value = "/cust_save", method = RequestMethod.POST)
  111. public Result custSave(@RequestBody ExamCardParams examCardParams) {
  112. String cardId = examCardService.saveExamCardCust(examCardParams);
  113. return ResultUtil.ok(cardId, "");
  114. }
  115. /**
  116. * 客服制卡审核查询
  117. *
  118. * @param schoolId
  119. * @param status
  120. * @param paperNumber
  121. * @param userId
  122. * @param applyStartTime
  123. * @param applyEndTime
  124. * @param finishStartTime
  125. * @param finishEndTime
  126. * @param pageNumber
  127. * @param pageSize
  128. * @return
  129. */
  130. @ApiOperation(value = "客服制卡审核查询")
  131. @RequestMapping(value = "/cust_list", method = RequestMethod.POST)
  132. public Result list(@RequestParam(value = "schoolId", required = false) String schoolId,
  133. @RequestParam(value = "status", required = false) String status,
  134. @RequestParam(value = "paperNumber", required = false) String paperNumber,
  135. @RequestParam(value = "userId", required = false) String userId,
  136. @RequestParam(value = "applyStartTime", required = false) Long applyStartTime,
  137. @RequestParam(value = "applyEndTime", required = false) Long applyEndTime,
  138. @RequestParam(value = "finishStartTime", required = false) Long finishStartTime,
  139. @RequestParam(value = "finishEndTime", required = false) Long finishEndTime,
  140. @RequestParam @Min(SystemConstant.PAGE_NUMBER_MIN) Integer pageNumber,
  141. @RequestParam @Min(SystemConstant.PAGE_SIZE_MIN) @Max(SystemConstant.PAGE_SIZE_MAX) Integer pageSize) {
  142. IPage<CardCustDto> cardCustDtoIPage = examCardService.listCardCust(schoolId, status, paperNumber, userId, applyStartTime, applyEndTime, finishStartTime, finishEndTime, pageNumber, pageSize);
  143. return ResultUtil.ok(cardCustDtoIPage);
  144. }
  145. /**
  146. * 根据ID获取题卡详情
  147. *
  148. * @param cardId
  149. * @return
  150. */
  151. @ApiOperation(value = "根据ID获取题卡详情")
  152. @RequestMapping(value = "/get_one", method = RequestMethod.POST)
  153. public Result getOne(@RequestParam("cardId") Long cardId) {
  154. CardDetailDto cardDetailDto = examCardService.getCardDetail(cardId);
  155. return ResultUtil.ok(cardDetailDto);
  156. }
  157. /**
  158. * 选择已有题卡列表
  159. * @param examId 考试id
  160. * @param courseCode 课程编号
  161. * @return 结果
  162. */
  163. @ApiOperation(value = "选择已有题卡列表")
  164. @RequestMapping(value = "/select_card_list", method = RequestMethod.POST)
  165. public Result selectCardList(@RequestParam String examId,@RequestParam String courseCode, @RequestParam(required = false) String paperNumber) {
  166. BasicPrintConfig basicPrintConfig = basicPrintConfigService.getByExamIdAndCourseCode(SystemConstant.convertIdToLong(examId),courseCode);
  167. List<ExamCard> list = examCardService.listSelectCard(courseCode, basicPrintConfig.getCardRuleId(), paperNumber);
  168. return ResultUtil.ok(list);
  169. }
  170. /**
  171. * 批量下载客服制卡文件
  172. *
  173. * @param response
  174. * @param arraysParams
  175. */
  176. @ApiOperation(value = "批量下载文件")
  177. @RequestMapping(value = "/download_files", method = RequestMethod.POST)
  178. public void taskPaperDownload(HttpServletResponse response, @RequestBody ArraysParams arraysParams) throws Exception {
  179. examCardService.downloadFiles(response, arraysParams);
  180. }
  181. /**
  182. * 复制题卡
  183. *
  184. * @param id 题卡id
  185. */
  186. @ApiOperation(value = "复制题卡")
  187. @RequestMapping(value = "/copy", method = RequestMethod.POST)
  188. public Result copyCard(@RequestParam(value = "id") String id,
  189. @RequestParam(value = "courseCode") String courseCode) {
  190. Long copyCardId = examCardService.copyCard(SystemConstant.convertIdToLong(id),courseCode);
  191. return ResultUtil.ok(String.valueOf(copyCardId), "");
  192. }
  193. }