From 70e1cfa9df81d28e941a3a54f423ad0306759db3 Mon Sep 17 00:00:00 2001 From: liyj <1617420630@qq.com> Date: Wed, 23 Jul 2025 16:59:18 +0800 Subject: [PATCH] =?UTF-8?q?=E5=95=86=E5=93=81=E5=9B=BE=E5=BA=93=E5=8C=B9?= =?UTF-8?q?=E9=85=8D=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ShopBaseProductCategoryController.java | 1 + .../service/impl/SyncBaseThirdSxAbstract.java | 4 ++- .../impl/SyncShopImageServiceImpl.java | 28 ++++++++++++++++++- 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/mall-shop/src/main/java/com/suisung/mall/shop/base/controller/admin/ShopBaseProductCategoryController.java b/mall-shop/src/main/java/com/suisung/mall/shop/base/controller/admin/ShopBaseProductCategoryController.java index d73a3f23..55280dba 100644 --- a/mall-shop/src/main/java/com/suisung/mall/shop/base/controller/admin/ShopBaseProductCategoryController.java +++ b/mall-shop/src/main/java/com/suisung/mall/shop/base/controller/admin/ShopBaseProductCategoryController.java @@ -118,6 +118,7 @@ public class ShopBaseProductCategoryController { }else { oldShopBaseProductCategory.setCategory_order(shopBaseProductCategory.getCategory_order()); oldShopBaseProductCategory.setCategory_is_enable(shopBaseProductCategory.getCategory_is_enable()); + oldShopBaseProductCategory.setCategory_image(shopBaseProductCategory.getCategory_image()); } return CommonResult.success(shopBaseProductCategoryService.editCategory(oldShopBaseProductCategory)); } diff --git a/mall-shop/src/main/java/com/suisung/mall/shop/sync/service/impl/SyncBaseThirdSxAbstract.java b/mall-shop/src/main/java/com/suisung/mall/shop/sync/service/impl/SyncBaseThirdSxAbstract.java index d333ce1b..2f449453 100644 --- a/mall-shop/src/main/java/com/suisung/mall/shop/sync/service/impl/SyncBaseThirdSxAbstract.java +++ b/mall-shop/src/main/java/com/suisung/mall/shop/sync/service/impl/SyncBaseThirdSxAbstract.java @@ -782,7 +782,9 @@ public abstract class SyncBaseThirdSxAbstract{ }else { String spectItem=StringUtils.isNotEmpty(shopProductBase.getSpecItem())?shopProductBase.getSpecItem():""; String unit=StringUtils.isNotEmpty(shopProductBase.getSpecUnit())?shopProductBase.getSpecUnit():""; - productName=productName+spectItem+"/"+unit; + if(StringUtils.isNotEmpty(spectItem)||StringUtils.isNotEmpty(unit)){ + productName=productName+spectItem+"/"+unit; + } } shopProductBase.setProduct_name(productName); // ShopProductIndex diff --git a/mall-shop/src/main/java/com/suisung/mall/shop/sync/service/impl/SyncShopImageServiceImpl.java b/mall-shop/src/main/java/com/suisung/mall/shop/sync/service/impl/SyncShopImageServiceImpl.java index 5200211e..d34f8f7a 100644 --- a/mall-shop/src/main/java/com/suisung/mall/shop/sync/service/impl/SyncShopImageServiceImpl.java +++ b/mall-shop/src/main/java/com/suisung/mall/shop/sync/service/impl/SyncShopImageServiceImpl.java @@ -35,6 +35,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.concurrent.ExecutorService; @@ -141,7 +142,8 @@ public class SyncShopImageServiceImpl implements SyncShopImageService { return "成功" + finalI; } catch (Exception e) { fails.getAndIncrement(); - return "失败"+finalI; + log.info("图库匹配失败:"+e.getMessage()); + return "失败"+finalI+":"+e.getMessage(); } })); } @@ -156,6 +158,7 @@ public class SyncShopImageServiceImpl implements SyncShopImageService { return "图库匹配成功" + finalI; } catch (Exception e) { fails.getAndIncrement(); + log.info("图库匹配失败:"+e.getMessage()); return "图库匹配失败"+finalI+":"+e.getMessage(); } })); @@ -224,7 +227,30 @@ public class SyncShopImageServiceImpl implements SyncShopImageService { if(CollectionUtil.isNotEmpty(shopProductImageList)){ shopProductImageService.updateBatchById(shopProductImageList); } + if(CollectionUtil.isNotEmpty(shopProductBaseList)){ + /** + * 如果没有规格不能上架 + */ + QueryWrapper shopProductBaseQueryWrapper=new QueryWrapper<>(); + shopProductBaseQueryWrapper.select("product_id","product_state_id"); + for(ShopProductBase shopProductBase:shopProductBaseList){ + shopProductBaseQueryWrapper.or(q->q.eq("product_id",shopProductBase.getProduct_id()).eq("product_state_id",StateCode.PRODUCT_STATE_OFF_THE_SHELF_UNCHECK)); + } + List list=shopProductBaseService.list(shopProductBaseQueryWrapper); + if(CollectionUtil.isNotEmpty(list)){ + Map map=new HashMap<>(); + for(ShopProductBase shopProductBase:list){ + map.put(shopProductBase.getProduct_id(),shopProductBase.getProduct_state_id()); + } + for(int i=0;i