GroupsController.cs 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. using Microsoft.AspNetCore.Mvc;
  2. using Newtonsoft.Json.Serialization;
  3. using OASystem.Domain.Dtos.Groups;
  4. using OASystem.Domain.ViewModels.Groups;
  5. using OASystem.Infrastructure.Repositories.Groups;
  6. namespace OASystem.API.Controllers
  7. {
  8. /// <summary>
  9. /// 团组相关
  10. /// </summary>
  11. //[Authorize]
  12. [Route("api/[controller]/[action]")]
  13. public class GroupsController : ControllerBase
  14. {
  15. private readonly GrpScheduleRepository _grpScheduleRep;
  16. private readonly IMapper _mapper;
  17. private readonly DelegationInfoRepository _groupRepository;
  18. public GroupsController(IMapper mapper, GrpScheduleRepository grpScheduleRep, DelegationInfoRepository groupRepository)
  19. {
  20. _mapper = mapper;
  21. _grpScheduleRep = grpScheduleRep;
  22. _groupRepository = groupRepository;
  23. }
  24. #region 流程管控
  25. /// <summary>
  26. /// 获取团组流程管控信息
  27. /// </summary>
  28. /// <param name="paras">参数Json字符串</param>
  29. /// <returns></returns>
  30. [HttpPost]
  31. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  32. public async Task<IActionResult> PostGrpSchedule(string paras)
  33. {
  34. if (string.IsNullOrEmpty(paras))
  35. {
  36. return Ok(JsonView(false, "参数为空"));
  37. }
  38. Grp_ScheduleDto _ScheduleDto = JsonConvert.DeserializeObject<Grp_ScheduleDto>(paras);
  39. if (_ScheduleDto != null)
  40. {
  41. if (_ScheduleDto.SearchType == 2)//获取列表
  42. {
  43. }
  44. else//获取对象
  45. {
  46. Grp_ScheduleView _grpScheduleView = await _grpScheduleRep.GetView_GrpSchedule(_ScheduleDto);
  47. if (_grpScheduleView != null)
  48. {
  49. return Ok(JsonView(0, "获取成功", _grpScheduleView));
  50. }
  51. }
  52. }
  53. else
  54. {
  55. return Ok(JsonView(false, "参数反序列化失败"));
  56. }
  57. return Ok(JsonView(false, "暂无数据!"));
  58. }
  59. #endregion
  60. #region 团组基本信息
  61. /// <summary>
  62. /// 接团信息列表
  63. /// </summary>
  64. /// <param name="dto">团组列表请求dto</param>
  65. /// <returns></returns>
  66. [HttpPost]
  67. public async Task<IActionResult> GetGroupList(GroupListDto dto)
  68. {
  69. var groupData = await _groupRepository.GetGroupList(dto);
  70. if (groupData.Code != 0)
  71. {
  72. return Ok(JsonView(false, groupData.Msg));
  73. }
  74. return Ok(JsonView(groupData.Data));
  75. }
  76. /// <summary>
  77. /// 接团信息详情
  78. /// </summary>
  79. /// <param name="dto">团组info请求dto</param>
  80. /// <returns></returns>
  81. [HttpPost]
  82. public async Task<IActionResult> GetGroupInfo(GroupInfoDto dto)
  83. {
  84. var groupData = await _groupRepository.GetGroupInfo(dto);
  85. if (groupData.Code != 0)
  86. {
  87. return Ok(JsonView(false, groupData.Msg));
  88. }
  89. return Ok(JsonView(groupData.Data));
  90. }
  91. /// <summary>
  92. /// 接团信息 编辑添加
  93. /// 基础信息数据源
  94. /// </summary>
  95. /// <param name="dto"></param>
  96. /// <returns></returns>
  97. [HttpPost]
  98. public async Task<IActionResult> GroupEditBasicSource(GroupListDto dto)
  99. {
  100. var groupData = await _groupRepository.GroupEditBasicSource(dto);
  101. if (groupData.Code != 0)
  102. {
  103. return Ok(JsonView(false, groupData.Msg));
  104. }
  105. return Ok(JsonView(groupData.Data));
  106. }
  107. /// <summary>
  108. /// 接团信息 操作(增删改)
  109. /// </summary>
  110. /// <param name="dto"></param>
  111. /// <returns></returns>
  112. [HttpPost]
  113. public async Task<IActionResult> GroupOperation(GroupOperationDto dto)
  114. {
  115. var groupData = await _groupRepository.GroupOperation(dto);
  116. if (groupData.Code != 0)
  117. {
  118. return Ok(JsonView(false, groupData.Msg));
  119. }
  120. return Ok(JsonView(true));
  121. }
  122. /// <summary>
  123. /// 获取团组销售报价号
  124. /// 团组添加时 使用
  125. /// </summary>
  126. /// <returns></returns>
  127. [HttpPost]
  128. public async Task<IActionResult> GetGroupSalesQuoteNo()
  129. {
  130. var groupData = await _groupRepository.GetGroupSalesQuoteNo();
  131. if (groupData.Code != 0)
  132. {
  133. return Ok(JsonView(false, groupData.Msg));
  134. }
  135. return Ok(JsonView(true, groupData.Data));
  136. }
  137. #endregion
  138. }
  139. }