parent
43606e3617
commit
a137fba38c
|
|
@ -0,0 +1,23 @@
|
|||
package com.xjs.business.log;
|
||||
|
||||
import com.ruoyi.common.core.constant.ServiceNameConstants;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.xjs.business.log.domain.ApiLog;
|
||||
import com.xjs.business.log.factory.RemoteLogFactory;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
/**
|
||||
* rpc远程调用日志服务接口
|
||||
* @author xiejs
|
||||
* @since 2022-01-13
|
||||
*/
|
||||
@FeignClient(contextId = "remoteLogFeign",
|
||||
value = ServiceNameConstants.BUSINESS_LOG_SERVICE,
|
||||
fallbackFactory = RemoteLogFactory.class)
|
||||
public interface RemoteLogFeign {
|
||||
|
||||
@PostMapping("/apilog/forPRC")
|
||||
R<Object> saveApiLog(@RequestBody ApiLog apiLog);
|
||||
}
|
||||
|
|
@ -0,0 +1,112 @@
|
|||
package com.xjs.business.log.domain;
|
||||
|
||||
|
||||
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
public class ApiLog implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 接口名称
|
||||
*/
|
||||
private String apiName;
|
||||
|
||||
/**
|
||||
* 请求API的url
|
||||
*/
|
||||
private String url;
|
||||
|
||||
/**
|
||||
* 请求API的方法
|
||||
*/
|
||||
private String method;
|
||||
|
||||
/**
|
||||
* 请求request
|
||||
*/
|
||||
private String request;
|
||||
|
||||
/**
|
||||
* 响应体
|
||||
*/
|
||||
private String response;
|
||||
|
||||
/**
|
||||
* 是否请求成功
|
||||
*/
|
||||
private Integer isSuccess;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private String createTime;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getApiName() {
|
||||
return apiName;
|
||||
}
|
||||
|
||||
public void setApiName(String apiName) {
|
||||
this.apiName = apiName;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public String getMethod() {
|
||||
return method;
|
||||
}
|
||||
|
||||
public void setMethod(String method) {
|
||||
this.method = method;
|
||||
}
|
||||
|
||||
public String getRequest() {
|
||||
return request;
|
||||
}
|
||||
|
||||
public void setRequest(String request) {
|
||||
this.request = request;
|
||||
}
|
||||
|
||||
public String getResponse() {
|
||||
return response;
|
||||
}
|
||||
|
||||
public void setResponse(String response) {
|
||||
this.response = response;
|
||||
}
|
||||
|
||||
public Integer getIsSuccess() {
|
||||
return isSuccess;
|
||||
}
|
||||
|
||||
public void setIsSuccess(Integer isSuccess) {
|
||||
this.isSuccess = isSuccess;
|
||||
}
|
||||
|
||||
public String getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(String createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
package com.xjs.business.log.factory;
|
||||
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.xjs.business.api.factory.RemoteTranDictFactory;
|
||||
import com.xjs.business.log.RemoteLogFeign;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 日志远程调用rpc服务降级处理
|
||||
* @author xiejs
|
||||
* @since 2022-01-13
|
||||
*/
|
||||
@Component
|
||||
public class RemoteLogFactory implements FallbackFactory<RemoteLogFeign> {
|
||||
private static final Logger log = LoggerFactory.getLogger(RemoteLogFactory.class);
|
||||
|
||||
@Override
|
||||
public RemoteLogFeign create(Throwable cause) {
|
||||
log.error("日志模块服务添加调用失败:{}", cause.getMessage());
|
||||
return apiLog -> R.fail("日志模块服务添加调用失败" + cause.getMessage());
|
||||
}
|
||||
}
|
||||
|
|
@ -33,6 +33,13 @@ public class ServiceNameConstants
|
|||
*/
|
||||
public static final String BUSINESS_WARNING_SERVICE= "xjs-warning" ;
|
||||
|
||||
/**
|
||||
* 日志服务的serviceid
|
||||
*/
|
||||
public static final String BUSINESS_LOG_SERVICE= "xjs-log" ;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import request from '@/utils/request'
|
|||
// 查询日志列表
|
||||
export function listLog(query) {
|
||||
return request({
|
||||
url: '/openapi/log/list',
|
||||
url: '/log/apilog/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
|
|
@ -12,7 +12,7 @@ export function listLog(query) {
|
|||
// 查询日志详细
|
||||
export function getLog(id) {
|
||||
return request({
|
||||
url: '/openapi/log/' + id,
|
||||
url: '/log/apilog/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
|
@ -20,7 +20,7 @@ export function getLog(id) {
|
|||
// 删除日志
|
||||
export function delLog(id) {
|
||||
return request({
|
||||
url: '/openapi/log/' + id,
|
||||
url: '/log/apilog/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
|
@ -26,7 +26,7 @@
|
|||
size="mini"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['openapi:log:remove']"
|
||||
v-hasPermi="['log:apilog:remove']"
|
||||
>删除
|
||||
</el-button>
|
||||
</el-col>
|
||||
|
|
@ -37,7 +37,7 @@
|
|||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['openapi:log:export']"
|
||||
v-hasPermi="['log:apilog:export']"
|
||||
>导出
|
||||
</el-button>
|
||||
</el-col>
|
||||
|
|
@ -64,7 +64,7 @@
|
|||
type=""
|
||||
icon="el-icon-view"
|
||||
@click="handleView(scope.row,scope.index)"
|
||||
v-hasPermi="['openapi:log:query']"
|
||||
v-hasPermi="['log:apilog:query']"
|
||||
></el-button>
|
||||
</el-tooltip>
|
||||
<el-button
|
||||
|
|
@ -72,7 +72,7 @@
|
|||
type="danger"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['openapi:log:remove']"
|
||||
v-hasPermi="['log:apilog:remove']"
|
||||
>
|
||||
</el-button>
|
||||
</template>
|
||||
|
|
@ -119,7 +119,7 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import {listLog, getLog, delLog} from "@/api/business/openapi/apilog";
|
||||
import {listLog, getLog, delLog} from "@/api/business/log/apilog";
|
||||
|
||||
export default {
|
||||
name: "Log",
|
||||
|
|
@ -20,6 +20,7 @@
|
|||
<module>xjs-business-common</module>
|
||||
<module>xjs-business-warning</module>
|
||||
<module>xjs-business-monitor</module>
|
||||
<module>xjs-business-log</module>
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
package com.xjs.common.aop;
|
||||
package com.xjs.annotation;
|
||||
|
||||
import com.ruoyi.common.log.enums.BusinessType;
|
||||
import com.ruoyi.common.log.enums.OperatorType;
|
||||
|
|
@ -6,8 +6,8 @@ import com.ruoyi.common.log.enums.OperatorType;
|
|||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* 自定义api日志注解
|
||||
* @author xiejs
|
||||
* @desc 自定义api日志注解
|
||||
* @create 2021-12-26
|
||||
*/
|
||||
@Target({ ElementType.PARAMETER, ElementType.METHOD })
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
package com.xjs.annotation;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* 服务之间的调用注解
|
||||
* @author xiejs
|
||||
* @since 2022-01-13
|
||||
*/
|
||||
@Target({ ElementType.PARAMETER, ElementType.METHOD })
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
public @interface RpcLog {
|
||||
/**
|
||||
* 请求服务方法
|
||||
* @return String
|
||||
*/
|
||||
String method() default "";
|
||||
|
||||
/**
|
||||
* 请求服务名称
|
||||
* @return String
|
||||
*/
|
||||
String serviceName() default "";
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>xjs-business</artifactId>
|
||||
<groupId>com.xjs</groupId>
|
||||
<version>3.3.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<name>业务模块-日志模块</name>
|
||||
|
||||
<artifactId>xjs-business-log</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>11</maven.compiler.source>
|
||||
<maven.compiler.target>11</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.xjs</groupId>
|
||||
<artifactId>xjs-business-common</artifactId>
|
||||
<version>3.3.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
package com.xjs;
|
||||
|
||||
import com.ruoyi.common.security.annotation.EnableCustomConfig;
|
||||
import com.ruoyi.common.security.annotation.EnableRyFeignClients;
|
||||
import com.ruoyi.common.swagger.annotation.EnableCustomSwagger2;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
/**
|
||||
* 日志服务启动器
|
||||
* @author xiejs
|
||||
* 2021-12-31
|
||||
*/
|
||||
@SpringBootApplication
|
||||
@EnableCustomConfig
|
||||
@EnableCustomSwagger2
|
||||
@EnableRyFeignClients
|
||||
public class XjsLogApp {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(XjsLogApp.class, args);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
package com.xjs.apilog.controller;
|
||||
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.web.controller.BaseController;
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
|
|
@ -9,6 +10,7 @@ import com.ruoyi.common.log.enums.BusinessType;
|
|||
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
||||
import com.xjs.apilog.domain.ApiLog;
|
||||
import com.xjs.apilog.service.IApiLogService;
|
||||
import com.xjs.business.api.domain.CopyWriting;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
|
@ -24,13 +26,20 @@ import java.util.List;
|
|||
* @date 2021-12-26
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("log")
|
||||
@RequestMapping("apilog")
|
||||
@Api(tags = "业务模块-API日志")
|
||||
public class ApiLogController extends BaseController {
|
||||
@Autowired
|
||||
private IApiLogService apiLogService;
|
||||
|
||||
|
||||
@PostMapping("forPRC")
|
||||
@ApiOperation("供AOP切面RPC远程调用")
|
||||
public R<Object> saveApiLog(@RequestBody ApiLog apiLog) {
|
||||
|
||||
boolean save = apiLogService.save(apiLog);
|
||||
return save?R.ok():R.fail();
|
||||
}
|
||||
|
||||
|
||||
//------------------------代码自动生成-----------------------------------
|
||||
|
|
@ -38,7 +47,7 @@ public class ApiLogController extends BaseController {
|
|||
/**
|
||||
* 查询日志列表
|
||||
*/
|
||||
@RequiresPermissions("openapi:log:list")
|
||||
@RequiresPermissions("log:apilog:list")
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("查询日志列表")
|
||||
public TableDataInfo list(ApiLog apiLog) {
|
||||
|
|
@ -50,7 +59,7 @@ public class ApiLogController extends BaseController {
|
|||
/**
|
||||
* 导出日志列表
|
||||
*/
|
||||
@RequiresPermissions("openapi:log:export")
|
||||
@RequiresPermissions("log:apilog:export")
|
||||
@Log(title = "API日志", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
@ApiOperation("导出日志列表")
|
||||
|
|
@ -63,7 +72,7 @@ public class ApiLogController extends BaseController {
|
|||
/**
|
||||
* 获取日志详细信息
|
||||
*/
|
||||
@RequiresPermissions("openapi:log:query")
|
||||
@RequiresPermissions("log:apilog:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
@ApiOperation("获取日志详细信息")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||
|
|
@ -74,7 +83,7 @@ public class ApiLogController extends BaseController {
|
|||
/**
|
||||
* 删除日志
|
||||
*/
|
||||
@RequiresPermissions("openapi:log:remove")
|
||||
@RequiresPermissions("log:apilog:remove")
|
||||
@Log(title = "API日志", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
@ApiOperation("删除日志")
|
||||
|
|
@ -48,7 +48,7 @@ public class ApiLog implements Serializable
|
|||
|
||||
/** 是否请求成功 */
|
||||
@Excel(name = "是否请求成功")
|
||||
private StatusEnum isSuccess;
|
||||
private Integer isSuccess;
|
||||
|
||||
@Excel(name = "创建时间" ,dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
package com.xjs.apilog.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.xjs.apilog.domain.ApiLog;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -10,7 +11,7 @@ import java.util.List;
|
|||
* @author xjs
|
||||
* @date 2021-12-26
|
||||
*/
|
||||
public interface IApiLogService {
|
||||
public interface IApiLogService extends IService<ApiLog> {
|
||||
|
||||
//------------------------代码自动生成-----------------------------------
|
||||
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
package com.xjs.apilog.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.xjs.apilog.domain.ApiLog;
|
||||
import com.xjs.apilog.mapper.ApiLogMapper;
|
||||
import com.xjs.apilog.service.IApiLogService;
|
||||
|
|
@ -15,7 +16,7 @@ import java.util.List;
|
|||
* @date 2021-12-26
|
||||
*/
|
||||
@Service
|
||||
public class ApiLogServiceImpl implements IApiLogService {
|
||||
public class ApiLogServiceImpl extends ServiceImpl<ApiLogMapper,ApiLog> implements IApiLogService {
|
||||
@Autowired
|
||||
private ApiLogMapper apiLogMapper;
|
||||
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
Spring Boot Version: ${spring-boot.version}
|
||||
Spring Application Name: ${spring.application.name}
|
||||
____ ___ ____. _________ _____.___._____.___.________ _________
|
||||
\ \/ / | |/ _____/ \__ | |\__ | |\______ \ / _____/
|
||||
\ / | |\_____ \ ______ / | | / | | | | \ \_____ \
|
||||
/ \/\__| |/ \ /_____/ \____ | \____ | | ` \/ \
|
||||
/___/\ \________/_______ / / ______| / ______|/_______ /_______ /
|
||||
\_/ \/ \/ \/ \/ \/
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
# Tomcat
|
||||
server:
|
||||
port: 9904
|
||||
|
||||
# Spring
|
||||
spring:
|
||||
application:
|
||||
# 应用名称
|
||||
name: xjs-log
|
||||
profiles:
|
||||
# 环境配置
|
||||
active: dev
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
shared-configs:
|
||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
#配置组
|
||||
group: xjs
|
||||
#命名空间
|
||||
namespace: xjs-666
|
||||
|
|
@ -0,0 +1,76 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
||||
<!-- 日志存放路径 -->
|
||||
<property name="log.path" value="logs/xjs-log"/>
|
||||
<!-- 日志输出格式 -->
|
||||
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
|
||||
|
||||
<!-- 控制台输出 -->
|
||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 系统日志输出 -->
|
||||
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/info.log</file>
|
||||
<!-- 循环政策:基于时间创建日志文件 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志文件名格式 -->
|
||||
<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<!-- 过滤的级别 -->
|
||||
<level>INFO</level>
|
||||
<!-- 匹配时的操作:接收(记录) -->
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/error.log</file>
|
||||
<!-- 循环政策:基于时间创建日志文件 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志文件名格式 -->
|
||||
<fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<!-- 过滤的级别 -->
|
||||
<level>ERROR</level>
|
||||
<!-- 匹配时的操作:接收(记录) -->
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<!-- 系统模块日志级别控制 -->
|
||||
<logger name="com.xjs" level="info" />
|
||||
<!--打印feign DEBUG日志-->
|
||||
<logger name="com.xjs.common.client" level="debug"/>
|
||||
<!-- Spring日志级别控制 -->
|
||||
<logger name="org.springframework" level="warn" />
|
||||
|
||||
<root level="info">
|
||||
<appender-ref ref="console" />
|
||||
</root>
|
||||
|
||||
<!--系统操作日志-->
|
||||
<root level="info">
|
||||
<appender-ref ref="file_info" />
|
||||
<appender-ref ref="file_error" />
|
||||
</root>
|
||||
</configuration>
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
This is the JRebel configuration file. It maps the running application to your IDE workspace, enabling JRebel reloading for this project.
|
||||
Refer to https://manuals.jrebel.com/jrebel/standalone/config.html for more information.
|
||||
-->
|
||||
<application generated-by="intellij" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.zeroturnaround.com" xsi:schemaLocation="http://www.zeroturnaround.com http://update.zeroturnaround.com/jrebel/rebel-2_3.xsd">
|
||||
|
||||
<id>xjs-business-log</id>
|
||||
|
||||
<classpath>
|
||||
<dir name="D:/Dev/IdeaPerject/GitHub/RuoYi-Cloud/xjs-business/xjs-business-log/target/classes">
|
||||
</dir>
|
||||
</classpath>
|
||||
|
||||
</application>
|
||||
|
|
@ -5,13 +5,14 @@ import cn.hutool.core.date.DateUnit;
|
|||
import cn.hutool.core.date.DateUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.xjs.annotation.ApiLog;
|
||||
import com.xjs.business.log.RemoteLogFeign;
|
||||
import com.xjs.business.warning.RemoteWarningCRUDFeign;
|
||||
import com.xjs.business.warning.domain.ApiRecord;
|
||||
import com.xjs.business.warning.domain.ApiWarning;
|
||||
import com.xjs.enums.StatusEnum;
|
||||
import com.xjs.consts.ReqConst;
|
||||
import com.xjs.enums.WarnLevelEnum;
|
||||
import com.xjs.enums.WarnTypeEnum;
|
||||
import com.xjs.apilog.mapper.ApiLogMapper;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.aspectj.lang.JoinPoint;
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
|
|
@ -20,7 +21,6 @@ import org.aspectj.lang.annotation.*;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.Method;
|
||||
import java.time.LocalDateTime;
|
||||
|
|
@ -41,8 +41,8 @@ import static com.xjs.consts.ApiWarnHandleConst.NO;
|
|||
@Log4j2
|
||||
public class ApiLogAspect {
|
||||
|
||||
@Resource
|
||||
private ApiLogMapper apiLogMapper;
|
||||
@Autowired
|
||||
private RemoteLogFeign remoteLogFeign;
|
||||
|
||||
//用来调用预警,记录预警信息
|
||||
@Autowired
|
||||
|
|
@ -51,7 +51,7 @@ public class ApiLogAspect {
|
|||
/**
|
||||
* 声明AOP签名
|
||||
*/
|
||||
@Pointcut("@annotation(com.xjs.common.aop.ApiLog)")
|
||||
@Pointcut("@annotation(com.xjs.annotation.ApiLog)")
|
||||
public void pointcut() {
|
||||
}
|
||||
|
||||
|
|
@ -98,7 +98,7 @@ public class ApiLogAspect {
|
|||
|
||||
|
||||
private void handleApiLog(JoinPoint joinPoint, ApiLog apiLog, final Exception e, Object jsonResult) {
|
||||
com.xjs.apilog.domain.ApiLog entity = new com.xjs.apilog.domain.ApiLog();
|
||||
com.xjs.business.log.domain.ApiLog entity = new com.xjs.business.log.domain.ApiLog();
|
||||
String name = apiLog.name();//请求名称
|
||||
entity.setApiName(name);
|
||||
String url = apiLog.url();//请求地址
|
||||
|
|
@ -121,11 +121,11 @@ public class ApiLogAspect {
|
|||
entity.setResponse(jsonResult.toString());
|
||||
}
|
||||
if (e != null) {
|
||||
entity.setIsSuccess(StatusEnum.ERROR);
|
||||
entity.setIsSuccess(ReqConst.ERROR);
|
||||
}else {
|
||||
entity.setIsSuccess(StatusEnum.SUCCESS);
|
||||
entity.setIsSuccess(ReqConst.SUCCESS);
|
||||
}
|
||||
apiLogMapper.insert(entity);
|
||||
remoteLogFeign.saveApiLog(entity);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package com.xjs.common.client.api.baidu;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.xjs.common.aop.ApiLog;
|
||||
import com.xjs.annotation.ApiLog;
|
||||
import com.xjs.common.client.factory.BaiduFeignFactory;
|
||||
import com.xjs.translation.domain.qo.translation.BaiDuTranslationQo;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package com.xjs.common.client.api.roll;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.xjs.common.aop.ApiLog;
|
||||
import com.xjs.annotation.ApiLog;
|
||||
import com.xjs.common.client.factory.RollMMYJFeignFactory;
|
||||
import com.xjs.copywriting.domain.RequestBody;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package com.xjs.common.client.api.roll;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.xjs.common.aop.ApiLog;
|
||||
import com.xjs.annotation.ApiLog;
|
||||
import com.xjs.common.client.factory.RollTranslationFeignFactory;
|
||||
import com.xjs.translation.domain.qo.translation.RollTranslationQo;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,8 @@
|
|||
package com.xjs.common.client.api.tianxing;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.xjs.common.aop.ApiLog;
|
||||
import com.xjs.annotation.ApiLog;
|
||||
import com.xjs.common.client.factory.TianXingBDRSFeignFactory;
|
||||
import com.xjs.common.client.factory.TianXingQWRSFeignFactory;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,8 @@
|
|||
package com.xjs.common.client.api.tianxing;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.xjs.common.aop.ApiLog;
|
||||
import com.xjs.annotation.ApiLog;
|
||||
import com.xjs.common.client.factory.TianXingDYRSFeignFactory;
|
||||
import com.xjs.common.client.factory.TianXingWXRSFeignFactory;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package com.xjs.common.client.api.tianxing;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.xjs.common.aop.ApiLog;
|
||||
import com.xjs.annotation.ApiLog;
|
||||
import com.xjs.common.client.factory.TianXingJDTCFeignFactory;
|
||||
import com.xjs.copywriting.domain.RequestBody;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package com.xjs.common.client.api.tianxing;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.xjs.common.aop.ApiLog;
|
||||
import com.xjs.annotation.ApiLog;
|
||||
import com.xjs.common.client.factory.TianXingMMMYFeignFactory;
|
||||
import com.xjs.copywriting.domain.RequestBody;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ package com.xjs.common.client.api.tianxing;
|
|||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.xjs.aword.domain.RequestBody;
|
||||
import com.xjs.common.aop.ApiLog;
|
||||
import com.xjs.annotation.ApiLog;
|
||||
import com.xjs.common.client.factory.TianXingMMYJFeignFactory;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.cloud.openfeign.SpringQueryMap;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package com.xjs.common.client.api.tianxing;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.xjs.common.aop.ApiLog;
|
||||
import com.xjs.annotation.ApiLog;
|
||||
import com.xjs.common.client.factory.TianXingOneEnglishFeignFactory;
|
||||
import com.xjs.oneenglish.domain.RequestBody;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package com.xjs.common.client.api.tianxing;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.xjs.common.aop.ApiLog;
|
||||
import com.xjs.annotation.ApiLog;
|
||||
import com.xjs.common.client.factory.TianXingPYQFeignFactory;
|
||||
import com.xjs.copywriting.domain.RequestBody;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
|
|
|
|||
|
|
@ -1,15 +1,12 @@
|
|||
package com.xjs.common.client.api.tianxing;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.xjs.common.aop.ApiLog;
|
||||
import com.xjs.annotation.ApiLog;
|
||||
import com.xjs.common.client.factory.TianXingQWRSFeignFactory;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.cloud.openfeign.SpringQueryMap;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import static com.xjs.consts.ApiConst.*;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package com.xjs.common.client.api.tianxing;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.xjs.common.aop.ApiLog;
|
||||
import com.xjs.annotation.ApiLog;
|
||||
import com.xjs.common.client.factory.TianXingTranDictFeignFactory;
|
||||
import com.xjs.copywriting.domain.RequestBody;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,8 @@
|
|||
package com.xjs.common.client.api.tianxing;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.xjs.common.aop.ApiLog;
|
||||
import com.xjs.annotation.ApiLog;
|
||||
import com.xjs.common.client.factory.TianXingWBRSFeignFactory;
|
||||
import com.xjs.common.client.factory.TianXingWXRSFeignFactory;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
package com.xjs.common.client.api.tianxing;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.xjs.common.aop.ApiLog;
|
||||
import com.xjs.common.client.factory.TianXingQWRSFeignFactory;
|
||||
import com.xjs.annotation.ApiLog;
|
||||
import com.xjs.common.client.factory.TianXingWXRSFeignFactory;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package com.xjs.common.client.api.tianxing;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.xjs.common.aop.ApiLog;
|
||||
import com.xjs.annotation.ApiLog;
|
||||
import com.xjs.common.client.factory.TianXingWYYFeignFactory;
|
||||
import com.xjs.copywriting.domain.RequestBody;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package com.xjs.common.client.api.youdao;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.xjs.common.aop.ApiLog;
|
||||
import com.xjs.annotation.ApiLog;
|
||||
import com.xjs.common.client.factory.YouDaoFeignFactory;
|
||||
import com.xjs.translation.domain.qo.translation.YouDaoTranslationQo;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
|
|
|
|||
Loading…
Reference in New Issue