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/client/v2/SuningControllerV2.java | 238 +++++++++++++++++++++++++++++----------------------------- 1 files changed, 119 insertions(+), 119 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/SuningControllerV2.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/SuningControllerV2.java index 2c919c5..cc04a83 100644 --- a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/SuningControllerV2.java +++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/SuningControllerV2.java @@ -1,119 +1,119 @@ -package com.yeshi.fanli.controller.client.v2; - -import java.io.PrintWriter; -import java.util.ArrayList; -import java.util.List; - -import javax.annotation.Resource; - -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.yeshi.utils.JsonUtil; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.yeshi.fanli.dto.ConfigParamsDTO; -import com.yeshi.fanli.dto.suning.SuningGoodsInfo; -import com.yeshi.fanli.entity.accept.AcceptData; -import com.yeshi.fanli.entity.bus.homemodule.Special; -import com.yeshi.fanli.service.inter.goods.suning.SuningGoodsService; -import com.yeshi.fanli.service.inter.homemodule.SpecialService; -import com.yeshi.fanli.service.inter.homemodule.SwiperPictureService; -import com.yeshi.fanli.service.inter.order.OrderHongBaoMoneyComputeService; -import com.yeshi.fanli.util.Constant; -import com.yeshi.fanli.util.factory.goods.GoodsDetailVOFactory; -import com.yeshi.fanli.vo.goods.GoodsDetailVO; -import com.yeshi.fanli.vo.homemodule.BannerVO; - -import net.sf.json.JSONArray; -import net.sf.json.JSONObject; - -/** - * 鐑攢姒� - * - * @author Administrator - * - */ -@Controller -@RequestMapping("api/v2/suning") -public class SuningControllerV2 { - - @Resource - private SuningGoodsService suningGoodsService; - - @Resource - private SwiperPictureService swiperPictureService; - - @Resource - private SpecialService specialService; - - @Resource - private OrderHongBaoMoneyComputeService orderHongBaoMoneyComputeService; - - /** - * 浜笢涓撻鍒嗙被 - * - * @param acceptData - * @param out - */ - @RequestMapping(value = "getClass") - public void getJDClass(AcceptData acceptData, PrintWriter out) { - JSONObject root = new JSONObject(); - root.put("list", suningGoodsService.getSpecialClass()); - root.put("suningLink", "https://www.suning.com/"); - out.print(JsonUtil.loadTrueResult(root)); - } - - /** - * 浜笢涓撻 + 鍟嗗搧鍒楄〃 - * - * @param acceptData - * @param out - */ - @RequestMapping(value = "getGoodsInfo") - public void getGoodsInfo(AcceptData acceptData, Long cid, Integer page, PrintWriter out) { - JSONObject root = new JSONObject(); - if (cid == 1 && page == 1) { - List<BannerVO> topPicList = swiperPictureService.getByBannerCardAndVersion("suning_banner_index", - acceptData.getPlatform(), Integer.parseInt(acceptData.getVersion())); - if (topPicList == null) { - topPicList = new ArrayList<BannerVO>(); - } - root.put("listPic", JsonUtil.getApiCommonGson().toJson(topPicList)); - - int platformCode = Constant.getPlatformCode(acceptData.getPlatform()); - - List<Special> listSpecial = specialService.listByPlaceKey("suning_special_index", platformCode, - Integer.parseInt(acceptData.getVersion())); - if (listSpecial == null) { - listSpecial = new ArrayList<Special>(); - } - root.put("listSpe", JsonUtil.getApiCommonGson().toJson(listSpecial)); - } - - List<SuningGoodsInfo> goodsList = suningGoodsService.specialSearch(page, cid); - - try { - JSONArray array = new JSONArray(); - if (goodsList != null && goodsList.size() > 0) { - ConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate(acceptData.getPlatform(), - acceptData.getVersion()); - - Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder()) - .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create(); - for (SuningGoodsInfo goods : goodsList) { - GoodsDetailVO goodsDetailVO = GoodsDetailVOFactory.convertSuningGoods(goods, paramsDTO); - array.add(gson.toJson(goodsDetailVO)); - } - } - - root.put("list", array); - root.put("count", 1000); - out.print(JsonUtil.loadTrueResult(root)); - } catch (Exception e) { - e.printStackTrace(); - out.print(JsonUtil.loadFalseResult("鑾峰彇鍑洪敊")); - } - } - -} +package com.yeshi.fanli.controller.client.v2; + +import java.io.PrintWriter; +import java.util.ArrayList; +import java.util.List; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.yeshi.utils.JsonUtil; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.yeshi.fanli.dto.GoodsMoneyConfigParamsDTO; +import com.yeshi.fanli.dto.suning.SuningGoodsInfo; +import com.yeshi.fanli.entity.accept.AcceptData; +import com.yeshi.fanli.entity.bus.homemodule.Special; +import com.yeshi.fanli.service.inter.goods.suning.SuningGoodsService; +import com.yeshi.fanli.service.inter.homemodule.SpecialService; +import com.yeshi.fanli.service.inter.homemodule.SwiperPictureService; +import com.yeshi.fanli.service.inter.order.OrderHongBaoMoneyComputeService; +import com.yeshi.fanli.util.Constant; +import com.yeshi.fanli.util.factory.goods.GoodsDetailVOFactory; +import com.yeshi.fanli.vo.goods.GoodsDetailVO; +import com.yeshi.fanli.vo.homemodule.BannerVO; + +import net.sf.json.JSONArray; +import net.sf.json.JSONObject; + +/** + * 鐑攢姒� + * + * @author Administrator + * + */ +@Controller +@RequestMapping("api/v2/suning") +public class SuningControllerV2 { + + @Resource + private SuningGoodsService suningGoodsService; + + @Resource + private SwiperPictureService swiperPictureService; + + @Resource + private SpecialService specialService; + + @Resource + private OrderHongBaoMoneyComputeService orderHongBaoMoneyComputeService; + + /** + * 浜笢涓撻鍒嗙被 + * + * @param acceptData + * @param out + */ + @RequestMapping(value = "getClass") + public void getJDClass(AcceptData acceptData, PrintWriter out) { + JSONObject root = new JSONObject(); + root.put("list", suningGoodsService.getSpecialClass()); + root.put("suningLink", "https://www.suning.com/"); + out.print(JsonUtil.loadTrueResult(root)); + } + + /** + * 浜笢涓撻 + 鍟嗗搧鍒楄〃 + * + * @param acceptData + * @param out + */ + @RequestMapping(value = "getGoodsInfo") + public void getGoodsInfo(AcceptData acceptData, Long cid, Integer page, PrintWriter out) { + JSONObject root = new JSONObject(); + if (cid == 1 && page == 1) { + List<BannerVO> topPicList = swiperPictureService.getByBannerCardAndVersion("suning_banner_index", + acceptData.getPlatform(), Integer.parseInt(acceptData.getVersion()),acceptData.getSystem()); + if (topPicList == null) { + topPicList = new ArrayList<BannerVO>(); + } + root.put("listPic", JsonUtil.getApiCommonGson().toJson(topPicList)); + + int platformCode = Constant.getPlatformCode(acceptData.getPlatform()); + + List<Special> listSpecial = specialService.listByPlaceKey("suning_special_index", platformCode, + Integer.parseInt(acceptData.getVersion()),acceptData.getSystem()); + if (listSpecial == null) { + listSpecial = new ArrayList<Special>(); + } + root.put("listSpe", JsonUtil.getApiCommonGson().toJson(listSpecial)); + } + + List<SuningGoodsInfo> goodsList = suningGoodsService.specialSearch(page, cid); + + try { + JSONArray array = new JSONArray(); + if (goodsList != null && goodsList.size() > 0) { + GoodsMoneyConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate(acceptData.getPlatform(), + acceptData.getVersion(),acceptData.getSystem()); + + Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder()) + .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create(); + for (SuningGoodsInfo goods : goodsList) { + GoodsDetailVO goodsDetailVO = GoodsDetailVOFactory.convertSuningGoods(goods, paramsDTO); + array.add(gson.toJson(goodsDetailVO)); + } + } + + root.put("list", array); + root.put("count", 1000); + out.print(JsonUtil.loadTrueResult(root)); + } catch (Exception e) { + e.printStackTrace(); + out.print(JsonUtil.loadFalseResult("鑾峰彇鍑洪敊")); + } + } + +} -- Gitblit v1.8.0