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
Expand all
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;
import
cn.hutool.json.JSONObject
;
import
com.baomidou.mybatisplus.core.injector.methods.Insert
;
import
io.swagger.annotations.Api
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.redis.core.RedisTemplate
;
...
...
@@ -12,8 +11,11 @@ import org.springframework.web.bind.annotation.RestController;
import
share.common.core.domain.R
;
import
share.common.enums.ReceiptRdeisEnum
;
import
share.system.domain.vo.SessionVo
;
import
share.system.service.QPService
;
import
java.text.SimpleDateFormat
;
@RestController
@RequestMapping
(
"/chessCards"
)
...
...
@@ -30,11 +32,8 @@ public class QPController {
}
@GetMapping
(
"/queryKey"
)
public
R
<
String
>
queryKey
()
{
JSONObject
o
=
(
JSONObject
)
redisTemplate
.
opsForValue
().
get
(
ReceiptRdeisEnum
.
MT_SESSION
.
getValue
());
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
());
public
R
<
SessionVo
>
queryKey
()
{
return
R
.
ok
(
qpService
.
queryKey
());
}
}
\ 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
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;
public
enum
ReceiptRdeisEnum
{
//1:验劵准备 2:session换取
PREPARE
(
1
,
"TUANGOU.RECEIPT.PREPARE."
),
SESSION
(
2
,
"MT_SESSION_KEY"
),
MT_SESSION
(
3
,
"MT_SESSION_OBJECT_KEY"
);
MT_SESSION_KEY
(
2
,
"MT_SESSION_KEY"
),
MT_SESSION
_OBJECT_KEY
(
3
,
"MT_SESSION_OBJECT_KEY"
);
private
Integer
code
;
...
...
share-quartz/src/main/java/share/quartz/task/RedisTask.java
View file @
e2bb6b23
...
...
@@ -43,13 +43,13 @@ public class RedisTask {
}
public
void
AutomaticMtSessionKey
()
{
Boolean
b
=
redisTemplate
.
hasKey
(
ReceiptRdeisEnum
.
SESSION
.
getValue
());
Boolean
b
=
redisTemplate
.
hasKey
(
ReceiptRdeisEnum
.
MT_SESSION_KEY
.
getValue
());
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"
);
CustomerRefreshTokenResponse
customerRefreshTokenResponse
=
qpService
.
refreshToken
(
refreshToken
);
redisTemplate
.
opsForValue
().
set
(
ReceiptRdeisEnum
.
MT_SESSION
.
getValue
(),
new
JSONObject
(
customerRefreshTokenResponse
));
redisTemplate
.
opsForValue
().
set
(
ReceiptRdeisEnum
.
SESSION
.
getValue
(),
new
JSONObject
(
customerRefreshTokenResponse
),
customerRefreshTokenResponse
.
getExpires_in
()
-
60
*
30
);
redisTemplate
.
opsForValue
().
set
(
ReceiptRdeisEnum
.
MT_SESSION
_OBJECT_KEY
.
getValue
(),
new
JSONObject
(
customerRefreshTokenResponse
));
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 {
* 小程序订单开门
* @param deviceParam
*/
void
openDoor
(
DeviceParamVo
deviceParam
,
String
userName
);
void
openDoor
(
DeviceParamVo
deviceParam
);
/**
* 小程序订单开门
* @param roomId 房间id
* @param phone 操作用户
*/
void
openDoor
(
Long
roomId
,
String
phone
,
String
userName
);
void
openDoor
(
Long
roomId
,
String
phone
);
/**
* 清除网关锁id列表
...
...
share-system/src/main/java/share/system/service/ISStoreService.java
View file @
e2bb6b23
...
...
@@ -95,4 +95,6 @@ public interface ISStoreService extends IService<SStore>
int
insertStoreConsumers
(
Long
storeId
,
Long
[]
consumerIds
);
List
<
SStore
>
listVoByCleaner
();
int
dataSync
();
}
share-system/src/main/java/share/system/service/QPService.java
View file @
e2bb6b23
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.tuangou.entity.*
;
import
share.system.domain.vo.SessionVo
;
import
share.system.domain.vo.TuangouReceiptPrepareResponseEntityVo
;
import
java.util.List
;
...
...
@@ -24,4 +26,8 @@ public interface QPService {
List
<
TuangouDealQueryShopDealResponseEntity
>
queryshopdeal
(
String
openShopUuid
);
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 {
* 小程序订单开门
* @param deviceParam
*/
public
void
openDoor
(
DeviceParamVo
deviceParam
,
String
userName
)
{
public
void
openDoor
(
DeviceParamVo
deviceParam
)
{
SRoom
room
=
roomMapper
.
selectSRoomById
(
deviceParam
.
getRoomId
());
if
(
room
!=
null
)
{
Device
param
=
new
Device
();
...
...
@@ -49,11 +49,11 @@ public class DeviceOpServiceImpl implements DeviceOpService {
for
(
Device
device
:
list
)
{
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
()))
{
// 取电开关
this
.
deviceOpInit
(
device
.
getDevId
(),
deviceParam
.
getPhone
(),
"20"
,
userName
);
this
.
deviceOpInit
(
device
.
getDevId
(),
deviceParam
.
getPhone
(),
"20"
);
}
}
...
...
@@ -65,7 +65,7 @@ public class DeviceOpServiceImpl implements DeviceOpService {
* @param roomId 房间id
* @param phone 操作用户
*/
public
void
openDoor
(
Long
roomId
,
String
phone
,
String
userName
)
{
public
void
openDoor
(
Long
roomId
,
String
phone
)
{
SRoom
room
=
roomMapper
.
selectSRoomById
(
roomId
);
if
(
room
!=
null
)
{
Device
param
=
new
Device
();
...
...
@@ -74,24 +74,24 @@ public class DeviceOpServiceImpl implements DeviceOpService {
for
(
Device
device
:
list
)
{
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
()))
{
// 取电开关
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
MqttxVo
mqttxVo
=
mqttxService
.
openOrCloseDevice
(
devId
,
phone
,
opType
);
// 发送mqtt消息
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
This diff is collapsed.
Click to expand it.
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
}
}
SConsumer
user
=
FrontTokenComponent
.
getWxSConsumerEntry
();
deviceOpService
.
openDoor
(
sRoomVo
.
getId
(),
user
.
getPhone
()
,
user
.
getNickName
()
);
deviceOpService
.
openDoor
(
sRoomVo
.
getId
(),
user
.
getPhone
());
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
if
(
Objects
.
isNull
(
one
))
{
throw
new
BaseException
(
"设备不存在!"
);
}
deviceOpService
.
openDoor
(
id
,
user
.
getPhone
()
,
user
.
getNickName
()
);
deviceOpService
.
openDoor
(
id
,
user
.
getPhone
());
return
"开锁成功"
;
}
...
...
share-system/src/main/java/share/system/service/impl/SStoreServiceImpl.java
View file @
e2bb6b23
...
...
@@ -4,6 +4,8 @@ import java.util.*;
import
java.util.stream.Collectors
;
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.lang3.StringUtils
;
import
org.apache.poi.hssf.record.DVALRecord
;
...
...
@@ -29,6 +31,7 @@ import share.system.request.SStoreRequest;
import
share.system.service.IPackService
;
import
share.system.service.ISRoomService
;
import
share.system.service.ISStoreService
;
import
share.system.service.QPService
;
/**
* 门店Service业务层处理
...
...
@@ -48,6 +51,8 @@ public class SStoreServiceImpl extends ServiceImpl<SStoreMapper, SStore> impleme
private
RoomPackMapper
roomPackMapper
;
@Autowired
private
IPackService
packService
;
@Autowired
private
QPService
qpService
;
/**
* 查询门店
...
...
@@ -280,6 +285,31 @@ public class SStoreServiceImpl extends ServiceImpl<SStoreMapper, SStore> impleme
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
)
{
List
<
Map
>
result
=
new
ArrayList
<>();
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