From a121afb545abe3cb510c9ea70023aa312ac4ddbe Mon Sep 17 00:00:00 2001 From: yinq Date: Thu, 19 Mar 2026 09:05:06 +0800 Subject: [PATCH] =?UTF-8?q?1.0.91=20=E6=A0=A1=E9=AA=8C=E5=90=88=E5=90=8C?= =?UTF-8?q?=E7=BC=96=E5=8F=B7=E4=B8=8D=E8=83=BD=E9=87=8D=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/ErpContractInfoServiceImpl.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/ruoyi-modules/ruoyi-oa/src/main/java/org/dromara/oa/erp/service/impl/ErpContractInfoServiceImpl.java b/ruoyi-modules/ruoyi-oa/src/main/java/org/dromara/oa/erp/service/impl/ErpContractInfoServiceImpl.java index a5061592..a635b883 100644 --- a/ruoyi-modules/ruoyi-oa/src/main/java/org/dromara/oa/erp/service/impl/ErpContractInfoServiceImpl.java +++ b/ruoyi-modules/ruoyi-oa/src/main/java/org/dromara/oa/erp/service/impl/ErpContractInfoServiceImpl.java @@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.convert.Convert; import cn.hutool.core.convert.NumberChineseFormatter; import cn.hutool.core.map.MapUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.deepoove.poi.data.RowRenderData; import com.deepoove.poi.data.Rows; @@ -389,6 +390,18 @@ public class ErpContractInfoServiceImpl implements IErpContractInfoService { * 保存前的数据校验 */ private void validEntityBeforeSave(ErpContractInfo entity) { + // 校验合同编号不能重复(编辑时排除自身) + if (entity != null && StringUtils.isNotBlank(entity.getContractCode())) { + LambdaQueryWrapper lqw = new LambdaQueryWrapper() + .eq(ErpContractInfo::getContractCode, entity.getContractCode()) + .eq(ErpContractInfo::getDelFlag, "0") + .ne(entity.getContractId() != null, ErpContractInfo::getContractId, entity.getContractId()); + Long cnt = baseMapper.selectCount(lqw); + if (cnt != null && cnt > 0) { + throw new ServiceException("合同编号【" + entity.getContractCode() + "】已存在,请勿重复"); + } + } + // 校验客户基础信息是否已完善(附件、税号、开户银行、银行账号不能为空) Long oneCustomerId = entity.getOneCustomerId(); if (oneCustomerId != null) {