Sfoglia il codice sorgente

Merge branch 'master' into test

yumeng 5 anni fa
parent
commit
23fb5836a2
52 ha cambiato i file con 1612 aggiunte e 471 eliminazioni
  1. 0 101
      feishu-sdk/pom.xml
  2. 0 18
      feishu-sdk/src/main/java/cn/feishu/sdk/Test.java
  3. 0 61
      feishu-sdk/src/main/java/cn/feishu/sdk/provider/AuthProvider.java
  4. 0 167
      feishu-sdk/src/main/java/cn/feishu/sdk/util/HttpUtil.java
  5. 0 62
      feishu-sdk/src/main/java/cn/feishu/sdk/util/PropertiesUtils.java
  6. 0 4
      feishu-sdk/src/main/resources/config.properties
  7. 6 0
      jeecg-boot-module-system/pom.xml
  8. 1 0
      jeecg-boot-module-system/src/main/java/org/jeecg/config/ShiroConfig.java
  9. 0 7
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/CallbackController.java
  10. 241 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/CorpFeishuUserController.java
  11. 76 5
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/TestController.java
  12. 1 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/YardController.java
  13. 72 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/CorpFeishuUser.java
  14. 14 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/CorpFeishuUserMapper.java
  15. 5 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/CorpFeishuUserMapper.xml
  16. 14 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/ICorpFeishuUserService.java
  17. 18 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/CorpFeishuUserServiceImpl.java
  18. 1 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/ProjectMemberServiceImpl.java
  19. 92 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/LoginController.java
  20. 3 3
      jeecg-boot-module-system/src/main/resources/application-prod.yml
  21. 168 0
      jeecg-boot-module-system/src/main/resources/application-prod2.yml
  22. 1 1
      jeecg-boot-module-system/src/main/resources/application-test.yml
  23. 4 4
      jeecg-boot-module-system/src/main/resources/application-wps.yml
  24. 123 0
      module-callback/pom.xml
  25. 23 0
      module-callback/src/main/java/cn/com/ctop/callback/StartApplication.java
  26. 29 0
      module-callback/src/main/java/cn/com/ctop/callback/config/XxlMqConf.java
  27. 28 0
      module-callback/src/main/java/cn/com/ctop/callback/controller/CallbackController.java
  28. 13 0
      module-callback/src/main/resources/application-dev.yml
  29. 13 0
      module-callback/src/main/resources/application-prod.yml
  30. 13 0
      module-callback/src/main/resources/application-test.yml
  31. 8 0
      module-callback/src/main/resources/application.yml
  32. 29 0
      module-callback/src/main/resources/logback-dev.xml
  33. 29 0
      module-callback/src/main/resources/logback-prod.xml
  34. 29 0
      module-callback/src/main/resources/logback-test.xml
  35. 20 0
      module-callback/src/test/java/org/jeecgframework/boot/AppTest.java
  36. 1 1
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/IpPoolServiceImpl.java
  37. 213 0
      module-common/src/main/java/cn/com/ctop/common/module/utils/HttpUtils.java
  38. 3 5
      module-common/src/main/java/cn/com/ctop/common/module/utils/PropertiesUtils.java
  39. 13 0
      module-common/src/main/java/cn/com/ctop/common/module/utils/RandomUtil.java
  40. 7 6
      feishu-sdk/src/main/java/cn/feishu/sdk/common/ApiConstant.java
  41. 87 0
      module-common/src/main/java/cn/com/feishu/provider/AuthProvider.java
  42. 5 6
      feishu-sdk/src/main/java/cn/feishu/sdk/provider/MessageProvider.java
  43. 2 0
      module-ctop/src/main/java/cn/com/ctop/manage/modules/material/service/impl/MaterialUploadServiceImpl.java
  44. 78 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/BatchController.java
  45. 1 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/KuaiShouVideoGet.java
  46. 9 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaiShouVideoTimeService.java
  47. 2 2
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaishouInterfaceService.java
  48. 5 4
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/BatchServiceImpl.java
  49. 6 6
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouCreateServiceImpl.java
  50. 64 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouVideoTimeServiceImpl.java
  51. 41 3
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java
  52. 1 2
      pom.xml

+ 0 - 101
feishu-sdk/pom.xml

@@ -1,101 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-  <modelVersion>4.0.0</modelVersion>
-
-  <groupId>cn.feishu.sdk</groupId>
-  <artifactId>feishu-sdk</artifactId>
-  <version>2.0.2</version>
-
-  <name>feishu-sdk</name>
-  <!-- FIXME change it to the project's website -->
-  <url>http://www.example.com</url>
-
-  <properties>
-    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-    <maven.compiler.source>1.7</maven.compiler.source>
-    <maven.compiler.target>1.7</maven.compiler.target>
-  </properties>
-
-  <dependencies>
-    <dependency>
-      <groupId>commons-io</groupId>
-      <artifactId>commons-io</artifactId>
-      <version>2.6</version>
-    </dependency>
-    <dependency>
-      <groupId>commons-lang</groupId>
-      <artifactId>commons-lang</artifactId>
-      <version>2.6</version>
-    </dependency>
-   <!-- <dependency>
-      <groupId>org.projectlombok</groupId>
-      <artifactId>lombok</artifactId>
-    </dependency>-->
-    <dependency>
-      <groupId>com.alibaba</groupId>
-      <artifactId>fastjson</artifactId>
-      <version>1.2.56</version>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.httpcomponents</groupId>
-      <artifactId>httpclient</artifactId>
-      <version>4.5.9</version>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.httpcomponents</groupId>
-      <artifactId>httpcore</artifactId>
-      <version>4.4</version>
-    </dependency>
-    <dependency>
-      <groupId>cn.hutool</groupId>
-      <artifactId>hutool-all</artifactId>
-      <version>4.5.11</version>
-    </dependency>
-  </dependencies>
-
-  <build>
-    <pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
-      <plugins>
-        <!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->
-        <plugin>
-          <artifactId>maven-clean-plugin</artifactId>
-          <version>3.1.0</version>
-        </plugin>
-        <!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging -->
-        <plugin>
-          <artifactId>maven-resources-plugin</artifactId>
-          <version>3.0.2</version>
-        </plugin>
-        <plugin>
-          <artifactId>maven-compiler-plugin</artifactId>
-          <version>3.8.0</version>
-        </plugin>
-        <plugin>
-          <artifactId>maven-surefire-plugin</artifactId>
-          <version>2.22.1</version>
-        </plugin>
-        <plugin>
-          <artifactId>maven-jar-plugin</artifactId>
-          <version>3.0.2</version>
-        </plugin>
-        <plugin>
-          <artifactId>maven-install-plugin</artifactId>
-          <version>2.5.2</version>
-        </plugin>
-        <plugin>
-          <artifactId>maven-deploy-plugin</artifactId>
-          <version>2.8.2</version>
-        </plugin>
-        <!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle -->
-        <plugin>
-          <artifactId>maven-site-plugin</artifactId>
-          <version>3.7.1</version>
-        </plugin>
-        <plugin>
-          <artifactId>maven-project-info-reports-plugin</artifactId>
-          <version>3.0.0</version>
-        </plugin>
-      </plugins>
-    </pluginManagement>
-  </build>
-</project>

+ 0 - 18
feishu-sdk/src/main/java/cn/feishu/sdk/Test.java

@@ -1,18 +0,0 @@
-package cn.feishu.sdk;
-
-import cn.feishu.sdk.provider.AuthProvider;
-
-import java.io.UnsupportedEncodingException;
-
-public class Test {
-    public static void main(String[] args){
-        AuthProvider authProvider = new AuthProvider();
-        try {
-//            authProvider.getAuthUrl("state");
-            authProvider.getAppAccessToken();
-            authProvider.getTenantAccessToken();
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-    }
-}

+ 0 - 61
feishu-sdk/src/main/java/cn/feishu/sdk/provider/AuthProvider.java

@@ -1,61 +0,0 @@
-package cn.feishu.sdk.provider;
-
-import cn.feishu.sdk.common.ApiConstant;
-import cn.feishu.sdk.util.HttpUtil;
-import cn.feishu.sdk.util.PropertiesUtils;
-import com.alibaba.fastjson.JSONObject;
-import java.io.UnsupportedEncodingException;
-import java.net.MalformedURLException;
-import java.net.URLEncoder;
-
-public class AuthProvider {
-    public String getAuthUrl(String state) throws UnsupportedEncodingException, MalformedURLException {
-        String redirectUri = PropertiesUtils.getConfig("callback_url");
-        return HttpUtil.feishuGetRequestString(ApiConstant.FEISHU_API_URL+ApiConstant.AUTH_INDEX+"?redirect_uri="+ URLEncoder.encode(redirectUri,"UTF-8")+"&app_id="+ApiConstant.FEISHU_APP_ID+"&state="+state);
-    }
-    public JSONObject getAccessToken(String code) throws Exception {
-        JSONObject params = new JSONObject();
-        params.put("app_access_token",getAppAccessToken());
-        params.put("grant_type","authorization_code");
-        params.put("code",code);
-        return HttpUtil.feishuPostRequest(ApiConstant.FEISHU_API_URL+ApiConstant.AUTH_ACCESS_TOKEN,params);
-    }
-
-    public JSONObject refreshAccessToken(String refreshToken) throws Exception{
-        JSONObject params = new JSONObject();
-        params.put("app_access_token",getAppAccessToken());
-        params.put("grant_type","refresh_token");
-        params.put("refresh_token",refreshToken);
-        return HttpUtil.feishuPostRequest(ApiConstant.FEISHU_API_URL+ApiConstant.REFRESH_AUTH_ACCESS_TOKEN,params);
-    }
-
-    public JSONObject getUserInfo(String accessToken){
-        JSONObject params = new JSONObject();
-        params.put("user_access_token",accessToken);
-        return HttpUtil.feishuGetRequest("Bearer user_access_token",ApiConstant.FEISHU_API_URL+ApiConstant.USER_INFO,params);
-    }
-
-    public String getAppAccessToken() throws Exception {
-        JSONObject params = new JSONObject();
-        params.put("app_id",ApiConstant.FEISHU_APP_ID);
-        params.put("app_secret",ApiConstant.FEISHU_APP_SECRET);
-        JSONObject resultNode = HttpUtil.feishuPostRequest(ApiConstant.FEISHU_API_URL+ApiConstant.APP_ACCESS_TOKEN,params);
-        if (resultNode.getIntValue("code")==0){
-            return resultNode.getString("app_access_token");
-        }else {
-            throw new Exception();
-        }
-    }
-
-    public String getTenantAccessToken() throws Exception {
-        JSONObject params = new JSONObject();
-        params.put("app_id",ApiConstant.FEISHU_APP_ID);
-        params.put("app_secret",ApiConstant.FEISHU_APP_SECRET);
-        JSONObject resultNode = HttpUtil.feishuPostRequest(ApiConstant.FEISHU_API_URL+ApiConstant.TENANT_ACCESS_TOKEN,params);
-        if (resultNode.getIntValue("code")==0){
-            return resultNode.getString("tenant_access_token");
-        }else {
-            throw new Exception();
-        }
-    }
-}

+ 0 - 167
feishu-sdk/src/main/java/cn/feishu/sdk/util/HttpUtil.java

@@ -1,167 +0,0 @@
-package cn.feishu.sdk.util;
-
-import cn.hutool.extra.ssh.JschRuntimeException;
-import com.alibaba.fastjson.JSONObject;
-import org.apache.http.client.config.RequestConfig;
-import org.apache.http.client.methods.CloseableHttpResponse;
-import org.apache.http.client.methods.HttpEntityEnclosingRequestBase;
-import org.apache.http.client.methods.HttpPost;
-import org.apache.http.entity.ContentType;
-import org.apache.http.entity.StringEntity;
-import org.apache.http.impl.client.CloseableHttpClient;
-import org.apache.http.impl.client.HttpClientBuilder;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.net.URI;
-
-public class HttpUtil {
-
-    public static JSONObject feishuGetRequest(String url, JSONObject params){
-        return HttpUtil.feishuGetRequest(null,url,params);
-    }
-    public static JSONObject feishuPostRequest(String url,JSONObject params){
-        return HttpUtil.feishuPostRequest(null,url,params);
-    }
-
-    public static String feishuGetRequestString(String url) {
-        System.out.println(url);
-        // 构造请求
-        HttpEntityEnclosingRequestBase httpEntity = new HttpEntityEnclosingRequestBase() {
-            @Override
-            public String getMethod() {
-                return "GET";
-            }
-        };
-        CloseableHttpResponse response = null;
-        CloseableHttpClient client = null;
-        try {
-            client = HttpClientBuilder.create().build();
-            httpEntity.setURI(URI.create(url));
-            RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(12000).setConnectTimeout(12000).build();
-            httpEntity.setConfig(requestConfig);
-            response = client.execute(httpEntity);
-            if (response != null && response.getStatusLine().getStatusCode() == 200) {
-                BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
-                StringBuilder result = new StringBuilder();
-                String line = "";
-                while ((line = bufferedReader.readLine()) != null) {
-                    result.append(line);
-                }
-                bufferedReader.close();
-                System.out.println(result.toString());
-                return result.toString();
-            }
-        } catch (Exception e) {
-            e.printStackTrace();
-        } finally {
-            try {
-                if (response != null) {
-                    response.close();
-                }
-                if (client != null) {
-                    client.close();
-                }
-            } catch (IOException e) {
-                e.printStackTrace();
-            }
-        }
-        return null;
-    }
-
-    public static JSONObject feishuGetRequest(String accessToken, String url, JSONObject params) {
-        System.out.println(url);
-        // 构造请求
-        HttpEntityEnclosingRequestBase httpEntity = new HttpEntityEnclosingRequestBase() {
-            @Override
-            public String getMethod() {
-                return "GET";
-            }
-        };
-        if(accessToken != null){
-            httpEntity.setHeader("Authorization", accessToken);
-        }
-        CloseableHttpResponse response = null;
-        CloseableHttpClient client = null;
-        try {
-            client = HttpClientBuilder.create().build();
-            httpEntity.setURI(URI.create(url));
-            if (params != null){
-                httpEntity.setEntity(new StringEntity(params.toJSONString(), ContentType.APPLICATION_JSON));
-            }
-            RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(12000).setConnectTimeout(12000).build();
-            httpEntity.setConfig(requestConfig);
-            response = client.execute(httpEntity);
-            if (response != null && response.getStatusLine().getStatusCode() == 200) {
-                BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
-                StringBuilder result = new StringBuilder();
-                String line = "";
-                while ((line = bufferedReader.readLine()) != null) {
-                    result.append(line);
-                }
-                bufferedReader.close();
-                System.out.println(result.toString());
-                return JSONObject.parseObject(result.toString());
-            }
-        } catch (Exception e) {
-            e.printStackTrace();
-        } finally {
-            try {
-                if (response != null) {
-                    response.close();
-                }
-                if (client != null) {
-                    client.close();
-                }
-            } catch (IOException e) {
-                e.printStackTrace();
-            }
-        }
-        return null;
-    }
-
-
-
-    public static JSONObject feishuPostRequest(String accessToken, String url, JSONObject params) {
-        // 构造请求
-        HttpPost httpEntity = new HttpPost(url);
-        if(accessToken != null){
-            httpEntity.setHeader("Authorization", accessToken);
-        }
-        CloseableHttpResponse response = null;
-        CloseableHttpClient client = null;
-        try {
-            client = HttpClientBuilder.create().build();
-            httpEntity.setEntity(new StringEntity(params.toJSONString(), ContentType.APPLICATION_JSON));
-            RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(12000).setConnectTimeout(12000).build();
-            httpEntity.setConfig(requestConfig);
-            response = client.execute(httpEntity);
-            if (response != null && response.getStatusLine().getStatusCode() == 200) {
-                BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
-                StringBuilder result = new StringBuilder();
-                String line = "";
-                while ((line = bufferedReader.readLine()) != null) {
-                    result.append(line);
-                }
-                bufferedReader.close();
-                System.out.println(result.toString());
-                return JSONObject.parseObject(result.toString());
-            }
-        } catch (Exception e) {
-            e.printStackTrace();
-        } finally {
-            try {
-                if (response != null) {
-                    response.close();
-                }
-                if (client != null) {
-                    client.close();
-                }
-            } catch (IOException e) {
-                e.printStackTrace();
-            }
-        }
-        return null;
-    }
-}

+ 0 - 62
feishu-sdk/src/main/java/cn/feishu/sdk/util/PropertiesUtils.java

@@ -1,62 +0,0 @@
-package cn.feishu.sdk.util;
-
-import java.io.InputStream;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Properties;
-
-/**
- * @author jeecg-boot
- * 2019年11月12日10:04:00
- */
-public class PropertiesUtils {
-    private static Map<String, String> cache = new HashMap<String, String>();
-
-    public static String getConfig(String key) {
-        return getValue("config", key);
-    }
-
-    public static String getValue(String name, String key) {
-        try {
-            String cacheValue = (String) cache.get(name + key);
-            if (cacheValue != null) {
-                return cacheValue;
-            }
-            Properties props = new Properties();
-            InputStream in = PropertiesUtils.class.getResourceAsStream("/"
-                    + name + ".properties");
-            props.load(in);
-            String value = props.getProperty(key);
-            cache.put(name + key, value);
-            props.clone();
-            in.close();
-            return value;
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-        return null;
-    }
-
-    public static Map<String, String> getMap(String name) {
-        try {
-            Properties props = new Properties();
-            InputStream in = PropertiesUtils.class.getResourceAsStream("/"
-                    + name + ".properties");
-            props.load(in);
-            Iterator<Object> it = props.keySet().iterator();
-            Map<String, String> map = new HashMap<String, String>();
-            while (it.hasNext()) {
-                String key = it.next().toString();
-                String value = props.getProperty(key);
-                map.put(key, value);
-            }
-            props.clone();
-            in.close();
-            return map;
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-        return null;
-    }
-}

+ 0 - 4
feishu-sdk/src/main/resources/config.properties

@@ -1,4 +0,0 @@
-feishu_api_url=https://open.feishu.cn/open-apis
-feishu_app_id=cli_9e68af69ca34d00e
-feishu_app_secret=0RsCBRCLx1rG8HKfeZNeAbddxZ3Rsnwv
-callback_url=https://callback.tjyourong.com.cn/jeecg-boot/feishu/auth

+ 6 - 0
jeecg-boot-module-system/pom.xml

@@ -232,6 +232,12 @@
             </properties>
         </profile>
         <profile>
+            <id>prod2</id>
+            <properties>
+                <activatedProperties>prod2</activatedProperties>
+            </properties>
+        </profile>
+        <profile>
             <id>wps</id>
             <properties>
                 <activatedProperties>wps</activatedProperties>

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

@@ -131,6 +131,7 @@ public class ShiroConfig {
 
         filterChainDefinitionMap.put("/system/userCompany/**", "anon");
         filterChainDefinitionMap.put("/qywexin", "anon");
+        filterChainDefinitionMap.put("/sys/feishu/**", "anon");
         filterChainDefinitionMap.put("/test/getGroupData/**", "anon");
         filterChainDefinitionMap.put("/test/getVideoAndImage/**", "anon");
         filterChainDefinitionMap.put("/test/gerCreative/**", "anon");

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

@@ -62,13 +62,6 @@ public class CallbackController {
     @Autowired
     private IReportService reportService;
 
-    @GetMapping("/feishu/auth")
-    public void feishuAuth(HttpServletRequest request,
-                        HttpServletResponse response,
-                        @RequestParam("code") String code,
-                        @RequestParam("state") String state) throws IOException {
-        System.out.println(request.getQueryString());
-    }
     @GetMapping("/qywexin")
     public void qywexin(HttpServletRequest request,
                         HttpServletResponse response,

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

@@ -0,0 +1,241 @@
+package org.jeecg.modules.ctop.controller;
+
+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.aspect.annotation.AutoLog;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.common.util.oConvertUtils;
+import org.jeecg.modules.ctop.entity.CorpFeishuUser;
+import org.jeecg.modules.ctop.service.ICorpFeishuUserService;
+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 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;
+
+ /**
+ * 飞书用户信息
+ * @author jeecg-boot
+ * @date   2020-06-23
+ * @version V1.0
+ */
+@Slf4j
+@Api(tags="飞书用户信息")
+@RestController
+@RequestMapping("/ctop/corpFeishuUser")
+public class CorpFeishuUserController {
+	@Autowired
+	private ICorpFeishuUserService corpFeishuUserService;
+
+	/**
+	  * 分页列表查询
+	 * @param corpFeishuUser
+	 * @param pageNo
+	 * @param pageSize
+	 * @param req
+	 * @return
+	 */
+	@AutoLog(value = "飞书用户信息-分页列表查询")
+	@ApiOperation(value="飞书用户信息-分页列表查询", notes="飞书用户信息-分页列表查询")
+	@GetMapping(value = "/list")
+	public Result<IPage<CorpFeishuUser>> queryPageList(CorpFeishuUser corpFeishuUser,
+													   @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+													   @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
+													   HttpServletRequest req) {
+		Result<IPage<CorpFeishuUser>> result = new Result<>();
+		QueryWrapper<CorpFeishuUser> queryWrapper = QueryGenerator.initQueryWrapper(corpFeishuUser, req.getParameterMap());
+		Page<CorpFeishuUser> page = new Page<CorpFeishuUser>(pageNo, pageSize);
+		IPage<CorpFeishuUser> pageList = corpFeishuUserService.page(page, queryWrapper);
+		result.setSuccess(true);
+		result.setResult(pageList);
+		return result;
+	}
+
+	/**
+	  *   添加
+	 * @param corpFeishuUser
+	 * @return
+	 */
+	@AutoLog(value = "飞书用户信息-添加")
+	@ApiOperation(value="飞书用户信息-添加", notes="飞书用户信息-添加")
+	@PostMapping(value = "/add")
+	public Result<CorpFeishuUser> add(@RequestBody CorpFeishuUser corpFeishuUser) {
+		Result<CorpFeishuUser> result = new Result<>();
+		try {
+			corpFeishuUserService.save(corpFeishuUser);
+			result.success("添加成功!");
+		} catch (Exception e) {
+			log.error(e.getMessage(),e);
+			result.error500("操作失败");
+		}
+		return result;
+	}
+
+	/**
+	  *  编辑
+	 * @param corpFeishuUser
+	 * @return
+	 */
+	@AutoLog(value = "飞书用户信息-编辑")
+	@ApiOperation(value="飞书用户信息-编辑", notes="飞书用户信息-编辑")
+	@PutMapping(value = "/edit")
+	public Result<CorpFeishuUser> edit(@RequestBody CorpFeishuUser corpFeishuUser) {
+		Result<CorpFeishuUser> result = new Result<>();
+		CorpFeishuUser corpFeishuUserEntity = corpFeishuUserService.getById(corpFeishuUser.getId());
+		if(corpFeishuUserEntity==null) {
+			result.error500("未找到对应实体");
+		}else {
+			boolean ok = corpFeishuUserService.updateById(corpFeishuUser);
+			if(ok) {
+				result.success("修改成功!");
+			}
+		}
+
+		return result;
+	}
+
+	/**
+	  *   通过id删除
+	 * @param id
+	 * @return
+	 */
+	@AutoLog(value = "飞书用户信息-通过id删除")
+	@ApiOperation(value="飞书用户信息-通过id删除", notes="飞书用户信息-通过id删除")
+	@DeleteMapping(value = "/delete")
+	public Result<Object> delete(@RequestParam(name="id",required=true) String id) {
+		try {
+			corpFeishuUserService.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<CorpFeishuUser> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
+		Result<CorpFeishuUser> result = new Result<>();
+		if(ids==null || "".equals(ids.trim())) {
+			result.error500("参数不识别!");
+		}else {
+			this.corpFeishuUserService.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<CorpFeishuUser> queryById(@RequestParam(name="id",required=true) String id) {
+		Result<CorpFeishuUser> result = new Result<>();
+		CorpFeishuUser corpFeishuUser = corpFeishuUserService.getById(id);
+		if(corpFeishuUser==null) {
+			result.error500("未找到对应实体");
+		}else {
+			result.setResult(corpFeishuUser);
+			result.setSuccess(true);
+		}
+		return result;
+	}
+
+  /**
+      * 导出excel
+   *
+   * @param request
+   * @param response
+   */
+  @RequestMapping(value = "/exportXls")
+  public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+      // Step.1 组装查询条件
+      QueryWrapper<CorpFeishuUser> queryWrapper = null;
+      try {
+          String paramsStr = request.getParameter("paramsStr");
+          if (oConvertUtils.isNotEmpty(paramsStr)) {
+              String deString = URLDecoder.decode(paramsStr, "UTF-8");
+              CorpFeishuUser corpFeishuUser = JSON.parseObject(deString, CorpFeishuUser.class);
+              queryWrapper = QueryGenerator.initQueryWrapper(corpFeishuUser, request.getParameterMap());
+          }
+      } catch (UnsupportedEncodingException e) {
+          e.printStackTrace();
+      }
+
+      //Step.2 AutoPoi 导出Excel
+      ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+      List<CorpFeishuUser> pageList = corpFeishuUserService.list(queryWrapper);
+      //导出文件名称
+      mv.addObject(NormalExcelConstants.FILE_NAME, "飞书用户信息列表");
+      mv.addObject(NormalExcelConstants.CLASS, CorpFeishuUser.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<CorpFeishuUser> listCorpFeishuUsers = ExcelImportUtil.importExcel(file.getInputStream(), CorpFeishuUser.class, params);
+              corpFeishuUserService.saveBatch(listCorpFeishuUsers);
+              return Result.ok("文件导入成功!数据行数:" + listCorpFeishuUsers.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("文件导入失败!");
+  }
+
+}

+ 76 - 5
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/TestController.java

@@ -7,10 +7,8 @@ import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.CtopAdConstant;
 import cn.com.ctop.common.module.utils.ResultMapUtils;
 import cn.com.ctop.common.module.utils.StatusCode;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouCampaignService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouDailyReportTaskService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouHistoryReportTaskService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouVideoGet;
+import cn.com.ctop.kuaishou.modules.batch.service.*;
 import cn.com.ctop.kuaishou.modules.graphql.service.IKuaishouWebInterfaceService;
 import cn.com.ctop.toutiao.modules.material.service.IByteDanceAdvertiserDataService;
 import cn.com.ctop.toutiao.modules.report.service.IBytedancePlanDailyReportService;
@@ -62,6 +60,9 @@ public class TestController {
     private IMaterialImageInfoService iMaterialImageInfoService;
     @Autowired
     private IBytedanceReportService bytedanceReportService;
+    static ExecutorService executorService = Executors.newFixedThreadPool(10);
+    static ExecutorService videoService = Executors.newFixedThreadPool(5);
+    static ExecutorService suzhaoService = Executors.newFixedThreadPool(5);
 
     @GetMapping(value = "/t")
     public String test() {
@@ -94,6 +95,76 @@ public class TestController {
 
     @Autowired
     private IMaterialCutFrameService cutFrameService;
+    @Autowired
+    IKuaiShouVideoGetService videoGetService;
+    @Autowired
+    private IKuaiShouVideoTimeService timeService;
+
+
+    @GetMapping(value = "/getVideoTime")
+    public void getVideoTime() throws InterruptedException {
+        Thread thread = new Thread() {
+            @Override
+            public void run() {
+                QueryWrapper<KuaiShouVideoGet> queryWrapper = new QueryWrapper<>();
+                queryWrapper.eq("channel_type", 0);
+                List<KuaiShouVideoGet> list = videoGetService.list(queryWrapper);
+                for (KuaiShouVideoGet video : list) {
+                    videoService.submit(new Runnable() {
+                        @Override
+                        public void run() {
+                            Date date = timeService.getVideoTime(video.getPhotoId(), video.getAccountId());
+                            if (!Check.isNull(date)) {
+                                video.setUploadDate(date);
+                                videoGetService.updateById(video);
+                            }
+
+                            try {
+                                Thread.sleep(1000);
+                            } catch (InterruptedException e) {
+                                e.printStackTrace();
+                            }
+                        }
+                    });
+                }
+            }
+        };
+        thread.start();
+
+    }
+
+
+    @GetMapping(value = "/getSuZhao")
+    public void getSuZhao() throws InterruptedException {
+        Thread thread = new Thread() {
+            @Override
+            public void run() {
+                QueryWrapper<KuaiShouVideoGet> queryWrapper = new QueryWrapper<>();
+                queryWrapper.eq("channel_type", 1);
+                List<KuaiShouVideoGet> list = videoGetService.list(queryWrapper);
+                for (KuaiShouVideoGet video : list) {
+                    suzhaoService.submit(new Runnable() {
+                        @Override
+                        public void run() {
+                            Date date = timeService.getVideoTime(video.getPhotoId(), video.getAccountId());
+                            if (!Check.isNull(date)) {
+                                video.setUploadDate(date);
+                                videoGetService.updateById(video);
+                            }
+
+                            try {
+                                Thread.sleep(1000);
+                            } catch (InterruptedException e) {
+                                e.printStackTrace();
+                            }
+                        }
+                    });
+                }
+            }
+        };
+        thread.start();
+
+    }
 
 
     @GetMapping(value = "/getAccountList")
@@ -405,7 +476,7 @@ public class TestController {
         return "Success";
     }
 
-    static ExecutorService executorService = Executors.newFixedThreadPool(10);
+
 
 
     @GetMapping(value = "/gerCreative")

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

@@ -15,6 +15,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
+import java.io.File;
 
 /**
  * @author yumeng

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

@@ -0,0 +1,72 @@
+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 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 java.util.Date;
+
+/**
+ * 飞书用户信息
+ * @author jeecg-boot
+ * @date   2020-06-23
+ * @version V1.0
+ */
+@Data
+@TableName("ctop_corp_feishu_user")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value="ctop_corp_feishu_user对象", description="飞书用户信息")
+public class CorpFeishuUser {
+
+	/**id*/
+	@TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "id")
+	private Long id;
+	/**email*/
+	@Excel(name = "email", width = 15)
+    @ApiModelProperty(value = "email")
+	private String email;
+	/**name*/
+	@Excel(name = "name", width = 15)
+    @ApiModelProperty(value = "name")
+	private String name;
+
+	private String openId;
+	/**avatarUrl*/
+	@Excel(name = "avatarUrl", width = 15)
+    @ApiModelProperty(value = "avatarUrl")
+	private String avatarUrl;
+	/**avatarThumb*/
+	@Excel(name = "avatarThumb", width = 15)
+    @ApiModelProperty(value = "avatarThumb")
+	private String avatarThumb;
+	/**avatarMiddle*/
+	@Excel(name = "avatarMiddle", width = 15)
+    @ApiModelProperty(value = "avatarMiddle")
+	private String avatarMiddle;
+	/**avatarBig*/
+	@Excel(name = "avatarBig", width = 15)
+    @ApiModelProperty(value = "avatarBig")
+	private String avatarBig;
+	/**userId*/
+	@Excel(name = "userId", width = 15)
+    @ApiModelProperty(value = "userId")
+	private String userId;
+	/**mobile*/
+	@Excel(name = "mobile", width = 15)
+    @ApiModelProperty(value = "mobile")
+	private String mobile;
+	/**createTime*/
+    @ApiModelProperty(value = "createTime")
+	private Date createTime;
+	/**updateTime*/
+    @ApiModelProperty(value = "updateTime")
+	private Date updateTime;
+}

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

@@ -0,0 +1,14 @@
+package org.jeecg.modules.ctop.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.jeecg.modules.ctop.entity.CorpFeishuUser;
+
+/**
+ * 飞书用户信息
+ * @author: jeecg-boot
+ * @date:   2020-06-23
+ * @cersion: V1.0
+ */
+public interface CorpFeishuUserMapper extends BaseMapper<CorpFeishuUser> {
+
+}

+ 5 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/CorpFeishuUserMapper.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.CorpFeishuUserMapper">
+
+</mapper>

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

@@ -0,0 +1,14 @@
+package org.jeecg.modules.ctop.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.modules.ctop.entity.CorpFeishuUser;
+
+/**
+ * 飞书用户信息
+ * @author jeecg-boot
+ * @date   2020-06-23
+ * @version V1.0
+ */
+public interface ICorpFeishuUserService extends IService<CorpFeishuUser> {
+
+}

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

@@ -0,0 +1,18 @@
+package org.jeecg.modules.ctop.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.jeecg.modules.ctop.entity.CorpFeishuUser;
+import org.jeecg.modules.ctop.mapper.CorpFeishuUserMapper;
+import org.jeecg.modules.ctop.service.ICorpFeishuUserService;
+import org.springframework.stereotype.Service;
+
+/**
+ * 飞书用户信息
+ * @author jeecg-boot
+ * @date   2020-06-23
+ * @version V1.0
+ */
+@Service
+public class CorpFeishuUserServiceImpl extends ServiceImpl<CorpFeishuUserMapper, CorpFeishuUser> implements ICorpFeishuUserService {
+
+}

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

@@ -5,7 +5,6 @@ import cn.com.ctop.common.module.mapper.UserAllocationMapper;
 import cn.com.ctop.common.module.service.ISysRoleService;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.CtopAdConstant;
-import cn.com.ctop.common.module.utils.SpringUtils;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.apache.shiro.SecurityUtils;
@@ -16,7 +15,6 @@ import org.jeecg.modules.ctop.mapper.ProjectMemberMapper;
 import org.jeecg.modules.ctop.service.IProjectMemberService;
 import org.jeecg.modules.system.entity.SysUser;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.cache.annotation.Cacheable;
 import org.springframework.stereotype.Service;
 
 import java.util.ArrayList;
@@ -72,6 +70,7 @@ public class ProjectMemberServiceImpl extends ServiceImpl<ProjectMemberMapper, P
     }
 
     //视频报表
+    @Override
     public List<ProjectMember> getProjects(List<Integer> mediaIds) {
         LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         String userId = sysUser.getId();

+ 92 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/LoginController.java

@@ -4,6 +4,9 @@ import cn.com.ctop.common.module.entity.CtopCorpWexinUser;
 import cn.com.ctop.common.module.service.ICtopCorpWexinUserService;
 import cn.com.ctop.common.module.utils.AesEncryptUtil;
 import cn.com.ctop.common.module.utils.EncryptedString;
+import cn.com.ctop.common.module.utils.ResultMapUtils;
+import cn.com.ctop.common.module.utils.StatusCode;
+import cn.com.feishu.provider.AuthProvider;
 import cn.hutool.core.util.RandomUtil;
 import com.alibaba.fastjson.JSONObject;
 import com.aliyuncs.exceptions.ClientException;
@@ -21,6 +24,7 @@ import me.chanjar.weixin.cp.bean.WxCpUser;
 import me.chanjar.weixin.cp.config.impl.WxCpDefaultConfigImpl;
 import org.apache.shiro.SecurityUtils;
 import org.apache.shiro.subject.Subject;
+import org.eclipse.jetty.util.UrlEncoded;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.constant.CommonConstant;
 import org.jeecg.common.system.api.ISysBaseApi;
@@ -30,6 +34,8 @@ import org.jeecg.common.util.DySmsHelper;
 import org.jeecg.common.util.PasswordUtil;
 import org.jeecg.common.util.RedisUtil;
 import org.jeecg.common.util.oConvertUtils;
+import org.jeecg.modules.ctop.entity.CorpFeishuUser;
+import org.jeecg.modules.ctop.service.ICorpFeishuUserService;
 import org.jeecg.modules.shiro.vo.DefContants;
 import org.jeecg.modules.system.entity.SysDepart;
 import org.jeecg.modules.system.entity.SysUser;
@@ -42,6 +48,7 @@ import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
 import java.util.*;
 
 /**
@@ -53,6 +60,7 @@ import java.util.*;
 @Api(tags = "用户登录")
 @Slf4j
 public class LoginController {
+    private static final String DOMAIN_SERVER = "http://adsp.tjyourong.com.cn/";
     @Autowired
     private ISysUserService sysUserService;
     @Autowired
@@ -65,11 +73,94 @@ public class LoginController {
     private ISysDepartService sysDepartService;
     @Autowired
     private ICtopCorpWexinUserService ctopCorpWexinUserService;
+    @Autowired
+    private ICorpFeishuUserService corpFeishuUserService;
+    @GetMapping("feishu/url")
+    public Map<String,Object> getUrl(){
+        Map<String,Object>result = new HashMap<>();
+        try {
+            String url = AuthProvider.getAuthUrl("");
+            result.put("url",url);
+            ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
+            return result;
+        } catch (Exception e) {
+            e.printStackTrace();
+            ResultMapUtils.setResultMap(result, StatusCode.COMMON_SERVER_ERROR);
+            return result;
+        }
+    }
+    @GetMapping("/feishu/auth")
+    public void feishuAuth(HttpServletRequest request,
+                           HttpServletResponse response,
+                           @RequestParam(name = "code",defaultValue = "code") String code,
+                           @RequestParam(name = "state",defaultValue = "_t") String state) throws IOException {
+        Result<JSONObject> result = new Result<>();
+        //1:根据code值获取用户飞书信息
+        try {
+            if(code.trim().equals("code")){
+                String url = AuthProvider.getAuthUrl("");
+                response.sendRedirect(url);
+                return ;
+            }
+            JSONObject data = AuthProvider.getFeishuUserInfo(code);
+            String accessToken = data.getJSONObject("data").getString("access_token");
+            String openId = data.getJSONObject("data").getString("open_id");
+            //根据accessToken
+            JSONObject userData = AuthProvider.getUserInfo(accessToken);
+            JSONObject dataObject = userData.getJSONObject("data");
+            String email = dataObject.getString("email");
+            if(null == email||email.trim().equals("")){
+                response.sendRedirect(DOMAIN_SERVER+"errorPage?desc="+ UrlEncoded.encodeString("飞书账号未绑定邮箱"));
+                return ;
+            }
+            SysUser sysUser = sysUserService.getUserByEmail(email);
+            if (sysUser == null) {
+                response.sendRedirect(DOMAIN_SERVER+"errorPage?desc="+ UrlEncoded.encodeString("该用户未注册系统账户,请联系管理员"));
+                return ;
+            }
+            if(sysUser.getStatus() != 1){
+                response.sendRedirect(DOMAIN_SERVER+"errorPage?desc="+UrlEncoded.encodeString("该用户已被冻结,请联系管理员"));
+                return ;
+            }
+            String departId = sysDepartService.selectIdByOrdCode(sysUser.getOrgCode());
+            sysUser.setDepartId(departId);
+            result = sysUserService.checkUserIsEffective(sysUser);
+            if (!result.isSuccess()) {
+                response.sendRedirect(DOMAIN_SERVER+"errorPage?desc="+UrlEncoded.encodeString(result.getMessage()));
+                return ;
+            }
+            //用户登录信息
+            userInfo(sysUser, result);
+            sysBaseApi.addLog("用户名: " + email + ",登录成功!", CommonConstant.LOG_TYPE_1, null);
+            CorpFeishuUser feishuUser = corpFeishuUserService.getById(sysUser.getId());
+            if (feishuUser == null) {
+                feishuUser = new CorpFeishuUser();
+                feishuUser.setOpenId(openId);
+                feishuUser.setUserId(sysUser.getId());
+                feishuUser.setEmail(sysUser.getEmail());
+                feishuUser.setAvatarBig(dataObject.getString("avatar_big"));
+                feishuUser.setAvatarMiddle(dataObject.getString("avatar_middle"));
+                feishuUser.setAvatarThumb(dataObject.getString("avatar_thumb"));
+                feishuUser.setAvatarUrl(dataObject.getString("avatar_url"));
+                feishuUser.setName(dataObject.getString("name"));
+                feishuUser.setMobile(dataObject.getString("mobile"));
+                feishuUser.setCreateTime(new Date());
+                feishuUser.setUpdateTime(new Date());
+                corpFeishuUserService.save(feishuUser);
+            }
+            response.sendRedirect(DOMAIN_SERVER+"dashboard/analysis");
+            return ;
+        } catch (Exception e) {
+            e.printStackTrace();
+            response.sendRedirect(DOMAIN_SERVER+"errorPage?desc="+ UrlEncoded.encodeString("系统异常,请联系管理员"));
+            return;
+        }
+    }
 
     @RequestMapping(value = "/wxlogin", method = RequestMethod.POST)
     @ApiOperation("企业微信登录接口")
     public Result<JSONObject> wxlogin(@RequestParam(name = "code") String code) throws Exception {
-        Result<JSONObject> result = new Result<JSONObject>();
+        Result<JSONObject> result = new Result<>();
         val configStorage = new WxCpDefaultConfigImpl();
         configStorage.setCorpId("ww24b8a47826f5875f");
         configStorage.setAgentId(1000002);

+ 3 - 3
jeecg-boot-module-system/src/main/resources/application-prod.yml

@@ -28,8 +28,8 @@ spring:
             enable: true
             required: true
   ## quartz定时任务,采用数据库方式
-  quartz:
-    job-store-type: jdbc
+  #quartz:
+    #job-store-type: jdbc
   #json 时间戳统一转换
   jackson:
     date-format:   yyyy-MM-dd HH:mm:ss
@@ -118,7 +118,7 @@ spring:
         max-wait: -1ms  #最大建立连接等待时间。如果超过此时间将接到异常。设为-1表示无限制。
         min-idle: 0     #最小等待连接中的数量,设 0 为没有限制
       shutdown-timeout: 100ms
-    password: ''
+    password: foobared
     port: 6379
 #mybatis plus 设置
 mybatis-plus:

+ 168 - 0
jeecg-boot-module-system/src/main/resources/application-prod2.yml

@@ -0,0 +1,168 @@
+server:
+  port: 8804
+  ip: 39.97.120.42
+  servlet:
+    context-path: /jeecg-boot
+    compression:
+      enabled: true
+      mime-types: application/javascript,application/json,application/xml,text/html,text/xml,text/plain,text/css,image/*
+management:
+  endpoints:
+    web:
+      exposure:
+        include: metrics,httptrace
+spring:
+  servlet:
+    multipart:
+      max-file-size: -1
+      max-request-size: -1
+  mail:
+    host: smtp.163.com
+    username: jeecgos@163.com
+    password: ??
+    properties:
+      mail:
+        smtp:
+          auth: true
+          starttls:
+            enable: true
+            required: true
+  ## quartz定时任务,采用数据库方式
+  quartz:
+    job-store-type: jdbc
+  #json 时间戳统一转换
+  jackson:
+    date-format:   yyyy-MM-dd HH:mm:ss
+    time-zone:   GMT+8
+  aop:
+    proxy-target-class: true
+  #配置freemarker
+  freemarker:
+    # 设置模板后缀名
+    suffix: .ftl
+    # 设置文档类型
+    content-type: text/html
+    # 设置页面编码格式
+    charset: UTF-8
+    # 设置页面缓存
+    cache: false
+    prefer-file-system-access: false
+    # 设置ftl文件路径
+    template-loader-path:
+      - classpath:/templates
+  # 设置静态文件路径,js,css等
+  mvc:
+    static-path-pattern: /**
+  resource:
+    static-locations: classpath:/static/,classpath:/public/
+  autoconfigure:
+    exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
+  datasource:
+    url: jdbc:mysql://172.30.0.4:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
+    username: hcst
+    password: test@20190531
+    driver-class-name: com.mysql.jdbc.Driver
+    druid:
+      stat-view-servlet:
+        loginUsername: admin
+        loginPassword: hcst2016
+        enabled: true
+      web-stat-filter:
+        enabled: true
+    #      remove-abandoned: false
+    dynamic:
+      druid: # 全局druid参数,绝大部分值和默认保持一致。(现已支持的参数如下,不清楚含义不要乱设置)
+        # 连接池的配置信息
+        # 初始化大小,最小,最大
+        connection-init-sql: set names utf8mb4
+        initial-size: 5
+        min-idle: 5
+        maxActive: 20
+        # 配置获取连接等待超时的时间
+        maxWait: 60000
+        # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
+        timeBetweenEvictionRunsMillis: 60000
+        # 配置一个连接在池中最小生存的时间,单位是毫秒
+        minEvictableIdleTimeMillis: 300000
+        validationQuery: SELECT 1 FROM DUAL
+        testWhileIdle: true
+        testOnBorrow: false
+        testOnReturn: false
+        # 打开PSCache,并且指定每个连接上PSCache的大小
+        poolPreparedStatements: true
+        maxPoolPreparedStatementPerConnectionSize: 20
+        # 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙
+        filters: stat,slf4j
+        # 通过connectProperties属性来打开mergeSql功能;慢SQL记录
+        connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
+      datasource:
+        master:
+          url: jdbc:mysql://172.30.0.4:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
+          username: hcst
+          password: test@20190531
+          driver-class-name: com.mysql.jdbc.Driver
+          # 多数据源配置
+          #multi-datasource1:
+          #url: jdbc:mysql://localhost:3306/jeecg-boot2?useUnicode=true&characterEncoding=utf8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true
+          #username: root
+          #password: root
+          #driver-class-name: com.mysql.jdbc.Driver
+  #redis 配置
+  redis:
+    database: 0
+    host: 172.30.0.17
+    lettuce:
+      pool:
+        max-active: 8   #最大连接数据库连接数,设 0 为没有限制
+        max-idle: 8     #最大等待连接中的数量,设 0 为没有限制
+        max-wait: -1ms  #最大建立连接等待时间。如果超过此时间将接到异常。设为-1表示无限制。
+        min-idle: 0     #最小等待连接中的数量,设 0 为没有限制
+      shutdown-timeout: 100ms
+    password: foobared
+    port: 6379
+#mybatis plus 设置
+mybatis-plus:
+  mapper-locations: classpath*:org/jeecg/modules/**/xml/*Mapper.xml,classpath*:cn/com/ctop/**/xml/*Mapper.xml
+  global-config:
+    # 关闭MP3.0自带的banner
+    banner: false
+    db-config:
+      #主键类型  0:"数据库ID自增",1:"该类型为未设置主键类型", 2:"用户输入ID",3:"全局唯一ID (数字类型唯一ID)", 4:"全局唯一ID UUID",5:"字符串全局唯一ID (idWorker 的字符串表示)";
+      id-type: 4
+      # 默认数据库表下划线命名
+      table-underline: true
+#  configuration:
+#    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
+#jeecg专用配置
+jeecg:
+  ffmpeg:
+    bin: ffmpeg
+  path:
+    #文件上传根目录 设置
+    upload: /data/upload
+    #webapp文件路径
+    webapp: /data/webapp
+    video-upload: /data/upload/video/
+    image-upload: /data/upload/image/
+    chrome-driver: /usr/bin/chromedriver
+    csv-upload: /data/upload/csv/
+    bak-database-file: /data/data/bak/
+    report-history: /data/upload/report/history/
+    report-daily: /data/upload/report/daily/
+kuaishou:
+  group-control:
+    path: http://39.106.184.70
+    port: 4723
+logging:
+  level:
+    root: info
+  config: classpath:logback-prod.xml
+chrome:
+  script:
+    clean: sh /data/webapp/cleanProcess.sh
+
+oss:
+  replace:
+    replace-value: oss-cn-beijing
+    replace-old-value: oss-cn-beijing
+    download: /data/file/video/

+ 1 - 1
jeecg-boot-module-system/src/main/resources/application-test.yml

@@ -113,7 +113,7 @@ spring:
         max-wait: -1ms  #最大建立连接等待时间。如果超过此时间将接到异常。设为-1表示无限制。
         min-idle: 0     #最小等待连接中的数量,设 0 为没有限制
       shutdown-timeout: 100ms
-    password: ''
+    password: foobared
     port: 6379
 #mybatis plus 设置
 mybatis-plus:

+ 4 - 4
jeecg-boot-module-system/src/main/resources/application-wps.yml

@@ -56,7 +56,7 @@ spring:
   autoconfigure:
     exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
   datasource:
-    url: jdbc:mysql://127.0.0.1:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
+    url: jdbc:mysql://139.186.27.96:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
     username: hcst
     password: test@20190531
     driver-class-name: com.mysql.jdbc.Driver
@@ -95,7 +95,7 @@ spring:
         connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
       datasource:
         master:
-          url: jdbc:mysql://39.106.184.70:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
+          url: jdbc:mysql://139.186.27.96:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
           username: hcst
           password: test@20190531
           driver-class-name: com.mysql.jdbc.Driver
@@ -108,7 +108,7 @@ spring:
   #redis 配置
   redis:
     database: 0
-    host: 127.0.0.1
+    host: 172.30.0.17
     lettuce:
       pool:
         max-active: 8   #最大连接数据库连接数,设 0 为没有限制
@@ -116,7 +116,7 @@ spring:
         max-wait: -1ms  #最大建立连接等待时间。如果超过此时间将接到异常。设为-1表示无限制。
         min-idle: 0     #最小等待连接中的数量,设 0 为没有限制
       shutdown-timeout: 100ms
-    password: ''
+    password: foobared
     port: 6379
 #mybatis plus 设置
 mybatis-plus:

+ 123 - 0
module-callback/pom.xml

@@ -0,0 +1,123 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>cn.com.ctop</groupId>
+  <artifactId>module-callback</artifactId>
+  <version>2.0.2</version>
+  <parent>
+    <groupId>org.jeecgframework.boot</groupId>
+    <artifactId>jeecg-boot-parent</artifactId>
+    <version>2.0.2</version>
+  </parent>
+  <name>module-callback</name>
+  <!-- FIXME change it to the project's website -->
+  <url>http://www.example.com</url>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    <maven.compiler.source>1.7</maven.compiler.source>
+    <maven.compiler.target>1.7</maven.compiler.target>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>cn.com.ctop</groupId>
+      <artifactId>module-common</artifactId>
+      <version>2.0.2</version>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>jcl-over-slf4j</artifactId>
+      <version>1.7.25</version>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
+      <version>1.7.25</version>
+    </dependency>
+    <dependency>
+      <groupId>org.jeecgframework.boot</groupId>
+      <artifactId>jeecg-boot-base-common</artifactId>
+      <version>2.0.2</version>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>jcl-over-slf4j</artifactId>
+      <version>1.7.25</version>
+    </dependency>
+    <dependency>
+      <groupId>com.xuxueli</groupId>
+      <artifactId>xxl-mq-client</artifactId>
+      <version>1.2.2</version>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.mybatis.generator</groupId>
+        <artifactId>mybatis-generator-maven-plugin</artifactId>
+        <version>1.3.6</version>
+        <configuration>
+          <!-- 是否覆盖,true表示会替换生成的JAVA文件,false则不覆盖 -->
+          <overwrite>true</overwrite>
+        </configuration>
+        <dependencies>
+          <!--mysql驱动包-->
+          <dependency>
+            <groupId>mysql</groupId>
+            <artifactId>mysql-connector-java</artifactId>
+            <version>5.1.45</version>
+          </dependency>
+        </dependencies>
+      </plugin>
+      <plugin>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-maven-plugin</artifactId>
+      </plugin>
+    </plugins>
+    <resources>
+      <!-- 解决MyBatis配置文件引入问题 -->
+      <resource>
+        <directory>src/main/java</directory>
+        <includes>
+          <include>**/*.properties</include>
+          <include>**/*.xml</include>
+        </includes>
+        <!-- 是否替换资源中的属性-->
+        <filtering>true</filtering>
+      </resource>
+      <resource>
+        <directory>src/main/resources</directory>
+        <filtering>true</filtering>
+      </resource>
+    </resources>
+  </build>
+
+  <profiles>
+    <profile>
+      <id>dev</id>
+      <properties>
+        <!-- 环境标识,需要与配置文件的名称相对应 -->
+        <activatedProperties>dev</activatedProperties>
+      </properties>
+      <activation>
+        <!-- 默认环境 -->
+        <activeByDefault>true</activeByDefault>
+      </activation>
+    </profile>
+    <profile>
+      <id>test</id>
+      <properties>
+        <activatedProperties>test</activatedProperties>
+      </properties>
+    </profile>
+    <profile>
+      <id>prod</id>
+      <properties>
+        <activatedProperties>prod</activatedProperties>
+      </properties>
+    </profile>
+  </profiles>
+</project>

+ 23 - 0
module-callback/src/main/java/cn/com/ctop/callback/StartApplication.java

@@ -0,0 +1,23 @@
+package cn.com.ctop.callback;
+import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure;
+import com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DynamicDataSourceAutoConfiguration;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.shiro.spring.boot.autoconfigure.ShiroAnnotationProcessorAutoConfiguration;
+import org.apache.shiro.spring.boot.autoconfigure.ShiroAutoConfiguration;
+import org.apache.shiro.spring.boot.autoconfigure.ShiroBeanAutoConfiguration;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.Configuration;
+
+
+@Slf4j
+@SpringBootApplication(exclude = {DynamicDataSourceAutoConfiguration.class,DruidDataSourceAutoConfigure.class,DataSourceAutoConfiguration.class,ShiroAnnotationProcessorAutoConfiguration.class, ShiroAutoConfiguration.class, ShiroBeanAutoConfiguration.class})
+@ComponentScan(basePackages = {"cn.com.ctop.callback"})
+@Configuration
+public class StartApplication {
+    public static void main(String[] args){
+        SpringApplication.run(StartApplication.class, args);
+    }
+}

+ 29 - 0
module-callback/src/main/java/cn/com/ctop/callback/config/XxlMqConf.java

@@ -0,0 +1,29 @@
+package cn.com.ctop.callback.config;
+
+import com.xxl.mq.client.factory.impl.XxlMqSpringClientFactory;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Bean;
+import org.springframework.stereotype.Component;
+
+@Component
+public class XxlMqConf {
+
+    // ---------------------- param ----------------------
+
+    @Value("${xxl.mq.admin.address}")
+    private String adminAddress;
+    @Value("${xxl.mq.accessToken}")
+    private String accessToken;
+
+
+    @Bean
+    public XxlMqSpringClientFactory getXxlMqConsumer(){
+
+        XxlMqSpringClientFactory xxlMqSpringClientFactory = new XxlMqSpringClientFactory();
+        xxlMqSpringClientFactory.setAdminAddress(adminAddress);
+        xxlMqSpringClientFactory.setAccessToken(accessToken);
+
+        return xxlMqSpringClientFactory;
+    }
+
+}

+ 28 - 0
module-callback/src/main/java/cn/com/ctop/callback/controller/CallbackController.java

@@ -0,0 +1,28 @@
+package cn.com.ctop.callback.controller;
+
+import com.xxl.mq.client.message.XxlMqMessage;
+import com.xxl.mq.client.producer.XxlMqProducer;
+import org.jeecg.common.api.vo.Result;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+@Controller
+@RequestMapping("/")
+public class CallbackController {
+    @RequestMapping("/{group}/{topic}")
+    @ResponseBody
+    public Result<String> callbackMethod(HttpServletRequest request,
+                                         HttpServletResponse response,
+                                         @PathVariable(name = "group") String group,
+                                         @PathVariable(name = "topic") String topic){
+        Result<String> result = new Result<>();
+        XxlMqProducer.produce(new XxlMqMessage(group+"_"+topic, request.getQueryString()));
+        result.success("success");
+        return result;
+    }
+}

+ 13 - 0
module-callback/src/main/resources/application-dev.yml

@@ -0,0 +1,13 @@
+server:
+  port: 8801
+  servlet:
+    context-path: /
+xxl:
+  mq:
+    accessToken:
+    admin:
+      address: http://129.28.150.229:8808/xxl-mq-admin
+logging:
+  level:
+    root: info
+  config: classpath:logback-dev.xml

+ 13 - 0
module-callback/src/main/resources/application-prod.yml

@@ -0,0 +1,13 @@
+server:
+  port: 8801
+  servlet:
+    context-path: /
+xxl:
+  mq:
+    accessToken:
+    admin:
+      address: http://129.28.150.229:8808/xxl-mq-admin
+logging:
+  level:
+    root: info
+  config: classpath:logback-prod.xml

+ 13 - 0
module-callback/src/main/resources/application-test.yml

@@ -0,0 +1,13 @@
+server:
+  port: 8801
+  servlet:
+    context-path: /
+xxl:
+  mq:
+    accessToken:
+    admin:
+      address: http://129.28.150.229:8808/xxl-mq-admin
+logging:
+  level:
+    root: info
+  config: classpath:logback-test.xml

+ 8 - 0
module-callback/src/main/resources/application.yml

@@ -0,0 +1,8 @@
+server:
+  port: 8801
+  context-path: /
+xxl:
+  mq:
+    accessToken:
+    admin:
+      address: http://129.28.150.229:8808/xxl-mq-admin

+ 29 - 0
module-callback/src/main/resources/logback-dev.xml

@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configuration debug="false" scan="true" scanPeriod="1 seconds">
+
+    <contextName>logback</contextName>
+    <property name="log.path" value="/data/applogs/xxl-mq/xxl-mq-samples-springboot.log"/>
+
+    <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
+        <encoder>
+            <pattern>%d{HH:mm:ss.SSS} %contextName [%thread] %-5level %logger{36} - %msg%n</pattern>
+        </encoder>
+    </appender>
+
+    <appender name="file" class="ch.qos.logback.core.rolling.RollingFileAppender">
+        <file>${log.path}</file>
+        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+            <fileNamePattern>${log.path}.%d{yyyy-MM-dd}.zip</fileNamePattern>
+        </rollingPolicy>
+        <encoder>
+            <pattern>%date %level [%thread] %logger{36} [%file : %line] %msg%n
+            </pattern>
+        </encoder>
+    </appender>
+
+    <root level="info">
+        <appender-ref ref="console"/>
+        <appender-ref ref="file"/>
+    </root>
+
+</configuration>

+ 29 - 0
module-callback/src/main/resources/logback-prod.xml

@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configuration debug="false" scan="true" scanPeriod="1 seconds">
+
+    <contextName>logback</contextName>
+    <property name="log.path" value="/data/applogs/xxl-mq/xxl-mq-samples-springboot.log"/>
+
+    <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
+        <encoder>
+            <pattern>%d{HH:mm:ss.SSS} %contextName [%thread] %-5level %logger{36} - %msg%n</pattern>
+        </encoder>
+    </appender>
+
+    <appender name="file" class="ch.qos.logback.core.rolling.RollingFileAppender">
+        <file>${log.path}</file>
+        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+            <fileNamePattern>${log.path}.%d{yyyy-MM-dd}.zip</fileNamePattern>
+        </rollingPolicy>
+        <encoder>
+            <pattern>%date %level [%thread] %logger{36} [%file : %line] %msg%n
+            </pattern>
+        </encoder>
+    </appender>
+
+    <root level="info">
+        <appender-ref ref="console"/>
+        <appender-ref ref="file"/>
+    </root>
+
+</configuration>

+ 29 - 0
module-callback/src/main/resources/logback-test.xml

@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configuration debug="false" scan="true" scanPeriod="1 seconds">
+
+    <contextName>logback</contextName>
+    <property name="log.path" value="/data/applogs/xxl-mq/xxl-mq-samples-springboot.log"/>
+
+    <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
+        <encoder>
+            <pattern>%d{HH:mm:ss.SSS} %contextName [%thread] %-5level %logger{36} - %msg%n</pattern>
+        </encoder>
+    </appender>
+
+    <appender name="file" class="ch.qos.logback.core.rolling.RollingFileAppender">
+        <file>${log.path}</file>
+        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+            <fileNamePattern>${log.path}.%d{yyyy-MM-dd}.zip</fileNamePattern>
+        </rollingPolicy>
+        <encoder>
+            <pattern>%date %level [%thread] %logger{36} [%file : %line] %msg%n
+            </pattern>
+        </encoder>
+    </appender>
+
+    <root level="info">
+        <appender-ref ref="console"/>
+        <appender-ref ref="file"/>
+    </root>
+
+</configuration>

+ 20 - 0
module-callback/src/test/java/org/jeecgframework/boot/AppTest.java

@@ -0,0 +1,20 @@
+package org.jeecgframework.boot;
+
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+/**
+ * Unit test for simple App.
+ */
+public class AppTest 
+{
+    /**
+     * Rigorous Test :-)
+     */
+    @Test
+    public void shouldAnswerWithTrue()
+    {
+        assertTrue( true );
+    }
+}

+ 1 - 1
module-common/src/main/java/cn/com/ctop/common/module/service/impl/IpPoolServiceImpl.java

@@ -34,7 +34,7 @@ public class IpPoolServiceImpl extends ServiceImpl<IpPoolMapper, IpPool> impleme
         queryWrapper.orderByAsc("last_use_time");
         IpPool ipPool = this.getOne(queryWrapper);
         if (ipPool == null) {
-            syncIpPool();
+            return null;
         } else {
             ipPool.setLastUseTime(new Date());
             this.updateById(ipPool);

+ 213 - 0
module-common/src/main/java/cn/com/ctop/common/module/utils/HttpUtils.java

@@ -419,6 +419,74 @@ public class HttpUtils {
         return strReturn;
     }
 
+    public static void main(String[] args){
+        String res = HttpUtils.getKuaishouShareUrl("http://yongzhou.s.gifshow.com/i/photo/lwx?userId=1400097524&photoId=5191805968879099278");
+        String path = res.split("\\?")[0];
+        String photoId = path.substring(path.lastIndexOf("/")+1,path.length());
+        path =path.substring(0,path.lastIndexOf("/"));
+        String uid = path.substring(path.lastIndexOf("/")+1,path.length());
+        System.out.println(uid);
+        System.out.println(photoId);
+        res = HttpUtils.postKuaishouVideoUrl("https://live.kuaishou.com/m_graphql",uid,photoId);
+        System.out.println(res);
+    }
+
+    public static String postKuaishouVideoUrl(String url,String uid,String photoId){
+        HttpClient httpClient = createSslClientDefault();
+        String strReturn = "";
+        String paramBody = "{\"operationName\":\"FeedQuery\",\"variables\":{\"principalId\":\""+uid+"\",\"photoId\":\""+photoId+"\"},\"query\":\"query FeedQuery($principalId: String, $photoId: String) {\\n  feedById(principalId: $principalId, photoId: $photoId) {\\n    currentWork {\\n                 timestamp\\n           __typename\\n    }\\n       __typename\\n  }\\n}\\n\"}";
+        try {
+            HttpPost httppost = new HttpPost(url);
+            httppost.setHeader("User-Agent", USER_AGENT);
+            httppost.addHeader("Content-Type", "application/json");
+//            for (String key : headers.keySet()) {
+//                httppost.setHeader(key, headers.get(key));
+//            }
+            httppost.setEntity(new StringEntity(paramBody, Charset.forName("UTF-8")));
+            HttpEntity respentity;
+
+            HttpResponse response = httpClient.execute(httppost);
+            int statusCode = response.getStatusLine().getStatusCode();
+
+            respentity = response.getEntity();
+            strReturn = EntityUtils.toString(respentity);
+            return strReturn;
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error(e.getMessage());
+        }
+        return strReturn;
+    }
+    public static String getKuaishouShareUrl(String url){
+        HttpClient httpClient = HttpClientBuilder.create().build();
+        HttpResponse response = null;
+        HttpGet httpGet = new HttpGet(url);
+        httpGet.setConfig(RequestConfig.custom().setRedirectsEnabled(false).build());
+        String result = null;
+        try {
+            httpGet.setHeader("User-Agent", USER_AGENT);
+            httpGet.setHeader("Accept-Encoding", "gzip, deflate, br");
+            httpGet.setHeader("Connection", "keep-alive");
+            httpGet.setHeader("Host", "yongzhou.s.gifshow.com");
+            httpGet.setHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3");
+            httpGet.setHeader("Upgrade-Insecure-Requests", "1");
+            httpGet.setHeader("Accept-Language", "zh-CN,zh;q=0.9");
+            response = httpClient.execute(httpGet);
+            int statusCode = response.getStatusLine().getStatusCode();
+            System.out.println(statusCode);
+            if (statusCode == HttpStatus.SC_MOVED_PERMANENTLY || statusCode == HttpStatus.SC_MOVED_TEMPORARILY) {
+                String newUrl = response.getFirstHeader("Location").getValue();
+                System.out.println(newUrl);
+                return newUrl;
+            }
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return result;
+    }
+
     public static String httpGetRequest(String url) {
         HttpClient httpClient = createSslClientDefault();
         HttpResponse response = null;
@@ -428,8 +496,10 @@ public class HttpUtils {
             httpGet.setHeader("User-Agent", USER_AGENT);
             response = httpClient.execute(httpGet);
             int statusCode = response.getStatusLine().getStatusCode();
+            System.out.println(statusCode);
             if (statusCode == HttpStatus.SC_MOVED_PERMANENTLY || statusCode == HttpStatus.SC_MOVED_TEMPORARILY) {
                 String newUrl = response.getFirstHeader("Location").getValue();
+                System.out.println(newUrl);
                 return httpGetRequest(newUrl);
             } else if (statusCode == HttpStatus.SC_OK) {
                 BufferedReader reader = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
@@ -793,4 +863,147 @@ public class HttpUtils {
         }
         return strReturn;
     }
+
+    public static JSONObject feishuGetRequest(String url, JSONObject params){
+        return feishuGetRequest(null,url,params);
+    }
+    public static JSONObject feishuPostRequest(String url,JSONObject params){
+        return feishuPostRequest(null,url,params);
+    }
+
+    public static String feishuGetRequestString(String url) {
+        // 构造请求
+        HttpEntityEnclosingRequestBase httpEntity = new HttpEntityEnclosingRequestBase() {
+            @Override
+            public String getMethod() {
+                return "GET";
+            }
+        };
+        CloseableHttpResponse response = null;
+        CloseableHttpClient client = null;
+        try {
+            client = HttpClientBuilder.create().build();
+            httpEntity.setURI(URI.create(url));
+            RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(12000).setConnectTimeout(12000).build();
+            httpEntity.setConfig(requestConfig);
+            response = client.execute(httpEntity);
+            if (response != null && response.getStatusLine().getStatusCode() == 200) {
+                BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
+                StringBuilder result = new StringBuilder();
+                String line = "";
+                while ((line = bufferedReader.readLine()) != null) {
+                    result.append(line);
+                }
+                bufferedReader.close();
+                return result.toString();
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                if (response != null) {
+                    response.close();
+                }
+                if (client != null) {
+                    client.close();
+                }
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+        return null;
+    }
+
+    public static JSONObject feishuGetRequest(String accessToken, String url, JSONObject params) {
+        System.out.println(url);
+        // 构造请求
+        HttpEntityEnclosingRequestBase httpEntity = new HttpEntityEnclosingRequestBase() {
+            @Override
+            public String getMethod() {
+                return "GET";
+            }
+        };
+        if(accessToken != null){
+            httpEntity.setHeader("Authorization", accessToken);
+        }
+        CloseableHttpResponse response = null;
+        CloseableHttpClient client = null;
+        try {
+            client = HttpClientBuilder.create().build();
+            httpEntity.setURI(URI.create(url));
+            if (params != null){
+                httpEntity.setEntity(new StringEntity(params.toJSONString(), ContentType.APPLICATION_JSON));
+            }
+            RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(12000).setConnectTimeout(12000).build();
+            httpEntity.setConfig(requestConfig);
+            response = client.execute(httpEntity);
+            if (response != null && response.getStatusLine().getStatusCode() == 200) {
+                BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
+                StringBuilder result = new StringBuilder();
+                String line = "";
+                while ((line = bufferedReader.readLine()) != null) {
+                    result.append(line);
+                }
+                bufferedReader.close();
+                return JSONObject.parseObject(result.toString());
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                if (response != null) {
+                    response.close();
+                }
+                if (client != null) {
+                    client.close();
+                }
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+        return null;
+    }
+
+
+
+    public static JSONObject feishuPostRequest(String accessToken, String url, JSONObject params) {
+        // 构造请求
+        HttpPost httpEntity = new HttpPost(url);
+        if(accessToken != null){
+            httpEntity.setHeader("Authorization", accessToken);
+        }
+        CloseableHttpResponse response = null;
+        CloseableHttpClient client = null;
+        try {
+            client = HttpClientBuilder.create().build();
+            httpEntity.setEntity(new StringEntity(params.toJSONString(), ContentType.APPLICATION_JSON));
+            RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(12000).setConnectTimeout(12000).build();
+            httpEntity.setConfig(requestConfig);
+            response = client.execute(httpEntity);
+            if (response != null && response.getStatusLine().getStatusCode() == 200) {
+                BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
+                StringBuilder result = new StringBuilder();
+                String line = "";
+                while ((line = bufferedReader.readLine()) != null) {
+                    result.append(line);
+                }
+                bufferedReader.close();
+                return JSONObject.parseObject(result.toString());
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                if (response != null) {
+                    response.close();
+                }
+                if (client != null) {
+                    client.close();
+                }
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+        return null;
+    }
 }

+ 3 - 5
module-common/src/main/java/cn/com/ctop/common/module/utils/PropertiesUtils.java

@@ -15,15 +15,13 @@ import java.util.Properties;
  */
 public class PropertiesUtils {
     private static final Logger log = LoggerFactory.getLogger(PropertiesUtils.class);
-    private static Map<String, String> cache = new HashMap<String, String>();
-
+    private static Map<String, String> cache = new HashMap<>();
     public static String getConfig(String key) {
         return getValue("kuaishou_config", key);
     }
-
     public static String getValue(String name, String key) {
         try {
-            String cacheValue = (String) cache.get(name + key);
+            String cacheValue = cache.get(name + key);
             if (cacheValue != null) {
                 return cacheValue;
             }
@@ -49,7 +47,7 @@ public class PropertiesUtils {
                     + name + ".properties");
             props.load(in);
             Iterator<Object> it = props.keySet().iterator();
-            Map<String, String> map = new HashMap<String, String>();
+            Map<String, String> map = new HashMap<>();
             while (it.hasNext()) {
                 String key = it.next().toString();
                 String value = props.getProperty(key);

+ 13 - 0
module-common/src/main/java/cn/com/ctop/common/module/utils/RandomUtil.java

@@ -18,6 +18,19 @@ public class RandomUtil {
     }
 
 
+    public static String verifyCodeV2() {
+
+        char[] c = charArray();//获取包含26个字母大小写和数字的字符数组
+
+        Random rd = new Random();
+        String code = "";
+        for (int k = 0; k < 4; k++) {
+            int index = rd.nextInt(c.length);//随机获取数组长度作为索引
+            code += c[index];//循环添加到字符串后面
+        }
+        return code;
+    }
+
     private static char[] charArray() {
         int i = 1234567890;
         String s = "qwertyuiopasdfghjklzxcvbnm";

+ 7 - 6
feishu-sdk/src/main/java/cn/feishu/sdk/common/ApiConstant.java

@@ -1,11 +1,10 @@
-package cn.feishu.sdk.common;
+package cn.com.feishu.constant;
 
-import cn.feishu.sdk.util.PropertiesUtils;
 
-public class ApiConstant {
-    public static final String FEISHU_API_URL = PropertiesUtils.getConfig("feishu_api_url");
-    public static final String FEISHU_APP_ID = PropertiesUtils.getConfig("feishu_app_id");
-    public static final String FEISHU_APP_SECRET = PropertiesUtils.getConfig("feishu_app_secret");
+public class FeishuConstant {
+    public static final String FEISHU_API_URL = "https://open.feishu.cn/open-apis";
+    public static final String FEISHU_APP_ID = "cli_9e68af69ca34d00e";
+    public static final String FEISHU_APP_SECRET = "0RsCBRCLx1rG8HKfeZNeAbddxZ3Rsnwv";
     public static final String APP_ACCESS_TOKEN = "/auth/v3/app_access_token/internal/";
     public static final String TENANT_ACCESS_TOKEN = "/auth/v3/tenant_access_token/internal/";
     public static final String AUTH_INDEX = "/authen/v1/index";
@@ -15,4 +14,6 @@ public class ApiConstant {
     public static final String MESSAGE_BATCH_SEND = "/message/v4/batch_send/";
     public static final String MESSAGE_SEND = "/message/v4/send/";
     public static final String NOTIFY_SEND = "/notify/v4/appnotify";
+    public static final String REDIRECT_URL = "http://adsp.tjyourong.com.cn/jeecg-boot/sys/feishu/auth";
+//    public static final String REDIRECT_URL = "http://192.168.0.111:8088/jeecg-boot/sys/feishu/auth";
 }

+ 87 - 0
module-common/src/main/java/cn/com/feishu/provider/AuthProvider.java

@@ -0,0 +1,87 @@
+package cn.com.feishu.provider;
+
+import cn.com.ctop.common.module.utils.HttpUtils;
+import cn.com.feishu.constant.FeishuConstant;
+import com.alibaba.fastjson.JSONObject;
+
+import java.io.UnsupportedEncodingException;
+import java.net.MalformedURLException;
+import java.net.URLEncoder;
+
+public class AuthProvider {
+    /**
+     *  获取授权url
+     * @param state
+     * @return
+     * @throws UnsupportedEncodingException
+     * @throws MalformedURLException
+     */
+    public static String getAuthUrl(String state) throws UnsupportedEncodingException {
+        String redirectUrl = FeishuConstant.REDIRECT_URL;
+        return FeishuConstant.FEISHU_API_URL+FeishuConstant.AUTH_INDEX+"?redirect_uri="+ URLEncoder.encode(redirectUrl,"UTF-8")+"&app_id="+FeishuConstant.FEISHU_APP_ID+"&state="+state;
+    }
+
+    /**
+     * 根据code获取用户登录信息
+     * @param code
+     * @return
+     * @throws Exception
+     */
+    public static JSONObject getFeishuUserInfo(String code) throws Exception {
+        JSONObject params = new JSONObject();
+        params.put("app_access_token",getAppAccessToken());
+        params.put("grant_type","authorization_code");
+        params.put("code",code);
+        return HttpUtils.feishuPostRequest(FeishuConstant.FEISHU_API_URL+FeishuConstant.AUTH_ACCESS_TOKEN,params);
+    }
+
+    public static JSONObject refreshAccessToken(String refreshToken) throws Exception{
+        JSONObject params = new JSONObject();
+        params.put("app_access_token",getAppAccessToken());
+        params.put("grant_type","refresh_token");
+        params.put("refresh_token",refreshToken);
+        return HttpUtils.feishuPostRequest(FeishuConstant.FEISHU_API_URL+FeishuConstant.REFRESH_AUTH_ACCESS_TOKEN,params);
+    }
+
+    public static JSONObject getUserInfo(String accessToken){
+        JSONObject params = new JSONObject();
+        params.put("user_access_token",accessToken);
+        return HttpUtils.feishuGetRequest("Bearer "+accessToken,FeishuConstant.FEISHU_API_URL+FeishuConstant.USER_INFO,params);
+    }
+
+    /**
+     * 获取企业自建应用token信息
+     * 调用接口获取应用资源时使用
+     * @return
+     * @throws Exception
+     */
+    public static String getAppAccessToken() throws Exception {
+        JSONObject params = new JSONObject();
+        params.put("app_id",FeishuConstant.FEISHU_APP_ID);
+        params.put("app_secret",FeishuConstant.FEISHU_APP_SECRET);
+        JSONObject resultNode = HttpUtils.feishuPostRequest(FeishuConstant.FEISHU_API_URL+FeishuConstant.APP_ACCESS_TOKEN,params);
+        if (resultNode.getIntValue("code")==0){
+            return resultNode.getString("app_access_token");
+        }else {
+            throw new Exception();
+        }
+    }
+
+    /**
+     * 获取企业自建应用租户token
+     * 调用接口获取企业资源时使用
+     * @return
+     * @throws Exception
+     */
+    public static String getTenantAccessToken() throws Exception {
+        JSONObject params = new JSONObject();
+        params.put("app_id",FeishuConstant.FEISHU_APP_ID);
+        params.put("app_secret",FeishuConstant.FEISHU_APP_SECRET);
+        JSONObject resultNode = HttpUtils.feishuPostRequest(FeishuConstant.FEISHU_API_URL+FeishuConstant.TENANT_ACCESS_TOKEN,params);
+        if (resultNode.getIntValue("code")==0){
+            return resultNode.getString("tenant_access_token");
+        }else {
+            throw new Exception();
+        }
+    }
+}

+ 5 - 6
feishu-sdk/src/main/java/cn/feishu/sdk/provider/MessageProvider.java

@@ -1,15 +1,14 @@
-package cn.feishu.sdk.provider;
+package cn.com.feishu.provider;
 
-import cn.feishu.sdk.common.ApiConstant;
-import cn.feishu.sdk.util.HttpUtil;
+import cn.com.ctop.common.module.utils.HttpUtils;
+import cn.com.feishu.constant.FeishuConstant;
 import com.alibaba.fastjson.JSONObject;
 
 import java.util.List;
 
 public class MessageProvider {
     public JSONObject batchSend(List<String> departmentIds,List<String> openIds,List<String> userIds,String content) throws Exception {
-        AuthProvider authProvider = new AuthProvider();
-        String tenantAccessToken = authProvider.getTenantAccessToken();
+        String tenantAccessToken = AuthProvider.getTenantAccessToken();
         JSONObject contentJson = new JSONObject();
         contentJson.put("text",content);
         JSONObject params = new JSONObject();
@@ -18,7 +17,7 @@ public class MessageProvider {
         params.put("user_ids",userIds);
         params.put("msg_type","text");
         params.put("content",contentJson);
-        return HttpUtil.feishuPostRequest("Bearer"+tenantAccessToken, ApiConstant.FEISHU_API_URL+ApiConstant.MESSAGE_BATCH_SEND,params);
+        return HttpUtils.feishuPostRequest("Bearer"+tenantAccessToken, FeishuConstant.FEISHU_API_URL+FeishuConstant.MESSAGE_BATCH_SEND,params);
     }
 
 

+ 2 - 0
module-ctop/src/main/java/cn/com/ctop/manage/modules/material/service/impl/MaterialUploadServiceImpl.java

@@ -35,6 +35,7 @@ import org.springframework.util.MultiValueMap;
 import org.springframework.web.client.RestTemplate;
 
 import java.io.File;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.concurrent.ExecutorService;
@@ -224,6 +225,7 @@ public class MaterialUploadServiceImpl implements IMaterialUploadService {
                                             String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
                                             videoGet.setStatDate(DateUtils.parseDate(nowDate, "yyyy-MM-dd"));
                                             videoGet.setCoverUrl(materialInfo.getUrl() + "?x-oss-process=video/snapshot,t_10000,m_fast");
+                                            videoGet.setUploadDate(new Date());
                                             kuaiShouVideoGetService.saveOrUpdate(videoGet);
                                             materialUploadImageService.uploadImage(videoGet.getSignature(), accountId, ctopOauthToken.getAccessToken());
 

+ 78 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/BatchController.java

@@ -1798,6 +1798,84 @@ public class BatchController {
         return result;
     }
 
+
+    /**
+     * 复制组
+     *
+     * @param requestJson
+     * @return
+     */
+/*    @PostMapping(value = "/copyUnitUpdate")
+    public Result<JSONObject> copyUnitUpdate(@RequestBody JSONObject requestJson) {
+        Result<JSONObject> result = new Result<>();
+        try {
+            Long accountId = requestJson.getLong("accountId");
+            CtopOauthToken oauthToken = oauthTokenService.getTokenByAccountId(accountId);
+            if (Check.isNull(oauthToken)) {
+                throw new Exception("未获取到账户信息");
+            }
+            JSONObject returnJson = new JSONObject();
+
+            Long unitId = requestJson.getLong("unitId");
+            kuaiShouGroupService.getGroupByUnitId(oauthToken.getAccessToken(), oauthToken.getAccountId(), unitId);
+            Long copyToCampaignId = requestJson.getLong("copyToCampaignId");
+            JSONArray failArr = new JSONArray();
+            //  Integer createCount = requestJson.getInteger("createCount");
+
+
+            Integer createType = requestJson.getInteger("createType");
+            if (createType == 1) { //系统生成
+                // 需要获取创建条数
+                Integer createCount = requestJson.getInteger("createCount");
+                String unitName = requestJson.getString("unitName");
+                if (unitName.contains("#")) {
+                    int lastIndexOf = unitName.lastIndexOf("#");
+                    unitName = unitName.substring(0, lastIndexOf);
+                }
+                requestJson.remove("unitName");
+                for (int i = 0; i < createCount; i++) {
+                    String randomName = unitName + RandomUtil.verifyCodeV2() + i;
+                    requestJson.put("unitName", randomName);
+                    JSONObject createJson = batchService.createUnit(requestJson, oauthToken);
+                    if (createJson.getInteger("code") != 0) {
+                        JSONObject errJson = new JSONObject();
+                        errJson.put("message", createJson.getString("message"));
+                        returnJson.put("unitName", randomName);
+                        failArr.add(errJson);
+                    }
+                }
+
+            } else if (createType == 2) { // 自定义
+                JSONArray unitNames = requestJson.getJSONArray("unitNames");
+                for (int i = 0; i < unitNames.size(); i++) {
+                    String unitName = unitNames.getString(i);
+                    requestJson.put("unitName", unitName);
+                    JSONObject createJson = batchService.createUnit(requestJson, oauthToken);
+                    if (createJson.getInteger("code") != 0) {
+                        JSONObject errJson = new JSONObject();
+                        errJson.put("message", createJson.getString("message"));
+                        returnJson.put("unitName", unitName);
+                        failArr.add(errJson);
+                    }
+
+                }
+            }
+
+
+            returnJson.put("failCount", failArr.size());
+            returnJson.put("failInfo", failArr);
+            result.setResult(returnJson);
+            result.setSuccess(true);
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            result.setSuccess(false);
+            result.setMessage(e.getMessage());
+        }
+        return result;
+    }*/
+
+
     /**
      * 获取人群包
      *

+ 1 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/KuaiShouVideoGet.java

@@ -75,6 +75,7 @@ public class KuaiShouVideoGet {
     private String signature;
 
     private Date statDate;
+    private Date  uploadDate;
 
 
     private Integer materialType;

+ 9 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaiShouVideoTimeService.java

@@ -0,0 +1,9 @@
+package cn.com.ctop.kuaishou.modules.batch.service;
+
+
+public interface IKuaiShouVideoTimeService {
+
+    java.util.Date getVideoTime(String photoId, Long accountId);
+
+
+}

+ 2 - 2
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaishouInterfaceService.java

@@ -126,7 +126,7 @@ public interface IKuaishouInterfaceService {
      * @param requestJson
      * @return
      */
-    Map<String, Object> adUnitCreate(String accessToken, Long advertiserId, JSONObject requestJson);
+    Map<String, Object> adUnitCreate(String accessToken, Long advertiserId, JSONObject requestJson, Integer count);
 
 
     /**
@@ -191,7 +191,7 @@ public interface IKuaishouInterfaceService {
      * @param advertiserId
      * @param requestJson
      */
-    Map<String, Object> creativeCreate(String accessToken, Long advertiserId, JSONObject requestJson);
+    Map<String, Object> creativeCreate(String accessToken, Long advertiserId, JSONObject requestJson, Integer count);
 
     /**
      * 根据创意id 获取创意信息

+ 5 - 4
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/BatchServiceImpl.java

@@ -404,7 +404,7 @@ public class BatchServiceImpl implements IBatchService {
                     unitJson.put("unit_name", unitName);
                 }
 
-                Map<String, Object> returnUnitMap = kuaishouInterfaceService.adUnitCreate(oauthToken.getAccessToken(), oauthToken.getAccountId(), unitJson);
+                Map<String, Object> returnUnitMap = kuaishouInterfaceService.adUnitCreate(oauthToken.getAccessToken(), oauthToken.getAccountId(), unitJson,1);
                 if (!Check.isNullMap(returnUnitMap)) {
                     Integer code = (Integer) returnUnitMap.get("code");
                     if (code == 0) {
@@ -683,7 +683,7 @@ public class BatchServiceImpl implements IBatchService {
                     unitJson.put("unit_name", unitName);
                 }
 
-                Map<String, Object> returnUnitMap = kuaishouInterfaceService.adUnitCreate(oauthToken.getAccessToken(), group.getAccountId(), unitJson);
+                Map<String, Object> returnUnitMap = kuaishouInterfaceService.adUnitCreate(oauthToken.getAccessToken(), group.getAccountId(), unitJson,1);
                 if (!Check.isNullMap(returnUnitMap)) {
                     Integer code = (Integer) returnUnitMap.get("code");
                     if (code == 0) {
@@ -786,7 +786,7 @@ public class BatchServiceImpl implements IBatchService {
                 }*/
 
 
-                Map<String, Object> returnCreativeMap = kuaishouInterfaceService.creativeCreate(oauthToken.getAccessToken(), accountId, creativeJson);
+                Map<String, Object> returnCreativeMap = kuaishouInterfaceService.creativeCreate(oauthToken.getAccessToken(), accountId, creativeJson,1);
                 if (!Check.isNullMap(returnCreativeMap)) {
                     Integer code = (Integer) returnCreativeMap.get("code");
                     if (code == 0) {
@@ -804,6 +804,7 @@ public class BatchServiceImpl implements IBatchService {
         }
     }
 
+
     /**
      * 获取广告组信息
      *
@@ -907,7 +908,7 @@ public class BatchServiceImpl implements IBatchService {
                                     }
                                 }
                                 creativeJson.put("image_token", imageToken);
-                                Map<String, Object> returnUnitMap = kuaishouInterfaceService.creativeCreate(oauthToken.getAccessToken(), accountId, creativeJson);
+                                Map<String, Object> returnUnitMap = kuaishouInterfaceService.creativeCreate(oauthToken.getAccessToken(), accountId, creativeJson,1);
                                 if (!Check.isNullMap(returnUnitMap)) {
                                     Integer code = (Integer) returnUnitMap.get("code");
                                     if (code == 0) {

+ 6 - 6
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouCreateServiceImpl.java

@@ -1,5 +1,7 @@
 package cn.com.ctop.kuaishou.modules.batch.service.impl;
 
+import cn.com.ctop.common.module.entity.CtopOauthToken;
+import cn.com.ctop.common.module.service.ICtopOauthTokenService;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouCampaignCreate;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouCampaignTemplate;
@@ -17,8 +19,6 @@ import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import lombok.extern.slf4j.Slf4j;
-import cn.com.ctop.common.module.entity.CtopOauthToken;
-import cn.com.ctop.common.module.service.ICtopOauthTokenService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -244,7 +244,7 @@ public class KuaiShouCreateServiceImpl implements IKuaiShouCreateService {
                     name = unitName;
                 }
                 groupJson.put("unit_name", name);
-                Map<String, Object> groupMap = kuaishouInterfaceService.adUnitCreate(accessToken, accountId, groupJson);
+                Map<String, Object> groupMap = kuaishouInterfaceService.adUnitCreate(accessToken, accountId, groupJson, 1);
                 if ((Integer) groupMap.get("code") != 0) {
                     log.error("创建广告组失败,accountId:{},unitName:{}", accountId, unitName);
                     return groupMap;
@@ -391,7 +391,7 @@ public class KuaiShouCreateServiceImpl implements IKuaiShouCreateService {
                     } else {
                         createJson.put("creative_name", creativeName + "_" + i);
                     }
-                    Map<String, Object> creativeMap = kuaishouInterfaceService.creativeCreate(accessToken, accountId, createJson);
+                    Map<String, Object> creativeMap = kuaishouInterfaceService.creativeCreate(accessToken, accountId, createJson, 1);
                     if ((Integer) creativeMap.get("code") != 0) {
                         return creativeMap;
                     }
@@ -451,7 +451,7 @@ public class KuaiShouCreateServiceImpl implements IKuaiShouCreateService {
                         } else {
                             createJson.put("creative_name", creativeName + "_" + i);
                         }
-                        Map<String, Object> creativeMap = kuaishouInterfaceService.creativeCreate(accessToken, accountId, createJson);
+                        Map<String, Object> creativeMap = kuaishouInterfaceService.creativeCreate(accessToken, accountId, createJson, 1);
                         if ((Integer) creativeMap.get("code") != 0) {
                             log.error("后贴片视频素材批量创建创意失败,accountId:{},creativeName:{}", accountId, creativeName + "_" + i);
                             return creativeMap;
@@ -492,7 +492,7 @@ public class KuaiShouCreateServiceImpl implements IKuaiShouCreateService {
                         JSONArray imageTokens = new JSONArray();
                         imageTokens.add(imageMap.get("imageToken"));
                         createJson.put("image_tokens", imageTokens);
-                        Map<String, Object> creativeMap = kuaishouInterfaceService.creativeCreate(accessToken, accountId, createJson);
+                        Map<String, Object> creativeMap = kuaishouInterfaceService.creativeCreate(accessToken, accountId, createJson, 1);
                         if ((Integer) creativeMap.get("code") != 0) {
                             log.error("后贴片素材单张图片批量创建创意失败,accountId:{}", accountId);
                             return creativeMap;

+ 64 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouVideoTimeServiceImpl.java

@@ -0,0 +1,64 @@
+package cn.com.ctop.kuaishou.modules.batch.service.impl;
+
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.common.module.utils.HttpUtils;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouVideoTimeService;
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouAgentAccount;
+import cn.com.ctop.kuaishou.modules.report.service.IKuaishouAgentAccountService;
+import com.alibaba.fastjson.JSONObject;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+
+@Slf4j
+@Service
+public class KuaiShouVideoTimeServiceImpl implements IKuaiShouVideoTimeService {
+    @Autowired
+    private IKuaishouAgentAccountService agentAccountService;
+
+    @Override
+    public java.util.Date getVideoTime(String photoId, Long accountId) {
+
+        KuaishouAgentAccount agentAccount = agentAccountService.getById(accountId);
+        if (Check.isNull(agentAccount)) {
+            log.info("未获取到userId:accountId:{}",accountId);
+            return null;
+        }
+
+        try {
+            String videoUrl = "http://yongzhou.s.gifshow.com/i/photo/lwx?userId=" + agentAccount.getUserId() + "&photoId=" + photoId;
+            String res = HttpUtils.getKuaishouShareUrl(videoUrl);
+            String path = res.split("\\?")[0];
+            String photoIdStr = path.substring(path.lastIndexOf("/") + 1, path.length());
+            path = path.substring(0, path.lastIndexOf("/"));
+            String uid = path.substring(path.lastIndexOf("/") + 1, path.length());
+            String result = HttpUtils.postKuaishouVideoUrl("https://live.kuaishou.com/m_graphql", uid, photoIdStr);
+            JSONObject resultJson = JSONObject.parseObject(result);
+            if (!Check.isNull(resultJson)) {
+                JSONObject dataJson = resultJson.getJSONObject("data");
+                if (!Check.isNull(dataJson)) {
+                    JSONObject feedById = dataJson.getJSONObject("feedById");
+                    if (!Check.isNull(feedById)) {
+                        JSONObject currentWork = feedById.getJSONObject("currentWork");
+                        if (!Check.isNull(currentWork)) {
+                            Long timestamp = currentWork.getLong("timestamp");
+                            return new java.util.Date(timestamp);
+
+                        }
+
+                    }
+
+                }
+
+            }
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error("获取时间错误");
+        }
+
+
+        return null;
+    }
+}

+ 41 - 3
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java

@@ -215,8 +215,18 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
             }
             for (int i = 0; i < details.size(); i++) {
                 var detailJson = details.getJSONObject(i);
+                KuaiShouVideoGet byId = kuaiShouVideoGetService.getById(token.getAccountId() + detailJson.getString("photo_id"));
+                if (!Check.isNull(byId)) {
+                    continue;
+                }
                 var kuaiShouVideoGet = JSONObject.toJavaObject(detailJson, KuaiShouVideoGet.class);
                 kuaiShouVideoGet.setId(token.getAccountId() + kuaiShouVideoGet.getPhotoId());
+
+                Date videoTime = videoTimeService.getVideoTime(kuaiShouVideoGet.getPhotoId(), token.getAccountId());
+                if (!Check.isNull(videoTime)) {
+                    kuaiShouVideoGet.setUploadDate(videoTime);
+                }
+
                 kuaiShouVideoGet.setAccountId(token.getAccountId());
                 kuaiShouVideoGet.setStatDate(DateUtils.parseDate(statDate, "yyyy-MM-dd"));
                 kuaiShouVideoGet.setUpdateTime(new Date());
@@ -985,7 +995,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
 
 
     @Override
-    public Map<String, Object> adUnitCreate(String accessToken, Long advertiserId, JSONObject requestJson) {
+    public Map<String, Object> adUnitCreate(String accessToken, Long advertiserId, JSONObject requestJson, Integer count) {
         Map<String, Object> returnMap = new HashMap<>();
         try {
             if (Check.isNull(requestJson)) {
@@ -1029,6 +1039,11 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
                     }
 
                 } else {
+
+                    if (code == 500000 && count <= 4) {
+
+                        adUnitCreate(accessToken, advertiserId, requestJson, count + 1);
+                    }
                     log.error("创建广告信息失败,advertiser_id:{},返回信息:{},入参:{}", advertiserId, resultJson, requestJson);
                     returnMap.put("code", -1);
                     returnMap.put("message", resultJson.getString("message"));
@@ -1036,6 +1051,10 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
                     returnMap.put("success", false);
                 }
             } else {
+                if (count <= 4) {
+                    log.info("创建组失败,重试,入参:{}", requestJson);
+                    adUnitCreate(accessToken, advertiserId, requestJson, count + 1);
+                }
                 log.error("快手创建广告计划返回内容为空,advertiser_id:{},入参:{}", advertiserId, requestJson);
                 returnMap.put("code", -1);
                 returnMap.put("message", "创建广告组异常");
@@ -1703,7 +1722,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
      * @param requestJson
      */
     @Override
-    public Map<String, Object> creativeCreate(String accessToken, Long advertiserId, JSONObject requestJson) {
+    public Map<String, Object> creativeCreate(String accessToken, Long advertiserId, JSONObject requestJson, Integer count) {
         Map<String, Object> returnMap = new HashMap<>();
         try {
             String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.AD_CREATIVE_CREATE;
@@ -1740,13 +1759,20 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
                         returnMap.put("success", true);
                     }
                 } else {
-                    log.error("创建广告创意失败,advertiser_id:{},返回信息:{},入参:{}", advertiserId, resultJson, requestJson);
+                    if (code == 500000 && count <= 4) {
+                        creativeCreate(accessToken, advertiserId, requestJson, count + 1);
+                    }
+                    log.error("创建广告创意失败,advertiser_id:{},返回信息:{},入参:{}", advertiserId, resultJson, requestJson, count + 1);
                     returnMap.put("code", -1);
                     returnMap.put("message", resultJson.getString("message"));
                     returnMap.put("desc", "创意创建失败");
                     returnMap.put("success", false);
                 }
             } else {
+                if (count <= 4) {
+                    creativeCreate(accessToken, advertiserId, requestJson, count + 1);
+                }
+
                 log.error("快手创建广告创意返回内容为空,advertiser_id:{},入参:{}", advertiserId, requestJson);
                 returnMap.put("code", -1);
                 returnMap.put("message", "上传图片异常");
@@ -2842,6 +2868,9 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
      * @param accountId
      * @param page
      */
+    @Autowired
+    private IKuaiShouVideoTimeService videoTimeService;
+
     @Override
     public void getSuZaoList(String token, Long accountId, int page) {
         String url = "https://ad.e.kuaishou.com/rest/openapi/v1/file/ad/video/su_zao/list";
@@ -2872,7 +2901,16 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
             }
             for (int i = 0; i < details.size(); i++) {
                 var detailJson = details.getJSONObject(i);
+
+                KuaiShouVideoGet byId = kuaiShouVideoGetService.getById(accountId + detailJson.getString("photo_id"));
+                if (!Check.isNull(byId)) {
+                    continue;
+                }
                 var kuaiShouVideoGet = JSONObject.toJavaObject(detailJson, KuaiShouVideoGet.class);
+                Date videoTime = videoTimeService.getVideoTime(kuaiShouVideoGet.getPhotoId(), accountId);
+                if (!Check.isNull(videoTime)) {
+                    kuaiShouVideoGet.setUploadDate(videoTime);
+                }
                 kuaiShouVideoGet.setAccountId(accountId);
                 kuaiShouVideoGet.setId(accountId + kuaiShouVideoGet.getPhotoId());
                 kuaiShouVideoGet.setCreateTime(new Date());

+ 1 - 2
pom.xml

@@ -26,8 +26,7 @@
         <module>jeecg-boot-module-system</module>
         <module>module-job-bytedance</module>
         <module>module-job-kuaishou</module>
-        <module>feishu-sdk</module>
-
+        <module>module-callback</module>
     </modules>
 
     <distributionManagement>