From 600d2f8062dae8991666d378bbcfd452efbe3a0d Mon Sep 17 00:00:00 2001 From: zhaoqiaobo <583671871@qq.com> Date: Mon, 8 Jul 2024 16:16:48 +0800 Subject: [PATCH] =?UTF-8?q?feat(all):=20=E4=BF=AE=E6=94=B9=E6=8A=A5?= =?UTF-8?q?=E8=A1=A8=E5=BC=82=E6=AD=A5=E4=BB=BB=E5=8A=A1=E5=BC=82=E5=B8=B8?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/logpm/report/service/IAsyncService.java | 4 ++++ .../report/service/ReportDeliverService.java | 3 +++ .../report/service/impl/AsyncServiceImpl.java | 17 +++++++++++++++++ .../service/impl/ReportDataServiceImpl.java | 12 ++++++++++-- .../service/impl/ReportDeliverServiceImpl.java | 6 ++++++ 5 files changed, 40 insertions(+), 2 deletions(-) diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/service/IAsyncService.java b/blade-service/logpm-report/src/main/java/com/logpm/report/service/IAsyncService.java index 6a040a52a..ed9bb70e7 100644 --- a/blade-service/logpm-report/src/main/java/com/logpm/report/service/IAsyncService.java +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/service/IAsyncService.java @@ -1,6 +1,7 @@ package com.logpm.report.service; import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.logpm.report.dto.DeliveryTrainLoadedScanDTO; import java.util.List; import java.util.Map; @@ -13,4 +14,7 @@ public interface IAsyncService { void initExportData(ExportReader service, Wrapper query, Long pageSize, Long count, int finalNum, Map> pageMap, int finalI, CountDownLatch countDownLatch); + List getDeliveryTrainLoadSacnInvnByIds(List idBatch); + + List getDeliveryTrainLoadSacnByIds(List idBatch); } diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/service/ReportDeliverService.java b/blade-service/logpm-report/src/main/java/com/logpm/report/service/ReportDeliverService.java index ee83b2954..f570f2887 100644 --- a/blade-service/logpm-report/src/main/java/com/logpm/report/service/ReportDeliverService.java +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/service/ReportDeliverService.java @@ -3,6 +3,7 @@ package com.logpm.report.service; import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.logpm.report.dto.DeliveryTrainLoadedScanDTO; import com.logpm.report.query.DevilerDetailsQuery; import com.logpm.report.query.ReportCustomerQuery; import com.logpm.report.query.ReportDevilerQuery; @@ -93,4 +94,6 @@ public interface ReportDeliverService { void exportStockOrder(HttpServletResponse response, StockOrderVO vo, StockOrderQuery query); List getDeliveryTrainPageReader(Page page, Wrapper query); + + List getDeliveryTrainLoadSacnInvnByIds(List idBatch); } diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/service/impl/AsyncServiceImpl.java b/blade-service/logpm-report/src/main/java/com/logpm/report/service/impl/AsyncServiceImpl.java index 1cbda6745..983d28e7f 100644 --- a/blade-service/logpm-report/src/main/java/com/logpm/report/service/impl/AsyncServiceImpl.java +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/service/impl/AsyncServiceImpl.java @@ -4,11 +4,14 @@ import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollectionUtil; import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.logpm.report.dto.DeliveryTrainLoadedScanDTO; +import com.logpm.report.mapper.ReportDeliverMapeer; import com.logpm.report.service.ExportReader; import com.logpm.report.service.IAsyncService; import lombok.extern.slf4j.Slf4j; import org.apache.poi.ss.formula.functions.T; import org.springblade.common.annotations.LogpmAsync; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -24,6 +27,8 @@ public class AsyncServiceImpl implements IAsyncService { @Resource private Executor asyncExecutor; + @Autowired + private ReportDeliverMapeer reportDeliverMapeer; @Override public CompletableFuture getListCompletableFuture(ExportReader service, Wrapper query, Long pageSize, Long count, int finalNum, Map> pageMap, int finalI) { @@ -79,4 +84,16 @@ public class AsyncServiceImpl implements IAsyncService { // 当前线程执行完成 countDownLatch.countDown(); } + + @Override + @LogpmAsync("asyncExecutor") + public List getDeliveryTrainLoadSacnInvnByIds(List idBatch) { + return reportDeliverMapeer.getDeliveryTrainLoadSacnInvnByIds(idBatch); + } + + @Override + @LogpmAsync("asyncExecutor") + public List getDeliveryTrainLoadSacnByIds(List idBatch) { + return reportDeliverMapeer.getDeliveryTrainLoadSacnByIds(idBatch); + } } diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/service/impl/ReportDataServiceImpl.java b/blade-service/logpm-report/src/main/java/com/logpm/report/service/impl/ReportDataServiceImpl.java index 159a8d0c2..ba625bb3f 100644 --- a/blade-service/logpm-report/src/main/java/com/logpm/report/service/impl/ReportDataServiceImpl.java +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/service/impl/ReportDataServiceImpl.java @@ -6,11 +6,14 @@ import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.logpm.report.dto.DeliveryTrainLoadedScanDTO; import com.logpm.report.mapper.ReportDeliverMapeer; +import com.logpm.report.service.IAsyncService; import com.logpm.report.service.ReportDataService; import com.logpm.report.vo.ReportDevilerVO; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.jetbrains.annotations.NotNull; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; import org.springframework.stereotype.Service; import java.util.ArrayList; @@ -18,6 +21,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.concurrent.CompletableFuture; +import java.util.concurrent.Executor; import java.util.stream.Collectors; /** @@ -30,6 +34,10 @@ import java.util.stream.Collectors; public class ReportDataServiceImpl implements ReportDataService { private final ReportDeliverMapeer reportDeliverMapeer; + private final IAsyncService asyncService; + + @Autowired + private Executor asyncExecutor; @Override public List getReportDevilerVOList(IPage page, Wrapper queryWrapper) { @@ -62,7 +70,7 @@ public class ReportDataServiceImpl implements ReportDataService { private @NotNull CompletableFuture> getTrainLoadedScanInvnFuture(List idBatch, List deliveryTrainPage) { CompletableFuture> future = CompletableFuture.supplyAsync(() -> - reportDeliverMapeer.getDeliveryTrainLoadSacnInvnByIds(idBatch)); + asyncService.getDeliveryTrainLoadSacnInvnByIds(idBatch), (ThreadPoolTaskExecutor) asyncExecutor); future.thenAccept(list -> { if (CollUtil.isNotEmpty(list)) { // list 封装为map deliveryId为key @@ -86,7 +94,7 @@ public class ReportDataServiceImpl implements ReportDataService { private @NotNull CompletableFuture> getTrainLoadedScanFuture(List idBatch, List deliveryTrainPage) { CompletableFuture> future = CompletableFuture.supplyAsync(() -> - reportDeliverMapeer.getDeliveryTrainLoadSacnByIds(idBatch)); + asyncService.getDeliveryTrainLoadSacnByIds(idBatch), (ThreadPoolTaskExecutor) asyncExecutor); future.thenAccept(list -> { if (CollUtil.isNotEmpty(list)) { // list 封装为map deliveryId为key diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/service/impl/ReportDeliverServiceImpl.java b/blade-service/logpm-report/src/main/java/com/logpm/report/service/impl/ReportDeliverServiceImpl.java index 2136b5ea0..5130be9c2 100644 --- a/blade-service/logpm-report/src/main/java/com/logpm/report/service/impl/ReportDeliverServiceImpl.java +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/service/impl/ReportDeliverServiceImpl.java @@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.logpm.basicdata.feign.IBasicdataWarehouseClient; +import com.logpm.report.dto.DeliveryTrainLoadedScanDTO; import com.logpm.report.mapper.ReportDeliverMapeer; import com.logpm.report.query.DevilerDetailsQuery; import com.logpm.report.query.ReportCustomerQuery; @@ -262,4 +263,9 @@ public class ReportDeliverServiceImpl implements ReportDeliverService { return reportDataService.getReportDevilerVOList(page, query); } + @Override + public List getDeliveryTrainLoadSacnInvnByIds(List idBatch) { + return reportDeliverMapeer.getDeliveryTrainLoadSacnInvnByIds(idBatch); + } + }