admin
2021-04-30 736a697381d0cc52c1c2213cd66740b83d6d81d9
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsControllerV2.java
@@ -1,7 +1,10 @@
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;
@@ -15,6 +18,10 @@
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;
@@ -28,7 +35,6 @@
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;
@@ -68,23 +74,18 @@
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;
@@ -985,7 +986,7 @@
        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)
@@ -1109,7 +1110,7 @@
        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() {
                // 添加浏览记录
@@ -1677,9 +1678,21 @@
            }
        }
        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));
    }
@@ -1746,9 +1759,22 @@
            }
        }
        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));
        // 获得金币
@@ -1823,15 +1849,29 @@
            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));
        // 获得金币
@@ -1839,7 +1879,7 @@
    }
    /**
     * 拼多多购买链接
     * 唯品会购买链接
     *
     * @param acceptData
     * @param uid
@@ -1880,12 +1920,21 @@
        }
        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);
    }
@@ -1927,12 +1976,31 @@
        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);
@@ -2118,8 +2186,24 @@
        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));
    }