Browse Source

磁力金牛 初版1

zhaoxian 2 years ago
parent
commit
e74403ef3f

+ 21 - 0
ruixuan-live/src/main/java/com/ruixuan/report/service/impl/KuaishouLiveAccountReportServiceImpl.java

@@ -375,6 +375,27 @@ public class KuaishouLiveAccountReportServiceImpl implements IKuaishouLiveAccoun
         });
     }
 
+
+    /*补全小时数据,排序 */
+    private void completeHour(List<JSONObject> list) {
+        List<Integer> newDayList = new ArrayList<>();
+        for (JSONObject data : list) {
+            newDayList.add(data.getInteger("time"));
+        }
+        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("time", hour);
+                obj.put("costTotal", 0);
+                list.add(obj);
+            }
+        }
+    }
+
     /*根据入参时间,整理上个时间周期,并判断查询日报OR时报*/
     private Map<String, Object> getDateTime(String startDate, String endDate) {
         Map<String, Object> map = new HashMap<>();