Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation
This project
Loading...
Sign in
李苗
/
Vion-DevOps
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 7a99f27e
authored
Aug 22, 2024
by
HlQ
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
[fix] 捕获同步销帮帮合同文件时发生的异常
1 parent
1dc02c04
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
2 deletions
src/main/java/vion/service/impl/ContractServiceImpl.java
src/main/java/vion/service/impl/ContractServiceImpl.java
View file @
7a99f27
...
...
@@ -647,7 +647,10 @@ public class ContractServiceImpl extends MPJBaseServiceImpl<ContractMapper, Cont
var
contractList
=
this
.
lambdaQuery
().
likeRight
(
Contract:
:
getContractNo
,
"SC"
).
list
();
var
contractNo2IdMap
=
contractList
.
stream
().
collect
(
Collectors
.
toMap
(
Contract:
:
getContractNo
,
Contract:
:
getId
));
var
fileInfoList
=
fileService
.
lambdaQuery
().
in
(
FileInfo:
:
getContractId
,
contractNo2IdMap
.
values
()).
eq
(
FileInfo:
:
getSourceType
,
5
).
list
();
var
fileInfoList
=
fileService
.
lambdaQuery
()
.
in
(
FileInfo:
:
getContractId
,
contractNo2IdMap
.
values
())
.
eq
(
FileInfo:
:
getSourceType
,
5
)
.
list
();
// 合同id -> sha256 的 List
var
contractId2Sha256Map
=
fileInfoList
.
stream
().
collect
(
Collectors
.
groupingBy
(
FileInfo:
:
getContractId
,
Collectors
.
mapping
(
FileInfo:
:
getSha256
,
Collectors
.
toList
())));
...
...
@@ -670,7 +673,13 @@ public class ContractServiceImpl extends MPJBaseServiceImpl<ContractMapper, Cont
var
fileObj
=
JSONUtil
.
parseObj
(
o
);
var
filename
=
fileObj
.
getStr
(
"filename"
);
String
path
=
fileUrl
+
FileUtil
.
FILE_SEPARATOR
+
"contract"
+
FileUtil
.
FILE_SEPARATOR
+
contractId
+
FileUtil
.
FILE_SEPARATOR
+
filename
;
var
bytes
=
HttpDownloader
.
downloadBytes
(
fileObj
.
getStr
(
"attachIndex"
));
byte
[]
bytes
;
try
{
bytes
=
HttpDownloader
.
downloadBytes
(
fileObj
.
getStr
(
"attachIndex"
));
}
catch
(
Exception
e
)
{
log
.
error
(
"合同:{},[{}] 文件同步失败"
,
contractNo
,
filename
);
continue
;
}
var
sha256
=
SecureUtil
.
sha256
().
digestHex
(
bytes
).
toUpperCase
();
// sha256 对应的文件不存在已有的文件列表,才保存
if
(
contractId2Sha256Map
.
getOrDefault
(
contractId
,
ListUtil
.
empty
()).
contains
(
sha256
))
{
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment