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
9a1b39fb
Commit
9a1b39fb
authored
Oct 31, 2024
by
332784038@qq.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
校验订单审批业务互斥逻辑业务提供前端校验接口
parent
53b1aa90
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
6 deletions
+45
-6
OrderApprovalTypeCheckListener.java
...module/order/listener/OrderApprovalTypeCheckListener.java
+8
-6
OrderController.java
.../module/order/controller/admin/order/OrderController.java
+37
-0
No files found.
yudao-module-order/yudao-module-order-core/src/main/java/cn/iocoder/yudao/module/order/listener/OrderApprovalTypeCheckListener.java
View file @
9a1b39fb
...
...
@@ -8,6 +8,7 @@ import lombok.extern.slf4j.Slf4j;
import
org.springframework.context.event.EventListener
;
import
org.springframework.stereotype.Component
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Objects
;
...
...
@@ -37,15 +38,16 @@ public class OrderApprovalTypeCheckListener {
event
.
setResult
(
Boolean
.
FALSE
);
return
;
}
if
(
types
.
contains
(-
1
)){
// 包含负一则表示订单不能有任何审批状态存在
types
=
null
;
}
else
{
types
.
add
(
event
.
getApprovalType
());
// 枚举配置中的互斥类型集合不能添加新值,这里需要重新定义新集合补充当前审批类型进行查询
List
<
Integer
>
typeList
=
null
;
// 包含-1则表示订单不能有任何审批状态存在,所以不用区分类型,查询所有的进行中审批
if
(!
types
.
contains
(-
1
)){
typeList
=
new
ArrayList
<>(
types
);
typeList
.
add
(
event
.
getApprovalType
());
}
// 查询当前订单正在进行的审批
// TODO 当订单互斥所有审批类型时,是否也要对自编号的审批状态进行校验
boolean
result
=
orderApprovalService
.
countProcessingApproval
(
event
.
getOrderId
(),
event
.
getOrderItemId
(),
type
s
);
boolean
result
=
orderApprovalService
.
countProcessingApproval
(
event
.
getOrderId
(),
event
.
getOrderItemId
(),
type
List
);
event
.
setResult
(
result
);
}
...
...
yudao-module-order/yudao-module-order-rest/src/main/java/cn/iocoder/yudao/module/order/controller/admin/order/OrderController.java
View file @
9a1b39fb
...
...
@@ -29,8 +29,10 @@ import cn.iocoder.yudao.module.order.convert.order.OrderConvert;
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.enums.OrderTempLateEnum
;
import
cn.iocoder.yudao.module.order.enums.TransportTypeShortEnum
;
import
cn.iocoder.yudao.module.order.service.approval.OrderApprovalService
;
import
cn.iocoder.yudao.module.order.service.order.OrderBusinessService
;
import
cn.iocoder.yudao.module.order.service.order.OrderItemService
;
import
cn.iocoder.yudao.module.order.service.order.OrderQueryService
;
...
...
@@ -103,6 +105,8 @@ public class OrderController {
@Autowired
private
OrderQueryService
orderQueryService
;
@Autowired
private
OrderApprovalService
orderApprovalService
;
@Autowired
private
RoleApi
roleApi
;
@Autowired
private
OrderItemService
orderItemService
;
...
...
@@ -829,6 +833,7 @@ public class OrderController {
@GetMapping
(
"/getDestCountryByOrderId"
)
@ApiOperation
(
"根据订单ID查询目的国"
)
@ApiImplicitParam
(
name
=
"orderId"
,
value
=
"编号"
,
required
=
true
,
example
=
"1024"
,
dataTypeClass
=
Long
.
class
)
public
CommonResult
<
String
>
getDestCountryByOrderId
(
Long
orderId
)
{
return
success
(
orderQueryService
.
getDestCountryByOrderId
(
orderId
));
}
...
...
@@ -852,4 +857,36 @@ public class OrderController {
}
@GetMapping
(
"/getDestCountryByOrderId"
)
@ApiOperation
(
"根据订单ID查询目的国"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"orderId"
,
value
=
"订单id"
,
required
=
true
,
example
=
"1024"
,
dataTypeClass
=
Long
.
class
),
@ApiImplicitParam
(
name
=
"orderItemId"
,
value
=
"订单项id"
,
required
=
true
,
example
=
"1024"
,
dataTypeClass
=
Long
.
class
),
@ApiImplicitParam
(
name
=
"approvalType"
,
value
=
"审批类型"
,
required
=
true
,
example
=
"1024"
,
dataTypeClass
=
Integer
.
class
)
})
public
CommonResult
<
Boolean
>
getDestCountryByOrderId
(
Long
orderId
,
Long
orderItemId
,
Integer
approvalType
)
{
OrderApprovalTypeEnum
approvalTypeEnum
=
OrderApprovalTypeEnum
.
valueOf
(
approvalType
);
if
(
Objects
.
isNull
(
approvalTypeEnum
)){
// 没有配置相关审批类型则不做校验
return
success
(
Boolean
.
FALSE
);
}
List
<
Integer
>
types
=
approvalTypeEnum
.
getMutualExclusionValues
();
if
(
Objects
.
isNull
(
types
)){
// 没有配置相关审批类型则不做校验
return
success
(
Boolean
.
FALSE
);
}
// 枚举配置中的互斥类型集合不能添加新值,这里需要重新定义新集合补充当前审批类型进行查询
List
<
Integer
>
typeList
=
null
;
// 包含-1则表示订单不能有任何审批状态存在,所以不用区分类型,查询所有的进行中审批
if
(!
types
.
contains
(-
1
)){
typeList
=
new
ArrayList
<>(
types
);
typeList
.
add
(
approvalType
);
}
// 查询当前订单正在进行的审批
boolean
result
=
orderApprovalService
.
countProcessingApproval
(
orderId
,
orderItemId
,
typeList
);
// TODO 当订单互斥所有审批类型时,是否也要对自编号的审批状态进行校验
return
success
(
result
);
}
}
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