|
|
@@ -358,8 +358,11 @@ public class MaterialStareServiceImpl implements MaterialStareService {
|
|
|
if (mediaType.equals("1")) {
|
|
|
long startDate = Long.valueOf(DateUtils.getDateInteger(startTime));
|
|
|
long endDate = Long.valueOf(DateUtils.getDateInteger(endTime));
|
|
|
+ boolean currentDay = startDate == endDate && startDate == nowDate;
|
|
|
JSONObject projectUserSummary = materialStareMapper.getBytedanceOperateProjectUserSummary(startDate, endDate, operatorUserIds);
|
|
|
- JSONObject sectionSummary = materialStareMapper.getBytedanceOperateSummary(startDate, endDate, operatorUserIds);
|
|
|
+ JSONObject sectionSummary = currentDay
|
|
|
+ ? materialStareMapper.getBytedanceTotalCost(startDate, endDate, nowHour, operatorUserIds)
|
|
|
+ : materialStareMapper.getBytedanceOperateSummary(startDate, endDate, operatorUserIds);
|
|
|
JSONObject compareSummary = materialStareMapper.getOperateTodayYesterdaySummary(
|
|
|
"application.bytedance_advertiser_report_hourly_dw",
|
|
|
"stat_datetime",
|
|
|
@@ -390,7 +393,13 @@ public class MaterialStareServiceImpl implements MaterialStareService {
|
|
|
if (mediaType.equals("2")) {
|
|
|
long startDate = Long.valueOf(DateUtils.getDateInteger(startTime));
|
|
|
long endDate = Long.valueOf(DateUtils.getDateInteger(endTime));
|
|
|
- JSONObject summary = materialStareMapper.getKuaiShouOperateSummary(startDate, endDate, operatorUserIds);
|
|
|
+ boolean currentDay = startDate == endDate && startDate == nowDate;
|
|
|
+ JSONObject summary = currentDay
|
|
|
+ ? materialStareMapper.getKuaiShouTotalCost(startDate, endDate, nowHour, operatorUserIds)
|
|
|
+ : materialStareMapper.getKuaiShouOperateSummary(startDate, endDate, operatorUserIds);
|
|
|
+ JSONObject projectUserSummary = currentDay
|
|
|
+ ? materialStareMapper.getKuaiShouOperateProjectUserSummary(startDate, endDate, nowHour, operatorUserIds)
|
|
|
+ : materialStareMapper.getKuaiShouOperateSummary(startDate, endDate, operatorUserIds);
|
|
|
JSONObject compareSummary = materialStareMapper.getOperateTodayYesterdaySummary(
|
|
|
"application.kuaishou_account_report_hourly_dw",
|
|
|
"stat_date",
|
|
|
@@ -408,13 +417,13 @@ public class MaterialStareServiceImpl implements MaterialStareService {
|
|
|
resultMap.put("compare", formatRate(todayCost, yesterdayCost, decimalFormat));
|
|
|
double sectionCost = getJsonDouble(summary, "totalCost");
|
|
|
resultMap.put("sectionCost", sectionCost);
|
|
|
- int activeUserNum = getJsonInt(summary, "userNum");
|
|
|
+ int activeUserNum = getJsonInt(projectUserSummary, "userNum");
|
|
|
Double userAverageAccount = safeDivide(getJsonDouble(summary, "accountNum"), activeUserNum);
|
|
|
Double userAveragecost = safeDivide(sectionCost, activeUserNum);
|
|
|
DecimalFormat df = new DecimalFormat("#.000");
|
|
|
resultMap.put("userAverageAccount", new Double(Math.ceil(userAverageAccount)).intValue());
|
|
|
resultMap.put("userAveragecost", df.format(userAveragecost));
|
|
|
- resultMap.put("projectNum", String.valueOf(getJsonInt(summary, "projectNum")));
|
|
|
+ resultMap.put("projectNum", String.valueOf(getJsonInt(projectUserSummary, "projectNum")));
|
|
|
}
|
|
|
if (mediaType.equals("16")) {
|
|
|
JSONObject jsonObjectNow = materialStareMapper.getAdqTotalCost(nowDate, nowDate, nowHour, operatorUserIds);
|