学段修改

This commit is contained in:
2026-08-20 14:36:10 +08:00
parent 5f184f4b4b
commit 736c21bb21
4 changed files with 126 additions and 7 deletions
@@ -1,5 +1,6 @@
package com.yunhai.bschclassmanage.enums;
import com.yunhai.bschclassmanage.model.vo.SelectIntVO;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
@@ -7,6 +8,8 @@ import lombok.NoArgsConstructor;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Getter
@NoArgsConstructor
@@ -22,8 +25,72 @@ public enum AcademicStage
private Integer key;
private String value;
AcademicStage(int key, String value)
{
this.key = key;
this.value = value;
}
public int getId()
{
return key;
}
public void setId(int id)
{
this.key = id;
}
public String getName()
{
return value;
}
public void setName(String name)
{
this.value = name;
}
public static List<AcademicStage> list()
{
return new ArrayList<>(EnumSet.allOf(AcademicStage.class));
}
public static List<SelectIntVO> select() {
List<SelectIntVO> list= list().stream()
.map(type -> new SelectIntVO(type.getId(), type.getName()))
.collect(Collectors.toList());
return new ArrayList<>(list);
}
public static Map<Integer, AcademicStage> map()
{
return list().stream().collect(Collectors.toMap(AcademicStage::getId, QuestionType->QuestionType));
}
public static String nameById(int id) {
for (AcademicStage type : list()) {
if (type.getId() == id) return type.getName();
}
return null;
}
public static Integer getIdByName(String name) {
for (AcademicStage type : list()) {
if (type.getName().equals(name)) return type.getId();
}
return null;
}
public static AcademicStage getById(int id)
{
for (AcademicStage na : list())
{
if (na.getId() == id)
{
return na;
}
}
return null;
}
}
@@ -249,21 +249,29 @@ public class SchBinSchsystemService implements ISchBinSchsystemService {
//创建校长室
sendUserBaseService.addGroup("校长室", teaGroup.getId(),1,NodeType.NORMAL,schId);
//获取学制
//获取学段
List<Integer> schsystemIds= getSchBinSchsystemIds(schId);
Map<Integer, String> schsystemMap=getSchBinSchsystemMap(schId);
List<BaseSchsystem> baseSchsystems=baseSchsystemService.getSchsystemList().stream().filter(s->schsystemIds.contains(s.getId())).collect(Collectors.toList());
List<SchBinSchsystem> schBinSchsystemList= getSchBinSchsystemList(schId);
if(newList.size()==1)
{
}else if(newList.size()>1)
{
Integer scort=1;
for (SchBinSchsystem schsystem:newList) {
for (SchBinSchsystem schsystem:schBinSchsystemList) {
//添加学段组
BoaGroup sectionGroup= sendUserBaseService.addGroup(schsystemMap.get(schsystem.getSchSystemId()),stuGroup.getId(),scort,NodeType.SECTION,schId);
schsystem.setGroupId(sectionGroup.getId());
scort++;
Optional<BaseSchsystem> baseSchsystemFirst= baseSchsystems.stream().filter(s->Objects.equals( schsystem.getSchSystemId(),s.getId())).findFirst();
if(baseSchsystemFirst.isPresent())
{
String academicStageName= AcademicStage.nameById(baseSchsystemFirst.get().getType());
BoaGroup sectionGroup= sendUserBaseService.addGroup(academicStageName,stuGroup.getId(),scort,NodeType.SECTION,schId);
schsystem.setGroupId(sectionGroup.getId());
scort++;
}
}
}else {
throw new DException("请选择学制!");
@@ -0,0 +1,44 @@
package com.yunhai.bschclassmanage.service.impl.com;
import com.alibaba.fastjson.JSON;
import com.yunhai.bschclassmanage.Repository.SchClassRepository;
import com.yunhai.bschclassmanage.Repository.SchDicMajorsRepository;
import com.yunhai.bschclassmanage.Repository.SchTeacherGroupRepository;
import com.yunhai.bschclassmanage.entity.*;
import com.yunhai.bschclassmanage.enums.AcademicStage;
import com.yunhai.bschclassmanage.enums.NodeType;
import com.yunhai.bschclassmanage.enums.SchType;
import com.yunhai.bschclassmanage.model.vo.SchSystemTreeVO;
import com.yunhai.bschclassmanage.model.vo.SelectIntVO;
import com.yunhai.bschclassmanage.service.*;
import com.yunhai.bschclassmanage.utils.RedisConstants;
import com.yunhai.bschclassmanage.utils.RedisUtil;
import com.yunhai.platform.openapi.client.YschBaseOpenApi;
import com.yunhai.platform.utils.exception.DException;
import com.yunhai.platform.utils.model.BoaGroup;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import java.util.*;
import java.util.stream.Collectors;
@Service
public class UserBaseTreeService {
@Autowired
private RedisUtil redisUtil;
/**
* 清除全部缓存(Redis 组树/学校列表 + 本地内存缓存)
* 调用时机:组树、学校组织信息变更后
*/
public void clearCache() {
redisUtil.del(RedisConstants.SYSTEM_GROUP_TREE);
}
}
@@ -49,7 +49,7 @@ public class RedisConstants {
//---------------------------学校-------------------------------------------------------
//学校树
public static final String SCHOOL_TREE =CachePrefix+ ".sch_tree";
//public static final String SCHOOL_TREE =CachePrefix+ ".sch_tree";
//学校列表
public static final String SCHOOL_LIST =CachePrefix+ ".sch_list";