diff --git a/IRaCIS.Core.API/Program.cs b/IRaCIS.Core.API/Program.cs
index e5046008f..57e58b427 100644
--- a/IRaCIS.Core.API/Program.cs
+++ b/IRaCIS.Core.API/Program.cs
@@ -37,7 +37,9 @@ namespace IRaCIS.Core.API
.AddJsonFile($"appsettings.{environment}.json", false, true);
})
.Build();
-
+
+ Log.Logger.Warning($"当前环境:{environment}");
+
NewId.SetProcessIdProvider(new CurrentProcessIdProvider());
@@ -50,7 +52,7 @@ namespace IRaCIS.Core.API
//缓存项目的状态 匿名化数据
await InitCache(host);
- //Log.Logger.Error("缓存项目状态完毕");
+
host.Run();
}
diff --git a/IRaCIS.Core.API/appsettings.Development.json b/IRaCIS.Core.API/appsettings.Development.json
index 8e0b4410d..36f518b8f 100644
--- a/IRaCIS.Core.API/appsettings.Development.json
+++ b/IRaCIS.Core.API/appsettings.Development.json
@@ -12,11 +12,11 @@
},
"BasicSystemConfig": {
- "OpenUserComplexPassword": true,
+ "OpenUserComplexPassword": false,
- "OpenSignDocumentBeforeWork": true,
+ "OpenSignDocumentBeforeWork": false,
- "OpenTrialRelationDelete": false
+ "OpenTrialRelationDelete": true
}
diff --git a/IRaCIS.Core.API/appsettings.Production.json b/IRaCIS.Core.API/appsettings.Production.json
index 475f23c63..f867db9a5 100644
--- a/IRaCIS.Core.API/appsettings.Production.json
+++ b/IRaCIS.Core.API/appsettings.Production.json
@@ -12,7 +12,7 @@
},
"BasicSystemConfig": {
- "OpenUserComplexPassword": false,
+ "OpenUserComplexPassword": true,
"OpenSignDocumentBeforeWork": true
}
diff --git a/IRaCIS.Core.Application/Service/Management/UserService.cs b/IRaCIS.Core.Application/Service/Management/UserService.cs
index e5330d0f0..9b9bea5be 100644
--- a/IRaCIS.Core.Application/Service/Management/UserService.cs
+++ b/IRaCIS.Core.Application/Service/Management/UserService.cs
@@ -41,26 +41,26 @@ namespace IRaCIS.Application.Services
- private async Task VerifyUserNameAsync(Guid userId, string userName)
+ private async Task VerifyUserNameAsync(Guid? userId, string userName)
{
- if (await _userRepository.AnyAsync(t => t.UserName == userName && t.Id != userId))
+ if (await _userRepository.WhereIf(userId!=null,t=>t.Id!=userId).AnyAsync(t => t.UserName == userName ))
{
throw new BusinessValidationFailedException("鐢ㄦ埛鍚嶅凡缁忓瓨鍦ㄣ");
}
}
- private async Task VerifyUserPhoneAsync(Guid userId, Guid userTypeId, string phone)
+ private async Task VerifyUserPhoneAsync(Guid? userId, Guid userTypeId, string phone)
{
- if (await _userRepository.AnyAsync(t => (t.Phone == phone && t.UserTypeId == userTypeId && t.Id != userId)))
+ if (await _userRepository.WhereIf(userId != null, t => t.Id != userId).AnyAsync(t => (t.Phone == phone && t.UserTypeId == userTypeId )))
{
throw new BusinessValidationFailedException("璇ョ敤鎴风被鍨嬩腑宸插瓨鍦ㄥ叿鏈夌浉鍚岀殑鐢佃瘽鐨勭敤鎴枫");
}
}
- private async Task VerifyUserEmailAsync(Guid userId, Guid userTypeId, string email)
+ private async Task VerifyUserEmailAsync(Guid? userId, Guid userTypeId, string email)
{
- if (await _userRepository.AnyAsync(t => (t.EMail == email && t.UserTypeId == userTypeId && t.Id != userId)))
+ if (await _userRepository.WhereIf(userId != null, t => t.Id != userId).AnyAsync(t => (t.EMail == email && t.UserTypeId == userTypeId)))
{
throw new BusinessValidationFailedException("璇ョ敤鎴风被鍨嬩腑宸插瓨鍦ㄥ叿鏈夌浉鍚岄偖绠辩殑鐢ㄦ埛銆");
}
@@ -78,8 +78,13 @@ namespace IRaCIS.Application.Services
throw new BusinessValidationFailedException("鏂板瘑鐮佷笌鏃у瘑鐮佺浉鍚屻");
}
+
var dbUser = (await _userRepository.FirstOrDefaultAsync(t => t.Id == userId)).IfNullThrowException();
+ if (oldPwd != null && dbUser.Password != oldPwd)
+ {
+ throw new BusinessValidationFailedException("鏃у瘑鐮侀獙璇佸け璐ャ");
+ }
if (dbUser.Password == newPwd)
{
@@ -87,10 +92,7 @@ namespace IRaCIS.Application.Services
}
- if (dbUser.Password != oldPwd)
- {
- throw new BusinessValidationFailedException("鏃у瘑鐮侀獙璇佸け璐ャ");
- }
+
//姝e垯 鑷冲皯8涓瓧绗︼紝鑷冲皯1涓ぇ鍐欏瓧姣嶏紝1涓皬鍐欏瓧姣嶏紝1涓暟瀛楀拰1涓壒娈婂瓧绗︼細
@@ -441,7 +443,7 @@ namespace IRaCIS.Application.Services
/// 鏍规嵁鐢ㄦ埛Id鑾峰彇鐢ㄦ埛璇︾粏淇℃伅[New]
///
///
- ///
+ /// xiuga
[HttpGet("{id:guid}")]
public async Task GetUser(Guid id)
{
@@ -457,10 +459,13 @@ namespace IRaCIS.Application.Services
[UnitOfWork]
public async Task> AddUser(UserCommand userAddModel)
{
- if (await _userRepository.AnyAsync(t => t.UserName == userAddModel.UserName || (t.EMail == userAddModel.EMail && t.UserTypeId == userAddModel.UserTypeId)))
- {
- return ResponseOutput.NotOk(" 璇ョ敤鎴风被鍨嬩腑宸插瓨鍦ㄥ叿鏈夌浉鍚岀敤鎴峰悕鎴栬呴偖绠辩殑鐢ㄦ埛銆", new UserAddedReturnDTO());
- }
+
+
+ await VerifyUserNameAsync(null, userAddModel.UserName);
+
+ await VerifyUserEmailAsync(null, userAddModel.UserTypeId, userAddModel.EMail);
+
+ await VerifyUserPhoneAsync(null, userAddModel.UserTypeId, userAddModel.Phone);
var saveItem = _mapper.Map(userAddModel);
@@ -500,6 +505,7 @@ namespace IRaCIS.Application.Services
await VerifyUserEmailAsync(model.Id, model.UserTypeId, model.EMail);
+ await VerifyUserPhoneAsync(model.Id, model.UserTypeId, model.Phone);
var user = await _userRepository.FirstOrDefaultAsync(t => t.Id == model.Id);