From 89463d38a06108fbc8426a7705fad0ab8261c1bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=9D=BE?= <8605635+zhang3064194730@user.noreply.gitee.com> Date: Thu, 27 Nov 2025 11:31:12 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=A5=E5=BA=93=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/ConsStockFlowServiceImpl.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/cash-service/product-service/src/main/java/com/czg/service/product/service/impl/ConsStockFlowServiceImpl.java b/cash-service/product-service/src/main/java/com/czg/service/product/service/impl/ConsStockFlowServiceImpl.java index 55bbfd6ef..9f59766ed 100644 --- a/cash-service/product-service/src/main/java/com/czg/service/product/service/impl/ConsStockFlowServiceImpl.java +++ b/cash-service/product-service/src/main/java/com/czg/service/product/service/impl/ConsStockFlowServiceImpl.java @@ -87,9 +87,7 @@ List insertList = new ArrayList<>(); List updateStockList = new ArrayList<>(); for (ConsStockFlow entity : entityList) { - if (entity.getId() == null) { - continue; - } + BeanUtil.copyProperties(head, entity, CopyOptions.create().ignoreNullValue()); entity.setShopId(shopId); entity.setInOutType(InOutTypeEnum.IN.value()); @@ -97,7 +95,14 @@ entity.setCreateUserId(createUserId); entity.setCreateUserName(createUserName); Long conId = entity.getConId(); - ConsInfo consInfo = consInfoMapper.selectOneById(conId); + ConsInfo consInfo; + if (entity.getId() == null) { + consInfo = consInfoMapper.selectOneByQuery(new QueryWrapper().like(ConsInfo::getConName, entity.getConName()) + .eq(ConsInfo::getShopId, shopId).limit(1)); + entity.setConId(consInfo == null ? null : consInfo.getId()); + }else { + consInfo = consInfoMapper.selectOneById(conId); + } if (consInfo == null) { continue; }