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
b048875d
Commit
b048875d
authored
Mar 31, 2020
by
luzhuang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
txt限制10M
parent
7b29d7fe
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
4 deletions
+11
-4
BChapterServiceImpl.java
...t/business/bchapter/service/impl/BChapterServiceImpl.java
+6
-3
FileReadableUtil.java
src/main/java/org/rcisoft/core/util/FileReadableUtil.java
+5
-1
No files found.
src/main/java/org/rcisoft/business/bchapter/service/impl/BChapterServiceImpl.java
View file @
b048875d
...
@@ -111,6 +111,9 @@ public class BChapterServiceImpl implements BChapterService {
...
@@ -111,6 +111,9 @@ public class BChapterServiceImpl implements BChapterService {
@Value
(
"${upload.pdfMaxSize:150}"
)
@Value
(
"${upload.pdfMaxSize:150}"
)
private
Long
pdfMaxSize
;
private
Long
pdfMaxSize
;
@Value
(
"${upload.txtMaxSize:10}"
)
private
Long
txtMaxSize
;
@Value
(
"${upload.replaceHttp:false}"
)
@Value
(
"${upload.replaceHttp:false}"
)
private
String
replaceHttp
;
private
String
replaceHttp
;
...
@@ -744,7 +747,7 @@ public class BChapterServiceImpl implements BChapterService {
...
@@ -744,7 +747,7 @@ public class BChapterServiceImpl implements BChapterService {
if
(
"7"
.
equals
(
bFile
.
getType
())
||
"8"
.
equals
(
bFile
.
getType
())
||
"9"
.
equals
(
bFile
.
getType
())
||
"10"
.
equals
(
bFile
.
getType
())){
if
(
"7"
.
equals
(
bFile
.
getType
())
||
"8"
.
equals
(
bFile
.
getType
())
||
"9"
.
equals
(
bFile
.
getType
())
||
"10"
.
equals
(
bFile
.
getType
())){
FileReadableUtil
.
imgReadable
(
path
);
FileReadableUtil
.
imgReadable
(
path
);
}
else
{
}
else
{
FileReadableUtil
.
fileReadable
(
path
,
fileMaxSize
,
pdfMaxSize
,
fileMaxPages
);
FileReadableUtil
.
fileReadable
(
path
,
fileMaxSize
,
pdfMaxSize
,
txtMaxSize
,
fileMaxPages
);
}
}
return
flag
;
return
flag
;
}
}
...
@@ -807,7 +810,7 @@ public class BChapterServiceImpl implements BChapterService {
...
@@ -807,7 +810,7 @@ public class BChapterServiceImpl implements BChapterService {
}
else
{
}
else
{
String
downLoadName
=
downLoadFile
(
bFile
,
file
,
filePath
);
String
downLoadName
=
downLoadFile
(
bFile
,
file
,
filePath
);
LogUtil
.
fileChangeLog
(
"------------------判断pdf是否可读----------------------------"
+
fileOld
);
LogUtil
.
fileChangeLog
(
"------------------判断pdf是否可读----------------------------"
+
fileOld
);
FileReadableUtil
.
fileReadable
(
filePath
+
File
.
separator
+
downLoadName
,
fileMaxSize
,
pdfMaxSize
,
fileMaxPages
);
FileReadableUtil
.
fileReadable
(
filePath
+
File
.
separator
+
downLoadName
,
fileMaxSize
,
pdfMaxSize
,
txtMaxSize
,
fileMaxPages
);
LogUtil
.
fileChangeLog
(
"------------------pdf文件可读--返回下载后路径-----------------------------"
+
downLoadName
);
LogUtil
.
fileChangeLog
(
"------------------pdf文件可读--返回下载后路径-----------------------------"
+
downLoadName
);
return
returnBasePath
+
File
.
separator
+
downLoadName
;
return
returnBasePath
+
File
.
separator
+
downLoadName
;
}
}
...
@@ -841,7 +844,7 @@ public class BChapterServiceImpl implements BChapterService {
...
@@ -841,7 +844,7 @@ public class BChapterServiceImpl implements BChapterService {
//判断文件是否可读
//判断文件是否可读
LogUtil
.
fileChangeLog
(
"------------------判断文件是否可读-----------------------------"
+
filePath
+
File
.
separator
+
name
);
LogUtil
.
fileChangeLog
(
"------------------判断文件是否可读-----------------------------"
+
filePath
+
File
.
separator
+
name
);
FileReadableUtil
.
fileReadable
(
filePath
+
File
.
separator
+
downLoadFileName
,
fileMaxSize
,
pdfMaxSize
,
fileMaxPages
);
FileReadableUtil
.
fileReadable
(
filePath
+
File
.
separator
+
downLoadFileName
,
fileMaxSize
,
pdfMaxSize
,
txtMaxSize
,
fileMaxPages
);
LogUtil
.
fileChangeLog
(
"------------------------非pdf文件可读-----------------------"
+
downLoadFileName
);
LogUtil
.
fileChangeLog
(
"------------------------非pdf文件可读-----------------------"
+
downLoadFileName
);
LogUtil
.
fileChangeLog
(
"-----------------------------------------------downLoadFileUrl:"
+
filePath
+
File
.
separator
+
downLoadFileName
);
LogUtil
.
fileChangeLog
(
"-----------------------------------------------downLoadFileUrl:"
+
filePath
+
File
.
separator
+
downLoadFileName
);
LogUtil
.
fileChangeLog
(
"-----------------------------------------------filePath:"
+
filePath
+
File
.
separator
+
newName
);
LogUtil
.
fileChangeLog
(
"-----------------------------------------------filePath:"
+
filePath
+
File
.
separator
+
newName
);
...
...
src/main/java/org/rcisoft/core/util/FileReadableUtil.java
View file @
b048875d
...
@@ -190,7 +190,7 @@ public class FileReadableUtil {
...
@@ -190,7 +190,7 @@ public class FileReadableUtil {
}
}
public
static
void
fileReadable
(
String
path
,
Long
fileMaxSize
,
Long
pdfMaxSize
,
Integer
fileMaxPages
)
{
public
static
void
fileReadable
(
String
path
,
Long
fileMaxSize
,
Long
pdfMaxSize
,
Long
txtMaxSize
,
Integer
fileMaxPages
)
{
LogUtil
.
fileChangeLog
(
"-----------FileReadableUtil-路径------------"
+
path
);
LogUtil
.
fileChangeLog
(
"-----------FileReadableUtil-路径------------"
+
path
);
File
file
=
new
File
(
path
);
File
file
=
new
File
(
path
);
Long
size
=
file
.
length
();
Long
size
=
file
.
length
();
...
@@ -198,6 +198,10 @@ public class FileReadableUtil {
...
@@ -198,6 +198,10 @@ public class FileReadableUtil {
if
(
size
>
(
long
)(
1024
*
1024
*
pdfMaxSize
)){
if
(
size
>
(
long
)(
1024
*
1024
*
pdfMaxSize
)){
throw
new
ServiceException
(
400
,
"该文件超过最大"
+
pdfMaxSize
+
"M限制"
);
throw
new
ServiceException
(
400
,
"该文件超过最大"
+
pdfMaxSize
+
"M限制"
);
}
}
}
else
if
(
"txt"
.
equals
(
path
.
substring
(
path
.
lastIndexOf
(
"."
)
+
1
))){
if
(
size
>
(
long
)(
1024
*
1024
*
txtMaxSize
)){
throw
new
ServiceException
(
400
,
"该文件超过最大"
+
txtMaxSize
+
"M限制"
);
}
}
else
{
}
else
{
if
(
size
>
(
long
)(
1024
*
1024
*
fileMaxSize
)){
if
(
size
>
(
long
)(
1024
*
1024
*
fileMaxSize
)){
throw
new
ServiceException
(
400
,
"该文件超过最大"
+
fileMaxSize
+
"M限制"
);
throw
new
ServiceException
(
400
,
"该文件超过最大"
+
fileMaxSize
+
"M限制"
);
...
...
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