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
Expand all
Hide 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
This diff is collapsed.
Click to expand it.
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;
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.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.OrderSpecialApplyVO
;
import
cn.iocoder.yudao.module.order.vo.approval.OrderSpecialBatchApplyVO
;
...
...
@@ -37,6 +38,7 @@ public interface OrderQueryService {
* @return 订单
*/
OrderBackVO
getOrder
(
Long
orderId
);
OrderBackVO
getOrderByNo
(
String
orderNo
);
OrderBackVO
getParentOrder
(
Long
orderId
);
...
...
@@ -296,7 +298,7 @@ public interface OrderQueryService {
*
* @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;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.io.FileUtil
;
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.exception.ServiceException
;
import
cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants
;
...
...
@@ -104,6 +105,7 @@ import org.apache.commons.collections.CollectionUtils;
import
org.apache.commons.lang3.StringUtils
;
import
org.jetbrains.annotations.NotNull
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.stereotype.Service
;
import
org.springframework.validation.annotation.Validated
;
...
...
@@ -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
.
module
.
order
.
enums
.
ErrorCodeConstants
.*;
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
;
/**
...
...
@@ -154,6 +157,7 @@ public class OrderQueryServiceImpl implements OrderQueryService {
private
final
AdminUserApi
adminUserApi
;
private
final
ReceiptService
receiptService
;
private
final
CurrencyApi
currencyApi
;
private
final
ApplicationContext
applicationContext
;
private
final
UserCardAuthService
userCardAuthService
;
...
...
@@ -161,7 +165,6 @@ public class OrderQueryServiceImpl implements OrderQueryService {
private
final
OrderWarehousePictureService
orderWarehousePictureService
;
private
final
OrderItemPackLogMapper
itemPackLogMapper
;
private
final
OrderWarehouseInMapper
orderWarehouseInMapper
;
...
...
@@ -520,6 +523,72 @@ public class OrderQueryServiceImpl implements OrderQueryService {
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
public
OrderBackVO
getParentOrder
(
Long
orderId
)
{
// TODO 后面可以在订单列表返回初始母订单id,前端可以直接通过初始母订单id查询订单详情
...
...
@@ -1542,7 +1611,6 @@ public class OrderQueryServiceImpl implements OrderQueryService {
@Override
public
void
throwPendingExceptionOrProcessingApproval
(
Long
orderId
)
{
OrderDO
orderDO
=
orderMapper
.
selectById
(
orderId
);
if
(
orderDO
==
null
)
{
throw
exception
(
ORDER_NOT_EXISTS
);
...
...
@@ -1556,16 +1624,18 @@ public class OrderQueryServiceImpl implements OrderQueryService {
}
//判断未处理审核
this
.
throwProcessingApproval
(
orderId
);
//
this.throwProcessingApproval(orderId);
}
@Override
public
void
throwProcessingApproval
(
Long
orderId
)
{
public
void
throwProcessingApproval
(
Long
orderId
,
OrderApprovalTypeEnum
approvalTypeEnum
)
{
OrderDO
orderDO
=
orderMapper
.
selectById
(
orderId
);
if
(
orderDO
==
null
)
{
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
());
}
}
...
...
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
public
Boolean
createSplit
(
OrderSplitCreateReqVO
createReqVO
)
{
String
parentOrderNo
=
createReqVO
.
getParentOrderNo
();
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
())
{
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
)
{
throw
exception
(
AIR_ORDER_IS_CONFIRM_CAN_NOT_SPLIT
);
}
...
...
@@ -591,15 +594,17 @@ public class OrderSplitServiceImpl extends AbstractService<OrderSplitMapper, Ord
Long
orderId
=
applyReqVO
.
getOrderId
();
//该订单是否有待处理异常或待处理审核则抛出异常
orderQueryService
.
throwPendingExceptionOrProcessingApproval
(
orderId
);
//草稿不可拆单
OrderDO
orderDO
=
orderService
.
getById
(
orderId
);
if
(
orderDO
==
null
)
{
throw
exception
(
ORDER_NOT_EXISTS
);
}
if
(
OrderStatusEnum
.
DRAFT
.
getValue
().
equals
(
orderDO
.
getStatus
()))
{
throw
exception
(
ORDER_DRAFT_STATUS_NOT_ALLOWED_SPLIT
);
}
if
(
orderDO
.
getAbnormalState
()
!=
0
)
{
throw
exception
(
ORDER_HAS_PENDING_EXCEPTION
,
orderDO
.
getOrderNo
());
}
//出货拆单不需要校验
if
(
applyReqVO
.
isCheckOrderScheduling
())
{
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
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
);
applicationContext
.
publishEvent
(
approvalTypeCheckEvent
);
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;
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
.
module
.
order
.
enums
.
ErrorCodeConstants
.*;
import
static
cn
.
iocoder
.
yudao
.
module
.
order
.
enums
.
OrderApprovalTypeEnum
.
WAREHOUSE_ADJUST
;
import
static
cn
.
iocoder
.
yudao
.
module
.
order
.
enums
.
OrderApprovalTypeEnum
.
WAREHOUSE_UPDATE
;
import
static
cn
.
iocoder
.
yudao
.
module
.
order
.
enums
.
OrderApprovalTypeEnum
.*;
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
else
{
//完成入仓之后修改信息才发起审批流程
// 需要提交审批,则不能有其他任何审批
orderQueryService
.
throwProcessingApproval
(
orderId
);
orderQueryService
.
throwProcessingApproval
(
orderId
,
WAREHOUSE_UPDATE
);
if
(
orderQueryService
.
isSplitOrderChildren
(
orderDO
))
{
int
sumOld
=
orderWarehouseInListOld
.
stream
().
mapToInt
(
OrderWarehouseInDO:
:
getCartonsNum
).
sum
();
...
...
@@ -4221,7 +4220,7 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
applicationContext
.
publishEvent
(
new
BoxCheckOrderSchedulingEvent
(
orderId
));
// 判断是否有未处理的审核单
orderQueryService
.
throwProcessingApproval
(
orderId
);
orderQueryService
.
throwProcessingApproval
(
orderId
,
WAREHOUSE_ROLLBACK
);
String
orderNo
=
orderWarehouseInRollbackApplyReqVO
.
getOrderNo
();
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