ソースを参照

Merge remote-tracking branch 'origin/test' into test

syh 5 年 前
コミット
825230d5ca

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

@@ -8,6 +8,7 @@ import cn.com.ctop.common.module.mapper.CtopOauthTokenMapper;
 import cn.com.ctop.common.module.mapper.MaterialInfoMapper;
 import cn.com.ctop.common.module.mapper.MaterialParameterMapper;
 import cn.com.ctop.common.module.service.IFileInfoService;
+import cn.com.ctop.common.module.service.IMaterialParameterService;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.KuaishouInterfaceConstant;
 import cn.com.ctop.common.module.utils.LoadFileUtil;
@@ -64,6 +65,12 @@ public class MaterialUploadServiceImpl implements IMaterialUploadService {
     private IFileInfoService fileInfoService;
     @Autowired
     private IKuaiShouImageGetService iKuaiShouImageGetService;
+    @Autowired
+    private IMaterialParameterService materialParameterService;
+    @Autowired
+    private MaterialParameterMapper parameterMapper;
+    @Autowired
+    private IKuaiShouVideoGetService kuaiShouVideoGetService;
 
 
     /**
@@ -139,10 +146,6 @@ public class MaterialUploadServiceImpl implements IMaterialUploadService {
 
     }
 
-    @Autowired
-    private MaterialParameterMapper parameterMapper;
-    @Autowired
-    private IKuaiShouVideoGetService kuaiShouVideoGetService;
 
     private void kuaiShouUpload(String mediaId, JSONArray materialArray, JSONArray accountArray) {
         for (int j = 0; j < materialArray.size(); j++) {
@@ -164,6 +167,16 @@ public class MaterialUploadServiceImpl implements IMaterialUploadService {
                 JSONObject requestJson = new JSONObject();
                 requestJson.put("file", resource);
                 requestJson.put("signature", materialInfo.getCode());
+                QueryWrapper<MaterialParameter> parameterQueryWrapper = new QueryWrapper<>();
+                parameterQueryWrapper.eq("material_id", materialInfo.getId());
+                parameterQueryWrapper.orderByDesc("create_time").last("limit 1");
+                MaterialParameter materialParameter = materialParameterService.getOne(parameterQueryWrapper);
+                if (!Check.isNull(materialParameter)) {
+                    Integer type = MaterialEnum.getTypeBySize(Integer.valueOf(materialParameter.getWidth()), Integer.valueOf(materialParameter.getHeight()));
+                    if (!Check.isNull(type) && type != 0) {
+                        requestJson.put("type", type);
+                    }
+                }
                 for (int i = 0; i < accountArray.size(); i++) {
                     Long accountId = accountArray.getLong(i);
                     QueryWrapper<CtopOauthToken> tokenQueryWrapper = new QueryWrapper<>();

+ 1 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouGroupMapper.xml

@@ -84,7 +84,7 @@
    unit_name
    FROM ctop_kuaishou_group
    WHERE account_id = #{accountId}
-   and deep_conversion_bid &gt; #{maxDeepCpaBid}
+   and deep_conversion_bid &gt; #{maxBid}
    group by unit_id
     </select>
 

+ 3 - 3
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/job/KuaishouReportAgentJob.java

@@ -30,10 +30,10 @@ public class KuaishouReportAgentJob implements Job {
     private IKuaishouReportDailyAgentService kuaishouReportDailyAgentService;
     @Override
     public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
-//        String currentDate = DateUtils.formatDate(DateUtils.addDay(new Date(),-1));
-//        kuaishouReportDailyAgentService.getReport(currentDate,currentDate);
+        String currentDate = DateUtils.formatDate(DateUtils.addDay(new Date(),-1));
+        kuaishouReportDailyAgentService.getReport(currentDate,currentDate);
 
-        kuaishouReportDailyAgentService.getReport("2019-01-01","2019-12-12");
+        //kuaishouReportDailyAgentService.getReport("2019-01-01","2019-12-12");
 
     }
 }

+ 1 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaishouReportDailyAgentServiceImpl.java

@@ -48,7 +48,7 @@ public class KuaishouReportDailyAgentServiceImpl extends ServiceImpl<KuaishouRep
     }
 
     public void getReport(String startDate,String endDate){
-        System.getProperties().setProperty("webdriver.chrome.driver", "D:/chromedriver.exe");
+        System.getProperties().setProperty("webdriver.chrome.driver", chromeDriver);
         String url = "https://agent.e.kuaishou.com";
         ChromeOptions chromeOptions = new ChromeOptions();
         chromeOptions.addArguments("--headless");