forked from gzzfw/backEnd/gz-dyh

fix:流转办理已经修改不生效问题,纠纷态势区域权限限制,纠纷态势纠纷类型二级接口
1 files added
9 files modified
367 ■■■■■ changed files
dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/controller/web/CaseInfoWebController.java 30 ●●●● patch | view | raw | blame | history
dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/dao/mapper/CaseInfoMapper.java 2 ●●●●● patch | view | raw | blame | history
dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/dao/mapper/xml/CaseInfoMapper.xml 31 ●●●● patch | view | raw | blame | history
dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/service/CaseFeedbackService.java 2 ●●● patch | view | raw | blame | history
dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/service/CaseInfoService.java 59 ●●●●● patch | view | raw | blame | history
dyh-service/dyh-sys/src/main/java/cn/huge/module/client/api/CustClient.java 9 ●●●●● patch | view | raw | blame | history
dyh-service/dyh-sys/src/main/java/cn/huge/module/client/api/impl/CustClientImpl.java 22 ●●●●● patch | view | raw | blame | history
dyh-service/dyh-sys/src/main/java/cn/huge/module/kind/controller/web/SyRegionWebController.java 18 ●●●●● patch | view | raw | blame | history
dyh-service/dyh-sys/src/main/java/cn/huge/module/kind/domain/bo/AreaBO.java 19 ●●●●● patch | view | raw | blame | history
dyh-service/dyh-sys/src/main/java/cn/huge/module/kind/service/SyRegionService.java 175 ●●●●● patch | view | raw | blame | history
dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/controller/web/CaseInfoWebController.java
@@ -81,10 +81,11 @@
            terms.put("createStart", fileStart+ " 00:00:00");
            terms.put("createEnd", fileEnd+ " 23:59:59");
        }
        String areaType = request.getParameter("areaType");
        if (StringUtils.isNotBlank(areaType)){
            terms.put("areaType", areaType);
        String queRoad = request.getParameter("queRoad");
        if (StringUtils.isNotBlank(queRoad)){
            terms.put("areaType", "2");
        }
        // 实际调解组织编号
        String mediateUnitId = request.getParameter("mediateUnitId");
        if (StringUtils.isNotBlank(mediateUnitId)){
@@ -724,16 +725,33 @@
    }
    /**
     * 综合查询
     * 解纷态势
     * @url {ctx}/api/web/caseInfo/statistics
     * @return Object
     * @CurrentUser String userId
     */
    @GetMapping("/statistics")
    public Object statistics() {
    public Object statistics(@CurrentUser String userId) {
        try {
            Map<String, Object> terms = getParameterAll();
            return ReturnSucUtils.getRepInfo( "处理成功", service.statistics(terms));
            return ReturnSucUtils.getRepInfo( "处理成功", service.statistics(terms,userId));
        } catch (Exception e) {
            log.error("Controller接口[CaseInfoWebController.statistics]请求异常:"+e, e);
            return ReturnFailUtils.getRepInfo();
        }
    }
    /**
     * 解纷态势-纠纷类型
     * @url {ctx}/api/web/caseInfo/statisticsCaseType
     * @return Object
     * @CurrentUser String userId
     */
    @GetMapping("/statisticsCaseType")
    public Object statisticsCaseType(@CurrentUser String userId) {
        try {
            Map<String, Object> terms = getParameterAll();
            return ReturnSucUtils.getRepInfo( "处理成功", service.statisticsCaseType(terms,userId));
        } catch (Exception e) {
            log.error("Controller接口[CaseInfoWebController.statistics]请求异常:"+e, e);
            return ReturnFailUtils.getRepInfo();
dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/dao/mapper/CaseInfoMapper.java
@@ -91,6 +91,8 @@
    CaseStatisticsBaseDTO statisticsBase(@Param("terms") Map<String, Object> terms);
    List<CaseStatisticsTypeDTO> statisticsTypeFirst(@Param("terms") Map<String, Object> terms);
    List<CaseStatisticsTypeDTO> statisticsType(@Param("terms") Map<String, Object> terms);
    CaseStatisticsSourceDTO statisticsSource(@Param("terms") Map<String, Object> terms);
dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/dao/mapper/xml/CaseInfoMapper.xml
@@ -324,6 +324,15 @@
                <if test="terms.caseType != null and terms.caseType !=''">
                    and a.case_type = #{terms.caseType}
                </if>
                <if test="terms.caseTypeFirst != null and terms.caseTypeFirst !=''">
                    and a.case_type_first = #{terms.caseTypeFirst}
                </if>
                <if test="terms.caseTypeFirstList != null and terms.caseTypeFirstList.size > 0">
                    and a.case_type_first in
                    <foreach collection="terms.caseTypeFirstList" item="caseTypeFirst" index="index" open="(" separator="," close=")">
                        #{caseTypeFirst}
                    </foreach>
                </if>
                <if test="terms.caseTypeName != null and terms.caseTypeName !=''">
                    and a.case_type_name = #{terms.caseTypeName}
                </if>
@@ -349,17 +358,17 @@
                    and (DATE_FORMAT(b.file_time,'%Y-%m-%d %H:%i:%s') <![CDATA[ >= ]]> #{terms.fileStart}
                    and DATE_FORMAT(b.file_time,'%Y-%m-%d %H:%i:%s') <![CDATA[ <= ]]> #{terms.fileEnd})
                </if>
                <if test="terms.queProv != null and terms.queProv !=''">
                    and a.que_prov = #{terms.queProv}
                </if>
                <if test="terms.queCity != null and terms.queCity !=''">
                    and a.que_city = #{terms.queCity}
                    and ((b.mediate_unit_id is not null and b.mediate_unit_id in (select id from "gzdyh_dev"."dyh_ct_unit" where que_city = #{terms.queCity}))
                    or (b.mediate_unit_id is null and a.que_city = #{terms.queCity}))
                </if>
                <if test="terms.queArea != null and terms.queArea !=''">
                    and a.que_area = #{terms.queArea}
                    and ((b.mediate_unit_id is not null and b.mediate_unit_id in (select id from "gzdyh_dev"."dyh_ct_unit" where que_area = #{terms.queArea}))
                    or (b.mediate_unit_id is null and a.que_area = #{terms.queArea}))
                </if>
                <if test="terms.queRoad != null and terms.queRoad !=''">
                    and a.que_road = #{terms.queRoad}
                    and ((b.mediate_unit_id is not null and b.mediate_unit_id in (select id from "gzdyh_dev"."dyh_ct_unit" where que_road = #{terms.queRoad}))
                    or (b.mediate_unit_id is null and a.que_road = #{terms.queRoad}))
                </if>
                <if test="terms.isArea != null and terms.isArea !=''">
                    and a.que_city is not null and a.que_area is not null and a.que_road is not null
@@ -881,6 +890,16 @@
        <include refid="where-part-all"/>
    </select>
    <!--  统计分析(类型)  -->
    <select id="statisticsTypeFirst" resultType="cn.huge.module.cases.domain.dto.CaseStatisticsTypeDTO">
        SELECT
        a.case_type_first as caseType,a.case_type_first_name as caseTypeName,count(1) as caseNum
        FROM
        dyh_case_info a LEFT JOIN dyh_case_info_unfold b on a.id = b.id
        <include refid="where-part-all"/>
        group by a.case_type_first
    </select>
    <!--  统计分析(类型)  -->
    <select id="statisticsType" resultType="cn.huge.module.cases.domain.dto.CaseStatisticsTypeDTO">
        SELECT
        a.case_type as caseType,a.case_type_name as caseTypeName,count(1) as caseNum
dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/service/CaseFeedbackService.java
@@ -282,7 +282,7 @@
            caseFeedback.setHandleUnitName(loginUser.getUnitName());
            caseFeedback.setHandleUserId(loginUser.getId());
            caseFeedback.setHandleUserName(loginUser.getTrueName());
            caseFeedback.setId(utilsClient.getNewTimeId());
//            caseFeedback.setId(utilsClient.getNewTimeId());
            caseFeedback.setHandleType(caseFeedback1.getHandleType());
            caseFeedback.setUpdateTime(nowDate);
            mapper.updateById(caseFeedback);
dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/service/CaseInfoService.java
@@ -14,6 +14,7 @@
import cn.huge.module.client.api.impl.UtilsClientImpl;
import cn.huge.module.cases.dao.mapper.CaseInfoMapper;
import cn.huge.module.constant.BaseConsts;
import cn.huge.module.cust.dto.CtUnitDTO;
import cn.huge.module.cust.dto.PaUserDTO;
import cn.huge.module.mediate.constant.*;
import cn.huge.module.cust.dto.CtUserDTO;
@@ -990,11 +991,21 @@
        return new PageImpl<CasePageDTO>(content, page, total);
    }
    public CaseStatisticsBaseDTO statistics(Map<String, Object> terms) throws IOException {
    /**
     * 纠纷态势
     * 筛选范围:如果已经有承办部门,就按承办部门的区域筛选。如果没有承办部门按问题归属区域筛选
     * */
    public CaseStatisticsBaseDTO statistics(Map<String, Object> terms,String userId) throws IOException {
        Object canal = null;
        if(ObjectUtils.isNotEmpty(terms.get("canal"))){
            canal = terms.get("canal");
        }
        //根据用户筛选区域范围
        CtUnitDTO ctUnitDTO = custClient.getUnitByUserId(userId);
        if(ctUnitDTO.getUnitGrade().equals(2)){
            terms.put("queArea", ctUnitDTO.getArea());
        }else if(ctUnitDTO.getUnitGrade().equals(3) || ctUnitDTO.getUnitGrade().equals(4)){
            terms.put("queRoad", ctUnitDTO.getRoad());
        }
        //基础数据统计
        CaseStatisticsBaseDTO caseStatisticsBaseDTO = mapper.statisticsBase(terms);
@@ -1045,7 +1056,7 @@
        caseStatisticsBaseDTO.setAreaList(caseStatisticsAreaDTOS);
        terms.remove("isArea");
        //纠纷类型统计
        List<CaseStatisticsTypeDTO> caseStatisticsTypeDTOS = mapper.statisticsType(terms);
        List<CaseStatisticsTypeDTO> caseStatisticsTypeDTOS = mapper.statisticsTypeFirst(terms);
        if (ObjectUtils.isNotEmpty(caseStatisticsTypeDTOS)) {
            sortType(caseStatisticsTypeDTOS);
        }
@@ -1124,7 +1135,7 @@
            terms.put("canal", canal);
        }
        Sort sort = Sort.by(Sort.Direction.DESC, "a.create_time");
        PageRequest pageRequest = PageRequest.of(0, 5, sort);
        PageRequest pageRequest = PageRequest.of(0, 30, sort);
        Page<CasePageDTO> casePageDTOS = pageQueryAll(pageRequest, terms);
        if (ObjectUtils.isNotEmpty(casePageDTOS.getContent())) {
            caseStatisticsBaseDTO.setCaseList(casePageDTOS.getContent());
@@ -1298,4 +1309,44 @@
        return casePersonCountBO;
    }
    public List<CaseStatisticsTypeDTO> statisticsCaseType(Map<String, Object> terms,String userId){
        //根据用户筛选区域范围
        CtUnitDTO ctUnitDTO = custClient.getUnitByUserId(userId);
        if(ctUnitDTO.getUnitGrade().equals(2)){
            terms.put("queArea", ctUnitDTO.getArea());
        }else if(ctUnitDTO.getUnitGrade().equals(3) || ctUnitDTO.getUnitGrade().equals(4)){
            terms.put("queRoad", ctUnitDTO.getRoad());
        }
        if(ObjectUtils.isEmpty(terms.get("caseTypeFirst"))){
            //筛选一级为其他的纠纷类型
            List<CaseStatisticsTypeDTO> caseStatisticsTypeDTOS = mapper.statisticsTypeFirst(terms);
            if (ObjectUtils.isNotEmpty(caseStatisticsTypeDTOS)) {
                sortType(caseStatisticsTypeDTOS);
            }
            int i = 1;
            List<String> caseTypeList = new ArrayList<>();
            for (CaseStatisticsTypeDTO caseStatisticsTypeDTO : caseStatisticsTypeDTOS) {
                if (i > 5) {
                    caseTypeList.add(caseStatisticsTypeDTO.getCaseType());
                }
                i++;
            }
            if(ObjectUtils.isEmpty(caseTypeList)){
                return new ArrayList<>();
            }
            terms.put("caseTypeFirstList", caseTypeList);
        }
        List<CaseStatisticsTypeDTO> caseStatisticsTypeDTOS = mapper.statisticsType(terms);
        if (ObjectUtils.isNotEmpty(caseStatisticsTypeDTOS)) {
            sortType(caseStatisticsTypeDTOS);
        }
        Integer typeTotalNum = 0;
        for (CaseStatisticsTypeDTO caseStatisticsTypeDTO : caseStatisticsTypeDTOS) {
            typeTotalNum = typeTotalNum + dellNull(caseStatisticsTypeDTO.getCaseNum());
        }
        for (CaseStatisticsTypeDTO caseStatisticsTypeDTO : caseStatisticsTypeDTOS) {
            caseStatisticsTypeDTO.setCaseRate(BigDecimalUtil.integerDivideDelZero(caseStatisticsTypeDTO.getCaseNum() * 100, typeTotalNum, 1));
        }
        return caseStatisticsTypeDTOS;
    }
}
dyh-service/dyh-sys/src/main/java/cn/huge/module/client/api/CustClient.java
@@ -42,4 +42,13 @@
     */
    @GetMapping("/api/client/paUser/clientGetUserAll")
    ReturnBO paClientGetUserAll(@RequestParam("userId") String userId);
    /**
     * 查询用户所在的单位信息
     * @url {ctx}/api/client/ctUnit/getUnitByUserId?userId=
     * @param userId 登录用户编号
     * @return ReturnBO
     */
    @GetMapping("/api/client/ctUnit/getUnitByUserId")
    ReturnBO getUnitByUserId(@RequestParam("userId") String userId);
}
dyh-service/dyh-sys/src/main/java/cn/huge/module/client/api/impl/CustClientImpl.java
@@ -6,6 +6,7 @@
import cn.huge.base.common.exception.ClientException;
import cn.huge.base.common.exception.ServiceException;
import cn.huge.module.client.api.CustClient;
import cn.huge.module.cust.dto.CtUnitDTO;
import cn.huge.module.cust.dto.CtUserDTO;
import cn.huge.module.cust.dto.PaUserDTO;
import com.alibaba.fastjson.JSON;
@@ -105,4 +106,25 @@
            throw new ServiceException("CustClientImpl.paClientGetUserAll", e);
        }
    }
    /**
     * 当事人-获取登录用户
     * @param userId 用户编号
     * @return
     */
    public CtUnitDTO getUnitByUserId(String userId){
        try{
            ReturnBO returnBo = custClient.getUnitByUserId(userId);
            if (ReturnConsts.OK == returnBo.getCode()){
                CtUnitDTO loginUser = objectMapper.convertValue(returnBo.getData(), CtUnitDTO.class);
                return loginUser;
            }else{
                log.error("Client外服务接口[CustClientImpl.getUnitByUserId]请求异常:" + returnBo.getMsg(), returnBo.getMsg());
                throw new ClientException("CustClientImpl.getUnitByUserId", returnBo.getMsg());
            }
        }catch (Exception e){
            log.error("service方法[CustClientImpl.getUnitByUserId]调用异常:"+e, e);
            throw new ServiceException("CustClientImpl.getUnitByUserId", e);
        }
    }
}
dyh-service/dyh-sys/src/main/java/cn/huge/module/kind/controller/web/SyRegionWebController.java
@@ -3,6 +3,7 @@
import cn.huge.base.common.utils.ObjectUtils;
import cn.huge.base.common.utils.ReturnFailUtils;
import cn.huge.base.common.utils.ReturnSucUtils;
import cn.huge.base.config.CurrentUser;
import cn.huge.module.kind.domain.dto.RegionSelectJSDTO;
import cn.huge.module.kind.domain.dto.RegionSelectSaveDTO;
import cn.huge.module.kind.domain.po.SyRegion;
@@ -225,4 +226,21 @@
        }
    }
    /**
     * 根据用户ID获取对应权限区域树
     * @url {ctx}/api/web/syRegion/treeByUserId
     * @return
     *
     */
    @GetMapping("/treeByUserId")
    public Object treeByUserId(@CurrentUser String userId) {
        try {
//            String userId = "2105120906491001";
            return ReturnSucUtils.getRepInfo(service.treeByUserId(userId));
        } catch (Exception e) {
            log.error("Controller接口[SyRegionWebController.treeByUserId]请求异常:"+e, e);
            return ReturnFailUtils.getRepInfo();
        }
    }
}
dyh-service/dyh-sys/src/main/java/cn/huge/module/kind/domain/bo/AreaBO.java
New file
@@ -0,0 +1,19 @@
package cn.huge.module.kind.domain.bo;
import lombok.Data;
import java.util.List;
/**
 * @author zhouxiantao
 * @create 2024-10-16 11:03
 */
@Data
public class AreaBO {
    private String label;// 名称
    private String value;// 编码
    private String level;//1-市,2-区,3-街道,4-村居
    private String parentId;//父类编码
    private String sort;//排序
    private List<AreaBO> children;//子类集合
}
dyh-service/dyh-sys/src/main/java/cn/huge/module/kind/service/SyRegionService.java
@@ -4,17 +4,23 @@
import cn.huge.base.common.utils.DateUtils;
import cn.huge.base.common.utils.IdUtils;
import cn.huge.base.common.utils.ObjectUtils;
import cn.huge.module.client.api.impl.CustClientImpl;
import cn.huge.module.client.api.impl.UtilsClientImpl;
import cn.huge.module.constant.BaseConsts;
import cn.huge.module.cust.dto.CtUnitDTO;
import cn.huge.module.kind.dao.mapper.SyRegionMapper;
import cn.huge.module.kind.domain.bo.AreaBO;
import cn.huge.module.kind.domain.dto.RegionSelectJSDTO;
import cn.huge.module.kind.domain.po.SyRegion;
import cn.huge.module.sys.dto.QueAddrBaseDTO;
import cn.huge.module.sys.dto.QueAreaDTO;
import cn.huge.module.utils.BaiduMapAddrDTO;
import cn.huge.module.utils.BaiduMapUtils;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import lombok.extern.slf4j.Slf4j;
@@ -26,10 +32,7 @@
import javax.annotation.PostConstruct;
import javax.swing.plaf.synth.Region;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
 * @title: 地域字典表业务逻辑处理
@@ -49,6 +52,9 @@
    @Autowired
    private UtilsClientImpl utilsClient;
    @Autowired
    private CustClientImpl custClient;
    /**
    * 更新对象
@@ -228,4 +234,165 @@
        return list;
    }
    public List<AreaBO> treeByUserId(String userId){
        CtUnitDTO ctUnitDTO = custClient.getUnitByUserId(userId);
        Integer unitGrade = ctUnitDTO.getUnitGrade();
        Set<AreaBO> areaSet = new HashSet<>();
        if(unitGrade.equals(1)){
            QueryWrapper<SyRegion> queryWrapper = new QueryWrapper();
            queryWrapper.gt("level", 0);
            List<SyRegion> syRegions = mapper.selectList(queryWrapper);
            for (SyRegion syRegion : syRegions) {
                AreaBO areaBO = new AreaBO();
                areaBO.setParentId(syRegion.getParentId());
                if(syRegion.getLevel().equals(1)){
                    areaBO.setParentId("root");
                }
                areaBO.setLevel(String.valueOf(syRegion.getLevel()));
                areaBO.setLabel(syRegion.getName());
                areaBO.setValue(syRegion.getId());
                areaBO.setSort(syRegion.getId());
                areaSet.add(areaBO);
            }
        }else if(unitGrade.equals(2)){
            SyRegion areaSyRegion = mapper.selectById(ctUnitDTO.getArea());
            if(ObjectUtils.isNotEmpty(areaSyRegion)){
                AreaBO areaBO = new AreaBO();
                areaBO.setParentId("root");
                areaBO.setLabel(areaSyRegion.getName());
                areaBO.setValue(areaSyRegion.getId());
                areaBO.setLevel(String.valueOf(areaSyRegion.getLevel()));
                areaBO.setSort(areaSyRegion.getId());
                areaSet.add(areaBO);
                QueryWrapper<SyRegion> queryWrapper = new QueryWrapper();
                queryWrapper.eq("parent_id", areaSyRegion.getId());
                List<SyRegion> syRegions = mapper.selectList(queryWrapper);
                for (SyRegion syRegion : syRegions) {
                    AreaBO roadaBO = new AreaBO();
                    roadaBO.setParentId(syRegion.getParentId());
                    roadaBO.setLabel(syRegion.getName());
                    roadaBO.setValue(syRegion.getId());
                    roadaBO.setLevel(String.valueOf(syRegion.getLevel()));
                    roadaBO.setSort(syRegion.getId());
                    areaSet.add(roadaBO);
                }
            }
        }else {
            SyRegion roadSyRegion = mapper.selectById(ctUnitDTO.getRoad());
            AreaBO roadaBO = new AreaBO();
            roadaBO.setParentId("root");
            roadaBO.setLabel(roadSyRegion.getName());
            roadaBO.setValue(roadSyRegion.getId());
            roadaBO.setLevel(String.valueOf(roadSyRegion.getLevel()));
            roadaBO.setSort(roadSyRegion.getId());
            areaSet.add(roadaBO);
        }
        if(ObjectUtils.isEmpty(areaSet)){
            return new ArrayList<>();
        }
        List<AreaBO> areaBOList = sort(areaSet);
        List<AreaBO> areaBOS = sortArea(areaBOList);
        return createTree(areaBOS, null);
    }
    public List<AreaBO> sortArea(List<AreaBO> list) {
        Map<String, String> map = new HashMap<>();
        map.put("越秀区","2");
        map.put("海珠区","3");
        map.put("荔湾区","4");
        map.put("天河区","5");
        map.put("白云区","6");
        map.put("黄埔区","7");
        map.put("花都区","8");
        map.put("番禺区","9");
        map.put("南沙区","10");
        map.put("从化区","11");
        map.put("增城区","12");
        for (AreaBO areaBO : list) {
            if(map.containsKey(areaBO.getLabel())){
                areaBO.setSort(map.get(areaBO.getLabel()));
            }
        }
        list.sort((o1, o2) -> {
            Integer totalScore1 = Integer.valueOf(o1.getSort());
            Integer totalScore2 = Integer.valueOf(o2.getSort());
            if (totalScore1 > totalScore2) {
                return 1;
            } else if (totalScore1.equals(totalScore2)) {
                return 0;
            } else {
                return -1;
            }
        });
        return list;
    }
    public List<AreaBO> sort(Set<AreaBO> termsSet){
        List<AreaBO> termsList = new ArrayList<>();
        if(ObjectUtils.isNotEmpty(termsSet)){
            for (AreaBO selectTermDTO : termsSet) {
                termsList.add(selectTermDTO);
            }
            termsList.sort((o1, o2)->{
                Double totalScore1 = Double.valueOf(o1.getValue());
                Double totalScore2 = Double.valueOf(o2.getValue());
                if(totalScore1 > totalScore2) {
                    return 1;
                }else if (totalScore1.equals(totalScore2)) {
                    return 0;
                }else {
                    return -1;
                }
            });
        }
        return termsList;
    }
    /**
     * 创建树形结构
     *
     * @param selectTermDTOList 所有集合
     * @param firstId    某一级编号
     * @return List
     */
    public List<AreaBO> createTree(List<AreaBO> selectTermDTOList, String firstId) {
        List<AreaBO> firstMapList = new ArrayList<>();
        for (AreaBO selectTermDTO : selectTermDTOList) {
            for (AreaBO currentParam : selectTermDTOList) {
                if (currentParam.getValue().equals(selectTermDTO.getParentId())) {
                    addToMBean(currentParam, selectTermDTO);
                    break;
                }
            }
        }
        //取第一级节点
        for (AreaBO selectTermDTO : selectTermDTOList) {
            if (StringUtils.isNotEmpty(firstId)) {
                if (firstId.equals(selectTermDTO.getValue())) {
                    firstMapList.add(selectTermDTO);
                }
            } else {
                if (BaseConsts.ROOT.equals(selectTermDTO.getParentId()) || StringUtils.isEmpty(selectTermDTO.getParentId())) {
                    firstMapList.add(selectTermDTO);
                }
            }
        }
        return firstMapList;
    }
    public void addToMBean(AreaBO targetUnit, AreaBO currentUnit) {
        List<AreaBO> childListObj = targetUnit.getChildren();
        List<AreaBO> childList = null;
        if (CollectionUtils.isEmpty(childListObj)) {
            childList = new ArrayList();
            targetUnit.setChildren(childList);
        } else {
            childList = childListObj;
        }
        childList.add(currentUnit);
    }
}