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
f2e9f3c7
Commit
f2e9f3c7
authored
Nov 02, 2024
by
zhengyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提供当费用申请金额修改为0时,可以直接删除的业务
parent
2d756946
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
63 additions
and
13 deletions
+63
-13
ErrorCodeConstants.java
.../iocoder/yudao/module/order/enums/ErrorCodeConstants.java
+1
-0
OrderFeeApplicationServiceImpl.java
...er/service/order/impl/OrderFeeApplicationServiceImpl.java
+49
-5
OrderFeeApplicationController.java
...in/orderFeeApplication/OrderFeeApplicationController.java
+7
-5
messages.properties
yudao-server/src/main/resources/i18n/messages.properties
+2
-1
messages_en.properties
yudao-server/src/main/resources/i18n/messages_en.properties
+2
-1
messages_zh.properties
yudao-server/src/main/resources/i18n/messages_zh.properties
+2
-1
No files found.
yudao-module-order/yudao-module-order-core/src/main/java/cn/iocoder/yudao/module/order/enums/ErrorCodeConstants.java
View file @
f2e9f3c7
...
...
@@ -429,4 +429,5 @@ public interface ErrorCodeConstants {
// 该订单已经是非海外仓订单
ErrorCode
ORDER_NOT_IS_OVERSEAS_WAREHOUSE_ORDER
=
new
ErrorCode
(
1004001170
,
"order.not.is.overseas.warehouse.order"
);
ErrorCode
ORDER_APPROVAL_IS_NOT_EXISTS
=
new
ErrorCode
(
1004001171
,
"order.approval.is.not.exists"
);
ErrorCode
FEE_APPLICATION_NOT_IS_ZERO
=
new
ErrorCode
(
1004001172
,
"fee.application.not.is.zero"
);
}
yudao-module-order/yudao-module-order-core/src/main/java/cn/iocoder/yudao/module/order/service/order/impl/OrderFeeApplicationServiceImpl.java
View file @
f2e9f3c7
...
...
@@ -47,9 +47,11 @@ import org.springframework.transaction.annotation.Transactional;
import
org.springframework.validation.annotation.Validated
;
import
javax.annotation.Resource
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.List
;
import
java.util.Objects
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
common
.
exception
.
util
.
ServiceExceptionUtil
.
exception
;
import
static
cn
.
iocoder
.
yudao
.
module
.
order
.
enums
.
ErrorCodeConstants
.*;
...
...
@@ -200,13 +202,21 @@ public class OrderFeeApplicationServiceImpl extends AbstractService<OrderFeeAppl
@Override
public
void
updateFeeApplication
(
OrderFeeApplicationUpdateReqVO
updateReqVO
)
{
// 校验存在
this
.
validateFeeApplicationExists
(
updateReqVO
.
getId
());
OrderDO
orderDO
=
orderService
.
getById
(
updateReqVO
.
getOrderId
());
OrderApprovalTypeCheckEvent
approvalTypeCheckEvent
=
new
OrderApprovalTypeCheckEvent
(
updateReqVO
.
getOrderId
(),
null
,
expense_apply
.
getValue
(),
null
,
false
);
applicationContext
.
publishEvent
(
approvalTypeCheckEvent
);
if
(
approvalTypeCheckEvent
.
getResult
())
{
throw
exception
(
ORDER_HAS_PROCESSING_APPROVAL
,
orderDO
.
getOrderNo
());
}
OrderFeeApplicationDO
orderFeeApplicationDOOld
=
feeApplicationMapper
.
selectById
(
updateReqVO
.
getId
());
// 校验存在
if
(
orderFeeApplicationDOOld
==
null
)
{
throw
exception
(
FEE_APPLICATION_NOT_EXISTS
);
}
// 更新
OrderFeeApplicationDO
updateObj
=
OrderFeeApplicationConvert
.
INSTANCE
.
convert
(
updateReqVO
);
Long
userId
=
SecurityFrameworkUtils
.
getLoginUserId
();
OrderDO
orderDO
=
orderService
.
selectOne
(
OrderDO:
:
getOrderId
,
updateReqVO
.
getOrderId
());
String
bpmProcessId
=
bpmCreateServiceFactory
.
createBmp
(
userId
,
updateObj
.
getId
(),
WorkFlowEmus
.
ORDER_FREE_APPLY
.
getKey
(),
orderDO
.
getOrderNo
(),
updateReqVO
.
getCopyUserId
());
Integer
auditType
=
OrderApprovalTypeResultEnum
.
expense_apply_processing
.
getType
();
orderService
.
updateStatus
(
orderDO
.
getOrderId
(),
null
,
null
,
null
,
null
,
null
,
auditType
,
OrderApprovalTypeResultEnum
.
expense_apply_processing
.
getDesc
());
...
...
@@ -237,10 +247,44 @@ public class OrderFeeApplicationServiceImpl extends AbstractService<OrderFeeAppl
@Override
public
void
deleteFeeApplication
(
Long
id
)
{
OrderFeeApplicationDO
orderFeeApplicationDO
=
feeApplicationMapper
.
selectById
(
id
);
// 校验存在
this
.
validateFeeApplicationExists
(
id
);
// 删除
if
(
orderFeeApplicationDO
==
null
)
{
throw
exception
(
FEE_APPLICATION_NOT_EXISTS
);
}
// 当费用金额为0时,可以不经审批直接删除
// 判断金额是否为0
if
(
orderFeeApplicationDO
.
getApplicationFee
().
compareTo
(
BigDecimal
.
ZERO
)
!=
0
){
throw
exception
(
FEE_APPLICATION_NOT_IS_ZERO
);
}
// 删除可能的应收单
if
(
orderFeeApplicationDO
.
getReceivableId
()
!=
null
&&
orderFeeApplicationDO
.
getReceivableId
()
>
0
)
{
long
idTemp
=
(
long
)
orderFeeApplicationDO
.
getReceivableId
();
ReceivableDO
rDo
=
receivableService
.
getReceivable
(
idTemp
);
if
(
Objects
.
nonNull
(
rDo
)){
receivableService
.
removeById
(
rDo
.
getId
());
}
}
// 删除费用申请记录
feeApplicationMapper
.
deleteById
(
id
);
CurrencyDO
currency
=
currencyService
.
getCurrency
(
orderFeeApplicationDO
.
getApplicationFeeCurrency
());
String
currencyName
=
Objects
.
nonNull
(
currency
)
?
(
I18nMessage
.
getLang
()
==
0
?
currency
.
getTitleZh
()
:
currency
.
getTitleEn
())
:
(
I18nMessage
.
getLang
()
==
0
?
"未知"
:
"NUKNOWN"
);
DictDataRespDTO
dictDataFromCache
=
DictFrameworkUtils
.
getDictDataFromCache
(
DictTypeConstants
.
RECEIVABLE_FEE_TYPE
,
String
.
valueOf
(
orderFeeApplicationDO
.
getFeeType
()));
List
<
ApplyInfoVO
>
list
=
new
ArrayList
<>();
ApplyInfoVO
applyInfoVO
=
new
ApplyInfoVO
();
applyInfoVO
.
setName
(
"申请费用名称"
);
applyInfoVO
.
setNewValue
(
I18nMessage
.
getLang
()
==
0
?
dictDataFromCache
.
getLabel
()
:
dictDataFromCache
.
getLabelEn
());
list
.
add
(
applyInfoVO
);
applyInfoVO
=
new
ApplyInfoVO
();
applyInfoVO
.
setName
(
"金额"
);
applyInfoVO
.
setNewValue
(
String
.
valueOf
(
orderFeeApplicationDO
.
getApplicationFee
().
doubleValue
()));
list
.
add
(
applyInfoVO
);
applyInfoVO
=
new
ApplyInfoVO
();
applyInfoVO
.
setName
(
"币种"
);
applyInfoVO
.
setNewValue
(
currencyName
);
list
.
add
(
applyInfoVO
);
orderBusinessService
.
addOrderOperateLog
(
orderFeeApplicationDO
.
getOrderId
(),
"订单操作"
,
"费用申请删除"
,
list
);
}
private
void
validateFeeApplicationExists
(
Long
id
)
{
...
...
yudao-module-order/yudao-module-order-rest/src/main/java/cn/iocoder/yudao/module/order/controller/admin/orderFeeApplication/OrderFeeApplicationController.java
View file @
f2e9f3c7
...
...
@@ -119,13 +119,15 @@ public class OrderFeeApplicationController {
@PutMapping
(
"/update"
)
@ApiOperation
(
"更新订单费用申请"
)
public
CommonResult
<
Boolean
>
updateFeeApplication
(
@Valid
@RequestBody
OrderFeeApplicationUpdateReqVO
updateReqVO
)
{
if
(!
Objects
.
isNull
(
updateReqVO
))
{
OrderDO
orderDO
=
orderService
.
getById
(
updateReqVO
.
getOrderId
());
if
(
orderDO
.
getAuditType
()
!=
0
)
{
throw
exception
(
ORDER_HAS_PROCESSING_APPROVAL
,
orderDO
.
getOrderNo
());
}
String
redisKey
=
MessageFormat
.
format
(
ORDER_FEE_APPLICATION_KEY
,
updateReqVO
.
getOrderId
().
toString
());
Long
count
=
redisHelper
.
incrBy
(
redisKey
,
1
);
if
(
count
>
1
){
return
error
(
ORDER_FEE_APPLICATION_REPEAT_COMMIT
);
}
redisHelper
.
expire
(
redisKey
,
1
,
TimeUnit
.
MINUTES
);
feeApplicationService
.
updateFeeApplication
(
updateReqVO
);
redisHelper
.
delete
(
redisKey
);
return
success
(
true
);
}
...
...
yudao-server/src/main/resources/i18n/messages.properties
View file @
f2e9f3c7
...
...
@@ -306,4 +306,5 @@ order.not.is.overseas.warehouse.order=
area.code.not.null
=
currency.id.not.null
=
order.approval.is.not.exists
=
\ No newline at end of file
order.approval.is.not.exists
=
fee.application.not.is.zero
=
\ No newline at end of file
yudao-server/src/main/resources/i18n/messages_en.properties
View file @
f2e9f3c7
...
...
@@ -1120,4 +1120,5 @@ order.not.is.overseas.warehouse.order=This order is already a non overseas wareh
area.code.not.null
=
The national mobile phone area code cannot be empty
currency.id.not.null
=
The country ID cannot be empty
order.approval.is.not.exists
=
Order approval type does not exist
\ No newline at end of file
order.approval.is.not.exists
=
Order approval type does not exist
fee.application.not.is.zero
=
The expense application amount is not 0, and cannot be directly deleted
\ No newline at end of file
yudao-server/src/main/resources/i18n/messages_zh.properties
View file @
f2e9f3c7
...
...
@@ -1120,4 +1120,5 @@ order.not.is.overseas.warehouse.order=\u8be5\u8ba2\u5355\u5df2\u7ecf\u662f\u975e
area.code.not.null
=
\u
56fd
\u
5bb6
\u
624b
\u
673a
\u
533a
\u
53f7
\u
4e0d
\u
80fd
\u
4e3a
\u
7a7a
currency.id.not.null
=
\u
56fd
\u
5bb6id
\u
4e0d
\u
80fd
\u
4e3a
\u
7a7a
order.approval.is.not.exists
=
\u
8ba2
\u5355\u
5ba1
\u6279\u
7c7b
\u
578b
\u
4e0d
\u
5b58
\u5728
\ No newline at end of file
order.approval.is.not.exists
=
\u
8ba2
\u5355\u
5ba1
\u6279\u
7c7b
\u
578b
\u
4e0d
\u
5b58
\u5728
fee.application.not.is.zero
=
\u
8d39
\u7528\u7533\u
8bf7
\u
91d1
\u
989d
\u
4e0d
\u
4e3a0
\u
ff0c
\u
4e0d
\u
80fd
\u
8fdb
\u
884c
\u
76f4
\u
63a5
\u5220\u9664
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