Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
log-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
赵啸非
log-platform
Commits
3a380c87
Commit
3a380c87
authored
Sep 23, 2022
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
业务日志添加
parent
22775c20
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
20 additions
and
12 deletions
+20
-12
log-manager/pom.xml
log-manager/pom.xml
+6
-6
log-manager/src/main/java/com/mortals/xhx/base/framework/listener/BizMessageConsumerListener.java
...x/base/framework/listener/BizMessageConsumerListener.java
+2
-0
log-manager/src/main/java/com/mortals/xhx/module/operate/service/impl/OperateLogServiceImpl.java
...hx/module/operate/service/impl/OperateLogServiceImpl.java
+6
-0
log-manager/src/main/resources/bootstrap.yml
log-manager/src/main/resources/bootstrap.yml
+1
-1
log-manager/src/main/resources/sqlmap/module/biz/BizLogMapper.xml
...ger/src/main/resources/sqlmap/module/biz/BizLogMapper.xml
+5
-5
No files found.
log-manager/pom.xml
View file @
3a380c87
...
@@ -27,15 +27,15 @@
...
@@ -27,15 +27,15 @@
<![CDATA[jdbc:mysql://localhost:3306/log-platform?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Hongkong]]>
</profiles.datasource.uri>
<![CDATA[jdbc:mysql://localhost:3306/log-platform?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Hongkong]]>
</profiles.datasource.uri>
<profiles.datasource.username>
root
</profiles.datasource.username>
<profiles.datasource.username>
root
</profiles.datasource.username>
<profiles.datasource.password>
12345678
</profiles.datasource.password>
<profiles.datasource.password>
12345678
</profiles.datasource.password>
<profiles.redis.uri>
1
92.168.0.252
</profiles.redis.uri>
<profiles.redis.uri>
1
27.0.0.1
</profiles.redis.uri>
<profiles.redis.port>
6379
</profiles.redis.port>
<profiles.redis.port>
6379
</profiles.redis.port>
<profiles.redis.username></profiles.redis.username>
<profiles.redis.username></profiles.redis.username>
<profiles.redis.password>
hotel@2020
</profiles.redis.password>
<profiles.redis.password></profiles.redis.password>
<profiles.redis.database>
8
</profiles.redis.database>
<profiles.redis.database>
8
</profiles.redis.database>
<profiles.rabbitmq.host>
1
92.168.0.98
</profiles.rabbitmq.host>
<profiles.rabbitmq.host>
1
27.0.0.1
</profiles.rabbitmq.host>
<profiles.rabbitmq.port>
5672
</profiles.rabbitmq.port>
<profiles.rabbitmq.port>
5672
</profiles.rabbitmq.port>
<profiles.rabbitmq.username>
taxi_mq
</profiles.rabbitmq.username>
<profiles.rabbitmq.username>
guest
</profiles.rabbitmq.username>
<profiles.rabbitmq.password>
admin@2020
</profiles.rabbitmq.password>
<profiles.rabbitmq.password>
guest
</profiles.rabbitmq.password>
<profiles.rabbitmq.virtualhost>
/
</profiles.rabbitmq.virtualhost>
<profiles.rabbitmq.virtualhost>
/
</profiles.rabbitmq.virtualhost>
<profiles.rabbitmq.exchange></profiles.rabbitmq.exchange>
<profiles.rabbitmq.exchange></profiles.rabbitmq.exchange>
<profiles.filepath>
/mortals/data
</profiles.filepath>
<profiles.filepath>
/mortals/data
</profiles.filepath>
...
@@ -43,7 +43,7 @@
...
@@ -43,7 +43,7 @@
<profiles.log.path>
/logs
</profiles.log.path>
<profiles.log.path>
/logs
</profiles.log.path>
<profiles.data.path>
/data
</profiles.data.path>
<profiles.data.path>
/data
</profiles.data.path>
<profiles.nacos.server-addr>
1
92.168.0.252
:8848
</profiles.nacos.server-addr>
<profiles.nacos.server-addr>
1
27.0.0.1
:8848
</profiles.nacos.server-addr>
<profiles.nacos.group>
DEFAULT_GROUP
</profiles.nacos.group>
<profiles.nacos.group>
DEFAULT_GROUP
</profiles.nacos.group>
<profiles.nacos.namespace>
smart-gov
</profiles.nacos.namespace>
<profiles.nacos.namespace>
smart-gov
</profiles.nacos.namespace>
</properties>
</properties>
...
...
log-manager/src/main/java/com/mortals/xhx/base/framework/listener/BizMessageConsumerListener.java
View file @
3a380c87
package
com.mortals.xhx.base.framework.listener
;
package
com.mortals.xhx.base.framework.listener
;
import
cn.hutool.core.util.IdUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.mortals.xhx.common.key.QueueKey
;
import
com.mortals.xhx.common.key.QueueKey
;
import
com.mortals.xhx.module.access.model.AccessLogEntity
;
import
com.mortals.xhx.module.access.model.AccessLogEntity
;
...
@@ -37,6 +38,7 @@ public class BizMessageConsumerListener {
...
@@ -37,6 +38,7 @@ public class BizMessageConsumerListener {
log
.
info
(
"[Biz onMessage][线程编号:{} 消息数量:{}]"
,
Thread
.
currentThread
().
getName
()+
Thread
.
currentThread
().
getId
(),
messages
.
size
());
log
.
info
(
"[Biz onMessage][线程编号:{} 消息数量:{}]"
,
Thread
.
currentThread
().
getName
()+
Thread
.
currentThread
().
getId
(),
messages
.
size
());
List
<
BizLogEntity
>
collect
=
messages
.
stream
().
map
(
str
->
{
List
<
BizLogEntity
>
collect
=
messages
.
stream
().
map
(
str
->
{
BizLogEntity
entity
=
JSON
.
parseObject
(
str
,
BizLogEntity
.
class
);
BizLogEntity
entity
=
JSON
.
parseObject
(
str
,
BizLogEntity
.
class
);
entity
.
setId
(
IdUtil
.
getSnowflake
(
0
,
1
).
nextId
());
entity
.
setCreateUserId
(
1L
);
entity
.
setCreateUserId
(
1L
);
entity
.
setCreateTime
(
new
Date
());
entity
.
setCreateTime
(
new
Date
());
return
entity
;
return
entity
;
...
...
log-manager/src/main/java/com/mortals/xhx/module/operate/service/impl/OperateLogServiceImpl.java
View file @
3a380c87
package
com.mortals.xhx.module.operate.service.impl
;
package
com.mortals.xhx.module.operate.service.impl
;
import
cn.hutool.core.lang.Snowflake
;
import
cn.hutool.core.lang.Snowflake
;
import
cn.hutool.core.util.IdUtil
;
import
cn.hutool.core.util.IdUtil
;
import
cn.hutool.core.util.RandomUtil
;
import
com.mortals.xhx.module.error.model.ErrorLogEntity
;
import
com.mortals.xhx.module.error.model.ErrorLogEntity
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
com.mortals.framework.service.impl.AbstractCRUDServiceImpl
;
import
com.mortals.framework.service.impl.AbstractCRUDServiceImpl
;
...
@@ -22,4 +23,9 @@ import java.util.Date;
...
@@ -22,4 +23,9 @@ import java.util.Date;
@Service
(
"operateLogService"
)
@Service
(
"operateLogService"
)
public
class
OperateLogServiceImpl
extends
AbstractCRUDServiceImpl
<
OperateLogDao
,
OperateLogEntity
,
Long
>
implements
OperateLogService
{
public
class
OperateLogServiceImpl
extends
AbstractCRUDServiceImpl
<
OperateLogDao
,
OperateLogEntity
,
Long
>
implements
OperateLogService
{
public
static
void
main
(
String
[]
args
)
{
System
.
out
.
println
(
RandomUtil
.
randomString
(
1024
));
}
}
}
\ No newline at end of file
log-manager/src/main/resources/bootstrap.yml
View file @
3a380c87
...
@@ -21,7 +21,7 @@ spring:
...
@@ -21,7 +21,7 @@ spring:
host
:
@
profiles.redis.uri@
host
:
@
profiles.redis.uri@
port
:
@
profiles.redis.port@
port
:
@
profiles.redis.port@
username
:
@
profiles.redis.username@
username
:
@
profiles.redis.username@
password
:
@
profiles.redis.password@
#
password: @profiles.redis.password@
database
:
@
profiles.redis.database@
database
:
@
profiles.redis.database@
timeout
:
30000
timeout
:
30000
pool
:
pool
:
...
...
log-manager/src/main/resources/sqlmap/module/biz/BizLogMapper.xml
View file @
3a380c87
...
@@ -85,20 +85,20 @@
...
@@ -85,20 +85,20 @@
</trim>
</trim>
</sql>
</sql>
<!-- 新增 区分主键自增加还是业务插入 -->
<!-- 新增 区分主键自增加还是业务插入 -->
<insert
id=
"insert"
parameterType=
"BizLogEntity"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
<insert
id=
"insert"
parameterType=
"BizLogEntity"
>
insert into `${tableName}`
insert into `${tableName}`
(traceID,appName,hostName,logLevel,userCode,deviceCode,eventTopic,eventTopicName,msg,logTime,createUserId,createTime)
(
id,
traceID,appName,hostName,logLevel,userCode,deviceCode,eventTopic,eventTopicName,msg,logTime,createUserId,createTime)
VALUES
VALUES
(#{traceID},#{appName},#{hostName},#{logLevel},#{userCode},#{deviceCode},#{eventTopic},#{eventTopicName},#{msg},#{logTime},#{createUserId},#{createTime})
(#{
id},#{
traceID},#{appName},#{hostName},#{logLevel},#{userCode},#{deviceCode},#{eventTopic},#{eventTopicName},#{msg},#{logTime},#{createUserId},#{createTime})
</insert>
</insert>
<!-- 批量新增 -->
<!-- 批量新增 -->
<insert
id=
"insertBatch"
parameterType=
"paramDto"
>
<insert
id=
"insertBatch"
parameterType=
"paramDto"
>
insert into `${tableName}`
insert into `${tableName}`
(traceID,appName,hostName,logLevel,userCode,deviceCode,eventTopic,eventTopicName,msg,logTime,createUserId,createTime)
(
id,
traceID,appName,hostName,logLevel,userCode,deviceCode,eventTopic,eventTopicName,msg,logTime,createUserId,createTime)
VALUES
VALUES
<foreach
collection=
"data.dataList"
item=
"item"
index=
"index"
separator=
","
>
<foreach
collection=
"data.dataList"
item=
"item"
index=
"index"
separator=
","
>
(#{item.traceID},#{item.appName},#{item.hostName},#{item.logLevel},#{item.userCode},#{item.deviceCode},#{item.eventTopic},#{item.eventTopicName},#{item.msg},#{item.logTime},#{item.createUserId},#{item.createTime})
(#{item.
id},#{item.
traceID},#{item.appName},#{item.hostName},#{item.logLevel},#{item.userCode},#{item.deviceCode},#{item.eventTopic},#{item.eventTopicName},#{item.msg},#{item.logTime},#{item.createUserId},#{item.createTime})
</foreach>
</foreach>
</insert>
</insert>
...
...
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