最新消息:本站持续更新中,请注意添加收藏夹。搜索关键词时,多换一个同义词。比如要搜索界面,可以尝试页面,画面,PER档等词汇。善于搜索,将大大提高你的查找效率。

ecology OA流程节点操作

实施与配置 bron1984 8385浏览

OA流程节点操作

首先在oa后端集成中心目录下流程流转集成,创建接口,如下图所示。

选择注册自定义接口,如图所示

已创建接口例子

下一步,查找需要操作流程,如下图所示,节点信息中,存在节点前附加操作,节点后附加操作。

点击节点前附加操作,如下图1.1所示,”+”,”-”,代表添加接口,删除接口,点击加号之后,点击搜索,如下图1.2所示

图1.1

图1.2

选择之后,如下图所示,添加接口名称,保存。Oa段操作完成

本地写代码,附录跟上图,oa创建接口相同,如下图

代码如下,demo
package weaver.interfaces.workflow.action;

import java.sql.PreparedStatement;

import java.sql.ResultSet;

import java.sql.ResultSetMetaData;

import java.sql.SQLException;

import java.sql.Statement;

import java.util.ArrayList;

import org.apache.commons.logging.Log;

import org.apache.commons.logging.LogFactory;

import weaver.general.BaseBean;

import weaver.general.StaticObj;

import weaver.interfaces.datasource.DataSource;

import weaver.interfaces.schedule.BaseIntervalJob;

import weaver.soa.workflow.request.MainTableInfo;

import weaver.soa.workflow.request.Property;

import weaver.soa.workflow.request.RequestInfo;

public class TestAction extends BaseBean

implements Action

{

private Log log = LogFactory.getLog(BaseAction.class.getName());

private DataSource ds;

public DataSource getDs()

{

return this.ds;

}

public void setDs(DataSource paramDataSource)

{

this.ds = paramDataSource;

}

public Log getLog()

{

return this.log;

}

public void setLog(Log paramLog)

{

this.log = paramLog;

}

public String getFBillNo(RequestInfo paramRequestInfo)

{

// 获取主表

MainTableInfo mainTable = paramRequestInfo.getMainTableInfo();

// 获取属性

Property[] properties = mainTable.getProperty();

 

String cgyxz = “”;

for (int i = 0; i < properties.length; i++)

{

if (“cgyxz”.equals(properties[i].getName()))

{

cgyxz = properties[i].getValue();

}

}

return cgyxz;

}

public String execute(RequestInfo paramRequestInfo)

{

weaver.interfaces.datasource.DataSource ds = (weaver.interfaces.datasource.DataSource) StaticObj.getServiceByFullname((“datasource.local”), weaver.interfaces.datasource.DataSource.class);

java.sql.Connection conn = ds.getConnection();

if (null == conn)

{

writeLog(“连接为空。”);

} else {

writeLog(“已经连接。”);

}

String lastname =””;

//获取到requestID

String requestId = paramRequestInfo.getRequestid();

writeLog(“============requestId:” +requestId);

//获取到采购员的id

String cgyxzId = getFBillNo(paramRequestInfo);

if(cgyxzId!=null&&!cgyxzId.equals(“”)){

writeLog(“============cgyxzId:” +cgyxzId);

}else{

writeLog(“============cgyxzId:值为null”);

}

 

PreparedStatement ps=null;

ResultSet rs = null;

for(String id :cgyxzId.split(“,”) ){

String sql = “select lastname from hrmresource where id ='”+id+”‘”;

try {

ps = conn.prepareStatement(sql);

//for(int i=0;i<pras.length;i++){

// ps.setString(i+1,pras[i]);

//}

// ps.setString(1, FBillNo);

rs= ps.executeQuery();

try {

if(rs.next())

{

lastname+=rs.getString(“lastname”)+”,”;

}

writeLog(“============lastname:” + String.valueOf(lastname));

} catch (Exception e) {

e.printStackTrace();

}

} catch (SQLException e) {

e.printStackTrace();

}

}

writeLog(“=====================值为:” +requestId+”———“+lastname);

String result = test(requestId,lastname);

writeLog(“======================操作结果:” +result);

try {

rs.close();

ps.close();

conn.close();

} catch (SQLException e) {

e.printStackTrace();

}

return “1”;

}

/**

* 连接GSRM数据,通过采购申请流程id,查询到当前的数据库,修改状态,操作不同的数据表

* 1.修改采购申请主表流程状态

* 2.为采购从表添加采购员

*/

public String test(String requestId,String lastname){

weaver.interfaces.datasource.DataSource ds = (weaver.interfaces.datasource.DataSource) StaticObj.getServiceByFullname((“datasource.GSRM”), weaver.interfaces.datasource.DataSource.class);

java.sql.Connection conn = ds.getConnection();

PreparedStatement ps=null;

//创建结果集

if (null == conn)

{

writeLog(“连接为空。”);

} else {

writeLog(“已经连接。”);

}

 

//为采购申请主表修改状态

try {

String sql0 =”update gsrm_porequest_entry set STATUS_POREQUEST=’2’ where request_id='”+requestId+”‘”;

ps = conn.prepareStatement(sql0);

int count = ps.executeUpdate();

writeLog(“============修改条数1:” + String.valueOf(count));

} catch (SQLException e) {

e.printStackTrace();

}

//采购申请从表修改状态

try {

String sql =”update gsrm_porequest set BPM_STATUS=’3’ where request_id='”+requestId+”‘”;

ps = conn.prepareStatement(sql);

int count = ps.executeUpdate();

writeLog(“============修改条数2:” + String.valueOf(count));

} catch (Exception e) {

e.printStackTrace();

}

 

//

try {

String sql1 =”update GSRM_POREQUEST_ENTRY set POREQ_ENTRY_BUYER='”+lastname+”‘ where id in( select id from GSRM_POREQUEST_ENTRY where POREQ_ENTRY_FINTERID in(select POREQ_FINTERID from gsrm_porequest where request_id='”+requestId+”‘ ))”;

ps = conn.prepareStatement(sql1);

int count = ps.executeUpdate();

writeLog(“============修改条数3:” + String.valueOf(count));

} catch (Exception e) {

e.printStackTrace();

}

try {

ps.close();

conn.close();

} catch (SQLException e) {

e.printStackTrace();

}

return “1”;

}

}

将java项目的代码,生成jar包,放在oa服务器下,路径如下

D:\WEAVER\ecology\classbean\weaver\interfaces\workflow\action

重启oa服务,至此完成。

重点:jar包

Classbean.jar 生成方法:到oa项目目录下

将classbean 打成压缩包,拿到本地,解压。在eclipse中创建java项目,导入classbean包,生成jar包。

转载请注明:赫非域 » ecology OA流程节点操作