| | |
| | | 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.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.entity.bus.homemodule.SwiperPicture;
|
| | | import com.yeshi.fanli.entity.bus.share.UserShareGoodsHistory;
|
| | | import com.yeshi.fanli.entity.bus.user.ShamUser;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.vip.UserLevelEnum;
|
| | | import com.yeshi.fanli.entity.goods.CollectionGoodsV2;
|
| | | import com.yeshi.fanli.entity.jd.JDGoods;
|
| | | import com.yeshi.fanli.entity.jd.JDGoodsClass;
|
| | | import com.yeshi.fanli.entity.system.ConfigKeyEnum;
|
| | | import com.yeshi.fanli.exception.share.UserShareGoodsRecordException;
|
| | | import com.yeshi.fanli.exception.user.UserInfoExtraException;
|
| | | 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.count.HongBaoV2CountService;
|
| | | import com.yeshi.fanli.service.inter.goods.CollectionGoodsV2Service;
|
| | | import com.yeshi.fanli.service.inter.goods.ScanHistoryV2Service;
|
| | | import com.yeshi.fanli.service.inter.goods.ShareGoodsService;
|
| | | import com.yeshi.fanli.service.inter.goods.TaoBaoGoodsBriefService;
|
| | | import com.yeshi.fanli.service.inter.homemodule.SwiperPictureService;
|
| | | 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.tlj.ConfigTaoLiJinService;
|
| | | import com.yeshi.fanli.service.inter.user.QrCodeService;
|
| | | import com.yeshi.fanli.service.inter.user.ShamUserService;
|
| | | import com.yeshi.fanli.service.inter.user.TBPidService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoService;
|
| | | import com.yeshi.fanli.service.inter.user.UserShareGoodsRecordService;
|
| | | import com.yeshi.fanli.service.inter.user.integral.IntegralGetService;
|
| | | import com.yeshi.fanli.service.inter.user.vip.UserVIPInfoService;
|
| | | import com.yeshi.fanli.tag.PageEntity;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.JumpDetailUtil;
|
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.ThreadUtil;
|
| | | 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.factory.CommonGoodsFactory;
|
| | | import com.yeshi.fanli.util.factory.goods.GoodsDetailVOFactory;
|
| | | import com.yeshi.fanli.util.jd.JDApiUtil;
|
| | |
| | | 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.homemodule.BannerVO;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | |
| | | @RequestMapping("/wxmp/api/v1/goods")
|
| | | public class GoodsController {
|
| | |
|
| | |
|
| | | @Resource
|
| | | private ConfigService configService;
|
| | |
|
| | |
|
| | |
|
| | | @Resource
|
| | | private ShamUserService shamUserService;
|
| | |
| | |
|
| | | @Resource
|
| | | private HongBaoManageService hongBaoManageService;
|
| | |
|
| | |
|
| | | |
| | | @Resource
|
| | | private OrderHongBaoMoneyComputeService orderHongBaoMoneyComputeService;
|
| | |
|
| | | @Resource
|
| | | private UserInfoExtraService userInfoExtraService;
|
| | |
|
| | |
|
| | | @Resource
|
| | | private ScanHistoryV2Service scanHistoryV2Service;
|
| | |
| | |
|
| | | @Resource
|
| | | private QrCodeService qrCodeService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private ShareGoodsService shareGoodsService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private UserShareGoodsRecordService userShareGoodsRecordService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private SwiperPictureService swiperPictureService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private HongBaoV2CountService hongBaoV2CountService;
|
| | |
|
| | | /**
|
| | | * 一级分类
|
| | | *
|
| | |
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getTopCategory", method = RequestMethod.POST)
|
| | | public void getTopCategory(WXMPAcceptData acceptData, PrintWriter out) {
|
| | | public void getTopCategory(WXMPAcceptData acceptData, Long uid, PrintWriter out) {
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("list", configService.get("jd_wxmp_class"));
|
| | | data.put("list", configService.get(ConfigKeyEnum.jdWXMPClass.getKey()));
|
| | |
|
| | | String tips = null;
|
| | | if (uid == null || uid <= 0) {
|
| | | tips = configService.get(ConfigKeyEnum.tipGuideNewUser.getKey());
|
| | | } else {
|
| | | long rebateOrder = hongBaoV2CountService.countRebateOrder(uid);
|
| | | long shareOrInviteOrder = hongBaoV2CountService.countShareOrInviteOrder(uid);
|
| | | if (rebateOrder + shareOrInviteOrder >= 3) {
|
| | | // 熟客版
|
| | | } else if (rebateOrder <= 0 && shareOrInviteOrder <= 0) {
|
| | | // 新人版
|
| | | tips = configService.get(ConfigKeyEnum.tipGuideNewUser.getKey());
|
| | | } else if (rebateOrder > 0 && shareOrInviteOrder <= 0) {
|
| | | // 省钱版
|
| | | tips = configService.get(ConfigKeyEnum.tipGuideSaveMoney.getKey());
|
| | | } else {
|
| | | // 赚钱版
|
| | | tips = configService.get(ConfigKeyEnum.tipGuideShareInvite.getKey());
|
| | | }
|
| | | }
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(tips)) {
|
| | | JSONObject tipData = JSONObject.fromObject(tips);
|
| | | data.put("tipData", tipData);
|
| | | }
|
| | |
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 一级分类商品
|
| | | *
|
| | |
| | | out.print(JsonUtil.loadFalseResult("分类ID为空"));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | if (page == 1) {
|
| | | // 轮播图
|
| | | String platform = acceptData.getPlatform();
|
| | | int version = Integer.parseInt(acceptData.getVersion());
|
| | | List<SwiperPicture> picList = swiperPictureService.getByBannerCardAndVersion("index_top", platform,
|
| | | List<BannerVO> picList = swiperPictureService.getByBannerCardAndVersion("index_top", platform,
|
| | | version);
|
| | | if (picList == null) {
|
| | | picList = new ArrayList<>();
|
| | | }
|
| | |
|
| | | for (SwiperPicture swiper : picList) {
|
| | | for (BannerVO swiper : picList) {
|
| | | JSONObject params = null;
|
| | | if (StringUtil.isNullOrEmpty(swiper.getParams())) {
|
| | | params = JSONObject.fromObject(swiper.getParams());
|
| | | }
|
| | | swiper.setJumpDetail(JumpDetailUtil.getWXMPJumDetail(swiper.getJumpDetail(), params));
|
| | | swiper.setParams(null);
|
| | | swiper.setJumpDetail(JumpDetailUtil.getWXMPJumDetail(swiper.getJumpDetail()));
|
| | | }
|
| | | data.put("bannerList", JsonUtil.getApiCommonGson().toJson(picList));
|
| | | }
|
| | | |
| | |
|
| | | JDFilter filterAPI = new JDFilter();
|
| | | filterAPI.setPageIndex(page);
|
| | | filterAPI.setPageSize(Constant.PAGE_SIZE);
|
| | |
| | | filterAPI.setIsHot(1); // 爆款
|
| | | filterAPI.setCid1(cid);
|
| | | JDSearchResult result = JDApiUtil.queryByKey(filterAPI);
|
| | | |
| | |
|
| | | long count = 0;
|
| | | JSONArray array = new JSONArray();
|
| | | if (result != null) {
|
| | |
| | | if (goodsList != null && goodsList.size() > 0) {
|
| | | Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
|
| | | .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
|
| | | ConfigParamsDTO paramsDTO = hongBaoManageService.getShowComputeRate(acceptData.getPlatform(),
|
| | | ConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate(acceptData.getPlatform(),
|
| | | acceptData.getVersion());
|
| | | for (JDGoods goods : goodsList) {
|
| | | GoodsDetailVO goodsDetailVO = GoodsDetailVOFactory.convertJDGoods(goods, paramsDTO);
|
| | |
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | | |
| | | |
| | | /**
|
| | | * 获取商品详情
|
| | | * |
| | | * @param acceptData
|
| | | * @param goodsId 商品id
|
| | | * @param uid |
| | | * @param code 邀请码
|
| | | * @param goodsType 商品类型
|
| | | * @param from 页面来源
|
| | | * @param goodsId
|
| | | * 商品id
|
| | | * @param uid
|
| | | * @param code
|
| | | * 邀请码
|
| | | * @param goodsType
|
| | | * 商品类型
|
| | | * @param from
|
| | | * 页面来源
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getGoodsDetial", method = RequestMethod.POST)
|
| | | public void getGoodsDetial(WXMPAcceptData acceptData, Long goodsId, Integer goodsType, String from, |
| | | Long uid, PrintWriter out) {
|
| | | @RequestMapping(value = "getGoodsDetial")
|
| | | public void getGoodsDetial(WXMPAcceptData acceptData, Long goodsId, Integer goodsType, String from, Long uid,
|
| | | PrintWriter out) {
|
| | | if (goodsType == null || goodsType < 2 || goodsType > 3) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "请传递正确平台参数"));
|
| | | return;
|
| | |
| | | // 保存缓存
|
| | | jdGoodsCacheUtil.saveGoodsInfo(jdGoods);
|
| | |
|
| | | ConfigParamsDTO paramsDTO = hongBaoManageService.getShowComputeRate(acceptData.getPlatform(),
|
| | | ConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate(acceptData.getPlatform(),
|
| | | acceptData.getVersion());
|
| | | paramsDTO.setMaxRewardRate(null);
|
| | | 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.getVIPShareRate()));
|
| | | .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();
|
| | |
| | | hongBaoManageService.getFanLiRate());
|
| | | otherInfo.setFanliMoneyPlus("京东plus返¥" + fanliMoneyPlus);
|
| | | // 使用奖励券最高返
|
| | | if (VersionUtil.greaterThan_2_0_5(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | | maxMoneyPlus = "(京东plus返¥"
|
| | | + JDUtil.getGoodsFanLiMoneyPlus(jdGoods,
|
| | | hongBaoManageService.getVIPFanLiRate())
|
| | | + ")";
|
| | | } else
|
| | | maxMoneyPlus = "(京东plus最高返¥"
|
| | | + fanliMoneyPlus.add(MoneyBigDecimalUtil.mul(fanliMoneyPlus, Constant.MAX_REWARD_RATE))
|
| | | + ")";
|
| | |
|
| | | maxMoneyPlus = "(京东plus返¥"
|
| | | + JDUtil.getGoodsFanLiMoneyPlus(jdGoods, hongBaoManageService.getFanLiRate(UserLevelEnum.superVIP)) + ")";
|
| | |
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | // 奖励券返利
|
| | | RewardCouponVO rewardCoupon = new RewardCouponVO();
|
| | | rewardCoupon.setMaxMoneyPlus(maxMoneyPlus);
|
| | | rewardCoupon.setJumpDetail(jumpDetailV2Service.getByTypeCache("web"));
|
| | |
|
| | | rewardCoupon.setMaxMoney(goodsDetail.getMoneyInfo().getMaxMoney());
|
| | | rewardCoupon.setDesc("返");
|
| | | otherInfo.setRewardCoupon(rewardCoupon);
|
| | | goodsDetail.setOtherInfo(otherInfo);
|
| | |
|
| | | CouponInfoVO couponInfo = goodsDetail.getCouponInfo();
|
| | |
| | | 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();
|
| | | shareInfoVO.setHelpLink(helpLink);
|
| | | extraVO.setShare(shareInfoVO);
|
| | |
|
| | | // 判断vip
|
| | | if (uid != null) {
|
| | | extraVO.setVip(userVIPInfoService.isVIP(uid));
|
| | | }
|
| | | JSONObject object = new JSONObject();
|
| | | object.put("extra", JsonUtil.getApiCommonGson().toJson(extraVO));
|
| | | object.put("goods", JsonUtil.getApiCommonGson().toJson(goodsDetail));
|
| | |
| | | * @param out
|
| | | */
|
| | | private void getDetialPDD(WXMPAcceptData acceptData, Long id, Long uid, String from, PrintWriter out) {
|
| | | PDDGoodsDetail pddGoods = PinDuoDuoApiUtil.getGoodsDetail(id);
|
| | | PDDGoodsDetail pddGoods =null; //PinDuoDuoApiUtil.getGoodsDetail(id);
|
| | | if (pddGoods == null) {
|
| | | out.print(JsonUtil.loadFalseResult(2, "商品不存在"));
|
| | | return;
|
| | | }
|
| | |
|
| | | ConfigParamsDTO paramsDTO = hongBaoManageService.getShowComputeRate(acceptData.getPlatform(),
|
| | | ConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate(acceptData.getPlatform(),
|
| | | acceptData.getVersion());
|
| | | paramsDTO.setMaxRewardRate(null);
|
| | | 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.getVIPShareRate()));
|
| | | "¥" + PinDuoDuoUtil.getGoodsFanLiMoney(pddGoods, hongBaoManageService.getShareRate(UserLevelEnum.superVIP)));
|
| | | }
|
| | |
|
| | | if (goodsDetail.getCouponInfo() != null) {
|
| | | List<CouponInfoVO> list = new ArrayList<>();
|
| | | list.add(goodsDetail.getCouponInfo());
|
| | | goodsDetail.setCouponInfoList(list);
|
| | | }
|
| | |
|
| | | // 奖励券返利
|
| | | RewardCouponVO rewardCoupon = new RewardCouponVO();
|
| | |
|
| | | rewardCoupon.setMaxMoney(goodsDetail.getMoneyInfo().getMaxMoney());
|
| | | rewardCoupon.setDesc("返");
|
| | |
|
| | | OtherInfo otherInfo = new OtherInfo();
|
| | | otherInfo.setRewardCoupon(rewardCoupon);
|
| | | goodsDetail.setOtherInfo(otherInfo);
|
| | |
|
| | | CouponInfoVO couponInfo = goodsDetail.getCouponInfo();
|
| | | PDDPromotionUrl convertUrl = null;
|
| | |
| | | goodsDetail.setShopInfo(null);
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | GoodsDetailExtraVO extraVO = new GoodsDetailExtraVO();
|
| | | 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)) {
|
| | | int indexOf = salesTip.indexOf("+");
|
| | |
| | | extraVO.setShareValid(true);
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(helpLink)) {
|
| | | helpLink = configService.get("no_rebate_help_link");
|
| | | helpLink = configService.get(ConfigKeyEnum.noRebateHelpLink.getKey());
|
| | | }
|
| | |
|
| | | ShareVO shareInfoVO = new ShareVO();
|
| | | shareInfoVO.setHelpLink(helpLink);
|
| | | extraVO.setShare(shareInfoVO);
|
| | |
|
| | | // 判断vip
|
| | | if (uid != null) {
|
| | | extraVO.setVip(userVIPInfoService.isVIP(uid));
|
| | | }
|
| | |
|
| | | if (convertUrl != null) {
|
| | | extraVO.setCouponJumpLink(convertUrl.getUrl());
|
| | |
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getRecommendGoods", method = RequestMethod.POST)
|
| | | public void getRecommendGoods(AcceptData acceptData, long id, Integer goodsType, PrintWriter out) {
|
| | | public void getRecommendGoods(WXMPAcceptData acceptData, long id, Integer goodsType, PrintWriter out) {
|
| | | if (goodsType == null || goodsType < 2 || goodsType > 3) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "请传递正确平台参数"));
|
| | | return;
|
| | |
| | | list = list.subList(0, 10);
|
| | | }
|
| | |
|
| | | ConfigParamsDTO paramsDTO = hongBaoManageService.getShowComputeRate(acceptData.getPlatform(),
|
| | | ConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate(acceptData.getPlatform(),
|
| | | acceptData.getVersion());
|
| | | List<GoodsDetailVO> listDetailVO = new ArrayList<GoodsDetailVO>();
|
| | |
|
| | |
| | | goodsList = goodsList.subList(0, 10);
|
| | | }
|
| | |
|
| | | ConfigParamsDTO paramsDTO = hongBaoManageService
|
| | | ConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService
|
| | | .getShowComputeRate(acceptData.getPlatform(), acceptData.getVersion());
|
| | | for (PDDGoodsDetail goods : goodsList) {
|
| | | listDetailVO.add(GoodsDetailVOFactory.convertPDDGoods(goods, paramsDTO));
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 获取商品详情
|
| | | * |
| | | * @param acceptData
|
| | | * @param goodsId 商品id
|
| | | * @param uid |
| | | * @param code 邀请码
|
| | | * @param goodsType 商品类型
|
| | | * @param from 页面来源
|
| | | * @param goodsId
|
| | | * 商品id
|
| | | * @param uid
|
| | | * @param code
|
| | | * 邀请码
|
| | | * @param goodsType
|
| | | * 商品类型
|
| | | * @param from
|
| | | * 页面来源
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getBuyLink", method = RequestMethod.POST)
|
| | | public void getBuyLink(WXMPAcceptData acceptData, Long goodsId, Integer goodsType, String from,
|
| | | String couponUrl, Long uid, String inviteCode, PrintWriter out) {
|
| | | public void getBuyLink(WXMPAcceptData acceptData, Long goodsId, Integer goodsType, String from, String couponUrl,
|
| | | Long uid, String inviteCode, PrintWriter out) {
|
| | | if (goodsId == null || goodsType == null) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "商品信息传递错误"));
|
| | | return;
|
| | |
| | |
|
| | | // 判断是自购 还是根据邀请码
|
| | | boolean share = false;
|
| | | |
| | |
|
| | | String subUnionId = "";
|
| | | if (uid != null) {
|
| | | UserInfo user = userInfoService.getUserByIdWithMybatis(uid);
|
| | |
| | | return;
|
| | | }
|
| | | subUnionId = uid.toString();
|
| | | } else if ((uid == null || uid < 1) && !StringUtil.isNullOrEmpty(inviteCode) ) {
|
| | | } else if ((uid == null || uid < 1) && !StringUtil.isNullOrEmpty(inviteCode)) {
|
| | | try {
|
| | | UserInfo user = userInfoExtraService.getUserByInviteCode(inviteCode);
|
| | | if (user != null && user.getState() == UserInfo.STATE_NORMAL) {
|
| | |
| | | } catch (UserInfoExtraException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | } |
| | | |
| | | }
|
| | |
|
| | | String jumpLink = null;
|
| | | if (goodsType.intValue() == Constant.SOURCE_TYPE_JD) { // 京东
|
| | | JDGoods goods = jdGoodsCacheUtil.getGoodsInfo(goodsId);
|
| | |
| | | out.print(JsonUtil.loadFalseResult(2, "商品已下架"));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | String materialId = "https://item.jd.com/" + goodsId + ".html";
|
| | | if (StringUtil.isNullOrEmpty(couponUrl)) {
|
| | | JDCouponInfo couponInfo = JDUtil.getShowCouponInfo(goods.getCouponInfoList(), goods.getPrice());
|
| | |
| | | couponUrl = couponInfo.getLink();
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | long position = JDApiUtil.POSITION_FANLI;
|
| | |
|
| | | long position = JDApiUtil.POSITION_FANLI;
|
| | | if (share) {
|
| | | position = JDApiUtil.POSITION_SHARE;
|
| | | }
|
| | |
| | | out.print(JsonUtil.loadFalseResult(2, "商品已下架"));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | String position = PinDuoDuoApiUtil.PID_FANLI;
|
| | | if (share) {
|
| | | position = PinDuoDuoApiUtil.PID_SHARE;
|
| | |
| | | out.print(JsonUtil.loadFalseResult(1, "创建购买信息失败"));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("goodsType", goodsType);
|
| | | data.put("jumpLink", jumpLink);
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | | |
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 分享商品海报
|
| | | * |
| | | * @param acceptData
|
| | | * @param goodsId
|
| | | * @param goodsType
|
| | |
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "sharePoster", method = RequestMethod.POST)
|
| | | public void sharePoster(WXMPAcceptData acceptData, Long goodsId, Integer goodsType, String from, Integer type, |
| | | public void sharePoster(WXMPAcceptData acceptData, Long goodsId, Integer goodsType, String from, Integer type,
|
| | | Long uid, PrintWriter out) {
|
| | | if (uid == null || uid < 1) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "用户未登录"));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | if (goodsId == null || goodsType == null) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "商品信息传递错误"));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | if (type == null || type < 1 || type > 2) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "分享类型错误"));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | UserInfo user = userInfoService.getUserByIdWithMybatis(uid);
|
| | | if (user != null && user.getState() != UserInfo.STATE_NORMAL) {
|
| | | out.print(JsonUtil.loadFalseResult(Constant.CODE_FORBIDDEN_USER, Constant.FORBIDDEN_USER_REASON_DESC));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | String inviteCode = userInfoExtraService.getInviteCodeByUid(uid);
|
| | | if (StringUtil.isNullOrEmpty(inviteCode)) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "邀请码未激活"));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | if (goodsType.intValue() == Constant.SOURCE_TYPE_JD) { // 京东
|
| | | createPosterJD(acceptData, goodsId, goodsType, from, type, user, inviteCode, out);
|
| | | } else if (goodsType.intValue() == Constant.SOURCE_TYPE_PDD) { // 拼多多
|
| | |
| | | out.print(JsonUtil.loadFalseResult(1, "参数传递错误"));
|
| | | }
|
| | | }
|
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 创建京东分享海报
|
| | | */
|
| | | private void createPosterJD(WXMPAcceptData acceptData, Long goodsId, Integer goodsType, String from, Integer type, UserInfo user,
|
| | | String inviteCode, PrintWriter out) {
|
| | | private void createPosterJD(WXMPAcceptData acceptData, Long goodsId, Integer goodsType, String from, Integer type,
|
| | | UserInfo user, String inviteCode, PrintWriter out) {
|
| | | JDGoods jdGoods = jdGoodsCacheUtil.getGoodsInfo(goodsId);
|
| | | if (jdGoods == null) {
|
| | | out.print(JsonUtil.loadFalseResult(2, "商品已下架"));
|
| | | return;
|
| | | }
|
| | | ConfigParamsDTO paramsDTO = hongBaoManageService.getShowComputeRate(acceptData.getPlatform(),acceptData.getVersion());
|
| | | ConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate(acceptData.getPlatform(),
|
| | | acceptData.getVersion());
|
| | | GoodsDetailVO goods = GoodsDetailVOFactory.convertJDGoods(jdGoods, paramsDTO);
|
| | | |
| | | String scene = goodsType+"#"+goodsId+"#" + inviteCode;
|
| | |
|
| | | String scene = goodsType + "#" + goodsId + "#" + inviteCode;
|
| | | FileUploadResult uploadResult = null;
|
| | | if (type == 1) {
|
| | | String erCodeUrl = "https://wxmp.banliapp.com/goods?info="+ scene;
|
| | | String erCodeUrl = "https://wxmp.banliapp.com/goods?i=" + scene;
|
| | | uploadResult = qrCodeService.drawGoodsPoster(erCodeUrl, user.getPortrait(), goods);
|
| | | } else {
|
| | | String acessToken = WXUtil.getAcessToken(Constant.WXMP_APP_INFO.getAppId(), Constant.WXMP_APP_INFO.getAppSecret());
|
| | | String acessToken = WXUtil.getAcessToken(Constant.WXMP_APP_INFO.getAppId(),
|
| | | Constant.WXMP_APP_INFO.getAppSecret());
|
| | | InputStream xcxCode = WXXCXUtil.getXCXCode(acessToken, "/pages/goods/goods", scene);
|
| | | uploadResult = qrCodeService.drawGoodsPosterXCX(xcxCode, user, goods);
|
| | | }
|
| | | |
| | |
|
| | | try {
|
| | | userShareGoodsRecordService.saveShareRecord(user.getId(), CommonGoodsFactory.create(jdGoods));
|
| | | } catch (UserShareGoodsRecordException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | String posterLink = uploadResult.getUrl();
|
| | | |
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("posterLink", posterLink);
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | |
| | |
|
| | | com.yeshi.fanli.util.ThreadUtil.run(new Runnable() {
|
| | | @Override
|
| | | public void run() {
|
| | |
| | | }
|
| | | });
|
| | | }
|
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 创建拼多多分享海报
|
| | | */
|
| | | private void createPosterPDD(WXMPAcceptData acceptData, Long goodsId, Integer goodsType, String from, Integer type, UserInfo user,
|
| | | String inviteCode, PrintWriter out) {
|
| | | private void createPosterPDD(WXMPAcceptData acceptData, Long goodsId, Integer goodsType, String from, Integer type,
|
| | | UserInfo user, String inviteCode, PrintWriter out) {
|
| | | PDDGoodsDetail pddGoods = pinDuoDuoCacheUtil.getGoodsInfo(goodsId);
|
| | | if (pddGoods == null) {
|
| | | out.print(JsonUtil.loadFalseResult(2, "商品已下架"));
|
| | | return;
|
| | | }
|
| | | ConfigParamsDTO paramsDTO = hongBaoManageService.getShowComputeRate(acceptData.getPlatform(), acceptData.getVersion());
|
| | | ConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate(acceptData.getPlatform(),
|
| | | acceptData.getVersion());
|
| | | GoodsDetailVO goods = GoodsDetailVOFactory.convertPDDGoods(pddGoods, paramsDTO);
|
| | | |
| | | String scene = goodsType+"#"+goodsId+"#" + inviteCode;
|
| | |
|
| | | String scene = goodsType + "#" + goodsId + "#" + inviteCode;
|
| | | FileUploadResult uploadResult = null;
|
| | | if (type == 1) {
|
| | | String erCodeUrl = "https://wxmp.banliapp.com/goods?info="+ scene;
|
| | | String erCodeUrl = "https://wxmp.banliapp.com/goods?info=" + scene;
|
| | | uploadResult = qrCodeService.drawGoodsPoster(erCodeUrl, user.getPortrait(), goods);
|
| | | } else {
|
| | | String acessToken = WXUtil.getAcessToken(Constant.WXMP_APP_INFO.getAppId(), Constant.WXMP_APP_INFO.getAppSecret());
|
| | | String acessToken = WXUtil.getAcessToken(Constant.WXMP_APP_INFO.getAppId(),
|
| | | Constant.WXMP_APP_INFO.getAppSecret());
|
| | | InputStream xcxCode = WXXCXUtil.getXCXCode(acessToken, "/pages/goods/goods", scene);
|
| | | uploadResult = qrCodeService.drawGoodsPosterXCX(xcxCode, user, goods);
|
| | | }
|
| | | |
| | |
|
| | | try {
|
| | | userShareGoodsRecordService.saveShareRecord(user.getId(), CommonGoodsFactory.create(pddGoods));
|
| | | } catch (UserShareGoodsRecordException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | String posterLink = uploadResult.getUrl();
|
| | | |
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("posterLink", posterLink);
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | |
| | |
|
| | | // 异步操作
|
| | | com.yeshi.fanli.util.ThreadUtil.run(new Runnable() {
|
| | | @Override
|