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
fa0bfc30
Commit
fa0bfc30
authored
Dec 28, 2023
by
YG8999
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
设备锁添加密码、删除密码操作接口
parent
f7135dbd
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
88 additions
and
18 deletions
+88
-18
OpTypeEnum.java
...e-common/src/main/java/share/common/enums/OpTypeEnum.java
+5
-4
DeviceOpService.java
...m/src/main/java/share/system/service/DeviceOpService.java
+22
-0
DeviceOpServiceImpl.java
...n/java/share/system/service/impl/DeviceOpServiceImpl.java
+57
-0
MqttxServiceImpl.java
...main/java/share/system/service/impl/MqttxServiceImpl.java
+4
-14
No files found.
share-common/src/main/java/share/common/enums/OpTypeEnum.java
View file @
fa0bfc30
...
...
@@ -5,13 +5,14 @@ public enum OpTypeEnum {
OPEN_DOOR
(
"10"
,
"开门"
),
GET_ELECTRIC
(
"20"
,
"取电"
),
LOCK_DOOR
(
"30"
,
"锁门"
),
CUT_ELECTRIC
(
"40"
,
"断电"
);
CUT_ELECTRIC
(
"40"
,
"断电"
),
OP_DEVICE_PASSWORD
(
"10"
,
"密码"
),
OP_DEVICE_ICCARD
(
"20"
,
"卡片"
),
OP_DEVICE_LEARN
(
"30"
,
"指纹"
)
;
private
String
code
;
private
String
name
;
OpTypeEnum
()
{
}
OpTypeEnum
(
String
code
,
String
name
)
{
this
.
code
=
code
;
this
.
name
=
name
;
...
...
share-system/src/main/java/share/system/service/DeviceOpService.java
View file @
fa0bfc30
...
...
@@ -76,4 +76,26 @@ public interface DeviceOpService {
*/
void
openOrCloseDevice
(
Long
roomId
,
String
phone
,
String
opType
,
boolean
isAsync
,
long
m
);
/**
* 远程设置密码/卡片
* @param roomId 房间id
* @param param 设置参数:密码、卡号、指纹
* @param startTime 生效时间:2020-04-06 10:00:00(格式)
* @param endTime 失效时间:2020-04-06 12:00:00(格式)
* @param phone 操作用户
* @param opType 操作类型:10:密码,20:卡片,30:指纹
* @return
*/
void
setDevicePassword
(
Long
roomId
,
String
param
,
String
startTime
,
String
endTime
,
String
phone
,
String
opType
);
/**
* 远程删除密码/卡片
* @param roomId 房间id
* @param param 设置参数:密码、卡号、指纹
* @param phone 操作用户
* @param opType 操作类型:10:密码,20:卡片,30:指纹
* @return
*/
void
deleteDevicePassword
(
Long
roomId
,
String
param
,
String
phone
,
String
opType
);
}
share-system/src/main/java/share/system/service/impl/DeviceOpServiceImpl.java
View file @
fa0bfc30
...
...
@@ -276,5 +276,62 @@ public class DeviceOpServiceImpl implements DeviceOpService {
}
}
/**
* 远程设置密码/卡片
* @param roomId 房间id
* @param param 设置参数:密码、卡号、指纹
* @param startTime 生效时间:2020-04-06 10:00:00(格式)
* @param endTime 失效时间:2020-04-06 12:00:00(格式)
* @param phone 操作用户
* @param opType 操作类型:10:密码,20:卡片,30:指纹
* @return
*/
@Override
public
void
setDevicePassword
(
Long
roomId
,
String
param
,
String
startTime
,
String
endTime
,
String
phone
,
String
opType
)
{
SRoom
room
=
roomMapper
.
selectSRoomById
(
roomId
);
if
(
room
!=
null
)
{
Device
queryParams
=
new
Device
();
queryParams
.
setRoomId
(
room
.
getId
());
queryParams
.
setDevType
(
DeviceType
.
DEVICE_CCEE
.
getCode
());
List
<
Device
>
list
=
deviceMapper
.
selectDeviceList
(
queryParams
);
list
.
stream
().
forEach
(
device
->
{
// 获取mqtt的topic、payload
MqttxVo
mqttxVo
=
mqttxService
.
setOpenPassword
(
device
.
getDevId
(),
param
,
startTime
,
endTime
,
phone
,
opType
);
// 发送mqtt消息
mqttGatewayComponent
.
sendToMqtt
(
mqttxVo
.
getTopic
(),
0
,
mqttxVo
.
getPayload
());
// 写日志记录
deviceLogService
.
addDeviceLog
(
mqttxVo
,
phone
);
});
}
}
/**
* 远程删除密码/卡片
* @param roomId 房间id
* @param param 设置参数:密码、卡号、指纹
* @param phone 操作用户
* @param opType 操作类型:10:密码,20:卡片,30:指纹
* @return
*/
@Override
public
void
deleteDevicePassword
(
Long
roomId
,
String
param
,
String
phone
,
String
opType
)
{
SRoom
room
=
roomMapper
.
selectSRoomById
(
roomId
);
if
(
room
!=
null
)
{
Device
queryParams
=
new
Device
();
queryParams
.
setRoomId
(
room
.
getId
());
queryParams
.
setDevType
(
DeviceType
.
DEVICE_CCEE
.
getCode
());
List
<
Device
>
list
=
deviceMapper
.
selectDeviceList
(
queryParams
);
list
.
stream
().
forEach
(
device
->
{
// 获取mqtt的topic、payload
MqttxVo
mqttxVo
=
mqttxService
.
deleteOpenPassword
(
device
.
getDevId
(),
param
,
null
,
null
,
phone
,
opType
);
// 发送mqtt消息
mqttGatewayComponent
.
sendToMqtt
(
mqttxVo
.
getTopic
(),
0
,
mqttxVo
.
getPayload
());
// 写日志记录
deviceLogService
.
addDeviceLog
(
mqttxVo
,
phone
);
});
}
}
}
share-system/src/main/java/share/system/service/impl/MqttxServiceImpl.java
View file @
fa0bfc30
...
...
@@ -240,19 +240,14 @@ public class MqttxServiceImpl implements MqttxService {
public
MqttxVo
setOpenPassword
(
String
devId
,
String
param
,
String
startTime
,
String
endTime
,
String
phone
,
String
opType
)
{
MqttxVo
mqttxVo
=
null
;
switch
(
opType
)
{
case
"10"
:
if
(
OpTypeEnum
.
OP_DEVICE_PASSWORD
.
getCode
().
equals
(
opType
))
{
// 密码设置
mqttxVo
=
this
.
setOpenPasswordInit
(
devId
,
phone
,
MqttOpType
.
PASSWORD
.
getCode
(),
param
,
startTime
,
endTime
,
MqttConstants
.
MQTT_DESCRIBE_DEVICE_PASSWORD
);
break
;
case
"20"
:
}
else
if
(
OpTypeEnum
.
OP_DEVICE_ICCARD
.
getCode
().
equals
(
opType
))
{
// 卡片设置
mqttxVo
=
this
.
setOpenPasswordInit
(
devId
,
phone
,
MqttOpType
.
IDCARD
.
getCode
(),
param
,
startTime
,
endTime
,
MqttConstants
.
MQTT_DESCRIBE_DEVICE_IDCARD
);
break
;
default
:
break
;
}
return
mqttxVo
;
}
...
...
@@ -325,19 +320,14 @@ public class MqttxServiceImpl implements MqttxService {
public
MqttxVo
deleteOpenPassword
(
String
devId
,
String
param
,
String
startTime
,
String
endTime
,
String
phone
,
String
opType
)
{
MqttxVo
mqttxVo
=
null
;
switch
(
opType
)
{
case
"10"
:
if
(
OpTypeEnum
.
OP_DEVICE_PASSWORD
.
getCode
().
equals
(
opType
))
{
// 密码设置
mqttxVo
=
this
.
deleteOpenPasswordInit
(
devId
,
phone
,
MqttOpType
.
PASSWORD
.
getCode
(),
param
,
startTime
,
endTime
,
MqttConstants
.
MQTT_DESCRIBE_DEVICE_PASSWORD
);
break
;
case
"20"
:
}
else
if
(
OpTypeEnum
.
OP_DEVICE_ICCARD
.
getCode
().
equals
(
opType
))
{
// 卡片设置
mqttxVo
=
this
.
deleteOpenPasswordInit
(
devId
,
phone
,
MqttOpType
.
IDCARD
.
getCode
(),
param
,
startTime
,
endTime
,
MqttConstants
.
MQTT_DESCRIBE_DEVICE_IDCARD
);
break
;
default
:
break
;
}
return
mqttxVo
;
}
...
...
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