Преглед на файлове

Merge remote-tracking branch 'origin/dev' into dev

dzx преди 1 година
родител
ревизия
15c5266ce5

+ 10 - 1
src/main/java/com/xjrsoft/module/student/entity/BaseStudentAssessmentInspection.java

@@ -99,6 +99,11 @@ public class BaseStudentAssessmentInspection implements Serializable {
     */
     @ApiModelProperty("班级Ids(多选)")
     private String classIds;
+    /**
+     * 学生Ids(多选)
+     */
+    @ApiModelProperty("学生Ids(多选)")
+    private String studentUserIds;
     /**
     * 考核时间
     */
@@ -135,5 +140,9 @@ public class BaseStudentAssessmentInspection implements Serializable {
     @ApiModelProperty("状态(1:结束 0:未结束)")
     private Integer status;
 
-
+    /**
+     * 考核对象
+     */
+    @ApiModelProperty("考核对象")
+    private String assessmentType;
 }

+ 40 - 2
src/main/java/com/xjrsoft/module/student/service/impl/BaseStudentAssessmentInspectionServiceImpl.java

@@ -6,6 +6,7 @@ import com.alibaba.excel.ExcelWriter;
 import com.alibaba.excel.support.ExcelTypeEnum;
 import com.alibaba.excel.write.metadata.WriteSheet;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.github.yulichang.base.MPJBaseServiceImpl;
@@ -242,7 +243,44 @@ public class BaseStudentAssessmentInspectionServiceImpl extends MPJBaseServiceIm
 
     @Override
     public Boolean dataHandle(Long id) {
-
-        return null;
+        //获取考核记录
+        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);
+                    }});
+                }
+            }
+            //同步数据到考核关联班级表
+            if(baseStudentAssessmentInspection.getAssessmentType() != null
+                    && baseStudentAssessmentInspection.getAssessmentType().equals("personal")
+                    && baseStudentAssessmentInspection.getStudentUserIds() != null
+                    && !baseStudentAssessmentInspection.getStudentUserIds().equals("")){
+                String[] studentIds = baseStudentAssessmentInspection.getStudentUserIds().split(",");
+                for (String studentId: studentIds) {
+                    assessmentStudentRelationMapper.insert(new BaseStudentAssessmentStudentRelation(){{
+                        setClassId(Long.parseLong(studentId));
+                        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);
+                    }});
+                }
+            }
+        }
+        return true;
     }
 }