|
@ -67,10 +67,7 @@ import org.springframework.stereotype.Service; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
import java.math.BigDecimal; |
|
|
import java.util.ArrayList; |
|
|
import java.util.*; |
|
|
import java.util.Arrays; |
|
|
|
|
|
import java.util.Date; |
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 机关单位信息 |
|
|
* 机关单位信息 |
|
@ -926,11 +923,15 @@ public class AgencyServiceImpl implements AgencyService { |
|
|
@Override |
|
|
@Override |
|
|
public List<CustomerTreeDTO> getCustomerTree(TokenDto tokenDto) { |
|
|
public List<CustomerTreeDTO> getCustomerTree(TokenDto tokenDto) { |
|
|
List<CustomerTreeDTO> rootList = customerAgencyDao.selectRootCustomer(); |
|
|
List<CustomerTreeDTO> rootList = customerAgencyDao.selectRootCustomer(); |
|
|
|
|
|
Map<String, CustomerTreeDTO> treeMap = new HashMap<>(); |
|
|
if (!rootList.isEmpty()) { |
|
|
if (!rootList.isEmpty()) { |
|
|
rootList.forEach(this::getSubCustomer); |
|
|
rootList.forEach(item -> { |
|
|
|
|
|
getSubCustomer(item, treeMap); |
|
|
|
|
|
}); |
|
|
} |
|
|
} |
|
|
return rootList; |
|
|
return rootList; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private CustomerAgencyEntity constructInsertEntity(AddAgencyV2FormDTO formDTO, CustomerAgencyDTO parent) { |
|
|
private CustomerAgencyEntity constructInsertEntity(AddAgencyV2FormDTO formDTO, CustomerAgencyDTO parent) { |
|
|
CustomerAgencyEntity insertEntity = ConvertUtils.sourceToTarget(formDTO, CustomerAgencyEntity.class); |
|
|
CustomerAgencyEntity insertEntity = ConvertUtils.sourceToTarget(formDTO, CustomerAgencyEntity.class); |
|
|
insertEntity.setOrganizationName(formDTO.getAgencyName()); |
|
|
insertEntity.setOrganizationName(formDTO.getAgencyName()); |
|
@ -988,22 +989,16 @@ public class AgencyServiceImpl implements AgencyService { |
|
|
* @author zhy |
|
|
* @author zhy |
|
|
* @date 2022/7/6 13:54 |
|
|
* @date 2022/7/6 13:54 |
|
|
*/ |
|
|
*/ |
|
|
private CustomerRelationTreeDTO getSubCustomer(CustomerTreeDTO customer) { |
|
|
private void getSubCustomer(CustomerTreeDTO customer,Map<String, CustomerTreeDTO> treeMap) { |
|
|
AreaCodeDetailFormDTO formDTO = new AreaCodeDetailFormDTO(); |
|
|
|
|
|
formDTO.setAreaCode(customer.getAreaCode()); |
|
|
Result<List<CustomerTreeDTO>> area = epmetCommonServiceOpenFeignClient.areaCodeTree(customer); |
|
|
formDTO.setLevel(customer.getLevel()); |
|
|
|
|
|
Result<AreaCodeResultDTO> area = epmetCommonServiceOpenFeignClient.areaCodeDetail(formDTO); |
|
|
|
|
|
if (area.success()) { |
|
|
if (area.success()) { |
|
|
if (area.getData() != null) { |
|
|
if (area.getData() != null) { |
|
|
customer.setAreaName(area.getData().getAreaName()); |
|
|
area.getData().forEach(item->{ |
|
|
|
|
|
treeMap.put(item.getAreaCode(),item); |
|
|
|
|
|
}); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
List<CustomerTreeDTO> children = baseDao.selectSubCustomerByPid(customer.getCustomerId()); |
|
|
|
|
|
customer.setChildren(children); |
|
|
|
|
|
if (!children.isEmpty()) { |
|
|
|
|
|
children.forEach(this::getSubCustomer); |
|
|
|
|
|
} |
|
|
|
|
|
return customer; |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|