MerchantParamSetRecordController.cs 3.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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.Main1;
  11. using MySystem.Service.Main1;
  12. using LitJson;
  13. using Library;
  14. namespace MySystem.Areas.Api.Controllers.v1.Main1
  15. {
  16. [Area("Api")]
  17. [Route("/v1/QrCodePlateMain/[controller]/[action]")]
  18. public class MerchantParamSetRecordController : BaseController
  19. {
  20. public MerchantParamSetRecordController(IHttpContextAccessor accessor) : base(accessor)
  21. {
  22. }
  23. #region 商户管理-商户管理-直连商户活动变更记录
  24. [Authorize]
  25. public JsonResult DirectMerchantParamSetRecordList(string value)
  26. {
  27. value = PublicFunction.DesDecrypt(value);
  28. JsonData data = JsonMapper.ToObject(value);
  29. List<Dictionary<string, object>> dataList = DirectMerchantParamSetRecordListDo(value);
  30. return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
  31. }
  32. private List<Dictionary<string, object>> DirectMerchantParamSetRecordListDo(string value)
  33. {
  34. JsonData data = JsonMapper.ToObject(value);
  35. string MerchantId = data["MerchantId"].ToString(); //商户Id
  36. int pageSize = int.Parse(function.CheckInt(data["page_size"].ToString()));
  37. int pageNum = int.Parse(function.CheckInt(data["page_num"].ToString()));
  38. string condition = "";
  39. List<RelationData> relationData = new List<RelationData>();
  40. List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
  41. List<Dictionary<string, object>> source = MerchantParamSetRecordService.List(relationData, condition, pageNum, pageSize);
  42. var merSet = MerchantParamSetService.Query(int.Parse(MerchantId));
  43. foreach (Dictionary<string, object> subdata in source)
  44. {
  45. Dictionary<string, object> curData = new Dictionary<string, object>();
  46. var Id = int.Parse(subdata["Id"].ToString()); //变更记录Id
  47. curData.Add("Id", Id); //变更记录Id
  48. var status = -1;
  49. if (merSet.Version == Id && merSet.IsAll == 0)
  50. {
  51. status = 1;
  52. }
  53. if (subdata["BeforeIsAll"].ToString() == "0" && subdata["AfterIsAll"].ToString() == "1")
  54. {
  55. status = 0;
  56. }
  57. if (merSet.Version != Id && subdata["BeforeIsAll"].ToString() == "0" && subdata["AfterIsAll"].ToString() == "0")
  58. {
  59. status = -1;
  60. }
  61. curData.Add("Status", int.Parse(subdata["Status"].ToString())); //活动状态(1 使用中 -1 已失效 0 已关闭)
  62. curData.Add("MerchantName", MerchantAddInfoService.Query(int.Parse(subdata["MerchantId"].ToString())).CertMerchantName); //商户名称
  63. curData.Add("CreateDate", subdata["CreateDate"].ToString() == "" ? "" : DateTime.Parse(subdata["CreateDate"].ToString()).ToString("yyyy-MM-dd HH:mm:ss")); //最后操作时间
  64. curData.Add("GetPercent", subdata["AfterGetPercent"].ToString()); //实收比例
  65. curData.Add("DiviPersons", subdata["AfterDiviPersons"].ToString()); //分红人数
  66. curData.Add("ProfitDays", subdata["AfterProfitDays"].ToString()); //分红天数
  67. curData.Add("MinPayMoney", subdata["AfterMinPayMoney"].ToString()); //参与门槛
  68. curData.Add("DiviPercent", subdata["AfterDiviPercent"].ToString()); //最大分红比例
  69. dataList.Add(curData);
  70. }
  71. return dataList;
  72. }
  73. #endregion
  74. }
  75. }