【新增】试卷任务完整版后台接口

This commit is contained in:
YOHO\20373
2025-04-25 15:51:06 +08:00
parent 60629af34a
commit dfd0cd9eb5
29 changed files with 731 additions and 60 deletions

View File

@@ -1,12 +1,13 @@
package pc.exam.pp.module.exam.controller.admin.paper;
import org.checkerframework.checker.units.qual.C;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import pc.exam.pp.framework.common.pojo.CommonResult;
import pc.exam.pp.module.exam.dal.dataobject.EducationPaperParam;
import pc.exam.pp.module.exam.service.paper.IEducationPaperParamService;
import static pc.exam.pp.module.infra.enums.ErrorCodeConstants.DEMO03_PAPER_SESSION_EXISTS;
/**
* 通用参数Controller
*
@@ -60,5 +61,30 @@ public class EducationPaperParamController
{
return CommonResult.success(educationPaperParamService.deleteEducationPaperParamByParamIds(paramIds));
}
@GetMapping( "/check-can-enter-step4/{taskId}")
public CommonResult ckeckSession(@PathVariable("taskId") String taskId){
EducationPaperParam educationPaperParam = educationPaperParamService.selectEducationPaperParamByTaskId(taskId);
if (educationPaperParam==null){
return CommonResult.error(DEMO03_PAPER_SESSION_EXISTS);
}
String isSession = educationPaperParam.getIsSession();
if ("1".equals(isSession)){
return CommonResult.error(DEMO03_PAPER_SESSION_EXISTS);
}
return CommonResult.success("200");
}
@GetMapping( "/check-can-enter-step4NoMsg/{taskId}")
public CommonResult ckeckSessionNoMsg(@PathVariable("taskId") String taskId){
EducationPaperParam educationPaperParam = educationPaperParamService.selectEducationPaperParamByTaskId(taskId);
if (educationPaperParam==null){
return CommonResult.success("1_001_401_001");
}
String isSession = educationPaperParam.getIsSession();
if ("1".equals(isSession)){
return CommonResult.success("1_001_401_001");
}
return CommonResult.success("200");
}
}

View File

@@ -1,15 +1,22 @@
package pc.exam.pp.module.exam.controller.admin.paper;
import jakarta.servlet.http.HttpServletResponse;
import lombok.extern.java.Log;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import pc.exam.pp.framework.common.pojo.CommonResult;
import pc.exam.pp.framework.common.pojo.PageResult;
import pc.exam.pp.framework.common.util.object.BeanUtils;
import pc.exam.pp.module.exam.controller.admin.paper.dto.PersonRepDto;
import pc.exam.pp.module.exam.controller.admin.paper.vo.DeleteRequestVo;
import pc.exam.pp.module.exam.controller.admin.paper.vo.ExamPersonVo;
import pc.exam.pp.module.exam.controller.admin.paper.vo.SessionStuPageReqVO;
import pc.exam.pp.module.exam.controller.admin.paper.vo.StudentSessionReqVO;
import pc.exam.pp.module.exam.dal.dataobject.EducationPaperParam;
import pc.exam.pp.module.exam.dal.dataobject.EducationPaperPerson;
import pc.exam.pp.module.exam.service.paper.IEducationPaperParamService;
import pc.exam.pp.module.exam.service.paper.IEducationPaperPersonService;
import java.util.ArrayList;
import static pc.exam.pp.module.infra.enums.ErrorCodeConstants.DEMO03_PAPER_SESSION_EXISTS;
import static pc.exam.pp.module.infra.enums.ErrorCodeConstants.DEMO03_PAPER_STUDENT_EXISTS;
import java.util.List;
/**
@@ -26,6 +33,8 @@ public class EducationPaperPersonController
private IEducationPaperPersonService educationPaperPersonService;
// @Autowired
// private IExamStuService examStuService;
@Autowired
private IEducationPaperParamService educationPaperParamService;
/**
* 查询试卷人员分配列表
*/
@@ -47,14 +56,7 @@ public class EducationPaperPersonController
// util.exportExcel(response, list, "试卷人员分配数据");
// }
/**
* 获取试卷人员分配详细信息
*/
@GetMapping(value = "/{taskId}")
public CommonResult getInfo(@PathVariable("taskId") String taskId)
{
return CommonResult.success(educationPaperPersonService.selectEducationPaperPersonByTaskId(taskId));
}
/**
* 新增试卷人员分配
@@ -83,24 +85,64 @@ public class EducationPaperPersonController
return CommonResult.success(educationPaperPersonService.deleteEducationPaperPersonByTaskIds(taskIds));
}
// @GetMapping("/getList")
// public CommonResult list(ExamStu examStu) {
// List<ExamStu> list = examStuService.selectExamStuList(examStu, String.valueOf(getDeptId()), String.valueOf(getUserId()));
//
// List<SessionDto> sessionDtos=new ArrayList<>();
// if (list!=null&&list.size()>0){
// for (ExamStu stu : list) {
// SessionDto sessionDto=new SessionDto();
// sessionDto.setStuClass();
// sessionDto.
//
// }
//
//
// }
//
// return success();
// }
/**
* 根据试卷任务获取人员分配列表
*/
@GetMapping(value = "/{taskId}")
public CommonResult<PageResult<PersonRepDto>> getInfo(ExamPersonVo examPersonVo)
{
PageResult<PersonRepDto> list = educationPaperPersonService.selectEducationPaperPersonByTaskId(examPersonVo.getTaskId());
return CommonResult.success(BeanUtils.toBean(list, PersonRepDto.class));
}
/**
* 根据试卷场次获取人员分配列表
*/
@GetMapping(value = "/getSessionStu")
public CommonResult<PageResult<PersonRepDto>> getSessionStu(ExamPersonVo examPersonVo) {
PageResult<PersonRepDto> list = educationPaperPersonService.selectEducationPaperPersonBySessionId(examPersonVo.getSessionId());
return CommonResult.success(BeanUtils.toBean(list, PersonRepDto.class));
}
/**
* 根据场次id学生信息等多个查询条件 获取人员分配列表(获取没有分配场次的人员)
*/
@GetMapping(value = "/getSessionStuBySearch")
public CommonResult<PageResult<PersonRepDto>> getSessionStuBySearch(SessionStuPageReqVO sessionStuPageReqVO) {
PageResult<PersonRepDto> list = educationPaperPersonService.selectEducationPaperPersonBySearch(sessionStuPageReqVO);
return CommonResult.success(BeanUtils.toBean(list, PersonRepDto.class));
}
/**
* 给任务场次分配学生
*
* @param reqVO 包含学生id场次id,试卷任务id
* @return
*/
@RequestMapping("/setSessionStu")
public CommonResult<String> handleStudentSelection(@RequestBody StudentSessionReqVO reqVO) {
if (reqVO.getStudentIds()!=null&&reqVO.getStudentIds().size()>0){
return CommonResult.success(educationPaperPersonService.setStuAndSession(reqVO));
}else {
return CommonResult.error(DEMO03_PAPER_STUDENT_EXISTS);
}
}
@DeleteMapping("/removeSessionStu")
public CommonResult<Integer> removeSessionStu(@RequestBody StudentSessionReqVO reqVO) {
return CommonResult.success(educationPaperPersonService.removeSessionStu(reqVO));
}
@DeleteMapping("/removeTaskStu")
public CommonResult<Integer> removeTaskStu(@RequestBody DeleteRequestVo deleteRequestVo) {
return CommonResult.success(educationPaperPersonService.removeTaskStu(deleteRequestVo));
}
}

View File

@@ -130,11 +130,14 @@ public class EducationPaperSessionController
return CommonResult.success("修改成功");
}
@PutMapping("/updateSessionStatus") // 更符合RESTful规范
public CommonResult updateSessionStatus(@RequestBody StatusDto statusDto) { // 改为Integer类型
@PutMapping("/updateSessionStatus")
public CommonResult updateSessionStatus(@RequestBody StatusDto statusDto) {
return CommonResult.success(
educationPaperSessionService.changeStatus(statusDto.getSessionId(), statusDto.getStatus())
);
}
}

View File

@@ -123,7 +123,7 @@ public class EducationPaperTaskController
/**
* 获取知识点
*/
@GetMapping("/getPoints")
@GetMapping("/getPoints")
public CommonResult getPoints (@RequestParam(value = "name") String name)
{
return CommonResult.success(educationPaperTaskService.getPoints(name));
@@ -171,4 +171,7 @@ public class EducationPaperTaskController
);
}
}

View File

@@ -0,0 +1,116 @@
package pc.exam.pp.module.exam.controller.admin.paper.dto;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import lombok.Data;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import pc.exam.pp.framework.common.enums.CommonStatusEnum;
import pc.exam.pp.module.system.enums.common.SexEnum;
import java.time.LocalDateTime;
import java.util.Set;
@Data
public class PersonRepDto {
/**
* 用户ID
*/
@TableId
private Long id;
/**
* 用户账号
*/
private String username;
/**
* 加密后的密码
*
* 因为目前使用 {@link BCryptPasswordEncoder} 加密器,所以无需自己处理 salt 盐
*/
private String password;
/**
* 用户昵称
*/
private String nickname;
/**
* 备注
*/
private String remark;
/**
* 部门 ID
*/
private Long deptId;
/**
* 班级 ID
*/
private Long classId;
@TableField
private String className;
/**
* 岗位编号数组
*/
@TableField(typeHandler = JacksonTypeHandler.class)
private Set<Long> postIds;
/**
* 班级编号数组
*/
@TableField(typeHandler = JacksonTypeHandler.class)
private Set<Long> classIds;
/**
* 专业编号数组
*/
@TableField(typeHandler = JacksonTypeHandler.class)
private Set<Long> specialtyIds;
/**
* 用户类型
*/
private String userType;
/**
* 用户邮箱
*/
private String email;
/**
* 手机号码
*/
private String mobile;
/**
* 用户性别
*
* 枚举类 {@link SexEnum}
*/
private Integer sex;
/**
* 用户头像
*/
private String avatar;
/**
* 帐号状态
*
* 枚举 {@link CommonStatusEnum}
*/
private Integer status;
/**
* 最后登录IP
*/
private String loginIp;
/**
* 最后登录时间
*/
private LocalDateTime loginDate;
/** 主键ID */
private String sessionId;
/** 批次 */
private String batch;
private LocalDateTime createTime;
}

View File

@@ -0,0 +1,11 @@
package pc.exam.pp.module.exam.controller.admin.paper.vo;
import lombok.Data;
import java.util.List;
@Data
public class DeleteRequestVo {
private List<String> studentIds;
private String taskId;
}

View File

@@ -0,0 +1,21 @@
package pc.exam.pp.module.exam.controller.admin.paper.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import pc.exam.pp.framework.common.pojo.PageParam;
@Schema(description = "试卷人员vo")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class ExamPersonVo extends PageParam {
/*
试卷任务Id
*/
private String taskId;
/*
场次Id
*/
private String sessionId;
}

View File

@@ -0,0 +1,53 @@
package pc.exam.pp.module.exam.controller.admin.paper.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
import pc.exam.pp.framework.common.pojo.PageParam;
import java.time.LocalDateTime;
import static pc.exam.pp.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "场次学生分页 Request VO")
@Data
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class SessionStuPageReqVO extends PageParam {
@Schema(description = "用户账号,模糊匹配", example = "exam")
private String username;
@Schema(description = "展示状态,参见 CommonStatusEnum 枚举类", example = "1")
private Integer status;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime startTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime endTime;
@Schema(description = "类型")
private String userType;
private String className;
private Long classId;
private String sessionId;
private String taskId;
}

View File

@@ -0,0 +1,13 @@
package pc.exam.pp.module.exam.controller.admin.paper.vo;
import lombok.Data;
import java.util.List;
@Data
public class StudentSessionReqVO {
private List<String> studentIds;
private String sessionId;
private String taskId;
private String batch;
}

View File

@@ -1,5 +1,6 @@
package pc.exam.pp.module.exam.dal.dataobject;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
@@ -23,6 +24,7 @@ public class EducationPaper extends TenantBaseDO
private static final long serialVersionUID = 1L;
/** 主键ID */
@TableId
private String paperId;
/** 试卷任务ID */

View File

@@ -69,4 +69,6 @@ public class EducationPaperParam
private String isConnect;
private String isSession;
}

View File

@@ -33,4 +33,6 @@ public class EducationPaperPerson
//@Excel(name = "场次")
private String sessionId;
private String batch;
}

View File

@@ -10,7 +10,7 @@ import pc.exam.pp.module.exam.controller.admin.paper.vo.TreeEntity;
* @author pengchen
* @date 2025-03-24
*/
public class ExamKnowledgePoints extends TreeEntity
public class ExamPaperKnowledgePoints extends TreeEntity
{
private static final long serialVersionUID = 1L;

View File

@@ -3,8 +3,11 @@ package pc.exam.pp.module.exam.dal.dataobject;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.v3.oas.annotations.info.Contact;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
@@ -20,6 +23,8 @@ import pc.exam.pp.framework.mybatis.core.dataobject.BaseDO;
@Data
@Accessors(chain = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
@AllArgsConstructor
@NoArgsConstructor
public class ExamQuestionAnswer
{
private static final long serialVersionUID = 1L;
@@ -57,4 +62,5 @@ public class ExamQuestionAnswer
private String sort;
}

View File

@@ -2,7 +2,20 @@ package pc.exam.pp.module.exam.dal.mysql.paper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import pc.exam.pp.framework.common.pojo.PageResult;
import pc.exam.pp.framework.mybatis.core.mapper.BaseMapperX;
import pc.exam.pp.framework.mybatis.core.query.MPJLambdaWrapperX;
import pc.exam.pp.framework.tenant.core.aop.TenantIgnore;
import pc.exam.pp.module.exam.controller.admin.paper.dto.PersonRepDto;
import pc.exam.pp.module.exam.controller.admin.paper.vo.DeleteRequestVo;
import pc.exam.pp.module.exam.controller.admin.paper.vo.SessionStuPageReqVO;
import pc.exam.pp.module.exam.controller.admin.paper.vo.StudentSessionReqVO;
import pc.exam.pp.module.exam.controller.admin.student.vo.StudentPageReqVO;
import pc.exam.pp.module.exam.dal.dataobject.EducationPaperPerson;
import pc.exam.pp.module.exam.dal.dataobject.student.StudentClassDO;
import pc.exam.pp.module.exam.dal.dataobject.student.StudentDO;
import pc.exam.pp.module.system.api.user.dto.AdminUserRespDTO;
import java.util.List;
@@ -22,7 +35,7 @@ public interface EducationPaperPersonMapper
* @param taskId 试卷人员分配主键
* @return 试卷人员分配
*/
public EducationPaperPerson selectEducationPaperPersonByTaskId(String taskId);
List<EducationPaperPerson> selectEducationPaperPersonByTaskId(String taskId);
/**
* 查询试卷人员分配列表
@@ -63,4 +76,35 @@ public interface EducationPaperPersonMapper
* @return 结果
*/
public int deleteEducationPaperPersonByTaskIds(String[] taskIds);
PersonRepDto selectUserById(String personId);
String selectUserClassName(Long classId);
List<EducationPaperPerson> selectEducationPaperPersonBySessionId(String sessionId);
List<PersonRepDto> selectEducationPaperPersonByNotInSessionId(SessionStuPageReqVO sessionStuPageReqVO);
Long selectUserClassIdByName(String className);
void insertEducationPaperPersonList(List<EducationPaperPerson> educationPaperPeople);
int removeSessionStu(StudentSessionReqVO reqVO);
void deleteEducationPaperPersonBySessionkIds(String[] sessionIds);
EducationPaperPerson selectByTaskIdAndPersonId(@Param("taskId") String taskId, @Param("studentId") String studentId);
void updateByTaskIdAndStuId(EducationPaperPerson existing);
int removeTaskStu(DeleteRequestVo deleteRequestVo);
List<PersonRepDto> selectEducationPaperPersonBySessionIdNotIn(SessionStuPageReqVO sessionStuPageReqVO);
}

View File

@@ -8,9 +8,8 @@ import org.apache.ibatis.annotations.Param;
import pc.exam.pp.framework.common.pojo.PageResult;
import pc.exam.pp.framework.mybatis.core.mapper.BaseMapperX;
import pc.exam.pp.framework.mybatis.core.query.LambdaQueryWrapperX;
import pc.exam.pp.framework.tenant.core.aop.TenantIgnore;
import pc.exam.pp.module.exam.controller.admin.paper.vo.PaperTaskPageVo;
import pc.exam.pp.module.exam.dal.dataobject.ExamKnowledgePoints;
import pc.exam.pp.module.exam.dal.dataobject.ExamPaperKnowledgePoints;
import pc.exam.pp.module.exam.dal.dataobject.EducationPaperTask;
/**
@@ -88,7 +87,7 @@ public interface EducationPaperTaskMapper extends BaseMapperX<EducationPaperTask
List<String> getKeywords();
List<ExamKnowledgePoints> getPoints(@Param("id") Long id);
List<ExamPaperKnowledgePoints> getPoints(@Param("id") Long id);
Integer getQuCount(@Param("taskSpecialty") String taskSpecialty
,@Param("spName") String spName

View File

@@ -1,11 +1,25 @@
package pc.exam.pp.module.exam.service.paper;
import com.alibaba.excel.util.StringUtils;
import jakarta.annotation.Resource;
import org.apache.poi.hssf.record.DVALRecord;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import pc.exam.pp.framework.common.pojo.PageResult;
import pc.exam.pp.module.exam.controller.admin.paper.dto.PersonRepDto;
import pc.exam.pp.module.exam.controller.admin.paper.vo.DeleteRequestVo;
import pc.exam.pp.module.exam.controller.admin.paper.vo.SessionStuPageReqVO;
import pc.exam.pp.module.exam.controller.admin.paper.vo.StudentSessionReqVO;
import pc.exam.pp.module.exam.controller.admin.student.vo.StudentPageReqVO;
import pc.exam.pp.module.exam.dal.dataobject.EducationPaperPerson;
import pc.exam.pp.module.exam.dal.dataobject.student.StudentDO;
import pc.exam.pp.module.exam.dal.mysql.paper.EducationPaperPersonMapper;
import pc.exam.pp.module.exam.dal.mysql.paper.EducationPaperSessionMapper;
import pc.exam.pp.module.exam.dal.mysql.student.StudentMapper;
import pc.exam.pp.module.system.api.user.dto.AdminUserRespDTO;
import java.util.ArrayList;
import java.util.List;
/**
@@ -20,6 +34,9 @@ public class EducationPaperPersonServiceImpl implements IEducationPaperPersonSer
@Autowired
private EducationPaperPersonMapper educationPaperPersonMapper;
@Autowired
private EducationPaperSessionMapper educationPaperSessionMapper;
/**
* 查询试卷人员分配
*
@@ -27,11 +44,143 @@ public class EducationPaperPersonServiceImpl implements IEducationPaperPersonSer
* @return 试卷人员分配
*/
@Override
public EducationPaperPerson selectEducationPaperPersonByTaskId(String taskId)
public PageResult<PersonRepDto> selectEducationPaperPersonByTaskId(String taskId)
{
return educationPaperPersonMapper.selectEducationPaperPersonByTaskId(taskId);
List<EducationPaperPerson> educationPaperPeoples= educationPaperPersonMapper.selectEducationPaperPersonByTaskId(taskId);
List<PersonRepDto> personRepDtos=new ArrayList<>();
if (educationPaperPeoples!=null&&educationPaperPeoples.size()>0){
for (EducationPaperPerson educationPaperPerson : educationPaperPeoples) {
PersonRepDto personRepDto = educationPaperPersonMapper.selectUserById(educationPaperPerson.getPersonId());
if ( StringUtils.isNotBlank(personRepDto.getClassId().toString())){
personRepDto.setClassName(educationPaperPersonMapper.selectUserClassName(personRepDto.getClassId())) ;
}
personRepDto.setSessionId(educationPaperPerson.getSessionId());
personRepDto.setBatch(educationPaperPerson.getBatch());
personRepDtos.add(personRepDto);
}
}
PageResult<PersonRepDto> pageResult=new PageResult<>();
pageResult.setList(personRepDtos);
pageResult.setTotal((long) personRepDtos.size());
return pageResult;
}
@Override
public PageResult<PersonRepDto> selectEducationPaperPersonBySessionId(String sessionId) {
List<EducationPaperPerson> educationPaperPeoples= educationPaperPersonMapper.selectEducationPaperPersonBySessionId(sessionId);
List<PersonRepDto> personRepDtos=new ArrayList<>();
if (educationPaperPeoples!=null&&educationPaperPeoples.size()>0){
for (EducationPaperPerson educationPaperPerson : educationPaperPeoples) {
PersonRepDto personRepDto = educationPaperPersonMapper.selectUserById(educationPaperPerson.getPersonId());
if ( StringUtils.isNotBlank(personRepDto.getClassId().toString())){
personRepDto.setClassName(educationPaperPersonMapper.selectUserClassName(personRepDto.getClassId())) ;
}
personRepDto.setSessionId(educationPaperPerson.getSessionId());
personRepDto.setBatch(educationPaperPerson.getBatch());
personRepDtos.add(personRepDto);
}
}
PageResult<PersonRepDto> pageResult=new PageResult<>();
pageResult.setList(personRepDtos);
pageResult.setTotal((long) personRepDtos.size());
return pageResult;
}
@Override
public PageResult<PersonRepDto> selectEducationPaperPersonBySearch(SessionStuPageReqVO sessionStuPageReqVO) {
String className = sessionStuPageReqVO.getClassName();
if (StringUtils.isNotBlank(className)) {
Long classId=educationPaperPersonMapper.selectUserClassIdByName(className);
sessionStuPageReqVO.setClassId(classId);
}
List<PersonRepDto> personRepDtos;
String sessionId = sessionStuPageReqVO.getSessionId();
if (StringUtils.isNotBlank(sessionId)){
personRepDtos = educationPaperPersonMapper.selectEducationPaperPersonByNotInSessionId(sessionStuPageReqVO);
}
else {
personRepDtos = educationPaperPersonMapper.selectEducationPaperPersonBySessionIdNotIn(sessionStuPageReqVO);
}
if (personRepDtos!=null&&personRepDtos.size()>0){
for (PersonRepDto personRepDto : personRepDtos) {
personRepDto.setClassName(educationPaperPersonMapper.selectUserClassName(personRepDto.getClassId())) ;
}
}
PageResult<PersonRepDto> pageResult=new PageResult<>();
pageResult.setList(personRepDtos);
pageResult.setTotal((long) personRepDtos.size());
return pageResult;
}
@Override
public String setStuAndSession(StudentSessionReqVO reqVO) {
//先根据场次id 把该场次的
//选中学生的id
List<String> studentIds = reqVO.getStudentIds();
//考场id
String sessionId = reqVO.getSessionId();
//试卷任务id
String taskId = reqVO.getTaskId();
//考场批次
String batch = reqVO.getBatch();
//这里要taskId和studentIds去判断表里是否有 符合这两个条件的数据因为会有学生在此考场不设置sessionid的
//根据taskId和studentIds获得EducationPaperPerson在判断它的sessionid是否为空为空把sessionId和batch赋值再插入
List<EducationPaperPerson> educationPaperPeople=new ArrayList<>();
if (studentIds!=null&&studentIds.size()>0){
for (String studentId : studentIds) {
// 查询是否存在该 taskId + studentId 的记录,且 sessionId 为 null
EducationPaperPerson existing = educationPaperPersonMapper.selectByTaskIdAndPersonId(taskId, studentId);
if (existing != null && (existing.getSessionId() == null || existing.getSessionId().isEmpty())) {
// 更新已有记录的 sessionId 和 batch
existing.setSessionId(sessionId);
existing.setBatch(batch);
educationPaperPersonMapper.updateByTaskIdAndStuId(existing);
} else if (existing == null) {
EducationPaperPerson educationPaperPerson=new EducationPaperPerson();
educationPaperPerson.setPersonId(studentId);
educationPaperPerson.setSessionId(sessionId);
educationPaperPerson.setBatch(batch);
educationPaperPerson.setTaskId(taskId);
educationPaperPeople.add(educationPaperPerson);
}
// 如果存在但 sessionId 已有值,则跳过
}
if (educationPaperPeople!=null&&educationPaperPeople.size()>0){
educationPaperPersonMapper.insertEducationPaperPersonList(educationPaperPeople);
}
}
return "0";
}
@Override
public int removeSessionStu(StudentSessionReqVO reqVO) {
return educationPaperPersonMapper.removeSessionStu(reqVO);
}
@Override
public int removeTaskStu(DeleteRequestVo deleteRequestVo) {
return educationPaperPersonMapper.removeTaskStu(deleteRequestVo);
}
/**
* 查询试卷人员分配列表
*
@@ -91,4 +240,22 @@ public class EducationPaperPersonServiceImpl implements IEducationPaperPersonSer
{
return educationPaperPersonMapper.deleteEducationPaperPersonByTaskId(taskId);
}
// @Override
// public PageResult<PersonRepDto> selectExamStuList(StudentPageReqVO examStu) {
//
//
// PageResult<StudentDO> studentDOPageResult = educationPaperPersonMapper.selectExamStuList(examStu);
// List<StudentDO> list = studentDOPageResult.getList();
// if (list!=null&&list.size()>0){
// for (StudentDO studentDO : list) {
// studentDO.getId()
//
// }
// }
// PageResult<PersonRepDto> pageResult=new PageResult<>();
//
// return pageResult;
// }
}

View File

@@ -153,6 +153,7 @@ public class EducationPaperServiceImpl implements IEducationPaperService
String uuid = IdUtils.simpleUUID();
educationPaper.setPaperId(uuid);
educationPaper.setTaskId(taskid);
educationPaper.setTenantId(TenantContextHolder.getRequiredTenantId());
educationPaperMapper.insertEducationPaper(educationPaper);
System.out.println(examQuestionIds+"examQuestionIdsexamQuestionIds");

View File

@@ -3,6 +3,7 @@ package pc.exam.pp.module.exam.service.paper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import pc.exam.pp.module.exam.dal.dataobject.EducationPaperSession;
import pc.exam.pp.module.exam.dal.mysql.paper.EducationPaperPersonMapper;
import pc.exam.pp.module.exam.dal.mysql.paper.EducationPaperSessionMapper;
import pc.exam.pp.module.exam.utils.uuid.IdUtils;
@@ -19,7 +20,8 @@ public class EducationPaperSessionServiceImpl implements IEducationPaperSessionS
{
@Autowired
private EducationPaperSessionMapper educationPaperSessionMapper;
@Autowired
private EducationPaperPersonMapper educationPaperPersonMapper;
/**
* 查询试卷场次
*
@@ -79,6 +81,8 @@ public class EducationPaperSessionServiceImpl implements IEducationPaperSessionS
@Override
public int deleteEducationPaperSessionBySessionIds(String[] sessionIds)
{
educationPaperPersonMapper.deleteEducationPaperPersonBySessionkIds(sessionIds);
return educationPaperSessionMapper.deleteEducationPaperSessionBySessionIds(sessionIds);
}

View File

@@ -92,6 +92,7 @@ public class EducationPaperTaskServiceImpl implements IEducationPaperTaskService
educationPaperParam.setDirectory("KSWJ");
educationPaperParam.setUploadTime("5");
educationPaperParam.setIsDel("0");
educationPaperParam.setIsSession("1");
if ("1".equals(educationPaperTask.getTaskType())){
educationPaperParam.setIsRepeat("1");
educationPaperParam.setIsAnswer("1");
@@ -160,7 +161,7 @@ public class EducationPaperTaskServiceImpl implements IEducationPaperTaskService
}
@Override
public List<ExamKnowledgePoints> getPoints(String name) {
public List<ExamPaperKnowledgePoints> getPoints(String name) {
Long id= educationPaperTaskMapper.getPointIdByName(name);
return educationPaperTaskMapper.getPoints(id);
}

View File

@@ -1,6 +1,12 @@
package pc.exam.pp.module.exam.service.paper;
import pc.exam.pp.framework.common.pojo.PageResult;
import pc.exam.pp.module.exam.controller.admin.paper.dto.PersonRepDto;
import pc.exam.pp.module.exam.controller.admin.paper.vo.DeleteRequestVo;
import pc.exam.pp.module.exam.controller.admin.paper.vo.SessionStuPageReqVO;
import pc.exam.pp.module.exam.controller.admin.paper.vo.StudentSessionReqVO;
import pc.exam.pp.module.exam.controller.admin.student.vo.StudentPageReqVO;
import pc.exam.pp.module.exam.dal.dataobject.EducationPaperPerson;
import java.util.List;
@@ -19,7 +25,7 @@ public interface IEducationPaperPersonService
* @param taskId 试卷人员分配主键
* @return 试卷人员分配
*/
public EducationPaperPerson selectEducationPaperPersonByTaskId(String taskId);
PageResult<PersonRepDto> selectEducationPaperPersonByTaskId(String taskId);
/**
* 查询试卷人员分配列表
@@ -60,5 +66,20 @@ public interface IEducationPaperPersonService
* @return 结果
*/
public int deleteEducationPaperPersonByTaskId(String taskId);
PageResult<PersonRepDto> selectEducationPaperPersonBySessionId(String sessionId);
PageResult<PersonRepDto> selectEducationPaperPersonBySearch(SessionStuPageReqVO sessionStuPageReqVO);
String setStuAndSession(StudentSessionReqVO reqVO);
int removeSessionStu(StudentSessionReqVO reqVO);
int removeTaskStu(DeleteRequestVo deleteRequestVo);
// PageResult<PersonRepDto> selectExamStuList(StudentPageReqVO examStu);
}

View File

@@ -5,7 +5,7 @@ import pc.exam.pp.framework.common.pojo.PageResult;
import pc.exam.pp.module.exam.controller.admin.paper.dto.SchemeParam;
import pc.exam.pp.module.exam.controller.admin.paper.dto.TempDto;
import pc.exam.pp.module.exam.controller.admin.paper.vo.PaperTaskPageVo;
import pc.exam.pp.module.exam.dal.dataobject.ExamKnowledgePoints;
import pc.exam.pp.module.exam.dal.dataobject.ExamPaperKnowledgePoints;
import pc.exam.pp.module.exam.dal.dataobject.EducationPaperTask;
import java.util.List;
@@ -73,7 +73,7 @@ public interface IEducationPaperTaskService
List<String> getKeywords();
List<ExamKnowledgePoints> getPoints(String name);
List<ExamPaperKnowledgePoints> getPoints(String name);
Integer getQuCount(SchemeParam param);

View File

@@ -66,6 +66,7 @@
AND tenant_id =#{tId}
and audit = 0
and status = 0
and deleted ='0'
<if test="educationPaperScheme.quLevel != null and educationPaperScheme.quLevel != ''">
AND qu_level = #{educationPaperScheme.quLevel}
</if>
@@ -93,17 +94,17 @@
select task_id from education_paper where paper_id=#{paperId}
</select>
<select id="selectPaperByTaskId" resultType="java.lang.String">
select paper_id from education_paper where task_id=#{taskId}
select paper_id from education_paper where task_id=#{taskId} and deleted ='0'
</select>
<select id="selectPaperRandomByTaskId" resultType="java.lang.String">
select paper_id from education_paper where task_id=#{taskId} and roll_up ='2'
</select>
<select id="selectPaperByTaskIdAndRoll" resultType="java.lang.String">
select paper_id from education_paper where task_id=#{taskId}
select paper_id from education_paper where task_id=#{taskId} and deleted ='0'
</select>
<select id="getPaperByTaskIdByType" resultType="java.lang.String">
select paper_id from education_paper where task_id=#{taskId} and status ='0' and roll_up IS NOT NULL
select paper_id from education_paper where task_id=#{taskId} and status ='0' and deleted ='0' and roll_up IS NOT NULL
</select>
<select id="getSelectPaperIdBySchemeIds" resultType="java.lang.String">
@@ -112,7 +113,7 @@ select task_id from education_paper where paper_id=#{paperId}
</select>
<select id="selectPaperListByTaskId" resultMap="EducationPaperResult">
<include refid="selectEducationPaperVo"/>
where task_id =#{taskId}
where task_id =#{taskId} and deleted ='0'
</select>

View File

@@ -19,10 +19,11 @@
<result property="isAnswer" column="is_answer" />
<result property="isLook" column="is_look" />
<result property="isConnect" column="is_connect" />
<result property="isSession" column="is_session" />
</resultMap>
<sql id="selectEducationPaperParamVo">
select param_id, task_id, is_exam_password, exam_password, usb, save_grades, driver, directory, upload_time, is_del,is_repeat ,is_answer,is_look,is_connect from education_paper_param
select param_id, task_id, is_exam_password, exam_password, usb, save_grades, driver, directory, upload_time, is_del,is_repeat ,is_answer,is_look,is_connect,is_session from education_paper_param
</sql>
<select id="selectEducationPaperParamList" parameterType="EducationPaperParam" resultMap="EducationPaperParamResult">
@@ -66,6 +67,7 @@
<if test="isAnswer != null">is_answer,</if>
<if test="isLook != null">is_look,</if>
<if test="isConnect != null">is_connect,</if>
<if test="isSession != null">is_session,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
@@ -83,7 +85,7 @@
<if test="isAnswer != null">#{isAnswer},</if>
<if test="isLook != null">#{isLook},</if>
<if test="isConnect != null">#{isConnect},</if>
<if test="isSession != null">#{isSession},</if>
</trim>
</insert>
@@ -104,7 +106,7 @@
<if test="isAnswer != null">is_answer = #{isAnswer},</if>
<if test="isLook != null">is_look = #{isLook},</if>
<if test="isConnect != null">is_connect = #{isConnect},</if>
<if test="isSession != null">is_session = #{isSession},</if>
</trim>
where param_id = #{paramId}

View File

@@ -8,10 +8,11 @@
<result property="taskId" column="task_id" />
<result property="personId" column="person_id" />
<result property="sessionId" column="session_id" />
<result property="batch" column="batch" />
</resultMap>
<sql id="selectEducationPaperPersonVo">
select task_id, person_id, session_id from education_paper_person
select task_id, person_id, session_id,batch from education_paper_person
</sql>
<select id="selectEducationPaperPersonList" parameterType="EducationPaperPerson" resultMap="EducationPaperPersonResult">
@@ -20,6 +21,7 @@
<if test="taskId != null and taskId != ''"> and task_id = #{taskId}</if>
<if test="personId != null and personId != ''"> and person_id = #{personId}</if>
<if test="sessionId != null and sessionId != ''"> and session_id = #{sessionId}</if>
<if test="batch != null and batch != ''"> and batch = #{batch}</if>
</where>
</select>
@@ -27,6 +29,85 @@
<include refid="selectEducationPaperPersonVo"/>
where task_id = #{taskId}
</select>
<select id="selectUserById" resultType="pc.exam.pp.module.exam.controller.admin.paper.dto.PersonRepDto">
select * from system_users where id =#{personId}
</select>
<select id="selectUserClassName" resultType="java.lang.String">
select name from exam_class where id =#{classId}
</select>
<select id="selectEducationPaperPersonBySessionId" parameterType="String" resultMap="EducationPaperPersonResult">
<include refid="selectEducationPaperPersonVo"/>
where session_id = #{sessionId}
</select>
<select id="selectEducationPaperPersonByNotInSessionId"
resultType="pc.exam.pp.module.exam.controller.admin.paper.dto.PersonRepDto">
SELECT DISTINCT s.*
FROM system_users s
LEFT JOIN education_paper_person pp ON s.id = pp.person_id
WHERE
s.user_type = #{userType}
AND s.id IN (
SELECT person_id FROM education_paper_person WHERE
session_id ='' and
session_id !=#{sessionId} and task_id =#{taskId}
)
<if test="username != null and username != ''">
AND s.username LIKE CONCAT('%', #{username}, '%')
</if>
<if test="status != null">
AND s.status = #{status}
</if>
<if test="startTime != null and endTime != null">
AND s.create_time BETWEEN #{startTime} AND #{endTime}
</if>
<if test="classId != null and classId != ''">
AND s.class_id = #{classId}
</if>
ORDER BY s.id DESC
</select>
<select id="selectUserClassIdByName" resultType="java.lang.Long">
select id from exam_class where name =#{className} and deleted ='0'
</select>
<select id="selectByTaskIdAndPersonId" resultMap="EducationPaperPersonResult">
<include refid="selectEducationPaperPersonVo"/>
where task_id = #{taskId}
and person_id =#{studentId}
</select>
<select id="selectEducationPaperPersonBySessionIdNotIn"
resultType="pc.exam.pp.module.exam.controller.admin.paper.dto.PersonRepDto">
SELECT DISTINCT s.*
FROM system_users s
LEFT JOIN education_paper_person pp ON s.id = pp.person_id
WHERE
s.user_type = #{userType}
AND s.id NOT IN (
SELECT person_id FROM education_paper_person WHERE task_id =#{taskId}
)
<if test="username != null and username != ''">
AND s.username LIKE CONCAT('%', #{username}, '%')
</if>
<if test="status != null">
AND s.status = #{status}
</if>
<if test="startTime != null and endTime != null">
AND s.create_time BETWEEN #{startTime} AND #{endTime}
</if>
<if test="classId != null and classId != ''">
AND s.class_id = #{classId}
</if>
ORDER BY s.id DESC
</select>
<insert id="insertEducationPaperPerson" parameterType="EducationPaperPerson">
insert into education_paper_person
@@ -34,22 +115,38 @@
<if test="taskId != null">task_id,</if>
<if test="personId != null">person_id,</if>
<if test="sessionId != null">session_id,</if>
<if test="batch != null">batch,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="taskId != null">#{taskId},</if>
<if test="personId != null">#{personId},</if>
<if test="sessionId != null">#{sessionId},</if>
<if test="batch != null">#{batch},</if>
</trim>
</insert>
<insert id="insertEducationPaperPersonList">
insert into education_paper_person (task_id, person_id, session_id, batch) VALUES
<foreach collection="list" item="item" separator=",">
(
#{item.taskId}, #{item.personId}, #{item.sessionId}, #{item.batch}
)
</foreach>
</insert>
<update id="updateEducationPaperPerson" parameterType="EducationPaperPerson">
update education_paper_person
<trim prefix="SET" suffixOverrides=",">
<if test="personId != null">person_id = #{personId},</if>
<if test="sessionId != null">session_id = #{sessionId},</if>
<if test="batch != null">batch = #{batch},</if>
</trim>
where task_id = #{taskId}
</update>
<update id="updateByTaskIdAndStuId">
update education_paper_person set session_id =#{sessionId},batch =#{batch}
where task_id =#{taskId} and person_id=#{personId}
</update>
<delete id="deleteEducationPaperPersonByTaskId" parameterType="String">
delete from education_paper_person where task_id = #{taskId}
@@ -61,4 +158,29 @@
#{taskId}
</foreach>
</delete>
<delete id="removeSessionStu" >
DELETE FROM education_paper_person
WHERE session_id = #{sessionId}
AND task_id = #{taskId}
AND batch = #{batch}
AND person_id IN
<foreach collection="studentIds" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<delete id="deleteEducationPaperPersonBySessionkIds">
delete from education_paper_person where education_paper_person.session_id in
<foreach item="sessionId" collection="array" open="(" separator="," close=")">
#{sessionId}
</foreach>
</delete>
<delete id="removeTaskStu">
DELETE FROM education_paper_person
WHERE task_id = #{taskId}
AND person_id IN
<foreach collection="studentIds" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -18,15 +18,13 @@
<result property="deleted" column="deleted" />
<result property="tenantId" column="tenant_id" />
</resultMap>
<resultMap type="ExamKnowledgePoints" id="ExamSpecialtyResult">
<resultMap type="ExamPaperKnowledgePoints" id="ExamSpecialtyResult">
<result property="spId" column="sp_id" />
<result property="parentId" column="parent_id" />
<result property="ancestors" column="ancestors" />
<result property="spName" column="sp_name" />
<result property="orderNum" column="order_num" />
<result property="status" column="status" />
<result property="delFlag" column="deleted" />
<result property="tenantId" column="tenant_id" />
<result property="unite" column="unite" />
<result property="treeNum" column="tree_num" />
</resultMap>
@@ -39,18 +37,19 @@
<select id="selectEducationPaperTaskByTaskId" parameterType="String" resultMap="EducationPaperTaskResult">
<include refid="selectEducationPaperTaskVo"/>
where task_id = #{taskId}
and deleted='0'
</select>
<select id="getSpecialityList" resultType="java.lang.String">
select sp_name from exam_specialty
where parent_id =0
and del_flag='0'
and deleted='0'
</select>
<select id="getCourseList" resultType="java.lang.String">
SELECT sp_name
FROM exam_specialty
WHERE ancestors REGEXP '^[0-9]+,[0-9]+,[0-9]+$'
and del_flag='0'
and deleted='0'
</select>
<select id="getKeywords" resultType="java.lang.String">

View File

@@ -68,4 +68,9 @@ public interface ErrorCodeConstants {
ErrorCode DEMO03_GRADE_NOT_EXISTS = new ErrorCode(1_001_201_008, "学生班级不存在");
ErrorCode DEMO03_GRADE_EXISTS = new ErrorCode(1_001_201_009, "学生班级已存在");
// ========== 试卷人员 1-001-301-000 ==========
ErrorCode DEMO03_PAPER_STUDENT_EXISTS = new ErrorCode(1_001_301_001, "请选择学生");
// ========== 试卷参数 1-001-401-000 ==========
ErrorCode DEMO03_PAPER_SESSION_EXISTS = new ErrorCode(1_001_401_001, "请开启考场设置");
}

View File

@@ -127,6 +127,12 @@
<artifactId>gson</artifactId>
<version>2.10</version>
</dependency>
<dependency>
<groupId>pc.exam.gg</groupId>
<artifactId>exam-module-exam-biz</artifactId>
<version>2.4.2-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>

View File

@@ -340,7 +340,6 @@ exam:
- exam_question_keyword
- exam_question_score
- sys_file
- education_paper
- education_paper_param
- education_paper_person
- education_paper_qu