获取时记得排序,默认是倒叙的
This commit is contained in:
parent
0d2c92e8e1
commit
9c1d979bd8
@ -14,6 +14,7 @@ import org.apache.commons.lang3.StringUtils;
|
|||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
import java.util.Comparator;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -78,16 +79,19 @@ public class WvpActiveStorageOperator extends ADeviceStorageOperator {
|
|||||||
if (result.getInteger("code") == 0) {
|
if (result.getInteger("code") == 0) {
|
||||||
JSONObject data = result.getJSONObject("data");
|
JSONObject data = result.getJSONObject("data");
|
||||||
List<JSONObject> recordList = data.getJSONArray("list").toJavaList(JSONObject.class);
|
List<JSONObject> recordList = data.getJSONArray("list").toJavaList(JSONObject.class);
|
||||||
return recordList.stream().map(record -> {
|
return recordList.stream()
|
||||||
FileObject object = new FileObject();
|
.map(record -> {
|
||||||
object.setName(record.getString("id"));
|
FileObject object = new FileObject();
|
||||||
object.setPath(record.getString("folder"));
|
object.setName(record.getString("id"));
|
||||||
object.setUrl(getUrlForDownload(record.getInteger("id")));
|
object.setPath(record.getString("folder"));
|
||||||
object.setNeedDownload(true);
|
object.setUrl(getUrlForDownload(record.getInteger("id")));
|
||||||
object.setCreateTime(new Date(record.getLongValue("startTime")));
|
object.setNeedDownload(true);
|
||||||
object.setEndTime(new Date(record.getLongValue("endTime")));
|
object.setCreateTime(new Date(record.getLongValue("startTime")));
|
||||||
return object;
|
object.setEndTime(new Date(record.getLongValue("endTime")));
|
||||||
}).collect(Collectors.toList());
|
return object;
|
||||||
|
})
|
||||||
|
.sorted(Comparator.comparing(FileObject::getCreateTime))
|
||||||
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user