tangjiang 7 miesięcy temu
rodzic
commit
9c8995ec01

+ 80 - 48
src/DataSharing.Host/Controllers/YiBin/ConvergenceMediaController.cs

@@ -6,12 +6,16 @@ using DataSharing.Share.Dtos.YiBin.ConvergenceMedia;
 using DataSharing.Share.Enums;
 using DataSharing.YiBin.ConvergenceMedia;
 using DotNetCore.CAP;
+using Hotline.Share.Dtos;
+using Hotline.Share.Dtos.DataSharingSearch;
 using Hotline.Share.Dtos.File;
 using Hotline.Share.Dtos.Order;
+using Hotline.Share.Enums.Order;
 using MapsterMapper;
 using MediatR;
 using Microsoft.AspNetCore.Authorization;
 using Microsoft.AspNetCore.Mvc;
+using Novacode;
 using SqlSugar;
 using XF.Domain.Filters;
 using XF.Domain.Repository;
@@ -270,8 +274,7 @@ namespace DataSharing.Host.Controllers.YiBin
             }
 
             //数据处理
-            string AcceptTypeCode = "";
-            AcceptTypeCode = dto.PurTypeID switch
+            string acceptTypeCode = dto.PurTypeID switch
             {
                 17 => "10",
                 18 => "30",
@@ -281,34 +284,44 @@ namespace DataSharing.Host.Controllers.YiBin
                 25 => "40",
                 _ => "",
             };
+            GetOrderList orderList = new()
+            {
+                SourceChannelCode = GetChannelCode(accountDto.PlatformSource),
+                No = dto.AcceptCode,
+                Title = dto.Title,
+                Mobile = dto.Mobile,
+                AcceptTypeCode = acceptTypeCode,
+                StartTime = string.IsNullOrEmpty(dto.StartDate) == false ? null : Convert.ToDateTime(dto.StartDate),
+                EndTime = string.IsNullOrEmpty(dto.EndDate) == false ? null : Convert.ToDateTime(dto.EndDate).AddDays(1)
+            };
 
-            //数据查询
-            RefAsync<int> total = 0;
-            var items = await _dataOrderRepository
-            .Queryable()
-            //.Where(p => p.Source == Hotline.Share.Enums.Order.ESource.ConvergenceMedia.ToString())
-           .Where(p => p.Source == accountDto.PlatformSource)
-            .WhereIF(!string.IsNullOrEmpty(dto.AcceptCode), p => p.OrderNo.Contains(dto.AcceptCode))
-            .WhereIF(!string.IsNullOrEmpty(dto.Title), p => p.Title.Contains(dto.Title))
-            .WhereIF(!string.IsNullOrEmpty(dto.Mobile), p => p.Contact.Contains(dto.Mobile))
-            .WhereIF(!string.IsNullOrEmpty(AcceptTypeCode), p => p.CaseTypeCode == AcceptTypeCode)
-            .WhereIF(!string.IsNullOrEmpty(dto.StartDate), p => p.CaseDate >= Convert.ToDateTime(dto.StartDate))
-            .WhereIF(!string.IsNullOrEmpty(dto.EndDate), p => p.CaseDate < Convert.ToDateTime(dto.EndDate).AddDays(1))
-            .Select(it => new
+            var result = await _fwClient.RequestNoTokenAsync<HotlineClientDataResponse<PagedDto<OrderDto>>>("api/v1/DataSharing/get_order_list_own",
+                "Post", System.Text.Json.JsonSerializer.Serialize(orderList));
+            int nPageCount = 0;
+            List<GetOrderMediaDataListDto> listData = [];
+            if (result != null && result.code == 0)
             {
-                FlowID = it.Id,
-                RowID = SqlFunc.RowNumber($"{it.CaseDate} desc "),
-                Code = it.OrderNo,
-                it.Title,
-                AddDate = it.CaseDate,
-                FromName = it.CaseSource,
-                PurTypeName = it.CaseType,
-                ResultState = it.HandleState
-            })
-              .ToPageListAsync(dto.CurrentPage, dto.PageSize, total);
+                if (result.result.Items != null && result.result.Items.Count > 0)
+                {
+                    //计算总页数
+                    nPageCount = Convert.ToInt32(Math.Ceiling(Convert.ToDouble(result.result.Total) / dto.PageSize.Value));
 
-            //计算总页数
-            int nPageCount = Convert.ToInt32(Math.Ceiling(Convert.ToDouble(total) / dto.PageSize));
+                    foreach (var item in result.result.Items)
+                    {
+                        listData.Add(new GetOrderMediaDataListDto()
+                        {
+                            RowID = ((dto.CurrentPage - 1) * dto.PageSize) + 1 + "",
+                            FlowID = item.Id,
+                            Code = item.No,
+                            Title = item.Title,
+                            AddDate = item.CreationTime.ToString("yyyy-MM-dd HH:mm:ss"),
+                            FromName = item.SourceChannel,
+                            PurTypeName = item.AcceptType,
+                            ResultState = item.Status >= EOrderStatus.Filed ? "办理完成" : "办理中"
+                        });
+                    }
+                }
+            }
 
             List<GetOrderMediaDataDto> returnData = new()
             {
@@ -316,7 +329,7 @@ namespace DataSharing.Host.Controllers.YiBin
             new()
             {
                 PageCount = nPageCount,
-                data = _mapper.Map<IReadOnlyList<GetOrderMediaDataListDto>>(items)
+                data = _mapper.Map<IReadOnlyList<GetOrderMediaDataListDto>>(listData)
             } };
 
             return OpenResponse.Ok(ConvergenceMediaDeResponse<List<GetOrderMediaDataDto>>.Success(returnData, "成功"));
@@ -351,28 +364,47 @@ namespace DataSharing.Host.Controllers.YiBin
             if (!string.IsNullOrEmpty(strResult))
                 return OpenResponse.Ok(ConvergenceMediaDeResponse<List<ReturnData>>.Failed(ReturnData.ReturnDataInfo(strResult), "0", "失败"));
 
+            GetOrderNoPwdDto getOrder = new()
+            {
+                No = dto.AcceptCode,
+                Password = dto.AcceptPwd,
+                SourceChannelCode = GetChannelCode(accountDto.PlatformSource)
+            };
+            //var result = await _fwClient.RequestNoTokenAsync<HotlineClientDataResponse<OrderDto>>("api/v1/DataSharing/get_order_detail_by_no_pwd",
+            //    "Post", System.Text.Json.JsonSerializer.Serialize(getOrder));
+            //if (result != null && result.code == 0)
+            //{
+            //    if (result.result != null)
+            //    {
+            //        MediaOrderDetailDataDto detailDataDto = new()
+            //        {
+            //            FlowID
+            //        };
+            //    }
+            //}
+
             //查询数据
             var items = await _dataOrderRepository
-             .Queryable()
-             .Where(p => p.OrderNo == dto.AcceptCode)
-             .Where(p => p.Password == dto.AcceptPwd)
-             .Where(p => p.Source == accountDto.PlatformSource)
-              .Select(it => new
-              {
-                  FlowID = it.Id,
-                  FlowCode = it.OrderNo,
-                  FlowTitle = it.Title,
-                  FlowFromName = it.CaseSource,
-                  FlowPurTypeName = it.CaseType,
-                  FlowConTypeName = it.HotspotName,
-                  FlowAddDate = it.CaseDate,
-                  FlowLKName = it.FromName,
-                  FlowBMName = it.ActualHandleOrgName,
-                  FlowRSFlagName = it.HandleState,
-                  FlowContent = it.Content,
-                  FlowResult = it.ActualOpinion,
-              })
-              .ToListAsync();
+     .Queryable()
+     .Where(p => p.OrderNo == dto.AcceptCode)
+     .Where(p => p.Password == dto.AcceptPwd)
+     .Where(p => p.Source == accountDto.PlatformSource)
+      .Select(it => new
+      {
+          FlowID = it.Id,
+          FlowCode = it.OrderNo,
+          FlowTitle = it.Title,
+          FlowFromName = it.CaseSource,
+          FlowPurTypeName = it.CaseType,
+          FlowConTypeName = it.HotspotName,
+          FlowAddDate = it.CaseDate,
+          FlowLKName = it.FromName,
+          FlowBMName = it.ActualHandleOrgName,
+          FlowRSFlagName = it.HandleState,
+          FlowContent = it.Content,
+          FlowResult = it.ActualOpinion,
+      })
+      .ToListAsync();
 
             if (items == null || items.Count == 0)
                 return OpenResponse.Ok(ConvergenceMediaDeResponse<List<ReturnData>>.Failed(ReturnData.ReturnDataInfo("信件受理中!"), "0", "失败"));

+ 8 - 0
src/DataSharing.Share/Dtos/HotlineSetting/HotlineClientResponse.cs

@@ -1,5 +1,13 @@
 namespace DataSharing.Share.Dtos.HotlineSetting
 {
+    public class HotlineClientDataResponse<TData>
+    {
+        public TData result { get; set; }
+        public int code { get; set; }
+        public string message { get; set; }
+        public string error { get; set; }
+    }
+
     public class HotlineClientResponse
     {
         public AddOrderRes result { get; set; }