|
@@ -1,4 +1,5 @@
|
|
|
using DotNetCore.CAP;
|
|
|
+using FluentValidation;
|
|
|
using Hotline.Api.Filter;
|
|
|
using Hotline.Application.CallCenter;
|
|
|
using Hotline.Application.ExportExcel;
|
|
@@ -23,7 +24,6 @@ using Hotline.Orders.Notifications;
|
|
|
using Hotline.OrderTranspond;
|
|
|
using Hotline.Push.FWMessage;
|
|
|
using Hotline.Push.Notifies;
|
|
|
-using Hotline.Repository.SqlSugar.CallCenter;
|
|
|
using Hotline.Repository.SqlSugar.Extensions;
|
|
|
using Hotline.Repository.SqlSugar.Ts;
|
|
|
using Hotline.SeedData;
|
|
@@ -32,8 +32,8 @@ using Hotline.Settings.Hotspots;
|
|
|
using Hotline.Settings.TimeLimitDomain;
|
|
|
using Hotline.Settings.TimeLimits;
|
|
|
using Hotline.Share.Dtos;
|
|
|
+using Hotline.Share.Dtos.Article;
|
|
|
using Hotline.Share.Dtos.CallCenter;
|
|
|
-using Hotline.Share.Dtos.File;
|
|
|
using Hotline.Share.Dtos.FlowEngine;
|
|
|
using Hotline.Share.Dtos.FlowEngine.Workflow;
|
|
|
using Hotline.Share.Dtos.Order;
|
|
@@ -44,6 +44,7 @@ using Hotline.Share.Dtos.Order.Publish;
|
|
|
using Hotline.Share.Dtos.Org;
|
|
|
using Hotline.Share.Dtos.Settings;
|
|
|
using Hotline.Share.Dtos.Snapshot;
|
|
|
+using Hotline.Share.Enums.Article;
|
|
|
using Hotline.Share.Enums.CallCenter;
|
|
|
using Hotline.Share.Enums.FlowEngine;
|
|
|
using Hotline.Share.Enums.Order;
|
|
@@ -56,6 +57,7 @@ using Hotline.Snapshot;
|
|
|
using Hotline.Snapshot.Interfaces;
|
|
|
using Hotline.Tools;
|
|
|
using Hotline.Users;
|
|
|
+using Hotline.Validators.FlowEngine;
|
|
|
using Hotline.YbEnterprise.Sdk;
|
|
|
using Mapster;
|
|
|
using MapsterMapper;
|
|
@@ -67,20 +69,12 @@ using MiniExcelLibs;
|
|
|
using SqlSugar;
|
|
|
using System.Text;
|
|
|
using System.Text.Json;
|
|
|
-using FluentValidation;
|
|
|
-using Hotline.Validators.FlowEngine;
|
|
|
using XF.Domain.Authentications;
|
|
|
using XF.Domain.Cache;
|
|
|
-using XF.Domain.Entities;
|
|
|
using XF.Domain.Exceptions;
|
|
|
using XF.Domain.Repository;
|
|
|
using XF.Utility.EnumExtensions;
|
|
|
using OrderDto = Hotline.Share.Dtos.Order.OrderDto;
|
|
|
-using System.Threading;
|
|
|
-using Hotline.Realtimes;
|
|
|
-using Hotline.Article;
|
|
|
-using Hotline.Share.Dtos.Article;
|
|
|
-using Hotline.Api.Realtimes;
|
|
|
|
|
|
namespace Hotline.Api.Controllers;
|
|
|
|
|
@@ -162,8 +156,6 @@ public class OrderController : BaseController
|
|
|
private readonly IRepository<SystemDicData> _sysDicDataRepository;
|
|
|
private readonly IRepository<SystemOrganize> _systemOrganizeRepository;
|
|
|
private readonly IRepository<OrderComplement> _orderComplementRepository;
|
|
|
- private readonly IRealtimeService _realtimeService;
|
|
|
- private readonly IRepository<NotificationWaitSend> _notificationWaitSendRepository;
|
|
|
|
|
|
public OrderController(
|
|
|
IOrderDomainService orderDomainService,
|
|
@@ -237,9 +229,7 @@ public class OrderController : BaseController
|
|
|
IOrderSnapshotApplication orderSnapshotApplication,
|
|
|
IRepository<SystemDicData> sysDicDataRepository,
|
|
|
IRepository<SystemOrganize> systemOrganizeRepository,
|
|
|
- IRepository<OrderComplement> orderComplementRepository,
|
|
|
- IRealtimeService realtimeService,
|
|
|
- IRepository<NotificationWaitSend> notificationWaitSendRepository)
|
|
|
+ IRepository<OrderComplement> orderComplementRepository)
|
|
|
{
|
|
|
_orderDomainService = orderDomainService;
|
|
|
_orderRepository = orderRepository;
|
|
@@ -313,8 +303,6 @@ public class OrderController : BaseController
|
|
|
_sysDicDataRepository = sysDicDataRepository;
|
|
|
_systemOrganizeRepository = systemOrganizeRepository;
|
|
|
_orderComplementRepository = orderComplementRepository;
|
|
|
- _realtimeService = realtimeService;
|
|
|
- _notificationWaitSendRepository = notificationWaitSendRepository;
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
@@ -5540,13 +5528,13 @@ public class OrderController : BaseController
|
|
|
if (specialAny) throw UserFriendlyException.SameMessage("工单已存在待审批特提信息!");
|
|
|
if (order.Workflow.IsInCountersign) throw UserFriendlyException.SameMessage("工单会签中,无法进行退回!");
|
|
|
|
|
|
- var (currentStep, prevStep, steps, isOrgToCenter, isSecondToFirstOrgLevel) = await _workflowApplication.GetPreviousInformationAsync(
|
|
|
- dto.WorkflowId, _sessionContext.RequiredUserId, _sessionContext.RequiredOrgId, _sessionContext.Roles, HttpContext.RequestAborted);
|
|
|
+ var (currentStep, prevStep, steps, isOrgToCenter, isSecondToFirstOrgLevel) = await _workflowApplication.GetPreviousInformationAsync(
|
|
|
+ dto.WorkflowId, _sessionContext.RequiredUserId, _sessionContext.RequiredOrgId, _sessionContext.Roles, HttpContext.RequestAborted);
|
|
|
|
|
|
- if (oneSendBack && isOrgToCenter && _appOptions.Value.IsZiGong)
|
|
|
+ if (oneSendBack && isOrgToCenter && _appOptions.Value.IsZiGong)
|
|
|
{
|
|
|
if (order.SendBackAuditEndTime.HasValue && order.SendBackAuditEndTime.Value < DateTime.Now)
|
|
|
- throw UserFriendlyException.SameMessage("工单截至退回时间【" + order.SendBackAuditEndTime.Value.ToString("yyyy-MM-dd HH:mm:ss") +"】,无法进行退回!");
|
|
|
+ throw UserFriendlyException.SameMessage("工单截至退回时间【" + order.SendBackAuditEndTime.Value.ToString("yyyy-MM-dd HH:mm:ss") + "】,无法进行退回!");
|
|
|
|
|
|
var sendBackAgain = await _orderSendBackAuditRepository.Queryable().Where(x => x.OrderId == dto.OrderId && x.IsReturnAgain == false).AnyAsync();
|
|
|
if (sendBackAgain)
|
|
@@ -5557,30 +5545,30 @@ public class OrderController : BaseController
|
|
|
{
|
|
|
await _orderRepository.Updateable().SetColumns(o => new Orders.Order() { Status = EOrderStatus.SendBackAudit })
|
|
|
.Where(o => o.Id == order.Id).ExecuteCommandAsync(HttpContext.RequestAborted);
|
|
|
- audit.ApplyOrgId = currentStep.AcceptorOrgId;
|
|
|
- audit.ApplyOrgName = currentStep!.AcceptorOrgName;
|
|
|
- ///判断是否指定
|
|
|
-
|
|
|
+ audit.ApplyOrgId = currentStep.AcceptorOrgId;
|
|
|
+ audit.ApplyOrgName = currentStep!.AcceptorOrgName;
|
|
|
+ ///判断是否指定
|
|
|
+
|
|
|
var assignStep = new WorkflowStep();
|
|
|
- if (audit.IsAssign.Value)
|
|
|
+ if (audit.IsAssign.Value)
|
|
|
{
|
|
|
assignStep = steps.FirstOrDefault(x => x.Id == dto.AssignStepId);
|
|
|
- }
|
|
|
- audit.SendBackOrgId = audit.IsAssign.Value ? assignStep .HandlerOrgId: prevStep.HandlerOrgId;
|
|
|
- audit.SendBackOrgName = audit.IsAssign.Value ? assignStep.HandlerOrgName : prevStep.HandlerOrgName;
|
|
|
- audit.SendBackStepName = audit.IsAssign.Value ? assignStep.Name : prevStep.Name;
|
|
|
-
|
|
|
- audit.WorkflowStepSendBackCrTime = currentStep.CreationTime;
|
|
|
- audit.TraceId = currentStep.Id;
|
|
|
- await _orderSendBackAuditRepository.AddAsync(audit, HttpContext.RequestAborted);
|
|
|
- }
|
|
|
+ }
|
|
|
+ audit.SendBackOrgId = audit.IsAssign.Value ? assignStep.HandlerOrgId : prevStep.HandlerOrgId;
|
|
|
+ audit.SendBackOrgName = audit.IsAssign.Value ? assignStep.HandlerOrgName : prevStep.HandlerOrgName;
|
|
|
+ audit.SendBackStepName = audit.IsAssign.Value ? assignStep.Name : prevStep.Name;
|
|
|
+
|
|
|
+ audit.WorkflowStepSendBackCrTime = currentStep.CreationTime;
|
|
|
+ audit.TraceId = currentStep.Id;
|
|
|
+ await _orderSendBackAuditRepository.AddAsync(audit, HttpContext.RequestAborted);
|
|
|
+ }
|
|
|
else
|
|
|
{
|
|
|
audit.State = ESendBackAuditState.End;
|
|
|
audit.AuditUser = "默认通过";
|
|
|
audit.AuditTime = DateTime.Now;
|
|
|
- await _orderApplication.OrderPrevious(audit, order, HttpContext.RequestAborted);
|
|
|
- }
|
|
|
+ await _orderApplication.OrderPrevious(audit, order, HttpContext.RequestAborted);
|
|
|
+ }
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -5589,7 +5577,7 @@ public class OrderController : BaseController
|
|
|
audit.AuditTime = DateTime.Now;
|
|
|
await _orderApplication.OrderPrevious(audit, order, HttpContext.RequestAborted);
|
|
|
|
|
|
- }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -5620,7 +5608,7 @@ public class OrderController : BaseController
|
|
|
var order = await _orderRepository.Queryable().Includes(d => d.Workflow).FirstAsync(d => d.Id == sendBack.OrderId);
|
|
|
if (_appOptions.Value.IsZiGong)
|
|
|
{
|
|
|
- var (currentStep, prevStep,steps ,isOrgToCenter, isSecondToFirstOrgLevel) = await _workflowApplication.GetPreviousInformationAsync(
|
|
|
+ var (currentStep, prevStep, steps, isOrgToCenter, isSecondToFirstOrgLevel) = await _workflowApplication.GetPreviousInformationAsync(
|
|
|
order.WorkflowId, sendBack.WorkflowUserId, sendBack.WorkflowOrgId, sendBack.WorkflowRoleIds.ToArray(),
|
|
|
HttpContext.RequestAborted);
|
|
|
|
|
@@ -5636,14 +5624,14 @@ public class OrderController : BaseController
|
|
|
}
|
|
|
}
|
|
|
sendBack.SendBackData.ExpiredTime = order.ExpiredTime;
|
|
|
- await _orderApplication.OrderPrevious(sendBack, order, HttpContext.RequestAborted);
|
|
|
- }
|
|
|
+ await _orderApplication.OrderPrevious(sendBack, order, HttpContext.RequestAborted);
|
|
|
+ }
|
|
|
else
|
|
|
{
|
|
|
await _orderRepository.Updateable().SetColumns(o => new Orders.Order() { Status = sendBack.Status.Value })
|
|
|
.Where(o => o.Id == sendBack.OrderId).ExecuteCommandAsync(HttpContext.RequestAborted);
|
|
|
- await _orderSendBackAuditRepository.UpdateAsync(sendBack, HttpContext.RequestAborted);
|
|
|
- }
|
|
|
+ await _orderSendBackAuditRepository.UpdateAsync(sendBack, HttpContext.RequestAborted);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -5675,7 +5663,7 @@ public class OrderController : BaseController
|
|
|
var order = await _orderRepository.Queryable().Includes(d => d.Workflow).FirstAsync(d => d.Id == sendBack.OrderId);
|
|
|
if (_appOptions.Value.IsZiGong)
|
|
|
{
|
|
|
- var (currentStep, prevStep,steps, isOrgToCenter, isSecondToFirstOrgLevel) = await _workflowApplication.GetPreviousInformationAsync(
|
|
|
+ var (currentStep, prevStep, steps, isOrgToCenter, isSecondToFirstOrgLevel) = await _workflowApplication.GetPreviousInformationAsync(
|
|
|
order.WorkflowId, sendBack.WorkflowUserId, sendBack.WorkflowOrgId, sendBack.WorkflowRoleIds.ToArray(),
|
|
|
HttpContext.RequestAborted);
|
|
|
if (prevStep.BusinessType == EBusinessType.Send)
|
|
@@ -5691,16 +5679,16 @@ public class OrderController : BaseController
|
|
|
}
|
|
|
|
|
|
sendBack.SendBackData.ExpiredTime = order.ExpiredTime;
|
|
|
- await _orderApplication.OrderPrevious(sendBack, order, HttpContext.RequestAborted);
|
|
|
- }
|
|
|
+ await _orderApplication.OrderPrevious(sendBack, order, HttpContext.RequestAborted);
|
|
|
+ }
|
|
|
else
|
|
|
{
|
|
|
await _orderRepository.Updateable().SetColumns(o => new Orders.Order() { Status = sendBack.Status.Value })
|
|
|
.Where(o => o.Id == sendBack.OrderId).ExecuteCommandAsync(HttpContext.RequestAborted);
|
|
|
- await _orderSendBackAuditRepository.UpdateAsync(sendBack, HttpContext.RequestAborted);
|
|
|
- }
|
|
|
+ await _orderSendBackAuditRepository.UpdateAsync(sendBack, HttpContext.RequestAborted);
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -5799,24 +5787,25 @@ public class OrderController : BaseController
|
|
|
if (string.IsNullOrEmpty(order.WorkflowId))
|
|
|
throw UserFriendlyException.SameMessage("该工单未开启流程");
|
|
|
|
|
|
- var (currentStep, prevStep,steps, isOrgToCenter, isSecondToFirstOrgLevel) = await _workflowApplication.GetPreviousInformationAsync(
|
|
|
+ var (currentStep, prevStep, steps, isOrgToCenter, isSecondToFirstOrgLevel) = await _workflowApplication.GetPreviousInformationAsync(
|
|
|
order.WorkflowId, _sessionContext.RequiredUserId, _sessionContext.RequiredOrgId, _sessionContext.Roles, HttpContext.RequestAborted);
|
|
|
- ///查询上一节点是否是领导节点
|
|
|
- ///ture 流程排除领导节点 排除当前节点 prevStep.BusinessType == EBusinessType.DepartmentLeader
|
|
|
- if (_appOptions.Value.IsYiBin && prevStep.Name.Contains("领导"))
|
|
|
+ ///查询上一节点是否是领导节点
|
|
|
+ ///ture 流程排除领导节点 排除当前节点 prevStep.BusinessType == EBusinessType.DepartmentLeader
|
|
|
+ if (_appOptions.Value.IsYiBin && prevStep.Name.Contains("领导"))
|
|
|
{
|
|
|
- var step = steps.Where(x=> !x.Name.Contains("领导") && x.Code != currentStep.Code).OrderByDescending(x=>x.CreationTime).FirstOrDefault();
|
|
|
+ var step = steps.Where(x => !x.Name.Contains("领导") && x.Code != currentStep.Code).OrderByDescending(x => x.CreationTime).FirstOrDefault();
|
|
|
var resStep = new List<WorkflowStep>
|
|
|
- {
|
|
|
- step,
|
|
|
- prevStep
|
|
|
- };
|
|
|
- return new TargetStepInfo {
|
|
|
- CurrentBusinessType = currentStep.BusinessType,
|
|
|
- TargetBusinessType = prevStep.BusinessType,
|
|
|
+ {
|
|
|
+ step,
|
|
|
+ prevStep
|
|
|
+ };
|
|
|
+ return new TargetStepInfo
|
|
|
+ {
|
|
|
+ CurrentBusinessType = currentStep.BusinessType,
|
|
|
+ TargetBusinessType = prevStep.BusinessType,
|
|
|
Steps = _mapper.Map<List<TargetStep>>(resStep)
|
|
|
- };
|
|
|
- }
|
|
|
+ };
|
|
|
+ }
|
|
|
|
|
|
return new TargetStepInfo
|
|
|
{
|
|
@@ -8841,6 +8830,7 @@ public class OrderController : BaseController
|
|
|
var id = await _orderComplementRepository.AddAsync(complement, HttpContext.RequestAborted);
|
|
|
if (!string.IsNullOrEmpty(id))
|
|
|
{
|
|
|
+ #region 处理推送消息
|
|
|
//获取当前办理节点数据
|
|
|
var work = await _workflowStepRepository.GetAsync(p => p.Id == data.ActualHandleStepId, HttpContext.RequestAborted);
|
|
|
if (work != null)
|
|
@@ -8849,60 +8839,61 @@ public class OrderController : BaseController
|
|
|
var workflowStepHandler = work.GetWorkflowStepHandler();
|
|
|
if (workflowStepHandler != null)
|
|
|
{
|
|
|
- List<string> users = [];
|
|
|
+
|
|
|
+ AddCircularDto circularDto = new AddCircularDto()
|
|
|
+ {
|
|
|
+ Title = "工单补充",
|
|
|
+ Content = "工单" + data.No + "有补充内容,请注意查收!",
|
|
|
+ CircularTypeId = "6",
|
|
|
+ CircularTypeName = "工单补充",
|
|
|
+ IsMustRead = true,
|
|
|
+ SourceOrgId = _sessionContext.RequiredOrgId,
|
|
|
+ SourceOrgName = _sessionContext.OrgName,
|
|
|
+ CircularType = ECircularType.Person
|
|
|
+ };
|
|
|
+
|
|
|
+ List<CircularReadGroupDto> users = [];
|
|
|
if (!string.IsNullOrEmpty(workflowStepHandler.UserId)) //指定用户
|
|
|
{
|
|
|
- users.Add(workflowStepHandler.UserId);
|
|
|
+ users.Add(new CircularReadGroupDto()
|
|
|
+ {
|
|
|
+ UserId = workflowStepHandler.UserId,
|
|
|
+ UserName = workflowStepHandler.Username
|
|
|
+ });
|
|
|
}
|
|
|
else if (!string.IsNullOrEmpty(workflowStepHandler.RoleId))//指定角色
|
|
|
{
|
|
|
//查询指定角色下面所有的用户
|
|
|
var userlist = await _userRepository.Queryable().Where(x =>
|
|
|
- x.OrgId == workflowStepHandler.OrgId && x.Roles.Any(d => workflowStepHandler.RoleId.Contains(d.Id))).Select(p => p.Id).ToListAsync();
|
|
|
- if (userlist != null && userlist.Count > 0)
|
|
|
- users.AddRange(userlist);
|
|
|
+ x.OrgId == workflowStepHandler.OrgId && x.Roles.Any(d => workflowStepHandler.RoleId.Contains(d.Id)))
|
|
|
+ .Select(d => new CircularReadGroupDto
|
|
|
+ {
|
|
|
+ UserId = d.Id,
|
|
|
+ UserName = d.Name
|
|
|
+ }).ToListAsync();
|
|
|
+ users.AddRange(userlist);
|
|
|
}
|
|
|
else if (!string.IsNullOrEmpty(workflowStepHandler.OrgId))//指定部门
|
|
|
{
|
|
|
- //添加成功以后查询需要发送的人员信息
|
|
|
- var acceptSmsRoleIds = _systemSettingCacheManager.GetSetting(SettingConstants.AcceptSmsRoleIds)?.SettingValue;
|
|
|
-
|
|
|
- //查询指定部门下面经办人的信息
|
|
|
- var userlist = await _userRepository.Queryable().Where(x =>
|
|
|
- x.OrgId == workflowStepHandler.OrgId && x.Roles.Any(d => acceptSmsRoleIds.Contains(d.Id))).Select(p => p.Id).ToListAsync();
|
|
|
- if (userlist != null && userlist.Count > 0)
|
|
|
- users.AddRange(userlist);
|
|
|
+ users.Add(new CircularReadGroupDto()
|
|
|
+ {
|
|
|
+ OrgId = workflowStepHandler.OrgId,
|
|
|
+ OrgName = workflowStepHandler.OrgName
|
|
|
+ });
|
|
|
+ circularDto.CircularType = ECircularType.Org;
|
|
|
}
|
|
|
+
|
|
|
if (users != null && users.Count > 0)
|
|
|
{
|
|
|
- var msg = @"工单" + data.No + "有补充内容,请注意查收!";
|
|
|
- foreach (var item in users)
|
|
|
- {
|
|
|
- //发送消息
|
|
|
- await _realtimeService.OrderComplementAsync(item, msg, HttpContext.RequestAborted);
|
|
|
- }
|
|
|
+ circularDto.CircularReadGroups = users;
|
|
|
+ //调用推送消息通用接口
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
- /// <summary>
|
|
|
- /// 根据userid查询补充消息
|
|
|
- /// </summary>
|
|
|
- /// <param name="userId"></param>
|
|
|
- /// <returns></returns>
|
|
|
- [HttpGet("get_notification_wait_send/{userId}")]
|
|
|
- public async Task<List<NotificationWaitSendDto>> GetNotificationWaitSend(string userId)
|
|
|
- {
|
|
|
- var data = await _notificationWaitSendRepository.Queryable()
|
|
|
- .Where(p => p.UserId == userId && p.Method == RealtimeMethods.OrderComplementRecord && p.State == "0")
|
|
|
- .ToListAsync();
|
|
|
- if (data != null && data.Count > 0)
|
|
|
- {
|
|
|
- await _notificationWaitSendRepository.RemoveRangeAsync(data, HttpContext.RequestAborted);
|
|
|
+ #endregion
|
|
|
}
|
|
|
- return _mapper.Map<List<NotificationWaitSendDto>>(data);
|
|
|
}
|
|
|
+
|
|
|
#endregion
|
|
|
}
|