Commit 2c34c6de417ea50f66fa5e044a9832d7288dc99d

Authored by dongqin
1 parent 8efcfb4cc4

结果按时间倒序

Showing 2 changed files with 22 additions and 1 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/IndividualCaseResult.java View file @ 2c34c6d
... ... @@ -3,12 +3,15 @@
3 3 import java.io.Serializable;
4 4 import java.util.List;
5 5  
  6 +import com.lyms.platform.common.utils.DateUtil;
  7 +import com.lyms.platform.common.utils.StringUtils;
  8 +
6 9 /**
7 10 * @author dongqin
8 11 * @description
9 12 * @date 13:50 2019/11/22
10 13 **/
11   -public class IndividualCaseResult<T> implements Serializable {
  14 +public class IndividualCaseResult<T> implements Comparable<IndividualCaseResult<T>>, Serializable {
12 15  
13 16 private static final long serialVersionUID = 1634160181617894592L;
14 17  
... ... @@ -80,6 +83,22 @@
80 83  
81 84 public void setHighRiskDesc(String highRiskDesc) {
82 85 this.highRiskDesc = highRiskDesc;
  86 + }
  87 +
  88 + @Override
  89 + public int compareTo(IndividualCaseResult<T> result) {
  90 + String timeAxisStr = result.getTimeAxisStr();
  91 + if (StringUtils.isNotEmpty(timeAxisStr)) {
  92 + long time = DateUtil.parseYMD(timeAxisStr).getTime();
  93 + if (StringUtils.isNotEmpty(this.timeAxisStr)) {
  94 + long time1 = DateUtil.parseYMD(this.timeAxisStr).getTime();
  95 + if (time1 > time) {
  96 + return -1;
  97 + }
  98 + return 1;
  99 + }
  100 + }
  101 + return 0;
83 102 }
84 103  
85 104 public static class Infos {
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/IndividualCaseServiceImpl.java View file @ 2c34c6d
1 1 package com.lyms.platform.operate.web.service.impl;
2 2  
  3 +import java.util.Collections;
3 4 import java.util.Date;
4 5 import java.util.LinkedList;
5 6 import java.util.List;
... ... @@ -84,6 +85,7 @@
84 85 }
85 86 }
86 87 BaseResponse baseResponse = new BaseResponse();
  88 + Collections.sort(results);
87 89 baseResponse.setObject(results);
88 90 return baseResponse;
89 91