lihao 4 anos atrás
pai
commit
96c8b48a43

+ 5 - 0
gx_api/GxPress/Model/GxPress.Result/App/Flow/FlowResult.cs

@@ -97,5 +97,10 @@ namespace GxPress.Result.App.Flow
         /// </summary>
         /// <value></value>
         public int UserId { get; set; }
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <value></value>
+        public int TodoId { get; set; }
     }
 }

+ 3 - 4
gx_api/GxPress/Repository/GxPress.Repository.Implement/WorkFlow/FlowTodoRepository.cs

@@ -725,10 +725,9 @@ namespace GxPress.Repository.Implement.WorkFlow
         }
         public async Task UpdateCCIsDoneAsync(int userId, int todoId)
         {
-            var flowTodo = await _repository.GetAsync(todoId);
-            await UpdateReadAsync(userId, flowTodo.FlowId);
-            await UpdateFlowReadAsync(userId, flowTodo.FlowId);
-
+            var flowDto = await _flowRepository.GetAsync(todoId);
+            await UpdateReadAsync(userId, flowDto.Id);
+            await UpdateFlowReadAsync(userId, flowDto.Id);
         }
 
         public async Task DeleteCheckingByFlowIdAsync(int flowId)

+ 14 - 3
gx_api/GxPress/Service/GxPress.Service.Implement/Flow/FlowService.Get.cs

@@ -79,9 +79,16 @@ namespace GxPress.Service.Implement
 
         public async Task<FlowResult> GetFlowResult(int todoId, int userId = 0)
         {
-            var flowTodoModel = await _flowTodoRepository.GetAsync(todoId);
-            var flowId = flowTodoModel.FlowId;
+            //var flowTodoModel = await _flowTodoRepository.GetAsync(todoId);
+
+            var flowId = todoId;
             var flowDto = await GetAsync(flowId);
+            var flowToDos = new List<Entity.WorkFlow.FlowTodo>();
+            var query = Q.NewQuery();
+            query.Where(nameof(Entity.WorkFlow.FlowTodo.FlowId), flowId);
+            query.Where(nameof(Entity.WorkFlow.FlowTodo.IsOperate), true);
+            flowToDos.AddRange(await _flowTodoRepository.GetAllAsync(query));
+            var flowTodoModel = flowToDos.FirstOrDefault(n => n.UserId == userId);
             var user = await _userRepository.GetAsync(flowDto.UserId);
             var avatarUrl = await _userRepository.GetAvatarUrlAsync(flowDto.UserId);
             var process = await _processRepository.GetAsync(flowDto.ProcessId);
@@ -224,7 +231,11 @@ namespace GxPress.Service.Implement
                         flowResult.State = FlowState.Denied;
                     else
                     {
-                        flowResult.State = FlowState.Checking;
+                        if (flowToDos != null && flowToDos.Any(n => n.UserId == userId))
+                        {
+                            flowResult.State = FlowState.Checking;
+                            flowResult.TodoId = flowToDo.Id;
+                        }
                     }
                 }
                 else