Browse Source

班级考核调整

dzx 1 năm trước cách đây
mục cha
commit
40685dd6f4

+ 29 - 39
src/main/java/com/xjrsoft/module/student/service/impl/BaseStudentAssessmentInspectionServiceImpl.java

@@ -493,47 +493,37 @@ public class BaseStudentAssessmentInspectionServiceImpl extends MPJBaseServiceIm
         BaseStudentAssessmentInspection baseStudentAssessmentInspection = this.getById(id);
         if(baseStudentAssessmentInspection != null){
             //同步数据到考核关联班级表
-            if(baseStudentAssessmentInspection.getAssessmentType() != null
-                    && baseStudentAssessmentInspection.getAssessmentType().equals("class")
-                    && baseStudentAssessmentInspection.getClassIds() != null
-                    && !baseStudentAssessmentInspection.getClassIds().equals("")){
-                String[] classIds = baseStudentAssessmentInspection.getClassIds().split(",");
-                for (String classId: classIds) {
-                    assessmentClassRelationMapper.insert(new BaseStudentAssessmentClassRelation(){{
-                        setClassId(Long.parseLong(classId));
-                        setBaseStudentAssessmentInspectionId(baseStudentAssessmentInspection.getId());
-                        QueryWrapper<BaseStudentAssessmentClassRelation> queryWrapperSortcode = new QueryWrapper<>();
-                        queryWrapperSortcode.select("IFNULL(MAX(sort_code),0) as sortCode");
-                        BaseStudentAssessmentClassRelation b = assessmentClassRelationMapper.selectOne(queryWrapperSortcode);
-                        setSortCode(b.getSortCode() + 1);
-                    }});
-                }
+            String[] classIds = baseStudentAssessmentInspection.getClassIds().split(",");
+            for (String classId: classIds) {
+                assessmentClassRelationMapper.insert(new BaseStudentAssessmentClassRelation(){{
+                    setClassId(Long.parseLong(classId));
+                    setBaseStudentAssessmentInspectionId(baseStudentAssessmentInspection.getId());
+                    QueryWrapper<BaseStudentAssessmentClassRelation> queryWrapperSortcode = new QueryWrapper<>();
+                    queryWrapperSortcode.select("IFNULL(MAX(sort_code),0) as sortCode");
+                    BaseStudentAssessmentClassRelation b = assessmentClassRelationMapper.selectOne(queryWrapperSortcode);
+                    setSortCode(b.getSortCode() + 1);
+                }});
             }
             //同步数据到考核关联学生表
-            if(baseStudentAssessmentInspection.getAssessmentType() != null
-                    && baseStudentAssessmentInspection.getAssessmentType().equals("personal")
-                    && baseStudentAssessmentInspection.getPersonalStudentUserIds() != null
-                    && !baseStudentAssessmentInspection.getPersonalStudentUserIds().equals("")){
-                String[] studentIds = baseStudentAssessmentInspection.getPersonalStudentUserIds().split(",");
-                for (String studentId: studentIds) {
-                    assessmentStudentRelationMapper.insert(new BaseStudentAssessmentStudentRelation(){{
-                        MPJLambdaWrapper<BaseStudentSchoolRoll> baseStudentSchoolRollMPJLambdaWrapper = new MPJLambdaWrapper<>();
-                        baseStudentSchoolRollMPJLambdaWrapper
-                                .select(BaseStudentSchoolRoll::getId)
-                                .select(BaseStudentSchoolRoll.class, x -> VoToColumnUtil.fieldsToColumns(BaseStudentSchoolRoll.class).contains(x.getProperty()))
-                                .eq(BaseStudentSchoolRoll::getUserId, studentId);
-                        BaseStudentSchoolRoll baseStudentSchoolRoll = baseStudentSchoolRollMapper.selectOne(baseStudentSchoolRollMPJLambdaWrapper);
-                        if(baseStudentSchoolRoll != null){
-                            setClassId(baseStudentSchoolRoll.getClassId());
-                        }
-                        setUserId(Long.parseLong(studentId));
-                        setBaseStudentAssessmentInspectionId(baseStudentAssessmentInspection.getId());
-                        QueryWrapper<BaseStudentAssessmentStudentRelation> queryWrapperSortcode = new QueryWrapper<>();
-                        queryWrapperSortcode.select("IFNULL(MAX(sort_code),0) as sortCode");
-                        BaseStudentAssessmentStudentRelation b = assessmentStudentRelationMapper.selectOne(queryWrapperSortcode);
-                        setSortCode(b.getSortCode() + 1);
-                    }});
-                }
+            String[] studentIds = baseStudentAssessmentInspection.getPersonalStudentUserIds().split(",");
+            for (String studentId: studentIds) {
+                assessmentStudentRelationMapper.insert(new BaseStudentAssessmentStudentRelation(){{
+                    MPJLambdaWrapper<BaseStudentSchoolRoll> baseStudentSchoolRollMPJLambdaWrapper = new MPJLambdaWrapper<>();
+                    baseStudentSchoolRollMPJLambdaWrapper
+                            .select(BaseStudentSchoolRoll::getId)
+                            .select(BaseStudentSchoolRoll.class, x -> VoToColumnUtil.fieldsToColumns(BaseStudentSchoolRoll.class).contains(x.getProperty()))
+                            .eq(BaseStudentSchoolRoll::getUserId, studentId);
+                    BaseStudentSchoolRoll baseStudentSchoolRoll = baseStudentSchoolRollMapper.selectOne(baseStudentSchoolRollMPJLambdaWrapper);
+                    if(baseStudentSchoolRoll != null){
+                        setClassId(baseStudentSchoolRoll.getClassId());
+                    }
+                    setUserId(Long.parseLong(studentId));
+                    setBaseStudentAssessmentInspectionId(baseStudentAssessmentInspection.getId());
+                    QueryWrapper<BaseStudentAssessmentStudentRelation> queryWrapperSortcode = new QueryWrapper<>();
+                    queryWrapperSortcode.select("IFNULL(MAX(sort_code),0) as sortCode");
+                    BaseStudentAssessmentStudentRelation b = assessmentStudentRelationMapper.selectOne(queryWrapperSortcode);
+                    setSortCode(b.getSortCode() + 1);
+                }});
             }
         }
         return true;