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
9e572191
Commit
9e572191
authored
Sep 02, 2022
by
李灿灿
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature-licancan' into 'develop'
Feature licancan See merge request fangxinjiang/yifu!227
parents
3add8e96
b2cb2f2b
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
25 additions
and
67 deletions
+25
-67
EkpOrderUtil.java
...va/com/yifu.cloud.plus.v1/yifu/ekp/util/EkpOrderUtil.java
+15
-39
AttachmentForm.java
...va/com/yifu/cloud/plus/v1/yifu/ekp/vo/AttachmentForm.java
+0
-23
OrderController.java
.../cloud/plus/v1/yifu/order/controller/OrderController.java
+6
-1
TOrderServiceImpl.java
...ud/plus/v1/yifu/order/service/impl/TOrderServiceImpl.java
+2
-2
application.yml
yifu-order/yifu-order-biz/src/main/resources/application.yml
+2
-2
No files found.
yifu-common/yifu-common-ekp/src/main/java/com/yifu.cloud.plus.v1/yifu/ekp/util/EkpOrderUtil.java
View file @
9e572191
...
...
@@ -2,7 +2,6 @@ package com.yifu.cloud.plus.v1.yifu.ekp.util;
import
com.yifu.cloud.plus.v1.yifu.ekp.config.EkpOrderProperties
;
import
com.yifu.cloud.plus.v1.yifu.ekp.constant.EkpConstants
;
import
com.yifu.cloud.plus.v1.yifu.ekp.vo.AttachmentForm
;
import
com.yifu.cloud.plus.v1.yifu.ekp.vo.EkpOrderParam
;
import
com.yifu.cloud.plus.v1.yifu.ekp.vo.EkpOrderReplyParam
;
import
io.micrometer.core.instrument.util.StringUtils
;
...
...
@@ -12,15 +11,13 @@ import org.apache.commons.lang.ArrayUtils;
import
org.codehaus.jackson.map.ObjectMapper
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
import
org.springframework.core.io.FileSystemResource
;
import
org.springframework.http.*
;
import
org.springframework.util.LinkedMultiValueMap
;
import
org.springframework.util.MultiValueMap
;
import
org.springframework.web.client.RestTemplate
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.activation.DataHandler
;
import
javax.activation.DataSource
;
import
javax.activation.FileDataSource
;
import
java.io.File
;
import
java.util.ArrayList
;
import
java.util.List
;
...
...
@@ -90,7 +87,7 @@ public class EkpOrderUtil {
public
String
sendReplyToEKP
(
EkpOrderReplyParam
param
,
MultipartFile
[]
multipartFiles
){
log
.
info
(
"推送EKP开始--订单回复信息"
);
RestTemplate
yourRestTemplate
=
new
RestTemplate
();
List
<
AttachmentForm
>
fileList
=
createAllAttach
(
multipartFiles
);
List
<
File
>
fileList
=
new
ArrayList
<>(
);
try
{
String
formValues
=
new
ObjectMapper
().
writeValueAsString
(
param
);
//指向EKP的接口url
...
...
@@ -102,7 +99,17 @@ public class EkpOrderUtil {
wholeForm
.
add
(
"fdModelId"
,
ekpProperties
.
getReplyFdModelId
());
wholeForm
.
add
(
"fdFlowId"
,
ekpProperties
.
getReplyFdFlowId
());
wholeForm
.
add
(
"formValues"
,
formValues
);
wholeForm
.
add
(
"attachmentForms"
,
fileList
);
if
(
ArrayUtils
.
isNotEmpty
(
multipartFiles
)){
for
(
int
i
=
0
;
i
<
multipartFiles
.
length
;
i
++)
{
String
fileName
=
multipartFiles
[
i
].
getOriginalFilename
();
File
file
=
new
File
(
fileName
);
FileUtils
.
copyInputStreamToFile
(
multipartFiles
[
i
].
getInputStream
(),
file
);
wholeForm
.
add
(
"attachmentForms["
+
i
+
"].fdKey"
,
ekpProperties
.
getReplyAttachKey
());
wholeForm
.
add
(
"attachmentForms["
+
i
+
"].fdFileName"
,
multipartFiles
[
i
].
getOriginalFilename
());
wholeForm
.
add
(
"attachmentForms["
+
i
+
"].fdAttachment"
,
new
FileSystemResource
(
file
));
fileList
.
add
(
file
);
}
}
log
.
info
(
"wholeForm:"
+
wholeForm
);
HttpHeaders
headers
=
new
HttpHeaders
();
...
...
@@ -127,42 +134,11 @@ public class EkpOrderUtil {
}
finally
{
//将产生的临时附件删除,这里的fileList没值得话是[],不会是null,如果是null需要做判空处理
fileList
.
stream
().
forEach
(
e
->
{
FileDataSource
dataSource
=
(
FileDataSource
)
e
.
getFdAttachment
().
getDataSource
();
boolean
delete
=
dataSource
.
getFile
().
delete
();
log
.
info
(
"临时附件删除结果:"
,
delete
);
boolean
delete
=
e
.
delete
();
log
.
info
(
"临时附件删除结果:{}"
,
delete
);
});
}
}
/**
* 处理成ekp要的附件格式
*
* @author licancan
* @param multipartFiles
* @return {@link List<AttachmentForm>}
*/
public
List
<
AttachmentForm
>
createAllAttach
(
MultipartFile
[]
multipartFiles
){
List
<
AttachmentForm
>
attForms
=
new
ArrayList
<>();
if
(
ArrayUtils
.
isNotEmpty
(
multipartFiles
)){
try
{
for
(
MultipartFile
multipartFile
:
multipartFiles
)
{
AttachmentForm
attForm
=
new
AttachmentForm
();
//设置附件关键字,注意附件列表的key是一样的
attForm
.
setFdKey
(
ekpProperties
.
getReplyAttachKey
());
attForm
.
setFdFileName
(
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
;
}
}
yifu-common/yifu-common-ekp/src/main/java/com/yifu/cloud/plus/v1/yifu/ekp/vo/AttachmentForm.java
deleted
100644 → 0
View file @
3add8e96
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
ekp
.
vo
;
import
lombok.Data
;
import
javax.activation.DataHandler
;
import
javax.xml.bind.annotation.XmlAccessType
;
import
javax.xml.bind.annotation.XmlAccessorType
;
import
javax.xml.bind.annotation.XmlMimeType
;
/**
* @author licancan
* @description ekp附件类
* @date 2022-08-31 17:02:49
*/
@XmlAccessorType
(
XmlAccessType
.
FIELD
)
@Data
public
class
AttachmentForm
{
private
String
fdKey
;
private
String
fdFileName
;
@XmlMimeType
(
"application/octet-stream"
)
private
DataHandler
fdAttachment
;
}
yifu-order/yifu-order-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/order/controller/OrderController.java
View file @
9e572191
...
...
@@ -14,6 +14,7 @@ import io.swagger.v3.oas.annotations.Operation;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
...
...
@@ -57,6 +58,7 @@ public class OrderController {
*/
@Operation
(
summary
=
"订单列表不分页查询"
,
description
=
"订单列表不分页查询"
)
@GetMapping
(
"/getOrderList"
)
@PreAuthorize
(
"@pms.hasPermission('order:order_getOrderList')"
)
public
R
<
List
<
OrderListVO
>>
getOrderList
(
OrderListParam
param
)
{
return
R
.
ok
(
tOrderService
.
getOrderList
(
param
));
}
...
...
@@ -71,6 +73,7 @@ public class OrderController {
*/
@GetMapping
(
"/handleOrder"
)
@Operation
(
summary
=
"变更订单状态"
,
description
=
"变更订单状态"
)
//@PreAuthorize("@pms.hasPermission('order:order_handleOrder')")
public
R
<
String
>
handleOrder
(
@RequestParam
String
id
,
@RequestParam
Integer
status
)
{
return
tOrderService
.
handleOrder
(
id
,
status
);
}
...
...
@@ -84,7 +87,8 @@ public class OrderController {
*/
@Operation
(
summary
=
"通过id查询详情"
,
description
=
"通过id查询详情"
)
@GetMapping
(
"/{id}"
)
public
R
<
OrderDetailVO
>
getInsuranceDetailById
(
@PathVariable
(
"id"
)
String
id
)
{
//@PreAuthorize("@pms.hasPermission('order:order_getOrderDetailById')")
public
R
<
OrderDetailVO
>
getOrderDetailById
(
@PathVariable
(
"id"
)
String
id
)
{
return
tOrderService
.
getOrderDetailById
(
id
);
}
...
...
@@ -114,6 +118,7 @@ public class OrderController {
*/
@Schema
(
description
=
"添加回复"
)
@PostMapping
(
value
=
"/uploadReplyEnclosure"
)
@PreAuthorize
(
"@pms.hasPermission('order:order_uploadReplyEnclosure')"
)
public
R
uploadReplyEnclosure
(
@RequestBody
MultipartFile
[]
file
,
String
filePath
,
String
replyContent
,
String
orderNo
)
throws
IOException
{
return
tOrderService
.
uploadReplyEnclosure
(
file
,
filePath
,
replyContent
,
orderNo
);
}
...
...
yifu-order/yifu-order-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/order/service/impl/TOrderServiceImpl.java
View file @
9e572191
...
...
@@ -129,7 +129,7 @@ public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> impleme
EkpOrderParam
param
=
new
EkpOrderParam
();
param
.
setFd_3b0b02a93e9cda
(
byId
.
getOrderNo
());
param
.
setFd_3b0b02a34a0134
(
getOrderStatus
(
status
));
//
ekpOrderUtil.sendOrderToEKP(param);
ekpOrderUtil
.
sendOrderToEKP
(
param
);
return
R
.
ok
(
OrderConstants
.
OPERATE_SUCCESS
);
}
...
...
@@ -275,7 +275,7 @@ public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> impleme
param
.
setFd_3ac904badcaa06
(
user
.
getUsername
());
param
.
setFd_3ac904b8590598
(
reply
.
getCreateTime
().
toString
());
param
.
setFd_3ac904c7798e5c
(
replyContent
);
//
ekpOrderUtil.sendReplyToEKP(param,file);
ekpOrderUtil
.
sendReplyToEKP
(
param
,
file
);
if
(
save
&&
ArrayUtils
.
isNotEmpty
(
file
)){
for
(
MultipartFile
multipartFile
:
file
)
{
String
fileName
=
System
.
currentTimeMillis
()
+
"_"
+
multipartFile
.
getOriginalFilename
();
...
...
yifu-order/yifu-order-biz/src/main/resources/application.yml
View file @
9e572191
...
...
@@ -39,8 +39,8 @@ security:
-
/v3/api-docs
-
/actuator/**
-
/swagger-ui/**
-
/ekp/order/receiveOrder
-
/ekp/order/receiveOrderReply
#
- /ekp/order/receiveOrder
#
- /ekp/order/receiveOrderReply
...
...
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