Cat.WorkFlow/WorkflowInstance.cs

(开头部分) 45KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using Cat.Data.Repository;
using Cat.Entity.WorkFLowManage;
using Cat.Service.WorkFLowManage;
using Cat.Util.Model;
using NPOI.SS.Formula.Functions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Cat.WorkFlow
{
    public class WorkflowInstance
    {
        WfWorkFLowService workFLowService = new WfWorkFLowService();
        WfInstanceService instanceService = new WfInstanceService();
        WfHistoryService historyService = new WfHistoryService();
        WfTaskService taskService = new WfTaskService();

        /// <summary>
        /// 流程提交,创建实例
        /// 有变化:根据新的Id来查询相关FlowId,BusinessId,UserId不能为空,ExtendInfo可以为空
        /// </summary>
        public async Task<TData> CreateInstance(WorkFlowProcessTransition transition)
        {
            TData obj = new TData();
            WfWorkFLowEntity entity = await workFLowService.GetEntity(transition.FlowId);
            if(entity==null || entity.FlowContent.Length<10)
            {
                obj.Tag = 0;
                obj.Message = "没有找到相应的流程";
                return obj;
            }

            //解析流程
            WorkFlowContext context = new WorkFlowContext(new WorkFlow
            {
                FlowJSON = entity.FlowContent,
                BusinessId = transition.BusinessId
            });
            var db = await instanceService.BaseRepository().BeginTrans();
            try
            {
                //获取下一个节点,根据该节点获取相关审批人,开始节点不支持分流及分支和跳过
                //???通过后可以加上相关功能
                List<long> UserList =await context.GetNodeUsers(context.WorkFlow.NextNode);
                WfInstanceEntity wfInstanceEntity;
                if (context.WorkFlow.NextNodeType == WorkFlowInstanceNodeType.EndRound) //结束节点
                {
                    //创建流程实例
                    wfInstanceEntity = await AddInstance(db, entity, transition, context, 1);
                }
                else
                {
                    wfInstanceEntity = await AddInstance(db, entity, transition, context);
                }

                //添加流程操作记录
                await AddHistory(db, wfInstanceEntity.Id.Value, context.WorkFlow.CurrentNodeId, context.WorkFlow.CurrentNode.Name, CommandType.Submit, "流程开始",true);
后面还有 927 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。