From b70763c1f595986558e573797c4960d522dd388a Mon Sep 17 00:00:00 2001 From: liuchengqian Date: Sat, 22 Oct 2022 19:30:09 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A8=E9=80=81=E7=81=AB=E7=82=B9=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E6=B7=BB=E5=8A=A0=E8=AF=A6=E7=BB=86=E7=9A=84=E5=8F=82?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xkrs/service/impl/FirePointServiceImpl.java | 2 +- src/main/java/com/xkrs/sms/SMSHelper.java | 17 ++++++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/xkrs/service/impl/FirePointServiceImpl.java b/src/main/java/com/xkrs/service/impl/FirePointServiceImpl.java index 30995ae..58e7e8c 100644 --- a/src/main/java/com/xkrs/service/impl/FirePointServiceImpl.java +++ b/src/main/java/com/xkrs/service/impl/FirePointServiceImpl.java @@ -370,7 +370,7 @@ public class FirePointServiceImpl implements FirePointService { List agentOrgList = agentOrgDao.findAll(); Map> agentOrgNameGroupMap = FirePointCodeUtils.groupSmsReceiver(smsReceiverList, agentOrgList); //分发短信通知 - smsHelper.dispatchSMSMessage(agentOrgNameGroupMap, new String[]{firePointEntity.getFirePointAddress()}); + smsHelper.dispatchSMSMessage(agentOrgNameGroupMap, new String[]{firePointEntity.getFirePointAddress()}, new FirePointEntity[]{firePointEntity}); } /** diff --git a/src/main/java/com/xkrs/sms/SMSHelper.java b/src/main/java/com/xkrs/sms/SMSHelper.java index 8bc92b7..7eb1119 100644 --- a/src/main/java/com/xkrs/sms/SMSHelper.java +++ b/src/main/java/com/xkrs/sms/SMSHelper.java @@ -2,6 +2,7 @@ package com.xkrs.sms; import com.aliyuncs.dysmsapi.model.v20170525.SendSmsResponse; import com.fasterxml.jackson.databind.ObjectMapper; +import com.xkrs.model.entity.FirePointEntity; import com.xkrs.model.entity.SysUserEntity; import com.xkrs.utils.AliYunSmsUtils; import com.xkrs.utils.HttpClientUtils; @@ -22,7 +23,7 @@ public class SMSHelper { public SMSHelper() { } - public void dispatchSMSMessage(Map> agentOrgNameGroupMap, String[] templateParamArray) { + public void dispatchSMSMessage(Map> agentOrgNameGroupMap, String[] templateParamArray, FirePointEntity[] detailParamArray) { for (Map.Entry> entry : agentOrgNameGroupMap.entrySet()) { String targetAgentOrgName = entry.getKey(); List groupSmsReceiverList = entry.getValue(); @@ -33,12 +34,12 @@ public class SMSHelper { } if ("青岛星科瑞升信息科技有限公司".equals(targetAgentOrgName)) { - xingkeSMSMessage(telephoneArray, templateParamArray); + xingkeSMSMessage(telephoneArray, templateParamArray, detailParamArray); } else if ("青岛华正信息技术股份有限公司".equals(targetAgentOrgName)) { try { - huazhengSMSMessage(telephoneArray, templateParamArray); + huazhengSMSMessage(telephoneArray, templateParamArray, detailParamArray); } catch (Exception e) { 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); String sendResult = resValue == 0 ? "短信通知发送成功!" : "短信通知发送失败!"; //记录短信通知日志 @@ -62,6 +63,9 @@ public class SMSHelper { for (String templateParam : templateParamArray) { stringBuilder.append("模板参数:").append(templateParam).append("\n"); } + for (FirePointEntity detailParam : detailParamArray) { + stringBuilder.append("超级详细的参数:").append(detailParam.toString()).append("\n"); + } stringBuilder.append(sendResult); 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(); for (int i = 0; i < telephoneArray.length; i++) { telephoneBuilder.append(telephoneArray[i]); @@ -93,6 +97,9 @@ public class SMSHelper { for (String templateParam : templateParamArray) { stringBuilder.append("模板参数:").append(templateParam).append("\n"); } + for (FirePointEntity detailParam : detailParamArray) { + stringBuilder.append("超级详细的参数:").append(detailParam.toString()).append("\n"); + } log.info(stringBuilder.toString()); }