From 84dd8c1579ea198aff6ca8afac05a5e8f6af9faf Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期五, 21 五月 2021 10:46:22 +0800 Subject: [PATCH] 淘礼金功能完善 --- fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsControllerV2.java | 172 ++++++++++++++++++++++++++++++++++++++------------------- 1 files changed, 115 insertions(+), 57 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsControllerV2.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsControllerV2.java index 7e0797b..69dffdf 100644 --- a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsControllerV2.java +++ b/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; @@ -12,12 +15,14 @@ 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.pdd.PDDJumpLinkVO; +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; @@ -26,12 +31,11 @@ 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; @@ -71,23 +75,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; @@ -219,7 +218,10 @@ @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); @@ -449,7 +451,7 @@ 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); @@ -724,7 +726,7 @@ // 淇濆瓨缂撳瓨 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)) { @@ -949,7 +951,7 @@ 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); @@ -1156,7 +1158,7 @@ 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); @@ -1296,7 +1298,7 @@ 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); @@ -1484,7 +1486,7 @@ * @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; } @@ -1502,12 +1504,8 @@ 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) { @@ -1543,11 +1541,9 @@ 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); } } } @@ -1589,13 +1585,9 @@ 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); } } @@ -1613,12 +1605,9 @@ } 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>(); // 鍙栧伓鏁颁釜鏁版嵁 @@ -1680,9 +1669,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)); } @@ -1749,9 +1750,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)); // 鑾峰緱閲戝竵 @@ -1837,7 +1851,7 @@ LogHelper.test(String.format("鎷煎澶氳浆閾�:uid:%s data:%s", uid + "", data.toString())); } - PDDJumpLinkVO vo = new PDDJumpLinkVO(); + GoodsJumpLinkVO vo = new GoodsJumpLinkVO(); vo.set_native(true); vo.setNativeJumpLink(PinDuoDuoUtil.getAndroidNativeURI(convertUrl.getUrl())); vo.setJumpLink(convertUrl.getUrl()); @@ -1856,7 +1870,7 @@ } /** - * 鎷煎澶氳喘涔伴摼鎺� + * 鍞搧浼氳喘涔伴摼鎺� * * @param acceptData * @param uid @@ -1897,12 +1911,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); } @@ -1944,12 +1967,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); @@ -2070,7 +2112,7 @@ 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())); @@ -2135,8 +2177,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)); } -- Gitblit v1.8.0