Browse Source

王垒、李娜效果报表

hcst_sunzhen 4 years ago
parent
commit
2e54beed3c

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

@@ -157,6 +157,35 @@ public class KuaiShouController {
     }
 
     @ResponseBody
+    @RequestMapping("/getKuaishouSaleAccountInfoByProjectId")
+    public Result<PageInfo<KuaishouReportDailyAccountDTO>> getKuaishouSaleAccountInfoByProjectId(@RequestBody KuaishouInfoDTO dto) {
+        Result<PageInfo<KuaishouReportDailyAccountDTO>> result = new Result<>();
+        result.setSuccess(true);
+
+        if(dto == null || dto.getStartDate() ==null || dto.getEndDate() == null){
+            result.setSuccess(false);
+            result.setMessage("参数有误");
+            return result;
+        }
+
+        if(dto.getPageSize() == 0){
+            dto.setPageSize(20);
+        }
+
+        try{
+            PageInfo<KuaishouReportDailyAccountDTO> kuaishouReportDailyAccountDTOList = accountService.getKuaishouSaleAccountInfoByProjectId(dto.getProjectId(), dto.getStartDate(), dto.getEndDate(),dto.getPageSize(),dto.getPageNum(),dto.getYn());
+            result.setResult(kuaishouReportDailyAccountDTOList);
+        }catch(Exception e){
+            log.error(e.getMessage());
+            result.setSuccess(false);
+            result.setMessage("执行出错");
+        }finally {
+        }
+
+        return result;
+    }
+
+    @ResponseBody
     @RequestMapping("/getKuaishouCampaignInfoByAccountId")
     public Result<PageInfo<KuaishouReportDailyAccountDTO>> getKuaishouCampaignInfoByAccountId(@RequestBody KuaishouInfoDTO dto) {
         Result<PageInfo<KuaishouReportDailyAccountDTO>> result = new Result<>();

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

@@ -45,4 +45,8 @@ public interface KuaishouReportDailyAccountMapper extends BaseMapper<KuaishouRep
     List<Long> getUserProjectAccountIdsByAdmin();
 
 
+
+    List<Long> getSaleProjectAccountIds(@Param("userId")String userId);
+
+
 }

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

@@ -1087,4 +1087,17 @@
         limit 50
     </select>
 
+    <select id="getSaleProjectAccountIds" resultType="long">
+        select
+        a.account_id
+        from
+        (select project_id,account_id,media_id,create_time from ctop_user_allocation  group by account_id) a
+        left join ctop_project b on a.project_id=b.id
+        where
+        b.sale_id = #{userId}
+        and b.media_id in (1,3)
+        order by a.create_time desc
+        limit 50
+    </select>
+
 </mapper>

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

@@ -20,6 +20,8 @@ public interface IKuaishouReportDailyAccountService extends IService<KuaishouRep
 
     PageInfo<ProjectAccountDTO> getKuaishouSaleProjectInfo(String startDate, String endDate, List<Long> projectList, Integer pageSize, Integer pageNum, String sort, Integer yn);
 
+    PageInfo<KuaishouReportDailyAccountDTO> getKuaishouSaleAccountInfoByProjectId(Long projectId, String startDate, String endDate, Integer pageSize, Integer pageNum, Integer yn);
+
     PageInfo<KuaishouReportDailyAccountDTO> getKuaishouAccountInfoByProjectId(Long projectId, String startDate, String endDate, Integer pageSize, Integer pageNum, Integer yn);
 
     PageInfo<KuaishouReportDailyAccountDTO> getKuaishouCampaignInfoByAccountId(Long accountId, String startDate, String endDate, Integer pageSize, Integer pageNum, Integer yn);

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

@@ -83,6 +83,26 @@ public class KuaishouReportDailyAccountServiceImpl extends ServiceImpl<KuaishouR
         return new PageInfo<>(dailyAccountMapper.getKuaishouProjectInfo(startDate,endDate,projectList,yn));
     }
 
+    @Override
+    public PageInfo<KuaishouReportDailyAccountDTO> getKuaishouSaleAccountInfoByProjectId(Long projectId, String startDate, String endDate, Integer pageSize, Integer pageNum, Integer yn){
+        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+        //String userId = "e9ca23d68d884d4ebb19d07889727dae";
+        String userId = sysUser.getId();
+        String roleCode = dailyAccountMapper.getRoleCodeByUserId(userId);
+
+        List<Long> accountIds = null;
+        if(projectId == null){
+            if("admin".equals(roleCode)){
+                accountIds = dailyAccountMapper.getUserProjectAccountIdsByAdmin();
+            }else {
+                accountIds = dailyAccountMapper.getSaleProjectAccountIds(userId);
+            }
+        }
+
+        PageHelper.startPage(pageNum,pageSize);
+        return new PageInfo<>(dailyAccountMapper.getKuaishouAccountInfoByProjectId(startDate, endDate, projectId, accountIds, yn));
+    }
+
 
     @Override
     public PageInfo<KuaishouReportDailyAccountDTO> getKuaishouAccountInfoByProjectId(Long projectId, String startDate, String endDate, Integer pageSize, Integer pageNum, Integer yn){

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

@@ -61,6 +61,8 @@ public interface BytedanceAccountReportMapper {
 
     List<Long> getUserProjectAccountIds(@Param("userId")String userId);
 
+    List<Long> getSaleProjectAccountIds(@Param("userId")String userId);
+
     List<Long> getUserProjectAccountIdsByAdmin();
 
 }

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

@@ -435,14 +435,29 @@
         select
         a.account_id
         from
-        (select project_id,account_id,media_id from ctop_user_allocation  group by account_id) a
+        (select project_id,account_id,media_id,create_time from ctop_user_allocation  group by account_id) a
         left join ctop_project_member b on a.project_id=b.project_id
         where
+        a.user_id = #{userId}
         and a.media_id in (1,3)
         order by a.create_time desc
         limit 50
     </select>
 
+
+    <select id="getSaleProjectAccountIds" resultType="long">
+        select
+        a.account_id
+        from
+        (select project_id,account_id,media_id,create_time from ctop_user_allocation  group by account_id) a
+        left join ctop_project b on a.project_id=b.id
+        where
+        b.sale_id = #{userId}
+        and b.media_id in (1,3)
+        order by a.create_time desc
+        limit 50
+    </select>
+
     <select id="getUserProjectAccountIdsByAdmin" resultType="long">
         select
         a.account_id

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

@@ -227,7 +227,7 @@ public class BytedanceAccountReportServiceImpl implements IBytedanceAccountRepor
             if("admin".equals(roleCode)){
                 accountIds = bytedanceAccountReportMapper.getUserProjectAccountIdsByAdmin();
             }else {
-                accountIds = bytedanceAccountReportMapper.getUserProjectAccountIds(userId);
+                accountIds = bytedanceAccountReportMapper.getSaleProjectAccountIds(userId);
             }
         }