|
|
|
using com.sun.xml.@internal.xsom;
|
|
|
|
using Elight.Entity.APPDto.Lawyer;
|
|
|
|
using Elight.Utility;
|
|
|
|
using Elight.Utility.Code;
|
|
|
|
using Elight.Utility.Extensions;
|
|
|
|
using Microsoft.AspNetCore.DataProtection;
|
|
|
|
|
|
|
|
namespace _24Hour
|
|
|
|
{
|
|
|
|
public class TwentySystemProxyClient
|
|
|
|
{
|
|
|
|
private readonly HttpClient httpCliet;
|
|
|
|
private readonly IConfiguration configuration;
|
|
|
|
public TwentySystemProxyClient(HttpClient _httpCliet, IConfiguration _configuration)
|
|
|
|
{
|
|
|
|
this.httpCliet = _httpCliet;
|
|
|
|
this.configuration = _configuration;
|
|
|
|
|
|
|
|
httpCliet.DefaultRequestHeaders.Add("Accept", "application/json");
|
|
|
|
httpCliet.DefaultRequestHeaders.Add("User-Agent", "HttpClientFactory-Sample");
|
|
|
|
httpCliet.DefaultRequestHeaders.ConnectionClose = true;
|
|
|
|
}
|
|
|
|
public async Task<Result<QueryResult<CaseInfo>>> GetCaseList(string? casename, string? bmsah, string? dwbm, DateTime? starttime, DateTime? endtime, int page, int size)
|
|
|
|
{
|
|
|
|
Result<QueryResult<CaseInfo>> Result = new();
|
|
|
|
var param = new
|
|
|
|
{
|
|
|
|
casename = casename ?? "",
|
|
|
|
bmsah = bmsah ?? "",
|
|
|
|
dwbm = dwbm ?? "",
|
|
|
|
starttime = starttime ?? DateTime.Now.AddDays(-100),
|
|
|
|
endtime = endtime ?? DateTime.Now,
|
|
|
|
page,
|
|
|
|
size
|
|
|
|
}.ConvertToGetParam();
|
|
|
|
try
|
|
|
|
{
|
|
|
|
var response = await Task.Run(async () =>
|
|
|
|
{
|
|
|
|
var connectionString = configuration.GetSection("CaseTwenty:UseOfflineData").Value;
|
|
|
|
if (connectionString=="false")
|
|
|
|
{
|
|
|
|
var request = await httpCliet.GetAsync($"/TwentySystem/GetCaseInfo{param}");
|
|
|
|
var response = await request.EnsureSuccessStatusCode().Content.ReadAsStringAsync();
|
|
|
|
return response;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return await File.ReadAllTextAsync(Path.Combine(Environment.CurrentDirectory,"caselist.txt"));
|
|
|
|
}
|
|
|
|
});
|
|
|
|
if (string.IsNullOrEmpty(response) == false)
|
|
|
|
{
|
|
|
|
var data = response.ConvertToModel<Result<Paging<CaseInfo>>>();
|
|
|
|
if (data.result != null)
|
|
|
|
{
|
|
|
|
var a = new QueryResult<CaseInfo>(new Paging()
|
|
|
|
{
|
|
|
|
PageCount = data.result.pages ?? 0,
|
|
|
|
PageIndex = data.result.pageNum ?? 0,
|
|
|
|
PageSize = data.result.pageSize ?? 0,
|
|
|
|
RowsCount = data.result.total ?? 0
|
|
|
|
}, data.result.List.ToList());
|
|
|
|
|
|
|
|
Result.IsSucceed = true;
|
|
|
|
Result.result = a;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Result.IsSucceed = true;
|
|
|
|
Result.Message = data.Message ?? "查询成功";
|
|
|
|
Result.result = new QueryResult<CaseInfo>(new Paging()
|
|
|
|
{
|
|
|
|
PageCount = 0,
|
|
|
|
PageIndex = 0,
|
|
|
|
PageSize = 0,
|
|
|
|
RowsCount = 0,
|
|
|
|
}, new List<CaseInfo>());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Result.IsSucceed = false;
|
|
|
|
Result.Message = "查询失败";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
Result.IsSucceed = false;
|
|
|
|
Result.Message = ex.Message;
|
|
|
|
}
|
|
|
|
return Result;
|
|
|
|
}
|
|
|
|
|
|
|
|
public async Task<Result<JZJBXXDto>> GetArchivesInfo(string bmsah, string dwbm)
|
|
|
|
{
|
|
|
|
var result = new Result<JZJBXXDto>();
|
|
|
|
|
|
|
|
//var path = Path.Combine(Environment.CurrentDirectory, "datajson.txt");
|
|
|
|
//var json = await System.IO.File.ReadAllTextAsync(path);
|
|
|
|
var param = new
|
|
|
|
{
|
|
|
|
bmsah = bmsah,
|
|
|
|
dwbm = dwbm
|
|
|
|
}.ConvertToGetParam();
|
|
|
|
|
|
|
|
|
|
|
|
var json = await Task.Run(async() =>
|
|
|
|
{
|
|
|
|
var connectionString = configuration.GetSection("CaseTwenty:UseOfflineData").Value;
|
|
|
|
if (connectionString == "false")
|
|
|
|
{
|
|
|
|
var request = await httpCliet.GetAsync($"/TwentySystem/GetJZXX{param}");
|
|
|
|
var jsonstr = await request.EnsureSuccessStatusCode().Content.ReadAsStringAsync();
|
|
|
|
return jsonstr;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return await File.ReadAllTextAsync(Path.Combine(Environment.CurrentDirectory, "jzlist.txt"));
|
|
|
|
}
|
|
|
|
});
|
|
|
|
var res = json.ConvertToModel<Result<JZJBXXDto>>();
|
|
|
|
if (res.IsSucceed == true)
|
|
|
|
{
|
|
|
|
if (res.result == null)
|
|
|
|
{
|
|
|
|
result.IsSucceed = false;
|
|
|
|
result.Message = "卷宗目录为空";
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
var convert = res.result;
|
|
|
|
if (convert == null)
|
|
|
|
{
|
|
|
|
result.IsSucceed = false;
|
|
|
|
result.Message = "未找到对应卷宗";
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
convert.Id = Guid.NewGuid().ToString();
|
|
|
|
if (convert?.jzml?.Any() == true)
|
|
|
|
{
|
|
|
|
await Task.Delay(5);
|
|
|
|
foreach (var ml in convert.jzml)
|
|
|
|
{
|
|
|
|
ml.Id = Guid.NewGuid().ToString();
|
|
|
|
ml.jzId = convert.Id;
|
|
|
|
|
|
|
|
await Task.Delay(5);
|
|
|
|
foreach (var item in ml.jzwj)
|
|
|
|
{
|
|
|
|
item.jzmlId = ml.Id;
|
|
|
|
item.Id = Guid.NewGuid().ToString();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
result.IsSucceed = true;
|
|
|
|
result.result = convert;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
result.IsSucceed = false;
|
|
|
|
result.Message = res.Message;
|
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
public class Paging<T>
|
|
|
|
{
|
|
|
|
public int? pageNum { get; set; }
|
|
|
|
public int? pageSize { get; set; }
|
|
|
|
public int? total { get; set; }
|
|
|
|
public int? pages { get; set; }
|
|
|
|
public IEnumerable<T>? List { get; set; }
|
|
|
|
}
|
|
|
|
public class CaseInfo
|
|
|
|
{
|
|
|
|
public string? jzbh { get; set; }
|
|
|
|
public string? ajmc { get; set; }
|
|
|
|
public string? bmsah { get; set; }
|
|
|
|
public string? cbdwbm { get; set; }
|
|
|
|
public string? rybm { get; set; }
|
|
|
|
public string? rymc { get; set; }
|
|
|
|
public int? cs { get; set; }
|
|
|
|
public int? ys { get; set; }
|
|
|
|
public DateTime? cjsj { get; set; }
|
|
|
|
public DateTime? cjrq { get; set; }
|
|
|
|
public string? zzr { get; set; }
|
|
|
|
public string? zzrbm { get; set; }
|
|
|
|
public string? zzzt { get; set; }
|
|
|
|
public string? jzms { get; set; }
|
|
|
|
public string? jzxh { get; set; }
|
|
|
|
public string? nfbd { get; set; }
|
|
|
|
public string? jzsd { get; set; }
|
|
|
|
public string? ajlbbm { get; set; }
|
|
|
|
public string? ajlbmc { get; set; }
|
|
|
|
public DateTime? slrq { get; set; }
|
|
|
|
public string? jzocrzt { get; set; }
|
|
|
|
public string? id { get; set; }
|
|
|
|
public string? yjzmc { get; set; }
|
|
|
|
public string? sfck { get; set; }
|
|
|
|
public string? sfkcz { get; set; }
|
|
|
|
public string? qlzt { get; set; }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|