From 1f511d33262c2f06a425afc2651760a6777827d2 Mon Sep 17 00:00:00 2001
From: lingling <kety1122@163.com>
Date: 星期三, 19 三月 2025 17:34:49 +0800
Subject: [PATCH] Merge branch 'master' of http://120.26.58.240:8888/r/LifePaymentApi
---
LifePayment/LifePayment.Application.Contracts/User/IAccountService.cs | 2
LifePayment/LifePayment.Application.Contracts/User/QrCodeLogin.cs | 5 ++
LifePayment/LifePayment.Host/LifePaymentServices.Application.Contracts.xml | 17 ++++++++
LifePayment/LifePayment.Application/User/UserRoleService.cs | 30 ++++++++++++++
LifePayment/LifePayment.Application.Contracts/User/CreateBackClientUserInput.cs | 10 +++++
LifePayment/LifePayment.HttpApi/LifePay/UserRoleController.cs | 18 +++++++++
LifePayment/LifePayment.Application/User/AccountService.cs | 8 ++-
LifePayment/LifePayment.Host/LifePaymentService.HttpApi.xml | 7 +++
LifePayment/LifePayment.Application.Contracts/User/IUserRoleService.cs | 7 +++
9 files changed, 99 insertions(+), 5 deletions(-)
diff --git a/LifePayment/LifePayment.Application.Contracts/User/CreateBackClientUserInput.cs b/LifePayment/LifePayment.Application.Contracts/User/CreateBackClientUserInput.cs
index b880d90..89d0e22 100644
--- a/LifePayment/LifePayment.Application.Contracts/User/CreateBackClientUserInput.cs
+++ b/LifePayment/LifePayment.Application.Contracts/User/CreateBackClientUserInput.cs
@@ -80,6 +80,16 @@
public string Remark { get; set; }
}
+ /// <summary>
+ /// 閲嶇疆瀵嗙爜鍩虹杈撳叆鍙傛暟
+ /// </summary>
+ public class ResetPasswordBaseInput
+ {
+ public Guid UserId { get; set; }
+
+ public string? Password { get; set; }
+ }
+
public class UpdateBackClientUserInput : CreateBackClientUserInput
{
/// <summary>
diff --git a/LifePayment/LifePayment.Application.Contracts/User/IAccountService.cs b/LifePayment/LifePayment.Application.Contracts/User/IAccountService.cs
index 407c707..af013fc 100644
--- a/LifePayment/LifePayment.Application.Contracts/User/IAccountService.cs
+++ b/LifePayment/LifePayment.Application.Contracts/User/IAccountService.cs
@@ -23,7 +23,7 @@
Task<IdentityModelTokenCacheItem> GetTokenForWeb(AccessRequestDto accessRequestDto, string webClientIp);
- Task<Guid> CreateAccount(CreateAccountInput input, bool isSend = false, bool isAdminCreate = false, string password = null);
+ Task<Guid> CreateAccount(CreateAccountInput input, bool isSend = false, bool isAdminCreate = false);
#endregion
}
}
\ No newline at end of file
diff --git a/LifePayment/LifePayment.Application.Contracts/User/IUserRoleService.cs b/LifePayment/LifePayment.Application.Contracts/User/IUserRoleService.cs
index d6c047b..cf16ff0 100644
--- a/LifePayment/LifePayment.Application.Contracts/User/IUserRoleService.cs
+++ b/LifePayment/LifePayment.Application.Contracts/User/IUserRoleService.cs
@@ -11,6 +11,13 @@
Task<int> UpdateBackClientUser(UpdateBackClientUserInput input);
+ /// <summary>
+ /// 閲嶇疆瀵嗙爜
+ /// </summary>
+ /// <param name="input"></param>
+ /// <returns></returns>
+ Task ResetPassword(ResetPasswordBaseInput input);
+
Task<int> DeleteBackClientUser(Guid id);
Task<Guid> CreateRole(CreateOrUpdateRoleInput input);
diff --git a/LifePayment/LifePayment.Application.Contracts/User/QrCodeLogin.cs b/LifePayment/LifePayment.Application.Contracts/User/QrCodeLogin.cs
index 9e766f5..386b8ae 100644
--- a/LifePayment/LifePayment.Application.Contracts/User/QrCodeLogin.cs
+++ b/LifePayment/LifePayment.Application.Contracts/User/QrCodeLogin.cs
@@ -50,6 +50,11 @@
public string Name { get; set; }
/// <summary>
+ /// 瀵嗙爜
+ /// </summary>
+ public string Password { get; set; }
+
+ /// <summary>
/// 鐢ㄦ埛鍚�
/// </summary>
[RegularExpression(LifePaymentConstant.RegularExpression.UserNameEx, ErrorMessage = "璐﹀彿鏍煎紡涓嶆纭�")]
diff --git a/LifePayment/LifePayment.Application/User/AccountService.cs b/LifePayment/LifePayment.Application/User/AccountService.cs
index 0837679..2c46855 100644
--- a/LifePayment/LifePayment.Application/User/AccountService.cs
+++ b/LifePayment/LifePayment.Application/User/AccountService.cs
@@ -134,7 +134,7 @@
return result;
}
- public async Task<Guid> CreateAccount(CreateAccountInput input, bool isSend, bool isAdminCreate = false, string password = null)
+ public async Task<Guid> CreateAccount(CreateAccountInput input, bool isSend, bool isAdminCreate = false)
{
if (input.ClientId == LifePaymentConstant.ClientId.Back)
{
@@ -146,8 +146,10 @@
CheckExtensions.IfTrueThrowUserFriendlyException(any,
CustomeErrorMessage.PhoneNumberRepeatSaveFail);
- password ??= GlobalRandom.GetRandomPassword();
+ /// input.Password ??= GlobalRandom.GetRandomPassword();
+ CheckExtensions.IfTrueThrowUserFriendlyException(string.IsNullOrEmpty(input.Password),
+ "璇疯緭鍏ュ瘑鐮�");
var res = await _identityUserService.CreateAsync(new IdentityUserCreateDto
{
Name = input.Name,
@@ -155,7 +157,7 @@
UserName = input.UserName,
RoleNames = input.RoleNames,
ClientId = input.ClientId,
- Password = password,
+ Password = input.Password,
});
var user = await _userRepository.InsertAsync(new User
{
diff --git a/LifePayment/LifePayment.Application/User/UserRoleService.cs b/LifePayment/LifePayment.Application/User/UserRoleService.cs
index 3a0aad5..be79492 100644
--- a/LifePayment/LifePayment.Application/User/UserRoleService.cs
+++ b/LifePayment/LifePayment.Application/User/UserRoleService.cs
@@ -1,6 +1,7 @@
锘縰sing LifePayment.Application.Contracts;
using LifePayment.Domain;
using LifePayment.Domain.Models;
+using LifePayment.Domain.Shared;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
@@ -9,8 +10,10 @@
using Volo.Abp;
using Volo.Abp.Application.Services;
using Volo.Abp.Domain.Repositories;
+using Volo.Abp.Identity;
using Z.EntityFramework.Plus;
using ZeroD.Util;
+using static LifePayment.Domain.Shared.LifePaymentConstant;
namespace HumanResourcesServices.Application
{
@@ -21,19 +24,22 @@
private readonly IRepository<LifePayChannles, Guid> _channleRepository;
private readonly IRepository<UserRole, Guid> _userRoleRep;
private readonly IRepository<UserChannle, Guid> _userChannleRep;
+ private readonly IIdentityUserAppService _identityUserService;
public UserRoleService(
IRepository<User, Guid> userRepository,
IRepository<Role, Guid> roleRepository,
IRepository<LifePayChannles, Guid> channleRepository,
IRepository<UserRole, Guid> userRoleRep,
- IRepository<UserChannle, Guid> userChannleRep)
+ IRepository<UserChannle, Guid> userChannleRep,
+ IIdentityUserAppService identityUserService)
{
_userRepository = userRepository;
_roleRepository = roleRepository;
_channleRepository = channleRepository;
_userRoleRep = userRoleRep;
_userChannleRep = userChannleRep;
+ _identityUserService = identityUserService;
}
public async Task<PageOutput<UserDto>> GetBackClientUsers(GetBackClientUsersInput input)
@@ -110,6 +116,28 @@
return Constant.SUCCESS;
}
+ /// <summary>
+ /// 閲嶇疆瀵嗙爜
+ /// </summary>
+ /// <param name="input"></param>
+ /// <returns></returns>
+ public async Task ResetPassword(ResetPasswordBaseInput input)
+ {
+ var user = await _userRepository.FirstOrDefaultAsync(x => x.Id == input.UserId);
+ CheckExtensions.IfTrueThrowUserFriendlyException(user == null, CustomeErrorMessage.IsNoExistUser);
+ CheckExtensions.IfTrueThrowUserFriendlyException(string.IsNullOrEmpty(input.Password), "璇疯緭鍏ュ瘑鐮�");
+ var identiResetInput = new ResetPassWordInput
+ {
+ UserId = input.UserId,
+ Name = user.Name,
+ UserName = user.UserName,
+ Password = input.Password,
+ PhoneNumber = user.PhoneNumber
+ };
+ var result = await _identityUserService.ResetPassword(identiResetInput);
+ CheckExtensions.IfTrueThrowUserFriendlyException(result != Constant.SUCCESS,
+ CustomeErrorMessage.ResetPasswordFail);
+ }
public async Task<int> DeleteBackClientUser(Guid id)
{
var entity = await _userRepository.FirstOrDefaultAsync(s => s.Id == id && s.ClientId == Constant.ClientType.Back);
diff --git a/LifePayment/LifePayment.Host/LifePaymentService.HttpApi.xml b/LifePayment/LifePayment.Host/LifePaymentService.HttpApi.xml
index 676a9e4..d63ca45 100644
--- a/LifePayment/LifePayment.Host/LifePaymentService.HttpApi.xml
+++ b/LifePayment/LifePayment.Host/LifePaymentService.HttpApi.xml
@@ -350,6 +350,13 @@
<param name="input"></param>
<returns></returns>
</member>
+ <member name="M:LifePayment.HttpApi.UserRoleController.ResetUserPassword(LifePayment.Application.Contracts.ResetPasswordBaseInput)">
+ <summary>
+ 閲嶇疆瀵嗙爜
+ </summary>
+ <param name="input"></param>
+ <returns></returns>
+ </member>
<member name="M:LifePayment.HttpApi.UserRoleController.DeleteBackClientUser(System.Guid)">
<summary>
鍒犻櫎鍚庡彴绠$悊璐︽埛
diff --git a/LifePayment/LifePayment.Host/LifePaymentServices.Application.Contracts.xml b/LifePayment/LifePayment.Host/LifePaymentServices.Application.Contracts.xml
index b3ef1b8..0dad992 100644
--- a/LifePayment/LifePayment.Host/LifePaymentServices.Application.Contracts.xml
+++ b/LifePayment/LifePayment.Host/LifePaymentServices.Application.Contracts.xml
@@ -1526,6 +1526,11 @@
澶囨敞
</summary>
</member>
+ <member name="T:LifePayment.Application.Contracts.ResetPasswordBaseInput">
+ <summary>
+ 閲嶇疆瀵嗙爜鍩虹杈撳叆鍙傛暟
+ </summary>
+ </member>
<member name="P:LifePayment.Application.Contracts.UpdateBackClientUserInput.Id">
<summary>
鐢ㄦ埛Id
@@ -1675,6 +1680,13 @@
<returns></returns>
<exception cref="T:Volo.Abp.UserFriendlyException"></exception>
</member>
+ <member name="M:LifePayment.Application.Contracts.IUserRoleService.ResetPassword(LifePayment.Application.Contracts.ResetPasswordBaseInput)">
+ <summary>
+ 閲嶇疆瀵嗙爜
+ </summary>
+ <param name="input"></param>
+ <returns></returns>
+ </member>
<member name="P:LifePayment.Application.Contracts.LifePayPhoneMesssageCodeLoginInput.PhoneNumber">
<summary>
鎵嬫満鍙�
@@ -1705,6 +1717,11 @@
鍚嶇О
</summary>
</member>
+ <member name="P:LifePayment.Application.Contracts.CreateAccountInput.Password">
+ <summary>
+ 瀵嗙爜
+ </summary>
+ </member>
<member name="P:LifePayment.Application.Contracts.CreateAccountInput.UserName">
<summary>
鐢ㄦ埛鍚�
diff --git a/LifePayment/LifePayment.HttpApi/LifePay/UserRoleController.cs b/LifePayment/LifePayment.HttpApi/LifePay/UserRoleController.cs
index aec1d39..2add6da 100644
--- a/LifePayment/LifePayment.HttpApi/LifePay/UserRoleController.cs
+++ b/LifePayment/LifePayment.HttpApi/LifePay/UserRoleController.cs
@@ -62,6 +62,11 @@
[HttpPost]
public async Task<int> UpdateBackClientUser(UpdateBackClientUserInput input)
{
+
+ var identityUser = await _identityUserService.GetAsync(input.Id);
+
+ CheckExtensions.IfTrueThrowUserFriendlyException(identityUser == null,
+ "鐢ㄦ埛涓嶅瓨鍦�");
await _identityUserService.UpdateAsync(input.Id, new IdentityUserUpdateDto
{
Name = input.Name,
@@ -73,6 +78,19 @@
}
/// <summary>
+ /// 閲嶇疆瀵嗙爜
+ /// </summary>
+ /// <param name="input"></param>
+ /// <returns></returns>
+ [HttpPost]
+ public virtual async Task<int> ResetUserPassword(ResetPasswordBaseInput input)
+ {
+ await _userRoleService.ResetPassword(input);
+
+ return Constant.SUCCESS;
+ }
+
+ /// <summary>
/// 鍒犻櫎鍚庡彴绠$悊璐︽埛
/// </summary>
/// <param name="id">鐢ㄦ埛Id</param>
--
Gitblit v1.10.0