This commit is contained in:
liuchengqian 2023-03-06 10:06:15 +08:00
parent 462da67a04
commit 9aa39ddc1c
4 changed files with 24 additions and 65 deletions

View File

@ -11,7 +11,6 @@ import com.xkrs.straw.model.bean.FirePointQueryResultBean;
import com.xkrs.straw.model.entity.FirePointOrdinaryEntity;
import com.xkrs.straw.model.entity.SysUserEntity;
import com.xkrs.straw.model.helper.PushHelper;
import com.xkrs.straw.model.helper.SMSHelper;
import com.xkrs.straw.model.vo.AllFirePointVo;
import com.xkrs.straw.utils.FirePointConvertUtils;
import com.xkrs.straw.utils.FirePointQueryManager;
@ -58,9 +57,6 @@ public class FirePointServiceImpl implements FirePointService {
@Resource
private StreetService streetService;
@Resource
private SMSHelper smsHelper;
@Resource
private PushHelper pushHelper;

View File

@ -7,7 +7,6 @@ import com.xkrs.model.validation.SysUserQoUpdate;
import com.xkrs.service.RedisService;
import com.xkrs.straw.dao.SysUserDao;
import com.xkrs.straw.model.entity.SysUserEntity;
import com.xkrs.straw.model.helper.SMSHelper;
import com.xkrs.straw.model.qo.SysUserQo;
import com.xkrs.straw.model.qo.SysUserReceiveSmsQo;
import com.xkrs.straw.model.qo.SysUserRemarkQo;
@ -56,9 +55,6 @@ public class SysUserController {
@Resource
private RedisService redisService;
@Resource
private SMSHelper smsHelper;
/**
* 更新批量系统用户信息
*

View File

@ -1,51 +0,0 @@
package com.xkrs.straw.model.helper;
import com.xkrs.straw.model.entity.SysUserEntity;
import com.xkrs.straw.model.vo.AllFirePointVo;
import com.xkrs.utils.SMSUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import java.util.List;
@Component
public class SMSHelper {
public static Logger log = LoggerFactory.getLogger(SMSHelper.class);
public SMSHelper() {
}
public void dispatchSMSMessage(List<SysUserEntity> smsReceiverList, String[] templateParamArray, AllFirePointVo[] detailParamArray) {
if (smsReceiverList != null && smsReceiverList.size() > 0) {
String[] telephoneArray = new String[smsReceiverList.size()];
for (int i = 0; i < smsReceiverList.size(); i++) {
telephoneArray[i] = "86" + smsReceiverList.get(i).getUserName();
}
xingkeSMSMessage(telephoneArray, templateParamArray, detailParamArray);
}
}
/**
* 星科瑞升向用户发送短信
*/
private void xingkeSMSMessage(String[] telephoneArray, String[] templateParamArray, AllFirePointVo[] detailParamArray) {
int resValue = SMSUtils.sendSmsToUser(telephoneArray, "1425995", templateParamArray);
String sendResult = resValue == 0 ? "短信通知发送成功!" : "短信通知发送失败!";
//记录短信通知日志
StringBuilder stringBuilder = new StringBuilder("发送人:青岛星科瑞升信息科技有限公司\n");
for (String telephone : telephoneArray) {
stringBuilder.append("接收人:").append(telephone).append("\n");
}
for (String templateParam : templateParamArray) {
stringBuilder.append("模板参数:").append(templateParam).append("\n");
}
for (AllFirePointVo detailParam : detailParamArray) {
stringBuilder.append("超级详细的参数:").append(detailParam.toString()).append("\n");
}
stringBuilder.append(sendResult);
log.info(stringBuilder.toString());
}
}

View File

@ -7,9 +7,9 @@ import com.xkrs.straw.model.entity.FirePointOrdinaryEntity;
import com.xkrs.straw.model.entity.FirePointPreciseEntity;
import com.xkrs.straw.model.entity.SysUserEntity;
import com.xkrs.straw.model.helper.PushHelper;
import com.xkrs.straw.model.helper.SMSHelper;
import com.xkrs.straw.model.vo.AllFirePointVo;
import com.xkrs.utils.FirePointCodeUtils;
import com.xkrs.utils.SMSUtils;
import com.xkrs.utils.WDWxSendMsgUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -29,9 +29,6 @@ public class FirePointPushManager {
@Resource
private CountyCodeWeiXinDao countyCodeWeiXinDao;
@Resource
private SMSHelper smsHelper;
@Resource
private PushHelper pushHelper;
@ -58,8 +55,29 @@ public class FirePointPushManager {
// } catch (Exception e) {
// e.printStackTrace();
// }
//分发短信通知
smsHelper.dispatchSMSMessage(smsReceiverList, new String[]{firePoint.getFirePointAddress()}, new AllFirePointVo[]{firePoint});
String[] templateParamArray = new String[]{firePoint.getFirePointAddress()};
AllFirePointVo[] detailParamArray = new AllFirePointVo[]{firePoint};
if (smsReceiverList.size() > 0) {
String[] telephoneArray = new String[smsReceiverList.size()];
for (int i = 0; i < smsReceiverList.size(); i++) {
telephoneArray[i] = "86" + smsReceiverList.get(i).getUserName();
}
int resValue = SMSUtils.sendSmsToUser(telephoneArray, "1425995", templateParamArray);
String sendResult = resValue == 0 ? "短信通知发送成功!" : "短信通知发送失败!";
//记录短信通知日志
StringBuilder stringBuilder = new StringBuilder("发送人:青岛星科瑞升信息科技有限公司\n");
for (String telephone : telephoneArray) {
stringBuilder.append("接收人:").append(telephone).append("\n");
}
for (String templateParam : templateParamArray) {
stringBuilder.append("模板参数:").append(templateParam).append("\n");
}
for (AllFirePointVo detailParam : detailParamArray) {
stringBuilder.append("超级详细的参数:").append(detailParam.toString()).append("\n");
}
stringBuilder.append(sendResult);
log.info(stringBuilder.toString());
}
}
}