|
@@ -38,62 +38,7 @@ namespace wispro.sp.winClient
|
|
{
|
|
{
|
|
|
|
|
|
}
|
|
}
|
|
-
|
|
|
|
- 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)
|
|
private CaseInfo getCaseInfo_files(string caseNo,out string draftFile,out string returnFile,out string finalFile)
|
|
{
|
|
{
|
|
@@ -174,7 +119,7 @@ namespace wispro.sp.winClient
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- private void compareCaseFile()
|
|
|
|
|
|
+ private async Task compareCaseFile()
|
|
{
|
|
{
|
|
DataTable table = wispro.sp.utility.IPEasyUtility.GetFinished3FilesCases(1);
|
|
DataTable table = wispro.sp.utility.IPEasyUtility.GetFinished3FilesCases(1);
|
|
|
|
|
|
@@ -192,19 +137,28 @@ namespace wispro.sp.winClient
|
|
string finalFile =string.Empty;
|
|
string finalFile =string.Empty;
|
|
|
|
|
|
string CaseNo = row["我方文号"].ToString();
|
|
string CaseNo = row["我方文号"].ToString();
|
|
|
|
+
|
|
|
|
+ var isExistResp = new APIService().CaseExist(CaseNo);
|
|
|
|
+
|
|
|
|
+ isExistResp.Wait();
|
|
|
|
+
|
|
|
|
+ if (isExistResp.Result)
|
|
|
|
+ {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+
|
|
CaseInfo caseInfo = getCaseInfo_files(CaseNo, out draftFile,out returnFile, out finalFile);
|
|
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);
|
|
|
|
|
|
+ int i = (string.IsNullOrEmpty(draftFile) ? 0 : 1) +
|
|
|
|
+ (string.IsNullOrEmpty(returnFile) ? 0 : 1) +
|
|
|
|
+ (string.IsNullOrEmpty(finalFile) ? 0 : 1);
|
|
|
|
|
|
if (i > 1)
|
|
if (i > 1)
|
|
{
|
|
{
|
|
CompareFiles(draftFile, returnFile, finalFile, caseInfo);
|
|
CompareFiles(draftFile, returnFile, finalFile, caseInfo);
|
|
|
|
|
|
- SaveCompareResult(caseInfo);
|
|
|
|
|
|
+ await new APIService().SaveCompareResult(caseInfo);
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -304,20 +258,66 @@ namespace wispro.sp.winClient
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- private string ExtractFile(string file,int type,string strExtractPath)
|
|
|
|
|
|
+
|
|
|
|
+ CaseInfo caseInfo;
|
|
|
|
+ private void button1_Click(object sender, EventArgs e)
|
|
|
|
+ {
|
|
|
|
+ if (string.IsNullOrEmpty(this.txtCaseNo.Text))
|
|
|
|
+ {
|
|
|
|
+ if (MessageBox.Show("获取前一天所有的完成案件,并比较文档?", "提示框", MessageBoxButtons.YesNo) == DialogResult.Yes)
|
|
|
|
+ {
|
|
|
|
+ compareCaseFile();
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ MessageBox.Show("请输入案号!", "提示框", MessageBoxButtons.OK);
|
|
|
|
+ this.txtCaseNo.Focus();
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ #region 获取文本框中输入的案件,并比较三个文件
|
|
|
|
+ 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);
|
|
|
|
+
|
|
|
|
+ for (int k = 0; k < 1; k++)
|
|
|
|
+ {
|
|
|
|
+ new APIService().SaveCompareResult(caseInfo);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ comboBox1.SelectedIndex = 0;
|
|
|
|
+ #endregion
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private static string ExtractFile(string file, int type, string strExtractPath)
|
|
{
|
|
{
|
|
-
|
|
|
|
if (file.ToLower().EndsWith(".zip") || file.ToLower().EndsWith(".rar"))
|
|
if (file.ToLower().EndsWith(".zip") || file.ToLower().EndsWith(".rar"))
|
|
{
|
|
{
|
|
- string extractPath = Path.Combine(strExtractPath, file.Substring(0,file.Length-4));
|
|
|
|
|
|
+ string extractPath = Path.Combine(strExtractPath, file.Substring(0, file.Length - 4));
|
|
|
|
|
|
if (file.ToLower().EndsWith(".zip"))
|
|
if (file.ToLower().EndsWith(".zip"))
|
|
{
|
|
{
|
|
- ExtractZip(file, extractPath);
|
|
|
|
|
|
+ ExtractFileUtil.ExtractZip(file, extractPath);
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
- ExtractRarFile(file, extractPath);
|
|
|
|
|
|
+ ExtractFileUtil.ExtractRarFile(file, extractPath);
|
|
}
|
|
}
|
|
|
|
|
|
foreach (string f in Directory.GetFiles(extractPath, "*.*", SearchOption.AllDirectories))
|
|
foreach (string f in Directory.GetFiles(extractPath, "*.*", SearchOption.AllDirectories))
|
|
@@ -343,7 +343,7 @@ namespace wispro.sp.winClient
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
return null;
|
|
return null;
|
|
@@ -354,108 +354,6 @@ namespace wispro.sp.winClient
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- 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);
|
|
|
|
-
|
|
|
|
- for (int k = 0; k < 10; k++)
|
|
|
|
- {
|
|
|
|
- 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)
|
|
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
{
|
|
if (caseInfo != null )
|
|
if (caseInfo != null )
|
|
@@ -584,45 +482,40 @@ namespace wispro.sp.winClient
|
|
|
|
|
|
private void button2_Click(object sender, EventArgs e)
|
|
private void button2_Click(object sender, EventArgs e)
|
|
{
|
|
{
|
|
-
|
|
|
|
new Form1().ShowDialog();
|
|
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);
|
|
|
|
- }
|
|
|
|
|
|
+ #region 选择文档比较
|
|
|
|
+ //OpenFileDialog openFileDialog = new OpenFileDialog();
|
|
|
|
+
|
|
|
|
+ //if(openFileDialog.ShowDialog() == DialogResult.OK)
|
|
|
|
+ //{
|
|
|
|
+ // string strPath = openFileDialog.FileName.ToLower().Replace(".rar", "").Replace(".zip","");
|
|
|
|
+
|
|
|
|
+ // if(openFileDialog.FileName.Contains(".rar"))
|
|
|
|
+ // {
|
|
|
|
+ // ExtractFileUtil.ExtractRarFile(openFileDialog.FileName, strPath);
|
|
|
|
+ // }
|
|
|
|
+ // else
|
|
|
|
+ // {
|
|
|
|
+ // ExtractFileUtil.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);
|
|
|
|
+ //}
|
|
|
|
+ #endregion
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|