Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
G
glinfo-api
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
林业通
glinfo-api
Commits
cc4e8734
提交
cc4e8734
authored
2月 17, 2022
作者:
linzhenjie
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
小问题调整
上级
e560a0a5
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
10 行增加
和
7 行删除
+10
-7
MqConsumer.java
...rc/main/java/tech/glinfo/enbao/modules/mq/MqConsumer.java
+2
-2
ShDeviceController.java
...linfo/enbao/modules/sh/controller/ShDeviceController.java
+6
-3
OtherShDeviceServiceImpl.java
...bao/modules/sh/service/impl/OtherShDeviceServiceImpl.java
+2
-2
没有找到文件。
appapi/src/main/java/tech/glinfo/enbao/modules/mq/MqConsumer.java
浏览文件 @
cc4e8734
...
@@ -108,7 +108,7 @@ public class MqConsumer {
...
@@ -108,7 +108,7 @@ public class MqConsumer {
try
{
try
{
Map
<
String
,
String
>
datas
=
(
Map
<
String
,
String
>)
JSON
.
parse
(
message
);
Map
<
String
,
String
>
datas
=
(
Map
<
String
,
String
>)
JSON
.
parse
(
message
);
if
(
"08"
.
equals
(
datas
.
get
(
"cmd"
)))
{
//
if ("08".equals(datas.get("cmd"))) {
//新增设备
//新增设备
if
(
redisUtils
.
hasKey
(
"device:save:"
+
datas
.
get
(
"mac"
)))
{
if
(
redisUtils
.
hasKey
(
"device:save:"
+
datas
.
get
(
"mac"
)))
{
String
[]
userId
=
redisUtils
.
get
(
"device:save:"
+
datas
.
get
(
"mac"
)).
split
(
"-"
);
String
[]
userId
=
redisUtils
.
get
(
"device:save:"
+
datas
.
get
(
"mac"
)).
split
(
"-"
);
...
@@ -125,7 +125,7 @@ public class MqConsumer {
...
@@ -125,7 +125,7 @@ public class MqConsumer {
redisUtils
.
delete
(
"device:save:"
+
datas
.
get
(
"mac"
));
redisUtils
.
delete
(
"device:save:"
+
datas
.
get
(
"mac"
));
jmsTemplate
.
convertAndSend
(
socketioTopic
,
JSON
.
toJSONString
(
new
MapUtils
().
put
(
"deviceId"
,
datas
.
get
(
"mac"
))));
jmsTemplate
.
convertAndSend
(
socketioTopic
,
JSON
.
toJSONString
(
new
MapUtils
().
put
(
"deviceId"
,
datas
.
get
(
"mac"
))));
}
}
}
//
}
ShDeviceEntity
device
=
otherShDeviceService
.
deviceInfo
(
new
MapUtils
().
put
(
"numbering"
,
datas
.
get
(
"receiveId"
)));
ShDeviceEntity
device
=
otherShDeviceService
.
deviceInfo
(
new
MapUtils
().
put
(
"numbering"
,
datas
.
get
(
"receiveId"
)));
if
(
device
==
null
)
{
if
(
device
==
null
)
{
logger
.
error
(
"设备不存在 : {}"
,
datas
.
get
(
"receiveId"
));
logger
.
error
(
"设备不存在 : {}"
,
datas
.
get
(
"receiveId"
));
...
...
appapi/src/main/java/tech/glinfo/enbao/modules/sh/controller/ShDeviceController.java
浏览文件 @
cc4e8734
...
@@ -115,15 +115,18 @@ public class ShDeviceController {
...
@@ -115,15 +115,18 @@ public class ShDeviceController {
@ApiLog
(
"添加关联房间"
)
@ApiLog
(
"添加关联房间"
)
public
R
addRelation
(
@RequestBody
Map
<
String
,
Object
>
params
)
{
public
R
addRelation
(
@RequestBody
Map
<
String
,
Object
>
params
)
{
Integer
roomId
=
(
Integer
)
params
.
get
(
"roomId"
);
Integer
roomId
=
(
Integer
)
params
.
get
(
"roomId"
);
Integer
deviceId
=
(
Integer
)
params
.
get
(
"deviceId"
);
String
deviceIds
=
(
String
)
params
.
get
(
"deviceIds"
);
//允许多选择设备
if
(
StringUtils
.
isBlank
(
roomId
,
deviceId
))
{
if
(
StringUtils
.
isBlank
(
roomId
,
deviceId
s
))
{
return
R
.
error
(
"缺少参数"
);
return
R
.
error
(
"缺少参数"
);
}
}
String
[]
ds
=
deviceIds
.
split
(
","
);
for
(
String
d
:
ds
)
{
ShDeviceEntity
device
=
new
ShDeviceEntity
();
ShDeviceEntity
device
=
new
ShDeviceEntity
();
device
.
setRoomId
(
roomId
);
device
.
setRoomId
(
roomId
);
device
.
setId
(
deviceId
);
device
.
setId
(
Integer
.
valueOf
(
d
)
);
otherShDeviceService
.
updateById
(
device
);
otherShDeviceService
.
updateById
(
device
);
}
return
R
.
ok
();
return
R
.
ok
();
}
}
...
...
appapi/src/main/java/tech/glinfo/enbao/modules/sh/service/impl/OtherShDeviceServiceImpl.java
浏览文件 @
cc4e8734
...
@@ -49,11 +49,11 @@ public class OtherShDeviceServiceImpl extends ServiceImpl<OtherShDeviceDao, ShDe
...
@@ -49,11 +49,11 @@ public class OtherShDeviceServiceImpl extends ServiceImpl<OtherShDeviceDao, ShDe
String
mac
=
(
String
)
params
.
get
(
"mac"
);
String
mac
=
(
String
)
params
.
get
(
"mac"
);
Integer
familyId
=
(
Integer
)
params
.
get
(
"familyId"
);
Integer
familyId
=
(
Integer
)
params
.
get
(
"familyId"
);
if
(
StringUtils
.
isBlank
(
mac
,
familyId
))
{
if
(
StringUtils
.
isBlank
(
mac
,
familyId
))
{
return
R
.
error
();
return
R
.
error
(
"缺少参数"
);
}
}
int
count
=
this
.
count
(
new
QueryWrapper
<
ShDeviceEntity
>().
eq
(
"mac"
,
mac
));
int
count
=
this
.
count
(
new
QueryWrapper
<
ShDeviceEntity
>().
eq
(
"mac"
,
mac
));
if
(
count
>
0
)
{
if
(
count
>
0
)
{
return
R
.
error
();
return
R
.
error
(
"该设备已添加"
);
}
}
//保存MAC地址
//保存MAC地址
redisUtils
.
set
(
"device:save:"
+
mac
,
user
.
getId
()
+
"-"
+
familyId
);
redisUtils
.
set
(
"device:save:"
+
mac
,
user
.
getId
()
+
"-"
+
familyId
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论