소스 검색

优化代码

hgw 3 년 전
부모
커밋
f856fc4823
1개의 변경된 파일6개의 추가작업 그리고 1개의 파일을 삭제
  1. 6 1
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/CourseScheduleServiceImpl.java

+ 6 - 1
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/CourseScheduleServiceImpl.java

@@ -81,7 +81,12 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
         String classDate = WrapperUtil.toStr(param, "classDate", "查询时间不能为空!");
         String[] classDateSp = classDate.split("-");
         //本月的第一天
-        LocalDate firstDay = LocalDate.of(Integer.parseInt(classDateSp[0]), Integer.parseInt(classDateSp[1]), 1);
+        LocalDate firstDay;
+        try {
+            firstDay = LocalDate.of(Integer.parseInt(classDateSp[0]), Integer.parseInt(classDateSp[1]), 1);
+        } catch (Exception e) {
+            throw new BizException("查询时间格式不正确 ["+classDate+"]");
+        }
         //本月的最后一天
         LocalDate lastDay = firstDay.with(TemporalAdjusters.lastDayOfMonth());
         //查询该月的所有课程