Browse Source

头条快手 视频报表,开始和结束时间的时间跨度,不能超过60天

zhaoxian 1 year ago
parent
commit
ce270b325e

+ 8 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/KsVideoReportCtrl.java

@@ -15,6 +15,7 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.constant.AccountReportConstants;
 import org.jeecg.common.system.entity.SysUser;
+import org.jeecg.common.util.DateUtils;
 import org.jeecg.common.utils.JsonResourceUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -78,6 +79,13 @@ public class KsVideoReportCtrl {
             if (Check.isNull(endDate)) {
                 throw new Exception("请输入查询结束时间");
             }
+
+            //开始和结束时间的时间跨度,不能超过60天
+            long days = DateUtils.getDiscrepantDays(startDate, endDate) + 1;
+            if (days > 60) {
+                throw new Exception("开始和结束时间的时间跨度,不能超过60天,请重新选择");
+            }
+
             String filedAll = JsonResourceUtil.joinAllFiled(AccountReportConstants.getKuaishouVideoReportMap());
             filedAll = filedAll.replace("t1.photo_show", "`show`");
             if (Check.isNull(filedAll)) {

+ 10 - 1
jeecg-boot-module-system/src/main/java/cn/com/ctop/toutiao/modules/report/controller/BytedanceVideoReportCtrl.java

@@ -11,6 +11,7 @@ import lombok.extern.slf4j.Slf4j;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.constant.AccountReportConstants;
+import org.jeecg.common.util.DateUtils;
 import org.jeecg.common.utils.JsonResourceUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -43,9 +44,17 @@ public class BytedanceVideoReportCtrl {
             log.error("request body is empty");
             result.setSuccess(false);
         } else {
-            JSONArray accountIds = requestBody.getJSONArray("accountIds");
             String startDate = requestBody.getString("startDate");
             String endDate = requestBody.getString("endDate");
+            //开始和结束时间的时间跨度,不能超过60天
+            long days = DateUtils.getDiscrepantDays(startDate, endDate) + 1;
+            if (days > 60) {
+                result.setSuccess(false);
+                result.setMessage("开始和结束时间的时间跨度,不能超过60天,请重新选择");
+                return result;
+            }
+
+            JSONArray accountIds = requestBody.getJSONArray("accountIds");
             String clip = requestBody.getString("clip");
             String shot = requestBody.getString("shot");
             String plan = requestBody.getString("plan");

+ 6 - 0
jeecg-boot-report/src/main/java/cn/com/ctop/report/controller/BytedanceMaterialReportDailyDwController.java

@@ -15,6 +15,7 @@ import com.github.pagehelper.PageInfo;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.util.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
@@ -61,6 +62,11 @@ public class BytedanceMaterialReportDailyDwController {
                 throw new Exception("请输入查询结束时间");
             }
 
+            //开始和结束时间的时间跨度,不能超过60天
+            long days = DateUtils.getDiscrepantDays(startDate, endDate) + 1;
+            if (days > 60) {
+                throw new Exception("开始和结束时间的时间跨度,不能超过60天,请重新选择");
+            }
 
             String filedAll = JsonResourceUtil.joinAllFiled(AccountReportConstants.getBytedanceVideoReportMap());
             if (Check.isNull(filedAll)) {

+ 8 - 0
jeecg-boot-report/src/main/java/cn/com/ctop/report/controller/KuaishouMaterialReportDailyDwController.java

@@ -16,6 +16,7 @@ import com.alibaba.fastjson.JSONObject;
 import com.github.pagehelper.PageInfo;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.util.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
@@ -122,6 +123,13 @@ public class KuaishouMaterialReportDailyDwController {
             if (Check.isNull(endDate)) {
                 throw new Exception("请输入查询结束时间");
             }
+
+            //开始和结束时间的时间跨度,不能超过60天
+            long days = DateUtils.getDiscrepantDays(startDate, endDate) + 1;
+            if (days > 60) {
+                throw new Exception("开始和结束时间的时间跨度,不能超过60天,请重新选择");
+            }
+
             String filedAll = JsonResourceUtil.joinAllFiled(AccountReportConstants.getKuaishouVideoReportMap());
             if (Check.isNull(filedAll)) {
                 throw new Exception("初始化查询 字段返回为空");