From f833aea25970ebc7171815fd0b44e45473082691 Mon Sep 17 00:00:00 2001
From: gongchunyi <deslre0381@gmail.com>
Date: 星期五, 10 四月 2026 09:58:54 +0800
Subject: [PATCH] fix: 产品维护拉取数据时,未更新从平台拉取并且已删除的产品数据
---
src/main/java/com/ruoyi/production/service/impl/ProductMaterialServiceImpl.java | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/src/main/java/com/ruoyi/production/service/impl/ProductMaterialServiceImpl.java b/src/main/java/com/ruoyi/production/service/impl/ProductMaterialServiceImpl.java
index f54b264..d28ed6b 100644
--- a/src/main/java/com/ruoyi/production/service/impl/ProductMaterialServiceImpl.java
+++ b/src/main/java/com/ruoyi/production/service/impl/ProductMaterialServiceImpl.java
@@ -106,7 +106,10 @@
String searchFieldJson = searchConditions.toJSONString();
- JSONArray dataArr = AliDingUtils.getFormDataList(aliDingConfig, aliDingConfig.getMaterialCodeFormUuid(), searchFieldJson, productMaterialSkuService, ProductMaterialSku::getFormModifiedTime);
+ LambdaQueryWrapper<ProductMaterialSku> countWrapper = new LambdaQueryWrapper<>();
+ countWrapper.eq(ProductMaterialSku::getType, 1L);
+
+ JSONArray dataArr = AliDingUtils.getFormDataList(aliDingConfig, aliDingConfig.getMaterialCodeFormUuid(), searchFieldJson, productMaterialSkuService, ProductMaterialSku::getFormModifiedTime, countWrapper);
if (dataArr.isEmpty()) {
log.info("娌℃湁鏇村鏂版暟鎹渶瑕佸悓姝�");
@@ -169,6 +172,7 @@
sku.setFormModifiedTime(AliDingUtils.parseUtcTime(item.getString("modifiedTimeGMT")));
sku.setCreateTime(now);
sku.setUpdateTime(now);
+ sku.setType(1L);
list.add(sku);
}
@@ -407,6 +411,13 @@
if (ids == null || ids.isEmpty()) {
throw new ServiceException("璇烽�夋嫨鑷冲皯涓�鏉℃暟鎹�");
}
+
+ // 瀛樺湪瑙勬牸灏变笉鑳藉垹闄�
+ long skuCount = productMaterialSkuService.count(new LambdaQueryWrapper<ProductMaterialSku>().in(ProductMaterialSku::getProductId, ids));
+ if (skuCount > 0) {
+ throw new ServiceException("璇ョ墿鏂欎笅瀛樺湪瑙勬牸鏁版嵁锛屾棤娉曞垹闄�");
+ }
+
if (!this.removeByIds(ids)) {
throw new ServiceException("鍒犻櫎鐗╂枡澶辫触");
}
--
Gitblit v1.9.3