Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
C
chnmuseum-party
Project
Project
Details
Activity
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
liqin
chnmuseum-party
Commits
a305c105
Commit
a305c105
authored
Apr 07, 2021
by
liqin
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug fixed
parent
b043bdcf
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
26 deletions
+17
-26
FastDFSUtils.java
...cn/wisenergy/chnmuseum/party/common/dfs/FastDFSUtils.java
+6
-23
AssetController.java
...nergy/chnmuseum/party/web/controller/AssetController.java
+8
-1
ExhibitionBoardCatController.java
...um/party/web/controller/ExhibitionBoardCatController.java
+1
-1
ExhibitionBoardController.java
...useum/party/web/controller/ExhibitionBoardController.java
+2
-1
No files found.
src/main/java/cn/wisenergy/chnmuseum/party/common/dfs/FastDFSUtils.java
View file @
a305c105
...
...
@@ -8,7 +8,6 @@ import com.github.tobato.fastdfs.domain.fdfs.FileInfo;
import
com.github.tobato.fastdfs.domain.fdfs.MetaData
;
import
com.github.tobato.fastdfs.domain.fdfs.StorePath
;
import
com.github.tobato.fastdfs.domain.fdfs.ThumbImageConfig
;
import
com.github.tobato.fastdfs.domain.proto.storage.DownloadByteArray
;
import
com.github.tobato.fastdfs.domain.proto.storage.DownloadFileStream
;
import
com.github.tobato.fastdfs.exception.FdfsServerException
;
import
com.github.tobato.fastdfs.service.FastFileStorageClient
;
...
...
@@ -106,17 +105,6 @@ public class FastDFSUtils {
/**
* 下载文件(字节数组)
*/
public
static
byte
[]
downloadFile
(
String
fileUrl
)
{
fileUrl
=
fileUrl
.
replace
(
dfsFileAccessBasePath
+
"/"
,
""
);
String
groupName
=
fileUrl
.
substring
(
0
,
fileUrl
.
indexOf
(
"/"
));
String
path
=
fileUrl
.
substring
(
fileUrl
.
indexOf
(
"/"
)
+
1
);
return
storageClient
.
downloadFile
(
groupName
,
path
,
new
DownloadByteArray
());
}
/**
* 下载文件(字节数组)
* @return
*/
public
static
BufferedInputStream
downloadFile
(
String
fileUrl
,
OutputStream
outputStream
)
{
fileUrl
=
fileUrl
.
replace
(
dfsFileAccessBasePath
+
"/"
,
""
);
String
groupName
=
fileUrl
.
substring
(
0
,
fileUrl
.
indexOf
(
"/"
));
...
...
@@ -126,14 +114,11 @@ public class FastDFSUtils {
/**
* 下载文件
*
* @param groupName
* @param path
* @return
*/
public
static
InputStream
d
eleteFile
(
String
groupName
,
String
p
ath
)
{
public
static
InputStream
d
ownloadFile
(
String
fileP
ath
)
{
try
{
return
storageClient
.
downloadFile
(
groupName
,
path
,
inputStream
->
inputStream
);
StorePath
storePath
=
StorePath
.
parseFromUrl
(
filePath
);
return
storageClient
.
downloadFile
(
storePath
.
getGroup
(),
storePath
.
getPath
(),
inputStream
->
inputStream
);
}
catch
(
FdfsServerException
e
)
{
//不起作用
log
.
error
(
"文件不存在,下载失败:"
+
e
.
getErrorCode
());
...
...
@@ -144,11 +129,9 @@ public class FastDFSUtils {
/**
* 删除文件
*/
public
static
byte
[]
deleteFile
(
String
fileUrl
)
{
fileUrl
=
fileUrl
.
replace
(
dfsFileAccessBasePath
+
"/"
,
""
);
String
groupName
=
fileUrl
.
substring
(
0
,
fileUrl
.
indexOf
(
"/"
));
String
path
=
fileUrl
.
substring
(
fileUrl
.
indexOf
(
"/"
)
+
1
);
return
storageClient
.
downloadFile
(
groupName
,
path
,
new
DownloadByteArray
());
public
static
void
deleteFile
(
String
filePath
)
{
StorePath
storePath
=
StorePath
.
parseFromUrl
(
filePath
);
storageClient
.
deleteFile
(
storePath
.
getGroup
(),
storePath
.
getPath
());
}
private
static
int
[]
getImageInfo
(
byte
[]
bytes
)
{
...
...
src/main/java/cn/wisenergy/chnmuseum/party/web/controller/AssetController.java
View file @
a305c105
package
cn
.
wisenergy
.
chnmuseum
.
party
.
web
.
controller
;
import
cn.wisenergy.chnmuseum.party.common.dfs.FastDFSUtils
;
import
cn.wisenergy.chnmuseum.party.common.vo.GenericPageParam
;
import
cn.wisenergy.chnmuseum.party.model.Asset
;
import
cn.wisenergy.chnmuseum.party.service.AssetService
;
...
...
@@ -13,10 +14,10 @@ import io.swagger.annotations.ApiOperation;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.shiro.authz.annotation.RequiresAuthentication
;
import
org.apache.shiro.authz.annotation.RequiresPermissions
;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
import
java.io.InputStream
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -80,9 +81,15 @@ public class AssetController extends BaseController {
@RequiresAuthentication
//@RequiresPermissions("asset:download")
public
void
download
(
@RequestParam
(
"idList"
)
List
<
String
>
idList
)
{
final
List
<
Asset
>
assetList
=
assetService
.
listByIds
(
idList
);
for
(
Asset
asset
:
assetList
)
{
final
String
fileUrl
=
asset
.
getFileUrl
();
final
InputStream
inputStream
=
FastDFSUtils
.
downloadFile
(
fileUrl
);
}
}
}
...
...
src/main/java/cn/wisenergy/chnmuseum/party/web/controller/ExhibitionBoardCatController.java
View file @
a305c105
...
...
@@ -22,7 +22,6 @@ import io.swagger.annotations.ApiOperation;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.shiro.authz.annotation.RequiresAuthentication
;
import
org.apache.shiro.authz.annotation.RequiresPermissions
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
...
...
@@ -144,6 +143,7 @@ public class ExhibitionBoardCatController extends BaseController {
queryWrapper
.
select
(
ExhibitionBoardCat:
:
getId
,
ExhibitionBoardCat:
:
getName
,
ExhibitionBoardCat:
:
getRemarks
,
ExhibitionBoardCat:
:
getCreateTime
,
ExhibitionBoardCat:
:
getUpdateTime
);
Page
<
ExhibitionBoardCat
>
page
=
this
.
exhibitionBoardCatService
.
page
(
getPage
(),
queryWrapper
);
...
...
src/main/java/cn/wisenergy/chnmuseum/party/web/controller/ExhibitionBoardController.java
View file @
a305c105
...
...
@@ -18,7 +18,6 @@ import io.swagger.annotations.ApiOperation;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.shiro.authz.annotation.RequiresAuthentication
;
import
org.apache.shiro.authz.annotation.RequiresPermissions
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
...
...
@@ -269,6 +268,8 @@ public class ExhibitionBoardController extends BaseController {
queryWrapper
.
select
(
ExhibitionBoard:
:
getId
,
ExhibitionBoard:
:
getName
,
ExhibitionBoard:
:
getRemarks
,
ExhibitionBoard:
:
getQrcodeUrl
,
ExhibitionBoard:
:
getAuditStatus
,
ExhibitionBoard:
:
getPublished
,
ExhibitionBoard:
:
getDeleted
,
...
...
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