@Override
  public Organization moveOrgBefore(Organization org, String otherId) {
    Organization parent = org.getParent();
    if (parent == null) throw new ServiceException("当前部门已经是根部门,无法移动位置!");

    List<Organization> brothers = parent.getChildren();
    Organization other = this.getOther(brothers, otherId);

    if (other == null) throw new ServiceException("当前部门不存在id=" + otherId + "的兄弟部门!");
    if (other.equals(org)) return org;

    int oldIndex = brothers.indexOf(org);
    int newIndex = brothers.indexOf(other);

    if (oldIndex != -1) {
      if (newIndex < oldIndex) {
        brothers.remove(oldIndex);
        brothers.add(newIndex, org);
      } else {
        brothers.add(newIndex, org);
        brothers.remove(oldIndex);
      }
    } else {
      throw new ServiceException("当前部门不存在!");
    }
    for (int i = 0; i < brothers.size(); i++) {
      Organization brother = brothers.get(i);
      brother.setPosition(i);
      dao.update(brother);
    }
    return org;
  }
 @Override
 public Organization moveToLast(Organization org) {
   List<Organization> brothers = org.getChildren();
   int p = brothers.indexOf(org);
   brothers.remove(p);
   brothers.add(org);
   for (int i = p; i < brothers.size(); i++) {
     Organization o = brothers.get(i);
     o.setPosition(i);
     dao.update(o, "position");
   }
   return org;
 }