Browse Source

bug修改

V1.0
luogw 1 week ago
parent
commit
b21e879868
  1. 6
      src/main/java/com/project/interaction/domain/service/impl/SaveClusterDomainServiceImpl.java
  2. 87
      src/main/java/com/project/question/domain/service/impl/QuestionInventoryDomainServiceImpl.java

6
src/main/java/com/project/interaction/domain/service/impl/SaveClusterDomainServiceImpl.java

@ -142,13 +142,13 @@ public class SaveClusterDomainServiceImpl implements SaveClusterDomainService {
for (TaskKnowledgePointEntity kp : taskKpList) {
// 调用题目生成方法
produceDTOList.add(buildDTO(kp.getId() , QuestionSourceTypeEnum.Single_Concept,
targetNum * (int) Math.ceil(questionTypeMap.get(QuestionTypeEnum.TRUE_FALSE.name())),
targetNum * (int) Math.ceil(questionTypeMap.get(QuestionTypeEnum.SINGLE_CHOICE.name())),
(int) Math.ceil(targetNum * questionTypeMap.get(QuestionTypeEnum.TRUE_FALSE.name())),
(int) Math.ceil(targetNum * questionTypeMap.get(QuestionTypeEnum.SINGLE_CHOICE.name())),
0));
}
if (clusterEntity.getClusterSize() > 1) {
// 簇生成目标量
int clusterTargetNum = targetNum * (int) Math.ceil(clusterEntity.getClusterSize() * questionTypeMap.get(QuestionTypeEnum.MULTIPLE_CHOICE.name()));
int clusterTargetNum = (int) Math.ceil(targetNum * clusterEntity.getClusterSize() * questionTypeMap.get(QuestionTypeEnum.MULTIPLE_CHOICE.name()));
produceDTOList.add(buildDTO(clusterEntity.getId(), QuestionSourceTypeEnum.Multi_Concept ,0,0, clusterTargetNum));
}
}

87
src/main/java/com/project/question/domain/service/impl/QuestionInventoryDomainServiceImpl.java

@ -59,8 +59,8 @@ public class QuestionInventoryDomainServiceImpl implements QuestionInventoryDoma
continue;
}
checkAndProduce(kp.getId() , questionType ,
watermark * (int) Math.ceil(questionTypeMap.get(questionType.name())),
targetLine * (int) Math.ceil(questionTypeMap.get(questionType.name())));
(int) Math.ceil(watermark * questionTypeMap.get(questionType.name())),
(int) Math.ceil(targetLine * questionTypeMap.get(questionType.name())));
}
}
// 针对每一个簇
@ -73,9 +73,9 @@ public class QuestionInventoryDomainServiceImpl implements QuestionInventoryDoma
}
int w = cluster.getClusterSize();
// 簇水位线: 1.0 * U * W
int clusterWatermark = watermark * (int) Math.ceil(w * questionTypeMap.get(QuestionTypeEnum.MULTIPLE_CHOICE.name()));
int clusterWatermark = (int) Math.ceil(watermark * w * questionTypeMap.get(QuestionTypeEnum.MULTIPLE_CHOICE.name()));
// 簇目标线: 2 * U * W
int clusterTargetLine = targetLine * (int) Math.ceil(w * questionTypeMap.get(QuestionTypeEnum.MULTIPLE_CHOICE.name()));
int clusterTargetLine = (int) Math.ceil(targetLine * w * questionTypeMap.get(QuestionTypeEnum.MULTIPLE_CHOICE.name()));
checkClusterProduce(cluster.getId(), clusterWatermark, clusterTargetLine);
}
@ -84,9 +84,6 @@ public class QuestionInventoryDomainServiceImpl implements QuestionInventoryDoma
@Override
public Result<String> checkAndReplenishBoolean(Long taskId) {
Boolean flage = false;
Integer total = 0;
TaskEntity task = taskMapper.selectById(taskId);
if (task == null || task.getEndTime().before(new Date())) {
return Result.success("考试任务不存在");
@ -95,44 +92,82 @@ public class QuestionInventoryDomainServiceImpl implements QuestionInventoryDoma
if (unpassed <= 0) {
return Result.success("考试任务未发现未通过人数");
}
Map<String, Double> questionTypeMap = questionTypeProportion(task);
int waterLine = getWatermark(task);
StringBuilder resultBuilder = new StringBuilder();
resultBuilder.append("=== 库存检查报告 ===\n");
// 单知识点簇检查
resultBuilder.append("\n【单知识点簇】\n");
List<TaskKnowledgePointEntity> kpList = taskKpMapper.selectList(
new LambdaQueryWrapper<TaskKnowledgePointEntity>().eq(TaskKnowledgePointEntity::getTaskId , taskId));
for (TaskKnowledgePointEntity kp : kpList) {
for (QuestionTypeEnum questionType : QuestionTypeEnum.values()) {
if (QuestionTypeEnum.MULTIPLE_CHOICE.equals(questionType)) {
continue;
}
Map<String, Double> questionTypeMap = questionTypeProportion(task);
int targetLine = getTargetLine(task);
int targetNum = targetLine * (int) Math.ceil(questionTypeMap.get(questionType.name()));
total = total + targetNum;
if (!checkKpInventory(kp.getId(), questionType, targetNum)) {
flage = true;
int watermark = (int) Math.ceil(waterLine * questionTypeMap.get(questionType.name()));
resultBuilder.append("\n题型: ").append(questionType.getDescription()).append("\n");
resultBuilder.append(" 水位线: ").append(watermark).append("\n");
int kpCount = 0;
int passedCount = 0;
for (TaskKnowledgePointEntity kp : kpList) {
kpCount++;
int currentStock = questionKpMapper.countAvailableByKp(kp.getId(), questionType.getValue());
boolean isEnough = currentStock >= watermark;
if (isEnough) {
passedCount++;
}
}
resultBuilder.append(" 知识点总数: ").append(kpCount).append("\n");
resultBuilder.append(" 达标知识点数: ").append(passedCount).append("\n");
resultBuilder.append(" 是否全部达标: ").append(passedCount == kpCount ? "是" : "否").append("\n");
}
// 针对每一个簇
// 多知识点簇检查
resultBuilder.append("\n【多知识点簇】\n");
List<TaskKnowledgeClusterEntity> clusterList = clusterMapper.selectList(
new LambdaQueryWrapper<TaskKnowledgeClusterEntity>().eq(TaskKnowledgeClusterEntity::getTaskId, taskId));
// 按簇大小分组统计
Map<Integer, Integer> sizeTotalMap = new HashMap<>();
Map<Integer, Integer> sizePassedMap = new HashMap<>();
for (TaskKnowledgeClusterEntity cluster : clusterList) {
if (cluster.getClusterSize() < 2) {
continue;
}
Map<String, Double> questionTypeMap = questionTypeProportion(task);
int targetLine = getTargetLine(task);
// 簇目标线: 2 * U * W
int w = cluster.getClusterSize();
int targetNum = targetLine * (int) Math.ceil(w * questionTypeMap.get(QuestionTypeEnum.MULTIPLE_CHOICE.name()));
total = total + targetNum;
if (!checkClusterInventory(cluster.getId(), targetNum)) {
flage = true;
int watermark = (int) Math.ceil(waterLine * w * questionTypeMap.get(QuestionTypeEnum.MULTIPLE_CHOICE.name()));
int currentStock = questionKpMapper.countAvailableByCluster(cluster.getId());
boolean isEnough = currentStock >= watermark;
sizeTotalMap.merge(w, 1, Integer::sum);
if (isEnough) {
sizePassedMap.merge(w, 1, Integer::sum);
}
}
if (flage){
return Result.success("题目未生成完成,目标题量:"+total);
if (sizeTotalMap.isEmpty()) {
resultBuilder.append(" 无多知识点簇\n");
} else {
for (Integer size : sizeTotalMap.keySet().stream().sorted().toList()) {
int total = sizeTotalMap.get(size);
int passed = sizePassedMap.getOrDefault(size, 0);
int watermark = (int) Math.ceil(waterLine * size * questionTypeMap.get(QuestionTypeEnum.MULTIPLE_CHOICE.name()));
resultBuilder.append("\n簇大小: ").append(size).append("\n");
resultBuilder.append(" 题型: 多选题\n");
resultBuilder.append(" 水位线: ").append(watermark).append("\n");
resultBuilder.append(" 簇总数: ").append(total).append("\n");
resultBuilder.append(" 达标簇数: ").append(passed).append("\n");
resultBuilder.append(" 是否全部达标: ").append(passed == total ? "是" : "否").append("\n");
}
return Result.success("题目生成完成,目标题量:"+total);
}
return Result.success(resultBuilder.toString());
}
/**

Loading…
Cancel
Save