Bladeren bron

Merge branch 'master' into test

yumeng 5 jaren geleden
bovenliggende
commit
ad848833c2
42 gewijzigde bestanden met toevoegingen van 942 en 404 verwijderingen
  1. 101 0
      feishu-sdk/pom.xml
  2. 18 0
      feishu-sdk/src/main/java/cn/feishu/sdk/Test.java
  3. 18 0
      feishu-sdk/src/main/java/cn/feishu/sdk/common/ApiConstant.java
  4. 61 0
      feishu-sdk/src/main/java/cn/feishu/sdk/provider/AuthProvider.java
  5. 25 0
      feishu-sdk/src/main/java/cn/feishu/sdk/provider/MessageProvider.java
  6. 167 0
      feishu-sdk/src/main/java/cn/feishu/sdk/util/HttpUtil.java
  7. 62 0
      feishu-sdk/src/main/java/cn/feishu/sdk/util/PropertiesUtils.java
  8. 4 0
      feishu-sdk/src/main/resources/config.properties
  9. 8 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/CallbackController.java
  10. 7 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialInfoController.java
  11. 14 7
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/TestController.java
  12. 41 34
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/BytedanceDailyMaterialReportRetryJob.java
  13. 2 3
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouMaterialsLoadJob.java
  14. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/ProjectMemberMapper.xml
  15. 1 1
      jeecg-boot-module-system/src/main/resources/application-prod.yml
  16. 3 2
      jeecg-boot-module-system/src/main/resources/quartz.properties
  17. 0 6
      module-common/src/main/java/cn/com/ctop/common/module/entity/BindAccountLogin.java
  18. 4 5
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/CtopOauthTokenServiceImpl.java
  19. 1 6
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialInfoServiceImpl.java
  20. 0 2
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/RefreshTokenServiceImpl.java
  21. 3 0
      module-ctop/src/main/java/cn/com/ctop/manage/modules/material/service/impl/MaterialUploadImageServiceImpl.java
  22. 4 1
      module-ctop/src/main/java/cn/com/ctop/manage/modules/material/service/impl/MaterialUploadServiceImpl.java
  23. 23 0
      module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/ByteDanceRefreshTokenJob.java
  24. 10 10
      module-job-bytedance/src/main/resources/application-prod.yml
  25. 25 0
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaiShouRefreshTokenJob.java
  26. 2 2
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouMaterialsLoadJob.java
  27. 10 10
      module-job-kuaishou/src/main/resources/application-prod.yml
  28. 38 20
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/BatchController.java
  29. 1 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/KuaiShouImageGet.java
  30. 2 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/KuaiShouVideoGet.java
  31. 2 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouImageGetMapper.xml
  32. 3 3
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IBatchService.java
  33. 2 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaiShouGroupService.java
  34. 3 16
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaishouInterfaceService.java
  35. 186 179
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/BatchServiceImpl.java
  36. 30 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouGroupServiceImpl.java
  37. 6 3
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouUpdateServiceImpl.java
  38. 39 83
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java
  39. 2 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/graphql/service/impl/KuaishouWebInterfaceServiceImpl.java
  40. 12 4
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/KuaiShouYiCheReportController.java
  41. 0 2
      performance-appraisal/src/main/java/cn/com/ctop/uservideomap/controller/UserVideoMapController.java
  42. 1 0
      pom.xml

+ 101 - 0
feishu-sdk/pom.xml

@@ -0,0 +1,101 @@
+<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>

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

@@ -0,0 +1,18 @@
+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();
+        }
+    }
+}

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

@@ -0,0 +1,18 @@
+package cn.feishu.sdk.common;
+
+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 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";
+    public static final String AUTH_ACCESS_TOKEN = "/authen/v1/access_token";
+    public static final String REFRESH_AUTH_ACCESS_TOKEN = "/authen/v1/refresh_access_token";
+    public static final String USER_INFO = "/authen/v1/user_info";
+    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";
+}

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

@@ -0,0 +1,61 @@
+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();
+        }
+    }
+}

+ 25 - 0
feishu-sdk/src/main/java/cn/feishu/sdk/provider/MessageProvider.java

@@ -0,0 +1,25 @@
+package cn.feishu.sdk.provider;
+
+import cn.feishu.sdk.common.ApiConstant;
+import cn.feishu.sdk.util.HttpUtil;
+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();
+        JSONObject contentJson = new JSONObject();
+        contentJson.put("text",content);
+        JSONObject params = new JSONObject();
+        params.put("department_ids",departmentIds);
+        params.put("open_ids",openIds);
+        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);
+    }
+
+
+}

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

@@ -0,0 +1,167 @@
+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;
+    }
+}

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

@@ -0,0 +1,62 @@
+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;
+    }
+}

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

@@ -0,0 +1,4 @@
+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

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

@@ -62,7 +62,13 @@ 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,
@@ -354,7 +360,7 @@ public class CallbackController {
             }
 
             returnMap.put("code", 0);
-            returnMap.put("desc", text);
+            returnMap.put("desc", text.toString());
 
         } catch (Exception e) {
             e.printStackTrace();

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

@@ -165,6 +165,8 @@ public class MaterialInfoController {
                                                      HttpServletRequest req) {
 
         Result<IPage<MaterialInfo>> result = new Result<>();
+        String materialName = materialInfo.getMaterialName();
+        materialInfo.setMaterialName(null);
         QueryWrapper<MaterialInfo> queryWrapper = new QueryWrapper<>();
         Object createTime = materialInfo.getCreateTime();
         materialInfo.setCreateTime(null);
@@ -201,6 +203,10 @@ public class MaterialInfoController {
                 }
             }
         }
+        if (!Check.isNull(materialName)) {
+            queryWrapper.like("material_name", materialName);
+
+        }
         Page<MaterialInfo> page = new Page<>(pageNo, pageSize);
         IPage<MaterialInfo> pageList = materialInfoService.page(page, queryWrapper);
         List<MaterialInfo> materialInfoList = pageList.getRecords();
@@ -494,7 +500,7 @@ public class MaterialInfoController {
         Object createTime = materialInfo.getCreateTime();
         materialInfo.setCreateTime(null);
         Long projectId = materialInfo.getProjectId();
-        if(projectId != null){
+        if (projectId != null) {
             queryWrapper.eq("project_id", projectId);
         }
         queryWrapper.in("code", effiList);

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

@@ -139,12 +139,9 @@ public class TestController {
 
         try {
 
-
             Thread thread = new Thread() {
                 @Override
                 public void run() {
-
-
                     QueryWrapper<CtopOauthToken> tokenQueryWrapper = new QueryWrapper<>();
                     tokenQueryWrapper.eq("media_id", 2);
                     List<CtopOauthToken> list = tokenService.list(tokenQueryWrapper);
@@ -155,10 +152,20 @@ public class TestController {
                             @Override
                             public void run() {
                                 try {
-                                    //获取全量视频素材数据
-                                    kuaishouInterfaceService.getVideoList(token, null, null);
-                                    // 获取图片信息数据
-                                    //   kuaishouInterfaceService.getImageList(token, startDate, endDate);
+                                    kuaishouInterfaceService.getSuZaoList(token.getAccessToken(), token.getAccountId(), 1);
+                                    String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
+                                    String videoEndDate = DateUtils.addDay(nowDate, -180);
+                                    SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+                                    Date end = simpleDateFormat.parse(nowDate);
+                                    Date start = simpleDateFormat.parse(videoEndDate);
+                                    List<Date> dates = DateUtils.findDates(start, end);
+                                    for (int i = 0; i < dates.size(); i++) {
+                                        String formatDate = simpleDateFormat.format(dates.get(i));
+                                        kuaishouInterfaceService.getVideoList(token, formatDate);
+                                        kuaishouInterfaceService.getImageList(token, formatDate);
+                                        Thread.sleep(500);
+                                    }
+
                                 } catch (Exception e) {
                                     e.printStackTrace();
                                 } finally {

+ 41 - 34
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/BytedanceDailyMaterialReportRetryJob.java

@@ -33,43 +33,50 @@ public class BytedanceDailyMaterialReportRetryJob implements Job {
     @Override
     public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
         log.info("头条素材报表重试定时任务开始");
-        List<BytedanceReportMaterialRetry> retryList = bytedanceReportService.getRetryList();
-        //
-        //多线程
-        final ExecutorService executorService = Executors.newFixedThreadPool(3);
-        retryList.forEach(retry -> {
-            executorService.submit(new Runnable() {
-                @Override
-                public void run() {
-                    try {
-                        String startDate = retry.getStartDate();
-                        String endDate = retry.getEndDate();
-                        Long accountId = retry.getAccountId();
-                        Integer type = retry.getType();
-                        CtopOauthToken token = tokenService.getOauthTokenByAccountId(String.valueOf(accountId));
-                        log.info("头条素材报表重试定时任务,当前accountId为:" + token.getAccountId());
+        Thread thread = new Thread() {
+            @Override
+            public void run() {
 
-                        Long days = DateUtils.getDiscrepantDays(startDate, endDate); //间隔天数
-                        String start = null;
-                        String end = null;
-                        for (int i = 0; i <= days; i++) {
-                            start = DateUtils.addDay(startDate, i);
-                            end = start;
-                            //获取头条素材报表数据
-                            int code = bytedanceReportService.bytedanceMaterialReportRetry(type, token, start, end);
-                            if(code ==200 || code == 1){
-                                if(type == 1){
-                                    //重试成功清洗数据
-                                    byteDanceVideoReportDailyService.videoInfoListByAccountId(start,end,accountId);
+                List<BytedanceReportMaterialRetry> retryList = bytedanceReportService.getRetryList();
+                //
+                //多线程
+                final ExecutorService executorService = Executors.newFixedThreadPool(3);
+                retryList.forEach(retry -> {
+                    executorService.submit(new Runnable() {
+                        @Override
+                        public void run() {
+                            try {
+                                String startDate = retry.getStartDate();
+                                String endDate = retry.getEndDate();
+                                Long accountId = retry.getAccountId();
+                                Integer type = retry.getType();
+                                CtopOauthToken token = tokenService.getOauthTokenByAccountId(String.valueOf(accountId));
+                                log.info("头条素材报表重试定时任务,当前accountId为:" + token.getAccountId());
+                                Long days = DateUtils.getDiscrepantDays(startDate, endDate); //间隔天数
+                                String start = null;
+                                String end = null;
+                                for (int i = 0; i <= days; i++) {
+                                    start = DateUtils.addDay(startDate, i);
+                                    end = start;
+                                    //获取头条素材报表数据
+                                    int code = bytedanceReportService.bytedanceMaterialReportRetry(type, token, start, end);
+                                    if (code == 200 || code == 1) {
+                                        if (type == 1) {
+                                            //重试成功清洗数据
+                                            byteDanceVideoReportDailyService.videoInfoListByAccountId(start, end, accountId);
+                                        }
+                                    }
                                 }
+                            } catch (Exception e) {
+                                e.printStackTrace();
+                            } finally {
                             }
                         }
-                    } catch (Exception e) {
-                        e.printStackTrace();
-                    } finally {
-                    }
-                }
-            });
-        });
+                    });
+                });
+            }
+        };
+        thread.start();
+
     }
 }

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

@@ -2,7 +2,6 @@ package org.jeecg.modules.ctop.job;
 
 import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
-import cn.com.ctop.common.module.utils.CtopAdConstant;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.util.DateUtils;
@@ -43,9 +42,9 @@ public class KuaishouMaterialsLoadJob implements Job {
                             try {
 
                                 //获取全量视频素材数据
-                                kuaishouInterfaceService.getVideoList(token, startDate, endDate);
+                                kuaishouInterfaceService.getVideoList(token, DateUtils.getNowDate("yyyy-MM-dd"));
                                 // 获取图片信息数据
-                                kuaishouInterfaceService.getImageList(token, startDate, endDate);
+                                kuaishouInterfaceService.getImageList(token, DateUtils.getNowDate("yyyy-MM-dd"));
                             } catch (Exception e) {
                                 e.printStackTrace();
                             } finally {

+ 1 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/ProjectMemberMapper.xml

@@ -107,7 +107,7 @@
 
     <select id="queryProjectMemberByUserId" resultType="org.jeecg.modules.ctop.entity.ProjectMember">
         select
-        distinct b.id as projectId,
+        distinct b.project_id as projectId,
         b.project_name as projectName,
         a.advertiser_id as advertiserId,
         a.advertiser_name as advertiserName,

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

@@ -1,5 +1,5 @@
 server:
-  port: 8080
+  port: 8804
   ip: 39.97.120.42
   servlet:
     context-path: /jeecg-boot

+ 3 - 2
jeecg-boot-module-system/src/main/resources/quartz.properties

@@ -1,6 +1,7 @@
 org.quartz.threadPool.class=org.quartz.simpl.SimpleThreadPool
-org.quartz.threadPool.threadCount=20
+org.quartz.threadPool.threadCount=50
+org.quartz.scheduler.batchTriggerAcquisitionMaxCount=50
 org.quartz.threadPool.threadPriority=5
 org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread=true
 org.quartz.jobStore.misfireThreshold=60000
-org.quartz.jobStore.class=org.quartz.simpl.RAMJobStore
+org.quartz.jobStore.class=org.quartz.simpl.RAMJobStore

+ 0 - 6
module-common/src/main/java/cn/com/ctop/common/module/entity/BindAccountLogin.java

@@ -3,14 +3,12 @@ package cn.com.ctop.common.module.entity;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
-import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
 import org.jeecgframework.poi.excel.annotation.Excel;
-import org.springframework.format.annotation.DateTimeFormat;
 
 import java.util.Date;
 
@@ -87,16 +85,12 @@ public class BindAccountLogin {
      * 创建时间
      */
     @Excel(name = "创建时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
-    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
-    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     @ApiModelProperty(value = "创建时间")
     private Date createTime;
     /**
      * 修改时间
      */
     @Excel(name = "修改时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
-    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
-    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     @ApiModelProperty(value = "修改时间")
     private Date updateTime;
 

+ 4 - 5
module-common/src/main/java/cn/com/ctop/common/module/service/impl/CtopOauthTokenServiceImpl.java

@@ -9,6 +9,7 @@ import cn.com.ctop.common.module.utils.PropertiesUtils;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.xxl.job.core.log.XxlJobLogger;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -51,7 +52,7 @@ public class CtopOauthTokenServiceImpl extends ServiceImpl<CtopOauthTokenMapper,
      */
     @Override
     public Map<String, Object> getByteDanceAccessToken(String token, String refreshToken) {
-        log.info("刷新头条token入参,token:{},refreshToken:{}", token, refreshToken);
+        XxlJobLogger.log("刷新头条token入参,token:{},refreshToken:{}", token, refreshToken);
         Map<String, Object> resultMap = new HashMap<>();
         String url = PropertiesUtils.getValue("bytedance_config", "bytedance_api_url") + "/oauth2/refresh_token";
         Map<String, Object> param = new HashMap<>();
@@ -61,7 +62,7 @@ public class CtopOauthTokenServiceImpl extends ServiceImpl<CtopOauthTokenMapper,
         param.put("refresh_token", refreshToken);
         String result = HttpUtils.httpPostRequest(url, param, new HashMap<>());
         JSONObject resultObject = JSONObject.parseObject(result);
-        log.info("头条刷新token入参,token:{},refreshToken:{},返回信息:{}", token, refreshToken, resultObject);
+        XxlJobLogger.log("头条刷新token入参,token:{},refreshToken:{},返回信息:{}", token, refreshToken, resultObject);
         Integer code = resultObject.getInteger("code");
         if (code == 0) {
             JSONObject data = resultObject.getJSONObject("data");
@@ -78,7 +79,7 @@ public class CtopOauthTokenServiceImpl extends ServiceImpl<CtopOauthTokenMapper,
             queryWrapper.eq("media_id", 1);
             int i = cTopOauthTokenMapper.update(updateRefreshToken, queryWrapper);
             if (i > 0) {
-                log.info("头条刷新token成功:token:{}", token);
+                XxlJobLogger.log("头条刷新token成功:token:{}", token);
             }
             resultMap.put("message", "token刷新成功");
             resultMap.put("code", 0);
@@ -87,8 +88,6 @@ public class CtopOauthTokenServiceImpl extends ServiceImpl<CtopOauthTokenMapper,
             resultMap.put("token", token);
             resultMap.put("code", 0);
         }
-
-
         return resultMap;
     }
 

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

@@ -66,7 +66,7 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
         VideoWatermarkTemplate videoWatermarkTemplate = videoWatermarkTemplateService.getById(videoWatermarkTemplateId);
         MaterialInfo materialInfo = this.getById(materialId);
         MpsUtils mpsUtils = new MpsUtils();
-        String path = materialInfo.getUrl().substring(materialInfo.getUrl().indexOf("/", 10) + 1, materialInfo.getUrl().length());
+        String path = materialInfo.getUrl().substring(materialInfo.getUrl().indexOf('/', 10) + 1, materialInfo.getUrl().length());
         String jobId = mpsUtils.videoWaterMark(path, videoWatermarkTemplate.getTemplatePath(), videoWatermarkTemplate.getTemplateId(), videoWatermarkTemplate.getHeight());
         QueryJobListResponse.Job job = MpsUtils.getJobStatus(jobId);
         VideoWatermarkTask videoWatermarkTask = new VideoWatermarkTask();
@@ -118,11 +118,6 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
         return p.matcher(fileName).find();
     }
 
-    public static void main(String[] args) {
-        String reg = "(mp4|flv|avi|rm|rmvb|wmv)";
-        Pattern p = Pattern.compile(reg);
-    }
-
     @Autowired
     private MaterialAscriptionMapper materialAscriptionMapper;
     @Autowired

+ 0 - 2
module-common/src/main/java/cn/com/ctop/common/module/service/impl/RefreshTokenServiceImpl.java

@@ -48,9 +48,7 @@ public class RefreshTokenServiceImpl implements IRefreshTokenService {
         if (!Check.isNull(byteDanceOauthTokens)) {
             for (CtopOauthToken oauthToken : byteDanceOauthTokens) {
                 oauthTokenService.getByteDanceAccessToken(oauthToken.getAccessToken(), oauthToken.getRefreshToken());
-
             }
         }
-
     }
 }

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

@@ -13,6 +13,7 @@ import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.http.ParseException;
+import org.jeecg.common.util.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.http.HttpEntity;
@@ -98,6 +99,8 @@ public class MaterialUploadImageServiceImpl implements IMaterialUploadImageServi
                                             if (!Check.isNull(type)) {
                                                 imageGet.setMaterialType(type);
                                             }
+                                            String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
+                                            imageGet.setStatDate(DateUtils.parseDate(nowDate, "yyyy-MM-dd"));
                                             imageGet.setSignature(signature);
                                             imageGet.setImageToken(image_token);
                                             imageGetService.saveOrUpdate(imageGet);

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

@@ -21,6 +21,7 @@ import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.util.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.core.io.FileSystemResource;
@@ -191,7 +192,6 @@ public class MaterialUploadServiceImpl implements IMaterialUploadService {
                             try {
                                 log.info("快手文件多线程上传:{},accountId:{}", Thread.currentThread().getName(), accountId);
                                 String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.VIDEO_UPLOAD;
-
                                 String result = exceptInfoForRestTemplate(url, requestJson, headerMap);
                                 JSONObject resultJson = JSONObject.parseObject(result);
                                 if (!Check.isNull(resultJson)) {
@@ -221,6 +221,9 @@ public class MaterialUploadServiceImpl implements IMaterialUploadService {
                                             }
                                             videoGet.setPhotoId(photoId);
                                             videoGet.setSignature(signature);
+                                            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");
                                             kuaiShouVideoGetService.saveOrUpdate(videoGet);
                                             materialUploadImageService.uploadImage(videoGet.getSignature(), accountId, ctopOauthToken.getAccessToken());
 

+ 23 - 0
module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/ByteDanceRefreshTokenJob.java

@@ -0,0 +1,23 @@
+package cn.com.ctop.job.bytedance.handler;
+
+import cn.com.ctop.common.module.service.IRefreshTokenService;
+import com.xxl.job.core.biz.model.ReturnT;
+import com.xxl.job.core.handler.annotation.XxlJob;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class ByteDanceRefreshTokenJob {
+    @Autowired
+    private IRefreshTokenService refreshTokenService;
+
+    /**
+     * 刷新token
+     * @throws Exception
+     */
+    @XxlJob("byteDanceRefreshTokenJob")
+    public ReturnT<String> execute(String param) throws Exception {
+        refreshTokenService.byteDanceRefresh();
+        return ReturnT.SUCCESS;
+    }
+}

+ 10 - 10
module-job-bytedance/src/main/resources/application-prod.yml

@@ -120,16 +120,16 @@ jeecg:
     bin: ffmpeg
   path:
     #文件上传根目录 设置
-    upload: /mnt/upload
+    upload: /data/upload
     #webapp文件路径
-    webapp: /mnt/webapp
-    video-upload: /mnt/upload/video/
-    image-upload: /mnt/upload/image/
+    webapp: /data/webapp
+    video-upload: /data/upload/video/
+    image-upload: /data/upload/image/
     chrome-driver: /usr/bin/chromedriver
-    csv-upload: /mnt/upload/csv/
-    bak-database-file: /mnt/data/bak/
-    report-history: /mnt/upload/report/history/
-    report-daily: /mnt/upload/report/daily/
+    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
@@ -140,10 +140,10 @@ logging:
   config: classpath:logback-prod.xml
 chrome:
   script:
-    clean: sh /mnt/webapp/cleanProcess.sh
+    clean: sh /data/webapp/cleanProcess.sh
 
 oss:
   replace:
     replace-value: oss-cn-beijing-internal
     replace-old-value: oss-cn-beijing
-    download: /mnt/file/video/
+    download: /data/file/video/

+ 25 - 0
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaiShouRefreshTokenJob.java

@@ -0,0 +1,25 @@
+package cn.com.ctop.job.kuaishou.handler;
+
+import cn.com.ctop.common.module.service.IRefreshTokenService;
+import com.xxl.job.core.biz.model.ReturnT;
+import com.xxl.job.core.handler.annotation.XxlJob;
+import org.quartz.JobExecutionException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class KuaiShouRefreshTokenJob {
+    @Autowired
+    private IRefreshTokenService refreshTokenService;
+
+    /**
+     * 刷新token
+     * @throws JobExecutionException
+     */
+    @XxlJob("kuaiShouRefreshTokenJob")
+    public ReturnT<String> execute(String param) throws Exception {
+        refreshTokenService.getKuaiShouRefresh();
+        return ReturnT.SUCCESS;
+    }
+}
+

+ 2 - 2
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouMaterialsLoadJob.java

@@ -34,9 +34,9 @@ public class KuaishouMaterialsLoadJob {
         executorService = Executors.newFixedThreadPool(8);
         tokens.forEach(token -> executorService.submit(() -> {
             //获取全量视频素材数据
-            kuaishouInterfaceService.getVideoList(token, startDate, endDate);
+            kuaishouInterfaceService.getVideoList(token, DateUtils.getNowDate("yyyy-MM-dd"));
             // 获取图片信息数据
-            kuaishouInterfaceService.getImageList(token, startDate, endDate);
+            kuaishouInterfaceService.getImageList(token, DateUtils.getNowDate("yyyy-MM-dd"));
         }));
         XxlJobLogger.log("快手物料数据同步完成");
         return ReturnT.SUCCESS;

+ 10 - 10
module-job-kuaishou/src/main/resources/application-prod.yml

@@ -125,16 +125,16 @@ jeecg:
     bin: ffmpeg
   path:
     #文件上传根目录 设置
-    upload: /mnt/upload
+    upload: /data/upload
     #webapp文件路径
-    webapp: /mnt/webapp
-    video-upload: /mnt/upload/video/
-    image-upload: /mnt/upload/image/
+    webapp: /data/webapp
+    video-upload: /data/upload/video/
+    image-upload: /data/upload/image/
     chrome-driver: /usr/bin/chromedriver
-    csv-upload: /mnt/upload/csv/
-    bak-database-file: /mnt/data/bak/
-    report-history: /mnt/upload/report/history/
-    report-daily: /mnt/upload/report/daily/
+    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
@@ -145,10 +145,10 @@ logging:
   config: classpath:logback-prod.xml
 chrome:
   script:
-    clean: sh /mnt/webapp/cleanProcess.sh
+    clean: sh /data/webapp/cleanProcess.sh
 
 oss:
   replace:
     replace-value: oss-cn-beijing-internal
     replace-old-value: oss-cn-beijing
-    download: /mnt/file/video/
+    download: /data/file/video/

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

@@ -24,6 +24,7 @@ import io.swagger.annotations.Api;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.common.util.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
@@ -133,7 +134,7 @@ public class BatchController {
             Thread thread2 = new Thread() {
                 @Override
                 public void run() {
-                    iKuaishouInterfaceService.getVideoList(oauthToken, null, null);
+                    iKuaishouInterfaceService.getVideoList(oauthToken, DateUtils.getNowDate("yyyy-MM-dd"));
                 }
             };
             thread2.start();
@@ -664,8 +665,13 @@ public class BatchController {
             if (Check.isNull(requestJson)) {
                 throw new Exception("入参为空");
             }
+            Long accountId = requestJson.getLong("accountId");
+            CtopOauthToken token = tokenService.getTokenByAccountId(accountId);
+            if (Check.isNull(token)) {
+                throw new Exception("账号信息为空");
+            }
 
-            JSONObject unitJson = batchService.createUnit(requestJson);
+            JSONObject unitJson = batchService.createUnit(requestJson, token);
             result.setSuccess(true);
             result.setResult(unitJson);
 
@@ -941,7 +947,7 @@ public class BatchController {
                         if (!Check.isNull(updateMap)) {
                             Integer code = (Integer) updateMap.get("code");
                             if (code == 0) {
-                                iKuaishouInterfaceService.getGroup(token.getAccessToken(), accountId, unitId);
+                                kuaiShouGroupService.getGroupByUnitId(token.getAccessToken(), accountId, unitId);
                             } else {
                                 JSONObject failJson = new JSONObject();
                                 failJson.put("message", updateMap.get("message"));
@@ -1006,7 +1012,7 @@ public class BatchController {
                                 Map<String, Object> updateDeepMap = updateService.updateUnitDeepConversionBid(token.getAccessToken(), accountId, unitId, deepConversionBid, userId);
                             }
                         }
-                        iKuaishouInterfaceService.getGroup(token.getAccessToken(), accountId, unitId);
+                        kuaiShouGroupService.getGroupByUnitId(token.getAccessToken(), accountId, unitId);
                         if (!Check.isNull(updateMap)) {
                             Integer code = (Integer) updateMap.get("code");
                             if (code != 0) {
@@ -1049,7 +1055,7 @@ public class BatchController {
         Result<IPage<KuaiShouImageGet>> result = new Result<>();
         try {
             QueryWrapper<KuaiShouImageGet> queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouImageGet, req.getParameterMap());
-            queryWrapper.orderByDesc("create_time");
+            queryWrapper.orderByDesc("stat_date");
             Page<KuaiShouImageGet> page = new Page<>(pageNo, pageSize);
             IPage<KuaiShouImageGet> pageList = kuaiShouImageGetService.page(page, queryWrapper);
             result.setSuccess(true);
@@ -1071,15 +1077,15 @@ public class BatchController {
     @GetMapping(value = "/getVideoList")
     public Result<IPage<KuaiShouVideoGet>> getVideoList(KuaiShouVideoGet kuaiShouVideoGet, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                         @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
-                                                        @RequestParam(name = "startDate", defaultValue = "2010-01-01") String startDate,
-                                                        @RequestParam(name = "endDate", defaultValue = "2100-01-01") String endDate, HttpServletRequest req) {
+                                                        @RequestParam(name = "startDate", defaultValue = "") String startDate,
+                                                        @RequestParam(name = "endDate", defaultValue = "") String endDate, HttpServletRequest req) {
         Result<IPage<KuaiShouVideoGet>> result = new Result<>();
         try {
             QueryWrapper<KuaiShouVideoGet> queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouVideoGet, req.getParameterMap());
-            startDate = startDate + " 00:00:00";
-            endDate = endDate + " 23:59:59";
-            queryWrapper.between("create_time", startDate, endDate);
-            queryWrapper.orderByDesc("create_time");
+            if (!Check.isNull(startDate) && !Check.isNull(endDate)) {
+                queryWrapper.between("stat_date", startDate, endDate);
+            }
+            queryWrapper.orderByDesc("stat_date");
             Page<KuaiShouVideoGet> page = new Page<>(pageNo, pageSize);
             IPage<KuaiShouVideoGet> pageList = kuaiShouVideoGetService.page(page, queryWrapper);
             result.setSuccess(true);
@@ -1622,6 +1628,15 @@ public class BatchController {
     public Result<JSONObject> batchCopyUnit(@RequestBody JSONObject requestJson) {
         Result<JSONObject> result = new Result<>();
         try {
+            Long accountId = requestJson.getLong("accountId");
+            if (Check.isNull(accountId)) {
+                throw new Exception("账户id不能为空");
+            }
+            CtopOauthToken oauthToken = oauthTokenService.getTokenByAccountId(accountId);
+            if (Check.isNull(oauthToken)) {
+                throw new Exception("未获取到token信息");
+            }
+
             if (Check.isNull(requestJson)) {
                 throw new Exception("入参为空");
             }
@@ -1629,10 +1644,8 @@ public class BatchController {
             if (Check.isNull(unitIds)) {
                 throw new Exception("请选择需要修改的广告组");
             }
-            Long accountId = requestJson.getLong("accountId");
-            Long copyToCampaignId = requestJson.getLong("copyToCampaignId");
-
 
+            Long copyToCampaignId = requestJson.getLong("copyToCampaignId");
             JSONObject returnJson = new JSONObject();
             JSONArray failArr = new JSONArray();
             for (int i = 0; i < unitIds.size(); i++) {
@@ -1640,7 +1653,7 @@ public class BatchController {
                 if (Check.isNull(unitId)) {
                     continue;
                 }
-
+                kuaiShouGroupService.getGroupByUnitId(oauthToken.getAccessToken(), oauthToken.getAccountId(), unitId);
                 QueryWrapper<KuaiShouGroup> queryWrapper = new QueryWrapper<>();
                 queryWrapper.eq("account_id", accountId);
                 queryWrapper.eq("unit_id", unitId);
@@ -1658,7 +1671,7 @@ public class BatchController {
                     unitName = unitNameStr;
                 }
                 group.setUnitName(unitName + RandomUtil.verifyCode());
-                JSONObject unitJson = batchService.copyUnit(group, copyToCampaignId);
+                JSONObject unitJson = batchService.copyUnit(group, copyToCampaignId, oauthToken);
                 if (!Check.isNull(unitJson)) {
                     Integer code = unitJson.getInteger("code");
                     if (code != 0) {
@@ -1694,10 +1707,15 @@ public class BatchController {
     public Result<JSONObject> copyUnit(@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 accountId = requestJson.getLong("accountId");
             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");
@@ -1705,7 +1723,7 @@ public class BatchController {
                 throw new Exception("请选择迭代次数");
             }
             if (createCount == 1) {
-                JSONObject createJson = batchService.createUnit(requestJson);
+                JSONObject createJson = batchService.createUnit(requestJson, oauthToken);
                 if (!Check.isNull(createJson)) {
                     failArr = createJson.getJSONArray("fail");
                 }
@@ -1732,7 +1750,7 @@ public class BatchController {
                     for (int i = 0; i < createCount; i++) {
                         String randomName = unitName + RandomUtil.verifyCode();
                         group.setUnitName(randomName);
-                        JSONObject copyUnitJson = batchService.copyUnit(group, copyToCampaignId);
+                        JSONObject copyUnitJson = batchService.copyUnit(group, copyToCampaignId, oauthToken);
                         if (copyUnitJson.getInteger("code") != 0) {
                             JSONObject errJson = new JSONObject();
                             errJson.put("message", copyUnitJson.getString("message"));
@@ -1753,7 +1771,7 @@ public class BatchController {
                                 continue;
                             }
                             group.setUnitName(copyUnitName);
-                            JSONObject copyUnitJson = batchService.copyUnit(group, copyToCampaignId);
+                            JSONObject copyUnitJson = batchService.copyUnit(group, copyToCampaignId, oauthToken);
                             if (copyUnitJson.getInteger("code") != 0) {
                                 JSONObject errJson = new JSONObject();
                                 errJson.put("message", copyUnitJson.getString("message"));

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

@@ -82,6 +82,7 @@ public class KuaiShouImageGet {
     @Excel(name = "图片 md5", width = 15)
     @ApiModelProperty(value = "图片 md5")
     private String signature;
+    private Date statDate;
     /**
      * 创建时间
      */

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

@@ -74,6 +74,8 @@ public class KuaiShouVideoGet {
 
     private String signature;
 
+    private Date statDate;
+
 
     private Integer materialType;
     /**

+ 2 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouImageGetMapper.xml

@@ -14,6 +14,7 @@
         material_type,
         signature,
         image_token,
+        stat_date,
         create_time,
         update_time
         )
@@ -30,6 +31,7 @@
             #{image.materialType},
             #{image.signature},
             #{image.imageToken},
+            #{image.statDate},
             #{image.createTime},
             #{image.updateTime}
             )

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

@@ -58,7 +58,7 @@ public interface IBatchService {
      * @param requestJson
      * @return
      */
-    JSONObject createUnit(JSONObject requestJson) throws Exception;
+    JSONObject createUnit(JSONObject requestJson,CtopOauthToken oauthToken) throws Exception;
 
     /**
      * 批量复制广告组
@@ -66,7 +66,7 @@ public interface IBatchService {
      * @param copyToCampaignId
      * @return
      */
-    JSONObject copyUnit(KuaiShouGroup group, Long copyToCampaignId);
+    JSONObject copyUnit(KuaiShouGroup group, Long copyToCampaignId, CtopOauthToken oauthToken);
 
 
     /**
@@ -110,7 +110,7 @@ public interface IBatchService {
      * @param requestJson
      * @return
      */
-    JSONObject updateUnit(JSONObject requestJson,CtopOauthToken token) throws Exception;
+    JSONObject updateUnit(JSONObject requestJson, CtopOauthToken token) throws Exception;
 
     /**
      * 修改广告创意

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

@@ -12,4 +12,6 @@ import com.baomidou.mybatisplus.extension.service.IService;
 public interface IKuaiShouGroupService extends IService<KuaiShouGroup> {
 
     void getGroupList(String accessToken, Long accountId);
+
+    void getGroupByUnitId(String accessToken, Long accountId, Long unitId);
 }

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

@@ -139,16 +139,6 @@ public interface IKuaishouInterfaceService {
 
 
     /**
-     * 获取广告组信息 单条
-     *
-     * @param accessToken
-     * @param advertiserId
-     * @param
-     */
-    void getGroup(String accessToken, Long advertiserId, Long unitId);
-
-
-    /**
      * 获取创意列表
      *
      * @param token
@@ -309,10 +299,9 @@ public interface IKuaishouInterfaceService {
      * 获取视频列表
      *
      * @param token
-     * @param startDate
-     * @param endDate
+     * @param statDate
      */
-    void getVideoList(CtopOauthToken token, Date startDate, Date endDate);
+    void getVideoList(CtopOauthToken token, String statDate);
 
 
     /**
@@ -411,10 +400,8 @@ public interface IKuaishouInterfaceService {
      * 获取快手图片列表
      *
      * @param token
-     * @param startDate
-     * @param endDate
      */
-    void getImageList(CtopOauthToken token, Date startDate, Date endDate);
+    void getImageList(CtopOauthToken token, String statDate);
 
 
     /**

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

@@ -169,12 +169,8 @@ public class BatchServiceImpl implements IBatchService {
      * @return
      */
     @Override
-    public JSONObject createUnit(JSONObject requestJson) throws Exception {
-        Long accountId = requestJson.getLong("accountId");
-        CtopOauthToken oauthToken = oauthTokenService.getTokenByAccountId(accountId);
-        if (Check.isNull(oauthToken)) {
-            throw new Exception("未获取到账户信息");
-        }
+    public JSONObject createUnit(JSONObject requestJson, CtopOauthToken oauthToken) throws Exception {
+
 
         JSONObject unitJson = new JSONObject();
 
@@ -408,7 +404,7 @@ public class BatchServiceImpl implements IBatchService {
                     unitJson.put("unit_name", unitName);
                 }
 
-                Map<String, Object> returnUnitMap = kuaishouInterfaceService.adUnitCreate(oauthToken.getAccessToken(), accountId, unitJson);
+                Map<String, Object> returnUnitMap = kuaishouInterfaceService.adUnitCreate(oauthToken.getAccessToken(), oauthToken.getAccountId(), unitJson);
                 if (!Check.isNullMap(returnUnitMap)) {
                     Integer code = (Integer) returnUnitMap.get("code");
                     if (code == 0) {
@@ -428,7 +424,7 @@ public class BatchServiceImpl implements IBatchService {
                                     @Override
                                     public void run() {
                                         try {
-                                            copyCreative(accountId, unitId, copyUnitId);
+                                            copyCreative(oauthToken.getAccountId(), unitId, copyUnitId);
                                         } catch (Exception e) {
                                             e.printStackTrace();
                                         }
@@ -465,14 +461,9 @@ public class BatchServiceImpl implements IBatchService {
 
 
     @Override
-    public JSONObject copyUnit(KuaiShouGroup group, Long copyToCampaignId) {
+    public JSONObject copyUnit(KuaiShouGroup group, Long copyToCampaignId, CtopOauthToken oauthToken) {
         JSONObject returnJson = new JSONObject();
         try {
-            CtopOauthToken oauthToken = oauthTokenService.getTokenByAccountId(group.getAccountId());
-            if (Check.isNull(oauthToken)) {
-                throw new Exception("未获取到token信息");
-            }
-
             JSONObject unitJson = new JSONObject();
             unitJson.put("campaign_id", copyToCampaignId);
 
@@ -1002,186 +993,202 @@ public class BatchServiceImpl implements IBatchService {
      */
     @Override
     public JSONObject updateUnit(JSONObject requestJson, CtopOauthToken token) throws Exception {
+        JSONObject returnJson = new JSONObject();
+        try {
 
-        JSONObject unitJson = new JSONObject();
-        unitJson.put("advertiser_id", token.getAccountId());
-
-        Long unitId = requestJson.getLong("unitId");
-        if (Check.isNull(unitId)) {
-            throw new Exception("请选择广告组");
-        }
+            JSONObject unitJson = new JSONObject();
+            unitJson.put("advertiser_id", token.getAccountId());
 
-        unitJson.put("unit_id", unitId);
-        // 广告组名称
-        if (!Check.isNull(requestJson.getString("unitName"))) {
-            unitJson.put("unit_name", requestJson.getString("unitName"));
-        }
-        // 出价
-        if (!Check.isNull(requestJson.getLong("bid"))) {
-            unitJson.put("bid", requestJson.getLong("bid"));
-        }
-        // 深度转化出价
-        if (!Check.isNull(requestJson.getLong("cpaBid"))) {
-            unitJson.put("cpa_bid", requestJson.getLong("cpaBid"));
-        }
-        // 深度转化目标出价
-        if (!Check.isNull(requestJson.getLong("deepConversionBid"))) {
-            unitJson.put("deep_conversion_bid", requestJson.getLong("deepConversionBid"));
-        }
-        //投放开始时间
-        if (!Check.isNull(requestJson.getString("beginTime"))) {
+            Long unitId = requestJson.getLong("unitId");
+            if (Check.isNull(unitId)) {
+                throw new Exception("请选择广告组");
+            }
 
-            String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
-            boolean beginTimeBoolean = DateUtils.compare(requestJson.getString("beginTime"), nowDate);
-            if (beginTimeBoolean) {
-                unitJson.put("begin_time", nowDate);
-            } else {
-                unitJson.put("begin_time", requestJson.getString("beginTime"));
+            unitJson.put("unit_id", unitId);
+            // 广告组名称
+            if (!Check.isNull(requestJson.getString("unitName"))) {
+                unitJson.put("unit_name", requestJson.getString("unitName"));
+            }
+            // 出价
+            if (!Check.isNull(requestJson.getLong("bid"))) {
+                unitJson.put("bid", requestJson.getLong("bid"));
+            }
+            // 深度转化出价
+            if (!Check.isNull(requestJson.getLong("cpaBid"))) {
+                unitJson.put("cpa_bid", requestJson.getLong("cpaBid"));
+            }
+            // 深度转化目标出价
+            if (!Check.isNull(requestJson.getLong("deepConversionBid"))) {
+                unitJson.put("deep_conversion_bid", requestJson.getLong("deepConversionBid"));
             }
+            //投放开始时间
+            if (!Check.isNull(requestJson.getString("beginTime"))) {
 
+                String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
+                boolean beginTimeBoolean = DateUtils.compare(requestJson.getString("beginTime"), nowDate);
+                if (beginTimeBoolean) {
+                    unitJson.put("begin_time", nowDate);
+                } else {
+                    unitJson.put("begin_time", requestJson.getString("beginTime"));
+                }
 
-        }
-        // 投放结束时间
-        if (!Check.isNull(requestJson.getString("endTime"))) {
-            unitJson.put("end_time", requestJson.getString("endTime"));
-        }
-        // 投放时间段
-        if (!Check.isNull(requestJson.getString("scheduleTime"))) {
-            unitJson.put("schedule_time", requestJson.getString("scheduleTime"));
-        }
-        // 广告组单日预算
-        if (!Check.isNull(requestJson.getLong("dayBudget"))) {
-            unitJson.put("day_budget", requestJson.getLong("dayBudget"));
-        }
-        // url类型
-        if (!Check.isNull(requestJson.getInteger("urlType"))) {
-            unitJson.put("url_type", requestJson.getInteger("urlType"));
-        }
-        // url
-        if (!Check.isNull(requestJson.getString("url"))) {
-            unitJson.put("url", requestJson.getString("url"));
-        }
-        // appId
-        if (!Check.isNull(requestJson.getLong("appId"))) {
-            unitJson.put("app_id", requestJson.getLong("appId"));
-        }
 
-        // 创意展现方式
-        if (!Check.isNull(requestJson.getInteger("showMode"))) {
-            unitJson.put("show_mode", requestJson.getInteger("showMode"));
-        }
-        //投放方式
-        if (!Check.isNull(requestJson.getInteger("speed"))) {
-            unitJson.put("speed", requestJson.getInteger("speed"));
-        }
+            }
+            // 投放结束时间
+            if (!Check.isNull(requestJson.getString("endTime"))) {
+                unitJson.put("end_time", requestJson.getString("endTime"));
+            }
+            // 投放时间段
+            if (!Check.isNull(requestJson.getString("scheduleTime"))) {
+                unitJson.put("schedule_time", requestJson.getString("scheduleTime"));
+            }
+            // 广告组单日预算
+            if (!Check.isNull(requestJson.getLong("dayBudget"))) {
+                unitJson.put("day_budget", requestJson.getLong("dayBudget"));
+            }
+            // url类型
+            if (!Check.isNull(requestJson.getInteger("urlType"))) {
+                unitJson.put("url_type", requestJson.getInteger("urlType"));
+            }
+            // url
+            if (!Check.isNull(requestJson.getString("url"))) {
+                unitJson.put("url", requestJson.getString("url"));
+            }
+            // appId
+            if (!Check.isNull(requestJson.getLong("appId"))) {
+                unitJson.put("app_id", requestJson.getLong("appId"));
+            }
 
+            // 创意展现方式
+            if (!Check.isNull(requestJson.getInteger("showMode"))) {
+                unitJson.put("show_mode", requestJson.getInteger("showMode"));
+            }
+            //投放方式
+            if (!Check.isNull(requestJson.getInteger("speed"))) {
+                unitJson.put("speed", requestJson.getInteger("speed"));
+            }
 
-        // -----------------用户定向-----------
-        JSONObject targetJson = new JSONObject();
+            // 优先从系统应用商店下载
+            if (!Check.isNull(requestJson.getInteger("useAppMarket"))) {
+                unitJson.put("use_app_market", requestJson.getInteger("useAppMarket"));
+            }
+            // 转化目标
+            if (!Check.isNull(requestJson.getInteger("convertId"))) {
+                unitJson.put("convert_id", requestJson.getInteger("convertId"));
+            }
 
-        // 地域
-        if (!Check.isNull(requestJson.getJSONArray("region"))) {
-            targetJson.put("region", requestJson.getJSONArray("region"));
-        }
 
-        // 自定义年龄段
-        JSONArray ageArr = requestJson.getJSONArray("age");
-        if (!Check.isNull(ageArr)) {
-            JSONObject ageJson = new JSONObject();
-            ageJson.put("min", ageArr.get(0));
-            ageJson.put("max", ageArr.get(1));
-            targetJson.put("age", ageJson);
-        }
-        // 固定年龄段
-        if (!Check.isNull(requestJson.getJSONArray("agesRange"))) {
-            targetJson.put("ages_range", requestJson.getJSONArray("agesRange"));
-        }
-        // 性别
-        if (!Check.isNull(requestJson.getInteger("gender"))) {
-            targetJson.put("gender", requestJson.getInteger("gender"));
-        }
-        //操作系统
-        if (!Check.isNull(requestJson.getInteger("platformOs"))) {
-            targetJson.put("platform_os", requestJson.getInteger("platformOs"));
-        }
-        //Android版本
-        if (!Check.isNull(requestJson.getInteger("androidOsv"))) {
-            targetJson.put("android_osv", requestJson.getInteger("androidOsv"));
-        }
-        // iOS版本
-        if (!Check.isNull(requestJson.getInteger("iosOsv"))) {
-            targetJson.put("ios_osv", requestJson.getInteger("iosOsv"));
-        }
-        //网络环境
-        if (!Check.isNull(requestJson.getInteger("network"))) {
-            targetJson.put("network", requestJson.getInteger("network"));
-        }
-        //设备品牌
-        if (!Check.isNull(requestJson.getJSONArray("deviceBrand"))) {
-            targetJson.put("device_brand", requestJson.getJSONArray("deviceBrand"));
-        }
-        //设备价格
-        if (!Check.isNull(requestJson.getJSONArray("devicePrice"))) {
-            targetJson.put("device_price", requestJson.getJSONArray("devicePrice"));
-        }
-        //商业兴趣类型
-        if (!Check.isNull(requestJson.getInteger("businessInterestType"))) {
-            targetJson.put("business_interest_type", requestJson.getInteger("businessInterestType"));
-        }
-        // 商业兴趣
-        if (!Check.isNull(requestJson.getJSONArray("businessInterest"))) {
-            targetJson.put("business_interest", requestJson.getJSONArray("businessInterest"));
-        }
-        //网红粉丝
-        if (!Check.isNull(requestJson.getJSONArray("fansStar"))) {
-            targetJson.put("fans_star", requestJson.getJSONArray("fansStar"));
-        }
-        //兴趣视频用户
-        if (!Check.isNull(requestJson.getJSONArray("interestVideo"))) {
-            targetJson.put("interest_video", requestJson.getJSONArray("interestVideo"));
-        }
-        // APP行为-按分类
-        if (!Check.isNull(requestJson.getJSONArray("appInterest"))) {
-            targetJson.put("app_interest", requestJson.getJSONArray("appInterest"));
-        }
-        // APP行为-按APP名称
-        if (!Check.isNull(requestJson.getJSONArray("appIds"))) {
-            targetJson.put("app_ids", requestJson.getJSONArray("appIds"));
-        }
-        // 人群包定向
-        if (!Check.isNull(requestJson.getJSONArray("population"))) {
-            targetJson.put("population", requestJson.getJSONArray("population"));
-        }
-        // 人群包排除
-        if (!Check.isNull(requestJson.getJSONArray("excludePopulation"))) {
-            targetJson.put("exclude_population", requestJson.getJSONArray("excludePopulation"));
-        }
+            // -----------------用户定向-----------
+            JSONObject targetJson = new JSONObject();
 
-        JSONObject intelliExtendJson = new JSONObject();
+            // 地域
+            if (!Check.isNull(requestJson.getJSONArray("region"))) {
+                targetJson.put("region", requestJson.getJSONArray("region"));
+            }
 
-        // 开启智能扩量
-        if (!Check.isNull(requestJson.getInteger("isOpen"))) {
-            intelliExtendJson.put("is_open", requestJson.getInteger("isOpen"));
-        }
-        //不可突破年龄
-        if (!Check.isNull(requestJson.getInteger("noAgeBreak"))) {
-            intelliExtendJson.put("no_age_break", requestJson.getInteger("noAgeBreak"));
-        }
-        //不可突破性别
-        if (!Check.isNull(requestJson.getInteger("noGenderBreak"))) {
-            intelliExtendJson.put("no_gender_break", requestJson.getInteger("noGenderBreak"));
-        }
-        // 不可突破地域
-        if (!Check.isNull(requestJson.getInteger("noAreaBreak"))) {
-            intelliExtendJson.put("no_area_break", requestJson.getInteger("noAreaBreak"));
-        }
-        if (!Check.isNull(intelliExtendJson)) {
-            targetJson.put("intelli_extend", intelliExtendJson);
-        }
+            // 自定义年龄段
+            JSONArray ageArr = requestJson.getJSONArray("age");
+            if (!Check.isNull(ageArr)) {
+                JSONObject ageJson = new JSONObject();
+                ageJson.put("min", ageArr.get(0));
+                ageJson.put("max", ageArr.get(1));
+                targetJson.put("age", ageJson);
+            }
+            // 固定年龄段
+            if (!Check.isNull(requestJson.getJSONArray("agesRange"))) {
+                targetJson.put("ages_range", requestJson.getJSONArray("agesRange"));
+            }
+            // 性别
+            if (!Check.isNull(requestJson.getInteger("gender"))) {
+                targetJson.put("gender", requestJson.getInteger("gender"));
+            }
+            //操作系统
+            if (!Check.isNull(requestJson.getInteger("platformOs"))) {
+                targetJson.put("platform_os", requestJson.getInteger("platformOs"));
+            }
+            //Android版本
+            if (!Check.isNull(requestJson.getInteger("androidOsv"))) {
+                targetJson.put("android_osv", requestJson.getInteger("androidOsv"));
+            }
+            // iOS版本
+            if (!Check.isNull(requestJson.getInteger("iosOsv"))) {
+                targetJson.put("ios_osv", requestJson.getInteger("iosOsv"));
+            }
+            //网络环境
+            if (!Check.isNull(requestJson.getInteger("network"))) {
+                targetJson.put("network", requestJson.getInteger("network"));
+            }
+            //设备品牌
+            if (!Check.isNull(requestJson.getJSONArray("deviceBrand"))) {
+                targetJson.put("device_brand", requestJson.getJSONArray("deviceBrand"));
+            }
+            //设备价格
+            if (!Check.isNull(requestJson.getJSONArray("devicePrice"))) {
+                targetJson.put("device_price", requestJson.getJSONArray("devicePrice"));
+            }
+            //商业兴趣类型
+            if (!Check.isNull(requestJson.getInteger("businessInterestType"))) {
+                targetJson.put("business_interest_type", requestJson.getInteger("businessInterestType"));
+            }
+            // 商业兴趣
+            if (!Check.isNull(requestJson.getJSONArray("businessInterest"))) {
+                targetJson.put("business_interest", requestJson.getJSONArray("businessInterest"));
+            }
+            //网红粉丝
+            if (!Check.isNull(requestJson.getJSONArray("fansStar"))) {
+                targetJson.put("fans_star", requestJson.getJSONArray("fansStar"));
+            }
+            //兴趣视频用户
+            if (!Check.isNull(requestJson.getJSONArray("interestVideo"))) {
+                targetJson.put("interest_video", requestJson.getJSONArray("interestVideo"));
+            }
+            // APP行为-按分类
+            if (!Check.isNull(requestJson.getJSONArray("appInterest"))) {
+                targetJson.put("app_interest", requestJson.getJSONArray("appInterest"));
+            }
+            // APP行为-按APP名称
+            if (!Check.isNull(requestJson.getJSONArray("appIds"))) {
+                targetJson.put("app_ids", requestJson.getJSONArray("appIds"));
+            }
+            // 人群包定向
+            if (!Check.isNull(requestJson.getJSONArray("population"))) {
+                targetJson.put("population", requestJson.getJSONArray("population"));
+            }
+            // 人群包排除
+            if (!Check.isNull(requestJson.getJSONArray("excludePopulation"))) {
+                targetJson.put("exclude_population", requestJson.getJSONArray("excludePopulation"));
+            }
 
-        unitJson.put("target", targetJson);
+            JSONObject intelliExtendJson = new JSONObject();
 
-        JSONObject returnJson = updateService.updateUnit(token.getAccessToken(), unitJson);
+            // 开启智能扩量
+            if (!Check.isNull(requestJson.getInteger("isOpen"))) {
+                intelliExtendJson.put("is_open", requestJson.getInteger("isOpen"));
+            }
+            //不可突破年龄
+            if (!Check.isNull(requestJson.getInteger("noAgeBreak"))) {
+                intelliExtendJson.put("no_age_break", requestJson.getInteger("noAgeBreak"));
+            }
+            //不可突破性别
+            if (!Check.isNull(requestJson.getInteger("noGenderBreak"))) {
+                intelliExtendJson.put("no_gender_break", requestJson.getInteger("noGenderBreak"));
+            }
+            // 不可突破地域
+            if (!Check.isNull(requestJson.getInteger("noAreaBreak"))) {
+                intelliExtendJson.put("no_area_break", requestJson.getInteger("noAreaBreak"));
+            }
+            if (!Check.isNull(intelliExtendJson)) {
+                targetJson.put("intelli_extend", intelliExtendJson);
+            }
+
+            unitJson.put("target", targetJson);
+
+            returnJson = updateService.updateUnit(token.getAccessToken(), unitJson);
+        } catch (Exception e) {
+            e.printStackTrace();
+            returnJson.put("code", -1);
+            returnJson.put("message", e.getMessage());
+        }
         return returnJson;
     }
 

+ 30 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouGroupServiceImpl.java

@@ -54,7 +54,6 @@ public class KuaiShouGroupServiceImpl extends ServiceImpl<KuaiShouGroupMapper, K
      */
     @Override
     public void getGroupList(String accessToken, Long accountId) {
-
         QueryWrapper<KuaiShouCampaign> campaignQueryWrapper = new QueryWrapper<>();
         campaignQueryWrapper.eq("account_id", accountId);
         campaignQueryWrapper.eq("status", 4);
@@ -109,6 +108,36 @@ public class KuaiShouGroupServiceImpl extends ServiceImpl<KuaiShouGroupMapper, K
     }
 
 
+    @Override
+    public void getGroupByUnitId(String accessToken, Long accountId, Long unitId) {
+        String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.GROUP_LIST;
+        JSONObject param = new JSONObject();
+        param.put("advertiser_id", accountId);
+        param.put("unit_id", unitId);
+
+        Map<String, String> headers = new HashMap<>();
+        headers.put("Access-Token", accessToken);
+        headers.put("Content-Type", "application/json");
+
+        String result = HttpUtils.kuaiShouhttpPostRequest(url, param.toJSONString(), headers);
+        JSONObject resultJson = JSONObject.parseObject(result);
+        if (Check.isNull(resultJson)) {
+            log.error("获取广告组接口异常,advertiserId:{}", accountId);
+            return;
+        }
+        Integer code = resultJson.getInteger("code");
+        if (null == code || code != 0) {
+            log.error("获取广告组返回结果异常,advertiserId:{},异常信息:{}", accountId, resultJson);
+            return;
+        }
+        JSONArray details = resultJson.getJSONObject("data").getJSONArray("details");
+        if (Check.isNull(details)) {
+            return;
+        }
+        addGroupV2(accountId, details);
+    }
+
+
     private void addGroupV2(Long advertiserId, JSONArray details) {
         if (!Check.isNull(details)) {
             List<KuaiShouGroup> groups = new ArrayList<>();

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

@@ -6,6 +6,7 @@ import cn.com.ctop.common.module.utils.KuaishouInterfaceConstant;
 import cn.com.ctop.common.module.utils.PropertiesUtils;
 import cn.com.ctop.kuaishou.modules.batch.entity.*;
 import cn.com.ctop.kuaishou.modules.batch.mapper.*;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouGroupService;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouUpdateService;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
 import com.alibaba.fastjson.JSONObject;
@@ -113,6 +114,8 @@ public class KuaiShouUpdateServiceImpl implements IKuaiShouUpdateService {
      * @param dayBudget
      * @return
      */
+    @Autowired
+    private IKuaiShouGroupService groupService;
     @Override
     public Map<String, Object> updateUnitDayBudget(String token, Long advertiserId, Long unitId, Long dayBudget, String loginId) {
         Map<String, Object> returnMap = new HashMap<>();
@@ -148,7 +151,7 @@ public class KuaiShouUpdateServiceImpl implements IKuaiShouUpdateService {
                         log.info("修改广告组预算本地记录添加成功,unitId:{}", unitId);
                     }
                     // 重新请求数据
-                    interfaceService.getGroup(token, advertiserId, unitId);
+                    groupService.getGroupByUnitId(token, advertiserId, unitId);
                     returnMap.put("code", 0);
                     returnMap.put("success", true);
                     returnMap.put("message", "修改成功");
@@ -369,7 +372,7 @@ public class KuaiShouUpdateServiceImpl implements IKuaiShouUpdateService {
                         deleteMap.put("unit_id", unitId);
                         groupMapper.deleteByMap(deleteMap);
                     } else {
-                        interfaceService.getGroup(token, advertiserId, unitId);
+                        groupService.getGroupByUnitId(token, advertiserId, unitId);
                     }
 
 
@@ -592,7 +595,7 @@ public class KuaiShouUpdateServiceImpl implements IKuaiShouUpdateService {
                     if (!Check.isNull(data)) {
                         try {
                             Thread.sleep(500);
-                            interfaceService.getGroup(accessToken, unitJson.getLong("advertiser_id"), data.getLong("unit_id"));
+                            groupService.getGroupByUnitId(accessToken, unitJson.getLong("advertiser_id"), data.getLong("unit_id"));
                         } catch (InterruptedException e) {
                             e.printStackTrace();
                         }

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

@@ -47,6 +47,7 @@ import java.io.File;
 import java.io.IOException;
 import java.lang.reflect.ParameterizedType;
 import java.lang.reflect.Type;
+import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
@@ -63,10 +64,6 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
     @Autowired
     private KuaiShouGroupMapper groupMapper;
     @Autowired
-    private KuaiShouAppInfoMapper appInfoMapper;
-    @Autowired
-    private KuaiShouScheduleMapper shouScheduleMapper;
-    @Autowired
     private IKuaiShouCreativeService creativeService;
     @Autowired
     private KuaiShouConversionInfosMapper conversionInfosMapper;
@@ -97,8 +94,6 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
     @Autowired
     private MaterialInfoMapper materialInfoMapper;
     @Autowired
-    private KuaiShouGroupTargetMapper groupTargetMapper;
-    @Autowired
     private KuaiShouTargetingTagsMapper targetingTagsMapper;
     @Autowired
     private KuaishouReportDailyAccountMapper dailyAccountMapper;
@@ -126,16 +121,16 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
     private IUserAllocationService userAllocationService;
     @Autowired
     private IKuaishouReportDailyCreativeStatisticService dailyCreativeStatisticService;
-
     @Autowired
     private IKuaiShouHistoryReportTaskService historyReportTaskService;
-
     @Autowired
-    IKuaiShouImageGetService kuaiShouImageGetService;
+    private IKuaiShouImageGetService kuaiShouImageGetService;
     @Autowired
     private IKuaiShouDailyFlowsService kuaiShouDailyFlowsService;
     @Autowired
     private IKuaishouPopulationService populationService;
+    @Autowired
+    private IKuaiShouGroupService getKuaiShouGroupService;
 
 
     @Override
@@ -186,11 +181,11 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
 
 
     @Override
-    public void getVideoList(CtopOauthToken token, Date startDate, Date endDate) {
-        getVideoListByPage(token, startDate, endDate, 1);
+    public void getVideoList(CtopOauthToken token, String statDate) {
+        getVideoListByPage(token, statDate, 1);
     }
 
-    private void getVideoListByPage(CtopOauthToken token, Date startDate, Date endDate, int page) {
+    private void getVideoListByPage(CtopOauthToken token, String statDate, int page) {
         try {
             log.info("获取视频数据,accountId:{}", token.getAccountId());
             String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.VIDEO_LIST;
@@ -201,9 +196,9 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
             param.put("advertiser_id", token.getAccountId());
             param.put("page_size", 500);
             param.put("page", page);
-            if (startDate != null && endDate != null) {
-                param.put("start_date", DateUtils.formatDate(startDate));
-                param.put("end_date", DateUtils.formatDate(endDate));
+            if (!Check.isNull(statDate)) {
+                param.put("start_date", statDate);
+                param.put("end_date", statDate);
             }
             String result = HttpUtils.httpPostRequest(url, param, headers);
             JSONObject resultJson = JSONObject.parseObject(result);
@@ -218,12 +213,12 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
                 log.info("快手视频列表信息为空=》accountId:{}", token.getAccountId());
                 return;
             }
-            List<KuaiShouVideoGet> videoGets = new ArrayList<>();
             for (int i = 0; i < details.size(); i++) {
                 var detailJson = details.getJSONObject(i);
                 var kuaiShouVideoGet = JSONObject.toJavaObject(detailJson, KuaiShouVideoGet.class);
                 kuaiShouVideoGet.setId(token.getAccountId() + kuaiShouVideoGet.getPhotoId());
                 kuaiShouVideoGet.setAccountId(token.getAccountId());
+                kuaiShouVideoGet.setStatDate(DateUtils.parseDate(statDate, "yyyy-MM-dd"));
                 kuaiShouVideoGet.setUpdateTime(new Date());
                 Integer type = MaterialEnum.getTypeBySize(kuaiShouVideoGet.getWidth(), kuaiShouVideoGet.getHeight());
                 if (!Check.isNull(type)) {
@@ -231,7 +226,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
                 }
                 kuaiShouVideoGetService.saveOrUpdate(kuaiShouVideoGet);
             }
-            getVideoListByPage(token, startDate, endDate, page + 1);
+            getVideoListByPage(token, statDate, page + 1);
         } catch (Exception e) {
             e.printStackTrace();
         }
@@ -890,9 +885,9 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
         //获取全量创意数据
         getCreativeList(token, null, null);
         //获取全量视频素材数据
-        getVideoList(token, null, null);
+
         //获取图片信息数据
-        getImageList(token, null, null);
+
 
         getAppList(token.getAccountId(), token.getAccessToken());
 
@@ -903,6 +898,18 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
 
         historyReportTaskService.createTask(token.getAccountId(), token.getAccessToken(), startDate, endDateStr, CtopAdConstant.KUAISHOU_LOAD_JOB_TYPE_HISTORY);
 
+        String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
+        String videoEndDate = DateUtils.addDay(nowDate, -180);
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+        Date end = simpleDateFormat.parse(nowDate);
+        Date start = simpleDateFormat.parse(videoEndDate);
+        List<Date> dates = DateUtils.findDates(start, end);
+        for (int i = 0; i < dates.size(); i++) {
+            String formatDate = simpleDateFormat.format(dates.get(i));
+            getVideoList(token, formatDate);
+            getImageList(token, formatDate);
+        }
+
 
     }
 
@@ -975,6 +982,8 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
      * @param requestJson
      * @return
      */
+
+
     @Override
     public Map<String, Object> adUnitCreate(String accessToken, Long advertiserId, JSONObject requestJson) {
         Map<String, Object> returnMap = new HashMap<>();
@@ -1002,7 +1011,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
                             public void run() {
                                 try {
                                     Thread.sleep(500);
-                                    getGroup(accessToken, advertiserId, unitId);
+                                    getKuaiShouGroupService.getGroupByUnitId(accessToken, advertiserId, unitId);
                                 } catch (InterruptedException e) {
                                     e.printStackTrace();
                                 }
@@ -1187,60 +1196,6 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
     }
 
 
-    /**
-     * 根据 id 获取组
-     *
-     * @param accessToken
-     * @param advertiserId
-     * @param unitId
-     */
-    @Override
-    public void getGroup(String accessToken, Long advertiserId, Long unitId) {
-
-        Map<String, Object> map = new HashMap<>();
-        map.put("unit_id", unitId);
-        map.put("account_id", advertiserId);
-        groupMapper.deleteByMap(map);
-        appInfoMapper.deleteByMap(map);
-        shouScheduleMapper.deleteByMap(map);
-
-        Map<String, String> headers = new HashMap<>();
-        headers.put("Access-Token", accessToken);
-        headers.put("Content-Type", " application/json");
-
-        JSONObject param = new JSONObject();
-        param.put("advertiser_id", advertiserId);
-        param.put("unit_id", unitId);
-
-        String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.GROUP_LIST;
-        try {
-            String result = HttpUtils.kuaiShouhttpPostRequest(url, param.toJSONString(), headers);
-            JSONObject resultJson = JSONObject.parseObject(result);
-            if (!Check.isNull(resultJson)) {
-                Integer code = resultJson.getInteger("code");
-                if (code == 0) {
-                    JSONObject dataJson = resultJson.getJSONObject("data");
-                    if (!Check.isNull(dataJson)) {
-                        JSONArray details = dataJson.getJSONArray("details");
-                        if (!Check.isNull(details)) {
-                            addGroup(advertiserId, details);
-                        }
-
-                    } else {
-                        log.error("获取广告组返回结果异常,advertiserId:{},异常信息:{}", advertiserId, resultJson);
-                    }
-                } else {
-                    log.error("获取广告组返回结果为空,advertiserId:{}", advertiserId);
-                }
-            }
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-
-
-    }
-
-
     private void addGroup(Long advertiserId, JSONArray details) {
         if (!Check.isNull(details)) {
             List<KuaiShouGroup> groups = new ArrayList<>();
@@ -2531,15 +2486,15 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
      * 查询图片列表
      */
     @Override
-    public void getImageList(CtopOauthToken token, Date startDate, Date endDate) {
-        getImageList(token, startDate, endDate, 1);
+    public void getImageList(CtopOauthToken token, String statDate) {
+        getImageList(token, statDate, 1);
     }
 
 
     /**
      * 查询图片列表
      */
-    private void getImageList(CtopOauthToken token, Date startDate, Date endDate, int page) {
+    private void getImageList(CtopOauthToken token, String statDate, int page) {
         try {
             String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.IMAGE_LIST;
             Map<String, String> headers = new HashMap<String, String>();
@@ -2549,9 +2504,9 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
             //传参
             JSONObject param = new JSONObject();
             param.put("advertiser_id", token.getAccountId());
-            if (startDate != null && endDate != null) {
-                param.put("startDate", DateUtils.formatDate(startDate));
-                param.put("endDate", DateUtils.formatDate(endDate));
+            if (!Check.isNull(statDate)) {
+                param.put("startDate", DateUtils.formatDate(statDate));
+                param.put("endDate", DateUtils.formatDate(statDate));
             }
             param.put("page_size", 500);
             param.put("page", page);
@@ -2588,13 +2543,14 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
                 if (!Check.isNull(type)) {
                     kuaiShouImageGet.setMaterialType(type);
                 }
+                kuaiShouImageGet.setStatDate(DateUtils.parseDate(statDate, "yyyy-MM-dd"));
 
                 kuaiShouImageGet.setCreateTime(new Date());
                 kuaiShouImageGet.setUpdateTime(new Date());
                 imageGets.add(kuaiShouImageGet);
             }
             kuaiShouImageGetService.replaceBatch(imageGets);
-            getImageList(token, startDate, endDate, page + 1);
+            getImageList(token, statDate, page + 1);
         } catch (Exception e) {
             e.printStackTrace();
 
@@ -2907,9 +2863,9 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
         JSONObject dataJson = resultJson.getJSONObject("data");
         if (!Check.isNull(dataJson)) {
             Integer total_count = dataJson.getInteger("total_count");
-            if (total_count > 2000) {
+           /* if (total_count > 2000) {
                 return;
-            }
+            }*/
             JSONArray details = dataJson.getJSONArray("details");
             if (Check.isNull(details)) {
                 return;

+ 2 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/graphql/service/impl/KuaishouWebInterfaceServiceImpl.java

@@ -632,6 +632,7 @@ public class KuaishouWebInterfaceServiceImpl implements IKuaishouWebInterfaceSer
     @Override
     public void getkuaishouWebLoginCookie(BindAccountLogin login){
         System.setProperty("webdriver.chrome.driver", chromeDriver);
+
         ChromeDriverService service = new ChromeDriverService.Builder().usingDriverExecutable(new File(chromeDriver)).usingAnyFreePort().build();
         try {
             service.start();
@@ -670,6 +671,7 @@ public class KuaishouWebInterfaceServiceImpl implements IKuaishouWebInterfaceSer
                 cookieList.add(cookieStr);
             }
             login.setCookie(new Gson().toJson(cookieList));
+            login.setUpdateTime(new Date());
             bindAccountLoginService.updateById(login);
         } catch (Exception e) {
             e.printStackTrace();

+ 12 - 4
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/KuaiShouYiCheReportController.java

@@ -117,7 +117,9 @@ public class KuaiShouYiCheReportController {
             android.add(androidJson.getString("agent"));
             android.add(androidJson.getString("media"));
             android.add(androidJson.getString("systemType"));
-            android.add(androidJson.getString("statDate").replace("-","/"));
+            if (!Check.isNull(androidJson.getString("statDate"))) {
+                android.add(androidJson.getString("statDate").replace("-", "/"));
+            }
             android.add(androidJson.getBigDecimal("charge"));
             android.add(androidJson.getBigDecimal("cashCost"));
             android.add(androidJson.getLong("photoShow"));
@@ -151,7 +153,9 @@ public class KuaiShouYiCheReportController {
             ios.add(iosJson.getString("agent"));
             ios.add(iosJson.getString("media"));
             ios.add(iosJson.getString("systemType"));
-            ios.add(iosJson.getString("statDate").replace("-","/"));
+            if (!Check.isNull(iosJson.getString("statDate"))) {
+                ios.add(iosJson.getString("statDate").replace("-", "/"));
+            }
             ios.add(iosJson.getBigDecimal("charge"));
             ios.add(iosJson.getBigDecimal("cashCost"));
             ios.add(iosJson.getLong("photoShow"));
@@ -183,7 +187,9 @@ public class KuaiShouYiCheReportController {
             directApplication.add(directApplicationJson.getString("agent"));
             directApplication.add(directApplicationJson.getString("media"));
             directApplication.add(directApplicationJson.getString("systemType"));
-            directApplication.add(directApplicationJson.getString("statDate").replace("-","/"));
+            if (!Check.isNull(directApplicationJson.getString("statDate"))) {
+                directApplication.add(directApplicationJson.getString("statDate").replace("-", "/"));
+            }
             directApplication.add(directApplicationJson.getBigDecimal("charge"));
             directApplication.add(directApplicationJson.getBigDecimal("cashCost"));
             directApplication.add(directApplicationJson.getLong("photoShow"));
@@ -216,7 +222,9 @@ public class KuaiShouYiCheReportController {
                 List<Object> channelSubcontracting = new ArrayList();
                 channelSubcontracting.add(channelSubcontractingJson.getString("agent"));
                 channelSubcontracting.add(channelSubcontractingJson.getString("systemType"));
-                channelSubcontracting.add(channelSubcontractingJson.getString("statDate").replace("-","/"));
+                if (!Check.isNull(channelSubcontractingJson.getString("statDate"))) {
+                    channelSubcontracting.add(channelSubcontractingJson.getString("statDate").replace("-", "/"));
+                }
                 channelSubcontracting.add(channelSubcontractingJson.getString("campaignName"));
                 channelSubcontracting.add(channelSubcontractingJson.getBigDecimal("charge"));
                 channelSubcontracting.add(channelSubcontractingJson.getBigDecimal("cashCost"));

+ 0 - 2
performance-appraisal/src/main/java/cn/com/ctop/uservideomap/controller/UserVideoMapController.java

@@ -16,8 +16,6 @@ import org.jeecg.common.util.oConvertUtils;
 import cn.com.ctop.uservideomap.entity.UserVideoMap;
 import cn.com.ctop.uservideomap.service.IUserVideoMapService;
 
-import java.util.Date;
-
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

+ 1 - 0
pom.xml

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