| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289 |
- package com.zhongzheng.controller.exam;
- import com.alibaba.fastjson.JSONObject;
- import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
- import com.baomidou.mybatisplus.core.toolkit.StringUtils;
- import com.zhongzheng.common.annotation.Log;
- import com.zhongzheng.common.core.controller.BaseController;
- import com.zhongzheng.common.core.domain.AjaxResult;
- import com.zhongzheng.common.core.page.TableDataInfo;
- import com.zhongzheng.common.enums.BusinessType;
- import com.zhongzheng.common.exception.CustomException;
- import com.zhongzheng.common.utils.poi.EasyPoiUtil;
- import com.zhongzheng.modules.base.bo.UserProfileQueryBo;
- import com.zhongzheng.modules.exam.bo.*;
- import com.zhongzheng.modules.exam.service.IExamApplyGoodsService;
- import com.zhongzheng.modules.exam.service.IExamApplyService;
- import com.zhongzheng.modules.exam.service.IExamApplySiteService;
- import com.zhongzheng.modules.exam.service.IExamApplyUserService;
- import com.zhongzheng.modules.exam.vo.*;
- import io.swagger.annotations.Api;
- import io.swagger.annotations.ApiOperation;
- import lombok.RequiredArgsConstructor;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.security.access.prepost.PreAuthorize;
- import org.springframework.web.bind.annotation.*;
- import org.springframework.web.multipart.MultipartFile;
- import java.util.List;
- /**
- * 考试安排Controller
- *
- * @author ruoyi
- * @date 2021-12-07
- */
- @Api(value = "考试安排控制器", tags = {"考试安排管理"})
- @RequiredArgsConstructor(onConstructor_ = @Autowired)
- @RestController
- @RequestMapping("/system/apply")
- public class ExamApplyController extends BaseController {
- private final IExamApplyService iExamApplyService;
- private final IExamApplySiteService iExamApplySiteService;
- private final IExamApplyGoodsService iExamApplyGoodsService;
- private final IExamApplyUserService iExamApplyUserService;
- /**
- * 查询考试安排列表
- */
- @ApiOperation("查询考试安排列表")
- @PreAuthorize("@ss.hasPermi('system:apply:list')")
- @GetMapping("/list")
- public TableDataInfo<ExamApplyVo> list(ExamApplyQueryBo bo) {
- startPage();
- List<ExamApplyVo> list = iExamApplyService.queryList(bo);
- return getDataTable(list);
- }
- /**
- * 查询考场列表
- */
- @ApiOperation("查询考场列表")
- @GetMapping("/place")
- public TableDataInfo<ExamApplyPlaceVo> placeList(ExamApplyRoomQueryBo bo) {
- startPage();
- List<ExamApplyPlaceVo> list = iExamApplyService.getPlaceList(bo);
- return getDataTable(list);
- }
- /**
- * 获取七大员考前需知
- */
- @ApiOperation("获取七大员考前需知")
- @GetMapping("/before/know")
- public AjaxResult<ExamBeforeKnowVo> getBeforeKnow() {
- return AjaxResult.success(iExamApplyService.getBeforeKnow());
- }
- /**
- * 七大员考前需知新增/修改
- */
- @ApiOperation("七大员考前需知新增/修改")
- @PostMapping("/saveorup/before/know")
- public AjaxResult<Void> saveOrUpBeforeKnow(@RequestBody ExamBeforeKnowBo bo) {
- return toAjax(iExamApplyService.saveOrUpBeforeKnow(bo)? 1 : 0);
- }
- /**
- * 考场邮件信息
- */
- @ApiOperation("考场邮件地址")
- @GetMapping("/sendmail")
- public AjaxResult getSendmailUrl(ExamApplyQueryBo bo) {
- String url = iExamApplyService.getSendmailUrl(bo.getIds());
- return AjaxResult.success(url);
- }
- /**
- * 考场邮件发送
- */
- @ApiOperation("考场邮件发送")
- @PostMapping("/send")
- public AjaxResult<Void> sendmail(@RequestBody ExamApplySendmailBo bo) {
- return toAjax(iExamApplyService.sendmail(bo)? 1 : 0);
- }
- /**
- * 获取考试安排详细信息
- */
- @ApiOperation("获取考试安排详细信息")
- @PreAuthorize("@ss.hasPermi('system:apply:query')")
- @GetMapping("/{applyId}")
- public AjaxResult<ExamApplyVo> getInfo(@PathVariable("applyId" ) Long applyId) {
- return AjaxResult.success(iExamApplyService.queryById(applyId));
- }
- /**
- * 获取考试地点 考培地点
- */
- @ApiOperation("获取考试地点 考培地点")
- @PreAuthorize("@ss.hasPermi('system:apply:query')")
- @GetMapping("/siteInfo")
- public TableDataInfo<ExamApplySiteVo> getSiteInfo(ExamApplyQueryBo bo) {
- List<ExamApplySiteVo> examApplySiteVo = iExamApplyService.getSiteInfo(bo);
- return getDataTable(examApplySiteVo);
- }
- /**
- * 新增考试安排
- */
- @ApiOperation("新增考试安排")
- @PreAuthorize("@ss.hasPermi('system:apply:add')")
- @Log(title = "考试安排", businessType = BusinessType.INSERT)
- @PostMapping()
- public AjaxResult<Void> add(@RequestBody ExamApplyAddBo bo) {
- return toAjax(iExamApplyService.insertByAddBo(bo) ? 1 : 0);
- }
- /**
- * 新增考试安排
- */
- @ApiOperation("新增考试安排")
- @PostMapping("/save")
- public AjaxResult<Void> saveExamApply(MultipartFile file, String param) {
- if (StringUtils.isBlank(param)){
- throw new CustomException("参数有误!");
- }
- ExamApplyAddBo addBo = JSONObject.parseObject(param, ExamApplyAddBo.class);
- if (ObjectUtils.isNotNull(file)){
- //学员资料解析
- List<ExamApplyUserImportBo> applyUsers = EasyPoiUtil.importExcel(file,0,1,ExamApplyUserImportBo.class);
- addBo.setApplyUsers(applyUsers);
- }
- return toAjax(iExamApplyService.saveExamApply(addBo) ? 1 : 0);
- }
- /**
- * 修改考试安排
- */
- @ApiOperation("修改考试安排")
- @PreAuthorize("@ss.hasPermi('system:apply:edit')")
- @Log(title = "考试安排", businessType = BusinessType.UPDATE)
- @PostMapping("edit")
- public AjaxResult<Void> edit(@RequestBody ExamApplyEditBo bo) {
- return toAjax(iExamApplyService.updateByEditBo(bo) ? 1 : 0);
- }
- /**
- * 修改考试安排
- */
- @ApiOperation("修改考试安排")
- @PostMapping("/editApply")
- public AjaxResult<Void> editExamApply(MultipartFile file, String param) {
- if (StringUtils.isBlank(param)){
- throw new CustomException("参数有误!");
- }
- ExamApplyEditBo editBo = JSONObject.parseObject(param, ExamApplyEditBo.class);
- if (ObjectUtils.isNotNull(file)){
- //学员资料解析
- List<ExamApplyUserImportBo> applyUsers = EasyPoiUtil.importExcel(file,0,1,ExamApplyUserImportBo.class);
- editBo.setApplyUsers(applyUsers);
- }
- return toAjax(iExamApplyService.editExamApply(editBo) ? 1 : 0);
- }
- /**
- * 新增考试安排地点
- */
- @ApiOperation("新增考试安排地点")
- @PreAuthorize("@ss.hasPermi('system:site:add')")
- @Log(title = "考试安排地点", businessType = BusinessType.INSERT)
- @PostMapping("addSite")
- public AjaxResult<Void> addSite(@RequestBody List<ExamApplySiteAddBo> bo) {
- return toAjax(iExamApplySiteService.addSite(bo) ? 1 : 0);
- }
- /**
- * 新增考试安排绑定商品
- */
- @ApiOperation("新增考试安排绑定商品")
- @PreAuthorize("@ss.hasPermi('system:goods:add')")
- @Log(title = "考试安排绑定商品", businessType = BusinessType.INSERT)
- @PostMapping("addGoods")
- public AjaxResult<Void> addGoods(@RequestBody ExamApplyGoodsAddBo bo) {
- return toAjax(iExamApplyGoodsService.addGoods(bo) ? 1 : 0);
- }
- /**
- * 获取考试地点 考培地点
- */
- @ApiOperation("查看考试安排绑定商品")
- @PreAuthorize("@ss.hasPermi('system:apply:query')")
- @GetMapping("/goodsInfo")
- public AjaxResult<ExamApplyVo> getGoodsInfo(ExamApplyQueryBo bo) {
- ExamApplyVo examApplyVos = iExamApplyService.getGoodsInfo(bo);
- return AjaxResult.success(examApplyVos);
- }
- /**
- * 查看考试安排被预约数量
- */
- @ApiOperation("查看考试安排被预约数量")
- @PreAuthorize("@ss.hasPermi('system:apply:query')")
- @GetMapping("/countApplySubscribe")
- public AjaxResult<Integer> countApplySubscribe(ExamApplyQueryBo bo) {
- Integer subNum = iExamApplyService.countApplySubscribe(bo);
- return AjaxResult.success(subNum);
- }
- /**
- * 查询考试配置绑定商品列表
- */
- @ApiOperation("查询考试安排商品列表")
- @PreAuthorize("@ss.hasPermi('system:goods:list')")
- @GetMapping("/listGoods")
- public TableDataInfo<ExamNumberGoodsVo> listGoods(ExamNumberGoodsQueryBo bo) {
- startPage();
- List<ExamNumberGoodsVo> list = iExamApplyService.listGoods(bo);
- return getDataTable(list);
- }
- /**
- * 查询考试配置绑定用户列表
- */
- @ApiOperation("查询考试配置绑定用户列表")
- @PreAuthorize("@ss.hasPermi('system:goods:list')")
- @GetMapping("/listUser")
- public TableDataInfo<ExamApplyUserVo> listUser(ExamApplyUserQueryBo bo) {
- startPage();
- List<ExamApplyUserVo> list = iExamApplyUserService.listUser(bo);
- return getDataTable(list);
- }
- /**
- * 获取考试关联的前培安排
- */
- @ApiOperation("获取考试关联的前培安排")
- @GetMapping("/getBefore/{applyId}")
- public AjaxResult<ExamBeforeVo> getBeforeByApplyId(@PathVariable("applyId" ) Long applyId) {
- ExamBeforeVo vo = iExamApplyUserService.getBeforeByApplyId(applyId);
- return AjaxResult.success(vo);
- }
- @ApiOperation("七大员学员资料批量变更")
- @PostMapping("/user/profile")
- public AjaxResult updateExamUserProfile(MultipartFile file) {
- iExamApplyService.updateExamUserProfile(file);
- return AjaxResult.success();
- }
- @ApiOperation("七大员学员资料导出")
- @PostMapping("/user/profile/export")
- public AjaxResult examUserProfileExport(@RequestBody UserProfileQueryBo bo) {
- return AjaxResult.success(iExamApplyService.examUserProfileExport(bo));
- }
- @ApiOperation("修改考场人数")
- @PostMapping ("/update/applyNum")
- public AjaxResult updateApplyNum(@RequestBody UpdateApplyNumBo bo) {
- return toAjax(iExamApplyService.updateApplyNum(bo) ? 1 : 0);
- }
- }
|