|
|
|
@ -5,6 +5,7 @@ import com.docus.bgts.facade.IBgtsService;
|
|
|
|
|
import com.docus.bgts.facade.IMzSyncService;
|
|
|
|
|
import com.docus.bgts.utils.FileUtils;
|
|
|
|
|
import com.docus.bgts.utils.HttpUtils;
|
|
|
|
|
import javafx.scene.effect.ImageInput;
|
|
|
|
|
import org.apache.logging.log4j.LogManager;
|
|
|
|
|
import org.apache.logging.log4j.Logger;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
@ -12,6 +13,7 @@ import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
@ -22,9 +24,9 @@ public class MyScheduling {
|
|
|
|
|
|
|
|
|
|
public static String syncFlag;
|
|
|
|
|
|
|
|
|
|
static {
|
|
|
|
|
syncFlag=FileUtils.getJsonByName("syncFlag").toString();
|
|
|
|
|
}
|
|
|
|
|
// static {
|
|
|
|
|
// syncFlag=FileUtils.getJsonByName("syncFlag").toString();
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
IBgtsService bgtsService;
|
|
|
|
@ -34,47 +36,62 @@ public class MyScheduling {
|
|
|
|
|
|
|
|
|
|
private Logger logger = LogManager.getLogger(MyScheduling.class);
|
|
|
|
|
|
|
|
|
|
//5分钟执行一次
|
|
|
|
|
@Scheduled(fixedRate = 1000 * 60 * 5)
|
|
|
|
|
public void beat() {
|
|
|
|
|
Map<String, String> params = new HashMap<>();
|
|
|
|
|
params.put("code", String.valueOf(FileUtils.getJsonByName("collectorid")));
|
|
|
|
|
try {
|
|
|
|
|
HttpUtils.get(beatUrl, params);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
logger.info("心跳推送出错,可能是住院服务没有开启");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//5分钟执行一次心跳
|
|
|
|
|
// @Scheduled(fixedRate = 1000 * 60 * 5)
|
|
|
|
|
// public void beat() {
|
|
|
|
|
// Map<String, String> params = new HashMap<>();
|
|
|
|
|
// params.put("code", String.valueOf(FileUtils.getJsonByName("collectorid")));
|
|
|
|
|
// try {
|
|
|
|
|
// HttpUtils.get(beatUrl, params);
|
|
|
|
|
// } catch (Exception e) {
|
|
|
|
|
// e.printStackTrace();
|
|
|
|
|
// logger.info("心跳推送出错,可能是住院服务没有开启");
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 手麻采集器
|
|
|
|
|
* 10分钟执行一次
|
|
|
|
|
*/
|
|
|
|
|
@Scheduled(fixedRate = 1000 * 60 * 10)
|
|
|
|
|
public void collect() {
|
|
|
|
|
String collectorid = String.valueOf(FileUtils.getJsonByName("collectorid"));
|
|
|
|
|
String isStartCollect = String.valueOf(FileUtils.getJsonByName("isStartCollect"));
|
|
|
|
|
if (isStartCollect.equals("0")) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if ((!collectorid.equals(Codes.SMCODE.getCode())) && (!collectorid.equals(Codes.ZZCODE.getCode()))) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
bgtsService.timerCollect();
|
|
|
|
|
}
|
|
|
|
|
// @Scheduled(fixedRate = 1000 * 60 * 10)
|
|
|
|
|
// public void collect() {
|
|
|
|
|
// String collectorid = String.valueOf(FileUtils.getJsonByName("collectorid"));
|
|
|
|
|
// String isStartCollect = String.valueOf(FileUtils.getJsonByName("isStartCollect"));
|
|
|
|
|
// if (isStartCollect.equals("0")) {
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
|
|
|
|
// if ((!collectorid.equals(Codes.SMCODE.getCode())) && (!collectorid.equals(Codes.ZZCODE.getCode()))) {
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
|
|
|
|
// bgtsService.timerCollect();
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 增量同步程序
|
|
|
|
|
* 批量按需采集
|
|
|
|
|
* 5分钟执行一次
|
|
|
|
|
*/
|
|
|
|
|
@Scheduled(fixedRate = 1000 * 60 * 30)
|
|
|
|
|
public void syncIntegrality() {
|
|
|
|
|
if (null == syncFlag || "0".equals(syncFlag)) {
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
mzSyncService.addSyncIntegrality();
|
|
|
|
|
@Scheduled(fixedRate = 1000 * 5 )
|
|
|
|
|
public void collectByExamNo(){
|
|
|
|
|
String collectOpen = String.valueOf(FileUtils.getJsonByName("collectOpen"));
|
|
|
|
|
if (collectOpen.equals("1")){
|
|
|
|
|
logger.info("按需采集开始----------");
|
|
|
|
|
String collectStartDate = String.valueOf(FileUtils.getJsonByName("collectStartDate"));
|
|
|
|
|
String collectEndDate = String.valueOf(FileUtils.getJsonByName("collectEndDate"));
|
|
|
|
|
String collectorid = String.valueOf(FileUtils.getJsonByName("collectorid"));
|
|
|
|
|
bgtsService.collectByDate(collectStartDate,collectEndDate,collectorid);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 增量同步程序
|
|
|
|
|
*/
|
|
|
|
|
// @Scheduled(fixedRate = 1000 * 60 * 30)
|
|
|
|
|
// public void syncIntegrality() {
|
|
|
|
|
// if (null == syncFlag || "0".equals(syncFlag)) {
|
|
|
|
|
//
|
|
|
|
|
// } else {
|
|
|
|
|
// mzSyncService.addSyncIntegrality();
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|