| | |
| | | package com.yeshi.fanli.controller.client.v2; |
| | | |
| | | import java.io.PrintWriter; |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.math.BigDecimal; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.net.URLEncoder; |
| | | import java.util.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import com.yeshi.fanli.entity.SystemEnum; |
| | | import com.yeshi.fanli.entity.SystemFunction; |
| | | import com.yeshi.fanli.entity.SystemPIDInfo; |
| | | import com.yeshi.fanli.exception.pdd.PDDApiException; |
| | | import com.yeshi.fanli.lijin.manager.GoodsLijinMnager; |
| | | import com.yeshi.fanli.lijin.manager.UserLijinMnager; |
| | | import com.yeshi.fanli.service.inter.pdd.PDDAuthService; |
| | | import com.yeshi.fanli.service.inter.user.*; |
| | | import com.yeshi.fanli.service.inter.user.tb.UserExtraTaoBaoInfoService; |
| | | import com.yeshi.fanli.service.manger.PIDManager; |
| | | import com.yeshi.fanli.util.*; |
| | | import com.yeshi.fanli.util.goods.GoodsJumpUtil; |
| | | import com.yeshi.fanli.util.goods.douyin.CSJCPSApiUtil; |
| | | import com.yeshi.fanli.util.goods.douyin.DYUtil; |
| | | import com.yeshi.fanli.util.goods.douyin.vo.*; |
| | | 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 com.yeshi.goods.facade.dto.taobao.TaoBaoGoodsImportantInfo; |
| | | import org.json.simple.JSONArray; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestMethod; |
| | |
| | | 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; |
| | |
| | | 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; |
| | | import com.yeshi.fanli.service.inter.user.vip.UserVipConfigService; |
| | |
| | | @Controller |
| | | @RequestMapping("api/v2/goods") |
| | | public class GoodsControllerV2 { |
| | | |
| | | |
| | | Logger logger = LoggerFactory.getLogger(GoodsControllerV2.class); |
| | | |
| | | @Resource |
| | | private BusinessSystemService businessSystemService; |
| | |
| | | @Resource |
| | | private PDDAuthService pddAuthService; |
| | | |
| | | private ConfigParamsDTO getParamsDTO(String platform, String version, Long uid, SystemEnum system) { |
| | | @Resource |
| | | private GoodsLijinMnager goodsLijinMnager; |
| | | |
| | | @Resource |
| | | private PIDManager pidManager; |
| | | |
| | | @Resource |
| | | private UserLijinMnager userLijinMnager; |
| | | |
| | | @Resource |
| | | private UserFunctionsLimitService userFunctionsLimitService; |
| | | |
| | | private GoodsMoneyConfigParamsDTO getParamsDTO(String platform, String version, Long uid, SystemEnum system) { |
| | | UserLevelEnum level = UserLevelEnum.daRen; |
| | | if (uid != null && uid > 0) { |
| | | level = userLevelManager.getUserLevel(uid); |
| | |
| | | return orderHongBaoMoneyComputeService.getShowComputeRate(platform, version, level, system); |
| | | } |
| | | |
| | | private TaoBaoGoodsBrief filterDaTaoKeGoodsInfo(TaoBaoGoodsBrief goods) { |
| | | private TaoBaoGoodsBrief filterDaTaoKeGoodsInfo(SystemEnum system, TaoBaoGoodsBrief goods) { |
| | | String specialPid = pidManager.getPidCache(system, Constant.SOURCE_TYPE_TAOBAO, SystemPIDInfo.PidType.fanli); |
| | | String relationPid = pidManager.getPidCache(system, Constant.SOURCE_TYPE_TAOBAO, SystemPIDInfo.PidType.fanliChannel); |
| | | |
| | | try { |
| | | DaTaoKeFilterResult result = daTaoKeGoodsDetailV2Service.filterTaoBaoGoods(goods); |
| | | if (result.getFilterType() == DaTaoKeFilterResult.FILTER_TYPE_COUPON |
| | |
| | | // 缓存基础链接 |
| | | String dpid = null; |
| | | if (TaoBaoUtil.isSpecialGoods(goods.getMaterialLibType())) { |
| | | dpid = TaoBaoConstant.TAOBAO_SPECIAL_PID_DEFAULT; |
| | | dpid = specialPid; |
| | | } else { |
| | | dpid = TaoBaoConstant.TAOBAO_RELATION_AS_SPECIAL_PID; |
| | | dpid = relationPid; |
| | | } |
| | | String link = taoBaoGoodsCacheUtil.getBaseConvertLink(goods.getAuctionId(), dpid); |
| | | if (!StringUtil.isNullOrEmpty(link)) { |
| | | // result.getGoods().setCouponLink(link); |
| | | return result.getGoods(); |
| | | } else { |
| | | link = DaTaoKeApiUtil.convertLink(goods.getAuctionId(), dpid); |
| | | link = DaTaoKeApiUtil.convertLink(goods.getAuctionId(), dpid, false); |
| | | if (!StringUtil.isNullOrEmpty(link)) { |
| | | // result.getGoods().setCouponLink(link); |
| | | taoBaoGoodsCacheUtil.cacheBaseConvertLink(goods.getAuctionId(), dpid, link); |
| | |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "getDetailTB", method = RequestMethod.POST) |
| | | public void getDetialTB(AcceptData acceptData, Long id, Long uid, String from, PrintWriter out) { |
| | | public void getDetialTB(AcceptData acceptData, String id, Long uid, String from, PrintWriter out) { |
| | | if (id == null) { |
| | | out.print(JsonUtil.loadFalseResult(1, "商品id不能为空")); |
| | | return; |
| | | } |
| | | |
| | | logger.debug("获取商品详情-开始:{}", id + ""); |
| | | |
| | | BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(), |
| | | acceptData.getPackages(), acceptData.getSystem()); |
| | |
| | | TaoBaoGoodsBrief goods = null; |
| | | |
| | | if (!convertInServer) { |
| | | logger.debug("获取商品详情-不在服务端转链:{}", id + ""); |
| | | try { |
| | | goods = taoBaoGoodsCacheUtil.getCommonTaoBaoGoodsInfo(id); |
| | | if (goods == null) { |
| | |
| | | }); |
| | | } |
| | | |
| | | logger.debug("获取商品详情-获取商品详情成功:{}", id + ""); |
| | | |
| | | TaoBaoGoodsBrief tb = goods; |
| | | |
| | | //创建时间设置为空,防止前端用long解析 |
| | | tb.setCreatetime(null); |
| | | |
| | | |
| | | if (tb == null) { |
| | |
| | | if (uid != null && uid > 0) { |
| | | String specialId = userExtraTaoBaoInfoService.getSpecialIdByUid(uid); |
| | | //获取最新的比例 |
| | | TaoBaoGoodsBrief rateGoods = TaoKeApiUtil.specialConvertCoupon(tb.getAuctionId(), TaoBaoConstant.getSpecialAuthAppInfo(), specialId, null); |
| | | TaoBaoGoodsBrief rateGoods = TaoKeApiUtil.specialConvertCoupon(tb.getAuctionId(), TaoBaoConstant.getSpecialAuthAppInfo(pidManager.getPidCache(acceptData.getSystem(), Constant.SOURCE_TYPE_TAOBAO, SystemPIDInfo.PidType.fanli)), specialId, null); |
| | | if (rateGoods != null) |
| | | tb.setMinTkRate(rateGoods.getTkRate()); |
| | | } |
| | |
| | | |
| | | tb.setImgList(finalImgList); |
| | | |
| | | logger.debug("获取商品详情-开始大淘客商品过滤:{}", id + ""); |
| | | |
| | | // 大淘客商品过滤 |
| | | try { |
| | | goods = filterDaTaoKeGoodsInfo(goods); |
| | | goods = filterDaTaoKeGoodsInfo(acceptData.getSystem(), goods); |
| | | } catch (Exception e) { |
| | | LogHelper.errorDetailInfo(e); |
| | | } |
| | | |
| | | ConfigParamsDTO paramsDTO = getParamsDTO(acceptData.getPlatform(), acceptData.getVersion(), uid, acceptData.getSystem()); |
| | | logger.debug("获取商品详情-结束大淘客商品过滤:{}", id + ""); |
| | | |
| | | GoodsMoneyConfigParamsDTO paramsDTO = getParamsDTO(acceptData.getPlatform(), acceptData.getVersion(), uid, acceptData.getSystem()); |
| | | paramsDTO.setBaseFanliRate(hongBaoManageService.getBaseFanliRate(acceptData.getSystem())); |
| | | |
| | | logger.debug("获取商品详情-获取到返利比例:{}", id + ""); |
| | | |
| | | GoodsDetailVO goodsDetail = GoodsDetailVOFactory.convertTaoBao(goods, paramsDTO); |
| | | if (goodsDetail != null && goodsDetail.getMoneyInfo() != null && userVIPInfoService.isVIP(uid)) { |
| | |
| | | } |
| | | goodsDetail.setShopInfo(ShopInfoVOFactory.convertTaoBaoShop(shop)); |
| | | } |
| | | logger.debug("获取商品详情-获取店铺信息结束:{}", id + ""); |
| | | |
| | | |
| | | // 免单商品 |
| | | if (!StringUtil.isNullOrEmpty(from) && "miandan".equals(from)) { |
| | |
| | | } |
| | | extraVO.setListShareUser(listShareUser); |
| | | |
| | | logger.debug("获取商品详情-分享赚人提示结束:{}", id + ""); |
| | | |
| | | // 领券人列表 |
| | | List<ShamUser> listCouponUser = new ArrayList<ShamUser>(); |
| | | if (!StringUtil.isNullOrEmpty(goods.getCouponInfo()) && goods.getCouponAmount() != null |
| | |
| | | } |
| | | extraVO.setListCouponUser(listCouponUser); |
| | | |
| | | logger.debug("获取商品详情- 领券人列表结束:{}", id + ""); |
| | | |
| | | if (uid != null) { |
| | | // 是否加入收藏 |
| | | CollectionGoodsV2 collectionGoods = collectionGoodsV2Service.findByUidAndAuctionId(uid, id, |
| | | Constant.SOURCE_TYPE_TAOBAO); |
| | | extraVO.setCollected(collectionGoods != null ? true : false); |
| | | logger.debug("获取商品详情- 收藏结束:{}", id + ""); |
| | | // 是否加入选品库 |
| | | extraVO.setStorage(userGoodsStorageService.isExistStorage(uid, id, Constant.SOURCE_TYPE_TAOBAO)); |
| | | logger.debug("获取商品详情- 选品库结束:{}", id + ""); |
| | | } |
| | | |
| | | // 测试 |
| | |
| | | goodsDetail.setLabels(labels); |
| | | |
| | | } else {// 普通购买 |
| | | logger.debug("获取商品详情- 奖励券开始:{}", id + ""); |
| | | OtherInfo otherInfo = new OtherInfo(); |
| | | RewardCouponVO rewardCoupon = new RewardCouponVO(); |
| | | rewardCoupon.setJumpDetail(jumpDetailV2Service.getByTypeCache("web")); |
| | | rewardCoupon.setJumpDetail(jumpDetailV2Service.getByTypeCache("web", acceptData.getSystem())); |
| | | JSONObject params1 = new JSONObject(); |
| | | if (!VersionUtil.greaterThan_2_0_5(acceptData.getPlatform(), acceptData.getVersion())) |
| | | params1.put("url", configService.getValue(ConfigKeyEnum.specialGuideRewardCouponLink.getKey(), acceptData.getSystem())); |
| | |
| | | rewardCoupon.setParams(params1.toString()); |
| | | |
| | | otherInfo.setRewardCoupon(rewardCoupon); |
| | | logger.debug("获取商品详情- 奖励券结束:{}", id + ""); |
| | | if ("ios".equalsIgnoreCase(acceptData.getPlatform()) |
| | | && configService.iosOnLining(Integer.parseInt(acceptData.getVersion()), acceptData.getSystem())) |
| | | otherInfo.setRewardCoupon(null); |
| | | |
| | | goodsDetail.setOtherInfo(otherInfo); |
| | | } |
| | | extraVO.setFanliValid(fanliValid); |
| | |
| | | goodsDetail.setCouponInfoList(couponInfoList); |
| | | } |
| | | |
| | | logger.debug("获取商品详情- 分享信息结束:{}", id + ""); |
| | | |
| | | if (VersionUtil.greaterThan_2_1_2(acceptData.getPlatform(), acceptData.getVersion())) { |
| | | getCloudInfo(acceptData, uid, goodsDetail, extraVO); // 云发单文案信息 |
| | | } |
| | | //云发单关闭 |
| | | // if (VersionUtil.greaterThan_2_1_2(acceptData.getPlatform(), acceptData.getVersion())) { |
| | | // getCloudInfo(acceptData, uid, goodsDetail, extraVO); // 云发单文案信息 |
| | | // logger.debug("获取商品详情- 云发单文案结束:{}", id + ""); |
| | | // } |
| | | |
| | | JSONObject object = new JSONObject(); |
| | | object.put("extra", JsonUtil.getApiCommonGson().toJson(extraVO)); |
| | | object.put("goods", JsonUtil.getApiCommonGson().toJson(goodsDetail)); |
| | | out.print(JsonUtil.loadTrueResult(object.toString())); |
| | | |
| | | logger.debug("获取商品详情-详情结束:{}", id + ""); |
| | | |
| | | final TaoBaoGoodsBrief goodsInfo = tb; |
| | | ThreadUtil.run(new Runnable() { |
| | |
| | | // 保存缓存 |
| | | 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)) { |
| | |
| | | // 奖励券返利 |
| | | RewardCouponVO rewardCoupon = new RewardCouponVO(); |
| | | rewardCoupon.setMaxMoneyPlus(maxMoneyPlus); |
| | | rewardCoupon.setJumpDetail(jumpDetailV2Service.getByTypeCache("web")); |
| | | rewardCoupon.setJumpDetail(jumpDetailV2Service.getByTypeCache("web", acceptData.getSystem())); |
| | | JSONObject params1 = new JSONObject(); |
| | | if (!VersionUtil.greaterThan_2_0_5(acceptData.getPlatform(), acceptData.getVersion())) |
| | | params1.put("url", configService.getValue(ConfigKeyEnum.specialGuideRewardCouponLink.getKey(), acceptData.getSystem())); |
| | |
| | | if (couponInfo != null) { |
| | | // 券链接处理 |
| | | String materialId = "https://item.jd.com/" + id + ".html"; |
| | | String url = JDApiUtil.convertLinkWithSubUnionId(materialId, couponInfo.getLink(), null, |
| | | JDApiUtil.POSITION_COUPON + "", null); |
| | | String url = null; |
| | | try { |
| | | url = JDApiUtil.convertLinkWithSubUnionId(materialId, couponInfo.getLink(), null, |
| | | pidManager.getPidCache(acceptData.getSystem(), Constant.SOURCE_TYPE_JD, SystemPIDInfo.PidType.coupon), null); |
| | | } catch (Exception e) { |
| | | logger.warn(String.format("京东转链出错:materialId-%s couponUrl-%s", materialId, couponInfo.getLink()), e); |
| | | } |
| | | couponInfo.setLink(url); |
| | | } |
| | | |
| | |
| | | |
| | | if (uid != null) { |
| | | // 是否加入收藏 |
| | | CollectionGoodsV2 collectionGoods = collectionGoodsV2Service.findByUidAndAuctionId(uid, id, |
| | | CollectionGoodsV2 collectionGoods = collectionGoodsV2Service.findByUidAndAuctionId(uid, id + "", |
| | | Constant.SOURCE_TYPE_JD); |
| | | extraVO.setCollected(collectionGoods != null ? true : false); |
| | | // 是否加入选品库 |
| | | extraVO.setStorage(userGoodsStorageService.isExistStorage(uid, id, Constant.SOURCE_TYPE_JD)); |
| | | extraVO.setStorage(userGoodsStorageService.isExistStorage(uid, id + "", Constant.SOURCE_TYPE_JD)); |
| | | } |
| | | |
| | | // 图文详情 |
| | |
| | | return; |
| | | } |
| | | |
| | | String pid = pidManager.getPidCache(acceptData.getSystem(), Constant.SOURCE_TYPE_PDD, SystemPIDInfo.PidType.fanli); |
| | | |
| | | PDDGoodsDetail pddGoods = null; |
| | | try { |
| | | pddGoods = PinDuoDuoApiUtil.getGoodsDetail(id, PinDuoDuoApiUtil.PID_FANLI, pddAuthService.getFanliCustomParams(uid)); |
| | | pddGoods = PinDuoDuoApiUtil.getGoodsDetail(id, pid, pddAuthService.getFanliCustomParams(uid)); |
| | | } catch (PDDApiException e) { |
| | | e.printStackTrace(); |
| | | if (e.getCode() == PDDApiException.CODE_NOT_AUTH) { |
| | | try { |
| | | pddGoods = PinDuoDuoApiUtil.getGoodsDetail(id, PinDuoDuoApiUtil.PID_FANLI, Constant.PDD_SEARCH_CUSTOMER_PARAMS); |
| | | pddGoods = PinDuoDuoApiUtil.getGoodsDetail(id, pid, Constant.PDD_SEARCH_CUSTOMER_PARAMS); |
| | | } catch (PDDApiException e1) { |
| | | } |
| | | } |
| | |
| | | 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); |
| | |
| | | // 附加信息 |
| | | OtherInfo otherInfo = new OtherInfo(); |
| | | RewardCouponVO rewardCoupon = new RewardCouponVO(); |
| | | rewardCoupon.setJumpDetail(jumpDetailV2Service.getByTypeCache("web")); |
| | | rewardCoupon.setJumpDetail(jumpDetailV2Service.getByTypeCache("web", acceptData.getSystem())); |
| | | JSONObject params1 = new JSONObject(); |
| | | if (!VersionUtil.greaterThan_2_0_5(acceptData.getPlatform(), acceptData.getVersion())) |
| | | params1.put("url", configService.getValue(ConfigKeyEnum.specialGuideRewardCouponLink.getKey(), acceptData.getSystem())); |
| | |
| | | CouponInfoVO couponInfo = goodsDetail.getCouponInfo(); |
| | | PDDConvertLinkResultVO convertUrl = null; |
| | | if (couponInfo != null) { |
| | | convertUrl = PinDuoDuoApiUtil.convert(pddGoods.getGoodsSign(), PinDuoDuoApiUtil.PID_COUPON + "", null, false); |
| | | convertUrl = PinDuoDuoApiUtil.convert(pddGoods.getGoodsSign(), pidManager.getPidCache(acceptData.getSystem(), Constant.SOURCE_TYPE_PDD, SystemPIDInfo.PidType.coupon), null, false); |
| | | if (convertUrl != null) |
| | | couponInfo.setLink(convertUrl.getUrl()); |
| | | } |
| | |
| | | |
| | | if (uid != null) { |
| | | // 是否加入收藏 |
| | | CollectionGoodsV2 collectionGoods = collectionGoodsV2Service.findByUidAndAuctionId(uid, id, |
| | | CollectionGoodsV2 collectionGoods = collectionGoodsV2Service.findByUidAndAuctionId(uid, id + "", |
| | | Constant.SOURCE_TYPE_PDD); |
| | | extraVO.setCollected(collectionGoods != null ? true : false); |
| | | // 是否加入选品库 |
| | | extraVO.setStorage(userGoodsStorageService.isExistStorage(uid, id, Constant.SOURCE_TYPE_PDD)); |
| | | extraVO.setStorage(userGoodsStorageService.isExistStorage(uid, id + "", Constant.SOURCE_TYPE_PDD)); |
| | | } |
| | | |
| | | extraVO.setIsNative(true); |
| | |
| | | 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); |
| | |
| | | // 附加信息 |
| | | OtherInfo otherInfo = new OtherInfo(); |
| | | RewardCouponVO rewardCoupon = new RewardCouponVO(); |
| | | rewardCoupon.setJumpDetail(jumpDetailV2Service.getByTypeCache("web")); |
| | | rewardCoupon.setJumpDetail(jumpDetailV2Service.getByTypeCache("web", acceptData.getSystem())); |
| | | JSONObject params1 = new JSONObject(); |
| | | if (!VersionUtil.greaterThan_2_0_5(acceptData.getPlatform(), acceptData.getVersion())) |
| | | params1.put("url", configService.getValue(ConfigKeyEnum.specialGuideRewardCouponLink.getKey(), acceptData.getSystem())); |
| | |
| | | |
| | | if (uid != null) { |
| | | // 是否加入收藏 |
| | | CollectionGoodsV2 collectionGoods = collectionGoodsV2Service.findByUidAndAuctionId(uid, id, |
| | | CollectionGoodsV2 collectionGoods = collectionGoodsV2Service.findByUidAndAuctionId(uid, id + "", |
| | | Constant.SOURCE_TYPE_VIP); |
| | | extraVO.setCollected(collectionGoods != null ? true : false); |
| | | // 是否加入选品库 |
| | | extraVO.setStorage(userGoodsStorageService.isExistStorage(uid, id, Constant.SOURCE_TYPE_VIP)); |
| | | extraVO.setStorage(userGoodsStorageService.isExistStorage(uid, id + "", Constant.SOURCE_TYPE_VIP)); |
| | | } |
| | | |
| | | extraVO.setIsNative(true); |
| | |
| | | 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); |
| | |
| | | // 附加信息 |
| | | OtherInfo otherInfo = new OtherInfo(); |
| | | RewardCouponVO rewardCoupon = new RewardCouponVO(); |
| | | rewardCoupon.setJumpDetail(jumpDetailV2Service.getByTypeCache("web")); |
| | | rewardCoupon.setJumpDetail(jumpDetailV2Service.getByTypeCache("web", acceptData.getSystem())); |
| | | JSONObject params1 = new JSONObject(); |
| | | |
| | | params1.put("url", userVipConfigService.getValueByKey("vip_link")); |
| | |
| | | if (uid != null) { |
| | | // 是否加入收藏 |
| | | CollectionGoodsV2 collectionGoods = collectionGoodsV2Service.findByUidAndAuctionId(uid, |
| | | Long.parseLong(suningGoodsInfo.getCommodityInfo().getCommodityCode()), Constant.SOURCE_TYPE_SUNING); |
| | | (suningGoodsInfo.getCommodityInfo().getCommodityCode()), Constant.SOURCE_TYPE_SUNING); |
| | | extraVO.setCollected(collectionGoods != null ? true : false); |
| | | // 是否加入选品库 |
| | | extraVO.setStorage(userGoodsStorageService.isExistStorage(uid, |
| | | Long.parseLong(suningGoodsInfo.getCommodityInfo().getCommodityCode()), |
| | | (suningGoodsInfo.getCommodityInfo().getCommodityCode()), |
| | | Constant.SOURCE_TYPE_SUNING)); |
| | | } |
| | | |
| | |
| | | }); |
| | | } |
| | | |
| | | |
| | | @RequestMapping(value = "getDetailDY", method = RequestMethod.POST) |
| | | public void getDetailDY(AcceptData acceptData, Long id, Long uid, String from, PrintWriter out) { |
| | | // 系统验证 |
| | | BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(), |
| | | acceptData.getPackages(), acceptData.getSystem()); |
| | | if (system == null) { |
| | | out.print(JsonUtil.loadFalseResult(1, "系统不存在")); |
| | | return; |
| | | } |
| | | |
| | | DYGoodsDetail dyGoodsDetail = CSJCPSApiUtil.goodsDetail(id); |
| | | if (dyGoodsDetail == null) { |
| | | out.print(JsonUtil.loadFalseResult(2, "商品不存在")); |
| | | return; |
| | | } |
| | | |
| | | GoodsMoneyConfigParamsDTO paramsDTO = getParamsDTO(acceptData.getPlatform(), acceptData.getVersion(), uid, acceptData.getSystem()); |
| | | paramsDTO.setBaseFanliRate(hongBaoManageService.getBaseFanliRate(acceptData.getSystem())); |
| | | |
| | | GoodsDetailVO goodsDetail = GoodsDetailVOFactory.convertDYGoods(dyGoodsDetail, paramsDTO); |
| | | if (goodsDetail != null && goodsDetail.getMoneyInfo() != null && userVIPInfoService.isVIP(uid)) { |
| | | goodsDetail.getMoneyInfo().setFanliMoney(goodsDetail.getMoneyInfo().getMaxMoney()); |
| | | goodsDetail.getMoneyInfo().setShareMoney("¥" + DYUtil.getGoodsFanLiMoney(dyGoodsDetail, |
| | | hongBaoManageService.getShareRate(UserLevelEnum.superVIP, acceptData.getSystem()))); |
| | | goodsDetail.getMoneyInfo().setRateInfo(goodsDetail.getMoneyInfo().getMaxRateInfo()); |
| | | goodsDetail.getMoneyInfo().setCompositionInfo(goodsDetail.getMoneyInfo().getMaxCompositionInfo()); |
| | | } |
| | | goodsDetail.getMoneyInfo() |
| | | .setRateInfoHelpUrl(configService.getValue(ConfigKeyEnum.goodsDetailFanliRateHelpUrl.getKey(), acceptData.getSystem())); |
| | | |
| | | // 附加信息 |
| | | OtherInfo otherInfo = new OtherInfo(); |
| | | RewardCouponVO rewardCoupon = new RewardCouponVO(); |
| | | rewardCoupon.setJumpDetail(jumpDetailV2Service.getByTypeCache("web", acceptData.getSystem())); |
| | | JSONObject params1 = new JSONObject(); |
| | | if (!VersionUtil.greaterThan_2_0_5(acceptData.getPlatform(), acceptData.getVersion())) |
| | | params1.put("url", configService.getValue(ConfigKeyEnum.specialGuideRewardCouponLink.getKey(), acceptData.getSystem())); |
| | | else |
| | | params1.put("url", userVipConfigService.getValueByKey("vip_link")); |
| | | |
| | | rewardCoupon.setMaxMoney(goodsDetail.getMoneyInfo().getMaxMoney()); |
| | | rewardCoupon.setDesc("返"); |
| | | params1.put("url", userVipConfigService.getValueByKey("vip_link")); |
| | | rewardCoupon.getJumpDetail().setNeedLogin(true); |
| | | |
| | | rewardCoupon.setParams(params1.toString()); |
| | | otherInfo.setRewardCoupon(rewardCoupon); |
| | | if ("ios".equalsIgnoreCase(acceptData.getPlatform()) |
| | | && configService.iosOnLining(Integer.parseInt(acceptData.getVersion()), acceptData.getSystem())) |
| | | otherInfo.setRewardCoupon(null); |
| | | goodsDetail.setOtherInfo(otherInfo); |
| | | |
| | | ShopInfoVO shopInfo = goodsDetail.getShopInfo(); |
| | | if (shopInfo != null) { |
| | | if (shopInfo.getId() == null || shopInfo.getScoreGoods() == null || shopInfo.getScoreLogistics() == null |
| | | || shopInfo.getScoreSeller() == null) { |
| | | goodsDetail.setShopInfo(null); |
| | | } |
| | | } |
| | | |
| | | GoodsDetailExtraVO extraVO = new GoodsDetailExtraVO(); |
| | | extraVO.setIsNative(false); |
| | | // IOS是否正在上线 |
| | | if ("ios".equalsIgnoreCase(acceptData.getPlatform())) { |
| | | String version = acceptData.getVersion(); |
| | | extraVO.setIosOnling(configService.iosOnLining(Integer.parseInt(version), acceptData.getSystem())); |
| | | } |
| | | |
| | | // TODO 图文详情 |
| | | extraVO.setDetailUrl(""); |
| | | |
| | | if (uid != null) { |
| | | // 是否加入收藏 |
| | | CollectionGoodsV2 collectionGoods = collectionGoodsV2Service.findByUidAndAuctionId(uid, id + "", |
| | | Constant.SOURCE_TYPE_DY); |
| | | extraVO.setCollected(collectionGoods != null ? true : false); |
| | | // 是否加入选品库 |
| | | extraVO.setStorage(userGoodsStorageService.isExistStorage(uid, id + "", Constant.SOURCE_TYPE_DY)); |
| | | } |
| | | |
| | | extraVO.setIsNative(true); |
| | | |
| | | // 分享路径 |
| | | String h5Url = String.format("http://%s%s?uid=%s&id=%s", configService.getH5Host(acceptData.getSystem()), |
| | | Constant.systemCommonConfig.getShareGoodsPagePathPDD(), "", id + ""); |
| | | // try { |
| | | // extraVO.setH5Url(HttpUtil.getShortLink(h5Url)); |
| | | // } catch (Exception e) { |
| | | extraVO.setH5Url(h5Url); |
| | | // } |
| | | |
| | | String helpLink = null; |
| | | extraVO.setFanliValid(true); |
| | | extraVO.setShareValid(true); |
| | | |
| | | if (StringUtil.isNullOrEmpty(helpLink)) { |
| | | helpLink = configService.getValue(ConfigKeyEnum.noRebateHelpLink.getKey(), acceptData.getSystem()); |
| | | } |
| | | |
| | | ShareVO shareInfoVO = new ShareVO(); |
| | | shareInfoVO.setHelpLink(helpLink); |
| | | extraVO.setShare(shareInfoVO); |
| | | |
| | | if (extraVO.getListShareUser() == null) { |
| | | extraVO.setListShareUser(new ArrayList<>()); |
| | | } |
| | | |
| | | if (extraVO.getListCouponUser() == null) { |
| | | extraVO.setListCouponUser(new ArrayList<>()); |
| | | } |
| | | |
| | | // 云发单文案信息 |
| | | getCloudInfo(acceptData, uid, goodsDetail, extraVO); |
| | | |
| | | JSONObject object = new JSONObject(); |
| | | object.put("extra", JsonUtil.getApiCommonGson().toJson(extraVO)); |
| | | object.put("goods", JsonUtil.getApiCommonGson().toJson(goodsDetail)); |
| | | out.print(JsonUtil.loadTrueResult(object.toString())); |
| | | |
| | | ThreadUtil.run(new Runnable() { |
| | | public void run() { |
| | | // 添加浏览记录 |
| | | try { |
| | | scanHistoryV2Service.addDYScanHistory(uid, acceptData.getDevice(), dyGoodsDetail); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | try { |
| | | goodsEvaluateService.updateDYGoods(dyGoodsDetail); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * // 云发单文案信息 |
| | | * |
| | | * @param goodsDetail |
| | | */ |
| | | private void getCloudInfo(AcceptData acceptData, Long uid, GoodsDetailVO goodsDetail, GoodsDetailExtraVO extraVO) { |
| | | if (1 > 0) { |
| | | return; |
| | | } |
| | | // 云发单是否开启 |
| | | boolean cloudOpen = configService.isRobotCloudOpen(ConfigKeyEnum.robotCloudOpenGoodsDetail.getKey(), acceptData.getPlatform(), acceptData.getVersion(), acceptData.getSystem()); |
| | | if (!cloudOpen && uid != null) { |
| | |
| | | * @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; |
| | | } |
| | |
| | | |
| | | List<JDGoods> list = JDUtil.getRecommendGoodsById(Long.parseLong(id)); |
| | | if (list == null) { |
| | | list = new ArrayList<JDGoods>(); |
| | | list = new ArrayList<>(); |
| | | } else if (list.size() > 10) { |
| | | 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) { |
| | |
| | | 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); |
| | | } |
| | | } |
| | | } |
| | |
| | | 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); |
| | | } |
| | | } |
| | | |
| | |
| | | return; |
| | | } |
| | | |
| | | List<TaoBaoGoodsBrief> goodsList = TaoKeApiUtil.guessLikeByAuctionId(Long.parseLong(id), 10); |
| | | // 初始化 |
| | | if (goodsList == null) { |
| | | goodsList = new ArrayList<TaoBaoGoodsBrief>(); |
| | | if (goodsType == Constant.SOURCE_TYPE_DY) { |
| | | DYGoodsDetail goods = CSJCPSApiUtil.goodsDetail(Long.parseLong(id)); |
| | | //goods.getThird_cid() |
| | | DYGoodsSearchFilter searchFilter = new DYGoodsSearchFilter(); |
| | | searchFilter.setPageSize(10); |
| | | searchFilter.setPage(1); |
| | | searchFilter.setThird_cids(Arrays.asList(new Integer[]{goods.getThird_cid()})); |
| | | ListResult listResult = CSJCPSApiUtil.searchGoods(searchFilter); |
| | | |
| | | |
| | | |
| | | List<GoodsDetailVO> listDetailVO = new ArrayList<>(); |
| | | if (listResult != null) { |
| | | if (listResult.getDataList() != null && listResult.getDataList() .size() > 0) { |
| | | List<DYGoods> dyGoodsList=new ArrayList<>(); |
| | | for(Object o:listResult.getDataList()){ |
| | | dyGoodsList.add((DYGoods)o); |
| | | } |
| | | |
| | | GoodsMoneyConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate(acceptData.getPlatform(), |
| | | acceptData.getVersion(), acceptData.getSystem()); |
| | | listDetailVO = goodsLijinMnager.loadOtherMoneyInfo(acceptData.getSystem(), uid, dyGoodsList, paramsDTO); |
| | | } |
| | | } |
| | | |
| | | 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<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)); |
| | | } |
| | | }); |
| | | List<TaoBaoGoodsBrief> goodsList = TaoKeApiUtil.guessLikeByAuctionId(id, 10); |
| | | // 初始化 |
| | | if (goodsList == null) { |
| | | goodsList = new ArrayList<>(); |
| | | } |
| | | |
| | | List<GoodsDetailVO> listExtra = new ArrayList<>(); |
| | | GoodsMoneyConfigParamsDTO paramsDTO = getParamsDTO(acceptData.getPlatform(), acceptData.getVersion(), null, acceptData.getSystem()); |
| | | |
| | | listExtra = goodsLijinMnager.loadTBMoneyInfo(acceptData.getSystem(), uid, goodsList, paramsDTO, false); |
| | | |
| | | List<GoodsDetailVO> listQuality = new ArrayList<GoodsDetailVO>(); |
| | | // 取偶数个数据 |
| | |
| | | } |
| | | String jumpLink = null; |
| | | String materialId = "https://item.jd.com/" + id + ".html"; |
| | | String pid = pidManager.getPidCache(acceptData.getSystem(), Constant.SOURCE_TYPE_JD, SystemPIDInfo.PidType.coupon); |
| | | if (StringUtil.isNullOrEmpty(couponUrl)) { |
| | | JDCouponInfo couponInfo = JDUtil.getShowCouponInfo(goods.getCouponInfoList(), goods.getPrice()); |
| | | if (couponInfo != null) { |
| | | couponUrl = couponInfo.getLink(); |
| | | } |
| | | jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, null, JDApiUtil.POSITION_COUPON + "", |
| | | ""); |
| | | if (jumpLink == null) { |
| | | jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, null, null, JDApiUtil.POSITION_COUPON + "", |
| | | |
| | | try { |
| | | jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, null, pid, |
| | | ""); |
| | | } catch (Exception e) { |
| | | logger.warn(String.format("京东转链出错:materialId-%s couponUrl-%s", materialId, couponUrl), e); |
| | | } |
| | | if (jumpLink == null) { |
| | | try { |
| | | jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, null, null, pid, |
| | | ""); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | logger.warn(String.format("京东转链出错:materialId-%s ", materialId), e); |
| | | } |
| | | } |
| | | } else { |
| | | jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, null, JDApiUtil.POSITION_COUPON + "", |
| | | ""); |
| | | try { |
| | | jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, null, pid, |
| | | ""); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | logger.warn(String.format("京东转链出错:materialId-%s couponUrl-%s", materialId, couponUrl), e); |
| | | } |
| | | if (StringUtil.isNullOrEmpty(jumpLink)) { |
| | | jumpLink = couponUrl; |
| | | } |
| | | } |
| | | |
| | | JSONObject data = new JSONObject(); |
| | | data.put("native", true); |
| | | data.put("jumpLink", jumpLink); |
| | | GoodsJumpLinkVO vo = GoodsJumpUtil.getJDJumpInfo(jumpLink); |
| | | 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)); |
| | | } |
| | | |
| | |
| | | getJDLinkWithoutFanLi(acceptData, id, couponUrl, source, out); |
| | | return; |
| | | } |
| | | //未登录领券 |
| | | if (uid == null) { |
| | | getJDLinkWithoutFanLi(acceptData, id, couponUrl, source, out); |
| | | return; |
| | | } |
| | | |
| | | if (uid == null || uid <= 0) { |
| | | out.print(JsonUtil.loadFalseResult(1, "用户ID不能为空")); |
| | |
| | | return; |
| | | } |
| | | |
| | | if (userFunctionsLimitService.isLimit(uid, SystemFunction.fanli, new Date())) { |
| | | out.print(JsonUtil.loadFalseResult(1, "该功能限制使用")); |
| | | return; |
| | | } |
| | | |
| | | JDGoods goods = jdGoodsCacheUtil.getGoodsInfo(id); |
| | | if (goods == null) { |
| | | out.print(JsonUtil.loadFalseResult(2, "商品已下架")); |
| | |
| | | |
| | | String jumpLink = null; |
| | | String materialId = "https://item.jd.com/" + id + ".html"; |
| | | |
| | | String pid = pidManager.getPidCache(acceptData.getSystem(), Constant.SOURCE_TYPE_JD, SystemPIDInfo.PidType.fanli); |
| | | |
| | | if (StringUtil.isNullOrEmpty(couponUrl)) { |
| | | JDCouponInfo couponInfo = JDUtil.getShowCouponInfo(goods.getCouponInfoList(), goods.getPrice()); |
| | | if (couponInfo != null) { |
| | | couponUrl = couponInfo.getLink(); |
| | | } |
| | | jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, null, JDApiUtil.POSITION_FANLI + "", |
| | | uid + ""); |
| | | if (jumpLink == null) { |
| | | jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, null, null, JDApiUtil.POSITION_FANLI + "", |
| | | try { |
| | | jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, null, pid, |
| | | uid + ""); |
| | | } catch (Exception e) { |
| | | logger.warn(String.format("京东转链出错:materialId-%s couponUrl-%s", materialId, couponUrl), e); |
| | | } |
| | | if (jumpLink == null) { |
| | | try { |
| | | jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, null, null, pid, |
| | | uid + ""); |
| | | } catch (Exception e) { |
| | | logger.warn(String.format("京东转链出错:materialId-%s", materialId), e); |
| | | } |
| | | } |
| | | } else { |
| | | jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, null, JDApiUtil.POSITION_FANLI + "", |
| | | uid + ""); |
| | | try { |
| | | jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, null, pid, |
| | | uid + ""); |
| | | } catch (Exception e) { |
| | | logger.warn(String.format("京东转链出错:materialId-%s couponUrl-%s", materialId, couponUrl), e); |
| | | } |
| | | if (StringUtil.isNullOrEmpty(jumpLink)) { |
| | | jumpLink = couponUrl; |
| | | } |
| | | } |
| | | |
| | | JSONObject data = new JSONObject(); |
| | | data.put("native", true); |
| | | data.put("jumpLink", jumpLink); |
| | | GoodsJumpLinkVO vo = GoodsJumpUtil.getJDJumpInfo(jumpLink); |
| | | JSONObject data = JSONObject.fromObject(new Gson().toJson(vo)); |
| | | data.put("native", vo.is_native()); |
| | | if (uid != null) |
| | | data.put("userLevel", userLijinMnager.getUserLevelInfo(uid, acceptData.getSystem())); |
| | | out.print(JsonUtil.loadTrueResult(data)); |
| | | |
| | | // 获得金币 |
| | |
| | | String jumpLink = null; |
| | | String materialId = "https://item.jd.com/" + id + ".html"; |
| | | |
| | | jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, null, JDApiUtil.POSITION_FANLI + "", null); |
| | | try { |
| | | jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, null, pidManager.getPidCache(acceptData.getSystem(), Constant.SOURCE_TYPE_JD, SystemPIDInfo.PidType.fanli), null); |
| | | } catch (Exception e) { |
| | | logger.warn(String.format("京东转链出错:materialId-%s couponUrl-%s", materialId, couponUrl), e); |
| | | } |
| | | if (StringUtil.isNullOrEmpty(jumpLink)) { |
| | | jumpLink = couponUrl; |
| | | } |
| | |
| | | return; |
| | | } |
| | | |
| | | String pid = PinDuoDuoApiUtil.PID_FANLI; |
| | | String pid = pidManager.getPidCache(acceptData.getSystem(), Constant.SOURCE_TYPE_PDD, SystemPIDInfo.PidType.fanli); |
| | | //只是领券 |
| | | if (!SystemInfoUtil.hasFunctions(acceptData.getSystem(), SystemFunction.fanli)) { |
| | | pid = PinDuoDuoApiUtil.PID_COUPON; |
| | | pid = pidManager.getPidCache(acceptData.getSystem(), Constant.SOURCE_TYPE_PDD, SystemPIDInfo.PidType.coupon); |
| | | uid = null; |
| | | } else { |
| | | if (uid == null || uid <= 0) { |
| | | 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)); |
| | | return; |
| | | if (uid == null) { |
| | | pid = pidManager.getPidCache(acceptData.getSystem(), Constant.SOURCE_TYPE_PDD, SystemPIDInfo.PidType.coupon); |
| | | uid = null; |
| | | } else { |
| | | if (uid == null || uid <= 0) { |
| | | 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)); |
| | | return; |
| | | } |
| | | |
| | | if (userFunctionsLimitService.isLimit(uid, SystemFunction.fanli, new Date())) { |
| | | out.print(JsonUtil.loadFalseResult(1, "该功能限制使用")); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | return; |
| | | } |
| | | |
| | | String customParams = pddAuthService.getFanliCustomParams(uid); |
| | | String customParams = uid == null ? Constant.PDD_SEARCH_CUSTOMER_PARAMS : pddAuthService.getFanliCustomParams(uid); |
| | | boolean auth = PinDuoDuoApiUtil.isAuth(pid, customParams); |
| | | JSONObject data = new JSONObject(); |
| | | PDDConvertLinkResultVO convertUrl = null; |
| | |
| | | LogHelper.test(String.format("拼多多转链:uid:%s data:%s", uid + "", data.toString())); |
| | | } |
| | | |
| | | PDDJumpLinkVO vo = new PDDJumpLinkVO(); |
| | | 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); |
| | | } |
| | | GoodsJumpLinkVO vo = GoodsJumpUtil.getPDDJumpInfo(convertUrl); |
| | | data = JSONObject.fromObject(new Gson().toJson(vo)); |
| | | data.put("native", vo.is_native()); |
| | | if (uid != null) |
| | | data.put("userLevel", userLijinMnager.getUserLevelInfo(uid, acceptData.getSystem())); |
| | | out.print(JsonUtil.loadTrueResult(data)); |
| | | |
| | | // 获得金币 |
| | |
| | | } |
| | | |
| | | /** |
| | | * 拼多多购买链接 |
| | | * 唯品会购买链接 |
| | | * |
| | | * @param acceptData |
| | | * @param uid |
| | |
| | | if (!SystemInfoUtil.hasFunctions(acceptData.getSystem(), SystemFunction.fanli)) { |
| | | tag = VipShopUtil.getCouponChanTag(); |
| | | } else { |
| | | if (uid == null || uid <= 0) { |
| | | out.print(JsonUtil.loadFalseResult(1, "用户ID不能为空")); |
| | | return; |
| | | } |
| | | //只是领券 |
| | | if (uid == null) { |
| | | tag = VipShopUtil.getCouponChanTag(); |
| | | } else { |
| | | if (uid == null || uid <= 0) { |
| | | 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)); |
| | | 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)); |
| | | return; |
| | | } |
| | | |
| | | tag = VipShopUtil.getBuyChanTag(uid); |
| | | if (userFunctionsLimitService.isLimit(uid, SystemFunction.fanli, new Date())) { |
| | | out.print(JsonUtil.loadFalseResult(1, "该功能限制使用")); |
| | | return; |
| | | } |
| | | |
| | | tag = VipShopUtil.getBuyChanTag(uid); |
| | | } |
| | | } |
| | | |
| | | VIPGoodsInfo goods = VipShopApiUtil.getGoodsDetail(id + ""); |
| | |
| | | } |
| | | |
| | | 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 = GoodsJumpUtil.getVIPShopJumpInfo(convertUrl); |
| | | |
| | | JSONObject data = JSONObject.fromObject(new Gson().toJson(vo)); |
| | | data.put("native", vo.is_native()); |
| | | if (uid != null) |
| | | data.put("userLevel", userLijinMnager.getUserLevelInfo(uid, acceptData.getSystem())); |
| | | out.print(JsonUtil.loadTrueResult(data)); |
| | | // 获得金币 |
| | | integralGetService.addCouponRebate(uid); |
| | | } |
| | |
| | | return; |
| | | } |
| | | |
| | | String pid = SuningApiUtil.PID_BUY; |
| | | String pid = pidManager.getPidCache(acceptData.getSystem(), Constant.SOURCE_TYPE_SUNING, SystemPIDInfo.PidType.fanli); |
| | | if (!SystemInfoUtil.hasFunctions(acceptData.getSystem(), SystemFunction.fanli)) { |
| | | pid = SuningApiUtil.PID_COUPON; |
| | | pid = pidManager.getPidCache(acceptData.getSystem(), Constant.SOURCE_TYPE_SUNING, SystemPIDInfo.PidType.coupon); |
| | | uid = null; |
| | | } else { |
| | | if (uid == null || uid <= 0) { |
| | | 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)); |
| | | return; |
| | | if (uid == null) { |
| | | pid = pidManager.getPidCache(acceptData.getSystem(), Constant.SOURCE_TYPE_SUNING, SystemPIDInfo.PidType.coupon); |
| | | uid = null; |
| | | } else { |
| | | if (uid == null || uid <= 0) { |
| | | 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)); |
| | | return; |
| | | } |
| | | |
| | | if (userFunctionsLimitService.isLimit(uid, SystemFunction.fanli, new Date())) { |
| | | out.print(JsonUtil.loadFalseResult(1, "该功能限制使用")); |
| | | return; |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | 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 = GoodsJumpUtil.getSuningJumpInfo(link); |
| | | |
| | | JSONObject data = JSONObject.fromObject(new Gson().toJson(vo)); |
| | | data.put("native", vo.is_native()); |
| | | if (uid != null) |
| | | data.put("userLevel", userLijinMnager.getUserLevelInfo(uid, acceptData.getSystem())); |
| | | out.print(JsonUtil.loadTrueResult(data)); |
| | | |
| | | |
| | | // 获得金币 |
| | | integralGetService.addCouponRebate(uid); |
| | | } |
| | | |
| | | |
| | | @RequestMapping(value = "getDYLink") |
| | | public void getDYLink(AcceptData acceptData, Long uid, String id, String source, PrintWriter out) { |
| | | if (StringUtil.isNullOrEmpty(id)) { |
| | | out.print(JsonUtil.loadFalseResult(1, "商品ID不能为空")); |
| | | return; |
| | | } |
| | | |
| | | if (!SystemInfoUtil.hasFunctions(acceptData.getSystem(), SystemFunction.fanli)) { |
| | | uid = null; |
| | | } else { |
| | | if (uid == null) { |
| | | uid = null; |
| | | } else { |
| | | if (uid == null || uid <= 0) { |
| | | 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)); |
| | | return; |
| | | } |
| | | |
| | | if (userFunctionsLimitService.isLimit(uid, SystemFunction.fanli, new Date())) { |
| | | out.print(JsonUtil.loadFalseResult(1, "该功能限制使用")); |
| | | return; |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | DYGoodsDetail goods = CSJCPSApiUtil.goodsDetail(Long.parseLong(id)); |
| | | if (goods == null) { |
| | | out.print(JsonUtil.loadFalseResult(2, "商品已下架")); |
| | | return; |
| | | } |
| | | |
| | | DYConvertResult link = null; |
| | | try { |
| | | link = CSJCPSApiUtil.goodsConvert(goods.getDetail_url(), DYUtil.createFanLiExtraInfo(uid), |
| | | ""); |
| | | } catch (Exception e) { |
| | | out.print(JsonUtil.loadFalseResult(2, "商品转链失败")); |
| | | } |
| | | |
| | | GoodsJumpLinkVO vo = GoodsJumpUtil.getDYJumpInfo(link); |
| | | |
| | | JSONObject data = JSONObject.fromObject(new Gson().toJson(vo)); |
| | | data.put("native", vo.is_native()); |
| | | if (uid != null) |
| | | data.put("userLevel", userLijinMnager.getUserLevelInfo(uid, acceptData.getSystem())); |
| | | out.print(JsonUtil.loadTrueResult(data)); |
| | | |
| | | |
| | | // 获得金币 |
| | | integralGetService.addCouponRebate(uid); |
| | |
| | | if (goodsType == Constant.SOURCE_TYPE_TAOBAO) { |
| | | TaoBaoGoodsBrief goods = null; |
| | | try { |
| | | goods = TaoKeApiUtil.getSimpleGoodsInfo(Long.parseLong(goodsId)); |
| | | goods = TaoKeApiUtil.getSimpleGoodsInfo(goodsId); |
| | | } catch (NumberFormatException e) { |
| | | e.printStackTrace(); |
| | | } catch (TaobaoGoodsDownException e) { |
| | |
| | | for (int i = 0; i < array.size(); i++) { |
| | | JSONObject obj = array.optJSONObject(i); |
| | | CommonGoods cg = new CommonGoods(); |
| | | cg.setGoodsId(obj.optLong("goodsId")); |
| | | cg.setGoodsId(obj.optString("goodsId")); |
| | | cg.setGoodsType(obj.optInt("goodsType")); |
| | | commonGoodsList.add(cg); |
| | | } |
| | |
| | | } |
| | | |
| | | // 分离各个平台的商品信息 |
| | | List<Long> tbGoodsList = new ArrayList<>(); |
| | | List<String> tbGoodsList = new ArrayList<>(); |
| | | List<Long> jdGoodsList = new ArrayList<>(); |
| | | List<Long> pddGoodsList = new ArrayList<>(); |
| | | |
| | |
| | | if (cg.getGoodsType() == Constant.SOURCE_TYPE_TAOBAO) { |
| | | tbGoodsList.add(cg.getGoodsId()); |
| | | } else if (cg.getGoodsType() == Constant.SOURCE_TYPE_JD) { |
| | | jdGoodsList.add(cg.getGoodsId()); |
| | | jdGoodsList.add(Long.parseLong(cg.getGoodsId())); |
| | | } else if (cg.getGoodsType() == Constant.SOURCE_TYPE_PDD) { |
| | | pddGoodsList.add(cg.getGoodsId()); |
| | | pddGoodsList.add(Long.parseLong(cg.getGoodsId())); |
| | | } |
| | | } |
| | | |
| | | 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())); |
| | | |
| | |
| | | return; |
| | | } |
| | | |
| | | link = JDApiUtil.convertLinkWithSubUnionId(link, null, null, JDApiUtil.POSITION_FANLI + "", uid + ""); |
| | | try { |
| | | link = JDApiUtil.convertLinkWithSubUnionId(link, null, null, pidManager.getPidCache(acceptData.getSystem(), Constant.SOURCE_TYPE_JD, SystemPIDInfo.PidType.fanli), uid + ""); |
| | | } catch (Exception e) { |
| | | logger.warn(String.format("京东转链出错:materialId-%s", link), e); |
| | | } |
| | | |
| | | JSONObject data = new JSONObject(); |
| | | data.put("link", link); |
| | | |
| | | GoodsJumpLinkVO vo = GoodsJumpUtil.getJDJumpInfo(link); |
| | | JSONObject data = JSONObject.fromObject(new Gson().toJson(vo)); |
| | | data.put("native", vo.is_native()); |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data)); |
| | | } |
| | | |
| | | @RequestMapping(value = "convertPDDLink") |
| | | public void convertPDDLink(AcceptData acceptData, String resourceType, String channelType, Long uid, PrintWriter out) { |
| | | if (StringUtil.isNullOrEmpty(resourceType) && StringUtil.isNullOrEmpty(channelType)) { |
| | | out.print(JsonUtil.loadFalseResult(1, "resourceType|channelType为空")); |
| | | return; |
| | | } |
| | | String customParams = null; |
| | | if (uid != null) |
| | | customParams = pddAuthService.getFanliCustomParams(uid); |
| | | String pid = pidManager.getPidCache(acceptData.getSystem(), Constant.SOURCE_TYPE_PDD, SystemPIDInfo.PidType.fanli); |
| | | PDDConvertLinkResultVO pddConvertLinkResultVO = null; |
| | | if (!StringUtil.isNullOrEmpty(resourceType)) { |
| | | pddConvertLinkResultVO = PinDuoDuoApiUtil.convertActivity(resourceType, null, pid, customParams); |
| | | } else if (!StringUtil.isNullOrEmpty(channelType)) { |
| | | pddConvertLinkResultVO = PinDuoDuoApiUtil.convertChannel(channelType, pid, customParams); |
| | | } |
| | | |
| | | |
| | | GoodsJumpLinkVO vo = GoodsJumpUtil.getPDDJumpInfo(pddConvertLinkResultVO); |
| | | JSONObject data = JSONObject.fromObject(new Gson().toJson(vo)); |
| | | data.put("native", vo.is_native()); |
| | | out.print(JsonUtil.loadTrueResult(data)); |
| | | } |
| | | |
| | | @RequestMapping(value = "getTaoBaoGoodsDetailImgs") |
| | | public void getTaoBaoGoodsDetailImgs(AcceptData acceptData, String id, PrintWriter out) { |
| | | TaoBaoGoodsImportantInfo info = DaTaoKeApiUtil.getGoodsImportantInfo(id); |
| | | if (info == null || info.getDetailImages() == null) { |
| | | out.print(JsonUtil.loadFalseResult("")); |
| | | return; |
| | | } |
| | | out.print(JsonUtil.loadTrueResult(new Gson().toJson(info.getDetailImages()))); |
| | | } |
| | | |
| | | } |