Procházet zdrojové kódy

绩效接口问题修改,公司报表

hcst_sunzhen před 5 roky
rodič
revize
d686f795c3

+ 15 - 7
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/PerformanceServiceImpl2.java

@@ -1895,7 +1895,7 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
         String endTime = timeMap.get("endDate");
 
         //1 获取快手下所有人
-        List<UserDto2> userDto2List = userEfficientVideoMapMapper.getKuaishouDepartUserInfo();
+        List<UserDto2> userDto2List = userEfficientVideoMapMapper.getKuaishouDepartAllUserInfo();
         //2 循环所有人,并查询出每个人的有效视频数、总视频数、总消耗
         for (UserDto2 userDto : userDto2List) {
             //String roleCode = userDto.getRoleCode();
@@ -1910,7 +1910,9 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
             }
             //2.4 当季度绩效
             BigDecimal performance = userEfficientVideoMapMapper.getQuarterPerformance(userDto.getUserId(), year, quarter, 2);
-
+            if(performance==null){
+                performance=BigDecimal.ZERO;
+            }
             userDto.setEffiRate(performance);
             userDto.setCost(cost);
             userDto.setVideoCount(videoCount);
@@ -1928,7 +1930,7 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
         String endTime = timeMap.get("endDate");
 
         //1 获取头条下所有人
-        List<UserDto2> userDto2List = userEfficientVideoMapMapper.getToutiaoDepartUserInfo();
+        List<UserDto2> userDto2List = userEfficientVideoMapMapper.getToutiaoDepartAllUserInfo();
         //2 循环所有人,并查询出每个人的有效视频数、总视频数、总消耗
         for (UserDto2 userDto : userDto2List) {
             //String roleCode = userDto.getRoleCode();
@@ -1943,7 +1945,9 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
             }
             //2.4 当季度绩效
             BigDecimal performance = userEfficientVideoMapMapper.getQuarterPerformance(userDto.getUserId(), year, quarter, 1);
-
+            if(performance==null){
+                performance=BigDecimal.ZERO;
+            }
             userDto.setEffiRate(performance);
             userDto.setCost(cost);
             userDto.setVideoCount(videoCount);
@@ -1969,10 +1973,8 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
         return materialInfoList;
     }
 
-
-
     //快手优化季度绩效报表
-    //@Override
+    @Override
     public List<UserDto2> kuaishouYouhuaQuarterReport(Integer year, Integer quarter) {
         //1 获取快手下所有人
         List<UserDto2> userDto2List = userEfficientVideoMapMapper.getKuaishouYunyingDepartUserInfo();
@@ -1985,6 +1987,9 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
             }
             //当季度绩效
             BigDecimal performance = userEfficientVideoMapMapper.getQuarterPerformance(userDto.getUserId(), year, quarter, 2);
+            if(performance==null){
+                performance=BigDecimal.ZERO;
+            }
             userDto.setEffiRate(performance);
             userDto.setCost(cost);
             userDto.setYear(year);
@@ -2008,6 +2013,9 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
             }
             //当季度绩效
             BigDecimal performance = userEfficientVideoMapMapper.getQuarterPerformance(userDto.getUserId(), year, quarter, 1);
+            if(performance==null){
+                performance=BigDecimal.ZERO;
+            }
             userDto.setEffiRate(performance);
             userDto.setCost(cost);
             userDto.setYear(year);

+ 26 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/KuaishouReportDailyAgentSumController.java

@@ -9,6 +9,7 @@ import java.net.URLDecoder;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAgent;
 import cn.com.ctop.kuaishou.modules.report.entity.ParamsDTO;
 import org.apache.commons.lang.StringUtils;
 import org.jeecg.common.api.vo.Result;
@@ -240,6 +241,7 @@ public class KuaishouReportDailyAgentSumController {
 		 if(StringUtils.isBlank(startDate) || StringUtils.isBlank(endDate)){
 			 result.setSuccess(false);
 			 result.setMessage("时间不能为空");
+			 return result;
 		 }
 
 		 KuaishouReportDailyAgentSum kuaishouReportDailyAgentSum = kuaishouReportDailyAgentSumService.companyReportSum(startDate,endDate);
@@ -250,4 +252,28 @@ public class KuaishouReportDailyAgentSumController {
 		 return result;
 	 }
 
+	 /**
+	  * @param dto
+	  * @return Result<KuaishouReportDailyAgentSum>
+	  */
+	 @AutoLog(value = "公司报表按时间汇总")
+	 @ApiOperation(value="公司报表按时间汇总", notes="公司报表按时间汇总")
+	 @PostMapping(value = "/companyReportAccountDetailList")
+	 public Result<List<KuaishouReportDailyAgent>> companyReportAccountDetailList(@RequestBody ParamsDTO dto) {
+		 Result<List<KuaishouReportDailyAgent>> result = new Result<>();
+		 String date = dto.getDate();
+		 if(StringUtils.isBlank(date)){
+			 result.setSuccess(false);
+			 result.setMessage("时间不能为空");
+			 return result;
+		 }
+
+		 List<KuaishouReportDailyAgent> kuaishouReportDailyAgentList = kuaishouReportDailyAgentSumService.companyReportAccountDetailList(date);
+		 result.setResult(kuaishouReportDailyAgentList);
+		 result.setSuccess(true);
+		 result.setMessage("success");
+
+		 return result;
+	 }
+
 }

+ 5 - 5
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/KuaishouReportDailyAgentSum.java

@@ -38,7 +38,7 @@ public class KuaishouReportDailyAgentSum {
 	/**有消费计划数*/
 	@Excel(name = "有消费计划数", width = 15)
     @ApiModelProperty(value = "有消费计划数")
-	private Integer costCampaignCount;
+	private Long costCampaignCount;
 	/**总余额*/
 	@Excel(name = "总余额", width = 15)
     @ApiModelProperty(value = "总余额")
@@ -70,19 +70,19 @@ public class KuaishouReportDailyAgentSum {
 	/**封面曝光数*/
 	@Excel(name = "封面曝光数", width = 15)
     @ApiModelProperty(value = "封面曝光数")
-	private Integer fengmianShowCount;
+	private Long fengmianShowCount;
 	/**封面点击数*/
 	@Excel(name = "封面点击数", width = 15)
     @ApiModelProperty(value = "封面点击数")
-	private Integer fengmianClickCount;
+	private Long fengmianClickCount;
 	/**素材曝光数*/
 	@Excel(name = "素材曝光数", width = 15)
     @ApiModelProperty(value = "素材曝光数")
-	private Integer sucaiShowCount;
+	private Long sucaiShowCount;
 	/**行为数*/
 	@Excel(name = "行为数", width = 15)
     @ApiModelProperty(value = "行为数")
-	private Integer convertCount;
+	private Long convertCount;
 	/**封面点击率*/
 	@Excel(name = "封面点击率", width = 15)
     @ApiModelProperty(value = "封面点击率")

+ 1 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/ParamsDTO.java

@@ -9,4 +9,5 @@ import java.io.Serializable;
 public class ParamsDTO implements Serializable {
     private String startDate;
     private String endDate;
+    private String date;
 }

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

@@ -2,6 +2,7 @@ package cn.com.ctop.kuaishou.modules.report.mapper;
 
 import java.util.List;
 
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAgent;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAgentSum;
 import org.apache.ibatis.annotations.Param;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
@@ -16,4 +17,6 @@ public interface KuaishouReportDailyAgentSumMapper extends BaseMapper<KuaishouRe
     List<KuaishouReportDailyAgentSum> companyReport(@Param("startDate")String startDate, @Param("endDate")String endDate);
 
     KuaishouReportDailyAgentSum companyReportSum(@Param("startDate")String startDate, @Param("endDate")String endDate);
+
+    List<KuaishouReportDailyAgent> companyReporAccountDetailList(@Param("date")String date);
 }

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

@@ -49,4 +49,33 @@
         date &lt;= #{endDate} and
         date &gt;= #{startDate}
     </select>
+
+    <!-- 根据传入时间获取公司报表账户的列表 -->
+    <select id="companyReporAccountDetailList" resultType="cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAgent">
+            select
+            date as date,  <!-- 日期 -->
+            account_id as accountId,  <!-- 账户id -->
+            kid as kid, <!-- 快手id -->
+            advertiser_name as advertiserName, <!-- 广告主名称 -->
+            advertiser_create_time as advertiserCreateTime, <!-- 广告主创建时间 -->
+            cost_campaign_count as costCampaignCount, <!-- 有消费计划数 -->
+            balance as balance, <!-- 总余额 -->
+            cost as cost, <!-- 总消耗 -->
+            xianjin_cost as xianjinCost, <!-- 现金消耗 -->
+            fandian_cost as fandianCost, <!-- 后返消耗 -->
+            kuangfan_cost as kuangfanCost, <!-- 框返消耗 -->
+            jili_cost as jiliCost, <!-- 激励账户消耗 -->
+            xinyong_cost as xinyongCost, <!-- 信用账户消耗 -->
+            fengmian_show_count as fengmianShowCount, <!-- 封面曝光数 -->
+            fengmian_click_count as fengmianClickCount, <!-- 封面点击数 -->
+            sucai_show_count as sucaiShowCount, <!-- 素材曝光数 -->
+            convert_count as convertCount, <!-- 行为数 -->
+            fengmian_click_rate as fengmianClickRate, <!-- 封面点击率 -->
+            convert_click_rate as convertClickRate <!-- 转化点击率 -->
+        from
+        ctop_kuaishou_report_daily_agent
+        where
+        date_format(date, '%Y-%m-%d') = #{date}
+    </select>
+
 </mapper>

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

@@ -1,5 +1,6 @@
 package cn.com.ctop.kuaishou.modules.report.service;
 
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAgent;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAgentSum;
 import com.baomidou.mybatisplus.extension.service.IService;
 
@@ -14,4 +15,6 @@ import java.util.List;
 public interface IKuaishouReportDailyAgentSumService extends IService<KuaishouReportDailyAgentSum> {
     List<KuaishouReportDailyAgentSum> companyReport(String startDate, String endDate);
     KuaishouReportDailyAgentSum companyReportSum(String startDate, String endDate);
+
+    List<KuaishouReportDailyAgent> companyReportAccountDetailList(String date);
 }

+ 5 - 5
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaishouReportDailyAgentServiceImpl.java

@@ -123,17 +123,17 @@ public class KuaishouReportDailyAgentServiceImpl extends ServiceImpl<KuaishouRep
                             KuaishouReportDailyAgentSum kuaishouReportDailyAgentSum = new KuaishouReportDailyAgentSum();
                             kuaishouReportDailyAgentSum.setBalance(dataNode.get("totalBalanceDouble").decimalValue());
                             kuaishouReportDailyAgentSum.setConvertClickRate(dataNode.get("actionbarClickRatio").decimalValue());
-                            kuaishouReportDailyAgentSum.setConvertCount(dataNode.get("actionbarClick").asInt());
+                            kuaishouReportDailyAgentSum.setConvertCount(dataNode.get("actionbarClick").asLong());
                             kuaishouReportDailyAgentSum.setCost(dataNode.get("totalChargedInYuan").decimalValue());
-                            kuaishouReportDailyAgentSum.setCostCampaignCount(dataNode.get("chargedCampaignCount").asInt());
+                            kuaishouReportDailyAgentSum.setCostCampaignCount(dataNode.get("chargedCampaignCount").asLong());
                             kuaishouReportDailyAgentSum.setDate(sdf.parse(currentDate));
-                            kuaishouReportDailyAgentSum.setFengmianClickCount(dataNode.get("adPhotoClick").asInt());
+                            kuaishouReportDailyAgentSum.setFengmianClickCount(dataNode.get("adPhotoClick").asLong());
                             kuaishouReportDailyAgentSum.setFengmianClickRate(dataNode.get("clickRatio").decimalValue());
-                            kuaishouReportDailyAgentSum.setFengmianShowCount(dataNode.get("impression").asInt());
+                            kuaishouReportDailyAgentSum.setFengmianShowCount(dataNode.get("impression").asLong());
                             kuaishouReportDailyAgentSum.setFandianCost(dataNode.get("rebateRealChargedInYuan").decimalValue());
                             kuaishouReportDailyAgentSum.setJiliCost(dataNode.get("directRebateRealChargedInYuan").decimalValue());
                             kuaishouReportDailyAgentSum.setKuangfanCost(dataNode.get("contractRebateRealChargedInYuan").decimalValue());
-                            kuaishouReportDailyAgentSum.setSucaiShowCount(dataNode.get("click").asInt());
+                            kuaishouReportDailyAgentSum.setSucaiShowCount(dataNode.get("click").asLong());
                             kuaishouReportDailyAgentSum.setXianjinCost(dataNode.get("realChargedInYuan").decimalValue());
                             kuaishouReportDailyAgentSum.setXinyongCost(dataNode.get("creditRealChargedInYuan").decimalValue());
                             QueryWrapper<KuaishouReportDailyAgentSum> queryWrapper = new QueryWrapper<>();

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

@@ -1,5 +1,6 @@
 package cn.com.ctop.kuaishou.modules.report.service.impl;
 
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAgent;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAgentSum;
 import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyAgentSumMapper;
 import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyAgentSumService;
@@ -32,4 +33,10 @@ public class KuaishouReportDailyAgentSumServiceImpl extends ServiceImpl<Kuaishou
         return kuaishouReportDailyAgentSumMapper.companyReportSum(startDate, endDate);
     }
 
+    //公司报表详情
+    @Override
+    public List<KuaishouReportDailyAgent> companyReportAccountDetailList(String date){
+        return kuaishouReportDailyAgentSumMapper.companyReporAccountDetailList(date);
+    }
+
 }

+ 3 - 3
performance-appraisal/src/main/java/cn/com/ctop/userefficientvideomap/mapper/UserEfficientVideoMapMapper.java

@@ -108,8 +108,9 @@ public interface UserEfficientVideoMapMapper extends BaseMapper<UserEfficientVid
     void updateToutiaoEffiType(@Param("toutiaoEffiType") Integer toutiaoEffiType, @Param("signature") String signature);
 
     List<UserDto2> getKuaishouDepartUserInfo();
-
+    List<UserDto2> getKuaishouDepartAllUserInfo();
     List<UserDto2> getToutiaoDepartUserInfo();
+    List<UserDto2> getToutiaoDepartAllUserInfo();
 
     //根据天数的区间获取userId获取有效视频数量
     Integer getEffiVideoCountByCalcDate(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("roleId") String roleId, @Param("userId") String userId, @Param("appType") Integer appType);
@@ -128,8 +129,7 @@ public interface UserEfficientVideoMapMapper extends BaseMapper<UserEfficientVid
     //获取头条单个优化师其下所有的账户下当前的消耗
     List<AccountDTO> getToutiaoAccountTotalCost(@Param("userId")String userId, @Param("appType")Integer appType, @Param("startDate")String startDate, @Param("endDate")String endDate);
 
-
-
     List<MaterialInfo> getEffiWeekVideoList(@Param("appType")Integer appType, @Param("startDate")String startDate, @Param("endDate")String endDate, @Param("userId")String userId);
+
 }
 

+ 36 - 4
performance-appraisal/src/main/java/cn/com/ctop/userefficientvideomap/mapper/xml/UserEfficientVideoMapMapper.xml

@@ -714,7 +714,25 @@
 
     <!-- 获取北京快手设计部所有编导、剪辑、拍摄的信息 -->
     <select id="getKuaishouDepartUserInfo" resultType="cn.com.ctop.userefficientvideomap.entity.UserDto2">
-        select u.id as userId,
+            select
+            u.id as userId,
+            u.realname as realname,
+            r.role_name as roleName,
+            r.role_code as roleCode,
+            r.id as roleId
+        FROM sys_user_depart ud
+        left join sys_depart b on ud.dep_id = b.id
+        left join sys_user u on ud.user_id = u.id
+        left join sys_user_role ur on u.id = ur.user_id
+        left join sys_role r on ur.role_id = r.id
+        WHERE b.parent_id = '4e939124a5f541c88838e49d2a3ea72b'  <!-- 快手设计部 -->
+        and r.role_code in ('plan','clip','shot')
+    </select>
+
+    <!-- 获取北京快手设计部所有人员的信息 -->
+    <select id="getKuaishouDepartAllUserInfo" resultType="cn.com.ctop.userefficientvideomap.entity.UserDto2">
+        select
+        u.id as userId,
         u.realname as realname,
         r.role_name as roleName,
         r.role_code as roleCode,
@@ -725,11 +743,26 @@
         left join sys_user_role ur on u.id = ur.user_id
         left join sys_role r on ur.role_id = r.id
         WHERE b.parent_id = '4e939124a5f541c88838e49d2a3ea72b'  <!-- 快手设计部 -->
-        and r.role_code in ('plan','clip','shot')
     </select>
 
     <!-- 获取北京头条设计部所有编导、剪辑、拍摄的信息 -->
     <select id="getToutiaoDepartUserInfo" resultType="cn.com.ctop.userefficientvideomap.entity.UserDto2">
+            select u.id as userId,
+            u.realname as realname,
+            r.role_name as roleName,
+            r.role_code as roleCode,
+            r.id as roleId
+        FROM sys_user_depart ud
+        left join sys_depart b on ud.dep_id = b.id
+        left join sys_user u on ud.user_id = u.id
+        left join sys_user_role ur on u.id = ur.user_id
+        left join sys_role r on ur.role_id = r.id
+        WHERE b.parent_id = '26c10ecb5e0d416bb01f8ff983f4588c'  <!-- 头条设计部 -->
+        and r.role_code in ('plan','clip','shot')
+    </select>
+
+    <!-- 获取北京头条设计部所有编导、剪辑、拍摄的信息 -->
+    <select id="getToutiaoDepartAllUserInfo" resultType="cn.com.ctop.userefficientvideomap.entity.UserDto2">
         select u.id as userId,
         u.realname as realname,
         r.role_name as roleName,
@@ -740,8 +773,7 @@
         left join sys_user u on ud.user_id = u.id
         left join sys_user_role ur on u.id = ur.user_id
         left join sys_role r on ur.role_id = r.id
-        WHERE b.parent_id = '26c10ecb5e0d416bb01f8ff983f4588c'  <!-- 快手设计部 -->
-        and r.role_code in ('plan','clip','shot')
+        WHERE b.parent_id = '26c10ecb5e0d416bb01f8ff983f4588c'  <!-- 头条设计部 -->
     </select>
 
     <!-- 获取北京快手运营部所有优化师得信息 -->