|
@@ -845,8 +845,10 @@ public class ImportPaperService {
|
|
}
|
|
}
|
|
//一级属性,二级属性都有值
|
|
//一级属性,二级属性都有值
|
|
else if(StringUtils.isNotBlank(firstProperty) && StringUtils.isNotBlank(secondProperty)){
|
|
else if(StringUtils.isNotBlank(firstProperty) && StringUtils.isNotBlank(secondProperty)){
|
|
|
|
+ boolean isFirstEmpty = true;
|
|
|
|
+ boolean isSecondEmpty = true;
|
|
//根据课程查询所有课程属性树
|
|
//根据课程查询所有课程属性树
|
|
- List<CourseProperty> courseProperties = coursePropertyRepo.findByCourseCode(paper.getCourse().getCode());
|
|
|
|
|
|
+ List<CourseProperty> courseProperties = coursePropertyRepo.findByCourseCodeAndEnable(paper.getCourse().getCode(), true);
|
|
if(courseProperties == null || courseProperties.size()<1){
|
|
if(courseProperties == null || courseProperties.size()<1){
|
|
importPaperCheck.setErrorInfo(getQuesNumInfo(importPaperCheck.quesName, subQuesNum)+"中,没有设置课程属性结构,请先设置课程属性结构");
|
|
importPaperCheck.setErrorInfo(getQuesNumInfo(importPaperCheck.quesName, subQuesNum)+"中,没有设置课程属性结构,请先设置课程属性结构");
|
|
throw new PaperException(importPaperCheck.errorInfo);
|
|
throw new PaperException(importPaperCheck.errorInfo);
|
|
@@ -857,12 +859,14 @@ public class ImportPaperService {
|
|
List<Property> propertieParents = propertyRepo.findAll(Example.of(propertyParent));
|
|
List<Property> propertieParents = propertyRepo.findAll(Example.of(propertyParent));
|
|
//存在一级属性
|
|
//存在一级属性
|
|
if(propertieParents != null || propertieParents.size()>0){
|
|
if(propertieParents != null || propertieParents.size()>0){
|
|
|
|
+ isFirstEmpty = false;
|
|
for(Property proParent:propertieParents){
|
|
for(Property proParent:propertieParents){
|
|
Property propertySon = new Property(secondProperty,proParent.getId(),courseProperty.getId());
|
|
Property propertySon = new Property(secondProperty,proParent.getId(),courseProperty.getId());
|
|
//查询二级属性
|
|
//查询二级属性
|
|
List<Property> propertieSons = propertyRepo.findAll(Example.of(propertySon));
|
|
List<Property> propertieSons = propertyRepo.findAll(Example.of(propertySon));
|
|
//存在二级属性
|
|
//存在二级属性
|
|
if(propertieSons!=null && propertieSons.size()>0){
|
|
if(propertieSons!=null && propertieSons.size()>0){
|
|
|
|
+ isSecondEmpty = false;
|
|
for(Property proSon:propertieSons){
|
|
for(Property proSon:propertieSons){
|
|
//保存一级和二级属性
|
|
//保存一级和二级属性
|
|
QuesProperty quesProperty = new QuesProperty(proParent, proSon,courseProperty);
|
|
QuesProperty quesProperty = new QuesProperty(proParent, proSon,courseProperty);
|
|
@@ -870,21 +874,24 @@ public class ImportPaperService {
|
|
quesProperty.setId(idNumber);
|
|
quesProperty.setId(idNumber);
|
|
quesProperties.add(quesProperty);
|
|
quesProperties.add(quesProperty);
|
|
}
|
|
}
|
|
- }else{
|
|
|
|
- importPaperCheck.setErrorInfo(getQuesNumInfo(importPaperCheck.quesName, subQuesNum)+"中,小题二级属性值不存在,请检查");
|
|
|
|
- throw new PaperException(importPaperCheck.errorInfo);
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- }else{
|
|
|
|
- importPaperCheck.setErrorInfo(getQuesNumInfo(importPaperCheck.quesName, subQuesNum)+"中,小题一级属性值不存在,请检查");
|
|
|
|
- throw new PaperException(importPaperCheck.errorInfo);
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ if(isFirstEmpty){
|
|
|
|
+ importPaperCheck.setErrorInfo(getQuesNumInfo(importPaperCheck.quesName, subQuesNum)+"中,小题一级属性值不存在,请检查");
|
|
|
|
+ throw new PaperException(importPaperCheck.errorInfo);
|
|
|
|
+ }
|
|
|
|
+ if(isSecondEmpty){
|
|
|
|
+ importPaperCheck.setErrorInfo(getQuesNumInfo(importPaperCheck.quesName, subQuesNum)+"中,小题二级属性值不存在,请检查");
|
|
|
|
+ throw new PaperException(importPaperCheck.errorInfo);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
//一级属性有值,二级属性为空
|
|
//一级属性有值,二级属性为空
|
|
else if(StringUtils.isNotBlank(firstProperty) && StringUtils.isBlank(secondProperty)){
|
|
else if(StringUtils.isNotBlank(firstProperty) && StringUtils.isBlank(secondProperty)){
|
|
|
|
+ boolean isEmpty = true;
|
|
//根据课程查询所有课程属性树
|
|
//根据课程查询所有课程属性树
|
|
- List<CourseProperty> courseProperties = coursePropertyRepo.findByCourseCode(paper.getCourse().getCode());
|
|
|
|
|
|
+ List<CourseProperty> courseProperties = coursePropertyRepo.findByCourseCodeAndEnable(paper.getCourse().getCode(), true);
|
|
if(courseProperties == null || courseProperties.size()<1){
|
|
if(courseProperties == null || courseProperties.size()<1){
|
|
importPaperCheck.setErrorInfo(getQuesNumInfo(importPaperCheck.quesName, subQuesNum)+"中,没有设置课程属性结构,请先设置课程属性结构");
|
|
importPaperCheck.setErrorInfo(getQuesNumInfo(importPaperCheck.quesName, subQuesNum)+"中,没有设置课程属性结构,请先设置课程属性结构");
|
|
throw new PaperException(importPaperCheck.errorInfo);
|
|
throw new PaperException(importPaperCheck.errorInfo);
|
|
@@ -895,6 +902,7 @@ public class ImportPaperService {
|
|
List<Property> propertieParents = propertyRepo.findAll(Example.of(propertyParent));
|
|
List<Property> propertieParents = propertyRepo.findAll(Example.of(propertyParent));
|
|
//存在一级属性
|
|
//存在一级属性
|
|
if(propertieParents!=null && propertieParents.size()>0){
|
|
if(propertieParents!=null && propertieParents.size()>0){
|
|
|
|
+ isEmpty = false;
|
|
for(Property proParent:propertieParents){
|
|
for(Property proParent:propertieParents){
|
|
//根据一级属性查询二级属性
|
|
//根据一级属性查询二级属性
|
|
List<Property> proSons = propertyRepo.findByParentIdOrderByNumber(proParent.getId());
|
|
List<Property> proSons = propertyRepo.findByParentIdOrderByNumber(proParent.getId());
|
|
@@ -910,11 +918,12 @@ public class ImportPaperService {
|
|
quesProperties.add(quesProperty);
|
|
quesProperties.add(quesProperty);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- }else {
|
|
|
|
- importPaperCheck.setErrorInfo(getQuesNumInfo(importPaperCheck.quesName, subQuesNum)+"中,小题一级属性值不存在,请检查");
|
|
|
|
- throw new PaperException(importPaperCheck.errorInfo);
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ if(isEmpty){
|
|
|
|
+ importPaperCheck.setErrorInfo(getQuesNumInfo(importPaperCheck.quesName, subQuesNum)+"中,小题一级属性值不存在,请检查");
|
|
|
|
+ throw new PaperException(importPaperCheck.errorInfo);
|
|
|
|
+ }
|
|
}//一级,二级都为空
|
|
}//一级,二级都为空
|
|
else {
|
|
else {
|
|
|
|
|