java110
2022-08-03 56209c7e652e25951623ab0041baa710cc29490e
service-user/src/main/java/com/java110/user/cmd/user/QueryStaffInfosCmd.java
@@ -107,27 +107,43 @@
                if(!apiStaffDataVo.getUserId().equals(tmpOrgStaffRelDto.getStaffId())){
                    continue;
                }
                tmpOrgStaffRelDto.setParentOrgId(tmpOrgStaffRelDto.getOrgId());
                findParents(tmpOrgStaffRelDto, orgDtos, null);
                apiStaffDataVo.setOrgName(tmpOrgStaffRelDto.getOrgName());
               apiStaffDataVo.setOrgId(tmpOrgStaffRelDto.getOrgId());
            }
        }
        for(ApiStaffDataVo apiStaffDataVo : staffs) {
            if(StringUtil.isEmpty(apiStaffDataVo.getOrgId())){
                continue;
            }
            apiStaffDataVo.setParentOrgId(apiStaffDataVo.getOrgId());
            findParents(apiStaffDataVo, orgDtos, null,0);
        }
    }
    private void findParents(OrgStaffRelDto orgStaffRelDto, List<OrgDto> orgDtos, OrgDto curOrgDto) {
    private void findParents(ApiStaffDataVo apiStaffDataVo, List<OrgDto> orgDtos, OrgDto curOrgDto,int orgDeep) {
        for (OrgDto orgDto : orgDtos) {
            if (!orgStaffRelDto.getParentOrgId().equals(orgDto.getOrgId())) { // 他自己跳过
                continue;
            }
            orgStaffRelDto.setParentOrgId(orgDto.getParentOrgId());
            curOrgDto = orgDto;
            if (StringUtil.isEmpty(orgStaffRelDto.getOrgName())) {
                orgStaffRelDto.setOrgName(orgDto.getOrgName() );
            if (!apiStaffDataVo.getParentOrgId().equals(orgDto.getOrgId())) { // 他自己跳过
                continue;
            }
            orgStaffRelDto.setOrgName(orgDto.getOrgName() + " / " + orgStaffRelDto.getOrgName());
            //如果到一级 就结束
            if(OrgDto.ORG_LEVEL_STORE.equals(apiStaffDataVo.getOrgLevel())){
                continue;
            }
            apiStaffDataVo.setParentOrgId(orgDto.getParentOrgId());
            if (StringUtil.isEmpty(apiStaffDataVo.getOrgName())) {
                apiStaffDataVo.setOrgName(orgDto.getOrgName() );
                continue;
            }
            apiStaffDataVo.setOrgName(orgDto.getOrgName() + " / " + apiStaffDataVo.getOrgName());
            apiStaffDataVo.setOrgLevel(orgDto.getOrgLevel());
        }
        if (curOrgDto != null && OrgDto.ORG_LEVEL_STORE.equals(curOrgDto.getOrgLevel())) {
@@ -142,7 +158,13 @@
            return;
        }
        findParents(orgStaffRelDto, orgDtos, curOrgDto);
        orgDeep +=1;
        if(orgDeep > 20){
            return ;
        }
        findParents(apiStaffDataVo, orgDtos, curOrgDto,orgDeep);
    }
    /**