新增方法 /get_list_by_instance
已办流程中的汇总功能
This commit is contained in:
@@ -179,4 +179,103 @@ public class TaskController {
|
|||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
@ApiOperation(value = "流程实例汇总列表")
|
||||||
|
@ApiImplicitParam(name = "prcNum", value = "流程实例id")
|
||||||
|
@GetMapping("/get_gather_by_instance")
|
||||||
|
public List<Map<String, Object>> get_gather_by_instance(String prcNum,String sortWord,String shunxu) {
|
||||||
|
QueryWrapper queryWrapper = new QueryWrapper();
|
||||||
|
queryWrapper.eq("PRC_NUM",prcNum);
|
||||||
|
BusProcessName one = iBusProcessNameService.getOne(queryWrapper);
|
||||||
|
HistoricTaskInstanceQuery historicTaskInstanceQuery = historyService.createHistoricTaskInstanceQuery()
|
||||||
|
.processInstanceId(one.getPrcId()).orderByHistoricTaskInstanceEndTime().asc();
|
||||||
|
List<HistoricTaskInstance> list2 = historicTaskInstanceQuery.list();
|
||||||
|
List<HistoricTaskInstance> middle =new ArrayList<>();
|
||||||
|
list2.forEach(historicTaskInstance -> {
|
||||||
|
if (null==historicTaskInstance.getEndTime()){
|
||||||
|
middle.add(historicTaskInstance);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
list2.removeAll(middle);
|
||||||
|
list2.addAll(middle);
|
||||||
|
List<Map<String,Object>> list = ActivitiTools.turnHistoricTaskInstance(list2);
|
||||||
|
for (Map<String, Object> historicTaskInstance : list) {
|
||||||
|
// if(ChkUtil.isNull(historicTaskInstance.get("assignee"))) {
|
||||||
|
// continue;
|
||||||
|
// }
|
||||||
|
//需要修改 根据当前表结构查询
|
||||||
|
// Map<String, Object> map = jt.queryForMap("select t.USR_NAME from view_t_au_usr t where t.OBJECT_ID=?", historicTaskInstance.get("assignee"));
|
||||||
|
// if(ChkUtil.isNotNull(map)) {
|
||||||
|
// historicTaskInstance.put("assignee", map.get("USR_NAME"));
|
||||||
|
// }
|
||||||
|
if(StringUtils.isNotBlank(one.getId())){
|
||||||
|
historicTaskInstance.put("bpnId",one.getId());
|
||||||
|
}
|
||||||
|
if(ChkUtil.isNull(historicTaskInstance.get("assignee"))) {
|
||||||
|
// ResponseMessage<List<OrgEO>> listUser = lawsUserInfoService.getManagerByOrgIdNew("企业标准管理工程师");
|
||||||
|
ResponseMessage<List<OrgEO>> listUser = new ResponseMessage<>();
|
||||||
|
if(false){
|
||||||
|
List<String> qbgcs = new ArrayList<>();
|
||||||
|
for (OrgEO orgEO : listUser.getData()) {
|
||||||
|
qbgcs.add(orgEO.getUserName());
|
||||||
|
}
|
||||||
|
String str= StringUtils.join(qbgcs, ",");
|
||||||
|
historicTaskInstance.put("assignee", str);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
ResponseMessage<UserVO> assignee = lawsUserInfoService.getById(historicTaskInstance.get("assignee").toString());
|
||||||
|
|
||||||
|
if(assignee.getData()!=null){
|
||||||
|
historicTaskInstance.put("assignee", assignee.getData().getUname());
|
||||||
|
historicTaskInstance.put("assigneeId", assignee.getData().getUsid());
|
||||||
|
QueryWrapper queryWrapper2 = new QueryWrapper();
|
||||||
|
queryWrapper2.eq("TASK_ID",historicTaskInstance.get("id"));
|
||||||
|
queryWrapper2.orderByDesc("CREATE_TIME");
|
||||||
|
List<BusProcessEntrust> list1 = iBusProcessEntrustService.list(queryWrapper2);
|
||||||
|
String str = "";
|
||||||
|
if(list1.size()>0){
|
||||||
|
ResponseMessage<UserVO> assignee1 = lawsUserInfoService.getById(list1.get(0).getUserId());
|
||||||
|
historicTaskInstance.put("assignee", assignee.getData().getUname()+"("+assignee1.getData().getUname()+" 转办)");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
historicTaskInstance.put("prcType",one.getPrcType());
|
||||||
|
historicTaskInstance.put("prcName",one.getPrcName());
|
||||||
|
historicTaskInstance.put("prcNum",one.getPrcNum());
|
||||||
|
QueryWrapper queryWrapper1 = new QueryWrapper();
|
||||||
|
queryWrapper1.eq("TASK_ID",historicTaskInstance.get("id"));
|
||||||
|
queryWrapper1.eq("TASK_INFO",historicTaskInstance.get("name"));
|
||||||
|
queryWrapper1.isNotNull("COMMIT_TEXT");
|
||||||
|
List<BusProcessNew> list1 = iBusProcessNewService.list(queryWrapper1);
|
||||||
|
if(!list1.isEmpty()){
|
||||||
|
historicTaskInstance.put("comment",list1.get(0).getCommitFlag());
|
||||||
|
historicTaskInstance.put("commentText",list1.get(0).getCommitText());
|
||||||
|
}else{
|
||||||
|
historicTaskInstance.put("comment","");
|
||||||
|
historicTaskInstance.put("commentText","");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
if(StringUtils.isNotBlank(sortWord)){
|
||||||
|
Collections.sort(list, new Comparator<Map<String, Object>>() {
|
||||||
|
public int compare(Map<String, Object> o1, Map<String, Object> o2) {
|
||||||
|
String id1="";
|
||||||
|
String id2="";
|
||||||
|
if(sortWord.equals("startTime")){
|
||||||
|
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
id1 = df.format(o1.get(sortWord));
|
||||||
|
id2 = df.format(o2.get(sortWord));
|
||||||
|
}else{
|
||||||
|
id1 = (String) o1.get(sortWord);
|
||||||
|
id2 = (String) o2.get(sortWord);
|
||||||
|
}
|
||||||
|
if(shunxu.equals("desc")){
|
||||||
|
return id2.compareTo(id1);
|
||||||
|
}else{
|
||||||
|
return id1.compareTo(id2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user