From b3da9f82b7740d39742fef1a81a56c22fe1c8b9c Mon Sep 17 00:00:00 2001
From: yujian <yujian@163.com>
Date: 星期一, 08 六月 2020 17:27:02 +0800
Subject: [PATCH] 券后价调整

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/goods/ShareGoodsServiceImpl.java |  258 ++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 180 insertions(+), 78 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 56227cb..ba8dfa0 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
@@ -19,15 +19,12 @@
 import org.yeshi.utils.exception.HttpException;
 import org.yeshi.utils.tencentcloud.COSManager;
 
-import com.yeshi.fanli.dao.mybatis.HongBaoManageMapper;
 import com.yeshi.fanli.dao.mybatis.UserInfoMapper;
 import com.yeshi.fanli.dao.mybatis.UserShareGoodsHistoryMapper;
-import com.yeshi.fanli.dao.mybatis.share.PidUserMapper;
+import com.yeshi.fanli.dto.taobao.DaTaoKeFilterResult;
 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;
@@ -35,33 +32,39 @@
 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.entity.taobao.dataoke.DaTaoKeDetailV2;
+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.UserTaoLiJinRecordException;
+import com.yeshi.fanli.exception.tlj.TaoLiJinCreateException;
+import com.yeshi.fanli.exception.tlj.UserTaoLiJinNewbiesException;
 import com.yeshi.fanli.log.LogHelper;
-import com.yeshi.fanli.service.impl.monitor.BusinessEmergent110ServiceImpl;
+import com.yeshi.fanli.log.LogManager;
+import com.yeshi.fanli.log.LogType;
 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.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.taobao.dataoke.DaTaoKeGoodsDetailV2Service;
 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.service.manger.goods.ConvertLinkManager;
 import com.yeshi.fanli.util.AESUtil;
 import com.yeshi.fanli.util.Constant;
+import com.yeshi.fanli.util.FilePathEnum;
 import com.yeshi.fanli.util.FileUtil;
 import com.yeshi.fanli.util.ImageUtil;
 import com.yeshi.fanli.util.RedisManager;
 import com.yeshi.fanli.util.StringUtil;
 import com.yeshi.fanli.util.TaoBaoConstant;
 import com.yeshi.fanli.util.TimeUtil;
+import com.yeshi.fanli.util.cache.TaoBaoGoodsCacheUtil;
+import com.yeshi.fanli.util.dataoke.DaTaoKeApiUtil;
+import com.yeshi.fanli.util.taobao.DaTaoKeUtil;
 import com.yeshi.fanli.util.taobao.TaoBaoUtil;
 import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
 
@@ -69,16 +72,10 @@
 public class ShareGoodsServiceImpl implements ShareGoodsService {
 
 	@Resource
-	private PidUserMapper pidUserMapper;
-
-	@Resource
 	private TBPidService tbPidService;
 
 	@Resource
 	private UserShareGoodsHistoryMapper userShareGoodsHistoryMapper;
-
-	@Resource
-	private HongBaoManageMapper hongBaoManageMapper;
 
 	@Resource
 	private UserInfoMapper userinfoMapper;
@@ -99,18 +96,6 @@
 	private HongBaoManageService hongBaoManageService;
 
 	@Resource
-	private UserShareGoodsRecordService userShareGoodsRecordService;
-
-	@Resource
-	private CommonGoodsService commonGoodsService;
-
-	@Resource
-	private UserMoneyExtraService userMoneyExtraService;
-
-	@Resource
-	private UserTaoLiJinRecordService userTaoLiJinRecordService;
-
-	@Resource
 	private UserTLJBuyHistoryService userTLJBuyHistoryService;
 
 	@Resource
@@ -118,6 +103,18 @@
 
 	@Resource
 	private BusinessEmergent110Service businessEmergent110Service;
+
+	@Resource
+	private UserTaoLiJinNewbiesService userTaoLiJinNewbiesService;
+
+	@Resource
+	private ConvertLinkManager convertLinkManager;
+
+	@Resource
+	private TaoBaoGoodsCacheUtil taoBaoGoodsCacheUtil;
+
+	@Resource
+	private DaTaoKeGoodsDetailV2Service daTaoKeGoodsDetailV2Service;
 
 	@Override
 	public void addShareGoodsHistory(UserShareGoodsHistory history) {
@@ -204,10 +201,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 +243,7 @@
 			// throw new ShareGoodsException(4, "鐢熸垚浜岀淮鐮佸け璐�");
 			// }
 			// 鑾峰彇鍒扮敤鎴风殑澶村儚
-			UserInfo user = userinfoMapper.selectByPrimaryKey(uid);
+			UserInfo user = userinfoMapper.selectAvailableByPrimaryKey(uid);
 			InputStream portrait = null;
 			if (!StringUtil.isNullOrEmpty(user.getPortrait())) {
 				try {
@@ -302,7 +299,8 @@
 			}
 
 			FileUploadResult shareImgResult = COSManager.getInstance().uploadInputStream(shareImgInputStream,
-					"sharegoods/share_" + uid + "_" + goods.getAuctionId() + "_" + System.currentTimeMillis() + ".png");
+					FilePathEnum.shareGoods.getPath() + "share_" + uid + "_" + goods.getAuctionId() + "_"
+							+ System.currentTimeMillis() + ".png");
 
 			if (shareImgResult == null || StringUtil.isNullOrEmpty(shareImgResult.getUrl())) {
 				throw new ShareGoodsException(6, "鍒嗕韩鍥剧墖淇濆瓨澶辫触");
@@ -366,16 +364,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;
@@ -418,8 +416,6 @@
 		}
 		TaoBaoGoodsBrief goods = null;
 		try {
-			// 娴嬭瘯
-			// info.setAdzoneId("123");
 			goods = TaoKeApiUtil.searchGoodsDetail(auctionId, info);
 		} catch (TaobaoGoodsDownException e) {
 			throw new ShareGoodsException(4, "鍟嗗搧宸蹭笅鏋�");
@@ -430,14 +426,40 @@
 		}
 
 		if (StringUtil.isNullOrEmpty(goods.getCouponLink()) && !goods.getAuctionUrl().contains("s.click.taobao.com")) {
-			TaoBaoUnionConfig taoBaoUnionConfig = taoBaoUnionConfigService
-					.getConfigByAppIdCache(info.getPid().split("_")[2]);
+
 			TaoBaoGoodsBrief taoBaoLink = TaoKeApiUtil.specialConvertCoupon(auctionId, info);
 			if (taoBaoLink == null) {
 				throw new ShareGoodsException(201, "鍟嗗搧杞摼澶辫触");
 			}
 			goods.setCouponLink(taoBaoLink.getCouponLink());
 			goods.setAuctionUrl(taoBaoLink.getAuctionUrl());
+		}
+
+		String link = taoBaoGoodsCacheUtil.getBaseConvertLink(auctionId, info.getPid());
+		if (link != null) {
+			goods.setCouponLink(link);
+		} else {// 缂撳瓨
+			DaTaoKeFilterResult result = daTaoKeGoodsDetailV2Service.filterTaoBaoGoods(goods);
+			if (result.getFilterType() == DaTaoKeFilterResult.FILTER_TYPE_COUPON
+					|| result.getFilterType() == DaTaoKeFilterResult.FILTER_TYPE_PRICE_AND_COUPON) {
+				link = DaTaoKeApiUtil.convertLink(auctionId, info.getPid());
+			} else if (goods.getCouponAmount() != null && goods.getCouponAmount().compareTo(new BigDecimal(0)) > 0) {// 鏈夊埜
+				link = DaTaoKeApiUtil.convertLink(auctionId, info.getPid());
+			}
+
+			if (!StringUtil.isNullOrEmpty(link)) {
+				goods.setCouponLink(link);
+				taoBaoGoodsCacheUtil.cacheBaseConvertLink(auctionId, info.getPid(), link);
+			}
+
+			if (StringUtil.isNullOrEmpty(link)) {
+				TaoBaoGoodsBrief taoBaoLink = TaoKeApiUtil.specialConvertCoupon(auctionId, info);
+				if (taoBaoLink == null) {
+					throw new ShareGoodsException(201, "鍟嗗搧杞摼澶辫触");
+				}
+				goods.setCouponLink(taoBaoLink.getCouponLink());
+				goods.setAuctionUrl(taoBaoLink.getAuctionUrl());
+			}
 		}
 
 		if (!StringUtil.isNullOrEmpty(relationId)) {
@@ -456,12 +478,14 @@
 		tbLink.setCouponLink(goods.getCouponLink());
 
 		if (!StringUtil.isNullOrEmpty(tbLink.getCouponLink())) {// 閫氳繃绔嬪嵆鎺ㄥ箍鏂瑰紡鑾峰彇娣樺彛浠ゆ垚鍔�
-			String quanToken = TaoKeApiUtil.getTKToken(goods.getPictUrl(), goods.getTitle(), tbLink.getCouponLink());
+			String quanToken = convertLinkManager.createTaoBaoToken(uid, goods.getPictUrl(), goods.getTitle(),
+					tbLink.getCouponLink());
 			if (!StringUtil.isNullOrEmpty(quanToken)) {
 				tbLink.setTaoToken(quanToken);
 			}
 		} else if (!StringUtil.isNullOrEmpty(tbLink.getClickUrl())) {
-			String quanToken = TaoKeApiUtil.getTKToken(goods.getPictUrl(), goods.getTitle(), tbLink.getClickUrl());
+			String quanToken = convertLinkManager.createTaoBaoToken(uid, goods.getPictUrl(), goods.getTitle(),
+					tbLink.getClickUrl());
 			if (!StringUtil.isNullOrEmpty(quanToken)) {
 				tbLink.setTaoToken(quanToken);
 			}
@@ -473,7 +497,24 @@
 		if (Constant.IS_OUTNET)
 			redisManager.saveTaoBaoGoodsBriefTemp(goods);
 
+		LogManager.getLogger(LogType.taobaoTrade)
+				.info(String.format("娣樺疂鍟嗗搧鍒嗕韩\n UID:%s \n 鍟嗗搧ID:%s \n 鍒搁摼鎺�%s \n鍟嗗搧閾炬帴:%s \n 鍙d护:%s ", uid, auctionId,
+						tbLink.getCouponLink(), tbLink.getClickUrl(), tbLink.getTaoToken()));
+
 		return tbLink;
+	}
+
+	@Override
+	public String createTaoBaoToken(Long uid, TaoBaoGoodsBrief goods) {
+		String quanToken = "";
+		if (!StringUtil.isNullOrEmpty(goods.getCouponLink())) {// 閫氳繃绔嬪嵆鎺ㄥ箍鏂瑰紡鑾峰彇娣樺彛浠ゆ垚鍔�
+			quanToken = convertLinkManager.createTaoBaoToken(uid, goods.getPictUrl(), goods.getTitle(),
+					goods.getCouponLink());
+		} else if (!StringUtil.isNullOrEmpty(goods.getAuctionUrl())) {
+			quanToken = convertLinkManager.createTaoBaoToken(uid, goods.getPictUrl(), goods.getTitle(),
+					goods.getAuctionUrl());
+		}
+		return quanToken;
 	}
 
 	@Override
@@ -562,17 +603,60 @@
 		app.setAppKey(TaoBaoConstant.TAOBAO_AUTH_APPKEY);
 		app.setAppSecret(TaoBaoConstant.TAOBAO_AUTH_APPSECRET);
 		app.setPid(TaoBaoConstant.TAOBAO_SPECIAL_PID_DEFAULT);
+
+		TaoBaoLink taoBaoLink = new TaoBaoLink();
+		taoBaoLink.setAuctionId(auctionId);
+
+		String baseUrl = taoBaoGoodsCacheUtil.getBaseConvertLink(auctionId, app.getPid());
+		if (!StringUtil.isNullOrEmpty(baseUrl)) {
+			taoBaoLink.setClickUrl(baseUrl);
+			taoBaoLink.setCouponLink(baseUrl);
+			return taoBaoLink;
+		}
+
+		// 鏌ヨ鏄惁涓哄ぇ娣樺鍟嗗搧
+
+		String link = null;
+		try {
+			link = DaTaoKeApiUtil.convertLink(auctionId, app.getPid());
+		} catch (Exception e) {
+		}
+		DaTaoKeDetailV2 v2 = daTaoKeGoodsDetailV2Service.selectByAuctionId(auctionId);
+		if (v2 != null) {
+			try {
+				TaoBaoGoodsBrief goods = redisManager.getTaoBaoGoodsBrief(auctionId);
+				if (goods != null) {
+					if (DaTaoKeUtil.canFilterCouponInfo(goods, v2)) {
+						// link = DaTaoKeApiUtil.convertLink(auctionId,
+						// app.getPid());
+						
+					}
+				}
+			} catch (TaobaoGoodsDownException e) {
+				throw new ShareGoodsException(4, "鍟嗗搧ID涓嶈兘涓虹┖");
+			}
+		}
+		
+		if (!StringUtil.isNullOrEmpty(link)) {
+			taoBaoGoodsCacheUtil.cacheBaseConvertLink(auctionId, app.getPid(), link);
+		}
+
+		if (!StringUtil.isNullOrEmpty(link)) {
+			taoBaoLink.setCouponLink(link);
+			return taoBaoLink;
+		}
+
 		TaoBaoGoodsBrief goods = TaoKeApiUtil.specialConvertCoupon(auctionId, app);
 		if (goods == null) {
 			throw new ShareGoodsException(1, "");
 		}
 
-		TaoBaoLink taoBaoLink = new TaoBaoLink();
-		taoBaoLink.setAuctionId(auctionId);
 		taoBaoLink.setClickUrl(goods.getAuctionUrl());
 		taoBaoLink.setCouponLink(goods.getCouponLink());
-		taoBaoLink.setGoods(goods);
 
+		if (!StringUtil.isNullOrEmpty(goods.getYsylClickUrl()))
+			taoBaoLink.setCouponLink(goods.getYsylClickUrl());
+		taoBaoLink.setGoods(goods);
 		return taoBaoLink;
 	}
 
@@ -635,6 +719,29 @@
 			goods.setAuctionUrl(taoBaoLink.getAuctionUrl());
 		}
 
+		String link = taoBaoGoodsCacheUtil.getBaseConvertLink(auctionId, info.getPid());
+		if (link != null) {
+			goods.setCouponLink(link);
+		} else {// 缂撳瓨
+			DaTaoKeFilterResult result = daTaoKeGoodsDetailV2Service.filterTaoBaoGoods(goods);
+			if (result.getFilterType() == DaTaoKeFilterResult.FILTER_TYPE_COUPON
+					|| result.getFilterType() == DaTaoKeFilterResult.FILTER_TYPE_PRICE_AND_COUPON) {
+				link = DaTaoKeApiUtil.convertLink(auctionId, info.getPid());
+				if (!StringUtil.isNullOrEmpty(link)) {
+					goods.setCouponLink(link);
+					taoBaoGoodsCacheUtil.cacheBaseConvertLink(auctionId, info.getPid(), link);
+				}
+			}
+			if (StringUtil.isNullOrEmpty(link)) {
+				TaoBaoGoodsBrief taoBaoLink = TaoKeApiUtil.specialConvertCoupon(auctionId, info);
+				if (taoBaoLink == null) {
+					throw new ShareGoodsException(201, "鍟嗗搧杞摼澶辫触");
+				}
+				goods.setCouponLink(taoBaoLink.getCouponLink());
+				goods.setAuctionUrl(taoBaoLink.getAuctionUrl());
+			}
+		}
+
 		if (!StringUtil.isNullOrEmpty(relationId)) {
 			if (!StringUtil.isNullOrEmpty(goods.getAuctionUrl()))
 				goods.setAuctionUrl(goods.getAuctionUrl() + "&relationId=" + relationId);
@@ -649,6 +756,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 +783,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(1, "鍟嗗搧ID涓嶈兘涓虹┖");
+
+		TaoBaoGoodsBrief goods = null;
+		try {
+			goods = TaoKeApiUtil.searchGoodsDetail(auctionId);
+		} catch (TaobaoGoodsDownException e) {
+			throw new ShareGoodsException(1, "璇ュ晢鍝佸凡涓嬫灦");
 		}
 
-		if (auctionId == null || auctionId <= 0) {
-			throw new ShareGoodsException(2, "鍟嗗搧ID涓嶈兘涓虹┖");
-		}
-
-		// 鐢ㄦ埛鍓╀綑鍙互娣樼ぜ閲戦獙璇�
-		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 +812,6 @@
 		taoBaoLink.setClickUrl(goods.getAuctionUrl());
 		taoBaoLink.setCouponLink(taoLiJinLink);
 		taoBaoLink.setGoods(goods);
-
 		return taoBaoLink;
 	}
 
@@ -798,7 +895,7 @@
 
 	@Override
 	public TaoBaoLink getTaoLiJinLinkForBuyWithOutFanLi(Long uid, Long auctionId, TaoKeAppInfo app)
-			throws ShareGoodsException {
+			throws ShareGoodsException, TaoLiJinCreateException {
 		if (uid == null || uid <= 0) {
 			throw new ShareGoodsException(1, "鐢ㄦ埛ID涓嶈兘涓虹┖");
 		}
@@ -822,20 +919,25 @@
 			throw new ShareGoodsException(4, "鍟嗗搧宸蹭笅鏋�");
 		}
 
-		BigDecimal perface = TaoBaoUtil.getGoodsHongBaoMoney(goods, new BigDecimal(70));
+		BigDecimal perface = TaoBaoUtil.getGoodsHongBaoMoney(goods, new BigDecimal(70), false);
 		TaoLiJinDTO taoLiJinDTO = null;
 		try {
 			taoLiJinDTO = TaoKeApiUtil.createTaoLiJin(auctionId, "鑷喘绔嬪噺", perface, 1,
 					new Date(currentTime - 1000 * 60 * 10L), sendEndTime, new Date(currentTime - 1000 * 60 * 10L),
 					sendEndTime, app);
-		} catch (TaoKeApiException e) {
-			if (e.getCode() == TaoKeApiException.CODE_TLJ_NO_MONEY) {// 璧勯噾涓嶈冻
+		} 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, "鐢熸垚鎺ㄥ箍閾炬帴澶辫触");
 

--
Gitblit v1.8.0