From 16455b0136bcae7062d34a8f8f1214ee82d7fe52 Mon Sep 17 00:00:00 2001 From: x_z Date: Mon, 24 Oct 2022 10:21:31 +0800 Subject: [PATCH] =?UTF-8?q?1.=E8=B0=83=E6=95=B4=E7=A0=81=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E6=8E=92=E5=BA=8F=202.=E4=BF=AE=E5=A4=8D=E5=AF=BC=E5=85=A5?= =?UTF-8?q?=E5=BB=BA=E5=9E=9B=E7=A0=81=E5=88=86=E9=A1=B5=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../udi/admin/service/inout/WarehouseService.java | 2 +- .../admin/service/inout/WarehouseTempService.java | 3 ++- .../udi/admin/service/product/StackOrderService.java | 12 ++++-------- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/glxp/udi/admin/service/inout/WarehouseService.java b/src/main/java/com/glxp/udi/admin/service/inout/WarehouseService.java index 8007c15..5ac6280 100644 --- a/src/main/java/com/glxp/udi/admin/service/inout/WarehouseService.java +++ b/src/main/java/com/glxp/udi/admin/service/inout/WarehouseService.java @@ -67,7 +67,7 @@ public class WarehouseService { .eq(StrUtil.isNotBlank(warehouseQueryRequest.getBatchNo()), "batchNo", warehouseQueryRequest.getBatchNo()) .eq(StrUtil.isNotBlank(warehouseQueryRequest.getUdi()), "nameCode", warehouseQueryRequest.getUdi()) .eq(StrUtil.isNotBlank(warehouseQueryRequest.getCode()), "code", warehouseQueryRequest.getCode()) - .orderByAsc("id"); + .orderByDesc("id"); return wrapper; } diff --git a/src/main/java/com/glxp/udi/admin/service/inout/WarehouseTempService.java b/src/main/java/com/glxp/udi/admin/service/inout/WarehouseTempService.java index 41d3739..e612fd0 100644 --- a/src/main/java/com/glxp/udi/admin/service/inout/WarehouseTempService.java +++ b/src/main/java/com/glxp/udi/admin/service/inout/WarehouseTempService.java @@ -48,7 +48,8 @@ public class WarehouseTempService { wrapper.eq(StrUtil.isNotBlank(warehouseQueryRequest.getCode()), "code", warehouseQueryRequest.getCode()) .eq(StrUtil.isNotBlank(warehouseQueryRequest.getOrderId()), "orderId", warehouseQueryRequest.getOrderId()) .eq(StrUtil.isNotBlank(warehouseQueryRequest.getCorpOrderId()), "corpOrderId", warehouseQueryRequest.getCorpOrderId()) - .eq(null != warehouseQueryRequest.getCustomerId(), "customerId", warehouseQueryRequest.getCustomerId()); + .eq(null != warehouseQueryRequest.getCustomerId(), "customerId", warehouseQueryRequest.getCustomerId()) + .orderByDesc("id"); return wrapper; } diff --git a/src/main/java/com/glxp/udi/admin/service/product/StackOrderService.java b/src/main/java/com/glxp/udi/admin/service/product/StackOrderService.java index c3e2cf8..53b2b30 100644 --- a/src/main/java/com/glxp/udi/admin/service/product/StackOrderService.java +++ b/src/main/java/com/glxp/udi/admin/service/product/StackOrderService.java @@ -124,16 +124,12 @@ public class StackOrderService { //校验码在数据库中是否重复 //每1000个一次查询,按照码数量分批 - int batchNum = codeList.size() / 1000 + (codeList.size() % 1000 != 0 ? 1 : 0); - CountDownLatch checkCodeCDL = new CountDownLatch(batchNum); - - for (int i = 1; i <= batchNum; i++) { - int start = (i - 1) * 1000; - int end = i == 1 ? (codeList.size() - 1) : i * 1000; - List codePage = codeList.subList(start, end); + List> codePage = ListUtil.split(codeList, 1000); + CountDownLatch checkCodeCDL = new CountDownLatch(codePage.size()); + for (List codes : codePage) { QueryWrapper wrapper = new QueryWrapper<>(); - wrapper.in("code", codePage); + wrapper.in("code", codes); executorService.submit(() -> { Long count = stackCodeDao.selectCount(wrapper);