教师转入
This commit is contained in:
+9
-8
@@ -206,6 +206,10 @@ public class SchStudentTransferService {
|
|||||||
cacheKeysToDelete.add(RedisConstants.SCHOOL_CLASS_STUDENT + "_"
|
cacheKeysToDelete.add(RedisConstants.SCHOOL_CLASS_STUDENT + "_"
|
||||||
+ targetSchId + "_" + targetClassId);
|
+ targetSchId + "_" + targetClassId);
|
||||||
|
|
||||||
|
// 已在目标学校且已在目标班级的学生 转入
|
||||||
|
if (student.getSchId().equals(targetSchId) && targetClassId.equals(student.getClassId())) {
|
||||||
|
sendUserBaseService.changeUserStatus(student.getStuId(),true);
|
||||||
|
}else {
|
||||||
// 执行批量更新(更新学校和班级,transferStatus 置为转入 0)
|
// 执行批量更新(更新学校和班级,transferStatus 置为转入 0)
|
||||||
int updated = schStudentRepository.batchUpdateSchIdAndClassId(
|
int updated = schStudentRepository.batchUpdateSchIdAndClassId(
|
||||||
Collections.singletonList(student.getId()),
|
Collections.singletonList(student.getId()),
|
||||||
@@ -217,20 +221,17 @@ public class SchStudentTransferService {
|
|||||||
if (updated != 1) {
|
if (updated != 1) {
|
||||||
throw new DException("更新失败,可能学生已被删除或修改,请刷新后重试");
|
throw new DException("更新失败,可能学生已被删除或修改,请刷新后重试");
|
||||||
}
|
}
|
||||||
|
// 平台同步:转入目标学校/班级(fromSchoolId 取转入前的原学校)
|
||||||
|
sendUserBaseService.transferUserToSchool(student.getStuId(), student.getSchId(), targetSchId, targetClassId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 清除缓存(直接按Key删除)
|
// 清除缓存(直接按Key删除)
|
||||||
for (String cacheKey : cacheKeysToDelete) {
|
for (String cacheKey : cacheKeysToDelete) {
|
||||||
redisUtil.del(cacheKey);
|
redisUtil.del(cacheKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 已在目标学校且已在目标班级的学生 转入
|
|
||||||
if (student.getSchId().equals(targetSchId) && targetClassId.equals(student.getClassId())) {
|
|
||||||
sendUserBaseService.changeUserStatus(student.getStuId(),true);
|
|
||||||
}else {
|
|
||||||
// 平台同步:转入目标学校/班级(fromSchoolId 取转入前的原学校)
|
|
||||||
sendUserBaseService.transferUserToSchool(student.getStuId(), student.getSchId(), targetSchId, targetClassId);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 异步记录操作日志
|
// 异步记录操作日志
|
||||||
logService.setTransferInLog(user, Collections.singletonList(student), targetSchId, targetClassId);
|
logService.setTransferInLog(user, Collections.singletonList(student), targetSchId, targetClassId);
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -168,9 +168,8 @@ public class SchTeacherRelationService {
|
|||||||
boolean alreadyInTarget = oldRelations.stream()
|
boolean alreadyInTarget = oldRelations.stream()
|
||||||
.anyMatch(r -> targetSchId.equals(r.getSchId()) && targetGroupId.equals(r.getGroupId()));
|
.anyMatch(r -> targetSchId.equals(r.getSchId()) && targetGroupId.equals(r.getGroupId()));
|
||||||
if (alreadyInTarget) {
|
if (alreadyInTarget) {
|
||||||
return;
|
sendUserBaseService.changeUserStatus(teaId, true);
|
||||||
}
|
}else {
|
||||||
|
|
||||||
// 删除原学校旧关联
|
// 删除原学校旧关联
|
||||||
schTeacherGroupRepository.deleteAll(oldRelations);
|
schTeacherGroupRepository.deleteAll(oldRelations);
|
||||||
|
|
||||||
@@ -184,6 +183,7 @@ public class SchTeacherRelationService {
|
|||||||
|
|
||||||
// 平台同步:转入目标学校/目标组
|
// 平台同步:转入目标学校/目标组
|
||||||
sendUserBaseService.transferUserToSchool(teaId, fromSchId, targetSchId, targetGroupId);
|
sendUserBaseService.transferUserToSchool(teaId, fromSchId, targetSchId, targetGroupId);
|
||||||
|
}
|
||||||
|
|
||||||
// 异步记录操作日志
|
// 异步记录操作日志
|
||||||
schTeacherRepository.findByTeaId(teaId).ifPresent(teacher ->
|
schTeacherRepository.findByTeaId(teaId).ifPresent(teacher ->
|
||||||
|
|||||||
Reference in New Issue
Block a user