|
|
@@ -5,13 +5,17 @@ import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.util.NumberUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
+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.DeleteMark;
|
|
|
import com.xjrsoft.common.enums.EnabledMark;
|
|
|
import com.xjrsoft.common.enums.GenderDictionaryEnum;
|
|
|
+import com.xjrsoft.common.enums.RoleEnum;
|
|
|
import com.xjrsoft.common.enums.YesOrNoEnum;
|
|
|
import com.xjrsoft.common.exception.MyException;
|
|
|
+import com.xjrsoft.common.utils.RedisUtil;
|
|
|
import com.xjrsoft.common.utils.VoToColumnUtil;
|
|
|
import com.xjrsoft.module.banding.dto.BandingTaskClassPageDto;
|
|
|
import com.xjrsoft.module.banding.dto.BandingTaskClassStudentPageDto;
|
|
|
@@ -36,6 +40,8 @@ import com.xjrsoft.module.base.mapper.BaseGradeMapper;
|
|
|
import com.xjrsoft.module.base.service.IBaseClassroomService;
|
|
|
import com.xjrsoft.module.base.service.IBaseMajorSetService;
|
|
|
import com.xjrsoft.module.organization.entity.User;
|
|
|
+import com.xjrsoft.module.organization.entity.UserRoleRelation;
|
|
|
+import com.xjrsoft.module.organization.service.IUserRoleRelationService;
|
|
|
import com.xjrsoft.module.organization.service.IUserService;
|
|
|
import com.xjrsoft.module.student.dto.StudentTryReadingReportPageDto;
|
|
|
import com.xjrsoft.module.student.entity.EnrollmentPlan;
|
|
|
@@ -61,6 +67,7 @@ import java.util.Date;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
+import java.util.concurrent.CompletableFuture;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
@@ -84,6 +91,8 @@ public class BandingTaskClassServiceImpl extends MPJBaseServiceImpl<BandingTaskC
|
|
|
private final EnrollmentPlanMapper enrollmentPlanMapper;
|
|
|
private final IStudentReportPlanService reportPlanService;
|
|
|
private final BaseGradeMapper gradeMapper;
|
|
|
+ private final IUserRoleRelationService roleRelationService;
|
|
|
+ private final RedisUtil redisUtil;
|
|
|
|
|
|
|
|
|
@Override
|
|
|
@@ -305,6 +314,23 @@ public class BandingTaskClassServiceImpl extends MPJBaseServiceImpl<BandingTaskC
|
|
|
baseClass.setCode(baseGrade.getTitle().replace("年", "") + String.format("%03d", i));
|
|
|
}
|
|
|
classMapper.updateById(baseClass);
|
|
|
+
|
|
|
+ //给该老师添加班主任角色
|
|
|
+ if (baseClass.getTeacherId() != null) {
|
|
|
+ long count = roleRelationService.count(
|
|
|
+ new QueryWrapper<UserRoleRelation>().lambda()
|
|
|
+ .eq(UserRoleRelation::getUserId, baseClass.getTeacherId())
|
|
|
+ .eq(UserRoleRelation::getRoleId, RoleEnum.CLASSTE.getCode())
|
|
|
+ );
|
|
|
+ if (count == 0) {
|
|
|
+ roleRelationService.save(
|
|
|
+ new UserRoleRelation() {{
|
|
|
+ setRoleId(RoleEnum.CLASSTE.getCode());
|
|
|
+ setUserId(baseClass.getTeacherId());
|
|
|
+ }}
|
|
|
+ );
|
|
|
+ }
|
|
|
+ }
|
|
|
}else{
|
|
|
i ++;
|
|
|
BaseClass baseClass = new BaseClass();
|
|
|
@@ -323,6 +349,22 @@ public class BandingTaskClassServiceImpl extends MPJBaseServiceImpl<BandingTaskC
|
|
|
baseClass.setCode(baseGrade.getTitle().replace("年", "") + String.format("%03d", i));
|
|
|
classMapper.insert(baseClass);
|
|
|
sourceObj.setBaseClassId(baseClass.getId());
|
|
|
+
|
|
|
+ if (baseClass.getTeacherId() != null) {
|
|
|
+ long count = roleRelationService.count(
|
|
|
+ new QueryWrapper<UserRoleRelation>().lambda()
|
|
|
+ .eq(UserRoleRelation::getUserId, baseClass.getTeacherId())
|
|
|
+ .eq(UserRoleRelation::getRoleId, RoleEnum.CLASSTE.getCode())
|
|
|
+ );
|
|
|
+ if (count == 0) {
|
|
|
+ roleRelationService.save(
|
|
|
+ new UserRoleRelation() {{
|
|
|
+ setRoleId(RoleEnum.CLASSTE.getCode());
|
|
|
+ setUserId(baseClass.getTeacherId());
|
|
|
+ }}
|
|
|
+ );
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
if(sourceObj.getSortCode() == null){
|
|
|
updNullList.add(sourceObj);
|
|
|
@@ -350,6 +392,21 @@ public class BandingTaskClassServiceImpl extends MPJBaseServiceImpl<BandingTaskC
|
|
|
baseClass.setCreateDate(new Date());
|
|
|
baseClass.setCode(baseGrade.getTitle().replace("年", "") + String.format("%03d", i));
|
|
|
classMapper.insert(baseClass);
|
|
|
+ if (baseClass.getTeacherId() != null) {
|
|
|
+ long count = roleRelationService.count(
|
|
|
+ new QueryWrapper<UserRoleRelation>().lambda()
|
|
|
+ .eq(UserRoleRelation::getUserId, baseClass.getTeacherId())
|
|
|
+ .eq(UserRoleRelation::getRoleId, RoleEnum.CLASSTE.getCode())
|
|
|
+ );
|
|
|
+ if (count == 0) {
|
|
|
+ roleRelationService.save(
|
|
|
+ new UserRoleRelation() {{
|
|
|
+ setRoleId(RoleEnum.CLASSTE.getCode());
|
|
|
+ setUserId(baseClass.getTeacherId());
|
|
|
+ }}
|
|
|
+ );
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
taskClass.setBaseClassId(baseClass.getId());
|
|
|
insList.add(taskClass);
|
|
|
@@ -363,11 +420,16 @@ public class BandingTaskClassServiceImpl extends MPJBaseServiceImpl<BandingTaskC
|
|
|
this.updateNull(updNullList);
|
|
|
}
|
|
|
|
|
|
+ CompletableFuture.runAsync(() -> {
|
|
|
+ List<UserRoleRelation> userRoleRelationList = roleRelationService.list(Wrappers.lambdaQuery(UserRoleRelation.class));
|
|
|
+ redisUtil.set(GlobalConstant.USER_ROLE_RELATION_CACHE_KEY, userRoleRelationList);
|
|
|
+ });
|
|
|
|
|
|
this.saveBatch(insList);
|
|
|
return this.updateBatchById(updList);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
/**
|
|
|
* 班级管理中,修改信息时同步修改新生分班中的班级信息
|
|
|
*/
|