Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jfV5lcyq
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
管理员
jfV5lcyq
Commits
952dcef5
Commit
952dcef5
authored
Jul 21, 2018
by
罗绍泽
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
流程实例详情实现,考虑后期加一个环节可处理人列表,就是配置环节的时候的人员列表,但是activiti中暂时没有找到可以获取的方法
parent
539975bc
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
398 additions
and
183 deletions
+398
-183
business-process.xml
WebContent/WEB-INF/conf/gaowj/bl/business-process.xml
+1
-0
common_luosz_util.js
WebContent/jwapp/common/js/common_luosz_util.js
+24
-0
procdefiChoosePeopleTab.js
...rocess/pages/procdefinition/js/procdefiChoosePeopleTab.js
+1
-1
procdefinitionTab.js
...tent/process/pages/procdefinition/js/procdefinitionTab.js
+2
-2
procinstanceTab.js
WebContent/process/pages/procinstance/js/procinstanceTab.js
+60
-1
procinstanceTabHistory.jsp
...ent/process/pages/procinstance/procinstanceTabHistory.jsp
+8
-0
proctaskModule.js
WebContent/process/pages/proctask/js/proctaskModule.js
+2
-0
proctaskTab.js
WebContent/process/pages/proctask/js/proctaskTab.js
+2
-1
AssignmentTaskListener.java
...s/com/gaowj/activiti/listener/AssignmentTaskListener.java
+19
-34
AssignmentTaskListenerComplete.java
...owj/activiti/listener/AssignmentTaskListenerComplete.java
+26
-0
ProcinstanceBusiness.java
src_process/com/gaowj/business/ProcinstanceBusiness.java
+10
-0
ProctaskBusiness.java
src_process/com/gaowj/business/ProctaskBusiness.java
+2
-0
ProcdefinitionmodelsBusinessImpl.java
...rocdefinitionmodels/ProcdefinitionmodelsBusinessImpl.java
+3
-0
ProcinstanceBusinessImpl.java
...gaowj/business/procinstance/ProcinstanceBusinessImpl.java
+56
-27
ProctaskBusinessImpl.java
...ess/com/gaowj/business/proctask/ProctaskBusinessImpl.java
+133
-117
dataAction.java
src_process/com/gaowj/procinstance/action/dataAction.java
+21
-0
viewAction.java
src_process/com/gaowj/procinstance/action/viewAction.java
+5
-0
actAction.java
src_process/com/gaowj/proctask/action/actAction.java
+15
-0
SystemBackDAO.xml
src_system/com/gaowj/business/system/SystemBackDAO.xml
+8
-0
No files found.
WebContent/WEB-INF/conf/gaowj/bl/business-process.xml
View file @
952dcef5
...
...
@@ -102,6 +102,7 @@
<property
name=
"taskService"
ref=
"taskService"
></property>
<property
name=
"historyService"
ref=
"historyService"
></property>
<property
name=
"repositoryService"
ref=
"repositoryService"
></property>
<property
name=
"systemBackDAO"
ref=
"systemBackDAO"
></property>
</bean>
<bean
id=
"ProcdefinitionInitLinkBusiness"
class=
"com.gaowj.business.procdefinitionInitlink.ProcdefinitionInitLinkBusinessImpl"
>
...
...
WebContent/jwapp/common/js/common_luosz_util.js
View file @
952dcef5
...
...
@@ -304,6 +304,12 @@ function openProcEditRow(editUrl,is_row,is_title,is_max,is_width,is_height,is_le
saveBox
(
'detail'
,
'list'
);
}
},
{
text
:
'退回'
,
iconCls
:
'icon-ext-44_08'
,
handler
:
function
()
{
lastBox
(
'detail'
,
'list'
);
}
},
{
text
:
'下一步'
,
iconCls
:
'icon-ext-44_08'
,
handler
:
function
()
{
...
...
@@ -327,6 +333,24 @@ function openProcEditRow(editUrl,is_row,is_title,is_max,is_width,is_height,is_le
}
/****/
//弹出层流程编辑上一步(退回)按扭
function
lastBox
(
Box_id
,
List_id
)
{
if
(
Box_id
==
null
||
Box_id
==
''
||
Box_id
==
undefined
)
Box_id
=
'detail'
;
if
(
List_id
==
null
||
List_id
==
''
||
List_id
==
undefined
)
List_id
=
'list'
;
var
returnIsValid
=
$
(
'#inputForm'
).
form
(
'validate'
);
if
(
returnIsValid
)
{
//$("#inputForm").submit();
var
query
=
$
(
"#inputForm"
).
getFormVal
();
var
v_result
=
backProc
(
query
);
if
(
v_result
!=
null
&&
v_result
!=
undefined
)
{
closeBox
(
Box_id
);
$
.
messager
.
alert
(
'提示'
,
v_result
.
VALUE
);
}
}
}
//弹出层流程编辑下一步按扭
function
nextBox
(
Box_id
,
List_id
)
{
if
(
Box_id
==
null
||
Box_id
==
''
||
Box_id
==
undefined
)
...
...
WebContent/process/pages/procdefinition/js/procdefiChoosePeopleTab.js
View file @
952dcef5
...
...
@@ -29,7 +29,7 @@ var ls_module_id='2';
var
ls_ywlx
=
'YBYW'
;
//定义grid列表
var
ls_title
=
"选择人员"
;
var
ls_title
=
null
;
var
is_column
=
[
[
{
field
:
'LINK_NAME'
,
title
:
'环节名'
,
width
:
300
,
align
:
'center'
},
{
field
:
'PROC_DEFIN_KEY'
,
title
:
'PROC_DEFIN_KEY'
,
width
:
300
,
align
:
'center'
}
...
...
WebContent/process/pages/procdefinition/js/procdefinitionTab.js
View file @
952dcef5
...
...
@@ -412,7 +412,7 @@ function procdefinitionImg(index){
width
:
1000
,
height
:
500
,
title
:
'流程图'
,
content
:
'<
img src="procdefinitionData_showProcdefinitionImg?deploymentId='
+
is_row
[
0
].
DEPLOYMENT_ID
+
'" /
>'
content
:
'<
div style="height:100%;overflow:auto;"><img src="procdefinitionData_showProcdefinitionImg?deploymentId='
+
is_row
[
0
].
DEPLOYMENT_ID
+
'" /></div
>'
});
}
...
...
@@ -430,5 +430,5 @@ function choosePeopleRow(index){
success
:
function
(
data
){
}
});
openViewIframRow
(
"choosePeople"
,
"procdefinitionView_procdefiChoosePeopleTab?DEPLOYMENT_ID="
+
is_row
[
0
].
DEPLOYMENT_ID
,
is_row
[
0
],
"
选人列表
"
,
true
,
0.95
,
0.95
,
0
,
0
);
openViewIframRow
(
"choosePeople"
,
"procdefinitionView_procdefiChoosePeopleTab?DEPLOYMENT_ID="
+
is_row
[
0
].
DEPLOYMENT_ID
,
is_row
[
0
],
"
环节配置
"
,
true
,
0.95
,
0.95
,
0
,
0
);
}
WebContent/process/pages/procinstance/js/procinstanceTab.js
View file @
952dcef5
...
...
@@ -541,6 +541,64 @@ function showProcinstanceImg(index) {
width
:
1000
,
height
:
500
,
title
:
'流程图'
,
content
:
'<img src="procinstanceData_showProcinstanceImg?instanceId='
+
is_row
[
0
].
INSTANCE_ID
+
'" />'
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
;
}
}
});
}
});
}
//流程退回
function
backProc
(
is_entity
){
var
v_result
=
proctaskModule
.
act
.
back
(
is_entity
);
$
(
'#list'
).
datagrid
(
'reload'
);
return
v_result
;
}
\ No newline at end of file
WebContent/process/pages/procinstance/procinstanceTabHistory.jsp
0 → 100644
View file @
952dcef5
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<div style="overflow:auto;height:100%;">
<div style="overflow:auto;">
<img src="procinstanceData_showProcinstanceImg?instanceId=${instanceId}" />
</div>
<input type="hidden" id="instanceIdHide" value="${instanceId}" />
<div id="historyTable"></div>
</div>
WebContent/process/pages/proctask/js/proctaskModule.js
View file @
952dcef5
...
...
@@ -16,6 +16,8 @@ proctaskModule.prototype.updateInfo = function(){};
proctaskModule
.
prototype
.
updateInfoToNext
=
function
(){};
//删除流程实例
proctaskModule
.
prototype
.
deleteInfo
=
function
(){};
//退回流程实例
proctaskModule
.
prototype
.
back
=
function
(){};
//创建一个数据操作对象,然后再后续使用
proctaskModule
.
act
=
new
proctaskModule
(
"json"
).
delegate
(
"proctaskAct"
);
...
...
WebContent/process/pages/proctask/js/proctaskTab.js
View file @
952dcef5
...
...
@@ -438,6 +438,6 @@ function showProcinstanceImg(index) {
width
:
1000
,
height
:
500
,
title
:
'流程图'
,
content
:
'<
img src="procinstanceData_showProcinstanceImg?instanceId='
+
is_row
[
0
].
INSTANCE_ID
+
'" /
>'
content
:
'<
div style="height:100%;overflow:auto;"><img src="procinstanceData_showProcinstanceImg?instanceId='
+
is_row
[
0
].
INSTANCE_ID
+
'" /></div
>'
});
}
\ No newline at end of file
src_process/com/gaowj/activiti/listener/AssignmentTaskListener.java
View file @
952dcef5
...
...
@@ -18,6 +18,12 @@ import com.gaowj.business.ProcinstanceBusiness;
import
com.gaowj.business.comp.BusinessManager
;
import
com.gaowj.business.util.SessionUtil
;
/**
* 流程任务新建时,设置该任务在数据库存储的人员列表
*
* @author luosz
*
*/
public
class
AssignmentTaskListener
implements
TaskListener
{
/**
...
...
@@ -28,49 +34,28 @@ public class AssignmentTaskListener implements TaskListener {
@Override
public
void
notify
(
DelegateTask
task
)
{
ApplicationContext
context
=
ContextLoaderListener
.
getCurrentWebApplicationContext
();
HistoryService
historyService
=
(
HistoryService
)
context
.
getBean
(
"historyService"
);
HistoryService
historyService
=
(
HistoryService
)
context
.
getBean
(
"historyService"
);
// 获取流程历史中已执行节点,并按照节点在流程中执行先后顺序排序
List
<
HistoricActivityInstance
>
historicActivityInstanceList
=
historyService
.
createHistoricActivityInstanceQuery
().
processInstanceId
(
task
.
getProcessInstanceId
()).
orderByHistoricActivityInstanceId
().
asc
().
list
();
System
.
out
.
println
(
"历史环节数量:"
+
historicActivityInstanceList
.
size
());
if
(
historicActivityInstanceList
.
size
()==
0
){
//如果历史环节数量为0,则表示这个实例第一次启动,第一个环节默认为当前登陆人
//task.setAssignee(SessionUtil.getCode());
List
<
String
>
listUserId
=
new
ArrayList
<
String
>();
if
(
historicActivityInstanceList
.
size
()
==
0
)
{
// 如果历史环节数量为0,则表示这个实例第一次启动,第一个环节默认为当前登陆人
// 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
>();
}
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
)
{
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.getCategory());
System.out.println(task.getDescription());
System.out.println(task.getEventName());
System.out.println(task.getExecutionId());
System.out.println(task.getFormKey());
System.out.println(task.getId());
System.out.println(task.getName());
System.out.println(task.getOwner());
System.out.println(task.getPriority());
System.out.println(task.getProcessDefinitionId());
System.out.println(task.getProcessInstanceId());
System.out.println(task.getTaskDefinitionKey());
System.out.println(task.getTenantId());
System.out.println(task.getVariables().toString());*/
//
}
}
src_process/com/gaowj/activiti/listener/AssignmentTaskListenerComplete.java
0 → 100644
View file @
952dcef5
package
com
.
gaowj
.
activiti
.
listener
;
import
org.activiti.engine.delegate.DelegateTask
;
import
org.activiti.engine.delegate.TaskListener
;
import
com.gaowj.business.util.SessionUtil
;
/**
* 任务完成时,设置实际的办理人为当前登录人
*
* @author luosz
*
*/
public
class
AssignmentTaskListenerComplete
implements
TaskListener
{
/**
*
*/
private
static
final
long
serialVersionUID
=
1L
;
@Override
public
void
notify
(
DelegateTask
task
)
{
task
.
setAssignee
(
SessionUtil
.
getCode
());
}
}
src_process/com/gaowj/business/ProcinstanceBusiness.java
View file @
952dcef5
...
...
@@ -58,6 +58,16 @@ public interface ProcinstanceBusiness {
* @throws BusinessException
*/
Page
<
Map
<
String
,
Object
>>
list_proc_instance
(
int
pageNo
,
int
pageSize
,
Map
<
String
,
Object
>
query
)
throws
BusinessException
;
/**
* 获取历史任务列表
* @param pageNo
* @param pageSize
* @param query
* @return
* @throws BusinessException
*/
List
<
Map
<
String
,
Object
>>
list_proc_instance_history
(
String
processInstanceId
)
throws
BusinessException
;
/**
* 获取所有记录
...
...
src_process/com/gaowj/business/ProctaskBusiness.java
View file @
952dcef5
...
...
@@ -22,4 +22,6 @@ public interface ProctaskBusiness {
Map
<
String
,
Object
>
update
(
Map
<
String
,
Object
>
entity
)
throws
BusinessException
;
Map
<
String
,
Object
>
updateToNext
(
String
taskId
,
Map
<
String
,
Object
>
entity
)
throws
BusinessException
;
Map
<
String
,
Object
>
back
(
Map
<
String
,
Object
>
entity
)
throws
BusinessException
;
}
src_process/com/gaowj/business/procdefinitionmodels/ProcdefinitionmodelsBusinessImpl.java
View file @
952dcef5
...
...
@@ -270,6 +270,9 @@ public class ProcdefinitionmodelsBusinessImpl implements ProcdefinitionmodelsBus
Element
taskListener
=
extensionElements
.
addElement
(
"activiti:taskListener"
);
taskListener
.
addAttribute
(
"event"
,
"create"
);
taskListener
.
addAttribute
(
"class"
,
"com.gaowj.activiti.listener.AssignmentTaskListener"
);
Element
taskListenerComplete
=
extensionElements
.
addElement
(
"activiti:taskListener"
);
taskListenerComplete
.
addAttribute
(
"event"
,
"complete"
);
taskListenerComplete
.
addAttribute
(
"class"
,
"com.gaowj.activiti.listener.AssignmentTaskListenerComplete"
);
}
}
bpmText
=
doc
.
asXML
();
...
...
src_process/com/gaowj/business/procinstance/ProcinstanceBusinessImpl.java
View file @
952dcef5
...
...
@@ -21,6 +21,7 @@ import org.activiti.engine.RuntimeService;
import
org.activiti.engine.TaskService
;
import
org.activiti.engine.history.HistoricActivityInstance
;
import
org.activiti.engine.history.HistoricProcessInstance
;
import
org.activiti.engine.history.HistoricTaskInstance
;
import
org.activiti.engine.repository.ProcessDefinition
;
import
org.activiti.engine.runtime.ProcessInstance
;
import
org.activiti.engine.task.Task
;
...
...
@@ -31,6 +32,7 @@ import com.gaowj.business.ProcinstanceBusiness;
import
com.gaowj.business.exception.BusinessException
;
import
com.gaowj.business.formtable.formtableDAO
;
import
com.gaowj.business.procdefinition.procdefinitionDAO
;
import
com.gaowj.business.system.SystemBackDAO
;
import
com.gaowj.business.util.Page
;
import
com.gaowj.business.util.SessionUtil
;
...
...
@@ -49,6 +51,8 @@ public class ProcinstanceBusinessImpl implements ProcinstanceBusiness {
private
HistoryService
historyService
;
private
RepositoryService
repositoryService
;
private
SystemBackDAO
systemBackDAO
;
public
RuntimeService
getRuntimeService
()
{
return
runtimeService
;
...
...
@@ -107,6 +111,14 @@ public class ProcinstanceBusinessImpl implements ProcinstanceBusiness {
this
.
repositoryService
=
repositoryService
;
}
public
SystemBackDAO
getSystemBackDAO
()
{
return
systemBackDAO
;
}
public
void
setSystemBackDAO
(
SystemBackDAO
systemBackDAO
)
{
this
.
systemBackDAO
=
systemBackDAO
;
}
@Override
public
Map
<
String
,
Object
>
insert_proc_instance
(
Map
<
String
,
Object
>
entity
)
throws
BusinessException
{
//流程定义id
...
...
@@ -443,36 +455,53 @@ public class ProcinstanceBusinessImpl implements ProcinstanceBusiness {
page
.
setItems
(
items
);
return
page
;
/*// 计算起始记录
int pageStart = (pageNo - 1) * pageSize;
ProcessInstanceQuery leaveDynamicQuery = runtimeService.createProcessInstanceQuery()
.orderByProcessInstanceId().desc().active();
if(query.get("PROCDEFINITION_UUID")!=null&&!"".equals(query.get("PROCDEFINITION_UUID"))){
Map<String, Object> query2=new HashMap<String, Object>();
query2.put("UUID", query.get("PROCDEFINITION_UUID"));
String deploymentKey=procdefinitionDAO.list_procde_finition(query2).get(0).get("DEPLOYMENT_KEY").toString();
if(deploymentKey!=null&&!"".equals(deploymentKey)){
leaveDynamicQuery.processDefinitionKey(deploymentKey);
}
@Override
public
List
<
Map
<
String
,
Object
>>
list_proc_instance_history
(
String
processInstanceId
)
throws
BusinessException
{
List
<
HistoricActivityInstance
>
listHistoricActivityInstance
=
historyService
// 历史相关Service
.
createHistoricActivityInstanceQuery
()
// 创建历史活动实例查询
.
processInstanceId
(
processInstanceId
)
// 执行流程实例id
//.finished()
.
orderByHistoricActivityInstanceStartTime
().
asc
().
list
();
List
<
Map
<
String
,
Object
>>
list
=
new
ArrayList
<
Map
<
String
,
Object
>>();
List
<
String
>
listAssignee
=
new
ArrayList
<
String
>();
for
(
HistoricActivityInstance
hai
:
listHistoricActivityInstance
)
{
if
(
hai
.
getActivityName
()==
null
){
continue
;
}
if
(
hai
.
getAssignee
()==
null
&&
hai
.
getEndTime
()!=
null
){
//如果没有办理人,但是有结束时间,任务该环节是开始环节,默认剔除
continue
;
}
if
(
hai
.
getAssignee
()!=
null
){
listAssignee
.
add
(
hai
.
getAssignee
());
}
Map
<
String
,
Object
>
entry
=
new
HashMap
<
String
,
Object
>();
entry
.
put
(
"ACTIVITY_NAME"
,
hai
.
getActivityName
());
entry
.
put
(
"ASSIGNEE"
,
hai
.
getAssignee
()==
null
?
""
:
hai
.
getAssignee
());
entry
.
put
(
"START_TIME"
,
hai
.
getStartTime
());
entry
.
put
(
"END_TIME"
,
hai
.
getEndTime
()==
null
?
""
:
hai
.
getEndTime
());
list
.
add
(
entry
);
}
List<ProcessInstance> list = leaveDynamicQuery.listPage(pageStart, pageSize);
List<Map<String, Object>> items=new ArrayList<Map<String,Object>>();
for(ProcessInstance processInstance:list){
Map<String, Object> item=new HashMap<String, Object>();
items.add(item);
item.put("NAME", processInstance.getName());
Map
<
String
,
Object
>
query
=
new
HashMap
<
String
,
Object
>();
query
.
put
(
"CODE_IN"
,
listAssignee
);
List
<
Map
<
String
,
Object
>>
items
=
systemBackDAO
.
listLoginUserInfo
(
query
);
outer:
for
(
Map
<
String
,
Object
>
m:
list
){
for
(
Map
<
String
,
Object
>
user:
items
){
if
(
m
.
get
(
"ASSIGNEE"
)!=
null
&&!
""
.
equals
(
m
.
get
(
"ASSIGNEE"
))){
if
(
m
.
get
(
"ASSIGNEE"
).
equals
(
user
.
get
(
"CODE"
))){
m
.
put
(
"ASSIGNEE"
,
user
.
get
(
"EMNAME"
));
continue
outer
;
}
}
}
}
int count=(int) leaveDynamicQuery.count();
// 创建分页对象
Page<Map<String, Object>> page = new Page<Map<String, Object>>();
page.setStart(pageStart);
page.setLimit(pageSize);
page.setCount(count);
page.setItems(items);
return page;*/
return
list
;
}
@Override
...
...
src_process/com/gaowj/business/proctask/ProctaskBusinessImpl.java
View file @
952dcef5
...
...
@@ -24,15 +24,15 @@ import com.gaowj.business.util.SessionUtil;
public
class
ProctaskBusinessImpl
implements
ProctaskBusiness
{
private
TaskService
taskService
;
private
RuntimeService
runtimeService
;
private
procinstanceDAO
procinstanceDAO
;
private
procdefinitionDAO
procdefinitionDAO
;
private
formmodelsDAO
formmodelsDAO
;
private
formtableDAO
formtableDAO
;
public
RuntimeService
getRuntimeService
()
{
...
...
@@ -88,55 +88,60 @@ public class ProctaskBusinessImpl implements ProctaskBusiness {
Page
<
Map
<
String
,
Object
>>
page
=
new
Page
<
Map
<
String
,
Object
>>();
// 计算起始记录
int
pageStart
=
(
pageNo
-
1
)
*
pageSize
;
TaskQuery
taskQuery
=
taskService
.
createTaskQuery
().
taskCandidateUser
(
SessionUtil
.
getCode
());
TaskQuery
taskQuery
=
taskService
.
createTaskQuery
().
taskCandidateUser
(
SessionUtil
.
getCode
());
page
.
setStart
(
pageStart
);
page
.
setLimit
(
pageSize
);
page
.
setCount
((
int
)
taskQuery
.
count
());
page
.
setCount
((
int
)
taskQuery
.
count
());
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
){
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>();
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
());
}
Map
<
String
,
Object
>
query2
=
new
HashMap
<
String
,
Object
>();
query2
.
put
(
"INSTANCE_ID_IN"
,
listInstanceId
);
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
>>();
List
<
Map
<
String
,
Object
>>
items
=
new
ArrayList
<
Map
<
String
,
Object
>>();
List
<
String
>
listInstanceId
=
new
ArrayList
<
String
>();
List
<
Map
<
String
,
Object
>>
listInstance
=
null
;
if
(
list
.
size
()
>
0
)
{
for
(
Task
task
:
list
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>();
items
.
add
(
map
);
map
.
put
(
"CREATE_TIME"
,
task
.
getCreateTime
());
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
.
getProcessInstanceId
());
}
Map
<
String
,
Object
>
query2
=
new
HashMap
<
String
,
Object
>();
query2
.
put
(
"INSTANCE_ID_IN"
,
listInstanceId
);
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
);
}
}
else
{
listInstance
=
procinstanceDAO
.
list_proc_instance_all
(
query2
);
}
outer:
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
;
outer:
for
(
Map
<
String
,
Object
>
instance
:
listInstance
)
{
for
(
Map
<
String
,
Object
>
map
:
items
)
{
if
(
map
.
get
(
"PROCESS_INSTANCE_ID"
).
equals
(
instance
.
get
(
"INSTANCE_ID"
)))
{
instance
.
putAll
(
map
);
continue
outer
;
}
}
}
}
else
{
//如果activit中没有任务,则new一个空的list
listInstance
=
new
ArrayList
<
Map
<
String
,
Object
>>();
}
page
.
setItems
(
listInstance
);
return
page
;
...
...
@@ -144,23 +149,23 @@ public class ProctaskBusinessImpl implements ProctaskBusiness {
@Override
public
Map
<
String
,
Object
>
data_info
(
String
businessId
)
throws
BusinessException
{
Map
<
String
,
Object
>
info
=
new
HashMap
<
String
,
Object
>();
Map
<
String
,
Object
>
query
=
new
HashMap
<
String
,
Object
>();
Map
<
String
,
Object
>
info
=
new
HashMap
<
String
,
Object
>();
Map
<
String
,
Object
>
query
=
new
HashMap
<
String
,
Object
>();
query
.
put
(
"BUSINESS_ID"
,
businessId
);
List
<
Map
<
String
,
Object
>>
listProcinstance
=
procinstanceDAO
.
list_proc_instance_all
(
query
);
if
(
listProcinstance
.
size
()>
0
)
{
Map
<
String
,
Object
>
procinstance
=
listProcinstance
.
get
(
0
);
//流程定义id
String
procDefinitionId
=
procinstance
.
get
(
"PROC_DEFINITION_ID"
).
toString
();
//表单模板id
String
formModelId
=
procinstance
.
get
(
"FORM_MODEL_ID"
).
toString
();
//根据表单模板id获取模板
Map
<
String
,
Object
>
formModel
=
getFormModelById
(
formModelId
);
//根据流程定义id获取存储业务数据的表
String
tableName
=
getBusinessTableNameByProcDefinitionId
(
procDefinitionId
);
//根据业务数据的表名和业务id,查询业务数据
Map
<
String
,
Object
>
businessData
=
getBusinessDataByBusinessTableAndBusinessId
(
tableName
,
businessId
);
//填充返回数据
List
<
Map
<
String
,
Object
>>
listProcinstance
=
procinstanceDAO
.
list_proc_instance_all
(
query
);
if
(
listProcinstance
.
size
()
>
0
)
{
Map
<
String
,
Object
>
procinstance
=
listProcinstance
.
get
(
0
);
//
流程定义id
String
procDefinitionId
=
procinstance
.
get
(
"PROC_DEFINITION_ID"
).
toString
();
//
表单模板id
String
formModelId
=
procinstance
.
get
(
"FORM_MODEL_ID"
).
toString
();
//
根据表单模板id获取模板
Map
<
String
,
Object
>
formModel
=
getFormModelById
(
formModelId
);
//
根据流程定义id获取存储业务数据的表
String
tableName
=
getBusinessTableNameByProcDefinitionId
(
procDefinitionId
);
//
根据业务数据的表名和业务id,查询业务数据
Map
<
String
,
Object
>
businessData
=
getBusinessDataByBusinessTableAndBusinessId
(
tableName
,
businessId
);
//
填充返回数据
info
.
put
(
"FORM_MODEL"
,
formModel
);
info
.
put
(
"BUSINESS_DATA"
,
businessData
);
}
...
...
@@ -168,24 +173,25 @@ public class ProctaskBusinessImpl implements ProctaskBusiness {
}
private
Map
<
String
,
Object
>
getFormModelById
(
String
uuid
)
{
Map
<
String
,
Object
>
query
=
new
HashMap
<
String
,
Object
>();
Map
<
String
,
Object
>
query
=
new
HashMap
<
String
,
Object
>();
query
.
put
(
"UUID"
,
uuid
);
return
formmodelsDAO
.
list_form_models
(
query
).
get
(
0
);
}
/**
* 根据流程定义id获取业务数据表的表名
*
* @param procDefinitionId
* @return
*/
private
String
getBusinessTableNameByProcDefinitionId
(
String
procDefinitionId
){
Map
<
String
,
Object
>
query
=
new
HashMap
<
String
,
Object
>();
private
String
getBusinessTableNameByProcDefinitionId
(
String
procDefinitionId
)
{
Map
<
String
,
Object
>
query
=
new
HashMap
<
String
,
Object
>();
query
.
put
(
"UUID"
,
procDefinitionId
);
return
procdefinitionDAO
.
list_procde_finition
(
query
).
get
(
0
).
get
(
"TABLE_NAME"
).
toString
();
}
private
Map
<
String
,
Object
>
getBusinessDataByBusinessTableAndBusinessId
(
String
tableName
,
String
uuid
)
{
Map
<
String
,
Object
>
query
=
new
HashMap
<
String
,
Object
>();
private
Map
<
String
,
Object
>
getBusinessDataByBusinessTableAndBusinessId
(
String
tableName
,
String
uuid
)
{
Map
<
String
,
Object
>
query
=
new
HashMap
<
String
,
Object
>();
query
.
put
(
"UUID"
,
uuid
);
query
.
put
(
"tableName"
,
tableName
);
return
procinstanceDAO
.
list_proc_instance
(
query
).
get
(
0
);
...
...
@@ -193,48 +199,61 @@ 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
);
//
存储自定义表单的业务数据
update_custom_business
(
entity
.
get
(
"TABLE_ID_SYSTEM"
).
toString
(),
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
);
//通过任务id获取流程id
String
processInstanceId
=
taskService
.
createTaskQuery
().
taskId
(
taskId
).
singleResult
().
getProcessInstanceId
();
//完成当前任务
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
>();
//
判断当前流程是否结束
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
>();
//
先获取实例表的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对实例表的状态进行更新
//
通过实例表的uuid对实例表的状态进行更新
update_proc_instance
(
procinstance
);
}
return
entity
;
}
@Override
public
Map
<
String
,
Object
>
back
(
Map
<
String
,
Object
>
entity
)
throws
BusinessException
{
// 存储自定义表单的业务数据
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
);
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
>>();
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
))
{
for
(
String
str
:
key
)
{
if
(
"UUID"
.
equals
(
str
))
{
continue
;
}
Map
<
String
,
Object
>
colum
=
new
HashMap
<
String
,
Object
>();
Map
<
String
,
Object
>
colum
=
new
HashMap
<
String
,
Object
>();
colum
.
put
(
"key"
,
str
);
colum
.
put
(
"value"
,
entity
.
get
(
str
));
info
.
add
(
colum
);
...
...
@@ -243,8 +262,8 @@ public class ProctaskBusinessImpl implements ProctaskBusiness {
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"
);
if
(
entity
.
get
(
"UUID"
)
==
null
)
{
entity
.
put
(
"UUID"
,
java
.
util
.
UUID
.
randomUUID
().
toString
());
...
...
@@ -261,40 +280,37 @@ public class ProctaskBusinessImpl implements ProctaskBusiness {
if
(
entity
.
get
(
"UPDATE_TIME"
)
==
null
)
{
entity
.
put
(
"UPDATE_TIME"
,
new
Date
());
}
Map
<
String
,
Object
>
query
=
new
HashMap
<
String
,
Object
>();
Map
<
String
,
Object
>
query
=
new
HashMap
<
String
,
Object
>();
query
.
put
(
"UUID"
,
tableId
);
// 动态传值插入
List
<
Map
<
String
,
Object
>>
infoList
=
new
ArrayList
<
Map
<
String
,
Object
>>();
//List<String> infoListKey = new ArrayList<String>();
List
<
Map
<
String
,
Object
>>
infoList
=
new
ArrayList
<
Map
<
String
,
Object
>>();
//
List<String> infoListKey = new ArrayList<String>();
if
(
entity
.
keySet
()
!=
null
)
{
Set
<
String
>
key
=
entity
.
keySet
();
// 将map集合中的key和value 取出来分别放到list集合里
for
(
String
str
:
key
)
{
//UUID不需要加进去
if
(
"UUID"
.
equals
(
str
))
{
//
UUID不需要加进去
if
(
"UUID"
.
equals
(
str
))
{
continue
;
}
Map
<
String
,
Object
>
kv
=
new
HashMap
<
String
,
Object
>();
kv
.
put
(
"value"
,
entity
.
get
(
str
));
kv
.
put
(
"key"
,
str
);
Map
<
String
,
Object
>
kv
=
new
HashMap
<
String
,
Object
>();
kv
.
put
(
"value"
,
entity
.
get
(
str
));
kv
.
put
(
"key"
,
str
);
infoList
.
add
(
kv
);
}
entity
.
put
(
"infoList"
,
infoList
);
}
/*List<Object> infoList = new ArrayList<Object>();
if (entity.keySet() != null) {
Set<String> key = entity.keySet();
// 将map集合中的key和value 取出来分别放到list集合里
for (String str : key) {
infoList.add(entity.get(str));
infoListKey.add(str);
}
entity.put("infoListKey", infoListKey);
entity.put("infoList", infoList);
}*/
//设置表名
String
tableName
=
formtableDAO
.
list_form_table
(
query
).
get
(
0
).
get
(
"TABLE_NAME"
).
toString
();
/*
* List<Object> infoList = new ArrayList<Object>(); if (entity.keySet()
* != null) { Set<String> key = entity.keySet(); // 将map集合中的key和value
* 取出来分别放到list集合里 for (String str : key) {
* infoList.add(entity.get(str)); infoListKey.add(str); }
* entity.put("infoListKey", infoListKey); entity.put("infoList",
* infoList); }
*/
// 设置表名
String
tableName
=
formtableDAO
.
list_form_table
(
query
).
get
(
0
).
get
(
"TABLE_NAME"
).
toString
();
entity
.
put
(
"tableName"
,
tableName
);
entity
.
put
(
"uuid"
,
entity
.
get
(
"UUID"
));
procdefinitionDAO
.
update_custom_business
(
entity
);
...
...
src_process/com/gaowj/procinstance/action/dataAction.java
View file @
952dcef5
...
...
@@ -6,6 +6,7 @@ import java.net.URLEncoder;
import
java.sql.SQLException
;
import
java.text.ParseException
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
com.gaowj.business.ProcdefinitionBusiness
;
...
...
@@ -103,4 +104,24 @@ public class dataAction extends BasicAction{
}
return
name
;
}
public
String
procinstanceHistory
()
throws
BusinessException
{
ProcinstanceBusiness
business
=
BusinessManager
.
getBusiness
(
ProcinstanceBusiness
.
class
);
try
{
List
<
Map
<
String
,
Object
>>
listRows
=
business
.
list_proc_instance_history
(
RequestUtils
.
getString
(
request
,
"processInstanceId"
));
Map
<
String
,
Object
>
data
=
new
HashMap
<
String
,
Object
>();
data
.
put
(
"rowSet"
,
QueryParamUtil
.
DateTimeToString
(
listRows
));
data
.
put
(
"pageNo"
,
pageNo
);
data
.
put
(
"pageSize"
,
pageSize
);
data
.
put
(
"pageCount"
,
pageCount
);
data
.
put
(
"rows"
,
data
.
get
(
"rowSet"
));
data
.
put
(
"total"
,
listRows
.
size
());
jsonObject
=
new
JSONObject
();
jsonObject
.
putAll
(
data
);
}
catch
(
Exception
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
}
return
"json"
;
}
}
src_process/com/gaowj/procinstance/action/viewAction.java
View file @
952dcef5
...
...
@@ -28,5 +28,10 @@ public class viewAction extends BasicAction {
request
.
setAttribute
(
"is_row"
,
query
);
return
"procinstanceTabDetailEdit"
;
}
public
String
procinstanceTabHistory
()
throws
BusinessException
{
request
.
setAttribute
(
"instanceId"
,
RequestUtils
.
getString
(
request
,
"instanceId"
));
return
"procinstanceTabHistory"
;
}
}
src_process/com/gaowj/proctask/action/actAction.java
View file @
952dcef5
...
...
@@ -84,4 +84,19 @@ public class actAction extends BasicAction{
}
return
"json"
;
}
public
String
back
()
throws
BusinessException
{
ProctaskBusiness
business
=
BusinessManager
.
getBusiness
(
ProctaskBusiness
.
class
);
Map
<
String
,
Object
>
entity
=
RequestUtils
.
getUpdateFieldMap
(
request
,
RequestUtils
.
UPDATEDATAFIELDPREFIX
);
jsonObject
=
new
JSONObject
();
try
{
entity
=
QueryParamUtil
.
StringToDate
(
entity
);
//business.list_proc_task(pageNo, pageSize, query)
jsonObject
.
putAll
(
Status
.
getStatusSuccessMessage
(
"保存成功"
));
}
catch
(
Exception
e
)
{
jsonObject
.
putAll
(
Status
.
getStatusErrorMessage
(
"保存失败"
));
e
.
printStackTrace
();
}
return
"json"
;
}
}
src_system/com/gaowj/business/system/SystemBackDAO.xml
View file @
952dcef5
...
...
@@ -103,6 +103,14 @@
<if
test=
"EMID != null and EMID != ''"
>
and u.emid like CONCAT('%',#{EMID},'%')
</if>
<if
test=
"CODE_IN != null and CODE_IN != ''"
>
and u.code IN
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<foreach
collection=
"CODE_IN"
item=
"value"
>
#{value},
</foreach>
</trim>
</if>
<if
test=
"NAME != null and NAME != ''"
>
and u.emid in (select lu.emid from c_t_sys_loginuser lu where lu.emname like CONCAT('%',#{NAME},'%') or lu.emid like CONCAT('%',#{NAME},'%'))
</if>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment