Commit 5756ad891afb12ee8a4dae01457eed96437ff2e3

Authored by fengliang
1 parent d1873f62

update:购物车显示商品图片

etrade-order/src/main/java/com/diligrp/etrade/order/domain/ShopCartMessageDto.java
@@ -99,6 +99,8 @@ public class ShopCartMessageDto implements Serializable { @@ -99,6 +99,8 @@ public class ShopCartMessageDto implements Serializable {
99 /** 商品名称 */ 99 /** 商品名称 */
100 private String productName; 100 private String productName;
101 101
  102 + private LocalDateTime modifiedTime;
  103 +
102 public LocalDateTime getCacheTime() { 104 public LocalDateTime getCacheTime() {
103 return cacheTime; 105 return cacheTime;
104 } 106 }
@@ -241,4 +243,12 @@ public class ShopCartMessageDto implements Serializable { @@ -241,4 +243,12 @@ public class ShopCartMessageDto implements Serializable {
241 public void setUrl(String url) { 243 public void setUrl(String url) {
242 this.url = url; 244 this.url = url;
243 } 245 }
  246 +
  247 + public LocalDateTime getModifiedTime() {
  248 + return modifiedTime;
  249 + }
  250 +
  251 + public void setModifiedTime(LocalDateTime modifiedTime) {
  252 + this.modifiedTime = modifiedTime;
  253 + }
244 } 254 }
etrade-order/src/main/java/com/diligrp/etrade/order/service/IShopCartMessageService.java
@@ -4,6 +4,7 @@ import com.diligrp.etrade.order.domain.ShopCartDto; @@ -4,6 +4,7 @@ import com.diligrp.etrade.order.domain.ShopCartDto;
4 import com.diligrp.etrade.order.domain.ShopCartMessageDto; 4 import com.diligrp.etrade.order.domain.ShopCartMessageDto;
5 import com.diligrp.etrade.order.model.ShopCartMessage; 5 import com.diligrp.etrade.order.model.ShopCartMessage;
6 6
  7 +import java.time.LocalDateTime;
7 import java.util.List; 8 import java.util.List;
8 9
9 public interface IShopCartMessageService { 10 public interface IShopCartMessageService {
@@ -16,7 +17,7 @@ public interface IShopCartMessageService { @@ -16,7 +17,7 @@ public interface IShopCartMessageService {
16 17
17 void updateShopCartMessage(ShopCartMessageDto shopCartMessageDto); 18 void updateShopCartMessage(ShopCartMessageDto shopCartMessageDto);
18 19
19 - void updateByOld(ShopCartMessage shopCartMessageOld,ShopCartMessageDto shopCartMessageDto,Boolean bo); 20 + void updateByOld(ShopCartMessage shopCartMessageOld, ShopCartMessageDto shopCartMessageDto, Boolean bo);
20 21
21 List<ShopCartMessage> findList(ShopCartMessageDto shopCartMessageDto); 22 List<ShopCartMessage> findList(ShopCartMessageDto shopCartMessageDto);
22 23
etrade-order/src/main/java/com/diligrp/etrade/order/service/IShopCartService.java
@@ -2,6 +2,7 @@ package com.diligrp.etrade.order.service; @@ -2,6 +2,7 @@ package com.diligrp.etrade.order.service;
2 2
3 import com.diligrp.etrade.order.domain.*; 3 import com.diligrp.etrade.order.domain.*;
4 4
  5 +import java.time.LocalDateTime;
5 import java.util.List; 6 import java.util.List;
6 7
7 public interface IShopCartService { 8 public interface IShopCartService {
@@ -10,7 +11,7 @@ public interface IShopCartService { @@ -10,7 +11,7 @@ public interface IShopCartService {
10 List<ShopCartVo> listShopCart(ShopCartDto shopCartDto); 11 List<ShopCartVo> listShopCart(ShopCartDto shopCartDto);
11 12
12 13
13 - void saveShopCart(ShopCartDto shopCartDto,boolean flag); 14 + void saveShopCart(ShopCartDto shopCartDto, boolean flag);
14 15
15 void updateShopcartList(List<ShopCartCacheDto> shopCartCacheDtoList); 16 void updateShopcartList(List<ShopCartCacheDto> shopCartCacheDtoList);
16 17
etrade-order/src/main/java/com/diligrp/etrade/order/service/impl/ShopCartImpl.java
@@ -31,6 +31,7 @@ import org.springframework.transaction.annotation.Transactional; @@ -31,6 +31,7 @@ import org.springframework.transaction.annotation.Transactional;
31 import org.springframework.util.Assert; 31 import org.springframework.util.Assert;
32 import org.springframework.util.CollectionUtils; 32 import org.springframework.util.CollectionUtils;
33 33
  34 +import java.time.LocalDateTime;
34 import java.util.*; 35 import java.util.*;
35 import java.util.stream.Collectors; 36 import java.util.stream.Collectors;
36 37
@@ -241,6 +242,7 @@ public class ShopCartImpl implements IShopCartService { @@ -241,6 +242,7 @@ public class ShopCartImpl implements IShopCartService {
241 @Transactional(rollbackFor = Exception.class) 242 @Transactional(rollbackFor = Exception.class)
242 @Override 243 @Override
243 public void updateShopcartList(List<ShopCartCacheDto> shopCartCacheDtoList) { 244 public void updateShopcartList(List<ShopCartCacheDto> shopCartCacheDtoList) {
  245 + LocalDateTime now = LocalDateTime.now();
244 shopCartCacheDtoList.forEach(shopCartCacheDto -> { 246 shopCartCacheDtoList.forEach(shopCartCacheDto -> {
245 List<ShopCartMessageDto> shopCartMessageDtos = shopCartCacheDto.getShopCartMessageDtos(); 247 List<ShopCartMessageDto> shopCartMessageDtos = shopCartCacheDto.getShopCartMessageDtos();
246 if (!CollectionUtils.isEmpty(shopCartMessageDtos)){ 248 if (!CollectionUtils.isEmpty(shopCartMessageDtos)){
@@ -251,6 +253,7 @@ public class ShopCartImpl implements IShopCartService { @@ -251,6 +253,7 @@ public class ShopCartImpl implements IShopCartService {
251 if(StringUtils.isBlank(shopCartMessageDto.getProductUrl())){ 253 if(StringUtils.isBlank(shopCartMessageDto.getProductUrl())){
252 shopCartMessageDto.setProductUrl(shopCartMessageDto.getUrl()); 254 shopCartMessageDto.setProductUrl(shopCartMessageDto.getUrl());
253 } 255 }
  256 + shopCartMessageDto.setModifiedTime(now);
254 shopCartDto.setShopCartMessageDto(shopCartMessageDto); 257 shopCartDto.setShopCartMessageDto(shopCartMessageDto);
255 return shopCartDto; 258 return shopCartDto;
256 }).toList(); 259 }).toList();
etrade-order/src/main/java/com/diligrp/etrade/order/service/impl/ShopCartMessageServiceImpl.java
@@ -13,6 +13,7 @@ import org.springframework.stereotype.Service; @@ -13,6 +13,7 @@ import org.springframework.stereotype.Service;
13 import org.springframework.transaction.annotation.Transactional; 13 import org.springframework.transaction.annotation.Transactional;
14 import org.springframework.util.CollectionUtils; 14 import org.springframework.util.CollectionUtils;
15 15
  16 +import java.time.LocalDateTime;
16 import java.util.List; 17 import java.util.List;
17 18
18 /** 19 /**
@@ -141,7 +142,7 @@ public class ShopCartMessageServiceImpl implements IShopCartMessageService { @@ -141,7 +142,7 @@ public class ShopCartMessageServiceImpl implements IShopCartMessageService {
141 //如果是处理离线缓存数据,bo=true,总重量做覆盖,不是处理离线数据,总重量做增量 142 //如果是处理离线缓存数据,bo=true,总重量做覆盖,不是处理离线数据,总重量做增量
142 if (bo) { 143 if (bo) {
143 //如果缓存时间在更新之前之前,说明缓存数据不是最新数据,则不进行更新操作 144 //如果缓存时间在更新之前之前,说明缓存数据不是最新数据,则不进行更新操作
144 - if (shopCartMessageDto.getCacheTime().isBefore(shopCartMessageOld.getModifiedTime())) { 145 + if (!shopCartMessageDto.getCacheTime().isAfter(shopCartMessageOld.getModifiedTime())) {
145 return; 146 return;
146 } 147 }
147 }else { 148 }else {
etrade-order/src/main/resources/com/diligrp/etrade/dao/mapper/shopCart/ShopCartMapper.xml
@@ -28,6 +28,7 @@ @@ -28,6 +28,7 @@
28 <result column="weight" jdbcType="BIGINT" property="weight"/> 28 <result column="weight" jdbcType="BIGINT" property="weight"/>
29 <result column="amount" jdbcType="BIGINT" property="amount"/> 29 <result column="amount" jdbcType="BIGINT" property="amount"/>
30 <result column="type" jdbcType="TINYINT" property="type"/> 30 <result column="type" jdbcType="TINYINT" property="type"/>
  31 + <result column="url" jdbcType="VARCHAR" property="url"/>
31 <result column="scm_modified_time" jdbcType="TIMESTAMP" property="modifiedTime"/> 32 <result column="scm_modified_time" jdbcType="TIMESTAMP" property="modifiedTime"/>
32 <result column="check_flag" jdbcType="TINYINT" property="checkFlag"/> 33 <result column="check_flag" jdbcType="TINYINT" property="checkFlag"/>
33 <result column="alias" jdbcType="VARCHAR" property="alias"/> 34 <result column="alias" jdbcType="VARCHAR" property="alias"/>
etrade-order/src/main/resources/com/diligrp/etrade/dao/mapper/shopCart/ShopCartMessageMapper.xml
@@ -253,9 +253,12 @@ @@ -253,9 +253,12 @@
253 <if test="shopCartId != null"> 253 <if test="shopCartId != null">
254 shop_cart_id = #{shopCartId,jdbcType=BIGINT}, 254 shop_cart_id = #{shopCartId,jdbcType=BIGINT},
255 </if> 255 </if>
256 -  
257 - modified_time = NOW(),  
258 - 256 + <if test="modifiedTime != null">
  257 + modified_time = #{modifiedTime,jdbcType=TIMESTAMP},
  258 + </if>
  259 + <if test="modifiedTime == null">
  260 + modified_time = NOW(),
  261 + </if>
259 <if test="marketId != null"> 262 <if test="marketId != null">
260 market_id = #{marketId,jdbcType=BIGINT}, 263 market_id = #{marketId,jdbcType=BIGINT},
261 </if> 264 </if>