| | |
| | | package com.yeshi.fanli.controller.client.v2; |
| | | |
| | | import java.io.PrintWriter; |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.math.BigDecimal; |
| | | import java.net.URLDecoder; |
| | | import java.net.URLEncoder; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | |
| | | import com.yeshi.fanli.entity.SystemEnum; |
| | | import com.yeshi.fanli.entity.SystemFunction; |
| | | import com.yeshi.fanli.exception.pdd.PDDApiException; |
| | | import com.yeshi.fanli.lijin.manager.GoodsLijinMnager; |
| | | import com.yeshi.fanli.service.inter.pdd.PDDAuthService; |
| | | import com.yeshi.fanli.service.inter.user.tb.UserExtraTaoBaoInfoService; |
| | | import com.yeshi.fanli.util.*; |
| | | import com.yeshi.fanli.vo.common.WXXCXJumpInfoVO; |
| | | import com.yeshi.fanli.vo.pdd.PDDConvertLinkResultVO; |
| | | import com.yeshi.fanli.vo.goods.GoodsJumpLinkVO; |
| | | import com.yeshi.fanli.vo.suning.SuningConvertLinkResult; |
| | | import org.json.simple.JSONArray; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | |
| | | 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; |
| | | import com.yeshi.fanli.dto.pdd.PDDGoodsResult; |
| | | import com.yeshi.fanli.dto.pdd.PDDPromotionUrl; |
| | | import com.yeshi.fanli.dto.pdd.PDDSearchFilter; |
| | | import com.yeshi.fanli.dto.suning.SuningGoodsInfo; |
| | | import com.yeshi.fanli.dto.suning.SuningGoodsInfoRecommend; |
| | |
| | | import com.yeshi.fanli.service.inter.dynamic.GoodsEvaluateService; |
| | | import com.yeshi.fanli.service.inter.goods.CollectionGoodsV2Service; |
| | | import com.yeshi.fanli.service.inter.goods.ScanHistoryV2Service; |
| | | import com.yeshi.fanli.service.inter.goods.TaoBaoGoodsBriefService; |
| | | import com.yeshi.fanli.service.inter.jd.JDGoodsClassService; |
| | | import com.yeshi.fanli.service.inter.money.UserMoneyExtraService; |
| | | import com.yeshi.fanli.service.inter.order.OrderHongBaoMoneyComputeService; |
| | | import com.yeshi.fanli.service.inter.order.config.HongBaoManageService; |
| | | import com.yeshi.fanli.service.inter.redpack.UserTaoLiJinNewbiesService; |
| | | import com.yeshi.fanli.service.inter.taobao.TLJBuyGoodsService; |
| | | import com.yeshi.fanli.service.inter.taobao.TLJFreeBuyGoodsService; |
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoGoodsUpdateService; |
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoShopService; |
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoUnionConfigService; |
| | | import com.yeshi.goods.facade.service.DaTaoKeGoodsDetailV2Service; |
| | | import com.yeshi.fanli.service.inter.tlj.ConfigTaoLiJinService; |
| | | import com.yeshi.fanli.service.inter.user.ShamUserService; |
| | | import com.yeshi.fanli.service.inter.user.TBPidService; |
| | | import com.yeshi.fanli.service.inter.user.UserGoodsStorageService; |
| | | import com.yeshi.fanli.service.inter.user.UserInfoExtraService; |
| | | import com.yeshi.fanli.service.inter.user.UserInfoService; |
| | | import com.yeshi.fanli.service.inter.user.integral.IntegralGetService; |
| | | import com.yeshi.fanli.service.inter.user.vip.UserVIPInfoService; |
| | |
| | | @Resource |
| | | private PDDAuthService pddAuthService; |
| | | |
| | | private ConfigParamsDTO getParamsDTO(String platform, String version, Long uid, SystemEnum system) { |
| | | @Resource |
| | | private GoodsLijinMnager goodsLijinMnager; |
| | | |
| | | private GoodsMoneyConfigParamsDTO getParamsDTO(String platform, String version, Long uid, SystemEnum system) { |
| | | UserLevelEnum level = UserLevelEnum.daRen; |
| | | if (uid != null && uid > 0) { |
| | | level = userLevelManager.getUserLevel(uid); |
| | |
| | | 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)) { |
| | |
| | | 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); |
| | |
| | | goodsDetail.setOtherInfo(otherInfo); |
| | | |
| | | CouponInfoVO couponInfo = goodsDetail.getCouponInfo(); |
| | | PDDPromotionUrl convertUrl = null; |
| | | PDDConvertLinkResultVO convertUrl = null; |
| | | if (couponInfo != null) { |
| | | convertUrl = PinDuoDuoApiUtil.convert(pddGoods.getGoodsSign(), PinDuoDuoApiUtil.PID_COUPON + "", null, false); |
| | | if (convertUrl != null) |
| | |
| | | object.put("goods", JsonUtil.getApiCommonGson().toJson(goodsDetail)); |
| | | out.print(JsonUtil.loadTrueResult(object.toString())); |
| | | |
| | | final PDDGoodsDetail fGoods=pddGoods; |
| | | final PDDGoodsDetail fGoods = pddGoods; |
| | | ThreadUtil.run(new Runnable() { |
| | | public void run() { |
| | | // 添加浏览记录 |
| | |
| | | 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>(); |
| | | // 取偶数个数据 |
| | |
| | | } |
| | | } |
| | | |
| | | JSONObject data = new JSONObject(); |
| | | data.put("native", true); |
| | | data.put("jumpLink", jumpLink); |
| | | GoodsJumpLinkVO vo = new GoodsJumpLinkVO(); |
| | | vo.set_native(true); |
| | | vo.setJumpLink(jumpLink); |
| | | vo.setNativeJumpLink(jumpLink); |
| | | try { |
| | | String wxPage = "pages/union/proxy/proxy?spreadUrl=" + URLEncoder.encode(jumpLink, "UTF-8"); |
| | | WXXCXJumpInfoVO wxxcxJumpInfoVO = new WXXCXJumpInfoVO(); |
| | | wxxcxJumpInfoVO.setUserName("gh_45b306365c3d"); |
| | | wxxcxJumpInfoVO.setPath(wxPage); |
| | | vo.setWxxcxJumpInfo(wxxcxJumpInfoVO); |
| | | } catch (UnsupportedEncodingException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | JSONObject data = JSONObject.fromObject(new Gson().toJson(vo)); |
| | | data.put("native", vo.is_native()); |
| | | out.print(JsonUtil.loadTrueResult(data)); |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | JSONObject data = new JSONObject(); |
| | | data.put("native", true); |
| | | data.put("jumpLink", jumpLink); |
| | | |
| | | GoodsJumpLinkVO vo = new GoodsJumpLinkVO(); |
| | | vo.set_native(true); |
| | | vo.setJumpLink(jumpLink); |
| | | vo.setNativeJumpLink(jumpLink); |
| | | try { |
| | | String wxPage = "pages/union/proxy/proxy?spreadUrl=" + URLEncoder.encode(jumpLink, "UTF-8"); |
| | | WXXCXJumpInfoVO wxxcxJumpInfoVO = new WXXCXJumpInfoVO(); |
| | | wxxcxJumpInfoVO.setUserName("gh_45b306365c3d"); |
| | | wxxcxJumpInfoVO.setPath(wxPage); |
| | | vo.setWxxcxJumpInfo(wxxcxJumpInfoVO); |
| | | } catch (UnsupportedEncodingException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | JSONObject data = JSONObject.fromObject(new Gson().toJson(vo)); |
| | | data.put("native", vo.is_native()); |
| | | out.print(JsonUtil.loadTrueResult(data)); |
| | | |
| | | // 获得金币 |
| | |
| | | return; |
| | | } |
| | | |
| | | //TODO 是否需要返回绑定链接 |
| | | String customParams = pddAuthService.getFanliCustomParams(uid); |
| | | boolean auth = PinDuoDuoApiUtil.isAuth(pid, customParams); |
| | | PDDPromotionUrl convertUrl = PinDuoDuoApiUtil.convert(goods.getGoodsSign(), pid + "", customParams, !auth); |
| | | JSONObject data = new JSONObject(); |
| | | data.put("native", true); |
| | | data.put("jumpLink", convertUrl.getUrl()); |
| | | data.put("nativeJumpLink", PinDuoDuoUtil.getAndroidNativeURI(convertUrl.getUrl())); |
| | | LogHelper.test(String.format("拼多多转链:uid:%s data:%s", uid + "", data.toString())); |
| | | PDDConvertLinkResultVO convertUrl = null; |
| | | if (!auth) { |
| | | convertUrl = PinDuoDuoApiUtil.getAuthLink(pid, customParams); |
| | | } else { |
| | | convertUrl = PinDuoDuoApiUtil.convert(goods.getGoodsSign(), pid + "", customParams, !auth); |
| | | LogHelper.test(String.format("拼多多转链:uid:%s data:%s", uid + "", data.toString())); |
| | | } |
| | | |
| | | GoodsJumpLinkVO vo = new GoodsJumpLinkVO(); |
| | | vo.set_native(true); |
| | | vo.setNativeJumpLink(PinDuoDuoUtil.getAndroidNativeURI(convertUrl.getUrl())); |
| | | vo.setJumpLink(convertUrl.getUrl()); |
| | | if (convertUrl.getWe_app_info() != null) { |
| | | WXXCXJumpInfoVO wxxcxJumpInfoVO = new WXXCXJumpInfoVO(); |
| | | wxxcxJumpInfoVO.setPath(convertUrl.getWe_app_info().getPage_path()); |
| | | wxxcxJumpInfoVO.setUserName(convertUrl.getWe_app_info().getUser_name()); |
| | | vo.setWxxcxJumpInfo(wxxcxJumpInfoVO); |
| | | } |
| | | data = JSONObject.fromObject(new Gson().toJson(vo)); |
| | | data.put("native", vo.is_native()); |
| | | out.print(JsonUtil.loadTrueResult(data)); |
| | | |
| | | // 获得金币 |
| | |
| | | } |
| | | |
| | | /** |
| | | * 拼多多购买链接 |
| | | * 唯品会购买链接 |
| | | * |
| | | * @param acceptData |
| | | * @param uid |
| | |
| | | } |
| | | |
| | | VIPConvertResultDTO convertUrl = VipShopApiUtil.convertLink(id + "", tag); |
| | | JSONObject data = new JSONObject(); |
| | | data.put("native", true); |
| | | data.put("jumpLink", convertUrl.getUrl()); |
| | | data.put("nativeJumpLink", convertUrl.getDeeplinkUrl()); |
| | | out.print(JsonUtil.loadTrueResult(data)); |
| | | |
| | | GoodsJumpLinkVO vo = new GoodsJumpLinkVO(); |
| | | vo.set_native(true); |
| | | vo.setJumpLink(convertUrl.getUrl()); |
| | | vo.setNativeJumpLink(convertUrl.getDeeplinkUrl()); |
| | | if (!StringUtil.isNullOrEmpty(convertUrl.getVipWxUrl())) { |
| | | WXXCXJumpInfoVO wxxcxJumpInfoVO = new WXXCXJumpInfoVO(); |
| | | wxxcxJumpInfoVO.setUserName("gh_8ed2afad9972"); |
| | | wxxcxJumpInfoVO.setPath(convertUrl.getVipWxUrl()); |
| | | vo.setWxxcxJumpInfo(wxxcxJumpInfoVO); |
| | | } |
| | | |
| | | JSONObject data = JSONObject.fromObject(new Gson().toJson(vo)); |
| | | data.put("native", vo.is_native()); |
| | | out.print(JsonUtil.loadTrueResult(data)); |
| | | // 获得金币 |
| | | integralGetService.addCouponRebate(uid); |
| | | } |
| | |
| | | String quanUrl = null; |
| | | if (!StringUtil.isNullOrEmpty(goods.getCouponInfo().getCouponUrl())) |
| | | quanUrl = goods.getCouponInfo().getCouponUrl(); |
| | | String link = SuningApiUtil.convertLink(SuningUtil.getProductUrl(supplierCode, goodsCode), quanUrl, |
| | | SuningConvertLinkResult link = SuningApiUtil.convertLinkNew(goodsCode, supplierCode, |
| | | pid, uid + ""); |
| | | JSONObject data = new JSONObject(); |
| | | data.put("native", false); |
| | | data.put("jumpLink", link); |
| | | |
| | | GoodsJumpLinkVO vo = new GoodsJumpLinkVO(); |
| | | vo.set_native(false); |
| | | try { |
| | | vo.setJumpLink(URLDecoder.decode(link.getWapExtendUrl(), "UTF-8")); |
| | | } catch (UnsupportedEncodingException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | if (!StringUtil.isNullOrEmpty(link.getSpPageUrl())) { |
| | | WXXCXJumpInfoVO wxxcxJumpInfoVO = new WXXCXJumpInfoVO(); |
| | | wxxcxJumpInfoVO.setUserName("gh_1d1e15e90afc"); |
| | | try { |
| | | wxxcxJumpInfoVO.setPath(URLDecoder.decode(link.getSpPageUrl(), "UTF-8")); |
| | | } catch (UnsupportedEncodingException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | vo.setWxxcxJumpInfo(wxxcxJumpInfoVO); |
| | | } |
| | | |
| | | JSONObject data = JSONObject.fromObject(new Gson().toJson(vo)); |
| | | data.put("native", vo.is_native()); |
| | | out.print(JsonUtil.loadTrueResult(data)); |
| | | |
| | | |
| | | // 获得金币 |
| | | integralGetService.addCouponRebate(uid); |
| | |
| | | |
| | | 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())); |
| | | |
| | |
| | | |
| | | link = JDApiUtil.convertLinkWithSubUnionId(link, null, null, JDApiUtil.POSITION_FANLI + "", uid + ""); |
| | | |
| | | JSONObject data = new JSONObject(); |
| | | data.put("link", link); |
| | | |
| | | GoodsJumpLinkVO vo = new GoodsJumpLinkVO(); |
| | | vo.set_native(true); |
| | | vo.setJumpLink(link); |
| | | vo.setNativeJumpLink(link); |
| | | try { |
| | | String wxPage = "pages/union/proxy/proxy?spreadUrl=" + URLEncoder.encode(link, "UTF-8"); |
| | | WXXCXJumpInfoVO wxxcxJumpInfoVO = new WXXCXJumpInfoVO(); |
| | | wxxcxJumpInfoVO.setUserName("gh_45b306365c3d"); |
| | | wxxcxJumpInfoVO.setPath(wxPage); |
| | | vo.setWxxcxJumpInfo(wxxcxJumpInfoVO); |
| | | } catch (UnsupportedEncodingException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | |
| | | JSONObject data = JSONObject.fromObject(new Gson().toJson(vo)); |
| | | data.put("native", vo.is_native()); |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data)); |
| | | } |
| | | |