public String addUsers() throws JTException {
    String idString = request.getParameter("useridStr");
    String[] ids = StringUtil.parseString2Array(idString, ",");
    for (String id : ids) {
      if (service.existScheduleMMS(this.getBusinessType(), task.getTaskId(), id)) {
        continue;
      }

      for (int i = 0; i < ids.length; i++) {
        User u = SysCache.interpertUser(ids[i]);
        ScheduleMMS shedMMS = new ScheduleMMS();
        shedMMS.setPhoneNumber(u.getPhoneNumber());
        shedMMS.setRequestTime(DateUtil.getCurrentTime());
        shedMMS.setTitle("业务提醒学习");
        shedMMS.setBusinessType(this.getBusinessType());
        shedMMS.setBusinessId(task.getTaskId());
        shedMMS.setRecipientId(u.getId());
        shedMMS.setCronExp(task.getCronExp());
        shedMMS.setStartTime(task.getStartTime());
        shedMMS.setEndTime(task.getEndTime());
        shedMMS.setSenderInfo(this.getLoginUserInfo());
        shedMMS.setOperatorId(this.getLoginUser().getId());
        shedMMS.setRealMMSID(task.getTaskId());
        service.saveOrUpdateScheduleMMS(shedMMS);
        service.startReminder(shedMMS);
      }
    }
    return listUsers();
  }
  public String save() throws Exception {
    User loginUser = this.getLoginUser();
    task.setCreatorId(loginUser.getId());
    task.setUnitName(loginUser.getUnit());
    task.setBusinessType(this.getBusinessType());
    task.setStartTime(
        this.getStartDate() + " " + this.getStartHour() + ":" + this.getStartMinite() + ":00");
    task.setEndTime(
        this.getEndDate() + " " + this.getEndHour() + ":" + this.getEndMinite() + ":00");
    if (!task.isValidTime()) {
      addActionError("开始或结束时间不对,请检查!");
      return listUsers();
    }

    task.setOperatorId(this.getLoginUser().getId());
    task.setIsRepeat("on".equals(this.getIsRepeat()) ? "1" : "0");
    if (task != null && !StringUtil.isEmpty(task.getTaskId())) {
      service.updateBo(task);
    } else {
      service.createBo(task);
    }
    String idString = request.getParameter("useridStr");
    String[] ids = StringUtil.parseString2Array(idString, ",");
    if (StringUtil.isEmpty(idString)) {
      addActionError("请选择人员");
      // return INPUT;
      return listUsers();
    }

    MMSAttachment att = new MMSAttachment();
    if (!StringUtil.isEmpty(task.getContent())) {
      att.setContent(Hibernate.createBlob(task.getContent().getBytes()));
      att.setContentType("txt");
      att.setMmsId(task.getTaskId());
      service.saveOrUpdateBo(att);
    } else {
      addActionError("请填写日程内容");
      // return INPUT;
      return listUsers();
    }

    for (int i = 0; i < ids.length; i++) {
      User u = SysCache.interpertUser(ids[i]);
      ScheduleMMS shedMMS = null;
      if (service.existScheduleMMS(this.getBusinessType(), task.getTaskId(), ids[i])) {
        shedMMS =
            service.findScheduleMMSByBusinessInfo(this.getBusinessType(), task.getTaskId(), ids[i]);
      } else {
        shedMMS = new ScheduleMMS();
      }
      shedMMS.setPhoneNumber(u.getPhoneNumber());
      shedMMS.setRequestTime(DateUtil.getCurrentTime());
      shedMMS.setTitle("业务提醒学习");
      shedMMS.setBusinessType(this.getBusinessType());
      shedMMS.setBusinessId(task.getTaskId());
      shedMMS.setRecipientId(u.getId());
      shedMMS.setCronExp(task.getCronExp());
      shedMMS.setStartTime(task.getStartTime());
      shedMMS.setEndTime(task.getEndTime());
      shedMMS.setSenderInfo(this.getLoginUserInfo());
      shedMMS.setOperatorId(this.getLoginUser().getId());
      shedMMS.setRealMMSID(
          task.getTaskId()); // use task id as realMMSID, make sure all mms can use one ATT.
      service.saveOrUpdateScheduleMMS(shedMMS);

      try {
        service.startReminder(shedMMS);
      } catch (JTException e) {
        addActionError(e.getMessage());
        return listUsers();
      }
    }
    return list();
  }