123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824 |
- using ICSharpCode.SharpZipLib.Tar;
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.IO;
- using System.IO.Compression;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using wispro.sp.utility;
- using SharpCompress.Archives;
- using SharpCompress.Archives.Rar;
- using SharpCompress.Common;
- using System.Collections;
- using wispro.sp.entity.CompareCase;
- using wispro.sp.share.webViewObject;
- using System.Net.Http;
- using System.Net.Http.Json;
- using wispro.sp.share;
- using OpenQA.Selenium.Support.UI;
- using System.Dynamic;
- namespace wispro.sp.winClient
- {
- public partial class frmCaseFileCompare : Form
- {
- private CompareDocx draft_fristReturn;
- private CompareDocx fristReturn_Finally;
- public frmCaseFileCompare()
- {
- InitializeComponent();
- }
- private void label1_Click(object sender, EventArgs e)
- {
- }
- private HttpClient CreateHttp()
- {
- HttpClientHandler clientHandler = new HttpClientHandler();
- clientHandler.ServerCertificateCustomValidationCallback = (sender, cert, chain, sslPolicyErrors) => { return true; };
- return new HttpClient(clientHandler);
- }
- string strAPIBaseUri = "http://localhost:39476";
- private async Task<bool> SaveCompareResult(CaseInfo caseinfo)
- {
- share.webViewObject.loginDto dto = new share.webViewObject.loginDto();
- dto.Name = "caiyangl";
- dto.Password = "Lqftiu807005";
- var response = await CreateHttp().PostAsJsonAsync<loginDto>($"{strAPIBaseUri}/api/account/Login", dto);
- if (response.IsSuccessStatusCode)
- {
- userToken? Token = await response.Content.ReadFromJsonAsync<userToken>();
- HttpClient http = CreateHttp();//
- http.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("bearer", Token?.Token);
- try
- {
- var data = await http.PostAsJsonAsync<CaseInfo>($"{strAPIBaseUri}/api/CaseFileCompare/Save", caseinfo);
- if (data.IsSuccessStatusCode)
- {
- var ret = await data.Content.ReadFromJsonAsync<ApiSaveResponse>();
- if(ret.Success)
- {
- return true;
- }
- else
- {
- throw new Exception(ret.ErrorMessage);
- }
-
- }
- else
- {
- return false;
- }
- }
- catch (Exception ex)
- {
- return false;
- }
- }
- return false;
- }
- private CaseInfo getCaseInfo_files(string caseNo,out string draftFile,out string returnFile,out string finalFile)
- {
- draftFile = null;
- returnFile = null;
- finalFile = null;
- var retFiles = wispro.sp.utility.IPEasyUtility.DownloadCaseFiles(caseNo);
- if (retFiles != null)
- {
- CaseInfo caseInfo = new CaseInfo();
- caseInfo.CaseNo = retFiles.CaseNo;
- IDictionary<String, Object> keyValuePairs = (IDictionary<String, Object>)retFiles;
- if (keyValuePairs.ContainsKey("CaseName"))
- {
- caseInfo.CaseName = retFiles.CaseName;
- }
- if (keyValuePairs.ContainsKey("Customer"))
- {
- caseInfo.Customer = new entity.Customer() { Name = retFiles.Customer };
- }
- if (keyValuePairs.ContainsKey("FirstDraftDate"))
- {
- caseInfo.DraftDate = string.IsNullOrEmpty(retFiles.FirstDraftDate) ? null : DateTime.Parse(retFiles.FirstDraftDate);
- }
- if (keyValuePairs.ContainsKey("ReturnDate"))
- {
- caseInfo.ReturnDate = string.IsNullOrEmpty(retFiles.ReturnDate) ? null : DateTime.Parse(retFiles.ReturnDate);
- }
- if (keyValuePairs.ContainsKey("FinalizationDate"))
- {
- caseInfo.FinalVersionDate = string.IsNullOrEmpty(retFiles.FinalizationDate) ? null : DateTime.Parse(retFiles.FinalizationDate);
- }
- if (keyValuePairs.ContainsKey("DoPersons"))
- {
- caseInfo.Handlers = retFiles.DoPersons;
- }
- if (keyValuePairs.ContainsKey("Reviewer"))
- {
- if (!string.IsNullOrEmpty(retFiles.Reviewer))
- {
- caseInfo.Reviewer = new entity.Staff() { Name = retFiles.Reviewer };
- }
- }
- if (keyValuePairs.ContainsKey("draftFile"))
- {
- draftFile = retFiles.draftFile;
- }
- if (keyValuePairs.ContainsKey("firstReturnFile"))
- {
- returnFile = retFiles.firstReturnFile;
- }
- if (keyValuePairs.ContainsKey("finallyFile"))
- {
- finalFile = retFiles.finallyFile;
- }
- return caseInfo;
- }
- else
- {
- return null;
- }
-
- }
- private void compareCaseFile()
- {
- DataTable table = wispro.sp.utility.IPEasyUtility.GetFinished3FilesCases(1);
- if (table != null)
- {
- foreach (DataRow row in table.Rows)
- {
- if (row["申请类型"].ToString().Trim() == "外观设计")
- {
- continue;
- }
- string draftFile = string.Empty;
- string returnFile =string.Empty;
- string finalFile =string.Empty;
- string CaseNo = row["我方文号"].ToString();
- CaseInfo caseInfo = getCaseInfo_files(CaseNo, out draftFile,out returnFile, out finalFile);
-
-
- int i = (string.IsNullOrEmpty(draftFile) ? 1 : 0) +
- (string.IsNullOrEmpty(returnFile) ? 1 : 0) +
- (string.IsNullOrEmpty(finalFile) ? 1 : 0);
- if (i > 1)
- {
- CompareFiles(draftFile, returnFile, finalFile, caseInfo);
- SaveCompareResult(caseInfo);
- }
- }
- }
- }
- private void CompareFiles(string draftFile, string returnFile, string finalFile, CaseInfo caseInfo)
- {
- string strExtractPath = @"c:\temp";
- string tmpdraftFile = ExtractFile(draftFile,0,strExtractPath);
- string tmpreturnFile = ExtractFile(returnFile, 1, strExtractPath);
- string tmpfinalFile = ExtractFile(finalFile, 2, strExtractPath);
- if (!string.IsNullOrEmpty(tmpdraftFile) && !string.IsNullOrEmpty(tmpreturnFile))
- {
- CompareDocx docx = new CompareDocx();
- docx.Compare(tmpdraftFile, tmpreturnFile);
- if(docx.FulltextResult.oldWordCount > 0)
- {
- caseInfo.DRRFulltext = docx.FulltextResult;
- }
- if (docx.AbstractResult.oldWordCount > 0)
- {
- caseInfo.DRRAbstract = docx.AbstractResult;
- }
- if (docx.ClaimResult.oldWordCount > 0)
- {
- caseInfo.DRRCalim = docx.ClaimResult;
- }
- if (docx.AbstractResult.oldWordCount > 0)
- {
- caseInfo.DRRAll = docx.AllStringResult;
- }
- }
- if (!string.IsNullOrEmpty(tmpfinalFile) && !string.IsNullOrEmpty(tmpreturnFile))
- {
- CompareDocx docx = new CompareDocx();
- docx.Compare(tmpreturnFile, tmpfinalFile);
- if (docx.FulltextResult.oldWordCount > 0)
- {
- caseInfo.RFRFulltext = docx.FulltextResult;
- }
- if (docx.AbstractResult.oldWordCount > 0)
- {
- caseInfo.RFRAbstract = docx.AbstractResult;
- }
- if (docx.ClaimResult.oldWordCount > 0)
- {
- caseInfo.RFRCalim = docx.ClaimResult;
- }
- if (docx.AllStringResult.oldWordCount > 0)
- {
- caseInfo.RFRAll = docx.AllStringResult;
- }
- }
- #region 清除下载和解压缩后的文件
- if (System.IO.File.Exists(returnFile))
- {
- System.IO.File.Delete(returnFile);
- }
- if (System.IO.File.Exists(draftFile))
- {
- System.IO.File.Delete(draftFile);
- }
- if (System.IO.File.Exists(finalFile))
- {
- System.IO.File.Delete(finalFile);
- }
- if (System.IO.Directory.Exists(Path.Combine(strExtractPath,returnFile.Substring(0,returnFile.Length -4))))
- {
- System.IO.Directory.Delete(Path.Combine(strExtractPath, returnFile.Substring(0, returnFile.Length - 4)), true);
- }
- if (System.IO.Directory.Exists(Path.Combine(strExtractPath, draftFile.Substring(0, draftFile.Length - 4))))
- {
- System.IO.Directory.Delete(Path.Combine(strExtractPath, draftFile.Substring(0, draftFile.Length - 4)),true);
- }
- if (System.IO.Directory.Exists(Path.Combine(strExtractPath, finalFile.Substring(0, finalFile.Length - 4))))
- {
- System.IO.Directory.Delete(Path.Combine(strExtractPath, finalFile.Substring(0, finalFile.Length - 4)),true);
- }
- #endregion
- }
- private string ExtractFile(string file,int type,string strExtractPath)
- {
-
- if (file.ToLower().EndsWith(".zip") || file.ToLower().EndsWith(".rar"))
- {
- string extractPath = Path.Combine(strExtractPath, file.Substring(0,file.Length-4));
- if (file.ToLower().EndsWith(".zip"))
- {
- ExtractZip(file, extractPath);
- }
- else
- {
- ExtractRarFile(file, extractPath);
- }
- foreach (string f in Directory.GetFiles(extractPath, "*.*", SearchOption.AllDirectories))
- {
- switch (type)
- {
- case 0:
- if (f.ToUpper().IndexOf("V1R", StringComparison.OrdinalIgnoreCase) > 0)
- {
- return f;
- }
- break;
- case 1:
- if (f.ToUpper().IndexOf("V1F", StringComparison.OrdinalIgnoreCase) > 0)
- {
- return f;
- }
- break;
- case 2:
- if (f.IndexOf("定稿", StringComparison.OrdinalIgnoreCase) > 0)
- {
- return f;
- }
- break;
- }
-
- }
- return null;
- }
- else
- {
- return file;
- }
- }
- CaseInfo caseInfo;
- private void button1_Click(object sender, EventArgs e)
- {
- //compareCaseFile();
- //return;
- if (string.IsNullOrEmpty(this.txtCaseNo.Text))
- {
- MessageBox.Show("请输入案号!", "提示框", MessageBoxButtons.OK);
- this.txtCaseNo.Focus();
- return;
- }
- string draftFile = string.Empty;
- string finalFile = string.Empty;
- string returnFile = string.Empty;
- caseInfo = getCaseInfo_files(txtCaseNo.Text.Trim(), out draftFile, out returnFile, out finalFile);
- int i = (string.IsNullOrEmpty(draftFile) ? 0 : 1) +
- (string.IsNullOrEmpty(returnFile) ? 0 : 1) +
- (string.IsNullOrEmpty(finalFile) ? 0 : 1);
- if (i > 1)
- {
- CompareFiles(draftFile, returnFile, finalFile, caseInfo);
- SaveCompareResult(caseInfo);
- }
-
- comboBox1.SelectedIndex = 0;
- }
- private void ExtractZip(string zipFilePath, string extractPath)
- {
- Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
- // 确保提取目录存在
- Directory.CreateDirectory(extractPath);
- // 使用 ZipArchive 解压缩 ZIP 文件
- using (FileStream zipToOpen = new FileStream(zipFilePath, FileMode.Open))
- {
- using (ZipArchive archive = new ZipArchive(zipToOpen, ZipArchiveMode.Read, true, Encoding.GetEncoding("GB2312")))
- {
- foreach (ZipArchiveEntry entry in archive.Entries)
- {
- if (entry.FullName.EndsWith("/", StringComparison.Ordinal) || entry.FullName.EndsWith("\\", StringComparison.Ordinal))
- {
- Console.WriteLine($"目录: {entry.FullName}");
- }
- else
- {
- string entryPath = Path.Combine(extractPath, entry.FullName);
- Directory.CreateDirectory(new System.IO.FileInfo(entryPath).Directory.FullName);
- entry.ExtractToFile(entryPath, true);
- }
- }
- }
- }
- }
- public static void ExtractRarFile(string rarPath, string outputPath)
- {
- try
- {
- // 确保输出目录存在
- Directory.CreateDirectory(outputPath);
- // 打开RAR文件
- using (var archive = RarArchive.Open(rarPath))
- {
- // 遍历所有文件
- foreach (var entry in archive.Entries)
- {
- if (!entry.IsDirectory)
- {
- // 构建完整输出路径
- string outputFilePath = Path.Combine(outputPath, entry.Key);
- // 确保输出文件的目录存在
- Directory.CreateDirectory(Path.GetDirectoryName(outputFilePath));
- // 解压文件
- entry.WriteToFile(outputFilePath, new ExtractionOptions
- {
- ExtractFullPath = true,
- Overwrite = true
- });
- }
- }
- }
- }
- catch (Exception ex)
- {
- throw new Exception($"解压RAR文件时出错: {ex.Message}");
- }
- }
- private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
- {
- if (caseInfo != null )
- {
- richTextBox1.Clear();
- string strHtml = string.Empty;
- switch (comboBox1.SelectedIndex)
- {
- case 0:
- if (caseInfo.DRRAll != null)
- {
- strHtml = $"<b>所有文字比较:</b><br/><p>初稿与第一次返稿比较结果:</p><p>初稿文件字数:{caseInfo.DRRAll.oldWordCount}</p><p>删除文字数量:{caseInfo.DRRAll.DeleteCount}</p><p>插入文字数量:{caseInfo.DRRAll.InsertCount}</p><p>修改比率:{(caseInfo.DRRAll.diffRate * 100).ToString("0.0000")}%</p><p>文档语义相似度:{(caseInfo.DRRAll.TextSimilarity*100).ToString("0.0000")}%</p>";
- }
- if (caseInfo.RFRAll != null)
- {
- strHtml = strHtml + $"<p></p><p>第一次返稿与定稿比较结果:</p><p>第一次返稿文件字数:{ caseInfo.RFRAll.oldWordCount}</p><p>删除文字数量:{caseInfo.RFRAll.DeleteCount}</p><p>插入文字数量:{caseInfo.RFRAll.InsertCount}</p><p>修改比率:{(caseInfo.RFRAll.diffRate * 100).ToString("0.0000")}%</p><p>文档语义相似度:{(caseInfo.RFRAll.TextSimilarity * 100).ToString("0.0000")}%</p>";
- }
- richTextBox1.Rtf = new HtmlToRtfConverter().ConvertHtmlToRtf(strHtml);
- break;
- case 1:
- if (caseInfo.DRRAll != null)
- {
- richTextBox1.Rtf = new HtmlToRtfConverter().ConvertHtmlToRtf(caseInfo.DRRAll.CompareResultString);
- }
- break;
- case 2:
- if (caseInfo.RFRAll != null)
- {
- richTextBox1.Rtf = new HtmlToRtfConverter().ConvertHtmlToRtf(caseInfo.RFRAll.CompareResultString);
- }
- break;
- case 3:
- if (caseInfo.DRRAbstract != null)
- {
- strHtml = $"<b>摘要比较:</b><br/><p>初稿与第一次返稿比较结果:</p><p>初稿文件字数:{caseInfo.DRRAbstract.oldWordCount}</p><p>删除文字数量:{caseInfo.DRRAbstract.DeleteCount}</p><p>插入文字数量:{caseInfo.DRRAbstract.InsertCount}</p><p>修改比率:{(caseInfo.DRRAbstract.diffRate * 100).ToString("0.0000")}%</p><p>语义相似度:{(caseInfo.DRRAbstract.TextSimilarity * 100).ToString("0.0000")}%</p>";
- }
- if (caseInfo.RFRAbstract != null)
- {
- strHtml = strHtml + $"<p></p><p>第一次返稿与定稿比较结果:</p><p>第一次返稿文件字数:{caseInfo.RFRAbstract.oldWordCount}</p><p>删除文字数量:{caseInfo.RFRAbstract.DeleteCount}</p><p>插入文字数量:{caseInfo.RFRAbstract.InsertCount}</p><p>修改比率:{(caseInfo.RFRAbstract.diffRate * 100).ToString("0.0000")}%</p><p>语义相似度:{(caseInfo.RFRAbstract.TextSimilarity * 100).ToString("0.0000")}%</p>";
- }
- richTextBox1.Rtf = new HtmlToRtfConverter().ConvertHtmlToRtf(strHtml);
- break;
- case 4:
- if (caseInfo.DRRAbstract != null)
- {
- richTextBox1.Rtf = new HtmlToRtfConverter().ConvertHtmlToRtf(caseInfo.DRRAbstract.CompareResultString);
- }
- break;
- case 5:
- if (caseInfo.RFRAbstract != null)
- {
- richTextBox1.Rtf = new HtmlToRtfConverter().ConvertHtmlToRtf(caseInfo.RFRAbstract.CompareResultString);
- }
- break;
- case 6:
- if (caseInfo.DRRCalim != null)
- {
- strHtml = $"<b>权力要求比较:</b><br/><p>初稿与第一次返稿比较结果:</p><p>初稿文件字数:{caseInfo.DRRCalim.oldWordCount}</p><p>删除文字数量:{caseInfo.DRRCalim.DeleteCount}</p><p>插入文字数量:{caseInfo.DRRCalim.InsertCount}</p><p>修改比率:{(caseInfo.DRRCalim.diffRate * 100).ToString("0.0000")}%</p><p>语义相似度:{(caseInfo.DRRCalim.TextSimilarity * 100).ToString("0.0000")}%</p>";
- }
- if (caseInfo.RFRCalim != null)
- {
- strHtml = strHtml + $"<p></p><p>第一次返稿与定稿比较结果:</p><p>第一次返稿文件字数:{caseInfo.RFRCalim.oldWordCount}</p><p>删除文字数量:{caseInfo.RFRCalim.DeleteCount}</p><p>插入文字数量:{caseInfo.RFRCalim.InsertCount}</p><p>修改比率:{(caseInfo.RFRCalim.diffRate * 100).ToString("0.0000")}%</p><p>语义相似度:{(caseInfo.RFRCalim.TextSimilarity * 100).ToString("0.0000")}%</p>";
- }
- richTextBox1.Rtf = new HtmlToRtfConverter().ConvertHtmlToRtf(strHtml);
- break;
- case 7:
- if (caseInfo.DRRCalim != null)
- {
- richTextBox1.Rtf = new HtmlToRtfConverter().ConvertHtmlToRtf(caseInfo.DRRCalim.CompareResultString);
- }
- break;
- case 8:
- if (caseInfo.RFRCalim != null)
- {
- richTextBox1.Rtf = new HtmlToRtfConverter().ConvertHtmlToRtf(caseInfo.RFRCalim.CompareResultString);
- }
- break;
- case 9:
- if (caseInfo.DRRFulltext != null)
- {
- strHtml = $"<b>说明书比较:</b><br/><p>初稿与第一次返稿比较结果:</p><p>初稿文件字数:{caseInfo.DRRFulltext.oldWordCount}</p><p>删除文字数量:{caseInfo.DRRFulltext.DeleteCount}</p><p>插入文字数量:{caseInfo.DRRFulltext.InsertCount}</p><p>修改比率:{(caseInfo.DRRFulltext.diffRate * 100).ToString("0.0000")}%</p><p>语义相似度:{(caseInfo.DRRFulltext.TextSimilarity * 100).ToString("0.0000")}%</p>";
- }
- if (caseInfo.RFRFulltext != null)
- {
- strHtml = strHtml + $"<p></p><p>第一次返稿与定稿比较结果:</p><p>第一次返稿文件字数:{caseInfo.RFRFulltext.oldWordCount}</p><p>删除文字数量:{caseInfo.RFRFulltext.DeleteCount}</p><p>插入文字数量:{caseInfo.RFRFulltext.InsertCount}</p><p>修改比率:{(caseInfo.RFRFulltext.diffRate * 100).ToString("0.0000")}%</p><p>语义相似度:{(caseInfo.RFRFulltext.TextSimilarity * 100).ToString("0.0000")}%</p>";
- }
- richTextBox1.Rtf = new HtmlToRtfConverter().ConvertHtmlToRtf(strHtml);
- break;
- case 10:
- if (caseInfo.DRRFulltext != null)
- {
- richTextBox1.Rtf = new HtmlToRtfConverter().ConvertHtmlToRtf(caseInfo.DRRFulltext.CompareResultString);
- }
- break;
- case 11:
- if (caseInfo.RFRFulltext != null)
- {
- richTextBox1.Rtf = new HtmlToRtfConverter().ConvertHtmlToRtf(caseInfo.RFRFulltext.CompareResultString);
- }
- break;
- }
- }
- }
- private void button2_Click(object sender, EventArgs e)
- {
-
- new Form1().ShowDialog();
- return;
- var caseInfo = IPEasyUtility.DownloadReport("每月绩效统计--上个月递交完成案件",true);
- return;
- var retData = IPEasyUtility.GetFinished3FilesCases(1);
- return;
-
- OpenFileDialog openFileDialog = new OpenFileDialog();
- if(openFileDialog.ShowDialog() == DialogResult.OK)
- {
- string strPath = openFileDialog.FileName.ToLower().Replace(".rar", "").Replace(".zip","");
- if(openFileDialog.FileName.Contains(".rar"))
- {
- ExtractRarFile(openFileDialog.FileName, strPath);
- }
- else
- {
- ExtractZip(openFileDialog.FileName,strPath);
- }
-
- string[] files = Directory.EnumerateFiles(strPath, "*.*", SearchOption.AllDirectories).ToArray<string>();
- Array.Sort(files);
- Array.Reverse(files);
- draft_fristReturn = new CompareDocx();
- draft_fristReturn.Compare(files[0], files[1]);
- if (files.Length > 2)
- {
- fristReturn_Finally = new CompareDocx();
- fristReturn_Finally.Compare(files[1], files[2]);
- }
- SaveResult(strPath,draft_fristReturn);
- SaveResult(strPath, fristReturn_Finally);
- }
- }
- private void SaveResult(string strPath,CompareDocx draft_fristReturn)
- {
- string strHtml = @"<!DOCTYPE html>
- <html lang=""en"">
- <head>
- <meta charset=""utf-8"">
- <meta http-equiv=""X-UA-Compatible"" content=""IE=edge"">
- <meta name=""description"" content=""email code"">
- <meta name=""viewport"" content=""width=device-width, initial-scale=1"">
- <title>对比结果</title>
- <script>
- function toggleDiv() {
-
- var radio = document.querySelector('input[name=""options""]:checked');
- if(!radio){
- return
- }
- var value = radio.value
- var div = document.getElementById('resultContent');
- var childrenDom = div.children
- if(!childrenDom || childrenDom.length==0){
- return
- }
- for(var i = 0;i<childrenDom.length;i++){
- var dom = childrenDom[i]
- if(dom.id == value){
- dom.className = 'checked'
- }else{
- dom.className = ''
- }
- }
- }
- </script>
- </head>
- <!--对比结果模板-->
- <body>
- <div class=""contrastResult"">
- <form action="""">
- <div>
- <label for=""originalFile"">原文件:</label>
- <span id=""originalFile"">{0}</span>
- </div>
- <div>
- <label for=""contrastFile"">对比文件:</label>
- <span id=""contrastFile"">{1}</span>
- </div>
- <div>
- <label for=""result"">对比结果:</label>
- <div id=""result"">
- <table>
- <thead>
- <tr>
- <td></td>
- <td>全部对比</td>
- <td>摘要</td>
- <td>权利要求</td>
- <td>说明书</td>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>原文字数</td>
- <td>{2}</td>
- <td>{3}</td>
- <td>{4}</td>
- <td>{5}</td>
- </tr>
- <tr>
- <td>删除字数</td>
- <td>{6}</td>
- <td>{7}</td>
- <td>{8}</td>
- <td>{9}</td>
- </tr>
- <tr>
- <td>插入字数</td>
- <td>{10}</td>
- <td>{11}</td>
- <td>{12}</td>
- <td>{13}</td>
- </tr>
- <tr>
- <td>修改比例</td>
- <td>{14}</td>
- <td>{15}</td>
- <td>{16}</td>
- <td>{17}</td>
- </tr>
- <tr>
- <td>语义相似度</td>
- <td>{18}</td>
- <td>{19}</td>
- <td>{20}</td>
- <td>{21}</td>
- </tr>
- </tbody>
- </table>
- </div>
- </div>
- <div class=""resultType"">
- <label for="""">结果:</label>
- <input type=""radio"" name=""options"" value=""allContrast"" id=""allContrast"" checked onchange=""toggleDiv()"">
- <label for=""allContrast"">全部对比</label>
- <input type=""radio"" name=""options"" value=""abstract"" id=""abstract"" onchange=""toggleDiv()"">
- <label for=""abstract"">摘要</label>
- <input type=""radio"" name=""options"" value=""claim"" id=""claim"" onchange=""toggleDiv()"">
- <label for=""claim"">权利要求</label>
- <input type=""radio"" name=""options"" value=""instructions"" id=""instructions"" onchange=""toggleDiv()"">
- <label for=""instructions"">说明书</label>
- </div>
- <div id=""resultContent"">
- <div id=""allContrast"">{22}</div>
- <div id=""abstract"">{23}</div>
- <div id=""claim"">{24}</div>
- <div id=""instructions"">{25}</div>
- </div>
- </form>
-
- </div>
- <script>
- toggleDiv();
- </script>
- </body>
- <style>
- .contrastResult{
- width: 1000px;
- margin: 0 auto;
- padding: 50px 0;
- }
- div{
- margin: 20px 0 ;
- }
- table{
- width: 100%;
- table-layout: fixed;
- border-collapse: collapse;
- }
- table td{
- border: 1px solid black;
- padding: 10px;
- }
- table thead td{
- text-align: center;
- }
- table tr>td:first-child{
- width: 120px;
- }
- #resultContent>div{
- display: none;
- overflow:auto;
- height:400px;
- }
- .checked{
- display: block !important;
- }
- </style>
- </html>";
- if (draft_fristReturn != null)
- {
- var temHtml = strHtml
- .Replace("{0}", new FileInfo(draft_fristReturn.oldDocument.FilePath).Name)
- .Replace("{1}", new FileInfo(draft_fristReturn.newDocument.FilePath).Name)
- .Replace("{2}", draft_fristReturn.AllStringResult.oldWordCount.ToString())
- .Replace("{3}", draft_fristReturn.AbstractResult.oldWordCount.ToString())
- .Replace("{4}", draft_fristReturn.ClaimResult.oldWordCount.ToString())
- .Replace("{5}", draft_fristReturn.FulltextResult.oldWordCount.ToString())
- .Replace("{6}", draft_fristReturn.AllStringResult.DeleteCount.ToString())
- .Replace("{7}", draft_fristReturn.AbstractResult.DeleteCount.ToString())
- .Replace("{8}", draft_fristReturn.ClaimResult.DeleteCount.ToString())
- .Replace("{9}", draft_fristReturn.FulltextResult.DeleteCount.ToString())
- .Replace("{10}", draft_fristReturn.AllStringResult.InsertCount.ToString())
- .Replace("{11}", draft_fristReturn.AbstractResult.InsertCount.ToString())
- .Replace("{12}", draft_fristReturn.ClaimResult.InsertCount.ToString())
- .Replace("{13}", draft_fristReturn.FulltextResult.InsertCount.ToString())
- .Replace("{14}", (draft_fristReturn.AllStringResult.diffRate * 100).ToString("0.0000") + "%")
- .Replace("{15}", (draft_fristReturn.AbstractResult.diffRate * 100).ToString("0.0000") + "%")
- .Replace("{16}", (draft_fristReturn.ClaimResult.diffRate * 100).ToString("0.0000") + "%")
- .Replace("{17}", (draft_fristReturn.FulltextResult.diffRate * 100).ToString("0.0000") + "%")
- .Replace("{18}", (draft_fristReturn.AllStringResult.TextSimilarity * 100).ToString("0.0000") + "%")
- .Replace("{19}", (draft_fristReturn.AbstractResult.TextSimilarity * 100).ToString("0.0000") + "%")
- .Replace("{20}", (draft_fristReturn.ClaimResult.TextSimilarity * 100).ToString("0.0000") + "%")
- .Replace("{21}", (draft_fristReturn.FulltextResult.TextSimilarity * 100).ToString("0.0000") + "%")
- .Replace("{22}", draft_fristReturn.AllStringResult.CompareResultString)
- .Replace("{23}", draft_fristReturn.AbstractResult.CompareResultString)
- .Replace("{24}", draft_fristReturn.ClaimResult.CompareResultString)
- .Replace("{25}", draft_fristReturn.FulltextResult.CompareResultString);
- string fileName = $"{new FileInfo(draft_fristReturn.oldDocument.FilePath).Name}_{new FileInfo(draft_fristReturn.newDocument.FilePath).Name}.html";
- using (var f = File.CreateText(Path.Combine(strPath, fileName)))
- {
- f.Write(temHtml);
- }
- }
- }
- }
- }
|