BankService.cs 41 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906
  1. using Muchinfo.MTPClient.Adapter.Abstract;
  2. using Muchinfo.MTPClient.CustomException;
  3. using Muchinfo.MTPClient.Data;
  4. using Muchinfo.MTPClient.Data.Enums;
  5. using Muchinfo.MTPClient.Data.Model.Account;
  6. using Muchinfo.MTPClient.Data.Model.Bank;
  7. using Muchinfo.MTPClient.Infrastructure.Helpers;
  8. using Muchinfo.MTPClient.Infrastructure.LinkProxy;
  9. using Muchinfo.MTPClient.Infrastructure.Utilities;
  10. using Muchinfo.MTPClient.IService;
  11. using Muchinfo.MTPClient.NetworkCore;
  12. using Muchinfo.MTPClient.NetworkCore.Package;
  13. using System;
  14. using System.Collections.Generic;
  15. using System.Collections.ObjectModel;
  16. using System.Windows;
  17. using Muchinfo.MTPClient.Data.Model.Sale;
  18. using Muchinfo.MTPClient.Service.Utilities;
  19. using Muchinfo.PC.Common.Helpers;
  20. using tas;
  21. using Muchinfo.MTPClient.Resources;
  22. using Bank;
  23. namespace Muchinfo.MTPClient.Service
  24. {
  25. public class BankService : IBankService
  26. {
  27. #region 构造函数
  28. private readonly BankAdapter _bankAdapter;
  29. public BankService()
  30. {
  31. _bankAdapter = LinkManager.Instance.TradeAdapterFactory.CreateBankAdapter();
  32. }
  33. #endregion
  34. #region 未实现接口
  35. /// <summary>
  36. /// 获取所有分行信息
  37. /// </summary>
  38. /// <returns>银行分支列表</returns>
  39. public List<Branchs> GetBranchBanks(string bankId, string cityName, TradeAccount tradeAccount)
  40. {
  41. throw new NotImplementedException();
  42. }
  43. /// <summary>
  44. /// 获取所有省列表地区信息
  45. /// </summary>
  46. /// <param name="tradeAccount"></param>
  47. /// <returns></returns>
  48. public List<KeyValuePair<string, string>> GetProvinces(TradeAccount tradeAccount)
  49. {
  50. //todo:这个接口之前是二级服务配置的物理文件address.txt
  51. throw new NotImplementedException();
  52. }
  53. /// <summary>
  54. /// 获取所有市地区信息
  55. /// </summary>
  56. /// <param name="province"></param>
  57. /// <param name="tradeAccount"></param>
  58. /// <returns></returns>
  59. public List<string> GetCitys(string province, TradeAccount tradeAccount)
  60. {
  61. //todo:这个接口之前是二级服务配置的物理文件address.txt
  62. throw new NotImplementedException();
  63. }
  64. public List<AmountQuery> QueryBankOutIn(DateTime startDate, DateTime endDate, TradeAccount tradeAccount)
  65. {
  66. throw new NotImplementedException();
  67. }
  68. #endregion
  69. #region 已经匹配完成
  70. /// <summary>
  71. /// 查询银行出入金
  72. /// </summary>
  73. /// <param name="startDate"></param>
  74. /// <param name="endDate"></param>
  75. /// <param name="tradeAccount"></param>
  76. /// <param name="successAction"></param>
  77. /// <param name="errorAction"></param>
  78. public void QueryBankOutIn(DateTime startDate, DateTime endDate, TradeAccount tradeAccount, Action<List<AmountQuery>> successAction, Action<ErrorEntity> errorAction)
  79. {
  80. return;
  81. //var packgage = new TCPPackage() { Content = null, FunCode = FuncCode.FID_QueryBankAmountReq };
  82. //LinkManager.Instance.TradeTcpLinkProxy.SendPackage(packgage, new Action<TCPPackage>((revPackgage) =>
  83. //{
  84. // var responeEntity = _bankAdapter.FromBankSignRsp(revPackgage.Content);
  85. // if (responeEntity.RetCode == 0)
  86. // {
  87. // // successAction(null);
  88. // }
  89. // else
  90. // {
  91. // if (errorAction != null)
  92. // {
  93. // errorAction(new ErrorEntity()
  94. // {
  95. // //RequestFunc = "查询银行出入金"
  96. // ReturnCode = responeEntity.RetCode,
  97. // ReturnDesc = responeEntity.RetDesc,
  98. // RequestFunc = Client_Resource.Resources_Service_QueryBankInOutOfMoney
  99. // });
  100. // }
  101. // }
  102. //}), new Action<int, string>((errorCode, errorDesc) =>
  103. //{
  104. // ////通信错误
  105. // if (errorAction != null)
  106. // {
  107. // errorAction(new ErrorEntity() { ReturnCode = errorCode, ReturnDesc = errorDesc, RequestFunc = Client_Resource.Resources_Service_QueryBankInOutOfMoney });
  108. // }
  109. //}));
  110. }
  111. /// <summary>
  112. /// 进行银行解约申请
  113. /// </summary>
  114. /// <param name="bankInfo"></param>
  115. /// <param name="tradeAccount"></param>
  116. /// <param name="successAction"></param>
  117. /// <param name="errorAction"></param>
  118. public void BankCaneclSign(SigningBank bankInfo, Action<BankSignResult> successAction, Action<ErrorEntity> errorAction)
  119. {
  120. return;
  121. //var Req = _bankAdapter.ToBankCancelSignReq(bankInfo);
  122. //var packgage = new TCPPackage() { Content = Req, FunCode = FuncCode.FID_BankCancelSignReq };
  123. //LinkManager.Instance.TradeTcpLinkProxy.SendPackage(packgage, new Action<TCPPackage>((revPackgage) =>
  124. //{
  125. // var responeEntity = _bankAdapter.FromBankSignRsp(revPackgage.Content);
  126. // if (responeEntity.RetCode == 0)
  127. // {
  128. // try
  129. // {
  130. // var rsp = _bankAdapter.FromBankSignRspToBankSignResult(responeEntity);
  131. // successAction(rsp);
  132. // }
  133. // catch (Exception ex)
  134. // {
  135. // errorAction(new ErrorEntity()
  136. // {
  137. // //RequestFunc = "出入金请求"
  138. // ReturnCode = ExceptionManager.NetWorkErrorDataError,
  139. // ReturnDesc = responeEntity.RetDesc,
  140. // RequestFunc = Client_Resource.Resources_Service_RequestOutInMoney
  141. // });
  142. // LogHelper.WriteError(typeof (BankService), ex.ToString());
  143. // }
  144. // }
  145. // else
  146. // {
  147. // if (errorAction != null)
  148. // {
  149. // errorAction(new ErrorEntity()
  150. // {
  151. // //RequestFunc = string.Format("进行银行解约申请,用户ID({0})"
  152. // ReturnCode = responeEntity.RetCode,
  153. // ReturnDesc = responeEntity.RetDesc,
  154. // RequestFunc = Client_Resource.Resources_Service_BankForCancellation
  155. // });
  156. // }
  157. // }
  158. //}), new Action<int, string>((errorCode, errorDesc) =>
  159. //{
  160. // ////通信错误
  161. // if (errorAction != null)
  162. // {
  163. // errorAction(new ErrorEntity() { ReturnCode = errorCode, ReturnDesc = errorDesc, RequestFunc = Client_Resource.Resources_Service_BankForCancellation });
  164. // }
  165. //}));
  166. }
  167. /// <summary>
  168. /// 签约银行申请
  169. /// </summary>
  170. /// <param name="signingBank"></param>
  171. /// <param name="tradeAccount"></param>
  172. /// <param name="successAction"></param>
  173. /// <param name="errorAction"></param>
  174. public void BankSign(SigningBank signingBank, Action<BankSignResult> successAction, Action<ErrorEntity> errorAction)
  175. {
  176. return;
  177. //var obj= new tas.BankSignReq()
  178. //{
  179. // ExtOperatorID = (long)signingBank.ExtOperatorID,
  180. // AccountCode = signingBank.AccountCode,
  181. // BankAccountNo = signingBank.BankAccount,
  182. // BankAccountName = signingBank.AccountName,
  183. // CertType = (int)signingBank.CredentialType,
  184. // CertID = string.IsNullOrWhiteSpace(signingBank.CredentialNumber) ? "0000" : signingBank.CredentialNumber,
  185. // CusBankID = signingBank.CusBankID+string.Empty,
  186. // CustomerName = signingBank.CustomerName,
  187. // ExBankNo = signingBank.BankId,
  188. // ExBankName = signingBank.Name,
  189. // OpenBankNo = signingBank.BranchId,
  190. // OpenBankName = signingBank.BranchBankName,
  191. // PaymentNo = signingBank.PaymentNumber,
  192. // ProtocolNo = signingBank.ProtocolNumber,
  193. // AccountType = (int)signingBank.AccountType,
  194. // Currency = string.IsNullOrWhiteSpace(signingBank.Currency) ? "RMB" : signingBank.Currency,
  195. // BankAccountPWD =string.IsNullOrEmpty(signingBank.BankPassword)?string.Empty: signingBank.BankPassword,
  196. // //BankAccountPWD = signingBank.BankPassword,
  197. // //SerialNumber = request.SerialNumber
  198. // // BankAccountPWD = request.BankAccountPWD,
  199. // IdentifyCode = signingBank.IdentifyCode,
  200. // AgentCertID = signingBank.AgentCID,
  201. // AgentCertType = (int)signingBank.AgentCredentialType,
  202. // AgentName = signingBank.AgentName,
  203. // BankAccountType = (int)signingBank.BankAccountType,
  204. // BankCity = signingBank.CityCode,
  205. // BankProvince = signingBank.ProvinceCode,
  206. // MobilePhone = signingBank.MobilePhone,
  207. // BankCardType = signingBank.BankCardType == 0 ? 1 : (int)signingBank.BankCardType,
  208. //};
  209. //var Req = _bankAdapter.ToBankSignReq(obj);
  210. //var packgage = new TCPPackage() { Content = Req, FunCode = FuncCode.FID_BankSignReq };
  211. //LinkManager.Instance.TradeTcpLinkProxy.SendPackage(packgage, new Action<TCPPackage>((revPackgage) =>
  212. //{
  213. // var responeEntity = _bankAdapter.FromBankSignRsp(revPackgage.Content);
  214. // if (responeEntity.RetCode == 0)
  215. // {
  216. // try
  217. // {
  218. // var rsp = _bankAdapter.FromBankSignRspToBankSignResult(responeEntity);
  219. // successAction(rsp);
  220. // }
  221. // catch (Exception ex)
  222. // {
  223. // errorAction(new ErrorEntity()
  224. // {
  225. // //RequestFunc = "出入金请求"
  226. // ReturnCode = ExceptionManager.NetWorkErrorDataError,
  227. // ReturnDesc = responeEntity.RetDesc,
  228. // RequestFunc = Client_Resource.Resources_Service_RequestOutInMoney
  229. // });
  230. // LogHelper.WriteError(typeof (BankService), ex.ToString());
  231. // }
  232. // }
  233. // else
  234. // {
  235. // if (errorAction != null)
  236. // {
  237. // errorAction(new ErrorEntity()
  238. // {
  239. // //RequestFunc = string.Format("签约银行申请,用户ID({0})"
  240. // ReturnCode = responeEntity.RetCode,
  241. // ReturnDesc = responeEntity.RetDesc,
  242. // RequestFunc = Client_Resource.Resources_Service_ContractBankApp
  243. // });
  244. // }
  245. // }
  246. //}), new Action<int, string>((errorCode, errorDesc) =>
  247. //{
  248. // ////通信错误
  249. // if (errorAction != null)
  250. // {
  251. // errorAction(new ErrorEntity() { ReturnCode = errorCode, ReturnDesc = errorDesc, RequestFunc = Client_Resource.Resources_Service_ContractBankApp });
  252. // }
  253. //}));
  254. }
  255. /// <summary>
  256. ///
  257. /// </summary>
  258. /// <param name="signingBank"></param>
  259. /// <param name="tradeAccount"></param>
  260. /// <param name="successAction"></param>
  261. /// <param name="errorAction"></param>
  262. public void SignUpdate(SigningBank signingBank, Action<int> successAction, Action<ErrorEntity> errorAction)
  263. {
  264. //var sur = new tas.SignUpdateReq()
  265. //{
  266. // ExtOperatorID = signingBank.ExtOperatorID,
  267. // CustomerSignId = signingBank.CustomerSignId,
  268. // AccountCode = signingBank.AccountCode,
  269. // AccountType = (int)signingBank.AccountType,
  270. // CusBankID = signingBank.CusBankID+string.Empty,
  271. // Currency = string.IsNullOrWhiteSpace(signingBank.Currency) ? "RMB" : signingBank.Currency,
  272. // OpenBankNo = signingBank.BankId,
  273. // OpenBankName = signingBank.Name,
  274. // BankAccountNo = signingBank.BankAccount,
  275. // BankAccountName = signingBank.AccountName,
  276. // BankId = signingBank.BankId,
  277. // MobilePhone = signingBank.MobilePhone,
  278. // IdentifyCode = signingBank.IdentifyCode,
  279. // //SerialNumber = request.SerialNumber
  280. //};
  281. //var Req = _bankAdapter.ToSignUpdateReq(sur);
  282. //var packgage = new TCPPackage() { Content = Req, FunCode = FuncCode.FID_SignUpdateReq };
  283. //LinkManager.Instance.TradeTcpLinkProxy.SendPackage(packgage, new Action<TCPPackage>((revPackgage) =>
  284. //{
  285. // var responeEntity = _bankAdapter.FromSignUpdateRsp(revPackgage.Content);
  286. // if (responeEntity.RetCode == 0)
  287. // {
  288. // successAction(responeEntity.RetCode);
  289. // }
  290. // else
  291. // {
  292. // if (errorAction != null)
  293. // {
  294. // errorAction(new ErrorEntity()
  295. // {
  296. // //RequestFunc = string.Format("签约信息变更,用户ID({0})
  297. // ReturnCode = responeEntity.RetCode,
  298. // ReturnDesc = responeEntity.RetDesc,
  299. // RequestFunc = Client_Resource.Resources_Service_ChangeOfContractInfo
  300. // });
  301. // }
  302. // }
  303. //}), new Action<int, string>((errorCode, errorDesc) =>
  304. //{
  305. // ////通信错误
  306. // if (errorAction != null)
  307. // {
  308. // errorAction(new ErrorEntity() { ReturnCode = errorCode, ReturnDesc = errorDesc, RequestFunc = Client_Resource.Resources_Service_ChangeOfContractInfo });
  309. // }
  310. //}));
  311. }
  312. /// <summary>
  313. /// 出入金请求
  314. /// </summary>
  315. /// <param name="request">The account.</param>
  316. /// <returns>BankResponse.</returns>
  317. public void OutInMoney(Amount amount, SigningBank bankAccountInfo, Action<BankSignResult> successAction, Action<ErrorEntity> errorAction)
  318. {
  319. return;
  320. //byte[] Req = null;
  321. //uint FCode = 0;
  322. //#region switch amount.FundsApplyType
  323. //switch (amount.FundsApplyType)
  324. //{
  325. // case Data.Enums.FundsApplyType.Withdraw: //出金 655597
  326. // FCode = FuncCode.FID_BankWithDrawReq;
  327. // var bwdr = new Bank.BankWithDrawReq()
  328. // {
  329. // // ExtOperatorID = request.OperationFlowId,
  330. // ExtOperatorID = (long)amount.AccountId,
  331. // AccountCode = amount.AccountCode,
  332. // Amount = -(double)amount.Money,
  333. // BankAccountNo = bankAccountInfo.BankAccount,
  334. // Currency = string.IsNullOrEmpty(bankAccountInfo.Currency) ? "RMB" : bankAccountInfo.Currency,
  335. // //OutInMoneyType = (int)request.OutInMoneyType,
  336. // AccountType = (int)amount.AccountType,// amount.AccountType,
  337. // CusBankID = bankAccountInfo.CusBankID == 0 ? "0" : bankAccountInfo.CusBankID+string.Empty,
  338. // CustomerSignId = bankAccountInfo.CustomerSignId,
  339. // IdentifyCode = bankAccountInfo.IdentifyCode,
  340. // //SerialNumber = request.SerialNumber,
  341. // OldTaPWD = string.IsNullOrEmpty(amount.Password) ? string.Empty : EncryptHelper.MD5(amount.Password),
  342. // Desc = amount.Remark
  343. // };
  344. // Req = _bankAdapter.ToBankWithDrawReq(bwdr);
  345. // break;
  346. // case Data.Enums.FundsApplyType.Deposit://入金 655599
  347. // FCode = FuncCode.FID_BankDepositReq;
  348. // var bdr = new Bank.BankDepositReq()
  349. // {
  350. // // ExtOperatorID = request.OperationFlowId,
  351. // ExtOperatorID = (long)amount.AccountId,
  352. // AccountCode = amount.AccountCode,
  353. // Amount = (double)amount.Money,
  354. // BankAccountNo = bankAccountInfo.BankAccount,
  355. // Currency = string.IsNullOrEmpty(bankAccountInfo.Currency) ? "RMB" : bankAccountInfo.Currency,
  356. // //OutInMoneyType = (int)request.OutInMoneyType,
  357. // AccountType = (int)amount.AccountType,// amount.AccountType,
  358. // CusBankID = bankAccountInfo.CusBankID == 0 ? "0" : bankAccountInfo.CusBankID+string.Empty,
  359. // CustomerSignId = bankAccountInfo.CustomerSignId,
  360. // IdentifyCode=bankAccountInfo.IdentifyCode,
  361. // //SerialNumber = request.SerialNumber,
  362. // OldTaPWD = string.IsNullOrEmpty(amount.Password) ? string.Empty : EncryptHelper.MD5(amount.Password),
  363. // Desc = amount.Remark
  364. // };
  365. // Req = _bankAdapter.ToBankDepositReq(bdr);
  366. // break;
  367. // default:
  368. // break;
  369. //}
  370. //#endregion
  371. //var packgage = new TCPPackage() { Content = Req, FunCode = FCode };
  372. //LinkManager.Instance.TradeTcpLinkProxy.SendPackage(packgage, new Action<TCPPackage>((revPackgage) =>
  373. //{
  374. // // BankDepositRsp
  375. // // BankDepositRsp rsp = ProtobufHelper.Deserialize<BankDepositRsp>(buffer);
  376. // var responeEntity = _bankAdapter.FromBankDepositRsp(revPackgage.Content);
  377. // if (responeEntity.RetCode == 0)
  378. // {
  379. // try
  380. // {
  381. // // 待转模型 SignBankPwdInRsp=》 BankSignResult
  382. // var rep = _bankAdapter.FromSignBankPwdInRspToBankSignResult(responeEntity);
  383. // successAction(rep);
  384. // }
  385. // catch (Exception ex)
  386. // {
  387. // errorAction(new ErrorEntity()
  388. // {
  389. // //RequestFunc = "出入金请求"
  390. // ReturnCode = ExceptionManager.NetWorkErrorDataError,
  391. // ReturnDesc = responeEntity.RetDesc,
  392. // RequestFunc = Client_Resource.Resources_Service_RequestOutInMoney
  393. // });
  394. // LogHelper.WriteError(typeof(BankService), ex.ToString());
  395. // }
  396. // }
  397. // else
  398. // {
  399. // if (errorAction != null)
  400. // {
  401. // errorAction(new ErrorEntity()
  402. // {
  403. // //RequestFunc = "出入金请求"
  404. // ReturnCode = responeEntity.RetCode,
  405. // ReturnDesc = responeEntity.RetDesc,
  406. // RequestFunc = Client_Resource.Resources_Service_RequestOutInMoney
  407. // });
  408. // }
  409. // }
  410. //}), new Action<int, string>((errorCode, errorDesc) =>
  411. //{
  412. // ////通信错误
  413. // if (errorAction != null)
  414. // {
  415. // errorAction(new ErrorEntity() { ReturnCode = errorCode, ReturnDesc = errorDesc, RequestFunc = Client_Resource.Resources_Service_RequestOutInMoney });
  416. // }
  417. //}));
  418. }
  419. /// <summary>
  420. /// 签约银行密码确认请求
  421. /// </summary>
  422. /// <param name="session">会话</param>
  423. /// <param name="request">请求实体</param>
  424. public void SignBankPwd(SignBankPDW request , Action<int> successAction, Action<ErrorEntity> errorAction)
  425. {
  426. //var Req = _bankAdapter.ToSignBankPwdReq(request);
  427. //var packgage = new TCPPackage() { Content = Req, FunCode = FuncCode.FID_SignBankPwdReq };
  428. //LinkManager.Instance.TradeTcpLinkProxy.SendPackage(packgage, new Action<TCPPackage>((revPackgage) =>
  429. //{
  430. // var responeEntity = _bankAdapter.FromSignBankPwdInRsp(revPackgage.Content);
  431. // if (responeEntity.RetCode == 0)
  432. // {
  433. // successAction(responeEntity.RetCode);
  434. // }
  435. // else
  436. // {
  437. // if (errorAction != null)
  438. // {
  439. // errorAction(new ErrorEntity()
  440. // {
  441. // //RequestFunc = "签约银行密码确认请求"
  442. // ReturnCode = responeEntity.RetCode,
  443. // ReturnDesc = responeEntity.RetDesc,
  444. // RequestFunc = Client_Resource.Resources_Service_RequestContractBankPasswordConfirm
  445. // });
  446. // }
  447. // }
  448. //}), new Action<int, string>((errorCode, errorDesc) =>
  449. //{
  450. // ////通信错误
  451. // if (errorAction != null)
  452. // {
  453. // errorAction(new ErrorEntity() { ReturnCode = errorCode, ReturnDesc = errorDesc, RequestFunc = Client_Resource.Resources_Service_RequestContractBankPasswordConfirm });
  454. // }
  455. //}));
  456. }
  457. /// <summary>
  458. /// 银行平台密钥申请请求
  459. /// </summary>
  460. /// <param name="session">会话</param>
  461. /// <param name="request">请求实体</param>
  462. public void QueryEncryptKey(EncryptKeyRequest request, Action<EncryptKey> successAction, Action<ErrorEntity> errorAction)
  463. {
  464. //var Req = _bankAdapter.ToApplySecretKeyReq(request);
  465. //var packgage = new TCPPackage() { Content = Req, FunCode = FuncCode.FID_ApplySecretKeyReq };
  466. //LinkManager.Instance.TradeTcpLinkProxy.SendPackage(packgage, new Action<TCPPackage>((revPackgage) =>
  467. //{
  468. // var responeEntity = _bankAdapter.FromApplySecretKeyResponse(revPackgage.Content);
  469. // if (responeEntity.RetCode == 0)
  470. // {
  471. // var rsp = new EncryptKey()
  472. // {
  473. // KMCode = responeEntity.KMCode,
  474. // KPCode = responeEntity.KPCode,
  475. // SecretKey = responeEntity.SecretKey,
  476. // };
  477. // successAction(rsp);
  478. // }
  479. // else
  480. // {
  481. // if (errorAction != null)
  482. // {
  483. // errorAction(new ErrorEntity()
  484. // {
  485. // //RequestFunc = "银行平台密钥申请请求"
  486. // ReturnCode = responeEntity.RetCode,
  487. // ReturnDesc = responeEntity.RetDesc,
  488. // RequestFunc = Client_Resource.Resources_Service_RequestBankPlatformPassword
  489. // });
  490. // }
  491. // }
  492. //}), new Action<int, string>((errorCode, errorDesc) =>
  493. //{
  494. // ////通信错误
  495. // if (errorAction != null)
  496. // {
  497. // errorAction(new ErrorEntity() { ReturnCode = errorCode, ReturnDesc = errorDesc, RequestFunc = Client_Resource.Resources_Service_RequestBankPlatformPassword });
  498. // }
  499. //}));
  500. }
  501. /// <summary>
  502. /// 城市信息查询请求
  503. /// </summary>
  504. /// <param name="session">会话</param>
  505. /// <param name="request">请求实体</param>
  506. public void QueryCityInfo(string provinceCode, Action<List<City>> successAction, Action<ErrorEntity> errorAction)
  507. {
  508. var request = _bankAdapter.ToRequestQueryCity(provinceCode);
  509. var packgage = new TCPPackage() { Content = request, FunCode = FuncBankCode.FID_BANK_QueryCityInfoReq };
  510. LinkManager.Instance.TradeTcpLinkProxy.SendPackage(packgage, new Action<TCPPackage>((revPackgage) =>
  511. {
  512. var responeEntity = _bankAdapter.ToLocalCityInfo(revPackgage.Content);
  513. if (responeEntity.RetCode == 0)
  514. {
  515. successAction(responeEntity.Entity);
  516. }
  517. else
  518. {
  519. if (errorAction != null)
  520. {
  521. errorAction(new ErrorEntity()
  522. {
  523. //RequestFunc = "城市信息查询请求"
  524. ReturnCode = responeEntity.RetCode,
  525. ReturnDesc = responeEntity.RetMessage,
  526. RequestFunc = Client_Resource.Resources_Service_QueryCityInfo
  527. });
  528. }
  529. }
  530. }), new Action<int, string>((errorCode, errorDesc) =>
  531. {
  532. ////通信错误
  533. if (errorAction != null)
  534. {
  535. errorAction(new ErrorEntity() { ReturnCode = errorCode, ReturnDesc = errorDesc, RequestFunc = Client_Resource.Resources_Service_QueryCityInfo });
  536. }
  537. }));
  538. }
  539. /// <summary>
  540. /// 省份信息查询请求
  541. /// </summary>
  542. /// <param name="session">会话</param>
  543. /// <param name="request">请求实体</param>
  544. public void QueryProvinceInfo(Action<List<Province>> successAction, Action<ErrorEntity> errorAction)
  545. {
  546. var request = _bankAdapter.ToRequestQueryProvince();
  547. var packgage = new TCPPackage() { Content = request, FunCode = FuncBankCode.FID_BANK_QueryProvinceInfoReq };
  548. LinkManager.Instance.TradeTcpLinkProxy.SendPackage(packgage, new Action<TCPPackage>((revPackgage) =>
  549. {
  550. var responeEntity = _bankAdapter.ToLocalProvinceInfo(revPackgage.Content);
  551. if (responeEntity.RetCode == 0)
  552. {
  553. successAction(responeEntity.Entity);
  554. }
  555. else
  556. {
  557. if (errorAction != null)
  558. {
  559. errorAction(new ErrorEntity()
  560. {
  561. //RequestFunc = "省份信息查询请求" Resources_Service_QueryProvinceInfo
  562. ReturnCode = responeEntity.RetCode,
  563. ReturnDesc = responeEntity.RetMessage,
  564. RequestFunc = Client_Resource.Resources_Service_QueryProvinceInfo
  565. });
  566. }
  567. }
  568. }), new Action<int, string>((errorCode, errorDesc) =>
  569. {
  570. ////通信错误
  571. if (errorAction != null)
  572. {
  573. errorAction(new ErrorEntity() { ReturnCode = errorCode, ReturnDesc = errorDesc, RequestFunc = Client_Resource.Resources_Service_QueryProvinceInfo });
  574. }
  575. }));
  576. }
  577. #endregion
  578. /// <summary>
  579. /// 出入金查询
  580. /// </summary>
  581. /// <param name="statement"></param>
  582. /// <param name="queryCommonParams"></param>
  583. /// <param name="successAction"></param>
  584. /// <param name="errorAction"></param>
  585. public void QueryBankOutIn(string statement, List<QueryCommonParam> queryCommonParams, Action<List<AmountQuery>> successAction, Action<ErrorEntity> errorAction)
  586. {
  587. QueryCommonHelper.QueryCommon(statement, queryCommonParams, new Action<List<AmountQuery>>((amountQuery) =>
  588. {
  589. if (successAction != null)
  590. {
  591. successAction(amountQuery);
  592. }
  593. }),(error) =>
  594. {
  595. if (errorAction != null)
  596. {
  597. //RequestFunc = "出入金明细查询({0})" Resources_Service_QueryBankOutIn
  598. error.RequestFunc = string.Format(Client_Resource.Resources_Service_QueryBankOutIn, statement);
  599. errorAction(error);
  600. }
  601. });
  602. }
  603. /// <summary>
  604. /// 查询账号所属会员账号信息
  605. /// </summary>
  606. /// <param name="accountId">交易员ID</param>
  607. /// <param name="successAction"></param>
  608. /// <param name="errorAction"></param>
  609. public void QueryMemberAccountInfo(ulong accountId, Action<List<AreaAccount>> successAction, Action<ErrorEntity> errorAction)
  610. {
  611. List<QueryCommonParam> queryCommonParams = new List<QueryCommonParam>();
  612. queryCommonParams.Add(new QueryCommonParam() { ParamKey = "accountId", ParamValue = accountId + string.Empty });
  613. QueryCommonHelper.QueryCommon(QueryStatement.SearchClientMemberAccount, queryCommonParams, new Action<List<AreaAccount>>((amountQuery) =>
  614. {
  615. if (successAction != null)
  616. {
  617. successAction(amountQuery);
  618. }
  619. }), (error) =>
  620. {
  621. if (errorAction != null)
  622. {
  623. error.RequestFunc = string.Format(Client_Resource.Resources_Service_areaAccount, QueryStatement.SearchClientMemberAccount);
  624. errorAction(error);
  625. }
  626. });
  627. }
  628. public void QueryBankCustomerSignInfo(ulong accountId, Action<List<SigningBank>> successAction, Action<ErrorEntity> errorAction)
  629. {
  630. List<QueryCommonParam> queryCommonParams = new List<QueryCommonParam>();
  631. queryCommonParams.Add(new QueryCommonParam() { ParamKey = "accountId", ParamValue = accountId + string.Empty });
  632. QueryCommonHelper.QueryCommon(QueryStatement.QueryBankCustomerSign, queryCommonParams, new Action<List<SigningBank>>((signInfos) =>
  633. {
  634. if (successAction != null)
  635. {
  636. successAction(signInfos);
  637. }
  638. }), (error) =>
  639. {
  640. if (errorAction != null)
  641. {
  642. error.RequestFunc ="签约信息查询";
  643. errorAction(error);
  644. }
  645. });
  646. }
  647. public void QueryCusBankParamConfig(ulong accountId, Action<List<CusBankInfo>> successAction, Action<ErrorEntity> errorAction)
  648. {
  649. List<QueryCommonParam> queryCommonParams = new List<QueryCommonParam>();
  650. queryCommonParams.Add(new QueryCommonParam() { ParamKey = "accountId", ParamValue = accountId + string.Empty });
  651. QueryCommonHelper.QueryCommon(QueryStatement.QueryCusBankParamconfig, queryCommonParams, new Action<List<CusBankInfo>>((bankinfos) =>
  652. {
  653. if (successAction != null)
  654. {
  655. successAction(bankinfos);
  656. }
  657. }), (error) =>
  658. {
  659. if (errorAction != null)
  660. {
  661. error.RequestFunc = "托管信息查询";
  662. errorAction(error);
  663. }
  664. });
  665. }
  666. public void QueryCommonBankInfo(List<QueryCommonParam> queryCommonParams, Action<List<Banks>> successAction, Action<ErrorEntity> errorAction)
  667. {
  668. QueryCommonHelper.QueryCommon(QueryStatement.QueryBankInfo, queryCommonParams, new Action<List<Banks>>((bankinfos) =>
  669. {
  670. if (successAction != null)
  671. {
  672. successAction(bankinfos);
  673. }
  674. }), (error) =>
  675. {
  676. if (errorAction != null)
  677. {
  678. error.RequestFunc = "托管信息查询";
  679. errorAction(error);
  680. }
  681. });
  682. }
  683. public void QueryBankCustomerSign(string accountCode, Action<ObservableCollection<SigningBank>> successAction, Action<ErrorEntity> errorAction)
  684. {
  685. throw new NotImplementedException();
  686. }
  687. public void QueryCusBankInfo(Action<List<SigningBank>> successAction, Action<ErrorEntity> errorAction)
  688. {
  689. throw new NotImplementedException();
  690. }
  691. public void QueryBankInfo(Action<List<Banks>> successAction, Action<ErrorEntity> errorAction)
  692. {
  693. throw new NotImplementedException();
  694. }
  695. public void QueryBankParamConfig(string cusBankID, Action<List<SigningBank>> successAction, Action<ErrorEntity> errorAction)
  696. {
  697. throw new NotImplementedException();
  698. }
  699. public void BankGetIdentifyCode(IdentifyCodeReq bankInfo, Action<bool> successAction, Action<ErrorEntity> errorAction)
  700. {
  701. var request = _bankAdapter.ToIdentifyCodeReq(bankInfo);
  702. var packgage = new TCPPackage() { Content = request, FunCode = FuncBankCode.FID_BANK_BankGetIdentifyCodeReq };
  703. LinkManager.Instance.TradeTcpLinkProxy.SendPackage(packgage, new Action<TCPPackage>((revPackgage) =>
  704. {
  705. var responeEntity = _bankAdapter.FromIdentifyCodeReq(revPackgage.Content);
  706. if (responeEntity.RetCode == 0)
  707. {
  708. successAction(true);
  709. }
  710. else
  711. {
  712. if (errorAction != null)
  713. {
  714. errorAction(new ErrorEntity()
  715. {
  716. //RequestFunc = "获取手机验证码"
  717. ReturnCode = responeEntity.RetCode,
  718. ReturnDesc = responeEntity.RetDesc,
  719. RequestFunc = Client_Resource.Resources_Service_BankGetIdentifyCode
  720. });
  721. }
  722. }
  723. }), new Action<int, string>((errorCode, errorDesc) =>
  724. {
  725. ////通信错误
  726. if (errorAction != null)
  727. {
  728. errorAction(new ErrorEntity() { ReturnCode = errorCode, ReturnDesc = errorDesc, RequestFunc = Client_Resource.Resources_Service_BankGetIdentifyCode });
  729. }
  730. }));
  731. }
  732. public void GetBankBalace(SigningBank bankInfo, Action<List<BankBalanceModel>> successAction, Action<ErrorEntity> errorAction)
  733. {
  734. //var request = _bankAdapter.ToBankSubBalanceReq(bankInfo);
  735. //var packgage = new TCPPackage() { Content = request, FunCode = FuncCode.FID_QueryBankAccountInfoReq };
  736. //LinkManager.Instance.TradeTcpLinkProxy.SendPackage(packgage, new Action<TCPPackage>((revPackgage) =>
  737. //{
  738. // var responeEntity = _bankAdapter.FromoBankSubBalanceRsp(revPackgage.Content);
  739. // if (responeEntity.RetCode == 0)
  740. // {
  741. // successAction(responeEntity.Entity);
  742. // }
  743. // else
  744. // {
  745. // if (errorAction != null)
  746. // {
  747. // errorAction(new ErrorEntity()
  748. // {
  749. // ReturnCode = responeEntity.RetCode,
  750. // ReturnDesc = responeEntity.RetMessage,
  751. // RequestFunc = Client_Resource.Resources_QueryBankBalance
  752. // });
  753. // }
  754. // }
  755. //}), new Action<int, string>((errorCode, errorDesc) =>
  756. //{
  757. // ////通信错误
  758. // if (errorAction != null)
  759. // {
  760. // errorAction(new ErrorEntity() { ReturnCode = errorCode, ReturnDesc = errorDesc, RequestFunc = Client_Resource.Resources_QueryBankBalance });
  761. // }
  762. //}));
  763. }
  764. public void BankUnBindBankCard(SigningBank bankInfo, Action<BankUnBindResult> successAction, Action<ErrorEntity> errorAction)
  765. {
  766. //var request = _bankAdapter.ToBankUnBindCardReq(bankInfo);
  767. //var packgage = new TCPPackage() { Content = request, FunCode = FuncCode.FID_BankUnbindCardReq };
  768. //LinkManager.Instance.TradeTcpLinkProxy.SendPackage(packgage, new Action<TCPPackage>((revPackgage) =>
  769. //{
  770. // try
  771. // {
  772. // var responeEntity = _bankAdapter.ToBankUnBindCardRsp(revPackgage.Content);
  773. // if (responeEntity.RetCode == 0)
  774. // {
  775. // successAction(responeEntity.Entity);
  776. // }
  777. // else
  778. // {
  779. // if (errorAction != null)
  780. // {
  781. // errorAction(new ErrorEntity()
  782. // {
  783. // ReturnCode = responeEntity.RetCode,
  784. // ReturnDesc = responeEntity.RetMessage,
  785. // RequestFunc = Client_Resource.Function_BankUnBindBankCard
  786. // });
  787. // }
  788. // }
  789. // }
  790. // catch (Exception ex)
  791. // {
  792. // errorAction(new ErrorEntity()
  793. // {
  794. // //RequestFunc = "出入金请求"
  795. // ReturnCode = ExceptionManager.NetWorkErrorDataError,
  796. // RequestFunc = Client_Resource.Resources_Service_RequestOutInMoney
  797. // });
  798. // LogHelper.WriteError(typeof (BankService), ex.ToString());
  799. // }
  800. //}), new Action<int, string>((errorCode, errorDesc) =>
  801. //{
  802. // ////通信错误
  803. // if (errorAction != null)
  804. // {
  805. // errorAction(new ErrorEntity() { ReturnCode = errorCode, ReturnDesc = errorDesc, RequestFunc = Client_Resource.Function_BankUnBindBankCard });
  806. // }
  807. //}));
  808. }
  809. public void BankBindingBankCard(SigningBank bankInfo, Action<BankSignResult> successAction, Action<ErrorEntity> errorAction)
  810. {
  811. //var request = _bankAdapter.ToBankRebindCardReq(bankInfo);
  812. //var packgage = new TCPPackage() { Content = request, FunCode = FuncCode.FID_BankRebindCardReq };
  813. //LinkManager.Instance.TradeTcpLinkProxy.SendPackage(packgage, new Action<TCPPackage>((revPackgage) =>
  814. //{
  815. // try
  816. // {
  817. // var responeEntity = _bankAdapter.ToBankReBindCardRsp(revPackgage.Content);
  818. // if (responeEntity.RetCode == 0)
  819. // {
  820. // successAction(responeEntity.Entity);
  821. // }
  822. // else
  823. // {
  824. // if (errorAction != null)
  825. // {
  826. // errorAction(new ErrorEntity()
  827. // {
  828. // ReturnCode = responeEntity.RetCode,
  829. // ReturnDesc = responeEntity.RetMessage,
  830. // RequestFunc = Client_Resource.Function_BankReBindBankCard
  831. // });
  832. // }
  833. // }
  834. // }
  835. // catch (Exception ex)
  836. // {
  837. // errorAction(new ErrorEntity()
  838. // {
  839. // //RequestFunc = "出入金请求"
  840. // ReturnCode = ExceptionManager.NetWorkErrorDataError,
  841. // RequestFunc = Client_Resource.Resources_Service_RequestOutInMoney
  842. // });
  843. // LogHelper.WriteError(typeof(BankService), ex.ToString());
  844. // }
  845. //}), new Action<int, string>((errorCode, errorDesc) =>
  846. //{
  847. // ////通信错误
  848. // if (errorAction != null)
  849. // {
  850. // errorAction(new ErrorEntity() { ReturnCode = errorCode, ReturnDesc = errorDesc, RequestFunc = Client_Resource.Function_BankReBindBankCard });
  851. // }
  852. //}));
  853. }
  854. }
  855. }