admin
2019-07-19 90ce9c6390613004d24699a80bbbe23f482cf001
fanli/src/main/java/com/yeshi/fanli/controller/AuthCallBackController.java
@@ -15,8 +15,10 @@
import com.yeshi.fanli.entity.bus.user.UserInfo;
import com.yeshi.fanli.entity.taobao.TaoBaoUnionAuthRecord;
import com.yeshi.fanli.exception.taobao.TaoBaoAuthException;
import com.yeshi.fanli.exception.user.UserExtraTaoBaoInfoException;
import com.yeshi.fanli.log.LogHelper;
import com.yeshi.fanli.service.inter.msg.UserAccountMsgNotificationService;
import com.yeshi.fanli.service.inter.taobao.TaoBaoUnionAuthRecordService;
import com.yeshi.fanli.service.inter.user.UserExtraTaoBaoInfoService;
import com.yeshi.fanli.util.AESUtil;
@@ -44,6 +46,9 @@
   @Resource
   private TaoBaoUnionAuthRecordService taoBaoUnionAuthRecordService;
   @Resource
   private UserAccountMsgNotificationService userAccountMsgNotificationService;
   @Resource
   private RedisManager redisManager;
@@ -102,12 +107,20 @@
         } catch (Exception e) {
         }
         final String name = nickName;
         // LogHelper.test("uid:" + uid + "\n accessToken:" + accessToken);
         LogHelper.test("uid:" + uid + "\n accessToken:" + accessToken);
         // 获取渠道ID与会员ID
         if ("share".equalsIgnoreCase(source)) {
            String relationId = TaoKeApiUtil.getRelationId(accessToken, TaoBaoConstant.TAOBAO_AUTH_APPKEY,
                  TaoBaoConstant.TAOBAO_AUTH_APPSECRET);// 渠道ID
            String relationId = null;
            try {
               TaoKeApiUtil.getRelationId(accessToken, TaoBaoConstant.TAOBAO_AUTH_APPKEY,
                     TaoBaoConstant.TAOBAO_AUTH_APPSECRET);// 渠道ID
            } catch (TaoBaoAuthException e) {
               if (e.getCode() == TaoBaoAuthException.CODE_NOT_REAL_NAME)
                  userAccountMsgNotificationService.taoBaoAuthFail(uid, name, "淘宝账号未实名");
            }
            if (StringUtil.isNullOrEmpty(relationId))
               LogHelper.test(uid + "渠道备案失败");
            try {
@@ -121,8 +134,13 @@
               @Override
               public void run() {
                  String specialId = TaoKeApiUtil.getSpecialId(accessToken, TaoBaoConstant.TAOBAO_AUTH_APPKEY,
                        TaoBaoConstant.TAOBAO_AUTH_APPSECRET);
                  String specialId = null;
                  try {
                     specialId = TaoKeApiUtil.getSpecialId(accessToken, TaoBaoConstant.TAOBAO_AUTH_APPKEY,
                           TaoBaoConstant.TAOBAO_AUTH_APPSECRET);
                  } catch (TaoBaoAuthException e1) {
                  }
                  if (StringUtil.isNullOrEmpty(specialId))
                     LogHelper.test(uid + "会员备案失败");
@@ -133,10 +151,19 @@
                  }
               }
            });
            //稍作延迟
            Thread.sleep(50);
         } else if ("zigou".equalsIgnoreCase(source)) {
            String specialId = TaoKeApiUtil.getSpecialId(accessToken, TaoBaoConstant.TAOBAO_AUTH_APPKEY,
                  TaoBaoConstant.TAOBAO_AUTH_APPSECRET);
            String specialId = null;
            try {
               specialId = TaoKeApiUtil.getSpecialId(accessToken, TaoBaoConstant.TAOBAO_AUTH_APPKEY,
                     TaoBaoConstant.TAOBAO_AUTH_APPSECRET);
            } catch (TaoBaoAuthException e) {
               if (e.getCode() == TaoBaoAuthException.CODE_NOT_REAL_NAME)
                  userAccountMsgNotificationService.taoBaoAuthFail(uid, name, "淘宝账号未实名");
            }
            if (StringUtil.isNullOrEmpty(specialId))
               LogHelper.test(uid + "会员备案失败");
@@ -152,8 +179,12 @@
               @Override
               public void run() {
                  String relationId = TaoKeApiUtil.getRelationId(accessToken, TaoBaoConstant.TAOBAO_AUTH_APPKEY,
                        TaoBaoConstant.TAOBAO_AUTH_APPSECRET);// 渠道ID
                  String relationId = null;
                  try {
                     relationId = TaoKeApiUtil.getRelationId(accessToken, TaoBaoConstant.TAOBAO_AUTH_APPKEY,
                           TaoBaoConstant.TAOBAO_AUTH_APPSECRET);
                  } catch (TaoBaoAuthException e1) {
                  } // 渠道ID
                  if (StringUtil.isNullOrEmpty(relationId))
                     LogHelper.test(uid + "渠道备案失败");
                  try {
@@ -163,13 +194,23 @@
                  }
               }
            });
            //稍作延迟
            Thread.sleep(50);
         } else if ("bind".equalsIgnoreCase(source)) {
            boolean bindInfo = true;
            // 绑定淘宝:V1.5.3
            String relationId = TaoKeApiUtil.getRelationId(accessToken, Constant.TAOBAO_AUTH_APPKEY,
                  TaoBaoConstant.TAOBAO_AUTH_APPSECRET);// 渠道ID
            String relationId = null;
            int tbErrorCode = 0;
            try {
               relationId = TaoKeApiUtil.getRelationId(accessToken, Constant.TAOBAO_AUTH_APPKEY,
                     TaoBaoConstant.TAOBAO_AUTH_APPSECRET);// 渠道ID
            } catch (TaoBaoAuthException e) {
               tbErrorCode = e.getCode();
            }
            if (StringUtil.isNullOrEmpty(relationId)) {
               LogHelper.test(uid + "渠道备案失败");
               bindInfo = false;
@@ -177,8 +218,12 @@
            String specialId = null;
            if (bindInfo) {
               specialId = TaoKeApiUtil.getSpecialId(accessToken, Constant.TAOBAO_AUTH_APPKEY,
                     TaoBaoConstant.TAOBAO_AUTH_APPSECRET);
               try {
                  specialId = TaoKeApiUtil.getSpecialId(accessToken, Constant.TAOBAO_AUTH_APPKEY,
                        TaoBaoConstant.TAOBAO_AUTH_APPSECRET);
               } catch (TaoBaoAuthException e) {
                  tbErrorCode = e.getCode();
               }
               if (StringUtil.isNullOrEmpty(specialId)) {
                  LogHelper.test(uid + "会员备案失败");
                  bindInfo = false;
@@ -186,6 +231,9 @@
            }
            if (!bindInfo) {
               if (tbErrorCode == TaoBaoAuthException.CODE_NOT_REAL_NAME) {
                  userAccountMsgNotificationService.taoBaoAuthFail(uid, name, "淘宝账号未实名");
               }
               errCode = 5;// 信息获取不全
            } else {
               try {
@@ -215,11 +263,7 @@
      } catch (Exception e) {
         errCode = 4;
         try {
            LogHelper.errorDetailInfo(e);
         } catch (Exception e1) {
            e1.printStackTrace();
         }
         LogHelper.errorDetailInfo(e);
      }
      try {