diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/EducationPaperController.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/EducationPaperController.java new file mode 100644 index 00000000..6edbae00 --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/EducationPaperController.java @@ -0,0 +1,168 @@ +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.PaperQueryRequest; +import pc.exam.pp.module.exam.controller.admin.paper.dto.StatusDto; +import pc.exam.pp.module.exam.controller.admin.paper.vo.PaperPageVo; +import pc.exam.pp.module.exam.dal.dataobject.EducationPaper; +import pc.exam.pp.module.exam.dal.dataobject.EducationPaperTask; +import pc.exam.pp.module.exam.service.paper.IEducationPaperService; + +import java.util.List; + +import static pc.exam.pp.framework.common.exception.enums.GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR; + +/** + * 试卷Controller + * + * @author pengchen + * @date 2025-04-15 + */ +@RestController +@RequestMapping("/exam/paper") +public class EducationPaperController +{ + @Autowired + private IEducationPaperService educationPaperService; + + /** + * 查询试卷列表 + */ + @GetMapping("/list") + public CommonResult> list(PaperPageVo paperPageVo) + { + PageResult pageResult = educationPaperService.selectEducationPaperList(paperPageVo); + return CommonResult.success(BeanUtils.toBean(pageResult, EducationPaper.class)); + } + + /** + * 导出试卷列表 + */ +// @PostMapping("/export") +// public void export(HttpServletResponse response, EducationPaper educationPaper) +// { +// List list = educationPaperService.selectEducationPaperList(educationPaper); +// ExcelUtil util = new ExcelUtil(EducationPaper.class); +// util.exportExcel(response, list, "试卷数据"); +// } + + /** + * 获取试卷详细信息 + */ + @GetMapping(value = "/{paperId}") + public CommonResult getInfo(@PathVariable("paperId") String paperId) + { + return CommonResult.success(educationPaperService.selectEducationPaperByPaperId(paperId)); + } + + /** + * 新增试卷 + */ + @GetMapping("/add") + public CommonResult add(@RequestParam("num") Integer num,@RequestParam("taskid") String taskid,@RequestParam("taskSpecialty") String taskSpecialty) + { + + return CommonResult.success(educationPaperService.addPaperList(num,taskid,taskSpecialty)); + } + + /** + * 修改试卷 + */ + @PutMapping + public CommonResult edit(@RequestBody EducationPaper educationPaper) + { + return CommonResult.success(educationPaperService.updateEducationPaper(educationPaper)); + } + + /** + * 删除试卷 + */ + @DeleteMapping("/{paperIds}") + public CommonResult remove(@PathVariable String[] paperIds) + { + return CommonResult.success(educationPaperService.deleteEducationPaperByPaperIds(paperIds)); + } + + /** + * 根据方案获取试卷 + */ + @GetMapping(value = "/getPaperByTaskId") + public CommonResult getPaperByTaskId(@RequestParam(value = "taskId") String taskId) + { + return CommonResult.success(educationPaperService.selectPaperByTaskId(taskId)); + } + + @PostMapping("/update") + public CommonResult update(@RequestBody EducationPaper educationPaper) + { + //根据方案id,查找所属试卷 ,把随机的清空掉 + String taskId = educationPaper.getTaskId(); + String rollUp = educationPaper.getRollUp(); + if ("0".equals(rollUp)||"1".equals(rollUp )){ + //先清空 改试卷 的抽卷方式 + String paperId = educationPaper.getPaperId(); + + //如果 把 ab卷的方式改成 固定的了,要把所有试卷的抽卷方式清空 + //查找方案下所有不是此抽卷方式的试卷id + List strings = educationPaperService.selectPaperByTaskIdAndRoll(taskId); + if (strings!=null&&strings.size()>0){ + //根据试卷id,批量清空试卷格式 + educationPaperService.updateRandomByids(strings); + } + //再更新 + educationPaperService.updateEducationPaper(educationPaper); + + + }else if ("2".equals(rollUp)){ + //根据方案,直接把所属试卷 抽卷方式全部 设为随机 + + //查找方案下所有试卷id + List strings = educationPaperService.selectPaperByTaskId(taskId); + if (strings!=null&&strings.size()>0){ + //根据试卷id,批量设置试卷格式 + educationPaperService.updateEducationByids(strings); + } + }else if("3".equals(rollUp)){ + //查找方案下所有试卷id + List strings = educationPaperService.selectPaperByTaskId(taskId); + if (strings!=null&&strings.size()>0){ + //根据试卷id,批量设置试卷格式 + educationPaperService.updateEducationByidsThree(strings); + } + } + + else { + return CommonResult.error(INTERNAL_SERVER_ERROR.getCode(),"未知抽卷方式!"); + } + + + return CommonResult.success(educationPaper); + } + /** + * 根据方案获取已经设置好的试卷 + */ + @PostMapping(value = "/getPaperByTaskIdByType") + public CommonResult getPaperByTaskIdByType(@RequestBody PaperQueryRequest requestData) + { + + + return CommonResult.success(educationPaperService.getPaperByTaskIdByType(requestData.getTaskId(), requestData.getRows())); + } + + + @PutMapping("/updatePaperStatus") // 更符合RESTful规范 + public CommonResult updateTaskStatus(@RequestBody StatusDto statusDto) { // 改为Integer类型 + return CommonResult.success( + educationPaperService.changeStatus(statusDto.getPaperId(), statusDto.getStatus()) + ); + } + +} diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/EducationPaperParamController.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/EducationPaperParamController.java new file mode 100644 index 00000000..057da9a6 --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/EducationPaperParamController.java @@ -0,0 +1,64 @@ +package pc.exam.pp.module.exam.controller.admin.paper; + + +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; + +/** + * 通用参数Controller + * + * @author pengchen + * @date 2025-04-16 + */ +@RestController +@RequestMapping("/exam/param") +public class EducationPaperParamController +{ + @Autowired + private IEducationPaperParamService educationPaperParamService; + + + + + + /** + * 获取通用参数详细信息 + */ + @GetMapping(value = "/getInfo") + public CommonResult getInfo(@RequestParam("taskId") String taskId) + { + EducationPaperParam educationPaperParam= educationPaperParamService.selectEducationPaperParamByTaskId(taskId); + return CommonResult.success(educationPaperParam); + } + + /** + * 新增通用参数 + */ + @PostMapping + public CommonResult add(@RequestBody EducationPaperParam educationPaperParam) + { + return CommonResult.success(educationPaperParamService.insertEducationPaperParam(educationPaperParam)); + } + + /** + * 修改通用参数 + */ + @PutMapping + public CommonResult edit(@RequestBody EducationPaperParam educationPaperParam) + { + return CommonResult.success(educationPaperParamService.updateEducationPaperParam(educationPaperParam)); + } + + /** + * 删除通用参数 + */ + @DeleteMapping("/{paramIds}") + public CommonResult remove(@PathVariable String[] paramIds) + { + return CommonResult.success(educationPaperParamService.deleteEducationPaperParamByParamIds(paramIds)); + } +} + diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/EducationPaperPersonController.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/EducationPaperPersonController.java new file mode 100644 index 00000000..ee4ea024 --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/EducationPaperPersonController.java @@ -0,0 +1,106 @@ +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.module.exam.dal.dataobject.EducationPaperPerson; +import pc.exam.pp.module.exam.service.paper.IEducationPaperPersonService; + +import java.util.ArrayList; +import java.util.List; + +/** + * 试卷人员分配Controller + * + * @author pengchen + * @date 2025-04-18 + */ +@RestController +@RequestMapping("/exam/person") +public class EducationPaperPersonController +{ + @Autowired + private IEducationPaperPersonService educationPaperPersonService; +// @Autowired +// private IExamStuService examStuService; + /** + * 查询试卷人员分配列表 + */ + @GetMapping("/list") + public CommonResult list(EducationPaperPerson educationPaperPerson) + { + List list = educationPaperPersonService.selectEducationPaperPersonList(educationPaperPerson); + return CommonResult.success(list); + } + + /** + * 导出试卷人员分配列表 + */ +// @PostMapping("/export") +// public void export(HttpServletResponse response, EducationPaperPerson educationPaperPerson) +// { +// List list = educationPaperPersonService.selectEducationPaperPersonList(educationPaperPerson); +// ExcelUtil util = new ExcelUtil(EducationPaperPerson.class); +// util.exportExcel(response, list, "试卷人员分配数据"); +// } + + /** + * 获取试卷人员分配详细信息 + */ + @GetMapping(value = "/{taskId}") + public CommonResult getInfo(@PathVariable("taskId") String taskId) + { + return CommonResult.success(educationPaperPersonService.selectEducationPaperPersonByTaskId(taskId)); + } + + /** + * 新增试卷人员分配 + */ + @PostMapping + public CommonResult add(@RequestBody EducationPaperPerson educationPaperPerson) + { + return CommonResult.success(educationPaperPersonService.insertEducationPaperPerson(educationPaperPerson)); + } + + /** + * 修改试卷人员分配 + */ + @PutMapping + public CommonResult edit(@RequestBody EducationPaperPerson educationPaperPerson) + { + return CommonResult.success(educationPaperPersonService.updateEducationPaperPerson(educationPaperPerson)); + } + + /** + * 删除试卷人员分配 + */ + @DeleteMapping("/{taskIds}") + public CommonResult remove(@PathVariable String[] taskIds) + { + return CommonResult.success(educationPaperPersonService.deleteEducationPaperPersonByTaskIds(taskIds)); + } + +// @GetMapping("/getList") +// public CommonResult list(ExamStu examStu) { +// List list = examStuService.selectExamStuList(examStu, String.valueOf(getDeptId()), String.valueOf(getUserId())); +// +// List sessionDtos=new ArrayList<>(); +// if (list!=null&&list.size()>0){ +// for (ExamStu stu : list) { +// SessionDto sessionDto=new SessionDto(); +// sessionDto.setStuClass(); +// sessionDto. +// +// } +// +// +// } +// +// return success(); +// } + + +} diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/EducationPaperQuController.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/EducationPaperQuController.java new file mode 100644 index 00000000..ebe55de6 --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/EducationPaperQuController.java @@ -0,0 +1,94 @@ +package pc.exam.pp.module.exam.controller.admin.paper; + +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.module.exam.dal.dataobject.EducationPaperQu; +import pc.exam.pp.module.exam.service.paper.IEducationPaperQuService; + +import java.util.List; + +/** + * 试卷试题Controller + * + * @author pengchen + * @date 2025-04-15 + */ +@RestController +@RequestMapping("/exam/qu") +public class EducationPaperQuController +{ + @Autowired + private IEducationPaperQuService educationPaperQuService; + + /** + * 查询试卷试题列表 + */ + @GetMapping("/list") + public CommonResult list(EducationPaperQu educationPaperQu) + { + List list = educationPaperQuService.selectEducationPaperQuList(educationPaperQu); + return CommonResult.success(list); + } + + /** + * 导出试卷试题列表 + */ +// @PostMapping("/export") +// public void export(HttpServletResponse response, EducationPaperQu educationPaperQu) +// { +// List list = educationPaperQuService.selectEducationPaperQuList(educationPaperQu); +// ExcelUtil util = new ExcelUtil(EducationPaperQu.class); +// util.exportExcel(response, list, "试卷试题数据"); +// } + + /** + * 获取试卷试题详细信息 + */ + @GetMapping(value = "/{paperId}") + public CommonResult getInfo(@PathVariable("paperId") String paperId) + { + return CommonResult.success(educationPaperQuService.selectEducationPaperQuByPaperId(paperId)); + } + + /** + * 新增试卷试题 + */ + @PostMapping + public CommonResult add(@RequestBody EducationPaperQu educationPaperQu) + { + return CommonResult.success(educationPaperQuService.insertEducationPaperQu(educationPaperQu)); + } + + /** + * 修改试卷试题 + */ + @PutMapping + public CommonResult edit(@RequestBody EducationPaperQu educationPaperQu) + { + return CommonResult.success(educationPaperQuService.updateEducationPaperQu(educationPaperQu)); + } + + /** + * 删除试卷试题 + */ + @DeleteMapping("/{paperIds}") + public CommonResult remove(@PathVariable String[] paperIds) + { + return CommonResult.success(educationPaperQuService.deleteEducationPaperQuByPaperIds(paperIds)); + } + + + /** + * 获取试卷详细信息 + */ + @GetMapping(value = "/getPaper") + public CommonResult getPaper(@RequestParam(value = "paperId") String paperId) + { + return CommonResult.success(educationPaperQuService.selectPaperQuListByPaperId(paperId)); + } + + +} + diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/EducationPaperSchemeController.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/EducationPaperSchemeController.java new file mode 100644 index 00000000..cb6e771d --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/EducationPaperSchemeController.java @@ -0,0 +1,81 @@ +package pc.exam.pp.module.exam.controller.admin.paper; + +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.EducationPaperScheme; +import pc.exam.pp.module.exam.service.paper.IEducationPaperSchemeService; + +import java.util.List; + +/** + * 试卷方案Controller + * + * @author pengchen + * @date 2025-04-15 + */ +@RestController +@RequestMapping("/exam/scheme") +public class EducationPaperSchemeController +{ + @Autowired + private IEducationPaperSchemeService educationPaperSchemeService; + + /** + * 查询试卷方案列表 + */ + @GetMapping("/list") + public CommonResult list(EducationPaperScheme educationPaperScheme) + { + List list = educationPaperSchemeService.selectEducationPaperSchemeList(educationPaperScheme); + return CommonResult.success(list); + } + + /** + * 导出试卷方案列表 + */ +// @PostMapping("/export") +// public void export(HttpServletResponse response, EducationPaperScheme educationPaperScheme) +// { +// List list = educationPaperSchemeService.selectEducationPaperSchemeList(educationPaperScheme); +// ExcelUtil util = new ExcelUtil(EducationPaperScheme.class); +// util.exportExcel(response, list, "试卷方案数据"); +// } + + /** + * 获取试卷方案详细信息 + */ + @GetMapping(value = "/{schemeId}") + public CommonResult getInfo(@PathVariable("schemeId") String schemeId) + { + return CommonResult.success(educationPaperSchemeService.selectEducationPaperSchemeBySchemeId(schemeId)); + } + + /** + * 新增试卷方案 + */ + @PostMapping + public CommonResult add(@RequestBody EducationPaperScheme educationPaperScheme) + { + + return CommonResult.success(educationPaperSchemeService.insertEducationPaperScheme(educationPaperScheme)); + } + + /** + * 修改试卷方案 + */ + @PutMapping + public CommonResult edit(@RequestBody EducationPaperScheme educationPaperScheme) + { + return CommonResult.success(educationPaperSchemeService.updateEducationPaperScheme(educationPaperScheme)); + } + + /** + * 删除试卷方案 + */ + @DeleteMapping("/{schemeIds}") + public CommonResult remove(@PathVariable String[] schemeIds) + { + return CommonResult.success(educationPaperSchemeService.deleteEducationPaperSchemeBySchemeIds(schemeIds)); + } +} diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/EducationPaperSessionController.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/EducationPaperSessionController.java new file mode 100644 index 00000000..e0b051f2 --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/EducationPaperSessionController.java @@ -0,0 +1,140 @@ +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.web.bind.annotation.*; +import pc.exam.pp.framework.common.pojo.CommonResult; +import pc.exam.pp.module.exam.controller.admin.paper.dto.SessionParamDto; +import pc.exam.pp.module.exam.controller.admin.paper.dto.StatusDto; +import pc.exam.pp.module.exam.dal.dataobject.EducationPaperSession; +import pc.exam.pp.module.exam.service.paper.IEducationPaperSessionService; + +import java.util.Date; +import java.util.List; + +import static pc.exam.pp.framework.common.exception.enums.GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR; + +/** + * 试卷场次Controller + * + * @author pengchen + * @date 2025-04-17 + */ +@RestController +@RequestMapping("/exam/session") +public class EducationPaperSessionController +{ + @Autowired + private IEducationPaperSessionService educationPaperSessionService; + + /** + * 查询试卷场次列表 + */ + @GetMapping("/list") + public CommonResult list(EducationPaperSession educationPaperSession) + { + List list = educationPaperSessionService.selectEducationPaperSessionList(educationPaperSession); + return CommonResult.success(list); + } + + /** + * 导出试卷场次列表 + */ +// @PostMapping("/export") +// public void export(HttpServletResponse response, EducationPaperSession educationPaperSession) +// { +// List list = educationPaperSessionService.selectEducationPaperSessionList(educationPaperSession); +// ExcelUtil util = new ExcelUtil(EducationPaperSession.class); +// util.exportExcel(response, list, "试卷场次数据"); +// } + + /** + * 获取试卷场次详细信息 + */ + @GetMapping(value = "/{sessionId}") + public CommonResult getInfo(@PathVariable("sessionId") String sessionId) + { + return CommonResult.success(educationPaperSessionService.selectEducationPaperSessionBySessionId(sessionId)); + } + + /** + * 新增试卷场次 + */ + @PostMapping + public CommonResult add(@RequestBody EducationPaperSession educationPaperSession) + { + Date startTime = educationPaperSession.getStartTime(); + Date endTime = educationPaperSession.getEndTime(); + // 判空 + if (startTime == null || endTime == null) { + return CommonResult.error(INTERNAL_SERVER_ERROR.getCode(),"考试开始时间和结束时间不能为空"); + } + // 判断结束时间不能早于开始时间 + if (endTime.before(startTime)) { + return CommonResult.error(INTERNAL_SERVER_ERROR.getCode(),"考试结束时间不能早于开始时间"); + } + + + return CommonResult.success(educationPaperSessionService.insertEducationPaperSession(educationPaperSession)); + } + + /** + * 修改试卷场次 + */ + @PutMapping + public CommonResult edit(@RequestBody EducationPaperSession educationPaperSession) + { + Date startTime = educationPaperSession.getStartTime(); + Date endTime = educationPaperSession.getEndTime(); + // 判空 + if (startTime == null || endTime == null) { + return CommonResult.error(INTERNAL_SERVER_ERROR.getCode(),"考试开始时间和结束时间不能为空"); + } + // 判断结束时间不能早于开始时间 + if (endTime.before(startTime)) { + return CommonResult.error(INTERNAL_SERVER_ERROR.getCode(),"考试结束时间不能早于开始时间"); + } + return CommonResult.success(educationPaperSessionService.updateEducationPaperSession(educationPaperSession)); + } + + /** + * 删除试卷场次 + */ + @DeleteMapping("/{sessionIds}") + public CommonResult remove(@PathVariable String[] sessionIds) + { + return CommonResult.success(educationPaperSessionService.deleteEducationPaperSessionBySessionIds(sessionIds)); + } + + /** + * 修改试卷场次详细信息 + */ + @PostMapping(value = "/set") + public CommonResult set(@RequestBody SessionParamDto param) { + List rows = param.getRows(); + List selectedIds = param.getSelectedIds(); + + String idsStr = (selectedIds != null && !selectedIds.isEmpty()) + ? String.join(",", selectedIds) + : null; + + for (String row : rows) { + EducationPaperSession session = educationPaperSessionService.selectEducationPaperSessionBySessionId(row); + if (session != null) { + session.setPaperId(idsStr); + educationPaperSessionService.updateEducationPaperSession(session); + } + } + + return CommonResult.success("修改成功"); + } + + @PutMapping("/updateSessionStatus") // 更符合RESTful规范 + public CommonResult updateSessionStatus(@RequestBody StatusDto statusDto) { // 改为Integer类型 + return CommonResult.success( + educationPaperSessionService.changeStatus(statusDto.getSessionId(), statusDto.getStatus()) + ); + } + +} diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/EducationPaperTaskController.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/EducationPaperTaskController.java new file mode 100644 index 00000000..fa5961ca --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/EducationPaperTaskController.java @@ -0,0 +1,174 @@ +package pc.exam.pp.module.exam.controller.admin.paper; + + +import jakarta.annotation.security.PermitAll; +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.framework.common.pojo.PageResult; +import pc.exam.pp.framework.common.util.object.BeanUtils; +import pc.exam.pp.framework.tenant.core.context.TenantContextHolder; +import pc.exam.pp.module.exam.controller.admin.paper.dto.SchemeParam; +import pc.exam.pp.module.exam.controller.admin.paper.dto.StatusDto; +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.EducationPaperTask; +import pc.exam.pp.module.exam.service.paper.IEducationPaperTaskService; +import static pc.exam.pp.framework.common.exception.enums.GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR; +import java.util.List; + + +/** + * 试卷任务Controller + * + * @author pengchen + * @date 2025-04-14 + */ +@RestController +@RequestMapping("/exam/task") +public class EducationPaperTaskController +{ + @Autowired + private IEducationPaperTaskService educationPaperTaskService; + + /** + * 查询试卷任务列表 + */ + @GetMapping("/list") + public CommonResult> list(PaperTaskPageVo educationPaperTask) + { + PageResult pageResult = educationPaperTaskService.selectEducationPaperTaskList(educationPaperTask); + return CommonResult.success(BeanUtils.toBean(pageResult, EducationPaperTask.class)); + + } + + /** + * 导出试卷任务列表 + */ +// @PostMapping("/export") +// public void export(HttpServletResponse response, EducationPaperTask educationPaperTask) +// { +// List list = educationPaperTaskService.selectEducationPaperTaskList(educationPaperTask,String.valueOf(getUserId()),String.valueOf(getDeptId())); +// ExcelUtil util = new ExcelUtil(EducationPaperTask.class); +// util.exportExcel(response, list, "试卷任务数据"); +// } + + /** + * 获取试卷任务详细信息 + */ + @GetMapping(value = "/{taskId}") + public CommonResult getInfo(@PathVariable("taskId") String taskId) + { + return CommonResult.success(educationPaperTaskService.selectEducationPaperTaskByTaskId(taskId)); + } + + /** + * 新增试卷任务 + */ + @PostMapping + public CommonResult add(@RequestBody EducationPaperTask educationPaperTask) + { + + return CommonResult.success(educationPaperTaskService.insertEducationPaperTask(educationPaperTask)); + } + + /** + * 修改试卷任务 + */ + @PutMapping + public CommonResult edit(@RequestBody EducationPaperTask educationPaperTask) + { + return CommonResult.success(educationPaperTaskService.updateEducationPaperTask(educationPaperTask)); + } + + /** + * 删除试卷任务 + */ + @DeleteMapping("/del/{taskId}") + public CommonResult remove(@PathVariable String taskId ) + { + return CommonResult.success(educationPaperTaskService.deleteEducationPaperTaskByTaskId(taskId)); + } + @DeleteMapping("/{taskIds}") + public CommonResult removeIds(@PathVariable String[] taskIds ) + { + return CommonResult.success(educationPaperTaskService.deleteEducationPaperTaskByTaskIds(taskIds)); + } + /** + * 获取专业列表 + */ + @GetMapping("/getSpeciality") + public CommonResult getSpeciality() + { + return CommonResult.success(educationPaperTaskService.getSpecialityList()); + } + + /** + * 获取题型列表 + */ + @GetMapping("/getCourse") + public CommonResult getCourse() + { + return CommonResult.success(educationPaperTaskService.getCourseList()); + } + + /** + * 获取关键字 + */ + @GetMapping("/getKeywords") + public CommonResult getKeywords() + { + return CommonResult.success(educationPaperTaskService.getKeywords()); + } + /** + * 获取知识点 + */ + @GetMapping("/getPoints") + public CommonResult getPoints (@RequestParam(value = "name") String name) + { + return CommonResult.success(educationPaperTaskService.getPoints(name)); + } + + + /* + 按照方案返回试题数量 + */ + @PostMapping("/getQuestionCount") + @PermitAll + public CommonResult fetchQuestionCount(@RequestBody SchemeParam param) { + + Integer count= educationPaperTaskService.getQuCount(param); + return CommonResult.success(count); + } + + + + @PostMapping("/submitSelection") + public CommonResult submitSelection(@RequestBody TempDto tempDto) { + System.out.println("接收到的任务ID: " + tempDto.getTaskId()); + System.out.println("接收到的选项: " + tempDto.getOptions()); + String taskId = tempDto.getTaskId(); + if (taskId == null || taskId.trim().isEmpty()) { + return CommonResult.error(INTERNAL_SERVER_ERROR.getCode(),"缺失模板方案参数Id!"); + } + List options = tempDto.getOptions(); + + if (options!=null&&options.size()>0){ + educationPaperTaskService.submitSelection(tempDto); + + + }else { + return CommonResult.error(INTERNAL_SERVER_ERROR.getCode(),"请选择复制的参数!"); + } + + return CommonResult.success("复制成功"); + } + + @PutMapping("/updateTaskStatus") // 更符合RESTful规范 + public CommonResult updateTaskStatus(@RequestBody StatusDto statusDto) { // 改为Integer类型 + return CommonResult.success( + educationPaperTaskService.changeStatus(statusDto.getTaskId(), statusDto.getStatus()) + ); + } + +} diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/dto/PaperQueryRequest.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/dto/PaperQueryRequest.java new file mode 100644 index 00000000..95ba7fef --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/dto/PaperQueryRequest.java @@ -0,0 +1,41 @@ +package pc.exam.pp.module.exam.controller.admin.paper.dto; + +import java.util.List; + +public class PaperQueryRequest { + private String taskId; + private List rows; + + public PaperQueryRequest() { + } + + public PaperQueryRequest(String taskId, List rows) { + this.taskId = taskId; + this.rows = rows; + } + + public String getTaskId() { + return taskId; + } + + public void setTaskId(String taskId) { + this.taskId = taskId; + } + + public List getRows() { + return rows; + } + + public void setRows(List rows) { + this.rows = rows; + } + + + @Override + public String toString() { + return "PaperQueryRequest{" + + "taskId='" + taskId + '\'' + + ", rows=" + rows + + '}'; + } +} diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/dto/SchemeParam.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/dto/SchemeParam.java new file mode 100644 index 00000000..e75c626d --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/dto/SchemeParam.java @@ -0,0 +1,17 @@ +package pc.exam.pp.module.exam.controller.admin.paper.dto; + +import lombok.Data; + +import java.util.List; + +@Data +public class SchemeParam { + private String spName; + private String quLevel; + private List pointIds; + private List keyword; + private String taskSpecialty; + + +} + diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/dto/SessionDto.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/dto/SessionDto.java new file mode 100644 index 00000000..2e5fe85a --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/dto/SessionDto.java @@ -0,0 +1,71 @@ +package pc.exam.pp.module.exam.controller.admin.paper.dto; + + +public class SessionDto { + /** 学生编码 */ + private String stuCode; + + /** 学生账号 */ + private String stuUsername; + + private String stuClass; + + /** 帐号状态(0正常 1停用) */ + private String status; + + /** 批次 */ + private String batch; + + + public String getStuCode() { + return stuCode; + } + + public void setStuCode(String stuCode) { + this.stuCode = stuCode; + } + + public String getStuUsername() { + return stuUsername; + } + + public void setStuUsername(String stuUsername) { + this.stuUsername = stuUsername; + } + + public String getStuClass() { + return stuClass; + } + + public void setStuClass(String stuClass) { + this.stuClass = stuClass; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getBatch() { + return batch; + } + + public void setBatch(String batch) { + this.batch = batch; + } + + public SessionDto() { + } + + + public SessionDto(String stuCode, String stuUsername, String stuClass, String status, String batch) { + this.stuCode = stuCode; + this.stuUsername = stuUsername; + this.stuClass = stuClass; + this.status = status; + this.batch = batch; + } +} diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/dto/SessionParamDto.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/dto/SessionParamDto.java new file mode 100644 index 00000000..c6d397fe --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/dto/SessionParamDto.java @@ -0,0 +1,34 @@ +package pc.exam.pp.module.exam.controller.admin.paper.dto; + +import java.util.List; + +public class SessionParamDto { + private List selectedIds; + private List rows; + + + public SessionParamDto() { + } + + + public SessionParamDto(List selectedIds, List rows) { + this.selectedIds = selectedIds; + this.rows = rows; + } + + public List getSelectedIds() { + return selectedIds; + } + + public void setSelectedIds(List selectedIds) { + this.selectedIds = selectedIds; + } + + public List getRows() { + return rows; + } + + public void setRows(List rows) { + this.rows = rows; + } +} diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/dto/StatusDto.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/dto/StatusDto.java new file mode 100644 index 00000000..36a9fed9 --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/dto/StatusDto.java @@ -0,0 +1,12 @@ +package pc.exam.pp.module.exam.controller.admin.paper.dto; + +import lombok.Data; + +@Data +public class StatusDto { + + private String status; + private String taskId; + private String paperId; + private String sessionId; +} diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/dto/TempDto.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/dto/TempDto.java new file mode 100644 index 00000000..30aabc67 --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/dto/TempDto.java @@ -0,0 +1,33 @@ +package pc.exam.pp.module.exam.controller.admin.paper.dto; + +import java.util.List; + +public class TempDto { + private String taskId; + private List options; + + public String getTaskId() { + return taskId; + } + + public void setTaskId(String taskId) { + this.taskId = taskId; + } + + public List getOptions() { + return options; + } + + public void setOptions(List options) { + this.options = options; + } + + + public TempDto() { + } + + public TempDto(String taskId, List options) { + this.taskId = taskId; + this.options = options; + } +} diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/vo/ExamPaperVo.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/vo/ExamPaperVo.java new file mode 100644 index 00000000..9a137675 --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/vo/ExamPaperVo.java @@ -0,0 +1,35 @@ +package pc.exam.pp.module.exam.controller.admin.paper.vo; + +import pc.exam.pp.module.exam.dal.dataobject.EducationPaperScheme; +import pc.exam.pp.module.exam.dal.dataobject.ExamQuestion; + +import java.util.List; + +public class ExamPaperVo { + List questionList; + List educationPaperSchemeList; + + public ExamPaperVo() { + } + + public ExamPaperVo(List examQuestionList, List educationPaperSchemeList) { + this.questionList = examQuestionList; + this.educationPaperSchemeList = educationPaperSchemeList; + } + + public List getExamQuestionList() { + return questionList; + } + + public void setExamQuestionList(List examQuestionList) { + this.questionList = examQuestionList; + } + + public List getEducationPaperSchemeList() { + return educationPaperSchemeList; + } + + public void setEducationPaperSchemeList(List educationPaperSchemeList) { + this.educationPaperSchemeList = educationPaperSchemeList; + } +} diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/vo/PaperPageVo.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/vo/PaperPageVo.java new file mode 100644 index 00000000..06f15389 --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/vo/PaperPageVo.java @@ -0,0 +1,35 @@ +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 PaperPageVo extends PageParam { + /** 主键ID */ + private String paperId; + + /** 试卷任务ID */ + // @Excel(name = "试卷任务ID") + private String taskId; + + /** 使用次数 */ + // @Excel(name = "使用次数") + private String counts; + + /** 抽卷方式(0固定1AB2随机) */ + //@Excel(name = "抽卷方式(0固定1AB2随机)") + private String rollUp; + + /** 0A1B */ + //Excel(name = "0A1B") + private String isAb; + + /** 0启用1不启 */ + // @Excel(name = "0启用1不启") + private String status; +} diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/vo/PaperTaskPageVo.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/vo/PaperTaskPageVo.java new file mode 100644 index 00000000..08e8c907 --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/vo/PaperTaskPageVo.java @@ -0,0 +1,48 @@ +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 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 = "试卷方案vo") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class PaperTaskPageVo extends PageParam { + /** 主键ID */ + private String taskId; + + /** 任务名称 */ + //@Excel(name = "任务名称") + private String taskName; + + /** 专业 */ + //@Excel(name = "专业") + private String taskSpecialty; + + /** 试卷任务模式 */ + //@Excel(name = "试卷任务模式") + private String taskType; + + /** 是否为模板 */ + //@Excel(name = "是否为模板") + private String isTemplate; + + /** 是否启用(0:启用,1:停用) */ + //@Excel(name = "是否启用", readConverterExp = "0=:启用,1:停用") + private String status; + + + + + @Schema(description = "创建时间", example = "[2022-07-01 00:00:00, 2022-07-01 23:59:59]") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; +} diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/vo/TreeEntity.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/vo/TreeEntity.java new file mode 100644 index 00000000..f4e35794 --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/vo/TreeEntity.java @@ -0,0 +1,79 @@ +package pc.exam.pp.module.exam.controller.admin.paper.vo; + +import java.util.ArrayList; +import java.util.List; + +/** + * Tree基类 + * + * @author pengchen + */ +public class TreeEntity +{ + private static final long serialVersionUID = 1L; + + /** 父菜单名称 */ + private String parentName; + + /** 父菜单ID */ + private Long parentId; + + /** 显示顺序 */ + private Integer orderNum; + + /** 祖级列表 */ + private String ancestors; + + /** 子客户端 */ + private List children = new ArrayList<>(); + + public String getParentName() + { + return parentName; + } + + public void setParentName(String parentName) + { + this.parentName = parentName; + } + + public Long getParentId() + { + return parentId; + } + + public void setParentId(Long parentId) + { + this.parentId = parentId; + } + + public Integer getOrderNum() + { + return orderNum; + } + + public void setOrderNum(Integer orderNum) + { + this.orderNum = orderNum; + } + + public String getAncestors() + { + return ancestors; + } + + public void setAncestors(String ancestors) + { + this.ancestors = ancestors; + } + + public List getChildren() + { + return children; + } + + public void setChildren(List children) + { + this.children = children; + } +} diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/question/ExamQuestionController.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/question/ExamQuestionController.java new file mode 100644 index 00000000..f39615f0 --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/question/ExamQuestionController.java @@ -0,0 +1,103 @@ +package pc.exam.pp.module.exam.controller.admin.question; + +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.annotation.Resource; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +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.module.exam.controller.admin.question.dto.ExamQuestionDto; +import pc.exam.pp.module.exam.controller.admin.question.vo.QuestionVo; +import pc.exam.pp.module.exam.dal.dataobject.EducationPaperTask; +import pc.exam.pp.module.exam.dal.dataobject.ExamQuestion; +import pc.exam.pp.module.exam.service.question.IExamQuestionService; + +import java.util.List; + +import static pc.exam.pp.framework.common.pojo.CommonResult.success; + +/** + * 试题(hyc)Controller + * + * @author pengchen + * @date 2025-03-13 + */ +@RestController +@RequestMapping("/exam/question") +@Tag( name = "试题管理接口") +@Validated +public class ExamQuestionController +{ + @Resource + private IExamQuestionService examQuestionService; + + /** + * 查询试题(hyc)列表 + */ + //@PreAuthorize("@ss.hasPermi('system:question:list')") + @GetMapping("/list") + public CommonResult> list(QuestionVo questionVo) + { + PageResult pageResult = examQuestionService.selectExamQuestionList(questionVo); + return success(pageResult); + } + + /** + * 导出试题(hyc)列表 + */ + //@PreAuthorize("@ss.hasPermi('system:question:export')") +// @PostMapping("/export") +// public void export(HttpServletResponse response, ExamQuestionDto examQuestionDto) +// { +// List list = examQuestionService.selectExamQuestionList(examQuestionDto,String.valueOf(getUserId()),String.valueOf(getDeptId())); +// ExcelUtil util = new ExcelUtil(ExamQuestion.class); +// util.exportExcel(response, list, "试题(hyc)数据"); +// } + + /** + * 获取试题(hyc)详细信息 + */ + //@PreAuthorize("@ss.hasPermi('system:question:query')") + @GetMapping(value = "/{quId}") + public CommonResult getInfo(@PathVariable("quId") String quId) + { + return success(examQuestionService.selectExamQuestionByQuId(quId)); + } + + /** + * 新增试题(hyc) + */ + //@PreAuthorize("@ss.hasPermi('system:question:add')") + @PostMapping + public CommonResult add(@RequestBody ExamQuestion examQuestion) + { + System.out.println(examQuestion.getContent()+"content"); + return success(examQuestionService.insertExamQuestion(examQuestion)); + } + + + /** + * 修改试题(hyc) + */ + //@PreAuthorize("@ss.hasPermi('system:question:edit')") + @PutMapping + public CommonResult edit(@RequestBody ExamQuestion examQuestion) + { + return success(examQuestionService.updateExamQuestion(examQuestion)); + } + + /** + * 删除试题(hyc) + */ + //@PreAuthorize("@ss.hasPermi('system:question:remove')") + @DeleteMapping("/{ids}") + public CommonResult remove(@PathVariable String[] ids) + { + return success(examQuestionService.deleteExamQuestionByQuIds(ids)); + } + + + + +} diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/question/dto/ExamQuestionDto.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/question/dto/ExamQuestionDto.java new file mode 100644 index 00000000..212ae490 --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/question/dto/ExamQuestionDto.java @@ -0,0 +1,79 @@ +package pc.exam.pp.module.exam.controller.admin.question.dto; + +public class ExamQuestionDto { + /** 题型难度 */ + private String quLevel; + /** 题型标志位 */ + private String subjectName; + /** 题库名称*/ + private String quBankName; + /** 课程类别 */ + private String courseName; + /** 专业分类 */ + private String specialtyName; + /** 知识点 */ + private String pointNames; + + + public ExamQuestionDto() { + } + + public ExamQuestionDto(String quLevel, String subjectName, String quBankName, String courseName, String specialtyName , String pointNames) { + this.quLevel = quLevel; + this.subjectName = subjectName; + this.quBankName = quBankName; + this.courseName = courseName; + this.specialtyName = specialtyName; + this.pointNames = pointNames; + + } + + public String getQuLevel() { + return quLevel; + } + + public void setQuLevel(String quLevel) { + this.quLevel = quLevel; + } + + public String getSubjectName() { + return subjectName; + } + + public void setSubjectName(String subjectName) { + this.subjectName = subjectName; + } + + public String getQuBankName() { + return quBankName; + } + + public void setQuBankName(String quBankName) { + this.quBankName = quBankName; + } + + public String getCourseName() { + return courseName; + } + + public void setCourseName(String courseName) { + this.courseName = courseName; + } + + public String getSpecialtyName() { + return specialtyName; + } + + public void setSpecialtyName(String specialtyName) { + this.specialtyName = specialtyName; + } + + + public String getPointNames() { + return pointNames; + } + + public void setPointNames(String pointNames) { + this.pointNames = pointNames; + } +} diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/question/vo/QuestionVo.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/question/vo/QuestionVo.java new file mode 100644 index 00000000..a6e05e98 --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/question/vo/QuestionVo.java @@ -0,0 +1,30 @@ +package pc.exam.pp.module.exam.controller.admin.question.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 QuestionVo extends PageParam { + + + private String subjectName; + + private String quLevel; + + private String courseName; + + private String specialtyName; + + private String pointNames; + + private String audit; + + private String status; + +} diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/EducationPaper.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/EducationPaper.java new file mode 100644 index 00000000..147a1d85 --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/EducationPaper.java @@ -0,0 +1,50 @@ +package pc.exam.pp.module.exam.dal.dataobject; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.Data; +import lombok.experimental.Accessors; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import pc.exam.pp.framework.tenant.core.db.TenantBaseDO; + +/** + * 试卷对象 education_paper + * + * @author pengchen + * @date 2025-04-14 + */ +@TableName(value = "education_paper", autoResultMap = true) +@Data +@Accessors(chain = true) +@JsonInclude(JsonInclude.Include.NON_NULL) +public class EducationPaper extends TenantBaseDO +{ + private static final long serialVersionUID = 1L; + + /** 主键ID */ + private String paperId; + + /** 试卷任务ID */ + // @Excel(name = "试卷任务ID") + private String taskId; + + /** 使用次数 */ + // @Excel(name = "使用次数") + private String counts; + + /** 抽卷方式(0固定1AB2随机) */ + //@Excel(name = "抽卷方式(0固定1AB2随机)") + private String rollUp; + + /** 0A1B */ + //Excel(name = "0A1B") + private String isAb; + + /** 0启用1不启 */ + // @Excel(name = "0启用1不启") + private String status; + + +} + diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/EducationPaperParam.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/EducationPaperParam.java new file mode 100644 index 00000000..29d2e062 --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/EducationPaperParam.java @@ -0,0 +1,72 @@ +package pc.exam.pp.module.exam.dal.dataobject; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.Data; +import lombok.experimental.Accessors; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +/** + * 通用参数对象 education_paper_param + * + * @author pengchen + * @date 2025-04-16 + */ +@TableName(value = "education_paper_param", autoResultMap = true) +@Data +@Accessors(chain = true) +@JsonInclude(JsonInclude.Include.NON_NULL) +public class EducationPaperParam +{ + private static final long serialVersionUID = 1L; + + /** 主键ID */ + private String paramId; + + /** 试卷任务ID */ + // @Excel(name = "试卷任务ID") + private String taskId; + + /** 是否使用监考密码验证(0是1否) */ + // @Excel(name = "是否使用监考密码验证", readConverterExp = "0=是1否") + private String isExamPassword; + + /** 监考密码 */ + // @Excel(name = "监考密码") + private String examPassword; + + /** 禁止学生使用U盘(0是1否) */ + // @Excel(name = "禁止学生使用U盘", readConverterExp = "0=是1否") + private String usb; + + /** 练习成绩保存0最高成绩1最新成绩 */ + // @Excel(name = "练习成绩保存0最高成绩1最新成绩") + private String saveGrades; + + /** 驱动器为学生文件存放系统盘(C,D) */ + // @Excel(name = "驱动器为学生文件存放系统盘", readConverterExp = "C=,D") + private String driver; + + /** 考试目录名称 */ + //@Excel(name = "考试目录名称") + private String directory; + + /** 考试的模式下定时上传考试目录,每{x}分钟传一次 */ + // @Excel(name = "考试的模式下定时上传考试目录,每{x}分钟传一次") + private String uploadTime; + + /** 完成考试后是否删除考试目录(0是1否) */ + // @Excel(name = "完成考试后是否删除考试目录", readConverterExp = "0=是1否") + private String isDel; + + //是否显示重答按钮 + private String isRepeat; + //是否显示答案按钮 + private String isAnswer; + //学生是否可以查看试卷 + private String isLook; + + + private String isConnect; +} diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/EducationPaperPerson.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/EducationPaperPerson.java new file mode 100644 index 00000000..ff3e1235 --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/EducationPaperPerson.java @@ -0,0 +1,36 @@ +package pc.exam.pp.module.exam.dal.dataobject; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.Data; +import lombok.experimental.Accessors; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +/** + * 试卷人员分配对象 education_paper_person + * + * @author pengchen + * @date 2025-04-18 + */ +@TableName(value = "education_paper_person", autoResultMap = true) +@Data +@Accessors(chain = true) +@JsonInclude(JsonInclude.Include.NON_NULL) +public class EducationPaperPerson +{ + private static final long serialVersionUID = 1L; + + /** 试卷任务ID */ + // @Excel(name = "试卷任务ID") + private String taskId; + + /** 学生id */ + // @Excel(name = "学生id") + private String personId; + + /** 场次 */ + //@Excel(name = "场次") + private String sessionId; + +} diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/EducationPaperQu.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/EducationPaperQu.java new file mode 100644 index 00000000..4e83a5af --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/EducationPaperQu.java @@ -0,0 +1,37 @@ +package pc.exam.pp.module.exam.dal.dataobject; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.Data; +import lombok.experimental.Accessors; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +/** + * 试卷试题对象 education_paper_qu + * + * @author pengchen + * @date 2025-04-14 + */ +@TableName(value = "education_paper_qu", autoResultMap = true) +@Data +@Accessors(chain = true) +@JsonInclude(JsonInclude.Include.NON_NULL) +public class EducationPaperQu +{ + private static final long serialVersionUID = 1L; + + /** 试卷ID */ + // @Excel(name = "试卷ID") + private String paperId; + + /** 试题ID */ + // @Excel(name = "试题ID") + private String quId; + + /** 试题版本 */ + // @Excel(name = "试题版本") + private String quVersion; + + +} diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/EducationPaperScheme.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/EducationPaperScheme.java new file mode 100644 index 00000000..7ec2e349 --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/EducationPaperScheme.java @@ -0,0 +1,72 @@ +package pc.exam.pp.module.exam.dal.dataobject; + + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.Data; +import lombok.experimental.Accessors; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +import java.util.List; + +/** + * 试卷方案对象 education_paper_scheme + * + * @author pengchen + * @date 2025-04-14 + */ +@TableName(value = "education_paper_scheme", autoResultMap = true) +@Data +@Accessors(chain = true) +@JsonInclude(JsonInclude.Include.NON_NULL) +public class EducationPaperScheme +{ + private static final long serialVersionUID = 1L; + + /** 主键ID */ + private String schemeId; + + /** 方案ID */ + // @Excel(name = "方案ID") + private String taskId; + + /** 题型 */ + // @Excel(name = "题型") + private String spName; + + /** 难度 */ + // @Excel(name = "难度") + private String quLevel; + + /** 关键字 */ + // @Excel(name = "关键字") + private String keywords; + + /** 知识点 */ + // @Excel(name = "知识点") + private String pointNames; + + /** 试题数量 */ + // @Excel(name = "试题数量") + private Integer quNumbers; + + /** 每题分数 */ + // @Excel(name = "每题分数") + private String quScores; + + @TableField(exist = false) + private List keyword; + + @TableField(exist = false) + private List pointName; + + + /** 小计分数 */ + // @Excel(name = "小计分数") + private String subtotalScore; + + +} + diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/EducationPaperSession.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/EducationPaperSession.java new file mode 100644 index 00000000..13d1d284 --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/EducationPaperSession.java @@ -0,0 +1,67 @@ +package pc.exam.pp.module.exam.dal.dataobject; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.util.Date; + +/** + * 试卷场次对象 education_paper_session + * + * @author pengchen + * @date 2025-04-17 + */ +@TableName(value = "education_paper_session", autoResultMap = true) +@Data +@Accessors(chain = true) +@JsonInclude(JsonInclude.Include.NON_NULL) +public class EducationPaperSession +{ + private static final long serialVersionUID = 1L; + + /** 主键ID */ + private String sessionId; + + /** 试卷任务ID */ + // @Excel(name = "试卷任务ID") + private String taskId; + + /** 批次 */ + // @Excel(name = "批次") + private String batch; + + /** 考试开始时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + // @Excel(name = "考试开始时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date startTime; + + /** 考试结束时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + //@Excel(name = "考试结束时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date endTime; + + /** 开始考试前分钟,允许入场 */ + // @Excel(name = "开始考试前分钟,允许入场") + private String allowEntry; + + /** 开始考试后分钟,禁止入场 */ + // @Excel(name = "开始考试后分钟,禁止入场") + private String endAllowEntry; + + /** 开始考试后分钟,允许交卷 */ + // @Excel(name = "开始考试后分钟,允许交卷") + private String allowSubmission; + + /** 0启用1不启 */ + // @Excel(name = "0启用1不启") + private String status; + + /** 试卷id(1,2,3,4) */ + // @Excel(name = "试卷id(1,2,3,4)") + private String paperId; + + +} diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/EducationPaperTask.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/EducationPaperTask.java new file mode 100644 index 00000000..d04976c0 --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/EducationPaperTask.java @@ -0,0 +1,54 @@ +package pc.exam.pp.module.exam.dal.dataobject; + +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import pc.exam.pp.framework.tenant.core.db.TenantBaseDO; + +/** + * 试卷任务对象 education_paper_task + * + * @author pengchen + * @date 2025-04-14 + */ +@TableName(value = "education_paper_task", autoResultMap = true) +@Data +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = true) +public class EducationPaperTask extends TenantBaseDO +{ + private static final long serialVersionUID = 1L; + + /** 主键ID */ + @TableId + private String taskId; + + /** 任务名称 */ + //@Excel(name = "任务名称") + private String taskName; + + /** 专业 */ + //@Excel(name = "专业") + private String taskSpecialty; + + /** 试卷任务模式 */ + //@Excel(name = "试卷任务模式") + private String taskType; + + /** 是否为模板 */ + //@Excel(name = "是否为模板") + private String isTemplate; + + /** 是否启用(0:启用,1:停用) */ + //@Excel(name = "是否启用", readConverterExp = "0=:启用,1:停用") + private String status; + + + + + +} diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/ExamKnowledgePoints.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/ExamKnowledgePoints.java new file mode 100644 index 00000000..47709c51 --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/ExamKnowledgePoints.java @@ -0,0 +1,132 @@ +package pc.exam.pp.module.exam.dal.dataobject; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import pc.exam.pp.module.exam.controller.admin.paper.vo.TreeEntity; + +/** + * 客户端对象 exam_specialty + * + * @author pengchen + * @date 2025-03-24 + */ +public class ExamKnowledgePoints extends TreeEntity +{ + private static final long serialVersionUID = 1L; + + /** id */ + private Long spId; + + /** 名称 */ + private String spName; + + /** 状态(0正常 1停用) */ + private String status; + + /** 删除标志(0代表存在 2代表删除) */ + private String delFlag; + + /** 客户端id */ + private String deptId; + + /** 用户id */ + private String userId; + + private String unite; + + /** 子树数量 */ + private Long treeNum; + + public void setSpId(Long spId) + { + this.spId = spId; + } + + public Long getSpId() + { + return spId; + } + + public void setSpName(String spName) + { + this.spName = spName; + } + + public String getSpName() + { + return spName; + } + + public void setStatus(String status) + { + this.status = status; + } + + public String getStatus() + { + return status; + } + + public void setDelFlag(String delFlag) + { + this.delFlag = delFlag; + } + + public String getUnite() { + return unite; + } + + public void setUnite(String unite) { + this.unite = unite; + } + + public String getDelFlag() + { + return delFlag; + } + + public void setDeptId(String deptId) + { + this.deptId = deptId; + } + + public String getDeptId() + { + return deptId; + } + + public void setUserId(String userId) + { + this.userId = userId; + } + + public String getUserId() + { + return userId; + } + + public Long getTreeNum() { + return treeNum; + } + + public void setTreeNum(Long treeNum) { + this.treeNum = treeNum; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("spId", getSpId()) + .append("parentId", getParentId()) + .append("ancestors", getAncestors()) + .append("spName", getSpName()) + .append("orderNum", getOrderNum()) + .append("status", getStatus()) + .append("delFlag", getDelFlag()) + .append("deptId", getDeptId()) + .append("userId", getUserId()) + .append("unite", getUnite()) + .append("treeNum", getTreeNum()) + .toString(); + } +} diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/ExamQuestion.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/ExamQuestion.java new file mode 100644 index 00000000..7ffee621 --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/ExamQuestion.java @@ -0,0 +1,118 @@ +package pc.exam.pp.module.exam.dal.dataobject; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; +import pc.exam.pp.framework.mybatis.core.dataobject.BaseDO; +import pc.exam.pp.framework.tenant.core.db.TenantBaseDO; + +import java.util.List; + +/** + * 试题(hyc)对象 exam_question + * + * @author pengchen + * @date 2025-03-13 + */ + +@TableName(value = "exam_question", autoResultMap = true) +@Data +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = true) +public class ExamQuestion extends TenantBaseDO { + + + /** 试题id */ + @TableId + private String quId; + + /** 题库id */ +// @Excel(name = "题库id") + private String quBankId; + + /** 题库名称 */ +// @Excel(name = "题库名称") + private String quBankName; + + /** 章节名称 */ +// @Excel(name = "章节名称") + private String chapteridDictText; + + /** 题型名称 */ +// @Excel(name = "题型名称") + private String subjectName; + + /** 题型难度(0:简单,1:一般,2:困难) */ + // @Excel(name = "题型难度(0:简单,1:一般,2:困难)") + private String quLevel; + + /** 试题内容(带样式:

下列表格123

\n\n\n\n\) */ + // @Excel(name = "试题内容") + private String content; + + /** 试题内容(纯文本) */ + // @Excel(name = "试题内容(纯文本)") + private String contentText; + + /** 解析(带样式) */ + // @Excel(name = "解析(带样式)") + private String analysis; + + /** 知识点 */ + // @Excel(name = "知识点") + private String pointNames; + + /** 关键字 */ + // @Excel(name = "关键字") + private String keywords; + + /** 是否人工(0否1是,简答题专用) */ + // @Excel(name = "是否人工,0=否1是,简答题专用") + private String manual; + + + /** 状态(0启用,1禁用) */ + // @Excel(name = "状态(0启用,1禁用)") + private String status; + + /** 审核 */ + // @Excel(name = "审核") + private String audit; + + /** 课程类别 */ + // @Excel(name = "课程类别") + private String courseName; + + /** 专业分类 */ + // @Excel(name = "专业分类") + private String specialtyName; + + /** 试题答案 */ + // @Excel(name = "试题答案") + @TableField(exist = false) + private List answerList; + + /** 试题文件 */ + // @Excel(name = "试题文件") + @TableField(exist = false) + private List fileUploads; + + /** 试题判分 */ + // @Excel(name = "试题判分") + @TableField(exist = false) + private ExamQuestionScore questionScores; + + /** 试题关键字 */ + // @Excel(name = "试题关键字") + @TableField(exist = false) + private List questionKeywords; + + + + + + +} diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/ExamQuestionAnswer.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/ExamQuestionAnswer.java new file mode 100644 index 00000000..5653c53c --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/ExamQuestionAnswer.java @@ -0,0 +1,60 @@ +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; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import pc.exam.pp.framework.mybatis.core.dataobject.BaseDO; + +/** + * 试题答案选项(hyc)对象 exam_question_answer + * + * @author pengchen + * @date 2025-03-18 + */ +@TableName(value = "exam_question_answer", autoResultMap = true) +@Data +@Accessors(chain = true) +@JsonInclude(JsonInclude.Include.NON_NULL) +public class ExamQuestionAnswer +{ + private static final long serialVersionUID = 1L; + + /** 答案ID */ + @TableId + private String answerId; + + /** 问题ID */ +// @Excel(name = "问题ID") + private String quId; + + /** 是否正确(0是1否) */ +// @Excel(name = "是否正确(0是1否)") + private String isRight; + + /** 选项图片 */ +// @Excel(name = "选项图片") + private String image; + + /** 答案内容(输出) */ +// @Excel(name = "答案内容(输出)") + private String content; + + /** 答案内容(输入) */ +// @Excel(name = "答案内容(输入)") + private String contentIn; + + /** 权值 */ + // @Excel(name = "权值") + private String scoreRate; + + /** 排序 */ +// @Excel(name = "排序") + private String sort; + + +} diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/ExamQuestionKeyword.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/ExamQuestionKeyword.java new file mode 100644 index 00000000..64661e1f --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/ExamQuestionKeyword.java @@ -0,0 +1,42 @@ +package pc.exam.pp.module.exam.dal.dataobject; + + +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; +import pc.exam.pp.framework.mybatis.core.dataobject.BaseDO; + +/** + * 试题答案关键字对象 exam_question_keyword + * + * @author pengchen + * @date 2025-03-21 + */ + +@TableName(value = "exam_question_keyword", autoResultMap = true) +@Data +@Accessors(chain = true) +public class ExamQuestionKeyword +{ + private static final long serialVersionUID = 1L; + + /** 答案ID */ + @TableId + private String keywordId; + + /** 问题ID */ +// @Excel(name = "问题ID") + private String quId; + + /** 关键字 */ + // @Excel(name = "关键字") + private String keyword; + + /** 权值 */ + // @Excel(name = "权值") + private String scoreRate; + + +} diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/ExamQuestionScore.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/ExamQuestionScore.java new file mode 100644 index 00000000..1b2d6d59 --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/ExamQuestionScore.java @@ -0,0 +1,75 @@ +package pc.exam.pp.module.exam.dal.dataobject; + + +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; +import pc.exam.pp.framework.mybatis.core.dataobject.BaseDO; + +/** + * 试题判分标准对象 exam_question_score + * + * @author pengchen + * @date 2025-03-19 + */ + +@TableName(value = "exam_question_score", autoResultMap = true) +@Data +@Accessors(chain = true) +public class ExamQuestionScore +{ + private static final long serialVersionUID = 1L; + + /** id */ + @TableId + private String scoreId; + + /** 问题ID */ +// @Excel(name = "问题ID") + private String quId; + + /** 检查程序编译(0:是,1否) */ + // @Excel(name = "检查程序编译(0:是,1否)") + private String isPass; + + /** 检查程序结果(0:是,1否) */ +// @Excel(name = "检查程序结果(0:是,1否)") + private String isResult; + + /** 检查关键字(0:是,1否) */ + // @Excel(name = "检查关键字(0:是,1否)") + private String isKeyword; + + /** 使用测试用例(0:是,1否) */ +// @Excel(name = "使用测试用例(0:是,1否)") + private String isCompile; + + + /** 检查程序编译百分比 */ +// @Excel(name = "检查程序编译百分比") + private String isPassScore; + + /** 检查程序结果百分比 */ +// @Excel(name = "检查程序结果百分比") + private String isResultScore; + + /** 检查关键字百分比 */ + // @Excel(name = "检查关键字百分比") + private String isKeywordScore; + + /** 使用测试用例百分比 */ +// @Excel(name = "使用测试用例百分比") + private String isCompileScore; + + /** 关键字得分临界值 */ + // @Excel(name = "关键字得分临界值") + private String keywordCutoff; + + /** 测试用例得分临界值(<=测试用例个数) */ +// @Excel(name = "测试用例得分临界值(<=测试用例个数)") + private String compileCutoff; + + +} diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/PaperListResponseVo.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/PaperListResponseVo.java new file mode 100644 index 00000000..d1f517dd --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/PaperListResponseVo.java @@ -0,0 +1,42 @@ +package pc.exam.pp.module.exam.dal.dataobject; + +import java.util.List; +import java.util.Set; + +public class PaperListResponseVo { + private List paperId; // 试卷列表 + private Set selectedIds; // 已选试卷 ID 列表 + + public PaperListResponseVo() { + } + + public PaperListResponseVo(List paperId, Set selectedIds) { + this.paperId = paperId; + this.selectedIds = selectedIds; + } + + public List getPaperId() { + return paperId; + } + + public void setPaperId(List paperId) { + this.paperId = paperId; + } + + public Set getSelectedIds() { + return selectedIds; + } + + public void setSelectedIds(Set selectedIds) { + this.selectedIds = selectedIds; + } + + + @Override + public String toString() { + return "PaperListResponseVo{" + + "paperId=" + paperId + + ", selectedIds=" + selectedIds + + '}'; + } +} diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/SysFileUpload.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/SysFileUpload.java new file mode 100644 index 00000000..3af9c4d6 --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/SysFileUpload.java @@ -0,0 +1,53 @@ +package pc.exam.pp.module.exam.dal.dataobject; + + +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; +import pc.exam.pp.framework.mybatis.core.dataobject.BaseDO; + +/** + * 文件(hyc)对象 sys_file + * + * @author pengchen + * @date 2025-03-18 + */ +@TableName(value = "sys_file", autoResultMap = true) +@Data +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = true) +public class SysFileUpload extends BaseDO { + private static final long serialVersionUID = 1L; + + /** + * 文件id + */ + @TableId + private String fileId; + + /** + * 试题id + */ +// @Excel(name = "试题id") + private String quId; + + + + /** + * 文件名(完整) + */ +// @Excel(name = "文件名(完整)") + private String url; + + + /** + * 文件类型(0:素材,1:原始,2:结果) + */ +// @Excel(name = "文件类型(0:素材,1:原始,2:结果)") + private String fileType; + + + +} diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/mysql/paper/EducationPaperMapper.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/mysql/paper/EducationPaperMapper.java new file mode 100644 index 00000000..8a461649 --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/mysql/paper/EducationPaperMapper.java @@ -0,0 +1,121 @@ +package pc.exam.pp.module.exam.dal.mysql.paper; + + +import java.util.List; + +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.LambdaQueryWrapperX; +import pc.exam.pp.module.exam.controller.admin.paper.vo.PaperPageVo; +import pc.exam.pp.module.exam.controller.admin.paper.vo.PaperTaskPageVo; +import pc.exam.pp.module.exam.dal.dataobject.EducationPaper; +import pc.exam.pp.module.exam.dal.dataobject.EducationPaperScheme; +import pc.exam.pp.module.exam.dal.dataobject.EducationPaperTask; + +/** + * 试卷Mapper接口 + * + * @author pengchen + * @date 2025-04-15 + */ +@Mapper +public interface EducationPaperMapper extends BaseMapperX +{ + /** + * 查询试卷 + * + * @param paperId 试卷主键 + * @return 试卷 + */ + public EducationPaper selectEducationPaperByPaperId(String paperId); + + /** + * 查询试卷列表 + * + + * @return 试卷集合 + */ +// public List selectEducationPaperList(EducationPaper educationPaper); + + default PageResult selectEducationPaperList(PaperPageVo paperPageVo) { + return selectPage(paperPageVo, new LambdaQueryWrapperX() + .likeIfPresent(EducationPaper::getTaskId, paperPageVo.getTaskId()) + .likeIfPresent(EducationPaper::getIsAb , paperPageVo.getIsAb()) + .likeIfPresent(EducationPaper::getPaperId , paperPageVo.getPaperId()) + .likeIfPresent(EducationPaper::getCounts , paperPageVo.getCounts()) + .likeIfPresent(EducationPaper::getRollUp , paperPageVo.getRollUp()) + .likeIfPresent(EducationPaper::getStatus , paperPageVo.getStatus()) + ); + } + + /** + * 新增试卷 + * + * @param educationPaper 试卷 + * @return 结果 + */ + public int insertEducationPaper(EducationPaper educationPaper); + + /** + * 修改试卷 + * + * @param educationPaper 试卷 + * @return 结果 + */ + public int updateEducationPaper(EducationPaper educationPaper); + + /** + * 删除试卷 + * + * @param paperId 试卷主键 + * @return 结果 + */ + public int deleteEducationPaperByPaperId(String paperId); + + /** + * 批量删除试卷 + * + * @param paperIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteEducationPaperByPaperIds(@Param("paperIds") String[] paperIds); + + + + List selectQuByPaperScheme(@Param("pointName") List pointName + ,@Param("keywordList") List keywordList + ,@Param("educationPaperScheme") EducationPaperScheme educationPaperScheme + ,@Param("taskSpecialty") String taskSpecialty + ,@Param("tId") Long tId ); + + String selectTaskIdByPaperId(String paperId); + + List selectPaperByTaskId(String taskId); + + public int updateEducationByids(@Param("strings")List strings); + + List selectPaperRandomByTaskId(String taskId); + + int updateRandomByids(@Param("strings")List strings); + + void updatePaperGuByRollup(String taskId); + + + List selectPaperByTaskIdAndRoll(@Param("taskId")String taskId); + + List getPaperByTaskIdByType(String taskId); + + String getSelectPaperIdBySchemeIds(String row); + + int updateEducationByidsThree(@Param("strings")List strings); + + List selectPaperListByTaskId(String taskId); + + void insertEducationPaperList(List educationPapers); + + int changeStatus(@Param("paperId") String paperId + ,@Param("status") String status); +} + diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/mysql/paper/EducationPaperParamMapper.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/mysql/paper/EducationPaperParamMapper.java new file mode 100644 index 00000000..361b9e7c --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/mysql/paper/EducationPaperParamMapper.java @@ -0,0 +1,70 @@ +package pc.exam.pp.module.exam.dal.mysql.paper; + + + + +import org.apache.ibatis.annotations.Mapper; +import pc.exam.pp.module.exam.dal.dataobject.EducationPaperParam; + +import java.util.List; + +/** + * 通用参数Mapper接口 + * + * @author pengchen + * @date 2025-04-16 + */ +@Mapper +public interface EducationPaperParamMapper +{ + /** + * 查询通用参数 + * + * @param paramId 通用参数主键 + * @return 通用参数 + */ + public EducationPaperParam selectEducationPaperParamByParamId(String paramId); + + /** + * 查询通用参数列表 + * + * @param educationPaperParam 通用参数 + * @return 通用参数集合 + */ + public List selectEducationPaperParamList(EducationPaperParam educationPaperParam); + + /** + * 新增通用参数 + * + * @param educationPaperParam 通用参数 + * @return 结果 + */ + public int insertEducationPaperParam(EducationPaperParam educationPaperParam); + + /** + * 修改通用参数 + * + * @param educationPaperParam 通用参数 + * @return 结果 + */ + public int updateEducationPaperParam(EducationPaperParam educationPaperParam); + + /** + * 删除通用参数 + * + * @param paramId 通用参数主键 + * @return 结果 + */ + public int deleteEducationPaperParamByParamId(String paramId); + + /** + * 批量删除通用参数 + * + * @param paramIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteEducationPaperParamByParamIds(String[] paramIds); + + EducationPaperParam selectEducationPaperParamByTaskId(String taskId); + +} diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/mysql/paper/EducationPaperPersonMapper.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/mysql/paper/EducationPaperPersonMapper.java new file mode 100644 index 00000000..af32cb4a --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/mysql/paper/EducationPaperPersonMapper.java @@ -0,0 +1,66 @@ +package pc.exam.pp.module.exam.dal.mysql.paper; + + +import org.apache.ibatis.annotations.Mapper; +import pc.exam.pp.module.exam.dal.dataobject.EducationPaperPerson; + +import java.util.List; + + +/** + * 试卷人员分配Mapper接口 + * + * @author pengchen + * @date 2025-04-18 + */ +@Mapper +public interface EducationPaperPersonMapper +{ + /** + * 查询试卷人员分配 + * + * @param taskId 试卷人员分配主键 + * @return 试卷人员分配 + */ + public EducationPaperPerson selectEducationPaperPersonByTaskId(String taskId); + + /** + * 查询试卷人员分配列表 + * + * @param educationPaperPerson 试卷人员分配 + * @return 试卷人员分配集合 + */ + public List selectEducationPaperPersonList(EducationPaperPerson educationPaperPerson); + + /** + * 新增试卷人员分配 + * + * @param educationPaperPerson 试卷人员分配 + * @return 结果 + */ + public int insertEducationPaperPerson(EducationPaperPerson educationPaperPerson); + + /** + * 修改试卷人员分配 + * + * @param educationPaperPerson 试卷人员分配 + * @return 结果 + */ + public int updateEducationPaperPerson(EducationPaperPerson educationPaperPerson); + + /** + * 删除试卷人员分配 + * + * @param taskId 试卷人员分配主键 + * @return 结果 + */ + public int deleteEducationPaperPersonByTaskId(String taskId); + + /** + * 批量删除试卷人员分配 + * + * @param taskIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteEducationPaperPersonByTaskIds(String[] taskIds); +} diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/mysql/paper/EducationPaperQuMapper.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/mysql/paper/EducationPaperQuMapper.java new file mode 100644 index 00000000..bec0e3e3 --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/mysql/paper/EducationPaperQuMapper.java @@ -0,0 +1,75 @@ +package pc.exam.pp.module.exam.dal.mysql.paper; + +import org.apache.ibatis.annotations.Mapper; +import pc.exam.pp.module.exam.dal.dataobject.EducationPaperQu; + +import java.util.List; + + +/** + * 试卷试题Mapper接口 + * + * @author pengchen + * @date 2025-04-15 + */ +@Mapper +public interface EducationPaperQuMapper +{ + /** + * 查询试卷试题 + * + * @param paperId 试卷试题主键 + * @return 试卷试题 + */ + public EducationPaperQu selectEducationPaperQuByPaperId(String paperId); + + /** + * 查询试卷试题列表 + * + * @param educationPaperQu 试卷试题 + * @return 试卷试题集合 + */ + public List selectEducationPaperQuList(EducationPaperQu educationPaperQu); + + /** + * 新增试卷试题 + * + * @param educationPaperQu 试卷试题 + * @return 结果 + */ + public int insertEducationPaperQu(EducationPaperQu educationPaperQu); + + /** + * 修改试卷试题 + * + * @param educationPaperQu 试卷试题 + * @return 结果 + */ + public int updateEducationPaperQu(EducationPaperQu educationPaperQu); + + /** + * 删除试卷试题 + * + * @param paperId 试卷试题主键 + * @return 结果 + */ + public int deleteEducationPaperQuByPaperId(String paperId); + + /** + * 批量删除试卷试题 + * + * @param paperIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteEducationPaperQuByPaperIds(String[] paperIds); + + void insertEducationPaperQuList(List educationPaperQus); + + + List selectPaperQuByPaperId(String paperId); + + + List selectPaperQuListByPaperId(String paperId); + +} + diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/mysql/paper/EducationPaperSchemeMapper.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/mysql/paper/EducationPaperSchemeMapper.java new file mode 100644 index 00000000..5bec2d92 --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/mysql/paper/EducationPaperSchemeMapper.java @@ -0,0 +1,71 @@ +package pc.exam.pp.module.exam.dal.mysql.paper; + + +import org.apache.ibatis.annotations.Mapper; +import pc.exam.pp.module.exam.dal.dataobject.EducationPaperScheme; + +import java.util.List; + + +/** + * 试卷方案Mapper接口 + * + * @author pengchen + * @date 2025-04-15 + */ +@Mapper +public interface EducationPaperSchemeMapper +{ + /** + * 查询试卷方案 + * + * @param schemeId 试卷方案主键 + * @return 试卷方案 + */ + public EducationPaperScheme selectEducationPaperSchemeBySchemeId(String schemeId); + + /** + * 查询试卷方案列表 + * + * @param educationPaperScheme 试卷方案 + * @return 试卷方案集合 + */ + public List selectEducationPaperSchemeList(EducationPaperScheme educationPaperScheme); + + /** + * 新增试卷方案 + * + * @param educationPaperScheme 试卷方案 + * @return 结果 + */ + public int insertEducationPaperScheme(EducationPaperScheme educationPaperScheme); + + /** + * 修改试卷方案 + * + * @param educationPaperScheme 试卷方案 + * @return 结果 + */ + public int updateEducationPaperScheme(EducationPaperScheme educationPaperScheme); + + /** + * 删除试卷方案 + * + * @param schemeId 试卷方案主键 + * @return 结果 + */ + public int deleteEducationPaperSchemeBySchemeId(String schemeId); + + /** + * 批量删除试卷方案 + * + * @param schemeIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteEducationPaperSchemeBySchemeIds(String[] schemeIds); + + List selectEducationPaperTaskByTaskId(String taskid); + + void insertEducationPaperSchemeList(List educationPaperSchemeList); + +} diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/mysql/paper/EducationPaperSessionMapper.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/mysql/paper/EducationPaperSessionMapper.java new file mode 100644 index 00000000..8a3b9e88 --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/mysql/paper/EducationPaperSessionMapper.java @@ -0,0 +1,73 @@ +package pc.exam.pp.module.exam.dal.mysql.paper; + +import java.util.List; + +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +import pc.exam.pp.module.exam.dal.dataobject.EducationPaperSession; + +/** + * 试卷场次Mapper接口 + * + * @author pengchen + * @date 2025-04-17 + */ +@Mapper +public interface EducationPaperSessionMapper +{ + /** + * 查询试卷场次 + * + * @param sessionId 试卷场次主键 + * @return 试卷场次 + */ + public EducationPaperSession selectEducationPaperSessionBySessionId(String sessionId); + + /** + * 查询试卷场次列表 + * + * @param educationPaperSession 试卷场次 + * @return 试卷场次集合 + */ + public List selectEducationPaperSessionList(EducationPaperSession educationPaperSession); + + /** + * 新增试卷场次 + * + * @param educationPaperSession 试卷场次 + * @return 结果 + */ + public int insertEducationPaperSession(EducationPaperSession educationPaperSession); + + /** + * 修改试卷场次 + * + * @param educationPaperSession 试卷场次 + * @return 结果 + */ + public int updateEducationPaperSession(EducationPaperSession educationPaperSession); + + /** + * 删除试卷场次 + * + * @param sessionId 试卷场次主键 + * @return 结果 + */ + public int deleteEducationPaperSessionBySessionId(String sessionId); + + /** + * 批量删除试卷场次 + * + * @param sessionIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteEducationPaperSessionBySessionIds(String[] sessionIds); + + public List selectEducationPaperSessionByTaskId(String taskId); + + void insertEducationPaperSessionList(List educationPaperSessions); + + + int changeStatus(@Param("sessionId") String sessionId + ,@Param("status") String status); +} diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/mysql/paper/EducationPaperTaskMapper.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/mysql/paper/EducationPaperTaskMapper.java new file mode 100644 index 00000000..8a5b9eac --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/mysql/paper/EducationPaperTaskMapper.java @@ -0,0 +1,108 @@ +package pc.exam.pp.module.exam.dal.mysql.paper; + + +import java.util.List; + +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.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.EducationPaperTask; + +/** + * 试卷任务Mapper接口 + * + * @author pengchen + * @date 2025-04-14 + */ +@Mapper +public interface EducationPaperTaskMapper extends BaseMapperX +{ + /** + * 查询试卷任务 + * + * @param taskId 试卷任务主键 + * @return 试卷任务 + */ + public EducationPaperTask selectEducationPaperTaskByTaskId(String taskId); + + /** + * 查询试卷任务列表 + * + * + * @return 试卷任务集合 + */ +// public List selectEducationPaperTaskList(@Param("educationPaperTask") PaperTaskPageVo educationPaperTask); + default PageResult selectEducationPaperTaskList(PaperTaskPageVo pageReqVO) { + return selectPage(pageReqVO, new LambdaQueryWrapperX() + .likeIfPresent(EducationPaperTask::getTaskType, pageReqVO.getTaskType()) + .likeIfPresent(EducationPaperTask::getTaskName , pageReqVO.getTaskName()) + .likeIfPresent(EducationPaperTask::getStatus , pageReqVO.getStatus()) + .likeIfPresent(EducationPaperTask::getTaskSpecialty , pageReqVO.getTaskSpecialty()) + .likeIfPresent(EducationPaperTask::getIsTemplate , pageReqVO.getIsTemplate()) + .betweenIfPresent(EducationPaperTask::getCreateTime, pageReqVO.getCreateTime()) + ); + } + + + /** + * 新增试卷任务 + * + * @param educationPaperTask 试卷任务 + * @return 结果 + */ + public int insertEducationPaperTask(EducationPaperTask educationPaperTask); + + /** + * 修改试卷任务 + * + * @param educationPaperTask 试卷任务 + * @return 结果 + */ + public int updateEducationPaperTask(EducationPaperTask educationPaperTask); + + /** + * 删除试卷任务 + * + * @param taskId 试卷任务主键 + * @return 结果 + */ + public int deleteEducationPaperTaskByTaskId(String taskId); + + /** + * 批量删除试卷任务 + * + * @param taskIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteEducationPaperTaskByTaskIds(@Param("taskIds") String[] taskIds); + + List getSpecialityList(); + + List getCourseList(); + + List getKeywords(); + + + List getPoints(@Param("id") Long id); + + Integer getQuCount(@Param("taskSpecialty") String taskSpecialty + ,@Param("spName") String spName + ,@Param("quLevel")String quLevel + ,@Param("pointName") List pointName + ,@Param("keyword") List keyword + ,@Param("tId") Long tId); + + List selectPointByid(List list); + + + Long getPointIdByName(String name); + + + boolean changeStatus(@Param("taskId")String taskId,@Param("status") String status); + +} diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/mysql/question/ExamQuestionAnswerMapper.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/mysql/question/ExamQuestionAnswerMapper.java new file mode 100644 index 00000000..10005443 --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/mysql/question/ExamQuestionAnswerMapper.java @@ -0,0 +1,74 @@ +package pc.exam.pp.module.exam.dal.mysql.question; + +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +import pc.exam.pp.framework.mybatis.core.mapper.BaseMapperX; +import pc.exam.pp.module.exam.dal.dataobject.ExamQuestionAnswer; + +import java.util.List; + +/** + * 试题答案选项(hyc)Mapper接口 + * + * @author pengchen + * @date 2025-03-13 + */ +@Mapper +public interface ExamQuestionAnswerMapper extends BaseMapperX +{ + /** + * 查询试题答案选项(hyc) + * + * @param answerId 试题答案选项(hyc)主键 + * @return 试题答案选项(hyc) + */ + public ExamQuestionAnswer selectExamQuestionAnswerByAnswerId(Long answerId); + + /** + * 查询试题答案选项(hyc)列表 + * + * @param examQuestionAnswer 试题答案选项(hyc) + * @return 试题答案选项(hyc)集合 + */ + public List selectExamQuestionAnswerList(ExamQuestionAnswer examQuestionAnswer); + + /** + * 新增试题答案选项(hyc) + * + * @param examQuestionAnswer 试题答案选项(hyc) + * @return 结果 + */ + public int insertExamQuestionAnswer(ExamQuestionAnswer examQuestionAnswer); + + /** + * 修改试题答案选项(hyc) + * + * @param examQuestionAnswer 试题答案选项(hyc) + * @return 结果 + */ + public int updateExamQuestionAnswer(ExamQuestionAnswer examQuestionAnswer); + + /** + * 删除试题答案选项(hyc) + * + * @param answerId 试题答案选项(hyc)主键 + * @return 结果 + */ + public int deleteExamQuestionAnswerByAnswerId(Long answerId); + + /** + * 批量删除试题答案选项(hyc) + * + * @param answerIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteExamQuestionAnswerByAnswerIds(Long[] answerIds); + + public int insertExamQuestionAnswerList(List answerList); + + List selectExamQuestionAnswerByQuId(String quId); + + public int deleteExamQuestionAnswerByQuesId(String firstQuId); + + public int deleteExamQuestionAnswerByQuesIds(@Param("ids") String[] ids); +} diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/mysql/question/ExamQuestionKeywordMapper.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/mysql/question/ExamQuestionKeywordMapper.java new file mode 100644 index 00000000..997e374d --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/mysql/question/ExamQuestionKeywordMapper.java @@ -0,0 +1,73 @@ +package pc.exam.pp.module.exam.dal.mysql.question; + +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +import pc.exam.pp.module.exam.dal.dataobject.ExamQuestionKeyword; + +import java.util.List; + +/** + * 试题答案关键字Mapper接口 + * + * @author pengchen + * @date 2025-03-21 + */ +@Mapper +public interface ExamQuestionKeywordMapper +{ + /** + * 查询试题答案关键字 + * + * @param keywordId 试题答案关键字主键 + * @return 试题答案关键字 + */ + public ExamQuestionKeyword selectExamQuestionKeywordByKeywordId(String keywordId); + + /** + * 查询试题答案关键字列表 + * + * @param examQuestionKeyword 试题答案关键字 + * @return 试题答案关键字集合 + */ + public List selectExamQuestionKeywordList(ExamQuestionKeyword examQuestionKeyword); + + /** + * 新增试题答案关键字 + * + * @param examQuestionKeyword 试题答案关键字 + * @return 结果 + */ + public int insertExamQuestionKeyword(ExamQuestionKeyword examQuestionKeyword); + + /** + * 修改试题答案关键字 + * + * @param examQuestionKeyword 试题答案关键字 + * @return 结果 + */ + public int updateExamQuestionKeyword(ExamQuestionKeyword examQuestionKeyword); + + /** + * 删除试题答案关键字 + * + * @param keywordId 试题答案关键字主键 + * @return 结果 + */ + public int deleteExamQuestionKeywordByKeywordId(String keywordId); + + /** + * 批量删除试题答案关键字 + * + * @param keywordIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteExamQuestionKeywordByKeywordIds(String[] keywordIds); + + List selectExamQuestionKeywordByQuId(String quId); + + void insertExamQuestionKeywordList(List examQuestionKeywords); + + void deleteExamQuestionScoreByQuesId(String firstQuId); + + void deleteExamQuestionScoreByQuesIds(@Param("ids")String[] ids); +} diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/mysql/question/ExamQuestionMapper.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/mysql/question/ExamQuestionMapper.java new file mode 100644 index 00000000..c71c7441 --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/mysql/question/ExamQuestionMapper.java @@ -0,0 +1,84 @@ +package pc.exam.pp.module.exam.dal.mysql.question; + +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.LambdaQueryWrapperX; +import pc.exam.pp.module.exam.controller.admin.paper.vo.PaperTaskPageVo; +import pc.exam.pp.module.exam.controller.admin.question.dto.ExamQuestionDto; +import pc.exam.pp.module.exam.controller.admin.question.vo.QuestionVo; +import pc.exam.pp.module.exam.dal.dataobject.EducationPaperTask; +import pc.exam.pp.module.exam.dal.dataobject.ExamQuestion; + +import java.util.List; + +/** + * 试题(hyc)Mapper接口 + * + * @author pengchen + * @date 2025-03-13 + */ +@Mapper +public interface ExamQuestionMapper extends BaseMapperX +{ + /** + * 查询试题(hyc) + * + * @param quId 试题(hyc)主键 + * @return 试题(hyc) + */ + public ExamQuestion selectExamQuestionByQuId(String quId); + + /** + * 查询试题(hyc)列表 + * + * @return 试题(hyc)集合 + */ + default PageResult selectExamQuestionList(QuestionVo questionVo) { + return selectPage(questionVo, new LambdaQueryWrapperX() + .likeIfPresent(ExamQuestion::getQuLevel, questionVo.getQuLevel()) + .likeIfPresent(ExamQuestion::getCourseName , questionVo.getCourseName()) + .likeIfPresent(ExamQuestion::getPointNames , questionVo.getPointNames()) + .likeIfPresent(ExamQuestion::getSpecialtyName , questionVo.getSpecialtyName()) + .likeIfPresent(ExamQuestion::getSubjectName , questionVo.getSubjectName()) + .likeIfPresent(ExamQuestion::getStatus, questionVo.getStatus()) + .likeIfPresent(ExamQuestion::getAudit, questionVo.getAudit()) + ); + } + + + /** + * 新增试题(hyc) + * + * @param examQuestion 试题(hyc) + * @return 结果 + */ + public int insertExamQuestion(ExamQuestion examQuestion); + + /** + * 修改试题(hyc) + * + * @param examQuestion 试题(hyc) + * @return 结果 + */ + public int updateExamQuestion(ExamQuestion examQuestion); + + /** + * 删除试题(hyc) + * + * @param quId 试题(hyc)主键 + * @return 结果 + */ + public int deleteExamQuestionByQuId(String quId); + + /** + * 批量删除试题(hyc) + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteExamQuestionByQuIds(@Param("ids") String[] ids); + + List selectExamQuestionListByQuIds(List quIds); +} diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/mysql/question/ExamQuestionScoreMapper.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/mysql/question/ExamQuestionScoreMapper.java new file mode 100644 index 00000000..0c66b92e --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/mysql/question/ExamQuestionScoreMapper.java @@ -0,0 +1,73 @@ +package pc.exam.pp.module.exam.dal.mysql.question; + +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +import pc.exam.pp.module.exam.dal.dataobject.ExamQuestionScore; + +import java.util.List; + +/** + * 试题判分标准Mapper接口 + * + * @author pengchen + * @date 2025-03-19 + */ +@Mapper +public interface ExamQuestionScoreMapper +{ + /** + * 查询试题判分标准 + * + * @param scoreId 试题判分标准主键 + * @return 试题判分标准 + */ + public ExamQuestionScore selectExamQuestionScoreByScoreId(String scoreId); + + /** + * 查询试题判分标准列表 + * + * @param examQuestionScore 试题判分标准 + * @return 试题判分标准集合 + */ + public List selectExamQuestionScoreList(ExamQuestionScore examQuestionScore); + + /** + * 新增试题判分标准 + * + * @param examQuestionScore 试题判分标准 + * @return 结果 + */ + public int insertExamQuestionScore(ExamQuestionScore examQuestionScore); + + /** + * 修改试题判分标准 + * + * @param examQuestionScore 试题判分标准 + * @return 结果 + */ + public int updateExamQuestionScore(ExamQuestionScore examQuestionScore); + + /** + * 删除试题判分标准 + * + * @param scoreId 试题判分标准主键 + * @return 结果 + */ + public int deleteExamQuestionScoreByScoreId(String scoreId); + + /** + * 批量删除试题判分标准 + * + * @param scoreIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteExamQuestionScoreByScoreIds(String[] scoreIds); + + public int insertExamQuestionScoreList(List questionScores); + + void deleteExamQuestionScoreByQuesId(String firstQuId); + + void deleteExamQuestionScoreByQuesIds(@Param("firstQuIds") String[] firstQuIds); + + ExamQuestionScore selectExamQuestionScoreByQuId(String quId); +} diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/mysql/question/SysFileMapper.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/mysql/question/SysFileMapper.java new file mode 100644 index 00000000..7e04b15e --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/mysql/question/SysFileMapper.java @@ -0,0 +1,72 @@ +package pc.exam.pp.module.exam.dal.mysql.question; + +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +import pc.exam.pp.module.exam.dal.dataobject.SysFileUpload; + +import java.util.List; + +/** + * 文件(hyc)Mapper接口 + * + * @author pengchen + * @date 2025-03-18 + */ +@Mapper +public interface SysFileMapper +{ + /** + * 查询文件(hyc) + * + * @param fileId 文件(hyc)主键 + * @return 文件(hyc) + */ + public SysFileUpload selectSysFileByFileId(String fileId); + + /** + * 查询文件(hyc)列表 + * + * @param sysFileUpload 文件(hyc) + * @return 文件(hyc)集合 + */ + public List selectSysFileList(SysFileUpload sysFileUpload); + + /** + * 新增文件(hyc) + * + * @param sysFileUpload 文件(hyc) + * @return 结果 + */ + public int insertSysFile(SysFileUpload sysFileUpload); + + /** + * 修改文件(hyc) + * + * @param sysFileUpload 文件(hyc) + * @return 结果 + */ + public int updateSysFile(SysFileUpload sysFileUpload); + + /** + * 删除文件(hyc) + * + * @param fileId 文件(hyc)主键 + * @return 结果 + */ + public int deleteSysFileByFileId(String fileId); + + /** + * 批量删除文件(hyc) + * + * @param fileIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteSysFileByFileIds(String[] fileIds); + + public int insertSysFileList(List fileUploads); + void deleteSysFileByQuesId(String firstQuId); + void deleteSysFileByQuesIds(@Param("firstQuIds") String[] firstQuIds); + + public List selectSysFileByQuid(String quId); + +} diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/paper/EducationPaperParamServiceImpl.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/paper/EducationPaperParamServiceImpl.java new file mode 100644 index 00000000..9701c15d --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/paper/EducationPaperParamServiceImpl.java @@ -0,0 +1,100 @@ +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.EducationPaperParam; +import pc.exam.pp.module.exam.dal.mysql.paper.EducationPaperParamMapper; + +import java.util.List; + +/** + * 通用参数Service业务层处理 + * + * @author pengchen + * @date 2025-04-16 + */ +@Service +public class EducationPaperParamServiceImpl implements IEducationPaperParamService +{ + @Autowired + private EducationPaperParamMapper educationPaperParamMapper; + + /** + * 查询通用参数 + * + * @param paramId 通用参数主键 + * @return 通用参数 + */ + @Override + public EducationPaperParam selectEducationPaperParamByParamId(String paramId) + { + return educationPaperParamMapper.selectEducationPaperParamByParamId(paramId); + } + + /** + * 查询通用参数列表 + * + * @param educationPaperParam 通用参数 + * @return 通用参数 + */ + @Override + public List selectEducationPaperParamList(EducationPaperParam educationPaperParam) + { + return educationPaperParamMapper.selectEducationPaperParamList(educationPaperParam); + } + + /** + * 新增通用参数 + * + * @param educationPaperParam 通用参数 + * @return 结果 + */ + @Override + public int insertEducationPaperParam(EducationPaperParam educationPaperParam) + { + return educationPaperParamMapper.insertEducationPaperParam(educationPaperParam); + } + + /** + * 修改通用参数 + * + * @param educationPaperParam 通用参数 + * @return 结果 + */ + @Override + public int updateEducationPaperParam(EducationPaperParam educationPaperParam) + { + return educationPaperParamMapper.updateEducationPaperParam(educationPaperParam); + } + + /** + * 批量删除通用参数 + * + * @param paramIds 需要删除的通用参数主键 + * @return 结果 + */ + @Override + public int deleteEducationPaperParamByParamIds(String[] paramIds) + { + return educationPaperParamMapper.deleteEducationPaperParamByParamIds(paramIds); + } + + /** + * 删除通用参数信息 + * + * @param paramId 通用参数主键 + * @return 结果 + */ + @Override + public int deleteEducationPaperParamByParamId(String paramId) + { + return educationPaperParamMapper.deleteEducationPaperParamByParamId(paramId); + } + + @Override + public EducationPaperParam selectEducationPaperParamByTaskId(String taskId) { + return educationPaperParamMapper.selectEducationPaperParamByTaskId(taskId); + } +} + diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/paper/EducationPaperPersonServiceImpl.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/paper/EducationPaperPersonServiceImpl.java new file mode 100644 index 00000000..29e5dafb --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/paper/EducationPaperPersonServiceImpl.java @@ -0,0 +1,94 @@ +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.EducationPaperPerson; +import pc.exam.pp.module.exam.dal.mysql.paper.EducationPaperPersonMapper; + +import java.util.List; + +/** + * 试卷人员分配Service业务层处理 + * + * @author pengchen + * @date 2025-04-18 + */ +@Service +public class EducationPaperPersonServiceImpl implements IEducationPaperPersonService +{ + @Autowired + private EducationPaperPersonMapper educationPaperPersonMapper; + + /** + * 查询试卷人员分配 + * + * @param taskId 试卷人员分配主键 + * @return 试卷人员分配 + */ + @Override + public EducationPaperPerson selectEducationPaperPersonByTaskId(String taskId) + { + return educationPaperPersonMapper.selectEducationPaperPersonByTaskId(taskId); + } + + /** + * 查询试卷人员分配列表 + * + * @param educationPaperPerson 试卷人员分配 + * @return 试卷人员分配 + */ + @Override + public List selectEducationPaperPersonList(EducationPaperPerson educationPaperPerson) + { + return educationPaperPersonMapper.selectEducationPaperPersonList(educationPaperPerson); + } + + /** + * 新增试卷人员分配 + * + * @param educationPaperPerson 试卷人员分配 + * @return 结果 + */ + @Override + public int insertEducationPaperPerson(EducationPaperPerson educationPaperPerson) + { + return educationPaperPersonMapper.insertEducationPaperPerson(educationPaperPerson); + } + + /** + * 修改试卷人员分配 + * + * @param educationPaperPerson 试卷人员分配 + * @return 结果 + */ + @Override + public int updateEducationPaperPerson(EducationPaperPerson educationPaperPerson) + { + return educationPaperPersonMapper.updateEducationPaperPerson(educationPaperPerson); + } + + /** + * 批量删除试卷人员分配 + * + * @param taskIds 需要删除的试卷人员分配主键 + * @return 结果 + */ + @Override + public int deleteEducationPaperPersonByTaskIds(String[] taskIds) + { + return educationPaperPersonMapper.deleteEducationPaperPersonByTaskIds(taskIds); + } + + /** + * 删除试卷人员分配信息 + * + * @param taskId 试卷人员分配主键 + * @return 结果 + */ + @Override + public int deleteEducationPaperPersonByTaskId(String taskId) + { + return educationPaperPersonMapper.deleteEducationPaperPersonByTaskId(taskId); + } +} diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/paper/EducationPaperQuServiceImpl.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/paper/EducationPaperQuServiceImpl.java new file mode 100644 index 00000000..d37eb563 --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/paper/EducationPaperQuServiceImpl.java @@ -0,0 +1,120 @@ +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.controller.admin.paper.vo.ExamPaperVo; +import pc.exam.pp.module.exam.dal.dataobject.EducationPaperQu; +import pc.exam.pp.module.exam.dal.dataobject.EducationPaperScheme; +import pc.exam.pp.module.exam.dal.dataobject.ExamQuestion; +import pc.exam.pp.module.exam.dal.mysql.paper.EducationPaperMapper; +import pc.exam.pp.module.exam.dal.mysql.paper.EducationPaperQuMapper; +import pc.exam.pp.module.exam.dal.mysql.paper.EducationPaperSchemeMapper; +import pc.exam.pp.module.exam.dal.mysql.question.ExamQuestionMapper; + +import java.util.List; + +/** + * 试卷试题Service业务层处理 + * + * @author pengchen + * @date 2025-04-15 + */ +@Service +public class EducationPaperQuServiceImpl implements IEducationPaperQuService +{ + @Autowired + private EducationPaperQuMapper educationPaperQuMapper; + @Autowired + private EducationPaperMapper educationPaperMapper; + @Autowired + private ExamQuestionMapper examQuestionMapper; + @Autowired + private EducationPaperSchemeMapper educationPaperSchemeMapper; + /** + * 查询试卷试题 + * + * @param paperId 试卷试题主键 + * @return 试卷试题 + */ + @Override + public EducationPaperQu selectEducationPaperQuByPaperId(String paperId) + { + return educationPaperQuMapper.selectEducationPaperQuByPaperId(paperId); + } + + /** + * 查询试卷试题列表 + * + * @param educationPaperQu 试卷试题 + * @return 试卷试题 + */ + @Override + public List selectEducationPaperQuList(EducationPaperQu educationPaperQu) + { + return educationPaperQuMapper.selectEducationPaperQuList(educationPaperQu); + } + + /** + * 新增试卷试题 + * + * @param educationPaperQu 试卷试题 + * @return 结果 + */ + @Override + public int insertEducationPaperQu(EducationPaperQu educationPaperQu) + { + return educationPaperQuMapper.insertEducationPaperQu(educationPaperQu); + } + + /** + * 修改试卷试题 + * + * @param educationPaperQu 试卷试题 + * @return 结果 + */ + @Override + public int updateEducationPaperQu(EducationPaperQu educationPaperQu) + { + return educationPaperQuMapper.updateEducationPaperQu(educationPaperQu); + } + + /** + * 批量删除试卷试题 + * + * @param paperIds 需要删除的试卷试题主键 + * @return 结果 + */ + @Override + public int deleteEducationPaperQuByPaperIds(String[] paperIds) + { + return educationPaperQuMapper.deleteEducationPaperQuByPaperIds(paperIds); + } + + /** + * 删除试卷试题信息 + * + * @param paperId 试卷试题主键 + * @return 结果 + */ + @Override + public int deleteEducationPaperQuByPaperId(String paperId) + { + return educationPaperQuMapper.deleteEducationPaperQuByPaperId(paperId); + } + + @Override + public ExamPaperVo selectPaperQuListByPaperId(String paperId) { + + List quIds =educationPaperQuMapper.selectPaperQuByPaperId(paperId); + List examQuestionList=examQuestionMapper.selectExamQuestionListByQuIds(quIds); + + String taskid=educationPaperMapper.selectTaskIdByPaperId(paperId); + + List educationPaperSchemeList= educationPaperSchemeMapper.selectEducationPaperTaskByTaskId(taskid); + ExamPaperVo examPaperVo=new ExamPaperVo(); + examPaperVo.setExamQuestionList(examQuestionList); + examPaperVo.setEducationPaperSchemeList(educationPaperSchemeList); + return examPaperVo; + } +} + diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/paper/EducationPaperSchemeServiceImpl.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/paper/EducationPaperSchemeServiceImpl.java new file mode 100644 index 00000000..6b2af428 --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/paper/EducationPaperSchemeServiceImpl.java @@ -0,0 +1,128 @@ +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.EducationPaperScheme; +import pc.exam.pp.module.exam.dal.mysql.paper.EducationPaperSchemeMapper; +import pc.exam.pp.module.exam.utils.uuid.IdUtils; + +import java.util.List; +import java.util.stream.Collectors; + +/** + * 试卷方案Service业务层处理 + * + * @author pengchen + * @date 2025-04-15 + */ +@Service +public class EducationPaperSchemeServiceImpl implements IEducationPaperSchemeService +{ + @Autowired + private EducationPaperSchemeMapper educationPaperSchemeMapper; + + /** + * 查询试卷方案 + * + * @param schemeId 试卷方案主键 + * @return 试卷方案 + */ + @Override + public EducationPaperScheme selectEducationPaperSchemeBySchemeId(String schemeId) + { + return educationPaperSchemeMapper.selectEducationPaperSchemeBySchemeId(schemeId); + } + + /** + * 查询试卷方案列表 + * + * @param educationPaperScheme 试卷方案 + * @return 试卷方案 + */ + @Override + public List selectEducationPaperSchemeList(EducationPaperScheme educationPaperScheme) + { + return educationPaperSchemeMapper.selectEducationPaperSchemeList(educationPaperScheme); + } + + /** + * 新增试卷方案 + * + * @param educationPaperScheme 试卷方案 + * @return 结果 + */ + @Override + public int insertEducationPaperScheme(EducationPaperScheme educationPaperScheme) { + + String uuid = IdUtils.simpleUUID(); + educationPaperScheme.setSchemeId(uuid); + + + // 将 List 转换为逗号分隔的字符串 + List keyword = educationPaperScheme.getKeyword(); + String keywordStr = String.join(",", keyword); + // 将 List 转换为逗号分隔的字符串 + List pointName = educationPaperScheme.getPointName(); + String pointNameStr = pointName.stream() + .map(String::valueOf) // 将 Integer 转换为 String + .collect(Collectors.joining(",")); // 使用逗号连接 + + educationPaperScheme.setKeywords(keywordStr); + educationPaperScheme.setPointNames(pointNameStr); + + // 然后插入到数据库 + return educationPaperSchemeMapper.insertEducationPaperScheme(educationPaperScheme); + } + + + /** + * 修改试卷方案 + * + * @param educationPaperScheme 试卷方案 + * @return 结果 + */ + @Override + public int updateEducationPaperScheme(EducationPaperScheme educationPaperScheme) + { + + // 将 List 转换为逗号分隔的字符串 + List keyword = educationPaperScheme.getKeyword(); + String keywordStr = String.join(",", keyword); + // 将 List 转换为逗号分隔的字符串 + List pointName = educationPaperScheme.getPointName(); + String pointNameStr = pointName.stream() + .map(String::valueOf) // 将 Integer 转换为 String + .collect(Collectors.joining(",")); // 使用逗号连接 + + educationPaperScheme.setKeywords(keywordStr); + educationPaperScheme.setPointNames(pointNameStr); + + return educationPaperSchemeMapper.updateEducationPaperScheme(educationPaperScheme); + } + + /** + * 批量删除试卷方案 + * + * @param schemeIds 需要删除的试卷方案主键 + * @return 结果 + */ + @Override + public int deleteEducationPaperSchemeBySchemeIds(String[] schemeIds) + { + return educationPaperSchemeMapper.deleteEducationPaperSchemeBySchemeIds(schemeIds); + } + + /** + * 删除试卷方案信息 + * + * @param schemeId 试卷方案主键 + * @return 结果 + */ + @Override + public int deleteEducationPaperSchemeBySchemeId(String schemeId) + { + return educationPaperSchemeMapper.deleteEducationPaperSchemeBySchemeId(schemeId); + } +} + diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/paper/EducationPaperServiceImpl.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/paper/EducationPaperServiceImpl.java new file mode 100644 index 00000000..b6ca3e05 --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/paper/EducationPaperServiceImpl.java @@ -0,0 +1,246 @@ +package pc.exam.pp.module.exam.service.paper; + + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import pc.exam.pp.framework.common.pojo.PageResult; +import pc.exam.pp.framework.tenant.core.aop.TenantIgnore; +import pc.exam.pp.framework.tenant.core.context.TenantContextHolder; +import pc.exam.pp.module.exam.controller.admin.paper.vo.PaperPageVo; +import pc.exam.pp.module.exam.dal.dataobject.PaperListResponseVo; +import pc.exam.pp.module.exam.dal.dataobject.EducationPaper; +import pc.exam.pp.module.exam.dal.dataobject.EducationPaperQu; +import pc.exam.pp.module.exam.dal.dataobject.EducationPaperScheme; +import pc.exam.pp.module.exam.dal.mysql.paper.EducationPaperMapper; +import pc.exam.pp.module.exam.dal.mysql.paper.EducationPaperQuMapper; +import pc.exam.pp.module.exam.dal.mysql.paper.EducationPaperSchemeMapper; +import pc.exam.pp.module.exam.dal.mysql.paper.EducationPaperTaskMapper; +import pc.exam.pp.module.exam.utils.uuid.IdUtils; + +import java.util.*; + +/** + * 试卷Service业务层处理 + * + * @author pengchen + * @date 2025-04-15 + */ +@Service +public class EducationPaperServiceImpl implements IEducationPaperService +{ + @Autowired + private EducationPaperMapper educationPaperMapper; + @Autowired + private EducationPaperSchemeMapper educationPaperSchemeMapper; + @Autowired + private EducationPaperTaskMapper educationPaperTaskMapper; + + @Autowired + private EducationPaperQuMapper educationPaperQuMapper; + /** + * 查询试卷 + * + * @param paperId 试卷主键 + * @return 试卷 + */ + @Override + public EducationPaper selectEducationPaperByPaperId(String paperId) + { + return educationPaperMapper.selectEducationPaperByPaperId(paperId); + } + + /** + * 查询试卷列表 + * + * @param paperPageVo 试卷 + * @return 试卷 + */ + @Override + public PageResult selectEducationPaperList(PaperPageVo paperPageVo) + { + return educationPaperMapper.selectEducationPaperList(paperPageVo); + } + + /** + * 新增试卷 + * + * @param educationPaper 试卷 + * @return 结果 + */ + @Override + public int insertEducationPaper(EducationPaper educationPaper) + { + return educationPaperMapper.insertEducationPaper(educationPaper); + } + + /** + * 修改试卷 + * + * @param educationPaper 试卷 + * @return 结果 + */ + @Override + public int updateEducationPaper(EducationPaper educationPaper) + { + return educationPaperMapper.updateEducationPaper(educationPaper); + } + + /** + * 批量删除试卷 + * + * @param paperIds 需要删除的试卷主键 + * @return 结果 + */ + @Override + public int deleteEducationPaperByPaperIds(String[] paperIds) + { + + + return educationPaperMapper.deleteEducationPaperByPaperIds(paperIds); + } + + /** + * 删除试卷信息 + * + * @param paperId 试卷主键 + * @return 结果 + */ + @Override + public int deleteEducationPaperByPaperId(String paperId) + { + return educationPaperMapper.deleteEducationPaperByPaperId(paperId); + } + + @Override + @TenantIgnore + public int addPaperList(Integer num, String taskid,String taskSpecialty) { + //根据试卷任务id查找方案集合 + List educationPaperSchemeList= educationPaperSchemeMapper.selectEducationPaperTaskByTaskId(taskid); + for (int i = 0; i examQuestionIds = new ArrayList<>(); + //第i张卷子 + for (EducationPaperScheme educationPaperScheme : educationPaperSchemeList) { + //获取试卷方案对象 + String pointNames = educationPaperScheme.getPointNames(); + //知识点id + List pointList ; + //知识点名称 + List pointName =new ArrayList<>(); + if (pointNames!=null){ + pointList = Arrays.asList(pointNames.split(",")); + if (pointList!=null){ + pointName= educationPaperTaskMapper.selectPointByid(pointList); + } + } + String keywords = educationPaperScheme.getKeywords(); + List keywordList =new ArrayList<>(); + if (keywords != null && !keywords.trim().isEmpty()) { + keywordList = Arrays.asList(keywords.split(",")); + } + if ("3".equals(educationPaperScheme.getQuLevel())){ + educationPaperScheme.setQuLevel(""); + } + //根据方案,去查找 试题表,返回试题id + Long requiredTenantId = TenantContextHolder.getRequiredTenantId(); + + List quId = educationPaperMapper.selectQuByPaperScheme(pointName,keywordList,educationPaperScheme,taskSpecialty,requiredTenantId); + //把第i张卷子方案的试题全加一起 + examQuestionIds.addAll(quId); + + } + //构建试卷 + EducationPaper educationPaper =new EducationPaper(); + String uuid = IdUtils.simpleUUID(); + educationPaper.setPaperId(uuid); + educationPaper.setTaskId(taskid); + educationPaperMapper.insertEducationPaper(educationPaper); + + System.out.println(examQuestionIds+"examQuestionIdsexamQuestionIds"); + + //构建试卷试题对象 + List educationPaperQus=new ArrayList<>(); + if (examQuestionIds!=null&& examQuestionIds.size()>0){ + for (String examQuestionId : examQuestionIds) { + EducationPaperQu educationPaperQu=new EducationPaperQu(); + educationPaperQu.setPaperId(uuid); + educationPaperQu.setQuId(examQuestionId); + educationPaperQus.add(educationPaperQu); + } + educationPaperQuMapper.insertEducationPaperQuList(educationPaperQus); + } + + + } + + + + return 0 ; + } + + @Override + public List selectPaperByTaskId(String taskId) { + return educationPaperMapper.selectPaperByTaskId(taskId); + } + + @Override + public int updateEducationByids(List strings) { + return educationPaperMapper.updateEducationByids(strings); + } + + @Override + public List selectPaperRandomByTaskId(String taskId) { + return educationPaperMapper.selectPaperRandomByTaskId(taskId); + } + + @Override + public int updateRandomByids(List strings) { + return educationPaperMapper.updateRandomByids(strings); + } + + @Override + public void updatePaperGuByRollup(String taskId) { + educationPaperMapper.updatePaperGuByRollup(taskId); + } + + @Override + public List selectPaperByTaskIdAndRoll(String taskId) { + return educationPaperMapper.selectPaperByTaskIdAndRoll(taskId); + } + + @Override + public PaperListResponseVo getPaperByTaskIdByType(String taskId, List rows) { + //构建返回对象 + PaperListResponseVo paperListResponseVo=new PaperListResponseVo(); + //查找该方案所有的试卷 + List paperByTaskIdByType = educationPaperMapper.getPaperByTaskIdByType(taskId); + paperListResponseVo.setPaperId(paperByTaskIdByType); + // + Set selectedIds =new HashSet<>(); + //根据选中的方案,查找选中方案下已分配的试卷 + if (rows!=null&&rows.size()>0){ + for (String row : rows) { + String selectedId=educationPaperMapper.getSelectPaperIdBySchemeIds(row); + if (selectedId != null && !selectedId.isEmpty()) { + // 按逗号分割,并添加到 selectedIds + selectedIds.addAll(Arrays.asList(selectedId.split(","))); + } + } + + } + paperListResponseVo.setSelectedIds(selectedIds); + return paperListResponseVo ; + } + + @Override + public int updateEducationByidsThree(List strings) { + return educationPaperMapper.updateEducationByidsThree(strings); + } + + @Override + public int changeStatus(String paperId, String status) { + return educationPaperMapper.changeStatus(paperId,status); + } + + +} + diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/paper/EducationPaperSessionServiceImpl.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/paper/EducationPaperSessionServiceImpl.java new file mode 100644 index 00000000..0831295d --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/paper/EducationPaperSessionServiceImpl.java @@ -0,0 +1,101 @@ +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.EducationPaperSessionMapper; +import pc.exam.pp.module.exam.utils.uuid.IdUtils; + +import java.util.List; + +/** + * 试卷场次Service业务层处理 + * + * @author pengchen + * @date 2025-04-17 + */ +@Service +public class EducationPaperSessionServiceImpl implements IEducationPaperSessionService +{ + @Autowired + private EducationPaperSessionMapper educationPaperSessionMapper; + + /** + * 查询试卷场次 + * + * @param sessionId 试卷场次主键 + * @return 试卷场次 + */ + @Override + public EducationPaperSession selectEducationPaperSessionBySessionId(String sessionId) + { + return educationPaperSessionMapper.selectEducationPaperSessionBySessionId(sessionId); + } + + /** + * 查询试卷场次列表 + * + * @param educationPaperSession 试卷场次 + * @return 试卷场次 + */ + @Override + public List selectEducationPaperSessionList(EducationPaperSession educationPaperSession) + { + return educationPaperSessionMapper.selectEducationPaperSessionList(educationPaperSession); + } + + /** + * 新增试卷场次 + * + * @param educationPaperSession 试卷场次 + * @return 结果 + */ + @Override + public int insertEducationPaperSession(EducationPaperSession educationPaperSession) + { + String uuid = IdUtils.simpleUUID(); + educationPaperSession.setSessionId(uuid); + return educationPaperSessionMapper.insertEducationPaperSession(educationPaperSession); + } + + /** + * 修改试卷场次 + * + * @param educationPaperSession 试卷场次 + * @return 结果 + */ + @Override + public int updateEducationPaperSession(EducationPaperSession educationPaperSession) + { + return educationPaperSessionMapper.updateEducationPaperSession(educationPaperSession); + } + + /** + * 批量删除试卷场次 + * + * @param sessionIds 需要删除的试卷场次主键 + * @return 结果 + */ + @Override + public int deleteEducationPaperSessionBySessionIds(String[] sessionIds) + { + return educationPaperSessionMapper.deleteEducationPaperSessionBySessionIds(sessionIds); + } + + /** + * 删除试卷场次信息 + * + * @param sessionId 试卷场次主键 + * @return 结果 + */ + @Override + public int deleteEducationPaperSessionBySessionId(String sessionId) + { + return educationPaperSessionMapper.deleteEducationPaperSessionBySessionId(sessionId); + } + + @Override + public int changeStatus(String sessionId, String status) { + return educationPaperSessionMapper.changeStatus(sessionId,status); + } +} diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/paper/EducationPaperTaskServiceImpl.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/paper/EducationPaperTaskServiceImpl.java new file mode 100644 index 00000000..5def6122 --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/paper/EducationPaperTaskServiceImpl.java @@ -0,0 +1,338 @@ +package pc.exam.pp.module.exam.service.paper; + + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import pc.exam.pp.framework.common.pojo.PageResult; +import pc.exam.pp.framework.tenant.core.aop.TenantIgnore; +import pc.exam.pp.framework.tenant.core.context.TenantContextHolder; +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.*; +import pc.exam.pp.module.exam.dal.mysql.paper.*; +import pc.exam.pp.module.exam.utils.date.DateUtils; +import pc.exam.pp.module.exam.utils.uuid.IdUtils; + +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.*; +import java.util.stream.Collectors; + +/** + * 试卷任务Service业务层处理 + * + * @author pengchen + * @date 2025-04-14 + */ +@Service +public class EducationPaperTaskServiceImpl implements IEducationPaperTaskService { + @Autowired + private EducationPaperMapper educationPaperMapper; + + @Autowired + private EducationPaperParamMapper educationPaperParamMapper; + + @Autowired + private EducationPaperQuMapper educationPaperQuMapper; + + @Autowired + private EducationPaperSchemeMapper educationPaperSchemeMapper; + + @Autowired + private EducationPaperSessionMapper educationPaperSessionMapper; + + @Autowired + private EducationPaperTaskMapper educationPaperTaskMapper; + + + + /** + * 查询试卷任务 + * + * @param taskId 试卷任务主键 + * @return 试卷任务 + */ + @Override + public EducationPaperTask selectEducationPaperTaskByTaskId(String taskId) { + return educationPaperTaskMapper.selectEducationPaperTaskByTaskId(taskId); + } + + /** + * 查询试卷任务列表 + * + * @param educationPaperTask 试卷任务 + * @return 试卷任务 + */ + @Override + public PageResult selectEducationPaperTaskList(PaperTaskPageVo educationPaperTask) { + PageResult educationPaperTasks = educationPaperTaskMapper.selectEducationPaperTaskList(educationPaperTask); + return educationPaperTasks ; + } + + /** + * 新增试卷任务 + * + * @param educationPaperTask 试卷任务 + * @return 结果 + */ + @Override + public int insertEducationPaperTask(EducationPaperTask educationPaperTask) { + String uuid = IdUtils.simpleUUID(); + educationPaperTask.setTaskId(uuid); + educationPaperTask.setCreateTime(DateUtils.getNowLocalDateTime()); + EducationPaperParam educationPaperParam = new EducationPaperParam(); + educationPaperParam.setParamId(IdUtils.simpleUUID()); + educationPaperParam.setTaskId(uuid); + educationPaperParam.setIsExamPassword("1"); + educationPaperParam.setUsb("0"); + educationPaperParam.setSaveGrades("0"); + educationPaperParam.setDriver("C"); + educationPaperParam.setDirectory("KSWJ"); + educationPaperParam.setUploadTime("5"); + educationPaperParam.setIsDel("0"); + if ("1".equals(educationPaperTask.getTaskType())){ + educationPaperParam.setIsRepeat("1"); + educationPaperParam.setIsAnswer("1"); + educationPaperParam.setIsLook("1"); + educationPaperParam.setIsConnect("30"); + }else { + educationPaperParam.setIsRepeat("0"); + educationPaperParam.setIsAnswer("0"); + educationPaperParam.setIsLook("0"); + } + + + educationPaperParamMapper.insertEducationPaperParam(educationPaperParam); + + return educationPaperTaskMapper.insertEducationPaperTask(educationPaperTask); + } + + /** + * 修改试卷任务 + * + * @param educationPaperTask 试卷任务 + * @return 结果 + */ + @Override + public int updateEducationPaperTask(EducationPaperTask educationPaperTask) { + educationPaperTask.setUpdateTime(DateUtils.getNowLocalDateTime()); + return educationPaperTaskMapper.updateEducationPaperTask(educationPaperTask); + } + + /** + * 批量删除试卷任务 + * + * @param taskIds 需要删除的试卷任务主键 + * @return 结果 + */ + @Override + public int deleteEducationPaperTaskByTaskIds(String[] taskIds) { + System.out.println(taskIds); + return educationPaperTaskMapper.deleteEducationPaperTaskByTaskIds(taskIds); + } + + /** + * 删除试卷任务信息 + * + * @param taskId 试卷任务主键 + * @return 结果 + */ + @Override + public int deleteEducationPaperTaskByTaskId(String taskId) { + return educationPaperTaskMapper.deleteEducationPaperTaskByTaskId(taskId); + } + + @Override + public List getSpecialityList() { + return educationPaperTaskMapper.getSpecialityList(); + } + + @Override + public List getCourseList() { + return educationPaperTaskMapper.getCourseList(); + } + + @Override + public List getKeywords() { + return educationPaperTaskMapper.getKeywords(); + } + + @Override + public List getPoints(String name) { + Long id= educationPaperTaskMapper.getPointIdByName(name); + return educationPaperTaskMapper.getPoints(id); + } + + @Override + @TenantIgnore + public Integer getQuCount(SchemeParam param) { + //关键字 + List keywords = param.getKeyword(); + //知识点 + List pointId = param.getPointIds(); + System.out.println(pointId + "pointd"); + //根据知识点的id查找对应的sp_name + List pointNames = new ArrayList<>(); + if (pointId != null&&pointId.size()>0) { + pointNames = educationPaperTaskMapper.selectPointByid(pointId); + } + //难度 + String quLevel = param.getQuLevel(); + if ("3".equals(quLevel)) { + quLevel = null; + } + //专业名称 + String taskSpecialty = param.getTaskSpecialty(); + //题型 + String spName = param.getSpName(); + Long requiredTenantId = TenantContextHolder.getRequiredTenantId(); + System.out.println(requiredTenantId+"requiredTenantIdrequiredTenantId"); + System.out.println(taskSpecialty+"taskSpecialty"); + System.out.println(pointNames+"pointNames"); + System.out.println(keywords+"keywords"); + System.out.println(quLevel+"quLevel"); + System.out.println(spName+"spName"); + return educationPaperTaskMapper.getQuCount(taskSpecialty, spName, quLevel, pointNames, keywords,requiredTenantId); + } + + @Override + @Transactional(rollbackFor = Exception.class) // 所有异常都回滚 + public void submitSelection(TempDto tempDto) { + String taskId = tempDto.getTaskId(); + List options = tempDto.getOptions(); + //新的方案id + String newtaskId = IdUtils.simpleUUID(); + EducationPaperTask educationPaperTask = educationPaperTaskMapper.selectEducationPaperTaskByTaskId(taskId); + educationPaperTask.setTaskId(newtaskId); + // 获取当前时间 + LocalDateTime now = LocalDateTime.now(); + + // 定义时间格式:yyyyMMddHHmm + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMddHHmm"); + + // 格式化时间为字符串 + String timeString = now.format(formatter); + educationPaperTask.setTaskName(educationPaperTask.getTaskName()+timeString); + + educationPaperTask.setIsTemplate("1"); + educationPaperTaskMapper.insertEducationPaperTask(educationPaperTask); + + if (options.contains("1")) { + //复制试卷方案 + List educationPaperSchemeList = educationPaperSchemeMapper.selectEducationPaperTaskByTaskId(taskId); + + + if (educationPaperSchemeList != null && !educationPaperSchemeList.isEmpty()) { + educationPaperSchemeList.forEach(scheme -> scheme.setSchemeId(IdUtils.simpleUUID())); + educationPaperSchemeList.forEach(scheme -> scheme.setTaskId(newtaskId)); + //构建新方案 + educationPaperSchemeMapper.insertEducationPaperSchemeList(educationPaperSchemeList); + } + + + } + if (options.contains("2") && !(options.contains("4"))) { + //复制试卷管理 + List educationPapers = educationPaperMapper.selectPaperListByTaskId(taskId); + if (educationPapers != null && !educationPapers.isEmpty()) { + + for (EducationPaper educationPaper : educationPapers) { + //创建新的试卷 + String paperId = educationPaper.getPaperId(); + //获得 试卷试题 + List educationPaperQus = educationPaperQuMapper.selectPaperQuListByPaperId(paperId); + + + String newpaperId = IdUtils.simpleUUID(); + + //不为空,构建新试卷试题 + if (educationPaperQus != null && !educationPaperQus.isEmpty()) { + educationPaperQus.forEach(qu -> qu.setPaperId(newpaperId)); + } + + //插入数据库 + educationPaperQuMapper.insertEducationPaperQuList(educationPaperQus); + educationPaper.setPaperId(newpaperId); + educationPaper.setTaskId(newtaskId); + + + } + + //构建新试卷 + educationPaperMapper.insertEducationPaperList(educationPapers); + } + } + if (options.contains("3")) { + //复制参数设置 + EducationPaperParam educationPaperParam = educationPaperParamMapper.selectEducationPaperParamByTaskId(taskId); + educationPaperParam.setTaskId(newtaskId); + educationPaperParam.setParamId(IdUtils.simpleUUID()); + educationPaperParamMapper.insertEducationPaperParam(educationPaperParam); + + } + //这里考虑考场和试题的关联 + if (options.contains("4") && !(options.contains("2"))) { + //复制考场设置 + List educationPaperSessions = educationPaperSessionMapper.selectEducationPaperSessionByTaskId(taskId); + educationPaperSessions.forEach(session -> session.setSessionId(IdUtils.simpleUUID())); + educationPaperSessions.forEach(session -> session.setPaperId(null)); + educationPaperSessions.forEach(session -> session.setTaskId(newtaskId)); + //批量插入 + educationPaperSessionMapper.insertEducationPaperSessionList(educationPaperSessions); + + } + if (options.contains("4") && options.contains("2")) { + + // 1. 查询原始数据 + List educationPapers = educationPaperMapper.selectPaperListByTaskId(taskId); + List educationPaperSessions = educationPaperSessionMapper.selectEducationPaperSessionByTaskId(taskId); + + // 2. 复制所有试卷,建立新旧ID映射 + Map paperIdMapping = new HashMap<>(); + for (EducationPaper paper : educationPapers) { + String newPaperId = IdUtils.simpleUUID(); + paperIdMapping.put(paper.getPaperId(), newPaperId); + + // 复制试卷试题 + List questions = educationPaperQuMapper.selectPaperQuListByPaperId(paper.getPaperId()); + questions.forEach(qu -> qu.setPaperId(newPaperId)); + educationPaperQuMapper.insertEducationPaperQuList(questions); + + paper.setPaperId(newPaperId); + paper.setTaskId(newtaskId); + educationPaperMapper.insertEducationPaper(paper); + + + } + + // 3. 处理考场分配 + for (EducationPaperSession session : educationPaperSessions) { + session.setSessionId(IdUtils.simpleUUID()); + session.setTaskId(newtaskId); + if (session.getPaperId() != null) { + String newPaperIds = Arrays.stream(session.getPaperId().split(",")) + .map(paperIdMapping::get) + .collect(Collectors.joining(",")); + session.setPaperId(newPaperIds); + } + } + + // 4. 批量插入考场 + educationPaperSessionMapper.insertEducationPaperSessionList(educationPaperSessions); + + } + + if (options.contains("5")) { + //复制人员设置 + + + } + } + + @Override + public boolean changeStatus(String taskId, String status) { + return educationPaperTaskMapper.changeStatus(taskId,status); + } +} diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/paper/IEducationPaperParamService.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/paper/IEducationPaperParamService.java new file mode 100644 index 00000000..33775697 --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/paper/IEducationPaperParamService.java @@ -0,0 +1,67 @@ +package pc.exam.pp.module.exam.service.paper; + + +import pc.exam.pp.module.exam.dal.dataobject.EducationPaperParam; + +import java.util.List; + +/** + * 通用参数Service接口 + * + * @author pengchen + * @date 2025-04-16 + */ +public interface IEducationPaperParamService +{ + /** + * 查询通用参数 + * + * @param paramId 通用参数主键 + * @return 通用参数 + */ + public EducationPaperParam selectEducationPaperParamByParamId(String paramId); + + /** + * 查询通用参数列表 + * + * @param educationPaperParam 通用参数 + * @return 通用参数集合 + */ + public List selectEducationPaperParamList(EducationPaperParam educationPaperParam); + + /** + * 新增通用参数 + * + * @param educationPaperParam 通用参数 + * @return 结果 + */ + public int insertEducationPaperParam(EducationPaperParam educationPaperParam); + + /** + * 修改通用参数 + * + * @param educationPaperParam 通用参数 + * @return 结果 + */ + public int updateEducationPaperParam(EducationPaperParam educationPaperParam); + + /** + * 批量删除通用参数 + * + * @param paramIds 需要删除的通用参数主键集合 + * @return 结果 + */ + public int deleteEducationPaperParamByParamIds(String[] paramIds); + + /** + * 删除通用参数信息 + * + * @param paramId 通用参数主键 + * @return 结果 + */ + public int deleteEducationPaperParamByParamId(String paramId); + + EducationPaperParam selectEducationPaperParamByTaskId(String taskId); + +} + diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/paper/IEducationPaperPersonService.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/paper/IEducationPaperPersonService.java new file mode 100644 index 00000000..4daf740f --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/paper/IEducationPaperPersonService.java @@ -0,0 +1,64 @@ +package pc.exam.pp.module.exam.service.paper; + + +import pc.exam.pp.module.exam.dal.dataobject.EducationPaperPerson; + +import java.util.List; + +/** + * 试卷人员分配Service接口 + * + * @author pengchen + * @date 2025-04-18 + */ +public interface IEducationPaperPersonService +{ + /** + * 查询试卷人员分配 + * + * @param taskId 试卷人员分配主键 + * @return 试卷人员分配 + */ + public EducationPaperPerson selectEducationPaperPersonByTaskId(String taskId); + + /** + * 查询试卷人员分配列表 + * + * @param educationPaperPerson 试卷人员分配 + * @return 试卷人员分配集合 + */ + public List selectEducationPaperPersonList(EducationPaperPerson educationPaperPerson); + + /** + * 新增试卷人员分配 + * + * @param educationPaperPerson 试卷人员分配 + * @return 结果 + */ + public int insertEducationPaperPerson(EducationPaperPerson educationPaperPerson); + + /** + * 修改试卷人员分配 + * + * @param educationPaperPerson 试卷人员分配 + * @return 结果 + */ + public int updateEducationPaperPerson(EducationPaperPerson educationPaperPerson); + + /** + * 批量删除试卷人员分配 + * + * @param taskIds 需要删除的试卷人员分配主键集合 + * @return 结果 + */ + public int deleteEducationPaperPersonByTaskIds(String[] taskIds); + + /** + * 删除试卷人员分配信息 + * + * @param taskId 试卷人员分配主键 + * @return 结果 + */ + public int deleteEducationPaperPersonByTaskId(String taskId); +} + diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/paper/IEducationPaperQuService.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/paper/IEducationPaperQuService.java new file mode 100644 index 00000000..4815fb92 --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/paper/IEducationPaperQuService.java @@ -0,0 +1,67 @@ +package pc.exam.pp.module.exam.service.paper; + +import pc.exam.pp.module.exam.controller.admin.paper.vo.ExamPaperVo; +import pc.exam.pp.module.exam.dal.dataobject.EducationPaperQu; + +import java.util.List; + +/** + * 试卷试题Service接口 + * + * @author pengchen + * @date 2025-04-15 + */ +public interface IEducationPaperQuService +{ + /** + * 查询试卷试题 + * + * @param paperId 试卷试题主键 + * @return 试卷试题 + */ + public EducationPaperQu selectEducationPaperQuByPaperId(String paperId); + + /** + * 查询试卷试题列表 + * + * @param educationPaperQu 试卷试题 + * @return 试卷试题集合 + */ + public List selectEducationPaperQuList(EducationPaperQu educationPaperQu); + + /** + * 新增试卷试题 + * + * @param educationPaperQu 试卷试题 + * @return 结果 + */ + public int insertEducationPaperQu(EducationPaperQu educationPaperQu); + + /** + * 修改试卷试题 + * + * @param educationPaperQu 试卷试题 + * @return 结果 + */ + public int updateEducationPaperQu(EducationPaperQu educationPaperQu); + + /** + * 批量删除试卷试题 + * + * @param paperIds 需要删除的试卷试题主键集合 + * @return 结果 + */ + public int deleteEducationPaperQuByPaperIds(String[] paperIds); + + /** + * 删除试卷试题信息 + * + * @param paperId 试卷试题主键 + * @return 结果 + */ + public int deleteEducationPaperQuByPaperId(String paperId); + + ExamPaperVo selectPaperQuListByPaperId(String paperId); + +} + diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/paper/IEducationPaperSchemeService.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/paper/IEducationPaperSchemeService.java new file mode 100644 index 00000000..979829ac --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/paper/IEducationPaperSchemeService.java @@ -0,0 +1,64 @@ +package pc.exam.pp.module.exam.service.paper; + + +import pc.exam.pp.module.exam.dal.dataobject.EducationPaperScheme; + +import java.util.List; + +/** + * 试卷方案Service接口 + * + * @author pengchen + * @date 2025-04-15 + */ +public interface IEducationPaperSchemeService +{ + /** + * 查询试卷方案 + * + * @param schemeId 试卷方案主键 + * @return 试卷方案 + */ + public EducationPaperScheme selectEducationPaperSchemeBySchemeId(String schemeId); + + /** + * 查询试卷方案列表 + * + * @param educationPaperScheme 试卷方案 + * @return 试卷方案集合 + */ + public List selectEducationPaperSchemeList(EducationPaperScheme educationPaperScheme); + + /** + * 新增试卷方案 + * + * @param educationPaperScheme 试卷方案 + * @return 结果 + */ + public int insertEducationPaperScheme(EducationPaperScheme educationPaperScheme); + + /** + * 修改试卷方案 + * + * @param educationPaperScheme 试卷方案 + * @return 结果 + */ + public int updateEducationPaperScheme(EducationPaperScheme educationPaperScheme); + + /** + * 批量删除试卷方案 + * + * @param schemeIds 需要删除的试卷方案主键集合 + * @return 结果 + */ + public int deleteEducationPaperSchemeBySchemeIds(String[] schemeIds); + + /** + * 删除试卷方案信息 + * + * @param schemeId 试卷方案主键 + * @return 结果 + */ + public int deleteEducationPaperSchemeBySchemeId(String schemeId); +} + diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/paper/IEducationPaperService.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/paper/IEducationPaperService.java new file mode 100644 index 00000000..fc429372 --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/paper/IEducationPaperService.java @@ -0,0 +1,91 @@ +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.vo.PaperPageVo; +import pc.exam.pp.module.exam.dal.dataobject.PaperListResponseVo; +import pc.exam.pp.module.exam.dal.dataobject.EducationPaper; + +import java.util.List; + +/** + * 试卷Service接口 + * + * @author pengchen + * @date 2025-04-15 + */ +public interface IEducationPaperService +{ + /** + * 查询试卷 + * + * @param paperId 试卷主键 + * @return 试卷 + */ + public EducationPaper selectEducationPaperByPaperId(String paperId); + + /** + * 查询试卷列表 + * + * @param paperPageVo 试卷 + * @return 试卷集合 + */ + PageResult selectEducationPaperList(PaperPageVo paperPageVo); + + /** + * 新增试卷 + * + * @param educationPaper 试卷 + * @return 结果 + */ + public int insertEducationPaper(EducationPaper educationPaper); + + /** + * 修改试卷 + * + * @param educationPaper 试卷 + * @return 结果 + */ + public int updateEducationPaper(EducationPaper educationPaper); + + /** + * 批量删除试卷 + * + * @param paperIds 需要删除的试卷主键集合 + * @return 结果 + */ + public int deleteEducationPaperByPaperIds(String[] paperIds); + + /** + * 删除试卷信息 + * + * @param paperId 试卷主键 + * @return 结果 + */ + public int deleteEducationPaperByPaperId(String paperId); + + + public int addPaperList(Integer num, String taskid, String taskSpecialty); + + List selectPaperByTaskId(String taskId); + + public int updateEducationByids(List strings); + + List selectPaperRandomByTaskId(String taskId); + + public int updateRandomByids(List strings); + + void updatePaperGuByRollup(String taskId); + + + List selectPaperByTaskIdAndRoll(String taskId); + + PaperListResponseVo getPaperByTaskIdByType(String taskId, List rows); + + public int updateEducationByidsThree(List strings); + + int changeStatus(String paperId, String status); + + +} + diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/paper/IEducationPaperSessionService.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/paper/IEducationPaperSessionService.java new file mode 100644 index 00000000..b9fec8ba --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/paper/IEducationPaperSessionService.java @@ -0,0 +1,65 @@ +package pc.exam.pp.module.exam.service.paper; + + +import pc.exam.pp.module.exam.dal.dataobject.EducationPaperSession; + +import java.util.List; + +/** + * 试卷场次Service接口 + * + * @author pengchen + * @date 2025-04-17 + */ +public interface IEducationPaperSessionService +{ + /** + * 查询试卷场次 + * + * @param sessionId 试卷场次主键 + * @return 试卷场次 + */ + public EducationPaperSession selectEducationPaperSessionBySessionId(String sessionId); + + /** + * 查询试卷场次列表 + * + * @param educationPaperSession 试卷场次 + * @return 试卷场次集合 + */ + public List selectEducationPaperSessionList(EducationPaperSession educationPaperSession); + + /** + * 新增试卷场次 + * + * @param educationPaperSession 试卷场次 + * @return 结果 + */ + public int insertEducationPaperSession(EducationPaperSession educationPaperSession); + + /** + * 修改试卷场次 + * + * @param educationPaperSession 试卷场次 + * @return 结果 + */ + public int updateEducationPaperSession(EducationPaperSession educationPaperSession); + + /** + * 批量删除试卷场次 + * + * @param sessionIds 需要删除的试卷场次主键集合 + * @return 结果 + */ + public int deleteEducationPaperSessionBySessionIds(String[] sessionIds); + + /** + * 删除试卷场次信息 + * + * @param sessionId 试卷场次主键 + * @return 结果 + */ + public int deleteEducationPaperSessionBySessionId(String sessionId); + + int changeStatus(String sessionId, String status); +} diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/paper/IEducationPaperTaskService.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/paper/IEducationPaperTaskService.java new file mode 100644 index 00000000..3fb249af --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/paper/IEducationPaperTaskService.java @@ -0,0 +1,85 @@ +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.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.EducationPaperTask; + +import java.util.List; + +/** + * 试卷任务Service接口 + * + * @author pengchen + * @date 2025-04-14 + */ +public interface IEducationPaperTaskService +{ + /** + * 查询试卷任务 + * + * @param taskId 试卷任务主键 + * @return 试卷任务 + */ + public EducationPaperTask selectEducationPaperTaskByTaskId(String taskId); + + /** + * 查询试卷任务列表 + * + * @param educationPaperTask 试卷任务 + * @return 试卷任务集合 + */ + PageResult selectEducationPaperTaskList(PaperTaskPageVo educationPaperTask); + + /** + * 新增试卷任务 + * + * @param educationPaperTask 试卷任务 + * @return 结果 + */ + public int insertEducationPaperTask(EducationPaperTask educationPaperTask); + + /** + * 修改试卷任务 + * + * @param educationPaperTask 试卷任务 + * @return 结果 + */ + public int updateEducationPaperTask(EducationPaperTask educationPaperTask); + + /** + * 批量删除试卷任务 + * + * @param taskIds 需要删除的试卷任务主键集合 + * @return 结果 + */ + public int deleteEducationPaperTaskByTaskIds(String[] taskIds); + + /** + * 删除试卷任务信息 + * + * @param taskId 试卷任务主键 + * @return 结果 + */ + public int deleteEducationPaperTaskByTaskId(String taskId); + + List getSpecialityList(); + + List getCourseList(); + + List getKeywords(); + + + List getPoints(String name); + + Integer getQuCount(SchemeParam param); + + void submitSelection(TempDto tempDto); + + boolean changeStatus(String taskId, String status); + +} + diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/question/ExamQuestionServiceImpl.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/question/ExamQuestionServiceImpl.java new file mode 100644 index 00000000..2282a126 --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/question/ExamQuestionServiceImpl.java @@ -0,0 +1,334 @@ +package pc.exam.pp.module.exam.service.question; + +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.question.dto.ExamQuestionDto; +import pc.exam.pp.module.exam.controller.admin.question.vo.QuestionVo; +import pc.exam.pp.module.exam.dal.dataobject.*; +import pc.exam.pp.module.exam.dal.mysql.question.*; +import pc.exam.pp.module.exam.utils.date.DateUtils; +import pc.exam.pp.module.exam.utils.rabbitmq.RabbitmqUtils; +import pc.exam.pp.module.exam.utils.uuid.IdUtils; + +import java.util.List; + +/** + * 试题(hyc)Service业务层处理 + * + * @author pengchen + * @date 2025-03-13 + */ +@Service +public class ExamQuestionServiceImpl implements IExamQuestionService +{ +// @Autowired +// private ExamBankMapper examBankMapper; + @Autowired + private ExamQuestionMapper examQuestionMapper; + @Autowired + private ExamQuestionAnswerMapper examQuestionAnswerMapper; + @Autowired + private SysFileMapper sysFileMapper; + @Autowired + private ExamQuestionScoreMapper examQuestionScoreMapper; + @Autowired + private ExamQuestionKeywordMapper examQuestionKeywordMapper; + @Autowired + private RabbitmqUtils rabbitMqService; + /** + * 查询试题(hyc) + * + * @param quId 试题(hyc)主键 + * @return 试题(hyc) + */ + @Override + public ExamQuestion selectExamQuestionByQuId(String quId) + { + //查找试题答案 + List examQuestionAnswers = examQuestionAnswerMapper.selectExamQuestionAnswerByQuId(quId); + //查找试题文件 + List sysFileUploads =sysFileMapper.selectSysFileByQuid(quId); + //查找试题判分 + ExamQuestionScore examQuestionScore =examQuestionScoreMapper.selectExamQuestionScoreByQuId(quId); + //获取试题关键字 + List examQuestionKeywords = examQuestionKeywordMapper.selectExamQuestionKeywordByQuId(quId); + + ExamQuestion examQuestion = examQuestionMapper.selectExamQuestionByQuId(quId); + if (examQuestionAnswers!=null&&examQuestionAnswers.size()>0){ + examQuestion.setAnswerList(examQuestionAnswers); + } + if (sysFileUploads!=null&&sysFileUploads.size()>0){ + examQuestion.setFileUploads(sysFileUploads); + } + if (examQuestionScore!=null){ + examQuestion.setQuestionScores(examQuestionScore); + } + if (examQuestionKeywords!=null&&examQuestionKeywords.size()>0){ + examQuestion.setQuestionKeywords(examQuestionKeywords); + } + return examQuestion; + } + + /** + * 查询试题(hyc)列表 + * + * @param examQuestionDto 试题(hyc) + * @return 试题(hyc) + */ + + /** + * 新增试题(hyc) + * + * @param examQuestion 试题(hyc) + * @return 结果 + */ + @Override + public int insertExamQuestion(ExamQuestion examQuestion) + { + //更新题库的试题数 +// if (examQuestion.getQuBankId()!=null){ +// UpdateQuCountNow(examQuestion.getQuBankId()); +// } + + String uuid = IdUtils.simpleUUID(); + examQuestion.setQuId(uuid); + examQuestion.setCreateTime(DateUtils.getNowLocalDateTime()); + List answerList = examQuestion.getAnswerList(); + List fileUploads = examQuestion.getFileUploads(); + ExamQuestionScore questionScore = examQuestion.getQuestionScores(); + List examQuestionKeywords = examQuestion.getQuestionKeywords(); + if (answerList!=null&&answerList.size()>0){ + answerList.replaceAll(answer -> { + answer.setAnswerId(IdUtils.simpleUUID()); + answer.setQuId(uuid); + return answer; + }); + //examQuestionAnswerMapper.insert(answerList); + examQuestionAnswerMapper.insertExamQuestionAnswerList(answerList); + } + + if (fileUploads!=null&&fileUploads.size()>0){ + fileUploads.replaceAll(fileUpload -> { + fileUpload.setFileId(IdUtils.simpleUUID()); + fileUpload.setQuId(uuid); + return fileUpload; + }); + sysFileMapper.insertSysFileList(fileUploads); + + } + + if (questionScore!=null){ + questionScore.setScoreId(IdUtils.simpleUUID()); + questionScore.setQuId(uuid); + examQuestionScoreMapper.insertExamQuestionScore(questionScore); + } + if (examQuestionKeywords!=null&&examQuestionKeywords.size()>0){ + examQuestionKeywords.replaceAll(examQuestionKeyword -> { + examQuestionKeyword.setKeywordId(IdUtils.simpleUUID()); + examQuestionKeyword.setQuId(uuid); + return examQuestionKeyword; + }); + examQuestionKeywordMapper.insertExamQuestionKeywordList(examQuestionKeywords); + } + // return examQuestionMapper.insert(examQuestion); + return examQuestionMapper.insertExamQuestion(examQuestion); + } + + /** + * 修改试题(hyc) + * + * @param examQuestion 试题(hyc) + * @return 结果 + */ + @Override + public int updateExamQuestion(ExamQuestion examQuestion) + { + //获取试题id +// String quId = examQuestion.getQuId(); +// ExamQuestion examQuestion1 = examQuestionMapper.selectExamQuestionByQuId(quId); +// String quBankId = examQuestion1.getQuBankId(); +// //现在题有题库归属 +// if (examQuestion.getQuBankId() != null && !examQuestion.getQuBankId().equals("")) { +// //原来试题有题库归属 +// if (quBankId!=null&& !quBankId.equals("")){ +// //代表没改动题库 +// if (quBankId.equals(examQuestion.getQuBankId())){ +// +// } +// //改动题库 +// else { +// UpdateQuCount(quBankId); +// UpdateQuCountNow(examQuestion.getQuBankId()); +// } +// } +// //原来试题没题库归属 +// else { +// UpdateQuCountNow(examQuestion.getQuBankId()); +// } +// } +// //现在题没题库归属 +// else { +// //原来试题有题库归属 +// if (quBankId!=null&& !quBankId.equals("")){ +// UpdateQuCount(quBankId); +// } +// } + + + + + List answerList = examQuestion.getAnswerList(); + List fileUploads = examQuestion.getFileUploads(); + ExamQuestionScore questionScore = examQuestion.getQuestionScores(); + List examQuestionKeywords = examQuestion.getQuestionKeywords(); + if (answerList!=null&&answerList.size()>0){ + // 获取集合中第一个元素的quId + String firstQuId = answerList.get(0).getQuId(); + //先删除试题的答案 + examQuestionAnswerMapper.deleteExamQuestionAnswerByQuesId(firstQuId); + //赋值 + answerList.replaceAll(answer -> { + answer.setAnswerId(IdUtils.simpleUUID()); + answer.setQuId(firstQuId); + return answer; + }); + //插入试题答案 + examQuestionAnswerMapper.insertExamQuestionAnswerList(answerList); + + } + if (fileUploads!=null&&fileUploads.size()>0){ + // 获取集合中第一个元素的quId + String firstQuId = fileUploads.get(0).getQuId(); + //先删除试题的答案 + sysFileMapper.deleteSysFileByQuesId(firstQuId); + //赋值 + fileUploads.replaceAll(fileUpload -> { + fileUpload.setFileId(IdUtils.simpleUUID()); + fileUpload.setQuId(firstQuId); + return fileUpload; + }); + //插入试题答案 + sysFileMapper.insertSysFileList(fileUploads); + + } + if (questionScore!=null){ + String firstQuId = questionScore.getQuId(); + //先删除试题的判分 + examQuestionScoreMapper.deleteExamQuestionScoreByQuesId(firstQuId); + //赋值 + questionScore.setScoreId(IdUtils.simpleUUID()); + questionScore.setQuId(firstQuId); + examQuestionScoreMapper.insertExamQuestionScore(questionScore); + } + if (examQuestionKeywords!=null&&examQuestionKeywords.size()>0){ + String firstQuId = questionScore.getQuId(); + //先删除试题的判分 + examQuestionKeywordMapper.deleteExamQuestionScoreByQuesId(firstQuId); + //赋值 + examQuestionKeywords.replaceAll(examQuestionKeyword -> { + examQuestionKeyword.setKeywordId(IdUtils.simpleUUID()); + examQuestionKeyword.setQuId(firstQuId); + return examQuestionKeyword; + }); + examQuestionKeywordMapper.insertExamQuestionKeywordList(examQuestionKeywords); + } + examQuestion.setUpdateTime(DateUtils.getNowLocalDateTime()); + return examQuestionMapper.updateExamQuestion(examQuestion); + } + +// private void UpdateQuCount(String quBankId) { +// //获得原来题库 +// ExamBank examBank = examBankMapper.selectExamBankByQuBankId(quBankId); +// String quCount = examBank.getQuCount(); +// int quCountInt = Integer.parseInt(quCount); +// quCountInt--; // quCount减1 +// // 更新examBank中的quCount +// examBank.setQuCount(String.valueOf(quCountInt)); +// // 更新数据库中的examBank记录 +// examBankMapper.updateExamBank(examBank); +// +// } + +// private void UpdateQuCountNow(String quBankId) { +// //获得现在题库 +// ExamBank examBankNow = examBankMapper.selectExamBankByQuBankId(quBankId); +// String quCountNow = examBankNow.getQuCount(); +// int quCountIntNow = Integer.parseInt(quCountNow); +// quCountIntNow++; // quCount加1 +// // 更新examBankNow中的quCount +// examBankNow.setQuCount(String.valueOf(quCountIntNow)); +// // 更新数据库中的examBank记录 +// examBankMapper.updateExamBank(examBankNow); +// } + + /** + * 批量删除试题(hyc) + * + * @param ids 需要删除的试题(hyc)主键 + * @return 结果 + */ + @Override + public int deleteExamQuestionByQuIds(String[] ids) + { + if (ids != null && ids.length > 0) { + //删除试题答案 + examQuestionAnswerMapper.deleteExamQuestionAnswerByQuesIds(ids); + //删除试题文件 + sysFileMapper.deleteSysFileByQuesIds(ids); + //删除试题的判分 + examQuestionScoreMapper.deleteExamQuestionScoreByQuesIds(ids); + //删除试题关键字 + examQuestionKeywordMapper.deleteExamQuestionScoreByQuesIds(ids); + } + return examQuestionMapper.deleteExamQuestionByQuIds(ids); + } + + /** + * 删除试题(hyc)信息 + * + * @param quId 试题(hyc)主键 + * @return 结果 + */ + @Override + public int deleteExamQuestionByQuId(String quId) + { + return examQuestionMapper.deleteExamQuestionByQuId(quId); + } + + + + @Override + public PageResult selectExamQuestionList(QuestionVo questionVo) { + return examQuestionMapper.selectExamQuestionList(questionVo); + + } + + /** + * 上传试题至Rabbitmq + * @param quId 试题内容 ID + * @param QUEUE_NAME 客户端ID + * @return 结果 + */ + @Override + public String uploadExamQuestionToRabbitMQ(String quId, String QUEUE_NAME) { + + // 根据试题ID查找试题详情 + ExamQuestion examQuestion_obj = selectExamQuestionByQuId(quId); + + // TODO 缺失逻辑 + + return rabbitMqService.sendMessage(QUEUE_NAME, examQuestion_obj); + } + + /** + * 拉取数据Rabbitmq + * @param QUEUE_NAME 客户端ID + * @return 试题内容 + */ + @Override + public List getExamQuestionToRabbitMQ(String QUEUE_NAME) { + // TODO 1、拉取数据,保存至数据库 2、回调服务器是否拉取成功(中心服务器) + return rabbitMqService.receiveAllMessages(QUEUE_NAME); + } +} diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/question/IExamQuestionService.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/question/IExamQuestionService.java new file mode 100644 index 00000000..8561155a --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/question/IExamQuestionService.java @@ -0,0 +1,82 @@ +package pc.exam.pp.module.exam.service.question; + +import pc.exam.pp.framework.common.pojo.PageResult; +import pc.exam.pp.module.exam.controller.admin.question.dto.ExamQuestionDto; +import pc.exam.pp.module.exam.controller.admin.question.vo.QuestionVo; +import pc.exam.pp.module.exam.dal.dataobject.EducationPaperTask; +import pc.exam.pp.module.exam.dal.dataobject.ExamQuestion; + +import java.util.List; + +/** + * 试题(hyc)Service接口 + * + * @author pengchen + * @date 2025-03-13 + */ +public interface IExamQuestionService +{ + /** + * 查询试题(hyc) + * + * @param quId 试题(hyc)主键 + * @return 试题(hyc) + */ + public ExamQuestion selectExamQuestionByQuId(String quId); + + /** + * 查询试题(hyc)列表 + * + * @param examQuestionDto 试题(hyc) + * @return 试题(hyc)集合 + */ + + /** + * 新增试题(hyc) + * + * @param examQuestion 试题(hyc) + * @return 结果 + */ + public int insertExamQuestion(ExamQuestion examQuestion); + + /** + * 修改试题(hyc) + * + * @param examQuestion 试题(hyc) + * @return 结果 + */ + public int updateExamQuestion(ExamQuestion examQuestion); + + /** + * 批量删除试题(hyc) + * + * @param ids 需要删除的试题(hyc)主键集合 + * @return 结果 + */ + public int deleteExamQuestionByQuIds(String[] ids); + + /** + * 删除试题(hyc)信息 + * + * @param quId 试题(hyc)主键 + * @return 结果 + */ + public int deleteExamQuestionByQuId(String quId); + + PageResult selectExamQuestionList(QuestionVo questionVo); + + /** + * 上传试题至Rabbitmq + * @param quId 试题内容 ID + * @param QUEUE_NAME 客户端ID + * @return 结果 + */ + public String uploadExamQuestionToRabbitMQ(String quId, String QUEUE_NAME); + + /** + * 拉取Rabbitmq内容 + * @param QUEUE_NAME 客户端ID + * @return 结果 + */ + public List getExamQuestionToRabbitMQ(String QUEUE_NAME); +} diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/utils/date/DateUtils.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/utils/date/DateUtils.java new file mode 100644 index 00000000..4647d2ac --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/utils/date/DateUtils.java @@ -0,0 +1,192 @@ +package pc.exam.pp.module.exam.utils.date; + +import org.apache.commons.lang3.time.DateFormatUtils; + +import java.lang.management.ManagementFactory; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.time.*; +import java.util.Date; + +/** + * 时间工具类 + * + * @author pengchen + */ +public class DateUtils extends org.apache.commons.lang3.time.DateUtils +{ + public static String YYYY = "yyyy"; + + public static String YYYY_MM = "yyyy-MM"; + + public static String YYYY_MM_DD = "yyyy-MM-dd"; + + public static String YYYYMMDDHHMMSS = "yyyyMMddHHmmss"; + + public static String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss"; + + private static String[] parsePatterns = { + "yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy-MM", + "yyyy/MM/dd", "yyyy/MM/dd HH:mm:ss", "yyyy/MM/dd HH:mm", "yyyy/MM", + "yyyy.MM.dd", "yyyy.MM.dd HH:mm:ss", "yyyy.MM.dd HH:mm", "yyyy.MM"}; + + /** + * 获取当前 LocalDateTime 型日期时间 + */ + public static LocalDateTime getNowLocalDateTime () { + return LocalDateTime.now(); + } + + /** + * 获取当前 Date 型日期 + */ + public static Date getNowDate() { + return new Date(); + } + + /** + * 获取当前日期, 默认格式为yyyy-MM-dd + * + * @return String + */ + public static String getDate() + { + return dateTimeNow(YYYY_MM_DD); + } + + public static final String getTime() + { + return dateTimeNow(YYYY_MM_DD_HH_MM_SS); + } + + public static final String dateTimeNow() + { + return dateTimeNow(YYYYMMDDHHMMSS); + } + + public static final String dateTimeNow(final String format) + { + return parseDateToStr(format, new Date()); + } + + public static final String dateTime(final Date date) + { + return parseDateToStr(YYYY_MM_DD, date); + } + + public static final String parseDateToStr(final String format, final Date date) + { + return new SimpleDateFormat(format).format(date); + } + + public static final Date dateTime(final String format, final String ts) + { + try + { + return new SimpleDateFormat(format).parse(ts); + } + catch (ParseException e) + { + throw new RuntimeException(e); + } + } + + /** + * 日期路径 即年/月/日 如2018/08/08 + */ + public static final String datePath() + { + Date now = new Date(); + return DateFormatUtils.format(now, "yyyy/MM/dd"); + } + + /** + * 日期路径 即年/月/日 如20180808 + */ + public static final String dateTime() + { + Date now = new Date(); + return DateFormatUtils.format(now, "yyyyMMdd"); + } + + /** + * 日期型字符串转化为日期 格式 + */ + public static Date parseDate(Object str) + { + if (str == null) + { + return null; + } + try + { + return parseDate(str.toString(), parsePatterns); + } + catch (ParseException e) + { + return null; + } + } + + /** + * 获取服务器启动时间 + */ + public static Date getServerStartDate() + { + long time = ManagementFactory.getRuntimeMXBean().getStartTime(); + return new Date(time); + } + + /** + * 计算相差天数 + */ + public static int differentDaysByMillisecond(Date date1, Date date2) + { + return Math.abs((int) ((date2.getTime() - date1.getTime()) / (1000 * 3600 * 24))); + } + + /** + * 计算时间差 + * + * @param endDate 最后时间 + * @param startTime 开始时间 + * @return 时间差(天/小时/分钟) + */ + public static String timeDistance(Date endDate, Date startTime) + { + long nd = 1000 * 24 * 60 * 60; + long nh = 1000 * 60 * 60; + long nm = 1000 * 60; + // long ns = 1000; + // 获得两个时间的毫秒时间差异 + long diff = endDate.getTime() - startTime.getTime(); + // 计算差多少天 + long day = diff / nd; + // 计算差多少小时 + long hour = diff % nd / nh; + // 计算差多少分钟 + long min = diff % nd % nh / nm; + // 计算差多少秒//输出结果 + // long sec = diff % nd % nh % nm / ns; + return day + "天" + hour + "小时" + min + "分钟"; + } + + /** + * 增加 LocalDateTime ==> Date + */ + public static Date toDate(LocalDateTime temporalAccessor) + { + ZonedDateTime zdt = temporalAccessor.atZone(ZoneId.systemDefault()); + return Date.from(zdt.toInstant()); + } + + /** + * 增加 LocalDate ==> Date + */ + public static Date toDate(LocalDate temporalAccessor) + { + LocalDateTime localDateTime = LocalDateTime.of(temporalAccessor, LocalTime.of(0, 0, 0)); + ZonedDateTime zdt = localDateTime.atZone(ZoneId.systemDefault()); + return Date.from(zdt.toInstant()); + } +} diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/utils/file/FileTypeUtils.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/utils/file/FileTypeUtils.java new file mode 100644 index 00000000..2d84c4f5 --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/utils/file/FileTypeUtils.java @@ -0,0 +1,76 @@ +package pc.exam.pp.module.exam.utils.file; + +import java.io.File; +import org.apache.commons.lang3.StringUtils; + +/** + * 文件类型工具类 + * + * @author pengchen + */ +public class FileTypeUtils +{ + /** + * 获取文件类型 + *

+ * 例如: pengchen.txt, 返回: txt + * + * @param file 文件名 + * @return 后缀(不含".") + */ + public static String getFileType(File file) + { + if (null == file) + { + return StringUtils.EMPTY; + } + return getFileType(file.getName()); + } + + /** + * 获取文件类型 + *

+ * 例如: pengchen.txt, 返回: txt + * + * @param fileName 文件名 + * @return 后缀(不含".") + */ + public static String getFileType(String fileName) + { + int separatorIndex = fileName.lastIndexOf("."); + if (separatorIndex < 0) + { + return ""; + } + return fileName.substring(separatorIndex + 1).toLowerCase(); + } + + /** + * 获取文件类型 + * + * @param photoByte 文件字节码 + * @return 后缀(不含".") + */ + public static String getFileExtendName(byte[] photoByte) + { + String strFileExtendName = "JPG"; + if ((photoByte[0] == 71) && (photoByte[1] == 73) && (photoByte[2] == 70) && (photoByte[3] == 56) + && ((photoByte[4] == 55) || (photoByte[4] == 57)) && (photoByte[5] == 97)) + { + strFileExtendName = "GIF"; + } + else if ((photoByte[6] == 74) && (photoByte[7] == 70) && (photoByte[8] == 73) && (photoByte[9] == 70)) + { + strFileExtendName = "JPG"; + } + else if ((photoByte[0] == 66) && (photoByte[1] == 77)) + { + strFileExtendName = "BMP"; + } + else if ((photoByte[1] == 80) && (photoByte[2] == 78) && (photoByte[3] == 71)) + { + strFileExtendName = "PNG"; + } + return strFileExtendName; + } +} \ No newline at end of file diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/utils/file/LogFileUtils.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/utils/file/LogFileUtils.java new file mode 100644 index 00000000..c4b0833b --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/utils/file/LogFileUtils.java @@ -0,0 +1,73 @@ +package pc.exam.pp.module.exam.utils.file; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; + +public class LogFileUtils { + + private static BufferedWriter writer; + private static final Logger log = LoggerFactory.getLogger(LogFileUtils.class); + // 日期时间格式化器(比如 2025-03-24 15:32:10) + private static final DateTimeFormatter formatter = + DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); + + /** + * 创建txt文件 + * @param path 路径 + */ + public static void createFile(String path) { + try { + File file = new File(path); + if (!file.exists()) { + file.getParentFile().mkdirs(); // 创建父目录 + file.createNewFile(); + } + writer = new BufferedWriter(new FileWriter(file, true)); // 追加写入模式 + } catch (IOException e) { + log.error(e.getMessage()); + throw new RuntimeException("无法创建日志文件: " + e.getMessage()); + } + } + + + /** + * 写入文本,自动换行 + * @param content 写入的文本 + */ + public static void writeLine(String content) { + if (writer == null) { + throw new IllegalStateException("请先调用 create() 方法初始化文件"); + } + + try { + String timestamp = LocalDateTime.now().format(formatter); + String logLine = String.format("[%s] %s", timestamp, content); + + writer.write(logLine); + writer.newLine(); + writer.flush(); + } catch (IOException e) { + e.printStackTrace(); + } + } + + /** + * 关闭文件 + */ + public static void close() { + if (writer != null) { + try { + writer.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } +} diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/utils/file/MimeTypeUtils.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/utils/file/MimeTypeUtils.java new file mode 100644 index 00000000..ce727067 --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/utils/file/MimeTypeUtils.java @@ -0,0 +1,59 @@ +package pc.exam.pp.module.exam.utils.file; + +/** + * 媒体类型工具类 + * + * @author pengchen + */ +public class MimeTypeUtils +{ + public static final String IMAGE_PNG = "image/png"; + + public static final String IMAGE_JPG = "image/jpg"; + + public static final String IMAGE_JPEG = "image/jpeg"; + + public static final String IMAGE_BMP = "image/bmp"; + + public static final String IMAGE_GIF = "image/gif"; + + public static final String[] IMAGE_EXTENSION = { "bmp", "gif", "jpg", "jpeg", "png" }; + + public static final String[] FLASH_EXTENSION = { "swf", "flv" }; + + public static final String[] MEDIA_EXTENSION = { "swf", "flv", "mp3", "wav", "wma", "wmv", "mid", "avi", "mpg", + "asf", "rm", "rmvb" }; + + public static final String[] VIDEO_EXTENSION = { "mp4", "avi", "rmvb" }; + + public static final String[] DEFAULT_ALLOWED_EXTENSION = { + // 图片 + "bmp", "gif", "jpg", "jpeg", "png", + // word excel powerpoint + "doc", "docx", "xls", "xlsx", "ppt", "pptx", "html", "htm", "txt", + // 压缩文件 + "rar", "zip", "gz", "bz2", + // 视频格式 + "mp4", "avi", "rmvb", + // pdf + "pdf" }; + + public static String getExtension(String prefix) + { + switch (prefix) + { + case IMAGE_PNG: + return "png"; + case IMAGE_JPG: + return "jpg"; + case IMAGE_JPEG: + return "jpeg"; + case IMAGE_BMP: + return "bmp"; + case IMAGE_GIF: + return "gif"; + default: + return ""; + } + } +} diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/utils/json/JsonUtil.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/utils/json/JsonUtil.java new file mode 100644 index 00000000..5b091151 --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/utils/json/JsonUtil.java @@ -0,0 +1,27 @@ +package pc.exam.pp.module.exam.utils.json; + +import com.fasterxml.jackson.databind.ObjectMapper; + +public class JsonUtil { + private static final ObjectMapper objectMapper = new ObjectMapper(); + + public static byte[] toJson(Object obj) { + try { + return objectMapper.writeValueAsString(obj).getBytes(); + } catch (Exception e) { + throw new RuntimeException("JSON 序列化失败", e); + } + } + + public static T fromJson(byte[] jsonBytes, Class clazz) { + if (jsonBytes == null || jsonBytes.length == 0) { + throw new IllegalArgumentException("JSON字节数组不能为空"); + } + + try { + return objectMapper.readValue(jsonBytes, clazz); + } catch (Exception e) { + throw new RuntimeException("JSON反序列化失败: " + e.getMessage(), e); + } + } +} diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/utils/rabbitmq/RabbitmqUtils.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/utils/rabbitmq/RabbitmqUtils.java new file mode 100644 index 00000000..8b75ed74 --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/utils/rabbitmq/RabbitmqUtils.java @@ -0,0 +1,143 @@ +package pc.exam.pp.module.exam.utils.rabbitmq; + + +import com.rabbitmq.client.Channel; +import com.rabbitmq.client.Connection; +import com.rabbitmq.client.ConnectionFactory; +import com.rabbitmq.client.GetResponse; +import org.springframework.stereotype.Service; + + +import pc.exam.pp.framework.common.util.json.JsonUtils; +import pc.exam.pp.module.exam.dal.dataobject.ExamQuestion; +import pc.exam.pp.module.exam.utils.json.JsonUtil ; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + + +/** + * rabbitmq 工具 + * QUEUE_NAME dept_id + "_Queue" + */ +@Service +public class RabbitmqUtils { + + // RabbitMQ 连接和通道 + private Connection connection; + private Channel channel; + + private final rabbitmq rabbitProps; + + public RabbitmqUtils(rabbitmq rabbitProps) { + this.rabbitProps = rabbitProps; + } + + + /** + * 判断是否已经连接 RabbitMQ + */ + public boolean isConnected() { + return connection != null && connection.isOpen() && channel != null && channel.isOpen(); + } + + /** + * + * @param QUEUE_NAME 客户端对应队列 + * @param deptName 客户端名称 + * @return 客户端连接状态 + */ + public String connect(String QUEUE_NAME, String deptName) { + if (isConnected()) { + return "已经连接"; + } + + ConnectionFactory factory = new ConnectionFactory(); + factory.setHost(rabbitProps.getHost()); + factory.setPort(rabbitProps.getPort()); + factory.setUsername(rabbitProps.getUsername()); + factory.setPassword(rabbitProps.getPassword()); + factory.setVirtualHost(rabbitProps.getVirtualHost()); + + try { + // 创建连接和通道 + connection = factory.newConnection(); + channel = connection.createChannel(); + // 声明一个队列,如果已经存在就不会重复创建 + channel.queueDeclare(QUEUE_NAME, true, false, false, null); + return deptName + "_连接成功"; + } catch (Exception e) { + e.printStackTrace(); + return deptName + "_连接失败: " + e.getMessage(); + } + } + + /** + * 向队列中发送一条消息 + */ + + public String sendMessage(String QUEUE_NAME, ExamQuestion message) { + try { + if (!isConnected()) return "未连接"; + // 发送消息到默认交换机,绑定到队列 + channel.basicPublish("", QUEUE_NAME, null, JsonUtil.toJson(message)); + return "消息发送成功:" + QUEUE_NAME; + } catch (IOException e) { + e.printStackTrace(); + return "发送失败: " + e.getMessage(); + } + } + + /** + * 只接收一条消息(点击一次,拉取一次) + * @param QUEUE_NAME 客户端对应队列 + * @return 消息 + */ + public String receiveMessageOnce(String QUEUE_NAME) { + try { + if (!isConnected()) return "未连接"; + // 拉取一条消息(非阻塞),自动确认 + GetResponse response = channel.basicGet(QUEUE_NAME, true); + if (response != null) { + return new String(response.getBody()); + } else { + return "没有消息可接收"; + } + } catch (IOException e) { + e.printStackTrace(); + return "接收失败: " + e.getMessage(); + } + } + + /** + * 一次性拉取所有消息(直到队列为空) + */ + public List receiveAllMessages(String QUEUE_NAME) { + List messages = new ArrayList<>(); + try { + if (!isConnected()) return messages; + + GetResponse response; + // 循环拉取,直到没有消息为止 + while ((response = channel.basicGet(QUEUE_NAME, true)) != null) { + messages.add(JsonUtil.fromJson(response.getBody(), ExamQuestion.class)); + } + } catch (IOException e) { + e.printStackTrace(); + } + return messages; + } + + /** + * 断开连接 + */ + public void disconnect() { + try { + if (channel != null) channel.close(); + if (connection != null) connection.close(); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/utils/rabbitmq/rabbitmq.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/utils/rabbitmq/rabbitmq.java new file mode 100644 index 00000000..540b8a41 --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/utils/rabbitmq/rabbitmq.java @@ -0,0 +1,56 @@ +package pc.exam.pp.module.exam.utils.rabbitmq; + +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + +@Component +@ConfigurationProperties(prefix = "spring.rabbitmq") +public class rabbitmq { + + private String host; + private int port; + private String username; + private String password; + private String virtualHost; + + // 必须有 setter & getter 方法(IDE 可以自动生成) + public String getHost() { + return host; + } + + public void setHost(String host) { + this.host = host; + } + + public int getPort() { + return port; + } + + public void setPort(int port) { + this.port = port; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getVirtualHost() { + return virtualHost; + } + + public void setVirtualHost(String virtualHost) { + this.virtualHost = virtualHost; + } +} \ No newline at end of file diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/utils/uuid/IdUtils.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/utils/uuid/IdUtils.java new file mode 100644 index 00000000..bc504544 --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/utils/uuid/IdUtils.java @@ -0,0 +1,49 @@ +package pc.exam.pp.module.exam.utils.uuid; + +/** + * ID生成器工具类 + * + * @author pengchen + */ +public class IdUtils +{ + /** + * 获取随机UUID + * + * @return 随机UUID + */ + public static String randomUUID() + { + return UUID.randomUUID().toString(); + } + + /** + * 简化的UUID,去掉了横线 + * + * @return 简化的UUID,去掉了横线 + */ + public static String simpleUUID() + { + return UUID.randomUUID().toString(true); + } + + /** + * 获取随机UUID,使用性能更好的ThreadLocalRandom生成UUID + * + * @return 随机UUID + */ + public static String fastUUID() + { + return UUID.fastUUID().toString(); + } + + /** + * 简化的UUID,去掉了横线,使用性能更好的ThreadLocalRandom生成UUID + * + * @return 简化的UUID,去掉了横线 + */ + public static String fastSimpleUUID() + { + return UUID.fastUUID().toString(true); + } +} diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/utils/uuid/UUID.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/utils/uuid/UUID.java new file mode 100644 index 00000000..fce43933 --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/utils/uuid/UUID.java @@ -0,0 +1,485 @@ +package pc.exam.pp.module.exam.utils.uuid; + +import cn.hutool.core.exceptions.UtilException; + +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.security.SecureRandom; +import java.util.Random; +import java.util.concurrent.ThreadLocalRandom; + +/** + * 提供通用唯一识别码(universally unique identifier)(UUID)实现 + * + * @author pengchen + */ +public final class UUID implements java.io.Serializable, Comparable +{ + private static final long serialVersionUID = -1185015143654744140L; + + /** + * SecureRandom 的单例 + * + */ + private static class Holder + { + static final SecureRandom numberGenerator = getSecureRandom(); + } + + /** 此UUID的最高64有效位 */ + private final long mostSigBits; + + /** 此UUID的最低64有效位 */ + private final long leastSigBits; + + /** + * 私有构造 + * + * @param data 数据 + */ + private UUID(byte[] data) + { + long msb = 0; + long lsb = 0; + assert data.length == 16 : "data must be 16 bytes in length"; + for (int i = 0; i < 8; i++) + { + msb = (msb << 8) | (data[i] & 0xff); + } + for (int i = 8; i < 16; i++) + { + lsb = (lsb << 8) | (data[i] & 0xff); + } + this.mostSigBits = msb; + this.leastSigBits = lsb; + } + + /** + * 使用指定的数据构造新的 UUID。 + * + * @param mostSigBits 用于 {@code UUID} 的最高有效 64 位 + * @param leastSigBits 用于 {@code UUID} 的最低有效 64 位 + */ + public UUID(long mostSigBits, long leastSigBits) + { + this.mostSigBits = mostSigBits; + this.leastSigBits = leastSigBits; + } + + /** + * 获取类型 4(伪随机生成的)UUID 的静态工厂。 + * + * @return 随机生成的 {@code UUID} + */ + public static UUID fastUUID() + { + return randomUUID(false); + } + + /** + * 获取类型 4(伪随机生成的)UUID 的静态工厂。 使用加密的强伪随机数生成器生成该 UUID。 + * + * @return 随机生成的 {@code UUID} + */ + public static UUID randomUUID() + { + return randomUUID(true); + } + + /** + * 获取类型 4(伪随机生成的)UUID 的静态工厂。 使用加密的强伪随机数生成器生成该 UUID。 + * + * @param isSecure 是否使用{@link SecureRandom}如果是可以获得更安全的随机码,否则可以得到更好的性能 + * @return 随机生成的 {@code UUID} + */ + public static UUID randomUUID(boolean isSecure) + { + final Random ng = isSecure ? Holder.numberGenerator : getRandom(); + + byte[] randomBytes = new byte[16]; + ng.nextBytes(randomBytes); + randomBytes[6] &= 0x0f; /* clear version */ + randomBytes[6] |= 0x40; /* set to version 4 */ + randomBytes[8] &= 0x3f; /* clear variant */ + randomBytes[8] |= 0x80; /* set to IETF variant */ + return new UUID(randomBytes); + } + + /** + * 根据指定的字节数组获取类型 3(基于名称的)UUID 的静态工厂。 + * + * @param name 用于构造 UUID 的字节数组。 + * + * @return 根据指定数组生成的 {@code UUID} + */ + public static UUID nameUUIDFromBytes(byte[] name) + { + MessageDigest md; + try + { + md = MessageDigest.getInstance("MD5"); + } + catch (NoSuchAlgorithmException nsae) + { + throw new InternalError("MD5 not supported"); + } + byte[] md5Bytes = md.digest(name); + md5Bytes[6] &= 0x0f; /* clear version */ + md5Bytes[6] |= 0x30; /* set to version 3 */ + md5Bytes[8] &= 0x3f; /* clear variant */ + md5Bytes[8] |= 0x80; /* set to IETF variant */ + return new UUID(md5Bytes); + } + + /** + * 根据 {@link #toString()} 方法中描述的字符串标准表示形式创建{@code UUID}。 + * + * @param name 指定 {@code UUID} 字符串 + * @return 具有指定值的 {@code UUID} + * @throws IllegalArgumentException 如果 name 与 {@link #toString} 中描述的字符串表示形式不符抛出此异常 + * + */ + public static UUID fromString(String name) + { + String[] components = name.split("-"); + if (components.length != 5) + { + throw new IllegalArgumentException("Invalid UUID string: " + name); + } + for (int i = 0; i < 5; i++) + { + components[i] = "0x" + components[i]; + } + + long mostSigBits = Long.decode(components[0]).longValue(); + mostSigBits <<= 16; + mostSigBits |= Long.decode(components[1]).longValue(); + mostSigBits <<= 16; + mostSigBits |= Long.decode(components[2]).longValue(); + + long leastSigBits = Long.decode(components[3]).longValue(); + leastSigBits <<= 48; + leastSigBits |= Long.decode(components[4]).longValue(); + + return new UUID(mostSigBits, leastSigBits); + } + + /** + * 返回此 UUID 的 128 位值中的最低有效 64 位。 + * + * @return 此 UUID 的 128 位值中的最低有效 64 位。 + */ + public long getLeastSignificantBits() + { + return leastSigBits; + } + + /** + * 返回此 UUID 的 128 位值中的最高有效 64 位。 + * + * @return 此 UUID 的 128 位值中最高有效 64 位。 + */ + public long getMostSignificantBits() + { + return mostSigBits; + } + + /** + * 与此 {@code UUID} 相关联的版本号. 版本号描述此 {@code UUID} 是如何生成的。 + *

+ * 版本号具有以下含意: + *

    + *
  • 1 基于时间的 UUID + *
  • 2 DCE 安全 UUID + *
  • 3 基于名称的 UUID + *
  • 4 随机生成的 UUID + *
+ * + * @return 此 {@code UUID} 的版本号 + */ + public int version() + { + // Version is bits masked by 0x000000000000F000 in MS long + return (int) ((mostSigBits >> 12) & 0x0f); + } + + /** + * 与此 {@code UUID} 相关联的变体号。变体号描述 {@code UUID} 的布局。 + *

+ * 变体号具有以下含意: + *

    + *
  • 0 为 NCS 向后兼容保留 + *
  • 2 IETF RFC 4122(Leach-Salz), 用于此类 + *
  • 6 保留,微软向后兼容 + *
  • 7 保留供以后定义使用 + *
+ * + * @return 此 {@code UUID} 相关联的变体号 + */ + public int variant() + { + // This field is composed of a varying number of bits. + // 0 - - Reserved for NCS backward compatibility + // 1 0 - The IETF aka Leach-Salz variant (used by this class) + // 1 1 0 Reserved, Microsoft backward compatibility + // 1 1 1 Reserved for future definition. + return (int) ((leastSigBits >>> (64 - (leastSigBits >>> 62))) & (leastSigBits >> 63)); + } + + /** + * 与此 UUID 相关联的时间戳值。 + * + *

+ * 60 位的时间戳值根据此 {@code UUID} 的 time_low、time_mid 和 time_hi 字段构造。
+ * 所得到的时间戳以 100 毫微秒为单位,从 UTC(通用协调时间) 1582 年 10 月 15 日零时开始。 + * + *

+ * 时间戳值仅在在基于时间的 UUID(其 version 类型为 1)中才有意义。
+ * 如果此 {@code UUID} 不是基于时间的 UUID,则此方法抛出 UnsupportedOperationException。 + * + * @throws UnsupportedOperationException 如果此 {@code UUID} 不是 version 为 1 的 UUID。 + */ + public long timestamp() throws UnsupportedOperationException + { + checkTimeBase(); + return (mostSigBits & 0x0FFFL) << 48// + | ((mostSigBits >> 16) & 0x0FFFFL) << 32// + | mostSigBits >>> 32; + } + + /** + * 与此 UUID 相关联的时钟序列值。 + * + *

+ * 14 位的时钟序列值根据此 UUID 的 clock_seq 字段构造。clock_seq 字段用于保证在基于时间的 UUID 中的时间唯一性。 + *

+ * {@code clockSequence} 值仅在基于时间的 UUID(其 version 类型为 1)中才有意义。 如果此 UUID 不是基于时间的 UUID,则此方法抛出 + * UnsupportedOperationException。 + * + * @return 此 {@code UUID} 的时钟序列 + * + * @throws UnsupportedOperationException 如果此 UUID 的 version 不为 1 + */ + public int clockSequence() throws UnsupportedOperationException + { + checkTimeBase(); + return (int) ((leastSigBits & 0x3FFF000000000000L) >>> 48); + } + + /** + * 与此 UUID 相关的节点值。 + * + *

+ * 48 位的节点值根据此 UUID 的 node 字段构造。此字段旨在用于保存机器的 IEEE 802 地址,该地址用于生成此 UUID 以保证空间唯一性。 + *

+ * 节点值仅在基于时间的 UUID(其 version 类型为 1)中才有意义。
+ * 如果此 UUID 不是基于时间的 UUID,则此方法抛出 UnsupportedOperationException。 + * + * @return 此 {@code UUID} 的节点值 + * + * @throws UnsupportedOperationException 如果此 UUID 的 version 不为 1 + */ + public long node() throws UnsupportedOperationException + { + checkTimeBase(); + return leastSigBits & 0x0000FFFFFFFFFFFFL; + } + + /** + * 返回此{@code UUID} 的字符串表现形式。 + * + *

+ * UUID 的字符串表示形式由此 BNF 描述: + * + *

+     * {@code
+     * UUID                   = ----
+     * time_low               = 4*
+     * time_mid               = 2*
+     * time_high_and_version  = 2*
+     * variant_and_sequence   = 2*
+     * node                   = 6*
+     * hexOctet               = 
+     * hexDigit               = [0-9a-fA-F]
+     * }
+     * 
+ * + * + * + * @return 此{@code UUID} 的字符串表现形式 + * @see #toString(boolean) + */ + @Override + public String toString() + { + return toString(false); + } + + /** + * 返回此{@code UUID} 的字符串表现形式。 + * + *

+ * UUID 的字符串表示形式由此 BNF 描述: + * + *

+     * {@code
+     * UUID                   = ----
+     * time_low               = 4*
+     * time_mid               = 2*
+     * time_high_and_version  = 2*
+     * variant_and_sequence   = 2*
+     * node                   = 6*
+     * hexOctet               = 
+     * hexDigit               = [0-9a-fA-F]
+     * }
+     * 
+ * + * + * + * @param isSimple 是否简单模式,简单模式为不带'-'的UUID字符串 + * @return 此{@code UUID} 的字符串表现形式 + */ + public String toString(boolean isSimple) + { + final StringBuilder builder = new StringBuilder(isSimple ? 32 : 36); + // time_low + builder.append(digits(mostSigBits >> 32, 8)); + if (!isSimple) + { + builder.append('-'); + } + // time_mid + builder.append(digits(mostSigBits >> 16, 4)); + if (!isSimple) + { + builder.append('-'); + } + // time_high_and_version + builder.append(digits(mostSigBits, 4)); + if (!isSimple) + { + builder.append('-'); + } + // variant_and_sequence + builder.append(digits(leastSigBits >> 48, 4)); + if (!isSimple) + { + builder.append('-'); + } + // node + builder.append(digits(leastSigBits, 12)); + + return builder.toString(); + } + + /** + * 返回此 UUID 的哈希码。 + * + * @return UUID 的哈希码值。 + */ + @Override + public int hashCode() + { + long hilo = mostSigBits ^ leastSigBits; + return ((int) (hilo >> 32)) ^ (int) hilo; + } + + /** + * 将此对象与指定对象比较。 + *

+ * 当且仅当参数不为 {@code null}、而是一个 UUID 对象、具有与此 UUID 相同的 varriant、包含相同的值(每一位均相同)时,结果才为 {@code true}。 + * + * @param obj 要与之比较的对象 + * + * @return 如果对象相同,则返回 {@code true};否则返回 {@code false} + */ + @Override + public boolean equals(Object obj) + { + if ((null == obj) || (obj.getClass() != UUID.class)) + { + return false; + } + UUID id = (UUID) obj; + return (mostSigBits == id.mostSigBits && leastSigBits == id.leastSigBits); + } + + // Comparison Operations + + /** + * 将此 UUID 与指定的 UUID 比较。 + * + *

+ * 如果两个 UUID 不同,且第一个 UUID 的最高有效字段大于第二个 UUID 的对应字段,则第一个 UUID 大于第二个 UUID。 + * + * @param val 与此 UUID 比较的 UUID + * + * @return 在此 UUID 小于、等于或大于 val 时,分别返回 -1、0 或 1。 + * + */ + @Override + public int compareTo(UUID val) + { + // The ordering is intentionally set up so that the UUIDs + // can simply be numerically compared as two numbers + return (this.mostSigBits < val.mostSigBits ? -1 : // + (this.mostSigBits > val.mostSigBits ? 1 : // + (this.leastSigBits < val.leastSigBits ? -1 : // + (this.leastSigBits > val.leastSigBits ? 1 : // + 0)))); + } + + // ------------------------------------------------------------------------------------------------------------------- + // Private method start + /** + * 返回指定数字对应的hex值 + * + * @param val 值 + * @param digits 位 + * @return 值 + */ + private static String digits(long val, int digits) + { + long hi = 1L << (digits * 4); + return Long.toHexString(hi | (val & (hi - 1))).substring(1); + } + + /** + * 检查是否为time-based版本UUID + */ + private void checkTimeBase() + { + if (version() != 1) + { + throw new UnsupportedOperationException("Not a time-based UUID"); + } + } + + /** + * 获取{@link SecureRandom},类提供加密的强随机数生成器 (RNG) + * + * @return {@link SecureRandom} + */ + public static SecureRandom getSecureRandom() + { + try + { + return SecureRandom.getInstance("SHA1PRNG"); + } + catch (NoSuchAlgorithmException e) + { + throw new UtilException(e); + } + } + + /** + * 获取随机数生成器对象
+ * ThreadLocalRandom是JDK 7之后提供并发产生随机数,能够解决多个线程发生的竞争争夺。 + * + * @return {@link ThreadLocalRandom} + */ + public static ThreadLocalRandom getRandom() + { + return ThreadLocalRandom.current(); + } +} diff --git a/exam-module-exam/exam-module-exam-biz/src/main/resources/mapper/exam/EducationPaperMapper.xml b/exam-module-exam/exam-module-exam-biz/src/main/resources/mapper/exam/EducationPaperMapper.xml new file mode 100644 index 00000000..6e7c92a4 --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/resources/mapper/exam/EducationPaperMapper.xml @@ -0,0 +1,230 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select paper_id, task_id, counts, roll_up, is_ab, status ,create_time,update_time,creator,updater ,deleted from education_paper + + + + + + + + + + + + + + + + + + insert into education_paper + + paper_id, + task_id, + counts, + roll_up, + is_ab, + status, + create_time, + update_time, + creator, + updater, + deleted, + tenant_id, + + + #{paperId}, + #{taskId}, + #{counts}, + #{rollUp}, + #{isAb}, + #{status}, + #{createTime}, + #{updateTime}, + #{creator}, + #{updater}, + #{deleted}, + #{tenantId}, + + + + INSERT INTO education_paper (paper_id, task_id, counts, roll_up, is_ab, status ) VALUES + + ( + #{item.paperId}, #{item.taskId}, #{item.counts}, #{item.rollUp}, #{item.isAb}, #{item.status} + ) + + + + + update education_paper + + task_id = #{taskId}, + counts = #{counts}, + roll_up = #{rollUp}, + is_ab = #{isAb}, + status = #{status}, + create_time = #{createTime}, + update_time = #{updateTime}, + creator = #{creator}, + updater = #{updater}, + deleted = #{deleted}, + tenant_id = #{tenantId}, + + where paper_id = #{paperId} + + + + UPDATE education_paper + SET roll_up = '2', is_ab = null + WHERE paper_id IN + + #{paperId} + + + + UPDATE education_paper + SET roll_up = null, is_ab = null + WHERE paper_id IN + + #{paperId} + + + + UPDATE education_paper + SET roll_up = null, is_ab = null + where task_id=#{taskId} and roll_up ='1' + + + UPDATE education_paper + SET roll_up = '3', is_ab = null + WHERE paper_id IN + + #{paperId} + + + + UPDATE education_paper + SET status = #{status} + where paper_id =#{paperId} + + + + + delete from education_paper where paper_id = #{paperId} + + + + UPDATE education_paper SET deleted = '2' + WHERE paper_id IN + + #{taskId} + + + + + + + + + \ No newline at end of file diff --git a/exam-module-exam/exam-module-exam-biz/src/main/resources/mapper/exam/EducationPaperParamMapper.xml b/exam-module-exam/exam-module-exam-biz/src/main/resources/mapper/exam/EducationPaperParamMapper.xml new file mode 100644 index 00000000..7898d8b6 --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/resources/mapper/exam/EducationPaperParamMapper.xml @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + 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 + + + + + + + + + insert into education_paper_param + + 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, + + + + #{paramId}, + #{taskId}, + #{isExamPassword}, + #{examPassword}, + #{usb}, + #{saveGrades}, + #{driver}, + #{directory}, + #{uploadTime}, + #{isDel}, + #{isRepeat}, + #{isAnswer}, + #{isLook}, + #{isConnect}, + + + + + + + update education_paper_param + + task_id = #{taskId}, + is_exam_password = #{isExamPassword}, + exam_password = #{examPassword}, + usb = #{usb}, + save_grades = #{saveGrades}, + driver = #{driver}, + directory = #{directory}, + upload_time = #{uploadTime}, + is_del = #{isDel}, + is_repeat = #{isRepeat}, + is_answer = #{isAnswer}, + is_look = #{isLook}, + is_connect = #{isConnect}, + + + + where param_id = #{paramId} + + + + delete from education_paper_param where param_id = #{paramId} + + + + delete from education_paper_param where param_id in + + #{paramId} + + + \ No newline at end of file diff --git a/exam-module-exam/exam-module-exam-biz/src/main/resources/mapper/exam/EducationPaperPersonMapper.xml b/exam-module-exam/exam-module-exam-biz/src/main/resources/mapper/exam/EducationPaperPersonMapper.xml new file mode 100644 index 00000000..12d94c3b --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/resources/mapper/exam/EducationPaperPersonMapper.xml @@ -0,0 +1,64 @@ + + + + + + + + + + + + select task_id, person_id, session_id from education_paper_person + + + + + + + + insert into education_paper_person + + task_id, + person_id, + session_id, + + + #{taskId}, + #{personId}, + #{sessionId}, + + + + + update education_paper_person + + person_id = #{personId}, + session_id = #{sessionId}, + + where task_id = #{taskId} + + + + delete from education_paper_person where task_id = #{taskId} + + + + delete from education_paper_person where task_id in + + #{taskId} + + + \ No newline at end of file diff --git a/exam-module-exam/exam-module-exam-biz/src/main/resources/mapper/exam/EducationPaperQuMapper.xml b/exam-module-exam/exam-module-exam-biz/src/main/resources/mapper/exam/EducationPaperQuMapper.xml new file mode 100644 index 00000000..9a1e7cf5 --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/resources/mapper/exam/EducationPaperQuMapper.xml @@ -0,0 +1,80 @@ + + + + + + + + + + + + select paper_id, qu_id, qu_version from education_paper_qu + + + + + + + + + + + insert into education_paper_qu + + paper_id, + qu_id, + qu_version, + + + #{paperId}, + #{quId}, + #{quVersion}, + + + + INSERT INTO education_paper_qu (paper_id ,qu_id )VALUES + + ( + #{item.paperId}, #{item.quId} + ) + + + + + update education_paper_qu + + qu_id = #{quId}, + qu_version = #{quVersion}, + + where paper_id = #{paperId} + + + + delete from education_paper_qu where paper_id = #{paperId} + + + + delete from education_paper_qu where paper_id in + + #{paperId} + + + \ No newline at end of file diff --git a/exam-module-exam/exam-module-exam-biz/src/main/resources/mapper/exam/EducationPaperSchemeMapper.xml b/exam-module-exam/exam-module-exam-biz/src/main/resources/mapper/exam/EducationPaperSchemeMapper.xml new file mode 100644 index 00000000..d0c05663 --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/resources/mapper/exam/EducationPaperSchemeMapper.xml @@ -0,0 +1,104 @@ + + + + + + + + + + + + + + + + + + select scheme_id, task_id, sp_name, qu_level, keywords, point_names, qu_numbers, qu_scores, subtotal_score from education_paper_scheme + + + + + + + + + insert into education_paper_scheme + + scheme_id, + task_id, + sp_name, + qu_level, + keywords, + point_names, + qu_numbers, + qu_scores, + subtotal_score, + + + #{schemeId}, + #{taskId}, + #{spName}, + #{quLevel}, + #{keywords}, + #{pointNames}, + #{quNumbers}, + #{quScores}, + #{subtotalScore}, + + + + INSERT INTO education_paper_scheme (scheme_id, task_id, sp_name, qu_level, keywords, point_names, qu_numbers, qu_scores, subtotal_score) VALUES + + ( + #{item.schemeId}, #{item.taskId}, #{item.spName}, #{item.quLevel}, #{item.keywords}, #{item.pointNames}, #{item.quNumbers}, #{item.quScores}, #{item.subtotalScore} + ) + + + + + update education_paper_scheme + + task_id = #{taskId}, + sp_name = #{spName}, + qu_level = #{quLevel}, + keywords = #{keywords}, + point_names = #{pointNames}, + qu_numbers = #{quNumbers}, + qu_scores = #{quScores}, + subtotal_score = #{subtotalScore}, + + where scheme_id = #{schemeId} + + + + delete from education_paper_scheme where scheme_id = #{schemeId} + + + + delete from education_paper_scheme where scheme_id in + + #{schemeId} + + + \ No newline at end of file diff --git a/exam-module-exam/exam-module-exam-biz/src/main/resources/mapper/exam/EducationPaperSessionMapper.xml b/exam-module-exam/exam-module-exam-biz/src/main/resources/mapper/exam/EducationPaperSessionMapper.xml new file mode 100644 index 00000000..3073137d --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/resources/mapper/exam/EducationPaperSessionMapper.xml @@ -0,0 +1,115 @@ + + + + + + + + + + + + + + + + + + + select session_id, task_id, batch, start_time, end_time, allow_entry, end_allow_entry, allow_submission, status, paper_id from education_paper_session + + + + + + + + + insert into education_paper_session + + session_id, + task_id, + batch, + start_time, + end_time, + allow_entry, + end_allow_entry, + allow_submission, + status, + paper_id, + + + #{sessionId}, + #{taskId}, + #{batch}, + #{startTime}, + #{endTime}, + #{allowEntry}, + #{endAllowEntry}, + #{allowSubmission}, + #{status}, + #{paperId}, + + + + INSERT INTO education_paper_session (session_id, task_id, batch, start_time, end_time, allow_entry, end_allow_entry, allow_submission, status, paper_id) VALUES + + ( + #{item.sessionId}, #{item.taskId}, #{item.batch}, #{item.startTime}, #{item.endTime}, #{item.allowEntry}, #{item.endAllowEntry}, #{item.allowSubmission}, #{item.status}, #{item.paperId} + ) + + + + + update education_paper_session + + task_id = #{taskId}, + batch = #{batch}, + start_time = #{startTime}, + end_time = #{endTime}, + allow_entry = #{allowEntry}, + end_allow_entry = #{endAllowEntry}, + allow_submission = #{allowSubmission}, + status = #{status}, + paper_id = #{paperId}, + + where session_id = #{sessionId} + + + UPDATE education_paper_session + SET status = #{status} + where session_id =#{sessionId} + + + + delete from education_paper_session where session_id = #{sessionId} + + + + delete from education_paper_session where session_id in + + #{sessionId} + + + \ No newline at end of file diff --git a/exam-module-exam/exam-module-exam-biz/src/main/resources/mapper/exam/EducationPaperTaskMapper.xml b/exam-module-exam/exam-module-exam-biz/src/main/resources/mapper/exam/EducationPaperTaskMapper.xml new file mode 100644 index 00000000..ddcb700d --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/resources/mapper/exam/EducationPaperTaskMapper.xml @@ -0,0 +1,183 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select task_id, task_name, task_specialty, task_type, is_template, status, create_time, update_time, creator, updater, deleted,tenant_id from education_paper_task + + + + + + + + + + + + + + + + + insert into education_paper_task + + task_id, + task_name, + task_specialty, + task_type, + is_template, + status, + create_time, + update_time, + creator, + updater, + deleted, + tenant_id, + + + #{taskId}, + #{taskName}, + #{taskSpecialty}, + #{taskType}, + #{isTemplate}, + #{status}, + #{createTime}, + #{updateTime}, + #{creator}, + #{updater}, + #{deleted}, + #{tenantId}, + + + + + + update education_paper_task + + task_name = #{taskName}, + task_specialty = #{taskSpecialty}, + task_type = #{taskType}, + is_template = #{isTemplate}, + status = #{status}, + create_time = #{createTime}, + update_time = #{updateTime}, + creator = #{creator}, + updater = #{updater}, + deleted = #{deleted}, + tenant_id = #{tenantId}, + + where task_id = #{taskId} + + + UPDATE education_paper_task + set status =#{status} + where task_id =#{taskId} + + + + + + UPDATE education_paper_task + set deleted = '2' where task_id = #{taskId} + + + + UPDATE education_paper_task + SET deleted = '2' + WHERE task_id IN + + #{taskId} + + + \ No newline at end of file diff --git a/exam-module-exam/exam-module-exam-biz/src/main/resources/mapper/exam/ExamQuestionAnswerMapper.xml b/exam-module-exam/exam-module-exam-biz/src/main/resources/mapper/exam/ExamQuestionAnswerMapper.xml new file mode 100644 index 00000000..faebc37b --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/resources/mapper/exam/ExamQuestionAnswerMapper.xml @@ -0,0 +1,113 @@ + + + + + + + + + + + + + + + + select answer_id, qu_id, is_right, image, content,contentIn, score_rate,sort from exam_question_answer + + + + + + + + insert into exam_question_answer + + answer_id, + qu_id, + is_right, + image, + content, + contentIn, + score_rate, + sort, + + + #{answerId}, + #{quId}, + #{isRight}, + #{image}, + #{content}, + #{contentIn}, + #{scoreRate}, + #{sort}, + + + + + update exam_question_answer + + qu_id = #{quId}, + is_right = #{isRight}, + image = #{image}, + content = #{content}, + contentIn = #{contentIn}, + score_rate = #{scoreRate}, + sort = #{sort}, + + where answer_id = #{answerId} + + + + delete from exam_question_answer where answer_id = #{answerId} + + + + delete from exam_question_answer where answer_id in + + #{answerId} + + + + + insert into exam_question_answer + (answer_id, qu_id, is_right, image, content,contentIn,score_rate,sort) + values + + (#{item.answerId},#{item.quId},#{item.isRight},#{item.image},#{item.content},#{item.contentIn},#{item.scoreRate},#{item.sort}) + + + + + + delete from exam_question_answer where qu_id = #{firstQuId} + + + delete from exam_question_answer where qu_id in + + #{firstQuId} + + + + + \ No newline at end of file diff --git a/exam-module-exam/exam-module-exam-biz/src/main/resources/mapper/exam/ExamQuestionKeywordMapper.xml b/exam-module-exam/exam-module-exam-biz/src/main/resources/mapper/exam/ExamQuestionKeywordMapper.xml new file mode 100644 index 00000000..72ab65b8 --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/resources/mapper/exam/ExamQuestionKeywordMapper.xml @@ -0,0 +1,91 @@ + + + + + + + + + + + + + select keyword_id, qu_id, keyword, score_rate from exam_question_keyword + + + + + + + + + insert into exam_question_keyword + + keyword_id, + qu_id, + keyword, + score_rate, + + + #{keywordId}, + #{quId}, + #{keyword}, + #{scoreRate}, + + + + insert into exam_question_keyword + (keyword_id, qu_id, keyword, score_rate) + values + + (#{item.keywordId},#{item.quId},#{item.keyword},#{item.scoreRate}) + + + + + update exam_question_keyword + + qu_id = #{quId}, + keyword = #{keyword}, + score_rate = #{scoreRate}, + + where keyword_id = #{keywordId} + + + + delete from exam_question_keyword where keyword_id = #{keywordId} + + + + delete from exam_question_keyword where keyword_id in + + #{keywordId} + + + + delete from exam_question_keyword where qu_id = #{firstQuId} + + + delete from exam_question_keyword where qu_id in + + #{firstQuId} + + + \ No newline at end of file diff --git a/exam-module-exam/exam-module-exam-biz/src/main/resources/mapper/exam/ExamQuestionMapper.xml b/exam-module-exam/exam-module-exam-biz/src/main/resources/mapper/exam/ExamQuestionMapper.xml new file mode 100644 index 00000000..d6419b40 --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/resources/mapper/exam/ExamQuestionMapper.xml @@ -0,0 +1,179 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select qu_id, qu_bank_id, qu_bank_name, chapterId_dict_text,subject_name, qu_level, + content, content_text, analysis, point_names, keywords, manual, create_time, creator, update_time, updater, deleted ,status,audit ,course_name, specialty_name from exam_question + + + + + + + + + + + insert into exam_question + + qu_id, + qu_bank_id, + qu_bank_name, + chapterId_dict_text, + subject_name, + qu_level, + content, + content_text, + analysis, + dept_id, + user_id, + point_names, + keywords, + manual, + create_time, + creator, + update_time, + updater, + deleted, + status, + audit, + course_name, + specialty_name, + tenant_id, + + + #{quId}, + #{quBankId}, + #{quBankName}, + #{chapteridDictText}, + #{subjectName}, + #{quLevel}, + #{content}, + #{contentText}, + #{analysis}, + #{deptId}, + #{userId}, + #{pointNames}, + #{keywords}, + #{manual}, + #{createTime}, + #{creator}, + #{updateTime}, + #{updater}, + #{deleted}, + #{status}, + #{audit}, + #{courseName}, + #{specialtyName}, + #{tenantId}, + + + + + + update exam_question + + qu_bank_id = #{quBankId}, + qu_bank_name = #{quBankName}, + chapterId_dict_text = #{chapteridDictText}, + subject_name = #{subjectName}, + qu_level = #{quLevel}, + content = #{content}, + content_text = #{contentText}, + analysis = #{analysis}, + point_names = #{pointNames}, + keywords = #{keywords}, + manual = #{manual}, + create_time = #{createTime}, + creator = #{creator}, + update_time = #{updateTime}, + updater = #{updater}, + deleted = #{deleted}, + status = #{status}, + audit = #{audit}, + course_name = #{courseName}, + specialty_name = #{specialtyName}, + tenant_id = #{tenantId}, + + where qu_id = #{quId} + + + + UPDATE exam_question set deleted ='2' where qu_id = #{quId} + + + + UPDATE exam_question + SET deleted = '2' + WHERE qu_id IN + + #{id} + + + + + \ No newline at end of file diff --git a/exam-module-exam/exam-module-exam-biz/src/main/resources/mapper/exam/ExamQuestionScoreMapper.xml b/exam-module-exam/exam-module-exam-biz/src/main/resources/mapper/exam/ExamQuestionScoreMapper.xml new file mode 100644 index 00000000..ddf385c8 --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/resources/mapper/exam/ExamQuestionScoreMapper.xml @@ -0,0 +1,131 @@ + + + + + + + + + + + + + + + + + + + + + select score_id, qu_id, is_pass, is_result, is_keyword,is_compile, is_pass_score, is_result_score, is_keyword_score ,is_compile_score,keyword_cutoff,compile_cutoff from exam_question_score + + + + + + + + + insert into exam_question_score + + score_id, + qu_id, + is_pass, + is_result, + is_keyword, + is_compile, + is_pass_score, + is_result_score, + is_keyword_score, + is_compile_score, + keyword_cutoff, + compile_cutoff, + + + #{scoreId}, + #{quId}, + #{isPass}, + #{isResult}, + #{isKeyword}, + #{isCompile}, + #{isPassScore}, + #{isResultScore}, + #{isKeywordScore}, + #{isCompileScore}, + #{keywordCutoff}, + #{compileCutoff}, + + + + insert into exam_question_score + (score_id, qu_id,is_pass,is_result,is_keyword,is_compile,is_pass_score,is_result_score,is_keyword_score,is_compile_score,keyword_cutoff,compile_cutoff) + values + + (#{item.scoreId},#{item.quId},#{item.isPass},#{item.isResult},#{item.isKeyword},#{item.isCompile},#{item.isPassScore},#{item.isResultScore},#{item.isKeywordScore},#{item.isCompileScore},#{item.keywordCutoff},#{item.compileCutoff}) + + + + + update exam_question_score + + qu_id = #{quId}, + is_pass = #{isPass}, + is_result = #{isResult}, + is_keyword = #{isKeyword}, + is_compile = #{isCompile}, + is_pass_score = #{isPassScore}, + is_result_score = #{isResultScore}, + is_keyword_score = #{isKeywordScore}, + is_compile_score = #{isCompileScore}, + keyword_cutoff = #{keywordCutoff}, + compile_cutoff = #{compileCutoff}, + + where score_id = #{scoreId} + + + + delete from exam_question_score where score_id = #{scoreId} + + + + delete from exam_question_score where score_id in + + #{scoreId} + + + + delete from exam_question_score where qu_id = #{firstQuId} + + + delete from exam_question_score where qu_id in + + #{firstQuId} + + + \ No newline at end of file diff --git a/exam-module-exam/exam-module-exam-biz/src/main/resources/mapper/exam/SysFileMapper.xml b/exam-module-exam/exam-module-exam-biz/src/main/resources/mapper/exam/SysFileMapper.xml new file mode 100644 index 00000000..62e9029b --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/resources/mapper/exam/SysFileMapper.xml @@ -0,0 +1,91 @@ + + + + + + + + + + + + + select file_id, qu_id, url, file_type from sys_file + + + + + + + + + insert into sys_file + + file_id, + qu_id, + url, + file_type, + + + #{fileId}, + #{quId}, + #{url}, + #{fileType}, + + + + insert into sys_file + (file_id, qu_id,url,file_type) + values + + (#{item.fileId},#{item.quId},#{item.url},#{item.fileType}) + + + + + update sys_file + + qu_id = #{quId}, + url = #{url}, + file_type = #{fileType}, + + where file_id = #{fileId} + + + + delete from sys_file where file_id = #{fileId} + + + + delete from sys_file where file_id in + + #{fileId} + + + + delete from sys_file where qu_id = #{firstQuId} + + + delete from sys_file where qu_id in + + #{firstQuId} + + + + \ No newline at end of file diff --git a/exam-server/src/main/resources/application.yaml b/exam-server/src/main/resources/application.yaml index e1db9659..81dbcbc6 100644 --- a/exam-server/src/main/resources/application.yaml +++ b/exam-server/src/main/resources/application.yaml @@ -66,14 +66,14 @@ flowable: # MyBatis配置 mybatis: # 搜索指定包别名 - typeAliasesPackage: pc.exam.pp.module.**.dal.dataobject + type-aliases-package: pc.exam.pp.module.**.dal.dataobject # 配置mapper的扫描,找到所有的mapper.xml映射文件 - mapperLocations: classpath*:mysql/**/*Mapper.xml - # 加载全局的配置文件 - configLocation: classpath:mybatis/mybatis-config.xml + mapper-locations: classpath*:mapper/**/*Mapper.xml + # MyBatis Plus 的配置项 mybatis-plus: + mapper-locations: classpath*:mapper/**/*Mapper.xml configuration: map-underscore-to-camel-case: true # 虽然默认为 true ,但是还是显示去指定下。 global-config: @@ -336,6 +336,17 @@ exam: - rep_demo_jianpiao - tmp_report_data_1 - tmp_report_data_income + - exam_question_answer + - exam_question_keyword + - exam_question_score + - sys_file + - education_paper + - education_paper_param + - education_paper_person + - education_paper_qu + - education_paper_scheme + - education_paper_session + - exam_specialty ignore-caches: - user_role_ids - permission_menu_ids

1