AddNewMerchantSetUtil.cs 19 KB

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