admin
2021-05-19 a1be6075c6b1365a7abc66bf559d6058039248ab
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/SearchControllerV2.java
@@ -9,6 +9,8 @@
import javax.annotation.Resource;
import javax.servlet.http.HttpSession;
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 org.springframework.core.task.TaskExecutor;
@@ -19,7 +21,7 @@
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.yeshi.fanli.dto.ConfigParamsDTO;
import com.yeshi.fanli.dto.GoodsMoneyConfigParamsDTO;
import com.yeshi.fanli.dto.jd.JDFilter;
import com.yeshi.fanli.dto.jd.JDSearchFilter;
import com.yeshi.fanli.dto.jd.JDSearchResult;
@@ -45,23 +47,16 @@
import com.yeshi.fanli.exception.user.TokenRecordException;
import com.yeshi.fanli.service.inter.brand.BrandInfoService;
import com.yeshi.fanli.service.inter.common.JumpDetailV2Service;
import com.yeshi.fanli.service.inter.config.BusinessSystemService;
import com.yeshi.fanli.service.inter.config.ConfigService;
import com.yeshi.fanli.service.inter.config.SuperHotSearchService;
import com.yeshi.fanli.service.inter.help.AppPageNotificationService;
import com.yeshi.fanli.service.inter.lable.QualityGoodsService;
import com.yeshi.fanli.service.inter.lable.TaoKeGoodsService;
import com.yeshi.fanli.service.inter.order.OrderHongBaoMoneyComputeService;
import com.yeshi.fanli.service.inter.order.config.HongBaoManageService;
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.user.HistorySearchService;
import com.yeshi.fanli.service.inter.user.TokenRecordService;
import com.yeshi.fanli.service.inter.user.integral.IntegralGetService;
import com.yeshi.fanli.service.manger.ClipboardAnalysisManager;
import com.yeshi.fanli.service.manger.IClipboardAnalysisResult;
import com.yeshi.fanli.service.manger.goods.jd.JDGoodsLinkParseManager;
import com.yeshi.common.entity.PageEntity;
import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.StringUtil;
@@ -143,6 +138,9 @@
    @Resource
    private PDDAuthService pddAuthService;
    @Resource
    private GoodsLijinMnager goodsLijinMnager;
    /**
@@ -276,12 +274,17 @@
                                                .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd")
                                                .create();
                                        data.put("type", 3);
                                        GoodsDetailVO goodsDetailVO = GoodsDetailVOFactory.convertCommonGoods(goods,
                                                orderHongBaoMoneyComputeService.getShowComputeRate(
                                                        acceptData.getPlatform(),
                                                        acceptData.getVersion(), acceptData.getSystem()));
                                        goodsDetailVO = goodsLijinMnager.loadTBMoneyInfo(acceptData.getSystem(), uid, goodsBrief, goodsDetailVO);
                                        data.put("goods",
                                                gson.toJson(
                                                        GoodsDetailVOFactory.convertCommonGoods(goods,
                                                                orderHongBaoMoneyComputeService.getShowComputeRate(
                                                                        acceptData.getPlatform(),
                                                                        acceptData.getVersion(), acceptData.getSystem()))));
                                                gson.toJson(goodsDetailVO));
                                        // 跳转详情
                                        if (VersionUtil.greaterThan_2_1_3(acceptData.getPlatform(),
                                                acceptData.getVersion())) {
@@ -298,10 +301,11 @@
                                    data.put("type", 3);
                                    data.put("goods",
                                            gson.toJson(
                                                    GoodsDetailVOFactory.convertCommonGoods(goods,
                                                            orderHongBaoMoneyComputeService.getShowComputeRate(
                                                                    acceptData.getPlatform(),
                                                                    acceptData.getVersion(), acceptData.getSystem()))));
                                                    goodsLijinMnager.loadOtherMoneyInfo(acceptData.getSystem(), uid, goods,
                                                            GoodsDetailVOFactory.convertCommonGoods(goods,
                                                                    orderHongBaoMoneyComputeService.getShowComputeRate(
                                                                            acceptData.getPlatform(),
                                                                            acceptData.getVersion(), acceptData.getSystem())))));
                                    // if
                                    // (VersionUtil.greaterThan_2_1_2(acceptData.getPlatform(),
                                    // acceptData.getVersion())) {
@@ -562,7 +566,7 @@
        /*--------- 京东商品  -------*/
        if (goodsType.intValue() == Constant.SOURCE_TYPE_JD) {
            searchJDGoods(acceptData, searchkey, page, filter, order, ap, out);
            searchJDGoods(acceptData, uid, searchkey, page, filter, order, ap, out);
            return;
        }
@@ -574,13 +578,13 @@
        /*-------- 唯品会商品 ------*/
        if (goodsType.intValue() == Constant.SOURCE_TYPE_VIP) {
            searchVIPGoods(acceptData, searchkey, page, filter, order, ap, out);
            searchVIPGoods(acceptData, uid, searchkey, page, filter, order, ap, out);
            return;
        }
        /*-------- 苏宁商品 ------*/
        if (goodsType.intValue() == Constant.SOURCE_TYPE_SUNING) {
            searchSuningGoods(acceptData, searchkey, page, filter, order, ap, out);
            searchSuningGoods(acceptData, uid, searchkey, page, filter, order, ap, out);
            return;
        }
@@ -691,13 +695,10 @@
            }
        }
        List<GoodsDetailVO> list = new ArrayList<GoodsDetailVO>();
        ConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate(acceptData.getPlatform(),
        GoodsMoneyConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate(acceptData.getPlatform(),
                acceptData.getVersion(), acceptData.getSystem());
        for (TaoBaoGoodsBrief goods : taoBaoGoodsBriefs) {
            list.add(GoodsDetailVOFactory.convertTaoBao(goods, paramsDTO));
        }
        List<GoodsDetailVO> list = goodsLijinMnager.loadTBMoneyInfo(acceptData.getSystem(), uid, taoBaoGoodsBriefs, paramsDTO);
        Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
                .excludeFieldsWithoutExposeAnnotation().create();
@@ -761,7 +762,7 @@
     * @param ap
     * @param out
     */
    private void searchJDGoods(AcceptData acceptData, String key, Integer page, String filter, Integer order,
    private void searchJDGoods(AcceptData acceptData, Long uid, String key, Integer page, String filter, Integer order,
                               AppPageNotification ap, PrintWriter out) {
        JDSearchResult result = null;
@@ -906,16 +907,19 @@
            if (goodsList != null && goodsList.size() > 0) {
                Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
                        .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
                ConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate(acceptData.getPlatform(),
                GoodsMoneyConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate(acceptData.getPlatform(),
                        acceptData.getVersion(), acceptData.getSystem());
                for (JDGoods goods : goodsList) {
                    GoodsDetailVO goodsDetailVO = GoodsDetailVOFactory.convertJDGoods(goods, paramsDTO);
                List<GoodsDetailVO> voList = goodsLijinMnager.loadOtherMoneyInfo(acceptData.getSystem(), uid, goodsList, paramsDTO);
                for (GoodsDetailVO vo : voList) {
                    if (hasCoupon) {
                        if (goodsDetailVO.isHasCoupon()) {
                            array.add(gson.toJson(goodsDetailVO));
                        if (vo.isHasCoupon()) {
                            array.add(gson.toJson(vo));
                        }
                    } else {
                        array.add(gson.toJson(goodsDetailVO));
                        array.add(gson.toJson(vo));
                    }
                }
            }
@@ -991,17 +995,29 @@
            }
        }
        PDDGoodsResult result = PinDuoDuoApiUtil.searchGoods(pddfilter, customParams);
        PDDGoodsResult result = null;
        try {
            result = PinDuoDuoApiUtil.searchGoods(pddfilter, customParams);
        } catch (PDDApiException e) {
            e.printStackTrace();
            if (e.getCode() == PDDApiException.CODE_NOT_AUTH) {
                try {
                    result = PinDuoDuoApiUtil.searchGoods(pddfilter, Constant.PDD_SEARCH_CUSTOMER_PARAMS);
                } catch (PDDApiException e1) {
                    e1.printStackTrace();
                }
            }
        }
        if (result != null) {
            count = result.getTotalCount();
            Gson gson = JsonUtil.getApiCommonGson();
            List<PDDGoodsDetail> goodsList = result.getGoodsList();
            if (goodsList != null && goodsList.size() > 0) {
                ConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate(acceptData.getPlatform(),
                        acceptData.getVersion(), acceptData.getSystem());
                for (PDDGoodsDetail goods : goodsList) {
                    GoodsDetailVO goodsDetailVO = GoodsDetailVOFactory.convertPDDGoods(goods, paramsDTO);
                GoodsMoneyConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate(acceptData.getPlatform(),
                        acceptData.getVersion(), acceptData.getSystem());
                List<GoodsDetailVO> voList = goodsLijinMnager.loadOtherMoneyInfo(acceptData.getSystem(), uid, goodsList, paramsDTO);
                for (GoodsDetailVO goodsDetailVO : voList) {
                    array.add(gson.toJson(goodsDetailVO));
                }
            }
@@ -1025,7 +1041,7 @@
     * @Title: searchVIPGoods
     * @Description:
     */
    private void searchVIPGoods(AcceptData acceptData, String key, Integer page, String filter, Integer order,
    private void searchVIPGoods(AcceptData acceptData, Long uid, String key, Integer page, String filter, Integer order,
                                AppPageNotification ap, PrintWriter out) {
        VIPSearchFilter searchFilter = new VIPSearchFilter();
        searchFilter.setKeyword(key);
@@ -1075,11 +1091,11 @@
            Gson gson = JsonUtil.getApiCommonGson();
            List<VIPGoodsInfo> goodsList = result.getGoodsList();
            if (goodsList != null && goodsList.size() > 0) {
                ConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate(acceptData.getPlatform(),
                GoodsMoneyConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate(acceptData.getPlatform(),
                        acceptData.getVersion(), acceptData.getSystem());
                for (VIPGoodsInfo goods : goodsList) {
                    GoodsDetailVO goodsDetailVO = GoodsDetailVOFactory.convertVIPGoods(goods, paramsDTO);
                List<GoodsDetailVO> voList = goodsLijinMnager.loadOtherMoneyInfo(acceptData.getSystem(), uid, goodsList, paramsDTO);
                for (GoodsDetailVO goodsDetailVO : voList) {
                    array.add(gson.toJson(goodsDetailVO));
                }
            }
@@ -1103,7 +1119,7 @@
     * @Title: searchVIPGoods
     * @Description:
     */
    private void searchSuningGoods(AcceptData acceptData, String key, Integer page, String filter, Integer order,
    private void searchSuningGoods(AcceptData acceptData, Long uid, String key, Integer page, String filter, Integer order,
                                   AppPageNotification ap, PrintWriter out) {
        SuningQueryModel searchFilter = new SuningQueryModel();
        searchFilter.setKeyword(key);
@@ -1179,11 +1195,11 @@
        if (resultList != null) {
            Gson gson = JsonUtil.getApiCommonGson();
            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);
                List<GoodsDetailVO> voList = goodsLijinMnager.loadOtherMoneyInfo(acceptData.getSystem(), uid, resultList, paramsDTO);
                for (GoodsDetailVO goodsDetailVO : voList) {
                    array.add(gson.toJson(goodsDetailVO));
                }
            }