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; + } }