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
561dfd83
Commit
561dfd83
authored
Jan 06, 2024
by
吕明尚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
验劵准备和验劵接口增加记录
parent
279c77bd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
6 deletions
+17
-6
QPServiceImpl.java
...rc/main/java/share/system/service/impl/QPServiceImpl.java
+11
-1
SOrderServiceImpl.java
...ain/java/share/system/service/impl/SOrderServiceImpl.java
+6
-5
No files found.
share-system/src/main/java/share/system/service/impl/QPServiceImpl.java
View file @
561dfd83
...
...
@@ -19,6 +19,8 @@ import com.dianping.openapi.sdk.api.tuangou.entity.*;
import
com.dianping.openapi.sdk.httpclient.DefaultOpenAPIClient
;
import
org.apache.commons.lang3.ObjectUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
...
...
@@ -49,7 +51,7 @@ public class QPServiceImpl implements QPService {
private
String
APP_KEY
;
@Value
(
"${dianping.appSecret}"
)
private
String
APP_SECRET
;
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
QPServiceImpl
.
class
);
@Autowired
private
ISCouponService
isCouponService
;
...
...
@@ -208,6 +210,8 @@ public class QPServiceImpl implements QPService {
if
(
Boolean
.
FALSE
.
equals
(
b
))
{
throw
new
RuntimeException
(
"请联系管理员"
);
}
logger
.
info
(
"code:{}"
,
code
);
logger
.
info
(
"验卷准备开始"
);
String
o
=
redisUtil
.
get
(
ReceiptRdeisEnum
.
MT_SESSION_KEY
.
getValue
());
JSONObject
sessionKey
=
new
JSONObject
(
o
);
String
session
=
(
String
)
sessionKey
.
get
(
"access_token"
);
...
...
@@ -216,8 +220,10 @@ public class QPServiceImpl implements QPService {
DefaultOpenAPIClient
client
=
new
DefaultOpenAPIClient
();
TuangouReceiptPrepareResponse
invoke
=
client
.
invoke
(
tuangouReceiptPrepare
);
if
(
invoke
.
getCode
()
!=
200
)
{
logger
.
error
(
"验卷准备失败:{}"
,
invoke
.
getMsg
());
throw
new
RuntimeException
(
invoke
.
getMsg
());
}
logger
.
info
(
"验卷准备结束:{}"
,
invoke
.
getData
());
return
invoke
.
getData
();
}
...
...
@@ -228,6 +234,8 @@ public class QPServiceImpl implements QPService {
@Override
public
List
<
TuangouReceiptConsumeResponseEntity
>
consume
(
String
code
,
int
count
,
String
openShopUuid
)
{
String
o
=
redisUtil
.
get
(
ReceiptRdeisEnum
.
MT_SESSION_KEY
.
getValue
());
logger
.
info
(
"code:{}"
,
code
);
logger
.
info
(
"验卷开始"
);
JSONObject
sessionKey
=
new
JSONObject
(
o
);
String
session
=
(
String
)
sessionKey
.
get
(
"access_token"
);
SConsumer
user
=
FrontTokenComponent
.
getWxSConsumerEntry
();
...
...
@@ -238,9 +246,11 @@ public class QPServiceImpl implements QPService {
TuangouReceiptConsume
tuangouReceiptConsume
=
new
TuangouReceiptConsume
(
request
);
TuangouReceiptConsumeResponse
invoke
=
openAPIClient
.
invoke
(
tuangouReceiptConsume
);
if
(
invoke
.
getCode
()
!=
200
)
{
logger
.
error
(
"验卷失败:{}"
,
invoke
.
getMsg
());
throw
new
RuntimeException
(
invoke
.
getMsg
());
}
redisUtil
.
delete
(
ReceiptRdeisEnum
.
PREPARE
.
getValue
()
+
code
);
logger
.
info
(
"验卷结束:{}"
,
invoke
.
getData
());
return
invoke
.
getData
();
}
...
...
share-system/src/main/java/share/system/service/impl/SOrderServiceImpl.java
View file @
561dfd83
...
...
@@ -722,11 +722,12 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
SStore
sStore
=
storeService
.
getById
(
sOrder
.
getStoreId
());
if
(
couponId
!=
null
&&
couponId
>
0
)
{
SConsumerCoupon
consumerCoupon
=
consumerCouponService
.
getById
(
couponId
);
if
(
consumerCoupon
!=
null
)
{
qpService
.
consume
(
consumerCoupon
.
getCouponCode
(),
1
,
sStore
.
getOpenShopUuid
());
consumerCoupon
.
setUseStatus
(
UserStatusEnum
.
USED
.
getCode
());
consumerCouponService
.
updateById
(
consumerCoupon
);
if
(
ObjectUtil
.
isNotEmpty
(
consumerCoupon
))
{
if
(
consumerCoupon
.
getUseStatus
().
equals
(
UserStatusEnum
.
UNUSED
.
getCode
()))
{
qpService
.
consume
(
consumerCoupon
.
getCouponCode
(),
1
,
sStore
.
getOpenShopUuid
());
consumerCoupon
.
setUseStatus
(
UserStatusEnum
.
USED
.
getCode
());
consumerCouponService
.
updateById
(
consumerCoupon
);
}
}
}
//续费成功语音播报
...
...
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