BaseBatch脚本报错提醒
This commit is contained in:
@@ -96,7 +96,7 @@ abstract class BaseBatch {
|
|||||||
exception = true
|
exception = true
|
||||||
e.printStackTrace()
|
e.printStackTrace()
|
||||||
__jms.monitor(batchName, '', extraData, e)
|
__jms.monitor(batchName, '', extraData, e)
|
||||||
def msg = "脚本发生异常 BatchName:${batchName}\t"
|
def msg = "脚本发生异常错误 BatchName:${batchName}\t"
|
||||||
def batchOwner = getBatchOwner(batch)
|
def batchOwner = getBatchOwner(batch)
|
||||||
if(batchOwner && batchOwner.size() > 0){
|
if(batchOwner && batchOwner.size() > 0){
|
||||||
def owner = null
|
def owner = null
|
||||||
@@ -110,8 +110,9 @@ abstract class BaseBatch {
|
|||||||
if(e){
|
if(e){
|
||||||
msg += "\tException:" + e.getClass().name
|
msg += "\tException:" + e.getClass().name
|
||||||
}
|
}
|
||||||
if(SystemUtils.IS_OS_LINUX){
|
def phoneNum = getBatchPhones(batch)
|
||||||
sendDingDingMsg("2307d2fec8314b3e8b4b83dd1d42da2e2051638e3e668f21e77ca01258bf682c",msg)
|
if(true){
|
||||||
|
sendDingDingMsg("ae14f50045e9375c354940a2afb86f14e453bd1f08f78da0ba6e788d35bccec4",msg, phoneNum)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Map<String, String> params = new HashMap<String, String>();
|
Map<String, String> params = new HashMap<String, String>();
|
||||||
@@ -174,6 +175,27 @@ abstract class BaseBatch {
|
|||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static def getBatchPhones(BaseBatch bb) {
|
||||||
|
def phones = []
|
||||||
|
try {
|
||||||
|
BatchOwner annotation = AnnotationUtils.findAnnotation(bb.getClass(), BatchOwner.class)
|
||||||
|
if (annotation) {
|
||||||
|
annotation.value().each {
|
||||||
|
def map = it.toMap()
|
||||||
|
if (map?.mobile) {
|
||||||
|
phones << map.mobile
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
bb.logWarn('!!!请使用' + BatchOwner.class.getName() + '注解标明本Batch的拥有者!!!')
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
bb.logWarn('!!!解析BatchOwner失败!!!', e)
|
||||||
|
}
|
||||||
|
return phones[0] ? phones[0] : ""
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static def getBatchDescribe(BaseBatch bb){
|
static def getBatchDescribe(BaseBatch bb){
|
||||||
try {
|
try {
|
||||||
BatchOwner annotation = AnnotationUtils.findAnnotation(bb.getClass(), BatchOwner.class)
|
BatchOwner annotation = AnnotationUtils.findAnnotation(bb.getClass(), BatchOwner.class)
|
||||||
@@ -217,8 +239,8 @@ abstract class BaseBatch {
|
|||||||
__jms.sendDingMsg(mobile, msg)
|
__jms.sendDingMsg(mobile, msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
def static sendDingDingMsg(String token, String msg){
|
def static sendDingDingMsg(String token, String msg, String phoneNum){
|
||||||
DingDingMessageUtil.sendTextMessage(token, msg);
|
DingDingMessageUtil.sendTextMessageAndAt(token, msg, phoneNum);
|
||||||
}
|
}
|
||||||
|
|
||||||
// def static getProp(String key){
|
// def static getProp(String key){
|
||||||
|
|||||||
Reference in New Issue
Block a user