| | |
| | |
|
| | | @Resource
|
| | | private TLJBuyGoodsService tljBuyGoodsService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private UserInfoService userInfoService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private JDGoodsCacheUtil jdGoodsCacheUtil;
|
| | |
|
| | | @Resource
|
| | | private PinDuoDuoCacheUtil pinDuoDuoCacheUtil;
|
| | |
|
| | | |
| | | /**
|
| | | * 淘宝商品详情
|
| | | * |
| | | * @param acceptData
|
| | | * @param id
|
| | | * @param uid
|
| | |
| | | out.print(JsonUtil.loadFalseResult(1, "商品id不能为空"));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(),
|
| | | acceptData.getPackages());
|
| | | if (system == null) {
|
| | |
| | | } catch (Exception e) {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | | |
| | | |
| | |
|
| | | BigDecimal fanLiRate = hongBaoManageService.getFanLiRate();
|
| | | BigDecimal shareRate = hongBaoManageService.getShareRate();
|
| | | GoodsDetailVO goodsDetail = GoodsDetailVOFactory.convertTaoBao(goods, null, fanLiRate, shareRate);
|
| | | |
| | |
|
| | | // 店铺信息
|
| | | TaoBaoShop shop = taoBaoShopService.getTaoBaoShop(id, goods.getSellerId());
|
| | | if (shop != null) {
|
| | |
| | | }
|
| | | goodsDetail.setShopInfo(ShopInfoVOFactory.convertTaoBaoShop(shop));
|
| | | }
|
| | | |
| | |
|
| | | // 有券处理
|
| | | if (goodsDetail.isHasCoupon()) {
|
| | | if (!StringUtil.isNullOrEmpty(from)) {
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | extraVO.setTbPidInfo(clientTBPid);
|
| | | extraVO.setDetailUrl("http://apph5.yeshitv.com/apppage/goods_img.html?id=" + id);
|
| | | |
| | |
|
| | | // 分享赚人提示
|
| | | MoneyInfoVO moneyInfo = goodsDetail.getMoneyInfo();
|
| | | List<ShamUser> listShareUser = new ArrayList<ShamUser>();
|
| | | if (moneyInfo != null) {
|
| | | String shareMoney = moneyInfo.getShareMoney();
|
| | | if (goods.getBiz30day() >= 1000) {
|
| | | listShareUser = shamUserService.listRandShareUser(10, new BigDecimal(shareMoney.replaceAll("¥", "")), 1, 5);
|
| | | listShareUser = shamUserService.listRandShareUser(10, new BigDecimal(shareMoney.replaceAll("¥", "")), 1,
|
| | | 5);
|
| | | }
|
| | | }
|
| | | extraVO.setListShareUser(listShareUser);
|
| | | |
| | | |
| | |
|
| | | // 领券人列表
|
| | | List<ShamUser> listCouponUser = new ArrayList<ShamUser>();
|
| | | if (!StringUtil.isNullOrEmpty(goods.getCouponInfo()) && goods.getCouponAmount() != null
|
| | |
| | | }
|
| | | }
|
| | | extraVO.setListCouponUser(listCouponUser);
|
| | | |
| | | |
| | |
|
| | | if (uid != null) {
|
| | | // 是否加入收藏
|
| | | CollectionGoodsV2 collectionGoods = collectionGoodsV2Service.findByUidAndAuctionId(uid, id,
|
| | |
| | | extraVO.setStorage(userGoodsStorageService.isExistStorage(uid, id, Constant.SOURCE_TYPE_TAOBAO));
|
| | | }
|
| | |
|
| | |
|
| | | // 测试
|
| | | SystemClientParams params = systemClientParamsService.getSystemClientParamsBySystemAndKey(system,
|
| | | "goods_detail_jump_taobao");
|
| | | if ("1".equalsIgnoreCase((params.getValue() + "").trim())) {
|
| | | extraVO.setIsNative(true);
|
| | | } |
| | | }
|
| | |
|
| | | String h5Url = String.format("http://%s%s?uid=%s&id=%s&appType=flq", configService.getH5Host(),
|
| | | Constant.systemCommonConfig.getShareGoodsPagePath(), "", id + "");
|
| | |
| | | boolean fanliValid = true;
|
| | | boolean shareValid = true;
|
| | | int moneyType = 1;
|
| | | |
| | |
|
| | | // 推广红包
|
| | | if (from != null && from.equals("taolijin")) {
|
| | | // 计算推广红包
|
| | |
| | | moneyType = 2;
|
| | | fanliValid = false;
|
| | | spreadHongBao.setMoney(spreadMoney.toString());
|
| | | |
| | |
|
| | | ClientTextStyleVO textStyleVO1 = new ClientTextStyleVO();
|
| | | textStyleVO1.setContent("分享");
|
| | | textStyleVO1.setColor("#666666");
|
| | |
| | | listText.add(textStyleVO4);
|
| | | extraVO.setTip(listText);
|
| | | }
|
| | | |
| | |
|
| | | spreadHongBao.setName("推广红包 ");
|
| | | spreadHongBao.setTip("当日领取,当日内使用,过期失效");
|
| | | OtherInfo otherInfo = new OtherInfo();
|
| | |
| | | fanliValid = true;
|
| | | shareValid = false;
|
| | | helpLink = configService.get("zigoulijian_nofanli_help");
|
| | | |
| | |
|
| | | String tljHongBao = TaoBaoUtil.getGoodsHongBaoMoney(goods, new BigDecimal(70)).toString();
|
| | | |
| | |
|
| | | ReduceHongBao reduceHongBao = new ReduceHongBao();
|
| | | reduceHongBao.setLeft(buyGoods.getLeftHongBaoCount());
|
| | | reduceHongBao.setMoney(tljHongBao);
|
| | | reduceHongBao.setName("付款立减 ");
|
| | | reduceHongBao.setTip("当日领取,当日内使用,过期失效");
|
| | | reduceHongBao.setTotal(buyGoods.getTotalHongBaoCount());
|
| | | |
| | | |
| | |
|
| | | OtherInfo otherInfo = new OtherInfo();
|
| | | otherInfo.setReduceHongBao(reduceHongBao);
|
| | | goodsDetail.setOtherInfo(otherInfo);
|
| | | }
|
| | | extraVO.setFanliValid(fanliValid);
|
| | | extraVO.setShareValid(shareValid);
|
| | | |
| | |
|
| | | MoneyInfoVO goodsMoney = goodsDetail.getMoneyInfo();
|
| | | if (goodsMoney != null) {
|
| | | goodsMoney.setMoneyType(moneyType);
|
| | | }
|
| | | |
| | | |
| | |
|
| | | // 分享路径
|
| | | if (StringUtil.isNullOrEmpty(helpLink)) {
|
| | | helpLink = configService.get("no_rebate_help_link");
|
| | | }
|
| | | |
| | |
|
| | | // 分享路径
|
| | | ShareVO shareInfoVO = new ShareVO();
|
| | | shareInfoVO.setHelpLink(helpLink);
|
| | |
| | | });
|
| | | }
|
| | |
|
| | |
|
| | | /**
|
| | | * 京东商品详情
|
| | | *
|
| | |
| | | JDGoods jdGoods = JDApiUtil.queryGoodsDetail(id); // 高级接口
|
| | | if (jdGoods == null) {
|
| | | jdGoods = JDUtil.getGoodsDetail(id); // 爬取网页
|
| | | //jdGoods = JDApiUtil.getGoodsDetail(id); // 普通接口
|
| | | // jdGoods = JDApiUtil.getGoodsDetail(id); // 普通接口
|
| | | }
|
| | | |
| | |
|
| | | if (jdGoods == null) {
|
| | | out.print(JsonUtil.loadFalseResult(2, "商品不存在"));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | List<String> imageList = jdGoods.getImageList();
|
| | | if (imageList == null) {
|
| | | imageList = new ArrayList<String>();
|
| | | imageList.add(jdGoods.getPicUrl());
|
| | | }
|
| | | |
| | |
|
| | | // 保存缓存
|
| | | jdGoodsCacheUtil.saveGoodsInfo(jdGoods);
|
| | |
|
| | |
| | | if (couponInfo != null) {
|
| | | // 券链接处理
|
| | | String materialId = "https://item.jd.com/" + id + ".html";
|
| | | String url = JDApiUtil.convertShortLink(materialId, couponInfo.getLink(), JDApiUtil.POSITION_COUPON+"", null);
|
| | | String url = JDApiUtil.convertShortLink(materialId, couponInfo.getLink(), JDApiUtil.POSITION_COUPON + "",
|
| | | null);
|
| | | couponInfo.setLink(url);
|
| | | }
|
| | | |
| | |
|
| | | ShopInfoVO shopInfo = goodsDetail.getShopInfo();
|
| | | if (shopInfo != null) {
|
| | | if (shopInfo.getId() == null || shopInfo.getScoreGoods() == null || shopInfo.getScoreLogistics() == null
|
| | |
| | | goodsDetail.setShopInfo(null);
|
| | | }
|
| | | }
|
| | | |
| | | |
| | |
|
| | | GoodsDetailExtraVO extraVO = new GoodsDetailExtraVO();
|
| | | extraVO.setIsNative(false);
|
| | | // IOS是否正在上线
|
| | |
| | | }
|
| | |
|
| | | // 图文详情
|
| | | extraVO.setDetailUrl("https://in.m.jd.com/product/jieshao/video/"+ id +".html");
|
| | | |
| | | extraVO.setDetailUrl("https://in.m.jd.com/product/jieshao/video/" + id + ".html");
|
| | |
|
| | | // 测试
|
| | | SystemClientParams params = systemClientParamsService.getSystemClientParamsBySystemAndKey(system,
|
| | | "goods_detail_jump_taobao");
|
| | |
| | | String url = PinDuoDuoApiUtil.convert(id, PinDuoDuoApiUtil.PID_COUPON + "", null);
|
| | | couponInfo.setLink(url);
|
| | | }
|
| | | |
| | |
|
| | | ShopInfoVO shopInfo = goodsDetail.getShopInfo();
|
| | | if (shopInfo != null) {
|
| | | if (shopInfo.getId() == null || shopInfo.getScoreGoods() == null || shopInfo.getScoreLogistics() == null
|
| | |
| | | goodsDetail.setShopInfo(null);
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | GoodsDetailExtraVO extraVO = new GoodsDetailExtraVO();
|
| | | extraVO.setIsNative(false);
|
| | | // IOS是否正在上线
|
| | |
| | | String version = acceptData.getVersion();
|
| | | extraVO.setIosOnling(configService.iosOnLining(Integer.parseInt(version)));
|
| | | }
|
| | | |
| | |
|
| | | // 图文详情
|
| | | extraVO.setDetailUrl("http://apph5.yeshitv.com/apppage/goods_img_pdd.html?id="+ id);
|
| | | |
| | | extraVO.setDetailUrl("http://apph5.yeshitv.com/apppage/goods_img_pdd.html?id=" + id);
|
| | |
|
| | | String salesTip = pddGoods.getSalesTip();
|
| | | if (!StringUtil.isNullOrEmpty(salesTip)) {
|
| | | int totalSales = 0;
|
| | | if (salesTip.contains("万")) {
|
| | | salesTip = salesTip.substring(0, salesTip.indexOf("万"));
|
| | | totalSales= (int) (Float.parseFloat(salesTip) * 10000);
|
| | | totalSales = (int) (Float.parseFloat(salesTip) * 10000);
|
| | | } else {
|
| | | totalSales = Integer.parseInt(salesTip);
|
| | | }
|
| | | |
| | |
|
| | | List<ShamUser> listShareUser = new ArrayList<ShamUser>();
|
| | | MoneyInfoVO moneyInfo = goodsDetail.getMoneyInfo();
|
| | | if (moneyInfo != null) {
|
| | |
| | | }
|
| | | extraVO.setListCouponUser(listCouponUser);
|
| | | }
|
| | | |
| | |
|
| | | if (uid != null) {
|
| | | // 是否加入收藏
|
| | | CollectionGoodsV2 collectionGoods = collectionGoodsV2Service.findByUidAndAuctionId(uid, id,
|
| | |
| | |
|
| | | // 分享路径
|
| | | String h5Url = String.format("http://%s%s?uid=%s&id=%s", configService.getH5Host(),
|
| | | Constant.systemCommonConfig.getShareGoodsPagePathPDD(), "", id + "");
|
| | | Constant.systemCommonConfig.getShareGoodsPagePathPDD(), "", id + "");
|
| | | try {
|
| | | extraVO.setH5Url(HttpUtil.getShortLink(h5Url));
|
| | | } catch (Exception e) {
|
| | |
| | | if (StringUtil.isNullOrEmpty(helpLink)) {
|
| | | helpLink = configService.get("no_rebate_help_link");
|
| | | }
|
| | | |
| | |
|
| | | ShareVO shareInfoVO = new ShareVO();
|
| | | shareInfoVO.setHelpLink(helpLink);
|
| | | extraVO.setShare(shareInfoVO);
|
| | |
| | | }
|
| | | });
|
| | | }
|
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 商品详情推荐(猜你喜欢 + 推荐)
|
| | | * 商品详情推荐(猜你喜欢 + 推荐)
|
| | | *
|
| | | * @param acceptData
|
| | | * @param id
|
| | |
| | | if (goodsType == null) {
|
| | | goodsType = Constant.SOURCE_TYPE_TAOBAO;
|
| | | }
|
| | | |
| | |
|
| | | // 京东
|
| | | if (goodsType == Constant.SOURCE_TYPE_JD) {
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("listGuess", JsonUtil.getApiCommonGson().toJson(new ArrayList<GoodsDetailVO>()));
|
| | | |
| | |
|
| | | List<JDGoods> list = JDUtil.getRecommendGoodsById(id);
|
| | | if (list == null) {
|
| | | list = new ArrayList<JDGoods>();
|
| | | } else if (list.size() > 10) {
|
| | | list = list.subList(0, 10);
|
| | | }
|
| | | |
| | |
|
| | | BigDecimal fanLiRate = hongBaoManageService.getFanLiRate();
|
| | | BigDecimal shareRate = hongBaoManageService.getShareRate();
|
| | | List<GoodsDetailVO> listDetailVO = new ArrayList<GoodsDetailVO>();
|
| | | |
| | | for (JDGoods goods: list) {
|
| | |
|
| | | for (JDGoods goods : list) {
|
| | | listDetailVO.add(GoodsDetailVOFactory.convertJDGoods(goods, fanLiRate, shareRate));
|
| | | }
|
| | | |
| | |
|
| | | // 取偶数个数据
|
| | | if (listDetailVO.size() % 2 != 0) {
|
| | | listDetailVO.remove(listDetailVO.size() - 1);
|
| | | }
|
| | | |
| | |
|
| | | data.put("listQuality", JsonUtil.getApiCommonGson().toJson(listDetailVO));
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | // 拼多多
|
| | | if (goodsType == Constant.SOURCE_TYPE_PDD) {
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("listGuess", JsonUtil.getApiCommonGson().toJson(new ArrayList<GoodsDetailVO>()));
|
| | | |
| | |
|
| | | List<GoodsDetailVO> listDetailVO = new ArrayList<GoodsDetailVO>();
|
| | | |
| | |
|
| | | List<Long> goodsIdList = PinDuoDuoUtil.getRecommendGoodsId(id);
|
| | | if (goodsIdList != null && goodsIdList.size() > 0) {
|
| | | PDDSearchFilter pddfilter = new PDDSearchFilter();
|
| | |
| | | pddfilter.setPageSize(Constant.PAGE_SIZE);
|
| | | Long[] strings = new Long[goodsIdList.size()];
|
| | | pddfilter.setGoodsIdList(goodsIdList.toArray(strings));
|
| | | |
| | |
|
| | | PDDGoodsResult result = PinDuoDuoApiUtil.searchGoods(pddfilter);
|
| | | if (result != null) {
|
| | | List<PDDGoodsDetail> goodsList = result.getGoodsList();
|
| | | if (goodsList != null && goodsList.size() > 0) {
|
| | | |
| | |
|
| | | if (goodsList.size() > 10) {
|
| | | goodsList = goodsList.subList(0, 10);
|
| | | }
|
| | | |
| | |
|
| | | BigDecimal fanLiRate = hongBaoManageService.getFanLiRate();
|
| | | BigDecimal shareRate = hongBaoManageService.getShareRate();
|
| | | for (PDDGoodsDetail goods : goodsList) {
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | // 取偶数个数据
|
| | | if (listDetailVO.size() % 2 != 0) {
|
| | | listDetailVO.remove(listDetailVO.size() - 1);
|
| | | }
|
| | | |
| | |
|
| | | data.put("listQuality", JsonUtil.getApiCommonGson().toJson(listDetailVO));
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | return;
|
| | | }
|
| | |
|
| | | |
| | | List<TaoBaoGoodsBrief> goodsList = TaoKeApiUtil.getRelationGoodsRecommend(id, 10);
|
| | | // 初始化
|
| | | if (goodsList == null) {
|
| | | goodsList = new ArrayList<TaoBaoGoodsBrief>();
|
| | | }
|
| | |
|
| | |
|
| | | List<GoodsDetailVO> listExtra = new ArrayList<GoodsDetailVO>();
|
| | | TaoKeAppInfo app = new TaoKeAppInfo();
|
| | |
| | | }
|
| | |
|
| | | if (goodsList != null && goodsList.size() > 0) {
|
| | | |
| | |
|
| | | BigDecimal fanLiRate = hongBaoManageService.getFanLiRate();
|
| | | BigDecimal shareRate = hongBaoManageService.getShareRate();
|
| | | |
| | |
|
| | | goodsList.parallelStream().forEach(goods -> {
|
| | | if (goods != null) {
|
| | | // 获取详情
|
| | |
| | | }
|
| | | });
|
| | | }
|
| | | |
| | | |
| | |
|
| | | List<GoodsDetailVO> listQuality = new ArrayList<GoodsDetailVO>();
|
| | | // 取偶数个数据
|
| | | if (listExtra.size() % 2 != 0) {
|
| | |
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | | |
| | | |
| | | /**
|
| | | * 京东购买链接
|
| | | * |
| | | * @param acceptData
|
| | | * @param uid
|
| | | * @param id
|
| | |
| | | out.print(JsonUtil.loadFalseResult(1, "商品ID不能为空"));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | UserInfo user = userInfoService.getUserByIdWithMybatis(uid);
|
| | | if (user != null && user.getState() != UserInfo.STATE_NORMAL) {
|
| | | out.print(JsonUtil.loadFalseResult(Constant.CODE_FORBIDDEN_USER, Constant.FORBIDDEN_USER_REASON_DESC));
|
| | |
| | | couponUrl = couponInfo.getLink();
|
| | | }
|
| | | String jumpLink = JDApiUtil.convertShortLink(materialId, couponUrl, JDApiUtil.POSITION_FANLI + "", uid + "");
|
| | | |
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("native", true);
|
| | | data.put("jumpLink", jumpLink);
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 拼多多购买链接
|
| | | * |
| | | * @param acceptData
|
| | | * @param uid
|
| | | * @param id
|
| | |
| | | out.print(JsonUtil.loadFalseResult(1, "商品ID不能为空"));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | UserInfo user = userInfoService.getUserByIdWithMybatis(uid);
|
| | | if (user != null && user.getState() != UserInfo.STATE_NORMAL) {
|
| | | out.print(JsonUtil.loadFalseResult(Constant.CODE_FORBIDDEN_USER, Constant.FORBIDDEN_USER_REASON_DESC));
|
| | |
| | | data.put("jumpLink", jumpLink);
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 是否在参与推广
|
| | | * |
| | | * @param goodsId
|
| | | * -商品ID
|
| | | * @param goodsType
|
| | | * -TB/JD
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "isGoodsExtend")
|
| | | public void isGoodsExtend(AcceptData acceptData, String goodsId, Integer goodsType, PrintWriter out) {
|
| | | if (StringUtil.isNullOrEmpty(goodsId)) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "未参与推广"));
|
| | | return;
|
| | | }
|
| | | if (goodsType == null) {
|
| | | out.print(JsonUtil.loadFalseResult(2, "缺少goodsType"));
|
| | | return;
|
| | | }
|
| | | JSONObject data = new JSONObject();
|
| | | if (goodsType == Constant.SOURCE_TYPE_TAOBAO) {
|
| | | TaoBaoGoodsBrief goods = null;
|
| | | try {
|
| | | goods = TaoKeApiUtil.getSimpleGoodsInfo(Long.parseLong(goodsId));
|
| | | } catch (NumberFormatException e) {
|
| | | e.printStackTrace();
|
| | | } catch (TaobaoGoodsDownException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | if (goods == null) {
|
| | | data.put("extend", false);
|
| | | data.put("url", "https://h5.m.taobao.com/awp/core/detail.htm?id=" + goodsId);
|
| | | } else {
|
| | | data.put("extend", true);
|
| | | }
|
| | |
|
| | | } else if (goodsType == Constant.SOURCE_TYPE_JD) {
|
| | | JDGoods goods = JDApiUtil.getGoodsDetail(Long.parseLong(goodsId));
|
| | | if (goods == null) {
|
| | | data.put("extend", false);
|
| | | data.put("url", String.format("https://item.m.jd.com/product/%s.html", goodsId));
|
| | | } else {
|
| | | data.put("extend", true);
|
| | | }
|
| | | } else if (goodsType == Constant.SOURCE_TYPE_PDD) {
|
| | | PDDGoodsDetail goods = PinDuoDuoApiUtil.getGoodsDetail(Long.parseLong(goodsId));
|
| | | if (goods == null) {
|
| | | data.put("extend", false);
|
| | | data.put("url", String.format("https://mobile.yangkeduo.com/goods.html?goods_id=%s", goodsId));
|
| | | } else {
|
| | | data.put("extend", true);
|
| | | }
|
| | | }
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | | }
|