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