|
@@ -104,7 +104,36 @@ public class MaterialReportOverViewServiceImpl implements IMaterialReportOverVie
|
|
|
result.put("yesterdayCost", yesterdayCost);
|
|
|
//环比 (昨日消耗-前日消耗)/前日消耗 X 100%
|
|
|
result.put("chainCompare", countLink(yesterdayCost,beforeYesterdayCost));
|
|
|
- //视频上新
|
|
|
+
|
|
|
+ } else if (mediaId == CtopAdConstant.PLATFORM_TYPE_KUAISHOU_INT) {
|
|
|
+ //总消耗
|
|
|
+ BigDecimal cost = materialReportOverViewMapper.queryKuaishouCost(startDate, endDate, projects);
|
|
|
+ //上阶段
|
|
|
+ BigDecimal lastCost = materialReportOverViewMapper.queryKuaishouCost(DateUtils.addDay(startDate, -DateUtils.dateDiff(startDate, endDate)-1), DateUtils.addDay(startDate, -1), projects);
|
|
|
+ result.put("costTotal", cost);
|
|
|
+ //同比 (本阶段截止昨天消耗-上一个阶段截止和昨天对应日期的消耗)/上一个阶段截止和昨天对应日期的消耗 X 100%
|
|
|
+ result.put("yearOnYearCompare", countLink(cost,lastCost));
|
|
|
+ //昨日消耗
|
|
|
+ BigDecimal yesterdayCost = materialReportOverViewMapper.queryKuaishouCost(endDate, endDate, projects);
|
|
|
+ //前天消耗
|
|
|
+ BigDecimal beforeYesterdayCost = materialReportOverViewMapper.queryKuaishouCost(DateUtils.addDay(endDate, -1), DateUtils.addDay(endDate, -1), projects);
|
|
|
+ result.put("yesterdayCost", yesterdayCost);
|
|
|
+ //环比 (昨日消耗-前日消耗)/前日消耗 X 100%
|
|
|
+ result.put("chainCompare", countLink(yesterdayCost,beforeYesterdayCost));
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Map<String, Object> sumDataVideoNewEffective(int mediaId, String startDate, String endDate, JSONArray projects) {
|
|
|
+ Map<String, Object> result = new HashMap<>();
|
|
|
+ if (projects.isEmpty()) {
|
|
|
+ projects = getProjectsByCurrentUser(mediaId);
|
|
|
+ }
|
|
|
+ if (mediaId == CtopAdConstant.PLATFORM_TYPE_BYTEDANCE_INT) {
|
|
|
+ //视频上新
|
|
|
List<Map<String, String>> videoList = materialReportOverViewMapper.queryMaterialCountList(startDate+" 00:00:00", endDate+" 23:59:59", projects);
|
|
|
//总数
|
|
|
long videoTotal = videoList.stream().collect(Collectors.summarizingInt(s->Integer.valueOf(String.valueOf(s.get("count"))))).getSum();
|
|
@@ -121,6 +150,39 @@ public class MaterialReportOverViewServiceImpl implements IMaterialReportOverVie
|
|
|
result.put("effectiveTotal",effectiveTotal);
|
|
|
//素材有效率 = 有效视频数量 / 视频总数 X 100%
|
|
|
result.put("effectiveCompare",Check.isNull(videoCost) ? 0: new BigDecimal(effectiveTotal).divide(new BigDecimal(videoTotal),4, RoundingMode.HALF_UP));
|
|
|
+
|
|
|
+ } else if (mediaId == CtopAdConstant.PLATFORM_TYPE_KUAISHOU_INT) {
|
|
|
+
|
|
|
+ //视频上新
|
|
|
+ List<Map<String, String>> videoList = materialReportOverViewMapper.queryMaterialCountListKs(startDate+" 00:00:00", endDate+" 23:59:59", projects);
|
|
|
+ //总数
|
|
|
+ long videoTotal = videoList.stream().collect(Collectors.summarizingInt(s->Integer.valueOf(String.valueOf(s.get("count"))))).getSum();
|
|
|
+ result.put("videoList",videoList);
|
|
|
+ result.put("videoTotal",videoTotal);
|
|
|
+ //素材使用率 = 有消耗的素材 / 总数 * 100%
|
|
|
+ long videoCost = materialReportOverViewMapper.queryMaterialCostListKs(startDate+" 00:00:00", endDate+" 23:59:59", projects);
|
|
|
+ result.put("useCompare", Check.isNull(videoCost) ? 0: new BigDecimal(videoCost).divide(new BigDecimal(videoTotal),4, RoundingMode.HALF_UP));
|
|
|
+ //有效视频
|
|
|
+ List<Map<String, String>> effectiveList = materialReportOverViewMapper.selectEffectiveMaterialVideoKs(startDate,endDate, projects);
|
|
|
+ //总数
|
|
|
+ long effectiveTotal = effectiveList.stream().collect(Collectors.summarizingInt(s->Integer.valueOf(String.valueOf(s.get("count"))))).getSum();
|
|
|
+ result.put("effectiveList",effectiveList);
|
|
|
+ result.put("effectiveTotal",effectiveTotal);
|
|
|
+ //素材有效率 = 有效视频数量 / 视频总数 X 100%
|
|
|
+ result.put("effectiveCompare",Check.isNull(videoTotal) ? 0 : new BigDecimal(effectiveTotal).divide(new BigDecimal(videoTotal),4, RoundingMode.HALF_UP));
|
|
|
+
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ //爆款视频
|
|
|
+ @Override
|
|
|
+ public Map<String, Object> sumDataVideoHot(int mediaId, String startDate, String endDate, JSONArray projects) {
|
|
|
+ Map<String, Object> result = new HashMap<>();
|
|
|
+ if (projects.isEmpty()) {
|
|
|
+ projects = getProjectsByCurrentUser(mediaId);
|
|
|
+ }
|
|
|
+ if (mediaId == CtopAdConstant.PLATFORM_TYPE_BYTEDANCE_INT) {
|
|
|
//爆款视频
|
|
|
List<Map<String, String>> hotList = materialReportOverViewMapper.selectHotMaterialVideoBytedance(startDate,endDate, projects);
|
|
|
//总数
|
|
@@ -142,39 +204,6 @@ public class MaterialReportOverViewServiceImpl implements IMaterialReportOverVie
|
|
|
result.put("hostCompare", countLink(new BigDecimal(yesterday),new BigDecimal(before)));
|
|
|
|
|
|
} else if (mediaId == CtopAdConstant.PLATFORM_TYPE_KUAISHOU_INT) {
|
|
|
- //总消耗
|
|
|
- BigDecimal cost = materialReportOverViewMapper.queryKuaishouCost(startDate, endDate, projects);
|
|
|
- //上阶段
|
|
|
- BigDecimal lastCost = materialReportOverViewMapper.queryKuaishouCost(DateUtils.addDay(startDate, -DateUtils.dateDiff(startDate, endDate)-1), DateUtils.addDay(startDate, -1), projects);
|
|
|
- result.put("costTotal", cost);
|
|
|
- //同比 (本阶段截止昨天消耗-上一个阶段截止和昨天对应日期的消耗)/上一个阶段截止和昨天对应日期的消耗 X 100%
|
|
|
- result.put("yearOnYearCompare", countLink(cost,lastCost));
|
|
|
- //昨日消耗
|
|
|
- BigDecimal yesterdayCost = materialReportOverViewMapper.queryKuaishouCost(endDate, endDate, projects);
|
|
|
- //前天消耗
|
|
|
- BigDecimal beforeYesterdayCost = materialReportOverViewMapper.queryKuaishouCost(DateUtils.addDay(endDate, -1), DateUtils.addDay(endDate, -1), projects);
|
|
|
- result.put("yesterdayCost", yesterdayCost);
|
|
|
- //环比 (昨日消耗-前日消耗)/前日消耗 X 100%
|
|
|
- result.put("chainCompare", countLink(yesterdayCost,beforeYesterdayCost));
|
|
|
-
|
|
|
- //视频上新
|
|
|
- List<Map<String, String>> videoList = materialReportOverViewMapper.queryMaterialCountList(startDate+" 00:00:00", endDate+" 23:59:59", projects);
|
|
|
- //总数
|
|
|
- long videoTotal = videoList.stream().collect(Collectors.summarizingInt(s->Integer.valueOf(String.valueOf(s.get("count"))))).getSum();
|
|
|
- result.put("videoList",videoList);
|
|
|
- result.put("videoTotal",videoTotal);
|
|
|
- //素材使用率 = 有消耗的素材 / 总数 * 100%
|
|
|
- long videoCost = materialReportOverViewMapper.queryMaterialCostListKs(startDate+" 00:00:00", endDate+" 23:59:59", projects);
|
|
|
-
|
|
|
- result.put("useCompare", Check.isNull(videoCost) ? 0: new BigDecimal(videoCost).divide(new BigDecimal(videoTotal),4, RoundingMode.HALF_UP));
|
|
|
- //有效视频
|
|
|
- List<Map<String, String>> effectiveList = materialReportOverViewMapper.selectEffectiveMaterialVideoKs(startDate,endDate, projects);
|
|
|
- //总数
|
|
|
- long effectiveTotal = effectiveList.stream().collect(Collectors.summarizingInt(s->Integer.valueOf(String.valueOf(s.get("count"))))).getSum();
|
|
|
- result.put("effectiveList",effectiveList);
|
|
|
- result.put("effectiveTotal",effectiveTotal);
|
|
|
- //素材有效率 = 有效视频数量 / 视频总数 X 100%
|
|
|
- result.put("effectiveCompare",Check.isNull(videoTotal) ? 0 : new BigDecimal(effectiveTotal).divide(new BigDecimal(videoTotal),4, RoundingMode.HALF_UP));
|
|
|
//爆款视频
|
|
|
List<Map<String, String>> hotList = materialReportOverViewMapper.selectHotMaterialVideoKs(startDate,endDate, projects);
|
|
|
//总数
|
|
@@ -198,6 +227,12 @@ public class MaterialReportOverViewServiceImpl implements IMaterialReportOverVie
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
@Override
|
|
|
public List<JSONObject> getTotalChat(int mediaId, String startDate, String endDate, JSONArray projects) {
|
|
|
List<JSONObject> result = new ArrayList<>();
|
|
@@ -477,6 +512,9 @@ public class MaterialReportOverViewServiceImpl implements IMaterialReportOverVie
|
|
|
//环比计算
|
|
|
private BigDecimal countLink(BigDecimal numA, BigDecimal numB) {
|
|
|
BigDecimal link = new BigDecimal("0");
|
|
|
+ if (Check.isNull(numA) || Check.isNull(numB)){
|
|
|
+ return link;
|
|
|
+ }
|
|
|
if (numB.compareTo(BigDecimal.ZERO)!=0) {
|
|
|
link = (numA.subtract(numB)).divide(numB, 4, RoundingMode.HALF_UP);
|
|
|
}
|