From 36f33b983fa84a542b8f0796d1fd73929c169a32 Mon Sep 17 00:00:00 2001 From: wanghaomei Date: Tue, 22 Nov 2022 14:17:51 +0800 Subject: [PATCH] =?UTF-8?q?=E9=82=AE=E7=AE=B1=E8=AE=BE=E7=BD=AE=E3=80=81?= =?UTF-8?q?=E7=BD=91=E7=AB=99=E8=B4=A6=E5=8F=B7=E6=9D=83=E9=99=90=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Myshipping.Application.xml | 3 +- .../BookingOrder/BookingOrderService.cs | 3 +- .../BookingTemplate/BookingTemplateService.cs | 7 +- Myshipping.Core/Entity/PingTai/PingTaiUser.cs | 152 ++++++++++++++++++ Myshipping.Core/Job/UserSyncWorker.cs | 34 +++- Myshipping.Core/Myshipping.Core.xml | 145 +++++++++++++++++ .../Service/DjyCustomer/DjyCustomerService.cs | 51 +++--- .../DjyCustomer/IDjyCustomerService.cs | 4 +- .../DjyUserConfig/DjyUserConfigService.cs | 7 +- .../DjyUserMailAccountService.cs | 5 +- .../DjyWebsiteAccountConfigService.cs | 13 +- .../IDjyWebsiteAccountConfigService.cs | 4 +- 12 files changed, 381 insertions(+), 47 deletions(-) diff --git a/Myshipping.Application/Myshipping.Application.xml b/Myshipping.Application/Myshipping.Application.xml index bd168fce..ded37c80 100644 --- a/Myshipping.Application/Myshipping.Application.xml +++ b/Myshipping.Application/Myshipping.Application.xml @@ -4705,7 +4705,8 @@ 打印 - + 订舱Id + 打印模板类型,根据字典传值 diff --git a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs index 62dbb965..e75307f5 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs @@ -1098,7 +1098,8 @@ namespace Myshipping.Application /// /// 打印 /// - /// + /// 订舱Id + /// 打印模板类型,根据字典传值 /// [HttpGet("/BookingOrder/Print")] public async Task Print(long bookingId, string type) diff --git a/Myshipping.Application/Service/BookingTemplate/BookingTemplateService.cs b/Myshipping.Application/Service/BookingTemplate/BookingTemplateService.cs index a93a62f8..4d9dc504 100644 --- a/Myshipping.Application/Service/BookingTemplate/BookingTemplateService.cs +++ b/Myshipping.Application/Service/BookingTemplate/BookingTemplateService.cs @@ -37,9 +37,10 @@ namespace Myshipping.Application public async Task Page([FromQuery] QueryBookingTemplateInput input) { var entities = await _rep.AsQueryable() - .WhereIF(!string.IsNullOrEmpty(input.Title), u => u.Title.Contains(input.Title)) - .WhereIF(input.Type.HasValue, u => u.Type == input.Type) - .ToPagedListAsync(input.PageNo, input.PageSize); + .Where(m => m.CreatedUserId == UserManager.UserId) + .WhereIF(!string.IsNullOrEmpty(input.Title), u => u.Title.Contains(input.Title)) + .WhereIF(input.Type.HasValue, u => u.Type == input.Type) + .ToPagedListAsync(input.PageNo, input.PageSize); return entities.XnPagedResult(); } diff --git a/Myshipping.Core/Entity/PingTai/PingTaiUser.cs b/Myshipping.Core/Entity/PingTai/PingTaiUser.cs index 5b7cd68d..3e17785e 100644 --- a/Myshipping.Core/Entity/PingTai/PingTaiUser.cs +++ b/Myshipping.Core/Entity/PingTai/PingTaiUser.cs @@ -185,5 +185,157 @@ namespace Myshipping.Core.Entity + } + + [SugarTable("user_baseinfo")] + [Description("平台用户baseinfo")] + public class PingTaiUserBaseInfo : PingTaiDbEntity + { + /// + /// + /// + public string GID { get; set; } + + /// + /// + /// + public string USERID { get; set; } + + /// + /// 所属分公司简称 + /// + public string COMPANYNAME { get; set; } + + /// + /// 部门名称 + /// + public string DEPTNAME { get; set; } + + /// + /// + /// + public string OFFICEPHONE { get; set; } + + /// + /// + /// + public string HOMEPHONE { get; set; } + + /// + /// + /// + public string MOBILE { get; set; } + + /// + /// + /// + public string FAX { get; set; } + + /// + /// + /// + public string EMAIL1 { get; set; } + + /// + /// + /// + public string EMAIL2 { get; set; } + + /// + /// + /// + public string HOMEADDRESS { get; set; } + + /// + /// + /// + public string REMARK { get; set; } + + /// + /// + /// + public string CREATEUSER { get; set; } + + /// + /// + /// + public DateTime? CREATETIME { get; set; } + + /// + /// + /// + public string MODIFIEDUSER { get; set; } + + /// + /// + /// + public DateTime? MODIFIEDTIME { get; set; } + + /// + /// + /// + public string EMERGUSER { get; set; } + + /// + /// + /// + public string EMERGPHONE { get; set; } + + /// + /// + /// + public string EMERGEMAIL { get; set; } + + /// + /// + /// + public string POSTCODE { get; set; } + + /// + /// + /// + public string QQ { get; set; } + + /// + /// + /// + public string MSN { get; set; } + + + /// + /// + /// + public string FINANCESOFTCODE { get; set; } + + /// + /// + /// + public string IMAGEURL { get; set; } + + /// + /// + /// + public string SIGNATUREURL { get; set; } + + /// + /// + /// + public string FaSongFangDaiMa { get; set; } + + /// + /// + /// + public string JieShouFangDaiMa { get; set; } + + /// + /// + /// + public string QdPortUserName { get; set; } + + /// + /// + /// + public string QdPortPassword { get; set; } + } } diff --git a/Myshipping.Core/Job/UserSyncWorker.cs b/Myshipping.Core/Job/UserSyncWorker.cs index a8caa76d..c61db913 100644 --- a/Myshipping.Core/Job/UserSyncWorker.cs +++ b/Myshipping.Core/Job/UserSyncWorker.cs @@ -23,11 +23,12 @@ namespace Myshipping.Core.Job { Log.Information($"UserSyncWorker {DateTime.Now}"); - var tenantId = 142307070918780L; - var roleId = 175633246363717L;//普通用户 + var tenantId = 349708986646597L; + var roleId = 355651062833221L;//普通用户 var _sugerClient = App.GetService(); _sugerClient.QueryFilter.Clear(); var _repPingTaiUser = App.GetService>(); + var _repPingTaiUserBase = App.GetService>(); var _repUser = App.GetService>(); var _repEmp = App.GetService>(); var _repOrg = App.GetService>(); @@ -41,7 +42,18 @@ namespace Myshipping.Core.Job var keyDES = App.GetOptions().DES; var org = _repOrg.FirstOrDefault(x => x.TenantId == tenantId); + if (org == null) + { + Log.Error($"用户数据同步失败:未找到任何组织"); + return; + } + var pos = _repPos.FirstOrDefault(x => x.TenantId == tenantId); + if (pos == null) + { + Log.Error($"用户数据同步失败:未找到任何职位"); + return; + } _sugerClient.Ado.BeginTran(System.Data.IsolationLevel.ReadCommitted); try @@ -59,11 +71,17 @@ namespace Myshipping.Core.Job sysUser = sysUsers.First(x => x.Account == user.CODENAME); } + var ub = _repPingTaiUserBase.FirstOrDefault(x => x.USERID == user.GID); + sysUser.Account = user.CODENAME; sysUser.Password = DESCEncryption.Encrypt(user.PASSWORD, keyDES); sysUser.TenantId = tenantId; sysUser.Name = user.SHOWNAME; sysUser.AdminType = AdminType.None; + sysUser.DjyUserId = user.GID; + sysUser.NickName = user.SHOWNAME; + sysUser.Phone = ub.MOBILE; + sysUser.Email = ub.EMAIL1; if (!existUser) { @@ -85,19 +103,27 @@ namespace Myshipping.Core.Job userrole.SysRoleId = roleId; userrole.SysUserId = sysUser.Id; _repUserRole.Insert(userrole); + + Log.Information($"新用户,插入:{sysUser.Name}"); } else { _repUser.Update(sysUser); + + Log.Information($"老用户,更新:{sysUser.Name}"); } } _sugerClient.Ado.CommitTran(); + + Log.Information($"用户数据同步完成"); } - catch + catch (Exception ex) { _sugerClient.Ado.RollbackTran(); - throw; + Log.Error($"用户数据同步失败:{ex.Message}"); + Log.Error($"{ex.StackTrace}"); + } } diff --git a/Myshipping.Core/Myshipping.Core.xml b/Myshipping.Core/Myshipping.Core.xml index f6d2399b..faf95647 100644 --- a/Myshipping.Core/Myshipping.Core.xml +++ b/Myshipping.Core/Myshipping.Core.xml @@ -2294,6 +2294,151 @@ + + + + + + + + + + + + + 所属分公司简称 + + + + + 部门名称 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 系统应用表 diff --git a/Myshipping.Core/Service/DjyCustomer/DjyCustomerService.cs b/Myshipping.Core/Service/DjyCustomer/DjyCustomerService.cs index fefad3b9..55e0c1b7 100644 --- a/Myshipping.Core/Service/DjyCustomer/DjyCustomerService.cs +++ b/Myshipping.Core/Service/DjyCustomer/DjyCustomerService.cs @@ -42,28 +42,29 @@ namespace Myshipping.Core.Service public async Task Page([FromQuery] QueryDjyCustomerInput input) { var entities = await _rep.AsQueryable() - .WhereIF(!string.IsNullOrWhiteSpace(input.CodeName), u => u.CodeName.Contains(input.CodeName.Trim())) - .WhereIF(!string.IsNullOrWhiteSpace(input.ShortName), u => u.ShortName.Contains(input.ShortName.Trim())) - .WhereIF(!string.IsNullOrWhiteSpace(input.FullName), u => u.FullName.Contains(input.FullName.Trim())) - .WhereIF(!string.IsNullOrWhiteSpace(input.Chief), u => u.Chief.Contains(input.Chief.Trim())) - .WhereIF(!string.IsNullOrWhiteSpace(input.Tel), u => u.Tel.Contains(input.Tel.Trim())) - .WhereIF(!string.IsNullOrWhiteSpace(input.Email), u => u.Email.Contains(input.Email.Trim())) - .WhereIF(!string.IsNullOrWhiteSpace(input.QQ), u => u.QQ.Contains(input.QQ.Trim())) - .WhereIF(!string.IsNullOrWhiteSpace(input.WebUrl), u => u.WebUrl.Contains(input.WebUrl.Trim())) - .WhereIF(!string.IsNullOrWhiteSpace(input.Province), u => u.Province.Contains(input.Province.Trim())) - .WhereIF(!string.IsNullOrWhiteSpace(input.City), u => u.City.Contains(input.City.Trim())) - .WhereIF(!string.IsNullOrWhiteSpace(input.Addr), u => u.Addr.Contains(input.Addr.Trim())) - .WhereIF(!string.IsNullOrWhiteSpace(input.FullNameEN), u => u.FullNameEN.Contains(input.FullNameEN.Trim())) - .WhereIF(!string.IsNullOrWhiteSpace(input.AddrEN), u => u.AddrEN.Contains(input.AddrEN.Trim())) - .WhereIF(!string.IsNullOrWhiteSpace(input.PropString), u => u.PropString.Contains(input.PropString.Trim())) - .WhereIF(!string.IsNullOrWhiteSpace(input.InvTitle), u => u.InvTitle.Contains(input.InvTitle.Trim())) - .WhereIF(!string.IsNullOrWhiteSpace(input.TaxNO), u => u.TaxNO.Contains(input.TaxNO.Trim())) - .WhereIF(!string.IsNullOrWhiteSpace(input.InvAddrTel), u => u.InvAddrTel.Contains(input.InvAddrTel.Trim())) - .WhereIF(!string.IsNullOrWhiteSpace(input.RMBBank), u => u.RMBBank.Contains(input.RMBBank.Trim())) - .WhereIF(!string.IsNullOrWhiteSpace(input.RmbAccount), u => u.RmbAccount.Contains(input.RmbAccount.Trim())) - .WhereIF(!string.IsNullOrWhiteSpace(input.USDBank), u => u.USDBank.Contains(input.USDBank.Trim())) - .WhereIF(!string.IsNullOrWhiteSpace(input.USDAccount), u => u.USDAccount.Contains(input.USDAccount.Trim())) - .ToPagedListAsync(input.PageNo, input.PageSize); + .Where(m => m.CreatedUserId == UserManager.UserId) + .WhereIF(!string.IsNullOrWhiteSpace(input.CodeName), u => u.CodeName.Contains(input.CodeName.Trim())) + .WhereIF(!string.IsNullOrWhiteSpace(input.ShortName), u => u.ShortName.Contains(input.ShortName.Trim())) + .WhereIF(!string.IsNullOrWhiteSpace(input.FullName), u => u.FullName.Contains(input.FullName.Trim())) + .WhereIF(!string.IsNullOrWhiteSpace(input.Chief), u => u.Chief.Contains(input.Chief.Trim())) + .WhereIF(!string.IsNullOrWhiteSpace(input.Tel), u => u.Tel.Contains(input.Tel.Trim())) + .WhereIF(!string.IsNullOrWhiteSpace(input.Email), u => u.Email.Contains(input.Email.Trim())) + .WhereIF(!string.IsNullOrWhiteSpace(input.QQ), u => u.QQ.Contains(input.QQ.Trim())) + .WhereIF(!string.IsNullOrWhiteSpace(input.WebUrl), u => u.WebUrl.Contains(input.WebUrl.Trim())) + .WhereIF(!string.IsNullOrWhiteSpace(input.Province), u => u.Province.Contains(input.Province.Trim())) + .WhereIF(!string.IsNullOrWhiteSpace(input.City), u => u.City.Contains(input.City.Trim())) + .WhereIF(!string.IsNullOrWhiteSpace(input.Addr), u => u.Addr.Contains(input.Addr.Trim())) + .WhereIF(!string.IsNullOrWhiteSpace(input.FullNameEN), u => u.FullNameEN.Contains(input.FullNameEN.Trim())) + .WhereIF(!string.IsNullOrWhiteSpace(input.AddrEN), u => u.AddrEN.Contains(input.AddrEN.Trim())) + .WhereIF(!string.IsNullOrWhiteSpace(input.PropString), u => u.PropString.Contains(input.PropString.Trim())) + .WhereIF(!string.IsNullOrWhiteSpace(input.InvTitle), u => u.InvTitle.Contains(input.InvTitle.Trim())) + .WhereIF(!string.IsNullOrWhiteSpace(input.TaxNO), u => u.TaxNO.Contains(input.TaxNO.Trim())) + .WhereIF(!string.IsNullOrWhiteSpace(input.InvAddrTel), u => u.InvAddrTel.Contains(input.InvAddrTel.Trim())) + .WhereIF(!string.IsNullOrWhiteSpace(input.RMBBank), u => u.RMBBank.Contains(input.RMBBank.Trim())) + .WhereIF(!string.IsNullOrWhiteSpace(input.RmbAccount), u => u.RmbAccount.Contains(input.RmbAccount.Trim())) + .WhereIF(!string.IsNullOrWhiteSpace(input.USDBank), u => u.USDBank.Contains(input.USDBank.Trim())) + .WhereIF(!string.IsNullOrWhiteSpace(input.USDAccount), u => u.USDAccount.Contains(input.USDAccount.Trim())) + .ToPagedListAsync(input.PageNo, input.PageSize); return entities.XnPagedResult(); } @@ -73,13 +74,14 @@ namespace Myshipping.Core.Service /// /// [HttpPost("/DjyCustomer/add"), SqlSugarUnitOfWork] - public async Task Add(AddDjyCustomerInput input) + public async Task Add(AddDjyCustomerInput input) { var entity = input.Adapt(); await _rep.InsertAsync(entity); var contactList = input.Contacts.Adapt>(); contactList.ForEach(x => x.CustomerId = entity.Id); await _repContact.InsertAsync(contactList); + return entity.Id; } /// @@ -88,7 +90,7 @@ namespace Myshipping.Core.Service /// /// [HttpPost("/DjyCustomer/edit"), SqlSugarUnitOfWork] - public async Task Update(UpdateDjyCustomerInput input) + public async Task Update(UpdateDjyCustomerInput input) { var find = await _rep.FirstOrDefaultAsync(u => u.Id == input.Id); if (find == null) @@ -102,6 +104,7 @@ namespace Myshipping.Core.Service var contactList = input.Contacts.Adapt>(); contactList.ForEach(x => x.CustomerId = entity.Id); await _repContact.InsertAsync(contactList); + return entity.Id; } /// diff --git a/Myshipping.Core/Service/DjyCustomer/IDjyCustomerService.cs b/Myshipping.Core/Service/DjyCustomer/IDjyCustomerService.cs index cdd0d494..ed6fed09 100644 --- a/Myshipping.Core/Service/DjyCustomer/IDjyCustomerService.cs +++ b/Myshipping.Core/Service/DjyCustomer/IDjyCustomerService.cs @@ -9,8 +9,8 @@ namespace Myshipping.Core.Service public interface IDjyCustomerService { Task Page([FromQuery] QueryDjyCustomerInput input); - Task Add(AddDjyCustomerInput input); - Task Update(UpdateDjyCustomerInput input); + Task Add(AddDjyCustomerInput input); + Task Update(UpdateDjyCustomerInput input); Task Delete(GetDjyCustomerInput input); Task Detail([FromQuery] GetDjyCustomerInput input); //Task List([FromQuery] QueryBookingCustomerInput input); diff --git a/Myshipping.Core/Service/DjyUserConfig/DjyUserConfigService.cs b/Myshipping.Core/Service/DjyUserConfig/DjyUserConfigService.cs index 8e690c6f..672308a4 100644 --- a/Myshipping.Core/Service/DjyUserConfig/DjyUserConfigService.cs +++ b/Myshipping.Core/Service/DjyUserConfig/DjyUserConfigService.cs @@ -32,9 +32,10 @@ namespace Myshipping.Core.Service public async Task Page([FromQuery] QueryDjyUserConfigInput input) { var entities = await _rep.AsQueryable() - .WhereIF(!string.IsNullOrWhiteSpace(input.Type), u => u.Type == input.Type) - .WhereIF(!string.IsNullOrWhiteSpace(input.ConfigJson), u => u.ConfigJson == input.ConfigJson) - .ToPagedListAsync(input.PageNo, input.PageSize); + .Where(m => m.CreatedUserId == UserManager.UserId) + .WhereIF(!string.IsNullOrWhiteSpace(input.Type), u => u.Type == input.Type) + .WhereIF(!string.IsNullOrWhiteSpace(input.ConfigJson), u => u.ConfigJson == input.ConfigJson) + .ToPagedListAsync(input.PageNo, input.PageSize); return entities.XnPagedResult(); } diff --git a/Myshipping.Core/Service/DjyUserMailAccount/DjyUserMailAccountService.cs b/Myshipping.Core/Service/DjyUserMailAccount/DjyUserMailAccountService.cs index f02b57c3..394f2970 100644 --- a/Myshipping.Core/Service/DjyUserMailAccount/DjyUserMailAccountService.cs +++ b/Myshipping.Core/Service/DjyUserMailAccount/DjyUserMailAccountService.cs @@ -36,8 +36,9 @@ namespace Myshipping.Core.Service public async Task Page([FromQuery] QueryDjyUserMailAccountInput input) { var entities = await _rep.AsQueryable() - .WhereIF(!string.IsNullOrWhiteSpace(input.MailAccount), u => u.MailAccount.Contains(input.MailAccount.Trim())) - .ToPagedListAsync(input.PageNo, input.PageSize); + .Where(m => m.CreatedUserId == UserManager.UserId) + .WhereIF(!string.IsNullOrWhiteSpace(input.MailAccount), u => u.MailAccount.Contains(input.MailAccount.Trim())) + .ToPagedListAsync(input.PageNo, input.PageSize); return entities.XnPagedResult(); } diff --git a/Myshipping.Core/Service/DjyWebsiteAccountConfig/DjyWebsiteAccountConfigService.cs b/Myshipping.Core/Service/DjyWebsiteAccountConfig/DjyWebsiteAccountConfigService.cs index aab1f036..77c62cc4 100644 --- a/Myshipping.Core/Service/DjyWebsiteAccountConfig/DjyWebsiteAccountConfigService.cs +++ b/Myshipping.Core/Service/DjyWebsiteAccountConfig/DjyWebsiteAccountConfigService.cs @@ -36,9 +36,10 @@ namespace Myshipping.Core.Service public async Task Page([FromQuery] QueryDjyWebsiteAccountConfigInput input) { var entities = await _rep.AsQueryable() - .WhereIF(!string.IsNullOrWhiteSpace(input.TypeCode), u => u.TypeCode == input.TypeCode) - .WhereIF(!string.IsNullOrWhiteSpace(input.Account), u => u.Account.Contains(input.Account.Trim())) - .ToPagedListAsync(input.PageNo, input.PageSize); + .Where(m => m.CreatedUserId == UserManager.UserId) + .WhereIF(!string.IsNullOrWhiteSpace(input.TypeCode), u => u.TypeCode == input.TypeCode) + .WhereIF(!string.IsNullOrWhiteSpace(input.Account), u => u.Account.Contains(input.Account.Trim())) + .ToPagedListAsync(input.PageNo, input.PageSize); return entities.XnPagedResult(); } @@ -48,7 +49,7 @@ namespace Myshipping.Core.Service /// /// [HttpPost("/DjyWebsiteAccountConfig/add")] - public async Task Add(AddDjyWebsiteAccountConfigInput input) + public async Task Add(AddDjyWebsiteAccountConfigInput input) { var cc = _rep.Count(x => x.TypeCode == input.TypeCode && x.CreatedUserId == UserManager.UserId); if (cc > 0) @@ -58,6 +59,7 @@ namespace Myshipping.Core.Service var entity = input.Adapt(); await _rep.InsertAsync(entity); + return entity.Id; } /// @@ -66,7 +68,7 @@ namespace Myshipping.Core.Service /// /// [HttpPost("/DjyWebsiteAccountConfig/edit")] - public async Task Update(UpdateDjyWebsiteAccountConfigInput input) + public async Task Update(UpdateDjyWebsiteAccountConfigInput input) { var cc = _rep.Count(x => x.TypeCode == input.TypeCode && x.CreatedUserId == UserManager.UserId && x.Id != input.Id); if (cc > 0) @@ -76,6 +78,7 @@ namespace Myshipping.Core.Service var entity = input.Adapt(); await _rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync(); + return entity.Id; } /// diff --git a/Myshipping.Core/Service/DjyWebsiteAccountConfig/IDjyWebsiteAccountConfigService.cs b/Myshipping.Core/Service/DjyWebsiteAccountConfig/IDjyWebsiteAccountConfigService.cs index ad0b4cba..0c7d0fed 100644 --- a/Myshipping.Core/Service/DjyWebsiteAccountConfig/IDjyWebsiteAccountConfigService.cs +++ b/Myshipping.Core/Service/DjyWebsiteAccountConfig/IDjyWebsiteAccountConfigService.cs @@ -8,8 +8,8 @@ namespace Myshipping.Core.Service public interface IDjyWebsiteAccountConfigService { Task Page([FromQuery] QueryDjyWebsiteAccountConfigInput input); - Task Add(AddDjyWebsiteAccountConfigInput input); - Task Update(UpdateDjyWebsiteAccountConfigInput input); + Task Add(AddDjyWebsiteAccountConfigInput input); + Task Update(UpdateDjyWebsiteAccountConfigInput input); Task Delete(GetDjyWebsiteAccountConfigInput input); } } \ No newline at end of file