mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-07-15 23:13:40 +08:00
修复驳回的BUG
This commit is contained in:
parent
a3b923f429
commit
fbe107789a
BIN
DOC/核心设计.EAP
BIN
DOC/核心设计.EAP
Binary file not shown.
@ -27,9 +27,20 @@
|
||||
|
||||
public class Setinfo
|
||||
{
|
||||
public const string SPECIAL_USER = "SPECIAL_USER"; //指定用户
|
||||
public const string ALL_USER = "ALL_USER"; //所有用户
|
||||
/// <summary>
|
||||
/// 节点执行权限类型
|
||||
/// </summary>
|
||||
public string NodeDesignate { get; set; }
|
||||
public Nodedesignatedata NodeDesignateData { get; set; }
|
||||
public string NodeCode { get; set; }
|
||||
public string NodeName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 驳回节点0"前一步"1"第一步"2"某一步" 3"不处理"
|
||||
/// </summary>
|
||||
public string NodeRejectType { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -43,6 +54,9 @@
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 节点执行结果标签
|
||||
/// </summary>
|
||||
public class Tag
|
||||
{
|
||||
public int Taged { get; set; }
|
||||
|
@ -23,14 +23,15 @@ namespace OpenAuth.App.Flow
|
||||
dynamic schemeContentJson = instance.SchemeContent.ToJson();//获取工作流模板内容的json对象;
|
||||
_runtimeModel.frmData = instance.FrmData;
|
||||
_runtimeModel.schemeContentJson = schemeContentJson;//模板流程json对象
|
||||
_runtimeModel.nodes = GetNodeDictionary(schemeContentJson);//节点集合
|
||||
_runtimeModel.nodes = GetNodes(schemeContentJson);//节点集合
|
||||
_runtimeModel.lines = GetLineDictionary(schemeContentJson);//线条集合
|
||||
_runtimeModel.currentNodeId = (instance.ActivityId == "" ? _runtimeModel.startNodeId : instance.ActivityId);
|
||||
_runtimeModel.currentNodeType = GetNodeType(_runtimeModel.currentNodeId);
|
||||
|
||||
//会签开始节点和流程结束节点没有下一步
|
||||
if (_runtimeModel.currentNodeType == 0 || _runtimeModel.currentNodeType == 4)
|
||||
{
|
||||
_runtimeModel.nextNodeId = "-1";//下一个节点
|
||||
_runtimeModel.nextNodeId = "-1";
|
||||
_runtimeModel.nextNodeType = -1;
|
||||
}
|
||||
else
|
||||
@ -50,22 +51,22 @@ namespace OpenAuth.App.Flow
|
||||
/// </summary>
|
||||
/// <param name="schemeContentJson"></param>
|
||||
/// <returns></returns>
|
||||
private Dictionary<string, FlowNode> GetNodeDictionary(dynamic schemeContentJson)
|
||||
private Dictionary<string, FlowNode> GetNodes(dynamic schemeContentJson)
|
||||
{
|
||||
Dictionary<string, FlowNode> nodeDictionary = new Dictionary<string, FlowNode>();
|
||||
Dictionary<string, FlowNode> nodes = new Dictionary<string, FlowNode>();
|
||||
foreach (JObject item in schemeContentJson.nodes)
|
||||
{
|
||||
var node = item.ToObject<FlowNode>();
|
||||
if (!nodeDictionary.ContainsKey(node.id))
|
||||
if (!nodes.ContainsKey(node.id))
|
||||
{
|
||||
nodeDictionary.Add(node.id, node);
|
||||
nodes.Add(node.id, node);
|
||||
}
|
||||
if (node.type == FlowNode.START)
|
||||
{
|
||||
this._runtimeModel.startNodeId = node.id;
|
||||
}
|
||||
}
|
||||
return nodeDictionary;
|
||||
return nodes;
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取工作流线段的字典列表:key开始节点id,value线条实体列表
|
||||
@ -379,14 +380,8 @@ namespace OpenAuth.App.Flow
|
||||
{
|
||||
return RejectNode(_runtimeModel.currentNodeId);
|
||||
}
|
||||
/// <summary>
|
||||
/// 驳回节点0"前一步"1"第一步"2"某一步" 3"不处理"
|
||||
/// </summary>
|
||||
/// <param name="nodeId"></param>
|
||||
/// <returns></returns>
|
||||
|
||||
public string RejectNode(string nodeId)
|
||||
{
|
||||
try
|
||||
{
|
||||
dynamic _node = _runtimeModel.nodes[nodeId];
|
||||
if (_node.setInfo != null)
|
||||
@ -395,30 +390,18 @@ namespace OpenAuth.App.Flow
|
||||
{
|
||||
return _runtimeModel.previousId;
|
||||
}
|
||||
else if (_node.setInfo.NodeRejectType.Value == "1")
|
||||
if (_node.setInfo.NodeRejectType.Value == "1")
|
||||
{
|
||||
return GetNextNodeByNodeId(_runtimeModel.startNodeId);
|
||||
}
|
||||
else if (_node.setInfo.NodeRejectType.Value == "2")
|
||||
if (_node.setInfo.NodeRejectType.Value == "2")
|
||||
{
|
||||
return _node.setInfo.NodeRejectStep.Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
||||
else//前一步
|
||||
{
|
||||
return _runtimeModel.previousId;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
///<summary>
|
||||
/// 标记节点1通过,-1不通过,0驳回
|
||||
/// </summary>
|
||||
|
@ -240,13 +240,10 @@ namespace OpenAuth.App
|
||||
/// <summary>
|
||||
/// 驳回
|
||||
/// </summary>
|
||||
/// <param name="processId"></param>
|
||||
/// <param name="nodeId"></param>
|
||||
/// <param name="description"></param>
|
||||
/// <returns></returns>
|
||||
public bool NodeReject(string processId, string nodeId, string description = "")
|
||||
public bool NodeReject(VerificationReq reqest)
|
||||
{
|
||||
FlowInstance flowInstance = Get(processId);
|
||||
FlowInstance flowInstance = Get(reqest.FlowInstanceId);
|
||||
FlowInstanceOperationHistory flowInstanceOperationHistory = new FlowInstanceOperationHistory();
|
||||
FlowInstanceTransitionHistory processTransitionHistoryEntity = null;
|
||||
|
||||
@ -254,19 +251,19 @@ namespace OpenAuth.App
|
||||
|
||||
|
||||
string resnode = "";
|
||||
if (nodeId == "")
|
||||
if (string.IsNullOrEmpty(reqest.NodeRejectStep))
|
||||
{
|
||||
resnode = wfruntime.RejectNode();
|
||||
}
|
||||
else
|
||||
{
|
||||
resnode = nodeId;
|
||||
resnode = reqest.NodeRejectStep;
|
||||
}
|
||||
|
||||
var user = AuthUtil.GetCurrentUser().User;
|
||||
var tag = new Tag
|
||||
{
|
||||
Description = description,
|
||||
Description = reqest.VerificationOpinion,
|
||||
Taged = 0,
|
||||
UserId = user.Id,
|
||||
UserName = user.Name
|
||||
@ -278,29 +275,32 @@ namespace OpenAuth.App
|
||||
{
|
||||
flowInstance.PreviousId = flowInstance.ActivityId;
|
||||
flowInstance.ActivityId = resnode;
|
||||
flowInstance.ActivityType = wfruntime.GetNodeType(resnode);//-1无法运行,0会签开始,1会签结束,2一般节点,4流程运行结束
|
||||
flowInstance.ActivityType = wfruntime.GetNodeType(resnode);
|
||||
flowInstance.ActivityName = wfruntime.runtimeModel.nodes[resnode].name;
|
||||
flowInstance.MakerList = GetMakerList(wfruntime.runtimeModel.nodes[resnode], flowInstance.PreviousId);//当前节点可执行的人信息
|
||||
#region 流转记录
|
||||
processTransitionHistoryEntity = new FlowInstanceTransitionHistory();
|
||||
processTransitionHistoryEntity.FromNodeId = wfruntime.runtimeModel.currentNodeId;
|
||||
processTransitionHistoryEntity.FromNodeName = wfruntime.runtimeModel.currentNode.name;
|
||||
processTransitionHistoryEntity.FromNodeType = wfruntime.runtimeModel.currentNodeType;
|
||||
processTransitionHistoryEntity.ToNodeId = wfruntime.runtimeModel.nextNodeId;
|
||||
processTransitionHistoryEntity.ToNodeName = wfruntime.runtimeModel.nextNode.name;
|
||||
processTransitionHistoryEntity.ToNodeType = wfruntime.runtimeModel.nextNodeType;
|
||||
processTransitionHistoryEntity.TransitionSate = 1;//
|
||||
|
||||
processTransitionHistoryEntity = new FlowInstanceTransitionHistory
|
||||
{
|
||||
FromNodeId = wfruntime.runtimeModel.currentNodeId,
|
||||
FromNodeName = wfruntime.runtimeModel.currentNode.name,
|
||||
FromNodeType = wfruntime.runtimeModel.currentNodeType,
|
||||
ToNodeId = wfruntime.runtimeModel.nextNodeId,
|
||||
ToNodeName = wfruntime.runtimeModel.nextNode.name,
|
||||
ToNodeType = wfruntime.runtimeModel.nextNodeType,
|
||||
TransitionSate = 1
|
||||
};
|
||||
//
|
||||
processTransitionHistoryEntity.IsFinish = (processTransitionHistoryEntity.ToNodeType == 4 ? 1 : 0);
|
||||
#endregion
|
||||
}
|
||||
var data = new
|
||||
{
|
||||
SchemeContent = wfruntime.runtimeModel.schemeContentJson.ToString(),
|
||||
frmData = (flowInstance.FrmType == 0 ? wfruntime.runtimeModel.frmData : null)
|
||||
};
|
||||
flowInstanceOperationHistory.Content = "【" + "todo name" + "】【" + wfruntime.runtimeModel.currentNode.name + "】【" + DateTime.Now.ToString("yyyy-MM-dd HH:mm") + "】驳回,备注:" + description;
|
||||
|
||||
UnitWork.Add(flowInstance);
|
||||
|
||||
flowInstanceOperationHistory.Content = "【" + "todo name" + "】【"
|
||||
+ wfruntime.runtimeModel.currentNode.name
|
||||
+ "】【" + DateTime.Now.ToString("yyyy-MM-dd HH:mm") + "】驳回,备注:" + reqest.VerificationOpinion;
|
||||
|
||||
UnitWork.Update(flowInstance);
|
||||
UnitWork.Add(flowInstanceOperationHistory);
|
||||
UnitWork.Add(processTransitionHistoryEntity);
|
||||
UnitWork.Save();
|
||||
@ -360,8 +360,6 @@ namespace OpenAuth.App
|
||||
/// <param name="node"></param>
|
||||
/// <returns></returns>
|
||||
private string GetMakerList(FlowNode node, string processId)
|
||||
{
|
||||
try
|
||||
{
|
||||
string makerlsit = "";
|
||||
|
||||
@ -371,13 +369,13 @@ namespace OpenAuth.App
|
||||
}
|
||||
else
|
||||
{
|
||||
//if (node.setInfo.NodeDesignate.Value == "NodeDesignateType1")//所有成员
|
||||
//{
|
||||
// makerlsit = "1";
|
||||
//}
|
||||
//else if (node.setInfo.NodeDesignate.Value == "NodeDesignateType2")//指定成员
|
||||
//{
|
||||
makerlsit = GenericHelpers.ArrayToString(node.setInfo.NodeDesignateData.role, makerlsit);
|
||||
if (node.setInfo.NodeDesignate == Setinfo.ALL_USER)//所有成员
|
||||
{
|
||||
makerlsit = "1";
|
||||
}
|
||||
else if (node.setInfo.NodeDesignate == Setinfo.SPECIAL_USER)//指定成员
|
||||
{
|
||||
// makerlsit = GenericHelpers.ArrayToString(node.setInfo.NodeDesignateData.role, makerlsit);
|
||||
// makerlsit = ArrwyToString(node.setInfo.NodeDesignateData.post, makerlsit);
|
||||
// makerlsit = ArrwyToString(node.setInfo.NodeDesignateData.usergroup, makerlsit);
|
||||
makerlsit = GenericHelpers.ArrayToString(node.setInfo.NodeDesignateData.users, makerlsit);
|
||||
@ -386,74 +384,10 @@ namespace OpenAuth.App
|
||||
{
|
||||
makerlsit = "-1";
|
||||
}
|
||||
// }
|
||||
//else if (node.setInfo.NodeDesignate.Value == "NodeDesignateType3")//发起者领导
|
||||
//{
|
||||
// UserEntity userEntity = userService.GetEntity(OperatorProvider.Provider.Current().UserId);
|
||||
// if (string.IsNullOrEmpty(userEntity.ManagerId))
|
||||
// {
|
||||
// makerlsit = "-1";
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// makerlsit = userEntity.ManagerId;
|
||||
// }
|
||||
//}
|
||||
//else if (node.setInfo.NodeDesignate.Value == "NodeDesignateType4")//前一步骤领导
|
||||
//{
|
||||
// FlowInstanceTransitionHistory transitionHistoryEntity = FlowInstanceTransitionHistoryService.GetEntity(flowInstanceId, node.id.Value);
|
||||
// UserEntity userEntity = userService.GetEntity(transitionHistoryEntity.CreateUserId);
|
||||
// if (string.IsNullOrEmpty(userEntity.ManagerId))
|
||||
// {
|
||||
// makerlsit = "-1";
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// makerlsit = userEntity.ManagerId;
|
||||
// }
|
||||
//}
|
||||
//else if (node.setInfo.NodeDesignate.Value == "NodeDesignateType5")//发起者部门领导
|
||||
//{
|
||||
// UserEntity userEntity = userService.GetEntity(OperatorProvider.Provider.Current().UserId);
|
||||
// DepartmentEntity departmentEntity = departmentService.GetEntity(userEntity.DepartmentId);
|
||||
|
||||
// if (string.IsNullOrEmpty(departmentEntity.ManagerId))
|
||||
// {
|
||||
// makerlsit = "-1";
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// makerlsit = departmentEntity.ManagerId;
|
||||
// }
|
||||
//}
|
||||
//else if (node.setInfo.NodeDesignate.Value == "NodeDesignateType6")//发起者公司领导
|
||||
//{
|
||||
// UserEntity userEntity = userService.GetEntity(OperatorProvider.Provider.Current().UserId);
|
||||
// OrganizeEntity organizeEntity = organizeService.GetEntity(userEntity.OrganizeId);
|
||||
|
||||
// if (string.IsNullOrEmpty(organizeEntity.ManagerId))
|
||||
// {
|
||||
// makerlsit = "-1";
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// makerlsit = organizeEntity.ManagerId;
|
||||
// }
|
||||
//}
|
||||
}
|
||||
}
|
||||
return makerlsit;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 将数组转化成逗号相隔的字串
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <param name="Str"></param>
|
||||
/// <returns></returns>
|
||||
|
||||
/// <summary>
|
||||
/// 审核流程
|
||||
@ -464,12 +398,7 @@ namespace OpenAuth.App
|
||||
//驳回
|
||||
if (request.VerificationFinally == "3")
|
||||
{
|
||||
string _nodeId = "";
|
||||
if (!string.IsNullOrEmpty(request.NodeRejectStep))
|
||||
{
|
||||
_nodeId = request.NodeRejectStep;
|
||||
}
|
||||
NodeReject(request.FlowInstanceId, _nodeId, request.VerificationOpinion);
|
||||
NodeReject(request);
|
||||
}
|
||||
else if (request.VerificationFinally == "2")//表示不同意
|
||||
{
|
||||
@ -511,3 +440,4 @@ namespace OpenAuth.App
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
public string VerificationOpinion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 驳回的步骤
|
||||
/// 驳回的步骤,即驳回到的节点ID
|
||||
/// </summary>
|
||||
public string NodeRejectStep { get; set; }
|
||||
}
|
||||
|
@ -28,6 +28,18 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">驳回类型</label>
|
||||
<div class="layui-input-block">
|
||||
<select name="NodeRejectType" v-model="NodeRejectType" required lay-verify="required">
|
||||
<option value="0">上一步</option>
|
||||
<option value="1">第一步</option>
|
||||
<option value="2">指定步骤</option>
|
||||
<option value="3">不处理</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">备注</label>
|
||||
<div class="layui-input-block">
|
||||
@ -37,12 +49,20 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-tab-item">
|
||||
<div class="layui-row">
|
||||
<div class="layui-input-block">
|
||||
<input type="radio" name="NodeDesignate" v-model="NodeDesignate" value="SPECIAL_USER" title="指定用户" checked>
|
||||
<input type="radio" name="NodeDesignate" v-model="NodeDesignate" value="ALL_USER" title="所有用户">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-row">
|
||||
<ul id="tree" class="ztree" style="display: inline-block; width: 180px; padding: 10px; border: 1px solid #ddd; overflow: auto;"></ul>
|
||||
<ul id="menutree" class="ztree" style="display: inline-block; width: 180px; padding: 10px; border: 1px solid #ddd; overflow: auto;"></ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<script type="text/javascript" src="/layui/layui.js"></script>
|
||||
|
@ -2,6 +2,7 @@
|
||||
using Infrastructure;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using OpenAuth.App;
|
||||
using OpenAuth.App.Request;
|
||||
using OpenAuth.Repository.Domain;
|
||||
|
||||
namespace OpenAuth.UnitTest
|
||||
@ -23,9 +24,13 @@ namespace OpenAuth.UnitTest
|
||||
/// <para>李玉宝于2017-01-20 9:59:11</para>
|
||||
/// </summary>
|
||||
[TestMethod]
|
||||
public void AddProcessInstance()
|
||||
public void Verify()
|
||||
{
|
||||
|
||||
_runApp.Verification(new VerificationReq
|
||||
{
|
||||
FlowInstanceId = "c4aa73f2-d5ea-43c3-8b7e-903e31ba5828",
|
||||
VerificationFinally = "3"
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user