public void sendSms(String mobile){
//1.生成6位短信验证码
Random random=new Random();
int max=999999;//最大数
int min=100000;//最小数
int code = random.nextInt(max);//随机生成
if(code<min){
code=code+min;
}
System.out.println(mobile+"收到验证码是:"+code);
//2.将验证码放入redis
redisTemplate.opsForValue().set("smscode_"+mobile, code+"" ,5,
TimeUnit.MINUTES );//五分钟过期
//3.将验证码和手机号发动到rabbitMQ中
Map<String,String> map=new HashMap();
map.put("mobile",mobile);
map.put("code",code+"");
rabbitTemplate.convertAndSend("sms",map);
}