任教
build / build-push (push) Successful in 1m4s

This commit is contained in:
wanghu
2026-09-20 20:13:54 +08:00
parent 3e18856c0c
commit 9f3b49c30a
@@ -6,6 +6,7 @@ import io.swagger.v3.oas.annotations.tags.Tag;
import com.yunhai.bschclassmanage.Repository.*;
import com.yunhai.bschclassmanage.config.Config;
import com.yunhai.bschclassmanage.entity.*;
import com.yunhai.bschclassmanage.enums.TransferStatus;
import com.yunhai.bschclassmanage.service.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
@@ -20,7 +21,7 @@ import java.util.stream.Collectors;
public class TeaChesController {
@Autowired private SchClassTeachRepository teachingRepository;
@Autowired private SchInfoRepository schoolRepository;
@Autowired private ISchTeacherService teacherService;
@Autowired private SchTeacherGroupRepository teacherGroupRepository;
@Autowired private ISchClassService classService;
@Autowired private ISchDicSubjectService subjectService;
@@ -62,14 +63,14 @@ public class TeaChesController {
List<SchClassTeach> list = teachingRepository.findAll().stream().filter(t -> ids.contains(t.getSchId())).collect(Collectors.toList());
return ResponseEntity.ok(normalFiltered(list).stream().map(t -> OaCompatSupport.teaching(t, schoolSer(t.getSchId()))).collect(Collectors.toList()));
}
/** 只保留正常教师(status=1)、正常班级(未毕业)、启用学科(enable=true)的任教记录,按学校分别过滤 */
/** 只保留正常教师(sch_teacher_group 中 transfer_status=转入)、正常班级(未毕业)、启用学科(enable=true)的任教记录,按学校分别过滤 */
private List<SchClassTeach> normalFiltered(List<SchClassTeach> teaches) {
List<SchClassTeach> out = new ArrayList<>();
Map<Integer, List<SchClassTeach>> bySch = new HashMap<>();
for (SchClassTeach t : teaches) if (t.getSchId() != null) bySch.computeIfAbsent(t.getSchId(), k -> new ArrayList<>()).add(t);
for (Map.Entry<Integer, List<SchClassTeach>> e : bySch.entrySet()) {
Integer schId = e.getKey();
Set<Integer> teaIds = teacherService.getSchTeacherCacheList(schId).stream().filter(t -> t.getStatus() == 1).map(SchTeacher::getTeaId).collect(Collectors.toSet());
Set<Integer> teaIds = teacherGroupRepository.findBySchIdAndTransferStatus(schId, TransferStatus.IN.getId()).stream().map(SchTeacherGroup::getTeaId).collect(Collectors.toSet());
Set<Integer> classIds = classService.getSchAllClassCacheList(schId).stream().filter(c -> !Boolean.TRUE.equals(c.getGraduate()) && c.getClassId() != null).map(SchClass::getClassId).collect(Collectors.toSet());
Set<String> subCodes = subjectService.toEnableIdAndNameMap(schId, null).keySet();
for (SchClassTeach t : e.getValue()) if (teaIds.contains(t.getTeaId()) && classIds.contains(t.getClassId()) && t.getSubId() != null && subCodes.contains(t.getSubId())) out.add(t);