TANG JIANG 1 éve
szülő
commit
8f74b808b8

+ 13 - 1
src/Sharing.Province/DefaultPusher.cs

@@ -108,8 +108,20 @@ public class DefaultPusher : IProvincePusher
         var response = await _xieTongClient.RequestAsync<SendSuperviseResultInfoRequest, ProvinceResponse>(request, cancellationToken);
         return response?.ReturnInfo;
     }
-    #endregion
 
+    /// <summary>
+    /// 工单发起甄别接
+    /// </summary>
+    /// <param name="request"></param>
+    /// <param name="cancellationToken"></param>
+    /// <returns></returns>
+    public async Task<BaseProvinceResponse> PushScreenCaseInfoSendAsync(ScreenCaseInfoSendRequest request, CancellationToken cancellationToken)
+    {
+        var response = await _xieTongClient.RequestAsync<ScreenCaseInfoSendRequest, ProvinceResponse>(request, cancellationToken);
+        return response?.ReturnInfo;
+    }
+    #endregion
+    
     #region 汇聚-第二批次
     /// <summary>
     /// 服务工单受理

+ 62 - 0
src/Sharing.Province/Dtos/XieTong/Send/ScreenCaseInfoSendRequest.cs

@@ -0,0 +1,62 @@
+using Microsoft.AspNetCore.Http;
+using System.Text.Json.Serialization;
+
+namespace Sharing.Province.Dtos.XieTong.Send
+{
+    /// <summary>
+    /// 工单发起甄别
+    /// </summary>
+    public class ScreenCaseInfoSendRequest : ProvinceRequest<ScreenCaseInfoSendInfo>
+    {
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <returns></returns>
+        public override string GetRequestUrl() => "screen_case_info_send";
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <returns></returns>
+        public override string GetHttpMethod() => HttpMethods.Post;
+    }
+
+    /// <summary>
+    /// 工单发起甄别
+    /// </summary>
+    public class ScreenCaseInfoSendInfo : BaseModel
+    {
+        /// <summary>
+        /// 申请人员
+        /// </summary>
+        [JsonPropertyName("APPLY_NAME")]
+        public string ApplyName { get; set; }
+
+        /// <summary>
+        /// 申请时间
+        /// </summary>
+        [JsonPropertyName("APPLY_TIME")]
+        public DateTime? ApplyTime { get; set; }
+
+        /// <summary>
+        /// 申请部门
+        /// </summary>
+        [JsonPropertyName("APPLY_OUNAME")]
+        public string ApplyOuName { get; set; }
+
+        /// <summary>
+        /// 申请原因
+        /// </summary>
+        [JsonPropertyName("APPLY_REASON")]
+        public string ApplyReason { get; set; }
+
+        /// <summary>
+        /// 申请人员
+        /// </summary>
+        [JsonPropertyName("APPLY_TYPE")]
+        public string ApplyType { get; set; }
+
+
+
+    }
+}

+ 62 - 0
src/Sharing.Province/Handlers/XieTong/ScreenCaseInfoSendHandler.cs

@@ -0,0 +1,62 @@
+using MapsterMapper;
+using MediatR;
+using Sharing.Notifications.XieTong;
+using Sharing.Province.Dtos.XieTong.Send;
+using Sharing.Province.XieTong.Send;
+
+namespace Sharing.Province.Handlers.XieTong
+{
+    public class ScreenCaseInfoSendHandler : INotificationHandler<ScreenCaseInfoSendNotification>
+    {
+        private readonly IChannelConfigurationManager _channelConfigurationManager;
+        private readonly PusherProvider _pusherProvider;
+        private readonly IMapper _mapper;
+        private readonly IScreenCaseInfoSendRepository _screenCaseInfoSendRepository;
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="channelConfigurationManager"></param>
+        /// <param name="pusherProvider"></param>
+        /// <param name="mapper"></param>
+        /// <param name="screenCaseInfoSendRepository"></param>
+        public ScreenCaseInfoSendHandler(IChannelConfigurationManager channelConfigurationManager, PusherProvider pusherProvider, IMapper mapper
+            , IScreenCaseInfoSendRepository screenCaseInfoSendRepository)
+        {
+            _channelConfigurationManager = channelConfigurationManager;
+            _pusherProvider = pusherProvider;
+            _mapper = mapper;
+            _screenCaseInfoSendRepository = screenCaseInfoSendRepository;
+        }
+
+        /// <summary>
+        /// 服务工单申请延时
+        /// </summary>
+        /// <param name="notification"></param>
+        /// <param name="cancellationToken"></param>
+        /// <returns></returns>
+        public async Task Handle(ScreenCaseInfoSendNotification notification, CancellationToken cancellationToken = default)
+        {
+            var pusher = _pusherProvider.CreatePusher(_channelConfigurationManager);
+
+            var dataReceive = _mapper.Map<ScreenCaseInfoSendInfo>(notification.Data);
+
+            var request = new ScreenCaseInfoSendRequest();
+            request.SetData(dataReceive);
+
+            var response = await pusher.PushScreenCaseInfoSendAsync(request, cancellationToken);
+
+            //如果推送成功修改数据状态
+            if (response != null)
+            {
+                if (response.Code == "1")
+                    notification.Data.SyncState = "1";
+                else
+                    notification.Data.SyncState = "2";
+
+                notification.Data.ReturnResult = Newtonsoft.Json.JsonConvert.SerializeObject(response);
+                await _screenCaseInfoSendRepository.UpdateAsync(notification.Data);
+            }
+        }
+    }
+}

+ 8 - 0
src/Sharing.Province/IProvincePusher.cs

@@ -65,6 +65,14 @@ public interface IProvincePusher
     /// <param name="cancellationToken"></param>
     /// <returns></returns>
     Task<BaseProvinceResponse> PushSendSuperviseResultInfoAsync(SendSuperviseResultInfoRequest request, CancellationToken cancellationToken);
+
+    /// <summary>
+    /// 工单发起甄别接
+    /// </summary>
+    /// <param name="request"></param>
+    /// <param name="cancellationToken"></param>
+    /// <returns></returns>
+    Task<BaseProvinceResponse> PushScreenCaseInfoSendAsync(ScreenCaseInfoSendRequest request, CancellationToken cancellationToken);
     #endregion
 
     #region 汇聚-第二批次

+ 11 - 0
src/Sharing.Province/SmartPusher.cs

@@ -87,6 +87,17 @@ public class SmartPusher : IProvincePusher
     {
         throw new NotImplementedException();
     }
+
+    /// <summary>
+    /// 工单发起甄别接
+    /// </summary>
+    /// <param name="request"></param>
+    /// <param name="cancellationToken"></param>
+    /// <returns></returns>
+    public async Task<BaseProvinceResponse> PushScreenCaseInfoSendAsync(ScreenCaseInfoSendRequest request, CancellationToken cancellationToken)
+    {
+        throw new NotImplementedException();
+    }
     #endregion
 
     #region 汇聚-第二批次

+ 14 - 0
src/Sharing.Repository/Province/XieTong/Send/ScreenCaseInfoSendRepository.cs

@@ -0,0 +1,14 @@
+using Sharing.Province.XieTong.Send;
+using SqlSugar;
+using XF.Domain.Dependency;
+
+namespace Sharing.Repository.Province.XieTong.Send
+{
+    public class ScreenCaseInfoSendRepository : BaseRepository<ScreenCaseInfoSend>, IScreenCaseInfoSendRepository, IScopeDependency
+    {
+        public ScreenCaseInfoSendRepository(ISugarUnitOfWork<SharingDbContext> uow) : base(uow)
+        {
+
+        }
+    }
+}

+ 11 - 0
src/Sharing/Notifications/XieTong/ScreenCaseInfoSendNotification.cs

@@ -0,0 +1,11 @@
+using MediatR;
+using Sharing.Province.XieTong.Send;
+
+namespace Sharing.Notifications.XieTong
+{
+    /// <summary>
+    /// 工单发起甄别  
+    /// </summary>
+    /// <param name="Data"></param>
+    public record ScreenCaseInfoSendNotification(ScreenCaseInfoSend Data) : INotification;
+}

+ 8 - 0
src/Sharing/Province/XieTong/Send/IScreenCaseInfoSendRepository.cs

@@ -0,0 +1,8 @@
+using XF.Domain.Repository;
+
+namespace Sharing.Province.XieTong.Send
+{
+    public interface IScreenCaseInfoSendRepository : IRepository<ScreenCaseInfoSend>
+    {
+    }
+}

+ 43 - 0
src/Sharing/Province/XieTong/Send/ScreenCaseInfoSend.cs

@@ -0,0 +1,43 @@
+using Sharing.Province.HuiJu;
+using SqlSugar;
+using System.ComponentModel;
+
+namespace Sharing.Province.XieTong.Send
+{
+    /// <summary>
+    /// 工单发起甄别接   
+    /// </summary>
+    [Description("工单发起甄别")]
+    public class ScreenCaseInfoSend : BaseSendAllResult
+    {
+        /// <summary>
+        /// 申请人员
+        /// </summary>
+        [SugarColumn(ColumnDescription = "申请人员", ColumnDataType = "varchar(50)")]
+        public string ApplyName { get; set; }
+
+        /// <summary>
+        /// 申请时间
+        /// </summary>
+        [SugarColumn(ColumnDescription = "申请时间")]
+        public DateTime? ApplyTime { get; set; }
+
+        /// <summary>
+        /// 申请部门
+        /// </summary>
+        [SugarColumn(ColumnDescription = "申请部门", ColumnDataType = "varchar(200)")]
+        public string ApplyOuName { get; set; }
+
+        /// <summary>
+        /// 申请原因
+        /// </summary>
+        [SugarColumn(ColumnDescription = "申请原因", ColumnDataType = "varchar(1000)")]
+        public string ApplyReason { get; set; }
+
+        /// <summary>
+        /// 申请人员
+        /// </summary>
+        [SugarColumn(ColumnDescription = "申请类型", ColumnDataType = "varchar(10)")]
+        public string ApplyType { get; set; }
+    }
+}