| | |
| | | import com.yeshi.fanli.entity.goods.CommonGoods;
|
| | | import com.yeshi.fanli.entity.goods.ScanHistoryV2;
|
| | | import com.yeshi.fanli.entity.system.BusinessSystem;
|
| | | import com.yeshi.fanli.entity.system.ConfigKeyEnum;
|
| | | import com.yeshi.fanli.entity.system.SystemClientParams;
|
| | | 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.homemodule.SuperSpecialService;
|
| | | import com.yeshi.fanli.service.inter.homemodule.SwiperPictureService;
|
| | | 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.order.config.HongBaoManageService;
|
| | | 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.taobao.dataoke.DaTaoKeGoodsDetailService;
|
| | | import com.yeshi.fanli.service.inter.taobao.dataoke.DaTaoKeGoodsDetailV2Service;
|
| | | import com.yeshi.fanli.service.inter.tlj.ConfigTaoLiJinService;
|
| | | import com.yeshi.fanli.service.inter.tlj.DeviceTaoLiJinRecordService;
|
| | | import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinOriginService;
|
| | | import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinRecordService;
|
| | | import com.yeshi.fanli.service.inter.user.ShamUserService;
|
| | |
| | | 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.RedisKeyEnum;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TaoBaoConstant;
|
| | |
| | | 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;
|
| | |
| | | private TaoBaoShopService taoBaoShopService;
|
| | |
|
| | | @Resource
|
| | | private DaTaoKeGoodsDetailService daTaoKeGoodsDetailService;
|
| | | private DaTaoKeGoodsDetailV2Service daTaoKeGoodsDetailV2Service;
|
| | |
|
| | | @Resource
|
| | | private UserMoneyExtraService userMoneyExtraService;
|
| | |
| | | private ConfigTaoLiJinService configTaoLiJinService;
|
| | |
|
| | | @Resource
|
| | | private DeviceTaoLiJinRecordService deviceTaoLiJinRecordService;
|
| | |
|
| | | @Resource
|
| | | private DeviceSexService deviceSexService;
|
| | |
|
| | | @Resource
|
| | |
| | |
|
| | | @Resource
|
| | | private RecommendGoodsDeleteHistoryService recommendGoodsDeleteHistoryService;
|
| | |
|
| | | @Resource
|
| | | private HomeRecommendGoodsService homeRecommendGoodsService;
|
| | |
|
| | | @Resource
|
| | | private TLJBuyGoodsService tljBuyGoodsService;
|
| | |
|
| | | @RequestMapping(value = "getHonestList")
|
| | | public void getHonestList(AcceptData acceptData, PrintWriter out) {
|
| | |
| | |
|
| | | // 获取淘客参数
|
| | | ClientTBPid clientTBPid = null;
|
| | | if (simpleGoods.getMaterialLibType() != null && simpleGoods.getMaterialLibType() == 1) {
|
| | | if (TaoBaoUtil.isSpecialGoods(simpleGoods.getMaterialLibType())) {
|
| | | String pid = TaoBaoConstant.TAOBAO_SPECIAL_PID_DEFAULT;
|
| | | clientTBPid = new ClientTBPid(TaoBaoConstant.TAOBAO_AUTH_APPKEY, TaoBaoConstant.TAOBAO_AUTH_APPSECRET,
|
| | | pid.split("_")[2], pid.split("_")[3]);
|
| | |
| | |
|
| | | // taoBaoGoodsBriefExtra.setAuctionUrl(null);
|
| | | data.put("taobao", taobaoJson);
|
| | | String info = configService.get("detail_prompt");
|
| | | String info = configService.get(ConfigKeyEnum.detailPrompt.getKey());
|
| | | data.put("info", info);
|
| | | String onlyInfo = configService.get("only_info");
|
| | | String onlyInfo = configService.get(ConfigKeyEnum.onlyInfo.getKey());
|
| | | data.put("only", onlyInfo);
|
| | | data.put("helpUrl", configService.get("old_goods_detail_help_url"));
|
| | | data.put("helpUrl", configService.get(ConfigKeyEnum.oldGoodsDetailHelpUrl.getKey()));
|
| | |
|
| | | int showType = taoBaoGoodsBriefExtra.getShowType();
|
| | | String price = "";
|
| | |
| | | data.put("shareTitle", taoBaoGoodsBriefExtra.getTitle());
|
| | | data.put("shareContent", "¥" + price + "元");
|
| | | data.put("shareImg", taoBaoGoodsBriefExtra.getPictUrl());
|
| | | String html = configService.get("downAPP");
|
| | | String html = configService.get(ConfigKeyEnum.downAPP.getKey());
|
| | | data.put("downAPP", html);
|
| | | String shareSinaContent = configService.get("shareSinaContent");
|
| | | data.put("shareSina",
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | List<TaoBaoGoodsBrief> goodsList = TaoKeApiUtil.getRelationGoodsRecommend(id, 6);
|
| | | List<TaoBaoGoodsBrief> goodsList = TaoKeApiUtil.guessLikeByAuctionId(id, 6);
|
| | | if (goodsList == null)
|
| | | goodsList = new ArrayList<>();
|
| | |
|
| | |
| | |
|
| | | // 获取浏览记录
|
| | | @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;
|
| | |
|
| | | String value = redisManager.getCommonString(key);
|
| | | if (!StringUtil.isNullOrEmpty(value)) {
|
| | | out.print(JsonUtil.loadFalseResult(11, "请求频率限制"));
|
| | | return;
|
| | | }
|
| | | redisManager.cacheCommonString(key, "1", 5);// 5s间隔
|
| | | // if (Constant.IS_OUTNET) {
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.taobaolinkParse, acceptData.getDevice() + "-" + id);
|
| | | 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();
|
| | |
| | | if (!StringUtil.isNullOrEmpty(imei) || !StringUtil.isNullOrEmpty(idfa)) {
|
| | | long startTime = java.lang.System.currentTimeMillis();
|
| | |
|
| | | TaoBaoSearchResult result = TaoKeApiUtil.guessDeviceLike(page, 50, imei, idfa);
|
| | | TaoBaoSearchResult result = TaoKeApiUtil.guessDeviceLike(page, 50, imei, idfa,"");
|
| | |
|
| | | if (result != null && result.getTaoBaoGoodsBriefs() != null) {
|
| | | // 筛选
|
| | |
| | |
|
| | | // filter
|
| | | try {
|
| | | gList = daTaoKeGoodsDetailService.filterTaoBaoGoods(gList);
|
| | |
|
| | | gList = daTaoKeGoodsDetailV2Service.filterTaoBaoGoods(gList);
|
| | | } catch (Exception e) {
|
| | | }
|
| | |
|
| | |
| | |
|
| | | TaoBaoGoodsBriefExtra extra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(goods,
|
| | | proportion.toString(), "");
|
| | |
|
| | | extra.setRecommend(true);
|
| | | goodsList.add(extra);
|
| | | }
|
| | |
| | | if (!StringUtil.isNullOrEmpty(specialCard)) {
|
| | | try {
|
| | |
|
| | | listswiper = swiperPictureService.getByBannerCard(swiperCard);
|
| | | listswiper = swiperPictureService.getByBannerCardAndVersion(swiperCard, acceptData.getPlatform(),
|
| | | Integer.parseInt(acceptData.getVersion()));
|
| | |
|
| | | if (listswiper == null) {
|
| | | listswiper = new ArrayList<SwiperPicture>();
|
| | |
| | | JSONObject invite = new JSONObject();
|
| | | JumpDetailV2 jumpDetail = jumpDetailV2Service.getByTypeCache("invite");
|
| | | invite.put("jumpDetail", jumpDetail);
|
| | | invite.put("picture", configService.get("home_invite_banner"));
|
| | | invite.put("picture", configService.get(ConfigKeyEnum.homeInviteBanner.getKey()));
|
| | |
|
| | | if ("ios".equalsIgnoreCase(acceptData.getPlatform())
|
| | | && configService.iosOnLining(Integer.parseInt(acceptData.getVersion()))) {
|
| | |
| | | JSONObject root = specialService.listCacheSpecialToIndex(acceptData, deviceSex);
|
| | |
|
| | | // 2、顶部轮播图
|
| | | List<SwiperPicture> topPicList = getSwiperByCard("index_top");
|
| | | List<SwiperPicture> topPicList = getSwiperByCard("index_top", acceptData);
|
| | | if (topPicList == null) {
|
| | | topPicList = new ArrayList<SwiperPicture>();
|
| | | }
|
| | |
| | | && configService.iosOnLining(Integer.parseInt(acceptData.getVersion()))) {
|
| | | // 如果IOS当前版本处于审核状态就不返回
|
| | | } else {
|
| | | invitePicList = getSwiperByCard("index_invite");
|
| | | invitePicList = getSwiperByCard("index_invite", acceptData);
|
| | | }
|
| | |
|
| | | if (invitePicList == null) {
|
| | |
| | | // 4、IOS的底部网页链接
|
| | | String platform = acceptData.getPlatform();
|
| | | if ("ios".equalsIgnoreCase(platform)) {
|
| | | root.put("htmlLink", configService.get("index_html_link_ios"));
|
| | | root.put("htmlLink", configService.get(ConfigKeyEnum.indexHtmlLinkIos.getKey()));
|
| | | }
|
| | |
|
| | | root.put("spikeGoods", getSpikeGoodsContent(acceptData));
|
| | |
| | | return null;
|
| | | }
|
| | |
|
| | | List<SwiperPicture> invitePicList = getSwiperByCard("index_invite");
|
| | | List<SwiperPicture> invitePicList = getSwiperByCard("index_invite", acceptData);
|
| | |
|
| | | return invitePicList;
|
| | | }
|
| | |
|
| | | public List<SwiperPicture> getSwiperByCard(String card) {
|
| | | public List<SwiperPicture> getSwiperByCard(String card, AcceptData acceptData) {
|
| | | List<SwiperPicture> swiperList = null;
|
| | | try {
|
| | | swiperList = swiperPictureService.getByBannerCard(card);
|
| | | swiperList = swiperPictureService.getByBannerCardAndVersion(card, acceptData.getPlatform(),
|
| | | Integer.parseInt(acceptData.getVersion()));
|
| | | } catch (Exception e) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e);
|
| | |
| | | nextTime.set(Calendar.MILLISECOND, 0);
|
| | |
|
| | | JSONArray array = null;
|
| | | String timekey = String.format("spikeGoods_hour-%s-%s", acceptData.getPlatform(), acceptData.getVersion());
|
| | | String cachekey = String.format("spikeGoodsList-%s-%s", acceptData.getPlatform(), acceptData.getVersion());
|
| | | String timekey = RedisKeyEnum.getRedisKey(RedisKeyEnum.spikeGoodsHour,acceptData.getPlatform() +"-"+acceptData.getVersion());
|
| | | String cachekey = RedisKeyEnum.getRedisKey(RedisKeyEnum.spikeGoodsList,acceptData.getPlatform() +"-"+acceptData.getVersion());
|
| | |
|
| | | String timeValue = redisManager.getCommonString(timekey);
|
| | | if (timeValue == null || !timeValue.equals(hour + "")) {
|
| | |
| | | .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());
|
| | | params.put("url", configService.get(ConfigKeyEnum.spikeGoodsLink.getKey()) + "?id=" + taoBaoGoodsBrief.getAuctionId());
|
| | | goods.put("params", params);
|
| | |
|
| | | // 1.5.4及以后返回
|
| | |
| | | root.put("listgoods", array);
|
| | |
|
| | | JSONObject params = new JSONObject();
|
| | | params.put("url", configService.get("spike_goods_link"));
|
| | | params.put("url", configService.get(ConfigKeyEnum.spikeGoodsLink.getKey()));
|
| | |
|
| | | root.put("params", params);
|
| | | root.put("jumpDetail", jumpDetail);
|
| | |
| | |
|
| | | // 大淘客商品过滤
|
| | | try {
|
| | | goods = daTaoKeGoodsDetailService.filterTaoBaoGoods(goods);
|
| | | goods = daTaoKeGoodsDetailV2Service.filterTaoBaoGoods(goods).getGoods();
|
| | | } catch (Exception e) {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | |
| | | 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);
|
| | |
| | | data.put("shareUrl", shareUrl);
|
| | | data.put("shareUsers", listShareUser);
|
| | | data.put("couponUsers", listCouponUser);
|
| | | data.put("detailWebUrl", "http://apph5.yeshitv.com/apppage/goods_img.html?id=" + id);
|
| | | data.put("detailWebUrl", "http://apph5.banliapp.com/apppage/goods_img.html?id=" + id);
|
| | |
|
| | | String noRebateHelpLink = null;
|
| | |
|
| | |
| | | // 推广红包
|
| | | 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(ConfigKeyEnum.zigoulijianNofanliHelp.getKey());
|
| | | // 查询分享库
|
| | | 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);
|
| | |
| | | if (!StringUtil.isNullOrEmpty(noRebateHelpLink)) {
|
| | | data.put("noRebateHelpLink", noRebateHelpLink);
|
| | | } else {
|
| | | data.put("noRebateHelpLink", configService.get("no_rebate_help_link"));
|
| | | data.put("noRebateHelpLink", configService.get(ConfigKeyEnum.noRebateHelpLink.getKey()));
|
| | | }
|
| | |
|
| | | // 取消分享活动
|
| | |
| | | @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.guessLikeByAuctionId(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) {
|
| | | List<Special> listSpecial = specialService.listByVersion(0, Integer.MAX_VALUE, "special_activities",
|
| | | acceptData.getPlatform(), 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);
|
| | |
|
| | | 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));
|
| | | }
|
| | | }
|
| | | }
|
| | | String name = special.getName();
|
| | | if (StringUtil.isNullOrEmpty(name)) {
|
| | | continue;
|
| | | }
|
| | | }
|
| | |
|
| | | JSONObject root = new JSONObject();
|
| | | root.put("special", JsonUtil.getApiCommonGson().toJson(list));
|
| | | JSONObject root = new JSONObject();
|
| | | root.put("special", JsonUtil.getApiCommonGson().toJson(list));
|
| | | if (StringUtil.isNullOrEmpty(callback))
|
| | | out.print(JsonUtil.loadTrueResult(root));
|
| | |
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | else
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(root));
|
| | | }
|
| | | }
|