Переглянути джерело

Merge remote-tracking branch 'origin/test' into test

# Conflicts:
#	module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaiShouController.java
syh 4 роки тому
батько
коміт
8a70b33c49

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

@@ -7,13 +7,13 @@ import cn.com.ctop.kuaishou.modules.report.entity.KuaishouInfoDTO;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAccountDTO;
 import cn.com.ctop.kuaishou.modules.report.entity.ProjectAccountDTO;
 import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyAccountService;
+import com.baomidou.mybatisplus.extension.api.R;
+import com.github.pagehelper.Page;
+import com.github.pagehelper.PageInfo;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.ResponseBody;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import java.util.HashMap;
 import java.util.List;
@@ -72,8 +72,8 @@ public class KuaiShouController {
 
     @ResponseBody
     @RequestMapping("/getKuaishouProjectInfo")
-    public Result<List<ProjectAccountDTO>> getKuaishouProjectInfo(@RequestBody KuaishouInfoDTO dto) {
-        Result<List<ProjectAccountDTO>> result = new Result<>();
+    public Result<PageInfo<ProjectAccountDTO>> getKuaishouProjectInfo(@RequestBody KuaishouInfoDTO dto) {
+        Result<PageInfo<ProjectAccountDTO>> result = new Result<>();
         result.setSuccess(true);
 
         if(dto == null || dto.getStartDate() ==null || dto.getEndDate() == null){
@@ -86,7 +86,7 @@ public class KuaiShouController {
         }
 
         try{
-            List<ProjectAccountDTO> projectAccountDTOList = accountService.getKuaishouProjectInfo(dto.getStartDate(), dto.getEndDate(), dto.getProjectList(),dto.getPageSize(),dto.getPageNum(), "");
+            PageInfo<ProjectAccountDTO> projectAccountDTOList = accountService.getKuaishouProjectInfo(dto.getStartDate(), dto.getEndDate(), dto.getProjectList(),dto.getPageSize(),dto.getPageNum(), "");
             result.setResult(projectAccountDTOList);
         }catch(Exception e){
             log.error(e.getMessage());
@@ -100,8 +100,8 @@ public class KuaiShouController {
 
     @ResponseBody
     @RequestMapping("/getKuaishouSaleProjectInfo")
-    public Result<List<ProjectAccountDTO>> getKuaishouSaleProjectInfo(@RequestBody KuaishouInfoDTO dto) {
-        Result<List<ProjectAccountDTO>> result = new Result<>();
+    public Result<PageInfo<ProjectAccountDTO>> getKuaishouSaleProjectInfo(@RequestBody KuaishouInfoDTO dto) {
+        Result<PageInfo<ProjectAccountDTO>> result = new Result<>();
         result.setSuccess(true);
 
         if(dto == null || dto.getStartDate() ==null || dto.getEndDate() == null){
@@ -114,7 +114,7 @@ public class KuaiShouController {
         }
 
         try{
-            List<ProjectAccountDTO> projectAccountDTOList = accountService.getKuaishouSaleProjectInfo(dto.getStartDate(), dto.getEndDate(), dto.getProjectList(),dto.getPageSize(),dto.getPageNum(), "");
+            PageInfo<ProjectAccountDTO> projectAccountDTOList = accountService.getKuaishouSaleProjectInfo(dto.getStartDate(), dto.getEndDate(), dto.getProjectList(),dto.getPageSize(),dto.getPageNum(), "");
             result.setResult(projectAccountDTOList);
         }catch(Exception e){
             log.error(e.getMessage());
@@ -129,8 +129,8 @@ public class KuaiShouController {
 
     @ResponseBody
     @RequestMapping("/getKuaishouAccountInfoByProjectId")
-    public Result<List<KuaishouReportDailyAccountDTO>> getKuaishouAccountInfoByProjectId(@RequestBody KuaishouInfoDTO dto) {
-        Result<List<KuaishouReportDailyAccountDTO>> result = new Result<>();
+    public Result<PageInfo<KuaishouReportDailyAccountDTO>> getKuaishouAccountInfoByProjectId(@RequestBody KuaishouInfoDTO dto) {
+        Result<PageInfo<KuaishouReportDailyAccountDTO>> result = new Result<>();
         result.setSuccess(true);
 
         if(dto == null || dto.getStartDate() ==null || dto.getEndDate() == null || dto.getProjectId()==null){
@@ -144,7 +144,7 @@ public class KuaiShouController {
         }
 
         try{
-            List<KuaishouReportDailyAccountDTO> kuaishouReportDailyAccountDTOList = accountService.getKuaishouAccountInfoByProjectId(dto.getProjectId(), dto.getStartDate(), dto.getEndDate(),dto.getPageSize(),dto.getPageNum());
+            PageInfo<KuaishouReportDailyAccountDTO> kuaishouReportDailyAccountDTOList = accountService.getKuaishouAccountInfoByProjectId(dto.getProjectId(), dto.getStartDate(), dto.getEndDate(),dto.getPageSize(),dto.getPageNum());
             result.setResult(kuaishouReportDailyAccountDTOList);
         }catch(Exception e){
             log.error(e.getMessage());
@@ -158,8 +158,8 @@ public class KuaiShouController {
 
     @ResponseBody
     @RequestMapping("/getKuaishouCampaignInfoByAccountId")
-    public Result<List<KuaishouReportDailyAccountDTO>> getKuaishouCampaignInfoByAccountId(@RequestBody KuaishouInfoDTO dto) {
-        Result<List<KuaishouReportDailyAccountDTO>> result = new Result<>();
+    public Result<PageInfo<KuaishouReportDailyAccountDTO>> getKuaishouCampaignInfoByAccountId(@RequestBody KuaishouInfoDTO dto) {
+        Result<PageInfo<KuaishouReportDailyAccountDTO>> result = new Result<>();
         result.setSuccess(true);
 
         if(dto == null || dto.getStartDate() ==null || dto.getEndDate() == null || dto.getAccountId()==null){
@@ -173,7 +173,7 @@ public class KuaiShouController {
         }
 
         try{
-            List<KuaishouReportDailyAccountDTO> kuaishouCampaignInfoList = accountService.getKuaishouCampaignInfoByAccountId(dto.getAccountId(), dto.getStartDate(), dto.getEndDate(),dto.getPageSize(),dto.getPageNum());
+            PageInfo<KuaishouReportDailyAccountDTO> kuaishouCampaignInfoList = accountService.getKuaishouCampaignInfoByAccountId(dto.getAccountId(), dto.getStartDate(), dto.getEndDate(),dto.getPageSize(),dto.getPageNum());
             result.setResult(kuaishouCampaignInfoList);
         }catch(Exception e){
             log.error(e.getMessage());
@@ -188,8 +188,8 @@ public class KuaiShouController {
 
     @ResponseBody
     @RequestMapping("/getKuaishouUnitInfoByCampaignId")
-    public Result<List<KuaishouReportDailyAccountDTO>> getKuaishouUnitInfoByCampaignId(@RequestBody KuaishouInfoDTO dto) {
-        Result<List<KuaishouReportDailyAccountDTO>> result = new Result<>();
+    public Result<PageInfo<KuaishouReportDailyAccountDTO>> getKuaishouUnitInfoByCampaignId(@RequestBody KuaishouInfoDTO dto) {
+        Result<PageInfo<KuaishouReportDailyAccountDTO>> result = new Result<>();
         result.setSuccess(true);
 
         if(dto == null || dto.getStartDate() ==null || dto.getEndDate() == null || dto.getCampaignId()==null){
@@ -202,7 +202,7 @@ public class KuaiShouController {
         }
 
         try{
-            List<KuaishouReportDailyAccountDTO> kuaishouCampaignInfoList = accountService.getKuaishouUnitInfoByCampaignId(dto.getCampaignId(), dto.getStartDate(), dto.getEndDate(),dto.getPageSize(),dto.getPageNum());
+            PageInfo<KuaishouReportDailyAccountDTO> kuaishouCampaignInfoList = accountService.getKuaishouUnitInfoByCampaignId(dto.getCampaignId(), dto.getStartDate(), dto.getEndDate(),dto.getPageSize(),dto.getPageNum());
             result.setResult(kuaishouCampaignInfoList);
         }catch(Exception e){
             log.error(e.getMessage());
@@ -216,8 +216,8 @@ public class KuaiShouController {
 
     @ResponseBody
     @RequestMapping("/getKuaishouCreativeInfoByUnitId")
-    public Result<List<KuaishouReportDailyAccountDTO>> getKuaishouCreativeInfoByUnitId(@RequestBody KuaishouInfoDTO dto) {
-        Result<List<KuaishouReportDailyAccountDTO>> result = new Result<>();
+    public Result<PageInfo<KuaishouReportDailyAccountDTO>> getKuaishouCreativeInfoByUnitId(@RequestBody KuaishouInfoDTO dto) {
+        Result<PageInfo<KuaishouReportDailyAccountDTO>> result = new Result<>();
         result.setSuccess(true);
 
         if(dto == null || dto.getStartDate() ==null || dto.getEndDate() == null || dto.getUnitId()==null){
@@ -230,7 +230,7 @@ public class KuaiShouController {
         }
 
         try{
-            List<KuaishouReportDailyAccountDTO> kuaishouCampaignInfoList = accountService.getKuaishouCreativeInfoByUnitId(dto.getUnitId(), dto.getStartDate(), dto.getEndDate(),dto.getPageSize(),dto.getPageNum());
+            PageInfo<KuaishouReportDailyAccountDTO> kuaishouCampaignInfoList = accountService.getKuaishouCreativeInfoByUnitId(dto.getUnitId(), dto.getStartDate(), dto.getEndDate(),dto.getPageSize(),dto.getPageNum());
             result.setResult(kuaishouCampaignInfoList);
         }catch(Exception e){
             log.error(e.getMessage());

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

@@ -39,4 +39,6 @@ public interface KuaishouReportDailyAccountMapper extends BaseMapper<KuaishouRep
     List<KuaishouReportDailyAccountDTO> getKuaishouCreativeInfoByUnitId(@Param("startDate")String startDate, @Param("endDate")String endDate, @Param("unitId")Long unitId);
 
     KuaishouVideoInfoDTO getVideoUrl(@Param("photoId")Long photoId);
+
+    List<Long> getUserProjectAccountIds(@Param("userId")String userId);
 }

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

@@ -590,8 +590,10 @@
         a.stat_date &gt;= #{startDate}
         and
         a.stat_date &lt;= #{endDate}
-        and
-        b.project_id = #{projectId}
+        <if test="projectId!=null and projectId != '' ">
+            and
+            b.project_id = #{projectId}
+        </if>>
         group by a.account_id
         order by sum(a.charge) desc
     </select>
@@ -735,8 +737,10 @@
         a.stat_date &gt;= #{startDate}
         and
         a.stat_date &lt;= #{endDate}
-        and
-        a.account_id = #{accountId}
+        <if test="accountId !=null and accountId != '' ">
+            and
+            a.account_id = #{accountId}
+        </if>
         group by a.campaign_id
     </select>
 
@@ -806,8 +810,10 @@
         a.stat_date &gt;= #{startDate}
         and
         a.stat_date &lt;= #{endDate}
-        and
-        a.campaign_id = #{campaignId}
+        <if test="campaignId != null and campaignId != ''">
+            and
+            a.campaign_id = #{campaignId}
+        </if>
         group by unit_id
     </select>
 
@@ -903,7 +909,7 @@
         order by create_time desc
     </select>
 
-    <select id="getKuaishouCreativeInfoByUnitId" resultType="cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAccountDTO">
+    <select id="getKuaishouCreativeInfoByUnitId2" resultType="cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAccountDTO">
         select
         a.*,
         b.photo_id as 'photoId'
@@ -974,13 +980,91 @@
             a.stat_date &gt;= #{startDate}
             and
             a.stat_date &lt;= #{endDate}
-            and
-            a.unit_id = #{unitId}
+            <if test="unitId != null and unitId !='' ">
+                and
+                a.unit_id = #{unitId}
+            </if>
             group by creative_id
         ) a
         left join  ctop_kuaishou_creative b on a.creativeId = b.creative_id
     </select>
 
+    <select id="getKuaishouCreativeInfoByUnitId" resultType="cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAccountDTO">
+        select
+        concat(#{startDate}, '~' ,#{endDate}) as 'statDate',
+        b.project_id as 'projectId',
+        b.project_name as 'projectName',
+        a.account_id as 'accountId',
+        b.auth_name as 'authName',
+        a.creative_id as 'creativeId',
+        a.creative_name as 'creativeName',
+        a.campaign_id as 'campaignId',  -- 计划id
+        a.campaign_name as 'campaignName',  -- 计划名称
+        a.unit_id as 'unitId',  -- 组id,
+        a.unit_name as 'unitName',  -- 组名称
+        round(sum(a.charge),2) as 'charge',
+        sum(a.photo_show) as 'photoShow',  -- 封面曝光数
+        sum(a.photo_click) as 'photoClick', -- 封面点击数
+        sum(a.aclick) as 'aclick',  -- 素材曝光数
+        sum(a.bclick) as 'bclick',  -- 行为数
+        sum(a.activation) as 'activation',  -- 激活数
+        sum(a.submit) as 'submit',   -- 提交按钮点击数
+        sum(a.event_register) as 'eventRegister',   -- 注册数
+        sum(event_next_day_stay) as 'eventNextDayStay',  -- 次日留存数
+        ROUND(IFNULL(sum(a.charge)/sum(a.activation),0),2) as 'activationCost',   -- 激活成本
+        case when photo_show!=0 then concat(round(sum(a.photo_click)/sum(a.photo_show) * 100 ,2),'%') else 0 end as 'photoClickRatio',   -- 封面点击率
+        case when aclick!=0 then concat(round(sum(a.bclick)/sum(a.aclick) * 100 ,2),'%') else 0 end as 'actionRate',  -- 行为率
+        (case
+        when sum(a.photo_show) != 0 and sum(a.photo_show) is not null
+        then round((sum(a.charge) / sum(a.photo_show)) * 1000,2)
+        else 0
+        end
+        ) as 'impression1kCost', -- 均千次封面曝光花费
+        (case
+        when sum(a.photo_click) != 0
+        then round(sum(a.charge) / sum(a.photo_click),2)
+        else 0
+        end
+        ) as 'photoClickCost', -- 平均封面点击单价
+        (CASE
+        WHEN sum(a.photo_click) != 0
+        THEN round(sum(a.charge) / sum(a.photo_click),2)
+        ELSE 0
+        end
+        ) as 'actionCost', -- 平均行为单价
+        sum(a.photo_share) as 'photoShare',  -- 分享数
+        sum(a.photo_comment) as 'photoComment', -- 评论数
+        sum(a.photo_like) as 'photoLike', -- 点赞数
+        sum(a.follow) as 'follow', -- 新增关注数
+        sum(a.report) as 'report', -- 举报数
+        sum(a.cancel_follow) as 'cancelFollow', -- 取消关注数
+        sum(a.block) as 'block', -- 拉黑数
+        sum(a.negative) as 'nagative', -- 减少此类作品数
+        sum(a.download_started) as 'downloadStarted',  -- 应用下载数据-安卓下载开始数
+        sum(a.download_completed) as 'downloadCompleted',  -- 应用下载数据-安卓下载完成数
+        (CASE
+        WHEN sum(a.event_next_day_stay) != 0
+        THEN round(sum(a.charge) / sum(a.event_next_day_stay),2)
+        ELSE 0
+        end
+        ) as 'eventNextDayStayCost',  -- 次日留存成本
+        (select url from ctop_kuaishou_video_get where photo_id = c.photo_id limit 1) as url,
+        (select cover_url from ctop_kuaishou_video_get where photo_id = c.photo_id limit 1) as coverUrl
+        from
+        ctop_kuaishou_report_daily_creative a
+        left join (select * from ctop_user_allocation group by account_id) b on a.account_id = b.account_id
+        left join ctop_kuaishou_creative c on a.creative_id = c.creative_id
+        where
+        a.stat_date &gt;= #{startDate}
+        and
+        a.stat_date &lt;= #{endDate}
+        <if test="unitId != null and unitId !='' ">
+            and
+            a.unit_id = #{unitId}
+        </if>
+        group by a.creative_id
+    </select>
+
     <select id="getVideoUrl" resultType="cn.com.ctop.kuaishou.modules.report.entity.KuaishouVideoInfoDTO">
         select
         url as url,
@@ -991,4 +1075,14 @@
         limit 1
     </select>
 
+    <!-- 获取项目成员所在所有项目下的所有账户id -->
+    <select id="getUserProjectAccountIds" resultType="long">
+        select
+        a.account_id
+        from
+        (select * from ctop_user_allocation  group by account_id) a
+        left join ctop_project_member b on a.project_id=b.project_id
+        where b.user_id = #{userId}
+    </select>
+
 </mapper>

+ 7 - 6
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IKuaishouReportDailyAccountService.java

@@ -5,6 +5,7 @@ import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAccountDTO;
 import cn.com.ctop.kuaishou.modules.report.entity.ProjectAccountDTO;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.github.pagehelper.PageInfo;
 import org.apache.shiro.SecurityUtils;
 import org.jeecg.common.system.vo.LoginUser;
 
@@ -15,16 +16,16 @@ public interface IKuaishouReportDailyAccountService extends IService<KuaishouRep
 
     List<JSONObject> selectCost(Long accountId, String startDate, String endDate);
 
-    List<ProjectAccountDTO> getKuaishouProjectInfo(String startDate, String endDate, List<Long> projectList , Integer pageSize, Integer pageNum, String sort );
+    PageInfo<ProjectAccountDTO> getKuaishouProjectInfo(String startDate, String endDate, List<Long> projectList , Integer pageSize, Integer pageNum, String sort );
 
-    List<ProjectAccountDTO> getKuaishouSaleProjectInfo(String startDate, String endDate, List<Long> projectList, Integer pageSize, Integer pageNum, String sort);
+    PageInfo<ProjectAccountDTO> getKuaishouSaleProjectInfo(String startDate, String endDate, List<Long> projectList, Integer pageSize, Integer pageNum, String sort);
 
-    List<KuaishouReportDailyAccountDTO> getKuaishouAccountInfoByProjectId(Long projectId, String startDate, String endDate, Integer pageSize, Integer pageNum);
+    PageInfo<KuaishouReportDailyAccountDTO> getKuaishouAccountInfoByProjectId(Long projectId, String startDate, String endDate, Integer pageSize, Integer pageNum);
 
-    List<KuaishouReportDailyAccountDTO> getKuaishouCampaignInfoByAccountId(Long accountId, String startDate, String endDate, Integer pageSize, Integer pageNum);
+    PageInfo<KuaishouReportDailyAccountDTO> getKuaishouCampaignInfoByAccountId(Long accountId, String startDate, String endDate, Integer pageSize, Integer pageNum);
 
-    List<KuaishouReportDailyAccountDTO> getKuaishouUnitInfoByCampaignId(Long campaignId, String startDate, String endDate, Integer pageSize, Integer pageNum);
+    PageInfo<KuaishouReportDailyAccountDTO> getKuaishouUnitInfoByCampaignId(Long campaignId, String startDate, String endDate, Integer pageSize, Integer pageNum);
 
-    List<KuaishouReportDailyAccountDTO> getKuaishouCreativeInfoByUnitId(Long unitId, String startDate, String endDate, Integer pageSize, Integer pageNum);
+    PageInfo<KuaishouReportDailyAccountDTO> getKuaishouCreativeInfoByUnitId(Long unitId, String startDate, String endDate, Integer pageSize, Integer pageNum);
 
 }

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

@@ -9,6 +9,7 @@ import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyAccountSe
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
 import org.apache.shiro.SecurityUtils;
 import org.apache.shiro.mgt.SecurityManager;
 import org.jeecg.common.system.vo.LoginUser;
@@ -31,12 +32,13 @@ public class KuaishouReportDailyAccountServiceImpl extends ServiceImpl<KuaishouR
     }
 
     @Override
-    public List<ProjectAccountDTO> getKuaishouProjectInfo(String startDate, String endDate, List<Long> projectList, Integer pageSize, Integer pageNum, String sort ){
+    public PageInfo<ProjectAccountDTO> getKuaishouProjectInfo(String startDate, String endDate, List<Long> projectList, Integer pageSize, Integer pageNum, String sort ){
         List<ProjectAccountDTO> projectAccountDTOList = new ArrayList<>();
 
         if(projectList==null || projectList.size()==0){
-            //LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
-            String userId = "a6abfea0f27843bf8595a234410afb04";
+            LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+            //String userId = "a6abfea0f27843bf8595a234410afb04";
+            String userId = sysUser.getId();
             String roleCode = dailyAccountMapper.getRoleCodeByUserId(userId);
 
             List<Long> mediaIds = new ArrayList<>();
@@ -86,16 +88,17 @@ public class KuaishouReportDailyAccountServiceImpl extends ServiceImpl<KuaishouR
             project.setStatDate(startDate + "~" + endDate);
         }
 
-        return projectAccountDTOList;
+        return new PageInfo<>(projectAccountDTOList);
     }
 
     @Override
-    public List<ProjectAccountDTO> getKuaishouSaleProjectInfo(String startDate, String endDate, List<Long> projectList, Integer pageSize, Integer pageNum, String sort ){
+    public PageInfo<ProjectAccountDTO> getKuaishouSaleProjectInfo(String startDate, String endDate, List<Long> projectList, Integer pageSize, Integer pageNum, String sort ){
         List<ProjectAccountDTO> projectAccountDTOList = new ArrayList<>();
 
         if(projectList==null || projectList.size()==0){
-            //LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
-            String userId = "e9ca23d68d884d4ebb19d07889727dae";
+            LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+            //String userId = "e9ca23d68d884d4ebb19d07889727dae";
+            String userId = sysUser.getId();
             String roleCode = dailyAccountMapper.getRoleCodeByUserId(userId);
 
             List<Long> mediaIds = new ArrayList<>();
@@ -145,38 +148,38 @@ public class KuaishouReportDailyAccountServiceImpl extends ServiceImpl<KuaishouR
             project.setStatDate(startDate + "~" + endDate);
         }
 
-        return projectAccountDTOList;
+        return new PageInfo<>(projectAccountDTOList);
     }
 
 
     @Override
-    public List<KuaishouReportDailyAccountDTO> getKuaishouAccountInfoByProjectId(Long projectId, String startDate, String endDate, Integer pageSize, Integer pageNum){
+    public PageInfo<KuaishouReportDailyAccountDTO> getKuaishouAccountInfoByProjectId(Long projectId, String startDate, String endDate, Integer pageSize, Integer pageNum){
         PageHelper.startPage(pageNum,pageSize);
-        return dailyAccountMapper.getKuaishouAccountInfoByProjectId(startDate, endDate, projectId);
+        return new PageInfo<>(dailyAccountMapper.getKuaishouAccountInfoByProjectId(startDate, endDate, projectId));
     }
 
     @Override
-    public List<KuaishouReportDailyAccountDTO> getKuaishouCampaignInfoByAccountId(Long accountId, String startDate, String endDate, Integer pageSize, Integer pageNum){
+    public PageInfo<KuaishouReportDailyAccountDTO> getKuaishouCampaignInfoByAccountId(Long accountId, String startDate, String endDate, Integer pageSize, Integer pageNum){
         PageHelper.startPage(pageNum,pageSize);
-        return dailyAccountMapper.getKuaishouCampaignInfoByAccountId(startDate, endDate, accountId);
+        return new PageInfo<>(dailyAccountMapper.getKuaishouCampaignInfoByAccountId(startDate, endDate, accountId));
     }
 
     @Override
-    public List<KuaishouReportDailyAccountDTO> getKuaishouUnitInfoByCampaignId(Long campaignId, String startDate, String endDate, Integer pageSize, Integer pageNum){
+    public PageInfo<KuaishouReportDailyAccountDTO> getKuaishouUnitInfoByCampaignId(Long campaignId, String startDate, String endDate, Integer pageSize, Integer pageNum){
         PageHelper.startPage(pageNum,pageSize);
-        return dailyAccountMapper.getKuaishouUnitInfoByCampaignId(startDate, endDate, campaignId);
+        return new PageInfo<>(dailyAccountMapper.getKuaishouUnitInfoByCampaignId(startDate, endDate, campaignId));
     }
 
     @Override
-    public List<KuaishouReportDailyAccountDTO> getKuaishouCreativeInfoByUnitId(Long unitId, String startDate, String endDate, Integer pageSize, Integer pageNum){
+    public PageInfo<KuaishouReportDailyAccountDTO> getKuaishouCreativeInfoByUnitId(Long unitId, String startDate, String endDate, Integer pageSize, Integer pageNum){
         PageHelper.startPage(pageNum,pageSize);
         List<KuaishouReportDailyAccountDTO> kuaishouCreativeInfoList = dailyAccountMapper.getKuaishouCreativeInfoByUnitId(startDate, endDate, unitId);
-        for(KuaishouReportDailyAccountDTO creativeInfo:kuaishouCreativeInfoList){
-            KuaishouVideoInfoDTO videoInfo = dailyAccountMapper.getVideoUrl(creativeInfo.getPhotoId());
-            creativeInfo.setUrl(videoInfo.getUrl());
-            creativeInfo.setCoverUrl(videoInfo.getCoverUrl());
-        }
-        return kuaishouCreativeInfoList;
+        //for(KuaishouReportDailyAccountDTO creativeInfo:kuaishouCreativeInfoList){
+        //    KuaishouVideoInfoDTO videoInfo = dailyAccountMapper.getVideoUrl(creativeInfo.getPhotoId());
+        //    creativeInfo.setUrl(videoInfo.getUrl());
+        //    creativeInfo.setCoverUrl(videoInfo.getCoverUrl());
+        //}
+        return new PageInfo<>(kuaishouCreativeInfoList);
     }
 
 }

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

@@ -9,6 +9,7 @@ import cn.com.ctop.toutiao.modules.report.service.IByteDanceVideoReportDailyServ
 import cn.com.ctop.toutiao.modules.report.service.IBytedanceAccountReportService;
 import cn.com.ctop.toutiao.modules.report.service.IBytedanceReportService;
 import com.alibaba.fastjson.JSONObject;
+import com.github.pagehelper.PageInfo;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang.StringUtils;
 import org.jeecg.common.api.vo.Result;
@@ -392,11 +393,11 @@ public class BytedanceReportController {
 
     @ResponseBody
     @RequestMapping("/getBytedanceAccountInfoByProjectId")
-    public Result<List<ByteDanceReportAccountDailyDTO>> getBytedanceAccountInfoByProjectId(@RequestBody BytedanceInfoDTO dto) {
-        Result<List<ByteDanceReportAccountDailyDTO>> result = new Result<>();
+    public Result<PageInfo<ByteDanceReportAccountDailyDTO>> getBytedanceAccountInfoByProjectId(@RequestBody BytedanceInfoDTO dto) {
+        Result<PageInfo<ByteDanceReportAccountDailyDTO>> result = new Result<>();
         result.setSuccess(true);
 
-        if(dto == null || dto.getStartDate() ==null || dto.getEndDate() == null || dto.getProjectId()==null){
+        if(dto == null || dto.getStartDate() ==null || dto.getEndDate() == null){
             result.setSuccess(false);
             result.setMessage("参数有误");
             return result;
@@ -407,7 +408,7 @@ public class BytedanceReportController {
         }
 
         try{
-            List<ByteDanceReportAccountDailyDTO> byteDanceReportAccountDailyDTOList = bytedanceAccountReportService.getBytedanceAccountInfoByProjectId(dto.getStartDate(), dto.getEndDate(), dto.getProjectId(),dto.getPageNum(),dto.getPageSize(),dto.getSort());
+            PageInfo<ByteDanceReportAccountDailyDTO> byteDanceReportAccountDailyDTOList = bytedanceAccountReportService.getBytedanceAccountInfoByProjectId(dto.getStartDate(), dto.getEndDate(), dto.getProjectId(),dto.getPageNum(),dto.getPageSize(),dto.getSort());
             result.setResult(byteDanceReportAccountDailyDTOList);
         }catch(Exception e){
             log.error(e.getMessage());
@@ -421,8 +422,8 @@ public class BytedanceReportController {
 
     @ResponseBody
     @RequestMapping("/getBytedanceSaleProjectInfo")
-    public Result<List<ByteDanceReportAccountDailyDTO>> getBytedanceSaleProjectInfo(@RequestBody BytedanceInfoDTO dto) {
-        Result<List<ByteDanceReportAccountDailyDTO>> result = new Result<>();
+    public Result<PageInfo<ByteDanceReportAccountDailyDTO>> getBytedanceSaleProjectInfo(@RequestBody BytedanceInfoDTO dto) {
+        Result<PageInfo<ByteDanceReportAccountDailyDTO>> result = new Result<>();
         result.setSuccess(true);
 
         if(dto == null || dto.getStartDate() ==null || dto.getEndDate() == null){
@@ -444,7 +445,7 @@ public class BytedanceReportController {
         }
 
         try{
-            List<ByteDanceReportAccountDailyDTO> byteDanceReportAccountDailyDTOList = bytedanceAccountReportService.getBytedanceSaleProjectInfo(dto.getStartDate(), dto.getEndDate(), dto.getProjectList(),dto.getPageNum(),dto.getPageSize(),dto.getSort());
+            PageInfo<ByteDanceReportAccountDailyDTO> byteDanceReportAccountDailyDTOList = bytedanceAccountReportService.getBytedanceSaleProjectInfo(dto.getStartDate(), dto.getEndDate(), dto.getProjectList(),dto.getPageNum(),dto.getPageSize(),dto.getSort());
             result.setResult(byteDanceReportAccountDailyDTOList);
         }catch(Exception e){
             log.error(e.getMessage());

+ 4 - 2
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/xml/BytedanceAccountReportMapper.xml

@@ -301,8 +301,10 @@
         date_format(a.stat_datetime,'%Y-%m-%d') &gt;= #{startDate}
         and
         date_format(a.stat_datetime,'%Y-%m-%d') &lt;= #{endDate}
-        and
-        b.project_id = #{projectId}
+        <if test="projectId!=null and projectId!=''">
+            and
+            b.project_id = #{projectId}
+        </if>
         group by a.advertiser_id
         -- order by sum(a.cost) desc
     </select>

+ 3 - 2
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/IBytedanceAccountReportService.java

@@ -3,6 +3,7 @@ package cn.com.ctop.toutiao.modules.report.service;
 import cn.com.ctop.toutiao.modules.report.DTO.ByteDanceReportAccountDailyDTO;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.github.pagehelper.PageInfo;
 
 import java.math.BigDecimal;
 import java.util.List;
@@ -20,9 +21,9 @@ public interface IBytedanceAccountReportService {
 
     //List<ByteDanceReportAccountDailyDTO> getBytedanceSaleProjectInfo(String startDate, String endDate, List<Long> projectList);
 
-    List<ByteDanceReportAccountDailyDTO> getBytedanceAccountInfoByProjectId(String startDate, String endDate, Long projectId,Integer pageNo, Integer pageSize, String sort);
+    PageInfo<ByteDanceReportAccountDailyDTO> getBytedanceAccountInfoByProjectId(String startDate, String endDate, Long projectId, Integer pageNo, Integer pageSize, String sort);
 
-    List<ByteDanceReportAccountDailyDTO> getBytedanceSaleProjectInfo(String startDate, String endDate, List<Long> projectList, Integer pageNum, Integer pageSize, String sort);
+    PageInfo<ByteDanceReportAccountDailyDTO> getBytedanceSaleProjectInfo(String startDate, String endDate, List<Long> projectList, Integer pageNum, Integer pageSize, String sort);
 
     //List<ByteDanceReportAccountDailyDTO> getBytedanceSaleProjectInfo(String startDate, String endDate, Long projectId, int pageNum, int pageSize, String sort);
 }

+ 10 - 6
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/BytedanceAccountReportServiceImpl.java

@@ -8,8 +8,11 @@ import cn.com.ctop.toutiao.modules.utils.LinkUtils;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
 import org.apache.commons.lang.StringUtils;
+import org.apache.shiro.SecurityUtils;
 import org.jeecg.common.constant.SystemDateConstant;
+import org.jeecg.common.system.vo.LoginUser;
 import org.jeecg.common.util.DateUtils;
 import org.jeecg.common.util.JsonResourceUtil;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -185,12 +188,13 @@ public class BytedanceAccountReportServiceImpl implements IBytedanceAccountRepor
     }
 
     @Override
-    public List<ByteDanceReportAccountDailyDTO> getBytedanceSaleProjectInfo(String startDate, String endDate, List<Long> projectList, Integer pageNum, Integer pageSize, String sort){
+    public PageInfo<ByteDanceReportAccountDailyDTO> getBytedanceSaleProjectInfo(String startDate, String endDate, List<Long> projectList, Integer pageNum, Integer pageSize, String sort){
         List<ByteDanceReportAccountDailyDTO> list = new ArrayList<>();
 
         if(projectList==null || projectList.size()==0){
-            //LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
-            String userId = "388e787edd294ecfb9243fe176a3ae56";
+            LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+            String userId = sysUser.getId();
+            //String userId = "388e787edd294ecfb9243fe176a3ae56";
             String roleCode = bytedanceAccountReportMapper.getRoleCodeByUserId(userId);
 
             List<Long> mediaIds = new ArrayList<>();
@@ -251,18 +255,18 @@ public class BytedanceAccountReportServiceImpl implements IBytedanceAccountRepor
             project.setActiveRegisterCost(p.getActiveRegisterCost());
         }
 
-        return list;
+        return new PageInfo<>(list);
     }
 
     @Override
-    public List<ByteDanceReportAccountDailyDTO> getBytedanceAccountInfoByProjectId(String startDate, String endDate, Long projectId,Integer pageNo, Integer pageSize, String sort){
+    public PageInfo<ByteDanceReportAccountDailyDTO> getBytedanceAccountInfoByProjectId(String startDate, String endDate, Long projectId, Integer pageNo, Integer pageSize, String sort){
         if(StringUtils.isBlank(sort)){
             sort = "cost-";
         }
         sort = sort.replace("-", " desc,").replace("+", " asc,");  //sort=id-name+age+
         sort = sort.substring(0, sort.length() - 1);
         PageHelper.startPage(pageNo,pageSize,sort);
-        return bytedanceAccountReportMapper.getBytedanceAccountInfoByProjectId(startDate,endDate,projectId);
+        return new PageInfo<>(bytedanceAccountReportMapper.getBytedanceAccountInfoByProjectId(startDate,endDate,projectId));
     }