From 178035f20c2ec783d851f3607e3aac450f2f0382 Mon Sep 17 00:00:00 2001 From: yinq Date: Mon, 22 Jun 2026 14:09:42 +0800 Subject: [PATCH] =?UTF-8?q?1.1.74=20=E6=96=B0=E5=A2=9E=E6=8C=89=E5=90=88?= =?UTF-8?q?=E5=90=8C=E6=9F=A5=E8=AF=A2=E7=B4=AF=E8=AE=A1=E5=9B=9E=E6=AC=BE?= =?UTF-8?q?=E6=AF=94=E4=BE=8B=E6=9C=80=E5=A4=A7=E7=9A=84=E5=BC=80=E7=A5=A8?= =?UTF-8?q?=E5=8D=95=E7=B4=AF=E8=AE=A1=E5=9B=9E=E6=AC=BE=E9=87=91=E9=A2=9D?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ErpFinInvoiceInfoController.java | 11 ++++++++ .../service/IErpFinInvoiceInfoService.java | 10 +++++++ .../impl/ErpFinInvoiceInfoServiceImpl.java | 26 +++++++++++++++++++ 3 files changed, 47 insertions(+) diff --git a/ruoyi-modules/ruoyi-oa/src/main/java/org/dromara/oa/erp/controller/ErpFinInvoiceInfoController.java b/ruoyi-modules/ruoyi-oa/src/main/java/org/dromara/oa/erp/controller/ErpFinInvoiceInfoController.java index f07a43db..8777d8d0 100644 --- a/ruoyi-modules/ruoyi-oa/src/main/java/org/dromara/oa/erp/controller/ErpFinInvoiceInfoController.java +++ b/ruoyi-modules/ruoyi-oa/src/main/java/org/dromara/oa/erp/controller/ErpFinInvoiceInfoController.java @@ -142,6 +142,17 @@ public class ErpFinInvoiceInfoController extends BaseController { return R.ok(list); } + /** + * 按合同查询累计回款比例最大的开票单累计回款金额 + */ + @SaCheckPermission("oa/erp:finInvoiceInfo:query") + @GetMapping("/getMaxReturnedMoneyByContractId/{contractId}") + public R getMaxReturnedMoneyByContractId(@NotNull(message = "contractId不能为空") + @PathVariable("contractId") Long contractId, + @RequestParam(required = false) Long excludeInvoiceId) { + return R.ok(erpFinInvoiceInfoService.getMaxReturnedMoneyByContractId(contractId, excludeInvoiceId)); + } + /** * 修改开票发票附件信息 diff --git a/ruoyi-modules/ruoyi-oa/src/main/java/org/dromara/oa/erp/service/IErpFinInvoiceInfoService.java b/ruoyi-modules/ruoyi-oa/src/main/java/org/dromara/oa/erp/service/IErpFinInvoiceInfoService.java index d7c31465..b4b0387e 100644 --- a/ruoyi-modules/ruoyi-oa/src/main/java/org/dromara/oa/erp/service/IErpFinInvoiceInfoService.java +++ b/ruoyi-modules/ruoyi-oa/src/main/java/org/dromara/oa/erp/service/IErpFinInvoiceInfoService.java @@ -8,6 +8,7 @@ import org.dromara.common.mybatis.core.page.TableDataInfo; import org.dromara.common.mybatis.core.page.PageQuery; import org.springframework.transaction.annotation.Transactional; +import java.math.BigDecimal; import java.util.Collection; import java.util.List; @@ -83,4 +84,13 @@ public interface IErpFinInvoiceInfoService { * @return 是否修改成功 */ public Boolean updateInvoiceAttachByBo(ErpFinInvoiceInfoBo bo); + + /** + * 按合同查询累计回款比例最大的开票单累计回款金额 + * + * @param contractId 合同ID + * @param excludeInvoiceId 排除的开票ID(编辑当前单时使用) + * @return 累计回款金额,无记录时返回0 + */ + BigDecimal getMaxReturnedMoneyByContractId(Long contractId, Long excludeInvoiceId); } diff --git a/ruoyi-modules/ruoyi-oa/src/main/java/org/dromara/oa/erp/service/impl/ErpFinInvoiceInfoServiceImpl.java b/ruoyi-modules/ruoyi-oa/src/main/java/org/dromara/oa/erp/service/impl/ErpFinInvoiceInfoServiceImpl.java index 0f94b8fc..30a0bf3c 100644 --- a/ruoyi-modules/ruoyi-oa/src/main/java/org/dromara/oa/erp/service/impl/ErpFinInvoiceInfoServiceImpl.java +++ b/ruoyi-modules/ruoyi-oa/src/main/java/org/dromara/oa/erp/service/impl/ErpFinInvoiceInfoServiceImpl.java @@ -378,6 +378,32 @@ public class ErpFinInvoiceInfoServiceImpl extends AbstractWorkflowService qw = Wrappers.lambdaQuery(ErpFinInvoiceInfo.class) + .eq(ErpFinInvoiceInfo::getContractId, contractId) + .eq(ErpFinInvoiceInfo::getDelFlag, DataConstants.DEL_FLAG_NORMAL) + .ne(ErpFinInvoiceInfo::getInvoiceStatus, OAStatusEnum.INVALID.getStatus()) + .isNotNull(ErpFinInvoiceInfo::getReturnedRate) + .orderByDesc(ErpFinInvoiceInfo::getReturnedRate) + .orderByDesc(ErpFinInvoiceInfo::getInvoiceId) + .last("LIMIT 1"); + if (excludeInvoiceId != null) { + qw.ne(ErpFinInvoiceInfo::getInvoiceId, excludeInvoiceId); + } + ErpFinInvoiceInfo invoiceInfo = baseMapper.selectOne(qw); + if (invoiceInfo == null || invoiceInfo.getReturnedMoney() == null) { + return ZERO; + } + return invoiceInfo.getReturnedMoney(); + } + /** * 修改发票附件信息