| | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.GsonBuilder; |
| | | import com.yeshi.fanli.dto.GoodsMoneyConfigParamsDTO; |
| | | import com.yeshi.fanli.dto.common.CommonContentResult; |
| | | import com.yeshi.fanli.dto.common.CommonContentTypeEnum; |
| | | import com.yeshi.fanli.entity.SystemEnum; |
| | | import com.yeshi.fanli.lijin.manager.GoodsLijinMnager; |
| | | import com.yeshi.fanli.service.inter.goods.CommonTemplateContentService; |
| | | import com.yeshi.goods.facade.dto.taobao.dataoke.DingDongTime; |
| | | import com.yeshi.fanli.dto.jd.JDSearchResult; |
| | | import com.yeshi.fanli.dto.pdd.PDDGoodsDetail; |
| | |
| | | @Resource |
| | | private GoodsLijinMnager goodsLijinMnager; |
| | | |
| | | @Resource |
| | | private CommonTemplateContentService commonTemplateContentService; |
| | | |
| | | /** |
| | | * 新版推荐专题管理(1.5.3) |
| | | * |
| | |
| | | |
| | | if (VersionUtil.greaterThan_2_0(acceptData.getPlatform(), acceptData.getVersion())) |
| | | root.put("searchDiscovery", getSearchDiscoveryInfo(acceptData)); |
| | | |
| | | |
| | | out.print(JsonUtil.loadTrueResult(root)); |
| | | } catch (Exception e) { |
| | | out.print(JsonUtil.loadFalseResult(1, "获取数据失败")); |
| | | try { |
| | | LogHelper.errorDetailInfo(e); |
| | | } catch (Exception e1) { |
| | | e1.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 特价推荐 |
| | | * |
| | | * @param acceptData |
| | | * @param uid |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "getRecommendIndexTJ") |
| | | public void getRecommendIndexTJ(AcceptData acceptData, Long uid, PrintWriter out) { |
| | | try { |
| | | // 获取设备定义性别 |
| | | int deviceSex = deviceSexService.getDeviceSex(acceptData.getDevice(), acceptData.getSystem()); |
| | | |
| | | // 1、专题模块 |
| | | JSONObject root = specialService.listCacheSpecialToIndex(acceptData, deviceSex, acceptData.getSystem()); |
| | | |
| | | // 2、顶部轮播图 |
| | | List<BannerVO> oldtopPicList = swiperPictureService.getByBannerCardAndVersion("index_top", |
| | | acceptData.getPlatform(), Integer.parseInt(acceptData.getVersion()), acceptData.getSystem()); |
| | | |
| | | List<BannerVO> topPicList = new ArrayList<>(); |
| | | if (oldtopPicList != null && oldtopPicList.size() > 0) |
| | | topPicList.addAll(oldtopPicList); |
| | | |
| | | root.put("topPicList", JsonUtil.getApiCommonGson().toJson(topPicList)); |
| | | |
| | | // 3、邀请有奖 |
| | | List<BannerVO> invitePicList = null; |
| | | if ("ios".equalsIgnoreCase(acceptData.getPlatform()) |
| | | && configService.iosOnLining(Integer.parseInt(acceptData.getVersion()), acceptData.getSystem())) { |
| | | // 如果IOS当前版本处于审核状态就不返回 |
| | | } else { |
| | | invitePicList = swiperPictureService.getByBannerCardAndVersion("index_invite", acceptData.getPlatform(), |
| | | Integer.parseInt(acceptData.getVersion()), acceptData.getSystem()); |
| | | } |
| | | |
| | | if (invitePicList == null) { |
| | | invitePicList = new ArrayList<BannerVO>(); |
| | | } |
| | | root.put("invitePicList", JsonUtil.getApiCommonGson().toJson(invitePicList)); |
| | | |
| | | // 4、IOS的底部网页链接 |
| | | String platform = acceptData.getPlatform(); |
| | | if ("ios".equalsIgnoreCase(platform)) { |
| | | root.put("htmlLink", configService.getValue(ConfigKeyEnum.indexHtmlLinkIos.getKey(), acceptData.getSystem())); |
| | | } |
| | | |
| | | 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(acceptData.getPlatform(), acceptData.getVersion())) |
| | | root.put("searchDiscovery", getSearchDiscoveryInfo(acceptData)); |
| | | |
| | | |
| | | //今日爆款 |
| | | CommonContentResult commonContentResult = commonTemplateContentService.getContentList(CommonContentTypeEnum.pddHotGoodsRank, null, 1, 10, acceptData.getSystem()); |
| | | if (commonContentResult != null && commonContentResult.getGoodsList() != null && commonContentResult.getGoodsList().size() > 0) { |
| | | com.alibaba.fastjson.JSONObject hotSale = new com.alibaba.fastjson.JSONObject(); |
| | | JumpDetailV2 jumpDetailV2 = new JumpDetailV2(); |
| | | jumpDetailV2.setActivity("com.tejia.lijin.app.ui.sellwellcommodity.SellWellGoods"); |
| | | |
| | | hotSale.put("jumpDetail", jumpDetailV2); |
| | | com.alibaba.fastjson.JSONObject params = new com.alibaba.fastjson.JSONObject(); |
| | | String navs = "[{\"key\":\"pddHotGoodsRank\",\"title\":\"拼多多\"},{\"key\":\"jdHotGoodsRank\",\"title\":\"京东\"},{\"key\":\"tbHotGoodsRank\",\"title\":\"淘宝\"}]"; |
| | | params.put("navs", navs.replace("\"","\\"+"\"")); |
| | | hotSale.put("params", params); |
| | | |
| | | Collections.shuffle(commonContentResult.getGoodsList()); |
| | | |
| | | //获取goodsList |
| | | GoodsMoneyConfigParamsDTO configParamsDTO = orderHongBaoMoneyComputeService.getShowComputeRate(acceptData.getPlatform(), |
| | | acceptData.getVersion(), acceptData.getSystem()); |
| | | List<GoodsDetailVO> goodsList = goodsLijinMnager.loadCommonGoodsMoneyInfo(acceptData.getSystem(), uid, commonContentResult.getGoodsList(), configParamsDTO); |
| | | JSONArray array = new JSONArray(); |
| | | Gson gson = new Gson(); |
| | | for (GoodsDetailVO vo : goodsList) { |
| | | array.add(gson.toJson(vo)); |
| | | } |
| | | hotSale.put("goodsList", array); |
| | | root.put("hotSales", hotSale); |
| | | } |
| | | |
| | | |
| | | out.print(JsonUtil.loadTrueResult(root)); |
| | | } catch (Exception e) { |
| | |
| | | |
| | | JumpDetailV2 jumpDetail = null; |
| | | if (VersionUtil.greaterThan_2_0_2(acceptData.getPlatform(), acceptData.getVersion())) { |
| | | jumpDetail = jumpDetailV2Service.getByTypeCache("spike_goods_list"); |
| | | jumpDetail = jumpDetailV2Service.getByTypeCache("spike_goods_list",acceptData.getSystem()); |
| | | } else { |
| | | jumpDetail = jumpDetailV2Service.getByTypeCache("web"); |
| | | jumpDetail = jumpDetailV2Service.getByTypeCache("web",acceptData.getSystem()); |
| | | } |
| | | |
| | | if (array == null) { |
| | |
| | | * @param out |
| | | */ |
| | | @RequestMapping("getSpikeGoodsList") |
| | | public void getSpikeGoodsList(AcceptData acceptData, Integer page, Long goodsId, String qtime, PrintWriter out) { |
| | | public void getSpikeGoodsList(AcceptData acceptData, Integer page, String goodsId, String qtime, PrintWriter out) { |
| | | List<DaTaoKeDetailV2> detailList0 = daTaoKeGoodsDetailV2Service.getDingDongQiangData(qtime); |
| | | if (detailList0 == null) |
| | | detailList0 = new ArrayList<>(); |
| | |
| | | JSONArray array = new JSONArray(); |
| | | if (page == 1 && goodsId != null && detailList != null) { |
| | | for (int i = 0; i < detailList.size(); i++) { |
| | | if (detailList.get(i).getGoodsId().longValue() == goodsId) { |
| | | if ( TaoBaoUtil.isEqual( detailList.get(i).getGoodsId(), goodsId)) { |
| | | DaTaoKeDetailV2 goods = detailList.get(i); |
| | | detailList.remove(i); |
| | | detailList.add(0, goods); |
| | |
| | | params.put("balanceMore", true); |
| | | root.put("params", params); |
| | | root.put("jumpDetail", jumpDetailV2Service.getByTypeCache("integralExchange", |
| | | Constant.getPlatformCode(acceptData.getPlatform()), Integer.parseInt(acceptData.getVersion()))); |
| | | Constant.getPlatformCode(acceptData.getPlatform()), Integer.parseInt(acceptData.getVersion()),acceptData.getSystem())); |
| | | |
| | | root.put("name", "金币兑换"); |
| | | root.put("desc", "每日签到,惊喜不停"); |
| | |
| | | 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()))); |
| | | Constant.getPlatformCode(acceptData.getPlatform()), Integer.parseInt(acceptData.getVersion()),acceptData.getSystem())); |
| | | |
| | | root.put("jumpResult", jumpDetailV2Service.getByTypeCache("search_goods_result", |
| | | Constant.getPlatformCode(acceptData.getPlatform()), Integer.parseInt(acceptData.getVersion()))); |
| | | Constant.getPlatformCode(acceptData.getPlatform()), Integer.parseInt(acceptData.getVersion()),acceptData.getSystem())); |
| | | root.put("keyList", array); |
| | | return root; |
| | | } |
| | |
| | | public void taoBaoGuessUserLikeByDevice(AcceptData acceptData, Long uid, int page, HttpServletRequest request, |
| | | PrintWriter out) { |
| | | int pageSize = Constant.PAGE_SIZE; |
| | | JSONArray array = new JSONArray(); |
| | | |
| | | Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder()).create(); |
| | | |
| | | String idfa = acceptData.getIdfa(); |
| | |
| | | acceptData.getVersion(), acceptData.getSystem()); |
| | | |
| | | |
| | | List<GoodsDetailVO> voList = goodsLijinMnager.loadTBMoneyInfo(acceptData.getSystem(), uid, goodsList, paramsDTO); |
| | | List<GoodsDetailVO> voList = goodsLijinMnager.loadTBMoneyInfo(acceptData.getSystem(), uid, goodsList, paramsDTO,false); |
| | | |
| | | for (GoodsDetailVO vo : voList) { |
| | | if (page < 3) |
| | | vo.setRecommend(true); |
| | | try { |
| | | array.add(gson.toJson(vo)); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | if (page == 1) { |
| | |
| | | detailVO.setOtherInfo(otherInfo); |
| | | detailVO.setPictureTag(new ClientTextStyleVO("立减TOP" + (i + 1), "#E5005C", "#FCE431", null)); |
| | | detailVO.setRecommend(true); |
| | | array.add(0, gson.toJson(detailVO)); |
| | | voList.add(0, detailVO); |
| | | } |
| | | } |
| | | } |
| | | |
| | | JSONArray array = new JSONArray(); |
| | | for (GoodsDetailVO vo : voList) { |
| | | if (acceptData.getSystem() == SystemEnum.yhqjx||acceptData.getSystem() == SystemEnum.hsb) { |
| | | //暂时不筛选红包 |
| | | // if (!StringUtil.isNullOrEmpty(vo.getMoneyInfo().getHongBaoMoney())) { |
| | | array.add(gson.toJson(vo)); |
| | | // } |
| | | } else { |
| | | array.add(gson.toJson(vo)); |
| | | } |
| | | } |
| | | JSONObject data = new JSONObject(); |
| | | data.put("list", array); |
| | | data.put("count", 1000); |
| | |
| | | } |
| | | |
| | | // 从推荐来 |
| | | List<GoodsDetailVO> finalVOList = new ArrayList<>(); |
| | | if (page <= 1) { |
| | | array.clear(); |
| | | if (!StringUtil.isNullOrEmpty(imei) || !StringUtil.isNullOrEmpty(idfa)) { |
| | | long startTime = java.lang.System.currentTimeMillis(); |
| | | |
| | |
| | | deviceGoodsList.add(goods); |
| | | } |
| | | } |
| | | List<GoodsDetailVO> voList = goodsLijinMnager.loadTBMoneyInfo(acceptData.getSystem(), uid, deviceGoodsList, paramsDTO); |
| | | List<GoodsDetailVO> voList = goodsLijinMnager.loadTBMoneyInfo(acceptData.getSystem(), uid, deviceGoodsList, paramsDTO,false); |
| | | for (GoodsDetailVO vo : voList) { |
| | | vo.setRecommend(true); |
| | | } |
| | |
| | | |
| | | Collections.shuffle(goodsList); |
| | | goodsList = goodsList.size() > 20 ? goodsList.subList(0, 20) : goodsList; |
| | | for (GoodsDetailVO goods : goodsList) { |
| | | array.add(gson.toJson(goods)); |
| | | } |
| | | finalVOList.addAll(goodsList); |
| | | } else { |
| | | try { |
| | | monitorService.addClientAPIMonitor(MonitorFactory.createClientAPI(request, 0, |
| | |
| | | } |
| | | } |
| | | } |
| | | JSONArray localArray = qualityGoodsService.getRecommendToIndexV2((page - 1) * pageSize, pageSize, acceptData.getPlatform(), acceptData.getVersion(), acceptData.getSystem()); |
| | | array.addAll(localArray); |
| | | List<GoodsDetailVO> voList = qualityGoodsService.getRecommendToIndexV2((page - 1) * pageSize, pageSize, acceptData.getPlatform(), acceptData.getVersion(), acceptData.getSystem()); |
| | | if (voList != null) |
| | | finalVOList.addAll(voList); |
| | | |
| | | } else {// 从精选库来 |
| | | array = qualityGoodsService.getRecommendToIndexV2((page - 1) * pageSize, pageSize, acceptData.getPlatform(), acceptData.getVersion(), acceptData.getSystem()); |
| | | if (array == null) { |
| | | List<GoodsDetailVO> voList = qualityGoodsService.getRecommendToIndexV2((page - 1) * pageSize, pageSize, acceptData.getPlatform(), acceptData.getVersion(), acceptData.getSystem()); |
| | | if (voList == null || voList.size() == 0) { |
| | | out.print(JsonUtil.loadFalseResult("没有更多了")); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | JSONArray array = new JSONArray(); |
| | | for (GoodsDetailVO vo : finalVOList) { |
| | | if (acceptData.getSystem() == SystemEnum.yhqjx||acceptData.getSystem() == SystemEnum.hsb) { |
| | | if (!StringUtil.isNullOrEmpty(vo.getMoneyInfo().getHongBaoMoney())) { |
| | | array.add(gson.toJson(vo)); |
| | | } |
| | | } else { |
| | | array.add(gson.toJson(vo)); |
| | | } |
| | | } |
| | | |
| | | JSONObject data = new JSONObject(); |
| | | data.put("list", array); |
| | | data.put("count", 1000); |