【修改】 试题推送、审核,相关

This commit is contained in:
dlaren
2025-08-08 14:57:43 +08:00
parent 520f2f0e0a
commit 9907e9aa36
11 changed files with 478 additions and 250 deletions

View File

@@ -24,10 +24,7 @@ import pc.exam.pp.module.exam.controller.admin.paper.dto.StatusDto;
import pc.exam.pp.module.exam.controller.admin.question.dto.ExamQuestionDto; import pc.exam.pp.module.exam.controller.admin.question.dto.ExamQuestionDto;
import pc.exam.pp.module.exam.controller.admin.question.dto.QuStatusDto; import pc.exam.pp.module.exam.controller.admin.question.dto.QuStatusDto;
import pc.exam.pp.module.exam.controller.admin.question.dto.TenantDto; import pc.exam.pp.module.exam.controller.admin.question.dto.TenantDto;
import pc.exam.pp.module.exam.controller.admin.question.vo.QueImportRespVO; import pc.exam.pp.module.exam.controller.admin.question.vo.*;
import pc.exam.pp.module.exam.controller.admin.question.vo.QuemportExcelVO;
import pc.exam.pp.module.exam.controller.admin.question.vo.QuestionVo;
import pc.exam.pp.module.exam.controller.admin.question.vo.TenantVo;
import pc.exam.pp.module.exam.controller.admin.questionexamine.vo.QuestionExaminePageReqVO; import pc.exam.pp.module.exam.controller.admin.questionexamine.vo.QuestionExaminePageReqVO;
import pc.exam.pp.module.exam.dal.dataobject.EducationPaperTask; import pc.exam.pp.module.exam.dal.dataobject.EducationPaperTask;
import pc.exam.pp.module.exam.dal.dataobject.ExamQuestion; import pc.exam.pp.module.exam.dal.dataobject.ExamQuestion;
@@ -45,16 +42,15 @@ import static pc.exam.pp.module.system.enums.ErrorCodeConstants.QESESTION_AUDIT_
/** /**
* 试题(hyc)Controller * 试题(hyc)Controller
* *
* @author pengchen * @author pengchen
* @date 2025-03-13 * @date 2025-03-13
*/ */
@RestController @RestController
@RequestMapping("/exam/question") @RequestMapping("/exam/question")
@Tag( name = "试题管理接口") @Tag(name = "试题管理接口")
@Validated @Validated
public class ExamQuestionController public class ExamQuestionController {
{
@Resource @Resource
private IExamQuestionService examQuestionService; private IExamQuestionService examQuestionService;
@@ -63,30 +59,30 @@ public class ExamQuestionController
*/ */
//@PreAuthorize("@ss.hasPermi('system:question:list')") //@PreAuthorize("@ss.hasPermi('system:question:list')")
@GetMapping("/list") @GetMapping("/list")
public CommonResult<PageResult<ExamQuestion>> list(QuestionVo questionVo) public CommonResult<PageResult<ExamQuestion>> list(QuestionVo questionVo) {
{
PageResult<ExamQuestion> pageResult = examQuestionService.selectExamQuestionList(questionVo); PageResult<ExamQuestion> pageResult = examQuestionService.selectExamQuestionList(questionVo);
return success(pageResult); return success(pageResult);
} }
@GetMapping("/listAnswer") @GetMapping("/listAnswer")
public CommonResult<PageResult<ExamQuestion>> listAnswer(QuestionVo questionVo) public CommonResult<PageResult<ExamQuestion>> listAnswer(QuestionVo questionVo) {
{
PageResult<ExamQuestion> pageResult = examQuestionService.selectExamQuestionListAnswer(questionVo); PageResult<ExamQuestion> pageResult = examQuestionService.selectExamQuestionListAnswer(questionVo);
return success(pageResult); return success(pageResult);
} }
/** /**
* 查询除了审核状态通过的其他状态的试题(试题推送) * 查询除了审核状态通过的其他状态的试题(试题推送)
*
* @param questionVo * @param questionVo
* @return * @return
*/ */
@GetMapping("/sendList") @GetMapping("/sendList")
public CommonResult<PageResult<ExamQuestion>> sendList(QuestionVo questionVo) public CommonResult<PageResult<ExamQuestion>> sendList(QuestionVo questionVo) {
{
PageResult<ExamQuestion> pageResult; PageResult<ExamQuestion> pageResult;
if (StringUtils.isNotBlank(questionVo.getAudit())){ if (StringUtils.isNotBlank(questionVo.getAudit())) {
pageResult= examQuestionService.selectExamQuestionList(questionVo); pageResult = examQuestionService.selectExamQuestionList(questionVo);
}else { } else {
pageResult = examQuestionService.selectExamQuestionListSend(questionVo); pageResult = examQuestionService.selectExamQuestionListSend(questionVo);
} }
return success(pageResult); return success(pageResult);
@@ -94,14 +90,14 @@ public class ExamQuestionController
/** /**
* 查询试题(试题审核) * 查询试题(试题审核)
*
* @return * @return
*/ */
@GetMapping("/auditList") @GetMapping("/auditList")
@TenantIgnore @TenantIgnore
public CommonResult<PageResult<ExamQuestion>> auditList(@Valid QuestionExaminePageReqVO pageReqVO) public CommonResult<PageResult<ExamQuestion>> auditList(@Valid QuestionExaminePageReqVO pageReqVO) {
{
PageResult<ExamQuestion> pageResult= examQuestionService.selectExamQuestionListNoAudit(pageReqVO); PageResult<ExamQuestion> pageResult = examQuestionService.selectExamQuestionListNoAudit(pageReqVO);
// pageResult= examQuestionService.selectExamQuestionListAudit(pageReqVO); // pageResult= examQuestionService.selectExamQuestionListAudit(pageReqVO);
@@ -126,27 +122,26 @@ public class ExamQuestionController
*/ */
//@PreAuthorize("@ss.hasPermi('system:question:query')") //@PreAuthorize("@ss.hasPermi('system:question:query')")
@GetMapping(value = "/{quId}") @GetMapping(value = "/{quId}")
public CommonResult<ExamQuestion> getInfo(@PathVariable("quId") String quId) public CommonResult<ExamQuestion> getInfo(@PathVariable("quId") String quId) {
{
return success(examQuestionService.selectExamQuestionByQuId(quId)); return success(examQuestionService.selectExamQuestionByQuId(quId));
} }
/** /**
* 获取试题(hyc)详细信息 无租户id * 获取试题(hyc)详细信息 无租户id
*/ */
//@PreAu //@PreAu
@GetMapping(value = "/notId/{quId}") @GetMapping(value = "/notId/{quId}")
@TenantIgnore @TenantIgnore
public CommonResult<ExamQuestion> getInfoNotId(@PathVariable("quId") String quId) public CommonResult<ExamQuestion> getInfoNotId(@PathVariable("quId") String quId) {
{
return success(examQuestionService.selectExamQuestionByQuId(quId)); return success(examQuestionService.selectExamQuestionByQuId(quId));
} }
/** /**
* 新增试题(hyc) * 新增试题(hyc)
*/ */
//@PreAuthorize("@ss.hasPermi('system:question:add')") //@PreAuthorize("@ss.hasPermi('system:question:add')")
@PostMapping @PostMapping
public CommonResult add(@RequestBody ExamQuestion examQuestion) public CommonResult add(@RequestBody ExamQuestion examQuestion) {
{
return success(examQuestionService.insertExamQuestion(examQuestion)); return success(examQuestionService.insertExamQuestion(examQuestion));
} }
@@ -155,9 +150,8 @@ public class ExamQuestionController
* 修改试题(hyc) * 修改试题(hyc)
*/ */
@PutMapping @PutMapping
public CommonResult edit(@RequestBody ExamQuestion examQuestion) public CommonResult edit(@RequestBody ExamQuestion examQuestion) {
{ return success(examQuestionService.updateExamQuestion(examQuestion));
return success(examQuestionService.updateExamQuestion(examQuestion));
} }
@@ -166,16 +160,15 @@ public class ExamQuestionController
*/ */
@PutMapping("/NoAudit") @PutMapping("/NoAudit")
@TenantIgnore @TenantIgnore
public CommonResult editNoAudit(@RequestBody ExamQuestion examQuestion) public CommonResult editNoAudit(@RequestBody ExamQuestion examQuestion) {
{
return success(examQuestionService.updateExamQuestion(examQuestion)); return success(examQuestionService.updateExamQuestion(examQuestion));
} }
/** /**
* 删除试题(hyc) * 删除试题(hyc)
*/ */
@DeleteMapping("/{ids}") @DeleteMapping("/{ids}")
public CommonResult remove(@PathVariable String[] ids) public CommonResult remove(@PathVariable String[] ids) {
{
return success(examQuestionService.deleteExamQuestionByQuIds(ids)); return success(examQuestionService.deleteExamQuestionByQuIds(ids));
} }
@@ -206,28 +199,30 @@ public class ExamQuestionController
/** /**
*获得学校分页列表 * 获得学校分页列表
*
* @return * @return
*/ */
@GetMapping("/getSchoolName") @GetMapping("/getSchoolName")
@TenantIgnore @TenantIgnore
public CommonResult<PageResult<TenantVo>> getSchoolName(TenantDto tenantDto) public CommonResult<PageResult<TenantVo>> getSchoolName(TenantDto tenantDto) {
{
return success(examQuestionService.getSchoolName(tenantDto)); return success(examQuestionService.getSchoolName(tenantDto));
} }
/** /**
*获得学校分页列表(不分页) * 获得学校分页列表(不分页)
*
* @return * @return
*/ */
@GetMapping("/getSchoolNameNopage") @GetMapping("/getSchoolNameNopage")
@TenantIgnore @TenantIgnore
public CommonResult<List<TenantVo>> getSchoolNameNaPage() public CommonResult<List<TenantVo>> getSchoolNameNaPage() {
{
return success(examQuestionService.getSchoolNameNaPage()); return success(examQuestionService.getSchoolNameNaPage());
} }
/** /**
* 服务端审核通过试题 * 服务端审核通过试题
*
* @param quIds * @param quIds
* @return * @return
*/ */
@@ -238,17 +233,18 @@ public class ExamQuestionController
return CommonResult.error(QESESTION_NOT_NULL); return CommonResult.error(QESESTION_NOT_NULL);
} }
int b = examQuestionService.auditQueByIds(quIds); int b = examQuestionService.auditQueByIds(quIds);
if (b>0){ if (b > 0) {
return success("审核成功"); return success("审核成功");
} } else {
else {
return error(QESESTION_AUDIT_ERROR); return error(QESESTION_AUDIT_ERROR);
} }
} }
/** /**
* 服务端审核不通过试题 * 服务端审核不通过试题
*
* @param quIds * @param quIds
* @return * @return
*/ */
@@ -259,16 +255,17 @@ public class ExamQuestionController
return CommonResult.error(QESESTION_NOT_NULL); return CommonResult.error(QESESTION_NOT_NULL);
} }
int b = examQuestionService.noAuditQue(quIds); int b = examQuestionService.noAuditQue(quIds);
if (b>0){ if (b > 0) {
return success("操作成功"); return success("操作成功");
}else { } else {
return error(QESESTION_AUDIT_ERROR); return error(QESESTION_AUDIT_ERROR);
} }
} }
/** /**
* 更改试题状态 * 更改试题状态
*
* @param quStatusDto * @param quStatusDto
* @return * @return
*/ */
@@ -280,7 +277,13 @@ public class ExamQuestionController
} }
/**
* 审核试题
*/
@PostMapping("/auditQuestion")
public CommonResult<Boolean> audit(@RequestBody AudioQuestionVo audioQuestionVo) {
return CommonResult.success(examQuestionService.auditQuestion(audioQuestionVo));
}
} }

View File

@@ -0,0 +1,11 @@
package pc.exam.pp.module.exam.controller.admin.question.vo;
import lombok.Data;
import java.util.List;
@Data
public class AudioQuestionVo{
private String type;
private List<String> quIds;
}

View File

@@ -10,6 +10,7 @@ import pc.exam.pp.framework.common.pojo.CommonResult;
import pc.exam.pp.framework.security.core.util.SecurityFrameworkUtils; import pc.exam.pp.framework.security.core.util.SecurityFrameworkUtils;
import pc.exam.pp.framework.tenant.core.aop.TenantIgnore; import pc.exam.pp.framework.tenant.core.aop.TenantIgnore;
import pc.exam.pp.framework.tenant.core.service.TenantFrameworkService; import pc.exam.pp.framework.tenant.core.service.TenantFrameworkService;
import pc.exam.pp.module.exam.controller.admin.rabbitmq.vo.PushAudioRequestVo;
import pc.exam.pp.module.exam.controller.admin.rabbitmq.vo.PushRequestVo; import pc.exam.pp.module.exam.controller.admin.rabbitmq.vo.PushRequestVo;
import pc.exam.pp.module.exam.controller.admin.rabbitmq.vo.RabbitMQSendInfoVO; import pc.exam.pp.module.exam.controller.admin.rabbitmq.vo.RabbitMQSendInfoVO;
import pc.exam.pp.module.exam.dal.dataobject.ExamQuestion; import pc.exam.pp.module.exam.dal.dataobject.ExamQuestion;
@@ -26,7 +27,7 @@ import static pc.exam.pp.module.system.enums.ErrorCodeConstants.RABBITMQ_CONNECT
@RestController @RestController
@RequestMapping("/rabbitmq") @RequestMapping("/rabbitmq")
@Tag( name = "rabbitmq 消息队列") @Tag(name = "rabbitmq 消息队列")
public class RabbitMQController { public class RabbitMQController {
@Resource @Resource
@@ -37,26 +38,28 @@ public class RabbitMQController {
/** /**
* 连接Rabbitmq * 连接Rabbitmq
*
* @return 连接状态 * @return 连接状态
*/ */
@PostMapping("/connect") @PostMapping("/connect")
// public String connect(@RequestParam String queueName) { // public String connect(@RequestParam String queueName) {
public CommonResult connect() { public CommonResult connect() {
String queueName = SecurityFrameworkUtils.getLoginQueueName(); String queueName = SecurityFrameworkUtils.getLoginQueueName();
int connect = rabbitMqService.connect(queueName); int connect = rabbitMqService.connect(queueName);
if (connect == 0 ){ if (connect == 0) {
return CommonResult.success("已经连接"); return CommonResult.success("已经连接");
} }
if (connect ==1){ if (connect == 1) {
return CommonResult.success("连接成功"); return CommonResult.success("连接成功");
} }
return CommonResult.error(RABBITMQ_CONNECT_EXISTS); return CommonResult.error(RABBITMQ_CONNECT_EXISTS);
} }
/** /**
* 判断是否连接 * 判断是否连接
*
* @return 连接状态 * @return 连接状态
*/ */
@GetMapping("/isConnected") @GetMapping("/isConnected")
@@ -65,34 +68,43 @@ public class RabbitMQController {
} }
/** /**
* 发送消息 * 发送消息(考点服务器-中心服务器审核试题)
* @param rabbitMQSendInfoVO 对象 *
* @param request 对象
* @return 发送状态 * @return 发送状态
*/ */
@PostMapping("/send") @PostMapping("/sendAudio")
public int sendMessage(@RequestBody RabbitMQSendInfoVO rabbitMQSendInfoVO) { public CommonResult sendMessage(@RequestBody PushAudioRequestVo request) {
rabbitMQSendInfoVO.setQueueName(SecurityFrameworkUtils.getLoginQueueName()); String queueNames = request.getQueueNames();
return examQuestionService.uploadExamQuestionToRabbitMQ(rabbitMQSendInfoVO); List<String> questionIds = request.getQuestionIds();
RabbitMQSendInfoVO rabbitMQSendInfoVO = new RabbitMQSendInfoVO();
rabbitMQSendInfoVO.setType(request.getType());
rabbitMQSendInfoVO.setQuIds(questionIds);
rabbitMQSendInfoVO.setQueueName(queueNames);
examQuestionService.uploadExamQuestionToRabbitMQBySource(rabbitMQSendInfoVO);
return CommonResult.success("推送成功");
} }
/** /**
* 全部接收消息(学校中心或服务器接收中心服务器推送的试题) * 全部接收消息(学校中心或服务器接收中心服务器推送的试题)
队列名称-客户端代码 * 队列名称-客户端代码
*
* @return 接收结果 * @return 接收结果
*/ */
@GetMapping("/receiveAll") @GetMapping("/receiveAll")
public CommonResult receiveMessage() { public CommonResult receiveMessage() {
String queueName = SecurityFrameworkUtils.getLoginQueueName(); String queueName = SecurityFrameworkUtils.getLoginQueueName();
boolean examQuestionToRabbitMQ = examQuestionService.getExamQuestionToRabbitMQInsertData(queueName); boolean examQuestionToRabbitMQ = examQuestionService.getExamQuestionToRabbitMQInsertData(queueName);
if (examQuestionToRabbitMQ){ if (examQuestionToRabbitMQ) {
return CommonResult.success("接收成功"); return CommonResult.success("接收成功");
}else { } else {
return CommonResult.error(RABBITMQ_NOT_EXISTS); return CommonResult.error(RABBITMQ_NOT_EXISTS);
} }
} }
/** /**
* 服务器连接学校 * 服务器连接学校
*
* @param queueNames * @param queueNames
* @return * @return
*/ */
@@ -104,7 +116,7 @@ public class RabbitMQController {
List<String> failedQueues = new ArrayList<>(); List<String> failedQueues = new ArrayList<>();
for (String queueName : queueNames) { for (String queueName : queueNames) {
boolean examQuestionToRabbitMQ = rabbitMqService.connectSchool(queueName); boolean examQuestionToRabbitMQ = rabbitMqService.connectSchool(queueName);
if (!examQuestionToRabbitMQ) { if (!examQuestionToRabbitMQ) {
failedQueues.add(queueName); failedQueues.add(queueName);
} }
@@ -113,12 +125,14 @@ public class RabbitMQController {
if (failedQueues.isEmpty()) { if (failedQueues.isEmpty()) {
return CommonResult.success("全部连接成功"); return CommonResult.success("全部连接成功");
} else { } else {
return CommonResult.error(1_005_005_023,"以下学校全部连接失败:" + String.join(", ", failedQueues)); return CommonResult.error(1_005_005_023, "以下学校全部连接失败:" + String.join(", ", failedQueues));
} }
} }
/** /**
* 接收学校的试题 * 接收学校的试题
*
* @param queueNames * @param queueNames
* @return * @return
*/ */
@@ -139,7 +153,7 @@ public class RabbitMQController {
if (failedQueues.isEmpty()) { if (failedQueues.isEmpty()) {
return CommonResult.success("全部接收成功"); return CommonResult.success("全部接收成功");
} else { } else {
return CommonResult.error(1_005_005_023,"以下学校接收失败:" + String.join(", ", failedQueues)); return CommonResult.error(1_005_005_023, "以下学校接收失败:" + String.join(", ", failedQueues));
} }
@@ -147,6 +161,7 @@ public class RabbitMQController {
/** /**
* 服务器推送学校试题 到mqtt * 服务器推送学校试题 到mqtt
*
* @param request * @param request
* @return * @return
*/ */
@@ -155,22 +170,20 @@ public class RabbitMQController {
public CommonResult doPush(@RequestBody PushRequestVo request) { public CommonResult doPush(@RequestBody PushRequestVo request) {
List<String> queueNames = request.getQueueNames(); List<String> queueNames = request.getQueueNames();
List<String> questionIds = request.getQuestionIds(); List<String> questionIds = request.getQuestionIds();
System.out.println(queueNames);
System.out.println(questionIds);
for (String queueName : queueNames) { for (String queueName : queueNames) {
RabbitMQSendInfoVO rabbitMQSendInfoVO=new RabbitMQSendInfoVO(); RabbitMQSendInfoVO rabbitMQSendInfoVO = new RabbitMQSendInfoVO();
rabbitMQSendInfoVO.setType("0"); rabbitMQSendInfoVO.setType("0");
rabbitMQSendInfoVO.setQuIds(questionIds); rabbitMQSendInfoVO.setQuIds(questionIds);
rabbitMQSendInfoVO.setQueueName(queueName); rabbitMQSendInfoVO.setQueueName(queueName);
examQuestionService.uploadExamQuestionToRabbitMQBySource(rabbitMQSendInfoVO); examQuestionService.uploadExamQuestionToRabbitMQBySource(rabbitMQSendInfoVO);
} }
return CommonResult.success("推送成功"); return CommonResult.success("推送成功");
} }
/** /**
* 关闭 * 关闭
*
* @return 关闭结果 * @return 关闭结果
*/ */
@GetMapping("/disconnect") @GetMapping("/disconnect")

View File

@@ -0,0 +1,13 @@
package pc.exam.pp.module.exam.controller.admin.rabbitmq.vo;
import lombok.Data;
import java.util.List;
@Data
public class PushAudioRequestVo {
// 类型
private String type;
private String queueNames;
private List<String> questionIds;
}

View File

@@ -6,6 +6,8 @@ import java.util.List;
@Data @Data
public class PushRequestVo { public class PushRequestVo {
// 类型
private String type;
private List<String> queueNames; private List<String> queueNames;
private List<String> questionIds; private List<String> questionIds;
} }

View File

@@ -12,7 +12,7 @@ import java.util.List;
/** /**
* 试题(hyc)对象 exam_question * 试题(hyc)对象 exam_question
* *
* @author pengchen * @author pengchen
* @date 2025-03-13 * @date 2025-03-13
*/ */
@@ -24,99 +24,143 @@ import java.util.List;
public class ExamQuestion extends TenantBaseDO { public class ExamQuestion extends TenantBaseDO {
/** 试题id */ /**
* 试题id
*/
@TableId @TableId
private String quId; private String quId;
/** 题库id */ /**
* 题库id
*/
// @Excel(name = "题库id") // @Excel(name = "题库id")
private String quBankId; private String quBankId;
/** 题库名称 */ /**
* 题库名称
*/
// @Excel(name = "题库名称") // @Excel(name = "题库名称")
private String quBankName; private String quBankName;
private String quNum; private String quNum;
/** 章节名称 */ /**
* 章节名称
*/
// @Excel(name = "章节名称") // @Excel(name = "章节名称")
private String chapteridDictText; private String chapteridDictText;
@TableField(exist = false) @TableField(exist = false)
private String chapteridDictTextVo; private String chapteridDictTextVo;
/** 题型名称 */ /**
* 题型名称
*/
// @Excel(name = "题型名称") // @Excel(name = "题型名称")
private String subjectName; private String subjectName;
/** 题型难度0简单1一般2困难 */ /**
* 题型难度0简单1一般2困难
*/
// @Excel(name = "题型难度0简单1一般2困难") // @Excel(name = "题型难度0简单1一般2困难")
private Integer quLevel; private Integer quLevel;
/** 试题内容(带样式:<p>下列表格123</p>\n<table style=\"border-collapse: collapse; width: 100%;\" border=\"1\">\n<tbody>\n<tr>\n<td style=\"width: 31.4907%;\">1</td>\) */ /**
* 试题内容(带样式:<p>下列表格123</p>\n<table style=\"border-collapse: collapse; width: 100%;\" border=\"1\">\n<tbody>\n<tr>\n<td style=\"width: 31.4907%;\">1</td>\)
*/
// @Excel(name = "试题内容") // @Excel(name = "试题内容")
private String content; private String content;
/** 试题内容(纯文本) */ /**
* 试题内容(纯文本)
*/
// @Excel(name = "试题内容(纯文本)") // @Excel(name = "试题内容(纯文本)")
private String contentText; private String contentText;
/** 解析(带样式) */ /**
* 解析(带样式)
*/
// @Excel(name = "解析(带样式)") // @Excel(name = "解析(带样式)")
private String analysis; private String analysis;
/**c语言参考答案*/ /**
private String answer; * c语言参考答案
*/
private String answer;
/** 知识点 */ /**
* 知识点
*/
// @Excel(name = "知识点") // @Excel(name = "知识点")
private String pointNames; private String pointNames;
@TableField(exist = false) @TableField(exist = false)
private String pointNamesVo; private String pointNamesVo;
/** 关键字 */ /**
* 关键字
*/
// @Excel(name = "关键字") // @Excel(name = "关键字")
private String keywords; private String keywords;
/** 是否人工0否1是简答题专用 */ /**
* 是否人工0否1是简答题专用
*/
// @Excel(name = "是否人工,0=否1是简答题专用") // @Excel(name = "是否人工,0=否1是简答题专用")
private String manual; private String manual;
/** 状态0启用1禁用 */ /**
* 状态0启用1禁用
*/
// @Excel(name = "状态0启用1禁用") // @Excel(name = "状态0启用1禁用")
private String status; private String status;
/** 审核 */ /**
* 审核
*/
// @Excel(name = "审核") // @Excel(name = "审核")
private String audit; private String audit;
/** 课程类别 */ /**
* 课程类别
*/
// @Excel(name = "课程类别") // @Excel(name = "课程类别")
private String courseName; private String courseName;
/** 专业分类 */ /**
* 专业分类
*/
// @Excel(name = "专业分类") // @Excel(name = "专业分类")
private String specialtyName; private String specialtyName;
/** 数据库名 */ /**
* 数据库名
*/
private String tname; private String tname;
/** 试题答案 */ /**
* 试题答案
*/
// @Excel(name = "试题答案") // @Excel(name = "试题答案")
@TableField(exist = false) @TableField(exist = false)
private List<ExamQuestionAnswer> answerList; private List<ExamQuestionAnswer> answerList;
/** 试题文件 */ /**
* 试题文件
*/
// @Excel(name = "试题文件") // @Excel(name = "试题文件")
@TableField(exist = false) @TableField(exist = false)
private List<ExamQuestionFile> fileUploads; private List<ExamQuestionFile> fileUploads;
/** 试题判分 */ /**
* 试题判分
*/
// @Excel(name = "试题判分") // @Excel(name = "试题判分")
@TableField(exist = false) @TableField(exist = false)
private ExamQuestionScore questionScores; private ExamQuestionScore questionScores;
/** 试题关键字 */ /**
* 试题关键字
*/
// @Excel(name = "试题关键字") // @Excel(name = "试题关键字")
@TableField(exist = false) @TableField(exist = false)
private List<ExamQuestionKeyword> questionKeywords; private List<ExamQuestionKeyword> questionKeywords;
@@ -129,14 +173,27 @@ public class ExamQuestion extends TenantBaseDO {
@TableField(exist = false) @TableField(exist = false)
private String type; private String type;
@TableField(exist = false) @TableField(exist = false)
private String schoolName; private String schoolName;
/** 每题分数 */ /**
* 每题分数
*/
@TableField(exist = false) @TableField(exist = false)
private String quScores; private String quScores;
/** 排序 */ /**
* 排序
*/
@TableField(exist = false) @TableField(exist = false)
private int sort; private int sort;
// 学校ID
private String schoolId;
/**
* 推送试题类型0中心服务器-考点服务器试题无需审核、1考点服务器-中心服务器:试题审核)
*/
@TableField(exist = false)
private String questionType;
} }

View File

@@ -5,29 +5,24 @@ import org.apache.ibatis.annotations.Param;
import pc.exam.pp.framework.common.pojo.PageResult; import pc.exam.pp.framework.common.pojo.PageResult;
import pc.exam.pp.framework.mybatis.core.mapper.BaseMapperX; import pc.exam.pp.framework.mybatis.core.mapper.BaseMapperX;
import pc.exam.pp.framework.mybatis.core.query.LambdaQueryWrapperX; 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.dto.TenantDto; import pc.exam.pp.module.exam.controller.admin.question.dto.TenantDto;
import pc.exam.pp.module.exam.controller.admin.question.vo.QuestionVo; import pc.exam.pp.module.exam.controller.admin.question.vo.QuestionVo;
import pc.exam.pp.module.exam.controller.admin.question.vo.TenantVo; import pc.exam.pp.module.exam.controller.admin.question.vo.TenantVo;
import pc.exam.pp.module.exam.dal.dataobject.EducationPaperTask;
import pc.exam.pp.module.exam.dal.dataobject.ExamQuestion; import pc.exam.pp.module.exam.dal.dataobject.ExamQuestion;
import pc.exam.pp.module.exam.dal.dataobject.monitor.MonitorDO;
import java.util.List; import java.util.List;
/** /**
* 试题(hyc)Mapper接口 * 试题(hyc)Mapper接口
* *
* @author pengchen * @author pengchen
* @date 2025-03-13 * @date 2025-03-13
*/ */
@Mapper @Mapper
public interface ExamQuestionMapper extends BaseMapperX<ExamQuestion> public interface ExamQuestionMapper extends BaseMapperX<ExamQuestion> {
{
/** /**
* 查询试题(hyc) * 查询试题(hyc)
* *
* @param quId 试题(hyc)主键 * @param quId 试题(hyc)主键
* @return 试题(hyc) * @return 试题(hyc)
*/ */
@@ -35,20 +30,20 @@ public interface ExamQuestionMapper extends BaseMapperX<ExamQuestion>
/** /**
* 查询试题(hyc)列表 * 查询试题(hyc)列表
* *
* @return 试题(hyc)集合 * @return 试题(hyc)集合
*/ */
default PageResult<ExamQuestion> selectExamQuestionList(QuestionVo questionVo) { default PageResult<ExamQuestion> selectExamQuestionList(QuestionVo questionVo) {
return selectPage(questionVo, new LambdaQueryWrapperX<ExamQuestion>() return selectPage(questionVo, new LambdaQueryWrapperX<ExamQuestion>()
.likeIfPresent(ExamQuestion::getQuNum, questionVo.getQuNum()) .likeIfPresent(ExamQuestion::getQuNum, questionVo.getQuNum())
.likeIfPresent(ExamQuestion::getContent, questionVo.getContent()) .likeIfPresent(ExamQuestion::getContent, questionVo.getContent())
.likeIfPresent(ExamQuestion::getQuId,questionVo.getQuId()) .likeIfPresent(ExamQuestion::getQuId, questionVo.getQuId())
.likeIfPresent(ExamQuestion::getKeywords,questionVo.getKeywords()) .likeIfPresent(ExamQuestion::getKeywords, questionVo.getKeywords())
.likeIfPresent(ExamQuestion::getQuLevel, questionVo.getQuLevel()) .likeIfPresent(ExamQuestion::getQuLevel, questionVo.getQuLevel())
.likeIfPresent(ExamQuestion::getCourseName , questionVo.getCourseName()) .likeIfPresent(ExamQuestion::getCourseName, questionVo.getCourseName())
.likeIfPresent(ExamQuestion::getPointNames , questionVo.getPointNames()) .likeIfPresent(ExamQuestion::getPointNames, questionVo.getPointNames())
.likeIfPresent(ExamQuestion::getSpecialtyName , questionVo.getSpecialtyName()) .likeIfPresent(ExamQuestion::getSpecialtyName, questionVo.getSpecialtyName())
.likeIfPresent(ExamQuestion::getSubjectName , questionVo.getSubjectName()) .likeIfPresent(ExamQuestion::getSubjectName, questionVo.getSubjectName())
.likeIfPresent(ExamQuestion::getStatus, questionVo.getStatus()) .likeIfPresent(ExamQuestion::getStatus, questionVo.getStatus())
.likeIfPresent(ExamQuestion::getAudit, questionVo.getAudit()) .likeIfPresent(ExamQuestion::getAudit, questionVo.getAudit())
.orderByDesc(ExamQuestion::getCreateTime) .orderByDesc(ExamQuestion::getCreateTime)
@@ -57,6 +52,7 @@ public interface ExamQuestionMapper extends BaseMapperX<ExamQuestion>
/** /**
* 查询除了审核状态为通过的其他试题 * 查询除了审核状态为通过的其他试题
*
* @param questionVo * @param questionVo
* @return * @return
*/ */
@@ -74,7 +70,7 @@ public interface ExamQuestionMapper extends BaseMapperX<ExamQuestion>
/** /**
* 新增试题(hyc) * 新增试题(hyc)
* *
* @param examQuestion 试题(hyc) * @param examQuestion 试题(hyc)
* @return 结果 * @return 结果
*/ */
@@ -82,7 +78,7 @@ public interface ExamQuestionMapper extends BaseMapperX<ExamQuestion>
/** /**
* 修改试题(hyc) * 修改试题(hyc)
* *
* @param examQuestion 试题(hyc) * @param examQuestion 试题(hyc)
* @return 结果 * @return 结果
*/ */
@@ -90,7 +86,7 @@ public interface ExamQuestionMapper extends BaseMapperX<ExamQuestion>
/** /**
* 删除试题(hyc) * 删除试题(hyc)
* *
* @param quId 试题(hyc)主键 * @param quId 试题(hyc)主键
* @return 结果 * @return 结果
*/ */
@@ -98,7 +94,7 @@ public interface ExamQuestionMapper extends BaseMapperX<ExamQuestion>
/** /**
* 批量删除试题(hyc) * 批量删除试题(hyc)
* *
* @param ids 需要删除的数据主键集合 * @param ids 需要删除的数据主键集合
* @return 结果 * @return 结果
*/ */
@@ -106,6 +102,7 @@ public interface ExamQuestionMapper extends BaseMapperX<ExamQuestion>
/** /**
* 批量查找试题 * 批量查找试题
*
* @param quIds * @param quIds
* @return * @return
*/ */
@@ -113,41 +110,54 @@ public interface ExamQuestionMapper extends BaseMapperX<ExamQuestion>
/** /**
* 批量审核试题 * 批量审核试题
*
* @param quIds * @param quIds
*/ */
void setQuestionAuditByids(@Param("quIds")List<String> quIds); void setQuestionAuditByids(@Param("quIds") List<String> quIds);
/** /**
* 查找学校集合(带分页) * 查找学校集合(带分页)
*
* @return * @return
*/ */
List<TenantVo> getSchoolName(TenantDto tenantDto); List<TenantVo> getSchoolName(TenantDto tenantDto);
/**
* 通过ID查找学校名称发
*/
TenantVo getSchoolNameById(@Param("id") String id);
long getSchoolNameTotal(TenantDto tenantDto);
int auditQueByIds(@Param("quIds")List<String> quIds,@Param("updater") String loginUserNickname); long getSchoolNameTotal(TenantDto tenantDto);
int auditQueByIds(@Param("quIds") List<String> quIds, @Param("updater") String loginUserNickname);
/** /**
* 批量审核试题 * 批量审核试题
*
* @param quIds * @param quIds
*/ */
int noAuditQue(@Param("quIds")List<String> quIds); int noAuditQue(@Param("quIds") List<String> quIds);
/** /**
* 根据试题id和租户id查找 试题 * 根据试题id和租户id查找 试题
*
* @param quId * @param quId
* @param source * @param source
* @return * @return
*/ */
ExamQuestion selectExamQuestionByQuIdAndTenantId(@Param("quId") String quId, @Param("source")Long source); ExamQuestion selectExamQuestionByQuIdAndTenantId(@Param("quId") String quId, @Param("source") Long source);
/** /**
* 查找所有的mqtt通道 * 查找所有的mqtt通道
*
* @return * @return
*/ */
List<String> seleAllQueueName(); List<String> seleAllQueueName();
/** /**
* 更改试题审核的审核人和审核时间 * 更改试题审核的审核人和审核时间
*
* @param loginUserNickname * @param loginUserNickname
* @param quIds * @param quIds
*/ */
@@ -155,6 +165,7 @@ public interface ExamQuestionMapper extends BaseMapperX<ExamQuestion>
/** /**
* 根据id查找试题 * 根据id查找试题
*
* @param quId * @param quId
* @return * @return
*/ */
@@ -162,6 +173,7 @@ public interface ExamQuestionMapper extends BaseMapperX<ExamQuestion>
/** /**
* 查找学校集合 * 查找学校集合
*
* @return * @return
*/ */
List<TenantVo> getSchoolNameNaPage(); List<TenantVo> getSchoolNameNaPage();
@@ -170,19 +182,21 @@ public interface ExamQuestionMapper extends BaseMapperX<ExamQuestion>
/** /**
* 根据专业、课程、题型、试题内容查找 相同的试题 * 根据专业、课程、题型、试题内容查找 相同的试题
*
* @param specialtyName 专业 * @param specialtyName 专业
* @param courseName 课程 * @param courseName 课程
* @param subjectName 题型 * @param subjectName 题型
* @param content 试题内容 * @param content 试题内容
* @return * @return
*/ */
ExamQuestion selectByTypes(@Param("specialtyName")String specialtyName ExamQuestion selectByTypes(@Param("specialtyName") String specialtyName
,@Param("courseName") String courseName , @Param("courseName") String courseName
,@Param("subjectName") String subjectName , @Param("subjectName") String subjectName
,@Param("content") String content); , @Param("content") String content);
/** /**
* 根据id查询学校名称 * 根据id查询学校名称
*
* @param loginTenantId * @param loginTenantId
* @return * @return
*/ */
@@ -190,27 +204,31 @@ public interface ExamQuestionMapper extends BaseMapperX<ExamQuestion>
/** /**
* 批量插入或更新试题 * 批量插入或更新试题
*
* @param examQuestions * @param examQuestions
*/ */
void insertOrUpdateList(List<ExamQuestion> examQuestions); void insertOrUpdateList(List<ExamQuestion> examQuestions);
/** /**
* 更改试题状态 * 更改试题状态
*
* @param quId * @param quId
* @param status * @param status
* @return * @return
*/ */
boolean changeStatus(@Param("quId") String quId boolean changeStatus(@Param("quId") String quId
,@Param("status") String status); , @Param("status") String status);
/** /**
* 查找试题表的试题数量 * 查找试题表的试题数量
*
* @return * @return
*/ */
int selectCountQu(); int selectCountQu();
/** /**
* 根据试题id找试题编号 * 根据试题id找试题编号
*
* @param cannotDeleteIds * @param cannotDeleteIds
* @return * @return
*/ */

View File

@@ -11,22 +11,22 @@ import pc.exam.pp.module.exam.controller.admin.questionexamine.vo.QuestionExamin
import pc.exam.pp.module.exam.dal.dataobject.QuestionExamineDO; import pc.exam.pp.module.exam.dal.dataobject.QuestionExamineDO;
/** /**
* 试题交互中间 Mapper * 试题交互中间 Mapper
* *
* @author 管理员 * @author 管理员
*/ */
@Mapper @Mapper
public interface QuestionExamineMapper extends BaseMapperX<QuestionExamineDO> { public interface QuestionExamineMapper extends BaseMapperX<QuestionExamineDO> {
default PageResult<QuestionExamineDO> selectPage(QuestionExaminePageReqVO reqVO) { default PageResult<QuestionExamineDO> selectPage(QuestionExaminePageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<QuestionExamineDO>() return selectPage(reqVO, new LambdaQueryWrapperX<QuestionExamineDO>()
.eqIfPresent(QuestionExamineDO::getQuId, reqVO.getQuId()) .eqIfPresent(QuestionExamineDO::getQuId, reqVO.getQuId())
.eqIfPresent(QuestionExamineDO::getSource, reqVO.getSource()) .eqIfPresent(QuestionExamineDO::getSource, reqVO.getSource())
.eqIfPresent(QuestionExamineDO::getCreateTeacher, reqVO.getCreateTeacher()) .eqIfPresent(QuestionExamineDO::getCreateTeacher, reqVO.getCreateTeacher())
.eqIfPresent(QuestionExamineDO::getType, reqVO.getType()) .eqIfPresent(QuestionExamineDO::getType, reqVO.getType())
.betweenIfPresent(QuestionExamineDO::getCreateTime, reqVO.getCreateTime()) .betweenIfPresent(QuestionExamineDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(QuestionExamineDO::getCreateTime)); .orderByDesc(QuestionExamineDO::getCreateTime));
} }
void insertOrUpdateList(List<QuestionExamineDO> questionExamineDOS); void insertOrUpdateList(List<QuestionExamineDO> questionExamineDOS);

View File

@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil;
import com.alibaba.excel.util.StringUtils; import com.alibaba.excel.util.StringUtils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.google.common.annotations.VisibleForTesting; import com.google.common.annotations.VisibleForTesting;
import jakarta.annotation.Resource;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@@ -30,6 +31,7 @@ import pc.exam.pp.module.exam.utils.rabbitmq.RabbitmqUtils;
import pc.exam.pp.module.exam.utils.uuid.IdUtils; import pc.exam.pp.module.exam.utils.uuid.IdUtils;
import pc.exam.pp.module.infra.api.config.ConfigApi; import pc.exam.pp.module.infra.api.config.ConfigApi;
import java.time.LocalDateTime;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@@ -72,7 +74,6 @@ public class ExamQuestionServiceImpl implements IExamQuestionService {
private IExamQuestionService examQuestionService; private IExamQuestionService examQuestionService;
@Autowired @Autowired
private ConfigApi configApi; private ConfigApi configApi;
/** /**
* 查询试题(hyc) * 查询试题(hyc)
* *
@@ -389,6 +390,24 @@ public class ExamQuestionServiceImpl implements IExamQuestionService {
for (ExamQuestion examQuestion : list) { for (ExamQuestion examQuestion : list) {
String pointIdStr = examQuestion.getPointNames(); String pointIdStr = examQuestion.getPointNames();
String chapterIdStr = examQuestion.getChapteridDictText(); String chapterIdStr = examQuestion.getChapteridDictText();
// 试题归属
if (examQuestion.getSchoolId() == null || examQuestion.getSchoolId().isEmpty()) {
// 说明是中心服务器的数据
examQuestion.setSchoolName("中心服务器");
} else {
String schoolId = examQuestion.getSchoolId();
String schoolName = null;
if (!schoolId.equals("1")) {
// 通过ID查询学校名称存放在数据中返回页面使用
TenantVo schoolInfo = examQuestionMapper.getSchoolNameById(schoolId);
schoolName = schoolInfo.getName();
} else {
schoolName = "中心服务器";
}
examQuestion.setSchoolName(schoolName);
}
// 试题创建人
examQuestion.setCreateTeacher(examQuestion.getCreator());
try { try {
if (pointIdStr != null) { if (pointIdStr != null) {
Long pointId = Long.valueOf(pointIdStr); Long pointId = Long.valueOf(pointIdStr);
@@ -431,7 +450,6 @@ public class ExamQuestionServiceImpl implements IExamQuestionService {
examQuestion_obj.setType(rabbitMQSendInfoVO.getType()); examQuestion_obj.setType(rabbitMQSendInfoVO.getType());
examQuestion_obj.setSource(SecurityFrameworkUtils.getLoginTenantId()); examQuestion_obj.setSource(SecurityFrameworkUtils.getLoginTenantId());
examQuestion_obj.setCreateTeacher(examQuestion_obj.getCreator()); examQuestion_obj.setCreateTeacher(examQuestion_obj.getCreator());
System.out.println(rabbitMQSendInfoVO.getQueueName());
// 3、上传至Rabbitmq // 3、上传至Rabbitmq
rabbitMqService.sendMessage(rabbitMQSendInfoVO.getQueueName(), examQuestion_obj); rabbitMqService.sendMessage(rabbitMQSendInfoVO.getQueueName(), examQuestion_obj);
} }
@@ -580,6 +598,7 @@ public class ExamQuestionServiceImpl implements IExamQuestionService {
// TODO 1、拉取数据保存至数据库 2、回调服务器是否拉取成功中心服务器 // TODO 1、拉取数据保存至数据库 2、回调服务器是否拉取成功中心服务器
// 1、获取上传的rabbit的试题数组 // 1、获取上传的rabbit的试题数组
List<ExamQuestion> examQuestions = null; List<ExamQuestion> examQuestions = null;
List<ExamQuestion> insertExam = new ArrayList<>();
try { try {
examQuestions = rabbitMqService.receiveAllMessages(queueName); examQuestions = rabbitMqService.receiveAllMessages(queueName);
} catch (Exception e) { } catch (Exception e) {
@@ -587,12 +606,27 @@ public class ExamQuestionServiceImpl implements IExamQuestionService {
} }
if (examQuestions != null && examQuestions.size() > 0) { if (examQuestions != null && examQuestions.size() > 0) {
for (ExamQuestion examQuestion : examQuestions) { for (ExamQuestion examQuestion : examQuestions) {
ExamQuestion question = examQuestionMapper.selectExamQuestionCountByQuId(examQuestion.getQuBankId()); ExamQuestion question = examQuestionMapper.selectExamQuestionCountByQuId(examQuestion.getQuBankId());
if (question == null) { if (question == null) {
//如果没有,就是新增 //如果没有,就是新增
String quId = IdUtils.simpleUUID(); String quId = IdUtils.simpleUUID();
examQuestion.setQuId(quId); examQuestion.setQuId(quId);
// 判断试题归属于中心服务器还是考点服务器
if (examQuestion.getSchoolId() == null || examQuestion.getSchoolId().isEmpty()) {
examQuestion.setSchoolId("1");
} else {
examQuestion.setSchoolId(examQuestion.getSchoolId());
}
examQuestion.setCreator(examQuestion.getCreator());
examQuestion.setCreateTime(LocalDateTime.now());
examQuestion.setUpdateTime(LocalDateTime.now());
// 判断上传的试题类型是需要审核还是不需要审核的
if (queueName.split("_")[0].equals("1")) {
// 中心服務器推送到考點服務器,默認審核是通過的
examQuestion.setAudit(String.valueOf(0));
} else {
examQuestion.setAudit(String.valueOf(1));
}
Long loginTenantId = SecurityFrameworkUtils.getLoginTenantId(); Long loginTenantId = SecurityFrameworkUtils.getLoginTenantId();
int count = examQuestionMapper.selectCountQu(); int count = examQuestionMapper.selectCountQu();
// 读取系统创建试题位数设置 // 读取系统创建试题位数设置
@@ -601,7 +635,6 @@ public class ExamQuestionServiceImpl implements IExamQuestionService {
String formattedNumber = String.format("%0" + number + "d", ++count); String formattedNumber = String.format("%0" + number + "d", ++count);
String quNum = loginTenantId + "-" + formattedNumber; String quNum = loginTenantId + "-" + formattedNumber;
examQuestion.setQuNum(quNum); examQuestion.setQuNum(quNum);
//新增 //新增
List<ExamQuestionAnswer> answerList = examQuestion.getAnswerList(); List<ExamQuestionAnswer> answerList = examQuestion.getAnswerList();
List<ExamQuestionFile> fileUploads = examQuestion.getFileUploads(); List<ExamQuestionFile> fileUploads = examQuestion.getFileUploads();
@@ -643,19 +676,22 @@ public class ExamQuestionServiceImpl implements IExamQuestionService {
}); });
examQuestionKeywordMapper.insertExamQuestionKeywordList(questionKeywords); examQuestionKeywordMapper.insertExamQuestionKeywordList(questionKeywords);
} }
examQuestionMapper.insert(insertExam);
} }
//有就是覆盖 //有就是覆盖
else { else {
examQuestion.setQuId(question.getQuId()); examQuestion.setQuId(question.getQuId());
examQuestion.setQuNum(question.getQuNum()); examQuestion.setQuNum(question.getQuNum());
examQuestion.setSchoolId(question.getSchoolId());
// 更新的时候只更新更新人,不更新创建人
examQuestion.setCreator(examQuestion.getCreator());
examQuestion.setUpdater(examQuestion.getCreator());
examQuestion.setUpdateTime(LocalDateTime.now());
String quId = question.getQuId(); String quId = question.getQuId();
examQuestionAnswerMapper.deleteExamQuestionAnswerByQuesId(quId); examQuestionAnswerMapper.deleteExamQuestionAnswerByQuesId(quId);
sysFileMapper.deleteSysFileByQuesId(quId); sysFileMapper.deleteSysFileByQuesId(quId);
examQuestionScoreMapper.deleteExamQuestionScoreByQuesId(quId); examQuestionScoreMapper.deleteExamQuestionScoreByQuesId(quId);
examQuestionKeywordMapper.deleteExamQuestionScoreByQuesId(quId); examQuestionKeywordMapper.deleteExamQuestionScoreByQuesId(quId);
//新增 //新增
List<ExamQuestionAnswer> answerList = examQuestion.getAnswerList(); List<ExamQuestionAnswer> answerList = examQuestion.getAnswerList();
List<ExamQuestionFile> fileUploads = examQuestion.getFileUploads(); List<ExamQuestionFile> fileUploads = examQuestion.getFileUploads();
@@ -697,14 +733,11 @@ public class ExamQuestionServiceImpl implements IExamQuestionService {
}); });
examQuestionKeywordMapper.insertExamQuestionKeywordList(questionKeywords); examQuestionKeywordMapper.insertExamQuestionKeywordList(questionKeywords);
} }
examQuestionMapper.updateBatch(examQuestion);
} }
} }
examQuestionMapper.insertOrUpdateList(examQuestions);
} }
return true; return true;
} }
@@ -714,11 +747,11 @@ public class ExamQuestionServiceImpl implements IExamQuestionService {
List<String> quIds = rabbitMQSendInfoVO.getQuIds(); List<String> quIds = rabbitMQSendInfoVO.getQuIds();
if (quIds != null && quIds.size() > 0) { if (quIds != null && quIds.size() > 0) {
for (String quId : quIds) { for (String quId : quIds) {
QuestionExamineDO questionExamineDO = questionExamineMapper.selectById(quId); // QuestionExamineDO questionExamineDO = questionExamineMapper.selectById(quId);
// 2、根据试题ID和租户查找试题详情 // 2、根据试题ID和租户查找试题详情
ExamQuestion examQuestion_obj = examQuestionMapper.selectExamQuestionByQuId(quId); ExamQuestion examQuestion_obj = examQuestionMapper.selectExamQuestionByQuId(quId);
// 更新創建人
examQuestion_obj.setCreator(SecurityFrameworkUtils.getLoginUserNickname());
//查找试题答案 //查找试题答案
List<ExamQuestionAnswer> examQuestionAnswers = examQuestionAnswerMapper.selectExamQuestionAnswerByQuId(quId); List<ExamQuestionAnswer> examQuestionAnswers = examQuestionAnswerMapper.selectExamQuestionAnswerByQuId(quId);
//查找试题文件 //查找试题文件
@@ -728,7 +761,6 @@ public class ExamQuestionServiceImpl implements IExamQuestionService {
//获取试题关键字 //获取试题关键字
List<ExamQuestionKeyword> examQuestionKeywords = examQuestionKeywordMapper.selectExamQuestionKeywordByQuId(quId); List<ExamQuestionKeyword> examQuestionKeywords = examQuestionKeywordMapper.selectExamQuestionKeywordByQuId(quId);
if (examQuestion_obj != null) { if (examQuestion_obj != null) {
if (examQuestionAnswers != null && examQuestionAnswers.size() > 0) { if (examQuestionAnswers != null && examQuestionAnswers.size() > 0) {
examQuestion_obj.setAnswerList(examQuestionAnswers); examQuestion_obj.setAnswerList(examQuestionAnswers);
@@ -743,10 +775,11 @@ public class ExamQuestionServiceImpl implements IExamQuestionService {
examQuestion_obj.setQuestionKeywords(examQuestionKeywords); examQuestion_obj.setQuestionKeywords(examQuestionKeywords);
} }
} }
// examQuestion_obj.setType(rabbitMQSendInfoVO.getType()); // examQuestion_obj.setType(rabbitMQSendInfoVO.getType());
// examQuestion_obj.setSource(SecurityFrameworkUtils.getLoginTenantId()); // examQuestion_obj.setSource(SecurityFrameworkUtils.getLoginTenantId());
// examQuestion_obj.setCreateTeacher(SecurityFrameworkUtils.getLoginUserNickname()); // examQuestion_obj.setCreateTeacher(SecurityFrameworkUtils.getLoginUserNickname());
// 判断上传的试题类型是需要审核还是不需要审核的 0不需要 1需要
examQuestion_obj.setQuestionType(rabbitMQSendInfoVO.getType());
// 3、上传至Rabbitmq // 3、上传至Rabbitmq
rabbitMqService.sendMessage(rabbitMQSendInfoVO.getQueueName(), examQuestion_obj); rabbitMqService.sendMessage(rabbitMQSendInfoVO.getQueueName(), examQuestion_obj);
} }
@@ -981,6 +1014,36 @@ public class ExamQuestionServiceImpl implements IExamQuestionService {
return examQuestionAnswers; return examQuestionAnswers;
} }
@Override
public boolean auditQuestion(AudioQuestionVo audioQuestionVo) {
List<ExamQuestion> examQuestions = new ArrayList<>();
// 判断是审核通过还是不通过
for (String quId : audioQuestionVo.getQuIds()) {
// 更新字段
// 通过ID查询数据
ExamQuestion examQuestion = examQuestionMapper.selectExamQuestionByQuId(quId);
examQuestion.setAudit(audioQuestionVo.getType().equals("True") ? "0" : "3");
examQuestionMapper.updateExamQuestion(examQuestion);
examQuestions.add(examQuestion);
}
// 通知上报的考点服务器
for (ExamQuestion examQuestion : examQuestions) {
// 获取试题的归属新校ID并拼接成通道名称
if (examQuestion.getSchoolId() != null && !examQuestion.getSchoolId().isEmpty() && !examQuestion.getSchoolId().equals("1")) {
// 非中心服务器试题要同步到对应的考点服务器
String queueNames = examQuestion.getSchoolId() + "_Queue";
List<String> questionIds = new ArrayList<>();
questionIds.add(examQuestion.getQuId());
RabbitMQSendInfoVO rabbitMQSendInfoVO = new RabbitMQSendInfoVO();
rabbitMQSendInfoVO.setType("0");
rabbitMQSendInfoVO.setQuIds(questionIds);
rabbitMQSendInfoVO.setQueueName(queueNames);
uploadExamQuestionToRabbitMQBySource(rabbitMQSendInfoVO);
}
}
return true;
}
private void validateChoice(String a, String b, String c, String d, String answer) { private void validateChoice(String a, String b, String c, String d, String answer) {
// A 和 B 必须存在 // A 和 B 必须存在
if (StringUtils.isBlank(a) || StringUtils.isBlank(b)) { if (StringUtils.isBlank(a) || StringUtils.isBlank(b)) {

View File

@@ -3,10 +3,7 @@ package pc.exam.pp.module.exam.service.question;
import pc.exam.pp.framework.common.pojo.PageResult; 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.dto.ExamQuestionDto;
import pc.exam.pp.module.exam.controller.admin.question.dto.TenantDto; import pc.exam.pp.module.exam.controller.admin.question.dto.TenantDto;
import pc.exam.pp.module.exam.controller.admin.question.vo.QueImportRespVO; import pc.exam.pp.module.exam.controller.admin.question.vo.*;
import pc.exam.pp.module.exam.controller.admin.question.vo.QuemportExcelVO;
import pc.exam.pp.module.exam.controller.admin.question.vo.QuestionVo;
import pc.exam.pp.module.exam.controller.admin.question.vo.TenantVo;
import pc.exam.pp.module.exam.controller.admin.questionexamine.vo.QuestionExaminePageReqVO; import pc.exam.pp.module.exam.controller.admin.questionexamine.vo.QuestionExaminePageReqVO;
import pc.exam.pp.module.exam.controller.admin.rabbitmq.vo.RabbitMQSendInfoVO; import pc.exam.pp.module.exam.controller.admin.rabbitmq.vo.RabbitMQSendInfoVO;
import pc.exam.pp.module.exam.dal.dataobject.EducationPaperTask; import pc.exam.pp.module.exam.dal.dataobject.EducationPaperTask;
@@ -109,4 +106,7 @@ public interface IExamQuestionService
PageResult<ExamQuestion> selectExamQuestionListAnswer(QuestionVo questionVo); PageResult<ExamQuestion> selectExamQuestionListAnswer(QuestionVo questionVo);
List<ExamQuestionAnswer> getPointById(String quId); List<ExamQuestionAnswer> getPointById(String quId);
// 试题审核
boolean auditQuestion(AudioQuestionVo audioQuestionVo);
} }

View File

@@ -1,40 +1,41 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper <!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="pc.exam.pp.module.exam.dal.mysql.question.ExamQuestionMapper"> <mapper namespace="pc.exam.pp.module.exam.dal.mysql.question.ExamQuestionMapper">
<resultMap type="ExamQuestion" id="ExamQuestionResult"> <resultMap type="ExamQuestion" id="ExamQuestionResult">
<result property="quId" column="qu_id" /> <result property="quId" column="qu_id"/>
<result property="quBankId" column="qu_bank_id" /> <result property="quBankId" column="qu_bank_id"/>
<result property="quNum" column="qu_num" /> <result property="quNum" column="qu_num"/>
<result property="quBankName" column="qu_bank_name" /> <result property="quBankName" column="qu_bank_name"/>
<result property="chapteridDictText" column="chapterId_dict_text" /> <result property="chapteridDictText" column="chapterId_dict_text"/>
<result property="subjectName" column="subject_name" /> <result property="subjectName" column="subject_name"/>
<result property="quLevel" column="qu_level" /> <result property="quLevel" column="qu_level"/>
<result property="content" column="content" /> <result property="content" column="content"/>
<result property="contentText" column="content_text" /> <result property="contentText" column="content_text"/>
<result property="answer" column="answer" /> <result property="answer" column="answer"/>
<result property="analysis" column="analysis" /> <result property="analysis" column="analysis"/>
<result property="pointNames" column="point_names" /> <result property="pointNames" column="point_names"/>
<result property="keywords" column="keywords" /> <result property="keywords" column="keywords"/>
<result property="manual" column="manual" /> <result property="manual" column="manual"/>
<result property="createTime" column="create_time" /> <result property="createTime" column="create_time"/>
<result property="creator" column="creator" /> <result property="creator" column="creator"/>
<result property="updateTime" column="update_time" /> <result property="updateTime" column="update_time"/>
<result property="updater" column="updater" /> <result property="updater" column="updater"/>
<result property="deleted" column="deleted" /> <result property="deleted" column="deleted"/>
<result property="status" column="status" /> <result property="status" column="status"/>
<result property="audit" column="audit" /> <result property="audit" column="audit"/>
<result property="tname" column="tname" /> <result property="tname" column="tname"/>
<result property="courseName" column="course_name" /> <result property="schoolId" column="school_id"/>
<result property="specialtyName" column="specialty_name" /> <result property="courseName" column="course_name"/>
<result property="tenantId" column="tenant_id" /> <result property="specialtyName" column="specialty_name"/>
<result property="tenantId" column="tenant_id"/>
<!-- 嵌套答案列表 --> <!-- 嵌套答案列表 -->
<collection property="answerList" ofType="pc.exam.pp.module.exam.dal.dataobject.ExamQuestionAnswer"> <collection property="answerList" ofType="pc.exam.pp.module.exam.dal.dataobject.ExamQuestionAnswer">
<id property="answerId" column="answer_id"/> <id property="answerId" column="answer_id"/>
<result property="quId" column="a_qu_id"/> <result property="quId" column="a_qu_id"/>
<result property="isRight" column="is_right"/> <result property="isRight" column="is_right"/>
<result property="image" column="image"/> <result property="image" column="image"/>
@@ -45,17 +46,40 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</collection> </collection>
</resultMap> </resultMap>
<resultMap type="pc.exam.pp.module.exam.controller.admin.question.vo.TenantVo" id="TenantVoResult"> <resultMap type="pc.exam.pp.module.exam.controller.admin.question.vo.TenantVo" id="TenantVoResult">
<result property="id" column="id" /> <result property="id" column="id"/>
<result property="name" column="name" /> <result property="name" column="name"/>
<result property="ququeName" column="queue_name" /> <result property="ququeName" column="queue_name"/>
</resultMap> </resultMap>
<sql id="selectExamQuestionVo"> <sql id="selectExamQuestionVo">
select qu_id, qu_bank_id, qu_num,qu_bank_name, chapterId_dict_text,subject_name, qu_level, select qu_id,
content, content_text, analysis,answer, point_names, keywords, manual, create_time, creator, update_time, updater, deleted ,status,audit ,course_name, specialty_name , tname from exam_question qu_bank_id,
qu_num,
qu_bank_name,
chapterId_dict_text,
subject_name,
qu_level,
content,
content_text,
analysis,
answer,
point_names,
keywords,
manual,
create_time,
creator,
update_time,
updater,
deleted,
status,
audit,
course_name,
specialty_name,
tname,
school_id
from exam_question
</sql> </sql>
<select id="selectExamQuestionByQuId" parameterType="String" resultMap="ExamQuestionResult"> <select id="selectExamQuestionByQuId" parameterType="String" resultMap="ExamQuestionResult">
<include refid="selectExamQuestionVo"/> <include refid="selectExamQuestionVo"/>
where qu_id = #{quId} where qu_id = #{quId}
@@ -63,7 +87,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectExamQuestionListByQuIds" resultMap="ExamQuestionResult"> <select id="selectExamQuestionListByQuIds" resultMap="ExamQuestionResult">
SELECT SELECT
q.*, -- exam_question 表字段 q.*, -- exam_question 表字段
a.answer_id, a.answer_id,
a.qu_id AS a_qu_id, a.qu_id AS a_qu_id,
a.is_right, a.is_right,
@@ -85,12 +109,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="getSchoolName" resultMap="TenantVoResult"> <select id="getSchoolName" resultMap="TenantVoResult">
SELECT id, name, queue_name SELECT id, name, queue_name
FROM system_tenant FROM system_tenant
WHERE deleted = 0 WHERE deleted = 0
<if test="name != null and name != ''"> <if test="name != null and name != ''">
AND name LIKE CONCAT('%', #{name}, '%') AND name LIKE CONCAT('%', #{name}, '%')
</if> </if>
LIMIT #{pageSize} OFFSET #{offset} LIMIT #{pageSize} OFFSET #{offset}
</select> </select>
<select id="getSchoolNameById" resultType="pc.exam.pp.module.exam.controller.admin.question.vo.TenantVo">
SELECT id, name, queue_name
FROM system_tenant
WHERE deleted = 0 and id = #{id}
</select>
<select id="getSchoolNameTotal" resultType="java.lang.Long"> <select id="getSchoolNameTotal" resultType="java.lang.Long">
SELECT count(*) SELECT count(*)
FROM system_tenant FROM system_tenant
@@ -102,37 +133,44 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectExamQuestionByQuIdAndTenantId" <select id="selectExamQuestionByQuIdAndTenantId"
resultMap="ExamQuestionResult"> resultMap="ExamQuestionResult">
<include refid="selectExamQuestionVo"/> <include refid="selectExamQuestionVo"/>
where qu_id = #{quId} and tenant_id= #{source} where qu_id = #{quId} and tenant_id= #{source}
</select> </select>
<select id="seleAllQueueName" resultType="java.lang.String"> <select id="seleAllQueueName" resultType="java.lang.String">
SELECT queue_name SELECT queue_name
FROM system_tenant FROM system_tenant
WHERE deleted = 0 WHERE deleted = 0
</select> </select>
<select id="selectExamQuestionCountByQuId" resultMap="ExamQuestionResult"> <select id="selectExamQuestionCountByQuId" resultMap="ExamQuestionResult">
select * from exam_question where qu_bank_id=#{quId} select *
from exam_question
where qu_bank_id = #{quId} and deleted = 0
</select> </select>
<select id="getSchoolNameNaPage" resultMap="TenantVoResult"> <select id="getSchoolNameNaPage" resultMap="TenantVoResult">
SELECT id, name, queue_name SELECT id, name, queue_name
FROM system_tenant FROM system_tenant
WHERE deleted = 0 WHERE deleted = 0
</select> </select>
<select id="selectTenantId" resultType="java.lang.Long"> <select id="selectTenantId" resultType="java.lang.Long">
select tenant_id from system_users limit 1 select tenant_id
from system_users limit 1
</select> </select>
<select id="selectByTypes" resultMap="ExamQuestionResult"> <select id="selectByTypes" resultMap="ExamQuestionResult">
select * from exam_question where specialty_name =#{specialtyName} select *
and course_name=#{courseName} from exam_question
and subject_name =#{subjectName} where specialty_name = #{specialtyName}
and content =#{content} and course_name = #{courseName}
limit 1; and subject_name = #{subjectName}
and content = #{content} limit 1;
</select> </select>
<select id="selectSchoolnameBytId" resultType="java.lang.String"> <select id="selectSchoolnameBytId" resultType="java.lang.String">
select name from system_tenant where id =#{loginTenantId} select name
from system_tenant
where id = #{loginTenantId}
</select> </select>
<select id="selectCountQu" resultType="java.lang.Integer"> <select id="selectCountQu" resultType="java.lang.Integer">
select count(*) from exam_question select count(*)
from exam_question
</select> </select>
<select id="selectQuNumBuIds" resultType="java.lang.String"> <select id="selectQuNumBuIds" resultType="java.lang.String">
select qu_num from exam_question where qu_id select qu_num from exam_question where qu_id
@@ -170,6 +208,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="audit != null">audit,</if> <if test="audit != null">audit,</if>
<if test="courseName != null">course_name,</if> <if test="courseName != null">course_name,</if>
<if test="specialtyName != null">specialty_name,</if> <if test="specialtyName != null">specialty_name,</if>
<if test="schoolId != null">school_id,</if>
<if test="tenantId != null">tenant_id,</if> <if test="tenantId != null">tenant_id,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
@@ -197,19 +236,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="audit != null">#{audit},</if> <if test="audit != null">#{audit},</if>
<if test="courseName != null">#{courseName},</if> <if test="courseName != null">#{courseName},</if>
<if test="specialtyName != null">#{specialtyName},</if> <if test="specialtyName != null">#{specialtyName},</if>
<if test="schoolId != null">#{schoolId},</if>
<if test="tenantId != null">#{tenantId},</if> <if test="tenantId != null">#{tenantId},</if>
</trim> </trim>
</insert> </insert>
<insert id="insertOrUpdateList"> <insert id="insertOrUpdateList">
INSERT INTO exam_question (qu_id, qu_bank_id,tname, qu_num,chapterId_dict_text, subject_name,specialty_name, INSERT INTO exam_question (qu_id, qu_bank_id,tname, qu_num,chapterId_dict_text, subject_name,specialty_name,
course_name, qu_level, content, audit, status, content_text, analysis, point_names, keywords, manual) course_name, qu_level, content, audit, status, content_text, analysis, point_names, keywords, manual, school_id,
create_time, creator, update_time, updater)
VALUES VALUES
<foreach collection="collection" item="item" separator=","> <foreach collection="collection" item="item" separator=",">
(#{item.quId}, #{item.quBankId},#{item.tname},#{item.quNum}, #{item.chapteridDictText}, #{item.subjectName}, (#{item.quId}, #{item.quBankId},#{item.tname},#{item.quNum}, #{item.chapteridDictText}, #{item.subjectName},
#{item.specialtyName}, #{item.courseName}, #{item.quLevel}, #{item.content}, #{item.audit} #{item.specialtyName}, #{item.courseName}, #{item.quLevel}, #{item.content}, #{item.audit}
, #{item.status}, #{item.contentText}, #{item.analysis}, #{item.pointNames}, #{item.keywords}, , #{item.status}, #{item.contentText}, #{item.analysis}, #{item.pointNames}, #{item.keywords},
#{item.manual}) #{item.manual}, #{item.schoolId}, #{createTime}, #{creator}, #{updateTime}, #{updater})
</foreach> </foreach>
ON DUPLICATE KEY UPDATE ON DUPLICATE KEY UPDATE
tname = VALUES(tname), tname = VALUES(tname),
@@ -225,8 +266,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
analysis = VALUES(analysis), analysis = VALUES(analysis),
point_names = VALUES(point_names), point_names = VALUES(point_names),
keywords = VALUES(keywords), keywords = VALUES(keywords),
manual = VALUES(manual); manual = VALUES(manual),
school_id = VALUES(school_id),
create_time = VALUES(create_time),
creator = VALUES(creator),
update_time = VALUES(update_time),
updater = VALUES(updater)
</insert> </insert>
<update id="updateExamQuestion" parameterType="ExamQuestion"> <update id="updateExamQuestion" parameterType="ExamQuestion">
@@ -254,21 +299,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="audit != null">audit = #{audit},</if> <if test="audit != null">audit = #{audit},</if>
<if test="courseName != null">course_name = #{courseName},</if> <if test="courseName != null">course_name = #{courseName},</if>
<if test="specialtyName != null">specialty_name = #{specialtyName},</if> <if test="specialtyName != null">specialty_name = #{specialtyName},</if>
<if test="schoolId != null">school_id = #{schoolId},</if>
<if test="tenantId != null">tenant_id = #{tenantId},</if> <if test="tenantId != null">tenant_id = #{tenantId},</if>
</trim> </trim>
where qu_id = #{quId} where qu_id = #{quId}
</update> </update>
<delete id="deleteExamQuestionByQuId" parameterType="String"> <delete id="deleteExamQuestionByQuId" parameterType="String">
UPDATE exam_question set deleted ='2' where qu_id = #{quId} UPDATE exam_question
set deleted ='2'
where qu_id = #{quId}
</delete> </delete>
<update id="deleteExamQuestionByQuIds"> <update id="deleteExamQuestionByQuIds">
UPDATE exam_question UPDATE exam_question
SET deleted = '2' SET deleted = '2'
WHERE qu_id IN WHERE qu_id IN
<foreach collection="ids" item="id" open="(" separator="," close=")"> <foreach collection="ids" item="id" open="(" separator="," close=")">
#{id} #{id}
</foreach> </foreach>
</update> </update>
@@ -281,36 +329,36 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach> </foreach>
</update> </update>
<update id="auditQueByIds"> <update id="auditQueByIds">
UPDATE exam_question UPDATE exam_question
SET audit = '0' SET audit = '0'
WHERE qu_id IN WHERE qu_id IN
<foreach collection="quIds" item="id" open="(" separator="," close=")"> <foreach collection="quIds" item="id" open="(" separator="," close=")">
#{id} #{id}
</foreach> </foreach>
</update> </update>
<update id="noAuditQue"> <update id="noAuditQue">
UPDATE exam_question UPDATE exam_question
SET audit = '3' SET audit = '3'
WHERE qu_id IN WHERE qu_id IN
<foreach collection="quIds" item="id" open="(" separator="," close=")"> <foreach collection="quIds" item="id" open="(" separator="," close=")">
#{id} #{id}
</foreach> </foreach>
</update> </update>
<update id="updateExamQuestionByIds"> <update id="updateExamQuestionByIds">
UPDATE education_question_examine UPDATE education_question_examine
SET updater = #{updater}, SET updater = #{updater},
update_time = now() update_time = now()
WHERE qu_id IN WHERE qu_id IN
<foreach collection="quIds" item="id" open="(" separator="," close=")"> <foreach collection="quIds" item="id" open="(" separator="," close=")">
#{id} #{id}
</foreach> </foreach>
</update> </update>
<update id="changeStatus"> <update id="changeStatus">
UPDATE exam_question UPDATE exam_question
set status =#{status} set status =#{status}
where qu_id =#{quId} where qu_id = #{quId}
</update> </update>