Commit c515b56b by 罗绍泽

流程定义+流程实例初始化

parent f9cbbe82
...@@ -9,6 +9,10 @@ ...@@ -9,6 +9,10 @@
<property name="transactionManager" ref="transactionManager-activiti" /> <property name="transactionManager" ref="transactionManager-activiti" />
<!-- 设置建表策略,如果没有表,自动创建表 --> <!-- 设置建表策略,如果没有表,自动创建表 -->
<property name="databaseSchemaUpdate" value="true" /> <property name="databaseSchemaUpdate" value="true" />
<!-- 设置字体,防止流程图生成时候产生乱码 -->
<property name="activityFontName" value="宋体"></property>
<!-- 设置字体,防止xml生成时候产生乱码 -->
<property name="labelFontName" value="宋体"></property>
</bean> </bean>
<!-- 创建流程引擎对象 --> <!-- 创建流程引擎对象 -->
<bean id="processEngine" class="org.activiti.spring.ProcessEngineFactoryBean"> <bean id="processEngine" class="org.activiti.spring.ProcessEngineFactoryBean">
......
...@@ -10,43 +10,47 @@ ...@@ -10,43 +10,47 @@
<value>classpath:com/gaowj/business/procdefinition/procdefinitionDAO.xml</value> <value>classpath:com/gaowj/business/procdefinition/procdefinitionDAO.xml</value>
<value>classpath:com/gaowj/business/procdefinitionmodels/procdefinitionmodelsDAO.xml</value> <value>classpath:com/gaowj/business/procdefinitionmodels/procdefinitionmodelsDAO.xml</value>
<value>classpath:com/gaowj/business/formfield/formfieldDAO.xml</value> <value>classpath:com/gaowj/business/formfield/formfieldDAO.xml</value>
<value>classpath:com/gaowj/business/formmodels/formmodelsDAO.xml</value>
</list> </list>
</property> </property>
</bean> </bean>
<!-- DAO定义开始 -->
<bean id="formtableDAO" class="org.mybatis.spring.mapper.MapperFactoryBean">
<property name="mapperInterface" value="com.gaowj.business.formtable.formtableDAO" />
<property name="sqlSessionFactory" ref="sqlSessionFactory-process" />
</bean>
<bean id="formmodelsDAO" class="org.mybatis.spring.mapper.MapperFactoryBean">
<property name="mapperInterface" value="com.gaowj.business.formmodels.formmodelsDAO" />
<property name="sqlSessionFactory" ref="sqlSessionFactory-process" />
</bean>
<bean id="procdefinitionDAO" class="org.mybatis.spring.mapper.MapperFactoryBean">
<property name="mapperInterface" value="com.gaowj.business.procdefinition.procdefinitionDAO" />
<property name="sqlSessionFactory" ref="sqlSessionFactory-process" />
</bean>
<bean id="procdefinitionmodelsDAO" class="org.mybatis.spring.mapper.MapperFactoryBean">
<property name="mapperInterface" value="com.gaowj.business.procdefinitionmodels.procdefinitionmodelsDAO" />
<property name="sqlSessionFactory" ref="sqlSessionFactory-process" />
</bean>
<!-- DAO定义结束 -->
<bean id="FormtableBusiness" class="com.gaowj.business.formtable.FormtableBusinessImpl"> <bean id="FormtableBusiness" class="com.gaowj.business.formtable.FormtableBusinessImpl">
<property name="formtableDAO"> <property name="formtableDAO" ref="formtableDAO"></property>
<bean class="org.mybatis.spring.mapper.MapperFactoryBean">
<property name="mapperInterface" value="com.gaowj.business.formtable.formtableDAO" />
<property name="sqlSessionFactory" ref="sqlSessionFactory-process" />
</bean>
</property>
</bean> </bean>
<bean id="procdefinitionBusiness" class="com.gaowj.business.procdefinition.ProcdefinitionBusinessImpl"> <bean id="procdefinitionBusiness" class="com.gaowj.business.procdefinition.ProcdefinitionBusinessImpl">
<property name="procdefinitionDAO"> <property name="procdefinitionDAO" ref="procdefinitionDAO"></property>
<bean class="org.mybatis.spring.mapper.MapperFactoryBean">
<property name="mapperInterface" value="com.gaowj.business.procdefinition.procdefinitionDAO" /> <property name="formmodelsDAO" ref="formmodelsDAO"></property>
<property name="sqlSessionFactory" ref="sqlSessionFactory-process" />
</bean>
</property>
<property name="repositoryService" ref="repositoryService"></property> <property name="repositoryService" ref="repositoryService"></property>
</bean> </bean>
<bean id="procdefinitionmodelsBusiness" class="com.gaowj.business.procdefinitionmodels.ProcdefinitionmodelsBusinessImpl"> <bean id="procdefinitionmodelsBusiness" class="com.gaowj.business.procdefinitionmodels.ProcdefinitionmodelsBusinessImpl">
<property name="procdefinitionmodelsDAO"> <property name="procdefinitionmodelsDAO" ref="procdefinitionmodelsDAO"></property>
<bean class="org.mybatis.spring.mapper.MapperFactoryBean">
<property name="mapperInterface" value="com.gaowj.business.procdefinitionmodels.procdefinitionmodelsDAO" />
<property name="sqlSessionFactory" ref="sqlSessionFactory-process" />
</bean>
</property>
<property name="procdefinitionDAO"> <property name="procdefinitionDAO" ref="procdefinitionDAO"></property>
<bean class="org.mybatis.spring.mapper.MapperFactoryBean">
<property name="mapperInterface" value="com.gaowj.business.procdefinition.procdefinitionDAO" />
<property name="sqlSessionFactory" ref="sqlSessionFactory-process" />
</bean>
</property>
<property name="repositoryService" ref="repositoryService"></property> <property name="repositoryService" ref="repositoryService"></property>
...@@ -61,4 +65,8 @@ ...@@ -61,4 +65,8 @@
</bean> </bean>
</property> </property>
</bean> </bean>
<bean id="ProcinstanceBusiness" class="com.gaowj.business.procinstance.ProcinstanceBusinessImpl">
<property name="runtimeService" ref="runtimeService"></property>
</bean>
</beans> </beans>
...@@ -304,3 +304,6 @@ ...@@ -304,3 +304,6 @@
.icon-ext-04_46{ .icon-ext-04_46{
background:url('../../../../images/icons/(04,46).png') no-repeat left center; background:url('../../../../images/icons/(04,46).png') no-repeat left center;
} }
.icon-ext-05_29{
background:url('../../../../images/icons/(05,29).png') no-repeat left center;
}
...@@ -12,4 +12,269 @@ var commonutil = { ...@@ -12,4 +12,269 @@ var commonutil = {
} }
return news; return news;
} }
}; };
\ No newline at end of file
/**
* easyui datagrid方法封装
*/
var easyui = {
datagrid : function(options) {
var opts = $.extend({
pagination : true,
checkOnSelect : false,
selectOnCheck : false,
rownumbers : true,
fitColumns : false,
striped : true,
scrollbarSize : 0,
tableId : options.tableId,
autoRowHeight : false,
isSingleSelect : true,
singleSelect : true,
//如果需要自定义计算最后一列,则需要设置customLastCellWidth属性为true
customLastCellWidth : true
/*,
border:false*/
}, options);
opts.onClickRow = function(rowIndex, rowData) {
if (typeof options.onClickRow == 'function') {
options.onClickRow.call(null, rowIndex, rowData);
}
//如果用户传入了isSingleSelect属性为true,则设置点击事件时候只能单行选中
/*if (opts.isSingleSelect) {
if (typeof datagridSingleSelect == 'function') {
datagridSingleSelect(opts.tableId, rowIndex);
}
}*/
};
opts.onRowContextMenu = function(e, rowIndex, rowData) {
if (typeof options.onRowContextMenu == 'function') {
options.onRowContextMenu.call(null, e, rowIndex, rowData);
}
//如果用户传入了isSingleSelect属性为true,则设置右击事件时候只能单行选中
/*if (opts.isSingleSelect) {
datagridSingleSelect(opts.tableId, rowIndex);
}*/
}
opts.onBeforeLoad = function(param) {
if (typeof options.onBeforeLoad == 'function') {
options.onBeforeLoad.call(null, param);
}
//提交参数前,将每个参数的两边空格都去除
for (var key in param) {
param[key] = (param[key] + "").trim();
}
};
opts.onLoadSuccess = function(data) {
if (typeof options.onLoadSuccess == 'function') {
options.onLoadSuccess.call();
}
//如果回传值有checkedIds属性,则将这些id的记录进行勾选操作
var checkedIds = data.checkedIds;
if (!stringutil.isEmpty(checkedIds) && checkedIds.length > 0) {
var rows = data.rows;
for (var i = 0; i < rows.length; i++) {
for (var j = 0; j < checkedIds.length; j++) {
if (checkedIds[j] == rows[i].id) {
$("#" + opts.tableId).datagrid("checkRow", i);
}
}
}
}
};
return $('#' + opts.tableId).datagrid(opts);
},
dialog : function(options) {
var opts = $.extend({
modal : true,
shadow : false,
onClose : function() {
$(this).dialog('destroy');
}
}, options);
opts.onLoad = function() {
if (typeof options.onLoad == 'function') {
options.onLoad.call();
}
$.messager.defaults.onClose = function() {};
//$.messager.progress('close')
};
opts.onOpen = function() {
if (typeof options.onOpen == 'function') {
options.onOpen.call();
}
//数据加载
/*$.messager.progress({
text : '数据加载中....',
interval : 100
});*/
};
if (opts.dialogSelector) {
//如果是自定义选择器生成dialog,就不需要调用销毁
opts.onClose = function() {};
return opts.dialogSelector.dialog(opts);
} else {
return $('<div/>').dialog(opts);
}
},
combobox : function(options) {
if (!options.selector) {
alert('selector必须设置');
return;
}
var opts = $.extend({
valueField : 'id',
textField : 'text',
defaultEmptyValue : '',
defaultEmptyText : '-- 请选择 --',
//空值行是否需要,默认为true,需要
needEmpty : true
}, options);
//如果key,value传进来的属性名一致,则强制改变textField属性名
var same = false;
if (opts.valueField == opts.textField) {
same = true;
opts.textField = "c_" + opts.textField;
}
var responseInfo;
$.ajax({
url : opts.url,
async : false,
success : function(data) {
responseInfo = data;
}
});
//设置第一个空行
var data = [];
if (opts.needEmpty) {
var d = {};
d[opts.valueField] = opts.defaultEmptyValue;
d[opts.textField] = opts.defaultEmptyText;
data.push(d);
}
var complete_data = stringutil.toJson(responseInfo.data);
for (var i = 0; i < complete_data.length; i++) {
var d = {};
d[opts.valueField] = complete_data[i][opts.valueField];
var textFieldName;
if (same) {
//如果key,value属性名一致,则获取数据的时候,多了一个"c_"字符,要给予去除
textFieldName = opts.textField.split("c_")[1];
} else {
textFieldName = opts.textField;
}
d[opts.textField] = complete_data[i][textFieldName];
data.push(d);
}
if (responseInfo.code == '0000') {
if ($(opts.selector).length == 0) {
alert('selector设置错误');
}
opts.data = data;
delete opts.url;
var handle = $(opts.selector).combobox(opts);
return handle;
}
return null;
},
calendar : function(options) {
if (!options.selector) {
alert('selector必须设置');
return;
}
var opts = $.extend({
current : new Date()
}, options);
$(opts.selector).calendar({
current : new Date()
});
},
datebox : function(options) {
if (!options.selector) {
alert('selector必须设置');
return;
}
var opts = $.extend({
formatter : function(date) {
var y = date.getFullYear();
var m = date.getMonth() + 1;
var d = date.getDate();
return y + '-' + (m < 10 ? ('0' + m) : m) + '-' + (d < 10 ? ('0' + d) : d);
}
}, options);
$(opts.selector).datebox(opts);
},
treegrid : function(options) {
var opts = $.extend({
animate : true,
rownumbers : true,
idField : 'id',
treeField : 'name',
tableId : options.tableId,
autoRowHeight:false,
fitColumns:true,
scrollbarSize:0
}, options);
opts.onLoadSuccess = function() {
if (typeof options.onLoadSuccess == 'function') {
options.onLoadSuccess.call();
}
};
opts.onDblClickRow=function(row){
if (typeof options.onDblClickRow == 'function') {
options.onDblClickRow.call();
}
$('#' + opts.tableId).treegrid('toggle',row.id);
};
opts.onLoadError=function(){
if (typeof options.onLoadError == 'function') {
options.onLoadError.call();
}
alert('数据获取失败!');
}
return $('#' + opts.tableId).treegrid(opts);
},
tree : function(options) {
var opts = $.extend({
checkbox : false,
lines : false,
animate : true,
treeId : options.treeId
}, options);
return $('#' + opts.treeId).tree(opts);
}
}
/**
* tree数据中,如果不是叶节点,则将checked属性设置为false
*/
function notleafToUnchecked(data){
for(var i=0;i<data.length;i++){
if(!stringutil.isEmpty(data[i].children)&&data[i].children.length!=0){
//表示非叶子节点
//将checked属性设置为false
data[i].checked=false;
data[i]._checked=false;
//继续判断子节点
notleafToUnchecked(data[i].children);
}
}
}
\ No newline at end of file
...@@ -14,6 +14,10 @@ procdefinitionModule.prototype.insertProcdefinition = function(){}; ...@@ -14,6 +14,10 @@ procdefinitionModule.prototype.insertProcdefinition = function(){};
procdefinitionModule.prototype.updateProcdefinition = function(){}; procdefinitionModule.prototype.updateProcdefinition = function(){};
//删除流程定义 //删除流程定义
procdefinitionModule.prototype.deleteProcdefinition = function(){}; procdefinitionModule.prototype.deleteProcdefinition = function(){};
//获取流程定义列表
procdefinitionModule.prototype.list = function(){};
//查找流程定义对应的表模板
procdefinitionModule.prototype.findFormModel = function(){};
//创建一个数据操作对象,然后再后续使用 //创建一个数据操作对象,然后再后续使用
procdefinitionModule.act = new procdefinitionModule("json").delegate("procdefinitionAct"); procdefinitionModule.act = new procdefinitionModule("json").delegate("procdefinitionAct");
......
...@@ -106,15 +106,16 @@ function formatMenu(value, data,index) { ...@@ -106,15 +106,16 @@ function formatMenu(value, data,index) {
//上浮横向菜单集里的具体菜单项(需更改) //上浮横向菜单集里的具体菜单项(需更改)
function getOptionMenu(data,index){ function getOptionMenu(data,index){
var returnData= "<span class=\"icon-edit\" style=\"padding-left:20px;*width:20px;\"></span><a href=\"javascript:void(0);\" onclick=\"editRow('" var returnData= "<span class=\"icon-edit\" style=\"padding-left:20px;*width:20px;\"></span><a href=\"javascript:void(0);\" onclick=\"editRow('"
+ index + "')\">编辑</a> | <span class=\"icon-clear\" style=\"padding-left:20px;*width:20px;\"></span><a href=\"javascript:void(0);\" onclick=\"deleteRow('" + index + "')\">编辑</a> | <span class=\"icon-ext-file\" style=\"padding-left:20px;*width:20px;\"></span><a href=\"javascript:void(0);\" onclick=\"modelList('"
+ index + "')\">删除</a> | <span class=\"icon-ext-file\" style=\"padding-left:20px;*width:20px;\"></span><a href=\"javascript:void(0);\" onclick=\"modelList('" + index + "')\">模板</a> | <span class=\"icon-ext-file\" style=\"padding-left:20px;*width:20px;\"></span><a href=\"javascript:void(0);\" onclick=\"procdefinitionImg('"
+ index + "')\">模板</a>"; + index + "')\">流程图</a> | <span class=\"icon-clear\" style=\"padding-left:20px;*width:20px;\"></span><a href=\"javascript:void(0);\" onclick=\"deleteRow('"
+ index + "')\">删除</a>";
return returnData; return returnData;
} }
//返回菜单集的菜单个数(需更改) //返回菜单集的菜单个数(需更改)
function getOptionMenuCount(){ function getOptionMenuCount(){
var is_menu_count = 3; var is_menu_count = 4.5;
return is_menu_count; return is_menu_count;
} }
...@@ -258,7 +259,7 @@ function deleteBatchRow(){ ...@@ -258,7 +259,7 @@ function deleteBatchRow(){
**/ **/
function refreshRow(){ function refreshRow(){
$('#list').datagrid('load',{}); $('#list').datagrid('load',{});
$("#studentTab_searchForm")[0].reset(); $("#procdefinitionTab_searchForm")[0].reset();
} }
/****/ /****/
...@@ -395,6 +396,22 @@ function modelList(index){ ...@@ -395,6 +396,22 @@ function modelList(index){
} }
function closeCallback(is_row){ function closeCallback(is_row){
console.log(is_row); $('#list').datagrid('load',is_entity);
}
function procdefinitionImg(index){
$('#list').datagrid('selectRow',index);
var is_row = $('#list').datagrid('getSelections');
$('#list').datagrid('clearSelections');
if(is_row[0].DEPLOYMENT_ID==null||is_row[0].DEPLOYMENT_ID==''){
$.messager.alert('提示','该流程定义还未进行部署!');
return;
}
easyui.dialog({
width : 1000,
height : 500,
title : '流程图',
content:'<img src="procdefinitionData_showProcdefinitionImg?deploymentId='+is_row[0].DEPLOYMENT_ID+'" />'
});
} }
...@@ -11,11 +11,9 @@ ...@@ -11,11 +11,9 @@
流程名称: <input class="easyui-textbox" id="FIELD_PROC_NAME" name="FIELD_PROC_NAME" style="width:200px"/>&nbsp;&nbsp; 流程名称: <input class="easyui-textbox" id="FIELD_PROC_NAME" name="FIELD_PROC_NAME" style="width:200px"/>&nbsp;&nbsp;
</form> </form>
<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search',plain:true" onclick="javascript:searchRow()">查询</a> <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search',plain:true" onclick="javascript:searchRow()">查询</a>
<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-ext-advsearch',plain:true" onclick="javascript:advsearchRow()">高级查询</a>
<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-reload',plain:true" onclick="javascript:refreshRow()">刷新</a> <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-reload',plain:true" onclick="javascript:refreshRow()">刷新</a>
<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-add',plain:true" onclick="javascript:addRow()">新增</a> <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-add',plain:true" onclick="javascript:addRow()">新增</a>
<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-clear',plain:true" onclick="javascript:deleteBatchRow()">删除</a> <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-clear',plain:true" onclick="javascript:deleteBatchRow()">删除</a>
<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-ext-file',plain:true" onclick="javascript:uploadcommonBatchRow()">附件</a>
</div> </div>
<div id="detail" style="overflow:auto;"></div> <div id="detail" style="overflow:auto;"></div>
<div id="iframedetail" style="overflow:auto;"></div> <div id="iframedetail" style="overflow:auto;"></div>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<span>流程名称:</span> <span>流程名称:</span>
</td> </td>
<td style="width: 74%"> <td style="width: 74%">
<input class="easyui-textbox" id="PROC_NAME" name="FIELD_PROC_NAME" style="width:200px" /> <input class="easyui-textbox" data-options="required:true" id="PROC_NAME" name="FIELD_PROC_NAME" style="width:200px" />
</td> </td>
</tr> </tr>
<tr> <tr>
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<span>表:</span> <span>表:</span>
</td> </td>
<td> <td>
<input class="easyui-textbox" id="TABLE_ID" name="FIELD_TABLE_ID" style="width:200px" /> <input class="easyui-textbox" data-options="required:true" id="TABLE_ID" name="FIELD_TABLE_ID" style="width:200px" />
</td> </td>
</tr> </tr>
<tr> <tr>
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
<span>KEY:</span> <span>KEY:</span>
</td> </td>
<td> <td>
<input class="easyui-textbox" id="DEPLOYMENT_KEY" name="FIELD_DEPLOYMENT_KEY" style="width:200px" /> <input class="easyui-textbox" data-options="required:true" id="DEPLOYMENT_KEY" name="FIELD_DEPLOYMENT_KEY" style="width:200px" />
</td> </td>
</tr> </tr>
</table> </table>
......
...@@ -57,7 +57,9 @@ var ls_ywlx = 'YBYW'; ...@@ -57,7 +57,9 @@ var ls_ywlx = 'YBYW';
var ls_title=null; var ls_title=null;
var is_column = [ [ var is_column = [ [
{field : 'NAME',title : '模板名称',width : 100,align : 'center'}, {field : 'NAME',title : '模板名称',width : 100,align : 'center'},
{field : 'DESCRIPTION',title : '描述',width : 80,align : 'center'}, {field : 'METAINFO',title : '描述',width : 80,align : 'center',formatter:function(value,row,index){
return eval('('+value+')').description;
}},
{field : 'KEY',title : 'KEY',width : 80,align : 'center'} {field : 'KEY',title : 'KEY',width : 80,align : 'center'}
] ]; ] ];
//列表加载完成回调 //列表加载完成回调
...@@ -133,7 +135,7 @@ function addUrlOnloadCallback(is_row){ ...@@ -133,7 +135,7 @@ function addUrlOnloadCallback(is_row){
} }
//保存 //保存
function insertData(is_entity){ function insertData(is_entity){
is_entity.PROCID=$("#PROCID").val(); is_entity.FIELD_PROCID=$("#PROCID").val();
var v_result = procdefinitionmodelsModule.act.insertProcdefinitionmodels(is_entity); var v_result = procdefinitionmodelsModule.act.insertProcdefinitionmodels(is_entity);
$('#list').datagrid('reload'); $('#list').datagrid('reload');
return v_result; return v_result;
...@@ -182,7 +184,7 @@ function deleteRow(index){ ...@@ -182,7 +184,7 @@ function deleteRow(index){
if (r) { if (r) {
var v_query = {}; var v_query = {};
v_query.FIELD_CODE = code; v_query.FIELD_CODE = code;
var v_result = procdefinitionModule.act.deleteProcdefinition(v_query); var v_result = procdefinitionmodelsModule.act.deleteProcdefinitionmodels(v_query);
$.messager.alert('提示',v_result.VALUE); $.messager.alert('提示',v_result.VALUE);
$('#list').datagrid('reload'); $('#list').datagrid('reload');
} }
...@@ -217,7 +219,7 @@ function deleteBatchRow(){ ...@@ -217,7 +219,7 @@ function deleteBatchRow(){
if (r) { if (r) {
var v_query = {}; var v_query = {};
v_query.FIELD_CODE = code; v_query.FIELD_CODE = code;
var v_result = procdefinitionModule.act.deleteProcdefinition(v_query); var v_result = procdefinitionmodelsModule.act.deleteProcdefinitionmodels(v_query);
$.messager.alert('提示',v_result.VALUE); $.messager.alert('提示',v_result.VALUE);
$('#list').datagrid('reload'); $('#list').datagrid('reload');
} }
...@@ -236,8 +238,8 @@ function deleteBatchRow(){ ...@@ -236,8 +238,8 @@ function deleteBatchRow(){
* 备注:需更改 * 备注:需更改
**/ **/
function refreshRow(){ function refreshRow(){
$('#list').datagrid('load',{}); $("#procdefinitionmodelsTab_searchForm").form('reset');
$("#studentTab_searchForm")[0].reset(); searchRow();
} }
/****/ /****/
......
...@@ -9,14 +9,12 @@ ...@@ -9,14 +9,12 @@
<div id="tb"> <div id="tb">
<form id="procdefinitionmodelsTab_searchForm" style="float:left"> <form id="procdefinitionmodelsTab_searchForm" style="float:left">
<input type="hidden" name="FIELD_PROCID" id="PROCID" value="${procId}" /> <input type="hidden" name="FIELD_PROCID" id="PROCID" value="${procId}" />
模板名称: <input class="easyui-textbox" id="FIELD_PROC_NAME" name="FIELD_PROC_NAME" style="width:200px"/>&nbsp;&nbsp; 模板名称: <input class="easyui-textbox" id="FIELD_MODEL_NAME" name="FIELD_MODEL_NAME" style="width:200px"/>&nbsp;&nbsp;
</form> </form>
<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search',plain:true" onclick="javascript:searchRow()">查询</a> <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search',plain:true" onclick="javascript:searchRow()">查询</a>
<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-ext-advsearch',plain:true" onclick="javascript:advsearchRow()">高级查询</a>
<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-reload',plain:true" onclick="javascript:refreshRow()">刷新</a> <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-reload',plain:true" onclick="javascript:refreshRow()">刷新</a>
<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-add',plain:true" onclick="javascript:addRow()">新增</a> <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-add',plain:true" onclick="javascript:addRow()">新增</a>
<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-clear',plain:true" onclick="javascript:deleteBatchRow()">删除</a> <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-clear',plain:true" onclick="javascript:deleteBatchRow()">删除</a>
<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-ext-file',plain:true" onclick="javascript:uploadcommonBatchRow()">附件</a>
</div> </div>
<div id="detail" style="overflow:auto;"></div> <div id="detail" style="overflow:auto;"></div>
<script type="text/javascript" src="${ctx}/jwapp/pages/standard/js/jwStandardModule.js" charset="utf-8"></script> <script type="text/javascript" src="${ctx}/jwapp/pages/standard/js/jwStandardModule.js" charset="utf-8"></script>
......
<%@page contentType="text/html; charset=UTF-8"%>
<%@ include file="/gaowj/header-simple-1.0.jsp"%>
<div id="procinstanceTab">
<link rel="stylesheet" type="text/css" href="${ctx}/jwapp/common/css/content_body.css" charset="utf-8"></link>
<link rel="stylesheet" type="text/css" href="${ctx}/jwapp/common/css/content_table.css" charset="utf-8"></link>
<link rel="stylesheet" type="text/css" href="${ctx}/jwapp/common/css/content_input.css" charset="utf-8"></link>
</div>
<table id="list" style="width: 100%; height: 100%;"></table>
<div id="tb">
<form id="procinstanceTab_searchForm" style="float:left">
流程: <input class="easyui-textbox" id="FIELD_PROCDEFINITION_UUID" name="FIELD_PROCDEFINITION_UUID" style="width:200px"/>&nbsp;&nbsp;
</form>
<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search',plain:true" onclick="javascript:searchRow()">查询</a>
<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-ext-advsearch',plain:true" onclick="javascript:advsearchRow()">高级查询</a>
<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-reload',plain:true" onclick="javascript:refreshRow()">刷新</a>
<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-add',plain:true" onclick="javascript:addRow()">新增</a>
<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-clear',plain:true" onclick="javascript:deleteBatchRow()">删除</a>
<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-ext-file',plain:true" onclick="javascript:uploadcommonBatchRow()">附件</a>
</div>
<div id="detail" style="overflow:auto;"></div>
<script type="text/javascript" src="${ctx}/jwapp/pages/standard/js/jwStandardModule.js" charset="utf-8"></script>
<script type="text/javascript" src="${ctx}/process/pages/procdefinition/js/procdefinitionModule.js" charset="utf-8"></script>
<script type="text/javascript" src="${ctx}/process/pages/procinstance/js/procinstanceModule.js" charset="utf-8"></script>
<script type="text/javascript" src="${ctx}/process/pages/procinstance/js/procinstanceTab.js" charset="utf-8"></script>
<%@page contentType="text/html; charset=UTF-8"%>
<form id="detail">
流程: <input class="easyui-textbox" id="FIELD_PROCDEFINITION_UUID" name="FIELD_PROCDEFINITION_UUID" style="width:200px" value="${is_row.PROCDEFINITION_UUID}"/>&nbsp;&nbsp;
</form>
<form id="inputForm" method="post" style="width: 100%;">
<input type="hidden" name="FIELD_OPETYPE" id="OPETYPE" value="${is_row.OPETYPE}" /> <input type="hidden" name="FIELD_UUID" id="UUID" value="${is_row.UUID}" />
<div id="table_content"></div>
</form>
\ No newline at end of file
...@@ -4,47 +4,69 @@ ...@@ -4,47 +4,69 @@
"http://struts.apache.org/dtds/struts-2.3.dtd"> "http://struts.apache.org/dtds/struts-2.3.dtd">
<struts> <struts>
<package name="process" extends="gaowj"> <package name="process" extends="gaowj">
<action name="formtableView_*" class="com.gaowj.formtable.action.viewAction" method="{1}"> <action name="formtableView_*" class="com.gaowj.formtable.action.viewAction" method="{1}">
<result name="{1}">/process/pages/formtable/{1}.jsp</result> <result name="{1}">/process/pages/formtable/{1}.jsp</result>
</action> </action>
<action name="formtableAct_*" class="com.gaowj.formtable.action.actAction" method="{1}"> <action name="formtableAct_*" class="com.gaowj.formtable.action.actAction" method="{1}">
<result name="json" type="json"> <result name="json" type="json">
<param name="root">jsonObject</param> <param name="root">jsonObject</param>
</result> </result>
</action> </action>
<action name="formtableData_*" class="com.gaowj.formtable.action.dataAction" method="{1}"> <action name="formtableData_*" class="com.gaowj.formtable.action.dataAction" method="{1}">
<result name="json" type="json"> <result name="json" type="json">
<param name="root">jsonObject</param> <param name="root">jsonObject</param>
</result> </result>
</action> </action>
<action name="procdefinitionView_*" class="com.gaowj.procdefinition.action.viewAction" method="{1}"> <action name="procdefinitionView_*" class="com.gaowj.procdefinition.action.viewAction" method="{1}">
<result name="{1}">/process/pages/procdefinition/{1}.jsp</result> <result name="{1}">/process/pages/procdefinition/{1}.jsp</result>
</action> </action>
<action name="procdefinitionAct_*" class="com.gaowj.procdefinition.action.actAction" method="{1}"> <action name="procdefinitionAct_*" class="com.gaowj.procdefinition.action.actAction" method="{1}">
<result name="json" type="json"> <result name="json" type="json">
<param name="root">jsonObject</param> <param name="root">jsonObject</param>
</result> </result>
</action> </action>
<action name="procdefinitionData_*" class="com.gaowj.procdefinition.action.dataAction" method="{1}"> <action name="procdefinitionData_*" class="com.gaowj.procdefinition.action.dataAction" method="{1}">
<result name="json" type="json"> <result name="json" type="json">
<param name="root">jsonObject</param> <param name="root">jsonObject</param>
</result> </result>
</action> <result name="download" type="stream">
<!-- 下载的文件数据存放的方法,该方法返回一个InputStream 例如取值为inputStream的属性需要编写getInputStream()方法 -->
<action name="procdefinitionmodelsView_*" class="com.gaowj.procdefinitionmodels.action.viewAction" method="{1}"> <param name="inputName">inputStream</param>
<result name="{1}">/process/pages/procdefinitionmodels/{1}.jsp</result> <!--下载时,客户端显示的下载的文件名 -->
</action> <param name="contentDisposition"> filename=${fileName}</param>
<action name="procdefinitionmodelsAct_*" class="com.gaowj.procdefinitionmodels.action.actAction" method="{1}"> <!-- 数据的缓冲大小 -->
<result name="json" type="json"> <param name="bufferSize">1024</param>
<param name="root">jsonObject</param> </result>
</result> </action>
</action>
<action name="procdefinitionmodelsData_*" class="com.gaowj.procdefinitionmodels.action.dataAction" method="{1}"> <action name="procdefinitionmodelsView_*" class="com.gaowj.procdefinitionmodels.action.viewAction" method="{1}">
<result name="json" type="json"> <result name="{1}">/process/pages/procdefinitionmodels/{1}.jsp</result>
<param name="root">jsonObject</param> </action>
</result> <action name="procdefinitionmodelsAct_*" class="com.gaowj.procdefinitionmodels.action.actAction" method="{1}">
</action> <result name="json" type="json">
</package> <param name="root">jsonObject</param>
</result>
</action>
<action name="procdefinitionmodelsData_*" class="com.gaowj.procdefinitionmodels.action.dataAction" method="{1}">
<result name="json" type="json">
<param name="root">jsonObject</param>
</result>
</action>
<action name="procinstanceView_*" class="com.gaowj.procinstance.action.viewAction" method="{1}">
<result name="{1}">/process/pages/procinstance/{1}.jsp</result>
</action>
<action name="procinstanceAct_*" class="com.gaowj.procinstance.action.actAction" method="{1}">
<result name="json" type="json">
<param name="root">jsonObject</param>
</result>
</action>
<action name="procinstanceData_*" class="com.gaowj.procinstance.action.dataAction" method="{1}">
<result name="json" type="json">
<param name="root">jsonObject</param>
</result>
</action>
</package>
</struts> </struts>
package com.gaowj.business;
public interface FormmodelsBusiness {
}
package com.gaowj.business; package com.gaowj.business;
import java.io.InputStream;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -12,43 +13,59 @@ import com.gaowj.business.util.Page; ...@@ -12,43 +13,59 @@ import com.gaowj.business.util.Page;
public interface ProcdefinitionBusiness { public interface ProcdefinitionBusiness {
/** /**
* 插入 * 插入
*
* @param entity * @param entity
* @throws BusinessException * @throws BusinessException
*/ */
Map<String,Object> insert_procde_finition(Map<String,Object> entity) throws BusinessException ; Map<String, Object> insert_procde_finition(Map<String, Object> entity) throws BusinessException;
/** /**
* 更新 * 更新
*
* @param entity * @param entity
* @throws BusinessException * @throws BusinessException
*/ */
void update_procde_finition(Map<String,Object> entity) throws BusinessException ; void update_procde_finition(Map<String, Object> entity) throws BusinessException;
/** /**
* 删除记录 * 删除记录
*
* @param entity * @param entity
* @throws BusinessException * @throws BusinessException
*/ */
void delete_procde_finition(List<String> list)throws BusinessException; void delete_procde_finition(List<String> list) throws BusinessException;
/** /**
* 分页获取记录 * 分页获取记录
*
* @param entity * @param entity
* @throws BusinessException * @throws BusinessException
*/ */
Page<Map<String, Object>> list_procde_finition(int pageNo, int pageSize, Map<String, Object> query)throws BusinessException ; Page<Map<String, Object>> list_procde_finition(int pageNo, int pageSize, Map<String, Object> query) throws BusinessException;
/** /**
* 获取所有记录 * 获取所有记录
*
* @param entity * @param entity
* @throws BusinessException * @throws BusinessException
*/ */
List<Map<String,Object>> list_procde_finition(Map<String, Object> query) throws BusinessException ; List<Map<String, Object>> list_procde_finition(Map<String, Object> query) throws BusinessException;
/** /**
* 获取所有记录数 * 获取所有记录数
*
* @param entity * @param entity
* @throws BusinessException * @throws BusinessException
*/ */
int listCount_procde_finition(Map<String, Object> query) throws BusinessException ; int listCount_procde_finition(Map<String, Object> query) throws BusinessException;
/**
* 根据流程部署id获取流程图
*
* @param deploymentId
* @return
*/
InputStream viewPic(String deploymentId,StringBuffer filename) throws BusinessException;
String findFormModel(String procdefinitionUuid) throws BusinessException;
} }
package com.gaowj.business;
import java.util.List;
import java.util.Map;
import org.springframework.stereotype.Service;
import com.gaowj.business.exception.BusinessException;
import com.gaowj.business.util.Page;
@Service
public interface ProcinstanceBusiness {
/**
* 插入
*
* @param entity
* @throws BusinessException
*/
Map<String, Object> insert_proc_instance(Map<String, Object> entity) throws BusinessException;
/**
* 更新
*
* @param entity
* @throws BusinessException
*/
void update_proc_instance(Map<String, Object> entity) throws BusinessException;
/**
* 删除记录
*
* @param entity
* @throws BusinessException
*/
void delete_proc_instance(List<String> list) throws BusinessException;
/**
* 分页获取记录
*
* @param entity
* @throws BusinessException
*/
Page<Map<String, Object>> list_proc_instance(int pageNo, int pageSize, Map<String, Object> query) throws BusinessException;
/**
* 获取所有记录
*
* @param entity
* @throws BusinessException
*/
List<Map<String, Object>> list_proc_instance(Map<String, Object> query) throws BusinessException;
/**
* 获取所有记录数
*
* @param entity
* @throws BusinessException
*/
int listCount_proc_instance(Map<String, Object> query) throws BusinessException;
}
package com.gaowj.business.formmodels;
import com.gaowj.business.FormmodelsBusiness;
public class FormmodelsBusinessImpl implements FormmodelsBusiness {
}
package com.gaowj.business.formmodels;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.session.RowBounds;
import com.gaowj.business.exception.BusinessException;
public interface formmodelsDAO {
void insert_form_models(Map<String, Object> entity) throws BusinessException;
void update_form_models(Map<String, Object> entity) throws BusinessException;
void delete_form_models(List<String> list) throws BusinessException;
List<Map<String, Object>> list_form_models(RowBounds rowbounds, Map<String, Object> query) throws BusinessException;
List<Map<String, Object>> list_form_models(Map<String, Object> query) throws BusinessException;
int listCount_form_models(Map<String, Object> query) throws BusinessException;
}
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.gaowj.business.formmodels.formmodelsDAO">
<sql id="Where_Clause">
<trim prefix="WHERE" prefixOverrides="AND |OR">
<if test="UUID != null and UUID != ''">
and f.UUID = #{UUID}
</if>
<if test="TABLE_ID != null and TABLE_ID != ''">
and f.TABLE_ID = #{TABLE_ID}
</if>
<if test="FLAG != null and FLAG != ''">
and f.FLAG = #{FLAG}
</if>
</trim>
</sql>
<insert id="insert_form_models" parameterType="map">
insert into C_T_FORM_MODELS(
<trim prefix="" suffixOverrides=",">
<foreach collection="infoListKey" item="key">
${key},
</foreach>
</trim>
<![CDATA[ ) values( ]]>
<trim prefix="" suffixOverrides=",">
<foreach collection="infoList" item="value">
#{value},
</foreach>
</trim>
<![CDATA[ ) ]]>
</insert>
<update id="update_form_models" parameterType="map">
<![CDATA[
update C_T_FORM_MODELS set
]]>
<trim prefix="" suffixOverrides=",">
<foreach collection="info" item="info">
${info.key} = #{info.value} ,
</foreach>
</trim>
<where>
<if test="UUID != null and UUID != ''">
and UUID = #{UUID}
</if>
</where>
</update>
<delete id="delete_form_models" parameterType="list">
<![CDATA[
delete from C_T_FORM_MODELS where UUID IN
]]>
<foreach collection="list" item="UUID" open="(" separator=","
close=")">
#{UUID}
</foreach>
</delete>
<select id="list_form_models" parameterType="map" resultType="upperCaseKeyMap">
<![CDATA[
select f.*
from C_T_FORM_MODELS f
]]>
<include refid="Where_Clause" />
order by f.CREATE_TIME DESC
</select>
<select id="listCount_form_models" parameterType="map"
resultType="int">
<![CDATA[
select count(*) c from C_T_FORM_MODELS f
]]>
<include refid="Where_Clause" />
</select>
</mapper>
\ No newline at end of file
...@@ -7,9 +7,6 @@ import java.util.List; ...@@ -7,9 +7,6 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import javax.xml.crypto.Data;
import org.activiti.engine.RepositoryService;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.apache.ibatis.session.RowBounds; import org.apache.ibatis.session.RowBounds;
......
package com.gaowj.business.procdefinition; package com.gaowj.business.procdefinition;
import java.io.InputStream;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
...@@ -16,11 +17,23 @@ import com.gaowj.business.exception.BusinessException; ...@@ -16,11 +17,23 @@ import com.gaowj.business.exception.BusinessException;
import com.gaowj.business.util.Page; import com.gaowj.business.util.Page;
import com.gaowj.business.util.SessionUtil; import com.gaowj.business.util.SessionUtil;
import com.gaowj.business.formmodels.formmodelsDAO;
public class ProcdefinitionBusinessImpl implements ProcdefinitionBusiness { public class ProcdefinitionBusinessImpl implements ProcdefinitionBusiness {
private procdefinitionDAO procdefinitionDAO; private procdefinitionDAO procdefinitionDAO;
private formmodelsDAO formmodelsDAO;
private RepositoryService repositoryService; private RepositoryService repositoryService;
public formmodelsDAO getFormmodelsDAO() {
return formmodelsDAO;
}
public void setFormmodelsDAO(com.gaowj.business.formmodels.formmodelsDAO formmodelsDAO) {
this.formmodelsDAO = formmodelsDAO;
}
public procdefinitionDAO getProcdefinitionDAO() { public procdefinitionDAO getProcdefinitionDAO() {
return procdefinitionDAO; return procdefinitionDAO;
...@@ -108,7 +121,7 @@ public class ProcdefinitionBusinessImpl implements ProcdefinitionBusiness { ...@@ -108,7 +121,7 @@ public class ProcdefinitionBusinessImpl implements ProcdefinitionBusiness {
@Override @Override
public List<Map<String, Object>> list_procde_finition(Map<String, Object> query) throws BusinessException { public List<Map<String, Object>> list_procde_finition(Map<String, Object> query) throws BusinessException {
machining(query); machining(query);
return null; return procdefinitionDAO.list_procde_finition(query);
} }
@Override @Override
...@@ -117,6 +130,44 @@ public class ProcdefinitionBusinessImpl implements ProcdefinitionBusiness { ...@@ -117,6 +130,44 @@ public class ProcdefinitionBusinessImpl implements ProcdefinitionBusiness {
return procdefinitionDAO.listCount_procde_finition(query); return procdefinitionDAO.listCount_procde_finition(query);
} }
@Override
public InputStream viewPic(String deploymentId,StringBuffer filename) throws BusinessException{
// 获取图片资源名称
List<String> list = repositoryService.getDeploymentResourceNames(deploymentId);
// 定义图片资源的名称(一个流程定义,默认都有两个资源文件,一个是png,一个是xml,这里只获取png)
String resourceName = "";
if (list != null && list.size() > 0) {
for (String name : list) {
if (name.indexOf(".png") >= 0) {
resourceName = name;
}
}
}
// 获取图片的输入流
InputStream in = repositoryService.getResourceAsStream(deploymentId, resourceName);
filename.append(resourceName);
return in;
}
@Override
public String findFormModel(String procdefinitionUuid) throws BusinessException {
if(procdefinitionUuid==null||"".equals(procdefinitionUuid)){
return "-1";
}
Map<String, Object> query=new HashMap<String, Object>();
query.put("UUID", procdefinitionUuid);
String tableId=procdefinitionDAO.list_procde_finition(query).get(0).get("TABLE_ID").toString();
Map<String, Object> query2=new HashMap<String, Object>();
query2.put("FLAG", 1);
query2.put("TABLE_ID", tableId);
List<Map<String, Object>> listFormmodels=formmodelsDAO.list_form_models(query2);
if(listFormmodels.size()==0){
return "-1";
}
Object content=listFormmodels.get(0).get("MODEL_CONTENT");
return content==null?"":content.toString();
}
/** /**
* 更新或者插入时,处理map对象的形式(将字段信息存储为list,便于mybatis代码调用) * 更新或者插入时,处理map对象的形式(将字段信息存储为list,便于mybatis代码调用)
* *
...@@ -140,10 +191,10 @@ public class ProcdefinitionBusinessImpl implements ProcdefinitionBusiness { ...@@ -140,10 +191,10 @@ public class ProcdefinitionBusinessImpl implements ProcdefinitionBusiness {
} }
entity.put("info", updateList); entity.put("info", updateList);
} }
private void machining(Map<String, Object> query){ private void machining(Map<String, Object> query) {
if(query.get("PROC_NAME")!=null&&!"".equals(query.get("PROC_NAME"))){ if (query.get("PROC_NAME") != null && !"".equals(query.get("PROC_NAME"))) {
query.put("PROC_NAME", "%"+query.get("PROC_NAME")+"%"); query.put("PROC_NAME", "%" + query.get("PROC_NAME") + "%");
} }
} }
} }
...@@ -13,9 +13,15 @@ import org.activiti.bpmn.converter.BpmnXMLConverter; ...@@ -13,9 +13,15 @@ import org.activiti.bpmn.converter.BpmnXMLConverter;
import org.activiti.bpmn.model.BpmnModel; import org.activiti.bpmn.model.BpmnModel;
import org.activiti.editor.constants.ModelDataJsonConstants; import org.activiti.editor.constants.ModelDataJsonConstants;
import org.activiti.editor.language.json.converter.BpmnJsonConverter; import org.activiti.editor.language.json.converter.BpmnJsonConverter;
import org.activiti.engine.ActivitiException;
import org.activiti.engine.ActivitiIllegalArgumentException;
import org.activiti.engine.ManagementService; import org.activiti.engine.ManagementService;
import org.activiti.engine.RepositoryService; import org.activiti.engine.RepositoryService;
import org.activiti.engine.impl.RepositoryServiceImpl;
import org.activiti.engine.impl.persistence.entity.ResourceEntity;
import org.activiti.engine.impl.repository.DeploymentBuilderImpl;
import org.activiti.engine.repository.Deployment; import org.activiti.engine.repository.Deployment;
import org.activiti.engine.repository.DeploymentBuilder;
import org.activiti.engine.repository.Model; import org.activiti.engine.repository.Model;
import org.activiti.engine.repository.NativeModelQuery; import org.activiti.engine.repository.NativeModelQuery;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
...@@ -36,12 +42,8 @@ public class ProcdefinitionmodelsBusinessImpl implements ProcdefinitionmodelsBus ...@@ -36,12 +42,8 @@ public class ProcdefinitionmodelsBusinessImpl implements ProcdefinitionmodelsBus
private procdefinitionDAO procdefinitionDAO; private procdefinitionDAO procdefinitionDAO;
private RepositoryService repositoryService; private RepositoryService repositoryService;
private ManagementService managementService;
public procdefinitionmodelsDAO getProcdefinitionmodelsDAO() { private ManagementService managementService;
return procdefinitionmodelsDAO;
}
public void setProcdefinitionmodelsDAO(procdefinitionmodelsDAO procdefinitionmodelsDAO) { public void setProcdefinitionmodelsDAO(procdefinitionmodelsDAO procdefinitionmodelsDAO) {
this.procdefinitionmodelsDAO = procdefinitionmodelsDAO; this.procdefinitionmodelsDAO = procdefinitionmodelsDAO;
...@@ -117,6 +119,12 @@ public class ProcdefinitionmodelsBusinessImpl implements ProcdefinitionmodelsBus ...@@ -117,6 +119,12 @@ public class ProcdefinitionmodelsBusinessImpl implements ProcdefinitionmodelsBus
@Override @Override
public void delete_procde_finition_models(List<String> list) throws BusinessException { public void delete_procde_finition_models(List<String> list) throws BusinessException {
Map<String, Object> query = new HashMap<String, Object>();
query.put("listUUID", list);
List<Map<String, Object>> lists = procdefinitionmodelsDAO.list_procde_finition_models(query);
for (Map<String, Object> m : lists) {
repositoryService.deleteModel(m.get("MODEL_ID").toString());
}
procdefinitionmodelsDAO.delete_procde_finition_models(list); procdefinitionmodelsDAO.delete_procde_finition_models(list);
} }
...@@ -126,7 +134,7 @@ public class ProcdefinitionmodelsBusinessImpl implements ProcdefinitionmodelsBus ...@@ -126,7 +134,7 @@ public class ProcdefinitionmodelsBusinessImpl implements ProcdefinitionmodelsBus
int pageStart = (pageNo - 1) * pageSize; int pageStart = (pageNo - 1) * pageSize;
// 获取列表(流程定义id下的全部模块id) // 获取列表(流程定义id下的全部模块id)
Map<String, Object> query2=new HashMap<String, Object>(); Map<String, Object> query2 = new HashMap<String, Object>();
query2.put("PROC_DEFINITION_ID", query.get("PROCID")); query2.put("PROC_DEFINITION_ID", query.get("PROCID"));
List<Map<String, Object>> items = procdefinitionmodelsDAO.list_procde_finition_models(query2); List<Map<String, Object>> items = procdefinitionmodelsDAO.list_procde_finition_models(query2);
List<String> listId = new ArrayList<String>(); List<String> listId = new ArrayList<String>();
...@@ -149,22 +157,25 @@ public class ProcdefinitionmodelsBusinessImpl implements ProcdefinitionmodelsBus ...@@ -149,22 +157,25 @@ public class ProcdefinitionmodelsBusinessImpl implements ProcdefinitionmodelsBus
} }
condition.append(")"); condition.append(")");
addCondition(where, condition.toString()); addCondition(where, condition.toString());
} else {
// 如果listId为空,则不需要查询任何数据
addCondition(where, "1 = 2");
} }
// 设置查询条件 // 设置查询条件
if (query.get("modelName")!=null&&!"".equals(query.get("modelName"))) { if (query.get("MODEL_NAME") != null && !"".equals(query.get("MODEL_NAME"))) {
addCondition(where, "NAME_ LIKE #{modelName}"); addCondition(where, "NAME_ LIKE #{modelName}");
nativeModelQuery.parameter("modelName", "%" + query.get("modelName") + "%"); nativeModelQuery.parameter("modelName", "%" + query.get("MODEL_NAME") + "%");
} }
sql += where.toString(); sql += where.toString();
// 获取列表个数 // 获取列表个数
int count = Integer.valueOf(nativeModelQuery.sql("SELECT count(*) " + sql).count() + ""); int count = Integer.valueOf(nativeModelQuery.sql("SELECT count(*) " + sql).count() + "");
List<Model> listModel=nativeModelQuery.sql("SELECT * "+sql).listPage((pageNo-1) * pageSize, pageSize); List<Model> listModel = nativeModelQuery.sql("SELECT * " + sql).listPage((pageNo - 1) * pageSize, pageSize);
List<Map<String,Object>> listModelMap=new ArrayList<Map<String,Object>>(); List<Map<String, Object>> listModelMap = new ArrayList<Map<String, Object>>();
for(Model model:listModel){ for (Model model : listModel) {
Map<String,Object> m=new HashMap<String, Object>(); Map<String, Object> m = new HashMap<String, Object>();
listModelMap.add(m); listModelMap.add(m);
m.put("ID", model.getId()); m.put("ID", model.getId());
m.put("REVISION", model.getVersion()); m.put("REVISION", model.getVersion());
...@@ -175,14 +186,21 @@ public class ProcdefinitionmodelsBusinessImpl implements ProcdefinitionmodelsBus ...@@ -175,14 +186,21 @@ public class ProcdefinitionmodelsBusinessImpl implements ProcdefinitionmodelsBus
m.put("LASTUPDATETIME", model.getLastUpdateTime()); m.put("LASTUPDATETIME", model.getLastUpdateTime());
m.put("METAINFO", model.getMetaInfo()); m.put("METAINFO", model.getMetaInfo());
m.put("KEY", model.getKey()); m.put("KEY", model.getKey());
List<String> listKey=new ArrayList<String>(); for (Map<String, Object> item : items) {
for(String k:m.keySet()){ if (model.getId().equals(item.get("MODEL_ID"))) {
if(m.get(k)==null){ m.put("UUID", item.get("UUID"));
break;
}
}
List<String> listKey = new ArrayList<String>();
for (String k : m.keySet()) {
if (m.get(k) == null) {
listKey.add(k); listKey.add(k);
} }
} }
for(String k:listKey){ for (String k : listKey) {
m.remove(k); m.remove(k);
} }
} }
...@@ -207,12 +225,12 @@ public class ProcdefinitionmodelsBusinessImpl implements ProcdefinitionmodelsBus ...@@ -207,12 +225,12 @@ public class ProcdefinitionmodelsBusinessImpl implements ProcdefinitionmodelsBus
machining(query); machining(query);
return procdefinitionmodelsDAO.listCount_procde_finition_models(query); return procdefinitionmodelsDAO.listCount_procde_finition_models(query);
} }
@Override @Override
public void deploy(Map<String, Object> query) throws BusinessException { public void deploy(Map<String, Object> query) throws BusinessException {
String procId=query.get("PROCID").toString(); String procId = query.get("PROCID").toString();
String modelId=query.get("MODELID").toString(); String modelId = query.get("MODELID").toString();
Model modelData = repositoryService.getModel(modelId); Model modelData = repositoryService.getModel(modelId);
ObjectNode modelNode = null; ObjectNode modelNode = null;
try { try {
...@@ -225,12 +243,13 @@ public class ProcdefinitionmodelsBusinessImpl implements ProcdefinitionmodelsBus ...@@ -225,12 +243,13 @@ public class ProcdefinitionmodelsBusinessImpl implements ProcdefinitionmodelsBus
byte[] bpmnBytes = null; byte[] bpmnBytes = null;
BpmnModel model = new BpmnJsonConverter().convertToBpmnModel(modelNode); BpmnModel model = new BpmnJsonConverter().convertToBpmnModel(modelNode);
bpmnBytes = new BpmnXMLConverter().convertToXML(model); bpmnBytes = new BpmnXMLConverter().convertToXML(model, "GBK");
String processName = modelData.getName() + ".bpmn20.xml"; String processName = modelData.getName() + ".bpmn20.xml";
Deployment deployment = repositoryService.createDeployment().name(modelData.getName()).addString(processName, new String(bpmnBytes)).deploy(); Deployment deployment = repositoryService.createDeployment().name(modelData.getName()).addString(processName, new String(bpmnBytes)).deploy();
//将部署id存入流程定义表 // 将部署id存入流程定义表
Map<String,Object> entity=new HashMap<String, Object>(); Map<String, Object> entity = new HashMap<String, Object>();
entity.put("UUID", procId); entity.put("UUID", procId);
entity.put("DEPLOYMENT_ID", deployment.getId()); entity.put("DEPLOYMENT_ID", deployment.getId());
convertEntity(entity); convertEntity(entity);
...@@ -307,16 +326,17 @@ public class ProcdefinitionmodelsBusinessImpl implements ProcdefinitionmodelsBus ...@@ -307,16 +326,17 @@ public class ProcdefinitionmodelsBusinessImpl implements ProcdefinitionmodelsBus
} }
return repositoryService.createModelQuery().modelId(modelData.getId()).singleResult(); return repositoryService.createModelQuery().modelId(modelData.getId()).singleResult();
} }
/** /**
* 添加条件 * 添加条件
*
* @param where * @param where
* @param condition * @param condition
*/ */
private void addCondition(StringBuffer where, String condition) { private void addCondition(StringBuffer where, String condition) {
if (where.length() == 0) { if (where.length() == 0) {
where.append(" WHERE"); where.append(" WHERE");
}else{ } else {
where.append(" AND"); where.append(" AND");
} }
where.append(" ").append(condition).toString(); where.append(" ").append(condition).toString();
......
...@@ -9,6 +9,12 @@ ...@@ -9,6 +9,12 @@
<if test="PROC_DEFINITION_ID != null and PROC_DEFINITION_ID != ''"> <if test="PROC_DEFINITION_ID != null and PROC_DEFINITION_ID != ''">
and f.PROC_DEFINITION_ID = #{PROC_DEFINITION_ID} and f.PROC_DEFINITION_ID = #{PROC_DEFINITION_ID}
</if> </if>
<if test="listUUID != null and listUUID != ''">
and f.UUID IN
<foreach collection="listUUID" item="oneUUID" open="(" close=")" separator=",">
#{oneUUID}
</foreach>
</if>
</trim> </trim>
</sql> </sql>
<insert id="insert_procde_finition_models" parameterType="map"> <insert id="insert_procde_finition_models" parameterType="map">
......
package com.gaowj.business.procinstance;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.activiti.engine.ManagementService;
import org.activiti.engine.RuntimeService;
import org.activiti.engine.runtime.ProcessInstance;
import org.activiti.engine.runtime.ProcessInstanceQuery;
import com.gaowj.business.ProcinstanceBusiness;
import com.gaowj.business.exception.BusinessException;
import com.gaowj.business.procdefinition.procdefinitionDAO;
import com.gaowj.business.util.Page;
public class ProcinstanceBusinessImpl implements ProcinstanceBusiness {
private procdefinitionDAO procdefinitionDAO;
private RuntimeService runtimeService;
public RuntimeService getRuntimeService() {
return runtimeService;
}
public void setRuntimeService(RuntimeService runtimeService) {
this.runtimeService = runtimeService;
}
public procdefinitionDAO getProcdefinitionDAO() {
return procdefinitionDAO;
}
public void setProcdefinitionDAO(procdefinitionDAO procdefinitionDAO) {
this.procdefinitionDAO = procdefinitionDAO;
}
@Override
public Map<String, Object> insert_proc_instance(Map<String, Object> entity) throws BusinessException {
// TODO Auto-generated method stub
return null;
}
@Override
public void update_proc_instance(Map<String, Object> entity) throws BusinessException {
// TODO Auto-generated method stub
}
@Override
public void delete_proc_instance(List<String> list) throws BusinessException {
// TODO Auto-generated method stub
}
@Override
public Page<Map<String, Object>> list_proc_instance(int pageNo, int pageSize, Map<String, Object> query) throws BusinessException {
// 计算起始记录
int pageStart = (pageNo - 1) * pageSize;
ProcessInstanceQuery leaveDynamicQuery = runtimeService.createProcessInstanceQuery()
.orderByProcessInstanceId().desc().active();
if(query.get("PROCDEFINITION_UUID")!=null&&!"".equals(query.get("PROCDEFINITION_UUID"))){
Map<String, Object> query2=new HashMap<String, Object>();
query2.put("UUID", query.get("PROCDEFINITION_UUID"));
String deploymentKey=procdefinitionDAO.list_procde_finition(query2).get(0).get("DEPLOYMENT_KEY").toString();
if(deploymentKey!=null&&!"".equals(deploymentKey)){
leaveDynamicQuery.processDefinitionKey(deploymentKey);
}
}
List<ProcessInstance> list = leaveDynamicQuery.listPage(pageStart, pageSize);
List<Map<String, Object>> items=new ArrayList<Map<String,Object>>();
for(ProcessInstance processInstance:list){
Map<String, Object> item=new HashMap<String, Object>();
items.add(item);
item.put("NAME", processInstance.getName());
}
int count=(int) leaveDynamicQuery.count();
// 创建分页对象
Page<Map<String, Object>> page = new Page<Map<String, Object>>();
page.setStart(pageStart);
page.setLimit(pageSize);
page.setCount(count);
page.setItems(items);
return page;
}
@Override
public List<Map<String, Object>> list_proc_instance(Map<String, Object> query) throws BusinessException {
// TODO Auto-generated method stub
return null;
}
@Override
public int listCount_proc_instance(Map<String, Object> query) throws BusinessException {
// TODO Auto-generated method stub
return 0;
}
}
package com.gaowj.business.procinstance;
public interface procinstanceDAO {
}
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.gaowj.business.procinstance.procinstanceDAO">
<sql id="Where_Clause">
<trim prefix="WHERE" prefixOverrides="AND |OR">
<if test="UUID != null and UUID != ''">
and f.UUID = #{UUID}
</if>
<if test="PROC_DEFINITION_ID != null and PROC_DEFINITION_ID != ''">
and f.PROC_DEFINITION_ID = #{PROC_DEFINITION_ID}
</if>
<if test="listUUID != null and listUUID != ''">
and f.UUID IN
<foreach collection="listUUID" item="oneUUID" open="(" close=")" separator=",">
#{oneUUID}
</foreach>
</if>
</trim>
</sql>
<insert id="insert_procde_finition_models" parameterType="map">
insert into C_T_PROC_DEFINITION_MODELS(
<trim prefix="" suffixOverrides=",">
<foreach collection="infoListKey" item="key">
${key},
</foreach>
</trim>
<![CDATA[ ) values( ]]>
<trim prefix="" suffixOverrides=",">
<foreach collection="infoList" item="value">
#{value},
</foreach>
</trim>
<![CDATA[ ) ]]>
</insert>
<update id="update_procde_finition_models" parameterType="map">
<![CDATA[
update C_T_PROC_DEFINITION_MODELS set
]]>
<trim prefix="" suffixOverrides=",">
<foreach collection="info" item="info">
${info.key} = #{info.value} ,
</foreach>
</trim>
<where>
<if test="UUID != null and UUID != ''">
and UUID = #{UUID}
</if>
</where>
</update>
<delete id="delete_procde_finition_models" parameterType="list">
<![CDATA[
delete from C_T_PROC_DEFINITION_MODELS where UUID IN
]]>
<foreach collection="list" item="UUID" open="(" separator=","
close=")">
#{UUID}
</foreach>
</delete>
<select id="list_procde_finition_models" parameterType="map" resultType="upperCaseKeyMap">
<![CDATA[
select f.*
from C_T_PROC_DEFINITION_MODELS f
]]>
<include refid="Where_Clause" />
order by f.CREATE_TIME DESC
</select>
<select id="listCount_procde_finition_models" parameterType="map"
resultType="int">
<![CDATA[
select count(*) c from C_T_PROC_DEFINITION_MODELS f
]]>
<include refid="Where_Clause" />
</select>
</mapper>
\ No newline at end of file
package com.gaowj.procdefinition.action; package com.gaowj.procdefinition.action;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.sql.SQLException; import java.sql.SQLException;
import java.text.ParseException; import java.text.ParseException;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
import com.gaowj.business.ProcdefinitionBusiness; import com.gaowj.business.ProcdefinitionBusiness;
...@@ -22,6 +26,9 @@ public class dataAction extends BasicAction{ ...@@ -22,6 +26,9 @@ public class dataAction extends BasicAction{
*/ */
private static final long serialVersionUID = -5059421324729466816L; private static final long serialVersionUID = -5059421324729466816L;
private StringBuffer filename=new StringBuffer();
private InputStream is;
private JSONObject jsonObject = new JSONObject(); private JSONObject jsonObject = new JSONObject();
private int rows = 20;// 每页显示的记录数 private int rows = 20;// 每页显示的记录数
private int page = 1;// 当前第几页 private int page = 1;// 当前第几页
...@@ -74,4 +81,76 @@ public class dataAction extends BasicAction{ ...@@ -74,4 +81,76 @@ public class dataAction extends BasicAction{
} }
return "json"; return "json";
} }
public String listAll() throws BusinessException {
ProcdefinitionBusiness business = BusinessManager.getBusiness(ProcdefinitionBusiness.class);
Map<String, Object> query = RequestUtils.getUpdateFieldMap(request,RequestUtils.UPDATEDATAFIELDPREFIX);
try {
query = QueryParamUtil.StringToDate(query);
List<Map<String, Object>> listRows = business.list_procde_finition( query);
setPageCount((listRows.size() - 1) / pageSize + 1);
Map<String, Object> data = new HashMap<String, Object>();
data.put("rowSet", QueryParamUtil.DateToString(listRows));
data.put("pageNo", pageNo);
data.put("pageSize", pageSize);
data.put("pageCount", pageCount);
data.put("rows", data.get("rowSet"));
data.put("total", listRows.size());
jsonObject = new JSONObject();
jsonObject.putAll(data);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return "json";
}
/**
* 获取流程定义中的表模板
* @return
*/
public String findFormModel() throws BusinessException {
ProcdefinitionBusiness business = BusinessManager.getBusiness(ProcdefinitionBusiness.class);
Map<String, Object> query = RequestUtils.getUpdateFieldMap(request,RequestUtils.UPDATEDATAFIELDPREFIX);
jsonObject = new JSONObject();
if(query.get("PROCDEFINITION_UUID")==null){
query.put("PROCDEFINITION_UUID","");
}
jsonObject.put("MODEL_CONTENT", business.findFormModel(query.get("PROCDEFINITION_UUID").toString()));
return "json";
}
/**
* 获取流程图片
* @return
* @throws BusinessException
*/
public String showProcdefinitionImg() throws BusinessException{
ProcdefinitionBusiness business = BusinessManager.getBusiness(ProcdefinitionBusiness.class);
is=business.viewPic(request.getParameter("deploymentId"),filename);
return "download";
/*ProcdefinitionBusiness business = BusinessManager.getBusiness(ProcdefinitionBusiness.class);
InputStream is=business.viewPic(request.getParameter("deploymentId"),filename);
return is;*/
}
public InputStream getInputStream() throws Exception {
return is;
}
public String getFileName() throws UnsupportedEncodingException{
String name=filename.toString();
String agent = request.getHeader("User-agent");
// 如果浏览器是IE浏览器,就得进行编码转换
if (agent.contains("MSIE")) {
name = URLEncoder.encode(name, "UTF-8");
} else {
name = new String(name.getBytes(), "ISO-8859-1");
}
return name;
}
} }
package com.gaowj.procinstance.action;
import java.util.List;
import java.util.Map;
import com.gaowj.business.ProcdefinitionBusiness;
import com.gaowj.business.ProcdefinitionmodelsBusiness;
import com.gaowj.business.StudentBusiness;
import com.gaowj.business.SystemOpeBusiness;
import com.gaowj.business.action.BasicAction;
import com.gaowj.business.comp.BusinessManager;
import com.gaowj.business.exception.BusinessException;
import com.gaowj.business.util.QueryParamUtil;
import com.gaowj.business.util.RequestUtils;
import com.gaowj.business.util.Status;
import net.sf.json.JSONObject;
public class actAction extends BasicAction {
/**
*
*/
private static final long serialVersionUID = 1559759499504671708L;
private JSONObject jsonObject = new JSONObject();
public JSONObject getJsonObject() {
return jsonObject;
}
public void setJsonObject(JSONObject jsonObject) {
this.jsonObject = jsonObject;
}
/**
* 插入
*
* @param entity
* @throws BusinessException
*/
public String insertProcdefinitionmodels() throws BusinessException {
ProcdefinitionmodelsBusiness business = BusinessManager.getBusiness(ProcdefinitionmodelsBusiness.class);
Map<String, Object> entity = RequestUtils.getUpdateFieldMap(request,RequestUtils.UPDATEDATAFIELDPREFIX);
jsonObject = new JSONObject();
try {
entity = QueryParamUtil.StringToDate(entity);
//去除不要更新的字段
entity.remove("OPETYPE");
//新增
Map<String,Object> procdefinitionmodels=business.insert_procde_finition_models(entity);
// 操作日志
//sysbusiness.insert_logBusiness(具体方法,操作内容,操作描述,操作记录ID,操作记录中文描述,分类)
SystemOpeBusiness sysbusiness = BusinessManager.getBusiness(SystemOpeBusiness.class);
sysbusiness.insert_logBusiness("insertProcdefinitionmodels", "" + procdefinitionmodels,
"增加流程定义模板数据", (String) entity.get("UUID"), (String) entity.get("CONTENT"), "procdefinitionmodels");
//
//
jsonObject.putAll(Status.getStatusSuccessMessage("保存成功"));
} catch (Exception e) {
jsonObject.putAll(Status.getStatusErrorMessage("保存失败"));
e.printStackTrace();
}
return "json";
}
public String updateProcdefinitionmodels() throws BusinessException {
ProcdefinitionmodelsBusiness business = BusinessManager.getBusiness(ProcdefinitionmodelsBusiness.class);
Map<String, Object> entity = RequestUtils.getUpdateFieldMap(request,RequestUtils.UPDATEDATAFIELDPREFIX);
jsonObject = new JSONObject();
try {
entity = QueryParamUtil.StringToDate(entity);
//去除不要更新的字段
entity.remove("OPETYPE");
//新增
business.update_procde_finition_models(entity);
// 操作日志
//sysbusiness.insert_logBusiness(具体方法,操作内容,操作描述,操作记录ID,操作记录中文描述,分类)
SystemOpeBusiness sysbusiness = BusinessManager.getBusiness(SystemOpeBusiness.class);
sysbusiness.insert_logBusiness("updateProcdefinitionmodels", "" + entity,
"修改流程定义模板数据", (String) entity.get("UUID"), (String) entity.get("CONTENT"), "procdefinitionmodels");
//
//
jsonObject.putAll(Status.getStatusSuccessMessage("保存成功"));
} catch (Exception e) {
jsonObject.putAll(Status.getStatusErrorMessage("保存失败"));
e.printStackTrace();
}
return "json";
}
public String deleteProcdefinitionmodels() throws BusinessException {
ProcdefinitionmodelsBusiness business = BusinessManager.getBusiness(ProcdefinitionmodelsBusiness.class);
Map<String, Object> entity = RequestUtils.getUpdateFieldMap(request,RequestUtils.UPDATEDATAFIELDPREFIX);
String deletekey = (String) entity.get("CODE");
List<String> ListKey = QueryParamUtil.StringToList(deletekey);
try {
business.delete_procde_finition_models(ListKey);
// 操作日志
SystemOpeBusiness sysbusiness = BusinessManager.getBusiness(SystemOpeBusiness.class);
sysbusiness.insert_logBusiness("deleteProcdefinitionmodels", "" + ListKey,
"删除流程定义模板数据", deletekey, "多个流水号","procdefinitionmodels");
//
jsonObject.putAll(Status.getStatusSuccessMessage("删除成功"));
} catch (Exception e) {
jsonObject.putAll(Status.getStatusErrorMessage("删除失败"));
e.printStackTrace();
}
return "json";
}
public String deploy() throws BusinessException {
ProcdefinitionmodelsBusiness business = BusinessManager.getBusiness(ProcdefinitionmodelsBusiness.class);
Map<String, Object> entity = RequestUtils.getUpdateFieldMap(request,RequestUtils.UPDATEDATAFIELDPREFIX);
try {
business.deploy(entity);
// 操作日志
SystemOpeBusiness sysbusiness = BusinessManager.getBusiness(SystemOpeBusiness.class);
sysbusiness.insert_logBusiness("deploy", "" + entity,
"部署流程定义模板数据", (String) entity.get("UUID"), (String) entity.get("CONTENT"), "procdefinitionmodels");
//
jsonObject.putAll(Status.getStatusSuccessMessage("部署成功"));
} catch (Exception e) {
jsonObject.putAll(Status.getStatusErrorMessage("部署失败"));
e.printStackTrace();
}
return "json";
}
}
package com.gaowj.procinstance.action;
import java.sql.SQLException;
import java.text.ParseException;
import java.util.HashMap;
import java.util.Map;
import com.gaowj.business.ProcinstanceBusiness;
import com.gaowj.business.action.BasicAction;
import com.gaowj.business.comp.BusinessManager;
import com.gaowj.business.exception.BusinessException;
import com.gaowj.business.util.Page;
import com.gaowj.business.util.QueryParamUtil;
import com.gaowj.business.util.RequestUtils;
import net.sf.json.JSONObject;
public class dataAction extends BasicAction{
/**
*
*/
private static final long serialVersionUID = -5059421324729466816L;
private JSONObject jsonObject = new JSONObject();
private int rows = 20;// 每页显示的记录数
private int page = 1;// 当前第几页
public JSONObject getJsonObject() {
return jsonObject;
}
public void setJsonObject(JSONObject jsonObject) {
this.jsonObject = jsonObject;
}
public int getRows() {
return rows;
}
public void setRows(int rows) {
this.rows = rows;
}
public int getPage() {
return page;
}
public void setPage(int page) {
this.page = page;
}
/**
* 分页获取记录
* @param entity
* @throws BusinessException
*/
public String list() throws BusinessException {
ProcinstanceBusiness business = BusinessManager.getBusiness(ProcinstanceBusiness.class);
Map<String, Object> query = RequestUtils.getUpdateFieldMap(request,RequestUtils.UPDATEDATAFIELDPREFIX);
try {
query = QueryParamUtil.StringToDate(query);
Page<Map<String, Object>> pageRows = business.list_proc_instance(pageNo,pageSize, query);
setPageCount((pageRows.getCount() - 1) / pageSize + 1);
Map<String, Object> data = new HashMap<String, Object>();
data.put("rowSet", QueryParamUtil.DateToString(pageRows.getItems()));
data.put("pageNo", pageNo);
data.put("pageSize", pageSize);
data.put("pageCount", pageCount);
data.put("rows", data.get("rowSet"));
data.put("total", pageRows.getCount());
jsonObject = new JSONObject();
jsonObject.putAll(data);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return "json";
}
}
package com.gaowj.procinstance.action;
import java.util.Map;
import com.gaowj.business.action.BasicAction;
import com.gaowj.business.exception.BusinessException;
import com.gaowj.business.util.RequestUtils;
public class viewAction extends BasicAction {
/**
*
*/
private static final long serialVersionUID = -5986096180610140300L;
public String procinstanceTab() throws BusinessException{
return "procinstanceTab";
}
public String procinstanceTabDetail() throws BusinessException{
Map<String,Object> query = RequestUtils.getUpdateFieldMapUtf8(request, RequestUtils.UPDATEDATAFIELDPREFIX);
request.setAttribute("is_row", query);
return "procinstanceTabDetail";
}
}
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.engine.impl.repository;
import org.activiti.bpmn.converter.BpmnXMLConverter;
import org.activiti.bpmn.model.BpmnModel;
import org.activiti.engine.ActivitiException;
import org.activiti.engine.ActivitiIllegalArgumentException;
import org.activiti.engine.impl.RepositoryServiceImpl;
import org.activiti.engine.impl.persistence.entity.DeploymentEntity;
import org.activiti.engine.impl.persistence.entity.ResourceEntity;
import org.activiti.engine.impl.util.IoUtil;
import org.activiti.engine.impl.util.ReflectUtil;
import org.activiti.engine.repository.Deployment;
import org.activiti.engine.repository.DeploymentBuilder;
import java.io.InputStream;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.util.Date;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
/**
* @author Tom Baeyens
* @author Joram Barrez
*/
public class DeploymentBuilderImpl implements DeploymentBuilder, Serializable {
private static final long serialVersionUID = 1L;
protected static final String DEFAULT_ENCODING = "UTF-8";
protected transient RepositoryServiceImpl repositoryService;
protected DeploymentEntity deployment = new DeploymentEntity();
protected boolean isBpmn20XsdValidationEnabled = true;
protected boolean isProcessValidationEnabled = true;
protected boolean isDuplicateFilterEnabled = false;
protected Date processDefinitionsActivationDate;
public DeploymentBuilderImpl(RepositoryServiceImpl repositoryService) {
this.repositoryService = repositoryService;
}
public DeploymentBuilder addInputStream(String resourceName, InputStream inputStream) {
if (inputStream==null) {
throw new ActivitiIllegalArgumentException("inputStream for resource '"+resourceName+"' is null");
}
byte[] bytes = IoUtil.readInputStream(inputStream, resourceName);
ResourceEntity resource = new ResourceEntity();
resource.setName(resourceName);
resource.setBytes(bytes);
deployment.addResource(resource);
return this;
}
public DeploymentBuilder addClasspathResource(String resource) {
InputStream inputStream = ReflectUtil.getResourceAsStream(resource);
if (inputStream==null) {
throw new ActivitiIllegalArgumentException("resource '"+resource+"' not found");
}
return addInputStream(resource, inputStream);
}
public DeploymentBuilder addString(String resourceName, String text, String encoding) {
if (text==null) {
throw new ActivitiIllegalArgumentException("text is null");
}
ResourceEntity resource = new ResourceEntity();
resource.setName(resourceName);
try {
resource.setBytes(text.getBytes(encoding));
} catch (UnsupportedEncodingException e) {
throw new ActivitiException("Unable to get process bytes.", e);
}
deployment.addResource(resource);
return this;
}
public DeploymentBuilder addString(String resourceName, String text) {
if (text==null) {
throw new ActivitiIllegalArgumentException("text is null");
}
ResourceEntity resource = new ResourceEntity();
resource.setName(resourceName);
try {
resource.setBytes(text.getBytes(DEFAULT_ENCODING));
} catch (UnsupportedEncodingException e) {
throw new ActivitiException("Unable to get process bytes.", e);
}
deployment.addResource(resource);
return this;
}
public DeploymentBuilder addZipInputStream(ZipInputStream zipInputStream) {
try {
ZipEntry entry = zipInputStream.getNextEntry();
while (entry != null) {
if (!entry.isDirectory()) {
String entryName = entry.getName();
byte[] bytes = IoUtil.readInputStream(zipInputStream, entryName);
ResourceEntity resource = new ResourceEntity();
resource.setName(entryName);
resource.setBytes(bytes);
deployment.addResource(resource);
}
entry = zipInputStream.getNextEntry();
}
} catch (Exception e) {
throw new ActivitiException("problem reading zip input stream", e);
}
return this;
}
public DeploymentBuilder addBpmnModel(String resourceName, BpmnModel bpmnModel) {
BpmnXMLConverter bpmnXMLConverter = new BpmnXMLConverter();
try {
String bpmn20Xml = new String(bpmnXMLConverter.convertToXML(bpmnModel), "UTF-8");
addString(resourceName, bpmn20Xml);
} catch (UnsupportedEncodingException e) {
throw new ActivitiException("Errot while transforming BPMN model to xml: not UTF-8 encoded", e);
}
return this;
}
public DeploymentBuilder name(String name) {
deployment.setName(name);
return this;
}
public DeploymentBuilder category(String category) {
deployment.setCategory(category);
return this;
}
public DeploymentBuilder disableBpmnValidation() {
this.isProcessValidationEnabled = false;
return this;
}
public DeploymentBuilder disableSchemaValidation() {
this.isBpmn20XsdValidationEnabled = false;
return this;
}
public DeploymentBuilder tenantId(String tenantId) {
deployment.setTenantId(tenantId);
return this;
}
public DeploymentBuilder enableDuplicateFiltering() {
this.isDuplicateFilterEnabled = true;
return this;
}
public DeploymentBuilder activateProcessDefinitionsOn(Date date) {
this.processDefinitionsActivationDate = date;
return this;
}
public Deployment deploy() {
return repositoryService.deploy(this);
}
// getters and setters //////////////////////////////////////////////////////
public DeploymentEntity getDeployment() {
return deployment;
}
public boolean isProcessValidationEnabled() {
return isProcessValidationEnabled;
}
public boolean isBpmn20XsdValidationEnabled() {
return isBpmn20XsdValidationEnabled;
}
public boolean isDuplicateFilterEnabled() {
return isDuplicateFilterEnabled;
}
public Date getProcessDefinitionsActivationDate() {
return processDefinitionsActivationDate;
}
}
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.engine.repository;
import java.io.InputStream;
import java.util.Date;
import java.util.zip.ZipInputStream;
import org.activiti.bpmn.model.BpmnModel;
/**
* Builder for creating new deployments.
*
* A builder instance can be obtained through {@link org.activiti.engine.RepositoryService#createDeployment()}.
*
* Multiple resources can be added to one deployment before calling the {@link #deploy()}
* operation.
*
* After deploying, no more changes can be made to the returned deployment
* and the builder instance can be disposed.
*
* @author Tom Baeyens
* @author Joram Barrez
*/
public interface DeploymentBuilder {
DeploymentBuilder addInputStream(String resourceName, InputStream inputStream);
DeploymentBuilder addClasspathResource(String resource);
DeploymentBuilder addString(String resourceName, String text);
DeploymentBuilder addString(String resourceName, String text, String encoding);
DeploymentBuilder addZipInputStream(ZipInputStream zipInputStream);
DeploymentBuilder addBpmnModel(String resourceName, BpmnModel bpmnModel);
/**
* If called, no XML schema validation against the BPMN 2.0 XSD.
*
* Not recommended in general.
*/
DeploymentBuilder disableSchemaValidation();
/**
* If called, no validation that the process definition is executable on the engine
* will be done against the process definition.
*
* Not recommended in general.
*/
DeploymentBuilder disableBpmnValidation();
/**
* Gives the deployment the given name.
*/
DeploymentBuilder name(String name);
/**
* Gives the deployment the given category.
*/
DeploymentBuilder category(String category);
/**
* Gives the deployment the given tenant id.
*/
DeploymentBuilder tenantId(String tenantId);
/**
* If set, this deployment will be compared to any previous deployment.
* This means that every (non-generated) resource will be compared with the
* provided resources of this deployment.
*/
DeploymentBuilder enableDuplicateFiltering();
/**
* Sets the date on which the process definitions contained in this deployment
* will be activated. This means that all process definitions will be deployed
* as usual, but they will be suspended from the start until the given activation date.
*/
DeploymentBuilder activateProcessDefinitionsOn(Date date);
/**
* Deploys all provided sources to the Activiti engine.
*/
Deployment deploy();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment