获取流程运行实例的内容api变更

usertest
嵇文龙 5 months ago
parent 744d256cc0
commit ac49b8f7c4

@ -69,5 +69,10 @@ public interface IClientFlowInstanceService
/// <returns></returns>
DataResult<List<FlowInstanceHistoryRes>> GetFlowInstanceHistoryList(string id);
DataResult<FlowInstanceRes> GetFlowInstance(long businessId, BusinessType? businessType, string type);
/// <summary>
/// 工作流审批
/// </summary>
/// <param name="info">工作流实例</param>
/// <returns></returns>
DataResult<List<FlowInstanceRes>> GetFlowInstances(long businessId, BusinessType? businessType);
}

@ -72,21 +72,25 @@ public class ClientFlowInstanceService : FlowInstanceService, IClientFlowInstanc
}
/// <summary>
/// 获取指定类型的工作流实例
/// »ñÈ¡¹¤×÷Á÷ʵÀýÐÅÏ¢
/// </summary>
/// <param name="businessId">业务ID</param>
/// <param name="businessType">业务类型</param>
/// <param name="type">模板类型</param>
/// <returns></returns>
public DataResult<FlowInstanceRes> GetFlowInstance(long businessId, BusinessType? businessType, string type)
public DataResult<List<FlowInstanceRes>> GetFlowInstances(long businessId, BusinessType? businessType)
{
var query = db.Queryable<FlowInstance>().Where(x => x.BusinessId == businessId && x.BusinessType == businessType && x.AuditType == type);
var query = db.Queryable<FlowInstance>().Where(x => x.BusinessId == businessId && x.BusinessType == businessType && x.FlowStatus != 1);
if (businessType.HasValue)
query = query.Where(x => x.BusinessType == businessType.Value);
var entity = query.OrderByDescending(x => x.CreateTime).Take(1).First();
var result = entity == null ? null : entity.Adapt<FlowInstanceRes>();
return DataResult<FlowInstanceRes>.Success(result);
var list = query.OrderBy(x => x.CreateTime).Select(x => new FlowInstance
{
Content = x.Content,
AuditType = x.AuditType,
CreateBy = x.CreateBy,
CreateTime = x.CreateTime
}).ToList();
return DataResult<List<FlowInstanceRes>>.Success(list.Select(x => x.Adapt<FlowInstanceRes>()).ToList());
}
/// <summary>

@ -122,10 +122,9 @@ public class ClientFlowInstanceController : ApiController
/// <param name="type">流程类型</param>
/// <returns></returns>
[HttpGet, Route("GetFlowContent")]
public DataResult<string> GetFlowContent([FromQuery] long businessId, [FromQuery] BusinessType? businessType, [FromQuery] AuditType type)
public DataResult<List<FlowInstanceRes>> GetFlowContent([FromQuery] long businessId, [FromQuery] BusinessType? businessType)
{
var res = _invokeService.GetFlowInstance(businessId, businessType, type.ToString());
string? content = res.Data?.Content;
return DataResult<string>.Success(content ?? string.Empty);
var result = _invokeService.GetFlowInstances(businessId, businessType);
return result;
}
}
Loading…
Cancel
Save