コード例 #1
0
ファイル: NoticeServiceImpl.java プロジェクト: liuyun073/wzd
 public void sendMessage(Notice s) {
   Message m = new Message();
   m.setName(s.getTitle());
   m.setReceive_user(s.getReceive_userid());
   m.setSent_user(s.getSend_userid());
   m.setContent(s.warpContent());
   this.messageDao.addMessage(m);
   this.noticeDao.add(s);
 }
コード例 #2
0
ファイル: NoticeServiceImpl.java プロジェクト: liuyun073/wzd
  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);
      }
    }
  }