@Override
  public void saveHuman(HumanDto human, Organization organization, HumanType humanType) {

    validateHuman(human, organization, humanType);

    AuthenticationController authenticationController =
        ControllerUtils.getBean(ControllerName.AUTHENTICATION);
    boolean isupdate = true;
    if (human.getHumanId() == null) {
      isupdate = false;
      human.setHumanId(humanService.getSequence(SystemDefine.SEQUENCE_STAFF_ID).longValue());
    }
    if (human.getUsername() != null
        && human.getUsername().trim().compareTo("") != 0
        && human.getUserId() == null) {
      human.setUserId(getSequence(SystemDefine.SEQUENCE_USER_ID).longValue());
      human.setCreateDate(new Date());
      human.setLoginFailCounter(0);
    }
    if (humanType.toInteger() == HumanType.RETAIL_CUSTOMER.toInteger()) {
      human.setOrganizationId(authenticationController.getOrganization().getOrganizationId());
      human.setOrgRootId(authenticationController.getOrganization().getRootId());
    } else {
      human.setOrganizationId(organization.getOrganizationId());
      human.setOrgRootId(organization.getRootId());
    }
    Human saveHuman = human.cloneHuman();
    Date today = new Date();
    Human modifiedHuman = AuthenticationController.getCurrentHuman();
    Long modifiedHumanId = modifiedHuman == null ? null : modifiedHuman.getHumanId();
    if (!isupdate) {
      saveHuman.setCreateDate(today);
      if (modifiedHuman != null) {
        saveHuman.setCreateStaffId(modifiedHumanId);
      }
    }

    saveHuman.setModifiedDate(today);
    if (modifiedHuman != null) {
      saveHuman.setCreateStaffId(modifiedHumanId);
    }

    this.humanService.saveEntity(saveHuman);

    if (human.getUserId() != null) {
      this.userService.saveEntity(human.cloneUser());
    }
    if (!isupdate) {
      ControllerUtils.addSuccessMessage(ResourceMessages.getResource("create_user_success"));
    } else {
      ControllerUtils.addSuccessMessage(ResourceMessages.getResource("update_user_success"));
    }
    UserController userController = ControllerUtils.getBean(ControllerName.USER_CONTROLLER);
    userController.setHuman4InitPermission(human);
  }
  public void saveUserOnly(HumanDto human) {

    boolean isupdate = true;
    Users user = human.cloneUser();
    if (user.getUserId() == null) {
      validateUserAccountOnly(user);
      user.setUserId(getSequence(SystemDefine.SEQUENCE_USER_ID).longValue());
      user.setCreateDate(new Date());
      user.setLoginFailCounter(0);
      isupdate = false;
    }

    if (!isupdate) {
      ControllerUtils.addSuccessMessage(ResourceMessages.getResource("create_account_success"));
      this.userService.persistEntity(user);
    } else {
      this.userService.updateUser(user);
      ControllerUtils.addSuccessMessage(ResourceMessages.getResource("update_account_success"));
    }
    UserController userController = ControllerUtils.getBean(ControllerName.USER_CONTROLLER);
    userController.setHuman4InitPermission(human);
  }