记得上下班打卡 | git大法好,push需谨慎
Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
liquidnet-bus-v1
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
董敬伟
liquidnet-bus-v1
Commits
13778009
Commit
13778009
authored
Mar 15, 2022
by
胡佳晨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交 店铺券 指定商品逻辑
parent
be04c7de
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
56 additions
and
27 deletions
+56
-27
GoblinUseResultVo.java
...om/liquidnet/service/goblin/dto/vo/GoblinUseResultVo.java
+3
-0
GoblinOrderPreParam.java
...m/liquidnet/service/goblin/param/GoblinOrderPreParam.java
+3
-0
GoblinCouponImpl.java
...quidnet/service/goblin/service/impl/GoblinCouponImpl.java
+1
-1
GoblinOrderServiceImpl.java
...et/service/order/service/impl/GoblinOrderServiceImpl.java
+33
-21
GoblinOrderUtils.java
...a/com/liquidnet/service/order/utils/GoblinOrderUtils.java
+16
-5
No files found.
liquidnet-bus-api/liquidnet-service-goblin-api/src/main/java/com/liquidnet/service/goblin/dto/vo/GoblinUseResultVo.java
View file @
13778009
...
...
@@ -6,6 +6,7 @@ import lombok.Data;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
import
java.util.List
;
@Data
@ApiModel
...
...
@@ -16,6 +17,8 @@ public class GoblinUseResultVo implements Serializable, Cloneable {
private
BigDecimal
value
;
@ApiModelProperty
(
value
=
"券类型[1-代金券|2-折扣券|3-满减券]"
,
example
=
"1"
)
private
String
couType
;
@ApiModelProperty
(
value
=
"适用spu范围"
)
private
List
<
String
>
spuIds
;
private
static
final
GoblinUseResultVo
obj
=
new
GoblinUseResultVo
();
...
...
liquidnet-bus-api/liquidnet-service-goblin-api/src/main/java/com/liquidnet/service/goblin/param/GoblinOrderPreParam.java
View file @
13778009
...
...
@@ -43,6 +43,9 @@ public class GoblinOrderPreParam implements Cloneable{
private
GoblinStoreOrder
storeOrder
;
private
GoblinOrderAttr
orderAttr
;
private
List
<
GoblinOrderSku
>
orderSkuList
;
private
List
<
String
>
storeSpuIds
;
private
List
<
String
>
platformSpuIds
;
private
static
final
GoblinOrderPreParam
obj
=
new
GoblinOrderPreParam
();
...
...
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/main/java/com/liquidnet/service/goblin/service/impl/GoblinCouponImpl.java
View file @
13778009
...
...
@@ -247,7 +247,7 @@ public class GoblinCouponImpl implements GoblinCouponService {
returnList
.
add
(
vo
);
}
else
{
List
<
String
>
spuIds
=
goblinRedisUtils
.
getStoreCouponSpuIds
(
vo
.
getStoreCouponId
());
if
(
spuIds
==
null
)
{
if
(
spuIds
==
null
||
spuIds
.
size
()
==
0
)
{
break
;
}
//判断是否在可用商品内
...
...
liquidnet-bus-service/liquidnet-service-order/liquidnet-service-order-impl/src/main/java/com/liquidnet/service/order/service/impl/GoblinOrderServiceImpl.java
View file @
13778009
...
...
@@ -116,6 +116,8 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
preParam
.
setStoreName
(
preParam
.
getStoreName
()
+
","
+
pre
.
getStoreName
());
preParam
.
setSkuName
(
preParam
.
getSkuName
()
+
","
+
pre
.
getSkuName
());
preParam
.
setOrderIdList
(
preParam
.
getOrderIdList
()
+
","
+
pre
.
getOrderIdList
());
preParam
.
setPlatformSpuIds
(
pre
.
getPlatformSpuIds
());
preParam
.
setStoreSpuIds
(
pre
.
getStoreSpuIds
());
GoblinOrderSqlParam
sqlParam
=
GoblinOrderSqlParam
.
getNew
();
sqlParam
.
setStoreOrder
(
pre
.
getStoreOrder
());
...
...
@@ -203,6 +205,8 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
BigDecimal
storeTotalPrice
=
BigDecimal
.
ZERO
;
//订单总金额
String
writeOffCode
=
""
;
//取货码
List
<
GoblinOrderSku
>
goblinOrderSkuList
=
ObjectUtil
.
getGoblinOrderSkuArrayList
();
List
<
String
>
storeSpuIds
=
CollectionUtil
.
linkedListString
();
List
<
String
>
platformSpuIds
=
CollectionUtil
.
linkedListString
();
String
marketId
=
""
;
String
marketType
=
""
;
for
(
GoblinOrderSkuParam
skuParam
:
storeParam
.
getGoblinOrderSkuParamArrayList
())
{
...
...
@@ -302,7 +306,7 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
spuIds
=
spuIds
.
concat
(
item
.
getSpuId
()
+
","
);
}
}
HashMap
<
String
,
Object
>
hashMap
=
orderUtils
.
useCoupon
(
platVoucherCode
,
"购买商品["
+
orderCode
+
"]"
,
storeTotalPrice
,
spuIds
,
uid
,
goblinOrderSkuList
);
HashMap
<
String
,
Object
>
hashMap
=
orderUtils
.
useCoupon
(
platVoucherCode
,
"购买商品["
+
orderCode
+
"]"
,
storeTotalPrice
,
spuIds
,
uid
,
goblinOrderSkuList
);
if
(
hashMap
!=
null
)
{
voucherPrice
=
(
BigDecimal
)
hashMap
.
get
(
"voucher"
);
Integer
typeVoucher
=
(
Integer
)
hashMap
.
get
(
"type"
);
...
...
@@ -310,6 +314,7 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
throw
new
Exception
(
"平台券不可用"
);
}
else
{
platformCodeList
.
add
(
platVoucherCode
);
platformSpuIds
=
(
List
<
String
>)
hashMap
.
get
(
"spuIds"
);
}
}
}
...
...
@@ -325,6 +330,7 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
throw
new
Exception
(
"店铺券不可用"
);
}
else
{
storeCodeList
.
add
(
storeVoucherCode
);
storeSpuIds
=
storeCouponVo
.
getSpuIds
();
}
}
}
...
...
@@ -395,6 +401,8 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
preParam
.
setStoreOrder
(
storeOrder
);
preParam
.
setOrderAttr
(
orderAttr
);
preParam
.
setOrderSkuList
(
goblinOrderSkuList
);
preParam
.
setStoreSpuIds
(
storeSpuIds
);
preParam
.
setPlatformSpuIds
(
platformSpuIds
);
return
preParam
;
}
...
...
@@ -454,16 +462,6 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
payCode
=
payInnerResultVo
.
getCode
();
payInnerResultVo
.
setShowUrl
(
preParam
.
getShowUrl
());
payInnerResultVo
.
setReturnUrl
(
preParam
.
getReturnUrl
());
// payInnerResultVo = GoblinPayInnerResultVo.getNew();
// payInnerResultVo.setCode("压测 code");
// payInnerResultVo.setOrderCode(preParam.getOrderMasterCode());
// payInnerResultVo.setPayData(null);
// payInnerResultVo.setPayType(preParam.getPayType());
// payInnerResultVo.setPrice(preParam.getPriceActual());
// payCode = payInnerResultVo.getCode();
// payInnerResultVo.setShowUrl(preParam.getShowUrl());
// payInnerResultVo.setReturnUrl(preParam.getReturnUrl());
}
else
if
(
preParam
.
getPayType
()
==
null
)
{
isFree
=
true
;
preParam
.
setPayType
(
"FREE"
);
...
...
@@ -503,17 +501,31 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
for
(
int
i
=
0
;
i
<
item
.
getOrderSkuList
().
size
();
i
++)
{
GoblinOrderSku
orderSku
=
item
.
getOrderSkuList
().
get
(
i
);
if
(
item
.
getStoreOrder
().
getPriceVoucher
().
compareTo
(
BigDecimal
.
ZERO
)
>
0
)
{
restVoucherPrice
=
restVoucherPrice
.
subtract
(
orderSku
.
getSkuPrice
());
if
(
restVoucherPrice
.
compareTo
(
BigDecimal
.
ZERO
)
>
0
)
{
orderSku
.
setPriceVoucher
(
orderSku
.
getSkuPrice
());
BigDecimal
skuPriceActual
=
orderSku
.
getSkuPrice
().
subtract
(
orderSku
.
getSkuPrice
());
orderSku
.
setSkuPriceActual
(
skuPriceActual
.
compareTo
(
BigDecimal
.
ZERO
)
>
0
?
skuPriceActual
:
BigDecimal
.
ZERO
);
}
else
{
orderSku
.
setPriceVoucher
(
restVoucherPrice
.
add
(
orderSku
.
getSkuPrice
()));
BigDecimal
skuPriceActual
=
orderSku
.
getSkuPrice
().
subtract
(
orderSku
.
getPriceVoucher
());
orderSku
.
setSkuPriceActual
(
skuPriceActual
.
compareTo
(
BigDecimal
.
ZERO
)
>
0
?
skuPriceActual
:
BigDecimal
.
ZERO
);
if
(
preParam
.
getStoreSpuIds
().
size
()
>
0
||
preParam
.
getPlatformSpuIds
().
size
()
>
0
)
{
//指定范围商品券
if
(
preParam
.
getStoreSpuIds
().
contains
(
orderSku
.
getSpuId
())
||
preParam
.
getPlatformSpuIds
().
contains
(
orderSku
.
getSpuId
()))
{
restVoucherPrice
=
restVoucherPrice
.
subtract
(
orderSku
.
getSkuPrice
());
if
(
restVoucherPrice
.
compareTo
(
BigDecimal
.
ZERO
)
>
0
)
{
orderSku
.
setPriceVoucher
(
orderSku
.
getSkuPrice
());
BigDecimal
skuPriceActual
=
orderSku
.
getSkuPrice
().
subtract
(
orderSku
.
getSkuPrice
());
orderSku
.
setSkuPriceActual
(
skuPriceActual
.
compareTo
(
BigDecimal
.
ZERO
)
>
0
?
skuPriceActual
:
BigDecimal
.
ZERO
);
}
else
{
orderSku
.
setPriceVoucher
(
restVoucherPrice
.
add
(
orderSku
.
getSkuPrice
()));
BigDecimal
skuPriceActual
=
orderSku
.
getSkuPrice
().
subtract
(
orderSku
.
getPriceVoucher
());
orderSku
.
setSkuPriceActual
(
skuPriceActual
.
compareTo
(
BigDecimal
.
ZERO
)
>
0
?
skuPriceActual
:
BigDecimal
.
ZERO
);
}
}
}
else
{
//全部商品券
restVoucherPrice
=
restVoucherPrice
.
subtract
(
orderSku
.
getSkuPrice
());
if
(
restVoucherPrice
.
compareTo
(
BigDecimal
.
ZERO
)
>
0
)
{
orderSku
.
setPriceVoucher
(
orderSku
.
getSkuPrice
());
BigDecimal
skuPriceActual
=
orderSku
.
getSkuPrice
().
subtract
(
orderSku
.
getSkuPrice
());
orderSku
.
setSkuPriceActual
(
skuPriceActual
.
compareTo
(
BigDecimal
.
ZERO
)
>
0
?
skuPriceActual
:
BigDecimal
.
ZERO
);
}
else
{
orderSku
.
setPriceVoucher
(
restVoucherPrice
.
add
(
orderSku
.
getSkuPrice
()));
BigDecimal
skuPriceActual
=
orderSku
.
getSkuPrice
().
subtract
(
orderSku
.
getPriceVoucher
());
orderSku
.
setSkuPriceActual
(
skuPriceActual
.
compareTo
(
BigDecimal
.
ZERO
)
>
0
?
skuPriceActual
:
BigDecimal
.
ZERO
);
}
}
}
sqlDataSku
.
add
(
new
Object
[]{
orderSku
.
getOrderSkuId
(),
orderSku
.
getOrderId
(),
orderSku
.
getSpuId
(),
orderSku
.
getSpuName
(),
orderSku
.
getSpuPic
(),
orderSku
.
getSkuId
(),
orderSku
.
getNum
(),
orderSku
.
getSkuPrice
(),
orderSku
.
getSkuPriceActual
(),
orderSku
.
getSkuName
(),
...
...
liquidnet-bus-service/liquidnet-service-order/liquidnet-service-order-impl/src/main/java/com/liquidnet/service/order/utils/GoblinOrderUtils.java
View file @
13778009
...
...
@@ -159,6 +159,7 @@ public class GoblinOrderUtils {
voucher
=
BigDecimal
.
ZERO
;
break
;
}
hashMap
.
put
(
"spuIds"
,
targetList
);
hashMap
.
put
(
"type"
,
type
);
hashMap
.
put
(
"voucher"
,
voucher
.
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
));
return
hashMap
;
...
...
@@ -223,6 +224,7 @@ public class GoblinOrderUtils {
returnVo
.
setValue
(
BigDecimal
.
ZERO
);
returnVo
.
setCouType
(
"-1"
);
LocalDateTime
now
=
LocalDateTime
.
now
();
List
<
String
>
spuIds
=
CollectionUtil
.
linkedListString
();
for
(
GoblinUserCouponVo
vo
:
voList
)
{
if
(
vo
.
getUcouponId
().
equals
(
ucouponId
)
&&
vo
.
getDuedAt
().
isAfter
(
now
))
{
//判断券状态 和 触发金额
...
...
@@ -249,8 +251,8 @@ public class GoblinOrderUtils {
SqlMapping
.
get
(
"goblin_user_coupon.updateState"
,
vo
.
getState
(),
vo
.
getUsedFor
(),
LocalDateTime
.
now
(),
vo
.
getUcouponId
()));
break
;
}
else
{
List
<
String
>
spuIds
=
redisUtils
.
getStoreCouponSpuIds
(
vo
.
getStoreCouponId
());
if
(
spuIds
==
null
)
{
spuIds
=
redisUtils
.
getStoreCouponSpuIds
(
vo
.
getStoreCouponId
());
if
(
spuIds
==
null
||
spuIds
.
size
()
==
0
)
{
break
;
}
//判断是否在可用商品内
...
...
@@ -264,7 +266,11 @@ public class GoblinOrderUtils {
}
if
(
vo
.
getTriggers
().
compareTo
(
contentPrice
)
<=
0
)
{
if
(
vo
.
getType
().
equals
(
"1"
))
{
//代金券
returnVo
.
setValue
(
vo
.
getValFace
());
if
(
vo
.
getValFace
().
compareTo
(
contentPrice
)
>
0
)
{
returnVo
.
setValue
(
contentPrice
);
}
else
{
returnVo
.
setValue
(
vo
.
getValFace
());
}
returnVo
.
setCouType
(
vo
.
getType
());
}
else
if
(
vo
.
getType
().
equals
(
"2"
))
{
//折扣
BigDecimal
tempPrice
=
contentPrice
.
multiply
(
vo
.
getDiscount
()).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
);
...
...
@@ -273,8 +279,12 @@ public class GoblinOrderUtils {
}
returnVo
.
setValue
(
tempPrice
);
returnVo
.
setCouType
(
vo
.
getType
());
}
else
if
(
vo
.
getType
().
equals
(
"3"
)
&&
vo
.
getTriggers
().
compareTo
(
contentPrice
)
<=
0
)
{
//满减
returnVo
.
setValue
(
vo
.
getValMinus
());
}
else
if
(
vo
.
getType
().
equals
(
"3"
))
{
//满减
if
(
vo
.
getValMinus
().
compareTo
(
contentPrice
)
>
0
)
{
returnVo
.
setValue
(
contentPrice
);
}
else
{
returnVo
.
setValue
(
vo
.
getValMinus
());
}
returnVo
.
setCouType
(
vo
.
getType
());
}
vo
.
setState
(
5
);
...
...
@@ -292,6 +302,7 @@ public class GoblinOrderUtils {
if
(!
returnVo
.
getCouType
().
equals
(
"-1"
))
{
redisUtils
.
setUserCouponVos
(
uid
,
voList
);
}
returnVo
.
setSpuIds
(
spuIds
);
return
returnVo
;
}
catch
(
Exception
e
)
{
log
.
error
(
"店铺券错误:{}"
,
e
);
...
...
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