Commit 3a380c87 authored by 赵啸非's avatar 赵啸非

业务日志添加

parent 22775c20
......@@ -27,15 +27,15 @@
<![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.password>12345678</profiles.datasource.password>
<profiles.redis.uri>192.168.0.252</profiles.redis.uri>
<profiles.redis.uri>127.0.0.1</profiles.redis.uri>
<profiles.redis.port>6379</profiles.redis.port>
<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.rabbitmq.host>192.168.0.98</profiles.rabbitmq.host>
<profiles.rabbitmq.host>127.0.0.1</profiles.rabbitmq.host>
<profiles.rabbitmq.port>5672</profiles.rabbitmq.port>
<profiles.rabbitmq.username>taxi_mq</profiles.rabbitmq.username>
<profiles.rabbitmq.password>admin@2020</profiles.rabbitmq.password>
<profiles.rabbitmq.username>guest</profiles.rabbitmq.username>
<profiles.rabbitmq.password>guest</profiles.rabbitmq.password>
<profiles.rabbitmq.virtualhost>/</profiles.rabbitmq.virtualhost>
<profiles.rabbitmq.exchange></profiles.rabbitmq.exchange>
<profiles.filepath>/mortals/data</profiles.filepath>
......@@ -43,7 +43,7 @@
<profiles.log.path>/logs</profiles.log.path>
<profiles.data.path>/data</profiles.data.path>
<profiles.nacos.server-addr>192.168.0.252:8848</profiles.nacos.server-addr>
<profiles.nacos.server-addr>127.0.0.1:8848</profiles.nacos.server-addr>
<profiles.nacos.group>DEFAULT_GROUP</profiles.nacos.group>
<profiles.nacos.namespace>smart-gov</profiles.nacos.namespace>
</properties>
......
package com.mortals.xhx.base.framework.listener;
import cn.hutool.core.util.IdUtil;
import com.alibaba.fastjson.JSON;
import com.mortals.xhx.common.key.QueueKey;
import com.mortals.xhx.module.access.model.AccessLogEntity;
......@@ -37,6 +38,7 @@ public class BizMessageConsumerListener {
log.info("[Biz onMessage][线程编号:{} 消息数量:{}]", Thread.currentThread().getName()+Thread.currentThread().getId(), messages.size());
List<BizLogEntity> collect = messages.stream().map(str -> {
BizLogEntity entity = JSON.parseObject(str, BizLogEntity.class);
entity.setId(IdUtil.getSnowflake(0, 1).nextId());
entity.setCreateUserId(1L);
entity.setCreateTime(new Date());
return entity;
......
package com.mortals.xhx.module.operate.service.impl;
import cn.hutool.core.lang.Snowflake;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.RandomUtil;
import com.mortals.xhx.module.error.model.ErrorLogEntity;
import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
......@@ -22,4 +23,9 @@ import java.util.Date;
@Service("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
......@@ -21,7 +21,7 @@ spring:
host: @profiles.redis.uri@
port: @profiles.redis.port@
username: @profiles.redis.username@
password: @profiles.redis.password@
# password: @profiles.redis.password@
database: @profiles.redis.database@
timeout: 30000
pool:
......
......@@ -85,20 +85,20 @@
</trim>
</sql>
<!-- 新增 区分主键自增加还是业务插入 -->
<insert id="insert" parameterType="BizLogEntity" useGeneratedKeys="true" keyProperty="id">
<insert id="insert" parameterType="BizLogEntity" >
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
(#{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 id="insertBatch" parameterType="paramDto">
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
<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>
</insert>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment