From 09e289ea735587fb0de2ea9717aca6f9909529bc Mon Sep 17 00:00:00 2001
From: sunpengfei <i@angelzzz.com>
Date: 星期三, 10 九月 2025 13:14:21 +0800
Subject: [PATCH] feat:开发

---
 FlexJobApi.UserServer.Application/EnterpriseWallets/Queries/EnterpriseWalletQueryHandler.cs |   77 ++++++++++++++++++++++++++++----------
 1 files changed, 57 insertions(+), 20 deletions(-)

diff --git a/FlexJobApi.UserServer.Application/EnterpriseWallets/Queries/EnterpriseWalletQueryHandler.cs b/FlexJobApi.UserServer.Application/EnterpriseWallets/Queries/EnterpriseWalletQueryHandler.cs
index 2202f1f..c729206 100644
--- a/FlexJobApi.UserServer.Application/EnterpriseWallets/Queries/EnterpriseWalletQueryHandler.cs
+++ b/FlexJobApi.UserServer.Application/EnterpriseWallets/Queries/EnterpriseWalletQueryHandler.cs
@@ -97,6 +97,12 @@
                         entity.CreditAuthMode = response.CreditAuthMode;
                         update = true;
                     }
+                    else
+                    {
+                        entity.ErrorCode = response.Code;
+                        entity.FailReason = response.SubMsg ?? response.Msg;
+                        update = true;
+                    }
                 }
 
                 if (entity.SignStatus == EnumEnterpriseWalletSignStatus.Normal && entity.AccountBookStatus != EnumEnterpriseWalletAccountBookStatus.Normal)
@@ -112,18 +118,26 @@
                             cert_no = enterprise.SocietyCreditCode
                         }.ToJson()
                     });
-                    if (response.IsError) throw Oops.Oh(EnumErrorCodeType.s510, response.SubMsg ?? response.Msg);
-                    entity.AccountBookId = response.AccountBookId;
-                    entity.BankAccName = response.ExtCardInfo.BankAccName;
-                    entity.CardBank = response.ExtCardInfo.CardBank;
-                    entity.CardBranch = response.ExtCardInfo.CardBranch;
-                    entity.CardDeposit = response.ExtCardInfo.CardDeposit;
-                    entity.CardLocation = response.ExtCardInfo.CardLocation;
-                    entity.CardNo = response.ExtCardInfo.CardNo;
-                    entity.AccountBookStatus = response.ExtCardInfo.Status == "A"
-                        ? EnumEnterpriseWalletAccountBookStatus.Normal
-                        : EnumEnterpriseWalletAccountBookStatus.Exception;
-                    update = true;
+                    if (!response.IsError)
+                    {
+                        entity.AccountBookId = response.AccountBookId;
+                        entity.BankAccName = response.ExtCardInfo.BankAccName;
+                        entity.CardBank = response.ExtCardInfo.CardBank;
+                        entity.CardBranch = response.ExtCardInfo.CardBranch;
+                        entity.CardDeposit = response.ExtCardInfo.CardDeposit;
+                        entity.CardLocation = response.ExtCardInfo.CardLocation;
+                        entity.CardNo = response.ExtCardInfo.CardNo;
+                        entity.AccountBookStatus = response.ExtCardInfo.Status == "A"
+                            ? EnumEnterpriseWalletAccountBookStatus.Normal
+                            : EnumEnterpriseWalletAccountBookStatus.Exception;
+                        update = true;
+                    }
+                    else
+                    {
+                        entity.ErrorCode = response.Code;
+                        entity.FailReason = response.SubMsg ?? response.Msg;
+                        update = true;
+                    }
                 }
 
                 if (entity.AccountBookStatus == EnumEnterpriseWalletAccountBookStatus.Normal)
@@ -147,17 +161,40 @@
 
             var model = entity.Adapt<GetEnterpriseWalletQueryResult>();
 
-            var expandindirectOrder = await repEnterpriseWalletExpandindirectOrder.AsQueryable().AsNoTracking()
+            var expandindirectOrder = await repEnterpriseWalletExpandindirectOrder.AsQueryable()
                 .OrderByDescending(it => it.CreatedTime)
                 .Where(it => it.WalletId == model.Id)
-                .Select(it => new
-                {
-                    it.OrderStatus
-                })
                 .FirstOrDefaultAsync();
-            model.ExpandindirectOrderStatus = expandindirectOrder == null
-                ? EnumEnterpriseWalletExpandindirectOrderStatus.Wait
-                : expandindirectOrder.OrderStatus;
+            if (expandindirectOrder != null)
+            {
+                if (expandindirectOrder.OrderStatus == EnumEnterpriseWalletExpandindirectOrderStatus.PROCESSING)
+                {
+                    var response = alipayUtils.FundExpandindirectOrderQuery(new Aop.Api.Domain.AlipayFundExpandindirectOrderQueryModel
+                    {
+                        BizScene = expandindirectOrder.BizScene,
+                        OrderId = expandindirectOrder.OrderId,
+                        OutBizNo = expandindirectOrder.OutBizNo,
+                        ProductCode = expandindirectOrder.ProductCode,
+                    });
+                    if (!response.IsError)
+                    {
+                        expandindirectOrder.Status = response.Status;
+                        expandindirectOrder.OrderStatus = expandindirectOrder.Status.ToEnum<EnumEnterpriseWalletExpandindirectOrderStatus>("鏈瘑鍒殑鐘舵��")!.Value;
+                        expandindirectOrder.TaskFinishTime = response.TaskFinishTime.ToDateTime();
+                        expandindirectOrder.RiskReviewRemark = response.RiskReviewRemark;
+                    }
+                    else
+                    {
+                        expandindirectOrder.RiskReviewRemark = response.SubMsg ?? response.Msg;
+                    }
+                    await repEnterpriseWalletExpandindirectOrder.UpdateNowAsync(expandindirectOrder);
+                }
+                model.ExpandindirectOrderStatus = expandindirectOrder.OrderStatus;
+            }
+            else
+            {
+                model.ExpandindirectOrderStatus = EnumEnterpriseWalletExpandindirectOrderStatus.Wait;
+            }
 
             return model;
         }

--
Gitblit v1.9.1