|
|
|
@ -47,7 +47,7 @@ public class QuestionInventoryDomainServiceImpl implements QuestionInventoryDoma |
|
|
|
return; |
|
|
|
} |
|
|
|
int watermark = getWatermark(task); |
|
|
|
int targetLine = (int) Math.ceil(1.2 * getUnpassedCount(task)); |
|
|
|
int targetLine = getTargetLine(task); |
|
|
|
|
|
|
|
Map<String, Double> questionTypeMap = questionTypeProportion(task); |
|
|
|
|
|
|
|
@ -84,13 +84,16 @@ 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("题目生成完成"); |
|
|
|
return Result.success("考试任务不存在"); |
|
|
|
} |
|
|
|
int unpassed = getUnpassedCount(task); |
|
|
|
if (unpassed <= 0) { |
|
|
|
return Result.success("题目生成完成"); |
|
|
|
return Result.success("考试任务未发现未通过人数"); |
|
|
|
} |
|
|
|
List<TaskKnowledgePointEntity> kpList = taskKpMapper.selectList( |
|
|
|
new LambdaQueryWrapper<TaskKnowledgePointEntity>().eq(TaskKnowledgePointEntity::getTaskId , taskId)); |
|
|
|
@ -99,8 +102,12 @@ public class QuestionInventoryDomainServiceImpl implements QuestionInventoryDoma |
|
|
|
if (QuestionTypeEnum.MULTIPLE_CHOICE.equals(questionType)) { |
|
|
|
continue; |
|
|
|
} |
|
|
|
if(!checkKp(task,kp.getId(),questionType)){ |
|
|
|
return Result.success("题目未生成完成"); |
|
|
|
Map<String, Double> questionTypeMap = questionTypeProportion(task); |
|
|
|
int targetLine = getTargetLine(task); |
|
|
|
int targetNum = (int) Math.ceil(targetLine * questionTypeMap.get(questionType.name())); |
|
|
|
total = total + targetNum; |
|
|
|
if (!checkKpInventory(kp.getId(), questionType, targetNum)) { |
|
|
|
flage = true; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@ -111,11 +118,20 @@ public class QuestionInventoryDomainServiceImpl implements QuestionInventoryDoma |
|
|
|
if (cluster.getClusterSize() < 2) { |
|
|
|
continue; |
|
|
|
} |
|
|
|
if (!checkCluster(task, cluster)) { |
|
|
|
return Result.success("题目未生成完成"); |
|
|
|
|
|
|
|
Map<String, Double> questionTypeMap = questionTypeProportion(task); |
|
|
|
int targetLine = getTargetLine(task); |
|
|
|
int clusterWatermark = targetLine * cluster.getClusterSize(); |
|
|
|
int targetNum = (int) Math.ceil(clusterWatermark * questionTypeMap.get(QuestionTypeEnum.MULTIPLE_CHOICE.name())); |
|
|
|
total = total + targetNum; |
|
|
|
if (!checkClusterInventory(cluster.getId(), targetNum)) { |
|
|
|
flage = true; |
|
|
|
} |
|
|
|
} |
|
|
|
return Result.success("题目生成完成"); |
|
|
|
if (flage){ |
|
|
|
return Result.success("题目未生成完成,目标题量:"+total); |
|
|
|
} |
|
|
|
return Result.success("题目生成完成,目标题量:"+total); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
@ -177,6 +193,13 @@ public class QuestionInventoryDomainServiceImpl implements QuestionInventoryDoma |
|
|
|
return (int) Math.ceil(1.0 * getUnpassedCount(task)); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 计算目标线 (targetLine = ceil(1.2 * u)) |
|
|
|
*/ |
|
|
|
private int getTargetLine(TaskEntity task) { |
|
|
|
return (int) Math.ceil(1.2 * getUnpassedCount(task)); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 获取题目题型占比系数 |
|
|
|
*/ |
|
|
|
@ -196,19 +219,17 @@ public class QuestionInventoryDomainServiceImpl implements QuestionInventoryDoma |
|
|
|
public Boolean checkKp(TaskEntity task, Long kpId, QuestionTypeEnum questionType){ |
|
|
|
Map<String, Double> questionTypeMap = questionTypeProportion(task); |
|
|
|
|
|
|
|
int watermark = getWatermark(task); |
|
|
|
if (!checkKpInventory(kpId, questionType, (int) Math.ceil(watermark * questionTypeMap.get(questionType.name())))) { |
|
|
|
return false; |
|
|
|
} |
|
|
|
return true; |
|
|
|
int targetLine = getTargetLine(task); |
|
|
|
|
|
|
|
return checkKpInventory(kpId, questionType, (int) Math.ceil(targetLine * questionTypeMap.get(questionType.name()))); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Boolean checkCluster(TaskEntity task, TaskKnowledgeClusterEntity cluster) { |
|
|
|
Map<String, Double> questionTypeMap = questionTypeProportion(task); |
|
|
|
|
|
|
|
int watermark = getWatermark(task); |
|
|
|
int clusterWatermark = watermark * cluster.getClusterSize(); |
|
|
|
int targetLine = getTargetLine(task); |
|
|
|
int clusterWatermark = targetLine * cluster.getClusterSize(); |
|
|
|
return checkClusterInventory(cluster.getId(), (int) Math.ceil(clusterWatermark * questionTypeMap.get(QuestionTypeEnum.MULTIPLE_CHOICE.name()))); |
|
|
|
} |
|
|
|
|
|
|
|
|