| | |
| | | import com.yeshi.fanli.entity.bus.lable.QualityFactory;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | | import com.yeshi.fanli.service.inter.goods.TaoBaoGoodsBriefService;
|
| | | import com.yeshi.fanli.service.inter.hongbao.HongBaoManageService;
|
| | | import com.yeshi.fanli.service.inter.lable.LabelService;
|
| | | import com.yeshi.fanli.service.inter.lable.QualityGoodsService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoGoodsUpdateService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoUnionConfigService;
|
| | | import com.yeshi.fanli.service.inter.taobao.dataoke.DaTaoKeGoodsDetailService;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.factory.goods.GoodsDetailVOFactory;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil;
|
| | | import com.yeshi.fanli.vo.goods.GoodsDetailVO;
|
| | |
|
| | | import net.sf.json.JSONArray;
|
| | |
|
| | |
| | |
|
| | | @Resource
|
| | | private DaTaoKeGoodsDetailService daTaoKeGoodsDetailService;
|
| | | |
| | | @Resource
|
| | | private HongBaoManageService hongBaoManageService;
|
| | | |
| | | @Resource
|
| | | private TaoBaoGoodsUpdateService taoBaoGoodsUpdateService;
|
| | | |
| | |
|
| | | @Override
|
| | | @Cacheable(value = "qualityCache", key = "'listQueryByCouponAmount-'+#start+'-'+#key+'-'+#endAmount+'-'+#startPropor")
|
| | |
| | | @Cacheable(value = "qualityCache", key = "'listQueryByClassId-'+#start+'-'+#cid")
|
| | | public List<QualityFactory> listQueryByClassId(long start, int count, Long cid) {
|
| | | List<QualityFactory> list = qualityFactoryMapper.listQuery(start, count, null, cid, null, null, 1);
|
| | | |
| | | if (list == null) {
|
| | | list = new ArrayList<QualityFactory>();
|
| | | }
|
| | | |
| | | List<TaoBaoGoodsBrief> goodsList = new ArrayList<>();
|
| | | for (QualityFactory qf : list)
|
| | | goodsList.add(qf.getTaoBaoGoodsBrief());
|
| | | //过滤商品信息
|
| | | goodsList=taoBaoGoodsUpdateService.filterImportantTaoBaoGoods(goodsList);
|
| | | goodsList = daTaoKeGoodsDetailService.filterTaoBaoGoods(goodsList);// 过滤大淘客标题
|
| | | for (int i = 0; i < list.size(); i++) {
|
| | | if (i < goodsList.size())
|
| | |
| | | return qualityFactoryMapper.listRecommendToIndex(start, count, proportion, commision, couponAmount, tkRate,
|
| | | couponRatio);
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public long countRecommend(Double proportion, Integer commision, Integer couponAmount, double tkRate,
|
| | |
| | |
|
| | | return array;
|
| | | }
|
| | | |
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 首页最底部@商品信息流
|
| | | */
|
| | | @Override
|
| | | @Cacheable(value = "qualityCache", key = "'getRecommendToIndexV2-'+#start")
|
| | | public JSONArray getRecommendToIndexV2(long start, int count) {
|
| | |
|
| | | // 返利金额2元以上;
|
| | | Integer commision = 2;
|
| | | // 优惠券面额高于5元以上
|
| | | Integer couponAmount = 5;
|
| | | // 佣金比例高的:5%以上;
|
| | | double tkRate = 5.0;
|
| | | // 优惠率高于10%以上(优惠率=优惠券面额/商品在售价*100%)
|
| | | Double couponRatio = 10.0;
|
| | |
|
| | | BigDecimal fanLiRate = hongBaoManageService.getFanLiRate();
|
| | | Double pop = 50.0;
|
| | | if (fanLiRate != null) {
|
| | | pop = Double.parseDouble(fanLiRate.toString());
|
| | | }
|
| | | |
| | | List<QualityFactory> listQuery = listRecommend(start, count, pop, commision, couponAmount, tkRate, couponRatio);
|
| | |
|
| | | if (listQuery == null || listQuery.size() == 0) {
|
| | | return null;
|
| | | }
|
| | |
|
| | | JSONArray array = new JSONArray();
|
| | | Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder()).create();
|
| | | // 遍历列表数据
|
| | | //
|
| | | List<TaoBaoGoodsBrief> goodsList = new ArrayList<>();
|
| | | for (QualityFactory quality : listQuery) {
|
| | | if (quality.getTaoBaoGoodsBrief() != null)
|
| | | goodsList.add(quality.getTaoBaoGoodsBrief());
|
| | | }
|
| | |
|
| | | try {
|
| | | goodsList = daTaoKeGoodsDetailService.filterTaoBaoGoods(goodsList);
|
| | | } catch (Exception e) {
|
| | | }
|
| | |
|
| | | BigDecimal shareRate = hongBaoManageService.getShareRate();
|
| | | for (TaoBaoGoodsBrief taoBaoGoodsBrief : goodsList) {
|
| | | GoodsDetailVO detailVO = GoodsDetailVOFactory.convertTaoBao(taoBaoGoodsBrief, null, fanLiRate, shareRate);
|
| | | array.add(gson.toJson(detailVO));
|
| | | }
|
| | |
|
| | | return array;
|
| | | }
|
| | |
|
| | | |
| | | |
| | | @Override
|
| | | @Cacheable(value = "qualityCache", key = "'countRecommendToIndex-'+#proportion")
|
| | | public long countRecommendToIndex(String proportion) {
|