Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in
Toggle navigation
T
tanpu-community
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
探普后端
tanpu-community
Commits
31ec71c4
Commit
31ec71c4
authored
Jul 16, 2021
by
刘基明
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
图片上传
parent
90410e4e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
3 deletions
+3
-3
FileRecordEntity.java
...anpu/community/dao/entity/community/FileRecordEntity.java
+1
-2
OSSFileService.java
...main/java/com/tanpu/community/service/OSSFileService.java
+2
-1
No files found.
community-service/src/main/java/com/tanpu/community/dao/entity/community/FileRecordEntity.java
View file @
31ec71c4
...
@@ -3,7 +3,6 @@ package com.tanpu.community.dao.entity.community;
...
@@ -3,7 +3,6 @@ package com.tanpu.community.dao.entity.community;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.tanpu.community.api.CommunityConstant
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.AllArgsConstructor
;
...
@@ -58,7 +57,7 @@ public class FileRecordEntity implements Serializable {
...
@@ -58,7 +57,7 @@ public class FileRecordEntity implements Serializable {
private
String
extInfo
;
private
String
extInfo
;
public
String
getUrl
(){
public
String
getUrl
(){
return
CommunityConstant
.
OSS_PREFIX_URL
+
fileOssKey
;
return
getPreviewUrl
().
substring
(
0
,
getPreviewUrl
().
indexOf
(
"?"
))
;
}
}
...
...
community-service/src/main/java/com/tanpu/community/service/OSSFileService.java
View file @
31ec71c4
...
@@ -76,11 +76,12 @@ public class OSSFileService {
...
@@ -76,11 +76,12 @@ public class OSSFileService {
String
[]
arr
=
StringUtils
.
split
(
fileName
,
"."
);
String
[]
arr
=
StringUtils
.
split
(
fileName
,
"."
);
String
suffix
=
arr
[
arr
.
length
-
1
];
String
suffix
=
arr
[
arr
.
length
-
1
];
if
(
FileTypeEnum
.
imageTypeSet
.
contains
(
suffix
))
{
if
(
FileTypeEnum
.
imageTypeSet
.
contains
(
suffix
))
{
//上传
String
id
=
uuidGenHelper
.
getUuidStr
();
String
id
=
uuidGenHelper
.
getUuidStr
();
String
key
=
CommunityConstant
.
OSS_PREFIX_FOLDER
+
id
+
"."
+
suffix
;
String
key
=
CommunityConstant
.
OSS_PREFIX_FOLDER
+
id
+
"."
+
suffix
;
ossHelper
.
writeFile
(
bucketName
,
key
,
data
,
fileSuffix
);
ossHelper
.
writeFile
(
bucketName
,
key
,
data
,
fileSuffix
);
//落库
FileRecordEntity
record
=
new
FileRecordEntity
();
FileRecordEntity
record
=
new
FileRecordEntity
();
record
.
setFileId
(
uuidGenHelper
.
getUuidStr
());
record
.
setFileId
(
uuidGenHelper
.
getUuidStr
());
record
.
setDeleteTag
(
BizStatus
.
DeleteTag
.
tag_init
);
record
.
setDeleteTag
(
BizStatus
.
DeleteTag
.
tag_init
);
...
...
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