Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
Y
yifu-mvp
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fangxinjiang
yifu-mvp
Commits
9e292f2b
Commit
9e292f2b
authored
Mar 04, 2024
by
huyuchen
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/fxj-dev' into fxj-dev
parents
10d6ec94
98a7360a
Hide whitespace changes
Inline
Side-by-side
Showing
27 changed files
with
1643 additions
and
0 deletions
+1643
-0
pom.xml
pom.xml
+1
-0
DateUtil.java
...om/yifu/cloud/plus/v1/yifu/common/core/util/DateUtil.java
+18
-0
.gitignore
yifu-nginx-log/.gitignore
+62
-0
pom.xml
yifu-nginx-log/pom.xml
+23
-0
pom.xml
yifu-nginx-log/yifu-nginx-log-api/pom.xml
+49
-0
ChecksConstants.java
...om/yifu/cloud/plus/v1/nginx/constant/ChecksConstants.java
+51
-0
NginxLog.java
...in/java/com/yifu/cloud/plus/v1/nginx/entity/NginxLog.java
+145
-0
NginxLogSearchVo.java
...ava/com/yifu/cloud/plus/v1/nginx/vo/NginxLogSearchVo.java
+56
-0
NginxLogVo.java
...main/java/com/yifu/cloud/plus/v1/nginx/vo/NginxLogVo.java
+146
-0
spring.factories.txt
...-log-api/src/main/resources/META-INF/spring.factories.txt
+2
-0
Dockerfile
yifu-nginx-log/yifu-nginx-log-biz/Dockerfile
+15
-0
build-prd.sh
yifu-nginx-log/yifu-nginx-log-biz/build-prd.sh
+2
-0
build-test.sh
yifu-nginx-log/yifu-nginx-log-biz/build-test.sh
+2
-0
build.sh
yifu-nginx-log/yifu-nginx-log-biz/build.sh
+2
-0
pom.xml
yifu-nginx-log/yifu-nginx-log-biz/pom.xml
+95
-0
NginxLogApplication.java
...ava/com/yifu/cloud/plus/v1/nginx/NginxLogApplication.java
+19
-0
NginxLogController.java
...fu/cloud/plus/v1/nginx/controller/NginxLogController.java
+156
-0
NginxLogMapper.java
...a/com/yifu/cloud/plus/v1/nginx/mapper/NginxLogMapper.java
+41
-0
NginxLogService.java
...com/yifu/cloud/plus/v1/nginx/service/NginxLogService.java
+55
-0
NginxLogServiceImpl.java
...cloud/plus/v1/nginx/service/impl/NginxLogServiceImpl.java
+326
-0
NginxLogCommandLineRunner.java
...u/cloud/plus/v1/nginx/util/NginxLogCommandLineRunner.java
+29
-0
application-dev.yml
...yifu-nginx-log-biz/src/main/resources/application-dev.yml
+33
-0
application-prd.yml
...yifu-nginx-log-biz/src/main/resources/application-prd.yml
+34
-0
application-test.yml
...ifu-nginx-log-biz/src/main/resources/application-test.yml
+44
-0
application.yml
...log/yifu-nginx-log-biz/src/main/resources/application.yml
+65
-0
logback-spring.xml
.../yifu-nginx-log-biz/src/main/resources/logback-spring.xml
+63
-0
NginxLogMapper.xml
...ginx-log-biz/src/main/resources/mapper/NginxLogMapper.xml
+109
-0
No files found.
pom.xml
View file @
9e292f2b
...
...
@@ -107,6 +107,7 @@
<module>
yifu-msg
</module>
<module>
yifu-permission
</module>
<module>
yifu-ekp
</module>
<module>
yifu-nginx-log
</module>
</modules>
<dependencyManagement>
...
...
yifu-common/yifu-common-core/src/main/java/com/yifu/cloud/plus/v1/yifu/common/core/util/DateUtil.java
View file @
9e292f2b
...
...
@@ -73,6 +73,10 @@ public class DateUtil {
* yyyy-MM-dd hh:mm:ss
*/
public
static
final
String
DATETIME_PATTERN_MINUTE
=
"yyyy-MM-dd HH:mm"
;
/**
* yyyy-MM-dd-hh
*/
public
static
final
String
DATETIME_PATTERN_HOUR
=
"yyyyMMddHH"
;
/**
* yyyyMMddHHmmss
*/
...
...
@@ -478,6 +482,20 @@ public class DateUtil {
return
cal
.
getTime
();
}
/**
* @param date
* @param mnt
* @return java.util.Date
*/
public
static
String
dateIncreaseByHour
(
Date
date
,
int
mnt
,
String
fmt
)
{
Calendar
cal
=
GregorianCalendar
.
getInstance
(
TimeZone
.
getTimeZone
(
"GMT"
));
cal
.
setTime
(
date
);
cal
.
add
(
Calendar
.
HOUR
,
mnt
);
return
dateToString
(
cal
.
getTime
(),
fmt
);
}
/**
* @param date
* @param mnt
...
...
yifu-nginx-log/.gitignore
0 → 100644
View file @
9e292f2b
# 忽略匹配下列规则的Git 提交 V2.1.0
### gradle ###
.gradle
/build/
!gradle/wrapper/gradle-wrapper.jar
### STS ###
.settings/
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
bin/
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
*.lock
rebel.xml
### NetBeans ###
nbproject/private/
build/
nbbuild/
nbdist/
.nb-gradle/
### maven ###
target/
*.war
*.ear
*.zip
*.tar
*.tar.gz
### logs ####
/logs/
*.log
### temp ignore ###
*.cache
*.diff
*.patch
*.tmp
*.java~
*.properties~
*.xml~
### system ignore ###
.DS_Store
Thumbs.db
Servers
.metadata
upload
gen_code
### node ###
node_modules
yifu-nginx-log/pom.xml
0 → 100644
View file @
9e292f2b
<?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"
>
<modelVersion>
4.0.0
</modelVersion>
<parent>
<groupId>
com.yifu.cloud.plus.v1
</groupId>
<artifactId>
yifu
</artifactId>
<version>
1.0.0
</version>
</parent>
<artifactId>
yifu-nginx-log
</artifactId>
<description>
nginx-log-insert-mysql
</description>
<packaging>
pom
</packaging>
<!--项目子模块-->
<modules>
<module>
yifu-nginx-log-api
</module>
<module>
yifu-nginx-log-biz
</module>
</modules>
</project>
yifu-nginx-log/yifu-nginx-log-api/pom.xml
0 → 100644
View file @
9e292f2b
<?xml version="1.0"?>
<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"
>
<modelVersion>
4.0.0
</modelVersion>
<parent>
<groupId>
com.yifu.cloud.plus.v1
</groupId>
<artifactId>
yifu
</artifactId>
<version>
1.0.0
</version>
</parent>
<artifactId>
yifu-nginx-log-api
</artifactId>
<packaging>
jar
</packaging>
<description>
nginx日志记录到数据库
</description>
<dependencies>
<!-- core 工具类 -->
<dependency>
<groupId>
com.yifu.cloud.plus.v1
</groupId>
<artifactId>
yifu-common-core
</artifactId>
</dependency>
<!--swagger 注解-->
<!--<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-annotations</artifactId>
</dependency>-->
<!--feign 注解依赖-->
<!--<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-openfeign-core</artifactId>
<optional>true</optional>
</dependency>-->
<!--mybatis 依赖-->
<dependency>
<groupId>
com.yifu.cloud.plus.v1
</groupId>
<artifactId>
yifu-common-mybatis
</artifactId>
</dependency>
<dependency>
<groupId>
org.apache.httpcomponents
</groupId>
<artifactId>
httpclient
</artifactId>
</dependency>
<dependency>
<groupId>
com.google.code.gson
</groupId>
<artifactId>
gson
</artifactId>
</dependency>
</dependencies>
</project>
yifu-nginx-log/yifu-nginx-log-api/src/main/java/com/yifu/cloud/plus/v1/nginx/constant/ChecksConstants.java
0 → 100644
View file @
9e292f2b
package
com
.
yifu
.
cloud
.
plus
.
v1
.
check
.
constant
;
/**
* @Author fxj
* @Date 2022/6/21
* @Description
* @Version 1.0
*/
public
interface
ChecksConstants
{
String
NACOS_CHECK_CONFIG_ERROR
=
"校验服务验证开关关闭!"
;
String
CHECK_CONFIG_ACCESS
=
"校验服务验证关闭,自动放行!"
;
String
CODE
=
"code"
;
String
DATA
=
"data"
;
String
CODE_200000
=
"200000"
;
String
NO_DATA_RESULT
=
"接口无返回数据"
;
String
MESSAGE
=
"message"
;
String
MESSAGE_INFO
=
",msg:"
;
String
MOBILE
=
"mobile"
;
String
AREA
=
"area"
;
String
NUMBER_TYPE
=
"numberType"
;
String
CHARGES_STATUS
=
"chargesStatus"
;
String
STATUS
=
"status"
;
String
RESULT
=
"result"
;
String
REMARK
=
"remark"
;
String
APP_ID
=
"appId"
;
String
APP_KEY
=
"appKey"
;
String
MOBILES
=
"mobiles"
;
String
NAME
=
"name"
;
String
ID_NUM
=
"idNum"
;
String
CARD_NO
=
"cardNo"
;
}
yifu-nginx-log/yifu-nginx-log-api/src/main/java/com/yifu/cloud/plus/v1/nginx/entity/NginxLog.java
0 → 100644
View file @
9e292f2b
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package
com
.
yifu
.
cloud
.
plus
.
v1
.
nginx
.
entity
;
import
com.alibaba.excel.annotation.ExcelProperty
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute
;
import
org.hibernate.validator.constraints.Length
;
import
javax.validation.constraints.NotBlank
;
/**
* @author fxj
* @date 2024-02-27 16:17:54
*/
@Data
@TableName
(
"nginx_log"
)
@EqualsAndHashCode
(
callSuper
=
true
)
@Schema
(
description
=
""
)
public
class
NginxLog
extends
BaseEntity
{
/**
* id
*/
@TableId
(
type
=
IdType
.
ASSIGN_ID
)
@ExcelProperty
(
"id"
)
@Schema
(
description
=
"id"
)
private
String
id
;
/**
* 访问时间和时区
*/
@ExcelAttribute
(
name
=
"访问时间和时区"
,
maxLength
=
255
)
@Length
(
max
=
255
,
message
=
"访问时间和时区不能超过255个字符"
)
@ExcelProperty
(
"访问时间和时区"
)
@Schema
(
description
=
"访问时间和时区"
)
private
String
timestamp
;
/**
* 客户端的IP地址
*/
@ExcelAttribute
(
name
=
"客户端的IP地址"
,
maxLength
=
255
)
@Length
(
max
=
255
,
message
=
"客户端的IP地址不能超过255个字符"
)
@ExcelProperty
(
"客户端的IP地址"
)
@Schema
(
description
=
"客户端的IP地址"
)
private
String
remoteAdr
;
/**
* 记录请求的URL及请求方法
*/
@ExcelAttribute
(
name
=
"记录请求的URL及请求方法"
,
maxLength
=
255
)
@Length
(
max
=
255
,
message
=
"记录请求的URL及请求方法不能超过255个字符"
)
@ExcelProperty
(
"记录请求的URL及请求方法"
)
@Schema
(
description
=
"记录请求的URL及请求方法"
)
private
String
request
;
/**
* HTTP请求状态
*/
@ExcelAttribute
(
name
=
"HTTP请求状态"
,
maxLength
=
255
)
@Length
(
max
=
255
,
message
=
"HTTP请求状态不能超过255个字符"
)
@ExcelProperty
(
"HTTP请求状态"
)
@Schema
(
description
=
"HTTP请求状态"
)
private
String
status
;
/**
* 给客户端发送的文件主题内容字节数,响应头不计算在内
*/
@ExcelAttribute
(
name
=
"给客户端发送的文件主题内容字节数,响应头不计算在内"
,
maxLength
=
255
)
@Length
(
max
=
255
,
message
=
"给客户端发送的文件主题内容字节数,响应头不计算在内不能超过255个字符"
)
@ExcelProperty
(
"给客户端发送的文件主题内容字节数,响应头不计算在内"
)
@Schema
(
description
=
"给客户端发送的文件主题内容字节数,响应头不计算在内"
)
private
String
bytes
;
/**
* 用户所使用的代理
*/
@ExcelAttribute
(
name
=
"用户所使用的代理"
,
maxLength
=
255
)
@Length
(
max
=
255
,
message
=
"用户所使用的代理不能超过255个字符"
)
@ExcelProperty
(
"用户所使用的代理"
)
@Schema
(
description
=
"用户所使用的代理"
)
private
String
agent
;
/**
* 重定向URL
*/
@ExcelAttribute
(
name
=
"重定向URL"
,
maxLength
=
255
)
@Length
(
max
=
255
,
message
=
"重定向URL不能超过255个字符"
)
@ExcelProperty
(
"重定向URL"
)
@Schema
(
description
=
"重定向URL"
)
private
String
forwarded
;
/**
* 后台提供服务的地址(即转发处理的目标地址)
*/
@ExcelAttribute
(
name
=
"后台提供服务的地址(即转发处理的目标地址)"
,
maxLength
=
255
)
@Length
(
max
=
255
,
message
=
"后台提供服务的地址(即转发处理的目标地址)不能超过255个字符"
)
@ExcelProperty
(
"后台提供服务的地址(即转发处理的目标地址)"
)
@Schema
(
description
=
"后台提供服务的地址(即转发处理的目标地址)"
)
private
String
upAddr
;
/**
* 后台提供服务的地址(即转发处理的目标地址)
*/
@ExcelAttribute
(
name
=
"后台提供服务的地址(即转发处理的目标地址)"
,
maxLength
=
255
)
@Length
(
max
=
255
,
message
=
"后台提供服务的地址(即转发处理的目标地址)不能超过255个字符"
)
@ExcelProperty
(
"后台提供服务的地址(即转发处理的目标地址)"
)
@Schema
(
description
=
"后台提供服务的地址(即转发处理的目标地址)"
)
private
String
upHost
;
/**
* 从nginx向后端建立连接开始到接受完数据然后关闭连接为止的时间
*/
@ExcelAttribute
(
name
=
"从nginx向后端建立连接开始到接受完数据然后关闭连接为止的时间"
)
@ExcelProperty
(
"从nginx向后端建立连接开始到接受完数据然后关闭连接为止的时间"
)
@Schema
(
description
=
"从nginx向后端建立连接开始到接受完数据然后关闭连接为止的时间"
)
private
Double
upRespTime
;
/**
* 整个请求的总时间,从接收用户请求的第一个字节到发送完响应数据的时间,即包括接收请求数据时间,程序响应时间,输出响应数据时间
*/
@ExcelAttribute
(
name
=
"整个请求的总时间,从接收用户请求的第一个字节到发送完响应数据的时间,即包括接收请求数据时间,程序响应时间,输出响应数据时间"
)
@ExcelProperty
(
"整个请求的总时间,从接收用户请求的第一个字节到发送完响应数据的时间,即包括接收请求数据时间,程序响应时间,输出响应数据时间"
)
@Schema
(
description
=
"整个请求的总时间,从接收用户请求的第一个字节到发送完响应数据的时间,即包括接收请求数据时间,程序响应时间,输出响应数据时间"
)
private
Double
requestTime
;
/**
* 请求中的参数
*/
@ExcelAttribute
(
name
=
"请求中的参数"
,
maxLength
=
255
)
@Length
(
max
=
255
,
message
=
"请求中的参数不能超过255个字符"
)
@ExcelProperty
(
"请求中的参数"
)
@Schema
(
description
=
"请求中的参数"
)
private
String
args
;
}
yifu-nginx-log/yifu-nginx-log-api/src/main/java/com/yifu/cloud/plus/v1/nginx/vo/NginxLogSearchVo.java
0 → 100644
View file @
9e292f2b
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package
com
.
yifu
.
cloud
.
plus
.
v1
.
nginx
.
vo
;
import
com.yifu.cloud.plus.v1.nginx.entity.NginxLog
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.Data
;
import
java.time.LocalDateTime
;
/**
* @author fxj
* @date 2024-02-27 16:17:54
*/
@Data
public
class
NginxLogSearchVo
extends
NginxLog
{
/**
* 多选导出或删除等操作
*/
@Schema
(
description
=
"选中ID,多个逗号分割"
)
private
String
ids
;
/**
* 创建时间区间 [开始时间,结束时间]
*/
@Schema
(
description
=
"创建时间区间"
)
private
LocalDateTime
[]
createTimes
;
/**
* @Author fxj
* 查询数据起
**/
@Schema
(
description
=
"查询limit 开始"
)
private
int
limitStart
;
/**
* @Author fxj
* 查询数据止
**/
@Schema
(
description
=
"查询limit 数据条数"
)
private
int
limitEnd
;
}
yifu-nginx-log/yifu-nginx-log-api/src/main/java/com/yifu/cloud/plus/v1/nginx/vo/NginxLogVo.java
0 → 100644
View file @
9e292f2b
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package
com
.
yifu
.
cloud
.
plus
.
v1
.
nginx
.
vo
;
import
com.alibaba.excel.annotation.ExcelProperty
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.yifu.cloud.plus.v1.yifu.common.core.vo.RowIndex
;
import
com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute
;
import
org.hibernate.validator.constraints.Length
;
import
javax.validation.constraints.NotBlank
;
import
java.io.Serializable
;
/**
* @author fxj
* @date 2024-02-27 16:17:54
*/
@Data
public
class
NginxLogVo
extends
RowIndex
implements
Serializable
{
/**
* id
*/
@TableId
(
type
=
IdType
.
ASSIGN_ID
)
@NotBlank
(
message
=
"id 不能为空"
)
@Length
(
max
=
255
,
message
=
"id 不能超过255 个字符"
)
@ExcelAttribute
(
name
=
"id"
,
isNotEmpty
=
true
,
errorInfo
=
"id 不能为空"
,
maxLength
=
255
)
@Schema
(
description
=
"id"
)
@ExcelProperty
(
"id"
)
private
String
id
;
/**
* 访问时间和时区
*/
@Length
(
max
=
255
,
message
=
"访问时间和时区 不能超过255 个字符"
)
@ExcelAttribute
(
name
=
"访问时间和时区"
,
maxLength
=
255
)
@Schema
(
description
=
"访问时间和时区"
)
@ExcelProperty
(
"访问时间和时区"
)
private
String
timestamp
;
/**
* 客户端的IP地址
*/
@Length
(
max
=
255
,
message
=
"客户端的IP地址 不能超过255 个字符"
)
@ExcelAttribute
(
name
=
"客户端的IP地址"
,
maxLength
=
255
)
@Schema
(
description
=
"客户端的IP地址"
)
@ExcelProperty
(
"客户端的IP地址"
)
private
String
remoteAdr
;
/**
* 记录请求的URL及请求方法
*/
@Length
(
max
=
255
,
message
=
"记录请求的URL及请求方法 不能超过255 个字符"
)
@ExcelAttribute
(
name
=
"记录请求的URL及请求方法"
,
maxLength
=
255
)
@Schema
(
description
=
"记录请求的URL及请求方法"
)
@ExcelProperty
(
"记录请求的URL及请求方法"
)
private
String
request
;
/**
* HTTP请求状态
*/
@Length
(
max
=
255
,
message
=
"HTTP请求状态 不能超过255 个字符"
)
@ExcelAttribute
(
name
=
"HTTP请求状态"
,
maxLength
=
255
)
@Schema
(
description
=
"HTTP请求状态"
)
@ExcelProperty
(
"HTTP请求状态"
)
private
String
status
;
/**
* 给客户端发送的文件主题内容字节数,响应头不计算在内
*/
@Length
(
max
=
255
,
message
=
"给客户端发送的文件主题内容字节数,响应头不计算在内 不能超过255 个字符"
)
@ExcelAttribute
(
name
=
"给客户端发送的文件主题内容字节数,响应头不计算在内"
,
maxLength
=
255
)
@Schema
(
description
=
"给客户端发送的文件主题内容字节数,响应头不计算在内"
)
@ExcelProperty
(
"给客户端发送的文件主题内容字节数,响应头不计算在内"
)
private
String
bytes
;
/**
* 用户所使用的代理
*/
@Length
(
max
=
255
,
message
=
"用户所使用的代理 不能超过255 个字符"
)
@ExcelAttribute
(
name
=
"用户所使用的代理"
,
maxLength
=
255
)
@Schema
(
description
=
"用户所使用的代理"
)
@ExcelProperty
(
"用户所使用的代理"
)
private
String
agent
;
/**
* 重定向URL
*/
@Length
(
max
=
255
,
message
=
"重定向URL 不能超过255 个字符"
)
@ExcelAttribute
(
name
=
"重定向URL"
,
maxLength
=
255
)
@Schema
(
description
=
"重定向URL"
)
@ExcelProperty
(
"重定向URL"
)
private
String
forwarded
;
/**
* 后台提供服务的地址(即转发处理的目标地址)
*/
@Length
(
max
=
255
,
message
=
"后台提供服务的地址(即转发处理的目标地址) 不能超过255 个字符"
)
@ExcelAttribute
(
name
=
"后台提供服务的地址(即转发处理的目标地址)"
,
maxLength
=
255
)
@Schema
(
description
=
"后台提供服务的地址(即转发处理的目标地址)"
)
@ExcelProperty
(
"后台提供服务的地址(即转发处理的目标地址)"
)
private
String
upAddr
;
/**
* 后台提供服务的地址(即转发处理的目标地址)
*/
@Length
(
max
=
255
,
message
=
"后台提供服务的地址(即转发处理的目标地址) 不能超过255 个字符"
)
@ExcelAttribute
(
name
=
"后台提供服务的地址(即转发处理的目标地址)"
,
maxLength
=
255
)
@Schema
(
description
=
"后台提供服务的地址(即转发处理的目标地址)"
)
@ExcelProperty
(
"后台提供服务的地址(即转发处理的目标地址)"
)
private
String
upHost
;
/**
* 从nginx向后端建立连接开始到接受完数据然后关闭连接为止的时间
*/
@ExcelAttribute
(
name
=
"从nginx向后端建立连接开始到接受完数据然后关闭连接为止的时间"
)
@Schema
(
description
=
"从nginx向后端建立连接开始到接受完数据然后关闭连接为止的时间"
)
@ExcelProperty
(
"从nginx向后端建立连接开始到接受完数据然后关闭连接为止的时间"
)
private
Long
upRespTime
;
/**
* 整个请求的总时间,从接收用户请求的第一个字节到发送完响应数据的时间,即包括接收请求数据时间,程序响应时间,输出响应数据时间
*/
@ExcelAttribute
(
name
=
"整个请求的总时间,从接收用户请求的第一个字节到发送完响应数据的时间,即包括接收请求数据时间,程序响应时间,输出响应数据时间"
)
@Schema
(
description
=
"整个请求的总时间,从接收用户请求的第一个字节到发送完响应数据的时间,即包括接收请求数据时间,程序响应时间,输出响应数据时间"
)
@ExcelProperty
(
"整个请求的总时间,从接收用户请求的第一个字节到发送完响应数据的时间,即包括接收请求数据时间,程序响应时间,输出响应数据时间"
)
private
Long
requestTime
;
/**
* 请求中的参数
*/
@Length
(
max
=
255
,
message
=
"请求中的参数 不能超过255 个字符"
)
@ExcelAttribute
(
name
=
"请求中的参数"
,
maxLength
=
255
)
@Schema
(
description
=
"请求中的参数"
)
@ExcelProperty
(
"请求中的参数"
)
private
String
args
;
}
yifu-nginx-log/yifu-nginx-log-api/src/main/resources/META-INF/spring.factories.txt
0 → 100644
View file @
9e292f2b
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
com.yifu.cloud.plus.v1.job.config.SchedulerBeanFactoryConfig
\ No newline at end of file
yifu-nginx-log/yifu-nginx-log-biz/Dockerfile
0 → 100644
View file @
9e292f2b
FROM
moxm/java:1.8-full
RUN
mkdir
-p
/yifu-nginx-log-biz
WORKDIR
yifu-nginx-log-biz
ARG
JAR_FILE=target/yifu-nginx-log-biz.jar
COPY
${JAR_FILE} app.jar
EXPOSE
5066
ENV
TZ=Asia/Shanghai JAVA_OPTS="-Xms128m -Xmx256m -Djava.security.egd=file:/dev/./urandom"
CMD
sleep 60; java -jar app.jar $JAVA_OPTS
yifu-nginx-log/yifu-nginx-log-biz/build-prd.sh
0 → 100644
View file @
9e292f2b
#!/usr/bin/env bash
mvn clean package
-Pprd
-Dmaven
.test.skip
=
true
docker:build
-DpushImage
\ No newline at end of file
yifu-nginx-log/yifu-nginx-log-biz/build-test.sh
0 → 100644
View file @
9e292f2b
#!/usr/bin/env bash
mvn clean package
-Ptest
-Dmaven
.test.skip
=
true
docker:build
-DpushImage
\ No newline at end of file
yifu-nginx-log/yifu-nginx-log-biz/build.sh
0 → 100644
View file @
9e292f2b
#!/usr/bin/env bash
mvn clean package
-Dmaven
.test.skip
=
true
docker:build
-DpushImage
\ No newline at end of file
yifu-nginx-log/yifu-nginx-log-biz/pom.xml
0 → 100644
View file @
9e292f2b
<?xml version="1.0"?>
<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"
>
<modelVersion>
4.0.0
</modelVersion>
<parent>
<groupId>
com.yifu.cloud.plus.v1
</groupId>
<artifactId>
yifu
</artifactId>
<version>
1.0.0
</version>
</parent>
<artifactId>
yifu-nginx-log-biz
</artifactId>
<packaging>
jar
</packaging>
<description>
nginx log 日志记录到数据库
</description>
<dependencies>
<!--选配: 依赖seata模块-->
<dependency>
<groupId>
com.yifu.cloud.plus.v1
</groupId>
<artifactId>
yifu-common-seata
</artifactId>
</dependency>
<!--必备: 依赖api模块-->
<dependency>
<groupId>
com.yifu.cloud.plus.v1
</groupId>
<artifactId>
yifu-nginx-log-api
</artifactId>
<version>
1.0.0
</version>
</dependency>
<!--选配: orm 模块-->
<dependency>
<groupId>
com.baomidou
</groupId>
<artifactId>
mybatis-plus-boot-starter
</artifactId>
</dependency>
<dependency>
<groupId>
mysql
</groupId>
<artifactId>
mysql-connector-java
</artifactId>
</dependency>
<!--必备:安全模块-->
<dependency>
<groupId>
com.yifu.cloud.plus.v1
</groupId>
<artifactId>
yifu-common-security
</artifactId>
</dependency>
<!--必备:日志处理-->
<dependency>
<groupId>
com.yifu.cloud.plus.v1
</groupId>
<artifactId>
yifu-common-log
</artifactId>
</dependency>
<!--必备:swagger-->
<dependency>
<groupId>
com.yifu.cloud.plus.v1
</groupId>
<artifactId>
yifu-common-swagger
</artifactId>
</dependency>
<!--必备:undertow容器-->
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-undertow
</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
</plugin>
<plugin>
<groupId>
com.spotify
</groupId>
<artifactId>
docker-maven-plugin
</artifactId>
<version>
1.1.0
</version>
<configuration>
<serverId>
docker-hub
</serverId>
<!--指定生成的镜像名-->
<imageName>
${my.hub.host}/${map.group.name}/${project.artifactId}:${project.version}
</imageName>
<dockerDirectory>
${project.basedir}/
</dockerDirectory>
<!--指定远程 docker api地址-->
<!--<dockerHost>http://172.16.66.232:2375</dockerHost>-->
<!-- 这里是复制 jar 包到 docker 容器指定目录配置-->
<resources>
<resource>
<targetPath>
/
</targetPath>
<!--jar 包所在的路径 此处配置的 即对应 target 目录-->
<directory>
${project.build.directory}
</directory>
<!-- 需要包含的 jar包 ,这里对应的是 Dockerfile中添加的文件名 -->
<include>
${project.build.finalName}.jar
</include>
</resource>
</resources>
<forceTags>
true
</forceTags>
</configuration>
</plugin>
</plugins>
</build>
</project>
yifu-nginx-log/yifu-nginx-log-biz/src/main/java/com/yifu/cloud/plus/v1/nginx/NginxLogApplication.java
0 → 100644
View file @
9e292f2b
package
com
.
yifu
.
cloud
.
plus
.
v1
.
nginx
;
import
com.yifu.cloud.plus.v1.yifu.common.security.annotation.EnableYifuResourceServer
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
/**
* @author pig archetype
* <p>
* 项目启动类
*/
@EnableYifuResourceServer
@SpringBootApplication
public
class
NginxLogApplication
{
public
static
void
main
(
String
[]
args
)
{
SpringApplication
.
run
(
NginxLogApplication
.
class
,
args
);
}
}
yifu-nginx-log/yifu-nginx-log-biz/src/main/java/com/yifu/cloud/plus/v1/nginx/controller/NginxLogController.java
0 → 100644
View file @
9e292f2b
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package
com
.
yifu
.
cloud
.
plus
.
v1
.
nginx
.
controller
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yifu.cloud.plus.v1.nginx.entity.NginxLog
;
import
com.yifu.cloud.plus.v1.nginx.service.NginxLogService
;
import
com.yifu.cloud.plus.v1.nginx.service.impl.NginxLogServiceImpl
;
import
com.yifu.cloud.plus.v1.nginx.vo.NginxLogSearchVo
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog
;
import
io.swagger.v3.oas.annotations.Operation
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
lombok.RequiredArgsConstructor
;
import
lombok.SneakyThrows
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.List
;
/**
*
*
* @author fxj
* @date 2024-02-27 16:17:54
*/
@RestController
@RequiredArgsConstructor
@RequestMapping
(
"/nginxlog"
)
@Tag
(
name
=
"管理"
)
public
class
NginxLogController
{
private
final
NginxLogService
nginxLogService
;
/**
* 简单分页查询
* @param page 分页对象
* @param nginxLog
* @return
*/
@Operation
(
description
=
"简单分页查询"
)
@GetMapping
(
"/page"
)
public
R
<
IPage
<
NginxLog
>>
getNginxLogPage
(
Page
<
NginxLog
>
page
,
NginxLogSearchVo
nginxLog
)
{
return
new
R
<>(
nginxLogService
.
getNginxLogPage
(
page
,
nginxLog
));
}
/**
* 不分页查询
* @param nginxLog
* @return
*/
@Operation
(
summary
=
"不分页查询"
,
description
=
"不分页查询"
)
@PostMapping
(
"/noPage"
)
//@PreAuthorize("@pms.hasPermission('demo_nginxlog_get')" )
public
R
<
List
<
NginxLog
>>
getNginxLogNoPage
(
@RequestBody
NginxLogSearchVo
nginxLog
)
{
return
R
.
ok
(
nginxLogService
.
noPageDiy
(
nginxLog
));
}
/**
* 通过id查询
* @param id id
* @return R
*/
@Operation
(
summary
=
"通过id查询"
,
description
=
"通过id查询:hasPermission('demo_nginxlog_get')"
)
@GetMapping
(
"/{id}"
)
@PreAuthorize
(
"@pms.hasPermission('demo_nginxlog_get')"
)
public
R
<
NginxLog
>
getById
(
@PathVariable
(
"id"
)
String
id
)
{
return
R
.
ok
(
nginxLogService
.
getById
(
id
));
}
/**
* 新增
* @param nginxLog
* @return R
*/
@Operation
(
summary
=
"新增"
,
description
=
"新增:hasPermission('demo_nginxlog_add')"
)
@SysLog
(
"新增"
)
@PostMapping
@PreAuthorize
(
"@pms.hasPermission('demo_nginxlog_add')"
)
public
R
<
Boolean
>
save
(
@RequestBody
NginxLog
nginxLog
)
{
return
R
.
ok
(
nginxLogService
.
save
(
nginxLog
));
}
/**
* 修改
* @param nginxLog
* @return R
*/
@Operation
(
summary
=
"修改"
,
description
=
"修改:hasPermission('demo_nginxlog_edit')"
)
@SysLog
(
"修改"
)
@PutMapping
@PreAuthorize
(
"@pms.hasPermission('demo_nginxlog_edit')"
)
public
R
<
Boolean
>
updateById
(
@RequestBody
NginxLog
nginxLog
)
{
return
R
.
ok
(
nginxLogService
.
updateById
(
nginxLog
));
}
/**
* 通过id删除
* @param id id
* @return R
*/
@Operation
(
summary
=
"通过id删除"
,
description
=
"通过id删除:hasPermission('demo_nginxlog_del')"
)
@SysLog
(
"通过id删除"
)
@DeleteMapping
(
"/{id}"
)
@PreAuthorize
(
"@pms.hasPermission('demo_nginxlog_del')"
)
public
R
<
Boolean
>
removeById
(
@PathVariable
String
id
)
{
return
R
.
ok
(
nginxLogService
.
removeById
(
id
));
}
/**
* 批量导入
*
* @author fxj
* @date 2024-02-27 16:17:54
**/
@SneakyThrows
@Operation
(
description
=
"批量新增 hasPermission('demo_nginxlog-batch-import')"
)
@SysLog
(
"批量新增"
)
@PostMapping
(
"/importListAdd"
)
@PreAuthorize
(
"@pms.hasPermission('demo_nginxlog-batch-import')"
)
public
R
<
List
<
ErrorMessage
>>
importListAdd
(
@RequestBody
MultipartFile
file
){
return
nginxLogService
.
importDiy
(
file
.
getInputStream
());
}
/**
* 批量导出
* @author fxj
* @date 2024-02-27 16:17:54
**/
@Operation
(
description
=
"导出 hasPermission('demo_nginxlog-export')"
)
@PostMapping
(
"/export"
)
@PreAuthorize
(
"@pms.hasPermission('demo_nginxlog-export')"
)
public
void
export
(
HttpServletResponse
response
,
@RequestBody
NginxLogSearchVo
searchVo
)
{
nginxLogService
.
listExport
(
response
,
searchVo
);
}
}
yifu-nginx-log/yifu-nginx-log-biz/src/main/java/com/yifu/cloud/plus/v1/nginx/mapper/NginxLogMapper.java
0 → 100644
View file @
9e292f2b
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package
com
.
yifu
.
cloud
.
plus
.
v1
.
nginx
.
mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yifu.cloud.plus.v1.nginx.entity.NginxLog
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
/**
*
*
* @author fxj
* @date 2024-02-27 16:17:54
*/
@Mapper
public
interface
NginxLogMapper
extends
BaseMapper
<
NginxLog
>
{
/**
* 简单分页查询
* @param nginxLog
* @return
*/
IPage
<
NginxLog
>
getNginxLogPage
(
Page
<
NginxLog
>
page
,
@Param
(
"nginxLog"
)
NginxLog
nginxLog
);
}
yifu-nginx-log/yifu-nginx-log-biz/src/main/java/com/yifu/cloud/plus/v1/nginx/service/NginxLogService.java
0 → 100644
View file @
9e292f2b
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package
com
.
yifu
.
cloud
.
plus
.
v1
.
nginx
.
service
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.yifu.cloud.plus.v1.nginx.entity.NginxLog
;
import
com.yifu.cloud.plus.v1.nginx.vo.NginxLogSearchVo
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.InputStream
;
import
java.util.List
;
/**
*
*
* @author fxj
* @date 2024-02-27 16:17:54
*/
public
interface
NginxLogService
extends
IService
<
NginxLog
>
{
/**
* 简单分页查询
* @param nginxLog
* @return
*/
IPage
<
NginxLog
>
getNginxLogPage
(
Page
<
NginxLog
>
page
,
NginxLogSearchVo
nginxLog
);
R
<
List
<
ErrorMessage
>>
importDiy
(
InputStream
inputStream
);
void
listExport
(
HttpServletResponse
response
,
NginxLogSearchVo
searchVo
);
List
<
NginxLog
>
noPageDiy
(
NginxLogSearchVo
searchVo
);
void
readAndWriteLogAsys
();
void
readAndWriteLog
();
}
yifu-nginx-log/yifu-nginx-log-biz/src/main/java/com/yifu/cloud/plus/v1/nginx/service/impl/NginxLogServiceImpl.java
0 → 100644
View file @
9e292f2b
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package
com
.
yifu
.
cloud
.
plus
.
v1
.
nginx
.
service
.
impl
;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.util.ArrayUtil
;
import
com.alibaba.excel.EasyExcel
;
import
com.alibaba.excel.ExcelWriter
;
import
com.alibaba.excel.context.AnalysisContext
;
import
com.alibaba.excel.read.listener.ReadListener
;
import
com.alibaba.excel.read.metadata.holder.ReadRowHolder
;
import
com.alibaba.excel.util.ListUtils
;
import
com.alibaba.excel.write.metadata.WriteSheet
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.google.gson.Gson
;
import
com.yifu.cloud.plus.v1.nginx.entity.NginxLog
;
import
com.yifu.cloud.plus.v1.nginx.mapper.NginxLogMapper
;
import
com.yifu.cloud.plus.v1.nginx.service.NginxLogService
;
import
com.yifu.cloud.plus.v1.nginx.vo.NginxLogSearchVo
;
import
com.yifu.cloud.plus.v1.nginx.vo.NginxLogVo
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.*
;
import
com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity
;
import
lombok.AllArgsConstructor
;
import
lombok.extern.log4j.Log4j2
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.stereotype.Service
;
import
javax.servlet.ServletOutputStream
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.*
;
import
java.net.URLEncoder
;
import
java.util.*
;
import
java.util.concurrent.Executors
;
import
java.util.concurrent.ScheduledExecutorService
;
import
java.util.concurrent.TimeUnit
;
/**
*
*
* @author fxj
* @date 2024-02-27 16:17:54
*/
@AllArgsConstructor
@Log4j2
@Service
public
class
NginxLogServiceImpl
extends
ServiceImpl
<
NginxLogMapper
,
NginxLog
>
implements
NginxLogService
{
/**
* 简单分页查询
* @param nginxLog
* @return
*/
@Override
public
IPage
<
NginxLog
>
getNginxLogPage
(
Page
<
NginxLog
>
page
,
NginxLogSearchVo
nginxLog
){
return
baseMapper
.
getNginxLogPage
(
page
,
nginxLog
);
}
/**
* 批量导出
* @param searchVo
* @return
*/
@Override
public
void
listExport
(
HttpServletResponse
response
,
NginxLogSearchVo
searchVo
){
String
fileName
=
"批量导出"
+
DateUtil
.
getThisTime
()
+
".xlsx"
;
//获取要导出的列表
List
<
NginxLog
>
list
=
new
ArrayList
<>();
long
count
=
noPageCountDiy
(
searchVo
);
ServletOutputStream
out
=
null
;
try
{
out
=
response
.
getOutputStream
();
response
.
setContentType
(
CommonConstants
.
MULTIPART_FORM_DATA
);
response
.
setCharacterEncoding
(
"utf-8"
);
response
.
setHeader
(
CommonConstants
.
CONTENT_DISPOSITION
,
CommonConstants
.
ATTACHMENT_FILENAME
+
URLEncoder
.
encode
(
fileName
,
CommonConstants
.
UTF8
));
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
//EasyExcel.write(out, TEmpBadRecord.class).sheet("不良记录").doWrite(list);
ExcelWriter
excelWriter
=
EasyExcel
.
write
(
out
,
NginxLog
.
class
).
build
();
int
index
=
0
;
if
(
count
>
CommonConstants
.
ZERO_INT
){
for
(
int
i
=
0
;
i
<=
count
;
)
{
// 获取实际记录
searchVo
.
setLimitStart
(
i
);
searchVo
.
setLimitEnd
(
CommonConstants
.
EXCEL_EXPORT_LIMIT
);
list
=
noPageDiy
(
searchVo
);
if
(
Common
.
isNotNull
(
list
)){
ExcelUtil
<
NginxLog
>
util
=
new
ExcelUtil
<>(
NginxLog
.
class
);
for
(
NginxLog
vo:
list
){
util
.
convertEntity
(
vo
,
null
,
null
,
null
);
}
}
if
(
Common
.
isNotNull
(
list
)){
WriteSheet
writeSheet
=
EasyExcel
.
writerSheet
(
""
+
index
).
build
();
excelWriter
.
write
(
list
,
writeSheet
);
index
++;
}
i
=
i
+
CommonConstants
.
EXCEL_EXPORT_LIMIT
;
if
(
Common
.
isNotNull
(
list
)){
list
.
clear
();
}
}
}
else
{
WriteSheet
writeSheet
=
EasyExcel
.
writerSheet
(
""
+
index
).
build
();
excelWriter
.
write
(
list
,
writeSheet
);
}
if
(
Common
.
isNotNull
(
list
)){
list
.
clear
();
}
out
.
flush
();
excelWriter
.
finish
();
}
catch
(
Exception
e
){
log
.
error
(
"执行异常"
,
e
);
}
finally
{
try
{
if
(
null
!=
out
)
{
out
.
close
();
}
}
catch
(
IOException
e
)
{
log
.
error
(
"执行异常"
,
e
);
}
}
}
@Override
public
List
<
NginxLog
>
noPageDiy
(
NginxLogSearchVo
searchVo
)
{
LambdaQueryWrapper
<
NginxLog
>
wrapper
=
buildQueryWrapper
(
searchVo
);
List
<
String
>
idList
=
Common
.
getList
(
searchVo
.
getIds
());
if
(
Common
.
isNotNull
(
idList
)){
wrapper
.
in
(
NginxLog:
:
getId
,
idList
);
}
if
(
searchVo
.
getLimitStart
()
>=
0
&&
searchVo
.
getLimitEnd
()
>
0
){
wrapper
.
last
(
" limit "
+
searchVo
.
getLimitStart
()
+
","
+
searchVo
.
getLimitEnd
());
}
wrapper
.
orderByDesc
(
BaseEntity:
:
getCreateTime
);
return
baseMapper
.
selectList
(
wrapper
);
}
private
Long
noPageCountDiy
(
NginxLogSearchVo
searchVo
)
{
LambdaQueryWrapper
<
NginxLog
>
wrapper
=
buildQueryWrapper
(
searchVo
);
List
<
String
>
idList
=
Common
.
getList
(
searchVo
.
getIds
());
if
(
Common
.
isNotNull
(
idList
)){
wrapper
.
in
(
NginxLog:
:
getId
,
idList
);
}
return
baseMapper
.
selectCount
(
wrapper
);
}
private
LambdaQueryWrapper
buildQueryWrapper
(
NginxLogSearchVo
entity
){
LambdaQueryWrapper
<
NginxLog
>
wrapper
=
Wrappers
.
lambdaQuery
();
if
(
ArrayUtil
.
isNotEmpty
(
entity
.
getCreateTimes
()))
{
wrapper
.
ge
(
NginxLog:
:
getCreateTime
,
entity
.
getCreateTimes
()[
0
])
.
le
(
NginxLog:
:
getCreateTime
,
entity
.
getCreateTimes
()[
1
]);
}
if
(
Common
.
isNotNull
(
entity
.
getCreateName
())){
wrapper
.
eq
(
NginxLog:
:
getCreateName
,
entity
.
getCreateName
());
}
return
wrapper
;
}
@Override
public
R
<
List
<
ErrorMessage
>>
importDiy
(
InputStream
inputStream
)
{
List
<
ErrorMessage
>
errorMessageList
=
new
ArrayList
<>();
ExcelUtil
<
NginxLogVo
>
util1
=
new
ExcelUtil
<>(
NginxLogVo
.
class
);;
// 写法2:
// 匿名内部类 不用额外写一个DemoDataListener
// 这里 需要指定读用哪个class去读,然后读取第一个sheet 文件流会自动关闭
try
{
EasyExcel
.
read
(
inputStream
,
NginxLogVo
.
class
,
new
ReadListener
<
NginxLogVo
>()
{
/**
* 单次缓存的数据量
*/
public
static
final
int
BATCH_COUNT
=
CommonConstants
.
BATCH_COUNT
;
/**
*临时存储
*/
private
List
<
NginxLogVo
>
cachedDataList
=
ListUtils
.
newArrayListWithExpectedSize
(
BATCH_COUNT
);
@Override
public
void
invoke
(
NginxLogVo
data
,
AnalysisContext
context
)
{
ReadRowHolder
readRowHolder
=
context
.
readRowHolder
();
Integer
rowIndex
=
readRowHolder
.
getRowIndex
();
data
.
setRowIndex
(
rowIndex
+
1
);
ErrorMessage
errorMessage
=
util1
.
checkEntity
(
data
,
data
.
getRowIndex
());
if
(
Common
.
isNotNull
(
errorMessage
)){
errorMessageList
.
add
(
errorMessage
);
}
else
{
cachedDataList
.
add
(
data
);
}
if
(
cachedDataList
.
size
()
>=
BATCH_COUNT
)
{
saveData
();
// 存储完成清理 list
cachedDataList
=
ListUtils
.
newArrayListWithExpectedSize
(
BATCH_COUNT
);
}
}
@Override
public
void
doAfterAllAnalysed
(
AnalysisContext
context
)
{
saveData
();
}
/**
* 加上存储数据库
*/
private
void
saveData
()
{
log
.
info
(
"{}条数据,开始存储数据库!"
,
cachedDataList
.
size
());
importNginxLog
(
cachedDataList
,
errorMessageList
);
log
.
info
(
"存储数据库成功!"
);
}
}).
sheet
().
doRead
();
}
catch
(
Exception
e
){
log
.
error
(
CommonConstants
.
IMPORT_DATA_ANALYSIS_ERROR
,
e
);
return
R
.
failed
(
CommonConstants
.
IMPORT_DATA_ANALYSIS_ERROR
);
}
return
R
.
ok
(
errorMessageList
);
}
private
void
importNginxLog
(
List
<
NginxLogVo
>
excelVOList
,
List
<
ErrorMessage
>
errorMessageList
)
{
// 个性化校验逻辑
ErrorMessage
errorMsg
;
// 执行数据插入操作 组装
for
(
int
i
=
0
;
i
<
excelVOList
.
size
();
i
++)
{
NginxLogVo
excel
=
excelVOList
.
get
(
i
);
// 数据合法情况 TODO
// 插入
insertExcel
(
excel
);
errorMessageList
.
add
(
new
ErrorMessage
(
excel
.
getRowIndex
(),
CommonConstants
.
SAVE_SUCCESS
));
}
}
/**
* 插入excel bad record
*/
private
void
insertExcel
(
NginxLogVo
excel
)
{
NginxLog
insert
=
new
NginxLog
();
BeanUtil
.
copyProperties
(
excel
,
insert
);
this
.
save
(
insert
);
}
@Async
@Override
public
void
readAndWriteLogAsys
(){
ScheduledExecutorService
executor
=
Executors
.
newSingleThreadScheduledExecutor
();
// 创建一个Runnable对象来表示需要执行的任务
Runnable
task
=
new
Runnable
()
{
@Override
public
void
run
()
{
// 添加自己想要执行的逻辑代码
log
.
info
(
"nginx-log read:"
+
DateUtil
.
getCurrentTimestamp
());
readAndWriteLog
();
}
};
// 调度任务并指定初始延迟为0秒,然后每隔1小时重复执行一次
executor
.
scheduleAtFixedRate
(
task
,
0
,
TimeUnit
.
HOURS
.
toMillis
(
1
),
TimeUnit
.
MILLISECONDS
);
// 等待程序结束前保持主线程运行状态
try
{
Thread
.
sleep
(
Long
.
MAX_VALUE
);
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
// 关闭executor服务
executor
.
shutdown
();
}
@Override
public
void
readAndWriteLog
()
{
FileInputStream
fis
=
null
;
BufferedReader
br
=
null
;
try
{
// 读取JSON日志文件
//fis = new FileInputStream("C:\\nginx.log");
fis
=
new
FileInputStream
(
"/app/logs/nginx-log-"
+
DateUtil
.
dateIncreaseByHour
(
new
Date
(),
0
,
DateUtil
.
DATETIME_PATTERN_HOUR
)+
".log"
);
br
=
new
BufferedReader
(
new
InputStreamReader
(
fis
));
String
line
;
while
((
line
=
br
.
readLine
())
!=
null
)
{
// 解析JSON数据
parseJson
(
line
);
}
br
.
close
();
}
catch
(
IOException
e
)
{
log
.
error
(
"读取nginx日志文件异常"
+
e
.
getMessage
());
}
finally
{
if
(
Common
.
isNotNull
(
br
)){
try
{
br
.
close
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
if
(
Common
.
isNotNull
(
fis
)){
try
{
fis
.
close
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
}
}
private
void
parseJson
(
String
json
)
{
// 解析JSON数据的代码
Gson
gson
=
new
Gson
();
NginxLog
logEntry
=
gson
.
fromJson
(
json
,
NginxLog
.
class
);
if
(
null
!=
logEntry
){
baseMapper
.
insert
(
logEntry
);
}
}
}
yifu-nginx-log/yifu-nginx-log-biz/src/main/java/com/yifu/cloud/plus/v1/nginx/util/NginxLogCommandLineRunner.java
0 → 100644
View file @
9e292f2b
package
com
.
yifu
.
cloud
.
plus
.
v1
.
nginx
.
util
;
import
com.yifu.cloud.plus.v1.nginx.service.NginxLogService
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.DateUtil
;
import
lombok.extern.log4j.Log4j2
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.CommandLineRunner
;
import
org.springframework.stereotype.Component
;
import
java.util.concurrent.Executors
;
import
java.util.concurrent.ScheduledExecutorService
;
import
java.util.concurrent.TimeUnit
;
/**
* @Author fxj
* @Date 2024/2/27
* @Description
* @Version 1.0
*/
@Log4j2
@Component
public
class
NginxLogCommandLineRunner
implements
CommandLineRunner
{
@Autowired
NginxLogService
nginxLogService
;
@Override
public
void
run
(
String
...
args
)
throws
Exception
{
nginxLogService
.
readAndWriteLogAsys
();
}
}
yifu-nginx-log/yifu-nginx-log-biz/src/main/resources/application-dev.yml
0 → 100644
View file @
9e292f2b
# 数据源配置
spring
:
mvc
:
pathmatch
:
matching-strategy
:
ant_path_matcher
config
:
activate
:
on-profile
:
dev
redis
:
host
:
127.0.0.1
password
:
'
@yf_2017'
datasource
:
type
:
com.zaxxer.hikari.HikariDataSource
driver-class-name
:
com.mysql.cj.jdbc.Driver
username
:
root
password
:
yf_zsk
url
:
jdbc:mysql://192.168.1.122:33306/yifu_nginx_log?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
## spring security 配置
security
:
oauth2
:
resource
:
loadBalanced
:
true
token-info-uri
:
http://127.0.0.1:3000/oauth/check_token
# 直接放行URL
ignore
:
urls
:
-
/v3/api-docs
-
/actuator/**
-
/swagger-ui/**
-
/checkBankNo/**
# 创蓝云智校验配置
canCheck
:
true
\ No newline at end of file
yifu-nginx-log/yifu-nginx-log-biz/src/main/resources/application-prd.yml
0 → 100644
View file @
9e292f2b
# 数据源配置
spring
:
mvc
:
pathmatch
:
matching-strategy
:
ant_path_matcher
config
:
activate
:
on-profile
:
prd
redis
:
host
:
192.168.0.153
password
:
'
@yf_2022'
port
:
22379
datasource
:
type
:
com.zaxxer.hikari.HikariDataSource
driver-class-name
:
com.mysql.cj.jdbc.Driver
username
:
root
password
:
yf_zsk
url
:
jdbc:mysql://192.168.0.222:22306/yifu_checks?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
## spring security 配置
security
:
oauth2
:
resource
:
loadBalanced
:
true
token-info-uri
:
http://127.0.0.1:3000/oauth/check_token
# 直接放行URL
ignore
:
urls
:
-
/v3/api-docs
-
/actuator/**
-
/swagger-ui/**
-
/checkBankNo/**
# 创蓝云智校验配置
canCheck
:
true
\ No newline at end of file
yifu-nginx-log/yifu-nginx-log-biz/src/main/resources/application-test.yml
0 → 100644
View file @
9e292f2b
# 数据源配置
spring
:
mvc
:
pathmatch
:
matching-strategy
:
ant_path_matcher
config
:
activate
:
on-profile
:
test
redis
:
host
:
192.168.1.65
port
:
22379
password
:
'
@yf_2017'
datasource
:
type
:
com.zaxxer.hikari.HikariDataSource
driver-class-name
:
com.mysql.cj.jdbc.Driver
username
:
root
password
:
ll_mysql
url
:
jdbc:mysql://192.168.1.122:33306/yifu_nginx_log?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
hikari
:
driver-class-name
:
${spring.datasource.driver-class-name}
jdbc-url
:
${spring.datasource.url}
username
:
${spring.datasource.username}
password
:
${spring.datasource.password}
pool-name
:
AmytangHikariCP
connection-timeout
:
600000
#最大超时时间
minimum-idle
:
10
# 最小空闲连接数量
validation-timeout
:
3000
#此属性控制测试连接是否活跃的最长时间。此值必须小于 connectionTimeout
idle-timeout
:
60000
# 空闲连接存活最大时间,默认600000(10分钟)此属性控制允许连接在池中处于空闲状态的最长时间
maximum-pool-size
:
20
# 连接池最大连接数,默认是10
auto-commit
:
true
#此属性控制从池返回的连接的默认自动提交行为,默认值:true
max-lifetime
:
1800000
#此属性控制池中连接的最长生命周期,值0表示无限生命周期,默认1800000即30分钟
## spring security 配置
security
:
oauth2
:
resource
:
loadBalanced
:
true
token-info-uri
:
http://127.0.0.1:3000/oauth/check_token
# 直接放行URL
ignore
:
urls
:
-
/v3/api-docs
-
/actuator/**
-
/swagger-ui/**
\ No newline at end of file
yifu-nginx-log/yifu-nginx-log-biz/src/main/resources/application.yml
0 → 100644
View file @
9e292f2b
server
:
port
:
5066
# 加解密根密码
jasypt
:
encryptor
:
password
:
yifu
#根密码
# 暴露监控端点
management
:
endpoints
:
web
:
exposure
:
include
:
"
*"
endpoint
:
health
:
show-details
:
ALWAYS
# mybaits-plus配置
mybatis-plus
:
mapper-locations
:
classpath:/mapper/*Mapper.xml
global-config
:
banner
:
false
db-config
:
id-type
:
auto
table-underline
:
true
logic-delete-value
:
1
logic-not-delete-value
:
0
configuration
:
map-underscore-to-camel-case
:
true
spring
:
application
:
name
:
@
artifactId@
#swagger 文档 https://springdoc.org/
### OpenAPI3 注解
# OpenAPI 3 注解位置
# @Tag(name = “接口类描述”) Controller 类上
# @Operation(summary =“接口方法描述”) Controller 方法上
# @Parameters Controller 方法上
# @Parameter(description=“参数描述”) Controller 方法上 @Parameters 里
# @Parameter(description=“参数描述”) Controller 方法的参数上
# @Parameter(hidden = true) 或 @Hidden --
# @Schema DTO类上
# @Schema DTO属性上
springdoc
:
api-docs
:
#是否开启文档功能
enabled
:
true
#swagger后端请求地址
path
:
/api-docs
swagger-ui
:
#自定义swagger前端请求路径,输入http:127.0.0.1:8080/test会自动重定向到swagger页面
path
:
/api
#包扫描路径
packages-to-scan
:
com.yifu.cloud.plus.v1.nginx.controller
#这里定义了两个分组,可定义多个,也可以不定义
group-configs
:
#分组名
#- group: admin
#按路径匹配
# pathsToMatch: /admin/**
#分组名
-
group
:
nginx-log
#按包路径匹配
packagesToScan
:
com.yifu.cloud.plus.v1.nginx.controller
\ No newline at end of file
yifu-nginx-log/yifu-nginx-log-biz/src/main/resources/logback-spring.xml
0 → 100644
View file @
9e292f2b
<?xml version="1.0" encoding="UTF-8"?>
<configuration
debug=
"false"
scan=
"false"
>
<springProperty
scop=
"context"
name=
"spring.application.name"
source=
"spring.application.name"
defaultValue=
""
/>
<property
name=
"log.path"
value=
"logs/${spring.application.name}"
/>
<!-- 彩色日志格式 -->
<property
name=
"CONSOLE_LOG_PATTERN"
value=
"${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"
/>
<!-- 彩色日志依赖的渲染类 -->
<conversionRule
conversionWord=
"clr"
converterClass=
"org.springframework.boot.logging.logback.ColorConverter"
/>
<conversionRule
conversionWord=
"wex"
converterClass=
"org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter"
/>
<conversionRule
conversionWord=
"wEx"
converterClass=
"org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter"
/>
<!-- Console log output -->
<appender
name=
"console"
class=
"ch.qos.logback.core.ConsoleAppender"
>
<encoder>
<pattern>
${CONSOLE_LOG_PATTERN}
</pattern>
</encoder>
</appender>
<!-- Log file debug output -->
<appender
name=
"debug"
class=
"ch.qos.logback.core.rolling.RollingFileAppender"
>
<file>
${log.path}/debug.log
</file>
<rollingPolicy
class=
"ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"
>
<fileNamePattern>
${log.path}/%d{yyyy-MM, aux}/debug.%d{yyyy-MM-dd}.%i.log.gz
</fileNamePattern>
<maxFileSize>
50MB
</maxFileSize>
<maxHistory>
30
</maxHistory>
</rollingPolicy>
<encoder>
<pattern>
%date [%thread] %-5level [%logger{50}] %file:%line - %msg%n
</pattern>
</encoder>
</appender>
<!-- Log file error output -->
<appender
name=
"error"
class=
"ch.qos.logback.core.rolling.RollingFileAppender"
>
<file>
${log.path}/error.log
</file>
<rollingPolicy
class=
"ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"
>
<fileNamePattern>
${log.path}/%d{yyyy-MM}/error.%d{yyyy-MM-dd}.%i.log.gz
</fileNamePattern>
<maxFileSize>
50MB
</maxFileSize>
<maxHistory>
30
</maxHistory>
</rollingPolicy>
<encoder>
<pattern>
%date [%thread] %-5level [%logger{50}] %file:%line - %msg%n
</pattern>
</encoder>
<filter
class=
"ch.qos.logback.classic.filter.ThresholdFilter"
>
<level>
ERROR
</level>
</filter>
</appender>
<!--nacos 心跳 INFO 屏蔽-->
<logger
name=
"com.alibaba.nacos"
level=
"OFF"
>
<appender-ref
ref=
"error"
/>
</logger>
<!-- Level: FATAL 0 ERROR 3 WARN 4 INFO 6 DEBUG 7 -->
<root
level=
"INFO"
>
<appender-ref
ref=
"console"
/>
<appender-ref
ref=
"debug"
/>
<appender-ref
ref=
"error"
/>
</root>
</configuration>
yifu-nginx-log/yifu-nginx-log-biz/src/main/resources/mapper/NginxLogMapper.xml
0 → 100644
View file @
9e292f2b
<?xml version="1.0" encoding="UTF-8"?>
<!--
~
~ Copyright (c) 2018-2025, lengleng All rights reserved.
~
~ Redistribution and use in source and binary forms, with or without
~ modification, are permitted provided that the following conditions are met:
~
~ Redistributions of source code must retain the above copyright notice,
~ this list of conditions and the following disclaimer.
~ Redistributions in binary form must reproduce the above copyright
~ notice, this list of conditions and the following disclaimer in the
~ documentation and/or other materials provided with the distribution.
~ Neither the name of the yifu4cloud.com developer nor the names of its
~ contributors may be used to endorse or promote products derived from
~ this software without specific prior written permission.
~ Author: lengleng (wangiegie@gmail.com)
~
-->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.yifu.cloud.plus.v1.nginx.mapper.NginxLogMapper"
>
<resultMap
id=
"nginxLogMap"
type=
"com.yifu.cloud.plus.v1.nginx.entity.NginxLog"
>
<id
property=
"id"
column=
"id"
/>
<result
property=
"timestamp"
column=
"timestamp"
/>
<result
property=
"remoteAdr"
column=
"remote_adr"
/>
<result
property=
"request"
column=
"request"
/>
<result
property=
"status"
column=
"status"
/>
<result
property=
"bytes"
column=
"bytes"
/>
<result
property=
"agent"
column=
"agent"
/>
<result
property=
"forwarded"
column=
"forwarded"
/>
<result
property=
"upAddr"
column=
"up_addr"
/>
<result
property=
"upHost"
column=
"up_host"
/>
<result
property=
"upRespTime"
column=
"up_resp_time"
/>
<result
property=
"requestTime"
column=
"request_time"
/>
<result
property=
"args"
column=
"args"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
a.id,
a.timestamp,
a.remote_adr,
a.request,
a.status,
a.bytes,
a.agent,
a.forwarded,
a.up_addr,
a.up_host,
a.up_resp_time,
a.request_time,
a.args
</sql>
<sql
id=
"nginxLog_where"
>
<if
test=
"nginxLog != null"
>
<if
test=
"nginxLog.id != null and nginxLog.id.trim() != ''"
>
AND a.id = #{nginxLog.id}
</if>
<if
test=
"nginxLog.timestamp != null and nginxLog.timestamp.trim() != ''"
>
AND a.timestamp = #{nginxLog.timestamp}
</if>
<if
test=
"nginxLog.remoteAdr != null and nginxLog.remoteAdr.trim() != ''"
>
AND a.remote_adr = #{nginxLog.remoteAdr}
</if>
<if
test=
"nginxLog.request != null and nginxLog.request.trim() != ''"
>
AND a.request = #{nginxLog.request}
</if>
<if
test=
"nginxLog.status != null and nginxLog.status.trim() != ''"
>
AND a.status = #{nginxLog.status}
</if>
<if
test=
"nginxLog.bytes != null and nginxLog.bytes.trim() != ''"
>
AND a.bytes = #{nginxLog.bytes}
</if>
<if
test=
"nginxLog.agent != null and nginxLog.agent.trim() != ''"
>
AND a.agent = #{nginxLog.agent}
</if>
<if
test=
"nginxLog.forwarded != null and nginxLog.forwarded.trim() != ''"
>
AND a.forwarded = #{nginxLog.forwarded}
</if>
<if
test=
"nginxLog.upAddr != null and nginxLog.upAddr.trim() != ''"
>
AND a.up_addr = #{nginxLog.upAddr}
</if>
<if
test=
"nginxLog.upHost != null and nginxLog.upHost.trim() != ''"
>
AND a.up_host = #{nginxLog.upHost}
</if>
<if
test=
"nginxLog.upRespTime != null"
>
AND a.up_resp_time = #{nginxLog.upRespTime}
</if>
<if
test=
"nginxLog.requestTime != null"
>
AND a.request_time = #{nginxLog.requestTime}
</if>
<if
test=
"nginxLog.args != null and nginxLog.args.trim() != ''"
>
AND a.args = #{nginxLog.args}
</if>
</if>
</sql>
<!--nginxLog简单分页查询-->
<select
id=
"getNginxLogPage"
resultMap=
"nginxLogMap"
>
SELECT
<include
refid=
"Base_Column_List"
/>
FROM nginx_log a
<where>
1=1
<include
refid=
"nginxLog_where"
/>
</where>
</select>
</mapper>
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