1.一个是对象里面的时间转时间戳

 2.然后用冒泡排序进行时间戳值的比较

 3.通过比较大小交换集合里面的对象进行排序

//获得列表结果查询
@RequestMapping(value = "/feelist",method = RequestMethod.GET)
@ResponseBody
public ApiResponseResult feelist( long hotelId,String roomNo){
Hotel h = hotelService.getHotel(hotelId);
FeeMonth f=new FeeMonth();
f.setHotel(h);
f.setRoomNo(roomNo);
List<FeeMonth> feelist =feeMonthService.FeeMonthgz(f);
if(feelist==null || feelist.size()<1){
return ApiResponseResult.failure("没有记录", -1);
}
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");

for(int i=0;i<feelist.size()-1;i++){//外层循环控制排序趟数
for(int j=0;j<feelist.size()-1-i;j++){//内层循环控制每一趟排序多少次
try {
if((simpleDateFormat.parse(feelist.get(j).getDatemonth())).getTime()>(simpleDateFormat.parse(feelist.get(j+1).getDatemonth())).getTime()){
FeeMonth fee=feelist.get(j);
feelist.set((j), feelist.get(j+1));
feelist.set((j+1), fee);
}
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}

return ApiResponseResult.success().data(feelist);
}//..