|
|
|
@ -18,7 +18,9 @@ import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import java.util.Date; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
@Service |
|
|
|
@Slf4j |
|
|
|
@ -46,6 +48,9 @@ public class QuestionInventoryDomainServiceImpl implements QuestionInventoryDoma |
|
|
|
} |
|
|
|
int watermark = getWatermark(task); |
|
|
|
int targetLine = (int) Math.ceil(1.2 * getUnpassedCount(task)); |
|
|
|
|
|
|
|
Map<String, Double> questionTypeMap = questionTypeProportion(task); |
|
|
|
|
|
|
|
List<TaskKnowledgePointEntity> kpList = taskKpMapper.selectList( |
|
|
|
new LambdaQueryWrapper<TaskKnowledgePointEntity>().eq(TaskKnowledgePointEntity::getTaskId , taskId)); |
|
|
|
for (TaskKnowledgePointEntity kp : kpList) { |
|
|
|
@ -53,7 +58,9 @@ public class QuestionInventoryDomainServiceImpl implements QuestionInventoryDoma |
|
|
|
if (QuestionTypeEnum.MULTIPLE_CHOICE.equals(questionType)) { |
|
|
|
continue; |
|
|
|
} |
|
|
|
checkAndProduce(kp.getId() , questionType , watermark , targetLine); |
|
|
|
checkAndProduce(kp.getId() , questionType , |
|
|
|
(int) Math.ceil(watermark * questionTypeMap.get(questionType.name())), |
|
|
|
(int) Math.ceil(targetLine * questionTypeMap.get(questionType.name()))); |
|
|
|
} |
|
|
|
} |
|
|
|
// 针对每一个簇
|
|
|
|
@ -66,9 +73,9 @@ public class QuestionInventoryDomainServiceImpl implements QuestionInventoryDoma |
|
|
|
} |
|
|
|
int w = cluster.getClusterSize(); |
|
|
|
// 簇水位线: 1.0 * U * W
|
|
|
|
int clusterWatermark = watermark * w; |
|
|
|
int clusterWatermark = (int) Math.ceil(watermark * w * questionTypeMap.get(QuestionTypeEnum.MULTIPLE_CHOICE.name())); |
|
|
|
// 簇目标线: 1.2 * U * W
|
|
|
|
int clusterTargetLine = targetLine * w; |
|
|
|
int clusterTargetLine = (int) Math.ceil(targetLine * w * questionTypeMap.get(QuestionTypeEnum.MULTIPLE_CHOICE.name())); |
|
|
|
|
|
|
|
checkClusterProduce(cluster.getId(), clusterWatermark, clusterTargetLine); |
|
|
|
} |
|
|
|
@ -170,10 +177,27 @@ public class QuestionInventoryDomainServiceImpl implements QuestionInventoryDoma |
|
|
|
return (int) Math.ceil(1.0 * getUnpassedCount(task)); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 获取题目题型占比系数 |
|
|
|
*/ |
|
|
|
private Map<String,Double> questionTypeProportion(TaskEntity task) { |
|
|
|
//题目总数
|
|
|
|
int totalNum = task.getMultipleChoiceNum() + task.getSingleChoiceNum() + task.getTrueFalseNum(); |
|
|
|
//题目占比系数
|
|
|
|
Map<String,Double> questionTypeMap = new HashMap<>(); |
|
|
|
questionTypeMap.put(QuestionTypeEnum.SINGLE_CHOICE.name(), task.getSingleChoiceNum() * 1.0/totalNum); |
|
|
|
questionTypeMap.put(QuestionTypeEnum.MULTIPLE_CHOICE.name(), task.getMultipleChoiceNum() * 1.0/totalNum); |
|
|
|
questionTypeMap.put(QuestionTypeEnum.TRUE_FALSE.name(), task.getTrueFalseNum() * 1.0/totalNum); |
|
|
|
|
|
|
|
return questionTypeMap; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Boolean checkKp(TaskEntity task, Long kpId, QuestionTypeEnum questionType){ |
|
|
|
Map<String, Double> questionTypeMap = questionTypeProportion(task); |
|
|
|
|
|
|
|
int watermark = getWatermark(task); |
|
|
|
if (!checkKpInventory(kpId, questionType, watermark)) { |
|
|
|
if (!checkKpInventory(kpId, questionType, (int) Math.ceil(watermark * questionTypeMap.get(questionType.name())))) { |
|
|
|
return false; |
|
|
|
} |
|
|
|
return true; |
|
|
|
@ -181,9 +205,11 @@ public class QuestionInventoryDomainServiceImpl implements QuestionInventoryDoma |
|
|
|
|
|
|
|
@Override |
|
|
|
public Boolean checkCluster(TaskEntity task, TaskKnowledgeClusterEntity cluster) { |
|
|
|
Map<String, Double> questionTypeMap = questionTypeProportion(task); |
|
|
|
|
|
|
|
int watermark = getWatermark(task); |
|
|
|
int clusterWatermark = watermark * cluster.getClusterSize(); |
|
|
|
return checkClusterInventory(cluster.getId(), clusterWatermark); |
|
|
|
return checkClusterInventory(cluster.getId(), (int) Math.ceil(clusterWatermark * questionTypeMap.get(QuestionTypeEnum.MULTIPLE_CHOICE.name()))); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|