MerchantDepositOrderController.cs 4.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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 MerchantDepositOrderController : BaseController
  19. {
  20. public MerchantDepositOrderController(IHttpContextAccessor accessor) : base(accessor)
  21. {
  22. }
  23. #region 商户激活-银联激活商户记录
  24. [Authorize]
  25. public JsonResult UnionPayActRecord(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 = UnionPayActRecordDo(value, out Other);
  31. return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList, Other = Other });
  32. }
  33. private List<Dictionary<string, object>> UnionPayActRecordDo(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. string UpdateDate = data["UpdateDate"].ToString(); //激活时间
  39. string PayMode = data["PayMode"].ToString(); //支付方式(1 支付宝 2 微信)
  40. int pageSize = int.Parse(function.CheckInt(data["page_size"].ToString()));
  41. int pageNum = int.Parse(function.CheckInt(data["page_num"].ToString()));
  42. string condition = "";
  43. if (!string.IsNullOrEmpty(MerchantName))
  44. {
  45. var query = MerchantAddInfoService.Query(" and CertMerchantName='" + MerchantName + "'");
  46. condition += " and MerchantId='" + query.Id + "'";
  47. }
  48. if (!string.IsNullOrEmpty(MctNo))
  49. {
  50. var query = MerchantAddInfoService.Query(" and MchtNo='" + MctNo + "'");
  51. condition += " and MerchantId='" + query.Id + "'";
  52. }
  53. if (!string.IsNullOrEmpty(data["UpdateDate"].ToString()))
  54. {
  55. string[] datelist = UpdateDate.Split(new string[] { " - " }, StringSplitOptions.None);
  56. string start = datelist[0];
  57. string end = datelist[1];
  58. condition += " and UpdateDate>='" + start + " 00:00:00' and UpdateDate<='" + end + " 23:59:59'";
  59. }
  60. if (!string.IsNullOrEmpty(data["PayMode"].ToString()))
  61. {
  62. condition += " and Sort='" + PayMode + "'";
  63. }
  64. List<RelationData> relationData = new List<RelationData>();
  65. List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
  66. Other = new Dictionary<string, object>();
  67. int count = 0;
  68. List<Dictionary<string, object>> source = MerchantDepositOrderService.List(relationData, condition, out count, pageNum, pageSize);
  69. foreach (Dictionary<string, object> subdata in source)
  70. {
  71. Dictionary<string, object> curData = new Dictionary<string, object>();
  72. var query = MerchantAddInfoService.Query(int.Parse(subdata["MerchantId"].ToString()));
  73. curData.Add("Id", subdata["Id"].ToString()); //Id
  74. curData.Add("MerchantName", query.CertMerchantName); //商户名称
  75. curData.Add("MctNo", subdata["MchtNo"].ToString()); //商户号
  76. curData.Add("UpdateDate", subdata["UpdateDate"].ToString() == "" ? "" : DateTime.Parse(subdata["UpdateDate"].ToString()).ToString("yyyy-MM-dd HH:mm:ss")); //激活时间
  77. curData.Add("PayMode", int.Parse(subdata["Sort"].ToString())); //支付方式(1 支付宝 2 微信)
  78. curData.Add("ActPayPrice", decimal.Parse(subdata["ActPayPrice"].ToString())); //支付金额
  79. dataList.Add(curData);
  80. }
  81. return dataList;
  82. }
  83. #endregion
  84. }
  85. }