|
|
@@ -7,6 +7,7 @@ import com.uas.platform.b2c.advertise.ad.utils.RecommendProductsUtils;
|
|
|
import com.uas.platform.b2c.core.config.MicroServicesConfMulti;
|
|
|
import com.uas.platform.b2c.prod.commodity.dao.GoodsDao;
|
|
|
import com.uas.platform.b2c.prod.commodity.model.Goods;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.kafka.core.KafkaTemplate;
|
|
|
@@ -101,23 +102,25 @@ public class RecommendProductServiceImpl implements RecommendProductService {
|
|
|
if (CollectionUtils.isEmpty(productList)) {
|
|
|
return Collections.emptyList();
|
|
|
}
|
|
|
-
|
|
|
+ List<RecommendProduct> list = new ArrayList<>();
|
|
|
for (RecommendProduct product : productList) {
|
|
|
+ RecommendProduct recommendProduct = new RecommendProduct();
|
|
|
+ BeanUtils.copyProperties(product, recommendProduct);
|
|
|
Date nowDate = new Date();
|
|
|
-
|
|
|
- product.setStoreUuid(uuid);
|
|
|
- product.setCreateTime(nowDate);
|
|
|
- product.setUpdateTime(nowDate);
|
|
|
+ recommendProduct.setId(null);
|
|
|
+ recommendProduct.setStoreUuid(uuid);
|
|
|
+ recommendProduct.setCreateTime(nowDate);
|
|
|
+ recommendProduct.setUpdateTime(nowDate);
|
|
|
}
|
|
|
- recommendProductDao.save(productList);
|
|
|
+ List<RecommendProduct> recommendProducts = recommendProductDao.save(list);
|
|
|
|
|
|
- for (RecommendProduct product : productList) {
|
|
|
+ for (RecommendProduct product : recommendProducts) {
|
|
|
Goods commodity = goodsDao.findByBatchCode(product.getBatchCode());
|
|
|
if (commodity != null) {
|
|
|
RecommendProductsUtils.fillCommodityInfo(product, commodity);
|
|
|
}
|
|
|
}
|
|
|
- return productList;
|
|
|
+ return recommendProducts;
|
|
|
}
|
|
|
|
|
|
|