Browse Source

基建数

yumeng 3 năm trước cách đây
mục cha
commit
13763fe113

+ 17 - 6
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/KuaishouPlanCreate.java

@@ -84,12 +84,7 @@ public class KuaishouPlanCreate {
     @Excel(name = "自动化新建组数", width = 15)
     @ApiModelProperty(value = "自动化新建组数")
     private Integer autoUnit;
-    /**
-     * 手动新建组数
-     */
-    @Excel(name = "手动新建组数", width = 15)
-    @ApiModelProperty(value = "手动新建组数")
-    private Integer manualUnit;
+
     /**
      * 有效新建组数
      */
@@ -97,6 +92,22 @@ public class KuaishouPlanCreate {
     @ApiModelProperty(value = "有效新建组数")
     private Integer effectiveUnit;
     /**
+     * 智能托管计划数
+     */
+    private Integer hostingPlans;
+
+    /**
+     * 批量工具搭建组数量(不包含智能托管)
+     */
+    private Integer batchUnit;
+
+
+    /**
+     * 媒体后台组搭建数(含智能托管)
+     */
+    private Integer mediaUnit;
+
+    /**
      * 创建时间
      */
     @Excel(name = "创建时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")

+ 7 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouPlanCreateMapper.java

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.Date;
+import java.util.List;
 
 /**
  * 快手-计划创建记录
@@ -26,4 +27,10 @@ public interface KuaishouPlanCreateMapper extends BaseMapper<KuaishouPlanCreate>
     Integer getEffectiveUnit(@Param("accountId") Long accountId, @Param("startDate") Date startDate, @Param("endDate") Date endDate);
 
     String getCompanyId(@Param("userId") String userId);
+
+    Integer getHostPlan(@Param("accountId") Long accountId, @Param("startDate") Date startDate, @Param("endDate") Date endDate);
+
+    Integer getBatchUnit(@Param("accountId") Long accountId, @Param("startDate") Date startDate, @Param("endDate") Date endDate);
+
+    Integer getMediaCount(@Param("accountId") Long accountId, @Param("startDate") Date startDate, @Param("endDate") Date endDate);
 }

+ 39 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouPlanCreateMapper.xml

@@ -11,7 +11,7 @@
        and put_create_time &lt;= #{endDate}
     </select>
     <select id="getNewUnit" resultType="java.lang.Integer">
-         SELECT count(1)  from  ctop_kuaishou_group WHERE account_id = #{accountId}
+       SELECT count(1)  from  ctop_kuaishou_group WHERE account_id = #{accountId}
        and group_create_time &gt;= #{startDate}
        and group_create_time &lt;= #{endDate}
     </select>
@@ -41,4 +41,42 @@
     <select id="getCompanyId" resultType="java.lang.String">
        SELECT company_id  from  user_company WHERE user_id = #{userId}
     </select>
+    <select id="getHostPlan" resultType="java.lang.Integer">
+        SELECT
+        count(1)
+        FROM
+        ctop_kuaishou_hosting_task
+        WHERE
+        account_id = #{accountId}
+        AND create_time &gt;= #{startDate}
+        AND create_time  &lt;= #{endDate}
+        AND task_status = 3
+    </select>
+    <select id="getBatchUnit" resultType="java.lang.Integer">
+        SELECT count(1)  from  ctop_kuaishou_group WHERE account_id = #{accountId}
+       and group_create_time &gt;= #{startDate}
+       and group_create_time &lt;= #{endDate}
+       and  create_channel = 1
+    </select>
+    <select id="getMediaCount" resultType="java.lang.Integer">
+        SELECT
+        count(1)
+        FROM
+        ctop_kuaishou_group
+        WHERE
+        account_id = #{accountId}
+        AND create_channel = 0
+        and group_create_time &gt;= #{startDate}
+        and group_create_time &lt;= #{endDate}
+        AND campaign_id not IN (
+        SELECT
+        campaign_id
+        FROM
+        ctop_kuaishou_hosting_task
+        WHERE
+        account_id = #{accountId}
+        AND task_status = 3
+        AND campaign_id IS NOT NULL
+        );
+    </select>
 </mapper>

+ 15 - 8
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaishouPlanCreateServiceImpl.java

@@ -50,16 +50,23 @@ public class KuaishouPlanCreateServiceImpl extends ServiceImpl<KuaishouPlanCreat
         create.setNewUnit(newUnitCount);
         Integer autoUnitCount = planCreateMapper.getAutoUnit(accountId, startDate, endDate);
         create.setAutoUnit(autoUnitCount);
-        if (newUnitCount != 0) {
-            Integer manualUnit = newUnitCount - autoUnitCount;
-            if (manualUnit > 0) {
-                create.setManualUnit(manualUnit);
-            } else {
-                create.setManualUnit(0);
-            }
+
+        // 智能托管新建计划数(助手)
+        Integer hostPlan = planCreateMapper.getHostPlan(accountId, startDate, endDate);
+        create.setHostingPlans(hostPlan);
+
+        // 批量工具创建组数量
+        Integer batch = planCreateMapper.getBatchUnit(accountId, startDate, endDate);
+        if (batch != 0) {
+            Integer batchCount = batch - autoUnitCount;
+            create.setBatchUnit(batchCount);
         } else {
-            create.setManualUnit(0);
+            create.setBatchUnit(0);
         }
+        // 媒体后台创建组数量 (不包含助手智能托管组)
+        Integer mediaCount = planCreateMapper.getMediaCount(accountId, startDate, endDate);
+        create.setMediaUnit(mediaCount);
+
         Integer effectiveUnitCount = planCreateMapper.getEffectiveUnit(accountId, startDate, endDate);
         create.setEffectiveUnit(effectiveUnitCount);
         int insert = planCreateMapper.insert(create);