Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
device-new-platform
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
赵啸非
device-new-platform
Commits
f7eb0391
Commit
f7eb0391
authored
Jun 19, 2023
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加设备上线和下线的业务日志记录
parent
ea362255
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
27 additions
and
4 deletions
+27
-4
device-manager/src/main/java/com/mortals/xhx/base/framework/listener/CustomerKeyExpirationListener.java
...ase/framework/listener/CustomerKeyExpirationListener.java
+20
-0
device-manager/src/main/java/com/mortals/xhx/base/framework/listener/DirectDynamicListener.java
...ls/xhx/base/framework/listener/DirectDynamicListener.java
+2
-1
device-manager/src/main/java/com/mortals/xhx/daemon/applicationservice/DeviceMsgComsumerStartedService.java
...n/applicationservice/DeviceMsgComsumerStartedService.java
+2
-1
device-manager/src/main/java/com/mortals/xhx/daemon/task/DeviceStatTaskImpl.java
.../java/com/mortals/xhx/daemon/task/DeviceStatTaskImpl.java
+2
-1
device-manager/src/main/java/com/mortals/xhx/module/device/web/DeviceLogController.java
...om/mortals/xhx/module/device/web/DeviceLogController.java
+1
-1
No files found.
device-manager/src/main/java/com/mortals/xhx/base/framework/listener/CustomerKeyExpirationListener.java
View file @
f7eb0391
package
com.mortals.xhx.base.framework.listener
;
package
com.mortals.xhx.base.framework.listener
;
import
cn.hutool.core.codec.Base64
;
import
cn.hutool.core.util.IdUtil
;
import
cn.hutool.core.util.IdUtil
;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.core.util.StrUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.mortals.framework.common.Rest
;
import
com.mortals.framework.common.Rest
;
import
com.mortals.framework.model.BizLogPdu
;
import
com.mortals.framework.service.IMessageProduceService
;
import
com.mortals.xhx.common.code.*
;
import
com.mortals.xhx.common.code.*
;
import
com.mortals.xhx.common.key.RedisKey
;
import
com.mortals.xhx.common.key.RedisKey
;
import
com.mortals.xhx.common.pdu.RespData
;
import
com.mortals.xhx.common.pdu.RespData
;
...
@@ -60,6 +63,8 @@ public class CustomerKeyExpirationListener implements MessageListener {
...
@@ -60,6 +63,8 @@ public class CustomerKeyExpirationListener implements MessageListener {
private
AlarmSmsSendService
alarmSmsSendService
;
private
AlarmSmsSendService
alarmSmsSendService
;
@Autowired
@Autowired
private
ISmsSetFeign
smsSetFeign
;
private
ISmsSetFeign
smsSetFeign
;
@Autowired
private
IMessageProduceService
messageProducer
;
@Override
@Override
public
void
onMessage
(
Message
message
,
byte
[]
bytes
)
{
public
void
onMessage
(
Message
message
,
byte
[]
bytes
)
{
...
@@ -87,6 +92,21 @@ public class CustomerKeyExpirationListener implements MessageListener {
...
@@ -87,6 +92,21 @@ public class CustomerKeyExpirationListener implements MessageListener {
if
(!
ObjectUtils
.
isEmpty
(
platformEntity
)
&&
!
ObjectUtils
.
isEmpty
(
productEntity
))
{
if
(!
ObjectUtils
.
isEmpty
(
platformEntity
)
&&
!
ObjectUtils
.
isEmpty
(
productEntity
))
{
//通知第三方平台
//通知第三方平台
deviceService
.
sendThirdParty
(
deviceEntity
,
productEntity
,
platformEntity
,
DeviceMethodEnum
.
OFFLINE
);
deviceService
.
sendThirdParty
(
deviceEntity
,
productEntity
,
platformEntity
,
DeviceMethodEnum
.
OFFLINE
);
//保存业务消息为离线
BizLogPdu
bizLogPdu
=
new
BizLogPdu
();
bizLogPdu
.
initAttrValue
();
//保存为产品名称
bizLogPdu
.
setAppName
(
productEntity
.
getProductCode
());
bizLogPdu
.
setTraceID
(
IdUtil
.
objectId
());
bizLogPdu
.
setUserCode
(
"system"
);
bizLogPdu
.
setDeviceCode
(
deviceEntity
.
getDeviceCode
());
bizLogPdu
.
setEventTopic
(
"online"
);
bizLogPdu
.
setEventTopicName
(
LogTypeEnum
.
上报事件
.
name
());
bizLogPdu
.
setMsg
(
Base64
.
encode
(
"设备下线"
));
bizLogPdu
.
setLogLevel
(
"INFO"
);
bizLogPdu
.
setLogTime
(
new
Date
());
messageProducer
.
syncBizSend
(
bizLogPdu
);
}
}
//保存离线告警消息
//保存离线告警消息
...
...
device-manager/src/main/java/com/mortals/xhx/base/framework/listener/DirectDynamicListener.java
View file @
f7eb0391
package
com.mortals.xhx.base.framework.listener
;
package
com.mortals.xhx.base.framework.listener
;
import
cn.hutool.core.codec.Base64
;
import
cn.hutool.core.util.IdUtil
;
import
cn.hutool.core.util.IdUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.mortals.framework.ap.GlobalSysInfo
;
import
com.mortals.framework.ap.GlobalSysInfo
;
...
@@ -105,7 +106,7 @@ public class DirectDynamicListener implements MessageListener {
...
@@ -105,7 +106,7 @@ public class DirectDynamicListener implements MessageListener {
bizLogPdu
.
setDeviceCode
(
deviceEntity
.
getDeviceCode
());
bizLogPdu
.
setDeviceCode
(
deviceEntity
.
getDeviceCode
());
bizLogPdu
.
setEventTopic
(
"online"
);
bizLogPdu
.
setEventTopic
(
"online"
);
bizLogPdu
.
setEventTopicName
(
LogTypeEnum
.
上报事件
.
name
());
bizLogPdu
.
setEventTopicName
(
LogTypeEnum
.
上报事件
.
name
());
bizLogPdu
.
setMsg
(
"设备上线"
);
bizLogPdu
.
setMsg
(
Base64
.
encode
(
"设备上线"
)
);
bizLogPdu
.
setLogLevel
(
"INFO"
);
bizLogPdu
.
setLogLevel
(
"INFO"
);
bizLogPdu
.
setLogTime
(
new
Date
());
bizLogPdu
.
setLogTime
(
new
Date
());
messageProducer
.
syncBizSend
(
bizLogPdu
);
messageProducer
.
syncBizSend
(
bizLogPdu
);
...
...
device-manager/src/main/java/com/mortals/xhx/daemon/applicationservice/DeviceMsgComsumerStartedService.java
View file @
f7eb0391
package
com.mortals.xhx.daemon.applicationservice
;
package
com.mortals.xhx.daemon.applicationservice
;
import
cn.hutool.core.codec.Base64
;
import
cn.hutool.core.util.IdUtil
;
import
cn.hutool.core.util.IdUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.mortals.framework.ap.GlobalSysInfo
;
import
com.mortals.framework.ap.GlobalSysInfo
;
...
@@ -190,7 +191,7 @@ public class DeviceMsgComsumerStartedService implements IApplicationStartedServi
...
@@ -190,7 +191,7 @@ public class DeviceMsgComsumerStartedService implements IApplicationStartedServi
bizLogPdu
.
setDeviceCode
(
deviceEntity
.
getDeviceCode
());
bizLogPdu
.
setDeviceCode
(
deviceEntity
.
getDeviceCode
());
bizLogPdu
.
setEventTopic
(
"online"
);
bizLogPdu
.
setEventTopic
(
"online"
);
bizLogPdu
.
setEventTopicName
(
LogTypeEnum
.
上报事件
.
name
());
bizLogPdu
.
setEventTopicName
(
LogTypeEnum
.
上报事件
.
name
());
bizLogPdu
.
setMsg
(
"设备上线"
);
bizLogPdu
.
setMsg
(
Base64
.
encode
(
"设备上线"
)
);
bizLogPdu
.
setLogLevel
(
"INFO"
);
bizLogPdu
.
setLogLevel
(
"INFO"
);
bizLogPdu
.
setLogTime
(
new
Date
());
bizLogPdu
.
setLogTime
(
new
Date
());
messageProducer
.
syncBizSend
(
bizLogPdu
);
messageProducer
.
syncBizSend
(
bizLogPdu
);
...
...
device-manager/src/main/java/com/mortals/xhx/daemon/task/DeviceStatTaskImpl.java
View file @
f7eb0391
package
com.mortals.xhx.daemon.task
;
package
com.mortals.xhx.daemon.task
;
import
cn.hutool.core.codec.Base64
;
import
cn.hutool.core.util.IdUtil
;
import
cn.hutool.core.util.IdUtil
;
import
com.mortals.framework.exception.AppException
;
import
com.mortals.framework.exception.AppException
;
import
com.mortals.framework.model.BizLogPdu
;
import
com.mortals.framework.model.BizLogPdu
;
...
@@ -97,7 +98,7 @@ public class DeviceStatTaskImpl implements ITaskExcuteService {
...
@@ -97,7 +98,7 @@ public class DeviceStatTaskImpl implements ITaskExcuteService {
bizLogPdu
.
setDeviceCode
(
deviceEntity
.
getDeviceCode
());
bizLogPdu
.
setDeviceCode
(
deviceEntity
.
getDeviceCode
());
bizLogPdu
.
setEventTopic
(
"offline"
);
bizLogPdu
.
setEventTopic
(
"offline"
);
bizLogPdu
.
setEventTopicName
(
LogTypeEnum
.
上报事件
.
name
());
bizLogPdu
.
setEventTopicName
(
LogTypeEnum
.
上报事件
.
name
());
bizLogPdu
.
setMsg
(
"设备离线"
);
bizLogPdu
.
setMsg
(
Base64
.
encode
(
"设备离线"
)
);
bizLogPdu
.
setLogLevel
(
"INFO"
);
bizLogPdu
.
setLogLevel
(
"INFO"
);
bizLogPdu
.
setLogTime
(
new
Date
());
bizLogPdu
.
setLogTime
(
new
Date
());
messageProducer
.
syncBizSend
(
bizLogPdu
);
messageProducer
.
syncBizSend
(
bizLogPdu
);
...
...
device-manager/src/main/java/com/mortals/xhx/module/device/web/DeviceLogController.java
View file @
f7eb0391
...
@@ -52,7 +52,7 @@ public class DeviceLogController extends BaseCRUDJsonBodyMappingController<Devic
...
@@ -52,7 +52,7 @@ public class DeviceLogController extends BaseCRUDJsonBodyMappingController<Devic
}
}
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
String
en
=
"
eyJ3YWl0Y291bnQiOiIzIiwiZm9yd2FpdGNvdW50IjoiMCJ9
"
;
String
en
=
"
好的
"
;
System
.
out
.
println
(
Base64
.
decodeStr
(
en
));
System
.
out
.
println
(
Base64
.
decodeStr
(
en
));
}
}
...
...
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