| | |
| | | /* |
| | | * 查询年份数据的时候需要传递,非必传 |
| | | * */ |
| | | @DateTimeFormat(pattern = "yyyy") |
| | | @JsonFormat(pattern = "yyyy", timezone = "GMT+8") |
| | | Date year; |
| | | String dateType; |
| | | |
| | | /* |
| | | * 查询年份数据的时候需要传递,非必传 |
| | | * */ |
| | | @DateTimeFormat(pattern = "yyyy-MM") |
| | | @JsonFormat(pattern = "yyyy-MM", timezone = "GMT+8") |
| | | Date month; |
| | | String time; |
| | | |
| | | /* |
| | | * 自定义开始时间,非必传 |
| | |
| | | return false; |
| | | } |
| | | //时间转换 |
| | | if (year != null) { |
| | | if(month!=null) |
| | | return false; |
| | | startDate = DateUtils.getFirstDayOfYear(year); |
| | | endDate = DateUtils.getLastDayOfYear(year); |
| | | if(dateType.equals(Constants.MONTH)){ |
| | | Date date = DateUtils.getDate(time, "yyyy-MM"); |
| | | startDate = DateUtils.getFirstDayOfMonth(date); |
| | | endDate = DateUtils.getLastDayOfMonth(date); |
| | | return true; |
| | | } |
| | | if (month != null) { |
| | | if(year!=null) |
| | | return false; |
| | | startDate = DateUtils.getFirstDayOfMonth(month); |
| | | endDate = DateUtils.getLastDayOfMonth(month); |
| | | |
| | | if(dateType.equals(Constants.YEAR)){ |
| | | Date date = DateUtils.getDate(time, "yyyy"); |
| | | startDate = DateUtils.getFirstDayOfYear(date); |
| | | endDate = DateUtils.getLastDayOfYear(date); |
| | | return true; |
| | | } |
| | | |
| | | if(startDate!=null&&endDate!=null) |
| | | return true; |
| | | |
| | | return false; |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | |
| | | } |
| | | } |