| | |
| | | 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.dto.taobao.DaTaoKeFilterResult;
|
| | | import com.yeshi.fanli.dto.vip.VIPConvertResultDTO;
|
| | | import com.yeshi.fanli.dto.vip.goods.VIPGoodsInfo;
|
| | |
| | |
|
| | |
|
| | | if (VersionUtil.greaterThan_2_1_2(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | | getCloudInfo(goodsDetail, extraVO); // 云发单文案信息
|
| | | getCloudInfo(acceptData, goodsDetail, extraVO); // 云发单文案信息
|
| | | }
|
| | |
|
| | | JSONObject object = new JSONObject();
|
| | |
| | | // 商品链接
|
| | | String h5Url = String.format("http://%s%s?uid=%s&id=%s", configService.getH5Host(),
|
| | | Constant.systemCommonConfig.getShareGoodsPagePathJD(), "", id + "");
|
| | | // try {
|
| | | // extraVO.setH5Url(HttpUtil.getShortLink(h5Url));
|
| | | // } catch (Exception e) {
|
| | | extraVO.setH5Url(h5Url);
|
| | | // }
|
| | | // try {
|
| | | // extraVO.setH5Url(HttpUtil.getShortLink(h5Url));
|
| | | // } catch (Exception e) {
|
| | | extraVO.setH5Url(h5Url);
|
| | | // }
|
| | |
|
| | | String helpLink = null;
|
| | | extraVO.setFanliValid(true);
|
| | |
| | | extraVO.setShare(shareInfoVO);
|
| | |
|
| | | if (VersionUtil.greaterThan_2_1_2(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | | getCloudInfo(goodsDetail, extraVO); // 云发单文案信息
|
| | | getCloudInfo(acceptData, goodsDetail, extraVO); // 云发单文案信息
|
| | | }
|
| | |
|
| | | JSONObject object = new JSONObject();
|
| | |
| | | // 分享路径
|
| | | String h5Url = String.format("http://%s%s?uid=%s&id=%s", configService.getH5Host(),
|
| | | Constant.systemCommonConfig.getShareGoodsPagePathPDD(), "", id + "");
|
| | | // try {
|
| | | // extraVO.setH5Url(HttpUtil.getShortLink(h5Url));
|
| | | // } catch (Exception e) {
|
| | | extraVO.setH5Url(h5Url);
|
| | | // }
|
| | | // try {
|
| | | // extraVO.setH5Url(HttpUtil.getShortLink(h5Url));
|
| | | // } catch (Exception e) {
|
| | | extraVO.setH5Url(h5Url);
|
| | | // }
|
| | |
|
| | | String helpLink = null;
|
| | | extraVO.setFanliValid(true);
|
| | |
| | | }
|
| | |
|
| | | if (VersionUtil.greaterThan_2_1_2(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | | getCloudInfo(goodsDetail, extraVO); // 云发单文案信息
|
| | | getCloudInfo(acceptData, goodsDetail, extraVO); // 云发单文案信息
|
| | | }
|
| | |
|
| | | JSONObject object = new JSONObject();
|
| | |
| | | // 分享路径
|
| | | String h5Url = String.format("http://%s%s?uid=%s&id=%s", configService.getH5Host(),
|
| | | Constant.systemCommonConfig.getShareGoodsPagePathPDD(), "", id + "");
|
| | | // try {
|
| | | // extraVO.setH5Url(HttpUtil.getShortLink(h5Url));
|
| | | // } catch (Exception e) {
|
| | | extraVO.setH5Url(h5Url);
|
| | | // }
|
| | | // try {
|
| | | // extraVO.setH5Url(HttpUtil.getShortLink(h5Url));
|
| | | // } catch (Exception e) {
|
| | | extraVO.setH5Url(h5Url);
|
| | | // }
|
| | |
|
| | | String helpLink = null;
|
| | | extraVO.setFanliValid(true);
|
| | |
| | | extraVO.setShare(shareInfoVO);
|
| | |
|
| | | // 云发单文案信息
|
| | | getCloudInfo(goodsDetail, extraVO); |
| | | getCloudInfo(acceptData, goodsDetail, extraVO); |
| | |
|
| | | JSONObject object = new JSONObject();
|
| | | object.put("extra", JsonUtil.getApiCommonGson().toJson(extraVO));
|
| | |
| | | extraVO.setShare(shareInfoVO);
|
| | |
|
| | | // 云发单文案信息
|
| | | getCloudInfo(goodsDetail, extraVO); |
| | | getCloudInfo(acceptData, goodsDetail, extraVO); |
| | |
|
| | | JSONObject object = new JSONObject();
|
| | | object.put("extra", JsonUtil.getApiCommonGson().toJson(extraVO));
|
| | |
| | | * // 云发单文案信息
|
| | | * @param goodsDetail
|
| | | */
|
| | | private void getCloudInfo(GoodsDetailVO goodsDetail, GoodsDetailExtraVO extraVO) {
|
| | | private void getCloudInfo(AcceptData acceptData, GoodsDetailVO goodsDetail, GoodsDetailExtraVO extraVO) {
|
| | | // 云发单是否开启
|
| | | String cloudState = configService.getByVersion(ConfigKeyEnum.robotCloudOpen.getKey(), acceptData.getPlatform(),
|
| | | Integer.parseInt(acceptData.getVersion()));
|
| | | if (!StringUtil.isNullOrEmpty(cloudState) && "1".equals(cloudState)) {
|
| | | extraVO.setCloudOpen(true);
|
| | | }
|
| | | |
| | | |
| | | if (!goodsDetail.isHasCoupon()) {
|
| | | return;
|
| | | }
|
| | | |
| | | GoodsEvaluate evaluate = goodsEvaluateService.queryExistSingle(goodsDetail.getGoodsId() +"", goodsDetail.getGoodsType());
|
| | | if (evaluate != null) {
|
| | | String cloudText = null;
|
| | |
| | | }
|
| | |
|
| | | try {
|
| | |
|
| | | // 京东
|
| | | if (goodsType == Constant.SOURCE_TYPE_JD) {
|
| | | JSONObject data = new JSONObject();
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | if (goodsType == Constant.SOURCE_TYPE_SUNING) {
|
| | | // 猜你喜欢
|
| | |
|
| | | // 唯品会
|
| | | if (goodsType == Constant.SOURCE_TYPE_VIP) {
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("listGuess", JsonUtil.getApiCommonGson().toJson(new ArrayList<GoodsDetailVO>()));
|
| | | data.put("listQuality", JsonUtil.getApiCommonGson().toJson(new ArrayList<GoodsDetailVO>()));
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | return;
|
| | | }
|
| | | |
| | | // 苏宁
|
| | | if (goodsType == Constant.SOURCE_TYPE_SUNING) {
|
| | | List<SuningGoodsInfo> resultList = null;
|
| | | String[] ids = SuningUtil.getGoodsIdDetail(id);
|
| | | List<SuningGoodsInfoRecommend> list = SuningApiUtil.getRecommendGoods(ids[1], ids[0]);
|
| | | if (list != null && list.size() > 0) {
|
| | | List<String> listId = new ArrayList<>();
|
| | | for (SuningGoodsInfoRecommend goodsInfo: list) {
|
| | | if (goodsInfo != null) {
|
| | | listId.add(goodsInfo.getCommodityCode() + "-" + goodsInfo.getSupplierCode());
|
| | | }
|
| | | }
|
| | | resultList = SuningApiUtil.getGoodsDetailList(listId);
|
| | | }
|
| | | |
| | | List<GoodsDetailVO> listDetailVO = new ArrayList<GoodsDetailVO>();
|
| | | if (resultList != null) {
|
| | | if (resultList != null && resultList.size() > 0) {
|
| | | ConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate(acceptData.getPlatform(),
|
| | | acceptData.getVersion());
|
| | |
|
| | | for (SuningGoodsInfo goods : resultList) {
|
| | | GoodsDetailVO goodsDetailVO = GoodsDetailVOFactory.convertSuningGoods(goods, paramsDTO);
|
| | | listDetailVO.add(goodsDetailVO);
|
| | | }
|
| | | }
|
| | | }
|
| | | |
| | | JSONObject data = new JSONObject();
|
| | | data.put("listQuality", JsonUtil.getApiCommonGson().toJson(listDetailVO));
|
| | | data.put("listGuess", JsonUtil.getApiCommonGson().toJson(new ArrayList<GoodsDetailVO>()));
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | return;
|
| | | }
|
| | | |
| | | List<TaoBaoGoodsBrief> goodsList = TaoKeApiUtil.guessLikeByAuctionId(Long.parseLong(id), 10);
|
| | | // 初始化
|
| | | if (goodsList == null) {
|
| | |
| | | }
|
| | |
|
| | | List<GoodsDetailVO> listExtra = new ArrayList<GoodsDetailVO>();
|
| | | TaoKeAppInfo app = new TaoKeAppInfo();
|
| | | app.setAppKey(TaoBaoConstant.TAOBAO_AUTH_APPKEY);
|
| | | app.setAppSecret(TaoBaoConstant.TAOBAO_AUTH_APPSECRET);
|
| | | app.setAdzoneId(TaoBaoConstant.TAOBAO_SPECIAL_PID_DEFAULT.split("_")[3]);
|
| | | app.setPid(TaoBaoConstant.TAOBAO_SPECIAL_PID_DEFAULT);
|
| | |
|
| | | List<Long> ids = new ArrayList<>();
|
| | | for (TaoBaoGoodsBrief goods : goodsList)
|
| | | ids.add(goods.getAuctionId());
|
| | |
|
| | | try {
|
| | | goodsList = TaoKeApiUtil.getBatchGoodsInfo(ids);
|
| | | } catch (TaoKeApiException e1) {
|
| | | } catch (TaobaoGoodsDownException e1) {
|
| | | }
|
| | |
|
| | | if (goodsList != null && goodsList.size() > 0) {
|
| | |
|
| | | ConfigParamsDTO paramsDTO = getParamsDTO(acceptData.getPlatform(), acceptData.getVersion(), null);
|
| | |
|
| | | goodsList.parallelStream().forEach(goods -> {
|
| | | if (goods != null) {
|
| | | // 获取详情
|
| | | TaoBaoGoodsBrief taoBaoGoodsBrief = null;
|
| | | try {
|
| | | taoBaoGoodsBrief = taoBaoGoodsCacheUtil.getCommonTaoBaoGoodsInfo(goods.getAuctionId());
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | if (taoBaoGoodsBrief == null) {
|
| | | TaoBaoGoodsBrief newGoods = TaoKeApiUtil.specialConvertCoupon(goods.getAuctionId(), app);
|
| | | goods.setCouponInfo(newGoods.getCouponInfo());
|
| | | goods.setCouponLink(newGoods.getCouponLink());
|
| | | goods.setTkRate(newGoods.getTkRate());
|
| | | taoBaoGoodsBrief = goods;
|
| | | }
|
| | |
|
| | | if (taoBaoGoodsBrief != null) {
|
| | | listExtra.add(GoodsDetailVOFactory.convertTaoBao(taoBaoGoodsBrief, paramsDTO));
|
| | | }
|
| | | }
|
| | | });
|
| | | }
|
| | | ConfigParamsDTO paramsDTO = getParamsDTO(acceptData.getPlatform(), acceptData.getVersion(), null);
|
| | | goodsList.parallelStream().forEach(goods -> {
|
| | | if (goods != null) { |
| | | listExtra.add(GoodsDetailVOFactory.convertTaoBao(goods, paramsDTO));
|
| | | }
|
| | | });
|
| | |
|
| | | List<GoodsDetailVO> listQuality = new ArrayList<GoodsDetailVO>();
|
| | | // 取偶数个数据
|
| | |
| | | } else {
|
| | | jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, JDApiUtil.POSITION_FANLI + "",
|
| | | uid + "");
|
| | | if (StringUtil.isNullOrEmpty(jumpLink)) {
|
| | | jumpLink = couponUrl;
|
| | | }
|
| | | }
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | |
| | | String materialId = "https://item.jd.com/" + id + ".html";
|
| | |
|
| | | jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, JDApiUtil.POSITION_FANLI + "", null);
|
| | | if (StringUtil.isNullOrEmpty(jumpLink)) {
|
| | | jumpLink = couponUrl;
|
| | | }
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("native", true);
|
| | |
| | | } else {
|
| | | data.put("extend", true);
|
| | | }
|
| | | } else if (goodsType == Constant.SOURCE_TYPE_VIP) {
|
| | | VIPGoodsInfo goods = VipShopApiUtil.getGoodsDetail(goodsId);
|
| | | if (goods == null) {
|
| | | data.put("extend", false);
|
| | | data.put("url","");
|
| | | } else {
|
| | | data.put("extend", true);
|
| | | }
|
| | | } else if (goodsType == Constant.SOURCE_TYPE_SUNING) {
|
| | | SuningGoodsInfo goods = SuningApiUtil.getGoodsDetail(goodsId.split("-")[1], goodsId.split("-")[0]);
|
| | | if (goods == null) {
|
| | | data.put("extend", false);
|
| | | data.put("url", String.format("https://m.suning.com/product/%s/%s.html", goodsId.split("-")[0],goodsId.split("-")[1]));
|
| | | } else {
|
| | | data.put("extend", true);
|
| | | }
|
| | | }
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|