Commit 079bad08 by 罗绍泽

流程实例,我的任务完善

parent 52b088f7
......@@ -55,6 +55,10 @@
<property name="mapperInterface" value="com.gaowj.business.procdefiChooseDept.procdefiChooseDeptDAO" />
<property name="sqlSessionFactory" ref="sqlSessionFactory-process" />
</bean>
<bean id="formfieldDAO" class="org.mybatis.spring.mapper.MapperFactoryBean">
<property name="mapperInterface" value="com.gaowj.business.formfield.formfieldDAO" />
<property name="sqlSessionFactory" ref="sqlSessionFactory-process" />
</bean>
<!-- DAO定义结束 -->
<bean id="FormtableBusiness" class="com.gaowj.business.formtable.FormtableBusinessImpl">
......@@ -69,6 +73,8 @@
<property name="formmodelsDAO" ref="formmodelsDAO"></property>
<property name="formfieldDAO" ref="formfieldDAO"></property>
<property name="repositoryService" ref="repositoryService"></property>
<property name="procdefinitionInitlinkDAO" ref="procdefinitionInitlinkDAO"></property>
......@@ -85,12 +91,7 @@
</bean>
<bean id="FormfieldBusiness" class="com.gaowj.business.formfield.FormfieldBusinessImpl">
<property name="formfieldDAO">
<bean class="org.mybatis.spring.mapper.MapperFactoryBean">
<property name="mapperInterface" value="com.gaowj.business.formfield.formfieldDAO" />
<property name="sqlSessionFactory" ref="sqlSessionFactory-test" />
</bean>
</property>
<property name="formfieldDAO" ref="formfieldDAO"></property>
</bean>
<bean id="ProcinstanceBusiness" class="com.gaowj.business.procinstance.ProcinstanceBusinessImpl">
......
......@@ -18,6 +18,8 @@ procdefinitionModule.prototype.deleteProcdefinition = function(){};
procdefinitionModule.prototype.listAll = function(){};
//查找流程定义对应的表模板
procdefinitionModule.prototype.findFormModel = function(){};
//根据流程定义id获取表的列表显示的字段
procdefinitionModule.prototype.listShowField = function(){};
//创建一个数据操作对象,然后再后续使用
procdefinitionModule.act = new procdefinitionModule("json").delegate("procdefinitionAct");
......
......@@ -308,28 +308,30 @@ 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
}, {
//获取该业务的列表显示字段
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,
......@@ -340,7 +342,9 @@ function searchRow(){
return "完成";
}
}
} ] ],
});
$('#list').datagrid({
columns : [bussiness_columns],
queryParams:v_query
});
}
......
......@@ -12,6 +12,8 @@ proctaskModule.prototype = BusinessObject;
proctaskModule.prototype.getInfo = function(){};
//修改流程实例
proctaskModule.prototype.updateInfo = function(){};
//修改流程实例,并跳到下一步
proctaskModule.prototype.updateInfoToNext = function(){};
//删除流程实例
proctaskModule.prototype.deleteInfo = function(){};
......
......@@ -72,7 +72,7 @@ for(var i=1;i<v_data_procdefinition.length;i++){
var ls_title=null;
var is_column = [[
{field:'PROC_NAME',title:'流程',width:80},
{field:'EXECUTION_ID',title:'实例id',width:80},
{field:'TASK_ID',title:'任务id',width:80},
{field:'CREATE_ID',title:'创建人',width:80},
{field:'CREATE_TIME',title:'新建时间',width:130,formatter:function(value,row,index){
return value;
......@@ -137,7 +137,7 @@ function getOptionMenuCount(){
/****/
function fillTable(businessId){
function fillTable(businessId,taskId){
var info=proctaskModule.data.getInfo({
FIELD_BUSINESS_ID:businessId
});
......@@ -148,6 +148,8 @@ function fillTable(businessId){
}
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);
}
......@@ -162,7 +164,7 @@ function editRow(index) {
//加载修改子页面成功后的回调
function updateUrlOnloadCallback(is_row){
fillTable(is_row.BUSINESS_ID);
fillTable(is_row.BUSINESS_ID,is_row.TASK_ID);
}
//保存
function updateData(is_entity){
......@@ -173,9 +175,7 @@ function updateData(is_entity){
//下一步按钮执行事件
function updateDataToNext(is_entity){
alert('开发中');
return;
v_result = procdefinitionModule.act.updateProcdefinition(is_entity);
v_result = proctaskModule.act.updateInfoToNext(is_entity);
$('#list').datagrid('reload');
return v_result;
}
......
......@@ -3,5 +3,6 @@
<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
package com.gaowj.activiti.listener;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -34,13 +35,21 @@ public class AssignmentTaskListener implements TaskListener {
if(historicActivityInstanceList.size()==0){
//如果历史环节数量为0,则表示这个实例第一次启动,第一个环节默认为当前登陆人
task.setAssignee(SessionUtil.getCode());
//task.setAssignee(SessionUtil.getCode());
List<String> listUserId=new ArrayList<String>();
listUserId.add(SessionUtil.getCode());
task.addCandidateUsers(listUserId);
}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);
List<String> listUserId=new ArrayList<String>();
for(Map<String, Object> user:listUser){
listUserId.add(user.get("CODE").toString());
}
task.addCandidateUsers(listUserId);
}
/*System.out.println(task.getAssignee());
......
......@@ -71,4 +71,6 @@ public interface ProcdefinitionBusiness {
int init_procde_finition_people_approval(String procdefinitionUuid)throws BusinessException;
List<Map<String,Object>> listShowField(String procDefinitionId) throws BusinessException;
}
......@@ -20,4 +20,6 @@ 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> updateToNext(String taskId,Map<String, Object> entity) throws BusinessException;
}
......@@ -9,6 +9,9 @@
<if test="TABLE_ID != null and TABLE_ID != ''">
and f.TABLE_ID = #{TABLE_ID}
</if>
<if test="IS_SHOW_LIST != null and IS_SHOW_LIST != ''">
and f.IS_SHOW_LIST = #{IS_SHOW_LIST}
</if>
</trim>
</sql>
<insert id="insert_form_field" parameterType="map">
......
......@@ -22,6 +22,7 @@ import org.apache.ibatis.session.RowBounds;
import com.gaowj.business.ProcdefinitionBusiness;
import com.gaowj.business.exception.BusinessException;
import com.gaowj.business.formfield.formfieldDAO;
import com.gaowj.business.procdefinitionInitlink.procdefinitionInitlinkDAO;
import com.gaowj.business.formmodels.formmodelsDAO;
import com.gaowj.business.util.Page;
......@@ -33,6 +34,8 @@ public class ProcdefinitionBusinessImpl implements ProcdefinitionBusiness {
private formmodelsDAO formmodelsDAO;
private formfieldDAO formfieldDAO;
private RepositoryService repositoryService;
private procdefinitionInitlinkDAO procdefinitionInitlinkDAO;
......@@ -54,7 +57,13 @@ public class ProcdefinitionBusinessImpl implements ProcdefinitionBusiness {
}
public formfieldDAO getFormfieldDAO() {
return formfieldDAO;
}
public void setFormfieldDAO(formfieldDAO formfieldDAO) {
this.formfieldDAO = formfieldDAO;
}
public RepositoryService getRepositoryService() {
return repositoryService;
......@@ -307,4 +316,16 @@ public class ProcdefinitionBusinessImpl implements ProcdefinitionBusiness {
}
return 1;
}
@Override
public List<Map<String, Object>> listShowField(String procDefinitionId) throws BusinessException {
Map<String,Object> query=new HashMap<String, Object>();
query.put("UUID", procDefinitionId);
String tableId=procdefinitionDAO.list_procde_finition(query).get(0).get("TABLE_ID").toString();
Map<String,Object> query2=new HashMap<String, Object>();
query2.put("TABLE_ID", tableId);
query2.put("IS_SHOW_LIST", 1);
return formfieldDAO.list_form_field(query2);
}
}
......@@ -6,6 +6,9 @@
<if test="UUID != null and UUID != ''">
and f.UUID = #{UUID}
</if>
<if test="CREATE_ID != null and CREATE_ID != ''">
and f.CREATE_ID = #{CREATE_ID}
</if>
<if test="PROC_DEFINITION_ID != null and PROC_DEFINITION_ID != ''">
and f.PROC_DEFINITION_ID = #{PROC_DEFINITION_ID}
</if>
......
......@@ -77,11 +77,11 @@ public class ProctaskBusinessImpl implements ProctaskBusiness {
Page<Map<String, Object>> page = new Page<Map<String, Object>>();
// 计算起始记录
int pageStart = (pageNo - 1) * pageSize;
TaskQuery taskQuery=taskService.createTaskQuery().taskAssignee(SessionUtil.getCode());
TaskQuery taskQuery=taskService.createTaskQuery().taskCandidateUser(SessionUtil.getCode());
page.setStart(pageStart);
page.setLimit(pageSize);
page.setCount((int)taskQuery.count());
List<Task> list = taskQuery.orderByTaskCreateTime().asc().listPage(pageStart, pageSize);
List<Task> list = taskQuery.orderByTaskCreateTime().desc().listPage(pageStart, pageSize);
List<Map<String,Object>> items=new ArrayList<Map<String,Object>>();
List<String> listInstanceId=new ArrayList<String>();
for(Task task:list){
......@@ -89,6 +89,7 @@ public class ProctaskBusinessImpl implements ProctaskBusiness {
items.add(map);
map.put("CREATE_TIME", task.getCreateTime());
map.put("EXECUTION_ID", task.getExecutionId());
map.put("TASK_ID", task.getId());
listInstanceId.add(task.getExecutionId());
}
......@@ -169,6 +170,15 @@ public class ProctaskBusinessImpl implements ProctaskBusiness {
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);
//完成当前任务
taskService.complete(taskId);
return entity;
}
private String update_custom_business(String tableId,Map<String, Object> entity) {
entity.remove("TABLE_ID_SYSTEM");
if (entity.get("UUID") == null) {
......
......@@ -236,4 +236,29 @@ public class dataAction extends BasicAction{
return "json";
}
public String listShowField() throws BusinessException{
ProcdefinitionBusiness business = BusinessManager.getBusiness(ProcdefinitionBusiness.class);
//流程定义id
String procDefinitionId=RequestUtils.getString(request, "PROC_DEFINITION_ID");
List<Map<String, Object>> listField=business.listShowField(procDefinitionId);
Map<String, Object> data = new HashMap<String, Object>();
try {
data.put("rowSet", QueryParamUtil.DateToString(listField));
data.put("pageNo", pageNo);
data.put("pageSize", pageSize);
data.put("pageCount", pageCount);
data.put("rows", data.get("rowSet"));
data.put("total", listField.size());
jsonObject = new JSONObject();
jsonObject.putAll(data);
jsonObject.putAll(Status.getStatusSuccessMessage("成功"));
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
jsonObject.putAll(Status.getStatusSuccessMessage("失败"));
}
return "json";
}
}
......@@ -40,6 +40,7 @@ public class actAction extends BasicAction{
entity = QueryParamUtil.StringToDate(entity);
//去除不要更新的字段
entity.remove("OPETYPE");
entity.remove("TASK_ID_SYSTEM");
//新增
Map<String,Object> procinstance=business.update(entity);
// 操作日志
......@@ -56,4 +57,31 @@ public class actAction extends BasicAction{
}
return "json";
}
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();
jsonObject = new JSONObject();
try {
entity = QueryParamUtil.StringToDate(entity);
//去除不要更新的字段
entity.remove("OPETYPE");
entity.remove("TASK_ID_SYSTEM");
//新增
Map<String,Object> procinstance=business.updateToNext(taskId, 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";
}
}
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