1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Threading.Tasks;
- using wispro.sp.entity.workflowDefine;
- using wispro.sp.share;
- namespace wispro.sp.web.Services
- {
- public class WorkflowService
- {
- private readonly IHttpService _httpClient;
- public WorkflowService(IHttpService http)
- {
- _httpClient = http;
- }
- private List<BindObjectType> bindObjectTypes = new List<BindObjectType>()
- {
- new BindObjectType(){ Name ="绩效记录",ObjectTypeFullName = typeof(wispro.sp.entity.PerformanceItem).FullName},
- new BindObjectType(){ Name ="人员",ObjectTypeFullName = typeof(wispro.sp.entity.Staff).FullName}
- };
- public List<BindObjectType> GetBindObjects()
- {
- return bindObjectTypes;
- }
- public string GetBindObjectName(string ObjectTypeFullName)
- {
- var retObj = bindObjectTypes.FirstOrDefault<BindObjectType>(b => b.ObjectTypeFullName == ObjectTypeFullName);
- if(retObj != null)
- {
- return retObj.Name;
- }
- else
- {
- return "";
- }
- }
- List<entity.workflowDefine.Workflow> Workflows = new List<Workflow>();
- Dictionary<int, List<entity.workflowDefine.InputValueSetting>> InitInputValues = new Dictionary<int, List<InputValueSetting>>();
- public async Task<ApiSaveResponse> AddWorkflow(entity.workflowDefine.Workflow wf,entity.workflowDefine.Action InitAction)
- {
- share.NewWorkflowObject newWorkflow = new share.NewWorkflowObject();
- newWorkflow.Workflow = wf;
- newWorkflow.InitAction = InitAction;
- Console.WriteLine(System.Text.Json.JsonSerializer.Serialize(newWorkflow));
- var ret = await _httpClient.Post<ApiSaveResponse>("WorkflowEngine/AddNew", newWorkflow);
- return ret;
-
- }
- public async Task<List<Workflow>> getAllWorkflows()
- {
- var retList = await _httpClient.Get<List<Workflow>>($"WorkflowEngine/GetAllWorkflows");
- return retList;
- }
- public async Task<Workflow> GetWorkflow(int Id)
- {
- Workflow ret = await _httpClient.Get<Workflow>($"WorkflowEngine/GetWorkflow?workflowId={Id}");
- Console.WriteLine(System.Text.Json.JsonSerializer.Serialize(ret));
- return ret;
- }
- public async Task<List<entity.workflowDefine.Step>> GetSteps(int Id)
- {
- var ret = await _httpClient.Get<List<entity.workflowDefine.Step>>($"WorkflowEngine/GetSteps?workflowId={Id}");
- return ret;
- }
-
- public async Task<List<entity.workflowDefine.Action>> GetActions(int workflowId)
- {
- var ret = await _httpClient.Get<List<entity.workflowDefine.Action>>($"WorkflowEngine/GetActions?workflowId={workflowId}");
- return ret;
- }
- public async Task<List<entity.workflowDefine.TrasferCondition>> GetTransfers(int workflowId)
- {
- var ret = await _httpClient.Get<List<entity.workflowDefine.TrasferCondition>>($"WorkflowEngine/GetTrasfers?workflowId={workflowId}");
- return ret;
- }
- }
- }
|