|
|
@@ -9,6 +9,7 @@ import com.uas.platform.b2c.core.utils.JacksonUtils;
|
|
|
import com.uas.platform.b2c.prod.commodity.dao.GoodsDao;
|
|
|
import com.uas.platform.b2c.prod.commodity.model.Goods;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.kafka.core.KafkaTemplate;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
@@ -31,6 +32,9 @@ import java.util.Set;
|
|
|
@Service
|
|
|
public class RecommendProductServiceImpl implements RecommendProductService {
|
|
|
|
|
|
+ @Value("#{sys.profile}")
|
|
|
+ private String profile;
|
|
|
+
|
|
|
private final RestTemplate restTemplate;
|
|
|
|
|
|
private final GoodsDao goodsDao;
|
|
|
@@ -53,6 +57,10 @@ public class RecommendProductServiceImpl implements RecommendProductService {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
+ if (StringUtils.isEmpty(profile)) {
|
|
|
+ throw new IllegalStateException("无法获取配置文件属性值");
|
|
|
+ }
|
|
|
+
|
|
|
Date date = new Date();
|
|
|
|
|
|
Message message = new Message();
|
|
|
@@ -62,7 +70,9 @@ public class RecommendProductServiceImpl implements RecommendProductService {
|
|
|
message.setBatchCodes(batchCodes);
|
|
|
System.out.println(JacksonUtils.toJson(message));
|
|
|
|
|
|
- kafkaTemplate.send("recommend-products-delete", "batchCode", JacksonUtils.toJson(message));
|
|
|
+ String topic = "recommend-products-delete" + "-" + profile;
|
|
|
+
|
|
|
+ kafkaTemplate.send(topic, "batchCode", JacksonUtils.toJson(message));
|
|
|
}
|
|
|
|
|
|
@Override
|