소스 검색

用户分配调整

yumeng 5 년 전
부모
커밋
f0ab1240b7
14개의 변경된 파일349개의 추가작업 그리고 469개의 파일을 삭제
  1. 1 0
      jeecg-boot-module-system/src/main/java/org/jeecg/config/ShiroConfig.java
  2. 0 83
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/AuthController.java
  3. 14 17
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/BindAccountAuthController.java
  4. 81 59
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/CallbackController.java
  5. 217 213
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/UserAllocationController.java
  6. 11 12
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/UserAllocation.java
  7. 5 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/UserAllocationMapper.java
  8. 0 4
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/IBindAccountAuthService.java
  9. 2 3
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/IUserAllocationService.java
  10. 2 47
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/BindAccountAuthServiceImpl.java
  11. 2 15
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/UserAllocationServiceImpl.java
  12. 4 4
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/vue/UserAllocationList.vue
  13. 5 5
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/vue/modules/UserAllocationModal.vue
  14. 5 5
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/vue/modules/UserAllocationModal__Style#Drawer.vue

+ 1 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/config/ShiroConfig.java

@@ -75,6 +75,7 @@ public class ShiroConfig {
 		filterChainDefinitionMap.put("/kuaishou/**", "anon");
 		filterChainDefinitionMap.put("/ctop/bindAccount/**", "anon");
 		filterChainDefinitionMap.put("/**/*.mp4", "anon");
+		filterChainDefinitionMap.put("/bytedance", "anon");
 
 
 		//性能监控

+ 0 - 83
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/AuthController.java

@@ -1,11 +1,6 @@
 package org.jeecg.modules.ctop.controller;
 
-import org.jeecg.modules.ctop.mapper.CTopOauthTokenMapper;
-import org.jeecg.modules.ctop.mapper.UserAllocationMapper;
-import org.jeecg.modules.ctop.service.IAuthTaskService;
 import org.jeecg.modules.ctop.service.IBindAccountAuthService;
-import org.jeecg.modules.ctop.service.ICTopOauthTokenService;
-import org.jeecg.modules.ctop.service.IUserAllocationService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -28,14 +23,6 @@ public class AuthController {
     @Autowired
     private IBindAccountAuthService bindAccountAuthService;
 
-    @Autowired
-    private CTopOauthTokenMapper cTopOauthTokenMapper;
-    @Autowired
-    private IAuthTaskService authTaskService;
-    @Autowired
-    private UserAllocationMapper allocationMapper;
-    @Autowired
-    private IUserAllocationService userAllocationService;
 
     @RequestMapping("/begin")
     public String authBegin(HttpServletRequest request,
@@ -63,19 +50,6 @@ public class AuthController {
         return "auth_error";
     }
 
-  /*  @RequestMapping("/bytedance")
-    @ResponseBody
-    public String bytedance(HttpServletRequest request,
-                            HttpServletResponse response,
-                            @RequestParam("auth_code") String authCode,
-                            @RequestParam("state") String state, @RequestParam("accountId") String accountId) {
-        System.out.println(request.getQueryString());
-        if (StringUtils.isNotBlank(authCode)) {
-            System.out.println(this.getByteDanceAccessToken(authCode, accountId, state));
-            return "auth_success";
-        }
-        return "auth_fail";
-    }*/
 
     @GetMapping("bytedance/refreshtoken")
     @ResponseBody
@@ -83,62 +57,5 @@ public class AuthController {
         return null;
     }
 
-    @Autowired
-    private ICTopOauthTokenService tokenService;
-
-  /*  public String getByteDanceAccessToken(String authCode, String accountId, String state) {
-        Map<String, Object> param = new HashMap<String, Object>();
-        param.put("app_id", PropertiesUtils.getValue("bytedance_config", "bytedance_appid"));
-        param.put("secret", PropertiesUtils.getValue("bytedance_config", "bytedance_secret"));
-        param.put("grant_type", "auth_code");
-        param.put("auth_code", authCode);
-
-        Gson gson = new Gson();
-        String result = "";
-        try {
-            result = HttpUtils.httpPostRequest(PropertiesUtils.getValue("bytedance_config", "bytedance_api_url") + BytedanceInterfaceConstant.AUTH_TOKEN, param, new HashMap<>());
-            JSONObject resultObject = JSONObject.parseObject(result);
-            Integer code = resultObject.getInteger("code");
-            String message = resultObject.getString("message");
-            if (null == code || code != 0) {
-                logger.info("获取token失败,accountId:{},message:{}", accountId, message);
-            }
-            JSONObject data = resultObject.getJSONObject("data");
-            CTopOauthToken token = new CTopOauthToken(accountId, data);
-            if (Check.isNull(token)) {
-                AuthTask authTask = authTaskService.getAuthTask(state);
-                if (Check.isNull(authTask)) {
-                    throw new Exception("根据taskId未取到任务相关信息,taskId:" + state);
-                }
-                String advertiserId = authTask.getAdvertiserId();
-
-                Map<String, Object> deleteMap = new HashMap<>();
-                deleteMap.put("advertiser_id", advertiserId);
-                deleteMap.put("account_id", token.getAccountId());
-                cTopOauthTokenMapper.deleteByMap(deleteMap); //删除 广告主id下的相关授权信息
-                token.setAdvertiserId(advertiserId);
-                cTopOauthTokenMapper.insert(token);
-                bindAccountAuthService.addBindAccount(token.getAccountId(), KuaishouInterfaceConstant.LOGIN_TYPE_BYTEDANCE, advertiserId); //账号绑定
-
-                // 快手 更新账号分配表
-                UserAllocation userAllocation = userAllocationService.selectByTaskId(state);
-                userAllocation.setAccountId(token.getAccountId());
-                allocationMapper.deleteById(userAllocation.getId());
-
-                Map<String, Object> deleteUserMap = new HashMap<>();
-                deleteUserMap.put("account_id", accountId);
-                deleteUserMap.put("advertiser_id", advertiserId);
-                allocationMapper.deleteByMap(deleteUserMap);
 
-                int i = allocationMapper.insert(userAllocation);
-                if (i > 0) {
-                    logger.info("同步分配用户表完成,task_id:{},accountId:{}", state, accountId);
-
-                }
-            }
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-        return result;
-    }*/
 }

+ 14 - 17
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/BindAccountAuthController.java

@@ -14,7 +14,6 @@ import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.query.QueryGenerator;
 import org.jeecg.common.util.oConvertUtils;
 import org.jeecg.modules.ctop.entity.BindAccountAuth;
-import org.jeecg.modules.ctop.entity.UserAllocation;
 import org.jeecg.modules.ctop.service.IBindAccountAuthService;
 import org.jeecgframework.poi.excel.ExcelImportUtil;
 import org.jeecgframework.poi.excel.def.NormalExcelConstants;
@@ -56,32 +55,30 @@ public class BindAccountAuthController {
         String codeUrl = null;
         try {
             String advertiserId = json.getString("advertiserId");
-            if(Check.isNull(advertiserId)){
+            if (Check.isNull(advertiserId)) {
                 System.err.println("advertiserId不能为空");
                 result.setSuccess(false);
                 return result;
             }
+
             String authorizationType = json.getString("authorizationType");
-            String distributionName = json.getString("distributionName");//指定分配人姓名
-            String advertiserName = json.getString("advertiser_name"); // 广告主名称
-            String mediaId = json.getString("mediaId"); // 媒体类型: 1 头条 2 快手
-            String realName = json.getString("realName");
-            String departmentId = json.getString("departmentId"); //部门id
-            String userId = json.getString("userId"); //创建人
-            UserAllocation userAllocation = new UserAllocation();
-            userAllocation.setDistributionName(distributionName);
-            userAllocation.setUserId(userId);
-            userAllocation.setAdvertiserName(advertiserName);
-            userAllocation.setMediaId(mediaId);
-            userAllocation.setDepartmentId(departmentId);
-            userAllocation.setOperationName(realName);
-            codeUrl = bindAccountAuthService.bindAuthorization(advertiserId, authorizationType, userAllocation);
+
+            if ("kuaishou".equals(authorizationType)) {
+                codeUrl = bindAccountAuthService.getKuaishouCodeUrl(JSONObject.toJSONString(json));
+            }
+            if ("bytedance".equals(authorizationType)) {
+                codeUrl = bindAccountAuthService.getByteDanceCodeUrl(JSONObject.toJSONString(json));
+            }
+            result.setMessage(codeUrl);
+            result.setSuccess(true);
+            return result;
         } catch (UnsupportedEncodingException e) {
             e.printStackTrace();
         }
         result.setMessage(codeUrl);
-        result.setSuccess(true);
+        result.setSuccess(false);
         return result;
+
     }
 
 

+ 81 - 59
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/CallbackController.java

@@ -5,25 +5,21 @@ import cn.com.ctop.common.utils.HttpUtils;
 import cn.com.ctop.common.utils.PropertiesUtils;
 import cn.com.ctop.kuaishou.modules.material.entity.KuaishouAccessToken;
 import cn.com.ctop.kuaishou.modules.material.entity.KuaishouResultToken;
-import cn.com.ctop.kuaishou.modules.material.service.IKuaishouAccessTokenService;
 import cn.com.ctop.toutiao.common.BytedanceInterfaceConstant;
 import com.alibaba.fastjson.JSONObject;
-import com.google.gson.Gson;
 import constant.KuaishouInterfaceConstant;
 import org.apache.commons.lang.StringUtils;
-import org.jeecg.modules.ctop.entity.AuthTask;
 import org.jeecg.modules.ctop.entity.CTopOauthToken;
 import org.jeecg.modules.ctop.entity.UserAllocation;
 import org.jeecg.modules.ctop.mapper.CTopOauthTokenMapper;
 import org.jeecg.modules.ctop.mapper.UserAllocationMapper;
-import org.jeecg.modules.ctop.service.IAuthTaskService;
 import org.jeecg.modules.ctop.service.IBindAccountAuthService;
-import org.jeecg.modules.ctop.service.IUserAllocationService;
 import org.jeecg.modules.kuaishou.service.IKuaishouInterfaceService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.ResponseBody;
@@ -41,48 +37,66 @@ public class CallbackController {
 
     @Autowired
     private IKuaishouInterfaceService kuaishouInterfaceService;
-    @Autowired
-    private IKuaishouAccessTokenService kuaishouAccessTokenService;
+
     @Autowired
     private CTopOauthTokenMapper cTopOauthTokenMapper;
     @Autowired
     private IBindAccountAuthService bindAccountAuthService;
-    @Autowired
-    private IAuthTaskService authTaskService;
-    @Autowired
-    private UserAllocationMapper allocationMapper;
-    @Autowired
-    private IUserAllocationService allocationService;
 
     @Autowired
-    private IUserAllocationService userAllocationService;
+    private UserAllocationMapper allocationMapper;
 
 
-    @RequestMapping("/kuaishou")
+    @GetMapping("/kuaishou")
     @ResponseBody
     public String kuaishou(HttpServletRequest request,
                            HttpServletResponse response,
                            @RequestParam("auth_code") String authCode,
                            @RequestParam("state") String state) {
         try {
+            JSONObject json = JSONObject.parseObject(state);
+            if (Check.isNull(json)) {
+                throw new Exception("回调信息为空");
+            }
             if (StringUtils.isNotBlank(authCode)) {
                 KuaishouResultToken accessToken = kuaishouInterfaceService.getAccessToken(authCode);
                 KuaishouAccessToken token = accessToken.getData();
                 if (token != null) {
-                    AuthTask authTask = authTaskService.getAuthTask(state);
-                    if (Check.isNull(authTask)) {
-                        throw new Exception("根据taskId未取到任务相关信息,taskId:" + state);
+                    Long accountId = token.getAccountId();
+                    String advertiser_id = json.getString("advertiserId");
+                    String distributionName = json.getString("distributionName");//指定分配人姓名
+                    String advertiserName = json.getString("advertiser_name"); // 广告主名称
+                    String mediaId = json.getString("mediaId"); // 媒体类型: 1 头条 2 快手
+                    String realName = json.getString("realName");
+                    String departmentId = json.getString("departmentId"); //部门id
+                    String userId = json.getString("userId"); //创建人
+                    UserAllocation userAllocation = new UserAllocation();
+                    userAllocation.setDistributionName(distributionName);
+                    userAllocation.setUserId(userId);
+                    userAllocation.setAdvertiserId(advertiser_id);
+                    userAllocation.setAuthName(json.getString("authName"));
+                    userAllocation.setAdvertiserName(advertiserName);
+                    userAllocation.setMediaId(mediaId);
+                    userAllocation.setDepartmentId(departmentId);
+                    userAllocation.setOperationName(realName);
+                    userAllocation.setAccountId(accountId);
+                    allocationMapper.deleteById(userAllocation.getId());
+                    Map<String, Object> deleteUserMap = new HashMap<>();
+                    deleteUserMap.put("advertiser_id", advertiser_id);
+                    deleteUserMap.put("account_id", accountId);
+                    allocationMapper.deleteByMap(deleteUserMap);
+                    int i = allocationMapper.insert(userAllocation);
+                    if (i > 0) {
+                        logger.info("同步分配用户表完成,task_id:{},accountId:{}", state, accountId);
                     }
-                    String advertiserId = authTask.getAdvertiserId();
                     CTopOauthToken topOauthToken = new CTopOauthToken();
-                    Long accountId = token.getAccountId();
                     Map<String, Object> deleteMap = new HashMap<>();
-                    deleteMap.put("advertiser_id", advertiserId);
+                    deleteMap.put("advertiser_id", advertiser_id);
                     deleteMap.put("account_id", accountId);
                     cTopOauthTokenMapper.deleteByMap(deleteMap); //删除 广告主id下的相关授权信息
                     topOauthToken.setAccountId(accountId);
                     topOauthToken.setMediaId("2");
-                    topOauthToken.setAdvertiserId(advertiserId);
+                    topOauthToken.setAdvertiserId(advertiser_id);
                     topOauthToken.setAccessToken(token.getAccessToken());
                     long accessTokenExpireIn = token.getAccessTokenExpiresIn() * 1000L;
                     long now = System.currentTimeMillis();
@@ -93,20 +107,7 @@ public class CallbackController {
                     Date refreshTokenExpireInDate = new Date(now + refreshTokenExpireIn);
                     topOauthToken.setRefreshTokenExpiresIn(refreshTokenExpireInDate);
                     cTopOauthTokenMapper.insert(topOauthToken);
-                    bindAccountAuthService.addBindAccount(accountId, KuaishouInterfaceConstant.LOGIN_TYPE_KUAISHOU, advertiserId); //账号绑定
-                    UserAllocation userAllocation = allocationService.selectByTaskId(state);
-                    userAllocation.setAccountId(accountId);
-                    allocationMapper.deleteById(userAllocation.getId());
-                    Map<String, Object> deleteUserMap = new HashMap<>();
-                    deleteUserMap.put("advertiser_id", advertiserId);
-                    deleteUserMap.put("account_id", accountId);
-                    allocationMapper.deleteByMap(deleteUserMap);
-
-                    int i = allocationMapper.insert(userAllocation);
-                    if (i > 0) {
-                        logger.info("同步分配用户表完成,task_id:{},accountId:{}", state, accountId);
-
-                    }
+                    bindAccountAuthService.addBindAccount(accountId, KuaishouInterfaceConstant.LOGIN_TYPE_KUAISHOU, advertiser_id); //账号绑定
                 }
                 return "auth_success";
             }
@@ -123,64 +124,85 @@ public class CallbackController {
                             HttpServletResponse response,
                             @RequestParam("auth_code") String authCode,
                             @RequestParam("state") String state) {
-        System.out.println(request.getQueryString());
+
         if (StringUtils.isNotBlank(authCode)) {
-            System.out.println(this.getByteDanceAccessToken(authCode, state));
-            return "auth_success";
+            Map<String, Object> map = this.getByteDanceAccessToken(authCode, state);
+            Integer code = (Integer) map.get("code");
+            if (code == 0) {
+                return "auth_success";
+            }
         }
         return "auth_fail";
     }
 
-    public String getByteDanceAccessToken(String authCode, String state) {
+    public Map<String, Object> getByteDanceAccessToken(String authCode, String state) {
         Map<String, Object> param = new HashMap<String, Object>();
         param.put("app_id", PropertiesUtils.getValue("bytedance_config", "bytedance_appid"));
         param.put("secret", PropertiesUtils.getValue("bytedance_config", "bytedance_secret"));
         param.put("grant_type", "auth_code");
         param.put("auth_code", authCode);
 
-        Gson gson = new Gson();
-        String result = "";
+        Map<String, Object> returnMap = new HashMap<>();
         try {
-            result = HttpUtils.httpPostRequest(PropertiesUtils.getValue("bytedance_config", "bytedance_api_url") + BytedanceInterfaceConstant.AUTH_TOKEN, param, new HashMap<>());
+            JSONObject json = JSONObject.parseObject(state);
+            if (Check.isNull(json)) {
+                throw new Exception("回调信息为空");
+            }
+            String result = HttpUtils.httpPostRequest(PropertiesUtils.getValue("bytedance_config", "bytedance_api_url") + BytedanceInterfaceConstant.AUTH_TOKEN, param, new HashMap<>());
             JSONObject resultObject = JSONObject.parseObject(result);
             Integer code = resultObject.getInteger("code");
             String message = resultObject.getString("message");
             if (null == code || code != 0) {
                 logger.info("获取token失败,state:{},message:{}", state, message);
+                throw new Exception("token返回码异常");
+
             }
             JSONObject data = resultObject.getJSONObject("data");
             CTopOauthToken token = new CTopOauthToken(data.getString("advertiser_id"), data);
             if (Check.isNull(token)) {
-                AuthTask authTask = authTaskService.getAuthTask(state);
-                if (Check.isNull(authTask)) {
-                    throw new Exception("根据taskId未取到任务相关信息,taskId:" + state);
-                }
-                String advertiserId = authTask.getAdvertiserId();
-                Map<String, Object> deleteMap = new HashMap<>();
-                deleteMap.put("advertiser_id", advertiserId);
-                deleteMap.put("account_id", token.getAccountId());
-                cTopOauthTokenMapper.deleteByMap(deleteMap); //删除 广告主id下的相关授权信息
-                token.setAdvertiserId(advertiserId);
-                cTopOauthTokenMapper.insert(token);
-                bindAccountAuthService.addBindAccount(token.getAccountId(), KuaishouInterfaceConstant.LOGIN_TYPE_BYTEDANCE, advertiserId); //账号绑定
-                // 头条 更新账号分配表
-                UserAllocation userAllocation = userAllocationService.selectByTaskId(state);
+                String advertiser_id = json.getString("advertiserId");
+                String mediaId = json.getString("mediaId"); // 媒体类型: 1 头条 2 快手
+                String realName = json.getString("realName");
+                String departmentId = json.getString("departmentId"); //部门id
+                String distributionName = json.getString("distributionName");//指定分配人姓名
+                String advertiserName = json.getString("advertiser_name"); // 广告主名称
+                String userId = json.getString("userId"); //创建人
+                UserAllocation userAllocation = new UserAllocation();
+                userAllocation.setDistributionName(distributionName);
+                userAllocation.setUserId(userId);
+                userAllocation.setDepartmentId(departmentId);
+                userAllocation.setOperationName(realName);
                 userAllocation.setAccountId(token.getAccountId());
+                userAllocation.setAdvertiserName(advertiserName);
+                userAllocation.setMediaId(mediaId);
+                userAllocation.setAdvertiserId(advertiser_id);
                 allocationMapper.deleteById(userAllocation.getId());
                 Map<String, Object> deleteUserMap = new HashMap<>();
+                deleteUserMap.put("advertiser_id", advertiser_id);
                 deleteUserMap.put("account_id", token.getAccountId());
-                deleteUserMap.put("advertiser_id", advertiserId);
                 allocationMapper.deleteByMap(deleteUserMap);
                 int i = allocationMapper.insert(userAllocation);
                 if (i > 0) {
                     logger.info("同步分配用户表完成,task_id:{},accountId:{}", state, token.getAccountId());
 
                 }
+                Map<String, Object> deleteMap = new HashMap<>();
+                deleteMap.put("advertiser_id", advertiser_id);
+                deleteMap.put("account_id", token.getAccountId());
+                cTopOauthTokenMapper.deleteByMap(deleteMap); //删除 广告主id下的相关授权信息
+                token.setAdvertiserId(advertiser_id);
+                cTopOauthTokenMapper.insert(token);
+                bindAccountAuthService.addBindAccount(token.getAccountId(), KuaishouInterfaceConstant.LOGIN_TYPE_BYTEDANCE, advertiser_id); //账号绑定
+                returnMap.put("code", 0);
+                returnMap.put("desc", "success");
             }
         } catch (Exception e) {
             e.printStackTrace();
+            returnMap.put("code", -1);
+            returnMap.put("desc", "回调token异常");
+
         }
-        return result;
+        return returnMap;
     }
 
 }

+ 217 - 213
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/UserAllocationController.java

@@ -1,244 +1,248 @@
 package org.jeecg.modules.ctop.controller;
 
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
-import org.jeecg.common.system.query.QueryGenerator;
 import org.jeecg.common.aspect.annotation.AutoLog;
+import org.jeecg.common.system.query.QueryGenerator;
 import org.jeecg.common.util.oConvertUtils;
 import org.jeecg.modules.ctop.entity.UserAllocation;
 import org.jeecg.modules.ctop.service.IUserAllocationService;
-import java.util.Date;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import lombok.extern.slf4j.Slf4j;
-
 import org.jeecgframework.poi.excel.ExcelImportUtil;
 import org.jeecgframework.poi.excel.def.NormalExcelConstants;
 import org.jeecgframework.poi.excel.entity.ExportParams;
 import org.jeecgframework.poi.excel.entity.ImportParams;
 import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
-
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 import org.springframework.web.multipart.MultipartHttpServletRequest;
 import org.springframework.web.servlet.ModelAndView;
-import com.alibaba.fastjson.JSON;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
 
- /**
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+/**
  * @Description: 用户分配
  * @Author: jeecg-boot
- * @Date:   2019-07-31
+ * @Date: 2019-08-08
  * @Version: V1.0
  */
 @Slf4j
-@Api(tags="用户分配")
+@Api(tags = "用户分配")
 @RestController
 @RequestMapping("/ctop/userAllocation")
 public class UserAllocationController {
-	@Autowired
-	private IUserAllocationService userAllocationService;
-	
-	/**
-	  * 分页列表查询
-	 * @param userAllocation
-	 * @param pageNo
-	 * @param pageSize
-	 * @param req
-	 * @return
-	 */
-	@AutoLog(value = "用户分配-分页列表查询")
-	@ApiOperation(value="用户分配-分页列表查询", notes="用户分配-分页列表查询")
-	@GetMapping(value = "/list")
-	public Result<IPage<UserAllocation>> queryPageList(UserAllocation userAllocation,
-									  @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
-									  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
-									  HttpServletRequest req) {
-		Result<IPage<UserAllocation>> result = new Result<IPage<UserAllocation>>();
-		QueryWrapper<UserAllocation> queryWrapper = QueryGenerator.initQueryWrapper(userAllocation, req.getParameterMap());
-		Page<UserAllocation> page = new Page<UserAllocation>(pageNo, pageSize);
-		IPage<UserAllocation> pageList = userAllocationService.page(page, queryWrapper);
-		result.setSuccess(true);
-		result.setResult(pageList);
-		return result;
-	}
-	
-	/**
-	  *   添加
-	 * @param userAllocation
-	 * @return
-	 */
-	@AutoLog(value = "用户分配-添加")
-	@ApiOperation(value="用户分配-添加", notes="用户分配-添加")
-	@PostMapping(value = "/add")
-	public Result<UserAllocation> add(@RequestBody UserAllocation userAllocation) {
-		Result<UserAllocation> result = new Result<UserAllocation>();
-		try {
-			userAllocationService.save(userAllocation);
-			result.success("添加成功!");
-		} catch (Exception e) {
-			log.error(e.getMessage(),e);
-			result.error500("操作失败");
-		}
-		return result;
-	}
-	
-	/**
-	  *  编辑
-	 * @param userAllocation
-	 * @return
-	 */
-	@AutoLog(value = "用户分配-编辑")
-	@ApiOperation(value="用户分配-编辑", notes="用户分配-编辑")
-	@PutMapping(value = "/edit")
-	public Result<UserAllocation> edit(@RequestBody UserAllocation userAllocation) {
-		Result<UserAllocation> result = new Result<UserAllocation>();
-		UserAllocation userAllocationEntity = userAllocationService.getById(userAllocation.getId());
-		if(userAllocationEntity==null) {
-			result.error500("未找到对应实体");
-		}else {
-			boolean ok = userAllocationService.updateById(userAllocation);
-			//TODO 返回false说明什么?
-			if(ok) {
-				result.success("修改成功!");
-			}
-		}
-		
-		return result;
-	}
-	
-	/**
-	  *   通过id删除
-	 * @param id
-	 * @return
-	 */
-	@AutoLog(value = "用户分配-通过id删除")
-	@ApiOperation(value="用户分配-通过id删除", notes="用户分配-通过id删除")
-	@DeleteMapping(value = "/delete")
-	public Result<?> delete(@RequestParam(name="id",required=true) String id) {
-		try {
-			userAllocationService.removeById(id);
-		} catch (Exception e) {
-			log.error("删除失败",e.getMessage());
-			return Result.error("删除失败!");
-		}
-		return Result.ok("删除成功!");
-	}
-	
-	/**
-	  *  批量删除
-	 * @param ids
-	 * @return
-	 */
-	@AutoLog(value = "用户分配-批量删除")
-	@ApiOperation(value="用户分配-批量删除", notes="用户分配-批量删除")
-	@DeleteMapping(value = "/deleteBatch")
-	public Result<UserAllocation> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
-		Result<UserAllocation> result = new Result<UserAllocation>();
-		if(ids==null || "".equals(ids.trim())) {
-			result.error500("参数不识别!");
-		}else {
-			this.userAllocationService.removeByIds(Arrays.asList(ids.split(",")));
-			result.success("删除成功!");
-		}
-		return result;
-	}
-	
-	/**
-	  * 通过id查询
-	 * @param id
-	 * @return
-	 */
-	@AutoLog(value = "用户分配-通过id查询")
-	@ApiOperation(value="用户分配-通过id查询", notes="用户分配-通过id查询")
-	@GetMapping(value = "/queryById")
-	public Result<UserAllocation> queryById(@RequestParam(name="id",required=true) String id) {
-		Result<UserAllocation> result = new Result<UserAllocation>();
-		UserAllocation userAllocation = userAllocationService.getById(id);
-		if(userAllocation==null) {
-			result.error500("未找到对应实体");
-		}else {
-			result.setResult(userAllocation);
-			result.setSuccess(true);
-		}
-		return result;
-	}
+    @Autowired
+    private IUserAllocationService userAllocationService;
+
+    /**
+     * 分页列表查询
+     *
+     * @param userAllocation
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @AutoLog(value = "用户分配-分页列表查询")
+    @ApiOperation(value = "用户分配-分页列表查询", notes = "用户分配-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<IPage<UserAllocation>> queryPageList(UserAllocation userAllocation,
+                                                       @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                       @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                       HttpServletRequest req) {
+        Result<IPage<UserAllocation>> result = new Result<IPage<UserAllocation>>();
+        QueryWrapper<UserAllocation> queryWrapper = QueryGenerator.initQueryWrapper(userAllocation, req.getParameterMap());
+        Page<UserAllocation> page = new Page<UserAllocation>(pageNo, pageSize);
+        IPage<UserAllocation> pageList = userAllocationService.page(page, queryWrapper);
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
+
+    /**
+     * 添加
+     *
+     * @param userAllocation
+     * @return
+     */
+    @AutoLog(value = "用户分配-添加")
+    @ApiOperation(value = "用户分配-添加", notes = "用户分配-添加")
+    @PostMapping(value = "/add")
+    public Result<UserAllocation> add(@RequestBody UserAllocation userAllocation) {
+        Result<UserAllocation> result = new Result<UserAllocation>();
+        try {
+            userAllocationService.save(userAllocation);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+    /**
+     * 编辑
+     *
+     * @param userAllocation
+     * @return
+     */
+    @AutoLog(value = "用户分配-编辑")
+    @ApiOperation(value = "用户分配-编辑", notes = "用户分配-编辑")
+    @PutMapping(value = "/edit")
+    public Result<UserAllocation> edit(@RequestBody UserAllocation userAllocation) {
+        Result<UserAllocation> result = new Result<UserAllocation>();
+        UserAllocation userAllocationEntity = userAllocationService.getById(userAllocation.getId());
+        if (userAllocationEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            boolean ok = userAllocationService.updateById(userAllocation);
+            //TODO 返回false说明什么?
+            if (ok) {
+                result.success("修改成功!");
+            }
+        }
+
+        return result;
+    }
+
+    /**
+     * 通过id删除
+     *
+     * @param id
+     * @return
+     */
+    @AutoLog(value = "用户分配-通过id删除")
+    @ApiOperation(value = "用户分配-通过id删除", notes = "用户分配-通过id删除")
+    @DeleteMapping(value = "/delete")
+    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+        try {
+            userAllocationService.removeById(id);
+        } catch (Exception e) {
+            log.error("删除失败", e.getMessage());
+            return Result.error("删除失败!");
+        }
+        return Result.ok("删除成功!");
+    }
+
+    /**
+     * 批量删除
+     *
+     * @param ids
+     * @return
+     */
+    @AutoLog(value = "用户分配-批量删除")
+    @ApiOperation(value = "用户分配-批量删除", notes = "用户分配-批量删除")
+    @DeleteMapping(value = "/deleteBatch")
+    public Result<UserAllocation> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+        Result<UserAllocation> result = new Result<UserAllocation>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.userAllocationService.removeByIds(Arrays.asList(ids.split(",")));
+            result.success("删除成功!");
+        }
+        return result;
+    }
+
+    /**
+     * 通过id查询
+     *
+     * @param id
+     * @return
+     */
+    @AutoLog(value = "用户分配-通过id查询")
+    @ApiOperation(value = "用户分配-通过id查询", notes = "用户分配-通过id查询")
+    @GetMapping(value = "/queryById")
+    public Result<UserAllocation> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<UserAllocation> result = new Result<UserAllocation>();
+        UserAllocation userAllocation = userAllocationService.getById(id);
+        if (userAllocation == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(userAllocation);
+            result.setSuccess(true);
+        }
+        return result;
+    }
 
-  /**
-      * 导出excel
-   *
-   * @param request
-   * @param response
-   */
-  @RequestMapping(value = "/exportXls")
-  public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
-      // Step.1 组装查询条件
-      QueryWrapper<UserAllocation> queryWrapper = null;
-      try {
-          String paramsStr = request.getParameter("paramsStr");
-          if (oConvertUtils.isNotEmpty(paramsStr)) {
-              String deString = URLDecoder.decode(paramsStr, "UTF-8");
-              UserAllocation userAllocation = JSON.parseObject(deString, UserAllocation.class);
-              queryWrapper = QueryGenerator.initQueryWrapper(userAllocation, request.getParameterMap());
-          }
-      } catch (UnsupportedEncodingException e) {
-          e.printStackTrace();
-      }
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param response
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+        // Step.1 组装查询条件
+        QueryWrapper<UserAllocation> queryWrapper = null;
+        try {
+            String paramsStr = request.getParameter("paramsStr");
+            if (oConvertUtils.isNotEmpty(paramsStr)) {
+                String deString = URLDecoder.decode(paramsStr, "UTF-8");
+                UserAllocation userAllocation = JSON.parseObject(deString, UserAllocation.class);
+                queryWrapper = QueryGenerator.initQueryWrapper(userAllocation, request.getParameterMap());
+            }
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
 
-      //Step.2 AutoPoi 导出Excel
-      ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
-      List<UserAllocation> pageList = userAllocationService.list(queryWrapper);
-      //导出文件名称
-      mv.addObject(NormalExcelConstants.FILE_NAME, "用户分配列表");
-      mv.addObject(NormalExcelConstants.CLASS, UserAllocation.class);
-      mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("用户分配列表数据", "导出人:Jeecg", "导出信息"));
-      mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
-      return mv;
-  }
+        //Step.2 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        List<UserAllocation> pageList = userAllocationService.list(queryWrapper);
+        //导出文件名称
+        mv.addObject(NormalExcelConstants.FILE_NAME, "用户分配列表");
+        mv.addObject(NormalExcelConstants.CLASS, UserAllocation.class);
+        mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("用户分配列表数据", "导出人:Jeecg", "导出信息"));
+        mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
+        return mv;
+    }
 
-  /**
-      * 通过excel导入数据
-   *
-   * @param request
-   * @param response
-   * @return
-   */
-  @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
-  public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
-      MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
-      Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
-      for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
-          MultipartFile file = entity.getValue();// 获取上传文件对象
-          ImportParams params = new ImportParams();
-          params.setTitleRows(2);
-          params.setHeadRows(1);
-          params.setNeedSave(true);
-          try {
-              List<UserAllocation> listUserAllocations = ExcelImportUtil.importExcel(file.getInputStream(), UserAllocation.class, params);
-              userAllocationService.saveBatch(listUserAllocations);
-              return Result.ok("文件导入成功!数据行数:" + listUserAllocations.size());
-          } catch (Exception e) {
-              log.error(e.getMessage(),e);
-              return Result.error("文件导入失败:"+e.getMessage());
-          } finally {
-              try {
-                  file.getInputStream().close();
-              } catch (IOException e) {
-                  e.printStackTrace();
-              }
-          }
-      }
-      return Result.ok("文件导入失败!");
-  }
+    /**
+     * 通过excel导入数据
+     *
+     * @param request
+     * @param response
+     * @return
+     */
+    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
+    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
+        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
+        Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
+        for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
+            MultipartFile file = entity.getValue();// 获取上传文件对象
+            ImportParams params = new ImportParams();
+            params.setTitleRows(2);
+            params.setHeadRows(1);
+            params.setNeedSave(true);
+            try {
+                List<UserAllocation> listUserAllocations = ExcelImportUtil.importExcel(file.getInputStream(), UserAllocation.class, params);
+                userAllocationService.saveBatch(listUserAllocations);
+                return Result.ok("文件导入成功!数据行数:" + listUserAllocations.size());
+            } catch (Exception e) {
+                log.error(e.getMessage(), e);
+                return Result.error("文件导入失败:" + e.getMessage());
+            } finally {
+                try {
+                    file.getInputStream().close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+        return Result.ok("文件导入失败!");
+    }
 
 }

+ 11 - 12
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/UserAllocation.java

@@ -1,24 +1,23 @@
 package org.jeecg.modules.ctop.entity;
 
-import java.io.Serializable;
-import java.util.Date;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
-import com.baomidou.mybatisplus.annotation.TableField;
+import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
-import com.fasterxml.jackson.annotation.JsonFormat;
-import org.springframework.format.annotation.DateTimeFormat;
 import org.jeecgframework.poi.excel.annotation.Excel;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
 
 /**
  * @Description: 用户分配
  * @Author: jeecg-boot
- * @Date:   2019-07-30
+ * @Date: 2019-08-08
  * @Version: V1.0
  */
 @Data
@@ -91,18 +90,18 @@ public class UserAllocation {
     @ApiModelProperty(value = "创建时间")
     private Date createTime;
     /**
-     * task_id
-     */
-    @Excel(name = "task_id", width = 15)
-    @ApiModelProperty(value = "task_id")
-    private String taskId;
-    /**
      * 操作人姓名
      */
     @Excel(name = "操作人姓名", width = 15)
     @ApiModelProperty(value = "操作人姓名")
     private String operationName;
     /**
+     * 授权名称
+     */
+    @Excel(name = "授权名称", width = 15)
+    @ApiModelProperty(value = "授权名称")
+    private String authName;
+    /**
      * 创建人
      */
     @Excel(name = "创建人", width = 15)

+ 5 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/UserAllocationMapper.java

@@ -1,12 +1,15 @@
 package org.jeecg.modules.ctop.mapper;
 
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import java.util.List;
+
+import org.apache.ibatis.annotations.Param;
 import org.jeecg.modules.ctop.entity.UserAllocation;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 
 /**
  * @Description: 用户分配
  * @Author: jeecg-boot
- * @Date: 2019-07-31
+ * @Date:   2019-08-08
  * @Version: V1.0
  */
 public interface UserAllocationMapper extends BaseMapper<UserAllocation> {

+ 0 - 4
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/IBindAccountAuthService.java

@@ -2,7 +2,6 @@ package org.jeecg.modules.ctop.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
 import org.jeecg.modules.ctop.entity.BindAccountAuth;
-import org.jeecg.modules.ctop.entity.UserAllocation;
 
 import java.io.UnsupportedEncodingException;
 
@@ -14,12 +13,9 @@ import java.io.UnsupportedEncodingException;
  */
 public interface IBindAccountAuthService extends IService<BindAccountAuth> {
 
-    String bindAuthorization(String advertiserId, String authorizationType, UserAllocation userAllocation) throws UnsupportedEncodingException;
-
     String getKuaishouCodeUrl(String state) throws UnsupportedEncodingException;
 
     String getByteDanceCodeUrl(String state) throws UnsupportedEncodingException;
 
-
     void addBindAccount(Long accountId, String type, String state);
 }

+ 2 - 3
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/IUserAllocationService.java

@@ -1,15 +1,14 @@
 package org.jeecg.modules.ctop.service;
 
-import org.jeecg.modules.ctop.entity.UserAllocation;
 import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.modules.ctop.entity.UserAllocation;
 
 /**
  * @Description: 用户分配
  * @Author: jeecg-boot
- * @Date:   2019-07-31
+ * @Date:   2019-08-08
  * @Version: V1.0
  */
 public interface IUserAllocationService extends IService<UserAllocation> {
 
-    UserAllocation selectByTaskId(String state);
 }

+ 2 - 47
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/BindAccountAuthServiceImpl.java

@@ -4,12 +4,8 @@ import cn.com.ctop.common.utils.PropertiesUtils;
 import cn.com.ctop.toutiao.common.BytedanceInterfaceConstant;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import constant.KuaishouInterfaceConstant;
-import org.jeecg.modules.ctop.entity.AuthTask;
 import org.jeecg.modules.ctop.entity.BindAccountAuth;
-import org.jeecg.modules.ctop.entity.UserAllocation;
-import org.jeecg.modules.ctop.mapper.AuthTaskMapper;
 import org.jeecg.modules.ctop.mapper.BindAccountAuthMapper;
-import org.jeecg.modules.ctop.mapper.UserAllocationMapper;
 import org.jeecg.modules.ctop.service.IBindAccountAuthService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -20,7 +16,6 @@ import java.io.UnsupportedEncodingException;
 import java.net.URLEncoder;
 import java.util.HashMap;
 import java.util.Map;
-import java.util.UUID;
 
 /**
  * @Description: 账号绑定-授权
@@ -31,50 +26,10 @@ import java.util.UUID;
 @Service
 public class BindAccountAuthServiceImpl extends ServiceImpl<BindAccountAuthMapper, BindAccountAuth> implements IBindAccountAuthService {
     private static final Logger logger = LoggerFactory.getLogger(BindAccountAuthServiceImpl.class);
-    @Autowired
-    private AuthTaskMapper authTaskMapper;
 
     @Autowired
     private BindAccountAuthMapper bindAccountAuthMapper;
 
-    @Autowired
-    private UserAllocationMapper userAllocationMapper;
-
-    /**
-     * 授权
-     *
-     * @param advertiserId
-     * @param authorizationType
-     * @return
-     */
-    @Override
-    public String bindAuthorization(String advertiserId, String authorizationType, UserAllocation userAllocation) throws UnsupportedEncodingException {
-        String taskId = UUID.randomUUID().toString();
-        AuthTask authTask = new AuthTask();
-        authTask.setAdvertiserId(advertiserId);
-        authTask.setTaskId(taskId);
-        int i = authTaskMapper.insert(authTask);
-        if (i > 0) {
-            logger.info("广告主关联id,auth_task入库完成,advertiserId:{}", advertiserId);
-        }
-
-        userAllocation.setTaskId(taskId);
-        userAllocation.setAdvertiserId(advertiserId);
-        int y = userAllocationMapper.insert(userAllocation);
-        if (y > 0) {
-            logger.info("用户分配,入库完成,advertiserId:{}", advertiserId);
-        }
-
-        String codeUrl = "";
-        if ("kuaishou".equals(authorizationType)) {
-            codeUrl = getKuaishouCodeUrl(taskId);
-        }
-        if ("bytedance".equals(authorizationType)) {
-            codeUrl = getByteDanceCodeUrl(taskId);
-        }
-
-        return codeUrl;
-    }
 
     /**
      * 授权 绑定账号信息
@@ -107,7 +62,7 @@ public class BindAccountAuthServiceImpl extends ServiceImpl<BindAccountAuthMappe
         sb.append(PropertiesUtils.getValue("kuaishou_config", "kuaishou_auth_url"))
                 .append(KuaishouInterfaceConstant.AUTH_PATH)
                 .append("?app_id=" + PropertiesUtils.getValue("kuaishou_config", "kuaishou_appid"))
-                .append("&state=" + state)
+                .append("&state=" + URLEncoder.encode(URLEncoder.encode(state)))
                 .append("&scope=%5B%22report_service%22%2C%22ad_query%22%2C%22ad_manage%22%5D")
                 .append("&redirect_uri=" + URLEncoder.encode(PropertiesUtils.getValue("kuaishou_config", "kuaishou_callback_url"), "UTF-8"));
         return sb.toString();
@@ -119,7 +74,7 @@ public class BindAccountAuthServiceImpl extends ServiceImpl<BindAccountAuthMappe
         sb.append(PropertiesUtils.getValue("bytedance_config", "bytedance_auth_url"))
                 .append(BytedanceInterfaceConstant.AUTH_PATH)
                 .append("?app_id=" + PropertiesUtils.getValue("bytedance_config", "bytedance_appid"))
-                .append("&state=" + state)
+                .append("&state=" + URLEncoder.encode(URLEncoder.encode(state)))
                 .append("&redirect_uri=" + URLEncoder.encode(PropertiesUtils.getValue("bytedance_config", "bytedance_callback_url"), "UTF-8"));
         return sb.toString();
     }

+ 2 - 15
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/UserAllocationServiceImpl.java

@@ -1,31 +1,18 @@
 package org.jeecg.modules.ctop.service.impl;
 
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import org.jeecg.modules.ctop.entity.CTopOauthToken;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.jeecg.modules.ctop.entity.UserAllocation;
 import org.jeecg.modules.ctop.mapper.UserAllocationMapper;
 import org.jeecg.modules.ctop.service.IUserAllocationService;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-
 /**
  * @Description: 用户分配
  * @Author: jeecg-boot
- * @Date: 2019-07-31
+ * @Date: 2019-08-08
  * @Version: V1.0
  */
 @Service
 public class UserAllocationServiceImpl extends ServiceImpl<UserAllocationMapper, UserAllocation> implements IUserAllocationService {
-    @Autowired
-    private UserAllocationMapper userAllocationMapper;
 
-    @Override
-    public UserAllocation selectByTaskId(String state) {
-        QueryWrapper<UserAllocation> queryWrapper = new QueryWrapper<>();
-        queryWrapper.eq("task_id", state).orderByDesc("create_time");
-        UserAllocation userAllocation = userAllocationMapper.selectOne(queryWrapper);
-        return userAllocation;
-    }
 }

+ 4 - 4
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/vue/UserAllocationList.vue

@@ -173,14 +173,14 @@
             dataIndex: 'accountName'
            },
 		   {
-            title: 'task_id',
+            title: '操作人姓名',
             align:"center",
-            dataIndex: 'taskId'
+            dataIndex: 'operationName'
            },
 		   {
-            title: '操作人姓名',
+            title: '授权名称',
             align:"center",
-            dataIndex: 'operationName'
+            dataIndex: 'authName'
            },
 		   {
             title: '平台类型 1 头条 2快手',

+ 5 - 5
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/vue/modules/UserAllocationModal.vue

@@ -62,14 +62,14 @@
         <a-form-item
           :labelCol="labelCol"
           :wrapperCol="wrapperCol"
-          label="task_id">
-          <a-input placeholder="请输入task_id" v-decorator="['taskId', {}]" />
+          label="操作人姓名">
+          <a-input placeholder="请输入操作人姓名" v-decorator="['operationName', {}]" />
         </a-form-item>
         <a-form-item
           :labelCol="labelCol"
           :wrapperCol="wrapperCol"
-          label="操作人姓名">
-          <a-input placeholder="请输入操作人姓名" v-decorator="['operationName', {}]" />
+          label="授权名称">
+          <a-input placeholder="请输入授权名称" v-decorator="['authName', {}]" />
         </a-form-item>
         <a-form-item
           :labelCol="labelCol"
@@ -125,7 +125,7 @@
         this.model = Object.assign({}, record);
         this.visible = true;
         this.$nextTick(() => {
-          this.form.setFieldsValue(pick(this.model,'userId','accountId','advertiserId','distributionName','departmentId','adminName','advertiserName','accountName','taskId','operationName','mediaId'))
+          this.form.setFieldsValue(pick(this.model,'userId','accountId','advertiserId','distributionName','departmentId','adminName','advertiserName','accountName','operationName','authName','mediaId'))
 		  //时间格式化
         });
 

+ 5 - 5
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/vue/modules/UserAllocationModal__Style#Drawer.vue

@@ -62,14 +62,14 @@
         <a-form-item
           :labelCol="labelCol"
           :wrapperCol="wrapperCol"
-          label="task_id">
-          <a-input placeholder="请输入task_id" v-decorator="['taskId', {}]" />
+          label="操作人姓名">
+          <a-input placeholder="请输入操作人姓名" v-decorator="['operationName', {}]" />
         </a-form-item>
         <a-form-item
           :labelCol="labelCol"
           :wrapperCol="wrapperCol"
-          label="操作人姓名">
-          <a-input placeholder="请输入操作人姓名" v-decorator="['operationName', {}]" />
+          label="授权名称">
+          <a-input placeholder="请输入授权名称" v-decorator="['authName', {}]" />
         </a-form-item>
         <a-form-item
           :labelCol="labelCol"
@@ -127,7 +127,7 @@
         this.model = Object.assign({}, record);
         this.visible = true;
         this.$nextTick(() => {
-          this.form.setFieldsValue(pick(this.model,'userId','accountId','advertiserId','distributionName','departmentId','adminName','advertiserName','accountName','taskId','operationName','mediaId'))
+          this.form.setFieldsValue(pick(this.model,'userId','accountId','advertiserId','distributionName','departmentId','adminName','advertiserName','accountName','operationName','authName','mediaId'))
 		  //时间格式化
         });