|
|
|
@ -208,6 +208,39 @@ public class BasicdataPriceServiceImpl extends BaseServiceImpl<BasicdataPriceMap
|
|
|
|
|
if (DateUtil.compare(vo.getEffectiveTime(), vo.getExpiryTime()) > 0) { |
|
|
|
|
throw new ServiceException("生效时间大于到期时间,请检查。"); |
|
|
|
|
} |
|
|
|
|
Long clientId1 = vo.getClientId(); |
|
|
|
|
Long brandId1 = vo.getBrandId(); |
|
|
|
|
List<BasicdataPriceEntity> list1 = this.list(Wrappers.<BasicdataPriceEntity>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())) { |
|
|
|
|