Browse Source

feat(all): 修改价格体系新增多个版本问题

dist.1.3.0
zhaoqiaobo 11 months ago
parent
commit
8c54d1580e
  1. 44
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataPriceServiceImpl.java

44
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataPriceServiceImpl.java

@ -208,6 +208,7 @@ 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()
@ -215,6 +216,7 @@ public class BasicdataPriceServiceImpl extends BaseServiceImpl<BasicdataPriceMap
.eq(BasicdataPriceEntity::getBrandId, brandId1)
.eq(BasicdataPriceEntity::getIsDeleted, 0)
);
// 修改的当前版本时间控制
Date start1 = vo.getEffectiveTime();
Date end1 = vo.getExpiryTime();
@ -245,22 +247,44 @@ public class BasicdataPriceServiceImpl extends BaseServiceImpl<BasicdataPriceMap
BasicdataPriceEntity entity = null;
if (ObjectUtil.isNotEmpty(vo.getId())) {
entity = this.getById(vo.getId());
if (ObjectUtil.isNotEmpty(entity)) {
Long templateId = entity.getTemplateId();
if (!ObjectUtil.equal(templateId, vo.getTemplateId())) {
// 删除数据
deleteByPriceId(vo.getId());
entity.setDispatchStairsCarryingCharge(0);
entity.setDispatchUpwardJudgment(0d);
entity.setDispatchUpwardJudgmentCost(0d);
log.info("价格体系:{} 切换模版删除数据", vo.getId());
}
} else {
if (flag > 0) {
throw new ServiceException("生效时间与截止时间范围在系统中已存在,请确认");
}
}
if (ObjectUtil.isNotEmpty(entity)) {
Long templateId = entity.getTemplateId();
if (!ObjectUtil.equal(templateId, vo.getTemplateId())) {
// 删除数据
deleteByPriceId(vo.getId());
entity.setDispatchStairsCarryingCharge(0);
entity.setDispatchUpwardJudgment(0d);
entity.setDispatchUpwardJudgmentCost(0d);
log.info("价格体系:{} 切换模版删除数据", vo.getId());
}
} else {
entity = new BasicdataPriceEntity();
entity.setClientId(vo.getClientId());
entity.setBrandId(vo.getBrandId());
}
// if (ObjectUtil.isNotEmpty(vo.getId())) {
// entity = this.getById(vo.getId());
// if (ObjectUtil.isNotEmpty(entity)) {
// Long templateId = entity.getTemplateId();
// if (!ObjectUtil.equal(templateId, vo.getTemplateId())) {
// // 删除数据
// deleteByPriceId(vo.getId());
// entity.setDispatchStairsCarryingCharge(0);
// entity.setDispatchUpwardJudgment(0d);
// entity.setDispatchUpwardJudgmentCost(0d);
// log.info("价格体系:{} 切换模版删除数据", vo.getId());
// }
// }
// } else {
// entity = new BasicdataPriceEntity();
// entity.setClientId(vo.getClientId());
// entity.setBrandId(vo.getBrandId());
// }
entity.setTemplateId(vo.getTemplateId());
entity.setEffectiveTime(vo.getEffectiveTime());
entity.setExpiryTime(vo.getExpiryTime());

Loading…
Cancel
Save