Exemple #1
0
  public String list() throws JTException {
    Map<String, String> dialMap = service.calcDial(startDate, endDate);
    Map<String, String> smsMap = service.calcSMS(startDate, endDate);
    Map<String, String> mmsMap = service.calcMMS(startDate, endDate);
    smsStatus0 = smsMap.get("0");
    smsStatus0 = StringUtil.isEmpty(smsStatus0) ? "0" : smsStatus0;
    smsStatus1 = smsMap.get("1");
    smsStatus1 = StringUtil.isEmpty(smsStatus1) ? "0" : smsStatus1;
    smsStatus2 = smsMap.get("2");
    smsStatus2 = StringUtil.isEmpty(smsStatus2) ? "0" : smsStatus2;
    smstotal = JTMath.add(JTMath.add(smsStatus0, smsStatus1), smsStatus2);

    mmsStatus0 = mmsMap.get("0");
    mmsStatus0 = StringUtil.isEmpty(mmsStatus0) ? "0" : mmsStatus0;
    mmsStatus1 = mmsMap.get("1");
    mmsStatus1 = StringUtil.isEmpty(mmsStatus1) ? "0" : mmsStatus1;
    mmsStatus2 = mmsMap.get("2");
    mmsStatus2 = StringUtil.isEmpty(mmsStatus2) ? "0" : mmsStatus2;
    mmstotal = JTMath.add(JTMath.add(mmsStatus0, mmsStatus1), mmsStatus2);

    dialStatus0 = dialMap.get("0");
    dialStatus0 = StringUtil.isEmpty(dialStatus0) ? "0" : dialStatus0;
    dialStatus1 = dialMap.get("1");
    dialStatus1 = StringUtil.isEmpty(dialStatus1) ? "0" : dialStatus1;
    dialStatus2 = dialMap.get("2");
    dialStatus2 = StringUtil.isEmpty(dialStatus2) ? "0" : dialStatus2;
    dialtotal = JTMath.add(JTMath.add(dialStatus0, dialStatus1), dialStatus2);
    return SUCCESS;
  }
 public String delete() throws Exception {
   if (task != null && !StringUtil.isEmpty(task.getTaskId())) {
     service.deleteBo(Task.class, task.getTaskId());
     service.deleteScheduleMMS(this.getBusinessType(), task.getTaskId());
   }
   return list();
 }
  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 listUsers() throws JTException {
   if (task != null && !StringUtil.isEmpty(task.getTaskId())) {
     scheduleMMSList =
         service.queryScheduleMMSByBusinessInfo(this.getBusinessType(), task.getTaskId());
     request.setAttribute("scheduleMMSList", scheduleMMSList);
   }
   return INPUT;
 }
  public String listAtt() throws JTException {
    String mmsId = getMmsId();
    if (!StringUtil.isEmpty(mmsId)) {
      SMSService service = new SMSService();
      List<MMSAttachment> atts = service.retrieveMMSAttachmentList(mmsId);
      logger.debug(atts);
      request.setAttribute("atts", atts);
    }

    return "listAtt";
  }
 public String setZiliaoku() throws JTException {
   SMSService service = new SMSService();
   BaseDAO dao = new BaseDAO(service.getS());
   if (task != null && !StringUtil.isEmpty(task.getTaskId())) {
     task = (Task) service.findBoById(Task.class, task.getTaskId());
   } else {
     // tixingxuexi = new Tixingxuexi();
     // tixingxuexi.setSendTime(DateUtil.getCurrentDate());
     if (ziliaokuId != null && ziliaokuId.trim().length() > 0) {
       Ziliaoku ziliaoku = (Ziliaoku) dao.findBoById(Ziliaoku.class, ziliaokuId);
       task = new Task();
       task.setContent(ziliaoku.getContent());
       // task.setTitle(ziliaoku.getTitle());
     }
   }
   return listUsers();
 }
 public String getListHQL(ArrayList<Object> params) {
   if (StringUtil.isEmpty(qryName)) {
     return "from InBoxVO s where  s.businessType='"
         + businessType
         + "' and s.businessId='"
         + businessId
         + "' order by s.GH desc";
   } else {
     return "from InBoxVO s where s.senderName like '%"
         + qryName
         + "%' and s.businessType='"
         + businessType
         + "' and s.businessId='"
         + businessId
         + "' order by s.GH desc";
   }
 }
  public String doSave() throws JTException {
    logger.debug(uploadForm);
    if (uploadForm != null) {
      List<String> errors = new ArrayList<String>();
      Shigongtu xianchangtupian = uploadForm.toShigongtu(errors);
      if (StringUtil.isEmpty(xianchangtupian.getSendToIds())) {
        addActionError("请选择接收人");
        return INPUT;
      }

      xianchangtupian.setOperatorId(this.getLoginUser().getId());
      if (errors.size() > 0) {
        for (String error : errors) {
          addFieldError("uploadForm.picture", error);
        }
        return INPUT;
      }
      logger.debug(xianchangtupian);
      SMSService service = new SMSService();
      service.saveMMSProducer(xianchangtupian);
    }
    return "thankYou";
  }
  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();
  }