Commit 44fbfc88 by jianan

新单跟进v2

parent cf75e1ed
......@@ -487,14 +487,21 @@ public class PolicyFollowServiceImpl extends ServiceImpl<PolicyFollowMapper, Pol
// 解析响应获取对账公司编码
if (iPageResult != null && iPageResult.getCode() == 200) {
IPage<ApiInsuranceReconciliationCompanyPageResponse> page = (IPage<ApiInsuranceReconciliationCompanyPageResponse>) iPageResult.getData();
if (page != null && CollectionUtils.isNotEmpty(page.getRecords())) {
try {
// Feign 返回的泛型会被反序列化为 LinkedHashMap,需要手动提取
Object data = iPageResult.getData();
if (data instanceof Map) {
Map<String, Object> dataMap = (Map<String, Object>) data;
Object recordsObj = dataMap.get("records");
if (recordsObj instanceof List) {
List<Map<String, Object>> records = (List<Map<String, Object>>) recordsObj;
// 遍历分页结果,找到匹配的对账公司
String targetBizId = productInfo.getReconciliationCompanyBizId();
for (ApiInsuranceReconciliationCompanyPageResponse response : page.getRecords()) {
if (response != null && targetBizId.equals(response.getReconciliationCompanyBizId())) {
// 尝试从响应中获取对账公司编码
reconciliationCompanyCode = response.getCode();
for (Map<String, Object> record : records) {
String recordBizId = (String) record.get("reconciliationCompanyBizId");
if (targetBizId.equals(recordBizId)) {
// 获取对账公司编码
reconciliationCompanyCode = (String) record.get("code");
log.info("从对账公司服务获取编码: reconciliationCompanyBizId={}, code={}",
targetBizId, reconciliationCompanyCode);
break; // 找到后跳出循环
......@@ -502,6 +509,10 @@ public class PolicyFollowServiceImpl extends ServiceImpl<PolicyFollowMapper, Pol
}
}
}
} catch (Exception e) {
log.error("解析对账公司响应失败: {}", e.getMessage(), e);
}
}
// 如果仍然没有获取到编码,抛异常
if (StringUtils.isBlank(reconciliationCompanyCode)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment