//生效日期、操作时间倒序、机型组升序
private void sort(List<IntpathcostAreaGroupstVO> data){
Comparator<Object> com = Collator.getInstance(java.util.Locale.CHINA);
Collections.sort(data,new Comparator<IntpathcostAreaGroupstVO>() {
@Override
public int compare(IntpathcostAreaGroupstVO o1, IntpathcostAreaGroupstVO o2) {
String startDate1=DateUtils.date2Str(o1.getStartDate(),DateUtils.YYYY_MM_DD_HHMMSS);//生效日期
String operateTime1=DateUtils.date2Str(o1.getOperateTime(),DateUtils.YYYY_MM_DD_HHMMSS);//操作时间
String groupingName1=o1.getGroupingName();//机型组
String startDate2=DateUtils.date2Str(o2.getStartDate(),DateUtils.YYYY_MM_DD_HHMMSS);//生效日期
String operateTime2=DateUtils.date2Str(o2.getOperateTime(),DateUtils.YYYY_MM_DD_HHMMSS);//操作时间
String groupingName2=o2.getGroupingName();//机型组
int startDate=com.compare(startDate2,startDate1);//倒序
int operateTime=com.compare(operateTime2,operateTime1);//倒序
int groupingName=com.compare(groupingName1,groupingName2);//升序
if(startDate!=0){
return startDate;
}else if(operateTime!=0){
return operateTime;
}else {
return groupingName;
}
}
});
}