Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
smf-core
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit b63949c8
由
sunke
编写于
2021-07-23 11:39:45 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
日志及打包配置
1 个父辈
0b2e4793
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
95 行增加
和
10 行删除
pom.xml
src/main/java/com/neotel/smfcore/SmfCoreApplication.java
src/main/java/com/neotel/smfcore/core/system/rest/TaskController.java
src/main/resources/config/application.yml
src/main/resources/log4j2-spring.xml
pom.xml
查看文件 @
b63949c
...
...
@@ -11,7 +11,7 @@
<groupId>
com.neotel
</groupId>
<artifactId>
smf-core
</artifactId>
<version>
1.7.1
</version>
<packaging>
j
ar
</packaging>
<packaging>
w
ar
</packaging>
<name>
smf-core
</name>
<description>
SMF project for Spring Boot
</description>
<properties>
...
...
@@ -35,12 +35,41 @@
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-web
</artifactId>
<!--<exclusions>-->
<!--<exclusion>-->
<!--<groupId>org.springframework.boot</groupId>-->
<!--<artifactId>spring-boot-starter-tomcat</artifactId>-->
<!--</exclusion>-->
<!--</exclusions>-->
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-configuration-processor
</artifactId>
<optional>
true
</optional>
</dependency>
<!--<dependency>-->
<!--<groupId>org.springframework.boot</groupId>-->
<!--<artifactId>spring-boot-starter-tomcat</artifactId>-->
<!--<scope>provided</scope>-->
<!--</dependency>-->
<dependency>
<!-- 排除 spring-boot-starter-logging -->
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-logging
</artifactId>
<exclusions>
<exclusion>
<groupId>
*
</groupId>
<artifactId>
*
</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- 其他依赖省略 -->
<!-- 引入 Log4j2 https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-log4j2 -->
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-log4j2
</artifactId>
</dependency>
<dependency>
...
...
@@ -161,6 +190,21 @@
<build>
<resources>
<resource>
<directory>
src/main/resources
</directory>
<targetPath>
META-INF/resources
</targetPath>
<includes>
<include>
*.*
</include>
</includes>
</resource>
<resource>
<directory>
src/main/resources
</directory>
<includes>
<include>
**/*.*
</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>
org.springframework.boot
</groupId>
...
...
src/main/java/com/neotel/smfcore/SmfCoreApplication.java
查看文件 @
b63949c
...
...
@@ -4,15 +4,17 @@ import com.neotel.smfcore.security.annotation.AnonymousGetMapping;
import
com.neotel.smfcore.common.utils.SpringContextHolder
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.boot.builder.SpringApplicationBuilder
;
import
org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory
;
import
org.springframework.boot.web.servlet.server.ServletWebServerFactory
;
import
org.springframework.boot.web.servlet.support.SpringBootServletInitializer
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.web.bind.annotation.RestController
;
@RestController
@SpringBootApplication
public
class
SmfCoreApplication
{
public
class
SmfCoreApplication
extends
SpringBootServletInitializer
{
public
static
void
main
(
String
[]
args
)
{
SpringApplication
.
run
(
SmfCoreApplication
.
class
,
args
);
...
...
@@ -23,11 +25,11 @@ public class SmfCoreApplication {
return
new
SpringContextHolder
();
}
@
Bean
p
ublic
ServletWebServerFactory
webServerFactory
(
)
{
TomcatServletWebServerFactory
fa
=
new
TomcatServletWebServerFactory
();
fa
.
addConnectorCustomizers
(
connector
->
connector
.
setProperty
(
"relaxedQueryChars"
,
"[]{}"
));
return
fa
;
@
Override
p
rotected
SpringApplicationBuilder
configure
(
SpringApplicationBuilder
builder
)
{
//参数为当前SpringBoot启动类
//构造新资源
return
builder
.
sources
(
SmfCoreApplication
.
class
)
;
}
/**
...
...
src/main/java/com/neotel/smfcore/core/system/rest/TaskController.java
查看文件 @
b63949c
...
...
@@ -63,10 +63,21 @@ public class TaskController {
return
taskMapper
.
toDto
(
taskList
);
}
@ApiOperation
(
"获取某个分组队列中的任务"
)
@GetMapping
(
"/{groupId}"
)
@PreAuthorize
(
"@el.check('task:inQueue','task:list')"
)
public
List
<
TaskDto
>
groupTask
(
@PathVariable
String
groupId
){
return
getTaskList
(
groupId
,
null
);
}
@ApiOperation
(
"获取队列中的任务"
)
@GetMapping
@PreAuthorize
(
"@el.check('task:inQueue','task:list')"
)
public
List
<
TaskDto
>
query
(
String
groupId
,
String
[]
cids
){
public
List
<
TaskDto
>
filterTask
(
String
groupId
,
String
[]
cids
){
return
getTaskList
(
groupId
,
cids
);
}
private
List
<
TaskDto
>
getTaskList
(
String
groupId
,
String
[]
cids
){
List
<
DataLog
>
resultTasks
=
Lists
.
newArrayList
();
List
<
DataLog
>
allTasks
=
taskService
.
getAllTasks
();
List
<
String
>
cidList
=
Lists
.
newArrayList
();
...
...
src/main/resources/config/application.yml
查看文件 @
b63949c
...
...
@@ -5,7 +5,6 @@ hella:
host
:
port
:
9900
spring
:
freemarker
:
check-template-location
:
false
...
...
@@ -17,7 +16,7 @@ spring:
mongodb
:
host
:
localhost
# 主机地址
port
:
27017
# 端口
database
:
smf
# 数据库
database
:
qisda
# 数据库
task
:
...
...
src/main/resources/log4j2-spring.xml
0 → 100644
查看文件 @
b63949c
<?xml version="1.0" encoding="UTF-8"?>
<configuration
status=
"WARN"
>
<Properties>
<Property
name=
"LOG_HOME"
>
logs
</Property>
<Property
name=
"LOG_NAME"
>
smf.txt
</Property>
</Properties>
<appenders>
<Console
name=
"Console"
target=
"SYSTEM_OUT"
>
<PatternLayout
pattern=
"%d{yyyy-MM-dd HH:mm:ss} %-5level [%file:%line] - %msg%n"
/>
</Console>
<RollingFile
name=
"log"
fileName=
"${LOG_HOME}/${LOG_NAME}"
filePattern=
"${LOG_HOME}/%d{yyyy-MM-dd}.${LOG_NAME}"
append=
"true"
>
<PatternLayout
charset=
"GB18030"
pattern=
"%d{yyyy-MM-dd HH:mm:ss} %-5level [%file:%line] - %msg%n"
/>
<Policies>
<TimeBasedTriggeringPolicy
modulate=
"true"
interval=
"1"
/>
</Policies>
<DefaultRolloverStrategy
max=
"180"
/>
</RollingFile>
</appenders>
<loggers>
<logger
name=
"org"
level=
"WARN"
>
</logger>
<logger
name=
"ro"
level=
"WARN"
>
</logger>
<root
level=
"INFO"
>
<!--<appender-ref ref="Console"/>-->
<appender-ref
ref=
"log"
/>
</root>
</loggers>
</configuration>
\ No newline at end of file
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论