Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
clx-performance
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
姜武杰
clx-performance
Commits
c2abc5e9
提交
c2abc5e9
authored
6月 04, 2024
作者:
艾庆国
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
线路预警
上级
596f7c51
显示空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
77 行增加
和
0 行删除
+77
-0
LineWarnLineReportMqParam.java
...formance/param/mq/linewarn/LineWarnLineReportMqParam.java
+43
-0
RabbitLineWarnConfig.java
...java/com/clx/performance/config/RabbitLineWarnConfig.java
+12
-0
RabbitKeyLineWarnConstants.java
.../clx/performance/constant/RabbitKeyLineWarnConstants.java
+6
-0
LineWarnMqServiceImpl.java
...formance/service/impl/linewarn/LineWarnMqServiceImpl.java
+14
-0
LineWarnMqService.java
...m/clx/performance/service/linewarn/LineWarnMqService.java
+2
-0
没有找到文件。
performance-api/src/main/java/com/clx/performance/param/mq/linewarn/LineWarnLineReportMqParam.java
0 → 100644
浏览文件 @
c2abc5e9
package
com
.
clx
.
performance
.
param
.
mq
.
linewarn
;
import
com.clx.performance.enums.linewarn.LineWarnConfigEnum
;
import
lombok.*
;
import
java.util.Arrays
;
import
java.util.Optional
;
/**
* @Author: aiqingguo
* @Description: 通知
* @Date: 2023-10-19 15:45:25
* @Version: 1.0
*/
@Setter
@Getter
@ToString
@NoArgsConstructor
public
class
LineWarnLineReportMqParam
{
private
Integer
sendSystemAddressId
;
private
Integer
receiveSystemAddressId
;
private
Integer
reportType
;
//1线路异常 2拥堵预警
@Getter
@AllArgsConstructor
public
enum
ReportType
{
LINE
(
1
,
"线路异常"
),
JAM
(
2
,
"拥堵预警"
),
;
private
final
Integer
code
;
private
final
String
msg
;
public
static
Optional
<
ReportType
>
getByCode
(
int
code
)
{
return
Arrays
.
stream
(
values
()).
filter
(
e
->
e
.
code
==
code
).
findFirst
();
}
public
static
String
getMsgByCode
(
int
code
)
{
return
getByCode
(
code
).
map
(
ReportType:
:
getMsg
).
orElse
(
null
);
}
}
}
performance-web/src/main/java/com/clx/performance/config/RabbitLineWarnConfig.java
浏览文件 @
c2abc5e9
...
...
@@ -84,4 +84,16 @@ public class RabbitLineWarnConfig {
return
BindingBuilder
.
bind
(
lineWarnNoticeQueue
()).
to
(
lineWarnDefaultExchange
()).
with
(
RabbitKeyLineWarnConstants
.
LINE_WARN_NOTICE_ROUTING_KEY
);
}
/**
* 线路上报
*/
@Bean
public
Queue
lineWarnLineReportQueue
()
{
return
new
Queue
(
RabbitKeyLineWarnConstants
.
LINE_WARN_LINE_REPORT_QUEUE
);
}
@Bean
public
Binding
lineWarnLineReportQueueBinding
()
{
return
BindingBuilder
.
bind
(
lineWarnNoticeQueue
()).
to
(
lineWarnDefaultExchange
()).
with
(
RabbitKeyLineWarnConstants
.
LINE_WARN_LINE_REPORT_ROUTING_KEY
);
}
}
performance-web/src/main/java/com/clx/performance/constant/RabbitKeyLineWarnConstants.java
浏览文件 @
c2abc5e9
...
...
@@ -51,4 +51,10 @@ public class RabbitKeyLineWarnConstants {
public
static
final
String
LINE_WARN_NOTICE_QUEUE
=
PREFIX
+
"lineWarn.notice"
+
QUEUE
;
public
static
final
String
LINE_WARN_NOTICE_ROUTING_KEY
=
PREFIX
+
"lineWarn.notice"
+
QUEUE_ROUTING_KEY
;
/**
* 线路上报
*/
public
static
final
String
LINE_WARN_LINE_REPORT_QUEUE
=
PREFIX
+
"lineWarn.lineReport"
+
QUEUE
;
public
static
final
String
LINE_WARN_LINE_REPORT_ROUTING_KEY
=
PREFIX
+
"lineWarn.lineReport"
+
QUEUE_ROUTING_KEY
;
}
performance-web/src/main/java/com/clx/performance/service/impl/linewarn/LineWarnMqServiceImpl.java
浏览文件 @
c2abc5e9
...
...
@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
import
com.clx.performance.common.MqDelay
;
import
com.clx.performance.common.MqWrapper
;
import
com.clx.performance.constant.RabbitKeyLineWarnConstants
;
import
com.clx.performance.param.mq.linewarn.LineWarnLineReportMqParam
;
import
com.clx.performance.param.mq.linewarn.LineWarnLineWarnMqParam
;
import
com.clx.performance.param.mq.linewarn.LineWarnNoticeMqParam
;
import
com.clx.performance.param.mq.linewarn.LineWarnOrderGoodsAddMqParam
;
...
...
@@ -55,4 +56,17 @@ public class LineWarnMqServiceImpl implements LineWarnMqService {
rabbitTemplate
.
send
(
RabbitKeyLineWarnConstants
.
DEFAULT_EXCHANGE
,
RabbitKeyLineWarnConstants
.
DEFAULT_DELAY_ROUTING_KEY
,
message
);
}
@Override
public
void
lineReport
(
Integer
sendSystemAddressId
,
Integer
receiveSystemAddressId
,
Integer
reportType
)
{
LineWarnLineReportMqParam
mq
=
new
LineWarnLineReportMqParam
();
mq
.
setSendSystemAddressId
(
sendSystemAddressId
);
mq
.
setReceiveSystemAddressId
(
receiveSystemAddressId
);
mq
.
setReportType
(
reportType
);
MqDelay
delay
=
new
MqDelay
<>(
RabbitKeyLineWarnConstants
.
DEFAULT_EXCHANGE
,
RabbitKeyLineWarnConstants
.
LINE_WARN_LINE_REPORT_ROUTING_KEY
,
new
MqWrapper
<>(
mq
));
Message
message
=
MessageBuilder
.
withBody
(
JSON
.
toJSONString
(
new
MqWrapper
<>(
delay
)).
getBytes
()).
build
();
message
.
getMessageProperties
().
setExpiration
(
"5000"
);
rabbitTemplate
.
send
(
RabbitKeyLineWarnConstants
.
DEFAULT_EXCHANGE
,
RabbitKeyLineWarnConstants
.
DEFAULT_DELAY_ROUTING_KEY
,
message
);
}
}
performance-web/src/main/java/com/clx/performance/service/linewarn/LineWarnMqService.java
浏览文件 @
c2abc5e9
...
...
@@ -7,4 +7,6 @@ public interface LineWarnMqService {
void
lineWarn
(
String
childNo
);
void
lineWarnNotice
(
Integer
infoId
);
void
lineReport
(
Integer
sendSystemAddressId
,
Integer
receiveSystemAddressId
,
Integer
reportType
);
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论