---恢复内容开始---

package com.zhourong.controller;

import org.apache.commons.lang3.RandomStringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate; import com.zhourong.dto.SmsDto;
import com.zhourong.utils.Result;
import com.zhourong.vo.SmsVo; @RestController
@RequestMapping("/sms/")
public class SmsController {
private final String appid = "6d5ea3e7964341058f0cd1b31799eb27";
private final String sid = "b3cf37114ad3e0f61d66d5317306af70";
private final String token = "1a1e13a677e25df8ceadb8dd100d2fd3";
private final String templateid = "413092"; @Autowired
private RestTemplate restTemplate; @RequestMapping("/send")
@ResponseBody
public Result<SmsVo> send() {
String url = "https://open.ucpaas.com/ol/sms/sendsms";
SmsDto sms = new SmsDto();
String code = RandomStringUtils.randomNumeric(4);
sms.setAppid(appid);
sms.setMobile("18821962348");
sms.setSid(sid);
sms.setTemplateid(templateid);
sms.setToken(token);
sms.setParam(code);
ResponseEntity<SmsVo> smsVo = restTemplate.postForEntity(url,sms, SmsVo.class);
return new Result(200,"发送成功",smsVo); }
} 项目结构:

直接用。

git:https://gitee.com/xxoo0_297/SMS.git

---恢复内容结束---

spring boot 整合 云之讯 demo的更多相关文章

  1. Spring Boot 整合 Fisco Bcos(区块链)

    简介 FISCO BCOS是由国内企业主导研发.对外开源.安全可控的企业级金融联盟链底层平台,由金链盟开源工作组协作打造,并于2017年正式对外开源. 目前,成熟的区块链的平台不少,之所以选择FISC ...

  2. Spring Kafka和Spring Boot整合实现消息发送与消费简单案例

    本文主要分享下Spring Boot和Spring Kafka如何配置整合,实现发送和接收来自Spring Kafka的消息. 先前我已经分享了Kafka的基本介绍与集群环境搭建方法.关于Kafka的 ...

  3. spring boot 整合 百度ueditor富文本

    百度的富文本没有提供Java版本的,只给提供了jsp版本,但是呢spring boot 如果是使用内置tomcat启动的话整合jsp是非常困难得,今天小编给大家带来spring boot整合百度富文本 ...

  4. Spring Boot初识(2)- Spring Boot整合Mybaties

    一.本文介绍 首先读这篇文章之前如果没有接触过Spring Boot可以看一下之前的文章,并且读这篇文章还需要你至少能写基本的sql语句.我在写这篇文章之前也想过到底是选择JPA还是Mybaties作 ...

  5. spring boot整合slf4j-log日志

    原文地址:https://blog.csdn.net/u011271894/article/details/75735915 版权声明:本文为博主原创文章,未经博主允许不得转载. https://bl ...

  6. Spring Boot 整合JDBC 实现后端项目开发

    一.前言 二.新建Spring Boot 项目 三.Spring Boot 整合JDBC 与MySQL 交互 3.1 新建数据表skr_user 3.2 Jdbcproject 项目结构如下 3.3 ...

  7. activeMQ入门+spring boot整合activeMQ

    最近想要学习MOM(消息中间件:Message Oriented Middleware),就从比较基础的activeMQ学起,rabbitMQ.zeroMQ.rocketMQ.Kafka等后续再去学习 ...

  8. Spring Boot 整合 Druid

    Spring Boot 整合 Druid 概述 Druid 是阿里巴巴开源平台上的一个项目,整个项目由数据库连接池.插件框架和 SQL 解析器组成.该项目主要是为了扩展 JDBC 的一些限制,可以让程 ...

  9. RabbitMQ使用及与spring boot整合

    1.MQ 消息队列(Message Queue,简称MQ)——应用程序和应用程序之间的通信方法 应用:不同进程Process/线程Thread之间通信 比较流行的中间件: ActiveMQ Rabbi ...

随机推荐

  1. Springboot整合Mybatis-puls

    Spring boot对于我来说是一个刚接触的新东西,学习过程中,发现这东西还是很容易上手的,Spring boot没配置时会默认使用Spring data jpa,这东西可以说一个极简洁的工具,可是 ...

  2. 构建之法 chapter1 心得

    阅读完了<构建之法>第一章后,觉得我们平时使用的软件并不是自己想象中的那样简单,用的时候是觉得很方便,但从来没有考虑过一个软件的背后需要一个团队多少的付出才能换来一个获得用户频频好评的软件 ...

  3. Windows 上安装 Azure PowerShell及Azure PowerShell部署虚拟机

    一.Azure PowerShell部署   1.使用 PowerShellGet 在 Windows 上安装 Azure PowerShell 从 Azure PowerShell 版本 6.0 开 ...

  4. ubuntu下安装无界面浏览器

    ubuntu下安装PhantomJS 1.下载: 32位:wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-li ...

  5. 2018-2019-2 20165313 Exp2 后门原理与实践

    实践基础问题回答 (1)例举你能想到的一个后门进入到你系统中的可能方式? 应用程序设定后门,用户安装后,后门就可以进入.例如课堂上讲到的百度. (2)例举你知道的后门如何启动起来(win及linux) ...

  6. Custom Default Node Colors and Shapes in Houdini 16.5

    A:before H16.5: 1.Create a file, named OPcustomize 2.Edit it like this: //Custom Default Shapes opde ...

  7. uwp应用在debug模式下运行正常,编译为release版本的时候抛出异常

    原因是在代码中使用了dynamic关键字,导致release时.net native优化了代码造成元数据丢失 所以在代码中要尽量不用dynamic.

  8. streamreader 和 streamwriter 以及 string 与 memorystream 使用示例

    经常用到,但老记不住,备忘一下 using (var ms = new MemoryStream()) { var sw = new StreamWriter(ms); sw.WriteLine(&q ...

  9. idea构建maven多项目web架构

    1.新建一个maven项目作为顶级module,可以使用模板quickstart模板,在生成pom.xml中添加一些子项目都会用到的依赖,apache-commons,guava等.因为是顶级modu ...

  10. Handlebars.js registerHelper

    Handlebars.registerHelper('link', function (text, url) { text = Handlebars.Utils.escapeExpression(te ...