Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
education
Project
Project
Details
Activity
Releases
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
李丛阳
education
Commits
1e6fd989
Commit
1e6fd989
authored
Dec 25, 2019
by
zhangqingle
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加控制日志等级接口
parent
8b0ab389
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
69 additions
and
5 deletions
+69
-5
BLessonServiceImpl.java
...oft/business/blesson/service/impl/BLessonServiceImpl.java
+19
-0
LogbackController.java
...java/org/rcisoft/common/controller/LogbackController.java
+45
-0
CurUserAspect.java
src/main/java/org/rcisoft/core/aop/CurUserAspect.java
+1
-1
FileReadableUtil.java
src/main/java/org/rcisoft/core/util/FileReadableUtil.java
+3
-3
LogUtil.java
src/main/java/org/rcisoft/core/util/LogUtil.java
+1
-1
No files found.
src/main/java/org/rcisoft/business/blesson/service/impl/BLessonServiceImpl.java
View file @
1e6fd989
...
...
@@ -1368,6 +1368,25 @@ public class BLessonServiceImpl implements BLessonService {
if
(
bLesson
==
null
)
{
throw
new
ServiceException
(
ResultServiceEnums
.
LESSON_NOT_EXISTA
);
}
//获取讲师部门
List
<
String
>
ids
=
new
ArrayList
<>();
ids
.
add
(
bLesson
.
getLecturerId
());
MTUserGetsReqDTO
mtUserGetsReqDTO
=
new
MTUserGetsReqDTO
();
mtUserGetsReqDTO
.
setCorpId
(
curUser
.
getCorpId
());
mtUserGetsReqDTO
.
setIds
(
ids
);
List
<
MTUserInfoRspDTO
>
mtUserInfoRspDTOList
=
cotactApiRequestClient
.
userGets
(
mtUserGetsReqDTO
);
if
(
mtUserInfoRspDTOList
!=
null
&&
mtUserInfoRspDTOList
.
size
()
>
0
)
{
mtUserInfoRspDTOList
.
forEach
(
mtUserInfoRspDTO
->
{
if
(
mtUserInfoRspDTO
.
getDepts
()
!=
null
&&
mtUserInfoRspDTO
.
getDepts
().
size
()
>
0
&&
mtUserInfoRspDTO
.
getId
().
equals
(
bLesson
.
getLecturerId
()))
{
//设置部门名
bLesson
.
setLecturerDeptName
(
mtUserInfoRspDTO
.
getDepts
().
get
(
0
).
getName
());
bLesson
.
setLecturerPic
(
mtUserInfoRspDTO
.
getAvatar
());
}
});
}
int
trainApplyCount
=
bLessonRepository
.
trainApplyCount
(
bLesson
.
getBusinessId
());
if
(
StringUtils
.
isNotEmpty
(
bLesson
.
getMaxApplyPerson
())
&&
!
"0"
.
equals
(
bLesson
.
getMaxApplyPerson
())
&&
trainApplyCount
>=
Integer
.
parseInt
(
bLesson
.
getMaxApplyPerson
()))
{
bLesson
.
setApplyIsFull
(
"1"
);
...
...
src/main/java/org/rcisoft/common/controller/LogbackController.java
0 → 100644
View file @
1e6fd989
package
org
.
rcisoft
.
common
.
controller
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
@RestController
@RequestMapping
(
"/logback"
)
public
class
LogbackController
{
private
Logger
log
=
LoggerFactory
.
getLogger
(
LogbackController
.
class
);
@RequestMapping
(
value
=
"/logback"
)
public
String
logj
(){
log
.
error
(
"我是error"
);
log
.
warn
(
"我是warn"
);
log
.
info
(
"我是info"
);
log
.
debug
(
"我是debug"
);
return
"success"
;
}
/**
* logback动态修改包名的日志级别
* @param level 日志级别
* @param packageName 包名
* @return
* @throws Exception
*/
@RequestMapping
(
value
=
"/level"
)
public
String
updateLogbackLevel
(
@RequestParam
(
value
=
"level"
)
String
level
,
@RequestParam
(
value
=
"packageName"
,
defaultValue
=
"-1"
)
String
packageName
)
throws
Exception
{
ch
.
qos
.
logback
.
classic
.
LoggerContext
loggerContext
=(
ch
.
qos
.
logback
.
classic
.
LoggerContext
)
LoggerFactory
.
getILoggerFactory
();
if
(
packageName
.
equals
(
"-1"
))
{
// 默认值-1,更改全局日志级别;否则按传递的包名或类名修改日志级别。
loggerContext
.
getLogger
(
"root"
).
setLevel
(
ch
.
qos
.
logback
.
classic
.
Level
.
toLevel
(
level
));
}
else
{
loggerContext
.
getLogger
(
packageName
).
setLevel
(
ch
.
qos
.
logback
.
classic
.
Level
.
valueOf
(
level
));
}
return
"success"
;
}
}
\ No newline at end of file
src/main/java/org/rcisoft/core/aop/CurUserAspect.java
View file @
1e6fd989
...
...
@@ -58,7 +58,7 @@ public class CurUserAspect {
if
(
null
==
model
)
throw
new
ServiceException
(
ResultExceptionEnum
.
USER_NO_AUTHEN
);
//免登 不拦截
if
(
methodSignature
.
getName
().
equals
(
"loginByCode"
)
||
methodSignature
.
getName
().
equals
(
"refreshToken"
)
||
methodSignature
.
getName
().
equals
(
"synchronizedUsers"
))
if
(
methodSignature
.
getName
().
equals
(
"loginByCode"
)
||
methodSignature
.
getName
().
equals
(
"refreshToken"
)
||
methodSignature
.
getName
().
equals
(
"synchronizedUsers"
)
||
methodSignature
.
getName
().
equals
(
"updateLogbackLevel"
)
)
return
;
CurUser
curUser
=
(
CurUser
)
model
;
//非法权限
...
...
src/main/java/org/rcisoft/core/util/FileReadableUtil.java
View file @
1e6fd989
...
...
@@ -19,7 +19,7 @@ import java.io.*;
public
class
FileReadableUtil
{
public
static
void
main
(
String
[]
args
)
{
String
filePath
=
"C:\\Users\\三\\Desktop\\素材\\
加密-pdf.pdf
"
;
String
filePath
=
"C:\\Users\\三\\Desktop\\素材\\
63.7M-82页.docx
"
;
fileReadable
(
filePath
,(
long
)
100
,
100
);
}
...
...
@@ -138,7 +138,7 @@ public class FileReadableUtil {
File
file
=
new
File
(
path
);
Long
size
=
file
.
length
();
if
(
size
>
(
long
)(
1024
*
1024
*
fileMaxSize
)){
throw
new
ServiceException
(
"该文件超过最大"
+
fileMaxSize
+
"M限制"
);
throw
new
ServiceException
(
400
,
"该文件超过最大"
+
fileMaxSize
+
"M限制"
);
}
Integer
pages
=
-
1
;
...
...
@@ -164,7 +164,7 @@ public class FileReadableUtil {
}
if
(
pages
!=
-
1
&&
pages
>
fileMaxPages
)
{
throw
new
ServiceException
(
"该文件超过最多"
+
fileMaxPages
+
"M
限制"
);
throw
new
ServiceException
(
400
,
"该文件超过最多"
+
fileMaxPages
+
"页
限制"
);
}
// if (!CheckFileHeaderUtil.toCheck(path)){
...
...
src/main/java/org/rcisoft/core/util/LogUtil.java
View file @
1e6fd989
...
...
@@ -6,6 +6,6 @@ import lombok.extern.slf4j.Slf4j;
public
class
LogUtil
{
//文件转换日志打印
public
static
void
fileChangeLog
(
String
message
){
log
.
debug
(
message
);
log
.
warn
(
message
);
}
}
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