类 SMSUtil

java.lang.Object
org.anyline.aliyun.sms.util.SMSUtil

public class SMSUtil extends Object
短信服务
作者:
zh
  • 字段详细资料

  • 构造器详细资料

    • SMSUtil

      public SMSUtil()
  • 方法详细资料

    • getInstances

      public static Hashtable<String,SMSUtil> getInstances()
    • getInstance

      public static SMSUtil getInstance()
    • getInstance

      public static SMSUtil getInstance(String key)
    • send

      public SMSResult send(String sign, String template, String extend, String out, String mobile, Map<String,String> params)
      发送短信
      参数:
      sign - 签名(如果不指定则使用配置文件中默认签名)
      template - 模板code(SMS_88550009,注意不要写成工单号)
      mobile - 手机号,多个以逗号分隔
      params - 参数
      extend - 上行短信扩展码。上行短信指发送给通信服务提供商的短信,用于定制某种服务、完成查询,或是办理某种业务等,需要收费,按运营商普通短信资费进行扣费。
      out - 外部流水扩展字段。
      返回:
      SMSResult
    • send

      public SMSResult send(String sign, String template, String mobile, Map<String,String> params)
    • send

      public SMSResult send(String sign, String template, String mobile, Object entity, List<String> keys)
      发送短信 send("sign","SMS_000000","15800000000", new User()/new DataRow(), ["id","name:userNmae","age:userAge"])
      参数:
      sign - 签名(如果不指定则使用配置文件中默认签名)
      template - 模板code(SMS_88550009,注意不要写成工单号)
      mobile - 手机号,多个以逗号分隔
      entity - 实体对象
      keys - 对象属性(根据keys从entity中取值生成短信参数),如果参数名与属性名不一致通过 短信参数名:属性名 转换
      返回:
      SMSResult
    • send

      public SMSResult send(String sign, String template, String mobile, Object entity, String... keys)
    • send

      public SMSResult send(String sign, String template, List<String> mobiles, Map<String,String> params)
      发送短信
      参数:
      sign - 签名(如果不指定则使用配置文件中默认签名)
      template - 模板code(SMS_88550009,注意不要写成工单号)
      mobiles - 手机号
      params - 参数
      返回:
      SMSResult
    • send

      public SMSResult send(String sign, String template, List<String> mobiles, Object entity, List<String> keys)
    • send

      public SMSResult send(String sign, String template, List<String> mobiles, Object entity, String... keys)
    • send

      public SMSResult send(String template, String mobile, Map<String,String> params)
      发送短信(使用配置文件中的默认签名)
      参数:
      template - 模板code(SMS_88550009,注意不要写成工单号)
      mobile - 手机号
      params - 参数
      返回:
      SMSResult
    • send

      public SMSResult send(String template, String mobile, Object entity, List<String> keys)
    • send

      public SMSResult send(String template, String mobile, Object entity, String... keys)
    • send

      public SMSResult send(String template, List<String> mobiles, Map<String,String> params)
      发送短信(使用配置文件中的默认签名)
      参数:
      template - 模板code(SMS_88550009,注意不要写成工单号)
      mobiles - 手机号
      params - 参数
      返回:
      SMSResult
    • send

      public SMSResult send(String template, List<String> mobiles, Object entity, List<String> keys)
    • send

      public SMSResult send(String template, List<String> mobiles, Object entity, String... keys)
    • status

      public List<SMSResult> status(String mobile, String biz, String date, int vol, int page) throws RuntimeException
      查询发送状态,有可能查出多个发送记录,按时间倒序
      参数:
      mobile - 手机号
      biz - 回执号
      date - 发送日期(yyyyMMdd) 不传默认当天 支持查询最近30天的记录。
      vol - 每页多少条
      page - 当前第几页
      返回:
      List 根据 SMSMResult.status 1:等待回执 2:发送失败 3:发送成功。
      抛出:
      RuntimeException - RuntimeException
    • status

      public SMSResult status(String mobile, String biz, String date)
      最后一次发送状态
      参数:
      mobile - 手机号
      biz - 回执号
      date - 发送日期
      返回:
      SMSResult 根据 SMSMResult.status 1:等待回执 2:发送失败 3:发送成功。
    • status

      public SMSResult status(String mobile, String biz)
    • status

      public SMSResult status(String mobile)
    • getConfig

      public SMSConfig getConfig()