|
@@ -779,7 +779,7 @@ public class KuaishouItemCollectSamplesServiceImpl implements IKuaishouItemColle
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public JSONObject getKsGmvHour(Long userId, String type, String mediaId,String nowDate,String lastDate){
|
|
|
|
|
|
+ public JSONObject getKsGmvHour(Long userId, String type, String mediaId, String nowDate, String lastDate) {
|
|
JSONObject returnJson = new JSONObject();
|
|
JSONObject returnJson = new JSONObject();
|
|
String roleKey = userService.getRoleKeyByUserId(userId);
|
|
String roleKey = userService.getRoleKeyByUserId(userId);
|
|
List<Long> userList = null;
|
|
List<Long> userList = null;
|
|
@@ -800,6 +800,8 @@ public class KuaishouItemCollectSamplesServiceImpl implements IKuaishouItemColle
|
|
today = supplyChainService.getKsCourtshipGmvHourByDate(userList, nowDate);
|
|
today = supplyChainService.getKsCourtshipGmvHourByDate(userList, nowDate);
|
|
yesterday = supplyChainService.getKsCourtshipGmvHourByDate(userList, lastDate);
|
|
yesterday = supplyChainService.getKsCourtshipGmvHourByDate(userList, lastDate);
|
|
}
|
|
}
|
|
|
|
+ completionTime(today, nowDate);
|
|
|
|
+ completionTime(yesterday, lastDate);
|
|
JSONObject result = new JSONObject();
|
|
JSONObject result = new JSONObject();
|
|
result.put("today", today);
|
|
result.put("today", today);
|
|
result.put("yesterday", yesterday);
|
|
result.put("yesterday", yesterday);
|
|
@@ -810,8 +812,57 @@ public class KuaishouItemCollectSamplesServiceImpl implements IKuaishouItemColle
|
|
return returnJson;
|
|
return returnJson;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 补全时辰
|
|
|
|
+ */
|
|
|
|
+ private void completionTime(List<JSONObject> dataList, String nowDate) {
|
|
|
|
+ String today = DateUtils.getNowDate("yyyy-MM-dd"); // 当天
|
|
|
|
+ Integer tohour = DateUtils.getNowHour(); // 当前小时
|
|
|
|
+
|
|
|
|
+ List<Integer> newDayList = new ArrayList<>();
|
|
|
|
+ for (JSONObject data : dataList) {
|
|
|
|
+ newDayList.add(data.getInteger("time"));
|
|
|
|
+ }
|
|
|
|
+ List<Integer> dayList = new ArrayList<>();
|
|
|
|
+ if (today.equals(nowDate)) {
|
|
|
|
+ for (int i = 0; i <= tohour; i++) {
|
|
|
|
+ dayList.add(i);
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ for (int i = 0; i <= 23; i++) {
|
|
|
|
+ dayList.add(i);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ for (Integer hour : dayList) {
|
|
|
|
+ if (!newDayList.contains(hour)) {
|
|
|
|
+ JSONObject obj = new JSONObject();
|
|
|
|
+ obj.put("time", hour);
|
|
|
|
+ obj.put("charge", 0.00);
|
|
|
|
+ dataList.add(obj);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ statHourListSort(dataList);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //排序
|
|
|
|
+ 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("time");
|
|
|
|
+ Integer dt2 = o2.getInteger("time");
|
|
|
|
+ return dt1.compareTo(dt2);
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ return 0;
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
- public JSONObject getBytedanceGmvHour(Long userId, String type, String mediaId,String nowDate,String lastDate) {
|
|
|
|
|
|
+ public JSONObject getBytedanceGmvHour(Long userId, String type, String mediaId, String nowDate, String lastDate) {
|
|
JSONObject returnJson = new JSONObject();
|
|
JSONObject returnJson = new JSONObject();
|
|
|
|
|
|
Long dataNow = Long.valueOf(nowDate.replace("-", ""));
|
|
Long dataNow = Long.valueOf(nowDate.replace("-", ""));
|
|
@@ -831,7 +882,7 @@ public class KuaishouItemCollectSamplesServiceImpl implements IKuaishouItemColle
|
|
List<JSONObject> yesterday = new ArrayList<>();
|
|
List<JSONObject> yesterday = new ArrayList<>();
|
|
if ("1".equals(type)) { // 渠道
|
|
if ("1".equals(type)) { // 渠道
|
|
|
|
|
|
- today = supplyChainService.getBytedanceChannelGmvHourByDate(userList,dataNow);
|
|
|
|
|
|
+ today = supplyChainService.getBytedanceChannelGmvHourByDate(userList, dataNow);
|
|
yesterday = supplyChainService.getBytedanceChannelGmvHourByDate(userList, lastDateNow);
|
|
yesterday = supplyChainService.getBytedanceChannelGmvHourByDate(userList, lastDateNow);
|
|
} else if ("2".equals(type)) {
|
|
} else if ("2".equals(type)) {
|
|
today = supplyChainService.getBytedanceCourtshipGmvHourByDate(userList, dataNow);
|
|
today = supplyChainService.getBytedanceCourtshipGmvHourByDate(userList, dataNow);
|