新疆短信内容中手机号码处理,避免含正常手机号的短信发不出去
This commit is contained in:
+3
-2
@@ -32,6 +32,7 @@ import org.jeecg.modules.manager.ISysCache;
|
||||
import org.jeecg.modules.system.entity.HealthUserEmployeeEx;
|
||||
import org.jeecg.modules.system.entity.SysDepart;
|
||||
import org.jeecg.modules.system.entity.SysUser;
|
||||
import org.jeecg.util.XjCommonUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@@ -188,7 +189,7 @@ public class LargeScreenImpl {
|
||||
data.put("userName", socket.getRealName());
|
||||
data.put("departName", socket.getDepartName());
|
||||
data.put("secondDepartName", socket.getOrgName());
|
||||
data.put("mobile", socket.getPhone());
|
||||
data.put("mobile", XjCommonUtil.handleMobile(socket.getPhone()));
|
||||
String code = "";
|
||||
if ("0".equals(socket.getType())) {
|
||||
log.info("拨打120,准备发送短信给【{}】", phone);
|
||||
@@ -213,7 +214,7 @@ public class LargeScreenImpl {
|
||||
departPart);
|
||||
Map<String, String> data = new HashMap<>(2);
|
||||
data.put("noticeContent", noticeContent);
|
||||
data.put("mobile", socket.getPhone());
|
||||
data.put("mobile", XjCommonUtil.handleMobile(socket.getPhone()));
|
||||
String templateCode = "qimoNotice";
|
||||
String busType = "emergency_qimo";
|
||||
sysBaseAPI.sendBusSms(new BusTemplateMessageDTO("qimo", phone, data, templateCode, busType, socket.getNoticeId()));
|
||||
|
||||
+2
-1
@@ -50,6 +50,7 @@ import org.jeecg.modules.manager.ISysCache;
|
||||
import org.jeecg.modules.system.entity.SysDepart;
|
||||
import org.jeecg.untils.SpeechUntil;
|
||||
import org.jeecg.util.AjaxJson;
|
||||
import org.jeecg.util.XjCommonUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
@@ -562,7 +563,7 @@ public class WatchMonitorDataServiceImpl extends ServiceImpl<WatchMonitorDataMap
|
||||
// 用户相关
|
||||
if (null != socketVo) {
|
||||
map.put("realName", nullCheck(socketVo.getRealName()));
|
||||
map.put("phone", nullCheck(socketVo.getPhone()));
|
||||
map.put("phone", nullCheck(XjCommonUtil.handleMobile(socketVo.getPhone())));
|
||||
map.put("secondDepartName", nullCheck(getOrgName(socketVo.getOrgCode())));
|
||||
}
|
||||
// 手表相关
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package org.jeecg.util;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
|
||||
public class XjCommonUtil {
|
||||
/**
|
||||
* 新疆短信内容中的手机号需要处理一下,不然他们短信平台不识别;
|
||||
* 并且发送的-会自动转换成_,这里直接在前三位后面加上_
|
||||
*
|
||||
* @param mobile
|
||||
* @return {@link String }
|
||||
*/
|
||||
public static String handleMobile(String mobile) {
|
||||
if(StrUtil.isBlank(mobile)){
|
||||
return "";
|
||||
}
|
||||
// 判空或长度不足3位,直接返回原值
|
||||
if (mobile.length() < 3) {
|
||||
return mobile;
|
||||
}
|
||||
return mobile.substring(0, 3) + "_" + mobile.substring(3);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println(handleMobile("13812345678"));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user