Commit 63db275af1b016238bd659d12f0e1d15ee4a4072
1 parent
772b7943
✨ MALL:默认异步记录商品访问日志、访问次数
Showing
2 changed files
with
5 additions
and
0 deletions
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/history/ProductBrowseHistoryService.java
| @@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.product.service.history; | @@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.product.service.history; | ||
| 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | import cn.iocoder.yudao.module.product.controller.admin.history.vo.ProductBrowseHistoryPageReqVO; | 4 | import cn.iocoder.yudao.module.product.controller.admin.history.vo.ProductBrowseHistoryPageReqVO; |
| 5 | import cn.iocoder.yudao.module.product.dal.dataobject.history.ProductBrowseHistoryDO; | 5 | import cn.iocoder.yudao.module.product.dal.dataobject.history.ProductBrowseHistoryDO; |
| 6 | +import org.springframework.scheduling.annotation.Async; | ||
| 6 | 7 | ||
| 7 | import java.util.Collection; | 8 | import java.util.Collection; |
| 8 | 9 | ||
| @@ -20,6 +21,7 @@ public interface ProductBrowseHistoryService { | @@ -20,6 +21,7 @@ public interface ProductBrowseHistoryService { | ||
| 20 | * @param spuId SPU 编号 | 21 | * @param spuId SPU 编号 |
| 21 | * @return 编号 | 22 | * @return 编号 |
| 22 | */ | 23 | */ |
| 24 | + @Async | ||
| 23 | Long createBrowseHistory(Long userId, Long spuId); | 25 | Long createBrowseHistory(Long userId, Long spuId); |
| 24 | 26 | ||
| 25 | /** | 27 | /** |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuService.java
| @@ -6,6 +6,8 @@ import cn.iocoder.yudao.module.product.controller.app.spu.vo.AppProductSpuPageRe | @@ -6,6 +6,8 @@ import cn.iocoder.yudao.module.product.controller.app.spu.vo.AppProductSpuPageRe | ||
| 6 | import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO; | 6 | import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO; |
| 7 | 7 | ||
| 8 | import jakarta.validation.Valid; | 8 | import jakarta.validation.Valid; |
| 9 | +import org.springframework.scheduling.annotation.Async; | ||
| 10 | + | ||
| 9 | import java.util.Collection; | 11 | import java.util.Collection; |
| 10 | import java.util.List; | 12 | import java.util.List; |
| 11 | import java.util.Map; | 13 | import java.util.Map; |
| @@ -154,6 +156,7 @@ public interface ProductSpuService { | @@ -154,6 +156,7 @@ public interface ProductSpuService { | ||
| 154 | * @param id 商品 SPU 编号 | 156 | * @param id 商品 SPU 编号 |
| 155 | * @param incrCount 增加的数量 | 157 | * @param incrCount 增加的数量 |
| 156 | */ | 158 | */ |
| 159 | + @Async | ||
| 157 | void updateBrowseCount(Long id, int incrCount); | 160 | void updateBrowseCount(Long id, int incrCount); |
| 158 | 161 | ||
| 159 | } | 162 | } |