Browse Source

修改 导入 导出 bool类型处理

dev_pda
郑渤旭[Irelia] 2 years ago
parent
commit
be561171a6
  1. 21
      be/Hosts/Auth.Host/src/Win_in.Sfs.Auth.Application/Users/SfsUserAppService.cs
  2. 2
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Customers/Inputs/CustomerImportInput.cs
  3. 21
      be/Modules/Shared/src/Win_in.Sfs.Shared.Application/ExportAndImport/ClosedXmlExportImportService.cs

21
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;
}
/// <summary>
/// 修改密码
/// </summary>
/// <param name="userId"></param>
/// <param name="input"></param>
/// <returns></returns>
[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);
}
}

2
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Customers/Inputs/CustomerImportInput.cs

@ -35,12 +35,14 @@ public class CustomerImportInput : SfsBaseDataImportInputBase
/// 类型
/// </summary>
[Display(Name = "类型")]
[Required(ErrorMessage = "类型是必填项")]
public EnumCustomerType Type { get; set; }
/// <summary>
/// 状态
/// </summary>
[Display(Name = "状态")]
[Required(ErrorMessage = "状态是必填项")]
public bool IsActive { get; set; }
/// <summary>

21
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<string> { "是","否"};
var validOptions = $"\"{string.Join(",", options)}\"";
cdv.List(validOptions, true);
}
SetCellStyle(cell, 1, i + 1, true, property.GetCustomAttributes<RequiredAttribute>().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);

Loading…
Cancel
Save