Browse Source

Merge branch 'feature/snapshot' into test

qinchaoyue 1 month ago
parent
commit
9ad8628855

+ 1 - 1
src/Hotline.Application/Snapshot/SnapshotApplicationBase.cs

@@ -288,7 +288,7 @@ public abstract class SnapshotApplicationBase
     public async Task<IReadOnlyList<BulletinOutDto>> GetBulletinsAsync(BulletinInDto dto, CancellationToken cancellationToken)
     {
         var items = await _bulletinRepository.Queryable()
-            .Where(m => m.BulletinState == EBulletinState.ReviewPass)
+            .Where(m => m.BulletinState == EBulletinState.ReviewPass && m.IsArrive == true)
             .LeftJoin<Industry>((bulletin, industry) => bulletin.SnapshotBulletinTypeId == industry.BulletinTypePublicityId)
             .Where((bulletin, industry) => industry.Id == dto.IndustryId)
             .ToFixedListAsync(dto, cancellationToken);

+ 3 - 0
src/Hotline.Application/Snapshot/SnapshotOrderApplication.cs

@@ -72,6 +72,9 @@ public class SnapshotOrderApplication : IOrderSnapshotApplication, IScopeDepende
     public async Task<string> AddOrderPublishAsync(AddSnapshotOrderPublishInDto dto, CancellationToken cancellation)
     {
         dto.ValidateObject();
+        var oldPublish = await _snapshotOrderPublishRepository.Queryable().Where(m => m.OrderId == dto.OrderId).FirstAsync(cancellation);
+        if (oldPublish != null)
+            await _snapshotOrderPublishRepository.RemoveAsync(oldPublish,cancellationToken: cancellation);
         var snapshotOrder = await _orderSnapshotRepository.GetAsync(dto.OrderId)
             ?? throw UserFriendlyException.SameMessage("工单不存在");
         var order = await _orderRepository.Queryable()