Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
G
glinfo-api
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
林业通
glinfo-api
Commits
6ffa77ab
提交
6ffa77ab
authored
2月 23, 2022
作者:
林业通
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
推送修改
上级
4a67f458
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
34 行增加
和
7 行删除
+34
-7
OtherShDeviceDao.java
...va/tech/glinfo/enbao/modules/sh/dao/OtherShDeviceDao.java
+1
-1
OtherShDeviceServiceImpl.java
...bao/modules/sh/service/impl/OtherShDeviceServiceImpl.java
+25
-4
MqConsumer.java
...rc/main/java/tech/glinfo/enbao/modules/mq/MqConsumer.java
+7
-2
OtherShFamilyServiceImpl.java
...bao/modules/sh/service/impl/OtherShFamilyServiceImpl.java
+1
-0
没有找到文件。
adminapi/src/main/java/tech/glinfo/enbao/modules/sh/dao/OtherShDeviceDao.java
浏览文件 @
6ffa77ab
...
...
@@ -42,7 +42,7 @@ public interface OtherShDeviceDao extends BaseMapper<ShDeviceEntity> {
Map
<
String
,
Object
>
info
(
Integer
id
);
@Select
(
"select id from sh_device where online_status = 2 and online_time is not null and now() > date_add(online_time,interval
5
minute)"
)
@Select
(
"select id from sh_device where online_status = 2 and online_time is not null and now() > date_add(online_time,interval
2
minute)"
)
List
<
Map
<
String
,
Object
>>
timeout
();
@Select
(
"<script>"
+
...
...
adminapi/src/main/java/tech/glinfo/enbao/modules/sh/service/impl/OtherShDeviceServiceImpl.java
浏览文件 @
6ffa77ab
package
tech
.
glinfo
.
enbao
.
modules
.
sh
.
service
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.jms.core.JmsMessagingTemplate
;
import
org.springframework.stereotype.Service
;
import
tech.glinfo.enbao.common.utils.Constant
;
import
tech.glinfo.enbao.common.utils.MapUtils
;
import
tech.glinfo.enbao.common.utils.PageUtils
;
import
tech.glinfo.enbao.common.utils.StringUtils
;
import
tech.glinfo.enbao.modules.sh.dao.OtherShDeviceDao
;
import
tech.glinfo.enbao.modules.sh.entity.ShDeviceEntity
;
import
tech.glinfo.enbao.modules.sh.service.OtherShDeviceService
;
import
javax.jms.Topic
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -21,6 +28,11 @@ import java.util.Map;
@Service
(
"otherShDeviceService"
)
public
class
OtherShDeviceServiceImpl
extends
ServiceImpl
<
OtherShDeviceDao
,
ShDeviceEntity
>
implements
OtherShDeviceService
{
@Autowired
private
Topic
socketioTopic
;
@Autowired
private
JmsMessagingTemplate
jmsTemplate
;
@Override
public
PageUtils
queryPage
(
Map
<
String
,
Object
>
params
)
{
...
...
@@ -34,8 +46,6 @@ public class OtherShDeviceServiceImpl extends ServiceImpl<OtherShDeviceDao, ShDe
start
=
time
+
" 00:00:00"
;
end
=
time
+
" 59:59:59"
;
}
System
.
out
.
println
(
start
);
System
.
out
.
println
(
end
);
params
.
put
(
"start"
,
start
);
params
.
put
(
"end"
,
end
);
page
.
setRecords
(
this
.
baseMapper
.
list
(
page
,
params
));
...
...
@@ -51,13 +61,24 @@ public class OtherShDeviceServiceImpl extends ServiceImpl<OtherShDeviceDao, ShDe
@Override
public
void
timeout
()
{
List
<
Map
<
String
,
Object
>>
list
=
this
.
baseMapper
.
timeout
();
List
<
Map
<
String
,
String
>>
mapList
=
new
ArrayList
<>();
for
(
Map
<
String
,
Object
>
map
:
list
)
{
ShDeviceEntity
entity
=
new
ShDeviceEntity
();
entity
.
setId
((
Integer
)
map
.
get
(
"id"
));
Integer
id
=
(
Integer
)
map
.
get
(
"id"
);
entity
.
setId
(
id
);
entity
.
setOnlineStatus
(
3
);
this
.
updateById
(
entity
);
Map
<
String
,
String
>
map1
=
new
HashMap
<>();
map1
.
put
(
"deviceId"
,
String
.
valueOf
(
id
));
map1
.
put
(
"status"
,
"3"
);
mapList
.
add
(
map1
);
//发送到单个设备
jmsTemplate
.
convertAndSend
(
socketioTopic
,
JSON
.
toJSONString
(
new
MapUtils
().
put
(
"deviceId"
,
String
.
valueOf
(
id
)).
put
(
"status"
,
"3"
)));
}
//发送到主页所有设备
if
(
mapList
.
size
()
>
0
)
{
jmsTemplate
.
convertAndSend
(
socketioTopic
,
JSON
.
toJSONString
(
new
MapUtils
().
put
(
"deviceId"
,
"onlineStatus"
).
put
(
"list"
,
JSON
.
toJSONString
(
mapList
))));
}
//智能锁密码过期
this
.
baseMapper
.
updateDevicePassword
();
}
...
...
appapi/src/main/java/tech/glinfo/enbao/modules/mq/MqConsumer.java
浏览文件 @
6ffa77ab
...
...
@@ -25,8 +25,7 @@ import tech.glinfo.enbao.modules.websocket.WebSocketServer;
import
javax.jms.Topic
;
import
java.lang.reflect.Method
;
import
java.util.Date
;
import
java.util.Map
;
import
java.util.*
;
@Component
public
class
MqConsumer
{
...
...
@@ -132,6 +131,12 @@ public class MqConsumer {
return
;
}
if
(
device
.
getOnlineStatus
()
==
1
||
device
.
getOnlineStatus
()
==
3
)
{
List
<
Map
<
String
,
String
>>
mapList
=
new
ArrayList
<>();
Map
<
String
,
String
>
map1
=
new
HashMap
<>();
map1
.
put
(
"deviceId"
,
String
.
valueOf
(
device
.
getId
()));
map1
.
put
(
"status"
,
"2"
);
mapList
.
add
(
map1
);
jmsTemplate
.
convertAndSend
(
socketioTopic
,
JSON
.
toJSONString
(
new
MapUtils
().
put
(
"deviceId"
,
"onlineStatus"
).
put
(
"list"
,
JSON
.
toJSONString
(
mapList
))));
//更新设备状态为在线
new
Thread
(()
->
{
ShDeviceEntity
deviceEntity
=
new
ShDeviceEntity
();
...
...
appapi/src/main/java/tech/glinfo/enbao/modules/sh/service/impl/OtherShFamilyServiceImpl.java
浏览文件 @
6ffa77ab
...
...
@@ -46,6 +46,7 @@ public class OtherShFamilyServiceImpl extends ServiceImpl<OtherShFamilyDao, ShFa
member
.
setFamilyId
(
family
.
getId
());
member
.
setUserId
(
user
.
getId
());
member
.
setIsAdmin
(
1
);
//管理员
member
.
setStatus
(
2
);
shFamilyMemberService
.
save
(
member
);
return
R
.
ok
();
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论