| | |
| | | * @return |
| | | */ |
| | | public boolean isDateToday(Date date) { |
| | | //如果给的日期小于当前日期,也直接发送 |
| | | LocalDateTime localDateTime = date.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime(); |
| | | if (localDateTime.isBefore(LocalDateTime.now())) { |
| | | return true; |
| | | if (date == null) { |
| | | return false; |
| | | } |
| | | // 获取当前日期 |
| | | Calendar calendarNow = Calendar.getInstance(); |
| | | int todayYear = calendarNow.get(Calendar.YEAR); |
| | | int todayMonth = calendarNow.get(Calendar.MONTH); |
| | | int todayDay = calendarNow.get(Calendar.DAY_OF_MONTH); |
| | | |
| | | // 创建一个 Calendar 实例用于检查的日期 |
| | | Calendar calendarToCheck = Calendar.getInstance(); |
| | | calendarToCheck.setTime(date); |
| | | |
| | | // 比较年、月和日 |
| | | return (calendarToCheck.get(Calendar.YEAR) == todayYear && calendarToCheck.get(Calendar.MONTH) == todayMonth && calendarToCheck.get(Calendar.DAY_OF_MONTH) == todayDay); |
| | | // 将 Date 转为 LocalDate |
| | | LocalDate localDate = date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); |
| | | // 获取今天的 LocalDate |
| | | LocalDate today = LocalDate.now(); |
| | | // 如果日期早于或等于今天,返回 true |
| | | return !localDate.isAfter(today); |
| | | } |
| | | |
| | | public void sfHandlle(CommonTaskcallMQ commonTaskcallMQ, String ip) { |
| | |
| | | if ((Boolean) map.get("succ") == true) { |
| | | serviceSubtask.setResult("success"); |
| | | } else { |
| | | log.error("serviceSubtask1231313的值为:{}",serviceSubtask); |
| | | log.error("serviceSubtask1231313的值为:{}", serviceSubtask); |
| | | serviceSubtask.setResult("error"); |
| | | serviceSubtask.setSendstate(5L); |
| | | serviceSubtask.setRemark(map.get("msg").toString()); |