summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortanghao <[email protected]>2024-11-26 16:30:00 +0800
committertanghao <[email protected]>2024-11-26 16:30:00 +0800
commit80496bf4039af1ed2b69d7e63664b5de2cbaa5fb (patch)
treedf31dc91fa9491168b4e5b62a742b414ea18e441
parent9d15b6e5caf6d2ee7497b77497ad2bcbaab2c9cb (diff)
fix: 统一名称entity profiles更改为entity integrations
-rw-r--r--cn-admin/src/main/java/net/geedge/common/config/SetupRunner.java6
-rw-r--r--cn-admin/src/main/java/net/geedge/common/utils/Constant.java4
-rw-r--r--cn-admin/src/main/java/net/geedge/common/utils/RCode.java8
-rw-r--r--cn-admin/src/main/java/net/geedge/common/utils/TypeEnum.java2
-rw-r--r--cn-admin/src/main/java/net/geedge/modules/entity/controller/EntityIntegrationsController.java (renamed from cn-admin/src/main/java/net/geedge/modules/entity/controller/EntityProfilesController.java)34
-rw-r--r--cn-admin/src/main/java/net/geedge/modules/entity/dao/EntityIntegrationsDao.java (renamed from cn-admin/src/main/java/net/geedge/modules/entity/dao/EntityProfilesDao.java)6
-rw-r--r--cn-admin/src/main/java/net/geedge/modules/entity/entity/EntityIntegrations.java (renamed from cn-admin/src/main/java/net/geedge/modules/entity/entity/EntityProfiles.java)4
-rw-r--r--cn-admin/src/main/java/net/geedge/modules/entity/job/ConfigSyncJob.java10
-rw-r--r--cn-admin/src/main/java/net/geedge/modules/entity/service/EntityIntegrationsService.java24
-rw-r--r--cn-admin/src/main/java/net/geedge/modules/entity/service/EntityProfilesService.java24
-rw-r--r--cn-admin/src/main/java/net/geedge/modules/entity/service/impl/EntityIntegrationsServiceImpl.java (renamed from cn-admin/src/main/java/net/geedge/modules/entity/service/impl/EntityProfilesServiceImpl.java)94
-rw-r--r--cn-admin/src/main/java/net/geedge/modules/entity/service/impl/EntitySourcesServiceImpl.java12
-rw-r--r--cn-admin/src/main/resources/db/R__AZ_entity_config.sql4
-rw-r--r--cn-admin/src/main/resources/db/R__AZ_sys_menu.sql3
-rw-r--r--cn-admin/src/main/resources/db/R__AZ_sys_role_menu.sql3
-rw-r--r--cn-admin/src/main/resources/db/V24.11.06__add entity integrations sources table.sql (renamed from cn-admin/src/main/resources/db/V24.11.06__add entity profiles sources table.sql)4
-rw-r--r--cn-admin/src/main/resources/mapper/entity/EntityIntegrationDao.xml (renamed from cn-admin/src/main/resources/mapper/entity/EntityProfilesDao.xml)8
17 files changed, 128 insertions, 122 deletions
diff --git a/cn-admin/src/main/java/net/geedge/common/config/SetupRunner.java b/cn-admin/src/main/java/net/geedge/common/config/SetupRunner.java
index 29ca9fe..7bec084 100644
--- a/cn-admin/src/main/java/net/geedge/common/config/SetupRunner.java
+++ b/cn-admin/src/main/java/net/geedge/common/config/SetupRunner.java
@@ -2,7 +2,7 @@ package net.geedge.common.config;
import java.io.File;
-import net.geedge.modules.entity.service.EntityProfilesService;
+import net.geedge.modules.entity.service.EntityIntegrationsService;
import net.geedge.modules.entity.service.EntitySourcesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
@@ -51,7 +51,7 @@ public class SetupRunner implements CommandLineRunner{
@Autowired
private EntitySourcesService entitySourcesService;
@Autowired
- private EntityProfilesService entityProfilesService;
+ private EntityIntegrationsService entityIntegrationsService;
@Override
public void run(String... args) throws Exception {
@@ -72,7 +72,7 @@ public class SetupRunner implements CommandLineRunner{
}
//将实体相关配置上传更新到nacos
entitySourcesService.uploadConfig();
- entityProfilesService.uploadConfig();
+ entityIntegrationsService.uploadConfig();
log.debug(" inited = {} ,skip init setup", inited);
return ;
}
diff --git a/cn-admin/src/main/java/net/geedge/common/utils/Constant.java b/cn-admin/src/main/java/net/geedge/common/utils/Constant.java
index 2cf55d2..9518116 100644
--- a/cn-admin/src/main/java/net/geedge/common/utils/Constant.java
+++ b/cn-admin/src/main/java/net/geedge/common/utils/Constant.java
@@ -366,9 +366,9 @@ public class Constant {
public static final String SOURCE_ID = "35c19f09-2a2c-44f4-bca1-fe0cd0c447cb";
public static final String ENTITY_SOURCES_DATAID ="data_sources.json";
- public static final String ENTITY_PROFILES_DATAID ="entity_integrations.json";
+ public static final String ENTITY_INTEGRATIONS_DATAID ="entity_integrations.json";
public static final String NACOS_ENTITY_CONFIG_GROUP = "DEFAULT_GROUP";
public static final String ENTITY_SOURCES_UPLOAD_STATUS = "entity_sources_upload_status";
- public static final String ENTITY_PROFILES_UPLOAD_STATUS = "entity_profiles_upload_status";
+ public static final String ENTITY_INTEGRATIONS_UPLOAD_STATUS = "entity_integrations_upload_status";
public static final String ENTITY_SOURCES_TOPIC_NAME = "CBNR-SOURCE";
}
diff --git a/cn-admin/src/main/java/net/geedge/common/utils/RCode.java b/cn-admin/src/main/java/net/geedge/common/utils/RCode.java
index bac193d..e9075ab 100644
--- a/cn-admin/src/main/java/net/geedge/common/utils/RCode.java
+++ b/cn-admin/src/main/java/net/geedge/common/utils/RCode.java
@@ -355,9 +355,9 @@ public enum RCode {
ENTITY_SOURCES_LOOKUPS_ISNULL(601007,"Entity sources lookups is required"),
ENTITY_SOURCES_DATAFORMAT_ISNULL(601008,"Entity sources dataformat is required"),
ENTITY_SOURCES_NAME_DUPLICATE(601009,"Entity sources name duplicate"),
- ENTITY_PROFILES_SOURCEID_ISNULL(601010,"Entity profiles sourceId is required"),
- ENTITY_PROFILES_ENTITIES_ISNULL(601011,"Entity profiles entities is required"),
- ENTITY_PROFILES_RELATIONS_ISNULL(601012,"Entity profiles relations is required"),
+ ENTITY_INTEGRATIONS_SOURCEID_ISNULL(601010,"Entity profiles sourceId is required"),
+ ENTITY_INTEGRATIONS_ENTITIES_ISNULL(601011,"Entity profiles entities is required"),
+ ENTITY_INTEGRATIONS_RELATIONS_ISNULL(601012,"Entity profiles relations is required"),
ENTITY_SOURCES_ID_ISNULL(601013,"Entity sources id is required"),
ENTITY_SOURCES_FILE_ISNULL(601014,"Entity sources upload file is required"),
ENTITY_SOURCES_DATAFORMAT_TYPE_ERROR(601015,"Entity sources data format must be one of json,csv"),
@@ -367,7 +367,7 @@ public enum RCode {
ENTITY_SOURCES_UPLOAD_DATA_NONE(601019,"There are null values in the uploaded data"),
ENTITY_SOURCES_REFERENCED_ERROR(601020,"The data is referenced and cannot be modified."),
ENTITY_SOURCES_BUILT_IN_ERROR(601021,"Entity sources Built-in data does not allow deletion or modification"),
- ENTITY_PROFILES_BUILT_IN_ERROR(601022,"Entity profiles Built-in data does not allow deletion or modification"),
+ ENTITY_INTEGRATIONS_BUILT_IN_ERROR(601022,"Entity profiles Built-in data does not allow deletion or modification"),
ENTITY_SOURCES_FIELDS_ERROR(601023,"Source data mapping fields have changed, please check"),
RULE_ID_ISNULL(611001,"Rule id is required"),
diff --git a/cn-admin/src/main/java/net/geedge/common/utils/TypeEnum.java b/cn-admin/src/main/java/net/geedge/common/utils/TypeEnum.java
index c9db39d..940ac6a 100644
--- a/cn-admin/src/main/java/net/geedge/common/utils/TypeEnum.java
+++ b/cn-admin/src/main/java/net/geedge/common/utils/TypeEnum.java
@@ -10,7 +10,7 @@ public enum TypeEnum {
UNKNOWN("unknown"),SYSTEM("system"), LINK("link"),LICENSE("license"), SYSTEMAPIKEY("sys api key"),SETTING("proxy setting"),
INTERFACE("proxy interface"),I18N("i18n setting"),CTL("ctl"),REPORTJOB("report job"),REPORTTEMP("report temp"),
KNOWLEDGEBASE("knowledge base"),DETECTIONRULE("detection rule"),TAG("tag"),
- ENTITYPROFILES("entity_profiles"),ENTITYSOURCES("entity_sources");
+ ENTITYINTEGRATIONS("entity_integrations"),ENTITYSOURCES("entity_sources");
private String value;
diff --git a/cn-admin/src/main/java/net/geedge/modules/entity/controller/EntityProfilesController.java b/cn-admin/src/main/java/net/geedge/modules/entity/controller/EntityIntegrationsController.java
index 49d3cb9..16edd2f 100644
--- a/cn-admin/src/main/java/net/geedge/modules/entity/controller/EntityProfilesController.java
+++ b/cn-admin/src/main/java/net/geedge/modules/entity/controller/EntityIntegrationsController.java
@@ -3,53 +3,53 @@ package net.geedge.modules.entity.controller;
import net.geedge.common.annotation.SysLog;
import net.geedge.common.smartvalidate.ValidateUtils;
import net.geedge.common.utils.*;
-import net.geedge.modules.entity.entity.EntityProfiles;
-import net.geedge.modules.entity.entity.EntitySources;
-import net.geedge.modules.entity.service.EntityProfilesService;
+import net.geedge.modules.entity.entity.EntityIntegrations;
+import net.geedge.modules.entity.service.EntityIntegrationsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
+
import java.util.Arrays;
import java.util.Map;
@RestController
-@RequestMapping("/v1/entity/profiles")
-public class EntityProfilesController {
+@RequestMapping("/v1/entity/integrations")
+public class EntityIntegrationsController {
@Autowired
- private EntityProfilesService entityProfilesService;
+ private EntityIntegrationsService entityIntegrationsService;
@GetMapping
public R queryList(@RequestParam Map<String, Object> params){
- PageUtils page = entityProfilesService.queryPage(params);
+ PageUtils page = entityIntegrationsService.queryPage(params);
return R.ok(page);
}
@GetMapping("/{id}")
public R queryInfo(@PathVariable Integer id){
- EntityProfiles entityProfiles= entityProfilesService.queryById(id);
- return R.ok(entityProfiles);
+ EntityIntegrations entityIntegrations= entityIntegrationsService.queryById(id);
+ return R.ok(entityIntegrations);
}
@PostMapping
- @SysLog(operation = OperationEnum.ADD,type = TypeEnum.ENTITYPROFILES)
- public R save(@RequestBody EntityProfiles entityProfiles){
- entityProfilesService.saveEntityProfiles(entityProfiles);
+ @SysLog(operation = OperationEnum.ADD,type = TypeEnum.ENTITYINTEGRATIONS)
+ public R save(@RequestBody EntityIntegrations entityIntegrations){
+ entityIntegrationsService.saveEntityIntegrations(entityIntegrations);
return R.ok();
}
@PutMapping
- @SysLog(operation = OperationEnum.UPDATE,type = TypeEnum.ENTITYPROFILES)
- public R modify(@RequestBody EntityProfiles entityProfiles){
- entityProfilesService.modify(entityProfiles);
+ @SysLog(operation = OperationEnum.UPDATE,type = TypeEnum.ENTITYINTEGRATIONS)
+ public R modify(@RequestBody EntityIntegrations entityIntegrations){
+ entityIntegrationsService.modify(entityIntegrations);
return R.ok();
}
@DeleteMapping
- @SysLog(operation = OperationEnum.DELETE,type = TypeEnum.ENTITYPROFILES)
+ @SysLog(operation = OperationEnum.DELETE,type = TypeEnum.ENTITYINTEGRATIONS)
public R remove(@RequestParam String ids){
ValidateUtils.is(ids).notNull(RCode.NOT_NULL_ERROR);
- entityProfilesService.remove(Arrays.asList(ids.split(",")));
+ entityIntegrationsService.remove(Arrays.asList(ids.split(",")));
return R.ok();
}
}
diff --git a/cn-admin/src/main/java/net/geedge/modules/entity/dao/EntityProfilesDao.java b/cn-admin/src/main/java/net/geedge/modules/entity/dao/EntityIntegrationsDao.java
index b83c73f..7555baa 100644
--- a/cn-admin/src/main/java/net/geedge/modules/entity/dao/EntityProfilesDao.java
+++ b/cn-admin/src/main/java/net/geedge/modules/entity/dao/EntityIntegrationsDao.java
@@ -2,7 +2,7 @@ package net.geedge.modules.entity.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
-import net.geedge.modules.entity.entity.EntityProfiles;
+import net.geedge.modules.entity.entity.EntityIntegrations;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@@ -10,7 +10,7 @@ import java.util.List;
import java.util.Map;
@Mapper
-public interface EntityProfilesDao extends BaseMapper<EntityProfiles>{
+public interface EntityIntegrationsDao extends BaseMapper<EntityIntegrations>{
- List<EntityProfiles> queryPage(IPage page, @Param("param")Map<String,Object> param);
+ List<EntityIntegrations> queryPage(IPage page, @Param("param")Map<String,Object> param);
}
diff --git a/cn-admin/src/main/java/net/geedge/modules/entity/entity/EntityProfiles.java b/cn-admin/src/main/java/net/geedge/modules/entity/entity/EntityIntegrations.java
index 8e4966f..8fbd9b5 100644
--- a/cn-admin/src/main/java/net/geedge/modules/entity/entity/EntityProfiles.java
+++ b/cn-admin/src/main/java/net/geedge/modules/entity/entity/EntityIntegrations.java
@@ -7,8 +7,8 @@ import lombok.Data;
import java.util.Date;
@Data
-@TableName("entity_profiles")
-public class EntityProfiles {
+@TableName("entity_integrations")
+public class EntityIntegrations {
private Integer id;
diff --git a/cn-admin/src/main/java/net/geedge/modules/entity/job/ConfigSyncJob.java b/cn-admin/src/main/java/net/geedge/modules/entity/job/ConfigSyncJob.java
index bedeca1..29ca465 100644
--- a/cn-admin/src/main/java/net/geedge/modules/entity/job/ConfigSyncJob.java
+++ b/cn-admin/src/main/java/net/geedge/modules/entity/job/ConfigSyncJob.java
@@ -5,7 +5,7 @@ import cn.hutool.log.Log;
import com.alibaba.nacos.api.config.ConfigService;
import net.geedge.common.utils.Constant;
import net.geedge.modules.election.dao.LeaderElectionDao;
-import net.geedge.modules.entity.service.EntityProfilesService;
+import net.geedge.modules.entity.service.EntityIntegrationsService;
import net.geedge.modules.entity.service.EntitySourcesService;
import net.geedge.modules.sys.service.SysConfigService;
import org.quartz.DisallowConcurrentExecution;
@@ -30,7 +30,7 @@ public class ConfigSyncJob extends QuartzJobBean {
@Autowired
private EntitySourcesService entitySourcesService;
@Autowired
- private EntityProfilesService entityProfilesService;
+ private EntityIntegrationsService entityIntegrationsService;
@Override
@SuppressWarnings("unchecked")
@@ -43,11 +43,11 @@ public class ConfigSyncJob extends QuartzJobBean {
if (BooleanUtil.negate(isLeader)) return;
//判断数据库中服务状态
- String profilesStatus = sysConfigService.getValue(Constant.ENTITY_PROFILES_UPLOAD_STATUS);
+ String profilesStatus = sysConfigService.getValue(Constant.ENTITY_INTEGRATIONS_UPLOAD_STATUS);
String sourcesStatus = sysConfigService.getValue(Constant.ENTITY_SOURCES_UPLOAD_STATUS);
if(Integer.valueOf(profilesStatus).equals(0)){
- entityProfilesService.uploadConfig();
- sysConfigService.updateValueByKey(Constant.ENTITY_PROFILES_UPLOAD_STATUS, "1");
+ entityIntegrationsService.uploadConfig();
+ sysConfigService.updateValueByKey(Constant.ENTITY_INTEGRATIONS_UPLOAD_STATUS, "1");
}
if(Integer.valueOf(sourcesStatus).equals(0)){
entitySourcesService.uploadConfig();
diff --git a/cn-admin/src/main/java/net/geedge/modules/entity/service/EntityIntegrationsService.java b/cn-admin/src/main/java/net/geedge/modules/entity/service/EntityIntegrationsService.java
new file mode 100644
index 0000000..c23833c
--- /dev/null
+++ b/cn-admin/src/main/java/net/geedge/modules/entity/service/EntityIntegrationsService.java
@@ -0,0 +1,24 @@
+package net.geedge.modules.entity.service;
+
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import net.geedge.common.utils.PageUtils;
+import net.geedge.modules.entity.entity.EntityIntegrations;
+
+import java.util.List;
+import java.util.Map;
+
+public interface EntityIntegrationsService extends IService<EntityIntegrations> {
+
+ PageUtils queryPage(Map<String,Object> param);
+
+ void saveEntityIntegrations(EntityIntegrations entityIntegrations);
+
+ void modify(EntityIntegrations entityIntegrations);
+
+ void remove(List<String> ids);
+
+ void uploadConfig();
+
+ EntityIntegrations queryById(Integer id);
+}
diff --git a/cn-admin/src/main/java/net/geedge/modules/entity/service/EntityProfilesService.java b/cn-admin/src/main/java/net/geedge/modules/entity/service/EntityProfilesService.java
deleted file mode 100644
index 4e4289e..0000000
--- a/cn-admin/src/main/java/net/geedge/modules/entity/service/EntityProfilesService.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package net.geedge.modules.entity.service;
-
-
-import com.baomidou.mybatisplus.extension.service.IService;
-import net.geedge.common.utils.PageUtils;
-import net.geedge.modules.entity.entity.EntityProfiles;
-
-import java.util.List;
-import java.util.Map;
-
-public interface EntityProfilesService extends IService<EntityProfiles> {
-
- PageUtils queryPage(Map<String,Object> param);
-
- void saveEntityProfiles(EntityProfiles entityProfiles);
-
- void modify(EntityProfiles entityProfiles);
-
- void remove(List<String> ids);
-
- void uploadConfig();
-
- EntityProfiles queryById(Integer id);
-}
diff --git a/cn-admin/src/main/java/net/geedge/modules/entity/service/impl/EntityProfilesServiceImpl.java b/cn-admin/src/main/java/net/geedge/modules/entity/service/impl/EntityIntegrationsServiceImpl.java
index 29cb43e..2e08869 100644
--- a/cn-admin/src/main/java/net/geedge/modules/entity/service/impl/EntityProfilesServiceImpl.java
+++ b/cn-admin/src/main/java/net/geedge/modules/entity/service/impl/EntityIntegrationsServiceImpl.java
@@ -16,10 +16,10 @@ import net.geedge.common.utils.Constant;
import net.geedge.common.utils.PageUtils;
import net.geedge.common.utils.Query;
import net.geedge.common.utils.RCode;
-import net.geedge.modules.entity.dao.EntityProfilesDao;
-import net.geedge.modules.entity.entity.EntityProfiles;
+import net.geedge.modules.entity.dao.EntityIntegrationsDao;
+import net.geedge.modules.entity.entity.EntityIntegrations;
import net.geedge.modules.entity.entity.EntitySources;
-import net.geedge.modules.entity.service.EntityProfilesService;
+import net.geedge.modules.entity.service.EntityIntegrationsService;
import net.geedge.modules.entity.service.EntitySourcesService;
import net.geedge.modules.sys.service.SysConfigService;
import org.springframework.beans.factory.annotation.Autowired;
@@ -29,8 +29,8 @@ import java.util.*;
import java.util.stream.Collectors;
-@Service("entityProfilesService")
-public class EntityProfilesServiceImpl extends ServiceImpl<EntityProfilesDao, EntityProfiles> implements EntityProfilesService {
+@Service("entityIntegrationsService")
+public class EntityIntegrationsServiceImpl extends ServiceImpl<EntityIntegrationsDao, EntityIntegrations> implements EntityIntegrationsService {
private Log log = Log.get();
@Autowired
private ConfigService nacosServer;
@@ -41,38 +41,38 @@ public class EntityProfilesServiceImpl extends ServiceImpl<EntityProfilesDao, En
@Override
public PageUtils queryPage(Map<String, Object> param) {
- IPage page = new Query(EntityProfiles.class).getPage(param);
+ IPage page = new Query(EntityIntegrations.class).getPage(param);
String ids = (String)param.get("ids");
if(StrUtil.isNotBlank(ids)){
param.put("ids", Arrays.asList(ids.split(",")));
}
- List<EntityProfiles> data = this.baseMapper.queryPage(page,param);
+ List<EntityIntegrations> data = this.baseMapper.queryPage(page,param);
page.setRecords(data);
return new PageUtils(page);
}
@Override
- public void saveEntityProfiles(EntityProfiles entityProfiles) {
- this.validateParams(entityProfiles);
- entityProfiles.setCtime(new Date());
- entityProfiles.setUtime(new Date());
- this.baseMapper.insert(entityProfiles);
+ public void saveEntityIntegrations(EntityIntegrations entityIntegrations) {
+ this.validateParams(entityIntegrations);
+ entityIntegrations.setCtime(new Date());
+ entityIntegrations.setUtime(new Date());
+ this.baseMapper.insert(entityIntegrations);
uploadConfig();
}
@Override
- public void modify(EntityProfiles entityProfiles) {
- this.validateParams(entityProfiles);
- entityProfiles.setUtime(new Date());
- this.baseMapper.updateById(entityProfiles);
+ public void modify(EntityIntegrations entityIntegrations) {
+ this.validateParams(entityIntegrations);
+ entityIntegrations.setUtime(new Date());
+ this.baseMapper.updateById(entityIntegrations);
uploadConfig();
}
@Override
public void remove(List<String> ids) {
- List<EntityProfiles> profiles = this.list(new QueryWrapper<EntityProfiles>().lambda().in(EntityProfiles::getId, ids).eq(EntityProfiles::getIsBuiltIn, 1));
- if(ObjectUtil.isNotEmpty(profiles)){
- throw new CNException(RCode.ENTITY_PROFILES_BUILT_IN_ERROR);
+ List<EntityIntegrations> Integration = this.list(new QueryWrapper<EntityIntegrations>().lambda().in(EntityIntegrations::getId, ids).eq(EntityIntegrations::getIsBuiltIn, 1));
+ if(ObjectUtil.isNotEmpty(Integration)){
+ throw new CNException(RCode.ENTITY_INTEGRATIONS_BUILT_IN_ERROR);
}
this.baseMapper.deleteBatchIds(ids);
uploadConfig();
@@ -81,54 +81,54 @@ public class EntityProfilesServiceImpl extends ServiceImpl<EntityProfilesDao, En
@Override
public void uploadConfig() {
// 查询所有配置数据
- List<EntityProfiles> profiles = this.list();
- Map<String, Object> result = this.handlerProfilesDataToJson(profiles);
+ List<EntityIntegrations> Integration = this.list();
+ Map<String, Object> result = this.handlerIntegrationDataToJson(Integration);
try {
- boolean uploadflag = nacosServer.publishConfig(Constant.ENTITY_PROFILES_DATAID, Constant.NACOS_ENTITY_CONFIG_GROUP, JSON.toJSONString(result));
+ boolean uploadflag = nacosServer.publishConfig(Constant.ENTITY_INTEGRATIONS_DATAID, Constant.NACOS_ENTITY_CONFIG_GROUP, JSON.toJSONString(result));
if(!uploadflag){
sysConfigService.updateValueByKey(Constant.ENTITY_SOURCES_UPLOAD_STATUS,"0");
- log.error("[EntityProfilesServiceImpl] [uploadConfig] [upload failed]");
+ log.error("[EntityIntegrationServiceImpl] [uploadConfig] [upload failed]");
}
} catch (NacosException e) {
- sysConfigService.updateValueByKey(Constant.ENTITY_PROFILES_UPLOAD_STATUS,"0");
- log.error("[EntityProfilesServiceImpl] [uploadConfig] [Error info :{}]",e.getErrCode());
+ sysConfigService.updateValueByKey(Constant.ENTITY_INTEGRATIONS_UPLOAD_STATUS,"0");
+ log.error("[EntityIntegrationServiceImpl] [uploadConfig] [Error info :{}]",e.getErrCode());
}
}
- private Map<String,Object> handlerProfilesDataToJson(List<EntityProfiles> profiles){
+ private Map<String,Object> handlerIntegrationDataToJson(List<EntityIntegrations> Integration){
Map profileMap = new HashMap();
- List<Object> profilesList =new ArrayList();
- for(EntityProfiles profile : profiles){
+ List<Object> IntegrationList =new ArrayList();
+ for(EntityIntegrations intergration : Integration){
Map map = new HashMap();
- map.put("id",profile.getId());
- map.put("source_id",profile.getSourceId());
- map.put("entities", JSON.parseArray(profile.getEntities()));
- map.put("relations",ObjectUtil.isNotEmpty(profile.getRelations())?JSON.parseArray(profile.getRelations()):new ArrayList());
- map.put("is_valid",profile.getEnable());
- map.put("create_time",profile.getCtime());
- map.put("update_time",profile.getUtime());
- profilesList.add(map);
+ map.put("id",intergration.getId());
+ map.put("source_id",intergration.getSourceId());
+ map.put("entities", JSON.parseArray(intergration.getEntities()));
+ map.put("relations",ObjectUtil.isNotEmpty(intergration.getRelations())?JSON.parseArray(intergration.getRelations()):new ArrayList());
+ map.put("is_valid",intergration.getEnable());
+ map.put("create_time",intergration.getCtime());
+ map.put("update_time",intergration.getUtime());
+ IntegrationList.add(map);
}
- profileMap.put("entity_integrations",profilesList);
+ profileMap.put("entity_integrations",IntegrationList);
return profileMap;
}
@Override
- public EntityProfiles queryById(Integer id) {
- EntityProfiles entityProfiles = this.baseMapper.selectById(id);
- return entityProfiles;
+ public EntityIntegrations queryById(Integer id) {
+ EntityIntegrations entityIntegrations = this.baseMapper.selectById(id);
+ return entityIntegrations;
}
- private void validateParams(EntityProfiles entityProfiles){
- ValidateUtils.is(entityProfiles.getSourceId()).notNull(RCode.ENTITY_PROFILES_SOURCEID_ISNULL)
- .is(entityProfiles.getEntities()).notNull(RCode.ENTITY_PROFILES_ENTITIES_ISNULL);
+ private void validateParams(EntityIntegrations entityIntegrations){
+ ValidateUtils.is(entityIntegrations.getSourceId()).notNull(RCode.ENTITY_INTEGRATIONS_SOURCEID_ISNULL)
+ .is(entityIntegrations.getEntities()).notNull(RCode.ENTITY_INTEGRATIONS_ENTITIES_ISNULL);
- EntitySources entitySources = entitySourcesService.getById(entityProfiles.getSourceId());
+ EntitySources entitySources = entitySourcesService.getById(entityIntegrations.getSourceId());
if(ObjectUtil.isEmpty(entitySources)){
throw new CNException(RCode.ENTITY_SOURCES_ISNULL);
}
// 校验每个字段值是否一致
- String entities = entityProfiles.getEntities();
+ String entities = entityIntegrations.getEntities();
String fields = entitySources.getFields();
String lookups = entitySources.getLookups();
List<String> filedName = new ArrayList<String>();
@@ -155,8 +155,8 @@ public class EntityProfilesServiceImpl extends ServiceImpl<EntityProfilesDao, En
}
});
- if(ObjectUtil.isNotEmpty(entityProfiles.getIsBuiltIn()) && entityProfiles.getIsBuiltIn().equals(1)){
- throw new CNException(RCode.ENTITY_PROFILES_BUILT_IN_ERROR);
+ if(ObjectUtil.isNotEmpty(entityIntegrations.getIsBuiltIn()) && entityIntegrations.getIsBuiltIn().equals(1)){
+ throw new CNException(RCode.ENTITY_INTEGRATIONS_BUILT_IN_ERROR);
}
}
}
diff --git a/cn-admin/src/main/java/net/geedge/modules/entity/service/impl/EntitySourcesServiceImpl.java b/cn-admin/src/main/java/net/geedge/modules/entity/service/impl/EntitySourcesServiceImpl.java
index 1a7b50b..a1f9659 100644
--- a/cn-admin/src/main/java/net/geedge/modules/entity/service/impl/EntitySourcesServiceImpl.java
+++ b/cn-admin/src/main/java/net/geedge/modules/entity/service/impl/EntitySourcesServiceImpl.java
@@ -24,9 +24,9 @@ import net.geedge.common.exception.CNException;
import net.geedge.common.smartvalidate.ValidateUtils;
import net.geedge.common.utils.*;
import net.geedge.modules.entity.dao.EntitySourcesDao;
-import net.geedge.modules.entity.entity.EntityProfiles;
+import net.geedge.modules.entity.entity.EntityIntegrations;
import net.geedge.modules.entity.entity.EntitySources;
-import net.geedge.modules.entity.service.EntityProfilesService;
+import net.geedge.modules.entity.service.EntityIntegrationsService;
import net.geedge.modules.entity.service.EntitySourcesService;
import net.geedge.modules.sys.service.SysConfigService;
import org.apache.commons.io.FileUtils;
@@ -57,7 +57,7 @@ public class EntitySourcesServiceImpl extends ServiceImpl<EntitySourcesDao, Enti
@Autowired
private SysConfigService sysConfigService;
@Autowired
- private EntityProfilesService entityProfilesService;
+ private EntityIntegrationsService entityIntegrationsService;
@Autowired
private KafkaProducer<String,String> kafkaProducer;
@@ -96,7 +96,7 @@ public class EntitySourcesServiceImpl extends ServiceImpl<EntitySourcesDao, Enti
if(ObjectUtil.isNotEmpty(builtInSources)){
throw new CNException(RCode.ENTITY_SOURCES_BUILT_IN_ERROR);
}
- List<EntityProfiles> profiles = entityProfilesService.list(new QueryWrapper<EntityProfiles>().lambda().in(EntityProfiles::getSourceId, ids));
+ List<EntityIntegrations> profiles = entityIntegrationsService.list(new QueryWrapper<EntityIntegrations>().lambda().in(EntityIntegrations::getSourceId, ids));
if(ObjectUtil.isNotEmpty(profiles)){
throw new CNException(RCode.ENTITY_SOURCES_REMOVE_ERROR);
}
@@ -144,7 +144,7 @@ public class EntitySourcesServiceImpl extends ServiceImpl<EntitySourcesDao, Enti
@Override
public EntitySources queryById(Integer id) {
EntitySources entitySources = this.baseMapper.selectById(id);
- List<EntityProfiles> profiles = entityProfilesService.list(new QueryWrapper<EntityProfiles>().lambda().eq(EntityProfiles::getSourceId, entitySources.getId()));
+ List<EntityIntegrations> profiles = entityIntegrationsService.list(new QueryWrapper<EntityIntegrations>().lambda().eq(EntityIntegrations::getSourceId, entitySources.getId()));
entitySources.setUsage(ObjectUtil.isNotEmpty(profiles)?profiles.size():0);
return entitySources;
}
@@ -321,7 +321,7 @@ public class EntitySourcesServiceImpl extends ServiceImpl<EntitySourcesDao, Enti
}
if(ObjectUtil.isNotEmpty(entitySources.getId())){
- List<EntityProfiles> profiles = entityProfilesService.list(new QueryWrapper<EntityProfiles>().lambda().eq(EntityProfiles::getSourceId, entitySources.getId()));
+ List<EntityIntegrations> profiles = entityIntegrationsService.list(new QueryWrapper<EntityIntegrations>().lambda().eq(EntityIntegrations::getSourceId, entitySources.getId()));
if(ObjectUtil.isNotEmpty(profiles)){
throw new CNException(RCode.ENTITY_SOURCES_REFERENCED_ERROR);
}
diff --git a/cn-admin/src/main/resources/db/R__AZ_entity_config.sql b/cn-admin/src/main/resources/db/R__AZ_entity_config.sql
index da901d0..19817b2 100644
--- a/cn-admin/src/main/resources/db/R__AZ_entity_config.sql
+++ b/cn-admin/src/main/resources/db/R__AZ_entity_config.sql
@@ -8,5 +8,5 @@ INSERT INTO `entity_sources` VALUES (2, 'SUBSCRIBER-LOCATION-MAPPING ', 'json',
/*
entity profiles 内置数据
*/
-INSERT INTO `entity_profiles` VALUES (1, 1, '[{\"index\":1,\"type\":\"ip\",\"name\":\"IP\",\"list\":[{\"entityField\":\"ip\",\"sourceField\":\"server_ip\"},{\"entityField\":\"ports\",\"sourceField\":\"server_port\"},{\"entityField\":\"ip_country\",\"sourceField\":\"server_ip_country\"},{\"entityField\":\"ip_super_admin_area\",\"sourceField\":\"server_ip_province\"},{\"entityField\":\"ip_admin_area\",\"sourceField\":\"server_ip_city\"},{\"entityField\":\"ip_asn\",\"sourceField\":\"server_ip_asn\"},{\"entityField\":\"ip_isp\",\"sourceField\":\"server_ip_isp\"},{\"entityField\":\"seen_time\",\"sourceField\":\"recv_time\"}],\"mapping\":{\"ip\":\"server_ip\",\"ports\":\"server_port\",\"ip_country\":\"server_ip_country\",\"ip_super_admin_area\":\"server_ip_province\",\"ip_admin_area\":\"server_ip_city\",\"ip_asn\":\"server_ip_asn\",\"ip_isp\":\"server_ip_isp\",\"seen_time\":\"recv_time\"},\"disabled\":false},{\"index\":2,\"type\":\"domain\",\"name\":\"Domain\",\"list\":[{\"entityField\":\"domain\",\"sourceField\":\"server_fqdn\"},{\"entityField\":\"seen_time\",\"sourceField\":\"recv_time\"}],\"mapping\":{\"domain\":\"server_fqdn\",\"seen_time\":\"recv_time\"},\"disabled\":false},{\"index\":3,\"type\":\"app\",\"name\":\"APP\",\"list\":[{\"entityField\":\"app\",\"sourceField\":\"app\"},{\"entityField\":\"seen_time\",\"sourceField\":\"recv_time\"}],\"mapping\":{\"app\":\"app\",\"seen_time\":\"recv_time\"},\"disabled\":false},{\"index\":4,\"type\":\"subscriber\",\"name\":\"Subscriber\",\"list\":[{\"entityField\":\"subscriber_id\",\"sourceField\":\"subscriber_id\"},{\"entityField\":\"subscriber_phone_number\",\"sourceField\":\"phone_number\"},{\"entityField\":\"subscriber_imsi\",\"sourceField\":\"imsi\"},{\"entityField\":\"subscriber_imei\",\"sourceField\":\"imei\"},{\"entityField\":\"subscriber_apns\",\"sourceField\":\"apn\"},{\"entityField\":\"seen_time\",\"sourceField\":\"recv_time\"}],\"mapping\":{\"subscriber_id\":\"subscriber_id\",\"subscriber_phone_number\":\"phone_number\",\"subscriber_imsi\":\"imsi\",\"subscriber_imei\":\"imei\",\"subscriber_apns\":\"apn\",\"seen_time\":\"recv_time\"},\"disabled\":false}]', '[{\"from_entity_index\":2,\"to_entity_index\":1,\"type\":\"RESOLVE_DOMAIN_IP\",\"fromDisabled\":true,\"toDisabled\":true},{\"from_entity_index\":3,\"to_entity_index\":1,\"type\":\"CARRY_APP_IP\",\"fromDisabled\":true,\"toDisabled\":true},{\"from_entity_index\":3,\"to_entity_index\":2,\"type\":\"CARRY_APP_DOMAIN\",\"fromDisabled\":true,\"toDisabled\":true},{\"from_entity_index\":4,\"to_entity_index\":3,\"type\":\"VISIT_SUBSCRIBER_APP\"}]', '2024-11-20 03:37:27', '2024-11-21 07:07:27', 1, 0);
-INSERT INTO `entity_profiles` VALUES (2, 2, '[{\"index\":1,\"type\":\"subscriber\",\"name\":\"Subscriber\",\"list\":[{\"entityField\":\"subscriber_id\",\"sourceField\":\"subscriber_id\"},{\"entityField\":\"subscriber_imsi\",\"sourceField\":\"imsi\"},{\"entityField\":\"subscriber_imei\",\"sourceField\":\"imei\"},{\"entityField\":\"subscriber_apns\",\"sourceField\":\"apn\"},{\"entityField\":\"seen_time\",\"sourceField\":\"ingestion_time\"}],\"mapping\":{\"subscriber_id\":\"subscriber_id\",\"subscriber_imsi\":\"imsi\",\"subscriber_imei\":\"imei\",\"subscriber_apns\":\"apn\",\"seen_time\":\"ingestion_time\"}}]', '[]', '2024-11-20 06:29:34', '2024-11-20 08:10:07', 1, 0);
+INSERT INTO `entity_integrations` VALUES (1, 1, '[{\"index\":1,\"type\":\"ip\",\"name\":\"IP\",\"list\":[{\"entityField\":\"ip\",\"sourceField\":\"server_ip\"},{\"entityField\":\"ports\",\"sourceField\":\"server_port\"},{\"entityField\":\"ip_country\",\"sourceField\":\"server_ip_country\"},{\"entityField\":\"ip_super_admin_area\",\"sourceField\":\"server_ip_province\"},{\"entityField\":\"ip_admin_area\",\"sourceField\":\"server_ip_city\"},{\"entityField\":\"ip_asn\",\"sourceField\":\"server_ip_asn\"},{\"entityField\":\"ip_isp\",\"sourceField\":\"server_ip_isp\"},{\"entityField\":\"seen_time\",\"sourceField\":\"recv_time\"}],\"mapping\":{\"ip\":\"server_ip\",\"ports\":\"server_port\",\"ip_country\":\"server_ip_country\",\"ip_super_admin_area\":\"server_ip_province\",\"ip_admin_area\":\"server_ip_city\",\"ip_asn\":\"server_ip_asn\",\"ip_isp\":\"server_ip_isp\",\"seen_time\":\"recv_time\"},\"disabled\":false},{\"index\":2,\"type\":\"domain\",\"name\":\"Domain\",\"list\":[{\"entityField\":\"domain\",\"sourceField\":\"server_fqdn\"},{\"entityField\":\"seen_time\",\"sourceField\":\"recv_time\"}],\"mapping\":{\"domain\":\"server_fqdn\",\"seen_time\":\"recv_time\"},\"disabled\":false},{\"index\":3,\"type\":\"app\",\"name\":\"APP\",\"list\":[{\"entityField\":\"app\",\"sourceField\":\"app\"},{\"entityField\":\"seen_time\",\"sourceField\":\"recv_time\"}],\"mapping\":{\"app\":\"app\",\"seen_time\":\"recv_time\"},\"disabled\":false},{\"index\":4,\"type\":\"subscriber\",\"name\":\"Subscriber\",\"list\":[{\"entityField\":\"subscriber_id\",\"sourceField\":\"subscriber_id\"},{\"entityField\":\"subscriber_phone_number\",\"sourceField\":\"phone_number\"},{\"entityField\":\"subscriber_imsi\",\"sourceField\":\"imsi\"},{\"entityField\":\"subscriber_imei\",\"sourceField\":\"imei\"},{\"entityField\":\"subscriber_apns\",\"sourceField\":\"apn\"},{\"entityField\":\"seen_time\",\"sourceField\":\"recv_time\"}],\"mapping\":{\"subscriber_id\":\"subscriber_id\",\"subscriber_phone_number\":\"phone_number\",\"subscriber_imsi\":\"imsi\",\"subscriber_imei\":\"imei\",\"subscriber_apns\":\"apn\",\"seen_time\":\"recv_time\"},\"disabled\":false}]', '[{\"from_entity_index\":2,\"to_entity_index\":1,\"type\":\"RESOLVE_DOMAIN_IP\",\"fromDisabled\":true,\"toDisabled\":true},{\"from_entity_index\":3,\"to_entity_index\":1,\"type\":\"CARRY_APP_IP\",\"fromDisabled\":true,\"toDisabled\":true},{\"from_entity_index\":3,\"to_entity_index\":2,\"type\":\"CARRY_APP_DOMAIN\",\"fromDisabled\":true,\"toDisabled\":true},{\"from_entity_index\":4,\"to_entity_index\":3,\"type\":\"VISIT_SUBSCRIBER_APP\"}]', '2024-11-20 03:37:27', '2024-11-21 07:07:27', 1, 0);
+INSERT INTO `entity_integrations` VALUES (2, 2, '[{\"index\":1,\"type\":\"subscriber\",\"name\":\"Subscriber\",\"list\":[{\"entityField\":\"subscriber_id\",\"sourceField\":\"subscriber_id\"},{\"entityField\":\"subscriber_imsi\",\"sourceField\":\"imsi\"},{\"entityField\":\"subscriber_imei\",\"sourceField\":\"imei\"},{\"entityField\":\"subscriber_apns\",\"sourceField\":\"apn\"},{\"entityField\":\"seen_time\",\"sourceField\":\"ingestion_time\"}],\"mapping\":{\"subscriber_id\":\"subscriber_id\",\"subscriber_imsi\":\"imsi\",\"subscriber_imei\":\"imei\",\"subscriber_apns\":\"apn\",\"seen_time\":\"ingestion_time\"}}]', '[]', '2024-11-20 06:29:34', '2024-11-20 08:10:07', 1, 0);
diff --git a/cn-admin/src/main/resources/db/R__AZ_sys_menu.sql b/cn-admin/src/main/resources/db/R__AZ_sys_menu.sql
index 5ff0765..37d4377 100644
--- a/cn-admin/src/main/resources/db/R__AZ_sys_menu.sql
+++ b/cn-admin/src/main/resources/db/R__AZ_sys_menu.sql
@@ -78,5 +78,8 @@ INSERT INTO `sys_menu` VALUES (51, 'Delete source', 'deleteSource', 'overall.del
INSERT INTO `sys_menu` VALUES (52, 'Create entity settting', 'createEntitySetting', 'overall.create', 48, '', 1, '/setting/entitySetting/create', '', NULL, 1, 1);
INSERT INTO `sys_menu` VALUES (53, 'Edit entity setting', 'editEntitySetting', 'overall.edit', 48, '', 1, '/setting/entitySetting/edit', '', NULL, 1, 1);
INSERT INTO `sys_menu` VALUES (54, 'Delete entity setting', 'deleteEntitySetting', 'overall.delete', 48, '', 2, '', '', NULL, 1, 1);
+INSERT INTO `sys_menu` VALUES (55, 'View data source', 'viewDataSource', 'overall.detail', 47, '', 1, '/setting/source/view', '', NULL, 2, 1);
+INSERT INTO `sys_menu` VALUES (56, 'Edit entity', 'editEntity', 'overall.edit', 5, '', 2, '', '', NULL, 1, 1);
+INSERT INTO `sys_menu` VALUES (57, 'View entity setting', 'viewEntityIntegration', 'overall.view', 48, '', 1, '/setting/entityIntegration/view', '', NULL, 1, 1);
SET FOREIGN_KEY_CHECKS = 1;
diff --git a/cn-admin/src/main/resources/db/R__AZ_sys_role_menu.sql b/cn-admin/src/main/resources/db/R__AZ_sys_role_menu.sql
index a315826..527eae5 100644
--- a/cn-admin/src/main/resources/db/R__AZ_sys_role_menu.sql
+++ b/cn-admin/src/main/resources/db/R__AZ_sys_role_menu.sql
@@ -339,5 +339,8 @@ INSERT INTO `sys_role_menu` VALUES (null, 1, 51);
INSERT INTO `sys_role_menu` VALUES (null, 1, 52);
INSERT INTO `sys_role_menu` VALUES (null, 1, 53);
INSERT INTO `sys_role_menu` VALUES (null, 1, 54);
+INSERT INTO `sys_role_menu` VALUES (null, 1, 55);
+INSERT INTO `sys_role_menu` VALUES (null, 1, 56);
+INSERT INTO `sys_role_menu` VALUES (null, 1, 57);
SET FOREIGN_KEY_CHECKS = 1; \ No newline at end of file
diff --git a/cn-admin/src/main/resources/db/V24.11.06__add entity profiles sources table.sql b/cn-admin/src/main/resources/db/V24.11.06__add entity integrations sources table.sql
index a0f3270..c2ba9a2 100644
--- a/cn-admin/src/main/resources/db/V24.11.06__add entity profiles sources table.sql
+++ b/cn-admin/src/main/resources/db/V24.11.06__add entity integrations sources table.sql
@@ -1,5 +1,5 @@
-DROP TABLE IF EXISTS `entity_profiles`;
-CREATE TABLE `entity_profiles` (
+DROP TABLE IF EXISTS `entity_integrations`;
+CREATE TABLE `entity_integrations` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`source_id` int(11) NOT NULL,
`entities` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
diff --git a/cn-admin/src/main/resources/mapper/entity/EntityProfilesDao.xml b/cn-admin/src/main/resources/mapper/entity/EntityIntegrationDao.xml
index 3f7cdac..4359ee6 100644
--- a/cn-admin/src/main/resources/mapper/entity/EntityProfilesDao.xml
+++ b/cn-admin/src/main/resources/mapper/entity/EntityIntegrationDao.xml
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="net.geedge.modules.entity.dao.EntityProfilesDao">
+<mapper namespace="net.geedge.modules.entity.dao.EntityIntegrationsDao">
- <resultMap id="entityProfiles" type="net.geedge.modules.entity.entity.EntityProfiles">
+ <resultMap id="entityIntegrations" type="net.geedge.modules.entity.entity.EntityIntegrations">
<result property="id" column="id"></result>
<result property="sourceId" column="source_id"></result>
<result property="entities" column="entities"></result>
@@ -17,12 +17,12 @@
<result column="name" property="name"/>
</association>
</resultMap>
- <select id="queryPage" resultMap="entityProfiles">
+ <select id="queryPage" resultMap="entityIntegrations">
select
ep.*,
es.id as es_id,
es.name as es_name
- from entity_profiles ep
+ from entity_integrations ep
left join entity_sources es on ep.source_id = es.id
<where>
<if test="param.sourceId !=null">