异步同步

master
wj 2 years ago
parent 42d931d688
commit f170787fc5

@ -26,9 +26,11 @@ import com.glxp.api.service.sync.BasicExportService;
import com.glxp.api.service.sync.BasicExportTimeService;
import com.glxp.api.service.sync.SpsSyncDownloadService;
import com.glxp.api.service.sync.SyncDataSetService;
import com.glxp.api.task.TaskExecutorConfig;
import com.glxp.api.util.CustomUtil;
import com.glxp.api.util.RedisUtil;
import lombok.RequiredArgsConstructor;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@ -42,6 +44,7 @@ import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.Date;
import java.util.List;
import java.util.concurrent.CompletableFuture;
@RestController
@RequiredArgsConstructor
@ -238,6 +241,7 @@ public class SpsSyncExportStatusController {
private final SpsSyncDownloadService spsSyncDownloadService;
private final SyncDataSetService syncDataSetService;
private final ThreadPoolTaskExecutor executorConfig;
/**
*
@ -257,6 +261,7 @@ public class SpsSyncExportStatusController {
if (syncDataSetEntity.getSyncTime() == null) {
return ResultVOUtils.error(ResultEnum.NOT_NETWORK.getCode(), "缺少初始化数据");
}
CompletableFuture future = CompletableFuture.runAsync(() -> {
switch (req.getExportType()) {
case IO_ORDER:
spsSyncDownloadService.syncOrderTask();
@ -267,6 +272,7 @@ public class SpsSyncExportStatusController {
default:
spsSyncDownloadService.syncData(syncDataSetEntity, req.getExportType(), req.getSyncTime());
}
}, executorConfig);
return ResultVOUtils.success();
}

Loading…
Cancel
Save