|
@@ -11,6 +11,7 @@ import com.github.pagehelper.PageInfo;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|
|
import org.apache.shiro.SecurityUtils;
|
|
|
+import org.jeecg.common.api.vo.Result;
|
|
|
import org.jeecg.common.constant.AccountReportConstants;
|
|
|
import org.jeecg.common.system.vo.LoginUser;
|
|
|
import org.jeecg.common.util.DateUtils;
|
|
@@ -93,39 +94,38 @@ public class MaterialReportOverViewServiceImpl implements IMaterialReportOverVie
|
|
|
//总消耗
|
|
|
BigDecimal cost = materialReportOverViewMapper.queryBytedanceCost(startDate, endDate, projects);
|
|
|
//上阶段消耗
|
|
|
- BigDecimal lastCost = materialReportOverViewMapper.queryBytedanceCost(DateUtils.addDay(startDate, -DateUtils.dateDiff(startDate, endDate)-1), DateUtils.addDay(startDate, -1), projects);
|
|
|
+ BigDecimal lastCost = materialReportOverViewMapper.queryBytedanceCost(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));
|
|
|
+ result.put("yearOnYearCompare", countLink(cost, lastCost));
|
|
|
//昨日消耗
|
|
|
BigDecimal yesterdayCost = materialReportOverViewMapper.queryBytedanceCost(endDate, endDate, projects);
|
|
|
//前天消耗
|
|
|
BigDecimal beforeYesterdayCost = materialReportOverViewMapper.queryBytedanceCost(DateUtils.addDay(endDate, -1), DateUtils.addDay(endDate, -1), projects);
|
|
|
result.put("yesterdayCost", yesterdayCost);
|
|
|
//环比 (昨日消耗-前日消耗)/前日消耗 X 100%
|
|
|
- result.put("chainCompare", countLink(yesterdayCost,beforeYesterdayCost));
|
|
|
+ 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);
|
|
|
+ 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));
|
|
|
+ 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));
|
|
|
+ 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<>();
|
|
@@ -133,43 +133,43 @@ public class MaterialReportOverViewServiceImpl implements IMaterialReportOverVie
|
|
|
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);
|
|
|
+ //视频上新
|
|
|
+ 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);
|
|
|
+ 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.queryMaterialCostList(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));
|
|
|
+ long videoCost = materialReportOverViewMapper.queryMaterialCostList(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.selectEffectiveMaterialVideoBytedance(startDate,endDate, projects);
|
|
|
+ List<Map<String, String>> effectiveList = materialReportOverViewMapper.selectEffectiveMaterialVideoBytedance(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);
|
|
|
+ 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(videoCost) ? 0: new BigDecimal(effectiveTotal).divide(new BigDecimal(videoTotal),4, RoundingMode.HALF_UP));
|
|
|
+ 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);
|
|
|
+ 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);
|
|
|
+ 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));
|
|
|
+ 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);
|
|
|
+ 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);
|
|
|
+ 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));
|
|
|
+ result.put("effectiveCompare", Check.isNull(videoTotal) ? 0 : new BigDecimal(effectiveTotal).divide(new BigDecimal(videoTotal), 4, RoundingMode.HALF_UP));
|
|
|
|
|
|
}
|
|
|
return result;
|
|
@@ -184,55 +184,50 @@ public class MaterialReportOverViewServiceImpl implements IMaterialReportOverVie
|
|
|
}
|
|
|
if (mediaId == CtopAdConstant.PLATFORM_TYPE_BYTEDANCE_INT) {
|
|
|
//爆款视频
|
|
|
- List<Map<String, String>> hotList = materialReportOverViewMapper.selectHotMaterialVideoBytedance(startDate,endDate, projects);
|
|
|
+ List<Map<String, String>> hotList = materialReportOverViewMapper.selectHotMaterialVideoBytedance(startDate, endDate, projects);
|
|
|
//总数
|
|
|
- long hotTotal = hotList.stream().collect(Collectors.summarizingInt(s->Integer.valueOf(String.valueOf(s.get("count"))))).getSum();
|
|
|
- result.put("hotList",hotList);
|
|
|
- result.put("hotTotal",hotTotal);
|
|
|
+ long hotTotal = hotList.stream().collect(Collectors.summarizingInt(s -> Integer.valueOf(String.valueOf(s.get("count"))))).getSum();
|
|
|
+ result.put("hotList", hotList);
|
|
|
+ result.put("hotTotal", hotTotal);
|
|
|
//上阶段
|
|
|
- List<Map<String, String>> lastHostList = materialReportOverViewMapper.selectHotMaterialVideoBytedance(DateUtils.addDay(startDate, -DateUtils.dateDiff(startDate, endDate)-1), DateUtils.addDay(startDate, -1), projects);
|
|
|
- long lastHotTotal = lastHostList.stream().collect(Collectors.summarizingInt(s->Integer.valueOf(String.valueOf(s.get("count"))))).getSum();
|
|
|
+ List<Map<String, String>> lastHostList = materialReportOverViewMapper.selectHotMaterialVideoBytedance(DateUtils.addDay(startDate, -DateUtils.dateDiff(startDate, endDate) - 1), DateUtils.addDay(startDate, -1), projects);
|
|
|
+ long lastHotTotal = lastHostList.stream().collect(Collectors.summarizingInt(s -> Integer.valueOf(String.valueOf(s.get("count"))))).getSum();
|
|
|
//同比 (本阶段截止昨天的爆款视频数量-上一个阶段截止和昨天对应日期的爆款视频数量)/上一个阶段截止和昨天对应日期的爆款视频数量X 100%
|
|
|
- result.put("hotYearOnYearCompare", countLink(new BigDecimal(hotTotal),new BigDecimal(lastHotTotal)));
|
|
|
+ result.put("hotYearOnYearCompare", countLink(new BigDecimal(hotTotal), new BigDecimal(lastHotTotal)));
|
|
|
//昨日消耗
|
|
|
- List<Map<String, String>> yesterdayHost = materialReportOverViewMapper.selectHotMaterialVideoBytedance(endDate,endDate, projects);
|
|
|
+ List<Map<String, String>> yesterdayHost = materialReportOverViewMapper.selectHotMaterialVideoBytedance(endDate, endDate, projects);
|
|
|
//前天消耗
|
|
|
List<Map<String, String>> beforeYesterdayHost = materialReportOverViewMapper.selectHotMaterialVideoBytedance(DateUtils.addDay(endDate, -1), DateUtils.addDay(endDate, -1), projects);
|
|
|
- long yesterday = yesterdayHost.stream().collect(Collectors.summarizingInt(s->Integer.valueOf(String.valueOf(s.get("count"))))).getSum();
|
|
|
- long before = beforeYesterdayHost.stream().collect(Collectors.summarizingInt(s->Integer.valueOf(String.valueOf(s.get("count"))))).getSum();
|
|
|
+ long yesterday = yesterdayHost.stream().collect(Collectors.summarizingInt(s -> Integer.valueOf(String.valueOf(s.get("count"))))).getSum();
|
|
|
+ long before = beforeYesterdayHost.stream().collect(Collectors.summarizingInt(s -> Integer.valueOf(String.valueOf(s.get("count"))))).getSum();
|
|
|
//环比 (昨日-前日)/前日消耗 X 100%
|
|
|
- result.put("hostCompare", countLink(new BigDecimal(yesterday),new BigDecimal(before)));
|
|
|
+ result.put("hostCompare", countLink(new BigDecimal(yesterday), new BigDecimal(before)));
|
|
|
|
|
|
} else if (mediaId == CtopAdConstant.PLATFORM_TYPE_KUAISHOU_INT) {
|
|
|
//爆款视频
|
|
|
- List<Map<String, String>> hotList = materialReportOverViewMapper.selectHotMaterialVideoKs(startDate,endDate, projects);
|
|
|
+ List<Map<String, String>> hotList = materialReportOverViewMapper.selectHotMaterialVideoKs(startDate, endDate, projects);
|
|
|
//总数
|
|
|
- long hotTotal = hotList.stream().collect(Collectors.summarizingInt(s->Integer.valueOf(String.valueOf(s.get("count"))))).getSum();
|
|
|
- result.put("hotList",hotList);
|
|
|
- result.put("hotTotal",hotTotal);
|
|
|
+ long hotTotal = hotList.stream().collect(Collectors.summarizingInt(s -> Integer.valueOf(String.valueOf(s.get("count"))))).getSum();
|
|
|
+ result.put("hotList", hotList);
|
|
|
+ result.put("hotTotal", hotTotal);
|
|
|
//上阶段
|
|
|
- List<Map<String, String>> lastHostList = materialReportOverViewMapper.selectHotMaterialVideoKs(DateUtils.addDay(startDate, -DateUtils.dateDiff(startDate, endDate)-1), DateUtils.addDay(startDate, -1), projects);
|
|
|
- long lastHotTotal = lastHostList.stream().collect(Collectors.summarizingInt(s->Integer.valueOf(String.valueOf(s.get("count"))))).getSum();
|
|
|
+ List<Map<String, String>> lastHostList = materialReportOverViewMapper.selectHotMaterialVideoKs(DateUtils.addDay(startDate, -DateUtils.dateDiff(startDate, endDate) - 1), DateUtils.addDay(startDate, -1), projects);
|
|
|
+ long lastHotTotal = lastHostList.stream().collect(Collectors.summarizingInt(s -> Integer.valueOf(String.valueOf(s.get("count"))))).getSum();
|
|
|
//同比 (本阶段截止昨天的爆款视频数量-上一个阶段截止和昨天对应日期的爆款视频数量)/上一个阶段截止和昨天对应日期的爆款视频数量X 100%
|
|
|
- result.put("hotYearOnYearCompare", countLink(new BigDecimal(hotTotal),new BigDecimal(lastHotTotal)));
|
|
|
+ result.put("hotYearOnYearCompare", countLink(new BigDecimal(hotTotal), new BigDecimal(lastHotTotal)));
|
|
|
//昨日消耗
|
|
|
- List<Map<String, String>> yesterdayHost = materialReportOverViewMapper.selectHotMaterialVideoKs(endDate,endDate, projects);
|
|
|
+ List<Map<String, String>> yesterdayHost = materialReportOverViewMapper.selectHotMaterialVideoKs(endDate, endDate, projects);
|
|
|
//前天消耗
|
|
|
List<Map<String, String>> beforeYesterdayHost = materialReportOverViewMapper.selectHotMaterialVideoKs(DateUtils.addDay(endDate, -1), DateUtils.addDay(endDate, -1), projects);
|
|
|
- long yesterday = yesterdayHost.stream().collect(Collectors.summarizingInt(s->Integer.valueOf(String.valueOf(s.get("count"))))).getSum();
|
|
|
- long before = beforeYesterdayHost.stream().collect(Collectors.summarizingInt(s->Integer.valueOf(String.valueOf(s.get("count"))))).getSum();
|
|
|
+ long yesterday = yesterdayHost.stream().collect(Collectors.summarizingInt(s -> Integer.valueOf(String.valueOf(s.get("count"))))).getSum();
|
|
|
+ long before = beforeYesterdayHost.stream().collect(Collectors.summarizingInt(s -> Integer.valueOf(String.valueOf(s.get("count"))))).getSum();
|
|
|
//环比 (昨日-前日)/前日消耗 X 100%
|
|
|
- result.put("hostCompare", countLink(new BigDecimal(yesterday),new BigDecimal(before)));
|
|
|
+ result.put("hostCompare", countLink(new BigDecimal(yesterday), new BigDecimal(before)));
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
@Override
|
|
|
public List<JSONObject> getTotalChat(int mediaId, String startDate, String endDate, JSONArray projects) {
|
|
|
List<JSONObject> result = new ArrayList<>();
|
|
@@ -306,7 +301,7 @@ public class MaterialReportOverViewServiceImpl implements IMaterialReportOverVie
|
|
|
|
|
|
@Override
|
|
|
public void exportBytedanceExcel(JSONObject requestBody, HttpServletRequest request, HttpServletResponse response) {
|
|
|
- JSONArray projects= requestBody.getJSONArray("projects");
|
|
|
+ JSONArray projects = requestBody.getJSONArray("projects");
|
|
|
if (projects.isEmpty()) {
|
|
|
projects = getProjectsByCurrentUser(requestBody.getInteger("mediaId"));
|
|
|
}
|
|
@@ -328,8 +323,8 @@ public class MaterialReportOverViewServiceImpl implements IMaterialReportOverVie
|
|
|
columns.add(3, "projectName");
|
|
|
|
|
|
List<JSONObject> excelData = materialReportOverViewMapper.queryBytedanceMaterialReport(filed, requestBody.getString("startDate"), requestBody.getString("endDate"),
|
|
|
- projects, requestBody.getString("md5"),requestBody.getString("target")==null?"cost":requestBody.getString("target")
|
|
|
- , requestBody.getString("order")==null?"desc":requestBody.getString("order"));
|
|
|
+ projects, requestBody.getString("md5"), requestBody.getString("target") == null ? "cost" : requestBody.getString("target")
|
|
|
+ , requestBody.getString("order") == null ? "desc" : requestBody.getString("order"));
|
|
|
|
|
|
if (null != excelData && excelData.isEmpty()) {
|
|
|
return;
|
|
@@ -359,7 +354,7 @@ public class MaterialReportOverViewServiceImpl implements IMaterialReportOverVie
|
|
|
|
|
|
@Override
|
|
|
public void exportKuaishouExcel(JSONObject requestBody, HttpServletRequest request, HttpServletResponse response) {
|
|
|
- JSONArray projects= requestBody.getJSONArray("projects");
|
|
|
+ JSONArray projects = requestBody.getJSONArray("projects");
|
|
|
if (projects.isEmpty()) {
|
|
|
projects = getProjectsByCurrentUser(requestBody.getInteger("mediaId"));
|
|
|
}
|
|
@@ -375,8 +370,8 @@ public class MaterialReportOverViewServiceImpl implements IMaterialReportOverVie
|
|
|
List<String> titles = getfileIds(AccountReportConstants.getKuaishouVideoReportDict(), columns2);
|
|
|
String filedAll = JsonResourceUtil.joinAllFiled(AccountReportConstants.getKuaishouVideoReportMap());
|
|
|
List<JSONObject> excelData = materialReportOverViewMapper.queryKuaishouMaterialReport(filedAll, requestBody.getString("startDate"), requestBody.getString("endDate"),
|
|
|
- projects, requestBody.getString("channelType"),requestBody.getString("md5"), requestBody.getString("target")==null?"cost":requestBody.getString("target")
|
|
|
- , requestBody.getString("order")==null?"desc":requestBody.getString("order"));
|
|
|
+ projects, requestBody.getString("channelType"), requestBody.getString("md5"), requestBody.getString("target") == null ? "cost" : requestBody.getString("target")
|
|
|
+ , requestBody.getString("order") == null ? "desc" : requestBody.getString("order"));
|
|
|
if (null != excelData && excelData.isEmpty()) {
|
|
|
return;
|
|
|
}
|
|
@@ -471,6 +466,140 @@ public class MaterialReportOverViewServiceImpl implements IMaterialReportOverVie
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 查询人群分析数据列表
|
|
|
+ *
|
|
|
+ * @param
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public Result populationAnalysisList(String signature) {
|
|
|
+ Result result = new Result<>();
|
|
|
+ Map resultMap = new HashMap();
|
|
|
+ try {
|
|
|
+ List<Map> list = materialReportOverViewMapper.populationAnalysisList(signature);
|
|
|
+ //查询点击率
|
|
|
+ String actionRatio = materialReportOverViewMapper.getActualProb(signature, "action_ratio");
|
|
|
+ //查询转化率
|
|
|
+ String convertRatio = materialReportOverViewMapper.getActualProb(signature, "convert_ratio");
|
|
|
+ resultMap.put("dataList", list);
|
|
|
+ resultMap.put("actionRatio", actionRatio);
|
|
|
+ resultMap.put("convertRatio", convertRatio);
|
|
|
+ result.setSuccess(true);
|
|
|
+ result.setResult(resultMap);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.info("查询错误:{}", e.toString());
|
|
|
+ result.error500("查询错误");
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询人群分析数据图
|
|
|
+ *
|
|
|
+ * @param
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public Result populationAnalysisChart(String signature) {
|
|
|
+ Result result = new Result<>();
|
|
|
+ try {
|
|
|
+ List<Map> list = materialReportOverViewMapper.populationAnalysisChart(signature);
|
|
|
+ result.setResult(list);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.info("查询错误:{}", e.toString());
|
|
|
+ result.error500("查询错误");
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 最优定向组合
|
|
|
+ *
|
|
|
+ * @param
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public Result optimalCombination(String signature) {
|
|
|
+ Result result = new Result<>();
|
|
|
+ Map<String, String> map = new HashMap();
|
|
|
+ try {
|
|
|
+ //最优转化率组合
|
|
|
+ Map<String, String> convertRatio = materialReportOverViewMapper.optimalCombination(signature, "convert_ratio");
|
|
|
+ //最优点击率组合
|
|
|
+ Map<String, String> actionRatio = materialReportOverViewMapper.optimalCombination(signature, "action_ratio");
|
|
|
+ if (convertRatio != null) {
|
|
|
+ map.put("convertRatio", convertRatio.get("gender") + convertRatio.get("age"));
|
|
|
+ } else {
|
|
|
+ map.put("convertRatio", null);
|
|
|
+ }
|
|
|
+ if (actionRatio != null) {
|
|
|
+ map.put("actionRatio", actionRatio.get("gender") + convertRatio.get("age"));
|
|
|
+ } else {
|
|
|
+ map.put("actionRatio", null);
|
|
|
+ }
|
|
|
+
|
|
|
+ result.setResult(map);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.info("查询错误:{}", e.toString());
|
|
|
+ result.error500("查询错误");
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 相似素材
|
|
|
+ *
|
|
|
+ * @param
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public Result similarMaterial(String signature) {
|
|
|
+ Result result = new Result<>();
|
|
|
+ List<Map> resultMap=new ArrayList<>();
|
|
|
+ Map<String,String> map = materialReportOverViewMapper.getSimilarMaterialList(signature);
|
|
|
+ if(map!=null){
|
|
|
+ String signature1 = map.get("s1");
|
|
|
+ String signature2 = map.get("s2");
|
|
|
+ String signature3 = map.get("s3");
|
|
|
+ String signature4 = map.get("s4");
|
|
|
+ String signature5 = map.get("s5");
|
|
|
+ if(signature1!=null&& !signature1.equals("")){
|
|
|
+ Map<String,String> info= materialReportOverViewMapper.similarMaterialInfo(signature1);
|
|
|
+ if(info.get("signature")!=null && !info.get("signature").equals("")){
|
|
|
+ resultMap.add(info);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(signature2!=null&& !signature2.equals("")){
|
|
|
+ Map<String,String> info= materialReportOverViewMapper.similarMaterialInfo(signature2);
|
|
|
+ if(info.get("signature")!=null && !info.get("signature").equals("")){
|
|
|
+ resultMap.add(info);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(signature3!=null&& !signature3.equals("")){
|
|
|
+ Map<String,String> info= materialReportOverViewMapper.similarMaterialInfo(signature3);
|
|
|
+ if(info.get("signature")!=null && !info.get("signature").equals("")){
|
|
|
+ resultMap.add(info);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(signature4!=null&& !signature4.equals("")){
|
|
|
+ Map<String,String> info= materialReportOverViewMapper.similarMaterialInfo(signature4);
|
|
|
+ if(info.get("signature")!=null && !info.get("signature").equals("")){
|
|
|
+ resultMap.add(info);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(signature5!=null&& !signature5.equals("")){
|
|
|
+ Map<String,String> info= materialReportOverViewMapper.similarMaterialInfo(signature5);
|
|
|
+ if(info.get("signature")!=null && !info.get("signature").equals("")){
|
|
|
+ resultMap.add(info);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ result.setResult(resultMap);
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
//递归查询
|
|
|
private Set<String> querySubordinate(Set<String> leaderIds, Set<String> result) {
|
|
|
if (leaderIds.isEmpty()) {
|
|
@@ -493,6 +622,7 @@ public class MaterialReportOverViewServiceImpl implements IMaterialReportOverVie
|
|
|
}
|
|
|
return Check.isNull(queryProjectIdBy(recursiveQuerySubordinate(currentUser), mediaId)) ? null : queryProjectIdBy(recursiveQuerySubordinate(currentUser), mediaId);
|
|
|
}
|
|
|
+
|
|
|
private List<String> getfileIds(Map<String, Map<String, Object>> kuaishouVideoReportMap, JSONArray columns) {
|
|
|
List<String> titles = new ArrayList<>();
|
|
|
for (int i = 0; i < columns.size(); i++) {
|
|
@@ -510,12 +640,12 @@ public class MaterialReportOverViewServiceImpl implements IMaterialReportOverVie
|
|
|
}
|
|
|
|
|
|
//环比计算
|
|
|
- private BigDecimal countLink(BigDecimal numA, BigDecimal numB) {
|
|
|
+ private BigDecimal countLink(BigDecimal numA, BigDecimal numB) {
|
|
|
BigDecimal link = new BigDecimal("0");
|
|
|
- if (Check.isNull(numA) || Check.isNull(numB)){
|
|
|
+ if (Check.isNull(numA) || Check.isNull(numB)) {
|
|
|
return link;
|
|
|
}
|
|
|
- if (numB.compareTo(BigDecimal.ZERO)!=0) {
|
|
|
+ if (numB.compareTo(BigDecimal.ZERO) != 0) {
|
|
|
link = (numA.subtract(numB)).divide(numB, 4, RoundingMode.HALF_UP);
|
|
|
}
|
|
|
return link;
|
|
@@ -524,15 +654,16 @@ public class MaterialReportOverViewServiceImpl implements IMaterialReportOverVie
|
|
|
|
|
|
/**
|
|
|
* 同比 (当前 - 上阶段 ) / 上阶段
|
|
|
+ *
|
|
|
* @param current 当前阶段数值
|
|
|
- * @param last 上阶段数值
|
|
|
+ * @param last 上阶段数值
|
|
|
* @return
|
|
|
*/
|
|
|
- private BigDecimal yearOnYearCompare(BigDecimal current,BigDecimal last){
|
|
|
+ private BigDecimal yearOnYearCompare(BigDecimal current, BigDecimal last) {
|
|
|
BigDecimal yearOnYear = new BigDecimal("0");
|
|
|
- if (last.compareTo(BigDecimal.ZERO)!=0) {
|
|
|
+ if (last.compareTo(BigDecimal.ZERO) != 0) {
|
|
|
// (当前 - 上阶段 ) / 上阶段
|
|
|
- yearOnYear = (current.subtract(last)).divide(last,20,BigDecimal.ROUND_HALF_UP);
|
|
|
+ yearOnYear = (current.subtract(last)).divide(last, 20, BigDecimal.ROUND_HALF_UP);
|
|
|
}
|
|
|
return yearOnYear;
|
|
|
}
|