Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation
This project
Loading...
Sign in
谢明辉
/
存储配置服务
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 907f8a78
authored
Feb 21, 2022
by
xmh
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
对 上传的文件 做xml判断
1 parent
7a5593db
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
1 deletions
src/main/java/com/viontech/storage/controller/StorageConfigController.java
src/main/java/com/viontech/storage/controller/StorageConfigController.java
View file @
907f8a7
...
@@ -3,6 +3,7 @@ package com.viontech.storage.controller;
...
@@ -3,6 +3,7 @@ package com.viontech.storage.controller;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.io.FastByteArrayOutputStream
;
import
cn.hutool.core.io.FastByteArrayOutputStream
;
import
cn.hutool.core.io.IoUtil
;
import
cn.hutool.core.io.IoUtil
;
import
cn.hutool.core.util.XmlUtil
;
import
cn.hutool.json.JSONUtil
;
import
cn.hutool.json.JSONUtil
;
import
com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper
;
import
com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper
;
import
com.viontech.storage.entity.Context
;
import
com.viontech.storage.entity.Context
;
...
@@ -17,9 +18,12 @@ import org.springframework.http.MediaType;
...
@@ -17,9 +18,12 @@ import org.springframework.http.MediaType;
import
org.springframework.util.Assert
;
import
org.springframework.util.Assert
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.w3c.dom.Document
;
import
org.w3c.dom.Node
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.ByteArrayInputStream
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.net.URLEncoder
;
import
java.net.URLEncoder
;
import
java.nio.charset.Charset
;
import
java.nio.charset.Charset
;
...
@@ -121,8 +125,10 @@ public class StorageConfigController {
...
@@ -121,8 +125,10 @@ public class StorageConfigController {
@PostMapping
(
"/upload"
)
@PostMapping
(
"/upload"
)
public
Message
<
Object
>
upload
(
Long
id
,
MultipartFile
file
)
throws
IOException
{
public
Message
<
Object
>
upload
(
Long
id
,
MultipartFile
file
)
throws
IOException
{
FastByteArrayOutputStream
read
=
IoUtil
.
read
(
file
.
getInputStream
());
FastByteArrayOutputStream
read
=
IoUtil
.
read
(
file
.
getInputStream
());
StorageConfig
byId
=
storageConfigService
.
getById
(
id
).
setContext
(
null
).
setType
(
1
).
setConfig
(
read
.
toByteArray
());
byte
[]
bytes
=
read
.
toByteArray
();
Document
document
=
XmlUtil
.
readXML
(
new
ByteArrayInputStream
(
bytes
));
StorageConfig
byId
=
storageConfigService
.
getById
(
id
).
setContext
(
null
).
setType
(
1
).
setConfig
(
bytes
);
storageConfigService
.
updateById
(
byId
);
storageConfigService
.
updateById
(
byId
);
return
Message
.
success
();
return
Message
.
success
();
}
}
...
...
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