Browse Source

优化签证流程状态设置逻辑及注释

- 更新 `GroupsController.cs` 中的注释,支持状态完成/未完成设置。
- 在 `VisaProcessRepository.cs` 中新增 `IsCompleted` 字段更新逻辑。
- 调整状态检查逻辑,避免重复设置相同状态。
- 优化更新条件,仅在状态变化时触发数据库更新。
- 修改多处注释,使其更贴合当前功能逻辑。
- 提高代码效率和可维护性,增强健壮性。
Lyyyi 1 day ago
parent
commit
d0899ed41b

+ 1 - 1
OASystem/OASystem.Api/Controllers/GroupsController.cs

@@ -28337,7 +28337,7 @@ ORDER BY
         }
 
         /// <summary>
-        /// 团组签证流程 - 设置状态为已完成
+        /// 团组签证流程 - 设置状态 完成/未完成
         /// </summary>
         /// <returns></returns>
         [HttpPost]

+ 5 - 4
OASystem/OASystem.Infrastructure/Repositories/Groups/VisaProcessRepository.cs

@@ -310,7 +310,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
             visaSteps.FirstOrDefault(x => x.Step == 4).TypedValue = invertedInfo.IssueVisaDt;
 
             var update = await _sqlSugar.Updateable(visaSteps)
-                .UpdateColumns(it => new { it.StoreVal, it.LastUpdateUserId,it.LastUpdateTime })
+                .UpdateColumns(it => new { it.IsCompleted, it.StoreVal, it.LastUpdateUserId, it.LastUpdateTime })
                 .ExecuteCommandAsync();
 
             if (update < 1) return new Result(400, "更新失败!");
@@ -331,7 +331,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
         }
 
         /// <summary>
-        /// 设置已完成的步骤
+        /// 设置状态步骤 完成/未完成
         /// </summary>
         /// <param name="id"></param>
         /// <param name="currUserId"></param>
@@ -346,7 +346,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
 
             if (stepInfo == null) return new Result(400, "步骤信息不存在,无法设置。");
 
-            if (stepInfo.IsCompleted) return new Result(400, "步骤信息已完成,无法重复设置。");
+            if (stepInfo.IsCompleted == isCompleted) return new Result(400, $"步骤信息已设置,无法重复设置。");
 
             var before = ManualClone(stepInfo);
             stepInfo.IsCompleted = isCompleted;
@@ -360,7 +360,8 @@ namespace OASystem.Infrastructure.Repositories.Groups
                     LastUpdateUserId = currUserId,
                     LastUpdateTime = DateTime.Now
                 })
-                .Where(s => s.Id == id && s.IsDel == 0 && !s.IsCompleted)
+                .Where(s => s.Id == id && s.IsDel == 0)
+                .Where(s => s.IsCompleted != isCompleted) // 只有状态变化时才更新
                 .ExecuteCommandAsync();
 
             if (update < 1) return new Result(400, "状态设置失败!");