考生注册时上传图片

This commit is contained in:
haown 2025-07-16 16:57:01 +08:00
parent b9f2f6c2c4
commit 5aace0e987
19 changed files with 201 additions and 214 deletions

View File

@ -53,6 +53,8 @@ public class ShiroConfig {
// 获取网站基本信息
map.put("/exam/api/sys/config/detail", "anon");
// 文件上传
map.put("/exam/api/file/upload", "anon");
// 文件读取
map.put("/upload/file/**", "anon");

View File

@ -41,9 +41,9 @@ public class ExamDTO implements Serializable {
private Integer openType;
/**
* 考试类型1模拟考试2正式考试
* 考试类型1模拟考试2正式考试3补考
* */
@ApiModelProperty(value = "考试类型1模拟考试2正式考试", required=true)
@ApiModelProperty(value = "考试类型1模拟考试2正式考试3补考", required=true)
private Integer examType;

View File

@ -1,6 +1,7 @@
package com.yf.exam.modules.exam.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yf.exam.modules.exam.entity.UserAttachment;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
@ -15,7 +16,7 @@ import org.springframework.format.annotation.DateTimeFormat;
**/
@Data
@ApiModel(value="报名", description="报名")
public class ExamRegistrationDTO implements Serializable {
public class ExamRegistrationDTO extends UserAttachment implements Serializable {
private static final long serialVersionUID = 1L;
@ -61,96 +62,6 @@ public class ExamRegistrationDTO implements Serializable {
@ApiModelProperty(value = "考试名称", required=true)
private String title;
/**
* 电子邮箱
*/
@ApiModelProperty(value = "电子邮箱", required=true)
private String email;
/**
* 通讯地址
*/
@ApiModelProperty(value = "通讯地址", required=true)
private String address;
/**
* 最高学历,1:初中,2:高中/中专,3:大专及以上
*/
@ApiModelProperty(value = "最高学历,1:初中,2:高中/中专,3:大专及以上", required=true)
private Integer education;
/**
* 毕业院校
*/
@ApiModelProperty(value = "毕业院校", required=true)
private String graduateSchool;
/**
* 专业
*/
@ApiModelProperty(value = "专业", required=true)
private String major;
/**
* 报考类别1普通医疗护理员2:老年医疗护理员3孕产妇和新生儿医疗护理员
*/
@ApiModelProperty(value = "报考类别1普通医疗护理员2:老年医疗护理员3孕产妇和新生儿医疗护理员", required=true)
private Integer regType;
/**
* 培训机构
*/
@ApiModelProperty(value = "培训机构")
private String trainInstitution;
/**
* 培训开始时间
*/
@ApiModelProperty(value = "培训开始时间")
private LocalDate trainStartDate;
/**
* 培训结束时间
*/
@ApiModelProperty(value = "培训结束时间")
private LocalDate trainEndDate;
/**
* 身份证正面照片
*/
@ApiModelProperty(value = "身份证正面照片")
private String cardFront;
/**
* 身份证背面照片
*/
@ApiModelProperty(value = "身份证背面照片")
private String cardBack;
/**
* 身份证正反面复印件
*/
@ApiModelProperty(value = "身份证正反面复印件")
private String cardCopy;
/**
* 证件照
*/
@ApiModelProperty(value = "证件照", required=true)
private String photo;
/**
* 学历证明
*/
@ApiModelProperty(value = "学历证明", required=true)
private String certificate;
/**
* 健康体检报告
*/
@ApiModelProperty(value = "健康体检报告", required=true)
private String physicalReport;
/**
* 签名图片
*/

View File

@ -18,9 +18,9 @@ public class ExamSearchDTO {
private Integer openType;
/**
* 考试类型1模拟考试2正式考试
* 考试类型1模拟考试2正式考试3补考
* */
@ApiModelProperty(value = "考试类型1模拟考试2正式考试", required=true)
@ApiModelProperty(value = "考试类型1模拟考试2正式考试3补考", required=true)
private Integer examType;
/**

View File

@ -48,7 +48,7 @@ public class Exam extends Model<Exam> {
private Integer openType;
/**
* 考试类型1模拟考试2正式考试
* 考试类型1模拟考试2正式考试3补考
* */
private Integer examType;

View File

@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import java.time.LocalDate;
import java.util.Date;
import lombok.Data;
@ -16,7 +15,7 @@ import lombok.Data;
**/
@Data
@TableName("el_exam_registration")
public class ExamRegistration extends Model<ExamRegistration> {
public class ExamRegistration extends UserAttachment {
private static final long serialVersionUID = 1L;
@ -61,81 +60,6 @@ public class ExamRegistration extends Model<ExamRegistration> {
*/
private String title;
/**
* 电子邮箱
*/
private String email;
/**
* 通讯地址
*/
private String address;
/**
* 最高学历,1:初中,2:高中/中专,3:大专及以上
*/
private Integer education;
/**
* 毕业院校
*/
private String graduateSchool;
/**
* 专业
*/
private String major;
/**
* 报考类别1普通医疗护理员2:老年医疗护理员3孕产妇和新生儿医疗护理员
*/
private Integer regType;
/**
* 培训机构
*/
private String trainInstitution;
/**
* 培训开始时间
*/
private LocalDate trainStartDate;
/**
* 培训结束时间
*/
private LocalDate trainEndDate;
/**
* 身份证正面照片
*/
private String cardFront;
/**
* 身份证背面照片
*/
private String cardBack;
/**
* 身份证正反面复印件
*/
private String cardCopy;
/**
* 证件照
*/
private String photo;
/**
* 学历证明
*/
private String certificate;
/**
* 健康体检报告
*/
private String physicalReport;
/**
* 签名图片
*/

View File

@ -0,0 +1,104 @@
package com.yf.exam.modules.exam.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import java.time.LocalDate;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
/**
* @description: 用户附件
* @author: haown
* @create: 2025-07-16 14:04
**/
@Data
public class UserAttachment {
/**
* 电子邮箱
*/
@ApiModelProperty(value = "电子邮箱", required=true)
private String email;
/**
* 通讯地址
*/
@ApiModelProperty(value = "通讯地址", required=true)
private String address;
/**
* 最高学历,1:初中,2:高中/中专,3:大专及以上
*/
@ApiModelProperty(value = "最高学历,1:初中,2:高中/中专,3:大专及以上", required=true)
private Integer education;
/**
* 毕业院校
*/
@ApiModelProperty(value = "毕业院校", required=true)
private String graduateSchool;
/**
* 专业
*/
@ApiModelProperty(value = "专业", required=true)
private String major;
/**
* 报考类别1普通医疗护理员2:老年医疗护理员3孕产妇和新生儿医疗护理员
*/
@ApiModelProperty(value = "报考类别1普通医疗护理员2:老年医疗护理员3孕产妇和新生儿医疗护理员", required=true)
private Integer regType;
/**
* 培训机构
*/
@ApiModelProperty(value = "培训机构")
private String trainInstitution;
/**
* 培训开始时间
*/
@ApiModelProperty(value = "培训开始时间")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate trainStartDate;
/**
* 培训结束时间
*/
@ApiModelProperty(value = "培训结束时间")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate trainEndDate;
/**
* 身份证正面照片
*/
private String cardFront;
/**
* 身份证背面照片
*/
private String cardBack;
/**
* 身份证正反面复印件
*/
private String cardCopy;
/**
* 证件照
*/
private String photo;
/**
* 学历证明
*/
private String certificate;
/**
* 健康体检报告
*/
private String physicalReport;
}

View File

@ -19,7 +19,6 @@ import com.yf.exam.modules.exam.mapper.ExamMapper;
import com.yf.exam.modules.exam.service.ExamDepartService;
import com.yf.exam.modules.exam.service.ExamRepoService;
import com.yf.exam.modules.exam.service.ExamService;
import com.yf.exam.modules.paper.enums.ExamType;
import java.time.LocalDate;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
@ -171,7 +170,6 @@ public class ExamServiceImpl extends ServiceImpl<ExamMapper, Exam> implements Ex
*/
@Override
public List<ExamDTO> getExamList(ExamSearchDTO reqDTO) {
reqDTO.setExamType(ExamType.FORMAL);
reqDTO.setStartDate(LocalDate.now());
reqDTO.setEndDate(LocalDate.now());
List<ExamDTO> list = baseMapper.getExamList(reqDTO);

View File

@ -17,4 +17,6 @@ public interface ExamType {
*/
Integer FORMAL = 2;
Integer RESIT = 3;
}

View File

@ -517,9 +517,9 @@ 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)) {
if (Objects.equals(examDTO.getExamType(), ExamType.FORMAL) || Objects.equals(examDTO.getExamType(), ExamType.RESIT)) {
ExamRegistration examRegistration = new ExamRegistration();
examRegistration.setExamId(examDTO.getId());
examRegistration.setUserId(paper.getUserId());

View File

@ -1,5 +1,6 @@
package com.yf.exam.modules.sys.user.dto;
import com.yf.exam.modules.exam.entity.UserAttachment;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
@ -16,7 +17,7 @@ import lombok.Data;
*/
@Data
@ApiModel(value="管理用户", description="管理用户")
public class SysUserDTO implements Serializable {
public class SysUserDTO extends UserAttachment implements Serializable {
private static final long serialVersionUID = 1L;

View File

@ -1,5 +1,6 @@
package com.yf.exam.modules.sys.user.dto.response;
import com.yf.exam.modules.exam.entity.UserAttachment;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -18,7 +19,7 @@ import java.util.List;
*/
@Data
@ApiModel(value="管理用户登录响应类", description="管理用户登录响应类")
public class SysUserLoginDTO implements Serializable {
public class SysUserLoginDTO extends UserAttachment implements Serializable {
private static final long serialVersionUID = 1L;

View File

@ -4,10 +4,9 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.Data;
import com.yf.exam.modules.exam.entity.UserAttachment;
import java.util.Date;
import lombok.Data;
/**
* <p>
@ -19,7 +18,7 @@ import java.util.Date;
*/
@Data
@TableName("sys_user")
public class SysUser extends Model<SysUser> {
public class SysUser extends UserAttachment {
private static final long serialVersionUID = 1L;

View File

@ -1,7 +1,11 @@
package com.yf.exam.modules.sys.user.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yf.exam.modules.sys.user.dto.SysUserDTO;
import com.yf.exam.modules.sys.user.entity.SysUser;
import org.apache.ibatis.annotations.Param;
/**
* <p>
@ -13,4 +17,6 @@ import com.yf.exam.modules.sys.user.entity.SysUser;
*/
public interface SysUserMapper extends BaseMapper<SysUser> {
IPage<SysUserDTO> paging(Page page, @Param("query") SysUserDTO query);
}

View File

@ -5,14 +5,12 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fasterxml.jackson.core.type.TypeReference;
import com.yf.exam.ability.shiro.jwt.JwtUtils;
import com.yf.exam.core.api.ApiError;
import com.yf.exam.core.api.dto.PagingReqDTO;
import com.yf.exam.core.enums.CommonState;
import com.yf.exam.core.exception.ServiceException;
import com.yf.exam.core.utils.BeanMapper;
import com.yf.exam.core.utils.jackson.JsonHelper;
import com.yf.exam.core.utils.passwd.PassHandler;
import com.yf.exam.core.utils.passwd.PassInfo;
import com.yf.exam.modules.sys.user.dto.SysUserDTO;
@ -23,16 +21,16 @@ import com.yf.exam.modules.sys.user.mapper.SysUserMapper;
import com.yf.exam.modules.sys.user.service.SysUserRoleService;
import com.yf.exam.modules.sys.user.service.SysUserService;
import com.yf.exam.modules.user.UserUtils;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.BeanUtils;
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.ArrayList;
import java.util.List;
/**
* <p>
* 语言设置 服务实现类
@ -52,27 +50,33 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
public IPage<SysUserDTO> paging(PagingReqDTO<SysUserDTO> reqDTO) {
//创建分页对象
IPage<SysUser> query = new Page<>(reqDTO.getCurrent(), reqDTO.getSize());
//IPage<SysUser> query = new Page<>(reqDTO.getCurrent(), reqDTO.getSize());
//查询条件
QueryWrapper<SysUser> wrapper = new QueryWrapper<>();
//QueryWrapper<SysUser> wrapper = new QueryWrapper<>();
SysUserDTO params = reqDTO.getParams();
//SysUserDTO params = reqDTO.getParams();
//
//if(params!=null){
// if(!StringUtils.isBlank(params.getUserName())){
// wrapper.lambda().like(SysUser::getUserName, params.getUserName());
// }
//
// if(!StringUtils.isBlank(params.getRealName())){
// wrapper.lambda().like(SysUser::getRealName, params.getRealName());
// }
//}
//
////获得数据
//IPage<SysUser> page = this.page(query, wrapper);
////转换结果
//IPage<SysUserDTO> pageData = JsonHelper.parseObject(page, new TypeReference<Page<SysUserDTO>>(){});
if(params!=null){
if(!StringUtils.isBlank(params.getUserName())){
wrapper.lambda().like(SysUser::getUserName, params.getUserName());
}
// 创建分页对象
Page page = new Page(reqDTO.getCurrent(), reqDTO.getSize());
// 查找分页
IPage<SysUserDTO> pageData = baseMapper.paging(page, reqDTO.getParams());
if(!StringUtils.isBlank(params.getRealName())){
wrapper.lambda().like(SysUser::getRealName, params.getRealName());
}
}
//获得数据
IPage<SysUser> page = this.page(query, wrapper);
//转换结果
IPage<SysUserDTO> pageData = JsonHelper.parseObject(page, new TypeReference<Page<SysUserDTO>>(){});
return pageData;
}
@ -198,10 +202,12 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
// 保存用户
SysUser user = new SysUser();
BeanUtils.copyProperties(reqDTO, user);
user.setId(IdWorker.getIdStr());
user.setUserName(reqDTO.getUserName());
user.setRealName(reqDTO.getRealName());
user.setPhone(reqDTO.getPhone());
//user.setUserName(reqDTO.getUserName());
//user.setRealName(reqDTO.getRealName());
//user.setPhone(reqDTO.getPhone());
PassInfo passInfo = PassHandler.buildPassword(reqDTO.getPassword());
user.setPassword(passInfo.getPassword());
user.setSalt(passInfo.getSalt());
@ -239,7 +245,9 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
private SysUserLoginDTO setToken(SysUser user){
SysUserLoginDTO respDTO = new SysUserLoginDTO();
BeanMapper.copy(user, respDTO);
BeanUtils.copyProperties(user, respDTO);
//BeanMapper.copy(user, respDTO);
// 生成Token
String token = JwtUtils.sign(user.getUserName());

View File

@ -27,9 +27,9 @@ public class UserExamReqDTO extends UserExamDTO {
private String realName;
/**
* 考试类型1模拟考试2正式考试
* 考试类型1模拟考试2正式考试3补考
* */
@ApiModelProperty(value = "考试类型1模拟考试2正式考试", required=true)
@ApiModelProperty(value = "考试类型1模拟考试2正式考试3补考", required=true)
private Integer examType;

View File

@ -24,9 +24,9 @@ public class UserExamRespDTO extends UserExamDTO {
private String title;
/**
* 考试类型1模拟考试2正式考试
* 考试类型1模拟考试2正式考试3补考
* */
@ApiModelProperty(value = "考试类型1模拟考试2正式考试", required=true)
@ApiModelProperty(value = "考试类型1模拟考试2正式考试3补考", required=true)
private Integer examType;
@ApiModelProperty(value = "人员名称", required=true)

View File

@ -102,7 +102,7 @@
<select id="getExamList" resultMap="OnlineResultMap">
SELECT * FROM el_exam
where state = 0 and id not in (select exam_id from el_exam_registration where user_id = #{query.userId})
where state = 0 and (exam_type = 2 or exam_type = 3) and id not in (select exam_id from el_exam_registration where user_id = #{query.userId})
<if test="query!=null">
<if test="query.openType!=null">
AND open_type = #{query.openType}

View File

@ -15,11 +15,42 @@
<result column="create_time" property="createTime" />
<result column="update_time" property="updateTime" />
<result column="state" property="state" />
<result column="email" property="email" />
<result column="address" property="address" />
<result column="education" property="education" />
<result column="graduate_school" property="graduateSchool" />
<result column="reg_type" property="regType" />
<result column="train_institution" property="trainInstitution" />
<result column="train_start_date" property="trainStartDate" />
<result column="train_end_date" property="trainEndDate" />
<result column="card_front" property="cardFront" />
<result column="card_back" property="cardBack" />
<result column="card_copy" property="cardCopy" />
<result column="photo" property="photo" />
<result column="certificate" property="certificate" />
<result column="physical_report" property="physicalReport" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
`id`,`user_name`,`real_name`,phone,`password`,`salt`,`role_ids`,`depart_id`,`create_time`,`update_time`,`state`
`id`,`user_name`,`real_name`,phone,`password`,`salt`,`role_ids`,`depart_id`,`create_time`,`update_time`,`state`,
`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`
</sql>
<select id="paging" resultType="com.yf.exam.modules.sys.user.dto.SysUserDTO">
SELECT *
FROM sys_user
<where>
<if test="query!=null">
<if test="query.userName!=null and query.userName!=''">
AND user_name LIKE CONCAT('%',#{query.userName},'%')
</if>
<if test="query.realName!=null">
AND real_name LIKE CONCAT('%',#{query.realName},'%')
</if>
</if>
</where>
</select>
</mapper>