|
|
|
@ -1,27 +1,12 @@
|
|
|
|
|
package com.glxp.api.admin.thread;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
|
|
import com.glxp.api.admin.constant.BasicProcessStatus;
|
|
|
|
|
import com.glxp.api.admin.constant.RedisContant;
|
|
|
|
|
import com.glxp.api.admin.dao.info.SyncDataSetDao;
|
|
|
|
|
import com.glxp.api.admin.dao.schedule.ScheduledDao;
|
|
|
|
|
import com.glxp.api.admin.entity.basic.BasicExportStatusEntity;
|
|
|
|
|
import com.glxp.api.admin.entity.basic.BasicExportStatusTimeEntity;
|
|
|
|
|
import com.glxp.api.admin.entity.info.ScheduledEntity;
|
|
|
|
|
import com.glxp.api.admin.entity.info.SystemParamConfigEntity;
|
|
|
|
|
import com.glxp.api.admin.req.basic.BasicExportStatusRequest;
|
|
|
|
|
import com.glxp.api.admin.entity.info.SyncDataSetEntity;
|
|
|
|
|
import com.glxp.api.admin.req.info.ScheduledRequest;
|
|
|
|
|
import com.glxp.api.admin.res.basic.SpsSyncBusResponse;
|
|
|
|
|
import com.glxp.api.admin.res.basic.SpsSyncDataResponse;
|
|
|
|
|
import com.glxp.api.admin.res.basic.SpsSyncOrderResponse;
|
|
|
|
|
import com.glxp.api.admin.res.basic.SpsSyncScheduleResponse;
|
|
|
|
|
import com.glxp.api.admin.service.basic.BasicExportService;
|
|
|
|
|
import com.glxp.api.admin.service.basic.BasicExportTimeService;
|
|
|
|
|
import com.glxp.api.admin.service.info.SystemParamConfigService;
|
|
|
|
|
import com.glxp.api.admin.util.CustomUtil;
|
|
|
|
|
import com.glxp.api.admin.util.DateUtil;
|
|
|
|
|
import com.glxp.api.admin.util.RedisUtil;
|
|
|
|
|
import com.glxp.api.admin.util.SpGetHttp;
|
|
|
|
|
import com.glxp.api.common.res.BaseResponse;
|
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
|
|
|
@ -31,8 +16,6 @@ import org.springframework.scheduling.support.CronTrigger;
|
|
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Component
|
|
|
|
@ -50,6 +33,8 @@ public class HeartTask implements SchedulingConfigurer {
|
|
|
|
|
DlUploadService dlUploadService;
|
|
|
|
|
@Resource
|
|
|
|
|
HeartService heartService;
|
|
|
|
|
@Resource
|
|
|
|
|
private SyncDataSetDao syncDataSetDao;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void configureTasks(ScheduledTaskRegistrar scheduledTaskRegistrar) {
|
|
|
|
@ -69,14 +54,11 @@ public class HeartTask implements SchedulingConfigurer {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void process() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SystemParamConfigEntity upConnect = systemParamConfigService.selectByParamKey("sync_upstream_enable");
|
|
|
|
|
if (upConnect.getParamValue().equals("1")) {
|
|
|
|
|
|
|
|
|
|
//查询数据同步设置
|
|
|
|
|
SyncDataSetEntity syncDataSetEntity = syncDataSetDao.selectSet();
|
|
|
|
|
if (syncDataSetEntity.isDownstreamEnable()) {
|
|
|
|
|
//定时上传最近更新数据至上游轮询时间
|
|
|
|
|
SystemParamConfigEntity systemParamConfigEntity1 = systemParamConfigService.selectByParamKey("sps_sync_upload_data");
|
|
|
|
|
long timeInterval1 = Long.parseLong(systemParamConfigEntity1.getParamValue()) * 60 * 1000;
|
|
|
|
|
long timeInterval1 = syncDataSetEntity.getSyncTime() * 60 * 1000;
|
|
|
|
|
long curTime1 = System.currentTimeMillis();
|
|
|
|
|
Long lastTime1 = (Long) redisUtil.get("SPS_SYNC_UPLOAD_DATA");
|
|
|
|
|
if (lastTime1 == null) {
|
|
|
|
@ -93,8 +75,7 @@ public class HeartTask implements SchedulingConfigurer {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//定时下载上游最近更新数据轮询时间
|
|
|
|
|
SystemParamConfigEntity systemParamConfigEntity = systemParamConfigService.selectByParamKey("sps_sync_donwload_data");
|
|
|
|
|
long timeInterval = Long.parseLong(systemParamConfigEntity.getParamValue()) * 60 * 1000;
|
|
|
|
|
long timeInterval = syncDataSetEntity.getSyncDownloadTime() * 60 * 1000;
|
|
|
|
|
long curTime = System.currentTimeMillis();
|
|
|
|
|
Long lastTime = (Long) redisUtil.get("SPS_SYNC_DOWNLOAD_DATA");
|
|
|
|
|
if (lastTime == null) {
|
|
|
|
@ -106,6 +87,7 @@ public class HeartTask implements SchedulingConfigurer {
|
|
|
|
|
redisUtil.set("SPS_SYNC_DOWNLOAD_DATA", curTime);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|