ソースを参照

图片素材增加总计

jiequan.bi 4 年 前
コミット
69689ef659

+ 9 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ImageCostController.java

@@ -35,6 +35,10 @@ public class ImageCostController {
         return imageReportDailyService.bytedanceImageCost(data);
     }
 
+    @PostMapping("bytedance/costTotal")
+    public Map<String,Object> bytedanceImageCostTotal(@RequestBody JSONObject data){
+        return imageReportDailyService.bytedanceImageCostTotal(data);
+    }
     @PostMapping("bytedance/cost/export")
     public void bytedanceImageCostExport(@RequestBody JSONObject data, HttpServletResponse response) throws IOException {
         SheetInfoVo vo = imageReportDailyService.getbytedanceImageCostVo(data);
@@ -56,6 +60,11 @@ public class ImageCostController {
         return imageReportDailyService.kuaishouImageCost(data);
     }
 
+    @PostMapping("kuaishou/costTotal")
+    public Map<String,Object> kuaishouImageCostTotal(@RequestBody JSONObject data){
+        return imageReportDailyService.kuaishouImageCostTotal(data);
+    }
+
     @PostMapping("kuaishou/cost/export")
     public void kuaishouImageCostExport(@RequestBody JSONObject data, HttpServletResponse response) throws IOException {
         SheetInfoVo vo = imageReportDailyService.getkuaishouImageCostVo(data);

+ 4 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/IImageReportDailyService.java

@@ -8,8 +8,12 @@ import java.util.Map;
 public interface IImageReportDailyService {
     Map<String,Object> bytedanceImageCost(JSONObject data);
 
+    Map<String,Object> bytedanceImageCostTotal(JSONObject data);
+
     Map<String, Object> kuaishouImageCost(JSONObject data);
 
+    Map<String,Object> kuaishouImageCostTotal(JSONObject data);
+
     SheetInfoVo getkuaishouImageCostVo(JSONObject data);
 
     SheetInfoVo getbytedanceImageCostVo(JSONObject data);

+ 50 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/ImageReportDailyServiceImpl.java

@@ -56,7 +56,8 @@ public class ImageReportDailyServiceImpl implements IImageReportDailyService {
             code = null;
         }
         Integer pageSize = data.getInteger("pageSize");
-        Integer pageNumber = data.getInteger("pageNumber");
+        Integer pageNumber = data.getInteger("pageNumber")
+                ;
         if(null == pageNumber||pageNumber ==0){
             pageNumber = 1;
         }
@@ -72,6 +73,30 @@ public class ImageReportDailyServiceImpl implements IImageReportDailyService {
     }
 
     @Override
+    public Map<String, Object> bytedanceImageCostTotal(JSONObject data) {
+        Map<String,Object>result = new HashMap<>();
+        String startDate = data.getString("startDate");
+        if(null == startDate|| "".equals(startDate.trim())){
+            startDate = null;
+        }
+        String endDate = data.getString("endDate");
+        if(null == endDate|| "".equals(endDate.trim())){
+            endDate = null;
+        }
+        JSONArray accountList = data.getJSONArray("accountList");
+        if(null==accountList||accountList.isEmpty()){
+            accountList = null;
+        }
+        String code = data.getString("code");
+        if(null == code|| "".equals(code.trim())){
+            code = null;
+        }
+        result.put("data",bytedanceReportMaterialDailyMapper.bytedanceImageCostTotal(startDate,endDate,accountList,code));
+        ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
+        return result;
+    }
+
+    @Override
     public SheetInfoVo getbytedanceImageCostVo(JSONObject data) {
         SheetInfoVo sheetInfoVo = new SheetInfoVo<BytedanceImageCostVOEntity>();
         String order = data.getString("order");
@@ -147,6 +172,30 @@ public class ImageReportDailyServiceImpl implements IImageReportDailyService {
     }
 
     @Override
+    public Map<String, Object> kuaishouImageCostTotal(JSONObject data) {
+        Map<String,Object>result = new HashMap<>();
+        String startDate = data.getString("startDate");
+        if(null == startDate|| "".equals(startDate.trim())){
+            startDate = null;
+        }
+        String endDate = data.getString("endDate");
+        if(null == endDate|| "".equals(endDate.trim())){
+            endDate = null;
+        }
+        JSONArray accountList = data.getJSONArray("accountList");
+        if(null==accountList||accountList.isEmpty()){
+            accountList = null;
+        }
+        String code = data.getString("code");
+        if(null == code|| "".equals(code.trim())){
+            code = null;
+        }
+        result.put("data",kuaishouReportDailyImageMapper.imageCostTotal(startDate,endDate,accountList,code));
+        ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
+        return result;
+    }
+
+    @Override
     public SheetInfoVo getkuaishouImageCostVo(JSONObject data) {
         SheetInfoVo sheetInfoVo = new SheetInfoVo<KuaishouImageCostVOEntity>();
         String order = data.getString("order");

+ 0 - 2
module-common/src/main/java/cn/com/ctop/common/module/vo/BytedanceImageCostVO.java

@@ -15,8 +15,6 @@ public class BytedanceImageCostVO implements Serializable {
     private Long click;
     private Long showNum;
     private Long convert;
-    private String userId;
-    private String userName;
     private BigDecimal clickRate;
     private BigDecimal convertRate;
     private BigDecimal convertCost;

+ 0 - 1
module-common/src/main/java/cn/com/ctop/common/module/vo/KuaishouImageCostVO.java

@@ -25,5 +25,4 @@ public class KuaishouImageCostVO implements Serializable {
     Long formCount;
     Long eventJinJianApp;
     Long eventCreditGrantApp;
-    String userName;
 }

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

@@ -26,6 +26,11 @@ public interface KuaishouReportDailyImageMapper extends BaseMapper<KuaishouRepor
                                         @Param(value = "order")String order,
                                         @Param(value = "target")String target);
 
+    KuaishouImageCostVO imageCostTotal(@Param(value = "startDate") String startDate,
+                                        @Param(value = "endDate")String endDate,
+                                        @Param(value = "accountList")JSONArray accountList,
+                                        @Param(value = "code")String code);
+
     void updateImageReportCode();
 
     List<KuaishouImageCostVOEntity> imageCostEntity(@Param(value = "startDate") String startDate,

+ 51 - 2
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouReportDailyImageMapper.xml

@@ -131,8 +131,7 @@
         sum(report.event_pay) AS 'eventPay',
         sum(report.form_count) AS 'formCount',
         sum(report.event_jin_jian_app) AS 'eventJinJianApp',
-        sum(report.event_credit_grant_app) AS 'eventCreditGrantApp',
-        report.realname as 'userName'
+        sum(report.event_credit_grant_app) AS 'eventCreditGrantApp'
         from ctop_kuaishou_report_daily_image report
         left join ctop_user_allocation allocation on allocation.account_id = report.account_id
         left join ctop_project p on p.id = allocation.project_id
@@ -158,6 +157,56 @@
         group by report.cover_id)a
         order by a.${target} ${order}
     </select>
+
+    <select id="imageCostTotal" resultType="cn.com.ctop.common.module.vo.KuaishouImageCostVO">
+        select
+        sum(report.charge) AS 'cost',
+        sum(report.photo_click) AS 'photoClick',
+        (case when sum(report.photo_show)!=0 and sum(report.photo_click)!=0
+        then round(sum(photo_click)/sum(photo_show)*100,2)
+        else 0 end)as 'photoClickRate',
+        sum(report.photo_show) AS 'photoShow',
+        (case when sum(report.charge)!=0 and sum(report.photo_show)!=0
+        then round(sum(charge)/sum(photo_show)*1000,2)
+        else 0 end)as 'photoShowCost',
+        sum(report.aclick) as 'aclick',
+        sum(report.bclick) as 'bclick',
+        (case when sum(report.bclick)!=0 and sum(report.aclick)!=0
+        then round(sum(bclick)/sum(aclick)*100,2)
+        else 0 end)as 'bclickRate',
+        (case when sum(report.charge)!=0 and sum(report.aclick)!=0
+        then round(sum(charge)/sum(aclick)*1000,2)
+        else 0 end)as 'aclickCost',
+        sum(report.activation) AS 'activation',
+        sum(report.event_register) AS 'eventRegister',
+        sum(report.event_pay) AS 'eventPay',
+        sum(report.form_count) AS 'formCount',
+        sum(report.event_jin_jian_app) AS 'eventJinJianApp',
+        sum(report.event_credit_grant_app) AS 'eventCreditGrantApp'
+        from ctop_kuaishou_report_daily_image report
+        left join ctop_user_allocation allocation on allocation.account_id = report.account_id
+        left join ctop_project p on p.id = allocation.project_id
+        where
+        1=1
+        and
+        report.cover_id is not null
+        <if test="startDate!=null">
+            and report.stat_date &gt;= #{startDate}
+        </if>
+        <if test="endDate!=null">
+            and report.stat_date &lt;= #{endDate}
+        </if>
+        <if test="accountList!=null">
+            and report.account_id in
+            <foreach item="accountId" collection="accountList" open="(" separator="," close=")">
+                #{accountId}
+            </foreach>
+        </if>
+        <if test="code!=null">
+            and report.cover_id = #{code}
+        </if>
+    </select>
+
     <select id="imageCostEntity" resultType="cn.com.ctop.common.module.vo.KuaishouImageCostVOEntity">
         select * from (select
         report.cover_url as 'imageUrl' ,

+ 6 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/BytedanceReportMaterialDailyMapper.java

@@ -39,6 +39,12 @@ public interface BytedanceReportMaterialDailyMapper extends BaseMapper<Bytedance
                                                   @Param("order")String order,
                                                   @Param("target")String target);
 
+    BytedanceImageCostVO bytedanceImageCostTotal(@Param("startDate")String startDate,
+                                                  @Param("endDate")String endDate,
+                                                  @Param("accountList")JSONArray accountList,
+                                                  @Param("code")String code
+);
+
     void replaceImageBatch(@Param("infos")List<BytedanceReportMaterialDaily> bytedanceReportImageDailyList);
     void updateImageReportCode();
     void updateImageReportProjectId();

+ 38 - 3
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/xml/BytedanceReportMaterialDailyMapper.xml

@@ -257,9 +257,7 @@
         report.image_url                           as 'imageUrl',
         report.material_id                         as 'signature',
         group_concat(distinct report.project_name) as 'projectName',
-        report.stat_datetime                       as 'statDate',
-        report.plane_id                            as 'userId',
-        report.plane_name                          as 'userName'
+        report.stat_datetime                       as 'statDate'
             from ctop_bytedance_report_image_daily report
             left join ctop_bytedance_image_info imageInfo on imageInfo.material_id = report.material_id
         where
@@ -283,6 +281,43 @@
         group by report.material_id)a order by a.${target} ${order}
     </select>
 
+    <select id="bytedanceImageCostTotal" resultType="cn.com.ctop.common.module.vo.BytedanceImageCostVO">
+        select
+        round(sum(report.cost), 2)                 as 'cost',
+        sum(report.click)                          as 'click',
+        (case when sum(report.show_material)!=0 and sum(report.click)!=0
+        then round(sum(report.click)/sum(report.show_material)*100,2)
+        else 0 end)                       as 'clickRate',
+        sum(report.show_material)                  as 'showNum',
+        sum(report.convert_material)               as 'convert',
+        (case when sum(report.convert_material)!=0 and sum(report.click)!=0
+        then round(sum(report.convert_material)/sum(report.click)*100,2)
+        else 0 end)                       as 'convertRate',
+        (case when sum(report.cost)!=0 and sum(report.convert_material)!=0
+        then round(sum(report.cost)/sum(report.convert_material),2)
+        else 0 end)                       as 'convertCost'
+        from ctop_bytedance_report_image_daily report
+        left join ctop_bytedance_image_info imageInfo on imageInfo.material_id = report.material_id
+        where
+        1=1
+        and report.material_id is not null
+        <if test="startDate!=null">
+            and report.stat_datetime &gt;= #{startDate}
+        </if>
+        <if test="endDate!=null">
+            and report.stat_datetime &lt;= #{endDate}
+        </if>
+        <if test="accountList!=null">
+            and report.account_id in
+            <foreach item="accountId" collection="accountList" open="(" separator="," close=")">
+                #{accountId}
+            </foreach>
+        </if>
+        <if test="code!=null">
+            and report.material_id = #{code}
+        </if>
+    </select>
+
     <update id="updateImageReportCode">
         update ctop_bytedance_report_image_daily a inner join ctop_bytedance_image_info image on image.material_id =a.material_id  set a.code = image.signature,a.image_url = image.image_url
         where a.material_id is not null and a.code is null