【修改】 解决考点服务器没有根据点位授权的专业进行显示的BUG

This commit is contained in:
dlaren
2025-08-11 14:52:28 +08:00
parent 851cc9e1cb
commit c07e8910d2
10 changed files with 293 additions and 42 deletions

View File

@@ -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"));
}
}

View File

@@ -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<String> queueNames = request.getQueueNames();
List<String> 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<TenantSpcialtyVo> tenantSpcialtyVos = examSpecialtyMapper.selectTenantSpcialtyList(Long.valueOf(teantId));
// 判断是否存在
Optional<TenantSpcialtyVo> 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");

View File

@@ -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;
}

View File

@@ -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<ExamSpecialty>
{
public interface ExamSpecialtyMapper extends BaseMapperX<ExamSpecialty> {
default List<ExamSpecialty> selectListByParentId(Collection<Long> parentIds) {
return selectList(ExamSpecialty::getParentId, parentIds);
}
/**
* 查询数据
*
@@ -32,7 +39,18 @@ public interface ExamSpecialtyMapper extends BaseMapperX<ExamSpecialty>
*/
ExamSpecialty selectExamSpecialtyBySpId(Long spId);
/**
* 查询数据
*
* @param name 名称
* @return 数据信息
*/
ExamSpecialty selectExamSpecialtyBySpNameOne(String name);
List<ExamSpecialty> selectExamSpecialtyBySpName(String spName);
List<TenantSpcialtyVo> selectTenantSpcialtyList(Long id);
/**
* 查询数据parentId
*
@@ -114,19 +132,17 @@ public interface ExamSpecialtyMapper extends BaseMapperX<ExamSpecialty>
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<SpecialtyRelation> selectAllSpecialtyRelations(); // 返回 sp_id 和 parent_id
List<IdParentPair> selectAllIdToParent(Long loginTenantId);
}

View File

@@ -123,11 +123,24 @@
where sp_id = #{spId}
</select>
<select id="selectExamSpecialtyBySpName" parameterType="String" resultType="pc.exam.pp.module.exam.dal.dataobject.specialty.ExamSpecialty">
<select id="selectExamSpecialtyBySpNameOne" parameterType="String" resultType="ExamSpecialty">
SELECT *
from exam_specialty
where sp_name = #{name}
</select>
<select id="selectExamSpecialtyBySpName" parameterType="String"
resultType="pc.exam.pp.module.exam.dal.dataobject.specialty.ExamSpecialty">
SELECT *
from exam_specialty
where sp_name = #{spName}
</select>
<select id="selectTenantSpcialtyList" parameterType="Long"
resultType="pc.exam.pp.module.exam.controller.admin.specialty.vo.TenantSpcialtyVo">
SELECT *
from exam_tenant_specialty
where tenant_id = #{id}
</select>
<select id="selectExamSpecialtyByParentId"
resultType="pc.exam.pp.module.exam.controller.admin.specialty.vo.SpecialtyQueryVo">