| | |
| | | import com.alibaba.excel.EasyExcel; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springblade.core.excel.util.ExcelUtil; |
| | | import org.springblade.core.redis.cache.BladeRedis; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.regex.Matcher; |
| | | import java.util.regex.Pattern; |
| | | import static cn.gistack.alerts.sms.util.SmsUtils.validator; |
| | | import static cn.gistack.common.cache.CacheNames.PHONE_KEY; |
| | | |
| | | /** |
| | |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 校验手机号码 |
| | | */ |
| | | public static boolean validator(String phone) { |
| | | if (null!=phone && !phone.equals("")) { |
| | | String regex = "^((13[0-9])|(14[5,7,9])|(15([0-3]|[5-9]))|(166)|(17[0,1,3,5,6,7,8])|(18[0-9])|(19[8|9]))\\d{8}$"; |
| | | if (phone.length() != 11) { |
| | | return false; |
| | | } else { |
| | | Pattern p = Pattern.compile(regex); |
| | | Matcher m = p.matcher(phone); |
| | | boolean isMatch = m.matches(); |
| | | return isMatch; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Async; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | import java.util.regex.Pattern; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import static cn.gistack.alerts.sms.util.SmsUtils.validator; |
| | | |
| | | /** |
| | | * 短信发送服务实现层 |
| | | * @author zhongrj |
| | |
| | | String templateId = params.get("templateId").toString(); |
| | | // 查询短信模板 |
| | | SmsTemplate smsTemplate = smsTemplateService.getOne(new QueryWrapper<SmsTemplate>().eq("template_id", templateId)); |
| | | String content = params.get("content").toString(); |
| | | List<String> phones = (List<String>)params.get("phones"); |
| | | List<String> errPhones = new ArrayList<>(); |
| | | // 手机号去重 |
| | |
| | | return smsRecord; |
| | | } |
| | | |
| | | /** |
| | | * 校验手机号码 |
| | | */ |
| | | public static boolean validator(String phone) { |
| | | if (null!=phone && !phone.equals("")) { |
| | | String regex = "^((13[0-9])|(14[5,7,9])|(15([0-3]|[5-9]))|(166)|(17[0,1,3,5,6,7,8])|(18[0-9])|(19[8|9]))\\d{8}$"; |
| | | if (phone.length() != 11) { |
| | | return false; |
| | | } else { |
| | | Pattern p = Pattern.compile(regex); |
| | | Matcher m = p.matcher(phone); |
| | | boolean isMatch = m.matches(); |
| | | return isMatch; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 通过手机号获取外呼未接通已发短信通知的人员水库信息 |
| | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.util.Random; |
| | | import java.util.regex.Matcher; |
| | | import java.util.regex.Pattern; |
| | | |
| | | import static cn.gistack.common.constant.SmsConstant.*; |
| | | |
| | |
| | | return request; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 校验手机号码 |
| | | */ |
| | | public static boolean validator(String phone) { |
| | | if (null!=phone && !phone.equals("")) { |
| | | String regex = "^((13[0-9])|(14[5,7,9])|(15([0-3]|[5-9]))|(166)|(17[0,1,3,5,6,7,8])|(18[0-9])|(19[8|9]))\\d{8}$"; |
| | | if (phone.length() != 11) { |
| | | return false; |
| | | } else { |
| | | Pattern p = Pattern.compile(regex); |
| | | Matcher m = p.matcher(phone); |
| | | boolean isMatch = m.matches(); |
| | | return isMatch; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 获取随机字符串 |
| | | * @return |