【修改】 试题推送、审核,相关
This commit is contained in:
@@ -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.QuStatusDto;
|
||||
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.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.question.vo.*;
|
||||
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.ExamQuestion;
|
||||
@@ -45,16 +42,15 @@ import static pc.exam.pp.module.system.enums.ErrorCodeConstants.QESESTION_AUDIT_
|
||||
|
||||
/**
|
||||
* 试题(hyc)Controller
|
||||
*
|
||||
*
|
||||
* @author pengchen
|
||||
* @date 2025-03-13
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/exam/question")
|
||||
@Tag( name = "试题管理接口")
|
||||
@Tag(name = "试题管理接口")
|
||||
@Validated
|
||||
public class ExamQuestionController
|
||||
{
|
||||
public class ExamQuestionController {
|
||||
@Resource
|
||||
private IExamQuestionService examQuestionService;
|
||||
|
||||
@@ -63,30 +59,30 @@ public class ExamQuestionController
|
||||
*/
|
||||
//@PreAuthorize("@ss.hasPermi('system:question:list')")
|
||||
@GetMapping("/list")
|
||||
public CommonResult<PageResult<ExamQuestion>> list(QuestionVo questionVo)
|
||||
{
|
||||
public CommonResult<PageResult<ExamQuestion>> list(QuestionVo questionVo) {
|
||||
PageResult<ExamQuestion> pageResult = examQuestionService.selectExamQuestionList(questionVo);
|
||||
return success(pageResult);
|
||||
}
|
||||
|
||||
@GetMapping("/listAnswer")
|
||||
public CommonResult<PageResult<ExamQuestion>> listAnswer(QuestionVo questionVo)
|
||||
{
|
||||
public CommonResult<PageResult<ExamQuestion>> listAnswer(QuestionVo questionVo) {
|
||||
PageResult<ExamQuestion> pageResult = examQuestionService.selectExamQuestionListAnswer(questionVo);
|
||||
return success(pageResult);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询除了审核状态通过的其他状态的试题(试题推送)
|
||||
*
|
||||
* @param questionVo
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/sendList")
|
||||
public CommonResult<PageResult<ExamQuestion>> sendList(QuestionVo questionVo)
|
||||
{
|
||||
public CommonResult<PageResult<ExamQuestion>> sendList(QuestionVo questionVo) {
|
||||
PageResult<ExamQuestion> pageResult;
|
||||
if (StringUtils.isNotBlank(questionVo.getAudit())){
|
||||
pageResult= examQuestionService.selectExamQuestionList(questionVo);
|
||||
}else {
|
||||
pageResult = examQuestionService.selectExamQuestionListSend(questionVo);
|
||||
if (StringUtils.isNotBlank(questionVo.getAudit())) {
|
||||
pageResult = examQuestionService.selectExamQuestionList(questionVo);
|
||||
} else {
|
||||
pageResult = examQuestionService.selectExamQuestionListSend(questionVo);
|
||||
}
|
||||
|
||||
return success(pageResult);
|
||||
@@ -94,14 +90,14 @@ public class ExamQuestionController
|
||||
|
||||
/**
|
||||
* 查询试题(试题审核)
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/auditList")
|
||||
@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);
|
||||
|
||||
@@ -126,27 +122,26 @@ public class ExamQuestionController
|
||||
*/
|
||||
//@PreAuthorize("@ss.hasPermi('system:question:query')")
|
||||
@GetMapping(value = "/{quId}")
|
||||
public CommonResult<ExamQuestion> getInfo(@PathVariable("quId") String quId)
|
||||
{
|
||||
public CommonResult<ExamQuestion> getInfo(@PathVariable("quId") String quId) {
|
||||
return success(examQuestionService.selectExamQuestionByQuId(quId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取试题(hyc)详细信息 无租户id
|
||||
*/
|
||||
//@PreAu
|
||||
@GetMapping(value = "/notId/{quId}")
|
||||
@TenantIgnore
|
||||
public CommonResult<ExamQuestion> getInfoNotId(@PathVariable("quId") String quId)
|
||||
{
|
||||
public CommonResult<ExamQuestion> getInfoNotId(@PathVariable("quId") String quId) {
|
||||
return success(examQuestionService.selectExamQuestionByQuId(quId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增试题(hyc)
|
||||
*/
|
||||
//@PreAuthorize("@ss.hasPermi('system:question:add')")
|
||||
@PostMapping
|
||||
public CommonResult add(@RequestBody ExamQuestion examQuestion)
|
||||
{
|
||||
public CommonResult add(@RequestBody ExamQuestion examQuestion) {
|
||||
return success(examQuestionService.insertExamQuestion(examQuestion));
|
||||
}
|
||||
|
||||
@@ -155,9 +150,8 @@ public class ExamQuestionController
|
||||
* 修改试题(hyc)
|
||||
*/
|
||||
@PutMapping
|
||||
public CommonResult edit(@RequestBody ExamQuestion examQuestion)
|
||||
{
|
||||
return success(examQuestionService.updateExamQuestion(examQuestion));
|
||||
public CommonResult edit(@RequestBody ExamQuestion examQuestion) {
|
||||
return success(examQuestionService.updateExamQuestion(examQuestion));
|
||||
}
|
||||
|
||||
|
||||
@@ -166,16 +160,15 @@ public class ExamQuestionController
|
||||
*/
|
||||
@PutMapping("/NoAudit")
|
||||
@TenantIgnore
|
||||
public CommonResult editNoAudit(@RequestBody ExamQuestion examQuestion)
|
||||
{
|
||||
public CommonResult editNoAudit(@RequestBody ExamQuestion examQuestion) {
|
||||
return success(examQuestionService.updateExamQuestion(examQuestion));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除试题(hyc)
|
||||
*/
|
||||
@DeleteMapping("/{ids}")
|
||||
public CommonResult remove(@PathVariable String[] ids)
|
||||
{
|
||||
public CommonResult remove(@PathVariable String[] ids) {
|
||||
return success(examQuestionService.deleteExamQuestionByQuIds(ids));
|
||||
}
|
||||
|
||||
@@ -206,28 +199,30 @@ public class ExamQuestionController
|
||||
|
||||
|
||||
/**
|
||||
*获得学校分页列表
|
||||
* 获得学校分页列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getSchoolName")
|
||||
@TenantIgnore
|
||||
public CommonResult<PageResult<TenantVo>> getSchoolName(TenantDto tenantDto)
|
||||
{
|
||||
public CommonResult<PageResult<TenantVo>> getSchoolName(TenantDto tenantDto) {
|
||||
return success(examQuestionService.getSchoolName(tenantDto));
|
||||
}
|
||||
|
||||
/**
|
||||
*获得学校分页列表(不分页)
|
||||
* 获得学校分页列表(不分页)
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getSchoolNameNopage")
|
||||
@TenantIgnore
|
||||
public CommonResult<List<TenantVo>> getSchoolNameNaPage()
|
||||
{
|
||||
public CommonResult<List<TenantVo>> getSchoolNameNaPage() {
|
||||
return success(examQuestionService.getSchoolNameNaPage());
|
||||
}
|
||||
|
||||
/**
|
||||
* 服务端审核通过试题
|
||||
*
|
||||
* @param quIds
|
||||
* @return
|
||||
*/
|
||||
@@ -238,17 +233,18 @@ public class ExamQuestionController
|
||||
return CommonResult.error(QESESTION_NOT_NULL);
|
||||
}
|
||||
int b = examQuestionService.auditQueByIds(quIds);
|
||||
if (b>0){
|
||||
if (b > 0) {
|
||||
return success("审核成功");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return error(QESESTION_AUDIT_ERROR);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 服务端审核不通过试题
|
||||
*
|
||||
* @param quIds
|
||||
* @return
|
||||
*/
|
||||
@@ -259,16 +255,17 @@ public class ExamQuestionController
|
||||
return CommonResult.error(QESESTION_NOT_NULL);
|
||||
}
|
||||
int b = examQuestionService.noAuditQue(quIds);
|
||||
if (b>0){
|
||||
if (b > 0) {
|
||||
return success("操作成功");
|
||||
|
||||
}else {
|
||||
} else {
|
||||
return error(QESESTION_AUDIT_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更改试题状态
|
||||
*
|
||||
* @param quStatusDto
|
||||
* @return
|
||||
*/
|
||||
@@ -280,7 +277,13 @@ public class ExamQuestionController
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 审核试题
|
||||
*/
|
||||
@PostMapping("/auditQuestion")
|
||||
public CommonResult<Boolean> audit(@RequestBody AudioQuestionVo audioQuestionVo) {
|
||||
return CommonResult.success(examQuestionService.auditQuestion(audioQuestionVo));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
@@ -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.tenant.core.aop.TenantIgnore;
|
||||
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.RabbitMQSendInfoVO;
|
||||
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
|
||||
@RequestMapping("/rabbitmq")
|
||||
@Tag( name = "rabbitmq 消息队列")
|
||||
@Tag(name = "rabbitmq 消息队列")
|
||||
public class RabbitMQController {
|
||||
|
||||
@Resource
|
||||
@@ -37,26 +38,28 @@ public class RabbitMQController {
|
||||
|
||||
/**
|
||||
* 连接Rabbitmq
|
||||
*
|
||||
* @return 连接状态
|
||||
*/
|
||||
@PostMapping("/connect")
|
||||
// public String connect(@RequestParam String queueName) {
|
||||
public CommonResult connect() {
|
||||
public CommonResult connect() {
|
||||
String queueName = SecurityFrameworkUtils.getLoginQueueName();
|
||||
int connect = rabbitMqService.connect(queueName);
|
||||
if (connect == 0 ){
|
||||
if (connect == 0) {
|
||||
return CommonResult.success("已经连接");
|
||||
}
|
||||
if (connect ==1){
|
||||
if (connect == 1) {
|
||||
return CommonResult.success("连接成功");
|
||||
}
|
||||
|
||||
return CommonResult.error(RABBITMQ_CONNECT_EXISTS);
|
||||
return CommonResult.error(RABBITMQ_CONNECT_EXISTS);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否连接
|
||||
*
|
||||
* @return 连接状态
|
||||
*/
|
||||
@GetMapping("/isConnected")
|
||||
@@ -65,34 +68,43 @@ public class RabbitMQController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送消息
|
||||
* @param rabbitMQSendInfoVO 对象
|
||||
* 发送消息(考点服务器-中心服务器审核试题)
|
||||
*
|
||||
* @param request 对象
|
||||
* @return 发送状态
|
||||
*/
|
||||
@PostMapping("/send")
|
||||
public int sendMessage(@RequestBody RabbitMQSendInfoVO rabbitMQSendInfoVO) {
|
||||
rabbitMQSendInfoVO.setQueueName(SecurityFrameworkUtils.getLoginQueueName());
|
||||
return examQuestionService.uploadExamQuestionToRabbitMQ(rabbitMQSendInfoVO);
|
||||
@PostMapping("/sendAudio")
|
||||
public CommonResult sendMessage(@RequestBody PushAudioRequestVo request) {
|
||||
String queueNames = request.getQueueNames();
|
||||
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 接收结果
|
||||
*/
|
||||
@GetMapping("/receiveAll")
|
||||
public CommonResult receiveMessage() {
|
||||
String queueName = SecurityFrameworkUtils.getLoginQueueName();
|
||||
boolean examQuestionToRabbitMQ = examQuestionService.getExamQuestionToRabbitMQInsertData(queueName);
|
||||
if (examQuestionToRabbitMQ){
|
||||
if (examQuestionToRabbitMQ) {
|
||||
return CommonResult.success("接收成功");
|
||||
}else {
|
||||
} else {
|
||||
return CommonResult.error(RABBITMQ_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 服务器连接学校
|
||||
*
|
||||
* @param queueNames
|
||||
* @return
|
||||
*/
|
||||
@@ -104,7 +116,7 @@ public class RabbitMQController {
|
||||
List<String> failedQueues = new ArrayList<>();
|
||||
|
||||
for (String queueName : queueNames) {
|
||||
boolean examQuestionToRabbitMQ = rabbitMqService.connectSchool(queueName);
|
||||
boolean examQuestionToRabbitMQ = rabbitMqService.connectSchool(queueName);
|
||||
if (!examQuestionToRabbitMQ) {
|
||||
failedQueues.add(queueName);
|
||||
}
|
||||
@@ -113,12 +125,14 @@ public class RabbitMQController {
|
||||
if (failedQueues.isEmpty()) {
|
||||
return CommonResult.success("全部连接成功");
|
||||
} else {
|
||||
return CommonResult.error(1_005_005_023,"以下学校全部连接失败:" + String.join(", ", failedQueues));
|
||||
return CommonResult.error(1_005_005_023, "以下学校全部连接失败:" + String.join(", ", failedQueues));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 接收学校的试题
|
||||
*
|
||||
* @param queueNames
|
||||
* @return
|
||||
*/
|
||||
@@ -139,7 +153,7 @@ public class RabbitMQController {
|
||||
if (failedQueues.isEmpty()) {
|
||||
return CommonResult.success("全部接收成功");
|
||||
} 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
|
||||
*
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@@ -155,22 +170,20 @@ public class RabbitMQController {
|
||||
public CommonResult doPush(@RequestBody PushRequestVo request) {
|
||||
List<String> queueNames = request.getQueueNames();
|
||||
List<String> questionIds = request.getQuestionIds();
|
||||
System.out.println(queueNames);
|
||||
System.out.println(questionIds);
|
||||
for (String queueName : queueNames) {
|
||||
RabbitMQSendInfoVO rabbitMQSendInfoVO=new RabbitMQSendInfoVO();
|
||||
RabbitMQSendInfoVO rabbitMQSendInfoVO = new RabbitMQSendInfoVO();
|
||||
rabbitMQSendInfoVO.setType("0");
|
||||
rabbitMQSendInfoVO.setQuIds(questionIds);
|
||||
rabbitMQSendInfoVO.setQueueName(queueName);
|
||||
examQuestionService.uploadExamQuestionToRabbitMQBySource(rabbitMQSendInfoVO);
|
||||
examQuestionService.uploadExamQuestionToRabbitMQBySource(rabbitMQSendInfoVO);
|
||||
}
|
||||
|
||||
return CommonResult.success("推送成功");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 关闭
|
||||
*
|
||||
* @return 关闭结果
|
||||
*/
|
||||
@GetMapping("/disconnect")
|
||||
|
@@ -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;
|
||||
}
|
@@ -6,6 +6,8 @@ import java.util.List;
|
||||
|
||||
@Data
|
||||
public class PushRequestVo {
|
||||
// 类型
|
||||
private String type;
|
||||
private List<String> queueNames;
|
||||
private List<String> questionIds;
|
||||
}
|
||||
|
@@ -12,7 +12,7 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
* 试题(hyc)对象 exam_question
|
||||
*
|
||||
*
|
||||
* @author pengchen
|
||||
* @date 2025-03-13
|
||||
*/
|
||||
@@ -24,99 +24,143 @@ import java.util.List;
|
||||
public class ExamQuestion extends TenantBaseDO {
|
||||
|
||||
|
||||
/** 试题id */
|
||||
/**
|
||||
* 试题id
|
||||
*/
|
||||
@TableId
|
||||
private String quId;
|
||||
|
||||
/** 题库id */
|
||||
/**
|
||||
* 题库id
|
||||
*/
|
||||
// @Excel(name = "题库id")
|
||||
private String quBankId;
|
||||
private String quBankId;
|
||||
|
||||
/** 题库名称 */
|
||||
/**
|
||||
* 题库名称
|
||||
*/
|
||||
// @Excel(name = "题库名称")
|
||||
private String quBankName;
|
||||
|
||||
private String quNum;
|
||||
private String quNum;
|
||||
|
||||
/** 章节名称 */
|
||||
/**
|
||||
* 章节名称
|
||||
*/
|
||||
// @Excel(name = "章节名称")
|
||||
private String chapteridDictText;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String chapteridDictTextVo;
|
||||
/** 题型名称 */
|
||||
/**
|
||||
* 题型名称
|
||||
*/
|
||||
// @Excel(name = "题型名称")
|
||||
private String subjectName;
|
||||
|
||||
/** 题型难度(0:简单,1:一般,2:困难) */
|
||||
/**
|
||||
* 题型难度(0:简单,1:一般,2:困难)
|
||||
*/
|
||||
// @Excel(name = "题型难度(0:简单,1:一般,2:困难)")
|
||||
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 = "试题内容")
|
||||
private String content;
|
||||
|
||||
/** 试题内容(纯文本) */
|
||||
/**
|
||||
* 试题内容(纯文本)
|
||||
*/
|
||||
// @Excel(name = "试题内容(纯文本)")
|
||||
private String contentText;
|
||||
|
||||
/** 解析(带样式) */
|
||||
/**
|
||||
* 解析(带样式)
|
||||
*/
|
||||
// @Excel(name = "解析(带样式)")
|
||||
private String analysis;
|
||||
|
||||
/**c语言参考答案*/
|
||||
private String answer;
|
||||
/**
|
||||
* c语言参考答案
|
||||
*/
|
||||
private String answer;
|
||||
|
||||
|
||||
/** 知识点 */
|
||||
/**
|
||||
* 知识点
|
||||
*/
|
||||
// @Excel(name = "知识点")
|
||||
private String pointNames;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String pointNamesVo;
|
||||
/** 关键字 */
|
||||
/**
|
||||
* 关键字
|
||||
*/
|
||||
// @Excel(name = "关键字")
|
||||
private String keywords;
|
||||
|
||||
/** 是否人工(0否1是,简答题专用) */
|
||||
/**
|
||||
* 是否人工(0否1是,简答题专用)
|
||||
*/
|
||||
// @Excel(name = "是否人工,0=否1是,简答题专用")
|
||||
private String manual;
|
||||
|
||||
|
||||
/** 状态(0启用,1禁用) */
|
||||
/**
|
||||
* 状态(0启用,1禁用)
|
||||
*/
|
||||
// @Excel(name = "状态(0启用,1禁用)")
|
||||
private String status;
|
||||
private String status;
|
||||
|
||||
/** 审核 */
|
||||
/**
|
||||
* 审核
|
||||
*/
|
||||
// @Excel(name = "审核")
|
||||
private String audit;
|
||||
private String audit;
|
||||
|
||||
/** 课程类别 */
|
||||
/**
|
||||
* 课程类别
|
||||
*/
|
||||
// @Excel(name = "课程类别")
|
||||
private String courseName;
|
||||
|
||||
/** 专业分类 */
|
||||
/**
|
||||
* 专业分类
|
||||
*/
|
||||
// @Excel(name = "专业分类")
|
||||
private String specialtyName;
|
||||
/** 数据库名 */
|
||||
private String specialtyName;
|
||||
/**
|
||||
* 数据库名
|
||||
*/
|
||||
private String tname;
|
||||
|
||||
/** 试题答案 */
|
||||
/**
|
||||
* 试题答案
|
||||
*/
|
||||
// @Excel(name = "试题答案")
|
||||
@TableField(exist = false)
|
||||
private List<ExamQuestionAnswer> answerList;
|
||||
|
||||
/** 试题文件 */
|
||||
private List<ExamQuestionAnswer> answerList;
|
||||
|
||||
/**
|
||||
* 试题文件
|
||||
*/
|
||||
// @Excel(name = "试题文件")
|
||||
@TableField(exist = false)
|
||||
private List<ExamQuestionFile> fileUploads;
|
||||
|
||||
/** 试题判分 */
|
||||
private List<ExamQuestionFile> fileUploads;
|
||||
|
||||
/**
|
||||
* 试题判分
|
||||
*/
|
||||
// @Excel(name = "试题判分")
|
||||
@TableField(exist = false)
|
||||
private ExamQuestionScore questionScores;
|
||||
|
||||
/** 试题关键字 */
|
||||
/**
|
||||
* 试题关键字
|
||||
*/
|
||||
// @Excel(name = "试题关键字")
|
||||
@TableField(exist = false)
|
||||
private List<ExamQuestionKeyword> questionKeywords;
|
||||
@@ -129,14 +173,27 @@ public class ExamQuestion extends TenantBaseDO {
|
||||
|
||||
@TableField(exist = false)
|
||||
private String type;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String schoolName;
|
||||
|
||||
/** 每题分数 */
|
||||
/**
|
||||
* 每题分数
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String quScores;
|
||||
/** 排序 */
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private int sort;
|
||||
|
||||
// 学校ID
|
||||
private String schoolId;
|
||||
|
||||
/**
|
||||
* 推送试题类型(0:中心服务器-考点服务器:试题无需审核、1:考点服务器-中心服务器:试题审核)
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String questionType;
|
||||
}
|
||||
|
@@ -5,29 +5,24 @@ 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.dto.TenantDto;
|
||||
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.dal.dataobject.EducationPaperTask;
|
||||
import pc.exam.pp.module.exam.dal.dataobject.ExamQuestion;
|
||||
import pc.exam.pp.module.exam.dal.dataobject.monitor.MonitorDO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 试题(hyc)Mapper接口
|
||||
*
|
||||
*
|
||||
* @author pengchen
|
||||
* @date 2025-03-13
|
||||
*/
|
||||
@Mapper
|
||||
public interface ExamQuestionMapper extends BaseMapperX<ExamQuestion>
|
||||
{
|
||||
public interface ExamQuestionMapper extends BaseMapperX<ExamQuestion> {
|
||||
/**
|
||||
* 查询试题(hyc)
|
||||
*
|
||||
*
|
||||
* @param quId 试题(hyc)主键
|
||||
* @return 试题(hyc)
|
||||
*/
|
||||
@@ -35,20 +30,20 @@ public interface ExamQuestionMapper extends BaseMapperX<ExamQuestion>
|
||||
|
||||
/**
|
||||
* 查询试题(hyc)列表
|
||||
*
|
||||
*
|
||||
* @return 试题(hyc)集合
|
||||
*/
|
||||
default PageResult<ExamQuestion> selectExamQuestionList(QuestionVo questionVo) {
|
||||
return selectPage(questionVo, new LambdaQueryWrapperX<ExamQuestion>()
|
||||
.likeIfPresent(ExamQuestion::getQuNum, questionVo.getQuNum())
|
||||
.likeIfPresent(ExamQuestion::getContent, questionVo.getContent())
|
||||
.likeIfPresent(ExamQuestion::getQuId,questionVo.getQuId())
|
||||
.likeIfPresent(ExamQuestion::getKeywords,questionVo.getKeywords())
|
||||
.likeIfPresent(ExamQuestion::getQuId, questionVo.getQuId())
|
||||
.likeIfPresent(ExamQuestion::getKeywords, questionVo.getKeywords())
|
||||
.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::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())
|
||||
.orderByDesc(ExamQuestion::getCreateTime)
|
||||
@@ -57,6 +52,7 @@ public interface ExamQuestionMapper extends BaseMapperX<ExamQuestion>
|
||||
|
||||
/**
|
||||
* 查询除了审核状态为通过的其他试题
|
||||
*
|
||||
* @param questionVo
|
||||
* @return
|
||||
*/
|
||||
@@ -74,7 +70,7 @@ public interface ExamQuestionMapper extends BaseMapperX<ExamQuestion>
|
||||
|
||||
/**
|
||||
* 新增试题(hyc)
|
||||
*
|
||||
*
|
||||
* @param examQuestion 试题(hyc)
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -82,7 +78,7 @@ public interface ExamQuestionMapper extends BaseMapperX<ExamQuestion>
|
||||
|
||||
/**
|
||||
* 修改试题(hyc)
|
||||
*
|
||||
*
|
||||
* @param examQuestion 试题(hyc)
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -90,7 +86,7 @@ public interface ExamQuestionMapper extends BaseMapperX<ExamQuestion>
|
||||
|
||||
/**
|
||||
* 删除试题(hyc)
|
||||
*
|
||||
*
|
||||
* @param quId 试题(hyc)主键
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -98,7 +94,7 @@ public interface ExamQuestionMapper extends BaseMapperX<ExamQuestion>
|
||||
|
||||
/**
|
||||
* 批量删除试题(hyc)
|
||||
*
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -106,6 +102,7 @@ public interface ExamQuestionMapper extends BaseMapperX<ExamQuestion>
|
||||
|
||||
/**
|
||||
* 批量查找试题
|
||||
*
|
||||
* @param quIds
|
||||
* @return
|
||||
*/
|
||||
@@ -113,41 +110,54 @@ public interface ExamQuestionMapper extends BaseMapperX<ExamQuestion>
|
||||
|
||||
/**
|
||||
* 批量审核试题
|
||||
*
|
||||
* @param quIds
|
||||
*/
|
||||
void setQuestionAuditByids(@Param("quIds")List<String> quIds);
|
||||
void setQuestionAuditByids(@Param("quIds") List<String> quIds);
|
||||
|
||||
/**
|
||||
* 查找学校集合(带分页)
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
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
|
||||
*/
|
||||
int noAuditQue(@Param("quIds")List<String> quIds);
|
||||
int noAuditQue(@Param("quIds") List<String> quIds);
|
||||
|
||||
/**
|
||||
* 根据试题id和租户id查找 试题
|
||||
*
|
||||
* @param quId
|
||||
* @param source
|
||||
* @return
|
||||
*/
|
||||
ExamQuestion selectExamQuestionByQuIdAndTenantId(@Param("quId") String quId, @Param("source")Long source);
|
||||
ExamQuestion selectExamQuestionByQuIdAndTenantId(@Param("quId") String quId, @Param("source") Long source);
|
||||
|
||||
/**
|
||||
* 查找所有的mqtt通道
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<String> seleAllQueueName();
|
||||
|
||||
/**
|
||||
* 更改试题审核的审核人和审核时间
|
||||
*
|
||||
* @param loginUserNickname
|
||||
* @param quIds
|
||||
*/
|
||||
@@ -155,6 +165,7 @@ public interface ExamQuestionMapper extends BaseMapperX<ExamQuestion>
|
||||
|
||||
/**
|
||||
* 根据id查找试题
|
||||
*
|
||||
* @param quId
|
||||
* @return
|
||||
*/
|
||||
@@ -162,6 +173,7 @@ public interface ExamQuestionMapper extends BaseMapperX<ExamQuestion>
|
||||
|
||||
/**
|
||||
* 查找学校集合
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<TenantVo> getSchoolNameNaPage();
|
||||
@@ -170,19 +182,21 @@ public interface ExamQuestionMapper extends BaseMapperX<ExamQuestion>
|
||||
|
||||
/**
|
||||
* 根据专业、课程、题型、试题内容查找 相同的试题
|
||||
*
|
||||
* @param specialtyName 专业
|
||||
* @param courseName 课程
|
||||
* @param subjectName 题型
|
||||
* @param content 试题内容
|
||||
* @param courseName 课程
|
||||
* @param subjectName 题型
|
||||
* @param content 试题内容
|
||||
* @return
|
||||
*/
|
||||
ExamQuestion selectByTypes(@Param("specialtyName")String specialtyName
|
||||
,@Param("courseName") String courseName
|
||||
,@Param("subjectName") String subjectName
|
||||
,@Param("content") String content);
|
||||
ExamQuestion selectByTypes(@Param("specialtyName") String specialtyName
|
||||
, @Param("courseName") String courseName
|
||||
, @Param("subjectName") String subjectName
|
||||
, @Param("content") String content);
|
||||
|
||||
/**
|
||||
* 根据id查询学校名称
|
||||
*
|
||||
* @param loginTenantId
|
||||
* @return
|
||||
*/
|
||||
@@ -190,27 +204,31 @@ public interface ExamQuestionMapper extends BaseMapperX<ExamQuestion>
|
||||
|
||||
/**
|
||||
* 批量插入或更新试题
|
||||
*
|
||||
* @param examQuestions
|
||||
*/
|
||||
void insertOrUpdateList(List<ExamQuestion> examQuestions);
|
||||
|
||||
/**
|
||||
* 更改试题状态
|
||||
*
|
||||
* @param quId
|
||||
* @param status
|
||||
* @return
|
||||
*/
|
||||
boolean changeStatus(@Param("quId") String quId
|
||||
,@Param("status") String status);
|
||||
, @Param("status") String status);
|
||||
|
||||
/**
|
||||
* 查找试题表的试题数量
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
int selectCountQu();
|
||||
|
||||
/**
|
||||
* 根据试题id找试题编号
|
||||
*
|
||||
* @param cannotDeleteIds
|
||||
* @return
|
||||
*/
|
||||
|
@@ -11,22 +11,22 @@ import pc.exam.pp.module.exam.controller.admin.questionexamine.vo.QuestionExamin
|
||||
import pc.exam.pp.module.exam.dal.dataobject.QuestionExamineDO;
|
||||
|
||||
/**
|
||||
* 试题交互中间 Mapper
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
* 试题交互中间 Mapper
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@Mapper
|
||||
public interface QuestionExamineMapper extends BaseMapperX<QuestionExamineDO> {
|
||||
|
||||
default PageResult<QuestionExamineDO> selectPage(QuestionExaminePageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<QuestionExamineDO>()
|
||||
.eqIfPresent(QuestionExamineDO::getQuId, reqVO.getQuId())
|
||||
.eqIfPresent(QuestionExamineDO::getSource, reqVO.getSource())
|
||||
.eqIfPresent(QuestionExamineDO::getCreateTeacher, reqVO.getCreateTeacher())
|
||||
.eqIfPresent(QuestionExamineDO::getType, reqVO.getType())
|
||||
.betweenIfPresent(QuestionExamineDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(QuestionExamineDO::getCreateTime));
|
||||
}
|
||||
default PageResult<QuestionExamineDO> selectPage(QuestionExaminePageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<QuestionExamineDO>()
|
||||
.eqIfPresent(QuestionExamineDO::getQuId, reqVO.getQuId())
|
||||
.eqIfPresent(QuestionExamineDO::getSource, reqVO.getSource())
|
||||
.eqIfPresent(QuestionExamineDO::getCreateTeacher, reqVO.getCreateTeacher())
|
||||
.eqIfPresent(QuestionExamineDO::getType, reqVO.getType())
|
||||
.betweenIfPresent(QuestionExamineDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(QuestionExamineDO::getCreateTime));
|
||||
}
|
||||
|
||||
void insertOrUpdateList(List<QuestionExamineDO> questionExamineDOS);
|
||||
|
||||
|
@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil;
|
||||
import com.alibaba.excel.util.StringUtils;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
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.infra.api.config.ConfigApi;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -72,7 +74,6 @@ public class ExamQuestionServiceImpl implements IExamQuestionService {
|
||||
private IExamQuestionService examQuestionService;
|
||||
@Autowired
|
||||
private ConfigApi configApi;
|
||||
|
||||
/**
|
||||
* 查询试题(hyc)
|
||||
*
|
||||
@@ -389,6 +390,24 @@ public class ExamQuestionServiceImpl implements IExamQuestionService {
|
||||
for (ExamQuestion examQuestion : list) {
|
||||
String pointIdStr = examQuestion.getPointNames();
|
||||
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 {
|
||||
if (pointIdStr != null) {
|
||||
Long pointId = Long.valueOf(pointIdStr);
|
||||
@@ -431,7 +450,6 @@ public class ExamQuestionServiceImpl implements IExamQuestionService {
|
||||
examQuestion_obj.setType(rabbitMQSendInfoVO.getType());
|
||||
examQuestion_obj.setSource(SecurityFrameworkUtils.getLoginTenantId());
|
||||
examQuestion_obj.setCreateTeacher(examQuestion_obj.getCreator());
|
||||
System.out.println(rabbitMQSendInfoVO.getQueueName());
|
||||
// 3、上传至Rabbitmq
|
||||
rabbitMqService.sendMessage(rabbitMQSendInfoVO.getQueueName(), examQuestion_obj);
|
||||
}
|
||||
@@ -580,6 +598,7 @@ public class ExamQuestionServiceImpl implements IExamQuestionService {
|
||||
// TODO 1、拉取数据,保存至数据库 2、回调服务器是否拉取成功(中心服务器)
|
||||
// 1、获取上传的rabbit的试题数组
|
||||
List<ExamQuestion> examQuestions = null;
|
||||
List<ExamQuestion> insertExam = new ArrayList<>();
|
||||
try {
|
||||
examQuestions = rabbitMqService.receiveAllMessages(queueName);
|
||||
} catch (Exception e) {
|
||||
@@ -587,12 +606,27 @@ public class ExamQuestionServiceImpl implements IExamQuestionService {
|
||||
}
|
||||
if (examQuestions != null && examQuestions.size() > 0) {
|
||||
for (ExamQuestion examQuestion : examQuestions) {
|
||||
|
||||
ExamQuestion question = examQuestionMapper.selectExamQuestionCountByQuId(examQuestion.getQuBankId());
|
||||
if (question == null) {
|
||||
//如果没有,就是新增
|
||||
String quId = IdUtils.simpleUUID();
|
||||
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();
|
||||
int count = examQuestionMapper.selectCountQu();
|
||||
// 读取系统创建试题位数设置
|
||||
@@ -601,7 +635,6 @@ public class ExamQuestionServiceImpl implements IExamQuestionService {
|
||||
String formattedNumber = String.format("%0" + number + "d", ++count);
|
||||
String quNum = loginTenantId + "-" + formattedNumber;
|
||||
examQuestion.setQuNum(quNum);
|
||||
|
||||
//新增
|
||||
List<ExamQuestionAnswer> answerList = examQuestion.getAnswerList();
|
||||
List<ExamQuestionFile> fileUploads = examQuestion.getFileUploads();
|
||||
@@ -643,19 +676,22 @@ public class ExamQuestionServiceImpl implements IExamQuestionService {
|
||||
});
|
||||
examQuestionKeywordMapper.insertExamQuestionKeywordList(questionKeywords);
|
||||
}
|
||||
|
||||
examQuestionMapper.insert(insertExam);
|
||||
}
|
||||
//有就是覆盖
|
||||
else {
|
||||
examQuestion.setQuId(question.getQuId());
|
||||
examQuestion.setQuNum(question.getQuNum());
|
||||
examQuestion.setSchoolId(question.getSchoolId());
|
||||
// 更新的时候只更新更新人,不更新创建人
|
||||
examQuestion.setCreator(examQuestion.getCreator());
|
||||
examQuestion.setUpdater(examQuestion.getCreator());
|
||||
examQuestion.setUpdateTime(LocalDateTime.now());
|
||||
String quId = question.getQuId();
|
||||
examQuestionAnswerMapper.deleteExamQuestionAnswerByQuesId(quId);
|
||||
sysFileMapper.deleteSysFileByQuesId(quId);
|
||||
examQuestionScoreMapper.deleteExamQuestionScoreByQuesId(quId);
|
||||
examQuestionKeywordMapper.deleteExamQuestionScoreByQuesId(quId);
|
||||
|
||||
|
||||
//新增
|
||||
List<ExamQuestionAnswer> answerList = examQuestion.getAnswerList();
|
||||
List<ExamQuestionFile> fileUploads = examQuestion.getFileUploads();
|
||||
@@ -697,14 +733,11 @@ public class ExamQuestionServiceImpl implements IExamQuestionService {
|
||||
});
|
||||
examQuestionKeywordMapper.insertExamQuestionKeywordList(questionKeywords);
|
||||
}
|
||||
examQuestionMapper.updateBatch(examQuestion);
|
||||
}
|
||||
|
||||
}
|
||||
examQuestionMapper.insertOrUpdateList(examQuestions);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -714,11 +747,11 @@ public class ExamQuestionServiceImpl implements IExamQuestionService {
|
||||
List<String> quIds = rabbitMQSendInfoVO.getQuIds();
|
||||
if (quIds != null && quIds.size() > 0) {
|
||||
for (String quId : quIds) {
|
||||
QuestionExamineDO questionExamineDO = questionExamineMapper.selectById(quId);
|
||||
|
||||
// QuestionExamineDO questionExamineDO = questionExamineMapper.selectById(quId);
|
||||
// 2、根据试题ID和租户查找试题详情
|
||||
ExamQuestion examQuestion_obj = examQuestionMapper.selectExamQuestionByQuId(quId);
|
||||
|
||||
// 更新創建人
|
||||
examQuestion_obj.setCreator(SecurityFrameworkUtils.getLoginUserNickname());
|
||||
//查找试题答案
|
||||
List<ExamQuestionAnswer> examQuestionAnswers = examQuestionAnswerMapper.selectExamQuestionAnswerByQuId(quId);
|
||||
//查找试题文件
|
||||
@@ -728,7 +761,6 @@ public class ExamQuestionServiceImpl implements IExamQuestionService {
|
||||
//获取试题关键字
|
||||
List<ExamQuestionKeyword> examQuestionKeywords = examQuestionKeywordMapper.selectExamQuestionKeywordByQuId(quId);
|
||||
|
||||
|
||||
if (examQuestion_obj != null) {
|
||||
if (examQuestionAnswers != null && examQuestionAnswers.size() > 0) {
|
||||
examQuestion_obj.setAnswerList(examQuestionAnswers);
|
||||
@@ -743,10 +775,11 @@ public class ExamQuestionServiceImpl implements IExamQuestionService {
|
||||
examQuestion_obj.setQuestionKeywords(examQuestionKeywords);
|
||||
}
|
||||
}
|
||||
|
||||
// examQuestion_obj.setType(rabbitMQSendInfoVO.getType());
|
||||
// examQuestion_obj.setSource(SecurityFrameworkUtils.getLoginTenantId());
|
||||
// examQuestion_obj.setCreateTeacher(SecurityFrameworkUtils.getLoginUserNickname());
|
||||
// 判断上传的试题类型是需要审核还是不需要审核的 0:不需要 1:需要
|
||||
examQuestion_obj.setQuestionType(rabbitMQSendInfoVO.getType());
|
||||
// 3、上传至Rabbitmq
|
||||
rabbitMqService.sendMessage(rabbitMQSendInfoVO.getQueueName(), examQuestion_obj);
|
||||
}
|
||||
@@ -981,6 +1014,36 @@ public class ExamQuestionServiceImpl implements IExamQuestionService {
|
||||
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) {
|
||||
// A 和 B 必须存在
|
||||
if (StringUtils.isBlank(a) || StringUtils.isBlank(b)) {
|
||||
|
@@ -3,10 +3,7 @@ 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.dto.TenantDto;
|
||||
import pc.exam.pp.module.exam.controller.admin.question.vo.QueImportRespVO;
|
||||
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.question.vo.*;
|
||||
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.dal.dataobject.EducationPaperTask;
|
||||
@@ -109,4 +106,7 @@ public interface IExamQuestionService
|
||||
PageResult<ExamQuestion> selectExamQuestionListAnswer(QuestionVo questionVo);
|
||||
|
||||
List<ExamQuestionAnswer> getPointById(String quId);
|
||||
|
||||
// 试题审核
|
||||
boolean auditQuestion(AudioQuestionVo audioQuestionVo);
|
||||
}
|
||||
|
@@ -1,40 +1,41 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="pc.exam.pp.module.exam.dal.mysql.question.ExamQuestionMapper">
|
||||
|
||||
|
||||
<resultMap type="ExamQuestion" id="ExamQuestionResult">
|
||||
<result property="quId" column="qu_id" />
|
||||
<result property="quBankId" column="qu_bank_id" />
|
||||
<result property="quNum" column="qu_num" />
|
||||
<result property="quBankName" column="qu_bank_name" />
|
||||
<result property="chapteridDictText" column="chapterId_dict_text" />
|
||||
<result property="subjectName" column="subject_name" />
|
||||
<result property="quLevel" column="qu_level" />
|
||||
<result property="content" column="content" />
|
||||
<result property="contentText" column="content_text" />
|
||||
<result property="answer" column="answer" />
|
||||
<result property="analysis" column="analysis" />
|
||||
<result property="pointNames" column="point_names" />
|
||||
<result property="keywords" column="keywords" />
|
||||
<result property="manual" column="manual" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="creator" column="creator" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="updater" column="updater" />
|
||||
<result property="deleted" column="deleted" />
|
||||
<result property="status" column="status" />
|
||||
<result property="audit" column="audit" />
|
||||
<result property="tname" column="tname" />
|
||||
<result property="courseName" column="course_name" />
|
||||
<result property="specialtyName" column="specialty_name" />
|
||||
<result property="tenantId" column="tenant_id" />
|
||||
<result property="quId" column="qu_id"/>
|
||||
<result property="quBankId" column="qu_bank_id"/>
|
||||
<result property="quNum" column="qu_num"/>
|
||||
<result property="quBankName" column="qu_bank_name"/>
|
||||
<result property="chapteridDictText" column="chapterId_dict_text"/>
|
||||
<result property="subjectName" column="subject_name"/>
|
||||
<result property="quLevel" column="qu_level"/>
|
||||
<result property="content" column="content"/>
|
||||
<result property="contentText" column="content_text"/>
|
||||
<result property="answer" column="answer"/>
|
||||
<result property="analysis" column="analysis"/>
|
||||
<result property="pointNames" column="point_names"/>
|
||||
<result property="keywords" column="keywords"/>
|
||||
<result property="manual" column="manual"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="creator" column="creator"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="updater" column="updater"/>
|
||||
<result property="deleted" column="deleted"/>
|
||||
<result property="status" column="status"/>
|
||||
<result property="audit" column="audit"/>
|
||||
<result property="tname" column="tname"/>
|
||||
<result property="schoolId" column="school_id"/>
|
||||
<result property="courseName" column="course_name"/>
|
||||
<result property="specialtyName" column="specialty_name"/>
|
||||
<result property="tenantId" column="tenant_id"/>
|
||||
|
||||
|
||||
<!-- 嵌套答案列表 -->
|
||||
<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="isRight" column="is_right"/>
|
||||
<result property="image" column="image"/>
|
||||
@@ -45,17 +46,40 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</collection>
|
||||
</resultMap>
|
||||
<resultMap type="pc.exam.pp.module.exam.controller.admin.question.vo.TenantVo" id="TenantVoResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="name" column="name" />
|
||||
<result property="ququeName" column="queue_name" />
|
||||
<result property="id" column="id"/>
|
||||
<result property="name" column="name"/>
|
||||
<result property="ququeName" column="queue_name"/>
|
||||
</resultMap>
|
||||
<sql id="selectExamQuestionVo">
|
||||
select qu_id, 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 from exam_question
|
||||
select qu_id,
|
||||
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>
|
||||
|
||||
|
||||
|
||||
<select id="selectExamQuestionByQuId" parameterType="String" resultMap="ExamQuestionResult">
|
||||
<include refid="selectExamQuestionVo"/>
|
||||
where qu_id = #{quId}
|
||||
@@ -63,7 +87,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
|
||||
<select id="selectExamQuestionListByQuIds" resultMap="ExamQuestionResult">
|
||||
SELECT
|
||||
q.*, -- exam_question 表字段
|
||||
q.*, -- exam_question 表字段
|
||||
a.answer_id,
|
||||
a.qu_id AS a_qu_id,
|
||||
a.is_right,
|
||||
@@ -85,12 +109,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<select id="getSchoolName" resultMap="TenantVoResult">
|
||||
SELECT id, name, queue_name
|
||||
FROM system_tenant
|
||||
WHERE deleted = 0
|
||||
WHERE deleted = 0
|
||||
<if test="name != null and name != ''">
|
||||
AND name LIKE CONCAT('%', #{name}, '%')
|
||||
</if>
|
||||
LIMIT #{pageSize} OFFSET #{offset}
|
||||
</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 count(*)
|
||||
FROM system_tenant
|
||||
@@ -102,37 +133,44 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<select id="selectExamQuestionByQuIdAndTenantId"
|
||||
resultMap="ExamQuestionResult">
|
||||
<include refid="selectExamQuestionVo"/>
|
||||
where qu_id = #{quId} and tenant_id= #{source}
|
||||
where qu_id = #{quId} and tenant_id= #{source}
|
||||
|
||||
</select>
|
||||
<select id="seleAllQueueName" resultType="java.lang.String">
|
||||
SELECT queue_name
|
||||
SELECT queue_name
|
||||
FROM system_tenant
|
||||
WHERE deleted = 0
|
||||
WHERE deleted = 0
|
||||
</select>
|
||||
<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 id="getSchoolNameNaPage" resultMap="TenantVoResult">
|
||||
SELECT id, name, queue_name
|
||||
FROM system_tenant
|
||||
WHERE deleted = 0
|
||||
WHERE deleted = 0
|
||||
</select>
|
||||
<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 id="selectByTypes" resultMap="ExamQuestionResult">
|
||||
select * from exam_question where specialty_name =#{specialtyName}
|
||||
and course_name=#{courseName}
|
||||
and subject_name =#{subjectName}
|
||||
and content =#{content}
|
||||
limit 1;
|
||||
select *
|
||||
from exam_question
|
||||
where specialty_name = #{specialtyName}
|
||||
and course_name = #{courseName}
|
||||
and subject_name = #{subjectName}
|
||||
and content = #{content} limit 1;
|
||||
</select>
|
||||
<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 id="selectCountQu" resultType="java.lang.Integer">
|
||||
select count(*) from exam_question
|
||||
select count(*)
|
||||
from exam_question
|
||||
</select>
|
||||
<select id="selectQuNumBuIds" resultType="java.lang.String">
|
||||
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="courseName != null">course_name,</if>
|
||||
<if test="specialtyName != null">specialty_name,</if>
|
||||
<if test="schoolId != null">school_id,</if>
|
||||
<if test="tenantId != null">tenant_id,</if>
|
||||
</trim>
|
||||
<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="courseName != null">#{courseName},</if>
|
||||
<if test="specialtyName != null">#{specialtyName},</if>
|
||||
<if test="schoolId != null">#{schoolId},</if>
|
||||
<if test="tenantId != null">#{tenantId},</if>
|
||||
|
||||
</trim>
|
||||
</trim>
|
||||
</insert>
|
||||
<insert id="insertOrUpdateList">
|
||||
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
|
||||
<foreach collection="collection" item="item" separator=",">
|
||||
(#{item.quId}, #{item.quBankId},#{item.tname},#{item.quNum}, #{item.chapteridDictText}, #{item.subjectName},
|
||||
#{item.specialtyName}, #{item.courseName}, #{item.quLevel}, #{item.content}, #{item.audit}
|
||||
, #{item.status}, #{item.contentText}, #{item.analysis}, #{item.pointNames}, #{item.keywords},
|
||||
#{item.manual})
|
||||
#{item.manual}, #{item.schoolId}, #{createTime}, #{creator}, #{updateTime}, #{updater})
|
||||
</foreach>
|
||||
ON DUPLICATE KEY UPDATE
|
||||
tname = VALUES(tname),
|
||||
@@ -225,8 +266,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
analysis = VALUES(analysis),
|
||||
point_names = VALUES(point_names),
|
||||
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>
|
||||
|
||||
<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="courseName != null">course_name = #{courseName},</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>
|
||||
</trim>
|
||||
where qu_id = #{quId}
|
||||
</update>
|
||||
|
||||
<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>
|
||||
<update id="deleteExamQuestionByQuIds">
|
||||
UPDATE exam_question
|
||||
SET deleted = '2'
|
||||
WHERE qu_id IN
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
UPDATE exam_question
|
||||
SET deleted = '2'
|
||||
WHERE qu_id IN
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
|
||||
@@ -281,36 +329,36 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</foreach>
|
||||
</update>
|
||||
<update id="auditQueByIds">
|
||||
UPDATE exam_question
|
||||
SET audit = '0'
|
||||
WHERE qu_id IN
|
||||
<foreach collection="quIds" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
UPDATE exam_question
|
||||
SET audit = '0'
|
||||
WHERE qu_id IN
|
||||
<foreach collection="quIds" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</update>
|
||||
<update id="noAuditQue">
|
||||
|
||||
UPDATE exam_question
|
||||
SET audit = '3'
|
||||
WHERE qu_id IN
|
||||
<foreach collection="quIds" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
UPDATE exam_question
|
||||
SET audit = '3'
|
||||
WHERE qu_id IN
|
||||
<foreach collection="quIds" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</update>
|
||||
<update id="updateExamQuestionByIds">
|
||||
UPDATE education_question_examine
|
||||
SET updater = #{updater},
|
||||
update_time = now()
|
||||
WHERE qu_id IN
|
||||
<foreach collection="quIds" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
UPDATE education_question_examine
|
||||
SET updater = #{updater},
|
||||
update_time = now()
|
||||
WHERE qu_id IN
|
||||
<foreach collection="quIds" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
|
||||
</update>
|
||||
<update id="changeStatus">
|
||||
UPDATE exam_question
|
||||
set status =#{status}
|
||||
where qu_id =#{quId}
|
||||
where qu_id = #{quId}
|
||||
</update>
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user