Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gxpt_ht
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
pseer
gxpt_ht
Commits
c0bb5aa8
Commit
c0bb5aa8
authored
Nov 06, 2023
by
吕明尚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加session到期后续期
parent
ecae0bf3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
26 deletions
+49
-26
application-dev.yml
share-admin/src/main/resources/application-dev.yml
+3
-2
application-dev.yml
share-front/src/main/resources/application-dev.yml
+3
-2
QPServiceImpl.java
...rc/main/java/share/system/service/impl/QPServiceImpl.java
+43
-22
No files found.
share-admin/src/main/resources/application-dev.yml
View file @
c0bb5aa8
...
...
@@ -175,6 +175,7 @@ meituan:
signKey
:
abcdefghijklmnopqrstuvwxyz
appAuthToken
:
abcdefghijklmnopqrstuvwxyz
dianping
:
appKey
:
a
bcdefghijklmnopqrstuvwxyz
appSecret
:
abcdefghijklmnopqrstuvwxyz
appKey
:
a
59ea57cd1eb4737
appSecret
:
0caaabb7fda1c1be46636171548dcf510d1fb706
authCode
:
abcdefghijklmnopqrstuvwxyz
openShoopUuid
:
5067d2db1311d32a0ff366c79a73df51
share-front/src/main/resources/application-dev.yml
View file @
c0bb5aa8
...
...
@@ -180,6 +180,7 @@ meituan:
signKey
:
abcdefghijklmnopqrstuvwxyz
appAuthToken
:
abcdefghijklmnopqrstuvwxyz
dianping
:
appKey
:
a
bcdefghijklmnopqrstuvwxyz
appSecret
:
abcdefghijklmnopqrstuvwxyz
appKey
:
a
59ea57cd1eb4737
appSecret
:
0caaabb7fda1c1be46636171548dcf510d1fb706
authCode
:
abcdefghijklmnopqrstuvwxyz
openShoopUuid
:
5067d2db1311d32a0ff366c79a73df51
share-system/src/main/java/share/system/service/impl/QPServiceImpl.java
View file @
c0bb5aa8
package
share
.
system
.
service
.
impl
;
import
com.dianping.openapi.sdk.api.oauth.CustomerRefreshToken
;
import
com.dianping.openapi.sdk.api.oauth.DynamicToken
;
import
com.dianping.openapi.sdk.api.oauth.entity.CustomerRefreshTokenResponse
;
import
com.dianping.openapi.sdk.api.oauth.entity.DynamicTokenRequest
;
import
com.dianping.openapi.sdk.api.oauth.entity.DynamicTokenResponse
;
import
com.dianping.openapi.sdk.api.oauth.entity.RefreshTokenRequest
;
import
com.dianping.openapi.sdk.api.oauth.enums.GrantType
;
import
com.dianping.openapi.sdk.api.tuangou.TuangouReceiptConsume
;
import
com.dianping.openapi.sdk.api.tuangou.TuangouReceiptGetConsumed
;
import
com.dianping.openapi.sdk.api.tuangou.TuangouReceiptPrepare
;
import
com.dianping.openapi.sdk.api.tuangou.TuangouReceiptReverseConsume
;
import
com.dianping.openapi.sdk.api.tuangou.*
;
import
com.dianping.openapi.sdk.api.tuangou.entity.*
;
import
com.dianping.openapi.sdk.httpclient.DefaultOpenAPIClient
;
import
com.sun.deploy.services.PlatformType
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
share.common.enums.DataSourceType
;
import
share.common.enums.PlatformTypeEnum
;
import
share.common.enums.SourceTypeEnum
;
import
share.common.utils.uuid.UUID
;
import
share.system.domain.SConsumer
;
import
share.system.domain.SConsumerCoupon
;
import
share.system.domain.SCoupon
;
...
...
@@ -27,11 +24,6 @@ import share.system.domain.vo.FrontTokenComponent;
import
share.system.service.ISConsumerCouponService
;
import
share.system.service.ISCouponService
;
import
share.system.service.QPService
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.time.LocalDateTime
;
import
java.time.format.DateTimeFormatter
;
import
java.util.*
;
@Service
...
...
@@ -40,8 +32,9 @@ public class QPServiceImpl implements QPService {
private
String
APP_KEY
;
@Value
(
"${dianping.appSecret}"
)
private
String
APP_SECRET
;
@Value
(
"${dianping.authCode}"
)
private
String
AUTH_CODE
;
@Value
(
"${dianping.openShoopUuid}"
)
private
String
OPEN_SHOP_UUID
;
@Autowired
private
ISCouponService
isCouponService
;
...
...
@@ -117,7 +110,7 @@ public class QPServiceImpl implements QPService {
*/
@Override
public
TuangouReceiptPrepareResponseEntity
prepare
(
String
code
)
{
TuangouReceiptPrepareRequest
request
=
new
TuangouReceiptPrepareRequest
(
APP_KEY
,
APP_SECRET
,
"session"
,
code
,
""
);
TuangouReceiptPrepareRequest
request
=
new
TuangouReceiptPrepareRequest
(
APP_KEY
,
APP_SECRET
,
"session"
,
code
,
OPEN_SHOP_UUID
);
TuangouReceiptPrepare
tuangouReceiptPrepare
=
new
TuangouReceiptPrepare
(
request
);
DefaultOpenAPIClient
client
=
new
DefaultOpenAPIClient
();
TuangouReceiptPrepareResponse
invoke
=
client
.
invoke
(
tuangouReceiptPrepare
);
...
...
@@ -152,8 +145,8 @@ public class QPServiceImpl implements QPService {
@Override
public
List
<
TuangouReceiptReverseConsumeResponseEntity
>
reverseconsume
(
String
code
,
String
appDealId
)
{
TuangouReceiptReverseConsumeRequest
tuangouReceiptReverseConsumeRequest
=
new
TuangouReceiptReverseConsumeRequest
(
APP_KEY
,
APP_SECRET
,
"session"
,
"app_deal_id"
,
code
,
appDealId
,
"app_shop_account"
,
"app_shop_account
name"
,
"open_shop_uuid
"
);
appDealId
,
code
,
OPEN_SHOP_UUID
,
"app_shop_account
"
,
"app_shop_accountname
"
);
DefaultOpenAPIClient
openAPIClient
=
new
DefaultOpenAPIClient
();
TuangouReceiptReverseConsume
tuangouReceiptReverseConsume
=
new
TuangouReceiptReverseConsume
(
tuangouReceiptReverseConsumeRequest
);
TuangouReceiptReverseConsumeResponse
response
=
openAPIClient
.
invoke
(
tuangouReceiptReverseConsume
);
...
...
@@ -171,7 +164,7 @@ public class QPServiceImpl implements QPService {
public
TuangouReceiptGetConsumedReponseEntity
getconsumed
(
String
code
)
{
DefaultOpenAPIClient
openAPIClient
=
new
DefaultOpenAPIClient
();
TuangouReceiptGetConsumedRequest
request
=
new
TuangouReceiptGetConsumedRequest
(
APP_KEY
,
APP_SECRET
,
"7bd6cc83aecf6fe937d4cd774e1682aeb87773ad"
,
code
,
"app_shop_id"
);
"7bd6cc83aecf6fe937d4cd774e1682aeb87773ad"
,
code
,
OPEN_SHOP_UUID
);
TuangouReceiptGetConsumed
tuangouReceiptGetConsumed
=
new
TuangouReceiptGetConsumed
(
request
);
TuangouReceiptGetConsumedReponse
response
=
openAPIClient
.
invoke
(
tuangouReceiptGetConsumed
);
if
(
response
.
getCode
()
!=
200
)
{
...
...
@@ -181,13 +174,41 @@ public class QPServiceImpl implements QPService {
}
//商家通过接入授权UI,可获取到对应的auth_code,通过此接口获取此次发起授权的session。
public
DynamicTokenResponse
oauthToken
(
)
{
public
String
oauthToken
(
String
authCode
)
{
DefaultOpenAPIClient
openAPIClient
=
new
DefaultOpenAPIClient
();
DynamicTokenRequest
request
=
new
DynamicTokenRequest
(
APP_KEY
,
APP_SECRET
,
GrantType
.
AUTHORIZATION_CODE
.
getValue
(),
AUTH_CODE
);
APP_SECRET
,
GrantType
.
AUTHORIZATION_CODE
.
getValue
(),
authCode
);
DynamicToken
dynamicToken
=
new
DynamicToken
(
request
);
DynamicTokenResponse
response
=
openAPIClient
.
invoke
(
dynamicToken
);
return
response
;
if
(
response
.
getRemain_refresh_count
()
==
0
)
{
return
refreshToken
(
response
.
getRefresh_token
());
}
return
response
.
getAccess_token
();
}
//获取团购信息接口
public
List
<
TuangouDealQueryShopDealResponseEntity
>
queryshopdeal
()
{
/**
* @param app_key
* @param app_secret
* @param session
* @param app_shop_id
*/
DefaultOpenAPIClient
openAPIClient
=
new
DefaultOpenAPIClient
();
TuangouDealQueryShopDealRequest
request
=
new
TuangouDealQueryShopDealRequest
(
APP_KEY
,
APP_SECRET
,
"session"
,
OPEN_SHOP_UUID
,
1
,
100
);
TuangouDealQueryShopDeal
tuangouDealQueryShopDeal
=
new
TuangouDealQueryShopDeal
(
request
);
TuangouDealQueryShopDealResponse
response
=
openAPIClient
.
invoke
(
tuangouDealQueryShopDeal
);
if
(
response
.
getCode
()
!=
200
)
{
throw
new
RuntimeException
(
response
.
getMsg
());
}
return
response
.
getData
();
}
public
String
refreshToken
(
String
newToken
)
{
DefaultOpenAPIClient
openAPIClient
=
new
DefaultOpenAPIClient
();
RefreshTokenRequest
request
=
new
RefreshTokenRequest
(
APP_KEY
,
APP_SECRET
,
newToken
);
CustomerRefreshToken
refreshToken
=
new
CustomerRefreshToken
(
request
);
CustomerRefreshTokenResponse
response
=
openAPIClient
.
invoke
(
refreshToken
);
return
response
.
getAccess_token
();
}
}
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