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
5405ee1d
Commit
5405ee1d
authored
Jan 23, 2024
by
hayden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更换定时任务调用api
更换创建订单调用美团api
parent
36fc5af2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
29 deletions
+11
-29
RedisTask.java
share-quartz/src/main/java/share/quartz/task/RedisTask.java
+8
-14
SOrderServiceImpl.java
...ain/java/share/system/service/impl/SOrderServiceImpl.java
+3
-15
No files found.
share-quartz/src/main/java/share/quartz/task/RedisTask.java
View file @
5405ee1d
...
...
@@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.dianping.openapi.sdk.api.oauth.entity.CustomerRefreshTokenResponse
;
import
com.dianping.openapi.sdk.api.tuangou.TuangouReceiptPrepare
;
import
com.dianping.openapi.sdk.api.tuangou.entity.TuangouReceiptGetConsumedReponseEntity
;
import
com.dianping.openapi.sdk.api.tuangou.entity.TuangouReceiptPrepareRequest
;
import
com.dianping.openapi.sdk.api.tuangou.entity.TuangouReceiptPrepareResponse
;
import
com.dianping.openapi.sdk.httpclient.DefaultOpenAPIClient
;
...
...
@@ -89,13 +90,12 @@ public class RedisTask {
final
long
FOUR_MINUTES
=
60
*
4
;
//3分钟的常量
final
long
THREE_MINUTES
=
60
*
3
;
@Value
(
"${dianping.appKey}"
)
private
String
APP_KEY
;
@Value
(
"${dianping.appSecret}"
)
private
String
APP_SECRET
;
public
void
AuToReceiptCode
()
{
/**
* 自动删除所有可用但已退款的优惠券
*/
public
void
AutoDelRefundedCoupon
()
{
//获取所有待使用的优惠卷
LambdaQueryWrapper
<
SConsumerCoupon
>
wrapper
=
Wrappers
.
lambdaQuery
();
wrapper
.
eq
(
SConsumerCoupon:
:
getUseStatus
,
CouponStatusEnum
.
NORMAL
.
getValue
());
...
...
@@ -107,18 +107,12 @@ public class RedisTask {
if
(!
CollectionUtils
.
isEmpty
(
coupons
))
{
for
(
SConsumerCoupon
coupon
:
coupons
)
{
//验券
String
o
=
redisUtil
.
get
(
ReceiptRdeisEnum
.
MT_SESSION_KEY
.
getValue
());
JSONObject
sessionKey
=
new
JSONObject
(
o
);
String
session
=
(
String
)
sessionKey
.
get
(
"access_token"
);
TuangouReceiptPrepareRequest
request
=
new
TuangouReceiptPrepareRequest
(
APP_KEY
,
APP_SECRET
,
session
,
coupon
.
getCouponCode
(),
""
,
TuangouReceiptGetConsumedReponseEntity
getconsumed
=
qpService
.
getconsumed
(
coupon
.
getCouponCode
(),
stores
.
stream
().
filter
(
store
->
store
.
getId
().
equals
(
coupon
.
getStoreId
())).
findFirst
().
get
().
getOpenShopUuid
());
TuangouReceiptPrepare
tuangouReceiptPrepare
=
new
TuangouReceiptPrepare
(
request
);
DefaultOpenAPIClient
client
=
new
DefaultOpenAPIClient
();
TuangouReceiptPrepareResponse
invoke
=
client
.
invoke
(
tuangouReceiptPrepare
);
if
(
invoke
.
getCode
()
!=
200
)
{
if
(
getconsumed
==
null
)
{
expiredCoupons
.
add
(
coupon
.
getId
());
}
logger
.
info
(
"券码:{}->查询结束:{}"
,
coupon
.
getCouponCode
(),
invoke
.
getData
()
);
logger
.
info
(
"券码:{}->查询结束:{}"
,
coupon
.
getCouponCode
(),
getconsumed
);
}
//逻辑删除所有异常优惠券
isConsumerCouponService
.
removeByIds
(
expiredCoupons
);
...
...
share-system/src/main/java/share/system/service/impl/SOrderServiceImpl.java
View file @
5405ee1d
...
...
@@ -16,6 +16,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.dianping.openapi.sdk.api.tuangou.TuangouReceiptGetConsumed
;
import
com.dianping.openapi.sdk.api.tuangou.entity.TuangouReceiptGetConsumedReponse
;
import
com.dianping.openapi.sdk.api.tuangou.entity.TuangouReceiptGetConsumedReponseEntity
;
import
com.dianping.openapi.sdk.api.tuangou.entity.TuangouReceiptGetConsumedRequest
;
import
com.dianping.openapi.sdk.httpclient.DefaultOpenAPIClient
;
import
org.apache.commons.collections4.CollectionUtils
;
...
...
@@ -54,10 +55,6 @@ import share.system.service.*;
public
class
SOrderServiceImpl
extends
ServiceImpl
<
SOrderMapper
,
SOrder
>
implements
ISOrderService
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
SOrderServiceImpl
.
class
);
@Value
(
"${dianping.appKey}"
)
private
String
APP_KEY
;
@Value
(
"${dianping.appSecret}"
)
private
String
APP_SECRET
;
@Value
(
"${order.allow-refund-time}"
)
private
Long
allowRefundTime
;
...
...
@@ -331,20 +328,11 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
if
(
Objects
.
nonNull
(
byId
))
{
if
(
byId
.
getUseStatus
().
equals
(
UserStatusEnum
.
UNUSED
.
getCode
()))
{
if
(
StringUtils
.
isNotEmpty
(
byId
.
getCouponCode
()))
{
String
o
=
redisUtil
.
get
(
ReceiptRdeisEnum
.
MT_SESSION_KEY
.
getValue
());
JSONObject
sessionKey
=
new
JSONObject
(
o
);
String
session
=
(
String
)
sessionKey
.
get
(
"access_token"
);
TuangouReceiptGetConsumedRequest
getConsumedRequest
=
new
TuangouReceiptGetConsumedRequest
(
APP_KEY
,
APP_SECRET
,
session
,
byId
.
getCouponCode
(),
""
,
sStore
.
getOpenShopUuid
());
TuangouReceiptGetConsumed
getConsumed
=
new
TuangouReceiptGetConsumed
(
getConsumedRequest
);
DefaultOpenAPIClient
client
=
new
DefaultOpenAPIClient
();
TuangouReceiptGetConsumedReponse
invoke
=
client
.
invoke
(
getConsumed
);
if
(
invoke
.
getCode
()
==
200
)
{
if
(
invoke
.
getData
()
==
null
)
{
logger
.
error
(
"验卷准备失败:{}"
,
invoke
.
getMsg
());
TuangouReceiptGetConsumedReponseEntity
getconsumed
=
qpService
.
getconsumed
(
byId
.
getCouponCode
(),
sStore
.
getOpenShopUuid
());
if
(
getconsumed
==
null
)
{
throw
new
RuntimeException
(
"优惠券异常,请稍后再试"
);
}
}
}
}
else
{
throw
new
BaseException
(
"优惠券已使用!"
);
}
...
...
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