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);