|
|
@@ -180,9 +180,16 @@ public class HuaNongCrawlerQuoteProcessServiceImpl implements HuaNongCrawlerQuot
|
|
|
|
|
|
//代理人
|
|
|
List<HuaNongCrawlerUserTypeAndProxyInfoQueryResponse.AgentInfoListDTO> agentInfoList = userTypeAndProxyInfoQueryResponse.getAgentInfoList();
|
|
|
- Map<String, HuaNongCrawlerUserTypeAndProxyInfoQueryResponse.AgentInfoListDTO> agentInfoListDTOMap = agentInfoList.stream()
|
|
|
- .collect(Collectors.toMap(HuaNongCrawlerUserTypeAndProxyInfoQueryResponse.AgentInfoListDTO::getAgentCode, x -> x));
|
|
|
-
|
|
|
+ Map<String, HuaNongCrawlerUserTypeAndProxyInfoQueryResponse.AgentInfoListDTO> agentInfoListDTOMap
|
|
|
+ = Optional.ofNullable(agentInfoList)
|
|
|
+ .orElse(Collections.emptyList())
|
|
|
+ .stream()
|
|
|
+ // 关键:过滤agentCode为空的记录
|
|
|
+ .filter(dto -> dto.getAgentCode() != null)
|
|
|
+ .collect(Collectors.toMap(
|
|
|
+ HuaNongCrawlerUserTypeAndProxyInfoQueryResponse.AgentInfoListDTO::getAgentCode,
|
|
|
+ x -> x
|
|
|
+ ));
|
|
|
// 协议号
|
|
|
List<HuaNongCrawlerUserTypeAndProxyInfoQueryResponse.AgreementListDTO> agreementList = userTypeAndProxyInfoQueryResponse.getAgreementList();
|
|
|
/*Map<String, String> map = agreementList.stream()
|
|
|
@@ -200,8 +207,12 @@ public class HuaNongCrawlerQuoteProcessServiceImpl implements HuaNongCrawlerQuot
|
|
|
// 业务员
|
|
|
List<HuaNongCrawlerUserTypeAndProxyInfoQueryResponse.HandlerListDTO> handlerList = userTypeAndProxyInfoQueryResponse.getHandlerList();
|
|
|
Map<String, HuaNongCrawlerUserTypeAndProxyInfoQueryResponse.HandlerListDTO> handler = handlerList.stream()
|
|
|
- .collect(Collectors.toMap(HuaNongCrawlerUserTypeAndProxyInfoQueryResponse.HandlerListDTO::getHandlerCode, x -> x));
|
|
|
-
|
|
|
+ .collect(Collectors.toMap(
|
|
|
+ HuaNongCrawlerUserTypeAndProxyInfoQueryResponse.HandlerListDTO::getHandlerCode,
|
|
|
+ x -> x,
|
|
|
+ // 冲突策略:key重复时,保留旧数据;如需保留最新数据改成 (oldVal, newVal) -> newVal
|
|
|
+ (oldVal, newVal) -> oldVal
|
|
|
+ ));
|
|
|
// 管理渠道
|
|
|
HuaNongCrawlerBaseCodeRequestRequest baseCodeRequest = new HuaNongCrawlerBaseCodeRequestRequest(token, loginComCode, parameters.getComCode(), "CHANNEL_SOURCE");
|
|
|
HuaNongCrawlerBaseCodeResponse.BaseInfoDTO baseInfoDTO = huaNongCrawlerRequestComponent.channelSource(baseCodeRequest, httpHeaders, userTypeAndProxyInfoQueryResponse.getChannelSource());
|
|
|
@@ -214,7 +225,7 @@ public class HuaNongCrawlerQuoteProcessServiceImpl implements HuaNongCrawlerQuot
|
|
|
|
|
|
HuaNongCrawlerComInfoQueryResponse.ComListDTO comListDTO = com.get(parameters.getComCode());
|
|
|
HuaNongCrawlerUserTypeAndProxyInfoQueryResponse.HandlerListDTO handlerListDTO = Optional.ofNullable(handlerList).filter(CollectionUtils::isNotEmpty).map(list -> list.get(0)).orElse(null);
|
|
|
- HuaNongCrawlerUserTypeAndProxyInfoQueryResponse.AgentInfoListDTO agentInfoListDTO = agentInfoListDTOMap.get(map.get(parameters.getAgreementNo()));
|
|
|
+ HuaNongCrawlerUserTypeAndProxyInfoQueryResponse.AgentInfoListDTO agentInfoListDTO = agentInfoListDTOMap.get(map.get(parameters.getAgreementNo())) == null?new HuaNongCrawlerUserTypeAndProxyInfoQueryResponse.AgentInfoListDTO() : agentInfoListDTOMap.get(map.get(parameters.getAgreementNo()));
|
|
|
return new HuaNongCrawlerQuotedPriceRequestRequest.BusinessDataDTO.SaleInfoDTO(comListDTO, handlerListDTO, agentInfoListDTO, producerListDTO, baseInfoDTO, parameters.getCallerName());
|
|
|
}, HuaNongCrawlerQuotedPriceRequestRequest.BusinessDataDTO.SaleInfoDTO.class, Duration.ofHours(HuaNongCrawlerCacheComponent.SALE_INFO_TIME));
|
|
|
}
|