package cn.gistack.sm.sjztmd.util;
|
|
import org.springblade.core.tool.utils.DateUtil;
|
import org.springblade.core.tool.utils.StringUtil;
|
|
import java.text.ParseException;
|
import java.text.SimpleDateFormat;
|
import java.util.Date;
|
|
public class MyDateUtils {
|
|
/**
|
* 判断当前日期是否在汛期,汛期
|
* @return
|
*/
|
public static Boolean isTodayInFloodSeason(){
|
Boolean inSeason = true;
|
|
Date today = DateUtil.now();
|
|
String todayStr = DateUtil.format(today, "yyyy-MM-dd");
|
String nowYear = todayStr.split("-")[0];
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
try {
|
Date startDate = sdf.parse(StringUtil.format("{}-05-01",nowYear));
|
Date endDate = sdf.parse(StringUtil.format("{}-11-01",nowYear));
|
|
inSeason = today.after(startDate)&&today.before(endDate);
|
return inSeason;
|
} catch (ParseException e) {
|
throw new RuntimeException(e);
|
}
|
}
|
|
|
|
}
|