From 51a4ff5d777028d52a19c314a99f796334cb7b51 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期六, 23 十一月 2019 18:30:01 +0800 Subject: [PATCH] 配置文件修改 --- fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandInfoServiceImpl.java | 44 +++++++++++++++++++++++++++++++++++++++----- 1 files changed, 39 insertions(+), 5 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..1eafeef 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 @@ -80,6 +80,10 @@ if (StringUtil.isNullOrEmpty(name)) throw new BrandInfoException(1, "鍚嶇О涓嶈兘涓虹┖"); + String shopKey = record.getShopKey(); + if (StringUtil.isNullOrEmpty(shopKey)) + record.setShopKey(name); + String searchKey = record.getSearchKey(); if (StringUtil.isNullOrEmpty(searchKey)) record.setSearchKey(name); @@ -110,16 +114,19 @@ if (picture != null && picture.trim().length() > 0) { // 鍒犻櫎鑰佸浘 - if (picture != null && picture.trim().length() > 0 && !Constant.IS_TEST) { - COSManager.getInstance().deleteFile(picture); + if (resultObj.getIcon() != null && resultObj.getIcon().trim().length() > 0 && !Constant.IS_TEST) { + COSManager.getInstance().deleteFile(resultObj.getIcon()); }; // 瀛樺偍鏂板浘 record.setIcon(picture); } else { record.setIcon(resultObj.getIcon()); } - - record.setGoodsTotal(resultObj.getGoodsTotal()); + if (state == 0){ + record.setGoodsTotal(0); + } else { + record.setGoodsTotal(resultObj.getGoodsTotal()); + } record.setCreateTime(resultObj.getCreateTime()); record.setUpdateTime(new Date()); brandInfoMapper.updateByPrimaryKey(record); @@ -255,8 +262,35 @@ // 鍒犻櫎搴楅摵 brandShopCaheService.removeAgoByDate(date); + + long count = brandInfoMapper.countValidByCid(null); + if (count == 0) + return; + + for (int page = 0; page < (count / 100) + 1; page++) { + updateTotalGoods(page * 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 @@ -298,7 +332,7 @@ return brandInfoMapper.listValidByCidToApp(cid); } - @Cacheable(value = "brandCache", key = "'listValidToApp-'+#start+'-'+#start +'-'+#cid") +// @Cacheable(value = "brandCache", key = "'listValidToApp-'+#start+'-'+#start +'-'+#cid") @Override public List<BrandInfoVO> listValidToApp(long start, int count, Long cid) { List<BrandInfoVO> list = brandInfoMapper.listBrandInfoVO(start, count, cid); -- Gitblit v1.8.0