diff --git a/插件库/Lskj.QueryEssentialInfo/FrmMain.cs b/插件库/Lskj.QueryEssentialInfo/FrmMain.cs index 0785e39..901cc35 100644 --- a/插件库/Lskj.QueryEssentialInfo/FrmMain.cs +++ b/插件库/Lskj.QueryEssentialInfo/FrmMain.cs @@ -80,6 +80,7 @@ namespace Lskj.QueryEssentialInfo /// private void ZXFJQuery() { + QueryApiUtil.Init(out string initResult, out string initMsg); if (QueryApiUtil.detailTab.AsEnumerable().Where(n => !(n["p_emp_addTag"] + "").Equals("1")).Count() > 0) { SetProcessMsg($"正在报送人员..."); diff --git a/插件库/Lskj.QueryEssentialInfo/Lskj.QueryEssentialInfo.csproj b/插件库/Lskj.QueryEssentialInfo/Lskj.QueryEssentialInfo.csproj index 9e6311b..05295b5 100644 --- a/插件库/Lskj.QueryEssentialInfo/Lskj.QueryEssentialInfo.csproj +++ b/插件库/Lskj.QueryEssentialInfo/Lskj.QueryEssentialInfo.csproj @@ -41,9 +41,9 @@ - + False - D:\工作\lserp_cs_6.0\引用DLL\Newtonsoft.Json.dll + ..\..\引用DLL\Newtonsoft.Json.dll diff --git a/插件库/Lskj.QueryEssentialInfo/QueryApiUtil.cs b/插件库/Lskj.QueryEssentialInfo/QueryApiUtil.cs index aa9bc9e..502a0aa 100644 --- a/插件库/Lskj.QueryEssentialInfo/QueryApiUtil.cs +++ b/插件库/Lskj.QueryEssentialInfo/QueryApiUtil.cs @@ -342,6 +342,50 @@ namespace Lskj.QueryEssentialInfo return code; } /// + /// 初始化 + /// + public static string Init(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/gsmycsh"; + HttpTools.setting("application/json", null, null, HttpTools.Encode.UTF8); + Dictionary headerDic = new Dictionary(); + 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("requestId", Guid.NewGuid().ToString().Replace("-", "").ToLower()); + pmsJObject.Add("accountId", "1"); + 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; + } + /// /// 同步人员 /// public static string Person(out string resultRead, out string resultMsg)