GroupsController.cs 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  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. try
  116. {
  117. var groupData = await _groupRepository.GroupOperation(dto);
  118. if (groupData.Code != 0)
  119. {
  120. return Ok(JsonView(false, groupData.Msg));
  121. }
  122. return Ok(JsonView(true));
  123. }
  124. catch (Exception ex)
  125. {
  126. Logs("[response]" + JsonConvert.SerializeObject( dto));
  127. Logs(ex.Message);
  128. return Ok(JsonView(false, ex.Message));
  129. }
  130. }
  131. /// <summary>
  132. /// 接团信息 操作(删除)
  133. /// </summary>
  134. /// <param name="dto"></param>
  135. /// <returns></returns>
  136. [HttpPost]
  137. public async Task<IActionResult> GroupDel(GroupDelDto dto)
  138. {
  139. try
  140. {
  141. var groupData = await _groupRepository.GroupDel(dto);
  142. if (groupData.Code != 0)
  143. {
  144. return Ok(JsonView(false, groupData.Msg));
  145. }
  146. return Ok(JsonView(true));
  147. }
  148. catch (Exception ex)
  149. {
  150. Logs("[response]" + JsonConvert.SerializeObject(dto));
  151. Logs(ex.Message);
  152. return Ok(JsonView(false, ex.Message));
  153. }
  154. }
  155. /// <summary>
  156. /// 获取团组销售报价号
  157. /// 团组添加时 使用
  158. /// </summary>
  159. /// <returns></returns>
  160. [HttpPost]
  161. public async Task<IActionResult> GetGroupSalesQuoteNo()
  162. {
  163. var groupData = await _groupRepository.GetGroupSalesQuoteNo();
  164. if (groupData.Code != 0)
  165. {
  166. return Ok(JsonView(false, groupData.Msg));
  167. }
  168. object salesQuoteNo = new
  169. {
  170. SalesQuoteNo = groupData.Data
  171. };
  172. return Ok(JsonView(salesQuoteNo));
  173. }
  174. #endregion
  175. }
  176. }