AdminFlowController.Actions.cs 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Threading.Tasks;
  4. using Datory;
  5. using GxPress.Common.Tools;
  6. using GxPress.Entity.WorkFlow;
  7. using GxPress.Entity.WorkFlowDto;
  8. using GxPress.Entity.WorkProcessDto;
  9. using GxPress.EnumConst;
  10. using GxPress.Result;
  11. using Microsoft.AspNetCore.Authorization;
  12. using Microsoft.AspNetCore.Mvc;
  13. namespace GxPress.Api.AdminControllers
  14. {
  15. public partial class AdminFlowController
  16. {
  17. /// <summary>
  18. /// 动作 - 审批
  19. /// </summary>
  20. /// <param name="request">审批意见</param>
  21. /// <returns></returns>
  22. [HttpPost("action/check")]
  23. [AllowAnonymous]
  24. public async Task<DefaultResult> ActionsCheck([FromBody] CheckRequest request)
  25. {
  26. await _flowService.CheckAsync(request.TodoId, request.IsChecked, request.Message);
  27. return new DefaultResult
  28. {
  29. Value = true
  30. };
  31. }
  32. /// <summary>
  33. /// 动作 - 下载
  34. /// </summary>
  35. /// <param name="request">请求</param>
  36. /// <returns></returns>
  37. [HttpPost("action/download")]
  38. [AllowAnonymous]
  39. public async Task<DefaultStringResult> ActionsDownload([FromBody] ActionRequest request)
  40. {
  41. var url = await docService.MakeDoc(request.FlowId, _loginContext.AccountId);
  42. var result = new DownloadResult
  43. {
  44. DownloadUrl = StringUtils.AddDomain(url),
  45. PreviewUrl = StringUtils.GetPreviewDocUrl(url)
  46. };
  47. return new DefaultStringResult
  48. {
  49. Value = result.DownloadUrl
  50. };
  51. }
  52. /// <summary>
  53. /// 动作 - 催办
  54. /// </summary>
  55. /// <param name="request">请求</param>
  56. /// <returns></returns>
  57. [HttpPost("action/remind")]
  58. [AllowAnonymous]
  59. public DefaultResult ActionsRemind([FromBody] ActionRequest request)
  60. {
  61. return new DefaultResult
  62. {
  63. Value = true
  64. };
  65. }
  66. /// <summary>
  67. /// 动作 - 上会
  68. /// </summary>
  69. /// <param name="request">请求</param>
  70. /// <returns></returns>
  71. [HttpPost("action/meeting")]
  72. [AllowAnonymous]
  73. public async Task<DefaultResult> ActionsMeeting([FromBody] ActionRequest request)
  74. {
  75. //await _flowRepository.UpdateStateAsync(request.FlowId, nameof(FlowState.Meeting));
  76. await _flowTodoRepository.UpdateAsync(Q.Where(nameof(Entity.WorkFlow.FlowTodo.FlowId), request.FlowId).Where(nameof(Entity.WorkFlow.FlowTodo.UserId), _loginContext.AccountId).Set(nameof(Entity.WorkFlow.FlowTodo.IsDone), true).Set(nameof(Entity.WorkFlow.FlowTodo.DoneType), 3));
  77. return new DefaultResult
  78. {
  79. Value = true
  80. };
  81. }
  82. }
  83. }