diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/question/ExamQuestionController.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/question/ExamQuestionController.java index c2219274..9091b853 100644 --- a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/question/ExamQuestionController.java +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/question/ExamQuestionController.java @@ -295,7 +295,7 @@ public class ExamQuestionController { if (!file.getFile().getOriginalFilename().endsWith(".c")) { return CommonResult.error(100810, "请上传.c文件"); } - return CommonResult.success(new String(file.getFile().getBytes(), StandardCharsets.UTF_8)); + return CommonResult.success(new String(file.getFile().getBytes(), "GBK")); } } diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/rabbitmq/RabbitMQController.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/rabbitmq/RabbitMQController.java index 3a35a1a9..5aa0c7ee 100644 --- a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/rabbitmq/RabbitMQController.java +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/rabbitmq/RabbitMQController.java @@ -13,12 +13,16 @@ 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.controller.admin.specialty.vo.TenantSpcialtyVo; import pc.exam.pp.module.exam.dal.dataobject.ExamQuestion; +import pc.exam.pp.module.exam.dal.dataobject.specialty.ExamSpecialty; +import pc.exam.pp.module.exam.dal.mysql.specialty.ExamSpecialtyMapper; import pc.exam.pp.module.exam.service.question.ExamQuestionServiceImpl; import pc.exam.pp.module.exam.utils.rabbitmq.RabbitmqUtils; import java.util.ArrayList; import java.util.List; +import java.util.Optional; import static pc.exam.pp.module.system.enums.ErrorCodeConstants.RABBITMQ_NOT_EXISTS; import static pc.exam.pp.module.system.enums.ErrorCodeConstants.RABBITMQ_NAME_NOT_NULL; @@ -34,6 +38,8 @@ public class RabbitMQController { private RabbitmqUtils rabbitMqService; @Resource private ExamQuestionServiceImpl examQuestionService; + @Resource + ExamSpecialtyMapper examSpecialtyMapper; /** @@ -170,6 +176,23 @@ public class RabbitMQController { public CommonResult doPush(@RequestBody PushRequestVo request) { List queueNames = request.getQueueNames(); List questionIds = request.getQuestionIds(); + // 需要查询对应试题的专业,考点服务器是否存在 + for (String quId : questionIds) { + // 查询试题信息 + ExamQuestion examQuestion = examQuestionService.selectExamQuestionByQuId(quId); + String courseName = examQuestion.getCourseName(); + // 通过Name查询专业信息 + ExamSpecialty examSpecialty = examSpecialtyMapper.selectExamSpecialtyBySpNameOne(courseName); + for (String queueName : queueNames) { + String teantId = queueName.split("_")[0]; + List tenantSpcialtyVos = examSpecialtyMapper.selectTenantSpcialtyList(Long.valueOf(teantId)); + // 判断是否存在 + Optional result = tenantSpcialtyVos.stream().filter(quLists -> quLists.getSpecialtyId().equals(examSpecialty.getSpId())).findFirst(); + if (!result.isPresent()) { + return CommonResult.error(1_005_005_023, "试题{" + examQuestion.getQuNum() + "},对应考点服务器{" + queueName + "}专业不存在"); + } + } + } for (String queueName : queueNames) { RabbitMQSendInfoVO rabbitMQSendInfoVO = new RabbitMQSendInfoVO(); rabbitMQSendInfoVO.setType("0"); diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/specialty/vo/TenantSpcialtyVo.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/specialty/vo/TenantSpcialtyVo.java new file mode 100644 index 00000000..66d4889e --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/specialty/vo/TenantSpcialtyVo.java @@ -0,0 +1,18 @@ +package pc.exam.pp.module.exam.controller.admin.specialty.vo; + + +import com.baomidou.mybatisplus.annotation.TableId; +import lombok.*; + +@Data +public class TenantSpcialtyVo { + + @TableId(value = "id") + private Long id; + + private Long tenantId; + + private Long specialtyId; + + private String points; +} diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/mysql/specialty/ExamSpecialtyMapper.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/mysql/specialty/ExamSpecialtyMapper.java index 619fe71b..58c988b9 100644 --- a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/mysql/specialty/ExamSpecialtyMapper.java +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/mysql/specialty/ExamSpecialtyMapper.java @@ -1,16 +1,20 @@ package pc.exam.pp.module.exam.dal.mysql.specialty; + import org.apache.ibatis.annotations.MapKey; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import pc.exam.pp.framework.mybatis.core.mapper.BaseMapperX; import pc.exam.pp.module.exam.controller.admin.specialty.vo.SpecialtListReqVo; import pc.exam.pp.module.exam.controller.admin.specialty.vo.SpecialtyQueryVo; +import pc.exam.pp.module.exam.controller.admin.specialty.vo.TenantSpcialtyVo; import pc.exam.pp.module.exam.dal.dataobject.knowledge.ExamKnowledgePoints; import pc.exam.pp.module.exam.dal.dataobject.monitor.TentSpecialy; import pc.exam.pp.module.exam.dal.dataobject.specialty.ExamSpecialty; +import pc.exam.pp.module.exam.dal.dataobject.wps.ExamWpsXlsx; import pc.exam.pp.module.exam.service.monitor.vo.IdParentPair; import pc.exam.pp.module.exam.service.monitor.vo.SpecialtyRelation; +import java.util.Collection; import java.util.List; import java.util.Map; import java.util.Set; @@ -22,8 +26,11 @@ import java.util.Set; * @date 2025-03-24 */ @Mapper -public interface ExamSpecialtyMapper extends BaseMapperX -{ +public interface ExamSpecialtyMapper extends BaseMapperX { + default List selectListByParentId(Collection parentIds) { + return selectList(ExamSpecialty::getParentId, parentIds); + } + /** * 查询数据 * @@ -32,7 +39,18 @@ public interface ExamSpecialtyMapper extends BaseMapperX */ ExamSpecialty selectExamSpecialtyBySpId(Long spId); + /** + * 查询数据 + * + * @param name 名称 + * @return 数据信息 + */ + ExamSpecialty selectExamSpecialtyBySpNameOne(String name); + List selectExamSpecialtyBySpName(String spName); + + List selectTenantSpcialtyList(Long id); + /** * 查询数据parentId * @@ -114,19 +132,17 @@ public interface ExamSpecialtyMapper extends BaseMapperX String getRoleById(String id); ExamSpecialty selectBySpecCourseSub(@Param("specialtyName") String specialtyName - ,@Param("courseName") String courseName - ,@Param("subjectName") String subjectName); + , @Param("courseName") String courseName + , @Param("subjectName") String subjectName); - ExamKnowledgePoints selectByPointsSub(@Param("specialtyName") String specialtyName - , @Param("chapteridDictText")String chapteridDictText - , @Param("pointNames") String pointNames); + ExamKnowledgePoints selectByPointsSub(@Param("specialtyName") String specialtyName + , @Param("chapteridDictText") String chapteridDictText + , @Param("pointNames") String pointNames); List selectAllSpecialtyRelations(); // 返回 sp_id 和 parent_id - List selectAllIdToParent(Long loginTenantId); - } diff --git a/exam-module-exam/exam-module-exam-biz/src/main/resources/mapper/specialty/ExamSpecialtyMapper.xml b/exam-module-exam/exam-module-exam-biz/src/main/resources/mapper/specialty/ExamSpecialtyMapper.xml index 44a00ad9..34290364 100644 --- a/exam-module-exam/exam-module-exam-biz/src/main/resources/mapper/specialty/ExamSpecialtyMapper.xml +++ b/exam-module-exam/exam-module-exam-biz/src/main/resources/mapper/specialty/ExamSpecialtyMapper.xml @@ -123,11 +123,24 @@ where sp_id = #{spId} - + SELECT * + from exam_specialty + where sp_name = #{name} + + + +