|
@@ -243,22 +243,33 @@ public class RandomPaperServiceImpl implements RandomPaperService {
|
|
|
Integer simpleCount = 0;
|
|
|
Integer mediumCount = 0;
|
|
|
Integer difficultyCount = 0;
|
|
|
+ Integer anyCount = 0;
|
|
|
if (CollectionUtils.isNotEmpty(paperDetailStruct.getUnitStructs())) {
|
|
|
for (PaperDetailUnitStructDto unitStruct : paperDetailStruct.getUnitStructs()) {
|
|
|
simpleCount = simpleCount + unitStruct.getPublicSimple() + unitStruct.getNoPublicSimple();
|
|
|
mediumCount = mediumCount + unitStruct.getPublicMedium() + unitStruct.getNoPublicMedium();
|
|
|
difficultyCount = difficultyCount + unitStruct.getPublicDifficulty()
|
|
|
+ unitStruct.getNoPublicDifficulty();
|
|
|
+ anyCount=anyCount+getIntVal(unitStruct.getPublicAnyDifficulty())
|
|
|
+ +getIntVal(unitStruct.getNoPublicAnyDifficulty());
|
|
|
}
|
|
|
}
|
|
|
sqinfo.setHardInfo(new StructQuestionCountInfo(difficultyCount, true));
|
|
|
sqinfo.setMediumInfo(new StructQuestionCountInfo(mediumCount, true));
|
|
|
sqinfo.setEasyInfo(new StructQuestionCountInfo(simpleCount, true));
|
|
|
+ sqinfo.setAnyInfo(new StructQuestionCountInfo(anyCount, true));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return ret;
|
|
|
}
|
|
|
+
|
|
|
+ private int getIntVal(Integer val) {
|
|
|
+ if(val==null) {
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ return val;
|
|
|
+ }
|
|
|
|
|
|
private Double getExactDifficulty(PaperStruct ps) {
|
|
|
Double sum = 0.0;
|
|
@@ -270,6 +281,10 @@ public class RandomPaperServiceImpl implements RandomPaperService {
|
|
|
for (PaperDetailStruct paperDetailStruct : ps.getPaperDetailStructs()) {
|
|
|
if (CollectionUtils.isNotEmpty(paperDetailStruct.getUnitStructs())) {
|
|
|
for (PaperDetailUnitStructDto unitStruct : paperDetailStruct.getUnitStructs()) {
|
|
|
+ if((unitStruct.getNoPublicAnyDifficulty()!=null&&unitStruct.getNoPublicAnyDifficulty()>0)
|
|
|
+ ||(unitStruct.getPublicAnyDifficulty()!=null&&unitStruct.getPublicAnyDifficulty()>0)) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
simpleCount = unitStruct.getPublicSimple() + unitStruct.getNoPublicSimple();
|
|
|
mediumCount = unitStruct.getPublicMedium() + unitStruct.getNoPublicMedium();
|
|
|
difficultyCount = unitStruct.getPublicDifficulty() + unitStruct.getNoPublicDifficulty();
|
|
@@ -313,7 +328,7 @@ public class RandomPaperServiceImpl implements RandomPaperService {
|
|
|
cd.setQuestionList(questionList);
|
|
|
if (PaperStructType.BLUEPRINT.equals(ps.getPaperStrucType())) {
|
|
|
for (PaperDetailUnitDto unit : unitList) {
|
|
|
- unit.getQuestion().setQuesName(unit.getPaperDetail().getName());
|
|
|
+ unit.getQuestion().addQuesName(unit.getPaperDetail().getName());
|
|
|
unit.getQuestion().setPropertyGroup(bulidPropertyGroup(unit.getQuestion()));
|
|
|
questionList.add(unit.getQuestion());
|
|
|
}
|
|
@@ -342,7 +357,7 @@ public class RandomPaperServiceImpl implements RandomPaperService {
|
|
|
}
|
|
|
} else if (PaperStructType.EXACT.equals(ps.getPaperStrucType())) {
|
|
|
for (PaperDetailUnitDto unit : unitList) {
|
|
|
- unit.getQuestion().setQuesName(unit.getPaperDetail().getName());
|
|
|
+ unit.getQuestion().addQuesName(unit.getPaperDetail().getName());
|
|
|
questionList.add(unit.getQuestion());
|
|
|
}
|
|
|
if (CollectionUtils.isNotEmpty(ps.getPaperDetailStructs())) {
|
|
@@ -365,7 +380,7 @@ public class RandomPaperServiceImpl implements RandomPaperService {
|
|
|
setQuestionInfoByExact(cd);
|
|
|
}
|
|
|
sqinfo.setTotalCount(sqinfo.getHardInfo().getCount() + sqinfo.getMediumInfo().getCount()
|
|
|
- + sqinfo.getEasyInfo().getCount());
|
|
|
+ + sqinfo.getEasyInfo().getCount()+sqinfo.getAnyInfo().getCount());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -451,6 +466,9 @@ public class RandomPaperServiceImpl implements RandomPaperService {
|
|
|
if (!si.getEasyInfo().getValid()) {
|
|
|
ret.setValid(false);
|
|
|
}
|
|
|
+ if (!si.getAnyInfo().getValid()) {
|
|
|
+ ret.setValid(false);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -469,6 +487,9 @@ public class RandomPaperServiceImpl implements RandomPaperService {
|
|
|
if (!si.getEasyInfo().getValid()) {
|
|
|
ret.setValid(false);
|
|
|
}
|
|
|
+ if (!si.getAnyInfo().getValid()) {
|
|
|
+ ret.setValid(false);
|
|
|
+ }
|
|
|
for (RandomPaperQuestionDto dto : si.getHardInfo().getQuestionInfo()) {
|
|
|
dto.setQuestionDtos(new ArrayList<>());
|
|
|
}
|
|
@@ -478,6 +499,9 @@ public class RandomPaperServiceImpl implements RandomPaperService {
|
|
|
for (RandomPaperQuestionDto dto : si.getEasyInfo().getQuestionInfo()) {
|
|
|
dto.setQuestionDtos(new ArrayList<>());
|
|
|
}
|
|
|
+ for (RandomPaperQuestionDto dto : si.getAnyInfo().getQuestionInfo()) {
|
|
|
+ dto.setQuestionDtos(new ArrayList<>());
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -527,6 +551,21 @@ public class RandomPaperServiceImpl implements RandomPaperService {
|
|
|
cd.setNeedCount(us.getPublicSimple());
|
|
|
setQuestionInfoByExactItem(cd);
|
|
|
}
|
|
|
+ //不限难度的一定要在最后抽题
|
|
|
+ if (getIntVal(us.getPublicAnyDifficulty()) > 0) {
|
|
|
+ cd.setSi(sqinfo.getAnyInfo());
|
|
|
+ cd.setPub(true);
|
|
|
+ cd.setDifficulty(QuestionDifficulty.ANY.getName());
|
|
|
+ cd.setNeedCount(us.getPublicAnyDifficulty());
|
|
|
+ setQuestionInfoByExactItem(cd);
|
|
|
+ }
|
|
|
+ if (getIntVal(us.getNoPublicAnyDifficulty()) > 0) {
|
|
|
+ cd.setSi(sqinfo.getAnyInfo());
|
|
|
+ cd.setPub(false);
|
|
|
+ cd.setDifficulty(QuestionDifficulty.ANY.getName());
|
|
|
+ cd.setNeedCount(us.getNoPublicAnyDifficulty());
|
|
|
+ setQuestionInfoByExactItem(cd);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
private void setQuestionInfoByExactItem(StructQuestionCheckDto cd) {
|
|
@@ -667,13 +706,34 @@ public class RandomPaperServiceImpl implements RandomPaperService {
|
|
|
return "第" + detailNumber + "大题 " + fp.getName() + "-" + pubstr + "-" + difficulty + "题源数量不满足";
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ private boolean checkHas(List<String> list,Set<String> set) {
|
|
|
+ if(list==null||set==null) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if(list.size()==0||set.size()==0) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ for(String s:list) {
|
|
|
+ if(set.contains(s)) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
|
|
|
private boolean checkExactQuesType(List<String> quesNames, QuesStructType st, Boolean pub, String difficulty,
|
|
|
QuestionDto question) {
|
|
|
if (CollectionUtils.isNotEmpty(quesNames)) {
|
|
|
- if (quesNames.contains(question.getQuesName()) && st.equals(question.getQuestionType())) {
|
|
|
- if (question.getPublicity().equals(pub) && question.getDifficulty().equals(difficulty)) {
|
|
|
- return true;
|
|
|
+ if (checkHas(quesNames, question.getQuesName())&& st.equals(question.getQuestionType())) {
|
|
|
+ if(QuestionDifficulty.ANY.getName().equals(difficulty)) {
|
|
|
+ if (question.getPublicity().equals(pub)) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ if (question.getPublicity().equals(pub) && question.getDifficulty().equals(difficulty)) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -683,7 +743,7 @@ public class RandomPaperServiceImpl implements RandomPaperService {
|
|
|
private boolean checkBlueQuesType(List<String> quesNames, QuesStructType st, String propertyGroup,
|
|
|
QuestionDto question) {
|
|
|
if (CollectionUtils.isNotEmpty(quesNames)) {
|
|
|
- if (quesNames.contains(question.getQuesName()) && st.equals(question.getQuestionType())) {
|
|
|
+ if (checkHas(quesNames, question.getQuesName()) && st.equals(question.getQuestionType())) {
|
|
|
if (question.getPropertyGroup() != null) {
|
|
|
if (question.getPropertyGroup().contains(propertyGroup)) {
|
|
|
return true;
|
|
@@ -1016,6 +1076,21 @@ public class RandomPaperServiceImpl implements RandomPaperService {
|
|
|
param.setKey(key);
|
|
|
createUnit(param);
|
|
|
}
|
|
|
+ //不限难度的一定要在最后抽题
|
|
|
+ if (getIntVal(us.getPublicAnyDifficulty()) > 0) {
|
|
|
+ param.setUnitCount(us.getPublicAnyDifficulty());
|
|
|
+ String key = param.getDetailNumber() + "-" + param.getIndex() + "-" + true + "-"
|
|
|
+ + QuestionDifficulty.ANY.getName();
|
|
|
+ param.setKey(key);
|
|
|
+ createUnit(param);
|
|
|
+ }
|
|
|
+ if (getIntVal(us.getNoPublicAnyDifficulty()) > 0) {
|
|
|
+ param.setUnitCount(us.getNoPublicAnyDifficulty());
|
|
|
+ String key = param.getDetailNumber() + "-" + param.getIndex() + "-" + false + "-"
|
|
|
+ + QuestionDifficulty.ANY.getName();
|
|
|
+ param.setKey(key);
|
|
|
+ createUnit(param);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
private void createUnitByBlueProp(CreateDefaultPaperParam param) {
|