MarketCustomerResourcesController.cs 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. using Microsoft.AspNetCore.Mvc;
  2. using OASystem.Domain.Dtos.CRM;
  3. using OASystem.Infrastructure.Repositories.CRM;
  4. using static OASystem.Domain.Dtos.CRM.NewClientDataQueryDto;
  5. namespace OASystem.API.Controllers
  6. {
  7. [Route("api/[controller]/[action]")]
  8. public class MarketCustomerResourcesController : ControllerBase
  9. {
  10. private readonly NewClientDataRepository _clientDataRepository;
  11. /// <summary>
  12. /// 初始化
  13. /// </summary>
  14. public MarketCustomerResourcesController(NewClientDataRepository clientDataRepository)
  15. {
  16. this._clientDataRepository = clientDataRepository;
  17. }
  18. /// <summary>
  19. /// 查询客户资料数据
  20. /// </summary>
  21. /// <returns></returns>
  22. [HttpPost]
  23. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  24. public async Task<IActionResult> QueryNewClientData(NewClientDataQueryDto dto)
  25. {
  26. try
  27. {
  28. Result resTable = await _clientDataRepository.QueryNewClientData(dto);
  29. //Result resSelect = await _clientDataRepository.NewClientSelectData();
  30. return Ok(JsonView(true, resTable.Msg, resTable));
  31. }
  32. catch (Exception)
  33. {
  34. return Ok(JsonView(false, "程序错误!"));
  35. throw;
  36. }
  37. }
  38. /// <summary>
  39. /// 客户资料操作(Status:1.新增,2.修改)
  40. /// </summary>
  41. /// <param name="dto"></param>
  42. /// <returns></returns>
  43. [HttpPost]
  44. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  45. public async Task<IActionResult> NewClientOp(NewClientOpDto dto)
  46. {
  47. try
  48. {
  49. Domain.Result result = await _clientDataRepository.NewClientOp(dto);
  50. if (result.Code != 0)
  51. {
  52. return Ok(JsonView(false, result.Msg));
  53. }
  54. return Ok(JsonView(true, result.Msg));
  55. }
  56. catch (Exception)
  57. {
  58. return Ok(JsonView(false, "程序错误!"));
  59. throw;
  60. }
  61. }
  62. [HttpPost]
  63. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  64. public async Task<IActionResult> QueryUserSelect()
  65. {
  66. try
  67. {
  68. Result resTable = await _clientDataRepository.QueryUserSelect();
  69. return Ok(JsonView(true, resTable.Msg, resTable));
  70. }
  71. catch (Exception)
  72. {
  73. return Ok(JsonView(false, "程序错误!"));
  74. throw;
  75. }
  76. }
  77. }
  78. }