Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
fzm-joying
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
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
lei
fzm-joying
Commits
9e217241
Commit
9e217241
authored
Jan 08, 2022
by
tangtuo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
解决文件空格的问题
parent
db6549e4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
5 deletions
+8
-5
CopyrightLister.java
...src/main/java/com/fzm/admin/listener/CopyrightLister.java
+6
-3
CopyrightFile.java
...on/src/main/java/com/fzm/common/entity/CopyrightFile.java
+1
-0
ObsUtil.java
...ng-common/src/main/java/com/fzm/common/utils/ObsUtil.java
+1
-1
CopyrightFileController.java
...va/com/fzm/portal/controller/CopyrightFileController.java
+0
-1
No files found.
joying-admin/src/main/java/com/fzm/admin/listener/CopyrightLister.java
View file @
9e217241
...
@@ -69,6 +69,7 @@ public class CopyrightLister {
...
@@ -69,6 +69,7 @@ public class CopyrightLister {
public
void
listerCopyrightApply
(
String
serial_code
,
Message
message
,
Channel
channel
)
throws
IOException
{
public
void
listerCopyrightApply
(
String
serial_code
,
Message
message
,
Channel
channel
)
throws
IOException
{
log
.
info
(
"监听者接收消息, 流水号为: {}"
,
serial_code
);
log
.
info
(
"监听者接收消息, 流水号为: {}"
,
serial_code
);
long
deliveryTag
=
message
.
getMessageProperties
().
getDeliveryTag
();
long
deliveryTag
=
message
.
getMessageProperties
().
getDeliveryTag
();
try
{
CopyrightQueryRequest
request
=
new
CopyrightQueryRequest
(
serial_code
,
copyrightProperties
.
getAppId
());
CopyrightQueryRequest
request
=
new
CopyrightQueryRequest
(
serial_code
,
copyrightProperties
.
getAppId
());
TreeMap
<
String
,
String
>
map
=
this
.
beanToMap
(
request
,
copyrightProperties
.
getAppSecret
());
TreeMap
<
String
,
String
>
map
=
this
.
beanToMap
(
request
,
copyrightProperties
.
getAppSecret
());
String
sign
=
CopyrightSignUtil
.
generateSign
(
map
);
String
sign
=
CopyrightSignUtil
.
generateSign
(
map
);
...
@@ -99,7 +100,6 @@ public class CopyrightLister {
...
@@ -99,7 +100,6 @@ public class CopyrightLister {
log
.
error
(
"接口响应失败, 失败原因:{}"
,
copyrightResponse
.
getMessage
());
log
.
error
(
"接口响应失败, 失败原因:{}"
,
copyrightResponse
.
getMessage
());
return
;
return
;
}
}
try
{
CopyrightApply
copyrightApply
=
copyrightApplyService
.
getBySerialNum
(
serial_code
);
CopyrightApply
copyrightApply
=
copyrightApplyService
.
getBySerialNum
(
serial_code
);
// if (copyrightApply == null) {
// if (copyrightApply == null) {
// log.error("unknown serial_code: {}", serial_code);
// log.error("unknown serial_code: {}", serial_code);
...
@@ -149,7 +149,6 @@ public class CopyrightLister {
...
@@ -149,7 +149,6 @@ public class CopyrightLister {
copyrightApplyService
.
updateById
(
copyrightApply
);
copyrightApplyService
.
updateById
(
copyrightApply
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
// 如果上链失败或者更新状态失败, 那么就把消息重新丢入延时队列,稍后重试
// 如果上链失败或者更新状态失败, 那么就把消息重新丢入延时队列,稍后重试
rabbitTemplate
.
convertAndSend
(
RabbitMQConfig
.
COPYRIGHT_DIRECT
,
"copyright.apply"
,
serial_code
);
rabbitTemplate
.
convertAndSend
(
RabbitMQConfig
.
COPYRIGHT_DIRECT
,
"copyright.apply"
,
serial_code
);
log
.
error
(
e
.
getMessage
(),
e
);
log
.
error
(
e
.
getMessage
(),
e
);
}
finally
{
}
finally
{
...
@@ -159,7 +158,6 @@ public class CopyrightLister {
...
@@ -159,7 +158,6 @@ public class CopyrightLister {
}
}
private
TreeMap
<
String
,
String
>
beanToMap
(
CopyrightQueryRequest
request
,
String
app_secret
)
{
private
TreeMap
<
String
,
String
>
beanToMap
(
CopyrightQueryRequest
request
,
String
app_secret
)
{
TreeMap
<
String
,
String
>
map
=
JSONUtil
.
toBean
(
JSONUtil
.
toJsonStr
(
request
),
new
TypeReference
<
TreeMap
<
String
,
String
>>()
{
TreeMap
<
String
,
String
>
map
=
JSONUtil
.
toBean
(
JSONUtil
.
toJsonStr
(
request
),
new
TypeReference
<
TreeMap
<
String
,
String
>>()
{
},
true
);
},
true
);
...
@@ -197,4 +195,9 @@ public class CopyrightLister {
...
@@ -197,4 +195,9 @@ public class CopyrightLister {
}
}
public
static
void
main
(
String
[]
args
)
{
String
str
=
"https://filmchain-file.obs.cn-east-3.myhuaweicloud.com/5f7d224aab0c4c22ae77aa2a21a0787c/权利取得方式证明材料附件 (7).docx"
;
String
s
=
str
.
replaceAll
(
" "
,
""
);
System
.
out
.
println
(
s
.
equals
(
str
));
}
}
}
joying-common/src/main/java/com/fzm/common/entity/CopyrightFile.java
View file @
9e217241
...
@@ -47,5 +47,6 @@ public class CopyrightFile {
...
@@ -47,5 +47,6 @@ public class CopyrightFile {
public
CopyrightFile
(
CopyrightDTO
.
File
file
)
{
public
CopyrightFile
(
CopyrightDTO
.
File
file
)
{
BeanUtil
.
copyProperties
(
file
,
this
,
true
);
BeanUtil
.
copyProperties
(
file
,
this
,
true
);
this
.
fileName
=
file
.
getFileName
().
replaceAll
(
" "
,
""
);
}
}
}
}
joying-common/src/main/java/com/fzm/common/utils/ObsUtil.java
View file @
9e217241
...
@@ -45,7 +45,7 @@ public class ObsUtil {
...
@@ -45,7 +45,7 @@ public class ObsUtil {
* @return
* @return
*/
*/
public
String
putObject
(
MultipartFile
file
)
throws
IOException
{
public
String
putObject
(
MultipartFile
file
)
throws
IOException
{
String
objectName
=
IdUtil
.
simpleUUID
().
concat
(
"/"
).
concat
(
file
.
getOriginalFilename
());
String
objectName
=
IdUtil
.
simpleUUID
().
concat
(
"/"
).
concat
(
file
.
getOriginalFilename
()
.
replaceAll
(
" "
,
""
)
);
obsClient
.
putObject
(
obsProperties
.
getBucket
(),
objectName
,
file
.
getInputStream
());
obsClient
.
putObject
(
obsProperties
.
getBucket
(),
objectName
,
file
.
getInputStream
());
return
String
.
format
(
"https://%s.%s/%s"
,
obsProperties
.
getBucket
(),
obsProperties
.
getEndPoint
(),
objectName
);
return
String
.
format
(
"https://%s.%s/%s"
,
obsProperties
.
getBucket
(),
obsProperties
.
getEndPoint
(),
objectName
);
}
}
...
...
joying-portal/src/main/java/com/fzm/portal/controller/CopyrightFileController.java
View file @
9e217241
...
@@ -43,7 +43,6 @@ public class CopyrightFileController {
...
@@ -43,7 +43,6 @@ public class CopyrightFileController {
if
(!
FileSuffix
.
validFileType
(
fileSuffix
))
{
if
(!
FileSuffix
.
validFileType
(
fileSuffix
))
{
throw
GlobalException
.
newException
(
ResultCode
.
FILE_UPLOAD_ERROR
,
"不支持当前上传的文件类型"
);
throw
GlobalException
.
newException
(
ResultCode
.
FILE_UPLOAD_ERROR
,
"不支持当前上传的文件类型"
);
}
}
String
url
=
obsUtil
.
putObject
(
file
);
String
url
=
obsUtil
.
putObject
(
file
);
return
ResponseModel
.
success
(
url
);
return
ResponseModel
.
success
(
url
);
}
}
...
...
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