fix: 调用 pcap-common 接口时添加 url,id 参数项

This commit is contained in:
shizhendong
2024-08-26 17:58:36 +08:00
parent fda9a1b2b1
commit bbbe71ae33
3 changed files with 6 additions and 2 deletions

View File

@@ -13,6 +13,6 @@ public interface PcapCommentClient {
@RequestLine("POST /api/v1/pcap/comment")
@Headers("Content-Type: multipart/form-data")
Response addCommon(@Param("file") File file);
Response addCommon(@Param("file") File file, @Param("url") String url, @Param("id") String pcapId);
}

View File

@@ -91,6 +91,9 @@ public class PcapServiceImpl extends ServiceImpl<PcapDao, PcapEntity> implements
@jakarta.annotation.Resource
private KibanaClient kibanaClient;
@Value("${controller.url:http://127.0.0.1}")
private String aswControllerUrl;
@Override
public PcapEntity queryInfo(String id) {
PcapEntity pcap = this.getById(id);
@@ -212,6 +215,7 @@ public class PcapServiceImpl extends ServiceImpl<PcapDao, PcapEntity> implements
// parse thread config properties
Properties properties = new Properties();
properties.setProperty("sharkdApiHostAddr", this.sharkdApiHostAddr);
properties.setProperty("aswControllerUrl", this.aswControllerUrl);
for (String id : ids) {
PcapEntity pcapEntity = this.getById(id);

View File

@@ -90,7 +90,7 @@ public class PcapParserThread implements Runnable {
*/
private void addCommonToPcap() throws IOException {
// pcap common
Response response = pcapCommentClient.addCommon(T.FileUtil.file(pcapEntity.getPath()));
Response response = pcapCommentClient.addCommon(T.FileUtil.file(pcapEntity.getPath()), properties.getProperty("aswControllerUrl"), pcapEntity.getId());
if (log.isDebugEnabled()) {
log.debug("[addCommonToPcap] [response: {}]", null != response ? response.status() : RCode.ERROR.getCode());