Browse Source

Merge branch 'dev' into dev_dss

Dun.Jason 11 months ago
parent
commit
42620f735e

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

@@ -17,6 +17,7 @@ public class BaseController : ControllerBase
         fileName = string.IsNullOrEmpty(fileName)
             ? tail
             : $"{fileName}_{tail}";
+        HttpContext.Response.Headers.Add("Access-Control-Expose-Headers", "Content-Disposition");
         return new FileStreamResult(stream, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
         {
             FileDownloadName = fileName

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

@@ -2188,7 +2188,7 @@ public class OrderController : BaseController
 
         var stream = ExcelHelper.CreateStream(dtos);
 
-        return ExcelStreamResult(stream);
+        return ExcelStreamResult(stream,"工单数据");
     }
 
     /// <summary>
@@ -2625,6 +2625,11 @@ public class OrderController : BaseController
                 ExpiredTime = timeResult.EndTime,
                 NearlyExpiredTime = timeResult.NearlyExpiredTime
             };
+            order.CenterToOrg(
+                expiredTimeConfig.TimeText, expiredTimeConfig.Count,
+                expiredTimeConfig.TimeType, expiredTimeConfig.ExpiredTime,
+                expiredTimeConfig.NearlyExpiredTime, dto.Opinion,
+                _sessionContext.RequiredUserId, _sessionContext.UserName);
         }
         else if (dto.FlowDirection is EFlowDirection.CenterToOrg)
         {

+ 14 - 13
src/Hotline.Application/Identity/IdentityAppService.cs

@@ -32,7 +32,7 @@ public class IdentityAppService : IIdentityAppService, IScopeDependency
     private readonly IRepository<Scheduling> _schedulingRepository;
     private readonly IOrderDomainService _orderDomainService;
 
-	public IdentityAppService(
+    public IdentityAppService(
         IAccountRepository accountRepository,
         IAccountDomainService accountDomainService,
         IRepository<User> userRepository,
@@ -41,7 +41,7 @@ public class IdentityAppService : IIdentityAppService, IScopeDependency
         ITypedCache<AudienceTicket> cacheAudience,
         IMessageCodeDomainService messageCodeDomainService,
         IRepository<Scheduling> schedulingRepository,
-		 IOrderDomainService orderDomainService)
+         IOrderDomainService orderDomainService)
     {
         _accountRepository = accountRepository;
         _accountDomainService = accountDomainService;
@@ -52,7 +52,7 @@ public class IdentityAppService : IIdentityAppService, IScopeDependency
         _messageCodeDomainService = messageCodeDomainService;
         _schedulingRepository = schedulingRepository;
         _orderDomainService = orderDomainService;
-	}
+    }
 
     public async Task<string> LoginAsync(LoginDto dto, CancellationToken cancellationToken)
     {
@@ -60,7 +60,7 @@ public class IdentityAppService : IIdentityAppService, IScopeDependency
             d => d.UserName == dto.Username,
             d => d.Includes(x => x.Roles));
         if (account == null)
-            throw UserFriendlyException.SameMessage("用户名或密码错误!");
+            throw new UserFriendlyException($"用户名或密码错误!{System.Text.Json.JsonSerializer.Serialize(dto)}", "用户名或密码错误!");
 
         //校验验证码
         await _messageCodeDomainService.CheckdCode(account.UserName, account.PhoneNo, dto.MsgCode, cancellationToken);
@@ -79,7 +79,7 @@ public class IdentityAppService : IIdentityAppService, IScopeDependency
             if (account.LockoutEnabled && account.AccessFailedCount >= lockoutOptions.MaxFailedAccessAttempts)
                 account.LockoutEnd = DateTime.Now.Add(lockoutOptions.DefaultLockoutTimeSpan);
             await _accountRepository.UpdateAsync(account, cancellationToken);
-            throw UserFriendlyException.SameMessage("账号名或密码错误!");
+            throw new UserFriendlyException($"用户名或密码错误!{System.Text.Json.JsonSerializer.Serialize(dto)}", "用户名或密码错误!");
         }
 
         //限制系统类型账户频繁获取token的行为
@@ -134,15 +134,16 @@ public class IdentityAppService : IIdentityAppService, IScopeDependency
         return token;
     }
 
-    public async Task AverageOrderScheduling(string id, CancellationToken cancellationToken) {
+    public async Task AverageOrderScheduling(string id, CancellationToken cancellationToken)
+    {
         try
         {
             DateTime time = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd"));
 
-	            //&& x.AtWork!.Value != true
-			//根据当前时间获取排班信息
-			var scheduling = await _schedulingRepository.Queryable().Includes(x => x.SchedulingUser)
-                .Where(x => x.SchedulingTime == time && x.WorkingTime <= DateTime.Now.TimeOfDay && x.OffDutyTime >= DateTime.Now.TimeOfDay && ( x.AtWork == true || x.AtWork  == null) && x.SchedulingUser.UserId == id)
+            //&& x.AtWork!.Value != true
+            //根据当前时间获取排班信息
+            var scheduling = await _schedulingRepository.Queryable().Includes(x => x.SchedulingUser)
+                .Where(x => x.SchedulingTime == time && x.WorkingTime <= DateTime.Now.TimeOfDay && x.OffDutyTime >= DateTime.Now.TimeOfDay && (x.AtWork == true || x.AtWork == null) && x.SchedulingUser.UserId == id)
                 .OrderBy(x => x.SendOrderNum).FirstAsync(cancellationToken);
             if (scheduling != null)
             {
@@ -150,11 +151,11 @@ public class IdentityAppService : IIdentityAppService, IScopeDependency
                 await _schedulingRepository.UpdateAsync(scheduling, cancellationToken);
                 //执行登录平均派单
                 await _orderDomainService.LogAverageOrder(id, cancellationToken);
-			}
+            }
         }
-        catch 
+        catch
         {
-	        // ignored
+            // ignored
         }
     }
 }

+ 26 - 22
src/Hotline.Share/Dtos/Order/OrderDto.cs

@@ -30,7 +30,7 @@ namespace Hotline.Share.Dtos.Order
         /// 过期状态
         /// </summary>
         public string ExpiredStatusText => ExpiredStatus?.GetDescription() ?? string.Empty;
-            
+
         /// <summary>
         /// 处理方式(直办、交办)
         /// </summary>
@@ -425,14 +425,18 @@ namespace Hotline.Share.Dtos.Order
         public string? RecordingBaseAddress { get; set; }
         public string? RecordingAbsolutePath { get; set; }
 
-        public int? ReTransactNum { get; set; }
+        public int ReTransactNum { get; set; }
 
         /// <summary>
         /// 敏感标签
         /// </summary>
         public List<string>? Sensitive { get; set; }
 
-	}
+        public string? SensitiveText => (Sensitive != null && Sensitive.Any()) ? string.Join(',', Sensitive) : "";
+
+        public string IsProvinceText => IsProvince ? "省工单" : "市工单";
+
+    }
 
     public class UpdateOrderDto : AddOrderDto
     {
@@ -684,28 +688,28 @@ namespace Hotline.Share.Dtos.Order
 
         public ETimeType? TimeLimitUnit { get; set; }
 
-		#endregion
+        #endregion
 
-		#region 市州工单互转
-		/// <summary>
-		/// 是否转发
-		/// </summary>
-		public bool? Transpond { get; set; }
+        #region 市州工单互转
+        /// <summary>
+        /// 是否转发
+        /// </summary>
+        public bool? Transpond { get; set; }
 
-		/// <summary>
-		/// 转发市州Id
-		/// </summary>
-		public string? TranspondCityId { get; set; }
+        /// <summary>
+        /// 转发市州Id
+        /// </summary>
+        public string? TranspondCityId { get; set; }
 
-		/// <summary>
-		/// 转发市州名称
-		/// </summary>
-		public string? TranspondCityName { get; set; }
+        /// <summary>
+        /// 转发市州名称
+        /// </summary>
+        public string? TranspondCityName { get; set; }
 
-		/// <summary>
-		/// 转发市州Value
-		/// </summary>
-		public string? TranspondCityValue { get; set; }
+        /// <summary>
+        /// 转发市州Value
+        /// </summary>
+        public string? TranspondCityValue { get; set; }
         #endregion
 
         /// <summary>
@@ -714,7 +718,7 @@ namespace Hotline.Share.Dtos.Order
         public bool? IsEnforcementOrder { get; set; }
     }
 
-	public record CanLinkCallRecordOrderDto : PagedKeywordRequest
+    public record CanLinkCallRecordOrderDto : PagedKeywordRequest
     {
 
     }

+ 1 - 1
src/Hotline/FlowEngine/Workflows/WorkflowDomainService.cs

@@ -1562,7 +1562,7 @@ namespace Hotline.FlowEngine.Workflows
                 _sessionContext.OrgAreaCode, _sessionContext.OrgAreaName,
                 _sessionContext.OrgIsCenter, opinion, nextStepCode);
 
-            var handler = step.FindActualHandler(_sessionContext.Roles, _sessionContext.RequiredUserId, _sessionContext.RequiredOrgId);
+            var handler = step.FindActualHandler(_sessionContext.Roles, userId, orgId);
             if (handler is not null)
                 handler.IsActualHandler = true;
         }

+ 2 - 1
src/Hotline/Tools/DynamicClassHelper.cs

@@ -3,6 +3,7 @@ using System.Reflection.Emit;
 using Hotline.Share.Dtos;
 using Hotline.Share.Dtos.Order;
 using MiniExcelLibs.Attributes;
+using XF.Domain.Extensions;
 
 namespace Hotline.Tools;
 
@@ -18,7 +19,7 @@ public class DynamicClassHelper
 
         foreach (var property in propInfos)
         {
-            var propertyName = property.Prop;
+            var propertyName = property.Prop.Trim().Replace(".", "").UpperFirstChar();
             var propertyType = typeof(string);
 
             FieldBuilder fieldBuilder = typeBuilder.DefineField("_" + propertyName, propertyType, FieldAttributes.Private);

+ 15 - 0
src/XF.Domain/Extensions/StringExtensions.cs

@@ -2,6 +2,7 @@
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
+using System.Text.RegularExpressions;
 using System.Threading.Tasks;
 
 namespace XF.Domain.Extensions
@@ -10,6 +11,8 @@ namespace XF.Domain.Extensions
     {
         public static string ToSnakeCase(this string name)
         {
+            if (string.IsNullOrEmpty(name))
+                throw new ArgumentNullException(nameof(name));
             var sb = new StringBuilder();
             sb.Append(char.ToLower(name[0]));
             for (int i = 1; i < name.Length; i++)
@@ -26,5 +29,17 @@ namespace XF.Domain.Extensions
             }
             return sb.ToString();
         }
+
+        public static string UpperFirstChar(this string str)
+        {
+            if(string.IsNullOrEmpty(str))
+                throw new ArgumentNullException(nameof(str));
+            var firstChar = str[0];
+            if (char.IsUpper(firstChar))
+                return str;
+            firstChar = char.ToUpper(firstChar);
+            str = str.Remove(0, 1);
+            return str.Insert(0,firstChar.ToString());
+        }
     }
 }