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
7d446b75
Commit
7d446b75
authored
Aug 23, 2024
by
332784038@qq.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
复制价格业务再次重构调整
parent
61755259
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
248 additions
and
250 deletions
+248
-250
ProductPriceServiceImpl.java
...product/service/product/impl/ProductPriceServiceImpl.java
+248
-250
No files found.
yudao-module-product/yudao-module-product-core/src/main/java/cn/iocoder/yudao/module/product/service/product/impl/ProductPriceServiceImpl.java
View file @
7d446b75
...
@@ -3611,6 +3611,7 @@ public class ProductPriceServiceImpl extends AbstractService<ProductPriceMapper,
...
@@ -3611,6 +3611,7 @@ public class ProductPriceServiceImpl extends AbstractService<ProductPriceMapper,
}
}
private
void
copyClearAndSavePriceStepList
(
ProductPriceDO
productPriceDO
,
List
<
ProductPriceStepDO
>
stepList
,
String
transportType
,
boolean
batchUpdate
)
{
private
void
copyClearAndSavePriceStepList
(
ProductPriceDO
productPriceDO
,
List
<
ProductPriceStepDO
>
stepList
,
String
transportType
,
boolean
batchUpdate
)
{
if
(
productPriceDO
.
getStepPrice
()
==
1
)
{
if
(
stepList
==
null
)
stepList
=
new
ArrayList
<>();
if
(
stepList
==
null
)
stepList
=
new
ArrayList
<>();
stepList
=
stepList
.
stream
()
stepList
=
stepList
.
stream
()
...
@@ -3618,10 +3619,17 @@ public class ProductPriceServiceImpl extends AbstractService<ProductPriceMapper,
...
@@ -3618,10 +3619,17 @@ public class ProductPriceServiceImpl extends AbstractService<ProductPriceMapper,
t
.
getWeightUnit
()
!=
null
&&
t
.
getWeightUnit
()
!=
null
&&
t
.
getEndNum
()
!=
null
)
t
.
getEndNum
()
!=
null
)
.
collect
(
Collectors
.
toList
());
.
collect
(
Collectors
.
toList
());
}
if
(
productPriceDO
.
getStepPrice
()
==
1
&&
CollectionUtil
.
isEmpty
(
stepList
))
return
;
if
(
CollectionUtil
.
isEmpty
(
stepList
))
return
;
List
<
ProductPriceStepDO
>
insertList1
=
new
ArrayList
<>();
List
<
ProductPriceStepDO
>
updateList
=
new
ArrayList
<>();
List
<
ProductPricePackagingDO
>
productPricePackagingDOS
=
new
ArrayList
<>();
List
<
ProductPriceSpecialDO
>
priceSpecialUpdate
=
new
ArrayList
<>();
if
(
productPriceDO
.
getStepPrice
()
==
1
)
{
Collection
<
Integer
>
priceTypes
=
stepList
.
stream
()
Collection
<
Integer
>
priceTypes
=
stepList
.
stream
()
.
map
(
ProductPriceStepDO:
:
getPriceType
)
.
map
(
ProductPriceStepDO:
:
getPriceType
)
.
collect
(
Collectors
.
toSet
());
.
collect
(
Collectors
.
toSet
());
...
@@ -3632,52 +3640,7 @@ public class ProductPriceServiceImpl extends AbstractService<ProductPriceMapper,
...
@@ -3632,52 +3640,7 @@ public class ProductPriceServiceImpl extends AbstractService<ProductPriceMapper,
);
);
Map
<
Long
,
List
<
ProductPriceStepDO
>>
dbStepMap
=
dbStepList
.
stream
()
Map
<
Long
,
List
<
ProductPriceStepDO
>>
dbStepMap
=
dbStepList
.
stream
()
.
collect
(
Collectors
.
groupingBy
(
ProductPriceStepDO:
:
getProductPriceId
));
.
collect
(
Collectors
.
groupingBy
(
ProductPriceStepDO:
:
getProductPriceId
));
List
<
ProductPriceStepDO
>
insertList1
=
new
ArrayList
<>();
List
<
ProductPriceStepDO
>
updateList
=
new
ArrayList
<>();
List
<
ProductPricePackagingDO
>
productPricePackagingDOS
=
new
ArrayList
<>();
List
<
ProductPriceSpecialDO
>
priceSpecialUpdate
=
new
ArrayList
<>();
if
(
productPriceDO
.
getStepPrice
()
==
1
)
{
copyStepPrice
(
stepList
,
transportType
,
productPriceDO
,
dbStepMap
,
insertList1
,
productPricePackagingDOS
,
updateList
);
copyStepPrice
(
stepList
,
transportType
,
productPriceDO
,
dbStepMap
,
insertList1
,
productPricePackagingDOS
,
updateList
);
}
else
{
if
(
CollectionUtil
.
isNotEmpty
(
productPriceDO
.
getSpecialDOList
()))
{
for
(
ProductPriceSpecialDO
specialDO
:
productPriceDO
.
getSpecialDOList
())
{
ProductPriceSpecialDO
priceSpecialDO
=
new
ProductPriceSpecialDO
();
BeanUtils
.
copyProperties
(
specialDO
,
priceSpecialDO
);
priceSpecialDO
.
setId
(
null
);
priceSpecialDO
.
setProductPriceId
(
productPriceDO
.
getId
());
priceSpecialUpdate
.
add
(
priceSpecialDO
);
}
}
if
(
CollectionUtil
.
isNotEmpty
(
productPriceDO
.
getFreightPricePackagingList
()))
{
for
(
ProductPricePackagingDO
packagingDO
:
productPriceDO
.
getFreightPricePackagingList
())
{
ProductPricePackagingDO
pricePackagingDO
=
new
ProductPricePackagingDO
();
BeanUtils
.
copyProperties
(
packagingDO
,
pricePackagingDO
);
pricePackagingDO
.
setId
(
null
);
pricePackagingDO
.
setProductPriceId
(
productPriceDO
.
getId
());
productPricePackagingDOS
.
add
(
pricePackagingDO
);
}
}
if
(
CollectionUtil
.
isNotEmpty
(
productPriceDO
.
getClearancePricePackagingList
()))
{
for
(
ProductPricePackagingDO
packagingDO
:
productPriceDO
.
getClearancePricePackagingList
())
{
ProductPricePackagingDO
pricePackagingDO
=
new
ProductPricePackagingDO
();
BeanUtils
.
copyProperties
(
packagingDO
,
pricePackagingDO
);
pricePackagingDO
.
setId
(
null
);
pricePackagingDO
.
setProductPriceId
(
productPriceDO
.
getId
());
productPricePackagingDOS
.
add
(
pricePackagingDO
);
}
}
if
(
CollectionUtil
.
isNotEmpty
(
productPriceDO
.
getFullPricePackagingList
()))
{
for
(
ProductPricePackagingDO
packagingDO
:
productPriceDO
.
getFullPricePackagingList
())
{
ProductPricePackagingDO
pricePackagingDO
=
new
ProductPricePackagingDO
();
BeanUtils
.
copyProperties
(
packagingDO
,
pricePackagingDO
);
pricePackagingDO
.
setId
(
null
);
pricePackagingDO
.
setProductPriceId
(
productPriceDO
.
getId
());
productPricePackagingDOS
.
add
(
pricePackagingDO
);
}
}
}
if
(
CollectionUtil
.
isNotEmpty
(
insertList1
))
{
if
(
CollectionUtil
.
isNotEmpty
(
insertList1
))
{
productPriceStepMapper
.
insertBatchSomeColumn
(
insertList1
);
productPriceStepMapper
.
insertBatchSomeColumn
(
insertList1
);
}
}
...
@@ -3787,7 +3750,6 @@ public class ProductPriceServiceImpl extends AbstractService<ProductPriceMapper,
...
@@ -3787,7 +3750,6 @@ public class ProductPriceServiceImpl extends AbstractService<ProductPriceMapper,
}
}
}
}
}
}
if
(
CollectionUtil
.
isNotEmpty
(
specialInsertList
))
{
if
(
CollectionUtil
.
isNotEmpty
(
specialInsertList
))
{
productPriceStepSpecialMapper
.
insertBatchSomeColumn
(
specialInsertList
);
productPriceStepSpecialMapper
.
insertBatchSomeColumn
(
specialInsertList
);
}
}
...
@@ -3795,19 +3757,6 @@ public class ProductPriceServiceImpl extends AbstractService<ProductPriceMapper,
...
@@ -3795,19 +3757,6 @@ public class ProductPriceServiceImpl extends AbstractService<ProductPriceMapper,
productPriceStepSpecialMapper
.
updateBatch
(
specialUpdateList
);
productPriceStepSpecialMapper
.
updateBatch
(
specialUpdateList
);
}
}
// if (CollectionUtil.isNotEmpty(priceSpecialInsert)) {
// productPriceSpecialMapper.insertBatch(priceSpecialInsert);
// }
if
(
CollectionUtil
.
isNotEmpty
(
priceSpecialUpdate
))
{
productPriceSpecialMapper
.
physicsDelete
(
productPriceDO
.
getId
().
toString
());
productPriceSpecialMapper
.
insertBatch
(
priceSpecialUpdate
);
}
if
(
CollectionUtil
.
isNotEmpty
(
productPricePackagingDOS
))
{
productPricePackagingMapper
.
physicsDelete
(
productPriceDO
.
getId
().
toString
());
productPricePackagingMapper
.
insertBatch
(
productPricePackagingDOS
);
}
List
<
ProductPriceStepPackagingDO
>
stepPackagingList
=
insertList1
.
stream
()
List
<
ProductPriceStepPackagingDO
>
stepPackagingList
=
insertList1
.
stream
()
.
map
(
ProductPriceStepDO:
:
getPackagingList
)
.
map
(
ProductPriceStepDO:
:
getPackagingList
)
.
filter
(
CollectionUtil:
:
isNotEmpty
)
.
filter
(
CollectionUtil:
:
isNotEmpty
)
...
@@ -3915,6 +3864,55 @@ public class ProductPriceServiceImpl extends AbstractService<ProductPriceMapper,
...
@@ -3915,6 +3864,55 @@ public class ProductPriceServiceImpl extends AbstractService<ProductPriceMapper,
productPriceStepPackagingMapper
.
physicsDeleteById
(
Joiner
.
on
(
","
).
join
(
dbPackingIdList
));
productPriceStepPackagingMapper
.
physicsDeleteById
(
Joiner
.
on
(
","
).
join
(
dbPackingIdList
));
}
}
}
}
}
else
{
if
(
CollectionUtil
.
isNotEmpty
(
productPriceDO
.
getSpecialDOList
()))
{
for
(
ProductPriceSpecialDO
specialDO
:
productPriceDO
.
getSpecialDOList
())
{
ProductPriceSpecialDO
priceSpecialDO
=
new
ProductPriceSpecialDO
();
BeanUtils
.
copyProperties
(
specialDO
,
priceSpecialDO
);
priceSpecialDO
.
setId
(
null
);
priceSpecialDO
.
setProductPriceId
(
productPriceDO
.
getId
());
priceSpecialUpdate
.
add
(
priceSpecialDO
);
}
}
if
(
CollectionUtil
.
isNotEmpty
(
productPriceDO
.
getFreightPricePackagingList
()))
{
for
(
ProductPricePackagingDO
packagingDO
:
productPriceDO
.
getFreightPricePackagingList
())
{
ProductPricePackagingDO
pricePackagingDO
=
new
ProductPricePackagingDO
();
BeanUtils
.
copyProperties
(
packagingDO
,
pricePackagingDO
);
pricePackagingDO
.
setId
(
null
);
pricePackagingDO
.
setProductPriceId
(
productPriceDO
.
getId
());
productPricePackagingDOS
.
add
(
pricePackagingDO
);
}
}
if
(
CollectionUtil
.
isNotEmpty
(
productPriceDO
.
getClearancePricePackagingList
()))
{
for
(
ProductPricePackagingDO
packagingDO
:
productPriceDO
.
getClearancePricePackagingList
())
{
ProductPricePackagingDO
pricePackagingDO
=
new
ProductPricePackagingDO
();
BeanUtils
.
copyProperties
(
packagingDO
,
pricePackagingDO
);
pricePackagingDO
.
setId
(
null
);
pricePackagingDO
.
setProductPriceId
(
productPriceDO
.
getId
());
productPricePackagingDOS
.
add
(
pricePackagingDO
);
}
}
if
(
CollectionUtil
.
isNotEmpty
(
productPriceDO
.
getFullPricePackagingList
()))
{
for
(
ProductPricePackagingDO
packagingDO
:
productPriceDO
.
getFullPricePackagingList
())
{
ProductPricePackagingDO
pricePackagingDO
=
new
ProductPricePackagingDO
();
BeanUtils
.
copyProperties
(
packagingDO
,
pricePackagingDO
);
pricePackagingDO
.
setId
(
null
);
pricePackagingDO
.
setProductPriceId
(
productPriceDO
.
getId
());
productPricePackagingDOS
.
add
(
pricePackagingDO
);
}
}
if
(
CollectionUtil
.
isNotEmpty
(
priceSpecialUpdate
))
{
productPriceSpecialMapper
.
physicsDelete
(
productPriceDO
.
getId
().
toString
());
productPriceSpecialMapper
.
insertBatch
(
priceSpecialUpdate
);
}
if
(
CollectionUtil
.
isNotEmpty
(
productPricePackagingDOS
))
{
productPricePackagingMapper
.
physicsDelete
(
productPriceDO
.
getId
().
toString
());
productPricePackagingMapper
.
insertBatch
(
productPricePackagingDOS
);
}
}
}
}
private
void
copyStepPrice
(
List
<
ProductPriceStepDO
>
stepList
,
String
transportType
,
ProductPriceDO
productPriceDO
,
Map
<
Long
,
List
<
ProductPriceStepDO
>>
dbStepMap
,
List
<
ProductPriceStepDO
>
insertList1
,
List
<
ProductPricePackagingDO
>
productPricePackagingDOS
,
List
<
ProductPriceStepDO
>
updateList
)
{
private
void
copyStepPrice
(
List
<
ProductPriceStepDO
>
stepList
,
String
transportType
,
ProductPriceDO
productPriceDO
,
Map
<
Long
,
List
<
ProductPriceStepDO
>>
dbStepMap
,
List
<
ProductPriceStepDO
>
insertList1
,
List
<
ProductPricePackagingDO
>
productPricePackagingDOS
,
List
<
ProductPriceStepDO
>
updateList
)
{
...
...
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