Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
G
glinfo-api
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
林业通
glinfo-api
Commits
ee53c280
提交
ee53c280
authored
2月 21, 2022
作者:
林业通
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
保存记录
上级
5a0f3684
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
33 行增加
和
10 行删除
+33
-10
OutletParse.java
...c/main/java/tech/glinfo/enbao/modules/mq/OutletParse.java
+11
-5
SwitchParse.java
...c/main/java/tech/glinfo/enbao/modules/mq/SwitchParse.java
+19
-2
ShDeviceController.java
...linfo/enbao/modules/sh/controller/ShDeviceController.java
+3
-3
没有找到文件。
appapi/src/main/java/tech/glinfo/enbao/modules/mq/OutletParse.java
浏览文件 @
ee53c280
...
...
@@ -50,9 +50,6 @@ public class OutletParse implements IParse {
@Autowired
private
TimeParseUtils
timeParseUtils
;
@Autowired
private
SpeakerService
speakerService
;
@Autowired
private
MqProducer
mqProducer
;
...
...
@@ -126,7 +123,7 @@ public class OutletParse implements IParse {
logger
.
info
(
"已删除重复 : {}"
,
redisUtils
.
hasKey
(
device
.
getNumbering
()
+
"cf"
));
String
content
=
datas
.
get
(
"content"
);
//开关状态
if
(
content
.
equals
(
"00"
))
{
/*
if (content.equals("00")) {
//保存开关记录
String action = redisUtils.get(datas.get("receiveId") + "action");
if (action != null) {
...
...
@@ -136,7 +133,7 @@ public class OutletParse implements IParse {
shDeviceRecordService.save(recordEntity);
redisUtils.delete(datas.get("receiveId") + "action");
}
}
}
*/
ws
.
put
(
"action"
,
content
);
}
else
if
(
"1A"
.
equals
(
datas
.
get
(
"cmd"
)))
{
//温控响应
...
...
@@ -160,6 +157,15 @@ public class OutletParse implements IParse {
}
redisUtils
.
delete
(
device
.
getNumbering
()
+
"temp"
);
}
else
if
(
"20"
.
equals
(
datas
.
get
(
"cmd"
)))
{
//事件上报
//保存开关记录
String
content
=
datas
.
get
(
"content"
);
String
action
=
content
.
substring
(
6
,
8
);
ShDeviceRecordEntity
recordEntity
=
new
ShDeviceRecordEntity
();
recordEntity
.
setDeviceId
(
device
.
getId
());
recordEntity
.
setAction
(
action
.
equals
(
"01"
)
?
1
:
2
);
shDeviceRecordService
.
save
(
recordEntity
);
}
new
Thread
(()
->
{
//检测有没待下发指令
...
...
appapi/src/main/java/tech/glinfo/enbao/modules/mq/SwitchParse.java
浏览文件 @
ee53c280
...
...
@@ -119,7 +119,7 @@ public class SwitchParse implements IParse {
String
content
=
datas
.
get
(
"content"
);
logger
.
info
(
"开关响应 : {}"
,
content
);
//开关状态
if
(
content
.
equals
(
"00"
))
{
/*
if (content.equals("00")) {
//保存开关记录
logger.info("receiveId : {}", datas.get("receiveId"));
String action = redisUtils.get(datas.get("receiveId") + "action1");
...
...
@@ -140,7 +140,7 @@ public class SwitchParse implements IParse {
redisUtils.delete(datas.get("receiveId") + "action2");
}
}
}
*/
ws
.
put
(
"action"
,
content
);
}
else
if
(
"1A"
.
equals
(
datas
.
get
(
"cmd"
)))
{
//温控响应
...
...
@@ -168,6 +168,23 @@ public class SwitchParse implements IParse {
}
redisUtils
.
delete
(
device
.
getNumbering
()
+
"temp"
);
}
else
if
(
"20"
.
equals
(
datas
.
get
(
"cmd"
)))
{
//事件上报
//保存开关记录
String
content
=
datas
.
get
(
"content"
);
String
type
=
content
.
substring
(
2
,
4
);
String
action
=
content
.
substring
(
6
,
8
);
ShDeviceRecordEntity
recordEntity
=
new
ShDeviceRecordEntity
();
recordEntity
.
setDeviceId
(
device
.
getId
());
if
(
type
.
equals
(
"01"
))
{
//开关1 1:开 2:关
recordEntity
.
setAction
(
action
.
equals
(
"01"
)
?
1
:
2
);
}
else
{
//开关2 3:开 4:关
recordEntity
.
setAction
(
action
.
equals
(
"01"
)
?
3
:
4
);
}
shDeviceRecordService
.
save
(
recordEntity
);
}
return
ws
;
}
...
...
appapi/src/main/java/tech/glinfo/enbao/modules/sh/controller/ShDeviceController.java
浏览文件 @
ee53c280
...
...
@@ -349,15 +349,15 @@ public class ShDeviceController {
protocol
.
setDeviceType
(
type
);
protocol
.
setCmd
(
"18"
);
if
(
flag
==
null
)
{
redisUtils
.
set
(
mac
+
"action"
,
action
.
substring
(
0
,
2
),
50
);
//
redisUtils.set(mac + "action", action.substring(0, 2), 50);
protocol
.
setContent
(
action
+
"000000000001"
);
}
else
{
if
(
flag
==
1
)
{
protocol
.
setContent
(
action
+
"000000000001"
);
redisUtils
.
set
(
mac
+
"action1"
,
action
.
substring
(
0
,
2
).
equals
(
"01"
)
?
1
:
2
,
50
);
//
redisUtils.set(mac + "action1", action.substring(0, 2).equals("01") ? 1 : 2, 50);
}
else
{
protocol
.
setContent
(
action
+
"000000000002"
);
redisUtils
.
set
(
mac
+
"action2"
,
action
.
substring
(
2
,
4
).
equals
(
"01"
)
?
3
:
4
,
50
);
//
redisUtils.set(mac + "action2", action.substring(2, 4).equals("01") ? 3 : 4, 50);
}
}
mqProducer
.
sendT
(
JSON
.
toJSONString
(
protocol
));
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论