提交 925554b9 作者: chenshiqiang

send data from excel to kafka for python

上级 a025c86b
......@@ -102,6 +102,7 @@ public class Knowledge implements Serializable {
* 知识库id
*/
private String kbKnowledgeId;
private String content;
/**
* 类型
*/
......
......@@ -3,6 +3,8 @@ package com.zzsn.knowbase.kafka.cloudstream;
import org.springframework.cloud.stream.annotation.Output;
import org.springframework.messaging.MessageChannel;
import java.net.DatagramSocket;
/**
* @author chenshiqiang
* @Description 知识信息通道
......@@ -18,5 +20,6 @@ public interface KnowledgeChannel {
@Output
MessageChannel knowledgeContents();
@Output
MessageChannel knowledgeExcelContents();
}
......@@ -32,4 +32,10 @@ public class ProduceInfo {
Message<String> message = MessageBuilder.withPayload(msg).build();
channel.knowledgeContents().send(message);
}
public void sendKnowledgeExcelContents(KnowledgeMessage knowledgeMessage) {
String msg = JSON.toJSONString(knowledgeMessage);
Message<String> message = MessageBuilder.withPayload(msg).build();
channel.knowledgeExcelContents().send(message);
}
}
......@@ -518,6 +518,9 @@ class KnowledgeServiceImpl implements IKnowledgeService {
continue;
}
if (StringUtils.isNotEmpty(info.get(1))) {
specialInformation.setContent(info.get(1));
//段落切分
specialInformation.setContents(Collections.singletonList(Content.builder()
.contentId(codeGenerateUtil.geneIdNo(Constants.FINANCE, 8))
.content(info.get(1)).build()));
......@@ -541,7 +544,7 @@ class KnowledgeServiceImpl implements IKnowledgeService {
BeanUtils.copyProperties(specialInformation, knowledgeMessage);
knowledgeMessage.setType(specialInformation.getTypeId());
knowledgeMessage.setContents(specialInformation.getContents());
produceInfo.sendKnowledgeContents(knowledgeMessage);
produceInfo.sendKnowledgeExcelContents(knowledgeMessage);
} catch (NumberFormatException e) {
log.error("处理异常");
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论