|
@@ -99,7 +99,6 @@ import java.math.RoundingMode;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.time.LocalDate;
|
|
|
import java.time.LocalDateTime;
|
|
|
-import java.time.ZoneId;
|
|
|
import java.time.temporal.TemporalAdjusters;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
@@ -992,8 +991,9 @@ public class BaseStudentAssessmentInspectionServiceImpl extends MPJBaseServiceIm
|
|
|
new QueryWrapper<BaseClass>().lambda()
|
|
|
.in(BaseClass::getName, classNames)
|
|
|
);
|
|
|
- Map<String, Long> classMap = classList.stream().collect(Collectors.toMap(BaseClass::getName, BaseClass::getId));
|
|
|
- Set<String> checkClassNames = new HashSet<>(classNames);
|
|
|
+ Map<String, BaseClass> classMap = classList.stream().collect(Collectors.toMap(BaseClass::getName, x -> x));
|
|
|
+
|
|
|
+ Set<String> checkClassNames = new HashSet<>(classMap.values().stream().map(BaseClass::getName).collect(Collectors.toSet()));
|
|
|
checkClassNames.removeAll(classMap.keySet());
|
|
|
if(!checkClassNames.isEmpty()){
|
|
|
throw new MyException("导入表格中的班级:" + checkClassNames.toString() + " 在系统中不存在");
|
|
@@ -1047,11 +1047,14 @@ public class BaseStudentAssessmentInspectionServiceImpl extends MPJBaseServiceIm
|
|
|
Set<String> checkItems = new HashSet<>();
|
|
|
|
|
|
List<BaseStudentAssessmentInspection> insertList = new ArrayList<>();
|
|
|
+ List<BaseStudentAssessmentStudentRelation> childInsertList = new ArrayList<>();
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd");
|
|
|
for (ImportBaseStudentAssessmentInspectionDto dto : savedDataList) {
|
|
|
-
|
|
|
+ long id = IdUtil.getSnowflakeNextId();
|
|
|
BaseStudentAssessmentInspection data = new BaseStudentAssessmentInspection();
|
|
|
|
|
|
+ data.setId(id);
|
|
|
+
|
|
|
data.setEnabledMark(EnabledMark.ENABLED.getCode());
|
|
|
data.setDeleteMark(DeleteMark.NODELETE.getCode());
|
|
|
data.setCreateDate(new Date());
|
|
@@ -1066,7 +1069,9 @@ public class BaseStudentAssessmentInspectionServiceImpl extends MPJBaseServiceIm
|
|
|
}
|
|
|
data.setPersonalStudentUserIds(studentMap.get(dto.getCredentialNumber()));
|
|
|
}
|
|
|
- data.setClassIds(classMap.get(dto.getClassName()).toString());
|
|
|
+ BaseClass baseClass = classMap.get(dto.getClassName());
|
|
|
+ data.setClassIds(baseClass.getId().toString());
|
|
|
+ data.setGradeId(baseClass.getGradeId());
|
|
|
data.setBaseStudentAssessmentCategoryId(categoryMap.get(dto.getAssessmentCategory()));
|
|
|
|
|
|
|
|
@@ -1084,7 +1089,8 @@ public class BaseStudentAssessmentInspectionServiceImpl extends MPJBaseServiceIm
|
|
|
}
|
|
|
BaseStudentAssessmentProject project = projectGroup.get(dto.getAssessmentProject());
|
|
|
data.setBaseStudentAssessmentProjectId(project.getId());
|
|
|
-
|
|
|
+ data.setScore(project.getBasicPoints());
|
|
|
+ data.setTotalScore(project.getBasicPoints());
|
|
|
if(project.getBasicPoints() > 0){
|
|
|
data.setScoreType("score_add");
|
|
|
}else{
|
|
@@ -1096,6 +1102,15 @@ public class BaseStudentAssessmentInspectionServiceImpl extends MPJBaseServiceIm
|
|
|
data.setAssessmentDate(sdf.parse(dto.getAssessmentDate()));
|
|
|
|
|
|
insertList.add(data);
|
|
|
+
|
|
|
+ BaseStudentAssessmentStudentRelation children = new BaseStudentAssessmentStudentRelation();
|
|
|
+ children.setBaseStudentAssessmentInspectionId(id);
|
|
|
+ children.setScore(project.getBasicPoints());
|
|
|
+ children.setUserId(Long.parseLong(studentMap.get(dto.getCredentialNumber())));
|
|
|
+ children.setClassId(baseClass.getId());
|
|
|
+ children.setEnabledMark(EnabledMark.ENABLED.getCode());
|
|
|
+ children.setDeleteMark(DeleteMark.NODELETE.getCode());
|
|
|
+ childInsertList.add(children);
|
|
|
}
|
|
|
if(!checkStudents.isEmpty()){
|
|
|
throw new MyException("导入表格中的学生:" + checkStudents.toString() + " 在系统中不存在");
|
|
@@ -1109,6 +1124,11 @@ public class BaseStudentAssessmentInspectionServiceImpl extends MPJBaseServiceIm
|
|
|
if(!insertList.isEmpty()){
|
|
|
this.saveBatch(insertList);
|
|
|
}
|
|
|
+ if(!childInsertList.isEmpty()){
|
|
|
+ for (BaseStudentAssessmentStudentRelation baseStudentAssessmentStudentRelation : childInsertList) {
|
|
|
+ assessmentStudentRelationMapper.insert(baseStudentAssessmentStudentRelation);
|
|
|
+ }
|
|
|
+ }
|
|
|
}catch (Exception e){
|
|
|
Log.error(e.getMessage(), e);
|
|
|
if(e.getClass().equals(MyException.class)){
|