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
d1a4fca3
Commit
d1a4fca3
authored
Nov 27, 2020
by
xiaoer.li@freemud.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加混合支付开关
parent
9d45ef7a
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
241 additions
and
25 deletions
+241
-25
order-application-service/src/main/java/cn/freemud/entities/dto/SvcComPayRequestDto.java
+21
-0
order-application-service/src/main/java/cn/freemud/entities/dto/SvcComPayResponseDto.java
+27
-0
order-application-service/src/main/java/cn/freemud/service/impl/OrderServiceImpl.java
+28
-3
order-application-service/src/main/java/cn/freemud/service/thirdparty/SvcComPayClient.java
+25
-0
shopping-cart-application-service/src/main/java/cn/freemud/entities/dto/SvcComPayRequestDto.java
+21
-0
shopping-cart-application-service/src/main/java/cn/freemud/entities/dto/SvcComPayResponseDto.java
+27
-0
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/ShoppingCartNewServiceImpl.java
+67
-22
shopping-cart-application-service/src/main/java/cn/freemud/service/thirdparty/SvcComPayClient.java
+25
-0
No files found.
order-application-service/src/main/java/cn/freemud/entities/dto/SvcComPayRequestDto.java
0 → 100644
View file @
d1a4fca3
package
cn
.
freemud
.
entities
.
dto
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
/**
* All rights Reserved, Designed By www.freemud.cn
*
* @Title: cn.freemud.entities.dto SvcComPayRequestDto
* @Description: TDO 描述....
* @author: 铁牌灵魂工程师
* @date: 2020/11/27
* @Copyright: www.freemud.cn Inc. All rights reserved.
* 注意:本内容仅限于上海非码科技内部传阅,禁止外泄以及用于其他的商业目
*/
@Data
@NoArgsConstructor
public
class
SvcComPayRequestDto
{
private
String
partnerId
;
private
String
storeId
;
}
order-application-service/src/main/java/cn/freemud/entities/dto/SvcComPayResponseDto.java
0 → 100644
View file @
d1a4fca3
package
cn
.
freemud
.
entities
.
dto
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
/**
* All rights Reserved, Designed By www.freemud.cn
*
* @Title: cn.freemud.entities.dto SvcComPayResoonseDto
* @Description: TDO 描述....
* @author: 铁牌灵魂工程师
* @date: 2020/11/27
* @Copyright: www.freemud.cn Inc. All rights reserved.
* 注意:本内容仅限于上海非码科技内部传阅,禁止外泄以及用于其他的商业目
*/
@Data
@NoArgsConstructor
public
class
SvcComPayResponseDto
{
private
Integer
code
;
private
String
message
;
private
Result
result
;
@Data
@NoArgsConstructor
static
public
class
Result
{
private
Boolean
value
;
}
}
order-application-service/src/main/java/cn/freemud/service/impl/OrderServiceImpl.java
View file @
d1a4fca3
...
...
@@ -266,6 +266,8 @@ public class OrderServiceImpl implements Orderservice {
@Autowired
private
AssortmentOpenPlatformIappWxappStoreManager
assortmentOpenPlatformIappWxappStoreManager
;
@Autowired
private
SvcComPayClient
svcComPayClient
;
@Override
public
BaseResponse
checkBeforeCreateOrder
(
CheckBeforeCreateOrderRequestVo
requestVo
)
{
String
trackingNo
=
LogTreadLocal
.
getTrackingNo
();
...
...
@@ -2320,11 +2322,10 @@ public class OrderServiceImpl implements Orderservice {
,
String
storeId
,
String
trackingNo
)
{
boolean
tigger
=
false
;
OrderPayResponse
orderPayResponse
=
new
OrderPayResponse
();
tigger
=
true
;
boolean
check
=
this
.
checkSvcComPay
(
orderBean
.
getCompanyId
(),
orderBean
.
getShopId
())
;
//混合支付
if
(
tigger
&&
StringUtils
.
isNotBlank
(
channel
))
{
if
(
check
&&
StringUtils
.
isNotBlank
(
channel
))
{
log
.
info
(
"混合支付:"
);
String
partnerPayOvertime
=
this
.
getPartnerPayOvertime
(
orderBean
.
getCompanyId
());
orderPayResponse
=
comPayOrder
(
cardCode
,
orderBean
,
paymentRequest
,
partnerPayOvertime
,
totalAmount
.
intValue
(),
channel
,
storeId
,
LogThreadLocal
.
getTrackingNo
());
...
...
@@ -3338,4 +3339,28 @@ public class OrderServiceImpl implements Orderservice {
// // TODO: 2019/9/10 hubowen mq推送变更
// backOrdersStatusChange(orderBean.getOid(), orderBean.getStatus());
//}
/**
* 获取混合支付是否开启
* @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
(
partnerId
.
equals
(
query
.
getResult
().
getValue
()))
{
return
true
;
}
else
{
return
false
;
}
}
}
order-application-service/src/main/java/cn/freemud/service/thirdparty/SvcComPayClient.java
0 → 100644
View file @
d1a4fca3
package
cn
.
freemud
.
service
.
thirdparty
;
import
cn.freemud.entities.dto.SvcComPayRequestDto
;
import
cn.freemud.entities.dto.SvcComPayResponseDto
;
import
org.springframework.cloud.netflix.feign.FeignClient
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
/**
* All rights Reserved, Designed By www.freemud.cn
*
* @Title: cn.freemud.service.thirdparty SvcClient
* @Description: TDO 描述....
* @author: 铁牌灵魂工程师
* @date: 2020/11/27
* @Copyright: www.freemud.cn Inc. All rights reserved.
* 注意:本内容仅限于上海非码科技内部传阅,禁止外泄以及用于其他的商业目
*/
@FeignClient
(
name
=
"payment-center-management"
,
url
=
"${saas.svc.switch.feign.url}"
)
@RequestMapping
(
produces
=
{
"application/json;charset=UTF-8"
})
public
interface
SvcComPayClient
{
@PostMapping
(
"/paymentmanager/partnerSetting/queryAssociationPaymentFlagPartnerSetting"
)
SvcComPayResponseDto
query
(
SvcComPayRequestDto
svcComPayRequestDto
);
}
shopping-cart-application-service/src/main/java/cn/freemud/entities/dto/SvcComPayRequestDto.java
0 → 100644
View file @
d1a4fca3
package
cn
.
freemud
.
entities
.
dto
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
/**
* All rights Reserved, Designed By www.freemud.cn
*
* @Title: cn.freemud.entities.dto SvcComPayRequestDto
* @Description: TDO 描述....
* @author: 铁牌灵魂工程师
* @date: 2020/11/27
* @Copyright: www.freemud.cn Inc. All rights reserved.
* 注意:本内容仅限于上海非码科技内部传阅,禁止外泄以及用于其他的商业目
*/
@Data
@NoArgsConstructor
public
class
SvcComPayRequestDto
{
private
String
partnerId
;
private
String
storeId
;
}
shopping-cart-application-service/src/main/java/cn/freemud/entities/dto/SvcComPayResponseDto.java
0 → 100644
View file @
d1a4fca3
package
cn
.
freemud
.
entities
.
dto
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
/**
* All rights Reserved, Designed By www.freemud.cn
*
* @Title: cn.freemud.entities.dto SvcComPayResoonseDto
* @Description: TDO 描述....
* @author: 铁牌灵魂工程师
* @date: 2020/11/27
* @Copyright: www.freemud.cn Inc. All rights reserved.
* 注意:本内容仅限于上海非码科技内部传阅,禁止外泄以及用于其他的商业目
*/
@Data
@NoArgsConstructor
public
class
SvcComPayResponseDto
{
private
Integer
code
;
private
String
message
;
private
Result
result
;
@Data
@NoArgsConstructor
static
public
class
Result
{
private
Boolean
value
;
}
}
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/ShoppingCartNewServiceImpl.java
View file @
d1a4fca3
...
...
@@ -151,6 +151,8 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
private
ActivityService
activityService
;
@Autowired
private
RedisCache
redisCache
;
@Autowired
private
SvcComPayClient
svcComPayClient
;
private
static
final
String
limitCartKey
=
"ecology:kgd:wxappconfig:open_platform_partner_wxapp_config:appkey_"
;
...
...
@@ -1643,30 +1645,49 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
if
(
response
.
getData
()
==
null
||
response
.
getData
().
getData
()
==
null
||
response
.
getData
().
getData
().
getCardSimpleInfos
().
size
()
>
1
)
{
throw
new
ServiceException
(
ResponseResult
.
USER_SVC_CARD_ERROR
);
}
//混合支付无需校验svc卡余额,但是配送和包装费不计算在svc卡支付
Integer
amount1
=
response
.
getData
().
getData
().
getCardSimpleInfos
().
get
(
0
).
getAmount
();
Integer
vamount
=
response
.
getData
().
getData
().
getCardSimpleInfos
().
get
(
0
).
getVamount
();
Integer
svcTotalAmount
=
amount1
+
vamount
;
//获取实际配送费
Integer
deliveryAmount
=
0
;
Integer
svcPayAmount
=
0
;
if
(
StringUtils
.
isNotBlank
(
receiveId
)
&&
shoppingCartGoodsResponseVo
.
getDiscountDeliveryAmount
()
!=
null
)
{
//Integer deliveryAmount = getDeliveryAmount(receiveId, partnerId, storeId);
deliveryAmount
=
shoppingCartGoodsResponseVo
.
getDiscountDeliveryAmount
().
intValue
();
orderAmount
+=
deliveryAmount
;
}
if
(
svcTotalAmount
>
0
&&
svcTotalAmount
>
orderAmount
)
{
svcPayAmount
=
orderAmount
;
shoppingCartGoodsResponseVo
.
setTotalAmount
(
0L
);
boolean
check
=
this
.
checkSvcComPay
(
partnerId
,
storeId
);
if
(
check
)
{
//混合支付无需校验svc卡余额,但是配送和包装费不计算在svc卡支付
Integer
amount1
=
response
.
getData
().
getData
().
getCardSimpleInfos
().
get
(
0
).
getAmount
();
Integer
vamount
=
response
.
getData
().
getData
().
getCardSimpleInfos
().
get
(
0
).
getVamount
();
Integer
svcTotalAmount
=
amount1
+
vamount
;
//获取实际配送费
Integer
deliveryAmount
=
0
;
Integer
svcPayAmount
=
0
;
if
(
StringUtils
.
isNotBlank
(
receiveId
)
&&
shoppingCartGoodsResponseVo
.
getDiscountDeliveryAmount
()
!=
null
)
{
//Integer deliveryAmount = getDeliveryAmount(receiveId, partnerId, storeId);
deliveryAmount
=
shoppingCartGoodsResponseVo
.
getDiscountDeliveryAmount
().
intValue
();
orderAmount
+=
deliveryAmount
;
}
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
(
svcTotalAmount
>
0
&&
svcTotalAmount
<=
orderAmount
)
{
svcPayAmount
=
svcTotalAmount
;
shoppingCartGoodsResponseVo
.
setTotalAmount
((
orderAmount
.
longValue
()-
svcPayAmount
.
longValue
()));
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
);
}
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
);
}
/**
...
...
@@ -2049,4 +2070,28 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
}
/**
* 获取混合支付是否开启
* @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
(
partnerId
.
equals
(
query
.
getResult
().
getValue
()))
{
return
true
;
}
else
{
return
false
;
}
}
}
shopping-cart-application-service/src/main/java/cn/freemud/service/thirdparty/SvcComPayClient.java
0 → 100644
View file @
d1a4fca3
package
cn
.
freemud
.
service
.
thirdparty
;
import
cn.freemud.entities.dto.SvcComPayRequestDto
;
import
cn.freemud.entities.dto.SvcComPayResponseDto
;
import
org.springframework.cloud.netflix.feign.FeignClient
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
/**
* All rights Reserved, Designed By www.freemud.cn
*
* @Title: cn.freemud.service.thirdparty SvcClient
* @Description: TDO 描述....
* @author: 铁牌灵魂工程师
* @date: 2020/11/27
* @Copyright: www.freemud.cn Inc. All rights reserved.
* 注意:本内容仅限于上海非码科技内部传阅,禁止外泄以及用于其他的商业目
*/
@FeignClient
(
name
=
"payment-center-management"
,
url
=
"${saas.svc.switch.feign.url}"
)
@RequestMapping
(
produces
=
{
"application/json;charset=UTF-8"
})
public
interface
SvcComPayClient
{
@PostMapping
(
"/paymentmanager/partnerSetting/queryAssociationPaymentFlagPartnerSetting"
)
SvcComPayResponseDto
query
(
SvcComPayRequestDto
svcComPayRequestDto
);
}
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