SVN-Revision: r954
This commit is contained in:
wyf
2025-08-18 08:20:49 +00:00
parent 265074dae2
commit 9e7e8018e8
14 changed files with 1660 additions and 0 deletions
@@ -0,0 +1,51 @@
using Lskj.Business;
using Lskj.Model;
using Lskj.Util;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Lskj.QueryEssentialInfo
{
/// <summary>
/// c#库被调用统一接口类
/// </summary>
public sealed class DllBaseClass : IForm
{
public DllBaseClass()
{
}
public DllBaseClass(string[] obj)
{
try
{
FrmMain main = new FrmMain();
main.Model = new DynamicQueryEssential(obj);
this.SubForm = main;
}
catch (Exception ex)
{
LogUtil.WriteError("Lskj.QueryEssentialInfo.dll--参数错误-->" + obj.ToString(), ex);
}
}
/// <summary>
/// 窗口
/// </summary>
public Form SubForm { get; set; }
}
public class DynamicQueryEssential : DynamicModel
{
public string MainSourceSql;
public string DetailSourceSql;
/// <summary>
/// 执行类型0:专项附加查询1:个税申报
/// </summary>
public string ExecMode = "0";
public DynamicQueryEssential(string[] args) : base(args)
{
if (args.Length > 5 && !string.IsNullOrWhit
+92
View File
@@ -0,0 +1,92 @@
namespace Lskj.QueryEssentialInfo
{
partial class FrmMain
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.panel2 = new System.Windows.Forms.Panel();
this.labelCurrentItem = new System.Windows.Forms.Label();
this.panel1 = new System.Windows.Forms.Panel();
this.label3 = new System.Windows.Forms.Label();
this.progressBarCurrent = new System.Windows.Forms.ProgressBar();
this.panel2.SuspendLayout();
this.panel1.SuspendLayout();
this.SuspendLayout();
//
// panel2
//
this.panel2.Controls.Add(this.labelCurrentItem);
this.panel2.Controls.Add(this.progressBarCurrent);
this.panel2.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel2.ForeColor = System.Drawing.SystemColors.ControlDark;
this.panel2.Location = new System.Drawing.Point(0, 31);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(473, 56);
this.panel2.TabIndex = 10;
//
// labelCurrentItem
//
this.labelCurrentItem.AutoSize = true;
this.labelCurrentItem.Location = new System.Drawing.Point(14, 16);
this.labelCurrentItem.Name = "labelCurrentItem";
this.labelCurrentItem.Size = new System.Drawing.Size(65, 12);
this.labelCurrentItem.TabIndex = 0;
this.labelCurrentItem.Text = "正在查询:";
//
// panel1
//
this.panel1.BackColor = System.Drawing.SystemColors.ButtonHighlight;
this.panel1.Controls.Add(this.label3);
this.panel1.Dock = System.Windows.Forms.DockStyle.Top;
this.panel1.Location = new System.Drawing.Point(0, 0);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(473, 31);
this.panel1.TabIndex = 9;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label3.Location = new System.Drawing.Point(11, 8);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(161, 12);
this.label3.TabIndex = 0;
this.label3.Text = "系统正在查询专项附加扣除";
//
// progressBarCurrent
//
this.progressBarCurrent.Location = new System.Drawing.Point(15, 33);
this.progressBarCurrent.Name = "progressBarCurrent";
this.progressBarCurrent.Size = new System.Drawing.Size(446, 12);
this.progressBarCurrent.Step = 1;
this.progressBarCurrent.TabIndex = 5;
//
// FrmMain
//
this.Appearance.BackColor = System.Drawing.SystemColors.Control;
this.Appearance.Optio
@@ -0,0 +1,394 @@
using Lskj.Business.Impl;
using Lskj.Control;
using Lskj.Core;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Lskj.QueryEssentialInfo
{
public partial class FrmMain : BaseForm
{
public DynamicQueryEssential Model;
public FrmMain()
{
InitializeComponent();
this.Load += OnFrmMainLoad;
}
/// <summary>
/// 初始化时
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void OnFrmMainLoad(object sender, EventArgs e)
{
try
{
progressBarCurrent.Maximum = 100;
progressBarCurrent.Value = 0;
QueryApiUtil.mainRow = BaseImpl.GetDataRowResult(Model.MainSourceSql);
QueryApiUtil.detailTab = BaseImpl.GetDataTableResult(Model.DetailSourceSql);
Task.Factory.StartNew(() =>
{
try
{
switch (Model.ExecMode)
{
case "0":
ZXFJQuery();
Invoke(new Action(() =>
{
MessageUtil.Show("专项附加查询完成");
}));
break;
case "1":
GSSBQuery();
Invoke(new Action(() =>
{
MessageUtil.Show("个税申报完成");
}));
break;
}
}
catch (Exception ex)
{
Invoke(new Action(() =>
{
MessageUtil.Show(ex.Message);
this.Close();
}));
}
});
}
catch (Exception ex)
{
MessageUtil.Show(ex.Message);
this.Close();
}
}
/// <summary>
/// 查询专项附加
/// </summary>
private void ZXFJQuery()
{
if (QueryApiUtil.detailTab.AsEnumerable().Where(n => !(n["p_emp_addTag"] + "").Equals("1")).Count() > 0)
{
SetProcessMsg($"正在报送人员...");
string personCode = QueryApiUtil.Person(out string personResult, out string personMsg);
if (!personCode.Equals("0"))
{
throw new Exception($"报送失败\r\n{personMsg}");
}
SetProcessMsg($"正在查询报送人员...");
string personQueryCode = QueryApiUtil.PersonQuery(out string personQueryResult, out string personQueryMsg);
if (!personQueryCode.Equals("0"))
{
throw new Exception($"报送查询失败\r\n{personQueryMsg}");
}
else
{
JObject personQueryJObject = (JObject)JsonConvert.DeserializeObject(personQueryResult);
if (personQueryJObject["data"] is JArray)
{
JArray personQueryJArray = (JArray)personQueryJObject["data"];
foreach (JObject personJObject in personQueryJArray)
{
string name = personJObject["name"] + "";
string sfzh = personJObject["sfzh"] + "";
string bszt = personJObject["bszt"] + "";
string sfyzzt = personJObject["sfyzzt"] + "";
if (bszt.Equals("报送成功") && sfyzzt.Equals("验证成功"))
{
SqlHelper.ExecuteNonQuery($"update p_employeeTab set p_emp_addTag = 1 where p_emp_idcardnum = '{sfzh}'");
}
SetProcessMsg($"已报送:{name}");
}
}
}
}
QueryApiUtil.detailTab = BaseImpl.GetDataTableResult(Model.DetailSourceSql);
Invoke(new Action(() =>
{
progressBarCurrent.Maximum = QueryApiUtil.detailTab.AsEnumerable().Where(n => (n["p_emp_addTag"] + "").Equals("1")).Count();
}));
SetProcessMsg($"正在同步专项附加数据...");
string postAdditionCode = QueryApiUtil.PostAddition(out string postAdditionResult, out string postAdditionMsg);
SetProcessMsg($"正在查询专项附加数据...");
string getAdditionCode = QueryApiUtil.GetAddition(out string getAdditionResult, out string getAdditionMsg);
if (!getAdditionCode.Equals("0"))
{
throw new Exception($"查询数据失败\r\n{getAdditionMsg}");
}
else
{
JObject additionJObject = (JObject)JsonConvert.DeserializeObject(getAdditionResult);
if (additionJObject["data"] is JObject)
{
JObject additionDataJObject = (JObject)additionJObject["data"];
if (additionDataJObject.ContainsKey("list") && additionDataJObject["list"] is JArray)
{
string ysyf = QueryApiUtil.mainRow["ysyf"] + "";
JArray additionListJArray = (JArray)additionDataJObject["list"];
foreach (JObject item in additionListJArray)
{
StringBuilder sqlBuilder = new StringBuilder();
string peopleName = item["peopleName"] + "";
string idNumber = item["idNumber"] + "";
sqlBuilder.AppendLine($"delete from p_gszxfjkctab where idnumber = '{idNumber}' and itemid = '{ysyf}';");
string sylrAccumulate = item["sylrAccumulate"] + "";
sqlBuilder.AppendLine($"insert into p_gszxfjkctab (employeename,type,money,bak,idnumber,itemid) values ('{peopleName}','赡养老人','{sylrAccumulate}','','{idNumber}','{ysyf}');");
string znjyAccumulate = item["znjyAccumulate"] + "";
sqlBuilder.AppendLine($"insert into p_gszxfjkctab (employeename,type,money,bak,idnumber,itemid) values ('{peopleName}','子女教育','{znjyAccumulate}','','{idNumber}','{ysyf}');");
string xljxjyAccumulate = item["xljxjyAccumulate"] + "";
sqlBuilder.AppendLine($"insert into p_gszxfjkctab (employeename,type,money,bak,idnumber,itemid) values ('{peopleName}','学历继续教育','{xljxjyAccumulate}','','{idNumber}','{ysyf}');");
string zyzgjxjyAccumulate = item["zyzgjxjyAccumulate"] + "";
sqlBuilder.AppendLine($"insert into p_gszxfjkctab (employeename,type,money,bak,idnumber,itemid) values ('{peopleName}','专业资格继续教育','{zyzgjxjyAccumulate}','','{idNumber}','{ysyf}');");
string zfdklxAccumulate = item["zfdklxAccumulate"] + "";
sqlBuilder.AppendLine($"insert into p_gszxfjkctab (employeename,type,money,bak,idnumber,itemid) values ('{peopleName}','住房贷款利息','{zfdklxAccumulate}','','{idNumber}','{ysyf}');");
string zfzjAccumulate = item["zfzjAccumulate"] + "";
sqlBuilder.AppendLine($"insert into p_gszxfjkctab (employeename,type,money,bak,idnumber,itemid) values ('{peopleName}','租房租金','{zfzjAccumulate}','','{idNumber}','{ysyf}');");
string yyezhfAccumulate = item["yyezhfAccumulate"] + "";
sqlBuilder.AppendLine($"insert into p_gszxfjkctab (employeename,type,money,bak,idnumber,itemid) values ('{peopleName}','婴幼儿照护','{yyezhfAccumulate}','','{idNumber}','{ysyf}');");
if (!string.IsNullOrEmpty(sqlBuilder.ToString()))
{
BaseImpl.ExecSqlValue(sqlBuilder.ToString());
}
SetProcessMsg($"已查询:{peopleName}");
SetProcessBar();
}
}
}
}
#region
//string token = "";
//string aggOrgId = "";
//string accountId = "";
//if ((string.IsNullOrEmpty(token) || string.IsNullOrEmpty(aggOrgId)) && QueryApiUtil.AlterTable("p_systemtab", "queryEssentialToken", "varchar(1000)") && QueryApiUtil.AlterTable("p_systemtab", "queryEssentialAggOrgId", "varchar(200)"))
//{
// DataRow tokenRow = BaseImpl.GetDataRowResult("select queryEssentialToken,queryEssentialAggOrgId from p_systemtab");
// token = tokenRow["queryEssentialToken"] + "";
// aggOrgId = tokenRow["queryEssentialAggOrgId"] + "";
// if (string.IsNullOrEmpty(token))
// {
// QueryApiUtil.GetToken(ref token, ref aggOrgId);
// }
//}
//string checkPasswordMsg = "";
//string checkPasswordCode = QueryApiUtil.CheckPassword(ref token, ref aggOrgId, ref accountId, ref checkPasswordMsg);
//if (!checkPasswordCode.Equals("2000"))
//{
// QueryApiUtil.GetToken(ref token, ref aggOrgId);
// checkPasswordMsg = "";
// checkPasswordCode = QueryApiUtil.CheckPassword(ref token, ref aggOrgId, ref accountId, ref checkPasswordMsg);
//}
//if (!checkPasswordCode.Equals("2000"))
//{
// throw new Exception($"验证失败\r\n{checkPasswordMsg}");
//}
//string employeeInfoCode = QueryApiUtil.QueryEssentialEmployeeInfo(ref token, ref aggOrgId, ref accountId, out string employeeInfoResult);
//if (employeeInfoCode.Equals("2000") || employeeInfoCode.Equals("-9998"))
//{
// if (employeeInfoCode.Equals("2000"))
// {
// JObject employeeInfoJObject = (JObject)JsonConvert.DeserializeObject(employeeInfoResult);
// string success = employeeInfoJObject.ContainsKey("success") ? employeeInfoJObject["success"] + "" : "";
// string message = employeeInfoJObject.ContainsKey("message") ? employeeInfoJObject["message"] + "" : "";
// if (success.Equals("true", StringComparison.OrdinalIgnoreCase))
// {
// string taskId = employeeInfoJObject["data"]["taskId"] + "";
// string backStates = "0";
// string backSuccess = "";
// string backMessage = "";
// int waitCount = 1;
// while (backStates.Equals("0") || backStates.Equals("1"))
// {
// SetProcessMsg($"等待报送数据返回({waitCount})...");
// string employeeInfoBackCode = QueryApiUtil.QueryEssentialEmployeeInfoFeedback(taskId, ref token, ref aggOrgId, ref accountId, out string employeeInfoBackResult);
// if (employeeInfoBackCode.Equals("2000"))
// {
// JObject employeeInfoBackJObject = (JObject)JsonConvert.DeserializeObject(employeeInfoBackResult);
// backSuccess = employeeInfoBackJObject.ContainsKey("success") ? employeeInfoBackJObject["success"] + "" : "";
// if (backSuccess.Equals("true", StringComparison.OrdinalIgnoreCase))
// {
// backMessage = employeeInfoBackJObject["data"]["taskStatusName"] + "";
// backStates = employeeInfoBackJObject["data"]["taskStatus"] + "";
// if (backStates.Equals("3"))//已完成
// {
// JArray resultArray = (JArray)employeeInfoBackJObject["data"]["result"];
// foreach (JObject result in resultArray)
// {
// string xm = result["xm"] + "";
// string zjhm = result["zzhm"] + "";
// SqlHelper.ExecuteNonQuery($"update p_employeeTab set p_emp_addTag = 1 where p_emp_idcardnum = '{zjhm}'");
// SetProcessMsg($"已报送:{xm}");
// SetProcessBar();
// }
// }
// if (backStates.Equals("2"))
// {
// string errorMessage = employeeInfoBackJObject["data"]["message"] + "";
// throw new Exception($"报送反馈请求失败\r\n{errorMessage}");
// }
// }
// }
// else
// {
// throw new Exception($"报送反馈请求失败\r\n{employeeInfoBackResult}");
// }
// }
// }
// }
//}
//else
//{
// throw new Exception($"报送失败\r\n{employeeInfoResult}");
//}
//string queryInfoCode = QueryApiUtil.QueryEssentialInfo(ref token, ref aggOrgId, ref accountId, out string queryInfoResult);
//if (queryInfoCode.Equals("2000") || queryInfoCode.Equals("-9998"))
//{
// if (queryInfoCode.Equals("2000"))
// {
// JObject queryInfoJObject = (JObject)JsonConvert.DeserializeObject(queryInfoResult);
// string success = queryInfoJObject.ContainsKey("success") ? queryInfoJObject["success"] + "" : "";
// string message = queryInfoJObject.ContainsKey("message") ? queryInfoJObject["message"] + "" : "";
// if (success.Equals("true", StringComparison.OrdinalIgnoreCase))
// {
// string taskId = queryInfoJObject["data"]["taskId"] + "";
// string backStates = "0";
// string backSuccess = "";
// string backMessage = "";
// int waitCount = 1;
// while (backStates.Equals("0") || backStates.Equals("1"))
// {
// SetProcessMsg($"等待查询数据返回({waitCount})...");
// string queryInfoBackCode = QueryApiUtil.QueryEssentialInfoFeedback(taskId, ref token, ref aggOrgId, ref accountId, out string queryInfoBackResult);
// if (queryInfoBackCode.Equals("2000"))
// {
// JObject queryInfoBackJObject = (JObject)JsonConvert.DeserializeObject(queryInfoBackResult);
// backSuccess = queryInfoBackJObject.ContainsKey("success") ? queryInfoBackJObject["success"] + "" : "";
// if (backSuccess.Equals("true", StringComparison.OrdinalIgnoreCase))
// {
// backMessage = queryInfoBackJObject["data"]["taskStatusName"] + "";
// backStates = queryInfoBackJObject["data"]["taskStatus"] + "";
// if (backStates.Equals("3"))
// {
// string itemId = QueryApiUtil.mainRow["skssq"] + "";
// JArray resultArray = (JArray)queryInfoBackJObject["data"]["result"];
// foreach (JObject result in resultArray)
// {
// StringBuilder sqlBuilder = new StringBuilder();
// string xm = result["xm"] + "";
// string zzlx = result["zzlx"] + "";
// string zzhm = result["zzhm"] + "";
// sqlBuilder.AppendLine($"delete from p_gszxfjkctab where idnumber = '{zzhm}' and itemid = '{itemId}';");
// #region 子女教育
// JArray znjys = (JArray)result["znjys"];
// foreach (JObject znjy in znjys)
// {
// string znjyxm = znjy["xm"] + "";
// sqlBuilder.AppendLine($"insert into p_gszxfjkctab (employeename,type,money,bak,idnumber,itemid) values ('{xm}','子女教育','2000','{znjyxm}','{zzhm}','{itemId}');");
// }
// #endregion
// #region 赡养老人
// if (result["sylrs"] is JObject)
// {
// JObject sylrs = (JObject)result["sylrs"];
// string ftje = sylrs["ftje"] + "";
// sqlBuilder.AppendLine($"insert into p_gszxfjkctab (employeename,type,money,bak,idnumber,itemid) values ('{xm}','赡养老人','{ftje}','','{zzhm}','{itemId}');");
// }
// #endregion
// #region 住房租金
// JArray fwzls = (JArray)result["fwzls"];
// foreach (JObject fwzl in fwzls)
// {
// string zfzlhtbh = fwzl["zfzlhtbh"] + "";
// sqlBuilder.AppendLine($"insert into p_gszxfjkctab (employeename,type,money,bak,idnumber,itemid) values ('{xm}','住房租金','1500','{zfzlhtbh}','{zzhm}','{itemId}');");
// }
// #endregion
// #region 住房贷款
// JArray fwdks = (JArray)result["fwdks"];
// foreach (JObject fwdk in fwdks)
// {
// string zsh = fwdk["zsh"] + "";
// sqlBuilder.AppendLine($"insert into p_gszxfjkctab (employeename,type,money,bak,idnumber,itemid) values ('{xm}','住房贷款','1000','{zsh}','{zzhm}','{itemId}');");
// }
// #endregion
// #region 继续教育
// JArray jxjys = (JArray)result["jxjys"];
// foreach (JObject jxjy in jxjys)
// {
// string zsmc = jxjy["zsmc"] + "";
// sqlBuilder.AppendLine($"insert into p_gszxfjkctab (employeename,type,money,bak,idnumber,itemid) values ('{xm}','继续教育','400','{zsmc}','{zzhm}','{itemId}');");
// }
// #endregion
// #region 婴幼儿照护
// JArray yyezhls = (JArray)result["yyezhls"];
// foreach (JObject yyezhl in yyezhls)
// {
// string yyexm = yyezhl["xm"] + "";
// sqlBuilder.AppendLine($"insert into p_gszxfjkctab (employeename,type,money,bak,idnumber,itemid) values ('{xm}','婴幼儿照护','2000','{yyexm}','{zzhm}','{itemId}');");
// }
// #endregion
// SqlHelper.ExecuteNonQuery(sqlBuilder.ToString());
// SetProcessMsg($"已查询:{xm}");
// SetProcessBar();
// }
// }
// if (backStates.Equals("2"))
// {
// string errorMessage = queryInfoBackJObject["data"]["message"] + "";
// throw new Exception($"报送反馈请求失败\r\n{errorMessage}");
// }
// }
// }
// else
// {
// throw new Exception($"数据请求反馈失败\r\n{queryInfoBackResult}");
// }
// Thread.Sleep(1000);
// }
// Invoke(new Action(() =>
// {
// MessageUtil.Show(backMessage);
// }));
// }
// }
//}
//else
//{
// throw new Exception($"数据请求失败\r\n{queryInfoResult}");
//}
#endregion
Invoke(new Action(() =>
{
this.Close();
}));
}
/// <summary>
/// 个税申报
/// </summary>
private void GSSBQuery()
{
SetProcessMsg($"正在进行个税申报...");
string submitCode = QueryApiUtil.Submit(out string submitResult, out string submitMsg);
if (!submitCode.Equals("0"))
{
throw new Exception($"个税申报失败\r\n{submitMsg}");
}
SetProcessMsg($"正在查询个税申报结果...");
string submitQueryCode = "-99";
while (!submitQueryCode.Equals("0"))
{
submitQueryCode = QueryApiUtil.SubmitQuery(out string submitQueryResult, out string submitQueryMsg);
if (!submitQueryCode.Equals("0"))
{
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{4CAF9151-C465-4CCE-B2C3-DF272DD6371D}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>Lskj.QueryEssentialInfo</RootNamespace>
<AssemblyName>Lskj.QueryEssentialInfo</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\Debug\Lib\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<StartupObject />
</PropertyGroup>
<ItemGroup>
<Reference Include="BouncyCastle.Crypto, Version=1.8.9.0, Culture=neutral, PublicKeyToken=0e99375e54769942">
<HintPath>..\Lskj.LserpAll\packages\BouncyCastle.1.8.9\lib\BouncyCastle.Crypto.dll</HintPath>
</Reference>
<Reference Include="DevExpress.Data.v15.2, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.Utils.v15.2, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="DevExpress.XtraEditors.v15.2, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="Newtonsoft.Json, Version=13.0.1.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>D:\工作\lserp_cs_6.0\引用DLL\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="DllBaseClass.cs" />
<Compile Include="FrmMain.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="FrmMain.Designer.cs">
<DependentUpon>FrmMain.cs</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="QueryApiUtil.cs" />
<Compile Include="RsaEncryUtil.cs" />
<EmbeddedResource Include="FrmMain.resx">
<DependentUpon>FrmMain.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<None Include="app.config" />
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Lskj.Business\Lskj.Business.csproj">
<Project>{7EAFCCC2-A18F-49E9-85C6-A984966CFD01}</Project>
<Name>Lskj.Business</Name>
</ProjectReference>
<ProjectReference Include="..\Lskj.Control\Lskj.Control.csproj">
<Project>{447CDC40-659F-4CCA-9ED6-8E818B4CF8BF}</Project>
<Name>Lskj.Control</Name>
</ProjectReference>
<ProjectReference Include="..\Lskj.Core\Lskj.Core.csproj">
<Project>{2A1BE6AC-1077-491B-A754-C5822FE8121E}</Project>
<Name>Lskj.Core</Name>
</ProjectReference>
<ProjectReference Include="..\Lskj.Model\Lskj.Model.csproj">
<Project>{52BC40E0-C0C6-4F78-996B-CAE028D209CA}</Project>
<Name>Lskj.Model</Name>
</ProjectReference>
<ProjectReference Include="..\Lskj.Util\Lskj.Util.csproj">
<Project>{A51BF642-6543-4DE3-8948-83F558B72BD4}</Project>
<Name>Lskj.Util</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
@@ -0,0 +1,9 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("Lskj.QueryEssentialInfo")]
[assembly: AssemblyDescript
@@ -0,0 +1,41 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本: 4.0.30319.42000
//
// 对此文件的更改可能导致不正确的行为,如果
// 重新生成代码,则所做更改将丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace Lskj.QueryEssentialInfo.Properties
{
/// <summary>
/// 强类型资源类,用于查找本地化字符串等。
/// </summary>
// 此类是由 StronglyTypedResourceBuilder
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或删除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
}
/// <summary>
/// 返回此类使用的缓存 ResourceManager 实例。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
@@ -0,0 +1 @@
//------------------------------------------------------------------------------
@@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>
@@ -0,0 +1,675 @@
using Lskj.Business.Impl;
using Lskj.Control.BrowserSetting;
using Lskj.Core;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Data;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Net;
using System.Security.Cryptography;
using System.Text;
namespace Lskj.QueryEssentialInfo
{
public static class QueryApiUtil
{
public static DataRow mainRow;
public static DataTable detailTab;
/// <summary>
/// 获取操作token
/// </summary>
public static void GetToken(ref string token, ref string aggOrgId)
{
token = "";
aggOrgId = "";
try
{
string url = "http://openapi.51fpcloud.com/v2/public/token";
HttpTools.setting("application/x-www-form-urlencoded", null, null, HttpTools.Encode.UTF8);
Dictionary<string, string> headerDic = new Dictionary<string, string>();
string client_id = mainRow["client_id"] + "";
string client_secret = mainRow["client_secret"] + "";
string authorization = Convert.ToBase64String(Encoding.UTF8.GetBytes($"{client_id}:{client_secret}"));
headerDic.Add("Authorization", $"Basic {authorization}");
Dictionary<string, string> pmsDic = new Dictionary<string, string>();
pmsDic.Add("nsrsbh", mainRow["nsrsbh"] + "");
HttpWebResponse webResponse = HttpTools.Post(url, "", pmsDic, headerDic, HttpTools.Method.POST);
string result = new StreamReader(webResponse.GetResponseStream(), Encoding.UTF8).ReadToEnd();
if (webResponse != null && !string.IsNullOrEmpty(result))
{
JObject resultJObject = (JObject)JsonConvert.DeserializeObject(result);
string code = resultJObject["code"] + "";
string msg = resultJObject["msg"] + "";
if (code.Equals("0"))
{
token = resultJObject["data"]["token"] + "";
aggOrgId = resultJObject["data"]["aggOrgId"] + "";
SqlHelper.ExecuteNonQuery(string.Format("update p_systemtab set queryEssentialToken = '{0}'", token));
SqlHelper.ExecuteNonQuery(string.Format("update p_systemtab set queryEssentialAggOrgId = '{0}'", aggOrgId));
}
else
{
throw new Exception($"获取token失败\r\n{msg}");
}
}
}
catch (Exception)
{
throw;
}
}
/// <summary>
/// 专项附加扣除查询
/// </summary>
/// <param name="token"></param>
/// <param name="result"></param>
/// <returns></returns>
public static string CheckPassword(ref string token, ref string aggOrgId, ref string accountId, ref string message)
{
string code = "-9999";
try
{
string url = "http://openapi.51fpcloud.com/v2/iit/check/checkPassword";
HttpTools.setting("application/json", null, null, HttpTools.Encode.UTF8);
Dictionary<string, string> headerDic = new Dictionary<string, string>();
headerDic.Add("token", token);
JObject pmsJObject = new JObject();
if (detailTab != null && detailTab.Rows.Count > 0)
{
pmsJObject.Add("aggOrgId", aggOrgId);
pmsJObject.Add("checkPassword", "Y");
pmsJObject.Add("nsrsbh", mainRow["nsrsbh"] + "");
pmsJObject.Add("qymc", mainRow["qymc"] + "");
pmsJObject.Add("mmlx", mainRow["mmlx"] + "");
pmsJObject.Add("sbmm", RsaEntryUtil.Encrypt(mainRow["sbmm"] + "", RsaEntryUtil.ToXmlPublicKey("MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC+vuYMGtTU+42wwbaFX+PkCuSeoREKe5V4EJMi553Gc03ficUdpLHIFdEjAMHAxepwm3RAGLwyxYFK/S93k8GYMuV35L2Nj/cVeHS8scsdqXzqLUKaI4wj438OI6HDh7rWsw1M5EgMsoZvQqja53+SgD3mgIy3XyILbmA5jUp2IwIDAQAB")));
pmsJObject.Add("areaid", mainRow["areaid"] + "");
HttpWebResponse webResponse = HttpTools.Post(url, JsonConvert.SerializeObject(pmsJObject), null, headerDic, HttpTools.Method.POST);
string resultRead = new StreamReader(webResponse.GetResponseStream(), Encoding.UTF8).ReadToEnd();
if (webResponse != null && !string.IsNullOrEmpty(resultRead))
{
JObject resultJObject = (JObject)JsonConvert.DeserializeObject(resultRead);
code = resultJObject["code"] + "";
message = resultJObject["message"] + "";
if (code.Equals("2000"))
{
accountId = resultJObject["data"]["accountId"] + "";
}
}
}
}
catch (Exception)
{
throw;
}
return code;
}
/// <summary>
/// 专项附加扣除查询
/// </summary>
/// <param name="token"></param>
/// <param name="result"></param>
/// <returns></returns>
public static string QueryEssentialInfo(ref string token, ref string aggOrgId, ref string accountId, out string resultRead)
{
string code = "-9999";
resultRead = "";
try
{
string url = "http://openapi.51fpcloud.com/v2/iit/declare/queryEssentialInfo";
HttpTools.setting("application/json", null, null, HttpTools.Encode.UTF8);
Dictionary<string, string> headerDic = new Dictionary<string, string>();
headerDic.Add("token", token);
JObject pmsJObject = new JObject();
if (detailTab != null && detailTab.Rows.Count > 0)
{
pmsJObject.Add("aggOrgId", aggOrgId);
pmsJObject.Add("accountId", accountId);
pmsJObject.Add("skssq", mainRow["skssq"] + "");
JArray rylbJArray = new JArray();
{
foreach (DataRow detailRow in detailTab.Rows)
{
string addTag = detailRow["p_emp_addTag"] + "";
if (addTag.Equals("0"))
{
continue;
}
JObject rylbJObject = new JObject();
rylbJObject.Add("xm", detailRow["xm"] + "");
rylbJObject.Add("zzlx", detailRow["zzlx"] + "");
rylbJObject.Add("zzhm", detailRow["zzhm"] + "");
rylbJArray.Add(rylbJObject);
}
}
pmsJObject.Add("rylb", rylbJArray);
if (rylbJArray.Count > 0)
{
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"] + "";
}
}
else
{
code = "-9998";
}
}
}
catch (Exception)
{
throw;
}
return code;
}
/// <summary>
/// 专项附加扣除查询反馈
/// </summary>
/// <param name="token"></param>
/// <param name="result"></param>
/// <returns></returns>
public static string QueryEssentialInfoFeedback(string taskId, ref string token, ref string aggOrgId, ref string accountId, out string resultRead)
{
string code = "-9999";
resultRead = "";
try
{
string url = "http://openapi.51fpcloud.com/v2/iit/declare/queryEssentialInfoFeedback";
HttpTools.setting("application/json", null, null, HttpTools.Encode.UTF8);
Dictionary<string, string> headerDic = new Dictionary<string, string>();
headerDic.Add("token", token);
JObject pmsJObject = new JObject();
pmsJObject.Add("aggOrgId", aggOrgId);
pmsJObject.Add("accountId", accountId);
pmsJObject.Add("taskId", taskId);
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"] + "";
}
}
catch (Exception)
{
throw;
}
return code;
}
/// <summary>
/// 获取企业人员
/// </summary>
/// <param name="token"></param>
/// <param name="aggOrgId"></param>
/// <param name="accountId"></param>
/// <param name="resultRead"></param>
/// <returns></returns>
public static string QueryEssentialCompanyEmployee(ref string token, ref string aggOrgId, ref string accountId, out string resultRead)
{
string code = "-9999";
resultRead = "";
try
{
string url = "http://openapi.51fpcloud.com/v2/iit/data/getCompanyEmployee";
HttpTools.setting("application/json", null, null, HttpTools.Encode.UTF8);
Dictionary<string, string> headerDic = new Dictionary<string, string>();
headerDic.Add("token", token);
JObject pmsJObject = new JObject();
pmsJObject.Add("aggOrgId", aggOrgId);
pmsJObject.Add("accountId", accountId);
pmsJObject.Add("pageNo", "1");
pmsJObject.Add("pageSize", "100");
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"] + "";
}
}
catch (Exception)
{
throw;
}
return code;
}
/// <summary>
/// 人员报送
/// </summary>
/// <param name="token"></param>
/// <param name="aggOrgId"></param>
/// <param name="accountId"></param>
/// <param name="resultRead"></param>
/// <returns></returns>
public static string QueryEssentialEmployeeInfo(ref string token, ref string aggOrgId, ref string accountId, out string resultRead)
{
string code = "-9999";
resultRead = "";
try
{
string url = "http://openapi.51fpcloud.com/v2/iit/declare/declareEmployeeInfo";
HttpTools.setting("application/json", null, null, HttpTools.Encode.UTF8);
Dictionary<string, string> headerDic = new Dictionary<string, string>();
headerDic.Add("token", token);
JObject pmsJObject = new JObject();
pmsJObject.Add("aggOrgId", aggOrgId);
pmsJObject.Add("accountId", accountId);
pmsJObject.Add("skssq", mainRow["skssq"] + "");
JArray rylbArray = new JArray();
foreach (DataRow detailRow in detailTab.Rows)
{
string addTag = detailRow["p_emp_addTag"] + "";
if (addTag.Equals("1"))
{
continue;
}
JObject rylbJObject = new JObject();
rylbJObject.Add("xm", detailRow["xm"] + "");
rylbJObject.Add("zzlx", detailRow["zzlx"] + "");
rylbJObject.Add("zzhm", detailRow["zzhm"] + "");
rylbJObject.Add("lxdh", detailRow["lxdh"] + "");
rylbJObject.Add("nsrzt", detailRow["nsrzt"] + "");
rylbJObject.Add("sfgy", detailRow["sfgy"] + "");
rylbJObject.Add("rzsgrq", detailRow["rzsgrq"] + "");
rylbJObject.Add("xb", detailRow["xb"] + "");
rylbJObject.Add("csny", detailRow["csny"] + "");
rylbJObject.Add("gj", detailRow["gj"] + "");
rylbJObject.Add("rydq", detailRow["rydq"] + "");
rylbArray.Add(rylbJObject);
}
pmsJObject.Add("rylb", rylbArray);
if (rylbArray.Count > 0)
{
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"] + "";
}
}
else
{
code = "-9998";
}
}
catch (Exception)
{
throw;
}
return code;
}
/// <summary>
/// 人员报送反馈
/// </summary>
/// <param name="token"></param>
/// <param name="aggOrgId"></param>
/// <param name="accountId"></param>
/// <param name="resultRead"></param>
/// <returns></returns>
public static string QueryEssentialEmployeeInfoFeedback(string taskId, ref string token, ref string aggOrgId, ref string accountId, out string resultRead)
{
string code = "-9999";
resultRead = "";
try
{
string url = "http://openapi.51fpcloud.com/v2/iit/declare/getEmployeeInfoFeedback";
HttpTools.setting("application/json", null, null, HttpTools.Encode.UTF8);
Dictionary<string, string> headerDic = new Dictionary<string, string>();
headerDic.Add("token", token);
JObject pmsJObject = new JObject();
pmsJObject.Add("aggOrgId", aggOrgId);
pmsJObject.Add("accountId", accountId);
pmsJObject.Add("taskId", taskId);
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"] + "";
}
}
catch (Exception)
{
throw;
}
return code;
}
/// <summary>
/// 同步人员
/// </summary>
public static string Person(out string resultRead, out string resultMsg)
{
string code = "-9999";
resultRead = "";
resultMsg = "";
try
{
string url = "http://swgxs.poc.htjs.net:9019/v2/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;
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"] + "");
JArray bizlistJArray = new JArray();
foreach (DataRow detailRow in detailTab.Rows)
{
string addTag = detailRow["p_emp_addTag"] + "";
if (!addTag.Equals("1"))
{
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"] + "");
bizlistJArray.Add(bizDataJObject);
}
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();
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>
public static string PersonQuery(out string resultRead, out string resultMsg)
{
string code = "-9999";
resultRead = "";
resultMsg = "";
try
{
string url = "http://swgxs.poc.htjs.net:9019/v2/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;
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"] + "");
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>
public static string PostAddition(out string resultRead, out string resultMsg)
{
string code = "-9999";
resultRead = "";
resultMsg = "";
try
{
string url = "http://swgxs.poc.htjs.net:9019/v2/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;
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("ysyf", mainRow["ysyf"] + "");
JArray idNumberjArray = new JArray();
foreach (DataRow detailRow in detailTab.Rows)
{
string addTag = detailRow["p_emp_addTag"] + "";
if (!addTag.Equals("1"))
{
continue;
}
string idNumber = detailRow["idNumber"] + "";
idNumberjArray.Add(idNumber);
}
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();
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>
public static string GetAddition(out string resultRead, out string resultMsg)
{
string code = "-9999";
resultRead = "";
resultMsg = "";
try
{
string url = "http://swgxs.poc.htjs.net:9019/v2/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;
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("ysyf", mainRow["ysyf"] + "");
JArray idNumberjArray = new JArray();
foreach (DataRow detailRow in detailTab.Rows)
{
string addTag = detailRow["p_emp_addTag"] + "";
if (!addTag.Equals("1"))
{
continue;
}
string idNumber = detailRow["idNumber"] + "";
idNumberjArray.Add(idNumber);
}
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();
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 Submit(out string resultRead, out string resultMsg)
{
string code = "-9999";
resultRead = "";
resultMsg = "";
try
{
string url = "http://swgxs.poc.htjs.net:9019/v2/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;
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();
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>
public static string SubmitQuery(out string resultRead, out string resultMsg)
{
string code = "-9999";
resultRead = "";
resultMsg = "";
try
{
string url = "http://swgxs.poc.htjs.net:9019/v2/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;
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();
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)
{
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.AppendLine("POST /v2/cloud/queryUniqueSign HTTP/1.1");
stringBuilder.AppendLine($"date: {date}");
stringBuilder.AppendLine($"host: {host}");
stringBuilder.AppendLine($"x-htjs-nonce: {x_htjs_nonce}");
stringBuilder.AppendLine($"x-htjs-ua: {x_htjs_ua}");
string value = $"hmac username=\"{GetHmacSha256("", "")}\", algorithm=\"hmac-sha256\", headers=\"request-line date host x-htjs-nonce x-htjs-ua\", signature=\"{GetHmacSha256("", stringBuilder.ToString())}\"";
return value;
}
/// <summary>
/// 获取HmacSha256
/// </summary>
/// <param name="key"></param>
/// <param name="value"></param>
/// <returns></returns>
public static string GetHmacSha256(string key, string value)
{
string rtnValue = "";
byte[] keyBytes = Encoding.UTF8.GetBytes(key);
byte[] valueBytes = Encoding.UTF8.GetBytes(value);
using (var hmacsha256 = n
@@ -0,0 +1,17 @@
using Org.BouncyCastle.Crypto.Parameters;
using Org.BouncyCastle.Security;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
namespace Lskj.QueryEssentialInfo
{
public static class RsaEntryUtil
{
public static byte[] Encrypt(string plainText, string publicKeyXml)
{
byte[] dataToEncrypt = Encoding.UTF8.GetBytes(plainText);
using (RSACryptoServi
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="BouncyCastle.Crypto" publicKeyToken="0e99375e54769942" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.8.9.0" newVersion="1.8.9.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="NPOI" publicKeyToken="0df73ec7942b34e1" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.1.3.1" newVersion="2.1.3.1" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="BouncyCastle" version="1.8.9" targetFramework="net40" />
</packages>