Browse Source

sort bug

pt
zhizhi wu 4 years ago
parent
commit
a1dcf3d69f
  1. 5
      wisdomcar/src/main/java/com/ccsens/wisdomcar/service/RecordService.java
  2. 4
      wisdomcar/src/main/resources/application.yml

5
wisdomcar/src/main/java/com/ccsens/wisdomcar/service/RecordService.java

@ -227,9 +227,10 @@ public class RecordService implements IRecordService{
prev = cur;
}
}
if (types.length > 1) {
if (types.length > 1 && CollectionUtil.isNotEmpty(records)) {
log.info("重新排序");
Collections.sort(records, (o1, o2) ->{
log.info("o1:{},o2:{}",o1,o2);
if (o1 == null || o1.getTime() == null) {
if (o2 == null || o2.getTime() == null) {
return 0;
@ -239,7 +240,7 @@ public class RecordService implements IRecordService{
if (o2 == null || o2.getTime() == null) {
return -1;
}
return (int) (o1.getTime() - o2.getTime());
return o1.getTime() - o2.getTime() > 0 ? 1 : -1;
} );
}
return records;

4
wisdomcar/src/main/resources/application.yml

@ -1,7 +1,7 @@
spring:
profiles:
active: test
include: common, util-test
active: prod
include: common, util-prod

Loading…
Cancel
Save