示例#1
0
  public void smsModel(Notice s) {
    User user = this.userDao.getUserById(s.getReceive_userid());
    String mobile = "";
    if ((user == null) || (StringUtils.isBlank(user.getPhone())))
      mobile = StringUtils.isNull(s.getMobile());
    else {
      mobile = user.getPhone();
    }
    String content = StringUtils.isNull(s.getContent());

    this.logger.debug("contentString=========" + content);
    this.logger.debug("mobile=========" + mobile);
    if ((!"".equals(content)) && (!"".equals(content))) {
      int result = -1;
      try {
        result = sms(mobile, content);
      } catch (UnsupportedEncodingException e) {
        this.logger.error(e.getMessage());
      }
      if (result == 1) {
        Notice notice = new Notice();
        notice.setContent(content + "订单短信提醒成功");
        notice.setStatus(1);
        notice.setReceive_userid(s.getReceive_userid());
        notice.setSend_userid(s.getSend_userid());
        notice.setResult("" + result);
        this.noticeDao.add(notice);
      } else {
        Notice notice = new Notice();
        notice.setContent(content + "订单短信提醒失败");
        notice.setStatus(2);
        notice.setReceive_userid(s.getReceive_userid());
        notice.setSend_userid(s.getSend_userid());
        if (result == -1) notice.setResult("发送短信结果:" + result + ",即设置手机账号欠费,短信发送失败");
        else {
          notice.setResult("发送短信结果:" + result + ",即参数有误,短信发送失败");
        }

        this.noticeDao.add(notice);
      }
    }
  }
示例#2
0
 public int sms(String mobile, String content) throws UnsupportedEncodingException {
   content = URLEncoder.encode(content, "UTF-8");
   String username = StringUtils.isNull(Global.getValue("sms_username"));
   String password = StringUtils.isNull(Global.getValue("sms_password"));
   String url =
       "http://smsopen.erongdu.com/sendsms.php?username="******"&password="******"&mobile="
           + mobile
           + "&content="
           + content;
   this.logger.debug("url:" + url);
   String s = GetPageContent(url);
   this.logger.debug("发送短信结果:" + new String(s.getBytes("UTF-8")));
   this.logger.debug("发送短信结果:" + new String(s.getBytes("GBK")));
   int result = NumberUtils.getInt(StringUtils.isNull(s));
   System.out.println(result);
   return result;
 }
示例#3
0
  private String html(
      String name,
      String id,
      String clazz,
      String defaultvalue,
      int typeid,
      String nid,
      String disabled,
      String type,
      String noselect) {

    List<Linkage> list = null;
    type = StringUtils.isNull(type);
    if (!nid.equals("")) list = this.dao.getLinkageByNid(nid, type);
    else {
      list = this.dao.getLinkageByTypeid(typeid, type);
    }

    StringBuffer sb = new StringBuffer();
    sb.append("<select name=\"").append(name).append("\" autocomplete=\"off\"");
    if (!id.equals("")) {
      sb.append(" id=\"").append(id).append("\"");
    }
    if (!clazz.equals("")) {
      sb.append(" class=\"").append(clazz).append("\"");
    }
    if (!disabled.equals("")) {
      sb.append(" disabled=\"").append(disabled).append("\"");
    }
    sb.append(">");

    if (!noselect.equals("")) {
      sb.append("<option value=\"0\">" + noselect + "</option>");
    }
    for (Linkage l : list) {
      String value = Integer.toString(l.getId());
      if ("value".equals(type)) {
        value = l.getValue();
      }
      sb.append("<option value=\"").append(value).append("\"");
      if ((!defaultvalue.equals("")) && (defaultvalue.equals(value))) {
        sb.append(" selected=\"selected\" ");
      }
      sb.append(">").append(l.getName()).append("</option>");
    }
    sb.append("</select>");
    return sb.toString();
  }