yumeng 5 jaren geleden
bovenliggende
commit
2744cb5836

+ 10 - 0
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/DateUtils.java

@@ -32,6 +32,16 @@ public class DateUtils extends PropertyEditorSupport {
     private static final long SECOND_IN_MILLIS = 1000L;
 
 
+
+    public static Date getNowDate() throws ParseException {
+        SimpleDateFormat dsdf = new SimpleDateFormat("yyyy-MM-dd");
+        String nowDate = getNowDate("yyyy-MM-dd");
+        Date parse = dsdf.parse(nowDate);
+        return parse;
+
+    }
+
+
     public static boolean compare(String beginDate, String nowDate) throws ParseException {
         //如果想比较日期则写成"yyyy-MM-dd"就可以了
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");

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

@@ -58,9 +58,9 @@ spring:
   autoconfigure:
     exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
   datasource:
-    url: jdbc:mysql://172.30.0.4:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
-    username: hcst
-    password: test@20190531
+    url: jdbc:mysql://139.186.31.213:6033/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
+    username: sync
+    password: sync@2020
     driver-class-name: com.mysql.jdbc.Driver
     druid:
       stat-view-servlet:
@@ -97,9 +97,9 @@ spring:
         connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
       datasource:
         master:
-          url: jdbc:mysql://172.30.0.4:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
-          username: hcst
-          password: test@20190531
+          url: jdbc:mysql://139.186.31.213:6033/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
+          username: sync
+          password: sync@2020
           driver-class-name: com.mysql.jdbc.Driver
           # 多数据源配置
           #multi-datasource1:

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

@@ -58,9 +58,9 @@ spring:
   autoconfigure:
     exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
   datasource:
-    url: jdbc:mysql://172.30.0.4:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
-    username: hcst
-    password: test@20190531
+    url: jdbc:mysql://139.186.31.213:6033/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
+    username: sync
+    password: sync@2020
     driver-class-name: com.mysql.jdbc.Driver
     druid:
       stat-view-servlet:
@@ -97,9 +97,9 @@ spring:
         connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
       datasource:
         master:
-          url: jdbc:mysql://172.30.0.4:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
-          username: hcst
-          password: test@20190531
+          url: jdbc:mysql://139.186.31.213:6033/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
+          username: sync
+          password: sync@2020
           driver-class-name: com.mysql.jdbc.Driver
           # 多数据源配置
           #multi-datasource1:

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

@@ -13,7 +13,6 @@ import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.KuaishouInterfaceConstant;
 import cn.com.ctop.common.module.utils.LoadFileUtil;
 import cn.com.ctop.common.module.utils.PropertiesUtils;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouVideoGet;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouVideoGetService;
 import cn.com.ctop.manage.modules.material.service.IMaterialUploadImageService;
 import cn.com.ctop.manage.modules.material.service.IMaterialUploadService;
@@ -21,7 +20,6 @@ import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import lombok.extern.slf4j.Slf4j;
-import 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;
@@ -35,7 +33,6 @@ import org.springframework.util.MultiValueMap;
 import org.springframework.web.client.RestTemplate;
 
 import java.io.File;
-import java.util.Date;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.concurrent.ExecutorService;
@@ -199,8 +196,10 @@ public class MaterialUploadServiceImpl implements IMaterialUploadService {
                                     if (resultJson.getInteger("code") == 0) {
                                         JSONObject dataJson = resultJson.getJSONObject("data");
                                         if (!Check.isNull(dataJson)) {
-                                            String photoId = dataJson.getString("photo_id");
+
                                             String signature = dataJson.getString("signature");
+                                           /*
+                                             String photoId = dataJson.getString("photo_id");
                                             KuaiShouVideoGet videoGet = new KuaiShouVideoGet();
                                             videoGet.setAccountId(accountId);
                                             videoGet.setId(accountId + photoId);
@@ -226,8 +225,8 @@ public class MaterialUploadServiceImpl implements IMaterialUploadService {
                                             videoGet.setStatDate(DateUtils.parseDate(nowDate, "yyyy-MM-dd"));
                                             videoGet.setCoverUrl(materialInfo.getUrl() + "?x-oss-process=video/snapshot,t_0,m_fast");
                                             videoGet.setUploadDate(new Date());
-                                            kuaiShouVideoGetService.saveOrUpdate(videoGet);
-                                            materialUploadImageService.uploadImage(videoGet.getSignature(), accountId, ctopOauthToken.getAccessToken());
+                                            kuaiShouVideoGetService.saveOrUpdate(videoGet);*/
+                                            materialUploadImageService.uploadImage(signature, accountId, ctopOauthToken.getAccessToken());
 
                                         }
                                         log.info("快手素材同步完成,accountId:{},code:{},返回信息:{}", accountId, materialInfo.getCode(), resultJson);

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

@@ -30,6 +30,7 @@ import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
 import java.math.BigDecimal;
+import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 
@@ -115,6 +116,25 @@ public class BatchController {
             spendVo.setBudget(budget);
             result.setSuccess(true);
             result.setResult(spendVo);
+
+            String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
+            String anotherDay = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -1);
+
+            List dateList = new ArrayList();
+            dateList.add(nowDate);
+            dateList.add(anotherDay);
+
+
+            Thread planThread = new Thread() {
+                @Override
+                public void run() {
+                    iKuaishouInterfaceService.getCampaignList(oauthToken, new java.util.Date(), new java.util.Date());
+
+                }
+            };
+            planThread.start();
+
+
             Thread thread = new Thread() {
                 @Override
                 public void run() {
@@ -131,13 +151,22 @@ public class BatchController {
             };
             thread1.start();
 
-            Thread thread2 = new Thread() {
-                @Override
-                public void run() {
-                    iKuaishouInterfaceService.getVideoList(oauthToken, DateUtils.getNowDate("yyyy-MM-dd"));
-                }
-            };
-            thread2.start();
+            for (int i = 0; i < dateList.size(); i++) {
+                String date = (String) dateList.get(i);
+                Thread thread2 = new Thread() {
+                    @Override
+                    public void run() {
+                        iKuaishouInterfaceService.getVideoList(oauthToken, date);
+                    }
+                };
+                thread2.start();
+
+
+
+
+            }
+
+
 
             Thread thread3 = new Thread() {
                 @Override