Commit 079bad08 by 罗绍泽

流程实例,我的任务完善

parent 52b088f7
...@@ -55,6 +55,10 @@ ...@@ -55,6 +55,10 @@
<property name="mapperInterface" value="com.gaowj.business.procdefiChooseDept.procdefiChooseDeptDAO" /> <property name="mapperInterface" value="com.gaowj.business.procdefiChooseDept.procdefiChooseDeptDAO" />
<property name="sqlSessionFactory" ref="sqlSessionFactory-process" /> <property name="sqlSessionFactory" ref="sqlSessionFactory-process" />
</bean> </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定义结束 --> <!-- DAO定义结束 -->
<bean id="FormtableBusiness" class="com.gaowj.business.formtable.FormtableBusinessImpl"> <bean id="FormtableBusiness" class="com.gaowj.business.formtable.FormtableBusinessImpl">
...@@ -69,6 +73,8 @@ ...@@ -69,6 +73,8 @@
<property name="formmodelsDAO" ref="formmodelsDAO"></property> <property name="formmodelsDAO" ref="formmodelsDAO"></property>
<property name="formfieldDAO" ref="formfieldDAO"></property>
<property name="repositoryService" ref="repositoryService"></property> <property name="repositoryService" ref="repositoryService"></property>
<property name="procdefinitionInitlinkDAO" ref="procdefinitionInitlinkDAO"></property> <property name="procdefinitionInitlinkDAO" ref="procdefinitionInitlinkDAO"></property>
...@@ -85,12 +91,7 @@ ...@@ -85,12 +91,7 @@
</bean> </bean>
<bean id="FormfieldBusiness" class="com.gaowj.business.formfield.FormfieldBusinessImpl"> <bean id="FormfieldBusiness" class="com.gaowj.business.formfield.FormfieldBusinessImpl">
<property name="formfieldDAO"> <property name="formfieldDAO" ref="formfieldDAO"></property>
<bean class="org.mybatis.spring.mapper.MapperFactoryBean">
<property name="mapperInterface" value="com.gaowj.business.formfield.formfieldDAO" />
<property name="sqlSessionFactory" ref="sqlSessionFactory-test" />
</bean>
</property>
</bean> </bean>
<bean id="ProcinstanceBusiness" class="com.gaowj.business.procinstance.ProcinstanceBusinessImpl"> <bean id="ProcinstanceBusiness" class="com.gaowj.business.procinstance.ProcinstanceBusinessImpl">
......
...@@ -18,6 +18,8 @@ procdefinitionModule.prototype.deleteProcdefinition = function(){}; ...@@ -18,6 +18,8 @@ procdefinitionModule.prototype.deleteProcdefinition = function(){};
procdefinitionModule.prototype.listAll = function(){}; procdefinitionModule.prototype.listAll = function(){};
//查找流程定义对应的表模板 //查找流程定义对应的表模板
procdefinitionModule.prototype.findFormModel = function(){}; procdefinitionModule.prototype.findFormModel = function(){};
//根据流程定义id获取表的列表显示的字段
procdefinitionModule.prototype.listShowField = function(){};
//创建一个数据操作对象,然后再后续使用 //创建一个数据操作对象,然后再后续使用
procdefinitionModule.act = new procdefinitionModule("json").delegate("procdefinitionAct"); procdefinitionModule.act = new procdefinitionModule("json").delegate("procdefinitionAct");
......
...@@ -308,40 +308,44 @@ function searchRow(){ ...@@ -308,40 +308,44 @@ 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;
}, { }
field : 'CREATE_TIME', }
title : '新建时间', bussiness_columns.push({
width : 130, field : 'CREATE_TIME',
formatter : function(value, row, index) { title : '新建时间',
return value; width : 130,
} formatter : function(value, row, index) {
}, return value;
{ }
field : 'COMPLETE', });
title : '进度', bussiness_columns.push({
width : 80, field : 'COMPLETE',
formatter : function(value, row, index) { title : '进度',
if (value == 0) { width : 80,
return "进行中"; formatter : function(value, row, index) {
} else { if (value == 0) {
return "完成"; return "进行中";
} } else {
return "完成";
} }
} ] ], }
queryParams:v_query });
$('#list').datagrid({
columns : [bussiness_columns],
queryParams:v_query
}); });
} }
......
...@@ -12,6 +12,8 @@ proctaskModule.prototype = BusinessObject; ...@@ -12,6 +12,8 @@ proctaskModule.prototype = BusinessObject;
proctaskModule.prototype.getInfo = function(){}; proctaskModule.prototype.getInfo = function(){};
//修改流程实例 //修改流程实例
proctaskModule.prototype.updateInfo = function(){}; proctaskModule.prototype.updateInfo = function(){};
//修改流程实例,并跳到下一步
proctaskModule.prototype.updateInfoToNext = function(){};
//删除流程实例 //删除流程实例
proctaskModule.prototype.deleteInfo = function(){}; proctaskModule.prototype.deleteInfo = function(){};
......
...@@ -72,7 +72,7 @@ for(var i=1;i<v_data_procdefinition.length;i++){ ...@@ -72,7 +72,7 @@ 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:80}, {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_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;
...@@ -137,7 +137,7 @@ function getOptionMenuCount(){ ...@@ -137,7 +137,7 @@ function getOptionMenuCount(){
/****/ /****/
function fillTable(businessId){ function fillTable(businessId,taskId){
var info=proctaskModule.data.getInfo({ var info=proctaskModule.data.getInfo({
FIELD_BUSINESS_ID:businessId FIELD_BUSINESS_ID:businessId
}); });
...@@ -148,6 +148,8 @@ function fillTable(businessId){ ...@@ -148,6 +148,8 @@ function fillTable(businessId){
} }
info.BUSINESS_DATA['FIELD_OPETYPE']='update'; info.BUSINESS_DATA['FIELD_OPETYPE']='update';
info.BUSINESS_DATA['FIELD_TABLE_ID_SYSTEM']=info.FORM_MODEL.TABLE_ID; 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); $("#inputForm").form('load',info.BUSINESS_DATA);
} }
...@@ -162,7 +164,7 @@ function editRow(index) { ...@@ -162,7 +164,7 @@ function editRow(index) {
//加载修改子页面成功后的回调 //加载修改子页面成功后的回调
function updateUrlOnloadCallback(is_row){ function updateUrlOnloadCallback(is_row){
fillTable(is_row.BUSINESS_ID); fillTable(is_row.BUSINESS_ID,is_row.TASK_ID);
} }
//保存 //保存
function updateData(is_entity){ function updateData(is_entity){
...@@ -173,9 +175,7 @@ function updateData(is_entity){ ...@@ -173,9 +175,7 @@ function updateData(is_entity){
//下一步按钮执行事件 //下一步按钮执行事件
function updateDataToNext(is_entity){ function updateDataToNext(is_entity){
alert('开发中'); v_result = proctaskModule.act.updateInfoToNext(is_entity);
return;
v_result = procdefinitionModule.act.updateProcdefinition(is_entity);
$('#list').datagrid('reload'); $('#list').datagrid('reload');
return v_result; return v_result;
} }
......
...@@ -3,5 +3,6 @@ ...@@ -3,5 +3,6 @@
<input type="hidden" name="FIELD_OPETYPE" id="OPETYPE" value="${is_row.OPETYPE}" /> <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_UUID" id="UUID" value="${is_row.UUID}" />
<input type="hidden" name="FIELD_TABLE_ID_SYSTEM" id="TABLE_ID_SYSTEM"/> <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> <div id="table_content"></div>
</form> </form>
\ No newline at end of file
package com.gaowj.activiti.listener; package com.gaowj.activiti.listener;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -34,13 +35,21 @@ public class AssignmentTaskListener implements TaskListener { ...@@ -34,13 +35,21 @@ public class AssignmentTaskListener implements TaskListener {
if(historicActivityInstanceList.size()==0){ if(historicActivityInstanceList.size()==0){
//如果历史环节数量为0,则表示这个实例第一次启动,第一个环节默认为当前登陆人 //如果历史环节数量为0,则表示这个实例第一次启动,第一个环节默认为当前登陆人
task.setAssignee(SessionUtil.getCode()); //task.setAssignee(SessionUtil.getCode());
List<String> listUserId=new ArrayList<String>();
listUserId.add(SessionUtil.getCode());
task.addCandidateUsers(listUserId);
}else{ }else{
//读取环节人员配置信息,循环设置人员 //读取环节人员配置信息,循环设置人员
ProcdefiChooseUserBusiness procdefiChooseUserBusiness=(ProcdefiChooseUserBusiness) context.getBean("ProcdefiChooseUserBusiness"); ProcdefiChooseUserBusiness procdefiChooseUserBusiness=(ProcdefiChooseUserBusiness) context.getBean("ProcdefiChooseUserBusiness");
Map<String, Object> query=new HashMap<String, Object>(); Map<String, Object> query=new HashMap<String, Object>();
query.put("LINK_KEY", task.getTaskDefinitionKey().toString()); query.put("LINK_KEY", task.getTaskDefinitionKey().toString());
List<Map<String, Object>> listUser=procdefiChooseUserBusiness.list_procdefi_chooseUser(query); 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()); /*System.out.println(task.getAssignee());
......
...@@ -71,4 +71,6 @@ public interface ProcdefinitionBusiness { ...@@ -71,4 +71,6 @@ public interface ProcdefinitionBusiness {
int init_procde_finition_people_approval(String procdefinitionUuid)throws BusinessException; 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 { ...@@ -20,4 +20,6 @@ public interface ProctaskBusiness {
Map<String, Object> data_info(String businessId) throws BusinessException; 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 BusinessException;
Map<String, Object> updateToNext(String taskId,Map<String, Object> entity) throws BusinessException;
} }
...@@ -9,6 +9,9 @@ ...@@ -9,6 +9,9 @@
<if test="TABLE_ID != null and TABLE_ID != ''"> <if test="TABLE_ID != null and TABLE_ID != ''">
and f.TABLE_ID = #{TABLE_ID} and f.TABLE_ID = #{TABLE_ID}
</if> </if>
<if test="IS_SHOW_LIST != null and IS_SHOW_LIST != ''">
and f.IS_SHOW_LIST = #{IS_SHOW_LIST}
</if>
</trim> </trim>
</sql> </sql>
<insert id="insert_form_field" parameterType="map"> <insert id="insert_form_field" parameterType="map">
......
...@@ -22,6 +22,7 @@ import org.apache.ibatis.session.RowBounds; ...@@ -22,6 +22,7 @@ import org.apache.ibatis.session.RowBounds;
import com.gaowj.business.ProcdefinitionBusiness; import com.gaowj.business.ProcdefinitionBusiness;
import com.gaowj.business.exception.BusinessException; import com.gaowj.business.exception.BusinessException;
import com.gaowj.business.formfield.formfieldDAO;
import com.gaowj.business.procdefinitionInitlink.procdefinitionInitlinkDAO; import com.gaowj.business.procdefinitionInitlink.procdefinitionInitlinkDAO;
import com.gaowj.business.formmodels.formmodelsDAO; import com.gaowj.business.formmodels.formmodelsDAO;
import com.gaowj.business.util.Page; import com.gaowj.business.util.Page;
...@@ -32,6 +33,8 @@ public class ProcdefinitionBusinessImpl implements ProcdefinitionBusiness { ...@@ -32,6 +33,8 @@ public class ProcdefinitionBusinessImpl implements ProcdefinitionBusiness {
private procdefinitionDAO procdefinitionDAO; private procdefinitionDAO procdefinitionDAO;
private formmodelsDAO formmodelsDAO; private formmodelsDAO formmodelsDAO;
private formfieldDAO formfieldDAO;
private RepositoryService repositoryService; private RepositoryService repositoryService;
...@@ -53,8 +56,14 @@ public class ProcdefinitionBusinessImpl implements ProcdefinitionBusiness { ...@@ -53,8 +56,14 @@ public class ProcdefinitionBusinessImpl implements ProcdefinitionBusiness {
this.procdefinitionDAO = procdefinitionDAO; this.procdefinitionDAO = procdefinitionDAO;
} }
public formfieldDAO getFormfieldDAO() {
return formfieldDAO;
}
public void setFormfieldDAO(formfieldDAO formfieldDAO) {
this.formfieldDAO = formfieldDAO;
}
public RepositoryService getRepositoryService() { public RepositoryService getRepositoryService() {
return repositoryService; return repositoryService;
...@@ -307,4 +316,16 @@ public class ProcdefinitionBusinessImpl implements ProcdefinitionBusiness { ...@@ -307,4 +316,16 @@ public class ProcdefinitionBusinessImpl implements ProcdefinitionBusiness {
} }
return 1; 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 @@ ...@@ -6,6 +6,9 @@
<if test="UUID != null and UUID != ''"> <if test="UUID != null and UUID != ''">
and f.UUID = #{UUID} and f.UUID = #{UUID}
</if> </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 != ''"> <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>
......
...@@ -77,11 +77,11 @@ public class ProctaskBusinessImpl implements ProctaskBusiness { ...@@ -77,11 +77,11 @@ public class ProctaskBusinessImpl implements ProctaskBusiness {
Page<Map<String, Object>> page = new Page<Map<String, Object>>(); Page<Map<String, Object>> page = new Page<Map<String, Object>>();
// 计算起始记录 // 计算起始记录
int pageStart = (pageNo - 1) * pageSize; int pageStart = (pageNo - 1) * pageSize;
TaskQuery taskQuery=taskService.createTaskQuery().taskAssignee(SessionUtil.getCode()); TaskQuery taskQuery=taskService.createTaskQuery().taskCandidateUser(SessionUtil.getCode());
page.setStart(pageStart); page.setStart(pageStart);
page.setLimit(pageSize); page.setLimit(pageSize);
page.setCount((int)taskQuery.count()); 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<Map<String,Object>> items=new ArrayList<Map<String,Object>>();
List<String> listInstanceId=new ArrayList<String>(); List<String> listInstanceId=new ArrayList<String>();
for(Task task:list){ for(Task task:list){
...@@ -89,6 +89,7 @@ public class ProctaskBusinessImpl implements ProctaskBusiness { ...@@ -89,6 +89,7 @@ public class ProctaskBusinessImpl implements ProctaskBusiness {
items.add(map); items.add(map);
map.put("CREATE_TIME", task.getCreateTime()); map.put("CREATE_TIME", task.getCreateTime());
map.put("EXECUTION_ID", task.getExecutionId()); map.put("EXECUTION_ID", task.getExecutionId());
map.put("TASK_ID", task.getId());
listInstanceId.add(task.getExecutionId()); listInstanceId.add(task.getExecutionId());
} }
...@@ -169,6 +170,15 @@ public class ProctaskBusinessImpl implements ProctaskBusiness { ...@@ -169,6 +170,15 @@ public class ProctaskBusinessImpl implements ProctaskBusiness {
return entity; 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) { 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) {
......
...@@ -236,4 +236,29 @@ public class dataAction extends BasicAction{ ...@@ -236,4 +236,29 @@ public class dataAction extends BasicAction{
return "json"; 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{ ...@@ -40,6 +40,7 @@ public class actAction extends BasicAction{
entity = QueryParamUtil.StringToDate(entity); entity = QueryParamUtil.StringToDate(entity);
//去除不要更新的字段 //去除不要更新的字段
entity.remove("OPETYPE"); entity.remove("OPETYPE");
entity.remove("TASK_ID_SYSTEM");
//新增 //新增
Map<String,Object> procinstance=business.update(entity); Map<String,Object> procinstance=business.update(entity);
// 操作日志 // 操作日志
...@@ -56,4 +57,31 @@ public class actAction extends BasicAction{ ...@@ -56,4 +57,31 @@ public class actAction extends BasicAction{
} }
return "json"; 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