From 1faf3ab0ba6c17eee48e68e8d0077ea61f45d75d Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期二, 12 五月 2020 20:19:36 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/div' into div
---
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/JingDongControllerV2.java | 102 ++++++++++++++++++++++++++++-----------------------
1 files changed, 56 insertions(+), 46 deletions(-)
diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/JingDongControllerV2.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/JingDongControllerV2.java
index 0cd74d4..1b6206a 100644
--- a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/JingDongControllerV2.java
+++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/JingDongControllerV2.java
@@ -1,7 +1,6 @@
package com.yeshi.fanli.controller.client.v2;
import java.io.PrintWriter;
-import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
@@ -13,19 +12,25 @@
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
+import com.yeshi.fanli.dto.ConfigParamsDTO;
import com.yeshi.fanli.entity.accept.AcceptData;
-import com.yeshi.fanli.entity.bus.clazz.GoodsClass;
+import com.yeshi.fanli.entity.bus.homemodule.Special;
import com.yeshi.fanli.entity.bus.homemodule.SwiperPicture;
-import com.yeshi.fanli.entity.bus.lable.QualityFactory;
-import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
+import com.yeshi.fanli.entity.jd.JDGoods;
+import com.yeshi.fanli.entity.system.ConfigKeyEnum;
+import com.yeshi.fanli.exception.jd.JDGoodsException;
import com.yeshi.fanli.service.inter.common.JumpDetailV2Service;
import com.yeshi.fanli.service.inter.config.ConfigService;
import com.yeshi.fanli.service.inter.goods.TaoBaoGoodsBriefService;
+import com.yeshi.fanli.service.inter.homemodule.SpecialService;
import com.yeshi.fanli.service.inter.homemodule.SwiperPictureService;
-import com.yeshi.fanli.service.inter.hongbao.HongBaoManageService;
+import com.yeshi.fanli.service.inter.jd.JDGoodsService;
import com.yeshi.fanli.service.inter.lable.QualityGoodsService;
+import com.yeshi.fanli.service.inter.order.OrderHongBaoMoneyComputeService;
import com.yeshi.fanli.service.inter.taobao.dataoke.DaTaoKeGoodsService;
+import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.factory.goods.GoodsDetailVOFactory;
+import com.yeshi.fanli.vo.goods.GoodsDetailVO;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
@@ -41,7 +46,7 @@
public class JingDongControllerV2 {
@Resource
- private HongBaoManageService hongBaoManageService;
+ private OrderHongBaoMoneyComputeService orderHongBaoMoneyComputeService;
@Resource
private TaoBaoGoodsBriefService taoBaoGoodsBriefService;
@@ -51,78 +56,83 @@
@Resource
private DaTaoKeGoodsService daTaoKeGoodsService;
-
+
@Resource
private SwiperPictureService swiperPictureService;
-
+
@Resource
private QualityGoodsService qualityGoodsService;
-
+
@Resource
private ConfigService configService;
-
+
+ @Resource
+ private SpecialService specialService;
+
+ @Resource
+ private JDGoodsService jdGoodsService;
+
/**
* 浜笢涓撻鍒嗙被
+ *
* @param acceptData
* @param out
*/
@RequestMapping(value = "getClass")
public void getJDClass(AcceptData acceptData, PrintWriter out) {
- List<GoodsClass> list = new ArrayList<GoodsClass>();
- list.add(new GoodsClass(1L, "绮鹃��"));
- list.add(new GoodsClass(2L, "濂宠"));
- list.add(new GoodsClass(3L, "鐢疯"));
- list.add(new GoodsClass(4L, "缇庡"));
- list.add(new GoodsClass(5L, "缇庨"));
- list.add(new GoodsClass(6L, "灞呭"));
JSONObject root = new JSONObject();
- root.put("list", list);
- root.put("jdLink", configService.get("jingdong_h5_link"));
+ root.put("list", jdGoodsService.getSpecialClass());
+ root.put("jdLink", configService.get(ConfigKeyEnum.jingdongH5Link.getKey()));
out.print(JsonUtil.loadTrueResult(root));
}
-
-
+
+
/**
- * 浜笢涓撻
+ * 浜笢涓撻 + 鍟嗗搧鍒楄〃
+ *
* @param acceptData
* @param out
*/
@RequestMapping(value = "getGoodsInfo")
- public void getGoodsInfo(AcceptData acceptData, Integer cid, Integer page, PrintWriter out) {
+ public void getGoodsInfo(AcceptData acceptData, Long cid, Integer page, PrintWriter out) {
JSONObject root = new JSONObject();
if (cid == 1 && page == 1) {
- List<SwiperPicture> topPicList = swiperPictureService.getByBannerCard("jd_top");
+ List<SwiperPicture> topPicList = swiperPictureService.getByBannerCardAndVersion("jingdong_special_index",acceptData.getPlatform(), Integer.parseInt(acceptData.getVersion()));
if (topPicList == null) {
topPicList = new ArrayList<SwiperPicture>();
}
root.put("listPic", JsonUtil.getApiCommonGson().toJson(topPicList));
- }
-
- List<QualityFactory> listQuery = qualityGoodsService.listFreeGoods((page - 1) * 20, 20);
- if (listQuery == null) {
- listQuery = new ArrayList<QualityFactory>();
+
+ int platformCode = Constant.getPlatformCode(acceptData.getPlatform());
+
+ List<Special> listSpecial = specialService.listByPlaceKey("jingdong_special_index", platformCode, Integer.parseInt(acceptData.getVersion()));
+ if (listSpecial == null) {
+ listSpecial = new ArrayList<Special>();
+ }
+ root.put("listSpe", JsonUtil.getApiCommonGson().toJson(listSpecial));
}
- JSONArray array = new JSONArray();
- if (listQuery.size() > 0) {
- Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
- .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
-
- BigDecimal fanLiRate = hongBaoManageService.getFanLiRate();
- BigDecimal shareRate = hongBaoManageService.getShareRate();
- for (QualityFactory qualityFactory : listQuery) {
- TaoBaoGoodsBrief goods = qualityFactory.getTaoBaoGoodsBrief();
- if (goods == null) {
- continue;
+ try {
+ List<JDGoods> goodsList = jdGoodsService.specialSearch(page, cid);
+ 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 (JDGoods goods : goodsList) {
+ GoodsDetailVO goodsDetailVO = GoodsDetailVOFactory.convertJDGoods(goods, paramsDTO);
+ array.add(gson.toJson(goodsDetailVO));
}
- array.add(gson.toJson(GoodsDetailVOFactory.convertTaoBao(goods, null, fanLiRate, shareRate)));
}
+
+ root.put("list", array);
+ root.put("count", 1000);
+ out.print(JsonUtil.loadTrueResult(root));
+ } catch (JDGoodsException e) {
+ out.print(JsonUtil.loadFalseResult(e.getMsg()));
}
- long count = qualityGoodsService.countFreeGoods();
-
- root.put("count", count);
- root.put("list", array);
- out.print(JsonUtil.loadTrueResult(root));
}
}
--
Gitblit v1.8.0