admin
2020-02-23 b59fef5c00b15fdfdfa9d4be26e5bf6b41c75458
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);