Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation
This project
Loading...
Sign in
李苗
/
Vion-DevOps
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 737cb2cc
authored
Sep 10, 2024
by
HlQ
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
[fix] 更新合同时,合同更新成功,再重新计算合同相关金额
1 parent
fd276d2b
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
6 deletions
README.md
src/main/java/vion/service/impl/ContractPaymentServiceImpl.java
src/main/java/vion/service/impl/ContractServiceImpl.java
README.md
View file @
737cb2c
...
...
@@ -20,3 +20,6 @@
</resource>
</resources>
```
## 更新合同金额
需要在
``Contract.class``
把 金额上面的四个注解
``@ReverseAutoMapping(targetClass = ContractDTO.class, ignore = true)``
注释掉,然后调用更新接口。
\ No newline at end of file
src/main/java/vion/service/impl/ContractPaymentServiceImpl.java
View file @
737cb2c
package
vion
.
service
.
impl
;
import
org.dromara.hutool.core.math.NumberUtil
;
import
org.dromara.hutool.core.util.ObjUtil
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.github.yulichang.base.MPJBaseServiceImpl
;
import
lombok.RequiredArgsConstructor
;
import
org.dromara.hutool.core.math.NumberUtil
;
import
org.dromara.hutool.core.util.ObjUtil
;
import
org.springframework.stereotype.Service
;
import
vion.mapper.ContractPaymentMapper
;
import
vion.mapper.SettlementDiffMapper
;
...
...
@@ -31,8 +31,8 @@ public class ContractPaymentServiceImpl extends MPJBaseServiceImpl<ContractPayme
/**
* 当合同状态变化或者应收款变化时,重新计算款项
*
* @param existContract
* @param dto
* @param existContract
数据库中当前合同记录
* @param dto
要变更的合同记录
*/
@Override
public
void
calMoney
(
Contract
existContract
,
Contract
dto
)
{
...
...
@@ -45,7 +45,7 @@ public class ContractPaymentServiceImpl extends MPJBaseServiceImpl<ContractPayme
Map
<
Integer
,
BigDecimal
>
type2RatioMap
=
contractPaymentList
.
stream
().
collect
(
Collectors
.
toMap
(
ContractPayment:
:
getPaymentType
,
ContractPayment:
:
getPaymentRatio
));
Integer
status
=
dto
.
getStatus
()
==
null
?
existContract
.
getStatus
()
:
dto
.
getStatus
();
BigDecimal
sumRatio
=
new
BigDecimal
(
0
)
;
BigDecimal
sumRatio
=
BigDecimal
.
ZERO
;
for
(
int
i
=
1
;
i
<=
status
;
i
++)
{
BigDecimal
ratio
=
type2RatioMap
.
get
(
i
);
sumRatio
=
NumberUtil
.
add
(
ratio
,
sumRatio
);
...
...
src/main/java/vion/service/impl/ContractServiceImpl.java
View file @
737cb2c
...
...
@@ -299,8 +299,8 @@ public class ContractServiceImpl extends MPJBaseServiceImpl<ContractMapper, Cont
Long
contractId
=
existContract
.
getId
();
String
existContractNo
=
existContract
.
getContractNo
();
contract
.
setId
(
contractId
);
contractPaymentService
.
calMoney
(
existContract
,
contract
);
if
(
this
.
updateById
(
contract
))
{
contractPaymentService
.
calMoney
(
existContract
,
contract
);
Opt
.
ofNullable
(
dto
.
getNodeDate
())
.
ifPresent
(
date
->
contractPaymentService
.
lambdaUpdate
()
.
set
(
ContractPayment:
:
getNodeDate
,
date
)
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment