CustomerAccountController.cs 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. using Microsoft.AspNetCore.Mvc;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Threading.Tasks;
  6. using XYY.Common.Standard;
  7. using XYY.Core.Standard.Mvc;
  8. using XYY.Model.Standard;
  9. using XYY.Model.Standard.Finance;
  10. using XYY.Service.Standard.Finance;
  11. namespace XYY.Api.Finance.Controllers
  12. {
  13. [Route("api/[controller]/[action]")]
  14. [ApiController]
  15. public class CustomerAccountController : ApiControllerBase
  16. {
  17. ICustomerAccountService _customerAccountService;
  18. public CustomerAccountController(ICustomerAccountService customerAccountService)
  19. {
  20. _customerAccountService = customerAccountService;
  21. }
  22. #region 流水
  23. [HttpPost]
  24. public async Task<IActionResult> QueryCustomerIncome(QueryModel query)
  25. {
  26. var data = await _customerAccountService.QueryCustomerIncome(query);
  27. return Ok(data);
  28. }
  29. [HttpPost]
  30. public async Task<IActionResult> DownloadData(QueryModel query)
  31. {
  32. var data = await _customerAccountService.OutCustomerIncome(query);
  33. return File(data, MimeMapping.MimeUtility.GetMimeMapping("1.xlsx"));
  34. }
  35. #endregion
  36. #region 账号管理
  37. /// <summary>
  38. /// 创建默认账号
  39. /// </summary>
  40. /// <param name="queryModel"></param>
  41. /// <returns></returns>
  42. public async Task<IActionResult> CreateDefault(AccountTypeEnum enumValue, int customerId)
  43. {
  44. if ((int)enumValue < 1) { return Error("请求数据异常,请重试"); }
  45. return Ok(await _customerAccountService.CreateDefault(enumValue, customerId));
  46. }
  47. public async Task<IActionResult> GetPager(QueryModel queryModel)
  48. {
  49. return Ok(await _customerAccountService.GetPager(queryModel));
  50. }
  51. public async Task<IActionResult> Update(Finance_Customer_Account account)
  52. {
  53. await _customerAccountService.Update(account);
  54. return Ok();
  55. }
  56. public async Task<IActionResult> GetLogs(int Id)
  57. {
  58. return Ok(await _customerAccountService.GetLogs(Id));
  59. }
  60. #endregion
  61. #region 授信相关
  62. /// <summary>
  63. /// 申请授信额度
  64. /// </summary>
  65. /// <param name="model"></param>
  66. /// <returns></returns>
  67. public async Task<IActionResult> SubmitCustomerAccountQuota(Finance_Customer_Account_ApplyRecord model)
  68. {
  69. var json = await _customerAccountService.AddAccountQuotaApply(model);
  70. return Ok(json.error ?? json.message);
  71. }
  72. //测试Api
  73. public async Task<IActionResult> DingTalkStartProcessEvent(string code)
  74. {
  75. string msg = await _customerAccountService.DingTalkStartProcessEvent(code);
  76. return Ok(msg);
  77. }
  78. public async Task<IActionResult> GetAccountQuotaPager(QueryModel queryModel)
  79. {
  80. return Ok(await _customerAccountService.GetAccountQuotaPager(queryModel));
  81. }
  82. public async Task<IActionResult> ApplySubmit(ApplySubmitRequest model)
  83. {
  84. if (model.applyStatu < 1) { return Error("数据请求异常,请重试"); }
  85. await _customerAccountService.ApplySubmit(model);
  86. return Ok();
  87. }
  88. /// <summary>
  89. /// 授信到期还原
  90. /// </summary>
  91. /// <param name="startTime">大于等于</param>
  92. /// <param name="endTime">小于</param>
  93. /// <returns></returns>
  94. public async Task<IActionResult> QuotaReduction(DateTime startTime, DateTime endTime)
  95. {
  96. ApiJsonModel json = await _customerAccountService.QuotaReduction(startTime, endTime);
  97. return Ok(json.error ?? json.message);
  98. }
  99. #endregion
  100. }
  101. }