|
|
@ -50,10 +50,7 @@ import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.util.CollectionUtils; |
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.Collections; |
|
|
|
import java.util.List; |
|
|
|
import java.util.*; |
|
|
|
|
|
|
|
/** |
|
|
|
* 组织相关api |
|
|
@ -508,7 +505,7 @@ public class AgencyServiceImpl implements AgencyService { |
|
|
|
//todo 暂不处理 有时间再说
|
|
|
|
}else { |
|
|
|
ScreenCustomerAgencyDTO parentAgencyDTO = null; |
|
|
|
String subAgencyAreaCode = staffAgencyDTO.getParentAreaCode(); |
|
|
|
String parentAreaCode = staffAgencyDTO.getParentAreaCode(); |
|
|
|
List<OrgTreeNode> nodeList = new ArrayList<>(); |
|
|
|
|
|
|
|
/*ScreenCustomerAgencyDTO currentAgency = new ScreenCustomerAgencyDTO(); |
|
|
@ -524,7 +521,7 @@ public class AgencyServiceImpl implements AgencyService { |
|
|
|
convertOrgTreeNode(nodeList, currentAgency);*/ |
|
|
|
//多客户 获取所有直线上级
|
|
|
|
do { |
|
|
|
parentAgencyDTO = screenCustomerAgencyDao.selectByAreaCode(subAgencyAreaCode); |
|
|
|
parentAgencyDTO = screenCustomerAgencyDao.selectByAreaCode(parentAreaCode); |
|
|
|
if (parentAgencyDTO == null){ |
|
|
|
break; |
|
|
|
} |
|
|
@ -532,20 +529,29 @@ public class AgencyServiceImpl implements AgencyService { |
|
|
|
if (parentAgencyDTO.getPid() == null || NumConstant.ZERO_STR.equals(parentAgencyDTO.getPid())){ |
|
|
|
break; |
|
|
|
} |
|
|
|
subAgencyAreaCode = parentAgencyDTO.getAreaCode(); |
|
|
|
parentAreaCode = parentAgencyDTO.getAreaCode(); |
|
|
|
} while (true); |
|
|
|
log.debug("查询所有上级为:{}",JSON.toJSONString(nodeList)); |
|
|
|
//多客户 获取所有下级
|
|
|
|
List<ScreenCustomerAgencyDTO> agencyNodeDTOS = screenCustomerAgencyDao.selectAllSubAgencyList(null,staffAgencyDTO.getAreaCode()); |
|
|
|
//孔村降级处理
|
|
|
|
//孔村降级处理 且移除掉 党总支级别
|
|
|
|
String KONG_CUN_AGENCY_ID = "1234085031077498881"; |
|
|
|
agencyNodeDTOS.forEach(e->{ |
|
|
|
Iterator<ScreenCustomerAgencyDTO> iterator = agencyNodeDTOS.iterator(); |
|
|
|
while (iterator.hasNext()){ |
|
|
|
ScreenCustomerAgencyDTO e = iterator.next(); |
|
|
|
if (e.getPids().contains(KONG_CUN_AGENCY_ID)){ |
|
|
|
e.setLevel(OrgLevelEnum.getSubOrgLevel(e.getLevel())); |
|
|
|
if (OrgLevelEnum.STREET.getCode().equals(e.getLevel())){ |
|
|
|
iterator.remove(); |
|
|
|
} |
|
|
|
if (KONG_CUN_AGENCY_ID.equals(e.getAgencyId())){ |
|
|
|
e.setLevel(OrgLevelEnum.getSubOrgLevel(e.getLevel())); |
|
|
|
} |
|
|
|
} |
|
|
|
convertOrgTreeNode(nodeList, e); |
|
|
|
}); |
|
|
|
} |
|
|
|
nodes = TreeUtils.buildTreeByAreaCode(nodeList); |
|
|
|
} |
|
|
|
log.debug("查询所有上级树结构为:{}",JSON.toJSONString(nodes)); |
|
|
|
//只有一个根节点的树 所以返回一个
|
|
|
|
return nodes.get(0); |
|
|
|
} |
|
|
|