Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
fit-finance
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
fitness-server
fit-finance
Commits
99bddebf
Commit
99bddebf
authored
May 13, 2024
by
程裕兵
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:ali
parent
0036c556
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
16 deletions
+19
-16
service/src/main/java/com/jiejing/fitness/finance/service/pay/impl/PayServiceImpl.java
+19
-16
No files found.
service/src/main/java/com/jiejing/fitness/finance/service/pay/impl/PayServiceImpl.java
View file @
99bddebf
...
@@ -108,16 +108,19 @@ public class PayServiceImpl implements PayService {
...
@@ -108,16 +108,19 @@ public class PayServiceImpl implements PayService {
@Resource
(
name
=
"financeThreadPool"
)
@Resource
(
name
=
"financeThreadPool"
)
private
Executor
executor
;
private
Executor
executor
;
private
final
Map
<
String
,
DefaultAlipayClient
>
aliClientMap
=
new
HashMap
<>();
//
private final Map<String, DefaultAlipayClient> aliClientMap = new HashMap<>();
@PostConstruct
@PostConstruct
public
void
init
()
{
public
void
init
()
{
GlobalConfig
config
=
globalConfigRpService
.
getById
(
GlobalConfigEnums
.
CASHIER_ALI_INFO
.
getCode
())
// GlobalConfig config = globalConfigRpService.getById(GlobalConfigEnums.CASHIER_ALI_INFO.getCode())
.
orElse
(
new
GlobalConfig
());
// .orElse(null);
AliInfo
info
=
JSON
.
parseObject
(
config
.
getConfigValue
(),
AliInfo
.
class
);
// if (config == null) {
aliClientMap
.
put
(
info
.
getAppId
(),
// return;
new
DefaultAlipayClient
(
info
.
getBaseUrl
(),
info
.
getAppId
(),
info
.
getMerchantPrivateKey
(),
"json"
,
// }
"utf-8"
,
info
.
getAlipayPublicKey
(),
"RSA2"
));
// AliInfo info = JSON.parseObject(config.getConfigValue(), AliInfo.class);
// aliClientMap.put(info.getAppId(),
// new DefaultAlipayClient(info.getBaseUrl(), info.getAppId(), info.getMerchantPrivateKey(), "json",
// "utf-8", info.getAlipayPublicKey(), "RSA2"));
}
}
@Override
@Override
...
@@ -126,15 +129,15 @@ public class PayServiceImpl implements PayService {
...
@@ -126,15 +129,15 @@ public class PayServiceImpl implements PayService {
case
WX:
case
WX:
return
Optional
.
ofNullable
(
weChatAuthService
.
getBaseAuthInfo
(
null
,
appId
,
authCode
))
return
Optional
.
ofNullable
(
weChatAuthService
.
getBaseAuthInfo
(
null
,
appId
,
authCode
))
.
map
(
BaseAuthInfoVO:
:
getOpenId
).
orElse
(
null
);
.
map
(
BaseAuthInfoVO:
:
getOpenId
).
orElse
(
null
);
case
ALI:
//
case ALI:
try
{
//
try {
AlipaySystemOauthTokenResponse
response
=
aliClientMap
.
get
(
appId
)
//
AlipaySystemOauthTokenResponse response = aliClientMap.get(appId)
.
execute
(
PayConvert
.
convertAlipaySystemOauthTokenRequest
(
authCode
));
//
.execute(PayConvert.convertAlipaySystemOauthTokenRequest(authCode));
log
.
info
(
"get ali openId response {}, {}, {}"
,
appId
,
authCode
,
JSON
.
toJSONString
(
response
));
//
log.info("get ali openId response {}, {}, {}", appId, authCode, JSON.toJSONString(response));
return
response
.
getOpenId
();
//
return response.getOpenId();
}
catch
(
AlipayApiException
e
)
{
//
} catch (AlipayApiException e) {
throw
new
BizException
(
e
.
getErrCode
(),
e
.
getMessage
());
//
throw new BizException(e.getErrCode(), e.getMessage());
}
//
}
default
:
default
:
throw
new
BizException
(
FinanceErrorEnums
.
NOT_SUPPORT_TYPE
);
throw
new
BizException
(
FinanceErrorEnums
.
NOT_SUPPORT_TYPE
);
}
}
...
...
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