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
f1954200
Commit
f1954200
authored
Apr 29, 2024
by
liuzeheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
复制价格包装数据复制
parent
3f1e4bd4
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
437 additions
and
7 deletions
+437
-7
WarehouseMapper.java
...odule/depository/dal/mysql/warehouse/WarehouseMapper.java
+9
-1
WarehouseService.java
...module/depository/service/warehouse/WarehouseService.java
+1
-1
WarehouseServiceImpl.java
...pository/service/warehouse/impl/WarehouseServiceImpl.java
+2
-2
WarehouseController.java
...itory/controller/admin/warehouse/WarehouseController.java
+3
-2
ProductPriceSpecialDO.java
...product/dal/dataobject/product/ProductPriceSpecialDO.java
+3
-0
ProductPriceServiceImpl.java
...product/service/product/impl/ProductPriceServiceImpl.java
+419
-1
No files found.
yudao-module-depository/yudao-module-depository-core/src/main/java/cn/iocoder/yudao/module/depository/dal/mysql/warehouse/WarehouseMapper.java
View file @
f1954200
...
...
@@ -159,7 +159,15 @@ public interface WarehouseMapper extends BaseMapperX<WarehouseDO> {
"</if>"
,
"GROUP BY w.title_zh"
,
"</when>"
,
"<when test = 'type == 4'>"
,
"GROUP BY w.shi"
,
"</when>"
,
"<when test = 'type == 5'>"
,
"GROUP BY w.title_zh"
,
"</when>"
,
"</script>"
})
List
<
WarehouseTreeRegionVO
>
getRegionList
(
@Param
(
"type"
)
Integer
type
,
@Param
(
"regionId"
)
String
regionId
);
List
<
WarehouseTreeRegionVO
>
getRegionList
(
@Param
(
"type"
)
Integer
type
,
@Param
(
"regionId"
)
String
regionId
,
@Param
(
"destCountryId"
)
String
destCountryId
,
@Param
(
"objectiveId"
)
String
objectiveId
,
@Param
(
"destWarehouseId"
)
String
destWarehouseId
);
}
yudao-module-depository/yudao-module-depository-core/src/main/java/cn/iocoder/yudao/module/depository/service/warehouse/WarehouseService.java
View file @
f1954200
...
...
@@ -171,5 +171,5 @@ public interface WarehouseService {
List
<
WarehouseTreeRegionVO
>
getWarehouseTreeRegionList
(
Integer
tradeType
);
List
<
WarehouseTreeRegionVO
>
getRegionList
(
Integer
type
,
String
regionId
);
List
<
WarehouseTreeRegionVO
>
getRegionList
(
Integer
type
,
String
regionId
,
String
destCountryId
,
String
objectiveId
,
String
destWarehouseId
);
}
yudao-module-depository/yudao-module-depository-core/src/main/java/cn/iocoder/yudao/module/depository/service/warehouse/impl/WarehouseServiceImpl.java
View file @
f1954200
...
...
@@ -514,11 +514,11 @@ public class WarehouseServiceImpl implements WarehouseService {
}
@Override
public
List
<
WarehouseTreeRegionVO
>
getRegionList
(
Integer
type
,
String
regionId
)
{
public
List
<
WarehouseTreeRegionVO
>
getRegionList
(
Integer
type
,
String
regionId
,
String
destCountryId
,
String
objectiveId
,
String
destWarehouseId
)
{
if
(
regionId
.
equals
(
""
)){
return
new
ArrayList
();
}
List
<
WarehouseTreeRegionVO
>
list
=
warehouseMapper
.
getRegionList
(
type
,
regionId
);
List
<
WarehouseTreeRegionVO
>
list
=
warehouseMapper
.
getRegionList
(
type
,
regionId
,
destCountryId
,
objectiveId
,
destWarehouseId
);
return
list
;
}
}
yudao-module-depository/yudao-module-depository-rest/src/main/java/cn/iocoder/yudao/module/depository/controller/admin/warehouse/WarehouseController.java
View file @
f1954200
...
...
@@ -101,8 +101,9 @@ public class WarehouseController {
}
@GetMapping
(
"/getRegionList"
)
public
CommonResult
<
List
<
WarehouseTreeRegionVO
>>
getRegionList
(
@RequestParam
(
value
=
"type"
,
required
=
false
)
Integer
type
,
String
regionId
){
List
<
WarehouseTreeRegionVO
>
list
=
warehouseService
.
getRegionList
(
type
,
regionId
);
public
CommonResult
<
List
<
WarehouseTreeRegionVO
>>
getRegionList
(
@RequestParam
(
value
=
"type"
,
required
=
false
)
Integer
type
,
String
regionId
,
String
destCountryId
,
String
objectiveId
,
String
destWarehouseId
){
List
<
WarehouseTreeRegionVO
>
list
=
warehouseService
.
getRegionList
(
type
,
regionId
,
destCountryId
,
objectiveId
,
destWarehouseId
);
return
success
(
list
);
}
...
...
yudao-module-product/yudao-module-product-core/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/product/ProductPriceSpecialDO.java
View file @
f1954200
...
...
@@ -7,6 +7,9 @@ import lombok.*;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
/**
* 线路价格特需
*/
@TableName
(
"ecw_product_price_special"
)
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
...
...
yudao-module-product/yudao-module-product-core/src/main/java/cn/iocoder/yudao/module/product/service/product/impl/ProductPriceServiceImpl.java
View file @
f1954200
...
...
@@ -3335,12 +3335,35 @@ public class ProductPriceServiceImpl extends AbstractService<ProductPriceMapper,
freightPriceStep
.
setRankNum
(
1
);
freightPriceStep
.
setWeightUnit
(
price
.
getTransportPriceUnit
());
freightPriceStep
.
setProductPriceId
(
price
.
getId
())
;
if
(
CollectionUtil
.
isNotEmpty
(
respVO
.
getSpecialList
())
){
List
<
ProductPriceStepSpecialDO
>
specialDOList
=
new
ArrayList
<>();
respVO
.
getSpecialList
().
forEach
(
sp
->{
ProductPriceStepSpecialDO
d
=
new
ProductPriceStepSpecialDO
();
BeanUtils
.
copyProperties
(
sp
,
d
);
specialDOList
.
add
(
d
)
;
});
specialDOList
.
stream
().
distinct
();
freightPriceStep
.
setSpecialList
(
specialDOList
)
;
}
//
if
(
CollectionUtil
.
isNotEmpty
(
respVO
.
getFreightPricePackagingList
())){
List
<
ProductPriceStepPackagingDO
>
stepPackagingDOS
=
new
ArrayList
<>();
respVO
.
getFreightPricePackagingList
().
forEach
(
pack
->{
ProductPriceStepPackagingDO
packagingDO
=
new
ProductPriceStepPackagingDO
()
;
BeanUtils
.
copyProperties
(
pack
,
packagingDO
);
stepPackagingDOS
.
add
(
packagingDO
)
;
});
stepPackagingDOS
.
stream
().
distinct
();
freightPriceStep
.
setPackagingList
(
stepPackagingDOS
)
;
}
freightPriceStepList
.
add
(
freightPriceStep
);
createReqVO
.
setFreightPriceStepList
(
freightPriceStepList
);
}
else
{
createReqVO
.
setFreightPriceStepList
(
respVO
.
getFreightPriceStepList
())
;
}
if
(
CollectionUtil
.
isEmpty
(
respVO
.
getClearancePriceStepList
())
){
BeanUtils
.
copyProperties
(
price
,
clear
);
clear
.
setStartNum
(
BigDecimal
.
valueOf
(
0
));
...
...
@@ -3348,6 +3371,18 @@ public class ProductPriceServiceImpl extends AbstractService<ProductPriceMapper,
clear
.
setRankNum
(
2
);
clear
.
setWeightUnit
(
price
.
getClearancePriceUnit
());
clear
.
setProductPriceId
(
price
.
getId
())
;
if
(
CollectionUtil
.
isNotEmpty
(
respVO
.
getClearancePricePackagingList
())
){
List
<
ProductPriceStepPackagingDO
>
stepPackagingDOS
=
new
ArrayList
<>();
respVO
.
getClearancePricePackagingList
().
forEach
(
pack
->{
ProductPriceStepPackagingDO
packagingDO
=
new
ProductPriceStepPackagingDO
()
;
BeanUtils
.
copyProperties
(
pack
,
packagingDO
);
stepPackagingDOS
.
add
(
packagingDO
)
;
});
stepPackagingDOS
.
stream
().
distinct
();
clear
.
setPackagingList
(
stepPackagingDOS
)
;
}
clearancePriceStepList
.
add
(
clear
);
createReqVO
.
setClearancePriceStepList
(
clearancePriceStepList
);
}
else
{
...
...
@@ -3488,7 +3523,7 @@ public class ProductPriceServiceImpl extends AbstractService<ProductPriceMapper,
List
<
Long
>
productPriceIdList
=
productPriceList
.
stream
().
map
(
ProductPriceDO:
:
getId
).
collect
(
Collectors
.
toList
());
List
<
ProductPriceStepDO
>
allStepList
=
buildCopyAllStepList
(
createReqVO
);
clearAndSavePriceStepList
(
productPriceIdList
,
allStepList
,
priceTransportTypeMap
,
createReqVO
.
isBatch
());
c
opyC
learAndSavePriceStepList
(
productPriceIdList
,
allStepList
,
priceTransportTypeMap
,
createReqVO
.
isBatch
());
long
t2
=
System
.
currentTimeMillis
();
log
.
info
(
"路线处理耗时:"
+
(
t2
-
t1
));
...
...
@@ -3497,6 +3532,389 @@ public class ProductPriceServiceImpl extends AbstractService<ProductPriceMapper,
handleOrderException
(
productPriceIdList
,
createReqVO
.
isSync
());
}
private
void
copyClearAndSavePriceStepList
(
List
<
Long
>
productPriceIdList
,
List
<
ProductPriceStepDO
>
stepList
,
Map
<
Long
,
String
>
priceTransportTypeMap
,
boolean
batchUpdate
)
{
if
(
stepList
==
null
)
stepList
=
new
ArrayList
<>();
stepList
=
stepList
.
stream
()
.
filter
(
t
->
t
.
getStartNum
()
!=
null
&&
t
.
getWeightUnit
()
!=
null
&&
t
.
getEndNum
()
!=
null
)
.
collect
(
Collectors
.
toList
());
if
(
CollectionUtil
.
isEmpty
(
stepList
))
return
;
Collection
<
Integer
>
priceTypes
=
stepList
.
stream
()
.
map
(
ProductPriceStepDO:
:
getPriceType
)
.
collect
(
Collectors
.
toSet
());
priceTypes
.
add
(
PriceTypeEnum
.
FULL_PRICE
.
getPriceType
());
List
<
ProductPriceStepDO
>
dbStepList
=
productPriceStepMapper
.
selectList
(
new
LambdaQueryWrapper
<
ProductPriceStepDO
>()
.
in
(
ProductPriceStepDO:
:
getProductPriceId
,
productPriceIdList
)
.
in
(
ProductPriceStepDO:
:
getPriceType
,
priceTypes
)
);
Map
<
Long
,
List
<
ProductPriceStepDO
>>
dbStepMap
=
dbStepList
.
stream
()
.
collect
(
Collectors
.
groupingBy
(
ProductPriceStepDO:
:
getProductPriceId
));
List
<
ProductPriceStepDO
>
insertList1
=
new
ArrayList
<>();
List
<
ProductPriceStepDO
>
updateList
=
new
ArrayList
<>();
List
<
ProductPricePackagingDO
>
productPricePackagingDOS
=
new
ArrayList
<>();
for
(
Long
productPriceId
:
productPriceIdList
)
{
String
transportType
=
priceTransportTypeMap
.
get
(
productPriceId
);
List
<
ProductPriceStepDO
>
dbPriceStepList
=
dbStepMap
.
get
(
productPriceId
);
if
(
CollectionUtil
.
isEmpty
(
dbPriceStepList
))
{
for
(
ProductPriceStepDO
stepItem
:
stepList
)
{
if
(
stepItem
.
getTransportPrice
()
==
null
&&
stepItem
.
getClearancePrice
()
==
null
&&
stepItem
.
getAllPrice
()
==
null
)
continue
;
ProductPriceStepDO
dbItem
=
ObjectUtil
.
clone
(
stepItem
);
dbItem
.
setId
(
null
);
dbItem
.
setProductPriceId
(
productPriceId
);
initBasePrice
(
dbItem
,
transportType
);
insertList1
.
add
(
dbItem
);
if
(
CollectionUtil
.
isNotEmpty
(
stepItem
.
getPackagingList
())){
stepItem
.
getPackagingList
().
forEach
(
pg
->{
ProductPricePackagingDO
pricePackagingDO
=
new
ProductPricePackagingDO
()
;
BeanUtils
.
copyProperties
(
pg
,
pricePackagingDO
);
pricePackagingDO
.
setId
(
null
);
productPricePackagingDOS
.
add
(
pricePackagingDO
);
});
}
}
}
else
{
//更新
for
(
ProductPriceStepDO
stepItem
:
stepList
)
{
boolean
update
=
false
;
for
(
ProductPriceStepDO
dbStepItem
:
dbPriceStepList
)
{
if
(!
stepItem
.
getPriceType
().
equals
(
dbStepItem
.
getPriceType
()))
continue
;
if
(
stepItem
.
getStartNum
().
intValue
()
!=
dbStepItem
.
getStartNum
().
intValue
()
||
stepItem
.
getEndNum
().
intValue
()
!=
dbStepItem
.
getEndNum
().
intValue
()
||
stepItem
.
getWeightUnit
().
longValue
()
!=
dbStepItem
.
getWeightUnit
().
longValue
())
{
continue
;
}
//更新
update
=
true
;
dbStepItem
.
setSpecialList
(
stepItem
.
getSpecialList
());
dbStepItem
.
setPackagingList
(
stepItem
.
getPackagingList
());
updateList
.
add
(
dbStepItem
);
if
(
stepItem
.
getTransportPrice
()
==
null
&&
stepItem
.
getClearancePrice
()
==
null
&&
stepItem
.
getAllPrice
()
==
null
)
continue
;
if
(
stepItem
.
getTransportPrice
()
!=
null
)
{
dbStepItem
.
setTransportPrice
(
stepItem
.
getTransportPrice
());
}
if
(
stepItem
.
getTransportPriceUnit
()
!=
null
)
{
dbStepItem
.
setTransportPriceUnit
(
stepItem
.
getTransportPriceUnit
());
}
if
(
stepItem
.
getTransportVolumeUnit
()
!=
null
)
{
dbStepItem
.
setTransportVolumeUnit
(
stepItem
.
getTransportVolumeUnit
());
}
if
(
stepItem
.
getClearancePrice
()
!=
null
)
{
dbStepItem
.
setClearancePrice
(
stepItem
.
getClearancePrice
());
}
if
(
stepItem
.
getClearancePriceUnit
()
!=
null
)
{
dbStepItem
.
setClearancePriceUnit
(
stepItem
.
getClearancePriceUnit
());
}
if
(
stepItem
.
getClearanceVolumeUnit
()
!=
null
)
{
dbStepItem
.
setClearanceVolumeUnit
(
stepItem
.
getClearanceVolumeUnit
());
}
if
(
stepItem
.
getAllPrice
()
!=
null
)
{
dbStepItem
.
setAllPrice
(
stepItem
.
getAllPrice
());
}
if
(
stepItem
.
getAllPriceUnit
()
!=
null
)
{
dbStepItem
.
setAllPriceUnit
(
stepItem
.
getAllPriceUnit
());
}
if
(
stepItem
.
getAllVolumeUnit
()
!=
null
)
{
dbStepItem
.
setAllVolumeUnit
(
stepItem
.
getAllVolumeUnit
());
}
if
(
stepItem
.
getPriceType
()
!=
null
)
{
dbStepItem
.
setPriceType
(
stepItem
.
getPriceType
());
}
if
(
stepItem
.
getRankNum
()
!=
null
)
{
dbStepItem
.
setRankNum
(
stepItem
.
getRankNum
());
}
break
;
}
if
(!
update
)
{
ProductPriceStepDO
dbItem
=
ObjectUtil
.
clone
(
stepItem
);
dbItem
.
setId
(
null
);
dbItem
.
setProductPriceId
(
productPriceId
);
initBasePrice
(
dbItem
,
transportType
);
insertList1
.
add
(
dbItem
);
}
if
(
CollectionUtil
.
isNotEmpty
(
stepItem
.
getPackagingList
())){
stepItem
.
getPackagingList
().
forEach
(
pg
->{
ProductPricePackagingDO
pricePackagingDO
=
new
ProductPricePackagingDO
()
;
BeanUtils
.
copyProperties
(
pg
,
pricePackagingDO
);
pricePackagingDO
.
setId
(
null
);
pricePackagingDO
.
setProductPriceId
(
productPriceId
)
;
pricePackagingDO
.
setPriceType
(
stepItem
.
getPriceType
())
;
productPricePackagingDOS
.
add
(
pricePackagingDO
);
});
}
}
}
}
if
(
CollectionUtil
.
isNotEmpty
(
insertList1
))
{
productPriceStepMapper
.
insertBatchSomeColumn
(
insertList1
);
}
if
(
CollectionUtil
.
isNotEmpty
(
updateList
))
{
productPriceStepMapper
.
updateBatch
(
updateList
);
}
List
<
Long
>
dbStepIdList
=
dbStepList
.
stream
()
.
map
(
ProductPriceStepDO:
:
getId
)
.
collect
(
toList
());
if
(!
batchUpdate
)
{
List
<
Long
>
updateIdList
=
updateList
.
stream
()
.
map
(
ProductPriceStepDO:
:
getId
)
.
collect
(
toList
());
List
<
Long
>
dbIdList
=
new
ArrayList
<>(
dbStepIdList
);
dbIdList
.
removeAll
(
updateIdList
);
if
(
CollectionUtil
.
isNotEmpty
(
dbIdList
))
{
productPriceStepMapper
.
physicsDeleteById
(
Joiner
.
on
(
","
).
join
(
dbIdList
));
}
}
insertList1
.
addAll
(
updateList
);
List
<
ProductPriceStepSpecialDO
>
allUpdateStepSpecialList
=
insertList1
.
stream
()
.
filter
(
step
->
CollectionUtil
.
isNotEmpty
(
step
.
getSpecialList
()))
.
flatMap
(
step
->
step
.
getSpecialList
().
stream
())
.
filter
(
stepSpecialDO
->
stepSpecialDO
.
getTransportPrice
()
!=
null
||
stepSpecialDO
.
getClearancePrice
()
!=
null
||
stepSpecialDO
.
getAllPrice
()
!=
null
)
.
collect
(
Collectors
.
toList
());
Map
<
Long
,
List
<
ProductPriceStepSpecialDO
>>
stepSpecialGroupMap
=
new
HashMap
<>();
if
(
CollectionUtil
.
isNotEmpty
(
allUpdateStepSpecialList
))
{
//数据库查找所有阶梯特需数据
List
<
List
<
Long
>>
stepIdPartList
=
Lists
.
partition
(
dbStepIdList
,
1000
);
List
<
ProductPriceStepSpecialDO
>
allStepSpecialList
=
new
ArrayList
<>();
for
(
List
<
Long
>
stepIdLis
:
stepIdPartList
)
{
List
<
ProductPriceStepSpecialDO
>
itemStepSpecialList
=
productPriceStepSpecialMapper
.
selectList
(
new
LambdaQueryWrapper
<
ProductPriceStepSpecialDO
>()
.
in
(
ProductPriceStepSpecialDO:
:
getProductPriceStepId
,
stepIdLis
)
);
allStepSpecialList
.
addAll
(
itemStepSpecialList
);
}
stepSpecialGroupMap
=
allStepSpecialList
.
stream
()
.
collect
(
Collectors
.
groupingBy
(
ProductPriceStepSpecialDO:
:
getProductPriceStepId
));
}
List
<
ProductPriceStepSpecialDO
>
specialInsertList
=
new
ArrayList
<>();
List
<
ProductPriceStepSpecialDO
>
specialUpdateList
=
new
ArrayList
<>();
List
<
ProductPriceSpecialDO
>
priceSpecialInsert
=
new
ArrayList
<>();
List
<
ProductPriceSpecialDO
>
priceSpecialUpdate
=
new
ArrayList
<>();
for
(
ProductPriceStepDO
stepDO
:
insertList1
)
{
String
transportType
=
priceTransportTypeMap
.
get
(
stepDO
.
getProductPriceId
());
List
<
ProductPriceStepSpecialDO
>
productPriceStepSpecialDOS
=
stepDO
.
getSpecialList
();
//过滤掉价格为空的数据
if
(
CollectionUtil
.
isNotEmpty
(
productPriceStepSpecialDOS
))
{
productPriceStepSpecialDOS
=
productPriceStepSpecialDOS
.
stream
()
.
filter
(
stepSpecialDO
->
stepSpecialDO
.
getTransportPrice
()
!=
null
||
stepSpecialDO
.
getClearancePrice
()
!=
null
||
stepSpecialDO
.
getAllPrice
()
!=
null
)
.
collect
(
toList
());
List
<
ProductPriceStepSpecialDO
>
dbStepSpecialList
=
stepSpecialGroupMap
.
get
(
stepDO
.
getId
());
Map
<
String
,
ProductPriceStepSpecialDO
>
stepSpecialMap
=
new
HashMap
<>();
if
(
CollectionUtil
.
isNotEmpty
(
dbStepSpecialList
))
{
stepSpecialMap
=
dbStepSpecialList
.
stream
()
.
collect
(
Collectors
.
toMap
(
ProductPriceStepSpecialDO:
:
getSpecialDictType
,
v
->
v
));
}
for
(
ProductPriceStepSpecialDO
stepSpecialDO
:
productPriceStepSpecialDOS
)
{
ProductPriceStepSpecialDO
dbStepSpecialDO
=
stepSpecialMap
.
get
(
stepSpecialDO
.
getSpecialDictType
());
if
(
dbStepSpecialDO
==
null
)
{
ProductPriceStepSpecialDO
dbItem
=
ObjectUtil
.
clone
(
stepSpecialDO
);
dbItem
.
setId
(
null
);
dbItem
.
setProductPriceId
(
stepDO
.
getProductPriceId
());
dbItem
.
setProductPriceStepId
(
stepDO
.
getId
());
initBasePrice
(
dbItem
,
transportType
);
//线路价格特需
ProductPriceSpecialDO
priceSpecialDO
=
new
ProductPriceSpecialDO
();
BeanUtils
.
copyProperties
(
dbItem
,
priceSpecialDO
);
priceSpecialDO
.
setId
(
null
);
priceSpecialInsert
.
add
(
priceSpecialDO
)
;
specialInsertList
.
add
(
dbItem
);
}
else
{
if
(
stepSpecialDO
.
getTransportPrice
()
!=
null
)
{
dbStepSpecialDO
.
setTransportPrice
(
stepSpecialDO
.
getTransportPrice
());
}
if
(
stepSpecialDO
.
getTransportPriceUnit
()
!=
null
)
{
dbStepSpecialDO
.
setTransportPriceUnit
(
stepSpecialDO
.
getTransportPriceUnit
());
}
if
(
stepSpecialDO
.
getTransportVolumeUnit
()
!=
null
)
{
dbStepSpecialDO
.
setTransportVolumeUnit
(
stepSpecialDO
.
getTransportVolumeUnit
());
}
if
(
stepSpecialDO
.
getClearancePrice
()
!=
null
)
{
dbStepSpecialDO
.
setClearancePrice
(
stepSpecialDO
.
getClearancePrice
());
}
if
(
stepSpecialDO
.
getClearancePriceUnit
()
!=
null
)
{
dbStepSpecialDO
.
setClearancePriceUnit
(
stepSpecialDO
.
getClearancePriceUnit
());
}
if
(
stepSpecialDO
.
getClearanceVolumeUnit
()
!=
null
)
{
dbStepSpecialDO
.
setClearanceVolumeUnit
(
stepSpecialDO
.
getClearanceVolumeUnit
());
}
if
(
stepSpecialDO
.
getAllPrice
()
!=
null
)
{
dbStepSpecialDO
.
setAllPrice
(
stepSpecialDO
.
getAllPrice
());
}
if
(
stepSpecialDO
.
getAllPriceUnit
()
!=
null
)
{
dbStepSpecialDO
.
setAllPriceUnit
(
stepSpecialDO
.
getAllPriceUnit
());
}
if
(
stepSpecialDO
.
getAllVolumeUnit
()
!=
null
)
{
dbStepSpecialDO
.
setAllVolumeUnit
(
stepSpecialDO
.
getAllVolumeUnit
());
}
ProductPriceSpecialDO
priceSpecialDO
=
new
ProductPriceSpecialDO
()
;
BeanUtils
.
copyProperties
(
dbStepSpecialDO
,
priceSpecialDO
);
priceSpecialDO
.
setId
(
null
)
;
priceSpecialUpdate
.
add
(
priceSpecialDO
)
;
specialUpdateList
.
add
(
dbStepSpecialDO
);
}
}
}
}
// List<ProductPriceSpecialDO> priceSpecialInsert = new ArrayList<>();
// List<ProductPriceSpecialDO> priceSpecialUpdate = new ArrayList<>();
if
(
CollectionUtil
.
isNotEmpty
(
specialInsertList
))
{
productPriceStepSpecialMapper
.
insertBatchSomeColumn
(
specialInsertList
);
}
if
(
CollectionUtil
.
isNotEmpty
(
specialUpdateList
))
{
productPriceStepSpecialMapper
.
updateBatch
(
specialUpdateList
);
}
if
(
CollectionUtil
.
isNotEmpty
(
priceSpecialInsert
)){
productPriceSpecialMapper
.
insertBatch
(
priceSpecialInsert
);
}
if
(
CollectionUtil
.
isNotEmpty
(
priceSpecialUpdate
)){
productPriceSpecialMapper
.
physicsDelete
(
priceSpecialUpdate
.
get
(
0
).
getProductPriceId
().
toString
());
;
productPriceSpecialMapper
.
insertBatch
(
priceSpecialUpdate
);
}
if
(
CollectionUtil
.
isNotEmpty
(
productPricePackagingDOS
)){
productPricePackagingMapper
.
physicsDelete
(
productPricePackagingDOS
.
get
(
0
).
getProductPriceId
().
toString
());
productPricePackagingMapper
.
insertBatch
(
productPricePackagingDOS
);
}
List
<
ProductPriceStepPackagingDO
>
stepPackagingList
=
insertList1
.
stream
()
.
map
(
ProductPriceStepDO:
:
getPackagingList
)
.
filter
(
CollectionUtil:
:
isNotEmpty
)
.
flatMap
(
List:
:
stream
)
.
collect
(
Collectors
.
toList
());
Map
<
Long
,
List
<
ProductPriceStepPackagingDO
>>
stepPackagingGroupMap
=
new
HashMap
<>();
List
<
Long
>
dbPackingIdList
=
new
ArrayList
<>();
if
(
CollectionUtil
.
isNotEmpty
(
stepPackagingList
))
{
//数据库查找所有阶梯包装数据
List
<
List
<
Long
>>
stepIdPartList
=
Lists
.
partition
(
dbStepIdList
,
1000
);
List
<
ProductPriceStepPackagingDO
>
allStepPackagingList
=
new
ArrayList
<>();
for
(
List
<
Long
>
stepIdLis
:
stepIdPartList
)
{
List
<
ProductPriceStepPackagingDO
>
itemStepPackagingList
=
productPriceStepPackagingMapper
.
selectList
(
new
LambdaQueryWrapper
<
ProductPriceStepPackagingDO
>()
.
in
(
ProductPriceStepPackagingDO:
:
getProductPriceStepId
,
stepIdLis
)
);
allStepPackagingList
.
addAll
(
itemStepPackagingList
);
}
dbPackingIdList
=
allStepPackagingList
.
stream
()
.
map
(
BasePackagingPrice:
:
getId
)
.
collect
(
toList
());
stepPackagingGroupMap
=
allStepPackagingList
.
stream
()
.
collect
(
Collectors
.
groupingBy
(
ProductPriceStepPackagingDO:
:
getProductPriceStepId
));
}
List
<
ProductPriceStepPackagingDO
>
packagingInsertList
=
new
ArrayList
<>();
List
<
ProductPriceStepPackagingDO
>
packagingUpdateList
=
new
ArrayList
<>();
List
<
ProductPriceStepPackagingDO
>
packagingDeleteListList
=
new
ArrayList
<>();
for
(
ProductPriceStepDO
priceStepDO
:
insertList1
)
{
List
<
ProductPriceStepPackagingDO
>
productPriceStepPackagingDOS
=
priceStepDO
.
getPackagingList
();
if
(
CollectionUtil
.
isNotEmpty
(
productPriceStepPackagingDOS
))
{
productPriceStepPackagingDOS
=
productPriceStepPackagingDOS
.
stream
()
.
filter
(
t
->
t
.
getPackagingPrice
()
!=
null
)
.
collect
(
toList
());
}
if
(
CollectionUtil
.
isNotEmpty
(
productPriceStepPackagingDOS
))
{
List
<
ProductPriceStepPackagingDO
>
dbStepPackagingList
=
stepPackagingGroupMap
.
get
(
priceStepDO
.
getId
());
if
(
CollectionUtil
.
isEmpty
(
dbStepPackagingList
))
{
for
(
int
i
=
0
;
i
<
productPriceStepPackagingDOS
.
size
();
i
++)
{
ProductPriceStepPackagingDO
m
=
productPriceStepPackagingDOS
.
get
(
i
);
ProductPriceStepPackagingDO
dbItem
=
ObjectUtil
.
clone
(
m
);
dbItem
.
setId
(
null
);
dbItem
.
setProductPriceId
(
priceStepDO
.
getProductPriceId
());
dbItem
.
setProductPriceStepId
(
priceStepDO
.
getId
());
dbItem
.
setRankNum
(
i
+
1
);
dbItem
.
setDeleted
(
false
);
packagingInsertList
.
add
(
dbItem
);
}
}
else
{
for
(
int
i
=
0
;
i
<
productPriceStepPackagingDOS
.
size
();
i
++)
{
ProductPriceStepPackagingDO
item
=
productPriceStepPackagingDOS
.
get
(
i
);
String
addPricePackagingTypes
=
item
.
getPackagingTypes
();
if
(
StringUtils
.
isBlank
(
addPricePackagingTypes
))
continue
;
Long
addPricePackagingPriceUnit
=
item
.
getPackagingPriceUnit
();
if
(
addPricePackagingPriceUnit
==
null
)
continue
;
Long
addPricePackagingVolumeUnit
=
item
.
getPackagingVolumeUnit
();
if
(
addPricePackagingVolumeUnit
==
null
)
continue
;
Set
<
String
>
addPriceTypeSets
=
new
HashSet
<>(
Arrays
.
asList
(
addPricePackagingTypes
.
split
(
","
)));
//新增BC
ProductPriceStepPackagingDO
dbItem
=
ObjectUtil
.
clone
(
item
);
dbItem
.
setId
(
null
);
dbItem
.
setProductPriceId
(
priceStepDO
.
getProductPriceId
());
dbItem
.
setProductPriceStepId
(
priceStepDO
.
getId
());
dbItem
.
setRankNum
(
i
+
1
);
dbItem
.
setDeleted
(
false
);
packagingInsertList
.
add
(
dbItem
);
if
(!
batchUpdate
)
continue
;
for
(
ProductPriceStepPackagingDO
dbStepPacking
:
dbStepPackagingList
)
{
Set
<
String
>
dbPriceTypeSets
=
new
HashSet
<>(
Arrays
.
asList
(
dbStepPacking
.
getPackagingTypes
().
split
(
","
)));
dbPriceTypeSets
.
removeAll
(
addPriceTypeSets
);
if
(
dbPriceTypeSets
.
isEmpty
())
{
packagingDeleteListList
.
add
(
dbStepPacking
);
}
else
{
dbStepPacking
.
setPackagingTypes
(
Joiner
.
on
(
","
).
join
(
dbPriceTypeSets
));
dbStepPacking
.
setPackagingPriceUnit
(
item
.
getPackagingPriceUnit
());
dbStepPacking
.
setPackagingVolumeUnit
(
item
.
getPackagingVolumeUnit
());
packagingUpdateList
.
add
(
dbStepPacking
);
}
}
}
}
}
}
if
(
CollectionUtil
.
isNotEmpty
(
packagingInsertList
))
{
productPriceStepPackagingMapper
.
insertBatchSomeColumn
(
packagingInsertList
);
}
if
(
CollectionUtil
.
isNotEmpty
(
packagingUpdateList
))
{
productPriceStepPackagingMapper
.
updateBatch
(
packagingUpdateList
);
}
if
(
CollectionUtil
.
isNotEmpty
(
packagingDeleteListList
))
{
List
<
Long
>
dIdList
=
packagingDeleteListList
.
stream
()
.
map
(
BasePackagingPrice:
:
getId
)
.
collect
(
toList
());
productPriceStepPackagingMapper
.
deleteBatchIds
(
dIdList
);
}
if
(!
batchUpdate
)
{
List
<
Long
>
updateIdList
=
packagingUpdateList
.
stream
()
.
map
(
ProductPriceStepPackagingDO:
:
getId
)
.
collect
(
toList
());
dbPackingIdList
.
removeAll
(
updateIdList
);
if
(
CollectionUtil
.
isNotEmpty
(
dbPackingIdList
))
{
productPriceStepPackagingMapper
.
physicsDeleteById
(
Joiner
.
on
(
","
).
join
(
dbPackingIdList
));
}
}
}
/**
* 复制另一商品价格的 阶梯价格
* @param productPriceStepBaseVO
...
...
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