|
@@ -0,0 +1,83 @@
|
|
|
+package org.jeecg.modules.ads.service.impl;
|
|
|
+
|
|
|
+import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouReportDailyMaterialMapper;
|
|
|
+import cn.com.ctop.kuaishou.modules.report.entity.KuaiShouReportDailyMaterial;
|
|
|
+import cn.hutool.json.JSON;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+import io.swagger.models.auth.In;
|
|
|
+//import jdk.nashorn.internal.parser.JSONParser;
|
|
|
+import org.jeecg.modules.ads.entity.AiKuaishouStrategyTemplate;
|
|
|
+import org.jeecg.modules.ads.mapper.AiKuaishouStrategyTemplateMapper;
|
|
|
+import org.jeecg.modules.ads.service.Test;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+@Service
|
|
|
+public class TestImpl implements Test {
|
|
|
+
|
|
|
+ private KuaiShouReportDailyMaterialMapper dailyMaterialMapper;
|
|
|
+ private AiKuaishouStrategyTemplateMapper strategyTemplateMapper;
|
|
|
+ @Override
|
|
|
+ public int f() {
|
|
|
+ return 123;
|
|
|
+ }
|
|
|
+
|
|
|
+ private static int printInt(int a){
|
|
|
+ System.out.println(a);
|
|
|
+ return a;
|
|
|
+ }
|
|
|
+
|
|
|
+ public static String getStrategy(){
|
|
|
+
|
|
|
+
|
|
|
+ /* String materialCombinationMode = "{'highQualityMaterial':{'intervalDays':7, 'highQualityMaterialNum':5}, 'newMaterialNum':5}";
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(materialCombinationMode);
|
|
|
+
|
|
|
+ int intervalDays = (int) jsonObject.getJSONObject("highQualityMaterial").get("intervalDays");
|
|
|
+ int highQualityMaterialNum = (int) jsonObject.getJSONObject("highQualityMaterial").get("highQualityMaterialNum");
|
|
|
+ int newQualityMaterialNum = (int) jsonObject.get("newMaterialNum");*/
|
|
|
+
|
|
|
+ return "213";
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ public List<String> getMaterialId(){
|
|
|
+ // 获取素材组合方式
|
|
|
+ // 下面这三个字段从前端传给的JSON数据进行解析得到
|
|
|
+ Long accountId = 7087890L;
|
|
|
+ Integer strategyType = 1;
|
|
|
+ List<AiKuaishouStrategyTemplate> StrategyTemplate =
|
|
|
+ strategyTemplateMapper.getStrategyTemplate(accountId,strategyType);
|
|
|
+
|
|
|
+ String materialCombinationMode = StrategyTemplate.get(0).getMaterialCombinationMode();
|
|
|
+ JSONObject JsonObject = JSONObject.parseObject(materialCombinationMode);
|
|
|
+ Integer intervalDays = (Integer) JsonObject.getJSONObject("highQualityMaterial").get("intervalDays");
|
|
|
+ Integer highQualityMaterialNum = (Integer) JsonObject.getJSONObject("highQualityMaterial").get("highQualityMaterialNum");
|
|
|
+ Integer newQualityMaterialNum = (Integer) JsonObject.get("newMaterialNum");
|
|
|
+
|
|
|
+ // 获取优质素材的签名
|
|
|
+ List<String> materialIds = new ArrayList<>();
|
|
|
+ List<KuaiShouReportDailyMaterial> highQualityMaterialIds =
|
|
|
+ dailyMaterialMapper.getHighQualityMaterialId(accountId,intervalDays,highQualityMaterialNum);
|
|
|
+ for (KuaiShouReportDailyMaterial item: highQualityMaterialIds){
|
|
|
+ materialIds.add(item.getSignature());
|
|
|
+ }
|
|
|
+
|
|
|
+ // 获取最新上线素材的签名
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ return materialIds;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void main(String[] args) {
|
|
|
+ int getNum = 123;
|
|
|
+ int num = printInt(getNum);
|
|
|
+ System.out.println(num++);
|
|
|
+ }
|
|
|
+
|
|
|
+}
|