|
|
@@ -69,9 +69,23 @@ public class AccountService {
|
|
|
private final AlipayTransferService alipayTransferService;
|
|
|
|
|
|
public List<AccountVO> queryAccounts(String enterpriseId) {
|
|
|
- return accountMapper.selectList(
|
|
|
+ List<AccountVO> vos = accountMapper.selectList(
|
|
|
new LambdaQueryWrapper<AccountEntity>().eq(AccountEntity::getEnterpriseId, enterpriseId))
|
|
|
.stream().map(this::accountVO).toList();
|
|
|
+ // 从支付宝拉取实时余额(available_amount)
|
|
|
+ for (AccountVO vo : vos) {
|
|
|
+ if (vo.getAccountBookId() != null && !vo.getAccountBookId().isBlank()) {
|
|
|
+ try {
|
|
|
+ var alipayAccounts = alipayTransferService.queryAccounts(enterpriseId);
|
|
|
+ for (var m : alipayAccounts) {
|
|
|
+ if (vo.getAccountBookId().equals(m.get("account_book_id"))) {
|
|
|
+ vo.setAvailableAmount((String) m.get("available_amount"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (Exception ignored) {}
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return vos;
|
|
|
}
|
|
|
|
|
|
/** 统计转账金额 — 仅统计 SUCCESS 状态的记录 */
|