| | |
| | | import java.io.PrintWriter;
|
| | | import java.math.BigDecimal;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Date;
|
| | | import java.util.HashMap;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | |
| | | import org.yeshi.utils.JsonUtil;
|
| | | import org.yeshi.utils.taobao.TbImgUtil;
|
| | |
|
| | | import com.google.gson.Gson;
|
| | | import com.yeshi.fanli.dto.ConfigParamsDTO;
|
| | | import com.yeshi.fanli.dto.jd.JDCategoryInfo;
|
| | | import com.yeshi.fanli.dto.jd.JDCouponInfo;
|
| | | import com.yeshi.fanli.dto.pdd.PDDGoodsDetail;
|
| | | import com.yeshi.fanli.dto.pdd.PDDGoodsResult;
|
| | | import com.yeshi.fanli.dto.pdd.PDDPromotionUrl;
|
| | | import com.yeshi.fanli.dto.pdd.PDDSearchFilter;
|
| | | import com.yeshi.fanli.dto.taobao.DaTaoKeFilterResult;
|
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.entity.bus.user.ShamUser;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.UserMoneyExtra;
|
| | | import com.yeshi.fanli.entity.bus.user.vip.UserLevelEnum;
|
| | | import com.yeshi.fanli.entity.goods.CollectionGoodsV2;
|
| | | import com.yeshi.fanli.entity.goods.CommonGoods;
|
| | | import com.yeshi.fanli.entity.jd.JDGoods;
|
| | | import com.yeshi.fanli.entity.jd.JDGoodsClass;
|
| | | 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.TLJBuyGoods;
|
| | | import com.yeshi.fanli.entity.taobao.TLJFreeBuyGoods;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoShop;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoUnionConfig;
|
| | |
| | | import com.yeshi.fanli.exception.taobao.TaobaoGoodsDownException;
|
| | | import com.yeshi.fanli.exception.taobao.TaobaoGoodsUpdateException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.common.JumpDetailV2Service;
|
| | | import com.yeshi.fanli.service.inter.config.BusinessSystemService;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.service.inter.config.SystemClientParamsService;
|
| | | import com.yeshi.fanli.service.inter.dynamic.GoodsEvaluateService;
|
| | | import com.yeshi.fanli.service.inter.goods.CollectionGoodsV2Service;
|
| | | import com.yeshi.fanli.service.inter.goods.ScanHistoryV2Service;
|
| | | import com.yeshi.fanli.service.inter.goods.TaoBaoGoodsBriefService;
|
| | | import com.yeshi.fanli.service.inter.hongbao.HongBaoManageService;
|
| | | import com.yeshi.fanli.service.inter.jd.JDGoodsClassService;
|
| | | import com.yeshi.fanli.service.inter.money.UserMoneyExtraService;
|
| | | import com.yeshi.fanli.service.inter.order.OrderHongBaoMoneyComputeService;
|
| | | import com.yeshi.fanli.service.inter.order.config.HongBaoManageService;
|
| | | import com.yeshi.fanli.service.inter.redpack.UserTaoLiJinNewbiesService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TLJBuyGoodsService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TLJFreeBuyGoodsService;
|
| | | 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.UserTaoLiJinOriginService;
|
| | | import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinRecordService;
|
| | | import com.yeshi.fanli.service.inter.user.ShamUserService;
|
| | | import com.yeshi.fanli.service.inter.user.TBPidService;
|
| | | 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.service.inter.user.integral.IntegralGetService;
|
| | | import com.yeshi.fanli.service.inter.user.vip.UserVIPInfoService;
|
| | | import com.yeshi.fanli.service.inter.user.vip.UserVipConfigService;
|
| | | import com.yeshi.fanli.service.manger.user.UserLevelManager;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TaoBaoConstant;
|
| | | import com.yeshi.fanli.util.ThreadUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.util.VersionUtil;
|
| | | import com.yeshi.fanli.util.cache.JDGoodsCacheUtil;
|
| | | import com.yeshi.fanli.util.cache.PinDuoDuoCacheUtil;
|
| | | import com.yeshi.fanli.util.cache.TaoBaoGoodsCacheUtil;
|
| | | import com.yeshi.fanli.util.dataoke.DaTaoKeApiUtil;
|
| | | import com.yeshi.fanli.util.factory.goods.GoodsDetailVOFactory;
|
| | | import com.yeshi.fanli.util.factory.goods.ShopInfoVOFactory;
|
| | | import com.yeshi.fanli.util.jd.JDApiUtil;
|
| | |
| | | import com.yeshi.fanli.util.pinduoduo.PinDuoDuoUtil;
|
| | | 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.util.user.UserLevelUtil;
|
| | | import com.yeshi.fanli.vo.goods.CouponInfoVO;
|
| | | import com.yeshi.fanli.vo.goods.GoodsDetailExtraVO;
|
| | | import com.yeshi.fanli.vo.goods.GoodsDetailVO;
|
| | | import com.yeshi.fanli.vo.goods.MoneyInfoVO;
|
| | | import com.yeshi.fanli.vo.goods.OtherInfo;
|
| | | import com.yeshi.fanli.vo.goods.RewardCouponVO;
|
| | | import com.yeshi.fanli.vo.goods.ShareVO;
|
| | | import com.yeshi.fanli.vo.goods.ShopInfoVO;
|
| | | import com.yeshi.fanli.vo.msg.ClientTextStyleVO;
|
| | | import com.yeshi.fanli.vo.tlj.NewUserHongBao;
|
| | | import com.yeshi.fanli.vo.tlj.ReduceHongBao;
|
| | | import com.yeshi.fanli.vo.tlj.SpreadHongBao;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | |
| | | private TaoBaoUnionConfigService taoBaoUnionConfigService;
|
| | |
|
| | | @Resource
|
| | | private DaTaoKeGoodsDetailService daTaoKeGoodsDetailService;
|
| | | private DaTaoKeGoodsDetailV2Service daTaoKeGoodsDetailV2Service;
|
| | |
|
| | | @Resource
|
| | | private HongBaoManageService hongBaoManageService;
|
| | | private OrderHongBaoMoneyComputeService orderHongBaoMoneyComputeService;
|
| | |
|
| | | @Resource
|
| | | private SystemClientParamsService systemClientParamsService;
|
| | |
| | | private UserGoodsStorageService userGoodsStorageService;
|
| | |
|
| | | @Resource
|
| | | private UserTaoLiJinOriginService userTaoLiJinOriginService;
|
| | |
|
| | | @Resource
|
| | | private ConfigTaoLiJinService configTaoLiJinService;
|
| | |
|
| | | @Resource
|
| | | private UserTaoLiJinRecordService userTaoLiJinRecordService;
|
| | |
|
| | | @Resource
|
| | | private UserInfoExtraService userInfoExtraService;
|
| | |
| | |
|
| | | @Resource
|
| | | private PinDuoDuoCacheUtil pinDuoDuoCacheUtil;
|
| | |
|
| | | @Resource
|
| | | private IntegralGetService integralGetService;
|
| | |
|
| | | @Resource
|
| | | private JumpDetailV2Service jumpDetailV2Service;
|
| | |
|
| | | @Resource
|
| | | private JDGoodsClassService jdGoodsClassService;
|
| | |
|
| | | @Resource
|
| | | private TLJFreeBuyGoodsService tljFreeBuyGoodsService;
|
| | |
|
| | | @Resource
|
| | | private UserTaoLiJinNewbiesService userTaoLiJinNewbiesService;
|
| | |
|
| | | @Resource
|
| | | private UserVIPInfoService userVIPInfoService;
|
| | |
|
| | | @Resource
|
| | | private UserVipConfigService userVipConfigService;
|
| | |
|
| | | @Resource
|
| | | private GoodsEvaluateService goodsEvaluateService;
|
| | |
|
| | | @Resource
|
| | | private UserLevelManager userLevelManager;
|
| | |
|
| | | @Resource
|
| | | private HongBaoManageService hongBaoManageService;
|
| | |
|
| | | private ConfigParamsDTO getParamsDTO(String platform, String version, Long uid) {
|
| | | UserLevelEnum level = UserLevelEnum.daRen;
|
| | | if (uid != null && uid > 0) {
|
| | | level = userLevelManager.getUserLevel(uid);
|
| | | if (level != null) {
|
| | | if (System.currentTimeMillis() < Constant.NEW_ORDER_FANLI_RULE_TIME)
|
| | | level = UserLevelUtil.getOldLevel(level);
|
| | | }
|
| | | }
|
| | | if (level == null)
|
| | | level = UserLevelEnum.daRen;
|
| | | return orderHongBaoMoneyComputeService.getShowComputeRate(platform, version, level);
|
| | | }
|
| | |
|
| | | private TaoBaoGoodsBrief filterDaTaoKeGoodsInfo(TaoBaoGoodsBrief goods) {
|
| | | try {
|
| | | DaTaoKeFilterResult result = daTaoKeGoodsDetailV2Service.filterTaoBaoGoods(goods);
|
| | | if (result.getFilterType() == DaTaoKeFilterResult.FILTER_TYPE_COUPON
|
| | | || result.getFilterType() == DaTaoKeFilterResult.FILTER_TYPE_PRICE_AND_COUPON) {
|
| | | // 缓存基础链接
|
| | | String dpid = null;
|
| | | if (TaoBaoUtil.isSpecialGoods(goods.getMaterialLibType())) {
|
| | | dpid = TaoBaoConstant.TAOBAO_SPECIAL_PID_DEFAULT;
|
| | | } else {
|
| | | dpid = TaoBaoConstant.TAOBAO_RELATION_AS_SPECIAL_PID;
|
| | | }
|
| | | String link = taoBaoGoodsCacheUtil.getBaseConvertLink(goods.getAuctionId(), dpid);
|
| | | if (!StringUtil.isNullOrEmpty(link)) {
|
| | | // result.getGoods().setCouponLink(link);
|
| | | return result.getGoods();
|
| | | } else {
|
| | | link = DaTaoKeApiUtil.convertLink(goods.getAuctionId(), dpid);
|
| | | if (!StringUtil.isNullOrEmpty(link)) {
|
| | | // result.getGoods().setCouponLink(link);
|
| | | taoBaoGoodsCacheUtil.cacheBaseConvertLink(goods.getAuctionId(), dpid, link);
|
| | | }
|
| | | return result.getGoods();
|
| | | }
|
| | | }
|
| | | } catch (Exception e) {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | |
|
| | | return goods;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 淘宝商品详情
|
| | |
| | |
|
| | | LogHelper.test("获取PID耗时:" + (java.lang.System.currentTimeMillis() - startTime));
|
| | |
|
| | | final List<TaoBaoGoodsBrief> goodsList = new ArrayList<>();
|
| | | // final List<TaoBaoGoodsBrief> goodsList = new ArrayList<>();
|
| | | // 是否在服务端进行转链
|
| | | boolean convertInServer = configService.isConvertTaoBaoLinkInServer();
|
| | |
|
| | |
| | | app.setPid(TaoBaoConstant.TAOBAO_COMMON_PID);
|
| | | app.setAdzoneId(TaoBaoConstant.TAOBAO_COMMON_PID.split("_")[3]);
|
| | | goods = TaoKeApiUtil.searchGoodsDetail(id, app);
|
| | |
|
| | | final TaoBaoGoodsBrief finalGoods = goods;
|
| | | if (goods != null) {
|
| | | ThreadUtil.run(new Runnable() {
|
| | |
| | | } catch (TaobaoGoodsDownException e) {
|
| | | // 商品下架
|
| | | ThreadUtil.run(new Runnable() {
|
| | |
|
| | | public void run() {
|
| | | taoBaoGoodsUpdateService.offlineTaoBaoGoods(id);
|
| | | }
|
| | | });
|
| | |
|
| | | }
|
| | |
|
| | | } else {
|
| | |
| | | }
|
| | |
|
| | | if (goods != null) {
|
| | | goodsList.add(goods);
|
| | | final TaoBaoGoodsBrief newGoods = goods;
|
| | | ThreadUtil.run(new Runnable() {
|
| | | public void run() {
|
| | |
| | | });
|
| | | }
|
| | |
|
| | | TaoBaoGoodsBrief tb = null;
|
| | | if (goodsList.size() > 0) {
|
| | | tb = goodsList.get(0);
|
| | | }
|
| | | TaoBaoGoodsBrief tb = goods;
|
| | |
|
| | | if (tb == null) {
|
| | | out.print(JsonUtil.loadFalseResult(2, "商品不存在"));
|
| | |
| | | tb.setImgList(new ArrayList<>());
|
| | | }
|
| | |
|
| | | tb.getImgList().add(0, tb.getPictUrl());
|
| | | // tb.getImgList().add(0, tb.getPictUrl());
|
| | |
|
| | | List<String> finalImgList = new ArrayList<>();
|
| | | for (String img : tb.getImgList()) {
|
| | | finalImgList.add(TbImgUtil.getTBSizeImg(img, 600));
|
| | | }
|
| | |
|
| | | if (finalImgList.size() == 0) {
|
| | | finalImgList.add(tb.getPictUrl());
|
| | | }
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(tb.getPictUrlWhite()))
|
| | | finalImgList.add(0, tb.getPictUrlWhite());
|
| | |
|
| | | // 移除相同图片
|
| | | if (finalImgList.size() > 0)
|
| | | for (int i = 0; i < finalImgList.size(); i++) {
|
| | | if (i < finalImgList.size() - 1)
|
| | | if (TbImgUtil.getTBSizeImg(finalImgList.get(i), 600)
|
| | | .equalsIgnoreCase(TbImgUtil.getTBSizeImg(finalImgList.get(i + 1), 600))) {
|
| | | finalImgList.remove(i--);
|
| | | }
|
| | | }
|
| | |
|
| | | tb.setImgList(finalImgList);
|
| | |
|
| | | // 大淘客商品过滤
|
| | | try {
|
| | | goods = daTaoKeGoodsDetailService.filterTaoBaoGoods(goods);
|
| | | goods = filterDaTaoKeGoodsInfo(goods);
|
| | | } catch (Exception e) {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | |
|
| | | BigDecimal fanLiRate = hongBaoManageService.getFanLiRate();
|
| | | BigDecimal shareRate = hongBaoManageService.getShareRate();
|
| | | GoodsDetailVO goodsDetail = GoodsDetailVOFactory.convertTaoBao(goods, null, fanLiRate, shareRate);
|
| | | ConfigParamsDTO paramsDTO = getParamsDTO(acceptData.getPlatform(), acceptData.getVersion(), uid);
|
| | | paramsDTO.setBaseFanliRate(hongBaoManageService.getBaseFanliRate());
|
| | |
|
| | | GoodsDetailVO goodsDetail = GoodsDetailVOFactory.convertTaoBao(goods, paramsDTO);
|
| | | if (goodsDetail != null && goodsDetail.getMoneyInfo() != null && userVIPInfoService.isVIP(uid)) {
|
| | | goodsDetail.getMoneyInfo().setFanliMoney(goodsDetail.getMoneyInfo().getMaxMoney());
|
| | | goodsDetail.getMoneyInfo().setShareMoney("¥" + TaoBaoUtil.getGoodsHongBaoMoney(goods,
|
| | | hongBaoManageService.getShareRate(UserLevelEnum.superVIP)));
|
| | | goodsDetail.getMoneyInfo().setRateInfo(goodsDetail.getMoneyInfo().getMaxRateInfo());
|
| | | goodsDetail.getMoneyInfo().setCompositionInfo(goodsDetail.getMoneyInfo().getMaxCompositionInfo());
|
| | | }
|
| | | goodsDetail.getMoneyInfo()
|
| | | .setRateInfoHelpUrl(configService.get(ConfigKeyEnum.goodsDetailFanliRateHelpUrl.getKey()));
|
| | |
|
| | | if (TaoBaoUtil.isYUShou(goods)) {
|
| | | if (!StringUtil.isNullOrEmpty(goods.getPresaleDiscountFeeText())) {
|
| | | if (goodsDetail.getLabels() == null)
|
| | | goodsDetail.setLabels(new ArrayList<>());
|
| | | goodsDetail.getLabels().add(new ClientTextStyleVO(goods.getPresaleDiscountFeeText(), "#FF2B4E"));
|
| | | }
|
| | | }
|
| | | // 在标题添加优惠信息
|
| | |
|
| | | // 店铺信息
|
| | | TaoBaoShop shop = taoBaoShopService.getTaoBaoShop(id, goods.getSellerId());
|
| | |
| | | }
|
| | |
|
| | | extraVO.setTbPidInfo(clientTBPid);
|
| | | extraVO.setDetailUrl("http://apph5.yeshitv.com/apppage/goods_img.html?id=" + id);
|
| | | extraVO.setDetailUrl("http://apph5.banliapp.com/apppage/goods_img.html?id=" + id);
|
| | |
|
| | | // 分享赚人提示
|
| | | MoneyInfoVO moneyInfo = goodsDetail.getMoneyInfo();
|
| | |
| | |
|
| | | String h5Url = String.format("http://%s%s?uid=%s&id=%s&appType=flq", configService.getH5Host(),
|
| | | Constant.systemCommonConfig.getShareGoodsPagePath(), "", id + "");
|
| | | try {
|
| | | extraVO.setH5Url(HttpUtil.getShortLink(h5Url));
|
| | | } catch (Exception e) {
|
| | | extraVO.setH5Url(h5Url);
|
| | | }
|
| | |
|
| | | extraVO.setH5Url(h5Url);
|
| | |
|
| | | String helpLink = null;
|
| | | boolean fanliValid = true;
|
| | | boolean shareValid = true;
|
| | | int moneyType = 1;
|
| | |
|
| | | // 推广红包
|
| | | if (from != null && from.equals("taolijin")) {
|
| | | // 计算推广红包
|
| | | String warningRate = configTaoLiJinService.getValueByKey("warning_value", new Date());
|
| | | BigDecimal spreadMoney = TaoLiJinUtil.getSpreadMoney(warningRate, goods);
|
| | |
|
| | | // 推广红包 不能小于1
|
| | | if (spreadMoney.compareTo(new BigDecimal(1.1)) < 0) {
|
| | | out.print(JsonUtil.loadFalseResult(2, "商品不存在"));
|
| | | return;
|
| | | }
|
| | |
|
| | | // 取消新用户自购
|
| | | boolean isNewUser = false;// userInfoExtraService.isNewUser(uid);
|
| | | if (isNewUser) {
|
| | | // 判定为老用户: 新人只要使用了新人红包,也就是那1块钱,那么,他看到的分享爆款中的商品-就只能分享。
|
| | | long countRecord = userTaoLiJinRecordService.countRecordByUid(uid);
|
| | | if (countRecord > 0) {
|
| | | isNewUser = false;
|
| | | }
|
| | | }
|
| | |
|
| | | SpreadHongBao spreadHongBao = new SpreadHongBao();
|
| | | if (isNewUser) {
|
| | | spreadHongBao.setMoney("1");
|
| | | } else {
|
| | | moneyType = 2;
|
| | | fanliValid = false;
|
| | | spreadHongBao.setMoney(spreadMoney.toString());
|
| | |
|
| | | ClientTextStyleVO textStyleVO1 = new ClientTextStyleVO();
|
| | | textStyleVO1.setContent("分享");
|
| | | textStyleVO1.setColor("#666666");
|
| | | ClientTextStyleVO textStyleVO2 = new ClientTextStyleVO();
|
| | | textStyleVO2.setContent("赚奖金");
|
| | | textStyleVO2.setColor("#F14242");
|
| | | ClientTextStyleVO textStyleVO3 = new ClientTextStyleVO();
|
| | | textStyleVO3.setContent(",好友");
|
| | | textStyleVO3.setColor("#666666");
|
| | | ClientTextStyleVO textStyleVO4 = new ClientTextStyleVO();
|
| | | textStyleVO4.setContent("领红包!");
|
| | | textStyleVO4.setColor("#F14242");
|
| | |
|
| | | List<ClientTextStyleVO> listText = new ArrayList<ClientTextStyleVO>();
|
| | | listText.add(textStyleVO1);
|
| | | listText.add(textStyleVO2);
|
| | | listText.add(textStyleVO3);
|
| | | listText.add(textStyleVO4);
|
| | | extraVO.setTip(listText);
|
| | | }
|
| | |
|
| | | spreadHongBao.setName("推广红包 ");
|
| | | spreadHongBao.setTip("当日领取,当日内使用,过期失效");
|
| | | OtherInfo otherInfo = new OtherInfo();
|
| | | otherInfo.setSpreadHongBao(spreadHongBao);
|
| | | goodsDetail.setOtherInfo(otherInfo);
|
| | |
|
| | | goodsDetail.getMoneyInfo().setFanliMoney(TaoBaoUtil.getGoodsHongBaoInfo(goods,
|
| | | hongBaoManageService.getTLJShareRate(System.currentTimeMillis())));
|
| | | goodsDetail.getMoneyInfo().setShareMoney(TaoBaoUtil.getGoodsHongBaoInfo(goods,
|
| | | hongBaoManageService.getTLJShareRate(System.currentTimeMillis())));
|
| | |
|
| | | // 用户淘礼金
|
| | | UserMoneyExtra userMoneyExtra = userMoneyExtraService.selectByPrimaryKey(uid);
|
| | | if (userMoneyExtra == null || userMoneyExtra.getTlj() == null) {
|
| | | extraVO.setUserTLJ(new BigDecimal(0).setScale(2).toString());
|
| | | } else {
|
| | | extraVO.setUserTLJ(userMoneyExtra.getTlj().setScale(2).toString());
|
| | | }
|
| | | helpLink = configTaoLiJinService.getValueByKey("share_goods_help_link", new Date());
|
| | |
|
| | | } else if (from != null && from.equals("taolijin_buy")) {
|
| | | if (from != null && from.equals("taolijin_buy")) {
|
| | | // 查询分享库
|
| | | TLJBuyGoods buyGoods = tljBuyGoodsService.selectByAuctionIdAndDay(id,
|
| | | TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyy-MM-dd"));
|
| | |
| | | moneyType = 2;
|
| | | fanliValid = true;
|
| | | shareValid = false;
|
| | | helpLink = configService.get("zigoulijian_nofanli_help");
|
| | | helpLink = configService.get(ConfigKeyEnum.zigoulijianNofanliHelp.getKey());
|
| | |
|
| | | String tljHongBao = TaoBaoUtil.getGoodsHongBaoMoney(goods, new BigDecimal(70)).toString();
|
| | | BigDecimal tljHongBao = TaoBaoUtil.getGoodsHongBaoMoney(goods, TaoBaoConstant.OWN_BUY_WITHOUT_FANLI_RATE);
|
| | |
|
| | | ReduceHongBao reduceHongBao = new ReduceHongBao();
|
| | | reduceHongBao.setLeft(buyGoods.getLeftHongBaoCount());
|
| | | reduceHongBao.setMoney(tljHongBao);
|
| | | reduceHongBao.setMoney(tljHongBao.toString());
|
| | | reduceHongBao.setName("付款立减 ");
|
| | | reduceHongBao.setTip("当日领取,当日内使用,过期失效");
|
| | | reduceHongBao.setTotal(buyGoods.getTotalHongBaoCount());
|
| | |
|
| | | OtherInfo otherInfo = new OtherInfo();
|
| | | otherInfo.setReduceHongBao(reduceHongBao);
|
| | | goodsDetail.setOtherInfo(otherInfo);
|
| | |
|
| | | // 1.6.5后改为福利价
|
| | | if (com.yeshi.fanli.util.VersionUtil.greaterThan_1_6_5(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | | if (goodsDetail.getCouponPrice() != null
|
| | | && goodsDetail.getCouponPrice().compareTo(new BigDecimal(0)) > 0)
|
| | | goodsDetail.setCouponPrice(goodsDetail.getCouponPrice().subtract(tljHongBao));
|
| | | else
|
| | | goodsDetail.setZkPrice(goodsDetail.getZkPrice().subtract(tljHongBao));
|
| | | }
|
| | | } else if (from != null && from.equals("taolijin_free_buy")) {
|
| | | TLJFreeBuyGoods freeGoods = tljFreeBuyGoodsService.selectByAuctionIdAndDay(id,
|
| | | TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyy-MM-dd"));
|
| | | if (freeGoods == null) {
|
| | | out.print(JsonUtil.loadFalseResult(2, "免单商品已下架"));
|
| | | return;
|
| | | }
|
| | |
|
| | | fanliValid = true;
|
| | | shareValid = false;
|
| | | BigDecimal couponPrice = goodsDetail.getCouponPrice();
|
| | | if (couponPrice == null)
|
| | | couponPrice = goodsDetail.getZkPrice();
|
| | |
|
| | | NewUserHongBao newUserHongBao = new NewUserHongBao();
|
| | | newUserHongBao.setMoney(couponPrice.setScale(2).toString());
|
| | | newUserHongBao.setName("新人红包 ");
|
| | | newUserHongBao.setTip("当日领取,当日内使用,过期失效");
|
| | | newUserHongBao.setLeft(1);
|
| | | newUserHongBao.setTotal(1);
|
| | |
|
| | | OtherInfo otherInfo = new OtherInfo();
|
| | | otherInfo.setReduceHongBao(newUserHongBao);
|
| | | goodsDetail.setOtherInfo(otherInfo);
|
| | |
|
| | | // 专属标签
|
| | | List<ClientTextStyleVO> labels = new ArrayList<ClientTextStyleVO>();
|
| | | labels.add(new ClientTextStyleVO("新人专属", "#FE0014"));
|
| | | labels.add(new ClientTextStyleVO("实付0元", "#FF9600"));
|
| | | goodsDetail.setLabels(labels);
|
| | |
|
| | | } else {// 普通购买
|
| | | OtherInfo otherInfo = new OtherInfo();
|
| | | RewardCouponVO rewardCoupon = new RewardCouponVO();
|
| | | rewardCoupon.setJumpDetail(jumpDetailV2Service.getByTypeCache("web"));
|
| | | JSONObject params1 = new JSONObject();
|
| | | if (!VersionUtil.greaterThan_2_0_5(acceptData.getPlatform(), acceptData.getVersion()))
|
| | | params1.put("url", configService.get(ConfigKeyEnum.specialGuideRewardCouponLink.getKey()));
|
| | | else
|
| | | params1.put("url", userVipConfigService.getValueByKey("vip_link"));
|
| | | rewardCoupon.setMaxMoney(goodsDetail.getMoneyInfo().getMaxMoney());
|
| | | if (VersionUtil.greaterThan_2_0_5(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | | rewardCoupon.setDesc("返");
|
| | | params1.put("url", userVipConfigService.getValueByKey("vip_link"));
|
| | | rewardCoupon.getJumpDetail().setNeedLogin(true);
|
| | | } else
|
| | | rewardCoupon.setDesc("用返利奖励券最高返");
|
| | | rewardCoupon.setParams(params1.toString());
|
| | |
|
| | | otherInfo.setRewardCoupon(rewardCoupon);
|
| | | if ("ios".equalsIgnoreCase(acceptData.getPlatform())
|
| | | && configService.iosOnLining(Integer.parseInt(acceptData.getVersion())))
|
| | | otherInfo.setRewardCoupon(null);
|
| | |
|
| | | goodsDetail.setOtherInfo(otherInfo);
|
| | | }
|
| | | extraVO.setFanliValid(fanliValid);
|
| | |
| | |
|
| | | // 分享路径
|
| | | if (StringUtil.isNullOrEmpty(helpLink)) {
|
| | | helpLink = configService.get("no_rebate_help_link");
|
| | | helpLink = configService.get(ConfigKeyEnum.noRebateHelpLink.getKey());
|
| | | }
|
| | |
|
| | | // 分享路径
|
| | |
| | | shareInfoVO.setHelpLink(helpLink);
|
| | | extraVO.setShare(shareInfoVO);
|
| | |
|
| | | if (goodsDetail.isHasCoupon()) {
|
| | | // 设置couponList
|
| | | List<CouponInfoVO> couponInfoList = new ArrayList<>();
|
| | | couponInfoList.add(goodsDetail.getCouponInfo());
|
| | | goodsDetail.setCouponInfoList(couponInfoList);
|
| | | }
|
| | | JSONObject object = new JSONObject();
|
| | | object.put("extra", JsonUtil.getApiCommonGson().toJson(extraVO));
|
| | | object.put("goods", JsonUtil.getApiCommonGson().toJson(goodsDetail));
|
| | |
| | | * @param from
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getDetailJD", method = RequestMethod.POST)
|
| | | @RequestMapping(value = "getDetailJD")
|
| | | public void getDetialJD(AcceptData acceptData, Long id, Long uid, String from, PrintWriter out) {
|
| | | // uid=2255993L;
|
| | | // 系统验证
|
| | | BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(),
|
| | | acceptData.getPackages());
|
| | |
| | | // 保存缓存
|
| | | jdGoodsCacheUtil.saveGoodsInfo(jdGoods);
|
| | |
|
| | | BigDecimal fanLiRate = hongBaoManageService.getFanLiRate();
|
| | | BigDecimal shareRate = hongBaoManageService.getShareRate();
|
| | | GoodsDetailVO goodsDetail = GoodsDetailVOFactory.convertJDGoods(jdGoods, fanLiRate, shareRate);
|
| | | ConfigParamsDTO paramsDTO = getParamsDTO(acceptData.getPlatform(), acceptData.getVersion(), uid);
|
| | | paramsDTO.setBaseFanliRate(hongBaoManageService.getBaseFanliRate());
|
| | | GoodsDetailVO goodsDetail = GoodsDetailVOFactory.convertJDGoods(jdGoods, paramsDTO);
|
| | | if (goodsDetail != null && goodsDetail.getMoneyInfo() != null && userVIPInfoService.isVIP(uid)) {
|
| | | goodsDetail.getMoneyInfo().setFanliMoney(goodsDetail.getMoneyInfo().getMaxMoney());
|
| | | goodsDetail.getMoneyInfo().setShareMoney("¥"
|
| | | + JDUtil.getGoodsFanLiMoney(jdGoods, hongBaoManageService.getShareRate(UserLevelEnum.superVIP)));
|
| | | goodsDetail.getMoneyInfo().setRateInfo(goodsDetail.getMoneyInfo().getMaxRateInfo());
|
| | | goodsDetail.getMoneyInfo().setCompositionInfo(goodsDetail.getMoneyInfo().getMaxCompositionInfo());
|
| | | }
|
| | | goodsDetail.getMoneyInfo()
|
| | | .setRateInfoHelpUrl(configService.get(ConfigKeyEnum.goodsDetailFanliRateHelpUrl.getKey()));
|
| | |
|
| | | // 附加信息
|
| | | OtherInfo otherInfo = new OtherInfo();
|
| | |
|
| | | // 京东plus返利
|
| | | String maxMoneyPlus = null;
|
| | | JDCategoryInfo categoryInfo = jdGoods.getCategoryInfo();
|
| | | if (categoryInfo != null && categoryInfo.getCid3() != null && jdGoods.getCommissionInfo() != null) {
|
| | | Long cid3 = categoryInfo.getCid3();
|
| | | JDGoodsClass threeClass = jdGoodsClassService.getThreeClassByCid(Integer.parseInt(cid3.toString()));
|
| | | if (threeClass != null && threeClass.getSelfComm() != null
|
| | | && threeClass.getSelfComm().compareTo(new BigDecimal(0)) > 0) {
|
| | | BigDecimal commissionShare = jdGoods.getCommissionInfo().getCommissionShare();
|
| | | // plus比例 小于正常比例
|
| | | if (commissionShare != null && commissionShare.compareTo(threeClass.getSelfComm()) > 0) {
|
| | | jdGoods.setCommissionPlus(threeClass.getSelfComm());
|
| | | // plus返利
|
| | | BigDecimal fanliMoneyPlus = JDUtil.getGoodsFanLiMoneyPlus(jdGoods,
|
| | | hongBaoManageService.getFanLiRate());
|
| | | otherInfo.setFanliMoneyPlus("京东plus返¥" + fanliMoneyPlus);
|
| | | // 使用奖励券最高返
|
| | | if (VersionUtil.greaterThan_2_0_5(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | | maxMoneyPlus = "(京东plus返¥" + JDUtil.getGoodsFanLiMoneyPlus(jdGoods,
|
| | | hongBaoManageService.getFanLiRate(UserLevelEnum.superVIP)) + ")";
|
| | | } else
|
| | | maxMoneyPlus = "(京东plus最高返¥"
|
| | | + fanliMoneyPlus.add(MoneyBigDecimalUtil.mul(fanliMoneyPlus, Constant.MAX_REWARD_RATE))
|
| | | + ")";
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | // 奖励券返利
|
| | | RewardCouponVO rewardCoupon = new RewardCouponVO();
|
| | | rewardCoupon.setMaxMoneyPlus(maxMoneyPlus);
|
| | | rewardCoupon.setJumpDetail(jumpDetailV2Service.getByTypeCache("web"));
|
| | | JSONObject params1 = new JSONObject();
|
| | | if (!VersionUtil.greaterThan_2_0_5(acceptData.getPlatform(), acceptData.getVersion()))
|
| | | params1.put("url", configService.get(ConfigKeyEnum.specialGuideRewardCouponLink.getKey()));
|
| | | else
|
| | | params1.put("url", userVipConfigService.getValueByKey("vip_link"));
|
| | |
|
| | | rewardCoupon.setMaxMoney(goodsDetail.getMoneyInfo().getMaxMoney());
|
| | | if (VersionUtil.greaterThan_2_0_5(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | | rewardCoupon.setDesc("返");
|
| | | params1.put("url", userVipConfigService.getValueByKey("vip_link"));
|
| | | rewardCoupon.getJumpDetail().setNeedLogin(true);
|
| | | } else {
|
| | | rewardCoupon.setDesc("用返利奖励券最高返");
|
| | | }
|
| | | rewardCoupon.setParams(params1.toString());
|
| | |
|
| | | otherInfo.setRewardCoupon(rewardCoupon);
|
| | | if ("ios".equalsIgnoreCase(acceptData.getPlatform())
|
| | | && configService.iosOnLining(Integer.parseInt(acceptData.getVersion())))
|
| | | otherInfo.setRewardCoupon(null);
|
| | |
|
| | | goodsDetail.setOtherInfo(otherInfo);
|
| | |
|
| | | CouponInfoVO couponInfo = goodsDetail.getCouponInfo();
|
| | | if (couponInfo != null) {
|
| | | // 券链接处理
|
| | | String materialId = "https://item.jd.com/" + id + ".html";
|
| | | String url = JDApiUtil.convertLink(materialId, couponInfo.getLink(), JDApiUtil.POSITION_COUPON + "", null);
|
| | | String url = JDApiUtil.convertLinkWithSubUnionId(materialId, couponInfo.getLink(),
|
| | | JDApiUtil.POSITION_COUPON + "", null);
|
| | | couponInfo.setLink(url);
|
| | | }
|
| | |
|
| | |
| | | List<ShamUser> listShareUser = new ArrayList<ShamUser>();
|
| | |
|
| | | // 京东开启分享
|
| | | String open = configService.get("share_jd_open");
|
| | | String open = configService.get(ConfigKeyEnum.shareOpenJD.getKey());
|
| | | if ("1".equals(open.trim())) {
|
| | | extraVO.setShareValid(true);
|
| | | MoneyInfoVO moneyInfo = goodsDetail.getMoneyInfo();
|
| | |
| | | extraVO.setFanliValid(true);
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(helpLink)) {
|
| | | helpLink = configService.get("no_rebate_help_link");
|
| | | helpLink = configService.get(ConfigKeyEnum.noRebateHelpLink.getKey());
|
| | | }
|
| | |
|
| | | ShareVO shareInfoVO = new ShareVO();
|
| | |
| | | out.print(JsonUtil.loadTrueResult(object.toString()));
|
| | |
|
| | | final JDGoods goods = jdGoods;
|
| | | final Long fuid = uid;
|
| | | ThreadUtil.run(new Runnable() {
|
| | | public void run() {
|
| | | // 添加浏览记录
|
| | | try {
|
| | | scanHistoryV2Service.addJDScanHistory(uid, acceptData.getDevice(), goods);
|
| | | scanHistoryV2Service.addJDScanHistory(fuid, acceptData.getDevice(), goods);
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | try {
|
| | | goodsEvaluateService.updateJDGoods(goods);
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | BigDecimal fanLiRate = hongBaoManageService.getFanLiRate();
|
| | | BigDecimal shareRate = hongBaoManageService.getShareRate();
|
| | | GoodsDetailVO goodsDetail = GoodsDetailVOFactory.convertPDDGoods(pddGoods, fanLiRate, shareRate);
|
| | | ConfigParamsDTO paramsDTO = getParamsDTO(acceptData.getPlatform(), acceptData.getVersion(), uid);
|
| | | paramsDTO.setBaseFanliRate(hongBaoManageService.getBaseFanliRate());
|
| | |
|
| | | GoodsDetailVO goodsDetail = GoodsDetailVOFactory.convertPDDGoods(pddGoods, paramsDTO);
|
| | | if (goodsDetail != null && goodsDetail.getMoneyInfo() != null && userVIPInfoService.isVIP(uid)) {
|
| | | goodsDetail.getMoneyInfo().setFanliMoney(goodsDetail.getMoneyInfo().getMaxMoney());
|
| | | goodsDetail.getMoneyInfo().setShareMoney("¥" + PinDuoDuoUtil.getGoodsFanLiMoney(pddGoods,
|
| | | hongBaoManageService.getShareRate(UserLevelEnum.superVIP)));
|
| | | goodsDetail.getMoneyInfo().setRateInfo(goodsDetail.getMoneyInfo().getMaxRateInfo());
|
| | | goodsDetail.getMoneyInfo().setCompositionInfo(goodsDetail.getMoneyInfo().getMaxCompositionInfo());
|
| | | }
|
| | | goodsDetail.getMoneyInfo()
|
| | | .setRateInfoHelpUrl(configService.get(ConfigKeyEnum.goodsDetailFanliRateHelpUrl.getKey()));
|
| | |
|
| | | // 附加信息
|
| | | OtherInfo otherInfo = new OtherInfo();
|
| | | RewardCouponVO rewardCoupon = new RewardCouponVO();
|
| | | rewardCoupon.setJumpDetail(jumpDetailV2Service.getByTypeCache("web"));
|
| | | JSONObject params1 = new JSONObject();
|
| | | if (!VersionUtil.greaterThan_2_0_5(acceptData.getPlatform(), acceptData.getVersion()))
|
| | | params1.put("url", configService.get(ConfigKeyEnum.specialGuideRewardCouponLink.getKey()));
|
| | | else
|
| | | params1.put("url", userVipConfigService.getValueByKey("vip_link"));
|
| | |
|
| | | rewardCoupon.setMaxMoney(goodsDetail.getMoneyInfo().getMaxMoney());
|
| | | if (VersionUtil.greaterThan_2_0_5(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | | rewardCoupon.setDesc("返");
|
| | | params1.put("url", userVipConfigService.getValueByKey("vip_link"));
|
| | | rewardCoupon.getJumpDetail().setNeedLogin(true);
|
| | | } else
|
| | | rewardCoupon.setDesc("用返利奖励券最高返");
|
| | | rewardCoupon.setParams(params1.toString());
|
| | | otherInfo.setRewardCoupon(rewardCoupon);
|
| | | if ("ios".equalsIgnoreCase(acceptData.getPlatform())
|
| | | && configService.iosOnLining(Integer.parseInt(acceptData.getVersion())))
|
| | | otherInfo.setRewardCoupon(null);
|
| | | goodsDetail.setOtherInfo(otherInfo);
|
| | |
|
| | | CouponInfoVO couponInfo = goodsDetail.getCouponInfo();
|
| | | PDDPromotionUrl convertUrl = null;
|
| | | if (couponInfo != null) {
|
| | |
| | | }
|
| | |
|
| | | // 图文详情
|
| | | extraVO.setDetailUrl("http://apph5.yeshitv.com/apppage/goods_img_pdd.html?id=" + id);
|
| | | extraVO.setDetailUrl("http://apph5.banliapp.com/apppage/goods_img_pdd.html?id=" + id);
|
| | |
|
| | | String salesTip = pddGoods.getSalesTip();
|
| | | if (!StringUtil.isNullOrEmpty(salesTip)) {
|
| | |
| | | extraVO.setShareValid(true);
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(helpLink)) {
|
| | | helpLink = configService.get("no_rebate_help_link");
|
| | | helpLink = configService.get(ConfigKeyEnum.noRebateHelpLink.getKey());
|
| | | }
|
| | |
|
| | | ShareVO shareInfoVO = new ShareVO();
|
| | |
| | | // 添加浏览记录
|
| | | try {
|
| | | scanHistoryV2Service.addPDDScanHistory(uid, acceptData.getDevice(), pddGoods);
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | try {
|
| | | goodsEvaluateService.updatePDDGoods(pddGoods);
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
| | | list = list.subList(0, 10);
|
| | | }
|
| | |
|
| | | BigDecimal fanLiRate = hongBaoManageService.getFanLiRate();
|
| | | BigDecimal shareRate = hongBaoManageService.getShareRate();
|
| | | ConfigParamsDTO paramsDTO = getParamsDTO(acceptData.getPlatform(), acceptData.getVersion(), null);
|
| | | List<GoodsDetailVO> listDetailVO = new ArrayList<GoodsDetailVO>();
|
| | |
|
| | | for (JDGoods goods : list) {
|
| | | listDetailVO.add(GoodsDetailVOFactory.convertJDGoods(goods, fanLiRate, shareRate));
|
| | | listDetailVO.add(GoodsDetailVOFactory.convertJDGoods(goods, paramsDTO));
|
| | | }
|
| | |
|
| | | // 取偶数个数据
|
| | |
| | | goodsList = goodsList.subList(0, 10);
|
| | | }
|
| | |
|
| | | BigDecimal fanLiRate = hongBaoManageService.getFanLiRate();
|
| | | BigDecimal shareRate = hongBaoManageService.getShareRate();
|
| | | ConfigParamsDTO paramsDTO = getParamsDTO(acceptData.getPlatform(), acceptData.getVersion(),
|
| | | null);
|
| | | for (PDDGoodsDetail goods : goodsList) {
|
| | | listDetailVO.add(GoodsDetailVOFactory.convertPDDGoods(goods, fanLiRate, shareRate));
|
| | | listDetailVO.add(GoodsDetailVOFactory.convertPDDGoods(goods, paramsDTO));
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | List<TaoBaoGoodsBrief> goodsList = TaoKeApiUtil.getRelationGoodsRecommend(id, 10);
|
| | | List<TaoBaoGoodsBrief> goodsList = TaoKeApiUtil.guessLikeByAuctionId(id, 10);
|
| | | // 初始化
|
| | | if (goodsList == null) {
|
| | | goodsList = new ArrayList<TaoBaoGoodsBrief>();
|
| | |
| | | try {
|
| | | goodsList = TaoKeApiUtil.getBatchGoodsInfo(ids);
|
| | | } catch (TaoKeApiException e1) {
|
| | | e1.printStackTrace();
|
| | | } catch (TaobaoGoodsDownException e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | |
|
| | | if (goodsList != null && goodsList.size() > 0) {
|
| | |
|
| | | BigDecimal fanLiRate = hongBaoManageService.getFanLiRate();
|
| | | BigDecimal shareRate = hongBaoManageService.getShareRate();
|
| | | ConfigParamsDTO paramsDTO = getParamsDTO(acceptData.getPlatform(), acceptData.getVersion(), null);
|
| | |
|
| | | goodsList.parallelStream().forEach(goods -> {
|
| | | if (goods != null) {
|
| | |
| | | }
|
| | |
|
| | | if (taoBaoGoodsBrief != null) {
|
| | | listExtra.add(
|
| | | GoodsDetailVOFactory.convertTaoBao(taoBaoGoodsBrief, null, fanLiRate, shareRate));
|
| | | listExtra.add(GoodsDetailVOFactory.convertTaoBao(taoBaoGoodsBrief, paramsDTO));
|
| | | }
|
| | | }
|
| | | });
|
| | |
| | | * @param acceptData
|
| | | * @param uid
|
| | | * @param id
|
| | | * @param couponUrl
|
| | | * -优惠券链接
|
| | | * @param source
|
| | | * @param request
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getJDLink")
|
| | | public void getJDLink(AcceptData acceptData, Long uid, Long id, String source, PrintWriter out) {
|
| | | public void getJDLink(AcceptData acceptData, Long uid, Long id, String couponUrl, String source, PrintWriter out) {
|
| | | if (uid == null || uid <= 0) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "用户ID不能为空"));
|
| | | return;
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | String couponUrl = null;
|
| | | String jumpLink = null;
|
| | | String materialId = "https://item.jd.com/" + id + ".html";
|
| | | JDCouponInfo couponInfo = goods.getCouponInfo();
|
| | | if (couponInfo != null) {
|
| | | couponUrl = couponInfo.getLink();
|
| | | if (StringUtil.isNullOrEmpty(couponUrl)) {
|
| | | JDCouponInfo couponInfo = JDUtil.getShowCouponInfo(goods.getCouponInfoList(), goods.getPrice());
|
| | | if (couponInfo != null) {
|
| | | couponUrl = couponInfo.getLink();
|
| | | }
|
| | | jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, JDApiUtil.POSITION_FANLI + "",
|
| | | uid + "");
|
| | | if (jumpLink == null) {
|
| | | jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, null, JDApiUtil.POSITION_FANLI + "",
|
| | | uid + "");
|
| | | }
|
| | | } else {
|
| | | jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, JDApiUtil.POSITION_FANLI + "",
|
| | | uid + "");
|
| | | }
|
| | | String jumpLink = JDApiUtil.convertLink(materialId, couponUrl, JDApiUtil.POSITION_FANLI + "", uid + "");
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("native", true);
|
| | | data.put("jumpLink", jumpLink);
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | |
|
| | | // 获得金币
|
| | | integralGetService.addCouponRebate(uid);
|
| | | }
|
| | |
|
| | | @RequestMapping(value = "getJDCouponLink")
|
| | | public void getJDCouponLink(AcceptData acceptData, Long id, String couponUrl, PrintWriter out) {
|
| | | if (StringUtil.isNullOrEmpty(couponUrl)) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "券链接不能为空"));
|
| | | return;
|
| | | }
|
| | | if (id == null || id <= 0) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "商品ID不能为空"));
|
| | | return;
|
| | | }
|
| | |
|
| | | String jumpLink = null;
|
| | | String materialId = "https://item.jd.com/" + id + ".html";
|
| | |
|
| | | jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, JDApiUtil.POSITION_FANLI + "", null);
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("native", true);
|
| | |
| | | PDDPromotionUrl convertUrl = PinDuoDuoApiUtil.convert(id, PinDuoDuoApiUtil.PID_FANLI + "", uid + "");
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("native", true);
|
| | |
|
| | | data.put("jumpLink", convertUrl.getUrl());
|
| | | data.put("nativeJumpLink", PinDuoDuoUtil.getAndroidNativeURI(convertUrl.getUrl()));
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | |
|
| | | // 获得金币
|
| | | integralGetService.addCouponRebate(uid);
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | }
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | | @RequestMapping(value = "listSimpleGoods", method = RequestMethod.POST)
|
| | | public void listSimpleGoods(AcceptData acceptData, String goodsInfo, PrintWriter out) {
|
| | | if (StringUtil.isNullOrEmpty(goodsInfo)) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "商品信息为空"));
|
| | | return;
|
| | | }
|
| | |
|
| | | net.sf.json.JSONArray array = net.sf.json.JSONArray.fromObject(goodsInfo);
|
| | |
|
| | | List<CommonGoods> commonGoodsList = new ArrayList<>();
|
| | |
|
| | | for (int i = 0; i < array.size(); i++) {
|
| | | JSONObject obj = array.optJSONObject(i);
|
| | | CommonGoods cg = new CommonGoods();
|
| | | cg.setGoodsId(obj.optLong("goodsId"));
|
| | | cg.setGoodsType(obj.optInt("goodsType"));
|
| | | commonGoodsList.add(cg);
|
| | | }
|
| | |
|
| | | if (commonGoodsList.size() > 9) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "最多同时获取9条数据"));
|
| | | return;
|
| | | }
|
| | |
|
| | | // 分离各个平台的商品信息
|
| | | List<Long> tbGoodsList = new ArrayList<>();
|
| | | List<Long> jdGoodsList = new ArrayList<>();
|
| | | List<Long> pddGoodsList = new ArrayList<>();
|
| | |
|
| | | List<String> keyList = new ArrayList<>();
|
| | |
|
| | | for (CommonGoods cg : commonGoodsList) {
|
| | | keyList.add(cg.getGoodsId() + "-" + cg.getGoodsType());
|
| | | if (cg.getGoodsType() == Constant.SOURCE_TYPE_TAOBAO) {
|
| | | tbGoodsList.add(cg.getGoodsId());
|
| | | } else if (cg.getGoodsType() == Constant.SOURCE_TYPE_JD) {
|
| | | jdGoodsList.add(cg.getGoodsId());
|
| | | } else if (cg.getGoodsType() == Constant.SOURCE_TYPE_PDD) {
|
| | | pddGoodsList.add(cg.getGoodsId());
|
| | | }
|
| | | }
|
| | |
|
| | | Map<String, GoodsDetailVO> tempGoodsList = new HashMap<>();
|
| | |
|
| | | ConfigParamsDTO params = new ConfigParamsDTO(hongBaoManageService.getFanLiRate(),
|
| | | hongBaoManageService.getShareRate(), new BigDecimal(80),
|
| | | hongBaoManageService.getFanLiRate(UserLevelEnum.superVIP));
|
| | |
|
| | | if (tbGoodsList.size() > 0) {
|
| | | List<TaoBaoGoodsBrief> goodsList = null;
|
| | | try {
|
| | | goodsList = TaoKeApiUtil.getBatchGoodsInfo(tbGoodsList);
|
| | | } catch (TaobaoGoodsDownException e) {
|
| | | e.printStackTrace();
|
| | | } catch (TaoKeApiException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | if (goodsList != null)
|
| | | for (TaoBaoGoodsBrief goods : goodsList) {
|
| | | goods.setTkRate(new BigDecimal(0));
|
| | | tempGoodsList.put(goods.getAuctionId() + "-" + Constant.SOURCE_TYPE_TAOBAO,
|
| | | GoodsDetailVOFactory.convertTaoBao(goods, params));
|
| | | }
|
| | | }
|
| | | if (jdGoodsList.size() > 0) {
|
| | | List<JDGoods> goodsList = JDApiUtil.getGoodsDetail(jdGoodsList);
|
| | | for (JDGoods goods : goodsList) {
|
| | | tempGoodsList.put(goods.getSkuId() + "-" + Constant.SOURCE_TYPE_JD,
|
| | | GoodsDetailVOFactory.convertJDGoods(goods, params));
|
| | | }
|
| | | }
|
| | | if (pddGoodsList.size() > 0) {
|
| | | List<PDDGoodsDetail> goodsList = PinDuoDuoApiUtil.listGoodsDetail(pddGoodsList);
|
| | | for (PDDGoodsDetail goods : goodsList) {
|
| | | tempGoodsList.put(goods.getGoodsId() + "-" + Constant.SOURCE_TYPE_PDD,
|
| | | GoodsDetailVOFactory.convertPDDGoods(goods, params));
|
| | | }
|
| | | }
|
| | | List<GoodsDetailVO> voList = new ArrayList<>();
|
| | | Gson gson = JsonUtil.getApiCommonGson();
|
| | | for (String key : keyList) {
|
| | | GoodsDetailVO vo = tempGoodsList.get(key);
|
| | | if (vo != null) {
|
| | | voList.add(vo);
|
| | | }
|
| | | }
|
| | | out.print(JsonUtil.loadTrueResult(gson.toJson(voList)));
|
| | | }
|
| | | }
|