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
98bee46a
Commit
98bee46a
authored
Mar 20, 2021
by
liqin
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug fixed
parent
c569dc0a
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
100 additions
and
21 deletions
+100
-21
pom.xml
pom.xml
+4
-3
FastDFSUtils.java
...cn/wisenergy/chnmuseum/party/common/dfs/FastDFSUtils.java
+2
-2
FdfsUtil.java
...ava/cn/wisenergy/chnmuseum/party/common/dfs/FdfsUtil.java
+51
-0
StorePath1.java
...a/cn/wisenergy/chnmuseum/party/common/dfs/StorePath1.java
+5
-5
FastDfsConfig.java
...java/cn/wisenergy/chnmuseum/party/conf/FastDfsConfig.java
+14
-0
AssetTypeController.java
...y/chnmuseum/party/web/controller/AssetTypeController.java
+10
-3
ChinaMobileRestApiController.java
...um/party/web/controller/ChinaMobileRestApiController.java
+4
-4
ExhibitionBoardController.java
...useum/party/web/controller/ExhibitionBoardController.java
+2
-2
application.properties
src/main/resources/application.properties
+8
-2
No files found.
pom.xml
View file @
98bee46a
...
...
@@ -108,10 +108,11 @@
<artifactId>
fastjson
</artifactId>
<version>
1.2.75
</version>
</dependency>
<!-- FastDFS -->
<dependency>
<groupId>
net.oschina.zcx7878
</groupId>
<artifactId>
fastdfs-client
-java
</artifactId>
<version>
1.27.
0.0
</version>
<groupId>
com.github.tobato
</groupId>
<artifactId>
fastdfs-client
</artifactId>
<version>
1.27.
2
</version>
</dependency>
<!-- Swagger2 Document -->
...
...
src/main/java/cn/wisenergy/chnmuseum/party/common/dfs/FastDFSUtils.java
View file @
98bee46a
...
...
@@ -118,8 +118,8 @@ public class FastDFSUtils {
StorageServer
storageServer
=
null
;
StorageClient
storageClient
=
new
StorageClient
(
trackerServer
,
storageServer
);
StorePath
storePath
=
StorePath
.
praseFromUrl
(
fileUrl
);
int
i
=
storageClient
.
delete_file
(
storePath
.
getGroup
(),
storePath
.
getPath
());
StorePath
1
storePath1
=
StorePath1
.
praseFromUrl
(
fileUrl
);
int
i
=
storageClient
.
delete_file
(
storePath
1
.
getGroup
(),
storePath1
.
getPath
());
System
.
out
.
println
(
i
==
0
?
"删除成功"
:
"删除失败:"
+
i
);
return
i
==
0
;
}
catch
(
Exception
e
)
{
...
...
src/main/java/cn/wisenergy/chnmuseum/party/common/dfs/FdfsUtil.java
0 → 100644
View file @
98bee46a
package
cn
.
wisenergy
.
chnmuseum
.
party
.
common
.
dfs
;
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.service.FastFileStorageClient
;
import
org.apache.commons.io.FilenameUtils
;
import
org.springframework.stereotype.Component
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.annotation.Resource
;
import
java.io.IOException
;
@Component
public
class
FdfsUtil
{
@Resource
private
FastFileStorageClient
fastFileStorageClient
;
@Resource
private
ThumbImageConfig
thumbImageConfig
;
/**
* 上传文件
*
* @param file 文件对象
* @return storePath 文件在服务器中的存储路径 group1/M00/00/08/rBEAA2A_Ci2AU9pHAAYlnPgRYiA554.jpg
* @throws IOException
*/
public
String
uploadFile
(
MultipartFile
file
)
throws
IOException
{
// StorePath storePath = fastFileStorageClient.uploadFile("aifruit", //默认都是放在aifruit分组group
StorePath
storePath
=
fastFileStorageClient
.
uploadFile
(
file
.
getInputStream
(),
file
.
getSize
(),
FilenameUtils
.
getExtension
(
file
.
getOriginalFilename
()),
null
);
return
storePath
.
getFullPath
();
//返回完整的图片存放路径(含group)
}
/**
* 下载文件(文件字节)
*
* @param fileUrl 文件服务器存储路径 group1/M00/00/08/rBEAA2A_Ci2AU9pHAAYlnPgRYiA554.jpg
* @return byte[] 文件字节
* @throws IOException
*/
public
byte
[]
downloadFileByByte
(
String
fileUrl
)
{
String
group
=
fileUrl
.
substring
(
0
,
fileUrl
.
indexOf
(
"/"
));
String
path
=
fileUrl
.
substring
(
fileUrl
.
indexOf
(
"/"
)
+
1
);
return
fastFileStorageClient
.
downloadFile
(
group
,
path
,
new
DownloadByteArray
());
}
}
src/main/java/cn/wisenergy/chnmuseum/party/common/dfs/StorePath.java
→
src/main/java/cn/wisenergy/chnmuseum/party/common/dfs/StorePath
1
.java
View file @
98bee46a
...
...
@@ -9,7 +9,7 @@ import org.apache.commons.lang3.Validate;
* @author yuqih
*
*/
public
class
StorePath
{
public
class
StorePath
1
{
private
String
group
;
...
...
@@ -24,7 +24,7 @@ public class StorePath {
/**
* 存储文件路径
*/
public
StorePath
()
{
public
StorePath
1
()
{
}
/**
...
...
@@ -33,7 +33,7 @@ public class StorePath {
* @param group
* @param path
*/
public
StorePath
(
String
group
,
String
path
)
{
public
StorePath
1
(
String
group
,
String
path
)
{
super
();
this
.
group
=
group
;
this
.
path
=
path
;
...
...
@@ -95,7 +95,7 @@ public class StorePath {
* 有效的路径样式为(group/path) 或者 (http://ip/group/path),路径地址必须包含group
* @return
*/
public
static
StorePath
praseFromUrl
(
String
filePath
)
{
public
static
StorePath
1
praseFromUrl
(
String
filePath
)
{
Validate
.
notNull
(
filePath
,
"解析文件路径不能为空"
);
// 获取group起始位置
int
groupStartPos
=
getGroupStartPos
(
filePath
);
...
...
@@ -108,7 +108,7 @@ public class StorePath {
String
group
=
groupAndPath
.
substring
(
0
,
pos
);
String
path
=
groupAndPath
.
substring
(
pos
+
1
);
return
new
StorePath
(
group
,
path
);
return
new
StorePath
1
(
group
,
path
);
}
/**
...
...
src/main/java/cn/wisenergy/chnmuseum/party/conf/FastDfsConfig.java
0 → 100644
View file @
98bee46a
package
cn
.
wisenergy
.
chnmuseum
.
party
.
conf
;
import
com.github.tobato.fastdfs.FdfsClientConfig
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.EnableMBeanExport
;
import
org.springframework.context.annotation.Import
;
import
org.springframework.jmx.support.RegistrationPolicy
;
@Configuration
@Import
(
FdfsClientConfig
.
class
)
// Jmx重复注册bean的问题
@EnableMBeanExport
(
registration
=
RegistrationPolicy
.
IGNORE_EXISTING
)
public
class
FastDfsConfig
{
}
src/main/java/cn/wisenergy/chnmuseum/party/web/controller/AssetTypeController.java
View file @
98bee46a
...
...
@@ -19,6 +19,7 @@ import io.swagger.annotations.ApiOperation;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.shiro.authz.annotation.RequiresPermissions
;
import
org.springframework.http.MediaType
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
...
...
@@ -49,7 +50,9 @@ public class AssetTypeController extends BaseController {
@Resource
private
CopyrightOwnerService
copyrightOwnerService
;
@PostMapping
(
"/save"
)
@PostMapping
(
value
=
"/save"
,
headers
=
"content-type=multipart/form-data"
,
consumes
=
MediaType
.
MULTIPART_FORM_DATA_VALUE
)
@RequiresPermissions
(
"asset:type:save"
)
@ApiOperation
(
value
=
"添加视频分类"
,
notes
=
"添加视频分类"
)
public
Map
<
String
,
Object
>
saveAssetType
(
@Validated
(
value
=
{
Add
.
class
})
AssetType
assetType
)
{
...
...
@@ -64,7 +67,9 @@ public class AssetTypeController extends BaseController {
}
}
@PutMapping
(
"/update"
)
@PutMapping
(
value
=
"/update"
,
headers
=
"content-type=multipart/form-data"
,
consumes
=
MediaType
.
MULTIPART_FORM_DATA_VALUE
)
@RequiresPermissions
(
"asset:type:update"
)
@ApiOperation
(
value
=
"修改视频分类信息"
,
notes
=
"修改视频分类信息"
)
public
Map
<
String
,
Object
>
updateAssetType
(
@Validated
AssetType
assetType
)
{
...
...
@@ -75,7 +80,9 @@ public class AssetTypeController extends BaseController {
return
getFailResult
();
}
@DeleteMapping
(
"/delete/{id}"
)
@DeleteMapping
(
value
=
"/delete/{id}"
,
headers
=
"content-type=multipart/form-data"
,
consumes
=
MediaType
.
MULTIPART_FORM_DATA_VALUE
)
@RequiresPermissions
(
"asset:type:delete"
)
@ApiOperation
(
value
=
"根据ID删除视频分类"
,
notes
=
"根据ID删除视频分类"
)
@ApiImplicitParams
(
value
=
{
...
...
src/main/java/cn/wisenergy/chnmuseum/party/web/controller/ChinaMobileRestApiController.java
View file @
98bee46a
...
...
@@ -192,7 +192,7 @@ public class ChinaMobileRestApiController extends BaseController {
@ApiImplicitParam
(
name
=
"startDate"
,
value
=
"创建时间-开始"
,
paramType
=
"query"
,
dataType
=
"String"
),
@ApiImplicitParam
(
name
=
"endDate"
,
value
=
"创建时间-结束"
,
paramType
=
"query"
,
dataType
=
"String"
)
})
@PostMapping
(
"/exhibitionBoard/getPage
List
"
)
@PostMapping
(
"/exhibitionBoard/getPage"
)
@RequiresPermissions
(
"exhibition:board:page"
)
@ApiOperation
(
value
=
"获取展板分页列表"
,
notes
=
"获取展板分页列表"
)
public
ResponseEntity
<
JSONObject
>
getExhibitionBoardPageList
(
GenericPageParam
genericPageParam
)
{
...
...
@@ -202,8 +202,8 @@ public class ChinaMobileRestApiController extends BaseController {
queryWrapper
.
like
(
ExhibitionBoard:
:
getName
,
genericPageParam
.
getNameOrCode
());
}
// 对版权方模糊查询
if
(
StringUtils
.
isNotBlank
(
genericPageParam
.
getCopyrightOwnerId
()))
{
queryWrapper
.
like
(
ExhibitionBoard:
:
getCopyrightOwnerId
,
genericPageParam
.
getCopyrightOwnerId
());
if
(
StringUtils
.
isNotBlank
(
genericPageParam
.
get
Board
CopyrightOwnerId
()))
{
queryWrapper
.
like
(
ExhibitionBoard:
:
getCopyrightOwnerId
,
genericPageParam
.
get
Board
CopyrightOwnerId
());
}
// 根据创建时间区间检索
if
(
genericPageParam
.
getStartDate
()
!=
null
&&
genericPageParam
.
getEndDate
()
!=
null
)
{
...
...
@@ -234,7 +234,7 @@ public class ChinaMobileRestApiController extends BaseController {
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"id"
,
value
=
"标识ID"
,
dataType
=
"String"
,
paramType
=
"path"
)
})
@GetMapping
(
"/exhibitionBoard/get/{id}"
)
@GetMapping
(
"/exhibitionBoard/get
by
/{id}"
)
@RequiresPermissions
(
"exhibition:board:get:id"
)
public
Map
<
String
,
Object
>
getById
(
@PathVariable
(
"id"
)
String
id
)
{
ExhibitionBoard
exhibitionBoard
=
exhibitionBoardService
.
getById
(
id
);
...
...
src/main/java/cn/wisenergy/chnmuseum/party/web/controller/ExhibitionBoardController.java
View file @
98bee46a
...
...
@@ -145,8 +145,8 @@ public class ExhibitionBoardController extends BaseController {
queryWrapper
.
like
(
ExhibitionBoard:
:
getName
,
genericPageParam
.
getNameOrCode
());
}
// 对版权方模糊查询
if
(
StringUtils
.
isNotBlank
(
genericPageParam
.
getCopyrightOwnerId
()))
{
queryWrapper
.
like
(
ExhibitionBoard:
:
getCopyrightOwnerId
,
genericPageParam
.
getCopyrightOwnerId
());
if
(
StringUtils
.
isNotBlank
(
genericPageParam
.
get
Board
CopyrightOwnerId
()))
{
queryWrapper
.
like
(
ExhibitionBoard:
:
getCopyrightOwnerId
,
genericPageParam
.
get
Board
CopyrightOwnerId
());
}
// 根据创建时间区间检索
if
(
genericPageParam
.
getStartDate
()
!=
null
&&
genericPageParam
.
getEndDate
()
!=
null
)
{
...
...
src/main/resources/application.properties
View file @
98bee46a
...
...
@@ -4,7 +4,7 @@ jwt.expiration=2592000
jwt.issuer
=
IATA
jwt.authenticationPath
=
/auth
jwt.authTokenPrefix
=
Bearer
cacheManager.principalIdFieldName
=
id
cacheManager.principalIdFieldName
=
id
mybatis-plus.check-config-location
=
true
...
...
@@ -21,9 +21,15 @@ mybatis-plus.configuration.cache-enabled=false
mybatis-plus.configuration.call-setters-on-nulls
=
true
mybatis-plus.configuration.jdbc-type-for-null
=
null
########################################################
###FastDFS
########################################################
fdfs.so-timeout
=
1501
fdfs.connect-timeout
=
601
fdfs.thumb-image.width
=
150
fdfs.thumb-image.height
=
150
fdfs.tracker-list[0]=
192.168.110.85
:
22122
dfsFileAccessBasePath
=
http://111.203.232.175:8085
prefixPat
=
/data/fastdfs/data
IMAGE_BASE_URL
=
http://111.203.232.175:8085/
...
...
@@ -45,7 +51,7 @@ spring.mvc.format.date=yyyy-MM-dd HH:mm:ss
spring.web.resources.static-locations
=
classpath:/META-INF/resources/,classpath:/resources/,classpath:/statics/,classpath:/public/
spring.servlet.multipart.enabled
=
true
spring.servlet.multipart.max-request-size
=
4096MB
spring.servlet.multipart.max-file-size
=
2048
MB
spring.servlet.multipart.max-file-size
=
4096
MB
spring.web.resources.add-mappings
=
true
#spring.mvc.converters.preferred-json-mapper=fastjson
...
...
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