Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
order-group
Overview
Overview
Details
Activity
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
order-group-application
order-group
Commits
54482871
Commit
54482871
authored
Dec 09, 2020
by
缪晖
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
拼单混合支付提交
parent
383c6979
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
87 additions
and
15 deletions
+87
-15
shopping-cart-application-service/src/main/java/cn/freemud/entities/vo/ShoppingCartCollageResponseVo.java
+15
-0
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/ShoppingCartCollageServiceImpl.java
+72
-15
No files found.
shopping-cart-application-service/src/main/java/cn/freemud/entities/vo/ShoppingCartCollageResponseVo.java
View file @
54482871
...
@@ -127,6 +127,21 @@ public class ShoppingCartCollageResponseVo extends ShoppingCartGoodsBaseResponse
...
@@ -127,6 +127,21 @@ public class ShoppingCartCollageResponseVo extends ShoppingCartGoodsBaseResponse
private
Integer
deliveryFeeZeroReason
;
private
Integer
deliveryFeeZeroReason
;
/**
/**
* 代金券
*/
private
String
couponCode
;
/**
* 运费券
*/
private
String
freightCouponCode
;
/**
* svc卡支付金额
*/
private
String
svcPayAmount
;
/**
* 购物车版本号
* 购物车版本号
*/
*/
private
Integer
carVer
;
private
Integer
carVer
;
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/ShoppingCartCollageServiceImpl.java
View file @
54482871
...
@@ -17,6 +17,7 @@ import cn.freemud.interceptor.ServiceException;
...
@@ -17,6 +17,7 @@ import cn.freemud.interceptor.ServiceException;
import
cn.freemud.redis.RedisCache
;
import
cn.freemud.redis.RedisCache
;
import
cn.freemud.service.*
;
import
cn.freemud.service.*
;
import
cn.freemud.service.thirdparty.ActivityClient
;
import
cn.freemud.service.thirdparty.ActivityClient
;
import
cn.freemud.service.thirdparty.SvcComPayClient
;
import
cn.freemud.utils.PropertyConvertUtil
;
import
cn.freemud.utils.PropertyConvertUtil
;
import
cn.freemud.utils.RedisLock
;
import
cn.freemud.utils.RedisLock
;
import
cn.freemud.utils.ResponseUtil
;
import
cn.freemud.utils.ResponseUtil
;
...
@@ -103,6 +104,9 @@ public class ShoppingCartCollageServiceImpl extends AbstractShoppingCartImpl imp
...
@@ -103,6 +104,9 @@ public class ShoppingCartCollageServiceImpl extends AbstractShoppingCartImpl imp
@Autowired
@Autowired
private
PaymentNewService
paymentNewService
;
private
PaymentNewService
paymentNewService
;
@Autowired
private
SvcComPayClient
svcComPayClient
;
@Override
@Override
public
BaseResponse
addGoodsByCard
(
AddGoodsByWeixinCardRequestVo
request
)
{
public
BaseResponse
addGoodsByCard
(
AddGoodsByWeixinCardRequestVo
request
)
{
...
@@ -1261,20 +1265,73 @@ public class ShoppingCartCollageServiceImpl extends AbstractShoppingCartImpl imp
...
@@ -1261,20 +1265,73 @@ public class ShoppingCartCollageServiceImpl extends AbstractShoppingCartImpl imp
if
(
response
.
getData
()
==
null
||
response
.
getData
().
getData
()
==
null
||
response
.
getData
().
getData
().
getCardSimpleInfos
().
size
()
>
1
)
{
if
(
response
.
getData
()
==
null
||
response
.
getData
().
getData
()
==
null
||
response
.
getData
().
getData
().
getCardSimpleInfos
().
size
()
>
1
)
{
throw
new
ServiceException
(
ResponseResult
.
USER_SVC_CARD_ERROR
);
throw
new
ServiceException
(
ResponseResult
.
USER_SVC_CARD_ERROR
);
}
}
//获取实际配送费
boolean
check
=
this
.
checkSvcComPay
(
partnerId
,
storeId
);
if
(
StringUtils
.
isNotBlank
(
receiveId
)
&&
shoppingCartGoodsResponseVo
.
getDiscountDeliveryAmount
()
!=
null
)
{
if
(
check
)
{
// Integer deliveryAmount = getDeliveryAmount(receiveId, partnerId, storeId);
//混合支付无需校验svc卡余额,但是配送和包装费不计算在svc卡支付
Integer
deliveryAmount
=
shoppingCartGoodsResponseVo
.
getDiscountDeliveryAmount
().
intValue
();
Integer
amount1
=
response
.
getData
().
getData
().
getCardSimpleInfos
().
get
(
0
).
getAmount
();
orderAmount
+=
deliveryAmount
;
Integer
vamount
=
response
.
getData
().
getData
().
getCardSimpleInfos
().
get
(
0
).
getVamount
();
}
Integer
svcTotalAmount
=
amount1
+
vamount
;
Integer
amount1
=
response
.
getData
().
getData
().
getCardSimpleInfos
().
get
(
0
).
getAmount
();
//获取实际配送费
Integer
vamount
=
response
.
getData
().
getData
().
getCardSimpleInfos
().
get
(
0
).
getVamount
();
Integer
deliveryAmount
=
0
;
if
(
orderAmount
>
amount1
+
vamount
)
{
Integer
svcPayAmount
=
0
;
throw
new
ServiceException
(
ResponseResult
.
USER_SVC_CARD_AMOUNT_DEFICIENCY
);
if
(
StringUtils
.
isNotBlank
(
receiveId
)
&&
shoppingCartGoodsResponseVo
.
getDiscountDeliveryAmount
()
!=
null
)
{
}
//Integer deliveryAmount = getDeliveryAmount(receiveId, partnerId, storeId);
BigDecimal
bigDecimal
=
new
BigDecimal
(
orderAmount
);
deliveryAmount
=
shoppingCartGoodsResponseVo
.
getDiscountDeliveryAmount
().
intValue
();
String
amountStr
=
bigDecimal
.
divide
(
new
BigDecimal
(
100
)).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
).
toString
();
orderAmount
+=
deliveryAmount
;
shoppingCartGoodsResponseVo
.
setTotalAmount
(
0L
);
}
shoppingCartGoodsResponseVo
.
setSvcDiscountDesc
(
"储值卡支付¥"
+
amountStr
);
if
(
svcTotalAmount
>
0
&&
svcTotalAmount
>
orderAmount
)
{
svcPayAmount
=
orderAmount
;
shoppingCartGoodsResponseVo
.
setTotalAmount
(
0L
);
}
else
if
(
svcTotalAmount
>
0
&&
svcTotalAmount
<=
orderAmount
)
{
svcPayAmount
=
svcTotalAmount
;
shoppingCartGoodsResponseVo
.
setTotalAmount
((
orderAmount
.
longValue
()-
svcPayAmount
.
longValue
()));
}
BigDecimal
bigDecimal
=
new
BigDecimal
(
svcPayAmount
);
String
amountStr
=
bigDecimal
.
divide
(
new
BigDecimal
(
100
)).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
).
toString
();
shoppingCartGoodsResponseVo
.
setSvcPayAmount
(
amountStr
);
shoppingCartGoodsResponseVo
.
setSvcDiscountDesc
(
"储值卡支付¥"
+
amountStr
);
}
else
{
//获取实际配送费
if
(
StringUtils
.
isNotBlank
(
receiveId
)
&&
shoppingCartGoodsResponseVo
.
getDiscountDeliveryAmount
()
!=
null
)
{
Integer
deliveryAmount
=
shoppingCartGoodsResponseVo
.
getDiscountDeliveryAmount
().
intValue
();
orderAmount
+=
deliveryAmount
;
}
Integer
amount1
=
response
.
getData
().
getData
().
getCardSimpleInfos
().
get
(
0
).
getAmount
();
Integer
vamount
=
response
.
getData
().
getData
().
getCardSimpleInfos
().
get
(
0
).
getVamount
();
if
(
orderAmount
>
amount1
+
vamount
)
{
throw
new
ServiceException
(
ResponseResult
.
USER_SVC_CARD_AMOUNT_DEFICIENCY
);
}
BigDecimal
bigDecimal
=
new
BigDecimal
(
orderAmount
);
String
amountStr
=
bigDecimal
.
divide
(
new
BigDecimal
(
100
)).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
).
toString
();
shoppingCartGoodsResponseVo
.
setTotalAmount
(
0L
);
shoppingCartGoodsResponseVo
.
setSvcDiscountDesc
(
"储值卡支付¥"
+
amountStr
);
}
}
/**
* 获取混合支付是否开启
* @param partnerId
* @return
*/
private
boolean
checkSvcComPay
(
String
partnerId
,
String
storeId
)
{
SvcComPayRequestDto
requestDto
=
new
SvcComPayRequestDto
();
requestDto
.
setPartnerId
(
partnerId
);
requestDto
.
setStoreId
(
storeId
);
SvcComPayResponseDto
query
=
null
;
for
(
int
i
=
0
;
i
<
3
;
i
++)
{
query
=
svcComPayClient
.
query
(
requestDto
);
if
(
query
!=
null
)
break
;
}
if
(
query
==
null
||
!
ResponseResult
.
SUCCESS
.
getCode
().
equals
(
query
.
getCode
()))
{
return
false
;
}
if
(
query
.
getResult
()!=
null
&&
query
.
getResult
().
getValue
())
{
return
true
;
}
else
{
return
false
;
}
}
}
}
}
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