Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
G
glinfo-api
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
林业通
glinfo-api
Commits
3a01765e
提交
3a01765e
authored
2月 21, 2022
作者:
林业通
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
温控修改
上级
4a5f5d4e
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
98 行增加
和
526 行删除
+98
-526
OutletParse.java
...c/main/java/tech/glinfo/enbao/modules/mq/OutletParse.java
+2
-2
SwitchParse.java
...c/main/java/tech/glinfo/enbao/modules/mq/SwitchParse.java
+4
-15
ShDeviceTempController.java
...o/enbao/modules/sh/controller/ShDeviceTempController.java
+32
-410
ShDeviceTempForm.java
...a/tech/glinfo/enbao/modules/sh/form/ShDeviceTempForm.java
+42
-39
ShDeviceTempEntity.java
...ch/glinfo/enbao/modules/sh/entity/ShDeviceTempEntity.java
+8
-36
ShDeviceTempDao.xml
common/src/main/resources/mapper/sh/ShDeviceTempDao.xml
+4
-11
12-24.sql
doc/sql/12-24.sql
+6
-13
没有找到文件。
appapi/src/main/java/tech/glinfo/enbao/modules/mq/OutletParse.java
浏览文件 @
3a01765e
...
...
@@ -139,7 +139,7 @@ public class OutletParse implements IParse {
}
else
if
(
"1A"
.
equals
(
datas
.
get
(
"cmd"
)))
{
//温控响应
String
content
=
datas
.
get
(
"content"
);
logger
.
info
(
"设置温控响应 : {}"
,
content
);
String
content1
=
redisUtils
.
get
(
device
.
getNumbering
()
+
"temp"
);
/*
String content1 = redisUtils.get(device.getNumbering() + "temp");
//设备响应成功之后修改数据,不用等30秒,页面体验好些
if ("00".equals(content)) {
if (content1 != null) {
...
...
@@ -155,7 +155,7 @@ public class OutletParse implements IParse {
}
}
}
redisUtils
.
delete
(
device
.
getNumbering
()
+
"temp"
);
redisUtils.delete(device.getNumbering() + "temp");
*/
}
else
if
(
"20"
.
equals
(
datas
.
get
(
"cmd"
)))
{
//事件上报
//保存开关记录
...
...
appapi/src/main/java/tech/glinfo/enbao/modules/mq/SwitchParse.java
浏览文件 @
3a01765e
...
...
@@ -53,7 +53,7 @@ public class SwitchParse implements IParse {
new
Thread
(()
->
{
//检测有没待下发指令
String
send
=
redisUtils
.
get
(
"device:sendtemp
1
:"
+
device
.
getNumbering
());
String
send
=
redisUtils
.
get
(
"device:sendtemp:"
+
device
.
getNumbering
());
if
(
send
!=
null
)
{
try
{
Thread
.
sleep
(
500
);
...
...
@@ -61,18 +61,7 @@ public class SwitchParse implements IParse {
e
.
printStackTrace
();
}
mqProducer
.
sendT
(
send
);
redisUtils
.
delete
(
"device:sendtemp1:"
+
device
.
getNumbering
());
}
//检测有没待下发指令
String
send1
=
redisUtils
.
get
(
"device:sendtemp2:"
+
device
.
getNumbering
());
if
(
send1
!=
null
)
{
try
{
Thread
.
sleep
(
500
);
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
mqProducer
.
sendT
(
send1
);
redisUtils
.
delete
(
"device:sendtemp2:"
+
device
.
getNumbering
());
redisUtils
.
delete
(
"device:sendtemp:"
+
device
.
getNumbering
());
}
}).
start
();
...
...
@@ -146,7 +135,7 @@ public class SwitchParse implements IParse {
}
else
if
(
"1A"
.
equals
(
datas
.
get
(
"cmd"
)))
{
//温控响应
String
content
=
datas
.
get
(
"content"
);
logger
.
info
(
"设置温控响应 : {}"
,
content
);
String
content1
=
redisUtils
.
get
(
device
.
getNumbering
()
+
"temp"
);
/*
String content1 = redisUtils.get(device.getNumbering() + "temp");
//设备响应成功之后修改数据,不用等30秒,页面体验好些
if ("00".equals(content)) {
if (content1 != null) {
...
...
@@ -166,7 +155,7 @@ public class SwitchParse implements IParse {
}
}
}
redisUtils
.
delete
(
device
.
getNumbering
()
+
"temp"
);
redisUtils.delete(device.getNumbering() + "temp");
*/
}
else
if
(
"20"
.
equals
(
datas
.
get
(
"cmd"
)))
{
//事件上报
//保存开关记录
...
...
appapi/src/main/java/tech/glinfo/enbao/modules/sh/controller/ShDeviceTempController.java
浏览文件 @
3a01765e
...
...
@@ -44,87 +44,36 @@ public class ShDeviceTempController {
@Login
@PostMapping
(
"saveOrUpdate"
)
@ApiOperation
(
"新增、修改
定时(智能插座、开关、窗帘
)"
)
@ApiLog
(
"新增、修改
定时
"
)
@ApiOperation
(
"新增、修改
(智能插座
)"
)
@ApiLog
(
"新增、修改
(智能插座)
"
)
public
R
saveOrUpdate
(
@RequestBody
ShDeviceTempForm
form
)
throws
InvocationTargetException
,
IllegalAccessException
{
//表单校验
ValidatorUtils
.
validateEntity
(
form
);
ShDeviceTempEntity
tempEntity
=
new
ShDeviceTempEntity
();
BeanUtils
.
copyProperties
(
tempEntity
,
form
);
ShDeviceTempEntity
tempEntity1
=
otherShDeviceTempService
.
getOne
(
new
QueryWrapper
<
ShDeviceTempEntity
>().
eq
(
"device_id"
,
form
.
getDeviceId
()));
if
(
tempEntity1
!=
null
)
{
tempEntity
.
setId
(
tempEntity1
.
getId
());
}
logger
.
info
(
"低温"
+
tempEntity
.
getTempL
());
otherShDeviceTempService
.
saveOrUpdate
(
tempEntity
);
if
(
form
.
getStatus
()
==
1
)
{
ShDeviceEntity
entity
=
otherShDeviceService
.
getById
(
form
.
getDeviceId
());
String
content
=
null
;
if
(!
StringUtils
.
isBlank
(
form
.
getTempH
(),
form
.
getMinuteH
(),
form
.
getSecondH
(),
form
.
getTempL
(),
form
.
getMinuteL
(),
form
.
getSecondL
()))
{
String
tempH
=
ByteUtils
.
signInt2HexString
(
form
.
getTempH
().
toString
(),
2
);
String
tempL
=
ByteUtils
.
signInt2HexString
(
form
.
getTempL
().
toString
(),
2
);
StringBuilder
minuteH
=
new
StringBuilder
(
ByteUtils
.
int2Hex
(
form
.
getMinuteH
()));
while
(
minuteH
.
length
()
<
4
)
{
minuteH
.
insert
(
0
,
"0"
);
}
StringBuilder
secondH
=
new
StringBuilder
(
ByteUtils
.
int2Hex
(
form
.
getSecondH
()));
while
(
secondH
.
length
()
<
4
)
{
secondH
.
insert
(
0
,
"0"
);
}
StringBuilder
minuteL
=
new
StringBuilder
(
ByteUtils
.
int2Hex
(
form
.
getMinuteL
()));
while
(
minuteL
.
length
()
<
4
)
{
minuteL
.
insert
(
0
,
"0"
);
}
StringBuilder
secondL
=
new
StringBuilder
(
ByteUtils
.
int2Hex
(
form
.
getSecondL
()));
while
(
secondL
.
length
()
<
4
)
{
secondL
.
insert
(
0
,
"0"
);
}
content
=
"010103"
+
tempH
+
tempL
+
minuteH
+
secondH
+
minuteL
+
secondL
;
}
else
if
(!
StringUtils
.
isBlank
(
form
.
getTempH
(),
form
.
getMinuteH
(),
form
.
getSecondH
()))
{
String
tempH
=
ByteUtils
.
signInt2HexString
(
form
.
getTempH
().
toString
(),
2
);
StringBuilder
minuteH
=
new
StringBuilder
(
ByteUtils
.
int2Hex
(
form
.
getMinuteH
()));
while
(
minuteH
.
length
()
<
4
)
{
minuteH
.
insert
(
0
,
"0"
);
}
StringBuilder
secondH
=
new
StringBuilder
(
ByteUtils
.
int2Hex
(
form
.
getSecondH
()));
while
(
secondH
.
length
()
<
4
)
{
secondH
.
insert
(
0
,
"0"
);
}
content
=
"010101"
+
tempH
+
"00"
+
minuteH
+
secondH
+
"00000000"
;
}
else
if
(!
StringUtils
.
isBlank
(
form
.
getTempL
(),
form
.
getMinuteL
(),
form
.
getSecondL
()))
{
String
tempL
=
ByteUtils
.
signInt2HexString
(
form
.
getTempL
().
toString
(),
2
);
ShDeviceEntity
entity
=
otherShDeviceService
.
getById
(
form
.
getDeviceId
());
String
content
;
String
tempH
=
ByteUtils
.
signInt2HexString
(
form
.
getTempH
().
toString
(),
2
);
String
tempL
=
ByteUtils
.
signInt2HexString
(
form
.
getTempL
().
toString
(),
2
);
content
=
tempH
+
ByteUtils
.
int2Hex
(
form
.
getStatusH
())
+
tempL
+
ByteUtils
.
int2Hex
(
form
.
getStatusL
())
+
"00000000"
;
StringBuilder
minuteL
=
new
StringBuilder
(
ByteUtils
.
int2Hex
(
form
.
getMinuteL
()));
while
(
minuteL
.
length
()
<
4
)
{
minuteL
.
insert
(
0
,
"0"
);
}
StringBuilder
secondL
=
new
StringBuilder
(
ByteUtils
.
int2Hex
(
form
.
getSecondL
()));
while
(
secondL
.
length
()
<
4
)
{
secondL
.
insert
(
0
,
"0"
);
}
content
=
"010102"
+
"00"
+
tempL
+
"00000000"
+
minuteL
+
secondL
;
}
else
{
content
=
"00010000000000000000000000"
;
}
ProtocolContent
protocol
=
new
ProtocolContent
();
protocol
.
setReceiveId
(
entity
.
getNumbering
());
protocol
.
setDeviceType
(
"03"
);
protocol
.
setCmd
(
"1C"
);
protocol
.
setContent
(
content
);
String
json
=
JSON
.
toJSONString
(
protocol
);
redisUtils
.
set
(
"device:sendtemp:"
+
entity
.
getNumbering
(),
json
);
}
ProtocolContent
protocol
=
new
ProtocolContent
();
protocol
.
setReceiveId
(
entity
.
getNumbering
());
protocol
.
setDeviceType
(
"03"
);
protocol
.
setCmd
(
"1A"
);
protocol
.
setContent
(
content
);
String
json
=
JSON
.
toJSONString
(
protocol
);
redisUtils
.
set
(
"device:sendtemp:"
+
entity
.
getNumbering
(),
json
);
return
R
.
ok
().
put
(
"id"
,
tempEntity
.
getId
());
}
@Login
@PostMapping
(
"saveOrUpdate1"
)
@ApiOperation
(
"新增、修改
定时(智能插座、开关、窗帘
)"
)
@ApiLog
(
"新增、修改
定时
"
)
@ApiOperation
(
"新增、修改
温控(智能开关
)"
)
@ApiLog
(
"新增、修改
温控(智能开关)
"
)
public
R
saveOrUpdate1
(
@RequestBody
ShDeviceTempForm
form
)
throws
InvocationTargetException
,
IllegalAccessException
{
//表单校验
ValidatorUtils
.
validateEntity
(
form
);
...
...
@@ -133,360 +82,32 @@ public class ShDeviceTempController {
otherShDeviceTempService
.
saveOrUpdate
(
tempEntity
);
ShDeviceEntity
entity
=
otherShDeviceService
.
getById
(
form
.
getDeviceId
());
String
content
=
null
;
String
content1
=
null
;
if
(
form
.
getFlag
()
==
1
)
{
if
(
form
.
getStatus
()
==
1
)
{
if
(!
StringUtils
.
isBlank
(
form
.
getTempH
(),
form
.
getMinuteH
(),
form
.
getSecondH
(),
form
.
getTempL
(),
form
.
getMinuteL
(),
form
.
getSecondL
()))
{
String
tempH
=
ByteUtils
.
signInt2HexString
(
form
.
getTempH
().
toString
(),
2
);
String
tempL
=
ByteUtils
.
signInt2HexString
(
form
.
getTempL
().
toString
(),
2
);
StringBuilder
minuteH
=
new
StringBuilder
(
ByteUtils
.
int2Hex
(
form
.
getMinuteH
()));
while
(
minuteH
.
length
()
<
4
)
{
minuteH
.
insert
(
0
,
"0"
);
}
StringBuilder
secondH
=
new
StringBuilder
(
ByteUtils
.
int2Hex
(
form
.
getSecondH
()));
while
(
secondH
.
length
()
<
4
)
{
secondH
.
insert
(
0
,
"0"
);
}
StringBuilder
minuteL
=
new
StringBuilder
(
ByteUtils
.
int2Hex
(
form
.
getMinuteL
()));
while
(
minuteL
.
length
()
<
4
)
{
minuteL
.
insert
(
0
,
"0"
);
}
StringBuilder
secondL
=
new
StringBuilder
(
ByteUtils
.
int2Hex
(
form
.
getSecondL
()));
while
(
secondL
.
length
()
<
4
)
{
secondL
.
insert
(
0
,
"0"
);
}
content
=
"010103"
+
tempH
+
tempL
+
minuteH
+
secondH
+
minuteL
+
secondL
;
}
else
if
(!
StringUtils
.
isBlank
(
form
.
getTempH
(),
form
.
getMinuteH
(),
form
.
getSecondH
()))
{
String
tempH
=
ByteUtils
.
signInt2HexString
(
form
.
getTempH
().
toString
(),
2
);
StringBuilder
minuteH
=
new
StringBuilder
(
ByteUtils
.
int2Hex
(
form
.
getMinuteH
()));
while
(
minuteH
.
length
()
<
4
)
{
minuteH
.
insert
(
0
,
"0"
);
}
StringBuilder
secondH
=
new
StringBuilder
(
ByteUtils
.
int2Hex
(
form
.
getSecondH
()));
while
(
secondH
.
length
()
<
4
)
{
secondH
.
insert
(
0
,
"0"
);
}
content
=
"010101"
+
tempH
+
"00"
+
minuteH
+
secondH
+
"00000000"
;
}
else
if
(!
StringUtils
.
isBlank
(
form
.
getTempL
(),
form
.
getMinuteL
(),
form
.
getSecondL
()))
{
String
tempL
=
ByteUtils
.
signInt2HexString
(
form
.
getTempL
().
toString
(),
2
);
StringBuilder
minuteL
=
new
StringBuilder
(
ByteUtils
.
int2Hex
(
form
.
getMinuteL
()));
while
(
minuteL
.
length
()
<
4
)
{
minuteL
.
insert
(
0
,
"0"
);
}
StringBuilder
secondL
=
new
StringBuilder
(
ByteUtils
.
int2Hex
(
form
.
getSecondL
()));
while
(
secondL
.
length
()
<
4
)
{
secondL
.
insert
(
0
,
"0"
);
}
content
=
"010102"
+
"00"
+
tempL
+
"00000000"
+
minuteL
+
secondL
;
}
else
{
content
=
"00010000000000000000000000"
;
}
ProtocolContent
protocol
=
new
ProtocolContent
();
protocol
.
setReceiveId
(
entity
.
getNumbering
());
protocol
.
setDeviceType
(
"02"
);
protocol
.
setCmd
(
"1C"
);
protocol
.
setContent
(
content
);
String
json
=
JSON
.
toJSONString
(
protocol
);
redisUtils
.
set
(
"device:sendtemp1:"
+
entity
.
getNumbering
(),
json
);
}
}
else
{
if
(
form
.
getStatusT
()
==
1
)
{
if
(!
StringUtils
.
isBlank
(
form
.
getTempHT
(),
form
.
getMinuteHT
(),
form
.
getSecondHT
(),
form
.
getTempLT
(),
form
.
getMinuteLT
(),
form
.
getSecondLT
()))
{
String
tempH
=
ByteUtils
.
signInt2HexString
(
form
.
getTempHT
().
toString
(),
2
);
String
tempL
=
ByteUtils
.
signInt2HexString
(
form
.
getTempLT
().
toString
(),
2
);
StringBuilder
minuteH
=
new
StringBuilder
(
ByteUtils
.
int2Hex
(
form
.
getMinuteHT
()));
while
(
minuteH
.
length
()
<
4
)
{
minuteH
.
insert
(
0
,
"0"
);
}
StringBuilder
secondH
=
new
StringBuilder
(
ByteUtils
.
int2Hex
(
form
.
getSecondHT
()));
while
(
secondH
.
length
()
<
4
)
{
secondH
.
insert
(
0
,
"0"
);
}
StringBuilder
minuteL
=
new
StringBuilder
(
ByteUtils
.
int2Hex
(
form
.
getMinuteLT
()));
while
(
minuteL
.
length
()
<
4
)
{
minuteL
.
insert
(
0
,
"0"
);
}
StringBuilder
secondL
=
new
StringBuilder
(
ByteUtils
.
int2Hex
(
form
.
getSecondLT
()));
while
(
secondL
.
length
()
<
4
)
{
secondL
.
insert
(
0
,
"0"
);
}
content1
=
"010203"
+
tempH
+
tempL
+
minuteH
+
secondH
+
minuteL
+
secondL
;
}
else
if
(!
StringUtils
.
isBlank
(
form
.
getTempHT
(),
form
.
getMinuteHT
(),
form
.
getSecondHT
()))
{
String
tempH
=
ByteUtils
.
signInt2HexString
(
form
.
getTempHT
().
toString
(),
2
);
StringBuilder
minuteH
=
new
StringBuilder
(
ByteUtils
.
int2Hex
(
form
.
getMinuteHT
()));
while
(
minuteH
.
length
()
<
4
)
{
minuteH
.
insert
(
0
,
"0"
);
}
StringBuilder
secondH
=
new
StringBuilder
(
ByteUtils
.
int2Hex
(
form
.
getSecondHT
()));
while
(
secondH
.
length
()
<
4
)
{
secondH
.
insert
(
0
,
"0"
);
}
content1
=
"010201"
+
tempH
+
"00"
+
minuteH
+
secondH
+
"00000000"
;
}
else
if
(!
StringUtils
.
isBlank
(
form
.
getTempLT
(),
form
.
getMinuteLT
(),
form
.
getSecondLT
()))
{
String
tempL
=
ByteUtils
.
signInt2HexString
(
form
.
getTempLT
().
toString
(),
2
);
StringBuilder
minuteL
=
new
StringBuilder
(
ByteUtils
.
int2Hex
(
form
.
getMinuteLT
()));
while
(
minuteL
.
length
()
<
4
)
{
minuteL
.
insert
(
0
,
"0"
);
}
StringBuilder
secondL
=
new
StringBuilder
(
ByteUtils
.
int2Hex
(
form
.
getSecondLT
()));
while
(
secondL
.
length
()
<
4
)
{
secondL
.
insert
(
0
,
"0"
);
}
content1
=
"010202"
+
"00"
+
tempL
+
"00000000"
+
minuteL
+
secondL
;
}
else
{
content1
=
"00020000000000000000000000"
;
}
ProtocolContent
protocol1
=
new
ProtocolContent
();
protocol1
.
setReceiveId
(
entity
.
getNumbering
());
protocol1
.
setDeviceType
(
"02"
);
protocol1
.
setCmd
(
"1C"
);
protocol1
.
setContent
(
content1
);
String
json1
=
JSON
.
toJSONString
(
protocol1
);
redisUtils
.
set
(
"device:sendtemp2:"
+
entity
.
getNumbering
(),
json1
);
}
}
return
R
.
ok
().
put
(
"id"
,
tempEntity
.
getId
());
}
@Login
@GetMapping
(
"info/{id}"
)
@ApiOperation
(
"定时详情(智能插座、开关、窗帘)"
)
@ApiLog
(
"定时详情"
)
public
R
info
(
@PathVariable
(
"id"
)
Integer
id
)
{
return
R
.
ok
().
put
(
"temp"
,
otherShDeviceTempService
.
getOne
(
new
QueryWrapper
<
ShDeviceTempEntity
>().
eq
(
"device_id"
,
id
)));
}
@Login
@PostMapping
(
"updateStatus"
)
@ApiOperation
(
"修改状态"
)
@ApiLog
(
"修改状态"
)
public
R
updateStatus
(
@RequestBody
Map
<
String
,
Object
>
params
)
{
Integer
id
=
(
Integer
)
params
.
get
(
"id"
);
Integer
status
=
(
Integer
)
params
.
get
(
"status"
);
if
(
StringUtils
.
isBlank
(
id
,
status
))
{
return
R
.
error
(
"缺少参数!"
);
}
ShDeviceTempEntity
tempEntity
=
new
ShDeviceTempEntity
();
tempEntity
.
setId
(
id
);
tempEntity
.
setStatus
(
status
);
otherShDeviceTempService
.
updateById
(
tempEntity
);
ShDeviceTempEntity
tempEntity1
=
otherShDeviceTempService
.
getById
(
id
);
ShDeviceEntity
entity
=
otherShDeviceService
.
getById
(
tempEntity1
.
getDeviceId
());
String
content
;
String
tempH
=
ByteUtils
.
signInt2HexString
(
form
.
getTempH
().
toString
(),
2
);
String
tempL
=
ByteUtils
.
signInt2HexString
(
form
.
getTempL
().
toString
(),
2
);
String
tempHT
=
ByteUtils
.
signInt2HexString
(
form
.
getTempHT
().
toString
(),
2
);
String
tempLT
=
ByteUtils
.
signInt2HexString
(
form
.
getTempLT
().
toString
(),
2
);
content
=
tempH
+
ByteUtils
.
int2Hex
(
form
.
getStatusH
())
+
tempL
+
ByteUtils
.
int2Hex
(
form
.
getStatusL
())
+
tempHT
+
ByteUtils
.
int2Hex
(
form
.
getStatusHT
())
+
tempLT
+
ByteUtils
.
int2Hex
(
form
.
getStatusLT
());
if
(
status
==
1
)
{
content
=
content
(
tempEntity1
);
}
else
{
content
=
"00010000000000000000000000"
;
}
ProtocolContent
protocol
=
new
ProtocolContent
();
protocol
.
setReceiveId
(
entity
.
getNumbering
());
protocol
.
setDeviceType
(
"0
3
"
);
protocol
.
setCmd
(
"1
C
"
);
protocol
.
setDeviceType
(
"0
2
"
);
protocol
.
setCmd
(
"1
A
"
);
protocol
.
setContent
(
content
);
String
json
=
JSON
.
toJSONString
(
protocol
);
redisUtils
.
set
(
"device:sendtemp:"
+
entity
.
getNumbering
(),
json
);
return
R
.
ok
();
return
R
.
ok
()
.
put
(
"id"
,
tempEntity
.
getId
())
;
}
@Login
@PostMapping
(
"updateStatus1"
)
@ApiOperation
(
"修改状态"
)
@ApiLog
(
"修改状态"
)
public
R
updateStatus1
(
@RequestBody
Map
<
String
,
Object
>
params
)
{
Integer
id
=
(
Integer
)
params
.
get
(
"id"
);
Integer
status
=
(
Integer
)
params
.
get
(
"status"
);
Integer
statusT
=
(
Integer
)
params
.
get
(
"statusT"
);
if
(
StringUtils
.
isBlank
(
id
))
{
return
R
.
error
(
"缺少参数!"
);
}
if
(
status
==
null
&&
statusT
==
null
)
{
return
R
.
error
(
"缺少参数!"
);
}
ShDeviceTempEntity
tempEntity
=
new
ShDeviceTempEntity
();
tempEntity
.
setId
(
id
);
if
(
status
!=
null
)
{
tempEntity
.
setStatus
(
status
);
}
if
(
statusT
!=
null
)
{
tempEntity
.
setStatusT
(
statusT
);
}
otherShDeviceTempService
.
updateById
(
tempEntity
);
ShDeviceTempEntity
tempEntity1
=
otherShDeviceTempService
.
getById
(
id
);
ShDeviceEntity
entity
=
otherShDeviceService
.
getById
(
tempEntity1
.
getDeviceId
());
String
content
=
null
;
if
(
status
!=
null
&&
status
==
1
)
{
if
(!
StringUtils
.
isBlank
(
tempEntity1
.
getTempH
(),
tempEntity1
.
getMinuteH
(),
tempEntity1
.
getSecondH
(),
tempEntity1
.
getTempL
(),
tempEntity1
.
getMinuteL
(),
tempEntity1
.
getSecondL
()))
{
String
tempH
=
ByteUtils
.
signInt2HexString
(
tempEntity1
.
getTempH
().
toString
(),
2
);
String
tempL
=
ByteUtils
.
signInt2HexString
(
tempEntity1
.
getTempL
().
toString
(),
2
);
StringBuilder
minuteH
=
new
StringBuilder
(
ByteUtils
.
int2Hex
(
tempEntity1
.
getMinuteH
()));
while
(
minuteH
.
length
()
<
4
)
{
minuteH
.
insert
(
0
,
"0"
);
}
StringBuilder
secondH
=
new
StringBuilder
(
ByteUtils
.
int2Hex
(
tempEntity1
.
getSecondH
()));
while
(
secondH
.
length
()
<
4
)
{
secondH
.
insert
(
0
,
"0"
);
}
StringBuilder
minuteL
=
new
StringBuilder
(
ByteUtils
.
int2Hex
(
tempEntity1
.
getMinuteL
()));
while
(
minuteL
.
length
()
<
4
)
{
minuteL
.
insert
(
0
,
"0"
);
}
StringBuilder
secondL
=
new
StringBuilder
(
ByteUtils
.
int2Hex
(
tempEntity1
.
getSecondL
()));
while
(
secondL
.
length
()
<
4
)
{
secondL
.
insert
(
0
,
"0"
);
}
content
=
"010103"
+
tempH
+
tempL
+
minuteH
+
secondH
+
minuteL
+
secondL
;
}
else
if
(!
StringUtils
.
isBlank
(
tempEntity1
.
getTempH
(),
tempEntity1
.
getMinuteH
(),
tempEntity1
.
getSecondH
()))
{
String
tempH
=
ByteUtils
.
signInt2HexString
(
tempEntity1
.
getTempH
().
toString
(),
2
);
StringBuilder
minuteH
=
new
StringBuilder
(
ByteUtils
.
int2Hex
(
tempEntity1
.
getMinuteH
()));
while
(
minuteH
.
length
()
<
4
)
{
minuteH
.
insert
(
0
,
"0"
);
}
StringBuilder
secondH
=
new
StringBuilder
(
ByteUtils
.
int2Hex
(
tempEntity1
.
getSecondH
()));
while
(
secondH
.
length
()
<
4
)
{
secondH
.
insert
(
0
,
"0"
);
}
content
=
"010101"
+
tempH
+
"00"
+
minuteH
+
secondH
+
"00000000"
;
}
else
if
(!
StringUtils
.
isBlank
(
tempEntity1
.
getTempL
(),
tempEntity1
.
getMinuteL
(),
tempEntity1
.
getSecondL
()))
{
String
tempL
=
ByteUtils
.
signInt2HexString
(
tempEntity1
.
getTempL
().
toString
(),
2
);
StringBuilder
minuteL
=
new
StringBuilder
(
ByteUtils
.
int2Hex
(
tempEntity1
.
getMinuteL
()));
while
(
minuteL
.
length
()
<
4
)
{
minuteL
.
insert
(
0
,
"0"
);
}
StringBuilder
secondL
=
new
StringBuilder
(
ByteUtils
.
int2Hex
(
tempEntity1
.
getSecondL
()));
while
(
secondL
.
length
()
<
4
)
{
secondL
.
insert
(
0
,
"0"
);
}
content
=
"010102"
+
"00"
+
tempL
+
"00000000"
+
minuteL
+
secondL
;
}
else
{
content
=
"00010000000000000000000000"
;
}
}
else
if
(
status
!=
null
&&
status
==
2
){
content
=
"00010000000000000000000000"
;
}
else
if
(
statusT
!=
null
&&
statusT
==
1
){
if
(!
StringUtils
.
isBlank
(
tempEntity1
.
getTempHT
(),
tempEntity1
.
getMinuteHT
(),
tempEntity1
.
getSecondHT
()))
{
String
tempH
=
ByteUtils
.
signInt2HexString
(
tempEntity1
.
getTempHT
().
toString
(),
2
);
StringBuilder
minuteH
=
new
StringBuilder
(
ByteUtils
.
int2Hex
(
tempEntity1
.
getMinuteHT
()));
while
(
minuteH
.
length
()
<
4
)
{
minuteH
.
insert
(
0
,
"0"
);
}
StringBuilder
secondH
=
new
StringBuilder
(
ByteUtils
.
int2Hex
(
tempEntity1
.
getSecondHT
()));
while
(
secondH
.
length
()
<
4
)
{
secondH
.
insert
(
0
,
"0"
);
}
content
=
"010201"
+
tempH
+
"00"
+
minuteH
+
secondH
+
"00000000"
;
}
else
if
(!
StringUtils
.
isBlank
(
tempEntity1
.
getTempLT
(),
tempEntity1
.
getMinuteLT
(),
tempEntity1
.
getSecondLT
()))
{
String
tempL
=
ByteUtils
.
signInt2HexString
(
tempEntity1
.
getTempLT
().
toString
(),
2
);
StringBuilder
minuteL
=
new
StringBuilder
(
ByteUtils
.
int2Hex
(
tempEntity1
.
getMinuteLT
()));
while
(
minuteL
.
length
()
<
4
)
{
minuteL
.
insert
(
0
,
"0"
);
}
StringBuilder
secondL
=
new
StringBuilder
(
ByteUtils
.
int2Hex
(
tempEntity1
.
getSecondLT
()));
while
(
secondL
.
length
()
<
4
)
{
secondL
.
insert
(
0
,
"0"
);
}
content
=
"010202"
+
"00"
+
tempL
+
"00000000"
+
minuteL
+
secondL
;
}
else
{
content
=
"00020000000000000000000000"
;
}
}
else
if
(
statusT
!=
null
&&
statusT
==
2
){
content
=
"00020000000000000000000000"
;
}
ProtocolContent
protocol
=
new
ProtocolContent
();
protocol
.
setReceiveId
(
entity
.
getNumbering
());
protocol
.
setDeviceType
(
"02"
);
protocol
.
setCmd
(
"1C"
);
protocol
.
setContent
(
content
);
String
json
=
JSON
.
toJSONString
(
protocol
);
if
(
status
!=
null
)
{
redisUtils
.
set
(
"device:sendtemp1:"
+
entity
.
getNumbering
(),
json
);
}
if
(
statusT
!=
null
)
{
redisUtils
.
set
(
"device:sendtemp2:"
+
entity
.
getNumbering
(),
json
);
}
return
R
.
ok
();
}
private
String
content
(
ShDeviceTempEntity
tempEntity
)
{
String
content
;
if
(!
StringUtils
.
isBlank
(
tempEntity
.
getTempH
(),
tempEntity
.
getMinuteH
(),
tempEntity
.
getSecondH
(),
tempEntity
.
getTempL
(),
tempEntity
.
getMinuteL
(),
tempEntity
.
getSecondL
()))
{
String
tempH
=
ByteUtils
.
signInt2HexString
(
tempEntity
.
getTempH
().
toString
(),
2
);
String
tempL
=
ByteUtils
.
signInt2HexString
(
tempEntity
.
getTempL
().
toString
(),
2
);
StringBuilder
minuteH
=
new
StringBuilder
(
ByteUtils
.
int2Hex
(
tempEntity
.
getMinuteH
()));
while
(
minuteH
.
length
()
<
4
)
{
minuteH
.
insert
(
0
,
"0"
);
}
StringBuilder
secondH
=
new
StringBuilder
(
ByteUtils
.
int2Hex
(
tempEntity
.
getSecondH
()));
while
(
secondH
.
length
()
<
4
)
{
secondH
.
insert
(
0
,
"0"
);
}
StringBuilder
minuteL
=
new
StringBuilder
(
ByteUtils
.
int2Hex
(
tempEntity
.
getMinuteL
()));
while
(
minuteL
.
length
()
<
4
)
{
minuteL
.
insert
(
0
,
"0"
);
}
StringBuilder
secondL
=
new
StringBuilder
(
ByteUtils
.
int2Hex
(
tempEntity
.
getSecondL
()));
while
(
secondL
.
length
()
<
4
)
{
secondL
.
insert
(
0
,
"0"
);
}
content
=
"010103"
+
tempH
+
tempL
+
minuteH
+
secondH
+
minuteL
+
secondL
;
}
else
if
(!
StringUtils
.
isBlank
(
tempEntity
.
getTempH
(),
tempEntity
.
getMinuteH
(),
tempEntity
.
getSecondH
()))
{
String
tempH
=
ByteUtils
.
signInt2HexString
(
tempEntity
.
getTempH
().
toString
(),
2
);
StringBuilder
minuteH
=
new
StringBuilder
(
ByteUtils
.
int2Hex
(
tempEntity
.
getMinuteH
()));
while
(
minuteH
.
length
()
<
4
)
{
minuteH
.
insert
(
0
,
"0"
);
}
StringBuilder
secondH
=
new
StringBuilder
(
ByteUtils
.
int2Hex
(
tempEntity
.
getSecondH
()));
while
(
secondH
.
length
()
<
4
)
{
secondH
.
insert
(
0
,
"0"
);
}
content
=
"010101"
+
tempH
+
"00"
+
minuteH
+
secondH
+
"00000000"
;
}
else
if
(!
StringUtils
.
isBlank
(
tempEntity
.
getTempL
(),
tempEntity
.
getMinuteL
(),
tempEntity
.
getSecondL
()))
{
String
tempL
=
ByteUtils
.
signInt2HexString
(
tempEntity
.
getTempL
().
toString
(),
2
);
StringBuilder
minuteL
=
new
StringBuilder
(
ByteUtils
.
int2Hex
(
tempEntity
.
getMinuteL
()));
while
(
minuteL
.
length
()
<
4
)
{
minuteL
.
insert
(
0
,
"0"
);
}
StringBuilder
secondL
=
new
StringBuilder
(
ByteUtils
.
int2Hex
(
tempEntity
.
getSecondL
()));
while
(
secondL
.
length
()
<
4
)
{
secondL
.
insert
(
0
,
"0"
);
}
content
=
"010102"
+
"00"
+
tempL
+
"00000000"
+
minuteL
+
secondL
;
}
else
{
content
=
"00010000000000000000000000"
;
}
return
content
;
@GetMapping
(
"info/{id}"
)
@ApiOperation
(
"定时详情(智能插座、开关、窗帘)"
)
@ApiLog
(
"定时详情"
)
public
R
info
(
@PathVariable
(
"id"
)
Integer
id
)
{
return
R
.
ok
().
put
(
"temp"
,
otherShDeviceTempService
.
getOne
(
new
QueryWrapper
<
ShDeviceTempEntity
>().
eq
(
"device_id"
,
id
)));
}
}
\ No newline at end of file
appapi/src/main/java/tech/glinfo/enbao/modules/sh/form/ShDeviceTempForm.java
浏览文件 @
3a01765e
...
...
@@ -17,49 +17,52 @@ public class ShDeviceTempForm {
@ApiModelProperty
(
value
=
"设备ID"
)
@NotNull
(
message
=
"设备ID不能为空"
)
private
Integer
deviceId
;
@ApiModelProperty
(
value
=
"状态1"
)
private
Integer
status
;
@ApiModelProperty
(
value
=
"状态2"
)
private
Integer
statusT
;
/**
* 高温
*/
@ApiModelProperty
(
value
=
"高温"
)
@NotNull
(
message
=
"高温不能为空"
)
private
Integer
tempH
;
@ApiModelProperty
(
value
=
"分钟"
)
private
Integer
minuteH
;
@ApiModelProperty
(
value
=
"秒"
)
private
Integer
secondH
;
@ApiModelProperty
(
value
=
"低温"
)
/**
* 状态 1开 2关
*/
@ApiModelProperty
(
value
=
"状态"
)
@NotNull
(
message
=
"状态不能为空"
)
private
Integer
statusH
;
/**
* 底温
*/
@ApiModelProperty
(
value
=
"底温"
)
@NotNull
(
message
=
"底温不能为空"
)
private
Integer
tempL
;
@ApiModelProperty
(
value
=
"分钟"
)
private
Integer
minuteL
;
@ApiModelProperty
(
value
=
"秒"
)
private
Integer
secondL
;
/**
* 状态 1开 2关
*/
@ApiModelProperty
(
value
=
"状态"
)
@NotNull
(
message
=
"状态不能为空"
)
private
Integer
statusL
;
/**
* 高温
*/
@ApiModelProperty
(
value
=
"高温"
)
@NotNull
(
message
=
"高温不能为空"
)
private
Integer
tempHT
;
@ApiModelProperty
(
value
=
"分钟"
)
private
Integer
minuteHT
;
@ApiModelProperty
(
value
=
"秒"
)
private
Integer
secondHT
;
@ApiModelProperty
(
value
=
"低温"
)
/**
* 状态 1开 2关
*/
@ApiModelProperty
(
value
=
"状态"
)
@NotNull
(
message
=
"状态不能为空"
)
private
Integer
statusHT
;
/**
* 高温
*/
@ApiModelProperty
(
value
=
"高温"
)
@NotNull
(
message
=
"高温不能为空"
)
private
Integer
tempLT
;
@ApiModelProperty
(
value
=
"分钟"
)
private
Integer
minuteLT
;
@ApiModelProperty
(
value
=
"秒"
)
private
Integer
secondLT
;
@ApiModelProperty
(
value
=
"开关标识"
)
private
Integer
flag
;
/**
* 状态 1开 2关
*/
@ApiModelProperty
(
value
=
"状态"
)
@NotNull
(
message
=
"状态不能为空"
)
private
Integer
statusLT
;
}
common/src/main/java/tech/glinfo/enbao/modules/sh/entity/ShDeviceTempEntity.java
浏览文件 @
3a01765e
...
...
@@ -33,60 +33,32 @@ public class ShDeviceTempEntity implements Serializable {
*/
private
Integer
tempH
;
/**
*
分钟
*
状态 1开 2关
*/
private
Integer
minute
H
;
private
Integer
status
H
;
/**
* 秒
*/
private
Integer
secondH
;
/**
* 高温
* 底温
*/
private
Integer
tempL
;
/**
* 分钟
*/
private
Integer
minuteL
;
/**
* 秒
* 状态 1开 2关
*/
private
Integer
s
econd
L
;
private
Integer
s
tatus
L
;
/**
* 高温
*/
private
Integer
tempHT
;
/**
* 分钟
*/
private
Integer
minuteHT
;
/**
* 秒
* 状态 1开 2关
*/
private
Integer
s
econd
HT
;
private
Integer
s
tatus
HT
;
/**
* 高温
*/
private
Integer
tempLT
;
/**
* 分钟
*/
private
Integer
minuteLT
;
/**
* 秒
*/
private
Integer
secondLT
;
/**
* 创建时间
*/
private
Date
createTime
;
/**
* 状态 1开 2关
*/
private
Integer
status
;
/**
* 状态 1开 2关
*/
private
Integer
statusT
;
private
Integer
status
L
T
;
}
common/src/main/resources/mapper/sh/ShDeviceTempDao.xml
浏览文件 @
3a01765e
...
...
@@ -8,20 +8,13 @@
<result
property=
"id"
column=
"id"
/>
<result
property=
"deviceId"
column=
"device_id"
/>
<result
property=
"tempH"
column=
"temp_h"
/>
<result
property=
"minuteH"
column=
"minute_h"
/>
<result
property=
"secondH"
column=
"second_h"
/>
<result
property=
"statusH"
column=
"status_h"
/>
<result
property=
"tempL"
column=
"temp_l"
/>
<result
property=
"minuteL"
column=
"minute_l"
/>
<result
property=
"secondL"
column=
"second_l"
/>
<result
property=
"statusL"
column=
"status_l"
/>
<result
property=
"tempHT"
column=
"temp_h_t"
/>
<result
property=
"minuteHT"
column=
"minute_h_t"
/>
<result
property=
"secondHT"
column=
"second_h_t"
/>
<result
property=
"statusHT"
column=
"status_h_t"
/>
<result
property=
"tempLT"
column=
"temp_l_t"
/>
<result
property=
"minuteLT"
column=
"minute_l_t"
/>
<result
property=
"secondLT"
column=
"second_l_t"
/>
<result
property=
"createTime"
column=
"create_time"
/>
<result
property=
"status"
column=
"status"
/>
<result
property=
"statusT"
column=
"status_t"
/>
<result
property=
"statusLT"
column=
"status_l_t"
/>
</resultMap>
...
...
doc/sql/12-24.sql
浏览文件 @
3a01765e
...
...
@@ -168,20 +168,13 @@ CREATE TABLE `sh_device_temp` (
`id`
int
(
11
)
NOT
NULL
AUTO_INCREMENT
,
`device_id`
int
(
11
)
DEFAULT
NULL
COMMENT
'设备ID'
,
`temp_h`
int
(
10
)
DEFAULT
NULL
COMMENT
'高温'
,
`minute_h`
int
(
10
)
DEFAULT
NULL
COMMENT
'分钟'
,
`second_h`
int
(
10
)
DEFAULT
NULL
COMMENT
'秒'
,
`temp_l`
int
(
10
)
DEFAULT
NULL
COMMENT
'高温'
,
`minute_l`
int
(
10
)
DEFAULT
NULL
COMMENT
'分钟'
,
`second_l`
int
(
10
)
DEFAULT
NULL
COMMENT
'秒'
,
`temp_h_t`
int
(
10
)
DEFAULT
NULL
COMMENT
'高温'
,
`minute_h_t`
int
(
10
)
DEFAULT
NULL
COMMENT
'分钟'
,
`second_h_t`
int
(
10
)
DEFAULT
NULL
COMMENT
'秒'
,
`status_h`
tinyint
(
2
)
DEFAULT
NULL
COMMENT
'状态 0关 1开'
,
`temp_l`
int
(
10
)
DEFAULT
NULL
COMMENT
'秒'
,
`status_l`
tinyint
(
2
)
DEFAULT
NULL
COMMENT
'状态 0关 1开'
,
`temp_h_t`
int
(
10
)
DEFAULT
NULL
COMMENT
'分钟'
,
`status_h_t`
tinyint
(
2
)
DEFAULT
NULL
COMMENT
'状态 0关 1开'
,
`temp_l_t`
int
(
10
)
DEFAULT
NULL
COMMENT
'高温'
,
`minute_l_t`
int
(
10
)
DEFAULT
NULL
COMMENT
'分钟'
,
`second_l_t`
int
(
10
)
DEFAULT
NULL
COMMENT
'秒'
,
`create_time`
timestamp
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
COMMENT
'创建时间'
,
`status`
tinyint
(
2
)
DEFAULT
'2'
COMMENT
'状态 1开 2关'
,
`status_t`
tinyint
(
2
)
DEFAULT
'2'
COMMENT
'状态 1开 2关'
,
`status_l_t`
tinyint
(
2
)
DEFAULT
NULL
COMMENT
'状态 0关 1开'
,
PRIMARY
KEY
(
`id`
)
USING
BTREE
,
KEY
`sh_device_temp_device_id`
(
`device_id`
)
USING
BTREE
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
COMMENT
=
'设备温度控制'
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论