// 根据当前用户取得驳回报销列表 @Transactional(readOnly = true) public List<WipeTask> getRejectTasks(Long userId) { taskList = taskService.findPersonalTasks(String.valueOf(ActionUtil.getCurLoginInfo().getId())); List<WipeTask> list = null; if (taskList != null && !taskList.isEmpty()) { String wCode = null; list = new ArrayList<WipeTask>(taskList.size()); WipeTask wipeTask = null; for (Task task : taskList) { if (task.getName().equalsIgnoreCase("填写经费报销")) { wipeTask = new WipeTask(); wipeTask.setTask(task); wCode = (String) taskService.getVariable(task.getId(), "wCode"); if (wCode != null) { wipeTask.setWipe(wipeDao.getWipe(wCode)); list.add(wipeTask); } } } } return list; }
// 查询某个人的待办任务。 public List<WipeTask> weiShenPiList() throws Exception { taskList = taskService.findPersonalTasks(String.valueOf(ActionUtil.getCurLoginInfo().getId())); List<WipeTask> list = null; if (taskList != null && !taskList.isEmpty()) { String wCode = null; list = new ArrayList<WipeTask>(taskList.size()); WipeTask wipeTask = null; for (Task task : taskList) { if (task.getName().equalsIgnoreCase("填写经费报销")) continue; wipeTask = new WipeTask(); wipeTask.setTask(task); wCode = (String) taskService.getVariable(task.getId(), "wCode"); if (wCode != null) { if (wipeDao.getWipe(wCode) != null) { wipeTask.setWipe(wipeDao.getWipe(wCode)); list.add(wipeTask); } } } } return list; }
// 查询某个人的已办任务(具体到某个人) public List<Wipe> yiShenPiList() throws Exception { List<Wipe> wipeList = null; if (ActionUtil.getCurLoginInfo() != null && ActionUtil.getCurLoginInfo().getId() != null) wipeList = judgeManager.findWipeByUser(ActionUtil.getCurLoginInfo().getId()); // 当前登录编号。 return wipeList; }
// 撤回流程的操作 @Transactional public void upd( Wipe wipe, String isCom, Long ju1, List<WipeItem> itemList, List<WipeItemDetail> detailList, String itemString, String detailString) throws Exception { judgeManager.del(wipe.getId()); wipe.setwUser(userManager.get(wipe.getwUser().getId())); List<Judge> judgeSet = wipe.getJudgeSet(); for (Judge judge : judgeSet) { if (judge.getUser().getId() == null) judge.setUser(null); else judge.setUser(userManager.get(judge.getUser().getId())); } wipe.setJudgeSet(judgeSet); wipe.setState((short) 0); if ("false".equals(isCom) && ju1 != null) updWipe(wipe, ju1); Map<String, Object> variables = new HashMap<String, Object>(); Integer type = wipe.getWType(); // 0部内,1部外。 String yiji = String.valueOf(wipe.getJudgeSet().get(0).getUser().getId()); String erji = String.valueOf(wipe.getJudgeSet().get(1).getUser().getId()); String sanji = null, siji = null, wuji = null; if (type == 1) { if (wipe.getJudgeSet().get(2).getUser() == null) { sanji = null; } else { sanji = String.valueOf(wipe.getJudgeSet().get(2).getUser().getId()); } if (wipe.getJudgeSet().get(3).getUser() == null) { siji = null; } else { siji = String.valueOf(wipe.getJudgeSet().get(3).getUser().getId()); } if (wipe.getJudgeSet().get(4).getUser() == null) { wuji = null; } else { wuji = String.valueOf(wipe.getJudgeSet().get(4).getUser().getId()); } } variables.put("wCode", wipe.getwCode()); // 把禀议编号存储在变量中。 variables.put("deptUser", yiji); variables.put("projUser", erji); variables.put("sanJiUser", sanji); variables.put("manager", siji); variables.put("topUser", wuji); variables.put("fillUser", String.valueOf(ActionUtil.getCurLoginInfo().getId())); wipe.getJudgeSet().get(0).setWipe(wipe); wipe.getJudgeSet().get(1).setWipe(wipe); // 全公司 if (type == 1) { if (wipe.getJudgeSet().get(2) == null) { wipe.getJudgeSet().set(2, null); } else { wipe.getJudgeSet().get(2).setWipe(wipe); } if (wipe.getJudgeSet().get(3) == null) { wipe.getJudgeSet().set(3, null); } else { wipe.getJudgeSet().get(3).setWipe(wipe); } if (wipe.getJudgeSet().get(4) == null) { wipe.getJudgeSet().set(4, null); } else { wipe.getJudgeSet().get(4).setWipe(wipe); } } taskList = taskService.findPersonalTasks(String.valueOf(wipe.getwUser().getId())); if (taskList != null && !taskList.isEmpty()) { String wCode = null; for (Task task : taskList) { wCode = (String) taskService.getVariable(task.getId(), "wCode"); if (wCode != null) { if (wCode.equals(wipe.getwCode())) { taskService.setVariables(task.getId(), variables); taskService.completeTask(task.getId()); } } } } wipeDao.mery(wipe); String[] itemIds = itemString.split(","); String[] detailIds = detailString.split(","); for (int d = 0; d < detailIds.length; d++) { if (!detailIds[d].equals("")) wipeItemDetailService.delete(Long.parseLong(detailIds[d])); } for (int i = 0; i < itemIds.length; i++) { if (!itemIds[i].equals("")) wipeItemService.delete(Long.parseLong(itemIds[i])); } if (itemList != null && itemList.size() != 0) { for (WipeItem wipeItem : itemList) { wipeItem.setWipe(wipe); // 这里有错误,为什么为空。 if (wipeItem.getId() == null || "".equals(wipeItem.getId())) wipeItemService.save(wipeItem); else wipeItemService.merge(wipeItem); if (detailList != null && detailList.size() != 0) { for (WipeItemDetail wipeItemDetail : detailList) { if (wipeItem.getiItem().equals(wipeItemDetail.getWipeItem().getiItem())) { wipeItemDetail.setWipeItem(wipeItem); if (wipeItemDetail.getId() == null || "".equals(wipeItemDetail.getId())) wipeItemDetailService.save(wipeItemDetail); else wipeItemDetailService.merge(wipeItemDetail); } } } } } }
// 添加wipe的方法 @Transactional public Wipe saveWipe(Wipe wipe, List<WipeItem> itemList, List<WipeItemDetail> detailList) { Map<String, Object> variables = new HashMap<String, Object>(); Integer type = wipe.getWType(); // 0部内,1部外。 String yiji = String.valueOf(wipe.getJudgeSet().get(0).getUser().getId()); String erji = String.valueOf(wipe.getJudgeSet().get(1).getUser().getId()); String sanji = null, siji = null, wuji = null; if (type == 1) { if (wipe.getJudgeSet().get(2).getUser() == null) { sanji = null; } else { sanji = String.valueOf(wipe.getJudgeSet().get(2).getUser().getId()); } if (wipe.getJudgeSet().get(3).getUser() == null) { siji = null; } else { siji = String.valueOf(wipe.getJudgeSet().get(3).getUser().getId()); } if (wipe.getJudgeSet().get(4).getUser() == null) { wuji = null; } else { wuji = String.valueOf(wipe.getJudgeSet().get(4).getUser().getId()); } } variables.put("wCode", wipe.getwCode()); // 把禀议编号存储在变量中。 variables.put("deptUser", yiji); variables.put("projUser", erji); variables.put("sanJiUser", sanji); variables.put("manager", siji); variables.put("topUser", wuji); variables.put("fillUser", String.valueOf(ActionUtil.getCurLoginInfo().getId())); executionService.startProcessInstanceByKey("jingfeibaoxiao", variables); taskList = taskService.findPersonalTasks(String.valueOf(ActionUtil.getCurLoginInfo().getId())); task = taskList.get(taskList.size() - 1); taskService.completeTask(task.getId()); execution = executionService.findExecutionById(task.getExecutionId()); wipe.getJudgeSet().get(0).setWipe(wipe); wipe.getJudgeSet().get(1).setWipe(wipe); // 全公司 if (type == 1) { if (wipe.getJudgeSet().get(2) == null) { wipe.getJudgeSet().set(2, null); } else { wipe.getJudgeSet().get(2).setWipe(wipe); } if (wipe.getJudgeSet().get(3) == null) { wipe.getJudgeSet().set(3, null); } else { wipe.getJudgeSet().get(3).setWipe(wipe); } if (wipe.getJudgeSet().get(4) == null) { wipe.getJudgeSet().set(4, null); } else { wipe.getJudgeSet().get(4).setWipe(wipe); } } wipe.setPId(execution.getProcessInstance().getId()); // 获得流程实例ID; this.save(wipe); if (itemList != null && itemList.size() != 0) { for (WipeItem wipeItem : itemList) { wipeItem.setWipe(wipe); if (detailList != null && detailList.size() != 0) { for (WipeItemDetail wipeItemDetail : detailList) { if (wipeItem.getiItem().equals(wipeItemDetail.getWipeItem().getiItem())) { wipeItemDetail.setWipeItem(wipeItem); wipeItemDetailService.save(wipeItemDetail); } } } wipeItemService.save(wipeItem); } } return wipe; }