Explorar o código

账号绑定 相关功能

yumeng %!s(int64=5) %!d(string=hai) anos
pai
achega
b58134b583
Modificáronse 14 ficheiros con 1117 adicións e 60 borrados
  1. 1 0
      jeecg-boot-module-system/src/main/java/org/jeecg/config/ShiroConfig.java
  2. 41 54
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/AuthController.java
  3. 277 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/BindAccountController.java
  4. 11 5
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/CallbackController.java
  5. 88 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/BindAccount.java
  6. 14 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/BindAccountMapper.java
  7. 5 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/BindAccountMapper.xml
  8. 25 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/IBindAccountService.java
  9. 140 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/BindAccountServiceImpl.java
  10. 193 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/vue/BindAccountList.vue
  11. 154 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/vue/modules/BindAccountModal.vue
  12. 161 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/vue/modules/BindAccountModal__Style#Drawer.vue
  13. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/service/impl/KuaishouInterfaceServiceImpl.java
  14. 6 0
      module-kuaishou/src/main/java/constant/KuaishouInterfaceConstant.java

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

@@ -73,6 +73,7 @@ public class ShiroConfig {
 		filterChainDefinitionMap.put("/webjars/**", "anon");
 		filterChainDefinitionMap.put("/v2/**", "anon");
 		filterChainDefinitionMap.put("/kuaishou/**", "anon");
+		filterChainDefinitionMap.put("/ctop/bindAccount/**", "anon");
 		filterChainDefinitionMap.put("/**/*.mp4", "anon");
 
 

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

@@ -1,5 +1,6 @@
 package org.jeecg.modules.ctop.controller;
 
+import cn.com.ctop.common.utils.Check;
 import cn.com.ctop.common.utils.HttpUtils;
 import cn.com.ctop.common.utils.PropertiesUtils;
 import cn.com.ctop.toutiao.common.BytedanceInterfaceConstant;
@@ -9,6 +10,7 @@ import constant.KuaishouInterfaceConstant;
 import org.apache.commons.lang.StringUtils;
 import org.jeecg.modules.ctop.entity.CTopOauthToken;
 import org.jeecg.modules.ctop.mapper.CTopOauthTokenMapper;
+import org.jeecg.modules.ctop.service.IBindAccountService;
 import org.jeecg.modules.kuaishou.service.IKuaishouInterfaceService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -21,8 +23,6 @@ import org.springframework.web.bind.annotation.ResponseBody;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
-import java.io.UnsupportedEncodingException;
-import java.net.URLEncoder;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.UUID;
@@ -33,99 +33,86 @@ public class AuthController {
     private static final Logger logger = LoggerFactory.getLogger(AuthController.class);
     @Autowired
     private IKuaishouInterfaceService kuaishouInterfaceService;
+    @Autowired
+    private IBindAccountService bindAccountService;
+
+    @Autowired
+    private CTopOauthTokenMapper cTopOauthTokenMapper;
+
     @RequestMapping("/begin")
     public String authBegin(HttpServletRequest request,
                             HttpServletResponse response,
-                            @RequestParam("auth_type")String authType){
-        try{
+                            @RequestParam("auth_type") String authType) {
+        try {
             String codeUrl = "";
-            switch (authType)
-            {
+            switch (authType) {
                 case "bytedance":
-                    codeUrl = this.getByteDanceCodeUrl(UUID.randomUUID().toString());
+                    codeUrl = bindAccountService.getByteDanceCodeUrl(UUID.randomUUID().toString());
                     System.out.println(codeUrl);
-                    return "redirect:"+codeUrl;
+                    return "redirect:" + codeUrl;
                 case "kuaishou":
-                    codeUrl = this.getKuaishouCodeUrl(UUID.randomUUID().toString());
+                    codeUrl = bindAccountService.getKuaishouCodeUrl(UUID.randomUUID().toString());
                     System.out.println(codeUrl);
-                    return "redirect:"+codeUrl;
+                    return "redirect:" + codeUrl;
                 default:
                     System.out.println("");
 
             }
-        }catch (Exception e){
+        } catch (Exception e) {
             e.printStackTrace();
         }
 
         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) {
+                            @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));
+        if (StringUtils.isNotBlank(authCode)) {
+            System.out.println(this.getByteDanceAccessToken(authCode, accountId, state));
             return "auth_success";
         }
         return "auth_fail";
     }
 
     @GetMapping("bytedance/refreshtoken")
-
-
-    public String getByteDanceAccessToken(String authCode, String accountId) {
+    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);
+        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{
-            System.out.println(PropertiesUtils.getValue("bytedance_config","bytedance_api_url")+ BytedanceInterfaceConstant.AUTH_TOKEN);
-            result = HttpUtils.httpPostRequest(PropertiesUtils.getValue("bytedance_config","bytedance_api_url")+BytedanceInterfaceConstant.AUTH_TOKEN,param,new HashMap<>());
-            System.out.println(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);
+            if (null == code || code != 0) {
+                logger.info("获取token失败,accountId:{},message:{}", accountId, message);
             }
             JSONObject data = resultObject.getJSONObject("data");
-            CTopOauthToken token = new CTopOauthToken(accountId,data);
-            cTopOauthTokenMapper.insert(token);
-        }catch (Exception e){
+            CTopOauthToken token = new CTopOauthToken(accountId, data);
+            if (Check.isNull(token)) {
+                Map<String, Object> deleteMap = new HashMap<>();
+                deleteMap.put("advertiser_id", state);
+                deleteMap.put("account_id", token.getAccountId());
+                cTopOauthTokenMapper.deleteByMap(deleteMap); //删除 广告主id下的相关授权信息
+                cTopOauthTokenMapper.insert(token);
+                bindAccountService.addBindAccount(token.getAccountId(), KuaishouInterfaceConstant.TYPE_AUTHORIZATION, state, KuaishouInterfaceConstant.LOGIN_TYPE_BYTEDANCE); //账号绑定
+            }
+
+        } catch (Exception e) {
             e.printStackTrace();
         }
         return result;
     }
 
-    @Autowired
-    private CTopOauthTokenMapper cTopOauthTokenMapper;
-
-    public String getKuaishouCodeUrl(String state) throws UnsupportedEncodingException {
-        StringBuffer sb = new StringBuffer();
-        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("&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();
-    }
-
 
-    public String getByteDanceCodeUrl(String state) throws UnsupportedEncodingException {
-        StringBuffer sb = new StringBuffer();
-        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("&redirect_uri="+ URLEncoder.encode(PropertiesUtils.getValue("bytedance_config","bytedance_callback_url"),"UTF-8"));
-        return sb.toString();
-    }
 }

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

@@ -0,0 +1,277 @@
+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 org.jeecg.common.api.vo.Result;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.common.aspect.annotation.AutoLog;
+import org.jeecg.common.util.oConvertUtils;
+import org.jeecg.modules.ctop.entity.BindAccount;
+import org.jeecg.modules.ctop.service.IBindAccountService;
+
+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;
+
+/**
+ * @Description: 账户绑定
+ * @Author: jeecg-boot
+ * @Date: 2019-07-30
+ * @Version: V1.0
+ */
+@Slf4j
+@Api(tags = "账户绑定")
+@RestController
+@RequestMapping("/ctop/bindAccount")
+public class BindAccountController {
+    @Autowired
+    private IBindAccountService bindAccountService;
+
+
+    @GetMapping(value = "/login")
+    public Result<IPage<BindAccount>> login(String advertiserId, String accountName, String password, String loginType) {
+        Result<IPage<BindAccount>> result = new Result<IPage<BindAccount>>();
+        boolean trueOrFalse = bindAccountService.bindLogin(advertiserId, accountName, password, loginType);
+        result.setSuccess(trueOrFalse);
+        return result;
+    }
+
+    @GetMapping(value = "/authorization")
+    public Result<IPage<BindAccount>> authorization(String advertiserId, String authorizationType) {
+        Result<IPage<BindAccount>> result = new Result<IPage<BindAccount>>();
+        String codeUrl = null;
+        try {
+            codeUrl = bindAccountService.bindAuthorization(advertiserId, authorizationType);
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+        result.setMessage(codeUrl);
+        result.setSuccess(true);
+        return result;
+    }
+
+
+    /**
+     * 分页列表查询
+     *
+     * @param bindAccount
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @AutoLog(value = "账户绑定-分页列表查询")
+    @ApiOperation(value = "账户绑定-分页列表查询", notes = "账户绑定-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<IPage<BindAccount>> queryPageList(BindAccount bindAccount,
+                                                    @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                    @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                    HttpServletRequest req) {
+        Result<IPage<BindAccount>> result = new Result<IPage<BindAccount>>();
+        QueryWrapper<BindAccount> queryWrapper = QueryGenerator.initQueryWrapper(bindAccount, req.getParameterMap());
+        Page<BindAccount> page = new Page<BindAccount>(pageNo, pageSize);
+        IPage<BindAccount> pageList = bindAccountService.page(page, queryWrapper);
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
+
+    /**
+     * 添加
+     *
+     * @param bindAccount
+     * @return
+     */
+    @AutoLog(value = "账户绑定-添加")
+    @ApiOperation(value = "账户绑定-添加", notes = "账户绑定-添加")
+    @PostMapping(value = "/add")
+    public Result<BindAccount> add(@RequestBody BindAccount bindAccount) {
+        Result<BindAccount> result = new Result<BindAccount>();
+        try {
+            bindAccountService.save(bindAccount);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+    /**
+     * 编辑
+     *
+     * @param bindAccount
+     * @return
+     */
+    @AutoLog(value = "账户绑定-编辑")
+    @ApiOperation(value = "账户绑定-编辑", notes = "账户绑定-编辑")
+    @PutMapping(value = "/edit")
+    public Result<BindAccount> edit(@RequestBody BindAccount bindAccount) {
+        Result<BindAccount> result = new Result<BindAccount>();
+        BindAccount bindAccountEntity = bindAccountService.getById(bindAccount.getId());
+        if (bindAccountEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            boolean ok = bindAccountService.updateById(bindAccount);
+            //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 {
+            bindAccountService.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<BindAccount> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+        Result<BindAccount> result = new Result<BindAccount>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.bindAccountService.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<BindAccount> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<BindAccount> result = new Result<BindAccount>();
+        BindAccount bindAccount = bindAccountService.getById(id);
+        if (bindAccount == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(bindAccount);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param response
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+        // Step.1 组装查询条件
+        QueryWrapper<BindAccount> queryWrapper = null;
+        try {
+            String paramsStr = request.getParameter("paramsStr");
+            if (oConvertUtils.isNotEmpty(paramsStr)) {
+                String deString = URLDecoder.decode(paramsStr, "UTF-8");
+                BindAccount bindAccount = JSON.parseObject(deString, BindAccount.class);
+                queryWrapper = QueryGenerator.initQueryWrapper(bindAccount, request.getParameterMap());
+            }
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+
+        //Step.2 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        List<BindAccount> pageList = bindAccountService.list(queryWrapper);
+        //导出文件名称
+        mv.addObject(NormalExcelConstants.FILE_NAME, "账户绑定列表");
+        mv.addObject(NormalExcelConstants.CLASS, BindAccount.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<BindAccount> listBindAccounts = ExcelImportUtil.importExcel(file.getInputStream(), BindAccount.class, params);
+                bindAccountService.saveBatch(listBindAccounts);
+                return Result.ok("文件导入成功!数据行数:" + listBindAccounts.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 - 5
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/CallbackController.java

@@ -3,9 +3,11 @@ package org.jeecg.modules.ctop.controller;
 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 constant.KuaishouInterfaceConstant;
 import org.apache.commons.lang.StringUtils;
 import org.jeecg.modules.ctop.entity.CTopOauthToken;
 import org.jeecg.modules.ctop.mapper.CTopOauthTokenMapper;
+import org.jeecg.modules.ctop.service.IBindAccountService;
 import org.jeecg.modules.kuaishou.service.IKuaishouInterfaceService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
@@ -28,6 +30,8 @@ public class CallbackController {
     private IKuaishouAccessTokenService kuaishouAccessTokenService;
     @Autowired
     private CTopOauthTokenMapper cTopOauthTokenMapper;
+    @Autowired
+    private IBindAccountService bindAccountService;
 
     @RequestMapping("/kuaishou")
     @ResponseBody
@@ -41,7 +45,11 @@ public class CallbackController {
             if (token != null) {
                 CTopOauthToken topOauthToken = new CTopOauthToken();
                 Long accountId = token.getAccountId();
-                topOauthToken.setAccountId(token.getAccountId());
+                Map<String, Object> deleteMap = new HashMap<>();
+                deleteMap.put("advertiser_id", state);
+                deleteMap.put("account_id", accountId);
+                cTopOauthTokenMapper.deleteByMap(deleteMap); //删除 广告主id下的相关授权信息
+                topOauthToken.setAccountId(accountId);
                 topOauthToken.setMediaId("2");
                 topOauthToken.setAdvertiserId(state);
                 topOauthToken.setAccessToken(token.getAccessToken());
@@ -53,10 +61,8 @@ public class CallbackController {
                 long refreshTokenExpireIn = token.getRefreshTokenExpiresIn() * 1000L;
                 Date refreshTokenExpireInDate = new Date(now + refreshTokenExpireIn);
                 topOauthToken.setRefreshTokenExpiresIn(refreshTokenExpireInDate);
-
-                Map<String, Object> map = new HashMap<>();
-                map.put("account_id", accountId);
-
+                cTopOauthTokenMapper.insert(topOauthToken);
+                bindAccountService.addBindAccount(accountId, KuaishouInterfaceConstant.TYPE_AUTHORIZATION, state, KuaishouInterfaceConstant.LOGIN_TYPE_KUAISHOU); //账号绑定
             }
             return "auth_success";
         }

+ 88 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/BindAccount.java

@@ -0,0 +1,88 @@
+package org.jeecg.modules.ctop.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+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 org.jeecgframework.poi.excel.annotation.Excel;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
+
+/**
+ * @Description: 账户绑定
+ * @Author: jeecg-boot
+ * @Date: 2019-07-30
+ * @Version: V1.0
+ */
+@Data
+@TableName("ctop_bind_account")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_bind_account对象", description = "账户绑定")
+public class BindAccount {
+
+    /**
+     * 主键ID
+     */
+    @TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "主键ID")
+    private Long id;
+    /**
+     * 广告id
+     */
+    @Excel(name = "广告id", width = 15)
+    @ApiModelProperty(value = "广告id")
+    private String advertiserId;
+    /**
+     * 账号
+     */
+    @Excel(name = "账号", width = 15)
+    @ApiModelProperty(value = "账号")
+    private String accountName;
+    /**
+     * 密码
+     */
+    @Excel(name = "密码", width = 15)
+    @ApiModelProperty(value = "密码")
+    private String password;
+    /**
+     * 登录/授权方式
+     */
+    @Excel(name = "登录/授权方式", width = 15)
+    @ApiModelProperty(value = "登录/授权方式")
+    private String loginType;
+    /**
+     * 方式:登录或授权
+     */
+    @Excel(name = "方式:登录或授权", width = 15)
+    @ApiModelProperty(value = "方式:登录或授权")
+    private String type;
+    /**
+     * 回调返回广告主id
+     */
+    @Excel(name = "回调返回广告主id", width = 15)
+    @ApiModelProperty(value = "回调返回广告主id")
+    private Long accountId;
+    /**
+     * 创建时间
+     */
+    @Excel(name = "创建时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "创建时间")
+    private Date createTime;
+    /**
+     * 修改时间
+     */
+    @Excel(name = "修改时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "修改时间")
+    private Date updateTime;
+}

+ 14 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/BindAccountMapper.java

@@ -0,0 +1,14 @@
+package org.jeecg.modules.ctop.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.jeecg.modules.ctop.entity.BindAccount;
+
+/**
+ * @Description: 账户绑定
+ * @Author: jeecg-boot
+ * @Date: 2019-07-30
+ * @Version: V1.0
+ */
+public interface BindAccountMapper extends BaseMapper<BindAccount> {
+
+}

+ 5 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/BindAccountMapper.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.jeecg.modules.ctop.mapper.BindAccountMapper">
+
+</mapper>

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

@@ -0,0 +1,25 @@
+package org.jeecg.modules.ctop.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.modules.ctop.entity.BindAccount;
+
+import java.io.UnsupportedEncodingException;
+
+/**
+ * @Description: 账户绑定
+ * @Author: jeecg-boot
+ * @Date: 2019-07-30
+ * @Version: V1.0
+ */
+public interface IBindAccountService extends IService<BindAccount> {
+    boolean bindLogin(String advertiserId, String accountName, String password, String loginType);
+
+    String bindAuthorization(String advertiserId, String authorizationType) throws UnsupportedEncodingException;
+
+    String getKuaishouCodeUrl(String state) throws UnsupportedEncodingException;
+
+    String getByteDanceCodeUrl(String state) throws UnsupportedEncodingException;
+
+
+    void addBindAccount(Long accountId, String type, String state, String loginType);
+}

+ 140 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/BindAccountServiceImpl.java

@@ -0,0 +1,140 @@
+package org.jeecg.modules.ctop.service.impl;
+
+import cn.com.ctop.common.utils.Check;
+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.BindAccount;
+import org.jeecg.modules.ctop.mapper.BindAccountMapper;
+import org.jeecg.modules.ctop.service.IBindAccountService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Description: 账户绑定
+ * @Author: jeecg-boot
+ * @Date: 2019-07-30
+ * @Version: V1.0
+ */
+@Service
+public class BindAccountServiceImpl extends ServiceImpl<BindAccountMapper, BindAccount> implements IBindAccountService {
+    private static final Logger logger = LoggerFactory.getLogger(BindAccountServiceImpl.class);
+
+
+    @Autowired
+    BindAccountMapper bindAccountMapper;
+
+    @Override
+    public boolean bindLogin(String advertiserId, String accountName, String password, String loginType) {
+        Map<String, Object> requestMap = new HashMap<>();
+        requestMap.put("advertiser_id", advertiserId);
+        requestMap.put("account_name", accountName);
+        requestMap.put("login_type", loginType);
+        List<BindAccount> bindAccounts = bindAccountMapper.selectByMap(requestMap);
+        if (!Check.isNull(bindAccounts)) {
+            return false;
+        }
+        BindAccount bindAccount = new BindAccount();
+        bindAccount.setAdvertiserId(advertiserId);
+        bindAccount.setAccountName(accountName);
+        bindAccount.setPassword(password);
+        bindAccount.setType(KuaishouInterfaceConstant.TYPE_LOGIN);
+        bindAccount.setLoginType(loginType);
+        int i = bindAccountMapper.insert(bindAccount);
+        if (i > 0) {
+            logger.info("登录账号绑定成功,广告主id:{}", bindAccount.getAdvertiserId());
+            return true;
+        }
+
+        return false;
+    }
+
+    /**
+     * 授权
+     *
+     * @param advertiserId
+     * @param authorizationType
+     * @return
+     */
+    @Override
+    public String bindAuthorization(String advertiserId, String authorizationType) throws UnsupportedEncodingException {
+        BindAccount bindAccount = new BindAccount();
+        bindAccount.setAdvertiserId(advertiserId);
+
+        bindAccount.setType("login");
+        bindAccount.setType("authorization");
+        bindAccount.setLoginType(authorizationType);
+
+        String codeUrl = "";
+        if ("kuaishou".equals(authorizationType)) {
+            codeUrl = getKuaishouCodeUrl(advertiserId);
+        }
+        if ("toutiao".equals(authorizationType)) {
+            codeUrl = getByteDanceCodeUrl(advertiserId);
+        }
+        bindAccountMapper.insert(bindAccount);
+        return codeUrl;
+    }
+
+
+    /**
+     * 授权 绑定账号信息
+     *
+     * @param accountId
+     * @param type
+     * @param state
+     * @param loginType
+     */
+    @Override
+    public void addBindAccount(Long accountId, String type, String state, String loginType) {
+        Map<String, Object> deleteMap = new HashMap<>();
+        deleteMap.put("advertiser_id", state);
+        deleteMap.put("account_id", accountId);
+        deleteMap.put("type", type);
+        deleteMap.put("login_type", loginType);
+        bindAccountMapper.deleteByMap(deleteMap);
+        BindAccount bindAccount = new BindAccount();
+        bindAccount.setAccountId(accountId);
+        bindAccount.setLoginType(loginType);
+        bindAccount.setAdvertiserId(state);
+        bindAccount.setType(type);
+        int i = bindAccountMapper.insert(bindAccount);
+        if (i > 0) {
+            logger.info("授权账号绑定成功,本地id:{},accountId:{}", bindAccount.getAdvertiserId(), accountId);
+        }
+    }
+
+    @Override
+    public String getKuaishouCodeUrl(String state) throws UnsupportedEncodingException {
+        StringBuffer sb = new StringBuffer();
+        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("&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();
+    }
+
+
+    public String getByteDanceCodeUrl(String state) throws UnsupportedEncodingException {
+        StringBuffer sb = new StringBuffer();
+        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("&redirect_uri=" + URLEncoder.encode(PropertiesUtils.getValue("bytedance_config", "bytedance_callback_url"), "UTF-8"));
+        return sb.toString();
+    }
+
+
+}

+ 193 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/vue/BindAccountList.vue

@@ -0,0 +1,193 @@
+<template>
+  <a-card :bordered="false">
+
+    <!-- 查询区域 -->
+    <div class="table-page-search-wrapper">
+      <a-form layout="inline">
+        <a-row :gutter="24">
+
+          <a-col :md="6" :sm="8">
+            <a-form-item label="广告id">
+              <a-input placeholder="请输入广告id" v-model="queryParam.advertiserId"></a-input>
+            </a-form-item>
+          </a-col>
+          <a-col :md="6" :sm="8">
+            <a-form-item label="账号">
+              <a-input placeholder="请输入账号" v-model="queryParam.accountName"></a-input>
+            </a-form-item>
+          </a-col>
+        <template v-if="toggleSearchStatus">
+        <a-col :md="6" :sm="8">
+            <a-form-item label="密码">
+              <a-input placeholder="请输入密码" v-model="queryParam.password"></a-input>
+            </a-form-item>
+          </a-col>
+          <a-col :md="6" :sm="8">
+            <a-form-item label="登录/授权方式">
+              <a-input placeholder="请输入登录/授权方式" v-model="queryParam.loginType"></a-input>
+            </a-form-item>
+          </a-col>
+          <a-col :md="6" :sm="8">
+            <a-form-item label="方式:登录或授权">
+              <a-input placeholder="请输入方式:登录或授权" v-model="queryParam.type"></a-input>
+            </a-form-item>
+          </a-col>
+          </template>
+          <a-col :md="6" :sm="8" >
+            <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
+              <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
+              <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
+              <a @click="handleToggleSearch" style="margin-left: 8px">
+                {{ toggleSearchStatus ? '收起' : '展开' }}
+                <a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
+              </a>
+            </span>
+          </a-col>
+
+        </a-row>
+      </a-form>
+    </div>
+
+    <!-- 操作按钮区域 -->
+    <div class="table-operator">
+      <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
+      <a-button type="primary" icon="download" @click="handleExportXls('账户绑定')">导出</a-button>
+      <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
+        <a-button type="primary" icon="import">导入</a-button>
+      </a-upload>
+      <a-dropdown v-if="selectedRowKeys.length > 0">
+        <a-menu slot="overlay">
+          <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>
+        </a-menu>
+        <a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>
+      </a-dropdown>
+    </div>
+
+    <!-- table区域-begin -->
+    <div>
+      <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
+        <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
+        <a style="margin-left: 24px" @click="onClearSelected">清空</a>
+      </div>
+
+      <a-table
+        ref="table"
+        size="middle"
+        bordered
+        rowKey="id"
+        :columns="columns"
+        :dataSource="dataSource"
+        :pagination="ipagination"
+        :loading="loading"
+        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
+        @change="handleTableChange">
+
+        <span slot="action" slot-scope="text, record">
+          <a @click="handleEdit(record)">编辑</a>
+
+          <a-divider type="vertical" />
+          <a-dropdown>
+            <a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
+            <a-menu slot="overlay">
+              <a-menu-item>
+                <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
+                  <a>删除</a>
+                </a-popconfirm>
+              </a-menu-item>
+            </a-menu>
+          </a-dropdown>
+        </span>
+
+      </a-table>
+    </div>
+    <!-- table区域-end -->
+
+    <!-- 表单区域 -->
+    <bindAccount-modal ref="modalForm" @ok="modalFormOk"></bindAccount-modal>
+  </a-card>
+</template>
+
+<script>
+  import BindAccountModal from './modules/BindAccountModal'
+  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
+
+  export default {
+    name: "BindAccountList",
+    mixins:[JeecgListMixin],
+    components: {
+      BindAccountModal
+    },
+    data () {
+      return {
+        description: '账户绑定管理页面',
+        // 表头
+        columns: [
+          {
+            title: '#',
+            dataIndex: '',
+            key:'rowIndex',
+            width:60,
+            align:"center",
+            customRender:function (t,r,index) {
+              return parseInt(index)+1;
+            }
+           },
+		   {
+            title: '广告id',
+            align:"center",
+            dataIndex: 'advertiserId'
+           },
+		   {
+            title: '账号',
+            align:"center",
+            dataIndex: 'accountName'
+           },
+		   {
+            title: '密码',
+            align:"center",
+            dataIndex: 'password'
+           },
+		   {
+            title: '登录/授权方式',
+            align:"center",
+            dataIndex: 'loginType'
+           },
+		   {
+            title: '方式:登录或授权',
+            align:"center",
+            dataIndex: 'type'
+           },
+		   {
+            title: '回调返回广告主id',
+            align:"center",
+            dataIndex: 'accountId'
+           },
+          {
+            title: '操作',
+            dataIndex: 'action',
+            align:"center",
+            scopedSlots: { customRender: 'action' },
+          }
+        ],
+		url: {
+          list: "/ctop/bindAccount/list",
+          delete: "/ctop/bindAccount/delete",
+          deleteBatch: "/ctop/bindAccount/deleteBatch",
+          exportXlsUrl: "ctop/bindAccount/exportXls",
+          importExcelUrl: "ctop/bindAccount/importExcel",
+       },
+    }
+  },
+  computed: {
+    importExcelUrl: function(){
+      return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
+    }
+  },
+    methods: {
+     
+    }
+  }
+</script>
+<style scoped>
+  @import '~@assets/less/common.less'
+</style>

+ 154 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/vue/modules/BindAccountModal.vue

@@ -0,0 +1,154 @@
+<template>
+  <a-modal
+    :title="title"
+    :width="800"
+    :visible="visible"
+    :confirmLoading="confirmLoading"
+    @ok="handleOk"
+    @cancel="handleCancel"
+    cancelText="关闭">
+    
+    <a-spin :spinning="confirmLoading">
+      <a-form :form="form">
+      
+        <a-form-item
+          :labelCol="labelCol"
+          :wrapperCol="wrapperCol"
+          label="广告id">
+          <a-input placeholder="请输入广告id" v-decorator="['advertiserId', {}]" />
+        </a-form-item>
+        <a-form-item
+          :labelCol="labelCol"
+          :wrapperCol="wrapperCol"
+          label="账号">
+          <a-input placeholder="请输入账号" v-decorator="['accountName', {}]" />
+        </a-form-item>
+        <a-form-item
+          :labelCol="labelCol"
+          :wrapperCol="wrapperCol"
+          label="密码">
+          <a-input placeholder="请输入密码" v-decorator="['password', {}]" />
+        </a-form-item>
+        <a-form-item
+          :labelCol="labelCol"
+          :wrapperCol="wrapperCol"
+          label="登录/授权方式">
+          <a-input placeholder="请输入登录/授权方式" v-decorator="['loginType', {}]" />
+        </a-form-item>
+        <a-form-item
+          :labelCol="labelCol"
+          :wrapperCol="wrapperCol"
+          label="方式:登录或授权">
+          <a-input placeholder="请输入方式:登录或授权" v-decorator="['type', {}]" />
+        </a-form-item>
+        <a-form-item
+          :labelCol="labelCol"
+          :wrapperCol="wrapperCol"
+          label="回调返回广告主id">
+          <a-input placeholder="请输入回调返回广告主id" v-decorator="['accountId', {}]" />
+        </a-form-item>
+		
+      </a-form>
+    </a-spin>
+  </a-modal>
+</template>
+
+<script>
+  import { httpAction } from '@/api/manage'
+  import pick from 'lodash.pick'
+  import moment from "moment"
+
+  export default {
+    name: "BindAccountModal",
+    data () {
+      return {
+        title:"操作",
+        visible: false,
+        model: {},
+        labelCol: {
+          xs: { span: 24 },
+          sm: { span: 5 },
+        },
+        wrapperCol: {
+          xs: { span: 24 },
+          sm: { span: 16 },
+        },
+
+        confirmLoading: false,
+        form: this.$form.createForm(this),
+        validatorRules:{
+        },
+        url: {
+          add: "/ctop/bindAccount/add",
+          edit: "/ctop/bindAccount/edit",
+        },
+      }
+    },
+    created () {
+    },
+    methods: {
+      add () {
+        this.edit({});
+      },
+      edit (record) {
+        this.form.resetFields();
+        this.model = Object.assign({}, record);
+        this.visible = true;
+        this.$nextTick(() => {
+          this.form.setFieldsValue(pick(this.model,'advertiserId','accountName','password','loginType','type','accountId'))
+		  //时间格式化
+        });
+
+      },
+      close () {
+        this.$emit('close');
+        this.visible = false;
+      },
+      handleOk () {
+        const that = this;
+        // 触发表单验证
+        this.form.validateFields((err, values) => {
+          if (!err) {
+            that.confirmLoading = true;
+            let httpurl = '';
+            let method = '';
+            if(!this.model.id){
+              httpurl+=this.url.add;
+              method = 'post';
+            }else{
+              httpurl+=this.url.edit;
+               method = 'put';
+            }
+            let formData = Object.assign(this.model, values);
+            //时间格式化
+            
+            console.log(formData)
+            httpAction(httpurl,formData,method).then((res)=>{
+              if(res.success){
+                that.$message.success(res.message);
+                that.$emit('ok');
+              }else{
+                that.$message.warning(res.message);
+              }
+            }).finally(() => {
+              that.confirmLoading = false;
+              that.close();
+            })
+
+
+
+          }
+        })
+      },
+      handleCancel () {
+        this.close()
+      },
+
+
+    }
+  }
+</script>
+
+<style lang="less" scoped>
+
+</style>

+ 161 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/vue/modules/BindAccountModal__Style#Drawer.vue

@@ -0,0 +1,161 @@
+<template>
+  <a-drawer
+      :title="title"
+      :width="800"
+      placement="right"
+      :closable="false"
+      @close="close"
+      :visible="visible"
+  >
+
+    <a-spin :spinning="confirmLoading">
+      <a-form :form="form">
+      
+        <a-form-item
+          :labelCol="labelCol"
+          :wrapperCol="wrapperCol"
+          label="广告id">
+          <a-input placeholder="请输入广告id" v-decorator="['advertiserId', {}]" />
+        </a-form-item>
+        <a-form-item
+          :labelCol="labelCol"
+          :wrapperCol="wrapperCol"
+          label="账号">
+          <a-input placeholder="请输入账号" v-decorator="['accountName', {}]" />
+        </a-form-item>
+        <a-form-item
+          :labelCol="labelCol"
+          :wrapperCol="wrapperCol"
+          label="密码">
+          <a-input placeholder="请输入密码" v-decorator="['password', {}]" />
+        </a-form-item>
+        <a-form-item
+          :labelCol="labelCol"
+          :wrapperCol="wrapperCol"
+          label="登录/授权方式">
+          <a-input placeholder="请输入登录/授权方式" v-decorator="['loginType', {}]" />
+        </a-form-item>
+        <a-form-item
+          :labelCol="labelCol"
+          :wrapperCol="wrapperCol"
+          label="方式:登录或授权">
+          <a-input placeholder="请输入方式:登录或授权" v-decorator="['type', {}]" />
+        </a-form-item>
+        <a-form-item
+          :labelCol="labelCol"
+          :wrapperCol="wrapperCol"
+          label="回调返回广告主id">
+          <a-input placeholder="请输入回调返回广告主id" v-decorator="['accountId', {}]" />
+        </a-form-item>
+		
+      </a-form>
+    </a-spin>
+    <a-button type="primary" @click="handleOk">确定</a-button>
+    <a-button type="primary" @click="handleCancel">取消</a-button>
+  </a-drawer>
+</template>
+
+<script>
+  import { httpAction } from '@/api/manage'
+  import pick from 'lodash.pick'
+  import moment from "moment"
+
+  export default {
+    name: "BindAccountModal",
+    data () {
+      return {
+        title:"操作",
+        visible: false,
+        model: {},
+        labelCol: {
+          xs: { span: 24 },
+          sm: { span: 5 },
+        },
+        wrapperCol: {
+          xs: { span: 24 },
+          sm: { span: 16 },
+        },
+
+        confirmLoading: false,
+        form: this.$form.createForm(this),
+        validatorRules:{
+        },
+        url: {
+          add: "/ctop/bindAccount/add",
+          edit: "/ctop/bindAccount/edit",
+        },
+      }
+    },
+    created () {
+    },
+    methods: {
+      add () {
+        this.edit({});
+      },
+      edit (record) {
+        this.form.resetFields();
+        this.model = Object.assign({}, record);
+        this.visible = true;
+        this.$nextTick(() => {
+          this.form.setFieldsValue(pick(this.model,'advertiserId','accountName','password','loginType','type','accountId'))
+		  //时间格式化
+        });
+
+      },
+      close () {
+        this.$emit('close');
+        this.visible = false;
+      },
+      handleOk () {
+        const that = this;
+        // 触发表单验证
+        this.form.validateFields((err, values) => {
+          if (!err) {
+            that.confirmLoading = true;
+            let httpurl = '';
+            let method = '';
+            if(!this.model.id){
+              httpurl+=this.url.add;
+              method = 'post';
+            }else{
+              httpurl+=this.url.edit;
+               method = 'put';
+            }
+            let formData = Object.assign(this.model, values);
+            //时间格式化
+            
+            console.log(formData)
+            httpAction(httpurl,formData,method).then((res)=>{
+              if(res.success){
+                that.$message.success(res.message);
+                that.$emit('ok');
+              }else{
+                that.$message.warning(res.message);
+              }
+            }).finally(() => {
+              that.confirmLoading = false;
+              that.close();
+            })
+
+
+
+          }
+        })
+      },
+      handleCancel () {
+        this.close()
+      },
+
+
+    }
+  }
+</script>
+
+<style lang="less" scoped>
+/** Button按钮间距 */
+  .ant-btn {
+    margin-left: 30px;
+    margin-bottom: 30px;
+    float: right;
+  }
+</style>

+ 1 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/service/impl/KuaishouInterfaceServiceImpl.java

@@ -721,7 +721,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
 
         KuaishouResultToken kuaiShouResult = null;
         try {
-            String result = HttpUtils.kuaiShouhttpPostRequest(url, requestJson.toJSONString(), null);
+            String result = HttpUtils.kuaiShouhttpPostRequest(url, requestJson.toJSONString(), headers);
             ObjectMapper mapper = new ObjectMapper();
             mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
             kuaiShouResult = mapper.readValue(result, new TypeReference<KuaishouResultToken>() {

+ 6 - 0
module-kuaishou/src/main/java/constant/KuaishouInterfaceConstant.java

@@ -24,4 +24,10 @@ public class KuaishouInterfaceConstant {
     public static final String APP_LIST = "/rest/openapi/v1/file/ad/app/list"; //创建广告获取应用列表
 
 
+    public static final String TYPE_LOGIN = "login"; //登录
+    public static final String TYPE_AUTHORIZATION = "authorization"; //授权
+    public static final String LOGIN_TYPE_KUAISHOU = "kuaishou"; //登录方式-快手
+    public static final String LOGIN_TYPE_BYTEDANCE = "bytedance"; //登录方式-快手
+
+
 }