o2oa使用手册
第1章 功能简介及概述
第6章 平台部署与配置
  • 6.1 安装部署-在windows系统中部署o2oa开发平台
  • 6.2 安装部署-在linux系统中部署o2oa开发平台
  • 6.3 安装部署-通过docker hub快速部署docker镜像
  • 6.4 安装部署-在宝塔/phpstudy中部署o2oa开发平台
  • 6.5 安装部署-o2oa开发平台之http端口规划
  • 6.6 安装部署-平台服务器版本升级操作说明
  • 6.7 安装部署-私有化部署服务器架构推荐
  • 6.8 安装部署-o2oa开发平台集群部署配置及操作说明
  • 6.9 安装部署-在线部署自定义应用的war包和jar包
  • 6.10 服务器配置与管理-​o2oa主要配置文件说明
  • 6.11 服务器配置与管理-服务器端口冲突和端口修改
  • 6.12 服务器配置与管理-如何修改服务器内存占用率?
  • 6.13 服务器配置与管理-如何访问和操作h2内置数据库
  • 6.14 服务器配置与管理-​如何在o2oa中使用mysql数据库?
  • 6.15 服务器配置与管理-如何修改平台支持的数据库驱动包
  • 6.16 服务器配置与管理-o2oa使用opengauss(华为高斯数据库)配置
  • 6.17 服务器配置与管理-o2oa开发平台平台数据库配置信息样例
  • 6.18 服务器配置与管理-配置o2oa服务器连接o2云
  • 6.19 服务器配置与管理-o2oa实现服务器随操作系统自动启动
  • 6.20 服务器配置与管理-文件存储服务器配置
  • 6.21 服务器配置与管理-工作日节假日配置
  • 6.22 服务器配置与管理-为平台增加全文检索功能
  • 6.23 服务器配置与管理-消息提醒配置说明
  • 6.24 服务器配置与管理-自定义消息提醒
  • 6.25 服务器配置与管理-定制消息通知的内容
  • 6.26 服务器配置与管理-消息通知过滤
  • 6.27 服务器配置与管理-为待办创建配置邮件通知
  • 6.28 服务器配置与管理-待办待阅数据的查询操作和管理
  • 6.29 服务器配置与管理-​自动执行平台数据的备份与恢复
  • 6.30 服务器配置与管理-数据导出导入与系统数据备份
  • 6.31 ​服务器配置与管理-定期自动执行数据备份与恢复
  • 6.32 系统安全-o2oa作为认证中心实现基于oauth2单点认证
  • 6.33 系统安全-o2oa基于nginx的ssl跳转、转发配置
  • 6.34 o2oa(翱途)开发平台如何基于nginx上下文分发的方式快速集群部署
  • 6.35 系统安全-访问日志相关配置
  • 6.36 系统架构-平台集群化部署之基于nginx端口分发机制实现集群部署
  • 6.37 系统安全-审计日志相关配置
  • 6.38 系统安全-平台日志文件说明
  • 6.39 系统架构-基于nginx快速集群部署-上下文分发
  • 6.40 系统安全-o2oa日志输出设置log4j2.xml
  • 6.41 系统安全-用户密码初始化规则的设定
  • 6.42 系统安全-启用https(百度云版)
  • 6.43 系统安全-启用https(腾讯云版)
  • 6.44 系统安全-自签名ssl证书验证https功能
  • 6.45 系统安全-登录密码rsa加密
  • 6.46 系统安全-用户登录ip限制
  • 6.47 系统安全-在用户登录过程中启用图形验证码
  • 6.48 系统安全-平台部署之使用非root用户运行服务
  • 6.49 系统安全-o2server启用国密加密设置
  • 6.50 系统安全-日志应用使用说明
  • 6.51 系统安全-用户重置密码操作
  • 6.52 系统安全-超级管理员(xadmin)密码修改
  • 6.53 系统安全-使用web端运行服务器管理命令
  • 6.54 系统安全-o2server无法正常显示验证码解决办法
  • 6.55 o2oa(翱途)开发平台前端安全配置建议(一)
  • 第16章 开发知识及常见问题
  • 16.1 o2oa如何实现文件跨服务器的备份
  • 16.2 o2oa(翱途)服务器故障排查
  • 16.3 开发知识-让后端代理/接口脚本编写也能像前端一样用上debugger
  • 16.4 常见问题-sqlserver中创建新数据库使用哪个中文编码?
  • 16.5 o2oa(翱途)流程引擎中如何修改,定制流程的流转记录
  • 16.6 mysql数据库备份
  • 16.7 domain不正确的时候如何强制设置成正确的
  • 16.8 配置文件中使用密文存储密码
  • 16.9 常见问题-连接mysql出现 public key retrieval is not allowed 的错误
  • 16.10 常见问题-查看表结构
  • 16.11 常见问题-7.2及以上版本开启web代理后请求中没有正确使用web端口问题解决方式
  • 16.12 linux环境libreoffice安装及使用
  • 16.13 在o2oa中使用网络会议(二):openmeetings与o2oa认证配置
  • 16.14 在o2oa中使用网络会议(一):openmeetings-5.1.0亲手安装整理 step-by-step
  • 16.15 藕粉社区问答系列1
  • 16.16 藕粉社区问答系列2
  • 16.17 藕粉社区问答系列3
  • 16.18 快速入门-平台相关资料汇总
  • 16.19 快速入门-服务器总体介绍汇总
  • 16.20 快速入门-流程表单载入基础数据
  • 16.21 快速入门-常用表单脚本样例汇总
  • 16.22 快速入门-自定义表数据分页样例
  • 16.23 云服务器-阿里云ecs服务器的端口启用
  • 16.24 开发知识-react篇:在o2oa平台框架中使用react
  • 16.25 开发知识-react篇:在o2oa门户页面中使用react
  • 16.26 开发知识-vue篇:在vue应用中集成o2oa
  • 16.27 开发知识-vue篇:使用vue-cli开发o2应用
  • 16.28 开发知识-vue篇:在o2门户页面中使用vue
  • 16.29 平台中使用druid数据库连接及监控
  • 16.30 开发知识-在paas平台上部署o2oa开发平台
  • 16.31 开发知识-如何使用tomcat架设webdav服务器
  • 16.32 开发知识-单个端口模式的nginx和系统配置
  • 16.33 开发知识-linux非root用户如何使用80端口启动o2oa
  • 16.34 开发知识-o2oa平台启用eruda进行移动端调试
  • 16.35 开发知识-神通数据库安装
  • 16.36 开发知识-人大金仓数据安装
  • 16.37 开发知识-中标麒麟安装达梦数据库(dm8)
  • 16.38 开发知识-中标麒麟安装人大金仓详细步骤
  • 16.39 开发知识-使用vnc连接中标麒麟v7操作系统
  • 16.40 开发知识-鲲鹏(arm)麒麟操作系统如何替换yum源?
  • 16.41 开发知识-数据优化知识点
  • 16.42 水印安全-附件水印|加密|文档格式转换图片|pdf
  • 16.43 消息队列-配置activemq、kafka消息队列
  • 16.44 常见问题-数据导出或者导入时发生oom异常
  • 16.45 常见问题-如何让用户在首次登录时,必须对初始密码进行修改
  • 16.46 常见问题-如何在模块部署中控制模块的访问权限
  • 16.47 常见问题-如何在平台中开发ftp文件上传文件的服务?
  • 16.48 常见问题-如何使用服务管理调用webservice
  • 16.49 常见问题-如何使用脚本调用外部服务
  • 16.50 常见问题-如何使用脚本控制流程自动流转
  • 16.51 常见问题-如何通过脚本调用系统内服务
  • 16.52 常见问题-接口代码疑惑解答汇总
  • 16.53 常见问题:maven编译o2server错误: java heap space
  • 16.54 常见问题-集群配置后启动报错:nullpointerexception
  • 16.55 常见问题-服务器错误:can not decrypt token
  • 16.56 常见问题-ios移动办公无法收到验证码
  • 16.57 常见问题-服务器和日志时间相差12小时的问题
  • 16.58 常见问题-为什么127.0.0.1可以访问但其他ip无法访问
  • 16.59 藕粉社区问答系列4
  • 16.60 开发知识-react篇:在react应用中集成o2oa

  • 服务集成-九游会官网登录入口网页

    时间:2022-08-03   

    九游会官网登录入口网页-ag8九游会j9登录入口允许用户自行修改源码或者增加源码来扩展系统服务,也可以包装功能更强的业务服务。本文主要介绍如何在java代码中通过接口从第三方应用系统启动九游会官网登录入口网页-ag8九游会j9登录入口中的业务流程(通过第三方调用启动流程)

    总体思络: 先用户单点获取token(因为创建流程、上传附件接口需要身份认证),接着创建流程,然后上传附件到流程实例。

    一、完整样例代码

    代码如下:

    import java.io.bufferedreader;
    import java.io.bytearrayoutputstream;
    import java.io.file;
    import java.io.fileoutputstream;
    import java.io.ioexception;
    import java.io.inputstream;
    import java.io.inputstreamreader;
    import java.io.printwriter;
    import java.net.url;
    import java.net.urlconnection;
    import java.util.arraylist;
    import java.util.date;
    import java.util.hashmap;
    import java.util.linkedhashmap;
    import java.util.list;
    import java.util.map;
    import java.util.set;
    import java.util.concurrent.executorservice;
    import java.util.concurrent.executors;
    import org.apache.commons.io.ioutils;
    import org.apache.http.httpentity;
    import org.apache.http.namevaluepair;
    import org.apache.http.client.entity.urlencodedformentity;
    import org.apache.http.client.methods.closeablehttpresponse;
    import org.apache.http.client.methods.httpget;
    import org.apache.http.client.methods.httppost;
    import org.apache.http.entity.contenttype;
    import org.apache.http.entity.stringentity;
    import org.apache.http.entity.mime.multipartentitybuilder;
    import org.apache.http.entity.mime.content.filebody;
    import org.apache.http.entity.mime.content.stringbody;
    import org.apache.http.impl.client.closeablehttpclient;
    import org.apache.http.impl.client.httpclients;
    import org.apache.http.message.basicnamevaluepair;
    import org.apache.http.util.entityutils;
    import com.google.gson.jsonarray;
    import com.google.gson.jsonobject;
    import com.google.gson.jsonparser;
    public class httpclientutil {
    public static final int thread_pool_size = 5;
    public interface httpclientdownloadprogress {
    	public void onprogress(int progress);
    }
    private static httpclientutil httpclientdownload;
    private executorservice downloadexcutorservice;
    private httpclientutil() {
    	downloadexcutorservice = executors.newfixedthreadpool(thread_pool_size);
    }
    public static httpclientutil getinstance() {
    	if (httpclientdownload == null) {
    		httpclientdownload = new httpclientutil();
    	}
    	return httpclientdownload;
    }
    /**
     * @param url
     * @param filepath
     */
    public void download(final string url, final string filepath) {
    	downloadexcutorservice.execute(new runnable() {
    		@override
    		public void run() {
    			httpdownloadfile(url, filepath, null, null);
    		}
    	});
    }
    /**
     *
     * @param url
     * @param filepath
     * @param progress
     */
    public void download(final string url, final string filepath, final httpclientdownloadprogress progress) {
    	downloadexcutorservice.execute(new runnable() {
    		@override
    		public void run() {
    			httpdownloadfile(url, filepath, progress, null);
    		}
    	});
    }
    /**
     * @param url
     * @param filepath
     */
    private void httpdownloadfile(string url, string filepath, httpclientdownloadprogress progress,
    		map headmap) {
    	closeablehttpclient httpclient = httpclients.createdefault();
    	try {
    		httpget httpget = new httpget(url);
    		setgethead(httpget, headmap);
    		closeablehttpresponse response1 = httpclient.execute(httpget);
    		try {
    			system.out.println(response1.getstatusline());
    			httpentity httpentity = response1.getentity();
    			long contentlength = httpentity.getcontentlength();
    			inputstream is = httpentity.getcontent();
    			bytearrayoutputstream output = new bytearrayoutputstream();
    			byte[] buffer = new byte[4096];
    			int r = 0;
    			long totalread = 0;
    			while ((r = is.read(buffer)) > 0) {
    				output.write(buffer, 0, r);
    				totalread  = r;
    				if (progress != null) {
    					progress.onprogress((int) (totalread * 100 / contentlength));
    				}
    			}
    			fileoutputstream fos = new fileoutputstream(filepath);
    			output.writeto(fos);
    			output.flush();
    			output.close();
    			fos.close();
    			entityutils.consume(httpentity);
    		} finally {
    			response1.close();
    		}
    	} catch (exception e) {
    		e.printstacktrace();
    	} finally {
    		try {
    			httpclient.close();
    		} catch (ioexception e) {
    			e.printstacktrace();
    		}
    	}
    }
    /**
     * @param url
     * @return
     */
    public string httpget(string url) {
    	return httpget(url, null);
    }
    /**
     * http get
     *
     * @param url
     * @return
     */
    public string httpget(string url, map headmap) {
    	string responsecontent = null;
    	closeablehttpclient httpclient = httpclients.createdefault();
    	try {
    		httpget httpget = new httpget(url);
    		closeablehttpresponse response1 = httpclient.execute(httpget);
    		setgethead(httpget, headmap);
    		try {
    			httpentity entity = response1.getentity();
    			responsecontent = getrespstring(entity);
    			entityutils.consume(entity);
    		} finally {
    			response1.close();
    		}
    	} catch (exception e) {
    		e.printstacktrace();
    	} finally {
    		try {
    			httpclient.close();
    		} catch (ioexception e) {
    			e.printstacktrace();
    		}
    	}
    	return responsecontent;
    }
    public string httppost(string url, map paramsmap) {
    	return httppost(url, paramsmap, null);
    }
    /**
     * @param url
     * @param paramsmap
     * @return
     */
    public string httppost(string url, map paramsmap, map headmap) {
    	string responsecontent = null;
    	closeablehttpclient httpclient = httpclients.createdefault();
    	try {
    		httppost httppost = new httppost(url);
    		setposthead(httppost, headmap);
    		setpostparams(httppost, paramsmap);
    		closeablehttpresponse response = httpclient.execute(httppost);
    		try {
    			httpentity entity = response.getentity();
    			responsecontent = getrespstring(entity);
    			entityutils.consume(entity);
    		} finally {
    			response.close();
    		}
    	} catch (exception e) {
    		e.printstacktrace();
    	} finally {
    		try {
    			httpclient.close();
    		} catch (ioexception e) {
    			e.printstacktrace();
    		}
    	}
    	return responsecontent;
    }
    /**
     * @param httppost
     * @param headmap
     */
    private void setposthead(httppost httppost, map headmap) {
    	if (headmap != null && headmap.size() > 0) {
    		set keyset = headmap.keyset();
    		for (string key : keyset) {
    			httppost.addheader(key, headmap.get(key));
    		}
    	}
    }
    /**
     * 
     *
     * @param httpget
     * @param headmap
     */
    private void setgethead(httpget httpget, map headmap) {
    	if (headmap != null && headmap.size() > 0) {
    		set keyset = headmap.keyset();
    		for (string key : keyset) {
    			httpget.addheader(key, headmap.get(key));
    		}
    	}
    }
    /**
     *
     *
     * @param serverurl       ַ
     * @param localfilepath
     * 
     * @param serverfieldname
     * @param params
     * @return
     * @throws exception
     */
    public string uploadfileimpl(string serverurl, string localfilepath, string serverfieldname,
    		map params, map paramshead) throws exception {
    	string respstr = null;
    	closeablehttpclient httpclient = httpclients.createdefault();
    	try {
    		httppost httppost = new httppost(serverurl);
    		setposthead(httppost, paramshead);
    		filebody binfilebody = new filebody(new file(localfilepath));
    		multipartentitybuilder multipartentitybuilder = multipartentitybuilder.create();
    		multipartentitybuilder.addpart(serverfieldname, binfilebody);
    		setuploadparams(multipartentitybuilder, params);
    		httpentity reqentity = multipartentitybuilder.build();
    		httppost.setentity(reqentity);
    		closeablehttpresponse response = httpclient.execute(httppost);
    		try {
    			httpentity resentity = response.getentity();
    			respstr = getrespstring(resentity);
    			entityutils.consume(resentity);
    		} finally {
    			response.close();
    		}
    	} finally {
    		httpclient.close();
    	}
    	return respstr;
    }
    /**
     * @param multipartentitybuilder
     * @param params
     */
    private void setuploadparams(multipartentitybuilder multipartentitybuilder, map params) {
    	if (params != null && params.size() > 0) {
    		set keys = params.keyset();
    		for (string key : keys) {
    			multipartentitybuilder.addpart(key, new stringbody(params.get(key), contenttype.application_json));
    		}
    	}
    }
    /**
     * string
     *
     * @param entity
     * @return
     * @throws exception
     */
    private string getrespstring(httpentity entity) throws exception {
    	if (entity == null) {
    		return null;
    	}
    	inputstream is = entity.getcontent();
    	stringbuffer strbuf = new stringbuffer();
    	byte[] buffer = new byte[4096];
    	int r = 0;
    	while ((r = is.read(buffer)) > 0) {
    		strbuf.append(new string(buffer, 0, r, "utf-8"));
    	}
    	return strbuf.tostring();
    }
    /**
     * @param httppost
     * @param paramsmap
     * @throws exception
     */
    private void setpostparams(httppost httppost, map paramsmap) throws exception {
    	if (paramsmap != null && paramsmap.size() > 0) {
    		list nvps = new arraylist();
    		set keyset = paramsmap.keyset();
    		for (string key : keyset) {
    			nvps.add(new basicnamevaluepair(key, paramsmap.get(key)));
    		}
    		httppost.setentity(new urlencodedformentity(nvps));
    	}
    }
    public static string sendpost(string url, string token, string paramsstr) throws ioexception, exception {
    	// post请求
    	closeablehttpclient httpclient = httpclients.createdefault();
    	// 请求参数
    	stringentity postingstring = new stringentity(paramsstr, "utf-8");
    	httppost httppost = new httppost(url);
    	httppost.setentity(postingstring);
    	// 请求头设置
    	httppost.addheader("cookie", "x-token="   token);
    	httppost.addheader("accept", "*/*");
    	httppost.addheader("connection", "keep-alive");
    	httppost.addheader("content-type", "application/json; charset=utf-8");
    	httppost.addheader("user-agent", "mozilla/4.0 (compatible; msie 6.0; windows nt 5.1;sv1)");
    	// 执行请求
    	closeablehttpresponse execute = httpclient.execute(httppost);
    	// 处理返回结果
    	string reststr = ioutils.tostring(execute.getentity().getcontent(), "utf-8");
    	return reststr;
    }
    public static string sendpost(string url, string param) {
    	printwriter out = null;
    	bufferedreader in = null;
    	string result = "";
    	try {
    		url realurl = new ;
    		urlconnection conn = realurl.openconnection();
    		conn.setrequestproperty("accept", "*/*");
    		conn.setrequestproperty("connection", "keep-alive");
    		conn.setrequestproperty("content-type", "application/json; charset=utf-8");
    		conn.setrequestproperty("user-agent", "mozilla/4.0 (compatible; msie 6.0; windows nt 5.1;sv1)");
    		conn.setdooutput(true);
    		conn.setdoinput(true);
    		out = new printwriter(conn.getoutputstream());
    		out.print(param);
    		out.flush();
    		in = new bufferedreader(new inputstreamreader(conn.getinputstream()));
    		string line;
    		while ((line = in.readline()) != null) {
    			result  = line;
    		}
    	} catch (exception e) {
    		system.out.println(" post"   e);
    		e.printstacktrace();
    	} finally {
    		try {
    			if (out != null) {
    				out.close();
    			}
    			if (in != null) {
    				in.close();
    			}
    		} catch (ioexception ex) {
    			ex.printstacktrace();
    		}
    	}
    	return result;
    }
    public static void main(string[] args) throws ioexception, exception {
    	string token = "";
    	// 第一步:单点登入
    	string path = "http://127.0.0.1:20020/x_organization_assemble_authentication/jaxrs/sso"; // 单点路径
    	long time = new date().gettime(); // 当前时间
    	string login_uid = "kfry"; // 用户id
    	string sso_key = "12345678"; // 加密密码
    	string xtoken = null;
    	string client = "sso"; // sso配置名称
    	try {
    		xtoken = crypto.encrypt(login_uid   "#"   time, sso_key);
    		system.out.println(xtoken);
    	} catch (exception e1) {
    		e1.printstacktrace();
    	}
    	string string = "{"token": "   xtoken   ", "client": "   client   "}";
    	string str = httpclientutil.getinstance().sendpost(path, string);
    	jsonparser parser = new jsonparser();
    	jsonobject object = null;
    	object = (jsonobject) parser.parse(str);
    	jsonobject value = object.get("data").getasjsonobject();
    	token = value.get("token").getasstring();
    	// 第二步:创建流程
    	string processid = "e4c77038-2964-498f-9d37-1635e26639eb";// 流程id
    	path = "http://127.0.0.1:20020/x_processplatform_assemble_surface/jaxrs/work/process/" processid;// 流程创建路径
    	string datagrid = "{"data": [{"   "      "
    			  "   "col1": { "textfield1": "1" },"
    			  "         "col2": { "textfield2": "2" }," 
    			  "         "col3": { "textfield3": "3" },"
    			  "         "col4": { "textfield4": "4" },"
    			  "         "col5": { "textfield5": "5" }"
    			  "     },"   "     {"
    			  "         "col1": { "textfield1": "11" },"
    			  "         "col2": { "textfield2": "12" }," 
    			  "         "col3": { "textfield3": "13" },"
    			  "         "col4": { "textfield4": "14" }," 
    			  "         "col5": { "textfield5": "15" }"
    			  "     }]}"; // 数据网格数据
    	jsonparser parser1 = new jsonparser();
    	jsonobject jsonobj = parser1.parse(datagrid).getasjsonobject();
    	jsonobject jsonobject = new jsonobject();
    	jsonobject.addproperty("latest", false);
    	jsonobject.addproperty("title", "演示系统grid测试(2021-02-22)");// 标题
    	jsonobject.addproperty("identity", "开发人员@932ca9a4-4c80-4a29-9e44-aed85afe21d3@i"); // 创建者身份
    	jsonobject jsonobjectdata = new jsonobject();
    	jsonobjectdata.addproperty("subject", "演示系统grid测试2021-02-22"); // 标题
    	jsonobjectdata.addproperty("calendar", "2020-04-13 12:00:00");// 表单 上的字段名“calendar”
    	jsonobjectdata.addproperty("explain", "演示系统grid测试"); // 表单 上的字段名“explain”
    	jsonobjectdata.add("datagrid", jsonobj); // 表单上的数据网格
    	jsonobject.add("data", jsonobjectdata);
    	// 创建流程
    	string strflow = httpclientutil.getinstance().sendpost(path, token, jsonobject.tostring());
    	string work = "";
    	// 获取返回的workid
    	jsonparser parser2 = new jsonparser();
    	jsonobject object2 = null;
    	object2 = (jsonobject) parser2.parse(strflow);
    	jsonarray value2 = object2.getasjsonarray("data");
    	object2 = value2.get(0).getasjsonobject();
    	work = object2.get("work").getasstring();
    	system.out.println("work="   work);
    	// 上传附件
    	try {
    		map uploadparams = new linkedhashmap();
    		uploadparams.put("filename", "明天.docx"); // 附件名
    		uploadparams.put("site", "attachment"); // 表单上的附件控件标识
    		uploadparams.put("extraparam", "");
    		map headmap = new hashmap();
    		headmap.put("cookie", "x-token="   token); // 单点token
    		headmap.put("accept", "*/*");
    		headmap.put("connection", "keep-alive");
    		headmap.put("user-agent", "mozilla/4.0 (compatible; msie 6.0; windows nt 5.1;sv1)");
    		string atturl = "http://127.0.0.1:20020/x_processplatform_assemble_surface/jaxrs/attachment/upload/work/"
    				  work;
    		string filepath = "f:download明天.docx";
    		httpclientutil.getinstance().uploadfileimpl(atturl, filepath, "file", uploadparams, headmap);
    	} catch (exception e) {
    		e.printstacktrace();
    	}
    }
    }

    二、功能代码介绍

    第一步:单点登入

    一、创建sso配置,请参考组织管理里中的sso管理

    二、通过下面代码获取token.

    注意:下面代码中要调整的内容如下:
    “path”:单点路径要根据实际服务器ip调整;

    “login_uid”:单点用户id;

    “sso_key”:加密解密密码;

    “client”:sso配置名称;

           string token = "";
            //第一步:单点登入
            string path = "http://127.0.0.1:20020/x_organization_assemble_authentication/jaxrs/sso"; //单点路径
            long time = new date().gettime(); //当前时间
            string login_uid = "kfry"; //用户id
            string sso_key = "12345678"; //加密密码
            string xtoken = null;
            string client = "sso"; //sso配置名称
    		try {
    			xtoken = crypto.encrypt( login_uid   "#"   time, sso_key );
    			system.out.println(xtoken);
    		} catch (exception e1) {
    			e1.printstacktrace();
    		}
    		
            string string = "{"token": " xtoken ", "client": "   client   "}";
            string  str =  httpclientutil.getinstance().sendpost(path,string);
            jsonparser parser = new jsonparser(); 
            jsonobject object = null; 
            object =(jsonobject) parser.parse(str);
            jsonobject value =object.get("data").getasjsonobject();
            token= value.get("token").getasstring();


    第二步:创建流程

    一、设置x-token

    注意:下面代码中要调整的内容如下:

    “processid”: 流程id;

    “path”:创建流程路径要根据实际服务器ip调整;

    “title”:标题;

    “identity”:创建者身份;

    subject”:标题;

    ......
    // 第二步:创建流程
    		string processid = "e4c77038-2964-498f-9d37-1635e26639eb";// 流程id
    		path = "http://127.0.0.1:20020/x_processplatform_assemble_surface/jaxrs/work/process/";// 流程创建路径
    		string datagrid = "{"data": [{"   "      "
    				  "   "col1": { "textfield1": "1" },"
    				  "         "col2": { "textfield2": "2" }," 
    				  "         "col3": { "textfield3": "3" },"
    				  "         "col4": { "textfield4": "4" },"
    				  "         "col5": { "textfield5": "5" }"
    				  "     },"   "     {"
    				  "         "col1": { "textfield1": "11" },"
    				  "         "col2": { "textfield2": "12" }," 
    				  "         "col3": { "textfield3": "13" },"
    				  "         "col4": { "textfield4": "14" }," 
    				  "         "col5": { "textfield5": "15" }"
    				  "     }]}"; // 数据网格数据
    		jsonparser parser1 = new jsonparser();
    		jsonobject jsonobj = parser1.parse(datagrid).getasjsonobject();
    		jsonobject jsonobject = new jsonobject();
    		jsonobject.addproperty("latest", false);
    		jsonobject.addproperty("title", "演示系统grid测试(2021-02-22)");// 标题
    		jsonobject.addproperty("identity", "开发人员@932ca9a4-4c80-4a29-9e44-aed85afe21d3@i"); // 创建者身份
    		jsonobject jsonobjectdata = new jsonobject();
    		jsonobjectdata.addproperty("subject", "演示系统grid测试2021-02-22"); // 标题
    		jsonobjectdata.addproperty("calendar", "2020-04-13 12:00:00");// 表单 上的字段名“calendar”
    		jsonobjectdata.addproperty("explain", "演示系统grid测试"); // 表单 上的字段名“explain”
    		jsonobjectdata.add("datagrid", jsonobj); // 表单上的数据网格
    		jsonobject.add("data", jsonobjectdata);
    		// 创建流程
    		string strflow = httpclientutil.getinstance().sendpost(path, token, jsonobject.tostring());
    		string work = "";
    		// 获取返回的workid
    		jsonparser parser2 = new jsonparser();
    		jsonobject object2 = null;
    		object2 = (jsonobject) parser2.parse(strflow);
    		jsonarray value2 = object2.getasjsonarray("data");
    		object2 = value2.get(0).getasjsonobject();
    		work = object2.get("work").getasstring();
    ......


    第三步:上传附件

    一、设置x-token

    二、设置workid

    注意:下面代码中要调整的内容如下:

    “filename”:附件名

    “site”:表单上的附件控件标识

    filepath”:附件路径

    “atturl”:附件接口要根据实际服务器ip调整

    	// 上传附件
    		try {
    			map uploadparams = new linkedhashmap();
    			uploadparams.put("filename", "明天.docx"); // 附件名
    			uploadparams.put("site", "attachment"); // 表单上的附件控件标识
    			uploadparams.put("extraparam", "");
    			map headmap = new hashmap();
    			headmap.put("cookie", "x-token="   token); // 单点token
    			headmap.put("accept", "*/*");
    			headmap.put("connection", "keep-alive");
    			headmap.put("user-agent", "mozilla/4.0 (compatible; msie 6.0; windows nt 5.1;sv1)");
    			string atturl = "http://127.0.0.1:20020/x_processplatform_assemble_surface/jaxrs/attachment/upload/work/"
    					  work;
    			string filepath = "f:download明天.docx";
    			httpclientutil.getinstance().uploadfileimpl(atturl, filepath, "file", uploadparams, headmap);
    		} catch (exception e) {
    			e.printstacktrace();
    		}



    网站地图