Browse Source

feat(all): 修改价格体系时间边界控制

dist.1.3.0
zhaoqiaobo 8 months ago
parent
commit
112110f924
  1. 27
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataPriceServiceImpl.java

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

@ -217,7 +217,7 @@ public class BasicdataPriceServiceImpl extends BaseServiceImpl<BasicdataPriceMap
public Boolean deletePrice(String id) {
BasicdataPriceEntity entity = this.getById(id);
if (ObjectUtil.isNotEmpty(entity)) {
if (new Date().before(entity.getEffectiveTime())) {
if (DateUtil.beginOfDay(new Date()).before(entity.getEffectiveTime())) {
this.removeById(id);
return Boolean.TRUE;
} else {
@ -234,6 +234,9 @@ public class BasicdataPriceServiceImpl extends BaseServiceImpl<BasicdataPriceMap
if (DateUtil.compare(vo.getEffectiveTime(), vo.getExpiryTime()) > 0) {
throw new ServiceException("生效时间大于到期时间,请检查。");
}
if (DateUtil.beginOfDay(new Date()).isAfter(vo.getExpiryTime())) {
throw new ServiceException("到期时间不能小于当前时间,请检查。");
}
// 只能维护当前时间的版本,时间范围必须包含当前时间
Long clientId1 = vo.getClientId();
Long brandId1 = vo.getBrandId();
@ -293,24 +296,6 @@ public class BasicdataPriceServiceImpl extends BaseServiceImpl<BasicdataPriceMap
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());
@ -438,8 +423,8 @@ public class BasicdataPriceServiceImpl extends BaseServiceImpl<BasicdataPriceMap
.le(BasicdataPriceEntity::getEffectiveTime, DateUtil.parse(param.getTime(), "yyyy-MM-dd"))
;
} else {
wrapper.ge(BasicdataPriceEntity::getExpiryTime, new Date())
.le(BasicdataPriceEntity::getEffectiveTime, new Date())
wrapper.ge(BasicdataPriceEntity::getExpiryTime, DateUtil.beginOfDay(new Date()))
.le(BasicdataPriceEntity::getEffectiveTime, DateUtil.beginOfDay(new Date()))
;
}
List<BasicdataPriceEntity> priceEntities = this.list(wrapper);

Loading…
Cancel
Save