SVN r1100
SVN-Revision: r1100
This commit is contained in:
@@ -17,6 +17,7 @@ namespace Lskj.QueryEssentialInfo
|
||||
{
|
||||
public static class QueryApiUtil
|
||||
{
|
||||
public static string urlStart = "https://api.baiwangjs.com/swgx-saas/swgxpt-shishi-cpsbmk/v2";
|
||||
public static DataRow mainRow;
|
||||
public static DataTable detailTab;
|
||||
/// <summary>
|
||||
@@ -351,7 +352,7 @@ namespace Lskj.QueryEssentialInfo
|
||||
resultMsg = "";
|
||||
try
|
||||
{
|
||||
string url = "http://swgxs.poc.htjs.net:9019/v2/web/sbmk/personal-tax/api/v1/gsmycsh";
|
||||
string url = $"{urlStart}/web/sbmk/personal-tax/api/v1/gsmycsh";
|
||||
HttpTools.setting("application/json", null, null, HttpTools.Encode.UTF8);
|
||||
Dictionary<string, string> headerDic = new Dictionary<string, string>();
|
||||
DateTime utcNow = DateTime.UtcNow;
|
||||
@@ -395,7 +396,7 @@ namespace Lskj.QueryEssentialInfo
|
||||
resultMsg = "";
|
||||
try
|
||||
{
|
||||
string url = "http://swgxs.poc.htjs.net:9019/v2/web/sbmk/personal-tax/api/v1/syn/person";
|
||||
string url = $"{urlStart}/web/sbmk/personal-tax/api/v1/syn/person";
|
||||
HttpTools.setting("application/json", null, null, HttpTools.Encode.UTF8);
|
||||
Dictionary<string, string> headerDic = new Dictionary<string, string>();
|
||||
DateTime utcNow = DateTime.UtcNow;
|
||||
@@ -421,15 +422,15 @@ namespace Lskj.QueryEssentialInfo
|
||||
continue;
|
||||
}
|
||||
JObject bizDataJObject = new JObject();
|
||||
bizDataJObject.Add("name", detailRow["name"] + "");
|
||||
bizDataJObject.Add("idType", detailRow["idType"] + "");
|
||||
bizDataJObject.Add("idNumber", detailRow["idNumber"] + "");
|
||||
bizDataJObject.Add("sex", detailRow["sex"] + "");
|
||||
bizDataJObject.Add("birthday", detailRow["birthday"] + "");
|
||||
bizDataJObject.Add("employType", detailRow["employType"] + "");
|
||||
bizDataJObject.Add("employedDate", detailRow["employedDate"] + "");
|
||||
bizDataJObject.Add("phoneNumber", detailRow["phoneNumber"] + "");
|
||||
bizDataJObject.Add("isDeductExpense", detailRow["isDeductExpense"] + "");
|
||||
bizDataJObject.Add("name", detailRow.Table.Columns.Contains("name") ? detailRow["name"] + "" : "");
|
||||
bizDataJObject.Add("idType", detailRow.Table.Columns.Contains("idType") ? detailRow["idType"] + "" : "");
|
||||
bizDataJObject.Add("idNumber", detailRow.Table.Columns.Contains("idNumber") ? detailRow["idNumber"] + "" : "");
|
||||
bizDataJObject.Add("sex", detailRow.Table.Columns.Contains("sex") ? detailRow["sex"] + "" : "");
|
||||
bizDataJObject.Add("birthday", detailRow.Table.Columns.Contains("birthday") ? detailRow["birthday"] + "" : "");
|
||||
bizDataJObject.Add("employType", detailRow.Table.Columns.Contains("employType") ? detailRow["employType"] + "" : "");
|
||||
bizDataJObject.Add("employedDate", detailRow.Table.Columns.Contains("employedDate") ? detailRow["employedDate"] + "" : "");
|
||||
bizDataJObject.Add("phoneNumber", detailRow.Table.Columns.Contains("phoneNumber") ? detailRow["phoneNumber"] + "" : "");
|
||||
bizDataJObject.Add("isDeductExpense", detailRow.Table.Columns.Contains("isDeductExpense") ? detailRow["isDeductExpense"] + "" : "");
|
||||
bizlistJArray.Add(bizDataJObject);
|
||||
}
|
||||
pmsJObject.Add("bizDataList", bizlistJArray);
|
||||
@@ -458,7 +459,7 @@ namespace Lskj.QueryEssentialInfo
|
||||
resultMsg = "";
|
||||
try
|
||||
{
|
||||
string url = "http://swgxs.poc.htjs.net:9019/v2/web/sbmk/personal-tax/api/v1/person/submit/query";
|
||||
string url = $"{urlStart}/web/sbmk/personal-tax/api/v1/person/submit/query";
|
||||
HttpTools.setting("application/json", null, null, HttpTools.Encode.UTF8);
|
||||
Dictionary<string, string> headerDic = new Dictionary<string, string>();
|
||||
DateTime utcNow = DateTime.UtcNow;
|
||||
@@ -500,7 +501,7 @@ namespace Lskj.QueryEssentialInfo
|
||||
resultMsg = "";
|
||||
try
|
||||
{
|
||||
string url = "http://swgxs.poc.htjs.net:9019/v2/web/sbmk/personal-tax/api/v1/syn/special/addition";
|
||||
string url = $"{urlStart}/web/sbmk/personal-tax/api/v1/syn/special/addition";
|
||||
HttpTools.setting("application/json", null, null, HttpTools.Encode.UTF8);
|
||||
Dictionary<string, string> headerDic = new Dictionary<string, string>();
|
||||
DateTime utcNow = DateTime.UtcNow;
|
||||
@@ -555,7 +556,7 @@ namespace Lskj.QueryEssentialInfo
|
||||
resultMsg = "";
|
||||
try
|
||||
{
|
||||
string url = "http://swgxs.poc.htjs.net:9019/v2/web/sbmk/personal-tax/api/v1/acquire/special/addition";
|
||||
string url = $"{urlStart}/web/sbmk/personal-tax/api/v1/acquire/special/addition";
|
||||
HttpTools.setting("application/json", null, null, HttpTools.Encode.UTF8);
|
||||
Dictionary<string, string> headerDic = new Dictionary<string, string>();
|
||||
DateTime utcNow = DateTime.UtcNow;
|
||||
@@ -613,7 +614,7 @@ namespace Lskj.QueryEssentialInfo
|
||||
resultMsg = "";
|
||||
try
|
||||
{
|
||||
string url = "http://swgxs.poc.htjs.net:9019/v2/web/sbmk/personal-tax/api/v1/acquire/ylj/fqcx";
|
||||
string url = $"{urlStart}/web/sbmk/personal-tax/api/v1/acquire/ylj/fqcx";
|
||||
HttpTools.setting("application/json", null, null, HttpTools.Encode.UTF8);
|
||||
Dictionary<string, string> headerDic = new Dictionary<string, string>();
|
||||
DateTime utcNow = DateTime.UtcNow;
|
||||
@@ -670,7 +671,7 @@ namespace Lskj.QueryEssentialInfo
|
||||
resultMsg = "";
|
||||
try
|
||||
{
|
||||
string url = "http://swgxs.poc.htjs.net:9019/v2/web/sbmk/personal-tax/api/v1/acquire/ylj/list";
|
||||
string url = $"{urlStart}/web/sbmk/personal-tax/api/v1/acquire/ylj/list";
|
||||
HttpTools.setting("application/json", null, null, HttpTools.Encode.UTF8);
|
||||
Dictionary<string, string> headerDic = new Dictionary<string, string>();
|
||||
DateTime utcNow = DateTime.UtcNow;
|
||||
@@ -730,7 +731,7 @@ namespace Lskj.QueryEssentialInfo
|
||||
resultMsg = "";
|
||||
try
|
||||
{
|
||||
string url = "http://swgxs.poc.htjs.net:9019/v2/web/sbmk/personal-tax/api/v1/submit";
|
||||
string url = $"{urlStart}/web/sbmk/personal-tax/api/v1/submit";
|
||||
HttpTools.setting("application/json", null, null, HttpTools.Encode.UTF8);
|
||||
Dictionary<string, string> headerDic = new Dictionary<string, string>();
|
||||
DateTime utcNow = DateTime.UtcNow;
|
||||
@@ -774,7 +775,7 @@ namespace Lskj.QueryEssentialInfo
|
||||
resultMsg = "";
|
||||
try
|
||||
{
|
||||
string url = "http://swgxs.poc.htjs.net:9019/v2/web/sbmk/personal-tax/api/v1/submit/query";
|
||||
string url = $"{urlStart}/web/sbmk/personal-tax/api/v1/submit/query";
|
||||
HttpTools.setting("application/json", null, null, HttpTools.Encode.UTF8);
|
||||
Dictionary<string, string> headerDic = new Dictionary<string, string>();
|
||||
DateTime utcNow = DateTime.UtcNow;
|
||||
@@ -809,6 +810,73 @@ namespace Lskj.QueryEssentialInfo
|
||||
return code;
|
||||
}
|
||||
/// <summary>
|
||||
/// 发起个人养老金查询
|
||||
/// </summary>
|
||||
/// <param name="resultRead"></param>
|
||||
/// <param name="resultMsg"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetDSFXZ(out string resultRead, out string resultMsg)
|
||||
{
|
||||
string code = "-9999";
|
||||
resultRead = "";
|
||||
resultMsg = "";
|
||||
try
|
||||
{
|
||||
string url = $"{urlStart}/web/sbmk/personal-tax/api/v1/syn/income";
|
||||
HttpTools.setting("application/json", null, null, HttpTools.Encode.UTF8);
|
||||
Dictionary<string, string> headerDic = new Dictionary<string, string>();
|
||||
DateTime utcNow = DateTime.UtcNow;
|
||||
string date = utcNow.ToString("r", CultureInfo.InvariantCulture);
|
||||
string host = "api.baiwangjs.com";
|
||||
string x_htjs_nonce = Guid.NewGuid().ToString().ToLower();
|
||||
string x_htjs_ua = "1.8.0_181 64 bit, sdk-ver=1.0.0";
|
||||
headerDic.Add("Date", DateTime.UtcNow.ToString());
|
||||
headerDic.Add("host", host);
|
||||
headerDic.Add("x-htjs-nonce", x_htjs_nonce);
|
||||
headerDic.Add("x-htjs-ua", x_htjs_ua);
|
||||
headerDic.Add("Authorization", $"{GetAuthorization(date, host, x_htjs_nonce, x_htjs_ua)}");
|
||||
JObject pmsJObject = new JObject();
|
||||
pmsJObject.Add("qysh", mainRow["qysh"] + "");
|
||||
pmsJObject.Add("operator", mainRow["qysh"] + "");
|
||||
pmsJObject.Add("skssqQ", mainRow["qysh"] + "");
|
||||
pmsJObject.Add("skssqZ", mainRow["qysh"] + "");
|
||||
JArray bizDataListJArry = new JArray();
|
||||
JArray incomeDataListJArry = new JArray();
|
||||
foreach (DataRow detailRow in detailTab.Rows)
|
||||
{
|
||||
JObject incomeDataJObject = new JObject();
|
||||
string addTag = detailRow["p_emp_addTag"] + "";
|
||||
if (!addTag.Equals("1"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
incomeDataJObject.Add("name", detailRow["name"] + "");
|
||||
incomeDataJObject.Add("idType", detailRow["idType"] + "");
|
||||
incomeDataJObject.Add("idNumber", detailRow["idNumber"] + "");
|
||||
incomeDataJObject.Add("income", detailRow["income"] + "");
|
||||
incomeDataListJArry.Add(incomeDataJObject);
|
||||
}
|
||||
JObject bizDataJObject = new JObject();
|
||||
bizDataJObject.Add("incomeTypeCode", "101060100010500");
|
||||
bizDataJObject.Add("incomeDataList", incomeDataListJArry);
|
||||
bizDataListJArry.Add(bizDataJObject);
|
||||
pmsJObject.Add("bizDataList", bizDataListJArry);
|
||||
HttpWebResponse webResponse = HttpTools.Post(url, JsonConvert.SerializeObject(pmsJObject), null, headerDic, HttpTools.Method.POST);
|
||||
resultRead = new StreamReader(webResponse.GetResponseStream(), Encoding.UTF8).ReadToEnd();
|
||||
if (webResponse != null && !string.IsNullOrEmpty(resultRead))
|
||||
{
|
||||
JObject resultJObject = (JObject)JsonConvert.DeserializeObject(resultRead);
|
||||
code = resultJObject["code"] + "";
|
||||
resultMsg = resultJObject["msg"] + "";
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
return code;
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取Authorization
|
||||
/// </summary>
|
||||
public static string GetAuthorization(string date, string host, string x_htjs_nonce, string x_htjs_ua)
|
||||
@@ -833,4 +901,26 @@ namespace Lskj.QueryEssentialInfo
|
||||
string rtnValue = "";
|
||||
byte[] keyBytes = Encoding.UTF8.GetBytes(key);
|
||||
byte[] valueBytes = Encoding.UTF8.GetBytes(value);
|
||||
using (var hmacsha256 = n
|
||||
using (var hmacsha256 = new HMACSHA256(keyBytes))
|
||||
{
|
||||
byte[] hashValue = hmacsha256.ComputeHash(valueBytes);
|
||||
rtnValue = Convert.ToBase64String(hashValue);
|
||||
}
|
||||
return rtnValue;
|
||||
}
|
||||
/// <summary>
|
||||
/// MD5加密
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetMD5Hash(string input)
|
||||
{
|
||||
if (string.IsNullOrEmpty(input))
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
using (MD5 md5 = MD5.Create())
|
||||
{
|
||||
byte[] inputBytes = Encoding.UTF8.GetBytes(input);
|
||||
byte[] hashBytes = md5.ComputeHash(inputBytes);
|
||||
StringBuilder sb = new StringBuil
|
||||
Reference in New Issue
Block a user