From 61c21f17b1ad94e4b0018c7e385195bab21b0b5c Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期一, 09 九月 2019 19:00:03 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/div' into div --- fanli/src/main/java/com/yeshi/fanli/controller/client/v2/RecommendControllerV2.java | 185 ++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 168 insertions(+), 17 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/RecommendControllerV2.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/RecommendControllerV2.java index 93cc6d1..c40c2ac 100644 --- a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/RecommendControllerV2.java +++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/RecommendControllerV2.java @@ -12,6 +12,7 @@ import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; import org.yeshi.utils.JsonUtil; import com.google.gson.Gson; @@ -44,6 +45,7 @@ import com.yeshi.fanli.service.inter.taobao.TaoBaoGoodsUpdateService; import com.yeshi.fanli.service.inter.taobao.dataoke.DaTaoKeGoodsDetailService; import com.yeshi.fanli.service.inter.taobao.dataoke.DaTaoKeGoodsDetailV2Service; +import com.yeshi.fanli.service.inter.taobao.dataoke.DaTaoKeGoodsService; import com.yeshi.fanli.tag.PageEntity; import com.yeshi.fanli.util.Constant; import com.yeshi.fanli.util.RedisManager; @@ -59,6 +61,8 @@ import com.yeshi.fanli.vo.goods.GoodsDetailVO; import com.yeshi.fanli.vo.goods.OtherInfo; import com.yeshi.fanli.vo.msg.ClientTextStyleVO; +import com.yeshi.fanli.vo.search.SearchKeyTOPVO; +import com.yeshi.fanli.vo.search.SearchKeyVO; import com.yeshi.fanli.vo.tlj.ReduceHongBao; import net.sf.json.JSONArray; @@ -118,6 +122,9 @@ @Resource private DaTaoKeGoodsDetailV2Service daTaoKeGoodsDetailV2Service; + + @Resource + private DaTaoKeGoodsService daTaoKeGoodsService; /** * 鏂扮増鎺ㄨ崘涓撻绠$悊(1.5.3) @@ -139,11 +146,6 @@ List<SwiperPicture> topPicList = new ArrayList<>(); if (oldtopPicList != null && oldtopPicList.size() > 0) topPicList.addAll(oldtopPicList); - if ("ios".equalsIgnoreCase(acceptData.getPlatform())) { - SwiperPicture notifyReName = swiperPictureService.selectByPrimaryKey(162L); - if (notifyReName != null) - topPicList.add(0, notifyReName); - } root.put("topPicList", JsonUtil.getApiCommonGson().toJson(topPicList)); @@ -168,7 +170,12 @@ } root.put("spikeGoods", getSpikeGoodsContent(acceptData)); - + if (VersionUtil.greaterThan_1_6_5(acceptData.getPlatform(), acceptData.getVersion())) + root.put("scoreExchange", getScoreExchangeInfo(acceptData)); + + if (VersionUtil.greaterThan_2_0_0(acceptData.getPlatform(), acceptData.getVersion())) + root.put("searchDiscovery", getSearchDiscoveryInfo(acceptData)); + out.print(JsonUtil.loadTrueResult(root)); } catch (Exception e) { out.print(JsonUtil.loadFalseResult(1, "鑾峰彇鏁版嵁澶辫触")); @@ -193,23 +200,25 @@ } private JSONObject getSpikeGoodsContent(AcceptData acceptData) { - List<String> dtoList = DaTaoKeUtil.getDingDongQiangTime(); + List<String> dtoList = DaTaoKeUtil.getDingDongQiangTime(); long nowTime = System.currentTimeMillis(); int dateNum = Integer.parseInt(TimeUtil.getGernalTime(nowTime, "ddHH")); String timeStr = null; int nextPos = 0; - for (int i = 0; i < dtoList.size(); i++) { - if (dateNum <= Integer.parseInt(dtoList.get(i))) { + for (int i = 0; i < dtoList.size() - 1; i++) { + if (dateNum >= Integer.parseInt(dtoList.get(i)) && dateNum < Integer.parseInt(dtoList.get(i + 1))) { timeStr = dtoList.get(i); nextPos = i + 1; break; } } + if (timeStr == null) + timeStr = dtoList.get(dtoList.size() - 1); long nextTime = nowTime + 1000 * 60 * 60L;// 榛樿涓�1灏忔椂 if (nextPos < dtoList.size()) { - nextTime = TimeUtil.convertToTimeTemp(TimeUtil.getGernalTime(nowTime, "MM") + dtoList.get(nextPos), - "MMddHH"); + nextTime = TimeUtil.convertToTimeTemp(TimeUtil.getGernalTime(nowTime, "yyyyMM") + dtoList.get(nextPos), + "yyyyMMddHH"); } JSONArray array = null; @@ -283,18 +292,103 @@ Long endTime = nextTime - nowTime; JSONObject root = new JSONObject(); + + if (VersionUtil.greaterThan_1_6_5(acceptData.getPlatform(), acceptData.getVersion())) { + root.put("time", nextTime); + root.put("endTime", endTime > 0 ? endTime : 0); + JSONArray imgArray = new JSONArray(); + if (array != null) + for (int i = 0; i < array.size(); i++) { + imgArray.add(array.optJSONObject(i).optJSONObject("goods").optString("picUrl")); + } + root.put("imgList", imgArray); + JSONObject params = new JSONObject(); + params.put("url", configService.get("spike_goods_link")); + root.put("params", params); + root.put("jumpDetail", jumpDetail); + root.put("name", "闄愭椂绉掓潃"); + root.put("desc", "鏁寸偣鏇存柊锛屽ソ鐗╂姠璐�"); + } else { + root.put("time", nextTime); + root.put("endTime", endTime > 0 ? endTime : 0); + root.put("listgoods", array); + JSONObject params = new JSONObject(); + params.put("url", configService.get("spike_goods_link")); + root.put("params", params); + root.put("jumpDetail", jumpDetail); + } + root.put("time", nextTime); root.put("endTime", endTime > 0 ? endTime : 0); root.put("listgoods", array); - JSONObject params = new JSONObject(); - params.put("url", configService.get("spike_goods_link")); - - root.put("params", params); - root.put("jumpDetail", jumpDetail); - return root; } + + /** + * 閲戝竵鍏戞崲淇℃伅 + * + * @param acceptData + * @return + */ + private JSONObject getScoreExchangeInfo(AcceptData acceptData) { + + JSONObject root = new JSONObject(); + JSONArray array = new JSONArray(); + array.add("http://img.flqapp.com/resource/integral/integral_home_icon_2.png"); + array.add("http://img.flqapp.com/resource/integral/integral_home_icon_1.png"); + root.put("imgList", array); + JSONObject params = new JSONObject(); + params.put("balanceMore", true); + root.put("params", params); + root.put("jumpDetail", jumpDetailV2Service.getByTypeCache("integralExchange", + Constant.getPlatformCode(acceptData.getPlatform()), Integer.parseInt(acceptData.getVersion()))); + + root.put("name", "閲戝竵鍏戞崲"); + root.put("desc", "姣忔棩绛惧埌锛屾儕鍠滀笉鍋�"); + root.put("tagImg", "http://img.flqapp.com/resource/score_exchange_tag.png"); + return root; + } + + + /** + * 閲戝竵鍏戞崲淇℃伅 + * + * @param acceptData + * @return + */ + private JSONObject getSearchDiscoveryInfo(AcceptData acceptData) { + JSONArray array = new JSONArray(); + String keys = configService.getSearchDiscoveryKeys(); + if (!StringUtil.isNullOrEmpty(keys)) { + JSONArray arrayKeys = JSONArray.fromObject(keys); + for (int i = 0; i < arrayKeys.size(); i++) { + String name = arrayKeys.get(i).toString(); + JSONObject params = new JSONObject(); + params.put("searchKey", name); + + SearchKeyVO keyVO = new SearchKeyVO(); + keyVO.setName(name); + keyVO.setParams(params.toString()); + array.add(keyVO); + } + } + + JSONObject params = new JSONObject(); + params.put("url", configService.get("search_discovery_h5_link")); + + JSONObject root = new JSONObject(); + root.put("picture", "http://img.flqapp.com/resource/home_search_found.png"); + root.put("params", params); + root.put("jumpDetail", jumpDetailV2Service.getByTypeCache("web", + Constant.getPlatformCode(acceptData.getPlatform()), Integer.parseInt(acceptData.getVersion()))); + + root.put("jumpResult", jumpDetailV2Service.getByTypeCache("search_goods_result", + Constant.getPlatformCode(acceptData.getPlatform()), Integer.parseInt(acceptData.getVersion()))); + root.put("keyList", array); + return root; + } + /** * 棣栭〉搴曢儴鍟嗗搧鎺ㄨ崘 @@ -559,4 +653,61 @@ out.print(JsonUtil.loadTrueResult(data)); } + + /** + * 鎼滅储鍙戠幇鍒楄〃 + * @param acceptData + * @param uid + * @param page + * @param out + */ + @RequestMapping(value = "getSearchDiscoveryTop", method = RequestMethod.POST) + public void getSearchDiscoveryTop(AcceptData acceptData, Long uid, Integer page, PrintWriter out) { + int count = 0; + List<SearchKeyTOPVO> list = new ArrayList<SearchKeyTOPVO>(); + + String keys = configService.getSearchDiscoveryKeys(); + if (!StringUtil.isNullOrEmpty(keys)) { + JSONArray arrayKeys = JSONArray.fromObject(keys); + if (arrayKeys != null && arrayKeys.size() > 0) { + count = arrayKeys.size(); + BigDecimal fanLiRate = hongBaoManageService.getFanLiRate(); + BigDecimal shareRate = hongBaoManageService.getShareRate(); + + int j = 1; + for (int i = (page-1) * 3; i < arrayKeys.size(); i++) { + if (j > 3) + break; + + String words = arrayKeys.get(i).toString(); + List<GoodsDetailVO> listGoods = new ArrayList<GoodsDetailVO>(); + + List<DaTaoKeDetailV2> listTaoKe = daTaoKeGoodsService.getSearchDiscoveryGoods(words); + if (listTaoKe != null && listTaoKe.size() > 0) { + for (DaTaoKeDetailV2 daTaoKeDetailV2: listTaoKe) { + listGoods.add(GoodsDetailVOFactory.convertTaoBao(TaoBaoUtil.convert(daTaoKeDetailV2), null, fanLiRate, + shareRate)); + if (listGoods.size() >= 3) + break; + } + } + + SearchKeyTOPVO keyTOPVO = new SearchKeyTOPVO(); + keyTOPVO.setName(words); + keyTOPVO.setListGoods(listGoods); + list.add(keyTOPVO); + + j++; + } + } + } + + GsonBuilder gsonBuilder = new GsonBuilder().excludeFieldsWithoutExposeAnnotation(); + Gson gson = gsonBuilder.create(); + JSONObject data = new JSONObject(); + data.put("count", count); + data.put("list", gson.toJson(list)); + out.print(JsonUtil.loadTrueResult(data)); + } + } -- Gitblit v1.8.0