package com.fzzy.sys.manager.group; import com.fzzy.igds.constant.Constant; import com.fzzy.igds.domain.Dept; import com.fzzy.igds.domain.DicArea; import com.fzzy.igds.service.CoreDeptService; import com.fzzy.igds.service.DicAreaService; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; import javax.annotation.Resource; import java.util.ArrayList; import java.util.List; /** * @Description * @Author CZT * @Date 2025/12/11 15:48 */ @Slf4j @Component public class GroupManager { @Resource private DicAreaService dicAreaService; @Resource private CoreDeptService deptService; /** * 获取省及下属市州集合 * * @param areaCode * @return */ public List getArea(String areaCode) { DicArea area = dicAreaService.listDicAreaByCode(areaCode); if (null == area) { return null; } List list = new ArrayList<>(); list.add(area); if (Constant.AREA_TYPE_1.equals(area.getType())) { List children = dicAreaService.listData(area.getCode(), null, null); if (null != children && children.size() > 0) { list.addAll(children); } } return list; } /** * 获取对应省份及下属市州children * * @param areaCode * @return */ public List getAreaAndChild(String areaCode) { List areaList = dicAreaService.listData(null, null, areaCode); if (null == areaList || areaList.isEmpty()) { return null; } List children; for (DicArea dicArea : areaList) { if (Constant.AREA_TYPE_1.equals(dicArea.getType())) { children = dicAreaService.listData(dicArea.getCode(), null, null); if (null != children && children.size() > 0) { dicArea.setChildren(children); } } } return areaList; } /** * 获取组织下所有库区信息 * * @param companyId * @return */ public List getAllDept(String companyId) { return deptService.listDept(null, companyId, null); } }