using System.Collections.Generic; using System.Threading.Tasks; using AutoMapper; using GxPress.Entity.WorkProcess; using GxPress.Entity.WorkProcessDto; using GxPress.Repository.Interface.WorkProcess; using GxPress.Service.Interface; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; namespace GxPress.Api.AdminControllers { /// /// 审批流程 /// [Route("api/admin/process")] [ApiController] [Authorize] public partial class AdminProcessController : ControllerBase { private readonly IProcessRepository _processRepository; private readonly IProcessService _processService; public AdminProcessController(IProcessRepository processRepository, IProcessService processService) { _processRepository = processRepository; _processService = processService; } /// /// 获取流程定义 /// /// /// [HttpGet("{id}")] [AllowAnonymous] public async Task Get(int id) { return await _processService.GetAsync(id); } /// /// 添加流程定义 /// /// /// [HttpPost] [AllowAnonymous] public async Task Add([FromBody] ProcessDto request) { return await _processService.AddAsync(request); } /// /// 编辑流程定义 /// /// 流程Id /// /// [HttpPost("{id}")] [AllowAnonymous] public async Task Edit([FromRoute] int id, [FromBody] ProcessDto request) { request.Id = id; return await _processService.EditAsync(request); } //获取流程定义,分步获取 ///// ///// 获取流程基本设置 ///// ///// ///// //[HttpGet("baseInfo")] //public async Task GetBaseInfo(int id) //{ // return await _processRepository.GetBaseInfoAsync(id); //} ///// ///// 获取流程表单设置 ///// ///// ///// //[HttpGet("form")] //public async Task> GetFormSetting(int id) //{ // return await _processRepository.GetFormSettingAsync(id); //} ///// ///// 获取流程节点树 ///// ///// ///// //[HttpGet("nodeTree")] //public async Task GetNodeTree(int id) //{ // return await _processRepository.GetNodeTreeAsync(id); //} /// /// 列表 /// /// [HttpGet("")] [AllowAnonymous] public async Task> GetList([FromQuery] string keyword) { return await _processRepository.GetListAsync(keyword); } /// /// 删除流程 /// /// /// [HttpDelete("{id}")] public async Task Delete(int id) { return await _processRepository.DeleteAsync(id); } /// /// 复制流程 /// /// /// [HttpPost("actions/clone")] public async Task Clone([FromBody] CloneRequest request) { var process = await _processService.GetAsync(request.ProcessId); process.Name = request.Name; return await _processService.AddAsync(process); } } }