yumeng 5 роки тому
батько
коміт
818408ba4b

+ 12 - 3
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/BindAccountLoginController.java

@@ -39,6 +39,7 @@ import java.io.IOException;
 import java.io.UnsupportedEncodingException;
 import java.net.URLDecoder;
 import java.util.Arrays;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -63,7 +64,6 @@ public class BindAccountLoginController {
     private ICreateInternalService createInternalService;
 
     /**
-     *
      * @param json
      * @return
      */
@@ -72,7 +72,6 @@ public class BindAccountLoginController {
         Result<IPage<BindAccountLogin>> result = new Result<>();
         String advertiserId = json.getString("advertiserId");
         if (Check.isNull(advertiserId)) {
-            System.err.println("advertiserId不能为空");
             result.setSuccess(false);
             return result;
         }
@@ -84,8 +83,17 @@ public class BindAccountLoginController {
         String advertiserName = json.getString("advertiser_name");
         //账号
         String accountName = json.getString("accountName");
-        boolean trueOrFalse = createInternalService.bindLogin(advertiserId, accountName, password, loginType, userId, advertiserName);
+        Map<String, Object> stringObjectMap = createInternalService.bindLogin(advertiserId, accountName, password, loginType, userId, advertiserName);
+        Boolean trueOrFalse = (Boolean) stringObjectMap.get("success");
         if (trueOrFalse) {
+            Map<String, Object> deleteMap = new HashMap<>();
+            deleteMap.put("account_name", accountName);
+            deleteMap.put("user_id", userId);
+            deleteMap.put("advertiser_id", advertiserId);
+            userAllocationMapper.deleteByMap(deleteMap);
+
+            Long accountId = (Long) stringObjectMap.get("accountId");
+
             String realName = json.getString("realName");
             //部门id
             String departmentId = json.getString("departmentId");
@@ -97,6 +105,7 @@ public class BindAccountLoginController {
             userAllocation.setDistributionName(distributionName);
             userAllocation.setUserId(userId);
             userAllocation.setAdvertiserId(advertiserId);
+            userAllocation.setAccountId(accountId);
             userAllocation.setDepartmentId(departmentId);
             userAllocation.setAdvertiserName(advertiserName);
             userAllocation.setAccountName(accountName);

+ 1 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/ICreateInternalService.java

@@ -9,5 +9,5 @@ public interface ICreateInternalService {
 
     Map<String, Object> checkAccountPassword(String account, String password);
 
-    boolean bindLogin(String advertiserId, String accountName, String password, String loginType, String userId, String advertiserName);
+    Map<String, Object> bindLogin(String advertiserId, String accountName, String password, String loginType, String userId, String advertiserName);
 }

+ 11 - 5
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/CreateInternalServiceImpl.java

@@ -54,14 +54,17 @@ public class CreateInternalServiceImpl implements ICreateInternalService {
     private BytedanceUrlInfoMapper urlInfoMapper;
 
     @Override
-    public boolean bindLogin(String advertiserId, String accountName, String password, String loginType, String userId, String advertiserName) {
+    public Map<String, Object> bindLogin(String advertiserId, String accountName, String password, String loginType, String userId, String advertiserName) {
+
+        Map<String, Object> returnMap = new HashMap<>();
         Map<String, Object> requestMap = new HashMap<>();
         requestMap.put("advertiser_id", advertiserId);
         requestMap.put("account_name", accountName);
         requestMap.put("login_type", loginType);
         List<BindAccountLogin> bindAccounts = bindAccountLoginMapper.selectByMap(requestMap);
         if (!Check.isNull(bindAccounts)) {
-            return false;
+            returnMap.put("success", false);
+            return returnMap;
         }
         String accountId = "";
         //头条登录
@@ -69,7 +72,8 @@ public class CreateInternalServiceImpl implements ICreateInternalService {
             Map<String, Object> result = this.checkAccountPassword(accountName, password);
             Boolean checkSuccess = (Boolean) result.get("success");
             if (!checkSuccess) {
-                return false;
+                returnMap.put("success", false);
+                return returnMap;
             }
             accountId = (String) result.get("id");
         }
@@ -83,9 +87,11 @@ public class CreateInternalServiceImpl implements ICreateInternalService {
         int i = bindAccountLoginMapper.insert(bindAccountLogin);
         if (i > 0) {
             log.info("登录账号绑定成功,广告主id:{}", bindAccountLogin.getAdvertiserId());
-            return true;
+            returnMap.put("success", true);
+            returnMap.put("accountUd", password);
+            return returnMap;
         }
-        return false;
+        return returnMap;
     }
 
     @Override