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
de430d78
Commit
de430d78
authored
Nov 27, 2024
by
hongguangwu
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/MVP1.7.2' into MVP1.7.2
parents
fe1a897e
19995d59
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
97 additions
and
43 deletions
+97
-43
EkpOrderUtil.java
...va/com/yifu/cloud/plus/v1/yifu/ekp/util/EkpOrderUtil.java
+1
-2
EkpOrderController.java
...oud/plus/v1/yifu/order/controller/EkpOrderController.java
+0
-5
TOrderService.java
.../yifu/cloud/plus/v1/yifu/order/service/TOrderService.java
+0
-2
TOrderServiceImpl.java
...ud/plus/v1/yifu/order/service/impl/TOrderServiceImpl.java
+7
-34
EkpOrderFileAsyncTask.java
.../cloud/plus/v1/yifu/order/util/EkpOrderFileAsyncTask.java
+89
-0
No files found.
yifu-common/yifu-common-ekp/src/main/java/com/yifu/cloud/plus/v1/yifu/ekp/util/EkpOrderUtil.java
View file @
de430d78
...
...
@@ -153,7 +153,6 @@ public class EkpOrderUtil {
* @Param
* @return
**/
@Async
public
String
syncFileFromEkp
(
String
orderNo
,
String
attIds
){
log
.
info
(
"同步项目订单附件信息"
);
RestTemplate
yourRestTemplate
=
new
RestTemplate
();
...
...
@@ -169,7 +168,7 @@ public class EkpOrderUtil {
ResponseEntity
<
String
>
obj
=
yourRestTemplate
.
exchange
(
ekpProperties
.
getUrl2
()+
"?addIds="
+
attIds
+
"&orderNo="
+
orderNo
,
HttpMethod
.
POST
,
null
,
String
.
class
);
log
.
error
(
"附件同步结果:"
+
JSONObject
.
toJSONString
(
obj
));
String
body
=
obj
.
getBody
();
if
(
StringUtils
.
isBlank
(
body
)){
if
(
!
"推送成功"
.
equals
(
body
)){
log
.
error
(
EkpConstants
.
SEND_FAILED
);
return
EkpConstants
.
SEND_FAILED
;
}
else
{
...
...
yifu-order/yifu-order-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/order/controller/EkpOrderController.java
View file @
de430d78
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
order
.
controller
;
import
com.alibaba.fastjson.JSONObject
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.Common
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
...
...
@@ -14,7 +13,6 @@ import io.swagger.v3.oas.annotations.media.Schema;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.io.FileUtils
;
import
org.apache.commons.lang3.ArrayUtils
;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -22,11 +20,8 @@ import org.springframework.web.bind.annotation.PostMapping;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.commons.CommonsMultipartFile
;
import
javax.annotation.Resource
;
import
javax.json.Json
;
import
java.io.File
;
import
java.io.IOException
;
/**
...
...
yifu-order/yifu-order-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/order/service/TOrderService.java
View file @
de430d78
...
...
@@ -122,8 +122,6 @@ public interface TOrderService extends IService<TOrder> {
void
receiveOrderFileAsc
(
InputStream
inputStream
,
String
orderNo
,
String
fileName
,
String
originalFileName
);
R
<
String
>
syncFileFromEkp
(
String
orderNo
,
String
attIds
);
/**
* 订单作废
*
...
...
yifu-order/yifu-order-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/order/service/impl/TOrderServiceImpl.java
View file @
de430d78
...
...
@@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.sun.org.apache.bcel.internal.generic.IF_ACMPEQ
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.TSettleDomain
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.TSettleDomainListVo
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.TSettleDomainSelectVo
;
...
...
@@ -30,6 +29,7 @@ import com.yifu.cloud.plus.v1.yifu.order.service.TOrderEnclosureService;
import
com.yifu.cloud.plus.v1.yifu.order.service.TOrderHandlerService
;
import
com.yifu.cloud.plus.v1.yifu.order.service.TOrderReplyService
;
import
com.yifu.cloud.plus.v1.yifu.order.service.TOrderService
;
import
com.yifu.cloud.plus.v1.yifu.order.util.EkpOrderFileAsyncTask
;
import
com.yifu.cloud.plus.v1.yifu.order.util.EkpOrderFileTask
;
import
com.yifu.cloud.plus.v1.yifu.order.util.ValidityUtil
;
import
com.yifu.cloud.plus.v1.yifu.order.vo.*
;
...
...
@@ -39,7 +39,7 @@ import org.apache.commons.compress.utils.Lists;
import
org.apache.commons.lang3.ArrayUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.
scheduling.annotation.Async
;
import
org.springframework.
beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.multipart.MultipartFile
;
...
...
@@ -78,6 +78,8 @@ public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> impleme
private
DaprUpmsProperties
daprUpmsProperties
;
@Resource
private
TOrderFileSyncLogMapper
orderFileSyncLogMapper
;
@Autowired
private
EkpOrderFileAsyncTask
ekpOrderFileAsyncTask
;
/**
* 订单列表分页查询
...
...
@@ -752,29 +754,7 @@ public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> impleme
return
R
.
ok
();
}
/**
* @Author fxj
* @Description 同步项目订单附件 (EKP=>HRO)
* @Date 15:59 2024/11/15
* @Param
* @return
**/
@Override
public
R
<
String
>
syncFileFromEkp
(
String
orderNo
,
String
attIds
)
{
log
.
error
(
"I AM HERE 2"
);
if
(
StringUtils
.
isEmpty
(
orderNo
)){
return
R
.
failed
(
OrderConstants
.
ORDER_NO_IS_EMPTY
);
}
if
(
StringUtils
.
isEmpty
(
attIds
)){
return
R
.
failed
(
OrderConstants
.
ENCLOSURE_ID_IS_EMPTY
);
}
String
res
=
ekpOrderUtil
.
syncFileFromEkp
(
orderNo
,
attIds
);
if
(
Common
.
isNotNull
(
res
)){
log
.
error
(
"I AM HERE 1"
+
res
);
return
R
.
failed
(
res
);
}
return
R
.
ok
(
OrderConstants
.
OPERATE_SUCCESS
);
}
/**
* @Author fxj
* @Description 记录及更新附件同步信息
...
...
@@ -815,14 +795,7 @@ public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> impleme
if
(
Common
.
isEmpty
(
log
)){
return
R
.
failed
(
CommonConstants
.
NO_DATA_TO_HANDLE
);
}
R
<
String
>
res
=
syncFileFromEkp
(
log
.
getOrderNo
(),
log
.
getAttIds
());
if
(
Common
.
isNotNull
(
res
)
&&
CommonConstants
.
SUCCESS
.
intValue
()
==
res
.
getCode
()){
// 记录到数据库 失败的部分可在前端列表重试
this
.
saveFileSyncLog
(
log
.
getOrderNo
(),
log
.
getAttIds
(),
null
,
id
);
}
else
{
// 记录到数据库 失败的部分可在前端列表重试
this
.
saveFileSyncLog
(
log
.
getOrderNo
(),
log
.
getAttIds
(),
res
.
getMsg
(),
id
);
}
return
res
;
ekpOrderFileAsyncTask
.
syncFileFromEkp
(
log
.
getOrderNo
(),
log
.
getAttIds
(),
id
);
return
R
.
ok
();
}
}
yifu-order/yifu-order-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/order/util/EkpOrderFileAsyncTask.java
0 → 100644
View file @
de430d78
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
order
.
util
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.Common
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
com.yifu.cloud.plus.v1.yifu.ekp.util.EkpOrderUtil
;
import
com.yifu.cloud.plus.v1.yifu.order.constants.OrderConstants
;
import
com.yifu.cloud.plus.v1.yifu.order.entity.TOrderFileSyncLog
;
import
com.yifu.cloud.plus.v1.yifu.order.mapper.TOrderFileSyncLogMapper
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.Resource
;
import
java.time.LocalDateTime
;
/**
* @Author fxj
* @Date 2023/6/25
* @Description
* @Version 1.0
*/
@Slf4j
@Component
public
class
EkpOrderFileAsyncTask
{
@Resource
private
EkpOrderUtil
ekpOrderUtil
;
@Resource
private
TOrderFileSyncLogMapper
orderFileSyncLogMapper
;
/**
* @Author fxj
* @Description 同步项目订单附件 (EKP=>HRO)
* @Date 15:59 2024/11/15
* @Param
* @return
**/
@Async
public
R
<
String
>
syncFileFromEkp
(
String
orderNo
,
String
attIds
,
String
id
)
{
if
(
StringUtils
.
isEmpty
(
orderNo
)){
return
R
.
failed
(
OrderConstants
.
ORDER_NO_IS_EMPTY
);
}
if
(
StringUtils
.
isEmpty
(
attIds
)){
return
R
.
failed
(
OrderConstants
.
ENCLOSURE_ID_IS_EMPTY
);
}
String
res
=
ekpOrderUtil
.
syncFileFromEkp
(
orderNo
,
attIds
);
if
(!
Common
.
isNotNull
(
res
)){
// 记录到数据库 失败的部分可在前端列表重试
this
.
saveFileSyncLog
(
orderNo
,
attIds
,
null
,
id
);
}
else
{
// 记录到数据库 失败的部分可在前端列表重试
this
.
saveFileSyncLog
(
orderNo
,
attIds
,
res
,
id
);
}
return
R
.
ok
(
OrderConstants
.
OPERATE_SUCCESS
);
}
/**
* @Author fxj
* @Description 记录及更新附件同步信息
* @Date 17:45 2024/11/15
* @Param
* @return
**/
private
void
saveFileSyncLog
(
String
orderNo
,
String
attIds
,
String
msg
,
String
id
){
TOrderFileSyncLog
log
=
new
TOrderFileSyncLog
();
if
(
Common
.
isNotNull
(
id
)){
log
.
setId
(
id
);
if
(
Common
.
isEmpty
(
msg
)){
log
.
setReason
(
CommonConstants
.
EMPTY_STRING
);
log
.
setFlag
(
CommonConstants
.
ZERO_STRING
);
}
else
{
log
.
setReason
(
msg
);
}
log
.
setUpdateTime
(
LocalDateTime
.
now
());
orderFileSyncLogMapper
.
updateById
(
log
);
}
else
{
log
.
setOrderNo
(
orderNo
);
log
.
setAttIds
(
attIds
);
log
.
setCreateTime
(
LocalDateTime
.
now
());
log
.
setReason
(
msg
);
log
.
setFlag
(
CommonConstants
.
ONE_STRING
);
orderFileSyncLogMapper
.
insert
(
log
);
}
}
}
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