AddNewMerchantSetUtil.cs 20 KB

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