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
6376ac76
Commit
6376ac76
authored
Jan 23, 2024
by
YG8999
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
网关上报信息验证日志最新时间范围改为配置文件设置
网关设备状态验证最新上报时间范围改为配置文件设置
parent
ef7991f7
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
5 deletions
+17
-5
application-prod.yml
share-admin/src/main/resources/application-prod.yml
+5
-2
application-prod.yml
share-front/src/main/resources/application-prod.yml
+3
-1
DeviceGatewayServiceImpl.java
...a/share/system/service/impl/DeviceGatewayServiceImpl.java
+5
-1
MqttxServiceImpl.java
...main/java/share/system/service/impl/MqttxServiceImpl.java
+4
-1
No files found.
share-admin/src/main/resources/application-prod.yml
View file @
6376ac76
...
@@ -215,4 +215,7 @@ dianping:
...
@@ -215,4 +215,7 @@ dianping:
appKey
:
a59ea57cd1eb4737
appKey
:
a59ea57cd1eb4737
appSecret
:
0caaabb7fda1c1be46636171548dcf510d1fb706
appSecret
:
0caaabb7fda1c1be46636171548dcf510d1fb706
order
:
order
:
allow-refund-time
:
3600
allow-refund-time
:
3600
\ No newline at end of file
mqtt
:
device-op-last-time
:
-5
device-gateway-last-report-time
:
-10
\ No newline at end of file
share-front/src/main/resources/application-prod.yml
View file @
6376ac76
...
@@ -213,4 +213,6 @@ dianping:
...
@@ -213,4 +213,6 @@ dianping:
#订单
#订单
order
:
order
:
allow-refund-time
:
3600
allow-refund-time
:
3600
mqtt
:
device-op-last-time
:
-5
device-gateway-last-report-time
:
-10
share-system/src/main/java/share/system/service/impl/DeviceGatewayServiceImpl.java
View file @
6376ac76
...
@@ -6,6 +6,7 @@ import java.util.List;
...
@@ -6,6 +6,7 @@ import java.util.List;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.date.DateUtil
;
import
com.baomidou.mybatisplus.core.conditions.Wrapper
;
import
com.baomidou.mybatisplus.core.conditions.Wrapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
org.springframework.beans.factory.annotation.Value
;
import
share.common.enums.DeviceStatusEnum
;
import
share.common.enums.DeviceStatusEnum
;
import
share.common.utils.DateUtils
;
import
share.common.utils.DateUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -26,6 +27,9 @@ public class DeviceGatewayServiceImpl extends ServiceImpl<DeviceGatewayMapper, D
...
@@ -26,6 +27,9 @@ public class DeviceGatewayServiceImpl extends ServiceImpl<DeviceGatewayMapper, D
@Autowired
@Autowired
private
DeviceGatewayMapper
deviceGatewayMapper
;
private
DeviceGatewayMapper
deviceGatewayMapper
;
@Value
(
"${mqtt.device-gateway-last-report-time}"
)
private
Integer
deviceGatewayLastReportTime
;
/**
/**
* 查询设备网关信息
* 查询设备网关信息
*
*
...
@@ -110,7 +114,7 @@ public class DeviceGatewayServiceImpl extends ServiceImpl<DeviceGatewayMapper, D
...
@@ -110,7 +114,7 @@ public class DeviceGatewayServiceImpl extends ServiceImpl<DeviceGatewayMapper, D
list
.
stream
().
forEach
(
gateway
->
{
list
.
stream
().
forEach
(
gateway
->
{
Date
lastReportDate
=
gateway
.
getLastReportDate
();
Date
lastReportDate
=
gateway
.
getLastReportDate
();
// 网关上报(最近10分钟内没有上报数据,网关设备离线)
// 网关上报(最近10分钟内没有上报数据,网关设备离线)
Date
startDate
=
DateUtil
.
offsetMinute
(
DateUtil
.
date
(),
-
10
);
Date
startDate
=
DateUtil
.
offsetMinute
(
DateUtil
.
date
(),
deviceGatewayLastReportTime
);
if
(
lastReportDate
!=
null
&&
lastReportDate
.
compareTo
(
startDate
)
>
0
)
{
if
(
lastReportDate
!=
null
&&
lastReportDate
.
compareTo
(
startDate
)
>
0
)
{
gateway
.
setStatus
(
DeviceStatusEnum
.
DEVICE_ONLINE
.
getCode
());
gateway
.
setStatus
(
DeviceStatusEnum
.
DEVICE_ONLINE
.
getCode
());
}
else
{
}
else
{
...
...
share-system/src/main/java/share/system/service/impl/MqttxServiceImpl.java
View file @
6376ac76
...
@@ -8,6 +8,7 @@ import cn.hutool.json.JSONObject;
...
@@ -8,6 +8,7 @@ import cn.hutool.json.JSONObject;
import
cn.hutool.json.JSONUtil
;
import
cn.hutool.json.JSONUtil
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
share.common.constant.MqttConstants
;
import
share.common.constant.MqttConstants
;
import
share.common.enums.*
;
import
share.common.enums.*
;
...
@@ -48,6 +49,8 @@ public class MqttxServiceImpl implements MqttxService {
...
@@ -48,6 +49,8 @@ public class MqttxServiceImpl implements MqttxService {
private
DeviceLogMapper
deviceLogMapper
;
private
DeviceLogMapper
deviceLogMapper
;
@Autowired
@Autowired
private
DeviceStatusLogService
deviceStatusLogService
;
private
DeviceStatusLogService
deviceStatusLogService
;
@Value
(
"${mqtt.device-op-last-time}"
)
private
Integer
deviceOpLastTime
;
/**
/**
* 清除网关锁id列表
* 清除网关锁id列表
...
@@ -557,7 +560,7 @@ public class MqttxServiceImpl implements MqttxService {
...
@@ -557,7 +560,7 @@ public class MqttxServiceImpl implements MqttxService {
Map
<
String
,
Device
>
map
=
deviceList
.
stream
()
Map
<
String
,
Device
>
map
=
deviceList
.
stream
()
.
collect
(
Collectors
.
toMap
(
Device:
:
getDevId
,
Function
.
identity
()));
.
collect
(
Collectors
.
toMap
(
Device:
:
getDevId
,
Function
.
identity
()));
// 设备操作日志(最近3分钟内的最新操作日志)
// 设备操作日志(最近3分钟内的最新操作日志)
Date
startDate
=
DateUtil
.
offsetMinute
(
DateUtil
.
date
(),
-
5
);
Date
startDate
=
DateUtil
.
offsetMinute
(
DateUtil
.
date
(),
deviceOpLastTime
);
List
<
DeviceLog
>
deviceLogList
=
deviceLogMapper
.
selectListByMaxId
(
devIds
,
startDate
);
List
<
DeviceLog
>
deviceLogList
=
deviceLogMapper
.
selectListByMaxId
(
devIds
,
startDate
);
// 将List转换为Map
// 将List转换为Map
Map
<
String
,
DeviceLog
>
deviceLogMap
=
deviceLogList
.
stream
()
Map
<
String
,
DeviceLog
>
deviceLogMap
=
deviceLogList
.
stream
()
...
...
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