Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
Y
yifu-mvp
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
fangxinjiang
yifu-mvp
Commits
0a5f4bb4
Commit
0a5f4bb4
authored
Sep 01, 2022
by
李灿灿
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
订单回复推ekp,附件推送送删除
parent
65badb9c
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
19 deletions
+29
-19
EkpOrderUtil.java
...va/com/yifu.cloud.plus.v1/yifu/ekp/util/EkpOrderUtil.java
+29
-19
No files found.
yifu-common/yifu-common-ekp/src/main/java/com/yifu.cloud.plus.v1/yifu/ekp/util/EkpOrderUtil.java
View file @
0a5f4bb4
...
...
@@ -57,7 +57,7 @@ public class EkpOrderUtil {
wholeForm
.
add
(
"fdModelId"
,
ekpProperties
.
getOrderFdModelId
());
wholeForm
.
add
(
"fdFlowId"
,
ekpProperties
.
getOrderFdFlowId
());
wholeForm
.
add
(
"formValues"
,
formValues
);
System
.
out
.
println
(
"wholeForm:"
+
wholeForm
);
log
.
info
(
"wholeForm:"
+
wholeForm
);
HttpHeaders
headers
=
new
HttpHeaders
();
//如果EKP对该接口启用了Basic认证,那么客户端需要加入
//addAuth(headers,"yourAccount"+":"+"yourPassword");是VO,则使用APPLICATION_JSON
...
...
@@ -75,7 +75,7 @@ public class EkpOrderUtil {
return
body
;
}
}
catch
(
Exception
e
){
log
.
info
(
e
);
log
.
error
(
e
);
return
null
;
}
}
...
...
@@ -90,6 +90,7 @@ public class EkpOrderUtil {
public
String
sendReplyToEKP
(
EkpOrderReplyParam
param
,
MultipartFile
[]
multipartFiles
){
log
.
info
(
"推送EKP开始--订单回复信息"
);
RestTemplate
yourRestTemplate
=
new
RestTemplate
();
List
<
AttachmentForm
>
fileList
=
createAllAttach
(
multipartFiles
);
try
{
String
formValues
=
new
ObjectMapper
().
writeValueAsString
(
param
);
//指向EKP的接口url
...
...
@@ -101,11 +102,9 @@ public class EkpOrderUtil {
wholeForm
.
add
(
"fdModelId"
,
ekpProperties
.
getReplyFdModelId
());
wholeForm
.
add
(
"fdFlowId"
,
ekpProperties
.
getReplyFdFlowId
());
wholeForm
.
add
(
"formValues"
,
formValues
);
wholeForm
.
add
(
"attachmentForms"
,
fileList
);
//注意附件列表的key是一样的
wholeForm
.
add
(
"attachmentForms"
,
createAllAttach
(
multipartFiles
));
System
.
out
.
println
(
"wholeForm:"
+
wholeForm
);
log
.
info
(
"wholeForm:"
+
wholeForm
);
HttpHeaders
headers
=
new
HttpHeaders
();
//如果EKP对该接口启用了Basic认证,那么客户端需要加入
//addAuth(headers,"yourAccount"+":"+"yourPassword");是VO,则使用APPLICATION_JSON
...
...
@@ -123,8 +122,15 @@ public class EkpOrderUtil {
return
body
;
}
}
catch
(
Exception
e
){
log
.
info
(
e
);
log
.
error
(
e
);
return
null
;
}
finally
{
//将产生的临时附件删除,这里的fileList没值得话是[],不会是null,如果是null需要做判空处理
fileList
.
stream
().
forEach
(
e
->
{
FileDataSource
dataSource
=
(
FileDataSource
)
e
.
getFdAttachment
().
getDataSource
();
boolean
delete
=
dataSource
.
getFile
().
delete
();
log
.
info
(
"临时附件删除结果:"
,
delete
);
});
}
}
...
...
@@ -135,21 +141,25 @@ public class EkpOrderUtil {
* @param multipartFiles
* @return {@link List<AttachmentForm>}
*/
public
List
<
AttachmentForm
>
createAllAttach
(
MultipartFile
[]
multipartFiles
)
throws
Exception
{
public
List
<
AttachmentForm
>
createAllAttach
(
MultipartFile
[]
multipartFiles
){
List
<
AttachmentForm
>
attForms
=
new
ArrayList
<>();
if
(
ArrayUtils
.
isNotEmpty
(
multipartFiles
)){
try
{
for
(
MultipartFile
multipartFile
:
multipartFiles
)
{
AttachmentForm
attForm
=
new
AttachmentForm
();
//设置附件关键字,表单模式下为附件控件的id
//设置附件关键字,注意附件列表的key是一样的
attForm
.
setFdKey
(
ekpProperties
.
getReplyAttachKey
());
attForm
.
setFdFileName
(
multipartFile
.
getOriginalFilename
());
File
file
=
new
File
(
"G:\\tmp\\"
+
multipartFile
.
getOriginalFilename
());
File
file
=
new
File
(
multipartFile
.
getOriginalFilename
());
FileUtils
.
copyInputStreamToFile
(
multipartFile
.
getInputStream
(),
file
);
DataSource
dataSource
=
new
FileDataSource
(
file
);
DataHandler
dataHandler
=
new
DataHandler
(
dataSource
);
attForm
.
setFdAttachment
(
dataHandler
);
attForms
.
add
(
attForm
);
}
}
catch
(
Exception
e
){
log
.
error
(
"createAllAttach--->error:"
,
e
);
}
}
return
attForms
;
}
...
...
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