From ad62312e9f7f59de39440232c2ed142cbfbaab28 Mon Sep 17 00:00:00 2001 From: zhaoqiaobo Date: Mon, 20 May 2024 18:58:44 +0800 Subject: [PATCH] =?UTF-8?q?feat(all):=20=E4=BF=AE=E6=94=B9=E4=BB=B7?= =?UTF-8?q?=E6=A0=BC=E4=BD=93=E7=B3=BB=E4=BF=9D=E5=AD=98=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../basicdata/mapper/BasicdataPriceMapper.xml | 2 ++ .../impl/BasicdataPriceServiceImpl.java | 33 +++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataPriceMapper.xml b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataPriceMapper.xml index 32d14c8b8..efd69243c 100644 --- a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataPriceMapper.xml +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataPriceMapper.xml @@ -11,6 +11,7 @@ select t.id, cli.client_name, t.brand_id, + t.client_id, t.template_id, ldb.brand_name, lbpt.service_type, @@ -48,6 +49,7 @@ select t.id, cli.client_name, t.brand_id, + t.client_id, t.template_id, ldb.brand_name, lbpt.service_type, diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataPriceServiceImpl.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataPriceServiceImpl.java index ed0c85b22..0ae01857c 100644 --- a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataPriceServiceImpl.java +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataPriceServiceImpl.java @@ -208,6 +208,39 @@ public class BasicdataPriceServiceImpl extends BaseServiceImpl 0) { throw new ServiceException("生效时间大于到期时间,请检查。"); } + Long clientId1 = vo.getClientId(); + Long brandId1 = vo.getBrandId(); + List list1 = this.list(Wrappers.lambdaQuery() + .eq(BasicdataPriceEntity::getClientId, clientId1) + .eq(BasicdataPriceEntity::getBrandId, brandId1) + .eq(BasicdataPriceEntity::getIsDeleted, 0) + ); + // 修改的当前版本时间控制 + Date start1 = vo.getEffectiveTime(); + Date end1 = vo.getExpiryTime(); + int flag = 0; + if (CollUtil.isNotEmpty(list1)) { + for (BasicdataPriceEntity priceEntity : list1) { + Date start2 = priceEntity.getEffectiveTime(); + Date end2 = priceEntity.getExpiryTime(); + if (start1.after(priceEntity.getEffectiveTime())) { + // 交换 interval1 的开始和结束时间 + Date temp = start1; + start1 = start2; + start2 = temp; + temp = end1; + end1 = end2; + end2 = temp; + } + // 计算交集 + if (!end1.before(start2)) { + flag += 1; + } + } + } + if (flag > 1) { + throw new ServiceException("生效时间与截至时间范围在系统中存在多个价格体系,请确认"); + } // 如果是切换模版,则删除所有本价格相关的数据 BasicdataPriceEntity entity = null; if (ObjectUtil.isNotEmpty(vo.getId())) {