Browse Source

排序修改

xuefy 3 năm trước cách đây
mục cha
commit
ab0eae2a1e

+ 26 - 1
flowable/src/main/java/com/huyi/flowable/controller/CloudSupplyChainController.java

@@ -84,7 +84,32 @@ public class CloudSupplyChainController {
                     .asc().list();
             List<String> assigneeList = ListUtil.getIdFromList(hisTaskList, "assignee");
 
-            hisTaskList.sort(Comparator.comparing(HistoricActivityInstance::getStartTime).thenComparing(HistoricActivityInstance::getEndTime));
+            Collections.sort(hisTaskList, new Comparator<HistoricActivityInstance>() {
+                @Override
+                public int compare(HistoricActivityInstance o1, HistoricActivityInstance o2) {
+                    if (o1.getStartTime().getTime() > o2.getStartTime().getTime()) {
+                        return 1;
+                    } else if ((o1.getStartTime().getTime() < o2.getStartTime().getTime())) {
+                        return -1;
+                    } else {
+                        if (o1.getEndTime() != null && o2.getEndTime() != null) {
+                            if (o1.getEndTime().getTime() > o2.getEndTime().getTime()) {
+                                return 1;
+                            } else if ((o1.getEndTime().getTime() < o2.getEndTime().getTime())) {
+                                return -1;
+                            } else {
+                                return 0;
+                            }
+                        } else {
+                            if (o1.getEndTime() == null) {
+                                return 1;
+                            } else {
+                                return -1;
+                            }
+                        }
+                    }
+                }
+            });
 
             List<User> userList = identityService.createUserQuery().userIds(assigneeList).list();