新增接口,分类新增,校验

This commit is contained in:
liyj 2025-11-29 11:34:24 +08:00
parent f833a26698
commit cdeeef7b86
2 changed files with 12 additions and 2 deletions

View File

@ -1310,6 +1310,15 @@ public class ShopBaseProductCategoryServiceImpl extends BaseServiceImpl<ShopBase
productBrandService.saveOrUpdateBrand(shopBaseProductBrand);
}
List<ShopBaseProductCategory> shopBaseProductCategories = JSONUtil.toList(jsonArray, ShopBaseProductCategory.class);
//校验
for (ShopBaseProductCategory shopBaseProductCategory : shopBaseProductCategories) {
if(StringUtils.isEmpty(shopBaseProductCategory.getCategory_name())){
throw new ApiException("存在分类为空的值");
}
if(StringUtils.isEmpty(shopBaseProductCategory.getCategory_image())){
shopBaseProductCategory.setCategory_image("https://media-mall-prod-1259811287.cos.ap-guangzhou.myqcloud.com/media/media/plantform/20250906/b93a9751b35a49fca6cf979829230868.png");
}
}
syncThirdDataService.baseSaveOrUpdateShopBaseProductCategoryBatch(shopBaseProductCategories,jsonArray,storeId);
String redisKey = RedisConstant.Product_Cate_Key + ":" + storeId;
redisService.del(redisKey);

View File

@ -148,8 +148,9 @@ public abstract class SyncBaseThirdSxAbstract{
}
list.get(i).setStore_id(storeId); // app 记录传进来
list.get(i).setData_source(dataSource); // 思迅数据来源
list.get(i).setCategory_is_enable(1);
if(null== list.get(i).getCategory_is_enable()){
list.get(i).setCategory_is_enable(1);
}
JSONObject o = (JSONObject) categoryListJSON.get(i);
ShopBaseProductType productType=new ShopBaseProductType();
productType.setType_is_draft(1);//发布