فهرست منبع

账户级总报表

zhaoxian 2 سال پیش
والد
کامیت
c79cf20fde

+ 9 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ProjectController.java

@@ -120,7 +120,15 @@ public class ProjectController {
     public Result<Object> getProjectListByMediaId(String mediaId) {
         try {
             QueryWrapper<Project> queryWrapper = new QueryWrapper<>();
-            queryWrapper.eq("media_id", mediaId);
+            List<String> mediaIds = new ArrayList<>();
+            if ("1".equals(mediaId)) {
+                mediaIds.add("1");
+                mediaIds.add("3");
+            } else {
+                mediaIds.add("2");
+                mediaIds.add("4");
+            }
+            queryWrapper.in("media_id", mediaIds);
             List<Project> projects = projectMapper.selectList(queryWrapper);
             return Result.ok(projects);
         } catch (Exception e) {

+ 21 - 0
jeecg-boot-report/src/main/java/cn/com/ctop/report/service/impl/BytedanceAccountReportDailyDwServiceImpl.java

@@ -128,10 +128,12 @@ public class BytedanceAccountReportDailyDwServiceImpl implements IBytedanceAccou
             yesterday = bytedanceAccountReportDailyDwMapper.getHourCost(projectId, DateUtils.getDateInteger(DateUtils.getLastDay(startTime, 1)));
         } else {
             today = bytedanceAccountReportDailyDwMapper.getDataCost(projectId, startTimeInt, endTimeInt);
+            fillingDates(startTime, endTime, today);
             int days = DateUtils.dateDiff(startTime, endTime);
             String endTime2 = DateUtils.getLastDay(startTime, 1);
             String startTime2 = DateUtils.getLastDay(endTime2, days);
             yesterday = bytedanceAccountReportDailyDwMapper.getDataCost(projectId, DateUtils.getDateInteger(startTime2), DateUtils.getDateInteger(endTime2));
+            fillingDates(startTime2, endTime2, yesterday);
         }
         JSONObject data = new JSONObject();
         data.put("today", today);
@@ -139,6 +141,25 @@ public class BytedanceAccountReportDailyDwServiceImpl implements IBytedanceAccou
         return data;
     }
 
+    /**
+     * 补充日期
+     */
+    private void fillingDates(String startTime, String endTime, List<JSONObject> today) {
+        long dayNum = DateUtils.getDiscrepantDays(startTime, endTime) + 1;
+        int size = today.size();
+        if (dayNum - size != 0) {
+            List<String> days = DateUtils.getDays(startTime, endTime);
+            for (String day : days) {
+                if (!today.contains(day)) {
+                    JSONObject obj = new JSONObject();
+                    obj.put("time", day);
+                    obj.put("cost", 0.00);
+                    today.add(obj);
+                }
+            }
+        }
+    }
+
     @Override
     public Result<Object> getProjectReport(Long projectId, String startTime, String endTime, Integer pageSize, Integer pageNo) throws Exception {
         Integer startTimeInt = DateUtils.getDateInteger(startTime);

+ 21 - 0
jeecg-boot-report/src/main/java/cn/com/ctop/report/service/impl/KuaishouAccountReportDailyDwServiceImpl.java

@@ -107,10 +107,12 @@ public class KuaishouAccountReportDailyDwServiceImpl extends ServiceImpl<Kuaisho
             yesterday = kuaishouAccountReportDailyDwMapper.getHourcharge(projectId, DateUtils.getDateInteger(DateUtils.getLastDay(startTime, 1)));
         } else {
             today = kuaishouAccountReportDailyDwMapper.getDatacharge(projectId, startTimeInt, endTimeInt);
+            fillingDates(startTime, endTime, today);
             int days = DateUtils.dateDiff(startTime, endTime);
             String endTime2 = DateUtils.getLastDay(startTime, 1);
             String startTime2 = DateUtils.getLastDay(endTime2, days);
             yesterday = kuaishouAccountReportDailyDwMapper.getDatacharge(projectId, DateUtils.getDateInteger(startTime2), DateUtils.getDateInteger(endTime2));
+            fillingDates(startTime2, endTime2, yesterday);
         }
         JSONObject data = new JSONObject();
         data.put("today", today);
@@ -118,6 +120,25 @@ public class KuaishouAccountReportDailyDwServiceImpl extends ServiceImpl<Kuaisho
         return data;
     }
 
+    /**
+     * 补充日期
+     */
+    private void fillingDates(String startTime, String endTime, List<JSONObject> today) {
+        long dayNum = DateUtils.getDiscrepantDays(startTime, endTime) + 1;
+        int size = today.size();
+        if (dayNum - size != 0) {
+            List<String> days = DateUtils.getDays(startTime, endTime);
+            for (String day : days) {
+                if (!today.contains(day)) {
+                    JSONObject obj = new JSONObject();
+                    obj.put("time", day);
+                    obj.put("charge", 0.00);
+                    today.add(obj);
+                }
+            }
+        }
+    }
+
     @Override
     public Result<Object> getProjectReport(Long projectId, String startTime, String endTime, Integer pageSize, Integer pageNo) throws Exception {
         Integer startTimeInt = DateUtils.getDateInteger(startTime);