From fd3326602b61f075261bdf1dcccdf1150ff73b96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=86=B7=E5=86=B7?= Date: Tue, 24 Mar 2020 17:22:12 +0800 Subject: [PATCH] =?UTF-8?q?:fire:=20Removing=20code=20or=20files.=20?= =?UTF-8?q?=E5=88=A0=E9=99=A4=20elastic-job?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/2pigxx.sql | 9 +- db/4pigxx_job.sql | 39 --- db/6pigxx_config.sql | 4 +- docker-compose.yml | 5 - pigx-common/pigx-common-job/pom.xml | 18 -- .../job/ElasticJobAutoConfiguration.java | 87 ------ .../job/annotation/EnablePigxElasticJob.java | 36 --- .../jobinit/AbstractJobInitialization.java | 286 ----------------- .../jobinit/DataflowJobInitialization.java | 53 ---- .../job/jobinit/ScriptJobInitialization.java | 53 ---- .../job/jobinit/SimpleJobInitialization.java | 53 ---- .../job/properties/ElasticJobProperties.java | 293 ------------------ pigx-visual/pigx-daemon-elastic-job/pom.xml | 2 +- .../controller/ExecutionLogController.java | 98 ------ .../controller/StatusTraceLogController.java | 96 ------ .../daemon/elastic/entity/ExecutionLog.java | 77 ----- .../daemon/elastic/entity/StatusTraceLog.java | 69 ----- .../daemon/elastic/job/PigxDataflowJob.java | 40 --- .../daemon/elastic/job/PigxSimpleJob.java | 40 --- .../daemon/elastic/job/PigxSimpleJob2.java | 40 --- .../PigxDistributeElasticJobListener.java | 42 --- .../listener/PigxElasticJobListener.java | 39 --- .../elastic/mapper/ExecutionLogMapper.java | 16 - .../elastic/mapper/StatusTraceLogMapper.java | 16 - .../elastic/service/ExecutionLogService.java | 14 - .../service/StatusTraceLogService.java | 14 - .../service/impl/ExecutionLogServiceImpl.java | 18 -- .../impl/StatusTraceLogServiceImpl.java | 20 -- pom.xml | 3 +- 29 files changed, 5 insertions(+), 1575 deletions(-) delete mode 100755 pigx-common/pigx-common-job/src/main/java/com/pig4cloud/pigx/common/job/ElasticJobAutoConfiguration.java delete mode 100644 pigx-common/pigx-common-job/src/main/java/com/pig4cloud/pigx/common/job/annotation/EnablePigxElasticJob.java delete mode 100755 pigx-common/pigx-common-job/src/main/java/com/pig4cloud/pigx/common/job/jobinit/AbstractJobInitialization.java delete mode 100755 pigx-common/pigx-common-job/src/main/java/com/pig4cloud/pigx/common/job/jobinit/DataflowJobInitialization.java delete mode 100755 pigx-common/pigx-common-job/src/main/java/com/pig4cloud/pigx/common/job/jobinit/ScriptJobInitialization.java delete mode 100755 pigx-common/pigx-common-job/src/main/java/com/pig4cloud/pigx/common/job/jobinit/SimpleJobInitialization.java delete mode 100755 pigx-common/pigx-common-job/src/main/java/com/pig4cloud/pigx/common/job/properties/ElasticJobProperties.java delete mode 100644 pigx-visual/pigx-daemon-elastic-job/src/main/java/com/pig4cloud/pigx/daemon/elastic/controller/ExecutionLogController.java delete mode 100644 pigx-visual/pigx-daemon-elastic-job/src/main/java/com/pig4cloud/pigx/daemon/elastic/controller/StatusTraceLogController.java delete mode 100644 pigx-visual/pigx-daemon-elastic-job/src/main/java/com/pig4cloud/pigx/daemon/elastic/entity/ExecutionLog.java delete mode 100644 pigx-visual/pigx-daemon-elastic-job/src/main/java/com/pig4cloud/pigx/daemon/elastic/entity/StatusTraceLog.java delete mode 100644 pigx-visual/pigx-daemon-elastic-job/src/main/java/com/pig4cloud/pigx/daemon/elastic/job/PigxDataflowJob.java delete mode 100644 pigx-visual/pigx-daemon-elastic-job/src/main/java/com/pig4cloud/pigx/daemon/elastic/job/PigxSimpleJob.java delete mode 100644 pigx-visual/pigx-daemon-elastic-job/src/main/java/com/pig4cloud/pigx/daemon/elastic/job/PigxSimpleJob2.java delete mode 100644 pigx-visual/pigx-daemon-elastic-job/src/main/java/com/pig4cloud/pigx/daemon/elastic/listener/PigxDistributeElasticJobListener.java delete mode 100644 pigx-visual/pigx-daemon-elastic-job/src/main/java/com/pig4cloud/pigx/daemon/elastic/listener/PigxElasticJobListener.java delete mode 100644 pigx-visual/pigx-daemon-elastic-job/src/main/java/com/pig4cloud/pigx/daemon/elastic/mapper/ExecutionLogMapper.java delete mode 100644 pigx-visual/pigx-daemon-elastic-job/src/main/java/com/pig4cloud/pigx/daemon/elastic/mapper/StatusTraceLogMapper.java delete mode 100644 pigx-visual/pigx-daemon-elastic-job/src/main/java/com/pig4cloud/pigx/daemon/elastic/service/ExecutionLogService.java delete mode 100644 pigx-visual/pigx-daemon-elastic-job/src/main/java/com/pig4cloud/pigx/daemon/elastic/service/StatusTraceLogService.java delete mode 100644 pigx-visual/pigx-daemon-elastic-job/src/main/java/com/pig4cloud/pigx/daemon/elastic/service/impl/ExecutionLogServiceImpl.java delete mode 100644 pigx-visual/pigx-daemon-elastic-job/src/main/java/com/pig4cloud/pigx/daemon/elastic/service/impl/StatusTraceLogServiceImpl.java diff --git a/db/2pigxx.sql b/db/2pigxx.sql index 1f1659afc..d5bcd5491 100644 --- a/db/2pigxx.sql +++ b/db/2pigxx.sql @@ -332,11 +332,7 @@ INSERT INTO `sys_menu` VALUES (3200, '接口文档', NULL, 'http://127.0.0.1:999 INSERT INTO `sys_menu` VALUES (3300, '事务监控', NULL, '/tx/index', 3000, 'icon-gtsquanjushiwufuwuGTS', 5, '0', '0', '2018-08-19 11:02:39', '2019-06-24 15:18:04', '0'); INSERT INTO `sys_menu` VALUES (3400, '在线事务', NULL, '/tx/model', 3000, 'icon-online', 6, '0', '0', '2018-08-19 11:32:04', '2019-06-24 15:18:13', '0'); INSERT INTO `sys_menu` VALUES (3500, '文档扩展', NULL, 'http://127.0.0.1:9999/doc.html', 3000, 'icon-wendang', 2, '0', '0', '2018-06-26 10:50:32', '2019-05-01 23:57:42', '0'); -INSERT INTO `sys_menu` VALUES (3600, '任务轨迹', '', '/daemon/status-trace-log/index', 3000, 'icon-guiji', 8, '0', '0', '2018-01-20 13:17:19', '2019-06-24 15:18:41', '0'); -INSERT INTO `sys_menu` VALUES (3601, '删除轨迹', 'daemon_status_trace_log_del', NULL, 3600, '1', 2, '0', '1', '2018-05-15 21:35:18', '2019-03-30 09:31:06', '0'); -INSERT INTO `sys_menu` VALUES (3620, 'Quartz日志', '', '/daemon/job-log/index', 3000, 'icon-gtsquanjushiwufuwuGTS', 8, '0', '0', '2018-01-20 13:17:19', '2019-06-24 15:18:54', '0'); -INSERT INTO `sys_menu` VALUES (3630, '任务日志', '', '/daemon/execution-log/index', 3000, 'icon-wendang', 7, '0', '0', '2018-01-20 13:17:19', '2019-06-24 15:19:07', '0'); -INSERT INTO `sys_menu` VALUES (3631, '删除日志', 'daemon_execution_log_del', NULL, 3900, '1', 2, '0', '1', '2018-05-15 21:35:18', '2019-03-30 09:30:45', '0'); +INSERT INTO `sys_menu` VALUES (3600, 'Quartz日志', '', '/daemon/job-log/index', 3000, 'icon-gtsquanjushiwufuwuGTS', 8, '0', '0', '2018-01-20 13:17:19', '2019-06-24 15:18:54', '0'); INSERT INTO `sys_menu` VALUES (3700, '注册配置', NULL, '', 3000, 'icon-line', 10, '0', '0', '2018-01-25 11:08:52', '2019-06-24 15:35:10', '1'); INSERT INTO `sys_menu` VALUES (4000, '协同管理', NULL, '/activti', -1, 'icon-kuaisugongzuoliu_o', 3, '0', '0', '2018-09-26 01:38:13', '2018-09-28 08:58:24', '0'); INSERT INTO `sys_menu` VALUES (4100, '模型管理', NULL, '/activiti/index', 4000, 'icon-weibiaoti13', 1, '0', '0', '2018-09-26 01:39:07', '2019-06-24 15:20:00', '0'); @@ -551,9 +547,6 @@ INSERT INTO `sys_role_menu` VALUES (1, 3300); INSERT INTO `sys_role_menu` VALUES (1, 3400); INSERT INTO `sys_role_menu` VALUES (1, 3500); INSERT INTO `sys_role_menu` VALUES (1, 3600); -INSERT INTO `sys_role_menu` VALUES (1, 3601); -INSERT INTO `sys_role_menu` VALUES (1, 3620); -INSERT INTO `sys_role_menu` VALUES (1, 3630); INSERT INTO `sys_role_menu` VALUES (1, 4000); INSERT INTO `sys_role_menu` VALUES (1, 4100); INSERT INTO `sys_role_menu` VALUES (1, 4101); diff --git a/db/4pigxx_job.sql b/db/4pigxx_job.sql index 10addc497..412825e15 100644 --- a/db/4pigxx_job.sql +++ b/db/4pigxx_job.sql @@ -7,45 +7,6 @@ USE pigxx_job; SET NAMES utf8mb4; SET FOREIGN_KEY_CHECKS = 0; --- ---------------------------- --- Table structure for job_execution_log --- ---------------------------- -DROP TABLE IF EXISTS `job_execution_log`; -CREATE TABLE `job_execution_log` ( - `id` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, - `job_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, - `task_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, - `hostname` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, - `ip` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, - `sharding_item` int(11) NOT NULL, - `execution_source` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, - `failure_cause` varchar(4000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, - `is_success` int(11) NOT NULL, - `start_time` timestamp NULL DEFAULT NULL, - `complete_time` timestamp NULL DEFAULT NULL, - PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='任务日志表'; - --- ---------------------------- --- Table structure for job_status_trace_log --- ---------------------------- -DROP TABLE IF EXISTS `job_status_trace_log`; -CREATE TABLE `job_status_trace_log` ( - `id` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, - `job_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, - `original_task_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, - `task_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, - `slave_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, - `source` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, - `execution_type` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, - `sharding_item` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, - `state` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, - `message` varchar(4000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, - `creation_time` timestamp NULL DEFAULT NULL, - PRIMARY KEY (`id`) USING BTREE, - KEY `TASK_ID_STATE_INDEX` (`task_id`,`state`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='任务轨迹表'; - -- ---------------------------- -- Table structure for qrtz_blob_triggers -- ---------------------------- diff --git a/db/6pigxx_config.sql b/db/6pigxx_config.sql index ab96a0913..abe837a15 100644 --- a/db/6pigxx_config.sql +++ b/db/6pigxx_config.sql @@ -35,10 +35,10 @@ BEGIN; INSERT INTO `config_info` VALUES (1, 'application-dev.yml', 'DEFAULT_GROUP', 'jasypt:\n encryptor:\n password: pigx\n \nspring:\n redis:\n host: pigx-redis\n servlet:\n multipart:\n max-file-size: 100MB\n max-request-size: 100MB\n cloud:\n sentinel:\n eager: true\n filter:\n url-patterns: /** \n transport:\n dashboard: pigx-sentinel:5020\n \nmanagement:\n endpoints:\n web:\n exposure:\n include: \'*\'\n\nfeign:\n sentinel:\n enabled: true\n okhttp:\n enabled: true\n httpclient:\n enabled: false\n client:\n config:\n default:\n connectTimeout: 10000\n readTimeout: 10000\n compression:\n request:\n enabled: true\n response:\n enabled: true\n\nribbon:\n ReadTimeout: 10000\n ConnectTimeout: 10000\n\n#开启灰度\ngray:\n rule:\n enabled: true\n\nmybatis-plus:\n tenant-enable: ture\n mapper-locations: classpath:/mapper/*Mapper.xml\n global-config:\n banner: false\n db-config:\n id-type: auto\n field-strategy: NOT_EMPTY\n type-handlers-package: com.pig4cloud.pigx.common.data.handler\n\nswagger:\n title: PigX Swagger API\n license: Powered By PigX\n licenseUrl: https://pig4cloud.com/\n terms-of-service-url: https://pig4cloud.com/\n contact:\n email: wangiegie@gmail.com\n url: https://pig4cloud.com/about.html\n authorization:\n name: pigX OAuth\n auth-regex: ^.*$\n authorization-scope-list:\n - scope: server\n description: server all\n token-url-list:\n - http://${GATEWAY-HOST:pigx-gateway}:${GATEWAY-PORT:9999}/auth/oauth/token\n\nsecurity:\n oauth2:\n client:\n ignore-urls:\n - /actuator/**\n - /v2/api-docs\n resource:\n loadBalanced: true\n token-info-uri: http://pigx-auth/oauth/check_token', '954b56ac77f2691529aad5c497591b28', '2019-04-18 02:10:20', '2020-02-24 13:58:21', NULL, '172.17.0.125', '', '', '通用配置文件', 'null', 'null', 'yaml', 'null'); INSERT INTO `config_info` VALUES (2, 'pigx-auth-dev.yml', 'DEFAULT_GROUP', '# 数据源\nspring:\n datasource:\n type: com.alibaba.druid.pool.DruidDataSource\n druid:\n driver-class-name: com.mysql.cj.jdbc.Driver\n username: ${MYSQL-USER:root}\n password: ${MYSQL-PWD:root}\n url: jdbc:mysql://${MYSQL-HOST:pigx-mysql}:${MYSQL-PORT:3306}/${MYSQL-DB:pigxx}?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&allowPublicKeyRetrieval=true\n freemarker:\n allow-request-override: false\n allow-session-override: false\n cache: true\n charset: UTF-8\n check-template-location: true\n content-type: text/html\n enabled: true\n expose-request-attributes: false\n expose-session-attributes: false\n expose-spring-macro-helpers: true\n prefer-file-system-access: true\n suffix: .ftl\n template-loader-path: classpath:/templates/', 'a6674e6747c1a0bb6c6d78e13706f8f0', '2019-04-18 02:11:32', '2019-08-27 18:24:04', NULL, '127.0.0.1', '', '', '认证中心配置文件', 'null', 'null', 'yaml', 'null'); INSERT INTO `config_info` VALUES (3, 'pigx-codegen-dev.yml', 'DEFAULT_GROUP', '## spring security 配置\nsecurity:\n oauth2:\n client:\n client-id: ENC(gPFcUOmJm8WqM3k3eSqS0Q==)\n client-secret: ENC(gPFcUOmJm8WqM3k3eSqS0Q==)\n scope: server\n# 数据源\nspring:\n datasource:\n type: com.alibaba.druid.pool.DruidDataSource\n druid:\n driver-class-name: com.mysql.cj.jdbc.Driver\n username: ${MYSQL-USER:root}\n password: ${MYSQL-PWD:root}\n url: jdbc:mysql://${MYSQL-HOST:pigx-mysql}:${MYSQL-PORT:3306}/${MYSQL-DB:pigxx_codegen}?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&allowPublicKeyRetrieval=true\n resources:\n static-locations: classpath:/static/,classpath:/views/\n\npigx:\n tenant:\n column: tenant_id\n tables:\n - gen_datasource_conf', 'b7d132a3ecdfac4252c994adbb65b23a', '2019-04-18 02:12:10', '2019-08-27 18:24:18', NULL, '127.0.0.1', '', '', '代码生成', 'null', 'null', 'yaml', 'null'); -INSERT INTO `config_info` VALUES (4, 'pigx-daemon-elastic-job-dev.yml', 'DEFAULT_GROUP', '## spring security 配置\nsecurity:\n oauth2:\n client:\n client-id: ENC(tz2NM4GcmnE7sNJTYL8ZSg==)\n client-secret: ENC(tz2NM4GcmnE7sNJTYL8ZSg==)\n scope: server\n## 定时任务\n# 数据源\nspring:\n datasource:\n type: com.alibaba.druid.pool.DruidDataSource\n druid:\n driver-class-name: com.mysql.cj.jdbc.Driver\n username: ${MYSQL-USER:root}\n password: ${MYSQL-PWD:root}\n url: jdbc:mysql://${MYSQL-HOST:pigx-mysql}:${MYSQL-PORT:3306}/${MYSQL-DB:pigxx_job}?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&allowPublicKeyRetrieval=true\n elasticjob:\n # 分布式任务协调依赖zookeeper\n zookeeper:\n server-lists: ${ZOOKEEPER-HOST:pigx-zookeeper}:${ZOOKEEPER-PORT:2181}\n namespace: pigx-daemon\n # 普通任务\n simples:\n spring-simple-job:\n job-class: com.pig4cloud.pigx.daemon.elastic.job.PigxSimpleJob\n cron: 0 0 0/1 * * ?\n sharding-total-count: 3\n sharding-item-parameters: 0=service1,1=service2,2=service3\n eventTraceRdbDataSource: \'dataSource\'\n listener:\n listener-class: com.pig4cloud.pigx.daemon.elastic.listener.PigxElasticJobListener\n spring-simple-job2:\n job-class: com.pig4cloud.pigx.daemon.elastic.job.PigxSimpleJob2\n cron: 0 0 0/1 * * ?\n sharding-total-count: 3\n sharding-item-parameters: 0=service1,1=service2,2=service3\n eventTraceRdbDataSource: \'dataSource\'\n listener:\n listener-class: com.pig4cloud.pigx.daemon.elastic.listener.PigxElasticJobListener\n # 简单任务\n dataflows:\n spring-dataflow-job:\n job-class: com.pig4cloud.pigx.daemon.elastic.job.PigxDataflowJob\n cron: 0 0 0/1 * * ?\n sharding-total-count: 3\n sharding-item-parameters: 0=service1,1=service2,2=service3\n streaming-process: true\n eventTraceRdbDataSource: \'dataSource\'\n listener:\n distributed-listener-class: com.pig4cloud.pigx.daemon.elastic.listener.PigxDistributeElasticJobListener\n started-timeout-milliseconds: 5000\n completed-timeout-milliseconds: 10000\n\nxxl:\n job:\n admin:\n addresses: http://${XXL-HOST:pigx-xxl}:${XXL-HOST:9080}/xxl-job-admin\n executor:\n port: 9988\n appName: test-xxl', '9ce58242d57b57f737dcb59a41ee6e55', '2019-04-18 02:12:57', '2019-10-04 11:22:56', NULL, '127.0.0.1', '', '', '定时任务-elastic-job配置', 'null', 'null', 'yaml', 'null'); +INSERT INTO `config_info` VALUES (4, 'pigx-daemon-elastic-job-dev.yml', 'DEFAULT_GROUP', '## spring security 配置\nsecurity:\n oauth2:\n client:\n client-id: ENC(tz2NM4GcmnE7sNJTYL8ZSg==)\n client-secret: ENC(tz2NM4GcmnE7sNJTYL8ZSg==)\n scope: server\n## 定时任务\n# 数据源\nspring:\n datasource:\n type: com.alibaba.druid.pool.DruidDataSource\n druid:\n driver-class-name: com.mysql.cj.jdbc.Driver\n username: ${MYSQL-USER:root}\n password: ${MYSQL-PWD:root}\n url: jdbc:mysql://${MYSQL-HOST:pigx-mysql}:${MYSQL-PORT:3306}/${MYSQL-DB:pigxx_job}?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&allowPublicKeyRetrieval=true\n\nxxl:\n job:\n admin:\n addresses: http://${XXL-HOST:pigx-xxl}:${XXL-HOST:9080}/xxl-job-admin\n executor:\n port: 9988\n appName: test-xxl', '9ce58242d57b57f737dcb59a41ee6e55', '2019-04-18 02:12:57', '2019-10-04 11:22:56', NULL, '127.0.0.1', '', '', '定时任务-elastic-job配置', 'null', 'null', 'yaml', 'null'); INSERT INTO `config_info` VALUES (5, 'pigx-gateway-dev.yml', 'DEFAULT_GROUP', 'security:\n encode:\n key: \'pigxpigxpigxpigx\'\n\nignore:\n clients:\n - test\n swagger-providers:\n - pigx-auth\n - pigx-tx-manager\n\nribbon:\n rule:\n gray-enabled: true', '24403a5b205b1e9d320078e309584bbc', '2019-04-18 02:13:52', '2019-10-20 17:07:42', NULL, '127.0.0.1', '', '', '网关配置文件', 'null', 'null', 'yaml', 'null'); INSERT INTO `config_info` VALUES (6, 'pigx-monitor-dev.yml', 'DEFAULT_GROUP', 'spring:\n # 安全配置\n security:\n user:\n name: ENC(rZHA4LW5hHmhLAAzJoFNag==) # pigx\n password: ENC(bjeyh+Aeii3kHXkoo00ZUw==) # pigx\n boot:\n admin:\n ui:\n title: \'pigx 服务状态监控\'\n brand: \'pigx 服务状态监控\'\nmanagement:\n endpoints:\n web:\n exposure:\n include: \'*\'\n endpoint:\n health:\n show-details: ALWAYS #显示详细信息', '7925a0c734460526262319b6a189e39d', '2019-04-18 02:14:17', '2019-12-31 19:04:00', NULL, '172.17.0.157', '', '', '监控配置文件', 'null', 'null', 'yaml', 'null'); -INSERT INTO `config_info` VALUES (7, 'pigx-upms-biz-dev.yml', 'DEFAULT_GROUP', '## spring security 配置\nsecurity:\n oauth2:\n client:\n client-id: ENC(ltJPpR50wT0oIY9kfOe1Iw==)\n client-secret: ENC(ltJPpR50wT0oIY9kfOe1Iw==)\n scope: server\n ignore-urls:\n - /druid/**\n - /actuator/**\n - /v2/api-docs\n\n# 数据源\nspring:\n datasource:\n type: com.alibaba.druid.pool.DruidDataSource\n druid:\n driver-class-name: com.mysql.cj.jdbc.Driver\n username: ${MYSQL-USER:root}\n password: ${MYSQL-PWD:root}\n url: jdbc:mysql://${MYSQL-HOST:pigx-mysql}:${MYSQL-PORT:3306}/${MYSQL-DB:pigxx}?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&allowPublicKeyRetrieval=true\n stat-view-servlet:\n enabled: true\n url-pattern: /druid/*\n #login-username: admin\n #login-password: admin\n filter:\n stat:\n enabled: true\n log-slow-sql: true\n slow-sql-millis: 10000\n merge-sql: false\n wall:\n config:\n multi-statement-allow: true\n\n# 文件系统 (提供测试环境,不要乱传)\nminio:\n url: http://minio.pig4cloud.com\n access-key: lengleng\n secret-key: lengleng\n\n# Logger Config\nlogging:\n level:\n com.pig4cloud.pigx.admin.mapper: debug\n\n# 租户表维护\npigx:\n tenant:\n column: tenant_id\n tables:\n - sys_user\n - sys_role\n - sys_dept\n - sys_log\n - sys_social_details\n - sys_dict\n - sys_dict_item\n - sys_public_param\n - sys_log\n - sys_file', 'fab3a6b4cb292954d9841b22a41e3dab', '2019-04-18 02:32:44', '2019-11-01 12:22:38', NULL, '127.0.0.1', '', '', 'admin 服务配置', 'null', 'null', 'yaml', 'null'); +INSERT INTO `config_info` VALUES (7, 'pigx-upms-biz-dev.yml', 'DEFAULT_GROUP', '## spring security 配置\nsecurity:\n oauth2:\n client:\n client-id: ENC(ltJPpR50wT0oIY9kfOe1Iw==)\n client-secret: ENC(ltJPpR50wT0oIY9kfOe1Iw==)\n scope: server\n ignore-urls:\n - /druid/**\n - /actuator/**\n - /v2/api-docs\n\n# 数据源\nspring:\n datasource:\n type: com.alibaba.druid.pool.DruidDataSource\n druid:\n driver-class-name: com.mysql.cj.jdbc.Driver\n username: ${MYSQL-USER:root}\n password: ${MYSQL-PWD:root}\n url: jdbc:mysql://${MYSQL-HOST:pigx-mysql}:${MYSQL-PORT:3306}/${MYSQL-DB:pigxx}?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&allowPublicKeyRetrieval=true\n stat-view-servlet:\n enabled: true\n url-pattern: /druid/*\n #login-username: admin\n #login-password: admin\n filter:\n stat:\n enabled: true\n log-slow-sql: true\n slow-sql-millis: 10000\n merge-sql: false\n wall:\n config:\n multi-statement-allow: true\n\n# 文件系统 (提供测试环境,不要乱传)\nminio:\n url: http://minio.pig4cloud.com\n access-key: lengleng\n secret-key: lengleng\n\n# Logger Config\nlogging:\n level:\n com.pig4cloud.pigx.admin.mapper: debug\n\n# 租户表维护\npigx:\n tenant:\n column: tenant_id\n tables:\n - sys_user\n - sys_role\n - sys_menu\n - sys_dept\n - sys_log\n - sys_social_details\n - sys_dict\n - sys_dict_item\n - sys_public_param\n - sys_log\n - sys_file', 'fab3a6b4cb292954d9841b22a41e3dab', '2019-04-18 02:32:44', '2019-11-01 12:22:38', NULL, '127.0.0.1', '', '', 'admin 服务配置', 'null', 'null', 'yaml', 'null'); INSERT INTO `config_info` VALUES (8, 'pigx-tx-manager-dev.yml', 'DEFAULT_GROUP', '# 页面配置\nspring:\n mvc:\n static-path-pattern: /**\n resources:\n static-locations: classpath:/static/\n\n\n# LCN 配置\ntm:\n transaction:\n netty:\n delaytime: 5 # 客户端链接最大通讯时间 (秒)\n hearttime: 15 # 客户端心跳时间 (秒)\n redis:\n savemaxtime: 30 # redis 保存时间 (秒)\n socket:\n port: 9998 # 通讯端口\n maxconnection: 1000 #最大链接数\n compensate:\n auto: false #是否自动补偿\n notifyUrl: http://ip:port/path #补偿结果通知(配消息总线里面)\n tryTime: 30 # z再次重试时间间隔\n maxWaitTime: 5000 # 请求超时的最大时间 (毫秒)', '885f5c125f2df7a08692929ccce154be', '2019-04-18 02:54:03', '2019-04-18 02:54:03', NULL, '127.0.0.1', '', '', '分布式事务协调模块', NULL, NULL, 'yaml', NULL); INSERT INTO `config_info` VALUES (9, 'pigx-daemon-quartz-dev.yml', 'DEFAULT_GROUP', '## spring security 配置\nsecurity:\n oauth2:\n client:\n client-id: ENC(tz2NM4GcmnE7sNJTYL8ZSg==)\n client-secret: ENC(tz2NM4GcmnE7sNJTYL8ZSg==)\n scope: server\n\n# 数据源\nspring:\n datasource:\n type: com.alibaba.druid.pool.DruidDataSource\n druid:\n driver-class-name: com.mysql.cj.jdbc.Driver\n username: ${MYSQL-USER:root}\n password: ${MYSQL-PWD:root}\n url: jdbc:mysql://${MYSQL-HOST:pigx-mysql}:${MYSQL-PORT:3306}/${MYSQL-DB:pigxx_job}?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&allowPublicKeyRetrieval=true\n resources:\n static-locations: classpath:/static/,classpath:/views/\n quartz:\n #相关属性配置\n properties:\n org:\n quartz:\n scheduler:\n instanceName: clusteredScheduler\n instanceId: AUTO\n jobStore:\n class: org.quartz.impl.jdbcjobstore.JobStoreTX\n driverDelegateClass: org.quartz.impl.jdbcjobstore.StdJDBCDelegate\n tablePrefix: QRTZ_\n isClustered: true\n clusterCheckinInterval: 10000\n useProperties: false\n threadPool:\n class: org.quartz.simpl.SimpleThreadPool\n threadCount: 50\n threadPriority: 5\n threadsInheritContextClassLoaderOfInitializingThread: true\n #数据库方式\n job-store-type: jdbc\n #初始化表结构\n #jdbc:\n #initialize-schema: never\n\n', '276cf549fb8b084e35dc07d1eb309932', '2019-04-18 03:08:34', '2019-08-27 18:25:41', NULL, '127.0.0.1', '', '', 'quartz 配置文件', 'null', 'null', 'yaml', 'null'); INSERT INTO `config_info` VALUES (10, 'pigx-pay-platform-dev.yml', 'DEFAULT_GROUP', '## spring security 配置\nsecurity:\n oauth2:\n client:\n client-id: ENC(gPFcUOmJm8WqM3k3eSqS0Q==)\n client-secret: ENC(gPFcUOmJm8WqM3k3eSqS0Q==)\n scope: server\n# 数据源\nspring:\n datasource:\n type: com.alibaba.druid.pool.DruidDataSource\n druid:\n driver-class-name: com.mysql.cj.jdbc.Driver\n username: ${MYSQL-USER:root}\n password: ${MYSQL-PWD:root}\n url: jdbc:mysql://${MYSQL-HOST:pigx-mysql}:${MYSQL-PORT:3306}/${MYSQL-DB:pigxx_pay}?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&allowPublicKeyRetrieval=true\n\n# 租户表维护\npigx:\n pay:\n test: lengleng\n aliPayConfig:\n expire-time: 30\n return-url: http://pig4cloud.com\n notify-url: https://admin.pig4cloud.com/pay/notify/ali/callbak\n wxPayConfig:\n notify-url: https://admin.pig4cloud.com/pay/notify/wx/callbak\n xsequence: #发号器相关配置\n db:\n retry-times: 3\n table-name: pay_sequence\n tenant:\n column: tenant_id\n tables:\n - pay_channel\n - pay_trade_order\n - pay_goods_order\n - pay_notify_record', 'bf185a74bb9af224bfe7f8f52ae3c9cb', '2019-05-28 11:46:27', '2019-08-27 18:26:01', NULL, '127.0.0.1', '', '', '支付模块配置', 'null', 'null', 'yaml', 'null'); diff --git a/docker-compose.yml b/docker-compose.yml index b5c30ab12..7c2beeb21 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -19,11 +19,6 @@ services: - ./pigx-mysql:/var/lib/mysql command: --lower_case_table_names=1 - pigx-zookeeper: - container_name: pigx-zookeeper - image: zookeeper:3.4.13 - restart: always - pigx-xxl: container_name: pigx-xxl image: pig4cloud/xxl-job-admin:2.1.1 diff --git a/pigx-common/pigx-common-job/pom.xml b/pigx-common/pigx-common-job/pom.xml index 9c5c813ce..c788784af 100644 --- a/pigx-common/pigx-common-job/pom.xml +++ b/pigx-common/pigx-common-job/pom.xml @@ -33,24 +33,6 @@ pigx 定时任务 - - - com.dangdang - elastic-job-lite-core - ${elastic-job-lite.version} - - - com.zaxxer - HikariCP-java7 - - - - - - com.dangdang - elastic-job-lite-spring - ${elastic-job-lite.version} - com.xuxueli diff --git a/pigx-common/pigx-common-job/src/main/java/com/pig4cloud/pigx/common/job/ElasticJobAutoConfiguration.java b/pigx-common/pigx-common-job/src/main/java/com/pig4cloud/pigx/common/job/ElasticJobAutoConfiguration.java deleted file mode 100755 index 97afd9bb7..000000000 --- a/pigx-common/pigx-common-job/src/main/java/com/pig4cloud/pigx/common/job/ElasticJobAutoConfiguration.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2018-2025, lengleng All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * Neither the name of the pig4cloud.com developer nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * Author: lengleng (wangiegie@gmail.com) - */ - -package com.pig4cloud.pigx.common.job; - -import com.dangdang.ddframe.job.reg.zookeeper.ZookeeperConfiguration; -import com.dangdang.ddframe.job.reg.zookeeper.ZookeeperRegistryCenter; -import com.pig4cloud.pigx.common.job.jobinit.DataflowJobInitialization; -import com.pig4cloud.pigx.common.job.jobinit.ScriptJobInitialization; -import com.pig4cloud.pigx.common.job.jobinit.SimpleJobInitialization; -import com.pig4cloud.pigx.common.job.properties.ElasticJobProperties; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.autoconfigure.EnableAutoConfiguration; -import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; -import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; -import org.springframework.boot.context.properties.EnableConfigurationProperties; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - - -/** - * @author lengleng - * @date 2018/7/24 - * 任务初配置入口类 - */ -@Configuration -@EnableAutoConfiguration -@EnableConfigurationProperties(ElasticJobProperties.class) -public class ElasticJobAutoConfiguration { - - /** - * 默认注册中心 - */ - public static final String DEFAULT_REGISTRY_CENTER_NAME = "elasticJobRegistryCenter"; - - @Autowired - private ElasticJobProperties elasticJobProperties; - - @Bean(name = DEFAULT_REGISTRY_CENTER_NAME, initMethod = "init") - @ConditionalOnMissingBean - public ZookeeperRegistryCenter elasticJobRegistryCenter() { - ElasticJobProperties.ZkConfiguration regCenterProperties = elasticJobProperties.getZookeeper(); - ZookeeperConfiguration zookeeperConfiguration = new ZookeeperConfiguration(regCenterProperties.getServerLists(), regCenterProperties.getNamespace()); - zookeeperConfiguration.setBaseSleepTimeMilliseconds(regCenterProperties.getBaseSleepTimeMilliseconds()); - zookeeperConfiguration.setConnectionTimeoutMilliseconds(regCenterProperties.getConnectionTimeoutMilliseconds()); - zookeeperConfiguration.setMaxSleepTimeMilliseconds(regCenterProperties.getMaxSleepTimeMilliseconds()); - zookeeperConfiguration.setSessionTimeoutMilliseconds(regCenterProperties.getSessionTimeoutMilliseconds()); - zookeeperConfiguration.setMaxRetries(regCenterProperties.getMaxRetries()); - zookeeperConfiguration.setDigest(regCenterProperties.getDigest()); - return new ZookeeperRegistryCenter(zookeeperConfiguration); - } - - @Bean(initMethod = "init") - @ConditionalOnMissingBean - @ConditionalOnBean(ZookeeperRegistryCenter.class) - public SimpleJobInitialization simpleJobInitialization() { - return new SimpleJobInitialization(elasticJobProperties.getSimples()); - } - - @Bean(initMethod = "init") - @ConditionalOnMissingBean - @ConditionalOnBean(ZookeeperRegistryCenter.class) - public DataflowJobInitialization dataflowJobInitialization() { - return new DataflowJobInitialization(elasticJobProperties.getDataflows()); - } - - @Bean(initMethod = "init") - @ConditionalOnMissingBean - @ConditionalOnBean(ZookeeperRegistryCenter.class) - public ScriptJobInitialization scriptJobInitialization() { - return new ScriptJobInitialization(elasticJobProperties.getScripts()); - } -} diff --git a/pigx-common/pigx-common-job/src/main/java/com/pig4cloud/pigx/common/job/annotation/EnablePigxElasticJob.java b/pigx-common/pigx-common-job/src/main/java/com/pig4cloud/pigx/common/job/annotation/EnablePigxElasticJob.java deleted file mode 100644 index bd1d92460..000000000 --- a/pigx-common/pigx-common-job/src/main/java/com/pig4cloud/pigx/common/job/annotation/EnablePigxElasticJob.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2018-2025, lengleng All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * Neither the name of the pig4cloud.com developer nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * Author: lengleng (wangiegie@gmail.com) - */ - -package com.pig4cloud.pigx.common.job.annotation; - -import com.pig4cloud.pigx.common.job.ElasticJobAutoConfiguration; -import org.springframework.context.annotation.Import; - -import java.lang.annotation.*; - -/** - * @author lengleng - * @date 2018/7/24 - * 开启pigx elastic job - */ -@Target({ElementType.TYPE}) -@Retention(RetentionPolicy.RUNTIME) -@Documented -@Inherited -@Import({ElasticJobAutoConfiguration.class}) -public @interface EnablePigxElasticJob { -} diff --git a/pigx-common/pigx-common-job/src/main/java/com/pig4cloud/pigx/common/job/jobinit/AbstractJobInitialization.java b/pigx-common/pigx-common-job/src/main/java/com/pig4cloud/pigx/common/job/jobinit/AbstractJobInitialization.java deleted file mode 100755 index b9b81b5d8..000000000 --- a/pigx-common/pigx-common-job/src/main/java/com/pig4cloud/pigx/common/job/jobinit/AbstractJobInitialization.java +++ /dev/null @@ -1,286 +0,0 @@ -/* - * Copyright (c) 2018-2025, lengleng All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * Neither the name of the pig4cloud.com developer nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * Author: lengleng (wangiegie@gmail.com) - */ - -package com.pig4cloud.pigx.common.job.jobinit; - -import com.dangdang.ddframe.job.api.ElasticJob; -import com.dangdang.ddframe.job.api.JobType; -import com.dangdang.ddframe.job.api.dataflow.DataflowJob; -import com.dangdang.ddframe.job.api.simple.SimpleJob; -import com.dangdang.ddframe.job.config.JobCoreConfiguration; -import com.dangdang.ddframe.job.config.JobTypeConfiguration; -import com.dangdang.ddframe.job.event.rdb.JobEventRdbConfiguration; -import com.dangdang.ddframe.job.executor.handler.JobProperties.JobPropertiesEnum; -import com.dangdang.ddframe.job.lite.api.listener.AbstractDistributeOnceElasticJobListener; -import com.dangdang.ddframe.job.lite.api.listener.ElasticJobListener; -import com.dangdang.ddframe.job.lite.config.LiteJobConfiguration; -import com.dangdang.ddframe.job.lite.spring.api.SpringJobScheduler; -import com.dangdang.ddframe.job.reg.zookeeper.ZookeeperRegistryCenter; -import com.pig4cloud.pigx.common.job.properties.ElasticJobProperties; -import lombok.SneakyThrows; -import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.factory.config.BeanDefinition; -import org.springframework.beans.factory.support.BeanDefinitionBuilder; -import org.springframework.beans.factory.support.DefaultListableBeanFactory; -import org.springframework.context.ApplicationContext; -import org.springframework.context.ApplicationContextAware; -import org.springframework.context.ConfigurableApplicationContext; -import org.springframework.util.CollectionUtils; - -import javax.sql.DataSource; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -import static com.pig4cloud.pigx.common.job.ElasticJobAutoConfiguration.DEFAULT_REGISTRY_CENTER_NAME; - - -/** - * @author lengleng - * @date 2018/7/24 - * 任务初始化基类 - */ -public abstract class AbstractJobInitialization implements ApplicationContextAware { - - protected ApplicationContext applicationContext; - - @Override - @SneakyThrows - public void setApplicationContext(ApplicationContext applicationContext) { - this.applicationContext = applicationContext; - } - - /** - * 初始化任务 - * - * @param jobName 任务名称 - * @param jobType 任务类型 - * @param configuration 配置 - */ - protected void initJob(String jobName, JobType jobType, ElasticJobProperties.JobConfiguration configuration) { - //向spring容器中注册作业任务 - ElasticJob elasticJob = registerElasticJob(jobName, configuration.getJobClass(), jobType); - //获取注册中心 - ZookeeperRegistryCenter regCenter = getZookeeperRegistryCenter(configuration.getRegistryCenterRef()); - //构建核心配置 - JobCoreConfiguration jobCoreConfiguration = getJobCoreConfiguration(jobName, configuration); - //获取作业类型配置 - JobTypeConfiguration jobTypeConfiguration = getJobTypeConfiguration(jobName, jobCoreConfiguration); - //获取Lite作业配置 - LiteJobConfiguration liteJobConfiguration = getLiteJobConfiguration(jobTypeConfiguration, configuration); - //获取作业事件追踪的数据源配置 - JobEventRdbConfiguration jobEventRdbConfiguration = getJobEventRdbConfiguration(configuration.getEventTraceRdbDataSource()); - //获取作业监听器 - ElasticJobListener[] elasticJobListeners = creatElasticJobListeners(configuration.getListener()); - elasticJobListeners = null == elasticJobListeners ? new ElasticJobListener[0] : elasticJobListeners; - //注册作业 - if (null == jobEventRdbConfiguration) { - new SpringJobScheduler(elasticJob, regCenter, liteJobConfiguration, elasticJobListeners).init(); - } else { - new SpringJobScheduler(elasticJob, regCenter, liteJobConfiguration, jobEventRdbConfiguration, elasticJobListeners).init(); - } - } - - /** - * 获取作业类型配置 - * - * @param jobName 任务名称 - * @param jobCoreConfiguration 任务核心配置 - * @return JobTypeConfiguration - */ - public abstract JobTypeConfiguration getJobTypeConfiguration(String jobName, JobCoreConfiguration jobCoreConfiguration); - - /** - * 获取作业任务实例 - * - * @param jobName 任务名称 - * @param jobType 任务类型 - * @param strClass 任务类全路径 - * @return ElasticJob - */ - private ElasticJob registerElasticJob(String jobName, String strClass, JobType jobType) { - switch (jobType) { - case SIMPLE: - return registerBean(jobName, strClass, SimpleJob.class); - case DATAFLOW: - return registerBean(jobName, strClass, DataflowJob.class); - default: - return null; - } - } - - /** - * 获取注册中心 - * - * @param registryCenterRef 注册中心引用 - * @return ZookeeperRegistryCenter - */ - private ZookeeperRegistryCenter getZookeeperRegistryCenter(String registryCenterRef) { - if (StringUtils.isBlank(registryCenterRef)) { - registryCenterRef = DEFAULT_REGISTRY_CENTER_NAME; - } - if (!applicationContext.containsBean(registryCenterRef)) { - throw new RuntimeException("not exist ZookeeperRegistryCenter [" + registryCenterRef + "] !"); - } - return applicationContext.getBean(registryCenterRef, ZookeeperRegistryCenter.class); - } - - /** - * 获取作业事件追踪的数据源配置 - * - * @param eventTraceRdbDataSource 作业事件追踪的数据源Bean引用 - * @return JobEventRdbConfiguration - */ - private JobEventRdbConfiguration getJobEventRdbConfiguration(String eventTraceRdbDataSource) { - if (StringUtils.isBlank(eventTraceRdbDataSource)) { - return null; - } - if (!applicationContext.containsBean(eventTraceRdbDataSource)) { - throw new RuntimeException("not exist datasource [" + eventTraceRdbDataSource + "] !"); - } - DataSource dataSource = (DataSource) applicationContext.getBean(eventTraceRdbDataSource); - return new JobEventRdbConfiguration(dataSource); - } - - - /** - * 构建Lite作业 - * - * @param jobTypeConfiguration 任务类型 - * @param jobConfiguration 任务配置 - * @return LiteJobConfiguration - */ - private LiteJobConfiguration getLiteJobConfiguration(JobTypeConfiguration jobTypeConfiguration, ElasticJobProperties.JobConfiguration jobConfiguration) { - //构建Lite作业 - return LiteJobConfiguration.newBuilder(Objects.requireNonNull(jobTypeConfiguration)) - .monitorExecution(jobConfiguration.isMonitorExecution()) - .monitorPort(jobConfiguration.getMonitorPort()) - .maxTimeDiffSeconds(jobConfiguration.getMaxTimeDiffSeconds()) - .jobShardingStrategyClass(jobConfiguration.getJobShardingStrategyClass()) - .reconcileIntervalMinutes(jobConfiguration.getReconcileIntervalMinutes()) - .disabled(jobConfiguration.isDisabled()) - .overwrite(jobConfiguration.isOverwrite()).build(); - } - - /** - * 构建任务核心配置 - * - * @param jobName 任务执行名称 - * @param jobConfiguration 任务配置 - * @return JobCoreConfiguration - */ - protected JobCoreConfiguration getJobCoreConfiguration(String jobName, ElasticJobProperties.JobConfiguration jobConfiguration) { - JobCoreConfiguration.Builder builder = JobCoreConfiguration.newBuilder(jobName, jobConfiguration.getCron(), jobConfiguration.getShardingTotalCount()) - .shardingItemParameters(jobConfiguration.getShardingItemParameters()) - .jobParameter(jobConfiguration.getJobParameter()) - .failover(jobConfiguration.isFailover()) - .misfire(jobConfiguration.isMisfire()) - .description(jobConfiguration.getDescription()); - if (StringUtils.isNotBlank(jobConfiguration.getJobExceptionHandler())) { - builder.jobProperties(JobPropertiesEnum.JOB_EXCEPTION_HANDLER.getKey(), jobConfiguration.getJobExceptionHandler()); - } - if (StringUtils.isNotBlank(jobConfiguration.getExecutorServiceHandler())) { - builder.jobProperties(JobPropertiesEnum.EXECUTOR_SERVICE_HANDLER.getKey(), jobConfiguration.getExecutorServiceHandler()); - } - return builder.build(); - } - - /** - * 获取监听器 - * - * @param listener 监听器配置 - * @return ElasticJobListener[] - */ - private ElasticJobListener[] creatElasticJobListeners(ElasticJobProperties.JobConfiguration.Listener listener) { - - if (null == listener) { - return null; - } - - List elasticJobListeners = new ArrayList<>(2); - - //注册每台作业节点均执行的监听 - ElasticJobListener elasticJobListener = registerBean(listener.getListenerClass(), listener.getListenerClass(), ElasticJobListener.class); - if (null != elasticJobListener) { - elasticJobListeners.add(elasticJobListener); - } - - //注册分布式监听者 - AbstractDistributeOnceElasticJobListener distributedListener = registerBean(listener.getDistributedListenerClass(), listener.getDistributedListenerClass(), - AbstractDistributeOnceElasticJobListener.class, listener.getStartedTimeoutMilliseconds(), listener.getCompletedTimeoutMilliseconds()); - if (null != distributedListener) { - elasticJobListeners.add(distributedListener); - } - - if (CollectionUtils.isEmpty(elasticJobListeners)) { - return null; - } - - //集合转数组 - ElasticJobListener[] elasticJobListenerArray = new ElasticJobListener[elasticJobListeners.size()]; - for (int i = 0; i < elasticJobListeners.size(); i++) { - elasticJobListenerArray[i] = elasticJobListeners.get(i); - } - return elasticJobListenerArray; - } - - /** - * 向spring容器中注册bean - * - * @param beanName bean名字 - * @param strClass 类全路径 - * @param tClass 类类型 - * @param constructorArgValue 构造函数参数 - * @param 泛型 - * @return T - */ - protected T registerBean(String beanName, String strClass, Class tClass, Object... constructorArgValue) { - - //判断是否配置了监听者 - if (StringUtils.isBlank(strClass)) { - return null; - } - - if (StringUtils.isBlank(beanName)) { - beanName = strClass; - } - - //判断监听者是否已经在spring容器中存在 - if (applicationContext.containsBean(beanName)) { - return applicationContext.getBean(beanName, tClass); - } - - //不存在则创建并注册到Spring容器中 - BeanDefinitionBuilder beanDefinitionBuilder = BeanDefinitionBuilder.rootBeanDefinition(strClass); - beanDefinitionBuilder.setScope(BeanDefinition.SCOPE_PROTOTYPE); - //设置参数 - for (Object argValue : constructorArgValue) { - beanDefinitionBuilder.addConstructorArgValue(argValue); - } - getDefaultListableBeanFactory().registerBeanDefinition(beanName, beanDefinitionBuilder.getBeanDefinition()); - return applicationContext.getBean(beanName, tClass); - } - - /** - * 获取beanFactory - * - * @return DefaultListableBeanFactory - */ - private DefaultListableBeanFactory getDefaultListableBeanFactory() { - return (DefaultListableBeanFactory) ((ConfigurableApplicationContext) applicationContext).getBeanFactory(); - } -} diff --git a/pigx-common/pigx-common-job/src/main/java/com/pig4cloud/pigx/common/job/jobinit/DataflowJobInitialization.java b/pigx-common/pigx-common-job/src/main/java/com/pig4cloud/pigx/common/job/jobinit/DataflowJobInitialization.java deleted file mode 100755 index 66af592bb..000000000 --- a/pigx-common/pigx-common-job/src/main/java/com/pig4cloud/pigx/common/job/jobinit/DataflowJobInitialization.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2018-2025, lengleng All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * Neither the name of the pig4cloud.com developer nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * Author: lengleng (wangiegie@gmail.com) - */ - -package com.pig4cloud.pigx.common.job.jobinit; - -import com.dangdang.ddframe.job.config.JobCoreConfiguration; -import com.dangdang.ddframe.job.config.JobTypeConfiguration; -import com.dangdang.ddframe.job.config.dataflow.DataflowJobConfiguration; -import com.pig4cloud.pigx.common.job.properties.ElasticJobProperties; - -import java.util.Map; - - -/** - * @author lengleng - * @date 2018/7/24 - * 流式任务初始 - */ -public class DataflowJobInitialization extends AbstractJobInitialization { - - private Map dataflowConfigurationMap; - - public DataflowJobInitialization(final Map dataflowConfigurationMap) { - this.dataflowConfigurationMap = dataflowConfigurationMap; - } - - public void init() { - for (String jobName : dataflowConfigurationMap.keySet()) { - ElasticJobProperties.DataflowConfiguration configuration = dataflowConfigurationMap.get(jobName); - initJob(jobName, configuration.getJobType(), configuration); - } - } - - @Override - public JobTypeConfiguration getJobTypeConfiguration(String jobName, JobCoreConfiguration jobCoreConfiguration) { - ElasticJobProperties.DataflowConfiguration configuration = dataflowConfigurationMap.get(jobName); - return new DataflowJobConfiguration(jobCoreConfiguration, configuration.getJobClass(), configuration.isStreamingProcess()); - } -} diff --git a/pigx-common/pigx-common-job/src/main/java/com/pig4cloud/pigx/common/job/jobinit/ScriptJobInitialization.java b/pigx-common/pigx-common-job/src/main/java/com/pig4cloud/pigx/common/job/jobinit/ScriptJobInitialization.java deleted file mode 100755 index c7cbd5890..000000000 --- a/pigx-common/pigx-common-job/src/main/java/com/pig4cloud/pigx/common/job/jobinit/ScriptJobInitialization.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2018-2025, lengleng All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * Neither the name of the pig4cloud.com developer nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * Author: lengleng (wangiegie@gmail.com) - */ - -package com.pig4cloud.pigx.common.job.jobinit; - -import com.dangdang.ddframe.job.config.JobCoreConfiguration; -import com.dangdang.ddframe.job.config.JobTypeConfiguration; -import com.dangdang.ddframe.job.config.script.ScriptJobConfiguration; -import com.pig4cloud.pigx.common.job.properties.ElasticJobProperties; - -import java.util.Map; - - -/** - * @author lengleng - * @date 2018/7/24 - * 脚本任务初始 - */ -public class ScriptJobInitialization extends AbstractJobInitialization { - - private Map scriptConfigurationMap; - - public ScriptJobInitialization(final Map scriptConfigurationMap) { - this.scriptConfigurationMap = scriptConfigurationMap; - } - - public void init() { - for (String jobName : scriptConfigurationMap.keySet()) { - ElasticJobProperties.ScriptConfiguration configuration = scriptConfigurationMap.get(jobName); - initJob(jobName, configuration.getJobType(), configuration); - } - } - - @Override - public JobTypeConfiguration getJobTypeConfiguration(String jobName, JobCoreConfiguration jobCoreConfiguration) { - ElasticJobProperties.ScriptConfiguration configuration = scriptConfigurationMap.get(jobName); - return new ScriptJobConfiguration(jobCoreConfiguration, configuration.getScriptCommandLine()); - } -} diff --git a/pigx-common/pigx-common-job/src/main/java/com/pig4cloud/pigx/common/job/jobinit/SimpleJobInitialization.java b/pigx-common/pigx-common-job/src/main/java/com/pig4cloud/pigx/common/job/jobinit/SimpleJobInitialization.java deleted file mode 100755 index fbbead7cb..000000000 --- a/pigx-common/pigx-common-job/src/main/java/com/pig4cloud/pigx/common/job/jobinit/SimpleJobInitialization.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2018-2025, lengleng All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * Neither the name of the pig4cloud.com developer nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * Author: lengleng (wangiegie@gmail.com) - */ - -package com.pig4cloud.pigx.common.job.jobinit; - -import com.dangdang.ddframe.job.config.JobCoreConfiguration; -import com.dangdang.ddframe.job.config.JobTypeConfiguration; -import com.dangdang.ddframe.job.config.simple.SimpleJobConfiguration; -import com.pig4cloud.pigx.common.job.properties.ElasticJobProperties; - -import java.util.Map; - - -/** - * @author lengleng - * @date 2018/7/24 - * 简单任务初始 - */ -public class SimpleJobInitialization extends AbstractJobInitialization { - - private Map simpleConfigurationMap; - - public SimpleJobInitialization(final Map simpleConfigurationMap) { - this.simpleConfigurationMap = simpleConfigurationMap; - } - - public void init() { - for (String jobName : simpleConfigurationMap.keySet()) { - ElasticJobProperties.SimpleConfiguration configuration = simpleConfigurationMap.get(jobName); - initJob(jobName, configuration.getJobType(), configuration); - } - } - - @Override - public JobTypeConfiguration getJobTypeConfiguration(String jobName, JobCoreConfiguration jobCoreConfiguration) { - ElasticJobProperties.SimpleConfiguration configuration = simpleConfigurationMap.get(jobName); - return new SimpleJobConfiguration(jobCoreConfiguration, configuration.getJobClass()); - } -} diff --git a/pigx-common/pigx-common-job/src/main/java/com/pig4cloud/pigx/common/job/properties/ElasticJobProperties.java b/pigx-common/pigx-common-job/src/main/java/com/pig4cloud/pigx/common/job/properties/ElasticJobProperties.java deleted file mode 100755 index 7dbbab4d7..000000000 --- a/pigx-common/pigx-common-job/src/main/java/com/pig4cloud/pigx/common/job/properties/ElasticJobProperties.java +++ /dev/null @@ -1,293 +0,0 @@ -/* - * Copyright (c) 2018-2025, lengleng All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * Neither the name of the pig4cloud.com developer nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * Author: lengleng (wangiegie@gmail.com) - */ - -package com.pig4cloud.pigx.common.job.properties; - -import com.dangdang.ddframe.job.api.JobType; -import lombok.Getter; -import lombok.Setter; -import org.springframework.boot.context.properties.ConfigurationProperties; - -import java.util.LinkedHashMap; -import java.util.Map; - -import static com.pig4cloud.pigx.common.job.ElasticJobAutoConfiguration.DEFAULT_REGISTRY_CENTER_NAME; - - -/** - * @author lengleng - * @date 2018/7/24 - * 任务配置类 - */ -@Getter -@Setter -@ConfigurationProperties(prefix = "spring.elasticjob") -public class ElasticJobProperties { - - /** - * 注册中心 - */ - private ZkConfiguration zookeeper; - - /** - * 简单作业配置 - */ - private Map simples = new LinkedHashMap<>(); - - /** - * 流式作业配置 - */ - private Map dataflows = new LinkedHashMap<>(); - - /** - * 脚本作业配置 - */ - private Map scripts = new LinkedHashMap<>(); - - @Getter - @Setter - public static class ZkConfiguration { - - /** - * 连接Zookeeper服务器的列表 - * 包括IP地址和端口号 - * 多个地址用逗号分隔 - * 如: host1:2181,host2:2181 - */ - private String serverLists; - - /** - * Zookeeper的命名空间 - */ - private String namespace; - - /** - * 等待重试的间隔时间的初始值 - * 单位:毫秒 - */ - private int baseSleepTimeMilliseconds = 1000; - - /** - * 等待重试的间隔时间的最大值 - * 单位:毫秒 - */ - private int maxSleepTimeMilliseconds = 3000; - - /** - * 最大重试次数 - */ - private int maxRetries = 3; - - /** - * 连接超时时间 - * 单位:毫秒 - */ - private int connectionTimeoutMilliseconds = 15000; - - /** - * 会话超时时间 - * 单位:毫秒 - */ - private int sessionTimeoutMilliseconds = 60000; - - /** - * 连接Zookeeper的权限令牌 - * 缺省为不需要权限验 - */ - private String digest; - - } - - @Getter - @Setter - public static class SimpleConfiguration extends JobConfiguration { - /** - * 作业类型 - */ - private final JobType jobType = JobType.SIMPLE; - } - - @Getter - @Setter - public static class DataflowConfiguration extends JobConfiguration { - /** - * 作业类型 - */ - private final JobType jobType = JobType.DATAFLOW; - /** - * 是否流式处理数据 - * 如果流式处理数据, 则fetchData不返回空结果将持续执行作业 - * 如果非流式处理数据, 则处理数据完成后作业结束 - */ - private boolean streamingProcess = false; - } - - @Getter - @Setter - public static class ScriptConfiguration extends JobConfiguration { - /** - * 作业类型 - */ - private final JobType jobType = JobType.SCRIPT; - /** - * 脚本型作业执行命令行 - */ - private String scriptCommandLine; - } - - @Getter - @Setter - public static class JobConfiguration { - - /** - * 作业实现类,需实现ElasticJob接口 - */ - private String jobClass; - /** - * 注册中心Bean的引用,需引用reg:zookeeper的声明 - */ - private String registryCenterRef = DEFAULT_REGISTRY_CENTER_NAME; - /** - * cron表达式,用于控制作业触发时间 - */ - private String cron; - /** - * 作业分片总数 - */ - private int shardingTotalCount = 1; - /** - * 分片序列号和参数用等号分隔,多个键值对用逗号分隔 - * 分片序列号从0开始,不可大于或等于作业分片总数 - * 如:0=a,1=b,2=c - */ - private String shardingItemParameters = "0=A"; - /** - * 作业实例主键,同IP可运行实例主键不同, 但名称相同的多个作业实例 - */ - private String jobInstanceId; - /** - * 作业自定义参数 - * 作业自定义参数,可通过传递该参数为作业调度的业务方法传参,用于实现带参数的作业 - * 例:每次获取的数据量、作业实例从数据库读取的主键等 - */ - private String jobParameter; - /** - * 监控作业运行时状态 - * 每次作业执行时间和间隔时间均非常短的情况,建议不监控作业运行时状态以提升效率。 - * 因为是瞬时状态,所以无必要监控。请用户自行增加数据堆积监控。并且不能保证数据重复选取,应在作业中实现幂等性。 - * 每次作业执行时间和间隔时间均较长的情况,建议监控作业运行时状态,可保证数据不会重复选取。 - */ - private boolean monitorExecution = true; - /** - * 作业监控端口 - * 建议配置作业监控端口, 方便开发者dump作业信息。 - * 使用方法: echo “dump” | nc 127.0.0.1 9888 - */ - private int monitorPort = -1; - /** - * 最大允许的本机与注册中心的时间误差秒数 - * 如果时间误差超过配置秒数则作业启动时将抛异常 - * 配置为-1表示不校验时间误差 - */ - private int maxTimeDiffSeconds = -1; - /** - * 是否开启失效转移 - */ - private boolean failover = false; - /** - * 是否开启错过任务重新执行 - */ - private boolean misfire = true; - /** - * 作业分片策略实现类全路径 - * 默认使用平均分配策略 - * 详情参见:作业分片策略http://elasticjob.io/docs/elastic-job-lite/02-guide/job-sharding-strategy - */ - private String jobShardingStrategyClass; - /** - * 作业描述信息 - */ - private String description; - /** - * 作业是否禁止启动 - * 可用于部署作业时,先禁止启动,部署结束后统一启动 - */ - private boolean disabled = false; - /** - * 本地配置是否可覆盖注册中心配置 - * 如果可覆盖,每次启动作业都以本地配置为准 - */ - private boolean overwrite = true; - /** - * 扩展异常处理类 - */ - private String jobExceptionHandler; - /** - * 扩展作业处理线程池类 - */ - private String executorServiceHandler; - /** - * 修复作业服务器不一致状态服务调度间隔时间,配置为小于1的任意值表示不执行修复 - * 单位:分钟 - */ - private int reconcileIntervalMinutes = 10; - /** - * 作业事件追踪的数据源Bean引用 - */ - private String eventTraceRdbDataSource; - - /** - * 监听器 - */ - private Listener listener; - - @Getter - @Setter - public static class Listener { - /** - * 每台作业节点均执行的监听 - * 若作业处理作业服务器的文件,处理完成后删除文件,可考虑使用每个节点均执行清理任务。 - * 此类型任务实现简单,且无需考虑全局分布式任务是否完成,请尽量使用此类型监听器。 - * - *

注意:类必须继承com.dangdang.ddframe.job.lite.api.listener.ElasticJobListener

- */ - String listenerClass; - - /** - * 分布式场景中仅单一节点执行的监听 - * 若作业处理数据库数据,处理完成后只需一个节点完成数据清理任务即可。 - * 此类型任务处理复杂,需同步分布式环境下作业的状态同步,提供了超时设置来避免作业不同步导致的死锁,请谨慎使用。 - * - *

注意:类必须继承com.dangdang.ddframe.job.lite.api.listener.AbstractDistributeOnceElasticJobListener

- */ - String distributedListenerClass; - - /** - * 最后一个作业执行前的执行方法的超时时间 - * 单位:毫秒 - */ - Long startedTimeoutMilliseconds = Long.MAX_VALUE; - - /** - * 最后一个作业执行后的执行方法的超时时间 - * 单位:毫秒 - */ - Long completedTimeoutMilliseconds = Long.MAX_VALUE; - } - } - -} diff --git a/pigx-visual/pigx-daemon-elastic-job/pom.xml b/pigx-visual/pigx-daemon-elastic-job/pom.xml index 99f2b828b..3c7a80849 100644 --- a/pigx-visual/pigx-daemon-elastic-job/pom.xml +++ b/pigx-visual/pigx-daemon-elastic-job/pom.xml @@ -29,7 +29,7 @@ pigx-daemon-elastic-job jar - 基于elastic-job后台跑批定时任务模块 + 基于xxl-job后台跑批定时任务模块 diff --git a/pigx-visual/pigx-daemon-elastic-job/src/main/java/com/pig4cloud/pigx/daemon/elastic/controller/ExecutionLogController.java b/pigx-visual/pigx-daemon-elastic-job/src/main/java/com/pig4cloud/pigx/daemon/elastic/controller/ExecutionLogController.java deleted file mode 100644 index 9d0278bd6..000000000 --- a/pigx-visual/pigx-daemon-elastic-job/src/main/java/com/pig4cloud/pigx/daemon/elastic/controller/ExecutionLogController.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (c) 2018-2025, lengleng All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * Neither the name of the pig4cloud.com developer nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * Author: lengleng (wangiegie@gmail.com) - */ - -package com.pig4cloud.pigx.daemon.elastic.controller; - - -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.pig4cloud.pigx.common.core.util.R; -import com.pig4cloud.pigx.daemon.elastic.entity.ExecutionLog; -import com.pig4cloud.pigx.daemon.elastic.service.ExecutionLogService; -import lombok.AllArgsConstructor; -import org.springframework.web.bind.annotation.*; - - -/** - * @author lengleng - * @date 2018-08-03 22:15:56 - */ -@RestController -@RequestMapping("/execution-log") -@AllArgsConstructor -public class ExecutionLogController { - - private final ExecutionLogService executionLogService; - - /** - * 任务日志处理简单分页查询 - * - * @param page 分页对象 - * @param executionLog 任务日志处理 - * @return - */ - @GetMapping("/page") - public R getExecutionLogPage(Page page, ExecutionLog executionLog) { - return R.ok(executionLogService.page(page, Wrappers.query(executionLog))); - } - - - /** - * 通过id查询一条记录 - * - * @param id - * @return R - */ - @GetMapping("/{id}") - public R getById(@PathVariable("id") String id) { - return R.ok(executionLogService.getById(id)); - } - - /** - * 保存 - * - * @param executionLog - * @return R - */ - @PostMapping - public R save(@RequestBody ExecutionLog executionLog) { - return R.ok(executionLogService.save(executionLog)); - } - - /** - * 修改 - * - * @param executionLog - * @return R - */ - @PutMapping - public R update(@RequestBody ExecutionLog executionLog) { - return R.ok(executionLogService.updateById(executionLog)); - } - - /** - * 删除 - * - * @param id - * @return R - */ - @DeleteMapping("/{id}") - public R removeById(@PathVariable String id) { - return R.ok(executionLogService.removeById(id)); - } - -} diff --git a/pigx-visual/pigx-daemon-elastic-job/src/main/java/com/pig4cloud/pigx/daemon/elastic/controller/StatusTraceLogController.java b/pigx-visual/pigx-daemon-elastic-job/src/main/java/com/pig4cloud/pigx/daemon/elastic/controller/StatusTraceLogController.java deleted file mode 100644 index 287984313..000000000 --- a/pigx-visual/pigx-daemon-elastic-job/src/main/java/com/pig4cloud/pigx/daemon/elastic/controller/StatusTraceLogController.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (c) 2018-2025, lengleng All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * Neither the name of the pig4cloud.com developer nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * Author: lengleng (wangiegie@gmail.com) - */ - -package com.pig4cloud.pigx.daemon.elastic.controller; - -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.pig4cloud.pigx.common.core.util.R; -import com.pig4cloud.pigx.daemon.elastic.entity.StatusTraceLog; -import com.pig4cloud.pigx.daemon.elastic.service.StatusTraceLogService; -import lombok.AllArgsConstructor; -import org.springframework.web.bind.annotation.*; - - -/** - * @author lengleng - * @date 2018-08-03 22:15:45 - */ -@RestController -@AllArgsConstructor -@RequestMapping("/status-trace-log") -public class StatusTraceLogController { - private final StatusTraceLogService statusTraceLogService; - - /** - * 任务轨迹处理简单分页查询 - * - * @param page 分页对象 - * @param statusTraceLog 任务轨迹处理 - * @return - */ - @GetMapping("/page") - public R getStatusTraceLogPage(Page page, StatusTraceLog statusTraceLog) { - return R.ok(statusTraceLogService.page(page, Wrappers.query(statusTraceLog))); - } - - - /** - * 信息 - * - * @param id - * @return R - */ - @GetMapping("/{id}") - public R getById(@PathVariable("id") String id) { - return R.ok(statusTraceLogService.getById(id)); - } - - /** - * 保存 - * - * @param statusTraceLog - * @return R - */ - @PostMapping - public R save(@RequestBody StatusTraceLog statusTraceLog) { - return R.ok(statusTraceLogService.save(statusTraceLog)); - } - - /** - * 修改 - * - * @param statusTraceLog - * @return R - */ - @PutMapping - public R update(@RequestBody StatusTraceLog statusTraceLog) { - return R.ok(statusTraceLogService.updateById(statusTraceLog)); - } - - /** - * 删除 - * - * @param id - * @return R - */ - @DeleteMapping("/{id}") - public R removeById(@PathVariable("id") String id) { - return R.ok(statusTraceLogService.removeById(id)); - } - -} diff --git a/pigx-visual/pigx-daemon-elastic-job/src/main/java/com/pig4cloud/pigx/daemon/elastic/entity/ExecutionLog.java b/pigx-visual/pigx-daemon-elastic-job/src/main/java/com/pig4cloud/pigx/daemon/elastic/entity/ExecutionLog.java deleted file mode 100644 index df7f52671..000000000 --- a/pigx-visual/pigx-daemon-elastic-job/src/main/java/com/pig4cloud/pigx/daemon/elastic/entity/ExecutionLog.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.pig4cloud.pigx.daemon.elastic.entity; - -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import com.baomidou.mybatisplus.extension.activerecord.Model; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.io.Serializable; -import java.time.LocalDateTime; - -/** - * - * - * @author lengleng - * @date 2018-08-03 22:15:56 - */ -@Data -@EqualsAndHashCode(callSuper = true) -@TableName("job_execution_log") -public class ExecutionLog extends Model { - private static final long serialVersionUID = 1L; - - /** - * - */ - @TableId - private String id; - /** - * - */ - private String jobName; - /** - * - */ - private String taskId; - /** - * - */ - private String hostname; - /** - * - */ - private String ip; - /** - * - */ - private Integer shardingItem; - /** - * - */ - private String executionSource; - /** - * - */ - private String failureCause; - /** - * - */ - private Integer isSuccess; - /** - * - */ - private LocalDateTime startTime; - /** - * - */ - private LocalDateTime completeTime; - - /** - * 主键值 - */ - @Override - protected Serializable pkVal() { - return this.id; - } -} diff --git a/pigx-visual/pigx-daemon-elastic-job/src/main/java/com/pig4cloud/pigx/daemon/elastic/entity/StatusTraceLog.java b/pigx-visual/pigx-daemon-elastic-job/src/main/java/com/pig4cloud/pigx/daemon/elastic/entity/StatusTraceLog.java deleted file mode 100644 index dcf1acc38..000000000 --- a/pigx-visual/pigx-daemon-elastic-job/src/main/java/com/pig4cloud/pigx/daemon/elastic/entity/StatusTraceLog.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.pig4cloud.pigx.daemon.elastic.entity; - -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import com.baomidou.mybatisplus.extension.activerecord.Model; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.time.LocalDateTime; - -/** - * - * - * @author lengleng - * @date 2018-08-03 22:15:45 - */ -@Data -@EqualsAndHashCode(callSuper = true) -@TableName("job_status_trace_log") -public class StatusTraceLog extends Model { - private static final long serialVersionUID = 1L; - - /** - * - */ - @TableId - private String id; - /** - * - */ - private String jobName; - /** - * - */ - private String originalTaskId; - /** - * - */ - private String taskId; - /** - * - */ - private String slaveId; - /** - * - */ - private String source; - /** - * - */ - private String executionType; - /** - * - */ - private String shardingItem; - /** - * - */ - private String state; - /** - * - */ - private String message; - /** - * - */ - private LocalDateTime creationTime; - -} diff --git a/pigx-visual/pigx-daemon-elastic-job/src/main/java/com/pig4cloud/pigx/daemon/elastic/job/PigxDataflowJob.java b/pigx-visual/pigx-daemon-elastic-job/src/main/java/com/pig4cloud/pigx/daemon/elastic/job/PigxDataflowJob.java deleted file mode 100644 index f43388f81..000000000 --- a/pigx-visual/pigx-daemon-elastic-job/src/main/java/com/pig4cloud/pigx/daemon/elastic/job/PigxDataflowJob.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2018-2025, lengleng All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * Neither the name of the pig4cloud.com developer nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * Author: lengleng (wangiegie@gmail.com) - */ - -package com.pig4cloud.pigx.daemon.elastic.job; - -import com.dangdang.ddframe.job.api.ShardingContext; -import com.dangdang.ddframe.job.api.dataflow.DataflowJob; - -import java.util.List; - -/** - * @author lengleng - * @date 2018/2/8 - */ -public class PigxDataflowJob implements DataflowJob { - - @Override - public List fetchData(ShardingContext shardingContext) { - return null; - } - - @Override - public void processData(ShardingContext shardingContext, List list) { - - } -} diff --git a/pigx-visual/pigx-daemon-elastic-job/src/main/java/com/pig4cloud/pigx/daemon/elastic/job/PigxSimpleJob.java b/pigx-visual/pigx-daemon-elastic-job/src/main/java/com/pig4cloud/pigx/daemon/elastic/job/PigxSimpleJob.java deleted file mode 100644 index c3b8b5b7f..000000000 --- a/pigx-visual/pigx-daemon-elastic-job/src/main/java/com/pig4cloud/pigx/daemon/elastic/job/PigxSimpleJob.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2018-2025, lengleng All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * Neither the name of the pig4cloud.com developer nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * Author: lengleng (wangiegie@gmail.com) - */ - -package com.pig4cloud.pigx.daemon.elastic.job; - -import com.dangdang.ddframe.job.api.ShardingContext; -import com.dangdang.ddframe.job.api.simple.SimpleJob; -import lombok.extern.slf4j.Slf4j; - -/** - * @author lengleng - * @date 2018/2/7 - * 测试Job - */ -@Slf4j -public class PigxSimpleJob implements SimpleJob { - /** - * 业务执行逻辑 - * - * @param shardingContext 分片信息 - */ - @Override - public void execute(ShardingContext shardingContext) { - log.info("第一个任务执行啦:{}", shardingContext); - } -} diff --git a/pigx-visual/pigx-daemon-elastic-job/src/main/java/com/pig4cloud/pigx/daemon/elastic/job/PigxSimpleJob2.java b/pigx-visual/pigx-daemon-elastic-job/src/main/java/com/pig4cloud/pigx/daemon/elastic/job/PigxSimpleJob2.java deleted file mode 100644 index 11d44804c..000000000 --- a/pigx-visual/pigx-daemon-elastic-job/src/main/java/com/pig4cloud/pigx/daemon/elastic/job/PigxSimpleJob2.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2018-2025, lengleng All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * Neither the name of the pig4cloud.com developer nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * Author: lengleng (wangiegie@gmail.com) - */ - -package com.pig4cloud.pigx.daemon.elastic.job; - -import com.dangdang.ddframe.job.api.ShardingContext; -import com.dangdang.ddframe.job.api.simple.SimpleJob; -import lombok.extern.slf4j.Slf4j; - -/** - * @author lengleng - * @date 2018/2/7 - * 测试Job - */ -@Slf4j -public class PigxSimpleJob2 implements SimpleJob { - /** - * 业务执行逻辑 - * - * @param shardingContext 分片信息 - */ - @Override - public void execute(ShardingContext shardingContext) { - log.info("第二个执行了:{}", shardingContext); - } -} diff --git a/pigx-visual/pigx-daemon-elastic-job/src/main/java/com/pig4cloud/pigx/daemon/elastic/listener/PigxDistributeElasticJobListener.java b/pigx-visual/pigx-daemon-elastic-job/src/main/java/com/pig4cloud/pigx/daemon/elastic/listener/PigxDistributeElasticJobListener.java deleted file mode 100644 index ba42d487b..000000000 --- a/pigx-visual/pigx-daemon-elastic-job/src/main/java/com/pig4cloud/pigx/daemon/elastic/listener/PigxDistributeElasticJobListener.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2018-2025, lengleng All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * Neither the name of the pig4cloud.com developer nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * Author: lengleng (wangiegie@gmail.com) - */ - -package com.pig4cloud.pigx.daemon.elastic.listener; - -import com.dangdang.ddframe.job.executor.ShardingContexts; -import com.dangdang.ddframe.job.lite.api.listener.AbstractDistributeOnceElasticJobListener; - -/** - * @author lengleng - * @date 2018/7/24 - */ -public class PigxDistributeElasticJobListener extends AbstractDistributeOnceElasticJobListener { - - public PigxDistributeElasticJobListener(long startedTimeoutMilliseconds, long completedTimeoutMilliseconds) { - super(startedTimeoutMilliseconds, completedTimeoutMilliseconds); - } - - @Override - public void doBeforeJobExecutedAtLastStarted(ShardingContexts shardingContexts) { - System.out.println(shardingContexts.getJobName() + " | MyDistributeElasticJobListener doBeforeJobExecutedAtLastStarted..."); - } - - @Override - public void doAfterJobExecutedAtLastCompleted(ShardingContexts shardingContexts) { - System.out.println(shardingContexts.getJobName() + " | MyDistributeElasticJobListener doAfterJobExecutedAtLastCompleted..."); - } -} diff --git a/pigx-visual/pigx-daemon-elastic-job/src/main/java/com/pig4cloud/pigx/daemon/elastic/listener/PigxElasticJobListener.java b/pigx-visual/pigx-daemon-elastic-job/src/main/java/com/pig4cloud/pigx/daemon/elastic/listener/PigxElasticJobListener.java deleted file mode 100644 index 7c847b8ba..000000000 --- a/pigx-visual/pigx-daemon-elastic-job/src/main/java/com/pig4cloud/pigx/daemon/elastic/listener/PigxElasticJobListener.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2018-2025, lengleng All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * Neither the name of the pig4cloud.com developer nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * Author: lengleng (wangiegie@gmail.com) - */ - -package com.pig4cloud.pigx.daemon.elastic.listener; - -import com.dangdang.ddframe.job.executor.ShardingContexts; -import com.dangdang.ddframe.job.lite.api.listener.ElasticJobListener; - -/** - * @author lengleng - * @date 2018/7/24 - * 任务监听器 - */ -public class PigxElasticJobListener implements ElasticJobListener { - - @Override - public void beforeJobExecuted(ShardingContexts shardingContexts) { - System.out.println(shardingContexts.getJobName() + " | MyElasticJobListener beforeJobExecuted"); - } - - @Override - public void afterJobExecuted(ShardingContexts shardingContexts) { - System.out.println(shardingContexts.getJobName() + " | MyElasticJobListener afterJobExecuted"); - } -} diff --git a/pigx-visual/pigx-daemon-elastic-job/src/main/java/com/pig4cloud/pigx/daemon/elastic/mapper/ExecutionLogMapper.java b/pigx-visual/pigx-daemon-elastic-job/src/main/java/com/pig4cloud/pigx/daemon/elastic/mapper/ExecutionLogMapper.java deleted file mode 100644 index f0d19fc20..000000000 --- a/pigx-visual/pigx-daemon-elastic-job/src/main/java/com/pig4cloud/pigx/daemon/elastic/mapper/ExecutionLogMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.pig4cloud.pigx.daemon.elastic.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.pig4cloud.pigx.daemon.elastic.entity.ExecutionLog; -import org.apache.ibatis.annotations.Mapper; - -/** - * 任务日志处理 - * - * @author lishangbu - * @date 2018/11/22 - */ -@Mapper -public interface ExecutionLogMapper extends BaseMapper { - -} diff --git a/pigx-visual/pigx-daemon-elastic-job/src/main/java/com/pig4cloud/pigx/daemon/elastic/mapper/StatusTraceLogMapper.java b/pigx-visual/pigx-daemon-elastic-job/src/main/java/com/pig4cloud/pigx/daemon/elastic/mapper/StatusTraceLogMapper.java deleted file mode 100644 index f301fe207..000000000 --- a/pigx-visual/pigx-daemon-elastic-job/src/main/java/com/pig4cloud/pigx/daemon/elastic/mapper/StatusTraceLogMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.pig4cloud.pigx.daemon.elastic.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.pig4cloud.pigx.daemon.elastic.entity.StatusTraceLog; -import org.apache.ibatis.annotations.Mapper; - -/** - * 任务轨迹处理 - * - * @author lishangbu - * @date 2018/11/22 - */ -@Mapper -public interface StatusTraceLogMapper extends BaseMapper { - -} diff --git a/pigx-visual/pigx-daemon-elastic-job/src/main/java/com/pig4cloud/pigx/daemon/elastic/service/ExecutionLogService.java b/pigx-visual/pigx-daemon-elastic-job/src/main/java/com/pig4cloud/pigx/daemon/elastic/service/ExecutionLogService.java deleted file mode 100644 index 5123cab27..000000000 --- a/pigx-visual/pigx-daemon-elastic-job/src/main/java/com/pig4cloud/pigx/daemon/elastic/service/ExecutionLogService.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.pig4cloud.pigx.daemon.elastic.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.pig4cloud.pigx.daemon.elastic.entity.ExecutionLog; - -/** - * 任务日志处理 - * - * @author lishangbu - * @date 2018-10-27 10:55:42 - */ -public interface ExecutionLogService extends IService { - -} diff --git a/pigx-visual/pigx-daemon-elastic-job/src/main/java/com/pig4cloud/pigx/daemon/elastic/service/StatusTraceLogService.java b/pigx-visual/pigx-daemon-elastic-job/src/main/java/com/pig4cloud/pigx/daemon/elastic/service/StatusTraceLogService.java deleted file mode 100644 index 397f37f42..000000000 --- a/pigx-visual/pigx-daemon-elastic-job/src/main/java/com/pig4cloud/pigx/daemon/elastic/service/StatusTraceLogService.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.pig4cloud.pigx.daemon.elastic.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.pig4cloud.pigx.daemon.elastic.entity.StatusTraceLog; - -/** - * 任务轨迹处理 - * - * @author lishangbu - * @date 2018-10-28 07:18:05 - */ -public interface StatusTraceLogService extends IService { - -} diff --git a/pigx-visual/pigx-daemon-elastic-job/src/main/java/com/pig4cloud/pigx/daemon/elastic/service/impl/ExecutionLogServiceImpl.java b/pigx-visual/pigx-daemon-elastic-job/src/main/java/com/pig4cloud/pigx/daemon/elastic/service/impl/ExecutionLogServiceImpl.java deleted file mode 100644 index ee4f4933f..000000000 --- a/pigx-visual/pigx-daemon-elastic-job/src/main/java/com/pig4cloud/pigx/daemon/elastic/service/impl/ExecutionLogServiceImpl.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.pig4cloud.pigx.daemon.elastic.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.pig4cloud.pigx.daemon.elastic.entity.ExecutionLog; -import com.pig4cloud.pigx.daemon.elastic.mapper.ExecutionLogMapper; -import com.pig4cloud.pigx.daemon.elastic.service.ExecutionLogService; -import org.springframework.stereotype.Service; - -/** - * 任务日志处理 - * - * @author lishangbu - * @date 2018/11/22 - */ -@Service("executionLogService") -public class ExecutionLogServiceImpl extends ServiceImpl implements ExecutionLogService { - -} diff --git a/pigx-visual/pigx-daemon-elastic-job/src/main/java/com/pig4cloud/pigx/daemon/elastic/service/impl/StatusTraceLogServiceImpl.java b/pigx-visual/pigx-daemon-elastic-job/src/main/java/com/pig4cloud/pigx/daemon/elastic/service/impl/StatusTraceLogServiceImpl.java deleted file mode 100644 index 46f3b76ef..000000000 --- a/pigx-visual/pigx-daemon-elastic-job/src/main/java/com/pig4cloud/pigx/daemon/elastic/service/impl/StatusTraceLogServiceImpl.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.pig4cloud.pigx.daemon.elastic.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.pig4cloud.pigx.daemon.elastic.entity.StatusTraceLog; -import com.pig4cloud.pigx.daemon.elastic.mapper.StatusTraceLogMapper; -import com.pig4cloud.pigx.daemon.elastic.service.StatusTraceLogService; -import lombok.AllArgsConstructor; -import org.springframework.stereotype.Service; - -/** - * 任务轨迹处理 - * - * @author lishangbu - * @date 2018/11/22 - */ -@Service("statusTraceLogService") -@AllArgsConstructor -public class StatusTraceLogServiceImpl extends ServiceImpl implements StatusTraceLogService { - -} diff --git a/pom.xml b/pom.xml index 23636544d..285cf3ce1 100644 --- a/pom.xml +++ b/pom.xml @@ -50,12 +50,11 @@ 2.1.1 2.11.2 6.0.11 - 2.1.5 2.1.1 2.3.6.RELEASE 5.22.0 172.17.0.111 - http://172.17.0.111:2375 + http://172.17.0.140:2375 library admin Harbor12345