修改测试问题
This commit is contained in:
parent
039b29a8cf
commit
43ac71449a
@ -45,4 +45,10 @@ public class ExamSearchDTO {
|
|||||||
* */
|
* */
|
||||||
@ApiModelProperty(value = "用户主键", required=true)
|
@ApiModelProperty(value = "用户主键", required=true)
|
||||||
private String userId;
|
private String userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 考试类型(多种类型查询用,拼接)
|
||||||
|
* */
|
||||||
|
@ApiModelProperty(value = "考试类型(1:模拟考试,2:正式考试,3:补考)", required=true)
|
||||||
|
private String examTypes;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -51,4 +51,11 @@ public interface ExamMapper extends BaseMapper<Exam> {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<ExamDTO> getExamList(@Param("query") ExamSearchDTO query);
|
List<ExamDTO> getExamList(@Param("query") ExamSearchDTO query);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询可预约考试列表
|
||||||
|
* @param query
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
IPage<ExamDTO> getExamPage(Page page, @Param("query") ExamSearchDTO query);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,8 +4,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.yf.exam.core.api.dto.PagingReqDTO;
|
import com.yf.exam.core.api.dto.PagingReqDTO;
|
||||||
import com.yf.exam.modules.exam.dto.ExamDTO;
|
import com.yf.exam.modules.exam.dto.ExamDTO;
|
||||||
import com.yf.exam.modules.exam.dto.request.ExamSearchDTO;
|
|
||||||
import com.yf.exam.modules.exam.dto.request.ExamSaveReqDTO;
|
import com.yf.exam.modules.exam.dto.request.ExamSaveReqDTO;
|
||||||
|
import com.yf.exam.modules.exam.dto.request.ExamSearchDTO;
|
||||||
import com.yf.exam.modules.exam.dto.response.ExamOnlineRespDTO;
|
import com.yf.exam.modules.exam.dto.response.ExamOnlineRespDTO;
|
||||||
import com.yf.exam.modules.exam.dto.response.ExamReviewRespDTO;
|
import com.yf.exam.modules.exam.dto.response.ExamReviewRespDTO;
|
||||||
import com.yf.exam.modules.exam.entity.Exam;
|
import com.yf.exam.modules.exam.entity.Exam;
|
||||||
@ -71,4 +71,11 @@ public interface ExamService extends IService<Exam> {
|
|||||||
*/
|
*/
|
||||||
List<ExamDTO> getExamList(ExamSearchDTO reqDTO);
|
List<ExamDTO> getExamList(ExamSearchDTO reqDTO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询可预约考试列表
|
||||||
|
* @param reqDTO
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
IPage<ExamDTO> getExamPage(PagingReqDTO<ExamSearchDTO> reqDTO);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,7 +11,9 @@ import com.yf.exam.core.enums.GooodsOrderStatusEnum;
|
|||||||
import com.yf.exam.core.exception.ServiceException;
|
import com.yf.exam.core.exception.ServiceException;
|
||||||
import com.yf.exam.modules.exam.dto.ExamRegistrationDTO;
|
import com.yf.exam.modules.exam.dto.ExamRegistrationDTO;
|
||||||
import com.yf.exam.modules.exam.dto.response.ExamRegistrationVO;
|
import com.yf.exam.modules.exam.dto.response.ExamRegistrationVO;
|
||||||
|
import com.yf.exam.modules.exam.entity.Exam;
|
||||||
import com.yf.exam.modules.exam.entity.ExamRegistration;
|
import com.yf.exam.modules.exam.entity.ExamRegistration;
|
||||||
|
import com.yf.exam.modules.exam.mapper.ExamMapper;
|
||||||
import com.yf.exam.modules.exam.mapper.ExamRegistrationMapper;
|
import com.yf.exam.modules.exam.mapper.ExamRegistrationMapper;
|
||||||
import com.yf.exam.modules.exam.service.ExamRegistrationService;
|
import com.yf.exam.modules.exam.service.ExamRegistrationService;
|
||||||
import com.yf.exam.modules.paper.enums.ExamFinishState;
|
import com.yf.exam.modules.paper.enums.ExamFinishState;
|
||||||
@ -19,6 +21,7 @@ import java.time.LocalDate;
|
|||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import javax.annotation.Resource;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@ -31,6 +34,9 @@ import org.springframework.stereotype.Service;
|
|||||||
@Service
|
@Service
|
||||||
public class ExamRegistrationServiceImpl extends ServiceImpl<ExamRegistrationMapper, ExamRegistration> implements ExamRegistrationService {
|
public class ExamRegistrationServiceImpl extends ServiceImpl<ExamRegistrationMapper, ExamRegistration> implements ExamRegistrationService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ExamMapper examMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String save(ExamRegistrationDTO reqDTO) {
|
public String save(ExamRegistrationDTO reqDTO) {
|
||||||
if (StringUtils.isBlank(reqDTO.getUserId()) || StringUtils.isBlank(reqDTO.getUserName()) || StringUtils.isBlank(reqDTO.getRealName()) || StringUtils.isBlank(reqDTO.getPhone())) {
|
if (StringUtils.isBlank(reqDTO.getUserId()) || StringUtils.isBlank(reqDTO.getUserName()) || StringUtils.isBlank(reqDTO.getRealName()) || StringUtils.isBlank(reqDTO.getPhone())) {
|
||||||
@ -40,6 +46,8 @@ public class ExamRegistrationServiceImpl extends ServiceImpl<ExamRegistrationMap
|
|||||||
throw new ServiceException("请选择要报名的考试");
|
throw new ServiceException("请选择要报名的考试");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Exam exam = examMapper.selectById(reqDTO.getId());
|
||||||
|
|
||||||
// 查询考生是否报名过该考试
|
// 查询考生是否报名过该考试
|
||||||
ExamRegistrationDTO examRegistrationDTO = new ExamRegistrationDTO();
|
ExamRegistrationDTO examRegistrationDTO = new ExamRegistrationDTO();
|
||||||
examRegistrationDTO.setExamId(reqDTO.getExamId());
|
examRegistrationDTO.setExamId(reqDTO.getExamId());
|
||||||
@ -65,7 +73,11 @@ public class ExamRegistrationServiceImpl extends ServiceImpl<ExamRegistrationMap
|
|||||||
entity.setOrderTime(LocalDateTime.now());
|
entity.setOrderTime(LocalDateTime.now());
|
||||||
entity.setPaymentState(GooodsOrderStatusEnum.WAIT_PAY.getInfo());
|
entity.setPaymentState(GooodsOrderStatusEnum.WAIT_PAY.getInfo());
|
||||||
entity.setFinishState(ExamFinishState.UNFINISH);
|
entity.setFinishState(ExamFinishState.UNFINISH);
|
||||||
entity.setExpirationState(true);
|
entity.setExpirationState(false);
|
||||||
|
if (exam != null) {
|
||||||
|
entity.setExpirationDate(exam.getExpirationDate());
|
||||||
|
}
|
||||||
|
|
||||||
if (reqDTO.getExamType() == 1) {
|
if (reqDTO.getExamType() == 1) {
|
||||||
entity.setRegTime(LocalDate.now());
|
entity.setRegTime(LocalDate.now());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -62,7 +62,7 @@ public class ExamServiceImpl extends ServiceImpl<ExamMapper, Exam> implements Ex
|
|||||||
this.calcScore(reqDTO);
|
this.calcScore(reqDTO);
|
||||||
|
|
||||||
|
|
||||||
if (reqDTO.getTimeLimit() && (reqDTO.getStartDate() == null || reqDTO.getEndDate() == null || reqDTO.getStartTime() == null || reqDTO.getEndTime() == null)) {
|
if ((reqDTO.getTimeLimit() || reqDTO.getExamType() == 2 || reqDTO.getExamType() == 3) && (reqDTO.getStartDate() == null || reqDTO.getEndDate() == null || reqDTO.getStartTime() == null || reqDTO.getEndTime() == null)) {
|
||||||
throw new ServiceException(1, "日期时间范围不能为空!");
|
throw new ServiceException(1, "日期时间范围不能为空!");
|
||||||
}
|
}
|
||||||
// 复制基本数据
|
// 复制基本数据
|
||||||
@ -164,7 +164,7 @@ public class ExamServiceImpl extends ServiceImpl<ExamMapper, Exam> implements Ex
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询可预约考试列表
|
* 查询可预约的正式考试列表
|
||||||
* @param reqDTO
|
* @param reqDTO
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -176,6 +176,17 @@ public class ExamServiceImpl extends ServiceImpl<ExamMapper, Exam> implements Ex
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IPage<ExamDTO> getExamPage(PagingReqDTO<ExamSearchDTO> reqDTO) {
|
||||||
|
// 创建分页对象
|
||||||
|
Page page = new Page(reqDTO.getCurrent(), reqDTO.getSize());
|
||||||
|
|
||||||
|
// 查找分页
|
||||||
|
IPage<ExamDTO> pageData = baseMapper.getExamPage(page, reqDTO.getParams());
|
||||||
|
|
||||||
|
return pageData;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 计算分值
|
* 计算分值
|
||||||
* @param reqDTO
|
* @param reqDTO
|
||||||
|
|||||||
@ -4,10 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|||||||
import com.yf.exam.core.api.ApiRest;
|
import com.yf.exam.core.api.ApiRest;
|
||||||
import com.yf.exam.core.api.controller.BaseController;
|
import com.yf.exam.core.api.controller.BaseController;
|
||||||
import com.yf.exam.core.api.dto.BaseIdReqDTO;
|
import com.yf.exam.core.api.dto.BaseIdReqDTO;
|
||||||
import com.yf.exam.core.api.dto.BaseIdRespDTO;
|
|
||||||
import com.yf.exam.core.api.dto.BaseIdsReqDTO;
|
|
||||||
import com.yf.exam.core.api.dto.PagingReqDTO;
|
import com.yf.exam.core.api.dto.PagingReqDTO;
|
||||||
import com.yf.exam.core.utils.BeanMapper;
|
|
||||||
import com.yf.exam.modules.paper.dto.PaperDTO;
|
import com.yf.exam.modules.paper.dto.PaperDTO;
|
||||||
import com.yf.exam.modules.paper.dto.ext.PaperQuDetailDTO;
|
import com.yf.exam.modules.paper.dto.ext.PaperQuDetailDTO;
|
||||||
import com.yf.exam.modules.paper.dto.request.PaperAnswerDTO;
|
import com.yf.exam.modules.paper.dto.request.PaperAnswerDTO;
|
||||||
@ -17,13 +14,11 @@ import com.yf.exam.modules.paper.dto.request.PaperQuQueryDTO;
|
|||||||
import com.yf.exam.modules.paper.dto.response.ExamDetailRespDTO;
|
import com.yf.exam.modules.paper.dto.response.ExamDetailRespDTO;
|
||||||
import com.yf.exam.modules.paper.dto.response.ExamResultRespDTO;
|
import com.yf.exam.modules.paper.dto.response.ExamResultRespDTO;
|
||||||
import com.yf.exam.modules.paper.dto.response.PaperListRespDTO;
|
import com.yf.exam.modules.paper.dto.response.PaperListRespDTO;
|
||||||
import com.yf.exam.modules.paper.entity.Paper;
|
|
||||||
import com.yf.exam.modules.paper.service.PaperService;
|
import com.yf.exam.modules.paper.service.PaperService;
|
||||||
|
import com.yf.exam.modules.paper.vo.PaperStateVO;
|
||||||
import com.yf.exam.modules.user.UserUtils;
|
import com.yf.exam.modules.user.UserUtils;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.apache.shiro.authz.annotation.RequiresRoles;
|
|
||||||
import org.springframework.beans.BeanUtils;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
@ -68,10 +63,10 @@ public class PaperController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@ApiOperation(value = "创建试卷")
|
@ApiOperation(value = "创建试卷")
|
||||||
@RequestMapping(value = "/create-paper", method = { RequestMethod.POST})
|
@RequestMapping(value = "/create-paper", method = { RequestMethod.POST})
|
||||||
public ApiRest<BaseIdRespDTO> save(@RequestBody PaperCreateReqDTO reqDTO) {
|
public ApiRest<PaperStateVO> save(@RequestBody PaperCreateReqDTO reqDTO) {
|
||||||
//复制参数
|
//复制参数
|
||||||
String paperId = baseService.createPaper(UserUtils.getUserId(), reqDTO.getExamId());
|
PaperStateVO paperStateVO = baseService.createPaper(UserUtils.getUserId(), reqDTO.getExamId(), reqDTO.getExamType());
|
||||||
return super.success(new BaseIdRespDTO(paperId));
|
return super.success(paperStateVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -19,4 +19,10 @@ public class PaperCreateReqDTO extends BaseDTO {
|
|||||||
@ApiModelProperty(value = "考试ID", required=true)
|
@ApiModelProperty(value = "考试ID", required=true)
|
||||||
private String examId;
|
private String examId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 考试类型(1:模拟考试,2:正式考试,3:补考)
|
||||||
|
* */
|
||||||
|
@ApiModelProperty(value = "考试类型(1:模拟考试,2:正式考试,3:补考)", required=true)
|
||||||
|
private Integer examType;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.annotation.TableField;
|
|||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
@ -122,4 +123,10 @@ public class Paper extends Model<Paper> {
|
|||||||
*/
|
*/
|
||||||
@TableField("limit_time")
|
@TableField("limit_time")
|
||||||
private Date limitTime;
|
private Date limitTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 考试类型(1:模拟考试,2:正式考试,3:补考)
|
||||||
|
* */
|
||||||
|
@ApiModelProperty(value = "考试类型(1:模拟考试,2:正式考试,3:补考)", required=true)
|
||||||
|
private Integer examType;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,6 +11,7 @@ import com.yf.exam.modules.paper.dto.response.ExamDetailRespDTO;
|
|||||||
import com.yf.exam.modules.paper.dto.response.ExamResultRespDTO;
|
import com.yf.exam.modules.paper.dto.response.ExamResultRespDTO;
|
||||||
import com.yf.exam.modules.paper.dto.response.PaperListRespDTO;
|
import com.yf.exam.modules.paper.dto.response.PaperListRespDTO;
|
||||||
import com.yf.exam.modules.paper.entity.Paper;
|
import com.yf.exam.modules.paper.entity.Paper;
|
||||||
|
import com.yf.exam.modules.paper.vo.PaperStateVO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@ -28,7 +29,7 @@ public interface PaperService extends IService<Paper> {
|
|||||||
* @param examId
|
* @param examId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
String createPaper(String userId, String examId);
|
PaperStateVO createPaper(String userId, String examId, Integer examType);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -7,7 +7,6 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|||||||
import com.yf.exam.ability.job.enums.JobGroup;
|
import com.yf.exam.ability.job.enums.JobGroup;
|
||||||
import com.yf.exam.ability.job.enums.JobPrefix;
|
import com.yf.exam.ability.job.enums.JobPrefix;
|
||||||
import com.yf.exam.ability.job.service.JobService;
|
import com.yf.exam.ability.job.service.JobService;
|
||||||
import com.yf.exam.core.api.ApiError;
|
|
||||||
import com.yf.exam.core.api.dto.PagingReqDTO;
|
import com.yf.exam.core.api.dto.PagingReqDTO;
|
||||||
import com.yf.exam.core.exception.ServiceException;
|
import com.yf.exam.core.exception.ServiceException;
|
||||||
import com.yf.exam.core.utils.BeanMapper;
|
import com.yf.exam.core.utils.BeanMapper;
|
||||||
@ -32,7 +31,6 @@ import com.yf.exam.modules.paper.entity.Paper;
|
|||||||
import com.yf.exam.modules.paper.entity.PaperQu;
|
import com.yf.exam.modules.paper.entity.PaperQu;
|
||||||
import com.yf.exam.modules.paper.entity.PaperQuAnswer;
|
import com.yf.exam.modules.paper.entity.PaperQuAnswer;
|
||||||
import com.yf.exam.modules.paper.enums.ExamFinishState;
|
import com.yf.exam.modules.paper.enums.ExamFinishState;
|
||||||
import com.yf.exam.modules.paper.enums.ExamState;
|
|
||||||
import com.yf.exam.modules.paper.enums.ExamType;
|
import com.yf.exam.modules.paper.enums.ExamType;
|
||||||
import com.yf.exam.modules.paper.enums.PaperState;
|
import com.yf.exam.modules.paper.enums.PaperState;
|
||||||
import com.yf.exam.modules.paper.job.BreakExamJob;
|
import com.yf.exam.modules.paper.job.BreakExamJob;
|
||||||
@ -40,6 +38,7 @@ import com.yf.exam.modules.paper.mapper.PaperMapper;
|
|||||||
import com.yf.exam.modules.paper.service.PaperQuAnswerService;
|
import com.yf.exam.modules.paper.service.PaperQuAnswerService;
|
||||||
import com.yf.exam.modules.paper.service.PaperQuService;
|
import com.yf.exam.modules.paper.service.PaperQuService;
|
||||||
import com.yf.exam.modules.paper.service.PaperService;
|
import com.yf.exam.modules.paper.service.PaperService;
|
||||||
|
import com.yf.exam.modules.paper.vo.PaperStateVO;
|
||||||
import com.yf.exam.modules.qu.entity.Qu;
|
import com.yf.exam.modules.qu.entity.Qu;
|
||||||
import com.yf.exam.modules.qu.entity.QuAnswer;
|
import com.yf.exam.modules.qu.entity.QuAnswer;
|
||||||
import com.yf.exam.modules.qu.enums.QuType;
|
import com.yf.exam.modules.qu.enums.QuType;
|
||||||
@ -124,19 +123,20 @@ public class PaperServiceImpl extends ServiceImpl<PaperMapper, Paper> implements
|
|||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
@Override
|
@Override
|
||||||
public String createPaper(String userId, String examId) {
|
public PaperStateVO createPaper(String userId, String examId, Integer examType) {
|
||||||
|
|
||||||
// 校验是否有正在考试的试卷
|
// 校验是否有正在考试的试卷
|
||||||
QueryWrapper<Paper> wrapper = new QueryWrapper<>();
|
QueryWrapper<Paper> wrapper = new QueryWrapper<>();
|
||||||
wrapper.lambda()
|
wrapper.lambda()
|
||||||
.eq(Paper::getUserId, userId)
|
.eq(Paper::getUserId, userId)
|
||||||
.eq(Paper::getState, PaperState.ING);
|
.eq(Paper::getState, PaperState.ING)
|
||||||
|
.eq(Paper::getExamId, examId);
|
||||||
|
|
||||||
int exists = this.count(wrapper);
|
Paper obj = this.getOne(wrapper);
|
||||||
|
|
||||||
|
|
||||||
if (exists > 0) {
|
if (obj != null) {
|
||||||
throw new ServiceException(ApiError.ERROR_20010002);
|
return PaperStateVO.builder().hasPaper(true).id(obj.getId()).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查找考试
|
// 查找考试
|
||||||
@ -146,9 +146,9 @@ public class PaperServiceImpl extends ServiceImpl<PaperMapper, Paper> implements
|
|||||||
throw new ServiceException(1, "考试不存在!");
|
throw new ServiceException(1, "考试不存在!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!ExamState.ENABLE.equals(exam.getState())){
|
/*if(!ExamState.ENABLE.equals(exam.getState())){
|
||||||
throw new ServiceException(1, "考试状态不正确!");
|
throw new ServiceException(1, "考试状态不正确!");
|
||||||
}
|
}*/
|
||||||
|
|
||||||
// 考试题目列表
|
// 考试题目列表
|
||||||
List<PaperQu> quList = this.generateByRepo(examId);
|
List<PaperQu> quList = this.generateByRepo(examId);
|
||||||
@ -164,7 +164,7 @@ public class PaperServiceImpl extends ServiceImpl<PaperMapper, Paper> implements
|
|||||||
String jobName = JobPrefix.BREAK_EXAM + paper.getId();
|
String jobName = JobPrefix.BREAK_EXAM + paper.getId();
|
||||||
jobService.addCronJob(BreakExamJob.class, jobName, CronUtils.dateToCron(paper.getLimitTime()), paper.getId());
|
jobService.addCronJob(BreakExamJob.class, jobName, CronUtils.dateToCron(paper.getLimitTime()), paper.getId());
|
||||||
|
|
||||||
return paper.getId();
|
return PaperStateVO.builder().hasPaper(false).id(paper.getId()).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -349,6 +349,7 @@ public class PaperServiceImpl extends ServiceImpl<PaperMapper, Paper> implements
|
|||||||
paper.setTitle(exam.getTitle());
|
paper.setTitle(exam.getTitle());
|
||||||
paper.setTotalScore(exam.getTotalScore());
|
paper.setTotalScore(exam.getTotalScore());
|
||||||
paper.setTotalTime(exam.getTotalTime());
|
paper.setTotalTime(exam.getTotalTime());
|
||||||
|
paper.setExamType(exam.getExamType());
|
||||||
paper.setUserScore(0);
|
paper.setUserScore(0);
|
||||||
paper.setUserId(userId);
|
paper.setUserId(userId);
|
||||||
paper.setCreateTime(new Date());
|
paper.setCreateTime(new Date());
|
||||||
|
|||||||
@ -0,0 +1,28 @@
|
|||||||
|
package com.yf.exam.modules.paper.vo;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 查询是否有正在进行的考试返回视图类
|
||||||
|
* @author: haown
|
||||||
|
* @create: 2025-08-27 16:29
|
||||||
|
**/
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Builder
|
||||||
|
public class PaperStateVO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否有正在进行的考试标识,true:有,false:无
|
||||||
|
*/
|
||||||
|
private Boolean hasPaper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 试卷主键
|
||||||
|
*/
|
||||||
|
private String id;
|
||||||
|
}
|
||||||
@ -9,7 +9,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
* @create: 2025-08-26 16:22
|
* @create: 2025-08-26 16:22
|
||||||
**/
|
**/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/monitor/payTask")
|
@RequestMapping("/monitor/regTask")
|
||||||
public class ExamRegistrationTaskController {
|
public class ExamRegistrationTaskController {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,12 +10,14 @@ import java.util.Calendar;
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description: 考试预约定时任务实现类
|
* @description: 考试预约定时任务实现类
|
||||||
* @author: haown
|
* @author: haown
|
||||||
* @create: 2025-08-26 16:31
|
* @create: 2025-08-26 16:31
|
||||||
**/
|
**/
|
||||||
|
@Service
|
||||||
public class ExamRegistrationTaskServiceImpl implements ExamRegistrationTaskService {
|
public class ExamRegistrationTaskServiceImpl implements ExamRegistrationTaskService {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
|
|||||||
@ -85,7 +85,9 @@
|
|||||||
FROM el_exam ex
|
FROM el_exam ex
|
||||||
LEFT JOIN el_exam_depart dept ON ex.id=dept.exam_id AND ex.open_type=2
|
LEFT JOIN el_exam_depart dept ON ex.id=dept.exam_id AND ex.open_type=2
|
||||||
LEFT JOIN sys_user uc ON uc.depart_id=dept.depart_id
|
LEFT JOIN sys_user uc ON uc.depart_id=dept.depart_id
|
||||||
WHERE ex.state=0 AND (ex.open_type=1 OR ex.open_type=3 OR uc.id='{{userId}}')
|
WHERE
|
||||||
|
-- ex.state=0 AND
|
||||||
|
(ex.open_type=1 OR ex.open_type=3 OR uc.id='{{userId}}')
|
||||||
|
|
||||||
<if test="query!=null">
|
<if test="query!=null">
|
||||||
<if test="query.title!=null and query.title!=''">
|
<if test="query.title!=null and query.title!=''">
|
||||||
@ -104,22 +106,49 @@
|
|||||||
|
|
||||||
<select id="getExamList" resultMap="OnlineResultMap">
|
<select id="getExamList" resultMap="OnlineResultMap">
|
||||||
SELECT * FROM el_exam
|
SELECT * FROM el_exam
|
||||||
where state = 0 and (exam_type = 2 or exam_type = 3)
|
where id not in (select exam_id from el_exam_registration where user_id = #{query.userId} and (payment_state = 'PAY' or payment_state = 'WAIT_REFUND'))
|
||||||
and id not in (select exam_id from el_exam_registration where user_id = #{query.userId} and (payment_state = 'PAY' or payment_state = 'WAIT_REFUND'))
|
|
||||||
<if test="query!=null">
|
<if test="query!=null">
|
||||||
<if test="query.openType!=null">
|
<if test="query.openType!=null">
|
||||||
AND open_type = #{query.openType}
|
AND open_type = #{query.openType}
|
||||||
</if>
|
</if>
|
||||||
<if test="query.examType!=null">
|
<if test="query.examType != null and query.examType != ''">
|
||||||
AND exam_type = #{query.examType}
|
AND exam_type = #{query.examType}
|
||||||
</if>
|
</if>
|
||||||
<if test="query.startDate!=null">
|
<if test="query.examTypes != null and query.examTypes != ''">
|
||||||
AND start_date <= #{query.startDate}
|
AND exam_type in
|
||||||
|
<foreach item = "item" collection="query.examTypes.split(',')" open="(" separator="," close=")">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
|
<!--<if test="query.startDate!=null">
|
||||||
|
AND start_date <= #{query.startDate}
|
||||||
|
</if>-->
|
||||||
<if test="query.endDate!=null">
|
<if test="query.endDate!=null">
|
||||||
AND end_date >= #{query.endDate}
|
AND end_date >= #{query.endDate}
|
||||||
</if>
|
</if>
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getExamPage" resultMap="OnlineResultMap">
|
||||||
|
SELECT * FROM el_exam
|
||||||
|
where id not in (select exam_id from el_exam_registration where user_id = #{query.userId} and (payment_state = 'PAY' or payment_state = 'WAIT_REFUND') and expiration_state = false)
|
||||||
|
<if test="query!=null">
|
||||||
|
<if test="query.openType!=null">
|
||||||
|
AND open_type = #{query.openType}
|
||||||
|
</if>
|
||||||
|
<if test="query.examType != null and query.examType != ''">
|
||||||
|
AND exam_type = #{query.examType}
|
||||||
|
</if>
|
||||||
|
<if test="query.examTypes != null and query.examTypes != ''">
|
||||||
|
AND exam_type in
|
||||||
|
<foreach item = "item" collection="query.examTypes.split(',')" open="(" separator="," close=")">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
<if test="query.endDate!=null">
|
||||||
|
AND end_date >= #{query.endDate}
|
||||||
|
</if>
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@ -49,34 +49,35 @@
|
|||||||
,ex.total_score, ex.total_time, ex.qualify_score, ex.exam_fee, DATEDIFF(ex.start_date, now()) >= 2 as daysAllow, ex.expiration_date
|
,ex.total_score, ex.total_time, ex.qualify_score, ex.exam_fee, DATEDIFF(ex.start_date, now()) >= 2 as daysAllow, ex.expiration_date
|
||||||
FROM el_exam_registration reg
|
FROM el_exam_registration reg
|
||||||
left join el_exam ex on reg.exam_id = ex.id
|
left join el_exam ex on reg.exam_id = ex.id
|
||||||
WHERE ex.state = 0
|
<where>
|
||||||
<if test="query.userId!=null">
|
<if test="query.userId!=null">
|
||||||
AND reg.user_id=#{query.userId}
|
AND reg.user_id=#{query.userId}
|
||||||
</if>
|
</if>
|
||||||
<if test="query.finishState!=null">
|
<if test="query.finishState!=null">
|
||||||
AND reg.finish_state=#{query.finishState}
|
AND reg.finish_state=#{query.finishState}
|
||||||
</if>
|
</if>
|
||||||
<if test="query.paymentState!=null">
|
<if test="query.paymentState!=null">
|
||||||
AND reg.payment_state=#{query.paymentState}
|
AND reg.payment_state=#{query.paymentState}
|
||||||
</if>
|
</if>
|
||||||
<if test="query.examId!=null">
|
<if test="query.examId!=null">
|
||||||
AND reg.exam_id=#{query.examId}
|
AND reg.exam_id=#{query.examId}
|
||||||
</if>
|
</if>
|
||||||
<if test="query.examType!=null">
|
<if test="query.examType!=null">
|
||||||
AND ex.exam_type=#{query.examType}
|
AND ex.exam_type=#{query.examType}
|
||||||
</if>
|
</if>
|
||||||
<if test="query.examTypes != null and query.examTypes != ''">
|
<if test="query.examTypes != null and query.examTypes != ''">
|
||||||
AND ex.exam_type in
|
AND ex.exam_type in
|
||||||
<foreach item = "item" collection="query.examTypes.split(',')" open="(" separator="," close=")">
|
<foreach item = "item" collection="query.examTypes.split(',')" open="(" separator="," close=")">
|
||||||
#{item}
|
#{item}
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
<if test="query.paymentStates != null and query.paymentStates != ''">
|
<if test="query.paymentStates != null and query.paymentStates != ''">
|
||||||
AND reg.payment_state in
|
AND reg.payment_state in
|
||||||
<foreach item = "item" collection="query.paymentStates.split(',')" open="(" separator="," close=")">
|
<foreach item = "item" collection="query.paymentStates.split(',')" open="(" separator="," close=")">
|
||||||
#{item}
|
#{item}
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
|
</where>
|
||||||
order by reg.payment_date desc, reg.order_time desc
|
order by reg.payment_date desc, reg.order_time desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
@ -86,34 +87,35 @@
|
|||||||
,ex.total_score, ex.total_time, ex.qualify_score, ex.exam_fee, ex.expiration_date
|
,ex.total_score, ex.total_time, ex.qualify_score, ex.exam_fee, ex.expiration_date
|
||||||
FROM el_exam_registration reg
|
FROM el_exam_registration reg
|
||||||
left join el_exam ex on reg.exam_id = ex.id
|
left join el_exam ex on reg.exam_id = ex.id
|
||||||
WHERE ex.state = 0
|
<where>
|
||||||
<if test="query.userId!=null">
|
<if test="query.userId!=null">
|
||||||
AND reg.user_id=#{query.userId}
|
AND reg.user_id=#{query.userId}
|
||||||
</if>
|
</if>
|
||||||
<if test="query.finishState!=null">
|
<if test="query.finishState!=null">
|
||||||
AND reg.finish_state=#{query.finishState}
|
AND reg.finish_state=#{query.finishState}
|
||||||
</if>
|
</if>
|
||||||
<if test="query.paymentState!=null">
|
<if test="query.paymentState!=null">
|
||||||
AND reg.payment_state=#{query.paymentState}
|
AND reg.payment_state=#{query.paymentState}
|
||||||
</if>
|
</if>
|
||||||
<if test="query.examId!=null">
|
<if test="query.examId!=null">
|
||||||
AND reg.exam_id=#{query.examId}
|
AND reg.exam_id=#{query.examId}
|
||||||
</if>
|
</if>
|
||||||
<if test="query.examType!=null">
|
<if test="query.examType!=null">
|
||||||
AND ex.exam_type=#{query.examType}
|
AND ex.exam_type=#{query.examType}
|
||||||
</if>
|
</if>
|
||||||
<if test="query.examTypes != null and query.examTypes != ''">
|
<if test="query.examTypes != null and query.examTypes != ''">
|
||||||
AND ex.exam_type in
|
AND ex.exam_type in
|
||||||
<foreach item = "item" collection="query.examTypes.split(',')" open="(" separator="," close=")">
|
<foreach item = "item" collection="query.examTypes.split(',')" open="(" separator="," close=")">
|
||||||
#{item}
|
#{item}
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
<if test="query.paymentStates != null and query.paymentStates != ''">
|
<if test="query.paymentStates != null and query.paymentStates != ''">
|
||||||
AND reg.payment_state in
|
AND reg.payment_state in
|
||||||
<foreach item = "item" collection="query.paymentStates.split(',')" open="(" separator="," close=")">
|
<foreach item = "item" collection="query.paymentStates.split(',')" open="(" separator="," close=")">
|
||||||
#{item}
|
#{item}
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
|
</where>
|
||||||
order by reg.payment_date desc, reg.order_time desc
|
order by reg.payment_date desc, reg.order_time desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
@ -128,12 +130,13 @@
|
|||||||
</update>
|
</update>
|
||||||
|
|
||||||
<select id="getRegUserList" resultType="com.yf.exam.modules.exam.dto.response.ExamRegistrationVO">
|
<select id="getRegUserList" resultType="com.yf.exam.modules.exam.dto.response.ExamRegistrationVO">
|
||||||
SELECT reg.id, reg.user_id as userId, reg.user_name, reg.real_name, reg.phone, reg.payment_state, reg.confirm_refund_status, reg.refund_reason
|
SELECT reg.id, reg.user_id as userId, reg.user_name, reg.real_name, reg.phone, reg.payment_state,reg.payment_date, reg.confirm_refund_status, reg.refund_reason
|
||||||
, ex.id as examId, ex.title, ex.content, ex.exam_type, ex.start_date, ex.end_date, ex.start_time, ex.end_time
|
, ex.id as examId, ex.title, ex.content, ex.exam_type, ex.start_date, ex.end_date, ex.start_time, ex.end_time
|
||||||
,ex.total_score, ex.total_time, ex.qualify_score, ex.exam_fee
|
,ex.total_score, ex.total_time, ex.qualify_score, ex.exam_fee
|
||||||
FROM el_exam_registration reg
|
FROM el_exam_registration reg
|
||||||
left join el_exam ex on reg.exam_id = ex.id
|
left join el_exam ex on reg.exam_id = ex.id
|
||||||
WHERE ex.state=0 and (reg.payment_state = 'PAY' or reg.payment_state = 'WAIT_REFUND' or reg.payment_state = 'REFUNDED')
|
WHERE
|
||||||
|
(reg.payment_state = 'PAY' or reg.payment_state = 'WAIT_REFUND' or reg.payment_state = 'REFUNDED')
|
||||||
<if test="query!=null">
|
<if test="query!=null">
|
||||||
<if test="query.title!=null and query.title!=''">
|
<if test="query.title!=null and query.title!=''">
|
||||||
AND ex.title LIKE CONCAT('%',#{query.title},'%')
|
AND ex.title LIKE CONCAT('%',#{query.title},'%')
|
||||||
@ -174,18 +177,19 @@
|
|||||||
reg.id as id, reg.user_id as userId, reg.user_name, reg.real_name, reg.phone, reg.payment_state, reg.finish_state
|
reg.id as id, reg.user_id as userId, reg.user_name, reg.real_name, reg.phone, reg.payment_state, reg.finish_state
|
||||||
FROM el_exam ex
|
FROM el_exam ex
|
||||||
left join (select * from el_exam_registration where user_id = #{query.userId} and (payment_state = 'PAY' or payment_state = 'WAIT_REFUND') and expiration_state = false) reg on reg.exam_id = ex.id
|
left join (select * from el_exam_registration where user_id = #{query.userId} and (payment_state = 'PAY' or payment_state = 'WAIT_REFUND') and expiration_state = false) reg on reg.exam_id = ex.id
|
||||||
WHERE ex.state=0
|
<where>
|
||||||
<if test="query!=null">
|
<if test="query!=null">
|
||||||
<if test="query.title!=null and query.title!=''">
|
<if test="query.title!=null and query.title!=''">
|
||||||
AND ex.title LIKE CONCAT('%',#{query.title},'%')
|
AND ex.title LIKE CONCAT('%',#{query.title},'%')
|
||||||
|
</if>
|
||||||
|
<if test="query.examType!=null">
|
||||||
|
AND ex.exam_type=#{query.examType}
|
||||||
|
</if>
|
||||||
|
<if test="query.paymentEndDate!=null">
|
||||||
|
AND reg.payment_date >= #{query.paymentEndDate}
|
||||||
|
</if>
|
||||||
</if>
|
</if>
|
||||||
<if test="query.examType!=null">
|
</where>
|
||||||
AND ex.exam_type=#{query.examType}
|
|
||||||
</if>
|
|
||||||
<if test="query.paymentEndDate!=null">
|
|
||||||
AND reg.payment_date >= #{query.paymentEndDate}
|
|
||||||
</if>
|
|
||||||
</if>
|
|
||||||
order by ex.start_date
|
order by ex.start_date
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user