From 806bfd1be601735121afcf252ceeaf8f06fd6464 Mon Sep 17 00:00:00 2001
From: yujian <yujian@163.com>
Date: 星期一, 25 十一月 2019 09:44:59 +0800
Subject: [PATCH] 品牌修改

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandInfoServiceImpl.java |   24 +++++++++++++++++++++++-
 1 files changed, 23 insertions(+), 1 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandInfoServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandInfoServiceImpl.java
index 1eafeef..d2f3b3f 100644
--- a/fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandInfoServiceImpl.java
+++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandInfoServiceImpl.java
@@ -21,6 +21,7 @@
 import com.yeshi.fanli.dto.pdd.PDDGoodsDetail;
 import com.yeshi.fanli.entity.brand.BrandGoodsCahe;
 import com.yeshi.fanli.entity.brand.BrandInfo;
+import com.yeshi.fanli.entity.brand.BrandShopCahe;
 import com.yeshi.fanli.entity.jd.JDGoods;
 import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
 import com.yeshi.fanli.entity.taobao.TaoBaoShop;
@@ -149,6 +150,13 @@
 				public void run() {
 					int goodsTotal = brandGoodsCaheService.addBrandGoods(record);
 					record.setGoodsTotal(goodsTotal);
+					
+					List<BrandShopCahe> listshop = brandShopCaheService.getByBrandId(record.getId());
+					if (listshop == null) {
+						record.setShopTotal(0);
+					} else {
+						record.setShopTotal(listshop.size());
+					}
 					brandInfoMapper.updateByPrimaryKeySelective(record);
 				}
 			});
@@ -288,6 +296,13 @@
 			BrandInfo updateInfo = new BrandInfo();
 			updateInfo.setId(brandInfo.getId());
 			updateInfo.setGoodsTotal((int)goodsTotal);
+			List<BrandShopCahe> listshop = brandShopCaheService.getByBrandId(brandInfo.getId());
+			if (listshop == null) {
+				updateInfo.setShopTotal(0);
+			} else {
+				updateInfo.setShopTotal(listshop.size());
+			}
+			
 			brandInfoMapper.updateByPrimaryKeySelective(updateInfo);
 		}
 	}
@@ -310,6 +325,13 @@
 
 			brandInfo.setGoodsTotal(goodsTotal);
 			brandInfo.setUpdateTime(new Date());
+			
+			List<BrandShopCahe> listshop = brandShopCaheService.getByBrandId(brandInfo.getId());
+			if (listshop == null) {
+				brandInfo.setShopTotal(0);
+			} else {
+				brandInfo.setShopTotal(listshop.size());
+			}
 			brandInfoMapper.updateByPrimaryKeySelective(brandInfo);
 		}
 	}
@@ -325,7 +347,7 @@
 	}
 
 	@Override
-	@Cacheable(value = "brandCache", key = "'listValidByCidToApp-'+#cid")
+//	@Cacheable(value = "brandCache", key = "'listValidByCidToApp-'+#cid")
 	public List<BrandInfo> listValidByCidToApp(Long cid) {
 		if (cid == null)
 			return null;

--
Gitblit v1.8.0