|
|
@ -14,6 +14,7 @@ using Volo.Abp.Application.Dtos; |
|
|
|
using Volo.Abp.Domain.Entities; |
|
|
|
using Volo.Abp.ObjectMapping; |
|
|
|
using Volo.Abp.Uow; |
|
|
|
using Volo.Abp.Users; |
|
|
|
using Win_in.Sfs.Basedata.Application.Contracts; |
|
|
|
using Win_in.Sfs.Basedata.Domain.Shared; |
|
|
|
using Win_in.Sfs.Shared.Domain; |
|
|
@ -37,18 +38,20 @@ public class ThirdLocationJobAppService |
|
|
|
private readonly ITransferLogAppService _transferLogAppService; |
|
|
|
private readonly ILocationAppService _locationAppService; |
|
|
|
private readonly IThirdLocationNoteAppService _thirdLocationNoteAppService; |
|
|
|
private readonly ICurrentUser _currentUser; |
|
|
|
|
|
|
|
protected IThirdLocationRequestAppService ThirdLocationRequestAppService => |
|
|
|
LazyServiceProvider.LazyGetRequiredService<IThirdLocationRequestAppService>(); |
|
|
|
|
|
|
|
public ThirdLocationJobAppService( |
|
|
|
IThirdLocationJobRepository repository, IThirdLocationJobManager thirdLocationJobManager, |
|
|
|
ITransferLogAppService transferLogAppService, ILocationAppService locationAppService, IThirdLocationNoteAppService thirdLocationNoteAppService) : base(repository, thirdLocationJobManager) |
|
|
|
ITransferLogAppService transferLogAppService, ILocationAppService locationAppService, IThirdLocationNoteAppService thirdLocationNoteAppService, ICurrentUser currentUser) : base(repository, thirdLocationJobManager) |
|
|
|
{ |
|
|
|
_thirdLocationJobManager = thirdLocationJobManager; |
|
|
|
_transferLogAppService = transferLogAppService; |
|
|
|
_locationAppService = locationAppService; |
|
|
|
_thirdLocationNoteAppService = thirdLocationNoteAppService; |
|
|
|
_currentUser = currentUser; |
|
|
|
} |
|
|
|
|
|
|
|
[HttpPost("")] |
|
|
@ -152,6 +155,34 @@ public class ThirdLocationJobAppService |
|
|
|
return ObjectMapper.Map<List<ThirdLocationJob>, List<ThirdLocationJobDTO>>(list); |
|
|
|
} |
|
|
|
|
|
|
|
[HttpPost("accept/{id}")] |
|
|
|
[UnitOfWork] |
|
|
|
public override async Task AcceptAsync(Guid id) |
|
|
|
{ |
|
|
|
var entity = await _repository.FindAsync(id).ConfigureAwait(false); |
|
|
|
entity.IsClaims = true; |
|
|
|
entity.ClaimsUserName = _currentUser.UserName; |
|
|
|
entity.ClaimsUserId = _currentUser.Id.ToString(); |
|
|
|
entity.AcceptTime = Clock.Now; |
|
|
|
await _repository.UpdateAsync(entity).ConfigureAwait(false); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 取消承接任务
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="id"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
[HttpPost("cancel-accept/{id}")] |
|
|
|
[UnitOfWork] |
|
|
|
public override async Task CancelAcceptAsync(Guid id) |
|
|
|
{ |
|
|
|
var entity = await _repository.FindAsync(id).ConfigureAwait(false); |
|
|
|
entity.IsClaims = false; |
|
|
|
entity.ClaimsUserName = string.Empty; |
|
|
|
entity.ClaimsUserId = string.Empty; |
|
|
|
entity.AcceptTime = DateTime.Now; |
|
|
|
await _repository.UpdateAsync(entity).ConfigureAwait(false); |
|
|
|
} |
|
|
|
#region 私有
|
|
|
|
|
|
|
|
private async Task UpdateJobStatusAsync(ThirdLocationJob thirdLocationJob) |
|
|
|