|
@@ -9,6 +9,10 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.kxs.transfer.api.model.KxsCheckpoint;
|
|
import com.kxs.transfer.api.model.KxsCheckpoint;
|
|
|
import com.kxs.transfer.api.service.KxsCheckpointService;
|
|
import com.kxs.transfer.api.service.KxsCheckpointService;
|
|
|
|
|
|
|
|
|
|
+import java.util.Comparator;
|
|
|
|
|
+import java.util.List;
|
|
|
|
|
+import java.util.Optional;
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* store the checkpoint data in the shared storage, such us database, shared file storage...
|
|
* store the checkpoint data in the shared storage, such us database, shared file storage...
|
|
|
* this meta store need to be completed by consumer
|
|
* this meta store need to be completed by consumer
|
|
@@ -44,12 +48,12 @@ public class UserMetaStore extends AbstractUserMetaStore {
|
|
|
@Override
|
|
@Override
|
|
|
protected String getData(String groupId) {
|
|
protected String getData(String groupId) {
|
|
|
|
|
|
|
|
- KxsCheckpoint checkpoint = kxsCheckpointService.getOne(Wrappers.lambdaQuery(KxsCheckpoint.class)
|
|
|
|
|
|
|
+ List<KxsCheckpoint> checkpoints = kxsCheckpointService.list(Wrappers.lambdaQuery(KxsCheckpoint.class)
|
|
|
.eq(KxsCheckpoint::getGroupId, groupId)
|
|
.eq(KxsCheckpoint::getGroupId, groupId)
|
|
|
.orderByDesc(KxsCheckpoint::getCreateTime)
|
|
.orderByDesc(KxsCheckpoint::getCreateTime)
|
|
|
- .last("limit 1"));
|
|
|
|
|
-
|
|
|
|
|
|
|
+ .last("limit 5"));
|
|
|
|
|
+ Optional<KxsCheckpoint> checkpoint = checkpoints.stream().min(Comparator.comparing(KxsCheckpoint::getCreateTime));
|
|
|
|
|
|
|
|
- return checkpoint != null ? checkpoint.getCheckpoint() : null;
|
|
|
|
|
|
|
+ return checkpoint.map(KxsCheckpoint::getCheckpoint).orElse(null);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|