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())) {