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
b99e29f1
Commit
b99e29f1
authored
Oct 25, 2021
by
查志伟
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '20211012-订单商户全程信息不直接查库改造-zhiwei.zha'
parents
18b9d363
1ed494fe
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
20 deletions
+42
-20
order-application-service/src/main/java/cn/freemud/constant/KgdRedisKeyConstant.java
+9
-3
order-application-service/src/main/java/cn/freemud/service/impl/PayServiceImpl.java
+33
-17
No files found.
order-application-service/src/main/java/cn/freemud/constant/KgdRedisKeyConstant.java
View file @
b99e29f1
...
@@ -31,9 +31,15 @@ public class KgdRedisKeyConstant {
...
@@ -31,9 +31,15 @@ public class KgdRedisKeyConstant {
public
static
final
String
ORDER_COMPLAIN_TYPE
=
"orderComplaintType"
;
public
static
final
String
ORDER_COMPLAIN_TYPE
=
"orderComplaintType"
;
/**
* 下单时 支付商品名称redis缓存key,懒加载方式,有效时间为24小时
* {0}:商户号
*
* value:hash结构
* hashKey:小程序id wxAppId
* hashValue: 支付商户名称
*/
public
static
final
String
PARTNER_PAYMENT_PRINCIPAL_NAME
=
"kgd:order:payment:principalName:{0}"
;
}
}
order-application-service/src/main/java/cn/freemud/service/impl/PayServiceImpl.java
View file @
b99e29f1
...
@@ -3,6 +3,7 @@ package cn.freemud.service.impl;
...
@@ -3,6 +3,7 @@ package cn.freemud.service.impl;
import
cn.freemud.adapter.OrderAdapter
;
import
cn.freemud.adapter.OrderAdapter
;
import
cn.freemud.base.entity.BaseResponse
;
import
cn.freemud.base.entity.BaseResponse
;
import
cn.freemud.base.util.DateUtil
;
import
cn.freemud.base.util.DateUtil
;
import
cn.freemud.constant.KgdRedisKeyConstant
;
import
cn.freemud.constant.RedisKeyConstant
;
import
cn.freemud.constant.RedisKeyConstant
;
import
cn.freemud.constant.ResponseCodeConstant
;
import
cn.freemud.constant.ResponseCodeConstant
;
import
cn.freemud.entities.dto.SvcComPayRequestDto
;
import
cn.freemud.entities.dto.SvcComPayRequestDto
;
...
@@ -84,6 +85,7 @@ import org.springframework.beans.factory.annotation.Value;
...
@@ -84,6 +85,7 @@ import org.springframework.beans.factory.annotation.Value;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.text.MessageFormat
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
java.time.format.DateTimeFormatter
;
import
java.time.format.DateTimeFormatter
;
import
java.util.*
;
import
java.util.*
;
...
@@ -457,15 +459,21 @@ public class PayServiceImpl {
...
@@ -457,15 +459,21 @@ public class PayServiceImpl {
/**
/**
*
处理定制化逻辑
*
查询支付配置
*/
*/
private
PaymentRequest
orderBodyConvertToPaymentBody
(
String
openId
,
String
partnerId
,
String
appId
,
String
payCode
,
String
storeId
)
{
private
PaymentRequest
orderBodyConvertToPaymentBody
(
String
openId
,
String
partnerId
,
String
appId
,
String
payCode
,
String
storeId
)
{
PaymentRequest
paymentRequest
=
this
.
orderBodyConvertToPaymentBody
(
openId
,
partnerId
,
appId
,
payCode
);
//设置支付信息
// fisherman 2227 测试商户号, 下个版本需要删除
PaymentRequest
paymentRequest
=
new
PaymentRequest
();
boolean
isTrue
=
"2080"
.
equals
(
partnerId
);
paymentRequest
.
setOpenId
(
openId
);
if
(
isTrue
)
{
paymentRequest
.
setWxAppId
(
appId
);
paymentRequest
.
setReverseNotifyiDcUrl
(
reverseNotifyiDcUrl
);
paymentRequest
.
setPayCode
(
payCode
);
if
(
"2080"
.
equals
(
partnerId
))
{
//【ID1035981】【蜜雪冰城】订单C端,拼接order_body字段:蜜雪冰城+门店编号
//【ID1035981】【蜜雪冰城】订单C端,拼接order_body字段:蜜雪冰城+门店编号
paymentRequest
.
setPrincipalName
(
"蜜雪冰城"
+
storeId
+
"店"
);
paymentRequest
.
setPrincipalName
(
"蜜雪冰城"
+
storeId
+
"店"
);
}
else
{
// saas 查询小程序配置
paymentRequest
.
setPrincipalName
(
this
.
getPaymentPrincipalName
(
partnerId
,
appId
));
}
}
return
paymentRequest
;
return
paymentRequest
;
}
}
...
@@ -473,20 +481,28 @@ public class PayServiceImpl {
...
@@ -473,20 +481,28 @@ public class PayServiceImpl {
/**
/**
* 查询支付配置
* 查询支付配置
*/
*/
private
PaymentRequest
orderBodyConvertToPaymentBody
(
String
openId
,
String
partnerId
,
String
appId
,
String
payCode
)
{
private
String
getPaymentPrincipalName
(
String
partnerId
,
String
appId
)
{
//设置支付信息
String
redisKey
=
MessageFormat
.
format
(
KgdRedisKeyConstant
.
PARTNER_PAYMENT_PRINCIPAL_NAME
,
partnerId
);
PaymentRequest
paymentRequest
=
new
PaymentRequest
();
// 先从redis中查询支付商户名称
paymentRequest
.
setOpenId
(
open
Id
);
String
principalName
=
redisCache
.
hashGet
(
redisKey
,
app
Id
);
paymentRequest
.
setWxAppId
(
appId
);
if
(
StringUtils
.
isEmpty
(
principalName
))
{
AssortmentOpenPlatformWxapp
wxApp
=
openPlatformWxappManager
.
findByPartnerIdAndWxappId
(
partnerId
,
appId
);
AssortmentOpenPlatformWxapp
wxApp
=
openPlatformWxappManager
.
findByPartnerIdAndWxappId
(
partnerId
,
appId
);
AssortmentOpenPlatformPartner
platformPartner
=
null
;
if
(
wxApp
==
null
||
StringUtils
.
isEmpty
(
wxApp
.
getPrincipalName
()))
{
if
(
wxApp
==
null
)
{
// 小程序如果没有配置支付商户名称,则去商户名称替代
platformPartner
=
assortmentOpenPlatformPartnerManager
.
selectOpenPlatformPartner
(
partnerId
);
AssortmentOpenPlatformPartner
platformPartner
=
assortmentOpenPlatformPartnerManager
.
selectOpenPlatformPartner
(
partnerId
);
if
(
null
!=
platformPartner
)
principalName
=
platformPartner
.
getCompanyName
();
}
else
{
principalName
=
wxApp
.
getPrincipalName
();
}
}
paymentRequest
.
setPrincipalName
(
wxApp
!=
null
?
wxApp
.
getPrincipalName
()
:
platformPartner
!=
null
?
platformPartner
.
getCompanyName
()
:
"上海非码网络科技有限公司"
);
if
(
StringUtils
.
isEmpty
(
principalName
))
{
paymentRequest
.
setReverseNotifyiDcUrl
(
reverseNotifyiDcUrl
);
//如果还是没有查到,就用非码代替
paymentRequest
.
setPayCode
(
payCode
);
principalName
=
"上海非码网络科技有限公司"
;
return
paymentRequest
;
}
// 加载到redis,有效期一天
redisCache
.
hashPut
(
redisKey
,
appId
,
principalName
);
redisCache
.
updateTTL
(
redisKey
,
24
,
TimeUnit
.
HOURS
);
}
return
principalName
;
}
}
...
...
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