|
|
@@ -1,21 +1,16 @@
|
|
|
package com.xjrsoft.module.banding.service.impl;
|
|
|
|
|
|
-import cn.dev33.satoken.secure.BCrypt;
|
|
|
import cn.dev33.satoken.stp.StpUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.github.yulichang.base.MPJBaseServiceImpl;
|
|
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
|
|
import com.xjrsoft.common.constant.GlobalConstant;
|
|
|
-import com.xjrsoft.common.enums.ArchivesStatusEnum;
|
|
|
import com.xjrsoft.common.enums.DeleteMark;
|
|
|
import com.xjrsoft.common.enums.EnabledMark;
|
|
|
-import com.xjrsoft.common.enums.RoleEnum;
|
|
|
import com.xjrsoft.common.exception.MyException;
|
|
|
-import com.xjrsoft.common.utils.LocalDateUtil;
|
|
|
import com.xjrsoft.common.utils.RedisUtil;
|
|
|
import com.xjrsoft.common.utils.VoToColumnUtil;
|
|
|
-import com.xjrsoft.config.CommonPropertiesConfig;
|
|
|
import com.xjrsoft.module.banding.dto.ChangeClassDto;
|
|
|
import com.xjrsoft.module.banding.dto.StudentDto;
|
|
|
import com.xjrsoft.module.banding.entity.BandingTask;
|
|
|
@@ -25,6 +20,7 @@ import com.xjrsoft.module.banding.mapper.BandingTaskClassMapper;
|
|
|
import com.xjrsoft.module.banding.mapper.BandingTaskClassStudentMapper;
|
|
|
import com.xjrsoft.module.banding.mapper.BandingTaskMapper;
|
|
|
import com.xjrsoft.module.banding.service.IBandingTaskClassStudentService;
|
|
|
+import com.xjrsoft.module.banding.vo.SyncStudentDataListVo;
|
|
|
import com.xjrsoft.module.base.entity.BaseClass;
|
|
|
import com.xjrsoft.module.base.entity.BaseSemester;
|
|
|
import com.xjrsoft.module.base.service.IBaseClassService;
|
|
|
@@ -35,27 +31,18 @@ import com.xjrsoft.module.organization.service.IUserRoleRelationService;
|
|
|
import com.xjrsoft.module.organization.service.IUserService;
|
|
|
import com.xjrsoft.module.student.dto.BaseNewStudentPageDto;
|
|
|
import com.xjrsoft.module.student.entity.BaseNewStudent;
|
|
|
-import com.xjrsoft.module.student.entity.BaseStudent;
|
|
|
-import com.xjrsoft.module.student.entity.BaseStudentFamily;
|
|
|
-import com.xjrsoft.module.student.entity.BaseStudentSchoolRoll;
|
|
|
import com.xjrsoft.module.student.entity.StudentReportPlan;
|
|
|
import com.xjrsoft.module.student.entity.StudentReportRecord;
|
|
|
import com.xjrsoft.module.student.mapper.StudentReportRecordMapper;
|
|
|
import com.xjrsoft.module.student.service.IBaseNewStudentService;
|
|
|
-import com.xjrsoft.module.student.service.IBaseStudentFamilyService;
|
|
|
-import com.xjrsoft.module.student.service.IBaseStudentSchoolRollService;
|
|
|
-import com.xjrsoft.module.student.service.IBaseStudentService;
|
|
|
import com.xjrsoft.module.student.service.IStudentReportPlanService;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
-import java.time.LocalDate;
|
|
|
-import java.time.LocalDateTime;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.Date;
|
|
|
-import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.concurrent.CompletableFuture;
|
|
|
@@ -388,4 +375,54 @@ public class BandingTaskClassStudentServiceImpl extends MPJBaseServiceImpl<Bandi
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 同步修改学生的班级信息
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ @Transactional
|
|
|
+ public Boolean syncStudentData(StudentReportPlan studentReportPlan) {
|
|
|
+ List<SyncStudentDataListVo> syncStudentDataList = this.baseMapper.getSyncStudentDataList(studentReportPlan.getId());
|
|
|
+ List<Long> newStudentIds = syncStudentDataList.stream().map(SyncStudentDataListVo::getNewStudentId).collect(Collectors.toList());
|
|
|
+
|
|
|
+ //修改新生基本信息
|
|
|
+ Map<Long, String> stduyStatusMap = syncStudentDataList.stream().collect(Collectors.toMap(SyncStudentDataListVo::getNewStudentId, SyncStudentDataListVo::getStduyStatus));
|
|
|
+ List<BaseNewStudent> studentList = newStudentService.listByIds(newStudentIds);
|
|
|
+ for (BaseNewStudent student : studentList) {
|
|
|
+ student.setStduyStatus(stduyStatusMap.get(student.getId()));
|
|
|
+ }
|
|
|
+ newStudentService.updateBatchById(studentList);
|
|
|
+
|
|
|
+ //修改班级信息
|
|
|
+ Map<Long, Long> bandingTaskClassMap = syncStudentDataList.stream().filter(x -> x.getBandingTaskClassId() != null).collect(Collectors.toMap(SyncStudentDataListVo::getNewStudentId, SyncStudentDataListVo::getBandingTaskClassId));
|
|
|
+
|
|
|
+ List<BandingTaskClass> taskClassList = taskClassMapper.selectList(
|
|
|
+ new QueryWrapper<BandingTaskClass>().lambda()
|
|
|
+ .eq(BandingTaskClass::getBandingTaskId, studentReportPlan.getBandingTaskId())
|
|
|
+ );
|
|
|
+ Map<Long, Long> taskClassMap = taskClassList.stream().collect(Collectors.toMap(BandingTaskClass::getBaseClassId, BandingTaskClass::getId));
|
|
|
+
|
|
|
+ List<BandingTaskClassStudent> insertList = new ArrayList<>();
|
|
|
+ for (BaseNewStudent student : studentList) {
|
|
|
+ Long bandingTaskClassId = bandingTaskClassMap.get(student.getId());
|
|
|
+ if(bandingTaskClassId == null){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ insertList.add(new BandingTaskClassStudent(){{
|
|
|
+ setBandingTaskClassId(taskClassMap.get(bandingTaskClassId));
|
|
|
+ setNewStudentId(student.getId());
|
|
|
+ setCreateDate(new Date());
|
|
|
+ setStatus(1);
|
|
|
+ }});
|
|
|
+ }
|
|
|
+
|
|
|
+ if(!insertList.isEmpty()){
|
|
|
+ this.remove(
|
|
|
+ new QueryWrapper<BandingTaskClassStudent>().lambda()
|
|
|
+ .in(BandingTaskClassStudent::getNewStudentId, newStudentIds)
|
|
|
+ );
|
|
|
+ this.saveBatch(insertList);
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
}
|