Jelajahi Sumber

增加标注修改日志接口

qinchaoyue 3 bulan lalu
induk
melakukan
6e1d3e0cd0

+ 0 - 1
src/Hotline.Api/Controllers/CallController.cs

@@ -112,7 +112,6 @@ namespace Hotline.Api.Controllers
         /// </summary>
         /// <param name="callId"></param>
         /// <returns></returns>
-        /// <exception cref="NotImplementedException"></exception>
         [HttpGet("{callId}")]
         public Task<List<CallNative>> GetCall(string callId)
         {

+ 11 - 1
src/Hotline.Application.Tests/Application/OrderSnapshotApplicationTest.cs

@@ -1,9 +1,14 @@
 using Hotline.Api.Controllers;
+using Hotline.Application.Snapshot;
 using Hotline.Application.Tests.Mock;
 using Hotline.Caching.Interfaces;
 using Hotline.Identity.Accounts;
 using Hotline.Identity.Roles;
+using Hotline.Repository.SqlSugar.Extensions;
 using Hotline.Share.Dtos;
+using Hotline.Share.Dtos.Snapshot;
+using Hotline.Share.Requests;
+using Hotline.Share.Tools;
 using Hotline.Snapshot.Interfaces;
 using Hotline.Users;
 using Microsoft.AspNetCore.Http;
@@ -22,11 +27,13 @@ public class OrderSnapshotApplicationTest : TestBase
     private readonly OrderServiceMock _orderServiceMock;
     private readonly ISystemDicDataCacheManager _systemDicDataCacheManager;
     private readonly IOrderSnapshotRepository _orderSnapshotRepository;
-    public OrderSnapshotApplicationTest(IAccountRepository accountRepository, IRepository<Role> roleRepository, UserController userController, IServiceScopeFactory scopeFactory, IRepository<User> userRepository, IHttpContextAccessor httpContextAccessor, IThirdIdentiyService thirdIdentiyService, IThirdAccountRepository thirdAccountRepository, OrderServiceMock orderServiceMock, ISystemDicDataCacheManager systemDicDataCacheManager, IOrderSnapshotRepository orderSnapshotRepository) : base(accountRepository, roleRepository, userController, scopeFactory, userRepository, httpContextAccessor, thirdIdentiyService, thirdAccountRepository)
+    private readonly IOrderSnapshotApplication _orderSnapshotApplication;
+    public OrderSnapshotApplicationTest(IAccountRepository accountRepository, IRepository<Role> roleRepository, UserController userController, IServiceScopeFactory scopeFactory, IRepository<User> userRepository, IHttpContextAccessor httpContextAccessor, IThirdIdentiyService thirdIdentiyService, IThirdAccountRepository thirdAccountRepository, OrderServiceMock orderServiceMock, ISystemDicDataCacheManager systemDicDataCacheManager, IOrderSnapshotRepository orderSnapshotRepository, IOrderSnapshotApplication orderSnapshotApplication) : base(accountRepository, roleRepository, userController, scopeFactory, userRepository, httpContextAccessor, thirdIdentiyService, thirdAccountRepository)
     {
         _orderServiceMock = orderServiceMock;
         _systemDicDataCacheManager = systemDicDataCacheManager;
         _orderSnapshotRepository = orderSnapshotRepository;
+        _orderSnapshotApplication = orderSnapshotApplication;
     }
 
     /// <summary>
@@ -56,6 +63,9 @@ public class OrderSnapshotApplicationTest : TestBase
         snapshot.Labels.Count.ShouldBe(inputLable.Count);
 
         snapshot.IsSafetyDepartment.ShouldBe(false);
+
+        var labelLog = await _orderSnapshotApplication.GetSignOrderSnapshotLogItemsAsync(new SignOrderSnapshotLogItemsInDto()).ToPagedListAsync(new PagedRequest());
+        labelLog.Items.Any(m => m.Title.IsNullOrEmpty()).ShouldBe(false);
     }
 }
 

+ 0 - 1
src/Hotline.Application/Orders/OrderApplication.cs

@@ -1248,7 +1248,6 @@ public class OrderApplication : IOrderApplication, IScopeDependency
     /// </summary>
     /// <param name="dto"></param>
     /// <returns></returns>
-    /// <exception cref="NotImplementedException"></exception>
     public async Task VisitPushSMSAsync(VisitSmsInDto dto, CancellationToken cancellationToken)
     {
         var orderVisitList = await _orderVisitRepository.Queryable()

+ 46 - 19
src/Hotline.Application/Snapshot/OrderSnapshotApplication.cs

@@ -41,8 +41,9 @@ public class OrderSnapshotApplication : IOrderSnapshotApplication, IScopeDepende
     private readonly ISystemDicDataCacheManager _systemDicDataCacheManager;
     private readonly IIndustryRepository _industryRepository;
     private readonly IFileRepository _fileRepository;
+    private readonly ISnapshotLabelLogRepository _snapshotLabelLogRepository;
 
-    public OrderSnapshotApplication(IOrderSnapshotRepository orderSnapshotRepository, IOrderRepository orderRepository, ISnapshotOrderPublishRepository snapshotOrderPublishRepository, ISessionContext sessionContext, ISystemSettingCacheManager systemSettingCacheManager, IIndustryCaseRepository industryCaseRepository, ISystemDicDataCacheManager systemDicDataCacheManager, IIndustryRepository industryRepository, IFileRepository fileRepository)
+    public OrderSnapshotApplication(IOrderSnapshotRepository orderSnapshotRepository, IOrderRepository orderRepository, ISnapshotOrderPublishRepository snapshotOrderPublishRepository, ISessionContext sessionContext, ISystemSettingCacheManager systemSettingCacheManager, IIndustryCaseRepository industryCaseRepository, ISystemDicDataCacheManager systemDicDataCacheManager, IIndustryRepository industryRepository, IFileRepository fileRepository, ISnapshotLabelLogRepository snapshotLabelLogRepository)
     {
         _orderSnapshotRepository = orderSnapshotRepository;
         _orderRepository = orderRepository;
@@ -53,6 +54,7 @@ public class OrderSnapshotApplication : IOrderSnapshotApplication, IScopeDepende
         _systemDicDataCacheManager = systemDicDataCacheManager;
         _industryRepository = industryRepository;
         _fileRepository = fileRepository;
+        _snapshotLabelLogRepository = snapshotLabelLogRepository;
     }
 
     /// <summary>
@@ -264,25 +266,29 @@ public class OrderSnapshotApplication : IOrderSnapshotApplication, IScopeDepende
         if (_systemSettingCacheManager.Snapshot == false) return;
 
         var snapshot = await _orderSnapshotRepository.GetAsync(m => m.Id == id);
+        if (snapshot == null) return;
         if (snapshot != null && labels.IsNullOrEmpty())
         {
             throw UserFriendlyException.SameMessage("随手拍工单标记不能为空");
         }
-        if (snapshot != null)
-        {
-            snapshot.Labels = labels;
-            snapshot.LabelName = string.Join('|', labels.Select(m => m.Value));
-            if (labels.Any(m => m.Key == "yzg"))
-                snapshot.IsRectifyDepartment = true;
-            if (labels.Any(m => m.Key == "wzg"))
-                snapshot.IsRectifyDepartment = false;
-            if (labels.Any(m => m.Key == "ss"))
-                snapshot.IsTruthDepartment = true;
-            if (labels.Any(m => m.Key == "bss"))
-                snapshot.IsTruthDepartment = false;
-
-            await _orderSnapshotRepository.UpdateAsync(snapshot);
-        }
+        snapshot.Labels = labels;
+        snapshot.LabelName = string.Join('|', labels.Select(m => m.Value));
+        //if (labels.Any(m => m.Key == "yzg"))
+        //    snapshot.IsRectifyDepartment = true;
+        //if (labels.Any(m => m.Key == "wzg"))
+        //    snapshot.IsRectifyDepartment = false;
+        //if (labels.Any(m => m.Key == "ss"))
+        //    snapshot.IsTruthDepartment = true;
+        //if (labels.Any(m => m.Key == "bss"))
+        //    snapshot.IsTruthDepartment = false;
+        await _orderSnapshotRepository.UpdateAsync(snapshot);
+
+        var entity = new SnapshotLabelLog { 
+        OrderId = snapshot.Id,
+        LabelName = snapshot.LabelName,
+        Labels = labels
+        };
+        await _snapshotLabelLogRepository.AddAsync(entity);
     }
 
     public async Task SaveOrderWorkflowInfo(NextWorkflowDto<OrderHandleFlowDto> dto)
@@ -335,9 +341,31 @@ public class OrderSnapshotApplication : IOrderSnapshotApplication, IScopeDepende
         }
     }
 
+    /// <summary>
+    /// 获取工单标注日志集合
+    /// </summary>
+    /// <param name="dto"></param>
+    /// <returns></returns>
     public ISugarQueryable<SignOrderSnapshotLogItemsOutDto> GetSignOrderSnapshotLogItemsAsync(SignOrderSnapshotLogItemsInDto dto)
     {
-        throw new NotImplementedException();
+        var query = _snapshotLabelLogRepository.Queryable()
+            .LeftJoin<Order>((log, order) => log.OrderId == order.Id)
+            .LeftJoin<OrderSnapshot>((log, order, snapshot) => log.OrderId == snapshot.Id)
+            .WhereIF(dto.No.NotNullOrEmpty(), (log, order) => order.No.Contains(dto.No))
+            .WhereIF(dto.Title.NotNullOrEmpty(), (log, order) => order.Title.Contains(dto.Title))
+            .WhereIF(dto.Contact.NotNullOrEmpty(), (log, order)=> order.Contact.Contains(dto.Contact))
+            .WhereIF(dto.FromName.NotNullOrEmpty(), (log, order)=> order.FromName.Contains(dto.FromName))
+            .WhereIF(dto.Label.NotNullOrEmpty(), (log, order)=> log.LabelName.Contains(dto.Label))
+            .WhereIF(dto.SignName.NotNullOrEmpty(), (log, order) => log.CreatorName.Contains(dto.SignName))
+            .WhereIF(dto.BeginSignTime.HasValue && dto.EndSignTime.HasValue, (log, order) => log.CreationTime >= dto.BeginSignTime && log.CreationTime <= dto.EndSignTime)
+            .Select((log, order, snapshot) => new SignOrderSnapshotLogItemsOutDto
+            {
+                OrderId = order.Id,
+                SignName = log.CreatorName,
+                SignTime = log.CreationTime,
+                IndustryName = snapshot.IndustryName
+            }, true);
+        return query;
     }
 
     /// <summary>
@@ -346,7 +374,6 @@ public class OrderSnapshotApplication : IOrderSnapshotApplication, IScopeDepende
     /// <param name="rsp"></param>
     /// <param name="orderId"></param>
     /// <returns></returns>
-    /// <exception cref="NotImplementedException"></exception>
     public async Task GetNextStepsDatabaseAsync(NextStepsWithOpinionDto<RecommendStepOption> rsp, string orderId)
     {
         if (_systemSettingCacheManager.Snapshot == false) return;
@@ -370,7 +397,7 @@ public class OrderSnapshotApplication : IOrderSnapshotApplication, IScopeDepende
                     {
                         await _fileRepository.Queryable()
                         .Where(m => m.Classify == EIndustryType.Declare.ToString())
-                        .Select(m => new FileJson { Id = m.Id, FileName = m.Name, Path = m.Path, FileType = m.Type})
+                        .Select(m => new FileJson { Id = m.Id, FileName = m.Name, Path = m.Path, FileType = m.Type })
                         .ToListAsync()
                         .Then(async file =>
                         {

+ 0 - 2
src/Hotline.Application/Snapshot/RedPackApplication.cs

@@ -47,7 +47,6 @@ public class RedPackApplication : IRedPackApplication, IScopeDependency
     /// </summary>
     /// <param name="dto"></param>
     /// <returns></returns>
-    /// <exception cref="NotImplementedException"></exception>
     public async Task AuditRedPackAuditAsync(UpdateRedPackAuditInDto dto)
     {
         var redPackAudit = await _redPackAuditRepository.GetAsync(dto.RedPackAuditId) ?? throw UserFriendlyException.SameMessage("审核记录不存在");
@@ -87,7 +86,6 @@ public class RedPackApplication : IRedPackApplication, IScopeDependency
     /// </summary>
     /// <param name="dto"></param>
     /// <returns></returns>
-    /// <exception cref="NotImplementedException"></exception>
     public async Task AuditRedPackGuiderAuditAsync(UpdateRedPackGuiderAuditInDto dto)
     {
         var redPackAudit = await _redPackGuiderAuditRepository.GetAsync(dto.RedPackAuditId) ?? throw UserFriendlyException.SameMessage("审核记录不存在");

+ 18 - 0
src/Hotline.Repository.SqlSugar/Snapshot/SnapshotLabelLogRepository.cs

@@ -0,0 +1,18 @@
+using Hotline.Repository.SqlSugar.DataPermissions;
+using Hotline.Snapshot;
+using Hotline.Snapshot.Interfaces;
+using SqlSugar;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using XF.Domain.Dependency;
+
+namespace Hotline.Repository.SqlSugar.Snapshot;
+public class SnapshotLabelLogRepository : BaseRepository<SnapshotLabelLog>, ISnapshotLabelLogRepository, IScopeDependency
+{
+    public SnapshotLabelLogRepository(ISugarUnitOfWork<HotlineDbContext> uow, IDataPermissionFilterBuilder dataPermissionFilterBuilder) : base(uow, dataPermissionFilterBuilder)
+    {
+    }
+}

+ 50 - 0
src/Hotline.Share/Dtos/Snapshot/OrderDto.cs

@@ -1453,6 +1453,56 @@ public class SignOrderSnapshotLogItemsOutDto
     /// 来源
     /// </summary>
     public string Source { get; set; }
+
+    /// <summary>
+    /// 受理编号
+    /// </summary>
+    public string No { get; set; }
+
+    /// <summary>
+    /// 标题
+    /// </summary>
+    public string Title { get; set; }
+
+    /// <summary>
+    /// 来电人姓名
+    /// </summary>
+    public string FromName { get; set; }
+
+    /// <summary>
+    /// 来电人电话
+    /// </summary>
+    public string FromPhone { get; set; }
+
+    /// <summary>
+    /// 区域
+    /// </summary>
+    public string County { get; set; }
+
+    /// <summary>
+    /// 行业
+    /// </summary>
+    public string IndustryName { get; set; }
+
+    /// <summary>
+    /// 受理时间
+    /// </summary>
+    public DateTime CreationTime { get; set; }
+
+    /// <summary>
+    /// 标注人
+    /// </summary>
+    public string SignName { get; set; }
+
+    /// <summary>
+    /// 标注类型
+    /// </summary>
+    public string LabelName { get; set; }
+
+    /// <summary>
+    /// 标注时间
+    /// </summary>
+    public DateTime SignTime { get; set; }
 }
 
 public record OrderSnapshotItemsInDto : PagedRequest

+ 0 - 1
src/Hotline/Caching/Services/CallCacheManager.cs

@@ -46,7 +46,6 @@ namespace Hotline.Caching.Services
         /// 删除队列
         /// </summary>
         /// <param name="id"></param>
-        /// <exception cref="NotImplementedException"></exception>
         public void RemoveCallCache(string id)
         {
             _cacheCall.Remove(id);

+ 0 - 1
src/Hotline/Orders/Order.cs

@@ -1409,7 +1409,6 @@ namespace Hotline.Orders
         /// 自动发布条件检测
         /// </summary>
         /// <returns></returns>
-        /// <exception cref="NotImplementedException"></exception>
         public string AutoPublishCheck()
         {
             if (CounterSignType != null)

+ 0 - 2
src/Hotline/Orders/OrderVisitDetail.cs

@@ -101,7 +101,6 @@ namespace Hotline.Orders
         /// 短信回访回填
         /// </summary>
         /// <param name="visitSatisfactionKv"></param>
-        /// <exception cref="NotImplementedException"></exception>
         public void ReplyBackfill(Kv visitSatisfactionKv)
         {
             this.OrgProcessingResults = visitSatisfactionKv;
@@ -113,7 +112,6 @@ namespace Hotline.Orders
         /// 短信回访回填
         /// </summary>
         /// <param name="visitSatisfactionKv"></param>
-        /// <exception cref="NotImplementedException"></exception>
         public void ReplyBackfill(ESeatEvaluate seatEvaluate)
         {
             this.SeatEvaluate ??= seatEvaluate;

+ 11 - 0
src/Hotline/Snapshot/Interfaces/ISnapshotLabelLogRepository.cs

@@ -0,0 +1,11 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using XF.Domain.Repository;
+
+namespace Hotline.Snapshot.Interfaces;
+public interface ISnapshotLabelLogRepository : IRepository<SnapshotLabelLog>
+{
+}

+ 31 - 0
src/Hotline/Snapshot/SnapshotLabelLog.cs

@@ -0,0 +1,31 @@
+using Hotline.Share.Dtos;
+using SqlSugar;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using XF.Domain.Repository;
+
+namespace Hotline.Snapshot;
+[Description("标注类型修改日志")]
+public class SnapshotLabelLog : FullStateEntity
+{
+    /// <summary>
+    /// OrderId
+    /// </summary>
+    public string OrderId { get; set; }
+
+    /// <summary>
+    /// 发布工单时标记的工单标签
+    /// </summary>
+    [SugarColumn(ColumnDescription = "工单标签", ColumnDataType = "json", IsJson = true, IsNullable = true)]
+    public IList<Kv>? Labels { get; set; }
+
+    /// <summary>
+    /// 发布工单时标记的工单标签(多个使用 | 分隔)
+    /// </summary>
+    [SugarColumn(ColumnDescription = "工单标签")]
+    public string? LabelName { get; set; }
+}

+ 0 - 1
src/NewRock.Sdk/Security/Encryptor.cs

@@ -9,7 +9,6 @@ namespace NewRock.Sdk.Security
         /// 生成一个10位随机数字符串
         /// </summary>
         /// <returns></returns>
-        /// <exception cref="NotImplementedException"></exception>
         public static string GenerateRandomNumber()
         {
             var sb = new StringBuilder();