...
|
...
|
@@ -8,6 +8,8 @@ import java.util.stream.Collectors; |
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.yoho.order.dal.BuyerOrderMapper;
|
|
|
import com.yoho.product.model.ProductNameAndImgReq;
|
|
|
import com.yoho.ufo.dal.model.*;
|
|
|
import com.yohobuy.ufo.model.order.bo.SellerBo;
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
...
|
...
|
@@ -112,7 +114,10 @@ public class ProductServiceImpl implements IProductService, ApplicationContextAw |
|
|
|
|
|
@Autowired
|
|
|
private BatchService batchService;
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
private BuyerOrderMapper buyerOrderMapper;
|
|
|
|
|
|
private static final Integer NOT_SYN_CALENDER = 0;
|
|
|
|
|
|
@Override
|
...
|
...
|
@@ -1462,7 +1467,7 @@ public class ProductServiceImpl implements IProductService, ApplicationContextAw |
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public ApiResponse<Integer> syncOrderGoodsInfo(Integer productId) {
|
|
|
public ApiResponse<Integer> updateOrderGoodsNameAndImg(Integer productId) {
|
|
|
if(productId == null){
|
|
|
return new ApiResponse<>(400,"商品编号不能为空");
|
|
|
}
|
...
|
...
|
@@ -1490,15 +1495,23 @@ public class ProductServiceImpl implements IProductService, ApplicationContextAw |
|
|
//仓库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);
|
|
|
//封装请求实体
|
|
|
ProductNameAndImgReq productNameAndImgReq = new ProductNameAndImgReq();
|
|
|
productNameAndImgReq.setProductName(product.getProductName());
|
|
|
productNameAndImgReq.setImgUrl(goods.getColorImage());
|
|
|
productNameAndImgReq.setStorages(storageIds);
|
|
|
int count = buyerOrderMapper.countByOrderGoodsNameAndImg(productNameAndImgReq);
|
|
|
|
|
|
int n = 0;
|
|
|
|
|
|
//批次更新,每次更新100行,防止一次更新的数据量太大,占用锁时间太长
|
|
|
while(count > 0){
|
|
|
n += buyerOrderMapper.updateOrderGoodsNameAndImg(productNameAndImgReq);
|
|
|
count = count - 100;
|
|
|
}
|
|
|
|
|
|
LOGGER.info("synchronize seller_order_goods image_url and product_name Affected rows----------->{}",n);
|
|
|
return new ApiResponse<>(200,"同步成功");
|
|
|
return new ApiResponse<>(200,"同步成功",n);
|
|
|
}
|
|
|
|
|
|
private String getMaxLen(String str, int len) {
|
...
|
...
|
|