法定节假日接口

http://tool.bitefu.net/jiari/


//判断国家法定假日
String daysOfMonth = String.valueOf(year)+String.format("%02d",month+1);//整理接口请求数据,月份要求两位

String url = "https://tool.bitefu.net/jiari/?d=" + daysOfMonth;
//处理返回的数据
try {
   Map m = new HashMap();
   HttpUtil.Response result = HttpUtil.sendGetRequest(url, "utf-8",m);
   JSONObject resultarr = JSON.parseObject(result.content.toString());
   Map maps = JSON.parseObject(resultarr.get(daysOfMonth).toString());

   for(Object key : maps.keySet()){
      holidays.add(key.toString().substring(2,4));//将法定假日添加到休息日中
   }
} catch (Exception e) {
   e.printStackTrace();
}

你可能感兴趣的:(法定节假日接口)