File was renamed from FlexJobApi.Application/Tasks/Commands/TaskInfoCommandHandler.cs |
| | |
| | | using FlexJobApi.Core; |
| | | using Furion.DatabaseAccessor; |
| | | using Furion.DistributedIDGenerator; |
| | | using Furion.FriendlyException; |
| | | using Mapster; |
| | | using MediatR; |
| | | using Microsoft.EntityFrameworkCore; |
| | |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | |
| | | namespace FlexJobApi.Application |
| | | namespace FlexJobApi.FlexJobServer.Application |
| | | { |
| | | /// <summary> |
| | | /// 任务命令处理器 |
| | |
| | | public async Task<Guid> Handle(SaveTaskInfoCommand request, CancellationToken cancellationToken) |
| | | { |
| | | var logier = JwtUtils.GetCurrentLogier(); |
| | | if (logier.EnterpriseId == null) throw Oops.Oh(EnumErrorCodeType.s400, "当前登录用户必须为企业用户才可以创建任务"); |
| | | return await request.SaveData<TaskInfo, SaveTaskInfoCommand>( |
| | | q => |
| | | { |
| | |
| | | if (request.Id == null) |
| | | { |
| | | entity.EnterpriseId = logier.EnterpriseId.Value; |
| | | entity.Status = EnumTaskStatus.Wait; |
| | | entity.ReleaseStatus = EnumTaskReleaseStatus.InProcess; |
| | | entity.RecommendStatus = EnumTaskRecommendStatus.No; |
| | | BuildCode(entity).Wait(); |
| | | } |
| | | entity.Benefits = request.Benefits |