//定时器到泄洪时间生成泄洪中预警 LocalDateTime floodTime = startTime.toLocalDateTime(); LocalDateTime now = LocalDateTime.now(); Duration duration = Duration.between(now, floodTime); long delay = duration.toMillis(); new Timer().schedule(new TimerTask() { @Override public void run() { WarnStages warnStages = new WarnStages(); warnStages.setWarnType("2"); String warnContent = "根据水库调令," + resName + "正在泄洪,您所处区域属泄洪影响范围,请您及时撤离到安全区域,并随时注意防范风险。"; warnStages.setWarnContent(warnContent); warnStages.setStartTime(startTime); warnStages.setWarnCode(warnCode); warnStagesDao.save(warnStages); } }, delay);
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)