| | |
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | | import javax.annotation.Resource;
|
| | | import javax.servlet.http.HttpServletRequest;
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | | import net.sf.json.JSONArray;
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | | import org.springframework.stereotype.Controller;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | |
| | | import org.yeshi.utils.IPUtil;
|
| | | import org.yeshi.utils.JsonUtil;
|
| | | import org.yeshi.utils.NumberUtil;
|
| | |
|
| | |
|
| | | import org.yeshi.utils.taobao.TbImgUtil;
|
| | |
|
| | | import com.google.gson.Gson;
|
| | |
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.entity.bus.homemodule.Special;
|
| | | import com.yeshi.fanli.entity.bus.homemodule.SuperSpecial;
|
| | | import com.yeshi.fanli.entity.bus.homemodule.SwiperPicture;
|
| | | import com.yeshi.fanli.entity.bus.lable.QualityFactory;
|
| | | import com.yeshi.fanli.entity.bus.recommend.Honest;
|
| | | import com.yeshi.fanli.entity.bus.recommend.RecommendBanner;
|
| | |
| | | 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.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.QualityGoodsService;
|
| | | import com.yeshi.fanli.service.inter.monitor.MonitorService;
|
| | | import com.yeshi.fanli.service.inter.order.OrderService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoGoodsUpdateService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoUnionConfigService;
|
| | |
| | | import com.yeshi.fanli.util.ThreadUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.util.Utils;
|
| | | import com.yeshi.fanli.util.factory.MonitorFactory;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoCouponUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoOrderUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil;
|
| | |
| | |
|
| | | @Resource
|
| | | private ShamUserService shamUserService;
|
| | | @Resource
|
| | | private SpecialService specialService;
|
| | |
|
| | | @Resource
|
| | | private SwiperPictureService swiperPictureService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private MonitorService monitorService;
|
| | |
|
| | | @RequestMapping(value = "getrecommendsection")
|
| | | public void getRecommendSection(AcceptData acceptData, int index, PrintWriter out) {
|
| | |
| | | data.put("info", info);
|
| | | String onlyInfo = configService.get("only_info");
|
| | | data.put("only", onlyInfo);
|
| | | data.put("helpUrl", configService.get("old_goods_detail_help_url"));
|
| | |
|
| | | int showType = taoBaoGoodsBriefExtra.getShowType();
|
| | | String price = "";
|
| | | if (showType == 1 || showType == 3) {
|
| | |
| | | + taoBaoGoodsBriefExtra.getTitle() + shareSinaContent);
|
| | |
|
| | | data.put("sharemoney", "分享奖金 ¥" + taoBaoGoodsBriefService.getShareGoodsUserHongBao(tb) + "元");
|
| | |
|
| | | data.put("shareHongBao", "¥" + taoBaoGoodsBriefService.getShareGoodsUserHongBao(tb));
|
| | |
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | final TaoBaoGoodsBrief tbb = tb;
|
| | |
| | |
|
| | | // 新版商品图文详情
|
| | | @RequestMapping(value = "getnewgoodsdetail", method = RequestMethod.POST)
|
| | | public void getNewGoodsDetail(AcceptData acceptData, String id, String uid, PrintWriter out) {
|
| | | public void getNewGoodsDetail(AcceptData acceptData, String id, String uid, HttpServletRequest request,
|
| | | PrintWriter out) {
|
| | | if ("0".equalsIgnoreCase(uid))
|
| | | uid = "";
|
| | | if (StringUtil.isNullOrEmpty(id)) {
|
| | |
| | | } catch (NumberFormatException e) {
|
| | | e.printStackTrace();
|
| | | } catch (TaobaoGoodsDownException e) {
|
| | | e.printStackTrace();
|
| | | try {
|
| | | monitorService.addClientAPIMonitor(MonitorFactory.createClientAPI(request, 0, 0, "商品下架"));
|
| | | } catch (Exception e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | | }
|
| | | } else {
|
| | | try {
|
| | | goods = redisManager.getTaoBaoGoodsBrief(Long.parseLong(id));
|
| | | } catch (TaobaoGoodsDownException e) {
|
| | | try {
|
| | | monitorService.addClientAPIMonitor(MonitorFactory.createClientAPI(request, 0, 0, "商品下架"));
|
| | | } catch (Exception e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | | // 商品下架
|
| | | ThreadUtil.run(new Runnable() {
|
| | | public void run() {
|
| | |
| | | * -IOS的idfa广告标识信息
|
| | | */
|
| | | @RequestMapping(value = "guessLikeByDevice")
|
| | | public void guessUserLikeByDevice(AcceptData acceptData, String imei, String idfa, int page, PrintWriter out) {
|
| | | public void guessUserLikeByDevice(AcceptData acceptData, String imei, String idfa, int page,
|
| | | HttpServletRequest request, PrintWriter out) {
|
| | | int pageSize = Constant.PAGE_SIZE;
|
| | | JSONArray array = new JSONArray();
|
| | | Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder()).create();
|
| | |
| | | if (!StringUtil.isNullOrEmpty(imei) || !StringUtil.isNullOrEmpty(idfa)) {
|
| | | long startTime = java.lang.System.currentTimeMillis();
|
| | | TaoBaoSearchResult result = TaoKeApiUtil.guessDeviceLike(page, 50, imei, idfa);
|
| | | LogHelper.test("首页为你推荐(淘宝)加载时间:" + (java.lang.System.currentTimeMillis() - startTime));
|
| | |
|
| | | if (result != null && result.getTaoBaoGoodsBriefs() != null) {
|
| | | // 筛选
|
| | |
| | | && goods.getBiz30day() > 1000)
|
| | | goodsList.add(goods);
|
| | | }
|
| | | try {
|
| | | monitorService.addClientAPIMonitor(MonitorFactory.createClientAPI(request, 0,
|
| | | (int) (java.lang.System.currentTimeMillis() - startTime), "推荐数量:" + goodsList.size()));
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | Collections.shuffle(goodsList);
|
| | | goodsList = goodsList.size() > 20 ? goodsList.subList(0, 20) : goodsList;
|
| | | for (TaoBaoGoodsBrief goods : goodsList) {
|
| | | array.add(gson.toJson(TaoBaoUtil.getTaoBaoGoodsBriefExtra(goods, proportion, fcRate, "")));
|
| | | }
|
| | | } else {
|
| | | try {
|
| | | monitorService.addClientAPIMonitor(MonitorFactory.createClientAPI(request, 0,
|
| | | (int) (java.lang.System.currentTimeMillis() - startTime), "无推荐"));
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | RecommendBannerV2 recommendBanner = superRecommendBanner.getRecommendBanner();
|
| | | // 淘特价暂时修改
|
| | | if (system.getId() == 7) {
|
| | | recommendBanner.getJumpDetail().setActivity(
|
| | | recommendBanner.getJumpDetail().getActivity()
|
| | | recommendBanner.getJumpDetail().setActivity(recommendBanner.getJumpDetail().getActivity()
|
| | | .replace("com.yeshi.ec.rebate.myapplication", "com.yeshi.ec.taospecial"));
|
| | | }
|
| | |
|
| | |
| | | out.print(JsonUtil.loadTrueResult(root));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 新版推荐专题管理(1.4.0)
|
| | | * |
| | | * @param acceptData
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getNewRecommendInfo")
|
| | | public void getNewRecommendInfo(AcceptData acceptData, String specialCard, String swiperCard, PrintWriter out) {
|
| | |
|
| | | System system = systemService.getSystemCache(acceptData.getPlatform(), acceptData.getPackages());
|
| | | if (system == null) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "系统不存在"));
|
| | | return;
|
| | | }
|
| | | |
| | | List<SwiperPicture> listswiper = null;
|
| | | if (!StringUtil.isNullOrEmpty(specialCard)) {
|
| | | try {
|
| | | |
| | | listswiper = swiperPictureService.getByBannerCard(swiperCard);
|
| | | |
| | | if (listswiper != null && listswiper.size() > 0) {
|
| | | for (SwiperPicture swiperPicture: listswiper) {
|
| | | swiperPicture.setBannerId(null);
|
| | | swiperPicture.setCreatetime(null);
|
| | | swiperPicture.setUpdatetime(null);
|
| | | swiperPicture.setState(null);
|
| | | swiperPicture.setRemark(null);
|
| | | }
|
| | | }
|
| | | |
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | Special miaoShaSpecial = null;
|
| | | List<Special> honestList = new ArrayList<Special>();
|
| | | List<Special> specialList = new ArrayList<Special>();
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(specialCard)) {
|
| | | try {
|
| | | List<Special> listSpecial = specialService.listBySystemAndCard(specialCard, system.getId());
|
| | | |
| | | if (listSpecial != null && listSpecial.size() > 0) {
|
| | | for (Special special: listSpecial) {
|
| | | special.setCreatetime(null);
|
| | | special.setUpdatetime(null);
|
| | | special.setState(null);
|
| | | special.setRemark(null);
|
| | | special.setCard(null);
|
| | | special.setCardId(null);
|
| | | |
| | | if ("限时秒杀".equals(special.getName())) {
|
| | | miaoShaSpecial = special;
|
| | | continue;
|
| | | }
|
| | | |
| | | if ("arc".equals(special.getShowType())) {
|
| | | // 同一行专题
|
| | | honestList.add(special);
|
| | | } else {
|
| | | // 其他专题
|
| | | specialList.add(special);
|
| | | }
|
| | | }
|
| | | }
|
| | | |
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | |
| | | }
|
| | |
|
| | | /* 限时秒杀 - 时间处理 */
|
| | | JSONObject msJSON = JSONObject.fromObject(new Gson().toJson(miaoShaSpecial));
|
| | | if (miaoShaSpecial != null) {
|
| | | // 获取秒杀
|
| | | int[] hours = new int[] { 0, 9, 12, 14, 16, 20, 22 };
|
| | | int hour = -1;
|
| | | Calendar calendar = Calendar.getInstance();
|
| | | calendar.setTimeInMillis(Long.parseLong(acceptData.getTime()));
|
| | | int nowHour = calendar.get(Calendar.HOUR_OF_DAY);
|
| | | for (int i = 0; i < hours.length - 1; i++) {
|
| | | if (nowHour >= hours[i] && nowHour < hours[i + 1]) {
|
| | | hour = hours[i + 1];
|
| | | break;
|
| | | }
|
| | | }
|
| | | |
| | | if (hour < 0)
|
| | | hour = 24;
|
| | | long time = TimeUtil.convertToTimeTemp(TimeUtil.getGernalTime(calendar.getTimeInMillis(), "yyyy-MM-dd"),
|
| | | "yyyy-MM-dd") + 1000 * 60 * 60 * hour;
|
| | | msJSON.put("time", time);
|
| | | }
|
| | |
|
| | | JSONObject root = new JSONObject();
|
| | | root.put("banner", listswiper);
|
| | | root.put("honest", honestList);
|
| | | root.put("special", specialList);
|
| | | root.put("miaoSha", msJSON);
|
| | |
|
| | | out.print(JsonUtil.loadTrueResult(root));
|
| | | |
| | | }
|
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 商品基本详情 (1.4.0)
|
| | | * |
| | | * @param acceptData
|
| | | * @param id
|
| | | * @param uid
|
| | |
| | |
|
| | | // 获取淘客参数
|
| | | ClientTBPid clientTBPid = null;
|
| | | |
| | |
|
| | | if (StringUtil.isNullOrEmpty(uid)) {
|
| | | // 用户未登录
|
| | |
| | | }
|
| | |
|
| | | LogHelper.test("获取PID耗时:" + (java.lang.System.currentTimeMillis() - startTime));
|
| | |
|
| | |
|
| | | final String clientPid = clientTBPid.getPid();
|
| | | final List<TaoBaoGoodsBrief> goodsList = new ArrayList<>();
|
| | |
| | | finalImgList.add(img);
|
| | | }
|
| | |
|
| | | |
| | | JSONObject goods = new JSONObject();
|
| | | goods.put("auctionId", tb.getAuctionId());
|
| | | goods.put("imgList", finalImgList);
|
| | |
| | | goods.put("userType", tb.getUserType() == 1 ? 2 : 1);
|
| | | goods.put("price", tb.getReservePrice().toString());
|
| | | goods.put("zkPrice", tb.getZkPrice().toString());
|
| | |
|
| | |
|
| | | // 红包
|
| | | String rateStr = hongBaoManageService.get("hongbao_goods_proportion");
|
| | |
| | | if (StringUtil.isNullOrEmpty(uid)) {
|
| | | data.put("collected", false);
|
| | | } else {
|
| | | CollectionGoods collectionGoods = |
| | | collectionGoodsService.findByUidAndAuctionId(Long.parseLong(uid), Long.parseLong(id));
|
| | | CollectionGoods collectionGoods = collectionGoodsService.findByUidAndAuctionId(Long.parseLong(uid),
|
| | | Long.parseLong(id));
|
| | | data.put("collected", collectionGoods != null ? true : false);
|
| | | }
|
| | |
|
| | | // 测试
|
| | | SystemClientParams params = |
| | | systemClientParamsService.getSystemClientParamsBySystemAndKey(system, "goods_detail_jump_taobao");
|
| | | SystemClientParams params = systemClientParamsService.getSystemClientParamsBySystemAndKey(system,
|
| | | "goods_detail_jump_taobao");
|
| | | if ("1".equalsIgnoreCase((params.getValue() + "").trim())) {
|
| | | data.put("native", true);
|
| | | } else {
|
| | |
| | | if (convertInServer && !StringUtil.isNullOrEmpty(tb.getCouponLink())) {
|
| | | couponInfo.put("couponUrl", tb.getCouponLink());
|
| | | } else {
|
| | | couponInfo.put("couponUrl", TaoBaoCouponUtil.getCoupleUrl(tb.getCouponActivityId() + "", pid, tb.getAuctionId() + ""));
|
| | | couponInfo.put("couponUrl",
|
| | | TaoBaoCouponUtil.getCoupleUrl(tb.getCouponActivityId() + "", pid, tb.getAuctionId() + ""));
|
| | | }
|
| | |
|
| | | couponInfo.put("couponAmount", NumberUtil.subZeroAndDot(tb.getCouponAmount().toString()));
|
| | | couponInfo.put("couponTime", "使用期限:" + tb.getCouponEffectiveStartTime().replace("-", ".") + "-" + tb.getCouponEffectiveEndTime().replace("-", "."));
|
| | | couponInfo.put("couponTime", "使用期限:" + tb.getCouponEffectiveStartTime().replace("-", ".") + "-"
|
| | | + tb.getCouponEffectiveEndTime().replace("-", "."));
|
| | | goods.put("couponInfo", couponInfo);
|
| | |
|
| | | // 领券人列表
|
| | |
| | | String jumpUrl = "https://item.taobao.com/item.htm?id=" + tb.getAuctionId();
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(tb.getCouponActivityId())) {// 有券,跳转券链接
|
| | | jumpUrl = TaoBaoCouponUtil.getCoupleUrl(tb.getCouponActivityId(), clientTBPid.getPid(), "" + tb.getAuctionId());
|
| | | jumpUrl = TaoBaoCouponUtil.getCoupleUrl(tb.getCouponActivityId(), clientTBPid.getPid(),
|
| | | "" + tb.getAuctionId());
|
| | | }
|
| | |
|
| | | // 设置跳转链接
|
| | |
| | | ScanHistory sh = TaoBaoUtil.getScanHistory(goodsInfo);
|
| | | sh.setId(0);
|
| | | sh.setDevice(acceptData.getDevice());
|
| | | sh.setSystem(systemService.getSystem(acceptData.getPlatform(),
|
| | | acceptData.getPackages()));
|
| | | sh.setSystem(systemService.getSystem(acceptData.getPlatform(), acceptData.getPackages()));
|
| | | sh.setCreatetime(new Date());
|
| | | if (!StringUtil.isNullOrEmpty(tempUid)) {
|
| | | sh.setUid(Long.parseLong(tempUid));
|
| | |
| | | });
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 获取图文详情(1.4.0)
|
| | | * |
| | | * @param acceptData
|
| | | * @param id
|
| | | * @param out
|
| | |
| | |
|
| | | /**
|
| | | * 商品详情推荐1.4.0
|
| | | * |
| | | * @param acceptData
|
| | | * @param id
|
| | | * @param out
|
| | |
| | |
|
| | | });
|
| | |
|
| | | |
| | | List<TaoBaoGoodsBrief> listQuality = new ArrayList<TaoBaoGoodsBrief>();
|
| | |
|
| | | try {
|
| | |
| | | } catch (Exception e2) {
|
| | | e2.printStackTrace();
|
| | | }
|
| | | |
| | |
|
| | | // 取偶数个数据
|
| | | if (listExtra.size() % 2 != 0) {
|