From 626d711cb15896055c13fe344eb7fcc824589715 Mon Sep 17 00:00:00 2001 From: yujian <yujian@163.com> Date: 星期四, 19 十二月 2019 15:38:42 +0800 Subject: [PATCH] 帮助中心 --- fanli/src/main/java/com/yeshi/fanli/service/impl/goods/ShareGoodsServiceImpl.java | 75 +++++++++++++++++-------------------- 1 files changed, 34 insertions(+), 41 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/goods/ShareGoodsServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/goods/ShareGoodsServiceImpl.java index d308746..ca6f566 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/goods/ShareGoodsServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/goods/ShareGoodsServiceImpl.java @@ -25,9 +25,7 @@ import com.yeshi.fanli.dao.mybatis.share.PidUserMapper; import com.yeshi.fanli.dto.taobao.TaoLiJinDTO; import com.yeshi.fanli.entity.bus.share.UserShareGoodsHistory; -import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinRecord; import com.yeshi.fanli.entity.bus.user.UserInfo; -import com.yeshi.fanli.entity.bus.user.UserMoneyExtra; import com.yeshi.fanli.entity.taobao.PidUser; import com.yeshi.fanli.entity.taobao.TBPid; import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief; @@ -39,20 +37,21 @@ 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.exception.tlj.UserTaoLiJinNewbiesException; 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.redpack.UserTaoLiJinNewbiesService; 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; @@ -119,6 +118,9 @@ @Resource private BusinessEmergent110Service businessEmergent110Service; + @Resource + private UserTaoLiJinNewbiesService userTaoLiJinNewbiesService; + @Override public void addShareGoodsHistory(UserShareGoodsHistory history) { UserShareGoodsHistory userShareGoodsHistory = userShareGoodsHistoryMapper @@ -204,10 +206,10 @@ } 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()); @@ -246,7 +248,7 @@ // throw new ShareGoodsException(4, "鐢熸垚浜岀淮鐮佸け璐�"); // } // 鑾峰彇鍒扮敤鎴风殑澶村儚 - UserInfo user = userinfoMapper.selectByPrimaryKey(uid); + UserInfo user = userinfoMapper.selectAvailableByPrimaryKey(uid); InputStream portrait = null; if (!StringUtil.isNullOrEmpty(user.getPortrait())) { try { @@ -366,16 +368,16 @@ 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; @@ -571,8 +573,9 @@ 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; } @@ -649,6 +652,8 @@ 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()); @@ -674,39 +679,28 @@ @Override public TaoBaoLink getTaoLiJinLinkForBuy(Long uid, String specialId, Long auctionId, String pid) throws ShareGoodsException { - if (uid == null || uid <= 0) { + if (uid == null || uid <= 0) throw new ShareGoodsException(1, "鐢ㄦ埛ID涓嶈兘涓虹┖"); - } - if (auctionId == null || auctionId <= 0) { - throw new ShareGoodsException(2, "鍟嗗搧ID涓嶈兘涓虹┖"); + if (auctionId == null || auctionId <= 0) + throw new ShareGoodsException(1, "鍟嗗搧ID涓嶈兘涓虹┖"); + + TaoBaoGoodsBrief goods = null; + try { + goods = TaoKeApiUtil.searchGoodsDetail(auctionId); + } catch (TaobaoGoodsDownException e) { + throw new ShareGoodsException(1, "璇ュ晢鍝佸凡涓嬫灦"); } - - // 鐢ㄦ埛鍓╀綑鍙互娣樼ぜ閲戦獙璇� - UserMoneyExtra userMoneyExtra = userMoneyExtraService.selectByPrimaryKey(uid); - if (userMoneyExtra == null || userMoneyExtra.getTlj() == null) { - throw new ShareGoodsException(101, "绾㈠寘浣欓涓嶈冻"); - } - - TaoKeAppInfo app = new TaoKeAppInfo(); - app.setAppKey(TaoBaoConstant.TAOBAO_AUTH_APPKEY); - app.setAppSecret(TaoBaoConstant.TAOBAO_AUTH_APPSECRET); - if (pid == null) - app.setPid(TaoBaoConstant.TAOBAO_SPECIAL_PID_DEFAULT); - else - app.setPid(pid); - TaoBaoGoodsBrief goods = TaoKeApiUtil.specialConvertCoupon(auctionId, app); - if (goods == null) { - throw new ShareGoodsException(1, ""); - } - + + if (goods == null) + throw new ShareGoodsException(1, "璇ュ晢鍝佸凡涓嬫灦"); + String taoLiJinLink = null; try { goods.setAuctionId(auctionId); - UserTaoLiJinRecord createUserTaoLiJin = userTaoLiJinRecordService.createSelfBuyTaoLiJin(uid, 1, goods); - taoLiJinLink = createUserTaoLiJin.getSendUrl(); - } catch (UserTaoLiJinRecordException e) { - throw new ShareGoodsException(e.getCode(), e.getMsg()); + taoLiJinLink = userTaoLiJinNewbiesService.createTaoLiJinForBuy(goods, uid); + } catch (UserTaoLiJinNewbiesException e1) { + throw new ShareGoodsException(e1.getCode(), e1.getMsg()); } TaoBaoLink taoBaoLink = new TaoBaoLink(); @@ -714,7 +708,6 @@ taoBaoLink.setClickUrl(goods.getAuctionUrl()); taoBaoLink.setCouponLink(taoLiJinLink); taoBaoLink.setGoods(goods); - return taoBaoLink; } -- Gitblit v1.8.0