/// <summary>
        /// 执行核心
        /// </summary>
        /// <param name="returnInfo">返回信息</param>
        /// <param name="flowIn">流程输入</param>
        /// <param name="findFlowCensorshipOut">查找流程关卡输出</param>
        /// <param name="connectionId">连接ID</param>
        protected override void ExecCore(ReturnInfo <bool> returnInfo, FlowInInfo <FlowAuditInfo> flowIn,
                                         FlowCensorshipOutInfo findFlowCensorshipOut, string connectionId = null)
        {
            // 更新工作流状态
            WorkflowPersistence.UpdateFlowStatusAndCensorshipAndHandlerById(findFlowCensorshipOut.Workflow, connectionId);

            // 更新当前工作流处理状态
            WorkflowHandlePersistence.UpdateHandleStatusById(findFlowCensorshipOut.CurrConcreteCensorship.WorkflowHandles[0], connectionId);

            string actionStr = flowIn.Flow.ActionType == ActionType.SEND ? "送件" : "退件";

            if (findFlowCensorshipOut.NextConcreteCensorshipHandles.IsNullOrLength0())
            {
                returnInfo.SetSuccessMsg($"申请单号[{findFlowCensorshipOut.Workflow.ApplyNo}]已{actionStr},等待其他人处理");
                return;
            }
            else
            {
                WorkflowHandleInfo updateEf = new WorkflowHandleInfo()
                {
                    Id = flowIn.Flow.HandleId,
                    FlowCensorshipId   = flowIn.Flow.WorkflowHandle.FlowCensorshipId,
                    ConcreteConcreteId = flowIn.Flow.WorkflowHandle.ConcreteConcreteId,
                    WorkflowId         = flowIn.Flow.WorkflowHandle.WorkflowId
                };
                updateEf.SetModifyInfo();

                if (flowIn.Flow.ActionType == ActionType.SEND)
                {
                    WorkflowHandlePersistence.UpdateEfficacyedNotIdByWorkflowIdAndFlowCensorshipId(updateEf, connectionId);
                }
                else
                {
                    WorkflowHandlePersistence.UpdateEfficacyedNotIdByWorkflowId(updateEf, connectionId);
                }

                // 插入下一个处理者
                IList <WorkflowHandleInfo> handlers = new List <WorkflowHandleInfo>();
                foreach (var c in findFlowCensorshipOut.NextConcreteCensorshipHandles)
                {
                    foreach (var h in c.WorkflowHandles)
                    {
                        h.WorkflowId = findFlowCensorshipOut.Workflow.Id;
                        handlers.Add(h);
                    }
                }

                ReturnInfo <bool> reHandle = WorkflowHandle.Add(handlers, connectionId);
                if (reHandle.Failure())
                {
                    returnInfo.FromBasic(reHandle);
                    return;
                }
            }

            StringBuilder msg = new StringBuilder($"申请单号[{findFlowCensorshipOut.Workflow.ApplyNo}]");

            if (findFlowCensorshipOut.ActionType == ActionType.SEND)
            {
                msg.AppendFormat("已送到[{0}]", findFlowCensorshipOut.Workflow.CurrHandlers);
                if (findFlowCensorshipOut.IsNextEndCensorship())
                {
                    msg.Append(",审核通过,流程结束");
                }
                else
                {
                    msg.Append("审核");
                }
            }
            else
            {
                msg.AppendFormat("已退给[{0}]", findFlowCensorshipOut.Workflow.CurrHandlers);
                if (findFlowCensorshipOut.IsNextApplicantCensorship())
                {
                    msg.Append(",审核驳回,流程结束");
                }
                else
                {
                    msg.Append("审核");
                }
            }

            returnInfo.SetMsg(msg.ToString());
        }
示例#2
0
        /// <summary>
        /// 执行核心
        /// </summary>
        /// <param name="returnInfo">返回信息</param>
        /// <param name="flowIn">流程输入</param>
        /// <param name="findFlowCensorshipOut">查找流程关卡输出</param>
        /// <param name="connectionId">连接ID</param>
        /// <param name="currUser">当前用户</param>
        protected override void ExecCore(ReturnInfo <bool> returnInfo, FlowInInfo <FlowInitInfo <PersonTimeInfo <int> > > flowIn,
                                         FlowCensorshipOutInfo findFlowCensorshipOut, string connectionId = null, BasicUserInfo <int> currUser = null)
        {
            // 操作工作流
            ReturnInfo <bool> reWorkflow = WorkflowService.Set(findFlowCensorshipOut.Workflow, connectionId, currUser);

            if (reWorkflow.Failure())
            {
                returnInfo.FromBasic(reWorkflow);
                return;
            }
            if (flowIn.Flow.Id < 1)
            {
                flowIn.Flow.Id = findFlowCensorshipOut.Workflow.Id;
            }

            // 操作工作流处理
            var currHandle = findFlowCensorshipOut.CurrConcreteCensorship.WorkflowHandles[0];

            currHandle.WorkflowId = findFlowCensorshipOut.Workflow.Id;

            var existsHandleReturnInfo = WorkflowHandle.FindByWorkflowIdAndFlowCensorshipIdAndHandlerId(currHandle.WorkflowId, currHandle.FlowCensorshipId, currHandle.HandlerId, connectionId, currUser);

            if (existsHandleReturnInfo.Failure())
            {
                returnInfo.FromBasic(existsHandleReturnInfo);
                return;
            }

            var user = UserTool <int> .GetCurrUser(currUser);

            if (existsHandleReturnInfo.Data != null)
            {
                if (existsHandleReturnInfo.Data.HandlerId != user.Id)
                {
                    returnInfo.SetFailureMsg($"Sorry,此流程不是您处理的,无权限操作");

                    return;
                }

                currHandle.Id = existsHandleReturnInfo.Data.Id;
                currHandle.SetModifyInfo(currUser);
            }

            ReturnInfo <bool> reHandle = WorkflowHandle.Set(findFlowCensorshipOut.CurrConcreteCensorship.WorkflowHandles[0], connectionId, currUser);

            if (reHandle.Failure())
            {
                returnInfo.FromBasic(reHandle);
                return;
            }

            if (findFlowCensorshipOut.NextConcreteCensorshipHandles.IsNullOrLength0())
            {
                returnInfo.SetMsg($"申请单号[{findFlowCensorshipOut.Workflow.ApplyNo}]已保存为草稿");
                return;
            }

            IList <WorkflowHandleInfo> handlers = new List <WorkflowHandleInfo>();

            foreach (var c in findFlowCensorshipOut.NextConcreteCensorshipHandles)
            {
                foreach (var h in c.WorkflowHandles)
                {
                    h.WorkflowId = findFlowCensorshipOut.Workflow.Id;
                    handlers.Add(h);
                }
            }

            reHandle = WorkflowHandle.Add(handlers, connectionId, currUser);
            if (reHandle.Failure())
            {
                returnInfo.FromBasic(reHandle);
                return;
            }

            returnInfo.SetMsg($"申请单号[{findFlowCensorshipOut.Workflow.ApplyNo}]已送到[{findFlowCensorshipOut.Workflow.CurrHandlers}]审核");
        }