瀏覽代碼

測試提交

liyuyi@c-top.com.cn 4 年之前
父節點
當前提交
d62be7446a
共有 14 個文件被更改,包括 202 次插入25 次删除
  1. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ads/entity/AiKuaishouStrategy.java
  2. 0 14
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ads/mapper/AiKuaishouStrategyMapper.java
  3. 20 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ads/mapper/AiKuaishouStrategyTemplateMapper.java
  4. 0 5
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ads/mapper/xml/AiKuaishouStrategyMapper.xml
  5. 19 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ads/mapper/xml/AiKuaishouStrategyTemplateMapper.xml
  6. 2 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ads/service/IAiKuaishouStrategyService.java
  7. 5 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ads/service/Test.java
  8. 3 3
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ads/service/impl/AiKuaishouStrategyServiceImpl.java
  9. 83 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ads/service/impl/TestImpl.java
  10. 7 0
      jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java
  11. 4 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/CustomDataByAccountMapper.java
  12. 6 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaiShouReportDailyMaterialMapper.java
  13. 26 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouReportDailyMaterialMapper.xml
  14. 26 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouVideoGetMapper.xml

+ 1 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ads/entity/AiKuaishouStrategy.java

@@ -15,7 +15,7 @@ import java.util.Date;
  */
 @Data
 @TableName("ctop_ai_kuaishou_strategy")
-public class AiKuaishouStrategy {
+public class AiKuaishouStrategyTemplate {
 
 	/**id*/
 	@TableId(type = IdType.AUTO)

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

@@ -1,14 +0,0 @@
-package org.jeecg.modules.ads.mapper;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import org.jeecg.modules.ads.entity.AiKuaishouStrategy;
-
-/**
- * 智能投放策略信息
- * @author: jeecg-boot
- * @date:   2020-12-10
- * @cersion: V1.0
- */
-public interface AiKuaishouStrategyMapper extends BaseMapper<AiKuaishouStrategy> {
-
-}

+ 20 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ads/mapper/AiKuaishouStrategyTemplateMapper.java

@@ -0,0 +1,20 @@
+package org.jeecg.modules.ads.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+import org.jeecg.modules.ads.entity.AiKuaishouStrategyTemplate;
+
+import java.util.List;
+
+/**
+ * 智能投放策略信息
+ * @author: jeecg-boot
+ * @date:   2020-12-10
+ * @cersion: V1.0
+ */
+public interface AiKuaishouStrategyTemplateMapper extends BaseMapper<AiKuaishouStrategyTemplate> {
+    List<AiKuaishouStrategyTemplate> getStrategyTemplate(@Param(value = "accountId") Long accountId,
+                                                         @Param(value = "strategyType") Integer strategyType);
+
+
+}

+ 0 - 5
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ads/mapper/xml/AiKuaishouStrategyMapper.xml

@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="org.jeecg.modules.ads.mapper.AiKuaishouStrategyMapper">
-
-</mapper>

+ 19 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ads/mapper/xml/AiKuaishouStrategyTemplateMapper.xml

@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.jeecg.modules.ads.mapper.AiKuaishouStrategyTemplateMapper">
+
+
+    <select id="getStrategyTemplate" resultType="org.jeecg.modules.ads.entity.AiKuaishouStrategyTemplate">
+        select * from ctop_ai_kuaishou_strategy_template
+        where 1=1
+        <if test="accountId!=null">
+            and account_id = #{accountId}
+        </if>
+        <if test="strategyType!=null">
+            and strategy_type = #{strategyType}
+        </if>
+            and status = 1
+    </select>
+
+
+</mapper>

+ 2 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ads/service/IAiKuaishouStrategyService.java

@@ -1,7 +1,7 @@
 package org.jeecg.modules.ads.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
-import org.jeecg.modules.ads.entity.AiKuaishouStrategy;
+import org.jeecg.modules.ads.entity.AiKuaishouStrategyTemplate;
 
 /**
  * @Description: 智能投放策略信息
@@ -9,6 +9,6 @@ import org.jeecg.modules.ads.entity.AiKuaishouStrategy;
  * @Date:   2020-12-10
  * @Version: V1.0
  */
-public interface IAiKuaishouStrategyService extends IService<AiKuaishouStrategy> {
+public interface IAiKuaishouStrategyService extends IService<AiKuaishouStrategyTemplate> {
 
 }

+ 5 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ads/service/Test.java

@@ -0,0 +1,5 @@
+package org.jeecg.modules.ads.service;
+
+public interface Test {
+    int f();
+}

+ 3 - 3
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ads/service/impl/AiKuaishouStrategyServiceImpl.java

@@ -1,8 +1,8 @@
 package org.jeecg.modules.ads.service.impl;
 
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import org.jeecg.modules.ads.entity.AiKuaishouStrategy;
-import org.jeecg.modules.ads.mapper.AiKuaishouStrategyMapper;
+import org.jeecg.modules.ads.entity.AiKuaishouStrategyTemplate;
+import org.jeecg.modules.ads.mapper.AiKuaishouStrategyTemplateMapper;
 import org.jeecg.modules.ads.service.IAiKuaishouStrategyService;
 import org.springframework.stereotype.Service;
 
@@ -13,6 +13,6 @@ import org.springframework.stereotype.Service;
  * @version V1.0
  */
 @Service
-public class AiKuaishouStrategyServiceImpl extends ServiceImpl<AiKuaishouStrategyMapper, AiKuaishouStrategy> implements IAiKuaishouStrategyService {
+public class AiKuaishouStrategyTemplateServiceImpl extends ServiceImpl<AiKuaishouStrategyTemplateMapper, AiKuaishouStrategyTemplate> implements IAiKuaishouStrategyService {
 
 }

+ 83 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ads/service/impl/TestImpl.java

@@ -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++);
+    }
+
+}

+ 7 - 0
jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java

@@ -365,5 +365,12 @@ public class SampleTest {
             videoReportDailyService.videoInfoList(date, date);
         }
     }
+    @Autowired
+    private org.jeecg.modules.ads.service.Test test;
+
+    @Test
+    public void test(){
+        test.f();
+    }
 
 }

+ 4 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/CustomDataByAccountMapper.java

@@ -14,6 +14,10 @@ public interface CustomDataByAccountMapper {
     //快手查询账户日报数据
     JSONObject queryKsAccountData(@Param("accountId") Long accountId,@Param("date") String date);
 
+
+    //快手查询物料日报数据
+    JSONObject queryKsMaterialData(@Param("accountId") Long accountId,@Param("days") Integer days);
+
     //头条查询广告组日报数据
     JSONObject queryByCampaignData(@Param("accountId") Long accountId,@Param("date") String date);
 

+ 6 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaiShouReportDailyMaterialMapper.java

@@ -29,4 +29,10 @@ public interface KuaiShouReportDailyMaterialMapper extends BaseMapper<KuaiShouRe
     List<KuaiShouVideoGetVo> getVideoList(Map<String, Object> requestMap);
 
     void batchReplace(@Param("addList") List<KuaiShouReportDailyMaterial> addList);
+
+
+    List<KuaiShouReportDailyMaterial> getHighQualityMaterialId(@Param(value = "accountId") Long accountId,
+                                                               @Param(value = "days") Integer days,
+                                                               @Param(value = "highQualityNum") Integer highQualityNum);
+
 }

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

@@ -318,4 +318,30 @@
     </select>
 
 
+
+    <select id="getHighQualityMaterialId" resultType="com.xxl.job.executor.report.entity.KuaiShouReportDailyMaterial">
+    /*
+    根据account_id,获取project_id
+    得到该项目下,近 days 内,素材消耗排名前 num 的素材签名
+    */
+        select
+        material.signature
+        from
+        ctop_kuaishou_report_daily_material material
+        left join
+        ctop_user_allocation allocation
+        on material.account_id = allocation.account_id
+        where  allocation.project_id in
+               (select project_id from ctop_user_allocation where 1=1
+                                                              <if test="accountId!=null">
+                                                              and account_id = #{accountId}
+                                                              </if>)
+        and  to_days(now()) - to_days(material.stat_date) &lt;=  #{days}
+        and material.signature is not null
+        GROUP BY material.signature
+        order by sum_charge desc
+        limit #{highQualityNum}
+    </select>
+
+
 </mapper>

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

@@ -57,4 +57,30 @@
         order by stat_date desc
     </select>
 
+
+
+    <select id="getNewMaterialSignature" parameterType="java.util.Map"
+            resultType="cn.com.ctop.kuaishou.modules.batch.entity.vo.KuaiShouVideoGetVo">
+        select
+        stat_date as 'statDate',
+        photo_id as 'photoId',
+        url as 'url',
+        cover_url as 'coverUrl',
+        signature as 'signature',
+        material_type as 'materialType'
+        from ctop_kuaishou_video_get
+        where account_id = #{accountId}
+        and channel_type = #{channelType}
+        and material_type = #{materialType}
+        and status = 0
+        <if test="startDate != null and startDate != '' ">
+            and stat_date &gt;= #{startDate}
+        </if>
+        <if test="endDate != null and endDate != '' ">
+            and stat_date &lt;= #{endDate}
+        </if>
+        group by signature
+        order by stat_date desc
+    </select>
+
 </mapper>