|
|
@@ -0,0 +1,60 @@
|
|
|
+package com.zhongshu.card.server.core.service.pay;
|
|
|
+
|
|
|
+import com.github.microservice.components.data.base.page.PageableModel;
|
|
|
+import com.github.microservice.pay.client.model.ledger.GeneralLedgerModel;
|
|
|
+import com.github.microservice.pay.client.model.ledger.GeneralLedgerTreeModel;
|
|
|
+import com.github.microservice.pay.client.model.ledger.transaction.BaseQueryTransactionLogModel;
|
|
|
+import com.github.microservice.pay.client.model.ledger.transaction.DescendantQueryTransactionLogModel;
|
|
|
+import com.github.microservice.pay.client.model.ledger.transaction.TransactionLogAggregateRetModel;
|
|
|
+import com.github.microservice.pay.client.ret.ResultContent;
|
|
|
+import com.github.microservice.pay.client.ret.ResultState;
|
|
|
+import com.github.microservice.pay.client.service.ledger.GeneralLedgerService;
|
|
|
+import com.github.microservice.pay.client.service.ledger.TransactionLogService;
|
|
|
+import com.zhongshu.card.client.utils.DateUtils;
|
|
|
+import com.zhongshu.card.server.core.domain.pay.PayAccount;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.data.domain.Pageable;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
+@Service
|
|
|
+public class AccountBookService {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ TransactionLogService transactionLogService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ GeneralLedgerService generalLedgerService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ PayAccountService payAccountService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询用户流水
|
|
|
+ */
|
|
|
+ public Object queryFlow(Pageable pageable, String userId, String projectOid){
|
|
|
+ PayAccount userParent = payAccountService.getUserParent(projectOid, userId);
|
|
|
+ ResultContent<GeneralLedgerTreeModel> descendantRet = generalLedgerService.descendant(userParent.getLedgerId());
|
|
|
+ if (!descendantRet.getState().equals(ResultState.Success)){
|
|
|
+ return com.github.microservice.net.ResultContent.buildFail("获取用户账户及下级账户失败");
|
|
|
+ }
|
|
|
+ GeneralLedgerTreeModel generalLedgerTreeModel = descendantRet.getContent();
|
|
|
+
|
|
|
+ List<GeneralLedgerTreeModel> children = generalLedgerTreeModel.getChildren();
|
|
|
+ List<String> childrenIdList = children.stream().map(GeneralLedgerModel::getId).toList();
|
|
|
+
|
|
|
+ DescendantQueryTransactionLogModel descendantQueryTransactionLogModel = new DescendantQueryTransactionLogModel();
|
|
|
+ PageableModel pageableModel = new PageableModel();
|
|
|
+ pageableModel.setPage(pageable.getPageNumber());
|
|
|
+ pageableModel.setSize(pageable.getPageSize());
|
|
|
+ pageableModel.setSort("createTime");
|
|
|
+
|
|
|
+ descendantQueryTransactionLogModel.setPage(pageableModel);
|
|
|
+ descendantQueryTransactionLogModel.setParentGeneralLedgerId(userParent.getLedgerId());
|
|
|
+
|
|
|
+ descendantQueryTransactionLogModel.setStartTime(DateUtils.getMonthStartTime(2024, 10));
|
|
|
+ return transactionLogService.aggregate(descendantQueryTransactionLogModel);
|
|
|
+ }
|
|
|
+}
|