Просмотр исходного кода

修正PerformanceItem中danger中没有返稿日期的时候,将结束日期为完成日期的
比较结果导出文件的添加中间数据工参考

luocaiyang 8 месяцев назад
Родитель
Сommit
e45f801bfa

+ 20 - 1
wispro.sp.api/Controllers/CaseFileCompareController.cs

@@ -261,7 +261,11 @@ namespace wispro.sp.api.Controllers
         /// </summary>
         /// <param name="start">定稿日开始时间</param>
         /// <param name="end">定稿日结束时间</param>
-        /// <param name="type">0:基于文本相似度计算,1:基于文本修改差异度计算</param>
+        /// <param name="type">
+        /// 0:基于文本相似度计算,
+        /// 1:基于文本修改差异度计算
+        /// 2:权要权重70说明书30
+        /// </param>
         /// <returns></returns>
         public IList<Object> CalCustomer_mean(DateTime start,DateTime end,int type=0)
         {
@@ -333,8 +337,16 @@ namespace wispro.sp.api.Controllers
             dt.Columns.Add("客户");
             dt.Columns.Add("处理人");
             dt.Columns.Add("核稿人");
+            dt.Columns.Add("内部核稿相似度或差异度");
+            dt.Columns.Add("内部客户平均值");
+            dt.Columns.Add("内部客户标准偏差");
             dt.Columns.Add("内部核稿分数");
+
+            dt.Columns.Add("外部核稿相似度或差异度");
+            dt.Columns.Add("外部客户平均值");
+            dt.Columns.Add("外部客户标准偏差");
             dt.Columns.Add("外部核稿分数");
+
             dt.Columns.Add("备注");
 
             foreach (var item in caseList)
@@ -367,8 +379,15 @@ namespace wispro.sp.api.Controllers
                 row["核稿人"] = item.Reviewer?.Name;
                 row["处理人"] = item.Handlers;
                 var zScoreA = (oneSim -one.Average)/one.Std_Deviation;
+                row["内部核稿相似度或差异度"] = oneSim;
+                row["内部客户平均值"] = one.Average;
+                row["内部客户标准偏差"] = one.Std_Deviation;
                 row["内部核稿分数"] = zScoreA;
+
                 var zScoreB = (twoSim -two.Average)/two.Std_Deviation;
+                row["外部核稿相似度或差异度"] = twoSim;
+                row["外部客户平均值"] = two.Average;
+                row["外部客户标准偏差"] = two.Std_Deviation;
                 row["外部核稿分数"] = zScoreB;
 
                 var distince = Math.Sqrt(zScoreB.Value * zScoreB.Value + zScoreA.Value * zScoreA.Value);

+ 26 - 9
wispro.sp.utility/CompareDocx.cs

@@ -62,12 +62,20 @@ namespace wispro.sp.utility
                     word = new Application();
                     // 打开Word文档
                     System.IO.FileInfo fileInfo = new System.IO.FileInfo(filePath);
-                    doc = word.Documents.Open(fileInfo.FullName);
-                    // 读取文档内容
-                    content = doc.Content.Text;
 
-                    List<string> lines = content.Split(new string[] { "\f", "\r" }, StringSplitOptions.None).ToList();
-                    return List2String(lines);
+                    if (fileInfo.Name.Contains("-保密-"))
+                    {
+                        return null;
+                    }
+                    else
+                    {
+                        doc = word.Documents.Open(fileInfo.FullName);
+                        // 读取文档内容
+                        content = doc.Content.Text;
+
+                        List<string> lines = content.Split(new string[] { "\f", "\r" }, StringSplitOptions.None).ToList();
+                        return List2String(lines);
+                    }
 
                 }
                 catch (Exception ex)
@@ -242,10 +250,19 @@ namespace wispro.sp.utility
             this.oldDocument =new PatentDocument(oldFile);
             this.newDocument =new PatentDocument(newFile);
 
-            this.ClaimResult = StringCompare(this.oldDocument.Claim,this.newDocument.Claim);
-            this.AbstractResult = StringCompare(this.oldDocument.Abstract, this.newDocument.Abstract);
-            this.FulltextResult = StringCompare(this.oldDocument.FullText, this.newDocument.FullText);
-            this.AllStringResult = StringCompare(this.oldDocument.DocumentString, this.newDocument.DocumentString);
+            if (!string.IsNullOrEmpty(this.oldDocument.Claim) && !string.IsNullOrEmpty(this.newDocument.Claim))
+            {
+                this.ClaimResult = StringCompare(this.oldDocument.Claim, this.newDocument.Claim);
+            }
+
+            if (!string.IsNullOrEmpty(this.oldDocument.Abstract) && !string.IsNullOrEmpty(this.newDocument.Abstract))
+                this.AbstractResult = StringCompare(this.oldDocument.Abstract, this.newDocument.Abstract);
+
+            if (!string.IsNullOrEmpty(this.oldDocument.FullText) && !string.IsNullOrEmpty(this.newDocument.FullText))
+                this.FulltextResult = StringCompare(this.oldDocument.FullText, this.newDocument.FullText);
+
+            if (!string.IsNullOrEmpty(this.oldDocument.DocumentString) && !string.IsNullOrEmpty(this.newDocument.DocumentString))
+                this.AllStringResult = StringCompare(this.oldDocument.DocumentString, this.newDocument.DocumentString);
 
         }
 

+ 1 - 1
wispro.sp.utility/IPEasyUtility.cs

@@ -727,7 +727,7 @@ namespace wispro.sp.utility
                         return firstTr.FindElement(By.XPath(".//td/a[@title='下载']"));
                     }).Click();
 
-                    var ReportName = $"案件清单({DateTime.Now.ToString("yyyy年MM月d日")})";
+                    var ReportName = $"案件清单({DateTime.Now.ToString("yyyy年M月d日")})";
                     string strFilePath = System.IO.Path.Combine(strFileSavePath, $"{ReportName.Trim()}.xlsx");
                     WaitForFileDownload(strFileSavePath, $"{ReportName.Trim()}.xlsx", TimeSpan.FromMinutes(5),out strFilePath);
 

+ 1 - 1
wispro.sp.winClient/APIService.cs

@@ -105,7 +105,7 @@ namespace wispro.sp.winClient
                 http.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("bearer", Token?.Token);
                 try
                 {
-                    var data = await http.GetAsync($"{strAPIBaseUri}/api/CaseFileCompare/CalCustomer_mean?start=2024-10-01&end=2024-12-27&type=1");
+                    var data = await http.GetAsync($"{strAPIBaseUri}/api/CaseFileCompare/CalCustomer_mean?start=2024-10-01&end=2025-12-27&type=2");
 
                     if (data.IsSuccessStatusCode)
                     {

+ 72 - 10
wispro.sp.winClient/frmCaseFileCompare.cs

@@ -176,10 +176,42 @@ namespace wispro.sp.winClient
                             (string.IsNullOrEmpty(returnFile) ? 0 : 1) +
                             (string.IsNullOrEmpty(finalFile) ? 0 : 1);
 
+                        
+                        //continue;
+
                         DebugLog($"{DateTime.Now}\t{iIndex}/{table.Rows.Count}\t{CaseNo}\t{(string.IsNullOrEmpty(draftFile) ? 0 : 1)}\t{(string.IsNullOrEmpty(returnFile) ? 0 : 1)}\t{(string.IsNullOrEmpty(finalFile) ? 0 : 1)}");
                         
                         if (i > 1 && returnFile != null)
                         {
+                            #region 将文件复制到保存文件夹中
+                            string strSavePath = "d:\\CaseFiles";
+
+                            string strCaseFilePath = Path.Combine(strSavePath, caseInfo.CaseNo);
+                            if (!Directory.Exists(strCaseFilePath))
+                            {
+                                Directory.CreateDirectory(strCaseFilePath);
+                            }
+                            if (!string.IsNullOrEmpty(draftFile))
+                            {
+                                FileInfo file = new FileInfo(draftFile);
+
+                                File.Copy(draftFile, Path.Combine(strCaseFilePath, $"草稿-{file.Name}"), true);
+                            }
+
+                            if (!string.IsNullOrEmpty(returnFile))
+                            {
+                                FileInfo file = new FileInfo(returnFile);
+
+                                File.Copy(returnFile, Path.Combine(strCaseFilePath, $"返稿-{file.Name}"), true);
+                            }
+
+                            if (!string.IsNullOrEmpty(finalFile))
+                            {
+                                FileInfo file = new FileInfo(finalFile);
+
+                                File.Copy(finalFile, Path.Combine(strCaseFilePath, $"定稿-{file.Name}"), true);
+                            }
+                            #endregion
                             CompareFiles(draftFile, returnFile, finalFile, caseInfo);
 
                             if (!(caseInfo.DRRAll == null && caseInfo.RFRAll == null))
@@ -243,22 +275,22 @@ namespace wispro.sp.winClient
             {
                 CompareDocx docx = new CompareDocx();
                 docx.Compare(tmpdraftFile, tmpreturnFile);
-                if (docx.FulltextResult.oldWordCount > 0)
+                if (docx.FulltextResult?.oldWordCount > 0)
                 {
                     caseInfo.DRRFulltext = docx.FulltextResult;
                 }
 
-                if (docx.AbstractResult.oldWordCount > 0)
+                if (docx.AbstractResult?.oldWordCount > 0)
                 {
                     caseInfo.DRRAbstract = docx.AbstractResult;
                 }
 
-                if (docx.ClaimResult.oldWordCount > 0)
+                if (docx.ClaimResult?.oldWordCount > 0)
                 {
                     caseInfo.DRRCalim = docx.ClaimResult;
                 }
 
-                if (docx.AllStringResult.oldWordCount > 0)
+                if (docx.AllStringResult?.oldWordCount > 0)
                 {
                     caseInfo.DRRAll = docx.AllStringResult;
                 }
@@ -269,22 +301,22 @@ namespace wispro.sp.winClient
                 CompareDocx docx = new CompareDocx();
                 docx.Compare(tmpreturnFile, tmpfinalFile);
 
-                if (docx.FulltextResult.oldWordCount > 0)
+                if (docx.FulltextResult?.oldWordCount > 0)
                 {
                     caseInfo.RFRFulltext = docx.FulltextResult;
                 }
 
-                if (docx.AbstractResult.oldWordCount > 0)
+                if (docx.AbstractResult?.oldWordCount > 0)
                 {
                     caseInfo.RFRAbstract = docx.AbstractResult;
                 }
 
-                if (docx.ClaimResult.oldWordCount > 0)
+                if (docx.ClaimResult?.oldWordCount > 0)
                 {
                     caseInfo.RFRCalim = docx.ClaimResult;
                 }
 
-                if (docx.AllStringResult.oldWordCount > 0)
+                if (docx.AllStringResult?.oldWordCount > 0)
                 {
                     caseInfo.RFRAll = docx.AllStringResult;
                 }
@@ -348,7 +380,7 @@ namespace wispro.sp.winClient
             {
                 if (MessageBox.Show("获取前一天所有的完成案件,并比较文档?", "提示框", MessageBoxButtons.YesNo) == DialogResult.Yes)
                 {
-                    compareCaseFile(DateTime.Parse("2024-12-01"),DateTime.Now);
+                    compareCaseFile(DateTime.Parse("2024-12-01"),DateTime.Parse("2024-12-31"));
                     return;
                 }
                 else
@@ -370,7 +402,37 @@ namespace wispro.sp.winClient
                             (string.IsNullOrEmpty(returnFile) ? 0 : 1) +
                             (string.IsNullOrEmpty(finalFile) ? 0 : 1);
 
-              if (i > 1)
+                #region 将文件复制到保存文件夹中
+                string strSavePath = "d:\\CaseFiles";
+
+                string strCaseFilePath = Path.Combine(strSavePath, caseInfo.CaseNo);
+                if (!Directory.Exists(strCaseFilePath))
+                {
+                    Directory.CreateDirectory(strCaseFilePath);
+                }
+                if (!string.IsNullOrEmpty(draftFile))
+                {
+                    FileInfo file = new FileInfo(draftFile);
+
+                    File.Copy(draftFile, Path.Combine(strCaseFilePath, $"草稿-{file.Name}"), true);
+                }
+
+                if (!string.IsNullOrEmpty(returnFile))
+                {
+                    FileInfo file = new FileInfo(returnFile);
+
+                    File.Copy(returnFile, Path.Combine(strCaseFilePath, $"返稿-{file.Name}"), true);
+                }
+
+                if (!string.IsNullOrEmpty(finalFile))
+                {
+                    FileInfo file = new FileInfo(finalFile);
+
+                    File.Copy(finalFile, Path.Combine(strCaseFilePath, $"定稿-{file.Name}"), true);
+                }
+                #endregion
+
+                if (i > 1)
                 {
                     CompareFiles(draftFile, returnFile, finalFile, caseInfo);
                     new APIService().SaveCompareResult(caseInfo);

+ 7 - 0
wospro.sp.entity/PerformanceItem.cs

@@ -246,6 +246,13 @@ namespace wispro.sp.entity
                 {
                     dt1 = ReturnDate.Value;
                 }
+                else
+                {
+                    if (FinishedDate != null)
+                    {
+                        dt1 = FinishedDate.Value;
+                    }
+                }
 
                 DateTime dt2 = DateTime.MinValue;
                 if (CustomerLimitDate != null)