Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jiedao-api-boot-master
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lanbaoming
jiedao-api-boot-master
Commits
454adc55
Commit
454adc55
authored
Dec 18, 2024
by
zhengyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
客户详情主营类别和主营商品回显返回值格式化封装bug修复
parent
b5b46bf2
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
35 deletions
+24
-35
CustomerController.java
...ustomer/controller/admin/customer/CustomerController.java
+24
-35
No files found.
yudao-module-customer/yudao-module-customer-rest/src/main/java/cn/iocoder/yudao/module/customer/controller/admin/customer/CustomerController.java
View file @
454adc55
...
@@ -438,29 +438,23 @@ public class CustomerController {
...
@@ -438,29 +438,23 @@ public class CustomerController {
respVO
.
setPromoterName
(
customer1
.
getName
());
respVO
.
setPromoterName
(
customer1
.
getName
());
}
}
}
}
if
(
CollectionUtil
.
isNotEmpty
(
respVO
.
getProductList
()))
{
// 主营类别是必须的
// 对商品数据进行分组返回
Map
<
Long
,
List
<
ProductRespVO
>>
productRespVOMap
=
respVO
.
getProductList
().
stream
().
collect
(
Collectors
.
groupingBy
(
ProductRespVO:
:
getTypeId
));
List
<
CustomerProductTypeGroupVO
>
products
=
productRespVOMap
.
entrySet
().
stream
().
map
(
entry
->
{
CustomerProductTypeGroupVO
productTypeGroupVO
=
new
CustomerProductTypeGroupVO
();
productTypeGroupVO
.
setTypeId
(
entry
.
getKey
());
productTypeGroupVO
.
setProductIds
(
entry
.
getValue
().
stream
().
map
(
ProductRespVO:
:
getId
).
collect
(
Collectors
.
toList
()));
return
productTypeGroupVO
;
}).
collect
(
Collectors
.
toList
());
if
(
CollectionUtil
.
isNotEmpty
(
respVO
.
getProductTypeList
())){
if
(
CollectionUtil
.
isNotEmpty
(
respVO
.
getProductTypeList
())){
// 允许选择了主营类别,但是该主营类别下面没有对应的商品
// 允许选择了主营类别,但是该主营类别下面没有对应的商品
List
<
CustomerProductTypeGroupVO
>
products
=
new
ArrayList
<>();
for
(
ProductTypeRespVO
typeRespVO
:
respVO
.
getProductTypeList
())
{
for
(
ProductTypeRespVO
typeRespVO
:
respVO
.
getProductTypeList
())
{
if
(!
productRespVOMap
.
containsKey
(
typeRespVO
.
getId
()))
{
CustomerProductTypeGroupVO
productTypeGroupVO
=
new
CustomerProductTypeGroupVO
();
CustomerProductTypeGroupVO
productTypeGroupVO
=
new
CustomerProductTypeGroupVO
();
productTypeGroupVO
.
setTypeId
(
typeRespVO
.
getId
());
productTypeGroupVO
.
setTypeId
(
typeRespVO
.
getId
());
if
(
CollectionUtil
.
isNotEmpty
(
respVO
.
getProductList
()))
{
List
<
Long
>
prodIds
=
respVO
.
getProductList
().
stream
().
filter
(
p
->
p
.
getTypeId
()
==
typeRespVO
.
getId
()).
map
(
ProductRespVO:
:
getId
).
collect
(
Collectors
.
toList
());
productTypeGroupVO
.
setProductIds
(
CollectionUtil
.
isEmpty
(
prodIds
)
?
new
ArrayList
<>()
:
prodIds
);
}
else
{
productTypeGroupVO
.
setProductIds
(
new
ArrayList
<>());
productTypeGroupVO
.
setProductIds
(
new
ArrayList
<>());
products
.
add
(
productTypeGroupVO
);
}
}
}
products
.
add
(
productTypeGroupVO
);
}
}
respVO
.
setProducts
(
products
);
respVO
.
setProducts
(
products
);
}
}
//设置银行账号
//设置银行账号
CustomerBankQueryVO
customerBankQueryVO
=
new
CustomerBankQueryVO
();
CustomerBankQueryVO
customerBankQueryVO
=
new
CustomerBankQueryVO
();
customerBankQueryVO
.
setCustomerId
(
id
);
customerBankQueryVO
.
setCustomerId
(
id
);
...
@@ -501,25 +495,20 @@ public class CustomerController {
...
@@ -501,25 +495,20 @@ public class CustomerController {
if
(
Objects
.
isNull
(
respVO
))
{
if
(
Objects
.
isNull
(
respVO
))
{
throw
exception
(
CUSTOMER_NOT_EXISTS
);
throw
exception
(
CUSTOMER_NOT_EXISTS
);
}
}
if
(
CollectionUtil
.
isNotEmpty
(
respVO
.
getProductList
()))
{
// 主营类别是必须的
// 对商品数据进行分组返回
Map
<
Long
,
List
<
ProductRespVO
>>
productRespVOMap
=
respVO
.
getProductList
().
stream
().
collect
(
Collectors
.
groupingBy
(
ProductRespVO:
:
getTypeId
));
List
<
CustomerProductTypeGroupVO
>
products
=
productRespVOMap
.
entrySet
().
stream
().
map
(
entry
->
{
CustomerProductTypeGroupVO
productTypeGroupVO
=
new
CustomerProductTypeGroupVO
();
productTypeGroupVO
.
setTypeId
(
entry
.
getKey
());
productTypeGroupVO
.
setProductIds
(
entry
.
getValue
().
stream
().
map
(
ProductRespVO:
:
getId
).
collect
(
Collectors
.
toList
()));
return
productTypeGroupVO
;
}).
collect
(
Collectors
.
toList
());
if
(
CollectionUtil
.
isNotEmpty
(
respVO
.
getProductTypeList
())){
if
(
CollectionUtil
.
isNotEmpty
(
respVO
.
getProductTypeList
())){
// 允许选择了主营类别,但是该主营类别下面没有对应的商品
// 允许选择了主营类别,但是该主营类别下面没有对应的商品
List
<
CustomerProductTypeGroupVO
>
products
=
new
ArrayList
<>();
for
(
ProductTypeRespVO
typeRespVO
:
respVO
.
getProductTypeList
())
{
for
(
ProductTypeRespVO
typeRespVO
:
respVO
.
getProductTypeList
())
{
if
(!
productRespVOMap
.
containsKey
(
typeRespVO
.
getId
()))
{
CustomerProductTypeGroupVO
productTypeGroupVO
=
new
CustomerProductTypeGroupVO
();
CustomerProductTypeGroupVO
productTypeGroupVO
=
new
CustomerProductTypeGroupVO
();
productTypeGroupVO
.
setTypeId
(
typeRespVO
.
getId
());
productTypeGroupVO
.
setTypeId
(
typeRespVO
.
getId
());
if
(
CollectionUtil
.
isNotEmpty
(
respVO
.
getProductList
()))
{
List
<
Long
>
prodIds
=
respVO
.
getProductList
().
stream
().
filter
(
p
->
p
.
getTypeId
()
==
typeRespVO
.
getId
()).
map
(
ProductRespVO:
:
getId
).
collect
(
Collectors
.
toList
());
productTypeGroupVO
.
setProductIds
(
CollectionUtil
.
isEmpty
(
prodIds
)
?
new
ArrayList
<>()
:
prodIds
);
}
else
{
productTypeGroupVO
.
setProductIds
(
new
ArrayList
<>());
productTypeGroupVO
.
setProductIds
(
new
ArrayList
<>());
products
.
add
(
productTypeGroupVO
);
}
}
}
products
.
add
(
productTypeGroupVO
);
}
}
respVO
.
setProducts
(
products
);
respVO
.
setProducts
(
products
);
}
}
...
...
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