Commit c68d988c authored by 赵啸非's avatar 赵啸非

业务日志添加

parent 78917d32
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
<id>release</id>
<formats>
<format>tar.gz</format>
</formats>
<!-- <includeBaseDirectory>false</includeBaseDirectory>-->
<!-- 需要打包的文件集 -->
<fileSets>
<fileSet>
<directory>${project.parent.basedir}/log-manager-ui/admin/dist</directory>
<includes>
<include>**/*</include>
</includes>
<outputDirectory>/dist</outputDirectory>
</fileSet>
</fileSets>
</assembly>
\ No newline at end of file
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
<id>release</id>
<formats>
<format>tar.gz</format>
</formats>
<!-- <includeBaseDirectory>false</includeBaseDirectory>-->
<fileSets>
<fileSet>
<directory>${project.parent.basedir}/dist/${project.parent.artifactId}/bin</directory>
<outputDirectory>bin</outputDirectory>
<fileMode>0755</fileMode>
</fileSet>
<fileSet>
<directory>${project.parent.basedir}/dist/${project.parent.artifactId}/boot</directory>
<outputDirectory>boot</outputDirectory>
<fileMode>0755</fileMode>
</fileSet>
<fileSet>
<directory>${project.parent.basedir}/dist/${project.parent.artifactId}/db</directory>
<outputDirectory>db</outputDirectory>
<fileMode>0755</fileMode>
</fileSet>
</fileSets>
</assembly>
\ No newline at end of file
/* DROP database if exists `log-platform`;
Navicat MySQL Data Transfer CREATE database `log-platform` default charset=utf8;
use `log-platform`;
Source Server : localhost
Source Server Type : MySQL
Source Server Version : 80018
Source Host : localhost:3306
Source Schema : base-platform
Target Server Type : MySQL
Target Server Version : 80018
File Encoding : 65001
Date: 05/11/2021 09:39:57
*/
SET NAMES utf8mb4; SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0; SET FOREIGN_KEY_CHECKS = 0;
-- ---------------------------- -- ----------------------------
-- Table structure for mortals_xhx_idgenerator -- Table structure for mortals_xhx_idgenerator
-- ---------------------------- -- ----------------------------
......
use `log-platform`;
-- ---------------------------- -- ----------------------------
-- 访问日志菜单 SQL -- 访问日志菜单 SQL
-- ---------------------------- -- ----------------------------
......
use `log-platform`;
-- ---------------------------- -- ----------------------------
-- 访问日志表 -- 访问日志表
-- ---------------------------- -- ----------------------------
......
...@@ -2,11 +2,11 @@ ...@@ -2,11 +2,11 @@
NODE_ENV = production NODE_ENV = production
# 地址 # 地址
VUE_APP_BASE_API = http://192.168.0.26:9005/m VUE_APP_BASE_API = http://192.168.0.251:9005/m
# websocket地址 # websocket地址
VUE_APP_WEBSOCKET_API =192.168.0.98:18222/m VUE_APP_WEBSOCKET_API =192.168.0.251:18222/m
# 门户登录地址 # 门户登录地址
VUE_APP_PORTAL_URL = http://192.168.0.98:11072 VUE_APP_PORTAL_URL = http://192.168.0.251:11072
This diff is collapsed.
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
"element-ui": "^2.15.5", "element-ui": "^2.15.5",
"file-saver": "2.0.4", "file-saver": "2.0.4",
"fuse.js": "6.4.3", "fuse.js": "6.4.3",
"highlight.js": "11.6.0",
"js-cookie": "2.2.1", "js-cookie": "2.2.1",
"jsencrypt": "3.0.0-rc.1", "jsencrypt": "3.0.0-rc.1",
"json-bigint": "^0.3.0", "json-bigint": "^0.3.0",
...@@ -36,8 +37,7 @@ ...@@ -36,8 +37,7 @@
"vue-cropper": "0.5.5", "vue-cropper": "0.5.5",
"vue-router": "3.4.9", "vue-router": "3.4.9",
"vue2-org-tree": "^1.3.5", "vue2-org-tree": "^1.3.5",
"vuex": "3.6.0", "vuex": "3.6.0"
"highlight.js": "11.6.0"
}, },
"devDependencies": { "devDependencies": {
"@vue/cli-plugin-babel": "4.4.6", "@vue/cli-plugin-babel": "4.4.6",
...@@ -51,10 +51,9 @@ ...@@ -51,10 +51,9 @@
"less": "^3.0.4", "less": "^3.0.4",
"less-loader": "^4.1.0", "less-loader": "^4.1.0",
"lint-staged": "10.5.3", "lint-staged": "10.5.3",
"node-sass": "^5.0.0",
"runjs": "4.4.2", "runjs": "4.4.2",
"sass": "1.32.0", "sass": "1.32.0",
"sass-loader": "^10.1.0", "sass-loader": "^7.1.0",
"script-ext-html-webpack-plugin": "2.1.5", "script-ext-html-webpack-plugin": "2.1.5",
"svg-sprite-loader": "5.1.1", "svg-sprite-loader": "5.1.1",
"vue-formatter": "^0.0.8", "vue-formatter": "^0.0.8",
......
...@@ -238,11 +238,9 @@ export default { ...@@ -238,11 +238,9 @@ export default {
async saveAuth() { async saveAuth() {
try { try {
this.auth.form.resourceIdList = this.auth.checkList this.auth.form.resourceIdList = this.auth.checkList
.filter((i) => typeof i === "number") await this.$post("/role/auth/distributionSource",
.join(","); this.auth.form
await this.$post("/role/auth/distributionSource", { );
query: this.auth.form,
});
this.auth.visible = false; this.auth.visible = false;
this.auth.form = this.initForm(); this.auth.form = this.initForm();
this.$message.success("操作成功"); this.$message.success("操作成功");
......
This diff is collapsed.
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
<profiles.redis.username></profiles.redis.username> <profiles.redis.username></profiles.redis.username>
<profiles.redis.password></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>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.port>5672</profiles.rabbitmq.port>
<profiles.rabbitmq.username>taxi_mq</profiles.rabbitmq.username> <profiles.rabbitmq.username>taxi_mq</profiles.rabbitmq.username>
<profiles.rabbitmq.password>admin@2020</profiles.rabbitmq.password> <profiles.rabbitmq.password>admin@2020</profiles.rabbitmq.password>
...@@ -42,10 +42,11 @@ ...@@ -42,10 +42,11 @@
<profiles.log.level>DEBUG</profiles.log.level> <profiles.log.level>DEBUG</profiles.log.level>
<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>192.168.0.252:8848</profiles.nacos.server-addr> <!-- <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.server-addr>127.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>
<package.environment>build</package.environment>
</properties> </properties>
</profile> </profile>
<profile> <profile>
...@@ -78,21 +79,40 @@ ...@@ -78,21 +79,40 @@
<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>
<profiles.log.path>/mortals/app/logs</profiles.log.path> <profiles.log.path>/mortals/app/logs</profiles.log.path>
<package.environment>build:stage</package.environment>
</properties> </properties>
</profile> </profile>
<profile> <profile>
<id>product</id> <id>product</id>
<properties> <properties>
<profiles.active>product</profiles.active> <profiles.active>product</profiles.active>
<profiles.server.port>17214</profiles.server.port> <profiles.server.port>18225</profiles.server.port>
<profiles.queue.type>rabbitmq</profiles.queue.type>
<profiles.datasource.uri>
<![CDATA[jdbc:mysql://127.0.0.1:3306/log-platform?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Hongkong]]></profiles.datasource.uri>
<profiles.datasource.username>root</profiles.datasource.username>
<profiles.datasource.password>xhx@2022</profiles.datasource.password>
<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>12345678</profiles.redis.password>
<profiles.redis.database>9</profiles.redis.database>
<profiles.kafka.brokers>192.168.0.251:9092</profiles.kafka.brokers>
<profiles.queue.type>rabbitmq</profiles.queue.type> <profiles.queue.type>rabbitmq</profiles.queue.type>
<profiles.kafka.brokers>192.168.0.100:9092</profiles.kafka.brokers> <profiles.rabbitmq.host>127.0.0.1</profiles.rabbitmq.host>
<profiles.rabbitmq.host>192.168.0.100</profiles.rabbitmq.host>
<profiles.rabbitmq.port>5672</profiles.rabbitmq.port> <profiles.rabbitmq.port>5672</profiles.rabbitmq.port>
<profiles.nacos.server-addr>192.168.0.100:8848</profiles.nacos.server-addr> <profiles.rabbitmq.username>root_mq</profiles.rabbitmq.username>
<profiles.rabbitmq.password>xhx@2022</profiles.rabbitmq.password>
<profiles.rabbitmq.virtualhost>/</profiles.rabbitmq.virtualhost>
<profiles.rabbitmq.exchange></profiles.rabbitmq.exchange>
<profiles.filepath>/mortals/app/data</profiles.filepath>
<profiles.log.level>INFO</profiles.log.level>
<profiles.data.path>/data</profiles.data.path>
<profiles.nacos.server-addr>127.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>stp</profiles.nacos.namespace> <profiles.nacos.namespace>smart-gov</profiles.nacos.namespace>
<profiles.log.path>/mortals/app/logs</profiles.log.path> <profiles.log.path>/mortals/app/logs</profiles.log.path>
<package.environment>build:prod</package.environment>
</properties> </properties>
</profile> </profile>
</profiles> </profiles>
...@@ -136,12 +156,6 @@ ...@@ -136,12 +156,6 @@
<version>2.5.2</version> <version>2.5.2</version>
</dependency> </dependency>
<!-- <dependency>-->
<!-- <groupId>org.springframework.cloud</groupId>-->
<!-- <artifactId>spring-cloud-bus</artifactId>-->
<!-- <version>3.1.2</version>-->
<!-- </dependency>-->
<dependency> <dependency>
<groupId>mysql</groupId> <groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId> <artifactId>mysql-connector-java</artifactId>
...@@ -229,6 +243,99 @@ ...@@ -229,6 +243,99 @@
</resources> </resources>
</configuration> </configuration>
</execution> </execution>
<execution>
<id>copy-db</id>
<phase>package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<encoding>UTF-8</encoding>
<outputDirectory>${project.parent.basedir}/dist/${project.parent.artifactId}/db</outputDirectory>
<resources>
<resource>
<directory>../db/</directory>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<executions>
<!--执行npm install-->
<execution>
<id>exec-npm-install</id>
<phase>generate-resources</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>yarn</executable>
<workingDirectory>${project.parent.basedir}/log-manager-ui/admin</workingDirectory>
</configuration>
</execution>
<!--执行npm build-->
<execution>
<id>exec-npm-run-build</id>
<phase>generate-resources</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>yarn</executable>
<arguments>
<argument>run</argument>
<arguments>${package.environment}</arguments>
</arguments>
<workingDirectory>${project.parent.basedir}/log-manager-ui/admin</workingDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<finalName>log-platform</finalName>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<descriptor>../assembly/assembly.xml</descriptor>
</descriptors>
<outputDirectory>${project.parent.basedir}/dist/log-platform</outputDirectory>
</configuration>
</execution>
<execution>
<id>make-assembly-ui</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<finalName>log-platform-ui</finalName>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<descriptor>../assembly/assembly-ui.xml</descriptor>
</descriptors>
<outputDirectory>${project.parent.basedir}/dist/log-platform</outputDirectory>
</configuration>
</execution>
</executions> </executions>
</plugin> </plugin>
</plugins> </plugins>
......
...@@ -5,9 +5,9 @@ BASEDIR=`(cd "$BASEDIR"; pwd)` ...@@ -5,9 +5,9 @@ BASEDIR=`(cd "$BASEDIR"; pwd)`
PROJECT_NAME="@project.artifactId@"; PROJECT_NAME="@project.artifactId@";
MAIN_CLASS="$PROJECT_NAME-@project.version@.jar"; MAIN_CLASS="$PROJECT_NAME-@project.version@.jar";
LOG_PATH="@profiles.log.path@/$PROJECT_NAME" LOG_PATH="@profiles.log.path@/$PROJECT_NAME"
GC_PATH=$LOG_PATH/$PORT"-gc.log" GC_PATH=$LOG_PATH/PROJECT_NAME"-gc.log"
HS_ERR_PATH=$LOG_PATH/$PORT"-hs_err.log" HS_ERR_PATH=$LOG_PATH/PROJECT_NAME"-hs_err.log"
HEAP_DUMP_PATH=$LOG_PATH/$PORT"-heap_dump.hprof" HEAP_DUMP_PATH=$LOG_PATH/PROJECT_NAME"-heap_dump.hprof"
TEMP_PATH=$LOG_PATH/temp/ TEMP_PATH=$LOG_PATH/temp/
SUCCESS=0 SUCCESS=0
FAIL=9 FAIL=9
......
...@@ -150,8 +150,8 @@ public class RabbitConfig { ...@@ -150,8 +150,8 @@ public class RabbitConfig {
@Override @Override
public Class<?> toClass(MessageProperties properties) { public Class<?> toClass(MessageProperties properties) {
if (properties.getConsumerQueue().equalsIgnoreCase(QueueKey.ACCESS_LOG_QUEUE)) { if (properties.getConsumerQueue().equalsIgnoreCase(QueueKey.ACCESS_LOG_QUEUE)) {
return String.class; // return String.class;
//return AccessLogEntity.class; return AccessLogEntity.class;
}else if (properties.getConsumerQueue().equalsIgnoreCase(QueueKey.BIZ_LOG_QUEUE)) { }else if (properties.getConsumerQueue().equalsIgnoreCase(QueueKey.BIZ_LOG_QUEUE)) {
return BizLogEntity.class; return BizLogEntity.class;
}else if (properties.getConsumerQueue().equalsIgnoreCase(QueueKey.ERROR_LOG_QUEUE)) { }else if (properties.getConsumerQueue().equalsIgnoreCase(QueueKey.ERROR_LOG_QUEUE)) {
......
package com.mortals.xhx.base.framework.filter; package com.mortals.xhx.base.framework.filter;
import cn.hutool.core.util.PageUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.slf4j.MDC; import org.slf4j.MDC;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -14,8 +15,8 @@ import javax.servlet.http.HttpServletResponse; ...@@ -14,8 +15,8 @@ import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
/** /**
*
* 请求过滤链 * 请求过滤链
*
* @author: zxfei * @author: zxfei
* @date: 2022/4/20 14:52 * @date: 2022/4/20 14:52
*/ */
...@@ -36,23 +37,14 @@ public class RequestFilter extends OncePerRequestFilter implements Filter { ...@@ -36,23 +37,14 @@ public class RequestFilter extends OncePerRequestFilter implements Filter {
} }
} }
public static void main(String[] args) {
int totalPage = PageUtil.totalPage(1001, 1000);
/*private void setUsername(HttpServletRequest request) { System.out.println("totalPage:" + totalPage);
//通过token解析出username
String token = authTokenService.getToken(request); int start = PageUtil.getStart(2, 1000);
//String token = request.getHeader("token"); System.out.println("start:" + start);
if (!ObjectUtils.isEmpty(token)) {
MDC.put("token",token);
MDC.put("token", token);
try {
SessionUserInfo info = tokenService.getUserInfo();
if (info != null) {
String username = info.getUsername();
MDC.put("username", username);
}
} catch (CommonJsonException e) {
log.info("无效的token:{}", token);
}
} }
}*/
} }
...@@ -10,6 +10,8 @@ import com.mortals.framework.service.IUser; ...@@ -10,6 +10,8 @@ import com.mortals.framework.service.IUser;
import com.mortals.framework.util.DateUtils; import com.mortals.framework.util.DateUtils;
import com.mortals.framework.util.StringUtils; import com.mortals.framework.util.StringUtils;
import com.mortals.xhx.base.system.user.model.UserEntity; import com.mortals.xhx.base.system.user.model.UserEntity;
import com.mortals.xhx.base.system.user.model.UserQuery;
import com.mortals.xhx.base.system.user.service.UserService;
import io.jsonwebtoken.Claims; import io.jsonwebtoken.Claims;
import io.jsonwebtoken.Jwts; import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm; import io.jsonwebtoken.SignatureAlgorithm;
...@@ -18,6 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -18,6 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.annotation.Order; import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.Base64; import java.util.Base64;
...@@ -37,6 +40,8 @@ public class AuthTokenServiceImpl implements IAuthTokenService { ...@@ -37,6 +40,8 @@ public class AuthTokenServiceImpl implements IAuthTokenService {
// 令牌自定义标识 // 令牌自定义标识
@Value("${token.header:Authorization}") @Value("${token.header:Authorization}")
private String header; private String header;
@Autowired
private UserService userService;
// 令牌秘钥 // 令牌秘钥
@Value("${token.secret:026db82420614469897fcc2dc1b4ce38}") @Value("${token.secret:026db82420614469897fcc2dc1b4ce38}")
...@@ -94,6 +99,10 @@ public class AuthTokenServiceImpl implements IAuthTokenService { ...@@ -94,6 +99,10 @@ public class AuthTokenServiceImpl implements IAuthTokenService {
if (StringUtils.isNotEmpty(userStr)) { if (StringUtils.isNotEmpty(userStr)) {
UserEntity userEntity = JSONObject.parseObject(userStr, UserEntity.class); UserEntity userEntity = JSONObject.parseObject(userStr, UserEntity.class);
userEntity.setToken(token); userEntity.setToken(token);
UserEntity temp = userService.selectOne(new UserQuery().loginName(userEntity.getLoginName()));
if (!ObjectUtils.isEmpty(temp)) {
userEntity.setId(temp.getId());
}
return userEntity; return userEntity;
} }
} catch (Exception e) { } catch (Exception e) {
......
...@@ -45,7 +45,7 @@ public class AccessMessageConsumerListener { ...@@ -45,7 +45,7 @@ public class AccessMessageConsumerListener {
@Autowired @Autowired
private AccessLogService accessLogService; private AccessLogService accessLogService;
@RabbitHandler /* @RabbitHandler
public void onMessage(List<String> messages) { public void onMessage(List<String> messages) {
log.info("[Access onMessage][线程编号:{} 消息数量:{}]", Thread.currentThread().getName() + Thread.currentThread().getId(), messages.size()); log.info("[Access onMessage][线程编号:{} 消息数量:{}]", Thread.currentThread().getName() + Thread.currentThread().getId(), messages.size());
List<AccessLogEntity> collect = messages.stream().map(message -> { List<AccessLogEntity> collect = messages.stream().map(message -> {
...@@ -65,6 +65,26 @@ public class AccessMessageConsumerListener { ...@@ -65,6 +65,26 @@ public class AccessMessageConsumerListener {
}).filter(f -> f != null).collect(Collectors.toList()); }).filter(f -> f != null).collect(Collectors.toList());
// collect.forEach(accessLogEntity -> accessLogService.save(accessLogEntity)); // collect.forEach(accessLogEntity -> accessLogService.save(accessLogEntity));
accessLogService.save(collect); accessLogService.save(collect);
}*/
@RabbitHandler
public void onMessage(List<AccessLogEntity> messages) {
log.info("[Access onMessage][线程编号:{} 消息数量:{}]", Thread.currentThread().getName() + Thread.currentThread().getId(), messages.size());
List<AccessLogEntity> collect = messages.stream().map(entity -> {
try {
// AccessLogEntity entity =null;
//entity = JSON.parseObject(message, AccessLogEntity.class);
entity.setId(IdUtil.getSnowflake(0, 1).nextId());
entity.setCreateUserId(1L);
entity.setCreateTime(new Date());
return entity;
} catch (Exception e) {
log.info("反序列化异常", e);
return null;
}
}).filter(f -> f != null).collect(Collectors.toList());
accessLogService.save(collect);
} }
...@@ -74,7 +94,6 @@ public class AccessMessageConsumerListener { ...@@ -74,7 +94,6 @@ public class AccessMessageConsumerListener {
// messages.add("111"); // messages.add("111");
if (messages.stream().noneMatch((o -> !(o instanceof String)))) { if (messages.stream().noneMatch((o -> !(o instanceof String)))) {
log.info("都匹配"); log.info("都匹配");
......
...@@ -46,4 +46,5 @@ public class BizMessageConsumerListener { ...@@ -46,4 +46,5 @@ public class BizMessageConsumerListener {
}).collect(Collectors.toList()); }).collect(Collectors.toList());
bizLogService.save(collect); bizLogService.save(collect);
} }
} }
...@@ -23,7 +23,7 @@ public class MessageProducer implements IMessageProduceService { ...@@ -23,7 +23,7 @@ public class MessageProducer implements IMessageProduceService {
public void syncAccessSend(AccessLogPdu accessLogPdu) { public void syncAccessSend(AccessLogPdu accessLogPdu) {
//log.info("accessinfo==>{}",JSON.toJSONString(accessLogPdu)); //log.info("accessinfo==>{}",JSON.toJSONString(accessLogPdu));
rabbitTemplate.convertAndSend(QueueKey.EXCHANGE, QueueKey.ACCESS_LOG_QUEUE, JSON.toJSONString(accessLogPdu)); rabbitTemplate.convertAndSend(QueueKey.EXCHANGE, QueueKey.ACCESS_LOG_QUEUE, accessLogPdu);
} }
@Override @Override
......
package com.mortals.xhx.module.access.web; package com.mortals.xhx.module.access.web;
import com.mortals.framework.annotation.UnAuth; import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.OrderCol; import com.mortals.framework.model.OrderCol;
...@@ -9,8 +10,10 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -9,8 +10,10 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import com.mortals.framework.model.Context; import com.mortals.framework.model.Context;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController; import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.module.access.model.AccessLogEntity; import com.mortals.xhx.module.access.model.AccessLogEntity;
import com.mortals.xhx.module.access.service.AccessLogService; import com.mortals.xhx.module.access.service.AccessLogService;
...@@ -19,26 +22,28 @@ import com.mortals.framework.util.StringUtils; ...@@ -19,26 +22,28 @@ import com.mortals.framework.util.StringUtils;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import static com.mortals.framework.ap.SysConstains.*; import static com.mortals.framework.ap.SysConstains.*;
/** /**
* * 访问日志
* 访问日志 *
* * @author zxfei
* @author zxfei * @date 2022-08-17
* @date 2022-08-17 */
*/
@RestController @RestController
@RequestMapping("access/log") @RequestMapping("access/log")
public class AccessLogController extends BaseCRUDJsonBodyMappingController<AccessLogService,AccessLogEntity,Long> { public class AccessLogController extends BaseCRUDJsonBodyMappingController<AccessLogService, AccessLogEntity, Long> {
@Autowired @Autowired
private ParamService paramService; private ParamService paramService;
public AccessLogController(){ public AccessLogController() {
super.setModuleDesc( "访问日志"); super.setModuleDesc("访问日志");
} }
@Override @Override
...@@ -58,14 +63,8 @@ public class AccessLogController extends BaseCRUDJsonBodyMappingController<Acces ...@@ -58,14 +63,8 @@ public class AccessLogController extends BaseCRUDJsonBodyMappingController<Acces
@Override @Override
@UnAuth @UnAuth
public String save(AccessLogEntity entity) { public String save(@RequestBody AccessLogEntity entity) {
return super.save(entity); return super.save(entity);
} }
@Override
public String view(Long id) {
return super.view(id);
}
} }
\ No newline at end of file
...@@ -55,7 +55,7 @@ public class BizLogController extends BaseCRUDJsonBodyMappingController<BizLogSe ...@@ -55,7 +55,7 @@ public class BizLogController extends BaseCRUDJsonBodyMappingController<BizLogSe
@Override @Override
@UnAuth @UnAuth
public String save(BizLogEntity entity) { public String save(@RequestBody BizLogEntity entity) {
return super.save(entity); return super.save(entity);
} }
} }
\ No newline at end of file
...@@ -27,16 +27,9 @@ import java.util.List; ...@@ -27,16 +27,9 @@ import java.util.List;
public class ErrorLogServiceImpl extends AbstractCRUDServiceImpl<ErrorLogDao, ErrorLogEntity, Long> implements ErrorLogService { public class ErrorLogServiceImpl extends AbstractCRUDServiceImpl<ErrorLogDao, ErrorLogEntity, Long> implements ErrorLogService {
@Override @Override
protected void saveBefore(ErrorLogEntity entity, Context context) throws AppException { protected void saveBefore(ErrorLogEntity entity, Context context) throws AppException {
//判断当前是否有重复的 //判断当前是否有重复的
//非系统自增,需这里设置主键 //非系统自增,需这里设置主键
entity.setId(IdUtil.getSnowflake(0, 1).nextId()); entity.setId(IdUtil.getSnowflake(0, 1).nextId());
super.saveBefore(entity, context); super.saveBefore(entity, context);
} }
......
...@@ -58,7 +58,7 @@ public class ErrorLogController extends BaseCRUDJsonBodyMappingController<ErrorL ...@@ -58,7 +58,7 @@ public class ErrorLogController extends BaseCRUDJsonBodyMappingController<ErrorL
@Override @Override
@UnAuth @UnAuth
public String save(ErrorLogEntity entity) { public String save(@RequestBody ErrorLogEntity entity) {
return super.save(entity); return super.save(entity);
} }
} }
\ No newline at end of file
...@@ -57,7 +57,7 @@ public class OperateLogController extends BaseCRUDJsonBodyMappingController<Oper ...@@ -57,7 +57,7 @@ public class OperateLogController extends BaseCRUDJsonBodyMappingController<Oper
@Override @Override
@UnAuth @UnAuth
public String save(OperateLogEntity entity) { public String save(@RequestBody OperateLogEntity entity) {
return super.save(entity); return super.save(entity);
} }
} }
\ No newline at end of file
...@@ -19,12 +19,12 @@ ...@@ -19,12 +19,12 @@
<encoder> <encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%-5level] [%X{traceId}] [%thread] [%.50c\(%L\)] - %msg%n</pattern> <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%-5level] [%X{traceId}] [%thread] [%.50c\(%L\)] - %msg%n</pattern>
</encoder> </encoder>
<file>${logFilePath}/${springApplicationName:-default}/${serverPort:-default}-info.log</file> <file>${logFilePath}/${springApplicationName:-default}/${springApplicationName:-default}-info.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 文件保存策略--> <!-- 文件保存策略-->
<fileNamePattern>${logFilePath}/${springApplicationName:-default}/${serverPort:-default}-info.log.%d{yyyyMMdd}</fileNamePattern> <fileNamePattern>${logFilePath}/${springApplicationName:-default}/${springApplicationName:-default}-info.log.%d{yyyyMMdd}</fileNamePattern>
<!--日志文件保留天数--> <!--日志文件保留天数-->
<MaxHistory>3</MaxHistory> <MaxHistory>7</MaxHistory>
</rollingPolicy> </rollingPolicy>
</appender> </appender>
<!-- 异常文件输出策略--> <!-- 异常文件输出策略-->
...@@ -35,11 +35,11 @@ ...@@ -35,11 +35,11 @@
<encoder> <encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%-5level] [%X{traceId}] [%thread] [%.50c\(%L\)] - %msg%n</pattern> <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%-5level] [%X{traceId}] [%thread] [%.50c\(%L\)] - %msg%n</pattern>
</encoder> </encoder>
<file>${logFilePath}/${springApplicationName:-default}/${serverPort:-default}-error.log</file> <file>${logFilePath}/${springApplicationName:-default}/${springApplicationName:-default}-error.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${logFilePath}/${springApplicationName:-default}/${serverPort:-default}-error.log.%d{yyyyMMdd}</fileNamePattern> <fileNamePattern>${logFilePath}/${springApplicationName:-default}/${springApplicationName:-default}-error.log.%d{yyyyMMdd}</fileNamePattern>
<!--日志文件保留天数--> <!--日志文件保留天数-->
<MaxHistory>15</MaxHistory> <MaxHistory>7</MaxHistory>
</rollingPolicy> </rollingPolicy>
</appender> </appender>
......
...@@ -52,6 +52,7 @@ Content-Type: application/json ...@@ -52,6 +52,7 @@ Content-Type: application/json
"logTime":"1661270400000" "logTime":"1661270400000"
} }
> {% > {%
client.global.set("ErrorLog_id", JSON.parse(response.body).data.id); client.global.set("ErrorLog_id", JSON.parse(response.body).data.id);
%} %}
......
{ {
"local": { "local": {
"baseUrl": "http://127.0.0.1:18225/logservice", "baseUrl": "http://127.0.0.1:17214/logservice",
"baseLogin": "http://127.0.0.1:18222/logservice" "baseLogin": "http://127.0.0.1:18222/logservice"
}, },
"dev": { "dev": {
......
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