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
da1d6639
Commit
da1d6639
authored
Apr 06, 2021
by
liqin
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug fixed
parent
9673ee8e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
11 deletions
+13
-11
FastDFSUtils.java
...cn/wisenergy/chnmuseum/party/common/dfs/FastDFSUtils.java
+3
-2
ChinaMobileRestApiController.java
...um/party/web/controller/ChinaMobileRestApiController.java
+5
-4
FileUploadController.java
.../chnmuseum/party/web/controller/FileUploadController.java
+5
-5
No files found.
src/main/java/cn/wisenergy/chnmuseum/party/common/dfs/FastDFSUtils.java
View file @
da1d6639
...
...
@@ -136,9 +136,10 @@ public class FastDFSUtils {
* 删除文件
*/
public
static
byte
[]
deleteFile
(
String
fileUrl
)
{
String
group
=
fileUrl
.
substring
(
0
,
fileUrl
.
indexOf
(
"/"
));
fileUrl
=
fileUrl
.
replace
(
dfsFileAccessBasePath
+
"/"
,
""
);
String
groupName
=
fileUrl
.
substring
(
0
,
fileUrl
.
indexOf
(
"/"
));
String
path
=
fileUrl
.
substring
(
fileUrl
.
indexOf
(
"/"
)
+
1
);
return
storageClient
.
downloadFile
(
group
,
path
,
new
DownloadByteArray
());
return
storageClient
.
downloadFile
(
group
Name
,
path
,
new
DownloadByteArray
());
}
private
static
int
[]
getImageInfo
(
byte
[]
bytes
)
{
...
...
src/main/java/cn/wisenergy/chnmuseum/party/web/controller/ChinaMobileRestApiController.java
View file @
da1d6639
...
...
@@ -3,6 +3,7 @@ package cn.wisenergy.chnmuseum.party.web.controller;
import
cn.wisenergy.chnmuseum.party.auth.SHA256PasswordEncryptionService
;
import
cn.wisenergy.chnmuseum.party.auth.util.JwtTokenUtil
;
import
cn.wisenergy.chnmuseum.party.common.enums.FileCatEnum
;
import
cn.wisenergy.chnmuseum.party.common.enums.FileTypeEnum
;
import
cn.wisenergy.chnmuseum.party.common.enums.LanguageEnum
;
import
cn.wisenergy.chnmuseum.party.common.util.TimeUtils
;
import
cn.wisenergy.chnmuseum.party.common.validator.groups.Add
;
...
...
@@ -39,10 +40,7 @@ import org.springframework.web.bind.annotation.*;
import
javax.annotation.Resource
;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.*
;
import
java.util.concurrent.TimeUnit
;
import
java.util.stream.Collectors
;
...
...
@@ -409,6 +407,9 @@ public class ChinaMobileRestApiController extends BaseController {
assetQueryWrapper
=
Wrappers
.<
Asset
>
lambdaQuery
().
eq
(
Asset:
:
getRefItemId
,
exhibitionBoard
.
getId
());
assetQueryWrapper
.
eq
(
Asset:
:
getFileCat
,
FileCatEnum
.
EXHIBITION_BOARD_DATUM
.
name
());
final
List
<
Asset
>
datumList
=
this
.
assetService
.
list
(
assetQueryWrapper
);
if
(
language
!=
null
)
{
datumList
.
removeIf
(
x
->
FileTypeEnum
.
VIDEO
.
name
().
equals
(
x
.
getFileType
())
&&
!
language
.
name
().
equals
(
x
.
getLanguage
()));
}
exhibitionBoard
.
setDatumList
(
datumList
);
final
String
videoContentId
=
exhibitionBoard
.
getVideoContentId
();
...
...
src/main/java/cn/wisenergy/chnmuseum/party/web/controller/FileUploadController.java
View file @
da1d6639
...
...
@@ -20,9 +20,7 @@ import lombok.extern.slf4j.Slf4j;
import
org.apache.commons.io.FilenameUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.shiro.authz.annotation.RequiresPermissions
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.MediaType
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
...
...
@@ -49,7 +47,7 @@ public class FileUploadController extends BaseController {
private
static
final
String
[]
AUDIO_TYPE
=
new
String
[]{
"MP3"
,
"AAC"
,
"WMA"
,
"FLAC"
,
"RM"
,
"OGG"
};
private
static
final
String
[]
VIDEO_TYPE
=
new
String
[]{
"MP4"
,
"FLV"
};
private
static
final
String
[]
DOC_TYPE
=
new
String
[]{
"PDF"
,
"TXT"
,
"DOC"
,
"DOCX"
,
"PPT"
,
"PPTX"
,
"XLS"
,
"XLSX"
};
private
static
final
String
[]
DATUM_TYPE
=
ArrayUtil
.
addAll
(
DOC_TYPE
,
IMAGE_TYPE
,
AUDIO_TYPE
,
VIDEO_TYPE
);
private
static
final
String
[]
DATUM_TYPE
=
ArrayUtil
.
addAll
(
DOC_TYPE
,
IMAGE_TYPE
,
VIDEO_TYPE
);
@Resource
private
AssetService
assetService
;
...
...
@@ -57,14 +55,16 @@ public class FileUploadController extends BaseController {
@ApiOperation
(
value
=
"根据文件ID刪除文件"
,
notes
=
"根据文件ID刪除文件"
)
@DeleteMapping
(
value
=
"/delete/{id}"
)
@RequiresPermissions
(
"file:delete"
)
public
ResponseEntity
<
Map
<
String
,
Object
>
>
delete
(
@PathVariable
(
value
=
"id"
)
String
id
)
{
public
Map
<
String
,
Object
>
delete
(
@PathVariable
(
value
=
"id"
)
String
id
)
{
final
Asset
asset
=
assetService
.
getById
(
id
);
if
(
asset
!=
null
)
{
final
String
fileUrl
=
asset
.
getFileUrl
();
FastDFSUtils
.
deleteFile
(
fileUrl
);
this
.
assetService
.
removeById
(
id
);
return
getSuccessResult
();
}
return
ResponseEntity
.
status
(
HttpStatus
.
INTERNAL_SERVER_ERROR
).
build
();
return
getFailResult
();
}
@ApiImplicitParams
({
...
...
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