Commit 32302264 by 罗绍泽

封装了部分activiti引擎代码

parent 952dcef5
......@@ -123,6 +123,8 @@
<property name="procinstanceDAO" ref="procinstanceDAO"></property>
<property name="formmodelsDAO" ref="formmodelsDAO"></property>
<property name="procdefinitionDAO" ref="procdefinitionDAO"></property>
<property name="historyService" ref="historyService"></property>
<property name="repositoryService" ref="repositoryService"></property>
<property name="formtableDAO" ref="formtableDAO"></property>
</bean>
</beans>
......@@ -234,8 +234,6 @@ function fillTable2(businessId,taskId){
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);
......@@ -541,58 +539,7 @@ function showProcinstanceImg(index) {
width : 1000,
height : 500,
title : '流程图',
href:'procinstanceView_procinstanceTabHistory?instanceId='+is_row[0].INSTANCE_ID,
onLoad:function(){
$('#historyTable').datagrid({
iconCls:$.getJwWindowPic(),
url:gaowj.WEB_APP_NAME+"/procinstanceData_procinstanceHistory",
queryParams : {
processInstanceId:$("#instanceIdHide").val()
},//查询参数
rownumbers : true,//显示索引号
singleSelect : false,//是否多选
fitColumns : false,//是否撑满
autoRowHeight : false,//设定高度
rowStyler :function(index,row){return rowstyler(index,row);},
pagination : true,//分页显示
pageSize : rows,//显示行数
pageList : listPageSize,//条数选择
striped : true, //是否隔行显示
remoteSort : false,//是否从服务器排序
frozenColumns : [[
{
field : 'ck',
checkbox : true
}
]],
columns : [ [ {
field : 'ACTIVITY_NAME',
title : '环节名称',
width : 200,
align : 'center',
}, {
field : 'ASSIGNEE',
title : '办理人',
width : 200,
align : 'center',
}, {
field : 'START_TIME',
title : '开始时间',
width : 250,
align : 'center',
}, {
field : 'END_TIME',
title : '结束时间',
width : 250,
align : 'center',
} ] ],
onLoadSuccess : function() {
if(is_opetipmenuwidth==null){
is_opetipmenuwidth = 60;
}
}
});
}
href:'procinstanceView_procinstanceTabHistory?instanceId='+is_row[0].INSTANCE_ID
});
}
......
$(function(){
$('#historyTable').datagrid({
iconCls:$.getJwWindowPic(),
url:gaowj.WEB_APP_NAME+"/procinstanceData_procinstanceHistory",
queryParams : {
processInstanceId:$("#instanceIdHide").val()
},//查询参数
rownumbers : true,//显示索引号
singleSelect : false,//是否多选
fitColumns : false,//是否撑满
autoRowHeight : false,//设定高度
rowStyler :function(index,row){return rowstyler(index,row);},
striped : true, //是否隔行显示
columns : [ [ {
field : 'ACTIVITY_NAME',
title : '环节名称',
width : 200,
align : 'center',
}, {
field : 'ASSIGNEE',
title : '办理人',
width : 200,
align : 'center',
}, {
field : 'START_TIME',
title : '开始时间',
width : 250,
align : 'center',
}, {
field : 'END_TIME',
title : '结束时间',
width : 250,
align : 'center',
} ] ],
onLoadSuccess : function() {
if(is_opetipmenuwidth==null){
is_opetipmenuwidth = 60;
}
}
});
});
\ No newline at end of file
......@@ -2,6 +2,5 @@
<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
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<div style="overflow:auto;height:100%;">
<div style="overflow:auto;">
<img src="procinstanceData_showProcinstanceImg?instanceId=${instanceId}" />
<img id="loadingImg" style="width: 20px;height: 20px;" src="gaowj/ria/jquery/jquery-easyui-1.4.1/themes/black/images/loading.gif" />
<img style="display:none" onload='$("#loadingImg").hide();$(this).show();' src="procinstanceData_showProcinstanceImg?instanceId=${instanceId}" />
</div>
<input type="hidden" id="instanceIdHide" value="${instanceId}" />
<div id="historyTable"></div>
</div>
<script type="text/javascript" src="${ctx}/process/pages/procinstance/js/procinstanceTabHistory.js" charset="utf-8"></script>
......@@ -147,8 +147,6 @@ function fillTable(businessId,taskId){
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);
}
......@@ -438,6 +436,6 @@ function showProcinstanceImg(index) {
width : 1000,
height : 500,
title : '流程图',
content:'<div style="height:100%;overflow:auto;"><img src="procinstanceData_showProcinstanceImg?instanceId='+is_row[0].INSTANCE_ID+'" /></div>'
href:'procinstanceView_procinstanceTabHistory?instanceId='+is_row[0].INSTANCE_ID
});
}
\ No newline at end of file
......@@ -2,7 +2,5 @@
<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
......@@ -6,6 +6,7 @@ import java.util.Map;
import org.springframework.stereotype.Service;
import com.gaowj.business.exception.ActivitiException;
import com.gaowj.business.exception.BusinessException;
import com.gaowj.business.util.Page;
......@@ -17,7 +18,7 @@ public interface ProcinstanceBusiness {
* @param entity
* @throws BusinessException
*/
Map<String, Object> insert_proc_instance(Map<String, Object> entity) throws BusinessException;
Map<String, Object> insert_proc_instance(Map<String, Object> entity) throws ActivitiException,BusinessException;
/**
* 插入
......@@ -25,7 +26,7 @@ public interface ProcinstanceBusiness {
* @param entity
* @throws BusinessException
*/
Map<String, Object> insert_proc_instance_next(Map<String, Object> entity) throws BusinessException;
Map<String, Object> insert_proc_instance_next(Map<String, Object> entity) throws ActivitiException,BusinessException;
/**
* 更新
......@@ -33,7 +34,7 @@ public interface ProcinstanceBusiness {
* @param entity
* @throws BusinessException
*/
Map<String, Object> update_proc_instance(Map<String, Object> entity) throws BusinessException;
Map<String, Object> update_proc_instance(Map<String, Object> entity) throws ActivitiException,BusinessException;
/**
* 更新
......@@ -41,7 +42,7 @@ public interface ProcinstanceBusiness {
* @param entity
* @throws BusinessException
*/
Map<String, Object> update_proc_instance_next(Map<String, Object> entity) throws BusinessException;
Map<String, Object> update_proc_instance_next(Map<String, Object> entity) throws ActivitiException,BusinessException;
/**
* 删除记录
......
......@@ -4,6 +4,7 @@ import java.util.Map;
import org.springframework.stereotype.Service;
import com.gaowj.business.exception.ActivitiException;
import com.gaowj.business.exception.BusinessException;
import com.gaowj.business.util.Page;
......@@ -19,9 +20,9 @@ public interface ProctaskBusiness {
Map<String, Object> data_info(String businessId) throws BusinessException;
Map<String, Object> update(Map<String, Object> entity) throws BusinessException;
Map<String, Object> update(Map<String, Object> entity) throws ActivitiException,BusinessException;
Map<String, Object> updateToNext(String taskId,Map<String, Object> entity) throws BusinessException;
Map<String, Object> updateToNext(Map<String, Object> entity) throws ActivitiException,BusinessException;
Map<String, Object> back(Map<String, Object> entity) throws BusinessException;
}
package com.gaowj.business.exception;
/**
* activiti异常类
*
* @author luosz
*
*/
public class ActivitiException extends RuntimeException {
/**
*
*/
private static final long serialVersionUID = 1L;
public ActivitiException(String frdMessage) {
super("操作失败!"+frdMessage);
}
public ActivitiException(Throwable throwable) {
super(throwable);
}
public ActivitiException(Throwable throwable, String frdMessage) {
super(throwable);
}
}
......@@ -54,7 +54,7 @@
update C_T_PROC_INSTANCE set
]]>
<trim prefix="" suffixOverrides=",">
<foreach collection="info" item="info">
<foreach collection="infoList" item="info">
${info.key} = #{info.value} ,
</foreach>
</trim>
......
......@@ -7,12 +7,23 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import org.activiti.engine.HistoryService;
import org.activiti.engine.RepositoryService;
import org.activiti.engine.RuntimeService;
import org.activiti.engine.TaskService;
import org.activiti.engine.history.HistoricTaskInstance;
import org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity;
import org.activiti.engine.impl.pvm.PvmActivity;
import org.activiti.engine.impl.pvm.PvmTransition;
import org.activiti.engine.impl.pvm.process.ActivityImpl;
import org.activiti.engine.impl.pvm.process.ProcessDefinitionImpl;
import org.activiti.engine.impl.pvm.process.TransitionImpl;
import org.activiti.engine.runtime.ProcessInstance;
import org.activiti.engine.task.Task;
import org.activiti.engine.task.TaskQuery;
import com.gaowj.business.ProctaskBusiness;
import com.gaowj.business.exception.ActivitiException;
import com.gaowj.business.exception.BusinessException;
import com.gaowj.business.formmodels.formmodelsDAO;
import com.gaowj.business.formtable.formtableDAO;
......@@ -20,6 +31,8 @@ import com.gaowj.business.procdefinition.procdefinitionDAO;
import com.gaowj.business.procinstance.procinstanceDAO;
import com.gaowj.business.util.Page;
import com.gaowj.business.util.SessionUtil;
import com.gaowj.business.utils.ActivitiTools;
import com.gaowj.business.utils.model.ActivitiResultEnum;
public class ProctaskBusinessImpl implements ProctaskBusiness {
......@@ -35,6 +48,10 @@ public class ProctaskBusinessImpl implements ProctaskBusiness {
private formtableDAO formtableDAO;
private HistoryService historyService;
private RepositoryService repositoryService;
public RuntimeService getRuntimeService() {
return runtimeService;
}
......@@ -83,6 +100,22 @@ public class ProctaskBusinessImpl implements ProctaskBusiness {
this.formtableDAO = formtableDAO;
}
public HistoryService getHistoryService() {
return historyService;
}
public void setHistoryService(HistoryService historyService) {
this.historyService = historyService;
}
public RepositoryService getRepositoryService() {
return repositoryService;
}
public void setRepositoryService(RepositoryService repositoryService) {
this.repositoryService = repositoryService;
}
@Override
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>>();
......@@ -104,7 +137,7 @@ public class ProctaskBusinessImpl implements ProctaskBusiness {
map.put("EXECUTION_ID", task.getExecutionId());
map.put("PROCESS_INSTANCE_ID", task.getProcessInstanceId());
map.put("TASK_ID", task.getId());
//listInstanceId.add(task.getExecutionId());
// listInstanceId.add(task.getExecutionId());
listInstanceId.add(task.getProcessInstanceId());
}
......@@ -140,7 +173,7 @@ public class ProctaskBusinessImpl implements ProctaskBusiness {
}
}
} else {
//如果activit中没有任务,则new一个空的list
// 如果activit中没有任务,则new一个空的list
listInstance = new ArrayList<Map<String, Object>>();
}
page.setItems(listInstance);
......@@ -198,33 +231,25 @@ public class ProctaskBusinessImpl implements ProctaskBusiness {
}
@Override
public Map<String, Object> update(Map<String, Object> entity) throws BusinessException {
// 存储自定义表单的业务数据
update_custom_business(entity.get("TABLE_ID_SYSTEM").toString(), entity);
public Map<String, Object> update(Map<String, Object> entity) throws ActivitiException, BusinessException {
ActivitiResultEnum activitiResultEnum = ActivitiTools.save(entity, false);
switch (activitiResultEnum) {
case OK:
break;
default:
throw new ActivitiException(activitiResultEnum.getMsg());
}
return entity;
}
@Override
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);
public Map<String, Object> updateToNext(Map<String, Object> entity) throws ActivitiException, BusinessException {
ActivitiResultEnum activitiResultEnum = ActivitiTools.save(entity, true);
switch (activitiResultEnum) {
case OK:
break;
default:
throw new ActivitiException(activitiResultEnum.getMsg());
}
return entity;
}
......@@ -235,10 +260,8 @@ public class ProctaskBusinessImpl implements ProctaskBusiness {
update_custom_business(entity.get("TABLE_ID_SYSTEM").toString(), entity);
// 通过任务id获取流程id
String taskId = entity.get("TASK_ID_SYSTEM").toString();
// String processInstanceId =
// taskService.createTaskQuery().taskId(taskId).singleResult().getProcessInstanceId();
// 完成当前任务
taskService.complete(taskId);
// 退回当前任务
taskRollBack(taskId);
return entity;
}
......@@ -317,4 +340,63 @@ public class ProctaskBusinessImpl implements ProctaskBusiness {
return entity.get("UUID").toString();
}
private void taskRollBack(String taskId) {
try {
Map<String, Object> variables;
// 取得当前任务
HistoricTaskInstance currTask = historyService.createHistoricTaskInstanceQuery().taskId(taskId).singleResult();
// 取得流程实例
ProcessInstance instance = runtimeService.createProcessInstanceQuery().processInstanceId(currTask.getProcessInstanceId()).singleResult();
if (instance == null) {
// 流程结束
}
variables = instance.getProcessVariables();
// 取得流程定义
ProcessDefinitionEntity definition = (ProcessDefinitionEntity) (repositoryService.getProcessDefinition(currTask.getProcessDefinitionId()));
if (definition == null) {
// log.error("流程定义未找到");
return;
}
// 取得上一步活动
ActivityImpl currActivity = ((ProcessDefinitionImpl) definition).findActivity(currTask.getTaskDefinitionKey());
List<PvmTransition> nextTransitionList = currActivity.getIncomingTransitions();
// 清除当前活动的出口
List<PvmTransition> oriPvmTransitionList = new ArrayList<PvmTransition>();
List<PvmTransition> pvmTransitionList = currActivity.getOutgoingTransitions();
for (PvmTransition pvmTransition : pvmTransitionList) {
oriPvmTransitionList.add(pvmTransition);
}
pvmTransitionList.clear();
// 建立新出口
List<TransitionImpl> newTransitions = new ArrayList<TransitionImpl>();
for (PvmTransition nextTransition : nextTransitionList) {
PvmActivity nextActivity = nextTransition.getSource();
ActivityImpl nextActivityImpl = ((ProcessDefinitionImpl) definition).findActivity(nextActivity.getId());
TransitionImpl newTransition = currActivity.createOutgoingTransition();
newTransition.setDestination(nextActivityImpl);
newTransitions.add(newTransition);
}
// 完成任务
List<Task> tasks = taskService.createTaskQuery().processInstanceId(instance.getId()).taskDefinitionKey(currTask.getTaskDefinitionKey()).list();
for (Task task : tasks) {
taskService.complete(task.getId(), variables);
historyService.deleteHistoricTaskInstance(task.getId());
}
// 恢复方向
for (TransitionImpl transitionImpl : newTransitions) {
currActivity.getOutgoingTransitions().remove(transitionImpl);
}
for (PvmTransition pvmTransition : oriPvmTransitionList) {
pvmTransitionList.add(pvmTransition);
}
return;
} catch (Exception e) {
return;
}
}
}
package com.gaowj.business.utils.model;
/**
* activiti工具类方法调用的返回值
*
* @author luosz
*
*/
public class ActivitiResult {
/**
* 错误码
*/
private int code;
/**
* 提示语
*/
private String msg;
public ActivitiResult() {
super();
}
public ActivitiResult(int code, String msg) {
super();
this.code = code;
this.msg = msg;
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
}
package com.gaowj.business.utils.model;
/**
* ActivitiResult类型枚举类
*
* @author luosz
*
*/
public enum ActivitiResultEnum {
/**
* 成功
*/
OK(0, "成功"),
/**
* 无权限
*/
NO_POWER(-1, "您不是当前环节操作人,无权限修改该内容!");
private ActivitiResult activitiResult;
private ActivitiResultEnum(int code, String msg) {
activitiResult = new ActivitiResult(code, msg);
}
public ActivitiResult getActivitiResult() {
return activitiResult;
}
public int getCode() {
return activitiResult.getCode();
}
public String getMsg() {
return activitiResult.getMsg();
}
}
......@@ -8,6 +8,7 @@ import com.gaowj.business.ProcinstanceBusiness;
import com.gaowj.business.SystemOpeBusiness;
import com.gaowj.business.action.BasicAction;
import com.gaowj.business.comp.BusinessManager;
import com.gaowj.business.exception.ActivitiException;
import com.gaowj.business.exception.BusinessException;
import com.gaowj.business.util.QueryParamUtil;
import com.gaowj.business.util.RequestUtils;
......@@ -40,25 +41,27 @@ public class actAction extends BasicAction {
*/
public String insertInfo() throws BusinessException {
ProcinstanceBusiness business = BusinessManager.getBusiness(ProcinstanceBusiness.class);
Map<String, Object> entity = RequestUtils.getUpdateFieldMap(request,RequestUtils.UPDATEDATAFIELDPREFIX);
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(entity);
// 新增
Map<String, Object> procinstance = business.insert_proc_instance(entity);
// 操作日志
//sysbusiness.insert_logBusiness(具体方法,操作内容,操作描述,操作记录ID,操作记录中文描述,分类)
// sysbusiness.insert_logBusiness(具体方法,操作内容,操作描述,操作记录ID,操作记录中文描述,分类)
SystemOpeBusiness sysbusiness = BusinessManager.getBusiness(SystemOpeBusiness.class);
sysbusiness.insert_logBusiness("insertInfo", "" + procinstance,
"增加流程实例数据", (String) entity.get("UUID"), (String) entity.get("CONTENT"), "procinstance");
sysbusiness.insert_logBusiness("insertInfo", "" + procinstance, "增加流程实例数据", (String) entity.get("UUID"), (String) entity.get("CONTENT"), "procinstance");
//
//
jsonObject.putAll(Status.getStatusSuccessMessage("保存成功"));
} catch (ActivitiException e) {
jsonObject.putAll(Status.getStatusErrorMessage(e.getMessage()));
e.printStackTrace();
} catch (Exception e) {
jsonObject.putAll(Status.getStatusErrorMessage("保存失败"));
jsonObject.putAll(Status.getStatusErrorMessage(e.getMessage()));
e.printStackTrace();
}
return "json";
......@@ -66,25 +69,27 @@ public class actAction extends BasicAction {
public String insertInfoToNext() throws BusinessException {
ProcinstanceBusiness business = BusinessManager.getBusiness(ProcinstanceBusiness.class);
Map<String, Object> entity = RequestUtils.getUpdateFieldMap(request,RequestUtils.UPDATEDATAFIELDPREFIX);
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);
// 新增
Map<String, Object> procinstance = business.insert_proc_instance_next(entity);
// 操作日志
//sysbusiness.insert_logBusiness(具体方法,操作内容,操作描述,操作记录ID,操作记录中文描述,分类)
// sysbusiness.insert_logBusiness(具体方法,操作内容,操作描述,操作记录ID,操作记录中文描述,分类)
SystemOpeBusiness sysbusiness = BusinessManager.getBusiness(SystemOpeBusiness.class);
sysbusiness.insert_logBusiness("insertInfo", "" + procinstance,
"增加流程实例数据", (String) entity.get("UUID"), (String) entity.get("CONTENT"), "procinstance");
sysbusiness.insert_logBusiness("insertInfo", "" + procinstance, "增加流程实例数据", (String) entity.get("UUID"), (String) entity.get("CONTENT"), "procinstance");
//
//
jsonObject.putAll(Status.getStatusSuccessMessage("保存成功"));
} catch (ActivitiException e) {
jsonObject.putAll(Status.getStatusErrorMessage(e.getMessage()));
e.printStackTrace();
} catch (Exception e) {
jsonObject.putAll(Status.getStatusErrorMessage("保存失败"));
jsonObject.putAll(Status.getStatusErrorMessage(e.getMessage()));
e.printStackTrace();
}
return "json";
......@@ -98,29 +103,27 @@ public class actAction extends BasicAction {
*/
public String updateInfo() throws BusinessException {
ProcinstanceBusiness business = BusinessManager.getBusiness(ProcinstanceBusiness.class);
Map<String, Object> entity = RequestUtils.getUpdateFieldMap(request,RequestUtils.UPDATEDATAFIELDPREFIX);
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_proc_instance(entity);
if("-1".equals(procinstance.get("ERROR"))){
jsonObject.putAll(Status.getStatusErrorMessage("你不属于当前流程环节处理人,无权限处理该业务。"));
return "json";
}
// 更新
Map<String, Object> procinstance = business.update_proc_instance(entity);
// 操作日志
//sysbusiness.insert_logBusiness(具体方法,操作内容,操作描述,操作记录ID,操作记录中文描述,分类)
// sysbusiness.insert_logBusiness(具体方法,操作内容,操作描述,操作记录ID,操作记录中文描述,分类)
SystemOpeBusiness sysbusiness = BusinessManager.getBusiness(SystemOpeBusiness.class);
sysbusiness.insert_logBusiness("insertInfo", "" + procinstance,
"更新流程实例数据", (String) entity.get("UUID"), (String) entity.get("CONTENT"), "procinstance");
sysbusiness.insert_logBusiness("insertInfo", "" + procinstance, "更新流程实例数据", (String) entity.get("UUID"), (String) entity.get("CONTENT"), "procinstance");
//
//
jsonObject.putAll(Status.getStatusSuccessMessage("保存成功"));
} catch (ActivitiException e) {
jsonObject.putAll(Status.getStatusErrorMessage(e.getMessage()));
e.printStackTrace();
} catch (Exception e) {
jsonObject.putAll(Status.getStatusErrorMessage("保存失败"));
jsonObject.putAll(Status.getStatusErrorMessage(e.getMessage()));
e.printStackTrace();
}
return "json";
......@@ -134,37 +137,35 @@ public class actAction extends BasicAction {
*/
public String updateInfoToNext() throws BusinessException {
ProcinstanceBusiness business = BusinessManager.getBusiness(ProcinstanceBusiness.class);
Map<String, Object> entity = RequestUtils.getUpdateFieldMap(request,RequestUtils.UPDATEDATAFIELDPREFIX);
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_proc_instance_next(entity);
if("-1".equals(procinstance.get("ERROR"))){
jsonObject.putAll(Status.getStatusErrorMessage("你不属于当前流程环节处理人,无权限处理该业务。"));
return "json";
}
// 更新
Map<String, Object> procinstance = business.update_proc_instance_next(entity);
// 操作日志
//sysbusiness.insert_logBusiness(具体方法,操作内容,操作描述,操作记录ID,操作记录中文描述,分类)
// sysbusiness.insert_logBusiness(具体方法,操作内容,操作描述,操作记录ID,操作记录中文描述,分类)
SystemOpeBusiness sysbusiness = BusinessManager.getBusiness(SystemOpeBusiness.class);
sysbusiness.insert_logBusiness("insertInfo", "" + procinstance,
"更新流程实例数据", (String) entity.get("UUID"), (String) entity.get("CONTENT"), "procinstance");
sysbusiness.insert_logBusiness("insertInfo", "" + procinstance, "更新流程实例数据", (String) entity.get("UUID"), (String) entity.get("CONTENT"), "procinstance");
//
//
jsonObject.putAll(Status.getStatusSuccessMessage("保存成功"));
} catch (ActivitiException e) {
jsonObject.putAll(Status.getStatusErrorMessage(e.getMessage()));
e.printStackTrace();
} catch (Exception e) {
jsonObject.putAll(Status.getStatusErrorMessage("保存失败"));
jsonObject.putAll(Status.getStatusErrorMessage(e.getMessage()));
e.printStackTrace();
}
return "json";
}
public String deleteInfo() throws BusinessException{
public String deleteInfo() throws BusinessException {
ProcinstanceBusiness business = BusinessManager.getBusiness(ProcinstanceBusiness.class);
Map<String, Object> entity = RequestUtils.getUpdateFieldMap(request,RequestUtils.UPDATEDATAFIELDPREFIX);
Map<String, Object> entity = RequestUtils.getUpdateFieldMap(request, RequestUtils.UPDATEDATAFIELDPREFIX);
String deletekey = (String) entity.get("CODE");
List<String> ListKey = QueryParamUtil.StringToList(deletekey);
......@@ -172,8 +173,7 @@ public class actAction extends BasicAction {
business.delete_proc_instance(ListKey);
// 操作日志
SystemOpeBusiness sysbusiness = BusinessManager.getBusiness(SystemOpeBusiness.class);
sysbusiness.insert_logBusiness("deleteProcinstance", "" + ListKey,
"删除流程实例数据", deletekey, "多个流水号","procinstance");
sysbusiness.insert_logBusiness("deleteProcinstance", "" + ListKey, "删除流程实例数据", deletekey, "多个流水号", "procinstance");
//
jsonObject.putAll(Status.getStatusSuccessMessage("删除成功"));
......
......@@ -2,11 +2,11 @@ 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.comp.BusinessManager;
import com.gaowj.business.exception.ActivitiException;
import com.gaowj.business.exception.BusinessException;
import com.gaowj.business.util.QueryParamUtil;
import com.gaowj.business.util.RequestUtils;
......@@ -14,7 +14,7 @@ import com.gaowj.business.util.Status;
import net.sf.json.JSONObject;
public class actAction extends BasicAction{
public class actAction extends BasicAction {
/**
*
......@@ -33,26 +33,27 @@ public class actAction extends BasicAction{
public String updateInfo() throws BusinessException {
ProctaskBusiness business = BusinessManager.getBusiness(ProctaskBusiness.class);
Map<String, Object> entity = RequestUtils.getUpdateFieldMap(request,RequestUtils.UPDATEDATAFIELDPREFIX);
Map<String, Object> entity = RequestUtils.getUpdateFieldMap(request, RequestUtils.UPDATEDATAFIELDPREFIX);
jsonObject = new JSONObject();
try {
entity = QueryParamUtil.StringToDate(entity);
//去除不要更新的字段
// 去除不要更新的字段
entity.remove("OPETYPE");
entity.remove("TASK_ID_SYSTEM");
//新增
Map<String,Object> procinstance=business.update(entity);
// 新增
Map<String, Object> procinstance = business.update(entity);
// 操作日志
//sysbusiness.insert_logBusiness(具体方法,操作内容,操作描述,操作记录ID,操作记录中文描述,分类)
// sysbusiness.insert_logBusiness(具体方法,操作内容,操作描述,操作记录ID,操作记录中文描述,分类)
SystemOpeBusiness sysbusiness = BusinessManager.getBusiness(SystemOpeBusiness.class);
sysbusiness.insert_logBusiness("updateInfo", "" + procinstance,
"更新流程实例数据", (String) entity.get("UUID"), (String) entity.get("CONTENT"), "procinstance");
sysbusiness.insert_logBusiness("updateInfo", "" + procinstance, "更新流程实例数据", (String) entity.get("UUID"), (String) entity.get("CONTENT"), "procinstance");
//
//
jsonObject.putAll(Status.getStatusSuccessMessage("保存成功"));
} catch (ActivitiException e) {
jsonObject.putAll(Status.getStatusErrorMessage(e.getMessage()));
e.printStackTrace();
} catch (Exception e) {
jsonObject.putAll(Status.getStatusErrorMessage("保存失败"));
jsonObject.putAll(Status.getStatusErrorMessage(e.getMessage()));
e.printStackTrace();
}
return "json";
......@@ -60,26 +61,26 @@ public class actAction extends BasicAction{
public String updateInfoToNext() throws BusinessException {
ProctaskBusiness business = BusinessManager.getBusiness(ProctaskBusiness.class);
Map<String, Object> entity = RequestUtils.getUpdateFieldMap(request,RequestUtils.UPDATEDATAFIELDPREFIX);
String taskId=entity.get("TASK_ID_SYSTEM").toString();
Map<String, Object> entity = RequestUtils.getUpdateFieldMap(request, RequestUtils.UPDATEDATAFIELDPREFIX);
jsonObject = new JSONObject();
try {
entity = QueryParamUtil.StringToDate(entity);
//去除不要更新的字段
// 去除不要更新的字段
entity.remove("OPETYPE");
entity.remove("TASK_ID_SYSTEM");
//新增
Map<String,Object> procinstance=business.updateToNext(taskId, entity);
// 新增
Map<String, Object> procinstance = business.updateToNext(entity);
// 操作日志
//sysbusiness.insert_logBusiness(具体方法,操作内容,操作描述,操作记录ID,操作记录中文描述,分类)
// sysbusiness.insert_logBusiness(具体方法,操作内容,操作描述,操作记录ID,操作记录中文描述,分类)
SystemOpeBusiness sysbusiness = BusinessManager.getBusiness(SystemOpeBusiness.class);
sysbusiness.insert_logBusiness("updateInfo", "" + procinstance,
"更新流程实例数据", (String) entity.get("UUID"), (String) entity.get("CONTENT"), "procinstance");
sysbusiness.insert_logBusiness("updateInfo", "" + procinstance, "更新流程实例数据", (String) entity.get("UUID"), (String) entity.get("CONTENT"), "procinstance");
//
//
jsonObject.putAll(Status.getStatusSuccessMessage("保存成功"));
} catch (ActivitiException e) {
jsonObject.putAll(Status.getStatusErrorMessage(e.getMessage()));
e.printStackTrace();
} catch (Exception e) {
jsonObject.putAll(Status.getStatusErrorMessage("保存失败"));
jsonObject.putAll(Status.getStatusErrorMessage(e.getMessage()));
e.printStackTrace();
}
return "json";
......@@ -91,10 +92,10 @@ public class actAction extends BasicAction{
jsonObject = new JSONObject();
try {
entity = QueryParamUtil.StringToDate(entity);
//business.list_proc_task(pageNo, pageSize, query)
// business.list_proc_task(pageNo, pageSize, query)
jsonObject.putAll(Status.getStatusSuccessMessage("保存成功"));
} catch (Exception e) {
jsonObject.putAll(Status.getStatusErrorMessage("保存失败"));
jsonObject.putAll(Status.getStatusErrorMessage(e.getMessage()));
e.printStackTrace();
}
return "json";
......
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