层次关系及示范,F2BPM流程基本RESTfull解决方案及示范

富有RESTfull都统壹只有那八个Json参数  

5.3. F2-BPM流水线大旨OAUTH2.0身份验证时序图

 图片 1

各种接口必须传递的数码:{token:,corpId:,timeStamp:,nonce:,signature:,loginAccount:}

参数名

值示例

说明

token

oa_token

系统令牌,在流程中心配置的固定值

corpId

app255e7feb2645dd23

应用系统的ID,在流程中心增加应用接入时生成的ID

timeStamp

1706261844

时间戳,传递时由客户端生成,格式:yymmddHHmm,客户端时间与F2-PBM流程中心系统时间误差充许在10分钟以内

nonce

6723

随时数,由客户端生成一个至少4位的随时数

signature

ZDlUMYZeJKXrAZ3ofbZQnXgSPqjHw9xw2lZhj0hPwF5VUG0yMhknJ-8Ql8zK8tXK

签名加密字符串,由客户端将timeStamp和nonce进行加密得到此签名加密字符串

loginAccount

zs

当前登录者的账号,用于作为调用RESTfull接口流程引擎将以此账号作为流程引擎运行中的当前登录人身份

 

 

5.2. OAuth2.0与F2-BPM平台

因为要将F2-BPM平台做为流程服务中央,那么F2-BPM平台就会与多个利用系统打交道,多少个应该系统经过调用RESTfull接口来驱动流程如故取得流程相关数据时索要安全认证后才能够实行接口影响再次回到正确的多寡结果。

F2-BPM流程基本构建了OAuth2.0的身份验证机制,此身份的印证是理所应当系统级其他,目标验证是还是不是来自官方注册的应当系统调用了流程基本的RESTfull接口。(数据涉嫌的用户是应用体系开发调用流程基本接口时间控制制)。

本流程核心的OAuthor并非用于用户的第①方登录认证,当然也能扩张出来,但由于F2-BPM并非人事系统的统一用户管理宗旨。

parmJson:请求业务数据的参数,比如分页参数,查询参数等

客户端与流程基本接口交互参数表明:

authorJson:重倘若接口地方的验证相关参数,校验访问者的源点合法性

parmJson:请求业务数据的参数,比如分页参数,查询参数等
全体RESTfull都合并唯有那四个Json参数 一般情形

 

get只适合参数相对简单的请求,假如参数过长或参数字符复杂,则采取Post
来传参请求。

 

F2BPM接口强大的特点:服务端能够利用F2BPM相当丰硕的流水生产线引擎WAPI进行披露成RESTfull服务接口供应用端系统调用。而且接口可以是无状态的伸手

图片 2

发起流程示例:

客户端

/**
     * post请求
     */
    public void startWorkflow() {
        String urlString = webApiUrl + "/workflowBusiness/startWorkflow/";
        Map<String, String> params = new HashMap<String, String>();
        StringBuilder queryString = new StringBuilder();
        String onlineFormData = StringUtil.format("[{\"mainTable\":\"csb\",\"data\":[{\"name\":\"csb.nl\",\"value\":\"22\"},{\"name\":\"csb.MyId\",\"value\":\"\"},{\"name\":\"csb.zz\",\"value\":\"RestFull测试\"},{\"name\":\"csb.xm\",\"value\":\"RestFull姓名\"}],\"subTables\":[]}]");
        params.put("authorJson", StringUtil.format("{loginAccount:\"{0}\"}", "admin"));
        params.put("parmJson", StringUtil.format("{appId:\"{0}\",wiid:\"{1}\",businessKey:\"{2}\",title:\"{3}\",opinion:\"{4}\",jsonFormData:{5}}", "ZX", Guid.getGuid(), Guid.getGuid(), "应用端RestFull请求测试", "同意", onlineFormData));
        // String param = HttpClientUtil.urlEncode(queryString.toString());
        // //特殊字符进行转义
        String jsonRes = HttpClientUtil.post(urlString, params);
        System.out.println(jsonRes);
    }

 

流程基本拍卖发起呼吁

    //响应发起流程
    @RequestMapping(value = "startWorkflow", method = RequestMethod.POST)
    public void startWorkflow(String authorJson, String parmJson, HttpServletRequest request, HttpServletResponse response) throws IOException {
        JSONObject jsonJSONObject = JSONObject.fromObject(parmJson);
        AuthorEntity authorEntity = JsonHelper.jsonToObject(authorJson, AuthorEntity.class);
        String loginAccount = authorEntity.getLoginAccount();
        // IUser user = userService.getUserByAccount(loginAccount);
        String appId = JsonHelper.getString(jsonJSONObject, "appId");
        String wiid = JsonHelper.getString(jsonJSONObject, "wiid");
        String businessKey = JsonHelper.getString(jsonJSONObject, "businessKey");
        String title = JsonHelper.getString(jsonJSONObject, "title");
        String opinion = JsonHelper.getString(jsonJSONObject, "opinion");
        String jsonFormData = JsonHelper.getString(jsonJSONObject, "jsonFormData");
        StringBuilder message = new StringBuilder();
        boolean success = WorkflowAPI.getWorkflowEnactmentManager().startWorkflow(appId, wiid, businessKey, title, opinion, loginAccount, null, message, jsonFormData, null, 0, 0);
        String jsonResult = JsonHelper.outResult(success, message.toString());
        JsonHelper.write(response, jsonResult);
    }

 

  

  

  

RESTfull参数格局

3. 独立程序和数据库安排方式

图片 3

 

数据库和次序都是独自布署情势是指流程基本与应用连串应用分别的数据库。

那会儿流程基本自己数据库中的用户协会架构管理仅是作为流程基本平台管理员使用的用户协会,用于登录维护管理流程基本有关的事情。流程基本的用户协会与应用种类的用户组织非亲非故。

而当调用流程基本执行流程流转时用户组织是由此重写F2用户协会架构接口的完成读取应用系统的用户协会架构,依然选拔的是利用系统本身的用户协会架构。流程引擎使用的是重写达成协会接口的应用类别本人的用户组织架构,用户组织架构的护卫管理依然是由运用连串自个儿来管理。

 

 

 

 

 

 

API开发接口与RestFull API服务发表代码示例

斯马特FormRESTfullApi 在线表单的RestFull API服务

package com.f2bpm.controller.restfullapi;

import java.util.List;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import net.sf.json.JSONObject;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;

import com.f2bpm.base.core.entity.AuthorEntity;
import com.f2bpm.base.core.entity.MyInteger;
import com.f2bpm.base.core.entity.PageParams;
import com.f2bpm.base.core.enums.ExtensionValidateType;
import com.f2bpm.base.core.utils.AppUtil;
import com.f2bpm.base.core.utils.ExtensionValidate;
import com.f2bpm.base.core.utils.FileDownUtil;
import com.f2bpm.base.core.utils.FileUtil;
import com.f2bpm.base.core.utils.JsonHelper;
import com.f2bpm.base.core.utils.string.StringUtil;
import com.f2bpm.base.core.utils.time.DateUtil;
import com.f2bpm.system.admin.impl.model.Users;
import com.f2bpm.system.security.utils.LogUtil;
import com.f2bpm.system.security.web.WebHelper;
import com.f2bpm.workflow.engine.api.entity.WorkflowInstanceContext;
import com.f2bpm.workflow.engine.api.model.TaskInstance;
import com.f2bpm.workflow.engine.api.model.TaskInstanceInfo;
import com.f2bpm.workflow.engine.api.model.WorkflowForm;
import com.f2bpm.workflow.engine.api.wapi.IWorkflowWAPIService;
import com.f2bpm.workflow.engine.helper.WfWebHelper;
import com.f2bpm.workflow.org.api.imodel.IUser;
import com.f2bpm.workflow.org.api.iservice.IUserService;
import com.f2bpm.workflow.smartForm.api.entity.BusObjectData;

/*
 * 在线表单RestFull API服务接口
 */
@Controller
@RequestMapping("/restfullapi/smartForm/")
public class SmartFormRESTfullApi {
    @Resource
    IUserService userService;
    public IWorkflowWAPIService WorkflowAPI = (IWorkflowWAPIService) AppUtil.getBean("WorkflowAPI");

    /**
     * 获取在线表单数据
     * 
     * @param parmJson
     * @param authorJson
     * @param response
     */
    @RequestMapping(value = "getOnlineFormData", method = RequestMethod.POST)
    public void getOnlineFormData(String parmJson, String authorJson, HttpServletResponse response) {
        String jsonResult = "";
        try {
            JSONObject jsonJSONObject = JSONObject.fromObject(parmJson);
            AuthorEntity authorEntity = JsonHelper.jsonToObject(authorJson, AuthorEntity.class);
            String loginAccount = authorEntity.getLoginAccount();
            // 流程实例ID
            String wiid = JsonHelper.getString(jsonJSONObject, "wiid");
            // 表单业务键
            String businessKey = JsonHelper.getString(jsonJSONObject, "businessKey");
            List<BusObjectData> data = WorkflowAPI.getSmartFormApiManager().getBusObjectListData(wiid, businessKey);
            jsonResult = JsonHelper.objectToJSON(data);
        } catch (Exception ex) {
            jsonResult = JsonHelper.outResult(false, ex.toString());
        }
        JsonHelper.write(response, jsonResult);
    }

    /**
     * 获取表单应用定义
     * 
     * @param parmJson
     * @param authorJson
     * @param response
     */
    @RequestMapping(value = "getWorkflowForm", method = RequestMethod.POST)
    public void getWorkflowForm(String parmJson, String authorJson, HttpServletResponse response) {
        String jsonResult = "";
        try {
            JSONObject jsonJSONObject = JSONObject.fromObject(parmJson);
            AuthorEntity authorEntity = JsonHelper.jsonToObject(authorJson, AuthorEntity.class);
            String loginAccount = authorEntity.getLoginAccount();
            String wid = JsonHelper.getString(jsonJSONObject, "wid");
            String appId = JsonHelper.getString(jsonJSONObject, "appId");
            WorkflowForm form = null;
            if (StringUtil.isEmpty(wid)) {
                // 启动时
                form = WorkflowAPI.getProcessDefManager().getWorkflowInfo(appId).getWorkflowFormRunned();
            } else {
                // 运行时
                form = WorkflowAPI.getProcessDefManager().getWorkflowInfo(wid, appId).getWorkflowFormRunned();

            }
            jsonResult = JsonHelper.objectToJSON(form);
        } catch (Exception ex) {
            jsonResult = JsonHelper.outResult(false, ex.toString());
        }
        JsonHelper.write(response, jsonResult);
    }

    /**
     * 获取表单手机端Html模板
     * 
     * @param parmJson wid:启动时可为空
     * @param authorJson
     * @param response
     */
    @RequestMapping(value = "getWorkflowFormMobileHtml", method = RequestMethod.POST)
    public void getWorkflowFormMobileHtml(String parmJson, String authorJson, HttpServletResponse response) {
        String jsonResult = "";
        try {
            JSONObject jsonJSONObject = JSONObject.fromObject(parmJson);
            AuthorEntity authorEntity = JsonHelper.jsonToObject(authorJson, AuthorEntity.class);
            String loginAccount = authorEntity.getLoginAccount();
            String wid = JsonHelper.getString(jsonJSONObject, "wid");//启用时可为空
            String appId = JsonHelper.getString(jsonJSONObject, "appId");
            String html= null;
            if (StringUtil.isEmpty(wid)) {
                // 启动时
                html = WorkflowAPI.getProcessDefManager().getWorkflowInfo(appId).getWorkflowFormRunned().getMobileTemplateContent();
            } else {
                // 运行时
                html = WorkflowAPI.getProcessDefManager().getWorkflowInfo(wid, appId).getWorkflowFormRunned().getMobileTemplateContent();

            }
            jsonResult = html;
        } catch (Exception ex) {
            jsonResult = JsonHelper.outResult(false, ex.toString());
        }
        JsonHelper.write(response, jsonResult);
    }
}

WorkflowBusinessRESTfullApi 流程运营相关的服务接口

  1 package com.f2bpm.controller.restfullapi;
  2 
  3 import java.io.File;
  4 import java.io.FileInputStream;
  5 import java.io.IOException;
  6 import java.io.InputStream;
  7 import java.io.OutputStream;
  8 import java.util.List;
  9 
 10 import javax.annotation.Resource;
 11 import javax.servlet.http.HttpServletRequest;
 12 import javax.servlet.http.HttpServletResponse;
 13 
 14 import net.sf.json.JSONObject;
 15 
 16 import org.springframework.stereotype.Controller;
 17 import org.springframework.web.bind.annotation.RequestMapping;
 18 import org.springframework.web.bind.annotation.RequestMethod;
 19 import org.springframework.web.bind.annotation.ResponseBody;
 20 import org.springframework.web.multipart.MultipartFile;
 21 import org.springframework.web.multipart.MultipartHttpServletRequest;
 22 
 23 import com.f2bpm.base.core.entity.AuthorEntity;
 24 import com.f2bpm.base.core.entity.MyInteger;
 25 import com.f2bpm.base.core.entity.PageParams;
 26 import com.f2bpm.base.core.enums.ExtensionValidateType;
 27 import com.f2bpm.base.core.utils.AppUtil;
 28 import com.f2bpm.base.core.utils.ExtensionValidate;
 29 import com.f2bpm.base.core.utils.FileDownUtil;
 30 import com.f2bpm.base.core.utils.FileUtil;
 31 import com.f2bpm.base.core.utils.JsonHelper;
 32 import com.f2bpm.base.core.utils.string.StringUtil;
 33 import com.f2bpm.base.core.utils.time.DateUtil;
 34 import com.f2bpm.system.admin.impl.model.Users;
 35 import com.f2bpm.system.security.utils.LogUtil;
 36 import com.f2bpm.system.security.web.WebHelper;
 37 import com.f2bpm.workflow.engine.api.entity.WorkflowInstanceContext;
 38 import com.f2bpm.workflow.engine.api.model.ActivityInfo;
 39 import com.f2bpm.workflow.engine.api.model.TaskInstance;
 40 import com.f2bpm.workflow.engine.api.model.TaskInstanceInfo;
 41 import com.f2bpm.workflow.engine.api.wapi.IWorkflowWAPIService;
 42 import com.f2bpm.workflow.engine.helper.WfWebHelper;
 43 import com.f2bpm.workflow.org.api.imodel.IUser;
 44 import com.f2bpm.workflow.org.api.iservice.IUserService;
 45 /*
 46  * 流程运行相关 RestFull API服务接口
 47  */
 48 @Controller
 49 @RequestMapping("/restfullapi/workflowBusiness/")
 50 public class WorkflowBusinessRESTfullApi {
 51     @Resource
 52     IUserService userService;
 53 
 54     public IWorkflowWAPIService WorkflowAPI = (IWorkflowWAPIService) AppUtil.getBean("WorkflowAPI");
 55 
 56     /**
 57      * 查找任务实例
 58      * @param id
 59      * @param request
 60      * @param response
 61      * @return
 62      * @throws IOException
 63      */
 64     @ResponseBody
 65     @RequestMapping(value = "getTask", method = RequestMethod.GET)
 66     public TaskInstance getTask(String id, HttpServletRequest request, HttpServletResponse response) throws IOException {
 67         TaskInstance task = new TaskInstance();
 68         id = "031d2404-94d1-4566-8ade-21126b620904";
 69         task = WorkflowAPI.getWorkTaskManager().getTaskInstanceByTaskId(id);
 70         return task;
 71     }
 72 
 73     /**
 74      *  获取待办列表
 75      * @param authorJson
 76      * @param parmJson
 77      * @param request
 78      * @param response
 79      * @throws Exception
 80      */
 81     @RequestMapping(value = "getTodoList", method = RequestMethod.GET)
 82     public void getTodoList(String authorJson, String parmJson, HttpServletRequest request, HttpServletResponse response) throws Exception {
 83         JSONObject jsonJSONObject = JSONObject.fromObject(parmJson);
 84         PageParams pageParams = JsonHelper.jsonToObject(parmJson, PageParams.class);
 85         AuthorEntity authorEntity = JsonHelper.jsonToObject(authorJson, AuthorEntity.class);
 86         String loginAccount = authorEntity.getLoginAccount();
 87         MyInteger recordCount = new MyInteger(0);
 88         MyInteger pageCount = new MyInteger(0);
 89         String whereStr = JsonHelper.getString(jsonJSONObject, "whereStr");
 90         IUser user = userService.getUserByAccount(loginAccount);
 91         List<TaskInstanceInfo> list = WorkflowAPI.getWorkTaskManager().getTodoList(user.getUserId(), whereStr.toString(), pageParams.getOrderBy(), pageParams.getPageIndex(), pageParams.getPageSize(), pageCount, recordCount, true);
 92         String jsonString = JsonHelper.listToJSON(list);
 93         String jsonResult = JsonHelper.convertToEasyUIJsonResult(jsonString, pageParams.getPageSize(), pageParams.getPageIndex(), recordCount.getValue(), pageCount.getValue());
 94         JsonHelper.write(response, jsonResult);
 95     }
 96 
 97     /**
 98      *  已办列表
 99      * @param authorJson
100      * @param parmJson
101      * @param request
102      * @param response
103      * @throws Exception
104      */
105     @RequestMapping(value = "getDoneList", method = RequestMethod.POST)
106     public void getDoneList(String authorJson, String parmJson, HttpServletRequest request, HttpServletResponse response) throws Exception {
107         JSONObject jsonJSONObject = JSONObject.fromObject(parmJson);
108         PageParams pageParams = JsonHelper.jsonToObject(parmJson, PageParams.class);
109         AuthorEntity authorEntity = JsonHelper.jsonToObject(authorJson, AuthorEntity.class);
110         String loginAccount = authorEntity.getLoginAccount();
111         MyInteger recordCount = new MyInteger(0);
112         MyInteger pageCount = new MyInteger(0);
113         String whereStr = JsonHelper.getString(jsonJSONObject, "whereStr");
114         int isHistory = JsonHelper.getInt(jsonJSONObject, "isHistory");
115         IUser user = userService.getUserByAccount(loginAccount);
116         List<TaskInstanceInfo> list = null;
117         if (isHistory == 1) {
118             // 归档中的列表
119             list = WorkflowAPI.getHistoryDataManager().getHistoryDoneList(user.getUserId(), whereStr.toString(), pageParams.getOrderBy(), pageParams.getPageIndex(), pageParams.getPageSize(), pageCount, recordCount, true);
120         } else {
121             // 进行中的已办
122             list = WorkflowAPI.getWorkTaskManager().getDoneList(user.getUserId(), whereStr.toString(), pageParams.getOrderBy(), pageParams.getPageIndex(), pageParams.getPageSize(), pageCount, recordCount, true);
123         }
124 
125         String jsonString = JsonHelper.listToJSON(list);
126         String jsonResult = JsonHelper.convertToEasyUIJsonResult(jsonString, pageParams.getPageSize(), pageParams.getPageIndex(), recordCount.getValue(), pageCount.getValue());
127         JsonHelper.write(response, jsonResult);
128     }
129 
130     /**
131      * 响应发起流程
132      * @param authorJson
133      * @param parmJson
134      * @param request
135      * @param response
136      * @throws IOException
137      */
138     @RequestMapping(value = "startWorkflow", method = RequestMethod.POST)
139     public void startWorkflow(String authorJson, String parmJson, HttpServletRequest request, HttpServletResponse response) throws IOException {
140         JSONObject jsonJSONObject = JSONObject.fromObject(parmJson);
141         AuthorEntity authorEntity = JsonHelper.jsonToObject(authorJson, AuthorEntity.class);
142         String loginAccount = authorEntity.getLoginAccount();
143         // IUser user = userService.getUserByAccount(loginAccount);
144         String appId = JsonHelper.getString(jsonJSONObject, "appId");
145         String wiid = JsonHelper.getString(jsonJSONObject, "wiid");
146         String businessKey = JsonHelper.getString(jsonJSONObject, "businessKey");
147         String title = JsonHelper.getString(jsonJSONObject, "title");
148         String opinion = JsonHelper.getString(jsonJSONObject, "opinion");
149         String jsonFormData = JsonHelper.getString(jsonJSONObject, "jsonFormData");
150         StringBuilder message = new StringBuilder();
151         boolean success = WorkflowAPI.getWorkflowEnactmentManager().startWorkflow(appId, wiid, businessKey, title, opinion, loginAccount, null, message, jsonFormData, null, 0, 0);
152         String jsonResult = JsonHelper.outResult(success, message.toString());
153         JsonHelper.write(response, jsonResult);
154     }
155 
156     /**
157      *  驳回流程
158      * @param parmJson
159      * @param authorJson
160      * @param response
161      */
162     @RequestMapping(value = "rejectFlow", method = RequestMethod.POST)
163     public void rejectFlow(String parmJson, String authorJson, HttpServletResponse response) {
164         JSONObject jsonJSONObject = JSONObject.fromObject(parmJson);
165         AuthorEntity authorEntity = JsonHelper.jsonToObject(authorJson, AuthorEntity.class);
166         String loginAccount = authorEntity.getLoginAccount();
167         String taskId = JsonHelper.getString(jsonJSONObject, "taskId");
168         String opinion = JsonHelper.getString(jsonJSONObject, "opinion");
169         StringBuilder message = new StringBuilder();
170         boolean success = WorkflowAPI.getWorkflowEnactmentManager().rejectWorkflow(taskId, loginAccount, opinion, true, null, message);
171         String jsonResult = JsonHelper.outResult(success, message.toString());
172         JsonHelper.write(response, jsonResult);
173     }
174 
175     /**
176      * 作废流程实例
177      * 
178      * @param parmJson
179      * @param authorJson
180      * @param response
181      */
182     @RequestMapping(value = "invalidFlow", method = RequestMethod.POST)
183     public void invalidFlow(String parmJson, String authorJson, HttpServletResponse response) {
184         JSONObject jsonJSONObject = JSONObject.fromObject(parmJson);
185         AuthorEntity authorEntity = JsonHelper.jsonToObject(authorJson, AuthorEntity.class);
186         String loginAccount = authorEntity.getLoginAccount();
187         String taskId = JsonHelper.getString(jsonJSONObject, "taskId");
188         String opinion = JsonHelper.getString(jsonJSONObject, "opinion");
189         TaskInstance taskInstance = WorkflowAPI.getWorkTaskManager().getTaskInstanceByTaskId(taskId);
190         String wiid = taskInstance.getWorkflowInstanceId();
191         StringBuilder message = new StringBuilder();
192         IUser user = WorkflowAPI.getOrgEngineManager().getUserService().getUserByAccount(loginAccount);
193         boolean success = WorkflowAPI.getWorkflowEnactmentManager().invalidWorkflowInstance(wiid, opinion, user);
194         String jsonResult = JsonHelper.outResult(success, message.toString());
195         JsonHelper.write(response, jsonResult);
196     }
197 
198 
199     
200     /**
201      * 审批执行代办任务
202      * @param authorJson
203      * @param parmJson
204      * @param response
205      */
206     @RequestMapping(value = "approvalTask", method = RequestMethod.POST)
207     public void approvalTask(String authorJson, String parmJson, HttpServletResponse response) {
208         JSONObject jsonJSONObject = JSONObject.fromObject(parmJson);
209         AuthorEntity authorEntity = JsonHelper.jsonToObject(authorJson, AuthorEntity.class);
210         String loginAccount = authorEntity.getLoginAccount();
211         String taskId = JsonHelper.getString(jsonJSONObject, "taskId");
212         String opinion = JsonHelper.getString(jsonJSONObject, "opinion");
213         StringBuilder message = new StringBuilder();
214         boolean success = WorkflowAPI.getWorkflowEnactmentManager().sendWorkflowByTaskId(taskId, loginAccount, opinion, message);
215         String jsonResult = JsonHelper.outResult(success, message.toString());
216         JsonHelper.write(response, jsonResult);
217     }
218 
219     /**
220      * 获取任务指定节点的供选择人(计算出节点参与者)
221      * @param authorJson
222      * @param parmJson
223      * @param response
224      */
225     @RequestMapping(value = "getActivityUsers", method = RequestMethod.POST)
226     public void getActivityUsers(String authorJson, String parmJson, HttpServletResponse response) {
227         JSONObject jsonJSONObject = JSONObject.fromObject(parmJson);
228         AuthorEntity authorEntity = JsonHelper.jsonToObject(authorJson, AuthorEntity.class);
229         String loginAccount = authorEntity.getLoginAccount();
230         String taskId = JsonHelper.getString(jsonJSONObject, "taskId");
231         String activityId = JsonHelper.getString(jsonJSONObject, "activityId");
232         StringBuilder message = new StringBuilder();
233         WorkflowInstanceContext wfContext=WorkflowAPI.getWorkflowEnactmentManager().getWorkflowInstanceContextOnTodo(taskId, loginAccount);
234         TaskInstance  task = WorkflowAPI.getWorkTaskManager().getTaskInstanceByTaskId(taskId);
235         ActivityInfo activityInfo=WorkflowAPI.getProcessDefManager().getActivityInfo(task.getWorkflowId(), activityId);
236         List<IUser> list= WorkflowAPI.getWorkflowEnactmentManager().getListActorUserResultByActivityInfo(wfContext,activityInfo);
237         String jsonResult =JsonHelper.objectToJSON(list);
238         JsonHelper.write(response, jsonResult);
239     }
240     
241     /**
242      * 上传在线表单附件 上传在线表单附件, 返回字段值单个附件值,表单附件的字段值格式:
243      * [{filePathName:"/attachments/workflow/files/20170714215409547.txt"
244      * ,fileName:"TestClient.txt"}]
245      * 
246      * @param request
247      * @param response
248      */
249     @RequestMapping("uploadFile")
250     public void uploadFile(HttpServletRequest request, HttpServletResponse response) {
251         String jsonResult = "";
252         MultipartHttpServletRequest mRequest = (MultipartHttpServletRequest) request;
253         MultipartFile fileUpload = mRequest.getFile("FileUpload");
254         if (!fileUpload.isEmpty()) {
255 
256             try {
257                 String uploadType = WfWebHelper.query("UploadType", "");
258 
259                 String path = FileDownUtil.getWorkflowFilePath();
260                 String uploadFileName = fileUpload.getOriginalFilename();
261                 String fileExtension = uploadFileName.substring(uploadFileName.lastIndexOf("."));
262 
263                 if (!StringUtil.isNullOrWhiteSpace(uploadType)) {
264                     path = path + uploadType + "/";
265                     if (!FileUtil.isExistDirectory(path)) {
266                         FileUtil.createFolder(path);
267                     }
268                 }
269 
270                 if (!ExtensionValidate.validateExtension(fileExtension, ExtensionValidateType.FileExtension)) {
271                     jsonResult = JsonHelper.outResult(false, fileExtension + ",文件类型不允许上传!");
272                     JsonHelper.write(response, jsonResult);
273                     return;
274                 }
275                 uploadFileName = DateUtil.getCurrentDateTime("yyyyMMddHHmmssSSS") + fileExtension;
276                 String filePathName = path + uploadFileName;
277                 if (FileUtil.isExistFile(filePathName)) {
278                     FileUtil.deleteFile(filePathName);
279                 }
280                 File filePath = new File(filePathName);// 上传地址
281                 fileUpload.transferTo(filePath);
282 
283                 int index = filePathName.indexOf("attachments");
284                 String downfielNamePath = filePathName.substring(index);
285                 jsonResult = JsonHelper.outResult(true, "{filePathName:\"/" + downfielNamePath + "\",fileName:\"" + fileUpload.getOriginalFilename() + "\"}");
286 
287             } catch (RuntimeException | IOException ex) {
288                 jsonResult = JsonHelper.outResult(false, "上传失败");
289                 LogUtil.writeLog(ex.toString());
290             }
291         } else {
292             jsonResult = JsonHelper.outResult(false, "请选择要上传的文件");
293         }
294         JsonHelper.write(response, jsonResult);
295     }
296 
297     /**
298      * 附件下载
299      * @param authorJson
300      * @param parmJson
301      * @param request
302      * @param response
303      */
304     @RequestMapping("downloadFile")
305     public void downloadFile(String authorJson, String parmJson, HttpServletRequest request, HttpServletResponse response) {
306         try {
307             JSONObject jsonJSONObject = JSONObject.fromObject(parmJson);
308             AuthorEntity authorEntity = JsonHelper.jsonToObject(authorJson, AuthorEntity.class);
309             // String fileName = JsonHelper.getString(jsonJSONObject,
310             // "fileName");
311             String filePath = JsonHelper.getString(jsonJSONObject, "filePath");
312             String path = AppUtil.getWebRootPath() + filePath;
313             String fileName = new String(path.getBytes("iso8859-1"), "UTF-8");
314             File file = new File(fileName);
315             if (!file.exists()) {
316                 response.setStatus(404);
317                 String jsonResult = JsonHelper.outResult(false, "404 file not found!");
318                 JsonHelper.write(response, jsonResult);
319                 return;
320             }
321             // response.setCharacterEncoding("utf-8");
322             // response.setContentType("multipart/form-data");
323             // response.setHeader("Content-Disposition", "attachment;fileName="
324             // + fileName);
325             InputStream inputStream = new FileInputStream(file);
326             OutputStream os = response.getOutputStream();
327             byte[] b = new byte[1024];
328             int length;
329             while ((length = inputStream.read(b)) > 0) {
330                 os.write(b, 0, length);
331             }
332             inputStream.close();
333         } catch (Exception ex) {
334             LogUtil.writeLog(ex.toString());
335             response.setStatus(500);
336             ex.printStackTrace();
337             String jsonResult = JsonHelper.outResult(false, "500 err "+ex.getMessage());
338             JsonHelper.write(response, jsonResult);
339         }
340     }
341 }

客户端调用示例

  1 package com.f2bpm.restfullapi;
  2 
  3 import java.util.HashMap;
  4 import java.util.Map;
  5 
  6 import org.apache.http.client.HttpClient;
  7 import org.apache.http.client.methods.HttpPost;
  8 import org.apache.http.impl.client.DefaultHttpClient;
  9 
 10 import com.f2bpm.base.core.utils.Guid;
 11 import com.f2bpm.base.core.utils.HttpClientUtil;
 12 import com.f2bpm.base.core.utils.string.StringUtil;
 13 
 14 public class WorkflowBusinessTestClient {
 15 
 16     String webApiUrl = "http://localhost:8081/f2bpm/restfullapi";
 17     
 18     /**
 19      * get请求 get只适合参数相对简单的请求,如果参数过长或参数字符复杂,则使用Post 来传参请求
 20      * 这里仅是一个get示例,不建议使用get统一使用Post来做 不建议使用get统一使用Post来做 不建议使用get统一使用Post来做
 21      * 不建议使用get统一使用Post来做
 22      */
 23     public void getTask() {
 24         String url = webApiUrl + "/workflowBusiness/getTask?";
 25         String queryString="id=123";
 26         String param = HttpClientUtil.urlEncode(queryString.toString()); // 特殊字符进行转义
 27         url = url + param;
 28         String jsonRes = HttpClientUtil.get(url);
 29         System.out.println(jsonRes);
 30     }
 31 
 32 
 33 //    public void getTodoList() {
 34 //        String urlString = webApiUrl + "/workflowBusiness/getTodoList/?";
 35 //        StringBuilder queryString = new StringBuilder();
 36 //        queryString.append(StringUtil.format("authorJson={loginAccount:\"{0}\"}", "admin"));
 37 //        queryString.append(StringUtil.format("&parmJson={pageIndex:{0},pageSize:{1},sort:\"{2}\",order:\"{3}\"}", 1, 2, "CreatedTime", "desc"));
 38 //        String param = HttpClientUtil.urlEncode(queryString.toString()); // 特殊字符进行转义
 39 //        urlString = urlString + param;
 40 //        String jsonRes = HttpClientUtil.get(urlString);
 41 //        System.out.println(jsonRes);
 42 //    }
 43     
 44     /**
 45      * 获取待办列表
 46      */
 47     public void getTodoList() {
 48         String  url= webApiUrl + "/workflowBusiness/getTodoList/";
 49         Map<String, String> params = new HashMap<String, String>();
 50         StringBuilder queryString = new StringBuilder();
 51         params.put("authorJson", StringUtil.format("{loginAccount:\"{0}\"}", "admin"));
 52         params.put("parmJson", StringUtil.format("{pageIndex:{0},pageSize:{1},sort:\"{2}\",order:\"{3}\",whereStr:\"{4}\",}", 1, 2, "CreatedTime", "desc", ""));
 53         String jsonRes = HttpClientUtil.post(url, params);
 54         System.out.println(jsonRes);
 55     }
 56     /**
 57      * 获取已办列表
 58      */
 59     public void getDoneList() {
 60         String urlString = webApiUrl + "/workflowBusiness/getDoneList/";
 61         Map<String, String> params = new HashMap<String, String>();
 62         StringBuilder queryString = new StringBuilder();
 63         params.put("authorJson", StringUtil.format("{loginAccount:\"{0}\"}", "admin"));
 64         // isHistory:0 进行中的已办,isHistory:1流程已结束并归档的已办
 65         params.put("parmJson", StringUtil.format("{isHistory:0,pageIndex:{0},pageSize:{1},sort:\"{2}\",order:\"{3}\",whereStr:\"{4}\",}", 1, 2, "CreatedTime", "desc", ""));
 66         String jsonRes = HttpClientUtil.post(urlString, params);
 67         System.out.println(jsonRes);
 68     }
 69 
 70     /**
 71      * 发起流程
 72      */
 73     public void startWorkflow() {
 74         String urlString = webApiUrl + "/workflowBusiness/startWorkflow/";
 75         Map<String, String> params = new HashMap<String, String>();
 76         String onlineFormData = StringUtil.format("[{\"mainTable\":\"csb\",\"data\":[{\"name\":\"csb.nl\",\"value\":\"22\"},{\"name\":\"csb.MyId\",\"value\":\"\"},{\"name\":\"csb.zz\",\"value\":\"RestFull测试\"},{\"name\":\"csb.xm\",\"value\":\"RestFull姓名\"}],\"subTables\":[]}]");
 77         params.put("authorJson", StringUtil.format("{loginAccount:\"{0}\"}", "admin"));
 78         params.put("parmJson", StringUtil.format("{appId:\"{0}\",wiid:\"{1}\",businessKey:\"{2}\",title:\"{3}\",opinion:\"{4}\",jsonFormData:{5}}", "ZX", Guid.getGuid(), Guid.getGuid(), "应用端RestFull请求测试", "同意", onlineFormData));
 79         // String param = HttpClientUtil.urlEncode(queryString.toString());
 80         // //特殊字符进行转义
 81         String jsonRes = HttpClientUtil.post(urlString, params);
 82         System.out.println(jsonRes);
 83     }
 84 
 85     /**
 86      * 驳回到提单
 87      */
 88     public void rejectFlow() {
 89         String urlString = webApiUrl + "/workflowBusiness/rejectFlow/";
 90         Map<String, String> params = new HashMap<String, String>();
 91         params.put("authorJson", StringUtil.format("{loginAccount:\"{0}\"}", "admin"));
 92         params.put("parmJson", StringUtil.format("{taskId:\"{0}\",opinion:\"{1}\"}", "d212c718-b6ea-481e-b7cc-1f44a9d47fd0", "驳回"));
 93         String jsonRes = HttpClientUtil.post(urlString, params);
 94         System.out.println(jsonRes);
 95     }
 96 
 97     /**
 98      * 作废工单
 99      */
100     public void invalidFlow() {
101         String urlString = webApiUrl + "/workflowBusiness/invalidFlow/";
102         Map<String, String> params = new HashMap<String, String>();
103         params.put("authorJson", StringUtil.format("{loginAccount:\"{0}\"}", "admin"));
104         params.put("parmJson", StringUtil.format("{taskId:\"{0}\",opinion:\"{1}\"}", "eac4e893-822c-46ec-9ba6-a1c028a1cef3", "作废"));
105         String jsonRes = HttpClientUtil.post(urlString, params);
106         System.out.println(jsonRes);
107     }
108 
109     /**
110      * 审批执行代办任务
111      */
112     public void approvalTask() {
113         String urlString = webApiUrl + "/workflowBusiness/approvalTask/";
114         Map<String, String> params = new HashMap<String, String>();
115         params.put("authorJson", StringUtil.format("{loginAccount:\"{0}\"}", "admin"));
116         params.put("parmJson", StringUtil.format("{taskId:\"{0}\",opinion:\"{1}\"}", "5f267057-ddd4-470a-bca4-a797caac3e09", "原则同意"));
117         String jsonRes = HttpClientUtil.post(urlString, params);
118         System.out.println(jsonRes);
119     }
120 
121 
122     /**
123      *上传在线表单附件,返回字段值单个附件值
124     /表单附件的字段值格式:
125     /#[{"value":"/attachments/workflow/files/20170714215204767.txt","text":"TestClient.txt"}]#
126     */
127     public void uploadFormFile() {
128         String urlString = webApiUrl + "/workflowBusiness/uploadFile/?loginAccount=admin";
129         String filepath = "C:\\Users\\Administrator\\Desktop\\TestClient.txt";
130         String jsonRes = HttpClientUtil.postFile(urlString, filepath);
131         System.out.println(jsonRes);
132     }
133     /**
134      * 下载表单附件
135      */
136     public void downLoadFile() {
137         String urlString = webApiUrl + "/workflowBusiness/downloadFile/";
138         //保存到本地的地址
139         String filepath = "C:\\Users\\Administrator\\Desktop\\TestClient.txt";
140         
141         Map<String, String> params = new HashMap<String, String>();
142         params.put("authorJson", StringUtil.format("{login Account:\"{0}\"}", "admin"));
143         params.put("parmJson", StringUtil.format("{filePath:\"{0}\"}", "/attachments/workflow/files/20170714215204767.txt"));
144         String jsonRes = HttpClientUtil.downLoadFile(urlString,filepath, params);
145         System.out.println(jsonRes);
146         
147     }
148     
149     public static void main(String[] args) {
150         WorkflowBusinessTestClient client = new WorkflowBusinessTestClient();
151         client.downLoadFile();
152         System.out.print("结束");
153     }
154 
155 }

 

客户端Get请求  

/**
     * get请求 get只适合参数相对简单的请求,如果参数过长或参数字符复杂,则使用Post 来传参请求
     */
    public void getTodoList() {
        String urlString = webApiUrl + "/workflowBusiness/getTodoList/?";
        StringBuilder queryString = new StringBuilder();
        queryString.append(StringUtil.format("authorJson={loginAccount:\"{0}\"}", "admin"));
        queryString.append(StringUtil.format("&parmJson={pageIndex:{0},pageSize:{1},sort:\"{2}\",order:\"{3}\"}", 1, 2, "CreatedTime", "desc"));
        String param = HttpClientUtil.urlEncode(queryString.toString()); // 特殊字符进行转义
        urlString = urlString + param;
        String jsonRes = HttpClientUtil.get(urlString);
        System.out.println(jsonRes);
    } 

相应的流程基本服务端

// 获取待办列表
    @RequestMapping(value = "getTodoList", method = RequestMethod.GET)
    public void getTodoList(String authorJson, String parmJson, HttpServletRequest request, HttpServletResponse response) throws Exception {
        JSONObject jsonJSONObject = JSONObject.fromObject(parmJson);
        PageParams pageParams = JsonHelper.jsonToObject(parmJson, PageParams.class);
        AuthorEntity authorEntity = JsonHelper.jsonToObject(authorJson, AuthorEntity.class);
        String loginAccount = authorEntity.getLoginAccount();
        MyInteger recordCount = new MyInteger(0);
        MyInteger pageCount = new MyInteger(0);
        String whereStr = JsonHelper.getString(jsonJSONObject, "whereStr");
        IUser user = userService.getUserByAccount(loginAccount);
        List<TaskInstanceInfo> list = WorkflowAPI.getWorkTaskManager().getTodoList(user.getUserId(), whereStr.toString(), pageParams.getOrderBy(), pageParams.getPageIndex(), pageParams.getPageSize(), pageCount, recordCount, true);
        String jsonString = JsonHelper.listToJSON(list);
        String jsonResult = JsonHelper.convertToEasyUIJsonResult(jsonString, pageParams.getPageSize(), pageParams.getPageIndex(), recordCount.getValue(), pageCount.getValue());
        JsonHelper.write(response, jsonResult);
    }

 

authorJson:主假如接口地点的印证相关参数,校验访问者的根源合法性

4. 施用统1位事系统用户服务器格局

 图片 4

 

 

选取统一个人事用户系统形式是最复杂但也是总体集团音讯化条件相比较好的办法,一般选拔于相比大的公司公司,他们的性状是数据库和次序都是单身计划,流程基本与使用系统利用分别的数据库,同时各使用体系都以联合接纳H本田CR-V系统的用户组织架构。

此时代时尚程基本本人数据库中的用户组织架构管理仅是作为流程基本平台管理员使用的用户协会,用于登录维护管理流程基本相关的事情。流程基本的用户组织与利用种类的用户组织非亲非故。

而当调用流程基本推行流程流转时用户组织是透过重写F2用户组织架构接口的落到实处读取应用系统的用户组织架构,如故采用的是应用类别本人的用户组织架构。流程引擎使用的是重写完毕组织接口的接纳系列本人的用户组织框架结构,用户组织框架结构的护卫管理还是是由运用种类自身来保管。

因公司新闻化条件差异大,此方案需求各方共同共同实践才能达标相比好的作用。大家可以合营实施。

 

5.1. 什么是OAuth2.0

OAuth2.0是一个有关授权(authorization)的怒放网络正式,在中外得到广泛应用,近期的本子是2.0版。本文是对OAuth
2.0的安插性思路和平运动转规律应用到F2BPM平西安,指标是为了防范接口被不安全使用,接口的调用必须有安全的身份申明机制。

现阶段更为多的卖家架构化解方案特别趋向于基于http协议“微服务”访问跨系统调用,而不行使统传的WebService调用,即因而RESTfull情势展开互动,越发轻量整合调用特别有利于。本文书档案中全部F2BPM开发接口API都得以发表成RESTfull对外应用服务接口

1用到方案情势

由于集团的IT建设的环境不心相同,构建流程基本的方案也会有所差异,由于单独安顿面临的一个最大标题就:用户组织架构难点、登录授权身份问题。所以会有两样的营业所IT环境会有例外的运用方案方式。

  • 方案形式一:流程基本和应用系列同步相同数据库,程序独立布署格局
  • 方案形式二:流程基本和行使类别的数据库和程序都是独立安插格局
  • 方案情势三:有联合人事系统用户认证服务器,流程基本和利用系统的数据库和程序都是单身安排

 

Post请求来赢得已办列表

   /**
     * post请求,参数复杂的建议使用Post来请求
     */
    public void getDoneList() {
        String urlString = webApiUrl + "/workflowBusiness/getDoneList/";
        Map<String, String> params = new HashMap<String, String>();
        StringBuilder queryString = new StringBuilder();
        params.put("authorJson", StringUtil.format("{loginAccount:\"{0}\"}", "admin"));
        // isHistory:0 进行中的已办,isHistory:1流程已结束并归档的已办
        params.put("parmJson", StringUtil.format("{isHistory:0,pageIndex:{0},pageSize:{1},sort:\"{2}\",order:\"{3}\",whereStr:\"{4}\",}", 1, 2, "CreatedTime", "desc", ""));
        String jsonRes = HttpClientUtil.post(urlString, params);
        System.out.println(jsonRes);
    }

// 流程中心服务-已办列表
    @RequestMapping(value = "getDoneList", method = RequestMethod.POST)
    public void getDoneList(String authorJson, String parmJson, HttpServletRequest request, HttpServletResponse response) throws Exception {
        JSONObject jsonJSONObject = JSONObject.fromObject(parmJson);
        PageParams pageParams = JsonHelper.jsonToObject(parmJson, PageParams.class);
        AuthorEntity authorEntity = JsonHelper.jsonToObject(authorJson, AuthorEntity.class);
        String loginAccount = authorEntity.getLoginAccount();
        MyInteger recordCount = new MyInteger(0);
        MyInteger pageCount = new MyInteger(0);
        String whereStr = JsonHelper.getString(jsonJSONObject, "whereStr");
        int isHistory = JsonHelper.getInt(jsonJSONObject, "isHistory");
        IUser user = userService.getUserByAccount(loginAccount);
        List<TaskInstanceInfo> list =null;
        if(isHistory==1){
            //归档中的列表
              list = WorkflowAPI.getHistoryDataManager().getHistoryDoneList(user.getUserId(), whereStr.toString(), pageParams.getOrderBy(), pageParams.getPageIndex(), pageParams.getPageSize(), pageCount, recordCount, true);
        }else {
            //进行中的已办
             list = WorkflowAPI.getWorkTaskManager().getDoneList(user.getUserId(), whereStr.toString(), pageParams.getOrderBy(), pageParams.getPageIndex(), pageParams.getPageSize(), pageCount, recordCount, true);
        }

        String jsonString = JsonHelper.listToJSON(list);
        String jsonResult = JsonHelper.convertToEasyUIJsonResult(jsonString, pageParams.getPageSize(), pageParams.getPageIndex(), recordCount.getValue(), pageCount.getValue());
        JsonHelper.write(response, jsonResult);
    }

 输出响应结果到客户端

{"success":true,"msg":"","total":4,"pageCount":2,"pageSize":2,"pageIndex":1, "rows":[{"isDelegateDone":false,"workflowTitle":"[系统管理员费用报销申请","directBackAct":"","expectFinishedTime":
{"time":0,"minutes":0,"seconds":0,"hours":8,"month":0,"year":70,"timezoneOffset":-480,"day":4,"date":1},"businessKey":"","delegatorUserId":"","respondType":"","delegatorRealName":"",
"wiState":0,"taskExpireTime":null,"mainActivityInstanceId":"","urgency":1,"activityId":"","extStr":"","formId":"bdd11478-97ab-4612-beb9-575a3b3d9e83","description":"","userId":"3c1df0b3-a4d9-4731-b143-02e81bce17ce",
"delegatorName":"","userName":"","opinion":"","taskDealHours":0,"appType":"表单规则2.0","isCirculated":false,"isContainDelegator":false,"currentActors":"","fromCreatorID":"","taskCreateType":"","currentActivityName":"",
"openBizDate":"","isReferred":false,"delegatorMobile":"","importance":1,"workflowInstanceState":2,"activityShowName":"","userMobile":"","creatorRealName":"系统管理员","userDpId":"","taskState":0,"isValid":false,"userDpName":"",
"appId":"AI","formType":"","workflowInstanceId":"5e2cfc5b-3fcb-4ae5-ae1d-fbdb27b4980e","creatorDepartId":"ZhiBoRuanJian","fromTaskId":"","activityInstanceId":"","taskSeq":"","creator":"admin","realTime":null,
"isCompleter":false,"completedType":"","delegatorDpName":"","finishedTime":null,"isMobileApproval":true,"stepId":0,"delegatorDpId":"","isMobileStart":true,"taskId":"","requirement":"",
"createdTime":{"time":1499268876000,"minutes":34,"seconds":36,"hours":23,"month":6,"year":117,"timezoneOffset":-480,"day":3,"date":5},"logs":"","creatorId":"3c1df0b3-a4d9-4731-b143-02e81bce17ce",
"taskRemark":"","secrecy":0,"commentCount":0,"mainWorkflowInstanceId":"","appName":"费用报销申请","sheetId":"AI20170705233435818","completedTime":null,"isDelegatorCompleted":false,"workflowId":"3944ea6b-0c56-4c74-8b0e-af82d128f772",
"urgeTimes":0,"creatorDpName":"致博软件","fromCreator":"","realName":"","activityName":"","startedTime":{"time":1499268876000,"minutes":34,"seconds":36,"hours":23,"month":6,"year":117,
"timezoneOffset":-480,"day":3,"date":5}},{"isDelegateDone":false,"workflowTitle":"系统管理员请假申请","directBackAct":"","expectFinishedTime":{"time":0,"minutes":0,"seconds":0,"hours":8,"month":0,"year":70,"timezoneOffset":-480,"day":4,"date":1},"businessKey":"","delegatorUserId":"","respondType":"","delegatorRealName":"",
"wiState":0,"taskExpireTime":null,"mainActivityInstanceId":"","urgency":1,"activityId":"","extStr":"","formId":"26eaad7d-ccfb-4b6a-96c0-4efc796f5d47","description":"","userId":"3c1df0b3-a4d9-4731-b143-02e81bce17ce","delegatorName":"","userName":"","opinion":"","taskDealHours":0,"appType":"表单规则2.0","isCirculated":false,"isContainDelegator":false,"currentActors":"","fromCreatorID":"","taskCreateType":"","currentActivityName":"","openBizDate":"","isReferred":false,"delegatorMobile":"","importance":1,"workflowInstanceState":2,"activityShowName":"","userMobile":"",
"creatorRealName":"系统管理员","userDpId":"","taskState":0,"isValid":false,"userDpName":"",
"appId":"AB","formType":"","workflowInstanceId":"a4d02561-7dc0-4a01-9368-687363081395","creatorDepartId":"ZhiBoRuanJian","fromTaskId":"",
"activityInstanceId":"","taskSeq":"","creator":"admin","realTime":null,"isCompleter":false,"completedType":"","delegatorDpName":"","finishedTime":null,"isMobileApproval":true,"stepId":0,"delegatorDpId":"","isMobileStart":true,"taskId":"","requirement":"","createdTime":{"time":1499268669000,"minutes":31,"seconds":9,"hours":23,"month":6,"year":117,"timezoneOffset":-480,"day":3,"date":5},"logs":"","creatorId":"3c1df0b3-a4d9-4731-b143-02e81bce17ce","taskRemark":"","secrecy":0,"commentCount":0,"mainWorkflowInstanceId":"",
"appName":"请假申请","sheetId":"AB20170705233109293","completedTime":null,"isDelegatorCompleted":false,
"workflowId":"4ae848a4-70f7-4e76-bd35-8f33f5bbac1e","urgeTimes":0,"creatorDpName":"致博软件","fromCreator":"","realName":"","activityName":"",
"startedTime":{"time":1499268669000,"minutes":31,"seconds":9,"hours":23,"month":6,"year":117,"timezoneOffset":-480,"day":3,"date":5}}]}

 

1.1. 施用背景

图片 5

整日公司的IT系统建设进一步多,往往3个小卖部中形成各类独立的系统,各系统相对独立,缺少流程支掌,为达到通过创设流程服务核心向所在应用连串提供流程服务,同时将依次独立的系统以流程基本为扭带链接起来。

流程基本仅是当做后台管理,对于用户来说并不需求登录此平台上做连锁的作业操作管理。流程基本作为利用系统的服务端,应用系列作为客户端。流程基本相对前端的客户的话是一个黑盒方式。

F2BPM流程服务为主(简称:F2流程大旨),是指将F2-BPM做为流程平台独立布署成流程大旨的形式,别的应用系统调用F2流程服务焦点开始展览流程流转的运用情状。

由于各样集团本人的IT系统应用环境千差万别,本文书档案给出F2流程主题利用到集团中作为流程基本的常见应用消除方案。

时下越来越多的卖家架构消除方案尤其趋向于基于http协议“微服务”框架结构,即经过RESTfull方式展开互动,特别轻量整合调用更上方便。F2流程中央利用方案也是提议选取轻量级的RESTfull方案。

2. 共用数据库情势

 图片 6

 

共用数据库格局是指流程基本与运用种类利用同一的数据,将流程基本的具有表建包蕴流程基本平台用户协会表都创造在运用系统所在的数据库中。

那会儿流程基本的用户协会架构管理仅是当做流程基本平台管理员使用的用户协会,用于登录维护管理流程基本相关的事情。流程基本的用户协会与利用种类的用户协会无关。而当调用流程基本实行流程流转时用户组织是经过引擎的用户组织架构接入的布署读取应用系统的用户协会,还是选拔的是利用种类自身的用户协会架构。流程引擎使用的是选择系统自个儿的用户协会架构,用户组织架构的保险管理照旧是由使用系统本身来治本。

RESTfull的数额交互机制详细见Oauth2.0接口交互授权。

 

1. 引言

5. RESTfull接口的OAuth2.0身价授权