|
|
@ -31,6 +31,7 @@ import org.slf4j.Logger; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.ArrayList; |
|
|
|
|
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.List; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
|
|
|
@ -72,9 +73,7 @@ public class AlertSender{ |
|
|
|
String receivers = alert.getReceivers(); |
|
|
|
String receivers = alert.getReceivers(); |
|
|
|
if (StringUtils.isNotEmpty(receivers)){ |
|
|
|
if (StringUtils.isNotEmpty(receivers)){ |
|
|
|
String[] splits = receivers.split(","); |
|
|
|
String[] splits = receivers.split(","); |
|
|
|
for (String receiver : splits){ |
|
|
|
receviersList.addAll(Arrays.asList(splits)); |
|
|
|
receviersList.add(receiver); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// copy list
|
|
|
|
// copy list
|
|
|
@ -86,9 +85,7 @@ public class AlertSender{ |
|
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isNotEmpty(receiversCc)){ |
|
|
|
if (StringUtils.isNotEmpty(receiversCc)){ |
|
|
|
String[] splits = receiversCc.split(","); |
|
|
|
String[] splits = receiversCc.split(","); |
|
|
|
for (String receiverCc : splits){ |
|
|
|
receviersCcList.addAll(Arrays.asList(splits)); |
|
|
|
receviersCcList.add(receiverCc); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (CollectionUtils.isEmpty(receviersList) && CollectionUtils.isEmpty(receviersCcList)) { |
|
|
|
if (CollectionUtils.isEmpty(receviersList) && CollectionUtils.isEmpty(receviersCcList)) { |
|
|
@ -106,7 +103,13 @@ public class AlertSender{ |
|
|
|
alert.setInfo(retMaps); |
|
|
|
alert.setInfo(retMaps); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
boolean flag = Boolean.parseBoolean(String.valueOf(retMaps.get(Constants.STATUS))); |
|
|
|
//send flag
|
|
|
|
|
|
|
|
boolean flag = false; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (null != retMaps) { |
|
|
|
|
|
|
|
flag = Boolean.parseBoolean(String.valueOf(retMaps.get(Constants.STATUS))); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (flag) { |
|
|
|
if (flag) { |
|
|
|
alertDao.updateAlert(AlertStatus.EXECUTION_SUCCESS, "execution success", alert.getId()); |
|
|
|
alertDao.updateAlert(AlertStatus.EXECUTION_SUCCESS, "execution success", alert.getId()); |
|
|
|
logger.info("alert send success"); |
|
|
|
logger.info("alert send success"); |
|
|
@ -121,8 +124,10 @@ public class AlertSender{ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
alertDao.updateAlert(AlertStatus.EXECUTION_FAILURE, String.valueOf(retMaps.get(Constants.MESSAGE)), alert.getId()); |
|
|
|
if (null != retMaps) { |
|
|
|
logger.info("alert send error : {}", String.valueOf(retMaps.get(Constants.MESSAGE))); |
|
|
|
alertDao.updateAlert(AlertStatus.EXECUTION_FAILURE, String.valueOf(retMaps.get(Constants.MESSAGE)), alert.getId()); |
|
|
|
|
|
|
|
logger.info("alert send error : {}", retMaps.get(Constants.MESSAGE)); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|