AddNewMerchantSetUtil.cs 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Threading.Tasks;
  5. using Aop.Api.Util;
  6. using GraphQL;
  7. using Library;
  8. using LitJson;
  9. using MySystem;
  10. using MySystem.Models.Main;
  11. namespace MySystem
  12. {
  13. /// <summary>
  14. /// 好哒新建商户参数赋值
  15. /// </summary>
  16. public class AddNewMerchantSetUtil
  17. {
  18. public static AddNewMerchant SetValue(MerchantAddInfo AddInfo)
  19. {
  20. AddNewMerchant addNewMerchant = new AddNewMerchant();
  21. addNewMerchant.brh = HaoDaHelper.BrhCode; //机构号(正式)
  22. if (!string.IsNullOrEmpty(AddInfo.MchtNo))
  23. {
  24. addNewMerchant.mchtNo = AddInfo.MchtNo; //收款商户号
  25. }
  26. addNewMerchant.accountNo = AddInfo.AccountNumber; //银行卡号
  27. if (AddInfo.AccountType == "1")
  28. {
  29. addNewMerchant.accountName = AddInfo.CertLegalPerson; //开户名(账户名称)
  30. }
  31. else
  32. {
  33. addNewMerchant.accountName = AddInfo.AccountName; //开户名(账户名称)
  34. }
  35. addNewMerchant.accountType = AddInfo.AccountType; //账户类型 1 对私 0 对公
  36. addNewMerchant.zbankNo = AddInfo.ZbankNo; //开户银行支行号 参考支行号表(联系对接人提供)
  37. addNewMerchant.zbankRegionCode = AddInfo.ZbankRegionCode; //开户银行支行区域码 参考区域码表(联系对接人提供)
  38. if (AddInfo.AccountType == "1" && AddInfo.LicenceType == "0")
  39. {
  40. addNewMerchant.openBankAccName = AddInfo.OpenBankAccName; //开户许可证-开户名 企业商户必填(个体工商户对私不填)
  41. addNewMerchant.openBankAccout = AddInfo.OpenBankAccout; //开户许可证-银行卡号 企业商户必填(个体工商户对私不填)
  42. addNewMerchant.openBankRegionCode = AddInfo.OpenBankRegionCode; //开户许可证-银行地区码(地区码) 企业商户必填(个体工商户对私不填)
  43. addNewMerchant.openCollectBankCode = AddInfo.OpenCollectBankCode; //开户许可证-银行代码(总行行号) 企业商户必填(个体工商户对私不填)
  44. addNewMerchant.openUnionNo = AddInfo.OpenUnionNo; //开户许可证-开户支行 企业商户必填(个体工商户对私不填)
  45. }
  46. addNewMerchant.channelKind = AddInfo.ChannelKind; //商户类型 有执照填000002无执照填000001
  47. if (!string.IsNullOrEmpty(AddInfo.OutMchtNo))
  48. {
  49. addNewMerchant.outMchtNo = AddInfo.OutMchtNo; //慧掌柜商户号 通过查询商户审核状态接口会返回该慧掌柜商户号,后续如果新的收款商户号是属于同一个慧掌柜商户时则必填
  50. }
  51. addNewMerchant.mchtName = AddInfo.CertMerchantName; //商户名称 无营业执照商户命名规则:商户_姓名 有营业执照商户命名规则:与营业执照商户名一致
  52. addNewMerchant.mchtCnShortName = AddInfo.MerchantShortname; //商户简称
  53. addNewMerchant.address = AddInfo.BizStoreAddress; //商户门店地址 详细地址即可,不需要附带省市区
  54. addNewMerchant.alipayRate = "0.38"; //支付宝费率,值0.38,0.33等
  55. addNewMerchant.wechatPayRate = "0.38"; //微信费率,值0.38,0.33等
  56. addNewMerchant.unionPayRate = "0.38"; //银联二维码费率,值0.38,0.33等
  57. addNewMerchant.areaNo = AddInfo.AreaNo; //经营地区区域码 参考区域码表,填6位地区码(联系对接人提供)
  58. addNewMerchant.businessId = AddInfo.BusinessId; //经营范围 参考经营范围表(联系对接人提供)
  59. if (!string.IsNullOrEmpty(AddInfo.LicenseNumber))
  60. {
  61. addNewMerchant.licNo = AddInfo.LicenseNumber; //营业执照号 有营业执照必填
  62. }
  63. addNewMerchant.businessTerm = AddInfo.PeriodBegin.Value.ToString("yyyyMMdd") + "-" + AddInfo.PeriodEnd.Value.ToString("yyyyMMdd"); //营业执照有效期 格式:20200101-20300101,长期的填 20200101-99991231
  64. addNewMerchant.licenceType = AddInfo.LicenceType; //营业执照类型 0-企业法人营业执照 1-个体工商户营业执照 2-党政,机关及事业单位 3-其他组织
  65. addNewMerchant.userCardNo = AddInfo.IdCardNumber; //商户法人身份证号
  66. addNewMerchant.userPhone = AddInfo.MobilePhone; //法人手机号
  67. if (AddInfo.ChannelKind == "000001")
  68. {
  69. addNewMerchant.resserveMobile = AddInfo.ResserveMobile; //银行预留手机号 channelkind为000001时必填
  70. }
  71. addNewMerchant.userName = AddInfo.CertLegalPerson; //商户法人姓名
  72. if (AddInfo.CardPeriodEnd.Value.Year == 2050)
  73. {
  74. addNewMerchant.periodValidity = AddInfo.CardPeriodBegin.Value.ToString("yyyyMMdd") + "-" + "长期"; //法人身份证有效期 格式:20150101-20200101,若结束日期为长期填20150101-长期
  75. }
  76. else
  77. {
  78. addNewMerchant.periodValidity = AddInfo.CardPeriodBegin.Value.ToString("yyyyMMdd") + "-" + AddInfo.CardPeriodEnd.Value.ToString("yyyyMMdd"); //法人身份证有效期 格式:20150101-20200101,若结束日期为长期填20150101-长期
  79. }
  80. List<ImageItem> imageList = new List<ImageItem>();
  81. ImageItem imageItem = new ImageItem();
  82. //法人手持身份证正面
  83. if (!string.IsNullOrEmpty(AddInfo.PersonWithIdCard))
  84. {
  85. var tokenInfo = JsonMapper.ToObject(HaoDaHelper.Instance.GetToken(AddInfo.PersonWithIdCard.Substring(AddInfo.PersonWithIdCard.LastIndexOf("/")).Trim('/'), "0"));
  86. if (tokenInfo["code"].ToString() == "1")
  87. {
  88. var returnInfo = HaoDaHelper.Instance.ReturnFileName(tokenInfo["token"].ToString(), AddInfo.PersonWithIdCard);
  89. if (returnInfo != "false")
  90. {
  91. imageItem = new ImageItem();
  92. imageItem.name = "personWithIdCard";
  93. imageItem.value = returnInfo;
  94. imageList.Add(imageItem);
  95. }
  96. }
  97. }
  98. //收款人银行卡照片
  99. if (!string.IsNullOrEmpty(AddInfo.BankCard))
  100. {
  101. var tokenInfo = JsonMapper.ToObject(HaoDaHelper.Instance.GetToken(AddInfo.BankCard.Substring(AddInfo.BankCard.LastIndexOf("/")).Trim('/'), "0"));
  102. if (tokenInfo["code"].ToString() == "1")
  103. {
  104. var returnInfo = HaoDaHelper.Instance.ReturnFileName(tokenInfo["token"].ToString(), AddInfo.BankCard);
  105. if (returnInfo != "false")
  106. {
  107. imageItem = new ImageItem();
  108. imageItem.name = "bankCard";
  109. imageItem.value = returnInfo;
  110. imageList.Add(imageItem);
  111. }
  112. }
  113. }
  114. //身份证正面
  115. if (!string.IsNullOrEmpty(AddInfo.IdCardCopy))
  116. {
  117. var tokenInfo = JsonMapper.ToObject(HaoDaHelper.Instance.GetToken(AddInfo.IdCardCopy.Substring(AddInfo.IdCardCopy.LastIndexOf("/")).Trim('/'), "0"));
  118. if (tokenInfo["code"].ToString() == "1")
  119. {
  120. var returnInfo = HaoDaHelper.Instance.ReturnFileName(tokenInfo["token"].ToString(), AddInfo.IdCardCopy);
  121. if (returnInfo != "false")
  122. {
  123. imageItem = new ImageItem();
  124. imageItem.name = "idCardFront";
  125. imageItem.value = returnInfo;
  126. imageList.Add(imageItem);
  127. }
  128. }
  129. }
  130. //身份证反面
  131. if (!string.IsNullOrEmpty(AddInfo.IdCardNational))
  132. {
  133. var tokenInfo = JsonMapper.ToObject(HaoDaHelper.Instance.GetToken(AddInfo.IdCardNational.Substring(AddInfo.IdCardNational.LastIndexOf("/")).Trim('/'), "0"));
  134. if (tokenInfo["code"].ToString() == "1")
  135. {
  136. var returnInfo = HaoDaHelper.Instance.ReturnFileName(tokenInfo["token"].ToString(), AddInfo.IdCardNational);
  137. if (returnInfo != "false")
  138. {
  139. imageItem = new ImageItem();
  140. imageItem.name = "idCardBack";
  141. imageItem.value = returnInfo;
  142. imageList.Add(imageItem);
  143. }
  144. }
  145. }
  146. //开户许可证(对公凭证)
  147. if (!string.IsNullOrEmpty(AddInfo.OpenAccountLicenses))
  148. {
  149. var tokenInfo = JsonMapper.ToObject(HaoDaHelper.Instance.GetToken(AddInfo.OpenAccountLicenses.Substring(AddInfo.OpenAccountLicenses.LastIndexOf("/")).Trim('/'), "0"));
  150. if (tokenInfo["code"].ToString() == "1")
  151. {
  152. var returnInfo = HaoDaHelper.Instance.ReturnFileName(tokenInfo["token"].ToString(), AddInfo.OpenAccountLicenses);
  153. if (returnInfo != "false")
  154. {
  155. imageItem = new ImageItem();
  156. imageItem.name = "openAccountLicenses";
  157. imageItem.value = returnInfo;
  158. imageList.Add(imageItem);
  159. }
  160. }
  161. }
  162. // //租赁协议
  163. // if (!string.IsNullOrEmpty(AddInfo.RentAgreement))
  164. // {
  165. // imageItem = new ImageItem();
  166. // imageItem.name = "rentAgreement";
  167. // imageItem.value = AddInfo.RentAgreement;
  168. // imageList.Add(imageItem);
  169. // }
  170. // //盒伙人商户合影
  171. // if (!string.IsNullOrEmpty(AddInfo.OperatorMcht))
  172. // {
  173. // imageItem = new ImageItem();
  174. // imageItem.name = "operatorMcht";
  175. // imageItem.value = AddInfo.OperatorMcht;
  176. // imageList.Add(imageItem);
  177. // }
  178. //营业执照
  179. if (!string.IsNullOrEmpty(AddInfo.LicenseCopy))
  180. {
  181. var tokenInfo = JsonMapper.ToObject(HaoDaHelper.Instance.GetToken(AddInfo.LicenseCopy.Substring(AddInfo.LicenseCopy.LastIndexOf("/")).Trim('/'), "0"));
  182. if (tokenInfo["code"].ToString() == "1")
  183. {
  184. var returnInfo = HaoDaHelper.Instance.ReturnFileName(tokenInfo["token"].ToString(), AddInfo.LicenseCopy);
  185. if (returnInfo != "false")
  186. {
  187. imageItem = new ImageItem();
  188. imageItem.name = "license";
  189. imageItem.value = returnInfo;
  190. imageList.Add(imageItem);
  191. }
  192. }
  193. }
  194. // if (true)
  195. // {
  196. // //委托结算协议
  197. // if (!string.IsNullOrEmpty(AddInfo.AgentProtocol))
  198. // {
  199. // imageItem = new ImageItem();
  200. // imageItem.name = "agentProtocol";
  201. // imageItem.value = AddInfo.AgentProtocol;
  202. // imageList.Add(imageItem);
  203. // }
  204. // //法人手持委托结算协议
  205. // if (!string.IsNullOrEmpty(AddInfo.HoldAgentProtocol))
  206. // {
  207. // imageItem = new ImageItem();
  208. // imageItem.name = "holdAgentProtocol";
  209. // imageItem.value = AddInfo.HoldAgentProtocol;
  210. // imageList.Add(imageItem);
  211. // }
  212. // //被委托人手持身份证
  213. // if (!string.IsNullOrEmpty(AddInfo.AgentCardIdPicture))
  214. // {
  215. // imageItem = new ImageItem();
  216. // imageItem.name = "agentCardIdPicture";
  217. // imageItem.value = AddInfo.AgentCardIdPicture;
  218. // imageList.Add(imageItem);
  219. // }
  220. // //被委托人身份证正面
  221. // if (!string.IsNullOrEmpty(AddInfo.AgentIdCardFront))
  222. // {
  223. // imageItem = new ImageItem();
  224. // imageItem.name = "agentIdCardFront";
  225. // imageItem.value = AddInfo.AgentIdCardFront;
  226. // imageList.Add(imageItem);
  227. // }
  228. // //被委托人身份证反面
  229. // if (!string.IsNullOrEmpty(AddInfo.AgentIdCardBack))
  230. // {
  231. // imageItem = new ImageItem();
  232. // imageItem.name = "agentIdCardBack";
  233. // imageItem.value = AddInfo.AgentIdCardBack;
  234. // imageList.Add(imageItem);
  235. // }
  236. // }
  237. // //商户签名图片
  238. // if (!string.IsNullOrEmpty(AddInfo.SignaturePicture))
  239. // {
  240. // imageItem = new ImageItem();
  241. // imageItem.name = "signaturePicture";
  242. // imageItem.value = AddInfo.SignaturePicture;
  243. // imageList.Add(imageItem);
  244. // }
  245. // //辅助照片
  246. // if (!string.IsNullOrEmpty(AddInfo.Support))
  247. // {
  248. // imageItem = new ImageItem();
  249. // imageItem.name = "support";
  250. // imageItem.value = AddInfo.Support;
  251. // imageList.Add(imageItem);
  252. // }
  253. //门头照
  254. if (!string.IsNullOrEmpty(AddInfo.StoreEntrancePic))
  255. {
  256. var tokenInfo = JsonMapper.ToObject(HaoDaHelper.Instance.GetToken(AddInfo.StoreEntrancePic.Substring(AddInfo.StoreEntrancePic.LastIndexOf("/")).Trim('/'), "0"));
  257. if (tokenInfo["code"].ToString() == "1")
  258. {
  259. var returnInfo = HaoDaHelper.Instance.ReturnFileName(tokenInfo["token"].ToString(), AddInfo.StoreEntrancePic);
  260. if (returnInfo != "false")
  261. {
  262. imageItem = new ImageItem();
  263. imageItem.name = "shopFrontImg";
  264. imageItem.value = returnInfo;
  265. imageList.Add(imageItem);
  266. }
  267. }
  268. }
  269. //收银台
  270. if (!string.IsNullOrEmpty(AddInfo.CheckstandImg))
  271. {
  272. var tokenInfo = JsonMapper.ToObject(HaoDaHelper.Instance.GetToken(AddInfo.CheckstandImg.Substring(AddInfo.CheckstandImg.LastIndexOf("/")).Trim('/'), "0"));
  273. if (tokenInfo["code"].ToString() == "1")
  274. {
  275. var returnInfo = HaoDaHelper.Instance.ReturnFileName(tokenInfo["token"].ToString(), AddInfo.CheckstandImg);
  276. if (returnInfo != "false")
  277. {
  278. imageItem = new ImageItem();
  279. imageItem.name = "checkstandImg";
  280. imageItem.value = returnInfo;
  281. imageList.Add(imageItem);
  282. }
  283. }
  284. }
  285. //店铺全景
  286. if (!string.IsNullOrEmpty(AddInfo.IndoorPic))
  287. {
  288. var tokenInfo = JsonMapper.ToObject(HaoDaHelper.Instance.GetToken(AddInfo.IndoorPic.Substring(AddInfo.IndoorPic.LastIndexOf("/")).Trim('/'), "0"));
  289. if (tokenInfo["code"].ToString() == "1")
  290. {
  291. var returnInfo = HaoDaHelper.Instance.ReturnFileName(tokenInfo["token"].ToString(), AddInfo.IndoorPic);
  292. if (returnInfo != "false")
  293. {
  294. imageItem = new ImageItem();
  295. imageItem.name = "shopInnerImg";
  296. imageItem.value = returnInfo;
  297. imageList.Add(imageItem);
  298. }
  299. }
  300. }
  301. // //商品照片
  302. // if (!string.IsNullOrEmpty(AddInfo.ProductImg))
  303. // {
  304. // imageItem = new ImageItem();
  305. // imageItem.name = "productImg";
  306. // imageItem.value = AddInfo.ProductImg;
  307. // imageList.Add(imageItem);
  308. // }
  309. // //合同签名
  310. // if (!string.IsNullOrEmpty(AddInfo.Agreement))
  311. // {
  312. // imageItem = new ImageItem();
  313. // imageItem.name = "agreement";
  314. // imageItem.value = AddInfo.Agreement;
  315. // imageList.Add(imageItem);
  316. // }
  317. // //税务登记证
  318. // if (!string.IsNullOrEmpty(AddInfo.TaxImage))
  319. // {
  320. // imageItem = new ImageItem();
  321. // imageItem.name = "taxImage";
  322. // imageItem.value = AddInfo.TaxImage;
  323. // imageList.Add(imageItem);
  324. // }
  325. // //组织机构证照片
  326. // if (!string.IsNullOrEmpty(AddInfo.OrganizationCopy))
  327. // {
  328. // imageItem = new ImageItem();
  329. // imageItem.name = "orgImage";
  330. // imageItem.value = AddInfo.OrganizationCopy;
  331. // imageList.Add(imageItem);
  332. // }
  333. // //行业许可证
  334. // if (!string.IsNullOrEmpty(AddInfo.IndustryLicense1))
  335. // {
  336. // imageItem = new ImageItem();
  337. // imageItem.name = "industryLicense1";
  338. // imageItem.value = AddInfo.IndustryLicense1;
  339. // imageList.Add(imageItem);
  340. // }
  341. // //正面人像图片
  342. // if (!string.IsNullOrEmpty(AddInfo.FaceRecognition))
  343. // {
  344. // imageItem = new ImageItem();
  345. // imageItem.name = "faceRecognition";
  346. // imageItem.value = AddInfo.FaceRecognition;
  347. // imageList.Add(imageItem);
  348. // }
  349. //补充资料
  350. if (!string.IsNullOrEmpty(AddInfo.Extra1))
  351. {
  352. var tokenInfo = JsonMapper.ToObject(HaoDaHelper.Instance.GetToken(AddInfo.Extra1.Substring(AddInfo.Extra1.LastIndexOf("/")).Trim('/'), "0"));
  353. if (tokenInfo["code"].ToString() == "1")
  354. {
  355. var returnInfo = HaoDaHelper.Instance.ReturnFileName(tokenInfo["token"].ToString(), AddInfo.Extra1);
  356. if (returnInfo != "false")
  357. {
  358. imageItem = new ImageItem();
  359. imageItem.name = "extra1";
  360. imageItem.value = returnInfo;
  361. imageList.Add(imageItem);
  362. }
  363. }
  364. }
  365. addNewMerchant.images = imageList; //图片
  366. return addNewMerchant;
  367. }
  368. }
  369. }