Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
JSH ERP
Commits
aa360938
Commit
aa360938
authored
Jul 02, 2021
by
季圣华
Browse files
增加配置获取文件大小限制
parent
29b2959b
Changes
2
Hide whitespace changes
Inline
Side-by-side
jshERP-boot/src/main/java/com/jsh/erp/controller/SystemConfigController.java
View file @
aa360938
...
...
@@ -55,6 +55,12 @@ public class SystemConfigController {
@Value
(
value
=
"${file.path}"
)
private
String
filePath
;
@Value
(
value
=
"${spring.servlet.multipart.max-file-size}"
)
private
Long
maxFileSize
;
@Value
(
value
=
"${spring.servlet.multipart.max-request-size}"
)
private
Long
maxRequestSize
;
@GetMapping
(
value
=
"/getDictItems/{dictCode}"
)
public
BaseResponseInfo
getDictItems
(
@PathVariable
String
dictCode
,
HttpServletRequest
request
)
{
...
...
@@ -120,6 +126,31 @@ public class SystemConfigController {
return
res
;
}
/**
* 获取文件大小限制
* @param request
* @return
* @throws Exception
*/
@GetMapping
(
value
=
"/fileSizeLimit"
)
public
BaseResponseInfo
fileSizeLimit
(
HttpServletRequest
request
)
throws
Exception
{
BaseResponseInfo
res
=
new
BaseResponseInfo
();
try
{
Long
limit
=
0L
;
if
(
maxFileSize
<
maxRequestSize
)
{
limit
=
maxFileSize
;
}
else
{
limit
=
maxRequestSize
;
}
res
.
code
=
200
;
res
.
data
=
limit
;
}
catch
(
Exception
e
){
e
.
printStackTrace
();
res
.
code
=
500
;
res
.
data
=
"获取数据失败"
;
}
return
res
;
}
/**
* 文件上传统一方法
...
...
jshERP-boot/src/main/resources/application.properties
View file @
aa360938
...
...
@@ -27,4 +27,7 @@ plugin.runMode=prod
plugin.pluginPath
=
plugins
plugin.pluginConfigFilePath
=
pluginConfig
#文件上传根目录
file.path
=
/opt/jshERP/upload
\ No newline at end of file
file.path
=
/opt/jshERP/upload
#文件上传限制(byte)
spring.servlet.multipart.max-file-size
=
10485760
spring.servlet.multipart.max-request-size
=
10485760
\ No newline at end of file
Write
Preview
Supports
Markdown
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