From 30d8e227e8d823b6c38c3b9c90ac2df03b63befe Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期二, 25 二月 2025 16:41:22 +0800 Subject: [PATCH] 淘宝转链接口更新 --- fanli/src/main/java/com/yeshi/fanli/controller/web/WebRecommendController.java | 312 +++++++++++++++++++++++++-------------------------- 1 files changed, 155 insertions(+), 157 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/web/WebRecommendController.java b/fanli/src/main/java/com/yeshi/fanli/controller/web/WebRecommendController.java index 76885fb..6503a7b 100644 --- a/fanli/src/main/java/com/yeshi/fanli/controller/web/WebRecommendController.java +++ b/fanli/src/main/java/com/yeshi/fanli/controller/web/WebRecommendController.java @@ -43,183 +43,181 @@ @RequestMapping("api/web/v1/webRecommend") public class WebRecommendController { - @Resource - private WebControllerUtil webControllerUtil; + @Resource + private WebControllerUtil webControllerUtil; - @Resource - private SuperRecommendBannerService superRecommendBannerService; + @Resource + private SuperRecommendBannerService superRecommendBannerService; - @Resource - private HongBaoManageService hongBaoManageService; + @Resource + private HongBaoManageService hongBaoManageService; - @Resource - private RedisManager redisManager; + @Resource + private RedisManager redisManager; - @Resource - private BusinessSystemService businessSystemService; + @Resource + private BusinessSystemService businessSystemService; - @Resource - private CollectionGoodsV2Service collectionGoodsV2Service; + @Resource + private CollectionGoodsV2Service collectionGoodsV2Service; - @Resource - private ConfigService configService; + @Resource + private ConfigService configService; - @Resource - private SystemConfigService systemConfigService; + @Resource + private SystemConfigService systemConfigService; - @Resource - private TaoBaoGoodsBriefService taoBaoGoodsBriefService; + @Resource + private TaoBaoGoodsBriefService taoBaoGoodsBriefService; - @Resource - private TaoBaoUnionConfigService taoBaoUnionConfigService; + @Resource + private TaoBaoUnionConfigService taoBaoUnionConfigService; - /** - * - * 鏂规硶璇存槑: 鎺ㄨ崘杞挱鍟嗗搧淇℃伅 - * - * @author mawurui createTime 2018骞�5鏈�11鏃� 涓婂崍11:13:47 - * @param acceptData - * @param out - */ - @RequestMapping(value = "getRecommenBanner", method = RequestMethod.GET) - public void getRecommendBanner(AcceptData acceptData, String callback, PrintWriter out) { + /** + * 鏂规硶璇存槑: 鎺ㄨ崘杞挱鍟嗗搧淇℃伅 + * + * @param acceptData + * @param out + * @author mawurui createTime 2018骞�5鏈�11鏃� 涓婂崍11:13:47 + */ + @RequestMapping(value = "getRecommenBanner", method = RequestMethod.GET) + public void getRecommendBanner(AcceptData acceptData, String callback, PrintWriter out) { - BusinessSystem system = businessSystemService.getBusinessSystem("WEB", - Constant.systemCommonConfig.getH5PackageName(),acceptData.getSystem()); - JSONObject json = new JSONObject(); - if (system == null) { - out.print(JsonUtil.loadFalseResult(1, WebControllerUtil.NOSYSTEM)); - return; - } - List<SuperRecommendBanner> superRecommendBanners = superRecommendBannerService - .getSuperRecommendBannersBySystem(system); - List<RecommendBanner> list = null; - for (SuperRecommendBanner superRecommendBanner : superRecommendBanners) { - if (list == null) { - list = new ArrayList<RecommendBanner>(); - } - RecommendBanner recommendBanner = superRecommendBanner.getRecommendBanner(); - // 娣樼壒浠锋殏鏃朵慨鏀� - if (system.getId() == 7) { - recommendBanner.getJumpDetail().setActivity(recommendBanner.getJumpDetail().getActivity() - .replace("com.yeshi.ec.rebate.myapplication", "com.yeshi.ec.taospecial")); - } + BusinessSystem system = businessSystemService.getBusinessSystem("WEB", + systemConfigService.getValueCache(SystemConfigKeyEnum.h5PackageName, acceptData.getSystem()), acceptData.getSystem()); + JSONObject json = new JSONObject(); + if (system == null) { + out.print(JsonUtil.loadFalseResult(1, WebControllerUtil.NOSYSTEM)); + return; + } + List<SuperRecommendBanner> superRecommendBanners = superRecommendBannerService + .getSuperRecommendBannersBySystem(system); + List<RecommendBanner> list = null; + for (SuperRecommendBanner superRecommendBanner : superRecommendBanners) { + if (list == null) { + list = new ArrayList<RecommendBanner>(); + } + RecommendBanner recommendBanner = superRecommendBanner.getRecommendBanner(); + // 娣樼壒浠锋殏鏃朵慨鏀� + if (system.getId() == 7) { + recommendBanner.getJumpDetail().setActivity(recommendBanner.getJumpDetail().getActivity() + .replace("com.yeshi.ec.rebate.myapplication", "com.yeshi.ec.taospecial")); + } - list.add(recommendBanner); - } + list.add(recommendBanner); + } - if (list == null) { - json.put("code", "1"); - json.put("msg", WebControllerUtil.NODATA); - out.print(json); - java.lang.System.out.println("json-" + json); - return; - } - json.put("code", 0); - JSONObject data = new JSONObject(); - data.put("count", list.size()); - Gson gson = new Gson(); - data.put("data", gson.toJson(list)); - json.put("data", data); - // jsonp鏂瑰紡杩斿洖 - out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(json))); - return; - } + if (list == null) { + json.put("code", "1"); + json.put("msg", WebControllerUtil.NODATA); + out.print(json); + java.lang.System.out.println("json-" + json); + return; + } + json.put("code", 0); + JSONObject data = new JSONObject(); + data.put("count", list.size()); + Gson gson = new Gson(); + data.put("data", gson.toJson(list)); + json.put("data", data); + // jsonp鏂瑰紡杩斿洖 + out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(json))); + return; + } - /** - * - * 鏂规硶璇存槑: 鑾峰彇鍟嗗搧璇︽儏 - * - * @author mawurui createTime 2018骞�5鏈�11鏃� 涓婂崍11:37:02 - * @param acceptData - * @param id - * @param uid - * @param out - */ + /** + * 鏂规硶璇存槑: 鑾峰彇鍟嗗搧璇︽儏 + * + * @param acceptData + * @param id + * @param uid + * @param out + * @author mawurui createTime 2018骞�5鏈�11鏃� 涓婂崍11:37:02 + */ - @RequestMapping(value = "getGoodsDetail", method = RequestMethod.GET) - public void getGoodsDetail(final AcceptData acceptData, final String id, final String uid, Integer goodsType, - String callback, PrintWriter out) { - - long begin = java.lang.System.currentTimeMillis(); - if (StringUtil.isNullOrEmpty(id)) { - out.print(JsonUtil.loadFalseResult(1, "璇蜂笂浼爄d")); - return; - } - BusinessSystem system = webControllerUtil.getSystem(acceptData); + @RequestMapping(value = "getGoodsDetail", method = RequestMethod.GET) + public void getGoodsDetail(final AcceptData acceptData, final String id, final String uid, Integer goodsType, + String callback, PrintWriter out) { - if (system == null) { - out.print(JsonUtil.loadFalseResult(1, WebControllerUtil.NOSYSTEM)); - return; - } - TaoBaoGoodsBrief tb = null; - try { - tb = redisManager.getTaoBaoGoodsBrief(Long.parseLong(id)); - } catch (NumberFormatException e1) { - e1.printStackTrace(); - } catch (TaobaoGoodsDownException e1) { - e1.printStackTrace(); - } + long begin = java.lang.System.currentTimeMillis(); + if (StringUtil.isNullOrEmpty(id)) { + out.print(JsonUtil.loadFalseResult(1, "璇蜂笂浼爄d")); + return; + } + BusinessSystem system = webControllerUtil.getSystem(acceptData); - if (tb != null) { - tb.setAuctionUrl(null); - tb.setId(null); - Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create(); - JSONObject data = new JSONObject(); + if (system == null) { + out.print(JsonUtil.loadFalseResult(1, WebControllerUtil.NOSYSTEM)); + return; + } + TaoBaoGoodsBrief tb = null; + try { + tb = redisManager.getTaoBaoGoodsBrief(id); + } catch (NumberFormatException e1) { + e1.printStackTrace(); + } catch (TaobaoGoodsDownException e1) { + e1.printStackTrace(); + } - // 鑾峰彇榛樿PID淇℃伅 - int type = 0; - if ("android".equalsIgnoreCase(acceptData.getPlatform())) - type = 1; - else - type = 2; - List<TaoBaoUnionConfig> config = taoBaoUnionConfigService.getConfigByTypeCache(type); - TaoBaoGoodsBriefExtra taoBaoGoodsBriefExtra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(tb, config.get(0),acceptData.getSystem()); - if (!StringUtil.isNullOrEmpty(tb.getCouponLink()) && taoBaoGoodsBriefExtra.getTaoBaoQuanInfo() != null) - taoBaoGoodsBriefExtra.getTaoBaoQuanInfo().setCouponLink(tb.getCouponLink()); + if (tb != null) { + tb.setAuctionUrl(null); + tb.setId(null); + Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create(); + JSONObject data = new JSONObject(); - if (uid != null && !"".equals(uid.trim())) { - CollectionGoodsV2 collectionGoods = collectionGoodsV2Service.findByUidAndAuctionId(Long.parseLong(uid), - Long.parseLong(id), goodsType); - data.put("collection", collectionGoods != null ? true : false); - } - taoBaoGoodsBriefExtra.setAuctionUrl(null); - data.put("taobao", gson.toJson(taoBaoGoodsBriefExtra)); - String info = configService.getValue(ConfigKeyEnum.detailPrompt.getKey(), acceptData.getSystem()); - data.put("info", info); - String onlyInfo = configService.getValue(ConfigKeyEnum.onlyInfo.getKey(), acceptData.getSystem()); - data.put("only", onlyInfo); - int showType = taoBaoGoodsBriefExtra.getShowType(); - String price = ""; - if (showType == 1 || showType == 3) { - price = taoBaoGoodsBriefExtra.getQuanPrice() + ""; - } else { - price = taoBaoGoodsBriefExtra.getZkPrice() + ""; - } - String appName = systemConfigService.getValueCache(SystemConfigKeyEnum.appName, acceptData.getSystem()); - data.put("sharePrice", "楼" + price + "鍏� 閫�" + appName + "绾㈠寘楼" - + taoBaoGoodsBriefExtra.getTaoBaoHongBaoInfo().getHongbao() + "鍏� "); - data.put("shareTitle", taoBaoGoodsBriefExtra.getTitle()); - data.put("shareContent", "楼" + price + "鍏�"); - data.put("shareImg", taoBaoGoodsBriefExtra.getPictUrl()); - String html = configService.getValue(ConfigKeyEnum.downAPP.getKey(), acceptData.getSystem()); - data.put("downAPP", html); - String shareSinaContent = configService.getValue("shareSinaContent", acceptData.getSystem()); - data.put("shareSina", - "楼" + price + "鍏� 閫�" + appName + "绾㈠寘楼" - + taoBaoGoodsBriefExtra.getTaoBaoHongBaoInfo().getHongbao() + "鍏� " - + taoBaoGoodsBriefExtra.getTitle() + shareSinaContent); + // 鑾峰彇榛樿PID淇℃伅 + int type = 0; + if ("android".equalsIgnoreCase(acceptData.getPlatform())) + type = 1; + else + type = 2; + List<TaoBaoUnionConfig> config = taoBaoUnionConfigService.getConfigByTypeCache(type); + TaoBaoGoodsBriefExtra taoBaoGoodsBriefExtra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(tb, config.get(0), acceptData.getSystem()); + if (!StringUtil.isNullOrEmpty(tb.getCouponLink()) && taoBaoGoodsBriefExtra.getTaoBaoQuanInfo() != null) + taoBaoGoodsBriefExtra.getTaoBaoQuanInfo().setCouponLink(tb.getCouponLink()); - data.put("sharemoney", "鍒嗕韩濂栭噾 楼" + taoBaoGoodsBriefService.getShareGoodsUserHongBao(tb,acceptData.getSystem()) + "鍏�"); - out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(data))); + if (uid != null && !"".equals(uid.trim())) { + CollectionGoodsV2 collectionGoods = collectionGoodsV2Service.findByUidAndAuctionId(Long.parseLong(uid), + id, goodsType); + data.put("collection", collectionGoods != null ? true : false); + } + taoBaoGoodsBriefExtra.setAuctionUrl(null); + data.put("taobao", gson.toJson(taoBaoGoodsBriefExtra)); + String info = configService.getValue(ConfigKeyEnum.detailPrompt.getKey(), acceptData.getSystem()); + data.put("info", info); + String onlyInfo = configService.getValue(ConfigKeyEnum.onlyInfo.getKey(), acceptData.getSystem()); + data.put("only", onlyInfo); + int showType = taoBaoGoodsBriefExtra.getShowType(); + String price = ""; + if (showType == 1 || showType == 3) { + price = taoBaoGoodsBriefExtra.getQuanPrice() + ""; + } else { + price = taoBaoGoodsBriefExtra.getZkPrice() + ""; + } + String appName = systemConfigService.getValueCache(SystemConfigKeyEnum.appName, acceptData.getSystem()); + data.put("sharePrice", "楼" + price + "鍏� 閫�" + appName + "绾㈠寘楼" + + taoBaoGoodsBriefExtra.getTaoBaoHongBaoInfo().getHongbao() + "鍏� "); + data.put("shareTitle", taoBaoGoodsBriefExtra.getTitle()); + data.put("shareContent", "楼" + price + "鍏�"); + data.put("shareImg", taoBaoGoodsBriefExtra.getPictUrl()); + String html = configService.getValue(ConfigKeyEnum.downAPP.getKey(), acceptData.getSystem()); + data.put("downAPP", html); + String shareSinaContent = configService.getValue("shareSinaContent", acceptData.getSystem()); + data.put("shareSina", + "楼" + price + "鍏� 閫�" + appName + "绾㈠寘楼" + + taoBaoGoodsBriefExtra.getTaoBaoHongBaoInfo().getHongbao() + "鍏� " + + taoBaoGoodsBriefExtra.getTitle() + shareSinaContent); - final TaoBaoGoodsBrief tbb = tb; + data.put("sharemoney", "鍒嗕韩濂栭噾 楼" + taoBaoGoodsBriefService.getShareGoodsUserHongBao(tb, acceptData.getSystem()) + "鍏�"); + out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(data))); - } else { - out.print(JsonUtil.loadFalseResult(2, "鍟嗗搧宸蹭笅鏋�")); - } - long end = java.lang.System.currentTimeMillis(); - java.lang.System.out.println("鑰楁椂:" + (end - begin)); - return; - } + final TaoBaoGoodsBrief tbb = tb; + + } else { + out.print(JsonUtil.loadFalseResult(2, "鍟嗗搧宸蹭笅鏋�")); + } + long end = java.lang.System.currentTimeMillis(); + java.lang.System.out.println("鑰楁椂:" + (end - begin)); + return; + } } -- Gitblit v1.8.0