Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation
This project
Loading...
Sign in
谢明辉
/
fanxing3
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit e4e2862d
authored
Mar 11, 2022
by
xmh
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
<feat> 数据采集功能模块基础建设
1 parent
44f0e791
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
773 additions
and
1 deletions
fanxing-collect/pom.xml
fanxing-collect/src/main/java/com/viontech/fanxing/collect/CollectApp.java
fanxing-collect/src/main/java/com/viontech/fanxing/collect/config/ListTypeHandler.java
fanxing-collect/src/main/java/com/viontech/fanxing/collect/config/MybatisPlusConfig.java
fanxing-collect/src/main/java/com/viontech/fanxing/collect/controller/CollectionResultController.java
fanxing-collect/src/main/java/com/viontech/fanxing/collect/controller/CollectionTaskController.java
fanxing-collect/src/main/java/com/viontech/fanxing/collect/mapper/CollectionResultMapper.java
fanxing-collect/src/main/java/com/viontech/fanxing/collect/mapper/CollectionTaskMapper.java
fanxing-collect/src/main/java/com/viontech/fanxing/collect/model/CollectionResult.java
fanxing-collect/src/main/java/com/viontech/fanxing/collect/model/CollectionTask.java
fanxing-collect/src/main/java/com/viontech/fanxing/collect/service/CollectionResultService.java
fanxing-collect/src/main/java/com/viontech/fanxing/collect/service/CollectionTaskService.java
fanxing-collect/src/main/java/com/viontech/fanxing/collect/vo/CollectionResultVo.java
fanxing-collect/src/main/java/com/viontech/fanxing/collect/vo/CollectionTaskVo.java
fanxing-collect/src/main/resources/application.properties
fanxing-collect/src/main/resources/application.yml
fanxing-collect/src/main/resources/bootstrap.yml
fanxing-collect/src/main/resources/logback-dev.xml
fanxing-collect/src/main/resources/logback-pro.xml
fanxing-gateway/src/main/java/com/viontech/fanxing/forward/VerifyGatewayFilter.java
fanxing-ops/src/main/resources/db/V1.03__fanxing-collect.sql
pom.xml
fanxing-collect/pom.xml
0 → 100644
View file @
e4e2862
<?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.viontech
</groupId>
<artifactId>
fanxing3
</artifactId>
<version>
3.0.1-SNAPSHOT
</version>
</parent>
<artifactId>
fanxing-collect
</artifactId>
<version>
3.0.1-SNAPSHOT
</version>
<dependencies>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-web
</artifactId>
</dependency>
<dependency>
<groupId>
com.viontech
</groupId>
<artifactId>
fanxing-commons
</artifactId>
<version>
${parent.version}
</version>
<exclusions>
<exclusion>
<groupId>
org.mybatis.spring.boot
</groupId>
<artifactId>
mybatis-spring-boot-starter
</artifactId>
</exclusion>
<exclusion>
<groupId>
com.github.pagehelper
</groupId>
<artifactId>
pagehelper-spring-boot-starter
</artifactId>
</exclusion>
<exclusion>
<groupId>
org.mybatis
</groupId>
<artifactId>
mybatis
</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-starter-consul-discovery
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-starter-consul-config
</artifactId>
</dependency>
<dependency>
<groupId>
com.baomidou
</groupId>
<artifactId>
mybatis-plus-boot-starter
</artifactId>
<version>
3.5.1
</version>
</dependency>
</dependencies>
<build>
<finalName>
fanxing-collect
</finalName>
<plugins>
<plugin>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
</plugin>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-jar-plugin
</artifactId>
<configuration>
<excludes>
<exclude>
*.yml
</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</project>
\ No newline at end of file
\ No newline at end of file
fanxing-collect/src/main/java/com/viontech/fanxing/collect/CollectApp.java
0 → 100644
View file @
e4e2862
package
com
.
viontech
.
fanxing
.
collect
;
import
org.mybatis.spring.annotation.MapperScan
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.cloud.client.discovery.EnableDiscoveryClient
;
import
org.springframework.cloud.openfeign.EnableFeignClients
;
import
org.springframework.scheduling.annotation.EnableScheduling
;
/**
* .
*
* @author 谢明辉
* @date 2022/3/9
*/
@SpringBootApplication
(
scanBasePackages
=
"com.viontech.fanxing"
)
@EnableFeignClients
(
basePackages
=
"com.viontech.fanxing"
)
@EnableScheduling
@EnableDiscoveryClient
@MapperScan
(
"com.viontech.fanxing.collect.mapper"
)
public
class
CollectApp
{
public
static
void
main
(
String
[]
args
)
{
SpringApplication
.
run
(
CollectApp
.
class
,
args
);
}
}
fanxing-collect/src/main/java/com/viontech/fanxing/collect/config/ListTypeHandler.java
0 → 100644
View file @
e4e2862
package
com
.
viontech
.
fanxing
.
collect
.
config
;
import
cn.hutool.json.JSONUtil
;
import
com.baomidou.mybatisplus.extension.handlers.AbstractJsonTypeHandler
;
import
java.util.List
;
/**
* .
*
* @author 谢明辉
* @date 2022/3/9
*/
public
class
ListTypeHandler
extends
AbstractJsonTypeHandler
<
List
<?>>
{
@Override
protected
List
<?>
parse
(
String
json
)
{
return
JSONUtil
.
parseArray
(
json
);
}
@Override
protected
String
toJson
(
List
<?>
obj
)
{
return
JSONUtil
.
parseArray
(
obj
).
toString
();
}
}
fanxing-collect/src/main/java/com/viontech/fanxing/collect/config/MybatisPlusConfig.java
0 → 100644
View file @
e4e2862
package
com
.
viontech
.
fanxing
.
collect
.
config
;
import
com.baomidou.mybatisplus.annotation.DbType
;
import
com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor
;
import
com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
/**
* .
*
* @author 谢明辉
* @date 2022/3/9
*/
@Configuration
public
class
MybatisPlusConfig
{
@Bean
public
MybatisPlusInterceptor
mybatisPlusInterceptor
()
{
MybatisPlusInterceptor
interceptor
=
new
MybatisPlusInterceptor
();
interceptor
.
addInnerInterceptor
(
new
PaginationInnerInterceptor
(
DbType
.
MYSQL
));
return
interceptor
;
}
}
fanxing-collect/src/main/java/com/viontech/fanxing/collect/controller/CollectionResultController.java
0 → 100644
View file @
e4e2862
package
com
.
viontech
.
fanxing
.
collect
.
controller
;
import
com.viontech.fanxing.collect.service.CollectionResultService
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.annotation.Resource
;
/**
* .
*
* @author 谢明辉
* @date 2022/3/9
*/
@RestController
@RequestMapping
(
"/collectionResult"
)
public
class
CollectionResultController
{
@Resource
private
CollectionResultService
collectionResultService
;
}
fanxing-collect/src/main/java/com/viontech/fanxing/collect/controller/CollectionTaskController.java
0 → 100644
View file @
e4e2862
package
com
.
viontech
.
fanxing
.
collect
.
controller
;
import
com.baomidou.mybatisplus.core.metadata.OrderItem
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.viontech.fanxing.collect.model.CollectionTask
;
import
com.viontech.fanxing.collect.service.CollectionTaskService
;
import
com.viontech.fanxing.collect.vo.CollectionTaskVo
;
import
com.viontech.keliu.util.JsonMessageUtil
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.annotation.Resource
;
import
java.io.IOException
;
/**
* .
*
* @author 谢明辉
* @date 2022/3/9
*/
@RestController
@RequestMapping
(
"/collectionTask"
)
public
class
CollectionTaskController
{
@Resource
private
CollectionTaskService
collectionTaskService
;
@GetMapping
public
JsonMessageUtil
.
JsonMessage
page
(
CollectionTaskVo
vo
)
{
Page
<
CollectionTask
>
page
=
collectionTaskService
.
lambdaQuery
()
.
page
(
Page
.<
CollectionTask
>
of
(
vo
.
getPage
(),
vo
.
getPageSize
()).
addOrder
(
OrderItem
.
desc
(
"create_time"
)));
return
JsonMessageUtil
.
getSuccessJsonMsg
(
page
);
}
@PostMapping
public
JsonMessageUtil
.
JsonMessage
add
(
CollectionTaskVo
vo
)
throws
IOException
{
if
(
vo
.
getFile
()
!=
null
)
{
vo
.
setConfigFile
(
vo
.
getFile
().
getBytes
());
}
collectionTaskService
.
save
(
vo
);
return
JsonMessageUtil
.
getSuccessJsonMsg
(
vo
);
}
}
fanxing-collect/src/main/java/com/viontech/fanxing/collect/mapper/CollectionResultMapper.java
0 → 100644
View file @
e4e2862
package
com
.
viontech
.
fanxing
.
collect
.
mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.viontech.fanxing.collect.model.CollectionResult
;
/**
* .
*
* @author 谢明辉
* @date 2022/3/9
*/
public
interface
CollectionResultMapper
extends
BaseMapper
<
CollectionResult
>
{
}
fanxing-collect/src/main/java/com/viontech/fanxing/collect/mapper/CollectionTaskMapper.java
0 → 100644
View file @
e4e2862
package
com
.
viontech
.
fanxing
.
collect
.
mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.viontech.fanxing.collect.model.CollectionTask
;
/**
* .
*
* @author 谢明辉
* @date 2022/3/9
*/
public
interface
CollectionTaskMapper
extends
BaseMapper
<
CollectionTask
>
{
}
fanxing-collect/src/main/java/com/viontech/fanxing/collect/model/CollectionResult.java
0 → 100644
View file @
e4e2862
package
com
.
viontech
.
fanxing
.
collect
.
model
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
lombok.Getter
;
import
lombok.Setter
;
import
lombok.experimental.Accessors
;
import
java.util.Date
;
/**
* .
*
* @author 谢明辉
* @date 2022/3/9
*/
@Getter
@Setter
@Accessors
(
chain
=
true
)
@TableName
(
"d_collection_result"
)
public
class
CollectionResult
{
@TableId
(
type
=
IdType
.
AUTO
)
private
Long
id
;
private
String
recordId
;
private
Long
collectionTaskId
;
private
String
collectionTaskName
;
private
Long
taskId
;
private
String
taskName
;
private
Date
collectTime
;
private
String
dataType
;
private
Integer
objectType
;
private
Integer
score
;
private
String
fileName
;
private
String
filePath
;
private
String
expandInfo
;
}
fanxing-collect/src/main/java/com/viontech/fanxing/collect/model/CollectionTask.java
0 → 100644
View file @
e4e2862
package
com
.
viontech
.
fanxing
.
collect
.
model
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.viontech.fanxing.collect.config.ListTypeHandler
;
import
lombok.Getter
;
import
lombok.Setter
;
import
lombok.experimental.Accessors
;
import
org.apache.ibatis.type.JdbcType
;
import
java.util.Date
;
import
java.util.List
;
/**
* .
*
* @author 谢明辉
* @date 2022/3/9
*/
@Getter
@Setter
@Accessors
(
chain
=
true
)
@TableName
(
value
=
"s_collection_task"
,
autoResultMap
=
true
)
public
class
CollectionTask
{
@TableId
(
type
=
IdType
.
AUTO
)
private
Long
id
;
private
String
unid
;
private
String
name
;
private
String
dataType
;
private
String
collectType
;
private
Date
startTime
;
private
Date
endTime
;
@TableField
(
jdbcType
=
JdbcType
.
VARCHAR
,
typeHandler
=
ListTypeHandler
.
class
)
private
List
<
Long
>
tasks
;
private
Integer
collectInterval
;
private
Integer
videoLength
;
@JsonIgnore
private
byte
[]
configFile
;
private
Date
createTime
;
private
Integer
status
;
}
fanxing-collect/src/main/java/com/viontech/fanxing/collect/service/CollectionResultService.java
0 → 100644
View file @
e4e2862
package
com
.
viontech
.
fanxing
.
collect
.
service
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.viontech.fanxing.collect.mapper.CollectionResultMapper
;
import
com.viontech.fanxing.collect.model.CollectionResult
;
import
org.springframework.stereotype.Service
;
/**
* .
*
* @author 谢明辉
* @date 2022/3/9
*/
@Service
public
class
CollectionResultService
extends
ServiceImpl
<
CollectionResultMapper
,
CollectionResult
>
implements
IService
<
CollectionResult
>
{
}
fanxing-collect/src/main/java/com/viontech/fanxing/collect/service/CollectionTaskService.java
0 → 100644
View file @
e4e2862
package
com
.
viontech
.
fanxing
.
collect
.
service
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.viontech.fanxing.collect.mapper.CollectionTaskMapper
;
import
com.viontech.fanxing.collect.model.CollectionTask
;
import
org.springframework.stereotype.Service
;
/**
* .
*
* @author 谢明辉
* @date 2022/3/9
*/
@Service
public
class
CollectionTaskService
extends
ServiceImpl
<
CollectionTaskMapper
,
CollectionTask
>
implements
IService
<
CollectionTask
>
{
}
fanxing-collect/src/main/java/com/viontech/fanxing/collect/vo/CollectionResultVo.java
0 → 100644
View file @
e4e2862
package
com
.
viontech
.
fanxing
.
collect
.
vo
;
import
com.viontech.fanxing.collect.model.CollectionResult
;
import
lombok.Getter
;
import
lombok.Setter
;
/**
* .
*
* @author 谢明辉
* @date 2022/3/9
*/
@Getter
@Setter
public
class
CollectionResultVo
extends
CollectionResult
{
}
fanxing-collect/src/main/java/com/viontech/fanxing/collect/vo/CollectionTaskVo.java
0 → 100644
View file @
e4e2862
package
com
.
viontech
.
fanxing
.
collect
.
vo
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.viontech.fanxing.collect.model.CollectionTask
;
import
lombok.Getter
;
import
lombok.Setter
;
import
org.springframework.web.multipart.MultipartFile
;
/**
* .
*
* @author 谢明辉
* @date 2022/3/9
*/
@Getter
@Setter
public
class
CollectionTaskVo
extends
CollectionTask
{
private
Long
page
;
private
Long
pageSize
;
@JsonIgnore
private
MultipartFile
file
;
}
fanxing-collect/src/main/resources/application.properties
0 → 100644
View file @
e4e2862
spring.cloud.consul.discovery.metadata.version
=
3.0-SNAPSHOT
\ No newline at end of file
\ No newline at end of file
fanxing-collect/src/main/resources/application.yml
0 → 100644
View file @
e4e2862
spring
:
servlet
:
multipart
:
max-file-size
:
500MB
max-request-size
:
512MB
cloud
:
loadbalancer
:
ribbon
:
enabled
:
false
consul
:
# 服务发现配置
discovery
:
# 启用服务发现
enabled
:
true
# 启用服务注册
register
:
true
# 服务停止时取消注册
deregister
:
true
# 表示注册时使用IP而不是hostname
prefer-ip-address
:
true
# 执行监控检查的频率
health-check-interval
:
10s
# 设置健康检查失败多长时间后,取消注册
health-check-critical-timeout
:
30s
# 健康检查的路径
health-check-path
:
/actuator/info
# 服务注册标识,格式为:应用名称:服务器IP:端口
instance-id
:
${spring.application.name}:${spring.cloud.consul.discovery.ip-address}:${server.port}
ip-address
:
192.168.9.146
datasource
:
driver-class-name
:
com.mysql.cj.jdbc.Driver
url
:
jdbc:mysql://192.168.9.233:3306/fanxing3
username
:
root
password
:
123456
redis
:
host
:
192.168.9.233
port
:
6379
password
:
3c61f2e4c4d1877ef9d01319c3a0fccaeabb1518
database
:
15
jackson
:
date-format
:
yyyy-MM-dd HH:mm:ss
time-zone
:
GMT+8
default-property-inclusion
:
non_null
task
:
scheduling
:
pool
:
size
:
10
codec
:
max-in-memory-size
:
-1
logging
:
config
:
classpath:logback-${spring.profiles.active}.xml
vion
:
redisson
:
path
:
F:\myIDEAworkspace\jt\fanxing3\fanxing-commons\src\main\resources\redisson.yml
\ No newline at end of file
\ No newline at end of file
fanxing-collect/src/main/resources/bootstrap.yml
0 → 100644
View file @
e4e2862
server
:
port
:
30006
spring
:
profiles
:
active
:
${PROFILE}
application
:
name
:
fanxing-collect
cloud
:
consul
:
host
:
192.168.9.233
port
:
8500
discovery
:
service-name
:
${spring.application.name}
# config 在 consul > key/value 中命名规则: prefix/default-context,profiles.active/data-key
config
:
enabled
:
true
format
:
YAML
prefix
:
fanxing
default-context
:
${spring.application.name}
data-key
:
config
watch
:
enabled
:
true
delay
:
10000
wait-time
:
30
fanxing-collect/src/main/resources/logback-dev.xml
0 → 100644
View file @
e4e2862
<?xml version="1.0" encoding="UTF-8"?>
<configuration
scan=
"true"
scanPeriod=
"10 seconds"
>
<contextName>
logback
</contextName>
<property
name=
"log.path"
value=
"logs"
/>
<property
name=
"pattern"
value=
"[%d{yyyy-MM-dd HH:mm:ss.SSS}] [%-5level] [%thread] %logger{50} - %msg%n"
/>
<appender
name=
"CONSOLE"
class=
"ch.qos.logback.core.ConsoleAppender"
>
<filter
class=
"ch.qos.logback.classic.filter.ThresholdFilter"
>
<level>
debug
</level>
</filter>
<encoder>
<Pattern>
${pattern}
</Pattern>
</encoder>
</appender>
<logger
name=
"com.viontech"
level=
"debug"
additivity=
"false"
>
<appender-ref
ref=
"CONSOLE"
/>
</logger>
<logger
name=
"com.viontech.fanxing.task.mapper"
level=
"off"
>
</logger>
<root
level=
"info"
>
<appender-ref
ref=
"CONSOLE"
/>
</root>
</configuration>
\ No newline at end of file
\ No newline at end of file
fanxing-collect/src/main/resources/logback-pro.xml
0 → 100644
View file @
e4e2862
<?xml version="1.0" encoding="UTF-8"?>
<!-- 日志级别从低到高分为TRACE < DEBUG < INFO < WARN < ERROR < FATAL,如果设置为WARN,则低于WARN的信息都不会输出 -->
<!-- scan:当此属性设置为true时,配置文件如果发生改变,将会被重新加载,默认值为true -->
<!-- scanPeriod:设置监测配置文件是否有修改的时间间隔,如果没有给出时间单位,默认单位是毫秒。当scan为true时,此属性生效。默认的时间间隔为1分钟。 -->
<!-- debug:当此属性设置为true时,将打印出logback内部日志信息,实时查看logback运行状态。默认值为false。 -->
<configuration
scan=
"true"
scanPeriod=
"10 seconds"
>
<!--<include resource="org/springframework/boot/logging/logback/base.xml" />-->
<contextName>
logback
</contextName>
<!-- name的值是变量的名称,value的值时变量定义的值。通过定义的值会被插入到logger上下文中。定义变量后,可以使“${}”来使用变量。 -->
<property
name=
"log.path"
value=
"logs"
/>
<property
name=
"pattern"
value=
"[%d{yyyy-MM-dd HH:mm:ss.SSS}] [%-5level] [%thread] %logger{50} - %msg%n"
/>
<!--输出到控制台-->
<appender
name=
"CONSOLE"
class=
"ch.qos.logback.core.ConsoleAppender"
>
<!--此日志appender是为开发使用,只配置最底级别,控制台输出的日志级别是大于或等于此级别的日志信息-->
<filter
class=
"ch.qos.logback.classic.filter.ThresholdFilter"
>
<level>
info
</level>
</filter>
<encoder>
<Pattern>
${pattern}
</Pattern>
<!-- 设置字符集 -->
</encoder>
</appender>
<!--输出到文件-->
<!-- 时间滚动输出 level为 DEBUG 日志 -->
<appender
name=
"DEBUG_FILE"
class=
"ch.qos.logback.core.rolling.RollingFileAppender"
>
<!-- 正在记录的日志文件的路径及文件名 -->
<file>
${log.path}/log_debug.log
</file>
<!--日志文件输出格式-->
<encoder>
<Pattern>
${pattern}
</Pattern>
<charset>
UTF-8
</charset>
<!-- 设置字符集 -->
</encoder>
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
<rollingPolicy
class=
"ch.qos.logback.core.rolling.TimeBasedRollingPolicy"
>
<!-- 日志归档 -->
<fileNamePattern>
${log.path}/debug/log-debug-%d{yyyy-MM-dd}.%i.log.gz
</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy
class=
"ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"
>
<maxFileSize>
100MB
</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<!--日志文件保留天数-->
<maxHistory>
15
</maxHistory>
</rollingPolicy>
<!-- 此日志文件只记录debug级别的 -->
<filter
class=
"ch.qos.logback.classic.filter.LevelFilter"
>
<level>
debug
</level>
<onMatch>
ACCEPT
</onMatch>
<onMismatch>
DENY
</onMismatch>
</filter>
</appender>
<!-- 时间滚动输出 level为 INFO 日志 -->
<appender
name=
"INFO_FILE"
class=
"ch.qos.logback.core.rolling.RollingFileAppender"
>
<!-- 正在记录的日志文件的路径及文件名 -->
<file>
${log.path}/log_info.log
</file>
<!--日志文件输出格式-->
<encoder>
<Pattern>
${pattern}
</Pattern>
<charset>
UTF-8
</charset>
</encoder>
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
<rollingPolicy
class=
"ch.qos.logback.core.rolling.TimeBasedRollingPolicy"
>
<!-- 每天日志归档路径以及格式 -->
<fileNamePattern>
${log.path}/info/log-info-%d{yyyy-MM-dd}.%i.log.gz
</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy
class=
"ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"
>
<maxFileSize>
100MB
</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<!--日志文件保留天数-->
<maxHistory>
15
</maxHistory>
</rollingPolicy>
<!-- 此日志文件只记录info级别的 -->
<filter
class=
"ch.qos.logback.classic.filter.LevelFilter"
>
<level>
info
</level>
<onMatch>
ACCEPT
</onMatch>
<onMismatch>
NEUTRAL
</onMismatch>
</filter>
<filter
class=
"ch.qos.logback.classic.filter.LevelFilter"
>
<level>
warn
</level>
<onMatch>
ACCEPT
</onMatch>
<onMismatch>
DENY
</onMismatch>
</filter>
</appender>
<!-- 时间滚动输出 level为 WARN 日志 -->
<appender
name=
"WARN_FILE"
class=
"ch.qos.logback.core.rolling.RollingFileAppender"
>
<!-- 正在记录的日志文件的路径及文件名 -->
<file>
${log.path}/log_warn.log
</file>
<!--日志文件输出格式-->
<encoder>
<Pattern>
${pattern}
</Pattern>
<charset>
UTF-8
</charset>
<!-- 此处设置字符集 -->
</encoder>
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
<rollingPolicy
class=
"ch.qos.logback.core.rolling.TimeBasedRollingPolicy"
>
<fileNamePattern>
${log.path}/warn/log-warn-%d{yyyy-MM-dd}.%i.log.gz
</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy
class=
"ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"
>
<maxFileSize>
100MB
</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<!--日志文件保留天数-->
<maxHistory>
5
</maxHistory>
</rollingPolicy>
<!-- 此日志文件只记录warn级别的 -->
<filter
class=
"ch.qos.logback.classic.filter.LevelFilter"
>
<level>
warn
</level>
<onMatch>
ACCEPT
</onMatch>
<onMismatch>
DENY
</onMismatch>
</filter>
</appender>
<!-- 时间滚动输出 level为 ERROR 日志 -->
<appender
name=
"ERROR_FILE"
class=
"ch.qos.logback.core.rolling.RollingFileAppender"
>
<!-- 正在记录的日志文件的路径及文件名 -->
<file>
${log.path}/log_error.log
</file>
<!--日志文件输出格式-->
<encoder>
<Pattern>
${pattern}
</Pattern>
<charset>
UTF-8
</charset>
<!-- 此处设置字符集 -->
</encoder>
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
<rollingPolicy
class=
"ch.qos.logback.core.rolling.TimeBasedRollingPolicy"
>
<fileNamePattern>
${log.path}/error/log-error-%d{yyyy-MM-dd}.%i.log.gz
</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy
class=
"ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"
>
<maxFileSize>
100MB
</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<!--日志文件保留天数-->
<maxHistory>
15
</maxHistory>
</rollingPolicy>
<!-- 此日志文件只记录ERROR级别的 -->
<filter
class=
"ch.qos.logback.classic.filter.LevelFilter"
>
<level>
ERROR
</level>
<onMatch>
ACCEPT
</onMatch>
<onMismatch>
DENY
</onMismatch>
</filter>
</appender>
<logger
name=
"com.viontech"
level=
"debug"
>
<appender-ref
ref=
"DEBUG_FILE"
/>
</logger>
<root
level=
"info"
>
<appender-ref
ref=
"CONSOLE"
/>
<appender-ref
ref=
"INFO_FILE"
/>
<appender-ref
ref=
"WARN_FILE"
/>
<appender-ref
ref=
"ERROR_FILE"
/>
</root>
</configuration>
\ No newline at end of file
\ No newline at end of file
fanxing-gateway/src/main/java/com/viontech/fanxing/forward/VerifyGatewayFilter.java
0 → 100644
View file @
e4e2862
package
com
.
viontech
.
fanxing
.
forward
;
import
lombok.extern.slf4j.Slf4j
;
import
org.bouncycastle.util.Strings
;
import
org.springframework.cloud.gateway.filter.GatewayFilterChain
;
import
org.springframework.cloud.gateway.filter.GlobalFilter
;
import
org.springframework.core.Ordered
;
import
org.springframework.core.io.buffer.DataBuffer
;
import
org.springframework.core.io.buffer.DataBufferUtils
;
import
org.springframework.http.HttpMethod
;
import
org.springframework.http.server.reactive.ServerHttpRequest
;
import
org.springframework.web.server.ServerWebExchange
;
import
reactor.core.publisher.Flux
;
import
reactor.core.publisher.Mono
;
import
java.util.concurrent.atomic.AtomicReference
;
//@Component
@Slf4j
public
class
VerifyGatewayFilter
implements
GlobalFilter
,
Ordered
{
public
static
final
String
CACHE_REQUEST_BODY_OBJECT_KEY
=
"cachedRequestBodyObject"
;
@Override
public
Mono
<
Void
>
filter
(
ServerWebExchange
exchange
,
GatewayFilterChain
chain
)
{
ServerHttpRequest
request
=
exchange
.
getRequest
();
if
(
request
.
getMethod
()
==
HttpMethod
.
POST
)
{
Flux
<
DataBuffer
>
cachedBody
=
exchange
.
getAttribute
(
CACHE_REQUEST_BODY_OBJECT_KEY
);
String
raw
=
toRaw
(
cachedBody
);
log
.
info
(
raw
);
}
return
chain
.
filter
(
exchange
);
}
@Override
public
int
getOrder
()
{
return
Ordered
.
HIGHEST_PRECEDENCE
+
100
;
}
private
static
String
toRaw
(
Flux
<
DataBuffer
>
body
)
{
AtomicReference
<
String
>
rawRef
=
new
AtomicReference
<>();
body
.
subscribe
(
buffer
->
{
byte
[]
bytes
=
new
byte
[
buffer
.
readableByteCount
()];
buffer
.
read
(
bytes
);
DataBufferUtils
.
release
(
buffer
);
rawRef
.
set
(
Strings
.
fromUTF8ByteArray
(
bytes
));
});
return
rawRef
.
get
();
}
}
fanxing-ops/src/main/resources/db/V1.03__fanxing-collect.sql
0 → 100644
View file @
e4e2862
create
table
if
not
exists
s_collection_task
(
id
BIGINT
NOT
NULL
PRIMARY
KEY
AUTO_INCREMENT
,
unid
varchar
(
36
)
NOT
NULL
DEFAULT
(
UUID
()),
name
varchar
(
128
)
comment
'采集任务名称'
,
data_type
varchar
(
16
)
comment
'采集的数据类型, 视频,图片'
,
collect_type
varchar
(
16
)
comment
'采集方式, 定时截取, 自定义'
,
start_time
timestamp
comment
'采集任务开始时间'
,
end_time
timestamp
comment
'采集任务结束时间'
,
tasks
text
comment
'关联的任务'
,
collect_interval
int
comment
'采集间隔'
,
video_length
int
comment
'视频长度'
,
config_file
blob
comment
'自定义方式对应的配置文件'
,
create_time
timestamp
not
null
default
(
CURRENT_TIMESTAMP
)
comment
'创建时间'
,
status
int
comment
'状态'
,
key
`s_collection_task_unid_idx`
(
`unid`
)
);
create
table
if
not
exists
d_collection_result
(
id
BIGINT
NOT
NULL
PRIMARY
KEY
AUTO_INCREMENT
,
record_id
varchar
(
36
)
comment
'采集结果的记录ID'
,
collection_task_id
bigint
comment
'采集任务ID'
,
collection_task_name
varchar
(
128
)
comment
'采集任务名称'
,
task_id
bigint
comment
'分析任务ID'
,
task_name
varchar
(
128
)
comment
'分析任务名称'
,
collect_time
timestamp
comment
'采集时间'
,
data_type
varchar
(
16
)
comment
'数据类型'
,
object_type
int
comment
'对象类型'
,
score
int
comment
'分数'
,
file_name
varchar
(
128
)
comment
'采集到的文件的名称'
,
file_path
varchar
(
1024
)
comment
'采集到的文件的完整路径'
,
expand_info
text
comment
'拓展信息,算法给出来的其他定制化信息,外层不需理解内容'
,
key
`d_collection_result_idx`
(
`collect_time`
,
`data_type`
)
);
pom.xml
View file @
e4e2862
<?xml version="1.0" encoding="UTF-8"?>
<?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"
>
<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>
<modelVersion>
4.0.0
</modelVersion>
<parent>
<parent>
<groupId>
org.springframework.boot
</groupId>
<groupId>
org.springframework.boot
</groupId>
...
@@ -18,6 +19,7 @@
...
@@ -18,6 +19,7 @@
<module>
fanxing-forward
</module>
<module>
fanxing-forward
</module>
<module>
fanxing-ops
</module>
<module>
fanxing-ops
</module>
<module>
fanxing-query
</module>
<module>
fanxing-query
</module>
<module>
fanxing-collect
</module>
</modules>
</modules>
<properties>
<properties>
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment