|
@@ -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 =>
|
|
|
{
|