From 3d3fa72ebf55f841c8ede01c59347af5e44b773b Mon Sep 17 00:00:00 2001 From: wujianwei <wjw@11.com> Date: 星期一, 18 八月 2025 09:26:59 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/yagwly_fa_master' into yagwly_fa_master --- service/src/main/java/com/ruoyi/cwgl/service/impl/EstimatedReceivableServiceImpl.java | 26 ++++++++++++++++++++++++++ 1 files changed, 26 insertions(+), 0 deletions(-) diff --git a/service/src/main/java/com/ruoyi/cwgl/service/impl/EstimatedReceivableServiceImpl.java b/service/src/main/java/com/ruoyi/cwgl/service/impl/EstimatedReceivableServiceImpl.java index a493210..02aef7d 100644 --- a/service/src/main/java/com/ruoyi/cwgl/service/impl/EstimatedReceivableServiceImpl.java +++ b/service/src/main/java/com/ruoyi/cwgl/service/impl/EstimatedReceivableServiceImpl.java @@ -1,5 +1,6 @@ package com.ruoyi.cwgl.service.impl; +import java.math.BigDecimal; import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; @@ -11,7 +12,10 @@ import com.ruoyi.common.utils.RandomUtils; import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.cwgl.domain.EstimatedReceivableBill; +import com.ruoyi.cwgl.domain.PendingSettlementBusiness; +import com.ruoyi.cwgl.mapper.EstimatedReceivableBillMapper; import com.ruoyi.cwgl.mapper.EstimatedReceivableLogMapper; +import com.ruoyi.cwgl.mapper.PendingSettlementBusinessMapper; import com.ruoyi.cwgl.service.IEstimatedReceivableLogService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.transaction.annotation.Transactional; @@ -45,6 +49,10 @@ private EstimatedReceivableMapper estimatedReceivableMapper; @Autowired private IEstimatedReceivableLogService logService; + @Resource + private PendingSettlementBusinessMapper pendingSettlementBusinessMapper; + @Resource + private EstimatedReceivableBillMapper estimatedReceivableBillMapper; /** * 鏌ヨ棰勪及搴旀敹绠$悊 @@ -150,6 +158,24 @@ if (estimatedReceivable1.getRelatedBillStatus().equals(2)||estimatedReceivable1.getRelatedBillStatus().equals(3)){ throw new ServiceException("缁撶畻涓垨宸茬粨绠楁棤娉曚慨鏀�"); } + //鍘熸湰閲戦 + BigDecimal oldAmount = estimatedReceivable1.getEstimatedAmount(); + //鏂伴噾棰� + BigDecimal newAmount = estimatedReceivable.getEstimatedAmount(); + if (!oldAmount.equals(newAmount)) { + + PendingSettlementBusiness pendingSettlementBusiness = pendingSettlementBusinessMapper.selectPendingSettlementBusinessByNo(estimatedReceivable.getDispatchNo()); + if (pendingSettlementBusiness!=null) { + BigDecimal estimatedTotalIncome = pendingSettlementBusiness.getEstimatedTotalIncome(); + pendingSettlementBusiness.setEstimatedTotalIncome(estimatedTotalIncome.subtract(oldAmount).add(newAmount)); + pendingSettlementBusinessMapper.updatePendingSettlementBusiness(pendingSettlementBusiness); + if (pendingSettlementBusiness.getBillId() != null) { + EstimatedReceivableBill estimatedReceivableBill = estimatedReceivableBillMapper.selectEstimatedReceivableBillById(pendingSettlementBusiness.getBillId()); + estimatedReceivableBill.setTotalAmount(estimatedReceivableBill.getTotalAmount().subtract( oldAmount).add( newAmount)); + estimatedReceivableBillMapper.updateEstimatedReceivableBill(estimatedReceivableBill); + } + } + } estimatedReceivable.setUpdateTime(DateUtils.getNowDate()); String username = SecurityUtils.getUsername(); logService.insertEstimatedReceivableLog("淇敼搴旀敹",estimatedReceivable.getId(),username); -- Gitblit v1.8.0