Commit f66352fa by 罗绍泽

流程实例运行

parent e9c018a3
...@@ -117,5 +117,9 @@ ...@@ -117,5 +117,9 @@
<bean id="ProctaskBusiness" class="com.gaowj.business.proctask.ProctaskBusinessImpl"> <bean id="ProctaskBusiness" class="com.gaowj.business.proctask.ProctaskBusinessImpl">
<property name="taskService" ref="taskService"></property> <property name="taskService" ref="taskService"></property>
<property name="procinstanceDAO" ref="procinstanceDAO"></property>
<property name="formmodelsDAO" ref="formmodelsDAO"></property>
<property name="procdefinitionDAO" ref="procdefinitionDAO"></property>
<property name="formtableDAO" ref="formtableDAO"></property>
</bean> </bean>
</beans> </beans>
...@@ -340,10 +340,10 @@ function nextBox(Box_id,List_id) { ...@@ -340,10 +340,10 @@ function nextBox(Box_id,List_id) {
var v_result; var v_result;
if ($('#OPETYPE').val() == null || $('#OPETYPE').val() == undefined if ($('#OPETYPE').val() == null || $('#OPETYPE').val() == undefined
|| $('#OPETYPE').val() == '' || $('#OPETYPE').val()=='insert'){ || $('#OPETYPE').val() == '' || $('#OPETYPE').val()=='insert'){
v_result = insertData(query); v_result = insertDataToNext(query);
} }
else{ else{
v_result = updateData(query); v_result = updateDataToNext(query);
} }
if (v_result != null && v_result != undefined) { if (v_result != null && v_result != undefined) {
closeBox(Box_id); closeBox(Box_id);
......
...@@ -180,6 +180,7 @@ function addUrlOnloadCallback(is_row){ ...@@ -180,6 +180,7 @@ function addUrlOnloadCallback(is_row){
//保存 //保存
function insertData(is_entity){ function insertData(is_entity){
is_entity.FIELD_PROCID=$('#detail #FIELD_PROCDEFINITION_UUID').combobox("getValue"); is_entity.FIELD_PROCID=$('#detail #FIELD_PROCDEFINITION_UUID').combobox("getValue");
is_entity.FIELD_FORM_MODEL_ID=$("#FIELD_FORM_MODEL_ID").val();
var v_result = procinstanceModule.act.insertInfo(is_entity); var v_result = procinstanceModule.act.insertInfo(is_entity);
$('#list').datagrid('reload'); $('#list').datagrid('reload');
return v_result; return v_result;
...@@ -451,10 +452,12 @@ function uploadcommonBatchRow(){ ...@@ -451,10 +452,12 @@ function uploadcommonBatchRow(){
/****/ /****/
function fillTable(){ function fillTable(){
var table_content=procdefinitionModule.data.findFormModel({ var table_model=procdefinitionModule.data.findFormModel({
FIELD_PROCDEFINITION_UUID:$('#detail #FIELD_PROCDEFINITION_UUID').combobox("getValue") FIELD_PROCDEFINITION_UUID:$('#detail #FIELD_PROCDEFINITION_UUID').combobox("getValue")
}); });
var table_content=table_model.MODEL;
$("#table_content").html(''); $("#table_content").html('');
$("#FIELD_FORM_MODEL_ID").val('');
if($('#detail #FIELD_PROCDEFINITION_UUID').combobox("getValue")==''){ if($('#detail #FIELD_PROCDEFINITION_UUID').combobox("getValue")==''){
//什么都不做 //什么都不做
...@@ -462,6 +465,7 @@ function fillTable(){ ...@@ -462,6 +465,7 @@ function fillTable(){
$.messager.alert('提示','该流程对应的表没有设置有效的模板信息!'); $.messager.alert('提示','该流程对应的表没有设置有效的模板信息!');
}else{ }else{
$("#table_content").html(table_content.MODEL_CONTENT); $("#table_content").html(table_content.MODEL_CONTENT);
$("#FIELD_FORM_MODEL_ID").val(table_content.UUID);
} }
} }
......
<%@page contentType="text/html; charset=UTF-8"%> <%@page contentType="text/html; charset=UTF-8"%>
<form id="detail"> <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; 流程: <input class="easyui-textbox" id="FIELD_PROCDEFINITION_UUID" name="FIELD_PROCDEFINITION_UUID" style="width:200px" value="${is_row.PROCDEFINITION_UUID}"/>&nbsp;&nbsp;
<input type="hidden" id="FIELD_FORM_MODEL_ID" />
</form> </form>
<form id="inputForm" method="post" style="width: 100%;"> <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_OPETYPE" id="OPETYPE" value="${is_row.OPETYPE}" />
......
...@@ -9,7 +9,7 @@ var proctaskModule = function(format) { ...@@ -9,7 +9,7 @@ var proctaskModule = function(format) {
proctaskModule.prototype = BusinessObject; proctaskModule.prototype = BusinessObject;
//插入流程实例 //插入流程实例
proctaskModule.prototype.insertInfo = function(){}; proctaskModule.prototype.getInfo = function(){};
//修改流程实例 //修改流程实例
proctaskModule.prototype.updateInfo = function(){}; proctaskModule.prototype.updateInfo = function(){};
//删除流程实例 //删除流程实例
......
...@@ -39,6 +39,23 @@ var ls_ywlx = 'YBYW'; ...@@ -39,6 +39,23 @@ var ls_ywlx = 'YBYW';
* 单位:宁波金网 * 单位:宁波金网
* 备注:需更改 * 备注:需更改
**/ **/
var v_data_procdefinition=procdefinitionModule.data.listAll().rowSet;
var v_data_procdefinition2=new Array();
v_data_procdefinition.splice(0, 0, {
DEPLOYMENT_KEY:'all',
PROC_NAME:'-- 全部 --'
});
$('#FIELD_PROCDEFINITION_UUID').combobox({
data : v_data_procdefinition,
valueField : 'UUID',
textField : 'PROC_NAME',
editable:false,
panelHeight:'auto'
});
$('#FIELD_PROCDEFINITION_UUID').combobox('setValue',v_data_procdefinition[0].UUID);
for(var i=1;i<v_data_procdefinition.length;i++){
v_data_procdefinition2.push(v_data_procdefinition[i]);
}
/****/ /****/
/** /**
...@@ -54,17 +71,11 @@ var ls_ywlx = 'YBYW'; ...@@ -54,17 +71,11 @@ var ls_ywlx = 'YBYW';
//定义grid列表 //定义grid列表
var ls_title=null; var ls_title=null;
var is_column = [[ var is_column = [[
{field:'PROC_NAME',title:'流程',width:100}, {field:'PROC_NAME',title:'流程',width:80},
{field:'INSTANCE_ID',title:'实例id',width:80}, {field:'EXECUTION_ID',title:'实例id',width:80},
{field:'CREATE_ID',title:'创建人',width:80},
{field:'CREATE_TIME',title:'新建时间',width:130,formatter:function(value,row,index){ {field:'CREATE_TIME',title:'新建时间',width:130,formatter:function(value,row,index){
return value; return value;
}},
{field:'COMPLETE',title:'进度',width:80,formatter:function(value,row,index){
if(value==0){
return "进行中";
}else{
return "完成";
}
}} }}
]]; ]];
//列表加载完成回调 //列表加载完成回调
...@@ -106,7 +117,7 @@ function formatMenu(value, data,index) { ...@@ -106,7 +117,7 @@ function formatMenu(value, data,index) {
//上浮横向菜单集里的具体菜单项(需更改) //上浮横向菜单集里的具体菜单项(需更改)
function getOptionMenu(data,index){ function getOptionMenu(data,index){
var returnData=[]; var returnData=[];
var editBtn="<span class=\"icon-edit\" style=\"padding-left:20px;*width:20px;\"></span><a href=\"javascript:void(0);\" onclick=\"showProcinstanceImg('" var editBtn="<span class=\"icon-edit\" style=\"padding-left:20px;*width:20px;\"></span><a href=\"javascript:void(0);\" onclick=\"editRow('"
+ index + "')\">处理</a>"; + index + "')\">处理</a>";
var delBtn="<span class=\"icon-edit\" style=\"padding-left:20px;*width:20px;\"></span><a href=\"javascript:void(0);\" onclick=\"showProcinstanceImg('" var delBtn="<span class=\"icon-edit\" style=\"padding-left:20px;*width:20px;\"></span><a href=\"javascript:void(0);\" onclick=\"showProcinstanceImg('"
+ index + "')\">删除</a>"; + index + "')\">删除</a>";
...@@ -126,46 +137,18 @@ function getOptionMenuCount(){ ...@@ -126,46 +137,18 @@ function getOptionMenuCount(){
/****/ /****/
/** function fillTable(businessId){
* 序号:5 var info=proctaskModule.data.getInfo({
* 功能:新增修改弹出 FIELD_BUSINESS_ID:businessId
* 参数:
* 说明:
* 作者:高伟杰
* 时间:2016-01-22
* 单位:宁波金网
* 备注:需更改
**/
//加载增加子页面
function addRow(){
var procdefinitionUuid=$("#FIELD_PROCDEFINITION_UUID").combobox('getValue');
if(procdefinitionUuid=='-- 全部 --'||procdefinitionUuid=='all'){
procdefinitionUuid='';
}
var is_row={OPETYPE:'insert',PROCDEFINITION_UUID:procdefinitionUuid};
openProcEditRow("procinstanceView_procinstanceTabDetail",is_row,"新增",true,0.95,0.95,0,0);
}
//加载增加子页面成功后的回调
function addUrlOnloadCallback(is_row){
$('#detail #FIELD_PROCDEFINITION_UUID').combobox({
data : v_data_procdefinition2,
valueField : 'UUID',
textField : 'PROC_NAME',
editable:false,
panelHeight:'auto',
onSelect:function(){
fillTable();
}
}); });
fillTable(); $("#table_content").html(info.FORM_MODEL.MODEL_CONTENT);
} for(key in info.BUSINESS_DATA){
//保存 info.BUSINESS_DATA['FIELD_'+key]=info.BUSINESS_DATA[key];
function insertData(is_entity){ delete info.BUSINESS_DATA[key];
is_entity.FIELD_PROCID=$('#detail #FIELD_PROCDEFINITION_UUID').combobox("getValue"); }
var v_result = procinstanceModule.act.insertInfo(is_entity); info.BUSINESS_DATA['FIELD_OPETYPE']='update';
$('#list').datagrid('reload'); info.BUSINESS_DATA['FIELD_TABLE_ID_SYSTEM']=info.FORM_MODEL.TABLE_ID;
return v_result; $("#inputForm").form('load',info.BUSINESS_DATA);
} }
//加载修改子页面 //加载修改子页面
...@@ -174,15 +157,24 @@ function editRow(index) { ...@@ -174,15 +157,24 @@ function editRow(index) {
var is_row = $('#list').datagrid('getSelections'); var is_row = $('#list').datagrid('getSelections');
$('#list').datagrid('clearSelections'); $('#list').datagrid('clearSelections');
is_row[0].OPETYPE = 'update'; is_row[0].OPETYPE = 'update';
openEditRow("procdefinitionView_procdefinitionTabDetail",is_row[0],"编辑",true,0.65,0.95,0,0); openProcEditRow("proctaskView_proctaskTabDetail",is_row[0],is_row[0].PROC_NAME,true,0.65,0.95,0,0);
} }
//加载修改子页面成功后的回调 //加载修改子页面成功后的回调
function updateUrlOnloadCallback(is_row){ function updateUrlOnloadCallback(is_row){
$("#inputForm").form('load',commonutil.keyAddStr(is_row)); fillTable(is_row.BUSINESS_ID);
} }
//保存 //保存
function updateData(is_entity){ function updateData(is_entity){
v_result = proctaskModule.act.updateInfo(is_entity);
$('#list').datagrid('reload');
return v_result;
}
//下一步按钮执行事件
function updateDataToNext(is_entity){
alert('开发中');
return;
v_result = procdefinitionModule.act.updateProcdefinition(is_entity); v_result = procdefinitionModule.act.updateProcdefinition(is_entity);
$('#list').datagrid('reload'); $('#list').datagrid('reload');
return v_result; return v_result;
...@@ -433,21 +425,6 @@ function uploadcommonBatchRow(){ ...@@ -433,21 +425,6 @@ function uploadcommonBatchRow(){
} }
/****/ /****/
function fillTable(){
var table_content=procdefinitionModule.data.findFormModel({
FIELD_PROCDEFINITION_UUID:$('#detail #FIELD_PROCDEFINITION_UUID').combobox("getValue")
});
$("#table_content").html('');
if($('#detail #FIELD_PROCDEFINITION_UUID').combobox("getValue")==''){
//什么都不做
}else if(table_content.MODEL_CONTENT=='-1'){
$.messager.alert('提示','该流程对应的表没有设置有效的模板信息!');
}else{
$("#table_content").html(table_content.MODEL_CONTENT);
}
}
function showProcinstanceImg(index) { function showProcinstanceImg(index) {
$('#list').datagrid('selectRow', index); $('#list').datagrid('selectRow', index);
var is_row = $('#list').datagrid('getSelections'); var is_row = $('#list').datagrid('getSelections');
......
...@@ -19,5 +19,6 @@ ...@@ -19,5 +19,6 @@
</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>
<script type="text/javascript" src="${ctx}/process/pages/procdefinition/js/procdefinitionModule.js" charset="utf-8"></script>
<script type="text/javascript" src="${ctx}/process/pages/proctask/js/proctaskModule.js" charset="utf-8"></script> <script type="text/javascript" src="${ctx}/process/pages/proctask/js/proctaskModule.js" charset="utf-8"></script>
<script type="text/javascript" src="${ctx}/process/pages/proctask/js/proctaskTab.js" charset="utf-8"></script> <script type="text/javascript" src="${ctx}/process/pages/proctask/js/proctaskTab.js" charset="utf-8"></script>
<%@page contentType="text/html; charset=UTF-8"%>
<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}" />
<input type="hidden" name="FIELD_TABLE_ID_SYSTEM" id="TABLE_ID_SYSTEM"/>
<div id="table_content"></div>
</form>
\ No newline at end of file
package com.gaowj.activiti.listener; package com.gaowj.activiti.listener;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.activiti.engine.HistoryService;
import org.activiti.engine.delegate.DelegateTask; import org.activiti.engine.delegate.DelegateTask;
import org.activiti.engine.delegate.TaskListener; import org.activiti.engine.delegate.TaskListener;
import org.activiti.engine.history.HistoricActivityInstance;
import org.springframework.context.ApplicationContext;
import org.springframework.web.context.ContextLoaderListener;
import org.springframework.web.context.support.WebApplicationContextUtils;
import com.gaowj.business.ProcdefiChooseUserBusiness;
import com.gaowj.business.ProcinstanceBusiness;
import com.gaowj.business.comp.BusinessManager;
import com.gaowj.business.util.SessionUtil; import com.gaowj.business.util.SessionUtil;
public class AssignmentTaskListener implements TaskListener { public class AssignmentTaskListener implements TaskListener {
...@@ -14,7 +26,24 @@ public class AssignmentTaskListener implements TaskListener { ...@@ -14,7 +26,24 @@ public class AssignmentTaskListener implements TaskListener {
@Override @Override
public void notify(DelegateTask task) { public void notify(DelegateTask task) {
System.out.println(task.getAssignee()); ApplicationContext context = ContextLoaderListener.getCurrentWebApplicationContext();
HistoryService historyService=(HistoryService) context.getBean("historyService");
// 获取流程历史中已执行节点,并按照节点在流程中执行先后顺序排序
List<HistoricActivityInstance> historicActivityInstanceList = historyService.createHistoricActivityInstanceQuery().processInstanceId(task.getProcessInstanceId()).orderByHistoricActivityInstanceId().asc().list();
System.out.println("历史环节数量:"+historicActivityInstanceList.size());
if(historicActivityInstanceList.size()==0){
//如果历史环节数量为0,则表示这个实例第一次启动,第一个环节默认为当前登陆人
task.setAssignee(SessionUtil.getCode());
}else{
//读取环节人员配置信息,循环设置人员
ProcdefiChooseUserBusiness procdefiChooseUserBusiness=(ProcdefiChooseUserBusiness) context.getBean("ProcdefiChooseUserBusiness");
Map<String, Object> query=new HashMap<String, Object>();
query.put("LINK_KEY", task.getTaskDefinitionKey().toString());
List<Map<String, Object>> listUser=procdefiChooseUserBusiness.list_procdefi_chooseUser(query);
}
/*System.out.println(task.getAssignee());
System.out.println(task.getCategory()); System.out.println(task.getCategory());
System.out.println(task.getDescription()); System.out.println(task.getDescription());
System.out.println(task.getEventName()); System.out.println(task.getEventName());
...@@ -29,8 +58,8 @@ public class AssignmentTaskListener implements TaskListener { ...@@ -29,8 +58,8 @@ public class AssignmentTaskListener implements TaskListener {
System.out.println(task.getProcessInstanceId()); System.out.println(task.getProcessInstanceId());
System.out.println(task.getTaskDefinitionKey()); System.out.println(task.getTaskDefinitionKey());
System.out.println(task.getTenantId()); System.out.println(task.getTenantId());
System.out.println(task.getVariables().toString()); System.out.println(task.getVariables().toString());*/
task.setAssignee(SessionUtil.getCode());
// //
} }
......
...@@ -67,7 +67,7 @@ public interface ProcdefinitionBusiness { ...@@ -67,7 +67,7 @@ public interface ProcdefinitionBusiness {
*/ */
InputStream viewPic(String deploymentId,StringBuffer filename) throws BusinessException; InputStream viewPic(String deploymentId,StringBuffer filename) throws BusinessException;
String findFormModel(String procdefinitionUuid) throws BusinessException; Map<String,Object> findFormModel(String procdefinitionUuid) throws BusinessException;
int init_procde_finition_people_approval(String procdefinitionUuid)throws BusinessException; int init_procde_finition_people_approval(String procdefinitionUuid)throws BusinessException;
......
...@@ -16,4 +16,8 @@ public interface ProctaskBusiness { ...@@ -16,4 +16,8 @@ public interface ProctaskBusiness {
* @throws BusinessException * @throws BusinessException
*/ */
Page<Map<String, Object>> list_proc_task(int pageNo, int pageSize, Map<String, Object> query) throws BusinessException; Page<Map<String, Object>> list_proc_task(int pageNo, int pageSize, Map<String, Object> query) throws BusinessException;
Map<String, Object> data_info(String businessId) throws BusinessException;
Map<String, Object> update(Map<String, Object> entity) throws BusinessException;
} }
...@@ -7,6 +7,9 @@ ...@@ -7,6 +7,9 @@
<if test="KEY_ID != null and KEY_ID != ''"> <if test="KEY_ID != null and KEY_ID != ''">
and f.KEY_ID = #{KEY_ID} and f.KEY_ID = #{KEY_ID}
</if> </if>
<if test="LINK_KEY != null and LINK_KEY != ''">
and f.LINK_KEY = #{LINK_KEY}
</if>
</trim> </trim>
</sql> </sql>
<insert id="insert_procdefi_chooseUser" parameterType="map"> <insert id="insert_procdefi_chooseUser" parameterType="map">
...@@ -53,11 +56,16 @@ ...@@ -53,11 +56,16 @@
<select id="list_procdefi_chooseUser" parameterType="map" resultType="upperCaseKeyMap"> <select id="list_procdefi_chooseUser" parameterType="map" resultType="upperCaseKeyMap">
<![CDATA[ <![CDATA[
select f.* , select * from (
select A.* ,
U.`EMNAME`, U.`EMNAME`,
U.`CODE` U.`CODE`,
from C_T_PROC_CHOOSE_USER f L.`LINK_KEY`
LEFT JOIN LCYQ_SYSTEM.C_T_SYS_LOGINUSER U ON U.`CODE`=f.`USER_ID` from C_T_PROC_CHOOSE_USER A
LEFT JOIN LCYQ_SYSTEM.C_T_SYS_LOGINUSER U ON U.`CODE`=A.`USER_ID`
LEFT JOIN C_T_PROC_DEFINITION_INIT_LINK L ON L.`UUID`=A.`KEY_ID`
) f
]]> ]]>
<include refid="Where_Clause" /> <include refid="Where_Clause" />
order by f.CREATE_TIME DESC order by f.CREATE_TIME DESC
......
...@@ -179,9 +179,9 @@ public class ProcdefinitionBusinessImpl implements ProcdefinitionBusiness { ...@@ -179,9 +179,9 @@ public class ProcdefinitionBusinessImpl implements ProcdefinitionBusiness {
} }
@Override @Override
public String findFormModel(String procdefinitionUuid) throws BusinessException { public Map<String,Object> findFormModel(String procdefinitionUuid) throws BusinessException {
if(procdefinitionUuid==null||"".equals(procdefinitionUuid)){ if(procdefinitionUuid==null||"".equals(procdefinitionUuid)){
return "-1"; return null;
} }
Map<String, Object> query=new HashMap<String, Object>(); Map<String, Object> query=new HashMap<String, Object>();
query.put("UUID", procdefinitionUuid); query.put("UUID", procdefinitionUuid);
...@@ -191,10 +191,10 @@ public class ProcdefinitionBusinessImpl implements ProcdefinitionBusiness { ...@@ -191,10 +191,10 @@ public class ProcdefinitionBusinessImpl implements ProcdefinitionBusiness {
query2.put("TABLE_ID", tableId); query2.put("TABLE_ID", tableId);
List<Map<String, Object>> listFormmodels=formmodelsDAO.list_form_models(query2); List<Map<String, Object>> listFormmodels=formmodelsDAO.list_form_models(query2);
if(listFormmodels.size()==0){ if(listFormmodels.size()==0){
return "-1"; return null;
} }
Object content=listFormmodels.get(0).get("MODEL_CONTENT");
return content==null?"":content.toString(); return listFormmodels.get(0);
} }
/** /**
......
...@@ -21,4 +21,6 @@ public interface procdefinitionDAO { ...@@ -21,4 +21,6 @@ public interface procdefinitionDAO {
int listCount_procde_finition(Map<String, Object> query) throws BusinessException; int listCount_procde_finition(Map<String, Object> query) throws BusinessException;
void insert_custom_business(Map<String, Object> entity) throws BusinessException; void insert_custom_business(Map<String, Object> entity) throws BusinessException;
void update_custom_business(Map<String, Object> entity) throws BusinessException;
} }
...@@ -88,4 +88,14 @@ ...@@ -88,4 +88,14 @@
</trim> </trim>
<![CDATA[ ) ]]> <![CDATA[ ) ]]>
</insert> </insert>
<update id="update_custom_business" parameterType="map">
update ${tableName} set
<trim suffixOverrides=",">
<foreach collection="infoList" item="info">
${info.key}=#{info.value},
</foreach>
</trim>
where UUID=#{uuid}
</update>
</mapper> </mapper>
\ No newline at end of file
...@@ -111,6 +111,11 @@ public class ProcinstanceBusinessImpl implements ProcinstanceBusiness { ...@@ -111,6 +111,11 @@ public class ProcinstanceBusinessImpl implements ProcinstanceBusiness {
public Map<String, Object> insert_proc_instance(Map<String, Object> entity) throws BusinessException { public Map<String, Object> insert_proc_instance(Map<String, Object> entity) throws BusinessException {
//流程定义id //流程定义id
String procId=entity.get("PROCID").toString(); String procId=entity.get("PROCID").toString();
//实时的表单模板id
String formModelId=entity.get("FORM_MODEL_ID").toString();
//一定要删掉,防止下面保存业务数据时候没有这个字段
entity.remove("FORM_MODEL_ID");
Map<String, Object> query=new HashMap<String, Object>(); Map<String, Object> query=new HashMap<String, Object>();
query.put("UUID", procId); query.put("UUID", procId);
Map<String, Object> procdeFinition=procdefinitionDAO.list_procde_finition(query).get(0); Map<String, Object> procdeFinition=procdefinitionDAO.list_procde_finition(query).get(0);
...@@ -121,7 +126,7 @@ public class ProcinstanceBusinessImpl implements ProcinstanceBusiness { ...@@ -121,7 +126,7 @@ public class ProcinstanceBusinessImpl implements ProcinstanceBusiness {
String deploymentKey=procdeFinition.get("DEPLOYMENT_KEY").toString(); String deploymentKey=procdeFinition.get("DEPLOYMENT_KEY").toString();
ProcessInstance processInstance=runtimeService.startProcessInstanceByKey(deploymentKey); ProcessInstance processInstance=runtimeService.startProcessInstanceByKey(deploymentKey);
//存储流程实例id和业务数据id的关联 //存储流程实例id和业务数据id的关联
insertProcInstance(procId,businessId,processInstance.getId()); insertProcInstance(procId,businessId,formModelId,processInstance.getId());
/*//第一步,通过流程定义id启动流程 /*//第一步,通过流程定义id启动流程
String deploymentKey=procdeFinition.get("DEPLOYMENT_KEY").toString(); String deploymentKey=procdeFinition.get("DEPLOYMENT_KEY").toString();
...@@ -133,9 +138,10 @@ public class ProcinstanceBusinessImpl implements ProcinstanceBusiness { ...@@ -133,9 +138,10 @@ public class ProcinstanceBusinessImpl implements ProcinstanceBusiness {
return entity; return entity;
} }
private void insertProcInstance(String procId,String businessId, String instanceId) { private void insertProcInstance(String procId,String businessId,String formModelId, String instanceId) {
Map<String, Object> entity = new HashMap<String, Object>(); Map<String, Object> entity = new HashMap<String, Object>();
entity.put("BUSINESS_ID", businessId); entity.put("BUSINESS_ID", businessId);
entity.put("FORM_MODEL_ID", formModelId);
if (instanceId != null) { if (instanceId != null) {
entity.put("INSTANCE_ID", instanceId); entity.put("INSTANCE_ID", instanceId);
} }
......
...@@ -9,6 +9,17 @@ ...@@ -9,6 +9,17 @@
<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="BUSINESS_ID != null and BUSINESS_ID != ''">
and f.BUSINESS_ID = #{BUSINESS_ID}
</if>
<if test="INSTANCE_ID_IN != null and INSTANCE_ID_IN != ''">
and f.INSTANCE_ID IN
<trim prefix="(" suffix=")" suffixOverrides=",">
<foreach collection="INSTANCE_ID_IN" item="value">
#{value},
</foreach>
</trim>
</if>
</trim> </trim>
</sql> </sql>
<insert id="insert_proc_instance" parameterType="map"> <insert id="insert_proc_instance" parameterType="map">
......
package com.gaowj.business.proctask; package com.gaowj.business.proctask;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set;
import org.activiti.engine.TaskService; import org.activiti.engine.TaskService;
import org.activiti.engine.task.Task; import org.activiti.engine.task.Task;
...@@ -11,6 +13,10 @@ import org.activiti.engine.task.TaskQuery; ...@@ -11,6 +13,10 @@ import org.activiti.engine.task.TaskQuery;
import com.gaowj.business.ProctaskBusiness; import com.gaowj.business.ProctaskBusiness;
import com.gaowj.business.exception.BusinessException; import com.gaowj.business.exception.BusinessException;
import com.gaowj.business.formmodels.formmodelsDAO;
import com.gaowj.business.formtable.formtableDAO;
import com.gaowj.business.procdefinition.procdefinitionDAO;
import com.gaowj.business.procinstance.procinstanceDAO;
import com.gaowj.business.util.Page; import com.gaowj.business.util.Page;
import com.gaowj.business.util.SessionUtil; import com.gaowj.business.util.SessionUtil;
...@@ -18,6 +24,14 @@ public class ProctaskBusinessImpl implements ProctaskBusiness { ...@@ -18,6 +24,14 @@ public class ProctaskBusinessImpl implements ProctaskBusiness {
private TaskService taskService; private TaskService taskService;
private procinstanceDAO procinstanceDAO;
private procdefinitionDAO procdefinitionDAO;
private formmodelsDAO formmodelsDAO;
private formtableDAO formtableDAO;
public TaskService getTaskService() { public TaskService getTaskService() {
return taskService; return taskService;
} }
...@@ -26,6 +40,38 @@ public class ProctaskBusinessImpl implements ProctaskBusiness { ...@@ -26,6 +40,38 @@ public class ProctaskBusinessImpl implements ProctaskBusiness {
this.taskService = taskService; this.taskService = taskService;
} }
public procinstanceDAO getProcinstanceDAO() {
return procinstanceDAO;
}
public void setProcinstanceDAO(procinstanceDAO procinstanceDAO) {
this.procinstanceDAO = procinstanceDAO;
}
public procdefinitionDAO getProcdefinitionDAO() {
return procdefinitionDAO;
}
public void setProcdefinitionDAO(procdefinitionDAO procdefinitionDAO) {
this.procdefinitionDAO = procdefinitionDAO;
}
public formmodelsDAO getFormmodelsDAO() {
return formmodelsDAO;
}
public void setFormmodelsDAO(formmodelsDAO formmodelsDAO) {
this.formmodelsDAO = formmodelsDAO;
}
public formtableDAO getFormtableDAO() {
return formtableDAO;
}
public void setFormtableDAO(formtableDAO formtableDAO) {
this.formtableDAO = formtableDAO;
}
@Override @Override
public Page<Map<String, Object>> list_proc_task(int pageNo, int pageSize, Map<String, Object> query) throws BusinessException { public Page<Map<String, Object>> list_proc_task(int pageNo, int pageSize, Map<String, Object> query) throws BusinessException {
Page<Map<String, Object>> page = new Page<Map<String, Object>>(); Page<Map<String, Object>> page = new Page<Map<String, Object>>();
...@@ -37,14 +83,147 @@ public class ProctaskBusinessImpl implements ProctaskBusiness { ...@@ -37,14 +83,147 @@ public class ProctaskBusinessImpl implements ProctaskBusiness {
page.setCount((int)taskQuery.count()); page.setCount((int)taskQuery.count());
List<Task> list = taskQuery.orderByTaskCreateTime().asc().listPage(pageStart, pageSize); List<Task> list = taskQuery.orderByTaskCreateTime().asc().listPage(pageStart, pageSize);
List<Map<String,Object>> items=new ArrayList<Map<String,Object>>(); List<Map<String,Object>> items=new ArrayList<Map<String,Object>>();
List<String> listInstanceId=new ArrayList<String>();
for(Task task:list){ for(Task task:list){
Map<String,Object> map=new HashMap<String, Object>(); Map<String,Object> map=new HashMap<String, Object>();
items.add(map); items.add(map);
map.put("createTime", task.getCreateTime()); map.put("CREATE_TIME", task.getCreateTime());
map.put("executionId", task.getExecutionId()); map.put("EXECUTION_ID", task.getExecutionId());
listInstanceId.add(task.getExecutionId());
}
Map<String, Object> query2=new HashMap<String, Object>();
query2.put("INSTANCE_ID_IN", listInstanceId);
List<Map<String, Object>> listInstance=procinstanceDAO.list_proc_instance_all(query2);
outer:
for(Map<String,Object> map:items){
for(Map<String, Object> instance:listInstance){
if(map.get("EXECUTION_ID").equals(instance.get("INSTANCE_ID"))){
map.put("PROC_NAME", instance.get("PROC_NAME"));
map.put("CREATE_ID", instance.get("CREATE_ID"));
map.put("UUID", instance.get("UUID"));
map.put("PROC_DEFINITION_ID", instance.get("PROC_DEFINITION_ID"));
map.put("BUSINESS_ID", instance.get("BUSINESS_ID"));
continue outer;
}
}
} }
page.setItems(items); page.setItems(items);
return page; return page;
} }
@Override
public Map<String, Object> data_info(String businessId) throws BusinessException {
Map<String, Object> info=new HashMap<String, Object>();
Map<String, Object> query=new HashMap<String, Object>();
query.put("BUSINESS_ID", businessId);
List<Map<String, Object>> listProcinstance=procinstanceDAO.list_proc_instance_all(query);
if(listProcinstance.size()>0){
Map<String, Object> procinstance=listProcinstance.get(0);
//流程定义id
String procDefinitionId=procinstance.get("PROC_DEFINITION_ID").toString();
//表单模板id
String formModelId=procinstance.get("FORM_MODEL_ID").toString();
//根据表单模板id获取模板
Map<String, Object> formModel=getFormModelById(formModelId);
//根据流程定义id获取存储业务数据的表
String tableName=getBusinessTableNameByProcDefinitionId(procDefinitionId);
//根据业务数据的表名和业务id,查询业务数据
Map<String, Object> businessData=getBusinessDataByBusinessTableAndBusinessId(tableName, businessId);
//填充返回数据
info.put("FORM_MODEL", formModel);
info.put("BUSINESS_DATA", businessData);
}
return info;
}
private Map<String, Object> getFormModelById(String uuid) {
Map<String, Object> query=new HashMap<String, Object>();
query.put("UUID", uuid);
return formmodelsDAO.list_form_models(query).get(0);
}
/**
* 根据流程定义id获取业务数据表的表名
* @param procDefinitionId
* @return
*/
private String getBusinessTableNameByProcDefinitionId(String procDefinitionId){
Map<String, Object> query=new HashMap<String, Object>();
query.put("UUID", procDefinitionId);
return procdefinitionDAO.list_procde_finition(query).get(0).get("TABLE_NAME").toString();
}
private Map<String, Object> getBusinessDataByBusinessTableAndBusinessId(String tableName,String uuid) {
Map<String, Object> query=new HashMap<String, Object>();
query.put("UUID", uuid);
query.put("tableName", tableName);
return procinstanceDAO.list_proc_instance(query).get(0);
}
@Override
public Map<String, Object> update(Map<String, Object> entity) throws BusinessException {
//存储自定义表单的业务数据
update_custom_business(entity.get("TABLE_ID_SYSTEM").toString(),entity);
return entity;
}
private String update_custom_business(String tableId,Map<String, Object> entity) {
entity.remove("TABLE_ID_SYSTEM");
if (entity.get("UUID") == null) {
entity.put("UUID", java.util.UUID.randomUUID().toString());
}
if (entity.get("CREATE_TIME") == null) {
entity.put("CREATE_TIME", new Date());
}
if (entity.get("CREATE_ID") == null) {
entity.put("CREATE_ID", SessionUtil.getCode());
}
if (entity.get("UPDATE_ID") == null) {
entity.put("UPDATE_ID", SessionUtil.getCode());
}
if (entity.get("UPDATE_TIME") == null) {
entity.put("UPDATE_TIME", new Date());
}
Map<String, Object> query=new HashMap<String, Object>();
query.put("UUID", tableId);
// 动态传值插入
List<Map<String,Object>> infoList = new ArrayList<Map<String,Object>>();
//List<String> infoListKey = new ArrayList<String>();
if (entity.keySet() != null) {
Set<String> key = entity.keySet();
// 将map集合中的key和value 取出来分别放到list集合里
for (String str : key) {
//UUID不需要加进去
if("UUID".equals(str)){
continue;
}
Map<String,Object> kv=new HashMap<String, Object>();
kv.put("value",entity.get(str));
kv.put("key",str);
infoList.add(kv);
}
entity.put("infoList", infoList);
}
/*List<Object> infoList = new ArrayList<Object>();
if (entity.keySet() != null) {
Set<String> key = entity.keySet();
// 将map集合中的key和value 取出来分别放到list集合里
for (String str : key) {
infoList.add(entity.get(str));
infoListKey.add(str);
}
entity.put("infoListKey", infoListKey);
entity.put("infoList", infoList);
}*/
//设置表名
String tableName=formtableDAO.list_form_table(query).get(0).get("TABLE_NAME").toString();
entity.put("tableName", tableName);
entity.put("uuid", entity.get("UUID"));
procdefinitionDAO.update_custom_business(entity);
return entity.get("UUID").toString();
}
} }
...@@ -123,7 +123,8 @@ public class dataAction extends BasicAction{ ...@@ -123,7 +123,8 @@ public class dataAction extends BasicAction{
if(query.get("PROCDEFINITION_UUID")==null){ if(query.get("PROCDEFINITION_UUID")==null){
query.put("PROCDEFINITION_UUID",""); query.put("PROCDEFINITION_UUID","");
} }
jsonObject.put("MODEL_CONTENT", business.findFormModel(query.get("PROCDEFINITION_UUID").toString())); Map<String,Object> model=business.findFormModel(query.get("PROCDEFINITION_UUID").toString());
jsonObject.put("MODEL", model);
return "json"; return "json";
} }
......
package com.gaowj.proctask.action; package com.gaowj.proctask.action;
import java.util.Map;
import com.gaowj.business.ProcinstanceBusiness;
import com.gaowj.business.ProctaskBusiness;
import com.gaowj.business.SystemOpeBusiness;
import com.gaowj.business.action.BasicAction; 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{ public class actAction extends BasicAction{
...@@ -9,4 +21,39 @@ public class actAction extends BasicAction{ ...@@ -9,4 +21,39 @@ public class actAction extends BasicAction{
*/ */
private static final long serialVersionUID = -4062030374955033260L; private static final long serialVersionUID = -4062030374955033260L;
private JSONObject jsonObject = new JSONObject();
public JSONObject getJsonObject() {
return jsonObject;
}
public void setJsonObject(JSONObject jsonObject) {
this.jsonObject = jsonObject;
}
public String updateInfo() throws BusinessException {
ProctaskBusiness business = BusinessManager.getBusiness(ProctaskBusiness.class);
Map<String, Object> entity = RequestUtils.getUpdateFieldMap(request,RequestUtils.UPDATEDATAFIELDPREFIX);
jsonObject = new JSONObject();
try {
entity = QueryParamUtil.StringToDate(entity);
//去除不要更新的字段
entity.remove("OPETYPE");
//新增
Map<String,Object> procinstance=business.update(entity);
// 操作日志
//sysbusiness.insert_logBusiness(具体方法,操作内容,操作描述,操作记录ID,操作记录中文描述,分类)
SystemOpeBusiness sysbusiness = BusinessManager.getBusiness(SystemOpeBusiness.class);
sysbusiness.insert_logBusiness("updateInfo", "" + procinstance,
"更新流程实例数据", (String) entity.get("UUID"), (String) entity.get("CONTENT"), "procinstance");
//
//
jsonObject.putAll(Status.getStatusSuccessMessage("保存成功"));
} catch (Exception e) {
jsonObject.putAll(Status.getStatusErrorMessage("保存失败"));
e.printStackTrace();
}
return "json";
}
} }
...@@ -5,7 +5,6 @@ import java.text.ParseException; ...@@ -5,7 +5,6 @@ import java.text.ParseException;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import com.gaowj.business.ProcinstanceBusiness;
import com.gaowj.business.ProctaskBusiness; import com.gaowj.business.ProctaskBusiness;
import com.gaowj.business.action.BasicAction; import com.gaowj.business.action.BasicAction;
import com.gaowj.business.comp.BusinessManager; import com.gaowj.business.comp.BusinessManager;
...@@ -75,4 +74,26 @@ public class dataAction extends BasicAction{ ...@@ -75,4 +74,26 @@ public class dataAction extends BasicAction{
} }
return "json"; return "json";
} }
public String getInfo() throws BusinessException {
ProctaskBusiness business = BusinessManager.getBusiness(ProctaskBusiness.class);
Map<String, Object> query = RequestUtils.getUpdateFieldMap(request,RequestUtils.UPDATEDATAFIELDPREFIX);
try {
query = QueryParamUtil.StringToDate(query);
Map<String, Object> info = business.data_info(query.get("BUSINESS_ID").toString());
System.out.println(info.get("BUSINESS_DATA"));
System.out.println(info.get("FORM_MODEL"));
jsonObject = new JSONObject();
jsonObject.put("BUSINESS_DATA", QueryParamUtil.DateTimeToString((Map<String, Object>) info.get("BUSINESS_DATA")));
jsonObject.put("FORM_MODEL", QueryParamUtil.DateTimeToString((Map<String, Object>) info.get("FORM_MODEL")));
//jsonObject.putAll(info);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return "json";
}
} }
...@@ -13,4 +13,8 @@ public class viewAction extends BasicAction{ ...@@ -13,4 +13,8 @@ public class viewAction extends BasicAction{
public String proctaskTab() throws BusinessException{ public String proctaskTab() throws BusinessException{
return "proctaskTab"; return "proctaskTab";
} }
public String proctaskTabDetail() throws BusinessException{
return "proctaskTabDetail";
}
} }
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