远望上传,个税代码调整
This commit is contained in:
@@ -6,6 +6,7 @@ using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
@@ -427,8 +428,16 @@ namespace Lskj.QueryEssentialInfo
|
||||
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"] + "" : "");
|
||||
string employType = detailRow.Table.Columns.Contains("employType") ? detailRow["employType"] + "" : "";
|
||||
bizDataJObject.Add("employType", employType);
|
||||
if (employType.Equals("雇员"))
|
||||
{
|
||||
bizDataJObject.Add("employedDate", detailRow.Table.Columns.Contains("employedDate") ? detailRow["employedDate"] + "" : "");
|
||||
}
|
||||
else if (employType.Equals("其他"))
|
||||
{
|
||||
bizDataJObject.Add("taxRelatedMatters", detailRow.Table.Columns.Contains("taxRelatedMatters") ? detailRow["taxRelatedMatters"] + "" : "");
|
||||
}
|
||||
bizDataJObject.Add("phoneNumber", detailRow.Table.Columns.Contains("phoneNumber") ? detailRow["phoneNumber"] + "" : "");
|
||||
bizDataJObject.Add("isDeductExpense", detailRow.Table.Columns.Contains("isDeductExpense") ? detailRow["isDeductExpense"] + "" : "");
|
||||
bizlistJArray.Add(bizDataJObject);
|
||||
@@ -436,6 +445,7 @@ namespace Lskj.QueryEssentialInfo
|
||||
pmsJObject.Add("bizDataList", bizlistJArray);
|
||||
HttpWebResponse webResponse = HttpTools.Post(url, JsonConvert.SerializeObject(pmsJObject), null, headerDic, HttpTools.Method.POST);
|
||||
resultRead = new StreamReader(webResponse.GetResponseStream(), Encoding.UTF8).ReadToEnd();
|
||||
WriteLogInfo("同步人员", JsonConvert.SerializeObject(pmsJObject), resultRead);
|
||||
if (webResponse != null && !string.IsNullOrEmpty(resultRead))
|
||||
{
|
||||
JObject resultJObject = (JObject)JsonConvert.DeserializeObject(resultRead);
|
||||
@@ -478,6 +488,7 @@ namespace Lskj.QueryEssentialInfo
|
||||
pmsJObject.Add("operator", mainRow["operator"] + "");
|
||||
HttpWebResponse webResponse = HttpTools.Post(url, JsonConvert.SerializeObject(pmsJObject), null, headerDic, HttpTools.Method.POST);
|
||||
resultRead = new StreamReader(webResponse.GetResponseStream(), Encoding.UTF8).ReadToEnd();
|
||||
WriteLogInfo("查询人员报送情况", JsonConvert.SerializeObject(pmsJObject), resultRead);
|
||||
if (webResponse != null && !string.IsNullOrEmpty(resultRead))
|
||||
{
|
||||
JObject resultJObject = (JObject)JsonConvert.DeserializeObject(resultRead);
|
||||
@@ -533,6 +544,7 @@ namespace Lskj.QueryEssentialInfo
|
||||
pmsJObject.Add("idNumberList", idNumberjArray);
|
||||
HttpWebResponse webResponse = HttpTools.Post(url, JsonConvert.SerializeObject(pmsJObject), null, headerDic, HttpTools.Method.POST);
|
||||
resultRead = new StreamReader(webResponse.GetResponseStream(), Encoding.UTF8).ReadToEnd();
|
||||
WriteLogInfo("同步专项附加", JsonConvert.SerializeObject(pmsJObject), resultRead);
|
||||
if (webResponse != null && !string.IsNullOrEmpty(resultRead))
|
||||
{
|
||||
JObject resultJObject = (JObject)JsonConvert.DeserializeObject(resultRead);
|
||||
@@ -588,6 +600,7 @@ namespace Lskj.QueryEssentialInfo
|
||||
pmsJObject.Add("idNumberList", idNumberjArray);
|
||||
HttpWebResponse webResponse = HttpTools.Post(url, JsonConvert.SerializeObject(pmsJObject), null, headerDic, HttpTools.Method.POST);
|
||||
resultRead = new StreamReader(webResponse.GetResponseStream(), Encoding.UTF8).ReadToEnd();
|
||||
WriteLogInfo("查询专项附加", JsonConvert.SerializeObject(pmsJObject), resultRead);
|
||||
if (webResponse != null && !string.IsNullOrEmpty(resultRead))
|
||||
{
|
||||
JObject resultJObject = (JObject)JsonConvert.DeserializeObject(resultRead);
|
||||
@@ -648,6 +661,7 @@ namespace Lskj.QueryEssentialInfo
|
||||
pmsJObject.Add("idNumberList", idNumberjArray);
|
||||
HttpWebResponse webResponse = HttpTools.Post(url, JsonConvert.SerializeObject(pmsJObject), null, headerDic, HttpTools.Method.POST);
|
||||
resultRead = new StreamReader(webResponse.GetResponseStream(), Encoding.UTF8).ReadToEnd();
|
||||
WriteLogInfo("发起养老金查询", JsonConvert.SerializeObject(pmsJObject), resultRead);
|
||||
if (webResponse != null && !string.IsNullOrEmpty(resultRead))
|
||||
{
|
||||
JObject resultJObject = (JObject)JsonConvert.DeserializeObject(resultRead);
|
||||
@@ -705,6 +719,7 @@ namespace Lskj.QueryEssentialInfo
|
||||
pmsJObject.Add("idNumberList", idNumberjArray);
|
||||
HttpWebResponse webResponse = HttpTools.Post(url, JsonConvert.SerializeObject(pmsJObject), null, headerDic, HttpTools.Method.POST);
|
||||
resultRead = new StreamReader(webResponse.GetResponseStream(), Encoding.UTF8).ReadToEnd();
|
||||
WriteLogInfo("获取养老金明细", JsonConvert.SerializeObject(pmsJObject), resultRead);
|
||||
if (webResponse != null && !string.IsNullOrEmpty(resultRead))
|
||||
{
|
||||
JObject resultJObject = (JObject)JsonConvert.DeserializeObject(resultRead);
|
||||
@@ -752,6 +767,55 @@ namespace Lskj.QueryEssentialInfo
|
||||
pmsJObject.Add("skssqZ", mainRow["skssqZ"] + "");
|
||||
HttpWebResponse webResponse = HttpTools.Post(url, JsonConvert.SerializeObject(pmsJObject), null, headerDic, HttpTools.Method.POST);
|
||||
resultRead = new StreamReader(webResponse.GetResponseStream(), Encoding.UTF8).ReadToEnd();
|
||||
WriteLogInfo("个税申报", JsonConvert.SerializeObject(pmsJObject), resultRead);
|
||||
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="resultMsg"></param>
|
||||
/// <returns></returns>
|
||||
public static string InvalidSubmit(out string resultRead, out string resultMsg)
|
||||
{
|
||||
string code = "-9999";
|
||||
resultRead = "";
|
||||
resultMsg = "";
|
||||
try
|
||||
{
|
||||
string url = $"{urlStart}/web/sbmk/personal-tax/api/v1/invalid/submit";
|
||||
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("busiTypeCode", mainRow["busiTypeCode"] + "");
|
||||
pmsJObject.Add("qysh", mainRow["qysh"] + "");
|
||||
pmsJObject.Add("operator", mainRow["operator"] + "");
|
||||
pmsJObject.Add("skssqQ", mainRow["skssqQ"] + "");
|
||||
pmsJObject.Add("skssqZ", mainRow["skssqZ"] + "");
|
||||
HttpWebResponse webResponse = HttpTools.Post(url, JsonConvert.SerializeObject(pmsJObject), null, headerDic, HttpTools.Method.POST);
|
||||
resultRead = new StreamReader(webResponse.GetResponseStream(), Encoding.UTF8).ReadToEnd();
|
||||
WriteLogInfo("个税申报作废", JsonConvert.SerializeObject(pmsJObject), resultRead);
|
||||
if (webResponse != null && !string.IsNullOrEmpty(resultRead))
|
||||
{
|
||||
JObject resultJObject = (JObject)JsonConvert.DeserializeObject(resultRead);
|
||||
@@ -796,6 +860,7 @@ namespace Lskj.QueryEssentialInfo
|
||||
pmsJObject.Add("skssqZ", mainRow["skssqZ"] + "");
|
||||
HttpWebResponse webResponse = HttpTools.Post(url, JsonConvert.SerializeObject(pmsJObject), null, headerDic, HttpTools.Method.POST);
|
||||
resultRead = new StreamReader(webResponse.GetResponseStream(), Encoding.UTF8).ReadToEnd();
|
||||
WriteLogInfo("个税申报查询", JsonConvert.SerializeObject(pmsJObject), resultRead);
|
||||
if (webResponse != null && !string.IsNullOrEmpty(resultRead))
|
||||
{
|
||||
JObject resultJObject = (JObject)JsonConvert.DeserializeObject(resultRead);
|
||||
@@ -873,7 +938,7 @@ namespace Lskj.QueryEssentialInfo
|
||||
}
|
||||
else if (typeCode.Equals("101060100010500"))
|
||||
{
|
||||
|
||||
externFieldsJObject.Add("sdxmdm", detailRow["sdxmdm"] + "");
|
||||
}
|
||||
incomeDataJObject.Add("externFields", externFieldsJObject);
|
||||
incomeDataListJArry.Add(incomeDataJObject);
|
||||
@@ -885,6 +950,7 @@ namespace Lskj.QueryEssentialInfo
|
||||
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();
|
||||
WriteLogInfo("同步收入", JsonConvert.SerializeObject(pmsJObject), resultRead);
|
||||
if (webResponse != null && !string.IsNullOrEmpty(resultRead))
|
||||
{
|
||||
JObject resultJObject = (JObject)JsonConvert.DeserializeObject(resultRead);
|
||||
@@ -976,9 +1042,11 @@ namespace Lskj.QueryEssentialInfo
|
||||
pmsJObject.Add("operator", mainRow["operator"] + "");
|
||||
pmsJObject.Add("skssqQ", mainRow["skssqQ"] + "");
|
||||
pmsJObject.Add("skssqZ", mainRow["skssqZ"] + "");
|
||||
pmsJObject.Add("incomeTypeCode", mainRow["incomeTypeCode"] + "");
|
||||
pmsJObject.Add("nsrlxDm", nsrlxdm);
|
||||
HttpWebResponse webResponse = HttpTools.Post(url, JsonConvert.SerializeObject(pmsJObject), null, headerDic, HttpTools.Method.POST);
|
||||
resultRead = new StreamReader(webResponse.GetResponseStream(), Encoding.UTF8).ReadToEnd();
|
||||
WriteLogInfo("计算税款", JsonConvert.SerializeObject(pmsJObject), resultRead);
|
||||
if (webResponse != null && !string.IsNullOrEmpty(resultRead))
|
||||
{
|
||||
JObject resultJObject = (JObject)JsonConvert.DeserializeObject(resultRead);
|
||||
@@ -1026,6 +1094,7 @@ namespace Lskj.QueryEssentialInfo
|
||||
pmsJObject.Add("nsrlxDm", nsrlxdm);
|
||||
HttpWebResponse webResponse = HttpTools.Post(url, JsonConvert.SerializeObject(pmsJObject), null, headerDic, HttpTools.Method.POST);
|
||||
resultRead = new StreamReader(webResponse.GetResponseStream(), Encoding.UTF8).ReadToEnd();
|
||||
WriteLogInfo("获取税款计算结果", JsonConvert.SerializeObject(pmsJObject), resultRead);
|
||||
if (webResponse != null && !string.IsNullOrEmpty(resultRead))
|
||||
{
|
||||
JObject resultJObject = (JObject)JsonConvert.DeserializeObject(resultRead);
|
||||
@@ -1117,5 +1186,67 @@ namespace Lskj.QueryEssentialInfo
|
||||
}
|
||||
return isResult;
|
||||
}
|
||||
/// <summary>
|
||||
/// 判断表是否存在
|
||||
/// </summary>
|
||||
public static void EssentialTabExists()
|
||||
{
|
||||
string sql = @"IF OBJECT_ID(N'[dbo].[p_EssentialLogTab]', N'U') IS NULL
|
||||
BEGIN
|
||||
CREATE TABLE [dbo].[p_EssentialLogTab]
|
||||
(
|
||||
[Id] INT IDENTITY(1,1) NOT NULL,
|
||||
[title] NVARCHAR(255) NULL,
|
||||
[data] NVARCHAR(MAX) NULL,
|
||||
[datetime] DATETIME NOT NULL DEFAULT(GETDATE()),
|
||||
[rtnmsg] NVARCHAR(MAX) NULL,
|
||||
|
||||
CONSTRAINT [PK_p_EssentialLogTab] PRIMARY KEY CLUSTERED ([Id] ASC)
|
||||
);
|
||||
END";
|
||||
SqlHelper.ExecuteNonQuery(sql);
|
||||
}
|
||||
/// <summary>
|
||||
/// 写入日志信息
|
||||
/// </summary>
|
||||
public static void WriteLogInfo(string title, string data, string rtnmsg)
|
||||
{
|
||||
try
|
||||
{
|
||||
string sql = @"
|
||||
INSERT INTO [dbo].[p_EssentialLogTab]
|
||||
(
|
||||
[title],
|
||||
[data],
|
||||
[rtnmsg]
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
@title,
|
||||
@data,
|
||||
@rtnmsg
|
||||
);";
|
||||
|
||||
SqlParameter[] parameters =
|
||||
{
|
||||
new SqlParameter("@title", SqlDbType.NVarChar, 255)
|
||||
{
|
||||
Value = title
|
||||
},
|
||||
new SqlParameter("@data", SqlDbType.NVarChar, -1)
|
||||
{
|
||||
Value = data.Replace("'","''")
|
||||
},
|
||||
new SqlParameter("@rtnmsg", SqlDbType.NVarChar, -1)
|
||||
{
|
||||
Value = rtnmsg.Replace("'","''")
|
||||
}
|
||||
};
|
||||
SqlHelper.ExecuteNonQuery(CommandType.Text, sql, parameters);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user