2017-02-06 19:11:21 +08:00
|
|
|
|
using Infrastructure;
|
2017-01-20 16:51:30 +08:00
|
|
|
|
using OpenAuth.App;
|
|
|
|
|
using OpenAuth.App.SSO;
|
|
|
|
|
using OpenAuth.Mvc.Controllers;
|
2017-02-06 19:11:21 +08:00
|
|
|
|
using System;
|
|
|
|
|
using System.Web.Mvc;
|
2017-11-29 20:49:14 +08:00
|
|
|
|
using OpenAuth.Repository.Domain;
|
2017-01-20 16:51:30 +08:00
|
|
|
|
|
|
|
|
|
namespace OpenAuth.Mvc.Areas.FlowManage.Controllers
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 通用申请流程处理
|
|
|
|
|
/// <para>李玉宝新增于2016-09-08 19:21:59</para>
|
|
|
|
|
/// </summary>
|
2017-01-24 16:04:17 +08:00
|
|
|
|
public class FlowInstancesController : BaseController
|
2017-01-20 16:51:30 +08:00
|
|
|
|
{
|
2017-03-24 15:35:52 +08:00
|
|
|
|
public WFProcessInstanceService App { get; set; }
|
2017-01-20 16:51:30 +08:00
|
|
|
|
|
2017-01-23 13:47:37 +08:00
|
|
|
|
#region 视图
|
|
|
|
|
|
2017-01-24 18:51:27 +08:00
|
|
|
|
public ActionResult Index()
|
2017-01-23 13:47:37 +08:00
|
|
|
|
{
|
|
|
|
|
return View();
|
|
|
|
|
}
|
2017-01-24 18:51:27 +08:00
|
|
|
|
|
2017-02-06 19:11:21 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// 进度查看
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpGet]
|
|
|
|
|
public ActionResult ProcessLookForm()
|
|
|
|
|
{
|
|
|
|
|
return View();
|
|
|
|
|
}
|
|
|
|
|
|
2017-01-24 18:51:27 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// 审核流程
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpGet]
|
|
|
|
|
public ActionResult VerificationForm()
|
2017-01-20 16:51:30 +08:00
|
|
|
|
{
|
|
|
|
|
return View();
|
|
|
|
|
}
|
|
|
|
|
|
2017-02-06 19:11:21 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// 创建流程实例视图
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpGet]
|
|
|
|
|
public ActionResult FlowProcessNewForm()
|
2017-01-20 16:51:30 +08:00
|
|
|
|
{
|
2017-02-06 19:11:21 +08:00
|
|
|
|
return View();
|
2017-01-20 16:51:30 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2017-02-06 19:11:21 +08:00
|
|
|
|
/// 流程监控
|
2017-01-20 16:51:30 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpGet]
|
2017-02-06 19:11:21 +08:00
|
|
|
|
public ActionResult MonitoringIndex()
|
2017-01-20 16:51:30 +08:00
|
|
|
|
{
|
|
|
|
|
return View();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2017-02-06 19:11:21 +08:00
|
|
|
|
/// 流程指派
|
2017-01-20 16:51:30 +08:00
|
|
|
|
/// </summary>
|
2017-02-06 19:11:21 +08:00
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpGet]
|
|
|
|
|
public ActionResult DesignationIndex()
|
2017-01-20 16:51:30 +08:00
|
|
|
|
{
|
2017-02-06 19:11:21 +08:00
|
|
|
|
return View();
|
|
|
|
|
}
|
2017-01-20 16:51:30 +08:00
|
|
|
|
|
2017-02-06 19:11:21 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// 流程进度查看
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>\
|
|
|
|
|
[HttpGet]
|
|
|
|
|
public ActionResult ProcessLookFrom()
|
|
|
|
|
{
|
|
|
|
|
return View();
|
2017-01-20 16:51:30 +08:00
|
|
|
|
}
|
|
|
|
|
|
2017-02-06 18:28:36 +08:00
|
|
|
|
/// <summary>
|
2017-02-06 19:11:21 +08:00
|
|
|
|
/// 流程指派
|
2017-02-06 18:28:36 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpGet]
|
2017-02-06 19:11:21 +08:00
|
|
|
|
public ActionResult ProcessDesignate()
|
2017-02-06 18:28:36 +08:00
|
|
|
|
{
|
|
|
|
|
return View();
|
|
|
|
|
}
|
|
|
|
|
|
2017-02-06 19:11:21 +08:00
|
|
|
|
#endregion 视图
|
2017-02-06 18:28:36 +08:00
|
|
|
|
|
|
|
|
|
#region 提交数据
|
2017-02-06 19:11:21 +08:00
|
|
|
|
|
2017-02-06 18:28:36 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// 创建流程实例
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="wfSchemeInfoId">流程模板信息Id</param>
|
|
|
|
|
/// <param name="frmData">表单数据</param>
|
|
|
|
|
/// <param name="type">0发起,3草稿</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost]
|
2017-10-11 16:19:34 +08:00
|
|
|
|
public string CreateProcess(string wfSchemeInfoId, string wfProcessInstanceJson, string frmData)
|
2017-02-06 18:28:36 +08:00
|
|
|
|
{
|
|
|
|
|
WFProcessInstance wfProcessInstanceEntity = wfProcessInstanceJson.ToObject<WFProcessInstance>();
|
2017-10-11 16:19:34 +08:00
|
|
|
|
wfProcessInstanceEntity.Id = string.Empty;
|
2017-03-10 00:09:33 +08:00
|
|
|
|
|
2017-10-11 16:19:34 +08:00
|
|
|
|
App.CreateInstance(Guid.NewGuid().ToString(), wfSchemeInfoId, wfProcessInstanceEntity, frmData);
|
2017-02-06 18:28:36 +08:00
|
|
|
|
|
2017-02-06 19:11:21 +08:00
|
|
|
|
return Result.ToJson();
|
2017-02-06 18:28:36 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2017-02-06 19:11:21 +08:00
|
|
|
|
/// 审核流程
|
2017-02-06 18:28:36 +08:00
|
|
|
|
/// </summary>
|
2017-02-06 19:11:21 +08:00
|
|
|
|
/// <param name="processId">工作流实例主键Id</param>
|
|
|
|
|
/// <param name="verificationData">审核数据</param>
|
2017-02-06 18:28:36 +08:00
|
|
|
|
/// <returns></returns>
|
2017-02-06 19:11:21 +08:00
|
|
|
|
[HttpPost]
|
2017-10-11 16:19:34 +08:00
|
|
|
|
public string VerificationProcess(string processId, string verificationData)
|
2017-02-06 18:28:36 +08:00
|
|
|
|
{
|
2017-03-24 15:35:52 +08:00
|
|
|
|
App.VerificationProcess(processId, verificationData);
|
2017-02-06 19:11:21 +08:00
|
|
|
|
return Result.ToJson();
|
2017-02-06 18:28:36 +08:00
|
|
|
|
}
|
2017-02-06 19:11:21 +08:00
|
|
|
|
|
2017-02-06 18:28:36 +08:00
|
|
|
|
/// <summary>
|
2017-02-06 19:11:21 +08:00
|
|
|
|
/// 删除申请
|
2017-02-06 18:28:36 +08:00
|
|
|
|
/// </summary>
|
2017-10-11 16:19:34 +08:00
|
|
|
|
public string Delete(string[] ids)
|
2017-02-06 18:28:36 +08:00
|
|
|
|
{
|
2017-02-06 19:11:21 +08:00
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
foreach (var id in ids)
|
|
|
|
|
{
|
2017-03-24 15:35:52 +08:00
|
|
|
|
App.DeleteProcess(id);
|
2017-02-06 19:11:21 +08:00
|
|
|
|
}
|
|
|
|
|
return Result.ToJson();
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
2017-11-28 23:54:49 +08:00
|
|
|
|
Result.Code = 500;
|
2017-02-06 19:11:21 +08:00
|
|
|
|
Result.Message = e.Message;
|
|
|
|
|
return Result.ToJson();
|
|
|
|
|
}
|
2017-02-06 18:28:36 +08:00
|
|
|
|
}
|
2017-02-06 19:11:21 +08:00
|
|
|
|
|
|
|
|
|
#endregion 提交数据
|
2017-02-06 18:28:36 +08:00
|
|
|
|
|
|
|
|
|
#region 获取数据(公用)
|
2017-01-20 16:51:30 +08:00
|
|
|
|
|
2017-02-06 18:28:36 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取进程模板Json
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="keyValue"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpGet]
|
2017-10-11 16:19:34 +08:00
|
|
|
|
public ActionResult GetProcessSchemeJson(string keyValue)
|
2017-02-06 18:28:36 +08:00
|
|
|
|
{
|
2017-03-24 15:35:52 +08:00
|
|
|
|
var data = App.GetProcessSchemeEntity(keyValue);
|
2017-02-06 18:28:36 +08:00
|
|
|
|
return Content(data.ToJson());
|
|
|
|
|
}
|
2017-02-06 19:11:21 +08:00
|
|
|
|
|
2017-02-06 18:28:36 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// 已办流程进度查看,根据当前访问人的权限查看表单内容
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="keyValue"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpGet]
|
2017-10-11 16:19:34 +08:00
|
|
|
|
public ActionResult GetProcessSchemeEntityByUserId(string keyValue)
|
2017-02-06 18:28:36 +08:00
|
|
|
|
{
|
2017-03-24 15:35:52 +08:00
|
|
|
|
var data = App.GetProcessSchemeByUserId(keyValue);
|
2017-02-06 18:28:36 +08:00
|
|
|
|
return Content(data.ToJson());
|
|
|
|
|
}
|
2017-02-06 19:11:21 +08:00
|
|
|
|
|
2017-02-06 18:28:36 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// 已办流程进度查看,根据当前节点的权限查看表单内容
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="keyValue"></param>
|
|
|
|
|
/// <param name="isPermission"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpGet]
|
2017-10-11 16:19:34 +08:00
|
|
|
|
public ActionResult GetProcessSchemeEntityByNodeId(string keyValue, string nodeId)
|
2017-02-06 18:28:36 +08:00
|
|
|
|
{
|
2017-03-24 15:35:52 +08:00
|
|
|
|
var data = App.GetProcessSchemeEntityByNodeId(keyValue, nodeId);
|
2017-02-06 18:28:36 +08:00
|
|
|
|
return Content(data.ToJson());
|
|
|
|
|
}
|
2017-02-06 19:11:21 +08:00
|
|
|
|
|
2017-02-06 18:28:36 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取进程信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="keyValue"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpGet]
|
2017-10-11 16:19:34 +08:00
|
|
|
|
public ActionResult GetProcessInfoJson(string keyValue)
|
2017-02-06 18:28:36 +08:00
|
|
|
|
{
|
2017-03-24 15:35:52 +08:00
|
|
|
|
var processInstance = App.GetProcessInstanceEntity(keyValue);
|
|
|
|
|
var processScheme = App.GetProcessSchemeEntity(processInstance.ProcessSchemeId);
|
2017-02-06 18:28:36 +08:00
|
|
|
|
var JsonData = new
|
|
|
|
|
{
|
|
|
|
|
processInstance = processInstance,
|
|
|
|
|
processScheme = processScheme
|
|
|
|
|
};
|
|
|
|
|
return Content(JsonData.ToJson());
|
|
|
|
|
}
|
2017-02-06 19:11:21 +08:00
|
|
|
|
|
2017-02-06 18:28:36 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取进程实例
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="keyValue"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpGet]
|
2017-10-11 16:19:34 +08:00
|
|
|
|
public ActionResult GetProcessInstanceJson(string keyValue)
|
2017-02-06 18:28:36 +08:00
|
|
|
|
{
|
2017-03-24 15:35:52 +08:00
|
|
|
|
var processInstance = App.GetProcessInstanceEntity(keyValue);
|
2017-02-06 18:28:36 +08:00
|
|
|
|
return Content(processInstance.ToJson());
|
|
|
|
|
}
|
|
|
|
|
|
2017-02-06 19:11:21 +08:00
|
|
|
|
public string Load(string type, int pageCurrent = 1, int pageSize = 30)
|
2017-02-06 18:28:36 +08:00
|
|
|
|
{
|
2017-03-24 15:35:52 +08:00
|
|
|
|
return JsonHelper.Instance.Serialize(App.Load(AuthUtil.GetCurrentUser().User.Id.ToString(), type, pageCurrent, pageSize));
|
2017-02-06 18:28:36 +08:00
|
|
|
|
}
|
|
|
|
|
|
2017-02-06 19:11:21 +08:00
|
|
|
|
#endregion 获取数据(公用)
|
2017-01-20 16:51:30 +08:00
|
|
|
|
}
|
|
|
|
|
}
|