判断学期
代码块
/**
* 获取当前学期 8.15~2.15为上学期
* @return 上学期=1 下学期=2
*/
private int getTerm(){
List<Integer> nextTermList = Arrays.asList(3,4,5,6,7);
DateTime nowDate = DateTime.now();
int month = nowDate.getMonthOfYear();
int day = nowDate.getDayOfMonth();
return (nextTermList.contains(month) || (month == 2 && day > 15) || (month == 8 && day < 15)) ? 2 : 1;
}
目录
用 [TOC]
来生成目录: