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
e2bb6b23
Commit
e2bb6b23
authored
Nov 13, 2023
by
吕明尚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更改Redis自动任务
parent
c55716fa
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
122 additions
and
63 deletions
+122
-63
QPController.java
...c/main/java/share/web/controller/system/QPController.java
+6
-6
SStoreController.java
...in/java/share/web/controller/system/SStoreController.java
+0
-4
ReceiptRdeisEnum.java
...on/src/main/java/share/common/enums/ReceiptRdeisEnum.java
+2
-2
RedisTask.java
share-quartz/src/main/java/share/quartz/task/RedisTask.java
+4
-4
SessionVo.java
...ystem/src/main/java/share/system/domain/vo/SessionVo.java
+11
-0
DeviceOpService.java
...m/src/main/java/share/system/service/DeviceOpService.java
+2
-2
ISStoreService.java
...em/src/main/java/share/system/service/ISStoreService.java
+2
-0
QPService.java
...-system/src/main/java/share/system/service/QPService.java
+6
-0
DeviceOpServiceImpl.java
...n/java/share/system/service/impl/DeviceOpServiceImpl.java
+8
-8
QPServiceImpl.java
...rc/main/java/share/system/service/impl/QPServiceImpl.java
+49
-35
SOrderServiceImpl.java
...ain/java/share/system/service/impl/SOrderServiceImpl.java
+1
-1
SRoomServiceImpl.java
...main/java/share/system/service/impl/SRoomServiceImpl.java
+1
-1
SStoreServiceImpl.java
...ain/java/share/system/service/impl/SStoreServiceImpl.java
+30
-0
No files found.
share-admin/src/main/java/share/web/controller/system/QPController.java
View file @
e2bb6b23
...
@@ -2,7 +2,6 @@ package share.web.controller.system;
...
@@ -2,7 +2,6 @@ package share.web.controller.system;
import
cn.hutool.json.JSONObject
;
import
cn.hutool.json.JSONObject
;
import
com.baomidou.mybatisplus.core.injector.methods.Insert
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
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
;
...
@@ -12,8 +11,11 @@ import org.springframework.web.bind.annotation.RestController;
...
@@ -12,8 +11,11 @@ import org.springframework.web.bind.annotation.RestController;
import
share.common.core.domain.R
;
import
share.common.core.domain.R
;
import
share.common.enums.ReceiptRdeisEnum
;
import
share.common.enums.ReceiptRdeisEnum
;
import
share.system.domain.vo.SessionVo
;
import
share.system.service.QPService
;
import
share.system.service.QPService
;
import
java.text.SimpleDateFormat
;
@RestController
@RestController
@RequestMapping
(
"/chessCards"
)
@RequestMapping
(
"/chessCards"
)
...
@@ -30,11 +32,8 @@ public class QPController {
...
@@ -30,11 +32,8 @@ public class QPController {
}
}
@GetMapping
(
"/queryKey"
)
@GetMapping
(
"/queryKey"
)
public
R
<
String
>
queryKey
()
{
public
R
<
SessionVo
>
queryKey
()
{
JSONObject
o
=
(
JSONObject
)
redisTemplate
.
opsForValue
().
get
(
ReceiptRdeisEnum
.
MT_SESSION
.
getValue
());
return
R
.
ok
(
qpService
.
queryKey
());
Long
expiresIn
=
(
Long
)
o
.
get
(
"expires_in"
);
Integer
remainRefreshCount
=
(
Integer
)
o
.
get
(
"remain_refresh_count"
);
return
R
.
ok
(
new
JSONObject
().
set
(
"expires_in"
,
expiresIn
).
set
(
"remain_refresh_count"
,
remainRefreshCount
).
toString
());
}
}
}
}
\ No newline at end of file
share-admin/src/main/java/share/web/controller/system/SStoreController.java
View file @
e2bb6b23
...
@@ -181,9 +181,5 @@ public class SStoreController extends BaseController
...
@@ -181,9 +181,5 @@ public class SStoreController extends BaseController
return
toAjax
(
sStoreService
.
insertStoreConsumers
(
storeId
,
consumerIds
));
return
toAjax
(
sStoreService
.
insertStoreConsumers
(
storeId
,
consumerIds
));
}
}
/**
* 数据同步
*/
}
}
share-common/src/main/java/share/common/enums/ReceiptRdeisEnum.java
View file @
e2bb6b23
...
@@ -3,8 +3,8 @@ package share.common.enums;
...
@@ -3,8 +3,8 @@ package share.common.enums;
public
enum
ReceiptRdeisEnum
{
public
enum
ReceiptRdeisEnum
{
//1:验劵准备 2:session换取
//1:验劵准备 2:session换取
PREPARE
(
1
,
"TUANGOU.RECEIPT.PREPARE."
),
PREPARE
(
1
,
"TUANGOU.RECEIPT.PREPARE."
),
SESSION
(
2
,
"MT_SESSION_KEY"
),
MT_SESSION_KEY
(
2
,
"MT_SESSION_KEY"
),
MT_SESSION
(
3
,
"MT_SESSION_OBJECT_KEY"
);
MT_SESSION
_OBJECT_KEY
(
3
,
"MT_SESSION_OBJECT_KEY"
);
private
Integer
code
;
private
Integer
code
;
...
...
share-quartz/src/main/java/share/quartz/task/RedisTask.java
View file @
e2bb6b23
...
@@ -43,13 +43,13 @@ public class RedisTask {
...
@@ -43,13 +43,13 @@ public class RedisTask {
}
}
public
void
AutomaticMtSessionKey
()
{
public
void
AutomaticMtSessionKey
()
{
Boolean
b
=
redisTemplate
.
hasKey
(
ReceiptRdeisEnum
.
SESSION
.
getValue
());
Boolean
b
=
redisTemplate
.
hasKey
(
ReceiptRdeisEnum
.
MT_SESSION_KEY
.
getValue
());
if
(!
b
)
{
if
(!
b
)
{
JSONObject
o
=
(
JSONObject
)
redisTemplate
.
opsForValue
().
get
(
ReceiptRdeisEnum
.
MT_SESSION
.
getValue
());
JSONObject
o
=
(
JSONObject
)
redisTemplate
.
opsForValue
().
get
(
ReceiptRdeisEnum
.
MT_SESSION
_OBJECT_KEY
.
getValue
());
String
refreshToken
=
(
String
)
o
.
get
(
"refresh_token"
);
String
refreshToken
=
(
String
)
o
.
get
(
"refresh_token"
);
CustomerRefreshTokenResponse
customerRefreshTokenResponse
=
qpService
.
refreshToken
(
refreshToken
);
CustomerRefreshTokenResponse
customerRefreshTokenResponse
=
qpService
.
refreshToken
(
refreshToken
);
redisTemplate
.
opsForValue
().
set
(
ReceiptRdeisEnum
.
MT_SESSION
.
getValue
(),
new
JSONObject
(
customerRefreshTokenResponse
));
redisTemplate
.
opsForValue
().
set
(
ReceiptRdeisEnum
.
MT_SESSION
_OBJECT_KEY
.
getValue
(),
new
JSONObject
(
customerRefreshTokenResponse
));
redisTemplate
.
opsForValue
().
set
(
ReceiptRdeisEnum
.
SESSION
.
getValue
(),
new
JSONObject
(
customerRefreshTokenResponse
),
customerRefreshTokenResponse
.
getExpires_in
()
-
60
*
30
);
redisTemplate
.
opsForValue
().
set
(
ReceiptRdeisEnum
.
MT_SESSION_KEY
.
getValue
(),
new
JSONObject
(
customerRefreshTokenResponse
),
customerRefreshTokenResponse
.
getExpires_in
()
-
60
*
30
);
}
}
}
}
}
}
share-system/src/main/java/share/system/domain/vo/SessionVo.java
0 → 100644
View file @
e2bb6b23
package
share
.
system
.
domain
.
vo
;
import
lombok.Data
;
@Data
public
class
SessionVo
{
private
long
expiresIn
;
private
Integer
remainRefreshCount
;
private
String
expirationTime
;
}
share-system/src/main/java/share/system/service/DeviceOpService.java
View file @
e2bb6b23
...
@@ -14,14 +14,14 @@ public interface DeviceOpService {
...
@@ -14,14 +14,14 @@ public interface DeviceOpService {
* 小程序订单开门
* 小程序订单开门
* @param deviceParam
* @param deviceParam
*/
*/
void
openDoor
(
DeviceParamVo
deviceParam
,
String
userName
);
void
openDoor
(
DeviceParamVo
deviceParam
);
/**
/**
* 小程序订单开门
* 小程序订单开门
* @param roomId 房间id
* @param roomId 房间id
* @param phone 操作用户
* @param phone 操作用户
*/
*/
void
openDoor
(
Long
roomId
,
String
phone
,
String
userName
);
void
openDoor
(
Long
roomId
,
String
phone
);
/**
/**
* 清除网关锁id列表
* 清除网关锁id列表
...
...
share-system/src/main/java/share/system/service/ISStoreService.java
View file @
e2bb6b23
...
@@ -95,4 +95,6 @@ public interface ISStoreService extends IService<SStore>
...
@@ -95,4 +95,6 @@ public interface ISStoreService extends IService<SStore>
int
insertStoreConsumers
(
Long
storeId
,
Long
[]
consumerIds
);
int
insertStoreConsumers
(
Long
storeId
,
Long
[]
consumerIds
);
List
<
SStore
>
listVoByCleaner
();
List
<
SStore
>
listVoByCleaner
();
int
dataSync
();
}
}
share-system/src/main/java/share/system/service/QPService.java
View file @
e2bb6b23
package
share
.
system
.
service
;
package
share
.
system
.
service
;
import
com.dianping.openapi.sdk.api.customerauth.session.entity.CustomerKeyShopScopeResponseEntity
;
import
com.dianping.openapi.sdk.api.oauth.entity.CustomerRefreshTokenResponse
;
import
com.dianping.openapi.sdk.api.oauth.entity.CustomerRefreshTokenResponse
;
import
com.dianping.openapi.sdk.api.tuangou.entity.*
;
import
com.dianping.openapi.sdk.api.tuangou.entity.*
;
import
share.system.domain.vo.SessionVo
;
import
share.system.domain.vo.TuangouReceiptPrepareResponseEntityVo
;
import
share.system.domain.vo.TuangouReceiptPrepareResponseEntityVo
;
import
java.util.List
;
import
java.util.List
;
...
@@ -24,4 +26,8 @@ public interface QPService {
...
@@ -24,4 +26,8 @@ public interface QPService {
List
<
TuangouDealQueryShopDealResponseEntity
>
queryshopdeal
(
String
openShopUuid
);
List
<
TuangouDealQueryShopDealResponseEntity
>
queryshopdeal
(
String
openShopUuid
);
CustomerRefreshTokenResponse
refreshToken
(
String
newToken
);
CustomerRefreshTokenResponse
refreshToken
(
String
newToken
);
SessionVo
queryKey
();
List
<
CustomerKeyShopScopeResponseEntity
>
scope
();
}
}
share-system/src/main/java/share/system/service/impl/DeviceOpServiceImpl.java
View file @
e2bb6b23
...
@@ -40,7 +40,7 @@ public class DeviceOpServiceImpl implements DeviceOpService {
...
@@ -40,7 +40,7 @@ public class DeviceOpServiceImpl implements DeviceOpService {
* 小程序订单开门
* 小程序订单开门
* @param deviceParam
* @param deviceParam
*/
*/
public
void
openDoor
(
DeviceParamVo
deviceParam
,
String
userName
)
{
public
void
openDoor
(
DeviceParamVo
deviceParam
)
{
SRoom
room
=
roomMapper
.
selectSRoomById
(
deviceParam
.
getRoomId
());
SRoom
room
=
roomMapper
.
selectSRoomById
(
deviceParam
.
getRoomId
());
if
(
room
!=
null
)
{
if
(
room
!=
null
)
{
Device
param
=
new
Device
();
Device
param
=
new
Device
();
...
@@ -49,11 +49,11 @@ public class DeviceOpServiceImpl implements DeviceOpService {
...
@@ -49,11 +49,11 @@ public class DeviceOpServiceImpl implements DeviceOpService {
for
(
Device
device
:
list
)
{
for
(
Device
device
:
list
)
{
if
(
DeviceType
.
DEVICE_CCEE
.
getCode
().
equals
(
device
.
getDevType
()))
{
if
(
DeviceType
.
DEVICE_CCEE
.
getCode
().
equals
(
device
.
getDevType
()))
{
// 门锁
// 门锁
this
.
deviceOpInit
(
device
.
getDevId
(),
deviceParam
.
getPhone
(),
"10"
,
userName
);
this
.
deviceOpInit
(
device
.
getDevId
(),
deviceParam
.
getPhone
(),
"10"
);
}
}
if
(
DeviceType
.
DEVICE_0001
.
getCode
().
equals
(
device
.
getDevType
()))
{
if
(
DeviceType
.
DEVICE_0001
.
getCode
().
equals
(
device
.
getDevType
()))
{
// 取电开关
// 取电开关
this
.
deviceOpInit
(
device
.
getDevId
(),
deviceParam
.
getPhone
(),
"20"
,
userName
);
this
.
deviceOpInit
(
device
.
getDevId
(),
deviceParam
.
getPhone
(),
"20"
);
}
}
}
}
...
@@ -65,7 +65,7 @@ public class DeviceOpServiceImpl implements DeviceOpService {
...
@@ -65,7 +65,7 @@ public class DeviceOpServiceImpl implements DeviceOpService {
* @param roomId 房间id
* @param roomId 房间id
* @param phone 操作用户
* @param phone 操作用户
*/
*/
public
void
openDoor
(
Long
roomId
,
String
phone
,
String
userName
)
{
public
void
openDoor
(
Long
roomId
,
String
phone
)
{
SRoom
room
=
roomMapper
.
selectSRoomById
(
roomId
);
SRoom
room
=
roomMapper
.
selectSRoomById
(
roomId
);
if
(
room
!=
null
)
{
if
(
room
!=
null
)
{
Device
param
=
new
Device
();
Device
param
=
new
Device
();
...
@@ -74,24 +74,24 @@ public class DeviceOpServiceImpl implements DeviceOpService {
...
@@ -74,24 +74,24 @@ public class DeviceOpServiceImpl implements DeviceOpService {
for
(
Device
device
:
list
)
{
for
(
Device
device
:
list
)
{
if
(
DeviceType
.
DEVICE_CCEE
.
getCode
().
equals
(
device
.
getDevType
()))
{
if
(
DeviceType
.
DEVICE_CCEE
.
getCode
().
equals
(
device
.
getDevType
()))
{
// 门锁
// 门锁
this
.
deviceOpInit
(
device
.
getDevId
(),
phone
,
"10"
,
userName
);
this
.
deviceOpInit
(
device
.
getDevId
(),
phone
,
"10"
);
}
}
if
(
DeviceType
.
DEVICE_0001
.
getCode
().
equals
(
device
.
getDevType
()))
{
if
(
DeviceType
.
DEVICE_0001
.
getCode
().
equals
(
device
.
getDevType
()))
{
// 取电开关
// 取电开关
this
.
deviceOpInit
(
device
.
getDevId
(),
phone
,
"20"
,
userName
);
this
.
deviceOpInit
(
device
.
getDevId
(),
phone
,
"20"
);
}
}
}
}
}
}
}
}
private
void
deviceOpInit
(
String
devId
,
String
phone
,
String
opType
,
String
userName
)
{
private
void
deviceOpInit
(
String
devId
,
String
phone
,
String
opType
)
{
// 获取mqtt的topic、payload
// 获取mqtt的topic、payload
MqttxVo
mqttxVo
=
mqttxService
.
openOrCloseDevice
(
devId
,
phone
,
opType
);
MqttxVo
mqttxVo
=
mqttxService
.
openOrCloseDevice
(
devId
,
phone
,
opType
);
// 发送mqtt消息
// 发送mqtt消息
mqttGatewayComponent
.
sendToMqtt
(
mqttxVo
.
getTopic
(),
0
,
mqttxVo
.
getPayload
());
mqttGatewayComponent
.
sendToMqtt
(
mqttxVo
.
getTopic
(),
0
,
mqttxVo
.
getPayload
());
// 写日志记录
// 写日志记录
deviceLogService
.
addDeviceLog
(
mqttxVo
,
userNam
e
);
deviceLogService
.
addDeviceLog
(
mqttxVo
,
phon
e
);
}
}
/**
/**
...
...
share-system/src/main/java/share/system/service/impl/QPServiceImpl.java
View file @
e2bb6b23
...
@@ -3,6 +3,10 @@ package share.system.service.impl;
...
@@ -3,6 +3,10 @@ package share.system.service.impl;
import
cn.hutool.json.JSONObject
;
import
cn.hutool.json.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.dianping.openapi.sdk.api.customerauth.session.CustomerKeyShopScopeQuery
;
import
com.dianping.openapi.sdk.api.customerauth.session.entity.CustomerKeyShopScopeRequest
;
import
com.dianping.openapi.sdk.api.customerauth.session.entity.CustomerKeyShopScopeResponse
;
import
com.dianping.openapi.sdk.api.customerauth.session.entity.CustomerKeyShopScopeResponseEntity
;
import
com.dianping.openapi.sdk.api.oauth.CustomerRefreshToken
;
import
com.dianping.openapi.sdk.api.oauth.CustomerRefreshToken
;
import
com.dianping.openapi.sdk.api.oauth.DynamicToken
;
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.CustomerRefreshTokenResponse
;
...
@@ -20,20 +24,18 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -20,20 +24,18 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.data.redis.core.RedisTemplate
;
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.Device
;
import
share.system.domain.SConsumer
;
import
share.system.domain.SConsumer
;
import
share.system.domain.SConsumerCoupon
;
import
share.system.domain.SConsumerCoupon
;
import
share.system.domain.SCoupon
;
import
share.system.domain.SCoupon
;
import
share.system.domain.vo.FrontTokenComponent
;
import
share.system.domain.vo.FrontTokenComponent
;
import
share.system.domain.vo.SessionVo
;
import
share.system.domain.vo.TuangouReceiptPrepareResponseEntityVo
;
import
share.system.domain.vo.TuangouReceiptPrepareResponseEntityVo
;
import
share.system.service.ISConsumerCouponService
;
import
share.system.service.ISConsumerCouponService
;
import
share.system.service.ISCouponService
;
import
share.system.service.ISCouponService
;
import
share.system.service.QPService
;
import
share.system.service.QPService
;
import
java.math.BigDecimal
;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.*
;
...
@@ -60,43 +62,25 @@ public class QPServiceImpl implements QPService {
...
@@ -60,43 +62,25 @@ public class QPServiceImpl implements QPService {
public
TuangouReceiptPrepareResponseEntityVo
consumeByUser
(
String
code
,
String
openShopUuid
)
{
public
TuangouReceiptPrepareResponseEntityVo
consumeByUser
(
String
code
,
String
openShopUuid
)
{
//验券准备
//验券准备
TuangouReceiptPrepareResponseEntity
prepare
=
prepare
(
code
,
openShopUuid
);
TuangouReceiptPrepareResponseEntity
prepare
=
prepare
(
code
,
openShopUuid
);
//根据优惠卷名称查询优惠劵配置
SCoupon
sCoupon
=
isCouponService
.
selectSCouponByName
(
prepare
.
getDeal_title
());
if
(
sCoupon
==
null
)
{
throw
new
RuntimeException
(
"未找到对应的优惠券"
);
}
//获取用户信息
//获取用户信息
SConsumer
user
=
FrontTokenComponent
.
getWxSConsumerEntry
();
SConsumer
user
=
FrontTokenComponent
.
getWxSConsumerEntry
();
TuangouReceiptPrepareResponseEntityVo
response
=
new
TuangouReceiptPrepareResponseEntityVo
();
//查询领取记录表
//查询领取记录表
LambdaQueryWrapper
<
SConsumerCoupon
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
LambdaQueryWrapper
<
SConsumerCoupon
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
SConsumerCoupon:
:
getDealId
,
prepare
.
getDeal_id
());
queryWrapper
.
eq
(
SConsumerCoupon:
:
getDealId
,
prepare
.
getDeal_id
());
queryWrapper
.
eq
(
SConsumerCoupon:
:
getCouponCode
,
code
);
queryWrapper
.
eq
(
SConsumerCoupon:
:
getConsumerId
,
user
.
getId
());
queryWrapper
.
eq
(
SConsumerCoupon:
:
getConsumerId
,
user
.
getId
());
SConsumerCoupon
one
=
isConsumerCouponService
.
getOne
(
queryWrapper
);
SConsumerCoupon
one
=
isConsumerCouponService
.
getOne
(
queryWrapper
);
//判断是否领取过
//判断是否领取过
if
(
ObjectUtils
.
isEmpty
(
one
))
{
if
(
ObjectUtils
.
is
Not
Empty
(
one
))
{
//领取删除原来的
//领取删除原来的
isConsumerCouponService
.
deleteSConsumerCouponById
(
one
.
getId
());
isConsumerCouponService
.
deleteSConsumerCouponById
(
one
.
getId
());
//判断redis键是否存在
//删除redis
if
(
Boolean
.
TRUE
.
equals
(
redisTemplate
.
hasKey
(
ReceiptRdeisEnum
.
PREPARE
.
getValue
()
+
prepare
.
getReceipt_code
())))
{
//获取redis中的值
JSONObject
jsonObject
=
(
JSONObject
)
redisTemplate
.
opsForValue
().
get
(
prepare
.
getReceipt_code
());
//获取过期时间
Date
expirationTime
=
jsonObject
.
getDate
(
"expirationTime"
);
//判断是否过期
if
(
expirationTime
.
getTime
()
<
new
Date
().
getTime
())
{
throw
new
RuntimeException
(
"券码已过期"
);
}
//获取redis中的券码id
Long
consumerCouponId
=
jsonObject
.
getLong
(
"consumerCouponId"
);
//删除redis中的值
redisTemplate
.
delete
(
ReceiptRdeisEnum
.
PREPARE
.
getValue
()
+
prepare
.
getReceipt_code
());
redisTemplate
.
delete
(
ReceiptRdeisEnum
.
PREPARE
.
getValue
()
+
prepare
.
getReceipt_code
());
//删除数据库中的值
isConsumerCouponService
.
deleteSConsumerCouponById
(
consumerCouponId
);
}
}
}
//根据优惠卷名称查询优惠劵配置
if
(
ObjectUtils
.
isNotEmpty
(
sCoupon
))
{
SCoupon
sCoupon
=
isCouponService
.
selectSCouponByName
(
prepare
.
getDeal_title
());
TuangouReceiptPrepareResponseEntityVo
response
=
new
TuangouReceiptPrepareResponseEntityVo
();
if
(
ObjectUtils
.
isEmpty
(
sCoupon
))
{
SConsumerCoupon
sConsumerCoupon
=
new
SConsumerCoupon
();
SConsumerCoupon
sConsumerCoupon
=
new
SConsumerCoupon
();
sConsumerCoupon
.
setDealId
(
prepare
.
getDeal_id
());
sConsumerCoupon
.
setDealId
(
prepare
.
getDeal_id
());
sConsumerCoupon
.
setCouponCode
(
code
);
sConsumerCoupon
.
setCouponCode
(
code
);
...
@@ -188,7 +172,7 @@ public class QPServiceImpl implements QPService {
...
@@ -188,7 +172,7 @@ public class QPServiceImpl implements QPService {
*/
*/
@Override
@Override
public
TuangouReceiptPrepareResponseEntity
prepare
(
String
code
,
String
openShopUuid
)
{
public
TuangouReceiptPrepareResponseEntity
prepare
(
String
code
,
String
openShopUuid
)
{
JSONObject
sessionKey
=
(
JSONObject
)
redisTemplate
.
opsForValue
().
get
(
ReceiptRdeisEnum
.
MT_SESSION
.
getValue
());
JSONObject
sessionKey
=
(
JSONObject
)
redisTemplate
.
opsForValue
().
get
(
ReceiptRdeisEnum
.
MT_SESSION
_KEY
.
getValue
());
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
);
...
@@ -206,7 +190,7 @@ public class QPServiceImpl implements QPService {
...
@@ -206,7 +190,7 @@ 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
=
(
JSONObject
)
redisTemplate
.
opsForValue
().
get
(
ReceiptRdeisEnum
.
MT_SESSION
.
getValue
());
JSONObject
sessionKey
=
(
JSONObject
)
redisTemplate
.
opsForValue
().
get
(
ReceiptRdeisEnum
.
MT_SESSION
_KEY
.
getValue
());
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
();
...
@@ -228,7 +212,7 @@ public class QPServiceImpl implements QPService {
...
@@ -228,7 +212,7 @@ 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
=
(
JSONObject
)
redisTemplate
.
opsForValue
().
get
(
ReceiptRdeisEnum
.
MT_SESSION
.
getValue
());
JSONObject
sessionKey
=
(
JSONObject
)
redisTemplate
.
opsForValue
().
get
(
ReceiptRdeisEnum
.
MT_SESSION
_KEY
.
getValue
());
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
,
...
@@ -249,7 +233,7 @@ public class QPServiceImpl implements QPService {
...
@@ -249,7 +233,7 @@ public class QPServiceImpl implements QPService {
*/
*/
@Override
@Override
public
TuangouReceiptGetConsumedReponseEntity
getconsumed
(
String
code
,
String
openShopUuid
)
{
public
TuangouReceiptGetConsumedReponseEntity
getconsumed
(
String
code
,
String
openShopUuid
)
{
JSONObject
sessionKey
=
(
JSONObject
)
redisTemplate
.
opsForValue
().
get
(
ReceiptRdeisEnum
.
MT_SESSION
.
getValue
());
JSONObject
sessionKey
=
(
JSONObject
)
redisTemplate
.
opsForValue
().
get
(
ReceiptRdeisEnum
.
MT_SESSION
_KEY
.
getValue
());
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
,
...
@@ -269,8 +253,8 @@ public class QPServiceImpl implements QPService {
...
@@ -269,8 +253,8 @@ public class QPServiceImpl implements QPService {
APP_SECRET
,
GrantType
.
AUTHORIZATION_CODE
.
getValue
(),
authCode
);
APP_SECRET
,
GrantType
.
AUTHORIZATION_CODE
.
getValue
(),
authCode
);
DynamicToken
dynamicToken
=
new
DynamicToken
(
request
);
DynamicToken
dynamicToken
=
new
DynamicToken
(
request
);
DynamicTokenResponse
response
=
openAPIClient
.
invoke
(
dynamicToken
);
DynamicTokenResponse
response
=
openAPIClient
.
invoke
(
dynamicToken
);
redisTemplate
.
opsForValue
().
set
(
ReceiptRdeisEnum
.
MT_SESSION
.
getValue
(),
new
JSONObject
(
response
));
redisTemplate
.
opsForValue
().
set
(
ReceiptRdeisEnum
.
MT_SESSION
_OBJECT_KEY
.
getValue
(),
new
JSONObject
(
response
));
redisTemplate
.
opsForValue
().
set
(
ReceiptRdeisEnum
.
SESSION
.
getValue
(),
new
JSONObject
(
response
),
response
.
getExpires_in
()
-
60
*
30
);
redisTemplate
.
opsForValue
().
set
(
ReceiptRdeisEnum
.
MT_SESSION_KEY
.
getValue
(),
new
JSONObject
(
response
),
response
.
getExpires_in
()
-
60
*
30
);
return
response
.
getAccess_token
();
return
response
.
getAccess_token
();
}
}
...
@@ -283,7 +267,7 @@ public class QPServiceImpl implements QPService {
...
@@ -283,7 +267,7 @@ public class QPServiceImpl implements QPService {
* @param app_shop_id
* @param app_shop_id
*/
*/
DefaultOpenAPIClient
openAPIClient
=
new
DefaultOpenAPIClient
();
DefaultOpenAPIClient
openAPIClient
=
new
DefaultOpenAPIClient
();
JSONObject
sessionKey
=
(
JSONObject
)
redisTemplate
.
opsForValue
().
get
(
ReceiptRdeisEnum
.
MT_SESSION
.
getValue
());
JSONObject
sessionKey
=
(
JSONObject
)
redisTemplate
.
opsForValue
().
get
(
ReceiptRdeisEnum
.
MT_SESSION
_KEY
.
getValue
());
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
);
...
@@ -302,4 +286,34 @@ public class QPServiceImpl implements QPService {
...
@@ -302,4 +286,34 @@ public class QPServiceImpl implements QPService {
return
response
;
return
response
;
}
}
@Override
public
SessionVo
queryKey
()
{
JSONObject
o
=
(
JSONObject
)
redisTemplate
.
opsForValue
().
get
(
ReceiptRdeisEnum
.
MT_SESSION_OBJECT_KEY
.
getValue
());
Long
expiresIn
=
(
Long
)
o
.
get
(
"expires_in"
);
Integer
remainRefreshCount
=
(
Integer
)
o
.
get
(
"remain_refresh_count"
);
SessionVo
sessionVo
=
new
SessionVo
();
sessionVo
.
setExpiresIn
(
expiresIn
);
sessionVo
.
setRemainRefreshCount
(
remainRefreshCount
);
Date
date
=
DateUtils
.
addSeconds
(
new
Date
(),
expiresIn
.
intValue
()
-
60
*
30
);
SimpleDateFormat
format2
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
String
output1
=
format2
.
format
(
date
);
TuangouReceiptPrepareResponseEntityVo
vo
=
new
TuangouReceiptPrepareResponseEntityVo
();
vo
.
setExpirationTime
(
output1
);
return
sessionVo
;
}
@Override
public
List
<
CustomerKeyShopScopeResponseEntity
>
scope
()
{
DefaultOpenAPIClient
openAPIClient
=
new
DefaultOpenAPIClient
();
JSONObject
sessionKey
=
(
JSONObject
)
redisTemplate
.
opsForValue
().
get
(
ReceiptRdeisEnum
.
MT_SESSION_KEY
.
getValue
());
String
session
=
(
String
)
sessionKey
.
get
(
"access_token"
);
String
bid
=
(
String
)
sessionKey
.
get
(
"bid"
);
// CustomerKeyShopScopeRequest request = new CustomerKeyShopScopeRequest(APP_KEY, APP_SECRET, "13ff8a38219075fafbbdeea6839450ed6bea1b9b","f1fd23c1c413862137b895bdcfc10ef8");
CustomerKeyShopScopeRequest
request
=
new
CustomerKeyShopScopeRequest
(
APP_KEY
,
APP_SECRET
,
session
,
bid
);
CustomerKeyShopScopeQuery
shopScopeQuery
=
new
CustomerKeyShopScopeQuery
(
request
);
CustomerKeyShopScopeResponse
response
=
openAPIClient
.
invoke
(
shopScopeQuery
);
return
response
.
getData
();
}
}
}
share-system/src/main/java/share/system/service/impl/SOrderServiceImpl.java
View file @
e2bb6b23
...
@@ -526,7 +526,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper,SOrder> implemen
...
@@ -526,7 +526,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper,SOrder> implemen
}
}
}
}
SConsumer
user
=
FrontTokenComponent
.
getWxSConsumerEntry
();
SConsumer
user
=
FrontTokenComponent
.
getWxSConsumerEntry
();
deviceOpService
.
openDoor
(
sRoomVo
.
getId
(),
user
.
getPhone
()
,
user
.
getNickName
()
);
deviceOpService
.
openDoor
(
sRoomVo
.
getId
(),
user
.
getPhone
());
return
"开锁成功"
;
return
"开锁成功"
;
}
}
...
...
share-system/src/main/java/share/system/service/impl/SRoomServiceImpl.java
View file @
e2bb6b23
...
@@ -234,7 +234,7 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper, SRoom> implements
...
@@ -234,7 +234,7 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper, SRoom> implements
if
(
Objects
.
isNull
(
one
))
{
if
(
Objects
.
isNull
(
one
))
{
throw
new
BaseException
(
"设备不存在!"
);
throw
new
BaseException
(
"设备不存在!"
);
}
}
deviceOpService
.
openDoor
(
id
,
user
.
getPhone
()
,
user
.
getNickName
()
);
deviceOpService
.
openDoor
(
id
,
user
.
getPhone
());
return
"开锁成功"
;
return
"开锁成功"
;
}
}
...
...
share-system/src/main/java/share/system/service/impl/SStoreServiceImpl.java
View file @
e2bb6b23
...
@@ -4,6 +4,8 @@ import java.util.*;
...
@@ -4,6 +4,8 @@ import java.util.*;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.dianping.openapi.sdk.api.customerauth.session.entity.CustomerKeyShopScopeResponseEntity
;
import
lombok.var
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.poi.hssf.record.DVALRecord
;
import
org.apache.poi.hssf.record.DVALRecord
;
...
@@ -29,6 +31,7 @@ import share.system.request.SStoreRequest;
...
@@ -29,6 +31,7 @@ import share.system.request.SStoreRequest;
import
share.system.service.IPackService
;
import
share.system.service.IPackService
;
import
share.system.service.ISRoomService
;
import
share.system.service.ISRoomService
;
import
share.system.service.ISStoreService
;
import
share.system.service.ISStoreService
;
import
share.system.service.QPService
;
/**
/**
* 门店Service业务层处理
* 门店Service业务层处理
...
@@ -48,6 +51,8 @@ public class SStoreServiceImpl extends ServiceImpl<SStoreMapper, SStore> impleme
...
@@ -48,6 +51,8 @@ public class SStoreServiceImpl extends ServiceImpl<SStoreMapper, SStore> impleme
private
RoomPackMapper
roomPackMapper
;
private
RoomPackMapper
roomPackMapper
;
@Autowired
@Autowired
private
IPackService
packService
;
private
IPackService
packService
;
@Autowired
private
QPService
qpService
;
/**
/**
* 查询门店
* 查询门店
...
@@ -280,6 +285,31 @@ public class SStoreServiceImpl extends ServiceImpl<SStoreMapper, SStore> impleme
...
@@ -280,6 +285,31 @@ public class SStoreServiceImpl extends ServiceImpl<SStoreMapper, SStore> impleme
return
storeList
;
return
storeList
;
}
}
@Override
public
int
dataSync
()
{
List
<
SStore
>
sStores
=
sStoreMapper
.
selectSStoreList
(
new
SStore
());
//查询美团接口查看改门店是否存在
List
<
CustomerKeyShopScopeResponseEntity
>
scope
=
qpService
.
scope
();
if
(
CollectionUtils
.
isEmpty
(
scope
))
{
return
0
;
//美团接口查不到门店信息,直接返回0,不同步门店信息。
}
//获取差集
List
<
SStore
>
collect
=
sStores
.
stream
().
filter
(
item
->
{
boolean
flag
=
true
;
for
(
CustomerKeyShopScopeResponseEntity
entity
:
scope
)
{
if
(
item
.
getName
().
equals
(
entity
.
getShopname
()
+
"("
+
entity
.
getBranchname
()
+
")"
))
{
flag
=
false
;
break
;
}
}
return
flag
;
}).
collect
(
Collectors
.
toList
());
if
(
CollectionUtils
.
isNotEmpty
(
collect
))
{
return
collect
.
size
();
}
return
0
;
}
private
List
<
Map
>
convertOptionList
(
List
<
SStore
>
storeList
)
{
private
List
<
Map
>
convertOptionList
(
List
<
SStore
>
storeList
)
{
List
<
Map
>
result
=
new
ArrayList
<>();
List
<
Map
>
result
=
new
ArrayList
<>();
if
(
CollectionUtils
.
isNotEmpty
(
storeList
))
{
if
(
CollectionUtils
.
isNotEmpty
(
storeList
))
{
...
...
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