private List<Sprint> getSprints() throws ParseException {
    List<Sprint> sprints = new ArrayList<>();
    Sprint sprint = new Sprint();
    sprint.setDonePoints(40l);
    sprint.setId(1l);
    sprint.setFinalDate(DateUtils.parseDate("30/07/2012", "dd/MM/yyyy"));
    sprints.add(sprint);

    sprint = new Sprint();
    sprint.setDonePoints(5l);
    sprint.setId(2l);
    sprint.setFinalDate(DateUtils.parseDate("30/08/2012", "dd/MM/yyyy"));
    sprints.add(sprint);

    sprint = new Sprint();
    sprint.setDonePoints(52l);
    sprint.setId(3l);
    sprint.setFinalDate(DateUtils.parseDate("30/09/2012", "dd/MM/yyyy"));
    sprints.add(sprint);

    sprint = new Sprint();
    sprint.setDonePoints(39l);
    sprint.setId(4l);
    sprint.setFinalDate(DateUtils.parseDate("30/10/2012", "dd/MM/yyyy"));
    sprints.add(sprint);

    sprint = new Sprint();
    sprint.setDonePoints(47l);
    sprint.setId(5l);
    sprint.setFinalDate(DateUtils.parseDate("30/11/2012", "dd/MM/yyyy"));
    sprints.add(sprint);

    return sprints;
  }
  public String getStyleForDate(int year, int month, int date, TimeZone timeZone) {
    String cellStyle = null;
    if (timeZone == null) {
      timeZone = getTimeZone();
    }

    GregorianCalendar dateCompareCalendar = new GregorianCalendar(timeZone);
    dateCompareCalendar.set(GregorianCalendar.YEAR, year);
    dateCompareCalendar.set(GregorianCalendar.MONTH, month);
    dateCompareCalendar.set(GregorianCalendar.DATE, date);
    dateCompareCalendar =
        (GregorianCalendar) DateUtils.truncate(dateCompareCalendar, GregorianCalendar.DATE);

    for (Entry<Long, String> entryCellStyle : getCellStyles().entrySet()) {
      GregorianCalendar cellStyleCalendar = new GregorianCalendar(timeZone);
      cellStyleCalendar.setTimeInMillis(entryCellStyle.getKey());

      // If selected month and year equals timestamp of cell style
      if (DateUtils.isSameDay(dateCompareCalendar, cellStyleCalendar)) {
        cellStyle = entryCellStyle.getValue();
      }
    }

    return cellStyle;
  }
  /**
   * This method returns all events for a specified date (year, month, date)<br>
   *
   * @param year e.g. 2010
   * @param month e.g. 11 for November
   * @param date e.g. 12
   * @return Collection of all events, which are planned for the specified date.
   */
  public Collection<CalendarEvent> getAllEventsForDate(
      int year, int month, int date, TimeZone timeZone) {
    // Get all events
    Collection<CalendarEvent> events = getCalendarEvents();
    Collection<CalendarEvent> dateEvents = new ArrayList<CalendarEvent>();

    GregorianCalendar dateCompareCalendar = new GregorianCalendar(timeZone);
    dateCompareCalendar.set(GregorianCalendar.YEAR, year);
    dateCompareCalendar.set(GregorianCalendar.MONTH, month);
    dateCompareCalendar.set(GregorianCalendar.DATE, date);
    dateCompareCalendar.set(GregorianCalendar.HOUR_OF_DAY, 00);
    dateCompareCalendar =
        (GregorianCalendar) DateUtils.truncate(dateCompareCalendar, GregorianCalendar.HOUR_OF_DAY);

    Iterator<CalendarEvent> eventsIter = events.iterator();
    while (eventsIter.hasNext()) {
      CalendarEvent event = eventsIter.next();
      GregorianCalendar eventCalendar = new GregorianCalendar(timeZone);
      eventCalendar.setTimeInMillis(event.getTimestampInMillis());

      // If selected month and year equals event in collection
      if (DateUtils.isSameDay(dateCompareCalendar, eventCalendar)) {
        dateEvents.add(event);
      }
    }
    // TODO Sort per hours
    return dateEvents;
  }
예제 #4
0
 @Override
 public final int compare(String[] o1, String[] o2) {
   String t1 = o1[this.index];
   String t2 = o2[this.index];
   if (StringUtils.isEmpty(t1) && StringUtils.isEmpty(t2)) {
     return 0;
   }
   if (StringUtils.isEmpty(t1)) {
     return 1;
   }
   if (StringUtils.isEmpty(t2)) {
     return -1;
   }
   if (StringUtils.isNumeric(t1) && StringUtils.isNumeric(t2)) {
     // 数値文字列の場合
     Long o1l = Long.valueOf(t1);
     Long o2l = Long.valueOf(t2);
     return this.compareTo(o1l, o2l, this.order);
   } else if (t1.matches("(?:\\d+日)?(?:\\d+時間)?(?:\\d+分)?(?:\\d+秒)?")) {
     try {
       // 時刻文字列の場合
       // SimpleDateFormatは24時間超えるような時刻でも正しく?パースしてくれる
       Date o1date = DateUtils.parseDate(t1, "ss秒", "mm分ss秒", "HH時間mm分", "dd日HH時間mm分");
       Date o2date = DateUtils.parseDate(t2, "ss秒", "mm分ss秒", "HH時間mm分", "dd日HH時間mm分");
       return this.compareTo(o1date, o2date, this.order);
     } catch (ParseException e) {
       e.printStackTrace();
     }
   }
   // 文字列の場合
   return this.compareTo(t1, t2, this.order);
 }
 @JsonProperty(value = "passwordExpirationDate")
 @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyyMMddHHmmss")
 public Date getPasswordExpirationDate() {
   if (!accountStatus.isPending()
       && (getPasswordLastModifiedDate() != null)
       && (getPasswordExpirationInterval() != null)) {
     return DateUtils.addDays(
         DateUtils.truncate(getPasswordLastModifiedDate(), Calendar.DATE),
         getPasswordExpirationInterval());
   }
   return null;
 }
예제 #6
0
 /**
  * 获取订单抓取结束时间
  *
  * @return
  */
 public Date getEndDate(Date endDate, Date start) {
   Date end = DateUtils.addMinutes(EJSDateUtils.getCurrentDate(), -3); // 默认结束时间为当前时间往前推3分钟
   if (endDate != null) {
     end = endDate;
   }
   if (DateUtils.addSeconds(start, ConstantJingDong.JD_FETCH_ORDER_TIME_INTERVAL_INCREMENT)
           .compareTo(end)
       < 0) {
     // 开始时间相对于抓单结束时间超过30Min
     end = DateUtils.addSeconds(start, ConstantJingDong.JD_FETCH_ORDER_TIME_INTERVAL_INCREMENT);
   }
   return end;
 }
예제 #7
0
 /**
  * 统计两个日期之间包含的天数。包含date1,但不包含date2
  *
  * @param date1
  * @param date2
  * @return
  */
 public static int getDayDiff(Date date1, Date date2) {
   if (date1 == null || date2 == null) {
     throw new InvalidParameterException("date1 and date2 cannot be null!");
   }
   Date startDate = org.apache.commons.lang3.time.DateUtils.truncate(date1, Calendar.DATE);
   Date endDate = org.apache.commons.lang3.time.DateUtils.truncate(date2, Calendar.DATE);
   if (startDate.after(endDate)) {
     throw new InvalidParameterException("date1 cannot be after date2!");
   }
   long millSecondsInOneDay =
       HOURS_IN_A_DAY * MINUTES_IN_AN_HOUR * SECONDS_IN_A_MINUTE * MILLIS_IN_A_SECOND;
   return (int) ((endDate.getTime() - startDate.getTime()) / millSecondsInOneDay);
 }
  @RequestMapping(value = "/new", method = RequestMethod.GET)
  public String showNewForm(
      @RequestParam(value = "start", required = false) @DateTimeFormat(pattern = dataFormat)
          Date start,
      @RequestParam(value = "end", required = false) @DateTimeFormat(pattern = dataFormat) Date end,
      Model model) {

    setColorList(model);

    Calendar calendar = new Calendar();
    calendar.setLength(1);
    if (start != null) {
      calendar.setStartDate(start);
      calendar.setLength((int) Math.ceil(1.0 * (end.getTime() - start.getTime()) / oneDayMillis));
      if (DateUtils.isSameDay(start, end)) {
        calendar.setLength(1);
      }
      if (!"00:00:00".equals(DateFormatUtils.format(start, "HH:mm:ss"))) {
        calendar.setStartTime(start);
      }
      if (!"00:00:00".equals(DateFormatUtils.format(end, "HH:mm:ss"))) {
        calendar.setEndTime(end);
      }
    }
    model.addAttribute("model", calendar);
    return viewName("newForm");
  }
  @RequestMapping(value = "/move", method = RequestMethod.POST)
  @ResponseBody
  public String moveCalendar(
      @RequestParam("id") Long id,
      @RequestParam(value = "start", required = false) @DateTimeFormat(pattern = dataFormat)
          Date start,
      @RequestParam(value = "end", required = false) @DateTimeFormat(pattern = dataFormat)
          Date end) {
    Calendar calendar = calendarService.findOne(id);

    if (end == null) {
      end = start;
    }

    calendar.setStartDate(start);
    calendar.setLength((int) Math.ceil(1.0 * (end.getTime() - start.getTime()) / oneDayMillis));
    if (DateUtils.isSameDay(start, end)) {
      calendar.setLength(1);
    }
    if (!"00:00:00".equals(DateFormatUtils.format(start, "HH:mm:ss"))) {
      calendar.setStartTime(start);
    }
    if (!"00:00:00".equals(DateFormatUtils.format(end, "HH:mm:ss"))) {
      calendar.setEndTime(end);
    }
    calendarService.copyAndRemove(calendar);

    return "ok";
  }
예제 #10
0
  /**
   * Test of getTVChanges method, of class TmdbTV.
   *
   * @throws com.omertron.themoviedbapi.MovieDbException
   */
  @Test
  public void testGetTVChanges() throws MovieDbException {
    LOG.info("getTVChanges");
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
    String startDate = sdf.format(DateUtils.addDays(new Date(), -14));
    String endDate = "";
    int maxCheck = 5;

    TmdbChanges chgs = new TmdbChanges(getApiKey(), getHttpTools());
    ResultList<ChangeListItem> changeList = chgs.getChangeList(MethodBase.TV, null, null, null);
    LOG.info(
        "Found {} changes to check, will check maximum of {}",
        changeList.getResults().size(),
        maxCheck);

    int count = 1;
    ResultList<ChangeKeyItem> result;
    for (ChangeListItem item : changeList.getResults()) {
      result = instance.getTVChanges(item.getId(), startDate, endDate);
      for (ChangeKeyItem ci : result.getResults()) {
        assertNotNull("Null changes", ci);
      }

      if (count++ > maxCheck) {
        break;
      }
    }
  }
예제 #11
0
 public static Integer getAcceptMonth(String dateStr, String parsePatterns) throws ParseException {
   if (parsePatterns == null) parsePatterns = "yyyyMMddHHmmss";
   Date date = DateUtils.parseDate(dateStr, parsePatterns);
   Calendar calendar = Calendar.getInstance();
   calendar.setTime(date);
   return new Integer(calendar.get(Calendar.MONTH) + 1);
 }
  public void testSave() throws SQLException {
    List<Day> daysBefore = dayManager.getAll();
    Assert.assertEquals(daysBefore.size(), 1);

    Day day = new Day();
    day.setId(100L);
    day.setName("Lunedì");

    Calendar calendar = GregorianCalendar.getInstance();
    calendar.set(Calendar.YEAR, 2014);
    calendar.set(Calendar.MONTH, Calendar.OCTOBER);
    calendar.set(Calendar.DAY_OF_MONTH, 27);
    calendar.set(Calendar.HOUR_OF_DAY, 9);
    calendar.set(Calendar.MINUTE, 0);
    calendar.set(Calendar.SECOND, 0);

    day.setDayDate(calendar.getTime());

    dayManager.save(day);

    List<Day> daysAfter = dayManager.getAll();
    Assert.assertEquals(daysAfter.size(), 2);

    Day savedDay = dayManager.get(day.getId());
    Assert.assertEquals(savedDay.getId(), day.getId());
    Assert.assertEquals(savedDay.getName(), day.getName());

    boolean areDatesEqual =
        DateUtils.truncatedEquals(savedDay.getDayDate(), calendar.getTime(), Calendar.SECOND);
    Assert.assertTrue(areDatesEqual);
  }
 @JsonProperty(value = "accountExpired")
 public boolean isAccountExpired() {
   if (!accountStatus.isPending()) {
     Date today = DateUtils.truncate(new Date(), Calendar.DATE);
     return ((getAccountExpirationDate() != null) && !today.before(getAccountExpirationDate()));
   }
   return false;
 }
예제 #14
0
 /**
  * 将字符串形式的日期表示解析为日期对象
  *
  * @param dateString
  * @return
  */
 public static Date parseDate(String dateString) {
   try {
     return org.apache.commons.lang3.time.DateUtils.parseDate(
         dateString, new String[] {"yyyy-MM-dd", "yyyy-M-d", "yyyy-MM-d", "yyyy-M-dd"});
   } catch (ParseException e) {
     return null;
   }
 }
예제 #15
0
 /**
  * 将字符串形式的时间表示解析为日期时间对象
  *
  * @param timeString
  * @return
  */
 public static Date parseTime(String timeString) {
   try {
     return org.apache.commons.lang3.time.DateUtils.parseDate(
         timeString, new String[] {"hh:mm:ss", "h:m:s", "hh:mm", "h:m"});
   } catch (ParseException e) {
     return null;
   }
 }
예제 #16
0
 private TimelineItem createTimelineItem(String str) throws ParseException {
   final Date date = DateUtils.parseDate(str, "yyyy-MM-dd");
   return new TimelineItem() {
     @Override
     public Date getDate() {
       return date;
     }
   };
 }
 @JsonProperty(value = "passwordExpired")
 public boolean isPasswordExpired() {
   Date passwordEpirationDate = getPasswordExpirationDate();
   if (passwordEpirationDate != null) {
     Date today = DateUtils.truncate(new Date(), Calendar.DATE);
     return !today.before(passwordEpirationDate);
   }
   return false;
 }
예제 #18
0
  public Date getDateFromTiffDateStr(String dateStr) {

    Date parsedDate = null;
    try {
      parsedDate = DateUtils.parseDate(dateStr, new String[] {"yyyy:MM:dd HH:mm:ss"});
    } catch (ParseException e) {
      e.printStackTrace();
    }

    return parsedDate;
  }
예제 #19
0
 private Date calculateDate(Date beginDate, String timeType, Integer amount) {
   Date limitDate = null;
   timeType = timeType == null ? "" : timeType;
   amount = amount == null ? 0 : amount;
   switch (timeType) {
     case "M":
       limitDate = DateUtils.addMinutes(beginDate, amount);
       break;
     case "H":
       limitDate = DateUtils.addHours(beginDate, amount);
       break;
     case "D":
       limitDate = DateUtils.addDays(beginDate, amount);
       break;
     default:
       //			limitDate = beginDate;
       break;
   }
   return limitDate;
 }
  /*
   * (non-Javadoc)
   *
   * @see
   * org.adorsys.platform.domain.service.ApplicationInitService#initUserAccount
   * (org.adorsys.platform.domain.PlatformUser)
   */
  @Override
  public boolean initUserAccount() {
    try {
      if (UserAccount.countUserAccounts() < 1) {
        Set<RoleNames> roleNames = this.constructRoleNames(RoleNames.ADMIN, RoleNames.DRUGSTORE);
        UserAccount userAccount =
            new UserAccount(
                "gakam",
                "test123",
                DateUtils.addYears(new Date(), 20),
                DateUtils.addYears(new Date(), 1),
                false,
                roleNames);
        userAccount.setPlatformUser(PlatformUser.findPlatformUser(Long.valueOf(1)));
        userAccount.persistUserAndSendMessage(userAccount);
      }
    } catch (Exception e) {
      e.printStackTrace();
      return false;
    }

    try {
      if (UserAccount.countUserAccounts() == 1) {
        Set<RoleNames> roleNames = this.constructRoleNames(RoleNames.ADMIN, RoleNames.PROVIDER);
        UserAccount userAccount2 =
            new UserAccount(
                "hsimo",
                "test123",
                DateUtils.addYears(new Date(), 20),
                DateUtils.addYears(new Date(), 1),
                false,
                roleNames);
        userAccount2.setPlatformUser(PlatformUser.findPlatformUser(Long.valueOf(2)));
        userAccount2.persistUserAndSendMessage(userAccount2);
      }
    } catch (Exception e) {
      e.printStackTrace();
      return false;
    }
    return true;
  }
예제 #21
0
  public static void main(String[] args) throws IOException, ParseException {
    ObjectMapper objectMapper = new ObjectMapper();
    CrawlerIndex crawlerIndex = new CrawlerIndex();
    List<Weibo> weibos = Lists.newArrayList();
    // 关键词搜索微博
    int total =
        crawlerIndex.search(
            "",
            0,
            5,
            weibos,
            "repostcount",
            SortOrder.DESC,
            DateUtils.parseDate("20150528 000000", "yyyyMMdd HHmmss"),
            DateUtils.parseDate("20150529 000000", "yyyyMMdd HHmmss"),
            true,
            0);
    System.out.println(total);
    System.out.println(objectMapper.writeValueAsString(weibos.get(0)));
    // 搜索一段时间的微博
    weibos = Lists.newArrayList();
    total =
        crawlerIndex.search(
            null,
            0,
            5,
            weibos,
            "repostcount",
            SortOrder.DESC,
            DateUtils.parseDate("20150528 000000", "yyyyMMdd HHmmss"),
            DateUtils.parseDate("20150529 000000", "yyyyMMdd HHmmss"),
            true,
            0);
    System.out.println(total);
    System.out.println(objectMapper.writeValueAsString(weibos.get(0)));
    // 按用户ID搜索微博
    weibos = Lists.newArrayList();
    total =
        crawlerIndex.searchByUid(
            "2028810631",
            0,
            5,
            weibos,
            "repostcount",
            SortOrder.DESC,
            DateUtils.parseDate("20150528 000000", "yyyyMMdd HHmmss"),
            DateUtils.parseDate("20150529 000000", "yyyyMMdd HHmmss"));
    System.out.println("按用户名搜索微博 " + total);
    System.out.println(objectMapper.writeValueAsString(weibos.get(0)));
    // 通过id找微博
    Long id = 3847603911216922L;
    Weibo w = crawlerIndex.getWeibo(id.toString());
    System.out.println("!!!" + objectMapper.writeValueAsString(w));

    // 找转发
    crawlerIndex.findAllReposts(w);
    // w.setReposts(Lists.<Weibo> newArrayList());
    System.out.println(objectMapper.writeValueAsString(w));
  }
예제 #22
0
  /**
   * 获取订单抓取开始时间
   *
   * @param fetchTime
   * @return
   */
  public Date getStartDate(Date startDate, Date fetchTime) {
    if (startDate != null) {
      return startDate;
    }

    Date start;
    if (fetchTime == null) { // 没有抓取记录
      // 当前时间往前推N秒
      start =
          DateUtils.addSeconds(
              EJSDateUtils.getCurrentDate(), -ConstantJingDong.JD_FETCH_ORDER_TIME_INTERVAL);
    } else {
      // 将抓取订单时间往前推N秒
      start = DateUtils.addSeconds(fetchTime, ConstantJingDong.JD_FETCH_ORDER_TIME_DELAY);
    }

    if (EJSDateUtils.isNew(start, DateUtils.addMinutes(EJSDateUtils.getCurrentDate(), -3))) {
      start = DateUtils.addMinutes(EJSDateUtils.getCurrentDate(), -3);
    }

    return start;
  }
예제 #23
0
 /**
  * @author Chivalry 批量价格修改
  * @param request
  * @return 2015-12-02
  */
 @PolicyJournal(accessLevel = AccessLevel.PRIVATE)
 @RequestMapping("/to_hotelRoomPrices_edit")
 public ModelAndView to_hotelRoomPrices_edit(HttpServletRequest request) {
   String hotelRoomId = request.getParameter("hotelRoomId");
   String hotelNameId = request.getParameter("hotelNameId");
   ModelAndView mav = new ModelAndView("/hotelroom/to_hotelRoomPrices_edit");
   String time = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
   String next = new SimpleDateFormat("yyyy-MM-dd").format(DateUtils.addDays(new Date(), 7));
   mav.addObject("hotelRoomId", hotelRoomId);
   mav.addObject("hotelNameId", hotelNameId);
   mav.addObject("time", time);
   mav.addObject("next", next);
   return mav;
 }
  @Test(expectedExceptions = UnknownTokenException.class)
  public void findUserByTokenExpired() {
    MolgenisToken molgenisToken = new MolgenisToken();
    molgenisToken.setToken("token");
    molgenisToken.setExpirationDate(DateUtils.addDays(new Date(), -1));

    when(dataService.findOne(
            MolgenisToken.ENTITY_NAME,
            new QueryImpl().eq(MolgenisToken.TOKEN, "token"),
            MolgenisToken.class))
        .thenReturn(molgenisToken);

    tokenService.findUserByToken("token");
  }
예제 #25
0
  @Transactional(readOnly = false)
  public Page<Link> findPage(Page<Link> page, Link link, boolean isDataScopeFilter) {
    // 更新过期的权重,间隔为“6”个小时
    Date updateExpiredWeightDate = (Date) CacheUtils.get("updateExpiredWeightDateByLink");
    if (updateExpiredWeightDate == null
        || (updateExpiredWeightDate != null
            && updateExpiredWeightDate.getTime() < new Date().getTime())) {
      dao.updateExpiredWeight(link);
      CacheUtils.put("updateExpiredWeightDateByLink", DateUtils.addHours(new Date(), 6));
    }
    link.getSqlMap().put("dsf", dataScopeFilter(link.getCurrentUser(), "o", "u"));

    return super.findPage(page, link);
  }
  @Test
  public void shouldReturnTotalOfPointsInBacklogInSprint() throws Exception {

    // 2 - total de pontos no backlog no sprint // TODO em portugues o comentario ??

    when(sprintService.getAllSprints()).thenReturn(getSprints());
    when(storyService.getStories(StoryStatus.BACKLOG)).thenReturn(getStories());

    List<Temp> temps = statisticallyService.get();

    verify(sprintService).getAllSprints();
    verify(storyService).getStories(StoryStatus.BACKLOG);

    System.out.println(
        DateUtils.parseDate("05/07/2012", "dd/MM/yyyy")
            .compareTo(DateUtils.parseDate("04/07/2012", "dd/MM/yyyy")));

    assertEquals(new Integer(50), temps.get(0).getPointsInBacklog());
    assertEquals(new Integer(100), temps.get(1).getPointsInBacklog());
    assertEquals(new Integer(120), temps.get(2).getPointsInBacklog());
    assertEquals(new Integer(140), temps.get(3).getPointsInBacklog());
    assertEquals(new Integer(250), temps.get(4).getPointsInBacklog());
  }
예제 #27
0
 private void handlePubSub(final Feed feed) {
   if (feed.getPushHub() != null && feed.getPushTopic() != null) {
     Date lastPing = feed.getPushLastPing();
     Date now = new Date();
     if (lastPing == null || lastPing.before(DateUtils.addDays(now, -3))) {
       new Thread() {
         @Override
         public void run() {
           handler.subscribe(feed);
         }
       }.start();
     }
   }
 }
예제 #28
0
  @Test
  public void add_weeks_to_date_in_java_with_apachecommons() {

    Calendar xmas = Calendar.getInstance();
    xmas.set(2012, 11, 25, 0, 0, 0);

    Date newYearsDay = DateUtils.addWeeks(xmas.getTime(), 1);

    SimpleDateFormat dateFormatter = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss z");

    logger.info(dateFormatter.format(xmas.getTime()));
    logger.info(dateFormatter.format(newYearsDay));

    assertTrue(newYearsDay.after(xmas.getTime()));
  }
예제 #29
0
  // TOOLS
  private DateTime getDateLimit(final boolean upper) {
    final Date date = DateUtils.truncate(new Date(), Calendar.DATE);
    final DateTime now = new DateTime(date);

    switch (type) {
      case YEAR:
        return upper ? now.plusYears(upperBoundary) : now.minusYears(lowerBoundary);
      case MONTH:
        return upper ? now.plusMonths(upperBoundary) : now.minusMonths(lowerBoundary);
      case DAY:
        return upper ? now.plusDays(upperBoundary) : now.minusDays(lowerBoundary);
      default:
        throw new IllegalArgumentException("Unsupported type of time unit: " + type);
    }
  }
 private long getRefreshWechatTokenScheduledInitDelay() {
   Date currentTime = DateUtil.currentTime();
   long initDelay = currentTime.getTime() - WechatRedisCmd.getLastTokenUpdateTime();
   if (initDelay >= WechatConstants.refreshTokenTaskPeriod) {
     initDelay = 0;
   } else {
     initDelay = WechatConstants.refreshTokenTaskPeriod - initDelay;
   }
   logger.info(
       "系统当前时间为{},刷新延迟毫秒数为{},下次刷新access token时间为{}",
       DateUtil.formatDate(currentTime),
       initDelay,
       DateUtil.formatDate(DateUtils.addMilliseconds(currentTime, (int) initDelay)));
   return initDelay;
 }