|
@@ -1048,6 +1048,7 @@ public class BaseStudentAssessmentInspectionServiceImpl extends MPJBaseServiceIm
|
|
|
|
|
|
List<BaseStudentAssessmentInspection> insertList = new ArrayList<>();
|
|
|
List<BaseStudentAssessmentStudentRelation> childInsertList = new ArrayList<>();
|
|
|
+ List<BaseStudentAssessmentClassRelation> child2InsertList = new ArrayList<>();
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd");
|
|
|
for (ImportBaseStudentAssessmentInspectionDto dto : savedDataList) {
|
|
|
long id = IdUtil.getSnowflakeNextId();
|
|
@@ -1059,16 +1060,6 @@ public class BaseStudentAssessmentInspectionServiceImpl extends MPJBaseServiceIm
|
|
|
data.setDeleteMark(DeleteMark.NODELETE.getCode());
|
|
|
data.setCreateDate(new Date());
|
|
|
data.setCreateUserId(StpUtil.getLoginIdAsLong());
|
|
|
- if("班级".equals(dto.getAssessmentType())){
|
|
|
- data.setAssessmentType("class");
|
|
|
- }else if("个人".equals(dto.getAssessmentType())){
|
|
|
- data.setAssessmentType("personal");
|
|
|
- if(!studentMap.containsKey(dto.getCredentialNumber())){
|
|
|
- checkStudents.add(dto.getStudentName());
|
|
|
- continue;
|
|
|
- }
|
|
|
- data.setPersonalStudentUserIds(studentMap.get(dto.getCredentialNumber()));
|
|
|
- }
|
|
|
BaseClass baseClass = classMap.get(dto.getClassName());
|
|
|
data.setClassIds(baseClass.getId().toString());
|
|
|
data.setGradeId(baseClass.getGradeId());
|
|
@@ -1101,16 +1092,35 @@ public class BaseStudentAssessmentInspectionServiceImpl extends MPJBaseServiceIm
|
|
|
data.setAssessmentUserId(StpUtil.getLoginIdAsLong());
|
|
|
data.setAssessmentDate(sdf.parse(dto.getAssessmentDate()));
|
|
|
|
|
|
+ if("班级".equals(dto.getAssessmentType())){
|
|
|
+ data.setAssessmentType("class");
|
|
|
+
|
|
|
+ BaseStudentAssessmentClassRelation children = new BaseStudentAssessmentClassRelation();
|
|
|
+ children.setBaseStudentAssessmentInspectionId(id);
|
|
|
+ children.setClassId(baseClass.getId());
|
|
|
+ child2InsertList.add(children);
|
|
|
+
|
|
|
+ }else if("个人".equals(dto.getAssessmentType())){
|
|
|
+ data.setAssessmentType("personal");
|
|
|
+ if(!studentMap.containsKey(dto.getCredentialNumber())){
|
|
|
+ checkStudents.add(dto.getStudentName());
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ data.setPersonalStudentUserIds(studentMap.get(dto.getCredentialNumber()));
|
|
|
+
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+
|
|
|
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() + " 在系统中不存在");
|
|
@@ -1129,6 +1139,11 @@ public class BaseStudentAssessmentInspectionServiceImpl extends MPJBaseServiceIm
|
|
|
assessmentStudentRelationMapper.insert(baseStudentAssessmentStudentRelation);
|
|
|
}
|
|
|
}
|
|
|
+ if(!child2InsertList.isEmpty()){
|
|
|
+ for (BaseStudentAssessmentClassRelation baseStudentAssessmentStudentRelation : child2InsertList) {
|
|
|
+ assessmentClassRelationMapper.insert(baseStudentAssessmentStudentRelation);
|
|
|
+ }
|
|
|
+ }
|
|
|
}catch (Exception e){
|
|
|
Log.error(e.getMessage(), e);
|
|
|
if(e.getClass().equals(MyException.class)){
|