| | |
| | | import com.yeshi.fanli.entity.taobao.ClientTBPid;
|
| | | import com.yeshi.fanli.entity.taobao.PidUser;
|
| | | import com.yeshi.fanli.entity.taobao.SearchFilter;
|
| | | import com.yeshi.fanli.entity.taobao.TLJBuyGoods;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBriefExtra;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoSearchResult;
|
| | |
| | | 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.HomeRecommendGoodsService;
|
| | | import com.yeshi.fanli.service.inter.goods.recommend.RecommendGoodsDeleteHistoryService;
|
| | | import com.yeshi.fanli.service.inter.homemodule.DeviceSexService;
|
| | | import com.yeshi.fanli.service.inter.homemodule.SpecialService;
|
| | |
| | | import com.yeshi.fanli.service.inter.hongbao.HongBaoManageService;
|
| | | import com.yeshi.fanli.service.inter.lable.QualityFlashSaleService;
|
| | | import com.yeshi.fanli.service.inter.lable.QualityGoodsService;
|
| | | import com.yeshi.fanli.service.inter.money.UserMoneyExtraService;
|
| | | import com.yeshi.fanli.service.inter.monitor.MonitorService;
|
| | | import com.yeshi.fanli.service.inter.order.OrderService;
|
| | | import com.yeshi.fanli.service.inter.order.ShareGoodsActivityOrderService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TLJBuyGoodsService;
|
| | | 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.user.UserGoodsStorageService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoService;
|
| | | import com.yeshi.fanli.service.inter.user.UserMoneyExtraService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | |
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoLiJinUtil;
|
| | | import com.yeshi.fanli.vo.goods.taobao.TLJBuyHongBaoVO;
|
| | | import com.yeshi.fanli.vo.msg.ClientTextStyleVO;
|
| | | import com.yeshi.fanli.vo.tlj.SpreadHongBao;
|
| | | import com.yeshi.fanli.vo.user.UserSettingsVO;
|
| | |
| | |
|
| | | @Resource
|
| | | private RecommendGoodsDeleteHistoryService recommendGoodsDeleteHistoryService;
|
| | |
|
| | | @Resource
|
| | | private HomeRecommendGoodsService homeRecommendGoodsService;
|
| | |
|
| | | @Resource
|
| | | private TLJBuyGoodsService tljBuyGoodsService;
|
| | |
|
| | | @RequestMapping(value = "getHonestList")
|
| | | public void getHonestList(AcceptData acceptData, PrintWriter out) {
|
| | |
| | |
|
| | | // 获取浏览记录
|
| | | @RequestMapping(value = "getscanhistory", method = RequestMethod.POST)
|
| | | public void getScanHistory(AcceptData acceptData, String uid, int page, Integer goodsType, PrintWriter out) {
|
| | | public void getScanHistory(AcceptData acceptData, String uid, int page, PrintWriter out) {
|
| | |
|
| | | if (page < 0) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "page不小于0"));
|
| | | return;
|
| | |
| | | out.print(JsonUtil.loadFalseResult(1, "不存在该系统"));
|
| | | return;
|
| | | }
|
| | | |
| | | List<ScanHistoryV2> list = scanHistoryV2Service.getScanHistoryByDeviceOrUid(
|
| | | StringUtil.isNullOrEmpty(uid) ? null : Long.parseLong(uid), acceptData.getDevice(), page, 20, goodsType);
|
| | | |
| | | long count = scanHistoryV2Service.getCountByDeviceOrUid(
|
| | | StringUtil.isNullOrEmpty(uid) ? null : Long.parseLong(uid), acceptData.getDevice(), goodsType);
|
| | | |
| | | JSONObject data = new JSONObject();
|
| | | data.put("count", count);
|
| | | JSONArray array = new JSONArray();
|
| | | try {
|
| | |
|
| | | GsonBuilder gsonBuilder = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder());
|
| | | gsonBuilder.excludeFieldsWithoutExposeAnnotation();
|
| | | gsonBuilder.registerTypeAdapter(Date.class, new JsonSerializer<Date>() {
|
| | | @Override
|
| | | public JsonElement serialize(Date value, Type theType, JsonSerializationContext context) {
|
| | | if (value == null) {
|
| | | return new JsonPrimitive("");
|
| | | } else {
|
| | | return new JsonPrimitive(value.getTime() + "");
|
| | | List<ScanHistoryV2> list = scanHistoryV2Service.getScanHistoryByDeviceOrUid(
|
| | | StringUtil.isNullOrEmpty(uid) ? null : Long.parseLong(uid), acceptData.getDevice(), page, 20,
|
| | | Constant.SOURCE_TYPE_TAOBAO);
|
| | | long count = scanHistoryV2Service.getCountByDeviceOrUid(
|
| | | StringUtil.isNullOrEmpty(uid) ? null : Long.parseLong(uid), acceptData.getDevice(),
|
| | | Constant.SOURCE_TYPE_TAOBAO);
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("count", count);
|
| | | JSONArray array = new JSONArray();
|
| | |
|
| | | GsonBuilder gsonBuilder = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder());
|
| | | gsonBuilder.excludeFieldsWithoutExposeAnnotation();
|
| | | gsonBuilder.registerTypeAdapter(Date.class, new JsonSerializer<Date>() {
|
| | | @Override
|
| | | public JsonElement serialize(Date value, Type theType, JsonSerializationContext context) {
|
| | | if (value == null) {
|
| | | return new JsonPrimitive("");
|
| | | } else {
|
| | | return new JsonPrimitive(value.getTime() + "");
|
| | | }
|
| | | }
|
| | | });
|
| | |
|
| | | Gson gson = gsonBuilder.create();
|
| | |
|
| | | if (list != null) {
|
| | | BigDecimal proportion = manageService.getFanLiRate();
|
| | | for (ScanHistoryV2 sh : list) {
|
| | | TaoBaoGoodsBrief goods = TaoBaoUtil.convert(sh.getCommonGoods());
|
| | | goods.setId(sh.getId());
|
| | | TaoBaoGoodsBriefExtra extra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(goods, proportion.toString(), "");
|
| | | extra.setCreatetime(sh.getCreateTime());
|
| | | array.add(gson.toJson(extra));
|
| | | }
|
| | | }
|
| | | });
|
| | |
|
| | | Gson gson = gsonBuilder.create();
|
| | |
|
| | | if (list != null) {
|
| | | BigDecimal proportion = manageService.getFanLiRate();
|
| | | for (ScanHistoryV2 sh : list) {
|
| | | TaoBaoGoodsBrief goods = TaoBaoUtil.convert(sh.getCommonGoods());
|
| | | goods.setId(sh.getId());
|
| | | TaoBaoGoodsBriefExtra extra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(goods, proportion.toString(), "");
|
| | | extra.setCreatetime(sh.getCreateTime());
|
| | | array.add(gson.toJson(extra));
|
| | | }
|
| | | data.put("data", array);
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | return;
|
| | | } catch (Exception e) {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("data", new JSONArray());
|
| | | data.put("count", 0);
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | | data.put("data", array);
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | return;
|
| | |
|
| | | }
|
| | |
|
| | | @RequestMapping(value = "deletescanhistory", method = RequestMethod.POST)
|
| | | public void deleteScanHistory(AcceptData acceptData, String type, String uid, String ids, |
| | | Integer goodsType, PrintWriter out) {
|
| | | public void deleteScanHistory(AcceptData acceptData, String type, String uid, String ids, PrintWriter out) {
|
| | | BusinessSystem sys = businessSystemService.getBusinessSystem(acceptData.getPlatform(),
|
| | | acceptData.getPackages());
|
| | | if (sys == null) {
|
| | |
| | | for (String auctionIdStr : idStr) {
|
| | | scanHistoryV2Service.deleteByAuctionIdAndDeviceOrUid(
|
| | | StringUtil.isNullOrEmpty(uid) ? null : Long.parseLong(uid), acceptData.getDevice(),
|
| | | Long.parseLong(auctionIdStr), goodsType);
|
| | | Long.parseLong(auctionIdStr));
|
| | | }
|
| | | } else {
|
| | | scanHistoryV2Service.deleteByDeviceOrUid(StringUtil.isNullOrEmpty(uid) ? null : Long.parseLong(uid),
|
| | | acceptData.getDevice(), goodsType);
|
| | | acceptData.getDevice());
|
| | | }
|
| | | out.print(JsonUtil.loadTrueResult(""));
|
| | |
|
| | |
| | | * 防止请求频率过高
|
| | | *
|
| | | */
|
| | | if (Constant.IS_OUTNET) {
|
| | | String key = "linkParse-" + acceptData.getDevice() + "-" + id;
|
| | | // if (Constant.IS_OUTNET) {
|
| | | String key = "linkParse-" + acceptData.getDevice() + "-" + id;
|
| | |
|
| | | String value = redisManager.getCommonString(key);
|
| | | if (!StringUtil.isNullOrEmpty(value)) {
|
| | | out.print(JsonUtil.loadFalseResult(11, "请求频率限制"));
|
| | | return;
|
| | | }
|
| | | redisManager.cacheCommonString(key, "1", 5);// 5s间隔
|
| | | String value = redisManager.getCommonString(key);
|
| | | if (!StringUtil.isNullOrEmpty(value)) {
|
| | | out.print(JsonUtil.loadFalseResult(11, "请求频率限制"));
|
| | | return;
|
| | | }
|
| | | redisManager.cacheCommonString(key, "1", 5);// 5s间隔
|
| | | // }
|
| | | TaoBaoGoodsBrief goods = null;
|
| | | try {
|
| | | goods = redisManager.getTaoBaoGoodsBrief(Long.parseLong(id));
|
| | |
| | | HttpServletRequest request, PrintWriter out) {
|
| | | int pageSize = Constant.PAGE_SIZE;
|
| | | JSONArray array = new JSONArray();
|
| | |
|
| | | Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder()).create();
|
| | | if (VersionUtil.greaterThan_1_5_70(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | | List<TaoBaoGoodsBrief> goodsList = homeRecommendGoodsService.listGoodsByPage(null, acceptData.getDevice(),
|
| | | imei, idfa, page);
|
| | |
|
| | | if (page < 4) {// 前三页加入更新
|
| | | try {
|
| | | taoBaoGoodsUpdateService.addUpdateQueueAsync(goodsList);
|
| | | } catch (Exception e) {
|
| | | }
|
| | | }
|
| | |
|
| | | BigDecimal rate = hongBaoManageService.getFanLiRate();
|
| | | for (TaoBaoGoodsBrief goods : goodsList) {
|
| | | TaoBaoGoodsBriefExtra extra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(goods, rate + "", null);
|
| | | if (page < 3)
|
| | | extra.setRecommend(true);
|
| | |
|
| | | try {
|
| | | array.add(gson.toJson(extra));
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | System.out.println(new Gson().toJson(goods));
|
| | | }
|
| | | }
|
| | |
|
| | | if (page == 1) {
|
| | | List<TLJBuyGoods> list = null;
|
| | | try {
|
| | | list = homeRecommendGoodsService.getZiGouLiJianHotGoods(acceptData.getDevice());
|
| | | } catch (Exception e) {
|
| | | }
|
| | | if (list != null && list.size() > 0)
|
| | | for (int i = list.size() - 1; i >= 0; i--) {
|
| | | TLJBuyGoods goods = list.get(i);
|
| | | TaoBaoGoodsBriefExtra extra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(goods.getGoods(),
|
| | | TaoBaoConstant.OWN_BUY_WITHOUT_FANLI_RATE + "", null);
|
| | | String hongBao = TaoBaoUtil.getGoodsHongBaoInfo(goods.getGoods(),
|
| | | TaoBaoConstant.OWN_BUY_WITHOUT_FANLI_RATE);
|
| | | TLJBuyHongBaoVO vo = new TLJBuyHongBaoVO();
|
| | | vo.setLeft(goods.getLeftHongBaoCount());
|
| | | vo.setMoney(hongBao);
|
| | | vo.setTagName("付款立减 " + hongBao);
|
| | | vo.setTip("");
|
| | | vo.setTotal(goods.getTotalHongBaoCount());
|
| | | extra.setTljBuyHongBao(vo);
|
| | | extra.setPictureTag(new ClientTextStyleVO("立减TOP" + (i + 1), "#E5005C", "#FCE431", null));
|
| | | extra.setRecommend(true);
|
| | | extra.setSpreadMoney(vo.getTagName());
|
| | | array.add(0, gson.toJson(extra));
|
| | | }
|
| | | }
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("data", array);
|
| | | data.put("count", 1000);
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | return;
|
| | | }
|
| | |
|
| | | // 从推荐来
|
| | | if (page <= 1) {
|
| | | array.clear();
|
| | |
| | |
|
| | | // filter
|
| | | try {
|
| | |
|
| | | gList = daTaoKeGoodsDetailService.filterTaoBaoGoods(gList);
|
| | | } catch (Exception e) {
|
| | | }
|
| | |
| | |
|
| | | TaoBaoGoodsBriefExtra extra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(goods,
|
| | | proportion.toString(), "");
|
| | |
|
| | | extra.setRecommend(true);
|
| | | goodsList.add(extra);
|
| | | }
|
| | |
| | | if (uid == null) {
|
| | | data.put("collected", false);
|
| | | } else {
|
| | | CollectionGoodsV2 collectionGoods = collectionGoodsV2Service.findByUidAndAuctionId(uid, id, Constant.SOURCE_TYPE_TAOBAO);
|
| | | CollectionGoodsV2 collectionGoods = collectionGoodsV2Service.findByUidAndAuctionId(uid, id,
|
| | | Constant.SOURCE_TYPE_TAOBAO);
|
| | | data.put("collected", collectionGoods != null ? true : false);
|
| | | }
|
| | |
|
| | |
| | | }
|
| | |
|
| | | String token = "";
|
| | | if (!StringUtil.isNullOrEmpty(tb.getCouponLink())) {
|
| | | if (!StringUtil.isNullOrEmpty(tb.getCouponLink())
|
| | | && VersionUtil.greaterThan_1_5_60(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | | token = redisManager.getCommonTaoToken(tb.getAuctionId());
|
| | | if (StringUtil.isNullOrEmpty(token)) {
|
| | | token = TaoKeApiUtil.getTKToken(tb.getPictUrl(), tb.getTitle(), tb.getCouponLink());
|
| | |
| | | // 红包
|
| | | if (hongBao == null) {
|
| | | BigDecimal proportion = manageService.getFanLiRate();
|
| | | if ("taolijin".equalsIgnoreCase(from))
|
| | | proportion = manageService.getTLJShareRate(System.currentTimeMillis());
|
| | | hongBao = TaoBaoUtil.getGoodsHongBaoInfo(tb, proportion);
|
| | | }
|
| | | goodsJson.put("hongBao", hongBao);
|
| | |
| | | // 推广红包
|
| | | if (from != null && from.equals("taolijin")) {
|
| | | // 计算推广红包
|
| | | String warningRate = configTaoLiJinService.getValueByKey("warning_value");
|
| | | String warningRate = configTaoLiJinService.getValueByKey("warning_value", null);
|
| | | BigDecimal spreadMoney = TaoLiJinUtil.getSpreadMoney(warningRate, goods);
|
| | |
|
| | | // 推广红包 不能小于1
|
| | |
| | |
|
| | | data.put("listTip", listText);
|
| | | }
|
| | | spreadHongBao.setTip("当日领取,当日内使用,过期失效。");
|
| | | spreadHongBao.setTip("当日领取,当日内使用,过期失效");
|
| | | goodsJson.put("spreadHongBao", spreadHongBao);
|
| | |
|
| | | // 用户剩余可以淘礼金验证
|
| | |
| | | data.put("userHongbao", userMoneyExtra.getTlj().setScale(2).toString());
|
| | | }
|
| | |
|
| | | noRebateHelpLink = configTaoLiJinService.getValueByKey("share_goods_help_link");
|
| | | noRebateHelpLink = configTaoLiJinService.getValueByKey("share_goods_help_link", null);
|
| | |
|
| | | if (Constant.IS_TEST) {
|
| | | fanliValid = true;
|
| | |
| | | goodsJson.put("tljNum", tljNum);
|
| | | }
|
| | |
|
| | | } else if (from != null && from.equals("taolijin_buy")) {
|
| | | noRebateHelpLink = configService.get("zigoulijian_nofanli_help");
|
| | | // 查询分享库
|
| | | TLJBuyGoods buyGoods = tljBuyGoodsService.selectByAuctionIdAndDay(goods.getAuctionId(),
|
| | | TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyy-MM-dd"));
|
| | | if (buyGoods == null) {
|
| | | out.print(JsonUtil.loadFalseResult(2, "自购立减红包过期"));
|
| | | return;
|
| | | }
|
| | |
|
| | | fanliValid = true;
|
| | | goodsJson.put("shareValid", false);
|
| | | String tljHongBao = TaoBaoUtil.getGoodsHongBaoMoney(goods, new BigDecimal(70)).toString();
|
| | | TLJBuyHongBaoVO vo = new TLJBuyHongBaoVO();
|
| | | vo.setLeft(buyGoods.getLeftHongBaoCount());
|
| | | vo.setMoney(tljHongBao);
|
| | | vo.setTagName("付款立减 ¥" + tljHongBao);
|
| | | vo.setTip("当日领取,当日内使用,过期失效");
|
| | | vo.setTotal(buyGoods.getTotalHongBaoCount());
|
| | | goodsJson.put("tljBuyHongBao", vo);
|
| | | moneyType = 2;
|
| | | }
|
| | |
|
| | | goodsJson.put("moneyType", moneyType);
|
| | |
| | | @RequestMapping(value = "getgoodsderivation", method = RequestMethod.POST)
|
| | | public void getRecommendGoods(AcceptData acceptData, long id, PrintWriter out) {
|
| | |
|
| | | BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(),
|
| | | acceptData.getPackages());
|
| | | if (system == null) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "系统不存在"));
|
| | | return;
|
| | | }
|
| | |
|
| | | List<TaoBaoGoodsBrief> goodsList = TaoKeApiUtil.getRelationGoodsRecommend(id, 10);
|
| | | // 初始化
|
| | | if (goodsList == null) {
|
| | | goodsList = new ArrayList<TaoBaoGoodsBrief>();
|
| | | }
|
| | |
|
| | | BigDecimal proportion = manageService.getFanLiRate();
|
| | |
|
| | | List<TaoBaoGoodsBriefExtra> listExtra = new ArrayList<TaoBaoGoodsBriefExtra>();
|
| | |
|
| | | TaoKeAppInfo app = new TaoKeAppInfo();
|
| | | app.setAppKey(TaoBaoConstant.TAOBAO_AUTH_APPKEY);
|
| | | app.setAppSecret(TaoBaoConstant.TAOBAO_AUTH_APPSECRET);
|
| | | app.setAdzoneId(TaoBaoConstant.TAOBAO_SPECIAL_PID_DEFAULT.split("_")[3]);
|
| | | app.setPid(TaoBaoConstant.TAOBAO_SPECIAL_PID_DEFAULT);
|
| | |
|
| | | List<Long> ids = new ArrayList<>();
|
| | | for (TaoBaoGoodsBrief goods : goodsList)
|
| | | ids.add(goods.getAuctionId());
|
| | |
|
| | | try {
|
| | | goodsList = TaoKeApiUtil.getBatchGoodsInfo(ids);
|
| | | } catch (TaoKeApiException e1) {
|
| | | e1.printStackTrace();
|
| | | } catch (TaobaoGoodsDownException e1) {
|
| | | e1.printStackTrace();
|
| | |
|
| | | List<TaoBaoGoodsBrief> goodsList = TaoKeApiUtil.getRelationGoodsRecommend(id, 10);
|
| | | // 初始化
|
| | | if (goodsList == null) {
|
| | | goodsList = new ArrayList<TaoBaoGoodsBrief>();
|
| | | }
|
| | |
|
| | | BigDecimal proportion = manageService.getFanLiRate();
|
| | |
|
| | | List<TaoBaoGoodsBriefExtra> listExtra = new ArrayList<TaoBaoGoodsBriefExtra>();
|
| | |
|
| | | TaoKeAppInfo app = new TaoKeAppInfo();
|
| | | app.setAppKey(TaoBaoConstant.TAOBAO_AUTH_APPKEY);
|
| | | app.setAppSecret(TaoBaoConstant.TAOBAO_AUTH_APPSECRET);
|
| | | app.setAdzoneId(TaoBaoConstant.TAOBAO_SPECIAL_PID_DEFAULT.split("_")[3]);
|
| | | app.setPid(TaoBaoConstant.TAOBAO_SPECIAL_PID_DEFAULT);
|
| | |
|
| | | List<Long> ids = new ArrayList<>();
|
| | | for (TaoBaoGoodsBrief goods : goodsList)
|
| | | ids.add(goods.getAuctionId());
|
| | |
|
| | | try {
|
| | | goodsList = TaoKeApiUtil.getBatchGoodsInfo(ids);
|
| | | } catch (TaoKeApiException e1) {
|
| | | e1.printStackTrace();
|
| | | } catch (TaobaoGoodsDownException e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | |
|
| | | if (goodsList != null && goodsList.size() > 0)
|
| | | goodsList.parallelStream().forEach(goods -> {
|
| | | if (goods != null) {
|
| | | // 获取详情
|
| | | TaoBaoGoodsBrief taoBaoGoodsBrief = null;
|
| | | try {
|
| | | taoBaoGoodsBrief = taoBaoGoodsCacheUtil.getCommonTaoBaoGoodsInfo(goods.getAuctionId());
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | if (taoBaoGoodsBrief == null) {
|
| | | TaoBaoGoodsBrief newGoods = TaoKeApiUtil.specialConvertCoupon(goods.getAuctionId(), app);
|
| | | goods.setCouponInfo(newGoods.getCouponInfo());
|
| | | goods.setCouponLink(newGoods.getCouponLink());
|
| | | goods.setTkRate(newGoods.getTkRate());
|
| | | taoBaoGoodsBrief = goods;
|
| | | }
|
| | |
|
| | | if (taoBaoGoodsBrief != null) {
|
| | | listExtra.add(
|
| | | TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion.toString(), ""));
|
| | | }
|
| | | }
|
| | | });
|
| | |
|
| | | List<TaoBaoGoodsBrief> listQuality = new ArrayList<TaoBaoGoodsBrief>();
|
| | |
|
| | | // 取偶数个数据
|
| | | if (listExtra.size() % 2 != 0) {
|
| | | listExtra.remove(listExtra.size() - 1);
|
| | | }
|
| | |
|
| | | if (listQuality.size() % 2 != 0) {
|
| | | listQuality.remove(listQuality.size() - 1);
|
| | | }
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("listQuality", JsonUtil.getApiCommonGson().toJson(listExtra));
|
| | | data.put("listGuess", JsonUtil.getApiCommonGson().toJson(listQuality));
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | } catch (Exception e) {
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("listQuality", new JSONArray());
|
| | | data.put("listGuess", new JSONArray());
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | | if (goodsList != null && goodsList.size() > 0)
|
| | | goodsList.parallelStream().forEach(goods -> {
|
| | |
|
| | | // 获取详情
|
| | | TaoBaoGoodsBrief taoBaoGoodsBrief = null;
|
| | | try {
|
| | | taoBaoGoodsBrief = taoBaoGoodsCacheUtil.getCommonTaoBaoGoodsInfo(goods.getAuctionId());
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | if (taoBaoGoodsBrief == null) {
|
| | | TaoBaoGoodsBrief newGoods = TaoKeApiUtil.specialConvertCoupon(goods.getAuctionId(), app);
|
| | | goods.setCouponInfo(newGoods.getCouponInfo());
|
| | | goods.setCouponLink(newGoods.getCouponLink());
|
| | | goods.setTkRate(newGoods.getTkRate());
|
| | | taoBaoGoodsBrief = goods;
|
| | | }
|
| | |
|
| | | if (taoBaoGoodsBrief != null) {
|
| | | listExtra.add(TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion.toString(), ""));
|
| | | }
|
| | |
|
| | | });
|
| | |
|
| | | List<TaoBaoGoodsBrief> listQuality = new ArrayList<TaoBaoGoodsBrief>();
|
| | | // 删除推荐
|
| | | //
|
| | | // try {
|
| | | // List<QualityFactory> listRecommend =
|
| | | // qualityGoodsService.recommendByAuctionId(id);
|
| | | //
|
| | | // if (listRecommend != null && listRecommend.size() > 1) {
|
| | | // for (QualityFactory quality : listRecommend) {
|
| | | //
|
| | | // TaoBaoGoodsBrief taoBaoGoodsBrief = quality.getTaoBaoGoodsBrief();
|
| | | // if (taoBaoGoodsBrief == null) {
|
| | | // continue;
|
| | | // }
|
| | | //
|
| | | // int biz30day = taoBaoGoodsBrief.getBiz30day();
|
| | | // if (biz30day >= 10000) {
|
| | | // double sales = biz30day;
|
| | | // String salesCountMidea = String.format("%.1f", sales / 10000);
|
| | | // taoBaoGoodsBrief.setSalesCount(salesCountMidea + "万");
|
| | | // } else {
|
| | | // taoBaoGoodsBrief.setSalesCount(biz30day + "");
|
| | | // }
|
| | | //
|
| | | // // 改变图片尺寸
|
| | | // String pictUrl = taoBaoGoodsBrief.getPictUrl();
|
| | | // if (!StringUtil.isNullOrEmpty(pictUrl) &&
|
| | | // !pictUrl.contains("320x320")) {
|
| | | // taoBaoGoodsBrief.setPictUrl(TbImgUtil.getTBSize320Img(pictUrl));
|
| | | // }
|
| | | //
|
| | | // listQuality.add(TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief,
|
| | | // proportion.toString(), null));
|
| | | // }
|
| | | // }
|
| | | // } catch (Exception e2) {
|
| | | // e2.printStackTrace();
|
| | | // }
|
| | |
|
| | | // 取偶数个数据
|
| | | if (listExtra.size() % 2 != 0) {
|
| | | listExtra.remove(listExtra.size() - 1);
|
| | | }
|
| | |
|
| | | if (listQuality.size() % 2 != 0) {
|
| | | listQuality.remove(listQuality.size() - 1);
|
| | | }
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("listQuality", JsonUtil.getApiCommonGson().toJson(listExtra));
|
| | | data.put("listGuess", JsonUtil.getApiCommonGson().toJson(listQuality));
|
| | |
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getSpecialActivities")
|
| | | public void getSpecialActivities(AcceptData acceptData, Long uid, PrintWriter out) {
|
| | | public void getSpecialActivities(AcceptData acceptData, Long uid, PrintWriter out, String callback) {
|
| | | int platformCode = Constant.getPlatformCode(acceptData.getPlatform());
|
| | | List<Special> listSpecial = specialService.listByVersion(0, Integer.MAX_VALUE, "special_activities",
|
| | | platformCode, Integer.parseInt(acceptData.getVersion()));
|
| | |
|
| | | BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(),
|
| | | acceptData.getPackages());
|
| | | if (system == null) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "系统不存在"));
|
| | | return;
|
| | | List<Special> list = new ArrayList<Special>();
|
| | | if (listSpecial != null) {
|
| | | list.addAll(listSpecial);
|
| | | }
|
| | |
|
| | | try {
|
| | | for (int i = 0; i < list.size(); i++) {
|
| | | Special special = list.get(i);
|
| | |
|
| | | List<Special> list = new ArrayList<Special>();
|
| | | // 专题活动
|
| | | String specialCard = "special_activities";
|
| | |
|
| | | List<Special> listSpecial = specialService.listPageBySystemAndCard(0, Integer.MAX_VALUE, specialCard,
|
| | | system.getId());
|
| | |
|
| | | if (listSpecial != null) {
|
| | | list.addAll(listSpecial);
|
| | | JumpDetailV2 jumpDetail = special.getJumpDetail();
|
| | | if (jumpDetail != null) {
|
| | | jumpDetail.setNeedLogin(special.isJumpLogin());
|
| | | special.setJumpDetail(jumpDetail);
|
| | | }
|
| | |
|
| | | for (int i = 0; i < list.size(); i++) {
|
| | | Special special = list.get(i);
|
| | | String name = special.getName();
|
| | | if (StringUtil.isNullOrEmpty(name)) {
|
| | | continue;
|
| | | }
|
| | |
|
| | | JumpDetailV2 jumpDetail = special.getJumpDetail();
|
| | | if (jumpDetail != null) {
|
| | | jumpDetail.setNeedLogin(special.isJumpLogin());
|
| | | special.setJumpDetail(jumpDetail);
|
| | | }
|
| | |
|
| | | String name = special.getName();
|
| | | if (StringUtil.isNullOrEmpty(name)) {
|
| | | continue;
|
| | | }
|
| | |
|
| | | // 是否需要弹出框
|
| | | if (name.equals("账户等级特权")) {
|
| | | if (!VersionUtil.greaterThan_1_5_60(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | | list.remove(i);
|
| | | i--;
|
| | | } else {
|
| | | if (uid != null) {
|
| | | special.setElastic(userTaoLiJinOriginService.hasRankHongBao(uid));
|
| | | }
|
| | | // 是否需要弹出框
|
| | | if (name.equals("账户等级特权")) {
|
| | | if (!VersionUtil.greaterThan_1_5_60(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | | list.remove(i);
|
| | | i--;
|
| | | } else {
|
| | | if (uid != null) {
|
| | | special.setElastic(userTaoLiJinOriginService.hasRankHongBao(uid));
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | JSONObject root = new JSONObject();
|
| | | root.put("special", JsonUtil.getApiCommonGson().toJson(list));
|
| | | out.print(JsonUtil.loadTrueResult(root));
|
| | |
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | JSONObject root = new JSONObject();
|
| | | root.put("special", JsonUtil.getApiCommonGson().toJson(list));
|
| | | if (StringUtil.isNullOrEmpty(callback))
|
| | | out.print(JsonUtil.loadTrueResult(root));
|
| | | else
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(root));
|
| | | }
|
| | | }
|