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
dc876985
Commit
dc876985
authored
Nov 25, 2024
by
fangxinjiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
项目订单附件上传优化-fxj
parent
f16dbd62
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
12 deletions
+15
-12
EkpOrderProperties.java
...ifu/cloud/plus/v1/yifu/ekp/config/EkpOrderProperties.java
+0
-4
EkpOrderUtil.java
...va/com/yifu/cloud/plus/v1/yifu/ekp/util/EkpOrderUtil.java
+13
-3
ekpOrderConfig-test.properties
...mon-ekp/src/main/resources/ekpOrderConfig-test.properties
+1
-2
TOrderServiceImpl.java
...ud/plus/v1/yifu/order/service/impl/TOrderServiceImpl.java
+1
-3
No files found.
yifu-common/yifu-common-ekp/src/main/java/com/yifu/cloud/plus/v1/yifu/ekp/config/EkpOrderProperties.java
View file @
dc876985
...
@@ -20,10 +20,6 @@ public class EkpOrderProperties {
...
@@ -20,10 +20,6 @@ public class EkpOrderProperties {
* 接口url
* 接口url
*/
*/
String
url
;
String
url
;
/**
* 接口url
*/
String
url2
;
/**
/**
* 订单modelId
* 订单modelId
...
...
yifu-common/yifu-common-ekp/src/main/java/com/yifu/cloud/plus/v1/yifu/ekp/util/EkpOrderUtil.java
View file @
dc876985
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
ekp
.
util
;
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
ekp
.
util
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants
;
import
com.yifu.cloud.plus.v1.yifu.ekp.config.EkpOrderProperties
;
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.constant.EkpConstants
;
import
com.yifu.cloud.plus.v1.yifu.ekp.vo.EkpOrderParam
;
import
com.yifu.cloud.plus.v1.yifu.ekp.vo.EkpOrderParam
;
...
@@ -13,6 +16,8 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -13,6 +16,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
import
org.springframework.core.io.FileSystemResource
;
import
org.springframework.core.io.FileSystemResource
;
import
org.springframework.http.*
;
import
org.springframework.http.*
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.LinkedMultiValueMap
;
import
org.springframework.util.LinkedMultiValueMap
;
import
org.springframework.util.MultiValueMap
;
import
org.springframework.util.MultiValueMap
;
import
org.springframework.web.client.RestTemplate
;
import
org.springframework.web.client.RestTemplate
;
...
@@ -29,6 +34,7 @@ import java.util.List;
...
@@ -29,6 +34,7 @@ import java.util.List;
*/
*/
@Log4j2
@Log4j2
@EnableConfigurationProperties
(
EkpOrderProperties
.
class
)
@EnableConfigurationProperties
(
EkpOrderProperties
.
class
)
@Component
public
class
EkpOrderUtil
{
public
class
EkpOrderUtil
{
@Autowired
@Autowired
private
EkpOrderProperties
ekpProperties
;
private
EkpOrderProperties
ekpProperties
;
...
@@ -146,15 +152,19 @@ public class EkpOrderUtil {
...
@@ -146,15 +152,19 @@ public class EkpOrderUtil {
* @Param
* @Param
* @return
* @return
**/
**/
@Async
public
String
syncFileFromEkp
(
String
orderNo
,
String
attIds
){
public
String
syncFileFromEkp
(
String
orderNo
,
String
attIds
){
log
.
info
(
"同步项目订单附件信息"
);
log
.
info
(
"同步项目订单附件信息"
);
RestTemplate
yourRestTemplate
=
new
RestTemplate
();
RestTemplate
yourRestTemplate
=
new
RestTemplate
();
String
formValues
=
"{}"
;
try
{
try
{
//指向EKP的接口url
//指向EKP的接口url
//把ModelingAppModelParameterAddForm转换成MultiValueMap
//把ModelingAppModelParameterAddForm转换成MultiValueMap
MultiValueMap
<
String
,
Object
>
wholeForm
=
new
LinkedMultiValueMap
<>();
MultiValueMap
<
String
,
Object
>
wholeForm
=
new
LinkedMultiValueMap
<>();
wholeForm
.
add
(
"orderNo"
,
orderNo
);
wholeForm
.
add
(
"orderNo"
,
orderNo
);
wholeForm
.
add
(
"attIds"
,
attIds
);
wholeForm
.
add
(
"attIds"
,
attIds
);
wholeForm
.
add
(
"fileFlag"
,
CommonConstants
.
ZERO_STRING
);
wholeForm
.
add
(
"formValues"
,
formValues
);
HttpHeaders
headers
=
new
HttpHeaders
();
HttpHeaders
headers
=
new
HttpHeaders
();
//如果EKP对该接口启用了Basic认证,那么客户端需要加入
//如果EKP对该接口启用了Basic认证,那么客户端需要加入
//addAuth(headers,"yourAccount"+":"+"yourPassword");是VO,则使用APPLICATION_JSON
//addAuth(headers,"yourAccount"+":"+"yourPassword");是VO,则使用APPLICATION_JSON
...
@@ -162,7 +172,8 @@ public class EkpOrderUtil {
...
@@ -162,7 +172,8 @@ public class EkpOrderUtil {
//必须设置上传类型,如果入参是字符串,使用MediaType.TEXT_PLAIN;如果
//必须设置上传类型,如果入参是字符串,使用MediaType.TEXT_PLAIN;如果
HttpEntity
<
MultiValueMap
<
String
,
Object
>>
entity
=
new
HttpEntity
<
MultiValueMap
<
String
,
Object
>>(
wholeForm
,
headers
);
HttpEntity
<
MultiValueMap
<
String
,
Object
>>
entity
=
new
HttpEntity
<
MultiValueMap
<
String
,
Object
>>(
wholeForm
,
headers
);
//有返回值的情况 VO可以替换成具体的JavaBean
//有返回值的情况 VO可以替换成具体的JavaBean
ResponseEntity
<
String
>
obj
=
yourRestTemplate
.
exchange
(
ekpProperties
.
getUrl2
(),
HttpMethod
.
POST
,
entity
,
String
.
class
);
ResponseEntity
<
String
>
obj
=
yourRestTemplate
.
exchange
(
ekpProperties
.
getUrl
(),
HttpMethod
.
POST
,
entity
,
String
.
class
);
log
.
error
(
"附件同步结果:"
+
JSONObject
.
toJSONString
(
obj
));
String
body
=
obj
.
getBody
();
String
body
=
obj
.
getBody
();
if
(
StringUtils
.
isBlank
(
body
)){
if
(
StringUtils
.
isBlank
(
body
)){
log
.
error
(
EkpConstants
.
SEND_FAILED
);
log
.
error
(
EkpConstants
.
SEND_FAILED
);
...
@@ -176,5 +187,4 @@ public class EkpOrderUtil {
...
@@ -176,5 +187,4 @@ public class EkpOrderUtil {
return
"项目订单附件同步异常:"
+
e
.
getMessage
();
return
"项目订单附件同步异常:"
+
e
.
getMessage
();
}
}
}
}
}
}
yifu-common/yifu-common-ekp/src/main/resources/ekpOrderConfig-test.properties
View file @
dc876985
#ekporder.url=http://192.168.0.228:8080/api/sys-modeling/appModelRestService/addModel
#ekporder.url=http://192.168.0.228:8080/api/sys-modeling/appModelRestService/addModel
ekporder.url
=
http://36.7.147.29:27007/api/sys-modeling/appModelRestService/addModel
ekporder.url
=
http://127.0.0.1:8080/api/sys-modeling/appModelRestService/addModel
ekporder.url2
=
http://36.7.147.29:27007/api/sys-modeling/appModelRestService/updateOrderFileInfo
ekporder.orderFdModelId
=
182f1b7ffe2e96f975564e44e559847d
ekporder.orderFdModelId
=
182f1b7ffe2e96f975564e44e559847d
ekporder.orderFdFlowId
=
182f1c098ce991ca96bc927408792beb
ekporder.orderFdFlowId
=
182f1c098ce991ca96bc927408792beb
ekporder.replyFdModelId
=
182f1bb35bb2156fb9a02904bc88dd8a
ekporder.replyFdModelId
=
182f1bb35bb2156fb9a02904bc88dd8a
...
...
yifu-order/yifu-order-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/order/service/impl/TOrderServiceImpl.java
View file @
dc876985
...
@@ -548,7 +548,7 @@ public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> impleme
...
@@ -548,7 +548,7 @@ public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> impleme
order
.
setDeptId
(
settleDomain
.
getId
());
order
.
setDeptId
(
settleDomain
.
getId
());
}
}
boolean
save
=
this
.
save
(
order
);
boolean
save
=
this
.
save
(
order
);
//异步处理附件信息同步
//异步处理附件信息同步
fxj 2024-11-22 17:46
if
(
Common
.
isNotNull
(
vo
.
getAttIds
())){
if
(
Common
.
isNotNull
(
vo
.
getAttIds
())){
this
.
syncFileFromEkp
(
order
.
getOrderNo
(),
vo
.
getAttIds
());
this
.
syncFileFromEkp
(
order
.
getOrderNo
(),
vo
.
getAttIds
());
}
}
...
@@ -572,7 +572,6 @@ public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> impleme
...
@@ -572,7 +572,6 @@ public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> impleme
ekpOrderFileTask
.
receiveOrderFileAsc
(
multipartFile
.
getInputStream
(),
vo
.
getOrderNo
(),
fileName
,
multipartFile
.
getOriginalFilename
());
ekpOrderFileTask
.
receiveOrderFileAsc
(
multipartFile
.
getInputStream
(),
vo
.
getOrderNo
(),
fileName
,
multipartFile
.
getOriginalFilename
());
}
}
}
}
return
R
.
ok
(
OrderConstants
.
OPERATE_SUCCESS
);
return
R
.
ok
(
OrderConstants
.
OPERATE_SUCCESS
);
}
}
...
@@ -764,7 +763,6 @@ public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> impleme
...
@@ -764,7 +763,6 @@ public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> impleme
* @Param
* @Param
* @return
* @return
**/
**/
@Async
@Override
@Override
public
R
<
String
>
syncFileFromEkp
(
String
orderNo
,
String
attIds
)
{
public
R
<
String
>
syncFileFromEkp
(
String
orderNo
,
String
attIds
)
{
if
(
StringUtils
.
isEmpty
(
orderNo
)){
if
(
StringUtils
.
isEmpty
(
orderNo
)){
...
...
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