|
@@ -920,7 +920,8 @@ public class ImportPaperService {
|
|
|
} else if (tmpText.startsWith(ImportPaperMsg.publicity)) {
|
|
|
// 检测到公安度开始段落
|
|
|
String pub = getContent(tmpText, ImportPaperMsg.publicity);
|
|
|
- publicity = checkPublicity(publicity, pub, importPaperCheck, errorQuesNum);
|
|
|
+
|
|
|
+ publicity = checkPublicity(pub, importPaperCheck, errorQuesNum);
|
|
|
question.setPublicity(publicity);
|
|
|
answerStart = false;
|
|
|
}
|
|
@@ -1014,14 +1015,22 @@ public class ImportPaperService {
|
|
|
throw new PaperException(importPaperCheck.getErrorInfo());
|
|
|
}
|
|
|
for (CourseProperty courseProperty : courseProperties) {
|
|
|
- Property propertyParent = new Property(firstProperty, 0l, courseProperty.getId());
|
|
|
+ Property propertyParent = new Property();
|
|
|
+ propertyParent.setCoursePropertyId(courseProperty.getId());
|
|
|
+ propertyParent.setParentId(0L);
|
|
|
+ propertyParent.setName(firstProperty);
|
|
|
+
|
|
|
//查询一级属性是否存在
|
|
|
List<Property> propertieParents = propertyRepo.findAll(Example.of(propertyParent));
|
|
|
//存在一级属性
|
|
|
if (propertieParents != null && propertieParents.size() > 0) {
|
|
|
isFirstEmpty = false;
|
|
|
for (Property proParent : propertieParents) {
|
|
|
- Property propertySon = new Property(secondProperty, proParent.getId(), courseProperty.getId());
|
|
|
+ Property propertySon = new Property();
|
|
|
+ propertySon.setCoursePropertyId(courseProperty.getId());
|
|
|
+ propertySon.setParentId(proParent.getId());
|
|
|
+ propertySon.setName(secondProperty);
|
|
|
+
|
|
|
//查询二级属性
|
|
|
List<Property> propertieSons = propertyRepo.findAll(Example.of(propertySon));
|
|
|
//存在二级属性
|
|
@@ -1069,9 +1078,14 @@ public class ImportPaperService {
|
|
|
}
|
|
|
throw new PaperException(importPaperCheck.getErrorInfo());
|
|
|
}
|
|
|
+
|
|
|
for (CourseProperty courseProperty : courseProperties) {
|
|
|
//查询一级属性
|
|
|
- Property propertyParent = new Property(firstProperty, 0l, courseProperty.getId());
|
|
|
+ Property propertyParent = new Property();
|
|
|
+ propertyParent.setCoursePropertyId(courseProperty.getId());
|
|
|
+ propertyParent.setParentId(0L);
|
|
|
+ propertyParent.setName(firstProperty);
|
|
|
+
|
|
|
List<Property> propertieParents = propertyRepo.findAll(Example.of(propertyParent));
|
|
|
//存在一级属性
|
|
|
if (propertieParents != null && propertieParents.size() > 0) {
|
|
@@ -1485,23 +1499,27 @@ public class ImportPaperService {
|
|
|
private void checkUnitNum(List<PaperDetailUnit> paperDetailUnits, ImportPaperCheck importPaperCheck) throws PaperException {
|
|
|
Map<PaperDetail, Integer> unitNumMap = new HashMap<>();
|
|
|
Collections.sort(paperDetailUnits);
|
|
|
+
|
|
|
for (PaperDetailUnit paperDetailUnit : paperDetailUnits) {
|
|
|
PaperDetail key = paperDetailUnit.getPaperDetail();
|
|
|
if (unitNumMap.containsKey(key)) {
|
|
|
int value = unitNumMap.get(key);
|
|
|
- if (paperDetailUnit.getQuestionType() == QuesStructType.NESTED_ANSWER_QUESTION) {
|
|
|
+ /*if (paperDetailUnit.getQuestionType() == QuesStructType.NESTED_ANSWER_QUESTION) {
|
|
|
unitNumMap.put(key, value + 1);
|
|
|
} else {
|
|
|
unitNumMap.put(key, value + 1);
|
|
|
- }
|
|
|
+ }*/
|
|
|
+ unitNumMap.put(key, value + 1);
|
|
|
} else {
|
|
|
- if (paperDetailUnit.getQuestionType() == QuesStructType.NESTED_ANSWER_QUESTION) {
|
|
|
+ /*if (paperDetailUnit.getQuestionType() == QuesStructType.NESTED_ANSWER_QUESTION) {
|
|
|
unitNumMap.put(key, 1);
|
|
|
} else {
|
|
|
unitNumMap.put(key, 1);
|
|
|
- }
|
|
|
+ }*/
|
|
|
+ unitNumMap.put(key, 1);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
for (Map.Entry<PaperDetail, Integer> entry : unitNumMap.entrySet()) {
|
|
|
PaperDetail paperDetail = entry.getKey();
|
|
|
if (paperDetail.getUnitCount().intValue() != entry.getValue().intValue()) {
|
|
@@ -1606,14 +1624,9 @@ public class ImportPaperService {
|
|
|
|
|
|
/**
|
|
|
* 校验试题公开度
|
|
|
- *
|
|
|
- * @param publicity
|
|
|
- * @param tmpText
|
|
|
- * @param importPaperCheck
|
|
|
- * @param subQuesNum
|
|
|
- * @throws Exception
|
|
|
*/
|
|
|
- private Boolean checkPublicity(Boolean publicity, String tmpText, ImportPaperCheck importPaperCheck, int subQuesNum) throws Exception {
|
|
|
+ private Boolean checkPublicity(String tmpText, ImportPaperCheck importPaperCheck, int subQuesNum) throws Exception {
|
|
|
+ Boolean publicity;
|
|
|
if (StringUtils.isBlank(tmpText)) {
|
|
|
//如果为空,默认是公开
|
|
|
publicity = true;
|