From 151ce72ae76d85c8b1ecc7f38c3541a43f00c1a9 Mon Sep 17 00:00:00 2001 From: liguoyang Date: Fri, 12 Dec 2025 10:09:11 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E8=84=8F=E6=95=B0=E6=8D=AE=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Implements/GainfoOutsourceService.cs | 47 +++++++++++-------- 1 file changed, 27 insertions(+), 20 deletions(-) diff --git a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoOutsourceService.cs b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoOutsourceService.cs index 48cabf13..b000f9db 100644 --- a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoOutsourceService.cs +++ b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoOutsourceService.cs @@ -95,28 +95,35 @@ public class GainfoOutsourceService : IGainfoOutsourceService public async Task GetExternalInfoAsync(string userNo) { - var data = await _dbContext.Queryable() - .LeftJoin((a, b) => a.Code == b.Code) - .LeftJoin((a, b, c) => a.SapCode == c.Code) - .Where((a, b, c) => b.No == userNo) - .Select((a, b, c) => new GainfoOutSourceExternalInfoResponse - { - UserCode = b.Code, - Supplier = a.Supplier, - SapCode = a.SapCode, - SapPhone = a.SapPhone, - SapName = c.Name, - EntryDate = b.EntryDate, - ResignationDate = b.ResignationDate, - Factory = b.Factory - }) - .SingleAsync(); + try + { + var data = await _dbContext.Queryable() + .LeftJoin((a, b) => a.Code == b.Code) + .LeftJoin((a, b, c) => a.SapCode == c.Code) + .Where((a, b, c) => b.No == userNo) + .Select((a, b, c) => new GainfoOutSourceExternalInfoResponse + { + UserCode = b.Code, + Supplier = a.Supplier, + SapCode = a.SapCode, + SapPhone = a.SapPhone, + SapName = c.Name, + EntryDate = b.EntryDate, + ResignationDate = b.ResignationDate, + Factory = b.Factory + }) + .SingleAsync(); - data.IsWhiteListInAutoResign = await _dbContext.Queryable() - .Where(x => x.UserCode == data.UserCode) - .AnyAsync(); + data.IsWhiteListInAutoResign = await _dbContext.Queryable() + .Where(x => x.UserCode == data.UserCode) + .AnyAsync(); - return data; + return data; + } + catch (Exception) + { + return null; + } }