Compare commits

..

33 Commits

Author SHA1 Message Date
liuy 2f416ed198 feat(nifi): 添加 NiFi API 客户端相关功能
- 实现了 NiFiClient 类,提供与 NiFi API 交互的功能
- 添加了必要的配置类和模型类
- 实现了基本的 HTTP 请求方法(GET、POST、DELETE、PUT)
-集成了 Jackson 和 OkHttpClient
2025-09-13 10:59:28 +08:00
476474485@qq.com 60a8739b06 Merge remote-tracking branch 'origin/fw-nifi' into fw-nifi 2025-09-06 12:16:15 +08:00
476474485@qq.com 348f0caf2d 预算代码提交 2025-09-06 12:15:11 +08:00
liuy 0b7a644ed0 test(jolt): 添加新的 Jolt 测试用例和功能
- 在 TestJoltCardinality 类中添加了新的测试方法 testDemo3
- 在 TestJoltShift 类中添加了新的测试方法 testDemo16
- 新增了 UserVo 类用于测试
- 更新了 TestNifiDbSync 类中的参数配置
- 添加了新的 JSON 输入文件和规范文件用于测试
- 引入了 QLExpress依赖并添加了相关测试类 TestQl
2025-07-23 14:14:46 +08:00
liuy f01f5cd00a test(jolt): 添加 Jolt框架相关测试用例- 新增多个测试类,覆盖 Jolt 框架的各种操作:
- TestJoltCardinality: 测试 cardinality 操作  - TestJoltDefault:测试 default 操作
  - TestJoltModify: 测试 modify操作
  - TestJoltRemove: 测试 remove 操作 - TestJoltShift: 测试 shift 操作
  - TestJoltSort: 测试 sort 操作
- 在 pom.xml 中添加 Jolt 相关依赖
2025-07-01 08:50:56 +08:00
liuy 9ace3f6737 test(jolt-demo): 添加新功能测试用例和规格说明
- 新增 cardinality、default、modify、remove、shift、sort等操作的测试用例
- 添加相应的规格说明文件,详细描述每种操作的使用方法和示例
- 为 shift 操作提供了多种不同场景的测试用例和说明
2025-07-01 08:50:08 +08:00
liuy f9eb0bdea3 feat(base-buildpackage): 优化数据同步参数化功能
- 新增自动建表功能,增加相关连接和参数配置
- 更新 Oracle 和 MySQL 参数配置,适应新的数据同步需求
- 优化参数环境名称生成逻辑,使用当前时间作为后缀
- 调整字段映射关系配置,提高数据同步准确性
- 注释掉不必要的参数配置,简化配置结构
2025-05-28 16:07:44 +08:00
liuy 460722dde6 refactor(nifi): 移除 Connections 类中未使用的 bends 字段
- 删除了 Connections 类中的 bends 字段
- 该字段类型为 List<String>,但未在代码中使用
- 移除未使用的字段可以提高代码的可读性和维护性
2025-05-28 16:06:55 +08:00
liuy fa9def8ded test(nifi): 更新测试用例以支持新的处理器创建和参数更新功能
- 新增测试用例以验证处理器复制功能
- 新增测试用例以验证创建处理器并更新参数的功能
- 更新现有测试用例以使用新的处理器创建方法
- 优化测试用例中的参数设置和处理器配置
2025-05-27 15:12:33 +08:00
liuy 56841ca743 feat(nifi): 优化流程组状态清理和控制器服务激活功能- 修改了 findNeedModifyControllerAndChangesOccur 方法的调用参数,从 true, true 改为 true, false
- 新增了激活流程组内所有控制器服务的逻辑
- 优化了清理流程组状态的逻辑,使用新的状态清理标记
- 修复了批量启用控制器服务时的版本控制问题
2025-05-27 11:10:18 +08:00
liuy b9bca5795d feat(nifi): 新增处理器复制和状态清理功能
- 新增 CreateProcessorAndUpdateParamJoin 类用于创建处理器和更新参数
- 在 NifiAppOperationImpl 中实现 createProcessorAndUpdateParam 方法
- 在 NifiBaseOperationImpl 中实现 copyProcessor 和 clearProcessGroupState 方法
- 更新 INifiAppOperation 和 INifiBaseOperation 接口
- 新增 Relationships15、Processors16 等相关模型类
2025-05-26 19:15:03 +08:00
liuy d504b44601 test(nifi): 添加 Nifi 数据同步相关测试用例
- 新增 TestINifiBaseOperation 类,包含控制器服务和连接关系测试- 新增 TestNifiDbSync 类,涵盖参数上下文、控制器服务、流程组创建等测试- 移除 TestNifiLog 中的未使用引用
2025-05-23 17:46:20 +08:00
liuy 346dcdf75d refactor(nifi): 重构 Oracle 应用创建逻辑
-重命名 CreateAppInstance 类为 CreateAppInstanceJoin,以更准确地反映其功能
- 新增 CreateAppInstanceResult 类用于封装创建结果
- 修改 INifiAppOperation接口,使用 CreateAppInstanceJoin 作为入参,返回 CreateAppInstanceResult 对象
- 优化 NifiAppOperationImpl 中的 createAppContext 方法,返回新创建的流程组 ID
- 调整 INifiBaseOperation 接口文档,明确 mark 参数为可选
- 优化 NifiFilterUtil 中的 filterPortsByComments 方法,支持空 mark 参数
2025-05-23 17:45:15 +08:00
liuy a5ee210a22 feat(nifi): 增加接口关系标记功能
- 在 NifiServiceConfig 中添加 relationshipMark配置项
- 在 Component 类中增加 comments、state、type等字段
- 新增 PortFilterResult 类用于存储过滤后的端口结果
- 在 NifiBaseOperationImpl 中实现 getNeedModifyControllerRelationshipByProcessGroup 方法
- 在 INifiBaseOperation 接口中添加相应的方法声明
- 新增 NifiFilterUtil 工具类用于过滤端口
2025-05-23 15:12:12 +08:00
liuy 095e58d812 feat(nifi): 完善应用创建并实例化的功能
-重构了应用创建流程,支持 Oracle 和 MySQL 应用的创建和实例化
- 新增了控制器服务的修改和启用功能
- 添加了批量创建连接关系的方法- 优化了代码结构,提高了可维护性和可扩展性
2025-05-23 10:18:07 +08:00
liuy 83f99be452 feat(nifi): 新增参数上下文创建和控制器更新功能
- 新增创建参数上下文并绑定到指定流程组的功能
- 新增查询需要修改的控制器详情功能
- 新增更新控制器服务的功能
- 重构了基础操作接口,增加了新的操作方法
-优化了代码结构,提高了可维护性和可扩展性
2025-05-22 11:51:11 +08:00
liuy 58ff225c47 feat(nifi): 新增应用实例化功能
- 新增 Oracle 和 MySQL 应用实例化功能- 实现创建流程组、处理器和连接的功能
- 添加计算新组件坐标的逻辑
- 封装基础操作和 NiFi 操作接口
2025-05-21 18:20:50 +08:00
liuy 675b4a7925 test(frame): 添加 Nifi 日志测试类
- 新增 TestNifiLog 类,用于测试 Nifi 日志查询功能
- 实现了查询指定处理器 ID 和日期的日志信息
- 使用 Spring Boot测试框架,集成 ILoggingEvent20250430Dao
2025-05-20 16:49:10 +08:00
liuy a0900b1cee feat(nifilog): 添加 2025 年 4月 30 日的日志事件和属性表
- 新增 LoggingEvent20250430 和 LoggingEventProperty20250430 两个实体类
- 实现了对应的 DAO 和 Service 接口及其实现类
- 添加了分页查询、批量插入等方法
2025-05-20 16:34:42 +08:00
liuy d7413fb99f build(base-buildpackage): 添加 dev环境配置文件
- 新增 application-liuy.yml 文件,包含 dev 环境的配置信息
- 配置内容包括日志设置、数据源配置、文件保存路径等
- 添加了与 CBS8、OA 等系统的集成配置
- 包含了 NiFi API 的访问信息
2025-05-20 08:59:07 +08:00
liuy 7d60bdeef4 build: 更新项目构建配置
- 移除 NiFi 客户端相关代码
- 删除了多个 NiFi 模型类
- 移除了 NiFi 服务配置类
- 删除了自定义的 OkHttpClient 和 Jackson 配置
2025-05-19 15:50:33 +08:00
liuy c0ef153a17 feat(nifi): 添加创建连接关系功能
- 新增 CreateConnection18、Component18、Revision18 等相关模型类- 在 NifiApiService 中添加 createProcessorConnections 方法用于建立连接关系
- 新增对应的请求和响应模型类,以支持创建连接关系的 API 调用
2025-05-19 15:47:32 +08:00
liuy 7abd8bbed9 feat(nifi-client): 增加处理器详情查询、更新和删除功能
- 新增处理器详情查询、更新和删除相关的 API 接口
- 添加处理器信息和版本相关的新模型类
- 优化错误处理,使用 StrUtil 格式化错误信息
2025-05-19 11:49:10 +08:00
liuy b228ab67a5 feat(nifi): 增加创建模板、实例化代码片段和创建处理器的功能
- 新增创建 NiFi 模板的功能
- 实现将代码片段实例化到指定位置的方法
- 添加创建处理器的功能,支持 nifi 1.28.1 版本的 364 个处理器- 优化日志输出,使用 slf4j 替代 System.out.println
- 新增多个结果模型类,用于处理不同类型的响应数据
2025-05-17 16:53:07 +08:00
liuy 7a5e8bf6f2 feat(nifi): 添加模板和代码片段相关功能
- 新增获取所有 XML 模板的接口- 新增根据模板 ID 获取 XML 模板内容的接口
- 新增生成模板的功能
- 新增复制流程组为代码片段的功能
- 优化 NiFi 客户端,支持 GET 请求返回文件流
2025-05-17 11:27:27 +08:00
liuy 6afd2264e3 feat(nifi): 添加控制器服务启用、禁用和删除功能
- 新增 EnOrDiControllerServices12 和 Revision13 类用于启用或禁用控制器服务
- 在 NifiApiService 中添加 enabledOrDisabledControllerServices 方法实现控制器服务启用或禁用
- 在 NifiApiService 中添加 deleteControllerServices 方法实现控制器服务删除
2025-05-16 17:49:06 +08:00
liuy a37f6ab340 feat(nifi): 添加控制器服务相关功能
- 新增 ControllerService12、Component12、Revision12 类用于处理控制器服务相关数据
- 在 NifiApiService 中添加获取控制器服务详情和创建流程组级别的控制器服务的方法
2025-05-16 16:45:17 +08:00
liuy 72710dc255 feat(nifi): 增加流程组相关API接口并优化参数处理
- 新增流程组查询、创建、删除和启动/停止的API接口
- 添加流程组绑定参数上下文的接口
- 优化参数处理,支持直接传入对象作为请求体
-重构部分代码以提高可维护性
2025-05-16 11:21:28 +08:00
liuy 9acde1cb1e feat(nifi-client): 添加删除参数上下文功能并优化模型命名- 在 NifiClient 中添加 delete 方法支持 DELETE 请求
- 在 NifiApiService 中实现删除参数上下文的接口
- 优化模型类命名,提高代码可读性
- 更新参数上下文相关 API 调用路径
2025-05-15 10:23:05 +08:00
liuy e535d45df3 feat(nifi): 添加参数上下文功能并优化错误处理
- 新增参数上下文相关模型类- 实现参数上下文创建、更新、删除和查询的API接口
- 优化错误处理,提高异常信息的可读性
- 移除未使用的ProcessorConfig类
2025-05-14 19:09:55 +08:00
liuy 5d9fb90fb1 refactor(fw-nifi):重构 Nifi 相关代码- 更新 Jackson 配置,增加忽略未知属性的功能
- 新增多个 Nifi 模型类,包括 Breadcrumb2、Breadcrumb3、ParentBreadcrumb2 和 Permissions2
- 修改现有模型类,增加新字段以适应 Nifi API 变更
- 调整 NifiApiService 中的 queryFlowProcessGroupsRoot 方法,支持返回不同类型的响应
2025-05-14 18:27:58 +08:00
liuy 10aeddff70 (nfeatifi): 添加 NiFi API 客户端和相关模型类
- 新增 NiFi API客户端类 NifiClient,实现与 NiFi 服务器的通信
- 添加多个 NiFi 模型类,用于解析和处理 NiFi API 响应数据
- 新增 Jackson 配置类和 JSON 工具类,用于 JSON 数据处理
- 移除无用的 Main 类
2025-05-14 17:49:37 +08:00
xiang2lin 7262d4f9a3 fw-nifi模块初始化 2025-05-12 14:17:58 +08:00
510 changed files with 14236 additions and 2069 deletions

View File

@ -18,6 +18,28 @@
<artifactId>base-webapp</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>com.hzya.frame</groupId>
<artifactId>fw-nifi</artifactId>
<version>0.0.1-SNAPSHOT</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.bazaarvoice.jolt</groupId>
<artifactId>jolt-core</artifactId>
<version>${latest.jolt.version}</version>
</dependency>
<dependency>
<groupId>com.bazaarvoice.jolt</groupId>
<artifactId>json-utils</artifactId>
<version>${latest.jolt.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.alibaba/QLExpress -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>QLExpress</artifactId>
<version>3.3.4</version>
</dependency>
</dependencies>
<profiles>
@ -32,6 +54,12 @@
</profile>
<profile>
<id>liuy</id> <!--刘洋-->
<properties>
<profile.active>liuy</profile.active>
</properties>
</profile>
<profile>
<id>llg</id> <!--吕磊钢-->
<properties>

View File

@ -0,0 +1,48 @@
#######################dev环境#######################
logging:
#日志级别 指定目录级别
level:
root: warn
encodings: UTF-8
file:
# 日志保存路径
path: /Users/liuyang/workspaces/hzya/fw-nifi/zt-log
spring:
datasource:
dynamic:
datasource:
master:
url: jdbc:mysql://ufidahz.com.cn:9014/businesscenter?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowLoadLocalInfile=false&autoReconnect=true&failOverReadOnly=false&connectTimeout=30000&socketTimeout=30000&autoReconnectForPools=true
username: root
password: bd993088e8a7c3dc5f44441617f9b4bf
driver-class-name: com.mysql.jdbc.Driver # 3.2.0开始支持SPI可省略此配置
savefile:
# 文件保存路径
path: /Users/liuyang/workspaces/hzya/fw-nifi/zt-file
# path: D:\webservice\file
# pluginpath: D:\webservice\plugin
pluginpath: /home/webservice/zt/plugin
# tomcatpath: D:\apache-tomcat-9.0.69\webapps\kangarooDataCenter\WEB-INF\classes\
tomcatpath: /home/webservice/zt/tomcatV3/webapps/kangarooDataCenterV3/WEB-INF/classes/
cbs8:
appId: 1P4AGrpz
appSecret: 2c2369ae5dc04382844bbe3a5abf39e1bea9cd3a
url: https://cbs8-openapi-reprd.csuat.cmburl.cn
# 测试用这个 这个是银行给的,和下面的公钥不是一对密钥
ya_private_key: 83BA7EC821D35F4CB31FF9A51C1EFA520FC52AF828C2337F88E91CF119B07F44
# 这个私钥到时候上传到cbs和下面到是同一对
#ya_private_key: e1eacfdee9b8d4184437d5a2071e17ce31befc3d93395f9f05709ed562e8dc46
ya_public_key: 044fa399d2223760f17b81b863cb482b009294c4516f8a605dea1475ec09e720eaa98468715e5ad509a592a0b426061551c5a3df236966c23253a7d894eac0dcde
cbs_public_key: 0469146F06BF3B01236E84632441E826
#电子回单下载临时存放位置
elec_path: /Users/xiangerlin/Downloads/
OA:
data_source_code: yc_oa
zt:
url: http://127.0.0.1:9082/kangarooDataCenterV3/entranceController/externalCallInterface
nifi:
api:
url: https://192.168.2.233:8443/nifi-api
username: hzya
password: hzya1314*nifi

View File

@ -0,0 +1,136 @@
package com.hzya.frame;
import com.hzya.frame.nifiapi.model.joincreateprocessorandupdateparam.CreateProcessorAndUpdateParamJoin;
import com.hzya.frame.nifiapi.model.joingetallcontrollerservice.Component19;
import com.hzya.frame.nifiapi.model.joingetallcontrollerservice.ControllerServices19;
import com.hzya.frame.nifiapi.model.resultNeedModifyController.PortFilterResult;
import com.hzya.frame.nifiapi.model.resultprocessorsinfo.Component16;
import com.hzya.frame.nifiapi.model.resultprocessorsinfo.Config16;
import com.hzya.frame.nifiapi.operation.INifiAppOperation;
import com.hzya.frame.nifiapi.operation.INifiBaseOperation;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @Authorliuyang
* @Packagecom.hzya.frame
* @Projectfw-nifi
* @nameTestINifiBaseOperation
* @Date2025/5/22 17:02
* @FilenameTestINifiBaseOperation
*/
@RunWith(SpringRunner.class)
@SpringBootTest(classes = {WebappApplication.class})
public class TestINifiBaseOperation {
@Autowired
private INifiBaseOperation iNifiBaseOperation;
@Autowired
private INifiAppOperation iNifiAppOperation;
@Test
public void testGetNeedModifyControllerServicesByProcessGroup() throws Exception {
try {
List<ControllerServices19> needModifyControllerServicesByProcessGroup = iNifiBaseOperation.getNeedModifyControllerServicesByProcessGroup("4143d803-0196-1000-968f-b06f55b43a3f");
System.out.println(needModifyControllerServicesByProcessGroup.size());
ControllerServices19 controllerServices19 = needModifyControllerServicesByProcessGroup.get(0);
Component19 component = controllerServices19.getComponent();
System.out.println(component.getName());
} catch (Exception e) {
e.printStackTrace();
}
}
@Test
public void testGetNeedModifyControllerServicesByProcessGroup2() throws Exception {
try {
ControllerServices19 czfJwnb9sb = iNifiBaseOperation.getNeedModifyControllerServicesByProcessGroup("4143d803-0196-1000-968f-b06f55b43a3f", "CZFJwnb9sb");
if (czfJwnb9sb != null && czfJwnb9sb.getComponent() != null) {
Component19 component = czfJwnb9sb.getComponent();
String name = component.getName();
System.out.println(name);
}
} catch (Exception e) {
e.printStackTrace();
}
}
@Test
public void testGetNeedModifyControllerRelationshipByProcessGroup() throws Exception {
try {
PortFilterResult needModifyControllerRelationshipByProcessGroup = iNifiBaseOperation.getNeedModifyControllerRelationshipByProcessGroup("41437b87-0196-1000-6951-50e41e75c0da", "f5228bc8-0360-41eb-a640-9f4df953937c");
System.out.println(needModifyControllerRelationshipByProcessGroup);
} catch (Exception e) {
e.printStackTrace();
}
}
@Test
public void testCopyProcessor() throws Exception {
try {
String targetProcessorId = "7f70897a-0196-1000-241a-3a7cdf5bf521";
String parentProcessGroupId = "76e23100-ad84-1aab-4447-b9ee936ee7d5";
String copyTargetProcessGroupId = "76e23115-ad84-1aab-7630-21c76aa3973d";
String s = iNifiBaseOperation.copyProcessor(targetProcessorId, parentProcessGroupId, copyTargetProcessGroupId);
System.out.println("新处理器id" + s);
} catch (Exception e) {
e.printStackTrace();
}
}
@Test
public void testCreateProcessorAndUpdateParam() {
try {
Map<String, String> properties = new HashMap<>();
properties.put("File Size", "1B");
properties.put("Batch Size", "2");
properties.put("Data Format", "Binary");
properties.put("Unique FlowFiles", "true");
properties.put("character-set", "GBK");
Config16 config16 = new Config16();
config16.setProperties(properties);
Component16 component16 = new Component16();
component16.setName("修改处理器名称2");
component16.setConfig(config16);
CreateProcessorAndUpdateParamJoin createProcessorAndUpdateParamJoin = new CreateProcessorAndUpdateParamJoin();
createProcessorAndUpdateParamJoin.setComponent(component16);
createProcessorAndUpdateParamJoin.setTargetProcessorId("7f70897a-0196-1000-241a-3a7cdf5bf521");
createProcessorAndUpdateParamJoin.setCopyTargetProcessGroupId("76e23115-ad84-1aab-7630-21c76aa3973d");
createProcessorAndUpdateParamJoin.setParentProcessGroupId("76e23100-ad84-1aab-4447-b9ee936ee7d5");
String processorAndUpdateParam = iNifiAppOperation.createProcessorAndUpdateParam(createProcessorAndUpdateParamJoin);
System.out.println("新处理器id" + processorAndUpdateParam);
} catch (Exception e) {
e.printStackTrace();
}
}
@Test
public void testgGetFindStateClearMarkProcessor() throws Exception {
try {
iNifiBaseOperation.getFindStateClearMarkProcessor("41437b87-0196-1000-6951-50e41e75c0da", "接口状态清理标记");
} catch (Exception e) {
e.printStackTrace();
}
}
@Test
public void testBatchEnabledControllerServices() throws Exception {
try {
iNifiBaseOperation.batchEnabledControllerServices("4143d803-0196-1000-968f-b06f55b43a3f", "xxxx");
} catch (Exception e) {
e.printStackTrace();
}
}
}

View File

@ -0,0 +1,817 @@
package com.hzya.frame;
import com.hzya.frame.nifiapi.model.joincreateconnections.Component18;
import com.hzya.frame.nifiapi.model.joincreateconnections.CreateConnections18;
import com.hzya.frame.nifiapi.model.joincreateconnections.Revision18;
import com.hzya.frame.nifiapi.model.joincreateconnections.SourceOrDestination18;
import com.hzya.frame.nifiapi.model.joincreateoracleapp.CreateAppInstanceJoin;
import com.hzya.frame.nifiapi.model.joincreateprocessconnection.CreateProcessorConnections;
import com.hzya.frame.nifiapi.model.joincreateprocessorandupdateparam.CreateProcessorAndUpdateParamJoin;
import com.hzya.frame.nifiapi.model.joincreparamcontext.CreateParamContextJoin;
import com.hzya.frame.nifiapi.model.joinfindneedmodifycontroller.FindNeedModifyController;
import com.hzya.frame.nifiapi.model.joingetcontroller.Component12;
import com.hzya.frame.nifiapi.model.joingetcontroller.ControllerService12;
import com.hzya.frame.nifiapi.model.joinparametercontexts.*;
import com.hzya.frame.nifiapi.model.joinprocessgroups.Component7;
import com.hzya.frame.nifiapi.model.joinprocessgroups.ProcessGroupsJoin;
import com.hzya.frame.nifiapi.model.joinprocessgroups.Revision5;
import com.hzya.frame.nifiapi.model.joinsnippetinstance.SnippetInstanceJoin;
import com.hzya.frame.nifiapi.model.joinsnippets.Snippet;
import com.hzya.frame.nifiapi.model.joinsnippets.SnippetsJoin;
import com.hzya.frame.nifiapi.model.joinstartorstopprocessgroup.Revision10;
import com.hzya.frame.nifiapi.model.joinstartorstopprocessgroup.StartOrStopProcessGroupsInfoJoin10;
import com.hzya.frame.nifiapi.model.resultNeedModifyController.PortFilterResult;
import com.hzya.frame.nifiapi.model.resultcreateoracleapp.CreateAppInstanceResult;
import com.hzya.frame.nifiapi.model.resultcreateprocessor.*;
import com.hzya.frame.nifiapi.model.resultcreateprocessors.CreateProcess16;
import com.hzya.frame.nifiapi.model.resultcreatesnippet.Flow15;
import com.hzya.frame.nifiapi.model.resultcreatesnippet.ProcessGroups15;
import com.hzya.frame.nifiapi.model.resultcreatesnippet.SnippetInstance15;
import com.hzya.frame.nifiapi.model.resultprocessgroups.ProcessgroupsResult;
import com.hzya.frame.nifiapi.model.resultprocessgroupsinfo.ProcessGroupsInfoResult9;
import com.hzya.frame.nifiapi.model.resultprocessgroupsinfo.Revision9;
import com.hzya.frame.nifiapi.model.resultsnippets.Snippet13;
import com.hzya.frame.nifiapi.model.resultsnippets.SnippetResult13;
import com.hzya.frame.nifiapi.operation.INifiAppOperation;
import com.hzya.frame.nifiapi.operation.INifiBaseOperation;
import com.hzya.frame.nifiapi.service.NifiApiService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
/**
* @Authorliuyang
* @Packagecom.hzya.frame
* @Projectfw-nifi
* @nameTestNifiDbSync
* @Date2025/5/20 17:49
* @FilenameTestNifiDbSync
*/
@RunWith(SpringRunner.class)
@SpringBootTest(classes = {WebappApplication.class})
public class TestNifiDbSync {
@Autowired
private NifiApiService nifiApiService;
@Autowired
private INifiAppOperation nifiOperation;
@Autowired
private INifiBaseOperation iNifiBaseOperation;
/**
* 测试nifi数据同步场景调用
*/
@Test
public void testDbSync2() throws Exception {
//创建业务数据流对应的流程组
String parentProcessGroupId = "76e23115-ad84-1aab-7630-21c76aa3973d";
String processGroupsName = "Oracle19c->Mysql跨数据源同步";
String newProcessGroupsId = testCreateProcessGroups(parentProcessGroupId, processGroupsName);
//新建GenerateFlowFile处理器(开始的处理器)
// String generateFlowFileId = testCreateProcessor(newProcessGroupsId);
CreateProcessorAndUpdateParamJoin createProcessorAndUpdateParamJoin = new CreateProcessorAndUpdateParamJoin();
createProcessorAndUpdateParamJoin.setTargetProcessorId("02d23f3c-7003-1a1b-1cdc-e9f37874bd78");
createProcessorAndUpdateParamJoin.setParentProcessGroupId("76e23100-ad84-1aab-4447-b9ee936ee7d5");
createProcessorAndUpdateParamJoin.setCopyTargetProcessGroupId(newProcessGroupsId);
String generateFlowFileId = nifiOperation.createProcessorAndUpdateParam(createProcessorAndUpdateParamJoin);
//创建Oracle应用
//初始化实例
CreateAppInstanceJoin createOracleApp = new CreateAppInstanceJoin();
createOracleApp.setAppProcessGroupId("41437b87-0196-1000-6951-50e41e75c0da");
createOracleApp.setParentProcessGroupId("76e23100-ad84-1aab-4447-b9ee936ee7d5");
createOracleApp.setCopyTargetProcessGroupId(newProcessGroupsId);
//上下文
CreateParamContextJoin createParamContextJoin = setOracleParamContextJoin();
createOracleApp.setCreateParamContextJoin(createParamContextJoin);
//控制器
// FindNeedModifyController findNeedModifyController = setOracleFindNeedModifyController(newProcessGroupsId);
// createOracleApp.setFindNeedModifyController(findNeedModifyController);
CreateAppInstanceResult oracleAppContext = nifiOperation.createAppContext(createOracleApp);
//创建Mysql应用
//初始化实例
CreateAppInstanceJoin createOracleApp2 = new CreateAppInstanceJoin();
createOracleApp2.setAppProcessGroupId("4143d803-0196-1000-968f-b06f55b43a3f");
createOracleApp2.setParentProcessGroupId("76e23100-ad84-1aab-4447-b9ee936ee7d5");
createOracleApp2.setCopyTargetProcessGroupId(newProcessGroupsId);
//上下文
CreateParamContextJoin createParamContextJoin2 = setMysqlParamContextJoin(newProcessGroupsId);
createOracleApp2.setCreateParamContextJoin(createParamContextJoin2);
//控制器
// FindNeedModifyController findNeedModifyController2 = setMysqlFindNeedModifyController(newProcessGroupsId);
// createOracleApp2.setFindNeedModifyController(findNeedModifyController2);
CreateAppInstanceResult mysqlAppContext = nifiOperation.createAppContext(createOracleApp2);
//新建LogAttribute处理器(结束处理器)
// String logAttributeId = testCreateProcessor2();
// String logAttributeId = null;
CreateProcessorAndUpdateParamJoin createProcessorAndUpdateParamJoin2 = new CreateProcessorAndUpdateParamJoin();
createProcessorAndUpdateParamJoin2.setTargetProcessorId("7f70897a-0196-1000-241a-3a7cdf5bf521");
createProcessorAndUpdateParamJoin2.setParentProcessGroupId("76e23100-ad84-1aab-4447-b9ee936ee7d5");
createProcessorAndUpdateParamJoin2.setCopyTargetProcessGroupId(newProcessGroupsId);
String logAttributeId = nifiOperation.createProcessorAndUpdateParam(createProcessorAndUpdateParamJoin2);
//查找对应应用的连接标记
//TYPE=INPUT_PORT
PortFilterResult oracleMarkInput = iNifiBaseOperation.getNeedModifyControllerRelationshipByProcessGroup(oracleAppContext.getNewProcessGroupId(), "f5228bc8-0360-41eb-a640-9f4df953937c");
PortFilterResult oracleMarkOutPut = iNifiBaseOperation.getNeedModifyControllerRelationshipByProcessGroup(oracleAppContext.getNewProcessGroupId(), "4929a9ac-291a-4ea2-a4b1-286ddf47164a");
//TYPE=OUTPUT_PORT
PortFilterResult mysqlMarkInput = iNifiBaseOperation.getNeedModifyControllerRelationshipByProcessGroup(mysqlAppContext.getNewProcessGroupId(), "be05a6ad-a440-43ed-b4c0-d1edcf03334f");
PortFilterResult mysqlMarkOutput = iNifiBaseOperation.getNeedModifyControllerRelationshipByProcessGroup(mysqlAppContext.getNewProcessGroupId(), "7ac85368-f2c9-48df-ab5b-ea610449083d");
//
// PortFilterResult automaticTableCreation = iNifiBaseOperation.getNeedModifyControllerRelationshipByProcessGroup(mysqlAppContext.getNewProcessGroupId(), "9480f217-9d94-4dcd-ba80-f718cc6e59db");
//批量创建连接关系
//连接关系一:开始处理器->Oracle应用
SourceOrDestination18 source = new SourceOrDestination18();
source.setId(generateFlowFileId);
source.setGroupId(newProcessGroupsId);
source.setType("PROCESSOR");
SourceOrDestination18 destination = new SourceOrDestination18();
destination.setId(oracleMarkInput.getInputPorts().get(0).getId());
destination.setGroupId(oracleAppContext.getNewProcessGroupId());
destination.setType("INPUT_PORT");
List<String> selectedRelationships = new ArrayList<>();
selectedRelationships.add("success");
Component18 component18 = new Component18();
component18.setSource(source);
component18.setDestination(destination);
component18.setSelectedRelationships(selectedRelationships);
Revision18 revision18 = new Revision18();
revision18.setVersion("0");//默认传递0
CreateConnections18 createConnections17 = new CreateConnections18();
createConnections17.setComponent(component18);
createConnections17.setRevision(revision18);
List<CreateConnections18> createConnections18List = new ArrayList<>();
createConnections18List.add(createConnections17);
//连接关系二Oracle应用->Mysql应用
SourceOrDestination18 source2 = new SourceOrDestination18();
source2.setId(oracleMarkOutPut.getOutputPorts().get(0).getId());
source2.setGroupId(oracleAppContext.getNewProcessGroupId());
source2.setType("OUTPUT_PORT");
SourceOrDestination18 destination2 = new SourceOrDestination18();
destination2.setId(mysqlMarkInput.getInputPorts().get(0).getId());
destination2.setGroupId(mysqlAppContext.getNewProcessGroupId());
destination2.setType("INPUT_PORT");
// List<String> selectedRelationships2 = new ArrayList<>();
// selectedRelationships2.add("success");
Component18 component182 = new Component18();
component182.setSource(source2);
component182.setDestination(destination2);
// component182.setSelectedRelationships(selectedRelationships2);
Revision18 revision182 = new Revision18();
revision182.setVersion("0");//默认传递0
CreateConnections18 createConnections172 = new CreateConnections18();
createConnections172.setComponent(component182);
createConnections172.setRevision(revision182);
createConnections18List.add(createConnections172);
//连接关系三Mysql应用->结束处理器
SourceOrDestination18 source3 = new SourceOrDestination18();
source3.setId(mysqlMarkOutput.getOutputPorts().get(0).getId());
source3.setGroupId(mysqlAppContext.getNewProcessGroupId());
source3.setType("OUTPUT_PORT");
SourceOrDestination18 destination3 = new SourceOrDestination18();
destination3.setId(logAttributeId);
destination3.setGroupId(newProcessGroupsId);
destination3.setType("PROCESSOR");
// List<String> selectedRelationships3 = new ArrayList<>();
// selectedRelationships3.add("success");
Component18 component183 = new Component18();
component183.setSource(source3);
component183.setDestination(destination3);
// component183.setSelectedRelationships(selectedRelationships3);
Revision18 revision183 = new Revision18();
revision183.setVersion("0");//默认传递0
CreateConnections18 createConnections173 = new CreateConnections18();
createConnections173.setComponent(component183);
createConnections173.setRevision(revision183);
createConnections18List.add(createConnections173);
//连接关系四如果存在自动建表则需要从开始节点-连接到Mysql应用的"自动建表"的输入端口
List<String> selectedRelationships2 = new ArrayList<>();
selectedRelationships2.add("success");
SourceOrDestination18 source4 = new SourceOrDestination18();
source4.setId(generateFlowFileId);
source4.setGroupId(newProcessGroupsId);
source4.setType("PROCESSOR");
// SourceOrDestination18 destination4 = new SourceOrDestination18();
// destination4.setId(automaticTableCreation.getInputPorts().get(0).getId());
// destination4.setGroupId(mysqlAppContext.getNewProcessGroupId());
// destination4.setType("INPUT_PORT");
// Component18 component184 = new Component18();
// component184.setSource(source4);
// component184.setDestination(destination4);
// component184.setSelectedRelationships(selectedRelationships2);
// Revision18 revision184 = new Revision18();
// revision184.setVersion("0");//默认传递0
// CreateConnections18 createConnections174 = new CreateConnections18();
// createConnections174.setComponent(component184);
// createConnections174.setRevision(revision184);
// createConnections18List.add(createConnections174);
CreateProcessorConnections createProcessorConnections = new CreateProcessorConnections();
createProcessorConnections.setProcessGroupsId(newProcessGroupsId);
createProcessorConnections.setCreateConnections18(createConnections18List);
iNifiBaseOperation.batchCreateProcessorConnections(createProcessorConnections);
//去掉流程组内对应的处理器旧状态
// List<String> stringList = new ArrayList<>();
// stringList.add(oracleAppContext.getNewProcessGroupId());
// stringList.add(mysqlAppContext.getNewProcessGroupId());
// iNifiBaseOperation.clearProcessGroupState(stringList);
//启动业务处理器
ProcessGroupsInfoResult9 processGroups = nifiApiService.getProcessGroups(newProcessGroupsId);
Revision9 revision = processGroups.getRevision();
Revision10 revision10 = new Revision10();
revision10.setVersion(revision.getVersion());
StartOrStopProcessGroupsInfoJoin10 startOrStopProcessGroupsInfoJoin10 = new StartOrStopProcessGroupsInfoJoin10();
startOrStopProcessGroupsInfoJoin10.setId(processGroups.getId());
startOrStopProcessGroupsInfoJoin10.setState("RUNNING");
startOrStopProcessGroupsInfoJoin10.setRevision(revision10);
ProcessGroupsInfoResult9 processGroupsInfoResult9 = nifiApiService.startOrStopProcessGroups(startOrStopProcessGroupsInfoJoin10);
System.out.println("流程组id" + processGroupsInfoResult9.getId());
}
public CreateParamContextJoin setOracleParamContextJoin() throws Exception {
Revision revision = new Revision();
revision.setVersion(0);
Parameter2 parameter = new Parameter2();
parameter.setSensitive(false);
parameter.setName("additionalWhereClause");
parameter.setValue("1=1");
parameter.setDescription("where条件");
Parameter2 parameter2 = new Parameter2();
parameter2.setSensitive(false);
parameter2.setName("columnsToReturn");
parameter2.setValue("csaleid,vreceiptcode,ts");
parameter2.setDescription("需要查询的表字段");
/**
* 参数描述
* 注意如果传递了排序参数不能仅按ts时间排序需要加上主键ts时间存在重复排序时存在随机性会导致数据重复
*
* 下面两个sql经过验证会导致部分数据重复
* sql1SELECT PK_SYSINIT, TS FROM U8C241231.PUB_SYSINIT WHERE ( 1 = 1 ) AND ts <= '2025-05-16 15:56:25' ORDER BY ts FETCH NEXT 10000 ROWS ONLY
* sql2SELECT PK_SYSINIT, TS FROM U8C241231.PUB_SYSINIT WHERE ( 1 = 1 ) AND ts <= '2025-05-16 15:56:25' ORDER BY ts OFFSET 10000 ROWS FETCH NEXT 10000 ROWS ONLY
*
* ORDER BY ts 仅按 ts 排序 ts 有重复值如多行 ts = '2024-08-12 11:52:23'数据库无法确定这些行的相对顺序可能在不同子查询中产生不同排列导致 0001A110... 被重复选中OFFSET FETCH 依赖排序如果排序不稳定分页范围可能错误地包含同一行
*
* 解决办法是ts+主键排序这样比较稳定
*/
Parameter2 parameter3 = new Parameter2();
parameter3.setSensitive(false);
parameter3.setName("customOrderByColumn");
parameter3.setValue("ts,csaleid asc");
parameter3.setDescription("排序规则,如果有增量同步需求,一定要通过时间+主键");
Parameter2 parameter4 = new Parameter2();
parameter4.setSensitive(false);
parameter4.setName("maximumValueColumns");
parameter4.setValue("ts");
parameter4.setDescription("分片字段");
Parameter2 parameter5 = new Parameter2();
parameter5.setSensitive(false);
parameter5.setName("sourceTbName");
parameter5.setValue("U8C241231.SO_SALE");
parameter5.setDescription("查询表名称");
Parameters2 parameters = new Parameters2();
parameters.setParameter(parameter);
Parameters2 parameters2 = new Parameters2();
parameters2.setParameter(parameter2);
Parameters2 parameters3 = new Parameters2();
parameters3.setParameter(parameter3);
Parameters2 parameters4 = new Parameters2();
parameters4.setParameter(parameter4);
Parameters2 parameters5 = new Parameters2();
parameters5.setParameter(parameter5);
List<Parameters2> parametersList = new ArrayList<>();
parametersList.add(parameters);
parametersList.add(parameters2);
parametersList.add(parameters3);
parametersList.add(parameters4);
parametersList.add(parameters5);
Component3 component = new Component3();
component.setName("oracle参数环境" + createParamTime());
component.setParameters(parametersList);
ParameterContextsJoin parameterContextsJoin = new ParameterContextsJoin();
parameterContextsJoin.setComponent(component);
parameterContextsJoin.setRevision(revision);
CreateParamContextJoin createParamContextJoin = new CreateParamContextJoin();
createParamContextJoin.setParameterContextsJoin(parameterContextsJoin);
// createParamContextJoin.setProcessGroupsId(processGroupsId);
return createParamContextJoin;
}
public static String createParamTime() {
LocalDateTime now = LocalDateTime.now();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyMMddHHmm");
String formattedTime = now.format(formatter);
return formattedTime;
}
public CreateParamContextJoin setMysqlParamContextJoin(String processGroupsId) throws Exception {
Revision revision = new Revision();
revision.setVersion(0);
// Parameter2 parameter = new Parameter2();
// parameter.setSensitive(false);
// parameter.setName("Release Signal Identifier");
// parameter.setValue("table_creation");
// parameter.setDescription("参数描述");
// Parameter2 parameter2 = new Parameter2();
// parameter2.setSensitive(false);
// parameter2.setName("autoTableCreation");
// parameter2.setValue("Y");
// parameter2.setDescription("是否自动建表");
// Parameter2 parameter3 = new Parameter2();
// parameter3.setSensitive(false);
// parameter3.setName("mappingRelationship");
// parameter3.setValue("[\n" + " {\n" + " \"targetTbName\": \"iep_so_sale\",\n" + " \"targetDBType\": \"mysql8.0.44\",\n" + " \"writeType\": \"1\",\n" + " \"fieldRelationship\": [\n" + " {\n" + " \"sourceFieldName\": \"csaleid\",\n" + " \"sourceFieldType\": \"varchar2(30)\",\n" + " \"targetFieldName\": \"csaleid\",\n" + " \"targetFieldType\": \"varchar(100)\",\n" + " \"targetFieldNameNotes\": \"主键\",\n" + " \"primaryKey\": \"Y\"\n" + " },\n" + " {\n" + " \"sourceFieldName\": \"vreceiptcode\",\n" + " \"sourceFieldType\": \"varchar2(30)\",\n" + " \"targetFieldName\": \"vreceiptcode\",\n" + " \"targetFieldType\": \"varchar(100)\",\n" + " \"targetFieldNameNotes\": \"编码\"\n" + " },\n" + " {\n" + " \"sourceFieldName\": \"ts\",\n" + " \"sourceFieldType\": \"varchar2(30)\",\n" + " \"targetFieldName\": \"ts\",\n" + " \"targetFieldType\": \"varchar(100)\",\n" + " \"targetFieldNameNotes\": \"更新时间\"\n" + " }\n" + " ]\n" + " }\n" + "]");
// parameter3.setDescription("字段映射关系");
Parameter2 parameter3 = new Parameter2();
parameter3.setSensitive(false);
parameter3.setName("autoTableCreation");
parameter3.setValue("Y");
parameter3.setDescription("");
Parameter2 parameter4 = new Parameter2();
parameter4.setSensitive(false);
parameter4.setName("joltSpec");
parameter4.setValue("[\n" +
" {\n" +
" \"operation\": \"shift\",\n" +
" \"spec\": {\n" +
" \"A\": \"B\",\n" +
" \"*\": \"&\"\n" +
" }\n" +
" }\n" +
"]");
parameter4.setDescription("");
Parameter2 parameter5 = new Parameter2();
parameter5.setSensitive(false);
parameter5.setName("jsonPrimaryKeyTag");
parameter5.setValue("[\"details_id\",\"header_id\",\"CSALEID\"]");
parameter5.setDescription("");
Parameter2 parameter6 = new Parameter2();
parameter6.setSensitive(false);
parameter6.setName("targetInsertTableName");
parameter6.setValue("iep_so_sale");
parameter6.setDescription("");
// Parameter2 parameter4 = new Parameter2();
// parameter4.setSensitive(false);
// parameter4.setName("releaseSignalIdentifier");
// parameter4.setValue(UUID.randomUUID().toString());
// parameter4.setDescription("建表信号,传随机值!");
// Parameter2 parameter4 = new Parameter2();
// parameter4.setSensitive(false);
// parameter4.setName("maximumValueColumns");
// parameter4.setValue("ts");
// parameter4.setDescription("参数描述");
// Parameter2 parameter5 = new Parameter2();
// parameter5.setSensitive(false);
// parameter5.setName("sourceTbName");
// parameter5.setValue("U8C241231.SO_SALE");
// parameter5.setDescription("参数描述");
// Parameters2 parameters = new Parameters2();
// parameters.setParameter(parameter4);
// Parameters2 parameters2 = new Parameters2();
// parameters2.setParameter(parameter2);
Parameters2 parameters3 = new Parameters2();
parameters3.setParameter(parameter3);
Parameters2 parameters4 = new Parameters2();
parameters4.setParameter(parameter4);
Parameters2 parameters5 = new Parameters2();
parameters5.setParameter(parameter5);
Parameters2 parameters6 = new Parameters2();
parameters6.setParameter(parameter6);
// Parameters2 parameters4 = new Parameters2();
// parameters4.setParameter(parameter4);
// Parameters2 parameters5 = new Parameters2();
// parameters5.setParameter(parameter5);
List<Parameters2> parametersList = new ArrayList<>();
// parametersList.add(parameters);
// parametersList.add(parameters2);
parametersList.add(parameters3);
parametersList.add(parameters4);
parametersList.add(parameters5);
parametersList.add(parameters6);
// parametersList.add(parameters4);
// parametersList.add(parameters5);
Component3 component = new Component3();
component.setName("mysql参数环境" + createParamTime());
component.setParameters(parametersList);
ParameterContextsJoin parameterContextsJoin = new ParameterContextsJoin();
parameterContextsJoin.setComponent(component);
parameterContextsJoin.setRevision(revision);
CreateParamContextJoin createParamContextJoin = new CreateParamContextJoin();
createParamContextJoin.setParameterContextsJoin(parameterContextsJoin);
createParamContextJoin.setProcessGroupsId(processGroupsId);
return createParamContextJoin;
}
/**
* 控制器参数-oracle
*/
private FindNeedModifyController setOracleFindNeedModifyController(String processGroupId) {
//创建Mysql数据源
Map<String, String> properties = new HashMap<>();
properties.put("Database Connection URL", "jdbc:oracle:thin:@39.170.109.90:1521:orcl");
properties.put("Database Driver Class Name", "oracle.jdbc.OracleDriver");
properties.put("database-driver-locations", "/data/nifi-1.28.1/lib/ojdbc8.jar");
properties.put("Database User", "U8C241231");
properties.put("Password", "U8C241231");
properties.put("Max Wait Time", "600001 millis");
properties.put("Max Total Connections", "20");
properties.put("Validation-query", "select 1 from dual");
properties.put("dbcp-min-idle-conns", "5");
properties.put("dbcp-max-idle-conns", "10");
properties.put("dbcp-max-conn-lifetime", "-1");
properties.put("dbcp-time-between-eviction-runs", "-1");
properties.put("dbcp-min-evictable-idle-time", "30 mins");
properties.put("dbcp-soft-min-evictable-idle-time", "-1");
Component12 component12 = new Component12();
component12.setName("Oracle数据源");
component12.setType("org.apache.nifi.dbcp.DBCPConnectionPool");
//传这个值并没有用
// component12.setState("ENABLED");
component12.setProperties(properties);
component12.setComments("Oracle数据源备注");
component12.setBulletinLevel("DEBUG");
// component12.setId();//需要修改的控制器id
ControllerService12 controllerService11 = new ControllerService12();
controllerService11.setComponent(component12);
controllerService11.setModifyMarkId("vuBXdbEu7v");
// controllerService11.setId();//需要修改的控制器id
List<ControllerService12> controllerService12List = new ArrayList<>();
controllerService12List.add(controllerService11);
FindNeedModifyController findNeedModifyController = new FindNeedModifyController();
findNeedModifyController.setNeedModifyController(controllerService12List);
findNeedModifyController.setProcessGroupId(processGroupId);
return findNeedModifyController;
}
/**
* 控制器参数-oracle
*/
private FindNeedModifyController setMysqlFindNeedModifyController(String processGroupId) {
//创建Mysql数据源
Map<String, String> properties = new HashMap<>();
properties.put("Database Connection URL", "jdbc:mysql://ufidahz.com.cn:9015/apache_nifi_sync?useSSL=false&serverTimezone=Asia/Shanghai&characterEncoding=utf8&useLegacyDatetimeCode=false");
properties.put("Database Driver Class Name", "com.mysql.cj.jdbc.Driver");
properties.put("database-driver-locations", "/data/nifi-1.28.1/lib/mysql-connector-java-8.0.30.jar");
properties.put("Database User", "root");
properties.put("Password", "hzya1314");
properties.put("Max Wait Time", "600001 millis");
properties.put("Max Total Connections", "15");
properties.put("Validation-query", "select 1");
properties.put("dbcp-min-idle-conns", "5");
properties.put("dbcp-max-idle-conns", "10");
properties.put("dbcp-max-conn-lifetime", "-1");
properties.put("dbcp-time-between-eviction-runs", "-1");
properties.put("dbcp-min-evictable-idle-time", "30 mins");
properties.put("dbcp-soft-min-evictable-idle-time", "-1");
Component12 component12 = new Component12();
component12.setName("Mysql数据源");
component12.setType("org.apache.nifi.dbcp.DBCPConnectionPool");
//传这个值并没有用
// component12.setState("ENABLED");
component12.setProperties(properties);
component12.setComments("Mysql数据源备注");
component12.setBulletinLevel("DEBUG");
// component12.setId();//需要修改的控制器id
ControllerService12 controllerService11 = new ControllerService12();
controllerService11.setComponent(component12);
controllerService11.setModifyMarkId("CZFJwnb9sb");
// controllerService11.setId();//需要修改的控制器id
List<ControllerService12> controllerService12List = new ArrayList<>();
controllerService12List.add(controllerService11);
FindNeedModifyController findNeedModifyController = new FindNeedModifyController();
findNeedModifyController.setNeedModifyController(controllerService12List);
findNeedModifyController.setProcessGroupId(processGroupId);
return findNeedModifyController;
}
/**
* 测试nifi数据同步场景调用
*/
@Test
public void testDbSync() throws Exception {
//新建开始处理器
String parentProcessGroupId = "76e23115-ad84-1aab-7630-21c76aa3973d";
String processGroupsName = "跨数据源同步";
String processGroupsId = testCreateProcessGroups(parentProcessGroupId, processGroupsName);
//新建GenerateFlowFile处理器(最开始的处理器)
String generateFlowFileId = testCreateProcessor(processGroupsId);
//拷贝Oracle应用,并实例化到新建的流程组
// String processGroupId = "41437b87-0196-1000-6951-50e41e75c0da";
// String parentProcessGroupId = "76e23100-ad84-1aab-4447-b9ee936ee7d5";
String oracleSnippetId = testCreateSnippets("41437b87-0196-1000-6951-50e41e75c0da", "76e23100-ad84-1aab-4447-b9ee936ee7d5");
String oracleProcessGroupId = testCreateSnippetInstance(processGroupsId, parentProcessGroupId, oracleSnippetId);
//拷贝Mysql应用并实例化到新建的流程组
// String processGroupId2 = "4143d803-0196-1000-968f-b06f55b43a3f";
// String parentProcessGroupId2 = "76e23100-ad84-1aab-4447-b9ee936ee7d5";
String mysqlSnippetId = testCreateSnippets("4143d803-0196-1000-968f-b06f55b43a3f", "76e23100-ad84-1aab-4447-b9ee936ee7d5");
String mysqlProcessGroupId = testCreateSnippetInstance(processGroupsId, parentProcessGroupId, mysqlSnippetId);
//新建LogAttribute处理器(结束处理器)
// String logAttributeId = testCreateProcessor2();
String logAttributeId = null;
//修改Oracle应用数据源
//修改Oracle应用上下文环境
//修改mysql应用数据源
//修改mysql应用上下文环境
//启动Mysql应用对应的控制器服务
//启动Oracle应用对应的控制器服务
//创建连接关系
//启动处理器
}
/**
* 创建空的流程组
*
* @param parentProcessGroupId 需要新建的目标流程组的父流程组id
* @param name 目标流程组名称
*/
public String testCreateProcessGroups(String parentProcessGroupId, String name) throws Exception {
String processGroupsId = "";
try {
Revision5 revision5 = new Revision5();
revision5.setVersion(0);
Component7 component7 = new Component7();
component7.setName(name);
ProcessGroupsJoin processGroupsJoin = new ProcessGroupsJoin();
processGroupsJoin.setRevision(revision5);
processGroupsJoin.setComponent(component7);
//父处理器组
// String parentGroupId = "76e23115-ad84-1aab-7630-21c76aa3973d";
ProcessgroupsResult processGroups = nifiApiService.createProcessGroups(parentProcessGroupId, processGroupsJoin);
processGroupsId = processGroups.getId();
} catch (Exception e) {
e.printStackTrace();
}
return processGroupsId;
}
/**
* 创建GenerateFlowFile处理器
*/
public String testCreateProcessor(String groupId) {
String processId = null;
try {
Revision15 revision15 = new Revision15();
revision15.setVersion("0");
Component15 component15 = new Component15();
component15.setType("org.apache.nifi.processors.standard.GenerateFlowFile");
component15.setName("定时调度");
// Position15 position15 = new Position15();
// position15.setX("0");
// position15.setY("0");
Config15 config15 = new Config15();
config15.setSchedulingPeriod("1 min");
Properties15 properties15 = new Properties15();
properties15.setFileSize("1KB");
config15.setProperties(properties15);
component15.setConfig(config15);
CreateProcessorJoin15 createProcessorJoin15 = new CreateProcessorJoin15();
createProcessorJoin15.setComponent(component15);
createProcessorJoin15.setRevision(revision15);
// String groupId = "019610d1-f933-1f70-16ea-3cf005012c4b";
CreateProcess16 processor = nifiApiService.createProcessor(groupId, createProcessorJoin15);
processId = processor.getId();
} catch (Exception e) {
e.printStackTrace();
}
return processId;
}
/**
* 为指定流程组创建片段
*
* @param targetCopyProcessGroupId 需要复制的目标流程组id
* @param parentProcessGroupId 目标流程组的父流程组id
*/
public String testCreateSnippets(String targetCopyProcessGroupId, String parentProcessGroupId) {
String snippetId = null;
try {
//查询目标流程组版本
ProcessGroupsInfoResult9 processGroups = nifiApiService.getProcessGroups(targetCopyProcessGroupId);
Revision9 revision = processGroups.getRevision();
Map<String, String> processGroupsMap2 = new HashMap<>();
processGroupsMap2.put("version", revision.getVersion());//目标流程组版本号
Map<String, Map<String, String>> processGroupsMap = new HashMap<>();
processGroupsMap.put(targetCopyProcessGroupId, processGroupsMap2);//目标流程组id
Snippet snippet = new Snippet();
snippet.setParentGroupId(parentProcessGroupId);//目标流程组id的父流程组id
snippet.setProcessGroups(processGroupsMap);
SnippetsJoin snippetsJoin = new SnippetsJoin();
snippetsJoin.setSnippet(snippet);
SnippetResult13 snippets = nifiApiService.createSnippets(snippetsJoin);
Snippet13 snippet1 = snippets.getSnippet();
snippetId = snippet1.getId();
} catch (Exception e) {
e.printStackTrace();
}
return snippetId;
}
/**
* 创建LogAttribute处理器
*/
@Test
public void testCreateProcessor2() throws Exception {
// String processorId = null;
try {
Revision15 revision15 = new Revision15();
revision15.setVersion("0");
Component15 component15 = new Component15();
component15.setType("org.apache.nifi.processors.standard.LogAttribute");
component15.setName("结束节点");
// Position15 position15 = new Position15();
// position15.setX("0");
// position15.setY("0");
Properties15 properties15 = new Properties15();
properties15.setLogLevel("info");
properties15.setLogPayload("false");
properties15.setAttributesToLogRegex(".*");
properties15.setLogFlowFileProperties("true");
properties15.setOutputFormat("Line per Attribute");
properties15.setCharacterSet("UTF-8");
Config15 config15 = new Config15();
config15.setProperties(properties15);
config15.setBulletinLevel("DEBUG");
component15.setConfig(config15);
// component15.setPosition(position15);
//定义连接关系
Relationships15 relationships15 = new Relationships15();
relationships15.setName("success");
relationships15.setAutoTerminate(true);
// relationships15.setRetry(true);
// relationships15.setDescription("123");
List<Relationships15> relationships15List = new ArrayList<>();
relationships15List.add(relationships15);
component15.setRelationships(relationships15List);
CreateProcessorJoin15 createProcessorJoin15 = new CreateProcessorJoin15();
createProcessorJoin15.setComponent(component15);
createProcessorJoin15.setRevision(revision15);
String groupId = "76e23115-ad84-1aab-7630-21c76aa3973d";
CreateProcess16 processor = nifiApiService.createProcessor(groupId, createProcessorJoin15);
// System.out.println("处理器id" + processor.getId());
// processorId = processor.getId();
} catch (Exception e) {
e.printStackTrace();
}
// return processorId;
}
/**
* 将片段实例到指定位置
*
* @param groupId 目标流程组id需要拷贝到哪个流程组
* @param parentGroupId 目标流程组的父流程组id
* @param snippetId 片段id
*/
public String testCreateSnippetInstance(String groupId, String parentGroupId, String snippetId) throws Exception {
String processGroupId = null;
try {
//先请求得到代码片段id
ProcessGroupsInfoResult9 processGroups = nifiApiService.getProcessGroups(groupId);
Revision9 revision = processGroups.getRevision();
Map<String, String> processGroupsMap2 = new HashMap<>();
processGroupsMap2.put("version", revision.getVersion());//目标流程组版本号
Map<String, Map<String, String>> processGroupsMap = new HashMap<>();
processGroupsMap.put(groupId, processGroupsMap2);//目标流程组id
// Snippet snippet = new Snippet();
// snippet.setParentGroupId(parentGroupId);//目标流程组id的父流程组id
// snippet.setProcessGroups(processGroupsMap);
// SnippetsJoin snippetsJoin = new SnippetsJoin();
// snippetsJoin.setSnippet(snippet);
// SnippetResult13 snippets = nifiApiService.createSnippets(snippetsJoin);
// Snippet13 snippet1 = snippets.getSnippet();
// System.out.println(snippet1.getId());
//将片段实例化到指定位置
// String groupId = "019610d1-f933-1f70-16ea-3cf005012c4b";//流程组id
SnippetInstanceJoin snippetInstanceJoin = new SnippetInstanceJoin();
snippetInstanceJoin.setSnippetId(snippetId);
// snippetInstanceJoin.setOriginY("0");
// snippetInstanceJoin.setOriginX("0");
SnippetInstance15 snippetInstance = nifiApiService.createSnippetInstance(groupId, snippetInstanceJoin);
Flow15 flow = snippetInstance.getFlow();
ProcessGroups15 processGroups15 = flow.getProcessGroups().get(0);
// System.out.println(processGroups15.getId());
processGroupId = processGroups15.getId();
} catch (Exception e) {
e.printStackTrace();
}
return processGroupId;
}
}

View File

@ -0,0 +1,58 @@
package com.hzya.frame;
import com.github.pagehelper.PageInfo;
import com.hzya.frame.nifilog.dao.ILoggingEvent20250430Dao;
import com.hzya.frame.nifilog.entity.LoggingEvent20250430Entity;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import java.util.ArrayList;
import java.util.List;
/**
* @Authorliuyang
* @Packagecom.hzya.frame
* @Projectfw-nifi
* @nameTestNifiLog
* @Date2025/5/20 11:53
* @FilenameTestNifiLog
*/
@RunWith(SpringRunner.class)
@SpringBootTest(classes = {WebappApplication.class})
public class TestNifiLog {
@Autowired
private ILoggingEvent20250430Dao iLoggingEvent20250430Dao;
/**
* 获取nifi token
*/
@Test
public void getAccessToken() {
try {
// PageAttribute<LoggingEvent20250430Entity> loggingEvent20250430EntityPageAttribute = iLoggingEvent20250430Dao.queryPaged();
List<String> arg0List = new ArrayList<>();
arg0List.add("UpdateAttribute[id=ad841aed-30f7-16e2-4fa0-595ab0ab9fdc]");
List<String> logDateList = new ArrayList<>();
logDateList.add("20250519");
logDateList.add("20250520");
LoggingEvent20250430Entity loggingEvent20250430Entity = new LoggingEvent20250430Entity();
loggingEvent20250430Entity.setArg0List(arg0List);
loggingEvent20250430Entity.setLogDateList(logDateList);
loggingEvent20250430Entity.setPageNum(1);
loggingEvent20250430Entity.setPageSize(100);
PageInfo<LoggingEvent20250430Entity> loggingEvent20250430EntityPageInfo = iLoggingEvent20250430Dao.queryLoggingEventByProcessorId(loggingEvent20250430Entity);
List<LoggingEvent20250430Entity> list = loggingEvent20250430EntityPageInfo.getList();
System.out.println(list.size());
} catch (Exception e) {
e.printStackTrace();
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,26 @@
package com.hzya.frame;
import com.ql.util.express.ExpressRunner;
import org.junit.Assert;
import org.junit.Test;
/**
* @Authorliuyang
* @Packagecom.hzya.frame
* @Projectfw-nifi
* @nameTestQl
* @Date2025/7/18 15:44
* @FilenameTestQl
*/
public class TestQl {
@Test
public void test1() throws Exception {
String exp = "import com.hzya.frame.vo.UserVo;" +
"UserVo cust = new UserVo();" +
"cust.setName(\"小强\");" +
"return cust.getName();";
ExpressRunner runner = new ExpressRunner();
String r = (String) runner.execute(exp, null, null, false, false);
Assert.assertEquals("操作符执行错误", "小强", r);
}
}

View File

@ -0,0 +1,63 @@
package com.hzya.frame.jolt;
import com.bazaarvoice.jolt.Chainr;
import com.bazaarvoice.jolt.JsonUtils;
import org.junit.Test;
/**
* "cardinality"
*
* @Authorliuyang
* @Packagecom.hzya.frame
* @Projectfw-nifi
* @nameTestJolt
* @Date2025/6/18 11:19
* @FilenameTestJolt
*/
public class TestJoltCardinality {
private final String jsonFileRootRoute = "/Users/liuyang/workspaces/hzya/fw-nifi/jolt-demo";
/**
* ONE:如果输入值是一个列表则获取该列表中的第一个元素并将其设置为该元素的数据,不支持其他类型
*/
@Test
public void testDemo() {
//输入json
Object input = JsonUtils.filepathToObject(jsonFileRootRoute + "/cardinality/input.json");
//spec
Object spec = JsonUtils.filepathToObject(jsonFileRootRoute + "/cardinality/spec.json");
Chainr chainr = Chainr.fromSpec(spec);
Object transform = chainr.transform(input);
System.out.println(JsonUtils.toJsonString(transform));
}
/**
* 'MANY':如果输入不是列表则创建一个列表并将第一个元素设置为输入值
* 如果输入是"null"使它成为一个空列表如果输入是一个列表不支持
*/
@Test
public void testDemo2() {
//输入json
Object input = JsonUtils.filepathToObject(jsonFileRootRoute + "/cardinality/input2.json");
//spec
Object spec = JsonUtils.filepathToObject(jsonFileRootRoute + "/cardinality/spec2.json");
Chainr chainr = Chainr.fromSpec(spec);
Object transform = chainr.transform(input);
System.out.println(JsonUtils.toJsonString(transform));
}
@Test
public void testDemo3() {
//输入json
Object input = JsonUtils.filepathToObject(jsonFileRootRoute + "/cardinality/input3.json");
//spec
Object spec = JsonUtils.filepathToObject(jsonFileRootRoute + "/cardinality/spec3.json");
Chainr chainr = Chainr.fromSpec(spec);
Object transform = chainr.transform(input);
System.out.println(JsonUtils.toJsonString(transform));
}
}

View File

@ -0,0 +1,58 @@
package com.hzya.frame.jolt;
//import org.flywaydb.core.internal.util.JsonUtils;
//import org.flywaydb.core.internal.util.JsonUtils;
//import org.flywaydb.core.internal.util.JsonUtils;
import com.bazaarvoice.jolt.Chainr;
import com.bazaarvoice.jolt.JsonUtils;
import org.junit.Test;
//import java.util.List;
/**
* jolt框架的default部分测试,
* default是一种为json对象设置默认值的核心操作当目标json中某个字段不存在或字段值为null时
* 用你指定的默认值填充该字段,如果字段已存在且值非 null则不会覆盖原有值
*
* @Authorliuyang
* @Packagecom.hzya.frame
* @Projectfw-nifi
* @nameTestJolt
* @Date2025/6/18 11:19
* @FilenameTestJolt
*/
public class TestJoltDefault {
private final String jsonFileRootRoute = "/Users/liuyang/workspaces/hzya/fw-nifi/jolt-demo";
/**
* 增加一些指定属性
*/
@Test
public void testDemo() {
//输入json
Object input = JsonUtils.filepathToObject(jsonFileRootRoute + "/default/input.json");
//spec
Object spec = JsonUtils.filepathToObject(jsonFileRootRoute + "/default/spec.json");
Chainr chainr = Chainr.fromSpec(spec);
Object transform = chainr.transform(input);
System.out.println(JsonUtils.toJsonString(transform));
}
/**
* 增加一些指定属性
*/
@Test
public void testDemo2() {
//输入json
Object input = JsonUtils.filepathToObject(jsonFileRootRoute + "/default/input3.json");
//spec
Object spec = JsonUtils.filepathToObject(jsonFileRootRoute + "/default/spec3.json");
Chainr chainr = Chainr.fromSpec(spec);
Object transform = chainr.transform(input);
System.out.println(JsonUtils.toJsonString(transform));
}
}

View File

@ -0,0 +1,32 @@
package com.hzya.frame.jolt;
import com.bazaarvoice.jolt.Chainr;
import com.bazaarvoice.jolt.JsonUtils;
import org.junit.Test;
/**
* jolt框架的modify部分测试
*
* @Authorliuyang
* @Packagecom.hzya.frame
* @Projectfw-nifi
* @nameTestJolt
* @Date2025/6/18 11:19
* @FilenameTestJolt
*/
public class TestJoltModify {
private final String jsonFileRootRoute = "/Users/liuyang/workspaces/hzya/fw-nifi/jolt-demo";
@Test
public void testDemo() {
//输入json
Object input = JsonUtils.filepathToObject(jsonFileRootRoute + "/modify/input.json");
//spec
Object spec = JsonUtils.filepathToObject(jsonFileRootRoute + "/modify/spec.json");
Chainr chainr = Chainr.fromSpec(spec);
Object transform = chainr.transform(input);
System.out.println(JsonUtils.toJsonString(transform));
}
}

View File

@ -0,0 +1,44 @@
package com.hzya.frame.jolt;
import com.bazaarvoice.jolt.Chainr;
import com.bazaarvoice.jolt.JsonUtils;
import org.junit.Test;
/**
* "remove" 是一种用于从输入 JSON 中删除指定字段或元素的核心转换操作
*
* @Authorliuyang
* @Packagecom.hzya.frame
* @Projectfw-nifi
* @nameTestJolt
* @Date2025/6/18 11:19
* @FilenameTestJolt
*/
public class TestJoltRemove {
private final String jsonFileRootRoute = "/Users/liuyang/workspaces/hzya/fw-nifi/jolt-demo";
@Test
public void testDemo() {
//输入json
Object input = JsonUtils.filepathToObject(jsonFileRootRoute + "/remove/input.json");
//spec
Object spec = JsonUtils.filepathToObject(jsonFileRootRoute + "/remove/spec.json");
Chainr chainr = Chainr.fromSpec(spec);
Object transform = chainr.transform(input);
System.out.println(JsonUtils.toJsonString(transform));
}
@Test
public void testDemo2() {
//输入json
Object input = JsonUtils.filepathToObject(jsonFileRootRoute + "/remove/input3.json");
//spec
Object spec = JsonUtils.filepathToObject(jsonFileRootRoute + "/remove/spec3.json");
Chainr chainr = Chainr.fromSpec(spec);
Object transform = chainr.transform(input);
System.out.println(JsonUtils.toJsonString(transform));
}
}

View File

@ -0,0 +1,231 @@
package com.hzya.frame.jolt;
//import org.flywaydb.core.internal.util.JsonUtils;
//import org.flywaydb.core.internal.util.JsonUtils;
//import org.flywaydb.core.internal.util.JsonUtils;
import com.bazaarvoice.jolt.Chainr;
import com.bazaarvoice.jolt.JsonUtils;
//import org.flywaydb.core.internal.util.JsonUtils;
import org.junit.Test;
//import java.util.List;
/**
* jolt框架的shift部分测试,Shiftr的基本操作是复制输入JSON的value
*
* @Authorliuyang
* @Packagecom.hzya.frame
* @Projectfw-nifi
* @nameTestJolt
* @Date2025/6/18 11:19
* @FilenameTestJolt
*/
public class TestJoltShift {
private final String jsonFileRootRoute = "/Users/liuyang/workspaces/hzya/fw-nifi/jolt-demo";
@Test
public void testDemo() {
//输入json
Object input = JsonUtils.filepathToObject(jsonFileRootRoute + "/shift/input.json");
//spec
Object spec = JsonUtils.filepathToObject(jsonFileRootRoute + "/shift/spec.json");
Chainr chainr = Chainr.fromSpec(spec);
Object transform = chainr.transform(input);
System.out.println(JsonUtils.toJsonString(transform));
}
/**
* 字段映射符
*/
@Test
public void testDemo2() {
Object input = JsonUtils.filepathToObject(jsonFileRootRoute + "/shift/input2.json");
Object spec = JsonUtils.filepathToObject(jsonFileRootRoute + "/shift/spec2.json");
Chainr chainr = Chainr.fromSpec(spec);
Object transform = chainr.transform(input);
System.out.println(JsonUtils.toJsonString(transform));
}
/**
* *通配符
*/
@Test
public void testDemo3() {
Object input = JsonUtils.filepathToObject(jsonFileRootRoute + "/shift/input3.json");
Object spec = JsonUtils.filepathToObject(jsonFileRootRoute + "/shift/spec3.json");
Chainr chainr = Chainr.fromSpec(spec);
Object transform = chainr.transform(input);
System.out.println(JsonUtils.toJsonString(transform));
}
@Test
public void testDemo4() {
Object input = JsonUtils.filepathToObject(jsonFileRootRoute + "/shift/input4.json");
Object spec = JsonUtils.filepathToObject(jsonFileRootRoute + "/shift/spec4.json");
Chainr chainr = Chainr.fromSpec(spec);
Object transform = chainr.transform(input);
System.out.println(JsonUtils.toJsonString(transform));
}
/**
* &通配符
*/
@Test
public void testDemo5() {
Object input = JsonUtils.filepathToObject(jsonFileRootRoute + "/shift/input5.json");
Object spec = JsonUtils.filepathToObject(jsonFileRootRoute + "/shift/spec5.json");
Chainr chainr = Chainr.fromSpec(spec);
Object transform = chainr.transform(input);
System.out.println(JsonUtils.toJsonString(transform));
}
/**
* $通配符
*/
@Test
public void testDemo6() {
Object input = JsonUtils.filepathToObject(jsonFileRootRoute + "/shift/input6.json");
Object spec = JsonUtils.filepathToObject(jsonFileRootRoute + "/shift/spec6.json");
Chainr chainr = Chainr.fromSpec(spec);
Object transform = chainr.transform(input);
System.out.println(JsonUtils.toJsonString(transform));
}
/**
* #通配符在右边
*/
@Test
public void testDemo7() {
Object input = JsonUtils.filepathToObject(jsonFileRootRoute + "/shift/input7.json");
Object spec = JsonUtils.filepathToObject(jsonFileRootRoute + "/shift/spec7.json");
Chainr chainr = Chainr.fromSpec(spec);
Object transform = chainr.transform(input);
System.out.println(JsonUtils.toJsonString(transform));
}
/**
* #通配符在左边
*/
@Test
public void testDemo8() {
Object input = JsonUtils.filepathToObject(jsonFileRootRoute + "/shift/input8.json");
Object spec = JsonUtils.filepathToObject(jsonFileRootRoute + "/shift/spec8.json");
Chainr chainr = Chainr.fromSpec(spec);
Object transform = chainr.transform(input);
System.out.println(JsonUtils.toJsonString(transform));
}
/**
* | 通配符在左边
*/
@Test
public void testDemo9() {
Object input = JsonUtils.filepathToObject(jsonFileRootRoute + "/shift/input9.json");
Object spec = JsonUtils.filepathToObject(jsonFileRootRoute + "/shift/spec9.json");
Chainr chainr = Chainr.fromSpec(spec);
Object transform = chainr.transform(input);
System.out.println(JsonUtils.toJsonString(transform));
}
/**
* @通配符在左边
*/
@Test
public void testDemo10() {
Object input = JsonUtils.filepathToObject(jsonFileRootRoute + "/shift/input10.json");
Object spec = JsonUtils.filepathToObject(jsonFileRootRoute + "/shift/spec10.json");
Chainr chainr = Chainr.fromSpec(spec);
Object transform = chainr.transform(input);
System.out.println(JsonUtils.toJsonString(transform));
}
/**
* @通配符在右边
*/
@Test
public void testDemo11() {
Object input = JsonUtils.filepathToObject(jsonFileRootRoute + "/shift/input11.json");
Object spec = JsonUtils.filepathToObject(jsonFileRootRoute + "/shift/spec11.json");
Chainr chainr = Chainr.fromSpec(spec);
Object transform = chainr.transform(input);
System.out.println(JsonUtils.toJsonString(transform));
}
/**
* 处理输入中的json数组
*/
@Test
public void testDemo12() {
Object input = JsonUtils.filepathToObject(jsonFileRootRoute + "/shift/input12.json");
Object spec = JsonUtils.filepathToObject(jsonFileRootRoute + "/shift/spec12.json");
Chainr chainr = Chainr.fromSpec(spec);
Object transform = chainr.transform(input);
System.out.println(JsonUtils.toJsonString(transform));
}
/**
* 处理输出的json数组
*/
@Test
public void testDemo13() {
Object input = JsonUtils.filepathToObject(jsonFileRootRoute + "/shift/input13.json");
Object spec = JsonUtils.filepathToObject(jsonFileRootRoute + "/shift/spec13.json");
Chainr chainr = Chainr.fromSpec(spec);
Object transform = chainr.transform(input);
System.out.println(JsonUtils.toJsonString(transform));
}
/**
* 同一个输入源可以输出到多个目标输出处
*/
@Test
public void testDemo14() {
Object input = JsonUtils.filepathToObject(jsonFileRootRoute + "/shift/input14.json");
Object spec = JsonUtils.filepathToObject(jsonFileRootRoute + "/shift/spec14.json");
Chainr chainr = Chainr.fromSpec(spec);
Object transform = chainr.transform(input);
System.out.println(JsonUtils.toJsonString(transform));
}
/**
* 隐式数组
*/
@Test
public void testDemo15() {
Object input = JsonUtils.filepathToObject(jsonFileRootRoute + "/shift/input15.json");
Object spec = JsonUtils.filepathToObject(jsonFileRootRoute + "/shift/spec15.json");
Chainr chainr = Chainr.fromSpec(spec);
Object transform = chainr.transform(input);
System.out.println(JsonUtils.toJsonString(transform));
}
/**
* 字段名替换
*/
@Test
public void testDemo16() {
Object input = JsonUtils.filepathToObject(jsonFileRootRoute + "/shift/input16.json");
Object spec = JsonUtils.filepathToObject(jsonFileRootRoute + "/shift/spec16.json");
Chainr chainr = Chainr.fromSpec(spec);
Object transform = chainr.transform(input);
System.out.println(JsonUtils.toJsonString(transform));
}
}

View File

@ -0,0 +1,35 @@
package com.hzya.frame.jolt;
import com.bazaarvoice.jolt.Chainr;
import com.bazaarvoice.jolt.JsonUtils;
import org.junit.Test;
/**
* "Sort"排序场景
*
* @Authorliuyang
* @Packagecom.hzya.frame
* @Projectfw-nifi
* @nameTestJolt
* @Date2025/6/18 11:19
* @FilenameTestJolt
*/
public class TestJoltSort {
private final String jsonFileRootRoute = "/Users/liuyang/workspaces/hzya/fw-nifi/jolt-demo";
/**
* 默认按字母升序排列A Z排序后键顺序为a b d r
*/
@Test
public void testDemo() {
//输入json
Object input = JsonUtils.filepathToObject(jsonFileRootRoute + "/sort/input.json");
//spec
Object spec = JsonUtils.filepathToObject(jsonFileRootRoute + "/sort/spec.json");
Chainr chainr = Chainr.fromSpec(spec);
Object transform = chainr.transform(input);
System.out.println(JsonUtils.toJsonString(transform));
}
}

View File

@ -0,0 +1,16 @@
package com.hzya.frame.vo;
import lombok.Data;
/**
* @Authorliuyang
* @Packagecom.hzya.frame.vo
* @Projectfw-nifi
* @nameUser
* @Date2025/7/18 15:46
* @FilenameUser
*/
@Data
public class UserVo {
private String name;
}

View File

@ -5,8 +5,6 @@ import cn.hutool.crypto.SecureUtil;
import cn.hutool.crypto.symmetric.SymmetricAlgorithm;
import cn.hutool.crypto.symmetric.SymmetricCrypto;
import static cn.hutool.crypto.CipherMode.encrypt;
/**
* @Description AES加密解密
* @Author xiang2lin
@ -79,9 +77,4 @@ public class AESUtil {
return null;
}
public static void main(String[] args) {
String data = "U8C241231";
String encrypt1 = encrypt(data);
System.out.println(encrypt1);
}
}

View File

@ -7,6 +7,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.context.support.ApplicationObjectSupport;
/**
* @author 郭军辉
* <p>
@ -25,7 +26,7 @@ public class DefaultController extends ApplicationObjectSupport {
* @return
*/
public JsonResultEntity getFailureMessageEntity(String message) {
return new JsonResultEntity(message, false, "500");
return new JsonResultEntity(message, false);
}
/**
@ -35,7 +36,7 @@ public class DefaultController extends ApplicationObjectSupport {
* @return
*/
public JsonResultEntity getFailureMessageEntity(String message, Object mo) {
return new JsonResultEntity(message, false, "500", mo);
return new JsonResultEntity(message, false, mo);
}
/**
@ -46,7 +47,7 @@ public class DefaultController extends ApplicationObjectSupport {
* @return
*/
public JsonResultEntity getSuccessMessageEntity(String message, Object mo) {
return new JsonResultEntity(message, true, "200", mo);
return new JsonResultEntity(message, true, mo);
}
/**
@ -56,10 +57,17 @@ public class DefaultController extends ApplicationObjectSupport {
* @return
*/
public JsonResultEntity getSuccessMessageEntity(String message ) {
return new JsonResultEntity(message, true, "200");
return new JsonResultEntity(message, true);
}
/**
* //绑定org_id
*

View File

@ -1,48 +0,0 @@
package com.hzya.frame.mdm.mdmModule;
import com.alibaba.excel.EasyExcel;
import com.hzya.frame.mdm.mdmModule.service.IMdmModuleService;
import com.hzya.frame.mdm.mdmModule.vo.ExcelTemplateVO;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.List;
public class WriteTest {
@Autowired
private IMdmModuleService mdmModuleService;
@Test
public void testGenerateExcelTemplate() throws IOException {
// 文件夹路径
String folderPath = "D:/test/";
// 完整文件路径文件夹 + 文件名
String localFilePath = folderPath + "表字段定义模版.xlsx";
File dir = new File(folderPath);
if (!dir.exists()) {
dir.mkdirs(); // 创建文件夹如果不存在
}
// 准备模板的示例数据
List<ExcelTemplateVO> demoData = new ArrayList<>();
// 生成Excel并保存到本地文件
try (OutputStream outputStream = new FileOutputStream(localFilePath)) {
EasyExcel.write(outputStream, ExcelTemplateVO.class)
.sheet("表字段定义模版")
.doWrite(demoData);
}
System.out.println("Excel模板已成功生成保存路径" + localFilePath);
}
}

View File

@ -1,34 +0,0 @@
package com.hzya.frame.mdm.mdmModule.config;
import org.springframework.cache.annotation.CachingConfigurerSupport;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cache.concurrent.ConcurrentMapCacheManager;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.util.Arrays;
import java.util.List;
@Configuration
@EnableCaching
public class CacheConfig extends CachingConfigurerSupport {
@Override
@Bean
public ConcurrentMapCacheManager cacheManager() {
// 整合所有需要的缓存名称原有的mdm相关缓存 + 新的业务缓存
List<String> cacheNames = Arrays.asList(
// 原有缓存来自SimpleCacheManager的配置
"mdmModuleDb",
"mdmModuleDbFileds",
"mdmModule",
// 新添加的业务缓存来自之前的ConcurrentMapCacheManager配置
"sysApplicationPlugin",
"IntegrationTask",
"IntegrationTaskLiving"
);
ConcurrentMapCacheManager cacheManager = new ConcurrentMapCacheManager();
cacheManager.setCacheNames(cacheNames); // 注册所有缓存名称
return cacheManager;
}
}

View File

@ -1,48 +0,0 @@
package com.hzya.frame.mdm.mdmModule.controller;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.mdm.mdmModule.service.IMdmModuleService;
import com.hzya.frame.mdm.mdmModule.vo.ImportExcelVO;
import com.hzya.frame.mdm.mdmModuleDbFileds.entity.MdmModuleDbFiledsEntity;
import com.hzya.frame.web.entity.JsonResultEntity;
import jline.internal.Log;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping(value = "/excel")
public class ImportExcelController {
@Autowired
private IMdmModuleService iMdmModuleService;
/**
* 导入模版
*/
@RequestMapping(value = "/importTemplateFile" ,method = RequestMethod.POST)
public JsonResultEntity importTemplateFile(@RequestParam("file") MultipartFile file,
@ModelAttribute ImportExcelVO importExcelVO){
List<MdmModuleDbFiledsEntity> entities = iMdmModuleService.importTemplateFile(file,importExcelVO);
// 新增字段
for (MdmModuleDbFiledsEntity entity : entities) {
// JSONObject object = (JSONObject) JSONObject.toJSON(entity);
String str = JSONObject.toJSONString(entity);
Map<String,String> jsonStr=new HashMap<>();
jsonStr.put("jsonStr",str);
String jsonS = JSON.toJSONString(jsonStr);
JSONObject jsonObject = JSONObject.parseObject(jsonS);
iMdmModuleService.saveMdmDbField(jsonObject);
}
return new JsonResultEntity("导入模版成功",true,200);
}
}

View File

@ -26,45 +26,8 @@ public class MdmModuleEntity extends BaseEntity {
private String createUser;
//修改人
private String modifyUser;
/** 0预制 1手工 */
private String tag;
private String u8cDbPk;
private String nccDbPk;
private String ysDbPk;
public String getTag() {
return tag;
}
public void setTag(String tag) {
this.tag = tag;
}
public String getU8cDbPk() {
return u8cDbPk;
}
public void setU8cDbPk(String u8cDbPk) {
this.u8cDbPk = u8cDbPk;
}
public String getNccDbPk() {
return nccDbPk;
}
public void setNccDbPk(String nccDbPk) {
this.nccDbPk = nccDbPk;
}
public String getYsDbPk() {
return ysDbPk;
}
public void setYsDbPk(String ysDbPk) {
this.ysDbPk = ysDbPk;
}
public String getMdmName() {
return mdmName;
}

View File

@ -19,10 +19,6 @@
<result property="sts" column="sts" jdbcType="VARCHAR"/>
<result property="org_id" column="org_id" jdbcType="VARCHAR"/>
<result property="companyId" column="company_id" jdbcType="VARCHAR"/>
<result property="tag" column="tag" jdbcType="VARCHAR"/>
<result property="u8cDbPk" column="u8c_db_pk" jdbcType="VARCHAR"/>
<result property="nccDbPk" column="ncc_db_pk" jdbcType="VARCHAR"/>
<result property="ysDbPk" column="ys_db_pk" jdbcType="VARCHAR"/>
</resultMap>
@ -43,10 +39,6 @@
,sts
,org_id
,company_id
,tag
,u8c_db_pk
,ncc_db_pk
,ys_db_pk
</sql>
<!--通过ID获取数据 -->
<select id="entity_get" resultMap="get-MdmModuleEntity-result">
@ -75,10 +67,6 @@
<if test="sts != null and sts != ''">and sts = #{sts}</if>
<if test="org_id != null and org_id != ''">and org_id = #{org_id}</if>
<if test="companyId != null and companyId != ''">and company_id = #{companyId}</if>
<if test="tag != null and tag != ''">and tag = #{tag}</if>
<if test="u8cDbPk != null and u8cDbPk != ''">and u8c_db_pk = #{u8cDbPk}</if>
<if test="nccDbPk != null and nccDbPk != ''">and ncc_db_pk = #{nccDbPk}</if>
<if test="ysDbPk != null and ysDbPk != ''">and ys_db_pk = #{ysDbPk}</if>
and sts='Y'
</trim>
<if test=" sort == null or sort == ''.toString() ">order by sorts asc</if>
@ -103,10 +91,6 @@
<if test="sts != null and sts != ''">and sts = #{sts}</if>
<if test="org_id != null and org_id != ''">and org_id = #{org_id}</if>
<if test="companyId != null and companyId != ''">and company_id = #{companyId}</if>
<if test="tag != null and tag != ''">and tag = #{tag}</if>
<if test="u8cDbPk != null and u8cDbPk != ''">and u8c_db_pk = #{u8cDbPk}</if>
<if test="nccDbPk != null and nccDbPk != ''">and ncc_db_pk = #{nccDbPk}</if>
<if test="ysDbPk != null and ysDbPk != ''">and ys_db_pk = #{ysDbPk}</if>
and sts='Y'
</trim>
<if test=" sort == null or sort == ''.toString() ">order by sorts asc</if>
@ -138,7 +122,6 @@
<if test="sts != null and sts != ''">and sts like concat('%',#{sts},'%')</if>
<if test="org_id != null and org_id != ''">and org_id like concat('%',#{org_id},'%')</if>
<if test="companyId != null and companyId != ''">and company_id like concat('%',#{companyId},'%')</if>
<if test="tag != null and tag != ''">and tag like concat('%',#{tag},'%')</if>
and sts='Y'
</trim>
<if test=" sort == null or sort == ''.toString() ">order by sorts asc</if>
@ -166,7 +149,6 @@
<if test="sts != null and sts != ''">or sts = #{sts}</if>
<if test="org_id != null and org_id != ''">or org_id = #{org_id}</if>
<if test="companyId != null and companyId != ''">or company_id = #{companyId}</if>
<if test="tag != null and tag != ''">or tag = #{tag}</if>
and sts='Y'
</trim>
<if test=" sort == null or sort == ''.toString() ">order by sorts asc</if>
@ -193,10 +175,6 @@
<if test="org_id != null and org_id != ''">org_id ,</if>
<if test="companyId != null and companyId != ''">company_id ,</if>
<if test="sts == null ">sts,</if>
<if test="tag == null ">tag ,</if>
<if test="u8cDbPk != null and u8cDbPk != ''">u8c_db_pk,</if>
<if test="nccDbPk != null and nccDbPk != ''">ncc_db_pk,</if>
<if test="ysDbPk != null and ysDbPk != ''">ys_db_pk,</if>
</trim>
)values(
<trim suffix="" suffixOverrides=",">
@ -216,10 +194,6 @@
<if test="org_id != null and org_id != ''">#{org_id} ,</if>
<if test="companyId != null and companyId != ''">#{companyId} ,</if>
<if test="sts == null ">'Y',</if>
<if test="tag == null ">'1',</if>
<if test="u8cDbPk != null and u8cDbPk != ''">#{u8cDbPk},</if>
<if test="nccDbPk != null and nccDbPk != ''">#{nccDbPk},</if>
<if test="ysDbPk != null and ysDbPk != ''">#{ysDbPk},</if>
</trim>
)
</insert>
@ -307,9 +281,6 @@ where id = #{id}
<select id="queryMdm" resultMap="get-MdmModuleEntity-result"
parameterType="com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity">
select
a.u8c_db_pk as u8c_db_pk,
a.ncc_db_pk as ncc_db_pk,
a.ys_db_pk as ys_db_pk,
a.id as id,
a.mdm_name as mdm_name,
a.mdm_logo as mdm_logo,
@ -1003,10 +974,10 @@ where id = #{id}
&lt; #{item.filedVaule}
</when>
<when test="item.compareType == '5'.toString() ">
like concat('%',#{item.filedVaule},'%')
like #{item.filedVaule}
</when>
<when test="item.compareType == '6'.toString() ">
not like concat('%',#{item.filedVaule},'%')
not like #{item.filedVaule}
</when>
</choose>

View File

@ -3,14 +3,7 @@ package com.hzya.frame.mdm.mdmModule.service;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity;
import com.hzya.frame.basedao.service.IBaseService;
import com.hzya.frame.mdm.mdmModule.vo.ImportExcelVO;
import com.hzya.frame.mdm.mdmModuleDbFileds.entity.MdmModuleDbFiledsEntity;
import com.hzya.frame.web.entity.JsonResultEntity;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
/**
* 主数据模版(MdmModule)表服务接口
@ -404,16 +397,4 @@ public interface IMdmModuleService extends IBaseService<MdmModuleEntity, String>
* @return com.hzya.frame.web.entity.JsonResultEntity
**/
JsonResultEntity queryMdmDistributeByMdmCode(JSONObject jsonObject);
/**
* 下载导入模版
* @return
*/
void generateExcelTemplate(HttpServletResponse response) throws IOException;
/**
* 导入模版
* @param file
*/
List<MdmModuleDbFiledsEntity> importTemplateFile(MultipartFile file, ImportExcelVO importExcelVO);
}

View File

@ -1,17 +1,8 @@
package com.hzya.frame.mdm.mdmModule.service.impl;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.alibaba.excel.util.StringUtils;
import com.alibaba.excel.write.metadata.WriteSheet;
import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.annotation.TableField;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hzya.frame.beanutil.BeanUtil;
import com.hzya.frame.mdm.entity.MdmDbFiledVo;
import com.hzya.frame.mdm.entity.MdmDto;
import com.hzya.frame.mdm.entity.MdmModuleViewVo;
@ -19,8 +10,6 @@ import com.hzya.frame.mdm.entity.MdmQuery;
import com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity;
import com.hzya.frame.mdm.mdmModule.dao.IMdmModuleDao;
import com.hzya.frame.mdm.mdmModule.service.IMdmModuleService;
import com.hzya.frame.mdm.mdmModule.vo.ExcelTemplateVO;
import com.hzya.frame.mdm.mdmModule.vo.ImportExcelVO;
import com.hzya.frame.mdm.mdmModuleDb.dao.IMdmModuleDbDao;
import com.hzya.frame.mdm.mdmModuleDb.dao.impl.MdmModuleDbDaoImpl;
import com.hzya.frame.mdm.mdmModuleDb.entity.MdmModuleDbEntity;
@ -61,24 +50,17 @@ import com.hzya.frame.web.entity.BaseResult;
import com.hzya.frame.web.entity.JsonResultEntity;
import com.hzya.frame.web.exception.BaseSystemException;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import com.hzya.frame.basedao.service.impl.BaseService;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URLEncoder;
import java.util.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 主数据模版(MdmModule)表服务实现类
@ -461,22 +443,6 @@ public class MdmModuleServiceImpl extends BaseService<MdmModuleEntity, String> i
for (int i = 0; i < mdmModuleDbEntities.size(); i++) {
if ("1".equals(mdmModuleDbEntities.get(i).getDbType()) || "2".equals(mdmModuleDbEntities.get(i).getDbType())) {
dbEntities.add(mdmModuleDbEntities.get(i));
//查询合并规则add by zyd 20250707
List<String> filedNames=new ArrayList<>();
if (mdmModuleDbEntities.get(i).getMergeRules() != null && !"".equals(mdmModuleDbEntities.get(i).getMergeRules())) {
String mergeRulesIds = mdmModuleDbEntities.get(i).getMergeRules();
String[] split = mergeRulesIds.split(",");
for (String filedId : split) {
MdmModuleDbFiledsEntity mdmModuleDbFiledsEntity = new MdmModuleDbFiledsEntity();
mdmModuleDbFiledsEntity.setId(filedId);
List<MdmModuleDbFiledsEntity> fileds = mdmModuleDbFiledsDao.query(mdmModuleDbFiledsEntity);
if(fileds.size()!=0){
filedNames.add(fileds.get(0).getChName());
}
}
}
mdmModuleDbEntities.get(i).setMergeRulesStr(String.join(",",filedNames));
}
}
}
@ -1437,8 +1403,7 @@ public class MdmModuleServiceImpl extends BaseService<MdmModuleEntity, String> i
MdmModuleDbFiledsEntity mdmModuleDbFiledsEntity = new MdmModuleDbFiledsEntity();
mdmModuleDbFiledsEntity.setMdmId(entity.getMdmId());
mdmModuleDbFiledsEntity.setSts("Y");
// List<MdmModuleDbFiledsEntity> mdmModuleDbFiledsEntityList = mdmServiceCache.queryMdmModuleDbFileds(mdmModuleDbFiledsEntity);
List<MdmModuleDbFiledsEntity> mdmModuleDbFiledsEntityList = mdmModuleDbFiledsDao.query(mdmModuleDbFiledsEntity);
List<MdmModuleDbFiledsEntity> mdmModuleDbFiledsEntityList = mdmServiceCache.queryMdmModuleDbFileds(mdmModuleDbFiledsEntity);
if (mdmModuleDbFiledsEntityList != null && mdmModuleDbFiledsEntityList.size() > 0) {
for (int i = 0; i < mdmModuleDbFiledsEntityList.size(); i++) {
if (entity.getDbId().equals(mdmModuleDbFiledsEntityList.get(i).getDbId()) && entity.getEnName().equals(mdmModuleDbFiledsEntityList.get(i).getEnName())) {
@ -1446,42 +1411,6 @@ public class MdmModuleServiceImpl extends BaseService<MdmModuleEntity, String> i
}
}
}
//新增时查询sysPk,sysCode,sysName段是否存在 add by zyd 2025-06-09
boolean isSysPk = false;
boolean isSysCode = false;
boolean isSysName = false;
boolean isSysDate = false;
for (MdmModuleDbFiledsEntity dbFiledsEntity : mdmModuleDbFiledsEntityList) {
if (entity.getDbId().equals(dbFiledsEntity.getDbId())) {
if (entity.getDbId().equals(dbFiledsEntity.getDbId())) {
if ("Y".equals(dbFiledsEntity.getIsSysPk())) {
isSysPk = true;
}
if ("Y".equals(dbFiledsEntity.getIsSysCode())) {
isSysCode = true;
}
if ("Y".equals(dbFiledsEntity.getIsSysName())) {
isSysName = true;
}
if ("Y".equals(dbFiledsEntity.getIsSysDate())) {
isSysDate = true;
}
}
}
}
//判端该字段是不是sysPk,sysCode,sysName=true
if ("Y".equals(entity.getIsSysPk()) && isSysPk) {
return BaseResult.getFailureMessageEntity("系统主键字段已存在,请修改");
}
if ("Y".equals(entity.getIsSysCode()) && isSysCode) {
return BaseResult.getFailureMessageEntity("系统code字段已存在请修改");
}
if ("Y".equals(entity.getIsSysName()) && isSysName) {
return BaseResult.getFailureMessageEntity("系统name字段已存在请修改");
}
if ("Y".equals(entity.getIsSysDate()) && isSysDate) {
return BaseResult.getFailureMessageEntity("系统date字段已存在请修改");
}
entity.setCreate();
if ("1".equals(entity.getDbType())) {
entity.setAddType("1");
@ -1559,49 +1488,6 @@ public class MdmModuleServiceImpl extends BaseService<MdmModuleEntity, String> i
} catch (Exception e) {
throw new BaseSystemException("表字段类型,修改失败,请联系管理员");
}
//更新时查询sysPk,sysCode,sysName段是否存在 add by zyd 2025-06-09
MdmModuleDbFiledsEntity mdmModuleDbFiledsEntity = new MdmModuleDbFiledsEntity();
mdmModuleDbFiledsEntity.setDbId(entity.getDbId());
mdmModuleDbFiledsEntity.setMdmId(entity.getMdmId());
mdmModuleDbFiledsEntity.setSts("Y");
List<MdmModuleDbFiledsEntity> mdmModuleDbFiledsEntityList = mdmModuleDbFiledsDao.query(mdmModuleDbFiledsEntity);
boolean isSysPk = false;
boolean isSysCode = false;
boolean isSysName = false;
boolean isSysDate = false;
for (MdmModuleDbFiledsEntity dbFiledsEntity : mdmModuleDbFiledsEntityList) {
if (entity.getDbId().equals(dbFiledsEntity.getDbId())) {
if (entity.getDbId().equals(dbFiledsEntity.getDbId())) {
if ("Y".equals(dbFiledsEntity.getIsSysPk())) {
isSysPk = true;
}
if ("Y".equals(dbFiledsEntity.getIsSysCode())) {
isSysCode = true;
}
if ("Y".equals(dbFiledsEntity.getIsSysName())) {
isSysName = true;
}
if ("Y".equals(dbFiledsEntity.getIsSysDate())) {
isSysDate = true;
}
}
}
}
//判端该字段是不是sysPk,sysCode,sysName=true
if ("Y".equals(entity.getIsSysPk()) && isSysPk) {
return BaseResult.getFailureMessageEntity("系统主键字段已存在,请修改");
}
if ("Y".equals(entity.getIsSysCode()) && isSysCode) {
return BaseResult.getFailureMessageEntity("系统code字段已存在请修改");
}
if ("Y".equals(entity.getIsSysName()) && isSysName) {
return BaseResult.getFailureMessageEntity("系统name字段已存在请修改");
}
if ("Y".equals(entity.getIsSysDate()) && isSysDate) {
return BaseResult.getFailureMessageEntity("系统date字段已存在请修改");
}
List<MdmModuleDbFiledsEntity> mdmModuleDbFiledsEntities = new ArrayList<>();
mdmModuleDbFiledsEntities.add(entity);
mdmServiceCache.saveOrUpdateMdmModuleDbFileds(entity.getMdmId(), mdmModuleDbFiledsEntities);
@ -1665,7 +1551,6 @@ public class MdmModuleServiceImpl extends BaseService<MdmModuleEntity, String> i
return BaseResult.getFailureMessageEntity("系统错误");
}
MdmModuleDbFiledsRuleEntity queryCount = new MdmModuleDbFiledsRuleEntity();
queryCount.setMdmId(entity.getMdmId());
queryCount.setDbId(entity.getDbId());
queryCount.setRuleCode("label");
queryCount.setRuleValue(entity.getEnName());
@ -2979,290 +2864,4 @@ public class MdmModuleServiceImpl extends BaseService<MdmModuleEntity, String> i
List<MdmModuleDistributeEntity> list = mdmModuleDistributeDao.queryBase(entity);
return BaseResult.getSuccessMessageEntity("获取分发设置成功", list);
}
/**
* 生成导入模版
*/
@Override
public void generateExcelTemplate(HttpServletResponse response) throws IOException {
// 设置响应内容类型
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
response.setCharacterEncoding("utf-8");
// 设置文件名注意中文需要URLEncoder编码
String fileName = URLEncoder.encode("表字段定义模版", "UTF-8").replaceAll("\\+", "%20");
response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx");
// 准备模板的示例数据
List<ExcelTemplateVO> demoData = new ArrayList<>(); //createTemplateDemoData()
// 使用EasyExcel直接写入响应输出流
EasyExcel.write(response.getOutputStream(), ExcelTemplateVO.class)
.sheet("表字段定义模版")
.doWrite(demoData);
}
/*private List<ExcelTemplateVO> createTemplateDemoData() {
List<ExcelTemplateVO> demoData = new ArrayList<>();
ExcelTemplateVO demo = new ExcelTemplateVO();
demo.setChName("用户ID");
demo.setEnName("userId");
demo.setFiledType("1"); // 对应BIGINT类型
demo.setFiledLength("20");
demo.setIsSysPk("Y");
demo.setIsSysCode("Y");
demo.setIsSysName("N");
demo.setIsSysDate("N");
demo.setTitle("用户ID");
demo.setRow("6");
demo.setWidth("100");
demo.setType("input");
demo.setRequired("true");
demo.setDisabled("true");
demoData.add(demo);
return demoData;
}
*/
/**
* 导入模版
*/
@Transactional
@Override
public List<MdmModuleDbFiledsEntity> importTemplateFile(MultipartFile file , ImportExcelVO importExcelVO) {
// 校验文件合法性
if (file == null || file.isEmpty()) {
throw new IllegalArgumentException("导入文件不能为空");
}
// 校验文件格式
String fileName = file.getOriginalFilename();
if (fileName == null || (!fileName.endsWith(".xlsx") && !fileName.endsWith(".xls"))) {
throw new IllegalArgumentException("请上传Excel格式文件");
}
// 表头数据
List<List<String>> headerList = new ArrayList<>();
// 用于存储内容数据
List<ExcelTemplateVO> dataList = new ArrayList<>();
List<MdmModuleDbFiledsEntity> resultEntities = new ArrayList<>();
try (InputStream inputStream = file.getInputStream()) {
// 使用EasyExcel读取文件
EasyExcel.read(inputStream)
.head(ExcelTemplateVO.class) // 指定映射的实体类
.sheet(0) // 指定第一个sheet页
.headRowNumber(1) // 表头行数从1开始
.autoTrim(true)
.registerReadListener(new AnalysisEventListener<ExcelTemplateVO>() {
/**
* 获取表头行数据
*/
@Override
public void invokeHeadMap(Map<Integer, String> headMap, AnalysisContext context) {
// 1. 转换表头为有序列表
List<String> header = new ArrayList<>();
// 获取最大列索引确保顺序正确
int maxColIndex = headMap.keySet().stream().mapToInt(Integer::intValue).max().orElse(-1);
for (int i = 0; i <= maxColIndex; i++) {
header.add(headMap.getOrDefault(i, "")); // 无数据的列填空
}
headerList.add(header);
}
/**
* 每解析一行数据触发
*/
@Override
public void invoke(ExcelTemplateVO data, AnalysisContext context) {
// 空行直接跳过
if (isRowEmpty(data)) {
return;
}
// 数据校验
validateData(data, context.readRowHolder().getRowIndex() + 1);
dataList.add(data);
}
/**
* 所有数据解析完成后触发
*/
@Override
public void doAfterAllAnalysed(AnalysisContext context) {
// 解析完成后的数据处理
List<MdmModuleDbFiledsEntity> entities = processImportData(headerList, dataList, importExcelVO);
if (entities != null) {
resultEntities.addAll(entities);
}
}
})
.doRead(); // 执行读取操作
} catch (IOException e) {
throw new RuntimeException("文件读取失败:" + e.getMessage(), e);
}
return resultEntities;
}
private boolean isRowEmpty(ExcelTemplateVO data) {
if(data == null) {
return true;
}
return StringUtils.isEmpty(data.getChName() ) &&
StringUtils.isEmpty(data.getFiledType()) &&
StringUtils.isEmpty(data.getEnName()) ;
}
/**
* 导入数据新增字段
* @param headerList
* @param dataList
*/
private List<MdmModuleDbFiledsEntity> processImportData(List<List<String>> headerList, List<ExcelTemplateVO> dataList,ImportExcelVO importExcelVO) {
// 获取表头列名
List<String> headers = headerList.get(0);
// 数据库字段数据
List<MdmModuleDbFiledsEntity> entities = new ArrayList<>();
for (ExcelTemplateVO data : dataList) {
MdmModuleDbFiledsEntity entity = new MdmModuleDbFiledsEntity();
BeanUtils.copyProperties(data, entity);
// 字段规则数据集合
List<MdmModuleDbFiledsRuleEntity> rules = new ArrayList<>();
for (String header : headers) {
// 字段规则数据
MdmModuleDbFiledsRuleEntity rule = new MdmModuleDbFiledsRuleEntity();
rule.setRuleType("2");
rule.setFormName("optionRuleForm");
switch (header) {
case "显示名":
rule.setRuleName("显示名");
rule.setRuleCode("title");
rule.setRuleValue(data.getChName());
break;
case "宽度":
rule.setRuleName("宽度");
rule.setRuleCode("row");
rule.setRuleValue(data.getRow());
break;
case "单元格宽度":
rule.setRuleName("单元格宽度");
rule.setRuleCode("width");
rule.setRuleValue(data.getWidth());
break;
case "数据类型":
rule.setRuleName("数据类型");
rule.setRuleCode("type");
rule.setRuleValue(data.getType());
break;
case "必填":
rule.setRuleName("必填");
rule.setRuleCode("required");
rule.setRuleValue(data.getRequired() != null ? "true" : "false");
break;
case "禁止修改":
rule.setRuleName("禁止修改");
rule.setRuleCode("disabled");
rule.setRuleValue(data.getDisabled() != null ? "true" : "false");
break;
default:
continue;
}
rules.add(rule);
}
entity.setMdmModuleDbFiledsRules(rules);
entity.setDbName(importExcelVO.getDbName());
entity.setDbId(importExcelVO.getDbId());
entity.setDbType(importExcelVO.getDbType());
entity.setMdmId(importExcelVO.getMdmId());
entities.add(entity);
}
return entities;
}
/**
* 数据校验方法验证Excel导入的数据合法性
* @param data 导入的Excel数据对象
* @param rowNum 行号
*/
private void validateData(ExcelTemplateVO data, int rowNum) {
List<String> errors = new ArrayList<>();
// 1. 校验中文名称必填
if (StringUtils.isBlank(data.getChName())) {
errors.add("" + rowNum + "行:中文名称不能为空");
}
// 2. 校验字段类型合法性
if (StringUtils.isBlank(data.getFiledType())) {
errors.add("" + rowNum + "行:字段类型不能为空");
} else {
Set<String> validTypes = new HashSet<>(Arrays.asList("1", "2", "3", "4"));
if (!validTypes.contains(data.getFiledType())) {
errors.add("" + rowNum + "字段类型无效允许值为1(BIGINT)、2(DECIMAL)、3(VARCHAR)、4(DATETIME)");
}
}
// 3. 校验长度数字类型且当字段类型为123时必填
if (StringUtils.isNotBlank(data.getFiledType()) &&
(data.getFiledType().equals("1") || data.getFiledType().equals("2") || data.getFiledType().equals("3"))) {
if (StringUtils.isBlank(data.getFiledLength())) {
errors.add("" + rowNum + "行:字段长度不能为空");
} else if (!StringUtils.isNumeric(data.getFiledLength())) {
errors.add("" + rowNum + "行:字段长度必须为数字");
} else {
int length = Integer.parseInt(data.getFiledLength());
if (length <= 0) {
errors.add("" + rowNum + "字段长度必须大于0");
}
}
}
// 4. 校验系统主键标识合法性
if (StringUtils.isNotBlank(data.getIsSysPk()) &&
!"Y".equals(data.getIsSysPk()) && !"N".equals(data.getIsSysPk())) {
errors.add("" + rowNum + "是否系统主键只能为Y或N");
}
// 5. 校验系统数据编码标识合法性
if (StringUtils.isNotBlank(data.getIsSysCode()) &&
!"Y".equals(data.getIsSysCode()) && !"N".equals(data.getIsSysCode())) {
errors.add("" + rowNum + "是否系统数据编码只能为Y或N");
}
// 6. 校验系统数据名称标识合法性
if (StringUtils.isNotBlank(data.getIsSysName()) &&
!"Y".equals(data.getIsSysName()) && !"N".equals(data.getIsSysName())) {
errors.add("" + rowNum + "是否系统数据名称只能为Y或N");
}
// 7. 校验系统日期标识合法性
if (StringUtils.isNotBlank(data.getIsSysDate()) &&
!"Y".equals(data.getIsSysDate()) && !"N".equals(data.getIsSysDate())) {
errors.add("" + rowNum + "是否系统日期只能为Y或N");
}
// 8. 校验是否必填标识合法性
if (data.getRequired() != null && !data.getRequired().trim().isEmpty()) {
String required = data.getRequired().trim();
if (!"TRUE".equalsIgnoreCase(required) && !"FALSE".equalsIgnoreCase(required)) {
errors.add("" + rowNum + "是否必填只能为true或false");
}
}
// 9. 校验禁止修改标识合法性
if (data.getDisabled() != null && !data.getDisabled().trim().isEmpty()) {
String disabled = data.getDisabled().trim();
if (!"TRUE".equalsIgnoreCase(disabled) && !"FALSE".equalsIgnoreCase(disabled)) {
errors.add("" + rowNum + "禁止修改只能为true或false");
}
}
// 如果有错误抛出异常中断导入
if (!errors.isEmpty()) {
throw new ExcelDataValidateException(String.join("", errors));
}
}
// 自定义异常类
public class ExcelDataValidateException extends RuntimeException {
public ExcelDataValidateException(String message) {
super(message);
}
}
}

View File

@ -1,56 +0,0 @@
package com.hzya.frame.mdm.mdmModule.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ExcelTemplateVO {
@ExcelProperty(value = "中文名称", index = 0)
private String chName;
@ExcelProperty(value = "英文名称", index = 1)
private String enName;
/** 字段类型 1、BIGINT 2、DECIMAL 3、VARCHAR 4、DATETIME */
@ExcelProperty(value = "字段类型", index = 2)
private String filedType;
@ExcelProperty(value = "长度", index = 3)
private String filedLength;
@ExcelProperty(value = "是否系统主键", index = 4)
private String isSysPk;// Y N
@ExcelProperty(value = "系统数据编码", index = 5)
private String isSysCode;// Y N
@ExcelProperty(value = "系统数据名称", index = 6)
private String isSysName;// Y N
@ExcelProperty(value = "系统日期", index = 7)
private String isSysDate; // Y N
@ExcelProperty(value = "显示名", index = 8)
private String title;
@ExcelProperty(value = "宽度", index = 9)
private String row;
@ExcelProperty(value = "单元格宽度", index = 10)
private String width;
@ExcelProperty(value = "数据类型",index = 11)
private String type;
@ExcelProperty(value= "必填",index = 12)
private String required; // true false
@ExcelProperty(value= "禁止修改",index = 13)
private String disabled; // true false
}

View File

@ -1,23 +0,0 @@
package com.hzya.frame.mdm.mdmModule.vo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.checkerframework.checker.units.qual.A;
import org.springframework.web.multipart.MultipartFile;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ImportExcelVO {
/** 主数据模版ID */
private String dbName;
/** 主数据模版ID */
private String mdmId;
/** 模版数据库id */
private String dbId;
/** 类型 1、主表 2、明细 3、操作日志 4、下发日志 */
private String dbType;
// MultipartFile file;
}

View File

@ -27,25 +27,7 @@ public class MdmModuleDbEntity extends BaseEntity {
/** 数据类型 1、新增 2、修改 */
private String dataType;
private List<MdmModuleDbFiledsEntity> sublistMdmModuleDbFileds;
/** 合并规则字段id使用逗号隔开 */
private String mergeRules;
private String mergeRulesStr;
public String getMergeRules() {
return mergeRules;
}
public void setMergeRules(String mergeRules) {
this.mergeRules = mergeRules;
}
public String getMergeRulesStr() {
return mergeRulesStr;
}
public void setMergeRulesStr(String mergeRulesStr) {
this.mergeRulesStr = mergeRulesStr;
}
public String getMdmId() {
return mdmId;

View File

@ -16,7 +16,6 @@
<result property="sts" column="sts" jdbcType="VARCHAR"/>
<result property="org_id" column="org_id" jdbcType="VARCHAR"/>
<result property="companyId" column="company_id" jdbcType="VARCHAR"/>
<result property="mergeRules" column="merge_rules" jdbcType="VARCHAR"/>
</resultMap>
<!-- 查询的字段-->
<sql id="MdmModuleDbEntity_Base_Column_List">
@ -33,7 +32,6 @@
,sts
,org_id
,company_id
,merge_rules
</sql>
<!-- 查询 采用==查询 -->
<select id="entity_list_base" resultMap="get-MdmModuleDbEntity-result"
@ -55,7 +53,6 @@
<if test="sts != null and sts != ''">and sts = #{sts}</if>
<if test="org_id != null and org_id != ''">and org_id = #{org_id}</if>
<if test="companyId != null and companyId != ''">and company_id = #{companyId}</if>
<if test="mergeRules != null and mergeRules != ''">and merge_rules = #{mergeRules}</if>
and sts='Y'
</trim>
<if test=" sort == null or sort == ''.toString() ">order by sorts asc</if>
@ -80,7 +77,6 @@
<if test="sts != null and sts != ''">and sts = #{sts}</if>
<if test="org_id != null and org_id != ''">and org_id = #{org_id}</if>
<if test="companyId != null and companyId != ''">and company_id = #{companyId}</if>
<if test="mergeRules != null and mergeRules != ''">and merge_rules = #{mergeRules}</if>
and sts='Y'
</trim>
<if test=" sort == null or sort == ''.toString() ">order by sorts asc</if>
@ -111,7 +107,6 @@
<if test="sts != null and sts != ''">and sts like concat('%',#{sts},'%')</if>
<if test="org_id != null and org_id != ''">and org_id like concat('%',#{org_id},'%')</if>
<if test="companyId != null and companyId != ''">and company_id like concat('%',#{companyId},'%')</if>
<if test="mergeRules != null and mergeRules != ''">and merge_rules like concat('%',#{mergeRules},'%')</if>
and sts='Y'
</trim>
<if test=" sort == null or sort == ''.toString() ">order by sorts asc</if>
@ -138,7 +133,6 @@
<if test="sts != null and sts != ''">or sts = #{sts}</if>
<if test="org_id != null and org_id != ''">or org_id = #{org_id}</if>
<if test="companyId != null and companyId != ''">or company_id = #{companyId}</if>
<if test="mergeRules != null and mergeRules != ''">or merge_rules = #{mergeRules}</if>
and sts='Y'
</trim>
<if test=" sort == null or sort == ''.toString() ">order by sorts asc</if>
@ -162,7 +156,6 @@
<if test="sts != null and sts != ''">sts ,</if>
<if test="org_id != null and org_id != ''">org_id ,</if>
<if test="companyId != null and companyId != ''">company_id ,</if>
<if test="mergeRules != null and mergeRules != ''">merge_rules ,</if>
<if test="sts == null ">sts,</if>
</trim>
)values(
@ -180,7 +173,6 @@
<if test="sts != null and sts != ''">#{sts} ,</if>
<if test="org_id != null and org_id != ''">#{org_id} ,</if>
<if test="companyId != null and companyId != ''">#{companyId} ,</if>
<if test="mergeRules != null and mergeRules != ''">#{mergeRules} ,</if>
<if test="sts == null ">'Y',</if>
</trim>
)
@ -188,10 +180,10 @@
<!-- 批量新增 -->
<insert id="entityInsertBatch">
insert into mdm_module_db(mdm_id, db_name, db_type, remark, create_user_id, create_time, modify_user_id,
modify_time, sts, org_id, company_id, merge_rules, sts)
modify_time, sts, org_id, company_id, sts)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.mdmId},#{entity.dbName},#{entity.dbType},#{entity.remark},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId},#{entity.mergeRules},
(#{entity.mdmId},#{entity.dbName},#{entity.dbType},#{entity.remark},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId},
'Y')
</foreach>
</insert>
@ -231,7 +223,6 @@
<if test="sts != null and sts != ''">sts = #{sts},</if>
<if test="org_id != null and org_id != ''">org_id = #{org_id},</if>
<if test="companyId != null and companyId != ''">company_id = #{companyId},</if>
<if test="mergeRules != null and mergeRules != ''">merge_rules = #{mergeRules},</if>
</trim>
where id = #{id}
</update>
@ -253,7 +244,6 @@ where id = #{id}
<if test="sorts != null">and sorts = #{sorts}</if>
<if test="sts != null and sts != ''">and sts = #{sts}</if>
<if test="companyId != null and companyId != ''">and company_id = #{companyId}</if>
<if test="mergeRules != null and mergeRules != ''">and merge_rules = #{mergeRules}</if>
and sts='Y'
</trim>
</update>

View File

@ -1,10 +1,7 @@
package com.hzya.frame.mdm.mdmModuleDbFileds.entity;
import java.util.ArrayList;
import java.util.List;
import com.alibaba.excel.annotation.ExcelProperty;
import com.hzya.frame.mdm.mdmModuleDb.entity.MdmModuleDbEntity;
import com.hzya.frame.mdm.mdmModuleDbFiledsRule.entity.MdmModuleDbFiledsRuleEntity;
import com.hzya.frame.web.entity.BaseEntity;
@ -23,13 +20,10 @@ public class MdmModuleDbFiledsEntity extends BaseEntity {
/** 模版数据库id */
private String dbId;
/** 中文名 */
@ExcelProperty(value = "中文名称", index = 0)
private String chName;
/** 英文名 */
@ExcelProperty(value = "英文名称", index = 1)
private String enName;
/** 字段类型 1、BIGINT 2、DECIMAL 3、VARCHAR 4、DATETIME */
@ExcelProperty(value = "字段类型", index = 2)
private String filedType;
/** 显示类型:新增 */
private String addType;
@ -39,13 +33,11 @@ public class MdmModuleDbFiledsEntity extends BaseEntity {
private String showType;
/** 显示类型:查询 */
private String queryType;
/** 显示类型:列表 */
private String listType;
/** 显示类型:显示 */
private String viewType;
/** 长度 */
@ExcelProperty(value = "长度", index = 3)
private String filedLength;
/** 公司id */
private String companyId;
@ -65,26 +57,6 @@ public class MdmModuleDbFiledsEntity extends BaseEntity {
//1查询2列表3新增4修改 5查看
private String fieldType;
/**
* 是否sys主键 系统主键三方系统主键同步中台之后该字段作为主键Y/N
*/
@ExcelProperty(value = "是否系统主键", index = 4)
private String isSysPk;
/**
* 是否sys编码 系统code三方系统code同步中台之后该字段作为codeY/N
*/
@ExcelProperty(value = "是否系统数据编码", index = 5)
private String isSysCode;
/**
* 是否sys名称 系统name三方系统name同步中台之后该字段作为nameY/N
*/
@ExcelProperty(value = "是否系统数据名称", index = 6)
private String isSysName;
/**
* 是否sys日期 系统date三方系统name同步中台之后该字段作为nameY/N
*/
@ExcelProperty(value = "是否系统日期", index = 7)
private String isSysDate;
public String getMdmId() {
return mdmId;
}
@ -244,67 +216,5 @@ public class MdmModuleDbFiledsEntity extends BaseEntity {
public void setDbType(String dbType) {
this.dbType = dbType;
}
public String getIsSysPk() {
return isSysPk;
}
public void setIsSysPk(String isSysPk) {
this.isSysPk = isSysPk;
}
public String getIsSysCode() {
return isSysCode;
}
public void setIsSysCode(String isSysCode) {
this.isSysCode = isSysCode;
}
public String getIsSysName() {
return isSysName;
}
public void setIsSysName(String isSysName) {
this.isSysName = isSysName;
}
public String getIsSysDate() {
return isSysDate;
}
public void setIsSysDate(String isSysDate) {
this.isSysDate = isSysDate;
}
/**
* 关联的表
*/
private MdmModuleDbEntity mdmModuleDbEntity;
public MdmModuleDbEntity getMdmModuleDbEntity() {
return mdmModuleDbEntity;
}
public void setMdmModuleDbEntity(MdmModuleDbEntity mdmModuleDbEntity) {
this.mdmModuleDbEntity = mdmModuleDbEntity;
}
/**
* 关联字段
*/
private List<MdmModuleDbFiledsEntity> sublistMdmModuleDbFileds;
public List<MdmModuleDbFiledsEntity> getSublistMdmModuleDbFileds() {
return sublistMdmModuleDbFileds;
}
public void setSublistMdmModuleDbFileds(List<MdmModuleDbFiledsEntity> sublistMdmModuleDbFileds) {
this.sublistMdmModuleDbFileds = sublistMdmModuleDbFileds;
}
}

View File

@ -2,8 +2,7 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hzya.frame.mdm.mdmModuleDbFileds.dao.impl.MdmModuleDbFiledsDaoImpl">
<resultMap id="get-MdmModuleDbFiledsEntity-result"
type="com.hzya.frame.mdm.mdmModuleDbFileds.entity.MdmModuleDbFiledsEntity">
<resultMap id="get-MdmModuleDbFiledsEntity-result" type="com.hzya.frame.mdm.mdmModuleDbFileds.entity.MdmModuleDbFiledsEntity" >
<result property="id" column="id" jdbcType="VARCHAR"/>
<result property="mdmId" column="mdm_id" jdbcType="VARCHAR"/>
<result property="dbId" column="db_id" jdbcType="VARCHAR"/>
@ -25,10 +24,6 @@
<result property="sts" column="sts" jdbcType="VARCHAR"/>
<result property="org_id" column="org_id" jdbcType="VARCHAR"/>
<result property="companyId" column="company_id" jdbcType="VARCHAR"/>
<result property="isSysPk" column="sys_pk" jdbcType="VARCHAR"/>
<result property="isSysCode" column="sys_code" jdbcType="VARCHAR"/>
<result property="isSysName" column="sys_name" jdbcType="VARCHAR"/>
<result property="isSysDate" column="sys_date" jdbcType="VARCHAR"/>
</resultMap>
<!-- 查询的字段-->
<sql id = "MdmModuleDbFiledsEntity_Base_Column_List">
@ -53,14 +48,9 @@
,sts
,org_id
,company_id
,sys_pk
,sys_code
,sys_name
,sys_date
</sql>
<!-- 查询 采用==查询 -->
<select id="entity_list_base" resultMap="get-MdmModuleDbFiledsEntity-result"
parameterType="com.hzya.frame.mdm.mdmModuleDbFileds.entity.MdmModuleDbFiledsEntity">
<select id="entity_list_base" resultMap="get-MdmModuleDbFiledsEntity-result" parameterType = "com.hzya.frame.mdm.mdmModuleDbFileds.entity.MdmModuleDbFiledsEntity">
select
<include refid="MdmModuleDbFiledsEntity_Base_Column_List" />
from mdm_module_db_fileds
@ -86,10 +76,6 @@
<if test="sts != null and sts != ''"> and sts = #{sts} </if>
<if test="org_id != null and org_id != ''"> and org_id = #{org_id} </if>
<if test="companyId != null and companyId != ''"> and company_id = #{companyId} </if>
<if test="isSysPk != null and isSysPk != ''">and sys_pk = #{isSysPk}</if>
<if test="isSysCode != null and isSysCode != ''">and sys_code = #{isSysCode}</if>
<if test="isSysName != null and isSysName != ''">and sys_name = #{isSysName}</if>
<if test="isSysDate != null and isSysDate != ''">and sys_date = #{isSysDate}</if>
<if test="roletype != null and roletype != ''">
and id in (
select
@ -105,8 +91,7 @@
</select>
<!-- 查询符合条件的数量 -->
<select id="entity_count" resultType="Integer"
parameterType="com.hzya.frame.mdm.mdmModuleDbFileds.entity.MdmModuleDbFiledsEntity">
<select id="entity_count" resultType="Integer" parameterType = "com.hzya.frame.mdm.mdmModuleDbFileds.entity.MdmModuleDbFiledsEntity">
select count(1) from mdm_module_db_fileds
<trim prefix="where" prefixOverrides="and">
<if test="id != null and id != ''"> and id = #{id} </if>
@ -130,10 +115,6 @@
<if test="sts != null and sts != ''"> and sts = #{sts} </if>
<if test="org_id != null and org_id != ''"> and org_id = #{org_id} </if>
<if test="companyId != null and companyId != ''"> and company_id = #{companyId} </if>
<if test="isSysPk != null and isSysPk != ''">and sys_pk = #{isSysPk}</if>
<if test="isSysCode != null and isSysCode != ''">and sys_code = #{isSysCode}</if>
<if test="isSysName != null and isSysName != ''">and sys_name = #{isSysName}</if>
<if test="isSysDate != null and isSysDate != ''">and sys_date = #{isSysDate}</if>
and sts='Y'
</trim>
<if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
@ -141,8 +122,7 @@
</select>
<!-- 分页查询列表 采用like格式 -->
<select id="entity_list_like" resultMap="get-MdmModuleDbFiledsEntity-result"
parameterType="com.hzya.frame.mdm.mdmModuleDbFileds.entity.MdmModuleDbFiledsEntity">
<select id="entity_list_like" resultMap="get-MdmModuleDbFiledsEntity-result" parameterType = "com.hzya.frame.mdm.mdmModuleDbFileds.entity.MdmModuleDbFiledsEntity">
select
<include refid="MdmModuleDbFiledsEntity_Base_Column_List" />
from mdm_module_db_fileds
@ -159,25 +139,15 @@
<if test="queryType != null and queryType != ''"> and query_type like concat('%',#{queryType},'%') </if>
<if test="listType != null and listType != ''"> and list_type like concat('%',#{listType},'%') </if>
<if test="viewType != null and viewType != ''"> and view_type like concat('%',#{viewType},'%') </if>
<if test="filedLength != null and filedLength != ''">and filed_length like concat('%',#{filedLength},'%')
</if>
<if test="filedLength != null and filedLength != ''"> and filed_length like concat('%',#{filedLength},'%') </if>
<if test="sorts != null"> and sorts like concat('%',#{sorts},'%') </if>
<if test="create_user_id != null and create_user_id != ''">and create_user_id like
concat('%',#{create_user_id},'%')
</if>
<if test="create_user_id != null and create_user_id != ''"> and create_user_id like concat('%',#{create_user_id},'%') </if>
<if test="create_time != null"> and create_time like concat('%',#{create_time},'%') </if>
<if test="modify_user_id != null and modify_user_id != ''">and modify_user_id like
concat('%',#{modify_user_id},'%')
</if>
<if test="modify_user_id != null and modify_user_id != ''"> and modify_user_id like concat('%',#{modify_user_id},'%') </if>
<if test="modify_time != null"> and modify_time like concat('%',#{modify_time},'%') </if>
<if test="sts != null and sts != ''"> and sts like concat('%',#{sts},'%') </if>
<if test="org_id != null and org_id != ''"> and org_id like concat('%',#{org_id},'%') </if>
<if test="companyId != null and companyId != ''"> and company_id like concat('%',#{companyId},'%') </if>
<if test="isSysPk != null and isSysPk != ''">and sys_pk like concat('%',#{isSysPk},'%')</if>
<if test="isSysCode != null and isSysCode != ''">and sys_code like concat('%',#{isSysCode},'%')</if>
<if test="isSysName != null and isSysName != ''">and sys_name like concat('%',#{isSysName},'%')</if>
<if test="isSysDate != null and isSysDate != ''">and sys_date like concat('%',#{isSysDate},'%')</if>
and sts='Y'
</trim>
<if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
@ -185,8 +155,7 @@
</select>
<!-- 查询列表 字段采用or格式 -->
<select id="MdmModuleDbFiledsentity_list_or" resultMap="get-MdmModuleDbFiledsEntity-result"
parameterType="com.hzya.frame.mdm.mdmModuleDbFileds.entity.MdmModuleDbFiledsEntity">
<select id="MdmModuleDbFiledsentity_list_or" resultMap="get-MdmModuleDbFiledsEntity-result" parameterType = "com.hzya.frame.mdm.mdmModuleDbFileds.entity.MdmModuleDbFiledsEntity">
select
<include refid="MdmModuleDbFiledsEntity_Base_Column_List" />
from mdm_module_db_fileds
@ -212,12 +181,6 @@
<if test="sts != null and sts != ''"> or sts = #{sts} </if>
<if test="org_id != null and org_id != ''"> or org_id = #{org_id} </if>
<if test="companyId != null and companyId != ''"> or company_id = #{companyId} </if>
<if test="isSysPk != null and isSysPk != ''">or sys_pk = #{isSysPk}</if>
<if test="isSysCode != null and isSysCode != ''">or sys_code = #{isSysCode}</if>
<if test="isSysName != null and isSysName != ''">or sys_name = #{isSysName}</if>
<if test="isSysDate != null and isSysDate != ''">or sys_date = #{isSysDate}</if>
and sts='Y'
</trim>
<if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
@ -249,10 +212,6 @@
<if test="sts != null and sts != ''"> sts , </if>
<if test="org_id != null and org_id != ''"> org_id , </if>
<if test="companyId != null and companyId != ''"> company_id , </if>
<if test="isSysPk != null and isSysPk != ''">sys_pk ,</if>
<if test="isSysCode != null and isSysCode != ''">sys_code ,</if>
<if test="isSysName != null and isSysName != ''">sys_name ,</if>
<if test="isSysDate != null and isSysDate != ''">sys_date ,</if>
<if test="sts == null ">sts,</if>
</trim>
)values(
@ -278,30 +237,21 @@
<if test="sts != null and sts != ''"> #{sts} ,</if>
<if test="org_id != null and org_id != ''"> #{org_id} ,</if>
<if test="companyId != null and companyId != ''"> #{companyId} ,</if>
<if test="isSysPk != null and isSysPk != ''">#{isSysPk} ,</if>
<if test="isSysCode != null and isSysCode != ''">#{isSysCode} ,</if>
<if test="isSysName != null and isSysName != ''">#{isSysName} ,</if>
<if test="isSysDate != null and isSysDate != ''">#{isSysDate} ,</if>
<if test="sts == null ">'Y',</if>
</trim>
)
</insert>
<!-- 批量新增 -->
<insert id="entityInsertBatch" >
insert into mdm_module_db_fileds(mdm_id, db_id, ch_name, en_name, filed_type, add_type, update_type, show_type,
query_type, list_type, view_type, filed_length, create_user_id, create_time, modify_user_id, modify_time, sts,
org_id, company_id, sts)
insert into mdm_module_db_fileds(mdm_id, db_id, ch_name, en_name, filed_type, add_type, update_type, show_type, query_type, list_type, view_type, filed_length, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id, sts)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.mdmId},#{entity.dbId},#{entity.chName},#{entity.enName},#{entity.filedType},#{entity.addType},#{entity.updateType},#{entity.showType},#{entity.queryType},#{entity.listType},#{entity.viewType},#{entity.filedLength},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId},
'Y')
(#{entity.mdmId},#{entity.dbId},#{entity.chName},#{entity.enName},#{entity.filedType},#{entity.addType},#{entity.updateType},#{entity.showType},#{entity.queryType},#{entity.listType},#{entity.viewType},#{entity.filedLength},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId}, 'Y')
</foreach>
</insert>
<!-- 批量新增或者修改-->
<insert id="entityInsertOrUpdateBatch" >
insert into mdm_module_db_fileds(mdm_id, db_id, ch_name, en_name, filed_type, add_type, update_type, show_type,
query_type, list_type, view_type, filed_length, create_user_id, create_time, modify_user_id, modify_time, sts,
org_id, company_id)
insert into mdm_module_db_fileds(mdm_id, db_id, ch_name, en_name, filed_type, add_type, update_type, show_type, query_type, list_type, view_type, filed_length, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.mdmId},#{entity.dbId},#{entity.chName},#{entity.enName},#{entity.filedType},#{entity.addType},#{entity.updateType},#{entity.showType},#{entity.queryType},#{entity.listType},#{entity.viewType},#{entity.filedLength},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId})
@ -325,8 +275,7 @@
modify_time = values(modify_time),
sts = values(sts),
org_id = values(org_id),
company_id = values(company_id)
</insert>
company_id = values(company_id)</insert>
<!--通过主键修改方法-->
<update id="entity_update" parameterType = "com.hzya.frame.mdm.mdmModuleDbFileds.entity.MdmModuleDbFiledsEntity" >
update mdm_module_db_fileds set
@ -350,28 +299,16 @@
<if test="sts != null and sts != ''"> sts = #{sts},</if>
<if test="org_id != null and org_id != ''"> org_id = #{org_id},</if>
<if test="companyId != null and companyId != ''"> company_id = #{companyId},</if>
<if test="isSysPk != null and isSysPk != ''">sys_pk = #{isSysPk},</if>
<if test="isSysPk == null ">sys_pk = null,</if>
<if test="isSysCode != null and isSysCode != ''">sys_code = #{isSysCode},</if>
<if test="isSysCode == null ">sys_code = null,</if>
<if test="isSysName != null and isSysName != ''">sys_name = #{isSysName},</if>
<if test="isSysName == null ">sys_name = null,</if>
<if test="isSysDate != null and isSysDate != ''">sys_date = #{isSysDate},</if>
<if test="isSysDate == null ">sys_date = null,</if>
</trim>
where id = #{id}
</update>
<!-- 逻辑删除 -->
<update id="entity_logicDelete" parameterType = "com.hzya.frame.mdm.mdmModuleDbFileds.entity.MdmModuleDbFiledsEntity" >
update mdm_module_db_fileds
set sts= 'N',
modify_time = #{modify_time},
modify_user_id = #{modify_user_id}
update mdm_module_db_fileds set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id}
where id = #{id}
</update>
<!-- 多条件逻辑删除 -->
<update id="entity_logicDelete_Multi_Condition"
parameterType="com.hzya.frame.mdm.mdmModuleDbFileds.entity.MdmModuleDbFiledsEntity">
<update id="entity_logicDelete_Multi_Condition" parameterType = "com.hzya.frame.mdm.mdmModuleDbFileds.entity.MdmModuleDbFiledsEntity" >
update mdm_module_db_fileds set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id}
<trim prefix="where" prefixOverrides="and">
<if test="id != null and id != ''"> and id = #{id} </if>
@ -395,15 +332,11 @@
</update>
<!--通过主键删除-->
<delete id="entity_delete">
delete
from mdm_module_db_fileds
where id = #{id}
delete from mdm_module_db_fileds where id = #{id}
</delete>
<!--通过mdmCode删除-->
<delete id="deleteMdmModuleDbFileds" parameterType="com.hzya.frame.mdm.mdmModuleDb.entity.MdmModuleDbEntity">
delete
from mdm_module_db_fileds
where mdm_id = #{mdmId}
delete from mdm_module_db_fileds where mdm_id = #{mdmId}
</delete>
</mapper>

View File

@ -3,7 +3,6 @@ package com.hzya.frame.mdm.mdmModuleDbFileds.service.impl;
import com.hzya.frame.mdm.mdmModuleDbFileds.entity.MdmModuleDbFiledsEntity;
import com.hzya.frame.mdm.mdmModuleDbFileds.dao.IMdmModuleDbFiledsDao;
import com.hzya.frame.mdm.mdmModuleDbFileds.service.IMdmModuleDbFiledsService;
import com.hzya.frame.web.entity.JsonResultEntity;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import javax.annotation.Resource;

View File

@ -310,12 +310,7 @@
parameterType="com.hzya.frame.mdm.mdmModuleDbFiledsRule.entity.MdmModuleDbFiledsRuleEntity">
select count(1) from mdm_module_db_fileds_rule
<trim prefix="where" prefixOverrides="and">
<!-- <if test="mdmId != null and mdmId != ''">and mdm_id != #{mdmId}</if>-->
<!-- <if test="ruleCode != null and ruleCode != ''">and rule_code = #{ruleCode}</if>-->
<!-- <if test="ruleValue != null and ruleValue != ''">and rule_value = #{ruleValue}</if>-->
<if test="mdmId != null and mdmId != ''">and mdm_id = #{mdmId}</if>
<if test="dbId != null and dbId != ''">and db_id = #{dbId}</if>
<if test="mdmId != null and mdmId != ''">and mdm_id != #{mdmId}</if>
<if test="ruleCode != null and ruleCode != ''">and rule_code = #{ruleCode}</if>
<if test="ruleValue != null and ruleValue != ''">and rule_value = #{ruleValue}</if>
and sts='Y'

View File

@ -0,0 +1,11 @@
package com.hzya.frame.nifiapi;//package com.hzya.frame.nifi;
//
//import org.springframework.boot.SpringApplication;
//import org.springframework.boot.autoconfigure.SpringBootApplication;
//
//@SpringBootApplication(scanBasePackages = "com.hzya.frame.nifi")
//public class NifiApplication {
// public static void main(String[] args) {
// SpringApplication.run(NifiApplication.class, args);
// }
//}

View File

@ -0,0 +1,238 @@
package com.hzya.frame.nifiapi.client;
import cn.hutool.core.util.StrUtil;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.hzya.frame.nifiapi.config.NifiServiceConfig;
import okhttp3.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.util.Map;
import java.util.concurrent.atomic.AtomicReference;
/**
* nifi客户端请求处理
*
* @Authorliuyang
* @Packagecom.hzya.frame.nifi.client
* @Projectfw-nifi
* @nameNifiClient
* @Date2025/5/14 10:00
* @FilenameNifiClient
*/
@Component
public class NifiClient {
private final NifiServiceConfig config;
private final OkHttpClient httpClient;
private final ObjectMapper objectMapper;
private final AtomicReference<String> accessToken = new AtomicReference<>();
private volatile long tokenIssueTime; // Token 发行时间毫秒
private volatile long tokenExpiration; // Token 过期时间毫秒
Logger logger = LoggerFactory.getLogger(NifiClient.class);
@Autowired
public NifiClient(NifiServiceConfig config, OkHttpClient httpClient, ObjectMapper objectMapper) {
this.config = config;
this.httpClient = httpClient;
this.objectMapper = objectMapper;
initializeToken();
}
private void initializeToken() {
try {
accessToken.set(getAccessToken());
tokenIssueTime = System.currentTimeMillis();
tokenExpiration = tokenIssueTime + (12 * 60 * 60 * 1000); // 默认 12 小时
logger.info("令牌已初始化,过期时间:" + new java.util.Date(tokenExpiration));
} catch (Exception e) {
throw new RuntimeException("初始化NiFi访问令牌失败 " + e.getMessage());
}
}
public <T> T get(String path, Class<T> responseType) throws IOException {
return executeRequestWithRetry(() -> {
Request request = new Request.Builder().url(config.getApiUrl() + path).get().header("Authorization", "Bearer " + accessToken.get()).build();
return executeRequest(request, responseType);
});
}
/**
* 获取原始JSON响应字符串不进行反序列化
*/
public String getRaw(String path) throws IOException {
return executeRequestWithRetry(() -> {
Request request = new Request.Builder().url(config.getApiUrl() + path).get().header("Authorization", "Bearer " + accessToken.get()).build();
try (Response response = httpClient.newCall(request).execute()) {
if (!response.isSuccessful()) {
throw new IOException("意外的响应码: " + response.code());
}
return response.body().string();
}
});
}
/**
* 执行GET请求并返回文件流供调用者处理如保存到文件或浏览器下载
*/
public InputStream getAsStream(String path) throws IOException {
return executeRequestWithRetry(() -> {
Request request = new Request.Builder().url(config.getApiUrl() + path).get().header("Authorization", "Bearer " + accessToken.get()).build();
return executeStreamRequest(request);
});
}
public <T> T post(String path, Object requestBody, Class<T> responseType) throws IOException {
String jsonBody = objectMapper.writeValueAsString(requestBody);
RequestBody body = RequestBody.create(jsonBody, MediaType.get("application/json; charset=utf-8"));
return executeRequestWithRetry(() -> {
Request request = new Request.Builder().url(config.getApiUrl() + path).post(body).header("Authorization", "Bearer " + accessToken.get()).build();
return executeRequest(request, responseType);
});
}
public <T> T delete(String path, Class<T> responseType) throws IOException {
return executeRequestWithRetry(() -> {
Request request = new Request.Builder().url(config.getApiUrl() + path).delete().header("Authorization", "Bearer " + accessToken.get()).build();
return executeRequest(request, responseType);
});
}
public <T> T delete(String path, Map<String, String> queryParams, Class<T> responseType) throws IOException {
// 构建 URL 并添加查询参数
HttpUrl.Builder urlBuilder = HttpUrl.parse(config.getApiUrl() + path).newBuilder();
if (queryParams != null) {
queryParams.forEach(urlBuilder::addQueryParameter);
}
String url = urlBuilder.build().toString();
return executeRequestWithRetry(() -> {
Request request = new Request.Builder().url(url).delete().header("Authorization", "Bearer " + accessToken.get()).build();
return executeRequest(request, responseType);
});
}
public <T> T put(String path, Object requestBody, Class<T> responseType) throws IOException {
String jsonBody = objectMapper.writeValueAsString(requestBody);
RequestBody body = RequestBody.create(jsonBody, MediaType.get("application/json; charset=utf-8"));
return executeRequestWithRetry(() -> {
Request request = new Request.Builder().url(config.getApiUrl() + path).put(body).header("Authorization", "Bearer " + accessToken.get()).build();
return executeRequest(request, responseType);
});
}
private <T> T executeRequestWithRetry(IOExceptionRunnable<T> runnable) throws IOException {
int maxRetries = 2;
for (int attempt = 0; attempt < maxRetries; attempt++) {
try {
checkAndRefreshToken();
return runnable.run();
} catch (IOException e) {
if (attempt == maxRetries - 1 || !isTokenExpiredError(e)) {
throw e;
}
logger.info("令牌可能已过期,请刷新并重试...");
try {
accessToken.set(getAccessToken());
tokenIssueTime = System.currentTimeMillis();
tokenExpiration = tokenIssueTime + (12 * 60 * 60 * 1000); // 默认 12 小时
} catch (Exception ex) {
throw new IOException("刷新令牌失败: " + ex.getMessage(), e);
}
}
}
throw new IOException("已达到最大重试次数");
}
private void checkAndRefreshToken() throws IOException {
long currentTime = System.currentTimeMillis();
if (currentTime > tokenExpiration - 300000) { // 提前 5 分钟刷新
try {
accessToken.set(getAccessToken());
tokenIssueTime = System.currentTimeMillis();
tokenExpiration = tokenIssueTime + (12 * 60 * 60 * 1000); // 默认 12 小时
logger.info("令牌已刷新,到期时间: " + new java.util.Date(tokenExpiration));
} catch (Exception e) {
throw new IOException("刷新令牌失败: " + e.getMessage());
}
}
}
private boolean isTokenExpiredError(IOException e) {
// 判断是否为 401 错误Token 过期
return e.getMessage().contains("401") || e.getMessage().contains("Unauthorized");
}
private <T> T executeRequest(Request request, Class<T> responseType) throws IOException {
try (Response response = httpClient.newCall(request).execute()) {
String responseBody = response.body().string();
logger.info("响应体:" + responseBody);
if (!response.isSuccessful()) {
throw new IOException(StrUtil.format("意外的响应码: {}", responseBody));
}
return objectMapper.readValue(responseBody, responseType);
}
}
public synchronized String getAccessToken() throws Exception {
// 创建信任所有证书的 OkHttpClient
// OkHttpClient client = httpClient.newBuilder().sslSocketFactory(createTrustAllSslSocketFactory(), createTrustAllTrustManager()).hostnameVerifier((hostname, session) -> true).build();
MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
RequestBody body = RequestBody.create(mediaType, "username=" + config.getUsername() + "&password=" + config.getPassword());
Request request = new Request.Builder().url(config.getApiUrl() + "/access/token").post(body).addHeader("Content-Type", "application/x-www-form-urlencoded").addHeader("Accept", "*/*").addHeader("User-Agent", "fw-nifi-client/1.0").addHeader("Connection", "keep-alive").build();
try (Response response = httpClient.newCall(request).execute()) {
if (!response.isSuccessful()) {
throw new IOException("获取访问令牌失败,响应码: " + response.code() + " - " + response.message());
}
byte[] bytes = response.body().bytes();
String newToken = new String(bytes, StandardCharsets.UTF_8);
return newToken;
}
}
// private SSLSocketFactory createTrustAllSslSocketFactory() throws Exception {
// SSLContext sslContext = SSLContext.getInstance("SSL");
// sslContext.init(null, new TrustManager[]{createTrustAllTrustManager()}, new SecureRandom());
// return sslContext.getSocketFactory();
// }
// private X509TrustManager createTrustAllTrustManager() {
// return new X509TrustManager() {
// @Override
// public void checkClientTrusted(X509Certificate[] chain, String authType) {
// }
//
// @Override
// public void checkServerTrusted(X509Certificate[] chain, String authType) {
// }
//
// @Override
// public X509Certificate[] getAcceptedIssuers() {
// return new X509Certificate[0];
// }
// };
// }
private InputStream executeStreamRequest(Request request) throws IOException {
Response response = httpClient.newCall(request).execute();
if (!response.isSuccessful()) {
String responseBody = response.body().string();
response.close();
throw new IOException("意外的响应码: " + responseBody);
}
return response.body().byteStream();
}
// 功能接口用于重试逻辑
@FunctionalInterface
private interface IOExceptionRunnable<T> {
T run() throws IOException;
}
}

View File

@ -0,0 +1,60 @@
package com.hzya.frame.nifiapi.config;
import okhttp3.OkHttpClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
import java.security.SecureRandom;
import java.security.cert.X509Certificate;
import java.util.concurrent.TimeUnit;
/**
* OkHttpClient配置类
*
* @Authorliuyang
* @Packagecom.hzya.frame.nifi.config
* @Projectfw-nifi
* @nameHttpClientConfig
* @Date2025/5/14 11:45
* @FilenameHttpClientConfig
*/
@Configuration
public class HttpClientConfig {
@Bean
public OkHttpClient okHttpClient() throws Exception {
//调用nifi接口正常情况不会超过60秒的目前遇到的接口1秒以内调用完毕
return new OkHttpClient.Builder().sslSocketFactory(createTrustAllSslSocketFactory(), createTrustAllTrustManager()).hostnameVerifier((hostname, session) -> true).connectTimeout(60, TimeUnit.SECONDS) // 连接超时时间
.readTimeout(60, TimeUnit.SECONDS) // 读取超时时间
.writeTimeout(60, TimeUnit.SECONDS) // 写入超时时间
.build();
}
private SSLSocketFactory createTrustAllSslSocketFactory() throws Exception {
SSLContext sslContext = SSLContext.getInstance("SSL");
sslContext.init(null, new TrustManager[]{createTrustAllTrustManager()}, new SecureRandom());
return sslContext.getSocketFactory();
}
private X509TrustManager createTrustAllTrustManager() {
return new X509TrustManager() {
@Override
public void checkClientTrusted(X509Certificate[] chain, String authType) {
}
@Override
public void checkServerTrusted(X509Certificate[] chain, String authType) {
}
@Override
public X509Certificate[] getAcceptedIssuers() {
return new X509Certificate[0];
}
};
}
}

View File

@ -0,0 +1,29 @@
package com.hzya.frame.nifiapi.config;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* jackson配置类
*
* @Authorliuyang
* @Packagecom.hzya.frame.nifi.config
* @Projectfw-nifi
* @nameJacksonConfig
* @Date2025/5/14 11:54
* @FilenameJacksonConfig
*/
@Configuration
public class JacksonConfig {
@Bean
public ObjectMapper objectMapper() {
ObjectMapper objectMapper = new ObjectMapper();
// 自动注册模块
objectMapper.findAndRegisterModules();
// 忽略 JSON 中存在但实体类中缺少的字段
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
return objectMapper;
}
}

View File

@ -0,0 +1,38 @@
package com.hzya.frame.nifiapi.config;
import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
/**
* nifi service配置类
*
* @Authorliuyang
* @Packagecom.hzya.frame.nifi.config
* @Projectfw-nifi
* @nameNifiConfig
* @Date2025/5/14 09:59
* @FilenameNifiConfig
*/
@Configuration
@Data
public class NifiServiceConfig {
@Value("${nifi.api.url:https://192.168.2.233:8443/nifi-api}")
private String apiUrl;
@Value("${nifi.api.username:hzya}")
private String username;
@Value("${nifi.api.password:hzya1314*nifi}")
private String password;
@Value("${nifi.api.controllerModifymark:接口修改标记}")
private String controllerModifyMark;
@Value("${nifi.api.relationshipMark:接口关系标记}")
private String relationshipMark;
@Value("${nifi.api.relationshipMark:接口状态清理标记}")
private String stateClearMark;
}

View File

@ -0,0 +1,30 @@
package com.hzya.frame.nifiapi.model.basemodel;
import com.hzya.frame.nifiapi.model.joincreparamcontext.CreateParamContextJoin;
import com.hzya.frame.nifiapi.model.joinfindneedmodifycontroller.FindNeedModifyController;
import lombok.Data;
/**
* 基类封转创建应用操作公共的字段
*
* @Authorliuyang
* @Packagecom.hzya.frame.nifiapi.model.joincreateoracleapp
* @Projectfw-nifi
* @nameCreateOracleApp
* @Date2025/5/21 17:44
* @FilenameCreateOracleApp
*/
@Data
public class JoinBashModel {
//实例化
private String appProcessGroupId;
private String parentProcessGroupId;
private String copyTargetProcessGroupId;
// private String copyTargetParentProcessGroupId;
//上下文
private CreateParamContextJoin createParamContextJoin;
//控制器
private FindNeedModifyController findNeedModifyController;
}

View File

@ -0,0 +1,15 @@
package com.hzya.frame.nifiapi.model.joinbindparametercontexts;
import lombok.Data;
/**
* Auto-generated: 2025-05-16 11:1:46
*
* @author bejson.com (i@bejson.com)
* @website http://www.bejson.com/java2pojo/
*/
@Data
public class BindParameterContextsJoin11 {
private Revision11 revision;
private Component11 component;
}

View File

@ -0,0 +1,15 @@
package com.hzya.frame.nifiapi.model.joinbindparametercontexts;
import lombok.Data;
/**
* Auto-generated: 2025-05-16 11:1:46
*
* @author bejson.com (i@bejson.com)
* @website http://www.bejson.com/java2pojo/
*/
@Data
public class Component11 {
private String id;
private ParameterContext11 parameterContext;
}

View File

@ -0,0 +1,8 @@
package com.hzya.frame.nifiapi.model.joinbindparametercontexts;
import lombok.Data;
@Data
public class ParameterContext11 {
private String id;
}

View File

@ -0,0 +1,17 @@
/**
* Copyright 2025 bejson.com
*/
package com.hzya.frame.nifiapi.model.joinbindparametercontexts;
import lombok.Data;
/**
* Auto-generated: 2025-05-16 11:1:46
*
* @author bejson.com (i@bejson.com)
* @website http://www.bejson.com/java2pojo/
*/
@Data
public class Revision11 {
private String version;
}

View File

@ -0,0 +1,17 @@
package com.hzya.frame.nifiapi.model.joincontrollerenabled;
import lombok.Data;
/**
* @Authorliuyang
* @Packagecom.hzya.frame.nifi.model.joincontrollerenabled
* @Projectfw-nifi
* @nameEnOrDiControllerServices
* @Date2025/5/16 16:54
* @FilenameEnOrDiControllerServices
*/
@Data
public class EnOrDiControllerServices12 {
private String state;
private Revision13 revision;
}

View File

@ -0,0 +1,16 @@
package com.hzya.frame.nifiapi.model.joincontrollerenabled;
import lombok.Data;
/**
* @Authorliuyang
* @Packagecom.hzya.frame.nifi.model.joincontrollerenabled
* @Projectfw-nifi
* @nameControllerServiceStatus
* @Date2025/5/16 16:54
* @FilenameControllerServiceStatus
*/
@Data
public class Revision13 {
private String version;
}

View File

@ -0,0 +1,20 @@
package com.hzya.frame.nifiapi.model.joincreateconnection;
import lombok.Data;
/**
* @Authorliuyang
* @Packagecom.hzya.frame.nifi.model.joincreateconnection
* @Projectfw-nifi
* @nameComponent18
* @Date2025/5/19 15:39
* @FilenameComponent18
*/
@Data
public class Component18 {
private String id;
private String parentGroupId;
private String backPressureObjectThreshold;
private String backPressureDataSizeThreshold;
private String flowFileExpiration;
}

View File

@ -0,0 +1,23 @@
package com.hzya.frame.nifiapi.model.joincreateconnection;
import lombok.Data;
/**
* @Authorliuyang
* @Packagecom.hzya.frame.nifi.model.joincreateconnection
* @Projectfw-nifi
* @nameCreateConnection
* @Date2025/5/19 15:35
* @FilenameCreateConnection
*/
@Data
public class CreateConnection18 {
private String id;
private String sourceId;
private String sourceGroupId;
private String sourceType;
private String destinationId;
private String destinationGroupId;
private String destinationType;
private Revision18 revision;
}

View File

@ -0,0 +1,16 @@
package com.hzya.frame.nifiapi.model.joincreateconnection;
import lombok.Data;
/**
* @Authorliuyang
* @Packagecom.hzya.frame.nifi.model.joincreateconnection
* @Projectfw-nifi
* @nameRevision18
* @Date2025/5/19 15:36
* @FilenameRevision18
*/
@Data
public class Revision18 {
private String version;
}

View File

@ -0,0 +1,20 @@
package com.hzya.frame.nifiapi.model.joincreateconnections;
import lombok.Data;
import java.util.List;
/**
* @Authorliuyang
* @Packagecom.hzya.frame.nifi.model.joincreateconnections
* @Projectfw-nifi
* @nameComponent17
* @Date2025/5/19 11:58
* @FilenameComponent17
*/
@Data
public class Component18 {
private SourceOrDestination18 source;
private SourceOrDestination18 destination;
private List<String> selectedRelationships;
}

View File

@ -0,0 +1,17 @@
package com.hzya.frame.nifiapi.model.joincreateconnections;
import lombok.Data;
/**
* @Authorliuyang
* @Packagecom.hzya.frame.nifi.model.joincreateconnections
* @Projectfw-nifi
* @nameCreateConnections
* @Date2025/5/19 11:56
* @FilenameCreateConnections
*/
@Data
public class CreateConnections18 {
private Revision18 revision;
private Component18 component;
}

View File

@ -0,0 +1,16 @@
package com.hzya.frame.nifiapi.model.joincreateconnections;
import lombok.Data;
/**
* @Authorliuyang
* @Packagecom.hzya.frame.nifi.model.joincreateconnections
* @Projectfw-nifi
* @nameRevision17
* @Date2025/5/19 11:56
* @FilenameRevision17
*/
@Data
public class Revision18 {
private String version;
}

View File

@ -0,0 +1,18 @@
package com.hzya.frame.nifiapi.model.joincreateconnections;
import lombok.Data;
/**
* @Authorliuyang
* @Packagecom.hzya.frame.nifi.model.joincreateconnections
* @Projectfw-nifi
* @nameSourceOrDestination
* @Date2025/5/19 13:39
* @FilenameSourceOrDestination
*/
@Data
public class SourceOrDestination18 {
private String id;
private String groupId;
private String type;
}

View File

@ -0,0 +1,16 @@
package com.hzya.frame.nifiapi.model.joincreatemysqlapp;
import com.hzya.frame.nifiapi.model.basemodel.JoinBashModel;
import lombok.Data;
/**
* @Authorliuyang
* @Packagecom.hzya.frame.nifiapi.model.joincreateoracleapp
* @Projectfw-nifi
* @nameCreateOracleApp
* @Date2025/5/21 17:44
* @FilenameCreateOracleApp
*/
@Data
public class CreateMysqlApp extends JoinBashModel {
}

View File

@ -0,0 +1,16 @@
package com.hzya.frame.nifiapi.model.joincreateoracleapp;
import com.hzya.frame.nifiapi.model.basemodel.JoinBashModel;
import lombok.Data;
/**
* @Authorliuyang
* @Packagecom.hzya.frame.nifiapi.model.joincreateoracleapp
* @Projectfw-nifi
* @nameCreateOracleApp
* @Date2025/5/21 17:44
* @FilenameCreateOracleApp
*/
@Data
public class CreateAppInstanceJoin extends JoinBashModel {
}

View File

@ -0,0 +1,20 @@
package com.hzya.frame.nifiapi.model.joincreateprocessconnection;
import com.hzya.frame.nifiapi.model.joincreateconnections.CreateConnections18;
import lombok.Data;
import java.util.List;
/**
* @Authorliuyang
* @Packagecom.hzya.frame.nifiapi.model.joincreateprocessconnection
* @Projectfw-nifi
* @nameCreateProcessorConnections
* @Date2025/5/22 14:06
* @FilenameCreateProcessorConnections
*/
@Data
public class CreateProcessorConnections {
private String processGroupsId;
private List<CreateConnections18> createConnections18;
}

View File

@ -0,0 +1,20 @@
package com.hzya.frame.nifiapi.model.joincreateprocessorandupdateparam;
import com.hzya.frame.nifiapi.model.resultprocessorsinfo.Component16;
import lombok.Data;
/**
* @Authorliuyang
* @Packagecom.hzya.frame.nifiapi.model.joincerateprocessorandupdateparam
* @Projectfw-nifi
* @nameCreateProcessorAndUpdateParam
* @Date2025/5/26 15:59
* @FilenameCreateProcessorAndUpdateParam
*/
@Data
public class CreateProcessorAndUpdateParamJoin {
private String targetProcessorId;
private String parentProcessGroupId;
private String copyTargetProcessGroupId;
private Component16 component;
}

View File

@ -0,0 +1,19 @@
package com.hzya.frame.nifiapi.model.joincreatetemp;
import lombok.Data;
/**
* @Authorliuyang
* @Packagecom.hzya.frame.nifi.model.joincreatetemp
* @Projectfw-nifi
* @nameCreateTemplateJoin
* @Date2025/5/17 10:52
* @FilenameCreateTemplateJoin
*/
@Data
public class CreateTemplateJoin {
private String name;
private String description;
private String snippetId;
private String disconnectedNodeAcknowledged;
}

View File

@ -0,0 +1,18 @@
package com.hzya.frame.nifiapi.model.joincreparamcontext;
import com.hzya.frame.nifiapi.model.joinparametercontexts.ParameterContextsJoin;
import lombok.Data;
/**
* @Authorliuyang
* @Packagecom.hzya.frame.nifiapi.model.joincreparamcontext
* @Projectfw-nifi
* @nameCreateParamContextJoin
* @Date2025/5/22 08:58
* @FilenameCreateParamContextJoin
*/
@Data
public class CreateParamContextJoin {
private ParameterContextsJoin parameterContextsJoin;
private String processGroupsId;
}

View File

@ -0,0 +1,20 @@
package com.hzya.frame.nifiapi.model.joinfindneedmodifycontroller;
import com.hzya.frame.nifiapi.model.joingetcontroller.ControllerService12;
import lombok.Data;
import java.util.List;
/**
* @Authorliuyang
* @Packagecom.hzya.frame.nifiapi.model.joinfindneedmodifycontroller
* @Projectfw-nifi
* @nameFindNeedModifyController
* @Date2025/5/22 11:03
* @FilenameFindNeedModifyController
*/
@Data
public class FindNeedModifyController {
private String processGroupId;
private List<ControllerService12> needModifyController;
}

View File

@ -0,0 +1,31 @@
package com.hzya.frame.nifiapi.model.joingetallcontrollerservice;
import lombok.Data;
import java.util.Map;
/**
* @Authorliuyang
* @Packagecom.hzya.frame.nifiapi.model.joingetallcontrollerservice
* @Projectfw-nifi
* @nameComponent19
* @Date2025/5/22 10:28
* @FilenameComponent19
*/
@Data
public class Component19 {
private String id;
private String name;
private String type;
private String state;
private String validationStatus;
private String bulletinLevel;
private String extensionMissing;
private String comments;
private Map<String, String> properties;
private String persistsState;
private String restricted;
private String deprecated;
private String multipleVersionsAvailable;
private String supportsSensitiveDynamicProperties;
}

View File

@ -0,0 +1,18 @@
package com.hzya.frame.nifiapi.model.joingetallcontrollerservice;
import lombok.Data;
/**
* @Authorliuyang
* @Packagecom.hzya.frame.nifiapi.model.joingetallcontrollerservice
* @Projectfw-nifi
* @nameControllerServices19
* @Date2025/5/22 10:15
* @FilenameControllerServices19
*/
@Data
public class ControllerServices19 {
private String id;
private String uri;
private Component19 component;
}

View File

@ -0,0 +1,18 @@
package com.hzya.frame.nifiapi.model.joingetallcontrollerservice;
import lombok.Data;
import java.util.List;
/**
* @Author liuyang
* @Package com.hzya.frame.nifiapi.model.joingetallcontrollerservice
* @Project fw-nifi
* @name GetAllController
* @Date 2025/5/22 10:13
* @Filename GetAllController
*/
@Data
public class GetAllController19 {
private List<ControllerServices19> controllerServices;
}

View File

@ -0,0 +1,27 @@
package com.hzya.frame.nifiapi.model.joingetcontroller;
import lombok.Data;
import java.util.Map;
/**
* @Authorliuyang
* @Packagecom.hzya.frame.nifi.model.joingetcontroller
* @Projectfw-nifi
* @nameComponent11
* @Date2025/5/16 13:59
* @FilenameComponent11
*/
@Data
public class Component12 {
private String id;//随机字符串
private String name;
private String type;
private String state;
//每个不同类型的控制器服务对应的属性都不一样这里就很坑
private Map<String, String> properties;
private String validationStatus;
private String bulletinLevel;
private String extensionMissing;
private String comments;
}

View File

@ -0,0 +1,21 @@
package com.hzya.frame.nifiapi.model.joingetcontroller;
import lombok.Data;
/**
* @Authorliuyang
* @Packagecom.hzya.frame.nifi.model.joingetcontroller
* @Projectfw-nifi
* @nameControllerSerbices
* @Date2025/5/16 13:57
* @FilenameControllerSerbices
*/
@Data
public class ControllerService12 {
//控制器服务id
private String id;
private Revision12 revision;
private Component12 component;
//修改标记id
private String modifyMarkId;
}

View File

@ -0,0 +1,24 @@
package com.hzya.frame.nifiapi.model.joingetcontroller;//package com.hzya.frame.nifi.model.joingetcontroller;
//
//import lombok.Data;
//
///**
// * @Authorliuyang
// * @Packagecom.hzya.frame.nifi.model.joingetcontroller
// * @Projectfw-nifi
// * @nameProperties11
// * @Date2025/5/16 14:00
// * @FilenameProperties11
// */
//@Data
//public class Properties11 {
// private String databaseConnectionUrl;
// private String databaseDriverClassName;
// private String databaseDriverLocations;
// private String databaseUser;
// private String password;
// private String maxWaitTime;
// private String maxTotalConnections;
// private String validationQuery;
// private String dbcpMinIdleConns;
//}

View File

@ -0,0 +1,16 @@
package com.hzya.frame.nifiapi.model.joingetcontroller;
import lombok.Data;
/**
* @Authorliuyang
* @Packagecom.hzya.frame.nifi.model.joingetcontroller
* @Projectfw-nifi
* @nameRevision11
* @Date2025/5/16 13:58
* @FilenameRevision11
*/
@Data
public class Revision12 {
private String version;
}

View File

@ -0,0 +1,17 @@
package com.hzya.frame.nifiapi.model.joinparametercontexts;
import lombok.Data;
import java.util.List;
/**
* Auto-generated: 2025-05-14 18:33:21
*
* @author bejson.com (i@bejson.com)
* @website http://www.bejson.com/java2pojo/
*/
@Data
public class Component3 {
private String name;
private List<Parameters2> parameters;
}

View File

@ -0,0 +1,11 @@
package com.hzya.frame.nifiapi.model.joinparametercontexts;
import lombok.Data;
@Data
public class Parameter2 {
private String name;
private String value;
private boolean sensitive;
private String description;
}

View File

@ -0,0 +1,9 @@
package com.hzya.frame.nifiapi.model.joinparametercontexts;
import lombok.Data;
@Data
public class ParameterContextsJoin {
private Revision revision;
private Component3 component;
}

View File

@ -0,0 +1,11 @@
/**
* Copyright 2025 bejson.com
*/
package com.hzya.frame.nifiapi.model.joinparametercontexts;
import lombok.Data;
@Data
public class Parameters2 {
private Parameter2 parameter;
}

View File

@ -0,0 +1,8 @@
package com.hzya.frame.nifiapi.model.joinparametercontexts;
import lombok.Data;
@Data
public class Revision {
private int version;
}

View File

@ -0,0 +1,9 @@
package com.hzya.frame.nifiapi.model.joinprocessgroups;
import lombok.Data;
@Data
public class Component7 {
private String name;
private Position7 position;
}

View File

@ -0,0 +1,25 @@
package com.hzya.frame.nifiapi.model.joinprocessgroups;
import lombok.Data;
/**
* @Authorliuyang
* @Packagecom.hzya.frame.nifiapi.model.joinprocessgroups
* @Projectfw-nifi
* @namePosition7
* @Date2025/5/21 14:57
* @FilenamePosition7
*/
@Data
public class Position7 {
private String x;
private String y;
public Position7() {
}
public Position7(String x, String y) {
this.x = x;
this.y = y;
}
}

View File

@ -0,0 +1,16 @@
package com.hzya.frame.nifiapi.model.joinprocessgroups;
import lombok.Data;
/**
* @Authorliuyang
* @Packagecom.hzya.frame.nifi.model.joinprocessgroups
* @Projectfw-nifi
* @nameProcessGroupStatus
* @Date2025/5/15 10:43
* @FilenameProcessGroupStatus
*/
@Data
public class ProcessGroupStatus {
private String name;
}

View File

@ -0,0 +1,18 @@
package com.hzya.frame.nifiapi.model.joinprocessgroups;
import lombok.Data;
/**
* @Authorliuyang
* @Packagecom.hzya.frame.nifi.model.joinprocessgroups
* @Projectfw-nifi
* @nameProcessGroupsJoin
* @Date2025/5/15 10:43
* @FilenameProcessGroupsJoin
*/
@Data
public class ProcessGroupsJoin {
private Revision5 revision;
// private ProcessGroupStatus status;
private Component7 component;
}

View File

@ -0,0 +1,8 @@
package com.hzya.frame.nifiapi.model.joinprocessgroups;
import lombok.Data;
@Data
public class Revision5 {
private int version;
}

View File

@ -0,0 +1,18 @@
package com.hzya.frame.nifiapi.model.joinsnippetinstance;
import lombok.Data;
/**
* @Authorliuyang
* @Packagecom.hzya.frame.nifi.model.joinsnippetinstance
* @Projectfw-nifi
* @nameSnippetInstanceJoin
* @Date2025/5/17 14:21
* @FilenameSnippetInstanceJoin
*/
@Data
public class SnippetInstanceJoin {
private String snippetId;
private String originX;
private String originY;
}

View File

@ -0,0 +1,20 @@
package com.hzya.frame.nifiapi.model.joinsnippets;
import lombok.Data;
import java.util.Map;
/**
* @Authorliuyang
* @Packagecom.hzya.frame.nifi.model.joinsnippets
* @Projectfw-nifi
* @nameSnippet
* @Date2025/5/17 11:01
* @FilenameSnippet
*/
@Data
public class Snippet {
private String parentGroupId;
private Map<String, Map<String, String>> processGroups;
private Map<String, Map<String, String>> processors;
}

View File

@ -0,0 +1,16 @@
package com.hzya.frame.nifiapi.model.joinsnippets;
import lombok.Data;
/**
* @Authorliuyang
* @Packagecom.hzya.frame.nifi.model.joinsnippets
* @Projectfw-nifi
* @nameSnippetsJoin
* @Date2025/5/17 11:00
* @FilenameSnippetsJoin
*/
@Data
public class SnippetsJoin {
private Snippet snippet;
}

View File

@ -0,0 +1,17 @@
/**
* Copyright 2025 bejson.com
*/
package com.hzya.frame.nifiapi.model.joinstartorstopprocessgroup;
import lombok.Data;
/**
* Auto-generated: 2025-05-16 10:47:3
*
* @author bejson.com (i@bejson.com)
* @website http://www.bejson.com/java2pojo/
*/
@Data
public class Revision10 {
private String version;
}

View File

@ -0,0 +1,16 @@
package com.hzya.frame.nifiapi.model.joinstartorstopprocessgroup;
import lombok.Data;
/**
* Auto-generated: 2025-05-16 10:47:3
*
* @author bejson.com (i@bejson.com)
* @website http://www.bejson.com/java2pojo/
*/
@Data
public class StartOrStopProcessGroupsInfoJoin10 {
private String id;
private String state;
private Revision10 revision;
}

View File

@ -0,0 +1,16 @@
package com.hzya.frame.nifiapi.model.joinupdateprocessor;
import lombok.Data;
/**
* @Authorliuyang
* @Packagecom.hzya.frame.nifi.model.joinupdateprocessor
* @Projectfw-nifi
* @nameRevision17
* @Date2025/5/19 11:26
* @FilenameRevision17
*/
@Data
public class Revision17 {
private String version;
}

View File

@ -0,0 +1,17 @@
package com.hzya.frame.nifiapi.model.joinupdateprocessor;
import lombok.Data;
/**
* @Authorliuyang
* @Packagecom.hzya.frame.nifi.model.joinupdateprocessor
* @Projectfw-nifi
* @nameRunStatusOrStop
* @Date2025/5/19 11:25
* @FilenameRunStatusOrStop
*/
@Data
public class RunStatusOrStop17 {
private String state;
private Revision17 revision;
}

View File

@ -0,0 +1,11 @@
package com.hzya.frame.nifiapi.model.nifitemplates;
import lombok.Data;
import java.util.List;
@Data
public class NifiTemplates {
private List<Templates> templates;
private String generated;
}

View File

@ -0,0 +1,9 @@
package com.hzya.frame.nifiapi.model.nifitemplates;
import lombok.Data;
@Data
public class Permissions {
private String canRead;
private String canWrite;
}

View File

@ -0,0 +1,16 @@
package com.hzya.frame.nifiapi.model.nifitemplates;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
@Data
public class Template {
private String uri;
private String id;
private String groupId;
private String name;
private String description;
private String timestamp;
@JsonProperty("encoding-version")
private String encodingVersion;
}

View File

@ -0,0 +1,10 @@
package com.hzya.frame.nifiapi.model.nifitemplates;
import lombok.Data;
@Data
public class Templates {
private String id;
private Permissions permissions;
private Template template;
}

View File

@ -0,0 +1,30 @@
package com.hzya.frame.nifiapi.model.processgroupid;
import lombok.Data;
@Data
public class AggregateSnapshot {
private String id;
private String groupId;
private String name;
private String type;
private String runStatus;
private String executionNode;
private String bytesRead;
private String bytesWritten;
private String read;
private String written;
private String flowFilesIn;
private String bytesIn;
private String input;
private String flowFilesOut;
private String bytesOut;
private String output;
private String taskCount;
private String tasksDurationNanos;
private String tasks;
private String tasksDuration;
private String activeThreadCount;
private String terminatedThreadCount;
private ProcessingPerformanceStatus processingPerformanceStatus;
}

View File

@ -0,0 +1,10 @@
package com.hzya.frame.nifiapi.model.processgroupid;
import lombok.Data;
@Data
public class AllowableValue {
private String displayName;
private String value;
private String description;
}

View File

@ -0,0 +1,9 @@
package com.hzya.frame.nifiapi.model.processgroupid;
import lombok.Data;
@Data
public class AllowableValues {
private AllowableValue allowableValue;
private String canRead;
}

View File

@ -0,0 +1,18 @@
package com.hzya.frame.nifiapi.model.processgroupid;
import lombok.Data;
import java.util.List;
@Data
public class AttributesToIgnore {
private String name;
private String displayName;
private String description;
private String required;
private String sensitive;
private String dynamic;
private String supportsEl;
private String expressionLanguageScope;
private List<String> dependencies;
}

View File

@ -0,0 +1,18 @@
package com.hzya.frame.nifiapi.model.processgroupid;
import lombok.Data;
import java.util.List;
@Data
public class AttributesToIgnoreRegex {
private String name;
private String displayName;
private String description;
private String required;
private String sensitive;
private String dynamic;
private String supportsEl;
private String expressionLanguageScope;
private List<String> dependencies;
}

View File

@ -0,0 +1,18 @@
package com.hzya.frame.nifiapi.model.processgroupid;
import lombok.Data;
import java.util.List;
@Data
public class AttributesToLog {
private String name;
private String displayName;
private String description;
private String required;
private String sensitive;
private String dynamic;
private String supportsEl;
private String expressionLanguageScope;
private List<String> dependencies;
}

View File

@ -0,0 +1,19 @@
package com.hzya.frame.nifiapi.model.processgroupid;
import lombok.Data;
import java.util.List;
@Data
public class AttributesToLogRegex {
private String name;
private String displayName;
private String description;
private String defaultValue;
private String required;
private String sensitive;
private String dynamic;
private String supportsEl;
private String expressionLanguageScope;
private List<String> dependencies;
}

View File

@ -0,0 +1,9 @@
package com.hzya.frame.nifiapi.model.processgroupid;
import lombok.Data;
@Data
public class Breadcrumb {
private String id;
private String name;
}

View File

@ -0,0 +1,11 @@
package com.hzya.frame.nifiapi.model.processgroupid;
import lombok.Data;
@Data
public class Breadcrumb2 {
private String id;
private Permissions2 permissions;
private Breadcrumb3 breadcrumb;
private ParentBreadcrumb2 parentBreadcrumb;
}

View File

@ -0,0 +1,17 @@
package com.hzya.frame.nifiapi.model.processgroupid;
import lombok.Data;
/**
* @Authorliuyang
* @Packagecom.hzya.frame.nifi.model.processgroupid
* @Projectfw-nifi
* @nameBreadcrumb3
* @Date2025/5/14 17:57
* @FilenameBreadcrumb3
*/
@Data
public class Breadcrumb3 {
private String id;
private String name;
}

View File

@ -0,0 +1,15 @@
package com.hzya.frame.nifiapi.model.processgroupid;
import lombok.Data;
@Data
public class Bulletin {
private String id;
private String category;
private String groupId;
private String sourceId;
private String sourceName;
private String level;
private String message;
private String timestamp;
}

View File

@ -0,0 +1,13 @@
package com.hzya.frame.nifiapi.model.processgroupid;
import lombok.Data;
@Data
public class Bulletins {
private String id;
private String groupId;
private String sourceId;
private String timestamp;
private String canRead;
private Bulletin bulletin;
}

View File

@ -0,0 +1,10 @@
package com.hzya.frame.nifiapi.model.processgroupid;
import lombok.Data;
@Data
public class Bundle {
private String group;
private String artifact;
private String version;
}

View File

@ -0,0 +1,19 @@
package com.hzya.frame.nifiapi.model.processgroupid;
import lombok.Data;
import java.util.List;
@Data
public class CharacterSet {
private String name;
private String displayName;
private String description;
private String defaultValue;
private String required;
private String sensitive;
private String dynamic;
private String supportsEl;
private String expressionLanguageScope;
private List<String> dependencies;
}

View File

@ -0,0 +1,13 @@
package com.hzya.frame.nifiapi.model.processgroupid;
import lombok.Data;
@Data
public class Component {
private String id;
private String name;
private String comments;
private String state;
private String type;
private String concurrentlySchedulableTaskCount;
}

Some files were not shown because too many files have changed in this diff Show More