Browse Source

Merge branch 'feature/snapshot' into test

qinchaoyue 1 week ago
parent
commit
9a3013f298
1 changed files with 14 additions and 8 deletions
  1. 14 8
      src/Hotline.Application/Snapshot/SnapshotOrderApplication.cs

+ 14 - 8
src/Hotline.Application/Snapshot/SnapshotOrderApplication.cs

@@ -693,18 +693,24 @@ public class SnapshotOrderApplication : IOrderSnapshotApplication, IScopeDepende
     {
         if (_systemSettingCacheManager.Snapshot == false) return;
 
-        var sspSourceChannel = new List<string>() { "ZGSSP", "SJP12345"};
+        var sspSourceChannel = new List<string>() { "ZGSSP", "SJP12345" };
         if (sspSourceChannel.Any(m => m == dto.SourceChannelCode) == false)
         {
-            await _orderSnapshotRepository.Removeable()
+            await _orderSnapshotRepository.Updateable()
+                .SetColumns(m => m.IsDeleted, true)
                 .Where(m => m.Id == dto.Id)
                 .ExecuteCommandAsync(token);
-            return;
         }
-        await _orderSnapshotRepository.Updateable()
-            .SetColumns(m => m.IndustryId, dto.IndustryId)
-            .SetColumns(m => m.IndustryName, dto.IndustryName)
-            .Where(m => m.Id == dto.Id)
-            .ExecuteCommandAsync(token);
+        else
+        {
+            var snapshot = await _orderSnapshotRepository.Queryable(includeDeleted: true)
+                .Where(m => m.Id == dto.Id)
+                .FirstAsync(token);
+            snapshot.IsDeleted = false;
+            snapshot.IndustryId = dto.IndustryId;
+            snapshot.IndustryName = dto.IndustryName;
+
+            await _orderSnapshotRepository.UpdateAsync(snapshot, token);
+        }
     }
 }