From fe879975a3e8a0a1aa280fb839e02d159bfbcff8 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期二, 27 八月 2019 18:04:38 +0800
Subject: [PATCH] 金币任务多次获取bug修改

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/goods/ShareGoodsServiceImpl.java |   23 +++++++++++++++++++----
 1 files changed, 19 insertions(+), 4 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 3013305..e4e4ca4 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
@@ -38,12 +38,14 @@
 import com.yeshi.fanli.exception.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.monitor.BusinessEmergent110Service;
 import com.yeshi.fanli.service.inter.taobao.TLJBuyGoodsService;
 import com.yeshi.fanli.service.inter.taobao.TaoBaoUnionConfigService;
 import com.yeshi.fanli.service.inter.taobao.UserTLJBuyHistoryService;
@@ -113,6 +115,9 @@
 
 	@Resource
 	private TLJBuyGoodsService tljBuyGoodsService;
+
+	@Resource
+	private BusinessEmergent110Service businessEmergent110Service;
 
 	@Override
 	public void addShareGoodsHistory(UserShareGoodsHistory history) {
@@ -792,7 +797,8 @@
 	}
 
 	@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涓嶈兘涓虹┖");
 		}
@@ -817,15 +823,24 @@
 		}
 
 		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, "鐢熸垚鎺ㄥ箍閾炬帴澶辫触");
 

--
Gitblit v1.8.0