diff --git a/IRaCIS.Core.API/IRaCIS.Core.API.csproj b/IRaCIS.Core.API/IRaCIS.Core.API.csproj index da285c560..65b1434e0 100644 --- a/IRaCIS.Core.API/IRaCIS.Core.API.csproj +++ b/IRaCIS.Core.API/IRaCIS.Core.API.csproj @@ -78,6 +78,9 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive + + true + @@ -85,7 +88,6 @@ - diff --git a/IRaCIS.Core.Application/Helper/InternationalizationHelper.cs b/IRaCIS.Core.Application/Helper/InternationalizationHelper.cs index 5d3bfb633..0a0edfb26 100644 --- a/IRaCIS.Core.Application/Helper/InternationalizationHelper.cs +++ b/IRaCIS.Core.Application/Helper/InternationalizationHelper.cs @@ -9,7 +9,6 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; -using static BeetleX.Redis.Commands.HSCAN; using static IRaCIS.Core.Application.Service.Common.SystemMonitor; namespace IRaCIS.Core.Application.Helper diff --git a/IRaCIS.Core.Application/Helper/NpoiWordHelper.cs b/IRaCIS.Core.Application/Helper/NpoiWordHelper.cs deleted file mode 100644 index 2e9932140..000000000 --- a/IRaCIS.Core.Application/Helper/NpoiWordHelper.cs +++ /dev/null @@ -1,171 +0,0 @@ - -using IRaCIS.Core.Application.Helper; -using Microsoft.AspNetCore.Hosting; -using Microsoft.AspNetCore.Mvc; -using NPOI.OpenXmlFormats.Wordprocessing; -using NPOI.XWPF.UserModel; -using System.Collections; -using System.Reflection; - -namespace IRaCIS.Core.Application.Service; - -public static class NpoiWordHelper -{ - public static async Task TemplateExportWordAsync(string code, object data, IRepository? _commonDocumentRepository, IWebHostEnvironment _hostEnvironment) - { - //var (physicalPath, fileNmae) = await FileStoreHelper.GetCommonDocPhysicalFilePathAsync(_hostEnvironment, _commonDocumentRepository, code); - - var physicalPath = code; - - - using (FileStream stream = File.OpenRead(physicalPath)) - { - XWPFDocument doc = new XWPFDocument(stream); - //遍历段落 - foreach (var para in doc.Paragraphs) - { - ReplaceKey(para, data); - } - //遍历表格 - var tables = doc.Tables; - foreach (var table in tables) - { - //ReplaceTableKey(table, data, "Data"); - } - - foreach (var table in tables) - { - foreach (var row in table.Rows) - { - foreach (var cell in row.GetTableCells()) - { - foreach (var para in cell.Paragraphs) - { - ReplaceKey(para, data); - } - } - } - } - - FileStream out1 = new FileStream("table.docx", FileMode.Create); - doc.Write(out1); - out1.Close(); - return new FileStreamResult(stream, "application/msword") - { - FileDownloadName = $"replaced_{DateTime.Now.ToString("yyyyMMddHHmmss")}.docx" - }; - } - - - - - - - - - - - - - - - } - - private static void ReplaceKey(XWPFParagraph para, object model) - { - string text = para.ParagraphText; - - Type t = model.GetType(); - PropertyInfo[] pi = t.GetProperties(); - foreach (PropertyInfo p in pi) - { - //$$与模板中$$对应,也可以改成其它符号,比如{$name},务必做到唯一 - if (text.Contains("$" + p.Name + "$")) - { - text = text.Replace("$" + p.Name + "$", p.GetValue(model)?.ToString()); - } - } - - //var runs = para.Runs; - //string styleid = para.Style; - //for (int i = 0; i < runs.Count; i++) - //{ - // var run = runs[i]; - // text = run.ToString(); - // Type t = model.GetType(); - // PropertyInfo[] pi = t.GetProperties(); - // foreach (PropertyInfo p in pi) - // { - // //$$与模板中$$对应,也可以改成其它符号,比如{$name},务必做到唯一 - // if (text.Contains("$" + p.Name + "$")) - // { - // text = text.Replace("$" + p.Name + "$", p.GetValue(model)?.ToString()); - // } - // } - // runs[i].SetText(text, 0); - //} - } - - - - - /// - /// 替换表格Key - /// - /// - /// - /// - - private static void ReplaceTableKey(XWPFTable table, IList list, String field) - { - List paras = new List(); - // 获取最后一行数据,最后一行设置值 - Int32 iLastRowIndex = 0; - for (int iIndex = 0; iIndex < table.Rows.Count; iIndex++) - { - if (iIndex == table.Rows.Count - 1) - { - iLastRowIndex = iIndex; - foreach (var cell in table.Rows[iIndex].GetTableCells()) - { - foreach (var para in cell.Paragraphs) - { - paras.Add(para); - } - } - } - } - // 删除最后一行 - table.RemoveRow(iLastRowIndex); - - for (int iIndex = 0; iIndex < list.Count; iIndex++) - { - object data = list[iIndex]; - Type t = data.GetType(); - PropertyInfo[] pi = t.GetProperties(); - // 表增加行 - XWPFTableRow m_row = table.CreateRow(); - CT_Row m_NewRow = new CT_Row(); - String text = String.Empty; - Int32 jIndex = 0; - paras.ForEach(para => - { - text = para.ParagraphText; - foreach (PropertyInfo p in pi) - { - if (text.Contains("$" + field + "." + p.Name + "$")) - { - m_row.GetCell(jIndex).SetText(p.GetValue(data, null).ToString()); - } - } - jIndex++; - }); - m_row = new XWPFTableRow(m_NewRow, table); - table.AddRow(m_row); - - } - } - - - -} \ No newline at end of file diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.csproj b/IRaCIS.Core.Application/IRaCIS.Core.Application.csproj index 656726dc8..56bb06eff 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.csproj +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.csproj @@ -64,7 +64,7 @@ - + @@ -75,9 +75,6 @@ - - true - true diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index d1764f822..17a4ac6da 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -85,14 +85,6 @@ - - - 替换表格Key - - - - - 分配规则 diff --git a/IRaCIS.Core.Application/TestService.cs b/IRaCIS.Core.Application/TestService.cs index 0bdd15b12..458705231 100644 --- a/IRaCIS.Core.Application/TestService.cs +++ b/IRaCIS.Core.Application/TestService.cs @@ -1,5 +1,4 @@ -using BeetleX.BNR; -using IRaCIS.Core.Application.Service; +using IRaCIS.Core.Application.Service; using IRaCIS.Core.Application.ViewModel; using IRaCIS.Core.Domain.Share; using IRaCIS.Core.Infrastructure; diff --git a/IRaCIS.Core.Domain.Share/IRaCIS.Core.Domain.Share.csproj b/IRaCIS.Core.Domain.Share/IRaCIS.Core.Domain.Share.csproj index 78fa3b6cf..85a1db3cc 100644 --- a/IRaCIS.Core.Domain.Share/IRaCIS.Core.Domain.Share.csproj +++ b/IRaCIS.Core.Domain.Share/IRaCIS.Core.Domain.Share.csproj @@ -10,9 +10,6 @@ - - - diff --git a/IRaCIS.Core.Domain/IRaCIS.Core.Domain.csproj b/IRaCIS.Core.Domain/IRaCIS.Core.Domain.csproj index 5cbdf014a..1397d105f 100644 --- a/IRaCIS.Core.Domain/IRaCIS.Core.Domain.csproj +++ b/IRaCIS.Core.Domain/IRaCIS.Core.Domain.csproj @@ -9,11 +9,10 @@ - - - - + + + diff --git a/IRaCIS.Core.Domain/Visit/SubjectVisit.cs b/IRaCIS.Core.Domain/Visit/SubjectVisit.cs index cf80c30b2..0711685f5 100644 --- a/IRaCIS.Core.Domain/Visit/SubjectVisit.cs +++ b/IRaCIS.Core.Domain/Visit/SubjectVisit.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using System.ComponentModel.DataAnnotations.Schema; using IRaCIS.Core.Domain.Share; -using Microsoft.EntityFrameworkCore.Metadata.Internal; namespace IRaCIS.Core.Domain.Models { diff --git a/IRaCIS.Core.Infra.EFCore/IRaCIS.Core.Infra.EFCore.csproj b/IRaCIS.Core.Infra.EFCore/IRaCIS.Core.Infra.EFCore.csproj index df6df308d..4baefc5d5 100644 --- a/IRaCIS.Core.Infra.EFCore/IRaCIS.Core.Infra.EFCore.csproj +++ b/IRaCIS.Core.Infra.EFCore/IRaCIS.Core.Infra.EFCore.csproj @@ -18,12 +18,14 @@ + - + + diff --git a/IRaCIS.Core.Infrastructure/IRaCIS.Core.Infrastructure.csproj b/IRaCIS.Core.Infrastructure/IRaCIS.Core.Infrastructure.csproj index 152693792..7d0a4080a 100644 --- a/IRaCIS.Core.Infrastructure/IRaCIS.Core.Infrastructure.csproj +++ b/IRaCIS.Core.Infrastructure/IRaCIS.Core.Infrastructure.csproj @@ -9,7 +9,6 @@ - diff --git a/IRaCIS.Core.Test/IRaCIS.Core.Test.csproj b/IRaCIS.Core.Test/IRaCIS.Core.Test.csproj index 5f49abc87..16b11378d 100644 --- a/IRaCIS.Core.Test/IRaCIS.Core.Test.csproj +++ b/IRaCIS.Core.Test/IRaCIS.Core.Test.csproj @@ -15,7 +15,6 @@ - all