|
@@ -131,6 +131,8 @@ public class EtlKuaishouReportAccountHourlyServiceImpl extends ServiceImpl<EtlKu
|
|
todayList = etlHourlyAccountMapper.getOnedayEtlReportList(startTime, accountId, value, type);
|
|
todayList = etlHourlyAccountMapper.getOnedayEtlReportList(startTime, accountId, value, type);
|
|
String lastDay = DateUtils.getLastDay(startTime, 1);
|
|
String lastDay = DateUtils.getLastDay(startTime, 1);
|
|
yesterdayList = etlHourlyAccountMapper.getOnedayEtlReportList(lastDay, accountId, value, type);
|
|
yesterdayList = etlHourlyAccountMapper.getOnedayEtlReportList(lastDay, accountId, value, type);
|
|
|
|
+ completionTime(todayList);
|
|
|
|
+ completionTime(yesterdayList);
|
|
} else {
|
|
} else {
|
|
updateTime = etlDailyAccountMapper.getNewlyUpdateTime();
|
|
updateTime = etlDailyAccountMapper.getNewlyUpdateTime();
|
|
todayList = etlDailyAccountMapper.getOnedayEtlReportList(startTime, endTime, accountId, value, type);
|
|
todayList = etlDailyAccountMapper.getOnedayEtlReportList(startTime, endTime, accountId, value, type);
|
|
@@ -144,14 +146,14 @@ public class EtlKuaishouReportAccountHourlyServiceImpl extends ServiceImpl<EtlKu
|
|
List<String> dayList = null;
|
|
List<String> dayList = null;
|
|
if (days > todayNum) {
|
|
if (days > todayNum) {
|
|
dayList = DateUtils.getDays(startTime, endTime);
|
|
dayList = DateUtils.getDays(startTime, endTime);
|
|
- completionTime(todayList, dayList);
|
|
|
|
|
|
+ completionDate(todayList, dayList);
|
|
}
|
|
}
|
|
if (days > yesterdayNum) {
|
|
if (days > yesterdayNum) {
|
|
dayList = DateUtils.getDays(startTime2, endTime2);
|
|
dayList = DateUtils.getDays(startTime2, endTime2);
|
|
- completionTime(yesterdayList, dayList);
|
|
|
|
|
|
+ completionDate(yesterdayList, dayList);
|
|
}
|
|
}
|
|
- userRechargeListSort(todayList);
|
|
|
|
- userRechargeListSort(yesterdayList);
|
|
|
|
|
|
+ statDateListSort(todayList);
|
|
|
|
+ statDateListSort(yesterdayList);
|
|
}
|
|
}
|
|
obj.put("today", todayList);
|
|
obj.put("today", todayList);
|
|
obj.put("yesterday", yesterdayList);
|
|
obj.put("yesterday", yesterdayList);
|
|
@@ -162,7 +164,7 @@ public class EtlKuaishouReportAccountHourlyServiceImpl extends ServiceImpl<EtlKu
|
|
/**
|
|
/**
|
|
* 补全日期
|
|
* 补全日期
|
|
*/
|
|
*/
|
|
- private void completionTime(List<JSONObject> dataList, List<String> dayList) {
|
|
|
|
|
|
+ private void completionDate(List<JSONObject> dataList, List<String> dayList) {
|
|
List<String> newDayList = new ArrayList<>();
|
|
List<String> newDayList = new ArrayList<>();
|
|
for (JSONObject data : dataList) {
|
|
for (JSONObject data : dataList) {
|
|
newDayList.add(data.getString("statDate"));
|
|
newDayList.add(data.getString("statDate"));
|
|
@@ -177,7 +179,30 @@ public class EtlKuaishouReportAccountHourlyServiceImpl extends ServiceImpl<EtlKu
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- private static void userRechargeListSort(List<JSONObject> list) {
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 补全时辰
|
|
|
|
+ */
|
|
|
|
+ private void completionTime(List<JSONObject> dataList) {
|
|
|
|
+ List<Integer> newDayList = new ArrayList<>();
|
|
|
|
+ for (JSONObject data : dataList) {
|
|
|
|
+ newDayList.add(data.getInteger("statHour"));
|
|
|
|
+ }
|
|
|
|
+ List<Integer> dayList = new ArrayList<>();
|
|
|
|
+ for (int i = 0; i < 23; i++) {
|
|
|
|
+ dayList.add(i);
|
|
|
|
+ }
|
|
|
|
+ for (Integer hour : dayList) {
|
|
|
|
+ if (!newDayList.contains(hour)) {
|
|
|
|
+ JSONObject obj = new JSONObject();
|
|
|
|
+ obj.put("statHour", hour);
|
|
|
|
+ obj.put("value", 0);
|
|
|
|
+ dataList.add(obj);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ statHourListSort(dataList);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private static void statDateListSort(List<JSONObject> list) {
|
|
Collections.sort(list, new Comparator<JSONObject>() {
|
|
Collections.sort(list, new Comparator<JSONObject>() {
|
|
@Override
|
|
@Override
|
|
public int compare(JSONObject o1, JSONObject o2) {
|
|
public int compare(JSONObject o1, JSONObject o2) {
|
|
@@ -194,6 +219,22 @@ public class EtlKuaishouReportAccountHourlyServiceImpl extends ServiceImpl<EtlKu
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private static void statHourListSort(List<JSONObject> list) {
|
|
|
|
+ Collections.sort(list, new Comparator<JSONObject>() {
|
|
|
|
+ @Override
|
|
|
|
+ public int compare(JSONObject o1, JSONObject o2) {
|
|
|
|
+ try {
|
|
|
|
+ Integer dt1 = o1.getInteger("statHour");
|
|
|
|
+ Integer dt2 = o2.getInteger("statHour");
|
|
|
|
+ return dt1.compareTo(dt2);
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ return 0;
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public Result<Object> getMaxChargeAccountIdByUser(String userId) {
|
|
public Result<Object> getMaxChargeAccountIdByUser(String userId) {
|
|
JSONObject obj = etlDailyAccountMapper.getMaxChargeAccountId(userId);
|
|
JSONObject obj = etlDailyAccountMapper.getMaxChargeAccountId(userId);
|