소스 검색

添加销售报表数据导出功能

syh 4 년 전
부모
커밋
7837ed2d26

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 194 - 294
module-common/src/main/java/cn/com/ctop/common/module/vo/KuaishouReportAccountDailyDTOEntity.java


+ 2 - 4
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaiShouController.java

@@ -3,7 +3,7 @@ package cn.com.ctop.kuaishou.modules.batch.controller;
 import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
 import cn.com.ctop.common.module.utils.HttpUtils;
-import cn.com.ctop.common.module.vo.ByteDanceReportAccountDailyDTOEntity;
+import cn.com.ctop.common.module.vo.KuaishouReportAccountDailyDTOEntity;
 import cn.com.ctop.common.module.vo.SheetInfoVo;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouInfoDTO;
@@ -144,15 +144,13 @@ public class KuaiShouController {
             result.setMessage("参数有误");
             return ;
         }
-
-        dto.setPageSize(1000000000);
         //查询总的消耗信息
         SheetInfoVo totalSheetVo = accountService.getKuaishouSaleProjectInfoSheetVO(dto.getStartDate(), dto.getEndDate(), dto.getProjectList(),dto.getPageNum(),dto.getPageSize(),"", dto.getYn());
         OutputStream outputStream = response.getOutputStream();
         String date = DateUtils.formatDate(new Date());
         HttpUtils.setResponseHeader(response, "快手销售报表" + date + ".xlsx");
         ExcelWriter excelWriter = EasyExcelFactory.getWriter(outputStream);
-        Sheet sheet = new Sheet(1, 0, ByteDanceReportAccountDailyDTOEntity.class);
+        Sheet sheet = new Sheet(1, 0, KuaishouReportAccountDailyDTOEntity.class);
         sheet.setSheetName(totalSheetVo.getSheetName());
         excelWriter.write(totalSheetVo.getDetails(), sheet);
         excelWriter.finish();

+ 1 - 2
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouReportDailyAccountMapper.java

@@ -47,6 +47,5 @@ public interface KuaishouReportDailyAccountMapper extends BaseMapper<KuaishouRep
 
     List<Long> getSaleProjectAccountIds(@Param("userId")String userId, @Param("yn")Integer yn);
 
-
-    List<KuaishouReportAccountDailyDTOEntity> getKuaishouProjectInfoEntity(String startDate, String endDate, List<Long> projectList, Integer yn);
+    List<KuaishouReportAccountDailyDTOEntity> getKuaishouProjectInfoEntity(@Param("startDate")String startDate, @Param("endDate")String endDate, @Param("projectList")List<Long> projectList, @Param("yn")Integer yn);
 }

+ 82 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouReportDailyAccountMapper.xml

@@ -1139,5 +1139,87 @@
             limit 50
         </if>
     </select>
+    <select id="getKuaishouProjectInfoEntity"
+            resultType="cn.com.ctop.common.module.vo.KuaishouReportAccountDailyDTOEntity">
+        select
+        concat(#{startDate}, '~' , #{endDate}) as 'statDate',
+        b.project_id as 'projectId',
+        (SELECT project_name FROM ctop_project where id = b.project_id) as 'projectName',
+        (select name from ctop_advertiser where id = b.advertiser_id) as 'advertiserName',
+        (
+        select realname from sys_user where id = (
+        select responsible_id from ctop_project where id = b.project_id
+        )
+        ) as 'responsibleName',
+        (
+        select realname from sys_user where id = (
+        select design_responsible_id from ctop_project where id = b.project_id
+        )
+        ) as 'designResponsibleName',
+        ifnull(round(sum(a.charge),3),0) as 'charge',
+        ifnull(sum(a.photo_show),0) as 'photoShow', -- 封面曝光数
+        ifnull(sum(a.photo_click),0) as 'photoClick', -- 封面点击数
+        ifnull(sum(a.aclick),0) as 'aclick', -- 素材曝光数
+        ifnull(sum(a.bclick),0) as 'bclick', -- 行为数
+        ifnull(sum(a.activation),0) as 'activation', -- 激活数
+        ifnull(sum(a.submit),0) as 'submit', -- 提交按钮点击数
+        ifnull(sum(a.event_register),0) as 'eventRegister', -- 注册数
+        ifnull(sum(event_next_day_stay),0) as 'eventNextDayStay', -- 次日留存数
+        ROUND(IFNULL(sum(a.charge)/sum(a.activation),0),2) as 'activationCost', -- 激活成本
+        case when (sum(a.photo_show) is not null and sum(a.photo_show)!=0) then
+        concat(round(ifnull(sum(a.photo_click),0)/sum(a.photo_show) * 100 ,2),'%') else 0 end as 'photoClickRate',
+        case when (sum(a.aclick) is not null and sum(a.aclick)!=0) then
+        concat(round(ifnull(sum(a.bclick),0)/sum(a.aclick) * 100 ,2),'%') else 0 end as 'bclickRate', -- 行为率
+        (case
+        when (sum(a.photo_show) is not null and sum(a.photo_show) != 0)
+        then round((ifnull(sum(a.charge),0) / sum(a.photo_show)) * 1000,2)
+        else 0
+        end
+        ) as 'impression1kCost', -- 均千次封面曝光花费
+        (case
+        when (sum(a.photo_click) is not null and sum(a.photo_click) != 0)
+        then round( ifnull(sum(a.charge),0) / sum(a.photo_click),2)
+        else 0
+        end
+        ) as 'photoClickCost', -- 平均封面点击单价
+        (CASE
+        WHEN ( sum(a.bclick) is not null and sum(a.bclick) != 0)
+        THEN round(sum(a.charge) / sum(a.bclick),2)
+        ELSE 0
+        end
+        ) as 'actionCost', -- 平均行为单价
+        ifnull(sum(a.photo_share),0) as 'photoShare', -- 分享数
+        ifnull(sum(a.photo_comment),0) as 'photoComment', -- 评论数
+        ifnull(sum(a.photo_like),0) as 'photoLike', -- 点赞数
+        ifnull(sum(a.follow),0) as 'follow', -- 新增关注数
+        ifnull(sum(a.report),0) as 'report', -- 举报数
+        ifnull(sum(a.cancel_follow),0) as 'cancelFollow', -- 取消关注数
+        ifnull(sum(a.block),0) as 'block', -- 拉黑数
+        ifnull(sum(a.negative),0) as 'nagative', -- 减少此类作品数
+        ifnull(sum(a.download_started),0) as 'downloadStarted', -- 应用下载数据-安卓下载开始数
+        ifnull(sum(a.download_completed),0) as 'downloadCompleted', -- 应用下载数据-安卓下载完成数
+        (CASE
+        WHEN ( sum(a.event_next_day_stay) is not null and sum(a.event_next_day_stay) != 0)
+        THEN round( ifnull(sum(a.charge),0) / sum(a.event_next_day_stay) ,2)
+        ELSE 0
+        end
+        ) as 'eventNextDayStayCost' -- 次日留存成本
+        from
+        ctop_kuaishou_report_daily_account a
+        left join ctop_user_allocation b
+        on a.account_id = b.account_id
+        where
+        a.stat_date &gt;= #{startDate}
+        and
+        a.stat_date &lt;= #{endDate}
+        and
+        b.project_id in
+        <foreach collection="projectList" item="item" separator=","
+                 open="(" close=")">
+            #{item}
+        </foreach>
+        group by b.project_id  order by sum(a.charge) desc
+
+    </select>
 
 </mapper>

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

@@ -200,10 +200,8 @@ public class KuaishouReportDailyAccountServiceImpl extends ServiceImpl<KuaishouR
             }
         }
 
-        PageHelper.startPage(pageNum,pageSize);
         List<KuaishouReportAccountDailyDTOEntity> dtos = dailyAccountMapper.getKuaishouProjectInfoEntity(startDate,endDate,projectList,yn);
-//        return new PageInfo<>(dailyAccountMapper.getKuaishouProjectInfo(startDate,endDate,projectList,yn));
-        vo.setSheetName("头条销售报表");
+        vo.setSheetName("快手销售报表");
         vo.setDetails(dtos);
         return vo;
     }

+ 1 - 2
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/controller/BytedanceReportController.java

@@ -468,8 +468,7 @@ public class BytedanceReportController {
      *
      * @return
      */
-    @RequestMapping(value = "/exportBytedanceSaleProjectInfo")
-    @ResponseBody
+    @PostMapping(value = "/exportBytedanceSaleProjectInfo")
     public void exportXxl(@RequestBody BytedanceInfoDTO dto,HttpServletResponse response) throws IOException {
         List<SheetInfoVo> sheets = new ArrayList<>();
         if(dto == null || dto.getStartDate() ==null || dto.getEndDate() == null){