Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation
This project
Loading...
Sign in
李苗
/
Vion-DevOps
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 644cce09
authored
Nov 06, 2024
by
HlQ
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
[add] 添加门店人数波动异常事件处理
[chg] 行分隔符修改 CRLF -> LF
1 parent
ca5b6f5c
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
118 additions
and
32 deletions
src/main/java/vion/constant/MqttMessageType.java
src/main/java/vion/event/mqtt/MqttClientMessageListener.java
src/main/java/vion/constant/MqttMessageType.java
View file @
644cce0
...
...
@@ -7,34 +7,91 @@ import java.util.Arrays;
@Getter
public
enum
MqttMessageType
{
/**
* 注册
*/
REGISTER
(
"REGISTER"
),
/**
* 升级
*/
UPGRADE
(
"UPGRADE"
),
// region store + mall 共有
/**
* 客流数据中断
*/
PASSENGER_FLOW_INTERRUPT
(
"PASSENGER_FLOW_INTERRUPT"
),
/**
* 设备离线
*/
DEVICE_OFFLINE
(
"DEVICE_OFFLINE"
),
/**
* 全天分析异常
*/
REID_ANALYZE
(
"REID_EXCEPTION"
),
/**
* 设备注册次数异常
*/
DEVICE_REGISTRATION
(
"DEVICE_REGISTRATION"
),
/**
* 设备特征异常
*/
DEVICE_FEATURE
(
"DEVICE_FEATURE"
),
/**
* 人数/人次异常
*/
HEADCOUNT_RATIO
(
"HEADCOUNT_RATIO"
),
/**
* 店员识别异常
*/
STAFF_RECOGNIZE
(
"STAFF_RECOGNIZE"
),
// endregion
// region store
/**
* 门店顾客人数波动异常
*/
STORE_CUSTOMER_UNDULATE
(
"STORE_CUSTOMER_UNDULATE"
),
/**
* 门店监控点数据波动异常
*/
STORE_GATE_DATA_UNDULATE
(
"STORE_GATE_DATA_UNDULATE"
),
/**
* 门店进出匹配率异常
*/
STORE_INOUT_MATCH_RATIO
(
"STORE_INOUT_MATCH_RATIO"
),
/**
* 门店单聚类异常
*/
STORE_SINGLE_CLUSTER
(
"STORE_SINGLE_CLUSTER"
),
/**
* 门店进店率异常
*/
STORE_ENTER_RATIO
(
"STORE_ENTER_RATIO"
),
// endregion
// region mall
/**
* 广场进出客流差异异常
*/
MALL_INOUT_DIFF
(
"MALL_INOUT_DIFF"
),
/**
* 广场店铺进出差异异常
*/
MALL_SHOP_INOUT_DIFF
(
"MALL_SHOP_INOUT_DIFF"
),
/**
*
store + mall 共有
*
广场数据波动异常
*/
PASSENGER_FLOW_INTERRUPT
(
"PASSENGER_FLOW_INTERRUPT"
),
//客流数据中断,
DEVICE_OFFLINE
(
"DEVICE_OFFLINE"
),
//设备离线
REID_ANALYZE
(
"REID_EXCEPTION"
),
//全天分析异常
DEVICE_REGISTRATION
(
"DEVICE_REGISTRATION"
),
//设备注册次数异常
DEVICE_FEATURE
(
"DEVICE_FEATURE"
),
//设备特征异常
HEADCOUNT_RATIO
(
"HEADCOUNT_RATIO"
),
//人数/人次异常
STAFF_RECOGNIZE
(
"STAFF_RECOGNIZE"
),
//店员识别异常
MALL_DATA_UNDULATE
(
"MALL_DATA_UNDULATE"
),
/**
*
store
*
广场外围入口数据波动异常
*/
STORE_CUSTOMER_UNDULATE
(
"STORE_CUSTOMER_UNDULATE"
),
//门店顾客人数波动异常
STORE_GATE_DATA_UNDULATE
(
"STORE_GATE_DATA_UNDULATE"
),
//门店监控点数据波动异常
STORE_INOUT_MATCH_RATIO
(
"STORE_INOUT_MATCH_RATIO"
),
//门店进出匹配率异常
STORE_SINGLE_CLUSTER
(
"STORE_SINGLE_CLUSTER"
),
//门店单聚类异常
STORE_ENTER_RATIO
(
"STORE_ENTER_RATIO"
),
//门店进店率异常
MALL_GATE_DATA_UNDULATE
(
"MALL_GATE_DATA_UNDULATE"
),
/**
*
mall
*
广场店铺数据波动异常
*/
MALL_INOUT_DIFF
(
"MALL_INOUT_DIFF"
),
//广场进出客流差异异常
MALL_SHOP_INOUT_DIFF
(
"MALL_SHOP_INOUT_DIFF"
),
//广场店铺进出差异异常
MALL_DATA_UNDULATE
(
"MALL_DATA_UNDULATE"
),
//广场数据波动异常
MALL_GATE_DATA_UNDULATE
(
"MALL_GATE_DATA_UNDULATE"
),
//广场外围入口数据波动异常
MALL_SHOP_DATA_UNDULATE
(
"MALL_SHOP_DATA_UNDULATE"
),
//广场店铺数据波动异常
MALL_SHOP_DATA_UNDULATE
(
"MALL_SHOP_DATA_UNDULATE"
),
// endregion
;
private
final
String
type
;
...
...
src/main/java/vion/event/mqtt/MqttClientMessageListener.java
View file @
644cce0
...
...
@@ -42,22 +42,25 @@ public class MqttClientMessageListener {
String
type
=
jsonObj
.
path
(
"eventType"
).
asText
();
switch
(
MqttMessageType
.
getEnumByType
(
type
))
{
case
MqttMessageType
.
REGISTER
:
log
.
info
(
"设备注册:{}"
,
jsonObj
);
String
agentUid
=
jsonObj
.
path
(
"agentUid"
).
asText
();
updateTaskByAgent
(
agentUid
);
break
;
case
MqttMessageType
.
PASSENGER_FLOW_INTERRUPT
:
handlePassengerFlowInterrupt
(
jsonObj
.
toString
());
break
;
case
MqttMessageType
.
DEVICE_OFFLINE
:
//设备离线
handleDeviceOffline
(
jsonObj
.
toString
());
break
;
case
MqttMessageType
.
REID_ANALYZE
:
//全天分析异常
handleWholeDayAnalyze
(
jsonObj
.
toString
());
handleReid
(
jsonObj
.
toString
());
break
;
case
MqttMessageType
.
PASSENGER_FLOW_INTERRUPT
:
//客流数据中断
handle
PassengerFlowInterrupt
(
jsonObj
.
toString
());
// region store 事件
case
STORE_CUSTOMER_UNDULATE:
handle
StoreCustomerUndulate
(
jsonObj
.
toString
());
break
;
// endregion
// region mall 事件
// endregion
default
:
log
.
info
(
"未定义的消息类型:{}, payload:{}"
,
type
,
jsonObj
);
break
;
...
...
@@ -67,7 +70,11 @@ public class MqttClientMessageListener {
}
}
//下发事件
/**
* 下发事件
*
* @param agentUid agent uid
*/
private
void
updateTaskByAgent
(
String
agentUid
)
{
List
<
RAgentEvent
>
list
=
agentEventService
.
lambdaQuery
()
.
eq
(
RAgentEvent:
:
getAgentUid
,
agentUid
)
...
...
@@ -88,22 +95,44 @@ public class MqttClientMessageListener {
log
.
info
(
"agent:{} topic:{} 结束下发事件监测"
,
agentUid
,
topic
);
}
//设备离线上报
/**
* 设备离线上报
*
* @param payloadStr 事件记录
*/
private
void
handleDeviceOffline
(
String
payloadStr
)
{
EventRecord
eventRecord
=
JsonUtil
.
parseObject
(
payloadStr
,
EventRecord
.
class
);
recordService
.
save
(
eventRecord
);
}
//全天分析异常上报
private
void
handleWholeDayAnalyze
(
String
payloadStr
)
{
/**
* 全天分析异常上报
*
* @param payloadStr 事件记录
*/
private
void
handleReid
(
String
payloadStr
)
{
EventRecord
eventRecord
=
JsonUtil
.
parseObject
(
payloadStr
,
EventRecord
.
class
);
recordService
.
save
(
eventRecord
);
}
//客流数据中断
/**
* 客流数据中断
*
* @param payloadStr 事件记录
*/
private
void
handlePassengerFlowInterrupt
(
String
payloadStr
)
{
EventRecord
eventRecord
=
JsonUtil
.
parseObject
(
payloadStr
,
EventRecord
.
class
);
recordService
.
save
(
eventRecord
);
}
/**
* 门店人数波动异常
*
* @param payloadStr 事件记录
*/
private
void
handleStoreCustomerUndulate
(
String
payloadStr
)
{
EventRecord
eventRecord
=
JsonUtil
.
parseObject
(
payloadStr
,
EventRecord
.
class
);
recordService
.
save
(
eventRecord
);
}
}
Write
Preview
Markdown
is supported
Attach a file
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 post a comment