using Learun.Application.Base.AuthorizeModule;
using Learun.Application.Form;
using Learun.Application.Organization;
using Learun.Application.WorkFlow;
using Learun.Util;
using Nancy;
using System.Collections.Generic;
namespace Learun.Application.WebApi.Modules
{
public class WorkFlowApi : BaseApi
{
///
/// 注册接口
///
public WorkFlowApi()
: base("/learun/adms/workflow")
{
Get["/bootstraper"] = GetBootstraper;
Get["/taskinfo"] = Taskinfo;
Get["/processinfo"] = ProcessInfo;
Get["/scheme"] = GetScheme;
Get["/mylist"] = GetMyProcess;// 获取数据字典详细列表
Get["/mytask"] = GetMyTaskList;
Get["/mytaskmaked"] = GetMyMakeTaskList;
Get["/auditer"] = GetAuditer;
Post["/create"] = Create;
Post["/audit"] = Audit;
}
private UserRelationIBLL userRelationIBLL = new UserRelationBLL();
private UserIBLL userIBLL = new UserBLL();
private WfEngineIBLL wfEngineIBLL = new WfEngineBLL();
private WfProcessInstanceIBLL wfProcessInstanceIBLL = new WfProcessInstanceBLL();
private WfTaskIBLL wfTaskIBLL = new WfTaskBLL();
private WfSchemeIBLL wfSchemeIBLL = new WfSchemeBLL();
private FormSchemeIBLL formSchemeIBLL = new FormSchemeBLL();
///
/// 获取流程模板
///
///
///
private Response GetScheme(dynamic _)
{
QueryModel parameter = this.GetReqData();
IEnumerable list = new List();
list = wfSchemeIBLL.GetAppSchemeInfoPageList(parameter.pagination, this.userInfo, parameter.queryJson);
var jsonData = new
{
rows = list,
total = parameter.pagination.total,
page = parameter.pagination.page,
records = parameter.pagination.records,
};
return Success(jsonData);
}
///
/// 获取我的流程实例信息
///
///
///
private Response GetMyProcess(dynamic _)
{
QueryModel parameter = this.GetReqData();
IEnumerable list = new List();
list = wfProcessInstanceIBLL.GetMyPageList(this.userInfo.userId, parameter.pagination, parameter.queryJson);
var jsonData = new
{
rows = list,
total = parameter.pagination.total,
page = parameter.pagination.page,
records = parameter.pagination.records,
};
return Success(jsonData);
}
///
/// 获取我的任务列表
///
///
///
private Response GetMyTaskList(dynamic _)
{
QueryModel parameter = this.GetReqData();
IEnumerable list = new List();
list = wfTaskIBLL.GetActiveList(this.userInfo, parameter.pagination, parameter.queryJson);
var jsonData = new
{
rows = list,
total = parameter.pagination.total,
page = parameter.pagination.page,
records = parameter.pagination.records,
};
return Success(jsonData);
}
///
/// 获取我已处理的任务列表
///
///
///
private Response GetMyMakeTaskList(dynamic _)
{
QueryModel parameter = this.GetReqData();
IEnumerable list = new List();
list = wfTaskIBLL.GetHasList(this.userInfo.userId, parameter.pagination, parameter.queryJson);
var jsonData = new
{
rows = list,
total = parameter.pagination.total,
page = parameter.pagination.page,
records = parameter.pagination.records,
};
return Success(jsonData);
}
///
/// 初始化流程模板->获取开始节点数据
///
///
///
private Response GetBootstraper(dynamic _)
{
WfParameter wfParameter = this.GetReqData();
wfParameter.companyId = this.userInfo.companyId;
wfParameter.departmentId = this.userInfo.departmentId;
wfParameter.userId = this.userInfo.userId;
wfParameter.userName = this.userInfo.realName;
WfResult res = wfEngineIBLL.Bootstraper(wfParameter);
return this.Success>(res);
}
///
/// 获取流程实例信息
///
///
///
private Response ProcessInfo(dynamic _)
{
WfParameter wfParameter = this.GetReqData();
wfParameter.companyId = this.userInfo.companyId;
wfParameter.departmentId = this.userInfo.departmentId;
wfParameter.userId = this.userInfo.userId;
wfParameter.userName = this.userInfo.realName;
WfResult res = wfEngineIBLL.GetProcessInfo(wfParameter);
return this.Success>(res);
}
///
/// 获取流程审核节点的信息
///
///
///
private Response Taskinfo(dynamic _)
{
WfParameter wfParameter = this.GetReqData();
wfParameter.companyId = this.userInfo.companyId;
wfParameter.departmentId = this.userInfo.departmentId;
wfParameter.userId = this.userInfo.userId;
wfParameter.userName = this.userInfo.realName;
WfResult res = wfEngineIBLL.GetTaskInfo(wfParameter);
return this.Success>(res);
}
///
/// 获取下一个节点审核人员
///
///
///
private Response GetAuditer(dynamic _) {
WfParameter wfParameter = this.GetReqData();
wfParameter.companyId = this.userInfo.companyId;
wfParameter.departmentId = this.userInfo.departmentId;
wfParameter.userId = this.userInfo.userId;
wfParameter.userName = this.userInfo.realName;
WfResult> res = wfEngineIBLL.GetAuditer(wfParameter);
List