|
|
|
@ -1,4 +1,5 @@ |
|
|
|
using System; |
|
|
|
using Microsoft.Extensions.Configuration; |
|
|
|
using System; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Linq; |
|
|
|
using System.Text; |
|
|
|
@ -24,16 +25,20 @@ namespace Shentun.Peis.Data |
|
|
|
{ |
|
|
|
protected ICurrentUser CurrentUser { get; } |
|
|
|
protected ICurrentTenant CurrentTenant { get; } |
|
|
|
|
|
|
|
private readonly IConfiguration _configuration; |
|
|
|
protected IClock Clock { get; } |
|
|
|
|
|
|
|
public CustomerAuditPropertySetter( |
|
|
|
ICurrentUser currentUser, |
|
|
|
ICurrentTenant currentTenant, |
|
|
|
IClock clock) |
|
|
|
IClock clock, |
|
|
|
IConfiguration configuration) |
|
|
|
{ |
|
|
|
CurrentUser = currentUser; |
|
|
|
CurrentTenant = currentTenant; |
|
|
|
Clock = clock; |
|
|
|
_configuration = configuration; |
|
|
|
} |
|
|
|
|
|
|
|
public void SetCreationProperties(object targetObject) |
|
|
|
@ -71,10 +76,12 @@ namespace Shentun.Peis.Data |
|
|
|
{ |
|
|
|
if (!CurrentUser.Id.HasValue) |
|
|
|
{ |
|
|
|
var defaultCreatorId = _configuration.GetValue<string>("AdminId"); |
|
|
|
|
|
|
|
#region 无登录操作
|
|
|
|
if (targetObject is IMayHaveCreator mayHaveCreatorObjectNoLogin) |
|
|
|
{ |
|
|
|
ObjectHelper.TrySetProperty(mayHaveCreatorObjectNoLogin, x => x.CreatorId, () => Guid.Parse("3a0c4180-107c-0c89-b25b-0bd34666dcec")); |
|
|
|
ObjectHelper.TrySetProperty(mayHaveCreatorObjectNoLogin, x => x.CreatorId, () => Guid.Parse(defaultCreatorId)); |
|
|
|
} |
|
|
|
#endregion
|
|
|
|
return; |
|
|
|
@ -135,9 +142,9 @@ namespace Shentun.Peis.Data |
|
|
|
{ |
|
|
|
//modificationAuditedObject.LastModifierId = null;
|
|
|
|
//return;
|
|
|
|
|
|
|
|
var defaultCreatorId = _configuration.GetValue<string>("AdminId"); |
|
|
|
#region 无登录操作
|
|
|
|
modificationAuditedObject.LastModifierId = Guid.Parse("3a0c4180-107c-0c89-b25b-0bd34666dcec"); |
|
|
|
modificationAuditedObject.LastModifierId = Guid.Parse(defaultCreatorId); |
|
|
|
return; |
|
|
|
#endregion
|
|
|
|
} |
|
|
|
|