商品图库匹配优化

This commit is contained in:
liyj 2025-07-23 16:59:18 +08:00
parent 97f8282494
commit 70e1cfa9df
3 changed files with 31 additions and 2 deletions

View File

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

View File

@ -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

View File

@ -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<ShopProductBase> 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<ShopProductBase> list=shopProductBaseService.list(shopProductBaseQueryWrapper);
if(CollectionUtil.isNotEmpty(list)){
Map<Long,Integer> map=new HashMap<>();
for(ShopProductBase shopProductBase:list){
map.put(shopProductBase.getProduct_id(),shopProductBase.getProduct_state_id());
}
for(int i=0;i<shopProductBaseList.size();i++){
ShopProductBase shopBase=shopProductBaseList.get(i);
if(map.containsKey(shopBase.getProduct_id())){
shopBase.setProduct_state_id(StateCode.PRODUCT_STATE_OFF_THE_SHELF_UNCHECK);
shopProductIndexList.get(i).setProduct_state_id(StateCode.PRODUCT_STATE_OFF_THE_SHELF_UNCHECK);
}
}
}
shopProductBaseService.updateBatchById(shopProductBaseList);
}
if(CollectionUtil.isNotEmpty(shopProductItemList)){