</pre><pre name="code" class="java"> public static Date getEndDay(int x) {
Date date;
if (x==0){
return new Date();
}
String dateStr = "d=";
for (int i = 0; i < 14; i++) {
date = new Date() + i;
dateStr += DateUtil.dateToStr(date) + ",";
}
String httpUrl = "http://apis.baidu.com/xiaogg/holiday/holiday";
//String httpArg = "";
JsonSlurper jsonSlurper = new JsonSlurper()
def json = jsonSlurper.parseText(DateUtil.getHolidays(httpUrl, dateStr))
int count = 0;
date = new Date()
for (int i = 0; i < json.size(); i++) {
if (json.getAt(DateUtil.dateToStr(date)).equals("0")) {
count++
if (count == x) {
break
}
}
date += 1;
}
return date;
}