/// <summary> /// 处理记录 /// </summary> /// <param name="taskId"></param> /// <returns></returns> public GetQualityProblemOutput GetByTaskHistory(int taskId) { var authInfo = _authInfoProvider.GetCurrent(); var userId = authInfo?.User?.Id; var task = _historyProvider.GetTaskHistory(taskId); if (!task.AssigneeList.Contains($"{userId}")) { throw new AppCoreException($"id:为{userId.Value}的用户不是任务【{task.NodeName}】的委托人"); } var problem = _problemRepository.Get() .Include(u => u.Rectifications) .ThenInclude(u => u.RectificationPhotoSets).ThenInclude(w => w.FileMeta) .Include(u => u.Project) .Include(u => u.Category) .Include(u => u.ProblemPhotoSets).ThenInclude(w => w.FileMeta) .Include(u => u.CompletionPhotoSets).ThenInclude(w => w.FileMeta).Where(u => u.ProcessInstanceId == task.ProcessInstanceId).FirstOrDefault(); if (problem == null) { throw new EntityException("ProjectInstanceId", task.ProcessInstanceId, "QualityProblem", "不存在"); } var processDefinition = _definitionProvder.Get(task.ProcessDefinitionId); var invisibleFields = ((UserTaskNode)processDefinition.GetNode(task.NodeUid)).GetInvisibleFields(); if (invisibleFields != null) { TypeDefaulter.SetDefault(problem, invisibleFields.ToArray()); } return(problem.MapTo <GetQualityProblemOutput>()); }
/// <summary> /// 处理记录 /// </summary> /// <param name="taskId"></param> /// <returns></returns> public GetContractPaymentOutput GetByTaskHistory(int taskId) { var authInfo = _authInfoProvider.GetCurrent(); var userId = authInfo?.User?.Id; var task = _historyProvider.GetTaskHistory(taskId); if (!task.AssigneeList.Contains($"{userId}")) { throw new AppCoreException($"id:为{userId.Value}的用户不是任务【{task.NodeName}】的委托人"); } var accident = _contractPaymentRepository.Get() .Include(u => u.Contract).Where(u => u.ProcessInstanceId == task.ProcessInstanceId).FirstOrDefault(); if (accident == null) { throw new EntityException("ProjectInstanceId", task.ProcessInstanceId, "ContractPayment", "不存在"); } var processDefinition = _definitionProvder.Get(task.ProcessDefinitionId); var invisibleFields = ((UserTaskNode)processDefinition.GetNode(task.NodeUid)).GetInvisibleFields(); if (invisibleFields != null) { TypeDefaulter.SetDefault(accident, invisibleFields.ToArray()); } return(accident.MapTo <GetContractPaymentOutput>()); }
/// <summary> /// 发起记录 /// </summary> /// <param name="taskId"></param> /// <returns></returns> public GetEarlyStageOutput GetByTask(int taskId) { var authInfo = _authInfoProvider.GetCurrent(); var userId = authInfo?.User?.Id; var task = _taskProvider.GetTask(taskId); if (task.Assignee != userId.Value.ToString()) { throw new AppCoreException($"id:为{userId.Value}的用户不是任务【{task.NodeName}】的委托人"); } var problem = _earlyStageRepository.Get() .Include(u => u.Project) .Include(u => u.Node) .Include(u => u.Attachments).ThenInclude(w => w.FileMeta).Where(u => u.ProcessInstanceId == task.ProcessInstanceId).FirstOrDefault(); if (problem == null) { throw new EntityException("ProjectInstanceId", task.ProcessInstanceId, "EarlyStage", "不存在"); } var processDefinition = _definitionProvder.Get(task.ProcessDefinitionId); var invisibleFields = ((UserTaskNode)processDefinition.GetNode(task.NodeUid)).GetInvisibleFields(); if (invisibleFields != null) { TypeDefaulter.SetDefault(problem, invisibleFields.ToArray()); } return(problem.MapTo <GetEarlyStageOutput>()); }
/// <summary> /// 发起记录 /// </summary> /// <param name="taskId"></param> /// <returns></returns> public GetSafetyAccidentOutput GetByTask(int taskId) { var authInfo = _authInfoProvider.GetCurrent(); var userId = authInfo?.User?.Id; var task = _taskProvider.GetTask(taskId); if (task.Assignee != userId.Value.ToString()) { throw new AppCoreException($"id:为{userId.Value}的用户不是任务【{task.NodeName}】的委托人"); } var accident = _accidentRepository.Get() .Include(u => u.Disposals) .ThenInclude(u => u.DisposalPhotoSets).ThenInclude(w => w.FileMeta) .Include(u => u.Project) .Include(u => u.Source) .Include(u => u.Category) .Include(u => u.Severity) .Include(u => u.AccidentPhotoSets).ThenInclude(w => w.FileMeta) .Include(u => u.SettlementPhotoSets).ThenInclude(w => w.FileMeta).Where(u => u.ProcessInstanceId == task.ProcessInstanceId).FirstOrDefault(); if (accident == null) { throw new EntityException("ProjectInstanceId", task.ProcessInstanceId, "SafetyAccident", "不存在"); } var processDefinition = _definitionProvder.Get(task.ProcessDefinitionId); var invisibleFields = ((UserTaskNode)processDefinition.GetNode(task.NodeUid)).GetInvisibleFields(); if (invisibleFields != null) { TypeDefaulter.SetDefault(accident, invisibleFields.ToArray()); } return(accident.MapTo <GetSafetyAccidentOutput>()); }