xf 6 bulan lalu
induk
melakukan
a87e5b96a8

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

@@ -273,7 +273,6 @@ public class OrderController : BaseController
         _orderTerminateRepository = orderTerminateRepository;
         _orderRevokeRepository = orderRevokeRepository;
         _typeCache = typeCache;
-        _cityBaseConfiguration = cityBaseConfiguration;
         _baseDataApplication = baseDataApplication;
     }
 
@@ -3638,7 +3637,7 @@ public class OrderController : BaseController
     [HttpPost("steps/temp")]
     public async Task TempSaveAsync([FromBody] StepTempInDto dto)
     {
-        await _typeCache.SetAsync($"tmp_opinion_{dto.OrderId}{_sessionContext.UserId}", dto.Opinion, TimeSpan.FromDays(3), HttpContext.RequestAborted);
+        //await _typeCache.SetAsync($"tmp_opinion_{dto.OrderId}{_sessionContext.UserId}", dto.Opinion, TimeSpan.FromDays(3), HttpContext.RequestAborted);
     }
 
     /// <summary>

+ 2 - 4
src/Hotline.Api/Controllers/OrderTerminateController.cs

@@ -175,8 +175,7 @@ namespace Hotline.Api.Controllers
 				startDto.DefinitionModuleCode = WorkflowModuleConsts.OrderTerminate;
 				startDto.Opinion = dto.Data.Content;
 				startDto.Title = "申请终止流程";
-				await _workflowApplication.StartWorkflowAsync(startDto, _sessionContext, model.Id,	
-					cancellationToken: HttpContext.RequestAborted);
+				await _workflowApplication.StartWorkflowAsync(startDto, model.Id, cancellationToken: HttpContext.RequestAborted);
 			}
 			catch (Exception e)
 			{
@@ -207,8 +206,7 @@ namespace Hotline.Api.Controllers
 			try
 			{
 				dto.NextWorkflow.WorkflowId = model.WorkflowId;
-				await _workflowApplication.NextAsync(dto.NextWorkflow, _sessionContext,
-					cancellationToken: HttpContext.RequestAborted);
+				await _workflowApplication.NextAsync(dto.NextWorkflow, cancellationToken: HttpContext.RequestAborted);
 			}
 			catch (Exception e)
 			{

+ 0 - 5
src/Hotline.Application/FlowEngine/WorkflowApplication.cs

@@ -101,7 +101,6 @@ public class WorkflowApplication : IWorkflowApplication, IScopeDependency
         _fileRepository = fileRepository;
         _logger = logger;
         _systemSettingCacheManager = systemSettingCacheManager;
-        _cityBaseConfiguration = cityBaseConfiguration;
         _sessionContext = sessionContextProvider.SessionContext;
     }
 
@@ -1223,7 +1222,6 @@ public class WorkflowApplication : IWorkflowApplication, IScopeDependency
                 else
                 {
                     businessType = EBusinessType.Department;
-                    handlerType = EHandlerType.AssignedOrgOrRole;
                     roleName = handleRoleName;
                     //上级部门Id
                     upperOrgId = _sessionContext.RequiredOrgId.GetHigherOrgId(orgLevel);
@@ -1249,7 +1247,6 @@ public class WorkflowApplication : IWorkflowApplication, IScopeDependency
                         ? EBusinessType.Send
                         : EBusinessType.Department;
                 orgLevel = _sessionContext.OrgLevel - 1;
-                handlerType = EHandlerType.AssignedOrgOrRole;
                 if (orgLevel <= 0) orgLevel = 1;
                 roleName = handleRoleName;
                 //上级部门Id
@@ -1291,7 +1288,6 @@ public class WorkflowApplication : IWorkflowApplication, IScopeDependency
                 else
                 {
                     businessType = EBusinessType.Department;
-                    handlerType = EHandlerType.AssignedOrgOrRole;
                     upperOrgId = _sessionContext.RequiredOrgId.GetHigherOrgId(_sessionContext.OrgLevel);
                     isLead = _sessionContext.Roles.Any(x => x == leadRoleCode);
                     if (!isLead)
@@ -1333,7 +1329,6 @@ public class WorkflowApplication : IWorkflowApplication, IScopeDependency
                         : EBusinessType.Department;
                 orgLevel = _sessionContext.OrgLevel - 1;
                 if (orgLevel <= 0) orgLevel = 1;
-                handlerType = EHandlerType.AssignedOrgOrRole;
                 upperOrgId = _sessionContext.RequiredOrgId.GetHigherOrgId(_sessionContext.OrgLevel);
                 isLead = _sessionContext.Roles.Any(x => x == leadRoleCode);
                 if (!isLead)

+ 2 - 2
src/Hotline.Application/Orders/OrderApplication.cs

@@ -2274,7 +2274,7 @@ public class OrderApplication : IOrderApplication, IScopeDependency
     /// <param name="dto"></param>
     /// <param name="cancellationToken"></param>
     /// <returns></returns>
-    private async Task<AddOrderResponse> ReceiveOrderFromOtherPlatformAsync(AddOrderDto dto, List<FileDto> files,ISessionContext current, CancellationToken cancellationToken)
+    private async Task<AddOrderResponse> ReceiveOrderFromOtherPlatformAsync(AddOrderDto dto, List<FileDto> files, CancellationToken cancellationToken)
     {
         if (string.IsNullOrEmpty(dto.ExternalId))
             throw new UserFriendlyException("工单外部编号不能为空");
@@ -2550,7 +2550,7 @@ public class OrderApplication : IOrderApplication, IScopeDependency
                 d => d.CreationTime >= dto.ApplyStartTime && d.CreationTime <= dto.ApplyEndTime)
             //.WhereIF(dto.AuditStatus is 1 , d=>d.Status == ETerminateStatus.Approval || d.Status == ETerminateStatus.SendBack )
             //.WhereIF(dto.AuditStatus is 2, d => d.Status == ETerminateStatus.End || dto.Status == ETerminateStatus.Refuse)
-			.WhereIF(dto.QueryType is 1, d => d.CreatorId == _sessionContext.UserId)
+			.WhereIF(dto.QueryType is 1, d => d.CreatorId == _sessionContextProvider.SessionContext.UserId)
             .WhereIF(dto.Status.HasValue, d => d.Status == dto.Status)
             .WhereIF(dto.StartTime.HasValue && dto.EndTime.HasValue, d => d.Order.StartTime >= dto.StartTime && d.Order.StartTime <= dto.EndTime)
             .OrderByDescending(d => d.CreationTime);

+ 15 - 21
src/Hotline.Application/Subscribers/DatasharingSubscriber.cs

@@ -266,8 +266,8 @@ namespace Hotline.Application.Subscribers
                 }
             };
             await _orderRevokeRepository.AddAsync(orderRevoke, cancellationToken);
-            var setting = _systemSettingCacheManager.GetSetting(SettingConstants.CityBaseConfiguration)?.SettingValue[0];
-            CityBaseConfiguration cityBase = JsonConvert.DeserializeObject<CityBaseConfiguration>(setting);
+            //var setting = _systemSettingCacheManager.GetSetting(SettingConstants.CityBaseConfiguration)?.SettingValue[0];
+            //CityBaseConfiguration cityBase = JsonConvert.DeserializeObject<CityBaseConfiguration>(setting);
 
             //计算order 期满时间
             ExpiredTimeWithConfig expiredTimeConfig;
@@ -297,7 +297,7 @@ namespace Hotline.Application.Subscribers
             }
             else
             {
-                await _workflowDomainService.RecallToCenterFirstToSendAsync(order.WorkflowId, dto.Opinion, 
+                await _workflowDomainService.RecallToCenterFirstToSendAsync(order.WorkflowId, dto.Opinion,
                     order.Status >= EOrderStatus.Filed, order.ExpiredTime, cancellationToken);
             }
         }
@@ -459,11 +459,8 @@ namespace Hotline.Application.Subscribers
                             x.Status == EScreenStatus.Approval)
                 .FirstAsync(cancellationToken);
 
-            var setting = _systemSettingCacheManager.GetSetting(SettingConstants.CityBaseConfiguration)?.SettingValue[0];
-            CityBaseConfiguration cityBase = JsonConvert.DeserializeObject<CityBaseConfiguration>(setting);
-			var current = SessionContextCreator.CreateSessionContext(_sessionContext, dto.Source, cityBase);
-            await _workflowApplication.HandleToEndAsync(current,
-                orderScreen.WorkflowId, "省上推送甄别结果", null,
+            //var setting = _systemSettingCacheManager.GetSetting(SettingConstants.CityBaseConfiguration)?.SettingValue[0];
+            //CityBaseConfiguration cityBase = JsonConvert.DeserializeObject<CityBaseConfiguration>(setting);
             SessionContextCreator.CreateSessionContext(_sessionContextProvider, dto.Source);
             await _workflowApplication.HandleToEndAsync(orderScreen.WorkflowId, "省上推送甄别结果", null,
                 dto.ProvinceScreenResult.AuditResult
@@ -710,11 +707,9 @@ namespace Hotline.Application.Subscribers
                         orderDelay.FileJson = await _fileRepository.AddFileAsync(dto.Files, orderDelay.Id, orderDelay.WorkflowId, cancellationToken);
                     await _orderDelayRepository.UpdateAsync(orderDelay, cancellationToken);
 
-                    var setting = _systemSettingCacheManager.GetSetting(SettingConstants.CityBaseConfiguration)?.SettingValue[0];
-                    CityBaseConfiguration cityBase = JsonConvert.DeserializeObject<CityBaseConfiguration>(setting);
+                    //var setting = _systemSettingCacheManager.GetSetting(SettingConstants.CityBaseConfiguration)?.SettingValue[0];
+                    //CityBaseConfiguration cityBase = JsonConvert.DeserializeObject<CityBaseConfiguration>(setting);
 
-					var current = SessionContextCreator.CreateSessionContext(_sessionContext, dto.Source, cityBase);
-                    await _workflowApplication.HandleToEndAsync(current, orderDelay.WorkflowId, dto.Opinion, dto.Files,
                     SessionContextCreator.CreateSessionContext(_sessionContextProvider, dto.Source);
                     await _workflowApplication.HandleToEndAsync(orderDelay.WorkflowId, dto.Opinion, dto.Files,
                         dto.IsPass ? EReviewResult.Approval : EReviewResult.Failed, cancellationToken);
@@ -735,16 +730,15 @@ namespace Hotline.Application.Subscribers
             if (string.IsNullOrEmpty(order.WorkflowId))
                 throw new UserFriendlyException($"该工单未开启流程,orderId: {dto.OrderId}");
 
-			//if (dto.Files != null && dto.Files.Any())
-			//{
-			//    order.FileJson = await _fileRepository.AddFileAsync(dto.Files, order.Id, order.WorkflowId,
-			//        cancellationToken);
-			//    await _orderRepository.FileAsync(order, cancellationToken);
-			//}
-			var setting = _systemSettingCacheManager.GetSetting(SettingConstants.CityBaseConfiguration)?.SettingValue[0];
-			CityBaseConfiguration cityBase = JsonConvert.DeserializeObject<CityBaseConfiguration>(setting);
+            //if (dto.Files != null && dto.Files.Any())
+            //{
+            //    order.FileJson = await _fileRepository.AddFileAsync(dto.Files, order.Id, order.WorkflowId,
+            //        cancellationToken);
+            //    await _orderRepository.FileAsync(order, cancellationToken);
+            //}
+            //var setting = _systemSettingCacheManager.GetSetting(SettingConstants.CityBaseConfiguration)?.SettingValue[0];
+            //CityBaseConfiguration cityBase = JsonConvert.DeserializeObject<CityBaseConfiguration>(setting);
 
-			var current = SessionContextCreator.CreateSessionContext(_sessionContext, dto.Source, cityBase);
             switch (dto.FinishType)
             {
                 case "0":

+ 9 - 2
src/Hotline/Authentications/Police110SessionContext.cs

@@ -1,4 +1,7 @@
-using Hotline.Configurations;
+using Hotline.Caching.Interfaces;
+using Hotline.Configurations;
+using Hotline.Settings;
+using Newtonsoft.Json;
 using XF.Domain.Authentications;
 
 namespace Hotline.Authentications
@@ -6,8 +9,12 @@ namespace Hotline.Authentications
     public class Police110SessionContext : ISessionContext
     {
         public const string Key = "Police110SessionContext";
-        public Police110SessionContext(PublicSecurityConfiguration config)
+        public Police110SessionContext(ISystemSettingCacheManager systemSettingCacheManager)
         {
+            var setting = systemSettingCacheManager.GetSetting(SettingConstants.CityBaseConfiguration)?.SettingValue[0];
+            var cityBase = JsonConvert.DeserializeObject<CityBaseConfiguration>(setting);
+            var config = cityBase.PublicSecurity;
+
             UserId = config.UserId;
             UserName = config.UserName;
             OrgId = config.OrgId;

+ 13 - 6
src/Hotline/Authentications/ProvinceSessionContext.cs

@@ -1,5 +1,8 @@
-using Hotline.Configurations;
+using Hotline.Caching.Interfaces;
+using Hotline.Configurations;
+using Hotline.Settings;
 using Microsoft.Extensions.Options;
+using Newtonsoft.Json;
 using XF.Domain.Authentications;
 
 namespace Hotline.Authentications
@@ -8,12 +11,16 @@ namespace Hotline.Authentications
     {
         public const string Key = "ProvinceSessionContext";
 
-        public ProvinceSessionContext(IOptions<CityBaseConfiguration> options)
+        public ProvinceSessionContext(ISystemSettingCacheManager systemSettingCacheManager)
         {
-            UserId = options.Value.CityProvince.UserId;
-            UserName = options.Value.CityProvince.UserName;
-            OrgId = options.Value.CityProvince.OrgId;
-            OrgName = options.Value.CityProvince.OrgName;
+            var setting = systemSettingCacheManager.GetSetting(SettingConstants.CityBaseConfiguration)?.SettingValue[0];
+            var cityBase = JsonConvert.DeserializeObject<CityBaseConfiguration>(setting);
+            var config = cityBase.CityProvince;
+
+            UserId = config.UserId;
+            UserName = config.UserName;
+            OrgId = config.OrgId;
+            OrgName = config.OrgName;
             OrgLevel = 1;
         }
 

+ 2 - 10
src/Hotline/Authentications/SessionContextCreator.cs

@@ -1,13 +1,5 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using Hotline.Configurations;
-using Hotline.Share.Enums.Order;
-using Hotline.Users;
-using XF.Domain.Authentications;
-using static Org.BouncyCastle.Math.EC.ECCurve;
+using XF.Domain.Authentications;
+
 
 namespace Hotline.Authentications
 {

+ 9 - 2
src/Hotline/Authentications/YbEnterpriseSessionContext.cs

@@ -1,4 +1,7 @@
-using Hotline.Configurations;
+using Hotline.Caching.Interfaces;
+using Hotline.Configurations;
+using Hotline.Settings;
+using Newtonsoft.Json;
 using XF.Domain.Authentications;
 
 namespace Hotline.Authentications
@@ -6,8 +9,12 @@ namespace Hotline.Authentications
     public class YbEnterpriseSessionContext : ISessionContext
     {
         public const string Key = "YbEnterpriseSessionContext";
-        public YbEnterpriseSessionContext(CityEnterpriseConfiguration config)
+        public YbEnterpriseSessionContext(ISystemSettingCacheManager systemSettingCacheManager)
         {
+            var setting = systemSettingCacheManager.GetSetting(SettingConstants.CityBaseConfiguration)?.SettingValue[0];
+            var cityBase = JsonConvert.DeserializeObject<CityBaseConfiguration>(setting);
+            var config = cityBase.CityEnterprise;
+
             UserId = config.UserId;
             UserName = config.UserName;
             OrgId = config.OrgId;

+ 9 - 2
src/Hotline/Authentications/ZzptSessionContext.cs

@@ -1,4 +1,7 @@
-using Hotline.Configurations;
+using Hotline.Caching.Interfaces;
+using Hotline.Configurations;
+using Hotline.Settings;
+using Newtonsoft.Json;
 using XF.Domain.Authentications;
 
 namespace Hotline.Authentications
@@ -6,8 +9,12 @@ namespace Hotline.Authentications
     public class ZzptSessionContext : ISessionContext
     {
         public const string Key = "ZzptSessionContext";
-        public ZzptSessionContext(ComprehensiveTreatmentConfiguration config)
+        public ZzptSessionContext(ISystemSettingCacheManager systemSettingCacheManager)
         {
+            var setting = systemSettingCacheManager.GetSetting(SettingConstants.CityBaseConfiguration)?.SettingValue[0];
+            var cityBase = JsonConvert.DeserializeObject<CityBaseConfiguration>(setting);
+            var config = cityBase.ComprehensiveTreatment;
+
             UserId = config.UserId;
             UserName = config.UserName;
             OrgId = config.OrgId;