思迅商品同步
This commit is contained in:
parent
271ddfbb53
commit
0c8d281f73
@ -39,6 +39,9 @@ public class ShopProductBase implements Serializable {
|
||||
@ApiModelProperty(value = "产品名称(in=>2,100)")
|
||||
private String product_name;
|
||||
|
||||
@ApiModelProperty(value = "商品货号")
|
||||
private String product_number;
|
||||
|
||||
@ApiModelProperty(value = "商品卖点:商品广告词")
|
||||
private String product_tips;
|
||||
|
||||
|
||||
@ -12,6 +12,8 @@ import com.suisung.mall.common.utils.HttpServletUtils;
|
||||
import com.suisung.mall.common.utils.I18nUtil;
|
||||
import com.suisung.mall.shop.config.BaiduConfig;
|
||||
import okhttp3.*;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
@ -22,9 +24,10 @@ import java.util.Map;
|
||||
|
||||
public class BaiduAi {
|
||||
static final OkHttpClient HTTP_CLIENT = new OkHttpClient().newBuilder().build();
|
||||
private static final Logger log = LoggerFactory.getLogger(BaiduAi.class);
|
||||
|
||||
|
||||
public static void main(String[] args) throws IOException {
|
||||
public static void main(String[] args) {
|
||||
|
||||
String url = "https://lancerdt.oss-accelerate.aliyuncs.com/mall/images/media/store/10002/20240123d3c27007baf740c9bdc429f850259501.jpg";
|
||||
BaiduAiBriefDTO brief = new BaiduAiBriefDTO();
|
||||
@ -64,7 +67,7 @@ public class BaiduAi {
|
||||
|
||||
}
|
||||
|
||||
public static String addProductImg(String url, BaiduAiBriefDTO brief) throws IOException {
|
||||
public static String addProductImg(String url, BaiduAiBriefDTO brief) {
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("url", url);
|
||||
map.put("brief", JSON.toJSONString(brief));
|
||||
@ -73,39 +76,38 @@ public class BaiduAi {
|
||||
|
||||
try {
|
||||
par = HttpServletUtils.generateParams(map, "utf-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
|
||||
RequestBody body = RequestBody.create(mediaType, par);
|
||||
Request request = new Request.Builder()
|
||||
.url("https://aip.baidubce.com/rest/2.0/image-classify/v1/realtime_search/product/add?access_token=" + BaiduConfig.getAccessToken())
|
||||
.method("POST", body)
|
||||
.addHeader("Content-Type", "application/x-www-form-urlencoded")
|
||||
.addHeader("Accept", "application/json")
|
||||
.build();
|
||||
Response response = HTTP_CLIENT.newCall(request).execute();
|
||||
MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
|
||||
RequestBody body = RequestBody.create(mediaType, par);
|
||||
Request request = new Request.Builder()
|
||||
.url("https://aip.baidubce.com/rest/2.0/image-classify/v1/realtime_search/product/add?access_token=" + BaiduConfig.getAccessToken())
|
||||
.method("POST", body)
|
||||
.addHeader("Content-Type", "application/x-www-form-urlencoded")
|
||||
.addHeader("Accept", "application/json")
|
||||
.build();
|
||||
Response response = HTTP_CLIENT.newCall(request).execute();
|
||||
|
||||
String resultStr = response.body().string();
|
||||
System.out.println(resultStr);
|
||||
String resultStr = response.body().string();
|
||||
System.out.println(resultStr);
|
||||
|
||||
JSONObject jsonObject = JSONUtil.parseObj(resultStr);
|
||||
Integer errCode = Convert.toInt(jsonObject.get("error_code"));
|
||||
String errMessage = Convert.toStr(jsonObject.get("error_msg"));
|
||||
String contSign = Convert.toStr(jsonObject.get("cont_sign"));
|
||||
JSONObject jsonObject = JSONUtil.parseObj(resultStr);
|
||||
Integer errCode = Convert.toInt(jsonObject.get("error_code"));
|
||||
// String errMessage = Convert.toStr(jsonObject.get("error_msg"));
|
||||
String contSign = Convert.toStr(jsonObject.get("cont_sign"));
|
||||
|
||||
if (CheckUtil.isEmpty(errCode)) {
|
||||
if (CheckUtil.isNotEmpty(errCode)) {
|
||||
return "";
|
||||
}
|
||||
|
||||
} else {
|
||||
return contSign;
|
||||
} catch (Exception e) {
|
||||
log.error("Baidu Ai 添加图片异常", e.getMessage());
|
||||
return "";
|
||||
}
|
||||
|
||||
return contSign;
|
||||
}
|
||||
|
||||
|
||||
public static String editProductImg(String url, BaiduAiBriefDTO brief) throws IOException {
|
||||
public static String editProductImg(String url, BaiduAiBriefDTO brief) {
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("url", url);
|
||||
map.put("brief", JSON.toJSONString(brief));
|
||||
@ -114,40 +116,41 @@ public class BaiduAi {
|
||||
|
||||
try {
|
||||
par = HttpServletUtils.generateParams(map, "utf-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
|
||||
RequestBody body = RequestBody.create(mediaType, par);
|
||||
Request request = new Request.Builder()
|
||||
.url("https://aip.baidubce.com/rest/2.0/image-classify/v1/realtime_search/product/update?access_token=" + BaiduConfig.getAccessToken())
|
||||
.method("POST", body)
|
||||
.addHeader("Content-Type", "application/x-www-form-urlencoded")
|
||||
.addHeader("Accept", "application/json")
|
||||
.build();
|
||||
Response response = HTTP_CLIENT.newCall(request).execute();
|
||||
MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
|
||||
RequestBody body = RequestBody.create(mediaType, par);
|
||||
Request request = new Request.Builder()
|
||||
.url("https://aip.baidubce.com/rest/2.0/image-classify/v1/realtime_search/product/update?access_token=" + BaiduConfig.getAccessToken())
|
||||
.method("POST", body)
|
||||
.addHeader("Content-Type", "application/x-www-form-urlencoded")
|
||||
.addHeader("Accept", "application/json")
|
||||
.build();
|
||||
Response response = HTTP_CLIENT.newCall(request).execute();
|
||||
|
||||
String resultStr = response.body().string();
|
||||
System.out.println(resultStr);
|
||||
String resultStr = response.body().string();
|
||||
System.out.println(resultStr);
|
||||
|
||||
JSONObject jsonObject = JSONUtil.parseObj(resultStr);
|
||||
JSONObject jsonObject = JSONUtil.parseObj(resultStr);
|
||||
|
||||
Integer errCode = Convert.toInt(jsonObject.get("error_code"));
|
||||
String errMessage = Convert.toStr(jsonObject.get("error_msg"));
|
||||
String contSign = Convert.toStr(jsonObject.get("cont_sign"));
|
||||
Integer errCode = Convert.toInt(jsonObject.get("error_code"));
|
||||
String errMessage = Convert.toStr(jsonObject.get("error_msg"));
|
||||
String contSign = Convert.toStr(jsonObject.get("cont_sign"));
|
||||
|
||||
if (CheckUtil.isEmpty(errCode)) {
|
||||
if (CheckUtil.isEmpty(errCode)) {
|
||||
|
||||
} else {
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
|
||||
return contSign;
|
||||
} catch (Exception e) {
|
||||
log.error("Baidu Ai 编辑图片异常", e.getMessage());
|
||||
return "";
|
||||
}
|
||||
|
||||
return contSign;
|
||||
}
|
||||
|
||||
|
||||
public static String removeProductImg(String url, String cont_sign) throws IOException {
|
||||
public static String removeProductImg(String url, String cont_sign) {
|
||||
Map<String, String> map = new HashMap<>();
|
||||
|
||||
if (CheckUtil.isNotEmpty(url)) {
|
||||
@ -162,38 +165,37 @@ public class BaiduAi {
|
||||
|
||||
try {
|
||||
par = HttpServletUtils.generateParams(map, "utf-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
|
||||
RequestBody body = RequestBody.create(mediaType, par);
|
||||
Request request = new Request.Builder()
|
||||
.url("https://aip.baidubce.com/rest/2.0/image-classify/v1/realtime_search/product/delete?access_token=" + BaiduConfig.getAccessToken())
|
||||
.method("POST", body)
|
||||
.addHeader("Content-Type", "application/x-www-form-urlencoded")
|
||||
.addHeader("Accept", "application/json")
|
||||
.build();
|
||||
Response response = HTTP_CLIENT.newCall(request).execute();
|
||||
MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
|
||||
RequestBody body = RequestBody.create(mediaType, par);
|
||||
Request request = new Request.Builder()
|
||||
.url("https://aip.baidubce.com/rest/2.0/image-classify/v1/realtime_search/product/delete?access_token=" + BaiduConfig.getAccessToken())
|
||||
.method("POST", body)
|
||||
.addHeader("Content-Type", "application/x-www-form-urlencoded")
|
||||
.addHeader("Accept", "application/json")
|
||||
.build();
|
||||
Response response = HTTP_CLIENT.newCall(request).execute();
|
||||
|
||||
String resultStr = response.body().string();
|
||||
System.out.println(resultStr);
|
||||
String resultStr = response.body().string();
|
||||
// System.out.println(resultStr);
|
||||
|
||||
JSONObject jsonObject = JSONUtil.parseObj(resultStr);
|
||||
Integer errCode = Convert.toInt(jsonObject.get("error_code"));
|
||||
String errMessage = Convert.toStr(jsonObject.get("error_msg"));
|
||||
String contSign = Convert.toStr(jsonObject.get("cont_sign"));
|
||||
JSONObject jsonObject = JSONUtil.parseObj(resultStr);
|
||||
Integer errCode = Convert.toInt(jsonObject.get("error_code"));
|
||||
String errMessage = Convert.toStr(jsonObject.get("error_msg"));
|
||||
String contSign = Convert.toStr(jsonObject.get("cont_sign"));
|
||||
|
||||
if (CheckUtil.isEmpty(errCode)) {
|
||||
if (CheckUtil.isNotEmpty(errCode)) {
|
||||
return "";
|
||||
}
|
||||
|
||||
} else {
|
||||
return contSign;
|
||||
} catch (Exception e) {
|
||||
log.error("Baidu Ai 删除图片异常", e.getMessage());
|
||||
return "";
|
||||
}
|
||||
|
||||
return contSign;
|
||||
}
|
||||
|
||||
public static List<Map> searchProductImg(String url, Integer pn, Integer rn) throws IOException {
|
||||
public static List<Map> searchProductImg(String url, Integer pn, Integer rn) {
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("url", url);
|
||||
|
||||
@ -209,45 +211,47 @@ public class BaiduAi {
|
||||
|
||||
try {
|
||||
par = HttpServletUtils.generateParams(map, "utf-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
|
||||
RequestBody body = RequestBody.create(mediaType, par);
|
||||
Request request = new Request.Builder()
|
||||
.url("https://aip.baidubce.com/rest/2.0/image-classify/v1/realtime_search/product/search?access_token=" + BaiduConfig.getAccessToken())
|
||||
.method("POST", body)
|
||||
.addHeader("Content-Type", "application/x-www-form-urlencoded")
|
||||
.addHeader("Accept", "application/json")
|
||||
.build();
|
||||
Response response = HTTP_CLIENT.newCall(request).execute();
|
||||
|
||||
String resultStr = response.body().string();
|
||||
System.out.println(resultStr);
|
||||
MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
|
||||
RequestBody body = RequestBody.create(mediaType, par);
|
||||
Request request = new Request.Builder()
|
||||
.url("https://aip.baidubce.com/rest/2.0/image-classify/v1/realtime_search/product/search?access_token=" + BaiduConfig.getAccessToken())
|
||||
.method("POST", body)
|
||||
.addHeader("Content-Type", "application/x-www-form-urlencoded")
|
||||
.addHeader("Accept", "application/json")
|
||||
.build();
|
||||
Response response = HTTP_CLIENT.newCall(request).execute();
|
||||
|
||||
JSONObject jsonObject = JSONUtil.parseObj(resultStr);
|
||||
String resultStr = response.body().string();
|
||||
System.out.println(resultStr);
|
||||
|
||||
Integer errCode = Convert.toInt(jsonObject.get("error_code"));
|
||||
String errMessage = Convert.toStr(jsonObject.get("error_msg"));
|
||||
String contSign = Convert.toStr(jsonObject.get("cont_sign"));
|
||||
JSONObject jsonObject = JSONUtil.parseObj(resultStr);
|
||||
|
||||
Integer result_num = Convert.toInt(jsonObject.get("result_num"));
|
||||
Integer errCode = Convert.toInt(jsonObject.get("error_code"));
|
||||
String errMessage = Convert.toStr(jsonObject.get("error_msg"));
|
||||
String contSign = Convert.toStr(jsonObject.get("cont_sign"));
|
||||
|
||||
List<Map> items = new ArrayList<>();
|
||||
Integer result_num = Convert.toInt(jsonObject.get("result_num"));
|
||||
|
||||
if (CheckUtil.isNotEmpty(result_num)) {
|
||||
JSONArray resData = (JSONArray) jsonObject.get("result");
|
||||
List<Map> items = new ArrayList<>();
|
||||
|
||||
if (resData == null) {
|
||||
throw new ApiException(I18nUtil._("返回结果为空!"));
|
||||
if (CheckUtil.isNotEmpty(result_num)) {
|
||||
JSONArray resData = (JSONArray) jsonObject.get("result");
|
||||
if (resData == null) {
|
||||
log.error(I18nUtil._("Baidu Ai 搜索图片,返回结果为空!"));
|
||||
return null;
|
||||
}
|
||||
|
||||
items = JSONUtil.toList(resData, Map.class);
|
||||
} else {
|
||||
return items;
|
||||
}
|
||||
|
||||
items = JSONUtil.toList(resData, Map.class);
|
||||
} else {
|
||||
return items;
|
||||
} catch (Exception e) {
|
||||
log.error("Baidu Ai 搜索图片异常", e.getMessage());
|
||||
return null;
|
||||
}
|
||||
|
||||
return items;
|
||||
}
|
||||
}
|
||||
@ -259,6 +259,14 @@ public interface ShopProductBaseService extends IBaseService<ShopProductBase> {
|
||||
*/
|
||||
Map getProductBasicInfo(Long product_id, Integer store_id);
|
||||
|
||||
/**
|
||||
* 根据店铺Id和商品货号,获取商品Id
|
||||
* @param store_id
|
||||
* @param product_number
|
||||
* @return
|
||||
*/
|
||||
Long getProductIdByStoreAndProductNumber(Integer store_id, String product_number);
|
||||
|
||||
@Transactional
|
||||
boolean updateProductSubsite(Integer store_id);
|
||||
|
||||
|
||||
@ -67,6 +67,7 @@ import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.util.Pair;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
@ -98,149 +99,102 @@ import static io.seata.common.util.LambdaUtils.distinctByKey;
|
||||
@Transactional
|
||||
@Service
|
||||
public class ShopProductBaseServiceImpl extends BaseServiceImpl<ShopProductBaseMapper, ShopProductBase> implements ShopProductBaseService {
|
||||
private final Logger logger = LoggerFactory.getLogger(ShopProductBaseServiceImpl.class);
|
||||
@Autowired
|
||||
private ShopBaseProductCategoryService shopBaseProductCategoryService;
|
||||
|
||||
@Autowired
|
||||
private ShopProductMetaService shopProductMetaService;
|
||||
|
||||
@Autowired
|
||||
private ShopProductPreSaleService shopProductPreSaleService;
|
||||
|
||||
@Autowired
|
||||
private ShopProductBaseService shopProductBaseService;
|
||||
|
||||
@Autowired
|
||||
private ShopStoreAnalyticsService shopStoreAnalyticsService;
|
||||
|
||||
@Autowired
|
||||
private ShopProductAnalyticsService shopProductAnalyticsService;
|
||||
|
||||
@Autowired
|
||||
private ShopProductDetailService shopProductDetailService;
|
||||
|
||||
@Autowired
|
||||
private ShopProductInfoService shopProductInfoService;
|
||||
|
||||
@Autowired
|
||||
private ShopProductValidPeriodService shopProductValidPeriodService;
|
||||
|
||||
@Autowired
|
||||
private ShopProductItemService shopProductItemService;
|
||||
|
||||
@Autowired
|
||||
private AccountBaseConfigService accountBaseConfigService;
|
||||
|
||||
@Autowired
|
||||
private ShopBaseCurrencyService shopBaseCurrencyService;
|
||||
|
||||
@Autowired
|
||||
private ShopUserCartService shopUserCartService;
|
||||
|
||||
@Autowired
|
||||
private ShopStoreTransportTypeService transportTypeService;
|
||||
|
||||
@Autowired
|
||||
private ShopBaseProductCategoryService productCategoryService;
|
||||
|
||||
@Autowired
|
||||
private ShopProductIndexService shopProductIndexService;
|
||||
|
||||
@Autowired
|
||||
private ShopProductImageService shopProductImageService;
|
||||
|
||||
@Autowired
|
||||
private ShopStoreBaseService shopStoreBaseService;
|
||||
|
||||
@Autowired
|
||||
private ShopBaseProductSpecService baseProductSpecService;
|
||||
|
||||
@Autowired
|
||||
private ShopBaseStoreGradeService baseStoreGradeService;
|
||||
|
||||
@Autowired
|
||||
private ShopProductAssistIndexService assistIndexService;
|
||||
|
||||
@Autowired
|
||||
private ShopProductDataService shopProductDataService;
|
||||
|
||||
@Autowired
|
||||
private ShopProductItemSeqService shopProductItemSeqService;
|
||||
|
||||
@Autowired
|
||||
private ShopProductValidPeriodService validPeriodService;
|
||||
|
||||
@Autowired
|
||||
private ShopUserSearchHistoryService shopUserSearchHistoryService;
|
||||
|
||||
@Autowired
|
||||
private ShopBaseStateCodeService shopBaseStateCodeService;
|
||||
|
||||
@Autowired
|
||||
private ShopProductBaseMapper shopProductBaseMapper;
|
||||
|
||||
@Autowired
|
||||
private ShopStoreActivityBaseService shopStoreActivityBaseService;
|
||||
|
||||
@Autowired
|
||||
private ShopStoreActivityItemService shopStoreActivityItemService;
|
||||
|
||||
@Autowired
|
||||
private ShopActivityGroupbookingService shopActivityGroupbookingService;
|
||||
|
||||
@Autowired
|
||||
private ShopBaseProductTypeService shopBaseProductTypeService;
|
||||
|
||||
@Autowired
|
||||
private ShopNumberSeqService shopNumberSeqService;
|
||||
|
||||
@Autowired
|
||||
private EduService eduService;
|
||||
|
||||
@Autowired
|
||||
private ShopBaseDistrictService shopBaseDistrictService;
|
||||
|
||||
@Autowired
|
||||
private ShopBaseContractTypeService shopBaseContractTypeService;
|
||||
|
||||
@Autowired
|
||||
private ShopBaseMarketCategoryService shopBaseMarketCategoryService;
|
||||
|
||||
@Autowired
|
||||
private MessageService messageService;
|
||||
|
||||
@Autowired
|
||||
private ShopOrderItemService shopOrderItemService;
|
||||
|
||||
@Autowired
|
||||
private SearchService searchService;
|
||||
|
||||
@Autowired
|
||||
private ShopChainItemService shopChainItemService;
|
||||
|
||||
@Autowired
|
||||
private ShopUserProductBrowseService shopUserProductBrowseService;
|
||||
|
||||
@Autowired
|
||||
private ShopUserProductBuyService shopUserProductBuyService;
|
||||
|
||||
@Autowired
|
||||
private ShopUserFavoritesItemService shopUserFavoritesItemService;
|
||||
|
||||
@Autowired
|
||||
private MqMessageService mqMessageService;
|
||||
|
||||
@Autowired
|
||||
private ThreadPoolExecutor executor;
|
||||
|
||||
@Autowired
|
||||
private ShopBaseLangMetaService shopBaseLangMetaService;
|
||||
|
||||
@Resource
|
||||
private SxSyncGoodsService sxSyncGoodsService;
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(ShopProductBaseServiceImpl.class);
|
||||
|
||||
@Override
|
||||
public boolean trySaveProduct(String productObj, String productItems) {
|
||||
|
||||
@ -690,7 +644,7 @@ public class ShopProductBaseServiceImpl extends BaseServiceImpl<ShopProductBaseM
|
||||
}
|
||||
|
||||
/**
|
||||
* 尝试保存一个商品所有信息
|
||||
* 尝试保存一个商品所有信息,会抛出异常
|
||||
*
|
||||
* @param shopProductBase 商品基础表信息
|
||||
* @param shopProductIndex 商品索引表信息
|
||||
@ -704,35 +658,67 @@ public class ShopProductBaseServiceImpl extends BaseServiceImpl<ShopProductBaseM
|
||||
* @return
|
||||
*/
|
||||
public boolean trySaveProduct(ShopProductBase shopProductBase, ShopProductIndex shopProductIndex, ShopProductData shopProductData, ShopProductDetail shopProductDetail, ShopProductInfo shopProductInfo, List<ShopProductItem> shopProductItemList, List<ShopProductImage> shopProductImageList, ShopProductValidPeriod shopProductValidPeriod, List<ShopProductAssistIndex> shopProductAssistIndexList) {
|
||||
Pair<Boolean, String> pair = saveProduct(shopProductBase, shopProductIndex, shopProductData, shopProductDetail, shopProductInfo, shopProductItemList, shopProductImageList, shopProductValidPeriod, shopProductAssistIndexList);
|
||||
if (!pair.getFirst()) {
|
||||
throw new ApiException(pair.getSecond());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存一个商品所有信息,不会抛出异常
|
||||
*
|
||||
* @param shopProductBase 商品基础表信息
|
||||
* @param shopProductIndex 商品索引表信息
|
||||
* @param shopProductData 商品数据表信息
|
||||
* @param shopProductDetail 商品详情表信息
|
||||
* @param shopProductInfo 商品信息表信息
|
||||
* @param shopProductItemList 商品SKU信息
|
||||
* @param shopProductImageList 商品图片信息
|
||||
* @param shopProductValidPeriod 虚拟商品信息
|
||||
* @param shopProductAssistIndexList 辅助信息表
|
||||
* @return
|
||||
*/
|
||||
public Pair<Boolean, String> saveProduct(ShopProductBase shopProductBase, ShopProductIndex shopProductIndex, ShopProductData shopProductData, ShopProductDetail shopProductDetail, ShopProductInfo shopProductInfo, List<ShopProductItem> shopProductItemList, List<ShopProductImage> shopProductImageList, ShopProductValidPeriod shopProductValidPeriod, List<ShopProductAssistIndex> shopProductAssistIndexList) {
|
||||
Integer store_id = shopProductBase.getStore_id();
|
||||
ShopStoreBase storeBase = null;
|
||||
if (store_id == null) {
|
||||
return false;
|
||||
} else {
|
||||
storeBase = shopStoreBaseService.get(store_id);
|
||||
Integer store_type = storeBase.getStore_type();
|
||||
// 判断是否为供应商店铺
|
||||
if (store_type == 2) {
|
||||
shopProductIndex.setProduct_fx_enable(1); // 供应商是否允许批发市场分销
|
||||
shopProductIndex.setProduct_dist_enable(0); // 三级分销逻辑
|
||||
return Pair.of(false, I18nUtil._("缺少店铺ID!"));
|
||||
}
|
||||
|
||||
storeBase = shopStoreBaseService.get(store_id);
|
||||
Integer store_type = storeBase.getStore_type();
|
||||
// 判断是否为供应商店铺
|
||||
if (store_type == 2) {
|
||||
shopProductIndex.setProduct_fx_enable(1); // 供应商是否允许批发市场分销
|
||||
shopProductIndex.setProduct_dist_enable(0); // 三级分销逻辑
|
||||
}
|
||||
|
||||
// TODO 判断违禁词
|
||||
|
||||
// 商品是否需要审核
|
||||
boolean verify_type = accountBaseConfigService.getConfig("product_verify_flag", false);
|
||||
Long productId = shopProductBase.getProduct_id();
|
||||
|
||||
// add 2025-01-08
|
||||
if (productId == null) {
|
||||
// 根据店铺id和商品货号获取商品id
|
||||
productId = getProductIdByStoreAndProductNumber(store_id, shopProductBase.getProduct_number());
|
||||
if (productId != null && productId > 0) {
|
||||
shopProductBase.setProduct_id(productId);
|
||||
}
|
||||
}
|
||||
|
||||
// todo 判断违禁词
|
||||
|
||||
// 是否需要审核
|
||||
boolean verify_type = accountBaseConfigService.getConfig("product_verify_flag", false);
|
||||
Long product_id = shopProductBase.getProduct_id();
|
||||
|
||||
boolean isUpdate = false;
|
||||
String product_image_old = "";
|
||||
if (product_id == null && storeBase != null) {
|
||||
product_id = shopNumberSeqService.createNextNo("product_id");
|
||||
|
||||
if (null == product_id) {
|
||||
throw new ApiException(I18nUtil._("生成商品编号异常!"));
|
||||
if (productId == null && storeBase != null) {
|
||||
// 生成商品ID:product_id
|
||||
productId = shopNumberSeqService.createNextNo("product_id");
|
||||
if (null == productId) {
|
||||
return Pair.of(false, I18nUtil._("生成商品编号异常!"));
|
||||
} else {
|
||||
shopProductBase.setProduct_id(product_id);
|
||||
shopProductBase.setProduct_id(productId);
|
||||
}
|
||||
|
||||
// begin 新增,判断发布商品数量是否超限
|
||||
@ -740,26 +726,23 @@ public class ShopProductBaseServiceImpl extends BaseServiceImpl<ShopProductBaseM
|
||||
ShopBaseStoreGrade store_grade_row = baseStoreGradeService.get(store_grade_id);
|
||||
|
||||
if (store_grade_row == null) {
|
||||
// 店铺等级有误!
|
||||
throw new ApiException(I18nUtil._("店铺等级有误!"));
|
||||
return Pair.of(false, I18nUtil._("店铺等级有误!"));
|
||||
}
|
||||
|
||||
|
||||
Integer store_grade_product_limit = store_grade_row.getStore_grade_product_limit();
|
||||
if (store_grade_product_limit != null && store_grade_product_limit != 0) {
|
||||
|
||||
QueryWrapper<ShopProductIndex> indexQueryWrapper = new QueryWrapper<>();
|
||||
indexQueryWrapper.eq("store_id", store_id);
|
||||
// 当前的商品数量
|
||||
long product_num = shopProductIndexService.count(indexQueryWrapper);
|
||||
|
||||
if (product_num >= store_grade_product_limit) {
|
||||
throw new ApiException(I18nUtil._("发布产品数超过店铺当前等级可允许发布商品数!"));
|
||||
return Pair.of(false, I18nUtil._("发布产品数超过店铺当前等级可允许发布商品数!"));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//for baiduAi
|
||||
ShopProductBase productBaseOld = shopProductBaseService.get(product_id);
|
||||
|
||||
//for baiduAi 以图搜图
|
||||
ShopProductBase productBaseOld = shopProductBaseService.get(productId);
|
||||
if (productBaseOld != null) {
|
||||
product_image_old = productBaseOld.getProduct_image();
|
||||
isUpdate = true;
|
||||
@ -775,6 +758,7 @@ public class ShopProductBaseServiceImpl extends BaseServiceImpl<ShopProductBaseM
|
||||
// 判断状态 - 用户端
|
||||
Integer product_state_id = shopProductBase.getProduct_state_id();
|
||||
if (ObjectUtil.equal(product_state_id, StateCode.PRODUCT_STATE_OFF_THE_SHELF)) {
|
||||
// 下架状态
|
||||
shopProductIndex.setProduct_sale_time(shopProductBase.getProduct_sale_time().getTime());
|
||||
} else {
|
||||
// 修正状态
|
||||
@ -818,12 +802,12 @@ public class ShopProductBaseServiceImpl extends BaseServiceImpl<ShopProductBaseM
|
||||
BigDecimal max_item_market_price = shopProductItemList.stream().map(ShopProductItem::getItem_market_price).max(BigDecimal::compareTo).get();
|
||||
BigDecimal product_market_price = NumberUtil.max(max_item_unit_price, max_item_market_price);
|
||||
shopProductBase.setProduct_market_price(product_market_price);
|
||||
|
||||
// 保存商品基本信息
|
||||
if (!saveOrUpdate(shopProductBase)) {
|
||||
throw new ApiException(ResultCode.FAILED);
|
||||
return Pair.of(false, I18nUtil._("保存 productBase 商品信息出错!"));
|
||||
}
|
||||
|
||||
Long productId = shopProductBase.getProduct_id();
|
||||
|
||||
// 商品辅助属性
|
||||
List<String> assistItemList = new ArrayList<>();
|
||||
if (CollUtil.isNotEmpty(shopProductAssistIndexList)) {
|
||||
@ -835,7 +819,7 @@ public class ShopProductBaseServiceImpl extends BaseServiceImpl<ShopProductBaseM
|
||||
assistIndex.setProduct_id(productId);
|
||||
|
||||
if (!assistIndexService.saveOrUpdate(assistIndex)) {
|
||||
throw new ApiException(ResultCode.FAILED);
|
||||
return Pair.of(false, I18nUtil._("保存 ShopProductAssistIndex 商品附加属性出错!"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -873,22 +857,22 @@ public class ShopProductBaseServiceImpl extends BaseServiceImpl<ShopProductBaseM
|
||||
ShopProductIndex temp_info_row = shopProductIndexService.findOne(indexQueryWrapper);
|
||||
if (temp_info_row != null && !ObjectUtil.equal(temp_info_row.getProduct_id(), productId)) {
|
||||
// 商品货号已经存在,不可重
|
||||
throw new ApiException(I18nUtil._("商品货号已经存在,不可重复!"));
|
||||
return Pair.of(false, I18nUtil._("商品货号已经存在,不可重复!"));
|
||||
}
|
||||
}
|
||||
|
||||
if (!shopProductIndexService.saveOrUpdate(shopProductIndex)) {
|
||||
throw new ApiException(ResultCode.FAILED);
|
||||
return Pair.of(false, I18nUtil._("保存 shopProductIndex 出错!"));
|
||||
}
|
||||
|
||||
shopProductDetail.setProduct_id(productId);
|
||||
if (!shopProductDetailService.saveOrUpdate(shopProductDetail)) {
|
||||
throw new ApiException(ResultCode.FAILED);
|
||||
return Pair.of(false, I18nUtil._("保存 shopProductDetail 出错!"));
|
||||
}
|
||||
|
||||
shopProductData.setProduct_id(productId);
|
||||
if (!shopProductDataService.saveOrUpdate(shopProductData)) {
|
||||
throw new ApiException(ResultCode.FAILED);
|
||||
return Pair.of(false, I18nUtil._("保存 shopProductData 出错!"));
|
||||
}
|
||||
|
||||
// 保存product image, 图片和规格属性一起保存
|
||||
@ -912,9 +896,7 @@ public class ShopProductBaseServiceImpl extends BaseServiceImpl<ShopProductBaseM
|
||||
image_row.setProduct_image_id(product_image_id);
|
||||
|
||||
//图片相同,不做处理
|
||||
if (product_image_row.getItem_image_default().equals(image_row.getItem_image_default())) {
|
||||
|
||||
} else {
|
||||
if (!product_image_row.getItem_image_default().equals(image_row.getItem_image_default())) {
|
||||
//图片不同,先删除旧的, 添加新的。
|
||||
if (CheckUtil.isNotEmpty(product_image_row.getItem_image_default())) {
|
||||
del_baidu_image_row.add(product_image_row.getItem_image_default());
|
||||
@ -925,8 +907,6 @@ public class ShopProductBaseServiceImpl extends BaseServiceImpl<ShopProductBaseM
|
||||
add_baidu_image_row.add(product_image_row.getItem_image_default());
|
||||
}
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -955,7 +935,7 @@ public class ShopProductBaseServiceImpl extends BaseServiceImpl<ShopProductBaseM
|
||||
image_row.setItem_image_ext_2("");
|
||||
|
||||
if (!shopProductImageService.saveOrUpdate(image_row)) {
|
||||
throw new ApiException(ResultCode.FAILED);
|
||||
return Pair.of(false, I18nUtil._("保存 shopProductImage 出错!"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -969,7 +949,7 @@ public class ShopProductBaseServiceImpl extends BaseServiceImpl<ShopProductBaseM
|
||||
|
||||
// 读取商品基础数据, 为了判断是否为分销供应商商品
|
||||
Map product_uniqid = new HashMap();
|
||||
ShopProductBase product_base_row = get(product_id);
|
||||
ShopProductBase product_base_row = get(productId);
|
||||
for (ShopProductItem item_row : shopProductItemList) {
|
||||
item_row.setProduct_id(productId);
|
||||
item_row.setCategory_id(shopProductIndex.getCategory_id());
|
||||
@ -981,7 +961,7 @@ public class ShopProductBaseServiceImpl extends BaseServiceImpl<ShopProductBaseM
|
||||
cn.hutool.json.JSONArray array_item_spec = cn.hutool.json.JSONUtil.parseArray(item_spec);
|
||||
List<Integer> spec_item_ids = new ArrayList<>();
|
||||
List<String> item_names = new ArrayList<>();
|
||||
Long item_id = null;
|
||||
Long item_id;
|
||||
|
||||
for (Object josn_item_spec : array_item_spec) {
|
||||
cn.hutool.json.JSONObject item = (cn.hutool.json.JSONObject) ((cn.hutool.json.JSONObject) josn_item_spec).get("item");
|
||||
@ -1016,13 +996,13 @@ public class ShopProductBaseServiceImpl extends BaseServiceImpl<ShopProductBaseM
|
||||
item_id = shopNumberSeqService.createNextNo("item_id");
|
||||
|
||||
if (null == item_id) {
|
||||
throw new ApiException(I18nUtil._("生成商品ItemId异常!"));
|
||||
return Pair.of(false, I18nUtil._("生成商品 ItemId 异常!"));
|
||||
} else {
|
||||
field_row.setItem_id(item_id);
|
||||
}
|
||||
|
||||
if (!shopProductItemSeqService.saveOrUpdate(field_row)) {
|
||||
throw new ApiException(ResultCode.FAILED);
|
||||
return Pair.of(false, I18nUtil._("保存 shopProductItemSeq 出错!"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1038,7 +1018,7 @@ public class ShopProductBaseServiceImpl extends BaseServiceImpl<ShopProductBaseM
|
||||
item_row.setItem_freetime(0);
|
||||
|
||||
if (!shopProductItemService.saveOrUpdate(item_row)) {
|
||||
throw new ApiException(ResultCode.FAILED);
|
||||
return Pair.of(false, I18nUtil._("保存 shopProductItem 出错!"));
|
||||
}
|
||||
|
||||
item_ids_new.add(item_row.getItem_id());
|
||||
@ -1075,7 +1055,7 @@ public class ShopProductBaseServiceImpl extends BaseServiceImpl<ShopProductBaseM
|
||||
shopStoreActivityItemService.remove(activityItemQueryWrapper);
|
||||
|
||||
if (!shopProductItemService.remove(item_ids_deprecate)) {
|
||||
throw new ApiException(I18nUtil._("删除废弃sku失败"));
|
||||
return Pair.of(false, I18nUtil._("删除废弃sku失败!"));
|
||||
}
|
||||
}
|
||||
//start 清理sku相关数据
|
||||
@ -1084,14 +1064,19 @@ public class ShopProductBaseServiceImpl extends BaseServiceImpl<ShopProductBaseM
|
||||
shopProductInfo.setProduct_id(productId);
|
||||
shopProductInfo.setProduct_uniqid(JSONUtil.toJsonStr(product_uniqid));
|
||||
if (!shopProductInfoService.saveOrUpdate(shopProductInfo)) {
|
||||
throw new ApiException(ResultCode.FAILED);
|
||||
return Pair.of(false, I18nUtil._("保存 shopProductInfo 出错!"));
|
||||
}
|
||||
|
||||
// virtual
|
||||
if (shopProductValidPeriod != null) {
|
||||
shopProductValidPeriod.setProduct_id(productId);
|
||||
Integer product_valid_type = shopProductValidPeriod.getProduct_valid_type();
|
||||
if(product_valid_type==null){
|
||||
product_valid_type = 1001;
|
||||
}
|
||||
shopProductValidPeriod.setProduct_valid_type(product_valid_type);// 默认到店服务 add 2025-01-08 避免出错
|
||||
if (!validPeriodService.saveOrUpdate(shopProductValidPeriod)) {
|
||||
throw new ApiException(ResultCode.FAILED);
|
||||
return Pair.of(false, I18nUtil._("保存 shopProductValidPeriod 出错!"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1099,12 +1084,14 @@ public class ShopProductBaseServiceImpl extends BaseServiceImpl<ShopProductBaseM
|
||||
if (CheckUtil.isNotEmpty(shopProductBase.getProduct_add_time())) {
|
||||
ShopProductAnalytics shopProductAnalytics = new ShopProductAnalytics();
|
||||
shopProductAnalytics.setProduct_id(shopProductIndex.getProduct_id());
|
||||
shopProductAnalytics.setProduct_click(0); // 默认0 add 2025-01-08 避免出错
|
||||
|
||||
shopProductAnalyticsService.saveOrUpdate(shopProductAnalytics);
|
||||
}
|
||||
|
||||
//店铺统计
|
||||
if (!shopStoreAnalyticsService.saveProductAnalyticsNum(store_id)) {
|
||||
throw new ApiException(ResultCode.FAILED);
|
||||
return Pair.of(false, I18nUtil._("保存 shopStoreAnalytics 出错!"));
|
||||
}
|
||||
|
||||
//修改活动产品分类
|
||||
@ -1126,9 +1113,6 @@ public class ShopProductBaseServiceImpl extends BaseServiceImpl<ShopProductBaseM
|
||||
boolean img_search_enable = accountBaseConfigService.getConfig("img_search_enable", false);
|
||||
if (img_search_enable) {
|
||||
//todo product_item_img模式放入队列,异步处理。
|
||||
//List<String> del_baidu_image_row = new ArrayList<>();
|
||||
//List<String> add_baidu_image_row = new ArrayList<>();
|
||||
|
||||
//product_image
|
||||
String contSign = "";
|
||||
String product_image_new = shopProductBase.getProduct_image();
|
||||
@ -1137,16 +1121,10 @@ public class ShopProductBaseServiceImpl extends BaseServiceImpl<ShopProductBaseM
|
||||
if (product_image_new.equals(product_image_old)) {
|
||||
product_image_new = "";
|
||||
product_image_old = "";
|
||||
} else {
|
||||
|
||||
}
|
||||
|
||||
if (CheckUtil.isNotEmpty(product_image_old)) {
|
||||
try {
|
||||
contSign = BaiduAi.removeProductImg(product_image_old, "");
|
||||
} catch (Exception e) {
|
||||
logger.warn(String.format("BaiduAi删除图片异常 : %s %s", product_image_old, e.getMessage()));
|
||||
}
|
||||
contSign = BaiduAi.removeProductImg(product_image_old, "");
|
||||
}
|
||||
|
||||
if (CheckUtil.isNotEmpty(product_image_new)) {
|
||||
@ -1154,25 +1132,21 @@ public class ShopProductBaseServiceImpl extends BaseServiceImpl<ShopProductBaseM
|
||||
briefDTO.setProductName(shopProductBase.getProduct_name());
|
||||
briefDTO.setProductId(shopProductBase.getProduct_id());
|
||||
|
||||
try {
|
||||
contSign = BaiduAi.addProductImg(product_image_new, briefDTO);
|
||||
ShopProductIndex productIndex = new ShopProductIndex();
|
||||
productIndex.setProduct_id(product_id);
|
||||
productIndex.setProduct_contsign(contSign);
|
||||
shopProductIndexService.edit(productIndex);
|
||||
} catch (Exception e) {
|
||||
logger.warn(String.format("BaiduAi添加图片异常 : %s %s", product_image_new, e.getMessage()));
|
||||
}
|
||||
contSign = BaiduAi.addProductImg(product_image_new, briefDTO);
|
||||
ShopProductIndex productIndex = new ShopProductIndex();
|
||||
productIndex.setProduct_id(productId);
|
||||
productIndex.setProduct_contsign(contSign);
|
||||
shopProductIndexService.edit(productIndex);
|
||||
}
|
||||
}
|
||||
|
||||
//同步修改分销商品
|
||||
if (isUpdate && shopProductIndex.getStore_type().equals(2)) {
|
||||
List<MqMessageVo> mqMessageVos = Collections.singletonList(new MqMessageVo(MqConstant.SHOP_EXCHANGE, MqConstant.SHOP_UPDATEDISTPRODUCT_ROUTING_KEY, product_id));
|
||||
List<MqMessageVo> mqMessageVos = Collections.singletonList(new MqMessageVo(MqConstant.SHOP_EXCHANGE, MqConstant.SHOP_UPDATEDISTPRODUCT_ROUTING_KEY, productId));
|
||||
mqMessageService.sendBatchMqMsg(mqMessageVos);
|
||||
}
|
||||
|
||||
return true;
|
||||
return Pair.of(true, I18nUtil._("保存处理成功!"));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1520,22 +1494,22 @@ public class ShopProductBaseServiceImpl extends BaseServiceImpl<ShopProductBaseM
|
||||
//是否启用以图搜图
|
||||
boolean img_search_enable = accountBaseConfigService.getConfig("img_search_enable", false);
|
||||
if (img_search_enable && CheckUtil.isNotEmpty(productSearchDTO.getProduct_img_url())) {
|
||||
try {
|
||||
List<Map> product_contsign_map = BaiduAi.searchProductImg(productSearchDTO.getProduct_img_url(), productSearchDTO.getPage() - 1, productSearchDTO.getRows());
|
||||
|
||||
//List<String> contsigns = product_contsign_map.stream().map(s -> Convert.toStr(s.get("cont_sign"))).distinct().collect(Collectors.toList());
|
||||
List<String> contsigns = new ArrayList<>();
|
||||
List<Map> product_contsign_map = BaiduAi.searchProductImg(productSearchDTO.getProduct_img_url(), productSearchDTO.getPage() - 1, productSearchDTO.getRows());
|
||||
|
||||
for (Map row : product_contsign_map) {
|
||||
BigDecimal score = Convert.toBigDecimal(row.get("score"));
|
||||
if (score.compareTo(BigDecimal.valueOf(0.8)) > 0) {
|
||||
contsigns.add(Convert.toStr(row.get("cont_sign")));
|
||||
}
|
||||
//List<String> contsigns = product_contsign_map.stream().map(s -> Convert.toStr(s.get("cont_sign"))).distinct().collect(Collectors.toList());
|
||||
List<String> contsigns = new ArrayList<>();
|
||||
|
||||
for (Map row : product_contsign_map) {
|
||||
BigDecimal score = Convert.toBigDecimal(row.get("score"));
|
||||
if (score.compareTo(BigDecimal.valueOf(0.8)) > 0) {
|
||||
contsigns.add(Convert.toStr(row.get("cont_sign")));
|
||||
}
|
||||
}
|
||||
|
||||
if (CollUtil.isNotEmpty(contsigns)) {
|
||||
column_row.in("product_contsign", contsigns);
|
||||
}
|
||||
if (CollUtil.isNotEmpty(contsigns)) {
|
||||
column_row.in("product_contsign", contsigns);
|
||||
}
|
||||
|
||||
/*
|
||||
//todo 修正排序
|
||||
@ -1543,9 +1517,7 @@ public class ShopProductBaseServiceImpl extends BaseServiceImpl<ShopProductBaseM
|
||||
BigDecimal score = Convert.toBigDecimal(row.get("score"));
|
||||
}
|
||||
*/
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 是否启用es
|
||||
@ -5077,6 +5049,31 @@ public class ShopProductBaseServiceImpl extends BaseServiceImpl<ShopProductBaseM
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据店铺Id和商品货号,获取商品Id
|
||||
*
|
||||
* @param store_id
|
||||
* @param product_number
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Long getProductIdByStoreAndProductNumber(Integer store_id, String product_number) {
|
||||
if (StrUtil.isBlank(product_number) || ObjectUtil.isNull(store_id)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
QueryWrapper<ShopProductBase> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("store_id", store_id);
|
||||
queryWrapper.eq("product_number", product_number);
|
||||
queryWrapper.select("product_id");
|
||||
ShopProductBase record = getOne(queryWrapper);
|
||||
if (record == null || record.getProduct_id() == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return record.getProduct_id();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public boolean updateProductSubsite(Integer store_id) {
|
||||
@ -5109,6 +5106,7 @@ public class ShopProductBaseServiceImpl extends BaseServiceImpl<ShopProductBaseM
|
||||
Long total = sxSyncGoodsService.countByStoreId(storeId, CommonConstant.Disable2);
|
||||
Integer pageSize = 100;
|
||||
Integer pages = com.suisung.mall.shop.sixun.utils.CommonUtil.getPagesCount(total.intValue(), pageSize);
|
||||
int successCnt = 0;
|
||||
|
||||
for (int i = 1; i <= pages; i++) {
|
||||
List<SxSyncGoods> goodsList = sxSyncGoodsService.pageByStoreId(storeId, CommonConstant.Disable2, i, pageSize).getRecords();
|
||||
@ -5116,7 +5114,7 @@ public class ShopProductBaseServiceImpl extends BaseServiceImpl<ShopProductBaseM
|
||||
continue;
|
||||
}
|
||||
|
||||
//shopProductBase, shopProductIndex, shopProductData, shopProductDetail, productInfo, itemList, productImageList, virtual, assistIndices
|
||||
// shopProductBase, shopProductIndex, shopProductData, shopProductDetail, shopProductInfo, shopProductItemList, ShopProductImageList, shopProductValidPeriod, ShopProductAssistIndexList
|
||||
for (SxSyncGoods sxSyncGoods : goodsList) {
|
||||
Date currentDate = new Date();
|
||||
|
||||
@ -5129,10 +5127,11 @@ public class ShopProductBaseServiceImpl extends BaseServiceImpl<ShopProductBaseM
|
||||
|
||||
ShopProductBase shopProductBase = new ShopProductBase();
|
||||
shopProductBase.setProduct_sale_time(Convert.toDate(DateUtil.current() + 600)); //10分钟
|
||||
shopProductBase.setProduct_name(sxSyncGoods.getItem_subname());
|
||||
shopProductBase.setProduct_tips("");
|
||||
shopProductBase.setStore_id(storeIdInt);
|
||||
shopProductBase.setProduct_number(sxSyncGoods.getItem_no());
|
||||
shopProductBase.setProduct_name(sxSyncGoods.getItem_subname());
|
||||
shopProductBase.setStore_name(store_row.getStore_name());
|
||||
shopProductBase.setProduct_tips("");
|
||||
shopProductBase.setProduct_video("");
|
||||
shopProductBase.setTransport_type_id(StateCode.DELIVERY_TYPE_SAME_CITY);
|
||||
shopProductBase.setProduct_state_id(StateCode.PRODUCT_STATE_NORMAL);
|
||||
@ -5213,11 +5212,17 @@ public class ShopProductBaseServiceImpl extends BaseServiceImpl<ShopProductBaseM
|
||||
shopProductItemList.add(shopProductItem);
|
||||
|
||||
// 保存数据
|
||||
trySaveProduct(shopProductBase, shopProductIndex, shopProductData, shopProductDetail, shopProductInfo, shopProductItemList, new ArrayList<ShopProductImage>(), new ShopProductValidPeriod(), new ArrayList<ShopProductAssistIndex>());
|
||||
Pair<Boolean, String> pair = saveProduct(shopProductBase, shopProductIndex, shopProductData, shopProductDetail, shopProductInfo, shopProductItemList, new ArrayList<ShopProductImage>(), new ShopProductValidPeriod(), new ArrayList<ShopProductAssistIndex>());
|
||||
if (!pair.getFirst()) {
|
||||
logger.error(pair.getSecond());
|
||||
continue;
|
||||
}
|
||||
|
||||
successCnt += 1;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
return successCnt > 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user