Skip to content

Commit

Permalink
修改商品有效性判定中,根据商品更新时间比较改为商品创建时间比较(因修改了商品更新逻辑,每次都是删除后新增,所以无商品更新时间)
Browse files Browse the repository at this point in the history
  • Loading branch information
LeiGaoRobot committed Jun 9, 2022
1 parent 8426294 commit 478ba20
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,11 @@ public Double getWeight() {
}

@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();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ private void checkData(TradeDTO tradeDTO) {
//缓存中的商品信息
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商品已失效
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public void add(String skuId, Integer num, String cartType, Boolean cover) {


//购物车中已经存在,更新数量
if (cartSkuVO != null && dataSku.getUpdateTime().equals(cartSkuVO.getGoodsSku().getUpdateTime())) {
if (cartSkuVO != null && dataSku.getCreateTime().equals(cartSkuVO.getGoodsSku().getCreateTime())) {

//如果覆盖购物车中商品数量
if (Boolean.TRUE.equals(cover)) {
Expand Down
2 changes: 1 addition & 1 deletion framework/src/main/java/cn/lili/mybatis/BaseEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 478ba20

Please sign in to comment.