From d8359ddb48dab5cc797a9d552e11fde571f4920c Mon Sep 17 00:00:00 2001 From: yujian <yujian@123.com> Date: 星期二, 27 八月 2019 12:32:46 +0800 Subject: [PATCH] Merge branch 'div' of ssh://193.112.35.168:29418/fanli-server into div --- fanli/src/main/java/com/yeshi/fanli/controller/client/v2/CommonContentControllerV2.java | 72 +++++++++++++++++++++++------------ 1 files changed, 47 insertions(+), 25 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/CommonContentControllerV2.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/CommonContentControllerV2.java index e994e79..665c512 100644 --- a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/CommonContentControllerV2.java +++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/CommonContentControllerV2.java @@ -29,11 +29,14 @@ import com.yeshi.fanli.service.inter.goods.CommonTemplateContentService; import com.yeshi.fanli.service.inter.goods.JDCommonTemplateContentService; import com.yeshi.fanli.service.inter.goods.PDDCommonTemplateContentService; +import com.yeshi.fanli.service.inter.homemodule.SwiperPictureService; import com.yeshi.fanli.service.inter.hongbao.HongBaoManageService; import com.yeshi.fanli.tag.PageEntity; import com.yeshi.fanli.util.Constant; import com.yeshi.fanli.util.StringUtil; import com.yeshi.fanli.util.factory.goods.GoodsDetailVOFactory; +import com.yeshi.fanli.util.taobao.TaoBaoUtil; +import com.yeshi.fanli.vo.goods.GoodsDetailVO; import net.sf.json.JSONArray; import net.sf.json.JSONObject; @@ -48,6 +51,8 @@ @RequestMapping("api/v2/commoncontent") public class CommonContentControllerV2 { + @Resource + private SwiperPictureService swiperPictureService; @Resource private HongBaoManageService hongBaoManageService; @@ -61,7 +66,6 @@ @Resource private PDDCommonTemplateContentService pddCommonTemplateContentService; - /** * 閫氱敤妯℃澘瀵艰埅 * @@ -75,7 +79,7 @@ out.print(JsonUtil.loadFalseResult(1, "璇蜂紶鍏ey")); return; } - + List<CommonContentNav> list = null; if (type == null || type == Constant.SOURCE_TYPE_TAOBAO) { list = commonTemplateContentService.getNavList(CommonContentTypeEnum.valueOf(key)); @@ -84,14 +88,14 @@ } else if (type == Constant.SOURCE_TYPE_PDD) { list = pddCommonTemplateContentService.getNavList(PDDCommonContentTypeEnum.valueOf(key)); } - + if (list == null) { list = new ArrayList<CommonContentNav>(); } - + out.print(JsonUtil.loadTrueResult(new Gson().toJson(list))); } - + /** * 鑾峰彇鍐呭 * @@ -102,7 +106,8 @@ * @param out */ @RequestMapping(value = "getNavGoodsList", method = RequestMethod.POST) - public void getNavContent(AcceptData acceptData, String key, Integer type, Integer page, String cid, PrintWriter out) { + public void getNavContent(AcceptData acceptData, String key, Integer type, Integer page, String cid, + PrintWriter out) { if (StringUtil.isNullOrEmpty(key)) { out.print(JsonUtil.loadFalseResult(1, "璇蜂紶鍏ey")); return; @@ -117,12 +122,12 @@ getListTB(acceptData, key, page, cid, out); return; } - + if (type == Constant.SOURCE_TYPE_JD) { getListJD(acceptData, key, page, cid, out); return; } - + if (type == Constant.SOURCE_TYPE_PDD) { getListPDD(acceptData, key, page, cid, out); return; @@ -130,7 +135,6 @@ out.print(JsonUtil.loadFalseResult("goodsType鍙傛暟涓嶆纭�")); } - private void getListTB(AcceptData acceptData, String key, Integer page, String cid, PrintWriter out) { CommonContentResult result = commonTemplateContentService.getContentList(CommonContentTypeEnum.valueOf(key), cid, page, Constant.PAGE_SIZE); @@ -147,18 +151,25 @@ List<TaoBaoGoodsBrief> goodsList = result.getGoodsList(); BigDecimal fanLiRate = hongBaoManageService.getFanLiRate(); BigDecimal shareRate = hongBaoManageService.getShareRate(); + for (TaoBaoGoodsBrief taoBaoGoodsBrief : goodsList) { - array.add(gson.toJson(GoodsDetailVOFactory.convertTaoBao(taoBaoGoodsBrief, null, fanLiRate, shareRate))); + GoodsDetailVO vo = GoodsDetailVOFactory.convertTaoBao(taoBaoGoodsBrief, null, fanLiRate, shareRate); + if (CommonContentTypeEnum.valueOf(key) == CommonContentTypeEnum.mianDan)// 鍏嶅崟鍟嗗搧 + { + vo.getMoneyInfo().setFanliMoney("楼" + TaoBaoUtil.getAfterUseCouplePrice(taoBaoGoodsBrief)); + vo.getMoneyInfo().setShareMoney("楼" + TaoBaoUtil.getAfterUseCouplePrice(taoBaoGoodsBrief)); + } + array.add(gson.toJson(vo)); } - + root.put("list", array); root.put("count", result.getCount()); out.print(JsonUtil.loadTrueResult(root)); } - - + /** * 浜笢閫氱敤涓撻妯℃澘 + * * @param acceptData * @param key * @param page @@ -172,16 +183,17 @@ data.put("bannerList", new Gson().toJson(bannerList)); } - JDSearchResult result = jdCommonTemplateContentService.getContentList(JDCommonContentTypeEnum.valueOf(key), cid, page, Constant.PAGE_SIZE); + JDSearchResult result = jdCommonTemplateContentService.getContentList(JDCommonContentTypeEnum.valueOf(key), cid, + page, Constant.PAGE_SIZE); JSONArray array = new JSONArray(); - + long count = 0; if (result != null) { PageEntity pageEntity = result.getPageEntity(); if (pageEntity != null) { count = pageEntity.getTotalCount(); } - + List<JDGoods> goodsList = result.getGoodsList(); if (goodsList != null && goodsList.size() > 0) { BigDecimal fanLiRate = hongBaoManageService.getFanLiRate(); @@ -193,15 +205,15 @@ } } } - + data.put("list", array); data.put("count", count); out.print(JsonUtil.loadTrueResult(data)); } - - + /** - * 鎷煎澶氶�氱敤涓撻妯℃澘 + * 鎷煎澶氶�氱敤涓撻妯℃澘 + * * @param acceptData * @param key * @param page @@ -211,16 +223,26 @@ public void getListPDD(AcceptData acceptData, String key, Integer page, String cid, PrintWriter out) { JSONObject data = new JSONObject(); if (page == 1) { - List<SwiperPicture> bannerList = new ArrayList<>(); + // 2銆侀《閮ㄨ疆鎾浘 + List<SwiperPicture> bannerList = null; + if (Constant.IS_TEST) { + bannerList = swiperPictureService.getByBannerCard("index_top"); + } + + if (bannerList == null) { + bannerList = new ArrayList<SwiperPicture>(); + } + data.put("bannerList", new Gson().toJson(bannerList)); } - - PDDGoodsResult result = pddCommonTemplateContentService.getContentList(PDDCommonContentTypeEnum.valueOf(key), cid, page, Constant.PAGE_SIZE); + + PDDGoodsResult result = pddCommonTemplateContentService.getContentList(PDDCommonContentTypeEnum.valueOf(key), + cid, page, Constant.PAGE_SIZE); JSONArray array = new JSONArray(); long count = 0; if (result != null) { count = result.getTotalCount(); - + List<PDDGoodsDetail> goodsList = result.getGoodsList(); if (goodsList != null && goodsList.size() > 0) { BigDecimal fanLiRate = hongBaoManageService.getFanLiRate(); @@ -232,7 +254,7 @@ } } } - + data.put("list", array); data.put("count", count); out.print(JsonUtil.loadTrueResult(data)); -- Gitblit v1.8.0