forked from lilishop/lilishop
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pg
- Loading branch information
Showing
18 changed files
with
290 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 24 additions & 1 deletion
25
consumer/src/main/java/cn/lili/event/impl/GoodsSkuExecute.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,53 @@ | ||
package cn.lili.event.impl; | ||
|
||
|
||
import cn.lili.cache.Cache; | ||
import cn.lili.cache.CachePrefix; | ||
import cn.lili.event.GoodsCommentCompleteEvent; | ||
import cn.lili.event.StoreSettingChangeEvent; | ||
import cn.lili.modules.goods.entity.dos.GoodsSku; | ||
import cn.lili.modules.goods.entity.dto.GoodsSearchParams; | ||
import cn.lili.modules.goods.service.GoodsSkuService; | ||
import cn.lili.modules.member.entity.dos.MemberEvaluation; | ||
import cn.lili.modules.store.entity.dos.Store; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.stereotype.Service; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
/** | ||
* 商品SKU变化 | ||
* | ||
* @author Chopper | ||
* @since 2020-07-03 11:20 | ||
*/ | ||
@Service | ||
public class GoodsSkuExecute implements GoodsCommentCompleteEvent { | ||
public class GoodsSkuExecute implements GoodsCommentCompleteEvent, StoreSettingChangeEvent { | ||
|
||
/** | ||
* 商品 | ||
*/ | ||
@Autowired | ||
private GoodsSkuService goodsSkuService; | ||
|
||
@Autowired | ||
private Cache cache; | ||
|
||
@Override | ||
public void goodsComment(MemberEvaluation memberEvaluation) { | ||
goodsSkuService.updateGoodsSkuCommentNum(memberEvaluation.getSkuId()); | ||
} | ||
|
||
@Override | ||
public void storeSettingChange(Store store) { | ||
//修改数据后,清除商品索引 | ||
GoodsSearchParams goodsSearchParams = new GoodsSearchParams(); | ||
goodsSearchParams.setStoreId(store.getId()); | ||
List<String> goodsSkuKeys = new ArrayList<>(); | ||
for (GoodsSku goodsSku : goodsSkuService.getGoodsSkuByList(goodsSearchParams)) { | ||
goodsSkuKeys.add(CachePrefix.GOODS_SKU.getPrefix()+goodsSku.getId()); | ||
} | ||
cache.multiDel(goodsSkuKeys); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.