|
|
|
@ -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; |
|
|
|
|
|
|
|
for (QuestionTypeEnum questionType : QuestionTypeEnum.values()) { |
|
|
|
if (QuestionTypeEnum.MULTIPLE_CHOICE.equals(questionType)) { |
|
|
|
continue; |
|
|
|
} |
|
|
|
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()); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
|