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
cbe72ece
Commit
cbe72ece
authored
Nov 14, 2023
by
吕明尚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新下单,开门
parent
dce6e4f3
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
54 additions
and
33 deletions
+54
-33
SOrderController.java
...in/java/share/web/controller/system/SOrderController.java
+1
-0
RedisTask.java
share-quartz/src/main/java/share/quartz/task/RedisTask.java
+9
-6
SStoreVo.java
...system/src/main/java/share/system/domain/vo/SStoreVo.java
+4
-0
CreateOrderRequest.java
...rc/main/java/share/system/request/CreateOrderRequest.java
+0
-2
QPServiceImpl.java
...rc/main/java/share/system/service/impl/QPServiceImpl.java
+32
-20
SOrderServiceImpl.java
...ain/java/share/system/service/impl/SOrderServiceImpl.java
+8
-5
No files found.
share-front/src/main/java/share/web/controller/system/SOrderController.java
View file @
cbe72ece
...
@@ -53,6 +53,7 @@ public class SOrderController extends BaseController
...
@@ -53,6 +53,7 @@ public class SOrderController extends BaseController
public
TableDataInfo
list
(
SOrder
sOrder
)
public
TableDataInfo
list
(
SOrder
sOrder
)
{
{
startPage
();
startPage
();
sOrder
.
setConsumerId
(
getUserId
());
List
<
SOrder
>
list
=
sOrderService
.
selectSOrderList
(
sOrder
);
List
<
SOrder
>
list
=
sOrderService
.
selectSOrderList
(
sOrder
);
return
getDataTable
(
list
);
return
getDataTable
(
list
);
}
}
...
...
share-quartz/src/main/java/share/quartz/task/RedisTask.java
View file @
cbe72ece
...
@@ -5,12 +5,14 @@ import com.dianping.openapi.sdk.api.oauth.entity.CustomerRefreshTokenResponse;
...
@@ -5,12 +5,14 @@ import com.dianping.openapi.sdk.api.oauth.entity.CustomerRefreshTokenResponse;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
share.common.core.redis.RedisUtil
;
import
share.common.enums.ReceiptRdeisEnum
;
import
share.common.enums.ReceiptRdeisEnum
;
import
share.system.service.ISConsumerCouponService
;
import
share.system.service.ISConsumerCouponService
;
import
share.system.service.QPService
;
import
share.system.service.QPService
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.Set
;
import
java.util.Set
;
import
java.util.concurrent.TimeUnit
;
@Component
(
"redisTask"
)
@Component
(
"redisTask"
)
public
class
RedisTask
{
public
class
RedisTask
{
...
@@ -20,14 +22,16 @@ public class RedisTask {
...
@@ -20,14 +22,16 @@ public class RedisTask {
private
QPService
qpService
;
private
QPService
qpService
;
@Autowired
@Autowired
private
RedisTemplate
redisTemplate
;
private
RedisTemplate
redisTemplate
;
@Autowired
private
RedisUtil
redisUtil
;
public
void
AuToReceiptCode
()
{
public
void
AuToReceiptCode
()
{
//获取redis中所有以tuangou.receipt.prepare开头的key
//获取redis中所有以tuangou.receipt.prepare开头的key
Set
keys
=
redisTemplate
.
keys
(
ReceiptRdeisEnum
.
PREPARE
.
getValue
()
+
"*"
);
Set
<
String
>
keys
=
redisTemplate
.
keys
(
ReceiptRdeisEnum
.
PREPARE
.
getValue
()
+
"*"
);
//遍历key
//遍历key
keys
.
stream
().
forEach
(
o
->
{
keys
.
stream
().
forEach
(
o
->
{
//获取key对应的value
//获取key对应的value
JSONObject
jsonObject
=
(
JSONObject
)
redisTemplate
.
opsForValue
()
.
get
(
o
);
JSONObject
jsonObject
=
redisUtil
.
get
(
o
);
//获取过期时间
//获取过期时间
Date
expirationTime
=
jsonObject
.
getDate
(
"expirationTime"
);
Date
expirationTime
=
jsonObject
.
getDate
(
"expirationTime"
);
//判断是否过期
//判断是否过期
...
@@ -37,7 +41,7 @@ public class RedisTask {
...
@@ -37,7 +41,7 @@ public class RedisTask {
//获取redis中的券码id
//获取redis中的券码id
Long
consumerCouponId
=
jsonObject
.
getLong
(
"consumerCouponId"
);
Long
consumerCouponId
=
jsonObject
.
getLong
(
"consumerCouponId"
);
//删除redis中的值
//删除redis中的值
redis
Template
.
delete
(
o
);
redis
Util
.
delete
(
o
);
//删除数据库中的值
//删除数据库中的值
isConsumerCouponService
.
deleteSConsumerCouponById
(
consumerCouponId
);
isConsumerCouponService
.
deleteSConsumerCouponById
(
consumerCouponId
);
});
});
...
@@ -50,9 +54,8 @@ public class RedisTask {
...
@@ -50,9 +54,8 @@ public class RedisTask {
String
refreshToken
=
(
String
)
o
.
get
(
"refresh_token"
);
String
refreshToken
=
(
String
)
o
.
get
(
"refresh_token"
);
CustomerRefreshTokenResponse
customerRefreshTokenResponse
=
qpService
.
refreshToken
(
refreshToken
);
CustomerRefreshTokenResponse
customerRefreshTokenResponse
=
qpService
.
refreshToken
(
refreshToken
);
JSONObject
jsonObject
=
new
JSONObject
(
customerRefreshTokenResponse
);
JSONObject
jsonObject
=
new
JSONObject
(
customerRefreshTokenResponse
);
redisTemplate
.
opsForValue
().
set
(
ReceiptRdeisEnum
.
MT_SESSION_OBJECT_KEY
.
getValue
(),
jsonObject
.
toString
());
redisUtil
.
set
(
ReceiptRdeisEnum
.
MT_SESSION_OBJECT_KEY
.
getValue
(),
jsonObject
.
toString
());
redisTemplate
.
opsForValue
().
set
(
ReceiptRdeisEnum
.
MT_SESSION_KEY
.
getValue
(),
jsonObject
.
toString
());
redisUtil
.
set
(
ReceiptRdeisEnum
.
MT_SESSION_KEY
.
getValue
(),
jsonObject
.
toString
(),
customerRefreshTokenResponse
.
getExpires_in
()
-
60
*
30
,
TimeUnit
.
SECONDS
);
redisTemplate
.
expire
(
ReceiptRdeisEnum
.
MT_SESSION_KEY
.
getValue
(),
customerRefreshTokenResponse
.
getExpires_in
()
-
60
*
30
,
java
.
util
.
concurrent
.
TimeUnit
.
SECONDS
);
}
}
}
}
}
}
share-system/src/main/java/share/system/domain/vo/SStoreVo.java
View file @
cbe72ece
...
@@ -2,6 +2,7 @@ package share.system.domain.vo;
...
@@ -2,6 +2,7 @@ package share.system.domain.vo;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.Data
;
import
share.common.annotation.Excel
;
import
share.common.core.domain.BaseEntity
;
import
share.common.core.domain.BaseEntity
;
import
java.util.List
;
import
java.util.List
;
...
@@ -74,4 +75,7 @@ public class SStoreVo extends BaseEntity
...
@@ -74,4 +75,7 @@ public class SStoreVo extends BaseEntity
@ApiModelProperty
(
value
=
"房间列表"
)
@ApiModelProperty
(
value
=
"房间列表"
)
private
List
<
SRoomVo
>
roomVoList
;
private
List
<
SRoomVo
>
roomVoList
;
@ApiModelProperty
(
name
=
"美团点评店铺id"
)
private
String
openShopUuid
;
}
}
share-system/src/main/java/share/system/request/CreateOrderRequest.java
View file @
cbe72ece
...
@@ -77,7 +77,5 @@ public class CreateOrderRequest {
...
@@ -77,7 +77,5 @@ public class CreateOrderRequest {
@NotNull
(
message
=
"实际支付金额不能为空"
)
@NotNull
(
message
=
"实际支付金额不能为空"
)
private
BigDecimal
payFee
;
private
BigDecimal
payFee
;
@ApiModelProperty
(
value
=
"劵码"
)
private
String
code
;
}
}
share-system/src/main/java/share/system/service/impl/QPServiceImpl.java
View file @
cbe72ece
...
@@ -25,6 +25,7 @@ import org.springframework.beans.factory.annotation.Value;
...
@@ -25,6 +25,7 @@ import org.springframework.beans.factory.annotation.Value;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer
;
import
org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
share.common.core.redis.RedisUtil
;
import
share.common.enums.*
;
import
share.common.enums.*
;
import
share.common.utils.DateUtils
;
import
share.common.utils.DateUtils
;
import
share.system.domain.SConsumer
;
import
share.system.domain.SConsumer
;
...
@@ -39,6 +40,7 @@ import share.system.service.QPService;
...
@@ -39,6 +40,7 @@ import share.system.service.QPService;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.*
;
import
java.util.concurrent.TimeUnit
;
@Service
@Service
public
class
QPServiceImpl
implements
QPService
{
public
class
QPServiceImpl
implements
QPService
{
...
@@ -53,8 +55,9 @@ public class QPServiceImpl implements QPService {
...
@@ -53,8 +55,9 @@ public class QPServiceImpl implements QPService {
@Autowired
@Autowired
private
ISConsumerCouponService
isConsumerCouponService
;
private
ISConsumerCouponService
isConsumerCouponService
;
@Autowired
@Autowired
private
Redis
Template
redisTemplate
;
private
Redis
Util
redisUtil
;
/**
/**
* 用户验卷接口
* 用户验卷接口
*/
*/
...
@@ -75,7 +78,7 @@ public class QPServiceImpl implements QPService {
...
@@ -75,7 +78,7 @@ public class QPServiceImpl implements QPService {
//领取删除原来的
//领取删除原来的
isConsumerCouponService
.
deleteSConsumerCouponById
(
one
.
getId
());
isConsumerCouponService
.
deleteSConsumerCouponById
(
one
.
getId
());
//删除redis
//删除redis
redis
Template
.
delete
(
ReceiptRdeisEnum
.
PREPARE
.
getValue
()
+
prepare
.
getReceipt_code
());
redis
Util
.
delete
(
ReceiptRdeisEnum
.
PREPARE
.
getValue
()
+
prepare
.
getReceipt_code
());
}
}
//根据优惠卷名称查询优惠劵配置
//根据优惠卷名称查询优惠劵配置
SCoupon
sCoupon
=
isCouponService
.
selectSCouponByName
(
prepare
.
getDeal_title
());
SCoupon
sCoupon
=
isCouponService
.
selectSCouponByName
(
prepare
.
getDeal_title
());
...
@@ -135,7 +138,7 @@ public class QPServiceImpl implements QPService {
...
@@ -135,7 +138,7 @@ public class QPServiceImpl implements QPService {
//设置30分钟后的时间
//设置30分钟后的时间
Date
date
=
DateUtils
.
addMinutes
(
new
Date
(),
30
);
Date
date
=
DateUtils
.
addMinutes
(
new
Date
(),
30
);
map
.
put
(
"expirationTime"
,
String
.
valueOf
(
date
));
map
.
put
(
"expirationTime"
,
String
.
valueOf
(
date
));
redis
Template
.
opsForValue
()
.
set
(
ReceiptRdeisEnum
.
PREPARE
.
getValue
()
+
prepare
.
getReceipt_code
(),
new
JSONObject
(
map
));
redis
Util
.
set
(
ReceiptRdeisEnum
.
PREPARE
.
getValue
()
+
prepare
.
getReceipt_code
(),
new
JSONObject
(
map
));
SimpleDateFormat
format2
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
SimpleDateFormat
format2
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
String
output1
=
format2
.
format
(
prepare
.
getReceiptEndDate
());
String
output1
=
format2
.
format
(
prepare
.
getReceiptEndDate
());
BeanUtils
.
copyProperties
(
prepare
,
response
);
BeanUtils
.
copyProperties
(
prepare
,
response
);
...
@@ -172,7 +175,12 @@ public class QPServiceImpl implements QPService {
...
@@ -172,7 +175,12 @@ public class QPServiceImpl implements QPService {
*/
*/
@Override
@Override
public
TuangouReceiptPrepareResponseEntity
prepare
(
String
code
,
String
openShopUuid
)
{
public
TuangouReceiptPrepareResponseEntity
prepare
(
String
code
,
String
openShopUuid
)
{
JSONObject
sessionKey
=
new
JSONObject
(
redisTemplate
.
opsForValue
().
get
(
ReceiptRdeisEnum
.
MT_SESSION_KEY
.
getValue
()));
Boolean
b
=
redisUtil
.
exists
(
ReceiptRdeisEnum
.
MT_SESSION_KEY
.
getValue
());
if
(
Boolean
.
FALSE
.
equals
(
b
))
{
throw
new
RuntimeException
(
"请联系管理员"
);
}
String
o
=
redisUtil
.
get
(
ReceiptRdeisEnum
.
MT_SESSION_KEY
.
getValue
());
JSONObject
sessionKey
=
new
JSONObject
(
o
);
String
session
=
(
String
)
sessionKey
.
get
(
"access_token"
);
String
session
=
(
String
)
sessionKey
.
get
(
"access_token"
);
TuangouReceiptPrepareRequest
request
=
new
TuangouReceiptPrepareRequest
(
APP_KEY
,
APP_SECRET
,
session
,
code
,
""
,
openShopUuid
);
TuangouReceiptPrepareRequest
request
=
new
TuangouReceiptPrepareRequest
(
APP_KEY
,
APP_SECRET
,
session
,
code
,
""
,
openShopUuid
);
TuangouReceiptPrepare
tuangouReceiptPrepare
=
new
TuangouReceiptPrepare
(
request
);
TuangouReceiptPrepare
tuangouReceiptPrepare
=
new
TuangouReceiptPrepare
(
request
);
...
@@ -190,13 +198,13 @@ public class QPServiceImpl implements QPService {
...
@@ -190,13 +198,13 @@ public class QPServiceImpl implements QPService {
*/
*/
@Override
@Override
public
List
<
TuangouReceiptConsumeResponseEntity
>
consume
(
String
code
,
int
count
,
String
openShopUuid
)
{
public
List
<
TuangouReceiptConsumeResponseEntity
>
consume
(
String
code
,
int
count
,
String
openShopUuid
)
{
JSONObject
sessionKey
=
new
JSONObject
(
redisTemplate
.
opsForValue
().
get
(
ReceiptRdeisEnum
.
MT_SESSION_KEY
.
getValue
()));
String
o
=
redisUtil
.
get
(
ReceiptRdeisEnum
.
MT_SESSION_KEY
.
getValue
());
JSONObject
sessionKey
=
new
JSONObject
(
o
);
String
session
=
(
String
)
sessionKey
.
get
(
"access_token"
);
String
session
=
(
String
)
sessionKey
.
get
(
"access_token"
);
SConsumer
user
=
FrontTokenComponent
.
getWxSConsumerEntry
();
SConsumer
user
=
FrontTokenComponent
.
getWxSConsumerEntry
();
String
requestid
=
UUID
.
randomUUID
().
toString
();
String
requestid
=
UUID
.
randomUUID
().
toString
();
TuangouReceiptConsumeRequest
request
=
new
TuangouReceiptConsumeRequest
(
APP_KEY
,
APP_SECRET
,
session
,
TuangouReceiptConsumeRequest
request
=
new
TuangouReceiptConsumeRequest
(
APP_KEY
,
APP_SECRET
,
session
,
requestid
,
code
,
count
,
openShopUuid
,
requestid
,
code
,
count
,
""
,
user
.
getAccount
(),
user
.
getNickName
(),
openShopUuid
);
user
.
getAccount
(),
user
.
getNickName
());
DefaultOpenAPIClient
openAPIClient
=
new
DefaultOpenAPIClient
();
DefaultOpenAPIClient
openAPIClient
=
new
DefaultOpenAPIClient
();
TuangouReceiptConsume
tuangouReceiptConsume
=
new
TuangouReceiptConsume
(
request
);
TuangouReceiptConsume
tuangouReceiptConsume
=
new
TuangouReceiptConsume
(
request
);
TuangouReceiptConsumeResponse
invoke
=
openAPIClient
.
invoke
(
tuangouReceiptConsume
);
TuangouReceiptConsumeResponse
invoke
=
openAPIClient
.
invoke
(
tuangouReceiptConsume
);
...
@@ -212,12 +220,13 @@ public class QPServiceImpl implements QPService {
...
@@ -212,12 +220,13 @@ public class QPServiceImpl implements QPService {
*/
*/
@Override
@Override
public
List
<
TuangouReceiptReverseConsumeResponseEntity
>
reverseconsume
(
String
code
,
Long
appDealId
,
String
openShopUuid
)
{
public
List
<
TuangouReceiptReverseConsumeResponseEntity
>
reverseconsume
(
String
code
,
Long
appDealId
,
String
openShopUuid
)
{
JSONObject
sessionKey
=
new
JSONObject
(
redisTemplate
.
opsForValue
().
get
(
ReceiptRdeisEnum
.
MT_SESSION_KEY
.
getValue
()));
String
o
=
redisUtil
.
get
(
ReceiptRdeisEnum
.
MT_SESSION_KEY
.
getValue
());
JSONObject
sessionKey
=
new
JSONObject
(
o
);
String
session
=
(
String
)
sessionKey
.
get
(
"access_token"
);
String
session
=
(
String
)
sessionKey
.
get
(
"access_token"
);
SConsumer
user
=
FrontTokenComponent
.
getWxSConsumerEntry
();
SConsumer
user
=
FrontTokenComponent
.
getWxSConsumerEntry
();
TuangouReceiptReverseConsumeRequest
tuangouReceiptReverseConsumeRequest
=
new
TuangouReceiptReverseConsumeRequest
(
APP_KEY
,
APP_SECRET
,
session
,
TuangouReceiptReverseConsumeRequest
tuangouReceiptReverseConsumeRequest
=
new
TuangouReceiptReverseConsumeRequest
(
APP_KEY
,
APP_SECRET
,
session
,
String
.
valueOf
(
appDealId
),
code
,
openShopUuid
,
String
.
valueOf
(
appDealId
),
code
,
""
,
user
.
getAccount
(),
user
.
getNickName
());
user
.
getAccount
(),
user
.
getNickName
()
,
openShopUuid
);
DefaultOpenAPIClient
openAPIClient
=
new
DefaultOpenAPIClient
();
DefaultOpenAPIClient
openAPIClient
=
new
DefaultOpenAPIClient
();
TuangouReceiptReverseConsume
tuangouReceiptReverseConsume
=
new
TuangouReceiptReverseConsume
(
tuangouReceiptReverseConsumeRequest
);
TuangouReceiptReverseConsume
tuangouReceiptReverseConsume
=
new
TuangouReceiptReverseConsume
(
tuangouReceiptReverseConsumeRequest
);
TuangouReceiptReverseConsumeResponse
response
=
openAPIClient
.
invoke
(
tuangouReceiptReverseConsume
);
TuangouReceiptReverseConsumeResponse
response
=
openAPIClient
.
invoke
(
tuangouReceiptReverseConsume
);
...
@@ -233,11 +242,12 @@ public class QPServiceImpl implements QPService {
...
@@ -233,11 +242,12 @@ public class QPServiceImpl implements QPService {
*/
*/
@Override
@Override
public
TuangouReceiptGetConsumedReponseEntity
getconsumed
(
String
code
,
String
openShopUuid
)
{
public
TuangouReceiptGetConsumedReponseEntity
getconsumed
(
String
code
,
String
openShopUuid
)
{
JSONObject
sessionKey
=
new
JSONObject
(
redisTemplate
.
opsForValue
().
get
(
ReceiptRdeisEnum
.
MT_SESSION_KEY
.
getValue
()));
String
o
=
redisUtil
.
get
(
ReceiptRdeisEnum
.
MT_SESSION_KEY
.
getValue
());
JSONObject
sessionKey
=
new
JSONObject
(
o
);
String
session
=
(
String
)
sessionKey
.
get
(
"access_token"
);
String
session
=
(
String
)
sessionKey
.
get
(
"access_token"
);
DefaultOpenAPIClient
openAPIClient
=
new
DefaultOpenAPIClient
();
DefaultOpenAPIClient
openAPIClient
=
new
DefaultOpenAPIClient
();
TuangouReceiptGetConsumedRequest
request
=
new
TuangouReceiptGetConsumedRequest
(
APP_KEY
,
APP_SECRET
,
TuangouReceiptGetConsumedRequest
request
=
new
TuangouReceiptGetConsumedRequest
(
APP_KEY
,
APP_SECRET
,
session
,
code
,
openShopUuid
);
session
,
code
,
""
,
openShopUuid
);
TuangouReceiptGetConsumed
tuangouReceiptGetConsumed
=
new
TuangouReceiptGetConsumed
(
request
);
TuangouReceiptGetConsumed
tuangouReceiptGetConsumed
=
new
TuangouReceiptGetConsumed
(
request
);
TuangouReceiptGetConsumedReponse
response
=
openAPIClient
.
invoke
(
tuangouReceiptGetConsumed
);
TuangouReceiptGetConsumedReponse
response
=
openAPIClient
.
invoke
(
tuangouReceiptGetConsumed
);
if
(
response
.
getCode
()
!=
200
)
{
if
(
response
.
getCode
()
!=
200
)
{
...
@@ -255,9 +265,8 @@ public class QPServiceImpl implements QPService {
...
@@ -255,9 +265,8 @@ public class QPServiceImpl implements QPService {
DynamicTokenResponse
response
=
openAPIClient
.
invoke
(
dynamicToken
);
DynamicTokenResponse
response
=
openAPIClient
.
invoke
(
dynamicToken
);
//response转JSON
//response转JSON
JSONObject
jsonObject
=
new
JSONObject
(
response
);
JSONObject
jsonObject
=
new
JSONObject
(
response
);
redisTemplate
.
opsForValue
().
set
(
ReceiptRdeisEnum
.
MT_SESSION_OBJECT_KEY
.
getValue
(),
jsonObject
.
toString
());
redisUtil
.
set
(
ReceiptRdeisEnum
.
MT_SESSION_OBJECT_KEY
.
getValue
(),
jsonObject
.
toString
());
redisTemplate
.
opsForValue
().
set
(
ReceiptRdeisEnum
.
MT_SESSION_KEY
.
getValue
(),
jsonObject
.
toString
());
redisUtil
.
set
(
ReceiptRdeisEnum
.
MT_SESSION_KEY
.
getValue
(),
jsonObject
.
toString
(),
response
.
getExpires_in
()
-
60
*
30
,
TimeUnit
.
SECONDS
);
redisTemplate
.
expire
(
ReceiptRdeisEnum
.
MT_SESSION_KEY
.
getValue
(),
response
.
getExpires_in
()
-
60
*
30
,
java
.
util
.
concurrent
.
TimeUnit
.
SECONDS
);
return
response
.
getAccess_token
();
return
response
.
getAccess_token
();
}
}
...
@@ -270,7 +279,8 @@ public class QPServiceImpl implements QPService {
...
@@ -270,7 +279,8 @@ public class QPServiceImpl implements QPService {
* @param app_shop_id
* @param app_shop_id
*/
*/
DefaultOpenAPIClient
openAPIClient
=
new
DefaultOpenAPIClient
();
DefaultOpenAPIClient
openAPIClient
=
new
DefaultOpenAPIClient
();
JSONObject
sessionKey
=
new
JSONObject
(
redisTemplate
.
opsForValue
().
get
(
ReceiptRdeisEnum
.
MT_SESSION_KEY
.
getValue
()));
String
o
=
redisUtil
.
get
(
ReceiptRdeisEnum
.
MT_SESSION_KEY
.
getValue
());
JSONObject
sessionKey
=
new
JSONObject
(
o
);
String
session
=
(
String
)
sessionKey
.
get
(
"access_token"
);
String
session
=
(
String
)
sessionKey
.
get
(
"access_token"
);
TuangouDealQueryShopDealRequest
request
=
new
TuangouDealQueryShopDealRequest
(
APP_KEY
,
APP_SECRET
,
session
,
""
,
1
,
100
,
openShopUuid
);
TuangouDealQueryShopDealRequest
request
=
new
TuangouDealQueryShopDealRequest
(
APP_KEY
,
APP_SECRET
,
session
,
""
,
1
,
100
,
openShopUuid
);
TuangouDealQueryShopDeal
tuangouDealQueryShopDeal
=
new
TuangouDealQueryShopDeal
(
request
);
TuangouDealQueryShopDeal
tuangouDealQueryShopDeal
=
new
TuangouDealQueryShopDeal
(
request
);
...
@@ -291,10 +301,11 @@ public class QPServiceImpl implements QPService {
...
@@ -291,10 +301,11 @@ public class QPServiceImpl implements QPService {
@Override
@Override
public
SessionVo
queryKey
()
{
public
SessionVo
queryKey
()
{
JSONObject
o
=
new
JSONObject
(
redisTemplate
.
opsForValue
().
get
(
ReceiptRdeisEnum
.
MT_SESSION_KEY
.
getValue
()));
String
o
=
redisUtil
.
get
(
ReceiptRdeisEnum
.
MT_SESSION_KEY
.
getValue
());
JSONObject
sessionKey
=
new
JSONObject
(
o
);
//获取KEY过期时间
//获取KEY过期时间
Long
expire
=
redis
Template
.
getExpire
(
ReceiptRdeisEnum
.
MT_SESSION_KEY
.
getValue
());
Long
expire
=
redis
Util
.
getExpire
(
ReceiptRdeisEnum
.
MT_SESSION_KEY
.
getValue
());
Integer
remainRefreshCount
=
(
Integer
)
o
.
get
(
"remain_refresh_count"
);
Integer
remainRefreshCount
=
(
Integer
)
sessionKey
.
get
(
"remain_refresh_count"
);
SessionVo
sessionVo
=
new
SessionVo
();
SessionVo
sessionVo
=
new
SessionVo
();
sessionVo
.
setExpiresIn
(
expire
);
sessionVo
.
setExpiresIn
(
expire
);
sessionVo
.
setRemainRefreshCount
(
remainRefreshCount
);
sessionVo
.
setRemainRefreshCount
(
remainRefreshCount
);
...
@@ -309,7 +320,8 @@ public class QPServiceImpl implements QPService {
...
@@ -309,7 +320,8 @@ public class QPServiceImpl implements QPService {
@Override
@Override
public
List
<
CustomerKeyShopScopeResponseEntity
>
scope
()
{
public
List
<
CustomerKeyShopScopeResponseEntity
>
scope
()
{
DefaultOpenAPIClient
openAPIClient
=
new
DefaultOpenAPIClient
();
DefaultOpenAPIClient
openAPIClient
=
new
DefaultOpenAPIClient
();
JSONObject
sessionKey
=
new
JSONObject
(
redisTemplate
.
opsForValue
().
get
(
ReceiptRdeisEnum
.
MT_SESSION_KEY
.
getValue
()));
String
o
=
redisUtil
.
get
(
ReceiptRdeisEnum
.
MT_SESSION_KEY
.
getValue
());
JSONObject
sessionKey
=
new
JSONObject
(
o
);
String
session
=
(
String
)
sessionKey
.
get
(
"access_token"
);
String
session
=
(
String
)
sessionKey
.
get
(
"access_token"
);
String
bid
=
(
String
)
sessionKey
.
get
(
"bid"
);
String
bid
=
(
String
)
sessionKey
.
get
(
"bid"
);
// CustomerKeyShopScopeRequest request = new CustomerKeyShopScopeRequest(APP_KEY, APP_SECRET, "13ff8a38219075fafbbdeea6839450ed6bea1b9b","f1fd23c1c413862137b895bdcfc10ef8");
// CustomerKeyShopScopeRequest request = new CustomerKeyShopScopeRequest(APP_KEY, APP_SECRET, "13ff8a38219075fafbbdeea6839450ed6bea1b9b","f1fd23c1c413862137b895bdcfc10ef8");
...
...
share-system/src/main/java/share/system/service/impl/SOrderServiceImpl.java
View file @
cbe72ece
...
@@ -198,12 +198,15 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper,SOrder> implemen
...
@@ -198,12 +198,15 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper,SOrder> implemen
redisUtil
.
lPush
(
Constants
.
ORDER_AUTO_CANCEL_KEY
,
sOrder
.
getOrderNo
());
redisUtil
.
lPush
(
Constants
.
ORDER_AUTO_CANCEL_KEY
,
sOrder
.
getOrderNo
());
}
}
if
(
response
.
getStatus
().
equals
(
YesNoEnum
.
yes
.
getFlag
()))
{
if
(
response
.
getStatus
().
equals
(
YesNoEnum
.
yes
.
getFlag
()))
{
if
(
Objects
.
nonNull
(
request
.
getCouponId
())
&&
request
.
getCouponId
()
!=
0
)
{
SConsumerCoupon
byId
=
consumerCouponService
.
getById
(
request
.
getCouponId
());
//验劵
qpService
.
consume
(
byId
.
getCouponCode
(),
1
,
sStore
.
getOpenShopUuid
());
SConsumerCoupon
consumerCoupon
=
new
SConsumerCoupon
();
SConsumerCoupon
consumerCoupon
=
new
SConsumerCoupon
();
consumerCoupon
.
setId
(
request
.
getCouponId
());
consumerCoupon
.
setId
(
request
.
getCouponId
());
consumerCoupon
.
setUseStatus
(
UserStatusEnum
.
USED
.
getCode
());
consumerCoupon
.
setUseStatus
(
UserStatusEnum
.
USED
.
getCode
());
consumerCouponService
.
updateById
(
consumerCoupon
);
consumerCouponService
.
updateById
(
consumerCoupon
);
//验劵
}
qpService
.
consume
(
request
.
getCode
(),
1
,
sStore
.
getOpenShopUuid
());
}
}
save
(
sOrder
);
save
(
sOrder
);
return
response
;
return
response
;
...
@@ -512,6 +515,9 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper,SOrder> implemen
...
@@ -512,6 +515,9 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper,SOrder> implemen
throw
new
BaseException
(
"设备不存在!"
);
throw
new
BaseException
(
"设备不存在!"
);
}
}
if
(
sOrder
.
getStatus
().
equals
(
OrderStatusEnum
.
UNUSED
.
getCode
()))
{
if
(
sOrder
.
getStatus
().
equals
(
OrderStatusEnum
.
UNUSED
.
getCode
()))
{
if
(
checkOrderOpenDoor
())
{
throw
new
BaseException
(
"房间当前时段已被占用不可开门!"
);
}
//更改订单状态,房间状态,开始时间,结束时间
//更改订单状态,房间状态,开始时间,结束时间
sOrder
.
setStatus
(
1
);
sOrder
.
setStatus
(
1
);
//计算预约开始和结束时间时长
//计算预约开始和结束时间时长
...
@@ -521,9 +527,6 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper,SOrder> implemen
...
@@ -521,9 +527,6 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper,SOrder> implemen
sOrder
.
setEndDate
(
DateUtils
.
addHours
(
new
Date
(),
bigDecimal
.
intValue
()));
sOrder
.
setEndDate
(
DateUtils
.
addHours
(
new
Date
(),
bigDecimal
.
intValue
()));
sOrderMapper
.
updateById
(
sOrder
);
sOrderMapper
.
updateById
(
sOrder
);
//查询非当前用户,预约时间或使用时间为当前时间的订单,如果存在,房间不可开门
//查询非当前用户,预约时间或使用时间为当前时间的订单,如果存在,房间不可开门
if
(
checkOrderOpenDoor
()){
throw
new
BaseException
(
"房间当前时段已被占用不可开门!"
);
}
}
}
SConsumer
user
=
FrontTokenComponent
.
getWxSConsumerEntry
();
SConsumer
user
=
FrontTokenComponent
.
getWxSConsumerEntry
();
deviceOpService
.
openDoor
(
sRoomVo
.
getId
(),
user
.
getPhone
());
deviceOpService
.
openDoor
(
sRoomVo
.
getId
(),
user
.
getPhone
());
...
...
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