Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yd-csf
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xingmin
yd-csf
Commits
f9f9cb73
Commit
f9f9cb73
authored
Dec 31, 2025
by
jianan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
前端对接问题修复25
parent
e60a1dbc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
18 deletions
+50
-18
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/PolicyServiceImpl.java
+50
-18
No files found.
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/PolicyServiceImpl.java
View file @
f9f9cb73
...
...
@@ -2,6 +2,8 @@ package com.yd.csf.service.service.impl;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.core.lang.TypeReference
;
import
cn.hutool.json.JSONArray
;
import
cn.hutool.json.JSONObject
;
import
cn.hutool.json.JSONUtil
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
...
...
@@ -189,30 +191,60 @@ public class PolicyServiceImpl extends ServiceImpl<PolicyMapper, Policy>
return
CollUtil
.
newArrayList
();
}
// 使用JSON工具手动转换
String
jsonData
=
JSONUtil
.
toJsonStr
(
result
.
getData
());
IPage
<
ApiRelProjectProductLaunchPageResponse
>
pageData
=
JSONUtil
.
toBean
(
jsonData
,
new
TypeReference
<
IPage
<
ApiRelProjectProductLaunchPageResponse
>>()
{},
false
);
if
(
ObjectUtils
.
isEmpty
(
pageData
.
getRecords
()))
{
// 直接使用Map来处理数据,避免复杂的类型转换
Object
data
=
result
.
getData
();
List
<
Map
<
String
,
Object
>>
policyProductInfoList
=
new
ArrayList
<>();
try
{
// 将数据转换为JSONObject进行解析
JSONObject
jsonObject
=
JSONUtil
.
parseObj
(
data
);
// 获取records数组
JSONArray
recordsArray
=
jsonObject
.
getJSONArray
(
"records"
);
if
(
recordsArray
!=
null
)
{
for
(
int
i
=
0
;
i
<
recordsArray
.
size
();
i
++)
{
JSONObject
record
=
recordsArray
.
getJSONObject
(
i
);
Map
<
String
,
Object
>
infoMap
=
new
HashMap
<>();
infoMap
.
put
(
"productLaunchBizId"
,
record
.
getStr
(
"productLaunchBizId"
));
infoMap
.
put
(
"productName"
,
record
.
getStr
(
"productName"
));
// 解析自定义属性
JSONArray
attributeSettingArray
=
record
.
getJSONArray
(
"apiAttributeSettingDtoList"
);
if
(
attributeSettingArray
!=
null
)
{
getInfoFromJsonArray
(
attributeSettingArray
,
infoMap
);
}
policyProductInfoList
.
add
(
infoMap
);
}
}
}
catch
(
Exception
e
)
{
log
.
error
(
"解析Feign返回数据失败: {}"
,
e
.
getMessage
(),
e
);
return
CollUtil
.
newArrayList
();
}
List
<
ApiRelProjectProductLaunchPageResponse
>
productLaunchPageResponseList
=
pageData
.
getRecords
();
List
<
Map
<
String
,
Object
>>
policyProductInfoList
=
CollUtil
.
newArrayList
();
for
(
ApiRelProjectProductLaunchPageResponse
response
:
productLaunchPageResponseList
)
{
log
.
info
(
"ApiRelProjectProductLaunchPageResponse:{}"
,
JSONUtil
.
toJsonStr
(
response
));
List
<
ApiAttributeSettingDto
>
apiAttributeSettingDtoList
=
response
.
getApiAttributeSettingDtoList
();
Map
<
String
,
Object
>
infoMap
=
new
HashMap
<>();
infoMap
.
put
(
"productLaunchBizId"
,
response
.
getProductLaunchBizId
());
infoMap
.
put
(
"productName"
,
response
.
getProductName
());
// 解析自定义属性
getInfo
(
apiAttributeSettingDtoList
,
infoMap
);
policyProductInfoList
.
add
(
infoMap
);
}
return
policyProductInfoList
;
}
/**
* 从JSON数组中解析自定义属性
*/
private
void
getInfoFromJsonArray
(
JSONArray
attributeSettingArray
,
Map
<
String
,
Object
>
infoMap
)
{
if
(
attributeSettingArray
==
null
||
attributeSettingArray
.
isEmpty
())
{
return
;
}
for
(
int
i
=
0
;
i
<
attributeSettingArray
.
size
();
i
++)
{
JSONObject
attribute
=
attributeSettingArray
.
getJSONObject
(
i
);
// 根据实际字段名设置属性
// infoMap.put("insuranceCompanyBizId", attribute.getStr("fieldName"));
// infoMap.put("insuranceCompany", attribute.getStr("fieldName"));
// infoMap.put("reconciliationCompanyBizId", attribute.getStr("fieldName"));
// infoMap.put("reconciliationCompany", attribute.getStr("fieldName"));
}
}
/**
* 从附加险列表中获取保险公司业务ID
*
* @param apiAttributeSettingDtoList
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment