From 2147d023563a7c9d05d97547c00d6b0162c0644c Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期一, 09 十一月 2020 18:37:24 +0800 Subject: [PATCH] 刷单风险规则优化 --- fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandClassShopServiceImpl.java | 46 ++++++++++++++++++++++++---------------------- 1 files changed, 24 insertions(+), 22 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandClassShopServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandClassShopServiceImpl.java index b3f7f36..e9264a2 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandClassShopServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandClassShopServiceImpl.java @@ -9,6 +9,7 @@ import javax.annotation.Resource; +import com.yeshi.fanli.entity.SystemEnum; import org.springframework.cache.annotation.Cacheable; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -21,16 +22,17 @@ import com.yeshi.fanli.entity.brand.BrandClassShop; import com.yeshi.fanli.entity.goods.CommonGoods; import com.yeshi.fanli.entity.taobao.SearchFilter; -import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief; -import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBriefExtra; +import com.yeshi.goods.facade.entity.taobao.TaoBaoGoodsBrief; +import com.yeshi.goods.facade.entity.taobao.TaoBaoGoodsBriefExtra; import com.yeshi.fanli.entity.taobao.TaoBaoSearchResult; -import com.yeshi.fanli.entity.taobao.TaoBaoShop; +import com.yeshi.common.entity.taobao.TaoBaoShop; import com.yeshi.fanli.exception.brand.BrandClassShopException; import com.yeshi.fanli.service.inter.brand.BrandClassShopService; import com.yeshi.fanli.service.inter.brand.TaoBaoShopHistoryService; import com.yeshi.fanli.service.inter.goods.CommonGoodsService; import com.yeshi.fanli.service.inter.goods.TaoBaoGoodsBriefService; import com.yeshi.fanli.service.inter.lable.QualityGoodsService; +import com.yeshi.fanli.service.inter.order.OrderHongBaoMoneyComputeService; import com.yeshi.fanli.service.inter.order.config.HongBaoManageService; import com.yeshi.fanli.service.inter.taobao.TaoBaoGoodsUpdateService; import com.yeshi.fanli.service.inter.taobao.TaoBaoShopService; @@ -61,6 +63,9 @@ @Resource private HongBaoManageService hongBaoManageService; + + @Resource + private OrderHongBaoMoneyComputeService orderHongBaoMoneyComputeService; @Resource private QualityGoodsService qualityGoodsService; @@ -77,7 +82,7 @@ } @Override - @Transactional + @Transactional(rollbackFor=Exception.class) public String saveShopInfo(Long cid, List<Long> list) throws BrandClassShopException { if (list == null || list.size() == 0) { throw new BrandClassShopException(1, "璇烽�夋嫨搴楅摵"); @@ -134,7 +139,7 @@ } @Override - @Transactional + @Transactional(rollbackFor=Exception.class) public void changeShopInfo(MultipartFile file, Long id, Long cid, String shopName, Integer state, Integer top, String key) throws BrandClassShopException { @@ -260,8 +265,8 @@ } @Override - @Cacheable(value = "brandCache", key = "'listEffectiveCache-'+#page+'-'+#cid") - public JSONObject listEffectiveCache(int page, Long cid) { + @Cacheable(value = "brandCache", key = "'listEffectiveCache-'+#page+'-'+#cid+'-'+#system") + public JSONObject listEffectiveCache(int page, Long cid,SystemEnum system) { long countShop = 0; if (cid != null && cid <= 0) { @@ -271,7 +276,7 @@ List<TaoBaoShop> listShop = new ArrayList<TaoBaoShop>(); // 绗竴椤� 鏌ヨ鍏ㄩ儴鍒嗙被涓嬪簵閾� if (page == 1 && cid != null) { - List<BrandClassShop> list = brandClassShopMapper.listEffective(cid); + List<BrandClassShop> list = brandClassShopMapper.listEffective(cid,system); if (list == null) { list = new ArrayList<BrandClassShop>(); } else if (list.size() > 0) { @@ -317,7 +322,7 @@ // 娣樺疂鍟嗗搧淇℃伅杩囨护 Map<Long, TaoBaoGoodsBrief> goodsMap = getFilterTaoBaoGoods(listInfo); - BigDecimal proportion = hongBaoManageService.getFanLiRate(); + BigDecimal proportion = hongBaoManageService.getFanLiRate(system); for (TaoBaoShopVO taoBaoShopVO : listInfo) { String shopLink = taoBaoShopVO.getShopLink(); @@ -369,8 +374,8 @@ } @Override - @Cacheable(value = "brandCache", key = "'listEffectiveCacheV2-'+#page+'-'+#cid") - public JSONObject listEffectiveCacheV2(int page, Long cid) { + @Cacheable(value = "brandCache", key = "'listEffectiveCacheV2-'+#page+'-'+#cid+'-'+#platform+'-'+#version+'-'+#system") + public JSONObject listEffectiveCacheV2(int page, Long cid,String platform,String version,SystemEnum system) { long countShop = 0; if (cid != null && cid <= 0) { @@ -380,7 +385,7 @@ List<TaoBaoShop> listShop = new ArrayList<TaoBaoShop>(); // 绗竴椤� 鏌ヨ鍏ㄩ儴鍒嗙被涓嬪簵閾� if (page == 1 && cid != null) { - List<BrandClassShop> list = brandClassShopMapper.listEffective(cid); + List<BrandClassShop> list = brandClassShopMapper.listEffective(cid,system); if (list == null) { list = new ArrayList<BrandClassShop>(); } else if (list.size() > 0) { @@ -431,9 +436,7 @@ count = taoBaoShopService.countBrandShopinfo(cid); } - BigDecimal fanLiRate = hongBaoManageService.getFanLiRate(); - BigDecimal shareRate = hongBaoManageService.getShareRate(); - ConfigParamsDTO paramsDTO = new ConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE); + ConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate(platform, version,system); // 娣樺疂鍟嗗搧淇℃伅杩囨护 Map<Long, TaoBaoGoodsBrief> goodsMap = getFilterTaoBaoGoods(listInfo); @@ -506,7 +509,7 @@ sf.setKey(shop.getShop().getShopName().replace("瀹樻柟鏃楄埌搴�", "").replace("鏃楄埌搴�", "")); sf.setPage(1); sf.setPageSize(100); - TaoBaoSearchResult result = TaoKeApiUtil.searchWuLiao(sf); + TaoBaoSearchResult result = TaoKeApiUtil.searchWuLiao(sf,null,null); List<TaoBaoGoodsBrief> goodsList = new ArrayList<>(); if (result != null && result.getTaoBaoGoodsBriefs() != null) for (TaoBaoGoodsBrief goods : result.getTaoBaoGoodsBriefs()) { @@ -528,7 +531,7 @@ @Override - public List<TaoBaoShopVO> listEffectiveShop(long start, int count, Long cid) { + public List<TaoBaoShopVO> listEffectiveShop(long start, int count, Long cid,String platform,String version,SystemEnum system) { if (cid != null && cid <= 0) { cid = null; } @@ -538,9 +541,8 @@ return listInfo; - BigDecimal fanLiRate = hongBaoManageService.getFanLiRate(); - BigDecimal shareRate = hongBaoManageService.getShareRate(); - ConfigParamsDTO paramsDTO = new ConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE); + ConfigParamsDTO paramsDTO = + orderHongBaoMoneyComputeService.getShowComputeRate(platform, version,system); // 娣樺疂鍟嗗搧淇℃伅杩囨护 Map<Long, TaoBaoGoodsBrief> goodsMap = getFilterTaoBaoGoods(listInfo); @@ -581,11 +583,11 @@ @Override - public List<TaoBaoShop> listEffectiveClassShop(Long cid) { + public List<TaoBaoShop> listEffectiveClassShop(Long cid, SystemEnum system) { if (cid == null) return null; - List<BrandClassShop> list = brandClassShopMapper.listEffective(cid); + List<BrandClassShop> list = brandClassShopMapper.listEffective(cid,system); if (list == null || list.size() == 0) return null; -- Gitblit v1.8.0