记得上下班打卡 | 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
8cc44247
Commit
8cc44247
authored
Mar 14, 2022
by
胡佳晨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
平台券指定商品满减券折扣券逻辑
parent
abdbab98
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
43 additions
and
72 deletions
+43
-72
CandyUseResultVo.java
...java/com/liquidnet/service/candy/vo/CandyUseResultVo.java
+4
-0
CandyCouponServiceImpl.java
...et/service/candy/service/impl/CandyCouponServiceImpl.java
+8
-0
RedisStreamConfig.java
...om/liquidnet/service/dragon/config/RedisStreamConfig.java
+0
-66
GoblinOrderServiceImpl.java
...et/service/order/service/impl/GoblinOrderServiceImpl.java
+1
-1
GoblinOrderUtils.java
...a/com/liquidnet/service/order/utils/GoblinOrderUtils.java
+30
-5
No files found.
liquidnet-bus-api/liquidnet-service-candy-api/src/main/java/com/liquidnet/service/candy/vo/CandyUseResultVo.java
View file @
8cc44247
...
...
@@ -17,6 +17,10 @@ public class CandyUseResultVo implements Serializable, Cloneable {
private
BigDecimal
value
;
@ApiModelProperty
(
value
=
"券类型[-1-不可用 | 1-代金券|2-满减券|3-兑换券|4-折扣券|101-优先券]"
,
example
=
"1"
)
private
Integer
couType
;
@ApiModelProperty
(
value
=
"目标数组"
)
private
List
<
String
>
targetIds
;
@ApiModelProperty
(
value
=
"满减金额[满多少]"
)
private
BigDecimal
fullValue
;
private
static
final
CandyUseResultVo
obj
=
new
CandyUseResultVo
();
...
...
liquidnet-bus-service/liquidnet-service-candy/liquidnet-service-candy-impl/src/main/java/com/liquidnet/service/candy/service/impl/CandyCouponServiceImpl.java
View file @
8cc44247
...
...
@@ -323,6 +323,8 @@ public class CandyCouponServiceImpl implements ICandyCouponService {
userCreateTime
=
null
;
}
CandyUseResultVo
vo
=
CandyUseResultVo
.
getNew
();
List
<
String
>
targetIds
=
CollectionUtil
.
linkedListString
();
BigDecimal
fullValue
=
BigDecimal
.
ZERO
;
List
<
CandyUserCouponBasicDto
>
dtoList
=
CouponBaseUtil
.
useCoupon
(
redisDataUtils
.
getCouponByUid
(
uid
,
userCreateTime
),
uCouponId
,
content
);
if
(
dtoList
==
null
)
{
vo
.
setCouType
(-
1
);
...
...
@@ -342,6 +344,7 @@ public class CandyCouponServiceImpl implements ICandyCouponService {
case
2
:
if
(
dto
.
getValOver
().
compareTo
(
new
BigDecimal
(
totalPrice
))
<=
0
)
{
vo
.
setValue
(
dto
.
getValMinus
());
vo
.
setFullValue
(
dto
.
getValOver
());
}
else
{
vo
.
setCouType
(-
1
);
vo
.
setValue
(
BigDecimal
.
ZERO
);
...
...
@@ -383,6 +386,10 @@ public class CandyCouponServiceImpl implements ICandyCouponService {
if
(
dto
.
getUseRules
().
size
()
>
1
&&
dto
.
getCouType
().
equals
(
4
))
{
isTarget
=
false
;
}
if
(
isTarget
){
targetIds
.
add
(
ruleItem
.
getBusiId
());
}
}
if
(
dto
.
getBusiType
().
equals
(
0
))
{
...
...
@@ -415,6 +422,7 @@ public class CandyCouponServiceImpl implements ICandyCouponService {
}
}
}
vo
.
setTargetIds
(
targetIds
);
return
vo
;
}
...
...
liquidnet-bus-service/liquidnet-service-notify/liquidnet-service-notify-impl/src/main/java/com/liquidnet/service/dragon/config/RedisStreamConfig.java
deleted
100644 → 0
View file @
abdbab98
package
com
.
liquidnet
.
service
.
dragon
.
config
;
import
org.springframework.context.annotation.Configuration
;
@Configuration
public
class
RedisStreamConfig
{
// @Autowired
// private RedisPayNotifyReceiver redisPayNotifyReceiver;
// @Bean
// public Subscription subscriptionAlipayNotify0(RedisConnectionFactory factory) {
// var options = StreamMessageListenerContainer
// .StreamMessageListenerContainerOptions
// .builder()
// .pollTimeout(Duration.ofMillis(1))
// .build();
// var listenerContainer = StreamMessageListenerContainer.create(factory, options);
// var subscription = listenerContainer.receiveAutoAck(Consumer.from(DragonConstant.ChannelRedisQueueEnum.ALIPAY_PAY_GROUP.getCode(), "alipay-pay-notify-0"),
// StreamOffset.create(DragonConstant.ChannelRedisQueueEnum.ALIPAY_PAY_KEY.getCode(), ReadOffset.lastConsumed()), redisPayNotifyReceiver);
// listenerContainer.start();
// return subscription;
// }
//
// @Bean
// public Subscription subscriptionAlipayNotify1(RedisConnectionFactory factory) {
// var options = StreamMessageListenerContainer
// .StreamMessageListenerContainerOptions
// .builder()
// .pollTimeout(Duration.ofMillis(1))
// .build();
// var listenerContainer = StreamMessageListenerContainer.create(factory, options);
// var subscription = listenerContainer.receiveAutoAck(Consumer.from(DragonConstant.ChannelRedisQueueEnum.ALIPAY_PAY_GROUP.getCode(), "alipay-pay-notify-1"),
// StreamOffset.create(DragonConstant.ChannelRedisQueueEnum.ALIPAY_PAY_KEY.getCode(), ReadOffset.lastConsumed()), redisPayNotifyReceiver);
// listenerContainer.start();
// return subscription;
// }
//
// @Bean
// public Subscription subscriptionWepayNotify0(RedisConnectionFactory factory) {
// var options = StreamMessageListenerContainer
// .StreamMessageListenerContainerOptions
// .builder()
// .pollTimeout(Duration.ofMillis(1))
// .build();
// var listenerContainer = StreamMessageListenerContainer.create(factory, options);
// var subscription = listenerContainer.receiveAutoAck(Consumer.from(DragonConstant.ChannelRedisQueueEnum.WECHAT_PAY_GROUP.getCode(), "wepay-pay-notify-0"),
// StreamOffset.create(DragonConstant.ChannelRedisQueueEnum.WECHAT_PAY_KEY.getCode(), ReadOffset.lastConsumed()), redisPayNotifyReceiver);
// listenerContainer.start();
// return subscription;
// }
//
// @Bean
// public Subscription subscriptionWepayNotify1(RedisConnectionFactory factory) {
// var options = StreamMessageListenerContainer
// .StreamMessageListenerContainerOptions
// .builder()
// .pollTimeout(Duration.ofMillis(1))
// .build();
// var listenerContainer = StreamMessageListenerContainer.create(factory, options);
// var subscription = listenerContainer.receiveAutoAck(Consumer.from(DragonConstant.ChannelRedisQueueEnum.WECHAT_PAY_GROUP.getCode(), "wepay-pay-notify-1"),
// StreamOffset.create(DragonConstant.ChannelRedisQueueEnum.WECHAT_PAY_KEY.getCode(), ReadOffset.lastConsumed()), redisPayNotifyReceiver);
// listenerContainer.start();
// return subscription;
// }
}
liquidnet-bus-service/liquidnet-service-order/liquidnet-service-order-impl/src/main/java/com/liquidnet/service/order/service/impl/GoblinOrderServiceImpl.java
View file @
8cc44247
...
...
@@ -302,7 +302,7 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
spuIds
=
spuIds
.
concat
(
item
.
getSpuId
()
+
","
);
}
}
HashMap
<
String
,
Object
>
hashMap
=
orderUtils
.
useCoupon
(
platVoucherCode
,
"购买商品["
+
orderCode
+
"]"
,
storeTotalPrice
,
spuIds
,
uid
);
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"
);
...
...
liquidnet-bus-service/liquidnet-service-order/liquidnet-service-order-impl/src/main/java/com/liquidnet/service/order/utils/GoblinOrderUtils.java
View file @
8cc44247
...
...
@@ -16,6 +16,7 @@ import com.liquidnet.service.goblin.dto.vo.*;
import
com.liquidnet.service.goblin.entity.GoblinBackOrder
;
import
com.liquidnet.service.goblin.entity.GoblinBackOrderLog
;
import
com.liquidnet.service.goblin.entity.GoblinOrderOperationLog
;
import
com.liquidnet.service.goblin.entity.GoblinOrderSku
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -88,7 +89,7 @@ public class GoblinOrderUtils {
* @param totalPrice 订单总价
* @return
*/
public
HashMap
<
String
,
Object
>
useCoupon
(
String
uCouponId
,
String
content
,
BigDecimal
totalPrice
,
String
spuId
,
String
uid
)
{
public
HashMap
<
String
,
Object
>
useCoupon
(
String
uCouponId
,
String
content
,
BigDecimal
totalPrice
,
String
spuId
,
String
uid
,
List
<
GoblinOrderSku
>
goblinOrderSkuList
)
{
HashMap
<
String
,
Object
>
hashMap
=
CollectionUtil
.
mapStringObject
();
try
{
MultiValueMap
<
String
,
String
>
params
=
CollectionUtil
.
linkedMultiValueMapStringString
();
...
...
@@ -109,8 +110,11 @@ public class GoblinOrderUtils {
});
CandyUseResultVo
candyUseResultVo
=
innerReturnVo
.
getData
();
Integer
type
=
candyUseResultVo
.
getCouType
();
List
<
String
>
targetList
=
candyUseResultVo
.
getTargetIds
();
BigDecimal
fullValue
=
candyUseResultVo
.
getFullValue
();
BigDecimal
value
=
candyUseResultVo
.
getValue
();
BigDecimal
voucher
=
BigDecimal
.
ZERO
;
BigDecimal
targetPrice
=
BigDecimal
.
ZERO
;
switch
(
type
)
{
case
-
1
:
voucher
=
BigDecimal
.
valueOf
(-
1
);
...
...
@@ -118,14 +122,35 @@ public class GoblinOrderUtils {
case
1
:
voucher
=
voucher
.
add
(
value
);
break
;
case
2
:
voucher
=
voucher
.
add
(
value
);
case
2
:
//满减
for
(
String
targetId
:
targetList
)
{
for
(
GoblinOrderSku
skuOrderVo
:
goblinOrderSkuList
)
{
if
(
targetId
.
equals
(
skuOrderVo
.
getSpuId
()))
{
targetPrice
=
targetPrice
.
add
(
skuOrderVo
.
getSkuPriceActual
());
}
}
}
if
(
fullValue
.
compareTo
(
targetPrice
)
>=
0
)
{
voucher
=
voucher
.
add
(
value
);
}
else
{
backCoupon
(
uCouponId
,
uid
);
hashMap
.
put
(
"type"
,
-
1
);
hashMap
.
put
(
"voucher"
,
0
);
return
hashMap
;
}
break
;
case
3
:
voucher
=
voucher
.
add
(
totalPrice
);
break
;
case
4
:
voucher
=
totalPrice
.
subtract
(
totalPrice
.
multiply
(
value
));
case
4
:
//折扣
for
(
String
targetId
:
targetList
)
{
for
(
GoblinOrderSku
skuOrderVo
:
goblinOrderSkuList
)
{
if
(
targetId
.
equals
(
skuOrderVo
.
getSpuId
()))
{
targetPrice
=
targetPrice
.
add
(
skuOrderVo
.
getSkuPriceActual
());
}
}
}
voucher
=
totalPrice
.
subtract
(
targetPrice
.
multiply
(
value
));
break
;
default
:
voucher
=
BigDecimal
.
ZERO
;
...
...
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