Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jiedao-api-boot-master
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
lanbaoming
jiedao-api-boot-master
Commits
722ddaf6
Commit
722ddaf6
authored
May 26, 2024
by
lanbaoming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
2024-05-23-4提交
parent
f0c3f018
Changes
19
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
816 additions
and
61 deletions
+816
-61
ShipmentReceivableExcelExportPushEvent2.java
...event/export/ShipmentReceivableExcelExportPushEvent2.java
+52
-0
BpmTaskApproveReqVO.java
...pm/controller/admin/task/vo/task/BpmTaskApproveReqVO.java
+6
-2
BpmTaskServiceImpl.java
...der/yudao/module/bpm/service/task/BpmTaskServiceImpl.java
+1
-0
EcwVzController.java
...dao/module/delivery/controller/admin/EcwVzController.java
+2
-1
OrderWarehouseInServiceImpl.java
...service/orderWarehouseIn/OrderWarehouseInServiceImpl.java
+13
-9
OrderBackPageVO.java
.../iocoder/yudao/module/order/vo/order/OrderBackPageVO.java
+11
-3
OrderWarehouseInController.java
...er/admin/orderWarehouseIn/OrderWarehouseInController.java
+1
-0
ProductPriceServiceImpl.java
...product/service/product/impl/ProductPriceServiceImpl.java
+35
-12
ProductPriceController.java
...duct/controller/admin/product/ProductPriceController.java
+4
-1
AirBillReceivableExcelExportListener.java
...ipment/listener/AirBillReceivableExcelExportListener.java
+45
-11
ShipmentReceivableExcelExportListener.java
...pment/listener/ShipmentReceivableExcelExportListener.java
+0
-1
ShipmentReceivableExcelExportListener2.java
...ment/listener/ShipmentReceivableExcelExportListener2.java
+548
-0
BoxServiceImpl.java
...der/yudao/module/shipment/service/box/BoxServiceImpl.java
+4
-4
BoxApprovalServiceImpl.java
.../shipment/service/boxApproval/BoxApprovalServiceImpl.java
+18
-5
MakeBillOfLadingServiceImpl.java
...service/makeBillOfLading/MakeBillOfLadingServiceImpl.java
+47
-9
BoxPreloadGoodsController.java
.../shipment/controller/admin/BoxPreloadGoodsController.java
+2
-0
MakeBillOfLadingController.java
...shipment/controller/admin/MakeBillOfLadingController.java
+4
-1
DownloadLogServiceImpl.java
...le/system/service/downloadLog/DownloadLogServiceImpl.java
+23
-2
nrlyReceivable2.xlsx
...-server/src/main/resources/templates/nrlyReceivable2.xlsx
+0
-0
No files found.
yudao-framework/yudao-spring-boot-starter-config/src/main/java/cn/iocoder/yudao/framework/apollo/core/event/export/ShipmentReceivableExcelExportPushEvent2.java
0 → 100644
View file @
722ddaf6
package
cn
.
iocoder
.
yudao
.
framework
.
apollo
.
core
.
event
.
export
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
/*
lanbm 2024-05-25 lanbm add
*/
@Data
public
class
ShipmentReceivableExcelExportPushEvent2
{
/**
* 操作用户
*/
private
Long
userId
;
/**
* 端口
*/
private
Integer
userType
;
/**
* 请求参数
*/
private
String
requestParams
;
/**
* 国际化语言值,默认0中文, 具体取值I18nMessage.getLang()
*/
private
Integer
lang
=
0
;
/**
* 文件名称
*/
private
String
fileName
;
/**
* 文件路径
*/
private
String
path
;
/**
* 下载地址
*/
private
String
url
;
/**
* 执行结果
*/
private
String
result
;
@ApiModelProperty
(
value
=
"文件ID"
)
private
Long
fileId
;
}
yudao-module-bpm/yudao-module-bpm-base/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/task/BpmTaskApproveReqVO.java
View file @
722ddaf6
...
@@ -18,8 +18,12 @@ public class BpmTaskApproveReqVO {
...
@@ -18,8 +18,12 @@ public class BpmTaskApproveReqVO {
@NotEmpty
(
message
=
"任务编号不能为空"
)
@NotEmpty
(
message
=
"任务编号不能为空"
)
private
String
id
;
private
String
id
;
@ApiModelProperty
(
value
=
"审批意见"
,
required
=
true
,
example
=
"不错不错!"
)
/*
@NotEmpty
(
message
=
"审批意见不能为空"
)
lanbm 2024-05-24 修改为审批意见可以为空,
客户要求部分审批流程不用写审批意见
*/
@ApiModelProperty
(
value
=
"审批意见"
,
required
=
false
,
example
=
"不错不错!"
)
//@NotEmpty(message = "审批意见不能为空")
private
String
comment
;
private
String
comment
;
@ApiModelProperty
(
"抄送用户Id"
)
@ApiModelProperty
(
"抄送用户Id"
)
...
...
yudao-module-bpm/yudao-module-bpm-impl-flowable/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmTaskServiceImpl.java
View file @
722ddaf6
...
@@ -270,6 +270,7 @@ public class BpmTaskServiceImpl implements BpmTaskService {
...
@@ -270,6 +270,7 @@ public class BpmTaskServiceImpl implements BpmTaskService {
taskService
.
addComment
(
task
.
getId
(),
taskService
.
addComment
(
task
.
getId
(),
task
.
getProcessInstanceId
(),
task
.
getProcessInstanceId
(),
BpmProcessInstanceResultEnum
.
APPROVE
.
getDesc
(),
reqVO
.
getComment
());
BpmProcessInstanceResultEnum
.
APPROVE
.
getDesc
(),
reqVO
.
getComment
());
taskService
.
complete
(
task
.
getId
(),
instance
.
getProcessVariables
());
taskService
.
complete
(
task
.
getId
(),
instance
.
getProcessVariables
());
// 是否有抄送
// 是否有抄送
...
...
yudao-module-delivery/yudao-module-delivery-rest/src/main/java/cn/iocoder/yudao/module/delivery/controller/admin/EcwVzController.java
View file @
722ddaf6
...
@@ -34,9 +34,10 @@ import java.util.List;
...
@@ -34,9 +34,10 @@ import java.util.List;
/**
/**
* V值转换配置参数(EcwVz)表控制层
* V值转换配置参数(EcwVz)表控制层
*
*
https://ft0n6y6ben.feishu.cn/sheets/Y7PosKYx5h2O2btS6Gcc0TS7nZe?from=from_copylink
* @author lanbm
* @author lanbm
* @since 2024-04-02
* @since 2024-04-02
* CNG244324 测试提单号
*/
*/
@RestController
@RestController
@RequestMapping
(
"/ecwVz/vz"
)
@RequestMapping
(
"/ecwVz/vz"
)
...
...
yudao-module-order/yudao-module-order-core/src/main/java/cn/iocoder/yudao/module/order/service/orderWarehouseIn/OrderWarehouseInServiceImpl.java
View file @
722ddaf6
...
@@ -6,7 +6,7 @@ import cn.hutool.core.date.DateTime;
...
@@ -6,7 +6,7 @@ import cn.hutool.core.date.DateTime;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.core.util.StrUtil
;
import
cn.iocoder.yudao.framework.apollo.core.event.BoxCheckOrderSchedulingEvent
;
import
cn.iocoder.yudao.framework.apollo.core.event.BoxCheckOrderSchedulingEvent
;
//
import cn.iocoder.yudao.framework.apollo.core.event.Order.CalculateOrderVValueEvent;
import
cn.iocoder.yudao.framework.apollo.core.event.Order.CalculateOrderVValueEvent
;
import
cn.iocoder.yudao.framework.apollo.core.event.QueryChannelInfoEvent
;
import
cn.iocoder.yudao.framework.apollo.core.event.QueryChannelInfoEvent
;
import
cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil
;
import
cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil
;
import
cn.iocoder.yudao.framework.common.pojo.PageResult
;
import
cn.iocoder.yudao.framework.common.pojo.PageResult
;
...
@@ -1173,11 +1173,12 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
...
@@ -1173,11 +1173,12 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
// 自定义体积
// 自定义体积
//
orderDO.setCustomSumVolume(finishReqVO.getSumVolume());
//
orderDO.setCustomSumVolume(finishReqVO.getSumVolume());
// 自定义重量
// 自定义重量
//
orderDO.setCustomSumWeight(finishReqVO.getSumWeight());
//
orderDO.setCustomSumWeight(finishReqVO.getSumWeight());
// 20230115 拆单子订单入仓不需要产生除转异外的其他异常,同时也不需要重新计算价格; 退场入仓也不需要产生异常
// 20230115 拆单子订单入仓不需要产生除转异外的其他异常,
// 同时也不需要重新计算价格; 退场入仓也不需要产生异常
if
(!
isSplitOrderChildren
&&
isNotRollbackIn
)
{
if
(!
isSplitOrderChildren
&&
isNotRollbackIn
)
{
//处理重泡货异常
//处理重泡货异常
...
@@ -1201,7 +1202,8 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
...
@@ -1201,7 +1202,8 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
// 处理发货人异常
// 处理发货人异常
processConsignorException
(
finishReqVO
,
orderId
,
orderDO
);
processConsignorException
(
finishReqVO
,
orderId
,
orderDO
);
// 重新调用计算订单价格, 订单信息和订单项信息需要重新查询,可能创建异常和修改订单已经对订单信息造成改变
// 重新调用计算订单价格, 订单信息和订单项信息需要重新查询,
// 可能创建异常和修改订单已经对订单信息造成改变
boolean
firstRucang
=
orderDO
.
getRucangTime
()
==
null
;
boolean
firstRucang
=
orderDO
.
getRucangTime
()
==
null
;
if
(
firstRucang
)
{
if
(
firstRucang
)
{
...
@@ -1225,7 +1227,9 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
...
@@ -1225,7 +1227,9 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
processOrderPayException
(
orderId
,
orderDO
,
result
);
processOrderPayException
(
orderId
,
orderDO
,
result
);
}
}
int
numSum2
=
orderWarehouseInDOList
.
stream
().
filter
(
t
->
t
.
getCartonsNum
()
!=
null
).
mapToInt
(
OrderWarehouseInDO:
:
getCartonsNum
).
sum
();
int
numSum2
=
orderWarehouseInDOList
.
stream
().
filter
(
t
->
t
.
getCartonsNum
()
!=
null
).
mapToInt
(
OrderWarehouseInDO:
:
getCartonsNum
).
sum
();
// 保存箱号
// 保存箱号
if
(
finishReqVO
.
getUpdateLabel
())
{
if
(
finishReqVO
.
getUpdateLabel
())
{
...
@@ -1311,7 +1315,8 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
...
@@ -1311,7 +1315,8 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
CustomerDO
consignorCustomer
=
customerService
.
getById
(
orderConsignorDO2
.
getCustomerId
())
;
CustomerDO
consignorCustomer
=
customerService
.
getById
(
orderConsignorDO2
.
getCustomerId
())
;
//获取收货人客户经理
//获取收货人客户经理
CustomerDO
consigneeCustomer
=
customerService
.
getById
(
orderConsigneeDO2
.
getCustomerId
())
;
CustomerDO
consigneeCustomer
=
customerService
.
getById
(
orderConsigneeDO2
.
getCustomerId
())
;
//订单的发货人、收货人同属一个客户经理,则两个客户经理都延期,否则只延期订单中业绩归属方客户
//订单的发货人、收货人同属一个客户经理,则两个客户经理都延期,
// 否则只延期订单中业绩归属方客户
if
(
consignorCustomer
!=
null
&&
consigneeCustomer
!=
null
&&
if
(
consignorCustomer
!=
null
&&
consigneeCustomer
!=
null
&&
Objects
.
nonNull
(
consignorCustomer
.
getCustomerService
())
&&
Objects
.
nonNull
(
consignorCustomer
.
getCustomerService
())
&&
Objects
.
nonNull
(
consigneeCustomer
.
getCustomerService
())
&&
Objects
.
nonNull
(
consigneeCustomer
.
getCustomerService
())
&&
...
@@ -1343,10 +1348,9 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
...
@@ -1343,10 +1348,9 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
}
}
//入仓完成,计算V值 lanbm 2024-05-13 add
//入仓完成,计算V值 lanbm 2024-05-13 add
/*
CalculateOrderVValueEvent
event
=
new
CalculateOrderVValueEvent
();
CalculateOrderVValueEvent
event
=
new
CalculateOrderVValueEvent
();
event
.
setOrderId
(
orderId
);
event
.
setOrderId
(
orderId
);
applicationContext.publishEvent(event);
*/
applicationContext
.
publishEvent
(
event
);
//end 入仓完成,计算V值 lanbm 2024-05-13 add
//end 入仓完成,计算V值 lanbm 2024-05-13 add
// 返回是否包含异常
// 返回是否包含异常
...
...
yudao-module-order/yudao-module-order-core/src/main/java/cn/iocoder/yudao/module/order/vo/order/OrderBackPageVO.java
View file @
722ddaf6
...
@@ -495,6 +495,7 @@ public class OrderBackPageVO {
...
@@ -495,6 +495,7 @@ public class OrderBackPageVO {
this
.
inWarehouseState
=
inWarehouseState
;
this
.
inWarehouseState
=
inWarehouseState
;
this
.
getOrderDesc
();
this
.
getOrderDesc
();
}
}
public
void
setAirShipment
(
Integer
airShipment
)
{
public
void
setAirShipment
(
Integer
airShipment
)
{
this
.
airShipment
=
airShipment
;
this
.
airShipment
=
airShipment
;
this
.
getOrderDesc
();
this
.
getOrderDesc
();
...
@@ -556,7 +557,8 @@ public class OrderBackPageVO {
...
@@ -556,7 +557,8 @@ public class OrderBackPageVO {
this
.
statusMsg
=
lang
==
0
?
I18nMessage
.
getZhMessage
(
auditResult
)
:
I18nMessage
.
getEnMessage
(
auditResult
);
this
.
statusMsg
=
lang
==
0
?
I18nMessage
.
getZhMessage
(
auditResult
)
:
I18nMessage
.
getEnMessage
(
auditResult
);
}
else
if
(
CollectionUtil
.
isNotEmpty
(
this
.
remindExceptionDtoList
)
&&
this
.
remindExceptionDtoList
.
size
()
>
0
)
{
}
else
if
(
CollectionUtil
.
isNotEmpty
(
this
.
remindExceptionDtoList
)
&&
this
.
remindExceptionDtoList
.
size
()
>
0
)
{
this
.
statusMsg
=
remindExceptionDtoList
.
get
(
0
).
getReason
();
this
.
statusMsg
=
remindExceptionDtoList
.
get
(
0
).
getReason
();
}
else
if
(
null
!=
this
.
status
&&
this
.
status
==
5
&&
CollectionUtil
.
isNotEmpty
(
this
.
guanLianOrderStatusVOList
))
{
}
else
if
(
null
!=
this
.
status
&&
this
.
status
==
5
&&
CollectionUtil
.
isNotEmpty
(
this
.
guanLianOrderStatusVOList
))
{
// 已入仓的订单才展示关联异常信息
// 已入仓的订单才展示关联异常信息
// 如果查询返回了关联订单状态,表示需要显示关联订单状态,关联订单状态冗余的是国际化key值
// 如果查询返回了关联订单状态,表示需要显示关联订单状态,关联订单状态冗余的是国际化key值
// 排序
// 排序
...
@@ -581,8 +583,14 @@ public class OrderBackPageVO {
...
@@ -581,8 +583,14 @@ public class OrderBackPageVO {
default
:
default
:
this
.
statusMsg
=
lang
==
0
?
I18nMessage
.
getZhMessage
(
guanlianOrderStatusVO
.
getStatusMsg
())
:
I18nMessage
.
getEnMessage
(
guanlianOrderStatusVO
.
getStatusMsg
());
this
.
statusMsg
=
lang
==
0
?
I18nMessage
.
getZhMessage
(
guanlianOrderStatusVO
.
getStatusMsg
())
:
I18nMessage
.
getEnMessage
(
guanlianOrderStatusVO
.
getStatusMsg
());
}
}
}
else
if
(
null
!=
this
.
status
&&
null
!=
this
.
inWarehouseState
&&
null
!=
this
.
shipmentState
&&
null
!=
this
.
airShipment
&&
null
!=
this
.
transportId
)
{
}
else
if
(
null
!=
this
.
status
&&
null
!=
this
.
inWarehouseState
&&
this
.
statusMsg
=
OrderStatusMsgEnum
.
getMsg
(
this
.
status
,
this
.
inWarehouseState
,
this
.
shipmentState
,
this
.
airShipment
,
this
.
transportId
,
this
.
userType
,
lang
);
null
!=
this
.
shipmentState
&&
null
!=
this
.
airShipment
&&
null
!=
this
.
transportId
)
{
this
.
statusMsg
=
OrderStatusMsgEnum
.
getMsg
(
this
.
status
,
this
.
inWarehouseState
,
this
.
shipmentState
,
this
.
airShipment
,
this
.
transportId
,
this
.
userType
,
lang
);
// this.statusKey = OrderStatusMsgEnum.getStatusKey(this.status, this.inWarehouseState, this.shipmentState);
// this.statusKey = OrderStatusMsgEnum.getStatusKey(this.status, this.inWarehouseState, this.shipmentState);
}
}
}
}
...
...
yudao-module-order/yudao-module-order-rest/src/main/java/cn/iocoder/yudao/module/order/controller/admin/orderWarehouseIn/OrderWarehouseInController.java
View file @
722ddaf6
...
@@ -124,6 +124,7 @@ public class OrderWarehouseInController {
...
@@ -124,6 +124,7 @@ public class OrderWarehouseInController {
@ApiOperation
(
"入仓完成/转异"
)
@ApiOperation
(
"入仓完成/转异"
)
@Idempotent
(
timeout
=
5
)
@Idempotent
(
timeout
=
5
)
public
CommonResult
<
Boolean
>
finishWarehouseIn
(
@Valid
@RequestBody
OrderWarehouseInFinishReqVO
finishReqVO
)
{
public
CommonResult
<
Boolean
>
finishWarehouseIn
(
@Valid
@RequestBody
OrderWarehouseInFinishReqVO
finishReqVO
)
{
//lanbm 2024-05-26 在此处添加注释
String
redisKey
=
MessageFormat
.
format
(
ORDER_FINISH_WAREHOUSE_IN_KEY
,
finishReqVO
.
getOrderId
().
toString
());
String
redisKey
=
MessageFormat
.
format
(
ORDER_FINISH_WAREHOUSE_IN_KEY
,
finishReqVO
.
getOrderId
().
toString
());
Long
count
=
redisHelper
.
incrBy
(
redisKey
,
1
);
Long
count
=
redisHelper
.
incrBy
(
redisKey
,
1
);
if
(
count
>
1
)
{
if
(
count
>
1
)
{
...
...
yudao-module-product/yudao-module-product-core/src/main/java/cn/iocoder/yudao/module/product/service/product/impl/ProductPriceServiceImpl.java
View file @
722ddaf6
...
@@ -2370,13 +2370,17 @@ public class ProductPriceServiceImpl extends AbstractService<ProductPriceMapper,
...
@@ -2370,13 +2370,17 @@ public class ProductPriceServiceImpl extends AbstractService<ProductPriceMapper,
}
}
@Override
@Override
public
void
batchAddPrice
(
ProductPriceBatchAddPriceReqVo
batchAddPriceReqVo
,
ProductPriceCheckAO
productPriceCheckAO
)
{
public
void
batchAddPrice
(
ProductPriceBatchAddPriceReqVo
batchAddPriceReqVo
,
ProductPriceCheckAO
productPriceCheckAO
)
{
String
json
=
JSON
.
toJSONString
(
batchAddPriceReqVo
);
String
json
=
JSON
.
toJSONString
(
batchAddPriceReqVo
);
List
<
ProductDO
>
productList
=
productPriceCheckAO
.
getProductList
();
List
<
ProductDO
>
productList
=
productPriceCheckAO
.
getProductList
();
List
<
LineChannelVo
>
lineChannelList
=
batchAddPriceReqVo
.
getLineChannelList
();
List
<
LineChannelVo
>
lineChannelList
=
batchAddPriceReqVo
.
getLineChannelList
();
logAndDelKey
(
json
,
productList
,
lineChannelList
);
logAndDelKey
(
json
,
productList
,
lineChannelList
);
List
<
WarehouseLineDO
>
warehouseLineList
=
productPriceCheckAO
.
getWarehouseLineList
();
List
<
WarehouseLineDO
>
warehouseLineList
=
productPriceCheckAO
.
getWarehouseLineList
();
String
content
=
productPriceCheckAO
.
getContent
();
String
content
=
productPriceCheckAO
.
getContent
();
int
countBatch
=
(
int
)
Math
.
ceil
((
double
)
productList
.
size
()
/
DATA_THRESHOLD
);
int
countBatch
=
(
int
)
Math
.
ceil
((
double
)
productList
.
size
()
/
DATA_THRESHOLD
);
...
@@ -2385,23 +2389,30 @@ public class ProductPriceServiceImpl extends AbstractService<ProductPriceMapper,
...
@@ -2385,23 +2389,30 @@ public class ProductPriceServiceImpl extends AbstractService<ProductPriceMapper,
.
parallel
()
.
parallel
()
.
map
(
a
->
productList
.
stream
().
skip
(
a
*
DATA_THRESHOLD
).
limit
(
DATA_THRESHOLD
).
parallel
().
collect
(
toList
())
.
map
(
a
->
productList
.
stream
().
skip
(
a
*
DATA_THRESHOLD
).
limit
(
DATA_THRESHOLD
).
parallel
().
collect
(
toList
())
).
collect
(
toList
());
).
collect
(
toList
());
//ecw_product 首先遍历产品
for
(
List
<
ProductDO
>
itemList
:
splitList
)
{
for
(
List
<
ProductDO
>
itemList
:
splitList
)
{
ProductPriceCreateReqVO
createReqVO
=
new
ProductPriceCreateReqVO
();
ProductPriceCreateReqVO
createReqVO
=
new
ProductPriceCreateReqVO
();
BeanUtils
.
copyProperties
(
batchAddPriceReqVo
,
createReqVO
);
BeanUtils
.
copyProperties
(
batchAddPriceReqVo
,
createReqVO
);
batchAddPrice
(
createReqVO
,
warehouseLineList
,
itemList
);
batchAddPrice
(
createReqVO
,
warehouseLineList
,
itemList
);
}
}
//发送站内信
//发送站内信
sendMessage
(
content
);
sendMessage
(
content
);
}
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
batchAddPrice
(
ProductPriceCreateReqVO
batchAddPriceReqVo
,
List
<
WarehouseLineDO
>
warehouseLineList
,
List
<
ProductDO
>
productList
)
{
public
void
batchAddPrice
(
ProductPriceCreateReqVO
batchAddPriceReqVo
,
List
<
WarehouseLineDO
>
warehouseLineList
,
List
<
ProductDO
>
productList
)
{
long
t1
=
System
.
currentTimeMillis
();
long
t1
=
System
.
currentTimeMillis
();
Long
loginUserId
=
SecurityFrameworkUtils
.
getLoginUserId
();
Long
loginUserId
=
SecurityFrameworkUtils
.
getLoginUserId
();
ProductPriceDO
productPrice
=
ProductPriceConvert
.
INSTANCE
.
convert
(
batchAddPriceReqVo
);
ProductPriceDO
productPrice
=
ProductPriceConvert
.
INSTANCE
.
convert
(
batchAddPriceReqVo
);
List
<
LineChannelVo
>
lineChannelList
=
batchAddPriceReqVo
.
getLineChannelList
();
List
<
LineChannelVo
>
lineChannelList
=
batchAddPriceReqVo
.
getLineChannelList
();
Set
<
Long
>
lineIdList
=
lineChannelList
.
stream
()
Set
<
Long
>
lineIdList
=
lineChannelList
.
stream
()
.
map
(
LineChannelVo:
:
getLineId
)
.
map
(
LineChannelVo:
:
getLineId
)
.
collect
(
Collectors
.
toSet
());
.
collect
(
Collectors
.
toSet
());
...
@@ -2424,6 +2435,7 @@ public class ProductPriceServiceImpl extends AbstractService<ProductPriceMapper,
...
@@ -2424,6 +2435,7 @@ public class ProductPriceServiceImpl extends AbstractService<ProductPriceMapper,
Map
<
String
,
ProductPriceDO
>
productLineChannelMap
=
dbPriceList
.
stream
()
Map
<
String
,
ProductPriceDO
>
productLineChannelMap
=
dbPriceList
.
stream
()
.
collect
(
Collectors
.
toMap
(
t
->
t
.
getProductId
()
+
"-"
+
t
.
getWarehouseLineId
()
+
"-"
+
t
.
getShippingChannelId
(),
v
->
v
,
(
v1
,
v2
)
->
v2
));
.
collect
(
Collectors
.
toMap
(
t
->
t
.
getProductId
()
+
"-"
+
t
.
getWarehouseLineId
()
+
"-"
+
t
.
getShippingChannelId
(),
v
->
v
,
(
v1
,
v2
)
->
v2
));
//ecw_product_price 产品价格
List
<
ProductPriceDO
>
priceList
=
new
ArrayList
<>();
List
<
ProductPriceDO
>
priceList
=
new
ArrayList
<>();
List
<
ProductPriceDO
>
updateList
=
new
ArrayList
<>();
List
<
ProductPriceDO
>
updateList
=
new
ArrayList
<>();
...
@@ -2468,9 +2480,12 @@ public class ProductPriceServiceImpl extends AbstractService<ProductPriceMapper,
...
@@ -2468,9 +2480,12 @@ public class ProductPriceServiceImpl extends AbstractService<ProductPriceMapper,
}
}
Map
<
Long
,
String
>
priceTransportTypeMap
=
new
HashMap
<>();
Map
<
Long
,
String
>
priceTransportTypeMap
=
new
HashMap
<>();
priceList
.
forEach
(
t
->
priceTransportTypeMap
.
put
(
t
.
getId
(),
lineTransportTypeMap
.
get
(
t
.
getWarehouseLineId
())));
priceList
.
forEach
(
t
->
priceTransportTypeMap
.
put
(
t
.
getId
(),
lineTransportTypeMap
.
get
(
t
.
getWarehouseLineId
())));
if
(
null
!=
batchAddPriceReqVo
.
getStepPrice
()
&&
batchAddPriceReqVo
.
getStepPrice
()
==
1
)
{
if
(
null
!=
batchAddPriceReqVo
.
getStepPrice
()
&&
batchAddPriceReqVo
.
getStepPrice
()
==
1
)
{
snapshotList
=
new
ArrayList
<>();
snapshotList
=
new
ArrayList
<>();
updateList
=
new
ArrayList
<>();
updateList
=
new
ArrayList
<>();
...
@@ -2506,13 +2521,16 @@ public class ProductPriceServiceImpl extends AbstractService<ProductPriceMapper,
...
@@ -2506,13 +2521,16 @@ public class ProductPriceServiceImpl extends AbstractService<ProductPriceMapper,
}
else
{
}
else
{
if
(
CollectionUtil
.
isNotEmpty
(
updateList
))
{
if
(
CollectionUtil
.
isNotEmpty
(
updateList
))
{
productPriceMapper
.
updateBatch
(
updateList
);
productPriceMapper
.
updateBatch
(
updateList
);
//添加修改日志,需要查询特需和阶梯,所以需要在修改之前执行
//添加修改日志,需要查询特需和阶梯,所以需要在修改之前执行
batchAddSnapshot
(
snapshotList
);
batchAddSnapshot
(
snapshotList
);
//价格特需
//价格特需
specialListAddPrice
(
updateList
,
batchAddPriceReqVo
.
getSpecialList
(),
priceTransportTypeMap
);
specialListAddPrice
(
updateList
,
batchAddPriceReqVo
.
getSpecialList
(),
priceTransportTypeMap
);
//价格包装单位
//价格包装单位
List
<
ProductPricePackagingDO
>
allPackagingList
=
buildAllPackageList
(
batchAddPriceReqVo
);
List
<
ProductPricePackagingDO
>
allPackagingList
=
buildAllPackageList
(
batchAddPriceReqVo
);
...
@@ -2595,7 +2613,9 @@ public class ProductPriceServiceImpl extends AbstractService<ProductPriceMapper,
...
@@ -2595,7 +2613,9 @@ public class ProductPriceServiceImpl extends AbstractService<ProductPriceMapper,
return
update
;
return
update
;
}
}
private
void
specialListAddPrice
(
List
<
ProductPriceDO
>
productPriceList
,
List
<
ProductPriceSpecialDO
>
specialList
,
Map
<
Long
,
String
>
priceTransportTypeMap
)
{
private
void
specialListAddPrice
(
List
<
ProductPriceDO
>
productPriceList
,
List
<
ProductPriceSpecialDO
>
specialList
,
Map
<
Long
,
String
>
priceTransportTypeMap
)
{
if
(
specialList
==
null
)
return
;
if
(
specialList
==
null
)
return
;
specialList
=
specialList
.
stream
()
specialList
=
specialList
.
stream
()
...
@@ -2612,7 +2632,9 @@ public class ProductPriceServiceImpl extends AbstractService<ProductPriceMapper,
...
@@ -2612,7 +2632,9 @@ public class ProductPriceServiceImpl extends AbstractService<ProductPriceMapper,
List
<
Long
>
idList
=
priceItemList
.
stream
()
List
<
Long
>
idList
=
priceItemList
.
stream
()
.
map
(
ProductPriceDO:
:
getId
)
.
map
(
ProductPriceDO:
:
getId
)
.
collect
(
toList
());
.
collect
(
toList
());
List
<
ProductPriceSpecialDO
>
itemSpecialList
=
productPriceSpecialService
.
selectList
(
new
LambdaQueryWrapper
<
ProductPriceSpecialDO
>()
List
<
ProductPriceSpecialDO
>
itemSpecialList
=
productPriceSpecialService
.
selectList
(
new
LambdaQueryWrapper
<
ProductPriceSpecialDO
>()
.
in
(
ProductPriceSpecialDO:
:
getProductPriceId
,
idList
)
.
in
(
ProductPriceSpecialDO:
:
getProductPriceId
,
idList
)
);
);
allSpecialList
.
addAll
(
itemSpecialList
);
allSpecialList
.
addAll
(
itemSpecialList
);
...
@@ -2627,7 +2649,8 @@ public class ProductPriceServiceImpl extends AbstractService<ProductPriceMapper,
...
@@ -2627,7 +2649,8 @@ public class ProductPriceServiceImpl extends AbstractService<ProductPriceMapper,
for
(
ProductPriceDO
productPriceDO
:
productPriceList
)
{
for
(
ProductPriceDO
productPriceDO
:
productPriceList
)
{
Long
productPriceId
=
productPriceDO
.
getId
();
Long
productPriceId
=
productPriceDO
.
getId
();
List
<
ProductPriceSpecialDO
>
productSpecialList
=
priceSpecialMap
.
get
(
productPriceId
);
List
<
ProductPriceSpecialDO
>
productSpecialList
=
priceSpecialMap
.
get
(
productPriceId
);
//价格没有特需则跳过
//价格没有特需则跳过
if
(
CollectionUtil
.
isEmpty
(
productSpecialList
))
continue
;
if
(
CollectionUtil
.
isEmpty
(
productSpecialList
))
continue
;
...
...
yudao-module-product/yudao-module-product-rest/src/main/java/cn/iocoder/yudao/module/product/controller/admin/product/ProductPriceController.java
View file @
722ddaf6
...
@@ -125,8 +125,11 @@ public class ProductPriceController {
...
@@ -125,8 +125,11 @@ public class ProductPriceController {
@ApiOperation
(
"批量加价"
)
@ApiOperation
(
"批量加价"
)
@PreAuthorize
(
"@ss.hasPermission('ecw:product-price:update')"
)
@PreAuthorize
(
"@ss.hasPermission('ecw:product-price:update')"
)
public
CommonResult
<
Boolean
>
batchAddPrice
(
@RequestBody
ProductPriceBatchAddPriceReqVo
updateReqVO
)
{
public
CommonResult
<
Boolean
>
batchAddPrice
(
@RequestBody
ProductPriceBatchAddPriceReqVo
updateReqVO
)
{
//批量修改价格 lanbm 2024-05-23 添加注释
updateReqVO
.
setCheckStepPrice
(
false
);
updateReqVO
.
setCheckStepPrice
(
false
);
ProductPriceCheckAO
productPriceCheckAO
=
productPriceService
.
check
(
updateReqVO
);
ProductPriceCheckAO
productPriceCheckAO
=
productPriceService
.
check
(
updateReqVO
);
routerService
.
batchAddPrice
(
updateReqVO
,
productPriceCheckAO
);
routerService
.
batchAddPrice
(
updateReqVO
,
productPriceCheckAO
);
return
success
(
true
);
return
success
(
true
);
}
}
...
...
yudao-module-shipment/yudao-module-shipment-core/src/main/java/cn/iocoder/yudao/module/shipment/listener/AirBillReceivableExcelExportListener.java
View file @
722ddaf6
...
@@ -62,6 +62,10 @@ import java.util.stream.Collectors;
...
@@ -62,6 +62,10 @@ import java.util.stream.Collectors;
import
static
cn
.
iocoder
.
yudao
.
framework
.
excel
.
constant
.
ExportConstant
.
DATA_FORMAT
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
excel
.
constant
.
ExportConstant
.
DATA_FORMAT
;
import
static
cn
.
iocoder
.
yudao
.
module
.
shipment
.
enums
.
ErrorCodeConstants
.
HAVE_NOT_PRELOAD_GOODS
;
import
static
cn
.
iocoder
.
yudao
.
module
.
shipment
.
enums
.
ErrorCodeConstants
.
HAVE_NOT_PRELOAD_GOODS
;
/*
空运应收款汇总下载
lanbm 2024-05-25 添加注释
*/
@Component
(
"AirBillReceivableExcelExportListener"
)
@Component
(
"AirBillReceivableExcelExportListener"
)
@AllArgsConstructor
@AllArgsConstructor
@Slf4j
@Slf4j
...
@@ -113,21 +117,42 @@ public class AirBillReceivableExcelExportListener {
...
@@ -113,21 +117,42 @@ public class AirBillReceivableExcelExportListener {
DateTimeFormatter
formatter
=
DateTimeFormatter
.
ofPattern
(
DATA_FORMAT
);
DateTimeFormatter
formatter
=
DateTimeFormatter
.
ofPattern
(
DATA_FORMAT
);
String
nowTime
=
formatter
.
format
(
LocalDateTime
.
now
());
String
nowTime
=
formatter
.
format
(
LocalDateTime
.
now
());
String
dir
=
ueProperties
.
getTempDir
().
concat
(
"/airReceivable/excel/"
);
String
dir
=
ueProperties
.
getTempDir
().
concat
(
"/airReceivable/excel/"
);
String
fileName
=
event
.
getUserId
().
toString
().
concat
(
StrUtil
.
DASHED
).
concat
(
event
.
getUserType
().
toString
()).
concat
(
StrUtil
.
DASHED
).
concat
(
nowTime
).
concat
(
"air_receivable_notMerge.xlsx"
);
String
fileName
=
event
.
getUserId
().
toString
().
String
fileNameMerge
=
event
.
getUserId
().
toString
().
concat
(
StrUtil
.
DASHED
).
concat
(
event
.
getUserType
().
toString
()).
concat
(
StrUtil
.
DASHED
).
concat
(
nowTime
).
concat
(
"air_receivable_Merge.xlsx"
);
concat
(
StrUtil
.
DASHED
).
concat
(
event
.
getUserType
().
toString
()).
concat
(
StrUtil
.
DASHED
).
concat
(
nowTime
).
concat
(
"air_receivable_notMerge.xlsx"
);
String
fileNameMerge
=
event
.
getUserId
().
toString
().
concat
(
StrUtil
.
DASHED
).
concat
(
event
.
getUserType
().
toString
()).
concat
(
StrUtil
.
DASHED
).
concat
(
nowTime
).
concat
(
"air_receivable_Merge.xlsx"
);
List
<
CurrencyDO
>
currencyList
=
currencyService
.
getCurrencyList
();
List
<
CurrencyDO
>
currencyList
=
currencyService
.
getCurrencyList
();
Map
<
Integer
,
String
>
currencyMap
=
currencyList
.
stream
().
collect
(
Collectors
.
toMap
(
CurrencyDO:
:
getId
,
CurrencyDO:
:
getTitleEn
,
(
key1
,
key2
)
->
key2
));
Map
<
Integer
,
String
>
currencyMap
=
Map
<
Integer
,
String
>
currencyFuhaoMap
=
currencyList
.
stream
().
collect
(
Collectors
.
toMap
(
CurrencyDO:
:
getId
,
CurrencyDO:
:
getFuhao
,
(
key1
,
key2
)
->
key2
));
currencyList
.
stream
().
collect
(
Collectors
.
toMap
(
CurrencyDO:
:
getId
,
CurrencyDO:
:
getTitleEn
,
(
key1
,
key2
)
->
key2
));
Map
<
Integer
,
String
>
currencyFuhaoMap
=
currencyList
.
stream
().
collect
(
Collectors
.
toMap
(
CurrencyDO:
:
getId
,
CurrencyDO:
:
getFuhao
,
(
key1
,
key2
)
->
key2
));
InputStream
inputStream
=
null
;
InputStream
inputStream
=
null
;
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
event
.
getRequestParams
());
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
event
.
getRequestParams
());
Long
shipmentId
=
jsonObject
.
getLong
(
"shipmentId"
);
Long
shipmentId
=
jsonObject
.
getLong
(
"shipmentId"
);
inputStream
=
getClass
().
getClassLoader
().
getResourceAsStream
(
ueProperties
.
getTemplatesUrl
()
+
"/airBillTemplate.xlsx"
);
inputStream
=
getClass
().
getClassLoader
().
getResourceAsStream
(
ueProperties
.
getTemplatesUrl
()
+
"/airBillTemplate.xlsx"
);
BoxDO
box
=
boxService
.
getBox
(
shipmentId
);
BoxDO
box
=
boxService
.
getBox
(
shipmentId
);
WarehouseDO
startWarehouse
=
warehouseService
.
getWarehouse
(
box
.
getStartWarehouseId
());
WarehouseDO
startWarehouse
=
warehouseService
.
getWarehouse
(
box
.
getStartWarehouseId
());
WarehouseDO
destWarehouse
=
warehouseService
.
getWarehouse
(
box
.
getDestWarehouseId
());
WarehouseDO
destWarehouse
=
warehouseService
.
getWarehouse
(
box
.
getDestWarehouseId
());
RegionDO
startRegion
=
regionService
.
getRegion
(
startWarehouse
.
getGuojia
());
RegionDO
startRegion
=
regionService
.
getRegion
(
startWarehouse
.
getGuojia
());
RegionDO
destRegion
=
regionService
.
getRegion
(
destWarehouse
.
getGuojia
());
RegionDO
destRegion
=
regionService
.
getRegion
(
destWarehouse
.
getGuojia
());
WarehouseLineDO
warehouseLineDO
=
warehouseLineMapper
.
findOne
(
box
.
getStartWarehouseId
(),
box
.
getDestWarehouseId
(),
box
.
getTransportType
());
WarehouseLineDO
warehouseLineDO
=
warehouseLineMapper
.
findOne
(
box
.
getStartWarehouseId
(),
box
.
getDestWarehouseId
(),
box
.
getTransportType
());
if
(
StringUtils
.
isNotBlank
(
warehouseLineDO
.
getRecipientInfo
()))
{
if
(
StringUtils
.
isNotBlank
(
warehouseLineDO
.
getRecipientInfo
()))
{
recipientInfo
=
JSONObject
.
parseObject
(
warehouseLineDO
.
getRecipientInfo
(),
ContactInfoDTO
.
class
);
recipientInfo
=
JSONObject
.
parseObject
(
warehouseLineDO
.
getRecipientInfo
(),
ContactInfoDTO
.
class
);
}
}
...
@@ -191,7 +216,12 @@ public class AirBillReceivableExcelExportListener {
...
@@ -191,7 +216,12 @@ public class AirBillReceivableExcelExportListener {
Integer
sum14
=
0
;
Integer
sum14
=
0
;
BigDecimal
sum15
=
BigDecimal
.
ZERO
;
BigDecimal
sum15
=
BigDecimal
.
ZERO
;
BigDecimal
sum16
=
BigDecimal
.
ZERO
;
BigDecimal
sum16
=
BigDecimal
.
ZERO
;
List
<
BoxMergePkgDO
>
boxMergePkgDOS
=
boxMergePkgService
.
selectList
(
new
LambdaQueryWrapperX
<
BoxMergePkgDO
>().
eq
(
BoxMergePkgDO:
:
getShipmentId
,
shipmentId
).
orderByDesc
(
BoxMergePkgDO:
:
getId
));
List
<
BoxMergePkgDO
>
boxMergePkgDOS
=
boxMergePkgService
.
selectList
(
new
LambdaQueryWrapperX
<
BoxMergePkgDO
>().
eq
(
BoxMergePkgDO:
:
getShipmentId
,
shipmentId
).
orderByDesc
(
BoxMergePkgDO:
:
getId
));
for
(
Map
.
Entry
<
Long
,
List
<
BoxPreloadGoodsBackVO
>>
entry
:
orderMap
.
entrySet
())
{
for
(
Map
.
Entry
<
Long
,
List
<
BoxPreloadGoodsBackVO
>>
entry
:
orderMap
.
entrySet
())
{
Long
orderId
=
entry
.
getKey
();
Long
orderId
=
entry
.
getKey
();
OrderBackInfoDto
orderInfo
=
orderQueryService
.
info
(
orderId
);
OrderBackInfoDto
orderInfo
=
orderQueryService
.
info
(
orderId
);
...
@@ -376,6 +406,7 @@ public class AirBillReceivableExcelExportListener {
...
@@ -376,6 +406,7 @@ public class AirBillReceivableExcelExportListener {
map
.
put
(
"objectiveName"
,
orderInfo
.
getLogisticsInfoDto
().
getDestTitleEn
());
map
.
put
(
"objectiveName"
,
orderInfo
.
getLogisticsInfoDto
().
getDestTitleEn
());
map
.
put
(
"consignorPhone"
,
orderInfo
.
getConsignorVO
().
getPhone
());
map
.
put
(
"consignorPhone"
,
orderInfo
.
getConsignorVO
().
getPhone
());
map
.
put
(
"consignorName"
,
orderInfo
.
getConsignorVO
().
getName
());
map
.
put
(
"consignorName"
,
orderInfo
.
getConsignorVO
().
getName
());
if
(
CollectionUtil
.
isNotEmpty
(
entry
.
getValue
()))
{
if
(
CollectionUtil
.
isNotEmpty
(
entry
.
getValue
()))
{
Long
pkgId
=
entry
.
getValue
().
get
(
0
).
getPkgId
();
Long
pkgId
=
entry
.
getValue
().
get
(
0
).
getPkgId
();
if
(
pkgId
!=
null
&&
pkgId
>
0L
)
{
if
(
pkgId
!=
null
&&
pkgId
>
0L
)
{
...
@@ -383,8 +414,10 @@ public class AirBillReceivableExcelExportListener {
...
@@ -383,8 +414,10 @@ public class AirBillReceivableExcelExportListener {
map
.
put
(
"remark"
,
boxMergePkgDO
.
getPkgNum
());
map
.
put
(
"remark"
,
boxMergePkgDO
.
getPkgNum
());
}
}
}
}
if
(
orderInfo
.
getSalesmanId
()
!=
null
&&
orderInfo
.
getSalesmanId
().
longValue
()
>
0L
)
{
if
(
orderInfo
.
getSalesmanId
()
!=
null
&&
map
.
put
(
"accountManager"
,
getUserName
(
String
.
valueOf
(
orderInfo
.
getSalesmanId
())));
orderInfo
.
getSalesmanId
().
longValue
()
>
0L
)
{
map
.
put
(
"accountManager"
,
getUserName
(
String
.
valueOf
(
orderInfo
.
getSalesmanId
())));
}
}
list
.
add
(
map
);
list
.
add
(
map
);
}
}
...
@@ -457,7 +490,8 @@ public class AirBillReceivableExcelExportListener {
...
@@ -457,7 +490,8 @@ public class AirBillReceivableExcelExportListener {
}
}
}
}
FileOutputStream
fileOutputStream
=
new
FileOutputStream
(
new
File
(
dir
+
fileNameMerge
));
FileOutputStream
fileOutputStream
=
new
FileOutputStream
(
new
File
(
dir
+
fileNameMerge
));
workbook
.
write
(
fileOutputStream
);
workbook
.
write
(
fileOutputStream
);
fileOutputStream
.
close
();
fileOutputStream
.
close
();
...
...
yudao-module-shipment/yudao-module-shipment-core/src/main/java/cn/iocoder/yudao/module/shipment/listener/ShipmentReceivableExcelExportListener.java
View file @
722ddaf6
...
@@ -261,7 +261,6 @@ public class ShipmentReceivableExcelExportListener {
...
@@ -261,7 +261,6 @@ public class ShipmentReceivableExcelExportListener {
event
.
setUrl
(
fileDO
.
getUrl
());
event
.
setUrl
(
fileDO
.
getUrl
());
event
.
setFileId
(
fileDO
.
getId
());
event
.
setFileId
(
fileDO
.
getId
());
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
// TODO 测试阶段打印堆栈错误信息,便于分析原因
e
.
printStackTrace
();
e
.
printStackTrace
();
event
.
setResult
(
e
.
getMessage
());
event
.
setResult
(
e
.
getMessage
());
}
}
...
...
yudao-module-shipment/yudao-module-shipment-core/src/main/java/cn/iocoder/yudao/module/shipment/listener/ShipmentReceivableExcelExportListener2.java
0 → 100644
View file @
722ddaf6
package
cn
.
iocoder
.
yudao
.
module
.
shipment
.
listener
;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.util.StrUtil
;
import
cn.iocoder.yudao.framework.apollo.core.event.export.ShipmentReceivableExcelExportPushEvent2
;
import
cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX
;
import
cn.iocoder.yudao.module.depository.dal.dataobject.warehouse.WarehouseDO
;
import
cn.iocoder.yudao.module.depository.dal.dataobject.warehouse.WarehouseLineDO
;
import
cn.iocoder.yudao.module.depository.dal.mysql.warehouse.WarehouseLineMapper
;
import
cn.iocoder.yudao.module.depository.dto.ContactInfoDTO
;
import
cn.iocoder.yudao.module.depository.service.warehouse.WarehouseService
;
import
cn.iocoder.yudao.module.ecw.api.currency.CurrencyApi
;
import
cn.iocoder.yudao.module.ecw.api.currency.dto.ExchangeRateRespDTO
;
import
cn.iocoder.yudao.module.ecw.dal.dataobject.currency.CurrencyDO
;
import
cn.iocoder.yudao.module.ecw.dal.dataobject.region.RegionDO
;
import
cn.iocoder.yudao.module.ecw.service.currency.CurrencyService
;
import
cn.iocoder.yudao.module.ecw.service.region.RegionService
;
import
cn.iocoder.yudao.module.infra.dal.dataobject.file.FileDO
;
import
cn.iocoder.yudao.module.infra.service.file.FileService
;
import
cn.iocoder.yudao.module.order.dto.OrderBackInfoDto
;
import
cn.iocoder.yudao.module.order.service.order.*
;
import
cn.iocoder.yudao.module.shipment.dal.dataobject.BoxDO
;
import
cn.iocoder.yudao.module.shipment.dal.dataobject.BoxMergePkgDO
;
import
cn.iocoder.yudao.module.shipment.dal.dataobject.BoxPkgOrderDO
;
import
cn.iocoder.yudao.module.shipment.service.box.BoxService
;
import
cn.iocoder.yudao.module.shipment.service.boxMergePkg.BoxMergePkgService
;
import
cn.iocoder.yudao.module.shipment.service.boxPkgOrder.BoxPkgOrderService
;
import
cn.iocoder.yudao.module.shipment.service.boxPreloadGoods.BoxPreloadGoodsService
;
import
cn.iocoder.yudao.module.shipment.vo.boxPreloadGoods.BoxPreloadGoodsBackVO
;
import
cn.iocoder.yudao.module.system.api.user.AdminUserApi
;
import
cn.iocoder.yudao.module.system.framework.ue.UeProperties
;
import
cn.iocoder.yudao.module.wealth.service.receivable.ReceivableService
;
import
cn.iocoder.yudao.module.wealth.vo.receivable.ReceivableOrderPayedFeeTypeVO
;
import
com.alibaba.excel.EasyExcel
;
import
com.alibaba.excel.ExcelWriter
;
import
com.alibaba.excel.write.metadata.WriteSheet
;
import
com.alibaba.excel.write.metadata.fill.FillConfig
;
import
com.alibaba.fastjson.JSONObject
;
import
lombok.AllArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.poi.ss.usermodel.Sheet
;
import
org.apache.poi.ss.usermodel.Workbook
;
import
org.apache.poi.ss.util.CellRangeAddress
;
import
org.apache.poi.xssf.usermodel.XSSFWorkbook
;
import
org.springframework.context.event.EventListener
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.Resource
;
import
java.io.*
;
import
java.math.BigDecimal
;
import
java.math.RoundingMode
;
import
java.time.LocalDateTime
;
import
java.time.format.DateTimeFormatter
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
excel
.
constant
.
ExportConstant
.
DATA_FORMAT
;
import
static
cn
.
iocoder
.
yudao
.
module
.
shipment
.
enums
.
ErrorCodeConstants
.
HAVE_NOT_PRELOAD_GOODS
;
/**
* 自编号订单excel导出监听
*
* @author lanbm 2024-05-25 add
*/
@Component
(
"ShipmentReceivableExcelExportListener2"
)
@AllArgsConstructor
@Slf4j
public
class
ShipmentReceivableExcelExportListener2
{
private
final
OrderQueryService
orderQueryService
;
private
UeProperties
ueProperties
;
private
FileService
fileService
;
@Resource
private
BoxService
boxService
;
@Resource
private
BoxPreloadGoodsService
boxPreloadGoodsService
;
@Resource
private
WarehouseLineMapper
warehouseLineMapper
;
@Resource
private
WarehouseService
warehouseService
;
@Resource
private
RegionService
regionService
;
@Resource
private
CurrencyService
currencyService
;
@Resource
private
ReceivableService
receivableService
;
@Resource
private
CurrencyApi
currencyApi
;
@Resource
private
BoxPkgOrderService
boxPkgOrderService
;
@Resource
private
BoxMergePkgService
boxMergePkgService
;
@Resource
private
AdminUserApi
adminUserApi
;
/**
* 订单导出监听
*
* @param event 编号记录
*/
@EventListener
(
ShipmentReceivableExcelExportPushEvent2
.
class
)
public
void
shipmentReceivableExcelExportPushEvent
(
ShipmentReceivableExcelExportPushEvent2
event
)
{
if
(
StringUtils
.
isNotBlank
(
event
.
getRequestParams
()))
{
try
{
ContactInfoDTO
recipientInfo
=
new
ContactInfoDTO
();
ContactInfoDTO
senderInfo
=
new
ContactInfoDTO
();
DateTimeFormatter
formatter
=
DateTimeFormatter
.
ofPattern
(
DATA_FORMAT
);
String
nowTime
=
formatter
.
format
(
LocalDateTime
.
now
());
String
dir
=
ueProperties
.
getTempDir
().
concat
(
"/receivable/excel/"
);
//先不合并单元格,之后合并,把合并的传到服务器 lanbm 2024-05-25 add
String
fileName
=
event
.
getUserId
().
toString
().
concat
(
StrUtil
.
DASHED
).
concat
(
event
.
getUserType
().
toString
()).
concat
(
StrUtil
.
DASHED
).
concat
(
nowTime
).
concat
(
"receivable_notMerge.xlsx"
);
String
fileNameMerge
=
event
.
getUserId
().
toString
().
concat
(
StrUtil
.
DASHED
).
concat
(
event
.
getUserType
().
toString
()).
concat
(
StrUtil
.
DASHED
).
concat
(
nowTime
).
concat
(
"receivable_Merge.xlsx"
);
List
<
CurrencyDO
>
currencyList
=
currencyService
.
getCurrencyList
();
Map
<
Integer
,
String
>
currencyMap
=
currencyList
.
stream
().
collect
(
Collectors
.
toMap
(
CurrencyDO:
:
getId
,
CurrencyDO:
:
getTitleEn
,
(
key1
,
key2
)
->
key2
));
Map
<
Integer
,
String
>
currencyFuhaoMap
=
currencyList
.
stream
().
collect
(
Collectors
.
toMap
(
CurrencyDO:
:
getId
,
CurrencyDO:
:
getFuhao
,
(
key1
,
key2
)
->
key2
));
InputStream
inputStream
=
null
;
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
event
.
getRequestParams
());
Long
shipmentId
=
jsonObject
.
getLong
(
"shipmentId"
);
inputStream
=
getClass
().
getClassLoader
().
getResourceAsStream
(
ueProperties
.
getTemplatesUrl
()
+
"/nrlyReceivable2.xlsx"
);
BoxDO
box
=
boxService
.
getBox
(
shipmentId
);
WarehouseDO
startWarehouse
=
warehouseService
.
getWarehouse
(
box
.
getStartWarehouseId
());
WarehouseDO
destWarehouse
=
warehouseService
.
getWarehouse
(
box
.
getDestWarehouseId
());
RegionDO
startRegion
=
regionService
.
getRegion
(
startWarehouse
.
getGuojia
());
RegionDO
destRegion
=
regionService
.
getRegion
(
destWarehouse
.
getGuojia
());
WarehouseLineDO
warehouseLineDO
=
warehouseLineMapper
.
findOne
(
box
.
getStartWarehouseId
(),
box
.
getDestWarehouseId
(),
box
.
getTransportType
());
if
(
StringUtils
.
isNotBlank
(
warehouseLineDO
.
getRecipientInfo
()))
{
recipientInfo
=
JSONObject
.
parseObject
(
warehouseLineDO
.
getRecipientInfo
(),
ContactInfoDTO
.
class
);
}
if
(
StringUtils
.
isNotBlank
(
warehouseLineDO
.
getSenderInfo
()))
{
senderInfo
=
JSONObject
.
parseObject
(
warehouseLineDO
.
getSenderInfo
(),
ContactInfoDTO
.
class
);
}
Long
currencyUnit
=
warehouseLineDO
.
getCurrencyUnit
();
Map
headMap
=
new
HashMap
();
Integer
yfCurrency
=
Integer
.
valueOf
(
destRegion
.
getImportCurrency1
());
//运费币种
Integer
qgCurrency
=
Integer
.
valueOf
(
destRegion
.
getImportCurrency2
());
//清关费币种
Integer
otherMainCurrency
=
Integer
.
valueOf
(
destRegion
.
getImportCurrency3
());
//额外费用主币种
Integer
otherAssisCurrency
=
Integer
.
valueOf
(
destRegion
.
getImportCurrency4
());
//额外费用副币种
headMap
.
put
(
"tempTitleEn"
,
StringUtils
.
isBlank
(
warehouseLineDO
.
getTempTitleEn
())
?
"GUANGZHOU E&C LOGISTICS LIMITED"
:
warehouseLineDO
.
getTempTitleEn
());
headMap
.
put
(
"tempTitleZh"
,
StringUtils
.
isBlank
(
warehouseLineDO
.
getTempTitleZh
())
?
"广州市捷道国际货运代理有限公司"
:
warehouseLineDO
.
getTempTitleZh
());
headMap
.
put
(
"selfNo"
,
box
.
getSelfNo
());
headMap
.
put
(
"fromZh"
,
senderInfo
.
getName
());
headMap
.
put
(
"fromEn"
,
senderInfo
.
getNameEn
());
headMap
.
put
(
"fromAddressZh"
,
senderInfo
.
getCompanyAddress
());
headMap
.
put
(
"fromAddressEn"
,
senderInfo
.
getCompanyAddressEn
());
headMap
.
put
(
"toZh"
,
recipientInfo
.
getName
());
headMap
.
put
(
"toEn"
,
recipientInfo
.
getNameEn
());
headMap
.
put
(
"toAddressZh"
,
recipientInfo
.
getCompanyAddress
());
headMap
.
put
(
"toAddressEn"
,
recipientInfo
.
getCompanyAddressEn
());
headMap
.
put
(
"currency1"
,
currencyMap
.
get
(
yfCurrency
));
headMap
.
put
(
"currency2"
,
currencyMap
.
get
(
qgCurrency
));
headMap
.
put
(
"currency3"
,
currencyMap
.
get
(
otherMainCurrency
));
headMap
.
put
(
"currency4"
,
currencyMap
.
get
(
otherAssisCurrency
));
headMap
.
put
(
"arrivedDate"
,
DateUtil
.
format
(
new
Date
(),
"yyyy-MM-dd"
));
headMap
.
put
(
"fromCountryEn"
,
startRegion
.
getTitleEn
());
headMap
.
put
(
"fromCountryZh"
,
startRegion
.
getTitleZh
());
headMap
.
put
(
"toCountryEn"
,
destRegion
.
getTitleEn
());
headMap
.
put
(
"toCountryZh"
,
destRegion
.
getTitleZh
());
List
<
BoxPreloadGoodsBackVO
>
goodsItemList
=
boxPreloadGoodsService
.
getShipGoodItemList
(
shipmentId
);
if
(
CollectionUtil
.
isEmpty
(
goodsItemList
))
{
event
.
setResult
(
HAVE_NOT_PRELOAD_GOODS
.
getMsg
());
return
;
}
//以secId排序
goodsItemList
.
sort
(
Comparator
.
comparing
(
BoxPreloadGoodsBackVO:
:
getPkgId
).
reversed
().
thenComparing
(
BoxPreloadGoodsBackVO:
:
getTidanNum
));
//
List
<
Map
<
String
,
Object
>>
list
=
new
ArrayList
<>();
//以订单ID分组
Map
<
Long
,
List
<
BoxPreloadGoodsBackVO
>>
orderMap
=
goodsItemList
.
stream
()
.
collect
(
Collectors
.
groupingBy
(
BoxPreloadGoodsBackVO:
:
getOrderId
,
LinkedHashMap:
:
new
,
Collectors
.
toList
()));
//所有订单的每列合计
BigDecimal
sum1
=
BigDecimal
.
ZERO
;
BigDecimal
sum2
=
BigDecimal
.
ZERO
;
BigDecimal
sum3
=
BigDecimal
.
ZERO
;
BigDecimal
sum4
=
BigDecimal
.
ZERO
;
BigDecimal
sum5
=
BigDecimal
.
ZERO
;
BigDecimal
sum6
=
BigDecimal
.
ZERO
;
BigDecimal
sum7
=
BigDecimal
.
ZERO
;
BigDecimal
sum8
=
BigDecimal
.
ZERO
;
BigDecimal
sum9
=
BigDecimal
.
ZERO
;
BigDecimal
sum10
=
BigDecimal
.
ZERO
;
BigDecimal
sum11
=
BigDecimal
.
ZERO
;
BigDecimal
sum12
=
BigDecimal
.
ZERO
;
BigDecimal
sum13
=
BigDecimal
.
ZERO
;
Integer
sum14
=
0
;
BigDecimal
sum15
=
BigDecimal
.
ZERO
;
BigDecimal
sum16
=
BigDecimal
.
ZERO
;
List
<
BoxMergePkgDO
>
boxMergePkgDOS
=
boxMergePkgService
.
selectList
(
new
LambdaQueryWrapperX
<
BoxMergePkgDO
>().
eq
(
BoxMergePkgDO:
:
getShipmentId
,
shipmentId
).
orderByDesc
(
BoxMergePkgDO:
:
getId
));
for
(
Map
.
Entry
<
Long
,
List
<
BoxPreloadGoodsBackVO
>>
entry
:
orderMap
.
entrySet
())
{
Long
orderId
=
entry
.
getKey
();
OrderBackInfoDto
orderInfo
=
orderQueryService
.
info
(
orderId
);
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"consigneeName"
,
orderInfo
.
getConsigneeVO
().
getName
());
map
.
put
(
"mark"
,
orderInfo
.
getMarks
());
map
.
put
(
"orderNo"
,
orderInfo
.
getOrderNo
());
map
.
put
(
"tidanNo"
,
orderInfo
.
getTidanNo
());
map
.
put
(
"consigneePhone"
,
"+"
+
orderInfo
.
getConsigneeVO
().
getCountryCode
()+
orderInfo
.
getConsigneeVO
().
getPhone
());
//todo 计算应收明细的核销比例,待测试,未减优惠金额
List
<
ReceivableOrderPayedFeeTypeVO
>
payedFeeTypeVOList
=
receivableService
.
getPayedMoneyByFeeType
(
orderId
);
//应收运费
List
<
ReceivableOrderPayedFeeTypeVO
>
collect
=
payedFeeTypeVOList
.
stream
().
filter
(
item
->
item
.
getFeeType
()
==
1
).
collect
(
Collectors
.
toList
());
BigDecimal
changeAmountSum
=
collect
.
stream
().
filter
(
item
->
item
.
getCurrencyId
().
longValue
()
!=
Long
.
valueOf
(
yfCurrency
).
longValue
()).
map
(
item
->
{
BigDecimal
toBigDecimal
=
changeAmountToDestCurrency
(
item
.
getCurrencyId
(),
Long
.
valueOf
(
yfCurrency
),
item
.
getTotalAmount
());
return
toBigDecimal
;
}).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
//运费不同时转换币种后求和
BigDecimal
unChangeAmountSum
=
collect
.
stream
().
filter
(
item
->
item
.
getCurrencyId
().
longValue
()
==
Long
.
valueOf
(
yfCurrency
).
longValue
()).
map
(
ReceivableOrderPayedFeeTypeVO:
:
getTotalAmount
).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
BigDecimal
totalFreight
=
unChangeAmountSum
.
add
(
changeAmountSum
);
totalFreight
=
totalFreight
.
setScale
(
2
,
RoundingMode
.
DOWN
);
map
.
put
(
"totalFreight"
,
currencyFuhaoMap
.
get
(
yfCurrency
)
+
totalFreight
);
sum1
=
sum1
.
add
(
totalFreight
);
//应收清关费
List
<
ReceivableOrderPayedFeeTypeVO
>
clearingList
=
payedFeeTypeVOList
.
stream
().
filter
(
item
->
item
.
getFeeType
()
==
2
).
collect
(
Collectors
.
toList
());
BigDecimal
changeClearingAmountSum
=
clearingList
.
stream
().
filter
(
item
->
item
.
getCurrencyId
().
longValue
()
!=
Long
.
valueOf
(
qgCurrency
).
longValue
()).
map
(
item
->
{
BigDecimal
toBigDecimal
=
changeAmountToDestCurrency
(
item
.
getCurrencyId
(),
Long
.
valueOf
(
qgCurrency
),
item
.
getTotalAmount
());
return
toBigDecimal
;
}).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
//清关费不同时转换币种后求和
BigDecimal
unChangeClearingAmountSum
=
clearingList
.
stream
().
filter
(
item
->
item
.
getCurrencyId
().
longValue
()
==
Long
.
valueOf
(
qgCurrency
).
longValue
()).
map
(
ReceivableOrderPayedFeeTypeVO:
:
getTotalAmount
).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
BigDecimal
totalClearing
=
unChangeClearingAmountSum
.
add
(
changeClearingAmountSum
);
totalClearing
=
totalClearing
.
setScale
(
2
,
RoundingMode
.
DOWN
);
map
.
put
(
"totalClearing"
,
currencyFuhaoMap
.
get
(
qgCurrency
)
+
totalClearing
);
sum2
=
sum2
.
add
(
totalClearing
);
//保价费
List
<
ReceivableOrderPayedFeeTypeVO
>
valuationList
=
payedFeeTypeVOList
.
stream
().
filter
(
item
->
item
.
getFeeType
()
==
6
).
collect
(
Collectors
.
toList
());
BigDecimal
changeValuationAmountSum
=
valuationList
.
stream
().
filter
(
item
->
item
.
getCurrencyId
().
longValue
()
!=
currencyUnit
.
longValue
()).
map
(
item
->
{
BigDecimal
toBigDecimal
=
changeAmountToDestCurrency
(
item
.
getCurrencyId
(),
currencyUnit
,
item
.
getTotalAmount
());
return
toBigDecimal
;
}).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
//保价费不同时转换币种后求和
BigDecimal
unChangeValuationAmountSum
=
valuationList
.
stream
().
filter
(
item
->
item
.
getCurrencyId
().
longValue
()
==
currencyUnit
.
longValue
()).
map
(
ReceivableOrderPayedFeeTypeVO:
:
getTotalAmount
).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
BigDecimal
totalValuation
=
unChangeValuationAmountSum
.
add
(
changeValuationAmountSum
);
map
.
put
(
"totalValuation"
,(
currencyFuhaoMap
.
get
(
currencyUnit
)
==
null
?
""
:
currencyFuhaoMap
.
get
(
currencyUnit
))
+
totalValuation
);
sum3
=
sum3
.
add
(
totalValuation
);
//额外费用
List
<
ReceivableOrderPayedFeeTypeVO
>
otherFeeList
=
payedFeeTypeVOList
.
stream
().
filter
(
item
->
item
.
getFeeType
()
!=
1
&&
item
.
getFeeType
()
!=
2
&&
item
.
getFeeType
()
!=
6
).
collect
(
Collectors
.
toList
());
BigDecimal
changeOtherMainAmountSum
=
otherFeeList
.
stream
().
filter
(
item
->
item
.
getCurrencyId
().
longValue
()
!=
Long
.
valueOf
(
otherAssisCurrency
).
longValue
()
&&
item
.
getCurrencyId
().
longValue
()
!=
Long
.
valueOf
(
otherMainCurrency
).
longValue
()).
map
(
item
->
{
BigDecimal
toBigDecimal
=
changeAmountToDestCurrency
(
item
.
getCurrencyId
(),
Long
.
valueOf
(
otherMainCurrency
),
item
.
getTotalAmount
());
return
toBigDecimal
;
}).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
//额外费不同时转换币种后求和
BigDecimal
unChangeOtherMainAmountSum
=
otherFeeList
.
stream
().
filter
(
item
->
item
.
getCurrencyId
().
longValue
()
==
Long
.
valueOf
(
otherMainCurrency
).
longValue
()).
map
(
ReceivableOrderPayedFeeTypeVO:
:
getTotalAmount
).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
BigDecimal
unChangeOtherAssisAmountSum
=
otherFeeList
.
stream
().
filter
(
item
->
item
.
getCurrencyId
().
longValue
()
==
Long
.
valueOf
(
otherAssisCurrency
).
longValue
()).
map
(
ReceivableOrderPayedFeeTypeVO:
:
getTotalAmount
).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
BigDecimal
totalOtherMain
=
unChangeOtherMainAmountSum
.
add
(
changeOtherMainAmountSum
);
totalOtherMain
=
totalOtherMain
.
setScale
(
2
,
RoundingMode
.
DOWN
);
map
.
put
(
"totalOtherMain"
,
currencyFuhaoMap
.
get
(
otherMainCurrency
)
+
totalOtherMain
);
sum4
=
sum4
.
add
(
totalOtherMain
);
unChangeOtherAssisAmountSum
=
unChangeOtherAssisAmountSum
.
setScale
(
2
,
RoundingMode
.
DOWN
);
map
.
put
(
"totalOtherAssis"
,
currencyFuhaoMap
.
get
(
otherAssisCurrency
)
+
unChangeOtherAssisAmountSum
);
sum5
=
sum5
.
add
(
unChangeOtherAssisAmountSum
);
BigDecimal
totalOrderAmountLeft
=
BigDecimal
.
ZERO
;
BigDecimal
totalOrderAmountRight
=
BigDecimal
.
ZERO
;
totalOrderAmountLeft
=
totalOrderAmountLeft
.
add
(
totalFreight
);
totalOrderAmountRight
=
totalOrderAmountRight
.
add
(
totalClearing
);
//总计加保价费
if
(
currencyUnit
.
longValue
()
==
Long
.
valueOf
(
yfCurrency
).
longValue
())
{
totalOrderAmountLeft
=
totalOrderAmountLeft
.
add
(
totalValuation
);
}
else
if
(
currencyUnit
.
longValue
()
==
Long
.
valueOf
(
qgCurrency
).
longValue
())
{
totalOrderAmountRight
=
totalOrderAmountRight
.
add
(
totalValuation
);
}
else
{
BigDecimal
changedAmount
=
changeAmountToDestCurrency
(
currencyUnit
,
Long
.
valueOf
(
yfCurrency
),
totalValuation
);
totalOrderAmountLeft
=
totalOrderAmountLeft
.
add
(
changedAmount
);
}
if
(
Long
.
valueOf
(
otherMainCurrency
).
longValue
()
==
Long
.
valueOf
(
otherAssisCurrency
).
longValue
())
{
//总计加额外费用主币种
if
(
Long
.
valueOf
(
otherMainCurrency
).
longValue
()
==
Long
.
valueOf
(
yfCurrency
).
longValue
())
{
totalOrderAmountLeft
=
totalOrderAmountLeft
.
add
(
totalOtherMain
);
}
else
if
(
Long
.
valueOf
(
otherMainCurrency
).
longValue
()
==
Long
.
valueOf
(
qgCurrency
).
longValue
())
{
totalOrderAmountRight
=
totalOrderAmountRight
.
add
(
totalOtherMain
);
}
else
{
BigDecimal
changedAmount
=
changeAmountToDestCurrency
(
Long
.
valueOf
(
otherMainCurrency
),
Long
.
valueOf
(
yfCurrency
),
totalOtherMain
);
totalOrderAmountLeft
=
totalOrderAmountLeft
.
add
(
changedAmount
);
}
}
else
{
//总计加额外费用主币种
if
(
Long
.
valueOf
(
otherMainCurrency
).
longValue
()
==
Long
.
valueOf
(
yfCurrency
).
longValue
())
{
totalOrderAmountLeft
=
totalOrderAmountLeft
.
add
(
totalOtherMain
);
}
else
if
(
Long
.
valueOf
(
otherMainCurrency
).
longValue
()
==
Long
.
valueOf
(
qgCurrency
).
longValue
())
{
totalOrderAmountRight
=
totalOrderAmountRight
.
add
(
totalOtherMain
);
}
else
{
BigDecimal
changedAmount
=
changeAmountToDestCurrency
(
Long
.
valueOf
(
otherMainCurrency
),
Long
.
valueOf
(
yfCurrency
),
totalOtherMain
);
totalOrderAmountLeft
=
totalOrderAmountLeft
.
add
(
changedAmount
);
}
//总计加额外费用副币种
if
(
Long
.
valueOf
(
otherAssisCurrency
).
longValue
()
==
Long
.
valueOf
(
yfCurrency
).
longValue
())
{
totalOrderAmountLeft
=
totalOrderAmountLeft
.
add
(
unChangeOtherAssisAmountSum
);
}
else
if
(
Long
.
valueOf
(
otherAssisCurrency
).
longValue
()
==
Long
.
valueOf
(
qgCurrency
).
longValue
())
{
totalOrderAmountRight
=
totalOrderAmountRight
.
add
(
unChangeOtherAssisAmountSum
);
}
else
{
BigDecimal
changedAmount
=
changeAmountToDestCurrency
(
Long
.
valueOf
(
otherAssisCurrency
),
Long
.
valueOf
(
yfCurrency
),
unChangeOtherAssisAmountSum
);
totalOrderAmountLeft
=
totalOrderAmountLeft
.
add
(
changedAmount
);
}
}
totalOrderAmountLeft
=
totalOrderAmountLeft
.
setScale
(
2
,
RoundingMode
.
DOWN
);
map
.
put
(
"totalOrderAmountLeft"
,
currencyFuhaoMap
.
get
(
yfCurrency
)
+
totalOrderAmountLeft
);
sum6
=
sum6
.
add
(
totalOrderAmountLeft
);
totalOrderAmountRight
=
totalOrderAmountRight
.
setScale
(
2
,
RoundingMode
.
DOWN
);
map
.
put
(
"totalOrderAmountRight"
,
currencyFuhaoMap
.
get
(
qgCurrency
)
+
totalOrderAmountRight
);
sum7
=
sum7
.
add
(
totalOrderAmountRight
);
//中国预付运费
List
<
ReceivableOrderPayedFeeTypeVO
>
fromPaymentFreightList
=
payedFeeTypeVOList
.
stream
().
filter
(
item
->
item
.
getCollectionType
()
!=
null
&&
item
.
getCollectionType
()
==
1
&&
item
.
getFeeType
()
==
1
).
collect
(
Collectors
.
toList
());
BigDecimal
changeFromPaymentFreightSum
=
fromPaymentFreightList
.
stream
().
filter
(
item
->
item
.
getCurrencyId
().
longValue
()
!=
Long
.
valueOf
(
yfCurrency
).
longValue
()).
map
(
item
->
{
BigDecimal
toBigDecimal
=
changeAmountToDestCurrency
(
item
.
getCurrencyId
(),
Long
.
valueOf
(
yfCurrency
),
item
.
getPayedAmount
());
return
toBigDecimal
;
}).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
//始发预付运费不同时转换币种后求和
BigDecimal
unChangeFromPaymentFreightSum
=
fromPaymentFreightList
.
stream
().
filter
(
item
->
item
.
getCurrencyId
().
longValue
()
==
Long
.
valueOf
(
yfCurrency
).
longValue
()).
map
(
ReceivableOrderPayedFeeTypeVO:
:
getPayedAmount
).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
BigDecimal
totalFromPaymentFreight
=
unChangeFromPaymentFreightSum
.
add
(
changeFromPaymentFreightSum
);
totalFromPaymentFreight
=
totalFromPaymentFreight
.
setScale
(
2
,
RoundingMode
.
DOWN
);
map
.
put
(
"totalFromPaymentFreight"
,
currencyFuhaoMap
.
get
(
yfCurrency
)
+
totalFromPaymentFreight
);
sum8
=
sum8
.
add
(
totalFromPaymentFreight
);
//中国预付清关费
List
<
ReceivableOrderPayedFeeTypeVO
>
fromPaymentClearingList
=
payedFeeTypeVOList
.
stream
().
filter
(
item
->
item
.
getCollectionType
()
!=
null
&&
item
.
getCollectionType
()
==
1
&&
item
.
getFeeType
()
==
2
).
collect
(
Collectors
.
toList
());
BigDecimal
changeFromPaymentClearingSum
=
fromPaymentClearingList
.
stream
().
filter
(
item
->
item
.
getCurrencyId
().
longValue
()
!=
Long
.
valueOf
(
yfCurrency
).
longValue
()).
map
(
item
->
{
BigDecimal
toBigDecimal
=
changeAmountToDestCurrency
(
item
.
getCurrencyId
(),
Long
.
valueOf
(
yfCurrency
),
item
.
getPayedAmount
());
return
toBigDecimal
;
}).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
//始发预付清关费不同时转换币种后求和
BigDecimal
unChangeFromPaymentClearingSum
=
fromPaymentClearingList
.
stream
().
filter
(
item
->
item
.
getCurrencyId
().
longValue
()
==
Long
.
valueOf
(
yfCurrency
).
longValue
()).
map
(
ReceivableOrderPayedFeeTypeVO:
:
getPayedAmount
).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
BigDecimal
totalFromPaymentClearing
=
unChangeFromPaymentClearingSum
.
add
(
changeFromPaymentClearingSum
);
totalFromPaymentClearing
=
totalFromPaymentClearing
.
setScale
(
2
,
RoundingMode
.
DOWN
);
map
.
put
(
"totalFromPaymentClearing"
,
currencyFuhaoMap
.
get
(
qgCurrency
)
+
totalFromPaymentClearing
);
sum9
=
sum9
.
add
(
totalFromPaymentClearing
);
//目的国预付运费
List
<
ReceivableOrderPayedFeeTypeVO
>
toPaymentFreightList
=
payedFeeTypeVOList
.
stream
().
filter
(
item
->
item
.
getCollectionType
()
!=
null
&&
item
.
getCollectionType
()
==
2
&&
item
.
getFeeType
()
==
1
).
collect
(
Collectors
.
toList
());
if
(
CollectionUtil
.
isEmpty
(
toPaymentFreightList
))
{
toPaymentFreightList
=
payedFeeTypeVOList
.
stream
().
filter
(
item
->
item
.
getCollectionType
()
!=
null
&&
item
.
getCollectionType
()
==
3
&&
item
.
getFeeType
()
==
1
).
collect
(
Collectors
.
toList
());
}
BigDecimal
changeToPaymentFreightSum
=
toPaymentFreightList
.
stream
().
filter
(
item
->
item
.
getCurrencyId
().
longValue
()
!=
Long
.
valueOf
(
yfCurrency
).
longValue
()).
map
(
item
->
{
BigDecimal
toBigDecimal
=
changeAmountToDestCurrency
(
item
.
getCurrencyId
(),
Long
.
valueOf
(
yfCurrency
),
item
.
getPayedAmount
());
return
toBigDecimal
;
}).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
//始发预付运费不同时转换币种后求和
BigDecimal
unChangeToPaymentFreightSum
=
toPaymentFreightList
.
stream
().
filter
(
item
->
item
.
getCurrencyId
().
longValue
()
==
Long
.
valueOf
(
yfCurrency
).
longValue
()).
map
(
ReceivableOrderPayedFeeTypeVO:
:
getPayedAmount
).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
BigDecimal
totalToPaymentFreight
=
unChangeToPaymentFreightSum
.
add
(
changeToPaymentFreightSum
);
totalToPaymentFreight
=
totalToPaymentFreight
.
setScale
(
2
,
RoundingMode
.
DOWN
);
map
.
put
(
"totalToPaymentFreight"
,
currencyFuhaoMap
.
get
(
yfCurrency
)
+
totalToPaymentFreight
);
sum10
=
sum10
.
add
(
totalToPaymentFreight
);
//目的国预付清关费
List
<
ReceivableOrderPayedFeeTypeVO
>
toPaymentClearingList
=
payedFeeTypeVOList
.
stream
().
filter
(
item
->
item
.
getCollectionType
()
!=
null
&&
item
.
getCollectionType
()
==
2
&&
item
.
getFeeType
()
==
2
).
collect
(
Collectors
.
toList
());
if
(
CollectionUtil
.
isEmpty
(
toPaymentFreightList
))
{
toPaymentClearingList
=
payedFeeTypeVOList
.
stream
().
filter
(
item
->
item
.
getCollectionType
()
!=
null
&&
item
.
getCollectionType
()
==
3
&&
item
.
getFeeType
()
==
2
).
collect
(
Collectors
.
toList
());
}
BigDecimal
changeToPaymentClearingSum
=
toPaymentClearingList
.
stream
().
filter
(
item
->
item
.
getCurrencyId
().
longValue
()
!=
Long
.
valueOf
(
qgCurrency
).
longValue
()).
map
(
item
->
{
BigDecimal
toBigDecimal
=
changeAmountToDestCurrency
(
item
.
getCurrencyId
(),
Long
.
valueOf
(
qgCurrency
),
item
.
getPayedAmount
());
return
toBigDecimal
;
}).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
//始发预付运费不同时转换币种后求和
BigDecimal
unChangeToPaymentClearingSum
=
toPaymentClearingList
.
stream
().
filter
(
item
->
item
.
getCurrencyId
().
longValue
()
==
Long
.
valueOf
(
qgCurrency
).
longValue
()).
map
(
ReceivableOrderPayedFeeTypeVO:
:
getPayedAmount
).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
BigDecimal
totalToPaymentClearing
=
unChangeToPaymentClearingSum
.
add
(
changeToPaymentClearingSum
);
totalToPaymentClearing
=
totalToPaymentClearing
.
setScale
(
2
,
RoundingMode
.
DOWN
);
map
.
put
(
"totalToPaymentClearing"
,
currencyFuhaoMap
.
get
(
qgCurrency
)
+
totalToPaymentClearing
);
sum11
=
sum11
.
add
(
totalToPaymentClearing
);
//目的地应收
BigDecimal
orderReceivableAmountLeft
=
totalOrderAmountLeft
.
subtract
(
totalToPaymentFreight
).
subtract
(
totalFromPaymentFreight
);
BigDecimal
orderReceivableAmountRight
=
totalOrderAmountRight
.
subtract
(
totalToPaymentClearing
).
subtract
(
totalFromPaymentClearing
);
orderReceivableAmountLeft
=
orderReceivableAmountLeft
.
setScale
(
2
,
RoundingMode
.
DOWN
);
map
.
put
(
"orderReceivableAmountLeft"
,
currencyFuhaoMap
.
get
(
yfCurrency
)
+
orderReceivableAmountLeft
);
sum12
=
sum12
.
add
(
orderReceivableAmountLeft
);
orderReceivableAmountRight
=
orderReceivableAmountRight
.
setScale
(
2
,
RoundingMode
.
DOWN
);
map
.
put
(
"orderReceivableAmountRight"
,
currencyFuhaoMap
.
get
(
qgCurrency
)
+
orderReceivableAmountRight
);
sum13
=
sum13
.
add
(
orderReceivableAmountRight
);
Long
existInMergePkg
=
boxPkgOrderService
.
selectCount
(
BoxPkgOrderDO:
:
getOrderId
,
orderId
);
if
(
existInMergePkg
!=
null
&&
existInMergePkg
>
0L
)
{
// map.put("sumNum", boxMergePkgDOS.size());
map
.
put
(
"sumNum"
,
"1"
);
}
else
{
map
.
put
(
"sumNum"
,
orderInfo
.
getSumNum
());
sum14
=
sum14
+
orderInfo
.
getSumNum
();
}
map
.
put
(
"sumVolume"
,
orderInfo
.
getSumVolume
());
sum15
=
sum15
.
add
(
orderInfo
.
getSumVolume
());
map
.
put
(
"sumWeight"
,
orderInfo
.
getSumWeight
());
sum16
=
sum16
.
add
(
orderInfo
.
getSumWeight
());
map
.
put
(
"vWeight"
,
orderInfo
.
getVWeight
());
map
.
put
(
"isCargoControl"
,
orderInfo
.
getIsCargoControl
()?
"YES"
:
"NO"
);
map
.
put
(
"objectiveName"
,
orderInfo
.
getLogisticsInfoDto
().
getDestTitleEn
());
map
.
put
(
"consignorPhone"
,
orderInfo
.
getConsignorVO
().
getPhone
());
map
.
put
(
"consignorName"
,
orderInfo
.
getConsignorVO
().
getName
());
if
(
CollectionUtil
.
isNotEmpty
(
entry
.
getValue
()))
{
Long
pkgId
=
entry
.
getValue
().
get
(
0
).
getPkgId
();
if
(
pkgId
!=
null
&&
pkgId
>
0L
)
{
BoxMergePkgDO
boxMergePkgDO
=
boxMergePkgService
.
selectOne
(
BoxMergePkgDO:
:
getId
,
pkgId
);
map
.
put
(
"remark"
,
boxMergePkgDO
.
getPkgNum
());
}
}
if
(
orderInfo
.
getSalesmanId
()
!=
null
&&
orderInfo
.
getSalesmanId
().
longValue
()
>
0L
)
{
map
.
put
(
"accountManager"
,
getUserName
(
String
.
valueOf
(
orderInfo
.
getSalesmanId
())));
}
list
.
add
(
map
);
}
headMap
.
put
(
"sum1"
,
currencyFuhaoMap
.
get
(
yfCurrency
)
+
sum1
);
headMap
.
put
(
"sum2"
,
currencyFuhaoMap
.
get
(
qgCurrency
)
+
sum2
);
headMap
.
put
(
"sum3"
,(
currencyFuhaoMap
.
get
(
currencyUnit
)==
null
?
""
:
currencyFuhaoMap
.
get
(
currencyUnit
))
+
sum3
);
headMap
.
put
(
"sum4"
,
currencyFuhaoMap
.
get
(
otherMainCurrency
)
+
sum4
);
headMap
.
put
(
"sum5"
,
currencyFuhaoMap
.
get
(
otherAssisCurrency
)
+
sum5
);
headMap
.
put
(
"sum6"
,
currencyFuhaoMap
.
get
(
yfCurrency
)
+
sum6
);
headMap
.
put
(
"sum7"
,
currencyFuhaoMap
.
get
(
qgCurrency
)
+
sum7
);
headMap
.
put
(
"sum8"
,
currencyFuhaoMap
.
get
(
yfCurrency
)
+
sum8
);
headMap
.
put
(
"sum9"
,
currencyFuhaoMap
.
get
(
qgCurrency
)
+
sum9
);
headMap
.
put
(
"sum10"
,
currencyFuhaoMap
.
get
(
yfCurrency
)
+
sum10
);
headMap
.
put
(
"sum11"
,
currencyFuhaoMap
.
get
(
qgCurrency
)
+
sum11
);
headMap
.
put
(
"sum12"
,
currencyFuhaoMap
.
get
(
yfCurrency
)
+
sum12
);
headMap
.
put
(
"sum13"
,
currencyFuhaoMap
.
get
(
qgCurrency
)
+
sum13
);
int
sumCount
=
0
;
for
(
BoxMergePkgDO
boxMergePkgDO
:
boxMergePkgDOS
)
{
Long
count
=
boxPkgOrderService
.
selectCount
(
BoxPkgOrderDO:
:
getPkgId
,
boxMergePkgDO
.
getId
());
if
(
count
!=
null
&&
count
>
0L
)
{
sumCount
=
sumCount
+
1
;
}
}
headMap
.
put
(
"sum14"
,
sum14
+
sumCount
);
headMap
.
put
(
"sum15"
,
sum15
);
headMap
.
put
(
"sum16"
,
sum16
);
StringBuffer
stringBuffer
=
new
StringBuffer
();
if
(
otherMainCurrency
.
intValue
()
==
otherAssisCurrency
.
intValue
())
{
stringBuffer
.
append
(
currencyMap
.
get
(
otherMainCurrency
)).
append
(
":"
).
append
(
sum4
);
}
else
{
stringBuffer
.
append
(
currencyMap
.
get
(
otherMainCurrency
)).
append
(
":"
).
append
(
sum4
).
append
(
" "
).
append
(
currencyMap
.
get
(
otherAssisCurrency
)).
append
(
":"
).
append
(
sum5
);
}
headMap
.
put
(
"otherFee"
,
stringBuffer
.
toString
());
File
fileDir
=
new
File
(
dir
);
if
(!
fileDir
.
exists
()){
// 不存在则创建一个目录
fileDir
.
mkdirs
();
}
ExcelWriter
excelWriter
=
EasyExcel
.
write
(
dir
+
fileName
).
withTemplate
(
inputStream
).
build
();
WriteSheet
sheet
=
EasyExcel
.
writerSheet
(
0
).
build
();
FillConfig
fillConfig
=
FillConfig
.
builder
().
forceNewRow
(
true
).
build
();
excelWriter
.
fill
(
headMap
,
sheet
);
//填充非循环数据--表头
excelWriter
.
fill
(
list
,
fillConfig
,
sheet
);
//填充循环数据--表数据
excelWriter
.
finish
();
inputStream
.
close
();
// 获取到临时文件
File
file
=
new
File
(
dir
+
fileName
);
//TODO 利用POI 合并单元格
Workbook
workbook
=
new
XSSFWorkbook
(
file
);
Sheet
poiSheet
=
workbook
.
getSheetAt
(
0
);
if
(
otherMainCurrency
.
intValue
()
==
otherAssisCurrency
.
intValue
())
{
poiSheet
.
addMergedRegion
(
new
CellRangeAddress
(
11
,
11
,
8
,
9
));
for
(
int
i
=
1
;
i
<=
orderMap
.
size
();
i
++)
{
poiSheet
.
addMergedRegion
(
new
CellRangeAddress
(
11
+
i
,
11
+
i
,
8
,
9
));
}
poiSheet
.
addMergedRegion
(
new
CellRangeAddress
(
12
+
orderMap
.
size
(),
12
+
orderMap
.
size
(),
8
,
9
));
}
if
(
CollectionUtil
.
isNotEmpty
(
boxMergePkgDOS
))
{
int
start
=
12
;
for
(
int
i
=
0
;
i
<
boxMergePkgDOS
.
size
();
i
++)
{
int
count
=
boxPkgOrderService
.
selectList
(
new
LambdaQueryWrapperX
<
BoxPkgOrderDO
>().
eq
(
BoxPkgOrderDO:
:
getPkgId
,
boxMergePkgDOS
.
get
(
i
).
getId
()).
groupBy
(
BoxPkgOrderDO:
:
getOrderId
)).
size
();
if
(
count
>
1L
)
{
poiSheet
.
addMergedRegion
(
new
CellRangeAddress
(
start
,
start
+
count
-
1
,
18
,
18
));
poiSheet
.
addMergedRegion
(
new
CellRangeAddress
(
start
,
start
+
count
-
1
,
27
,
27
));
}
start
=
start
+
count
;
}
}
FileOutputStream
fileOutputStream
=
new
FileOutputStream
(
new
File
(
dir
+
fileNameMerge
));
workbook
.
write
(
fileOutputStream
);
fileOutputStream
.
close
();
File
mergeFile
=
new
File
(
dir
+
fileNameMerge
);
// 创建FileInputStream对象
FileInputStream
fileInputStream
=
new
FileInputStream
(
mergeFile
);
// 读取文件内容
byte
[]
fileBytes
=
new
byte
[(
int
)
mergeFile
.
length
()];
fileInputStream
.
read
(
fileBytes
);
// 关闭文件流
fileInputStream
.
close
();
// 将文件上传到资源服务器
FileDO
fileDO
=
fileService
.
createFile
(
dir
,
fileNameMerge
,
fileBytes
);
event
.
setPath
(
fileDO
.
getPath
());
event
.
setFileName
(
fileDO
.
getPath
());
event
.
setUrl
(
fileDO
.
getUrl
());
event
.
setFileId
(
fileDO
.
getId
());
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
event
.
setResult
(
e
.
getMessage
());
}
}
else
{
event
.
setResult
(
"param fail"
);
}
}
private
BigDecimal
changeAmountToDestCurrency
(
Long
fromCurrencyId
,
Long
toCurrencyId
,
BigDecimal
fromAmount
){
BigDecimal
destAmount
=
BigDecimal
.
ZERO
;
ExchangeRateRespDTO
currencyRate
=
currencyApi
.
getCurrencyRate
(
fromCurrencyId
,
toCurrencyId
);
destAmount
=
fromAmount
.
multiply
(
currencyRate
.
getCurrencyRate
());
return
destAmount
;
}
private
String
getUserName
(
String
userId
)
{
if
(
StringUtils
.
isEmpty
(
userId
))
{
return
null
;
}
return
adminUserApi
.
getUser
(
Long
.
valueOf
(
userId
)).
getNickname
();
}
}
yudao-module-shipment/yudao-module-shipment-core/src/main/java/cn/iocoder/yudao/module/shipment/service/box/BoxServiceImpl.java
View file @
722ddaf6
...
@@ -1456,7 +1456,7 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements
...
@@ -1456,7 +1456,7 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements
if
(
CollectionUtil
.
isNotEmpty
(
boxMergePkgDOS
))
{
if
(
CollectionUtil
.
isNotEmpty
(
boxMergePkgDOS
))
{
List
<
Long
>
pkgIds
=
boxMergePkgDOS
.
stream
().
List
<
Long
>
pkgIds
=
boxMergePkgDOS
.
stream
().
map
(
BoxMergePkgDO:
:
getId
).
collect
(
Collectors
.
toList
());
map
(
BoxMergePkgDO:
:
getId
).
collect
(
Collectors
.
toList
());
List
<
BoxPkgOrderDO
>
boxPkgOrderDOS
=
List
<
BoxPkgOrderDO
>
boxPkgOrderDOS
=
boxPkgOrderService
.
selectList
(
BoxPkgOrderDO:
:
getPkgId
,
pkgIds
);
boxPkgOrderService
.
selectList
(
BoxPkgOrderDO:
:
getPkgId
,
pkgIds
);
...
@@ -2504,8 +2504,9 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements
...
@@ -2504,8 +2504,9 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements
public
PageResult
<
BoxBackVO
>
getBoxExitPageAir
(
MyBoxExitQueryVO
query
)
{
public
PageResult
<
BoxBackVO
>
getBoxExitPageAir
(
MyBoxExitQueryVO
query
)
{
Set
<
Long
>
warehouseIdSet
=
getDepartWarehouseId
();
Set
<
Long
>
warehouseIdSet
=
getDepartWarehouseId
();
PageResult
<
BoxDO
>
pageResult
=
selectPage
(
query
,
new
LambdaQuery
<
BoxDO
>()
PageResult
<
BoxDO
>
pageResult
=
selectPage
(
query
,
new
LambdaQuery
<
BoxDO
>()
.
likeIfPresent
(
BoxDO:
:
getSelfNo
,
query
.
getSelfNo
())
.
likeIfPresent
(
BoxDO:
:
getSelfNo
,
//已出仓
query
.
getSelfNo
())
//已出仓 222
.
eq
(
BoxDO:
:
getCheckoutStatus
,
AirCheckoutStatusEnum
.
CHECKOUT
.
getStatus
())
.
eq
(
BoxDO:
:
getCheckoutStatus
,
AirCheckoutStatusEnum
.
CHECKOUT
.
getStatus
())
.
and
(
.
and
(
i
->
i
.
and
(
t
->
i
->
i
.
and
(
t
->
...
@@ -2519,7 +2520,6 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements
...
@@ -2519,7 +2520,6 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements
.
eq
(
BoxDO:
:
getOverMachineExamineStatus
,
BpmProcessInstanceResultEnum
.
APPROVE
.
getResult
())
.
eq
(
BoxDO:
:
getOverMachineExamineStatus
,
BpmProcessInstanceResultEnum
.
APPROVE
.
getResult
())
)
)
)
)
.
and
(
.
and
(
i
->
i
->
i
.
in
(
BoxDO:
:
getStartWarehouseId
,
warehouseIdSet
)
i
.
in
(
BoxDO:
:
getStartWarehouseId
,
warehouseIdSet
)
...
...
yudao-module-shipment/yudao-module-shipment-core/src/main/java/cn/iocoder/yudao/module/shipment/service/boxApproval/BoxApprovalServiceImpl.java
View file @
722ddaf6
...
@@ -895,7 +895,10 @@ public class BoxApprovalServiceImpl extends AbstractService<BoxApprovalMapper, B
...
@@ -895,7 +895,10 @@ public class BoxApprovalServiceImpl extends AbstractService<BoxApprovalMapper, B
case
SHIPMENT_CUSTOMS_DECLARE_REMOVE_SPLIT:
case
SHIPMENT_CUSTOMS_DECLARE_REMOVE_SPLIT:
// 删单退场拆单业务(主要操作流程与部分退场拆单一致)
// 删单退场拆单业务(主要操作流程与部分退场拆单一致)
if
(
result
==
BpmProcessInstanceResultEnum
.
APPROVE
.
getResult
())
{
if
(
result
==
BpmProcessInstanceResultEnum
.
APPROVE
.
getResult
())
{
OrderSplitApplyDetailDto
orderSplitApplyDetailDto
=
JSON
.
parseObject
(
boxApprovalDO
.
getDetails
(),
OrderSplitApplyDetailDto
.
class
);
OrderSplitApplyDetailDto
orderSplitApplyDetailDto
=
JSON
.
parseObject
(
boxApprovalDO
.
getDetails
(),
OrderSplitApplyDetailDto
.
class
);
OrderDO
oldOrder
=
boxService
.
getOrder
(
orderId
);
OrderDO
oldOrder
=
boxService
.
getOrder
(
orderId
);
orderSplitApplyDetailDto
.
setBoxSplitOrder
(
true
);
// 标识为出货拆单,需要保持主拆单原状态、原单价等数据
orderSplitApplyDetailDto
.
setBoxSplitOrder
(
true
);
// 标识为出货拆单,需要保持主拆单原状态、原单价等数据
orderSplitApplyDetailDto
.
setPartRefundSplit
(
true
);
// 标识为部分退场拆单,需要将子状态也保持原有状态(注:删单退场拆单逻辑一致,拆单后状态与母订单一致,等操作退场提交审批后才会修改状态)
orderSplitApplyDetailDto
.
setPartRefundSplit
(
true
);
// 标识为部分退场拆单,需要将子状态也保持原有状态(注:删单退场拆单逻辑一致,拆单后状态与母订单一致,等操作退场提交审批后才会修改状态)
...
@@ -1146,15 +1149,25 @@ public class BoxApprovalServiceImpl extends AbstractService<BoxApprovalMapper, B
...
@@ -1146,15 +1149,25 @@ public class BoxApprovalServiceImpl extends AbstractService<BoxApprovalMapper, B
//==============删单退场=============================
//==============删单退场=============================
case
SHIPMENT_CUSTOMS_DECLARE_REMOVE:
case
SHIPMENT_CUSTOMS_DECLARE_REMOVE:
//解析审核详情
//解析审核详情
CustomsExitType
customsExitType
=
JSON
.
parseObject
(
boxApprovalDO
.
getDetails
(),
CustomsExitType
.
class
);
//出货审批-报关删单退场审核 lanbm 2024-05-25
CustomsExitType
customsExitType
=
JSON
.
parseObject
(
boxApprovalDO
.
getDetails
(),
CustomsExitType
.
class
);
if
(
customsExitType
.
getDeleteExitType
()
==
2
)
{
if
(
customsExitType
.
getDeleteExitType
()
==
2
)
{
opStatus
=
Integer
.
parseInt
(
DcStatueEnum
.
CUSTOMING
.
getDcStatus
()
+
"3"
+
result
);
opStatus
=
Integer
.
parseInt
(
DcStatueEnum
.
CUSTOMING
.
getDcStatus
()
+
"3"
+
result
);
if
(
result
==
BpmProcessInstanceResultEnum
.
APPROVE
.
getResult
())
{
if
(
result
==
BpmProcessInstanceResultEnum
.
APPROVE
.
getResult
())
{
//如果审核通过,重新修改状态为未处理
//如果审核通过,重新修改状态为未处理
boxDO
.
setCheckDealStatus
(
0
);
boxDO
.
setCheckDealStatus
(
0
);
boxOpLogService
.
createBoxOpLog
(
boxDO
.
getId
(),
opStatus
,
"报关删单退场审核成功"
,
"delete return of customs declaration under review success"
,
boxApprovalDO
.
getId
());
boxOpLogService
.
createBoxOpLog
(
boxDO
.
getId
(),
opStatus
,
"报关删单退场审核成功"
,
"delete return of customs declaration under review success"
,
boxApprovalDO
.
getId
());
}
else
if
(
result
==
BpmProcessInstanceResultEnum
.
REJECT
.
getResult
())
{
}
else
if
(
result
==
BpmProcessInstanceResultEnum
.
REJECT
.
getResult
())
{
boxOpLogService
.
createBoxOpLog
(
boxDO
.
getId
(),
opStatus
,
"报关删单审核失败"
,
"delete return of customs declaration under review fail"
,
boxApprovalDO
.
getId
());
boxOpLogService
.
createBoxOpLog
(
boxDO
.
getId
(),
opStatus
,
"报关删单审核失败"
,
"delete return of customs declaration under review fail"
,
boxApprovalDO
.
getId
());
}
}
}
}
boxService
.
updateOrderStatusByShipmentId
(
shipmentId
,
null
,
null
,
boxService
.
updateOrderStatusByShipmentId
(
shipmentId
,
null
,
null
,
...
...
yudao-module-shipment/yudao-module-shipment-core/src/main/java/cn/iocoder/yudao/module/shipment/service/makeBillOfLading/MakeBillOfLadingServiceImpl.java
View file @
722ddaf6
...
@@ -188,7 +188,8 @@ public class MakeBillOfLadingServiceImpl extends AbstractService<MakeBillOfLadin
...
@@ -188,7 +188,8 @@ public class MakeBillOfLadingServiceImpl extends AbstractService<MakeBillOfLadin
}
}
// 插入
// 插入
MakeBillOfLadingDO
makeBillOfLading
=
MakeBillOfLadingConvert
.
INSTANCE
.
convert
(
createReqVO
);
MakeBillOfLadingDO
makeBillOfLading
=
MakeBillOfLadingConvert
.
INSTANCE
.
convert
(
createReqVO
);
//查询shipmentId
//查询shipmentId
List
<
BoxPreloadGoodsDO
>
preloadGoodsDOList
=
boxPreloadGoodsService
.
list
(
new
LambdaQueryWrapper
<
BoxPreloadGoodsDO
>()
List
<
BoxPreloadGoodsDO
>
preloadGoodsDOList
=
boxPreloadGoodsService
.
list
(
new
LambdaQueryWrapper
<
BoxPreloadGoodsDO
>()
...
@@ -251,11 +252,31 @@ public class MakeBillOfLadingServiceImpl extends AbstractService<MakeBillOfLadin
...
@@ -251,11 +252,31 @@ public class MakeBillOfLadingServiceImpl extends AbstractService<MakeBillOfLadin
makeBillOfLadingMapper
.
insert
(
makeBillOfLading
);
makeBillOfLadingMapper
.
insert
(
makeBillOfLading
);
// 返回
// 返回
OrderDO
orderDO
=
orderService
.
selectOne
(
OrderDO:
:
getOrderId
,
createReqVO
.
getOrderId
());
OrderDO
orderDO
=
String
bpmProcessId
=
bpmCreateServiceFactory
.
createBmp
(
SecurityFrameworkUtils
.
getLoginUserId
(),
makeBillOfLading
.
getId
(),
WorkFlowEmus
.
SHIPMENT_BILL_LADING
.
getKey
(),
orderDO
.
getOrderNo
(),
createReqVO
.
getCopyUserId
());
orderService
.
selectOne
(
OrderDO:
:
getOrderId
,
createReqVO
.
getOrderId
());
String
bpmProcessId
=
bpmCreateServiceFactory
.
createBmp
(
SecurityFrameworkUtils
.
getLoginUserId
(),
makeBillOfLading
.
getId
(),
WorkFlowEmus
.
SHIPMENT_BILL_LADING
.
getKey
(),
orderDO
.
getOrderNo
(),
createReqVO
.
getCopyUserId
());
makeBillOfLading
.
setBpmProcessId
(
bpmProcessId
);
makeBillOfLading
.
setBpmProcessId
(
bpmProcessId
);
//lanbm 2024-05-24 修改为自动审批通过
//ecw_make_bill_of_lading
/*
PROCESS(1, "处理中"),
APPROVE(2, "通过"),
REJECT(3, "不通过"),
CANCEL(4, "已取消"),*/
makeBillOfLading
.
setStatus
(
2
);
makeBillOfLadingMapper
.
updateById
(
makeBillOfLading
);
makeBillOfLadingMapper
.
updateById
(
makeBillOfLading
);
orderBusinessService
.
addOrderOperateLog
(
Long
.
valueOf
(
createReqVO
.
getOrderId
()),
"出货操作"
,
"提交提单制作审核"
,
""
);
//提交提单制作审核
orderBusinessService
.
addOrderOperateLog
(
Long
.
valueOf
(
createReqVO
.
getOrderId
()),
"出货操作"
,
"提交提单制作审批通过"
,
""
);
return
makeBillOfLading
.
getId
();
return
makeBillOfLading
.
getId
();
}
}
...
@@ -264,10 +285,18 @@ public class MakeBillOfLadingServiceImpl extends AbstractService<MakeBillOfLadin
...
@@ -264,10 +285,18 @@ public class MakeBillOfLadingServiceImpl extends AbstractService<MakeBillOfLadin
// 校验存在
// 校验存在
this
.
validateMakeBillOfLadingExists
(
updateReqVO
.
getId
());
this
.
validateMakeBillOfLadingExists
(
updateReqVO
.
getId
());
// 更新
// 更新
MakeBillOfLadingDO
updateObj
=
MakeBillOfLadingConvert
.
INSTANCE
.
convert
(
updateReqVO
);
MakeBillOfLadingDO
updateObj
=
MakeBillOfLadingConvert
.
INSTANCE
.
convert
(
updateReqVO
);
//lanbm 2024-05-24 提单直接审批通过
updateObj
.
setStatus
(
2
);
//end lanbm 2024-05-24 提单直接审批通过
makeBillOfLadingMapper
.
updateById
(
updateObj
);
makeBillOfLadingMapper
.
updateById
(
updateObj
);
OrderBackVO
order
=
orderQueryService
.
getOrder
(
Long
.
valueOf
(
makeBillOfLadingMapper
.
selectById
(
updateReqVO
.
getId
()).
getOrderId
()));
OrderBackVO
order
=
orderQueryService
.
getOrder
(
Long
.
valueOf
(
makeBillOfLadingMapper
.
selectById
(
updateReqVO
.
getId
()).
getOrderId
()));
String
bpmProcessId
=
bpmCreateServiceFactory
.
createBmp
(
SecurityFrameworkUtils
.
getLoginUserId
(),
updateReqVO
.
getId
(),
WorkFlowEmus
.
SHIPMENT_BILL_LADING
.
getKey
(),
order
.
getOrderNo
(),
updateReqVO
.
getCopyUserId
());
String
bpmProcessId
=
bpmCreateServiceFactory
.
createBmp
(
SecurityFrameworkUtils
.
getLoginUserId
(),
updateReqVO
.
getId
(),
WorkFlowEmus
.
SHIPMENT_BILL_LADING
.
getKey
(),
order
.
getOrderNo
(),
updateReqVO
.
getCopyUserId
());
updateObj
.
setBpmProcessId
(
bpmProcessId
);
updateObj
.
setBpmProcessId
(
bpmProcessId
);
makeBillOfLadingMapper
.
updateById
(
updateObj
);
makeBillOfLadingMapper
.
updateById
(
updateObj
);
}
}
...
@@ -637,13 +666,21 @@ public class MakeBillOfLadingServiceImpl extends AbstractService<MakeBillOfLadin
...
@@ -637,13 +666,21 @@ public class MakeBillOfLadingServiceImpl extends AbstractService<MakeBillOfLadin
return
stringBuffer
.
toString
();
return
stringBuffer
.
toString
();
}
}
/* lanbm 2024-05-24 添加注释
PROCESS(1, "处理中"),
APPROVE(2, "通过"),
REJECT(3, "不通过"),
CANCEL(4, "已取消"),
*/
@Override
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
updateBillOfLadingResult
(
String
id
,
int
result
)
{
public
void
updateBillOfLadingResult
(
String
id
,
int
result
)
{
MakeBillOfLadingDO
makeBillOfLadingDO
=
new
MakeBillOfLadingDO
();
MakeBillOfLadingDO
makeBillOfLadingDO
=
new
MakeBillOfLadingDO
();
makeBillOfLadingDO
.
setId
(
Long
.
valueOf
(
id
));
makeBillOfLadingDO
.
setId
(
Long
.
valueOf
(
id
));
makeBillOfLadingDO
.
setStatus
(
result
);
makeBillOfLadingDO
.
setStatus
(
result
);
MakeBillOfLadingDO
makeBillOfLadingDO1
=
makeBillOfLadingMapper
.
selectById
(
id
);
MakeBillOfLadingDO
makeBillOfLadingDO1
=
makeBillOfLadingMapper
.
selectById
(
id
);
if
(
result
==
4
)
{
if
(
result
==
4
)
{
makeBillOfLadingMapper
.
updateById
(
makeBillOfLadingDO
);
makeBillOfLadingMapper
.
updateById
(
makeBillOfLadingDO
);
makeBillOfLadingMapper
.
deleteById
(
Long
.
valueOf
(
id
));
makeBillOfLadingMapper
.
deleteById
(
Long
.
valueOf
(
id
));
...
@@ -699,8 +736,9 @@ public class MakeBillOfLadingServiceImpl extends AbstractService<MakeBillOfLadin
...
@@ -699,8 +736,9 @@ public class MakeBillOfLadingServiceImpl extends AbstractService<MakeBillOfLadin
}
}
makeBillOfLadingMapper
.
updateById
(
makeBillOfLadingDO
);
makeBillOfLadingMapper
.
updateById
(
makeBillOfLadingDO
);
if
(
makeBillOfLadingDO1
!=
null
)
{
if
(
makeBillOfLadingDO1
!=
null
)
{
orderBusinessService
.
addOrderOperateLog
(
orderBusinessService
.
addOrderOperateLog
(
Long
.
valueOf
(
makeBillOfLadingDO1
.
getOrderId
()),
"出货操作"
,
"提单制作审核通过"
,
""
);
Long
.
valueOf
(
makeBillOfLadingDO1
.
getOrderId
()),
"出货操作"
,
"提单制作审核通过"
,
""
);
}
}
}
}
// if (result == 2) {
// if (result == 2) {
...
...
yudao-module-shipment/yudao-module-shipment-rest/src/main/java/cn/iocoder/yudao/module/shipment/controller/admin/BoxPreloadGoodsController.java
View file @
722ddaf6
...
@@ -355,6 +355,7 @@ public class BoxPreloadGoodsController {
...
@@ -355,6 +355,7 @@ public class BoxPreloadGoodsController {
@ApiOperation
(
"下载应收汇总"
)
@ApiOperation
(
"下载应收汇总"
)
@ApiImplicitParam
(
name
=
"shipmentId"
,
value
=
"出货单ID"
,
required
=
true
,
example
=
"20"
,
dataTypeClass
=
Long
.
class
)
@ApiImplicitParam
(
name
=
"shipmentId"
,
value
=
"出货单ID"
,
required
=
true
,
example
=
"20"
,
dataTypeClass
=
Long
.
class
)
public
CommonResult
downloadReceivableList
(
@RequestParam
(
"shipmentId"
)
Long
shipmentId
,
HttpServletResponse
response
)
throws
Exception
{
public
CommonResult
downloadReceivableList
(
@RequestParam
(
"shipmentId"
)
Long
shipmentId
,
HttpServletResponse
response
)
throws
Exception
{
//下载应收汇总表 ,修改模板样式 lanbm 2024-04-24 添加注释
BoxDO
box
=
boxService
.
getBox
(
shipmentId
);
BoxDO
box
=
boxService
.
getBox
(
shipmentId
);
FileMakeReqDTO
reqDTO
=
new
FileMakeReqDTO
();
FileMakeReqDTO
reqDTO
=
new
FileMakeReqDTO
();
JSONObject
jsonObject
=
new
JSONObject
();
JSONObject
jsonObject
=
new
JSONObject
();
...
@@ -374,6 +375,7 @@ public class BoxPreloadGoodsController {
...
@@ -374,6 +375,7 @@ public class BoxPreloadGoodsController {
@ApiOperation
(
"下载空运应收汇总"
)
@ApiOperation
(
"下载空运应收汇总"
)
@ApiImplicitParam
(
name
=
"shipmentId"
,
value
=
"出货单ID"
,
required
=
true
,
example
=
"20"
,
dataTypeClass
=
Long
.
class
)
@ApiImplicitParam
(
name
=
"shipmentId"
,
value
=
"出货单ID"
,
required
=
true
,
example
=
"20"
,
dataTypeClass
=
Long
.
class
)
public
CommonResult
downloadAirBillReceivable
(
@RequestParam
(
"shipmentId"
)
Long
shipmentId
,
HttpServletResponse
response
)
throws
Exception
{
public
CommonResult
downloadAirBillReceivable
(
@RequestParam
(
"shipmentId"
)
Long
shipmentId
,
HttpServletResponse
response
)
throws
Exception
{
//下载空运应收款汇总单 lanbm 2024-05-25 添加注释
BoxDO
box
=
boxService
.
getBox
(
shipmentId
);
BoxDO
box
=
boxService
.
getBox
(
shipmentId
);
FileMakeReqDTO
reqDTO
=
new
FileMakeReqDTO
();
FileMakeReqDTO
reqDTO
=
new
FileMakeReqDTO
();
JSONObject
jsonObject
=
new
JSONObject
();
JSONObject
jsonObject
=
new
JSONObject
();
...
...
yudao-module-shipment/yudao-module-shipment-rest/src/main/java/cn/iocoder/yudao/module/shipment/controller/admin/MakeBillOfLadingController.java
View file @
722ddaf6
...
@@ -85,13 +85,16 @@ public class MakeBillOfLadingController {
...
@@ -85,13 +85,16 @@ public class MakeBillOfLadingController {
@Idempotent
(
timeout
=
10
)
@Idempotent
(
timeout
=
10
)
//@PreAuthorize("@ss.hasPermission('shipment:make-bill-of-lading:create')")
//@PreAuthorize("@ss.hasPermission('shipment:make-bill-of-lading:create')")
public
CommonResult
<
Long
>
createMakeBillOfLading
(
@Valid
@RequestBody
MakeBillOfLadingCreateReqVO
createReqVO
)
{
public
CommonResult
<
Long
>
createMakeBillOfLading
(
@Valid
@RequestBody
MakeBillOfLadingCreateReqVO
createReqVO
)
{
//lanbm 2024-05-24 修改此函数,取消审批流程
//ecw_make_bill_of_lading 提单
String
redisKey
=
MessageFormat
.
format
(
BOX_MAKE_LADING_KEY
,
createReqVO
.
getOrderId
().
toString
());
String
redisKey
=
MessageFormat
.
format
(
BOX_MAKE_LADING_KEY
,
createReqVO
.
getOrderId
().
toString
());
Long
count
=
redisHelper
.
incrBy
(
redisKey
,
1
);
Long
count
=
redisHelper
.
incrBy
(
redisKey
,
1
);
if
(
count
>
1
){
if
(
count
>
1
){
return
error
(
BOX_MAKE_LADING_REPEAT_COMMIT
);
return
error
(
BOX_MAKE_LADING_REPEAT_COMMIT
);
}
}
redisHelper
.
expire
(
redisKey
,
1
,
TimeUnit
.
MINUTES
);
redisHelper
.
expire
(
redisKey
,
1
,
TimeUnit
.
MINUTES
);
Long
makeBillOfLading
=
makeBillOfLadingService
.
createMakeBillOfLading
(
createReqVO
);
Long
makeBillOfLading
=
makeBillOfLadingService
.
createMakeBillOfLading
(
createReqVO
);
redisHelper
.
delete
(
redisKey
);
redisHelper
.
delete
(
redisKey
);
return
success
(
makeBillOfLading
);
return
success
(
makeBillOfLading
);
}
}
...
...
yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/downloadLog/DownloadLogServiceImpl.java
View file @
722ddaf6
...
@@ -284,9 +284,11 @@ public class DownloadLogServiceImpl extends AbstractService<DownloadLogMapper, D
...
@@ -284,9 +284,11 @@ public class DownloadLogServiceImpl extends AbstractService<DownloadLogMapper, D
case
SHIPMENT_LOAD_EXCEL_EXPORT:
case
SHIPMENT_LOAD_EXCEL_EXPORT:
shipmentLoadExcelExportPushEvent
(
downloadLog
);
shipmentLoadExcelExportPushEvent
(
downloadLog
);
break
;
break
;
//应收汇总导出
//应收汇总导出
lanbm 2024-05-24 修改导出Excel样式
case
SHIPMENT_RECEIVABLE_EXCEL_EXPORT:
case
SHIPMENT_RECEIVABLE_EXCEL_EXPORT:
shipmentReceivableExcelExportPushEvent
(
downloadLog
);
//老模板导出方式
//shipmentReceivableExcelExportPushEvent(downloadLog);
shipmentReceivableExcelExportPushEvent2
(
downloadLog
);
break
;
break
;
//提单打包导出
//提单打包导出
case
SHIPMENT_BILLING_ZIP_EXPORT:
case
SHIPMENT_BILLING_ZIP_EXPORT:
...
@@ -628,6 +630,25 @@ public class DownloadLogServiceImpl extends AbstractService<DownloadLogMapper, D
...
@@ -628,6 +630,25 @@ public class DownloadLogServiceImpl extends AbstractService<DownloadLogMapper, D
downloadLog
.
setFileId
(
event
.
getFileId
());
downloadLog
.
setFileId
(
event
.
getFileId
());
}
}
/*
lanbm 2024-05-25 add
*/
private
void
shipmentReceivableExcelExportPushEvent2
(
DownloadLogDO
downloadLog
)
{
ShipmentReceivableExcelExportPushEvent2
event
=
new
ShipmentReceivableExcelExportPushEvent2
();
event
.
setUserId
(
downloadLog
.
getUserId
());
event
.
setUserType
(
downloadLog
.
getUserType
());
event
.
setLang
(
downloadLog
.
getLang
());
event
.
setRequestParams
(
downloadLog
.
getRequestParams
());
applicationContext
.
publishEvent
(
event
);
downloadLog
.
setFileName
(
event
.
getFileName
());
downloadLog
.
setPath
(
event
.
getPath
());
downloadLog
.
setDownloadUrl
(
event
.
getUrl
());
downloadLog
.
setResult
(
event
.
getResult
());
downloadLog
.
setFileId
(
event
.
getFileId
());
}
private
void
shipmentLoadExcelExportPushEvent
(
DownloadLogDO
downloadLog
)
{
private
void
shipmentLoadExcelExportPushEvent
(
DownloadLogDO
downloadLog
)
{
ShipmentLoadExcelExportPushEvent
event
=
new
ShipmentLoadExcelExportPushEvent
();
ShipmentLoadExcelExportPushEvent
event
=
new
ShipmentLoadExcelExportPushEvent
();
event
.
setUserId
(
downloadLog
.
getUserId
());
event
.
setUserId
(
downloadLog
.
getUserId
());
...
...
yudao-server/src/main/resources/templates/nrlyReceivable2.xlsx
0 → 100644
View file @
722ddaf6
File added
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