|
@@ -6,6 +6,7 @@ import com.helospark.lightdi.annotation.Autowired;
|
|
import com.helospark.lightdi.annotation.Service;
|
|
import com.helospark.lightdi.annotation.Service;
|
|
import com.winhc.dataworks.flow.touch.service.QueryService;
|
|
import com.winhc.dataworks.flow.touch.service.QueryService;
|
|
import com.winhc.dataworks.flow.touch.utils.DingUtils;
|
|
import com.winhc.dataworks.flow.touch.utils.DingUtils;
|
|
|
|
+import com.winhc.dataworks.flow.touch.utils.SmsUtils;
|
|
import lombok.SneakyThrows;
|
|
import lombok.SneakyThrows;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
|
@@ -27,6 +28,13 @@ public class QueryStatus {
|
|
bean.waitTaskDone();
|
|
bean.waitTaskDone();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private static final String[] to = new String[]{
|
|
|
|
+ "18538736690"
|
|
|
|
+ , "17602140784"
|
|
|
|
+ , "13918612566"
|
|
|
|
+ , "18866771835"
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private QueryService queryService;
|
|
private QueryService queryService;
|
|
@@ -34,6 +42,9 @@ public class QueryStatus {
|
|
@Autowired
|
|
@Autowired
|
|
private DingUtils dingUtils;
|
|
private DingUtils dingUtils;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private SmsUtils smsUtils;
|
|
|
|
+
|
|
@SneakyThrows
|
|
@SneakyThrows
|
|
public void waitTaskDone() {
|
|
public void waitTaskDone() {
|
|
boolean flag = false;
|
|
boolean flag = false;
|
|
@@ -45,23 +56,27 @@ public class QueryStatus {
|
|
while (!queryService.isSuccess()) {
|
|
while (!queryService.isSuccess()) {
|
|
log.warn("等待上游数据同步...");
|
|
log.warn("等待上游数据同步...");
|
|
|
|
|
|
|
|
+ if (LocalTime.now().isAfter(exitTime)) {
|
|
|
|
+ log.error("数据同步任务长时间未完成,程序退出!");
|
|
|
|
+ smsUtils.send("ERROR,数据同步任务长时间未完成,数据处理程序退出!【odps数据同步】", to);
|
|
|
|
+ dingUtils.send("数据同步任务长时间未完成,程序退出!", "");
|
|
|
|
+ System.exit(-99);
|
|
|
|
+ }
|
|
|
|
+
|
|
if (LocalTime.now().isAfter(sendTime) && !flag) {
|
|
if (LocalTime.now().isAfter(sendTime) && !flag) {
|
|
flag = true;
|
|
flag = true;
|
|
log.error("上游数据同步任务长时间阻塞,请及时排查!");
|
|
log.error("上游数据同步任务长时间阻塞,请及时排查!");
|
|
- dingUtils.send("上游数据同步任务长时间阻塞,请及时排查!");
|
|
|
|
|
|
+ smsUtils.send("WARNING,上游数据同步任务长时间阻塞,请及时排查!【odps数据同步】", to);
|
|
|
|
+ dingUtils.send("上游数据同步任务长时间阻塞,请及时排查!", "");
|
|
}
|
|
}
|
|
|
|
|
|
- if (LocalTime.now().isAfter(exitTime)) {
|
|
|
|
- log.error("数据同步任务长时间未完成,程序退出!");
|
|
|
|
- dingUtils.send("数据同步任务长时间未完成,程序退出!");
|
|
|
|
- System.exit(-99);
|
|
|
|
- }
|
|
|
|
Thread.sleep(120000);
|
|
Thread.sleep(120000);
|
|
}
|
|
}
|
|
long between = ChronoUnit.MINUTES.between(startTime, LocalTime.now());
|
|
long between = ChronoUnit.MINUTES.between(startTime, LocalTime.now());
|
|
String msg = "上游数据同步任务已经完成!累计阻塞" + between + "分钟";
|
|
String msg = "上游数据同步任务已经完成!累计阻塞" + between + "分钟";
|
|
dingUtils.send(msg);
|
|
dingUtils.send(msg);
|
|
log.info(msg);
|
|
log.info(msg);
|
|
|
|
+ System.exit(0);
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|