From f4a0f2acc63d7785eab108419a4e16f5f688cb95 Mon Sep 17 00:00:00 2001
From: yujian <yujian@163.com>
Date: 星期六, 18 一月 2020 12:06:27 +0800
Subject: [PATCH] 用户注册信息

---
 fanli/src/main/java/com/yeshi/fanli/controller/client/v1/GoodsController.java |   52 ++++++++++++++++++++++++++++------------------------
 1 files changed, 28 insertions(+), 24 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/GoodsController.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/GoodsController.java
index 500ad52..9b09e21 100644
--- a/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/GoodsController.java
+++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/GoodsController.java
@@ -30,6 +30,7 @@
 import com.yeshi.fanli.service.inter.monitor.BusinessEmergent110Service;
 import com.yeshi.fanli.service.inter.monitor.MonitorService;
 import com.yeshi.fanli.service.inter.taobao.TLJBuyGoodsService;
+import com.yeshi.fanli.service.inter.taobao.TLJFreeBuyGoodsService;
 import com.yeshi.fanli.service.inter.taobao.TaoBaoBuyRelationMapService;
 import com.yeshi.fanli.service.inter.taobao.TaoBaoUnionConfigService;
 import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinRecordService;
@@ -42,8 +43,8 @@
 import com.yeshi.fanli.util.StringUtil;
 import com.yeshi.fanli.util.TaoBaoConstant;
 import com.yeshi.fanli.util.TimeUtil;
-import com.yeshi.fanli.util.VersionUtil;
 import com.yeshi.fanli.util.factory.MonitorFactory;
+import com.yeshi.fanli.util.taobao.TaoBaoUtil;
 import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
 
 import net.sf.json.JSONObject;
@@ -90,6 +91,10 @@
 
 	@Resource
 	private IntegralGetService integralGetService;
+	
+	@Resource
+	private TLJFreeBuyGoodsService tljFreeBuyGoodsService;
+	
 
 	private void doTaoLiJinBuy(AcceptData acceptData, Long uid, Long auctionId, PrintWriter out) {
 		JSONObject data = new JSONObject();
@@ -127,6 +132,7 @@
 
 		integralGetService.addTaoLiJinBuy(uid, auctionId);
 	}
+	
 
 	/**
 	 * 鑾峰彇娣樺疂鐨勫垎浜摼鎺�
@@ -156,6 +162,14 @@
 			return;
 		}
 
+		try {
+			// 鏃ュ織璁板綍
+			String info = String.format("type=buy&uid=%s&goodsId=%s&source=%s&goodsType=%s", uid, auctionId, source,
+					Constant.SOURCE_TYPE_TAOBAO);
+			LogHelper.orderInfo(info);
+		} catch (Exception e) {
+		}
+
 		TaoBaoGoodsBrief goods = null;
 
 		try {
@@ -175,11 +189,11 @@
 			doTaoLiJinBuy(acceptData, uid, auctionId, out);
 			return;
 		}
-
+		
 		ClientTBPid clientTBPid = null;
 
 		String dpid = null;
-		if (goods.getMaterialLibType() != null && goods.getMaterialLibType() > 0) {
+		if (TaoBaoUtil.isSpecialGoods(goods.getMaterialLibType())) {
 			dpid = TaoBaoConstant.TAOBAO_SPECIAL_PID_DEFAULT;
 		} else {
 			dpid = TaoBaoConstant.TAOBAO_RELATION_AS_SPECIAL_PID;
@@ -195,7 +209,7 @@
 
 		boolean specialConvert = false;
 
-		if (goods.getMaterialLibType() != null && goods.getMaterialLibType() == 1) {
+		if (TaoBaoUtil.isSpecialGoods(goods.getMaterialLibType())) {
 			specialConvert = true;
 		} else
 			specialConvert = false;
@@ -231,16 +245,8 @@
 			// 鏄繑鍒╁晢鍝佸簱鐨勫晢鍝�
 			if (specialConvert) {
 				if (!StringUtil.isNullOrEmpty(specialId)) {
-					if (source != null && "taolijin".equals(source)) {
-						boolean isNewUser = userInfoExtraService.isNewUser(uid);
-						if (isNewUser) {
-							// 鍒ゅ畾涓鸿�佺敤鎴凤細
-							// 鏂颁汉鍙浣跨敤浜嗘柊浜虹孩鍖咃紝涔熷氨鏄偅1鍧楅挶锛岄偅涔堬紝浠栫湅鍒扮殑鍒嗕韩鐖嗘涓殑鍟嗗搧-灏卞彧鑳藉垎浜��
-							long countRecord = userTaoLiJinRecordService.countRecordByUid(uid);
-							if (countRecord == 0) {
-								taoBaoLink = shareGoodsService.getTaoLiJinLinkForBuy(uid, specialId, auctionId, null);
-							}
-						}
+					if (source != null && "taolijin_free_buy".equals(source)) {
+						taoBaoLink = shareGoodsService.getTaoLiJinLinkForBuy(uid, specialId, auctionId, null);
 					}
 
 					if (taoBaoLink == null) {
@@ -268,17 +274,9 @@
 					LogHelper.errorDetailInfo(e, "uid:" + uid, null);
 				}
 				if (!StringUtil.isNullOrEmpty(relationId)) {//
-					if (source != null && "taolijin".equals(source)) {
-						boolean isNewUser = userInfoExtraService.isNewUser(uid);
-						if (isNewUser) {
-							// 鍒ゅ畾涓鸿�佺敤鎴凤細
-							// 鏂颁汉鍙浣跨敤浜嗘柊浜虹孩鍖咃紝涔熷氨鏄偅1鍧楅挶锛岄偅涔堬紝浠栫湅鍒扮殑鍒嗕韩鐖嗘涓殑鍟嗗搧-灏卞彧鑳藉垎浜��
-							long countRecord = userTaoLiJinRecordService.countRecordByUid(uid);
-							if (countRecord == 0) {
-								taoBaoLink = shareGoodsService.getTaoLiJinLinkForBuy(uid, specialId, auctionId,
+					if (source != null && "taolijin_free_buy".equals(source)) {
+						taoBaoLink = shareGoodsService.getTaoLiJinLinkForBuy(uid, specialId, auctionId,
 										TaoBaoConstant.TAOBAO_RELATION_AS_SPECIAL_PID);
-							}
-						}
 					} else {
 						taoBaoLink = shareGoodsService.getTaoBaoLinkForShare(uid, auctionId, relationId,
 								TaoBaoConstant.TAOBAO_RELATION_AS_SPECIAL_PID);
@@ -308,6 +306,12 @@
 			// 鑾峰緱閲戝竵
 			integralGetService.addCouponRebate(uid);
 
+		} catch (ShareGoodsException e) {
+			if (e.getCode() == 1001 || e.getCode() == 1002) {
+				out.print(JsonUtil.loadFalseResult(e.getCode(), e.getMsg()));
+			} else {
+				out.print(JsonUtil.loadFalseResult(1, e.getMsg()));
+			}
 		} catch (Exception e) {
 
 			LogHelper.errorDetailInfo(e);

--
Gitblit v1.8.0