From 2012b3b5db3c6b06535a68f775bcc81b16151b90 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期五, 06 九月 2019 16:54:00 +0800
Subject: [PATCH] 加入任务

---
 fanli/src/main/java/com/yeshi/fanli/util/taobao/TaoKeApiUtil.java |   40 +++++++++++-----------------------------
 1 files changed, 11 insertions(+), 29 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/util/taobao/TaoKeApiUtil.java b/fanli/src/main/java/com/yeshi/fanli/util/taobao/TaoKeApiUtil.java
index e7aeb14..f881d10 100644
--- a/fanli/src/main/java/com/yeshi/fanli/util/taobao/TaoKeApiUtil.java
+++ b/fanli/src/main/java/com/yeshi/fanli/util/taobao/TaoKeApiUtil.java
@@ -25,7 +25,9 @@
 import com.yeshi.fanli.exception.taobao.TaoBaoAuthException;
 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.log.LogHelper;
+import com.yeshi.fanli.log.TLJLogHelper;
 import com.yeshi.fanli.log.TaoKeLogHelper;
 import com.yeshi.fanli.tag.PageEntity;
 import com.yeshi.fanli.util.MoneyBigDecimalUtil;
@@ -38,8 +40,6 @@
 
 //娣樺疂瀹PI鎺ュ彛
 public class TaoKeApiUtil {
-
-	
 
 	// 瑙f瀽鍒哥殑鍐呭
 	private static TaoBaoSearchResult parseCoupleContent(String content) {
@@ -339,22 +339,6 @@
 				System.out.println(goods.getAuctionId() + ":" + g.getAuctionId());
 				if (goods.getAuctionId().longValue() == g.getAuctionId()) {
 					g.setId(goods.getAuctionId());
-					// 鍒ゆ柇鏄惁鏈変紭鎯犲埜
-					if (!StringUtil.isNullOrEmpty(g.getCouponActivityId())) {
-						// 鑾峰彇浼樻儬鍒歌鎯�
-						QuanInfo quanInfo = getQuanInfo(g.getAuctionId(), g.getCouponActivityId());
-						if (quanInfo != null) {
-							g.setCouponAmount(quanInfo.coupon_amount);
-							g.setCouponEffectiveEndTime(quanInfo.coupon_end_time);
-							g.setCouponEffectiveStartTime(quanInfo.coupon_start_time);
-							g.setCouponLeftCount(quanInfo.coupon_remain_count);
-							g.setCouponStartFee(quanInfo.coupon_start_fee);
-							g.setCouponTotalCount(quanInfo.coupon_total_count);
-						}
-					} else {
-						g.setCouponAmount(new BigDecimal(0));
-						g.setCouponStartFee(new BigDecimal(0));
-					}
 					g.setCreatetime(new Date());
 					g.setMaterialLibType(goods.getMaterialLibType());
 					return g;
@@ -892,10 +876,9 @@
 		if (!StringUtil.isNullOrEmpty(goods.getCouponInfo())) {
 			List<BigDecimal> quanInfo = TaoBaoCouponUtil.getCouponInfo(goods.getCouponInfo());
 			goods.setCouponAmount(quanInfo.get(1));
-			goods.setCouponEffectiveEndTime(
-					TimeUtil.getGernalTime(System.currentTimeMillis() + 1000 * 60 * 60 * 24, "yyyy-MM-dd"));
-			goods.setCouponEffectiveStartTime(TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyy-MM-dd"));
-			goods.setCouponStartFee(quanInfo.get(0));
+			goods.setCouponEffectiveEndTime(item.optString("coupon_end_time"));
+			goods.setCouponEffectiveStartTime(item.optString("coupon_start_time"));
+			goods.setCouponStartFee(new BigDecimal(item.optString("coupon_start_fee")));
 			goods.setCouponLeftCount(item.optInt("coupon_remain_count"));
 			goods.setCouponLink("https:" + item.optString("coupon_share_url"));
 			goods.setCouponTotalCount(item.optInt("coupon_total_count"));
@@ -1708,7 +1691,7 @@
 	public static void taoKeContent() {
 		Map<String, String> map = new HashMap<>();
 		map.put("method", "taobao.tbk.content.get");
-		map.put("adzone_id", TaoBaoConstant.TAOBAO_SPECIAL_PID_DEFAULT.split("_")[3]);
+		map.put("adzone_id", TaoBaoConstant.TAOBAO_RELATION_PID_DEFAULT.split("_")[3]);
 		map.put("type", "1");
 		map.put("count", "100");
 
@@ -1922,7 +1905,7 @@
 	// 娣樼ぜ閲戝垱寤�
 	public static TaoLiJinDTO createTaoLiJin(Long auctionId, String name, BigDecimal perface, int totalNum,
 			Date sendStartTime, Date sendEndTime, Date useStartTime, Date useEndTime, TaoKeAppInfo app)
-			throws TaoKeApiException {
+			throws TaoLiJinCreateException,TaoKeApiException {
 		Map<String, String> map = new HashMap<>();
 		map.put("method", "taobao.tbk.dg.vegas.tlj.create");
 		map.put("adzone_id", app.getPid().split("_")[3]);
@@ -1964,21 +1947,20 @@
 				// 鎺ュ彛杩斿洖寮傚父
 				String msgCode = root.optJSONObject("result").optString("msg_code");
 				if (!StringUtil.isNullOrEmpty(msgCode)) {
+					TLJLogHelper.info(auctionId, root.toString());// 娣樼ぜ閲戝紓甯镐俊鎭褰�
 					switch (msgCode) {
 					case "FAIL_BIZ_ITEM_FORBIDDEN":
-						throw new TaoKeApiException(TaoKeApiException.CODE_TLJ_FORBIDDEN, "璇ュ晢鍝佷笉鏀寔鍒涘缓娣樼ぜ閲戠孩鍖�");
+						throw new TaoLiJinCreateException(TaoLiJinCreateException.CODE_TLJ_FORBIDDEN, "璇ュ晢鍝佷笉鏀寔鍒涘缓娣樼ぜ閲戠孩鍖�");
 					case "FAIL_BIZ_ACCOUNT_UN_PAID":
 					case "PRE_FREEZE_ASSET_ACCOUNT_ERROR":
-						throw new TaoKeApiException(TaoKeApiException.CODE_TLJ_NO_MONEY, "瀹樻柟鐜╂硶閽卞寘浣欓涓嶈冻");
+						throw new TaoLiJinCreateException(TaoLiJinCreateException.CODE_TLJ_NO_MONEY, "瀹樻柟鐜╂硶閽卞寘浣欓涓嶈冻");
 					default:
-						return null;
+						throw new TaoKeApiException(Integer.parseInt(msgCode), root.toString());
 					}
 				}
 			}
 		} catch (TaoKeApiException e) {
 			throw e;
-		} catch (Exception e) {
-			LogHelper.errorDetailInfo(e);
 		}
 
 		return null;

--
Gitblit v1.8.0