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
5ec19d6c
Commit
5ec19d6c
authored
Nov 07, 2024
by
332784038@qq.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
合单审批业务修改
parent
f03e57e3
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
157 additions
and
52 deletions
+157
-52
MergeServiceImpl.java
...er/yudao/module/order/service/merge/MergeServiceImpl.java
+53
-28
OrderQueryService.java
...r/yudao/module/order/service/order/OrderQueryService.java
+3
-1
OrderQueryServiceImpl.java
...odule/order/service/order/impl/OrderQueryServiceImpl.java
+75
-5
OrderSplitServiceImpl.java
...odule/order/service/orderSplit/OrderSplitServiceImpl.java
+17
-12
OrderWarehouseAdjustServiceImpl.java
...orderWarehouseAdjust/OrderWarehouseAdjustServiceImpl.java
+6
-2
OrderWarehouseInServiceImpl.java
...service/orderWarehouseIn/OrderWarehouseInServiceImpl.java
+3
-4
No files found.
yudao-module-order/yudao-module-order-core/src/main/java/cn/iocoder/yudao/module/order/service/merge/MergeServiceImpl.java
View file @
5ec19d6c
...
@@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.order.service.merge;
...
@@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.order.service.merge;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.core.util.StrUtil
;
import
cn.iocoder.yudao.framework.apollo.core.event.BoxCheckOrderSchedulingEvent
;
import
cn.iocoder.yudao.framework.apollo.core.event.BoxCheckOrderSchedulingEvent
;
import
cn.iocoder.yudao.framework.apollo.core.event.Order.OrderApprovalTypeCheckEvent
;
import
cn.iocoder.yudao.framework.common.exception.ServiceException
;
import
cn.iocoder.yudao.framework.common.exception.ServiceException
;
import
cn.iocoder.yudao.framework.common.pojo.PageResult
;
import
cn.iocoder.yudao.framework.common.pojo.PageResult
;
import
cn.iocoder.yudao.framework.dict.core.dto.DictDataRespDTO
;
import
cn.iocoder.yudao.framework.dict.core.dto.DictDataRespDTO
;
...
@@ -22,6 +23,7 @@ import cn.iocoder.yudao.module.order.convert.orderConsignee.OrderConsigneeConver
...
@@ -22,6 +23,7 @@ import cn.iocoder.yudao.module.order.convert.orderConsignee.OrderConsigneeConver
import
cn.iocoder.yudao.module.order.convert.orderConsignor.OrderConsignorConvert
;
import
cn.iocoder.yudao.module.order.convert.orderConsignor.OrderConsignorConvert
;
import
cn.iocoder.yudao.module.order.convert.orderDeparture.OrderDepartureConvert
;
import
cn.iocoder.yudao.module.order.convert.orderDeparture.OrderDepartureConvert
;
import
cn.iocoder.yudao.module.order.convert.orderObjective.OrderObjectiveConvert
;
import
cn.iocoder.yudao.module.order.convert.orderObjective.OrderObjectiveConvert
;
import
cn.iocoder.yudao.module.order.dal.dataobject.approval.OrderApprovalDO
;
import
cn.iocoder.yudao.module.order.dal.dataobject.merge.MergeDO
;
import
cn.iocoder.yudao.module.order.dal.dataobject.merge.MergeDO
;
import
cn.iocoder.yudao.module.order.dal.dataobject.order.OrderDO
;
import
cn.iocoder.yudao.module.order.dal.dataobject.order.OrderDO
;
import
cn.iocoder.yudao.module.order.dal.dataobject.orderFeeApplication.OrderFeeApplicationDO
;
import
cn.iocoder.yudao.module.order.dal.dataobject.orderFeeApplication.OrderFeeApplicationDO
;
...
@@ -43,6 +45,7 @@ import cn.iocoder.yudao.module.order.service.orderCargoControl.OrderCargoControl
...
@@ -43,6 +45,7 @@ import cn.iocoder.yudao.module.order.service.orderCargoControl.OrderCargoControl
import
cn.iocoder.yudao.module.order.service.orderWarehouseIn.OrderWarehouseInService
;
import
cn.iocoder.yudao.module.order.service.orderWarehouseIn.OrderWarehouseInService
;
import
cn.iocoder.yudao.module.order.service.orderWarehousePicture.OrderWarehousePictureService
;
import
cn.iocoder.yudao.module.order.service.orderWarehousePicture.OrderWarehousePictureService
;
import
cn.iocoder.yudao.module.order.service.targetLog.TargetLogService
;
import
cn.iocoder.yudao.module.order.service.targetLog.TargetLogService
;
import
cn.iocoder.yudao.module.order.vo.approval.OrderApprovalQueryVO
;
import
cn.iocoder.yudao.module.order.vo.merge.*
;
import
cn.iocoder.yudao.module.order.vo.merge.*
;
import
cn.iocoder.yudao.module.order.vo.order.OrderBackVO
;
import
cn.iocoder.yudao.module.order.vo.order.OrderBackVO
;
import
cn.iocoder.yudao.module.order.vo.orderItem.OrderItemQueryVO
;
import
cn.iocoder.yudao.module.order.vo.orderItem.OrderItemQueryVO
;
...
@@ -66,6 +69,7 @@ import java.util.stream.Collectors;
...
@@ -66,6 +69,7 @@ import java.util.stream.Collectors;
import
static
cn
.
iocoder
.
yudao
.
framework
.
common
.
exception
.
util
.
ServiceExceptionUtil
.
exception
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
common
.
exception
.
util
.
ServiceExceptionUtil
.
exception
;
import
static
cn
.
iocoder
.
yudao
.
module
.
order
.
enums
.
ErrorCodeConstants
.*;
import
static
cn
.
iocoder
.
yudao
.
module
.
order
.
enums
.
ErrorCodeConstants
.*;
import
static
cn
.
iocoder
.
yudao
.
module
.
order
.
enums
.
OrderApprovalTypeEnum
.*;
/**
/**
* 订单合单申请 Service 实现类
* 订单合单申请 Service 实现类
...
@@ -135,18 +139,26 @@ public class MergeServiceImpl extends AbstractService<MergeMapper, MergeDO> impl
...
@@ -135,18 +139,26 @@ public class MergeServiceImpl extends AbstractService<MergeMapper, MergeDO> impl
@Override
@Override
@Transactional
@Transactional
public
void
createMerge
(
List
<
MergeCreateReqVO
>
createReqVOS
)
{
public
void
createMerge
(
List
<
MergeCreateReqVO
>
createReqVOS
)
{
List
<
OrderDO
>
approvalOrderList
=
new
ArrayList
<>();
if
(
CollectionUtil
.
isNotEmpty
(
createReqVOS
))
{
if
(
CollectionUtil
.
isNotEmpty
(
createReqVOS
))
{
List
<
String
>
collect
=
createReqVOS
.
stream
().
map
(
MergeBaseVO:
:
getOrderNos
).
collect
(
Collectors
.
toList
());
List
<
String
>
collect
=
createReqVOS
.
stream
().
map
(
MergeBaseVO:
:
getOrderNos
).
collect
(
Collectors
.
toList
());
collect
.
add
(
createReqVOS
.
get
(
0
).
getApplyOrderNo
());
collect
.
add
(
createReqVOS
.
get
(
0
).
getApplyOrderNo
());
//判断这些订单是否已经已出
//判断这些订单是否已经已出
checkOrderCanOut
(
collect
);
checkOrderCanOut
(
collect
);
for
(
String
item
:
collect
)
{
collect
.
stream
().
forEach
(
item
->
{
OrderDO
one
=
orderService
.
getOne
(
new
LambdaQueryWrapperX
<
OrderDO
>().
eq
(
OrderDO:
:
getOrderNo
,
item
));
OrderDO
one
=
orderService
.
getOne
(
new
LambdaQueryWrapperX
<
OrderDO
>().
eq
(
OrderDO:
:
getOrderNo
,
item
));
applicationContext
.
publishEvent
(
new
BoxCheckOrderSchedulingEvent
(
one
.
getOrderId
()));
applicationContext
.
publishEvent
(
new
BoxCheckOrderSchedulingEvent
(
one
.
getOrderId
()));
orderQueryService
.
throwPendingExceptionOrProcessingApproval
(
one
.
getOrderId
());
if
(
one
.
getAbnormalState
()
!=
0
)
{
});
throw
exception
(
ORDER_HAS_PENDING_EXCEPTION
,
one
.
getOrderNo
());
}
OrderApprovalTypeCheckEvent
approvalTypeCheckEvent
=
new
OrderApprovalTypeCheckEvent
(
one
.
getOrderId
(),
null
,
merge_order
.
getValue
(),
null
,
false
);
applicationContext
.
publishEvent
(
approvalTypeCheckEvent
);
if
(
approvalTypeCheckEvent
.
getResult
())
{
throw
exception
(
ORDER_HAS_PROCESSING_APPROVAL
,
one
.
getOrderNo
());
}
approvalOrderList
.
add
(
one
);
}
}
}
OrderDO
one
=
orderService
.
getOne
(
new
LambdaQueryWrapperX
<
OrderDO
>().
eq
(
OrderDO:
:
getOrderNo
,
createReqVOS
.
get
(
0
).
getApplyOrderNo
()));
OrderDO
one
=
orderService
.
getOne
(
new
LambdaQueryWrapperX
<
OrderDO
>().
eq
(
OrderDO:
:
getOrderNo
,
createReqVOS
.
get
(
0
).
getApplyOrderNo
()));
applicationContext
.
publishEvent
(
new
BoxCheckOrderSchedulingEvent
(
one
.
getOrderId
()));
applicationContext
.
publishEvent
(
new
BoxCheckOrderSchedulingEvent
(
one
.
getOrderId
()));
...
@@ -160,24 +172,33 @@ public class MergeServiceImpl extends AbstractService<MergeMapper, MergeDO> impl
...
@@ -160,24 +172,33 @@ public class MergeServiceImpl extends AbstractService<MergeMapper, MergeDO> impl
Long
id
=
0L
;
Long
id
=
0L
;
Long
userId
=
SecurityFrameworkUtils
.
getLoginUserId
();
Long
userId
=
SecurityFrameworkUtils
.
getLoginUserId
();
Date
now
=
new
Date
();
Date
now
=
new
Date
();
List
<
MergeDO
>
mergeDOList
=
new
ArrayList
<>();
for
(
MergeCreateReqVO
createReqVO
:
createReqVOS
)
{
for
(
MergeCreateReqVO
createReqVO
:
createReqVOS
)
{
MergeDO
merge
=
MergeConvert
.
INSTANCE
.
convert
(
createReqVO
);
MergeDO
merge
=
MergeConvert
.
INSTANCE
.
convert
(
createReqVO
);
merge
.
setAddTime
(
now
);
merge
.
setAddTime
(
now
);
mergeMapper
.
insert
(
merge
);
mergeMapper
.
insert
(
merge
);
id
=
merge
.
getId
();
id
=
merge
.
getId
();
mergeDOList
.
add
(
merge
);
}
}
//创建审批流
//创建审批流
,这里只保存随便一个合并订单记录的主键id
String
bpmProcessId
=
bpmCreateServiceFactory
.
createBmp
(
userId
,
id
,
WorkFlowEmus
.
ORDER_MERGE_ORDER
.
getKey
(),
createReqVOS
.
get
(
0
).
getApplyOrderNo
(),
createReqVOS
.
get
(
0
).
getCopyUserId
());
String
bpmProcessId
=
bpmCreateServiceFactory
.
createBmp
(
userId
,
id
,
WorkFlowEmus
.
ORDER_MERGE_ORDER
.
getKey
(),
createReqVOS
.
get
(
0
).
getApplyOrderNo
(),
createReqVOS
.
get
(
0
).
getCopyUserId
());
Integer
auditType
=
OrderApprovalTypeResultEnum
.
merge_order_processing
.
getType
();
for
(
MergeDO
merge
:
mergeDOList
)
{
orderService
.
updateStatus
(
null
,
createReqVOS
.
get
(
0
).
getApplyOrderNo
(),
OrderStatusEnum
.
IN_WAREHOUSE
.
getValue
(),
null
,
OrderWarehouseInStatusEnum
.
order_merge_applying
.
getValue
(),
null
,
auditType
,
OrderApprovalTypeResultEnum
.
typeAndResultOf
(
auditType
,
1
).
getDesc
());
for
(
MergeCreateReqVO
createReqVO
:
createReqVOS
)
{
mergeMapper
.
update
(
null
,
new
LambdaUpdateWrapper
<
MergeDO
>()
mergeMapper
.
update
(
null
,
new
LambdaUpdateWrapper
<
MergeDO
>()
.
eq
(
MergeDO:
:
getApplyOrderNo
,
createReqVO
.
getApplyOrderNo
())
.
eq
(
MergeDO:
:
getId
,
merge
.
getId
())
.
eq
(
MergeDO:
:
getOrderNos
,
createReqVO
.
getOrderNos
())
.
set
(
MergeDO:
:
getBpmProcessId
,
bpmProcessId
));
.
set
(
MergeDO:
:
getBpmProcessId
,
bpmProcessId
));
orderService
.
updateStatus
(
null
,
createReqVO
.
getOrderNos
(),
OrderStatusEnum
.
IN_WAREHOUSE
.
getValue
(),
null
,
OrderWarehouseInStatusEnum
.
order_merge_applying
.
getValue
(),
null
,
auditType
,
OrderApprovalTypeResultEnum
.
typeAndResultOf
(
auditType
,
1
).
getDesc
());
}
}
// orderService.addOrderOperateLog(one.getOrderId(),"","提交合单申请","");
for
(
OrderDO
orderDO
:
approvalOrderList
)
{
//创建审批单,发起流程
OrderApprovalDO
orderApprovalDO
=
new
OrderApprovalDO
();
orderApprovalDO
.
setFollowUpSalesmanId
(
String
.
valueOf
(
SecurityFrameworkUtils
.
getLoginUserId
()));
orderApprovalDO
.
setOrderId
(
orderDO
.
getOrderId
());
//批量费用申请
orderApprovalDO
.
setType
(
expense_apply_BATCH
.
getValue
());
orderApprovalDO
.
setStatus
(
ApprovalResultStatusEnum
.
processing
.
getValue
());
orderApprovalDO
.
setFormId
(
bpmProcessId
);
orderApprovalService
.
save
(
orderApprovalDO
);
orderService
.
updateStatus
(
orderDO
.
getOrderId
(),
null
,
OrderStatusEnum
.
IN_WAREHOUSE
.
getValue
(),
null
,
OrderWarehouseInStatusEnum
.
order_merge_applying
.
getValue
(),
null
,
merge_order
.
getValue
(),
OrderApprovalTypeResultEnum
.
merge_order_processing
.
getDesc
());
}
}
}
private
void
checkOrderCanOut
(
List
<
String
>
orderNoList
)
{
private
void
checkOrderCanOut
(
List
<
String
>
orderNoList
)
{
...
@@ -185,8 +206,8 @@ public class MergeServiceImpl extends AbstractService<MergeMapper, MergeDO> impl
...
@@ -185,8 +206,8 @@ public class MergeServiceImpl extends AbstractService<MergeMapper, MergeDO> impl
long
count
=
orderList
.
stream
()
long
count
=
orderList
.
stream
()
.
filter
(
t
->
t
.
getAirShipment
()
>
1
)
.
filter
(
t
->
t
.
getAirShipment
()
>
1
)
.
count
();
.
count
();
if
(
count
>
0
)
{
if
(
count
>
0
)
{
throw
new
ServiceException
(
500
,
"订单已出,不能合
包
"
);
throw
new
ServiceException
(
500
,
"订单已出,不能合
单
"
);
}
}
}
}
...
@@ -247,13 +268,13 @@ public class MergeServiceImpl extends AbstractService<MergeMapper, MergeDO> impl
...
@@ -247,13 +268,13 @@ public class MergeServiceImpl extends AbstractService<MergeMapper, MergeDO> impl
if
(!
CollectionUtil
.
isEmpty
(
mergeDOS1
))
{
if
(!
CollectionUtil
.
isEmpty
(
mergeDOS1
))
{
map
.
put
(
"bpmProcessId"
,
mergeDOS1
.
get
(
0
).
getBpmProcessId
());
map
.
put
(
"bpmProcessId"
,
mergeDOS1
.
get
(
0
).
getBpmProcessId
());
}
}
OrderBackVO
applyOrder
=
orderQueryService
.
getOrder
(
orderService
.
selectOne
(
OrderDO:
:
getOrderNo
,
mergeDOS
.
get
(
0
).
getApplyOrderNo
()).
getOrderId
());
OrderBackVO
applyOrder
=
orderQueryService
.
getOrder
ByNo
(
mergeDOS
.
get
(
0
).
getApplyOrderNo
());
MergeBackVO
applyConvertor
=
MergeConvert
.
INSTANCE
.
convert
(
mergeDOS
.
get
(
0
));
MergeBackVO
applyConvertor
=
MergeConvert
.
INSTANCE
.
convert
(
mergeDOS
.
get
(
0
));
applyConvertor
.
setMergedOrder
(
applyOrder
);
applyConvertor
.
setMergedOrder
(
applyOrder
);
backVOList
.
add
(
applyConvertor
);
backVOList
.
add
(
applyConvertor
);
for
(
MergeDO
mergeDO
:
mergeDOS
)
{
for
(
MergeDO
mergeDO
:
mergeDOS
)
{
MergeBackVO
convert
=
MergeConvert
.
INSTANCE
.
convert
(
mergeDO
);
MergeBackVO
convert
=
MergeConvert
.
INSTANCE
.
convert
(
mergeDO
);
OrderBackVO
order
=
orderQueryService
.
getOrder
(
orderService
.
selectOne
(
OrderDO:
:
getOrderNo
,
mergeDO
.
getOrderNos
()).
getOrderId
());
OrderBackVO
order
=
orderQueryService
.
getOrder
ByNo
(
mergeDO
.
getOrderNos
());
convert
.
setMergedOrder
(
order
);
convert
.
setMergedOrder
(
order
);
backVOList
.
add
(
convert
);
backVOList
.
add
(
convert
);
}
}
...
@@ -274,9 +295,16 @@ public class MergeServiceImpl extends AbstractService<MergeMapper, MergeDO> impl
...
@@ -274,9 +295,16 @@ public class MergeServiceImpl extends AbstractService<MergeMapper, MergeDO> impl
@Override
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
updateOrderMergeResult
(
String
id
,
int
result
)
{
public
void
updateOrderMergeResult
(
String
id
,
int
result
)
{
MergeDO
mergeDO
=
mergeMapper
.
selectById
(
id
);
// 需要先更新订单合单审批信息
OrderApprovalQueryVO
query
=
new
OrderApprovalQueryVO
();
query
.
setFormId
(
mergeDO
.
getBpmProcessId
());
List
<
OrderApprovalDO
>
approvalDOList
=
orderApprovalService
.
getApprovalList
(
query
);
if
(
CollectionUtil
.
isNotEmpty
(
approvalDOList
))
{
orderApprovalService
.
updateBatchById
(
approvalDOList
.
stream
().
peek
(
it
->
it
.
setStatus
(
result
)).
collect
(
Collectors
.
toList
()));
}
//审批拒绝则修改所有流程编号一致的合单申请状态
//审批拒绝则修改所有流程编号一致的合单申请状态
if
(
result
==
3
)
{
if
(
result
==
3
)
{
MergeDO
mergeDO
=
mergeMapper
.
selectById
(
id
);
List
<
MergeDO
>
mergeDOS
=
mergeMapper
.
selectList
(
MergeDO:
:
getBpmProcessId
,
mergeDO
.
getBpmProcessId
());
List
<
MergeDO
>
mergeDOS
=
mergeMapper
.
selectList
(
MergeDO:
:
getBpmProcessId
,
mergeDO
.
getBpmProcessId
());
Integer
type
=
OrderApprovalTypeResultEnum
.
merge_order_reject
.
getType
();
Integer
type
=
OrderApprovalTypeResultEnum
.
merge_order_reject
.
getType
();
orderService
.
updateStatus
(
null
,
mergeDOS
.
get
(
0
).
getApplyOrderNo
(),
OrderStatusEnum
.
IN_WAREHOUSE
.
getValue
(),
null
,
OrderWarehouseInStatusEnum
.
warehouse_finished
.
getValue
(),
null
,
0
,
OrderApprovalTypeResultEnum
.
typeAndResultOf
(
type
,
3
).
getDesc
());
orderService
.
updateStatus
(
null
,
mergeDOS
.
get
(
0
).
getApplyOrderNo
(),
OrderStatusEnum
.
IN_WAREHOUSE
.
getValue
(),
null
,
OrderWarehouseInStatusEnum
.
warehouse_finished
.
getValue
(),
null
,
0
,
OrderApprovalTypeResultEnum
.
typeAndResultOf
(
type
,
3
).
getDesc
());
...
@@ -285,8 +313,8 @@ public class MergeServiceImpl extends AbstractService<MergeMapper, MergeDO> impl
...
@@ -285,8 +313,8 @@ public class MergeServiceImpl extends AbstractService<MergeMapper, MergeDO> impl
mergeMapper
.
updateById
(
mergeDO1
);
mergeMapper
.
updateById
(
mergeDO1
);
orderService
.
updateStatus
(
null
,
mergeDO1
.
getOrderNos
(),
OrderStatusEnum
.
IN_WAREHOUSE
.
getValue
(),
null
,
OrderWarehouseInStatusEnum
.
warehouse_finished
.
getValue
(),
null
,
0
,
OrderApprovalTypeResultEnum
.
typeAndResultOf
(
type
,
3
).
getDesc
());
orderService
.
updateStatus
(
null
,
mergeDO1
.
getOrderNos
(),
OrderStatusEnum
.
IN_WAREHOUSE
.
getValue
(),
null
,
OrderWarehouseInStatusEnum
.
warehouse_finished
.
getValue
(),
null
,
0
,
OrderApprovalTypeResultEnum
.
typeAndResultOf
(
type
,
3
).
getDesc
());
}
}
}
else
if
(
result
==
2
)
{
//审批通过,需考虑分多次提交的合单申请
}
else
if
(
result
==
2
)
{
MergeDO
mergeDO
=
mergeMapper
.
selectById
(
id
);
//审批通过,需考虑分多次提交的合单申请
List
<
MergeDO
>
mergeDOS
=
new
ArrayList
<>();
List
<
MergeDO
>
mergeDOS
=
new
ArrayList
<>();
if
(
mergeDO
.
getOrderNos
().
endsWith
(
"S"
)
||
mergeDO
.
getApplyOrderNo
().
endsWith
(
"S"
))
{
if
(
mergeDO
.
getOrderNos
().
endsWith
(
"S"
)
||
mergeDO
.
getApplyOrderNo
().
endsWith
(
"S"
))
{
mergeDOS
=
mergeMapper
.
selectList
(
new
LambdaQueryWrapperX
<
MergeDO
>()
mergeDOS
=
mergeMapper
.
selectList
(
new
LambdaQueryWrapperX
<
MergeDO
>()
...
@@ -379,7 +407,7 @@ public class MergeServiceImpl extends AbstractService<MergeMapper, MergeDO> impl
...
@@ -379,7 +407,7 @@ public class MergeServiceImpl extends AbstractService<MergeMapper, MergeDO> impl
orderService
.
updateStatus
(
null
,
orderNo
,
OrderStatusEnum
.
MERGED_ORDER
.
getValue
(),
null
,
OrderWarehouseInStatusEnum
.
order_merge_apply_finish
.
getValue
(),
null
,
0
,
OrderApprovalTypeResultEnum
.
typeAndResultOf
(
type
,
2
).
getDesc
());
orderService
.
updateStatus
(
null
,
orderNo
,
OrderStatusEnum
.
MERGED_ORDER
.
getValue
(),
null
,
OrderWarehouseInStatusEnum
.
order_merge_apply_finish
.
getValue
(),
null
,
0
,
OrderApprovalTypeResultEnum
.
typeAndResultOf
(
type
,
2
).
getDesc
());
receivableService
.
remove
(
new
LambdaQueryWrapperX
<
ReceivableDO
>().
eq
(
ReceivableDO:
:
getOrderId
,
orderDO1
.
getOrderId
()).
eq
(
ReceivableDO:
:
getFeeSource
,
1
));
receivableService
.
remove
(
new
LambdaQueryWrapperX
<
ReceivableDO
>().
eq
(
ReceivableDO:
:
getOrderId
,
orderDO1
.
getOrderId
()).
eq
(
ReceivableDO:
:
getFeeSource
,
1
));
//修改入仓数据
//修改入仓数据
orderWarehouseInList
.
addAll
(
orderWarehouseInService
.
selectList
(
OrderWarehouseInDO:
:
getOrderId
,
orderDO1
.
getOrderId
()));
orderWarehouseInList
.
addAll
(
orderWarehouseInService
.
selectList
(
OrderWarehouseInDO:
:
getOrderId
,
orderDO1
.
getOrderId
()));
specialNeedList
.
addAll
(
orderSpecialNeedService
.
getListByOrderId
(
orderDO1
.
getOrderId
()));
specialNeedList
.
addAll
(
orderSpecialNeedService
.
getListByOrderId
(
orderDO1
.
getOrderId
()));
feeApplicationList
.
addAll
(
orderFeeApplicationService
.
getFeeApplicationListByOrderId
(
orderDO1
.
getOrderId
()));
feeApplicationList
.
addAll
(
orderFeeApplicationService
.
getFeeApplicationListByOrderId
(
orderDO1
.
getOrderId
()));
orderLocationList
.
addAll
(
orderLocationService
.
getOrderLocationListByOrderId
(
orderDO1
.
getOrderId
()));
orderLocationList
.
addAll
(
orderLocationService
.
getOrderLocationListByOrderId
(
orderDO1
.
getOrderId
()));
...
@@ -516,13 +544,13 @@ public class MergeServiceImpl extends AbstractService<MergeMapper, MergeDO> impl
...
@@ -516,13 +544,13 @@ public class MergeServiceImpl extends AbstractService<MergeMapper, MergeDO> impl
List
<
Long
>
orderIds
=
new
ArrayList
<>();
List
<
Long
>
orderIds
=
new
ArrayList
<>();
String
applyOrderNo
=
""
;
String
applyOrderNo
=
""
;
Integer
type
=
OrderApprovalTypeResultEnum
.
merge_order_pass
.
getType
();
Integer
type
=
OrderApprovalTypeResultEnum
.
merge_order_pass
.
getType
();
List
<
OrderWarehouseInDO
>
orderWarehouseInList
=
orderWarehouseInService
.
selectList
(
OrderWarehouseInDO:
:
getOrderId
,
orderDO2
.
getOrderId
());
List
<
OrderWarehouseInDO
>
orderWarehouseInList
=
orderWarehouseInService
.
selectList
(
OrderWarehouseInDO:
:
getOrderId
,
orderDO2
.
getOrderId
());
List
<
OrderSpecialNeedDO
>
specialNeedList
=
orderSpecialNeedService
.
getListByOrderId
(
orderDO2
.
getOrderId
());
List
<
OrderSpecialNeedDO
>
specialNeedList
=
orderSpecialNeedService
.
getListByOrderId
(
orderDO2
.
getOrderId
());
List
<
OrderFeeApplicationDO
>
feeApplicationList
=
orderFeeApplicationService
.
getFeeApplicationListByOrderId
(
orderDO2
.
getOrderId
());
List
<
OrderFeeApplicationDO
>
feeApplicationList
=
orderFeeApplicationService
.
getFeeApplicationListByOrderId
(
orderDO2
.
getOrderId
());
List
<
OrderLocationDO
>
orderLocationList
=
orderLocationService
.
getOrderLocationListByOrderId
(
orderDO2
.
getOrderId
());
List
<
OrderLocationDO
>
orderLocationList
=
orderLocationService
.
getOrderLocationListByOrderId
(
orderDO2
.
getOrderId
());
List
<
OrderWarehousePictureDO
>
warehousePictureList
=
orderWarehousePictureService
.
selectList
(
new
LambdaQueryWrapper
<
OrderWarehousePictureDO
>()
List
<
OrderWarehousePictureDO
>
warehousePictureList
=
orderWarehousePictureService
.
selectList
(
new
LambdaQueryWrapper
<
OrderWarehousePictureDO
>()
.
eq
(
OrderWarehousePictureDO:
:
getType
,
5
)
.
eq
(
OrderWarehousePictureDO:
:
getType
,
5
)
.
in
(
OrderWarehousePictureDO:
:
getBizId
,
orderItemIds
)
.
in
(
OrderWarehousePictureDO:
:
getBizId
,
orderItemIds
)
);
);
//处理和原订单合并的其他订单的信息
//处理和原订单合并的其他订单的信息
for
(
MergeDO
mergeDO1
:
mergeDOList
)
{
for
(
MergeDO
mergeDO1
:
mergeDOList
)
{
...
@@ -570,7 +598,7 @@ public class MergeServiceImpl extends AbstractService<MergeMapper, MergeDO> impl
...
@@ -570,7 +598,7 @@ public class MergeServiceImpl extends AbstractService<MergeMapper, MergeDO> impl
applyOrderNo
=
mergeDO1
.
getApplyOrderNo
();
applyOrderNo
=
mergeDO1
.
getApplyOrderNo
();
receivableService
.
remove
(
new
LambdaQueryWrapperX
<
ReceivableDO
>().
eq
(
ReceivableDO:
:
getOrderId
,
orderDO1
.
getOrderId
()).
eq
(
ReceivableDO:
:
getFeeSource
,
1
));
receivableService
.
remove
(
new
LambdaQueryWrapperX
<
ReceivableDO
>().
eq
(
ReceivableDO:
:
getOrderId
,
orderDO1
.
getOrderId
()).
eq
(
ReceivableDO:
:
getFeeSource
,
1
));
//合并除订单外的其他数据 TODO 入仓数据怎么处理? 复制原来的加上订单id来新增?
//合并除订单外的其他数据 TODO 入仓数据怎么处理? 复制原来的加上订单id来新增?
orderWarehouseInList
.
addAll
(
orderWarehouseInService
.
selectList
(
OrderWarehouseInDO:
:
getOrderId
,
orderDO1
.
getOrderId
()));
orderWarehouseInList
.
addAll
(
orderWarehouseInService
.
selectList
(
OrderWarehouseInDO:
:
getOrderId
,
orderDO1
.
getOrderId
()));
specialNeedList
.
addAll
(
orderSpecialNeedService
.
getListByOrderId
(
orderDO1
.
getOrderId
()));
specialNeedList
.
addAll
(
orderSpecialNeedService
.
getListByOrderId
(
orderDO1
.
getOrderId
()));
feeApplicationList
.
addAll
(
orderFeeApplicationService
.
getFeeApplicationListByOrderId
(
orderDO1
.
getOrderId
()));
feeApplicationList
.
addAll
(
orderFeeApplicationService
.
getFeeApplicationListByOrderId
(
orderDO1
.
getOrderId
()));
orderLocationList
.
addAll
(
orderLocationService
.
getOrderLocationListByOrderId
(
orderDO1
.
getOrderId
()));
orderLocationList
.
addAll
(
orderLocationService
.
getOrderLocationListByOrderId
(
orderDO1
.
getOrderId
()));
...
@@ -648,15 +676,12 @@ public class MergeServiceImpl extends AbstractService<MergeMapper, MergeDO> impl
...
@@ -648,15 +676,12 @@ public class MergeServiceImpl extends AbstractService<MergeMapper, MergeDO> impl
// orderLocationService.insertBatch(orderLocationList);
// orderLocationService.insertBatch(orderLocationList);
}
}
}
else
if
(
result
==
4
)
{
}
else
if
(
result
==
4
)
{
MergeDO
mergeDO
=
mergeMapper
.
selectById
(
id
);
Integer
type
=
OrderApprovalTypeResultEnum
.
merge_order_cancel
.
getType
();
Integer
type
=
OrderApprovalTypeResultEnum
.
merge_order_cancel
.
getType
();
List
<
MergeDO
>
cancelList
=
mergeMapper
.
selectList
(
new
LambdaQueryWrapperX
<
MergeDO
>().
eq
(
MergeDO:
:
getBpmProcessId
,
mergeDO
.
getBpmProcessId
()).
eq
(
MergeDO:
:
getStatus
,
1
));
List
<
MergeDO
>
cancelList
=
mergeMapper
.
selectList
(
new
LambdaQueryWrapperX
<
MergeDO
>().
eq
(
MergeDO:
:
getBpmProcessId
,
mergeDO
.
getBpmProcessId
()).
eq
(
MergeDO:
:
getStatus
,
1
));
if
(
CollectionUtil
.
isNotEmpty
(
cancelList
))
{
if
(
CollectionUtil
.
isNotEmpty
(
cancelList
))
{
orderService
.
updateStatus
(
null
,
cancelList
.
get
(
0
).
getApplyOrderNo
(),
OrderStatusEnum
.
IN_WAREHOUSE
.
getValue
(),
null
,
OrderWarehouseInStatusEnum
.
warehouse_finished
.
getValue
(),
null
,
0
,
OrderApprovalTypeResultEnum
.
typeAndResultOf
(
type
,
4
).
getDesc
());
orderService
.
updateStatus
(
null
,
cancelList
.
get
(
0
).
getApplyOrderNo
(),
OrderStatusEnum
.
IN_WAREHOUSE
.
getValue
(),
null
,
OrderWarehouseInStatusEnum
.
warehouse_finished
.
getValue
(),
null
,
0
,
OrderApprovalTypeResultEnum
.
typeAndResultOf
(
type
,
4
).
getDesc
());
cancelList
.
stream
().
forEach
(
item
->
orderService
.
updateStatus
(
null
,
item
.
getOrderNos
(),
OrderStatusEnum
.
IN_WAREHOUSE
.
getValue
(),
null
,
OrderWarehouseInStatusEnum
.
warehouse_finished
.
getValue
(),
null
,
0
,
OrderApprovalTypeResultEnum
.
typeAndResultOf
(
type
,
4
).
getDesc
()));
cancelList
.
stream
().
forEach
(
item
->
orderService
.
updateStatus
(
null
,
item
.
getOrderNos
(),
OrderStatusEnum
.
IN_WAREHOUSE
.
getValue
(),
null
,
OrderWarehouseInStatusEnum
.
warehouse_finished
.
getValue
(),
null
,
0
,
OrderApprovalTypeResultEnum
.
typeAndResultOf
(
type
,
4
).
getDesc
()));
}
}
mergeMapper
.
delete
(
new
LambdaQueryWrapperX
<
MergeDO
>().
eq
(
MergeDO:
:
getBpmProcessId
,
mergeDO
.
getBpmProcessId
()));
mergeMapper
.
delete
(
new
LambdaQueryWrapperX
<
MergeDO
>().
eq
(
MergeDO:
:
getBpmProcessId
,
mergeDO
.
getBpmProcessId
()));
}
}
}
}
...
@@ -725,7 +750,7 @@ public class MergeServiceImpl extends AbstractService<MergeMapper, MergeDO> impl
...
@@ -725,7 +750,7 @@ public class MergeServiceImpl extends AbstractService<MergeMapper, MergeDO> impl
private
void
feeApplicationCreateReceivable
(
List
<
OrderFeeApplicationDO
>
batchFeeList
)
{
private
void
feeApplicationCreateReceivable
(
List
<
OrderFeeApplicationDO
>
batchFeeList
)
{
List
<
FeeDto
>
feeDtos
=
new
ArrayList
<>();
List
<
FeeDto
>
feeDtos
=
new
ArrayList
<>();
if
(
CollectionUtil
.
isNotEmpty
(
batchFeeList
))
{
if
(
CollectionUtil
.
isNotEmpty
(
batchFeeList
))
{
OrderDO
order
=
orderService
.
selectOne
(
OrderDO:
:
getOrderId
,
batchFeeList
.
get
(
0
).
getOrderId
());
OrderDO
order
=
orderService
.
selectOne
(
OrderDO:
:
getOrderId
,
batchFeeList
.
get
(
0
).
getOrderId
());
for
(
OrderFeeApplicationDO
feeApplicationDO
:
batchFeeList
)
{
for
(
OrderFeeApplicationDO
feeApplicationDO
:
batchFeeList
)
{
//生成应收
//生成应收
DictDataRespDTO
dictDto
=
DictFrameworkUtils
.
getDictDataFromCache
(
"receivable_fee_type"
,
String
.
valueOf
(
feeApplicationDO
.
getFeeType
()));
DictDataRespDTO
dictDto
=
DictFrameworkUtils
.
getDictDataFromCache
(
"receivable_fee_type"
,
String
.
valueOf
(
feeApplicationDO
.
getFeeType
()));
...
...
yudao-module-order/yudao-module-order-core/src/main/java/cn/iocoder/yudao/module/order/service/order/OrderQueryService.java
View file @
5ec19d6c
...
@@ -8,6 +8,7 @@ import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileDO;
...
@@ -8,6 +8,7 @@ import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileDO;
import
cn.iocoder.yudao.module.order.dal.dataobject.order.OrderDO
;
import
cn.iocoder.yudao.module.order.dal.dataobject.order.OrderDO
;
import
cn.iocoder.yudao.module.order.dal.dataobject.orderItem.OrderItemDO
;
import
cn.iocoder.yudao.module.order.dal.dataobject.orderItem.OrderItemDO
;
import
cn.iocoder.yudao.module.order.dto.*
;
import
cn.iocoder.yudao.module.order.dto.*
;
import
cn.iocoder.yudao.module.order.enums.OrderApprovalTypeEnum
;
import
cn.iocoder.yudao.module.order.vo.approval.OrderApprovalHeadBaseVO
;
import
cn.iocoder.yudao.module.order.vo.approval.OrderApprovalHeadBaseVO
;
import
cn.iocoder.yudao.module.order.vo.approval.OrderSpecialApplyVO
;
import
cn.iocoder.yudao.module.order.vo.approval.OrderSpecialApplyVO
;
import
cn.iocoder.yudao.module.order.vo.approval.OrderSpecialBatchApplyVO
;
import
cn.iocoder.yudao.module.order.vo.approval.OrderSpecialBatchApplyVO
;
...
@@ -37,6 +38,7 @@ public interface OrderQueryService {
...
@@ -37,6 +38,7 @@ public interface OrderQueryService {
* @return 订单
* @return 订单
*/
*/
OrderBackVO
getOrder
(
Long
orderId
);
OrderBackVO
getOrder
(
Long
orderId
);
OrderBackVO
getOrderByNo
(
String
orderNo
);
OrderBackVO
getParentOrder
(
Long
orderId
);
OrderBackVO
getParentOrder
(
Long
orderId
);
...
@@ -296,7 +298,7 @@ public interface OrderQueryService {
...
@@ -296,7 +298,7 @@ public interface OrderQueryService {
*
*
* @param orderId 订单id
* @param orderId 订单id
*/
*/
void
throwProcessingApproval
(
Long
orderId
);
void
throwProcessingApproval
(
Long
orderId
,
OrderApprovalTypeEnum
approvalTypeEnum
);
/**
/**
...
...
yudao-module-order/yudao-module-order-core/src/main/java/cn/iocoder/yudao/module/order/service/order/impl/OrderQueryServiceImpl.java
View file @
5ec19d6c
...
@@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.order.service.order.impl;
...
@@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.order.service.order.impl;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.io.FileUtil
;
import
cn.hutool.core.io.FileUtil
;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.core.util.StrUtil
;
import
cn.iocoder.yudao.framework.apollo.core.event.Order.OrderApprovalTypeCheckEvent
;
import
cn.iocoder.yudao.framework.common.util.spring.enums.UserTypeEnum
;
import
cn.iocoder.yudao.framework.common.util.spring.enums.UserTypeEnum
;
import
cn.iocoder.yudao.framework.common.exception.ServiceException
;
import
cn.iocoder.yudao.framework.common.exception.ServiceException
;
import
cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants
;
import
cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants
;
...
@@ -104,6 +105,7 @@ import org.apache.commons.collections.CollectionUtils;
...
@@ -104,6 +105,7 @@ import org.apache.commons.collections.CollectionUtils;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.jetbrains.annotations.NotNull
;
import
org.jetbrains.annotations.NotNull
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.validation.annotation.Validated
;
...
@@ -124,6 +126,7 @@ import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionU
...
@@ -124,6 +126,7 @@ import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionU
import
static
cn
.
iocoder
.
yudao
.
framework
.
excel
.
constant
.
ExportConstant
.*;
import
static
cn
.
iocoder
.
yudao
.
framework
.
excel
.
constant
.
ExportConstant
.*;
import
static
cn
.
iocoder
.
yudao
.
module
.
order
.
enums
.
ErrorCodeConstants
.*;
import
static
cn
.
iocoder
.
yudao
.
module
.
order
.
enums
.
ErrorCodeConstants
.*;
import
static
cn
.
iocoder
.
yudao
.
module
.
order
.
enums
.
OrderApprovalTypeEnum
.
ORDER_UPDATE
;
import
static
cn
.
iocoder
.
yudao
.
module
.
order
.
enums
.
OrderApprovalTypeEnum
.
ORDER_UPDATE
;
import
static
cn
.
iocoder
.
yudao
.
module
.
order
.
enums
.
OrderApprovalTypeEnum
.
merge_order
;
import
static
cn
.
iocoder
.
yudao
.
module
.
product
.
enums
.
ErrorCodeConstants
.
NOT_FIND_CURRENCY
;
import
static
cn
.
iocoder
.
yudao
.
module
.
product
.
enums
.
ErrorCodeConstants
.
NOT_FIND_CURRENCY
;
/**
/**
...
@@ -154,6 +157,7 @@ public class OrderQueryServiceImpl implements OrderQueryService {
...
@@ -154,6 +157,7 @@ public class OrderQueryServiceImpl implements OrderQueryService {
private
final
AdminUserApi
adminUserApi
;
private
final
AdminUserApi
adminUserApi
;
private
final
ReceiptService
receiptService
;
private
final
ReceiptService
receiptService
;
private
final
CurrencyApi
currencyApi
;
private
final
CurrencyApi
currencyApi
;
private
final
ApplicationContext
applicationContext
;
private
final
UserCardAuthService
userCardAuthService
;
private
final
UserCardAuthService
userCardAuthService
;
...
@@ -161,7 +165,6 @@ public class OrderQueryServiceImpl implements OrderQueryService {
...
@@ -161,7 +165,6 @@ public class OrderQueryServiceImpl implements OrderQueryService {
private
final
OrderWarehousePictureService
orderWarehousePictureService
;
private
final
OrderWarehousePictureService
orderWarehousePictureService
;
private
final
OrderItemPackLogMapper
itemPackLogMapper
;
private
final
OrderWarehouseInMapper
orderWarehouseInMapper
;
private
final
OrderWarehouseInMapper
orderWarehouseInMapper
;
...
@@ -520,6 +523,72 @@ public class OrderQueryServiceImpl implements OrderQueryService {
...
@@ -520,6 +523,72 @@ public class OrderQueryServiceImpl implements OrderQueryService {
return
backVO
;
return
backVO
;
}
}
@Override
public
OrderBackVO
getOrderByNo
(
String
orderNo
)
{
OrderDO
orderDO
=
orderMapper
.
selectOne
(
new
LambdaQueryWrapper
<
OrderDO
>().
eq
(
OrderDO:
:
getOrderNo
,
orderNo
).
last
(
"limit 1"
));
if
(
Objects
.
isNull
(
orderDO
))
{
throw
exception
(
ORDER_NOT_EXISTS
);
}
OrderBackVO
backVO
=
OrderConvert
.
INSTANCE
.
convert
(
orderDO
);
if
(
StringUtils
.
isNotBlank
(
backVO
.
getExternalWarehouseJson
()))
{
backVO
.
setExternalWarehouseDtoList
(
JSONObject
.
parseArray
(
backVO
.
getExternalWarehouseJson
(),
ExternalWarehouseDto
.
class
));
}
// 发货人信息
OrderConsignorDO
orderConsignorDO
=
orderConsignorService
.
getOne
(
new
LambdaQueryWrapper
<
OrderConsignorDO
>().
eq
(
OrderConsignorDO:
:
getOrderId
,
orderDO
.
getOrderId
()).
orderByDesc
(
OrderConsignorDO:
:
getId
).
last
(
"limit 1"
));
// if (Objects.isNull(orderConsignorDO)) {
// throw exception(ORDER_CONSIGNOR_NOT_EXISTS);
// }
if
(
Objects
.
nonNull
(
orderConsignorDO
))
{
backVO
.
setConsignorVO
(
OrderConsignorConvert
.
INSTANCE
.
convert
(
orderConsignorDO
));
backVO
.
setConsignorId
(
orderConsignorDO
.
getCustomerId
());
backVO
.
setConsignorContactsId
(
orderConsignorDO
.
getCustomerContactsId
());
}
// 收货人信息
OrderConsigneeDO
orderConsigneeDO
=
orderConsigneeService
.
getOne
(
new
LambdaQueryWrapper
<
OrderConsigneeDO
>().
eq
(
OrderConsigneeDO:
:
getOrderId
,
orderDO
.
getOrderId
()).
orderByDesc
(
OrderConsigneeDO:
:
getId
).
last
(
"limit 1"
));
// if (Objects.isNull(orderConsigneeDO)) {
// throw exception(ORDER_CONSIGNEE_NOT_EXISTS);
// }
if
(
Objects
.
nonNull
(
orderConsigneeDO
))
{
backVO
.
setConsigneeVO
(
OrderConsigneeConvert
.
INSTANCE
.
convert
(
orderConsigneeDO
));
backVO
.
setConsigneeId
(
orderConsigneeDO
.
getCustomerId
());
backVO
.
setConsigneeContactsId
(
orderConsigneeDO
.
getCustomerContactsId
());
backVO
.
setConsigneeAddress
(
orderConsigneeDO
.
getAddress
());
backVO
.
setHarvestMethod
(
orderConsigneeDO
.
getHarvestMethod
());
backVO
.
setCity
(
orderConsigneeDO
.
getCity
());
backVO
.
setProvince
(
orderConsigneeDO
.
getProvince
());
backVO
.
setCountry
(
orderConsigneeDO
.
getCountry
());
}
// 始发地
OrderDepartureDO
orderDepartureDO
=
orderDepartureService
.
getOne
(
new
LambdaQueryWrapper
<
OrderDepartureDO
>().
eq
(
OrderDepartureDO:
:
getOrderId
,
orderDO
.
getOrderId
()).
orderByDesc
(
OrderDepartureDO:
:
getId
).
last
(
"limit 1"
));
backVO
.
setOrderDepartureVO
(
OrderDepartureConvert
.
INSTANCE
.
convert
(
orderDepartureDO
));
backVO
.
setDepartureId
(
orderDepartureDO
.
getDepartureId
());
// 目的地
OrderObjectiveDO
orderObjectiveDO
=
orderObjectiveService
.
getOne
(
new
LambdaQueryWrapper
<
OrderObjectiveDO
>().
eq
(
OrderObjectiveDO:
:
getOrderId
,
orderDO
.
getOrderId
()).
orderByDesc
(
OrderObjectiveDO:
:
getId
).
last
(
"limit 1"
));
backVO
.
setOrderObjectiveVO
(
OrderObjectiveConvert
.
INSTANCE
.
convert
(
orderObjectiveDO
));
backVO
.
setObjectiveId
(
orderObjectiveDO
.
getObjectiveId
());
// 商品信息
List
<
OrderItemDO
>
itemDOList
=
orderItemMapper
.
selectList
(
new
LambdaQueryWrapper
<
OrderItemDO
>().
eq
(
OrderItemDO:
:
getOrderId
,
orderDO
.
getOrderId
()).
orderByDesc
(
OrderItemDO:
:
getOrderItemId
));
if
(
CollectionUtil
.
isNotEmpty
(
itemDOList
))
{
backVO
.
setOrderItemVOList
(
OrderItemConvert
.
INSTANCE
.
convertList
(
itemDOList
));
}
// 物流信息查询
LogisticsInfoDto
logisticsInfoDto
=
warehouseLineMapper
.
getStartInfoAndDestInfoByLineId
(
backVO
.
getLineId
());
if
(
Objects
.
isNull
(
logisticsInfoDto
))
{
throw
exception
(
NOT_FIND_LOGISTICS_INFO
);
}
logisticsInfoDto
.
setLineId
(
backVO
.
getLineId
());
logisticsInfoDto
.
setTransportId
(
backVO
.
getTransportId
());
logisticsInfoDto
.
setChannelId
(
backVO
.
getChannelId
());
backVO
.
setLogisticsInfoDto
(
logisticsInfoDto
);
// if (backVO.getOrderNo().startsWith("DRAFT")) {
// backVO.setOrderNo("");
// }
return
backVO
;
}
@Override
@Override
public
OrderBackVO
getParentOrder
(
Long
orderId
)
{
public
OrderBackVO
getParentOrder
(
Long
orderId
)
{
// TODO 后面可以在订单列表返回初始母订单id,前端可以直接通过初始母订单id查询订单详情
// TODO 后面可以在订单列表返回初始母订单id,前端可以直接通过初始母订单id查询订单详情
...
@@ -1542,7 +1611,6 @@ public class OrderQueryServiceImpl implements OrderQueryService {
...
@@ -1542,7 +1611,6 @@ public class OrderQueryServiceImpl implements OrderQueryService {
@Override
@Override
public
void
throwPendingExceptionOrProcessingApproval
(
Long
orderId
)
{
public
void
throwPendingExceptionOrProcessingApproval
(
Long
orderId
)
{
OrderDO
orderDO
=
orderMapper
.
selectById
(
orderId
);
OrderDO
orderDO
=
orderMapper
.
selectById
(
orderId
);
if
(
orderDO
==
null
)
{
if
(
orderDO
==
null
)
{
throw
exception
(
ORDER_NOT_EXISTS
);
throw
exception
(
ORDER_NOT_EXISTS
);
...
@@ -1556,16 +1624,18 @@ public class OrderQueryServiceImpl implements OrderQueryService {
...
@@ -1556,16 +1624,18 @@ public class OrderQueryServiceImpl implements OrderQueryService {
}
}
//判断未处理审核
//判断未处理审核
this
.
throwProcessingApproval
(
orderId
);
//
this.throwProcessingApproval(orderId);
}
}
@Override
@Override
public
void
throwProcessingApproval
(
Long
orderId
)
{
public
void
throwProcessingApproval
(
Long
orderId
,
OrderApprovalTypeEnum
approvalTypeEnum
)
{
OrderDO
orderDO
=
orderMapper
.
selectById
(
orderId
);
OrderDO
orderDO
=
orderMapper
.
selectById
(
orderId
);
if
(
orderDO
==
null
)
{
if
(
orderDO
==
null
)
{
throw
exception
(
ORDER_NOT_EXISTS
);
throw
exception
(
ORDER_NOT_EXISTS
);
}
}
if
(
orderDO
.
getAuditType
()
!=
0
)
{
OrderApprovalTypeCheckEvent
approvalTypeCheckEvent
=
new
OrderApprovalTypeCheckEvent
(
orderDO
.
getOrderId
(),
null
,
approvalTypeEnum
.
getValue
(),
null
,
false
);
applicationContext
.
publishEvent
(
approvalTypeCheckEvent
);
if
(
approvalTypeCheckEvent
.
getResult
())
{
throw
exception
(
ORDER_HAS_PROCESSING_APPROVAL
,
orderDO
.
getOrderNo
());
throw
exception
(
ORDER_HAS_PROCESSING_APPROVAL
,
orderDO
.
getOrderNo
());
}
}
}
}
...
...
yudao-module-order/yudao-module-order-core/src/main/java/cn/iocoder/yudao/module/order/service/orderSplit/OrderSplitServiceImpl.java
View file @
5ec19d6c
...
@@ -175,20 +175,23 @@ public class OrderSplitServiceImpl extends AbstractService<OrderSplitMapper, Ord
...
@@ -175,20 +175,23 @@ public class OrderSplitServiceImpl extends AbstractService<OrderSplitMapper, Ord
public
Boolean
createSplit
(
OrderSplitCreateReqVO
createReqVO
)
{
public
Boolean
createSplit
(
OrderSplitCreateReqVO
createReqVO
)
{
String
parentOrderNo
=
createReqVO
.
getParentOrderNo
();
String
parentOrderNo
=
createReqVO
.
getParentOrderNo
();
Long
parentOrderId
=
createReqVO
.
getParentOrderId
();
Long
parentOrderId
=
createReqVO
.
getParentOrderId
();
//草稿不可拆单
OrderDO
orderDO
=
orderService
.
getById
(
parentOrderId
);
if
(
orderDO
==
null
)
{
throw
exception
(
ORDER_NOT_EXISTS
);
}
if
(
OrderStatusEnum
.
DRAFT
.
getValue
().
equals
(
orderDO
.
getStatus
()))
{
throw
exception
(
ORDER_DRAFT_STATUS_NOT_ALLOWED_SPLIT
);
}
//该订单是否有待处理异常或待处理审核则抛出异常
//该订单是否有待处理异常或待处理审核则抛出异常
orderQueryService
.
throwPendingExceptionOrProcessingApproval
(
parentOrderId
);
if
(
orderDO
.
getAbnormalState
()
!=
0
)
{
throw
exception
(
ORDER_HAS_PENDING_EXCEPTION
,
orderDO
.
getOrderNo
());
}
//出货拆单不需要校验
//出货拆单不需要校验
if
(
createReqVO
.
isCheckOrderScheduling
())
{
if
(
createReqVO
.
isCheckOrderScheduling
())
{
applicationContext
.
publishEvent
(
new
BoxCheckOrderSchedulingEvent
(
parentOrderId
));
applicationContext
.
publishEvent
(
new
BoxCheckOrderSchedulingEvent
(
parentOrderId
));
}
}
//草稿不可拆单
OrderDO
orderDO
=
orderService
.
getById
(
parentOrderId
);
if
(
OrderStatusEnum
.
DRAFT
.
getValue
().
equals
(
orderDO
.
getStatus
()))
{
throw
exception
(
ORDER_DRAFT_STATUS_NOT_ALLOWED_SPLIT
);
}
if
(
orderDO
.
getTransportId
()
==
4
&&
OrderStatusEnum
.
IN_WAREHOUSE
.
getValue
().
equals
(
orderDO
.
getStatus
())
&&
orderDO
.
getAirShipment
()
==
2
)
{
if
(
orderDO
.
getTransportId
()
==
4
&&
OrderStatusEnum
.
IN_WAREHOUSE
.
getValue
().
equals
(
orderDO
.
getStatus
())
&&
orderDO
.
getAirShipment
()
==
2
)
{
throw
exception
(
AIR_ORDER_IS_CONFIRM_CAN_NOT_SPLIT
);
throw
exception
(
AIR_ORDER_IS_CONFIRM_CAN_NOT_SPLIT
);
}
}
...
@@ -591,15 +594,17 @@ public class OrderSplitServiceImpl extends AbstractService<OrderSplitMapper, Ord
...
@@ -591,15 +594,17 @@ public class OrderSplitServiceImpl extends AbstractService<OrderSplitMapper, Ord
Long
orderId
=
applyReqVO
.
getOrderId
();
Long
orderId
=
applyReqVO
.
getOrderId
();
//该订单是否有待处理异常或待处理审核则抛出异常
orderQueryService
.
throwPendingExceptionOrProcessingApproval
(
orderId
);
//草稿不可拆单
//草稿不可拆单
OrderDO
orderDO
=
orderService
.
getById
(
orderId
);
OrderDO
orderDO
=
orderService
.
getById
(
orderId
);
if
(
orderDO
==
null
)
{
throw
exception
(
ORDER_NOT_EXISTS
);
}
if
(
OrderStatusEnum
.
DRAFT
.
getValue
().
equals
(
orderDO
.
getStatus
()))
{
if
(
OrderStatusEnum
.
DRAFT
.
getValue
().
equals
(
orderDO
.
getStatus
()))
{
throw
exception
(
ORDER_DRAFT_STATUS_NOT_ALLOWED_SPLIT
);
throw
exception
(
ORDER_DRAFT_STATUS_NOT_ALLOWED_SPLIT
);
}
}
if
(
orderDO
.
getAbnormalState
()
!=
0
)
{
throw
exception
(
ORDER_HAS_PENDING_EXCEPTION
,
orderDO
.
getOrderNo
());
}
//出货拆单不需要校验
//出货拆单不需要校验
if
(
applyReqVO
.
isCheckOrderScheduling
())
{
if
(
applyReqVO
.
isCheckOrderScheduling
())
{
applicationContext
.
publishEvent
(
new
BoxCheckOrderSchedulingEvent
(
orderId
));
applicationContext
.
publishEvent
(
new
BoxCheckOrderSchedulingEvent
(
orderId
));
...
...
yudao-module-order/yudao-module-order-core/src/main/java/cn/iocoder/yudao/module/order/service/orderWarehouseAdjust/OrderWarehouseAdjustServiceImpl.java
View file @
5ec19d6c
...
@@ -140,8 +140,12 @@ public class OrderWarehouseAdjustServiceImpl extends AbstractService<OrderWareho
...
@@ -140,8 +140,12 @@ public class OrderWarehouseAdjustServiceImpl extends AbstractService<OrderWareho
adjustDirectList
.
add
(
orderId
);
adjustDirectList
.
add
(
orderId
);
}
}
}
}
orderQueryService
.
throwPendingExceptionOrProcessingApproval
(
orderId
);
if
(
orderDO
==
null
)
{
throw
exception
(
ORDER_NOT_EXISTS
);
}
if
(
orderDO
.
getAbnormalState
()
!=
0
)
{
throw
exception
(
ORDER_HAS_PENDING_EXCEPTION
,
orderDO
.
getOrderNo
());
}
OrderApprovalTypeCheckEvent
approvalTypeCheckEvent
=
new
OrderApprovalTypeCheckEvent
(
orderDO
.
getOrderId
(),
null
,
WAREHOUSE_ADJUST
.
getValue
(),
null
,
false
);
OrderApprovalTypeCheckEvent
approvalTypeCheckEvent
=
new
OrderApprovalTypeCheckEvent
(
orderDO
.
getOrderId
(),
null
,
WAREHOUSE_ADJUST
.
getValue
(),
null
,
false
);
applicationContext
.
publishEvent
(
approvalTypeCheckEvent
);
applicationContext
.
publishEvent
(
approvalTypeCheckEvent
);
if
(
approvalTypeCheckEvent
.
getResult
())
{
if
(
approvalTypeCheckEvent
.
getResult
())
{
...
...
yudao-module-order/yudao-module-order-core/src/main/java/cn/iocoder/yudao/module/order/service/orderWarehouseIn/OrderWarehouseInServiceImpl.java
View file @
5ec19d6c
...
@@ -133,8 +133,7 @@ import java.util.stream.Collectors;
...
@@ -133,8 +133,7 @@ import java.util.stream.Collectors;
import
static
cn
.
iocoder
.
yudao
.
framework
.
apollo
.
core
.
constants
.
Constants
.
NOT_ACCEPTED_PROD_CODE
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
apollo
.
core
.
constants
.
Constants
.
NOT_ACCEPTED_PROD_CODE
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
common
.
exception
.
util
.
ServiceExceptionUtil
.
exception
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
common
.
exception
.
util
.
ServiceExceptionUtil
.
exception
;
import
static
cn
.
iocoder
.
yudao
.
module
.
order
.
enums
.
ErrorCodeConstants
.*;
import
static
cn
.
iocoder
.
yudao
.
module
.
order
.
enums
.
ErrorCodeConstants
.*;
import
static
cn
.
iocoder
.
yudao
.
module
.
order
.
enums
.
OrderApprovalTypeEnum
.
WAREHOUSE_ADJUST
;
import
static
cn
.
iocoder
.
yudao
.
module
.
order
.
enums
.
OrderApprovalTypeEnum
.*;
import
static
cn
.
iocoder
.
yudao
.
module
.
order
.
enums
.
OrderApprovalTypeEnum
.
WAREHOUSE_UPDATE
;
import
static
cn
.
iocoder
.
yudao
.
module
.
wealth
.
enums
.
ErrorCodeConstants
.
RECEIVABLE_WRITE_OFF_ING_NO_NEED_TO_PACK
;
import
static
cn
.
iocoder
.
yudao
.
module
.
wealth
.
enums
.
ErrorCodeConstants
.
RECEIVABLE_WRITE_OFF_ING_NO_NEED_TO_PACK
;
/**
/**
...
@@ -2885,7 +2884,7 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
...
@@ -2885,7 +2884,7 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
else
{
else
{
//完成入仓之后修改信息才发起审批流程
//完成入仓之后修改信息才发起审批流程
// 需要提交审批,则不能有其他任何审批
// 需要提交审批,则不能有其他任何审批
orderQueryService
.
throwProcessingApproval
(
orderId
);
orderQueryService
.
throwProcessingApproval
(
orderId
,
WAREHOUSE_UPDATE
);
if
(
orderQueryService
.
isSplitOrderChildren
(
orderDO
))
{
if
(
orderQueryService
.
isSplitOrderChildren
(
orderDO
))
{
int
sumOld
=
orderWarehouseInListOld
.
stream
().
mapToInt
(
OrderWarehouseInDO:
:
getCartonsNum
).
sum
();
int
sumOld
=
orderWarehouseInListOld
.
stream
().
mapToInt
(
OrderWarehouseInDO:
:
getCartonsNum
).
sum
();
...
@@ -4221,7 +4220,7 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
...
@@ -4221,7 +4220,7 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
applicationContext
.
publishEvent
(
new
BoxCheckOrderSchedulingEvent
(
orderId
));
applicationContext
.
publishEvent
(
new
BoxCheckOrderSchedulingEvent
(
orderId
));
// 判断是否有未处理的审核单
// 判断是否有未处理的审核单
orderQueryService
.
throwProcessingApproval
(
orderId
);
orderQueryService
.
throwProcessingApproval
(
orderId
,
WAREHOUSE_ROLLBACK
);
String
orderNo
=
orderWarehouseInRollbackApplyReqVO
.
getOrderNo
();
String
orderNo
=
orderWarehouseInRollbackApplyReqVO
.
getOrderNo
();
OrderWarehouseApprovalDO
orderWarehouseApprovalDO
=
OrderWarehouseApprovalDO
.
builder
()
OrderWarehouseApprovalDO
orderWarehouseApprovalDO
=
OrderWarehouseApprovalDO
.
builder
()
...
...
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