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
5643d79b
Commit
5643d79b
authored
May 13, 2024
by
liuzeheng
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/dev' into dev
parents
3e71c660
68813a00
Changes
26
Show whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
1007 additions
and
401 deletions
+1007
-401
JsonUtils.java
...n/iocoder/yudao/framework/common/util/json/JsonUtils.java
+33
-1
CalculateCustomerTypeEvent.java
...pollo/core/event/Customer/CalculateCustomerTypeEvent.java
+37
-0
CalculateOrderVValueEvent.java
...rk/apollo/core/event/Order/CalculateOrderVValueEvent.java
+31
-0
CalculateOrderYeJiTypeEvent.java
.../apollo/core/event/Order/CalculateOrderYeJiTypeEvent.java
+23
-0
BmpFinanceCommissionPaymentApproveListener.java
.../listener/BmpFinanceCommissionPaymentApproveListener.java
+3
-0
BmpFinanceReceiptApproveListener.java
...ce/finance/listener/BmpFinanceReceiptApproveListener.java
+3
-0
CustomerServiceImpl.java
...module/customer/service/customer/CustomerServiceImpl.java
+58
-3
CustomerController.java
...ustomer/controller/admin/customer/CustomerController.java
+14
-16
CustomerAnalysisControl.java
...le/delivery/controller/admin/CustomerAnalysisControl.java
+1
-4
EcwVzController.java
...dao/module/delivery/controller/admin/EcwVzController.java
+16
-0
OrderExt.java
...oder/yudao/module/delivery/entity/orderdata/OrderExt.java
+10
-0
ErrorCodeConstants.java
...coder/yudao/module/delivery/enums/ErrorCodeConstants.java
+8
-1
CalculateCustomerType.java
...yudao/module/delivery/listener/CalculateCustomerType.java
+62
-0
CalculateOrderVValueListener.java
...odule/delivery/listener/CalculateOrderVValueListener.java
+84
-0
CalculateOrderYeJiTypeListener.java
...ule/delivery/listener/CalculateOrderYeJiTypeListener.java
+59
-0
CustomerAnalysisExcelExportListener.java
...elivery/listener/CustomerAnalysisExcelExportListener.java
+2
-5
OrderExtMapper.java
.../iocoder/yudao/module/delivery/mapper/OrderExtMapper.java
+24
-0
CustomerAnalysisService.java
...udao/module/delivery/service/CustomerAnalysisService.java
+2
-0
EcwVzServiceImpl.java
.../yudao/module/delivery/service/Impl/EcwVzServiceImpl.java
+33
-34
OrderExtMapper.xml
...elivery-rest/src/main/resources/mapper/OrderExtMapper.xml
+41
-0
OrderDO.java
...oder/yudao/module/order/dal/dataobject/order/OrderDO.java
+25
-4
OrderController.java
.../module/order/controller/admin/order/OrderController.java
+29
-23
BoxServiceImpl.java
...der/yudao/module/shipment/service/box/BoxServiceImpl.java
+22
-9
BoxPreloadGoodsServiceImpl.java
...t/service/boxPreloadGoods/BoxPreloadGoodsServiceImpl.java
+383
-301
BoxController.java
...yudao/module/shipment/controller/admin/BoxController.java
+1
-0
MakeBillOfLadingController.java
...shipment/controller/admin/MakeBillOfLadingController.java
+3
-0
No files found.
yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/json/JsonUtils.java
View file @
5643d79b
...
...
@@ -11,8 +11,12 @@ import lombok.SneakyThrows;
import
lombok.experimental.UtilityClass
;
import
lombok.extern.slf4j.Slf4j
;
import
java.io.File
;
import
java.io.FileOutputStream
;
import
java.io.IOException
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
/**
...
...
@@ -132,4 +136,32 @@ public class JsonUtils {
}
}
/*
lanbm 2024-04-12 add
保存指定的测试信息
*/
public
static
void
SaveLog
(
String
content
)
{
FileOutputStream
outputStream
=
null
;
try
{
File
file
=
new
File
(
"D:\\ProjectLog\\TestLog.txt"
);
outputStream
=
new
FileOutputStream
(
file
,
true
);
Date
day
=
new
Date
();
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
String
s
=
sdf
.
format
(
day
);
content
=
s
+
":"
+
content
;
byte
[]
bytes
=
content
.
getBytes
();
outputStream
.
write
(
bytes
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
finally
{
if
(
outputStream
!=
null
)
{
try
{
outputStream
.
close
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
}
}
}
yudao-framework/yudao-spring-boot-starter-config/src/main/java/cn/iocoder/yudao/framework/apollo/core/event/Customer/CalculateCustomerTypeEvent.java
0 → 100644
View file @
5643d79b
package
cn
.
iocoder
.
yudao
.
framework
.
apollo
.
core
.
event
.
Customer
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
/*
lanbm 2024-05-07 添加公海捞取是计算客户类型
*/
@Data
public
class
CalculateCustomerTypeEvent
{
/**
* 客户编码
*/
private
String
customerNumber
;
/*
客户ID
*/
private
Long
customerId
;
/*
新客户经理
*/
private
Long
oldCustomerService
;
/*
老客户经理
*/
private
Long
newCustomerService
;
/*
客户状态:1.线索2.意向3.成交
通过客户状态来判断客户是否是已成交客户
*/
private
Integer
status
;
}
yudao-framework/yudao-spring-boot-starter-config/src/main/java/cn/iocoder/yudao/framework/apollo/core/event/Order/CalculateOrderVValueEvent.java
0 → 100644
View file @
5643d79b
package
cn
.
iocoder
.
yudao
.
framework
.
apollo
.
core
.
event
.
Order
;
import
lombok.Data
;
import
java.math.BigDecimal
;
import
java.util.Date
;
/*
lanbm 2024-05-13 add
计算订单V值
*/
@Data
public
class
CalculateOrderVValueEvent
{
/*
订单id
*/
private
Long
orderId
;
/*
根据体积或重量计算出的V值
*/
private
BigDecimal
calVvalue
;
/*
业绩产生时间
*/
private
Date
yejiCreateDate
;
}
yudao-framework/yudao-spring-boot-starter-config/src/main/java/cn/iocoder/yudao/framework/apollo/core/event/Order/CalculateOrderYeJiTypeEvent.java
0 → 100644
View file @
5643d79b
package
cn
.
iocoder
.
yudao
.
framework
.
apollo
.
core
.
event
.
Order
;
import
lombok.Data
;
/*
lanbm 2024-05-13 add
在创建订单或修改订单时计算客户业绩类型
*/
@Data
public
class
CalculateOrderYeJiTypeEvent
{
/*
业绩归属方ID
*/
private
long
customerId
;
/*
订单id
*/
private
Long
orderId
;
}
yudao-module-bpm/yudao-module-bpm-base/src/main/java/cn/iocoder/yudao/module/bpm/service/finance/listener/BmpFinanceCommissionPaymentApproveListener.java
View file @
5643d79b
...
...
@@ -21,6 +21,9 @@ public class BmpFinanceCommissionPaymentApproveListener extends BpmProcessInstan
@Override
protected
void
onEvent
(
BpmProcessInstanceResultEvent
event
)
{
//lanbm 2024-05-13 添加注释
//ecw_payment 付款单审批回调函数
//ecw_payment_approval 付款单审核表
log
.
info
(
"--------------------------------------------{},{}"
,
event
.
getBusinessKey
(),
event
.
getResult
());
financePaymentApproveService
.
financeApproveCallBack
(
WorkFlowEmus
.
FINANCE_COMMISSION_PAYMENT_APPROVE
.
getKey
(),
event
.
getBusinessKey
(),
event
.
getResult
());
}
...
...
yudao-module-bpm/yudao-module-bpm-base/src/main/java/cn/iocoder/yudao/module/bpm/service/finance/listener/BmpFinanceReceiptApproveListener.java
View file @
5643d79b
...
...
@@ -24,6 +24,9 @@ public class BmpFinanceReceiptApproveListener extends BpmProcessInstanceResultEv
@Override
protected
void
onEvent
(
BpmProcessInstanceResultEvent
event
)
{
//lanbm 2024-05-13添加注释
//财务收款单 ecw_receipt
//收款单或者收款明细审核表 ecw_receipt_approval
log
.
info
(
"--------------------------------------------{},{}"
,
event
.
getBusinessKey
(),
event
.
getResult
());
financeReceiptApproveService
.
financeApproveCallBack
(
WorkFlowEmus
.
FINANCE_RECEIPT_APPROVE
.
getKey
(),
event
.
getBusinessKey
(),
event
.
getResult
());
}
...
...
yudao-module-customer/yudao-module-customer-core/src/main/java/cn/iocoder/yudao/module/customer/service/customer/CustomerServiceImpl.java
View file @
5643d79b
...
...
@@ -8,8 +8,11 @@ import cn.hutool.core.util.BooleanUtil;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.core.util.StrUtil
;
import
cn.iocoder.yudao.framework.apollo.core.event.AssignConfirmedCustomerEvent
;
import
cn.iocoder.yudao.framework.apollo.core.event.Customer.ReceiveCustomerCalTypeEvent
;
import
cn.iocoder.yudao.framework.apollo.core.event.AutoProcessNotCustomerServiceExceptionEvent
;
import
cn.iocoder.yudao.framework.apollo.core.event.Customer.ReceiveCustomerCalTypeEvent
;
import
cn.iocoder.yudao.framework.apollo.core.event.QueryEstimateEnterOpenSeaTimeEvent
;
import
cn.iocoder.yudao.framework.apollo.core.event.Customer.CalculateCustomerTypeEvent
;
import
cn.iocoder.yudao.framework.apollo.core.vo.ApplyInfoVO
;
import
cn.iocoder.yudao.framework.common.exception.ServiceException
;
import
cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil
;
...
...
@@ -517,6 +520,19 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, Custome
//分配确认接收回调
applicationContext
.
publishEvent
(
new
AssignConfirmedCustomerEvent
(
customerId
,
customerNew
.
getCustomerService
()));
//完善客户信息顺便确认接收,对客户类型做逻辑运算
//lanbm 2024-05-08 添加接收确认后判断客户是新客户还是老客户逻辑
//前面的逻辑有可能改了客户的业绩类型,需要再次获取客户信息
CustomerDO
customer2
=
customerMapper
.
selectById
(
customerId
);
ReceiveCustomerCalTypeEvent
event
=
new
ReceiveCustomerCalTypeEvent
();
event
.
setCustomerId
(
customerId
);
event
.
setCustomerNumber
(
customer2
.
getNumber
());
event
.
setIsNew
(
customer2
.
getIsNew
());
applicationContext
.
publishEvent
(
event
);
//end lanbm 2024-05-08 添加接收确认后判断客户是新客户还是老客户逻辑
}
else
{
//纪录编辑日志
customerOperateLogCreateReqVO
.
setOperateType
(
CustomerOperateTypeEnum
.
UPDATE
.
getValue
())
...
...
@@ -2391,6 +2407,8 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, Custome
// 当新客户(已有已装柜订单)分配给其他客户经理,客户经理接收后,业绩类型变成老客户
// 其他情况不需更新注:业绩类型只会从新客户更新到老客户,不反向更新
if
(
Boolean
.
TRUE
.
equals
(
customer
.
getIsNew
()))
{
//根据部门业绩日志表中的信息把新客户变为老客户 lanbm 2024-05-08 添加注释
//ecw_target_log 部门业绩日志表
customerMapper
.
updateCustomerIsNewToOldByTargetLog
(
customerId
);
}
...
...
@@ -2412,6 +2430,15 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, Custome
//分配确认接收回调
applicationContext
.
publishEvent
(
new
AssignConfirmedCustomerEvent
(
customerId
,
customerService
));
//lanbm 2024-05-08 添加接收确认后判断客户是新客户还是老客户逻辑
//前面的逻辑有可能改了客户的业绩类型,需要再次获取客户信息
CustomerDO
customer2
=
customerMapper
.
selectById
(
customerId
);
ReceiveCustomerCalTypeEvent
event
=
new
ReceiveCustomerCalTypeEvent
();
event
.
setCustomerId
(
customerId
);
event
.
setCustomerNumber
(
customer2
.
getNumber
());
event
.
setIsNew
(
customer2
.
getIsNew
());
applicationContext
.
publishEvent
(
event
);
//end lanbm 2024-05-08 添加接收确认后判断客户是新客户还是老客户逻辑
}
private
Date
getEstimateTimeByCustomerStatus
(
CustomerDO
customer
,
Date
now
)
{
...
...
@@ -2435,7 +2462,7 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, Custome
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
catchCustomer
(
Long
customerId
)
{
//lanbm 2024-05-07 添加客户业绩类型逻辑
//捞取公海池客户
CustomerDO
customer
=
customerMapper
.
selectById
(
customerId
);
if
(
customer
==
null
)
{
...
...
@@ -2455,6 +2482,7 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, Custome
throw
exception
(
ErrorCodeConstants
.
CUSTOMER_CATCH_ERROR
);
}
// if (!user.getPostIds().contains(adminUserApi.getActiveCustomerServicePostId())) {
//判断当前用户的角色 lanbm 2024-05-07 添加注释
if
(!
user
.
getPostIds
().
contains
(
2L
)
&&
!
user
.
getPostIds
().
contains
(
19L
))
{
throw
exception
(
ErrorCodeConstants
.
CUSTOMER_CATCH_ERROR
);
}
...
...
@@ -2530,6 +2558,7 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, Custome
Long
newCustomerService
=
loginUserId
;
LoginUser
loginUser
=
SecurityFrameworkUtils
.
getLoginUser
();
//保存客户捞取记录 lanbm 2024-05-07 添加注释
CustomerOperateLogCreateReqVO
customerOperateLogCreateReqVO
=
new
CustomerOperateLogCreateReqVO
()
.
setOperator
(
loginUser
==
null
?
null
:
loginUser
.
getId
())
.
setOperatorName
(
loginUser
==
null
?
null
:
loginUser
.
getNickname
())
...
...
@@ -2549,15 +2578,29 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, Custome
log
.
info
(
"公海池捞取客户[{}]包含海运整柜,设置不掉入公海"
,
customer
.
getId
());
}
// 记录catch时间
//记录catch时间
//对应的数据库表为 ecw_customer_public_catch_log
customerPublicCatchLogMapper
.
insert
(
new
CustomerPublicCatchLogDO
(
null
,
customer
.
getId
(),
loginUserId
));
//捞取完后 自动处理未分配客户经理异常
applicationContext
.
publishEvent
(
new
AutoProcessNotCustomerServiceExceptionEvent
(
customer
.
getNumber
()));
//lanbm 2024-05-07 添加捞取后修改客户是否为新客户的相关逻辑
CalculateCustomerTypeEvent
cevent
=
new
CalculateCustomerTypeEvent
();
cevent
.
setCustomerNumber
(
customer
.
getNumber
());
cevent
.
setStatus
(
customer
.
getStatus
());
cevent
.
setOldCustomerService
(
newCustomerService
);
cevent
.
setOldCustomerService
(
oldCustomerService
);
cevent
.
setCustomerId
(
customer
.
getId
());
applicationContext
.
publishEvent
(
cevent
);
//end lanbm 2024-05-07 添加捞取后修改客户是否为新客户的相关逻辑
}
/*
接收客户,lanbm 2024-05-08 添加客户业绩类型逻辑运算
*/
public
void
receiveCustomer
(
Long
customerId
,
Long
customerServiceId
)
{
CustomerDO
customerDO
=
customerMapper
.
selectById
(
customerId
);
if
(
customerDO
!=
null
)
{
...
...
@@ -2611,6 +2654,18 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, Custome
//分配确认接收回调
applicationContext
.
publishEvent
(
new
AssignConfirmedCustomerEvent
(
customerId
,
customerDO
.
getCustomerService
()));
//报价成功后就会确认接收客户,所以在此做客户类型逻辑运算
//lanbm 2024-05-08 add
//lanbm 2024-05-08 添加接收确认后判断客户是新客户还是老客户逻辑
//前面的逻辑有可能改了客户的业绩类型,需要再次获取客户信息
CustomerDO
customer2
=
customerMapper
.
selectById
(
customerId
);
ReceiveCustomerCalTypeEvent
event
=
new
ReceiveCustomerCalTypeEvent
();
event
.
setCustomerId
(
customerId
);
event
.
setCustomerNumber
(
customer2
.
getNumber
());
event
.
setIsNew
(
customer2
.
getIsNew
());
applicationContext
.
publishEvent
(
event
);
//end lanbm 2024-05-08 添加接收确认后判断客户是新客户还是老客户逻辑
}
}
}
...
...
yudao-module-customer/yudao-module-customer-rest/src/main/java/cn/iocoder/yudao/module/customer/controller/admin/customer/CustomerController.java
View file @
5643d79b
...
...
@@ -129,6 +129,7 @@ public class CustomerController {
@Resource
private
FileMakeApi
fileMakeApi
;
public
CustomerController
()
{
}
...
...
@@ -291,6 +292,7 @@ public class CustomerController {
//完善信息要确认接收
updateReqVO
.
setIsCustomerServiceConfirmed
(
true
);
//lanbm 2024-05-08 完善客户信息确认接收时要计算客户的业绩类型
return
this
.
updateCustomer
(
updateReqVO
);
}
...
...
@@ -448,8 +450,6 @@ public class CustomerController {
}
// @GetMapping("/handover/approval/info")
// @ApiOperation("获取客户移交的审批详情")
// // @PreAuthorize("@ss.hasPermission('ecw:customer:query')")
...
...
@@ -510,12 +510,11 @@ public class CustomerController {
@ApiOperation
(
"跟进客户确认接收"
)
@PreAuthorize
(
"@ss.hasPermission('ecw:customer:treat-accept')"
)
@Idempotent
(
timeout
=
5
)
public
CommonResult
<
Boolean
>
confirm
(
@Valid
@RequestBody
CustomerConfirmReqVO
customerConfirmReqVO
)
{
public
CommonResult
<
Boolean
>
confirm
(
@Valid
@RequestBody
CustomerConfirmReqVO
customerConfirmReqVO
)
{
//lanbm 2024-05-08 添加接收确认后判断客户是新客户还是老客户逻辑
Long
id
=
customerConfirmReqVO
.
getCustomerId
();
customerService
.
confirmCustomer
(
id
);
return
success
(
true
);
}
...
...
@@ -565,7 +564,8 @@ public class CustomerController {
@PreAuthorize
(
"@ss.hasPermission('ecw:customer:sea-gain')"
)
@Idempotent
(
timeout
=
5
)
public
CommonResult
<
Boolean
>
catchCustomer
(
@RequestParam
(
"id"
)
Long
id
)
{
//公海池捞取客户,修改客户业绩类型需要调整此处的逻辑
//lanbm 2024-05-07 处理
customerService
.
catchCustomer
(
id
);
return
success
(
true
);
...
...
@@ -731,7 +731,6 @@ public class CustomerController {
}
@PutMapping
(
"/change-customer-fcl"
)
@ApiOperation
(
"设置客户为海运整柜客户/非海运整柜客户"
)
@PreAuthorize
(
"@ss.hasPermission('ecw:customer:fcl')"
)
...
...
@@ -756,7 +755,6 @@ public class CustomerController {
}
@PutMapping
(
"/update-customer-to-old"
)
@ApiOperation
(
"根据客户经理id更新成交状态的新客户为老客户"
)
@ApiImplicitParam
(
name
=
"customerServiceId"
,
value
=
"客户经理id"
,
required
=
true
,
example
=
"1024"
,
dataTypeClass
=
Long
.
class
)
...
...
yudao-module-delivery/yudao-module-delivery-rest/src/main/java/cn/iocoder/yudao/module/delivery/controller/admin/CustomerAnalysisControl.java
View file @
5643d79b
...
...
@@ -63,8 +63,6 @@ public class CustomerAnalysisControl {
@Autowired
private
CustomerAnalysisService
customerAnalysisService
;
@Resource
private
CustomerAnalysisService2
customerAnalysisService2
;
//报表权限信息
@Resource
...
...
@@ -73,8 +71,7 @@ public class CustomerAnalysisControl {
@Resource
private
RedisHelper
redisHelper
;
@Resource
private
view_order_businesstimeService
vieworderbusinesstimeService
;
private
List
<
view_order_businesstime
>
listBData
=
null
;
private
List
<
CustomerAnalysisResp
>
objListResult
=
null
;
...
...
yudao-module-delivery/yudao-module-delivery-rest/src/main/java/cn/iocoder/yudao/module/delivery/controller/admin/EcwVzController.java
View file @
5643d79b
...
...
@@ -3,9 +3,11 @@ package cn.iocoder.yudao.module.delivery.controller.admin;
import
cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX
;
import
cn.iocoder.yudao.module.delivery.entity.EcwVz
;
import
cn.iocoder.yudao.module.delivery.entity.EcwVzPageReq
;
import
cn.iocoder.yudao.module.delivery.listener.TestEvent
;
import
cn.iocoder.yudao.module.delivery.service.EcwVzService
;
import
cn.iocoder.yudao.framework.common.pojo.PageResult
;
import
cn.iocoder.yudao.framework.common.pojo.CommonResult
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
...
...
@@ -28,6 +30,10 @@ public class EcwVzController {
@Resource
private
EcwVzService
ecwVzService
;
@Resource
private
ApplicationContext
applicationContext
;
private
final
String
HYPG
=
"海运拼柜"
;
private
final
String
ZXKY
=
"专线空运"
;
...
...
@@ -114,5 +120,15 @@ public class EcwVzController {
return
success
(
this
.
ecwVzService
.
selectPage
(
PageReq
));
}
@GetMapping
(
"/Test"
)
@Operation
(
summary
=
"测试功能"
)
public
CommonResult
<
Boolean
>
Test
()
{
TestEvent
even
=
new
TestEvent
();
even
.
setName
(
"测试事件监听"
);
applicationContext
.
publishEvent
(
even
);
return
success
(
true
);
}
}
yudao-module-delivery/yudao-module-delivery-rest/src/main/java/cn/iocoder/yudao/module/delivery/entity/orderdata/OrderExt.java
0 → 100644
View file @
5643d79b
package
cn
.
iocoder
.
yudao
.
module
.
delivery
.
entity
.
orderdata
;
import
lombok.Data
;
/*
订单业务逻辑的相关判断 lanbm 2024-05-07 add
此参数暂时未使用
*/
@Data
public
class
OrderExt
{
}
yudao-module-delivery/yudao-module-delivery-rest/src/main/java/cn/iocoder/yudao/module/delivery/enums/ErrorCodeConstants.java
View file @
5643d79b
...
...
@@ -6,4 +6,11 @@ import cn.iocoder.yudao.framework.common.exception.ErrorCode;
public
interface
ErrorCodeConstants
{
ErrorCode
TEST_NOT_EXISTS
=
new
ErrorCode
(
2004020001
,
"单号配置不存在"
);
//ErrorCode ORDER_NOT_EXISTS = new ErrorCode(2004020002, "订单不存在");
//lanbm 2024-05-13 add
ErrorCode
CUSTOMER_NOT_EXISTS
=
new
ErrorCode
(
2004020003
,
"客户不存在"
);
ErrorCode
VCONFIG_NOT_EXISTS
=
new
ErrorCode
(
2004020004
,
"V值配置参数不存在"
);
}
yudao-module-delivery/yudao-module-delivery-rest/src/main/java/cn/iocoder/yudao/module/delivery/listener/CalculateCustomerType.java
0 → 100644
View file @
5643d79b
package
cn
.
iocoder
.
yudao
.
module
.
delivery
.
listener
;
import
cn.iocoder.yudao.framework.apollo.core.event.Customer.CalculateCustomerTypeEvent
;
import
cn.iocoder.yudao.module.customer.service.customer.CustomerService
;
import
lombok.AllArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.context.event.EventListener
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.Resource
;
/*
lanbm 2024-05-07 add
*/
@Component
(
"CalculateCustomerType"
)
@AllArgsConstructor
@Slf4j
public
class
CalculateCustomerType
{
//监听公海捞取事件,计算客户是新客户类型还是老客户类型,此字段用户计算订单业绩类型
@Resource
private
CustomerService
customerService
;
/**
* 客户捞取监听事件 lanbm 2024-05-07 add
* @param event
*/
@EventListener
(
CalculateCustomerTypeEvent
.
class
)
public
void
CalculateCustomerTypePushEvent
(
CalculateCustomerTypeEvent
event
)
{
if
(
event
.
getNewCustomerService
()
==
event
.
getOldCustomerService
())
{
//新客户经理和老客户经理是同一客户经理
//继续判断有无成交记录
//有成交记录 客户业绩类型=老客户
//没成交记录 客户业绩类型=新客户
boolean
bR
=
isHaving_TransactionRecords
(
event
);
if
(
bR
==
true
)
{
//有成交记录
customerService
.
updateCustomerNewOrOld
(
event
.
getCustomerId
(),
false
);
}
else
{
//无成交记录
customerService
.
updateCustomerNewOrOld
(
event
.
getCustomerId
(),
true
);
}
}
else
{
//新客户经理和老客户经理不是同一客户经理
//客户业绩类型=新客户
customerService
.
updateCustomerNewOrOld
(
event
.
getCustomerId
(),
true
);
}
}
/*
通过客户状态来判断有无成交记录
1.线索2.意向3.成交
*/
private
boolean
isHaving_TransactionRecords
(
CalculateCustomerTypeEvent
event
)
{
if
(
event
.
getStatus
()
==
3
)
return
true
;
else
return
false
;
}
}
yudao-module-delivery/yudao-module-delivery-rest/src/main/java/cn/iocoder/yudao/module/delivery/listener/CalculateOrderVValueListener.java
0 → 100644
View file @
5643d79b
package
cn
.
iocoder
.
yudao
.
module
.
delivery
.
listener
;
import
cn.iocoder.yudao.framework.apollo.core.event.Order.CalculateOrderVValueEvent
;
import
cn.iocoder.yudao.framework.apollo.core.event.Order.CalculateOrderYeJiTypeEvent
;
import
cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX
;
import
cn.iocoder.yudao.module.customer.dal.dataobject.customer.CustomerDO
;
import
cn.iocoder.yudao.module.customer.service.customer.CustomerService
;
import
cn.iocoder.yudao.module.delivery.entity.EcwVz
;
import
cn.iocoder.yudao.module.delivery.service.EcwVzService
;
import
cn.iocoder.yudao.module.order.dal.dataobject.order.OrderDO
;
import
cn.iocoder.yudao.module.order.service.order.OrderService
;
import
lombok.AllArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.event.EventListener
;
import
org.springframework.stereotype.Component
;
import
java.math.BigDecimal
;
import
java.util.Date
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
common
.
exception
.
util
.
ServiceExceptionUtil
.
exception
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
common
.
pojo
.
CommonResult
.
success
;
import
static
cn
.
iocoder
.
yudao
.
module
.
order
.
enums
.
ErrorCodeConstants
.
ORDER_EXPRESS_NUMBER_TOO_LONG
;
import
static
cn
.
iocoder
.
yudao
.
module
.
order
.
enums
.
ErrorCodeConstants
.
ORDER_NOT_EXISTS
;
import
static
cn
.
iocoder
.
yudao
.
module
.
delivery
.
enums
.
ErrorCodeConstants
.
VCONFIG_NOT_EXISTS
;
/*
计算订单V值计算 海运已装柜,空运已入仓 计算V值
lanbm 2024-05-13 add
*/
@Component
(
"CalculateOrderVValueListener"
)
@AllArgsConstructor
@Slf4j
public
class
CalculateOrderVValueListener
{
@Autowired
private
OrderService
orderService
;
@Autowired
private
EcwVzService
ecwVzService
;
@EventListener
(
CalculateOrderVValueEvent
.
class
)
public
void
CalculateOrderVValuePushEvent
(
CalculateOrderVValueEvent
event
)
{
OrderDO
orderDO
=
orderService
.
getById
(
event
.
getOrderId
());
if
(
orderDO
==
null
)
{
throw
exception
(
ORDER_NOT_EXISTS
);
}
//订单状态为已入仓之后的状态,其他状态是否排除,后续和客户确认,先按此逻辑处理
int
nS
=
orderDO
.
getStatus
();
if
(
nS
>=
5
)
{
//查询配置参数信息
EcwVz
temp
=
null
;
BigDecimal
CalVvalue
=
new
BigDecimal
(
0
);
if
(
orderDO
.
getTransportId
()
==
1
)
{
//海运计算V值
temp
=
ecwVzService
.
getOne
(
new
LambdaQueryWrapperX
<
EcwVz
>()
.
eqIfPresent
(
EcwVz:
:
getTitleZh
,
"M3"
));
if
(
temp
==
null
)
{
throw
exception
(
VCONFIG_NOT_EXISTS
);
}
CalVvalue
=
new
BigDecimal
(
temp
.
getVz
()).
divide
(
orderDO
.
getSumVolume
());
}
else
if
(
orderDO
.
getTransportId
()
==
3
)
{
//空运计算V值
temp
=
ecwVzService
.
getOne
(
new
LambdaQueryWrapperX
<
EcwVz
>()
.
eqIfPresent
(
EcwVz:
:
getTitleZh
,
"KG"
));
if
(
temp
==
null
)
{
throw
exception
(
VCONFIG_NOT_EXISTS
);
}
CalVvalue
=
new
BigDecimal
(
temp
.
getVz
()).
divide
(
orderDO
.
getSumWeight
());
}
//计算业绩产生时间
if
(
orderDO
.
getRucangTime
()
==
null
)
{
event
.
setYejiCreateDate
(
new
Date
());
}
else
{
event
.
setYejiCreateDate
(
orderDO
.
getRucangTime
());
}
orderService
.
UpdateOrderVValue
(
event
.
getOrderId
(),
CalVvalue
,
event
.
getYejiCreateDate
());
}
}
}
yudao-module-delivery/yudao-module-delivery-rest/src/main/java/cn/iocoder/yudao/module/delivery/listener/CalculateOrderYeJiTypeListener.java
0 → 100644
View file @
5643d79b
package
cn
.
iocoder
.
yudao
.
module
.
delivery
.
listener
;
import
cn.iocoder.yudao.framework.apollo.core.event.Customer.CalculateCustomerTypeEvent
;
import
cn.iocoder.yudao.framework.apollo.core.event.Order.CalculateOrderYeJiTypeEvent
;
import
cn.iocoder.yudao.module.customer.dal.dataobject.customer.CustomerDO
;
import
cn.iocoder.yudao.module.customer.service.customer.CustomerService
;
import
cn.iocoder.yudao.module.order.dal.dataobject.order.OrderDO
;
import
cn.iocoder.yudao.module.order.service.order.OrderService
;
import
lombok.AllArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.event.EventListener
;
import
org.springframework.stereotype.Component
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
common
.
exception
.
util
.
ServiceExceptionUtil
.
exception
;
import
static
cn
.
iocoder
.
yudao
.
module
.
delivery
.
enums
.
ErrorCodeConstants
.
CUSTOMER_NOT_EXISTS
;
import
static
cn
.
iocoder
.
yudao
.
module
.
order
.
enums
.
ErrorCodeConstants
.
ORDER_NOT_EXISTS
;
/*
计算订单业绩类型监听
lanbm 2024-05-13 add
*/
@Component
(
"CalculateOrderYeJiTypeListener"
)
@AllArgsConstructor
@Slf4j
public
class
CalculateOrderYeJiTypeListener
{
@Autowired
private
OrderService
orderService
;
@Autowired
private
CustomerService
customerService
;
@EventListener
(
CalculateOrderYeJiTypeEvent
.
class
)
public
void
CalculateOrderYeJiTypePushEvent
(
CalculateOrderYeJiTypeEvent
event
)
{
OrderDO
orderDO
=
orderService
.
getById
(
event
.
getOrderId
());
if
(
orderDO
==
null
)
{
throw
exception
(
ORDER_NOT_EXISTS
);
}
//获取订单中计算号的业绩归属客户ID
event
.
setCustomerId
(
orderDO
.
getCustomerId
());
CustomerDO
customerDO
=
customerService
.
getById
(
event
.
getCustomerId
());
if
(
customerDO
==
null
)
{
throw
exception
(
CUSTOMER_NOT_EXISTS
);
}
int
isNew
=
0
;
if
(
customerDO
.
getIsNew
()
==
true
)
isNew
=
1
;
//新客户业绩类型
else
isNew
=
0
;
//老客户业绩类型
orderService
.
UpdateOrderYeJiType
(
event
.
getOrderId
(),
isNew
);
}
}
yudao-module-delivery/yudao-module-delivery-rest/src/main/java/cn/iocoder/yudao/module/delivery/listener/CustomerAnalysisExcelExportListener.java
View file @
5643d79b
...
...
@@ -76,17 +76,14 @@ public class CustomerAnalysisExcelExportListener {
concat
(
"客户分析报表.xlsx"
);
List
<
CustomerAnalysisResp
>
list
=
customerAnalysisService
.
getLis
t
(
query
);
customerAnalysisService
.
GetDataListResul
t
(
query
);
//把查询列表转换位Excel对象
List
<
CustomerAnalysisExcelResp
>
listExel
=
CustomerAnalysis
.
INSTANCE
.
convertList
(
list
);
String
path
=
ExcelUtils
.
write
(
dir
,
fileName
,
"客户分析报表"
,
CustomerAnalysisExcelResp
.
class
,
listExel
);
// 获取到临时文件
File
file
=
new
File
(
path
);
// 创建FileInputStream对象
...
...
yudao-module-delivery/yudao-module-delivery-rest/src/main/java/cn/iocoder/yudao/module/delivery/mapper/OrderExtMapper.java
0 → 100644
View file @
5643d79b
package
cn
.
iocoder
.
yudao
.
module
.
delivery
.
mapper
;
import
cn.iocoder.yudao.framework.apollo.core.event.Customer.ReceiveCustomerCalTypeEvent
;
import
cn.iocoder.yudao.module.delivery.entity.orderdata.OrderExt
;
import
org.apache.ibatis.annotations.Mapper
;
@Mapper
public
interface
OrderExtMapper
{
/*
客户为发货方是否有订单
*/
int
IsHavingOrderConsignor
(
ReceiveCustomerCalTypeEvent
event
);
/*
客户为收货方是否有订单
*/
int
IsHavingOrderConsignee
(
ReceiveCustomerCalTypeEvent
event
);
/*
上面2个函数废弃不用了,用此函数来判断客户是否已经产生了订单
*/
int
IsHavingOrder
(
ReceiveCustomerCalTypeEvent
event
);
}
yudao-module-delivery/yudao-module-delivery-rest/src/main/java/cn/iocoder/yudao/module/delivery/service/CustomerAnalysisService.java
View file @
5643d79b
...
...
@@ -10,6 +10,8 @@ import java.util.List;
public
interface
CustomerAnalysisService
{
PageResult
<
CustomerAnalysisResp
>
getListPage
(
CustomerAnalysisReq
req
)
throws
JsonProcessingException
;
...
...
yudao-module-delivery/yudao-module-delivery-rest/src/main/java/cn/iocoder/yudao/module/delivery/service/Impl/EcwVzServiceImpl.java
View file @
5643d79b
...
...
@@ -10,6 +10,7 @@ import cn.iocoder.yudao.module.delivery.service.EcwVzService;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.*
;
import
javax.validation.Valid
;
...
...
@@ -20,83 +21,81 @@ import javax.validation.Valid;
* @since 2024-04-02 22:38:22
*/
@Service
(
"ecwVzService"
)
public
class
EcwVzServiceImpl
extends
ServiceImpl
<
EcwVzMapper
,
EcwVz
>
implements
EcwVzService
{
public
class
EcwVzServiceImpl
extends
ServiceImpl
<
EcwVzMapper
,
EcwVz
>
implements
EcwVzService
{
@Autowired
private
EcwVzMapper
ecwVzMapper
;
/**
* 创建测试
*
* @param createReq 创建信息
* @return 编号
*/
public
Long
create
(
@Valid
EcwVz
createReq
)
{
public
Long
create
(
@Valid
EcwVz
createReq
)
{
ecwVzMapper
.
insert
(
createReq
);
return
createReq
.
getId
();
}
/**
* 更新测试
*
* @param updateReq 更新信息
*/
public
void
update
(
@Valid
EcwVz
updateReq
)
{
public
void
update
(
@Valid
EcwVz
updateReq
)
{
ecwVzMapper
.
updateById
(
updateReq
);
}
/**
* 删除测试
*
* @param id 编号
*/
public
void
delete
(
Long
id
)
{
public
void
delete
(
Long
id
)
{
ecwVzMapper
.
deleteById2
(
id
);
}
/**
* 获得测试
*
* @param id 编号
* @return 测试
*/
public
EcwVz
getModel
(
Long
id
)
{
public
EcwVz
getModel
(
Long
id
)
{
return
ecwVzMapper
.
selectById
(
id
);
}
/**
* 获得测试列表
*
* @param ids 编号
* @return 测试列表
*/
public
List
<
EcwVz
>
getQueryList
(
Collection
<
Long
>
ids
)
{
return
ecwVzMapper
.
selectBatchIds
(
ids
);
public
List
<
EcwVz
>
getQueryList
(
Collection
<
Long
>
ids
)
{
return
ecwVzMapper
.
selectBatchIds
(
ids
);
}
/**
* 获得测试列表, 用于 Excel 导出
*
* @param query 查询
* @return 列表
*/
public
List
<
EcwVz
>
getQueryList
(
EcwVz
query
)
{
return
ecwVzMapper
.
selectList
(
query
);
public
List
<
EcwVz
>
getQueryList
(
EcwVz
query
)
{
return
ecwVzMapper
.
selectList
(
query
);
}
/**
* 获得测试分页
*
* @param page 分页查询
* @param page 查询
* @return 分页列表
*/
public
PageResult
<
EcwVz
>
selectPage
(
EcwVzPageReq
page
)
{
public
PageResult
<
EcwVz
>
selectPage
(
EcwVzPageReq
page
)
{
return
ecwVzMapper
.
selectPage
(
page
);
}
}
yudao-module-delivery/yudao-module-delivery-rest/src/main/resources/mapper/OrderExtMapper.xml
0 → 100644
View file @
5643d79b
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"cn.iocoder.yudao.module.delivery.mapper.OrderExtMapper"
>
<!--发货方,客户是否有订单判断-->
<select
id=
"IsHavingOrderConsignor"
resultType=
"java.lang.Integer"
>
SELECT count(*)
FROM ecw_order o
LEFT JOIN ecw_order_consignor r ON o.order_id = r.order_id
and r.deleted = 0
where o.deleted = 0
and r.customer_id = #{customerId}
and o.status >= 5
<!--订单已取消88,有可能包含在类,暂时未做处理-->
</select>
<!--收货方客户,是否有已入仓订单-->
<select
id=
"IsHavingOrderConsignee"
resultType=
"java.lang.Integer"
>
SELECT count(*)
FROM ecw_order o
LEFT JOIN ecw_order_consignee r ON o.order_id = r.order_id
and r.deleted = 0
where o.deleted = 0
and r.customer_id = #{customerId}
and o.status >= 5
</select>
<select
id=
"IsHavingOrder"
resultType=
"java.lang.Integer"
>
select COUNT(id)
from ecw_target_log
where deleted = 0
and customer_id = #{customerId}
</select>
</mapper>
yudao-module-order/yudao-module-order-core/src/main/java/cn/iocoder/yudao/module/order/dal/dataobject/order/OrderDO.java
View file @
5643d79b
...
...
@@ -12,6 +12,7 @@ import lombok.*;
import
java.math.BigDecimal
;
import
java.util.*
;
import
com.baomidou.mybatisplus.annotation.*
;
import
cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO
;
...
...
@@ -569,10 +570,10 @@ public class OrderDO extends BaseDO {
@TableField
(
exist
=
false
)
@ApiModelProperty
(
value
=
"入仓状态变更前缀(例如:理货移除、预装移除、撤销拆单、装柜移除)"
)
private
String
prefixStatusZh
=
""
;
private
String
prefixStatusZh
=
""
;
@TableField
(
exist
=
false
)
@ApiModelProperty
(
value
=
"入仓状态变更前缀(例如:理货移除、预装移除、撤销拆单、装柜移除)"
)
private
String
prefixStatusEn
=
""
;
private
String
prefixStatusEn
=
""
;
@TableField
(
exist
=
false
)
@ApiModelProperty
(
value
=
"是否主拆单"
)
...
...
@@ -603,4 +604,24 @@ public class OrderDO extends BaseDO {
// @TableField(exist = false)
// @ApiModelProperty(value = "是否重置订单编号")
// private Boolean resetOrderNo;
/*
lanbm 2024-05-13 add
*/
@ApiModelProperty
(
value
=
"客户业绩类型:1 新客户业绩 0老客户业绩"
)
private
Integer
yejiType
;
/*
业绩产生时间 lanbm 2024-05-13 add
*/
private
Date
yejiCreateDate
;
/*
海运根据体积计算出的V值,空运根据重量计算出的V值
lanbm 2024-05-13 add
*/
private
BigDecimal
calVValue
;
}
yudao-module-order/yudao-module-order-rest/src/main/java/cn/iocoder/yudao/module/order/controller/admin/order/OrderController.java
View file @
5643d79b
...
...
@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollectionUtil;
import
cn.hutool.core.io.file.FileNameUtil
;
import
cn.hutool.core.util.IdUtil
;
import
cn.hutool.core.util.StrUtil
;
import
cn.iocoder.yudao.framework.apollo.core.event.Order.CalculateOrderYeJiTypeEvent
;
import
cn.iocoder.yudao.framework.common.enums.UserTypeEnum
;
import
cn.iocoder.yudao.framework.common.exception.ErrorCode
;
import
cn.iocoder.yudao.framework.common.pojo.CommonResult
;
...
...
@@ -62,6 +63,7 @@ import org.apache.commons.io.FileUtils;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
...
...
@@ -120,6 +122,10 @@ public class OrderController {
@Resource
private
RedisHelper
redisHelper
;
//lanbm 2024-05-13 add
@Resource
private
ApplicationContext
applicationContext
;
/**
* 订单修改操作的防重复提交缓存key
...
...
@@ -144,7 +150,10 @@ public class OrderController {
throw
exception
(
ORDER_EXPRESS_NUMBER_TOO_LONG
);
}
}
return
success
(
orderService
.
createOrder
(
createReqVO
,
null
).
getOrderId
());
//lanbm 2024-05-13 添加注释
Long
orderId
=
orderService
.
createOrder
(
createReqVO
,
null
).
getOrderId
();
return
success
(
orderId
);
}
...
...
@@ -165,12 +174,13 @@ public class OrderController {
}
String
redisKey
=
MessageFormat
.
format
(
ORDER_UPDATE_KEY
,
updateReqVO
.
getOrderId
().
toString
());
Long
count
=
redisHelper
.
incrBy
(
redisKey
,
1
);
if
(
count
>
1
){
if
(
count
>
1
)
{
return
error
(
ORDER_UPDATE_REPEAT_COMMIT
);
}
redisHelper
.
expire
(
redisKey
,
1
,
TimeUnit
.
MINUTES
);
orderService
.
updateOrder
(
updateReqVO
,
null
);
redisHelper
.
delete
(
redisKey
);
return
success
(
true
);
}
...
...
@@ -181,7 +191,7 @@ public class OrderController {
public
CommonResult
<
Boolean
>
deleteOrder
(
@RequestParam
(
"orderId"
)
Long
orderId
)
{
String
redisKey
=
MessageFormat
.
format
(
ORDER_UPDATE_KEY
,
orderId
.
toString
());
Long
count
=
redisHelper
.
incrBy
(
redisKey
,
1
);
if
(
count
>
1
){
if
(
count
>
1
)
{
return
error
(
ORDER_UPDATE_REPEAT_COMMIT
);
}
redisHelper
.
expire
(
redisKey
,
1
,
TimeUnit
.
MINUTES
);
...
...
@@ -197,7 +207,7 @@ public class OrderController {
public
CommonResult
<
Boolean
>
recoveryOrder
(
@PathVariable
(
"orderId"
)
Long
orderId
)
{
String
redisKey
=
MessageFormat
.
format
(
ORDER_UPDATE_KEY
,
orderId
.
toString
());
Long
count
=
redisHelper
.
incrBy
(
redisKey
,
1
);
if
(
count
>
1
){
if
(
count
>
1
)
{
return
error
(
ORDER_UPDATE_REPEAT_COMMIT
);
}
redisHelper
.
expire
(
redisKey
,
1
,
TimeUnit
.
MINUTES
);
...
...
@@ -213,7 +223,7 @@ public class OrderController {
public
CommonResult
<
Boolean
>
cancelOrder
(
@PathVariable
(
"orderId"
)
Long
orderId
)
{
String
redisKey
=
MessageFormat
.
format
(
ORDER_UPDATE_KEY
,
orderId
.
toString
());
Long
count
=
redisHelper
.
incrBy
(
redisKey
,
1
);
if
(
count
>
1
){
if
(
count
>
1
)
{
return
error
(
ORDER_UPDATE_REPEAT_COMMIT
);
}
redisHelper
.
expire
(
redisKey
,
1
,
TimeUnit
.
MINUTES
);
...
...
@@ -253,7 +263,7 @@ public class OrderController {
}
String
redisKey
=
MessageFormat
.
format
(
ORDER_UPDATE_KEY
,
updateReqVO
.
getOrderId
().
toString
());
Long
count
=
redisHelper
.
incrBy
(
redisKey
,
1
);
if
(
count
>
1
){
if
(
count
>
1
)
{
return
error
(
ORDER_UPDATE_REPEAT_COMMIT
);
}
redisHelper
.
expire
(
redisKey
,
1
,
TimeUnit
.
MINUTES
);
...
...
@@ -352,11 +362,11 @@ public class OrderController {
}
query
.
setUserType
(
UserTypeEnum
.
ADMIN
.
getValue
());
LoginUser
loginUser
=
SecurityFrameworkUtils
.
getLoginUser
();
if
(
Objects
.
isNull
(
loginUser
)){
if
(
Objects
.
isNull
(
loginUser
))
{
return
error
(
ErrorCodeConstants
.
USER_NOT_EXISTS
);
}
List
<
RoleRespDTO
>
roleRespDTOS
=
roleApi
.
getRoles
(
loginUser
.
getRoleIds
());
if
(
Objects
.
isNull
(
roleRespDTOS
)){
if
(
Objects
.
isNull
(
roleRespDTOS
))
{
return
error
(
ROLE_NOT_EXISTS
);
}
addDataScopeQuery
(
query
,
loginUser
,
roleRespDTOS
);
...
...
@@ -370,7 +380,7 @@ public class OrderController {
boolean
isAll
=
Boolean
.
FALSE
;
for
(
RoleRespDTO
roleRespDTO
:
roleRespDTOS
)
{
DataScopeEnum
dataScopeEnum
=
DataScopeEnum
.
valueOf
(
roleRespDTO
.
getDataScope
());
switch
(
dataScopeEnum
){
switch
(
dataScopeEnum
)
{
case
ALL:
// 全部数据权限,不限制
isAll
=
Boolean
.
TRUE
;
...
...
@@ -393,12 +403,12 @@ public class OrderController {
break
;
}
}
if
(!
isAll
){
if
(!
isAll
)
{
// 非全部数据权限时查询限制条件
if
(
CollectionUtil
.
isEmpty
(
deptIdList
)
||
deptIdList
.
size
()
==
0
){
if
(
CollectionUtil
.
isEmpty
(
deptIdList
)
||
deptIdList
.
size
()
==
0
)
{
// 没有部门限制条件时,只查询当前用户自己的
query
.
setCreator
(
String
.
valueOf
(
loginUser
.
getId
()));
}
else
{
}
else
{
// 查询限定部门的数据
query
.
setDeptIdList
(
deptIdList
);
}
...
...
@@ -670,8 +680,8 @@ public class OrderController {
@RequestParam
(
value
=
"isAllPrice"
,
defaultValue
=
"false"
)
Boolean
isAllPrice
,
@RequestParam
(
value
=
"isResetPrice"
)
Boolean
isResetPrice
)
{
List
<
String
>
list
=
new
ArrayList
<>();
if
(
StringUtils
.
isBlank
(
orderNumbers
)
&&
(
Objects
.
isNull
(
isAllPrice
)
||
!
isAllPrice
)){
return
error
(
new
ErrorCode
(
11110000
,
"请确认是否全部重置"
));
if
(
StringUtils
.
isBlank
(
orderNumbers
)
&&
(
Objects
.
isNull
(
isAllPrice
)
||
!
isAllPrice
))
{
return
error
(
new
ErrorCode
(
11110000
,
"请确认是否全部重置"
));
}
if
(
StringUtils
.
isNotBlank
(
orderNumbers
))
{
list
.
addAll
(
Arrays
.
asList
(
orderNumbers
.
split
(
StrUtil
.
COMMA
)));
...
...
@@ -729,11 +739,11 @@ public class OrderController {
}
query
.
setUserType
(
UserTypeEnum
.
ADMIN
.
getValue
());
LoginUser
loginUser
=
SecurityFrameworkUtils
.
getLoginUser
();
if
(
Objects
.
isNull
(
loginUser
)){
if
(
Objects
.
isNull
(
loginUser
))
{
return
error
(
ErrorCodeConstants
.
USER_NOT_EXISTS
);
}
List
<
RoleRespDTO
>
roleRespDTOS
=
roleApi
.
getRoles
(
loginUser
.
getRoleIds
());
if
(
Objects
.
isNull
(
roleRespDTOS
)){
if
(
Objects
.
isNull
(
roleRespDTOS
))
{
return
error
(
ROLE_NOT_EXISTS
);
}
addDataScopeQuery
(
query
,
loginUser
,
roleRespDTOS
);
...
...
@@ -790,8 +800,4 @@ public class OrderController {
}
}
yudao-module-shipment/yudao-module-shipment-core/src/main/java/cn/iocoder/yudao/module/shipment/service/box/BoxServiceImpl.java
View file @
5643d79b
...
...
@@ -1527,10 +1527,12 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements
List
<
Long
>
warehouseIdList
;
if
(
countryId
!=
null
)
{
List
<
WarehouseDO
>
warehouseList
=
warehouseService
.
findByCountryIdList
(
Collections
.
singletonList
(
countryId
));
List
<
WarehouseDO
>
warehouseList
=
warehouseService
.
findByCountryIdList
(
Collections
.
singletonList
(
countryId
));
warehouseIdList
=
warehouseList
.
stream
().
map
(
WarehouseDO:
:
getId
).
collect
(
Collectors
.
toList
());
query
.
setWarehouseIdList
(
warehouseIdList
);
}
//上面都是处理查询条件相关逻辑
return
boxInfoQuery1
(
boxMapper
.
selectPage2
(
page
,
query
),
false
);
}
...
...
@@ -2292,7 +2294,9 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements
.
map
(
BoxBaseBackVO:
:
getId
)
.
collect
(
Collectors
.
toList
());
Map
<
Long
,
BoxGoodsStatistics
>
shipmentStatisticsMap
=
boxPreloadGoodsService
.
getBoxStatistics
(
idList
);
//ecw_box_preload_goods 预装货物 lanbm 2024-05-13 添加注释
Map
<
Long
,
BoxGoodsStatistics
>
shipmentStatisticsMap
=
boxPreloadGoodsService
.
getBoxStatistics
(
idList
);
List
<
Long
>
cabinetIdList
=
boxBackList
.
stream
()
.
map
(
BoxBaseBackVO:
:
getCabinetId
)
...
...
@@ -2301,6 +2305,7 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements
Map
<
Long
,
CabinetDO
>
cabinetMap
=
new
HashMap
<>();
//ecw_cabinet 柜型配置 lanbm 2024-05-13 添加注释
if
(
CollectionUtils
.
isNotEmpty
(
cabinetIdList
))
{
List
<
CabinetDO
>
cabinetDOList
=
cabinetService
.
getCabinetList
(
cabinetIdList
);
cabinetMap
=
cabinetDOList
.
stream
()
...
...
@@ -2310,7 +2315,9 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements
Set
<
Long
>
destWarehouseIdList
=
boxBackList
.
stream
()
.
map
(
BoxBaseBackVO:
:
getDestWarehouseId
)
.
collect
(
Collectors
.
toSet
());
List
<
WarehouseDO
>
warehouseDOList
=
warehouseService
.
getByIdList
(
new
ArrayList
<>(
destWarehouseIdList
));
//ecw_warehouse 仓库相关信息
List
<
WarehouseDO
>
warehouseDOList
=
warehouseService
.
getByIdList
(
new
ArrayList
<>(
destWarehouseIdList
));
Map
<
Long
,
WarehouseDO
>
warehouseDOMap
=
warehouseDOList
.
stream
()
.
collect
(
Collectors
.
toMap
(
WarehouseDO:
:
getId
,
v
->
v
));
...
...
@@ -2340,22 +2347,28 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements
}
//设置目的地
WarehouseDO
destWarehouse
=
warehouseDOMap
.
get
(
boxBackVO
.
getDestWarehouseId
());
WarehouseRespVO
destWarehouseResp
=
WarehouseConvert
.
INSTANCE
.
convert
(
destWarehouse
);
WarehouseDO
destWarehouse
=
warehouseDOMap
.
get
(
boxBackVO
.
getDestWarehouseId
());
WarehouseRespVO
destWarehouseResp
=
WarehouseConvert
.
INSTANCE
.
convert
(
destWarehouse
);
boxBackVO
.
setDestWarehouseResp
(
destWarehouseResp
);
Long
channelId
=
boxBackVO
.
getShippingChannelId
();
if
(
channelId
!=
null
&&
channelId
!=
0
)
{
ChannelDO
channelDO
=
channelMap
.
get
(
channelId
);
boxBackVO
.
setChannelRespVO
(
ChannelConvert
.
INSTANCE
.
convert
(
channelDO
));
boxBackVO
.
setChannelRespVO
(
ChannelConvert
.
INSTANCE
.
convert
(
channelDO
));
}
//统计信息
BoxGoodsStatistics
boxStatistics
=
shipmentStatisticsMap
.
get
(
shipmentId
);
//统计信息 lanbm2024-05-13 添加注释
BoxGoodsStatistics
boxStatistics
=
shipmentStatisticsMap
.
get
(
shipmentId
);
boxBackVO
.
setBoxStatistics
(
boxStatistics
);
if
(
searchDcDate
)
{
BoxCabinetUnloadDO
boxCabinetUnloadDO
=
boxCabinetUnloadService
.
getOne
(
new
LambdaQueryWrapperX
<
BoxCabinetUnloadDO
>()
BoxCabinetUnloadDO
boxCabinetUnloadDO
=
boxCabinetUnloadService
.
getOne
(
new
LambdaQueryWrapperX
<
BoxCabinetUnloadDO
>()
.
eq
(
BoxCabinetUnloadDO:
:
getShipmentId
,
shipmentId
)
.
last
(
"limit 1"
)
);
...
...
yudao-module-shipment/yudao-module-shipment-core/src/main/java/cn/iocoder/yudao/module/shipment/service/boxPreloadGoods/BoxPreloadGoodsServiceImpl.java
View file @
5643d79b
...
...
@@ -167,16 +167,16 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
//找到出货单
BoxDO
boxDO
=
boxService
.
getBox
(
shipmentId
);
if
(
boxDO
==
null
)
{
if
(
boxDO
==
null
)
{
throw
exception
(
BOX_NOT_EXISTS
);
}
boxService
.
checkApproval
(
shipmentId
,
null
);
if
(
createReqVO
.
getIsCover
()
==
0
)
{
if
(
createReqVO
.
getIsCover
()
==
0
)
{
//排单,先校验出货是否已经预装审核通过了
Integer
prStatus
=
boxDO
.
getPrStatus
();
if
(
prStatus
==
PrStatusEnum
.
PRELOAD_APPROVAL_SUCCESS
.
getPrStatus
())
{
if
(
prStatus
==
PrStatusEnum
.
PRELOAD_APPROVAL_SUCCESS
.
getPrStatus
())
{
throw
new
ServiceException
(
500
,
"出货已排单审核通过。"
);
}
}
...
...
@@ -194,14 +194,14 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
//如果都符合,下面展示互斥和关联订单的弹窗
Integer
relationStatus
=
createReqVO
.
getRelationStatus
();
//校验是否是互斥订单
if
(
relationStatus
==
null
||
relationStatus
==
2
)
{
if
(
relationStatus
==
null
||
relationStatus
==
2
)
{
//校验互斥订单
checkMutualOrder
(
loadList
,
orderDO
);
}
List
<
OrderGuanlianDO
>
orderRelationList
=
null
;
boolean
hasRelationOrder
=
false
;
if
(!
createReqVO
.
isSingleLoad
())
{
if
(!
createReqVO
.
isSingleLoad
())
{
//所有关联订单
orderRelationList
=
orderGuanlianService
.
getRelationList
(
orderId
);
hasRelationOrder
=
CollectionUtil
.
isNotEmpty
(
orderRelationList
);
...
...
@@ -210,7 +210,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
List
<
OrderDO
>
orderList
;
StringBuilder
sb
=
new
StringBuilder
();
if
(
hasRelationOrder
)
{
if
(
hasRelationOrder
)
{
Set
<
Long
>
orderIdSet
=
orderRelationList
.
stream
()
.
flatMap
(
o
->
Stream
.
of
(
o
.
getOrderId
(),
o
.
getRelateOrderId
()))
.
collect
(
Collectors
.
toSet
());
...
...
@@ -220,7 +220,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
.
in
(
BoxPreloadGoodsDO:
:
getOrderId
,
orderIdSet
)
.
eq
(
BoxPreloadGoodsDO:
:
getIsRemove
,
0
)
);
if
(
CollectionUtil
.
isNotEmpty
(
orderLoadList
))
{
if
(
CollectionUtil
.
isNotEmpty
(
orderLoadList
))
{
Set
<
Long
>
loadOrderIdList
=
orderLoadList
.
stream
()
.
map
(
BoxPreloadGoodsDO:
:
getOrderId
)
.
collect
(
Collectors
.
toSet
());
...
...
@@ -253,43 +253,43 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
.
collect
(
Collectors
.
toList
());
boolean
isSuit
=
true
;
if
(
CollectionUtil
.
isNotEmpty
(
notMatchStatusList
))
{
if
(
CollectionUtil
.
isNotEmpty
(
notMatchStatusList
))
{
isSuit
=
false
;
if
(
hasRelationOrder
)
{
if
(
hasRelationOrder
)
{
sb
.
append
(
"<br>"
);
}
List
<
String
>
orderNoList
=
notMatchStatusList
.
stream
()
.
map
(
OrderDO:
:
getOrderNo
)
.
collect
(
Collectors
.
toList
());
String
orderNos
=
Joiner
.
on
(
","
).
join
(
orderNoList
);
sb
.
append
(
"订单:"
)
.
append
(
orderNos
).
append
(
"不是已入仓状态,不能预装"
);
sb
.
append
(
"订单:"
).
append
(
orderNos
).
append
(
"不是已入仓状态,不能预装"
);
}
if
(
CollectionUtil
.
isNotEmpty
(
abnormalList
))
{
if
(
CollectionUtil
.
isNotEmpty
(
abnormalList
))
{
isSuit
=
false
;
if
(
hasRelationOrder
)
{
if
(
hasRelationOrder
)
{
sb
.
append
(
"<br>"
);
}
List
<
String
>
orderNoList
=
abnormalList
.
stream
()
.
map
(
OrderDO:
:
getOrderNo
)
.
collect
(
Collectors
.
toList
());
String
orderNos
=
Joiner
.
on
(
","
).
join
(
orderNoList
);
sb
.
append
(
"订单:"
)
.
append
(
orderNos
).
append
(
"存在异常"
);
sb
.
append
(
"订单:"
).
append
(
orderNos
).
append
(
"存在异常"
);
}
if
(
CollectionUtil
.
isNotEmpty
(
auditList
))
{
if
(
CollectionUtil
.
isNotEmpty
(
auditList
))
{
isSuit
=
false
;
if
(
hasRelationOrder
)
{
if
(
hasRelationOrder
)
{
sb
.
append
(
"<br>"
);
}
List
<
String
>
orderNoList
=
auditList
.
stream
()
.
map
(
OrderDO:
:
getOrderNo
)
.
collect
(
Collectors
.
toList
());
String
orderNos
=
Joiner
.
on
(
","
).
join
(
orderNoList
);
sb
.
append
(
"订单:"
)
.
append
(
orderNos
).
append
(
"审核中"
);
sb
.
append
(
"订单:"
).
append
(
orderNos
).
append
(
"审核中"
);
}
if
(!
isSuit
)
{
if
(!
isSuit
)
{
throw
new
ServiceException
(
500
,
sb
.
toString
());
}
...
...
@@ -299,7 +299,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
//过滤了入仓为0的数据
List
<
OrderItemBackVO
>
orderItemList
=
orderItemService
.
getOrderItemBackByOrderId
(
orderIdList
);
if
(
CollectionUtil
.
isEmpty
(
orderItemList
))
{
if
(
CollectionUtil
.
isEmpty
(
orderItemList
))
{
throw
new
ServiceException
(
500
,
"订单项不存在"
);
}
...
...
@@ -331,15 +331,15 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
sb
.
append
(
"订单:"
).
append
(
item
.
getOrderNo
()).
append
(
","
).
append
(
e
.
getMessage
()).
append
(
"<br>"
);
}
}
if
(!
isSuit
)
{
if
(!
isSuit
)
{
throw
new
ServiceException
(
500
,
sb
.
toString
());
}
checkCabinet
(
boxDO
,
orderItemIdList
);
//都符合,预装,看是否弹出提示
if
(
relationStatus
==
null
||
relationStatus
==
1
)
{
if
(
hasRelationOrder
)
{
if
(
relationStatus
==
null
||
relationStatus
==
1
)
{
if
(
hasRelationOrder
)
{
throw
new
ServiceException
(
566
,
sb
.
toString
());
}
...
...
@@ -350,7 +350,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
BoxPreloadGoodsDO
boxPreloadGoods
=
BoxPreloadGoodsConvert
.
INSTANCE
.
convert
(
createReqVO
);
boxPreloadGoods
.
setOrderItemId
(
orderItem
.
getOrderItemId
());
boxPreloadGoods
.
setOrderId
(
orderItem
.
getOrderId
());
if
(
createReqVO
.
getIsCover
()
!=
null
)
{
if
(
createReqVO
.
getIsCover
()
!=
null
)
{
boxPreloadGoods
.
setIsCover
(
createReqVO
.
getIsCover
());
}
preloadGoodsDOList
.
add
(
boxPreloadGoods
);
...
...
@@ -359,12 +359,12 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
// 插入
boxPreloadGoodsMapper
.
insertBatch
(
preloadGoodsDOList
);
if
(
boxDO
.
getPrStatus
()
==
PrStatusEnum
.
NO_PRELOAD
.
getPrStatus
())
{
if
(
boxDO
.
getPrStatus
()
==
PrStatusEnum
.
NO_PRELOAD
.
getPrStatus
())
{
//修改为预装中
boxDO
.
setPrStatus
(
PrStatusEnum
.
PRELOAD_ING
.
getPrStatus
());
boxService
.
updateById
(
boxDO
);
boxService
.
addOrderLog
(
orderIdList
,
OrderShipmentLog
.
PRELOAD_ADD
,
""
);
}
else
if
(
boxDO
.
getPrStatus
()
==
PrStatusEnum
.
PRELOAD_APPROVAL_SUCCESS
.
getPrStatus
())
{
}
else
if
(
boxDO
.
getPrStatus
()
==
PrStatusEnum
.
PRELOAD_APPROVAL_SUCCESS
.
getPrStatus
())
{
//补单。修改订单状态
for
(
Long
oId
:
orderIdList
)
{
boxService
.
updateOrderStatus
(
oId
,
OrderStatusEnum
.
PRE_INSTALLED
.
getValue
(),
0
,
...
...
@@ -394,7 +394,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
//找到出货单
BoxDO
boxDO
=
boxService
.
getBox
(
shipmentId
);
if
(
boxDO
==
null
)
{
if
(
boxDO
==
null
)
{
throw
exception
(
BOX_NOT_EXISTS
);
}
...
...
@@ -406,7 +406,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
//过滤了入仓为0的数据
List
<
OrderItemBackVO
>
orderItemList
=
orderItemService
.
getOrderItemBackByOrderId
(
Collections
.
singletonList
(
orderId
));
if
(
CollectionUtil
.
isNotEmpty
(
orderItemList
))
{
if
(
CollectionUtil
.
isNotEmpty
(
orderItemList
))
{
orderItemIdList
=
orderItemList
.
stream
()
.
map
(
OrderItemBackVO:
:
getOrderItemId
)
.
collect
(
Collectors
.
toList
());
...
...
@@ -426,7 +426,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
//如果都符合,下面展示互斥和关联订单的弹窗
Integer
relationStatus
=
createReqVO
.
getRelationStatus
();
//校验是否是互斥订单
if
(
relationStatus
==
null
||
relationStatus
==
2
)
{
if
(
relationStatus
==
null
||
relationStatus
==
2
)
{
//校验互斥订单
checkMutualOrder
(
loadList
,
orderDO
);
}
...
...
@@ -436,7 +436,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
for
(
Long
orderItemId
:
orderItemIdList
)
{
BoxPreloadGoodsDO
boxPreloadGoods
=
BoxPreloadGoodsConvert
.
INSTANCE
.
convert
(
createReqVO
);
boxPreloadGoods
.
setOrderItemId
(
orderItemId
);
if
(
createReqVO
.
getIsCover
()
!=
null
)
{
if
(
createReqVO
.
getIsCover
()
!=
null
)
{
boxPreloadGoods
.
setIsCover
(
createReqVO
.
getIsCover
());
}
preloadGoodsDOList
.
add
(
boxPreloadGoods
);
...
...
@@ -445,12 +445,12 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
// 插入
boxPreloadGoodsMapper
.
insertBatch
(
preloadGoodsDOList
);
if
(
boxDO
.
getPrStatus
()
==
PrStatusEnum
.
NO_PRELOAD
.
getPrStatus
())
{
if
(
boxDO
.
getPrStatus
()
==
PrStatusEnum
.
NO_PRELOAD
.
getPrStatus
())
{
//修改为预装中
boxDO
.
setPrStatus
(
PrStatusEnum
.
PRELOAD_ING
.
getPrStatus
());
boxService
.
updateById
(
boxDO
);
boxService
.
addOrderLog
(
Collections
.
singletonList
(
orderId
),
OrderShipmentLog
.
PRELOAD_ADD
,
""
);
}
else
if
(
boxDO
.
getPrStatus
()
==
PrStatusEnum
.
PRELOAD_APPROVAL_SUCCESS
.
getPrStatus
())
{
}
else
if
(
boxDO
.
getPrStatus
()
==
PrStatusEnum
.
PRELOAD_APPROVAL_SUCCESS
.
getPrStatus
())
{
//补单。修改订单状态
boxService
.
updateOrderStatus
(
orderId
,
OrderStatusEnum
.
PRE_INSTALLED
.
getValue
(),
0
,
BoxStatusEnum
.
PREINSTALL_EXAMINE_SUCCESS
.
getStatus
(),
null
,
null
,
Boolean
.
FALSE
);
...
...
@@ -469,9 +469,9 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
PreloadResultVO
preloadResultVO
=
new
PreloadResultVO
();
//校验关联订单
if
(
relationStatus
==
null
||
relationStatus
==
1
)
{
if
(
relationStatus
==
null
||
relationStatus
==
1
)
{
List
<
OrderDO
>
relationOrderList
=
checkRelationOrder
(
boxDO
,
secId
,
orderDO
,
orderItemIdList
,
loadList
);
if
(
CollectionUtil
.
isEmpty
(
relationOrderList
))
return
preloadResultVO
;
if
(
CollectionUtil
.
isEmpty
(
relationOrderList
))
return
preloadResultVO
;
//需要弹窗提醒关联单
List
<
String
>
orderNoList
=
relationOrderList
.
stream
()
...
...
@@ -496,6 +496,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
/**
* 校验关联
*
* @param boxDO 出货单
* @param secId 预装部分
* @param orderDO 预装原始订单
...
...
@@ -508,16 +509,16 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
Long
orderId
=
orderDO
.
getOrderId
();
String
transportType
=
boxDO
.
getTransportType
();
List
<
OrderGuanlianDO
>
guanlianList
=
orderGuanlianService
.
getGuanlianListByOrderId
(
orderId
);
if
(
CollectionUtil
.
isEmpty
(
guanlianList
))
return
null
;
if
(
CollectionUtil
.
isEmpty
(
guanlianList
))
return
null
;
//rIdList为此订单的所有关联订单
List
<
Long
>
rIdList
=
new
ArrayList
<>();
for
(
OrderGuanlianDO
orderGuanlianDO
:
guanlianList
)
{
Long
oId
=
orderGuanlianDO
.
getOrderId
();
Long
rId
=
orderGuanlianDO
.
getRelateOrderId
();
if
(
oId
.
equals
(
orderId
))
{
if
(
oId
.
equals
(
orderId
))
{
rIdList
.
add
((
rId
));
}
else
if
(
rId
.
equals
(
orderId
))
{
}
else
if
(
rId
.
equals
(
orderId
))
{
rIdList
.
add
(
oId
);
}
}
...
...
@@ -530,14 +531,14 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
PageResult
<
BoxOrderPreloadVo
>
pageResult
=
boxOrderPreloadStatistics
.
getDataList
();
List
<
BoxOrderPreloadVo
>
orderList
=
pageResult
.
getList
();
if
(
CollectionUtil
.
isEmpty
(
orderList
))
return
null
;
if
(
CollectionUtil
.
isEmpty
(
orderList
))
return
null
;
//找出符合条件的关联单
orderList
=
orderList
.
stream
()
.
filter
(
t
->
rIdList
.
contains
(
t
.
getOrderId
()))
.
collect
(
Collectors
.
toList
());
if
(
CollectionUtil
.
isEmpty
(
orderList
))
return
null
;
if
(
CollectionUtil
.
isEmpty
(
orderList
))
return
null
;
//剩下的就是符合条件的关联单
//校验这些关联单是否可以和主订单一起合装
...
...
@@ -569,6 +570,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
/**
* 校验互斥订单
*
* @param loadList 已装商品项
* @param orderDO 想要预装的订单
*/
...
...
@@ -579,19 +581,19 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
.
map
(
BoxPreloadGoodsDO:
:
getOrderId
)
.
collect
(
Collectors
.
toSet
());
//已装为空,则不需要校验,
if
(
CollectionUtil
.
isEmpty
(
orderIdSet
))
return
;
if
(
CollectionUtil
.
isEmpty
(
orderIdSet
))
return
;
orderIdSet
.
add
(
orderId
);
List
<
OrderDO
>
orderList
=
orderMutualService
.
searchMutualOrderList
(
orderId
,
orderIdSet
);
if
(
CollectionUtil
.
isEmpty
(
orderList
))
return
;
if
(
CollectionUtil
.
isEmpty
(
orderList
))
return
;
//过滤自己
orderList
=
orderList
.
stream
().
filter
(
t
->
!
t
.
getOrderId
().
equals
(
orderId
)).
collect
(
Collectors
.
toList
());
//过滤不在已装单里面的
orderList
=
orderList
.
stream
().
filter
(
t
->
orderIdSet
.
contains
(
t
.
getOrderId
())).
collect
(
Collectors
.
toList
());
if
(
CollectionUtil
.
isEmpty
(
orderList
))
return
;
if
(
CollectionUtil
.
isEmpty
(
orderList
))
return
;
List
<
String
>
orderNoList
=
orderList
.
stream
()
.
map
(
OrderDO:
:
getOrderNo
)
...
...
@@ -603,6 +605,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
/**
* 校验柜子体积重量
*
* @param boxDO 出货
* @param orderItemIdList 订单项
*/
...
...
@@ -622,16 +625,17 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
BigDecimal
remainWeight
=
cabinetDO
.
getWeight
().
subtract
(
boxGoodsStatistics
.
getWeight
()).
setScale
(
2
,
BigDecimal
.
ROUND_DOWN
);
BoxGoodsStatistics
reloadGoodsStatistics
=
calculationStatistics
(
orderItemDOList
);
if
(
remainVolume
.
compareTo
(
reloadGoodsStatistics
.
getVolume
())
<
0
)
{
if
(
remainVolume
.
compareTo
(
reloadGoodsStatistics
.
getVolume
())
<
0
)
{
throw
exception
(
BOX_VOLUME_EXCEED
);
}
if
(
remainWeight
.
compareTo
(
reloadGoodsStatistics
.
getWeight
())
<
0
)
{
if
(
remainWeight
.
compareTo
(
reloadGoodsStatistics
.
getWeight
())
<
0
)
{
throw
exception
(
BOX_WEIGHT_EXCEED
);
}
}
/**
* 校验仓库始发地、目的地是否符合要求
*
* @param boxDO 出货
* @param orderDO 订单
*/
...
...
@@ -662,26 +666,27 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
//始发仓调仓后的目的仓
Long
adjustToDestWarehouseId
=
orderDO
.
getAdjustToDestWarehouseId
();
if
(
adjustToDestWarehouseId
!=
null
&&
adjustToDestWarehouseId
!=
0
)
{
if
(
adjustToDestWarehouseId
!=
null
&&
adjustToDestWarehouseId
!=
0
)
{
//调仓了,看出货仓库是否与调仓id一样
if
(!
startWarehouseId
.
equals
(
adjustToDestWarehouseId
))
{
if
(!
startWarehouseId
.
equals
(
adjustToDestWarehouseId
))
{
throw
exception
(
BOX_WAREHOUSE_START_NOT_MATCH
);
}
}
else
{
//没有调仓,看出货仓库是否与订单仓库一样
if
(!
startWarehouseId
.
equals
(
orderStartWarehouseId
))
{
if
(!
startWarehouseId
.
equals
(
orderStartWarehouseId
))
{
throw
exception
(
BOX_WAREHOUSE_START_NOT_MATCH
);
}
}
//目的地看国家是否一致
if
(!
destCountryId
.
equals
(
orderDestCountryId
))
{
if
(!
destCountryId
.
equals
(
orderDestCountryId
))
{
throw
exception
(
BOX_WAREHOUSE_DEST_NOT_MATCH
);
}
}
/**
* 校验同一个订单只能装在同一个部分
*
* @param secId 部分
* @param loadList 已装
* @param orderAllItemIdList 订单项
...
...
@@ -694,13 +699,14 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
.
collect
(
Collectors
.
toSet
());
//有已装的部分,并且已装的部分和待装部分id不一致
if
(
sectionSets
.
size
()
>
0
&&
!
sectionSets
.
contains
(
secId
))
{
if
(
sectionSets
.
size
()
>
0
&&
!
sectionSets
.
contains
(
secId
))
{
throw
new
ServiceException
(
500
,
"同一订单只能装在同一部分下"
);
}
}
/**
* 校验订单项是否已装
*
* @param loadList 已装
* @param orderItemIdList 订单项
*/
...
...
@@ -711,7 +717,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
.
eq
(
BoxPreloadGoodsDO:
:
getIsRemove
,
0
)
);
if
(
CollectionUtil
.
isNotEmpty
(
itemLoadList
))
{
if
(
CollectionUtil
.
isNotEmpty
(
itemLoadList
))
{
Set
<
Long
>
loadItemIdList
=
itemLoadList
.
stream
()
.
map
(
BoxPreloadGoodsDO:
:
getOrderId
)
.
collect
(
Collectors
.
toSet
());
...
...
@@ -729,6 +735,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
/**
* 校验订单预装是否可用
*
* @param boxDO 出货单
* @param secId 需要预装在的部分
* @param loadList 出货单已预装的商品项
...
...
@@ -790,13 +797,14 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
/**
* 统计已装的学校
*
* @param shipmentId 出货单ID
* @param sectionId 部分ID,为空则统计所有
* @return
*/
private
BoxGoodsStatistics
calculationStatistics
(
Long
shipmentId
,
Long
sectionId
)
{
BoxPreloadGoodsQueryVO
queryVO
=
new
BoxPreloadGoodsQueryVO
();
if
(
sectionId
==
null
)
{
if
(
sectionId
==
null
)
{
queryVO
.
setShipmentId
(
shipmentId
);
}
else
{
queryVO
.
setSecId
(
sectionId
);
...
...
@@ -808,7 +816,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
.
map
(
BoxPreloadGoodsDO:
:
getOrderItemId
)
.
collect
(
Collectors
.
toList
());
List
<
OrderItemDO
>
orderItemDOList
=
new
ArrayList
<>();
if
(
CollectionUtil
.
isNotEmpty
(
orderItemIdList
))
{
if
(
CollectionUtil
.
isNotEmpty
(
orderItemIdList
))
{
orderItemDOList
=
orderItemService
.
getOrderItemList
(
orderItemIdList
);
}
return
calculationStatistics
(
orderItemDOList
);
...
...
@@ -823,11 +831,11 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
BigDecimal
chargeVolumeSum
=
boxGoodsStatistics
.
getChargeVolume
();
BigDecimal
chargeWeightSum
=
boxGoodsStatistics
.
getChargeWeight
();
if
(
orderItemDO
.
getChargeVolume
()
!=
null
)
{
if
(
orderItemDO
.
getChargeVolume
()
!=
null
)
{
chargeVolumeSum
=
chargeVolumeSum
.
add
(
orderItemDO
.
getChargeVolume
()).
setScale
(
2
,
BigDecimal
.
ROUND_DOWN
);
boxGoodsStatistics
.
setChargeVolume
(
chargeVolumeSum
);
}
if
(
orderItemDO
.
getChargeWeight
()
!=
null
)
{
if
(
orderItemDO
.
getChargeWeight
()
!=
null
)
{
chargeWeightSum
=
chargeWeightSum
.
add
(
orderItemDO
.
getChargeWeight
()).
setScale
(
2
,
BigDecimal
.
ROUND_DOWN
);
boxGoodsStatistics
.
setChargeWeight
(
chargeWeightSum
);
}
...
...
@@ -836,7 +844,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
}
private
List
<
OrderDO
>
getOrderListByOrderItem
(
List
<
OrderItemDO
>
orderItemDOList
)
{
if
(
CollectionUtils
.
isEmpty
(
orderItemDOList
))
{
if
(
CollectionUtils
.
isEmpty
(
orderItemDOList
))
{
return
new
ArrayList
<>();
}
Set
<
Long
>
orderIdSet
=
orderItemDOList
.
stream
()
...
...
@@ -849,7 +857,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
@Override
public
BoxGoodsStatistics
calculationStatisticsByOrderList
(
Collection
<
OrderDO
>
orderDOList
)
{
BoxGoodsStatistics
boxGoodsStatistics
=
new
BoxGoodsStatistics
();
if
(
CollectionUtil
.
isEmpty
(
orderDOList
))
{
if
(
CollectionUtil
.
isEmpty
(
orderDOList
))
{
return
boxGoodsStatistics
;
}
for
(
OrderDO
orderDO
:
orderDOList
)
{
...
...
@@ -857,15 +865,15 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
BigDecimal
volumeSum
=
boxGoodsStatistics
.
getVolume
();
BigDecimal
weightSum
=
boxGoodsStatistics
.
getWeight
();
if
(
orderDO
.
getSumNum
()
!=
null
)
{
if
(
orderDO
.
getSumNum
()
!=
null
)
{
numSum
+=
orderDO
.
getSumNum
();
boxGoodsStatistics
.
setNum
(
numSum
);
}
if
(
orderDO
.
getSumVolume
()
!=
null
)
{
if
(
orderDO
.
getSumVolume
()
!=
null
)
{
volumeSum
=
volumeSum
.
add
(
orderDO
.
getSumVolume
()).
setScale
(
2
,
BigDecimal
.
ROUND_DOWN
);
boxGoodsStatistics
.
setVolume
(
volumeSum
);
}
if
(
orderDO
.
getSumWeight
()
!=
null
)
{
if
(
orderDO
.
getSumWeight
()
!=
null
)
{
weightSum
=
weightSum
.
add
(
orderDO
.
getSumWeight
()).
setScale
(
2
,
BigDecimal
.
ROUND_DOWN
);
boxGoodsStatistics
.
setWeight
(
weightSum
);
}
...
...
@@ -877,14 +885,14 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
public
void
delCheckStatus
(
Long
shipmentId
)
{
//>审核中就不可以移出,
BoxDO
boxDO
=
boxService
.
getBox
(
shipmentId
);
if
(
boxDO
.
getTransportType
().
equals
(
TransportTypeEnum
.
AIR
.
getType
()))
{
if
(
boxDO
.
getTransportType
().
equals
(
TransportTypeEnum
.
AIR
.
getType
()))
{
Integer
airShipmentStatus
=
boxDO
.
getAirShipmentStatus
();
if
(
airShipmentStatus
==
AirShipmentStatusEnum
.
SHIPMENT
.
getStatus
())
{
if
(
airShipmentStatus
==
AirShipmentStatusEnum
.
SHIPMENT
.
getStatus
())
{
throw
new
ServiceException
(
500
,
"自编号通过出货审核,无法删除订单"
);
}
}
else
{
Integer
ldStatus
=
boxDO
.
getLdStatus
();
if
(
ldStatus
==
LdStatusEnum
.
INSTALLED_TO_BE_SEALED
.
getLdStatus
()
||
ldStatus
==
LdStatusEnum
.
CABINET_EXAMINE_ING
.
getLdStatus
()
if
(
ldStatus
==
LdStatusEnum
.
INSTALLED_TO_BE_SEALED
.
getLdStatus
()
||
ldStatus
==
LdStatusEnum
.
CABINET_EXAMINE_ING
.
getLdStatus
()
||
ldStatus
==
LdStatusEnum
.
CABINET_EXAMINE_SUCCESS
.
getLdStatus
()
||
ldStatus
==
LdStatusEnum
.
CABINET_SEALED
.
getLdStatus
())
{
throw
new
ServiceException
(
500
,
"自编号通过出货审核,无法删除订单"
);
}
...
...
@@ -896,7 +904,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
public
void
deleteBoxPreloadGoods
(
Collection
<
Long
>
ids
,
Integer
deleteType
)
{
//同时删除这些商品的订单下的所有商品
List
<
BoxPreloadGoodsDO
>
goodItemList
=
getBoxPreloadGoodsList
(
ids
);
if
(
CollectionUtil
.
isEmpty
(
goodItemList
))
return
;
if
(
CollectionUtil
.
isEmpty
(
goodItemList
))
return
;
//校验是否在审核中
BoxPreloadGoodsDO
boxPreloadGoodsDO
=
goodItemList
.
get
(
0
);
...
...
@@ -922,19 +930,19 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
@Override
public
Collection
<
Long
>
checkDeleteOrder
(
Long
shipmentId
,
Integer
deleteType
,
Collection
<
Long
>
orderIdList
)
{
if
(
deleteType
==
null
)
{
if
(
deleteType
==
null
)
{
//需要弹窗提示
//找出这些订单的关联单,提示
BoxOrderRemoveAO
ao
=
findRelationOrder
(
shipmentId
,
orderIdList
);
if
(
ao
.
isHasRelationOrder
())
{
if
(
ao
.
isHasRelationOrder
())
{
//有关联单,弹出提示
throw
new
ServiceException
(
666
,
ao
.
getMsg
());
}
}
else
{
//需要删除关联单
if
(
deleteType
==
2
)
{
if
(
deleteType
==
2
)
{
BoxOrderRemoveAO
ao
=
findRelationOrder
(
shipmentId
,
orderIdList
);
if
(
ao
.
isHasRelationOrder
())
{
if
(
ao
.
isHasRelationOrder
())
{
List
<
OrderDO
>
orderList
=
ao
.
getRemoveList
();
orderIdList
=
orderList
.
stream
()
.
map
(
OrderDO:
:
getOrderId
)
...
...
@@ -955,7 +963,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
if
(
CollectionUtil
.
isNotEmpty
(
orderIdList
))
{
List
<
OrderDO
>
removeOrderList
=
orderService
.
listByIds
(
orderIdList
);
Map
<
Long
,
OrderDO
>
orderMap
=
removeOrderList
.
stream
()
.
collect
(
Collectors
.
toMap
(
OrderDO:
:
getOrderId
,
v
->
v
,
(
v1
,
v2
)
->
v2
));
.
collect
(
Collectors
.
toMap
(
OrderDO:
:
getOrderId
,
v
->
v
,
(
v1
,
v2
)
->
v2
));
//找出这个出货所有预装的订单
Set
<
Long
>
preloadOrderIdSet
=
getShipOrderIdList
(
shipmentId
);
...
...
@@ -965,19 +973,19 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
//订单的所有关联单
List
<
OrderGuanlianDO
>
orderRelationList
=
orderGuanlianService
.
getRelationList
(
orderId
);
if
(
orderRelationList
!=
null
)
{
if
(
orderRelationList
!=
null
)
{
//过滤掉不在这个出货的关联单
orderRelationList
=
orderRelationList
.
stream
()
.
filter
(
t
->
preloadOrderIdSet
.
contains
(
t
.
getOrderId
())
&&
preloadOrderIdSet
.
contains
(
t
.
getRelateOrderId
()))
.
collect
(
Collectors
.
toList
());
}
boolean
hasRelationOrder
=
CollectionUtil
.
isNotEmpty
(
orderRelationList
);
if
(
hasRelationOrder
)
{
if
(
hasRelationOrder
)
{
//从已经预装的里面过滤
orderRelationList
=
orderRelationList
.
stream
()
.
filter
(
t
->
preloadOrderIdSet
.
contains
(
t
.
getOrderId
())
||
preloadOrderIdSet
.
contains
(
t
.
getRelateOrderId
()))
.
collect
(
Collectors
.
toList
());
if
(
CollectionUtils
.
isEmpty
(
orderRelationList
))
continue
;
if
(
CollectionUtils
.
isEmpty
(
orderRelationList
))
continue
;
relationOrder
=
true
;
...
...
@@ -1031,8 +1039,9 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
BoxDO
boxDO
=
boxService
.
getBox
(
shipmentId
);
List
<
BoxPreloadSectionDO
>
sectionList
=
boxPreloadSectionService
.
selectList
(
"shipment_id"
,
shipmentId
);
if
(
CollectionUtil
.
isEmpty
(
sectionList
))
{
List
<
BoxPreloadSectionDO
>
sectionList
=
boxPreloadSectionService
.
selectList
(
"shipment_id"
,
shipmentId
);
if
(
CollectionUtil
.
isEmpty
(
sectionList
))
{
// sectionList = new ArrayList<>();
//
...
...
@@ -1040,9 +1049,9 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
DictDataExportReqVO
dictDataExportReqVO
=
new
DictDataExportReqVO
();
dictDataExportReqVO
.
setDictType
(
"part_function_switch"
);
List
<
DictDataDO
>
dictDataRespDTOS
=
dictDataService
.
getDictDatas
(
dictDataExportReqVO
);
if
(
query
.
getSmartInstall
()
!=
null
&&
query
.
getSmartInstall
()
==
1
)
{
if
(
query
.
getSmartInstall
()
!=
null
&&
query
.
getSmartInstall
()
==
1
)
{
int
defaultNum
=
5
;
if
(
boxDO
.
getTransportType
().
equals
(
TransportTypeEnum
.
AIR
.
getType
()))
{
if
(
boxDO
.
getTransportType
().
equals
(
TransportTypeEnum
.
AIR
.
getType
()))
{
defaultNum
=
1
;
}
//默认创建5个部分
...
...
@@ -1080,7 +1089,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
List
<
BoxPreloadGoodsBackVO
>
sectionGoodsList
=
sectionGoodsMap
.
get
(
sectionBackVO
.
getId
());
sectionBackVO
.
setSectionGoodsList
(
sectionGoodsList
);
if
(
sectionGoodsList
==
null
)
continue
;
if
(
sectionGoodsList
==
null
)
continue
;
for
(
BoxPreloadGoodsBackVO
boxPreloadGoodsBackVO
:
sectionGoodsList
)
{
boxPreloadGoodsBackVO
.
setAttrNameList
(
...
...
@@ -1108,7 +1117,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
BoxPreloadSectionDetailVO
data
=
new
BoxPreloadSectionDetailVO
();
data
.
setLoadStatistics
(
loadStatistics
);
data
.
setSectionGoodList
(
sectionBackList
);
if
(
cabinetDO
!=
null
)
{
if
(
cabinetDO
!=
null
)
{
//计算剩余的体积和重量
BigDecimal
remainVolume
=
cabinetDO
.
getVolume
().
subtract
(
loadStatistics
.
getVolume
()).
setScale
(
2
,
BigDecimal
.
ROUND_DOWN
);
BigDecimal
remainWeight
=
cabinetDO
.
getWeight
().
subtract
(
loadStatistics
.
getWeight
()).
setScale
(
2
,
BigDecimal
.
ROUND_DOWN
);
...
...
@@ -1122,13 +1131,14 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
* 智慧预装
* 按入仓时间最早、路线相同、方数符合要求的订单默认填充,可手动移出。
* 1.优先拆单、报关退场订单
*
*
<p>
* 预装规则:
* 第一部分:存放柜里货
* 第二部分:在非柜里货中筛选存在有牌的货,装在第二部分
* 第三部分:无牌的柜内货
* 第四部分:无牌的次封柜货
* 第五部分:无牌的封柜货
*
* @param boxDO 出货单
*/
private
void
smartInstall
(
BoxDO
boxDO
,
List
<
BoxPreloadSectionDO
>
sectionList
)
{
...
...
@@ -1152,11 +1162,11 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
orderPreloadReq
.
setPageSize
(
Integer
.
MAX_VALUE
);
BoxOrderPreloadStatistics
boxOrderPreloadStatistics
=
orderPreloadPage
(
orderPreloadReq
);
PageResult
<
BoxOrderPreloadVo
>
pageResult
=
boxOrderPreloadStatistics
.
getDataList
();
if
(
pageResult
==
null
)
return
;
if
(
pageResult
==
null
)
return
;
List
<
BoxOrderPreloadVo
>
orderList
=
pageResult
.
getList
();
if
(
CollectionUtil
.
isEmpty
(
orderList
))
return
;
if
(
CollectionUtil
.
isEmpty
(
orderList
))
return
;
//首先按照入仓时间排序
orderList
.
sort
((
o1
,
o2
)
->
o2
.
getRucangTime
().
compareTo
(
o1
.
getRucangTime
()));
...
...
@@ -1172,7 +1182,6 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
List
<
OrderItemDO
>
orderItemList
=
boxService
.
getOrderItemListByOrderIdList
(
orderIdList
);
Map
<
Long
,
List
<
OrderItemDO
>>
orderItemMap
=
orderItemList
.
stream
()
.
collect
(
Collectors
.
groupingBy
(
OrderItemDO:
:
getOrderId
));
...
...
@@ -1189,10 +1198,10 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
List
<
OrderItemDO
>
itemOrderItemList
=
orderItemMap
.
get
(
orderId
);
Integer
sectionPosition
=
checkSectionPosition
(
itemOrderItemList
);
//
if
(
sectionPosition
==
null
)
continue
;
if
(
sectionPosition
==
null
)
continue
;
BoxPreloadSectionDO
sectionDO
;
int
sectionSize
=
sectionList
.
size
();
if
(
sectionSize
>
sectionPosition
)
{
if
(
sectionSize
>
sectionPosition
)
{
sectionDO
=
sectionList
.
get
(
sectionPosition
);
}
else
{
int
needAdd
=
(
sectionPosition
+
1
)
-
sectionSize
;
...
...
@@ -1234,6 +1243,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
* 第三部分:无牌的柜内货
* 第四部分:无牌的次封柜货
* 第五部分:无牌的封柜货
*
* @param itemOrderItemList 订单项
* @return
*/
...
...
@@ -1242,30 +1252,30 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
Long
proId
=
orderItemDO
.
getProdId
();
Long
lineId
=
orderItemDO
.
getLineId
();
Long
channelId
=
orderItemDO
.
getChannelId
();
if
(
channelId
==
null
)
channelId
=
0L
;
if
(
channelId
==
null
)
channelId
=
0L
;
ProductPriceDO
productPriceDO
=
boxService
.
getProductPrice
(
proId
,
lineId
,
channelId
);
String
containerLocation
=
productPriceDO
.
getContainerLocation
();
if
(
StringUtils
.
isEmpty
(
containerLocation
))
{
if
(
StringUtils
.
isEmpty
(
containerLocation
))
{
//未设置的话,默认为柜里货
containerLocation
=
ContainerLocation
.
GLH
.
getValue
();
}
Integer
brandType
=
orderItemDO
.
getBrandType
();
if
(
containerLocation
.
equals
(
ContainerLocation
.
GLH
.
getValue
()))
{
if
(
containerLocation
.
equals
(
ContainerLocation
.
GLH
.
getValue
()))
{
//柜里货,放第一部分
return
0
;
}
else
{
//有牌,放在第二部分
if
(
brandType
==
1
)
{
if
(
brandType
==
1
)
{
return
1
;
}
else
{
//
if
(
containerLocation
.
equals
(
ContainerLocation
.
GNH
.
getValue
()))
{
if
(
containerLocation
.
equals
(
ContainerLocation
.
GNH
.
getValue
()))
{
return
2
;
}
else
if
(
containerLocation
.
equals
(
ContainerLocation
.
CFHG
.
getValue
()))
{
}
else
if
(
containerLocation
.
equals
(
ContainerLocation
.
CFHG
.
getValue
()))
{
return
3
;
}
else
if
(
containerLocation
.
equals
(
ContainerLocation
.
FHG
.
getValue
()))
{
}
else
if
(
containerLocation
.
equals
(
ContainerLocation
.
FHG
.
getValue
()))
{
return
4
;
}
}
...
...
@@ -1276,6 +1286,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
/**
* 获取部分列表
*
* @param shipmentId 出货单ID
* @return
*/
...
...
@@ -1294,19 +1305,19 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
//首先判断是否是反审后回来的
BoxApprovalDO
boxApprovalDO
=
boxService
.
getLatestApproval
(
shipmentId
);
if
(
boxApprovalDO
!=
null
)
{
if
(
boxApprovalDO
!=
null
)
{
boolean
backApproval
=
boxApprovalDO
.
getApprovalType
()
==
BoxApprovalTypeEnum
.
PRELOAD_UMPIRE
.
getType
()
||
boxApprovalDO
.
getApprovalType
()
==
BoxApprovalTypeEnum
.
AIR_SORTING_BACK
.
getType
();
if
(
backApproval
)
tempSort
=
false
;
if
(
backApproval
)
tempSort
=
false
;
}
int
maxNum
=
0
;
if
(!
tempSort
)
{
if
(!
tempSort
)
{
List
<
BoxPreloadGoodsDO
>
settleList
=
preloadGoodsList
.
stream
().
filter
(
t
->
t
.
getTidanNum
()
!=
99999
)
.
collect
(
Collectors
.
toList
());
OptionalInt
optionalInt
=
settleList
.
stream
().
mapToInt
(
BoxPreloadGoodsDO:
:
getTidanNum
).
max
();
if
(
optionalInt
.
isPresent
())
{
if
(
optionalInt
.
isPresent
())
{
maxNum
=
optionalInt
.
getAsInt
();
}
...
...
@@ -1321,7 +1332,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
.
collect
(
Collectors
.
toList
());
//还未设置提单号
if
(
maxNum
==
0
)
{
if
(
maxNum
==
0
)
{
List
<
BoxPreloadSectionDO
>
sectionList
=
getSectionListByShipmentId
(
shipmentId
);
Map
<
Long
,
List
<
BoxPreloadGoodsDO
>>
sectionGoodsMap
=
preloadGoodsList
.
stream
()
...
...
@@ -1330,7 +1341,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
int
orderNum
=
1
;
for
(
BoxPreloadSectionDO
sectionDO
:
sectionList
)
{
List
<
BoxPreloadGoodsDO
>
sectionGoodsList
=
sectionGoodsMap
.
get
(
sectionDO
.
getId
());
if
(
CollectionUtil
.
isEmpty
(
sectionGoodsList
))
continue
;
if
(
CollectionUtil
.
isEmpty
(
sectionGoodsList
))
continue
;
sectionGoodsList
.
sort
(
Comparator
.
comparing
(
BoxPreloadGoodsDO:
:
getId
));
orderNum
=
setTidanNum
(
sectionGoodsList
,
orderNum
,
selfNo
,
updateOrder
);
...
...
@@ -1342,14 +1353,14 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
List
<
BoxPreloadGoodsDO
>
list
=
preloadGoodsList
.
stream
()
.
filter
(
t
->
t
.
getTidanNum
()
==
99999
)
.
collect
(
Collectors
.
toList
());
if
(
CollectionUtil
.
isNotEmpty
(
list
))
{
if
(
CollectionUtil
.
isNotEmpty
(
list
))
{
//按照时间排序
list
.
sort
(
Comparator
.
comparing
(
BaseDO:
:
getCreateTime
));
int
orderNum
=
maxNum
+
1
;
List
<
Integer
>
missList
=
findDeletionList
(
preloadGoodsList
);
if
(
CollectionUtil
.
isEmpty
(
missList
))
{
if
(
CollectionUtil
.
isEmpty
(
missList
))
{
orderNum
=
setTidanNum
(
list
,
orderNum
,
selfNo
,
updateOrder
);
}
else
{
//list是需要补单的数据
...
...
@@ -1361,7 +1372,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
));
Iterator
<
Long
>
orderIdIt
=
orderMap
.
keySet
().
iterator
();
for
(
Integer
num
:
missList
)
{
if
(
orderIdIt
.
hasNext
())
{
if
(
orderIdIt
.
hasNext
())
{
Long
orderId
=
orderIdIt
.
next
();
List
<
BoxPreloadGoodsDO
>
orderGoodList
=
orderMap
.
get
(
orderId
);
setTidanNum
(
orderGoodList
,
num
,
selfNo
,
updateOrder
);
...
...
@@ -1372,7 +1383,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
List
<
BoxPreloadGoodsDO
>
resultList
=
orderMap
.
values
().
stream
()
.
flatMap
(
Collection:
:
stream
)
.
collect
(
Collectors
.
toList
());
if
(
CollectionUtil
.
isNotEmpty
(
resultList
))
{
if
(
CollectionUtil
.
isNotEmpty
(
resultList
))
{
setTidanNum
(
resultList
,
orderNum
,
selfNo
,
updateOrder
);
}
}
...
...
@@ -1380,13 +1391,13 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
}
}
if
(
updateOrder
)
{
if
(
updateOrder
)
{
Set
<
Long
>
orderIdSet
=
preloadGoodsList
.
stream
()
.
map
(
BoxPreloadGoodsDO:
:
getOrderId
)
.
collect
(
Collectors
.
toSet
());
Map
<
Long
,
Integer
>
tidanNumMap
=
preloadGoodsList
.
stream
()
.
collect
(
Collectors
.
toMap
(
BoxPreloadGoodsDO:
:
getOrderId
,
BoxPreloadGoodsDO:
:
getTidanNum
,
(
v1
,
v2
)
->
v2
));
.
collect
(
Collectors
.
toMap
(
BoxPreloadGoodsDO:
:
getOrderId
,
BoxPreloadGoodsDO:
:
getTidanNum
,
(
v1
,
v2
)
->
v2
));
for
(
Long
orderId
:
orderIdSet
)
{
Integer
orderNum
=
tidanNumMap
.
get
(
orderId
);
String
ladingBillNo
=
selfNo
+
"-"
+
orderNum
;
...
...
@@ -1397,6 +1408,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
/**
* 找出有间隔的订单
*
* @param list 预装商品项
* @return
*/
...
...
@@ -1458,6 +1470,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
/**
* 根据订单生成提单号
*
* @param orderId 订单ID
* @return
*/
...
...
@@ -1466,7 +1479,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
.
eq
(
BoxPreloadGoodsDO:
:
getOrderId
,
orderId
)
.
eq
(
BoxPreloadGoodsDO:
:
getIsRemove
,
0
)
);
if
(
CollectionUtil
.
isEmpty
(
goodsDOList
))
{
if
(
CollectionUtil
.
isEmpty
(
goodsDOList
))
{
throw
new
IllegalStateException
(
"出货单不存在"
);
}
BoxPreloadGoodsDO
boxPreloadGoodsDO
=
goodsDOList
.
get
(
0
);
...
...
@@ -1536,8 +1549,8 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
BoxDO
boxDO
=
boxService
.
getBox
(
shipmentId
);
Integer
prStatus
=
boxDO
.
getPrStatus
();
Set
<
Long
>
orderIdSet
=
getShipOrderIdList
(
shipmentId
);
if
(
CollectionUtil
.
isEmpty
(
orderIdSet
))
{
if
(
prStatus
==
PrStatusEnum
.
PRELOAD_ING
.
getPrStatus
()
||
if
(
CollectionUtil
.
isEmpty
(
orderIdSet
))
{
if
(
prStatus
==
PrStatusEnum
.
PRELOAD_ING
.
getPrStatus
()
||
prStatus
==
PrStatusEnum
.
PRELOAD_APPROVAL_FAIL
.
getPrStatus
()
)
{
//修改为已订舱,待预装
...
...
@@ -1546,7 +1559,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
}
}
else
{
//修改为预装中
if
(
prStatus
==
PrStatusEnum
.
NO_PRELOAD
.
getPrStatus
()
||
if
(
prStatus
==
PrStatusEnum
.
NO_PRELOAD
.
getPrStatus
()
||
prStatus
==
PrStatusEnum
.
PRELOAD_APPROVAL_FAIL
.
getPrStatus
()
)
{
//未预装和预装审核失败的情况才修改为预装中
...
...
@@ -1559,6 +1572,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
/**
* 把订单从出货单中删除
*
* @param shipmentId 出货单ID
* @param orderIdCollection 订单列表
* @param type 1 预装移除 2 理货移除 3 装柜移除
...
...
@@ -1566,7 +1580,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
*/
@Override
public
void
deleteOrderList
(
Long
shipmentId
,
Collection
<
Long
>
orderIdCollection
,
Integer
type
,
boolean
hasExit
)
{
if
(
CollectionUtil
.
isNotEmpty
(
orderIdCollection
))
{
if
(
CollectionUtil
.
isNotEmpty
(
orderIdCollection
))
{
//删除装柜商品
boxPreloadGoodsMapper
.
delete
(
new
LambdaQueryWrapperX
<
BoxPreloadGoodsDO
>()
.
in
(
BoxPreloadGoodsDO:
:
getOrderId
,
orderIdCollection
)
...
...
@@ -1585,8 +1599,8 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
//删除该订单在理货这合包时的装箱数据
boxOrderCheckInfoService
.
remove
(
new
LambdaQueryWrapperX
<
BoxOrderCheckInfoDO
>()
.
eq
(
BoxOrderCheckInfoDO:
:
getShipmentId
,
shipmentId
)
.
in
(
BoxOrderCheckInfoDO:
:
getOrderId
,
orderIdCollection
)
.
eq
(
BoxOrderCheckInfoDO:
:
getShipmentId
,
shipmentId
)
.
in
(
BoxOrderCheckInfoDO:
:
getOrderId
,
orderIdCollection
)
);
//删除已经理货的数据
...
...
@@ -1678,10 +1692,10 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
calculateBoxMergeSum
(
shipmentId
,
boxGoodsStatistics
);
boxLoadDetailBackVO
.
setTotalStatistics
(
boxGoodsStatistics
);
if
(
secId
!=
null
&&
secId
!=
0L
)
{
if
(
secId
!=
null
&&
secId
!=
0L
)
{
List
<
BoxPreloadGoodsBackVO
>
sectionGoodsList
=
sectionGoodsMap
.
get
(
secId
);
if
(
sectionGoodsList
!=
null
)
{
if
(
sectionGoodsList
!=
null
)
{
List
<
OrderItemDO
>
secOrderItemDOList
=
new
ArrayList
<>();
for
(
BoxPreloadGoodsBackVO
item
:
sectionGoodsList
)
{
OrderItemDO
orderItemDO
=
new
OrderItemDO
();
...
...
@@ -1690,7 +1704,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
}
BoxGoodsStatistics
secBoxGoodsStatistics
=
calculationStatistics
(
secOrderItemDOList
);
long
secUnloadNum
=
loadInfoList
.
stream
()
.
filter
(
t
->
t
.
getIsUnload
()
==
1
)
.
filter
(
t
->
t
.
getIsUnload
()
==
1
)
.
count
();
Set
<
Long
>
secOrderIdSet
=
secOrderItemDOList
.
stream
()
...
...
@@ -1717,13 +1731,13 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
//
Long
sectionId
=
sectionDO
.
getId
();
if
(
secId
!=
null
&&
secId
!=
0
&&
!
sectionId
.
equals
(
secId
))
{
if
(
secId
!=
null
&&
secId
!=
0
&&
!
sectionId
.
equals
(
secId
))
{
continue
;
}
List
<
BoxPreloadGoodsBackVO
>
sectionGoodsList
=
sectionGoodsMap
.
get
(
sectionId
);
if
(
CollectionUtil
.
isEmpty
(
sectionGoodsList
))
continue
;
if
(
CollectionUtil
.
isEmpty
(
sectionGoodsList
))
continue
;
//按照订单分组
Map
<
Long
,
List
<
BoxPreloadGoodsBackVO
>>
orderItemsMap
=
sectionGoodsList
.
stream
()
...
...
@@ -1801,7 +1815,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
orderVO
.
setInstallNum
(
CollectionUtil
.
isNotEmpty
(
installList
)
?
installList
.
size
()
:
0
);
orderVO
.
setUnloadNum
(
0
);
if
(
installList
!=
null
)
{
if
(
installList
!=
null
)
{
List
<
BoxLoadInfoDO
>
unloadList
=
installList
.
stream
()
.
filter
(
t
->
t
.
getIsUnload
()
==
1
)
.
collect
(
Collectors
.
toList
());
...
...
@@ -1809,7 +1823,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
}
}
loadOrderList
.
sort
((
o1
,
o2
)
->
{
if
(
o1
.
getTidanNum
().
compareTo
(
o2
.
getTidanNum
())
==
0
)
{
if
(
o1
.
getTidanNum
().
compareTo
(
o2
.
getTidanNum
())
==
0
)
{
return
o1
.
getPreloadId
().
compareTo
(
o2
.
getPreloadId
());
}
return
o1
.
getTidanNum
().
compareTo
(
o2
.
getTidanNum
());
...
...
@@ -1819,7 +1833,6 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
}
@Override
public
BoxLoadDetailBackVO
loadGoodsList
(
Long
shipmentId
,
Long
secId
)
{
return
boxGoodsList
(
shipmentId
,
secId
,
null
,
0
);
...
...
@@ -1854,7 +1867,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
//查询订单的报关费用
List
<
BoxLoadOrderVO
>
orderVOList
=
detailBackVO
.
getSectionOrderList
();
if
(
CollectionUtil
.
isNotEmpty
(
orderVOList
))
{
if
(
CollectionUtil
.
isNotEmpty
(
orderVOList
))
{
List
<
Long
>
orderIdList
=
orderVOList
.
stream
()
.
map
(
BoxLoadOrderVO:
:
getOrderId
)
.
collect
(
Collectors
.
toList
());
...
...
@@ -1868,16 +1881,16 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
detailBackVO
.
setAbnormalList
(
BoxAbnormalConvert
.
INSTANCE
.
convertList
(
abnormalList
));
String
dealOrderIds
=
null
;
BoxAbnormalDO
boxAbnormalDO
=
null
;
if
(
CollectionUtil
.
isNotEmpty
(
abnormalList
))
{
if
(
CollectionUtil
.
isNotEmpty
(
abnormalList
))
{
boxAbnormalDO
=
abnormalList
.
get
(
0
);
dealOrderIds
=
boxAbnormalDO
.
getDealOrderIds
();
}
if
(
StringUtils
.
isEmpty
(
dealOrderIds
))
{
if
(
StringUtils
.
isEmpty
(
dealOrderIds
))
{
dealOrderIds
=
""
;
}
for
(
BoxLoadOrderVO
orderVO
:
orderVOList
)
{
orderVO
.
setCustomsFee
(
orderFeeMap
.
get
(
orderVO
.
getOrderId
()));
if
(
boxAbnormalDO
==
null
)
{
if
(
boxAbnormalDO
==
null
)
{
orderVO
.
setAbnormalDealStatus
(
1
);
}
else
{
boolean
isDeal
=
dealOrderIds
.
contains
(
orderVO
.
getOrderId
().
toString
());
...
...
@@ -1893,7 +1906,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
//1.找出计划装箱的数量
//设置为不能移除的
List
<
BoxPreloadGoodsBackVO
>
goodsItemList
=
getShipGoodItemList
(
shipmentId
);
if
(
CollectionUtil
.
isEmpty
(
goodsItemList
))
{
if
(
CollectionUtil
.
isEmpty
(
goodsItemList
))
{
throw
exception
(
cn
.
iocoder
.
yudao
.
module
.
order
.
enums
.
ErrorCodeConstants
.
ORDER_NOT_EXISTS
);
}
...
...
@@ -1904,7 +1917,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
orderDOList
=
orderDOList
.
stream
()
.
filter
(
t
->
t
.
getOrderNo
().
equals
(
orderNo
))
.
collect
(
Collectors
.
toList
());
if
(
CollectionUtil
.
isEmpty
(
orderDOList
))
{
if
(
CollectionUtil
.
isEmpty
(
orderDOList
))
{
throw
exception
(
cn
.
iocoder
.
yudao
.
module
.
order
.
enums
.
ErrorCodeConstants
.
ORDER_NOT_EXISTS
);
}
return
orderDOList
.
get
(
0
).
getOrderId
();
...
...
@@ -1917,21 +1930,22 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
List
<
OrderPreloadVO
>
orderPreloadList
=
orderQueryService
.
orderPreloadList
(
query
);
if
(
CollectionUtil
.
isEmpty
(
orderPreloadList
))
return
new
BoxOrderPreloadStatistics
();
if
(
CollectionUtil
.
isEmpty
(
orderPreloadList
))
return
new
BoxOrderPreloadStatistics
();
Long
startWarehouseId
=
query
.
getStartWarehouseId
();
//校验始发仓
if
(
startWarehouseId
!=
null
)
{
if
(
startWarehouseId
!=
null
)
{
Iterator
<
OrderPreloadVO
>
it
=
orderPreloadList
.
iterator
();
while
(
it
.
hasNext
())
{
OrderPreloadVO
preloadVO
=
it
.
next
();
Long
adjustToDestWarehouseId
=
preloadVO
.
getAdjustToDestWarehouseId
();
if
(
adjustToDestWarehouseId
!=
null
&&
adjustToDestWarehouseId
!=
0
)
{
if
(
adjustToDestWarehouseId
!=
null
&&
adjustToDestWarehouseId
!=
0
)
{
//有调仓,判断调仓是否符合条件,不符合条件则直接移除
if
(!
startWarehouseId
.
equals
(
adjustToDestWarehouseId
))
it
.
remove
();
if
(!
startWarehouseId
.
equals
(
adjustToDestWarehouseId
))
it
.
remove
();
}
else
{
//没有调仓,判断始发仓是否符合条件
if
(!
startWarehouseId
.
equals
(
preloadVO
.
getStartWarehouseId
()))
it
.
remove
();
if
(!
startWarehouseId
.
equals
(
preloadVO
.
getStartWarehouseId
()))
it
.
remove
();
}
}
}
...
...
@@ -1959,7 +1973,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
List
<
OrderItemBackVO
>
orderItemList
=
orderItemService
.
getOrderItemBackByOrderId
(
orderIdList
);
//订单项过滤了入仓为0的数据,
if
(
CollectionUtil
.
isEmpty
(
orderItemList
))
return
new
BoxOrderPreloadStatistics
();
if
(
CollectionUtil
.
isEmpty
(
orderItemList
))
return
new
BoxOrderPreloadStatistics
();
//订单对应的订单项列表
Map
<
Long
,
List
<
OrderItemBackVO
>>
orderItemMap
=
orderItemList
.
stream
()
...
...
@@ -1977,7 +1991,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
);
//订单项ID->已装商品
Map
<
Long
,
BoxPreloadGoodsDO
>
itemIdMap
=
boxPreloadGoodsDOList
.
stream
()
.
collect
(
Collectors
.
toMap
(
BoxPreloadGoodsDO:
:
getOrderItemId
,
v
->
v
,
(
v1
,
v2
)->
v2
));
.
collect
(
Collectors
.
toMap
(
BoxPreloadGoodsDO:
:
getOrderItemId
,
v
->
v
,
(
v1
,
v2
)
->
v2
));
//获取出货单ID列表
List
<
Long
>
shipmentIdList
=
boxPreloadGoodsDOList
.
stream
()
...
...
@@ -1987,10 +2001,10 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
Map
<
Long
,
BoxDO
>
boxMap
=
new
HashMap
<>();
Map
<
Long
,
List
<
BoxPreloadSectionDO
>>
sectionMap
=
new
HashMap
<>();
if
(
CollectionUtil
.
isNotEmpty
(
shipmentIdList
))
{
if
(
CollectionUtil
.
isNotEmpty
(
shipmentIdList
))
{
List
<
BoxDO
>
boxList
=
boxService
.
getBoxList
(
shipmentIdList
);
boxMap
=
boxList
.
stream
()
.
collect
(
Collectors
.
toMap
(
BoxDO:
:
getId
,
v
->
v
));
.
collect
(
Collectors
.
toMap
(
BoxDO:
:
getId
,
v
->
v
));
//找到出货单下面的所有部分,确定已装商品在第几部分
List
<
BoxPreloadSectionDO
>
sectionDOList
=
boxPreloadSectionService
.
selectByShipmentIdList
(
shipmentIdList
);
...
...
@@ -2012,7 +2026,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
List
<
OrderItemBackVO
>
itemList
=
orderItemMap
.
get
(
orderPreloadVO
.
getOrderId
());
//过滤了为入仓的订单项,所以会有为null的情况,
//没有订单项,删除这个订单,
if
(
CollectionUtil
.
isEmpty
(
itemList
))
{
if
(
CollectionUtil
.
isEmpty
(
itemList
))
{
it
.
remove
();
continue
;
}
...
...
@@ -2029,14 +2043,14 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
Long
orderItemId
=
item
.
getOrderItemId
();
BoxPreloadGoodsDO
boxPreloadGoodsDO
=
itemIdMap
.
get
(
orderItemId
);
if
(
boxPreloadGoodsDO
==
null
)
{
if
(
boxPreloadGoodsDO
==
null
)
{
//未预装
unLoadItemList
.
add
(
OrderItemConvert
.
INSTANCE
.
convert
(
item
));
}
else
{
//已预装
Long
shipmentId
=
boxPreloadGoodsDO
.
getShipmentId
();
BoxDO
boxDO
=
boxMap
.
get
(
shipmentId
);
if
(
boxDO
==
null
)
{
if
(
boxDO
==
null
)
{
//出货单未找到?
unLoadItemList
.
add
(
OrderItemConvert
.
INSTANCE
.
convert
(
item
));
}
else
{
...
...
@@ -2050,7 +2064,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
}
}
}
if
(
boxOrderItemBackVOList
.
size
()
==
loadInfoList
.
size
())
{
if
(
boxOrderItemBackVOList
.
size
()
==
loadInfoList
.
size
())
{
//这个订单都已经被预装了
it
.
remove
();
}
...
...
@@ -2060,16 +2074,16 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
.
map
(
OrderPreloadVO:
:
getOrderId
)
.
collect
(
Collectors
.
toList
());
Integer
orderStatus
=
query
.
getOrderStatus
();
if
(
orderStatus
!=
null
&&
CollectionUtil
.
isNotEmpty
(
resultOrderIdList
))
{
if
(
orderStatus
!=
null
&&
CollectionUtil
.
isNotEmpty
(
resultOrderIdList
))
{
List
<
Long
>
matchIdList
=
new
ArrayList
<>();
if
(
orderStatus
==
1
)
{
//拆单
if
(
orderStatus
==
1
)
{
//拆单
//过滤掉不是拆单的订单
List
<
OrderDO
>
orderDOList
=
orderQueryService
.
getOrderList
(
resultOrderIdList
);
matchIdList
=
orderDOList
.
stream
()
.
filter
(
t
->
(
t
.
getParentOrderId
()
!=
null
&&
t
.
getParentOrderId
()
!=
0L
))
.
map
(
OrderDO:
:
getOrderId
)
.
collect
(
Collectors
.
toList
());
}
else
if
(
orderStatus
==
2
)
{
//关联单
}
else
if
(
orderStatus
==
2
)
{
//关联单
//找出所有的关联单
List
<
OrderGuanlianDO
>
guanlianList
=
orderGuanlianService
.
getGuanlianList
(
resultOrderIdList
);
matchIdList
=
guanlianList
.
stream
()
...
...
@@ -2088,7 +2102,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
.
filter
(
t
->
finalMatchIdList
.
contains
(
t
.
getOrderId
()))
.
collect
(
Collectors
.
toList
());
}
if
(
CollectionUtil
.
isNotEmpty
(
unLoadItemList
))
{
if
(
CollectionUtil
.
isNotEmpty
(
unLoadItemList
))
{
//过滤审核中的订单
Set
<
Long
>
oIdList
=
unLoadItemList
.
stream
()
.
map
(
OrderItemDO:
:
getOrderId
)
...
...
@@ -2106,15 +2120,21 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
}
//统计待预装箱数、重量、体积
BoxGoodsStatistics
boxGoodsStatistics
=
calculationStatistics
(
unLoadItemList
);
//按照最早入仓时间排序
list
.
sort
(
new
Comparator
<
BoxOrderPreloadVo
>()
{
@Override
public
int
compare
(
BoxOrderPreloadVo
o1
,
BoxOrderPreloadVo
o2
)
{
if
(
o1
.
getRucangTime
()
!=
null
&&
o2
.
getRucangTime
()
!=
null
)
{
return
o1
.
getRucangTime
().
compareTo
(
o2
.
getRucangTime
());
}
else
{
o1
.
setRucangTime
(
new
Date
());
o2
.
setRucangTime
(
new
Date
());
return
o1
.
getRucangTime
().
compareTo
(
o2
.
getRucangTime
());
}
}
});
...
...
@@ -2129,7 +2149,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
float
count
=
list
.
size
();
//计算最大页数
float
number
=
count
/
limit
;
int
pages
=
(
int
)
Math
.
ceil
(
number
);
int
pages
=
(
int
)
Math
.
ceil
(
number
);
mPage
.
setPages
(
pages
);
List
<
BoxOrderPreloadVo
>
records
=
list
.
stream
()
...
...
@@ -2182,7 +2202,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
OrderConsigneeDO
filterConsigneeDO
=
null
;
//已经有预装订单,并且需要限制只能放入一个客户订单
if
(
CollectionUtil
.
isNotEmpty
(
orderIdSets
)
&&
isLimit
)
{
if
(
CollectionUtil
.
isNotEmpty
(
orderIdSets
)
&&
isLimit
)
{
Long
existOrderId
=
new
ArrayList
<>(
orderIdSets
).
get
(
0
);
OrderDO
existDO
=
boxService
.
getOrder
(
existOrderId
);
filterConsigneeDO
=
boxService
.
getOrderConsignee
(
existDO
);
...
...
@@ -2196,7 +2216,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
//找到出货单
BoxDO
boxDO
=
boxService
.
getBox
(
shipmentId
);
if
(
boxDO
==
null
)
{
if
(
boxDO
==
null
)
{
throw
exception
(
BOX_NOT_EXISTS
);
}
...
...
@@ -2204,15 +2224,15 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
Long
orderId
=
createReqVO
.
getOrderId
();
Long
secId
=
createReqVO
.
getSecId
();
if
(
createReqVO
.
getIsCover
()
==
0
)
{
if
(
createReqVO
.
getIsCover
()
==
0
)
{
//排单,先校验出货是否已经预装审核通过了
Integer
prStatus
=
boxDO
.
getPrStatus
();
if
(
prStatus
==
StStatusEnum
.
SORTING_APPROVAL_SUCCESS
.
getStStatus
())
{
if
(
prStatus
==
StStatusEnum
.
SORTING_APPROVAL_SUCCESS
.
getStStatus
())
{
throw
new
ServiceException
(
500
,
"出货已分拣审核通过。"
);
}
}
else
{
Integer
airShipmentStatus
=
boxDO
.
getAirShipmentStatus
();
if
(
airShipmentStatus
==
AirShipmentStatusEnum
.
SHIPMENT
.
getStatus
())
{
if
(
airShipmentStatus
==
AirShipmentStatusEnum
.
SHIPMENT
.
getStatus
())
{
throw
new
ServiceException
(
500
,
"已出货不能补单。"
);
}
}
...
...
@@ -2226,13 +2246,13 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
OrderConsigneeDO
filterConsigneeDO
=
getFilterOrderConsigneeDO
(
boxDO
,
loadList
);
OrderDO
orderDO
=
orderService
.
getById
(
orderId
);
if
(
filterConsigneeDO
!=
null
)
{
if
(
filterConsigneeDO
!=
null
)
{
//校验收货人是否是同一个人
OrderConsigneeDO
consigneeDO
=
boxService
.
getOrderConsignee
(
orderDO
);
//校验是否是用一个人 ,通过手机号
if
(
consigneeDO
!=
null
&&
!
consigneeDO
.
getPhone
().
equals
(
filterConsigneeDO
.
getPhone
()))
{
if
(
consigneeDO
!=
null
&&
!
consigneeDO
.
getPhone
().
equals
(
filterConsigneeDO
.
getPhone
()))
{
throw
new
ServiceException
(
500
,
"当前自编号是客户+自清,收货人必须是手机号相同才可以进行分拣"
);
}
}
...
...
@@ -2240,7 +2260,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
//如果都符合,下面展示互斥和关联订单的弹窗
Integer
relationStatus
=
createReqVO
.
getRelationStatus
();
//校验是否是互斥订单
if
(
relationStatus
==
null
||
relationStatus
==
2
)
{
if
(
relationStatus
==
null
||
relationStatus
==
2
)
{
//校验互斥订单
checkMutualOrder
(
loadList
,
orderDO
);
}
...
...
@@ -2251,7 +2271,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
boolean
hasRelationOrder
=
CollectionUtil
.
isNotEmpty
(
orderRelationList
);
if
(
hasRelationOrder
)
{
if
(
hasRelationOrder
)
{
Set
<
Long
>
orderIdSet
=
orderRelationList
.
stream
()
.
flatMap
(
o
->
Stream
.
of
(
o
.
getOrderId
(),
o
.
getRelateOrderId
()))
.
collect
(
Collectors
.
toSet
());
...
...
@@ -2281,43 +2301,43 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
.
collect
(
Collectors
.
toList
());
boolean
isSuit
=
true
;
if
(
CollectionUtil
.
isNotEmpty
(
notMatchStatusList
))
{
if
(
CollectionUtil
.
isNotEmpty
(
notMatchStatusList
))
{
isSuit
=
false
;
if
(
hasRelationOrder
)
{
if
(
hasRelationOrder
)
{
sb
.
append
(
"<br>"
);
}
List
<
String
>
orderNoList
=
notMatchStatusList
.
stream
()
.
map
(
OrderDO:
:
getOrderNo
)
.
collect
(
Collectors
.
toList
());
String
orderNos
=
Joiner
.
on
(
","
).
join
(
orderNoList
);
sb
.
append
(
"订单:"
)
.
append
(
orderNos
).
append
(
"未完成备货,不能排单"
);
sb
.
append
(
"订单:"
).
append
(
orderNos
).
append
(
"未完成备货,不能排单"
);
}
if
(
CollectionUtil
.
isNotEmpty
(
abnormalList
))
{
if
(
CollectionUtil
.
isNotEmpty
(
abnormalList
))
{
isSuit
=
false
;
if
(
hasRelationOrder
)
{
if
(
hasRelationOrder
)
{
sb
.
append
(
"<br>"
);
}
List
<
String
>
orderNoList
=
abnormalList
.
stream
()
.
map
(
OrderDO:
:
getOrderNo
)
.
collect
(
Collectors
.
toList
());
String
orderNos
=
Joiner
.
on
(
","
).
join
(
orderNoList
);
sb
.
append
(
"订单:"
)
.
append
(
orderNos
).
append
(
"存在异常"
);
sb
.
append
(
"订单:"
).
append
(
orderNos
).
append
(
"存在异常"
);
}
if
(
CollectionUtil
.
isNotEmpty
(
auditList
))
{
if
(
CollectionUtil
.
isNotEmpty
(
auditList
))
{
isSuit
=
false
;
if
(
hasRelationOrder
)
{
if
(
hasRelationOrder
)
{
sb
.
append
(
"<br>"
);
}
List
<
String
>
orderNoList
=
auditList
.
stream
()
.
map
(
OrderDO:
:
getOrderNo
)
.
collect
(
Collectors
.
toList
());
String
orderNos
=
Joiner
.
on
(
","
).
join
(
orderNoList
);
sb
.
append
(
"订单:"
)
.
append
(
orderNos
).
append
(
"审核中"
);
sb
.
append
(
"订单:"
).
append
(
orderNos
).
append
(
"审核中"
);
}
if
(!
isSuit
)
{
if
(!
isSuit
)
{
throw
new
ServiceException
(
500
,
sb
.
toString
());
}
...
...
@@ -2327,7 +2347,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
//过滤了入仓为0的数据
List
<
OrderItemBackVO
>
orderItemList
=
orderItemService
.
getOrderItemBackByOrderId
(
orderIdList
);
if
(
CollectionUtil
.
isEmpty
(
orderItemList
))
{
if
(
CollectionUtil
.
isEmpty
(
orderItemList
))
{
throw
new
ServiceException
(
500
,
"订单项不存在"
);
}
...
...
@@ -2359,13 +2379,13 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
sb
.
append
(
"订单:"
).
append
(
item
.
getOrderNo
()).
append
(
","
).
append
(
e
.
getMessage
()).
append
(
"<br>"
);
}
}
if
(!
isSuit
)
{
if
(!
isSuit
)
{
throw
new
ServiceException
(
500
,
sb
.
toString
());
}
//都符合,预装,看是否弹出提示
if
(
relationStatus
==
null
||
relationStatus
==
1
)
{
if
(
hasRelationOrder
)
{
if
(
relationStatus
==
null
||
relationStatus
==
1
)
{
if
(
hasRelationOrder
)
{
throw
new
ServiceException
(
566
,
sb
.
toString
());
}
...
...
@@ -2376,7 +2396,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
BoxPreloadGoodsDO
boxPreloadGoods
=
BoxPreloadGoodsConvert
.
INSTANCE
.
convert
(
createReqVO
);
boxPreloadGoods
.
setOrderItemId
(
orderItem
.
getOrderItemId
());
boxPreloadGoods
.
setOrderId
(
orderItem
.
getOrderId
());
if
(
createReqVO
.
getIsCover
()
!=
null
)
{
if
(
createReqVO
.
getIsCover
()
!=
null
)
{
boxPreloadGoods
.
setIsCover
(
createReqVO
.
getIsCover
());
}
preloadGoodsDOList
.
add
(
boxPreloadGoods
);
...
...
@@ -2385,12 +2405,12 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
// 插入
boxPreloadGoodsMapper
.
insertBatch
(
preloadGoodsDOList
);
if
(
boxDO
.
getPrStatus
()
==
StStatusEnum
.
NO_SORTING
.
getStStatus
())
{
if
(
boxDO
.
getPrStatus
()
==
StStatusEnum
.
NO_SORTING
.
getStStatus
())
{
//修改为分拣中
boxDO
.
setPrStatus
(
StStatusEnum
.
SORTING
.
getStStatus
());
boxService
.
updateById
(
boxDO
);
boxService
.
addOrderLog
(
orderIdList
,
OrderShipmentLog
.
SORTING_ADD
,
""
);
}
else
if
(
boxDO
.
getPrStatus
()
==
StStatusEnum
.
SORTING_APPROVAL_SUCCESS
.
getStStatus
())
{
}
else
if
(
boxDO
.
getPrStatus
()
==
StStatusEnum
.
SORTING_APPROVAL_SUCCESS
.
getStStatus
())
{
//补单。修改订单状态
for
(
Long
oId
:
orderIdList
)
{
boxService
.
updateOrderStatus
(
oId
,
OrderStatusEnum
.
PRE_INSTALLED
.
getValue
(),
0
,
...
...
@@ -2425,7 +2445,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
query
.
setLang
(
I18nMessage
.
getLang
());
Long
airShipmentId
=
query
.
getShipmentId
();
if
(
airShipmentId
==
null
)
{
if
(
airShipmentId
==
null
)
{
throw
new
ServiceException
(
500
,
"shipmentId不能为空"
);
}
BoxDO
airBox
=
boxService
.
getBox
(
airShipmentId
);
...
...
@@ -2438,7 +2458,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
);
OrderConsigneeDO
filterConsigneeDO
=
getFilterOrderConsigneeDO
(
airBox
,
loadList
);
if
(
filterConsigneeDO
!=
null
)
{
if
(
filterConsigneeDO
!=
null
)
{
filterConsigneeDO
.
setRelationId
(
filterConsigneeDO
.
getRelationId
());
}
...
...
@@ -2448,17 +2468,17 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
Long
startWarehouseId
=
query
.
getStartWarehouseId
();
//校验始发仓
if
(
startWarehouseId
!=
null
)
{
if
(
startWarehouseId
!=
null
)
{
Iterator
<
OrderPreloadVO
>
it
=
orderPreloadList
.
iterator
();
while
(
it
.
hasNext
())
{
OrderPreloadVO
preloadVO
=
it
.
next
();
Long
adjustToDestWarehouseId
=
preloadVO
.
getAdjustToDestWarehouseId
();
if
(
adjustToDestWarehouseId
!=
null
&&
adjustToDestWarehouseId
!=
0
)
{
if
(
adjustToDestWarehouseId
!=
null
&&
adjustToDestWarehouseId
!=
0
)
{
//有调仓,判断调仓是否符合条件,不符合条件则直接移除
if
(!
startWarehouseId
.
equals
(
adjustToDestWarehouseId
))
it
.
remove
();
if
(!
startWarehouseId
.
equals
(
adjustToDestWarehouseId
))
it
.
remove
();
}
else
{
//没有调仓,判断始发仓是否符合条件
if
(!
startWarehouseId
.
equals
(
preloadVO
.
getStartWarehouseId
()))
it
.
remove
();
if
(!
startWarehouseId
.
equals
(
preloadVO
.
getStartWarehouseId
()))
it
.
remove
();
}
}
}
...
...
@@ -2486,17 +2506,17 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
List
<
OrderItemBackVO
>
orderItemList
=
orderItemService
.
getOrderItemBackByOrderId
(
orderIdList
);
//订单项过滤了入仓为0的数据,
if
(
CollectionUtil
.
isEmpty
(
orderItemList
))
return
new
BoxOrderPreloadStatistics
();
if
(
CollectionUtil
.
isEmpty
(
orderItemList
))
return
new
BoxOrderPreloadStatistics
();
//过滤入仓特性条件
if
(
StringUtils
.
isNotBlank
(
query
.
getAttrId
()))
{
if
(
StringUtils
.
isNotBlank
(
query
.
getAttrId
()))
{
orderItemList
=
orderItemList
.
stream
()
.
filter
(
t
->
StringUtils
.
isNotBlank
(
t
.
getWarehouseInProdAttrIds
()))
.
filter
(
t
->
t
.
getWarehouseInProdAttrIds
().
contains
(
query
.
getAttrId
()))
.
collect
(
Collectors
.
toList
());
}
if
(
CollectionUtil
.
isEmpty
(
orderItemList
))
return
new
BoxOrderPreloadStatistics
();
if
(
CollectionUtil
.
isEmpty
(
orderItemList
))
return
new
BoxOrderPreloadStatistics
();
//订单对应的订单项列表
Map
<
Long
,
List
<
OrderItemBackVO
>>
orderItemMap
=
orderItemList
.
stream
()
...
...
@@ -2514,7 +2534,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
);
//订单项ID->已装商品
Map
<
Long
,
BoxPreloadGoodsDO
>
itemIdMap
=
boxPreloadGoodsDOList
.
stream
()
.
collect
(
Collectors
.
toMap
(
BoxPreloadGoodsDO:
:
getOrderItemId
,
v
->
v
,
(
v1
,
v2
)->
v2
));
.
collect
(
Collectors
.
toMap
(
BoxPreloadGoodsDO:
:
getOrderItemId
,
v
->
v
,
(
v1
,
v2
)
->
v2
));
//获取出货单ID列表
List
<
Long
>
shipmentIdList
=
boxPreloadGoodsDOList
.
stream
()
...
...
@@ -2524,10 +2544,10 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
Map
<
Long
,
BoxDO
>
boxMap
=
new
HashMap
<>();
Map
<
Long
,
List
<
BoxPreloadSectionDO
>>
sectionMap
=
new
HashMap
<>();
if
(
CollectionUtil
.
isNotEmpty
(
shipmentIdList
))
{
if
(
CollectionUtil
.
isNotEmpty
(
shipmentIdList
))
{
List
<
BoxDO
>
boxList
=
boxService
.
getBoxList
(
shipmentIdList
);
boxMap
=
boxList
.
stream
()
.
collect
(
Collectors
.
toMap
(
BoxDO:
:
getId
,
v
->
v
));
.
collect
(
Collectors
.
toMap
(
BoxDO:
:
getId
,
v
->
v
));
//找到出货单下面的所有部分,确定已装商品在第几部分
List
<
BoxPreloadSectionDO
>
sectionDOList
=
boxPreloadSectionService
.
selectByShipmentIdList
(
shipmentIdList
);
...
...
@@ -2549,7 +2569,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
List
<
OrderItemBackVO
>
itemList
=
orderItemMap
.
get
(
orderPreloadVO
.
getOrderId
());
//过滤了为入仓的订单项,所以会有为null的情况,
//没有订单项,删除这个订单,
if
(
CollectionUtil
.
isEmpty
(
itemList
))
{
if
(
CollectionUtil
.
isEmpty
(
itemList
))
{
it
.
remove
();
continue
;
}
...
...
@@ -2566,14 +2586,14 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
Long
orderItemId
=
item
.
getOrderItemId
();
BoxPreloadGoodsDO
boxPreloadGoodsDO
=
itemIdMap
.
get
(
orderItemId
);
if
(
boxPreloadGoodsDO
==
null
)
{
if
(
boxPreloadGoodsDO
==
null
)
{
//未预装
unLoadItemList
.
add
(
OrderItemConvert
.
INSTANCE
.
convert
(
item
));
}
else
{
//已预装
Long
shipmentId
=
boxPreloadGoodsDO
.
getShipmentId
();
BoxDO
boxDO
=
boxMap
.
get
(
shipmentId
);
if
(
boxDO
==
null
)
{
if
(
boxDO
==
null
)
{
//出货单未找到?
unLoadItemList
.
add
(
OrderItemConvert
.
INSTANCE
.
convert
(
item
));
}
else
{
...
...
@@ -2587,7 +2607,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
}
}
}
if
(
boxOrderItemBackVOList
.
size
()
==
loadInfoList
.
size
())
{
if
(
boxOrderItemBackVOList
.
size
()
==
loadInfoList
.
size
())
{
//这个订单都已经被预装了
it
.
remove
();
}
...
...
@@ -2597,16 +2617,16 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
.
map
(
OrderPreloadVO:
:
getOrderId
)
.
collect
(
Collectors
.
toList
());
Integer
orderStatus
=
query
.
getOrderStatus
();
if
(
orderStatus
!=
null
&&
CollectionUtil
.
isNotEmpty
(
resultOrderIdList
))
{
if
(
orderStatus
!=
null
&&
CollectionUtil
.
isNotEmpty
(
resultOrderIdList
))
{
List
<
Long
>
matchIdList
=
new
ArrayList
<>();
if
(
orderStatus
==
1
)
{
//拆单
if
(
orderStatus
==
1
)
{
//拆单
//过滤掉不是拆单的订单
List
<
OrderDO
>
orderDOList
=
orderQueryService
.
getOrderList
(
resultOrderIdList
);
matchIdList
=
orderDOList
.
stream
()
.
filter
(
t
->
(
t
.
getParentOrderId
()
!=
null
&&
t
.
getParentOrderId
()
!=
0L
))
.
map
(
OrderDO:
:
getOrderId
)
.
collect
(
Collectors
.
toList
());
}
else
if
(
orderStatus
==
2
)
{
//关联单
}
else
if
(
orderStatus
==
2
)
{
//关联单
//找出所有的关联单
List
<
OrderGuanlianDO
>
guanlianList
=
orderGuanlianService
.
getGuanlianList
(
resultOrderIdList
);
matchIdList
=
guanlianList
.
stream
()
...
...
@@ -2625,7 +2645,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
.
filter
(
t
->
finalMatchIdList
.
contains
(
t
.
getOrderId
()))
.
collect
(
Collectors
.
toList
());
}
if
(
CollectionUtil
.
isNotEmpty
(
unLoadItemList
))
{
if
(
CollectionUtil
.
isNotEmpty
(
unLoadItemList
))
{
//过滤审核中的订单
Set
<
Long
>
oIdList
=
unLoadItemList
.
stream
()
.
map
(
OrderItemDO:
:
getOrderId
)
...
...
@@ -2643,7 +2663,6 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
}
//统计待预装箱数、重量、体积
BoxGoodsStatistics
boxGoodsStatistics
=
calculationStatistics
(
unLoadItemList
);
...
...
@@ -2658,7 +2677,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
float
count
=
list
.
size
();
//计算最大页数
float
number
=
count
/
limit
;
int
pages
=
(
int
)
Math
.
ceil
(
number
);
int
pages
=
(
int
)
Math
.
ceil
(
number
);
mPage
.
setPages
(
pages
);
List
<
BoxOrderPreloadVo
>
records
=
list
.
stream
()
...
...
@@ -2677,7 +2696,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
.
map
(
OrderPreloadVO:
:
getChannelId
)
.
collect
(
Collectors
.
toSet
());
Map
<
Long
,
ChannelDO
>
channelDOMap
=
new
HashMap
<>();
if
(
CollectionUtil
.
isNotEmpty
(
lineIdList
))
{
if
(
CollectionUtil
.
isNotEmpty
(
lineIdList
))
{
List
<
ChannelDO
>
channelDOList
=
channelService
.
getChannelList
(
lineIdList
);
channelDOMap
=
channelDOList
.
stream
()
.
collect
(
Collectors
.
toMap
(
ChannelDO:
:
getChannelId
,
v
->
v
));
...
...
@@ -2691,7 +2710,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
Long
channelId
=
boxOrderPreloadVo
.
getChannelId
();
ChannelDO
channelDO
=
channelDOMap
.
get
(
channelId
);
if
(
channelDO
!=
null
)
{
if
(
channelDO
!=
null
)
{
boxOrderPreloadVo
.
setAttrNameList
(
getAttrNameByIds
(
channelDO
.
getAttrId
(),
idNameMap
));
}
...
...
@@ -2712,7 +2731,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
}
private
List
<
String
>
getAttrNameByIds
(
String
attrIds
,
Map
<
String
,
String
>
idNameMap
)
{
if
(
StringUtils
.
isNotBlank
(
attrIds
))
{
if
(
StringUtils
.
isNotBlank
(
attrIds
))
{
String
[]
attrIdArray
=
attrIds
.
split
(
","
);
List
<
String
>
nameList
=
new
ArrayList
<>();
for
(
String
attrId
:
attrIdArray
)
{
...
...
@@ -2729,9 +2748,9 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
while
(
it
.
hasNext
())
{
OrderPreloadVO
orderPreloadVO
=
it
.
next
();
String
guanlianOrderStatus
=
orderPreloadVO
.
getGuanLianOrderStatus
();
if
(
StringUtils
.
isEmpty
(
guanlianOrderStatus
))
continue
;
if
(
StringUtils
.
isEmpty
(
guanlianOrderStatus
))
continue
;
JSONArray
jsonArray
=
JSONArray
.
parseArray
(
guanlianOrderStatus
);
if
(
jsonArray
.
size
()
>
0
)
{
if
(
jsonArray
.
size
()
>
0
)
{
//表示该订单的关联单-有异常或者在审核中或者未入仓
it
.
remove
();
}
...
...
@@ -2742,19 +2761,19 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
Integer
lang
=
I18nMessage
.
getLang
();
StringBuilder
sb
=
new
StringBuilder
();
if
(
Objects
.
equals
(
lang
,
LangEnum
.
ZH
.
getLang
()))
{
if
(
Objects
.
equals
(
lang
,
LangEnum
.
ZH
.
getLang
()))
{
sb
.
append
(
"第"
);
}
else
{
sb
.
append
(
"section "
);
}
for
(
int
i
=
1
;
i
<=
boxSectionList
.
size
();
i
++)
{
BoxPreloadSectionDO
item
=
boxSectionList
.
get
(
i
-
1
);
if
(
item
.
getId
().
equals
(
secId
))
{
if
(
item
.
getId
().
equals
(
secId
))
{
sb
.
append
(
i
);
break
;
}
}
if
(
Objects
.
equals
(
lang
,
LangEnum
.
ZH
.
getLang
()))
{
if
(
Objects
.
equals
(
lang
,
LangEnum
.
ZH
.
getLang
()))
{
sb
.
append
(
"部分"
);
}
return
sb
.
toString
();
...
...
@@ -2765,20 +2784,20 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
StringBuilder
sb
=
new
StringBuilder
();
int
sectionIndex
=
1
;
if
(
Objects
.
equals
(
lang
,
LangEnum
.
ZH
.
getLang
()))
{
if
(
Objects
.
equals
(
lang
,
LangEnum
.
ZH
.
getLang
()))
{
sb
.
append
(
"第"
);
}
else
{
sb
.
append
(
"section "
);
}
for
(
int
i
=
1
;
i
<=
boxSectionList
.
size
();
i
++)
{
BoxPreloadSectionDO
item
=
boxSectionList
.
get
(
i
-
1
);
if
(
item
.
getId
().
equals
(
secId
))
{
if
(
item
.
getId
().
equals
(
secId
))
{
sb
.
append
(
i
);
sectionIndex
=
i
;
break
;
}
}
if
(
Objects
.
equals
(
lang
,
LangEnum
.
ZH
.
getLang
()))
{
if
(
Objects
.
equals
(
lang
,
LangEnum
.
ZH
.
getLang
()))
{
sb
.
append
(
"部分"
);
}
orderVO
.
setSectionName
(
sb
.
toString
());
...
...
@@ -2819,11 +2838,11 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
Map
<
Long
,
BoxGoodsStatistics
>
shipmentStaticsMap
=
new
HashMap
<>();
for
(
Long
shipmentId
:
shipmentIdList
)
{
List
<
BoxLoadInfoDO
>
loadList
=
shipmentLoadMap
.
get
(
shipmentId
);
if
(
loadList
==
null
)
loadList
=
new
ArrayList
<>();
if
(
loadList
==
null
)
loadList
=
new
ArrayList
<>();
Set
<
Long
>
itemOrderIdSet
=
shipmentOrderMap
.
get
(
shipmentId
);
List
<
OrderDO
>
itemOrderList
=
null
;
if
(
itemOrderIdSet
!=
null
)
{
if
(
itemOrderIdSet
!=
null
)
{
itemOrderList
=
orderDOList
.
stream
()
.
filter
(
t
->
itemOrderIdSet
.
contains
(
t
.
getOrderId
()))
.
collect
(
Collectors
.
toList
());
...
...
@@ -2859,7 +2878,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
boxStatistics
.
setUnloadNum
(
unloadList
.
size
());
long
planNum
=
boxStatistics
.
getNum
();
if
(
planNum
!=
0
)
{
if
(
planNum
!=
0
)
{
//平均计算
BigDecimal
planVolume
=
boxStatistics
.
getVolume
();
BigDecimal
planWeight
=
boxStatistics
.
getWeight
();
...
...
@@ -2869,7 +2888,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
BigDecimal
loadVolume
;
BigDecimal
loadWeight
;
if
(
planNum
==
loadNum
)
{
if
(
planNum
==
loadNum
)
{
loadVolume
=
planVolume
;
loadWeight
=
planWeight
;
...
...
@@ -2887,7 +2906,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
BigDecimal
unloadVolume
;
BigDecimal
unloadWeight
;
if
(
planNum
==
unloadNum
)
{
if
(
planNum
==
unloadNum
)
{
unloadVolume
=
planVolume
;
unloadWeight
=
planWeight
;
}
else
{
...
...
@@ -2922,16 +2941,23 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
return
boxGoodsStatistics
;
}
/*
lanbm 2024-05-13 处理问题添加注释
*/
@Override
public
Map
<
Long
,
BoxGoodsStatistics
>
getBoxStatistics
(
List
<
Long
>
idList
)
{
//设置为不能移除的
//获取所有预装的商品
List
<
BoxPreloadGoodsDO
>
allGoodsItemList
=
boxPreloadGoodsMapper
.
selectList
(
new
LambdaQueryWrapperX
<
BoxPreloadGoodsDO
>()
//lanbm 2024-05-13 添加注释
List
<
BoxPreloadGoodsDO
>
allGoodsItemList
=
boxPreloadGoodsMapper
.
selectList
(
new
LambdaQueryWrapperX
<
BoxPreloadGoodsDO
>()
.
in
(
BoxPreloadGoodsDO:
:
getShipmentId
,
idList
)
.
eq
(
BoxPreloadGoodsDO:
:
getIsRemove
,
0
)
);
List
<
OrderItemDO
>
orderItemDOList
=
convertOrderItemList
(
BoxPreloadGoodsConvert
.
INSTANCE
.
convertList
(
allGoodsItemList
));
List
<
OrderItemDO
>
orderItemDOList
=
convertOrderItemList
(
BoxPreloadGoodsConvert
.
INSTANCE
.
convertList
(
allGoodsItemList
));
List
<
OrderDO
>
allOrderDOList
=
getOrderListByOrderItem
(
orderItemDOList
);
Map
<
Long
,
OrderDO
>
allOrderMap
=
allOrderDOList
.
stream
()
.
collect
(
Collectors
.
toMap
(
OrderDO:
:
getOrderId
,
v
->
v
));
...
...
@@ -2942,32 +2968,43 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
Long
orderId
=
goodsItem
.
getOrderId
();
OrderDO
orderDO
=
allOrderMap
.
get
(
orderId
);
// 检查 Map 中是否已存在 shipmentId,如果不存在则创建一个新的 Set
shipmentOrderMap
.
computeIfAbsent
(
shipmentId
,
k
->
new
HashSet
<>()).
add
(
orderDO
);
shipmentOrderMap
.
computeIfAbsent
(
shipmentId
,
k
->
new
HashSet
<>()).
add
(
orderDO
);
}
List
<
BoxLoadInfoDO
>
allLoadList
=
boxLoadInfoService
.
list
(
new
LambdaQueryWrapperX
<
BoxLoadInfoDO
>()
//ecw_box_load_info 已装柜标签 lanbm 2024-05-13 添加注释
List
<
BoxLoadInfoDO
>
allLoadList
=
boxLoadInfoService
.
list
(
new
LambdaQueryWrapperX
<
BoxLoadInfoDO
>()
.
in
(
BoxLoadInfoDO:
:
getShipmentId
,
idList
)
);
List
<
BoxMergePkgDO
>
allPkgList
=
boxMergePkgService
.
list
(
new
LambdaQueryWrapper
<
BoxMergePkgDO
>()
//ecw_box_merge_pkg 合包箱表 添加注释
List
<
BoxMergePkgDO
>
allPkgList
=
boxMergePkgService
.
list
(
new
LambdaQueryWrapper
<
BoxMergePkgDO
>()
.
in
(
BoxMergePkgDO:
:
getShipmentId
,
idList
)
);
Map
<
Long
,
List
<
BoxLoadInfoDO
>>
shipmentLoadMap
=
allLoadList
.
stream
()
.
collect
(
Collectors
.
groupingBy
(
BoxLoadInfoDO:
:
getShipmentId
));
//合包箱数据
Map
<
Long
,
List
<
BoxMergePkgDO
>>
shipmentMergeMap
=
allPkgList
.
stream
()
.
collect
(
Collectors
.
groupingBy
(
BoxMergePkgDO:
:
getShipmentId
));
Map
<
Long
,
BoxGoodsStatistics
>
shipmentStatisticsMap
=
new
HashMap
<>();
for
(
Long
shipmentId
:
idList
)
{
List
<
BoxLoadInfoDO
>
loadInfoList
=
shipmentLoadMap
.
get
(
shipmentId
);
Set
<
OrderDO
>
orderDOList
=
shipmentOrderMap
.
get
(
shipmentId
);
if
(
loadInfoList
==
null
)
loadInfoList
=
new
ArrayList
<>();
if
(
orderDOList
==
null
)
orderDOList
=
new
HashSet
<>();
BoxGoodsStatistics
boxGoodsStatistics
=
calculateByOrderList
(
loadInfoList
,
orderDOList
);
calculateBoxMergeSum
(
shipmentMergeMap
.
get
(
shipmentId
),
boxGoodsStatistics
);
if
(
loadInfoList
==
null
)
loadInfoList
=
new
ArrayList
<>();
if
(
orderDOList
==
null
)
orderDOList
=
new
HashSet
<>();
BoxGoodsStatistics
boxGoodsStatistics
=
calculateByOrderList
(
loadInfoList
,
orderDOList
);
//lanbm 2024-05-13 添加参数,解决合包箱数据为空时不计算预装箱数的BUG
calculateBoxMergeSum
(
shipmentMergeMap
.
get
(
shipmentId
),
boxGoodsStatistics
,
shipmentId
);
shipmentStatisticsMap
.
put
(
shipmentId
,
boxGoodsStatistics
);
}
return
shipmentStatisticsMap
;
...
...
@@ -2976,7 +3013,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
@Override
public
String
getDocumentInfo
(
Long
shipmentId
)
{
Map
<
String
,
String
>
documentInfoMap
=
baseMapper
.
getShipmentCustomTypes
(
shipmentId
);
if
(
documentInfoMap
==
null
)
return
null
;
if
(
documentInfoMap
==
null
)
return
null
;
return
documentInfoMap
.
get
(
"customs_type"
);
}
...
...
@@ -3012,11 +3049,11 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
Set
<
Long
>
orderIdSet
=
dataList
.
stream
()
.
map
(
BoxPreloadGoodsDO:
:
getOrderId
)
.
collect
(
Collectors
.
toSet
());
if
(
CollectionUtil
.
isEmpty
(
orderIdSet
))
return
new
ArrayList
<>();
if
(
CollectionUtil
.
isEmpty
(
orderIdSet
))
return
new
ArrayList
<>();
List
<
Integer
>
customsTypeList
=
Arrays
.
asList
(
2
,
3
);
List
<
OrderDO
>
orderList
=
orderQueryService
.
getOrderList
(
orderIdSet
);
orderList
=
orderList
.
stream
()
.
filter
(
t
->
(
t
.
getCustomsType
()
!=
null
&&
customsTypeList
.
contains
(
t
.
getCustomsType
())))
.
filter
(
t
->
(
t
.
getCustomsType
()
!=
null
&&
customsTypeList
.
contains
(
t
.
getCustomsType
())))
.
collect
(
Collectors
.
toList
());
return
orderList
;
}
...
...
@@ -3026,24 +3063,49 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
return
boxPreloadGoodsMapper
.
orderPreloaded
(
query
);
}
private
void
calculateBoxMergeSum
(
List
<
BoxMergePkgDO
>
mergePkgDOList
,
BoxGoodsStatistics
boxGoodsStatistics
)
{
if
(
CollectionUtil
.
isEmpty
(
mergePkgDOList
))
return
;
/*
shipmentId lanbm 2024-05-13 添加出货主表ID shipmentId
BoxMergePkgDO ecw_box_merge_pkg lanbm 2024-05-13 添加注释
*/
private
void
calculateBoxMergeSum
(
List
<
BoxMergePkgDO
>
mergePkgDOList
,
BoxGoodsStatistics
boxGoodsStatistics
,
long
shipmentId
)
{
//lanbm 2024-05-13 添加修改问题注释掉的代码
//if (CollectionUtil.isEmpty(mergePkgDOList)) return;
//shipmentId = mergePkgDOList.get(0).getShipmentId();
//end lanbm 2024-05-13 添加修改问题注释掉的代码
Long
shipmentId
=
mergePkgDOList
.
get
(
0
).
getShipmentId
();
BoxDO
box
=
boxService
.
getBox
(
shipmentId
);
if
(!
TransportTypeEnum
.
AIR
.
getType
().
equals
(
box
.
getTransportType
()))
{
return
;
}
List
<
BoxMergePkgDO
>
boxMergePkgDOS
=
boxMergePkgService
.
selectList
(
BoxMergePkgDO:
:
getShipmentId
,
shipmentId
);
List
<
BoxPreloadGoodsDO
>
boxPreloadGoodsDOS
=
boxPreloadGoodsMapper
.
selectList
(
new
LambdaQueryWrapperX
<
BoxPreloadGoodsDO
>().
eq
(
BoxPreloadGoodsDO:
:
getShipmentId
,
shipmentId
).
eq
(
BoxPreloadGoodsDO:
:
getIsRemove
,
0
));
//合包箱数据
List
<
BoxMergePkgDO
>
boxMergePkgDOS
=
boxMergePkgService
.
selectList
(
BoxMergePkgDO:
:
getShipmentId
,
shipmentId
);
//合包箱数据和预装箱数据
List
<
BoxPreloadGoodsDO
>
boxPreloadGoodsDOS
=
boxPreloadGoodsMapper
.
selectList
(
new
LambdaQueryWrapperX
<
BoxPreloadGoodsDO
>().
eq
(
BoxPreloadGoodsDO:
:
getShipmentId
,
shipmentId
).
eq
(
BoxPreloadGoodsDO:
:
getIsRemove
,
0
));
//合包箱计划数据
getMergeData
(
boxPreloadGoodsDOS
,
boxMergePkgDOS
,
boxGoodsStatistics
);
//已出合包数据
getCheckoutMergeData
(
shipmentId
,
boxPreloadGoodsDOS
,
boxMergePkgDOS
,
boxGoodsStatistics
);
boxGoodsStatistics
.
setMergePlanVolume
(
boxGoodsStatistics
.
getMergeVolume
());
boxGoodsStatistics
.
setMergePlanWeight
(
boxGoodsStatistics
.
getMergeWeight
());
boxGoodsStatistics
.
setMergeRealVolume
(
boxGoodsStatistics
.
getCheckoutMergeVolume
());
boxGoodsStatistics
.
setMergeRealWeight
(
boxGoodsStatistics
.
getCheckoutMergeWeight
());
getCheckoutMergeData
(
shipmentId
,
boxPreloadGoodsDOS
,
boxMergePkgDOS
,
boxGoodsStatistics
);
boxGoodsStatistics
.
setMergePlanVolume
(
boxGoodsStatistics
.
getMergeVolume
());
boxGoodsStatistics
.
setMergePlanWeight
(
boxGoodsStatistics
.
getMergeWeight
());
//已出数 lanbm 2024-04-13 添加注释
boxGoodsStatistics
.
setMergeRealVolume
(
boxGoodsStatistics
.
getCheckoutMergeVolume
());
boxGoodsStatistics
.
setMergeRealWeight
(
boxGoodsStatistics
.
getCheckoutMergeWeight
());
}
private
void
calculateBoxMergeSum
(
Long
shipmentId
,
BoxGoodsStatistics
boxGoodsStatistics
)
{
...
...
@@ -3051,14 +3113,18 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
if
(!
TransportTypeEnum
.
AIR
.
getType
().
equals
(
box
.
getTransportType
()))
{
return
;
}
List
<
BoxMergePkgDO
>
boxMergePkgDOS
=
boxMergePkgService
.
selectList
(
BoxMergePkgDO:
:
getShipmentId
,
shipmentId
);
List
<
BoxPreloadGoodsDO
>
boxPreloadGoodsDOS
=
boxPreloadGoodsMapper
.
selectList
(
new
LambdaQueryWrapperX
<
BoxPreloadGoodsDO
>().
eq
(
BoxPreloadGoodsDO:
:
getShipmentId
,
shipmentId
).
eq
(
BoxPreloadGoodsDO:
:
getIsRemove
,
0
));
List
<
BoxMergePkgDO
>
boxMergePkgDOS
=
boxMergePkgService
.
selectList
(
BoxMergePkgDO:
:
getShipmentId
,
shipmentId
);
List
<
BoxPreloadGoodsDO
>
boxPreloadGoodsDOS
=
boxPreloadGoodsMapper
.
selectList
(
new
LambdaQueryWrapperX
<
BoxPreloadGoodsDO
>().
eq
(
BoxPreloadGoodsDO:
:
getShipmentId
,
shipmentId
).
eq
(
BoxPreloadGoodsDO:
:
getIsRemove
,
0
));
//合包箱计划数据
getMergeData
(
boxPreloadGoodsDOS
,
boxMergePkgDOS
,
boxGoodsStatistics
);
//已出合包数据
getCheckoutMergeData
(
shipmentId
,
boxPreloadGoodsDOS
,
boxMergePkgDOS
,
boxGoodsStatistics
);
getCheckoutMergeData
(
shipmentId
,
boxPreloadGoodsDOS
,
boxMergePkgDOS
,
boxGoodsStatistics
);
//已出订单数据
getCheckoutOrderData
(
shipmentId
,
boxPreloadGoodsDOS
,
boxMergePkgDOS
,
boxGoodsStatistics
);
getCheckoutOrderData
(
shipmentId
,
boxPreloadGoodsDOS
,
boxMergePkgDOS
,
boxGoodsStatistics
);
// calculateBoxMergeSum(mergePkgDOList, boxGoodsStatistics);
}
...
...
@@ -3086,7 +3152,10 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
boxGoodsStatistics
.
setCheckoutOrderWeight
(
checkoutOrderWeight
);
}
private
void
getCheckoutMergeData
(
Long
shipmentId
,
List
<
BoxPreloadGoodsDO
>
boxPreloadGoodsDOS
,
List
<
BoxMergePkgDO
>
boxMergePkgDOS
,
BoxGoodsStatistics
boxGoodsStatistics
)
{
private
void
getCheckoutMergeData
(
Long
shipmentId
,
List
<
BoxPreloadGoodsDO
>
boxPreloadGoodsDOS
,
List
<
BoxMergePkgDO
>
boxMergePkgDOS
,
BoxGoodsStatistics
boxGoodsStatistics
)
{
int
checkoutMergeNum
=
0
;
BigDecimal
checkoutMergeVolume
=
BigDecimal
.
ZERO
;
BigDecimal
checkoutMergeWeight
=
BigDecimal
.
ZERO
;
...
...
@@ -3101,7 +3170,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
int
orderSumNum
=
orderDOS
.
stream
().
mapToInt
(
OrderDO:
:
getSumNum
).
sum
();
Long
loadCount
=
boxLoadInfoService
.
selectCount
(
new
LambdaQueryWrapper
<
BoxLoadInfoDO
>()
.
eq
(
BoxLoadInfoDO:
:
getShipmentId
,
shipmentId
)
.
in
(
BoxLoadInfoDO:
:
getOrderId
,
orderIds
)
.
in
(
BoxLoadInfoDO:
:
getOrderId
,
orderIds
)
);
if
(
loadCount
.
intValue
()
==
orderSumNum
)
{
checkoutMergeNum
=
checkoutMergeNum
+
1
;
...
...
@@ -3141,30 +3210,43 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
boxGoodsStatistics
.
setCheckoutMergeWeight
(
checkoutMergeWeight
);
}
private
void
getMergeData
(
List
<
BoxPreloadGoodsDO
>
boxPreloadGoodsDOS
,
List
<
BoxMergePkgDO
>
boxMergePkgDOS
,
BoxGoodsStatistics
boxGoodsStatistics
)
{
private
void
getMergeData
(
List
<
BoxPreloadGoodsDO
>
boxPreloadGoodsDOS
,
List
<
BoxMergePkgDO
>
boxMergePkgDOS
,
BoxGoodsStatistics
boxGoodsStatistics
)
{
int
mergeNum
=
0
;
BigDecimal
mergeVolume
=
BigDecimal
.
ZERO
;
BigDecimal
mergeWeight
=
BigDecimal
.
ZERO
;
List
<
Long
>
preloadOrderIds
=
boxPreloadGoodsDOS
.
stream
().
map
(
BoxPreloadGoodsDO:
:
getOrderId
).
distinct
().
collect
(
Collectors
.
toList
());
List
<
Long
>
preloadOrderIds
=
boxPreloadGoodsDOS
.
stream
().
map
(
BoxPreloadGoodsDO:
:
getOrderId
).
distinct
().
collect
(
Collectors
.
toList
());
if
(
CollectionUtil
.
isNotEmpty
(
boxMergePkgDOS
))
{
List
<
Long
>
pkgIds
=
boxMergePkgDOS
.
stream
().
map
(
BoxMergePkgDO:
:
getId
).
collect
(
Collectors
.
toList
());
List
<
BoxPkgOrderDO
>
boxPkgOrderDOS
=
boxPkgOrderService
.
selectList
(
BoxPkgOrderDO:
:
getPkgId
,
pkgIds
);
List
<
Long
>
pkgIds
=
boxMergePkgDOS
.
stream
().
map
(
BoxMergePkgDO:
:
getId
).
collect
(
Collectors
.
toList
());
List
<
BoxPkgOrderDO
>
boxPkgOrderDOS
=
boxPkgOrderService
.
selectList
(
BoxPkgOrderDO:
:
getPkgId
,
pkgIds
);
if
(
CollectionUtil
.
isNotEmpty
(
boxPkgOrderDOS
))
{
List
<
Long
>
pkgOrderIds
=
boxPkgOrderDOS
.
stream
().
map
(
BoxPkgOrderDO:
:
getOrderId
).
collect
(
Collectors
.
toList
());
List
<
Long
>
pkgOrderIds
=
boxPkgOrderDOS
.
stream
().
map
(
BoxPkgOrderDO:
:
getOrderId
).
collect
(
Collectors
.
toList
());
preloadOrderIds
.
removeAll
(
pkgOrderIds
);
}
mergeNum
=
mergeNum
+
boxMergePkgDOS
.
size
();
mergeVolume
=
mergeVolume
.
add
(
boxMergePkgDOS
.
stream
().
filter
(
item
->
Objects
.
nonNull
(
item
.
getSumVolume
())).
map
(
BoxMergePkgDO:
:
getSumVolume
).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
));
mergeWeight
=
mergeWeight
.
add
(
boxMergePkgDOS
.
stream
().
filter
(
item
->
Objects
.
nonNull
(
item
.
getSumWeight
())).
map
(
BoxMergePkgDO:
:
getSumWeight
).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
));
mergeVolume
=
mergeVolume
.
add
(
boxMergePkgDOS
.
stream
().
filter
(
item
->
Objects
.
nonNull
(
item
.
getSumVolume
())).
map
(
BoxMergePkgDO:
:
getSumVolume
).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
));
mergeWeight
=
mergeWeight
.
add
(
boxMergePkgDOS
.
stream
().
filter
(
item
->
Objects
.
nonNull
(
item
.
getSumWeight
())).
map
(
BoxMergePkgDO:
:
getSumWeight
).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
));
}
//合包数据和预装箱数据累加一起 lanbm 2024-05-13 添加注释
if
(
CollectionUtil
.
isNotEmpty
(
preloadOrderIds
))
{
List
<
OrderDO
>
orderDOS
=
orderService
.
selectList
(
OrderDO:
:
getOrderId
,
preloadOrderIds
);
mergeNum
=
mergeNum
+
orderDOS
.
stream
().
mapToInt
(
OrderDO:
:
getSumNum
).
sum
();
mergeVolume
=
mergeVolume
.
add
(
orderDOS
.
stream
().
map
(
OrderDO:
:
getSumVolume
).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
));
mergeWeight
=
mergeWeight
.
add
(
orderDOS
.
stream
().
map
(
OrderDO:
:
getSumWeight
).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
));
List
<
OrderDO
>
orderDOS
=
orderService
.
selectList
(
OrderDO:
:
getOrderId
,
preloadOrderIds
);
mergeNum
=
mergeNum
+
orderDOS
.
stream
().
mapToInt
(
OrderDO:
:
getSumNum
).
sum
();
mergeVolume
=
mergeVolume
.
add
(
orderDOS
.
stream
().
map
(
OrderDO:
:
getSumVolume
).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
));
mergeWeight
=
mergeWeight
.
add
(
orderDOS
.
stream
().
map
(
OrderDO:
:
getSumWeight
).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
));
}
boxGoodsStatistics
.
setMergeNum
(
mergeNum
);
boxGoodsStatistics
.
setMergeVolume
(
mergeVolume
);
boxGoodsStatistics
.
setMergeWeight
(
mergeWeight
);
}
}
yudao-module-shipment/yudao-module-shipment-rest/src/main/java/cn/iocoder/yudao/module/shipment/controller/admin/BoxController.java
View file @
5643d79b
...
...
@@ -184,6 +184,7 @@ public class BoxController {
@ApiOperation
(
"获得出货分页, use this"
)
// @PreAuthorize("@ss.hasPermission({'shipment:box:query', 'shipment:box:query:air'})")
public
CommonResult
<
PageResult
<
BoxBackVO
>>
getBoxPage
(
@Valid
BoxQueryVO
query
,
PageVO
page
)
{
//lanbm 2024-05-13 处理问题添加注释
return
success
(
boxService
.
getBoxPage
(
query
,
page
));
}
...
...
yudao-module-shipment/yudao-module-shipment-rest/src/main/java/cn/iocoder/yudao/module/shipment/controller/admin/MakeBillOfLadingController.java
View file @
5643d79b
...
...
@@ -214,6 +214,9 @@ public class MakeBillOfLadingController {
return
success
(
true
);
}
/*
lanbm 2024-05-07 修改报关价显示单位问题
*/
@GetMapping
(
"/make"
)
@ApiOperation
(
"制作提货单"
)
@ApiImplicitParams
({
...
...
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