Browse Source

Merge branch 'test_feature_task363' of http://110.188.24.182:10023/Fengwo/hotline into test_feature_task363

Dun.Jason 1 month ago
parent
commit
78486d3858

+ 20 - 5
src/Hotline.Api/Controllers/EarlyController.cs

@@ -1,15 +1,24 @@
-using DocumentFormat.OpenXml.Drawing.Diagrams;
+using DocumentFormat.OpenXml.Drawing.Charts;
+using DocumentFormat.OpenXml.Drawing.Diagrams;
+using DocumentFormat.OpenXml.Vml;
+using DocumentFormat.OpenXml.Wordprocessing;
+using Hotline.Application.Early;
+using Hotline.Application.Tools;
 using Hotline.Caching.Interfaces;
 using Hotline.Caching.Services;
 using Hotline.Early;
+using Hotline.File;
 using Hotline.Orders;
 using Hotline.Repository.SqlSugar.Extensions;
 using Hotline.Settings;
 using Hotline.Share.Dtos;
 using Hotline.Share.Dtos.Early;
+using Hotline.Share.Dtos.ExportWord;
 using Hotline.Share.Dtos.Order;
+using Hotline.Share.Enums.Article;
 using Hotline.Share.Enums.Early;
 using Hotline.Share.Enums.Order;
+using Hotline.Share.Tools;
 using MapsterMapper;
 using Microsoft.AspNetCore.Mvc;
 using SqlSugar;
@@ -31,12 +40,14 @@ namespace Hotline.Api.Controllers
         private readonly IRepository<EarlyWarningOrderDetail> _earlyWarningOrderDetailRepository;
         private readonly IRepository<EarlyWarningPush> _earlyWarningPushRepository;
         private readonly IRepository<EarlyWarningPushDetail> _earlyWarningPushDetailRepository;
+        private readonly IEarlyReportProvder _earlyReportProvder;
+        private readonly IFileDomainService _fileDomainService;
         private readonly ISessionContext _sessionContext;
         private readonly IOrderRepository _orderRepository;
 
 
 
-        public EarlyController(IRepository<EarlyWarningSetting> earlyWarningRepository, IMapper mapper, ISystemDicDataCacheManager sysDicDataCacheManager, IRepository<OrderWord> orderWrodRepository, IRepository<EarlyWarningOrder> earlyWarningOrderRepository, IRepository<EarlyWarningOrderDetail> earlyWarningOrderDetailRepository, IRepository<EarlyWarningPush> earlyWarningPushRepository, IRepository<EarlyWarningPushDetail> earlyWarningPushDetailRepository, ISessionContext sessionContext, IOrderRepository orderRepository)
+        public EarlyController(IRepository<EarlyWarningSetting> earlyWarningRepository, IMapper mapper, ISystemDicDataCacheManager sysDicDataCacheManager, IRepository<OrderWord> orderWrodRepository, IRepository<EarlyWarningOrder> earlyWarningOrderRepository, IRepository<EarlyWarningOrderDetail> earlyWarningOrderDetailRepository, IRepository<EarlyWarningPush> earlyWarningPushRepository, IRepository<EarlyWarningPushDetail> earlyWarningPushDetailRepository, IEarlyReportProvder earlyReportProvder,IFileDomainService fileDomainService, ISessionContext sessionContext, IOrderRepository orderRepository)
         {
             _earlyWarningRepository = earlyWarningRepository;
             _mapper = mapper;
@@ -46,6 +57,8 @@ namespace Hotline.Api.Controllers
             _earlyWarningOrderDetailRepository = earlyWarningOrderDetailRepository;
             _earlyWarningPushRepository = earlyWarningPushRepository;
             _earlyWarningPushDetailRepository = earlyWarningPushDetailRepository;
+            this._earlyReportProvder = earlyReportProvder;
+            this._fileDomainService = fileDomainService;
             _sessionContext = sessionContext;
             _orderRepository = orderRepository;
         }
@@ -216,8 +229,11 @@ namespace Hotline.Api.Controllers
             if (dto.OperateModel == 3)
             {
                 //准备数据
-                var reportDto = GetEarlyReport(dto.EarlyWarningPushDetails,earlySettingPush);
-                
+                var reportDto = GetEarlyReport(dto.EarlyWarningPushDetails,earlySettingPush);               
+               
+                var html = _earlyReportProvder.PushReport(reportDto);
+
+                //await _fileDomainService.UploadFileFromMemoryAsync(html.HtmlToWord(), "报表" + EFileType.word.GetFileExtension(), EFileType.word);
                 //推送生成报告消息TODO
                 earlySettingPush.PushReportUrl = "";
             }
@@ -249,7 +265,6 @@ namespace Hotline.Api.Controllers
 
             return reportDto;
         }
-
         /// <summary>
         /// 获取推送报告
         /// </summary>

+ 7 - 1
src/Hotline.Api/Controllers/TestController.cs

@@ -1,4 +1,5 @@
-using DotNetCore.CAP;
+using DocumentFormat.OpenXml.Office.CustomUI;
+using DotNetCore.CAP;
 using Hotline.Ai.Quality;
 using Hotline.Application.CallCenter;
 using Hotline.Application.ExportExcel;
@@ -28,6 +29,7 @@ using Hotline.Settings.Hotspots;
 using Hotline.Settings.TimeLimitDomain;
 using Hotline.Settings.TimeLimits;
 using Hotline.Share.Dtos;
+using Hotline.Share.Dtos.ExportWord;
 using Hotline.Share.Dtos.FlowEngine.Workflow;
 using Hotline.Share.Dtos.Home;
 using Hotline.Share.Dtos.Order;
@@ -42,6 +44,8 @@ using Hotline.Share.Enums.Order;
 using Hotline.Share.Mq;
 using Hotline.ThirdAccountDomainServices.Interfaces;
 using Hotline.Users;
+using J2N.Text;
+using JiebaNet.Segmenter.Common;
 using Mapster;
 using MapsterMapper;
 using MediatR;
@@ -51,6 +55,7 @@ using Microsoft.Extensions.Options;
 using MiniExcelLibs;
 using NETCore.Encrypt;
 using SqlSugar;
+using System.Text;
 using XC.RSAUtil;
 using XF.Domain.Authentications;
 using XF.Domain.Cache;
@@ -1430,4 +1435,5 @@ ICallApplication callApplication,
     //    await _capPublisher.PublishAsync(Hotline.Share.Mq.EventNames.HotlineOrderFiled, orderFlowDto, cancellationToken: cancellationToken);
     //}
 
+    
 }

+ 393 - 0
src/Hotline.Application/Early/EarlyReportProvider.cs

@@ -0,0 +1,393 @@
+using Hotline.Application.ExportWord;
+using Hotline.Share.Dtos.Early;
+using Hotline.Share.Dtos.ExportWord;
+using XF.Domain.Dependency;
+
+namespace Hotline.Application.Early
+{
+    public class EarlyReportProvider : IEarlyReportProvder, IScopeDependency
+    {
+        public string PushReport(EarlyReportDto earlyReportDtoreportDto)
+        {
+            string summarize = CreateSummarize(earlyReportDtoreportDto);
+
+            var reportDto = new ReportDto
+            {
+                CssStyle = "padding-left: 10%;padding-right: 10%;padding-top: 10px;",
+                Title = new TitleDto
+                {
+                    Content = earlyReportDtoreportDto.ReportName,
+                    CssStyle = "font-weight:bolder;color: red;font-size: 50px;font-family:宋体; width: 100 %; text-align: center; word-spacing: 10px;letter-spacing: 2px; margin-bottom: 10; line-height: 2; "
+                },
+                SubTitleDtos = new List<SubTitleDto>
+                {
+                    new SubTitleDto
+                    {
+                        CssStyle = "font-weight: bold; font-size: 24px;font-family:方正楷体_GBK;width: 100%;\r\n text-align: center;letter-spacing: 5px;line-height: 1.5;",
+                        Content = "2025年第32期"
+                    },
+                    new SubTitleDto
+                    {
+                        CssStyle = "font-weight: bold; font-size: 24px;font-family:方正楷体_GBK;width: 100%;\r\n        text-align: center;letter-spacing: 5px;line-height: 1.5;",
+                        Content = "(截至3月17日12时)"
+                    },
+                    new SubTitleDto
+                    {
+                        CssStyle = "font-weight: bold; font-size: 20px;font-family:楷体_GB2312;\r\n    width: 100%;letter-spacing: 5px;line-height: 1.5;\r\n    border-bottom:2px solid red;float: left;margin-bottom: 20px;",
+                        Children =  new List<SubTitleDto>
+                        {
+                             new SubTitleDto
+                             {
+                                 CssStyle = "float: left;",
+                                 Content = "市政务服务非公经济局"
+                             },
+                            new SubTitleDto
+                            {
+                                CssStyle="float: right;",
+                                Content = earlyReportDtoreportDto.ReportPushTime.ToString()
+                            }
+                        }
+                    }
+                },
+                ContentDto = new ContentDto
+                {
+                    CssStyle = "font-weight: normal; font-size: 18px;font-family:宋体;width: 100%;letter-spacing: 5px;line-height: 1.5;",
+                    TitleDto = new TitleDto
+                    {
+                        Content = "领导批示:",
+                        CssStyle = "font-weight: normal; font-size: 22px;font-family:黑体;width: 100%;letter-spacing: 5px;line-height: 1.5;"
+                    },
+                    ParagraphDtos = new List<ParagraphDto>
+                    {
+                        new ParagraphDto
+                        {
+                            CssStyle = "text-indent: 2rem;",
+                            Content = summarize
+                        }
+                    }
+                }
+            };
+            int index = FillParagraphes(earlyReportDtoreportDto, reportDto);
+
+            var olderOrderName = $"{earlyReportDtoreportDto.ReportPushTime.Month}月{earlyReportDtoreportDto.ReportPushTime.Day}日重点诉求处置情况";
+
+            reportDto.ContentDto.ParagraphDtos.Add(new ParagraphDto
+            {
+                Content = $"附件1:{olderOrderName}",
+                CssStyle = "text-indent: 2rem;",
+                SortIndex = ++index
+            });
+
+            var orderName = "前期重点问题办结情况";
+            reportDto.ContentDto.ParagraphDtos.Add(new ParagraphDto
+            {
+                Content = $"附件2:{orderName}",
+                CssStyle = "text-indent: 2rem;",
+                SortIndex = ++index
+            });
+
+            reportDto.AttachmentDtos = [];
+            AttachmentDto orderAttachmentDto = CreateOrderAttachment(earlyReportDtoreportDto, olderOrderName);
+            reportDto.AttachmentDtos.Add(orderAttachmentDto);
+            AttachmentDto fileOrderAttachmentDto = CreateFileOrderAttachment(earlyReportDtoreportDto, orderName);
+            reportDto.AttachmentDtos.Add(fileOrderAttachmentDto);
+
+            reportDto.BottomDtos = new List<BaseReportDto>
+            {
+                new BaseReportDto
+                {
+                    CssStyle = "font-weight: normal; font-size: 18px;font-family:楷体_GB2312;\r\n    width: 100%;letter-spacing: 2px;line-height: 1;\r\n    border-bottom:1px solid #000;float: left;margin-bottom: 20px;",
+                    Children = new List<BaseReportDto>
+                    {
+                        new BaseReportDto
+                        {
+                            CssStyle = "float: left;",
+                            Content = "信息公开属性:"
+                        },new BaseReportDto
+                        {
+                            CssStyle = "font-weight: bolder;float: left;",
+                            Content = "不予公开"
+                        }
+                    }
+                },
+                new BaseReportDto
+                {
+                    CssStyle = "font-weight: normal; font-size: 18px;font-family:楷体_GB2312;\r\n    width: 100%;letter-spacing: 2px;line-height: 1;\r\n    border-bottom:1px solid #000;float: left;margin-bottom: 20px;",
+                    Content = "主送:市长,常务副市长、分管副市长,联系副秘书长。"
+                },new BaseReportDto
+                {
+                    CssStyle="font-weight: normal; font-size: 18px;font-family:楷体_GB2312;\r\n    width: 100%;letter-spacing: 2px;line-height: 1;float: left;margin-bottom: 20px;",
+                    Children = new List<BaseReportDto>
+                    {
+                        new BaseReportDto
+                        {
+                            CssStyle = "float:left;",
+                            Content = "市政务服务非公经济发展局"
+                        },
+                        new BaseReportDto
+                        {
+                            CssStyle = "float:right;",
+                            Content = $"{earlyReportDtoreportDto.ReportPushTime.ToString()}印发"
+                        }
+                    }
+                }
+            };
+
+            return reportDto.RenderHtml();
+        }
+
+        private static AttachmentDto CreateOrderAttachment(EarlyReportDto earlyReportDtoreportDto, string olderOrderName)
+        {
+            TableDto orderTableDto = CreateOrderTable(earlyReportDtoreportDto);
+            var attachmentDto = new AttachmentDto
+            {
+                Title = new TitleDto
+                {
+                    CssStyle = "font-weight: bold; font-size: 18px;font-family:宋体;width: 100%; float:right;",
+                    Content = "附件1"
+                },
+                SubTitleDtos = new List<SubTitleDto>
+               {
+                   new SubTitleDto
+                   {
+                       CssStyle = "font-weight: bold; font-size: 24px;font-family:宋体;width: 100%; text-align: center;margin-bottom: 20px;",
+                       Content = olderOrderName
+                   }
+               },
+                TableDtos = new List<TableDto>
+                {
+                   orderTableDto
+                }
+            };
+            return attachmentDto;
+        }
+
+        private static AttachmentDto CreateFileOrderAttachment(EarlyReportDto earlyReportDtoreportDto, string olderOrderName)
+        {
+            TableDto orderTableDto = CreateFileOrderTable(earlyReportDtoreportDto);
+            var attachmentDto = new AttachmentDto
+            {
+                Title = new TitleDto
+                {
+                    CssStyle = "font-weight: bold; font-size: 18px;font-family:宋体;width: 100%; float:right;",
+                    Content = "附件2"
+                },
+                SubTitleDtos = new List<SubTitleDto>
+               {
+                   new SubTitleDto
+                   {
+                       CssStyle = "font-weight: bold; font-size: 24px;font-family:宋体;width: 100%; text-align: center;margin-bottom: 20px;",
+                       Content = olderOrderName
+                   }
+               },
+                TableDtos = new List<TableDto>
+                {
+                   orderTableDto
+                }
+            };
+            return attachmentDto;
+        }
+
+        private static TableDto CreateFileOrderTable(EarlyReportDto earlyReportDtoreportDto)
+        {
+            var tableDto = new TableDto
+            {
+                CssStyle = "border-collapse: collapse;"
+            };
+            tableDto.HeadDto.RowDtos.Add(new RowDto
+            {
+                ColumnDtos = new List<ColumnDto>
+                {
+                    new ColumnDto
+                        {
+                            CssStyle = "border: solid 1px #000;width: 10%;text-align: center;",
+                            Content = "序号",
+                        },
+                    new ColumnDto
+                        {
+                            CssStyle = "border: solid 1px #000;width: 10%;text-align: center;",
+                            Content = "期刊",
+                        },
+                        new ColumnDto
+                        {
+                            CssStyle = "border: solid 1px #000;width: 10%;text-align: center;",
+                            Content = "诉求来源",
+                        },
+                        new ColumnDto
+                        {
+                            CssStyle = "border: solid 1px #000;width: 20%;text-align: center;",
+                            Content = "问题类型",
+                        },
+                        new ColumnDto
+                        {
+                            CssStyle = "border: solid 1px #000;width: 25%;text-align: center;",
+                            Content = "诉求内容",
+                        },
+                        new ColumnDto
+                        {
+                            CssStyle = "border: solid 1px #000;width: 25%;text-align: center;",
+                            Content = "答复情况",
+                        }
+                }
+            });
+            var number = 1;
+            earlyReportDtoreportDto.ReportFiledOrderDetails.ForEach(item =>
+            {
+                tableDto.BodyDto.RowDtos.Add(new RowDto
+                {
+                    CssStyle = "border: solid 1px #000;",
+                    ColumnDtos = new List<ColumnDto>
+                    {
+                        new ColumnDto
+                        {
+                            CssStyle = "border: solid 1px #000;text-align: center;",
+                            Content = number.ToString(),
+                        },
+                        new ColumnDto
+                        {
+                            CssStyle = "border: solid 1px #000;text-align: center;",
+                            Content = item.ReportName,
+                        },
+                        new ColumnDto
+                        {
+                            CssStyle = "border: solid 1px #000;text-align: center;",
+                            Content = item.OneHotSportName,
+                        },
+                        new ColumnDto
+                        {
+                            CssStyle = "border: solid 1px #000;text-align: center;",
+                            Content = item.HotSportName,
+                        },
+                        new ColumnDto
+                        {
+                            CssStyle = "border: solid 1px #000;",
+                            Content = item.Content,
+                        },
+                        new ColumnDto
+                        {
+                            CssStyle = "border: solid 1px #000;",
+                            Content = item.ActualOpinion,
+                        }
+                    }
+                });
+                number++;
+            });
+            return tableDto;
+        }
+
+        private static TableDto CreateOrderTable(EarlyReportDto earlyReportDtoreportDto)
+        {
+            var tableDto = new TableDto
+            {
+                CssStyle = "border-collapse: collapse;"
+            };
+            tableDto.HeadDto.RowDtos.Add(new RowDto
+            {
+                ColumnDtos = new List<ColumnDto>
+                {
+                    new ColumnDto
+                        {
+                            CssStyle = "border: solid 1px #000;width: 10%;text-align: center;",
+                            Content = "序号",
+                        },
+                        new ColumnDto
+                        {
+                            CssStyle = "border: solid 1px #000;width: 20%;text-align: center;",
+                            Content = "诉求来源",
+                        },
+                        new ColumnDto
+                        {
+                            CssStyle = "border: solid 1px #000;width: 20%;text-align: center;",
+                            Content = "问题类型",
+                        },
+                        new ColumnDto
+                        {
+                            CssStyle = "border: solid 1px #000;width: 25%;text-align: center;",
+                            Content = "诉求内容",
+                        },
+                        new ColumnDto
+                        {
+                            CssStyle = "border: solid 1px #000;width: 25%;text-align: center;",
+                            Content = "办理情况",
+                        }
+                }
+            });
+            var number = 1;
+            earlyReportDtoreportDto.ReportOrderDetails.ForEach(item =>
+            {
+                tableDto.BodyDto.RowDtos.Add(new RowDto
+                {
+                    CssStyle = "border: solid 1px #000;",
+                    ColumnDtos = new List<ColumnDto>
+                    {
+                        new ColumnDto
+                        {
+                            CssStyle = "border: solid 1px #000;text-align: center;",
+                            Content = number.ToString(),
+                        },
+                        new ColumnDto
+                        {
+                            CssStyle = "border: solid 1px #000;text-align: center;",
+                            Content = item.OneHotSportName,
+                        },
+                        new ColumnDto
+                        {
+                            CssStyle = "border: solid 1px #000;text-align: center;",
+                            Content = item.HotSportName,
+                        },
+                        new ColumnDto
+                        {
+                            CssStyle = "border: solid 1px #000;",
+                            Content = item.Content,
+                        },
+                        new ColumnDto
+                        {
+                            CssStyle = "border: solid 1px #000;",
+                            Content = item.ActualOpinion,
+                        }
+                    }
+                });
+                number++;
+            });
+            return tableDto;
+        }
+
+        private static int FillParagraphes(EarlyReportDto earlyReportDtoreportDto, ReportDto reportDto)
+        {
+            var index = 1;
+            earlyReportDtoreportDto.ReportHotDetails.ForEach(item =>
+            {
+                reportDto.ContentDto.ParagraphDtos.Add(new ParagraphDto
+                {
+                    titleDto = new TitleDto
+                    {
+                        Content = item.HotName,
+                        CssStyle = "text-indent: 2rem;font-weight: bolder;",
+                    },
+                    Content = item.Content,
+                    CssStyle = "text-indent: 2rem;",
+                    SortIndex = index
+                });
+                index++;
+            });
+            return index;
+        }
+
+        private static string CreateSummarize(EarlyReportDto earlyReportDtoreportDto)
+        {
+            var hotDetails = new List<string>();
+            earlyReportDtoreportDto.ReportHotDetails.ForEach(item =>
+            {
+                hotDetails.Add($"{item.HotName}{item.Content}件");
+            });
+            var areaDetails = new List<string>();
+            earlyReportDtoreportDto.ReportAreaDetails.ForEach(item =>
+            {
+                areaDetails.Add($"{item.AreaName}{item.Count}件");
+            });
+            var summarize = $"{earlyReportDtoreportDto.ReportPushTime},市12345热线共受理重点领域问题{earlyReportDtoreportDto.ReportHotDetails.Sum(x => x.Count)}件,其中,{string.Join("、", hotDetails)}。从区域分布来看,{string.Join(",", areaDetails)}。";
+            return summarize;
+        }
+
+    }
+}

+ 14 - 0
src/Hotline.Application/Early/IEarlyReportProvder.cs

@@ -0,0 +1,14 @@
+using Hotline.Share.Dtos.Early;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Hotline.Application.Early
+{
+    public interface IEarlyReportProvder
+    {
+        public string PushReport(EarlyReportDto earlyReportDto);
+    }
+}

+ 218 - 0
src/Hotline.Application/ExportWord/IWordExportTemplateExtensions.cs

@@ -1,5 +1,6 @@
 using Hotline.Share.Dtos.ExportWord;
 using Hotline.Share.Enums.ExportWord;
+using JiebaNet.Segmenter.Common;
 using System.Reflection;
 
 namespace Hotline.Application.ExportWord
@@ -65,5 +66,222 @@ namespace Hotline.Application.ExportWord
 
             return list;
         }
+
+        public static string RenderHtml(this ReportDto reportDto)
+        {
+            var body = string.Empty;
+            if (reportDto != null)
+            {
+                var content = string.Empty;
+                content = CreateTitle(reportDto.Title, content);
+                content = CreateSubTitles(reportDto, content);
+                content = CreateParagraphes(reportDto, content);
+                content = CreateAttachments(reportDto, content);
+                content = CreateBottoms(reportDto, content);
+                body = $"<body style=\"{reportDto.CssStyle}\">{content}</body>";
+            }
+            var result = $"<html>{body}</html>";
+
+            return result;
+        }
+
+        #region 渲染HTML
+        private static string CreateBottoms(ReportDto reportDto, string content)
+        {
+            if (reportDto.BottomDtos != null && reportDto.BottomDtos.Any())
+            {
+                reportDto.BottomDtos.OrderBy(x => x.SortIndex).ToList().ForEach(item =>
+                {
+
+                    content = CreateBottoms(item, content);
+                });
+            }
+
+            return content;
+        }
+
+        private static string CreateAttachments(ReportDto reportDto, string content)
+        {
+            if (reportDto.AttachmentDtos != null && reportDto.AttachmentDtos.Any())
+            {
+                var attachments = string.Empty;
+                reportDto.AttachmentDtos.ForEach(item =>
+                {
+                    var attachment = string.Empty;
+                    if (item.Title != null)
+                    {
+                        attachment = $"<div style=\"{item.Title}\">{item.Content}</div>";
+                    }
+
+                    if (item.SubTitleDtos != null && item.SubTitleDtos.Any())
+                    {
+                        item.SubTitleDtos.ForEach(sub =>
+                        {
+                            attachment = CreateSubTitle(sub, attachment);
+                        });
+                    }
+
+                    if (item.TableDtos != null && item.TableDtos.Any())
+                    {
+                        item.TableDtos.ForEach(tab =>
+                        {
+                            var body = $"";
+                            var head = $"";
+                            var table = $"<table style=\"{tab.CssStyle}\">{head}{body}</div>";
+                            if (tab.HeadDto != null)
+                            {
+                                tab.HeadDto.RowDtos.ForEach(row =>
+                                {
+                                    string rowStr = CreateRow(row);
+
+                                    head += rowStr;
+                                });
+
+                                head = $"<thead style=\"{tab.HeadDto.CssStyle}\">{head}</thead>";
+                            }
+
+                            if (tab.BodyDto != null)
+                            {
+                                tab.BodyDto.RowDtos.ForEach(row =>
+                                {
+                                    string rowStr = CreateRow(row);
+
+                                    body += rowStr;
+                                });
+
+                                body = $"<tbody style=\"{tab.BodyDto.CssStyle}\">{body}</tbody>";
+                            }
+
+                        });
+                    }
+
+                    attachments += attachment;
+                });
+                content += attachments;
+            }
+
+            return content;
+        }
+
+        private static string CreateRow(RowDto row)
+        {
+            var colStr = $"";
+            var rowStr = $"<tr style=\"{row.CssStyle}\">{colStr}</tr>";
+            row.ColumnDtos.ForEach(col =>
+            {
+                colStr += $"<td style=\"{col.CssStyle}\">{col.Content}</td>";
+            });
+            return rowStr;
+        }
+
+        private static string CreateParagraphes(ReportDto reportDto, string content)
+        {
+            if (reportDto.ContentDto != null)
+            {
+                if(reportDto.Title != null)
+                {
+                    content = CreateTitle(reportDto.Title, content);
+                }
+
+                var paragraphes = string.Empty;
+
+                if (reportDto.ContentDto.ParagraphDtos != null && reportDto.ContentDto.ParagraphDtos.Any())
+                {
+                    reportDto.ContentDto.ParagraphDtos.OrderBy(x => x.SortIndex).ToList().ForEach(item =>
+                    {
+                        var paragraph = string.Empty;
+                        if (item.titleDto != null)
+                        {
+                            paragraph = $"<p style=\"{item.titleDto.CssStyle}\">{item.titleDto.Content}</p>";
+                        }
+                        if (item.Content.IsNotEmpty())
+                        {
+                            paragraph += $"<p style=\"{item.CssStyle}\">{item.Content}</p>";
+                        }
+                        paragraphes += paragraph;
+                    });
+                }
+
+                content += $"<div style=\"{reportDto.ContentDto.CssStyle}\">{paragraphes}</div>";
+            }
+
+            return content;
+        }
+
+        private static string CreateSubTitles(ReportDto reportDto, string content)
+        {
+            if (reportDto.SubTitleDtos != null && reportDto.SubTitleDtos.Any())
+            {
+                reportDto.SubTitleDtos.OrderBy(x => x.SortIndex).ToList().ForEach(item =>
+                {
+                    content = CreateSubTitle(item, content);
+
+                });
+            }
+
+            return content;
+        }
+
+        private static string CreateSubTitle(SubTitleDto subTitleDto, string content)
+        {
+            var children = string.Empty;
+
+            if (subTitleDto.Children != null && subTitleDto.Children.Any())
+            {
+                subTitleDto.Children.OrderBy(x => x.SortIndex).ToList().ForEach(item =>
+                {
+                    children = CreateSubTitle(item, children);
+                });
+            }
+            else if (subTitleDto.Content.IsNotEmpty())
+            {
+                children = subTitleDto.Content;
+            }
+            else
+            {
+                return content;
+            }
+
+            content += $"<div style=\"{subTitleDto.CssStyle}\">{children}</div>";
+
+            return content;
+        }
+
+        private static string CreateBottoms(BaseReportDto baseReportDto, string content)
+        {
+            var children = string.Empty;
+
+            if (baseReportDto.Children != null && baseReportDto.Children.Any())
+            {
+                baseReportDto.Children.OrderBy(x => x.SortIndex).ToList().ForEach(item =>
+                {
+                    children = CreateBottoms(item, children);
+                });
+            }
+            else if (baseReportDto.Content.IsNotEmpty())
+            {
+                children = baseReportDto.Content;
+            }
+            else
+            {
+                return content;
+            }
+
+            content += $"<div style=\"{baseReportDto.CssStyle}\">{children}</div>";
+
+            return content;
+        }
+
+
+        private static string CreateTitle(TitleDto titleDto, string content)
+        {
+            if (titleDto != null)
+            {
+                content += $"<div style=\"{titleDto.CssStyle}\">{titleDto.Content}</div>";
+            }
+
+            return content;
+        }
+        #endregion
     }
 }

+ 4 - 4
src/Hotline.Share/Dtos/Early/EarlyDto.cs

@@ -413,22 +413,22 @@ namespace Hotline.Share.Dtos.Early
         /// <summary>
         /// 热点汇报简介
         /// </summary>
-        public ReportHotDetailDto ReportHotDetail { get; set; }
+        public List<ReportHotDetailDto> ReportHotDetails { get; set; }
 
         /// <summary>
         /// 区域汇报简介
         /// </summary>
-        public ReportAreaDetailDto ReportAreaDetail { get; set; }
+        public List<ReportAreaDetailDto> ReportAreaDetails { get; set; }
 
         /// <summary>
         /// 工单明细表
         /// </summary>
-        public ReportOrderDetailDto ReportOrderDetail { get; set; }
+        public List<ReportOrderDetailDto> ReportOrderDetails { get; set; }
 
         /// <summary>
         /// 往期明细工单
         /// </summary>
-        public ReportFiledOrderDetailDto ReportFiledOrderDetail { get; set; }
+        public List<ReportFiledOrderDetailDto> ReportFiledOrderDetails { get; set; }
     }
 
     public class ReportAreaDetailDto

+ 122 - 0
src/Hotline.Share/Dtos/ExportWord/ReportDto.cs

@@ -0,0 +1,122 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Hotline.Share.Dtos.ExportWord
+{
+    /// <summary>
+    /// 报表实体
+    /// </summary>
+    public class ReportDto: BaseReportDto
+    {
+        public TitleDto Title { get; set; }
+
+        public List<SubTitleDto> SubTitleDtos { get; set; }
+
+        public ContentDto ContentDto { get; set; }
+
+        public List<AttachmentDto> AttachmentDtos { get; set; }
+
+        public List<BaseReportDto> BottomDtos { get; set; }
+    }
+
+    /// <summary>
+    /// 标题实体
+    /// </summary>
+    public class TitleDto: BaseReportDto
+    {
+        
+    }
+
+    /// <summary>
+    /// 内容实体
+    /// </summary>
+    public class ContentDto : BaseReportDto
+    {
+        public TitleDto TitleDto { get; set; }
+        public List<ParagraphDto> ParagraphDtos { get; set; }
+    }
+
+    /// <summary>
+    /// 段落实体
+    /// </summary>
+    public class ParagraphDto : BaseReportDto
+    {
+        /// <summary>
+        /// 标题
+        /// </summary>
+        public TitleDto titleDto { get; set; }
+    }
+
+    /// <summary>
+    /// 子标题
+    /// </summary>
+    public class SubTitleDto: BaseReportDto
+    {
+        /// <summary>
+        /// 子元素
+        /// </summary>
+        public new List<SubTitleDto> Children { get; set; }
+    }
+
+    /// <summary>
+    /// 附件
+    /// </summary>
+    public class AttachmentDto : BaseReportDto
+    {
+        public TitleDto Title { get; set; }
+
+        public List<SubTitleDto> SubTitleDtos { get; set; }
+
+        public List<TableDto> TableDtos { get; set; }
+    }
+
+    public class TableDto : BaseReportDto
+    {
+       public TableDto()
+        {
+            HeadDto = new HeadDto();
+            BodyDto = new TBodyDto();
+        }
+        public HeadDto HeadDto { get; set; }
+
+        public TBodyDto BodyDto { get; set; }
+    }
+
+    public class HeadDto : BaseReportDto
+    {
+        public List<RowDto> RowDtos { get; set; }
+    }
+
+    public class TBodyDto : BaseReportDto
+    {
+        public TBodyDto()
+        {
+            RowDtos = new List<RowDto>();
+        }
+        public List<RowDto> RowDtos { get; set; }
+    }
+
+    public class RowDto : BaseReportDto
+    {
+        public List<ColumnDto> ColumnDtos;
+    }
+
+    public class ColumnDto : BaseReportDto
+    {
+
+    }
+
+    public class BaseReportDto
+    {
+        public string Content { get; set; }
+
+        public string CssStyle { get; set; }
+
+        public int SortIndex { get; set; }
+
+        public List<BaseReportDto> Children { get; set; }
+    }
+}