修改商品有效性判定中,根据商品更新时间比较改为商品创建时间比较(因修改了商品更新逻辑,每次都是删除后新增,所以无商品更新时间)

This commit is contained in:
paulGao 2022-06-09 09:13:13 +08:00
parent 8426294a0f
commit 478ba2048a
4 changed files with 6 additions and 6 deletions

View File

@ -171,11 +171,11 @@ public class GoodsSku extends BaseEntity {
}
@Override
public Date getUpdateTime() {
if (super.getUpdateTime() == null) {
public Date getCreateTime() {
if (super.getCreateTime() == null) {
return new Date(1593571928);
} else {
return super.getUpdateTime();
return super.getCreateTime();
}
}

View File

@ -107,7 +107,7 @@ public class CheckDataRender implements CartRenderStep {
//缓存中的商品信息
GoodsSku dataSku = goodsSkuService.getGoodsSkuByIdFromCache(cartSkuVO.getGoodsSku().getId());
//商品有效性判定
if (dataSku == null || dataSku.getUpdateTime().before(cartSkuVO.getGoodsSku().getUpdateTime())) {
if (dataSku == null || dataSku.getCreateTime().after(cartSkuVO.getGoodsSku().getCreateTime())) {
//设置购物车未选中
cartSkuVO.setChecked(false);
//设置购物车此sku商品已失效

View File

@ -150,7 +150,7 @@ public class CartServiceImpl implements CartService {
//购物车中已经存在更新数量
if (cartSkuVO != null && dataSku.getUpdateTime().equals(cartSkuVO.getGoodsSku().getUpdateTime())) {
if (cartSkuVO != null && dataSku.getCreateTime().equals(cartSkuVO.getGoodsSku().getCreateTime())) {
//如果覆盖购物车中商品数量
if (Boolean.TRUE.equals(cover)) {

View File

@ -64,7 +64,7 @@ public abstract class BaseEntity implements Serializable {
@LastModifiedDate
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@TableField(fill = FieldFill.UPDATE)
@TableField(fill = FieldFill.INSERT_UPDATE)
@ApiModelProperty(value = "更新时间", hidden = true)
@Field(type = FieldType.Date, format = DateFormat.custom, pattern = "yyyy-MM-dd HH:mm:ss || yyyy-MM-dd || yyyy/MM/dd HH:mm:ss|| yyyy/MM/dd ||epoch_millis")
private Date updateTime;