|
@@ -27,7 +27,6 @@ using PTMedicalInsurance.Common;
|
|
|
using PTMedicalInsurance.Variables;
|
|
|
using System.Runtime.InteropServices;
|
|
|
using PTMedicalInsurance.Forms;
|
|
|
-using PTMedicalInsurance.Common;
|
|
|
|
|
|
namespace PTMedicalInsurance.Helper
|
|
|
{
|
|
@@ -184,21 +183,47 @@ namespace PTMedicalInsurance.Helper
|
|
|
private JObject invokeCenterService(string data)
|
|
|
{
|
|
|
JObject joRtn = new JObject();
|
|
|
- IInvokeCenter center = InvokeCenterFactory.create();
|
|
|
- string outputData = "";
|
|
|
- string errMsg = "";
|
|
|
- int iInt = center.Init(ref errMsg);
|
|
|
- if (iInt == 0)
|
|
|
+ try
|
|
|
{
|
|
|
- iInt = center.Business(data, ref outputData, ref errMsg);
|
|
|
- joRtn = JObject.Parse(outputData);
|
|
|
- return joRtn;
|
|
|
+ IInvokeCenter center = InvokeCenterFactory.create();
|
|
|
+ string outputData = "";
|
|
|
+ string errMsg = "";
|
|
|
+ int iInt = center.Init(ref errMsg);
|
|
|
+ if (iInt == 0)
|
|
|
+ {
|
|
|
+ iInt = center.Business(data, ref outputData, ref errMsg);
|
|
|
+ if (iInt == 0 && !string.IsNullOrEmpty(outputData))
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ joRtn = JObject.Parse(outputData);
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ joRtn.Add("infcode", iInt);
|
|
|
+ joRtn.Add("err_msg", "返回参数异常:" + outputData);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ joRtn.Add("infcode", iInt);
|
|
|
+ joRtn.Add("err_msg", outputData);
|
|
|
+ return joRtn;
|
|
|
+ }
|
|
|
+ return joRtn;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ joRtn.Add("infcode", -1);
|
|
|
+ joRtn.Add("err_msg", "医保动态库初始化失败invokeInitByDLL:" + errMsg);
|
|
|
+ return joRtn;
|
|
|
+ }
|
|
|
}
|
|
|
- else
|
|
|
+ finally
|
|
|
{
|
|
|
- joRtn.Add("infcode", -1);
|
|
|
- joRtn.Add("err_msg", "医保动态库初始化失败invokeInitByDLL:" + errMsg);
|
|
|
- return joRtn;
|
|
|
+ Global.writeLog("调用中心:", JsonHelper.Compress(data), joRtn.ToString());
|
|
|
+ // 保存到服务器
|
|
|
+ this.saveCenterLog(JsonHelper.Compress(data), joRtn.ToString(), JsonHelper.Compress(data), joRtn.ToString());
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -351,45 +376,51 @@ namespace PTMedicalInsurance.Helper
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- InvokeRestCenter mobileCenter = new InvokeRestCenter();
|
|
|
- int iInt = mobileCenter.Business(data, ref outputData, ref errMsg);
|
|
|
- joRtn = JObject.Parse(outputData);
|
|
|
-
|
|
|
- Global.writeLog(funNO + "【密文出参】:\r\n" + joRtn.ToString());
|
|
|
-
|
|
|
- string encData = JsonHelper.getDestValue(joRtn, "encData");
|
|
|
- string signData = JsonHelper.getDestValue(joRtn, "signData");
|
|
|
- if (!string.IsNullOrEmpty(encData) && !string.IsNullOrEmpty(signData))
|
|
|
+ try
|
|
|
{
|
|
|
- joRtn.Remove("encData");
|
|
|
- joRtn.Remove("signData");
|
|
|
- joRtn.Remove("data");
|
|
|
- //解密
|
|
|
- string decData = encrypt.decrypt(encData);
|
|
|
- // 验签
|
|
|
- JsonConvert.DefaultSettings = () => new JsonSerializerSettings
|
|
|
- {
|
|
|
- FloatParseHandling = FloatParseHandling.Decimal
|
|
|
- };
|
|
|
- joRtn.Add("data", JToken.FromObject(JsonConvert.DeserializeObject(decData)));
|
|
|
+ InvokeRestCenter mobileCenter = new InvokeRestCenter();
|
|
|
+ int iInt = mobileCenter.Business(data, ref outputData, ref errMsg);
|
|
|
+ joRtn = JObject.Parse(outputData);
|
|
|
|
|
|
- bool rtn = encrypt.verify(joRtn, signData);
|
|
|
- if (rtn)
|
|
|
- {
|
|
|
- Global.writeLog(funNO + "【明文出参】:\r\n" + decData);
|
|
|
+ Global.writeLog(funNO + "【密文出参】:\r\n" + joRtn.ToString());
|
|
|
|
|
|
- joRtn = JObject.Parse(decData);
|
|
|
- joRtn.Add("success", "True");
|
|
|
- }
|
|
|
- else
|
|
|
+ string encData = JsonHelper.getDestValue(joRtn, "encData");
|
|
|
+ string signData = JsonHelper.getDestValue(joRtn, "signData");
|
|
|
+ if (!string.IsNullOrEmpty(encData) && !string.IsNullOrEmpty(signData))
|
|
|
{
|
|
|
- Global.writeLog("验签失败,请核查!");
|
|
|
+ joRtn.Remove("encData");
|
|
|
+ joRtn.Remove("signData");
|
|
|
+ joRtn.Remove("data");
|
|
|
+ //解密
|
|
|
+ string decData = encrypt.decrypt(encData);
|
|
|
+ // 验签
|
|
|
+ JsonConvert.DefaultSettings = () => new JsonSerializerSettings
|
|
|
+ {
|
|
|
+ FloatParseHandling = FloatParseHandling.Decimal
|
|
|
+ };
|
|
|
+ joRtn.Add("data", JToken.FromObject(JsonConvert.DeserializeObject(decData)));
|
|
|
+
|
|
|
+ bool rtn = encrypt.verify(joRtn, signData);
|
|
|
+ if (rtn)
|
|
|
+ {
|
|
|
+ Global.writeLog(funNO + "【明文出参】:\r\n" + decData);
|
|
|
+
|
|
|
+ joRtn = JObject.Parse(decData);
|
|
|
+ joRtn.Add("success", "True");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ Global.writeLog("验签失败,请核查!");
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- return joRtn;
|
|
|
+ return joRtn;
|
|
|
|
|
|
-
|
|
|
+ }
|
|
|
+ finally
|
|
|
+ {
|
|
|
+ this.saveCenterLog(JsonHelper.Compress(data), joRtn.ToString(), JsonHelper.Compress(data), joRtn.ToString());
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
catch (Exception ex)
|