|
|
@@ -382,6 +382,40 @@ public class StakingGrpcService extends StakingServiceGrpc.StakingServiceImplBas
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void listProfitJournalsForCommissionReissue(ListProfitJournalsForCommissionReissueRequest request,
|
|
|
+ StreamObserver<ListProfitJournalsForCommissionReissueResponse> responseObserver) {
|
|
|
+ try {
|
|
|
+ LocalDateTime start = LocalDateTime.parse(request.getCreatedAtStart(), FMT);
|
|
|
+ LocalDateTime end = LocalDateTime.parse(request.getCreatedAtEnd(), FMT);
|
|
|
+ LambdaQueryWrapper<StakingProfitJournal> wrapper = new LambdaQueryWrapper<StakingProfitJournal>()
|
|
|
+ .ge(StakingProfitJournal::getCreatedAt, start)
|
|
|
+ .le(StakingProfitJournal::getCreatedAt, end)
|
|
|
+ .orderByAsc(StakingProfitJournal::getCreatedAt);
|
|
|
+ if (request.hasUserId()) {
|
|
|
+ wrapper.eq(StakingProfitJournal::getUserId, request.getUserId());
|
|
|
+ }
|
|
|
+
|
|
|
+ List<StakingProfitJournal> journals = stakingProfitJournalMapper.selectList(wrapper);
|
|
|
+ ListProfitJournalsForCommissionReissueResponse.Builder builder = ListProfitJournalsForCommissionReissueResponse.newBuilder();
|
|
|
+ for (StakingProfitJournal journal : journals) {
|
|
|
+ builder.addJournals(ProfitJournalForCommissionReissue.newBuilder()
|
|
|
+ .setJournalId(journal.getId() != null ? journal.getId() : 0L)
|
|
|
+ .setUserId(journal.getUserId() != null ? journal.getUserId() : 0L)
|
|
|
+ .setProfitAmount(journal.getProfitAmount() != null ? journal.getProfitAmount().toPlainString() : "0")
|
|
|
+ .setCreatedAt(journal.getCreatedAt() != null ? journal.getCreatedAt().format(FMT) : "")
|
|
|
+ .build());
|
|
|
+ }
|
|
|
+ log.info("【补发质押返佣】gRPC 查询质押收益流水完成:start={}, end={}, userId={}, count={}",
|
|
|
+ request.getCreatedAtStart(), request.getCreatedAtEnd(), request.hasUserId() ? request.getUserId() : null, journals.size());
|
|
|
+ responseObserver.onNext(builder.build());
|
|
|
+ responseObserver.onCompleted();
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("【补发质押返佣】gRPC 查询质押收益流水异常", e);
|
|
|
+ responseObserver.onError(io.grpc.Status.INTERNAL.withDescription(e.getMessage()).asRuntimeException());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private StakingProductInfo toProductInfo(StakingProduct p) {
|
|
|
StakingProductInfo.Builder builder = StakingProductInfo.newBuilder()
|
|
|
.setId(p.getId() != null ? p.getId() : 0L)
|