From 2a3e411612bf75b81a8789127a714b5c5e28bc43 Mon Sep 17 00:00:00 2001
From: yujian <yujian@123.com>
Date: 星期四, 31 十月 2019 13:55:03 +0800
Subject: [PATCH] 红包获得

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandInfoServiceImpl.java |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 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 3227405..057259e 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
@@ -255,8 +255,35 @@
 		
 		// 鍒犻櫎搴楅摵
 		brandShopCaheService.removeAgoByDate(date);
+		
+		long count = brandInfoMapper.countValidByCid(null);
+		if (count == 0)
+			return;
+
+		for (int page = 1; page < (count / 100) + 1; page++) {
+			updateTotalGoods((page - 1) * 100, 100);
+		}
 	}
 
+	/**
+	 * 鏇存柊鍟嗗搧鏁伴噺
+	 * @param start
+	 * @param count
+	 */
+	private void updateTotalGoods(long start, int count) {
+		List<BrandInfo> list = brandInfoMapper.listValidAll(start, count);
+		if (list == null || list.size() == 0)
+			return;
+		
+		for (BrandInfo brandInfo : list) {
+			long goodsTotal = brandGoodsCaheService.countByBrandId(brandInfo.getId());
+			
+			BrandInfo updateInfo = new BrandInfo();
+			updateInfo.setId(brandInfo.getId());
+			updateInfo.setGoodsTotal((int)goodsTotal);
+			brandInfoMapper.updateByPrimaryKeySelective(updateInfo);
+		}
+	}
 	
 	
 	@Override

--
Gitblit v1.8.0