private boolean renew4Forward(WfInstance wfInst, TaskOptVO optVO, String currUserId) throws BusinessException { WfAwt awtParm = new WfAwt(); awtParm.setInstId(wfInst.getInstId()); awtParm.setAssignerId(currUserId); WfAwt awt = this.selectOne(awtParm); if (awt == null) { log.error( "renew4Forward(): no awt found for instId=" + wfInst.getInstId() + ", currUserid=" + currUserId); return false; } String nextAssigners = optVO.getNextAssigners(); String currAssigners = wfInst.getCurrAssigners(); wfInst.setCurrAssigners(currAssigners.replace(currUserId + ",", nextAssigners + ",")); String optdUsers = wfInst.getOptUsersPre(); if (optdUsers != null && optdUsers.contains(currUserId)) { wfInst.setOptUsersPre(optdUsers.replace(currUserId + ",", "")); } instService.updateById(wfInst); String[] nextAssignerArray = nextAssigners.split(","); WfAwt awtNew = null; List<WfAwt> awtNewList = new ArrayList<WfAwt>(nextAssignerArray.length); try { for (String assinger : nextAssignerArray) { if (!StringUtils.isEmpty(assinger)) { awtParm.setAssignerId(assinger); awtNew = this.selectOne(awtParm); if (awtNew != null) { continue; } awtNew = awt.clone(); awtNew.setAssignerId(assinger); awtNew.setOptUsersPre(currUserId); awtNew.setTaskIdPre(awt.getTaskIdCurr()); awtNew.setWfAwtId(null); awtNewList.add(awtNew); } } } catch (CloneNotSupportedException e) { log.error("renew4Forward(): CloneNotSupportedException ", e); throw new BusinessException("Error when create Awt for forward task"); } this.deleteById(awt.getWfAwtId()); if (!awtNewList.isEmpty()) { this.insertBatch(awtNewList); } return false; }
private void removeUserFromOptUserPrev( WfInstance wfInst, String currUserId, String currTaskId, boolean refreshCurrAssigners) { String optdUsers = wfInst.getOptUsersPre(); if (optdUsers != null && optdUsers.contains(currUserId)) { wfInst.setOptUsersPre(optdUsers.replace(currUserId + ",", "")); } String currAssigners = wfInst.getCurrAssigners(); if (currAssigners == null || refreshCurrAssigners) { currAssigners = currUserId + ","; } else { currAssigners += currUserId; } wfInst.setCurrAssigners(currAssigners); wfInst.setTaskIdCurr(currTaskId); instService.updateById(wfInst); }
private void updateCurrAssigners4CS(WfInstance wfInst, String currUserId) { String optdUsers = wfInst.getOptUsersPre(); if (optdUsers == null) { optdUsers = currUserId + ","; } else { if (!optdUsers.contains(currUserId)) { optdUsers += currUserId + ","; } } /** 事务未流转,更新该task的处理人 */ wfInst.setOptUsersPre(optdUsers); String currAssigners4Inst = wfInst.getCurrAssigners(); if (currAssigners4Inst != null) { if (currAssigners4Inst.contains(currUserId + ",")) { wfInst.setCurrAssigners(currAssigners4Inst.replace(currUserId + ",", "")); instService.updateById(wfInst); // 更新当前处理人 wfInst.setCurrAssigners(currAssigners4Inst); } } }