|
@@ -32,7 +32,7 @@ public class IdentityAppService : IIdentityAppService, IScopeDependency
|
|
|
private readonly IRepository<Scheduling> _schedulingRepository;
|
|
|
private readonly IOrderDomainService _orderDomainService;
|
|
|
|
|
|
- public IdentityAppService(
|
|
|
+ public IdentityAppService(
|
|
|
IAccountRepository accountRepository,
|
|
|
IAccountDomainService accountDomainService,
|
|
|
IRepository<User> userRepository,
|
|
@@ -41,7 +41,7 @@ public class IdentityAppService : IIdentityAppService, IScopeDependency
|
|
|
ITypedCache<AudienceTicket> cacheAudience,
|
|
|
IMessageCodeDomainService messageCodeDomainService,
|
|
|
IRepository<Scheduling> schedulingRepository,
|
|
|
- IOrderDomainService orderDomainService)
|
|
|
+ IOrderDomainService orderDomainService)
|
|
|
{
|
|
|
_accountRepository = accountRepository;
|
|
|
_accountDomainService = accountDomainService;
|
|
@@ -52,7 +52,7 @@ public class IdentityAppService : IIdentityAppService, IScopeDependency
|
|
|
_messageCodeDomainService = messageCodeDomainService;
|
|
|
_schedulingRepository = schedulingRepository;
|
|
|
_orderDomainService = orderDomainService;
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
public async Task<string> LoginAsync(LoginDto dto, CancellationToken cancellationToken)
|
|
|
{
|
|
@@ -60,7 +60,7 @@ public class IdentityAppService : IIdentityAppService, IScopeDependency
|
|
|
d => d.UserName == dto.Username,
|
|
|
d => d.Includes(x => x.Roles));
|
|
|
if (account == null)
|
|
|
- throw UserFriendlyException.SameMessage("用户名或密码错误!");
|
|
|
+ throw new UserFriendlyException($"用户名或密码错误!{System.Text.Json.JsonSerializer.Serialize(dto)}", "用户名或密码错误!");
|
|
|
|
|
|
//校验验证码
|
|
|
await _messageCodeDomainService.CheckdCode(account.UserName, account.PhoneNo, dto.MsgCode, cancellationToken);
|
|
@@ -79,7 +79,7 @@ public class IdentityAppService : IIdentityAppService, IScopeDependency
|
|
|
if (account.LockoutEnabled && account.AccessFailedCount >= lockoutOptions.MaxFailedAccessAttempts)
|
|
|
account.LockoutEnd = DateTime.Now.Add(lockoutOptions.DefaultLockoutTimeSpan);
|
|
|
await _accountRepository.UpdateAsync(account, cancellationToken);
|
|
|
- throw UserFriendlyException.SameMessage("账号名或密码错误!");
|
|
|
+ throw new UserFriendlyException($"用户名或密码错误!{System.Text.Json.JsonSerializer.Serialize(dto)}", "用户名或密码错误!");
|
|
|
}
|
|
|
|
|
|
//限制系统类型账户频繁获取token的行为
|
|
@@ -134,15 +134,16 @@ public class IdentityAppService : IIdentityAppService, IScopeDependency
|
|
|
return token;
|
|
|
}
|
|
|
|
|
|
- public async Task AverageOrderScheduling(string id, CancellationToken cancellationToken) {
|
|
|
+ public async Task AverageOrderScheduling(string id, CancellationToken cancellationToken)
|
|
|
+ {
|
|
|
try
|
|
|
{
|
|
|
DateTime time = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd"));
|
|
|
|
|
|
- //&& x.AtWork!.Value != true
|
|
|
- //根据当前时间获取排班信息
|
|
|
- var scheduling = await _schedulingRepository.Queryable().Includes(x => x.SchedulingUser)
|
|
|
- .Where(x => x.SchedulingTime == time && x.WorkingTime <= DateTime.Now.TimeOfDay && x.OffDutyTime >= DateTime.Now.TimeOfDay && ( x.AtWork == true || x.AtWork == null) && x.SchedulingUser.UserId == id)
|
|
|
+ //&& x.AtWork!.Value != true
|
|
|
+ //根据当前时间获取排班信息
|
|
|
+ var scheduling = await _schedulingRepository.Queryable().Includes(x => x.SchedulingUser)
|
|
|
+ .Where(x => x.SchedulingTime == time && x.WorkingTime <= DateTime.Now.TimeOfDay && x.OffDutyTime >= DateTime.Now.TimeOfDay && (x.AtWork == true || x.AtWork == null) && x.SchedulingUser.UserId == id)
|
|
|
.OrderBy(x => x.SendOrderNum).FirstAsync(cancellationToken);
|
|
|
if (scheduling != null)
|
|
|
{
|
|
@@ -150,11 +151,11 @@ public class IdentityAppService : IIdentityAppService, IScopeDependency
|
|
|
await _schedulingRepository.UpdateAsync(scheduling, cancellationToken);
|
|
|
//执行登录平均派单
|
|
|
await _orderDomainService.LogAverageOrder(id, cancellationToken);
|
|
|
- }
|
|
|
+ }
|
|
|
}
|
|
|
- catch
|
|
|
+ catch
|
|
|
{
|
|
|
- // ignored
|
|
|
+ // ignored
|
|
|
}
|
|
|
}
|
|
|
}
|