소스 검색

空指针

yumeng 5 년 전
부모
커밋
72a4541c17
1개의 변경된 파일4개의 추가작업 그리고 1개의 파일을 삭제
  1. 4 1
      module-report/src/main/java/cn/com/ctop/bytedance/service/impl/MaterialReportServiceImpl.java

+ 4 - 1
module-report/src/main/java/cn/com/ctop/bytedance/service/impl/MaterialReportServiceImpl.java

@@ -55,6 +55,9 @@ public class MaterialReportServiceImpl implements IMaterialReportService {
             }
             if (type == 1) { // 今天分时数据
                 Integer maxHour = materialReportMapper.selectMaxHourByDate(nowDate);
+                if (Check.isNull(maxHour) || maxHour == 0) {
+                    return null;
+                }
                 Integer statHour = maxHour - 1;
                 paramsMap.put("startDate", nowDate);
                 paramsMap.put("statHour", statHour);
@@ -178,7 +181,7 @@ public class MaterialReportServiceImpl implements IMaterialReportService {
 
             } else if (type == 4) { //  近15天数据
 
-                 contrastStartDate = DateUtils.getAnotherDay("yyyy-MM-dd", anotherDay, -15);
+                contrastStartDate = DateUtils.getAnotherDay("yyyy-MM-dd", anotherDay, -15);
                 paramsMap.put("startDate", contrastStartDate);
                 paramsMap.put("endDate", anotherDay);
                 contrastJson = materialReportMapper.selectDailyChainRatioByMap(paramsMap);