From 9d35ba657fa5e3add766405d76e3ff8c4dcd4ad4 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期六, 04 七月 2020 15:38:00 +0800 Subject: [PATCH] 多系统兼容优化 --- fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsControllerV2.java | 3250 +++++++++++++++++++++++++++++----------------------------- 1 files changed, 1,624 insertions(+), 1,626 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 ea4855b..b891c76 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 @@ -127,1889 +127,1887 @@ @RequestMapping("api/v2/goods") public class GoodsControllerV2 { - @Resource - private BusinessSystemService businessSystemService; + @Resource + private BusinessSystemService businessSystemService; - @Resource - private ConfigService configService; + @Resource + private ConfigService configService; - @Resource - private TBPidService tbPidService; + @Resource + private TBPidService tbPidService; - @Resource - private TaoBaoGoodsCacheUtil taoBaoGoodsCacheUtil; + @Resource + private TaoBaoGoodsCacheUtil taoBaoGoodsCacheUtil; - @Resource - private RedisManager redisManager; + @Resource + private RedisManager redisManager; - @Resource - private TaoBaoShopService taoBaoShopService; + @Resource + private TaoBaoShopService taoBaoShopService; - @Resource - private ShamUserService shamUserService; + @Resource + private ShamUserService shamUserService; - @Resource - private CollectionGoodsV2Service collectionGoodsV2Service; + @Resource + private CollectionGoodsV2Service collectionGoodsV2Service; - @Resource - private TaoBaoGoodsBriefService taoBaoGoodsBriefService; + @Resource + private TaoBaoGoodsBriefService taoBaoGoodsBriefService; - @Resource - private TaoBaoGoodsUpdateService taoBaoGoodsUpdateService; + @Resource + private TaoBaoGoodsUpdateService taoBaoGoodsUpdateService; - @Resource - private TaoBaoUnionConfigService taoBaoUnionConfigService; + @Resource + private TaoBaoUnionConfigService taoBaoUnionConfigService; - @Resource - private DaTaoKeGoodsDetailV2Service daTaoKeGoodsDetailV2Service; + @Resource + private DaTaoKeGoodsDetailV2Service daTaoKeGoodsDetailV2Service; - @Resource - private OrderHongBaoMoneyComputeService orderHongBaoMoneyComputeService; + @Resource + private OrderHongBaoMoneyComputeService orderHongBaoMoneyComputeService; - @Resource - private SystemClientParamsService systemClientParamsService; + @Resource + private SystemClientParamsService systemClientParamsService; - @Resource - private UserGoodsStorageService userGoodsStorageService; + @Resource + private UserGoodsStorageService userGoodsStorageService; - @Resource - private ConfigTaoLiJinService configTaoLiJinService; + @Resource + private ConfigTaoLiJinService configTaoLiJinService; - @Resource - private UserInfoExtraService userInfoExtraService; + @Resource + private UserInfoExtraService userInfoExtraService; - @Resource - private UserMoneyExtraService userMoneyExtraService; + @Resource + private UserMoneyExtraService userMoneyExtraService; - @Resource - private ScanHistoryV2Service scanHistoryV2Service; + @Resource + private ScanHistoryV2Service scanHistoryV2Service; - @Resource - private TLJBuyGoodsService tljBuyGoodsService; + @Resource + private TLJBuyGoodsService tljBuyGoodsService; - @Resource - private UserInfoService userInfoService; + @Resource + private UserInfoService userInfoService; - @Resource - private JDGoodsCacheUtil jdGoodsCacheUtil; + @Resource + private JDGoodsCacheUtil jdGoodsCacheUtil; - @Resource - private PinDuoDuoCacheUtil pinDuoDuoCacheUtil; + @Resource + private PinDuoDuoCacheUtil pinDuoDuoCacheUtil; - @Resource - private IntegralGetService integralGetService; + @Resource + private IntegralGetService integralGetService; - @Resource - private JumpDetailV2Service jumpDetailV2Service; + @Resource + private JumpDetailV2Service jumpDetailV2Service; - @Resource - private JDGoodsClassService jdGoodsClassService; + @Resource + private JDGoodsClassService jdGoodsClassService; - @Resource - private TLJFreeBuyGoodsService tljFreeBuyGoodsService; + @Resource + private TLJFreeBuyGoodsService tljFreeBuyGoodsService; - @Resource - private UserTaoLiJinNewbiesService userTaoLiJinNewbiesService; + @Resource + private UserTaoLiJinNewbiesService userTaoLiJinNewbiesService; - @Resource - private UserVIPInfoService userVIPInfoService; + @Resource + private UserVIPInfoService userVIPInfoService; - @Resource - private UserVipConfigService userVipConfigService; + @Resource + private UserVipConfigService userVipConfigService; - @Resource - private GoodsEvaluateService goodsEvaluateService; + @Resource + private GoodsEvaluateService goodsEvaluateService; - @Resource - private UserLevelManager userLevelManager; + @Resource + private UserLevelManager userLevelManager; - @Resource - private HongBaoManageService hongBaoManageService; + @Resource + private HongBaoManageService hongBaoManageService; - private ConfigParamsDTO getParamsDTO(String platform, String version, Long uid) { - UserLevelEnum level = UserLevelEnum.daRen; - if (uid != null && uid > 0) { - level = userLevelManager.getUserLevel(uid); - if (level != null) { - if (System.currentTimeMillis() < Constant.NEW_ORDER_FANLI_RULE_TIME) - level = UserLevelUtil.getOldLevel(level); - } - } - if (level == null) - level = UserLevelEnum.daRen; - return orderHongBaoMoneyComputeService.getShowComputeRate(platform, version, level); - } + private ConfigParamsDTO getParamsDTO(String platform, String version, Long uid) { + UserLevelEnum level = UserLevelEnum.daRen; + if (uid != null && uid > 0) { + level = userLevelManager.getUserLevel(uid); + if (level != null) { + if (System.currentTimeMillis() < Constant.NEW_ORDER_FANLI_RULE_TIME) + level = UserLevelUtil.getOldLevel(level); + } + } + if (level == null) + level = UserLevelEnum.daRen; + return orderHongBaoMoneyComputeService.getShowComputeRate(platform, version, level); + } - private TaoBaoGoodsBrief filterDaTaoKeGoodsInfo(TaoBaoGoodsBrief goods) { - try { - DaTaoKeFilterResult result = daTaoKeGoodsDetailV2Service.filterTaoBaoGoods(goods); - if (result.getFilterType() == DaTaoKeFilterResult.FILTER_TYPE_COUPON - || result.getFilterType() == DaTaoKeFilterResult.FILTER_TYPE_PRICE_AND_COUPON) { - // 缂撳瓨鍩虹閾炬帴 - String dpid = null; - if (TaoBaoUtil.isSpecialGoods(goods.getMaterialLibType())) { - dpid = TaoBaoConstant.TAOBAO_SPECIAL_PID_DEFAULT; - } else { - dpid = TaoBaoConstant.TAOBAO_RELATION_AS_SPECIAL_PID; - } - 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); - if (!StringUtil.isNullOrEmpty(link)) { - // result.getGoods().setCouponLink(link); - taoBaoGoodsCacheUtil.cacheBaseConvertLink(goods.getAuctionId(), dpid, link); - } - return result.getGoods(); - } - } - } catch (Exception e) { - LogHelper.errorDetailInfo(e); - } + private TaoBaoGoodsBrief filterDaTaoKeGoodsInfo(TaoBaoGoodsBrief goods) { + try { + DaTaoKeFilterResult result = daTaoKeGoodsDetailV2Service.filterTaoBaoGoods(goods); + if (result.getFilterType() == DaTaoKeFilterResult.FILTER_TYPE_COUPON + || result.getFilterType() == DaTaoKeFilterResult.FILTER_TYPE_PRICE_AND_COUPON) { + // 缂撳瓨鍩虹閾炬帴 + String dpid = null; + if (TaoBaoUtil.isSpecialGoods(goods.getMaterialLibType())) { + dpid = TaoBaoConstant.TAOBAO_SPECIAL_PID_DEFAULT; + } else { + dpid = TaoBaoConstant.TAOBAO_RELATION_AS_SPECIAL_PID; + } + 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); + if (!StringUtil.isNullOrEmpty(link)) { + // result.getGoods().setCouponLink(link); + taoBaoGoodsCacheUtil.cacheBaseConvertLink(goods.getAuctionId(), dpid, link); + } + return result.getGoods(); + } + } + } catch (Exception e) { + LogHelper.errorDetailInfo(e); + } - return goods; - } + return goods; + } - /** - * 娣樺疂鍟嗗搧璇︽儏 - * - * @param acceptData - * @param id - * @param uid - * @param from - * @param out - */ - @RequestMapping(value = "getDetailTB", method = RequestMethod.POST) - public void getDetialTB(AcceptData acceptData, Long id, Long uid, String from, PrintWriter out) { - if (id == null) { - out.print(JsonUtil.loadFalseResult(1, "鍟嗗搧id涓嶈兘涓虹┖")); - return; - } + /** + * 娣樺疂鍟嗗搧璇︽儏 + * + * @param acceptData + * @param id + * @param uid + * @param from + * @param out + */ + @RequestMapping(value = "getDetailTB", method = RequestMethod.POST) + public void getDetialTB(AcceptData acceptData, Long id, Long uid, String from, PrintWriter out) { + if (id == null) { + out.print(JsonUtil.loadFalseResult(1, "鍟嗗搧id涓嶈兘涓虹┖")); + return; + } - BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(), - acceptData.getPackages()); - if (system == null) { - out.print(JsonUtil.loadFalseResult(1, "绯荤粺涓嶅瓨鍦�")); - return; - } + BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(), + acceptData.getPackages()); + if (system == null) { + out.print(JsonUtil.loadFalseResult(1, "绯荤粺涓嶅瓨鍦�")); + return; + } - GoodsDetailExtraVO extraVO = new GoodsDetailExtraVO(); - extraVO.setIsNative(false); + GoodsDetailExtraVO extraVO = new GoodsDetailExtraVO(); + extraVO.setIsNative(false); - // IOS鏄惁姝e湪涓婄嚎 - if ("ios".equalsIgnoreCase(acceptData.getPlatform())) { - String version = acceptData.getVersion(); - extraVO.setIosOnling(configService.iosOnLining(Integer.parseInt(version),acceptData.getSystem())); - } + // IOS鏄惁姝e湪涓婄嚎 + if ("ios".equalsIgnoreCase(acceptData.getPlatform())) { + String version = acceptData.getVersion(); + extraVO.setIosOnling(configService.iosOnLining(Integer.parseInt(version), acceptData.getSystem())); + } - long startTime = java.lang.System.currentTimeMillis(); + long startTime = java.lang.System.currentTimeMillis(); - // 鑾峰彇娣樺鍙傛暟 - ClientTBPid clientTBPid = null; + // 鑾峰彇娣樺鍙傛暟 + ClientTBPid clientTBPid = null; - // 鐢ㄦ埛鏈櫥褰� - if (acceptData.getPlatform().equalsIgnoreCase("android")) { - clientTBPid = tbPidService.getAndroidDefault(); - } else { - clientTBPid = tbPidService.getIOSDefault(); - } + // 鐢ㄦ埛鏈櫥褰� + if (acceptData.getPlatform().equalsIgnoreCase("android")) { + clientTBPid = tbPidService.getAndroidDefault(); + } else { + clientTBPid = tbPidService.getIOSDefault(); + } - LogHelper.test("鑾峰彇PID鑰楁椂锛�" + (java.lang.System.currentTimeMillis() - startTime)); + LogHelper.test("鑾峰彇PID鑰楁椂锛�" + (java.lang.System.currentTimeMillis() - startTime)); - // final List<TaoBaoGoodsBrief> goodsList = new ArrayList<>(); - // 鏄惁鍦ㄦ湇鍔$杩涜杞摼 - boolean convertInServer = configService.isConvertTaoBaoLinkInServer(acceptData.getSystem()); + // final List<TaoBaoGoodsBrief> goodsList = new ArrayList<>(); + // 鏄惁鍦ㄦ湇鍔$杩涜杞摼 + boolean convertInServer = configService.isConvertTaoBaoLinkInServer(acceptData.getSystem()); - TaoBaoGoodsBrief goods = null; + TaoBaoGoodsBrief goods = null; - if (!convertInServer) { - try { - goods = taoBaoGoodsCacheUtil.getCommonTaoBaoGoodsInfo(id); - if (goods == null) { - TaoKeAppInfo app = new TaoKeAppInfo(); - app.setAppKey(TaoBaoConstant.TAOBAO_COMMON_APPKEY); - app.setAppSecret(TaoBaoConstant.TAOBAO_COMMON_APPSECRET); - app.setPid(TaoBaoConstant.TAOBAO_COMMON_PID); - app.setAdzoneId(TaoBaoConstant.TAOBAO_COMMON_PID.split("_")[3]); - goods = TaoKeApiUtil.searchGoodsDetail(id, app); + if (!convertInServer) { + try { + goods = taoBaoGoodsCacheUtil.getCommonTaoBaoGoodsInfo(id); + if (goods == null) { + TaoKeAppInfo app = new TaoKeAppInfo(); + app.setAppKey(TaoBaoConstant.TAOBAO_COMMON_APPKEY); + app.setAppSecret(TaoBaoConstant.TAOBAO_COMMON_APPSECRET); + app.setPid(TaoBaoConstant.TAOBAO_COMMON_PID); + app.setAdzoneId(TaoBaoConstant.TAOBAO_COMMON_PID.split("_")[3]); + goods = TaoKeApiUtil.searchGoodsDetail(id, app); - final TaoBaoGoodsBrief finalGoods = goods; - if (goods != null) { - ThreadUtil.run(new Runnable() { - @Override - public void run() { - taoBaoGoodsCacheUtil.saveCommonTaoBaoGoodsInfo(finalGoods); - } - }); - } - } - } catch (TaobaoGoodsDownException e) { - // 鍟嗗搧涓嬫灦 - ThreadUtil.run(new Runnable() { + final TaoBaoGoodsBrief finalGoods = goods; + if (goods != null) { + ThreadUtil.run(new Runnable() { + @Override + public void run() { + taoBaoGoodsCacheUtil.saveCommonTaoBaoGoodsInfo(finalGoods); + } + }); + } + } + } catch (TaobaoGoodsDownException e) { + // 鍟嗗搧涓嬫灦 + ThreadUtil.run(new Runnable() { - public void run() { - taoBaoGoodsUpdateService.offlineTaoBaoGoods(id); - } - }); - } + public void run() { + taoBaoGoodsUpdateService.offlineTaoBaoGoods(id); + } + }); + } - } else { - final String clientPid = clientTBPid.getPid(); - String appId = clientPid.split("_")[2]; - TaoBaoUnionConfig config = taoBaoUnionConfigService.getConfigByAppIdCache(appId); - TaoKeAppInfo app = new TaoKeAppInfo(); - app.setAdzoneId(clientPid.split("_")[3]); - app.setAppKey(config.getAppKey()); - app.setAppSecret(config.getAppSecret()); - app.setPid(clientPid); + } else { + final String clientPid = clientTBPid.getPid(); + String appId = clientPid.split("_")[2]; + TaoBaoUnionConfig config = taoBaoUnionConfigService.getConfigByAppIdCache(appId); + TaoKeAppInfo app = new TaoKeAppInfo(); + app.setAdzoneId(clientPid.split("_")[3]); + app.setAppKey(config.getAppKey()); + app.setAppSecret(config.getAppSecret()); + app.setPid(clientPid); - try { - goods = TaoKeApiUtil.searchGoodsDetail(id, app); - if (goods.getTkRate() == null || new BigDecimal(0).compareTo(goods.getTkRate()) == 0) { - TaoBaoGoodsBrief linkInfo = TaoKeApiUtil.specialConvertCoupon(goods.getAuctionId(), app); - if (linkInfo != null) { - goods.setAuctionUrl(linkInfo.getAuctionUrl()); - goods.setCouponLink(linkInfo.getCouponLink()); - goods.setTkRate(linkInfo.getTkRate()); - } - } + try { + goods = TaoKeApiUtil.searchGoodsDetail(id, app); + if (goods.getTkRate() == null || new BigDecimal(0).compareTo(goods.getTkRate()) == 0) { + TaoBaoGoodsBrief linkInfo = TaoKeApiUtil.specialConvertCoupon(goods.getAuctionId(), app); + if (linkInfo != null) { + goods.setAuctionUrl(linkInfo.getAuctionUrl()); + goods.setCouponLink(linkInfo.getCouponLink()); + goods.setTkRate(linkInfo.getTkRate()); + } + } - } catch (NumberFormatException e) { - e.printStackTrace(); - } catch (TaobaoGoodsDownException e) { - ThreadUtil.run(new Runnable() { - public void run() { - taoBaoGoodsUpdateService.offlineTaoBaoGoods(id); - } - }); - } + } catch (NumberFormatException e) { + e.printStackTrace(); + } catch (TaobaoGoodsDownException e) { + ThreadUtil.run(new Runnable() { + public void run() { + taoBaoGoodsUpdateService.offlineTaoBaoGoods(id); + } + }); + } - } + } - if (goods != null) { - final TaoBaoGoodsBrief newGoods = goods; - ThreadUtil.run(new Runnable() { - public void run() { - try { - // 鏇存柊鍟嗗搧 - LogHelper.test("鏇存柊鍟嗗搧璇︽儏:" + newGoods.getAuctionId()); - taoBaoGoodsUpdateService.updateTaoBaoGoods(newGoods); - } catch (TaobaoGoodsUpdateException e) { + if (goods != null) { + final TaoBaoGoodsBrief newGoods = goods; + ThreadUtil.run(new Runnable() { + public void run() { + try { + // 鏇存柊鍟嗗搧 + LogHelper.test("鏇存柊鍟嗗搧璇︽儏:" + newGoods.getAuctionId()); + taoBaoGoodsUpdateService.updateTaoBaoGoods(newGoods); + } catch (TaobaoGoodsUpdateException e) { - } - } - }); - } + } + } + }); + } - TaoBaoGoodsBrief tb = goods; + TaoBaoGoodsBrief tb = goods; - if (tb == null) { - out.print(JsonUtil.loadFalseResult(2, "鍟嗗搧涓嶅瓨鍦�")); - return; - } + if (tb == null) { + out.print(JsonUtil.loadFalseResult(2, "鍟嗗搧涓嶅瓨鍦�")); + return; + } - if (tb.getImgList() == null) { - tb.setImgList(new ArrayList<>()); - } + if (tb.getImgList() == null) { + tb.setImgList(new ArrayList<>()); + } - // tb.getImgList().add(0, tb.getPictUrl()); + // tb.getImgList().add(0, tb.getPictUrl()); - List<String> finalImgList = new ArrayList<>(); - for (String img : tb.getImgList()) { - finalImgList.add(TbImgUtil.getTBSizeImg(img, 600)); - } + List<String> finalImgList = new ArrayList<>(); + for (String img : tb.getImgList()) { + finalImgList.add(TbImgUtil.getTBSizeImg(img, 600)); + } - if (finalImgList.size() == 0) { - finalImgList.add(tb.getPictUrl()); - } + if (finalImgList.size() == 0) { + finalImgList.add(tb.getPictUrl()); + } - if (!StringUtil.isNullOrEmpty(tb.getPictUrlWhite())) - finalImgList.add(0, tb.getPictUrlWhite()); + if (!StringUtil.isNullOrEmpty(tb.getPictUrlWhite())) + finalImgList.add(0, tb.getPictUrlWhite()); - // 绉婚櫎鐩稿悓鍥剧墖 - if (finalImgList.size() > 0) - for (int i = 0; i < finalImgList.size(); i++) { - if (i < finalImgList.size() - 1) - if (TbImgUtil.getTBSizeImg(finalImgList.get(i), 600) - .equalsIgnoreCase(TbImgUtil.getTBSizeImg(finalImgList.get(i + 1), 600))) { - finalImgList.remove(i--); - } - } + // 绉婚櫎鐩稿悓鍥剧墖 + if (finalImgList.size() > 0) + for (int i = 0; i < finalImgList.size(); i++) { + if (i < finalImgList.size() - 1) + if (TbImgUtil.getTBSizeImg(finalImgList.get(i), 600) + .equalsIgnoreCase(TbImgUtil.getTBSizeImg(finalImgList.get(i + 1), 600))) { + finalImgList.remove(i--); + } + } - tb.setImgList(finalImgList); + tb.setImgList(finalImgList); - // 澶ф窐瀹㈠晢鍝佽繃婊� - try { - goods = filterDaTaoKeGoodsInfo(goods); - } catch (Exception e) { - LogHelper.errorDetailInfo(e); - } + // 澶ф窐瀹㈠晢鍝佽繃婊� + try { + goods = filterDaTaoKeGoodsInfo(goods); + } catch (Exception e) { + LogHelper.errorDetailInfo(e); + } - ConfigParamsDTO paramsDTO = getParamsDTO(acceptData.getPlatform(), acceptData.getVersion(), uid); - paramsDTO.setBaseFanliRate(hongBaoManageService.getBaseFanliRate()); + ConfigParamsDTO paramsDTO = getParamsDTO(acceptData.getPlatform(), acceptData.getVersion(), uid); + paramsDTO.setBaseFanliRate(hongBaoManageService.getBaseFanliRate()); - GoodsDetailVO goodsDetail = GoodsDetailVOFactory.convertTaoBao(goods, paramsDTO); - if (goodsDetail != null && goodsDetail.getMoneyInfo() != null && userVIPInfoService.isVIP(uid)) { - goodsDetail.getMoneyInfo().setFanliMoney(goodsDetail.getMoneyInfo().getMaxMoney()); - goodsDetail.getMoneyInfo().setShareMoney("楼" + TaoBaoUtil.getGoodsHongBaoMoney(goods, - hongBaoManageService.getShareRate(UserLevelEnum.superVIP), true)); - goodsDetail.getMoneyInfo().setRateInfo(goodsDetail.getMoneyInfo().getMaxRateInfo()); - goodsDetail.getMoneyInfo().setCompositionInfo(goodsDetail.getMoneyInfo().getMaxCompositionInfo()); - } - goodsDetail.getMoneyInfo() - .setRateInfoHelpUrl(configService.getValue(ConfigKeyEnum.goodsDetailFanliRateHelpUrl.getKey(),acceptData.getSystem())); + GoodsDetailVO goodsDetail = GoodsDetailVOFactory.convertTaoBao(goods, paramsDTO); + if (goodsDetail != null && goodsDetail.getMoneyInfo() != null && userVIPInfoService.isVIP(uid)) { + goodsDetail.getMoneyInfo().setFanliMoney(goodsDetail.getMoneyInfo().getMaxMoney()); + goodsDetail.getMoneyInfo().setShareMoney("楼" + TaoBaoUtil.getGoodsHongBaoMoney(goods, + hongBaoManageService.getShareRate(UserLevelEnum.superVIP), true)); + goodsDetail.getMoneyInfo().setRateInfo(goodsDetail.getMoneyInfo().getMaxRateInfo()); + goodsDetail.getMoneyInfo().setCompositionInfo(goodsDetail.getMoneyInfo().getMaxCompositionInfo()); + } + goodsDetail.getMoneyInfo() + .setRateInfoHelpUrl(configService.getValue(ConfigKeyEnum.goodsDetailFanliRateHelpUrl.getKey(), acceptData.getSystem())); - if (TaoBaoUtil.isYUShou(goods)) { - if (!StringUtil.isNullOrEmpty(goods.getPresaleDiscountFeeText())) { - if (goodsDetail.getLabels() == null) - goodsDetail.setLabels(new ArrayList<>()); - goodsDetail.getLabels().add(new ClientTextStyleVO(goods.getPresaleDiscountFeeText(), "#FF2B4E")); - } - } - // 鍦ㄦ爣棰樻坊鍔犱紭鎯犱俊鎭� + if (TaoBaoUtil.isYUShou(goods)) { + if (!StringUtil.isNullOrEmpty(goods.getPresaleDiscountFeeText())) { + if (goodsDetail.getLabels() == null) + goodsDetail.setLabels(new ArrayList<>()); + goodsDetail.getLabels().add(new ClientTextStyleVO(goods.getPresaleDiscountFeeText(), "#FF2B4E")); + } + } + // 鍦ㄦ爣棰樻坊鍔犱紭鎯犱俊鎭� - // 搴楅摵淇℃伅 - TaoBaoShop shop = taoBaoShopService.getTaoBaoShop(id, goods.getSellerId()); - if (shop != null) { - String shopLink = shop.getShopLink(); - if (StringUtil.isNullOrEmpty(shopLink)) { - shop.setShopLink(TaoBaoUtil.getShopLink(shop.getId())); - } - goodsDetail.setShopInfo(ShopInfoVOFactory.convertTaoBaoShop(shop)); - } + // 搴楅摵淇℃伅 + TaoBaoShop shop = taoBaoShopService.getTaoBaoShop(id, goods.getSellerId()); + if (shop != null) { + String shopLink = shop.getShopLink(); + if (StringUtil.isNullOrEmpty(shopLink)) { + shop.setShopLink(TaoBaoUtil.getShopLink(shop.getId())); + } + goodsDetail.setShopInfo(ShopInfoVOFactory.convertTaoBaoShop(shop)); + } - // 鍏嶅崟鍟嗗搧 - if (!StringUtil.isNullOrEmpty(from) && "miandan".equals(from)) { - MoneyInfoVO moneyInfo = goodsDetail.getMoneyInfo(); - if (goodsDetail.isHasCoupon()) { - moneyInfo.setFanliMoney("楼" + goodsDetail.getCouponPrice()); - } else { - moneyInfo.setFanliMoney("楼" + goodsDetail.getZkPrice()); - } - goodsDetail.setMoneyInfo(moneyInfo); - } + // 鍏嶅崟鍟嗗搧 + if (!StringUtil.isNullOrEmpty(from) && "miandan".equals(from)) { + MoneyInfoVO moneyInfo = goodsDetail.getMoneyInfo(); + if (goodsDetail.isHasCoupon()) { + moneyInfo.setFanliMoney("楼" + goodsDetail.getCouponPrice()); + } else { + moneyInfo.setFanliMoney("楼" + goodsDetail.getZkPrice()); + } + goodsDetail.setMoneyInfo(moneyInfo); + } - extraVO.setTbPidInfo(clientTBPid); - extraVO.setDetailUrl("http://apph5.banliapp.com/apppage/goods_img.html?id=" + id); + extraVO.setTbPidInfo(clientTBPid); + extraVO.setDetailUrl("http://apph5.banliapp.com/apppage/goods_img.html?id=" + id); - // 鍒嗕韩璧氫汉鎻愮ず - MoneyInfoVO moneyInfo = goodsDetail.getMoneyInfo(); - List<ShamUser> listShareUser = new ArrayList<ShamUser>(); - if (moneyInfo != null) { - String shareMoney = moneyInfo.getShareMoney(); - if (goods.getBiz30day() >= 1000) { - listShareUser = shamUserService.listRandShareUser(10, new BigDecimal(shareMoney.replaceAll("楼", "")), 1, - 5); - } - } - extraVO.setListShareUser(listShareUser); + // 鍒嗕韩璧氫汉鎻愮ず + MoneyInfoVO moneyInfo = goodsDetail.getMoneyInfo(); + List<ShamUser> listShareUser = new ArrayList<ShamUser>(); + if (moneyInfo != null) { + String shareMoney = moneyInfo.getShareMoney(); + if (goods.getBiz30day() >= 1000) { + listShareUser = shamUserService.listRandShareUser(10, new BigDecimal(shareMoney.replaceAll("楼", "")), 1, + 5); + } + } + extraVO.setListShareUser(listShareUser); - // 棰嗗埜浜哄垪琛� - List<ShamUser> listCouponUser = new ArrayList<ShamUser>(); - if (!StringUtil.isNullOrEmpty(goods.getCouponInfo()) && goods.getCouponAmount() != null - && goods.getCouponAmount().compareTo(new BigDecimal(0)) > 0) { - if (goods.getBiz30day() >= 1000) { - listCouponUser = shamUserService.listRandCouponUser(5, 1, 300); - } - } - extraVO.setListCouponUser(listCouponUser); + // 棰嗗埜浜哄垪琛� + List<ShamUser> listCouponUser = new ArrayList<ShamUser>(); + if (!StringUtil.isNullOrEmpty(goods.getCouponInfo()) && goods.getCouponAmount() != null + && goods.getCouponAmount().compareTo(new BigDecimal(0)) > 0) { + if (goods.getBiz30day() >= 1000) { + listCouponUser = shamUserService.listRandCouponUser(5, 1, 300); + } + } + extraVO.setListCouponUser(listCouponUser); - if (uid != null) { - // 鏄惁鍔犲叆鏀惰棌 - CollectionGoodsV2 collectionGoods = collectionGoodsV2Service.findByUidAndAuctionId(uid, id, - Constant.SOURCE_TYPE_TAOBAO); - extraVO.setCollected(collectionGoods != null ? true : false); - // 鏄惁鍔犲叆閫夊搧搴� - extraVO.setStorage(userGoodsStorageService.isExistStorage(uid, id, Constant.SOURCE_TYPE_TAOBAO)); - } + if (uid != null) { + // 鏄惁鍔犲叆鏀惰棌 + CollectionGoodsV2 collectionGoods = collectionGoodsV2Service.findByUidAndAuctionId(uid, id, + Constant.SOURCE_TYPE_TAOBAO); + extraVO.setCollected(collectionGoods != null ? true : false); + // 鏄惁鍔犲叆閫夊搧搴� + extraVO.setStorage(userGoodsStorageService.isExistStorage(uid, id, Constant.SOURCE_TYPE_TAOBAO)); + } - // 娴嬭瘯 - SystemClientParams params = systemClientParamsService.getSystemClientParamsBySystemAndKey(system, - "goods_detail_jump_taobao"); - if ("1".equalsIgnoreCase((params.getValue() + "").trim())) { - extraVO.setIsNative(true); - } + // 娴嬭瘯 + SystemClientParams params = systemClientParamsService.getSystemClientParamsBySystemAndKey(system, + "goods_detail_jump_taobao"); + if ("1".equalsIgnoreCase((params.getValue() + "").trim())) { + extraVO.setIsNative(true); + } - String h5Url = String.format("http://%s%s?uid=%s&id=%s&appType=flq", configService.getH5Host(acceptData.getSystem()), - Constant.systemCommonConfig.getShareGoodsPagePath(), "", id + ""); + String h5Url = String.format("http://%s%s?uid=%s&id=%s&appType=flq", configService.getH5Host(acceptData.getSystem()), + Constant.systemCommonConfig.getShareGoodsPagePath(), "", id + ""); - extraVO.setH5Url(h5Url); + extraVO.setH5Url(h5Url); - String helpLink = null; - boolean fanliValid = true; - boolean shareValid = true; - int moneyType = 1; + String helpLink = null; + boolean fanliValid = true; + boolean shareValid = true; + int moneyType = 1; - if (from != null && from.equals("taolijin_buy")) { - // 鏌ヨ鍒嗕韩搴� - TLJBuyGoods buyGoods = tljBuyGoodsService.selectByAuctionIdAndDay(id, - TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyy-MM-dd")); - if (buyGoods == null) { - out.print(JsonUtil.loadFalseResult(2, "鑷喘绔嬪噺绾㈠寘杩囨湡")); - return; - } + if (from != null && from.equals("taolijin_buy")) { + // 鏌ヨ鍒嗕韩搴� + TLJBuyGoods buyGoods = tljBuyGoodsService.selectByAuctionIdAndDay(id, + TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyy-MM-dd")); + if (buyGoods == null) { + out.print(JsonUtil.loadFalseResult(2, "鑷喘绔嬪噺绾㈠寘杩囨湡")); + return; + } - moneyType = 2; - fanliValid = true; - shareValid = false; - helpLink = configService.getValue(ConfigKeyEnum.zigoulijianNofanliHelp.getKey(),acceptData.getSystem()); + moneyType = 2; + fanliValid = true; + shareValid = false; + helpLink = configService.getValue(ConfigKeyEnum.zigoulijianNofanliHelp.getKey(), acceptData.getSystem()); - BigDecimal tljHongBao = TaoBaoUtil.getGoodsHongBaoMoney(goods, TaoBaoConstant.OWN_BUY_WITHOUT_FANLI_RATE, - false); + BigDecimal tljHongBao = TaoBaoUtil.getGoodsHongBaoMoney(goods, TaoBaoConstant.OWN_BUY_WITHOUT_FANLI_RATE, + false); - ReduceHongBao reduceHongBao = new ReduceHongBao(); - reduceHongBao.setLeft(buyGoods.getLeftHongBaoCount()); - reduceHongBao.setMoney(tljHongBao.toString()); - reduceHongBao.setName("浠樻绔嬪噺 "); - reduceHongBao.setTip("褰撴棩棰嗗彇锛屽綋鏃ュ唴浣跨敤锛岃繃鏈熷け鏁�"); - reduceHongBao.setTotal(buyGoods.getTotalHongBaoCount()); + ReduceHongBao reduceHongBao = new ReduceHongBao(); + reduceHongBao.setLeft(buyGoods.getLeftHongBaoCount()); + reduceHongBao.setMoney(tljHongBao.toString()); + reduceHongBao.setName("浠樻绔嬪噺 "); + reduceHongBao.setTip("褰撴棩棰嗗彇锛屽綋鏃ュ唴浣跨敤锛岃繃鏈熷け鏁�"); + reduceHongBao.setTotal(buyGoods.getTotalHongBaoCount()); - OtherInfo otherInfo = new OtherInfo(); - otherInfo.setReduceHongBao(reduceHongBao); - goodsDetail.setOtherInfo(otherInfo); + OtherInfo otherInfo = new OtherInfo(); + otherInfo.setReduceHongBao(reduceHongBao); + goodsDetail.setOtherInfo(otherInfo); - // 1.6.5鍚庢敼涓虹鍒╀环 - if (com.yeshi.fanli.util.VersionUtil.greaterThan_1_6_5(acceptData.getPlatform(), acceptData.getVersion())) { - if (goodsDetail.getCouponPrice() != null - && goodsDetail.getCouponPrice().compareTo(new BigDecimal(0)) > 0) - goodsDetail.setCouponPrice(goodsDetail.getCouponPrice().subtract(tljHongBao)); - else - goodsDetail.setZkPrice(goodsDetail.getZkPrice().subtract(tljHongBao)); - } - } else if (from != null && from.equals("taolijin_free_buy")) { - TLJFreeBuyGoods freeGoods = tljFreeBuyGoodsService.selectByAuctionIdAndDay(id, - TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyy-MM-dd")); - if (freeGoods == null) { - out.print(JsonUtil.loadFalseResult(2, "鍏嶅崟鍟嗗搧宸蹭笅鏋�")); - return; - } + // 1.6.5鍚庢敼涓虹鍒╀环 + if (com.yeshi.fanli.util.VersionUtil.greaterThan_1_6_5(acceptData.getPlatform(), acceptData.getVersion())) { + if (goodsDetail.getCouponPrice() != null + && goodsDetail.getCouponPrice().compareTo(new BigDecimal(0)) > 0) + goodsDetail.setCouponPrice(goodsDetail.getCouponPrice().subtract(tljHongBao)); + else + goodsDetail.setZkPrice(goodsDetail.getZkPrice().subtract(tljHongBao)); + } + } else if (from != null && from.equals("taolijin_free_buy")) { + TLJFreeBuyGoods freeGoods = tljFreeBuyGoodsService.selectByAuctionIdAndDay(id, + TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyy-MM-dd")); + if (freeGoods == null) { + out.print(JsonUtil.loadFalseResult(2, "鍏嶅崟鍟嗗搧宸蹭笅鏋�")); + return; + } - fanliValid = true; - shareValid = false; - BigDecimal couponPrice = goodsDetail.getCouponPrice(); - if (couponPrice == null) - couponPrice = goodsDetail.getZkPrice(); + fanliValid = true; + shareValid = false; + BigDecimal couponPrice = goodsDetail.getCouponPrice(); + if (couponPrice == null) + couponPrice = goodsDetail.getZkPrice(); - NewUserHongBao newUserHongBao = new NewUserHongBao(); - newUserHongBao.setMoney(couponPrice.setScale(2).toString()); - newUserHongBao.setName("鏂颁汉绾㈠寘 "); - newUserHongBao.setTip("褰撴棩棰嗗彇锛屽綋鏃ュ唴浣跨敤锛岃繃鏈熷け鏁�"); - newUserHongBao.setLeft(1); - newUserHongBao.setTotal(1); + NewUserHongBao newUserHongBao = new NewUserHongBao(); + newUserHongBao.setMoney(couponPrice.setScale(2).toString()); + newUserHongBao.setName("鏂颁汉绾㈠寘 "); + newUserHongBao.setTip("褰撴棩棰嗗彇锛屽綋鏃ュ唴浣跨敤锛岃繃鏈熷け鏁�"); + newUserHongBao.setLeft(1); + newUserHongBao.setTotal(1); - OtherInfo otherInfo = new OtherInfo(); - otherInfo.setReduceHongBao(newUserHongBao); - goodsDetail.setOtherInfo(otherInfo); + OtherInfo otherInfo = new OtherInfo(); + otherInfo.setReduceHongBao(newUserHongBao); + goodsDetail.setOtherInfo(otherInfo); - // 涓撳睘鏍囩 - List<ClientTextStyleVO> labels = new ArrayList<ClientTextStyleVO>(); - labels.add(new ClientTextStyleVO("鏂颁汉涓撳睘", "#FE0014")); - labels.add(new ClientTextStyleVO("瀹炰粯0鍏�", "#FF9600")); - goodsDetail.setLabels(labels); + // 涓撳睘鏍囩 + List<ClientTextStyleVO> labels = new ArrayList<ClientTextStyleVO>(); + labels.add(new ClientTextStyleVO("鏂颁汉涓撳睘", "#FE0014")); + labels.add(new ClientTextStyleVO("瀹炰粯0鍏�", "#FF9600")); + goodsDetail.setLabels(labels); - } else {// 鏅�氳喘涔� - OtherInfo otherInfo = new OtherInfo(); - RewardCouponVO rewardCoupon = new RewardCouponVO(); - rewardCoupon.setJumpDetail(jumpDetailV2Service.getByTypeCache("web")); - 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()); - if (VersionUtil.greaterThan_2_0_5(acceptData.getPlatform(), acceptData.getVersion())) { - rewardCoupon.setDesc("杩�"); - params1.put("url", userVipConfigService.getValueByKey("vip_link")); - rewardCoupon.getJumpDetail().setNeedLogin(true); - } else - rewardCoupon.setDesc("鐢ㄨ繑鍒╁鍔卞埜鏈�楂樿繑"); - rewardCoupon.setParams(params1.toString()); + } else {// 鏅�氳喘涔� + OtherInfo otherInfo = new OtherInfo(); + RewardCouponVO rewardCoupon = new RewardCouponVO(); + rewardCoupon.setJumpDetail(jumpDetailV2Service.getByTypeCache("web")); + 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()); + if (VersionUtil.greaterThan_2_0_5(acceptData.getPlatform(), acceptData.getVersion())) { + rewardCoupon.setDesc("杩�"); + params1.put("url", userVipConfigService.getValueByKey("vip_link")); + rewardCoupon.getJumpDetail().setNeedLogin(true); + } else + rewardCoupon.setDesc("鐢ㄨ繑鍒╁鍔卞埜鏈�楂樿繑"); + rewardCoupon.setParams(params1.toString()); - otherInfo.setRewardCoupon(rewardCoupon); - if ("ios".equalsIgnoreCase(acceptData.getPlatform()) - && configService.iosOnLining(Integer.parseInt(acceptData.getVersion()),acceptData.getSystem())) - otherInfo.setRewardCoupon(null); + otherInfo.setRewardCoupon(rewardCoupon); + if ("ios".equalsIgnoreCase(acceptData.getPlatform()) + && configService.iosOnLining(Integer.parseInt(acceptData.getVersion()), acceptData.getSystem())) + otherInfo.setRewardCoupon(null); - goodsDetail.setOtherInfo(otherInfo); - } - extraVO.setFanliValid(fanliValid); - extraVO.setShareValid(shareValid); + goodsDetail.setOtherInfo(otherInfo); + } + extraVO.setFanliValid(fanliValid); + extraVO.setShareValid(shareValid); - MoneyInfoVO goodsMoney = goodsDetail.getMoneyInfo(); - if (goodsMoney != null) { - goodsMoney.setMoneyType(moneyType); - } + MoneyInfoVO goodsMoney = goodsDetail.getMoneyInfo(); + if (goodsMoney != null) { + goodsMoney.setMoneyType(moneyType); + } - // 鍒嗕韩璺緞 - if (StringUtil.isNullOrEmpty(helpLink)) { - helpLink = configService.getValue(ConfigKeyEnum.noRebateHelpLink.getKey(),acceptData.getSystem()); - } + // 鍒嗕韩璺緞 + if (StringUtil.isNullOrEmpty(helpLink)) { + helpLink = configService.getValue(ConfigKeyEnum.noRebateHelpLink.getKey(), acceptData.getSystem()); + } - // 鍒嗕韩璺緞 - ShareVO shareInfoVO = new ShareVO(); - shareInfoVO.setHelpLink(helpLink); - extraVO.setShare(shareInfoVO); + // 鍒嗕韩璺緞 + ShareVO shareInfoVO = new ShareVO(); + shareInfoVO.setHelpLink(helpLink); + extraVO.setShare(shareInfoVO); - if (goodsDetail.isHasCoupon()) { - // 璁剧疆couponList - List<CouponInfoVO> couponInfoList = new ArrayList<>(); - couponInfoList.add(goodsDetail.getCouponInfo()); - goodsDetail.setCouponInfoList(couponInfoList); - } - - - if (VersionUtil.greaterThan_2_1_2(acceptData.getPlatform(), acceptData.getVersion())) { - 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())); + if (goodsDetail.isHasCoupon()) { + // 璁剧疆couponList + List<CouponInfoVO> couponInfoList = new ArrayList<>(); + couponInfoList.add(goodsDetail.getCouponInfo()); + goodsDetail.setCouponInfoList(couponInfoList); + } - final TaoBaoGoodsBrief goodsInfo = tb; - ThreadUtil.run(new Runnable() { - public void run() { - // 娣诲姞娴忚璁板綍 - try { - scanHistoryV2Service.addScanHistory(uid, acceptData.getDevice(), goodsInfo); - } catch (Exception e) { - e.printStackTrace(); - } - } - }); - } - /** - * 浜笢鍟嗗搧璇︽儏 - * - * @param acceptData - * @param id - * @param uid - * @param from - * @param out - */ - @RequestMapping(value = "getDetailJD") - public void getDetialJD(AcceptData acceptData, Long id, Long uid, String from, PrintWriter out) { - // uid=2255993L; - // 绯荤粺楠岃瘉 - BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(), - acceptData.getPackages()); - if (system == null) { - out.print(JsonUtil.loadFalseResult(1, "绯荤粺涓嶅瓨鍦�")); - return; - } + if (VersionUtil.greaterThan_2_1_2(acceptData.getPlatform(), acceptData.getVersion())) { + getCloudInfo(acceptData, uid, goodsDetail, extraVO); // 浜戝彂鍗曟枃妗堜俊鎭� + } - JDGoods jdGoods = JDApiUtil.queryGoodsDetail(id); // 楂樼骇鎺ュ彛 - if (jdGoods == null) { - jdGoods = JDUtil.getGoodsDetail(id); // 鐖彇缃戦〉 - // jdGoods = JDApiUtil.getGoodsDetail(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())); - if (jdGoods == null) { - out.print(JsonUtil.loadFalseResult(2, "鍟嗗搧涓嶅瓨鍦�")); - return; - } + final TaoBaoGoodsBrief goodsInfo = tb; + ThreadUtil.run(new Runnable() { + public void run() { + // 娣诲姞娴忚璁板綍 + try { + scanHistoryV2Service.addScanHistory(uid, acceptData.getDevice(), goodsInfo); + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + } - List<String> imageList = jdGoods.getImageList(); - if (imageList == null) { - imageList = new ArrayList<String>(); - imageList.add(jdGoods.getPicUrl()); - } + /** + * 浜笢鍟嗗搧璇︽儏 + * + * @param acceptData + * @param id + * @param uid + * @param from + * @param out + */ + @RequestMapping(value = "getDetailJD") + public void getDetialJD(AcceptData acceptData, Long id, Long uid, String from, PrintWriter out) { + // uid=2255993L; + // 绯荤粺楠岃瘉 + BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(), + acceptData.getPackages()); + if (system == null) { + out.print(JsonUtil.loadFalseResult(1, "绯荤粺涓嶅瓨鍦�")); + return; + } - // 淇濆瓨缂撳瓨 - jdGoodsCacheUtil.saveGoodsInfo(jdGoods); + JDGoods jdGoods = JDApiUtil.queryGoodsDetail(id); // 楂樼骇鎺ュ彛 + if (jdGoods == null) { + jdGoods = JDUtil.getGoodsDetail(id); // 鐖彇缃戦〉 + // jdGoods = JDApiUtil.getGoodsDetail(id); // 鏅�氭帴鍙� + } - ConfigParamsDTO paramsDTO = getParamsDTO(acceptData.getPlatform(), acceptData.getVersion(), uid); - paramsDTO.setBaseFanliRate(hongBaoManageService.getBaseFanliRate()); - GoodsDetailVO goodsDetail = GoodsDetailVOFactory.convertJDGoods(jdGoods, paramsDTO); - if (goodsDetail != null && goodsDetail.getMoneyInfo() != null && userVIPInfoService.isVIP(uid)) { - goodsDetail.getMoneyInfo().setFanliMoney(goodsDetail.getMoneyInfo().getMaxMoney()); - goodsDetail.getMoneyInfo().setShareMoney("楼" - + JDUtil.getGoodsFanLiMoney(jdGoods, hongBaoManageService.getShareRate(UserLevelEnum.superVIP))); - goodsDetail.getMoneyInfo().setRateInfo(goodsDetail.getMoneyInfo().getMaxRateInfo()); - goodsDetail.getMoneyInfo().setCompositionInfo(goodsDetail.getMoneyInfo().getMaxCompositionInfo()); - } - goodsDetail.getMoneyInfo() - .setRateInfoHelpUrl(configService.getValue(ConfigKeyEnum.goodsDetailFanliRateHelpUrl.getKey(),acceptData.getSystem())); + if (jdGoods == null) { + out.print(JsonUtil.loadFalseResult(2, "鍟嗗搧涓嶅瓨鍦�")); + return; + } - // 闄勫姞淇℃伅 - OtherInfo otherInfo = new OtherInfo(); + List<String> imageList = jdGoods.getImageList(); + if (imageList == null) { + imageList = new ArrayList<String>(); + imageList.add(jdGoods.getPicUrl()); + } - // 浜笢plus杩斿埄 - String maxMoneyPlus = null; - JDCategoryInfo categoryInfo = jdGoods.getCategoryInfo(); - if (categoryInfo != null && categoryInfo.getCid3() != null && jdGoods.getCommissionInfo() != null) { - Long cid3 = categoryInfo.getCid3(); - JDGoodsClass threeClass = jdGoodsClassService.getThreeClassByCid(Integer.parseInt(cid3.toString())); - if (threeClass != null && threeClass.getSelfComm() != null - && threeClass.getSelfComm().compareTo(new BigDecimal(0)) > 0) { - BigDecimal commissionShare = jdGoods.getCommissionInfo().getCommissionShare(); - // plus姣斾緥 灏忎簬姝e父姣斾緥 - if (commissionShare != null && commissionShare.compareTo(threeClass.getSelfComm()) > 0) { - jdGoods.setCommissionPlus(threeClass.getSelfComm()); - // plus杩斿埄 - BigDecimal fanliMoneyPlus = JDUtil.getGoodsFanLiMoneyPlus(jdGoods, - hongBaoManageService.getFanLiRate()); - otherInfo.setFanliMoneyPlus("浜笢plus杩斅�" + fanliMoneyPlus); - // 浣跨敤濂栧姳鍒告渶楂樿繑 - if (VersionUtil.greaterThan_2_0_5(acceptData.getPlatform(), acceptData.getVersion())) { - maxMoneyPlus = "锛堜含涓減lus杩斅�" + JDUtil.getGoodsFanLiMoneyPlus(jdGoods, - hongBaoManageService.getFanLiRate(UserLevelEnum.superVIP)) + "锛�"; - } else - maxMoneyPlus = "锛堜含涓減lus鏈�楂樿繑楼" - + fanliMoneyPlus.add(MoneyBigDecimalUtil.mul(fanliMoneyPlus, Constant.MAX_REWARD_RATE)) - + "锛�"; - } - } - } + // 淇濆瓨缂撳瓨 + jdGoodsCacheUtil.saveGoodsInfo(jdGoods); - // 濂栧姳鍒歌繑鍒� - RewardCouponVO rewardCoupon = new RewardCouponVO(); - rewardCoupon.setMaxMoneyPlus(maxMoneyPlus); - rewardCoupon.setJumpDetail(jumpDetailV2Service.getByTypeCache("web")); - 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")); + ConfigParamsDTO paramsDTO = getParamsDTO(acceptData.getPlatform(), acceptData.getVersion(), uid); + paramsDTO.setBaseFanliRate(hongBaoManageService.getBaseFanliRate()); + GoodsDetailVO goodsDetail = GoodsDetailVOFactory.convertJDGoods(jdGoods, paramsDTO); + if (goodsDetail != null && goodsDetail.getMoneyInfo() != null && userVIPInfoService.isVIP(uid)) { + goodsDetail.getMoneyInfo().setFanliMoney(goodsDetail.getMoneyInfo().getMaxMoney()); + goodsDetail.getMoneyInfo().setShareMoney("楼" + + JDUtil.getGoodsFanLiMoney(jdGoods, hongBaoManageService.getShareRate(UserLevelEnum.superVIP))); + goodsDetail.getMoneyInfo().setRateInfo(goodsDetail.getMoneyInfo().getMaxRateInfo()); + goodsDetail.getMoneyInfo().setCompositionInfo(goodsDetail.getMoneyInfo().getMaxCompositionInfo()); + } + goodsDetail.getMoneyInfo() + .setRateInfoHelpUrl(configService.getValue(ConfigKeyEnum.goodsDetailFanliRateHelpUrl.getKey(), acceptData.getSystem())); - rewardCoupon.setMaxMoney(goodsDetail.getMoneyInfo().getMaxMoney()); - if (VersionUtil.greaterThan_2_0_5(acceptData.getPlatform(), acceptData.getVersion())) { - rewardCoupon.setDesc("杩�"); - params1.put("url", userVipConfigService.getValueByKey("vip_link")); - rewardCoupon.getJumpDetail().setNeedLogin(true); - } else { - rewardCoupon.setDesc("鐢ㄨ繑鍒╁鍔卞埜鏈�楂樿繑"); - } - rewardCoupon.setParams(params1.toString()); + // 闄勫姞淇℃伅 + OtherInfo otherInfo = new OtherInfo(); - otherInfo.setRewardCoupon(rewardCoupon); - if ("ios".equalsIgnoreCase(acceptData.getPlatform()) - && configService.iosOnLining(Integer.parseInt(acceptData.getVersion()),acceptData.getSystem())) - otherInfo.setRewardCoupon(null); + // 浜笢plus杩斿埄 + String maxMoneyPlus = null; + JDCategoryInfo categoryInfo = jdGoods.getCategoryInfo(); + if (categoryInfo != null && categoryInfo.getCid3() != null && jdGoods.getCommissionInfo() != null) { + Long cid3 = categoryInfo.getCid3(); + JDGoodsClass threeClass = jdGoodsClassService.getThreeClassByCid(Integer.parseInt(cid3.toString())); + if (threeClass != null && threeClass.getSelfComm() != null + && threeClass.getSelfComm().compareTo(new BigDecimal(0)) > 0) { + BigDecimal commissionShare = jdGoods.getCommissionInfo().getCommissionShare(); + // plus姣斾緥 灏忎簬姝e父姣斾緥 + if (commissionShare != null && commissionShare.compareTo(threeClass.getSelfComm()) > 0) { + jdGoods.setCommissionPlus(threeClass.getSelfComm()); + // plus杩斿埄 + BigDecimal fanliMoneyPlus = JDUtil.getGoodsFanLiMoneyPlus(jdGoods, + hongBaoManageService.getFanLiRate()); + otherInfo.setFanliMoneyPlus("浜笢plus杩斅�" + fanliMoneyPlus); + // 浣跨敤濂栧姳鍒告渶楂樿繑 + if (VersionUtil.greaterThan_2_0_5(acceptData.getPlatform(), acceptData.getVersion())) { + maxMoneyPlus = "锛堜含涓減lus杩斅�" + JDUtil.getGoodsFanLiMoneyPlus(jdGoods, + hongBaoManageService.getFanLiRate(UserLevelEnum.superVIP)) + "锛�"; + } else + maxMoneyPlus = "锛堜含涓減lus鏈�楂樿繑楼" + + fanliMoneyPlus.add(MoneyBigDecimalUtil.mul(fanliMoneyPlus, Constant.MAX_REWARD_RATE)) + + "锛�"; + } + } + } - goodsDetail.setOtherInfo(otherInfo); + // 濂栧姳鍒歌繑鍒� + RewardCouponVO rewardCoupon = new RewardCouponVO(); + rewardCoupon.setMaxMoneyPlus(maxMoneyPlus); + rewardCoupon.setJumpDetail(jumpDetailV2Service.getByTypeCache("web")); + 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")); - CouponInfoVO couponInfo = goodsDetail.getCouponInfo(); - if (couponInfo != null) { - // 鍒搁摼鎺ュ鐞� - String materialId = "https://item.jd.com/" + id + ".html"; - String url = JDApiUtil.convertLinkWithSubUnionId(materialId, couponInfo.getLink(), - JDApiUtil.POSITION_COUPON + "", null); - couponInfo.setLink(url); - } + rewardCoupon.setMaxMoney(goodsDetail.getMoneyInfo().getMaxMoney()); + if (VersionUtil.greaterThan_2_0_5(acceptData.getPlatform(), acceptData.getVersion())) { + rewardCoupon.setDesc("杩�"); + params1.put("url", userVipConfigService.getValueByKey("vip_link")); + rewardCoupon.getJumpDetail().setNeedLogin(true); + } else { + rewardCoupon.setDesc("鐢ㄨ繑鍒╁鍔卞埜鏈�楂樿繑"); + } + rewardCoupon.setParams(params1.toString()); - ShopInfoVO shopInfo = goodsDetail.getShopInfo(); - if (shopInfo != null) { - if (shopInfo.getId() == null || shopInfo.getScoreGoods() == null || shopInfo.getScoreLogistics() == null - || shopInfo.getScoreSeller() == null) { - goodsDetail.setShopInfo(null); - } - } + otherInfo.setRewardCoupon(rewardCoupon); + if ("ios".equalsIgnoreCase(acceptData.getPlatform()) + && configService.iosOnLining(Integer.parseInt(acceptData.getVersion()), acceptData.getSystem())) + otherInfo.setRewardCoupon(null); - GoodsDetailExtraVO extraVO = new GoodsDetailExtraVO(); - extraVO.setIsNative(false); - // IOS鏄惁姝e湪涓婄嚎 - if ("ios".equalsIgnoreCase(acceptData.getPlatform())) { - String version = acceptData.getVersion(); - extraVO.setIosOnling(configService.iosOnLining(Integer.parseInt(version),acceptData.getSystem())); - } + goodsDetail.setOtherInfo(otherInfo); - Long inOrderCount30Days = jdGoods.getInOrderCount30Days(); - List<ShamUser> listShareUser = new ArrayList<ShamUser>(); + CouponInfoVO couponInfo = goodsDetail.getCouponInfo(); + if (couponInfo != null) { + // 鍒搁摼鎺ュ鐞� + String materialId = "https://item.jd.com/" + id + ".html"; + String url = JDApiUtil.convertLinkWithSubUnionId(materialId, couponInfo.getLink(), + JDApiUtil.POSITION_COUPON + "", null); + couponInfo.setLink(url); + } - // 浜笢寮�鍚垎浜� - String open = configService.getValue(ConfigKeyEnum.shareOpenJD.getKey(),acceptData.getSystem()); - if ("1".equals(open.trim())) { - extraVO.setShareValid(true); - MoneyInfoVO moneyInfo = goodsDetail.getMoneyInfo(); - if (moneyInfo != null) { - String shareMoney = moneyInfo.getShareMoney().replaceAll("楼", ""); - if (Integer.parseInt(inOrderCount30Days.toString()) >= 1000) { - listShareUser.addAll(shamUserService.listRandShareUser(10, new BigDecimal(shareMoney), 1, 5)); - } - } - } + ShopInfoVO shopInfo = goodsDetail.getShopInfo(); + if (shopInfo != null) { + if (shopInfo.getId() == null || shopInfo.getScoreGoods() == null || shopInfo.getScoreLogistics() == null + || shopInfo.getScoreSeller() == null) { + goodsDetail.setShopInfo(null); + } + } - extraVO.setListShareUser(listShareUser); + GoodsDetailExtraVO extraVO = new GoodsDetailExtraVO(); + extraVO.setIsNative(false); + // IOS鏄惁姝e湪涓婄嚎 + if ("ios".equalsIgnoreCase(acceptData.getPlatform())) { + String version = acceptData.getVersion(); + extraVO.setIosOnling(configService.iosOnLining(Integer.parseInt(version), acceptData.getSystem())); + } - // 棰嗗埜浜哄垪琛� - List<ShamUser> listCouponUser = new ArrayList<ShamUser>(); - if (goodsDetail.isHasCoupon() && Integer.parseInt(inOrderCount30Days.toString()) >= 1000) { - listCouponUser = shamUserService.listRandCouponUser(5, 1, 300); - } - extraVO.setListCouponUser(listCouponUser); + Long inOrderCount30Days = jdGoods.getInOrderCount30Days(); + List<ShamUser> listShareUser = new ArrayList<ShamUser>(); - if (uid != null) { - // 鏄惁鍔犲叆鏀惰棌 - 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)); - } + // 浜笢寮�鍚垎浜� + String open = configService.getValue(ConfigKeyEnum.shareOpenJD.getKey(), acceptData.getSystem()); + if ("1".equals(open.trim())) { + extraVO.setShareValid(true); + MoneyInfoVO moneyInfo = goodsDetail.getMoneyInfo(); + if (moneyInfo != null) { + String shareMoney = moneyInfo.getShareMoney().replaceAll("楼", ""); + if (Integer.parseInt(inOrderCount30Days.toString()) >= 1000) { + listShareUser.addAll(shamUserService.listRandShareUser(10, new BigDecimal(shareMoney), 1, 5)); + } + } + } - // 鍥炬枃璇︽儏 - extraVO.setDetailUrl("https://in.m.jd.com/product/jieshao/video/" + id + ".html"); + extraVO.setListShareUser(listShareUser); - // 娴嬭瘯 - SystemClientParams params = systemClientParamsService.getSystemClientParamsBySystemAndKey(system, - "goods_detail_jump_taobao"); - if ("1".equalsIgnoreCase((params.getValue() + "").trim())) { - extraVO.setIsNative(true); - } + // 棰嗗埜浜哄垪琛� + List<ShamUser> listCouponUser = new ArrayList<ShamUser>(); + if (goodsDetail.isHasCoupon() && Integer.parseInt(inOrderCount30Days.toString()) >= 1000) { + listCouponUser = shamUserService.listRandCouponUser(5, 1, 300); + } + extraVO.setListCouponUser(listCouponUser); - // 鍟嗗搧閾炬帴 - String h5Url = String.format("http://%s%s?uid=%s&id=%s", configService.getH5Host(acceptData.getSystem()), - Constant.systemCommonConfig.getShareGoodsPagePathJD(), "", id + ""); - // try { - // extraVO.setH5Url(HttpUtil.getShortLink(h5Url)); - // } catch (Exception e) { - extraVO.setH5Url(h5Url); - // } + if (uid != null) { + // 鏄惁鍔犲叆鏀惰棌 + 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)); + } - String helpLink = null; - extraVO.setFanliValid(true); + // 鍥炬枃璇︽儏 + extraVO.setDetailUrl("https://in.m.jd.com/product/jieshao/video/" + id + ".html"); - if (StringUtil.isNullOrEmpty(helpLink)) { - helpLink = configService.getValue(ConfigKeyEnum.noRebateHelpLink.getKey(),acceptData.getSystem()); - } + // 娴嬭瘯 + SystemClientParams params = systemClientParamsService.getSystemClientParamsBySystemAndKey(system, + "goods_detail_jump_taobao"); + if ("1".equalsIgnoreCase((params.getValue() + "").trim())) { + extraVO.setIsNative(true); + } - ShareVO shareInfoVO = new ShareVO(); - shareInfoVO.setHelpLink(helpLink); - extraVO.setShare(shareInfoVO); - - if (VersionUtil.greaterThan_2_1_2(acceptData.getPlatform(), acceptData.getVersion())) { - getCloudInfo(acceptData, uid, goodsDetail, extraVO); // 浜戝彂鍗曟枃妗堜俊鎭� - } + // 鍟嗗搧閾炬帴 + String h5Url = String.format("http://%s%s?uid=%s&id=%s", configService.getH5Host(acceptData.getSystem()), + Constant.systemCommonConfig.getShareGoodsPagePathJD(), "", id + ""); + // try { + // extraVO.setH5Url(HttpUtil.getShortLink(h5Url)); + // } catch (Exception e) { + extraVO.setH5Url(h5Url); + // } - JSONObject object = new JSONObject(); - object.put("extra", JsonUtil.getApiCommonGson().toJson(extraVO)); - object.put("goods", JsonUtil.getApiCommonGson().toJson(goodsDetail)); - out.print(JsonUtil.loadTrueResult(object.toString())); + String helpLink = null; + extraVO.setFanliValid(true); - final JDGoods goods = jdGoods; - final Long fuid = uid; - ThreadUtil.run(new Runnable() { - public void run() { - // 娣诲姞娴忚璁板綍 - try { - scanHistoryV2Service.addJDScanHistory(fuid, acceptData.getDevice(), goods); - } catch (Exception e) { - e.printStackTrace(); - } + if (StringUtil.isNullOrEmpty(helpLink)) { + helpLink = configService.getValue(ConfigKeyEnum.noRebateHelpLink.getKey(), acceptData.getSystem()); + } - try { - goodsEvaluateService.updateJDGoods(goods); - } catch (Exception e) { - e.printStackTrace(); - } - } - }); - } + ShareVO shareInfoVO = new ShareVO(); + shareInfoVO.setHelpLink(helpLink); + extraVO.setShare(shareInfoVO); - /** - * 鎷煎澶氬晢鍝佽鎯� - * - * @param acceptData - * @param id - * @param uid - * @param from - * @param out - */ - @RequestMapping(value = "getDetailPDD", method = RequestMethod.POST) - public void getDetialPDD(AcceptData acceptData, Long id, Long uid, String from, PrintWriter out) { - // 绯荤粺楠岃瘉 - BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(), - acceptData.getPackages()); - if (system == null) { - out.print(JsonUtil.loadFalseResult(1, "绯荤粺涓嶅瓨鍦�")); - return; - } + if (VersionUtil.greaterThan_2_1_2(acceptData.getPlatform(), acceptData.getVersion())) { + getCloudInfo(acceptData, uid, goodsDetail, extraVO); // 浜戝彂鍗曟枃妗堜俊鎭� + } - PDDGoodsDetail pddGoods = PinDuoDuoApiUtil.getGoodsDetail(id); - if (pddGoods == null) { - out.print(JsonUtil.loadFalseResult(2, "鍟嗗搧涓嶅瓨鍦�")); - return; - } + JSONObject object = new JSONObject(); + object.put("extra", JsonUtil.getApiCommonGson().toJson(extraVO)); + object.put("goods", JsonUtil.getApiCommonGson().toJson(goodsDetail)); + out.print(JsonUtil.loadTrueResult(object.toString())); - ConfigParamsDTO paramsDTO = getParamsDTO(acceptData.getPlatform(), acceptData.getVersion(), uid); - paramsDTO.setBaseFanliRate(hongBaoManageService.getBaseFanliRate()); + final JDGoods goods = jdGoods; + final Long fuid = uid; + ThreadUtil.run(new Runnable() { + public void run() { + // 娣诲姞娴忚璁板綍 + try { + scanHistoryV2Service.addJDScanHistory(fuid, acceptData.getDevice(), goods); + } catch (Exception e) { + e.printStackTrace(); + } - GoodsDetailVO goodsDetail = GoodsDetailVOFactory.convertPDDGoods(pddGoods, paramsDTO); - if (goodsDetail != null && goodsDetail.getMoneyInfo() != null && userVIPInfoService.isVIP(uid)) { - goodsDetail.getMoneyInfo().setFanliMoney(goodsDetail.getMoneyInfo().getMaxMoney()); - goodsDetail.getMoneyInfo().setShareMoney("楼" + PinDuoDuoUtil.getGoodsFanLiMoney(pddGoods, - hongBaoManageService.getShareRate(UserLevelEnum.superVIP))); - goodsDetail.getMoneyInfo().setRateInfo(goodsDetail.getMoneyInfo().getMaxRateInfo()); - goodsDetail.getMoneyInfo().setCompositionInfo(goodsDetail.getMoneyInfo().getMaxCompositionInfo()); - } - goodsDetail.getMoneyInfo() - .setRateInfoHelpUrl(configService.getValue(ConfigKeyEnum.goodsDetailFanliRateHelpUrl.getKey(),acceptData.getSystem())); + try { + goodsEvaluateService.updateJDGoods(goods); + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + } - // 闄勫姞淇℃伅 - OtherInfo otherInfo = new OtherInfo(); - RewardCouponVO rewardCoupon = new RewardCouponVO(); - rewardCoupon.setJumpDetail(jumpDetailV2Service.getByTypeCache("web")); - 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")); + /** + * 鎷煎澶氬晢鍝佽鎯� + * + * @param acceptData + * @param id + * @param uid + * @param from + * @param out + */ + @RequestMapping(value = "getDetailPDD", method = RequestMethod.POST) + public void getDetialPDD(AcceptData acceptData, Long id, Long uid, String from, PrintWriter out) { + // 绯荤粺楠岃瘉 + BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(), + acceptData.getPackages()); + if (system == null) { + out.print(JsonUtil.loadFalseResult(1, "绯荤粺涓嶅瓨鍦�")); + return; + } - rewardCoupon.setMaxMoney(goodsDetail.getMoneyInfo().getMaxMoney()); - if (VersionUtil.greaterThan_2_0_5(acceptData.getPlatform(), acceptData.getVersion())) { - rewardCoupon.setDesc("杩�"); - params1.put("url", userVipConfigService.getValueByKey("vip_link")); - rewardCoupon.getJumpDetail().setNeedLogin(true); - } else - rewardCoupon.setDesc("鐢ㄨ繑鍒╁鍔卞埜鏈�楂樿繑"); - 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); + PDDGoodsDetail pddGoods = PinDuoDuoApiUtil.getGoodsDetail(id); + if (pddGoods == null) { + out.print(JsonUtil.loadFalseResult(2, "鍟嗗搧涓嶅瓨鍦�")); + return; + } - CouponInfoVO couponInfo = goodsDetail.getCouponInfo(); - PDDPromotionUrl convertUrl = null; - if (couponInfo != null) { - convertUrl = PinDuoDuoApiUtil.convert(id, PinDuoDuoApiUtil.PID_COUPON + "", null); - if (convertUrl != null) - couponInfo.setLink(convertUrl.getUrl()); - } + ConfigParamsDTO paramsDTO = getParamsDTO(acceptData.getPlatform(), acceptData.getVersion(), uid); + paramsDTO.setBaseFanliRate(hongBaoManageService.getBaseFanliRate()); - ShopInfoVO shopInfo = goodsDetail.getShopInfo(); - if (shopInfo != null) { - if (shopInfo.getId() == null || shopInfo.getScoreGoods() == null || shopInfo.getScoreLogistics() == null - || shopInfo.getScoreSeller() == null) { - goodsDetail.setShopInfo(null); - } - } + GoodsDetailVO goodsDetail = GoodsDetailVOFactory.convertPDDGoods(pddGoods, paramsDTO); + if (goodsDetail != null && goodsDetail.getMoneyInfo() != null && userVIPInfoService.isVIP(uid)) { + goodsDetail.getMoneyInfo().setFanliMoney(goodsDetail.getMoneyInfo().getMaxMoney()); + goodsDetail.getMoneyInfo().setShareMoney("楼" + PinDuoDuoUtil.getGoodsFanLiMoney(pddGoods, + hongBaoManageService.getShareRate(UserLevelEnum.superVIP))); + goodsDetail.getMoneyInfo().setRateInfo(goodsDetail.getMoneyInfo().getMaxRateInfo()); + goodsDetail.getMoneyInfo().setCompositionInfo(goodsDetail.getMoneyInfo().getMaxCompositionInfo()); + } + goodsDetail.getMoneyInfo() + .setRateInfoHelpUrl(configService.getValue(ConfigKeyEnum.goodsDetailFanliRateHelpUrl.getKey(), acceptData.getSystem())); - GoodsDetailExtraVO extraVO = new GoodsDetailExtraVO(); - extraVO.setIsNative(false); - // IOS鏄惁姝e湪涓婄嚎 - if ("ios".equalsIgnoreCase(acceptData.getPlatform())) { - String version = acceptData.getVersion(); - extraVO.setIosOnling(configService.iosOnLining(Integer.parseInt(version),acceptData.getSystem())); - } + // 闄勫姞淇℃伅 + OtherInfo otherInfo = new OtherInfo(); + RewardCouponVO rewardCoupon = new RewardCouponVO(); + rewardCoupon.setJumpDetail(jumpDetailV2Service.getByTypeCache("web")); + 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")); - // 鍥炬枃璇︽儏 - extraVO.setDetailUrl("http://apph5.banliapp.com/apppage/goods_img_pdd.html?id=" + id); + rewardCoupon.setMaxMoney(goodsDetail.getMoneyInfo().getMaxMoney()); + if (VersionUtil.greaterThan_2_0_5(acceptData.getPlatform(), acceptData.getVersion())) { + rewardCoupon.setDesc("杩�"); + params1.put("url", userVipConfigService.getValueByKey("vip_link")); + rewardCoupon.getJumpDetail().setNeedLogin(true); + } else + rewardCoupon.setDesc("鐢ㄨ繑鍒╁鍔卞埜鏈�楂樿繑"); + 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); - String salesTip = pddGoods.getSalesTip(); - if (!StringUtil.isNullOrEmpty(salesTip)) { - int indexOf = salesTip.indexOf("+"); - if (indexOf > 0) { - salesTip = salesTip.substring(0, indexOf); - } + CouponInfoVO couponInfo = goodsDetail.getCouponInfo(); + PDDPromotionUrl convertUrl = null; + if (couponInfo != null) { + convertUrl = PinDuoDuoApiUtil.convert(id, PinDuoDuoApiUtil.PID_COUPON + "", null); + if (convertUrl != null) + couponInfo.setLink(convertUrl.getUrl()); + } - int totalSales = 0; - if (salesTip.contains("涓�")) { - salesTip = salesTip.substring(0, salesTip.indexOf("涓�")); - totalSales = (int) (Float.parseFloat(salesTip) * 10000); - } else { - totalSales = Integer.parseInt(salesTip); - } + ShopInfoVO shopInfo = goodsDetail.getShopInfo(); + if (shopInfo != null) { + if (shopInfo.getId() == null || shopInfo.getScoreGoods() == null || shopInfo.getScoreLogistics() == null + || shopInfo.getScoreSeller() == null) { + goodsDetail.setShopInfo(null); + } + } - List<ShamUser> listShareUser = new ArrayList<ShamUser>(); - MoneyInfoVO moneyInfo = goodsDetail.getMoneyInfo(); - if (moneyInfo != null) { - String shareMoney = moneyInfo.getShareMoney().replaceAll("楼", ""); - if (totalSales >= 50000) { - listShareUser = shamUserService.listRandShareUser(10, new BigDecimal(shareMoney), 1, 5); - } - } - extraVO.setListShareUser(listShareUser); + GoodsDetailExtraVO extraVO = new GoodsDetailExtraVO(); + extraVO.setIsNative(false); + // IOS鏄惁姝e湪涓婄嚎 + if ("ios".equalsIgnoreCase(acceptData.getPlatform())) { + String version = acceptData.getVersion(); + extraVO.setIosOnling(configService.iosOnLining(Integer.parseInt(version), acceptData.getSystem())); + } + + // 鍥炬枃璇︽儏 + extraVO.setDetailUrl("http://apph5.banliapp.com/apppage/goods_img_pdd.html?id=" + id); + + String salesTip = pddGoods.getSalesTip(); + if (!StringUtil.isNullOrEmpty(salesTip)) { + int indexOf = salesTip.indexOf("+"); + if (indexOf > 0) { + salesTip = salesTip.substring(0, indexOf); + } + + int totalSales = 0; + if (salesTip.contains("涓�")) { + salesTip = salesTip.substring(0, salesTip.indexOf("涓�")); + totalSales = (int) (Float.parseFloat(salesTip) * 10000); + } else { + totalSales = Integer.parseInt(salesTip); + } + + List<ShamUser> listShareUser = new ArrayList<ShamUser>(); + MoneyInfoVO moneyInfo = goodsDetail.getMoneyInfo(); + if (moneyInfo != null) { + String shareMoney = moneyInfo.getShareMoney().replaceAll("楼", ""); + if (totalSales >= 50000) { + listShareUser = shamUserService.listRandShareUser(10, new BigDecimal(shareMoney), 1, 5); + } + } + extraVO.setListShareUser(listShareUser); + + // 棰嗗埜浜哄垪琛� + List<ShamUser> listCouponUser = new ArrayList<ShamUser>(); + if (goodsDetail.isHasCoupon() && totalSales >= 50000) { + listCouponUser = shamUserService.listRandCouponUser(5, 1, 300); + } + extraVO.setListCouponUser(listCouponUser); + } + + if (uid != null) { + // 鏄惁鍔犲叆鏀惰棌 + 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.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 (convertUrl != null) { + extraVO.setCouponJumpLink(convertUrl.getUrl()); + extraVO.setNativeCouponJumpLink(PinDuoDuoUtil.getAndroidNativeURI(convertUrl.getUrl())); + } + + if (VersionUtil.greaterThan_2_1_2(acceptData.getPlatform(), acceptData.getVersion())) { + getCloudInfo(acceptData, uid, goodsDetail, extraVO); // 浜戝彂鍗曟枃妗堜俊鎭� + } + + // 鍏嶅崟鍟嗗搧 + if (!StringUtil.isNullOrEmpty(from) && "miandan".equals(from)) { + MoneyInfoVO moneyInfo = goodsDetail.getMoneyInfo(); + if (goodsDetail.isHasCoupon()) { + moneyInfo.setFanliMoney("楼" + goodsDetail.getCouponPrice()); + } else { + moneyInfo.setFanliMoney("楼" + goodsDetail.getZkPrice()); + } + goodsDetail.setMoneyInfo(moneyInfo); + } + + 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.addPDDScanHistory(uid, acceptData.getDevice(), pddGoods); + } catch (Exception e) { + e.printStackTrace(); + } + + try { + goodsEvaluateService.updatePDDGoods(pddGoods); + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + } + + /** + * 鍞搧浼氳鎯� + * + * @param acceptData + * @param id + * @param uid + * @param from + * @param out + */ + @RequestMapping(value = "getDetailVIP", method = RequestMethod.POST) + public void getDetialVIP(AcceptData acceptData, Long id, Long uid, String from, PrintWriter out) { + // 绯荤粺楠岃瘉 + BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(), + acceptData.getPackages()); + if (system == null) { + out.print(JsonUtil.loadFalseResult(1, "绯荤粺涓嶅瓨鍦�")); + return; + } + + VIPGoodsInfo vipGoodsInfo = VipShopApiUtil.getGoodsDetail(id + ""); + if (vipGoodsInfo == null) { + out.print(JsonUtil.loadFalseResult(2, "鍟嗗搧涓嶅瓨鍦�")); + return; + } - // 棰嗗埜浜哄垪琛� - List<ShamUser> listCouponUser = new ArrayList<ShamUser>(); - if (goodsDetail.isHasCoupon() && totalSales >= 50000) { - listCouponUser = shamUserService.listRandCouponUser(5, 1, 300); - } - extraVO.setListCouponUser(listCouponUser); - } + ConfigParamsDTO paramsDTO = getParamsDTO(acceptData.getPlatform(), acceptData.getVersion(), uid); + paramsDTO.setBaseFanliRate(hongBaoManageService.getBaseFanliRate()); - if (uid != null) { - // 鏄惁鍔犲叆鏀惰棌 - 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)); - } + GoodsDetailVO goodsDetail = GoodsDetailVOFactory.convertVIPGoods(vipGoodsInfo, paramsDTO); + if (goodsDetail != null && goodsDetail.getMoneyInfo() != null && userVIPInfoService.isVIP(uid)) { + goodsDetail.getMoneyInfo().setFanliMoney(goodsDetail.getMoneyInfo().getMaxMoney()); + goodsDetail.getMoneyInfo().setShareMoney("楼" + VipShopUtil.getGoodsFanLiMoney(vipGoodsInfo, + hongBaoManageService.getShareRate(UserLevelEnum.superVIP))); + goodsDetail.getMoneyInfo().setRateInfo(goodsDetail.getMoneyInfo().getMaxRateInfo()); + goodsDetail.getMoneyInfo().setCompositionInfo(goodsDetail.getMoneyInfo().getMaxCompositionInfo()); + } + goodsDetail.getMoneyInfo() + .setRateInfoHelpUrl(configService.getValue(ConfigKeyEnum.goodsDetailFanliRateHelpUrl.getKey(), acceptData.getSystem())); - extraVO.setIsNative(true); + // 闄勫姞淇℃伅 + OtherInfo otherInfo = new OtherInfo(); + RewardCouponVO rewardCoupon = new RewardCouponVO(); + rewardCoupon.setJumpDetail(jumpDetailV2Service.getByTypeCache("web")); + 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")); - // 鍒嗕韩璺緞 - 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); - // } + rewardCoupon.setMaxMoney(goodsDetail.getMoneyInfo().getMaxMoney()); + rewardCoupon.setDesc("杩�"); + params1.put("url", userVipConfigService.getValueByKey("vip_link")); + rewardCoupon.getJumpDetail().setNeedLogin(true); - String helpLink = null; - extraVO.setFanliValid(true); - extraVO.setShareValid(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); - if (StringUtil.isNullOrEmpty(helpLink)) { - helpLink = configService.getValue(ConfigKeyEnum.noRebateHelpLink.getKey(),acceptData.getSystem()); - } + ShopInfoVO shopInfo = goodsDetail.getShopInfo(); + if (shopInfo != null) { + if (shopInfo.getId() == null || shopInfo.getScoreGoods() == null || shopInfo.getScoreLogistics() == null + || shopInfo.getScoreSeller() == null) { + goodsDetail.setShopInfo(null); + } + } - ShareVO shareInfoVO = new ShareVO(); - shareInfoVO.setHelpLink(helpLink); - extraVO.setShare(shareInfoVO); + GoodsDetailExtraVO extraVO = new GoodsDetailExtraVO(); + extraVO.setIsNative(false); + // IOS鏄惁姝e湪涓婄嚎 + if ("ios".equalsIgnoreCase(acceptData.getPlatform())) { + String version = acceptData.getVersion(); + extraVO.setIosOnling(configService.iosOnLining(Integer.parseInt(version), acceptData.getSystem())); + } - if (convertUrl != null) { - extraVO.setCouponJumpLink(convertUrl.getUrl()); - extraVO.setNativeCouponJumpLink(PinDuoDuoUtil.getAndroidNativeURI(convertUrl.getUrl())); - } - - if (VersionUtil.greaterThan_2_1_2(acceptData.getPlatform(), acceptData.getVersion())) { - getCloudInfo(acceptData, uid, goodsDetail, extraVO); // 浜戝彂鍗曟枃妗堜俊鎭� - } - - // 鍏嶅崟鍟嗗搧 - if (!StringUtil.isNullOrEmpty(from) && "miandan".equals(from)) { - MoneyInfoVO moneyInfo = goodsDetail.getMoneyInfo(); - if (goodsDetail.isHasCoupon()) { - moneyInfo.setFanliMoney("楼" + goodsDetail.getCouponPrice()); - } else { - moneyInfo.setFanliMoney("楼" + goodsDetail.getZkPrice()); - } - goodsDetail.setMoneyInfo(moneyInfo); - } + // 鍥炬枃璇︽儏 + extraVO.setDetailUrl("http://apph5.banliapp.com/apppage/goods_img_pdd.html?id=" + 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())); + if (uid != null) { + // 鏄惁鍔犲叆鏀惰棌 + 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)); + } - ThreadUtil.run(new Runnable() { - public void run() { - // 娣诲姞娴忚璁板綍 - try { - scanHistoryV2Service.addPDDScanHistory(uid, acceptData.getDevice(), pddGoods); - } catch (Exception e) { - e.printStackTrace(); - } + extraVO.setIsNative(true); - try { - goodsEvaluateService.updatePDDGoods(pddGoods); - } catch (Exception e) { - e.printStackTrace(); - } - } - }); - } + // 鍒嗕韩璺緞 + 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); + // } - /** - * 鍞搧浼氳鎯� - * - * @param acceptData - * @param id - * @param uid - * @param from - * @param out - */ - @RequestMapping(value = "getDetailVIP", method = RequestMethod.POST) - public void getDetialVIP(AcceptData acceptData, Long id, Long uid, String from, PrintWriter out) { - // 绯荤粺楠岃瘉 - BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(), - acceptData.getPackages()); - if (system == null) { - out.print(JsonUtil.loadFalseResult(1, "绯荤粺涓嶅瓨鍦�")); - return; - } + String helpLink = null; + extraVO.setFanliValid(true); + extraVO.setShareValid(true); - VIPGoodsInfo vipGoodsInfo = VipShopApiUtil.getGoodsDetail(id + ""); - if (vipGoodsInfo == null) { - out.print(JsonUtil.loadFalseResult(2, "鍟嗗搧涓嶅瓨鍦�")); - return; - } + if (StringUtil.isNullOrEmpty(helpLink)) { + helpLink = configService.getValue(ConfigKeyEnum.noRebateHelpLink.getKey(), acceptData.getSystem()); + } - ConfigParamsDTO paramsDTO = getParamsDTO(acceptData.getPlatform(), acceptData.getVersion(), uid); - paramsDTO.setBaseFanliRate(hongBaoManageService.getBaseFanliRate()); + ShareVO shareInfoVO = new ShareVO(); + shareInfoVO.setHelpLink(helpLink); + extraVO.setShare(shareInfoVO); - GoodsDetailVO goodsDetail = GoodsDetailVOFactory.convertVIPGoods(vipGoodsInfo, paramsDTO); - if (goodsDetail != null && goodsDetail.getMoneyInfo() != null && userVIPInfoService.isVIP(uid)) { - goodsDetail.getMoneyInfo().setFanliMoney(goodsDetail.getMoneyInfo().getMaxMoney()); - goodsDetail.getMoneyInfo().setShareMoney("楼" + VipShopUtil.getGoodsFanLiMoney(vipGoodsInfo, - hongBaoManageService.getShareRate(UserLevelEnum.superVIP))); - goodsDetail.getMoneyInfo().setRateInfo(goodsDetail.getMoneyInfo().getMaxRateInfo()); - goodsDetail.getMoneyInfo().setCompositionInfo(goodsDetail.getMoneyInfo().getMaxCompositionInfo()); - } - goodsDetail.getMoneyInfo() - .setRateInfoHelpUrl(configService.getValue(ConfigKeyEnum.goodsDetailFanliRateHelpUrl.getKey(),acceptData.getSystem())); + // 浜戝彂鍗曟枃妗堜俊鎭� + getCloudInfo(acceptData, uid, goodsDetail, extraVO); - // 闄勫姞淇℃伅 - OtherInfo otherInfo = new OtherInfo(); - RewardCouponVO rewardCoupon = new RewardCouponVO(); - rewardCoupon.setJumpDetail(jumpDetailV2Service.getByTypeCache("web")); - 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")); + JSONObject object = new JSONObject(); + object.put("extra", JsonUtil.getApiCommonGson().toJson(extraVO)); + object.put("goods", JsonUtil.getApiCommonGson().toJson(goodsDetail)); + out.print(JsonUtil.loadTrueResult(object.toString())); - rewardCoupon.setMaxMoney(goodsDetail.getMoneyInfo().getMaxMoney()); - rewardCoupon.setDesc("杩�"); - params1.put("url", userVipConfigService.getValueByKey("vip_link")); - rewardCoupon.getJumpDetail().setNeedLogin(true); + ThreadUtil.run(new Runnable() { + public void run() { + // 娣诲姞娴忚璁板綍 + try { + scanHistoryV2Service.addVIPScanHistory(uid, acceptData.getDevice(), vipGoodsInfo); + } catch (Exception e) { + e.printStackTrace(); + } - 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); + try { + goodsEvaluateService.updateVIPGoods(vipGoodsInfo); + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + } - ShopInfoVO shopInfo = goodsDetail.getShopInfo(); - if (shopInfo != null) { - if (shopInfo.getId() == null || shopInfo.getScoreGoods() == null || shopInfo.getScoreLogistics() == null - || shopInfo.getScoreSeller() == null) { - goodsDetail.setShopInfo(null); - } - } + @RequestMapping(value = "getDetailSuning", method = RequestMethod.POST) + public void getDetialSuning(AcceptData acceptData, String id, Long uid, String from, PrintWriter out) { + // 绯荤粺楠岃瘉 + BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(), + acceptData.getPackages()); + if (system == null) { + out.print(JsonUtil.loadFalseResult(1, "绯荤粺涓嶅瓨鍦�")); + return; + } - GoodsDetailExtraVO extraVO = new GoodsDetailExtraVO(); - extraVO.setIsNative(false); - // IOS鏄惁姝e湪涓婄嚎 - if ("ios".equalsIgnoreCase(acceptData.getPlatform())) { - String version = acceptData.getVersion(); - extraVO.setIosOnling(configService.iosOnLining(Integer.parseInt(version),acceptData.getSystem())); - } + String[] ids = SuningUtil.getGoodsIdDetail(id); - // 鍥炬枃璇︽儏 - extraVO.setDetailUrl("http://apph5.banliapp.com/apppage/goods_img_pdd.html?id=" + id); + SuningGoodsInfo suningGoodsInfo = SuningApiUtil.getGoodsDetail(ids[1], ids[0]); - if (uid != null) { - // 鏄惁鍔犲叆鏀惰棌 - 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)); - } + if (suningGoodsInfo == null) { + out.print(JsonUtil.loadFalseResult(2, "鍟嗗搧涓嶅瓨鍦�")); + return; + } - extraVO.setIsNative(true); + ConfigParamsDTO paramsDTO = getParamsDTO(acceptData.getPlatform(), acceptData.getVersion(), uid); + paramsDTO.setBaseFanliRate(hongBaoManageService.getBaseFanliRate()); - // 鍒嗕韩璺緞 - 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); - // } + GoodsDetailVO goodsDetail = GoodsDetailVOFactory.convertSuningGoods(suningGoodsInfo, paramsDTO); + if (goodsDetail != null && goodsDetail.getMoneyInfo() != null && userVIPInfoService.isVIP(uid)) { + goodsDetail.getMoneyInfo().setFanliMoney(goodsDetail.getMoneyInfo().getMaxMoney()); + goodsDetail.getMoneyInfo().setShareMoney("楼" + SuningUtil.getGoodsFanLiMoney(suningGoodsInfo, + hongBaoManageService.getShareRate(UserLevelEnum.superVIP))); + goodsDetail.getMoneyInfo().setRateInfo(goodsDetail.getMoneyInfo().getMaxRateInfo()); + goodsDetail.getMoneyInfo().setCompositionInfo(goodsDetail.getMoneyInfo().getMaxCompositionInfo()); + } + goodsDetail.getMoneyInfo() + .setRateInfoHelpUrl(configService.getValue(ConfigKeyEnum.goodsDetailFanliRateHelpUrl.getKey(), acceptData.getSystem())); - String helpLink = null; - extraVO.setFanliValid(true); - extraVO.setShareValid(true); + // 闄勫姞淇℃伅 + OtherInfo otherInfo = new OtherInfo(); + RewardCouponVO rewardCoupon = new RewardCouponVO(); + rewardCoupon.setJumpDetail(jumpDetailV2Service.getByTypeCache("web")); + JSONObject params1 = new JSONObject(); - if (StringUtil.isNullOrEmpty(helpLink)) { - helpLink = configService.getValue(ConfigKeyEnum.noRebateHelpLink.getKey(),acceptData.getSystem()); - } + params1.put("url", userVipConfigService.getValueByKey("vip_link")); - ShareVO shareInfoVO = new ShareVO(); - shareInfoVO.setHelpLink(helpLink); - extraVO.setShare(shareInfoVO); - - // 浜戝彂鍗曟枃妗堜俊鎭� - getCloudInfo(acceptData, uid, goodsDetail, extraVO); + rewardCoupon.setMaxMoney(goodsDetail.getMoneyInfo().getMaxMoney()); + rewardCoupon.setDesc("杩�"); + params1.put("url", userVipConfigService.getValueByKey("vip_link")); + rewardCoupon.getJumpDetail().setNeedLogin(true); - JSONObject object = new JSONObject(); - object.put("extra", JsonUtil.getApiCommonGson().toJson(extraVO)); - object.put("goods", JsonUtil.getApiCommonGson().toJson(goodsDetail)); - out.print(JsonUtil.loadTrueResult(object.toString())); + 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); - ThreadUtil.run(new Runnable() { - public void run() { - // 娣诲姞娴忚璁板綍 - try { - scanHistoryV2Service.addVIPScanHistory(uid, acceptData.getDevice(), vipGoodsInfo); - } catch (Exception e) { - e.printStackTrace(); - } + ShopInfoVO shopInfo = goodsDetail.getShopInfo(); + if (shopInfo != null) { + if (shopInfo.getId() == null || shopInfo.getScoreGoods() == null || shopInfo.getScoreLogistics() == null + || shopInfo.getScoreSeller() == null) { + goodsDetail.setShopInfo(null); + } + } - try { - goodsEvaluateService.updateVIPGoods(vipGoodsInfo); - } catch (Exception e) { - e.printStackTrace(); - } - } - }); - } + GoodsDetailExtraVO extraVO = new GoodsDetailExtraVO(); + extraVO.setIsNative(false); + // IOS鏄惁姝e湪涓婄嚎 + if ("ios".equalsIgnoreCase(acceptData.getPlatform())) { + String version = acceptData.getVersion(); + extraVO.setIosOnling(configService.iosOnLining(Integer.parseInt(version), acceptData.getSystem())); + } - @RequestMapping(value = "getDetailSuning", method = RequestMethod.POST) - public void getDetialSuning(AcceptData acceptData, String id, Long uid, String from, PrintWriter out) { - // 绯荤粺楠岃瘉 - BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(), - acceptData.getPackages()); - if (system == null) { - out.print(JsonUtil.loadFalseResult(1, "绯荤粺涓嶅瓨鍦�")); - return; - } + // 鍥炬枃璇︽儏 + extraVO.setDetailUrl("http://apph5.banliapp.com/apppage/goods_img_suning.html?id=" + + suningGoodsInfo.getCommodityInfo().getCommodityCode() + "&supplierCode=" + + suningGoodsInfo.getCommodityInfo().getSupplierCode()); - String[] ids = SuningUtil.getGoodsIdDetail(id); + if (uid != null) { + // 鏄惁鍔犲叆鏀惰棌 + CollectionGoodsV2 collectionGoods = collectionGoodsV2Service.findByUidAndAuctionId(uid, + Long.parseLong(suningGoodsInfo.getCommodityInfo().getCommodityCode()), Constant.SOURCE_TYPE_SUNING); + extraVO.setCollected(collectionGoods != null ? true : false); + // 鏄惁鍔犲叆閫夊搧搴� + extraVO.setStorage(userGoodsStorageService.isExistStorage(uid, + Long.parseLong(suningGoodsInfo.getCommodityInfo().getCommodityCode()), + Constant.SOURCE_TYPE_SUNING)); + } - SuningGoodsInfo suningGoodsInfo = SuningApiUtil.getGoodsDetail(ids[1], ids[0]); + extraVO.setIsNative(true); - if (suningGoodsInfo == null) { - out.print(JsonUtil.loadFalseResult(2, "鍟嗗搧涓嶅瓨鍦�")); - return; - } + // 鍒嗕韩璺緞 + 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); + // } - ConfigParamsDTO paramsDTO = getParamsDTO(acceptData.getPlatform(), acceptData.getVersion(), uid); - paramsDTO.setBaseFanliRate(hongBaoManageService.getBaseFanliRate()); + String helpLink = null; + extraVO.setFanliValid(true); + extraVO.setShareValid(true); - GoodsDetailVO goodsDetail = GoodsDetailVOFactory.convertSuningGoods(suningGoodsInfo, paramsDTO); - if (goodsDetail != null && goodsDetail.getMoneyInfo() != null && userVIPInfoService.isVIP(uid)) { - goodsDetail.getMoneyInfo().setFanliMoney(goodsDetail.getMoneyInfo().getMaxMoney()); - goodsDetail.getMoneyInfo().setShareMoney("楼" + SuningUtil.getGoodsFanLiMoney(suningGoodsInfo, - hongBaoManageService.getShareRate(UserLevelEnum.superVIP))); - goodsDetail.getMoneyInfo().setRateInfo(goodsDetail.getMoneyInfo().getMaxRateInfo()); - goodsDetail.getMoneyInfo().setCompositionInfo(goodsDetail.getMoneyInfo().getMaxCompositionInfo()); - } - goodsDetail.getMoneyInfo() - .setRateInfoHelpUrl(configService.getValue(ConfigKeyEnum.goodsDetailFanliRateHelpUrl.getKey(),acceptData.getSystem())); + if (StringUtil.isNullOrEmpty(helpLink)) { + helpLink = configService.getValue(ConfigKeyEnum.noRebateHelpLink.getKey(), acceptData.getSystem()); + } - // 闄勫姞淇℃伅 - OtherInfo otherInfo = new OtherInfo(); - RewardCouponVO rewardCoupon = new RewardCouponVO(); - rewardCoupon.setJumpDetail(jumpDetailV2Service.getByTypeCache("web")); - JSONObject params1 = new JSONObject(); + ShareVO shareInfoVO = new ShareVO(); + shareInfoVO.setHelpLink(helpLink); + extraVO.setShare(shareInfoVO); - params1.put("url", userVipConfigService.getValueByKey("vip_link")); + // 浜戝彂鍗曟枃妗堜俊鎭� + getCloudInfo(acceptData, uid, goodsDetail, extraVO); - rewardCoupon.setMaxMoney(goodsDetail.getMoneyInfo().getMaxMoney()); - rewardCoupon.setDesc("杩�"); - params1.put("url", userVipConfigService.getValueByKey("vip_link")); - rewardCoupon.getJumpDetail().setNeedLogin(true); + JSONObject object = new JSONObject(); + object.put("extra", JsonUtil.getApiCommonGson().toJson(extraVO)); + object.put("goods", JsonUtil.getApiCommonGson().toJson(goodsDetail)); + out.print(JsonUtil.loadTrueResult(object.toString())); - 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); + ThreadUtil.run(new Runnable() { + public void run() { + // 娣诲姞娴忚璁板綍 + try { + scanHistoryV2Service.addSuningScanHistory(uid, acceptData.getDevice(), suningGoodsInfo); + } catch (Exception e) { + e.printStackTrace(); + } - ShopInfoVO shopInfo = goodsDetail.getShopInfo(); - if (shopInfo != null) { - if (shopInfo.getId() == null || shopInfo.getScoreGoods() == null || shopInfo.getScoreLogistics() == null - || shopInfo.getScoreSeller() == null) { - goodsDetail.setShopInfo(null); - } - } + try { + goodsEvaluateService.updateSuningGoods(suningGoodsInfo); + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + } - GoodsDetailExtraVO extraVO = new GoodsDetailExtraVO(); - extraVO.setIsNative(false); - // IOS鏄惁姝e湪涓婄嚎 - if ("ios".equalsIgnoreCase(acceptData.getPlatform())) { - String version = acceptData.getVersion(); - extraVO.setIosOnling(configService.iosOnLining(Integer.parseInt(version),acceptData.getSystem())); - } + /** + * // 浜戝彂鍗曟枃妗堜俊鎭� + * + * @param goodsDetail + */ + private void getCloudInfo(AcceptData acceptData, Long uid, GoodsDetailVO goodsDetail, GoodsDetailExtraVO extraVO) { + // 浜戝彂鍗曟槸鍚﹀紑鍚� + boolean cloudOpen = configService.isRobotCloudOpen(ConfigKeyEnum.robotCloudOpenGoodsDetail.getKey(), acceptData.getPlatform(), acceptData.getVersion(), acceptData.getSystem()); + if (!cloudOpen && uid != null) { + List<String> testUsers = configService.getTestUsers(acceptData.getSystem()); + if (testUsers != null && testUsers.contains(uid + "")) { + cloudOpen = true; + } + } + extraVO.setCloudOpen(cloudOpen); - // 鍥炬枃璇︽儏 - extraVO.setDetailUrl("http://apph5.banliapp.com/apppage/goods_img_suning.html?id=" - + suningGoodsInfo.getCommodityInfo().getCommodityCode() + "&supplierCode=" - + suningGoodsInfo.getCommodityInfo().getSupplierCode()); + // 鏃犲埜鎴栬�呮湭寮�鍚彂鍦� + if (!goodsDetail.isHasCoupon() || !cloudOpen) { + return; + } - if (uid != null) { - // 鏄惁鍔犲叆鏀惰棌 - CollectionGoodsV2 collectionGoods = collectionGoodsV2Service.findByUidAndAuctionId(uid, - Long.parseLong(suningGoodsInfo.getCommodityInfo().getCommodityCode()), Constant.SOURCE_TYPE_SUNING); - extraVO.setCollected(collectionGoods != null ? true : false); - // 鏄惁鍔犲叆閫夊搧搴� - extraVO.setStorage(userGoodsStorageService.isExistStorage(uid, - Long.parseLong(suningGoodsInfo.getCommodityInfo().getCommodityCode()), - Constant.SOURCE_TYPE_SUNING)); - } + GoodsEvaluate evaluate = goodsEvaluateService.queryExistSingle(goodsDetail.getGoodsId() + "", goodsDetail.getGoodsType(), acceptData.getSystem()); + if (evaluate != null) { + String cloudText = null; + List<CommentInfo> comments = evaluate.getComments(); + if (comments != null && comments.size() > 0) { + cloudText = comments.get(0).getContent(); + } - extraVO.setIsNative(true); + String cloudPic = null; + List<ImgInfo> imgList = evaluate.getImgList(); + if (imgList != null && imgList.size() > 0) { + for (ImgInfo imgInfo : imgList) { + ImgEnum type = imgInfo.getType(); + if (type == ImgEnum.goods) { + cloudPic = imgInfo.getUrl(); + } + } + } - // 鍒嗕韩璺緞 - 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); - // } + if (!StringUtil.isNullOrEmpty(cloudText) && !StringUtil.isNullOrEmpty(cloudPic)) { - String helpLink = null; - extraVO.setFanliValid(true); - extraVO.setShareValid(true); + cloudText = cloudText.replace("[鍘熶环]", MoneyBigDecimalUtil.getWithNoZera(goodsDetail.getZkPrice()) + ""); + if (!goodsDetail.isHasCoupon()) { + cloudText = cloudText.replace("棰嗗埜鎶㈣喘", "鎶㈣喘"); + cloudText = cloudText.replace("銆愬埜鍚庝环銆慬鍒稿悗浠穄鍏�", ""); + } else { + cloudText = cloudText.replace("[鍒稿悗浠穄", MoneyBigDecimalUtil.getWithNoZera(goodsDetail.getCouponPrice()) + ""); + } + cloudText = cloudText.replace("\r\n\r\n", "\r\n").replace("\r\n\r\n", "\r\n").replace("\r\n\r\n", "\r\n"); - if (StringUtil.isNullOrEmpty(helpLink)) { - helpLink = configService.getValue(ConfigKeyEnum.noRebateHelpLink.getKey(),acceptData.getSystem()); - } + extraVO.setCloudPic(cloudPic); + extraVO.setCloudText(cloudText); + } + } + } - ShareVO shareInfoVO = new ShareVO(); - shareInfoVO.setHelpLink(helpLink); - extraVO.setShare(shareInfoVO); + /** + * 鍟嗗搧璇︽儏鎺ㄨ崘锛堢寽浣犲枩娆� + 鎺ㄨ崘锛� + * + * @param acceptData + * @param id + * @param out + */ + @RequestMapping(value = "getRecommendGoods", method = RequestMethod.POST) + public void getRecommendGoods(AcceptData acceptData, String id, Integer goodsType, PrintWriter out) { + if (goodsType == null) { + goodsType = Constant.SOURCE_TYPE_TAOBAO; + } - // 浜戝彂鍗曟枃妗堜俊鎭� - 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())); + try { + // 浜笢 + if (goodsType == Constant.SOURCE_TYPE_JD) { + JSONObject data = new JSONObject(); + data.put("listGuess", JsonUtil.getApiCommonGson().toJson(new ArrayList<GoodsDetailVO>())); - ThreadUtil.run(new Runnable() { - public void run() { - // 娣诲姞娴忚璁板綍 - try { - scanHistoryV2Service.addSuningScanHistory(uid, acceptData.getDevice(), suningGoodsInfo); - } catch (Exception e) { - e.printStackTrace(); - } + List<JDGoods> list = JDUtil.getRecommendGoodsById(Long.parseLong(id)); + if (list == null) { + list = new ArrayList<JDGoods>(); + } else if (list.size() > 10) { + list = list.subList(0, 10); + } - try { - goodsEvaluateService.updateSuningGoods(suningGoodsInfo); - } catch (Exception e) { - e.printStackTrace(); - } - } - }); - } - - /** - * // 浜戝彂鍗曟枃妗堜俊鎭� - * @param goodsDetail - */ - private void getCloudInfo(AcceptData acceptData,Long uid, GoodsDetailVO goodsDetail, GoodsDetailExtraVO extraVO) { - // 浜戝彂鍗曟槸鍚﹀紑鍚� - boolean cloudOpen = configService.isRobotCloudOpen(ConfigKeyEnum.robotCloudOpenGoodsDetail.getKey(),acceptData.getPlatform(),acceptData.getVersion(),acceptData.getSystem()); - if (!cloudOpen && uid != null) { - List<String> testUsers = configService.getTestUsers(acceptData.getSystem()); - if (testUsers != null && testUsers.contains(uid+"")) { - cloudOpen = true; - } - } - extraVO.setCloudOpen(cloudOpen); - - // 鏃犲埜鎴栬�呮湭寮�鍚彂鍦� - if (!goodsDetail.isHasCoupon() || !cloudOpen) { - return; - } - - GoodsEvaluate evaluate = goodsEvaluateService.queryExistSingle(goodsDetail.getGoodsId() +"", goodsDetail.getGoodsType()); - if (evaluate != null) { - String cloudText = null; - List<CommentInfo> comments = evaluate.getComments(); - if (comments != null && comments.size() > 0) { - cloudText = comments.get(0).getContent(); - } - - String cloudPic = null; - List<ImgInfo> imgList = evaluate.getImgList(); - if (imgList != null && imgList.size() > 0) { - for (ImgInfo imgInfo: imgList) { - ImgEnum type = imgInfo.getType(); - if (type == ImgEnum.goods) { - cloudPic = imgInfo.getUrl(); - } - } - } - - if (!StringUtil.isNullOrEmpty(cloudText) && !StringUtil.isNullOrEmpty(cloudPic)) { - - cloudText = cloudText.replace("[鍘熶环]", MoneyBigDecimalUtil.getWithNoZera(goodsDetail.getZkPrice()) + ""); - if (!goodsDetail.isHasCoupon()) { - cloudText = cloudText.replace("棰嗗埜鎶㈣喘", "鎶㈣喘"); - cloudText = cloudText.replace("銆愬埜鍚庝环銆慬鍒稿悗浠穄鍏�", ""); - } else { - cloudText = cloudText.replace("[鍒稿悗浠穄", MoneyBigDecimalUtil.getWithNoZera(goodsDetail.getCouponPrice()) + ""); - } - cloudText = cloudText.replace("\r\n\r\n", "\r\n").replace("\r\n\r\n", "\r\n").replace("\r\n\r\n", "\r\n"); - - extraVO.setCloudPic(cloudPic); - extraVO.setCloudText(cloudText); - } - } - } + ConfigParamsDTO paramsDTO = getParamsDTO(acceptData.getPlatform(), acceptData.getVersion(), null); + List<GoodsDetailVO> listDetailVO = new ArrayList<GoodsDetailVO>(); - /** - * 鍟嗗搧璇︽儏鎺ㄨ崘锛堢寽浣犲枩娆� + 鎺ㄨ崘锛� - * - * @param acceptData - * @param id - * @param out - */ - @RequestMapping(value = "getRecommendGoods", method = RequestMethod.POST) - public void getRecommendGoods(AcceptData acceptData, String id, Integer goodsType, PrintWriter out) { - if (goodsType == null) { - goodsType = Constant.SOURCE_TYPE_TAOBAO; - } + for (JDGoods goods : list) { + listDetailVO.add(GoodsDetailVOFactory.convertJDGoods(goods, paramsDTO)); + } - try { - // 浜笢 - if (goodsType == Constant.SOURCE_TYPE_JD) { - JSONObject data = new JSONObject(); - data.put("listGuess", JsonUtil.getApiCommonGson().toJson(new ArrayList<GoodsDetailVO>())); + // 鍙栧伓鏁颁釜鏁版嵁 + if (listDetailVO.size() % 2 != 0) { + listDetailVO.remove(listDetailVO.size() - 1); + } - List<JDGoods> list = JDUtil.getRecommendGoodsById(Long.parseLong(id)); - if (list == null) { - list = new ArrayList<JDGoods>(); - } else if (list.size() > 10) { - list = list.subList(0, 10); - } + data.put("listQuality", JsonUtil.getApiCommonGson().toJson(listDetailVO)); + out.print(JsonUtil.loadTrueResult(data)); + return; + } - ConfigParamsDTO paramsDTO = getParamsDTO(acceptData.getPlatform(), acceptData.getVersion(), null); - List<GoodsDetailVO> listDetailVO = new ArrayList<GoodsDetailVO>(); + // 鎷煎澶� + if (goodsType == Constant.SOURCE_TYPE_PDD) { + JSONObject data = new JSONObject(); + data.put("listGuess", JsonUtil.getApiCommonGson().toJson(new ArrayList<GoodsDetailVO>())); - for (JDGoods goods : list) { - listDetailVO.add(GoodsDetailVOFactory.convertJDGoods(goods, paramsDTO)); - } + List<GoodsDetailVO> listDetailVO = new ArrayList<GoodsDetailVO>(); - // 鍙栧伓鏁颁釜鏁版嵁 - if (listDetailVO.size() % 2 != 0) { - listDetailVO.remove(listDetailVO.size() - 1); - } + List<Long> goodsIdList = PinDuoDuoUtil.getRecommendGoodsId(Long.parseLong(id)); + if (goodsIdList != null && goodsIdList.size() > 0) { + PDDSearchFilter pddfilter = new PDDSearchFilter(); + pddfilter.setPage(1); + pddfilter.setPageSize(Constant.PAGE_SIZE); + Long[] strings = new Long[goodsIdList.size()]; + pddfilter.setGoodsIdList(goodsIdList.toArray(strings)); - data.put("listQuality", JsonUtil.getApiCommonGson().toJson(listDetailVO)); - out.print(JsonUtil.loadTrueResult(data)); - return; - } + PDDGoodsResult result = PinDuoDuoApiUtil.searchGoods(pddfilter); + if (result != null) { + List<PDDGoodsDetail> goodsList = result.getGoodsList(); + if (goodsList != null && goodsList.size() > 0) { - // 鎷煎澶� - if (goodsType == Constant.SOURCE_TYPE_PDD) { - JSONObject data = new JSONObject(); - data.put("listGuess", JsonUtil.getApiCommonGson().toJson(new ArrayList<GoodsDetailVO>())); + if (goodsList.size() > 10) { + goodsList = goodsList.subList(0, 10); + } - List<GoodsDetailVO> listDetailVO = new ArrayList<GoodsDetailVO>(); + ConfigParamsDTO paramsDTO = getParamsDTO(acceptData.getPlatform(), acceptData.getVersion(), + null); + for (PDDGoodsDetail goods : goodsList) { + listDetailVO.add(GoodsDetailVOFactory.convertPDDGoods(goods, paramsDTO)); + } + } + } + } - List<Long> goodsIdList = PinDuoDuoUtil.getRecommendGoodsId(Long.parseLong(id)); - if (goodsIdList != null && goodsIdList.size() > 0) { - PDDSearchFilter pddfilter = new PDDSearchFilter(); - pddfilter.setPage(1); - pddfilter.setPageSize(Constant.PAGE_SIZE); - Long[] strings = new Long[goodsIdList.size()]; - pddfilter.setGoodsIdList(goodsIdList.toArray(strings)); + // 鍙栧伓鏁颁釜鏁版嵁 + if (listDetailVO.size() % 2 != 0) { + listDetailVO.remove(listDetailVO.size() - 1); + } - PDDGoodsResult result = PinDuoDuoApiUtil.searchGoods(pddfilter); - if (result != null) { - List<PDDGoodsDetail> goodsList = result.getGoodsList(); - if (goodsList != null && goodsList.size() > 0) { + data.put("listQuality", JsonUtil.getApiCommonGson().toJson(listDetailVO)); + out.print(JsonUtil.loadTrueResult(data)); + return; + } - if (goodsList.size() > 10) { - goodsList = goodsList.subList(0, 10); - } + // 鍞搧浼� + if (goodsType == Constant.SOURCE_TYPE_VIP) { + JSONObject data = new JSONObject(); + data.put("listGuess", JsonUtil.getApiCommonGson().toJson(new ArrayList<GoodsDetailVO>())); + data.put("listQuality", JsonUtil.getApiCommonGson().toJson(new ArrayList<GoodsDetailVO>())); + out.print(JsonUtil.loadTrueResult(data)); + return; + } - ConfigParamsDTO paramsDTO = getParamsDTO(acceptData.getPlatform(), acceptData.getVersion(), - null); - for (PDDGoodsDetail goods : goodsList) { - listDetailVO.add(GoodsDetailVOFactory.convertPDDGoods(goods, paramsDTO)); - } - } - } - } + // 鑻忓畞 + if (goodsType == Constant.SOURCE_TYPE_SUNING) { + List<SuningGoodsInfo> resultList = null; + String[] ids = SuningUtil.getGoodsIdDetail(id); + List<SuningGoodsInfoRecommend> list = SuningApiUtil.getRecommendGoods(ids[1], ids[0]); + if (list != null && list.size() > 0) { + List<String> listId = new ArrayList<>(); + for (SuningGoodsInfoRecommend goodsInfo : list) { + if (goodsInfo != null) { + listId.add(goodsInfo.getCommodityCode() + "-" + goodsInfo.getSupplierCode()); + } + } + resultList = SuningApiUtil.getGoodsDetailList(listId); + } - // 鍙栧伓鏁颁釜鏁版嵁 - if (listDetailVO.size() % 2 != 0) { - listDetailVO.remove(listDetailVO.size() - 1); - } + List<GoodsDetailVO> listDetailVO = new ArrayList<GoodsDetailVO>(); + if (resultList != null) { + if (resultList != null && resultList.size() > 0) { + ConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate(acceptData.getPlatform(), + acceptData.getVersion()); - data.put("listQuality", JsonUtil.getApiCommonGson().toJson(listDetailVO)); - out.print(JsonUtil.loadTrueResult(data)); - return; - } + for (SuningGoodsInfo goods : resultList) { + GoodsDetailVO goodsDetailVO = GoodsDetailVOFactory.convertSuningGoods(goods, paramsDTO); + listDetailVO.add(goodsDetailVO); + } + } + } - // 鍞搧浼� - if (goodsType == Constant.SOURCE_TYPE_VIP) { - JSONObject data = new JSONObject(); - data.put("listGuess", JsonUtil.getApiCommonGson().toJson(new ArrayList<GoodsDetailVO>())); - data.put("listQuality", JsonUtil.getApiCommonGson().toJson(new ArrayList<GoodsDetailVO>())); - out.print(JsonUtil.loadTrueResult(data)); - return; - } - - // 鑻忓畞 - if (goodsType == Constant.SOURCE_TYPE_SUNING) { - List<SuningGoodsInfo> resultList = null; - String[] ids = SuningUtil.getGoodsIdDetail(id); - List<SuningGoodsInfoRecommend> list = SuningApiUtil.getRecommendGoods(ids[1], ids[0]); - if (list != null && list.size() > 0) { - List<String> listId = new ArrayList<>(); - for (SuningGoodsInfoRecommend goodsInfo: list) { - if (goodsInfo != null) { - listId.add(goodsInfo.getCommodityCode() + "-" + goodsInfo.getSupplierCode()); - } - } - resultList = SuningApiUtil.getGoodsDetailList(listId); - } - - List<GoodsDetailVO> listDetailVO = new ArrayList<GoodsDetailVO>(); - if (resultList != null) { - if (resultList != null && resultList.size() > 0) { - ConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate(acceptData.getPlatform(), - acceptData.getVersion()); + 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; + } - for (SuningGoodsInfo goods : resultList) { - GoodsDetailVO goodsDetailVO = GoodsDetailVOFactory.convertSuningGoods(goods, paramsDTO); - listDetailVO.add(goodsDetailVO); - } - } - } - - 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<TaoBaoGoodsBrief> goodsList = TaoKeApiUtil.guessLikeByAuctionId(Long.parseLong(id), 10); - // 鍒濆鍖� - if (goodsList == null) { - goodsList = new ArrayList<TaoBaoGoodsBrief>(); - } + List<TaoBaoGoodsBrief> goodsList = TaoKeApiUtil.guessLikeByAuctionId(Long.parseLong(id), 10); + // 鍒濆鍖� + if (goodsList == null) { + goodsList = new ArrayList<TaoBaoGoodsBrief>(); + } - List<GoodsDetailVO> listExtra = new ArrayList<GoodsDetailVO>(); - ConfigParamsDTO paramsDTO = getParamsDTO(acceptData.getPlatform(), acceptData.getVersion(), null); - goodsList.parallelStream().forEach(goods -> { - if (goods != null) { - listExtra.add(GoodsDetailVOFactory.convertTaoBao(goods, paramsDTO)); - } - }); + List<GoodsDetailVO> listExtra = new ArrayList<GoodsDetailVO>(); + ConfigParamsDTO paramsDTO = getParamsDTO(acceptData.getPlatform(), acceptData.getVersion(), null); + goodsList.parallelStream().forEach(goods -> { + if (goods != null) { + listExtra.add(GoodsDetailVOFactory.convertTaoBao(goods, paramsDTO)); + } + }); - List<GoodsDetailVO> listQuality = new ArrayList<GoodsDetailVO>(); - // 鍙栧伓鏁颁釜鏁版嵁 - if (listExtra.size() % 2 != 0) { - listExtra.remove(listExtra.size() - 1); - } + List<GoodsDetailVO> listQuality = new ArrayList<GoodsDetailVO>(); + // 鍙栧伓鏁颁釜鏁版嵁 + if (listExtra.size() % 2 != 0) { + listExtra.remove(listExtra.size() - 1); + } - if (listQuality.size() % 2 != 0) { - listQuality.remove(listQuality.size() - 1); - } + if (listQuality.size() % 2 != 0) { + listQuality.remove(listQuality.size() - 1); + } - JSONObject data = new JSONObject(); - data.put("listQuality", JsonUtil.getApiCommonGson().toJson(listExtra)); - data.put("listGuess", JsonUtil.getApiCommonGson().toJson(listQuality)); - out.print(JsonUtil.loadTrueResult(data)); - } catch (Exception e) { - LogHelper.errorDetailInfo(e); - JSONObject data = new JSONObject(); - data.put("listQuality", new JSONArray()); - data.put("listGuess", new JSONArray()); - out.print(JsonUtil.loadTrueResult(data)); - } - } + JSONObject data = new JSONObject(); + data.put("listQuality", JsonUtil.getApiCommonGson().toJson(listExtra)); + data.put("listGuess", JsonUtil.getApiCommonGson().toJson(listQuality)); + out.print(JsonUtil.loadTrueResult(data)); + } catch (Exception e) { + LogHelper.errorDetailInfo(e); + JSONObject data = new JSONObject(); + data.put("listQuality", new JSONArray()); + data.put("listGuess", new JSONArray()); + out.print(JsonUtil.loadTrueResult(data)); + } + } - /** - * 浜笢璐拱閾炬帴 - * - * @param acceptData - * @param uid - * @param id - * @param couponUrl - * -浼樻儬鍒搁摼鎺� - * @param source - * @param out - */ - @RequestMapping(value = "getJDLink") - public void getJDLink(AcceptData acceptData, Long uid, Long id, String couponUrl, String source, PrintWriter out) { - if (uid == null || uid <= 0) { - out.print(JsonUtil.loadFalseResult(1, "鐢ㄦ埛ID涓嶈兘涓虹┖")); - return; - } + /** + * 浜笢璐拱閾炬帴 + * + * @param acceptData + * @param uid + * @param id + * @param couponUrl -浼樻儬鍒搁摼鎺� + * @param source + * @param out + */ + @RequestMapping(value = "getJDLink") + public void getJDLink(AcceptData acceptData, Long uid, Long id, String couponUrl, String source, PrintWriter out) { + if (uid == null || uid <= 0) { + out.print(JsonUtil.loadFalseResult(1, "鐢ㄦ埛ID涓嶈兘涓虹┖")); + return; + } - if (id == null || id <= 0) { - out.print(JsonUtil.loadFalseResult(1, "鍟嗗搧ID涓嶈兘涓虹┖")); - return; - } + if (id == null || id <= 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; + } - JDGoods goods = jdGoodsCacheUtil.getGoodsInfo(id); - if (goods == null) { - out.print(JsonUtil.loadFalseResult(2, "鍟嗗搧宸蹭笅鏋�")); - return; - } + JDGoods goods = jdGoodsCacheUtil.getGoodsInfo(id); + if (goods == null) { + out.print(JsonUtil.loadFalseResult(2, "鍟嗗搧宸蹭笅鏋�")); + return; + } - String jumpLink = null; - String materialId = "https://item.jd.com/" + id + ".html"; - if (StringUtil.isNullOrEmpty(couponUrl)) { - JDCouponInfo couponInfo = JDUtil.getShowCouponInfo(goods.getCouponInfoList(), goods.getPrice()); - if (couponInfo != null) { - couponUrl = couponInfo.getLink(); - } - jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, JDApiUtil.POSITION_FANLI + "", - uid + ""); - if (jumpLink == null) { - jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, null, JDApiUtil.POSITION_FANLI + "", - uid + ""); - } - } else { - jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, JDApiUtil.POSITION_FANLI + "", - uid + ""); - if (StringUtil.isNullOrEmpty(jumpLink)) { - jumpLink = couponUrl; - } - } + String jumpLink = null; + String materialId = "https://item.jd.com/" + id + ".html"; + if (StringUtil.isNullOrEmpty(couponUrl)) { + JDCouponInfo couponInfo = JDUtil.getShowCouponInfo(goods.getCouponInfoList(), goods.getPrice()); + if (couponInfo != null) { + couponUrl = couponInfo.getLink(); + } + jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, JDApiUtil.POSITION_FANLI + "", + uid + ""); + if (jumpLink == null) { + jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, null, JDApiUtil.POSITION_FANLI + "", + uid + ""); + } + } else { + jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, JDApiUtil.POSITION_FANLI + "", + uid + ""); + if (StringUtil.isNullOrEmpty(jumpLink)) { + jumpLink = couponUrl; + } + } - JSONObject data = new JSONObject(); - data.put("native", true); - data.put("jumpLink", jumpLink); - out.print(JsonUtil.loadTrueResult(data)); + JSONObject data = new JSONObject(); + data.put("native", true); + data.put("jumpLink", jumpLink); + out.print(JsonUtil.loadTrueResult(data)); - // 鑾峰緱閲戝竵 - integralGetService.addCouponRebate(uid); - } + // 鑾峰緱閲戝竵 + integralGetService.addCouponRebate(uid); + } - @RequestMapping(value = "getJDCouponLink") - public void getJDCouponLink(AcceptData acceptData, Long id, String couponUrl, PrintWriter out) { - if (StringUtil.isNullOrEmpty(couponUrl)) { - out.print(JsonUtil.loadFalseResult(1, "鍒搁摼鎺ヤ笉鑳戒负绌�")); - return; - } - if (id == null || id <= 0) { - out.print(JsonUtil.loadFalseResult(1, "鍟嗗搧ID涓嶈兘涓虹┖")); - return; - } + @RequestMapping(value = "getJDCouponLink") + public void getJDCouponLink(AcceptData acceptData, Long id, String couponUrl, PrintWriter out) { + if (StringUtil.isNullOrEmpty(couponUrl)) { + out.print(JsonUtil.loadFalseResult(1, "鍒搁摼鎺ヤ笉鑳戒负绌�")); + return; + } + if (id == null || id <= 0) { + out.print(JsonUtil.loadFalseResult(1, "鍟嗗搧ID涓嶈兘涓虹┖")); + return; + } - String jumpLink = null; - String materialId = "https://item.jd.com/" + id + ".html"; + String jumpLink = null; + String materialId = "https://item.jd.com/" + id + ".html"; - jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, JDApiUtil.POSITION_FANLI + "", null); - if (StringUtil.isNullOrEmpty(jumpLink)) { - jumpLink = couponUrl; - } + jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, JDApiUtil.POSITION_FANLI + "", null); + if (StringUtil.isNullOrEmpty(jumpLink)) { + jumpLink = couponUrl; + } - JSONObject data = new JSONObject(); - data.put("native", true); - data.put("jumpLink", jumpLink); - out.print(JsonUtil.loadTrueResult(data)); - } + JSONObject data = new JSONObject(); + data.put("native", true); + data.put("jumpLink", jumpLink); + out.print(JsonUtil.loadTrueResult(data)); + } - /** - * 鎷煎澶氳喘涔伴摼鎺� - * - * @param acceptData - * @param uid - * @param id - * @param source - * @param out - */ - @RequestMapping(value = "getPDDLink") - public void getPDDLink(AcceptData acceptData, Long uid, Long id, String source, PrintWriter out) { - if (uid == null || uid <= 0) { - out.print(JsonUtil.loadFalseResult(1, "鐢ㄦ埛ID涓嶈兘涓虹┖")); - return; - } + /** + * 鎷煎澶氳喘涔伴摼鎺� + * + * @param acceptData + * @param uid + * @param id + * @param source + * @param out + */ + @RequestMapping(value = "getPDDLink") + public void getPDDLink(AcceptData acceptData, Long uid, Long id, String source, PrintWriter out) { + if (uid == null || uid <= 0) { + out.print(JsonUtil.loadFalseResult(1, "鐢ㄦ埛ID涓嶈兘涓虹┖")); + return; + } - if (id == null || id <= 0) { - out.print(JsonUtil.loadFalseResult(1, "鍟嗗搧ID涓嶈兘涓虹┖")); - return; - } + if (id == null || id <= 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; + } - PDDGoodsDetail goods = pinDuoDuoCacheUtil.getGoodsInfo(id); - if (goods == null) { - out.print(JsonUtil.loadFalseResult(2, "鍟嗗搧宸蹭笅鏋�")); - return; - } + PDDGoodsDetail goods = pinDuoDuoCacheUtil.getGoodsInfo(id); + if (goods == null) { + out.print(JsonUtil.loadFalseResult(2, "鍟嗗搧宸蹭笅鏋�")); + return; + } - PDDPromotionUrl convertUrl = PinDuoDuoApiUtil.convert(id, PinDuoDuoApiUtil.PID_FANLI + "", uid + ""); - JSONObject data = new JSONObject(); - data.put("native", true); + PDDPromotionUrl convertUrl = PinDuoDuoApiUtil.convert(id, PinDuoDuoApiUtil.PID_FANLI + "", uid + ""); + JSONObject data = new JSONObject(); + data.put("native", true); - data.put("jumpLink", convertUrl.getUrl()); - data.put("nativeJumpLink", PinDuoDuoUtil.getAndroidNativeURI(convertUrl.getUrl())); - out.print(JsonUtil.loadTrueResult(data)); + data.put("jumpLink", convertUrl.getUrl()); + data.put("nativeJumpLink", PinDuoDuoUtil.getAndroidNativeURI(convertUrl.getUrl())); + out.print(JsonUtil.loadTrueResult(data)); - // 鑾峰緱閲戝竵 - integralGetService.addCouponRebate(uid); - } + // 鑾峰緱閲戝竵 + integralGetService.addCouponRebate(uid); + } - /** - * 鎷煎澶氳喘涔伴摼鎺� - * - * @param acceptData - * @param uid - * @param id - * @param source - * @param out - */ - @RequestMapping(value = "getVIPLink") - public void getVIPLink(AcceptData acceptData, Long uid, Long id, String source, PrintWriter out) { - if (uid == null || uid <= 0) { - out.print(JsonUtil.loadFalseResult(1, "鐢ㄦ埛ID涓嶈兘涓虹┖")); - return; - } + /** + * 鎷煎澶氳喘涔伴摼鎺� + * + * @param acceptData + * @param uid + * @param id + * @param source + * @param out + */ + @RequestMapping(value = "getVIPLink") + public void getVIPLink(AcceptData acceptData, Long uid, Long id, String source, PrintWriter out) { + if (uid == null || uid <= 0) { + out.print(JsonUtil.loadFalseResult(1, "鐢ㄦ埛ID涓嶈兘涓虹┖")); + return; + } - if (id == null || id <= 0) { - out.print(JsonUtil.loadFalseResult(1, "鍟嗗搧ID涓嶈兘涓虹┖")); - return; - } + if (id == null || id <= 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; + } - VIPGoodsInfo goods = VipShopApiUtil.getGoodsDetail(id + ""); - if (goods == null) { - out.print(JsonUtil.loadFalseResult(2, "鍟嗗搧宸蹭笅鏋�")); - return; - } + VIPGoodsInfo goods = VipShopApiUtil.getGoodsDetail(id + ""); + if (goods == null) { + out.print(JsonUtil.loadFalseResult(2, "鍟嗗搧宸蹭笅鏋�")); + return; + } - VIPConvertResultDTO convertUrl = VipShopApiUtil.convertLink(id + "", VipShopUtil.getBuyChanTag(uid)); - JSONObject data = new JSONObject(); - data.put("native", true); - data.put("jumpLink", convertUrl.getUrl()); - data.put("nativeJumpLink", convertUrl.getDeeplinkUrl()); - out.print(JsonUtil.loadTrueResult(data)); + VIPConvertResultDTO convertUrl = VipShopApiUtil.convertLink(id + "", VipShopUtil.getBuyChanTag(uid)); + JSONObject data = new JSONObject(); + data.put("native", true); + data.put("jumpLink", convertUrl.getUrl()); + data.put("nativeJumpLink", convertUrl.getDeeplinkUrl()); + out.print(JsonUtil.loadTrueResult(data)); - // 鑾峰緱閲戝竵 - integralGetService.addCouponRebate(uid); - } + // 鑾峰緱閲戝竵 + integralGetService.addCouponRebate(uid); + } - @RequestMapping(value = "getSuningLink") - public void getSuningLink(AcceptData acceptData, Long uid, String id, String source, PrintWriter out) { - if (uid == null || uid <= 0) { - out.print(JsonUtil.loadFalseResult(1, "鐢ㄦ埛ID涓嶈兘涓虹┖")); - return; - } + @RequestMapping(value = "getSuningLink") + public void getSuningLink(AcceptData acceptData, Long uid, String id, String source, PrintWriter out) { + if (uid == null || uid <= 0) { + out.print(JsonUtil.loadFalseResult(1, "鐢ㄦ埛ID涓嶈兘涓虹┖")); + return; + } - if (StringUtil.isNullOrEmpty(id)) { - out.print(JsonUtil.loadFalseResult(1, "鍟嗗搧ID涓嶈兘涓虹┖")); - return; - } + if (StringUtil.isNullOrEmpty(id)) { + out.print(JsonUtil.loadFalseResult(1, "鍟嗗搧ID涓嶈兘涓虹┖")); + return; + } - UserInfo user = userInfoService.getUserByIdWithMybatis(uid); - if (user != null && user.getState() != UserInfo.STATE_NORMAL) { - out.print(JsonUtil.loadFalseResult(Constant.CODE_FORBIDDEN_USER, Constant.FORBIDDEN_USER_REASON_DESC)); - 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; + } - String[] sts = SuningUtil.getGoodsIdDetail(id); - String supplierCode = sts[0]; - String goodsCode = sts[1]; + String[] sts = SuningUtil.getGoodsIdDetail(id); + String supplierCode = sts[0]; + String goodsCode = sts[1]; - SuningGoodsInfo goods = SuningApiUtil.getGoodsDetail(goodsCode, supplierCode); - if (goods == null) { - out.print(JsonUtil.loadFalseResult(2, "鍟嗗搧宸蹭笅鏋�")); - return; - } + SuningGoodsInfo goods = SuningApiUtil.getGoodsDetail(goodsCode, supplierCode); + if (goods == null) { + out.print(JsonUtil.loadFalseResult(2, "鍟嗗搧宸蹭笅鏋�")); + return; + } - String quanUrl = null; - if (!StringUtil.isNullOrEmpty(goods.getCouponInfo().getCouponUrl())) - quanUrl = goods.getCouponInfo().getCouponUrl(); - String link = SuningApiUtil.convertLink(SuningUtil.getProductUrl(supplierCode, goodsCode), quanUrl, - SuningApiUtil.PID_BUY, uid + ""); - JSONObject data = new JSONObject(); - data.put("native", false); - data.put("jumpLink", link); - out.print(JsonUtil.loadTrueResult(data)); + String quanUrl = null; + if (!StringUtil.isNullOrEmpty(goods.getCouponInfo().getCouponUrl())) + quanUrl = goods.getCouponInfo().getCouponUrl(); + String link = SuningApiUtil.convertLink(SuningUtil.getProductUrl(supplierCode, goodsCode), quanUrl, + SuningApiUtil.PID_BUY, uid + ""); + JSONObject data = new JSONObject(); + data.put("native", false); + data.put("jumpLink", link); + out.print(JsonUtil.loadTrueResult(data)); - // 鑾峰緱閲戝竵 - integralGetService.addCouponRebate(uid); - } + // 鑾峰緱閲戝竵 + integralGetService.addCouponRebate(uid); + } - /** - * 鏄惁鍦ㄥ弬涓庢帹骞� - * - * @param goodsId - * -鍟嗗搧ID - * @param goodsType - * -TB/JD - * @param out - */ - @RequestMapping(value = "isGoodsExtend") - public void isGoodsExtend(AcceptData acceptData, String goodsId, Integer goodsType, PrintWriter out) { - if (StringUtil.isNullOrEmpty(goodsId)) { - out.print(JsonUtil.loadFalseResult(1, "鏈弬涓庢帹骞�")); - return; - } - if (goodsType == null) { - out.print(JsonUtil.loadFalseResult(2, "缂哄皯goodsType")); - return; - } - JSONObject data = new JSONObject(); - if (goodsType == Constant.SOURCE_TYPE_TAOBAO) { - TaoBaoGoodsBrief goods = null; - try { - goods = TaoKeApiUtil.getSimpleGoodsInfo(Long.parseLong(goodsId)); - } catch (NumberFormatException e) { - e.printStackTrace(); - } catch (TaobaoGoodsDownException e) { - e.printStackTrace(); - } + /** + * 鏄惁鍦ㄥ弬涓庢帹骞� + * + * @param goodsId -鍟嗗搧ID + * @param goodsType -TB/JD + * @param out + */ + @RequestMapping(value = "isGoodsExtend") + public void isGoodsExtend(AcceptData acceptData, String goodsId, Integer goodsType, PrintWriter out) { + if (StringUtil.isNullOrEmpty(goodsId)) { + out.print(JsonUtil.loadFalseResult(1, "鏈弬涓庢帹骞�")); + return; + } + if (goodsType == null) { + out.print(JsonUtil.loadFalseResult(2, "缂哄皯goodsType")); + return; + } + JSONObject data = new JSONObject(); + if (goodsType == Constant.SOURCE_TYPE_TAOBAO) { + TaoBaoGoodsBrief goods = null; + try { + goods = TaoKeApiUtil.getSimpleGoodsInfo(Long.parseLong(goodsId)); + } catch (NumberFormatException e) { + e.printStackTrace(); + } catch (TaobaoGoodsDownException e) { + e.printStackTrace(); + } - if (goods == null) { - data.put("extend", false); - data.put("url", "https://h5.m.taobao.com/awp/core/detail.htm?id=" + goodsId); - } else { - data.put("extend", true); - } + if (goods == null) { + data.put("extend", false); + data.put("url", "https://h5.m.taobao.com/awp/core/detail.htm?id=" + goodsId); + } else { + data.put("extend", true); + } - } else if (goodsType == Constant.SOURCE_TYPE_JD) { - JDGoods goods = JDApiUtil.getGoodsDetail(Long.parseLong(goodsId)); - if (goods == null) { - data.put("extend", false); - data.put("url", String.format("https://item.m.jd.com/product/%s.html", goodsId)); - } else { - data.put("extend", true); - } - } else if (goodsType == Constant.SOURCE_TYPE_PDD) { - PDDGoodsDetail goods = PinDuoDuoApiUtil.getGoodsDetail(Long.parseLong(goodsId)); - if (goods == null) { - data.put("extend", false); - data.put("url", String.format("https://mobile.yangkeduo.com/goods.html?goods_id=%s", goodsId)); - } else { - data.put("extend", true); - } - } else if (goodsType == Constant.SOURCE_TYPE_VIP) { - VIPGoodsInfo goods = VipShopApiUtil.getGoodsDetail(goodsId); - if (goods == null) { - data.put("extend", false); - data.put("url",""); - } else { - data.put("extend", true); - } - } else if (goodsType == Constant.SOURCE_TYPE_SUNING) { - SuningGoodsInfo goods = SuningApiUtil.getGoodsDetail(goodsId.split("-")[1], goodsId.split("-")[0]); - if (goods == null) { - data.put("extend", false); - data.put("url", String.format("https://m.suning.com/product/%s/%s.html", goodsId.split("-")[0],goodsId.split("-")[1])); - } else { - data.put("extend", true); - } - } - out.print(JsonUtil.loadTrueResult(data)); - } + } else if (goodsType == Constant.SOURCE_TYPE_JD) { + JDGoods goods = JDApiUtil.getGoodsDetail(Long.parseLong(goodsId)); + if (goods == null) { + data.put("extend", false); + data.put("url", String.format("https://item.m.jd.com/product/%s.html", goodsId)); + } else { + data.put("extend", true); + } + } else if (goodsType == Constant.SOURCE_TYPE_PDD) { + PDDGoodsDetail goods = PinDuoDuoApiUtil.getGoodsDetail(Long.parseLong(goodsId)); + if (goods == null) { + data.put("extend", false); + data.put("url", String.format("https://mobile.yangkeduo.com/goods.html?goods_id=%s", goodsId)); + } else { + data.put("extend", true); + } + } else if (goodsType == Constant.SOURCE_TYPE_VIP) { + VIPGoodsInfo goods = VipShopApiUtil.getGoodsDetail(goodsId); + if (goods == null) { + data.put("extend", false); + data.put("url", ""); + } else { + data.put("extend", true); + } + } else if (goodsType == Constant.SOURCE_TYPE_SUNING) { + SuningGoodsInfo goods = SuningApiUtil.getGoodsDetail(goodsId.split("-")[1], goodsId.split("-")[0]); + if (goods == null) { + data.put("extend", false); + data.put("url", String.format("https://m.suning.com/product/%s/%s.html", goodsId.split("-")[0], goodsId.split("-")[1])); + } else { + data.put("extend", true); + } + } + out.print(JsonUtil.loadTrueResult(data)); + } - @RequestMapping(value = "listSimpleGoods", method = RequestMethod.POST) - public void listSimpleGoods(AcceptData acceptData, String goodsInfo, PrintWriter out) { - if (StringUtil.isNullOrEmpty(goodsInfo)) { - out.print(JsonUtil.loadFalseResult(1, "鍟嗗搧淇℃伅涓虹┖")); - return; - } + @RequestMapping(value = "listSimpleGoods", method = RequestMethod.POST) + public void listSimpleGoods(AcceptData acceptData, String goodsInfo, PrintWriter out) { + if (StringUtil.isNullOrEmpty(goodsInfo)) { + out.print(JsonUtil.loadFalseResult(1, "鍟嗗搧淇℃伅涓虹┖")); + return; + } - net.sf.json.JSONArray array = net.sf.json.JSONArray.fromObject(goodsInfo); + net.sf.json.JSONArray array = net.sf.json.JSONArray.fromObject(goodsInfo); - List<CommonGoods> commonGoodsList = new ArrayList<>(); + List<CommonGoods> commonGoodsList = new ArrayList<>(); - for (int i = 0; i < array.size(); i++) { - JSONObject obj = array.optJSONObject(i); - CommonGoods cg = new CommonGoods(); - cg.setGoodsId(obj.optLong("goodsId")); - cg.setGoodsType(obj.optInt("goodsType")); - commonGoodsList.add(cg); - } + for (int i = 0; i < array.size(); i++) { + JSONObject obj = array.optJSONObject(i); + CommonGoods cg = new CommonGoods(); + cg.setGoodsId(obj.optLong("goodsId")); + cg.setGoodsType(obj.optInt("goodsType")); + commonGoodsList.add(cg); + } - if (commonGoodsList.size() > 9) { - out.print(JsonUtil.loadFalseResult(1, "鏈�澶氬悓鏃惰幏鍙�9鏉℃暟鎹�")); - return; - } + if (commonGoodsList.size() > 9) { + out.print(JsonUtil.loadFalseResult(1, "鏈�澶氬悓鏃惰幏鍙�9鏉℃暟鎹�")); + return; + } - // 鍒嗙鍚勪釜骞冲彴鐨勫晢鍝佷俊鎭� - List<Long> tbGoodsList = new ArrayList<>(); - List<Long> jdGoodsList = new ArrayList<>(); - List<Long> pddGoodsList = new ArrayList<>(); + // 鍒嗙鍚勪釜骞冲彴鐨勫晢鍝佷俊鎭� + List<Long> tbGoodsList = new ArrayList<>(); + List<Long> jdGoodsList = new ArrayList<>(); + List<Long> pddGoodsList = new ArrayList<>(); - List<String> keyList = new ArrayList<>(); + List<String> keyList = new ArrayList<>(); - for (CommonGoods cg : commonGoodsList) { - keyList.add(cg.getGoodsId() + "-" + cg.getGoodsType()); - if (cg.getGoodsType() == Constant.SOURCE_TYPE_TAOBAO) { - tbGoodsList.add(cg.getGoodsId()); - } else if (cg.getGoodsType() == Constant.SOURCE_TYPE_JD) { - jdGoodsList.add(cg.getGoodsId()); - } else if (cg.getGoodsType() == Constant.SOURCE_TYPE_PDD) { - pddGoodsList.add(cg.getGoodsId()); - } - } + for (CommonGoods cg : commonGoodsList) { + keyList.add(cg.getGoodsId() + "-" + cg.getGoodsType()); + if (cg.getGoodsType() == Constant.SOURCE_TYPE_TAOBAO) { + tbGoodsList.add(cg.getGoodsId()); + } else if (cg.getGoodsType() == Constant.SOURCE_TYPE_JD) { + jdGoodsList.add(cg.getGoodsId()); + } else if (cg.getGoodsType() == Constant.SOURCE_TYPE_PDD) { + pddGoodsList.add(cg.getGoodsId()); + } + } - Map<String, GoodsDetailVO> tempGoodsList = new HashMap<>(); + Map<String, GoodsDetailVO> tempGoodsList = new HashMap<>(); - ConfigParamsDTO params = new ConfigParamsDTO(hongBaoManageService.getFanLiRate(), - hongBaoManageService.getShareRate(), new BigDecimal(80), - hongBaoManageService.getFanLiRate(UserLevelEnum.superVIP)); + ConfigParamsDTO params = new ConfigParamsDTO(hongBaoManageService.getFanLiRate(), + hongBaoManageService.getShareRate(), new BigDecimal(80), + hongBaoManageService.getFanLiRate(UserLevelEnum.superVIP)); - if (tbGoodsList.size() > 0) { - List<TaoBaoGoodsBrief> goodsList = null; - try { - goodsList = TaoKeApiUtil.getBatchGoodsInfo(tbGoodsList); - } catch (TaobaoGoodsDownException e) { - e.printStackTrace(); - } catch (TaoKeApiException e) { - e.printStackTrace(); - } - if (goodsList != null) - for (TaoBaoGoodsBrief goods : goodsList) { - goods.setTkRate(new BigDecimal(0)); - tempGoodsList.put(goods.getAuctionId() + "-" + Constant.SOURCE_TYPE_TAOBAO, - GoodsDetailVOFactory.convertTaoBao(goods, params)); - } - } - if (jdGoodsList.size() > 0) { - List<JDGoods> goodsList = JDApiUtil.getGoodsDetail(jdGoodsList); - for (JDGoods goods : goodsList) { - tempGoodsList.put(goods.getSkuId() + "-" + Constant.SOURCE_TYPE_JD, - GoodsDetailVOFactory.convertJDGoods(goods, params)); - } - } - if (pddGoodsList.size() > 0) { - List<PDDGoodsDetail> goodsList = PinDuoDuoApiUtil.listGoodsDetail(pddGoodsList); - for (PDDGoodsDetail goods : goodsList) { - tempGoodsList.put(goods.getGoodsId() + "-" + Constant.SOURCE_TYPE_PDD, - GoodsDetailVOFactory.convertPDDGoods(goods, params)); - } - } - List<GoodsDetailVO> voList = new ArrayList<>(); - Gson gson = JsonUtil.getApiCommonGson(); - for (String key : keyList) { - GoodsDetailVO vo = tempGoodsList.get(key); - if (vo != null) { - voList.add(vo); - } - } - out.print(JsonUtil.loadTrueResult(gson.toJson(voList))); - } + if (tbGoodsList.size() > 0) { + List<TaoBaoGoodsBrief> goodsList = null; + try { + goodsList = TaoKeApiUtil.getBatchGoodsInfo(tbGoodsList); + } catch (TaobaoGoodsDownException e) { + e.printStackTrace(); + } catch (TaoKeApiException e) { + e.printStackTrace(); + } + if (goodsList != null) + for (TaoBaoGoodsBrief goods : goodsList) { + goods.setTkRate(new BigDecimal(0)); + tempGoodsList.put(goods.getAuctionId() + "-" + Constant.SOURCE_TYPE_TAOBAO, + GoodsDetailVOFactory.convertTaoBao(goods, params)); + } + } + if (jdGoodsList.size() > 0) { + List<JDGoods> goodsList = JDApiUtil.getGoodsDetail(jdGoodsList); + for (JDGoods goods : goodsList) { + tempGoodsList.put(goods.getSkuId() + "-" + Constant.SOURCE_TYPE_JD, + GoodsDetailVOFactory.convertJDGoods(goods, params)); + } + } + if (pddGoodsList.size() > 0) { + List<PDDGoodsDetail> goodsList = PinDuoDuoApiUtil.listGoodsDetail(pddGoodsList); + for (PDDGoodsDetail goods : goodsList) { + tempGoodsList.put(goods.getGoodsId() + "-" + Constant.SOURCE_TYPE_PDD, + GoodsDetailVOFactory.convertPDDGoods(goods, params)); + } + } + List<GoodsDetailVO> voList = new ArrayList<>(); + Gson gson = JsonUtil.getApiCommonGson(); + for (String key : keyList) { + GoodsDetailVO vo = tempGoodsList.get(key); + if (vo != null) { + voList.add(vo); + } + } + out.print(JsonUtil.loadTrueResult(gson.toJson(voList))); + } - /** - * 浜笢杞摼 - * @Title: getJDLink - * @Description: - * @param acceptData - * @param link - * @param uid - * @param out - * void 杩斿洖绫诲瀷 - * @throws - */ - @RequestMapping(value = "convertJDLink") - public void convertJDLink(AcceptData acceptData, String link, Long uid, String callback, PrintWriter out) { - if (StringUtil.isNullOrEmpty(link)) { - out.print(JsonUtil.loadFalseResult(1, "閾炬帴涓虹┖")); - return; - } + /** + * 浜笢杞摼 + * + * @param acceptData + * @param link + * @param uid + * @param out void 杩斿洖绫诲瀷 + * @throws + * @Title: getJDLink + * @Description: + */ + @RequestMapping(value = "convertJDLink") + public void convertJDLink(AcceptData acceptData, String link, Long uid, String callback, PrintWriter out) { + if (StringUtil.isNullOrEmpty(link)) { + out.print(JsonUtil.loadFalseResult(1, "閾炬帴涓虹┖")); + return; + } - link = JDApiUtil.convertLinkWithSubUnionId(link, null, JDApiUtil.POSITION_FANLI + "", uid + ""); + link = JDApiUtil.convertLinkWithSubUnionId(link, null, JDApiUtil.POSITION_FANLI + "", uid + ""); - JSONObject data = new JSONObject(); - data.put("link", link); - JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data)); - } + JSONObject data = new JSONObject(); + data.put("link", link); + JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data)); + } } -- Gitblit v1.8.0