SVN r954
SVN-Revision: r954
This commit is contained in:
@@ -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"))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user