Commit 35198140 by 罗绍泽

进一步修改

parent 079bad08
......@@ -118,6 +118,7 @@
<bean id="ProctaskBusiness" class="com.gaowj.business.proctask.ProctaskBusinessImpl">
<property name="taskService" ref="taskService"></property>
<property name="runtimeService" ref="runtimeService"></property>
<property name="procinstanceDAO" ref="procinstanceDAO"></property>
<property name="formmodelsDAO" ref="formmodelsDAO"></property>
<property name="procdefinitionDAO" ref="procdefinitionDAO"></property>
......
......@@ -10,6 +10,8 @@ procinstanceModule.prototype = BusinessObject;
//插入流程实例
procinstanceModule.prototype.insertInfo = function(){};
//插入流程实例,并执行下一步
procinstanceModule.prototype.insertInfoToNext = function(){};
//修改流程实例
procinstanceModule.prototype.updateInfo = function(){};
//删除流程实例
......
......@@ -72,13 +72,23 @@ for(var i=1;i<v_data_procdefinition.length;i++){
var ls_title=null;
var is_column = [[
{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){
return value;
}},
{field:'COMPLETE',title:'进度',width:80,formatter:function(value,row,index){
if(value==0){
return "进行中";
if(row.INSTANCE_ID==null){
return "未启动";
}else{
return "进行中";
}
}else{
return "完成";
}
......@@ -123,7 +133,7 @@ function formatMenu(value, data,index) {
//上浮横向菜单集里的具体菜单项(需更改)
function getOptionMenu(data,index){
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>";
var delBtn="<span class=\"icon-edit\" style=\"padding-left:20px;*width:20px;\"></span><a href=\"javascript:void(0);\" onclick=\"showProcinstanceImg('"
+ index + "')\">删除</a>";
......@@ -186,24 +196,51 @@ function insertData(is_entity){
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) {
$('#list').datagrid('selectRow',index);
var is_row = $('#list').datagrid('getSelections');
$('#list').datagrid('clearSelections');
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){
$("#inputForm").form('load',commonutil.keyAddStr(is_row));
console.log(is_row);
fillTable2(is_row.BUSINESS_ID,is_row.TASK_ID);
}
//保存
function updateData(is_entity){
v_result = procdefinitionModule.act.updateProcdefinition(is_entity);
$('#list').datagrid('reload');
return v_result;
alert('明天实现');
}
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(){
width : 80,
formatter : function(value, row, index) {
if (value == 0) {
return "进行中";
if(row.INSTANCE_ID==null){
return "未启动";
}else{
return "进行中";
}
} else {
return "完成";
}
......
......@@ -20,5 +20,6 @@
<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="/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/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,40 +282,44 @@ function searchRow(){
queryParams:v_query
});
}else {
$('#list').datagrid({
columns : [ [ {
field : 'PEOPLE',
title : '请假人',
width : 80
}, {
field : 'REASON',
title : '原因',
width : 80
}, {
field : 'INSTANCE_ID',
title : '环节',
width : 80
}, {
field : 'CREATE_TIME',
title : '新建时间',
width : 130,
formatter : function(value, row, index) {
return value;
}
},
{
field : 'COMPLETE',
title : '进度',
width : 80,
formatter : function(value, row, index) {
if (value == 0) {
return "进行中";
} else {
return "完成";
}
//获取该业务的列表显示字段
var listField = procdefinitionModule.data.listShowField({
PROC_DEFINITION_ID : FIELD_PROCDEFINITION_UUID
}).rows;
var bussiness_columns = [];
for (var i = 0; i < listField.length; i++) {
bussiness_columns.push({
field : listField[i].FIELD_NAME.toUpperCase(),
title : listField[i].CONTENT,
width : listField[i].FIELD_WIDTH
});
if (typeof (bussiness_columns[i].FIELD_WIDTH) == 'undefined') {
bussiness_columns[i].FIELD_WIDTH = 80;
}
}
bussiness_columns.push({
field : 'CREATE_TIME',
title : '新建时间',
width : 130,
formatter : function(value, row, index) {
return value;
}
});
bussiness_columns.push({
field : 'COMPLETE',
title : '进度',
width : 80,
formatter : function(value, row, index) {
if (value == 0) {
return "进行中";
} else {
return "完成";
}
} ] ],
queryParams:v_query
}
});
$('#list').datagrid({
columns : [ bussiness_columns],
queryParams:v_query
});
}
......
......@@ -18,6 +18,14 @@ public interface ProcinstanceBusiness {
* @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;
/**
* 更新
......
......@@ -122,19 +122,33 @@ public class ProcinstanceBusinessImpl implements ProcinstanceBusiness {
//存储自定义表单的业务数据
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启动流程
String deploymentKey=procdeFinition.get("DEPLOYMENT_KEY").toString();
ProcessInstance processInstance=runtimeService.startProcessInstanceByKey(deploymentKey);
//存储流程实例id和业务数据id的关联
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;
}
......
......@@ -71,9 +71,11 @@
<![CDATA[
select f.*
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
ON t.uuid=ins.business_id
LEFT JOIN c_t_proc_definition def ON def.uuid = ins.proc_definition_id
) f
]]>
<include refid="Where_Clause" />
......
......@@ -7,6 +7,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import org.activiti.engine.RuntimeService;
import org.activiti.engine.TaskService;
import org.activiti.engine.task.Task;
import org.activiti.engine.task.TaskQuery;
......@@ -24,6 +25,8 @@ public class ProctaskBusinessImpl implements ProctaskBusiness {
private TaskService taskService;
private RuntimeService runtimeService;
private procinstanceDAO procinstanceDAO;
private procdefinitionDAO procdefinitionDAO;
......@@ -32,6 +35,14 @@ public class ProctaskBusinessImpl implements ProctaskBusiness {
private formtableDAO formtableDAO;
public RuntimeService getRuntimeService() {
return runtimeService;
}
public void setRuntimeService(RuntimeService runtimeService) {
this.runtimeService = runtimeService;
}
public TaskService getTaskService() {
return taskService;
}
......@@ -95,22 +106,39 @@ public class ProctaskBusinessImpl implements ProctaskBusiness {
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);
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:
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"));
for (Map<String, Object> instance : listInstance) {
for (Map<String, Object> map : items){
if (map.get("EXECUTION_ID").equals(instance.get("INSTANCE_ID"))) {
instance.putAll(map);
continue outer;
}
}
}
page.setItems(items);
page.setItems(listInstance);
return page;
}
......@@ -174,11 +202,48 @@ public class ProctaskBusinessImpl implements ProctaskBusiness {
public Map<String, Object> updateToNext(String taskId,Map<String, Object> entity) throws BusinessException {
//存储自定义表单的业务数据
update_custom_business(entity.get("TABLE_ID_SYSTEM").toString(),entity);
//通过任务id获取流程id
String processInstanceId=taskService.createTaskQuery().taskId(taskId).singleResult().getProcessInstanceId();
//完成当前任务
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;
}
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) {
entity.remove("TABLE_ID_SYSTEM");
if (entity.get("UUID") == null) {
......
......@@ -63,5 +63,30 @@ public class actAction extends BasicAction {
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";
}
}
......@@ -22,5 +22,11 @@ public class viewAction extends BasicAction {
request.setAttribute("is_row", query);
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