推送火点日志添加详细的参数

This commit is contained in:
liuchengqian 2022-10-22 19:30:09 +08:00
parent 823db4f82e
commit b70763c1f5
2 changed files with 13 additions and 6 deletions

View File

@ -370,7 +370,7 @@ public class FirePointServiceImpl implements FirePointService {
List<AgentOrgEntity> agentOrgList = agentOrgDao.findAll(); List<AgentOrgEntity> agentOrgList = agentOrgDao.findAll();
Map<String, List<SysUserEntity>> agentOrgNameGroupMap = FirePointCodeUtils.groupSmsReceiver(smsReceiverList, agentOrgList); Map<String, List<SysUserEntity>> agentOrgNameGroupMap = FirePointCodeUtils.groupSmsReceiver(smsReceiverList, agentOrgList);
//分发短信通知 //分发短信通知
smsHelper.dispatchSMSMessage(agentOrgNameGroupMap, new String[]{firePointEntity.getFirePointAddress()}); smsHelper.dispatchSMSMessage(agentOrgNameGroupMap, new String[]{firePointEntity.getFirePointAddress()}, new FirePointEntity[]{firePointEntity});
} }
/** /**

View File

@ -2,6 +2,7 @@ package com.xkrs.sms;
import com.aliyuncs.dysmsapi.model.v20170525.SendSmsResponse; import com.aliyuncs.dysmsapi.model.v20170525.SendSmsResponse;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.xkrs.model.entity.FirePointEntity;
import com.xkrs.model.entity.SysUserEntity; import com.xkrs.model.entity.SysUserEntity;
import com.xkrs.utils.AliYunSmsUtils; import com.xkrs.utils.AliYunSmsUtils;
import com.xkrs.utils.HttpClientUtils; import com.xkrs.utils.HttpClientUtils;
@ -22,7 +23,7 @@ public class SMSHelper {
public SMSHelper() { public SMSHelper() {
} }
public void dispatchSMSMessage(Map<String, List<SysUserEntity>> agentOrgNameGroupMap, String[] templateParamArray) { public void dispatchSMSMessage(Map<String, List<SysUserEntity>> agentOrgNameGroupMap, String[] templateParamArray, FirePointEntity[] detailParamArray) {
for (Map.Entry<String, List<SysUserEntity>> entry : agentOrgNameGroupMap.entrySet()) { for (Map.Entry<String, List<SysUserEntity>> entry : agentOrgNameGroupMap.entrySet()) {
String targetAgentOrgName = entry.getKey(); String targetAgentOrgName = entry.getKey();
List<SysUserEntity> groupSmsReceiverList = entry.getValue(); List<SysUserEntity> groupSmsReceiverList = entry.getValue();
@ -33,12 +34,12 @@ public class SMSHelper {
} }
if ("青岛星科瑞升信息科技有限公司".equals(targetAgentOrgName)) { if ("青岛星科瑞升信息科技有限公司".equals(targetAgentOrgName)) {
xingkeSMSMessage(telephoneArray, templateParamArray); xingkeSMSMessage(telephoneArray, templateParamArray, detailParamArray);
} else if ("青岛华正信息技术股份有限公司".equals(targetAgentOrgName)) { } else if ("青岛华正信息技术股份有限公司".equals(targetAgentOrgName)) {
try { try {
huazhengSMSMessage(telephoneArray, templateParamArray); huazhengSMSMessage(telephoneArray, templateParamArray, detailParamArray);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -51,7 +52,7 @@ public class SMSHelper {
/** /**
* 星科瑞升向用户发送短信 * 星科瑞升向用户发送短信
*/ */
private void xingkeSMSMessage(String[] telephoneArray, String[] templateParamArray) { private void xingkeSMSMessage(String[] telephoneArray, String[] templateParamArray, FirePointEntity[] detailParamArray) {
int resValue = SMSUtils.sendSmsToUser(telephoneArray, "1425995", templateParamArray); int resValue = SMSUtils.sendSmsToUser(telephoneArray, "1425995", templateParamArray);
String sendResult = resValue == 0 ? "短信通知发送成功!" : "短信通知发送失败!"; String sendResult = resValue == 0 ? "短信通知发送成功!" : "短信通知发送失败!";
//记录短信通知日志 //记录短信通知日志
@ -62,6 +63,9 @@ public class SMSHelper {
for (String templateParam : templateParamArray) { for (String templateParam : templateParamArray) {
stringBuilder.append("模板参数:").append(templateParam).append("\n"); stringBuilder.append("模板参数:").append(templateParam).append("\n");
} }
for (FirePointEntity detailParam : detailParamArray) {
stringBuilder.append("超级详细的参数:").append(detailParam.toString()).append("\n");
}
stringBuilder.append(sendResult); stringBuilder.append(sendResult);
log.info(stringBuilder.toString()); log.info(stringBuilder.toString());
} }
@ -69,7 +73,7 @@ public class SMSHelper {
/** /**
* 华正信息向用户发送短信 * 华正信息向用户发送短信
*/ */
private void huazhengSMSMessage(String[] telephoneArray, String[] templateParamArray) throws Exception { private void huazhengSMSMessage(String[] telephoneArray, String[] templateParamArray, FirePointEntity[] detailParamArray) throws Exception {
StringBuilder telephoneBuilder = new StringBuilder(); StringBuilder telephoneBuilder = new StringBuilder();
for (int i = 0; i < telephoneArray.length; i++) { for (int i = 0; i < telephoneArray.length; i++) {
telephoneBuilder.append(telephoneArray[i]); telephoneBuilder.append(telephoneArray[i]);
@ -93,6 +97,9 @@ public class SMSHelper {
for (String templateParam : templateParamArray) { for (String templateParam : templateParamArray) {
stringBuilder.append("模板参数:").append(templateParam).append("\n"); stringBuilder.append("模板参数:").append(templateParam).append("\n");
} }
for (FirePointEntity detailParam : detailParamArray) {
stringBuilder.append("超级详细的参数:").append(detailParam.toString()).append("\n");
}
log.info(stringBuilder.toString()); log.info(stringBuilder.toString());
} }