考试报名接口
This commit is contained in:
parent
7a3b651a5d
commit
b9435cb54a
@ -56,42 +56,42 @@ public class UploadServiceImpl implements UploadService {
|
||||
}
|
||||
// 上传文件夹
|
||||
String fileDir = conf.getDir();
|
||||
switch (reqDTO.getType()) {
|
||||
//身份证正面上传
|
||||
case Constants.card_front_type:
|
||||
fileDir += uploadPathConfig.getCardFrontUrl();
|
||||
break;
|
||||
//身份证背面上传
|
||||
case Constants.card_back_type:
|
||||
fileDir += uploadPathConfig.getCardBackUrl();
|
||||
break;
|
||||
//身份证背面上传
|
||||
case Constants.card_copy_type:
|
||||
fileDir += uploadPathConfig.getCardCopyUrl();
|
||||
break;
|
||||
//证件照上传
|
||||
case Constants.photo_type:
|
||||
fileDir += uploadPathConfig.getPhotoUrl();
|
||||
break;
|
||||
//学历证明上传
|
||||
case Constants.certificate_type:
|
||||
fileDir += uploadPathConfig.getCertificateUrl();
|
||||
break;
|
||||
//体检报告上传
|
||||
case Constants.physical_report_type:
|
||||
fileDir += uploadPathConfig.getPhysicalReportUrl();
|
||||
break;
|
||||
//签名图片上传
|
||||
case Constants.sign_picture_type:
|
||||
fileDir += uploadPathConfig.getSignPictureUrl();
|
||||
break;
|
||||
}
|
||||
// 真实物理地址
|
||||
String fullPath;
|
||||
try {
|
||||
|
||||
// 新文件
|
||||
String filePath = FileUtils.processPath(file);
|
||||
switch (reqDTO.getType()) {
|
||||
//身份证正面上传
|
||||
case Constants.card_front_type:
|
||||
filePath = uploadPathConfig.getCardFrontUrl() + filePath;
|
||||
break;
|
||||
//身份证背面上传
|
||||
case Constants.card_back_type:
|
||||
filePath = uploadPathConfig.getCardBackUrl() + filePath;
|
||||
break;
|
||||
//身份证背面上传
|
||||
case Constants.card_copy_type:
|
||||
filePath = uploadPathConfig.getCardCopyUrl() + filePath;
|
||||
break;
|
||||
//证件照上传
|
||||
case Constants.photo_type:
|
||||
filePath = uploadPathConfig.getPhotoUrl() + filePath;
|
||||
break;
|
||||
//学历证明上传
|
||||
case Constants.certificate_type:
|
||||
filePath = uploadPathConfig.getCertificateUrl() + filePath;
|
||||
break;
|
||||
//体检报告上传
|
||||
case Constants.physical_report_type:
|
||||
filePath = uploadPathConfig.getPhysicalReportUrl() + filePath;
|
||||
break;
|
||||
//签名图片上传
|
||||
case Constants.sign_picture_type:
|
||||
filePath = uploadPathConfig.getSignPictureUrl() + filePath;
|
||||
break;
|
||||
}
|
||||
// 文件保存地址
|
||||
fullPath = fileDir + filePath;
|
||||
// 创建文件夹
|
||||
|
||||
@ -9,7 +9,6 @@ import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
@ -43,14 +42,11 @@ public class ExamRegistrationController extends BaseController {
|
||||
|
||||
/**
|
||||
* 查询已报名的考试列表
|
||||
* @param userId 用户主键
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "查询已报名的考试列表")
|
||||
@RequestMapping(value = "/getRegExamList/{userId}", method = { RequestMethod.GET})
|
||||
public ApiRest getExamList(@PathVariable String userId) {
|
||||
ExamRegistrationDTO examRegistrationDTO = new ExamRegistrationDTO();
|
||||
examRegistrationDTO.setUserId(userId);
|
||||
@RequestMapping(value = "/getRegExamList", method = {RequestMethod.GET})
|
||||
public ApiRest getExamList(ExamRegistrationDTO examRegistrationDTO) {
|
||||
List<ExamRegistrationVO> list = baseService.getRegExamList(examRegistrationDTO);
|
||||
return super.success(list);
|
||||
}
|
||||
|
||||
@ -169,5 +169,5 @@ public class ExamRegistrationDTO implements Serializable {
|
||||
* 考试状态(0:未考试,1:已考试)
|
||||
*/
|
||||
@ApiModelProperty(value = "考试状态(0:未考试,1:已考试)", required=true)
|
||||
private Integer examState;
|
||||
private Integer finishState;
|
||||
}
|
||||
|
||||
@ -16,6 +16,11 @@ import org.springframework.format.annotation.DateTimeFormat;
|
||||
@Data
|
||||
public class ExamRegistrationVO {
|
||||
|
||||
/**
|
||||
* 用户主键
|
||||
*/
|
||||
@ApiModelProperty(value = "用户主键", required=true)
|
||||
private String userId;
|
||||
/**
|
||||
* 报名时间
|
||||
*/
|
||||
@ -28,11 +33,17 @@ public class ExamRegistrationVO {
|
||||
* 考试状态(0:未考试,1:已考试)
|
||||
*/
|
||||
@ApiModelProperty(value = "考试状态(0:未考试,1:已考试)", required=true)
|
||||
private Integer examState;
|
||||
private Integer finishState;
|
||||
|
||||
@ApiModelProperty(value = "考试主键", required=true)
|
||||
private String examId;
|
||||
|
||||
@ApiModelProperty(value = "考试名称", required=true)
|
||||
private String title;
|
||||
|
||||
@ApiModelProperty(value = "考试描述", required=true)
|
||||
private String content;
|
||||
|
||||
@ApiModelProperty(value = "是否限时", required=true)
|
||||
private Boolean timeLimit;
|
||||
|
||||
|
||||
@ -149,7 +149,7 @@ public class ExamRegistration extends Model<ExamRegistration> {
|
||||
/**
|
||||
* 考试状态(0:未考试,1:已考试)
|
||||
*/
|
||||
private Integer examState;
|
||||
private Integer finishState;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
|
||||
@ -17,4 +17,6 @@ import java.util.List;
|
||||
public interface ExamRegistrationMapper extends BaseMapper<ExamRegistration> {
|
||||
|
||||
List<ExamRegistrationVO> getRegExamList(ExamRegistrationDTO examRegistrationDTO);
|
||||
|
||||
void updateFinishState(ExamRegistration examRegistration);
|
||||
}
|
||||
|
||||
@ -30,4 +30,6 @@ public interface ExamRegistrationService extends IService<ExamRegistration> {
|
||||
* @Date 2025-7-14 10:45
|
||||
*/
|
||||
List<ExamRegistrationVO> getRegExamList(ExamRegistrationDTO examRegistrationDTO);
|
||||
|
||||
void updateFinishState(ExamRegistration examRegistration);
|
||||
}
|
||||
|
||||
@ -9,6 +9,7 @@ import com.yf.exam.modules.exam.dto.response.ExamRegistrationVO;
|
||||
import com.yf.exam.modules.exam.entity.ExamRegistration;
|
||||
import com.yf.exam.modules.exam.mapper.ExamRegistrationMapper;
|
||||
import com.yf.exam.modules.exam.service.ExamRegistrationService;
|
||||
import com.yf.exam.modules.paper.enums.ExamFinishState;
|
||||
import java.util.List;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
@ -51,7 +52,7 @@ public class ExamRegistrationServiceImpl extends ServiceImpl<ExamRegistrationMap
|
||||
// 复制基本数据
|
||||
BeanUtils.copyProperties(reqDTO, entity);
|
||||
entity.setId(id);
|
||||
entity.setExamState(0);
|
||||
entity.setFinishState(ExamFinishState.UNFINISH);
|
||||
this.saveOrUpdate(entity);
|
||||
}
|
||||
|
||||
@ -59,4 +60,8 @@ public class ExamRegistrationServiceImpl extends ServiceImpl<ExamRegistrationMap
|
||||
public List<ExamRegistrationVO> getRegExamList(ExamRegistrationDTO examRegistrationDTO) {
|
||||
return baseMapper.getRegExamList(examRegistrationDTO);
|
||||
}
|
||||
|
||||
@Override public void updateFinishState(ExamRegistration examRegistration) {
|
||||
baseMapper.updateFinishState(examRegistration);
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,12 +7,11 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.yf.exam.core.api.dto.PagingReqDTO;
|
||||
import com.yf.exam.core.enums.OpenType;
|
||||
import com.yf.exam.core.exception.ServiceException;
|
||||
import com.yf.exam.core.utils.BeanMapper;
|
||||
import com.yf.exam.modules.exam.dto.ExamDTO;
|
||||
import com.yf.exam.modules.exam.dto.ExamRepoDTO;
|
||||
import com.yf.exam.modules.exam.dto.request.ExamSearchDTO;
|
||||
import com.yf.exam.modules.exam.dto.ext.ExamRepoExtDTO;
|
||||
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.ExamReviewRespDTO;
|
||||
import com.yf.exam.modules.exam.entity.Exam;
|
||||
@ -116,7 +115,7 @@ public class ExamServiceImpl extends ServiceImpl<ExamMapper, Exam> implements Ex
|
||||
public ExamDTO findById(String id) {
|
||||
ExamDTO respDTO = new ExamDTO();
|
||||
Exam exam = this.getById(id);
|
||||
BeanMapper.copy(exam, respDTO);
|
||||
BeanUtils.copyProperties(exam, respDTO);
|
||||
return respDTO;
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,19 @@
|
||||
package com.yf.exam.modules.paper.enums;
|
||||
|
||||
/**
|
||||
* 考试报名表考试状态
|
||||
* @author haown
|
||||
* @date 2025-07-15 09:55
|
||||
*/
|
||||
public interface ExamFinishState {
|
||||
|
||||
/**
|
||||
* 未考试
|
||||
*/
|
||||
Integer UNFINISH = 0;
|
||||
|
||||
/**
|
||||
* 已考试
|
||||
*/
|
||||
Integer FINISHED = 1;
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
package com.yf.exam.modules.paper.enums;
|
||||
|
||||
/**
|
||||
* 考试类型
|
||||
* @author haown
|
||||
* @date 2025-07-15 09:55
|
||||
*/
|
||||
public interface ExamType {
|
||||
|
||||
/**
|
||||
* 模拟考试
|
||||
*/
|
||||
Integer MOCK = 1;
|
||||
|
||||
/**
|
||||
* 正式考试
|
||||
*/
|
||||
Integer FORMAL = 2;
|
||||
|
||||
}
|
||||
@ -15,6 +15,8 @@ import com.yf.exam.core.utils.CronUtils;
|
||||
import com.yf.exam.modules.exam.dto.ExamDTO;
|
||||
import com.yf.exam.modules.exam.dto.ExamRepoDTO;
|
||||
import com.yf.exam.modules.exam.dto.ext.ExamRepoExtDTO;
|
||||
import com.yf.exam.modules.exam.entity.ExamRegistration;
|
||||
import com.yf.exam.modules.exam.service.ExamRegistrationService;
|
||||
import com.yf.exam.modules.exam.service.ExamRepoService;
|
||||
import com.yf.exam.modules.exam.service.ExamService;
|
||||
import com.yf.exam.modules.paper.dto.PaperDTO;
|
||||
@ -29,7 +31,9 @@ import com.yf.exam.modules.paper.dto.response.PaperListRespDTO;
|
||||
import com.yf.exam.modules.paper.entity.Paper;
|
||||
import com.yf.exam.modules.paper.entity.PaperQu;
|
||||
import com.yf.exam.modules.paper.entity.PaperQuAnswer;
|
||||
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.PaperState;
|
||||
import com.yf.exam.modules.paper.job.BreakExamJob;
|
||||
import com.yf.exam.modules.paper.mapper.PaperMapper;
|
||||
@ -45,14 +49,19 @@ import com.yf.exam.modules.sys.user.entity.SysUser;
|
||||
import com.yf.exam.modules.sys.user.service.SysUserService;
|
||||
import com.yf.exam.modules.user.book.service.UserBookService;
|
||||
import com.yf.exam.modules.user.exam.service.UserExamService;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 语言设置 服务实现类
|
||||
@ -98,6 +107,9 @@ public class PaperServiceImpl extends ServiceImpl<PaperMapper, Paper> implements
|
||||
@Autowired
|
||||
private JobService jobService;
|
||||
|
||||
@Autowired
|
||||
private ExamRegistrationService examRegistrationService;
|
||||
|
||||
/**
|
||||
* 展示的选项,ABC这样
|
||||
*/
|
||||
@ -505,6 +517,16 @@ public class PaperServiceImpl extends ServiceImpl<PaperMapper, Paper> implements
|
||||
String name = JobPrefix.BREAK_EXAM + paperId;
|
||||
jobService.deleteJob(name, JobGroup.SYSTEM);
|
||||
|
||||
// 正式考试修改报名表,考试状态为已考试
|
||||
ExamDTO examDTO = examService.findById(paper.getExamId());
|
||||
if (Objects.equals(examDTO.getExamType(), ExamType.FORMAL)) {
|
||||
ExamRegistration examRegistration = new ExamRegistration();
|
||||
examRegistration.setExamId(examDTO.getId());
|
||||
examRegistration.setUserId(paper.getUserId());
|
||||
examRegistration.setFinishState(ExamFinishState.FINISHED);
|
||||
examRegistrationService.updateFinishState(examRegistration);
|
||||
}
|
||||
|
||||
//把打错的问题加入错题本
|
||||
List<PaperQuDTO> list = paperQuService.listByPaper(paperId);
|
||||
for(PaperQuDTO qu: list){
|
||||
|
||||
@ -28,7 +28,7 @@
|
||||
<result column="physical_report" property="physicalReport" />
|
||||
<result column="sign_picture" property="signPicture" />
|
||||
<result column="reg_time" property="regTime" />
|
||||
<result column="exam_state" property="examState" />
|
||||
<result column="finish_state" property="finishState" />
|
||||
<result column="create_time" property="createTime" />
|
||||
<result column="update_time" property="updateTime" />
|
||||
</resultMap>
|
||||
@ -37,12 +37,12 @@
|
||||
<sql id="Base_Column_List">
|
||||
id,user_id,user_name,real_name,phone,exam_id,title,email,address,education,graduate_school,major,reg_type,
|
||||
train_institution,train_start_date,train_end_date,card_front,card_back,card_copy,photo,certificate,physical_report,sign_picture,
|
||||
reg_time,exam_state,create_time,update_time
|
||||
reg_time,finish_state,create_time,update_time
|
||||
</sql>
|
||||
|
||||
|
||||
<select id="getRegExamList" resultType="com.yf.exam.modules.exam.dto.response.ExamRegistrationVO">
|
||||
SELECT reg.reg_time, reg.exam_state, ex.title, ex.start_date, ex.end_date, ex.start_time, ex.end_time
|
||||
SELECT reg.user_id as userId, reg.reg_time, reg.finish_state, ex.id as examId, ex.title, ex.content, ex.start_date, ex.end_date, ex.start_time, ex.end_time
|
||||
,ex.total_score, ex.total_time, ex.qualify_score, ex.exam_fee
|
||||
FROM el_exam_registration reg
|
||||
left join el_exam ex on reg.exam_id = ex.id
|
||||
@ -50,9 +50,23 @@
|
||||
<if test="userId!=null">
|
||||
AND reg.user_id=#{userId}
|
||||
</if>
|
||||
<if test="finishState!=null">
|
||||
AND reg.finish_state=#{finishState}
|
||||
</if>
|
||||
<if test="examId!=null">
|
||||
AND reg.exam_id=#{examId}
|
||||
</if>
|
||||
order by ex.start_date, ex.start_time
|
||||
</select>
|
||||
|
||||
<update id="updateFinishState" parameterType="com.yf.exam.modules.exam.entity.ExamRegistration">
|
||||
update el_exam_registration
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="finishState != null">finish_state =
|
||||
#{finishState},
|
||||
</if>
|
||||
</trim>
|
||||
where user_id = #{userId} and exam_id = #{examId}
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user