切换导航条
此项目
正在载入...
登录
message_bus
/
message_bus_service
·
提交
转到一个项目
GitLab
转到群组
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
朱兆平
2 years ago
提交
7838b008b21aa8cddc3431b1e77c1c8ec58eaf2c
1 个父辈
e67be036
雪花算法生成方法时间超长40s左右问题修复.增加路由订阅者日志展示
隐藏空白字符变更
内嵌
并排对比
正在显示
2 个修改的文件
包含
6 行增加
和
2 行删除
src/main/java/com/sunyo/wlpt/message/bus/service/service/impl/MessageRouterReciverImpl.java
src/main/java/com/sunyo/wlpt/message/bus/service/utils/IdUtils.java
src/main/java/com/sunyo/wlpt/message/bus/service/service/impl/MessageRouterReciverImpl.java
查看文件 @
7838b00
...
...
@@ -6,6 +6,7 @@ import com.sunyo.wlpt.message.bus.service.model.MessageRouterReciver;
import
com.sunyo.wlpt.message.bus.service.response.ResultJson
;
import
com.sunyo.wlpt.message.bus.service.service.MessageRouterReciverService
;
import
com.sunyo.wlpt.message.bus.service.utils.IdUtils
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
@@ -14,6 +15,7 @@ import org.springframework.transaction.annotation.Transactional;
import
javax.annotation.Resource
;
import
java.util.List
;
@Slf4j
@Service
public
class
MessageRouterReciverImpl
implements
MessageRouterReciverService
{
...
...
@@ -43,11 +45,13 @@ public class MessageRouterReciverImpl implements MessageRouterReciverService {
)
{
if
(
StringUtils
.
isNotBlank
(
rcvr
.
getRcvrTopic
())){
rcvr
.
setMessageRouterId
(
messageRouter
.
getId
());
rcvr
.
setId
(
IdUtils
.
generateId
());
List
<
MessageRouterReciver
>
list
=
messageRouterReciverMapper
.
selectByRouterKeyAndTopic
(
rcvr
);
//判断是否已经有这条数据
if
(
list
.
isEmpty
()){
rcvr
.
setId
(
IdUtils
.
generateId
());
i
+=
messageRouterReciverMapper
.
insertSelective
(
rcvr
);
log
.
info
(
"新增{}的类型{}订阅者{}成功,关联订阅者ID{}"
,
messageRouter
.
getSndr
(),
messageRouter
.
getStype
(),
rcvr
.
getRcvrTopic
(),
rcvr
.
getId
());
};
}
}
...
...
src/main/java/com/sunyo/wlpt/message/bus/service/utils/IdUtils.java
查看文件 @
7838b00
...
...
@@ -6,13 +6,13 @@ package com.sunyo.wlpt.message.bus.service.utils;
* 时间:2020/7/1 9:26
*/
public
class
IdUtils
{
private
static
IdWorker
idWorker
=
new
IdWorker
();
/**
* 静态工具类
*
* @return id
*/
public
static
synchronized
String
generateId
()
{
IdWorker
idWorker
=
new
IdWorker
();
long
nextId
=
idWorker
.
nextId
();
String
id
=
String
.
valueOf
(
nextId
);
return
id
;
...
...
请
注册
或
登录
后发表评论