Commit 35198140 by 罗绍泽

进一步修改

parent 079bad08
...@@ -118,6 +118,7 @@ ...@@ -118,6 +118,7 @@
<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="runtimeService" ref="runtimeService"></property>
<property name="procinstanceDAO" ref="procinstanceDAO"></property> <property name="procinstanceDAO" ref="procinstanceDAO"></property>
<property name="formmodelsDAO" ref="formmodelsDAO"></property> <property name="formmodelsDAO" ref="formmodelsDAO"></property>
<property name="procdefinitionDAO" ref="procdefinitionDAO"></property> <property name="procdefinitionDAO" ref="procdefinitionDAO"></property>
......
...@@ -10,6 +10,8 @@ procinstanceModule.prototype = BusinessObject; ...@@ -10,6 +10,8 @@ procinstanceModule.prototype = BusinessObject;
//插入流程实例 //插入流程实例
procinstanceModule.prototype.insertInfo = function(){}; procinstanceModule.prototype.insertInfo = function(){};
//插入流程实例,并执行下一步
procinstanceModule.prototype.insertInfoToNext = function(){};
//修改流程实例 //修改流程实例
procinstanceModule.prototype.updateInfo = function(){}; procinstanceModule.prototype.updateInfo = function(){};
//删除流程实例 //删除流程实例
......
...@@ -72,13 +72,23 @@ for(var i=1;i<v_data_procdefinition.length;i++){ ...@@ -72,13 +72,23 @@ for(var i=1;i<v_data_procdefinition.length;i++){
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:100},
{field:'INSTANCE_ID',title:'实例id',width:80}, {field:'INSTANCE_ID',title:'实例id',width:80,formatter:function(value,row,index){
if(value==null){
return '未启动';
}else{
return value;
}
}},
{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){ {field:'COMPLETE',title:'进度',width:80,formatter:function(value,row,index){
if(value==0){ if(value==0){
if(row.INSTANCE_ID==null){
return "未启动";
}else{
return "进行中"; return "进行中";
}
}else{ }else{
return "完成"; return "完成";
} }
...@@ -123,7 +133,7 @@ function formatMenu(value, data,index) { ...@@ -123,7 +133,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>";
...@@ -186,24 +196,51 @@ function insertData(is_entity){ ...@@ -186,24 +196,51 @@ function insertData(is_entity){
return v_result; return v_result;
} }
function insertDataToNext(is_entity){
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.insertInfoToNext(is_entity);
$('#list').datagrid('reload');
return v_result;
}
//加载修改子页面 //加载修改子页面
function editRow(index) { function editRow(index) {
$('#list').datagrid('selectRow',index); $('#list').datagrid('selectRow',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("procinstanceView_procinstanceTabDetailEdit",is_row[0],"编辑",true,0.65,0.95,0,0);
} }
//加载修改子页面成功后的回调 //加载修改子页面成功后的回调
function updateUrlOnloadCallback(is_row){ function updateUrlOnloadCallback(is_row){
$("#inputForm").form('load',commonutil.keyAddStr(is_row)); console.log(is_row);
fillTable2(is_row.BUSINESS_ID,is_row.TASK_ID);
} }
//保存 //保存
function updateData(is_entity){ function updateData(is_entity){
v_result = procdefinitionModule.act.updateProcdefinition(is_entity); alert('明天实现');
$('#list').datagrid('reload'); }
return v_result;
function fillTable2(businessId,taskId){
var info=proctaskModule.data.getInfo({
FIELD_BUSINESS_ID:businessId
});
$("#table_content").html(info.FORM_MODEL.MODEL_CONTENT);
for(key in info.BUSINESS_DATA){
info.BUSINESS_DATA['FIELD_'+key]=info.BUSINESS_DATA[key];
delete info.BUSINESS_DATA[key];
}
info.BUSINESS_DATA['FIELD_OPETYPE']='update';
info.BUSINESS_DATA['FIELD_TABLE_ID_SYSTEM']=info.FORM_MODEL.TABLE_ID;
info.BUSINESS_DATA['FIELD_TASK_ID_SYSTEM']=taskId;
$("#inputForm").form('load',info.BUSINESS_DATA);
}
//下一步按钮执行事件
function updateDataToNext(is_entity){
alert('明天实现');
} }
/****/ /****/
...@@ -337,7 +374,11 @@ function searchRow(){ ...@@ -337,7 +374,11 @@ function searchRow(){
width : 80, width : 80,
formatter : function(value, row, index) { formatter : function(value, row, index) {
if (value == 0) { if (value == 0) {
if(row.INSTANCE_ID==null){
return "未启动";
}else{
return "进行中"; return "进行中";
}
} else { } else {
return "完成"; return "完成";
} }
......
...@@ -20,5 +20,6 @@ ...@@ -20,5 +20,6 @@
<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/procdefinition/js/procdefinitionModule.js" charset="utf-8"></script>
<script type="text/javascript" src="/jfV5lcyq/process/pages/proctask/js/proctaskModule.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/procinstanceModule.js" charset="utf-8"></script>
<script type="text/javascript" src="${ctx}/process/pages/procinstance/js/procinstanceTab.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="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"/>
<input type="hidden" name="FIELD_TASK_ID_SYSTEM" id="TASK_ID_SYSTEM"/>
<div id="table_content"></div>
</form>
\ No newline at end of file
...@@ -282,28 +282,30 @@ function searchRow(){ ...@@ -282,28 +282,30 @@ function searchRow(){
queryParams:v_query queryParams:v_query
}); });
}else { }else {
$('#list').datagrid({ //获取该业务的列表显示字段
columns : [ [ { var listField = procdefinitionModule.data.listShowField({
field : 'PEOPLE', PROC_DEFINITION_ID : FIELD_PROCDEFINITION_UUID
title : '请假人', }).rows;
width : 80 var bussiness_columns = [];
}, { for (var i = 0; i < listField.length; i++) {
field : 'REASON', bussiness_columns.push({
title : '原因', field : listField[i].FIELD_NAME.toUpperCase(),
width : 80 title : listField[i].CONTENT,
}, { width : listField[i].FIELD_WIDTH
field : 'INSTANCE_ID', });
title : '环节', if (typeof (bussiness_columns[i].FIELD_WIDTH) == 'undefined') {
width : 80 bussiness_columns[i].FIELD_WIDTH = 80;
}, { }
}
bussiness_columns.push({
field : 'CREATE_TIME', field : 'CREATE_TIME',
title : '新建时间', title : '新建时间',
width : 130, width : 130,
formatter : function(value, row, index) { formatter : function(value, row, index) {
return value; return value;
} }
}, });
{ bussiness_columns.push({
field : 'COMPLETE', field : 'COMPLETE',
title : '进度', title : '进度',
width : 80, width : 80,
...@@ -314,7 +316,9 @@ function searchRow(){ ...@@ -314,7 +316,9 @@ function searchRow(){
return "完成"; return "完成";
} }
} }
} ] ], });
$('#list').datagrid({
columns : [ bussiness_columns],
queryParams:v_query queryParams:v_query
}); });
} }
......
...@@ -20,6 +20,14 @@ public interface ProcinstanceBusiness { ...@@ -20,6 +20,14 @@ public interface ProcinstanceBusiness {
Map<String, Object> insert_proc_instance(Map<String, Object> entity) throws BusinessException; Map<String, Object> insert_proc_instance(Map<String, Object> entity) throws BusinessException;
/** /**
* 插入
*
* @param entity
* @throws BusinessException
*/
Map<String, Object> insert_proc_instance_next(Map<String, Object> entity) throws BusinessException;
/**
* 更新 * 更新
* *
* @param entity * @param entity
......
...@@ -122,19 +122,33 @@ public class ProcinstanceBusinessImpl implements ProcinstanceBusiness { ...@@ -122,19 +122,33 @@ public class ProcinstanceBusinessImpl implements ProcinstanceBusiness {
//存储自定义表单的业务数据 //存储自定义表单的业务数据
String businessId=insert_custom_business(procdeFinition.get("TABLE_ID").toString(),entity); String businessId=insert_custom_business(procdeFinition.get("TABLE_ID").toString(),entity);
//通过流程定义id启动流程,因为是直接保存,所以并不启动流程实例
//存储流程实例id和业务数据id的关联
insertProcInstance(procId,businessId,formModelId,null);
return entity;
}
@Override
public Map<String, Object> insert_proc_instance_next(Map<String, Object> entity) throws BusinessException {
//流程定义id
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>();
query.put("UUID", procId);
Map<String, Object> procdeFinition=procdefinitionDAO.list_procde_finition(query).get(0);
//存储自定义表单的业务数据
String businessId=insert_custom_business(procdeFinition.get("TABLE_ID").toString(),entity);
//通过流程定义id启动流程 //通过流程定义id启动流程
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,formModelId,processInstance.getId()); insertProcInstance(procId,businessId,formModelId,processInstance.getId());
/*//第一步,通过流程定义id启动流程
String deploymentKey=procdeFinition.get("DEPLOYMENT_KEY").toString();
ProcessInstance processInstance=runtimeService.startProcessInstanceByKey(deploymentKey);
//第二步,存储自定义表单的业务数据
String businessId=insert_custom_business(procdeFinition.get("TABLE_ID").toString(),entity);
//第三步,存储流程实例id和业务数据id的关联
insertProcInstance(businessId,processInstance.getId());*/
return entity; return entity;
} }
......
...@@ -71,9 +71,11 @@ ...@@ -71,9 +71,11 @@
<![CDATA[ <![CDATA[
select f.* select f.*
from ( from (
SELECT t.*,ins.proc_definition_id,ins.instance_id,ins.complete FROM ${tableName} t SELECT t.*,ins.proc_definition_id,ins.instance_id,ins.complete,ins.business_id,def.proc_name
FROM ${tableName} t
LEFT JOIN c_t_proc_instance ins LEFT JOIN c_t_proc_instance ins
ON t.uuid=ins.business_id ON t.uuid=ins.business_id
LEFT JOIN c_t_proc_definition def ON def.uuid = ins.proc_definition_id
) f ) f
]]> ]]>
<include refid="Where_Clause" /> <include refid="Where_Clause" />
......
...@@ -7,6 +7,7 @@ import java.util.List; ...@@ -7,6 +7,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import org.activiti.engine.RuntimeService;
import org.activiti.engine.TaskService; import org.activiti.engine.TaskService;
import org.activiti.engine.task.Task; import org.activiti.engine.task.Task;
import org.activiti.engine.task.TaskQuery; import org.activiti.engine.task.TaskQuery;
...@@ -24,6 +25,8 @@ public class ProctaskBusinessImpl implements ProctaskBusiness { ...@@ -24,6 +25,8 @@ public class ProctaskBusinessImpl implements ProctaskBusiness {
private TaskService taskService; private TaskService taskService;
private RuntimeService runtimeService;
private procinstanceDAO procinstanceDAO; private procinstanceDAO procinstanceDAO;
private procdefinitionDAO procdefinitionDAO; private procdefinitionDAO procdefinitionDAO;
...@@ -32,6 +35,14 @@ public class ProctaskBusinessImpl implements ProctaskBusiness { ...@@ -32,6 +35,14 @@ public class ProctaskBusinessImpl implements ProctaskBusiness {
private formtableDAO formtableDAO; private formtableDAO formtableDAO;
public RuntimeService getRuntimeService() {
return runtimeService;
}
public void setRuntimeService(RuntimeService runtimeService) {
this.runtimeService = runtimeService;
}
public TaskService getTaskService() { public TaskService getTaskService() {
return taskService; return taskService;
} }
...@@ -95,22 +106,39 @@ public class ProctaskBusinessImpl implements ProctaskBusiness { ...@@ -95,22 +106,39 @@ public class ProctaskBusinessImpl implements ProctaskBusiness {
Map<String, Object> query2=new HashMap<String, Object>(); Map<String, Object> query2=new HashMap<String, Object>();
query2.put("INSTANCE_ID_IN", listInstanceId); query2.put("INSTANCE_ID_IN", listInstanceId);
List<Map<String, Object>> listInstance=procinstanceDAO.list_proc_instance_all(query2);
List<Map<String, Object>> listInstance=null;
if (query.get("PROCDEFINITION_UUID") != null && !"".equals(query.get("PROCDEFINITION_UUID"))) {
String procdefinitionUuid = query.get("PROCDEFINITION_UUID").toString();
query.remove("PROCDEFINITION_UUID");
//通过流程定义id获取表名
Map<String, Object> query3=new HashMap<String, Object>();
query3.put("UUID", procdefinitionUuid);
String tableName=procdefinitionDAO.list_procde_finition(query3).get(0).get("TABLE_NAME").toString();
query2.put("tableName", tableName);
try {
listInstance=procinstanceDAO.list_proc_instance(query2);
} catch (Exception e) {
if(e.getMessage().indexOf("doesn't exist")!=-1){
//如果有XX不存在字样,说明当前需要查询的表不存在,则直接设置为空list
listInstance=new ArrayList<Map<String, Object>>();
}
}
}
else{
listInstance=procinstanceDAO.list_proc_instance_all(query2);
}
outer: outer:
for(Map<String,Object> map:items){ for (Map<String, Object> instance : listInstance) {
for(Map<String, Object> instance:listInstance){ for (Map<String, Object> map : items){
if(map.get("EXECUTION_ID").equals(instance.get("INSTANCE_ID"))){ if (map.get("EXECUTION_ID").equals(instance.get("INSTANCE_ID"))) {
map.put("PROC_NAME", instance.get("PROC_NAME")); instance.putAll(map);
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; continue outer;
} }
} }
} }
page.setItems(items); page.setItems(listInstance);
return page; return page;
} }
...@@ -174,11 +202,48 @@ public class ProctaskBusinessImpl implements ProctaskBusiness { ...@@ -174,11 +202,48 @@ public class ProctaskBusinessImpl implements ProctaskBusiness {
public Map<String, Object> updateToNext(String taskId,Map<String, Object> entity) throws BusinessException { public Map<String, Object> updateToNext(String taskId,Map<String, Object> entity) throws BusinessException {
//存储自定义表单的业务数据 //存储自定义表单的业务数据
update_custom_business(entity.get("TABLE_ID_SYSTEM").toString(),entity); update_custom_business(entity.get("TABLE_ID_SYSTEM").toString(),entity);
//通过任务id获取流程id
String processInstanceId=taskService.createTaskQuery().taskId(taskId).singleResult().getProcessInstanceId();
//完成当前任务 //完成当前任务
taskService.complete(taskId); taskService.complete(taskId);
//判断当前流程是否结束
long count=runtimeService.createExecutionQuery().processInstanceId(processInstanceId).count();
if(count==0){
//表示流程已结束,修改实例表的complete字段为1
Map<String, Object> query=new HashMap<String, Object>();
query.put("BUSINESS_ID", entity.get("UUID"));
//先获取实例表的uuid
String procinstanceId=procinstanceDAO.list_proc_instance_all(query).get(0).get("UUID").toString();
Map<String, Object> procinstance=new HashMap<String, Object>();
procinstance.put("UUID", procinstanceId);
procinstance.put("COMPLETE", 1);
//通过实例表的uuid对实例表的状态进行更新
update_proc_instance(procinstance);
}
return entity; return entity;
} }
private void update_proc_instance(Map<String, Object> entity) {
Map<String, Object> entity2 = new HashMap<String, Object>();
entity2.put("UUID", entity.get("UUID"));
if (entity.keySet() != null) {
List<Map<String,Object>> info=new ArrayList<Map<String,Object>>();
entity2.put("info", info);
Set<String> key = entity.keySet();
for(String str:key){
if("UUID".equals(str)){
continue;
}
Map<String,Object> colum=new HashMap<String, Object>();
colum.put("key", str);
colum.put("value", entity.get(str));
info.add(colum);
}
}
procinstanceDAO.update_proc_instance(entity2);
}
private String update_custom_business(String tableId,Map<String, Object> entity) { private String update_custom_business(String tableId,Map<String, Object> entity) {
entity.remove("TABLE_ID_SYSTEM"); entity.remove("TABLE_ID_SYSTEM");
if (entity.get("UUID") == null) { if (entity.get("UUID") == null) {
......
...@@ -63,5 +63,30 @@ public class actAction extends BasicAction { ...@@ -63,5 +63,30 @@ public class actAction extends BasicAction {
return "json"; return "json";
} }
public String insertInfoToNext() throws BusinessException {
ProcinstanceBusiness business = BusinessManager.getBusiness(ProcinstanceBusiness.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.insert_proc_instance_next(entity);
// 操作日志
//sysbusiness.insert_logBusiness(具体方法,操作内容,操作描述,操作记录ID,操作记录中文描述,分类)
SystemOpeBusiness sysbusiness = BusinessManager.getBusiness(SystemOpeBusiness.class);
sysbusiness.insert_logBusiness("insertInfo", "" + 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";
}
} }
...@@ -23,4 +23,10 @@ public class viewAction extends BasicAction { ...@@ -23,4 +23,10 @@ public class viewAction extends BasicAction {
return "procinstanceTabDetail"; return "procinstanceTabDetail";
} }
public String procinstanceTabDetailEdit() throws BusinessException{
Map<String,Object> query = RequestUtils.getUpdateFieldMapUtf8(request, RequestUtils.UPDATEDATAFIELDPREFIX);
request.setAttribute("is_row", query);
return "procinstanceTabDetailEdit";
}
} }
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