From be561171a6108e52407b2e53f0f3bb0965367592 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91=E6=B8=A4=E6=97=AD=5BIrelia=5D?= <366601522@qq.com> Date: Thu, 30 Mar 2023 01:05:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20=E5=AF=BC=E5=85=A5=20?= =?UTF-8?q?=E5=AF=BC=E5=87=BA=20bool=E7=B1=BB=E5=9E=8B=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Users/SfsUserAppService.cs | 21 +++++++++++++++++-- .../Customers/Inputs/CustomerImportInput.cs | 2 ++ .../ClosedXmlExportImportService.cs | 21 +++++++++++++++++++ 3 files changed, 42 insertions(+), 2 deletions(-) diff --git a/be/Hosts/Auth.Host/src/Win_in.Sfs.Auth.Application/Users/SfsUserAppService.cs b/be/Hosts/Auth.Host/src/Win_in.Sfs.Auth.Application/Users/SfsUserAppService.cs index a8d77d7b8..f70a89f2c 100644 --- a/be/Hosts/Auth.Host/src/Win_in.Sfs.Auth.Application/Users/SfsUserAppService.cs +++ b/be/Hosts/Auth.Host/src/Win_in.Sfs.Auth.Application/Users/SfsUserAppService.cs @@ -3,6 +3,7 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Volo.Abp; +using Volo.Abp.Account; using Volo.Abp.Application.Services; using Volo.Abp.Identity; using Win_in.Sfs.Auth.Domain; @@ -15,13 +16,15 @@ namespace Win_in.Sfs.Auth.Users; public class SfsUserAppService : ApplicationService, ISfsUserAppService { private readonly IIdentityUserRepository _userRepository; + private readonly IProfileAppService _profileAppService; protected readonly IdentityUserManager _userManager; public SfsUserAppService( IIdentityUserRepository userRepository, - IdentityUserManager userManager - ) + IdentityUserManager userManager, + IProfileAppService profileAppService) { _userManager = userManager; + _profileAppService = profileAppService; _userRepository = userRepository; } @@ -77,4 +80,18 @@ public class SfsUserAppService : ApplicationService, ISfsUserAppService return userresult; } + + /// + /// 修改密码 + /// + /// + /// + /// + [HttpPost("change-password/{userId}")] + public virtual async Task ChangePasswordAsync(Guid userId,ChangePasswordInput input) + { + var user=await _userManager.GetByIdAsync(userId); + var ttt = user.PasswordHash; + var t=await _userManager.ResetPasswordAsync(user, input.CurrentPassword, input.NewPassword); + } } diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Customers/Inputs/CustomerImportInput.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Customers/Inputs/CustomerImportInput.cs index efcb517ef..bcd1b951a 100644 --- a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Customers/Inputs/CustomerImportInput.cs +++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Customers/Inputs/CustomerImportInput.cs @@ -35,12 +35,14 @@ public class CustomerImportInput : SfsBaseDataImportInputBase /// 类型 /// [Display(Name = "类型")] + [Required(ErrorMessage = "类型是必填项")] public EnumCustomerType Type { get; set; } /// /// 状态 /// [Display(Name = "状态")] + [Required(ErrorMessage = "状态是必填项")] public bool IsActive { get; set; } /// 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 16201a6ed..2a5e93880 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 @@ -9,6 +9,7 @@ using System.Reflection; using AutoMapper.Internal; using ClosedXML.Excel; using ClosedXML.Graphics; +using DocumentFormat.OpenXml; using Irony; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; @@ -98,6 +99,15 @@ public class ClosedXmlExportImportService : IExportImportService var validOptions = $"\"{string.Join(",", options)}\""; cdv.List(validOptions, true); } + + if (propertyType.Name == typeof(bool).Name) + { + var cdv = ws.Column(i + 1).CreateDataValidation(); + var options = new List { "是","否"}; + var validOptions = $"\"{string.Join(",", options)}\""; + cdv.List(validOptions, true); + } + SetCellStyle(cell, 1, i + 1, true, property.GetCustomAttributes().Any()); } // @@ -151,6 +161,17 @@ public class ClosedXmlExportImportService : IExportImportService .FirstOrDefault(); property.SetValue(model, enumValue); } + else if(propertyType.Name== typeof(bool).Name) + { + if (value.GetText() == "是") + { + property.SetValue(model, true); + } + else + { + property.SetValue(model, false); + } + } else { var propertyValue = Convert.ChangeType(value.ToString(), propertyType);