123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189 |
- package com.zhongzheng.controller.mock;
- import cn.hutool.core.lang.Validator;
- 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.utils.ServletUtils;
- import com.zhongzheng.common.utils.poi.ExcelUtil;
- import com.zhongzheng.framework.web.service.WxTokenService;
- import com.zhongzheng.modules.course.bo.CourseSectionQueryBo;
- import com.zhongzheng.modules.mock.bo.MockApplyAddBo;
- import com.zhongzheng.modules.mock.bo.MockApplyEditBo;
- import com.zhongzheng.modules.mock.bo.MockApplyQueryBo;
- import com.zhongzheng.modules.mock.domain.MockMajorSubject;
- import com.zhongzheng.modules.mock.service.IMockApplyService;
- import com.zhongzheng.modules.mock.vo.MockApplyVo;
- import com.zhongzheng.modules.mock.vo.MockMajorSubjectVo;
- import com.zhongzheng.modules.user.entity.ClientLoginUser;
- 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 java.util.Arrays;
- import java.util.List;
- /**
- * 模考安排Controller
- *
- * @author ruoyi
- * @date 2022-05-24
- */
- @Api(value = "模考安排控制器", tags = {"模考安排管理"})
- @RequiredArgsConstructor(onConstructor_ = @Autowired)
- @RestController
- @RequestMapping("/mock/apply")
- public class MockApplyController extends BaseController {
- private final IMockApplyService iMockApplyService;
- private final WxTokenService wxTokenService;
- /**
- * 查询模考安排列表
- */
- @ApiOperation("查询模考安排列表")
- @PreAuthorize("@ss.hasPermi('system:apply:list')")
- @GetMapping("/list")
- public TableDataInfo<MockApplyVo> list(MockApplyQueryBo bo) {
- startPage();
- List<MockApplyVo> list = iMockApplyService.queryList(bo);
- return getDataTable(list);
- }
- /**
- * 导出模考安排列表
- */
- @ApiOperation("导出模考安排列表")
- @PreAuthorize("@ss.hasPermi('system:apply:export')")
- @Log(title = "模考安排", businessType = BusinessType.EXPORT)
- @GetMapping("/export")
- public AjaxResult<MockApplyVo> export(MockApplyQueryBo bo) {
- List<MockApplyVo> list = iMockApplyService.queryList(bo);
- ExcelUtil<MockApplyVo> util = new ExcelUtil<MockApplyVo>(MockApplyVo.class);
- return util.exportExcel(list, "模考安排");
- }
- /**
- * 获取模考安排详细信息
- */
- @ApiOperation("获取模考安排详细信息")
- @PreAuthorize("@ss.hasPermi('system:apply:query')")
- @GetMapping("/{applyId}")
- public AjaxResult<MockApplyVo> getInfo(@PathVariable("applyId" ) Long applyId) {
- return AjaxResult.success(iMockApplyService.queryById(applyId));
- }
- /**
- * 新增模考安排
- */
- @ApiOperation("新增模考安排")
- @PreAuthorize("@ss.hasPermi('system:apply:add')")
- @Log(title = "模考安排", businessType = BusinessType.INSERT)
- @PostMapping()
- public AjaxResult<Void> add(@RequestBody MockApplyAddBo bo) {
- return toAjax(iMockApplyService.insertByAddBo(bo) ? 1 : 0);
- }
- /**
- * 修改模考安排
- */
- @ApiOperation("修改模考安排")
- @PreAuthorize("@ss.hasPermi('system:apply:edit')")
- @Log(title = "模考安排", businessType = BusinessType.UPDATE)
- @PutMapping()
- public AjaxResult<Void> edit(@RequestBody MockApplyEditBo bo) {
- return toAjax(iMockApplyService.updateByEditBo(bo) ? 1 : 0);
- }
- /**
- * 删除模考安排
- */
- @ApiOperation("删除模考安排")
- @PreAuthorize("@ss.hasPermi('system:apply:remove')")
- @Log(title = "模考安排" , businessType = BusinessType.DELETE)
- @DeleteMapping("/{applyIds}")
- public AjaxResult<Void> remove(@PathVariable Long[] applyIds) {
- return toAjax(iMockApplyService.deleteWithValidByIds(Arrays.asList(applyIds), true) ? 1 : 0);
- }
- /**
- * 查询模考安排列表
- */
- @ApiOperation("查询模考安排列表")
- @PreAuthorize("@ss.hasPermi('system:apply:list')")
- @GetMapping("/listApply")
- public TableDataInfo<MockApplyVo> listApply(MockApplyQueryBo bo){
- startPage();
- ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
- bo.setUserId(loginUser.getUser().getUserId());
- List<MockApplyVo> list = iMockApplyService.queryApplyList(bo);
- return getDataTable(list);
- }
- /**
- * 查询模考预约业务层次列表
- */
- @ApiOperation("查询模考预约业务层次列表")
- @PreAuthorize("@ss.hasPermi('system:apply:list')")
- @GetMapping("/listApplyBusiness")
- public TableDataInfo<MockApplyVo> listApplyBusiness(MockApplyQueryBo bo) {
- ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
- bo.setUserId(loginUser.getUser().getUserId());
- List<MockApplyVo> list = iMockApplyService.listApplyBusiness(bo);
- return getDataTable(list);
- }
- /**
- * 查询模考讲解直播列表
- */
- @ApiOperation("查询模考讲解直播列表")
- @PreAuthorize("@ss.hasPermi('system:apply:list')")
- @GetMapping("/listMockLive")
- public TableDataInfo<MockMajorSubjectVo> listMockLive(MockApplyQueryBo bo) {
- Integer pageNum = 0;
- Integer pageSize = 0;
- if (Validator.isNotEmpty(bo.getPageNum()) && Validator.isNotEmpty(bo.getPageSize())) {
- pageNum = bo.getPageNum();
- pageSize = bo.getPageSize();
- bo.setPageNum(null);
- bo.setPageSize(null);
- }
- List<MockMajorSubjectVo> list = iMockApplyService.listMockLive(bo);
- bo.setPageNum(pageNum);
- bo.setPageSize(pageSize);
- if (Validator.isEmpty(bo.getPageNum()) || Validator.isEmpty(bo.getPageSize())) {
- return getDataTable(list);
- }
- return getDataTable(getPageInfo(pageNum, pageSize, list).getList());
- }
- /**
- * 查询是否有模考讲解直播正在进行
- * @return
- */
- @ApiOperation("查询是否有模考讲解直播正在进行")
- @PreAuthorize("@ss.hasPermi('system:apply:list')")
- @GetMapping("/mockLiving")
- public AjaxResult<CourseSectionQueryBo> mockLiving() {
- ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
- return AjaxResult.success(iMockApplyService.mockLiving(loginUser.getUser().getUserId()));
- }
- /**
- * 获取模考标题
- */
- @ApiOperation("获取模考标题")
- @PreAuthorize("@ss.hasPermi('system:apply:list')")
- @GetMapping("/listApplyName")
- public TableDataInfo<MockMajorSubjectVo> listApplyName(MockApplyQueryBo bo) {
- List<MockMajorSubjectVo> list = iMockApplyService.listApplyName(bo);
- return getDataTable(list);
- }
- }
|