diff --git a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/EntityDtoBase.cs b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/EntityDtoBase.cs index 2f99370f4..84ca68f58 100644 --- a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/EntityDtoBase.cs +++ b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/EntityDtoBase.cs @@ -11,8 +11,7 @@ public class EntityDtoBase : IEntityDto, ICanTrace, IHasErrorMessage [DataMember] public Guid Id { get; set; } - [DataMember] - public DateTime CreationTime { get; set; } + [DataMember] public DateTime CreationTime { get; set; } [DataMember] public Guid? CreatorId { get; set; } diff --git a/be/Hosts/Auth.Host/src/Win_in.Sfs.Auth.Application/UserMenus/UserMenuAppService.cs b/be/Hosts/Auth.Host/src/Win_in.Sfs.Auth.Application/UserMenus/UserMenuAppService.cs index 2a5626e6b..7f955d101 100644 --- a/be/Hosts/Auth.Host/src/Win_in.Sfs.Auth.Application/UserMenus/UserMenuAppService.cs +++ b/be/Hosts/Auth.Host/src/Win_in.Sfs.Auth.Application/UserMenus/UserMenuAppService.cs @@ -2,17 +2,22 @@ using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; +using DocumentFormat.OpenXml.Office2010.Excel; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; +using Volo.Abp.Application.Dtos; using Volo.Abp.Identity; +using Volo.Abp.ObjectMapping; using Volo.Abp.PermissionManagement; +using Volo.Abp.Uow; +using Volo.Abp.Users; using Win_in.Sfs.Auth.Application.Contracts; using Win_in.Sfs.Auth.Domain; using Win_in.Sfs.Shared.Domain.Shared; namespace Win_in.Sfs.Auth.Application; -[Authorize] +[AllowAnonymous] [Route($"{AuthConsts.RootPath}user-menu")] public class UserMenuAppService : SfsAuthCrudAppServiceBase, @@ -25,12 +30,12 @@ public class UserMenuAppService : private readonly IMenuRepository _menuRepository; private readonly IPermissionAppService _permissionAppService; private readonly IIdentityUserAppService _identityUserAppService; - + private readonly IIdentityUserRepository _identityUserRepository; public UserMenuAppService( IUserMenuRepository repository, IMenuRepository menuRepository , IPermissionAppService permissionAppService , IIdentityUserAppService identityUserAppService - ) : base(repository) + , IIdentityUserRepository identityUserRepository) : base(repository) { base.CreatePolicyName = UserMenuPermissions.Create; base.UpdatePolicyName = UserMenuPermissions.Update; @@ -38,6 +43,7 @@ public class UserMenuAppService : _menuRepository = menuRepository; _permissionAppService = permissionAppService; _identityUserAppService = identityUserAppService; + _identityUserRepository = identityUserRepository; } /// @@ -46,6 +52,8 @@ public class UserMenuAppService : /// /// [HttpGet("pda-menu/{userId}")] + [AllowAnonymous] + [UnitOfWork] public virtual async Task> GetPdaMenusOfUserAsync(Guid? userId) { var userMenus = await _repository @@ -64,6 +72,8 @@ public class UserMenuAppService : /// /// [HttpGet("web-menu/{userId}")] + [AllowAnonymous] + [UnitOfWork] public virtual async Task> GetWebMenusOfUserAsync(Guid? userId) { var permissions = await GetPermissionsAsync(userId.Value).ConfigureAwait(false); @@ -86,11 +96,17 @@ public class UserMenuAppService : return result; } + [AllowAnonymous] + [UnitOfWork] + [NonAction] private async Task> GetPermissionsAsync(Guid userId) { - var roles = await _identityUserAppService.GetRolesAsync(userId).ConfigureAwait(false); + //var roles = await _identityUserAppService.GetRolesAsync(userId).ConfigureAwait(false); + var roles = await _identityUserRepository.GetRolesAsync(userId); + var rolesDto=ObjectMapper.Map, List>(roles); + var permissionNames = new List(); - foreach (var role in roles.Items) + foreach (var role in rolesDto) { var result = await _permissionAppService.GetAsync("R", role.Name).ConfigureAwait(false); permissionNames.AddRange(from permissionGroup in result.Groups diff --git a/be/Hosts/Auth.Host/src/Win_in.Sfs.Auth.Web/Properties/PublishProfiles/FolderProfile1.pubxml b/be/Hosts/Auth.Host/src/Win_in.Sfs.Auth.Web/Properties/PublishProfiles/FolderProfile1.pubxml new file mode 100644 index 000000000..36847ea03 --- /dev/null +++ b/be/Hosts/Auth.Host/src/Win_in.Sfs.Auth.Web/Properties/PublishProfiles/FolderProfile1.pubxml @@ -0,0 +1,17 @@ + + + + + false + false + true + Release + Any CPU + FileSystem + bin\Release\net6.0\publish\ + FileSystem + <_TargetId>Folder + + \ No newline at end of file diff --git a/be/Hosts/Basedata.Host/Win_in.Sfs.Basedata.HttpApi.Host/Win_in.Sfs.Basedata.HttpApi.Host.csproj b/be/Hosts/Basedata.Host/Win_in.Sfs.Basedata.HttpApi.Host/Win_in.Sfs.Basedata.HttpApi.Host.csproj index abafefdaf..89fb1704a 100644 --- a/be/Hosts/Basedata.Host/Win_in.Sfs.Basedata.HttpApi.Host/Win_in.Sfs.Basedata.HttpApi.Host.csproj +++ b/be/Hosts/Basedata.Host/Win_in.Sfs.Basedata.HttpApi.Host/Win_in.Sfs.Basedata.HttpApi.Host.csproj @@ -43,8 +43,8 @@ - + diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Customers/CustomerAutoMapperProfile.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Customers/CustomerAutoMapperProfile.cs index cedf54ded..5abc9cafb 100644 --- a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Customers/CustomerAutoMapperProfile.cs +++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Customers/CustomerAutoMapperProfile.cs @@ -10,7 +10,6 @@ public partial class BasedataApplicationAutoMapperProfile : Profile private void CustomerAutoMapperProfile() { CreateMap() - .IgnoreAuditedObjectProperties() .ReverseMap(); CreateMap() diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain.Shared/Enum/EnumCustomerType.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain.Shared/Enum/EnumCustomerType.cs index aef5892d2..dcaafdc14 100644 --- a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain.Shared/Enum/EnumCustomerType.cs +++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain.Shared/Enum/EnumCustomerType.cs @@ -10,4 +10,7 @@ public enum EnumCustomerType [Display(Name = "空")] None = 0, + + [Display(Name = "普通用户")] + Normal = 1, } diff --git a/be/Modules/Shared/src/Win_in.Sfs.Shared.Application/ExportAndImport/ClosedXmlExportImportService.cs b/be/Modules/Shared/src/Win_in.Sfs.Shared.Application/ExportAndImport/ClosedXmlExportImportService.cs index eb7c734a9..16201a6ed 100644 --- a/be/Modules/Shared/src/Win_in.Sfs.Shared.Application/ExportAndImport/ClosedXmlExportImportService.cs +++ b/be/Modules/Shared/src/Win_in.Sfs.Shared.Application/ExportAndImport/ClosedXmlExportImportService.cs @@ -8,6 +8,8 @@ using System.Linq.Dynamic.Core; using System.Reflection; using AutoMapper.Internal; using ClosedXML.Excel; +using ClosedXML.Graphics; +using Irony; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using Win_in.Sfs.Shared.Application.Contracts; @@ -22,12 +24,18 @@ public class ClosedXmlExportImportService : IExportImportService public FileContentResult Export(List list, bool includeAuditedProperties = false, string detailsProptyName = null) { + using (var fallbackFontStream = Assembly.GetExecutingAssembly().GetManifestResourceStream($"{Assembly.GetExecutingAssembly().FullName}.Resources.calibril.ttf")) + { + LoadOptions.DefaultGraphicEngine = DefaultGraphicEngine.CreateWithFontsAndSystemFonts(fallbackFontStream); + } + try { using var workbook = new XLWorkbook(); var name = typeof(TModel).GetCustomAttribute()?.Name ?? typeof(TModel).Name; var fileName = $"{name}_导出.xlsx"; var ws = workbook.Worksheets.Add(name); + ws.Style.Font.FontName = "宋体"; // var ignoreProperties = $"Id,TenantId,ExtraProperties,ConcurrencyStamp"; var defaultPropertyNames = new Dictionary() { @@ -269,6 +277,8 @@ public class ClosedXmlExportImportService : IExportImportService cell.Style.Font.FontColor = fontColor ?? (isRequired ? XLColor.Red : XLColor.Black); // font weight cell.Style.Font.Bold = isHeader; + cell.Style.Font.FontName = "calibril"; + //cell.Style.Font.FontName = // background color cell.Style.Fill.BackgroundColor = rowIndex % 2 == 0 ? XLColor.LightGray : XLColor.White; cell.Style.Fill.BackgroundColor = columnIndex % 2 == 0 ? XLColor.White : XLColor.White; diff --git a/be/Modules/Shared/src/Win_in.Sfs.Shared.Application/Properties/Resources.Designer.cs b/be/Modules/Shared/src/Win_in.Sfs.Shared.Application/Properties/Resources.Designer.cs new file mode 100644 index 000000000..1b9d2a437 --- /dev/null +++ b/be/Modules/Shared/src/Win_in.Sfs.Shared.Application/Properties/Resources.Designer.cs @@ -0,0 +1,73 @@ +//------------------------------------------------------------------------------ +// +// 此代码由工具生成。 +// 运行时版本:4.0.30319.42000 +// +// 对此文件的更改可能会导致不正确的行为,并且如果 +// 重新生成代码,这些更改将会丢失。 +// +//------------------------------------------------------------------------------ + +namespace Win_in.Sfs.Shared.Application.Properties { + using System; + + + /// + /// 一个强类型的资源类,用于查找本地化的字符串等。 + /// + // 此类是由 StronglyTypedResourceBuilder + // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 + // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen + // (以 /str 作为命令选项),或重新生成 VS 项目。 + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// 返回此类使用的缓存的 ResourceManager 实例。 + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Win_in.Sfs.Shared.Application.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// 重写当前线程的 CurrentUICulture 属性,对 + /// 使用此强类型资源类的所有资源查找执行重写。 + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// 查找 System.Byte[] 类型的本地化资源。 + /// + internal static byte[] calibril { + get { + object obj = ResourceManager.GetObject("calibril", resourceCulture); + return ((byte[])(obj)); + } + } + } +} diff --git a/be/Modules/Shared/src/Win_in.Sfs.Shared.Application/Properties/Resources.resx b/be/Modules/Shared/src/Win_in.Sfs.Shared.Application/Properties/Resources.resx new file mode 100644 index 000000000..831ac1a71 --- /dev/null +++ b/be/Modules/Shared/src/Win_in.Sfs.Shared.Application/Properties/Resources.resx @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + ..\Resources\calibril.ttf;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/be/Modules/Shared/src/Win_in.Sfs.Shared.Application/Resources/calibril.ttf b/be/Modules/Shared/src/Win_in.Sfs.Shared.Application/Resources/calibril.ttf new file mode 100644 index 000000000..9aaf94c7f Binary files /dev/null and b/be/Modules/Shared/src/Win_in.Sfs.Shared.Application/Resources/calibril.ttf differ diff --git a/be/Modules/Shared/src/Win_in.Sfs.Shared.Application/Win_in.Sfs.Shared.Application.csproj b/be/Modules/Shared/src/Win_in.Sfs.Shared.Application/Win_in.Sfs.Shared.Application.csproj index 025c6e659..e42d0c1a5 100644 --- a/be/Modules/Shared/src/Win_in.Sfs.Shared.Application/Win_in.Sfs.Shared.Application.csproj +++ b/be/Modules/Shared/src/Win_in.Sfs.Shared.Application/Win_in.Sfs.Shared.Application.csproj @@ -16,6 +16,16 @@ 1701;1702;1591 + + + + + + + PreserveNewest + + + @@ -32,4 +42,19 @@ + + + True + True + Resources.resx + + + + + + ResXFileCodeGenerator + Resources.Designer.cs + + + diff --git a/be/Modules/Shared/src/Win_in.Sfs.Shared.Host/Properties/Resources.Designer.cs b/be/Modules/Shared/src/Win_in.Sfs.Shared.Host/Properties/Resources.Designer.cs new file mode 100644 index 000000000..e07382bde --- /dev/null +++ b/be/Modules/Shared/src/Win_in.Sfs.Shared.Host/Properties/Resources.Designer.cs @@ -0,0 +1,73 @@ +//------------------------------------------------------------------------------ +// +// 此代码由工具生成。 +// 运行时版本:4.0.30319.42000 +// +// 对此文件的更改可能会导致不正确的行为,并且如果 +// 重新生成代码,这些更改将会丢失。 +// +//------------------------------------------------------------------------------ + +namespace Win_in.Sfs.Shared.Host.Properties { + using System; + + + /// + /// 一个强类型的资源类,用于查找本地化的字符串等。 + /// + // 此类是由 StronglyTypedResourceBuilder + // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 + // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen + // (以 /str 作为命令选项),或重新生成 VS 项目。 + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + public class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// 返回此类使用的缓存的 ResourceManager 实例。 + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + public static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Win_in.Sfs.Shared.Host.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// 重写当前线程的 CurrentUICulture 属性,对 + /// 使用此强类型资源类的所有资源查找执行重写。 + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + public static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// 查找 System.Byte[] 类型的本地化资源。 + /// + public static byte[] calibril { + get { + object obj = ResourceManager.GetObject("calibril", resourceCulture); + return ((byte[])(obj)); + } + } + } +} diff --git a/be/Modules/Shared/src/Win_in.Sfs.Shared.Host/Properties/Resources.resx b/be/Modules/Shared/src/Win_in.Sfs.Shared.Host/Properties/Resources.resx new file mode 100644 index 000000000..831ac1a71 --- /dev/null +++ b/be/Modules/Shared/src/Win_in.Sfs.Shared.Host/Properties/Resources.resx @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + ..\Resources\calibril.ttf;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/be/Modules/Shared/src/Win_in.Sfs.Shared.Host/Resources/calibril.ttf b/be/Modules/Shared/src/Win_in.Sfs.Shared.Host/Resources/calibril.ttf new file mode 100644 index 000000000..9aaf94c7f Binary files /dev/null and b/be/Modules/Shared/src/Win_in.Sfs.Shared.Host/Resources/calibril.ttf differ diff --git a/be/Modules/Shared/src/Win_in.Sfs.Shared.Host/calibril.ttf b/be/Modules/Shared/src/Win_in.Sfs.Shared.Host/calibril.ttf new file mode 100644 index 000000000..9aaf94c7f Binary files /dev/null and b/be/Modules/Shared/src/Win_in.Sfs.Shared.Host/calibril.ttf differ