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
416d4f6d
Commit
416d4f6d
authored
Aug 23, 2024
by
zhangfeng
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/dev' into dev
parents
70dfec54
4b0575aa
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
611 additions
and
698 deletions
+611
-698
BasePrice.java
...udao/module/product/dal/dataobject/product/BasePrice.java
+18
-0
ProductPriceExcelExportListener.java
...ule/product/listener/ProductPriceExcelExportListener.java
+133
-132
ProductPriceServiceImpl.java
...product/service/product/impl/ProductPriceServiceImpl.java
+458
-566
ProductPriceReqBaseVO.java
...module/product/vo/productPrice/ProductPriceReqBaseVO.java
+2
-0
No files found.
yudao-module-product/yudao-module-product-core/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/product/BasePrice.java
View file @
416d4f6d
...
@@ -7,6 +7,7 @@ import io.swagger.annotations.ApiModelProperty;
...
@@ -7,6 +7,7 @@ import io.swagger.annotations.ApiModelProperty;
import
lombok.Data
;
import
lombok.Data
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.util.List
;
@Data
@Data
public
class
BasePrice
extends
BaseDO
{
public
class
BasePrice
extends
BaseDO
{
...
@@ -92,4 +93,21 @@ public class BasePrice extends BaseDO {
...
@@ -92,4 +93,21 @@ public class BasePrice extends BaseDO {
@JsonIgnore
@JsonIgnore
private
int
productPriceEmptyType
=
0
;
private
int
productPriceEmptyType
=
0
;
@ApiModelProperty
(
value
=
"特殊需求列表"
)
@TableField
(
exist
=
false
)
private
List
<
ProductPriceSpecialDO
>
specialDOList
;
@ApiModelProperty
(
value
=
"运费包装价格列表"
)
@TableField
(
exist
=
false
)
private
List
<
ProductPricePackagingDO
>
freightPricePackagingList
;
@ApiModelProperty
(
value
=
"清关费包装价格列表"
)
@TableField
(
exist
=
false
)
private
List
<
ProductPricePackagingDO
>
clearancePricePackagingList
;
@ApiModelProperty
(
value
=
"全包价包装价格列表"
)
@TableField
(
exist
=
false
)
private
List
<
ProductPricePackagingDO
>
fullPricePackagingList
;
}
}
yudao-module-product/yudao-module-product-core/src/main/java/cn/iocoder/yudao/module/product/listener/ProductPriceExcelExportListener.java
View file @
416d4f6d
...
@@ -193,157 +193,158 @@ public class ProductPriceExcelExportListener {
...
@@ -193,157 +193,158 @@ public class ProductPriceExcelExportListener {
StringBuilder
ytqgfSb
=
new
StringBuilder
();
StringBuilder
ytqgfSb
=
new
StringBuilder
();
StringBuilder
ddyfSb
=
new
StringBuilder
();
StringBuilder
ddyfSb
=
new
StringBuilder
();
StringBuilder
ddqgfSb
=
new
StringBuilder
();
StringBuilder
ddqgfSb
=
new
StringBuilder
();
if
(
item
.
getPriceType
()
==
0
)
{
if
(
CollectionUtil
.
isNotEmpty
(
yfStepList
))
{
if
(
CollectionUtil
.
isNotEmpty
(
yfStepList
))
{
yfStepList
.
sort
(
Comparator
.
comparing
(
ProductPriceStepDO:
:
getRankNum
));
yfStepList
.
sort
(
Comparator
.
comparing
(
ProductPriceStepDO:
:
getRankNum
));
for
(
int
j
=
1
;
j
<=
yfStepList
.
size
();
j
++)
{
for
(
int
j
=
1
;
j
<=
yfStepList
.
size
();
j
++)
{
ProductPriceStepDO
stepDO
=
yfStepList
.
get
(
j
-
1
);
ProductPriceStepDO
stepDO
=
yfStepList
.
get
(
j
-
1
);
List
<
ProductPriceStepSpecialDO
>
stepSpecialDOS
=
stepDO
.
getSpecialList
();
List
<
ProductPriceStepSpecialDO
>
stepSpecialDOS
=
stepDO
.
getSpecialList
();
if
(
CollectionUtil
.
isNotEmpty
(
stepSpecialDOS
))
{
if
(
CollectionUtil
.
isNotEmpty
(
stepSpecialDOS
))
{
Map
<
String
,
ProductPriceStepSpecialDO
>
stepSpecialDOMap
=
stepSpecialDOS
.
stream
()
Map
<
String
,
ProductPriceStepSpecialDO
>
stepSpecialDOMap
=
stepSpecialDOS
.
stream
()
.
collect
(
Collectors
.
toMap
(
ProductPriceStepSpecialDO:
:
getSpecialDictType
,
v
->
v
,
(
v1
,
v2
)
->
v2
));
.
collect
(
Collectors
.
toMap
(
ProductPriceStepSpecialDO:
:
getSpecialDictType
,
v
->
v
,
(
v1
,
v2
)
->
v2
));
//有牌
//有牌
ProductPriceStepSpecialDO
yp
=
stepSpecialDOMap
.
get
(
"licensed_price"
);
ProductPriceStepSpecialDO
yp
=
stepSpecialDOMap
.
get
(
"licensed_price"
);
//中性
//中性
ProductPriceStepSpecialDO
zx
=
stepSpecialDOMap
.
get
(
"neutral_brand_prices"
);
ProductPriceStepSpecialDO
zx
=
stepSpecialDOMap
.
get
(
"neutral_brand_prices"
);
//液体
//液体
ProductPriceStepSpecialDO
yt
=
stepSpecialDOMap
.
get
(
"liquid_price"
);
ProductPriceStepSpecialDO
yt
=
stepSpecialDOMap
.
get
(
"liquid_price"
);
//带电
//带电
ProductPriceStepSpecialDO
dd
=
stepSpecialDOMap
.
get
(
"live_price"
);
ProductPriceStepSpecialDO
dd
=
stepSpecialDOMap
.
get
(
"live_price"
);
String
stepInfo
=
"第"
+
j
+
"阶梯: "
;
String
stepInfo
=
"第"
+
j
+
"阶梯: "
;
addStepSpecialPrice
(
yp
,
currencyMap
,
unitMap
,
ypyfSb
,
stepInfo
,
PriceTypeEnum
.
FREIGHT
);
addStepSpecialPrice
(
yp
,
currencyMap
,
unitMap
,
ypyfSb
,
stepInfo
,
PriceTypeEnum
.
FREIGHT
);
addStepSpecialPrice
(
zx
,
currencyMap
,
unitMap
,
zxyfSb
,
stepInfo
,
PriceTypeEnum
.
FREIGHT
);
addStepSpecialPrice
(
zx
,
currencyMap
,
unitMap
,
zxyfSb
,
stepInfo
,
PriceTypeEnum
.
FREIGHT
);
addStepSpecialPrice
(
yt
,
currencyMap
,
unitMap
,
ytyfSb
,
stepInfo
,
PriceTypeEnum
.
FREIGHT
);
addStepSpecialPrice
(
yt
,
currencyMap
,
unitMap
,
ytyfSb
,
stepInfo
,
PriceTypeEnum
.
FREIGHT
);
addStepSpecialPrice
(
dd
,
currencyMap
,
unitMap
,
ddyfSb
,
stepInfo
,
PriceTypeEnum
.
FREIGHT
);
addStepSpecialPrice
(
dd
,
currencyMap
,
unitMap
,
ddyfSb
,
stepInfo
,
PriceTypeEnum
.
FREIGHT
);
if
(
i
!=
yfStepList
.
size
())
{
if
(
i
!=
yfStepList
.
size
())
{
ypyfSb
.
append
((
char
)
10
);
ypyfSb
.
append
((
char
)
10
);
zxyfSb
.
append
((
char
)
10
);
zxyfSb
.
append
((
char
)
10
);
ytyfSb
.
append
((
char
)
10
);
ytyfSb
.
append
((
char
)
10
);
ddyfSb
.
append
((
char
)
10
);
ddyfSb
.
append
((
char
)
10
);
}
}
}
}
String
stepTransportPrice
=
getPrice
(
stepDO
.
getTransportPrice
(),
String
stepTransportPrice
=
getPrice
(
stepDO
.
getTransportPrice
(),
stepDO
.
getTransportPriceUnit
().
intValue
(),
stepDO
.
getTransportPriceUnit
().
intValue
(),
stepDO
.
getTransportVolumeUnit
().
intValue
(),
currencyMap
,
unitMap
);
stepDO
.
getTransportVolumeUnit
().
intValue
(),
currencyMap
,
unitMap
);
Long
weightUnit
=
stepDO
.
getWeightUnit
();
Long
weightUnit
=
stepDO
.
getWeightUnit
();
String
unit
=
""
;
String
unit
=
""
;
if
(
weightUnit
!=
null
)
{
if
(
weightUnit
!=
null
)
{
UnitDO
unitDO
=
unitMap
.
get
(
weightUnit
.
intValue
());
UnitDO
unitDO
=
unitMap
.
get
(
weightUnit
.
intValue
());
unit
=
Objects
.
nonNull
(
unitDO
)?
unitDO
.
getTitleZh
():
"空"
;
unit
=
Objects
.
nonNull
(
unitDO
)
?
unitDO
.
getTitleZh
()
:
"空"
;
}
}
BigDecimal
startNum
=
stepDO
.
getStartNum
();
BigDecimal
startNum
=
stepDO
.
getStartNum
();
BigDecimal
endNum
=
stepDO
.
getEndNum
();
BigDecimal
endNum
=
stepDO
.
getEndNum
();
transportPriceSb
.
append
(
"第"
).
append
(
j
).
append
(
"阶梯:"
).
append
(
startNum
)
transportPriceSb
.
append
(
"第"
).
append
(
j
).
append
(
"阶梯:"
).
append
(
startNum
)
.
append
(
"-"
).
append
(
endNum
).
append
(
unit
).
append
(
" "
).
append
(
stepTransportPrice
);
.
append
(
"-"
).
append
(
endNum
).
append
(
unit
).
append
(
" "
).
append
(
stepTransportPrice
);
if
(
i
!=
stepList
.
size
())
{
if
(
i
!=
stepList
.
size
())
{
transportPriceSb
.
append
((
char
)
10
);
transportPriceSb
.
append
((
char
)
10
);
}
}
}
}
}
}
if
(
CollectionUtil
.
isNotEmpty
(
qgfStepList
))
{
if
(
CollectionUtil
.
isNotEmpty
(
qgfStepList
))
{
qgfStepList
.
sort
(
Comparator
.
comparing
(
ProductPriceStepDO:
:
getRankNum
));
qgfStepList
.
sort
(
Comparator
.
comparing
(
ProductPriceStepDO:
:
getRankNum
));
for
(
int
j
=
1
;
j
<=
qgfStepList
.
size
();
j
++)
{
for
(
int
j
=
1
;
j
<=
qgfStepList
.
size
();
j
++)
{
ProductPriceStepDO
stepDO
=
qgfStepList
.
get
(
j
-
1
);
ProductPriceStepDO
stepDO
=
qgfStepList
.
get
(
j
-
1
);
List
<
ProductPriceStepSpecialDO
>
stepSpecialDOS
=
stepDO
.
getSpecialList
();
List
<
ProductPriceStepSpecialDO
>
stepSpecialDOS
=
stepDO
.
getSpecialList
();
if
(
CollectionUtil
.
isNotEmpty
(
stepSpecialDOS
))
{
if
(
CollectionUtil
.
isNotEmpty
(
stepSpecialDOS
))
{
Map
<
String
,
ProductPriceStepSpecialDO
>
stepSpecialDOMap
=
stepSpecialDOS
.
stream
()
Map
<
String
,
ProductPriceStepSpecialDO
>
stepSpecialDOMap
=
stepSpecialDOS
.
stream
()
.
collect
(
Collectors
.
toMap
(
ProductPriceStepSpecialDO:
:
getSpecialDictType
,
v
->
v
,
(
v1
,
v2
)
->
v2
));
.
collect
(
Collectors
.
toMap
(
ProductPriceStepSpecialDO:
:
getSpecialDictType
,
v
->
v
,
(
v1
,
v2
)
->
v2
));
//有牌
//有牌
ProductPriceStepSpecialDO
yp
=
stepSpecialDOMap
.
get
(
"licensed_price"
);
ProductPriceStepSpecialDO
yp
=
stepSpecialDOMap
.
get
(
"licensed_price"
);
//中性
//中性
ProductPriceStepSpecialDO
zx
=
stepSpecialDOMap
.
get
(
"neutral_brand_prices"
);
ProductPriceStepSpecialDO
zx
=
stepSpecialDOMap
.
get
(
"neutral_brand_prices"
);
//液体
//液体
ProductPriceStepSpecialDO
yt
=
stepSpecialDOMap
.
get
(
"liquid_price"
);
ProductPriceStepSpecialDO
yt
=
stepSpecialDOMap
.
get
(
"liquid_price"
);
//带电
//带电
ProductPriceStepSpecialDO
dd
=
stepSpecialDOMap
.
get
(
"live_price"
);
ProductPriceStepSpecialDO
dd
=
stepSpecialDOMap
.
get
(
"live_price"
);
String
stepInfo
=
"第"
+
j
+
"阶梯: "
;
String
stepInfo
=
"第"
+
j
+
"阶梯: "
;
addStepSpecialPrice
(
yp
,
currencyMap
,
unitMap
,
ypqgfSb
,
stepInfo
,
PriceTypeEnum
.
CLEARANCE
);
addStepSpecialPrice
(
yp
,
currencyMap
,
unitMap
,
ypqgfSb
,
stepInfo
,
PriceTypeEnum
.
CLEARANCE
);
addStepSpecialPrice
(
zx
,
currencyMap
,
unitMap
,
zxqgfSb
,
stepInfo
,
PriceTypeEnum
.
CLEARANCE
);
addStepSpecialPrice
(
zx
,
currencyMap
,
unitMap
,
zxqgfSb
,
stepInfo
,
PriceTypeEnum
.
CLEARANCE
);
addStepSpecialPrice
(
yt
,
currencyMap
,
unitMap
,
ytqgfSb
,
stepInfo
,
PriceTypeEnum
.
CLEARANCE
);
addStepSpecialPrice
(
yt
,
currencyMap
,
unitMap
,
ytqgfSb
,
stepInfo
,
PriceTypeEnum
.
CLEARANCE
);
addStepSpecialPrice
(
dd
,
currencyMap
,
unitMap
,
ddqgfSb
,
stepInfo
,
PriceTypeEnum
.
CLEARANCE
);
addStepSpecialPrice
(
dd
,
currencyMap
,
unitMap
,
ddqgfSb
,
stepInfo
,
PriceTypeEnum
.
CLEARANCE
);
if
(
i
!=
qgfStepList
.
size
())
{
if
(
i
!=
qgfStepList
.
size
())
{
ypqgfSb
.
append
((
char
)
10
);
ypqgfSb
.
append
((
char
)
10
);
zxqgfSb
.
append
((
char
)
10
);
zxqgfSb
.
append
((
char
)
10
);
ytqgfSb
.
append
((
char
)
10
);
ytqgfSb
.
append
((
char
)
10
);
ddqgfSb
.
append
((
char
)
10
);
ddqgfSb
.
append
((
char
)
10
);
}
}
}
}
String
stepClearancePrice
=
getPrice
(
stepDO
.
getClearancePrice
(),
String
stepClearancePrice
=
getPrice
(
stepDO
.
getClearancePrice
(),
stepDO
.
getClearancePriceUnit
().
intValue
(),
stepDO
.
getClearancePriceUnit
().
intValue
(),
stepDO
.
getClearanceVolumeUnit
().
intValue
(),
currencyMap
,
unitMap
);
stepDO
.
getClearanceVolumeUnit
().
intValue
(),
currencyMap
,
unitMap
);
//
//
Long
weightUnit
=
stepDO
.
getWeightUnit
();
Long
weightUnit
=
stepDO
.
getWeightUnit
();
String
unit
=
""
;
String
unit
=
""
;
if
(
weightUnit
!=
null
)
{
if
(
weightUnit
!=
null
)
{
UnitDO
unitDO
=
unitMap
.
get
(
weightUnit
.
intValue
());
UnitDO
unitDO
=
unitMap
.
get
(
weightUnit
.
intValue
());
unit
=
unitDO
.
getTitleZh
();
unit
=
Objects
.
nonNull
(
unitDO
)
?
unitDO
.
getTitleZh
()
:
"空"
;
}
}
BigDecimal
startNum
=
stepDO
.
getStartNum
();
BigDecimal
startNum
=
stepDO
.
getStartNum
();
BigDecimal
endNum
=
stepDO
.
getEndNum
();
BigDecimal
endNum
=
stepDO
.
getEndNum
();
clearancePriceSb
.
append
(
"第"
).
append
(
j
).
append
(
"阶梯:"
).
append
(
startNum
)
clearancePriceSb
.
append
(
"第"
).
append
(
j
).
append
(
"阶梯:"
).
append
(
startNum
)
.
append
(
"-"
).
append
(
endNum
).
append
(
unit
).
append
(
" "
).
append
(
stepClearancePrice
);
.
append
(
"-"
).
append
(
endNum
).
append
(
unit
).
append
(
" "
).
append
(
stepClearancePrice
);
if
(
i
!=
stepList
.
size
())
{
if
(
i
!=
stepList
.
size
())
{
clearancePriceSb
.
append
((
char
)
10
);
clearancePriceSb
.
append
((
char
)
10
);
}
}
}
}
}
}
}
if
(
item
.
getPriceType
()
==
1
)
{
if
(
CollectionUtil
.
isNotEmpty
(
qbjStepList
)
&&
item
.
getPriceType
()
==
1
)
{
if
(
CollectionUtil
.
isNotEmpty
(
qbjStepList
)
&&
item
.
getPriceType
()
==
1
)
{
qbjStepList
.
sort
(
Comparator
.
comparing
(
ProductPriceStepDO:
:
getRankNum
));
qbjStepList
.
sort
(
Comparator
.
comparing
(
ProductPriceStepDO:
:
getRankNum
));
for
(
int
j
=
1
;
j
<=
qbjStepList
.
size
();
j
++)
{
for
(
int
j
=
1
;
j
<=
qbjStepList
.
size
();
j
++)
{
ProductPriceStepDO
stepDO
=
qbjStepList
.
get
(
j
-
1
);
ProductPriceStepDO
stepDO
=
qbjStepList
.
get
(
j
-
1
);
List
<
ProductPriceStepSpecialDO
>
stepSpecialDOS
=
stepDO
.
getSpecialList
();
List
<
ProductPriceStepSpecialDO
>
stepSpecialDOS
=
stepDO
.
getSpecialList
();
if
(
CollectionUtil
.
isNotEmpty
(
stepSpecialDOS
))
{
if
(
CollectionUtil
.
isNotEmpty
(
stepSpecialDOS
))
{
Map
<
String
,
ProductPriceStepSpecialDO
>
stepSpecialDOMap
=
stepSpecialDOS
.
stream
()
Map
<
String
,
ProductPriceStepSpecialDO
>
stepSpecialDOMap
=
stepSpecialDOS
.
stream
()
.
collect
(
Collectors
.
toMap
(
ProductPriceStepSpecialDO:
:
getSpecialDictType
,
v
->
v
,
(
v1
,
v2
)
->
v2
));
.
collect
(
Collectors
.
toMap
(
ProductPriceStepSpecialDO:
:
getSpecialDictType
,
v
->
v
,
(
v1
,
v2
)
->
v2
));
//有牌
//有牌
ProductPriceStepSpecialDO
yp
=
stepSpecialDOMap
.
get
(
"licensed_price"
);
ProductPriceStepSpecialDO
yp
=
stepSpecialDOMap
.
get
(
"licensed_price"
);
//中性
//中性
ProductPriceStepSpecialDO
zx
=
stepSpecialDOMap
.
get
(
"neutral_brand_prices"
);
ProductPriceStepSpecialDO
zx
=
stepSpecialDOMap
.
get
(
"neutral_brand_prices"
);
//液体
//液体
ProductPriceStepSpecialDO
yt
=
stepSpecialDOMap
.
get
(
"liquid_price"
);
ProductPriceStepSpecialDO
yt
=
stepSpecialDOMap
.
get
(
"liquid_price"
);
//带电
//带电
ProductPriceStepSpecialDO
dd
=
stepSpecialDOMap
.
get
(
"live_price"
);
ProductPriceStepSpecialDO
dd
=
stepSpecialDOMap
.
get
(
"live_price"
);
String
stepInfo
=
"第"
+
j
+
"阶梯: "
;
String
stepInfo
=
"第"
+
j
+
"阶梯: "
;
addStepSpecialPrice
(
yp
,
currencyMap
,
unitMap
,
ypyfSb
,
stepInfo
,
PriceTypeEnum
.
FULL_PRICE
);
addStepSpecialPrice
(
yp
,
currencyMap
,
unitMap
,
ypyfSb
,
stepInfo
,
PriceTypeEnum
.
FULL_PRICE
);
addStepSpecialPrice
(
zx
,
currencyMap
,
unitMap
,
zxyfSb
,
stepInfo
,
PriceTypeEnum
.
FULL_PRICE
);
addStepSpecialPrice
(
zx
,
currencyMap
,
unitMap
,
zxyfSb
,
stepInfo
,
PriceTypeEnum
.
FULL_PRICE
);
addStepSpecialPrice
(
yt
,
currencyMap
,
unitMap
,
ytyfSb
,
stepInfo
,
PriceTypeEnum
.
FULL_PRICE
);
addStepSpecialPrice
(
yt
,
currencyMap
,
unitMap
,
ytyfSb
,
stepInfo
,
PriceTypeEnum
.
FULL_PRICE
);
addStepSpecialPrice
(
dd
,
currencyMap
,
unitMap
,
ddyfSb
,
stepInfo
,
PriceTypeEnum
.
FULL_PRICE
);
addStepSpecialPrice
(
dd
,
currencyMap
,
unitMap
,
ddyfSb
,
stepInfo
,
PriceTypeEnum
.
FULL_PRICE
);
if
(
i
!=
qbjStepList
.
size
())
{
if
(
i
!=
qbjStepList
.
size
())
{
ypyfSb
.
append
((
char
)
10
);
ypyfSb
.
append
((
char
)
10
);
zxyfSb
.
append
((
char
)
10
);
zxyfSb
.
append
((
char
)
10
);
ytyfSb
.
append
((
char
)
10
);
ytyfSb
.
append
((
char
)
10
);
ddyfSb
.
append
((
char
)
10
);
ddyfSb
.
append
((
char
)
10
);
}
}
}
}
//
//
String
stepTransportPrice
=
getPrice
(
stepDO
.
getAllPrice
(),
stepDO
.
getAllPriceUnit
().
intValue
(),
String
stepTransportPrice
=
getPrice
(
stepDO
.
getAllPrice
(),
stepDO
.
getAllPriceUnit
().
intValue
(),
stepDO
.
getAllVolumeUnit
().
intValue
(),
currencyMap
,
unitMap
);
stepDO
.
getAllVolumeUnit
().
intValue
(),
currencyMap
,
unitMap
);
//
//
Long
weightUnit
=
stepDO
.
getWeightUnit
();
Long
weightUnit
=
stepDO
.
getWeightUnit
();
String
unit
=
""
;
String
unit
=
""
;
if
(
weightUnit
!=
null
)
{
if
(
weightUnit
!=
null
)
{
UnitDO
unitDO
=
unitMap
.
get
(
weightUnit
.
intValue
());
UnitDO
unitDO
=
unitMap
.
get
(
weightUnit
.
intValue
());
unit
=
Objects
.
nonNull
(
unitDO
)
?
unitDO
.
getTitleZh
()
:
"空"
;
unit
=
Objects
.
nonNull
(
unitDO
)
?
unitDO
.
getTitleZh
()
:
"空"
;
}
}
BigDecimal
startNum
=
stepDO
.
getStartNum
();
BigDecimal
startNum
=
stepDO
.
getStartNum
();
BigDecimal
endNum
=
stepDO
.
getEndNum
();
BigDecimal
endNum
=
stepDO
.
getEndNum
();
transportPriceSb
.
append
(
"第"
).
append
(
j
).
append
(
"阶梯:"
).
append
(
startNum
)
transportPriceSb
.
append
(
"第"
).
append
(
j
).
append
(
"阶梯:"
).
append
(
startNum
)
.
append
(
"-"
).
append
(
endNum
).
append
(
unit
).
append
(
" "
).
append
(
stepTransportPrice
);
.
append
(
"-"
).
append
(
endNum
).
append
(
unit
).
append
(
" "
).
append
(
stepTransportPrice
);
if
(
i
!=
stepList
.
size
())
{
if
(
i
!=
stepList
.
size
())
{
transportPriceSb
.
append
((
char
)
10
);
transportPriceSb
.
append
((
char
)
10
);
}
}
}
}
}
}
}
transportPrice
=
transportPriceSb
.
toString
();
transportPrice
=
transportPriceSb
.
toString
();
clearancePrice
=
clearancePriceSb
.
toString
();
clearancePrice
=
clearancePriceSb
.
toString
();
...
...
yudao-module-product/yudao-module-product-core/src/main/java/cn/iocoder/yudao/module/product/service/product/impl/ProductPriceServiceImpl.java
View file @
416d4f6d
...
@@ -1618,7 +1618,12 @@ public class ProductPriceServiceImpl extends AbstractService<ProductPriceMapper,
...
@@ -1618,7 +1618,12 @@ public class ProductPriceServiceImpl extends AbstractService<ProductPriceMapper,
//设置特殊需求列表
//设置特殊需求列表
productPriceRespVO
.
setSpecialList
(
productPriceSpecialService
.
getProductPriceSpecialList
(
id
));
productPriceRespVO
.
setSpecialList
(
productPriceSpecialService
.
getProductPriceSpecialList
(
id
));
List
<
ProductPricePackagingDO
>
packagingDOList
=
productPricePackagingMapper
.
selectList
(
new
LambdaQueryWrapperX
<
ProductPricePackagingDO
>().
eq
(
ProductPricePackagingDO:
:
getProductPriceId
,
id
));
if
(
CollectionUtil
.
isNotEmpty
(
packagingDOList
))
{
productPriceRespVO
.
setFreightPricePackagingList
(
packagingDOList
.
stream
().
filter
(
p
->
p
.
getPriceType
()
==
PriceTypeEnum
.
FREIGHT
.
getPriceType
()).
collect
(
toList
()));
productPriceRespVO
.
setClearancePricePackagingList
(
packagingDOList
.
stream
().
filter
(
p
->
p
.
getPriceType
()
==
PriceTypeEnum
.
CLEARANCE
.
getPriceType
()).
collect
(
toList
()));
productPriceRespVO
.
setFullPricePackagingList
(
packagingDOList
.
stream
().
filter
(
p
->
p
.
getPriceType
()
==
PriceTypeEnum
.
FULL_PRICE
.
getPriceType
()).
collect
(
toList
()));
}
List
<
ProductPriceStepDO
>
priceStepDOList
=
productPriceStepService
.
getProductPriceStepList
(
id
);
List
<
ProductPriceStepDO
>
priceStepDOList
=
productPriceStepService
.
getProductPriceStepList
(
id
);
List
<
Long
>
stepIdList
=
priceStepDOList
.
stream
()
List
<
Long
>
stepIdList
=
priceStepDOList
.
stream
()
...
@@ -3458,6 +3463,7 @@ public class ProductPriceServiceImpl extends AbstractService<ProductPriceMapper,
...
@@ -3458,6 +3463,7 @@ public class ProductPriceServiceImpl extends AbstractService<ProductPriceMapper,
lineChannelList
.
add
(
vo
);
lineChannelList
.
add
(
vo
);
createReqVO
.
setLineChannelList
(
lineChannelList
);
createReqVO
.
setLineChannelList
(
lineChannelList
);
ProductPriceRespVO
respVO
=
this
.
getProductPriceDetail
(
price
.
getId
());
ProductPriceRespVO
respVO
=
this
.
getProductPriceDetail
(
price
.
getId
());
price
.
setSpecialDOList
(
respVO
.
getSpecialList
());
//阶梯运费价格列表
//阶梯运费价格列表
List
<
ProductPriceStepDO
>
freightPriceStepList
=
new
ArrayList
<>();
List
<
ProductPriceStepDO
>
freightPriceStepList
=
new
ArrayList
<>();
//阶梯清关费价格列表
//阶梯清关费价格列表
...
@@ -3467,134 +3473,22 @@ public class ProductPriceServiceImpl extends AbstractService<ProductPriceMapper,
...
@@ -3467,134 +3473,22 @@ public class ProductPriceServiceImpl extends AbstractService<ProductPriceMapper,
ProductPriceStepDO
freightPriceStep
=
new
ProductPriceStepDO
();
ProductPriceStepDO
freightPriceStep
=
new
ProductPriceStepDO
();
ProductPriceStepDO
clear
=
new
ProductPriceStepDO
();
ProductPriceStepDO
clear
=
new
ProductPriceStepDO
();
if
(
createReqVO
.
getPriceType
()
==
1
)
{
if
(
createReqVO
.
getPriceType
()
==
1
)
{
price
.
setFullPricePackagingList
(
respVO
.
getFullPricePackagingList
());
if
(
CollectionUtil
.
isNotEmpty
(
respVO
.
getFullPriceStepList
()))
{
if
(
CollectionUtil
.
isNotEmpty
(
respVO
.
getFullPriceStepList
()))
{
// respVO.getFullPriceStepList().forEach(pack -> {
// ProductPriceStepDO priceStepDO = new ProductPriceStepDO();
// BeanUtils.copyProperties(pack, priceStepDO);
// priceStepDO.setId(null);
// priceStepDO.setStartNum(BigDecimal.valueOf(0));
// priceStepDO.setEndNum(BigDecimal.valueOf(0));
// priceStepDO.setWeightUnit(price.getTransportPriceUnit());
// priceStepDO.setAllPrice(respVO.getAllPrice());
// priceStepDO.setAllPriceUnit(respVO.getAllPriceUnit());
// priceStepDO.setAllVolumeUnit(respVO.getAllVolumeUnit());
// if (CollectionUtil.isNotEmpty(respVO.getSpecialList())) {
// List<ProductPriceStepSpecialDO> specialList = new ArrayList<>();
// respVO.getSpecialList().forEach(sp -> {
// ProductPriceStepSpecialDO specialDO = new ProductPriceStepSpecialDO();
// BeanUtils.copyProperties(sp, specialDO);
// specialDO.setId(null);
// specialList.add(specialDO);
// });
// priceStepDO.setSpecialList(specialList);
// }
// fullPriceStepList.add(priceStepDO);
// });
createReqVO
.
setFullPriceStepList
(
respVO
.
getFullPriceStepList
());
createReqVO
.
setFullPriceStepList
(
respVO
.
getFullPriceStepList
());
}
}
}
else
{
}
else
{
// if (CollectionUtil.isEmpty(respVO.getFreightPriceStepList())) {
price
.
setFreightPricePackagingList
(
respVO
.
getFullPricePackagingList
());
// BeanUtils.copyProperties(price, freightPriceStep);
price
.
setClearancePricePackagingList
(
respVO
.
getFullPricePackagingList
());
// freightPriceStep.setStartNum(BigDecimal.valueOf(0));
// freightPriceStep.setEndNum(BigDecimal.valueOf(0));
// 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);
// }
// if (respVO.getPriceType() == 1) {
// if (CollectionUtil.isNotEmpty(respVO.getFullPricePackagingList())) {
// List<ProductPriceStepPackagingDO> specialDOList = new ArrayList<>();
// respVO.getFullPricePackagingList().forEach(pack -> {
// ProductPriceStepPackagingDO packagingDO = new ProductPriceStepPackagingDO();
// BeanUtils.copyProperties(pack, packagingDO);
// packagingDO.setId(null);
//
// specialDOList.add(packagingDO);
// });
//
// freightPriceStep.setPackagingList(specialDOList);
//
// }
// } else {
//
// }
// freightPriceStepList.add(freightPriceStep);
//
// createReqVO.setFreightPriceStepList(freightPriceStepList);
// } else {
// createReqVO.setFreightPriceStepList(respVO.getFreightPriceStepList());
// }
if
(
CollectionUtil
.
isNotEmpty
(
respVO
.
getFreightPriceStepList
()))
{
if
(
CollectionUtil
.
isNotEmpty
(
respVO
.
getFreightPriceStepList
()))
{
createReqVO
.
setFreightPriceStepList
(
respVO
.
getFreightPriceStepList
());
createReqVO
.
setFreightPriceStepList
(
respVO
.
getFreightPriceStepList
());
}
}
// if (CollectionUtil.isEmpty(respVO.getClearancePriceStepList())) {
// BeanUtils.copyProperties(price, clear);
// clear.setStartNum(BigDecimal.valueOf(0));
// clear.setEndNum(BigDecimal.valueOf(0));
// 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 {
// createReqVO.setClearancePriceStepList(respVO.getClearancePriceStepList());
// }
if
(
CollectionUtil
.
isNotEmpty
(
respVO
.
getClearancePriceStepList
()))
{
if
(
CollectionUtil
.
isNotEmpty
(
respVO
.
getClearancePriceStepList
()))
{
createReqVO
.
setClearancePriceStepList
(
respVO
.
getClearancePriceStepList
());
createReqVO
.
setClearancePriceStepList
(
respVO
.
getClearancePriceStepList
());
}
}
}
}
// if(CollectionUtil.isNotEmpty(respVO.getFullPricePackagingList())){
//
// respVO.getFullPricePackagingList().forEach(pack->{
// ProductPriceStepDO packagingDO = new ProductPriceStepDO() ;
// BeanUtils.copyProperties(pack,packagingDO);
// packagingDO.setId(null);
//
// packagingDO.setTransportPrice(pack.getPackagingPrice());
// packagingDO.setTransportPriceUnit(pack.getPackagingPriceUnit());
//
// fullPriceStepList.add(packagingDO) ;
// });
//
// createReqVO.setFullPriceStepList(fullPriceStepList);
// }
//ProductDO productDO = checkUpdateStatus(lineChannelList, createReqVO.getProductId());
//ProductDO productDO = checkUpdateStatus(lineChannelList, createReqVO.getProductId());
ProductDO
productDO
=
productService
.
getProduct
(
createReqVO
.
getProductId
());
ProductDO
productDO
=
productService
.
getProduct
(
createReqVO
.
getProductId
());
WarehouseLineSearchVO
searchVO
=
new
WarehouseLineSearchVO
();
WarehouseLineSearchVO
searchVO
=
new
WarehouseLineSearchVO
();
...
@@ -3608,8 +3502,9 @@ public class ProductPriceServiceImpl extends AbstractService<ProductPriceMapper,
...
@@ -3608,8 +3502,9 @@ public class ProductPriceServiceImpl extends AbstractService<ProductPriceMapper,
createReqVO
.
setSync
(
true
);
createReqVO
.
setSync
(
true
);
createReqVO
.
setBatch
(
false
);
createReqVO
.
setBatch
(
false
);
copyPriceUpdateAir
(
createReqVO
,
copyPriceUpdateAir
(
createReqVO
,
vo
,
warehouseLineList
,
warehouseLineList
,
product
List
,
product
DO
,
price
);
price
);
}
}
}
}
...
@@ -3622,239 +3517,493 @@ public class ProductPriceServiceImpl extends AbstractService<ProductPriceMapper,
...
@@ -3622,239 +3517,493 @@ public class ProductPriceServiceImpl extends AbstractService<ProductPriceMapper,
*
*
* @param createReqVO
* @param createReqVO
* @param warehouseLineList
* @param warehouseLineList
* @param product
List
* @param product
DO
* @param productPrice
* @param productPrice
*/
*/
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
copyPriceUpdateAir
(
ProductPriceAirCreateReqVO
createReqVO
,
Li
st
<
WarehouseLineDO
>
warehouseLineList
,
List
<
ProductDO
>
productList
,
ProductPriceDO
productPrice
)
{
public
void
copyPriceUpdateAir
(
ProductPriceAirCreateReqVO
createReqVO
,
Li
neChannelVo
vo
,
List
<
WarehouseLineDO
>
warehouseLineList
,
ProductDO
productDO
,
ProductPriceDO
productPrice
)
{
long
t1
=
System
.
currentTimeMillis
();
long
t1
=
System
.
currentTimeMillis
();
Long
loginUserId
=
SecurityFrameworkUtils
.
getLoginUserId
();
Long
loginUserId
=
SecurityFrameworkUtils
.
getLoginUserId
();
checkAndUpdateStepToMainPrice
(
productPrice
,
createReqVO
);
checkAndUpdateStepToMainPrice
(
productPrice
,
createReqVO
);
List
<
LineChannelVo
>
lineChannelList
=
createReqVO
.
getLineChannelList
();
Set
<
Long
>
lineIdList
=
lineChannelList
.
stream
()
.
map
(
LineChannelVo:
:
getLineId
)
.
collect
(
Collectors
.
toSet
());
Map
<
Long
,
String
>
lineTransportTypeMap
=
warehouseLineList
.
stream
()
Map
<
Long
,
String
>
lineTransportTypeMap
=
warehouseLineList
.
stream
()
.
collect
(
Collectors
.
toMap
(
WarehouseLineDO:
:
getId
,
WarehouseLineDO:
:
getTransportType
));
.
collect
(
Collectors
.
toMap
(
WarehouseLineDO:
:
getId
,
WarehouseLineDO:
:
getTransportType
));
List
<
Long
>
idList
=
productList
.
stream
()
.
map
(
ProductDO:
:
getId
)
.
collect
(
toList
());
//这个产品这么多线路已有的价格
//这个产品这么多线路已有的价格
List
<
ProductPriceDO
>
dbPriceList
=
productPriceMapper
.
selectList
(
new
LambdaQueryWrapperX
<
ProductPriceDO
>()
List
<
ProductPriceDO
>
dbPriceList
=
productPriceMapper
.
selectList
(
new
LambdaQueryWrapperX
<
ProductPriceDO
>()
.
in
(
ProductPriceDO:
:
getWarehouseLineId
,
lineIdList
)
.
eq
(
ProductPriceDO:
:
getWarehouseLineId
,
vo
.
getLineId
()
)
.
in
(
ProductPriceDO:
:
getProductId
,
idList
));
.
eq
(
ProductPriceDO:
:
getProductId
,
productDO
.
getId
()
));
Map
<
String
,
ProductPriceDO
>
productLineChannelMap
=
dbPriceList
.
stream
()
Map
<
String
,
ProductPriceDO
>
productLineChannelMap
=
dbPriceList
.
stream
()
.
collect
(
Collectors
.
toMap
(
t
->
t
.
getProductId
()
+
"-"
+
t
.
getWarehouseLineId
()
+
"-"
+
t
.
getShippingChannelId
(),
v
->
v
,
(
v1
,
v2
)
->
v2
));
.
collect
(
Collectors
.
toMap
(
t
->
t
.
getProductId
()
+
"-"
+
t
.
getWarehouseLineId
()
+
"-"
+
t
.
getShippingChannelId
(),
v
->
v
,
(
v1
,
v2
)
->
v2
));
List
<
ProductPriceDO
>
insertList
=
new
ArrayList
<>();
List
<
ProductPriceDO
>
updateList
=
new
ArrayList
<>();
List
<
ProductPriceDO
>
snapshotList
=
new
ArrayList
<>();
List
<
ProductPriceDO
>
snapshotList
=
new
ArrayList
<>();
Date
current
=
new
Date
();
Date
current
=
new
Date
();
for
(
Long
productId
:
idList
)
{
Long
lineId
=
vo
.
getLineId
();
for
(
LineChannelVo
lineChannel
:
lineChannelList
)
{
Long
shippingChannelId
=
vo
.
getShippingChannelId
();
Long
lineId
=
lineChannel
.
getLineId
();
String
key
=
productDO
.
getId
()
+
"-"
+
lineId
+
"-"
+
shippingChannelId
;
Long
shippingChannelId
=
lineChannel
.
getShippingChannelId
();
String
key
=
productId
+
"-"
+
lineId
+
"-"
+
shippingChannelId
;
ProductPriceDO
dbItem
;
if
(
productLineChannelMap
.
containsKey
(
key
))
{
ProductPriceDO
dbItem
;
dbItem
=
productLineChannelMap
.
get
(
key
);
if
(
productLineChannelMap
.
containsKey
(
key
))
{
dbItem
=
productLineChannelMap
.
get
(
key
);
//添加日志
ProductPriceDO
snapshot
=
ObjectUtil
.
clone
(
dbItem
);
//添加日志
snapshotList
.
add
(
snapshot
);
ProductPriceDO
snapshot
=
ObjectUtil
.
clone
(
dbItem
);
dbItem
.
setUpdater
(
String
.
valueOf
(
loginUserId
));
snapshotList
.
add
(
snapshot
);
updateColumn
(
dbItem
,
productPrice
);
dbItem
.
setUpdater
(
String
.
valueOf
(
loginUserId
));
productPriceMapper
.
updateById
(
dbItem
);
updateColumn
(
dbItem
,
productPrice
);
}
else
{
updateList
.
add
(
dbItem
);
dbItem
=
ObjectUtil
.
clone
(
productPrice
);
}
else
{
dbItem
.
setProductId
(
productDO
.
getId
());
dbItem
=
ObjectUtil
.
clone
(
productPrice
);
dbItem
.
setWarehouseLineId
(
lineId
);
dbItem
.
setProductId
(
productId
);
dbItem
.
setShippingChannelId
(
shippingChannelId
);
dbItem
.
setWarehouseLineId
(
lineId
);
dbItem
.
setShippingChannelId
(
shippingChannelId
);
if
(
dbItem
.
getNeedBook
()
==
null
)
{
if
(
dbItem
.
getNeedBook
()
==
null
)
{
dbItem
.
setNeedBook
(
0
);
dbItem
.
setNeedBook
(
0
);
}
if
(
dbItem
.
getPriceType
()
==
null
)
{
dbItem
.
setPriceType
(
0
);
}
if
(
dbItem
.
getNeedPay
()
==
null
)
{
dbItem
.
setNeedPay
(
0
);
}
if
(
dbItem
.
getAuditStatus
()
==
null
)
{
dbItem
.
setAuditStatus
(
0
);
}
if
(
dbItem
.
getPayDelivery
()
==
null
)
{
dbItem
.
setPayDelivery
(
0
);
}
if
(
dbItem
.
getStepPrice
()
==
null
)
{
dbItem
.
setStepPrice
(
0
);
}
if
(
dbItem
.
getMinWeight
()
==
null
)
{
dbItem
.
setMinWeight
(
BigDecimal
.
ZERO
);
}
if
(
dbItem
.
getMinWeightUnit
()
==
null
)
{
dbItem
.
setMinWeightUnit
(
7L
);
}
dbItem
.
setBlacklist
(
0
);
dbItem
.
setStatus
(
0
);
dbItem
.
setCreateTime
(
current
);
insertList
.
add
(
dbItem
);
}
dbItem
.
setUpdateTime
(
current
);
String
transportType
=
lineTransportTypeMap
.
get
(
lineId
);
initBasePrice
(
dbItem
,
transportType
);
}
}
if
(
dbItem
.
getPriceType
()
==
null
)
{
dbItem
.
setPriceType
(
0
);
}
if
(
dbItem
.
getNeedPay
()
==
null
)
{
dbItem
.
setNeedPay
(
0
);
}
if
(
dbItem
.
getAuditStatus
()
==
null
)
{
dbItem
.
setAuditStatus
(
0
);
}
if
(
dbItem
.
getPayDelivery
()
==
null
)
{
dbItem
.
setPayDelivery
(
0
);
}
if
(
dbItem
.
getStepPrice
()
==
null
)
{
dbItem
.
setStepPrice
(
0
);
}
if
(
dbItem
.
getMinWeight
()
==
null
)
{
dbItem
.
setMinWeight
(
BigDecimal
.
ZERO
);
}
if
(
dbItem
.
getMinWeightUnit
()
==
null
)
{
dbItem
.
setMinWeightUnit
(
7L
);
}
dbItem
.
setBlacklist
(
0
);
dbItem
.
setStatus
(
0
);
dbItem
.
setCreateTime
(
current
);
productPriceMapper
.
insert
(
dbItem
);
}
}
if
(
CollectionUtil
.
isNotEmpty
(
insertList
))
{
dbItem
.
setUpdateTime
(
current
);
productPriceMapper
.
insertBatchSomeColumn
(
insertList
);
String
transportType
=
lineTransportTypeMap
.
get
(
lineId
);
}
initBasePrice
(
dbItem
,
transportType
);
if
(
CollectionUtil
.
isNotEmpty
(
updateList
))
{
productPriceMapper
.
updateBatch
(
updateList
);
}
List
<
ProductPriceDO
>
productPriceList
=
new
ArrayList
<>();
productPriceList
.
addAll
(
insertList
);
productPriceList
.
addAll
(
updateList
);
Map
<
Long
,
String
>
priceTransportTypeMap
=
new
HashMap
<>();
productPriceList
.
forEach
(
t
->
priceTransportTypeMap
.
put
(
t
.
getId
(),
lineTransportTypeMap
.
get
(
t
.
getWarehouseLineId
())));
//添加修改日志,需要查询特需和阶梯,所以需要在修改之前执行
//添加修改日志,需要查询特需和阶梯,所以需要在修改之前执行
batchAddSnapshot
(
snapshotList
);
batchAddSnapshot
(
snapshotList
);
List
<
Long
>
productPriceIdList
=
productPriceList
.
stream
().
map
(
ProductPriceDO:
:
getId
).
collect
(
Collectors
.
toList
());
dbItem
.
setSpecialDOList
(
productPrice
.
getSpecialDOList
());
if
(
productPrice
.
getPriceType
()
==
1
)
{
dbItem
.
setFullPricePackagingList
(
productPrice
.
getFullPricePackagingList
());
}
else
{
dbItem
.
setFreightPricePackagingList
(
productPrice
.
getFullPricePackagingList
());
dbItem
.
setClearancePricePackagingList
(
productPrice
.
getFullPricePackagingList
());
}
List
<
ProductPriceStepDO
>
allStepList
=
buildCopyAllStepList
(
createReqVO
);
List
<
ProductPriceStepDO
>
allStepList
=
buildCopyAllStepList
(
createReqVO
);
copyClearAndSavePriceStepList
(
productPriceIdList
,
allStepList
,
priceTransportTypeMap
,
createReqVO
.
isBatch
());
copyClearAndSavePriceStepList
(
dbItem
,
allStepList
,
lineTransportTypeMap
.
get
(
dbItem
.
getWarehouseLineId
())
,
createReqVO
.
isBatch
());
long
t2
=
System
.
currentTimeMillis
();
long
t2
=
System
.
currentTimeMillis
();
log
.
info
(
"路线处理耗时:"
+
(
t2
-
t1
));
log
.
info
(
"路线处理耗时:"
+
(
t2
-
t1
));
deleteKey
(
idList
,
lineChannelList
);
deleteKey
(
Collections
.
singletonList
(
productDO
.
getId
()),
Collections
.
singletonList
(
vo
)
);
handleOrderException
(
productPriceIdList
,
handleOrderException
(
Collections
.
singletonList
(
dbItem
.
getId
())
,
createReqVO
.
isSync
());
createReqVO
.
isSync
());
}
}
private
void
copyClearAndSavePriceStepList
(
List
<
Long
>
productPriceIdList
,
List
<
ProductPriceStepDO
>
stepList
,
Map
<
Long
,
String
>
priceTransportTypeMap
,
boolean
batchUpdate
)
{
private
void
copyClearAndSavePriceStepList
(
ProductPriceDO
productPriceDO
,
List
<
ProductPriceStepDO
>
stepList
,
String
transportType
,
boolean
batchUpdate
)
{
if
(
stepList
==
null
)
stepList
=
new
ArrayList
<>();
if
(
productPriceDO
.
getStepPrice
()
==
1
)
{
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
;
stepList
=
stepList
.
stream
()
.
filter
(
t
->
t
.
getStartNum
()
!=
null
&&
t
.
getWeightUnit
()
!=
null
&&
t
.
getEndNum
()
!=
null
)
.
collect
(
Collectors
.
toList
());
}
if
(
productPriceDO
.
getStepPrice
()
==
1
&&
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
>
insertList1
=
new
ArrayList
<>();
List
<
ProductPriceStepDO
>
updateList
=
new
ArrayList
<>();
List
<
ProductPriceStepDO
>
updateList
=
new
ArrayList
<>();
List
<
ProductPricePackagingDO
>
productPricePackagingDOS
=
new
ArrayList
<>();
List
<
ProductPricePackagingDO
>
productPricePackagingDOS
=
new
ArrayList
<>();
for
(
Long
productPriceId
:
productPriceIdList
)
{
List
<
ProductPriceSpecialDO
>
priceSpecialUpdate
=
new
ArrayList
<>();
String
transportType
=
priceTransportTypeMap
.
get
(
productPriceId
);
if
(
productPriceDO
.
getStepPrice
()
==
1
)
{
List
<
ProductPriceStepDO
>
dbPriceStepList
=
dbStepMap
.
get
(
productPriceId
);
Collection
<
Integer
>
priceTypes
=
stepList
.
stream
()
if
(
CollectionUtil
.
isEmpty
(
dbPriceStepList
))
{
.
map
(
ProductPriceStepDO:
:
getPriceType
)
for
(
ProductPriceStepDO
stepItem
:
stepList
)
{
.
collect
(
Collectors
.
toSet
());
priceTypes
.
add
(
PriceTypeEnum
.
FULL_PRICE
.
getPriceType
());
List
<
ProductPriceStepDO
>
dbStepList
=
productPriceStepMapper
.
selectList
(
new
LambdaQueryWrapper
<
ProductPriceStepDO
>()
.
eq
(
ProductPriceStepDO:
:
getProductPriceId
,
productPriceDO
.
getId
())
.
in
(
ProductPriceStepDO:
:
getPriceType
,
priceTypes
)
);
Map
<
Long
,
List
<
ProductPriceStepDO
>>
dbStepMap
=
dbStepList
.
stream
()
.
collect
(
Collectors
.
groupingBy
(
ProductPriceStepDO:
:
getProductPriceId
));
copyStepPrice
(
stepList
,
transportType
,
productPriceDO
,
dbStepMap
,
insertList1
,
productPricePackagingDOS
,
updateList
);
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
<>();
for
(
ProductPriceStepDO
stepDO
:
insertList1
)
{
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
);
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
());
}
specialUpdateList
.
add
(
dbStepSpecialDO
);
}
}
}
}
if
(
CollectionUtil
.
isNotEmpty
(
specialInsertList
))
{
productPriceStepSpecialMapper
.
insertBatchSomeColumn
(
specialInsertList
);
}
if
(
CollectionUtil
.
isNotEmpty
(
specialUpdateList
))
{
productPriceStepSpecialMapper
.
updateBatch
(
specialUpdateList
);
}
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
));
}
}
}
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
)
{
List
<
ProductPriceStepDO
>
dbPriceStepList
=
dbStepMap
.
get
(
productPriceDO
.
getId
());
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
(
productPriceDO
.
getId
());
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
if
(
stepItem
.
getTransportPrice
()
==
null
&&
stepItem
.
getClearancePrice
()
==
null
&&
stepItem
.
getAllPrice
()
==
null
)
continue
;
&&
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
);
ProductPriceStepDO
dbItem
=
ObjectUtil
.
clone
(
stepItem
);
dbItem
.
setId
(
null
);
dbItem
.
setId
(
null
);
dbItem
.
setProductPriceId
(
productPrice
Id
);
dbItem
.
setProductPriceId
(
productPrice
DO
.
getId
()
);
initBasePrice
(
dbItem
,
transportType
);
initBasePrice
(
dbItem
,
transportType
);
insertList1
.
add
(
dbItem
);
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(stepItem.getPriceType()==1){
// if(stepItem.getPriceType()==1){
//
//
// ProductPricePackagingDO pricePackagingDO = new ProductPricePackagingDO() ;
// ProductPricePackagingDO pricePackagingDO = new ProductPricePackagingDO() ;
...
@@ -3876,276 +4025,19 @@ public class ProductPriceServiceImpl extends AbstractService<ProductPriceMapper,
...
@@ -3876,276 +4025,19 @@ public class ProductPriceServiceImpl extends AbstractService<ProductPriceMapper,
// });
// });
// }
// }
// }
// }
if
(
CollectionUtil
.
isNotEmpty
(
stepItem
.
getPackagingList
()))
{
if
(
CollectionUtil
.
isNotEmpty
(
stepItem
.
getPackagingList
()))
{
stepItem
.
getPackagingList
().
forEach
(
pg
->
{
stepItem
.
getPackagingList
().
forEach
(
pg
->
{
ProductPricePackagingDO
pricePackagingDO
=
new
ProductPricePackagingDO
();
ProductPricePackagingDO
pricePackagingDO
=
new
ProductPricePackagingDO
();
BeanUtils
.
copyProperties
(
pg
,
pricePackagingDO
);
BeanUtils
.
copyProperties
(
pg
,
pricePackagingDO
);
pricePackagingDO
.
setId
(
null
);
pricePackagingDO
.
setId
(
null
);
pricePackagingDO
.
setProductPriceId
(
productPriceId
);
pricePackagingDO
.
setProductPriceId
(
productPriceDO
.
getId
());
pricePackagingDO
.
setPriceType
(
stepItem
.
getPriceType
());
pricePackagingDO
.
setPriceType
(
stepItem
.
getPriceType
());
productPricePackagingDOS
.
add
(
pricePackagingDO
);
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
));
}
}
}
}
/**
/**
...
...
yudao-module-product/yudao-module-product-core/src/main/java/cn/iocoder/yudao/module/product/vo/productPrice/ProductPriceReqBaseVO.java
View file @
416d4f6d
package
cn
.
iocoder
.
yudao
.
module
.
product
.
vo
.
productPrice
;
package
cn
.
iocoder
.
yudao
.
module
.
product
.
vo
.
productPrice
;
import
cn.iocoder.yudao.module.product.dal.dataobject.product.ProductPricePackagingDO
;
import
cn.iocoder.yudao.module.product.dal.dataobject.product.ProductPriceSpecialDO
;
import
cn.iocoder.yudao.module.product.dal.dataobject.product.ProductPriceStepDO
;
import
cn.iocoder.yudao.module.product.dal.dataobject.product.ProductPriceStepDO
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.Data
;
...
...
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