...
|
...
|
@@ -1462,11 +1462,42 @@ public class ProductServiceImpl implements IProductService, ApplicationContextAw |
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public ApiResponse<Integer> syncOrderGoodsInfo(String productCode) {
|
|
|
if(StringUtils.isEmpty(productCode)){
|
|
|
public ApiResponse<Integer> syncOrderGoodsInfo(Integer productId) {
|
|
|
if(productId == null){
|
|
|
return new ApiResponse<>(400,"商品编号不能为空");
|
|
|
}
|
|
|
productMapper.syncOrderGoodsInfo(productCode);
|
|
|
//根据productId获取货品信息
|
|
|
Product product = productMapper.selectByPrimaryKey(productId);
|
|
|
if(Objects.isNull(product)){
|
|
|
return new ApiResponse<>(400,"货品不存在");
|
|
|
}
|
|
|
//根据货品id获取商品
|
|
|
List<Integer> productIds = new ArrayList<>(2);
|
|
|
productIds.add(product.getId());
|
|
|
List<Goods> goodsList = goodsMapper.selectByProductId(productIds);
|
|
|
if(goodsList.isEmpty()){
|
|
|
return new ApiResponse<>(400,"商品不存在");
|
|
|
}
|
|
|
|
|
|
Goods goods = goodsList.get(0);
|
|
|
|
|
|
//根据goodsId获取仓库列表
|
|
|
List<Storage> storageList = storageMapper.selectByGoodsId(goods.getId());
|
|
|
if(storageList.isEmpty()){
|
|
|
return new ApiResponse<>(400,"仓库不存在");
|
|
|
}
|
|
|
|
|
|
//仓库id集合
|
|
|
List<Integer> storageIds = storageList.stream().map(Storage::getId).collect(Collectors.toList());
|
|
|
|
|
|
//构造参数
|
|
|
Map<String,Object> param = new HashMap<>(8);
|
|
|
param.put("productName",product.getProductName());
|
|
|
param.put("imgUrl",goods.getColorImage());
|
|
|
param.put("storages",storageIds);
|
|
|
int n = productMapper.syncOrderGoodsInfo(param);
|
|
|
|
|
|
LOGGER.info("synchronize seller_order_goods image_url and product_name Affected rows----------->{}",n);
|
|
|
return new ApiResponse<>(200,"同步成功");
|
|
|
}
|
|
|
|
...
|
...
|
|