Przeglądaj źródła

Merge branch 'test' of http://110.188.24.182:10023/Fengwo/hotline into test

tangjiang 1 miesiąc temu
rodzic
commit
5b66e4cf4f

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

@@ -1,4 +1,5 @@
-using DotNetCore.CAP;
+using DocumentFormat.OpenXml.Spreadsheet;
+using DotNetCore.CAP;
 using FluentValidation;
 using Hotline.Api.Filter;
 using Hotline.Application.CallCenter;
@@ -70,6 +71,7 @@ using Microsoft.AspNetCore.Authorization;
 using Microsoft.AspNetCore.Mvc;
 using Microsoft.Extensions.Options;
 using MiniExcelLibs;
+using NPOI.SS.Formula.Functions;
 using SqlSugar;
 using System.Text;
 using System.Text.Json;
@@ -80,6 +82,7 @@ using XF.Domain.Exceptions;
 using XF.Domain.Repository;
 using XF.Utility.EnumExtensions;
 using OrderDto = Hotline.Share.Dtos.Order.OrderDto;
+using UserInfo = Hotline.Share.Dtos.FlowEngine.UserInfo;
 
 namespace Hotline.Api.Controllers;
 
@@ -3646,6 +3649,10 @@ public class OrderController : BaseController
     [HttpGet("history")]
     public async Task<PagedDto<OrderHistoryOutDto>> Query([FromQuery] QueryOrderHistoryDto dto)
     {
+        if (dto.PhoneNo.Equals("信息保密"))
+        {
+            return new PagedDto<OrderHistoryOutDto>() { };
+        }
         var query = _orderRepository.Queryable();
 
         if (_appOptions.Value.IsLuZhou && !_sessionContext.OrgIsCenter)
@@ -3667,6 +3674,7 @@ public class OrderController : BaseController
         var (total, items) = await query
             .Includes(d => d.OrderScreens)
             .Where(d => d.Contact == dto.PhoneNo)
+            .WhereIF(_sessionContext.OrgIsCenter==false,d=>d.IsSecret==false)
             .WhereIF(!string.IsNullOrEmpty(dto.OrderId), d => d.Id != dto.OrderId)
             .WhereIF(!string.IsNullOrEmpty(dto.Keyword), d => d.Title.Contains(dto.Keyword!) || d.No.Contains(dto.Keyword!))
             .Select(d => new OrderHistoryOutDto
@@ -7190,6 +7198,60 @@ public class OrderController : BaseController
         }
     }
 
+	/// <summary>
+	/// 批量重提   根据传入的工单编号特提所有工单
+	/// </summary>
+	/// <returns></returns>
+	[HttpPost("order_batch_special")]
+    [AllowAnonymous]
+    public async Task BatchSpecial([FromBody] OrderBatchSpecialDto model)
+    {
+        var orders = await _orderRepository.Queryable(isAdmin: true)
+            .Includes(o => o.Workflow)
+            .Includes(o => o.OrderVisits)
+            .Where(o => (o.CounterSignType == null || o.CounterSignType == ECounterSignType.Department))
+            .In(o=> o.No, model.No).ToListAsync();
+        if (!orders.Any())
+            throw UserFriendlyException.SameMessage("未查询到工单信息!");
+        foreach (var order in orders)
+        {
+            var nextStep = await _workflowTraceRepository.Queryable()
+				.LeftJoin<SystemOrganize>((step, o) => step.HandlerOrgId == o.Id)
+				.Where((step,o) =>  step.WorkflowId == order.WorkflowId && step.TraceStyle == ETraceStyle.Flow && step.StepType == EStepType.Normal
+					&&!string.IsNullOrEmpty(step.HandlerOrgId) && o.Level == 1 && step.BusinessType == EBusinessType.Department).OrderByDescending(step => step.CreationTime)
+                .FirstAsync(HttpContext.RequestAborted);
+            if (nextStep is null)
+                continue;
+            var dto = new OrderReTransactDto
+            {
+                AlterTime = true,
+                BusinessType = EBusinessType.Department,
+                FlowDirection = EFlowDirection.FiledToOrg,
+                HandlerType = EHandlerType.OrgLevel,
+                NextHandlers = new List<StepAssignInfo>
+                {
+                    new()
+                    {
+                        Key = nextStep.HandlerOrgId, Value = nextStep.HandlerOrgName,
+                        OrgId = nextStep.HandlerOrgId, OrgName = nextStep.HandlerOrgName,
+                        FlowAssignType = EFlowAssignType.Org
+                    }
+                },
+                NextStepCode = nextStep.Code,
+                NextStepName = nextStep.Name,
+                OrderId = order.Id,
+                Cause = "不满意二次办理",
+                Reason = "部门回访不满意  批量特提",
+                SpecialType = ESpecialType.SendBack,
+                StepType = EStepType.Normal,
+                TimeLimit = 5,
+                TimeLimitUnit = ETimeType.WorkDay,
+                WorkflowId = order.WorkflowId
+            };
+            await Add(dto);
+        }
+    }
+
     #endregion
 
     #region 市民信息

+ 3 - 1
src/Hotline.Application/Handlers/FlowEngine/WorkflowEndHandler.cs

@@ -209,7 +209,9 @@ public class WorkflowEndHandler : INotificationHandler<EndWorkflowNotify>
                     //是否已解决
                     order.IsResolved = notification.Dto.External == null ? false : notification.Dto.External.IsResolved;
 
-                    await _orderRepository.UpdateAsync(order, cancellationToken);
+                    //await _orderRepository.UpdateAsync(order, cancellationToken);
+                    await _orderRepository.Updateable(order)
+                        .ExecuteCommandAsync(cancellationToken);
                     //var callRecord = await _trCallRecordRepository.GetAsync(p => p.CallAccept == order.CallId, cancellationToken); //由CallAccept改为OtherAccept
                     //var callRecord = await _trCallRecordRepository.GetAsync(p => p.OtherAccept == order.CallId, cancellationToken);
                     var orderFlowDto = new OrderFlowDto

+ 1 - 1
src/Hotline.Application/StatisticalReport/CallReport/CallReportApplicationBase.cs

@@ -294,7 +294,7 @@ public abstract class CallReportApplicationBase : ICallReportApplication
                   InAnswered = SqlFunc.AggregateSum(SqlFunc.IIF(c.Direction == ECallDirection.In && c.AnsweredTime != null, 1, 0)), // 呼入接通量
                   OutAnswered = SqlFunc.AggregateSum(SqlFunc.IIF(c.Direction == ECallDirection.Out && c.AnsweredTime != null, 1, 0)), // 呼出接通量
                   InHangupImmediate = SqlFunc.AggregateSum(SqlFunc.IIF(c.Direction == ECallDirection.In && c.AnsweredTime == null && c.RingDuration < noConnectByeTimes, 1, 0)), // 呼入秒挂
-                  InHanguped = SqlFunc.AggregateSum(SqlFunc.IIF(c.Direction == ECallDirection.In && c.RingDuration >= noConnectByeTimes, 1, 0)), //呼入未接
+                  InHanguped = SqlFunc.AggregateSum(SqlFunc.IIF(c.Direction == ECallDirection.In && c.AnsweredTime == null && c.RingDuration >= noConnectByeTimes, 1, 0)), //呼入未接
                   InDurationAvg = SqlFunc.Ceil(SqlFunc.AggregateAvg(SqlFunc.IIF(c.Direction == ECallDirection.In && c.AnsweredTime != null, c.Duration, 0))), // 呼入平均时长
                   OutDurationAvg = SqlFunc.Ceil(SqlFunc.AggregateAvg(SqlFunc.IIF(c.Direction == ECallDirection.Out && c.AnsweredTime != null, c.Duration, 0))), // 呼出平均时长
                   InAvailableAnswer = SqlFunc.AggregateSum(SqlFunc.IIF(c.Direction == ECallDirection.In && c.AnsweredTime != null && c.Duration >= effectiveTimes, 1, 0)), // 有效接通量

+ 6 - 0
src/Hotline.Share/Dtos/Order/OrderSpecialDto.cs

@@ -486,4 +486,10 @@ namespace Hotline.Share.Dtos.Order
 
 		public DateTime EndTime { get; set; }
 	}
+
+	public class OrderBatchSpecialDto
+	{
+		public List<string>  No { get; set; }
+
+	}
 }