MerchantInfoController.cs 4.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using Microsoft.AspNetCore.Mvc;
  5. using Microsoft.AspNetCore.Http;
  6. using Microsoft.Extensions.Logging;
  7. using Microsoft.Extensions.Options;
  8. using Microsoft.AspNetCore.Authorization;
  9. using System.Web;
  10. using MySystem.Models.Main2;
  11. using MySystem.Service.Main2;
  12. using LitJson;
  13. using Library;
  14. namespace MySystem.Areas.Api.Controllers.v1.Main2
  15. {
  16. [Area("Api")]
  17. [Route("/v1/QrCodePlateMain/[controller]/[action]")]
  18. public class MerchantInfoController : BaseController
  19. {
  20. public MerchantInfoController(IHttpContextAccessor accessor) : base(accessor)
  21. {
  22. }
  23. #region 商户激活-银联达标商户列表
  24. [Authorize]
  25. public JsonResult UnionPayQualifiedMerchants(string value)
  26. {
  27. value = PublicFunction.DesDecrypt(value);
  28. JsonData data = JsonMapper.ToObject(value);
  29. Dictionary<string, object> Other = new Dictionary<string, object>();
  30. List<Dictionary<string, object>> dataList = UnionPayQualifiedMerchantsDo(value, out Other);
  31. return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList, Other = Other });
  32. }
  33. private List<Dictionary<string, object>> UnionPayQualifiedMerchantsDo(string value, out Dictionary<string, object> Other)
  34. {
  35. JsonData data = JsonMapper.ToObject(value);
  36. string MerchantName = data["MerchantName"].ToString(); //商户名称
  37. string MctNo = data["MctNo"].ToString(); //商户号
  38. int pageSize = int.Parse(function.CheckInt(data["page_size"].ToString()));
  39. int pageNum = int.Parse(function.CheckInt(data["page_num"].ToString()));
  40. string condition = " and IsAct=1 and ExamineStatus=1 and Months=10";
  41. if (!string.IsNullOrEmpty(MerchantName))
  42. {
  43. condition += " and Name like '%" + MerchantName + "%'";
  44. }
  45. if (!string.IsNullOrEmpty(MctNo))
  46. {
  47. var merAddInfo = MerchantAddInfoService.Query(" and MchtNo=" + MctNo + "");
  48. condition += " and Id=" + merAddInfo.Id + "";
  49. }
  50. List<RelationData> relationData = new List<RelationData>();
  51. List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
  52. Other = new Dictionary<string, object>();
  53. int count = 0;
  54. List<Dictionary<string, object>> source = MerchantInfoService.List(relationData, condition, out count, pageNum, pageSize);
  55. foreach (Dictionary<string, object> subdata in source)
  56. {
  57. Dictionary<string, object> curData = new Dictionary<string, object>();
  58. var MerchantId = int.Parse(subdata["Id"].ToString());
  59. var merAddInfo = MerchantAddInfoService.Query(MerchantId);
  60. var Status = -1;
  61. var order = MerchantDepositOrderService.Query(" and Status>0 and MerchantId=" + MerchantId + "");
  62. if (order.Id > 0) Status = int.Parse(subdata["Status"].ToString());
  63. curData.Add("Id", MerchantId); //Id
  64. curData.Add("MerchantName", merAddInfo.CertMerchantName); //商户名称
  65. curData.Add("MctNo", merAddInfo.MchtNo); //商户号
  66. curData.Add("UpdateDate", order.UpdateDate.ToString() == null ? "" : DateTime.Parse(order.UpdateDate.ToString()).ToString("yyyy-MM-dd HH:mm:ss")); //激活时间
  67. curData.Add("PayMode", order.Sort); //支付方式(1 支付宝 2 微信)
  68. curData.Add("Status", Status); //达标状态(-1 未参与 0 考核中 1 已通过 2 未通过 101 待领取 100 已领取 99 发放中)
  69. curData.Add("Months", subdata["Months"].ToString()); //达标月数
  70. dataList.Add(curData);
  71. }
  72. Other.Add("Count", count); //总数
  73. return dataList;
  74. }
  75. #endregion
  76. }
  77. }