Compare commits
No commits in common. "af77baba60d3b048f139cf666a9902dc480687ed" and "37d15736e257431d03c49724a496b598acc9f514" have entirely different histories.
af77baba60
...
37d15736e2
|
|
@ -1,5 +1,4 @@
|
||||||
using IRaCIS.Core.Domain.Share;
|
using Microsoft.AspNetCore.Builder;
|
||||||
using Microsoft.AspNetCore.Builder;
|
|
||||||
using Microsoft.AspNetCore.Localization;
|
using Microsoft.AspNetCore.Localization;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
|
|
@ -13,9 +12,8 @@ namespace IRaCIS.Core.API
|
||||||
{
|
{
|
||||||
var supportedCultures = new List<CultureInfo>
|
var supportedCultures = new List<CultureInfo>
|
||||||
{
|
{
|
||||||
|
new CultureInfo("en-US"),
|
||||||
new CultureInfo(StaticData.CultureInfo.en_US),
|
new CultureInfo("zh-CN")
|
||||||
new CultureInfo(StaticData.CultureInfo.zh_CN)
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var options = new RequestLocalizationOptions
|
var options = new RequestLocalizationOptions
|
||||||
|
|
|
||||||
|
|
@ -1,101 +0,0 @@
|
||||||
using IRaCIS.Core.Domain.Share;
|
|
||||||
using NPOI.XWPF.UserModel;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Globalization;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Xceed.Document.NET;
|
|
||||||
using Xceed.Words.NET;
|
|
||||||
|
|
||||||
namespace IRaCIS.Core.Application.Helper
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 利用DocX 库 处理word国际化模板
|
|
||||||
/// </summary>
|
|
||||||
public static class WordTempleteHelper
|
|
||||||
{
|
|
||||||
public static void DocX_GetInternationalTempleteStream(string filePath, Stream memoryStream)
|
|
||||||
{
|
|
||||||
|
|
||||||
var isEn_US = CultureInfo.CurrentCulture.Name == StaticData.CultureInfo.en_US;
|
|
||||||
|
|
||||||
using (DocX document = DocX.Load(filePath))
|
|
||||||
{
|
|
||||||
// 查找书签
|
|
||||||
var bookmarkEn_Start = document.Bookmarks.FirstOrDefault(b => b.Name == StaticData.CultureInfo.en_US_bookMark);
|
|
||||||
|
|
||||||
if (bookmarkEn_Start != null)
|
|
||||||
{
|
|
||||||
// 获取书签的起始位置
|
|
||||||
//int bookmarkCNStartPos = bookmarkCn_Start.Paragraph.StartIndex;
|
|
||||||
|
|
||||||
var bookmarkENStartPos = bookmarkEn_Start.Paragraph.StartIndex;
|
|
||||||
|
|
||||||
// 创建一个要删除段落的列表
|
|
||||||
List<Paragraph> paragraphsToRemove = new List<Paragraph>();
|
|
||||||
|
|
||||||
foreach (var item in document.Paragraphs)
|
|
||||||
{
|
|
||||||
//中文模板在前,英文在后,英文模板,就删除英文之前的,中文模板就删除英文之后的
|
|
||||||
|
|
||||||
if (isEn_US ? item.EndIndex < bookmarkENStartPos : item.StartIndex >= bookmarkENStartPos)
|
|
||||||
{
|
|
||||||
paragraphsToRemove.Add(item);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var paragraph in paragraphsToRemove)
|
|
||||||
{
|
|
||||||
document.RemoveParagraph(paragraph);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// 保存修改
|
|
||||||
document.SaveAs(memoryStream);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static void Npoi_GetInternationalTempleteStream(string filePath, Stream memoryStream)
|
|
||||||
{
|
|
||||||
|
|
||||||
var isEn_US = CultureInfo.CurrentCulture.Name == StaticData.CultureInfo.en_US;
|
|
||||||
|
|
||||||
using (FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read))
|
|
||||||
{
|
|
||||||
XWPFDocument doc = new XWPFDocument(fs);
|
|
||||||
|
|
||||||
// 查找包含指定书签的段落及其索引
|
|
||||||
var bookmarkParagraph = doc.Paragraphs
|
|
||||||
.FirstOrDefault(p => p.GetCTP().GetBookmarkStartList().Any(b => b.name == StaticData.CultureInfo.en_US_bookMark));
|
|
||||||
|
|
||||||
if (bookmarkParagraph != null)
|
|
||||||
{
|
|
||||||
int bookmarkIndex = doc.Paragraphs.IndexOf(bookmarkParagraph);
|
|
||||||
|
|
||||||
if (isEn_US)
|
|
||||||
{
|
|
||||||
// 从书签所在段落开始,删除之前的所有段落
|
|
||||||
for (int i = bookmarkIndex - 1; i >= 0; i--)
|
|
||||||
{
|
|
||||||
doc.RemoveBodyElement(i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// 删除书签之后的所有段落
|
|
||||||
for (int i = doc.Paragraphs.Count - 1; i >= bookmarkIndex; i--)
|
|
||||||
{
|
|
||||||
doc.RemoveBodyElement(i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
doc.Write(memoryStream);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -42,7 +42,7 @@
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Remove="IRaCIS.Core.Application.xml" />
|
<None Remove="IRaCIS.Core.Application.xml" />
|
||||||
<None Remove="Resources\en-US.json" />
|
<None Remove="Resources\en-US.json" />
|
||||||
<None Remove="Resources\zh_ch.json" />
|
<None Remove="Resources\zh-CN.json" />
|
||||||
<None Remove="Service\Allocation\TaskConsistentRuleService.cs~RF1603d47.TMP" />
|
<None Remove="Service\Allocation\TaskConsistentRuleService.cs~RF1603d47.TMP" />
|
||||||
<None Remove="Service\Reading\ReadingImageTask\ReadingImageTaskService.cs~RF2f9323.TMP" />
|
<None Remove="Service\Reading\ReadingImageTask\ReadingImageTaskService.cs~RF2f9323.TMP" />
|
||||||
<None Remove="Service\Reading\ReadingImageTask\ReadingJudgeTaskService.cs~RF198afd23.TMP" />
|
<None Remove="Service\Reading\ReadingImageTask\ReadingJudgeTaskService.cs~RF198afd23.TMP" />
|
||||||
|
|
@ -50,6 +50,11 @@
|
||||||
|
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Content Include="Resources\zh-CN.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
||||||
|
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
||||||
|
</Content>
|
||||||
<Content Include="Resources\en-US.json">
|
<Content Include="Resources\en-US.json">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
||||||
|
|
|
||||||
|
|
@ -117,11 +117,6 @@
|
||||||
<returns>解密后的字符串</returns>
|
<returns>解密后的字符串</returns>
|
||||||
</member>
|
</member>
|
||||||
<!-- Badly formed XML comment ignored for member "M:IRaCIS.Core.Application.Helper.RSAHelper.Encrypt(System.String,System.String)" -->
|
<!-- Badly formed XML comment ignored for member "M:IRaCIS.Core.Application.Helper.RSAHelper.Encrypt(System.String,System.String)" -->
|
||||||
<member name="T:IRaCIS.Core.Application.Helper.WordTempleteHelper">
|
|
||||||
<summary>
|
|
||||||
利用DocX 库 处理word国际化模板
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="T:IRaCIS.Core.Application.Service.TaskAllocationRuleService">
|
<member name="T:IRaCIS.Core.Application.Service.TaskAllocationRuleService">
|
||||||
<summary>
|
<summary>
|
||||||
分配规则
|
分配规则
|
||||||
|
|
|
||||||
|
|
@ -1522,18 +1522,20 @@ namespace IRaCIS.Core.Application.Service.Common
|
||||||
//两个都不为null 肯定是不同的裁判
|
//两个都不为null 肯定是不同的裁判
|
||||||
|
|
||||||
//在完成裁判之后的,和未完成裁判之前的
|
//在完成裁判之后的,和未完成裁判之前的
|
||||||
if (/*visitItem.VisitTaskNum < maxNotFinishedJudge.VisitTaskNum &&*/ visitItem.VisitTaskNum > maxFinishedJudge.VisitTaskNum)
|
if (visitItem.VisitTaskNum < maxNotFinishedJudge.VisitTaskNum && visitItem.VisitTaskNum > maxFinishedJudge.VisitTaskNum)
|
||||||
{
|
{
|
||||||
visitItem.IsGenerateJudge = null;
|
visitItem.IsGenerateJudge = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (visitItem.ArmEnum == maxFinishedJudge.JudgeArmEnum && visitItem.VisitTaskNum < maxFinishedJudge.VisitTaskNum)
|
else if (visitItem.ArmEnum == maxFinishedJudge.JudgeArmEnum && visitItem.VisitTaskNum < maxFinishedJudge.VisitTaskNum)
|
||||||
{
|
{
|
||||||
visitItem.IsGenerateJudge = true;
|
visitItem.IsGenerateJudge = true;
|
||||||
}
|
}
|
||||||
//else if (visitItem.ArmEnum == Arm.DoubleReadingArm1)
|
|
||||||
//{
|
else if (visitItem.ArmEnum == Arm.DoubleReadingArm1)
|
||||||
// visitItem.IsGenerateJudge = true;
|
{
|
||||||
//}
|
visitItem.IsGenerateJudge = true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
using Aliyun.OSS;
|
using Aliyun.OSS;
|
||||||
using DocumentFormat.OpenXml.Wordprocessing;
|
|
||||||
using IP2Region.Net.XDB;
|
using IP2Region.Net.XDB;
|
||||||
using IRaCIS.Application.Contracts;
|
using IRaCIS.Application.Contracts;
|
||||||
using IRaCIS.Core.Application.Contracts;
|
using IRaCIS.Core.Application.Contracts;
|
||||||
|
|
@ -19,14 +18,12 @@ using Microsoft.Extensions.Options;
|
||||||
using MiniExcelLibs;
|
using MiniExcelLibs;
|
||||||
using Minio;
|
using Minio;
|
||||||
using Minio.DataModel.Args;
|
using Minio.DataModel.Args;
|
||||||
using NPOI.XWPF.UserModel;
|
|
||||||
using SharpCompress.Common;
|
using SharpCompress.Common;
|
||||||
using Spire.Doc;
|
using Spire.Doc;
|
||||||
using System.Linq.Expressions;
|
using System.Linq.Expressions;
|
||||||
using System.Reflection.Metadata;
|
using System.Reflection.Metadata;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Xceed.Document.NET;
|
|
||||||
using Xceed.Words.NET;
|
using Xceed.Words.NET;
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -117,7 +114,7 @@ namespace IRaCIS.Application.Services
|
||||||
public async Task<IResponseOutput> TestMinIO([FromServices] IOSSService oSSService)
|
public async Task<IResponseOutput> TestMinIO([FromServices] IOSSService oSSService)
|
||||||
{
|
{
|
||||||
|
|
||||||
var str = await oSSService.GetSignedUrl("/01000000-c0a8-0242-1c98-08dc7ebcd37d/Read/01000000-c0a8-0242-1c98-08dc7ebcd37d/Visit/1716872544006_1716872544003.png");
|
var str= await oSSService.GetSignedUrl("/01000000-c0a8-0242-1c98-08dc7ebcd37d/Read/01000000-c0a8-0242-1c98-08dc7ebcd37d/Visit/1716872544006_1716872544003.png");
|
||||||
|
|
||||||
|
|
||||||
//await oSSService.UploadToOSSAsync("C:\\Users\\Administrator\\Desktop\\TrialSiteUserImportTemplate.xlsx", "myfolder");
|
//await oSSService.UploadToOSSAsync("C:\\Users\\Administrator\\Desktop\\TrialSiteUserImportTemplate.xlsx", "myfolder");
|
||||||
|
|
@ -191,11 +188,11 @@ namespace IRaCIS.Application.Services
|
||||||
Console.WriteLine("\nOriginal Data: " + dataToEncrypt);
|
Console.WriteLine("\nOriginal Data: " + dataToEncrypt);
|
||||||
|
|
||||||
// Encrypt the data
|
// Encrypt the data
|
||||||
var encryptedData = RSAHelper.Encrypt(publicKey, dataToEncrypt);
|
var encryptedData = RSAHelper.Encrypt( publicKey, dataToEncrypt);
|
||||||
Console.WriteLine("\nEncrypted Data: " + encryptedData);
|
Console.WriteLine("\nEncrypted Data: " + encryptedData);
|
||||||
|
|
||||||
// Decrypt the data
|
// Decrypt the data
|
||||||
string decryptedData = RSAHelper.Decrypt(privateKey, encryptedData);
|
string decryptedData = RSAHelper.Decrypt( privateKey, encryptedData);
|
||||||
Console.WriteLine("\nDecrypted Data: " + decryptedData);
|
Console.WriteLine("\nDecrypted Data: " + decryptedData);
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -205,111 +202,38 @@ namespace IRaCIS.Application.Services
|
||||||
|
|
||||||
|
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
public async Task<string> testDoc([FromServices] IWebHostEnvironment env, string email)
|
public async Task<string> testEmail([FromServices] IWebHostEnvironment env ,string email)
|
||||||
{
|
{
|
||||||
#region DocX 测试
|
|
||||||
//using (DocX document = DocX.Load("C:\\Users\\hang\\Desktop\\test.docx"))
|
//using (DocX document = DocX.Load("C:\\Users\\hang\\Desktop\\"))
|
||||||
//{
|
//{
|
||||||
// // 查找书签
|
// // 查找书签对应的段落
|
||||||
// var bookmarkCn_Start = document.Bookmarks.FirstOrDefault(b => b.Name == "zh_cn");
|
// var bookmark = document.Bookmarks.FirstOrDefault(b => b.Name == bookmarkName);
|
||||||
// var bookmarkEn_Start = document.Bookmarks.FirstOrDefault(b => b.Name == "en_us");
|
|
||||||
|
|
||||||
// if (bookmarkCn_Start != null && bookmarkEn_Start != null)
|
// if (bookmark != null)
|
||||||
// {
|
// {
|
||||||
// // 获取书签的起始位置
|
// // 获取书签所在的段落位置
|
||||||
// int bookmarkCNStartPos = bookmarkCn_Start.Paragraph.StartIndex;
|
// int paragraphIndex = document.Paragraphs.IndexOf(bookmark.Paragraph);
|
||||||
|
|
||||||
// var bookmarkENStartPos = bookmarkEn_Start.Paragraph.StartIndex;
|
// // 如果书签所在的段落在文档中
|
||||||
|
// if (paragraphIndex >= 0)
|
||||||
// // // 创建一个要删除段落的列表
|
|
||||||
// List<Paragraph> paragraphsToRemove = new List<Paragraph>();
|
|
||||||
|
|
||||||
// foreach (var item in document.Paragraphs)
|
|
||||||
// {
|
// {
|
||||||
|
// // 删除书签所在的段落
|
||||||
// //中文模板在前,英文在后,英文模板,就删除英文之前的,中文模板就删除英文之后的
|
// document.RemoveParagraphAt(paragraphIndex);
|
||||||
// //_userInfo.IsEn_Us? item.EndIndex< bookmarkENStartPos :item.StartIndex>= bookmarkENStartPos
|
|
||||||
// if (item.StartIndex>= bookmarkENStartPos)
|
|
||||||
// {
|
|
||||||
// paragraphsToRemove.Add(item);
|
|
||||||
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// foreach (var paragraph in paragraphsToRemove)
|
|
||||||
// {
|
|
||||||
// document.RemoveParagraph(paragraph);
|
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
// // 删除书签(只删除书签标记,不删除内容)
|
||||||
|
// document.Bookmarks.Remove(bookmark);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// // 保存修改
|
// // 保存修改
|
||||||
// document.SaveAs("C:\\Users\\hang\\Desktop\\test1.docx");
|
// document.Save();
|
||||||
//}
|
//}
|
||||||
#endregion
|
|
||||||
|
|
||||||
using (FileStream fs = new FileStream("C:\\Users\\hang\\Desktop\\test.docx", FileMode.Open, FileAccess.Read))
|
|
||||||
{
|
|
||||||
XWPFDocument doc = new XWPFDocument(fs);
|
|
||||||
|
|
||||||
|
|
||||||
// 查找包含指定书签的段落及其索引
|
var hiddenEmail = EmailMaskHelper.MaskEmail(email);
|
||||||
var bookmarkParagraph = doc.Paragraphs
|
|
||||||
.FirstOrDefault(p => p.GetCTP().GetBookmarkStartList().Any(b => b.name == "en_us"));
|
|
||||||
|
|
||||||
|
return hiddenEmail;
|
||||||
if (bookmarkParagraph != null)
|
|
||||||
{
|
|
||||||
int bookmarkIndex = doc.Paragraphs.IndexOf(bookmarkParagraph);
|
|
||||||
|
|
||||||
// 删除书签之后的所有段落
|
|
||||||
for (int i = doc.Paragraphs.Count - 1; i >= bookmarkIndex; i--)
|
|
||||||
{
|
|
||||||
doc.RemoveBodyElement(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
throw new BusinessValidationFailedException("word 模板没有英文书签");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 创建一个要删除段落的列表
|
|
||||||
|
|
||||||
//XWPFParagraph bookmarkParagraph = null;
|
|
||||||
|
|
||||||
//foreach (var paragraph in doc.Paragraphs)
|
|
||||||
//{
|
|
||||||
|
|
||||||
// foreach (var bookmark in paragraph.GetCTP().GetBookmarkStartList())
|
|
||||||
// {
|
|
||||||
// if (bookmark.name == "en_us")
|
|
||||||
// {
|
|
||||||
// bookmarkParagraph = paragraph;
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//// 从书签所在段落开始,删除之前的所有段落
|
|
||||||
//for (int i = bookmarkIndex - 1; i >= 0; i--)
|
|
||||||
//{
|
|
||||||
// doc.RemoveBodyElement(i);
|
|
||||||
//}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
using (FileStream outStream = new FileStream("C:\\Users\\hang\\Desktop\\test1.docx", FileMode.Create, FileAccess.Write))
|
|
||||||
{
|
|
||||||
doc.Write(outStream);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return "hiddenEmail";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,14 +17,6 @@ public static class StaticData
|
||||||
public static readonly string Zh_CN_Json = "zh-CN.json";
|
public static readonly string Zh_CN_Json = "zh-CN.json";
|
||||||
|
|
||||||
|
|
||||||
public static class CultureInfo
|
|
||||||
{
|
|
||||||
public static readonly string zh_CN = "zh-CN";
|
|
||||||
public static readonly string en_US = "en-US";
|
|
||||||
|
|
||||||
public static readonly string en_US_bookMark = "en_us";
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取国际化
|
/// 获取国际化
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue