Commit 4c888858 authored by shyWang's avatar shyWang

PDM前端改造

添加查询用户全部待办接口
parent 75fb0e4f
......@@ -2131,7 +2131,7 @@ public class WorkflowUtil implements RemoteAccess {
public static List<WorkItem> getUserWorks(WTUser wtUser)
throws WTException {
List<WorkItem> list = new ArrayList<WorkItem>();
Enumeration enumx = getUserUnDoTask(wtUser);
Enumeration enumx = getUserTask(wtUser);
if (enumx != null) {
while (enumx.hasMoreElements()) {
WorkItem workItem = (WorkItem) enumx.nextElement();
......@@ -2157,6 +2157,35 @@ public class WorkflowUtil implements RemoteAccess {
* @return
* @throws WTException
*/
public static List<WorkItem> getUserUndoWorks(WTUser wtUser)
throws WTException {
List<WorkItem> list = new ArrayList<WorkItem>();
Enumeration enumx = getUserUnDoTask(wtUser);
if (enumx != null) {
while (enumx.hasMoreElements()) {
WorkItem workItem = (WorkItem) enumx.nextElement();
list.add(workItem);
}
}
// 对workItem根据创建时间进行排序,最新时间的排列在前。
Collections.sort(list, new Comparator<WorkItem>() {
@Override
public int compare(WorkItem wt1, WorkItem wt2) {
Timestamp ts1 = wt1.getCreateTimestamp();
Timestamp ts2 = wt2.getCreateTimestamp();
return ts2.compareTo(ts1);
}
});
return list;
}
/**
* 获取未完成工作流任务
*
* @param wtUser
* @return
* @throws WTException
*/
public static Enumeration getUserUnDoTask(WTUser wtUser)
throws WTException {
Enumeration enumx = null;
......@@ -2168,6 +2197,24 @@ public class WorkflowUtil implements RemoteAccess {
return enumx;
}
/**
* 获取工作流任务
*
* @param wtUser
* @return
* @throws WTException
*/
public static Enumeration getUserTask(WTUser wtUser)
throws WTException {
Enumeration enumx = null;
if (ObjectsUtil.nonNull(wtUser)) {
enumx = WorkflowHelper.service.getWorkItems(wtUser);
} else {
enumx = WorkflowHelper.service.getWorkItems();
}
return enumx;
}
/**
* 判断流程活动是否已存在参与者
*
......
......@@ -51,6 +51,18 @@ public class WfcProcessController {
return todoTaskList;
}
@GetMapping({"/task/all"})
//@ApiOperation("查询待办任务列表")
public List<DxWfProcessTaskVO> getAllTaskList(@RequestParam("userName") String userName) {
List<DxWfProcessTaskVO> todoTaskList = new ArrayList<DxWfProcessTaskVO>();
try {
todoTaskList = WfcProcessService.getAllTaskList(userName);
} catch (Exception e) {
e.printStackTrace();
}
return todoTaskList;
}
@GetMapping({"/task/countOfType"})
public Map<String, Integer> getTaskTypeAndCount(@RequestParam("userName") String userName) {
Map<String, Integer> resultMap = new HashMap<String, Integer>();
......
......@@ -177,6 +177,34 @@ public class WfcProcessService implements RemoteAccess {
}
List<DxWfProcessTaskVO> taskVOList = new ArrayList<DxWfProcessTaskVO>();
SessionContext previous = SessionContext.newContext();
try {
SessionHelper.manager.setAdministrator();
WTUser user = WTUserUtil.getUser(userName);
List<WorkItem> userWorks = WorkflowUtil.getUserUndoWorks(user);
for (WorkItem userWork : userWorks) {
DxWfProcessTaskVO dxWfProcessTaskVO = new DxWfProcessTaskVO(userWork);
taskVOList.add(dxWfProcessTaskVO);
}
} finally {
SessionContext.setContext(previous);
}
return taskVOList;
}
/**
* 获取用户待办
* @param userName
* @return
* @throws Exception
*/
public static List<DxWfProcessTaskVO> getAllTaskList(String userName) throws Exception {
if (!RemoteMethodServer.ServerFlag) {
return (List<DxWfProcessTaskVO>)RemoteMethodServer.getDefault().invoke("getAllTaskList", WfcProcessService.class.getName(), null,
new Class[] { String.class},
new Object[] { userName });
}
List<DxWfProcessTaskVO> taskVOList = new ArrayList<DxWfProcessTaskVO>();
SessionContext previous = SessionContext.newContext();
try {
SessionHelper.manager.setAdministrator();
WTUser user = WTUserUtil.getUser(userName);
......
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