|
@@ -47,6 +47,9 @@ public class TabDatasourceMsgServiceImpl extends ServiceImpl<TabDatasourceMsgMap
|
|
|
@Resource
|
|
|
ITabKafkaSunService tabKafkaSunService;
|
|
|
|
|
|
+ @Resource
|
|
|
+ ITabUrlSunService tabUrlSunService;
|
|
|
+
|
|
|
@Override
|
|
|
@Transactional
|
|
|
public AjaxResult insertDataSun(DataSun dataSun) {
|
|
@@ -109,6 +112,7 @@ public class TabDatasourceMsgServiceImpl extends ServiceImpl<TabDatasourceMsgMap
|
|
|
List<TabKb> kb = dataSun.getKb();
|
|
|
if (kb != null) {
|
|
|
kb.forEach(tabKb -> {
|
|
|
+ tabKb.setId(snowflake.nextId());
|
|
|
tabKb.setAccessFeedbackId(dataSun.getAccessFeedbackId());
|
|
|
tabKbService.save(tabKb);
|
|
|
});
|
|
@@ -117,6 +121,7 @@ public class TabDatasourceMsgServiceImpl extends ServiceImpl<TabDatasourceMsgMap
|
|
|
List<TabSftp> sftp = dataSun.getSftp();
|
|
|
if (sftp != null) {
|
|
|
sftp.forEach(tabSftp -> {
|
|
|
+ tabSftp.setId(snowflake.nextId());
|
|
|
tabSftp.setAccessFeedbackId(dataSun.getAccessFeedbackId());
|
|
|
tabSftpService.save(tabSftp);
|
|
|
});
|
|
@@ -125,8 +130,39 @@ public class TabDatasourceMsgServiceImpl extends ServiceImpl<TabDatasourceMsgMap
|
|
|
List<TabUrl> url = dataSun.getUrl();
|
|
|
if (url != null) {
|
|
|
url.forEach(tabUrl -> {
|
|
|
+ long urlId = snowflake.nextId();
|
|
|
tabUrl.setAccessFeedbackId(dataSun.getAccessFeedbackId());
|
|
|
tabUrlService.save(tabUrl);
|
|
|
+
|
|
|
+ tabUrl.getTabEtlHeaderSuns().forEach(tabUrlSun -> {
|
|
|
+ tabUrlSun.setId(snowflake.nextId());
|
|
|
+ tabUrlSun.setUrlId(urlId);
|
|
|
+ tabUrlSunService.save(tabUrlSun);
|
|
|
+ });
|
|
|
+
|
|
|
+ tabUrl.getTabEtlBodySuns().forEach(tabUrlSun -> {
|
|
|
+ tabUrlSun.setId(snowflake.nextId());
|
|
|
+ tabUrlSun.setUrlId(urlId);
|
|
|
+ tabUrlSunService.save(tabUrlSun);
|
|
|
+ });
|
|
|
+
|
|
|
+ tabUrl.getTabEtlQuerySuns().forEach(tabUrlSun -> {
|
|
|
+ tabUrlSun.setId(snowflake.nextId());
|
|
|
+ tabUrlSun.setUrlId(urlId);
|
|
|
+ tabUrlSunService.save(tabUrlSun);
|
|
|
+ });
|
|
|
+
|
|
|
+ tabUrl.getTabEtlResponseSuns().forEach(tabUrlSun -> {
|
|
|
+ tabUrlSun.setId(snowflake.nextId());
|
|
|
+ tabUrlSun.setUrlId(urlId);
|
|
|
+ tabUrlSunService.save(tabUrlSun);
|
|
|
+ });
|
|
|
+
|
|
|
+ tabUrl.getTabEtlDataSuns().forEach(tabUrlSun -> {
|
|
|
+ tabUrlSun.setId(snowflake.nextId());
|
|
|
+ tabUrlSun.setUrlId(urlId);
|
|
|
+ tabUrlSunService.save(tabUrlSun);
|
|
|
+ });
|
|
|
});
|
|
|
}
|
|
|
|
|
@@ -212,6 +248,67 @@ public class TabDatasourceMsgServiceImpl extends ServiceImpl<TabDatasourceMsgMap
|
|
|
url.forEach(tabUrl -> {
|
|
|
tabUrl.setAccessFeedbackId(dataSun.getAccessFeedbackId());
|
|
|
tabUrlService.saveOrUpdate(tabUrl);
|
|
|
+
|
|
|
+ tabUrl.getTabEtlHeaderSuns().forEach(tabUrlSun -> {
|
|
|
+ LambdaQueryWrapper<TabUrlSun> kql = new LambdaQueryWrapper<>();
|
|
|
+ kql.eq(TabUrlSun::getId, tabUrlSun.getId());
|
|
|
+ TabUrlSun one = tabUrlSunService.getOne(kql);
|
|
|
+ if (one != null) {
|
|
|
+ tabUrlSunService.updateById(one);
|
|
|
+ } else {
|
|
|
+ tabUrlSun.setId(snowflake.nextId());
|
|
|
+ tabUrlSunService.save(tabUrlSun);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ tabUrl.getTabEtlBodySuns().forEach(tabUrlSun -> {
|
|
|
+ LambdaQueryWrapper<TabUrlSun> kql = new LambdaQueryWrapper<>();
|
|
|
+ kql.eq(TabUrlSun::getId, tabUrlSun.getId());
|
|
|
+ TabUrlSun one = tabUrlSunService.getOne(kql);
|
|
|
+ if (one != null) {
|
|
|
+ tabUrlSunService.updateById(one);
|
|
|
+ } else {
|
|
|
+ tabUrlSun.setId(snowflake.nextId());
|
|
|
+ tabUrlSunService.save(tabUrlSun);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ tabUrl.getTabEtlQuerySuns().forEach(tabUrlSun -> {
|
|
|
+ LambdaQueryWrapper<TabUrlSun> kql = new LambdaQueryWrapper<>();
|
|
|
+ kql.eq(TabUrlSun::getId, tabUrlSun.getId());
|
|
|
+ TabUrlSun one = tabUrlSunService.getOne(kql);
|
|
|
+ if (one != null) {
|
|
|
+ tabUrlSunService.updateById(one);
|
|
|
+ } else {
|
|
|
+ tabUrlSun.setId(snowflake.nextId());
|
|
|
+ tabUrlSunService.save(tabUrlSun);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ tabUrl.getTabEtlResponseSuns().forEach(tabUrlSun -> {
|
|
|
+ LambdaQueryWrapper<TabUrlSun> kql = new LambdaQueryWrapper<>();
|
|
|
+ kql.eq(TabUrlSun::getId, tabUrlSun.getId());
|
|
|
+ TabUrlSun one = tabUrlSunService.getOne(kql);
|
|
|
+ if (one != null) {
|
|
|
+ tabUrlSunService.updateById(one);
|
|
|
+ } else {
|
|
|
+ tabUrlSun.setId(snowflake.nextId());
|
|
|
+ tabUrlSunService.save(tabUrlSun);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ tabUrl.getTabEtlDataSuns().forEach(tabUrlSun -> {
|
|
|
+ LambdaQueryWrapper<TabUrlSun> kql = new LambdaQueryWrapper<>();
|
|
|
+ kql.eq(TabUrlSun::getId, tabUrlSun.getId());
|
|
|
+ TabUrlSun one = tabUrlSunService.getOne(kql);
|
|
|
+ if (one != null) {
|
|
|
+ tabUrlSunService.updateById(one);
|
|
|
+ } else {
|
|
|
+ tabUrlSun.setId(snowflake.nextId());
|
|
|
+ tabUrlSunService.save(tabUrlSun);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
});
|
|
|
}
|
|
|
|
|
@@ -246,9 +343,12 @@ public class TabDatasourceMsgServiceImpl extends ServiceImpl<TabDatasourceMsgMap
|
|
|
tabSftpService.updateById(tabSftp);
|
|
|
|
|
|
TabUrl tabUrl = new TabUrl();
|
|
|
- tabUrl.setAccessFeedbackId(id);
|
|
|
- tabUrl.setIsDel(1);
|
|
|
- tabUrlService.updateById(tabUrl);
|
|
|
+ tabUrl.setId(id);
|
|
|
+ tabUrlService.removeById(tabUrl);
|
|
|
+
|
|
|
+ LambdaQueryWrapper<TabUrlSun> uql = new LambdaQueryWrapper<>();
|
|
|
+ uql.eq(TabUrlSun::getUrlId, id);
|
|
|
+ tabUrlSunService.remove(uql);
|
|
|
|
|
|
return AjaxResult.success("删除成功");
|
|
|
|
|
@@ -297,6 +397,38 @@ public class TabDatasourceMsgServiceImpl extends ServiceImpl<TabDatasourceMsgMap
|
|
|
urlql.eq(TabUrl::getAccessFeedbackId, id);
|
|
|
List<TabUrl> tabUrls = tabUrlService.list(urlql);
|
|
|
|
|
|
+ tabUrls.forEach(tabUrl -> {
|
|
|
+ LambdaQueryWrapper<TabUrlSun> hql = new LambdaQueryWrapper<>();
|
|
|
+ hql.eq(TabUrlSun::getUrlId, tabUrl.getId());
|
|
|
+ hql.eq(TabUrlSun::getType, "header");
|
|
|
+ List<TabUrlSun> tabUrlSunS = tabUrlSunService.list(hql);
|
|
|
+ tabUrl.setTabEtlHeaderSuns(tabUrlSunS);
|
|
|
+
|
|
|
+ LambdaQueryWrapper<TabUrlSun> bql = new LambdaQueryWrapper<>();
|
|
|
+ bql.eq(TabUrlSun::getUrlId, tabUrl.getId());
|
|
|
+ bql.eq(TabUrlSun::getType, "body");
|
|
|
+ List<TabUrlSun> tabUrlSunS1 = tabUrlSunService.list(bql);
|
|
|
+ tabUrl.setTabEtlBodySuns(tabUrlSunS1);
|
|
|
+
|
|
|
+ LambdaQueryWrapper<TabUrlSun> qql = new LambdaQueryWrapper<>();
|
|
|
+ qql.eq(TabUrlSun::getUrlId, tabUrl.getId());
|
|
|
+ qql.eq(TabUrlSun::getType, "query");
|
|
|
+ List<TabUrlSun> tabUrlSunS2 = tabUrlSunService.list(qql);
|
|
|
+ tabUrl.setTabEtlQuerySuns(tabUrlSunS2);
|
|
|
+
|
|
|
+ LambdaQueryWrapper<TabUrlSun> rql = new LambdaQueryWrapper<>();
|
|
|
+ rql.eq(TabUrlSun::getUrlId, tabUrl.getId());
|
|
|
+ rql.eq(TabUrlSun::getType, "response");
|
|
|
+ List<TabUrlSun> tabUrlSunS3 = tabUrlSunService.list(rql);
|
|
|
+ tabUrl.setTabEtlResponseSuns(tabUrlSunS3);
|
|
|
+
|
|
|
+ LambdaQueryWrapper<TabUrlSun> dql = new LambdaQueryWrapper<>();
|
|
|
+ dql.eq(TabUrlSun::getUrlId, tabUrl.getId());
|
|
|
+ dql.eq(TabUrlSun::getType, "data");
|
|
|
+ List<TabUrlSun> tabUrlSunS4 = tabUrlSunService.list(dql);
|
|
|
+ tabUrl.setTabEtlDataSuns(tabUrlSunS4);
|
|
|
+ });
|
|
|
+
|
|
|
DataSun dataSun = new DataSun();
|
|
|
dataSun.setEtl(tabEtls);
|
|
|
dataSun.setKafka(tabKafkas);
|