From eda5d0e998204c7a49ab84d8528569b765bec2f9 Mon Sep 17 00:00:00 2001 From: yujian <yujian@163.com> Date: 星期五, 20 十二月 2019 10:05:10 +0800 Subject: [PATCH] 品牌日志 --- fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandInfoServiceImpl.java | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 56 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 014b339..44b2851 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 @@ -376,6 +376,9 @@ if (list == null || list.size() == 0) return; + long startTime = java.lang.System.currentTimeMillis(); + LogHelper.test(start + "鍝佺墝鏇存柊service---addShopAndGoods" + startTime); + for (BrandInfo brandInfo : list) { try { String name = brandInfo.getName(); @@ -395,8 +398,10 @@ } catch (Exception e) { LogHelper.errorDetailInfo(e); } - } + + long endTime = java.lang.System.currentTimeMillis(); + LogHelper.test(start + "鍝佺墝鏇存柊service---addShopAndGoods" + endTime + ",鏈鎬昏�楁椂:" +(endTime -startTime) / 1000); } @Override @@ -465,4 +470,54 @@ } return listInfo; } + + + + + @Override + @Cacheable(value = "brandCache", key = "'listByAlikeName-'+#key") + public BrandInfoVO listByAlikeName(String key) { + if (StringUtil.isNullOrEmpty(key)) + return null; + + List<BrandInfoVO> list = brandInfoMapper.listByAlikeName(key); + if (list == null || list.size() == 0) + return null; + + BigDecimal fanLiRate = hongBaoManageService.getFanLiRate(); + BigDecimal shareRate = hongBaoManageService.getShareRate(); + ConfigParamsDTO configParamsDTO = new ConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE,hongBaoManageService.getVIPFanLiRate()); + + BrandInfoVO brand = list.get(0); + List<BrandGoodsCahe> listGoods = brandGoodsCaheService.getByBrandId(1, 3, brand.getId()); + if (listGoods == null || listGoods.size() < 3) + return null; + + List<GoodsDetailVO> listGoodsVO = new ArrayList<GoodsDetailVO>(); + for (BrandGoodsCahe brandGoods : listGoods) { + JDGoods goodsJD = brandGoods.getGoodsJD(); + if (goodsJD != null) { + listGoodsVO.add(GoodsDetailVOFactory.convertJDGoods(goodsJD, configParamsDTO)); + continue; + } + + TaoBaoGoodsBrief goodsTB = brandGoods.getGoodsTB(); + if (goodsTB != null) { + listGoodsVO.add(GoodsDetailVOFactory.convertTaoBao(goodsTB, configParamsDTO)); + continue; + } + + PDDGoodsDetail goodsPDD = brandGoods.getGoodsPDD(); + if (goodsPDD != null) { + listGoodsVO.add(GoodsDetailVOFactory.convertPDDGoods(goodsPDD, configParamsDTO)); + continue; + } + } + + if (listGoodsVO.size() < 3) + return null; + + brand.setListGoods(listGoodsVO); + return brand; + } } -- Gitblit v1.8.0