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
b6e54458
Commit
b6e54458
authored
Nov 25, 2024
by
hongguangwu
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/MVP1.7.2' into MVP1.7.2
parents
10bd1225
a411162a
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
908 additions
and
25 deletions
+908
-25
EkpOrderUtil.java
...va/com/yifu/cloud/plus/v1/yifu/ekp/util/EkpOrderUtil.java
+48
-2
EkpOrderParam.java
...ava/com/yifu/cloud/plus/v1/yifu/ekp/vo/EkpOrderParam.java
+11
-0
ekpOrderConfig-test.properties
...mon-ekp/src/main/resources/ekpOrderConfig-test.properties
+1
-0
TOrder.java
...java/com/yifu/cloud/plus/v1/yifu/order/entity/TOrder.java
+6
-0
TOrderFileSyncLog.java
...fu/cloud/plus/v1/yifu/order/entity/TOrderFileSyncLog.java
+88
-0
OrderAddVO.java
...java/com/yifu/cloud/plus/v1/yifu/order/vo/OrderAddVO.java
+5
-1
OrderAttVo.java
...java/com/yifu/cloud/plus/v1/yifu/order/vo/OrderAttVo.java
+6
-0
TOrderFileSyncLogSearchVo.java
...loud/plus/v1/yifu/order/vo/TOrderFileSyncLogSearchVo.java
+51
-0
TOrderFileSyncLogVo.java
...yifu/cloud/plus/v1/yifu/order/vo/TOrderFileSyncLogVo.java
+86
-0
EkpOrderController.java
...oud/plus/v1/yifu/order/controller/EkpOrderController.java
+17
-1
TOrderFileSyncLogController.java
...v1/yifu/order/controller/TOrderFileSyncLogController.java
+62
-0
TOrderFileSyncLogMapper.java
...ud/plus/v1/yifu/order/mapper/TOrderFileSyncLogMapper.java
+42
-0
TOrderFileSyncLogService.java
.../plus/v1/yifu/order/service/TOrderFileSyncLogService.java
+52
-0
TOrderService.java
.../yifu/cloud/plus/v1/yifu/order/service/TOrderService.java
+5
-1
TOrderFileSyncLogServiceImpl.java
...yifu/order/service/impl/TOrderFileSyncLogServiceImpl.java
+248
-0
TOrderServiceImpl.java
...ud/plus/v1/yifu/order/service/impl/TOrderServiceImpl.java
+99
-18
EkpOrderFileTask.java
.../yifu/cloud/plus/v1/yifu/order/util/EkpOrderFileTask.java
+2
-2
TOrderFileSyncLogMapper.xml
...biz/src/main/resources/mapper/TOrderFileSyncLogMapper.xml
+79
-0
No files found.
yifu-common/yifu-common-ekp/src/main/java/com/yifu/cloud/plus/v1/yifu/ekp/util/EkpOrderUtil.java
View file @
b6e54458
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.constant.EkpConstants
;
import
com.yifu.cloud.plus.v1.yifu.ekp.vo.EkpOrderParam
;
...
...
@@ -13,6 +16,8 @@ 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.scheduling.annotation.Async
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.LinkedMultiValueMap
;
import
org.springframework.util.MultiValueMap
;
import
org.springframework.web.client.RestTemplate
;
...
...
@@ -29,6 +34,7 @@ import java.util.List;
*/
@Log4j2
@EnableConfigurationProperties
(
EkpOrderProperties
.
class
)
@Component
public
class
EkpOrderUtil
{
@Autowired
private
EkpOrderProperties
ekpProperties
;
...
...
@@ -139,6 +145,46 @@ public class EkpOrderUtil {
});
}
}
/**
* @Author fxj
* @Description 同步项目订单的附件信息(含删除的附件)
* @Date 15:10 2024/11/15
* @Param
* @return
**/
@Async
public
String
syncFileFromEkp
(
String
orderNo
,
String
attIds
){
log
.
info
(
"同步项目订单附件信息"
);
RestTemplate
yourRestTemplate
=
new
RestTemplate
();
String
formValues
=
"{}"
;
try
{
//指向EKP的接口url
//把ModelingAppModelParameterAddForm转换成MultiValueMap
MultiValueMap
<
String
,
Object
>
wholeForm
=
new
LinkedMultiValueMap
<>();
wholeForm
.
add
(
"orderNo"
,
orderNo
);
wholeForm
.
add
(
"attIds"
,
attIds
);
wholeForm
.
add
(
"fileFlag"
,
CommonConstants
.
ZERO_STRING
);
wholeForm
.
add
(
"formValues"
,
formValues
);
HttpHeaders
headers
=
new
HttpHeaders
();
//如果EKP对该接口启用了Basic认证,那么客户端需要加入
//addAuth(headers,"yourAccount"+":"+"yourPassword");是VO,则使用APPLICATION_JSON
headers
.
setContentType
(
MediaType
.
MULTIPART_FORM_DATA
);
//必须设置上传类型,如果入参是字符串,使用MediaType.TEXT_PLAIN;如果
HttpEntity
<
MultiValueMap
<
String
,
Object
>>
entity
=
new
HttpEntity
<
MultiValueMap
<
String
,
Object
>>(
wholeForm
,
headers
);
//有返回值的情况 VO可以替换成具体的JavaBean
ResponseEntity
<
String
>
obj
=
yourRestTemplate
.
exchange
(
ekpProperties
.
getUrl
(),
HttpMethod
.
POST
,
entity
,
String
.
class
);
log
.
error
(
"附件同步结果:"
+
JSONObject
.
toJSONString
(
obj
));
String
body
=
obj
.
getBody
();
if
(
StringUtils
.
isBlank
(
body
)){
log
.
error
(
EkpConstants
.
SEND_FAILED
);
return
EkpConstants
.
SEND_FAILED
;
}
else
{
log
.
info
(
EkpConstants
.
SEND_SUCCESS
+
body
);
return
null
;
}
}
catch
(
Exception
e
){
log
.
error
(
e
);
return
"项目订单附件同步异常:"
+
e
.
getMessage
();
}
}
}
yifu-common/yifu-common-ekp/src/main/java/com/yifu/cloud/plus/v1/yifu/ekp/vo/EkpOrderParam.java
View file @
b6e54458
...
...
@@ -20,4 +20,15 @@ public class EkpOrderParam implements Serializable {
* 订单状态 待处理,处理中,已办结
**/
private
String
fd_3b0b02a34a0134
;
/**
* 附件IDS 目前用于项目订单附件同步
**/
private
String
attIds
;
/**
* 项目订单ID 与 附件attIds 配合使用
**/
private
String
orderNo
;
}
yifu-common/yifu-common-ekp/src/main/resources/ekpOrderConfig-test.properties
View file @
b6e54458
...
...
@@ -9,5 +9,6 @@ ekporder.docStatus=20
ekporder.LoginName
=
admin
ekporder.orderDocSubject
=
\u7528\u
4E8E
\u9879\u
76EE
\u
8BA2
\u5355\u
66F4
\u
65B0
\u
63A5
\u
53E3
ekporder.replyDocSubject
=
\u7528\u
4E8E
\u
8BA2
\u5355\u
56DE
\u
590D
\u
63A5
\u
53E3
ekporder.updateOrderFile
=
\u
540C
\u
6B65
\u9644\u
4EF6
\u
4FE1
\u
606F
yifu-order/yifu-order-api/src/main/java/com/yifu/cloud/plus/v1/yifu/order/entity/TOrder.java
View file @
b6e54458
...
...
@@ -380,4 +380,10 @@ public class TOrder implements Serializable {
@Schema
(
description
=
"其他项费用"
)
private
String
otherExpenses
;
/**
* 附件ID集合
*/
@Schema
(
description
=
"附件ID集合"
)
private
String
attIds
;
}
\ No newline at end of file
yifu-order/yifu-order-api/src/main/java/com/yifu/cloud/plus/v1/yifu/order/entity/TOrderFileSyncLog.java
0 → 100644
View file @
b6e54458
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
order
.
entity
;
import
com.alibaba.excel.annotation.ExcelProperty
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute
;
import
com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
org.hibernate.validator.constraints.Length
;
import
java.util.Date
;
/**
* 项目订单附件同步日志信息
*
* @author fxj
* @date 2024-11-15 17:21:46
*/
@Data
@TableName
(
"t_order_file_sync_log"
)
@EqualsAndHashCode
(
callSuper
=
true
)
@Schema
(
description
=
"项目订单附件同步日志信息"
)
public
class
TOrderFileSyncLog
extends
BaseEntity
{
/**
* 主键
*/
@TableId
(
type
=
IdType
.
ASSIGN_ID
)
@ExcelProperty
(
"主键"
)
@Schema
(
description
=
"主键"
)
private
String
id
;
/**
* 项目单号
*/
@ExcelAttribute
(
name
=
"项目单号"
,
maxLength
=
30
)
@Length
(
max
=
30
,
message
=
"项目单号不能超过30个字符"
)
@ExcelProperty
(
"项目单号"
)
@Schema
(
description
=
"项目单号"
)
private
String
orderNo
;
/**
* 附件IDS
*/
@ExcelAttribute
(
name
=
"附件IDS"
,
maxLength
=
500
)
@Length
(
max
=
500
,
message
=
"附件IDS不能超过500个字符"
)
@ExcelProperty
(
"附件IDS"
)
@Schema
(
description
=
"附件IDS"
)
private
String
attIds
;
/**
* 失败原因
*/
@ExcelAttribute
(
name
=
"失败原因"
)
@ExcelProperty
(
"失败原因"
)
@Schema
(
description
=
"失败原因"
)
private
String
reason
;
/**
* 重试结果:0 成功 1 失败
*/
@ExcelAttribute
(
name
=
"重试结果:0 成功 1 失败"
,
maxLength
=
1
)
@Length
(
max
=
1
,
message
=
"重试结果:0 成功 1 失败不能超过1个字符"
)
@ExcelProperty
(
"重试结果:0 成功 1 失败"
)
@Schema
(
description
=
"重试结果:0 成功 1 失败"
)
private
String
flag
;
}
yifu-order/yifu-order-api/src/main/java/com/yifu/cloud/plus/v1/yifu/order/vo/OrderAddVO.java
View file @
b6e54458
...
...
@@ -420,6 +420,10 @@ public class OrderAddVO implements Serializable {
private
MultipartFile
[]
salaryHandoverFile
;
/**
* 附件ID集合
*/
@Schema
(
description
=
"附件ID集合"
)
private
String
attIds
;
}
yifu-order/yifu-order-api/src/main/java/com/yifu/cloud/plus/v1/yifu/order/vo/OrderAttVo.java
View file @
b6e54458
...
...
@@ -32,4 +32,10 @@ public class OrderAttVo implements Serializable {
@Schema
(
description
=
"附件"
)
private
MultipartFile
[]
file
;
/**
* 附件ID
*/
@Schema
(
description
=
"附件ID"
)
private
String
fileIds
;
}
yifu-order/yifu-order-api/src/main/java/com/yifu/cloud/plus/v1/yifu/order/vo/TOrderFileSyncLogSearchVo.java
0 → 100644
View file @
b6e54458
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
order
.
vo
;
import
com.yifu.cloud.plus.v1.yifu.order.entity.TOrderFileSyncLog
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.Data
;
/**
* 项目订单附件同步日志信息
*
* @author fxj
* @date 2024-11-15 17:21:46
*/
@Data
public
class
TOrderFileSyncLogSearchVo
extends
TOrderFileSyncLog
{
/**
* 多选导出或删除等操作
*/
@Schema
(
description
=
"选中ID,多个逗号分割"
)
private
String
ids
;
/**
* @Author fxj
* 查询数据起
**/
@Schema
(
description
=
"查询limit 开始"
)
private
int
limitStart
;
/**
* @Author fxj
* 查询数据止
**/
@Schema
(
description
=
"查询limit 数据条数"
)
private
int
limitEnd
;
}
yifu-order/yifu-order-api/src/main/java/com/yifu/cloud/plus/v1/yifu/order/vo/TOrderFileSyncLogVo.java
0 → 100644
View file @
b6e54458
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
order
.
vo
;
import
com.alibaba.excel.annotation.ExcelProperty
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute
;
import
com.yifu.cloud.plus.v1.yifu.common.core.vo.RowIndex
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.Data
;
import
org.hibernate.validator.constraints.Length
;
import
javax.validation.constraints.NotBlank
;
import
java.io.Serializable
;
/**
* 项目订单附件同步日志信息
*
* @author fxj
* @date 2024-11-15 17:21:46
*/
@Data
public
class
TOrderFileSyncLogVo
extends
RowIndex
implements
Serializable
{
/**
* 主键
*/
@TableId
(
type
=
IdType
.
ASSIGN_ID
)
@NotBlank
(
message
=
"主键 不能为空"
)
@Length
(
max
=
32
,
message
=
"主键 不能超过32 个字符"
)
@ExcelAttribute
(
name
=
"主键"
,
isNotEmpty
=
true
,
errorInfo
=
"主键 不能为空"
,
maxLength
=
32
)
@Schema
(
description
=
"主键"
)
@ExcelProperty
(
"主键"
)
private
String
id
;
/**
* 项目单号
*/
@Length
(
max
=
30
,
message
=
"项目单号 不能超过30 个字符"
)
@ExcelAttribute
(
name
=
"项目单号"
,
maxLength
=
30
)
@Schema
(
description
=
"项目单号"
)
@ExcelProperty
(
"项目单号"
)
private
String
orderNo
;
/**
* 附件IDS
*/
@Length
(
max
=
500
,
message
=
"附件IDS 不能超过500 个字符"
)
@ExcelAttribute
(
name
=
"附件IDS"
,
maxLength
=
500
)
@Schema
(
description
=
"附件IDS"
)
@ExcelProperty
(
"附件IDS"
)
private
String
attIds
;
/**
* 失败原因
*/
@ExcelAttribute
(
name
=
"失败原因"
)
@Schema
(
description
=
"失败原因"
)
@ExcelProperty
(
"失败原因"
)
private
String
reason
;
/**
* 重试结果:0 成功 1 失败
*/
@Length
(
max
=
1
,
message
=
"重试结果:0 成功 1 失败 不能超过1 个字符"
)
@ExcelAttribute
(
name
=
"重试结果:0 成功 1 失败"
,
maxLength
=
1
)
@Schema
(
description
=
"重试结果:0 成功 1 失败"
)
@ExcelProperty
(
"重试结果:0 成功 1 失败"
)
private
String
flag
;
}
yifu-order/yifu-order-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/order/controller/EkpOrderController.java
View file @
b6e54458
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
;
...
...
@@ -15,6 +16,7 @@ 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
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
...
...
@@ -52,6 +54,7 @@ public class EkpOrderController {
@Schema
(
description
=
"接收处理ekp订单"
)
@PostMapping
(
value
=
"/receiveOrder"
)
public
R
receiveOrder
(
OrderAddVO
vo
)
throws
IOException
{
log
.
error
(
"#################################"
+
JSONObject
.
toJSONString
(
vo
));
return
tOrderService
.
receiveOrder
(
vo
,
ekpOrderFileTask
);
}
...
...
@@ -84,7 +87,7 @@ public class EkpOrderController {
}
fileName
=
System
.
currentTimeMillis
()
+
"_"
+
multipartFile
.
getOriginalFilename
();
ekpOrderFileTask
.
receiveOrderNew
(
multipartFile
.
getInputStream
(),
vo
.
getFile1
(),
vo
.
getOrderNo
(),
fileName
,
multipartFile
.
getOriginalFilename
());
,
multipartFile
.
getOriginalFilename
()
,
vo
.
getFileIds
()
);
}
}
return
R
.
ok
();
...
...
@@ -104,4 +107,17 @@ public class EkpOrderController {
return
tOrderService
.
receiveOrderReply
(
vo
);
}
/**
* @Author fxj
* @Description 重试附件同步接口
* @Date 16:45 2024/11/15
* @Param
* @return
**/
@Schema
(
description
=
"重试附件同步接口"
)
@PostMapping
(
value
=
"/retrySyncFileFromEkp"
)
public
R
<
String
>
syncFileFromEkp
(
@Param
(
"id"
)
String
id
){
return
tOrderService
.
syncFileFromEkpInterface
(
id
);
}
}
yifu-order/yifu-order-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/order/controller/TOrderFileSyncLogController.java
0 → 100644
View file @
b6e54458
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
order
.
controller
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
com.yifu.cloud.plus.v1.yifu.order.entity.TOrderFileSyncLog
;
import
com.yifu.cloud.plus.v1.yifu.order.service.TOrderFileSyncLogService
;
import
com.yifu.cloud.plus.v1.yifu.order.vo.TOrderFileSyncLogSearchVo
;
import
io.swagger.v3.oas.annotations.Operation
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
/**
* 项目订单附件同步日志信息
*
* @author fxj
* @date 2024-11-15 17:21:46
*/
@RestController
@RequiredArgsConstructor
@RequestMapping
(
"/torderfilesynclog"
)
@Tag
(
name
=
"项目订单附件同步日志信息管理"
)
public
class
TOrderFileSyncLogController
{
private
final
TOrderFileSyncLogService
tOrderFileSyncLogService
;
/**
* 简单分页查询
*
* @param page 分页对象
* @param tOrderFileSyncLog 项目订单附件同步日志信息
* @return
*/
@Operation
(
description
=
"简单分页查询"
)
@GetMapping
(
"/page"
)
public
R
<
IPage
<
TOrderFileSyncLog
>>
getTOrderFileSyncLogPage
(
Page
<
TOrderFileSyncLog
>
page
,
TOrderFileSyncLogSearchVo
tOrderFileSyncLog
)
{
return
new
R
<>(
tOrderFileSyncLogService
.
getTOrderFileSyncLogPage
(
page
,
tOrderFileSyncLog
));
}
}
yifu-order/yifu-order-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/order/mapper/TOrderFileSyncLogMapper.java
0 → 100644
View file @
b6e54458
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
order
.
mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yifu.cloud.plus.v1.yifu.order.entity.TOrderFileSyncLog
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
/**
* 项目订单附件同步日志信息
*
* @author fxj
* @date 2024-11-15 17:21:46
*/
@Mapper
public
interface
TOrderFileSyncLogMapper
extends
BaseMapper
<
TOrderFileSyncLog
>
{
/**
* 项目订单附件同步日志信息简单分页查询
*
* @param tOrderFileSyncLog 项目订单附件同步日志信息
* @return
*/
IPage
<
TOrderFileSyncLog
>
getTOrderFileSyncLogPage
(
Page
<
TOrderFileSyncLog
>
page
,
@Param
(
"tOrderFileSyncLog"
)
TOrderFileSyncLog
tOrderFileSyncLog
);
}
yifu-order/yifu-order-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/order/service/TOrderFileSyncLogService.java
0 → 100644
View file @
b6e54458
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
order
.
service
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
com.yifu.cloud.plus.v1.yifu.order.entity.TOrderFileSyncLog
;
import
com.yifu.cloud.plus.v1.yifu.order.vo.TOrderFileSyncLogSearchVo
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.InputStream
;
import
java.util.List
;
/**
* 项目订单附件同步日志信息
*
* @author fxj
* @date 2024-11-15 17:21:46
*/
public
interface
TOrderFileSyncLogService
extends
IService
<
TOrderFileSyncLog
>
{
/**
* 项目订单附件同步日志信息简单分页查询
*
* @param tOrderFileSyncLog 项目订单附件同步日志信息
* @return
*/
IPage
<
TOrderFileSyncLog
>
getTOrderFileSyncLogPage
(
Page
<
TOrderFileSyncLog
>
page
,
TOrderFileSyncLogSearchVo
tOrderFileSyncLog
);
R
<
List
<
ErrorMessage
>>
importDiy
(
InputStream
inputStream
);
void
listExport
(
HttpServletResponse
response
,
TOrderFileSyncLogSearchVo
searchVo
);
List
<
TOrderFileSyncLog
>
noPageDiy
(
TOrderFileSyncLogSearchVo
searchVo
);
}
yifu-order/yifu-order-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/order/service/TOrderService.java
View file @
b6e54458
...
...
@@ -118,10 +118,12 @@ public interface TOrderService extends IService<TOrder> {
* @return {@link R}
* @throws IOException
*/
void
receiveOrderNew
(
InputStream
inputStream
,
String
file1
,
String
orderNo
,
String
fileName
,
String
originalFileName
)
throws
IOException
;
void
receiveOrderNew
(
InputStream
inputStream
,
String
file1
,
String
orderNo
,
String
fileName
,
String
originalFileName
,
String
fileIds
)
throws
IOException
;
void
receiveOrderFileAsc
(
InputStream
inputStream
,
String
orderNo
,
String
fileName
,
String
originalFileName
);
R
<
String
>
syncFileFromEkp
(
String
orderNo
,
String
attIds
);
/**
* 订单作废
*
...
...
@@ -130,4 +132,6 @@ public interface TOrderService extends IService<TOrder> {
* @return {@link R}
*/
R
invalidOrder
(
String
id
);
R
<
String
>
syncFileFromEkpInterface
(
String
id
);
}
yifu-order/yifu-order-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/order/service/impl/TOrderFileSyncLogServiceImpl.java
0 → 100644
View file @
b6e54458
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
order
.
service
.
impl
;
import
cn.hutool.core.bean.BeanUtil
;
import
com.alibaba.excel.EasyExcel
;
import
com.alibaba.excel.ExcelWriter
;
import
com.alibaba.excel.context.AnalysisContext
;
import
com.alibaba.excel.read.listener.ReadListener
;
import
com.alibaba.excel.read.metadata.holder.ReadRowHolder
;
import
com.alibaba.excel.util.ListUtils
;
import
com.alibaba.excel.write.metadata.WriteSheet
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
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.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.*
;
import
com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity
;
import
com.yifu.cloud.plus.v1.yifu.order.entity.TOrderFileSyncLog
;
import
com.yifu.cloud.plus.v1.yifu.order.mapper.TOrderFileSyncLogMapper
;
import
com.yifu.cloud.plus.v1.yifu.order.service.TOrderFileSyncLogService
;
import
com.yifu.cloud.plus.v1.yifu.order.vo.TOrderFileSyncLogSearchVo
;
import
com.yifu.cloud.plus.v1.yifu.order.vo.TOrderFileSyncLogVo
;
import
lombok.extern.log4j.Log4j2
;
import
org.springframework.stereotype.Service
;
import
javax.servlet.ServletOutputStream
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.net.URLEncoder
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* 项目订单附件同步日志信息
*
* @author fxj
* @date 2024-11-15 17:21:46
*/
@Log4j2
@Service
public
class
TOrderFileSyncLogServiceImpl
extends
ServiceImpl
<
TOrderFileSyncLogMapper
,
TOrderFileSyncLog
>
implements
TOrderFileSyncLogService
{
/**
* 项目订单附件同步日志信息简单分页查询
*
* @param tOrderFileSyncLog 项目订单附件同步日志信息
* @return
*/
@Override
public
IPage
<
TOrderFileSyncLog
>
getTOrderFileSyncLogPage
(
Page
<
TOrderFileSyncLog
>
page
,
TOrderFileSyncLogSearchVo
tOrderFileSyncLog
)
{
return
baseMapper
.
getTOrderFileSyncLogPage
(
page
,
tOrderFileSyncLog
);
}
/**
* 项目订单附件同步日志信息批量导出
*
* @param searchVo 项目订单附件同步日志信息
* @return
*/
@Override
public
void
listExport
(
HttpServletResponse
response
,
TOrderFileSyncLogSearchVo
searchVo
)
{
String
fileName
=
"项目订单附件同步日志信息批量导出"
+
DateUtil
.
getThisTime
()
+
".xlsx"
;
//获取要导出的列表
List
<
TOrderFileSyncLog
>
list
=
new
ArrayList
<>();
long
count
=
noPageCountDiy
(
searchVo
);
ServletOutputStream
out
=
null
;
try
{
out
=
response
.
getOutputStream
();
response
.
setContentType
(
CommonConstants
.
MULTIPART_FORM_DATA
);
response
.
setCharacterEncoding
(
"utf-8"
);
response
.
setHeader
(
CommonConstants
.
CONTENT_DISPOSITION
,
CommonConstants
.
ATTACHMENT_FILENAME
+
URLEncoder
.
encode
(
fileName
,
CommonConstants
.
UTF8
));
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
//EasyExcel.write(out, TEmpBadRecord.class).sheet("不良记录").doWrite(list);
ExcelWriter
excelWriter
=
EasyExcel
.
write
(
out
,
TOrderFileSyncLog
.
class
).
build
();
int
index
=
0
;
if
(
count
>
CommonConstants
.
ZERO_INT
)
{
for
(
int
i
=
0
;
i
<=
count
;
)
{
// 获取实际记录
searchVo
.
setLimitStart
(
i
);
searchVo
.
setLimitEnd
(
CommonConstants
.
EXCEL_EXPORT_LIMIT
);
list
=
noPageDiy
(
searchVo
);
if
(
Common
.
isNotNull
(
list
))
{
ExcelUtil
<
TOrderFileSyncLog
>
util
=
new
ExcelUtil
<>(
TOrderFileSyncLog
.
class
);
for
(
TOrderFileSyncLog
vo
:
list
)
{
util
.
convertEntity
(
vo
,
null
,
null
,
null
);
}
}
if
(
Common
.
isNotNull
(
list
))
{
WriteSheet
writeSheet
=
EasyExcel
.
writerSheet
(
"项目订单附件同步日志信息"
+
index
).
build
();
excelWriter
.
write
(
list
,
writeSheet
);
index
++;
}
i
=
i
+
CommonConstants
.
EXCEL_EXPORT_LIMIT
;
if
(
Common
.
isNotNull
(
list
))
{
list
.
clear
();
}
}
}
else
{
WriteSheet
writeSheet
=
EasyExcel
.
writerSheet
(
"项目订单附件同步日志信息"
+
index
).
build
();
excelWriter
.
write
(
list
,
writeSheet
);
}
if
(
Common
.
isNotNull
(
list
))
{
list
.
clear
();
}
out
.
flush
();
excelWriter
.
finish
();
}
catch
(
Exception
e
)
{
log
.
error
(
"执行异常"
,
e
);
}
finally
{
try
{
if
(
null
!=
out
)
{
out
.
close
();
}
}
catch
(
IOException
e
)
{
log
.
error
(
"执行异常"
,
e
);
}
}
}
@Override
public
List
<
TOrderFileSyncLog
>
noPageDiy
(
TOrderFileSyncLogSearchVo
searchVo
)
{
LambdaQueryWrapper
<
TOrderFileSyncLog
>
wrapper
=
buildQueryWrapper
(
searchVo
);
List
<
String
>
idList
=
Common
.
getList
(
searchVo
.
getIds
());
if
(
Common
.
isNotNull
(
idList
))
{
wrapper
.
in
(
TOrderFileSyncLog:
:
getId
,
idList
);
}
if
(
searchVo
.
getLimitStart
()
>=
0
&&
searchVo
.
getLimitEnd
()
>
0
)
{
wrapper
.
last
(
" limit "
+
searchVo
.
getLimitStart
()
+
","
+
searchVo
.
getLimitEnd
());
}
wrapper
.
orderByDesc
(
BaseEntity:
:
getCreateTime
);
return
baseMapper
.
selectList
(
wrapper
);
}
private
Long
noPageCountDiy
(
TOrderFileSyncLogSearchVo
searchVo
)
{
LambdaQueryWrapper
<
TOrderFileSyncLog
>
wrapper
=
buildQueryWrapper
(
searchVo
);
List
<
String
>
idList
=
Common
.
getList
(
searchVo
.
getIds
());
if
(
Common
.
isNotNull
(
idList
))
{
wrapper
.
in
(
TOrderFileSyncLog:
:
getId
,
idList
);
}
return
baseMapper
.
selectCount
(
wrapper
);
}
private
LambdaQueryWrapper
buildQueryWrapper
(
TOrderFileSyncLogSearchVo
entity
)
{
LambdaQueryWrapper
<
TOrderFileSyncLog
>
wrapper
=
Wrappers
.
lambdaQuery
();
if
(
Common
.
isNotNull
(
entity
.
getCreateName
()))
{
wrapper
.
eq
(
TOrderFileSyncLog:
:
getCreateName
,
entity
.
getCreateName
());
}
return
wrapper
;
}
@Override
public
R
<
List
<
ErrorMessage
>>
importDiy
(
InputStream
inputStream
)
{
List
<
ErrorMessage
>
errorMessageList
=
new
ArrayList
<>();
ExcelUtil
<
TOrderFileSyncLogVo
>
util1
=
new
ExcelUtil
<>(
TOrderFileSyncLogVo
.
class
);
;
// 写法2:
// 匿名内部类 不用额外写一个DemoDataListener
// 这里 需要指定读用哪个class去读,然后读取第一个sheet 文件流会自动关闭
try
{
EasyExcel
.
read
(
inputStream
,
TOrderFileSyncLogVo
.
class
,
new
ReadListener
<
TOrderFileSyncLogVo
>()
{
/**
* 单次缓存的数据量
*/
public
static
final
int
BATCH_COUNT
=
CommonConstants
.
BATCH_COUNT
;
/**
*临时存储
*/
private
List
<
TOrderFileSyncLogVo
>
cachedDataList
=
ListUtils
.
newArrayListWithExpectedSize
(
BATCH_COUNT
);
@Override
public
void
invoke
(
TOrderFileSyncLogVo
data
,
AnalysisContext
context
)
{
ReadRowHolder
readRowHolder
=
context
.
readRowHolder
();
Integer
rowIndex
=
readRowHolder
.
getRowIndex
();
data
.
setRowIndex
(
rowIndex
+
1
);
ErrorMessage
errorMessage
=
util1
.
checkEntity
(
data
,
data
.
getRowIndex
());
if
(
Common
.
isNotNull
(
errorMessage
))
{
errorMessageList
.
add
(
errorMessage
);
}
else
{
cachedDataList
.
add
(
data
);
}
if
(
cachedDataList
.
size
()
>=
BATCH_COUNT
)
{
saveData
();
// 存储完成清理 list
cachedDataList
=
ListUtils
.
newArrayListWithExpectedSize
(
BATCH_COUNT
);
}
}
@Override
public
void
doAfterAllAnalysed
(
AnalysisContext
context
)
{
saveData
();
}
/**
* 加上存储数据库
*/
private
void
saveData
()
{
log
.
info
(
"{}条数据,开始存储数据库!"
,
cachedDataList
.
size
());
importTOrderFileSyncLog
(
cachedDataList
,
errorMessageList
);
log
.
info
(
"存储数据库成功!"
);
}
}).
sheet
().
doRead
();
}
catch
(
Exception
e
)
{
log
.
error
(
CommonConstants
.
IMPORT_DATA_ANALYSIS_ERROR
,
e
);
return
R
.
failed
(
CommonConstants
.
IMPORT_DATA_ANALYSIS_ERROR
);
}
return
R
.
ok
(
errorMessageList
);
}
private
void
importTOrderFileSyncLog
(
List
<
TOrderFileSyncLogVo
>
excelVOList
,
List
<
ErrorMessage
>
errorMessageList
)
{
// 个性化校验逻辑
ErrorMessage
errorMsg
;
// 执行数据插入操作 组装
for
(
int
i
=
0
;
i
<
excelVOList
.
size
();
i
++)
{
TOrderFileSyncLogVo
excel
=
excelVOList
.
get
(
i
);
// 数据合法情况 TODO
// 插入
insertExcel
(
excel
);
errorMessageList
.
add
(
new
ErrorMessage
(
excel
.
getRowIndex
(),
CommonConstants
.
SAVE_SUCCESS
));
}
}
/**
* 插入excel bad record
*/
private
void
insertExcel
(
TOrderFileSyncLogVo
excel
)
{
TOrderFileSyncLog
insert
=
new
TOrderFileSyncLog
();
BeanUtil
.
copyProperties
(
excel
,
insert
);
this
.
save
(
insert
);
}
}
yifu-order/yifu-order-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/order/service/impl/TOrderServiceImpl.java
View file @
b6e54458
...
...
@@ -4,6 +4,7 @@ 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
;
...
...
@@ -22,10 +23,8 @@ import com.yifu.cloud.plus.v1.yifu.ekp.util.EkpOrderUtil;
import
com.yifu.cloud.plus.v1.yifu.ekp.vo.EkpOrderParam
;
import
com.yifu.cloud.plus.v1.yifu.ekp.vo.EkpOrderReplyParam
;
import
com.yifu.cloud.plus.v1.yifu.order.constants.OrderConstants
;
import
com.yifu.cloud.plus.v1.yifu.order.entity.TOrder
;
import
com.yifu.cloud.plus.v1.yifu.order.entity.TOrderEnclosure
;
import
com.yifu.cloud.plus.v1.yifu.order.entity.TOrderHandler
;
import
com.yifu.cloud.plus.v1.yifu.order.entity.TOrderReply
;
import
com.yifu.cloud.plus.v1.yifu.order.entity.*
;
import
com.yifu.cloud.plus.v1.yifu.order.mapper.TOrderFileSyncLogMapper
;
import
com.yifu.cloud.plus.v1.yifu.order.mapper.TOrderMapper
;
import
com.yifu.cloud.plus.v1.yifu.order.service.TOrderEnclosureService
;
import
com.yifu.cloud.plus.v1.yifu.order.service.TOrderHandlerService
;
...
...
@@ -40,6 +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.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.multipart.MultipartFile
;
...
...
@@ -76,6 +76,8 @@ public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> impleme
private
ArchivesDaprUtil
archivesDaprUtil
;
@Resource
private
DaprUpmsProperties
daprUpmsProperties
;
@Resource
private
TOrderFileSyncLogMapper
orderFileSyncLogMapper
;
/**
* 订单列表分页查询
...
...
@@ -546,6 +548,10 @@ public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> impleme
order
.
setDeptId
(
settleDomain
.
getId
());
}
boolean
save
=
this
.
save
(
order
);
//异步处理附件信息同步 fxj 2024-11-22 17:46
if
(
Common
.
isNotNull
(
vo
.
getAttIds
())){
this
.
syncFileFromEkp
(
order
.
getOrderNo
(),
vo
.
getAttIds
());
}
//处理指派人
if
(
save
&&
CollectionUtils
.
isNotEmpty
(
vo
.
getHandleUserList
())){
List
<
TOrderHandler
>
list
=
new
ArrayList
<>();
...
...
@@ -566,7 +572,6 @@ public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> impleme
ekpOrderFileTask
.
receiveOrderFileAsc
(
multipartFile
.
getInputStream
(),
vo
.
getOrderNo
(),
fileName
,
multipartFile
.
getOriginalFilename
());
}
}
return
R
.
ok
(
OrderConstants
.
OPERATE_SUCCESS
);
}
...
...
@@ -667,36 +672,36 @@ public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> impleme
* @throws IOException
*/
@Override
public
void
receiveOrderNew
(
InputStream
inputStream
,
String
file1
,
String
orderNo
,
String
fileName
,
String
originalFileName
){
public
void
receiveOrderNew
(
InputStream
inputStream
,
String
file1
,
String
orderNo
,
String
fileName
,
String
originalFileName
,
String
fileIds
){
R
<
Object
>
e
;
if
(
file1
.
equals
(
"fileOne"
))
{
getObjectR
(
inputStream
,
orderNo
,
fileName
,
originalFileName
,
CommonConstants
.
TWO_INTEGER
);
getObjectR
(
inputStream
,
orderNo
,
fileName
,
originalFileName
,
CommonConstants
.
TWO_INTEGER
,
fileIds
);
}
if
(
file1
.
equals
(
"fileTwo"
))
{
getObjectR
(
inputStream
,
orderNo
,
fileName
,
originalFileName
,
CommonConstants
.
THREE_INTEGER
);
getObjectR
(
inputStream
,
orderNo
,
fileName
,
originalFileName
,
CommonConstants
.
THREE_INTEGER
,
fileIds
);
}
if
(
file1
.
equals
(
"fileThree"
))
{
getObjectR
(
inputStream
,
orderNo
,
fileName
,
originalFileName
,
CommonConstants
.
FOUR_INTEGER
);
getObjectR
(
inputStream
,
orderNo
,
fileName
,
originalFileName
,
CommonConstants
.
FOUR_INTEGER
,
fileIds
);
}
if
(
file1
.
equals
(
"fileFour"
))
{
getObjectR
(
inputStream
,
orderNo
,
fileName
,
originalFileName
,
CommonConstants
.
FIVE_INTEGER
);
getObjectR
(
inputStream
,
orderNo
,
fileName
,
originalFileName
,
CommonConstants
.
FIVE_INTEGER
,
fileIds
);
}
if
(
file1
.
equals
(
"fileFive"
))
{
getObjectR
(
inputStream
,
orderNo
,
fileName
,
originalFileName
,
CommonConstants
.
SIX_INTEGER
);
getObjectR
(
inputStream
,
orderNo
,
fileName
,
originalFileName
,
CommonConstants
.
SIX_INTEGER
,
fileIds
);
}
if
(
file1
.
equals
(
"fileSix"
))
{
getObjectR
(
inputStream
,
orderNo
,
fileName
,
originalFileName
,
CommonConstants
.
SEVEN_INTEGER
);
getObjectR
(
inputStream
,
orderNo
,
fileName
,
originalFileName
,
CommonConstants
.
SEVEN_INTEGER
,
fileIds
);
}
if
(
file1
.
equals
(
"fileSeven"
))
{
getObjectR
(
inputStream
,
orderNo
,
fileName
,
originalFileName
,
CommonConstants
.
EIGHT_INTEGER
);
getObjectR
(
inputStream
,
orderNo
,
fileName
,
originalFileName
,
CommonConstants
.
EIGHT_INTEGER
,
fileIds
);
}
if
(
file1
.
equals
(
"fileEight"
))
{
getObjectR
(
inputStream
,
orderNo
,
fileName
,
originalFileName
,
CommonConstants
.
NINE_INTEGER
);
getObjectR
(
inputStream
,
orderNo
,
fileName
,
originalFileName
,
CommonConstants
.
NINE_INTEGER
,
fileIds
);
}
if
(
file1
.
equals
(
"fileNine"
))
{
getObjectR
(
inputStream
,
orderNo
,
fileName
,
originalFileName
,
CommonConstants
.
TEN_INTEGER
);
getObjectR
(
inputStream
,
orderNo
,
fileName
,
originalFileName
,
CommonConstants
.
TEN_INTEGER
,
fileIds
);
}
if
(
file1
.
equals
(
"fileTen"
))
{
getObjectR
(
inputStream
,
orderNo
,
fileName
,
originalFileName
,
CommonConstants
.
ELEVEN_INTEGER
);
getObjectR
(
inputStream
,
orderNo
,
fileName
,
originalFileName
,
CommonConstants
.
ELEVEN_INTEGER
,
fileIds
);
}
}
/**
...
...
@@ -708,11 +713,11 @@ public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> impleme
*/
@Override
public
void
receiveOrderFileAsc
(
InputStream
inputStream
,
String
orderNo
,
String
fileName
,
String
originalFileName
){
getObjectR
(
inputStream
,
orderNo
,
fileName
,
originalFileName
,
CommonConstants
.
ZERO_INT
);
getObjectR
(
inputStream
,
orderNo
,
fileName
,
originalFileName
,
CommonConstants
.
ZERO_INT
,
null
);
}
private
R
<
Object
>
getObjectR
(
InputStream
inputStream
,
String
orderNo
,
String
fileName
,
String
originalFileName
,
Integer
enclosureflag
)
{
private
R
<
Object
>
getObjectR
(
InputStream
inputStream
,
String
orderNo
,
String
fileName
,
String
originalFileName
,
Integer
enclosureflag
,
String
fileIds
)
{
//filePath不传默认存储空间的根目录
//支持的附件格式
boolean
flag
=
ossUtil
.
uploadFileByStream
(
inputStream
,
fileName
,
null
);
...
...
@@ -729,9 +734,13 @@ public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> impleme
}
catch
(
Exception
e
)
{
log
.
error
(
"订单接收OSS文件上传接口异常:"
+
e
.
getMessage
());
ossUtil
.
deleteObject
(
null
,
fileName
);
// 记录到数据库 失败的部分可在前端列表重试
saveFileSyncLog
(
orderNo
,
fileIds
,
e
.
getMessage
(),
null
);
return
R
.
failed
(
"failed:"
+
e
.
getMessage
());
}
}
else
{
// 记录到数据库 失败的部分可在前端列表重试
saveFileSyncLog
(
orderNo
,
fileIds
,
OrderConstants
.
OPERATE_FAILED
+
"OSS上传异常"
,
null
);
return
R
.
failed
(
OrderConstants
.
OPERATE_FAILED
);
}
return
null
;
...
...
@@ -746,4 +755,76 @@ public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> impleme
baseMapper
.
updateById
(
one
);
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
)
{
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
)){
return
R
.
failed
(
res
);
}
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
);
}
}
@Override
public
R
<
String
>
syncFileFromEkpInterface
(
String
id
)
{
if
(
Common
.
isEmpty
(
id
)){
return
R
.
failed
(
CommonConstants
.
PARAM_IS_NOT_ERROR
);
}
TOrderFileSyncLog
log
=
orderFileSyncLogMapper
.
selectOne
(
Wrappers
.<
TOrderFileSyncLog
>
query
().
lambda
().
eq
(
TOrderFileSyncLog:
:
getId
,
id
));
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
;
}
}
yifu-order/yifu-order-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/order/util/EkpOrderFileTask.java
View file @
b6e54458
...
...
@@ -28,10 +28,10 @@ public class EkpOrderFileTask {
* @return
**/
@Async
public
void
receiveOrderNew
(
InputStream
inputStream
,
String
file1
,
String
orderNo
,
String
fileName
,
String
originalFileName
){
public
void
receiveOrderNew
(
InputStream
inputStream
,
String
file1
,
String
orderNo
,
String
fileName
,
String
originalFileName
,
String
fileIds
){
synchronized
(
this
){
try
{
orderService
.
receiveOrderNew
(
inputStream
,
file1
,
orderNo
,
fileName
,
originalFileName
);
orderService
.
receiveOrderNew
(
inputStream
,
file1
,
orderNo
,
fileName
,
originalFileName
,
fileIds
);
}
catch
(
IOException
e
)
{
log
.
error
(
"订单附件上传异常:"
,
e
);
}
...
...
yifu-order/yifu-order-biz/src/main/resources/mapper/TOrderFileSyncLogMapper.xml
0 → 100644
View file @
b6e54458
<?xml version="1.0" encoding="UTF-8"?>
<!--
~
~ Copyright (c) 2018-2025, lengleng All rights reserved.
~
~ Redistribution and use in source and binary forms, with or without
~ modification, are permitted provided that the following conditions are met:
~
~ Redistributions of source code must retain the above copyright notice,
~ this list of conditions and the following disclaimer.
~ Redistributions in binary form must reproduce the above copyright
~ notice, this list of conditions and the following disclaimer in the
~ documentation and/or other materials provided with the distribution.
~ Neither the name of the yifu4cloud.com developer nor the names of its
~ contributors may be used to endorse or promote products derived from
~ this software without specific prior written permission.
~ Author: lengleng (wangiegie@gmail.com)
~
-->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.yifu.cloud.plus.v1.yifu.order.mapper.TOrderFileSyncLogMapper"
>
<resultMap
id=
"tOrderFileSyncLogMap"
type=
"com.yifu.cloud.plus.v1.yifu.order.entity.TOrderFileSyncLog"
>
<id
property=
"id"
column=
"id"
/>
<result
property=
"orderNo"
column=
"order_no"
/>
<result
property=
"attIds"
column=
"att_ids"
/>
<result
property=
"reason"
column=
"reason"
/>
<result
property=
"createTime"
column=
"create_time"
/>
<result
property=
"flag"
column=
"flag"
/>
<result
property=
"updateTime"
column=
"update_time"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
a.id,
a.order_no,
a.att_ids,
a.reason,
a.create_time,
a.flag,
a.update_time
</sql>
<sql
id=
"tOrderFileSyncLog_where"
>
<if
test=
"tOrderFileSyncLog != null"
>
<if
test=
"tOrderFileSyncLog.id != null and tOrderFileSyncLog.id.trim() != ''"
>
AND a.id = #{tOrderFileSyncLog.id}
</if>
<if
test=
"tOrderFileSyncLog.orderNo != null and tOrderFileSyncLog.orderNo.trim() != ''"
>
AND a.order_no = #{tOrderFileSyncLog.orderNo}
</if>
<if
test=
"tOrderFileSyncLog.attIds != null and tOrderFileSyncLog.attIds.trim() != ''"
>
AND a.att_ids = #{tOrderFileSyncLog.attIds}
</if>
<if
test=
"tOrderFileSyncLog.reason != null and tOrderFileSyncLog.reason.trim() != ''"
>
AND a.reason = #{tOrderFileSyncLog.reason}
</if>
<if
test=
"tOrderFileSyncLog.createTime != null"
>
AND a.create_time = #{tOrderFileSyncLog.createTime}
</if>
<if
test=
"tOrderFileSyncLog.flag != null and tOrderFileSyncLog.flag.trim() != ''"
>
AND a.flag = #{tOrderFileSyncLog.flag}
</if>
<if
test=
"tOrderFileSyncLog.updateTime != null"
>
AND a.update_time = #{tOrderFileSyncLog.updateTime}
</if>
</if>
</sql>
<!--tOrderFileSyncLog简单分页查询-->
<select
id=
"getTOrderFileSyncLogPage"
resultMap=
"tOrderFileSyncLogMap"
>
SELECT
<include
refid=
"Base_Column_List"
/>
FROM t_order_file_sync_log a
<where>
1=1
<include
refid=
"tOrderFileSyncLog_where"
/>
</where>
</select>
</mapper>
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