Sfoglia il codice sorgente

批量修改工单标记

qinchaoyue 3 mesi fa
parent
commit
5a0244589c

+ 1 - 1
src/Hotline.Api/Controllers/OrderController.cs

@@ -4059,7 +4059,7 @@ public class OrderController : BaseController
                 continue;
             }
 
-            var snapshot = await _orderSnapshotRepository.UpdateSafetyAsync(orderId, dto.IsSafetyDepartment, dto.Remark);
+            var snapshot = await _orderSnapshotApplication.UpdateSafetyAsync(orderId, dto.IsSafetyDepartment, dto.Remark);
             if (snapshot is null)
             {
                 stringBuilder.Append($"随手拍: {orderId} 不存在");

+ 10 - 0
src/Hotline.Application/Snapshot/IOrderSnapshotApplication.cs

@@ -2,6 +2,7 @@
 using Hotline.Share.Dtos.FlowEngine;
 using Hotline.Share.Dtos.Order;
 using Hotline.Share.Dtos.Snapshot;
+using Hotline.Snapshot;
 using SqlSugar;
 using System;
 using System.Collections.Generic;
@@ -117,4 +118,13 @@ public interface IOrderSnapshotApplication
     /// <param name="dto"></param>
     /// <returns></returns>
     ISugarQueryable<LabeledOrderSnapshotItemsOutDto> GetLabeledOrderSnapshotItemsAsync(LabeledOrderSnapshotItemsInDto dto);
+
+    /// <summary>
+    /// 工单标记
+    /// </summary>
+    /// <param name="orderId"></param>
+    /// <param name="isSafetyDepartment"></param>
+    /// <param name="remark"></param>
+    /// <returns></returns>
+    Task<OrderSnapshot> UpdateSafetyAsync(string orderId, bool isSafetyDepartment, string remark);
 }

+ 12 - 1
src/Hotline.Application/Snapshot/OrderSnapshotApplication.cs

@@ -42,8 +42,9 @@ public class OrderSnapshotApplication : IOrderSnapshotApplication, IScopeDepende
     private readonly IIndustryRepository _industryRepository;
     private readonly IFileRepository _fileRepository;
     private readonly ISnapshotLabelLogRepository _snapshotLabelLogRepository;
+    private readonly IRedPackAuditRepository _redPackAuditRepository;
 
-    public OrderSnapshotApplication(IOrderSnapshotRepository orderSnapshotRepository, IOrderRepository orderRepository, ISnapshotOrderPublishRepository snapshotOrderPublishRepository, ISessionContext sessionContext, ISystemSettingCacheManager systemSettingCacheManager, IIndustryCaseRepository industryCaseRepository, ISystemDicDataCacheManager systemDicDataCacheManager, IIndustryRepository industryRepository, IFileRepository fileRepository, ISnapshotLabelLogRepository snapshotLabelLogRepository)
+    public OrderSnapshotApplication(IOrderSnapshotRepository orderSnapshotRepository, IOrderRepository orderRepository, ISnapshotOrderPublishRepository snapshotOrderPublishRepository, ISessionContext sessionContext, ISystemSettingCacheManager systemSettingCacheManager, IIndustryCaseRepository industryCaseRepository, ISystemDicDataCacheManager systemDicDataCacheManager, IIndustryRepository industryRepository, IFileRepository fileRepository, ISnapshotLabelLogRepository snapshotLabelLogRepository, IRedPackAuditRepository redPackAuditRepository)
     {
         _orderSnapshotRepository = orderSnapshotRepository;
         _orderRepository = orderRepository;
@@ -55,6 +56,7 @@ public class OrderSnapshotApplication : IOrderSnapshotApplication, IScopeDepende
         _industryRepository = industryRepository;
         _fileRepository = fileRepository;
         _snapshotLabelLogRepository = snapshotLabelLogRepository;
+        _redPackAuditRepository = redPackAuditRepository;
     }
 
     /// <summary>
@@ -466,4 +468,13 @@ public class OrderSnapshotApplication : IOrderSnapshotApplication, IScopeDepende
         return query;
     }
 
+    public async Task<OrderSnapshot> UpdateSafetyAsync(string orderId, bool isSafetyDepartment, string remark)
+    {
+        // 红包已经审核通过的工单不允许修改
+        if (await _redPackAuditRepository.Queryable().AnyAsync(m => m.OrderId == orderId && m.Status == ERedPackAuditStatus.Agree))
+        {
+            return await _orderSnapshotRepository.GetAsync(orderId);
+        }
+        return await _orderSnapshotRepository.UpdateSafetyAsync(orderId, isSafetyDepartment, remark);
+    }
 }