SVN r1150
SVN-Revision: r1150
This commit is contained in:
@@ -810,12 +810,12 @@ 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)
|
||||
public static string GetIncome(out string resultRead, out string resultMsg)
|
||||
{
|
||||
string code = "-9999";
|
||||
resultRead = "";
|
||||
@@ -842,24 +842,45 @@ namespace Lskj.QueryEssentialInfo
|
||||
pmsJObject.Add("skssqZ", mainRow["qysh"] + "");
|
||||
JArray bizDataListJArry = new JArray();
|
||||
JArray incomeDataListJArry = new JArray();
|
||||
foreach (DataRow detailRow in detailTab.Rows)
|
||||
var groupedRows = detailTab.AsEnumerable().Where(row => (row["p_emp_addTag"] + "") == "1").GroupBy(row => row["incomeTypeCode"] + "");
|
||||
foreach (var group in groupedRows)
|
||||
{
|
||||
JObject incomeDataJObject = new JObject();
|
||||
string addTag = detailRow["p_emp_addTag"] + "";
|
||||
if (!addTag.Equals("1"))
|
||||
JObject bizDataJObject = new JObject();
|
||||
string typeCode = group.Key; //当前的分组编码
|
||||
foreach (DataRow detailRow in group)
|
||||
{
|
||||
continue;
|
||||
JObject incomeDataJObject = new JObject();
|
||||
incomeDataJObject.Add("name", detailRow["name"] + "");
|
||||
incomeDataJObject.Add("idType", detailRow["idType"] + "");
|
||||
incomeDataJObject.Add("idNumber", detailRow["idNumber"] + "");
|
||||
incomeDataJObject.Add("income", detailRow["income"] + "");
|
||||
JObject externFieldsJObject = new JObject();
|
||||
if (typeCode.Equals("101060100010100"))
|
||||
{
|
||||
externFieldsJObject.Add("endowmentInsurance", detailRow["endowmentInsurance"] + "");
|
||||
externFieldsJObject.Add("medicalInsurance", detailRow["medicalInsurance"] + "");
|
||||
externFieldsJObject.Add("unemploymentInsurance", detailRow["unemploymentInsurance"] + "");
|
||||
externFieldsJObject.Add("housingFund", detailRow["housingFund"] + "");
|
||||
}
|
||||
else if (typeCode.Equals("101060100010300"))
|
||||
{
|
||||
externFieldsJObject.Add("sfkcjcfy", detailRow["sfkcjcfy"] + "");
|
||||
externFieldsJObject.Add("employedDate", detailRow["employedDate"] + "");
|
||||
}
|
||||
else if (typeCode.Equals("101060100010400"))
|
||||
{
|
||||
|
||||
}
|
||||
else if (typeCode.Equals("101060100010500"))
|
||||
{
|
||||
|
||||
}
|
||||
incomeDataListJArry.Add(incomeDataJObject);
|
||||
}
|
||||
incomeDataJObject.Add("name", detailRow["name"] + "");
|
||||
incomeDataJObject.Add("idType", detailRow["idType"] + "");
|
||||
incomeDataJObject.Add("idNumber", detailRow["idNumber"] + "");
|
||||
incomeDataJObject.Add("income", detailRow["income"] + "");
|
||||
incomeDataListJArry.Add(incomeDataJObject);
|
||||
bizDataJObject.Add("incomeTypeCode", typeCode);
|
||||
bizDataJObject.Add("incomeDataList", incomeDataListJArry);
|
||||
bizDataListJArry.Add(bizDataJObject);
|
||||
}
|
||||
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();
|
||||
@@ -877,6 +898,99 @@ namespace Lskj.QueryEssentialInfo
|
||||
return code;
|
||||
}
|
||||
/// <summary>
|
||||
/// 生成批次信息
|
||||
/// </summary>
|
||||
/// <param name="resultRead"></param>
|
||||
/// <param name="resultMsg"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetBatch(out string resultRead, string incomeTypeCode, out string resultMsg)
|
||||
{
|
||||
string code = "-9999";
|
||||
resultRead = "";
|
||||
resultMsg = "";
|
||||
try
|
||||
{
|
||||
string url = $"{urlStart}/web/sbmk/personal-tax/api/v1/gen/batch";
|
||||
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("ysyf", mainRow["ysyf"] + "");
|
||||
pmsJObject.Add("nsrlxdm", mainRow["nsrlxdm"] + "");
|
||||
pmsJObject.Add("incomeTypeCode", incomeTypeCode);
|
||||
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>
|
||||
/// 获取计算结果
|
||||
/// </summary>
|
||||
/// <param name="resultRead"></param>
|
||||
/// <param name="incomeTypeCode"></param>
|
||||
/// <param name="resultMsg"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetResult(out string resultRead, string incomeTypeCode, out string resultMsg)
|
||||
{
|
||||
string code = "-9999";
|
||||
resultRead = "";
|
||||
resultMsg = "";
|
||||
try
|
||||
{
|
||||
string url = $"{urlStart}/web/sbmk/personal-tax/api/v1/acquire/compute/result";
|
||||
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("skssqQ", mainRow["skssqQ"] + "");
|
||||
pmsJObject.Add("skssqZ", mainRow["skssqZ"] + "");
|
||||
pmsJObject.Add("incomeTypeCode", incomeTypeCode);
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user