Browse Source

message模块,发送手机验证码

dev
yujintao 6 years ago
parent
commit
956b3aadf8
  1. 1
      esua-epdc/epdc-commons/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/constant/NumConstant.java
  2. 12
      esua-epdc/epdc-commons/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/redis/RedisKeys.java
  3. 28
      esua-epdc/epdc-commons/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/redis/RedisUtils.java
  4. 1
      esua-epdc/epdc-gateway/src/main/resources/application.yml
  5. 4
      esua-epdc/epdc-module/epdc-message/epdc-message-server/pom.xml
  6. 55
      esua-epdc/epdc-module/epdc-message/epdc-message-server/src/main/java/com/elink/esua/epdc/controller/SmsController.java
  7. 52
      esua-epdc/epdc-module/epdc-message/epdc-message-server/src/main/java/com/elink/esua/epdc/redis/SmsRedis.java
  8. 17
      esua-epdc/epdc-module/epdc-message/epdc-message-server/src/main/java/com/elink/esua/epdc/service/SysSmsService.java
  9. 47
      esua-epdc/epdc-module/epdc-message/epdc-message-server/src/main/java/com/elink/esua/epdc/service/impl/SysSmsServiceImpl.java

1
esua-epdc/epdc-commons/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/constant/NumConstant.java

@ -14,6 +14,7 @@ public interface NumConstant {
int TWO = 2; int TWO = 2;
int THREE = 3; int THREE = 3;
int FOUR = 4; int FOUR = 4;
int SIX = 6;
int TEN = 10; int TEN = 10;
int FIFTEEN = 15; int FIFTEEN = 15;

12
esua-epdc/epdc-commons/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/redis/RedisKeys.java

@ -102,4 +102,16 @@ public class RedisKeys {
public static String getSimpleDictKey(String dictType) { public static String getSimpleDictKey(String dictType) {
return rootPrefix.concat("config:simple:dict:").concat(dictType); return rootPrefix.concat("config:simple:dict:").concat(dictType);
} }
/**
* 拼接手机验证码key
*
* @param phone
* @return java.lang.String
* @author yujintao
* @date 2019/9/6 17:03
*/
public static String getPhoneSmsCodeKey(String phone) {
return rootPrefix.concat("phone:sms:code:").concat(phone);
}
} }

28
esua-epdc/epdc-commons/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/redis/RedisUtils.java

@ -29,13 +29,33 @@ public class RedisUtils {
@Autowired @Autowired
private RedisTemplate<String, Object> redisTemplate; private RedisTemplate<String, Object> redisTemplate;
/** 默认过期时长为24小时,单位:秒 */ /**
* 默认过期时长为24小时单位
*/
public final static long DEFAULT_EXPIRE = 60 * 60 * 24L; public final static long DEFAULT_EXPIRE = 60 * 60 * 24L;
/** 过期时长为1小时,单位:秒 */ /**
* 过期时长为1小时单位
*/
public final static long HOUR_ONE_EXPIRE = 60 * 60 * 1L; public final static long HOUR_ONE_EXPIRE = 60 * 60 * 1L;
/** 过期时长为6小时,单位:秒 */ /**
* 过期时长为6小时单位
*/
public final static long HOUR_SIX_EXPIRE = 60 * 60 * 6L; public final static long HOUR_SIX_EXPIRE = 60 * 60 * 6L;
/** 不设置过期时长 */ /**
* 过期时长为5分钟单位
*/
public final static long MINUTE_FIVE_EXPIRE = 60 * 5 * 1L;
/**
* 过期时长为10分钟单位
*/
public final static long MINUTE_TEN_EXPIRE = 60 * 10 * 1L;
/**
* 过期时长为30分钟单位
*/
public final static long MINUTE_THIRTY_EXPIRE = 60 * 30 * 1L;
/**
* 不设置过期时长
*/
public final static long NOT_EXPIRE = -1L; public final static long NOT_EXPIRE = -1L;
public void set(String key, Object value, long expire) { public void set(String key, Object value, long expire) {

1
esua-epdc/epdc-gateway/src/main/resources/application.yml

@ -179,6 +179,7 @@ renren:
- /activiti/modeler.html - /activiti/modeler.html
- /activiti/service/** - /activiti/service/**
- /activiti/editor-app/** - /activiti/editor-app/**
- /message/sms/sendCode #发送验证码
- /heart/** - /heart/**

4
esua-epdc/epdc-module/epdc-message/epdc-message-server/pom.xml

@ -124,7 +124,7 @@
<![CDATA[jdbc:mysql://47.104.224.45:3308/esua_epdc_admin?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]> <![CDATA[jdbc:mysql://47.104.224.45:3308/esua_epdc_admin?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]>
</spring.datasource.druid.url> </spring.datasource.druid.url>
<spring.datasource.druid.username>epdc</spring.datasource.druid.username> <spring.datasource.druid.username>epdc</spring.datasource.druid.username>
<spring.datasource.druid.password>elink888</spring.datasource.druid.password> <spring.datasource.druid.password>elink833066</spring.datasource.druid.password>
<nacos.register-enabled>false</nacos.register-enabled> <nacos.register-enabled>false</nacos.register-enabled>
<nacos.server-addr>47.104.224.45:8848</nacos.server-addr> <nacos.server-addr>47.104.224.45:8848</nacos.server-addr>
@ -147,7 +147,7 @@
<![CDATA[jdbc:mysql://47.104.224.45:3308/esua_epdc_admin?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]> <![CDATA[jdbc:mysql://47.104.224.45:3308/esua_epdc_admin?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]>
</spring.datasource.druid.url> </spring.datasource.druid.url>
<spring.datasource.druid.username>epdc</spring.datasource.druid.username> <spring.datasource.druid.username>epdc</spring.datasource.druid.username>
<spring.datasource.druid.password>elink888</spring.datasource.druid.password> <spring.datasource.druid.password>elink833066</spring.datasource.druid.password>
<nacos.register-enabled>false</nacos.register-enabled> <nacos.register-enabled>false</nacos.register-enabled>
<nacos.server-addr>47.104.224.45:8848</nacos.server-addr> <nacos.server-addr>47.104.224.45:8848</nacos.server-addr>

55
esua-epdc/epdc-module/epdc-message/epdc-message-server/src/main/java/com/elink/esua/epdc/controller/SmsController.java

@ -1,8 +1,8 @@
/** /**
* Copyright (c) 2018 人人开源 All rights reserved. * Copyright (c) 2018 人人开源 All rights reserved.
* * <p>
* https://www.renren.io * https://www.renren.io
* * <p>
* 版权所有侵权必究 * 版权所有侵权必究
*/ */
@ -19,7 +19,6 @@ import com.elink.esua.epdc.commons.tools.validator.group.AliyunGroup;
import com.elink.esua.epdc.commons.tools.validator.group.QcloudGroup; import com.elink.esua.epdc.commons.tools.validator.group.QcloudGroup;
import com.elink.esua.epdc.dto.SysSmsDTO; import com.elink.esua.epdc.dto.SysSmsDTO;
import com.elink.esua.epdc.enums.PlatformEnum; import com.elink.esua.epdc.enums.PlatformEnum;
import com.elink.esua.epdc.remote.ParamsRemoteService;
import com.elink.esua.epdc.service.SysSmsService; import com.elink.esua.epdc.service.SysSmsService;
import com.elink.esua.epdc.sms.SmsConfig; import com.elink.esua.epdc.sms.SmsConfig;
import com.elink.esua.epdc.utils.ModuleConstant; import com.elink.esua.epdc.utils.ModuleConstant;
@ -27,6 +26,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore; import springfox.documentation.annotations.ApiIgnore;
@ -41,7 +41,7 @@ import java.util.Map;
*/ */
@RestController @RestController
@RequestMapping("sms") @RequestMapping("sms")
@Api(tags="短信服务") @Api(tags = "短信服务")
public class SmsController { public class SmsController {
@Autowired @Autowired
private SysSmsService sysSmsService; private SysSmsService sysSmsService;
@ -53,14 +53,14 @@ public class SmsController {
@GetMapping("page") @GetMapping("page")
@ApiOperation("分页") @ApiOperation("分页")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType="int") , @ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType = "int"),
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") , @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query", required = true, dataType = "int"),
@ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") , @ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String") , @ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "mobile", value = "mobile", paramType = "query", dataType="String"), @ApiImplicitParam(name = "mobile", value = "mobile", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "status", value = "status", paramType = "query", dataType="String") @ApiImplicitParam(name = "status", value = "status", paramType = "query", dataType = "String")
}) })
public Result<PageData<SysSmsDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){ public Result<PageData<SysSmsDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params) {
PageData<SysSmsDTO> page = sysSmsService.page(params); PageData<SysSmsDTO> page = sysSmsService.page(params);
return new Result<PageData<SysSmsDTO>>().ok(page); return new Result<PageData<SysSmsDTO>>().ok(page);
@ -68,7 +68,7 @@ public class SmsController {
@GetMapping("config") @GetMapping("config")
@ApiOperation("获取配置短信") @ApiOperation("获取配置短信")
public Result<SmsConfig> config(){ public Result<SmsConfig> config() {
SmsConfig config = paramsRemoteService.getValueObject(KEY, SmsConfig.class); SmsConfig config = paramsRemoteService.getValueObject(KEY, SmsConfig.class);
return new Result<SmsConfig>().ok(config); return new Result<SmsConfig>().ok(config);
@ -77,14 +77,14 @@ public class SmsController {
@PostMapping("saveConfig") @PostMapping("saveConfig")
@ApiOperation("保存配置短信") @ApiOperation("保存配置短信")
@LogOperation("保存配置短信") @LogOperation("保存配置短信")
public Result saveConfig(@RequestBody SmsConfig config){ public Result saveConfig(@RequestBody SmsConfig config) {
//校验类型 //校验类型
ValidatorUtils.validateEntity(config); ValidatorUtils.validateEntity(config);
if(config.getPlatform() == PlatformEnum.ALIYUN.value()){ if (config.getPlatform() == PlatformEnum.ALIYUN.value()) {
//校验阿里云数据 //校验阿里云数据
ValidatorUtils.validateEntity(config, AliyunGroup.class); ValidatorUtils.validateEntity(config, AliyunGroup.class);
}else if(config.getPlatform() == PlatformEnum.QCLOUD.value()){ } else if (config.getPlatform() == PlatformEnum.QCLOUD.value()) {
//校验腾讯云数据 //校验腾讯云数据
ValidatorUtils.validateEntity(config, QcloudGroup.class); ValidatorUtils.validateEntity(config, QcloudGroup.class);
} }
@ -98,19 +98,36 @@ public class SmsController {
@ApiOperation("发送短信") @ApiOperation("发送短信")
@LogOperation("发送短信") @LogOperation("发送短信")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "mobile", value = "手机好号", paramType = "query", required = true, dataType="String"), @ApiImplicitParam(name = "mobile", value = "手机好号", paramType = "query", required = true, dataType = "String"),
@ApiImplicitParam(name = "params", value = "参数", paramType = "query", required = true, dataType="String") @ApiImplicitParam(name = "params", value = "参数", paramType = "query", required = true, dataType = "String")
}) })
public Result send(String mobile, String params){ public Result send(String mobile, String params) {
sysSmsService.send(mobile, params); sysSmsService.send(mobile, params);
return new Result(); return new Result();
} }
/**
* 发送手机验证码
*
* @param mobile
* @return com.elink.esua.epdc.commons.tools.utils.Result
* @author yujintao
* @date 2019/9/6 16:50
*/
@GetMapping("sendCode")
public Result sendCode(String mobile) {
if (StringUtils.isBlank(mobile)) {
return new Result().error();
}
sysSmsService.sendCode(mobile);
return new Result();
}
@DeleteMapping @DeleteMapping
@ApiOperation("删除") @ApiOperation("删除")
@LogOperation("删除") @LogOperation("删除")
public Result delete(@RequestBody Long[] ids){ public Result delete(@RequestBody Long[] ids) {
sysSmsService.deleteBatchIds(Arrays.asList(ids)); sysSmsService.deleteBatchIds(Arrays.asList(ids));
return new Result(); return new Result();

52
esua-epdc/epdc-module/epdc-message/epdc-message-server/src/main/java/com/elink/esua/epdc/redis/SmsRedis.java

@ -0,0 +1,52 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.redis;
import com.elink.esua.epdc.commons.tools.redis.RedisKeys;
import com.elink.esua.epdc.commons.tools.redis.RedisUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* 区划信息表
*
* @author yujintao yujintao@elink-cn.com
* @since v1.0.0 2019-05-08
*/
@Component
public class SmsRedis {
@Autowired
private RedisUtils redisUtils;
/**
* 缓存短信验证码十分钟过期
*
* @param phone 手机号
* @param smsCode 验证码
* @return void
* @author yujintao
* @date 2019/9/6 17:01
*/
public void setSmsCode(String phone, String smsCode) {
String key = RedisKeys.getPhoneSmsCodeKey(phone);
redisUtils.set(key, smsCode, RedisUtils.MINUTE_TEN_EXPIRE);
}
}

17
esua-epdc/epdc-module/epdc-message/epdc-message-server/src/main/java/com/elink/esua/epdc/service/SysSmsService.java

@ -1,14 +1,13 @@
/** /**
* Copyright (c) 2018 人人开源 All rights reserved. * Copyright (c) 2018 人人开源 All rights reserved.
* * <p>
* https://www.renren.io * https://www.renren.io
* * <p>
* 版权所有侵权必究 * 版权所有侵权必究
*/ */
package com.elink.esua.epdc.service; package com.elink.esua.epdc.service;
import com.elink.esua.epdc.commons.mybatis.service.BaseService;
import com.elink.esua.epdc.commons.mybatis.service.BaseService; import com.elink.esua.epdc.commons.mybatis.service.BaseService;
import com.elink.esua.epdc.commons.tools.page.PageData; import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.dto.SysSmsDTO; import com.elink.esua.epdc.dto.SysSmsDTO;
@ -28,6 +27,7 @@ public interface SysSmsService extends BaseService<SysSmsEntity> {
/** /**
* 发送短信 * 发送短信
*
* @param mobile 手机号 * @param mobile 手机号
* @param params 短信参数 * @param params 短信参数
*/ */
@ -35,11 +35,22 @@ public interface SysSmsService extends BaseService<SysSmsEntity> {
/** /**
* 保存短信发送记录 * 保存短信发送记录
*
* @param platform 平台 * @param platform 平台
* @param mobile 手机号 * @param mobile 手机号
* @param params 短信参数 * @param params 短信参数
* @param status 发送状态 * @param status 发送状态
*/ */
void save(Integer platform, String mobile, LinkedHashMap<String, String> params, Integer status); void save(Integer platform, String mobile, LinkedHashMap<String, String> params, Integer status);
/**
* 发送手机短信验证吗
*
* @param mobile 手机号
* @return void
* @author yujintao
* @date 2019/9/6 16:48
*/
void sendCode(String mobile);
} }

47
esua-epdc/epdc-module/epdc-message/epdc-message-server/src/main/java/com/elink/esua/epdc/service/impl/SysSmsServiceImpl.java

@ -1,32 +1,34 @@
/** /**
* Copyright (c) 2018 人人开源 All rights reserved. * Copyright (c) 2018 人人开源 All rights reserved.
* * <p>
* https://www.renren.io * https://www.renren.io
* * <p>
* 版权所有侵权必究 * 版权所有侵权必究
*/ */
package com.elink.esua.epdc.service.impl; package com.elink.esua.epdc.service.impl;
import cn.hutool.core.map.MapUtil; import cn.hutool.core.map.MapUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl; import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl;
import com.elink.esua.epdc.commons.tools.constant.NumConstant;
import com.elink.esua.epdc.commons.tools.exception.ErrorCode; import com.elink.esua.epdc.commons.tools.exception.ErrorCode;
import com.elink.esua.epdc.commons.tools.utils.RandomUtil;
import com.elink.esua.epdc.exception.ModuleErrorCode; import com.elink.esua.epdc.exception.ModuleErrorCode;
import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl;
import com.elink.esua.epdc.commons.tools.constant.Constant; import com.elink.esua.epdc.commons.tools.constant.Constant;
import com.elink.esua.epdc.commons.tools.exception.ErrorCode;
import com.elink.esua.epdc.commons.tools.exception.RenException; import com.elink.esua.epdc.commons.tools.exception.RenException;
import com.elink.esua.epdc.commons.tools.page.PageData; import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.dao.SysSmsDao; import com.elink.esua.epdc.dao.SysSmsDao;
import com.elink.esua.epdc.dto.SysSmsDTO; import com.elink.esua.epdc.dto.SysSmsDTO;
import com.elink.esua.epdc.entity.SysSmsEntity; import com.elink.esua.epdc.entity.SysSmsEntity;
import com.elink.esua.epdc.exception.ModuleErrorCode; import com.elink.esua.epdc.redis.SmsRedis;
import com.elink.esua.epdc.service.SysSmsService; import com.elink.esua.epdc.service.SysSmsService;
import com.elink.esua.epdc.sms.AbstractSmsService; import com.elink.esua.epdc.sms.AbstractSmsService;
import com.elink.esua.epdc.sms.SmsFactory; import com.elink.esua.epdc.sms.SmsFactory;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
@ -35,6 +37,9 @@ import java.util.Map;
@Service @Service
public class SysSmsServiceImpl extends BaseServiceImpl<SysSmsDao, SysSmsEntity> implements SysSmsService { public class SysSmsServiceImpl extends BaseServiceImpl<SysSmsDao, SysSmsEntity> implements SysSmsService {
@Autowired
private SmsRedis smsRedis;
@Override @Override
public PageData<SysSmsDTO> page(Map<String, Object> params) { public PageData<SysSmsDTO> page(Map<String, Object> params) {
IPage<SysSmsEntity> page = baseDao.selectPage( IPage<SysSmsEntity> page = baseDao.selectPage(
@ -44,9 +49,9 @@ public class SysSmsServiceImpl extends BaseServiceImpl<SysSmsDao, SysSmsEntity>
return getPageData(page, SysSmsDTO.class); return getPageData(page, SysSmsDTO.class);
} }
private QueryWrapper<SysSmsEntity> getWrapper(Map<String, Object> params){ private QueryWrapper<SysSmsEntity> getWrapper(Map<String, Object> params) {
String mobile = (String)params.get("mobile"); String mobile = (String) params.get("mobile");
String status = (String)params.get("status"); String status = (String) params.get("status");
QueryWrapper<SysSmsEntity> wrapper = new QueryWrapper<>(); QueryWrapper<SysSmsEntity> wrapper = new QueryWrapper<>();
wrapper.like(StringUtils.isNotBlank(mobile), "mobile", mobile); wrapper.like(StringUtils.isNotBlank(mobile), "mobile", mobile);
@ -60,13 +65,13 @@ public class SysSmsServiceImpl extends BaseServiceImpl<SysSmsDao, SysSmsEntity>
LinkedHashMap<String, String> map; LinkedHashMap<String, String> map;
try { try {
map = JSON.parseObject(params, LinkedHashMap.class); map = JSON.parseObject(params, LinkedHashMap.class);
}catch (Exception e){ } catch (Exception e) {
throw new RenException(ErrorCode.JSON_FORMAT_ERROR); throw new RenException(ErrorCode.JSON_FORMAT_ERROR);
} }
//短信服务 //短信服务
AbstractSmsService service = SmsFactory.build(); AbstractSmsService service = SmsFactory.build();
if(service == null){ if (service == null) {
throw new RenException(ModuleErrorCode.SMS_CONFIG); throw new RenException(ModuleErrorCode.SMS_CONFIG);
} }
@ -74,6 +79,16 @@ public class SysSmsServiceImpl extends BaseServiceImpl<SysSmsDao, SysSmsEntity>
service.sendSms(mobile, map); service.sendSms(mobile, map);
} }
@Override
public void sendCode(String mobile) {
String smsCode = RandomUtil.getNewRandomCode(NumConstant.SIX);
// 缓存手机验证码
smsRedis.setSmsCode(mobile, smsCode);
JSONObject param = new JSONObject();
param.put("code", smsCode);
this.send(mobile, param.toJSONString());
}
@Override @Override
public void save(Integer platform, String mobile, LinkedHashMap<String, String> params, Integer status) { public void save(Integer platform, String mobile, LinkedHashMap<String, String> params, Integer status) {
SysSmsEntity sms = new SysSmsEntity(); SysSmsEntity sms = new SysSmsEntity();
@ -81,16 +96,16 @@ public class SysSmsServiceImpl extends BaseServiceImpl<SysSmsDao, SysSmsEntity>
sms.setMobile(mobile); sms.setMobile(mobile);
//设置短信参数 //设置短信参数
if(MapUtil.isNotEmpty(params)){ if (MapUtil.isNotEmpty(params)) {
int index = 1; int index = 1;
for(String value : params.values()){ for (String value : params.values()) {
if(index == 1){ if (index == 1) {
sms.setParams1(value); sms.setParams1(value);
}else if(index == 2){ } else if (index == 2) {
sms.setParams2(value); sms.setParams2(value);
}else if(index == 3){ } else if (index == 3) {
sms.setParams3(value); sms.setParams3(value);
}else if(index == 4){ } else if (index == 4) {
sms.setParams4(value); sms.setParams4(value);
} }
index++; index++;

Loading…
Cancel
Save