| | |
| | | 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.yeshi.fanli.service.inter.homemodule.SuperSpecialService;
|
| | | 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 SuperRecommendBannerV2Service superRecommendBannerV2Service;
|
| | | |
| | |
|
| | | @Resource
|
| | | private ShamUserService shamUserService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private MonitorService monitorService;
|
| | |
|
| | | @RequestMapping(value = "getrecommendsection")
|
| | | public void getRecommendSection(AcceptData acceptData, int index, PrintWriter out) {
|
| | |
| | |
|
| | | // 新版商品图文详情
|
| | | @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() {
|
| | |
| | | for (TaoBaoGoodsBrief taoBaoGoodsBrief : recommendGoodsList) {
|
| | | if (taoBaoGoodsBrief == null)
|
| | | continue;
|
| | | |
| | |
|
| | | re.add(TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion, fcRate, ""));
|
| | | }
|
| | | out.print(JsonUtil.loadTrueResult(JsonUtil.getApiCommonGson().toJson(re)));
|
| | |
| | | * -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()
|
| | | .replace("com.yeshi.ec.rebate.myapplication", "com.yeshi.ec.taospecial"));
|
| | | recommendBanner.getJumpDetail().setActivity(recommendBanner.getJumpDetail().getActivity()
|
| | | .replace("com.yeshi.ec.rebate.myapplication", "com.yeshi.ec.taospecial"));
|
| | | }
|
| | |
|
| | | listBanner.add(recommendBanner);
|
| | |
| | |
|
| | | out.print(JsonUtil.loadTrueResult(root));
|
| | | }
|
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 商品基本详情 (1.4.0)
|
| | | * |
| | | * @param acceptData
|
| | | * @param id
|
| | | * @param uid
|
| | |
| | | */
|
| | | @RequestMapping(value = "getgoodsinfo", method = RequestMethod.POST)
|
| | | public void getGoodsInfo(AcceptData acceptData, String id, String uid, PrintWriter out) {
|
| | | |
| | | if ("0".equalsIgnoreCase(uid)){
|
| | |
|
| | | if ("0".equalsIgnoreCase(uid)) {
|
| | | uid = "";
|
| | | }
|
| | | |
| | |
|
| | | if (StringUtil.isNullOrEmpty(id)) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "请上传id"));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | System system = systemService.getSystemCache(acceptData.getPlatform(), acceptData.getPackages());
|
| | | if (system == null) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "系统不存在"));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("invalid", false);
|
| | | |
| | |
|
| | | // IOS是否正在上线
|
| | | if ("ios".equalsIgnoreCase(acceptData.getPlatform())) {
|
| | | String version = acceptData.getVersion();
|
| | |
| | |
|
| | | // 获取淘客参数
|
| | | ClientTBPid clientTBPid = null;
|
| | | |
| | | |
| | |
|
| | | if (StringUtil.isNullOrEmpty(uid)) {
|
| | | // 用户未登录
|
| | | if (acceptData.getPlatform().equalsIgnoreCase("android")) {
|
| | |
| | | } else {
|
| | | clientTBPid = tbPidService.getIOSDefault();
|
| | | }
|
| | | |
| | |
|
| | | } else {
|
| | | |
| | |
|
| | | // 用户已经登录
|
| | | TBPid tbPid = null;
|
| | | if (acceptData.getPlatform().equalsIgnoreCase("android")) {
|
| | | |
| | | tbPid = tbPidService.getTBPid(Long.parseLong(uid),PidUser.TYPE_FANLI_ANDROID);
|
| | | |
| | |
|
| | | tbPid = tbPidService.getTBPid(Long.parseLong(uid), PidUser.TYPE_FANLI_ANDROID);
|
| | |
|
| | | if (tbPid == null) {
|
| | | clientTBPid = tbPidService.getAndroidDefault();
|
| | | } else {
|
| | | String siteId = tbPid.getPid().split("_")[2];
|
| | | String adzoneId = tbPid.getPid().split("_")[3];
|
| | | TaoBaoUnionConfig config = taoBaoUnionConfigService.getConfigByAppIdCache(siteId);
|
| | | clientTBPid = new ClientTBPid(config.getAppKey(),tbPid.getPid(), siteId, adzoneId);
|
| | | clientTBPid = new ClientTBPid(config.getAppKey(), tbPid.getPid(), siteId, adzoneId);
|
| | | }
|
| | |
|
| | | } else {
|
| | | |
| | |
|
| | | tbPid = tbPidService.getTBPid(Long.parseLong(uid), PidUser.TYPE_FANLI_IOS);
|
| | | |
| | |
|
| | | if (tbPid == null) {
|
| | | clientTBPid = tbPidService.getIOSDefault();
|
| | | } else {
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | LogHelper.test("获取PID耗时:" + (java.lang.System.currentTimeMillis() - startTime));
|
| | | LogHelper.test("获取PID耗时:" + (java.lang.System.currentTimeMillis() - startTime));
|
| | |
|
| | | |
| | | final String clientPid = clientTBPid.getPid();
|
| | | final List<TaoBaoGoodsBrief> goodsList = new ArrayList<>();
|
| | | // 是否在服务端进行转链
|
| | | boolean convertInServer = configService.isConvertTaoBaoLinkInServer();
|
| | | |
| | |
|
| | | List<String> taskList = new ArrayList<>();
|
| | | // 获取商品基本信息
|
| | | taskList.add("goods");
|
| | | |
| | |
|
| | | taskList.stream().parallel().forEach(task -> {
|
| | | if (task.equalsIgnoreCase("goods")) {
|
| | | JSONObject ticket = new JSONObject();
|
| | | TaoBaoGoodsBrief goods = null;
|
| | | |
| | | if (!convertInServer) {
|
| | | |
| | | try {
|
| | | goods = redisManager.getTaoBaoGoodsBrief(Long.parseLong(id));
|
| | | } catch (TaobaoGoodsDownException e) {
|
| | | // 商品下架
|
| | | ThreadUtil.run(new Runnable() {
|
| | | public void run() {
|
| | | taoBaoGoodsUpdateService.deleteTaoBaoGoods(Long.parseLong(id));
|
| | | }
|
| | | });
|
| | | JSONObject ticket = new JSONObject();
|
| | | TaoBaoGoodsBrief goods = null;
|
| | |
|
| | | }
|
| | | |
| | | } else {
|
| | | String appId = clientPid.split("_")[2];
|
| | | TaoBaoUnionConfig config = taoBaoUnionConfigService.getConfigByAppIdCache(appId);
|
| | | TaoKeAppInfo app = new TaoKeAppInfo();
|
| | | app.setAdzoneId(clientPid.split("_")[3]);
|
| | | app.setAppKey(config.getAppKey());
|
| | | app.setAppSecret(config.getAppSecret());
|
| | | app.setPid(clientPid);
|
| | | |
| | | try {
|
| | | goods = TaoKeApiUtil.searchGoodsDetail(Long.parseLong(id), app);
|
| | | if (goods != null) {
|
| | | ticket.put("clickUrl", goods.getAuctionUrl());
|
| | | // 测试使用
|
| | | ticket.put("couponUrl", goods.getCouponLink());
|
| | | data.put("ticket", ticket);
|
| | | }
|
| | | if (!convertInServer) {
|
| | |
|
| | | } catch (NumberFormatException e) {
|
| | | e.printStackTrace();
|
| | | } catch (TaobaoGoodsDownException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | |
| | | }
|
| | |
|
| | | if (goods != null) {
|
| | | goodsList.add(goods);
|
| | | final TaoBaoGoodsBrief newGoods = goods;
|
| | | try {
|
| | | goods = redisManager.getTaoBaoGoodsBrief(Long.parseLong(id));
|
| | | } catch (TaobaoGoodsDownException e) {
|
| | | // 商品下架
|
| | | ThreadUtil.run(new Runnable() {
|
| | | public void run() {
|
| | | try {
|
| | | // 更新商品
|
| | | LogHelper.test("更新商品详情:" + newGoods.getAuctionId());
|
| | | taoBaoGoodsUpdateService.updateTaoBaoGoods(newGoods);
|
| | | } catch (TaobaoGoodsUpdateException e) {
|
| | |
|
| | | }
|
| | | taoBaoGoodsUpdateService.deleteTaoBaoGoods(Long.parseLong(id));
|
| | | }
|
| | | });
|
| | |
|
| | | }
|
| | |
|
| | | } else {
|
| | | String appId = clientPid.split("_")[2];
|
| | | TaoBaoUnionConfig config = taoBaoUnionConfigService.getConfigByAppIdCache(appId);
|
| | | TaoKeAppInfo app = new TaoKeAppInfo();
|
| | | app.setAdzoneId(clientPid.split("_")[3]);
|
| | | app.setAppKey(config.getAppKey());
|
| | | app.setAppSecret(config.getAppSecret());
|
| | | app.setPid(clientPid);
|
| | |
|
| | | try {
|
| | | goods = TaoKeApiUtil.searchGoodsDetail(Long.parseLong(id), app);
|
| | | if (goods != null) {
|
| | | ticket.put("clickUrl", goods.getAuctionUrl());
|
| | | // 测试使用
|
| | | ticket.put("couponUrl", goods.getCouponLink());
|
| | | data.put("ticket", ticket);
|
| | | }
|
| | |
|
| | | } catch (NumberFormatException e) {
|
| | | e.printStackTrace();
|
| | | } catch (TaobaoGoodsDownException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | }
|
| | | });
|
| | |
|
| | | if (goods != null) {
|
| | | goodsList.add(goods);
|
| | | final TaoBaoGoodsBrief newGoods = goods;
|
| | | ThreadUtil.run(new Runnable() {
|
| | | public void run() {
|
| | | try {
|
| | | // 更新商品
|
| | | LogHelper.test("更新商品详情:" + newGoods.getAuctionId());
|
| | | taoBaoGoodsUpdateService.updateTaoBaoGoods(newGoods);
|
| | | } catch (TaobaoGoodsUpdateException e) {
|
| | |
|
| | | }
|
| | | }
|
| | | });
|
| | | }
|
| | | }
|
| | | });
|
| | |
|
| | | TaoBaoGoodsBrief tb = null;
|
| | | if (goodsList.size() > 0){
|
| | | if (goodsList.size() > 0) {
|
| | | tb = goodsList.get(0);
|
| | | }
|
| | |
|
| | |
| | | out.print(JsonUtil.loadFalseResult(2, "商品不存在"));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | if (tb.getImgList() == null) {
|
| | | tb.setImgList(new ArrayList<>());
|
| | | }
|
| | | |
| | |
|
| | | tb.getImgList().add(0, tb.getPictUrl());
|
| | |
|
| | | List<String> finalImgList = new ArrayList<>();
|
| | | for (String img : tb.getImgList()) {
|
| | | finalImgList.add(img);
|
| | | }
|
| | | |
| | | |
| | |
|
| | | JSONObject goods = new JSONObject();
|
| | | goods.put("auctionId", tb.getAuctionId());
|
| | | goods.put("imgList", finalImgList);
|
| | |
| | | goods.put("price", tb.getReservePrice().toString());
|
| | | goods.put("zkPrice", tb.getZkPrice().toString());
|
| | |
|
| | | |
| | | // 红包
|
| | | String rateStr = hongBaoManageService.get("hongbao_goods_proportion");
|
| | | String hongBao = TaoBaoUtil.getGoodsHongBaoInfo(tb, new BigDecimal(rateStr));
|
| | | goods.put("hongBao", hongBao);
|
| | | // 30天销量
|
| | | goods.put("saleCount", TaoBaoUtil.getSaleCount(tb.getBiz30day()));
|
| | | |
| | |
|
| | | // 分享赚
|
| | | BigDecimal shareMoney = taoBaoGoodsBriefService.getShareGoodsUserHongBao(tb);
|
| | | data.put("shareMoney","¥" + shareMoney);
|
| | | data.put("shareMoney", "¥" + shareMoney);
|
| | | // 分享赚人提示
|
| | | List<ShamUser> listShareUser = shamUserService.listRandShareUser(10, shareMoney, 1, 5);
|
| | |
|
| | |
| | | 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 {
|
| | | data.put("native", false);
|
| | | }
|
| | | |
| | |
|
| | | // 获取PID
|
| | | String pid = clientTBPid.getPid();
|
| | | LogHelper.test(String.format("PID: uid-%s pid-%s", uid + "", pid));
|
| | | |
| | |
|
| | | // 是否有券
|
| | | goods.put("coupon", StringUtil.isNullOrEmpty(tb.getCouponInfo()) ? false : true);
|
| | | |
| | | goods.put("coupon", StringUtil.isNullOrEmpty(tb.getCouponInfo()) ? false : true);
|
| | |
|
| | | // 领券人列表
|
| | | List<ShamUser> listCouponUser = null;
|
| | | |
| | |
|
| | | // 获取券信息
|
| | | if (!StringUtil.isNullOrEmpty(tb.getCouponInfo())) {
|
| | | BigDecimal quanPrice = TaoBaoUtil.getAfterUseCouplePrice(tb);
|
| | | JSONObject couponInfo = new JSONObject();
|
| | | couponInfo.put("couponPrice", quanPrice.toString());
|
| | | |
| | |
|
| | | // 服务端转链
|
| | | if (convertInServer && !StringUtil.isNullOrEmpty(tb.getCouponLink())) {
|
| | | 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);
|
| | | |
| | |
|
| | | // 领券人列表
|
| | | listCouponUser = shamUserService.listRandCouponUser(5, 1, 300);
|
| | | }
|
| | |
|
| | | data.put("tbPidInfo", clientTBPid);
|
| | |
|
| | | String jumpUrl = "https://item.taobao.com/item.htm?id=" + tb.getAuctionId();
|
| | | |
| | | 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());
|
| | | }
|
| | |
|
| | | // 设置跳转链接
|
| | |
| | | jumpUrl = tb.getAuctionUrl();
|
| | | }
|
| | | goods.put("jumpUrl", jumpUrl);
|
| | | |
| | |
|
| | | TaoBaoShopInfo tbShopInfo = redisManager.getTBShopInfo(tb.getShopTitle(), tb.getSellerId(), tb.getAuctionId());
|
| | | if (tbShopInfo != null) {
|
| | | String shopType = tbShopInfo.getShopType();
|
| | |
| | | }
|
| | | // 店铺
|
| | | goods.put("shopInfo", tbShopInfo);
|
| | | |
| | |
|
| | | // 分享路径
|
| | | String shareUrl = String.format("%s?id=" + tb.getAuctionId(), Constant.systemCommonConfig.getAppShareInfoUrl());
|
| | | |
| | |
|
| | | data.put("shareUrl", shareUrl);
|
| | | data.put("goods", goods);
|
| | | data.put("shareUsers", listShareUser);
|
| | |
| | | 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
|
| | | */
|
| | | @RequestMapping(value = "getgoodsdetailimgs", method = RequestMethod.POST)
|
| | | public void getgoodsdetailimgs(AcceptData acceptData, String id, PrintWriter out) {
|
| | | public void getgoodsdetailimgs(AcceptData acceptData, String id, PrintWriter out) {
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(id)) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "请上传id"));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | List<String> detailImgs = new ArrayList<>();
|
| | | JSONArray detailImgsSize = new JSONArray();
|
| | |
|
| | |
| | | JSONObject data = new JSONObject();
|
| | | data.put("detailImgs", detailImgs);
|
| | | data.put("detailImgsSize", detailImgsSize);
|
| | | |
| | |
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * 商品详情推荐1.4.0
|
| | | * |
| | | * @param acceptData
|
| | | * @param id
|
| | | * @param out
|
| | |
| | | }
|
| | |
|
| | | List<TaoBaoGoodsBrief> goodsList = TaoKeApiUtil.getRelationGoodsRecommend(id, 10);
|
| | | |
| | |
|
| | | // 重新做推荐
|
| | | if (goodsList == null || goodsList.size() == 0) {
|
| | | |
| | |
|
| | | goodsList = new ArrayList<>();
|
| | | |
| | |
|
| | | TaoBaoGoodsBrief goods = null;
|
| | | |
| | |
|
| | | try {
|
| | | goods = redisManager.getTaoBaoGoodsBrief(id);
|
| | | } catch (TaobaoGoodsDownException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | |
| | | if (goods == null){
|
| | |
|
| | | if (goods == null) {
|
| | | // 从我们的商品库搜索
|
| | | CollectionGoods cgoods = collectionGoodsService.findByAuctionId(id);
|
| | | |
| | |
|
| | | // 商品有本地缓存
|
| | | if (cgoods != null) {
|
| | | // 按名字搜索商品
|
| | | SearchFilter sf = new SearchFilter();
|
| | | sf.setKey(cgoods.getTitle().substring(0, cgoods.getTitle().length() / 2));
|
| | | |
| | |
|
| | | TaoBaoSearchResult result = TaoBaoUtil.search(sf);
|
| | | |
| | |
|
| | | if (result != null && result.getTaoBaoGoodsBriefs() != null
|
| | | && result.getTaoBaoGoodsBriefs().size() > 0){
|
| | | |
| | | && result.getTaoBaoGoodsBriefs().size() > 0) {
|
| | |
|
| | | for (TaoBaoGoodsBrief gds : result.getTaoBaoGoodsBriefs()) {
|
| | | if (goodsList.size() == 10) {
|
| | | break;
|
| | | }
|
| | | goodsList.add(gds);
|
| | | }
|
| | | |
| | |
|
| | | }
|
| | | |
| | |
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | } catch (Exception e2) {
|
| | | e2.printStackTrace();
|
| | | }
|
| | | |
| | |
|
| | | }
|
| | | }
|
| | |
|
| | | Map<String, String> map = hongBaoManageService.convertMap();
|
| | | String proportion = map.get("hongbao_goods_proportion");
|
| | | String fcRate = map.get("hongbao_fc_ratio");
|
| | | |
| | |
|
| | | List<TaoBaoGoodsBriefExtra> listExtra = new ArrayList<TaoBaoGoodsBriefExtra>();
|
| | | |
| | |
|
| | | goodsList.parallelStream().forEach(goods -> {
|
| | | // 获取详情
|
| | | TaoBaoGoodsBrief taoBaoGoodsBrief = null;
|
| | |
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | |
| | |
|
| | | if (taoBaoGoodsBrief != null) {
|
| | | listExtra.add(TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion, fcRate, ""));
|
| | | }
|
| | | |
| | |
|
| | | });
|
| | |
|
| | | |
| | | List<TaoBaoGoodsBrief> listQuality = new ArrayList<TaoBaoGoodsBrief>();
|
| | | |
| | |
|
| | | try {
|
| | | List<QualityFactory> listRecommend = qualityGoodsService.recommendByAuctionId(id);
|
| | | |
| | |
|
| | | if (listRecommend != null && listRecommend.size() > 1) {
|
| | | for (QualityFactory quality : listRecommend) {
|
| | |
|
| | |
| | | } 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("listGuess", JsonUtil.getApiCommonGson().toJson(listExtra));
|
| | | data.put("listQuality", JsonUtil.getApiCommonGson().toJson(listQuality));
|
| | | |
| | |
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|