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
abba8913
Commit
abba8913
authored
Aug 18, 2021
by
刘基明
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
图片审核添加待审核类型
parent
b05c24c1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
11 deletions
+15
-11
FileChechStatusEnum.java
...va/com/tanpu/community/api/enums/FileChechStatusEnum.java
+2
-1
CallBackController.java
...va/com/tanpu/community/controller/CallBackController.java
+10
-2
FileManager.java
...rc/main/java/com/tanpu/community/manager/FileManager.java
+3
-8
No files found.
community-api/src/main/java/com/tanpu/community/api/enums/FileChechStatusEnum.java
View file @
abba8913
...
...
@@ -8,7 +8,8 @@ public enum FileChechStatusEnum {
INIT
(
0
,
"初始化"
),
PASS
(
1
,
"审核通过"
),
FAILED
(
2
,
"审核不通过"
);
FAILED
(
2
,
"审核不通过"
),
REVIEW
(
3
,
"建议人工审核"
);
public
static
final
HashSet
<
String
>
ossTypeSet
=
SetUtils
.
hashSet
(
"jpg"
,
"jpeg"
,
"png"
,
"txt"
);
...
...
community-service/src/main/java/com/tanpu/community/controller/CallBackController.java
View file @
abba8913
...
...
@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONArray;
import
com.tanpu.common.api.CommonResp
;
import
com.tanpu.common.exception.BizException
;
import
com.tanpu.common.util.JsonUtil
;
import
com.tanpu.community.api.enums.FileChechStatusEnum
;
import
com.tanpu.community.manager.FileManager
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -15,6 +16,7 @@ import org.springframework.web.bind.annotation.RestController;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
@RestController
...
...
@@ -42,10 +44,16 @@ public class CallBackController {
Map
<
String
,
Object
>
response
=
JsonUtil
.
toMap
(
content
);
String
fileKey
=
(
String
)
response
.
get
(
"object"
);
boolean
freezed
=
(
boolean
)
response
.
get
(
"freezed"
);
FileChechStatusEnum
type
=
freezed
?
FileChechStatusEnum
.
FAILED
:
FileChechStatusEnum
.
PASS
;
HashMap
<
String
,
Object
>
scanResult
=
(
HashMap
<
String
,
Object
>)
response
.
get
(
"scanResult"
);
String
taskId
=
(
String
)
scanResult
.
get
(
"taskId"
);
String
resultLog
=
JsonUtil
.
toJson
(
scanResult
.
get
(
"results"
));
fileManager
.
updateCheckResult
(
fileKey
,
freezed
,
taskId
,
resultLog
);
List
<
HashMap
<
String
,
Object
>>
scenes
=
(
List
<
HashMap
<
String
,
Object
>>)
scanResult
.
get
(
"results"
);
for
(
HashMap
<
String
,
Object
>
scene
:
scenes
)
{
if
(!
"pass"
.
equals
(
scene
.
get
(
"suggestion"
)))
{
type
=
FileChechStatusEnum
.
REVIEW
;
}
}
fileManager
.
updateCheckResult
(
fileKey
,
type
,
taskId
,
JsonUtil
.
toJson
(
scanResult
));
return
"success"
;
}
...
...
community-service/src/main/java/com/tanpu/community/manager/FileManager.java
View file @
abba8913
...
...
@@ -15,6 +15,7 @@ import com.aliyuncs.profile.IClientProfile;
import
com.tanpu.common.constant.ErrorCodeConstant
;
import
com.tanpu.common.exception.BizException
;
import
com.tanpu.community.api.beans.resp.FileUploadResp
;
import
com.tanpu.community.api.enums.FileChechStatusEnum
;
import
com.tanpu.community.api.enums.OssDirEnum
;
import
com.tanpu.community.dao.entity.community.FileRecordEntity
;
import
com.tanpu.community.service.OSSFileService
;
...
...
@@ -73,19 +74,13 @@ public class FileManager {
.
collect
(
Collectors
.
toMap
(
FileRecordEntity:
:
getFileId
,
FileRecordEntity:
:
getUrl
));
}
public
void
updateCheckResult
(
String
fileKey
,
boolean
check
,
String
taskId
,
String
resultLog
)
{
public
void
updateCheckResult
(
String
fileKey
,
FileChechStatusEnum
type
,
String
taskId
,
String
resultLog
)
{
FileRecordEntity
fileRecordEntity
=
ossFileService
.
queryByOssKey
(
fileKey
);
if
(
fileRecordEntity
==
null
)
{
throw
new
BizException
(
"图片未找到:"
+
fileKey
);
}
if
(
check
)
{
// 审核失败
fileRecordEntity
.
setCheckStatus
(
2
);
}
else
{
// 审核通过
fileRecordEntity
.
setCheckStatus
(
1
);
}
fileRecordEntity
.
setCheckStatus
(
type
.
getCode
());
fileRecordEntity
.
setCheckTaskId
(
taskId
);
fileRecordEntity
.
setCheckResultLog
(
resultLog
);
ossFileService
.
update
(
fileRecordEntity
);
...
...
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