diff --git a/src/main/java/com/glxp/api/service/sync/SpsSyncDownloadService.java b/src/main/java/com/glxp/api/service/sync/SpsSyncDownloadService.java index 256362fc..27bc15f0 100644 --- a/src/main/java/com/glxp/api/service/sync/SpsSyncDownloadService.java +++ b/src/main/java/com/glxp/api/service/sync/SpsSyncDownloadService.java @@ -35,6 +35,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.ApplicationContext; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -230,9 +231,12 @@ public class SpsSyncDownloadService { * @return */ private boolean needExec(int... set) { - return CollectionUtil.contains(Collections.singleton(set), 2); + + return Arrays.stream(set).filter(i -> i == 2).findAny().isPresent(); } + private final ApplicationContext applicationContext; + /** * 创建一个同步任务 * @@ -259,7 +263,7 @@ public class SpsSyncDownloadService { if (exportStatus == null || BasicExportStatusEnum.COMPLETED.getCode().equals(exportStatus.getStatus())) { //判断有无新数据 - Boolean hasData = hasDataMethod.apply(this); + Boolean hasData = hasDataMethod.apply(applicationContext.getBean(this.getClass())); if (Boolean.FALSE.equals(hasData)) { return; } @@ -274,7 +278,7 @@ public class SpsSyncDownloadService { .build(); basicExportService.save(exportStatus); } else if (exportStatus.getStatus().equals(BasicExportStatusEnum.WAIT_BUILT.getCode())) {//文件待生成 - createFileMethod.apply(this); + createFileMethod.apply(applicationContext.getBean(this.getClass())); } }