本文主要是介绍BPS流程怎样设计业务与流程的结合,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
阅读原文
场景描述
BPS工作流默认客户端界面中包括"待办任务列表"、"已办任务列表"等纯流程信息,而为了业务操作人员更全面了解任务相关的业务信息,往往需要在任务列表中显示相关的业务属性信息。
本场景适用BPS服务器与用户应用集中部署的方式,流程引擎的数据库和应用的数据库存放在同一数据库中。
案例简介
业务场景描述:
在报销流程中,审批人登录系统后能结合工作项和报销业务表查询到待审批的报销单信息,查询条件为报销人,如下图所示:
场景实现(关键步骤描述)
- 报销业务表 (通过流程实例ID与流程进行关联)
create table EXPENSEINFO
(
EXPID NUMERIC(
18
) not
null
,
PROCESSINSTID NUMERIC(
18
) not
null
,
EXPNAME VARCHAR(
20
) not
null
,
EXPMONEY NUMBER not
null
,
REASON VARCHAR(
255
),
ISBUDGETITEM CHAR(
1
),
AUDITOR VARCHAR(
20
)
);
alter table EXPENSEINFO add constraint P_EXP primary key (EXPID);
-- Add comments to the columns
comment on column EXPENSEINFO.EXPID
is
'报销单编号'
;
comment on column EXPENSEINFO.PROCESSINSTID
is
'流程实例ID'
;
comment on column EXPENSEINFO.EXPNAME
is
'报销人'
;
comment on column EXPENSEINFO.EXPMONEY
is
'报销金额'
;
comment on column EXPENSEINFO.REASON
is
'报销原因'
;
comment on column EXPENSEINFO.ISBUDGETITEM
is
'是否是预算内项目'
;
comment on column EXPENSEINFO.AUDITOR
is
'财务审阅人'
;
- 构造业务实体对应的XSD和HBM
- expdata.xsd代码如下:
<?xml version=
"1.0"
encoding=
"UTF-8"
standalone=
"no"
?>
<xs:schema xmlns=
"com.eos.workflow.expdata"
xmlns:sdo=
"commonj.sdo"
xmlns:sdoJava=
"commonj.sdo/java"
xmlns:xs=
"<a href="http://www.w3.org/2001/XMLSchema" "="">http://www.w3.org/2001/XMLSchema"
targetNamespace=
"com.eos.workflow.expdata"
>
<xs:complexType name=
"Expenseinfo"
>
<xs:sequence>
<xs:any/>
<xs:element name=
"expid"
type=
"xs:long"
/>
<xs:element name=
"processinstid"
type=
"xs:long"
/>
<xs:element name=
"expname"
type=
"xs:string"
/>
<xs:element name=
"expmoney"
type=
"xs:long"
/>
<xs:element name=
"reason"
type=
"xs:string"
/>
<xs:element name=
"isbudgetitem"
type=
"xs:string"
/>
<xs:element name=
"auditor"
type=
"xs:string"
/>
</xs:sequence>
</xs:complexType>
</xs:schema>
- expdata.hbm代码如下:
<?xml version=
"1.0"
encoding=
"UTF-8"
?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"<a href="http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" "="">http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"
>
<hibernate-mapping>
<
class
dynamic-insert=
"true"
dynamic-update=
"true"
entity-name=
"com.eos.workflow.expdata.Expenseinfo"
table=
"EXPENSEINFO"
>
<tuplizer
class
=
"com.primeton.server.das.tuplizer.SDOEntityTuplizer"
entity-mode=
"sdo"
/>
<id name=
"expid"
type=
"long"
>
<column length=
"18"
name=
"EXPID"
/>
<generator
class
=
"assigned"
/>
</id>
<property name=
"processinstid"
type=
"long"
>
<column length=
"18"
name=
"PROCESSINSTID"
not-
null
=
"true"
/>
</property>
<property name=
"expname"
type=
"string"
>
<column length=
"20"
name=
"EXPNAME"
not-
null
=
"true"
/>
</property>
<property name=
"expmoney"
type=
"long"
>
<column length=
"22"
name=
"EXPMONEY"
not-
null
=
"true"
/>
</property>
<property name=
"reason"
type=
"string"
>
<column length=
"255"
name=
"REASON"
/>
</property>
<property name=
"isbudgetitem"
type=
"string"
>
<column length=
"1"
name=
"ISBUDGETITEM"
/>
</property>
<property name=
"auditor"
type=
"string"
>
<column length=
"20"
name=
"AUDITOR"
/>
</property>
</
class
>
</hibernate-mapping>
- expdata.xsd代码如下:
- 把expdata.hbm和expdata.xsd放在"${BPS_HOME}\apache-tomcat-5.5.20\webapps\default\WEB-INF\ _srv\work\system\com.eos.workflow\com\eos\workflow"目录下。
- 结合业务查询关键代码
public
List<WFWorkItem> getUserTasks4SDO(User user,ExpenseInfoForm expenseInfoForm, PageCond pageCond)
throws
WFServiceException {
List<WFWorkItem> tasklist =
new
ArrayList();
//获取工作列表查询器接口
IWFWorklistQueryManager workListMng = client.getWorklistQueryManager();
//创建并封装工作项查询对象
DataObject workItemFilter=DataFactory.INSTANCE.create(
"com.primeton.das.criteria"
,
"criteriaType"
);
workItemFilter.set(
"_entity"
,
"com.eos.workflow.data.WFWorkItem"
);
//创建并封装业务查询对象
DataObject bizEntityFilter=DataFactory.INSTANCE.create(
"com.primeton.das.criteria"
,
"criteriaType"
);
bizEntityFilter.set(
"_entity"
,
"com.eos.workflow.expdata.Expenseinfo"
);
String expname = expenseInfoForm.getExpname();
if
(expname !=
null
&& !
""
.equals(expname))
{
bizEntityFilter.set(
"/_and[1]/_expr[1]/expname"
, expname);
bizEntityFilter.set(
"/_and[1]/_expr[1]/_op"
,
"like"
);
bizEntityFilter.set(
"/_and[1]/_expr[1]/_likeRule"
,
"all"
);
}
DataObject pageCondSDO=DataFactory.INSTANCE.create(
"com.eos.foundation"
,
"PageCond"
);
pageCondSDO.set(
"begin"
, pageCond.getBegin());
pageCondSDO.set(
"length"
, pageCond.getLength());
pageCondSDO.set(
"isCount"
, pageCond.getIsCount());
DataObject[] objs = workListMng.queryPersonBizEntities4SDO(user.getUserId(),
"ALL"
,
"ALL"
,
bizEntityFilter, workItemFilter,
"processinstid"
, pageCondSDO);
//回填查询记录数,更新输入的分页信息
pageCond.setCount(pageCondSDO.getInt(
"count"
));
//将查询结果(DataObject数组类型)转化为WFWorkItem的List类型(JavaBean类型)
tasklist = BPSDataConvertor.convertToUserObjectList(objs, com.eos.workflow.data.WFWorkItem.
class
);
return
tasklist;
}
这篇关于BPS流程怎样设计业务与流程的结合的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!