| | |
| | | |
| | | import com.yeshi.fanli.entity.SystemEnum; |
| | | import com.yeshi.fanli.entity.SystemFunction; |
| | | import com.yeshi.fanli.entity.SystemPIDInfo; |
| | | import com.yeshi.fanli.exception.pdd.PDDApiException; |
| | | import com.yeshi.fanli.lijin.manager.GoodsLijinMnager; |
| | | import com.yeshi.fanli.lijin.manager.UserLijinMnager; |
| | | import com.yeshi.fanli.service.inter.pdd.PDDAuthService; |
| | | import com.yeshi.fanli.service.inter.user.tb.UserExtraTaoBaoInfoService; |
| | | import com.yeshi.fanli.service.manger.PIDManager; |
| | | import com.yeshi.fanli.util.*; |
| | | import com.yeshi.fanli.vo.common.WXXCXJumpInfoVO; |
| | | import com.yeshi.fanli.vo.pdd.PDDConvertLinkResultVO; |
| | |
| | | import org.yeshi.utils.taobao.TbImgUtil; |
| | | |
| | | import com.google.gson.Gson; |
| | | import com.yeshi.fanli.dto.ConfigParamsDTO; |
| | | import com.yeshi.fanli.dto.GoodsMoneyConfigParamsDTO; |
| | | import com.yeshi.fanli.dto.jd.JDCategoryInfo; |
| | | import com.yeshi.fanli.dto.jd.JDCouponInfo; |
| | | import com.yeshi.fanli.dto.pdd.PDDGoodsDetail; |
| | |
| | | @Resource |
| | | private PDDAuthService pddAuthService; |
| | | |
| | | private ConfigParamsDTO getParamsDTO(String platform, String version, Long uid, SystemEnum system) { |
| | | @Resource |
| | | private GoodsLijinMnager goodsLijinMnager; |
| | | |
| | | @Resource |
| | | private PIDManager pidManager; |
| | | |
| | | @Resource |
| | | private UserLijinMnager userLijinMnager; |
| | | |
| | | private GoodsMoneyConfigParamsDTO getParamsDTO(String platform, String version, Long uid, SystemEnum system) { |
| | | UserLevelEnum level = UserLevelEnum.daRen; |
| | | if (uid != null && uid > 0) { |
| | | level = userLevelManager.getUserLevel(uid); |
| | |
| | | return orderHongBaoMoneyComputeService.getShowComputeRate(platform, version, level, system); |
| | | } |
| | | |
| | | private TaoBaoGoodsBrief filterDaTaoKeGoodsInfo(TaoBaoGoodsBrief goods) { |
| | | private TaoBaoGoodsBrief filterDaTaoKeGoodsInfo(SystemEnum system, TaoBaoGoodsBrief goods) { |
| | | String specialPid = pidManager.getPidCache(system, Constant.SOURCE_TYPE_TAOBAO, SystemPIDInfo.PidType.fanli); |
| | | String relationPid = pidManager.getPidCache(system, Constant.SOURCE_TYPE_TAOBAO, SystemPIDInfo.PidType.fanliChannel); |
| | | |
| | | try { |
| | | DaTaoKeFilterResult result = daTaoKeGoodsDetailV2Service.filterTaoBaoGoods(goods); |
| | | if (result.getFilterType() == DaTaoKeFilterResult.FILTER_TYPE_COUPON |
| | |
| | | // 缓存基础链接 |
| | | String dpid = null; |
| | | if (TaoBaoUtil.isSpecialGoods(goods.getMaterialLibType())) { |
| | | dpid = TaoBaoConstant.TAOBAO_SPECIAL_PID_DEFAULT; |
| | | dpid = specialPid; |
| | | } else { |
| | | dpid = TaoBaoConstant.TAOBAO_RELATION_AS_SPECIAL_PID; |
| | | dpid = relationPid; |
| | | } |
| | | String link = taoBaoGoodsCacheUtil.getBaseConvertLink(goods.getAuctionId(), dpid); |
| | | if (!StringUtil.isNullOrEmpty(link)) { |
| | |
| | | if (uid != null && uid > 0) { |
| | | String specialId = userExtraTaoBaoInfoService.getSpecialIdByUid(uid); |
| | | //获取最新的比例 |
| | | TaoBaoGoodsBrief rateGoods = TaoKeApiUtil.specialConvertCoupon(tb.getAuctionId(), TaoBaoConstant.getSpecialAuthAppInfo(), specialId, null); |
| | | TaoBaoGoodsBrief rateGoods = TaoKeApiUtil.specialConvertCoupon(tb.getAuctionId(), TaoBaoConstant.getSpecialAuthAppInfo(pidManager.getPidCache(acceptData.getSystem(), Constant.SOURCE_TYPE_TAOBAO, SystemPIDInfo.PidType.fanli)), specialId, null); |
| | | if (rateGoods != null) |
| | | tb.setMinTkRate(rateGoods.getTkRate()); |
| | | } |
| | |
| | | |
| | | // 大淘客商品过滤 |
| | | try { |
| | | goods = filterDaTaoKeGoodsInfo(goods); |
| | | goods = filterDaTaoKeGoodsInfo(acceptData.getSystem(), goods); |
| | | } catch (Exception e) { |
| | | LogHelper.errorDetailInfo(e); |
| | | } |
| | | |
| | | ConfigParamsDTO paramsDTO = getParamsDTO(acceptData.getPlatform(), acceptData.getVersion(), uid, acceptData.getSystem()); |
| | | GoodsMoneyConfigParamsDTO paramsDTO = getParamsDTO(acceptData.getPlatform(), acceptData.getVersion(), uid, acceptData.getSystem()); |
| | | paramsDTO.setBaseFanliRate(hongBaoManageService.getBaseFanliRate(acceptData.getSystem())); |
| | | |
| | | GoodsDetailVO goodsDetail = GoodsDetailVOFactory.convertTaoBao(goods, paramsDTO); |
| | |
| | | // 保存缓存 |
| | | jdGoodsCacheUtil.saveGoodsInfo(jdGoods); |
| | | |
| | | ConfigParamsDTO paramsDTO = getParamsDTO(acceptData.getPlatform(), acceptData.getVersion(), uid, acceptData.getSystem()); |
| | | GoodsMoneyConfigParamsDTO paramsDTO = getParamsDTO(acceptData.getPlatform(), acceptData.getVersion(), uid, acceptData.getSystem()); |
| | | paramsDTO.setBaseFanliRate(hongBaoManageService.getBaseFanliRate(acceptData.getSystem())); |
| | | GoodsDetailVO goodsDetail = GoodsDetailVOFactory.convertJDGoods(jdGoods, paramsDTO); |
| | | if (goodsDetail != null && goodsDetail.getMoneyInfo() != null && userVIPInfoService.isVIP(uid)) { |
| | |
| | | // 券链接处理 |
| | | String materialId = "https://item.jd.com/" + id + ".html"; |
| | | String url = JDApiUtil.convertLinkWithSubUnionId(materialId, couponInfo.getLink(), null, |
| | | JDApiUtil.POSITION_COUPON + "", null); |
| | | pidManager.getPidCache(acceptData.getSystem(), Constant.SOURCE_TYPE_JD, SystemPIDInfo.PidType.coupon), null); |
| | | couponInfo.setLink(url); |
| | | } |
| | | |
| | |
| | | return; |
| | | } |
| | | |
| | | String pid = pidManager.getPidCache(acceptData.getSystem(), Constant.SOURCE_TYPE_PDD, SystemPIDInfo.PidType.fanli); |
| | | |
| | | PDDGoodsDetail pddGoods = null; |
| | | try { |
| | | pddGoods = PinDuoDuoApiUtil.getGoodsDetail(id, PinDuoDuoApiUtil.PID_FANLI, pddAuthService.getFanliCustomParams(uid)); |
| | | pddGoods = PinDuoDuoApiUtil.getGoodsDetail(id, pid, pddAuthService.getFanliCustomParams(uid)); |
| | | } catch (PDDApiException e) { |
| | | e.printStackTrace(); |
| | | if (e.getCode() == PDDApiException.CODE_NOT_AUTH) { |
| | | try { |
| | | pddGoods = PinDuoDuoApiUtil.getGoodsDetail(id, PinDuoDuoApiUtil.PID_FANLI, Constant.PDD_SEARCH_CUSTOMER_PARAMS); |
| | | pddGoods = PinDuoDuoApiUtil.getGoodsDetail(id, pid, Constant.PDD_SEARCH_CUSTOMER_PARAMS); |
| | | } catch (PDDApiException e1) { |
| | | } |
| | | } |
| | |
| | | return; |
| | | } |
| | | |
| | | ConfigParamsDTO paramsDTO = getParamsDTO(acceptData.getPlatform(), acceptData.getVersion(), uid, acceptData.getSystem()); |
| | | GoodsMoneyConfigParamsDTO paramsDTO = getParamsDTO(acceptData.getPlatform(), acceptData.getVersion(), uid, acceptData.getSystem()); |
| | | paramsDTO.setBaseFanliRate(hongBaoManageService.getBaseFanliRate(acceptData.getSystem())); |
| | | |
| | | GoodsDetailVO goodsDetail = GoodsDetailVOFactory.convertPDDGoods(pddGoods, paramsDTO); |
| | |
| | | CouponInfoVO couponInfo = goodsDetail.getCouponInfo(); |
| | | PDDConvertLinkResultVO convertUrl = null; |
| | | if (couponInfo != null) { |
| | | convertUrl = PinDuoDuoApiUtil.convert(pddGoods.getGoodsSign(), PinDuoDuoApiUtil.PID_COUPON + "", null, false); |
| | | convertUrl = PinDuoDuoApiUtil.convert(pddGoods.getGoodsSign(), pidManager.getPidCache(acceptData.getSystem(), Constant.SOURCE_TYPE_PDD, SystemPIDInfo.PidType.coupon), null, false); |
| | | if (convertUrl != null) |
| | | couponInfo.setLink(convertUrl.getUrl()); |
| | | } |
| | |
| | | return; |
| | | } |
| | | |
| | | ConfigParamsDTO paramsDTO = getParamsDTO(acceptData.getPlatform(), acceptData.getVersion(), uid, acceptData.getSystem()); |
| | | GoodsMoneyConfigParamsDTO paramsDTO = getParamsDTO(acceptData.getPlatform(), acceptData.getVersion(), uid, acceptData.getSystem()); |
| | | paramsDTO.setBaseFanliRate(hongBaoManageService.getBaseFanliRate(acceptData.getSystem())); |
| | | |
| | | GoodsDetailVO goodsDetail = GoodsDetailVOFactory.convertVIPGoods(vipGoodsInfo, paramsDTO); |
| | |
| | | return; |
| | | } |
| | | |
| | | ConfigParamsDTO paramsDTO = getParamsDTO(acceptData.getPlatform(), acceptData.getVersion(), uid, acceptData.getSystem()); |
| | | GoodsMoneyConfigParamsDTO paramsDTO = getParamsDTO(acceptData.getPlatform(), acceptData.getVersion(), uid, acceptData.getSystem()); |
| | | paramsDTO.setBaseFanliRate(hongBaoManageService.getBaseFanliRate(acceptData.getSystem())); |
| | | |
| | | GoodsDetailVO goodsDetail = GoodsDetailVOFactory.convertSuningGoods(suningGoodsInfo, paramsDTO); |
| | |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "getRecommendGoods", method = RequestMethod.POST) |
| | | public void getRecommendGoods(AcceptData acceptData, String id, Integer goodsType, PrintWriter out) { |
| | | public void getRecommendGoods(AcceptData acceptData, String id, Long uid, Integer goodsType, PrintWriter out) { |
| | | if (goodsType == null) { |
| | | goodsType = Constant.SOURCE_TYPE_TAOBAO; |
| | | } |
| | |
| | | list = list.subList(0, 10); |
| | | } |
| | | |
| | | ConfigParamsDTO paramsDTO = getParamsDTO(acceptData.getPlatform(), acceptData.getVersion(), null, acceptData.getSystem()); |
| | | List<GoodsDetailVO> listDetailVO = new ArrayList<GoodsDetailVO>(); |
| | | |
| | | for (JDGoods goods : list) { |
| | | listDetailVO.add(GoodsDetailVOFactory.convertJDGoods(goods, paramsDTO)); |
| | | } |
| | | GoodsMoneyConfigParamsDTO paramsDTO = getParamsDTO(acceptData.getPlatform(), acceptData.getVersion(), null, acceptData.getSystem()); |
| | | List<GoodsDetailVO> listDetailVO = goodsLijinMnager.loadOtherMoneyInfo(acceptData.getSystem(), uid, list, paramsDTO); //new ArrayList<GoodsDetailVO>(); |
| | | |
| | | // 取偶数个数据 |
| | | if (listDetailVO.size() % 2 != 0) { |
| | |
| | | goodsList = goodsList.subList(0, 10); |
| | | } |
| | | |
| | | ConfigParamsDTO paramsDTO = getParamsDTO(acceptData.getPlatform(), acceptData.getVersion(), |
| | | GoodsMoneyConfigParamsDTO paramsDTO = getParamsDTO(acceptData.getPlatform(), acceptData.getVersion(), |
| | | null, acceptData.getSystem()); |
| | | for (PDDGoodsDetail goods : goodsList) { |
| | | listDetailVO.add(GoodsDetailVOFactory.convertPDDGoods(goods, paramsDTO)); |
| | | } |
| | | listDetailVO = goodsLijinMnager.loadOtherMoneyInfo(acceptData.getSystem(), uid, goodsList, paramsDTO); |
| | | } |
| | | } |
| | | } |
| | |
| | | List<GoodsDetailVO> listDetailVO = new ArrayList<GoodsDetailVO>(); |
| | | if (resultList != null) { |
| | | if (resultList != null && resultList.size() > 0) { |
| | | ConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate(acceptData.getPlatform(), |
| | | GoodsMoneyConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate(acceptData.getPlatform(), |
| | | acceptData.getVersion(), acceptData.getSystem()); |
| | | |
| | | for (SuningGoodsInfo goods : resultList) { |
| | | GoodsDetailVO goodsDetailVO = GoodsDetailVOFactory.convertSuningGoods(goods, paramsDTO); |
| | | listDetailVO.add(goodsDetailVO); |
| | | } |
| | | listDetailVO = goodsLijinMnager.loadOtherMoneyInfo(acceptData.getSystem(), uid, resultList, paramsDTO); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | List<GoodsDetailVO> listExtra = new ArrayList<GoodsDetailVO>(); |
| | | ConfigParamsDTO paramsDTO = getParamsDTO(acceptData.getPlatform(), acceptData.getVersion(), null, acceptData.getSystem()); |
| | | goodsList.parallelStream().forEach(goods -> { |
| | | if (goods != null) { |
| | | listExtra.add(GoodsDetailVOFactory.convertTaoBao(goods, paramsDTO)); |
| | | } |
| | | }); |
| | | GoodsMoneyConfigParamsDTO paramsDTO = getParamsDTO(acceptData.getPlatform(), acceptData.getVersion(), null, acceptData.getSystem()); |
| | | |
| | | listExtra = goodsLijinMnager.loadTBMoneyInfo(acceptData.getSystem(), uid, goodsList, paramsDTO); |
| | | |
| | | List<GoodsDetailVO> listQuality = new ArrayList<GoodsDetailVO>(); |
| | | // 取偶数个数据 |
| | |
| | | } |
| | | String jumpLink = null; |
| | | String materialId = "https://item.jd.com/" + id + ".html"; |
| | | String pid = pidManager.getPidCache(acceptData.getSystem(), Constant.SOURCE_TYPE_JD, SystemPIDInfo.PidType.coupon); |
| | | if (StringUtil.isNullOrEmpty(couponUrl)) { |
| | | JDCouponInfo couponInfo = JDUtil.getShowCouponInfo(goods.getCouponInfoList(), goods.getPrice()); |
| | | if (couponInfo != null) { |
| | | couponUrl = couponInfo.getLink(); |
| | | } |
| | | jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, null, JDApiUtil.POSITION_COUPON + "", |
| | | |
| | | |
| | | jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, null, pid, |
| | | ""); |
| | | if (jumpLink == null) { |
| | | jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, null, null, JDApiUtil.POSITION_COUPON + "", |
| | | jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, null, null, pid, |
| | | ""); |
| | | } |
| | | } else { |
| | | jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, null, JDApiUtil.POSITION_COUPON + "", |
| | | jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, null, pid, |
| | | ""); |
| | | if (StringUtil.isNullOrEmpty(jumpLink)) { |
| | | jumpLink = couponUrl; |
| | |
| | | |
| | | String jumpLink = null; |
| | | String materialId = "https://item.jd.com/" + id + ".html"; |
| | | |
| | | String pid = pidManager.getPidCache(acceptData.getSystem(), Constant.SOURCE_TYPE_JD, SystemPIDInfo.PidType.fanli); |
| | | |
| | | if (StringUtil.isNullOrEmpty(couponUrl)) { |
| | | JDCouponInfo couponInfo = JDUtil.getShowCouponInfo(goods.getCouponInfoList(), goods.getPrice()); |
| | | if (couponInfo != null) { |
| | | couponUrl = couponInfo.getLink(); |
| | | } |
| | | jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, null, JDApiUtil.POSITION_FANLI + "", |
| | | jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, null, pid, |
| | | uid + ""); |
| | | if (jumpLink == null) { |
| | | jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, null, null, JDApiUtil.POSITION_FANLI + "", |
| | | jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, null, null, pid, |
| | | uid + ""); |
| | | } |
| | | } else { |
| | | jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, null, JDApiUtil.POSITION_FANLI + "", |
| | | jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, null, pid, |
| | | uid + ""); |
| | | if (StringUtil.isNullOrEmpty(jumpLink)) { |
| | | jumpLink = couponUrl; |
| | |
| | | } |
| | | JSONObject data = JSONObject.fromObject(new Gson().toJson(vo)); |
| | | data.put("native", vo.is_native()); |
| | | data.put("userLevel", userLijinMnager.getUserLevelInfo(uid, acceptData.getSystem())); |
| | | out.print(JsonUtil.loadTrueResult(data)); |
| | | |
| | | // 获得金币 |
| | |
| | | String jumpLink = null; |
| | | String materialId = "https://item.jd.com/" + id + ".html"; |
| | | |
| | | jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, null, JDApiUtil.POSITION_FANLI + "", null); |
| | | jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, null, pidManager.getPidCache(acceptData.getSystem(), Constant.SOURCE_TYPE_JD, SystemPIDInfo.PidType.fanli), null); |
| | | if (StringUtil.isNullOrEmpty(jumpLink)) { |
| | | jumpLink = couponUrl; |
| | | } |
| | |
| | | return; |
| | | } |
| | | |
| | | String pid = PinDuoDuoApiUtil.PID_FANLI; |
| | | String pid = pidManager.getPidCache(acceptData.getSystem(), Constant.SOURCE_TYPE_PDD, SystemPIDInfo.PidType.fanli); |
| | | //只是领券 |
| | | if (!SystemInfoUtil.hasFunctions(acceptData.getSystem(), SystemFunction.fanli)) { |
| | | pid = PinDuoDuoApiUtil.PID_COUPON; |
| | | pid = pidManager.getPidCache(acceptData.getSystem(), Constant.SOURCE_TYPE_PDD, SystemPIDInfo.PidType.coupon); |
| | | uid = null; |
| | | } else { |
| | | if (uid == null || uid <= 0) { |
| | |
| | | } |
| | | data = JSONObject.fromObject(new Gson().toJson(vo)); |
| | | data.put("native", vo.is_native()); |
| | | data.put("userLevel", userLijinMnager.getUserLevelInfo(uid, acceptData.getSystem())); |
| | | out.print(JsonUtil.loadTrueResult(data)); |
| | | |
| | | // 获得金币 |
| | |
| | | |
| | | JSONObject data = JSONObject.fromObject(new Gson().toJson(vo)); |
| | | data.put("native", vo.is_native()); |
| | | data.put("userLevel", userLijinMnager.getUserLevelInfo(uid, acceptData.getSystem())); |
| | | out.print(JsonUtil.loadTrueResult(data)); |
| | | // 获得金币 |
| | | integralGetService.addCouponRebate(uid); |
| | |
| | | return; |
| | | } |
| | | |
| | | String pid = SuningApiUtil.PID_BUY; |
| | | String pid = pidManager.getPidCache(acceptData.getSystem(), Constant.SOURCE_TYPE_SUNING, SystemPIDInfo.PidType.fanli); |
| | | if (!SystemInfoUtil.hasFunctions(acceptData.getSystem(), SystemFunction.fanli)) { |
| | | pid = SuningApiUtil.PID_COUPON; |
| | | pid = pidManager.getPidCache(acceptData.getSystem(), Constant.SOURCE_TYPE_SUNING, SystemPIDInfo.PidType.coupon); |
| | | uid = null; |
| | | } else { |
| | | if (uid == null || uid <= 0) { |
| | |
| | | |
| | | JSONObject data = JSONObject.fromObject(new Gson().toJson(vo)); |
| | | data.put("native", vo.is_native()); |
| | | data.put("userLevel", userLijinMnager.getUserLevelInfo(uid, acceptData.getSystem())); |
| | | out.print(JsonUtil.loadTrueResult(data)); |
| | | |
| | | |
| | |
| | | |
| | | Map<String, GoodsDetailVO> tempGoodsList = new HashMap<>(); |
| | | |
| | | ConfigParamsDTO params = new ConfigParamsDTO(hongBaoManageService.getFanLiRate(acceptData.getSystem()), |
| | | GoodsMoneyConfigParamsDTO params = new GoodsMoneyConfigParamsDTO(hongBaoManageService.getFanLiRate(acceptData.getSystem()), |
| | | hongBaoManageService.getShareRate(acceptData.getSystem()), new BigDecimal(80), |
| | | hongBaoManageService.getFanLiRate(UserLevelEnum.superVIP, acceptData.getSystem())); |
| | | |
| | |
| | | return; |
| | | } |
| | | |
| | | link = JDApiUtil.convertLinkWithSubUnionId(link, null, null, JDApiUtil.POSITION_FANLI + "", uid + ""); |
| | | link = JDApiUtil.convertLinkWithSubUnionId(link, null, null, pidManager.getPidCache(acceptData.getSystem(), Constant.SOURCE_TYPE_JD, SystemPIDInfo.PidType.fanli), uid + ""); |
| | | |
| | | |
| | | GoodsJumpLinkVO vo = new GoodsJumpLinkVO(); |