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
c95878d0
Commit
c95878d0
authored
Oct 09, 2025
by
zhangxingmin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
push
parent
7735a182
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
31 deletions
+41
-31
yd-csf-api/src/main/java/com/yd/csf/api/service/impl/ApiBeneficiaryServiceImpl.java
+34
-31
yd-csf-service/src/main/java/com/yd/csf/service/service/IBeneficiaryService.java
+2
-0
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/BeneficiaryServiceImpl.java
+5
-0
No files found.
yd-csf-api/src/main/java/com/yd/csf/api/service/impl/ApiBeneficiaryServiceImpl.java
View file @
c95878d0
...
...
@@ -183,38 +183,40 @@ public class ApiBeneficiaryServiceImpl implements ApiBeneficiaryService {
return
Result
.
success
();
}
//获取不为空的受益人信息表唯一业务ID列表
List
<
String
>
beneficiaryBizIdList
=
list
.
stream
()
.
filter
(
dto
->
StringUtils
.
isNotBlank
(
dto
.
getBeneficiaryBizId
()))
.
map
(
ApiBeneficiaryInfoDto:
:
getBeneficiaryBizId
)
.
collect
(
Collectors
.
toList
());
if
(!
CollectionUtils
.
isEmpty
(
beneficiaryBizIdList
))
{
//入参的受益人业务id列表至少一个不为空就走表数据校验,全部为空是全部新增操作,不走表数据校验
//根据受益人信息表唯一业务ID列表查询表里面的列表信息
List
<
Beneficiary
>
beneficiarys
=
iBeneficiaryService
.
queryList
(
BeneficiaryDto
.
builder
()
.
beneficiaryBizIdList
(
beneficiaryBizIdList
).
build
());
//过滤入参的受益人列表信息在表里不存在的集合,然后抛出这些不存在的列表信息
// 提取 existingBeneficiaryBizIds:从 beneficiarys 中获取所有已存在的 beneficiaryBizId 集合
Set
<
String
>
existingBeneficiaryBizIds
=
beneficiarys
.
stream
()
.
map
(
Beneficiary:
:
getBeneficiaryBizId
)
.
collect
(
Collectors
.
toSet
());
// 过滤 list:保留 beneficiaryBizId 不在 existingBeneficiaryBizIds 中的对象
List
<
ApiBeneficiaryInfoDto
>
filteredList
=
list
.
stream
()
.
filter
(
dto
->
StringUtils
.
isNotBlank
(
dto
.
getBeneficiaryBizId
())
&&
!
existingBeneficiaryBizIds
.
contains
(
dto
.
getBeneficiaryBizId
()))
.
collect
(
Collectors
.
toList
());
if
(!
CollectionUtils
.
isEmpty
(
filteredList
))
{
//入参对象列表中有传值的业务id在库中不存在的对象,提示
List
<
String
>
beneficiaryProductNameList
=
filteredList
.
stream
()
.
map
(
ApiBeneficiaryInfoDto:
:
getName
)
.
collect
(
Collectors
.
toList
());
throw
new
BusinessException
(
"以下是在库里不存在的受益人数据的名字:"
+
String
.
join
(
" ;"
,
beneficiaryProductNameList
));
}
}
//
//获取不为空的受益人信息表唯一业务ID列表
//
List<String> beneficiaryBizIdList = list.stream()
//
.filter(dto -> StringUtils.isNotBlank(dto.getBeneficiaryBizId()))
//
.map(ApiBeneficiaryInfoDto::getBeneficiaryBizId)
//
.collect(Collectors.toList());
//
//
if (!CollectionUtils.isEmpty(beneficiaryBizIdList)) {
//
//入参的受益人业务id列表至少一个不为空就走表数据校验,全部为空是全部新增操作,不走表数据校验
//
//
//根据受益人信息表唯一业务ID列表查询表里面的列表信息
//
List<Beneficiary> beneficiarys = iBeneficiaryService.queryList(BeneficiaryDto.builder()
//
.beneficiaryBizIdList(beneficiaryBizIdList).build());
//
//
//过滤入参的受益人列表信息在表里不存在的集合,然后抛出这些不存在的列表信息
//
// 提取 existingBeneficiaryBizIds:从 beneficiarys 中获取所有已存在的 beneficiaryBizId 集合
//
Set<String> existingBeneficiaryBizIds = beneficiarys.stream()
//
.map(Beneficiary::getBeneficiaryBizId)
//
.collect(Collectors.toSet());
//
// 过滤 list:保留 beneficiaryBizId 不在 existingBeneficiaryBizIds 中的对象
//
List<ApiBeneficiaryInfoDto> filteredList = list.stream()
//
.filter(dto -> StringUtils.isNotBlank(dto.getBeneficiaryBizId()) && !existingBeneficiaryBizIds.contains(dto.getBeneficiaryBizId()))
//
.collect(Collectors.toList());
//
if (!CollectionUtils.isEmpty(filteredList)) {
//
//入参对象列表中有传值的业务id在库中不存在的对象,提示
//
List<String> beneficiaryProductNameList = filteredList
//
.stream()
//
.map(ApiBeneficiaryInfoDto::getName)
//
.collect(Collectors.toList());
//
throw new BusinessException("以下是在库里不存在的受益人数据的名字:"+String.join(" ;",beneficiaryProductNameList));
//
}
//
}
//先删后增加
iBeneficiaryService
.
del
(
appointmentBizId
);
//构造需要新增或者更新数据的对象集合
List
<
Beneficiary
>
updateList
=
list
.
stream
().
map
(
dto
->
{
...
...
@@ -228,6 +230,7 @@ public class ApiBeneficiaryServiceImpl implements ApiBeneficiaryService {
}
//地址列表(json串)
beneficiary
.
setAddressList
(
CommonUtil
.
getAddressListJsonStr
(
dto
.
getAddressList
()));
beneficiary
.
setId
(
null
);
return
beneficiary
;
}).
collect
(
Collectors
.
toList
());
...
...
yd-csf-service/src/main/java/com/yd/csf/service/service/IBeneficiaryService.java
View file @
c95878d0
...
...
@@ -19,4 +19,6 @@ public interface IBeneficiaryService extends IService<Beneficiary> {
List
<
Beneficiary
>
queryList
(
BeneficiaryDto
dto
);
Beneficiary
queryOne
(
String
beneficiaryBizId
);
Boolean
del
(
String
appointmentBizId
);
}
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/BeneficiaryServiceImpl.java
View file @
c95878d0
...
...
@@ -48,4 +48,9 @@ public class BeneficiaryServiceImpl extends ServiceImpl<BeneficiaryMapper, Benef
public
Beneficiary
queryOne
(
String
beneficiaryBizId
)
{
return
this
.
getOne
(
new
LambdaQueryWrapper
<
Beneficiary
>().
eq
(
Beneficiary:
:
getBeneficiaryBizId
,
beneficiaryBizId
));
}
@Override
public
Boolean
del
(
String
appointmentBizId
)
{
return
this
.
remove
(
new
LambdaQueryWrapper
<
Beneficiary
>().
eq
(
Beneficiary:
:
getAppointmentBizId
,
appointmentBizId
));
}
}
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