| | |
| | | import com.yeshi.fanli.entity.taobao.TaoBaoUnionConfig;
|
| | | import com.yeshi.fanli.entity.taobao.TaoKeAppInfo;
|
| | | import com.yeshi.fanli.entity.taobao.UserTLJBuyHistory;
|
| | | import com.yeshi.fanli.exception.ShareGoodsException;
|
| | | import com.yeshi.fanli.exception.share.ShareGoodsException;
|
| | | import com.yeshi.fanli.exception.taobao.TaoKeApiException;
|
| | | import com.yeshi.fanli.exception.taobao.TaobaoGoodsDownException;
|
| | | import com.yeshi.fanli.exception.tlj.TaoLiJinCreateException;
|
| | | import com.yeshi.fanli.exception.tlj.UserTaoLiJinRecordException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.service.inter.goods.CommonGoodsService;
|
| | | import com.yeshi.fanli.service.inter.goods.ShareGoodsService;
|
| | | import com.yeshi.fanli.service.inter.hongbao.HongBaoManageService;
|
| | | import com.yeshi.fanli.service.inter.money.UserMoneyExtraService;
|
| | | import com.yeshi.fanli.service.inter.monitor.BusinessEmergent110Service;
|
| | | import com.yeshi.fanli.service.inter.order.config.HongBaoManageService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TLJBuyGoodsService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoUnionConfigService;
|
| | | import com.yeshi.fanli.service.inter.taobao.UserTLJBuyHistoryService;
|
| | | import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinRecordService;
|
| | | import com.yeshi.fanli.service.inter.user.TBPidService;
|
| | | import com.yeshi.fanli.service.inter.user.UserAccountService;
|
| | | import com.yeshi.fanli.service.inter.user.UserMoneyExtraService;
|
| | | import com.yeshi.fanli.service.inter.user.UserShareGoodsRecordService;
|
| | | import com.yeshi.fanli.util.AESUtil;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | |
| | |
|
| | | @Resource
|
| | | private TLJBuyGoodsService tljBuyGoodsService;
|
| | |
|
| | | @Resource
|
| | | private BusinessEmergent110Service businessEmergent110Service;
|
| | |
|
| | | @Override
|
| | | public void addShareGoodsHistory(UserShareGoodsHistory history) {
|
| | |
| | | }
|
| | |
|
| | | UserShareGoodsHistory history = new UserShareGoodsHistory();
|
| | | history.setTkCode(tbLink.getTaoToken());
|
| | | history.setTkCode(TaoBaoUtil.filterTaoToken(tbLink.getTaoToken()));
|
| | | history.setLink(tbLink.getClickUrl());
|
| | | history.setQuanLink(tbLink.getCouponLink());
|
| | | history.setTkCode(tbLink.getTaoToken());
|
| | | history.setTkCode(TaoBaoUtil.filterTaoToken(tbLink.getTaoToken()));
|
| | |
|
| | | history.setCreateTime(new Date());
|
| | | history.setGoodsId(goods.getAuctionId());
|
| | |
| | | // throw new ShareGoodsException(4, "生成二维码失败");
|
| | | // }
|
| | | // 获取到用户的头像
|
| | | UserInfo user = userinfoMapper.selectByPrimaryKey(uid);
|
| | | UserInfo user = userinfoMapper.selectAvailableByPrimaryKey(uid);
|
| | | InputStream portrait = null;
|
| | | if (!StringUtil.isNullOrEmpty(user.getPortrait())) {
|
| | | try {
|
| | |
| | |
|
| | | UserShareGoodsHistory history = new UserShareGoodsHistory();
|
| | | history.setId(userShareGoodsHistory.getId());
|
| | | history.setTkCode(tbLink.getTaoToken());
|
| | | history.setTkCode(TaoBaoUtil.filterTaoToken(tbLink.getTaoToken()));
|
| | | history.setLink(tbLink.getClickUrl());
|
| | | history.setQuanLink(tbLink.getCouponLink());
|
| | | history.setTkCode(tbLink.getTaoToken());
|
| | | history.setTkCode(TaoBaoUtil.filterTaoToken(tbLink.getTaoToken()));
|
| | | userShareGoodsHistoryMapper.updateByPrimaryKeySelective(history);
|
| | |
|
| | | userShareGoodsHistory.setTkCode(tbLink.getTaoToken());
|
| | | userShareGoodsHistory.setTkCode(TaoBaoUtil.filterTaoToken(tbLink.getTaoToken()));
|
| | | userShareGoodsHistory.setLink(tbLink.getClickUrl());
|
| | | userShareGoodsHistory.setQuanLink(tbLink.getCouponLink());
|
| | | userShareGoodsHistory.setTkCode(tbLink.getTaoToken());
|
| | | userShareGoodsHistory.setTkCode(TaoBaoUtil.filterTaoToken(tbLink.getTaoToken()));
|
| | | }
|
| | |
|
| | | return userShareGoodsHistory;
|
| | |
| | | taoBaoLink.setAuctionId(auctionId);
|
| | | taoBaoLink.setClickUrl(goods.getAuctionUrl());
|
| | | taoBaoLink.setCouponLink(goods.getCouponLink());
|
| | | if (!StringUtil.isNullOrEmpty(goods.getYsylClickUrl()))
|
| | | taoBaoLink.setCouponLink(goods.getYsylClickUrl());
|
| | | taoBaoLink.setGoods(goods);
|
| | |
|
| | | return taoBaoLink;
|
| | | }
|
| | |
|
| | |
| | | tbLink.setAuctionId(goods.getAuctionId());
|
| | | tbLink.setClickUrl(goods.getAuctionUrl());
|
| | | tbLink.setCouponLink(goods.getCouponLink());
|
| | | if (!StringUtil.isNullOrEmpty(goods.getYsylClickUrl()))
|
| | | tbLink.setCouponLink(goods.getYsylClickUrl());
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(tbLink.getCouponLink())) {// 通过立即推广方式获取淘口令成功
|
| | | String quanToken = TaoKeApiUtil.getTKToken(goods.getPictUrl(), goods.getTitle(), tbLink.getCouponLink());
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | public TaoBaoLink getTaoLiJinLinkForBuyWithOutFanLi(Long uid, Long auctionId) throws ShareGoodsException {
|
| | | public TaoBaoLink getTaoLiJinLinkForBuyWithOutFanLi(Long uid, Long auctionId, TaoKeAppInfo app)
|
| | | throws ShareGoodsException, TaoLiJinCreateException {
|
| | | if (uid == null || uid <= 0) {
|
| | | throw new ShareGoodsException(1, "用户ID不能为空");
|
| | | }
|
| | |
| | | }
|
| | |
|
| | | BigDecimal perface = TaoBaoUtil.getGoodsHongBaoMoney(goods, new BigDecimal(70));
|
| | | TaoKeAppInfo app = TaoBaoConstant.ownBuyApp;
|
| | | TaoLiJinDTO taoLiJinDTO = null;
|
| | | try {
|
| | | taoLiJinDTO = TaoKeApiUtil.createTaoLiJin(auctionId, "自购立减", perface, 1, new Date(currentTime), sendEndTime,
|
| | | new Date(currentTime), sendEndTime, app);
|
| | | taoLiJinDTO = TaoKeApiUtil.createTaoLiJin(auctionId, "自购立减", perface, 1,
|
| | | new Date(currentTime - 1000 * 60 * 10L), sendEndTime, new Date(currentTime - 1000 * 60 * 10L),
|
| | | sendEndTime, app);
|
| | | } catch (TaoLiJinCreateException e1) {
|
| | | if (e1.getCode() == TaoLiJinCreateException.CODE_TLJ_NO_MONEY) {// 资金不足
|
| | | TaoBaoUnionConfig config = taoBaoUnionConfigService.getConfigByAppKeyCache(app.getAppKey());
|
| | | businessEmergent110Service.tljNoMoney(config.getAccount());
|
| | | } else if (e1.getCode() == TaoLiJinCreateException.CODE_TLJ_FORBIDDEN) {// 商品不允许创建淘礼金
|
| | | tljBuyGoodsService.removeGoods(auctionId);
|
| | | }
|
| | | LogHelper.errorDetailInfo(e1, e1.getMessage(), null);
|
| | | } catch (TaoKeApiException e) {
|
| | | LogHelper.errorDetailInfo(e, e.getMessage(), null);
|
| | | throw new ShareGoodsException(5, "生成推广链接失败");
|
| | | }
|
| | |
|
| | | if (taoLiJinDTO == null)
|
| | | throw new ShareGoodsException(5, "生成推广链接失败");
|
| | |
|