package com.qmth.distributed.print.api; import com.baomidou.mybatisplus.core.metadata.IPage; import com.qmth.boot.api.constant.ApiConstant; import com.qmth.distributed.print.business.bean.dto.CardCustDto; import com.qmth.distributed.print.business.bean.dto.CardDetailDto; import com.qmth.distributed.print.business.bean.dto.ExamCardPageDto; import com.qmth.distributed.print.business.bean.params.ExamCardParams; import com.qmth.distributed.print.business.bean.params.GenericExamCardParams; import com.qmth.distributed.print.business.entity.ExamCard; import com.qmth.distributed.print.business.service.BasicPrintConfigService; import com.qmth.distributed.print.business.service.ExamCardService; import com.qmth.teachcloud.common.annotation.OperationLogDetail; import com.qmth.teachcloud.common.bean.params.ArraysParams; import com.qmth.teachcloud.common.contant.SystemConstant; import com.qmth.teachcloud.common.entity.BasicPrintConfig; import com.qmth.teachcloud.common.enums.log.CustomizedOperationTypeEnum; import com.qmth.teachcloud.common.util.Result; import com.qmth.teachcloud.common.util.ResultUtil; import io.swagger.annotations.Api; import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiOperation; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; import javax.validation.constraints.Max; import javax.validation.constraints.Min; import java.util.List; /** *

* 题卡 前端控制器 *

* * @author xf * @since 2021-03-23 */ @Api(tags = "题卡Controller") @RestController @RequestMapping(ApiConstant.DEFAULT_URI_PREFIX + SystemConstant.PREFIX_URL_EXAM + "/card") @Validated public class ExamCardController { @Resource private ExamCardService examCardService; @Resource private BasicPrintConfigService basicPrintConfigService; //====================================通卡接口(start)=================================== /** * 题卡管理 * * @param cardType 题卡类型(通卡或专卡) * @param title 题卡名称模糊查询 * @param createMethod 题卡创建方式(上传、自定义) * @param enable 1正常/0禁用 * @param createStartTime 创建时间(开始) * @param createEndTime 创建时间(结束) * @param pageNumber 分页参数 * @param pageSize 分页参数 * @return Result */ @ApiOperation(value = "分页查询") @RequestMapping(value = "/page", method = RequestMethod.POST) public Result page(@RequestParam(value = "cardType", required = false) String cardType, @RequestParam(value = "title", required = false) String title, @RequestParam(value = "createMethod", required = false) String createMethod, @RequestParam(value = "enable", required = false) Boolean enable, @RequestParam(value = "createStartTime", required = false) Long createStartTime, @RequestParam(value = "createEndTime", required = false) Long createEndTime, @RequestParam @Min(SystemConstant.PAGE_NUMBER_MIN) Integer pageNumber, @RequestParam @Min(SystemConstant.PAGE_SIZE_MIN) @Max(SystemConstant.PAGE_SIZE_MAX) Integer pageSize) { IPage examCardIPage = examCardService.listPage(cardType, title, createMethod, enable, createStartTime, createEndTime, pageNumber, pageSize); return ResultUtil.ok(examCardIPage); } /** * 题卡管理(通卡管理)-新增/修改 * * @param params 保存传值参数 * @return Result */ @ApiOperation(value = "新增/修改") @RequestMapping(value = "/save_generic", method = RequestMethod.POST) @OperationLogDetail(customizedOperationType = CustomizedOperationTypeEnum.EDIT) public Result save(@RequestBody GenericExamCardParams params) throws Exception { Long id = examCardService.saveGeneric(params); return ResultUtil.ok(String.valueOf(id), ""); } /** * 题卡管理(通卡管理)-删除 * * @param id 题卡ID * @return Result */ @ApiOperation(value = "删除") @RequestMapping(value = "/delete_generic", method = RequestMethod.POST) public Result save(@RequestParam(value = "id") Long id) { Boolean success = examCardService.deleteGeneric(id); return ResultUtil.ok(success); } //====================================通卡接口↑(end)=================================== /** * 新建专卡 * * @param examCardParams */ @ApiOperation(value = "新建") @RequestMapping(value = "/save", method = RequestMethod.POST) public Result save(@RequestBody ExamCardParams examCardParams) throws Exception { String cardId = examCardService.saveExamCard(examCardParams); return ResultUtil.ok(cardId, ""); } /** * 客服制卡申请 * * @param examCardParams * @return */ @ApiOperation(value = "客服制卡申请") @RequestMapping(value = "/cust_save", method = RequestMethod.POST) public Result custSave(@RequestBody ExamCardParams examCardParams) { String cardId = examCardService.saveExamCardCust(examCardParams); return ResultUtil.ok(cardId, ""); } /** * 客服制卡审核查询 * * @param schoolId * @param status * @param paperNumber * @param userId * @param applyStartTime * @param applyEndTime * @param finishStartTime * @param finishEndTime * @param pageNumber * @param pageSize * @return */ @ApiOperation(value = "客服制卡审核查询") @RequestMapping(value = "/cust_list", method = RequestMethod.POST) public Result list(@RequestParam(value = "schoolId", required = false) String schoolId, @RequestParam(value = "status", required = false) String status, @RequestParam(value = "paperNumber", required = false) String paperNumber, @RequestParam(value = "userId", required = false) String userId, @RequestParam(value = "applyStartTime", required = false) Long applyStartTime, @RequestParam(value = "applyEndTime", required = false) Long applyEndTime, @RequestParam(value = "finishStartTime", required = false) Long finishStartTime, @RequestParam(value = "finishEndTime", required = false) Long finishEndTime, @RequestParam @Min(SystemConstant.PAGE_NUMBER_MIN) Integer pageNumber, @RequestParam @Min(SystemConstant.PAGE_SIZE_MIN) @Max(SystemConstant.PAGE_SIZE_MAX) Integer pageSize) { IPage cardCustDtoIPage = examCardService.listCardCust(schoolId, status, paperNumber, userId, applyStartTime, applyEndTime, finishStartTime, finishEndTime, pageNumber, pageSize); return ResultUtil.ok(cardCustDtoIPage); } /** * 根据ID获取题卡详情 * * @param cardId * @return */ @ApiOperation(value = "根据ID获取题卡详情") @RequestMapping(value = "/get_one", method = RequestMethod.POST) public Result getOne(@RequestParam("cardId") Long cardId) { CardDetailDto cardDetailDto = examCardService.getCardDetail(cardId); return ResultUtil.ok(cardDetailDto); } /** * 选择已有题卡列表 * * @param examId 考试id * @param courseCode 课程编号 * @return 结果 */ @ApiOperation(value = "选择已有题卡列表") @RequestMapping(value = "/select_card_list", method = RequestMethod.POST) public Result selectCardList(@RequestParam String examId, @RequestParam String courseCode, @RequestParam(required = false) String paperNumber) { BasicPrintConfig basicPrintConfig = basicPrintConfigService.getByExamIdAndCourseCode(SystemConstant.convertIdToLong(examId), courseCode); List list = examCardService.listSelectCard(courseCode, basicPrintConfig.getCardRuleId(), paperNumber); return ResultUtil.ok(list); } /** * 批量下载客服制卡文件 * * @param response * @param arraysParams */ @ApiOperation(value = "批量下载文件") @RequestMapping(value = "/download_files", method = RequestMethod.POST) public void taskPaperDownload(HttpServletResponse response, @RequestBody ArraysParams arraysParams) throws Exception { examCardService.downloadFiles(response, arraysParams); } /** * 复制题卡 * * @param id 题卡id */ @ApiOperation(value = "复制题卡") @RequestMapping(value = "/copy", method = RequestMethod.POST) public Result copyCard(@RequestParam(value = "id") String id, @RequestParam(value = "courseCode") String courseCode) { Long copyCardId = examCardService.copyCard(SystemConstant.convertIdToLong(id), courseCode); return ResultUtil.ok(String.valueOf(copyCardId), ""); } /** * 题卡转图片 * * @param id 题卡id */ @ApiOperation(value = "题卡转图片") @RequestMapping(value = "/convert_image", method = RequestMethod.POST) public Result convertImage(@RequestParam(value = "id") String id) { examCardService.convertImage(SystemConstant.convertIdToLong(id)); return ResultUtil.ok(true, ""); } /** * 导出题卡pdf,html,json,jpg * * @param response * @param id 题卡ID */ @ApiOperation(value = "导出题卡文件") @RequestMapping(value = "/download_card", method = RequestMethod.POST) public void cardDownload(HttpServletResponse response, @RequestParam(value = "id") String id) { examCardService.cardDownload(response, id); } }