Переглянути джерело

Merge branch 'master' of http://110.188.24.182:10023/Fengwo/hotline

田爽 1 рік тому
батько
коміт
cac80d6436

+ 52 - 23
src/Hotline.Api/Controllers/Bi/BiOrderController.cs

@@ -1901,21 +1901,28 @@ namespace Hotline.Api.Controllers.Bi
                 }).ToListAsync();
             var items2 = await _workflowTraceRepository.Queryable()
                 .LeftJoin<Workflow>((x, w) => x.WorkflowId == w.Id)
-                .LeftJoin<WorkflowStepHandler>((x, w, wsh) => x.StepId == wsh.WorkflowStepId)
-                .InnerJoin<SchedulingUser>((x, w, wsh, su) => wsh.UserId == su.UserId)
-                .Where((x, w, wsh, su) => w.ModuleCode == "OrderHandle" && x.BusinessType == EBusinessType.Send)
-                .Where((x, w, wsh, su) => x.CreationTime >= dto.StartTime.Value)
-                .Where((x, w, wsh, su) => x.CreationTime <= dto.EndTime.Value)
-                .WhereIF(!string.IsNullOrEmpty(dto.UserName), (x, w, wsh, su) => su.UserName == dto.UserName)
-                .GroupBy((x, w, wsh, su) => new { su.UserId, su.UserName })
-                .Having((x, w, wsh, su) => SqlFunc.AggregateCount(x.WorkflowId) > 1)
-                .Select((x, w, wsh, su) => new BiOrderSendVo
+                .LeftJoin<WorkflowStepHandler>((x, w, wfsh) => x.StepId == wfsh.WorkflowStepId)
+                .InnerJoin<SchedulingUser>((x, w, wfsh, su) => wfsh.UserId == su.UserId)
+				.Where((x, w, wfsh, su) => w.ModuleCode == "OrderHandle" && x.BusinessType == EBusinessType.Send)
+                .Where((x, w, wfsh, su) => x.CreationTime >= dto.StartTime.Value)
+                .Where((x, w, wfsh, su) => x.CreationTime <= dto.EndTime.Value)
+				.GroupBy((x, w, wfsh, su) =>x.WorkflowId)
+                .Having((x, w, wfsh, su) => SqlFunc.AggregateCount(x.WorkflowId) > 1)
+                .Select((x, w, wfsh, su) => new { Id = x.WorkflowId })
+                .MergeTable()
+                .LeftJoin<WorkflowTrace>((a,wt)=>a.Id == wt.WorkflowId)
+                .LeftJoin<Workflow>((a, wt, wf) => wt.WorkflowId == wf.Id)
+				.LeftJoin<WorkflowStepHandler>((a, wt, wf, wsh) => wt.StepId == wsh.WorkflowStepId)
+                .InnerJoin<SchedulingUser>((a,wt, wf, wsh, su) => wsh.UserId == su.UserId)
+				.WhereIF(!string.IsNullOrEmpty(dto.UserName), ((a, wt, wf, wsh, su) => su.UserName == dto.UserName))
+				.GroupBy((a, wt, wf, wsh, su) => new { su.UserId, su.UserName })
+                .Select((a, wt, wf, wsh, su) => new BiOrderSendVo
                 {
                     UserId = su.UserId,
                     UserName = su.UserName,
                     SendOrderNum = 0,
                     NoSendOrderNum = 0,
-                    ReSendOrderNum = SqlFunc.AggregateDistinctCount(w.ExternalId),
+                    ReSendOrderNum = SqlFunc.AggregateDistinctCount(wf.ExternalId),
                 }).ToListAsync();
 
             var res = (from t1 in items
@@ -1945,25 +1952,47 @@ namespace Hotline.Api.Controllers.Bi
 		        throw UserFriendlyException.SameMessage("请选择时间!");
 	        dto.EndTime = dto.EndTime.Value.AddDays(1).AddSeconds(-1);
 
-			var quer =  _workflowTraceRepository.Queryable()
+            var (total, items) = await _workflowTraceRepository.Queryable()
                 .LeftJoin<Workflow>((x, w) => x.WorkflowId == w.Id)
                 .LeftJoin<WorkflowStepHandler>((x, w, wsh) => x.StepId == wsh.WorkflowStepId)
-                .InnerJoin<SchedulingUser>((x, w,  wsh, su) => wsh.UserId == su.UserId)
+                .InnerJoin<SchedulingUser>((x, w, wsh, su) => wsh.UserId == su.UserId)
                 .Where((x, w, wsh, su) => w.ModuleCode == "OrderHandle" && x.BusinessType == EBusinessType.Send)
-                .Where((x, w,  wsh, su) => su.UserId == dto.UserId)
                 .Where((x, w, wsh, su) => x.CreationTime >= dto.StartTime.Value)
-                .Where((x, w,  wsh, su) => x.CreationTime <= dto.EndTime.Value)
-				.WhereIF(dto.TitleCode == "NoSendOrderNum", (x, w, wsh, su) => x.HandlerId == null || x.HandlerId == "");
-                if (dto.TitleCode == "ReSendOrderNum")
-			    {
-                     quer = quer.Having((x, w, wsh, su) => SqlFunc.AggregateCount(x.WorkflowId) > 1);
-				}
-                var (total, items) = await quer.GroupBy((x, w, wsh, su)=> w.ExternalId)
-                .Select((x, w, wsh, su) => new { Id = w.ExternalId }  )
+                .Where((x, w, wsh, su) => x.CreationTime <= dto.EndTime.Value)
+                .Where((x, w, wsh, su)=> su.UserId == dto.UserId)
+				.WhereIF(dto.TitleCode == "NoSendOrderNum", (x, w, wsh, su) => x.HandlerId == null || x.HandlerId == "")
+                .GroupBy((x, w, wsh, su) => w.ExternalId)
+                .Select((x, w, wsh, su) => new { Id = w.ExternalId })
                 .MergeTable()
-                .LeftJoin<Order>((a,b) => a.Id == b.Id)
-                .Select((a,b)=>b)
+                .LeftJoin<Order>((a, b) => a.Id == b.Id)
+                .Select((a, b) => b)
                 .ToPagedListAsync(dto, HttpContext.RequestAborted);
+
+			if (dto.TitleCode == "ReSendOrderNum")
+			{
+				 (total, items) = await _workflowTraceRepository.Queryable()
+	                    .LeftJoin<Workflow>((x, w) => x.WorkflowId == w.Id)
+	                    .LeftJoin<WorkflowStepHandler>((x, w, wfsh) => x.StepId == wfsh.WorkflowStepId)
+	                    .InnerJoin<SchedulingUser>((x, w, wfsh, su) => wfsh.UserId == su.UserId)
+	                    .Where((x, w, wfsh, su) => w.ModuleCode == "OrderHandle" && x.BusinessType == EBusinessType.Send)
+	                    .Where((x, w, wfsh, su) => x.CreationTime >= dto.StartTime.Value)
+	                    .Where((x, w, wfsh, su) => x.CreationTime <= dto.EndTime.Value)
+						.GroupBy((x, w, wfsh, su) => x.WorkflowId)
+	                    .Having((x, w, wfsh, su) => SqlFunc.AggregateCount(x.WorkflowId) > 1)
+	                    .Select((x, w, wfsh, su) => new { Id = x.WorkflowId })
+	                    .MergeTable()
+	                    .LeftJoin<WorkflowTrace>((a, wt) => a.Id == wt.WorkflowId)
+	                    .LeftJoin<Workflow>((a, wt, wf) => wt.WorkflowId == wf.Id)
+	                    .LeftJoin<WorkflowStepHandler>((a, wt, wf, wsh) => wt.StepId == wsh.WorkflowStepId)
+	                    .InnerJoin<SchedulingUser>((a, wt, wf, wsh, su) => wsh.UserId == su.UserId)
+	                    .Where((a, wt, wf, wsh, su) => su.UserId == dto.UserId)
+						.GroupBy((a, wt, wf, wsh, su) => wf.ExternalId)
+	                    .Select((a, wt, wf, wsh, su) => new { Id = wf.ExternalId })
+	                    .MergeTable()
+	                    .LeftJoin<Order>((a, b) => a.Id == b.Id)
+	                    .Select((a, b) => b)
+	                    .ToPagedListAsync(dto, HttpContext.RequestAborted);
+			}
             return new PagedDto<OrderDto>(total, _mapper.Map<IReadOnlyList<OrderDto>>(items));
 		}
 

+ 22 - 10
src/Hotline.Api/Controllers/OrderController.cs

@@ -2601,10 +2601,10 @@ public class OrderController : BaseController
             .FirstAsync(d => d.WorkflowId == dto.WorkflowId, HttpContext.RequestAborted);
         if (order is null)
             throw new UserFriendlyException("无效工单编号");
-        if (await _orderDelayRepository.AnyAsync(x => x.OrderId == order.Id && x.DelayState == EDelayState.Examining, HttpContext.RequestAborted))
-        {
-            throw UserFriendlyException.SameMessage("该工单存在正在审核中的延期,不能办理");
-        }
+        //if (await _orderDelayRepository.AnyAsync(x => x.OrderId == order.Id && x.DelayState == EDelayState.Examining, HttpContext.RequestAborted))
+        //{
+        //    throw UserFriendlyException.SameMessage("该工单存在正在审核中的延期,不能办理");
+        //}
         if (await _orderSendBackAuditRepository.AnyAsync(x => x.OrderId == order.Id && x.State == ESendBackAuditState.Apply, HttpContext.RequestAborted))
         {
             throw UserFriendlyException.SameMessage("该工单存在正在审核中的退回,不能办理");
@@ -3295,8 +3295,11 @@ public class OrderController : BaseController
                 NextStepCode = dto.NextStepCode,
                 NextStepName = dto.NextStepName,
                 NextHandlers = dto.NextHandlers,
-                Opinion = dto.Cause
-            };
+                Opinion = dto.Cause,
+                FlowDirection =dto.FlowDirection,
+                HandlerType = dto.HandlerType,
+                BusinessType= dto.BusinessType
+			};
 			// 计算期满时间
 			//if (dto.AlterTime)
 			//{
@@ -3416,7 +3419,10 @@ public class OrderController : BaseController
 				NextStepCode = dto.NextStepCode,
 				NextStepName = dto.NextStepName,
 				NextHandlers = dto.NextHandlers,
-				Opinion = dto.Cause
+				Opinion = dto.Cause,
+				FlowDirection = dto.FlowDirection,
+				HandlerType = dto.HandlerType,
+				BusinessType = dto.BusinessType
 			};
             DateTime endTime = order.ExpiredTime!.Value;
 			// 计算期满时间
@@ -3477,7 +3483,10 @@ public class OrderController : BaseController
 		if (string.IsNullOrEmpty(dto.NextStepName)) dto.NextStepName = special.NextStepName;
         if (string.IsNullOrEmpty(dto.NextStepCode)) dto.NextStepCode = special.NextStepCode;
         if (dto.NextHandlers.Count <= 0) dto.NextHandlers = special.NextHandlers;
-        _mapper.Map(dto, special);
+        dto.FlowDirection ??= special.FlowDirection;
+        dto.HandlerType ??= special.HandlerType;
+        dto.BusinessType ??= special.BusinessType;
+		_mapper.Map(dto, special);
         if (dto.Files.Any())
             special.ReplyFileJson =
                 await _fileRepository.AddFileAsync(dto.Files, special.Id, "", HttpContext.RequestAborted);
@@ -3491,8 +3500,11 @@ public class OrderController : BaseController
                 NextStepCode = dto.NextStepCode,
                 NextStepName = dto.NextStepName,
                 NextHandlers = dto.NextHandlers,
-                Opinion = dto.Opinion
-            };
+                Opinion = dto.Opinion,
+                FlowDirection = dto.FlowDirection,
+                HandlerType = dto.HandlerType.Value,
+                BusinessType = dto.BusinessType.Value
+			};
 			//if (dto.AlterTime)
 			//    recall.External = new External { TimeLimit = dto.TimeLimit, TimeLimitUnit = dto.TimeLimitUnit };
 			//if (dto.Files.Any()) recall.Files = dto.Files;

+ 1 - 2
src/Hotline.Repository.SqlSugar/System/SystemOrganizeRepository.cs

@@ -31,10 +31,9 @@ namespace Hotline.Repository.SqlSugar.System
 
         public async Task<IReadOnlyList<SystemOrganize>> GetCanUseOrgByOrgCode(string orgCode)
         {
-            orgCode = orgCode.Substring(0, orgCode.Length - 3);
             var list = await Db.Queryable<SystemOrganize>()
                  .Where(it => it.Id.StartsWith(orgCode))
-                .ToTreeAsync(it => it.Children, it => it.ParentId, orgCode);
+                .ToTreeAsync(it => it.Children, it => it.ParentId, orgCode.Length > 6 ? orgCode.Substring(0, orgCode.Length - 3) : null);
             return list;
         }
 

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

@@ -71,6 +71,18 @@ namespace Hotline.Share.Dtos.Order
 		/// </summary>
 		public List<FileDto> Files { get; set; } = new();
 
+
+		public EFlowDirection? FlowDirection { get; set; }
+
+		/// <summary>
+		/// 办理对象类型
+		/// </summary>
+		public EHandlerType HandlerType { get; set; }
+		/// <summary>
+		/// 模板配置节点业务类型
+		/// </summary>
+		public EBusinessType BusinessType { get; set; }
+
 	}
 	public class AuditOrderSpecialDto
 	{
@@ -128,6 +140,18 @@ namespace Hotline.Share.Dtos.Order
 		/// </summary>
 		public List<FileDto> Files { get; set; } = new();
 
+
+		public EFlowDirection? FlowDirection { get; set; }
+
+		/// <summary>
+		/// 办理对象类型
+		/// </summary>
+		public EHandlerType? HandlerType { get; set; }
+		/// <summary>
+		/// 模板配置节点业务类型
+		/// </summary>
+		public EBusinessType? BusinessType { get; set; } 
+
 	}
 	public class OrderSpecialDto : OrderSpecialBaseDto
 	{

+ 22 - 16
src/Hotline/FlowEngine/Workflows/StepBasicEntity.cs

@@ -284,6 +284,7 @@ public abstract class StepBasicEntity : CreationEntity
     #endregion
 
     #region 办理参数
+    #region 办理时赋值
 
     /// <summary>
     /// (下一节点办理人)根据审批者类型不同,此字段为不同内容
@@ -304,13 +305,6 @@ public abstract class StepBasicEntity : CreationEntity
     /// </summary>
     public string? NextStepCode { get; set; }
 
-    /// <summary>
-    /// 是否回到会签发起节点汇总
-    /// </summary>
-    public bool BackToCountersignEnd { get; set; }
-
-    public EFlowDirection? FlowDirection { get; set; }
-
     /// <summary>
     /// 是否短信通知
     /// </summary>
@@ -322,23 +316,35 @@ public abstract class StepBasicEntity : CreationEntity
     [SugarColumn(Length = 2000)]
     public string? Opinion { get; set; }
 
-	/// <summary>
-	/// 附件
-	/// </summary>
-	[SugarColumn(ColumnDataType = "json", IsJson = true, IsNullable = true)]
-	public List<FileJson>? FileJson { get; set; }
+    /// <summary>
+    /// 附件
+    /// </summary>
+    [SugarColumn(ColumnDataType = "json", IsJson = true, IsNullable = true)]
+    public List<FileJson>? FileJson { get; set; }
 
+    #endregion
+    #region 创建时赋值
 
-	/// <summary>
-	/// 节点期满时间
-	/// </summary>
-	public DateTime? StepExpiredTime { get; set; }
+    /// <summary>
+    /// 节点期满时间
+    /// </summary>
+    public DateTime? StepExpiredTime { get; set; }
+
+    /// nextStep 信息
+
+    /// <summary>
+    /// 是否回到会签发起节点汇总
+    /// </summary>
+    public bool BackToCountersignEnd { get; set; }
+
+    public EFlowDirection? FlowDirection { get; set; }
 
     /// <summary>
     /// 发起会签
     /// </summary>
     public bool IsStartCountersign { get; set; }
 
+    #endregion
     #endregion
 
     #region method

+ 6 - 2
src/Hotline/FlowEngine/Workflows/WorkflowDomainService.cs

@@ -1103,7 +1103,6 @@ namespace Hotline.FlowEngine.Workflows
             }
 
             var startStep = _mapper.Map<WorkflowStep>(startStepDefine);
-            _mapper.Map(dto, startStep);
             _mapper.Map(workflow, startStep);
             startStep.Handlers = handles;
             startStep.StepHandlers = stepHandlers;
@@ -1198,7 +1197,12 @@ namespace Hotline.FlowEngine.Workflows
             //}
 
             //办理参数
-            _mapper.Map(dto, step);
+            //_mapper.Map(dto, step);
+            step.NextHandlers = dto.NextHandlers;
+            step.NextMainHandler = dto.NextMainHandler;
+            step.NextStepCode = dto.NextStepCode;
+            step.IsSms = dto.IsSms;
+            step.Opinion = dto.Opinion;
 
             //step办理状态
             HandleStep(step, dto.Opinion, dto.NextStepCode);

+ 1 - 1
src/Hotline/Orders/OrderDelay.cs

@@ -70,7 +70,7 @@ namespace Hotline.Orders
         /// <summary>
         /// 延期申请单位
         /// </summary>
-        public ETimeType DelayUnit { get; set; }
+        public ETimeType DelayUnit { get; set; } 
 
         /// <summary>
         /// 延期申请理由

+ 13 - 1
src/Hotline/Orders/OrderSpecial.cs

@@ -8,6 +8,7 @@ using Hotline.FlowEngine.Workflows;
 using Hotline.Share.Dtos;
 using Hotline.Share.Dtos.File;
 using Hotline.Share.Dtos.Order;
+using Hotline.Share.Enums.FlowEngine;
 using Hotline.Share.Enums.Order;
 using Hotline.Share.Enums.Settings;
 using SqlSugar;
@@ -30,7 +31,18 @@ namespace Hotline.Orders
         public string NextStepCode { get; set; } = string.Empty;
         public string NextStepName { get; set; } = string.Empty;
 
-        public string? StepCode { get; set; } = string.Empty;
+        public EFlowDirection? FlowDirection { get; set; }
+
+        /// <summary>
+        /// 办理对象类型
+        /// </summary>
+        public EHandlerType? HandlerType { get; set; }
+        /// <summary>
+        /// 模板配置节点业务类型
+        /// </summary>
+        public EBusinessType? BusinessType { get; set; }
+
+		public string? StepCode { get; set; } = string.Empty;
         public string? StepName { get; set; } = string.Empty;
 
 		[SugarColumn(ColumnDataType = "json", IsJson = true, IsNullable = true)]