| | |
| | | import com.yeshi.fanli.service.inter.goods.SuperRecommendSpecialService;
|
| | | import com.yeshi.fanli.service.inter.goods.TaoBaoCouponService;
|
| | | import com.yeshi.fanli.service.inter.goods.TaoBaoGoodsBriefService;
|
| | | import com.yeshi.fanli.service.inter.goods.recommend.RecommendGoodsDeleteHistoryService;
|
| | | import com.yeshi.fanli.service.inter.homemodule.SpecialService;
|
| | | import com.yeshi.fanli.service.inter.homemodule.SuperSpecialService;
|
| | | import com.yeshi.fanli.service.inter.homemodule.SwiperPictureService;
|
| | |
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoGoodsUpdateService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoShopService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoUnionConfigService;
|
| | | import com.yeshi.fanli.service.inter.taobao.dataoke.DaTaoKeGoodsDetailService;
|
| | | import com.yeshi.fanli.service.inter.user.ShamUserService;
|
| | | import com.yeshi.fanli.service.inter.user.TBPidService;
|
| | | import com.yeshi.fanli.service.inter.user.UserCustomSettingsService;
|
| | |
| | | import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TaoBaoConstant;
|
| | | import com.yeshi.fanli.util.ThreadUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.util.VersionUtil;
|
| | | import com.yeshi.fanli.util.cache.TaoBaoGoodsCacheUtil;
|
| | | import com.yeshi.fanli.util.factory.MonitorFactory;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoCouponUtil;
|
| | |
| | |
|
| | | @Resource
|
| | | private TaoBaoShopService taoBaoShopService;
|
| | |
|
| | | @Resource
|
| | | private DaTaoKeGoodsDetailService daTaoKeGoodsDetailService;
|
| | |
|
| | | @Resource
|
| | | private RecommendGoodsDeleteHistoryService recommendGoodsDeleteHistoryService;
|
| | |
|
| | | @RequestMapping(value = "getHonestList")
|
| | | public void getHonestList(AcceptData acceptData, PrintWriter out) {
|
| | |
| | |
|
| | | if (result != null && result.getTaoBaoGoodsBriefs() != null) {
|
| | | // 筛选
|
| | | List<TaoBaoGoodsBrief> goodsList = new ArrayList<>();
|
| | | List<TaoBaoGoodsBriefExtra> goodsList = new ArrayList<>();
|
| | |
|
| | | for (TaoBaoGoodsBrief goods : result.getTaoBaoGoodsBriefs()) {
|
| | | if (!StringUtil.isNullOrEmpty(goods.getCouponInfo()) && goods.getCouponAmount() != null
|
| | | && goods.getCouponAmount().compareTo(new BigDecimal("5")) >= 0
|
| | | && goods.getBiz30day() > 1000 && !StringUtil.isNullOrEmpty(goods.getPictUrlWhite()))
|
| | | goodsList.add(goods);
|
| | | }
|
| | | List<TaoBaoGoodsBrief> gList = recommendGoodsDeleteHistoryService
|
| | | .filterGoods(acceptData.getDevice(), result.getTaoBaoGoodsBriefs());
|
| | | // 设备推荐
|
| | | if (gList != null)
|
| | | for (TaoBaoGoodsBrief goods : gList) {
|
| | | if (!StringUtil.isNullOrEmpty(goods.getCouponInfo()) && goods.getCouponAmount() != null
|
| | | && goods.getCouponAmount().compareTo(new BigDecimal("5")) >= 0
|
| | | && goods.getBiz30day() > 1000
|
| | | && !StringUtil.isNullOrEmpty(goods.getPictUrlWhite())) {
|
| | |
|
| | | TaoBaoGoodsBriefExtra extra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(goods,
|
| | | proportion.toString(), "");
|
| | | extra.setRecommend(true);
|
| | | goodsList.add(extra);
|
| | | }
|
| | | }
|
| | | try {
|
| | | monitorService.addClientAPIMonitor(MonitorFactory.createClientAPI(request, 0,
|
| | | (int) (java.lang.System.currentTimeMillis() - startTime), "推荐数量:" + goodsList.size()));
|
| | |
| | |
|
| | | Collections.shuffle(goodsList);
|
| | | goodsList = goodsList.size() > 20 ? goodsList.subList(0, 20) : goodsList;
|
| | | for (TaoBaoGoodsBrief goods : goodsList) {
|
| | | array.add(gson.toJson(TaoBaoUtil.getTaoBaoGoodsBriefExtra(goods, proportion.toString(), "")));
|
| | | for (TaoBaoGoodsBriefExtra goods : goodsList) {
|
| | | array.add(gson.toJson(goods));
|
| | | }
|
| | | } else {
|
| | | try {
|
| | |
| | | if ("ios".equalsIgnoreCase(platform)) {
|
| | | root.put("htmlLink", configService.get("index_html_link_ios"));
|
| | | }
|
| | | |
| | | root.put("spikeGoods", getSpikeGoodsContent(acceptData));
|
| | |
|
| | | root.put("spikeGoods", getSpikeGoodsContent(acceptData));
|
| | |
|
| | | out.print(JsonUtil.loadTrueResult(root));
|
| | | } catch (Exception e) {
|
| | |
| | | nextTime.set(Calendar.MILLISECOND, 0);
|
| | |
|
| | | JSONArray array = null;
|
| | | String timekey = "spikeGoods_hour";
|
| | | String cachekey = "spikeGoodsList";
|
| | | String timekey = String.format("spikeGoods_hour-%s-%s", acceptData.getPlatform(), acceptData.getVersion());
|
| | | String cachekey = String.format("spikeGoodsList-%s-%s", acceptData.getPlatform(), acceptData.getVersion());
|
| | |
|
| | | String timeValue = redisManager.getCommonString(timekey);
|
| | | if (timeValue == null || !timeValue.equals(hour + "")) {
|
| | |
| | | array = JSONArray.fromObject(cacheValue);
|
| | | }
|
| | | }
|
| | |
|
| | | JumpDetailV2 jumpDetail = jumpDetailV2Service.getByTypeCache("web");
|
| | | if (array == null) {
|
| | | array = new JSONArray();
|
| | |
|
| | |
| | | }
|
| | |
|
| | | /* 遍历列表数据 */
|
| | | for (QualityFactory qualityFactory : listGoods) {
|
| | |
|
| | | for (QualityFactory qualityFactory : listGoods) {
|
| | | TaoBaoGoodsBrief taoBaoGoodsBrief = qualityFactory.getTaoBaoGoodsBrief();
|
| | | if (taoBaoGoodsBrief == null) {
|
| | | continue;
|
| | | }
|
| | | array.add(gson
|
| | | JSONObject goods = new JSONObject();
|
| | | goods.put("goods", gson
|
| | | .toJson(TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion.toString(), null)));
|
| | | goods.put("jumpDetail", jumpDetail);
|
| | | JSONObject params = new JSONObject();
|
| | | params.put("url", configService.get("spike_goods_link") + "?id=" + taoBaoGoodsBrief.getAuctionId());
|
| | | goods.put("params", params);
|
| | |
|
| | | // 1.5.4及以后返回
|
| | | if (VersionUtil.greaterThan_1_5_40(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | | array.add(goods);
|
| | | } else {
|
| | | array.add(goods.optJSONObject("goods"));
|
| | | }
|
| | | }
|
| | |
|
| | | // 缓存半个小时
|
| | | redisManager.cacheCommonString(cachekey, array.toString(), 60 * 30);
|
| | | }
|
| | | Long endTime = nextTime.getTimeInMillis() - java.lang.System.currentTimeMillis();
|
| | | |
| | |
|
| | | JSONObject root = new JSONObject();
|
| | | root.put("time", nextTime.getTimeInMillis());
|
| | | root.put("endTime", endTime > 0? endTime : 0);
|
| | | root.put("endTime", endTime > 0 ? endTime : 0);
|
| | | root.put("listgoods", array);
|
| | | |
| | | |
| | |
|
| | | JSONObject params = new JSONObject();
|
| | | params.put("url", configService.get("spike_goods_link"));
|
| | | JumpDetailV2 jumpDetail = jumpDetailV2Service.getByTypeCache("web");
|
| | |
|
| | | root.put("params", params);
|
| | | root.put("jumpDetail", jumpDetail);
|
| | |
|
| | |
| | | if (!StringUtil.isNullOrEmpty(tb.getPictUrlWhite()))
|
| | | finalImgList.add(0, tb.getPictUrlWhite());
|
| | |
|
| | | // 大淘客商品过滤
|
| | | try {
|
| | | goods = daTaoKeGoodsDetailService.filterTaoBaoGoods(goods);
|
| | | } catch (Exception e) {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | | JSONObject goodsJson = new JSONObject();
|
| | | goodsJson.put("auctionId", tb.getAuctionId());
|
| | | goodsJson.put("imgList", finalImgList);
|
| | | goodsJson.put("title", tb.getTitle());
|
| | | goodsJson.put("userType", tb.getUserType() == 1 ? 2 : 1);
|
| | | goodsJson.put("price", tb.getReservePrice().toString());
|
| | | goodsJson.put("zkPrice", tb.getZkPrice().toString());
|
| | | goodsJson.put("zkPrice", MoneyBigDecimalUtil.getWithNoZera(tb.getZkPrice()).toString());
|
| | |
|
| | | |
| | | // 30天销量
|
| | | goodsJson.put("saleCount", TaoBaoUtil.getSaleCount(tb.getBiz30day()));
|
| | | goodsJson.put("salesCount", TaoBaoUtil.getSaleCount(tb.getBiz30day()));
|
| | | |
| | |
|
| | | // 分享赚
|
| | | BigDecimal shareMoney = taoBaoGoodsBriefService.getShareGoodsUserHongBao(tb);
|
| | | data.put("shareMoney", "¥" + shareMoney);
|
| | |
| | | String hongBao = null;
|
| | |
|
| | | // 获取券信息
|
| | | if (!StringUtil.isNullOrEmpty(tb.getCouponInfo())) {
|
| | | if (!StringUtil.isNullOrEmpty(tb.getCouponInfo()) && tb.getCouponAmount() != null
|
| | | && tb.getCouponAmount().compareTo(new BigDecimal(0)) > 0 && tb.getCouponEffectiveStartTime() != null
|
| | | && tb.getCouponEffectiveEndTime() != null) {
|
| | | BigDecimal quanPrice = TaoBaoUtil.getAfterUseCouplePrice(tb);
|
| | | JSONObject couponInfo = new JSONObject();
|
| | | couponInfo.put("couponPrice", quanPrice.toString());
|
| | | couponInfo.put("couponPrice", MoneyBigDecimalUtil.getWithNoZera(quanPrice).toString());
|
| | |
|
| | | if (from != null && from.equals("miandan")) {
|
| | | // 免单商品
|
| | |
| | | redisManager.saveCommonTaoToken(tb.getAuctionId(), token);
|
| | | }
|
| | | }
|
| | | tb.setCouponLinkTaoToken(token);
|
| | | // 测试
|
| | | if (!Constant.IS_TEST)
|
| | | tb.setCouponLinkTaoToken(token);
|
| | |
|
| | | // 服务端转链
|
| | | // if (convertInServer &&
|
| | |
| | | // tb.getAuctionId() + ""));
|
| | | // }
|
| | |
|
| | | couponInfo.put("couponAmount", NumberUtil.subZeroAndDot(tb.getCouponAmount().toString()));
|
| | | couponInfo.put("couponAmount", MoneyBigDecimalUtil.getWithNoZera(tb.getCouponAmount()).toString());
|
| | | couponInfo.put("couponTime", "使用期限:" + tb.getCouponEffectiveStartTime().replace("-", ".") + "-"
|
| | | + tb.getCouponEffectiveEndTime().replace("-", "."));
|
| | | // 券的口令
|
| | | couponInfo.put("couponToken", token);
|
| | |
|
| | | // 测试
|
| | | if (!Constant.IS_TEST)
|
| | | couponInfo.put("couponToken", token);
|
| | | goodsJson.put("couponInfo", couponInfo);
|
| | |
|
| | | if (tb.getBiz30day() >= 1000) {
|
| | |
| | | } else {
|
| | | tbShopInfo.setUserType("0");
|
| | | }
|
| | | |
| | |
|
| | | String shopLink = tbShopInfo.getShopUrl();
|
| | | if (StringUtil.isNullOrEmpty(shopLink)) {
|
| | | tbShopInfo.setShopUrl(TaoBaoUtil.getShopLink(tbShopInfo.getUserId()));
|
| | | }
|
| | | }
|
| | | |
| | | // 店铺
|
| | | if (("android".equalsIgnoreCase(acceptData.getPlatform()) && Integer.parseInt(acceptData.getVersion()) >= 40)
|
| | | || ("ios".equalsIgnoreCase(acceptData.getPlatform())
|
| | | && Integer.parseInt(acceptData.getVersion()) >= 49)) {
|
| | |
|
| | | // 店铺1.5.4及以后版本
|
| | | if (VersionUtil.greaterThan_1_5_40(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | | TaoBaoShop shop = taoBaoShopService.getTaoBaoShop(goods.getAuctionId(), goods.getSellerId());
|
| | | if (shop != null) {
|
| | | String shopLink = shop.getShopLink();
|
| | |
| | | goodsJson.put("shopInfo", tbShopInfo);
|
| | | }
|
| | |
|
| | | goodsJson.put("fanliValid",true);// 是否有返利
|
| | | goodsJson.put("fanliValid", true);// 是否有返利
|
| | |
|
| | | // 分享路径
|
| | | String shareUrl = String.format("%s?id=" + tb.getAuctionId(), Constant.systemCommonConfig.getAppShareInfoUrl());
|
| | |
| | | data.put("shareUsers", listShareUser);
|
| | | data.put("couponUsers", listCouponUser);
|
| | | data.put("detailWebUrl", "http://apph5.yeshitv.com/apppage/goods_img.html?id=" + id);
|
| | | |
| | |
|
| | | data.put("noRebateHelpLink", configService.get("no_rebate_help_link"));
|
| | | |
| | |
|
| | | // 商品链接
|
| | | String h5Url = String.format("http://%s%s?id=%s&appType=flq", configService.getH5Host(),
|
| | | Constant.systemCommonConfig.getShareGoodsPagePath(), tb.getAuctionId() + "");
|
| | |
| | | e1.printStackTrace();
|
| | | }
|
| | |
|
| | | if (goodsList != null)
|
| | | if (goodsList != null && goodsList.size() > 0)
|
| | | goodsList.parallelStream().forEach(goods -> {
|
| | |
|
| | | // 获取详情
|