Browse Source

:card_file_box: 调整租户套餐相关的SQL

aeizzz 1 year ago
parent
commit
42620ee23b

+ 61 - 103
db/2pigxx.sql

@@ -397,48 +397,20 @@ INSERT INTO `sys_menu` VALUES (3000, '系统监控', NULL, '/daemon', -1, 'icon-
 INSERT INTO `sys_menu` VALUES (3500, '文档扩展', NULL, 'http://pigx-gateway:9999/admin/doc.html', 3000, 'icon-wendang', 2, '0', '0', ' ', '2018-06-26 10:50:32', ' ', '2020-03-24 08:57:36', '0', 1);
 INSERT INTO `sys_menu` VALUES (3600, 'Quartz日志', '', '/daemon/job-log/index', 3000, 'icon-gtsquanjushiwufuwuGTS', 8, '0', '0', ' ', '2018-01-20 13:17:19', ' ', '2020-03-24 08:57:37', '0', 1);
 INSERT INTO `sys_menu` VALUES (3700, '注册配置', NULL, '', 3000, 'icon-line', 10, '0', '0', ' ', '2018-01-25 11:08:52', ' ', '2020-03-24 08:57:37', '1', 1);
-INSERT INTO `sys_menu`
-VALUES (8000, '文件管理', NULL, '/admin/file/index', 2000, 'icon-wenjianguanli', 6, '0', '0', ' ',
-        '2019-06-25 12:44:46', ' ', '2020-03-24 08:58:41', '0', 1);
-INSERT INTO `sys_menu`
-VALUES (8001, '删除文件', 'sys_file_del', NULL, 8000, NULL, 1, '0', '1', ' ', '2019-06-25 13:41:41', ' ',
-        '2020-03-24 08:58:42', '0', 1);
-INSERT INTO `sys_menu`
-VALUES (9000, '开发平台', NULL, '/gen', -1, 'icon-shejiyukaifa-', 9, '0', '0', ' ', '2019-08-12 09:35:16', ' ',
-        '2020-03-24 08:58:48', '0', 1);
-INSERT INTO `sys_menu`
-VALUES (9001, '表单管理', '', '/gen/form', 9000, 'icon-record', 3, '0', '0', ' ', '2018-01-20 13:17:19', ' ',
-        '2020-03-24 08:58:44', '0', 1);
-INSERT INTO `sys_menu`
-VALUES (9002, '表单新增', 'gen_form_add', NULL, 9001, '1', 0, '0', '1', ' ', '2018-05-15 21:35:18', ' ',
-        '2020-03-24 08:58:45', '0', 1);
-INSERT INTO `sys_menu`
-VALUES (9003, '表单修改', 'gen_form_edit', NULL, 9001, '1', 1, '0', '1', ' ', '2018-05-15 21:35:18', ' ',
-        '2020-03-24 08:58:46', '0', 1);
-INSERT INTO `sys_menu`
-VALUES (9004, '表单删除', 'gen_form_del', NULL, 9001, '1', 2, '0', '1', ' ', '2018-05-15 21:35:18', ' ',
-        '2020-03-24 08:58:47', '0', 1);
-INSERT INTO `sys_menu`
-VALUES (9005, '数据源管理', NULL, '/gen/datasource', 9000, 'icon-mysql', 0, '0', '0', ' ', '2019-08-12 09:42:11', ' ',
-        '2020-03-24 08:58:49', '0', 1);
-INSERT INTO `sys_menu`
-VALUES (9006, '表单设计', NULL, '/gen/design', 9000, 'icon-biaodanbiaoqian', 2, '0', '0', ' ', '2019-08-16 10:08:56',
-        ' ', '2020-03-24 08:58:53', '0', 1);
-INSERT INTO `sys_menu`
-VALUES (9007, '低代码', 'gen_api_designer', NULL, 9001, '1', 3, '0', '1', ' ', '2019-08-16 10:08:56', ' ',
-        '2020-03-24 08:58:53', '0', 1);
-INSERT INTO `sys_menu`
-VALUES (15103, '租户菜单新增', 'admin_systenantmenu_add', NULL, 15100, NULL, '1', 1, '0', '1', 'admin',
-        '2022-12-09 14:04:19', 'admin', '2022-12-12 09:02:00', '0', 1);
-INSERT INTO `sys_menu`
-VALUES (15102, '租户菜单编辑', 'admin_systenantmenu_edit', NULL, 15100, NULL, '1', 999, '0', '1', 'admin',
-        '2022-12-09 14:04:19', 'admin', '2022-12-12 09:02:11', '0', 1);
-INSERT INTO `sys_menu`
-VALUES (15101, '租户菜单删除', 'admin_systenantmenu_del', NULL, 15100, NULL, '1', 999, '0', '1', 'admin',
-        '2022-12-09 14:04:19', 'admin', '2022-12-12 09:02:06', '0', 1);
-INSERT INTO `sys_menu`
-VALUES (15100, '租户菜单', 'admin_systenant_tenantmenu', NULL, 1500, NULL, '1', 999, '0', '1', 'admin',
-        '2022-12-12 09:01:41', ' ', NULL, '0', 1);
+INSERT INTO `sys_menu` VALUES (8000, '文件管理', NULL, '/admin/file/index', 2000, 'icon-wenjianguanli', 6, '0', '0', ' ', '2019-06-25 12:44:46', ' ', '2020-03-24 08:58:41', '0', 1);
+INSERT INTO `sys_menu` VALUES (8001, '删除文件', 'sys_file_del', NULL, 8000, NULL, 1, '0', '1', ' ', '2019-06-25 13:41:41', ' ', '2020-03-24 08:58:42', '0', 1);
+INSERT INTO `sys_menu` VALUES (9000, '开发平台', NULL, '/gen', -1, 'icon-shejiyukaifa-', 9, '0', '0', ' ', '2019-08-12 09:35:16', ' ', '2020-03-24 08:58:48', '0', 1);
+INSERT INTO `sys_menu` VALUES (9001, '表单管理', '', '/gen/form', 9000, 'icon-record', 3, '0', '0', ' ', '2018-01-20 13:17:19', ' ', '2020-03-24 08:58:44', '0', 1);
+INSERT INTO `sys_menu` VALUES (9002, '表单新增', 'gen_form_add', NULL, 9001, '1', 0, '0', '1', ' ', '2018-05-15 21:35:18', ' ', '2020-03-24 08:58:45', '0', 1);
+INSERT INTO `sys_menu` VALUES (9003, '表单修改', 'gen_form_edit', NULL, 9001, '1', 1, '0', '1', ' ', '2018-05-15 21:35:18', ' ', '2020-03-24 08:58:46', '0', 1);
+INSERT INTO `sys_menu` VALUES (9004, '表单删除', 'gen_form_del', NULL, 9001, '1', 2, '0', '1', ' ', '2018-05-15 21:35:18', ' ', '2020-03-24 08:58:47', '0', 1);
+INSERT INTO `sys_menu` VALUES (9005, '数据源管理', NULL, '/gen/datasource', 9000, 'icon-mysql', 0, '0', '0', ' ', '2019-08-12 09:42:11', ' ', '2020-03-24 08:58:49', '0', 1);
+INSERT INTO `sys_menu` VALUES (9006, '表单设计', NULL, '/gen/design', 9000, 'icon-biaodanbiaoqian', 2, '0', '0', ' ', '2019-08-16 10:08:56', ' ', '2020-03-24 08:58:53', '0', 1);
+INSERT INTO `sys_menu` VALUES (9007, '低代码', 'gen_api_designer', NULL , 9001, '1', 3, '0', '1', ' ', '2019-08-16 10:08:56', ' ', '2020-03-24 08:58:53', '0', 1);
+INSERT INTO `sys_menu` VALUES (15100, '租户菜单', 'admin_systenant_tenantmenu', NULL, 1500, '1', 1, '0', '1', 'admin', '2022-12-12 09:01:41', ' ', '2023-01-11 05:52:51', '0', 1);
+INSERT INTO `sys_menu` VALUES (15101, '租户菜单删除', 'admin_systenantmenu_del', NULL, 15100, '1', 1, '0', '1', 'admin', '2022-12-09 14:04:19', 'admin', '2023-01-11 05:52:51', '0', 1);
+INSERT INTO `sys_menu` VALUES (15102, '租户菜单编辑', 'admin_systenantmenu_edit', NULL, 15100, '1', 1, '0', '1', 'admin', '2022-12-09 14:04:19', 'admin', '2023-01-11 05:52:51', '0', 1);
+INSERT INTO `sys_menu` VALUES (15103, '租户菜单新增', 'admin_systenantmenu_add', NULL, 15100, '1', 1, '0', '1', 'admin', '2022-12-09 14:04:19', 'admin', '2022-12-12 09:02:00', '0', 1);
 
 COMMIT;
 
@@ -448,25 +420,25 @@ COMMIT;
 DROP TABLE IF EXISTS `sys_oauth_client_details`;
 CREATE TABLE `sys_oauth_client_details`
 (
-    `id`                                                              bigint                            NOT NULL COMMENT 'ID',
-    `client_id`                                                       varchar(32) CHARACTER SET utf8mb4 NOT NULL,
-                                            `resource_ids` varchar(256) CHARACTER SET utf8mb4 DEFAULT NULL,
-                                            `client_secret` varchar(256) CHARACTER SET utf8mb4 DEFAULT NULL,
-                                            `scope` varchar(256) CHARACTER SET utf8mb4 DEFAULT NULL,
-                                            `authorized_grant_types` varchar(256) CHARACTER SET utf8mb4 DEFAULT NULL,
-                                            `web_server_redirect_uri` varchar(256) CHARACTER SET utf8mb4 DEFAULT NULL,
-                                            `authorities` varchar(256) CHARACTER SET utf8mb4 DEFAULT NULL,
-                                            `access_token_validity` int DEFAULT NULL,
-                                            `refresh_token_validity` int DEFAULT NULL,
-                                            `additional_information` varchar(4096) CHARACTER SET utf8mb4 DEFAULT NULL,
-                                            `autoapprove` varchar(256) CHARACTER SET utf8mb4 DEFAULT NULL,
-                                            `del_flag` char(1) CHARACTER SET utf8mb4 DEFAULT '0',
-                                            `create_by` varchar(64) CHARACTER SET utf8  NOT NULL DEFAULT ' ' COMMENT '创建人',
-                                            `update_by` varchar(64) CHARACTER SET utf8  NOT NULL DEFAULT ' ' COMMENT '修改人',
-                                            `create_time` datetime DEFAULT NULL COMMENT '上传时间',
-                                            `update_time` datetime DEFAULT NULL COMMENT '更新时间',
-                                            `tenant_id` bigint NOT NULL DEFAULT '0' COMMENT '所属租户',
-                                            PRIMARY KEY (`id`) USING BTREE
+                                    `id`  bigint NOT NULL COMMENT 'ID',
+                                    `client_id` varchar(32) CHARACTER SET utf8mb4 NOT NULL,
+                                    `resource_ids` varchar(256) CHARACTER SET utf8mb4 DEFAULT NULL,
+                                    `client_secret` varchar(256) CHARACTER SET utf8mb4 DEFAULT NULL,
+                                    `scope` varchar(256) CHARACTER SET utf8mb4 DEFAULT NULL,
+                                    `authorized_grant_types` varchar(256) CHARACTER SET utf8mb4 DEFAULT NULL,
+                                    `web_server_redirect_uri` varchar(256) CHARACTER SET utf8mb4 DEFAULT NULL,
+                                    `authorities` varchar(256) CHARACTER SET utf8mb4 DEFAULT NULL,
+                                    `access_token_validity` int DEFAULT NULL,
+                                    `refresh_token_validity` int DEFAULT NULL,
+                                    `additional_information` varchar(4096) CHARACTER SET utf8mb4 DEFAULT NULL,
+                                    `autoapprove` varchar(256) CHARACTER SET utf8mb4 DEFAULT NULL,
+                                    `del_flag` char(1) CHARACTER SET utf8mb4 DEFAULT '0',
+                                    `create_by` varchar(64) CHARACTER SET utf8  NOT NULL DEFAULT ' ' COMMENT '创建人',
+                                    `update_by` varchar(64) CHARACTER SET utf8  NOT NULL DEFAULT ' ' COMMENT '修改人',
+                                    `create_time` datetime DEFAULT NULL COMMENT '上传时间',
+                                    `update_time` datetime DEFAULT NULL COMMENT '更新时间',
+                                    `tenant_id` bigint NOT NULL DEFAULT '0' COMMENT '所属租户',
+                                    PRIMARY KEY (`id`) USING BTREE
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='终端信息表';
 
 -- ----------------------------
@@ -628,34 +600,20 @@ INSERT INTO `sys_role_menu` VALUES (1, 2870);
 INSERT INTO `sys_role_menu` VALUES (1, 3000);
 INSERT INTO `sys_role_menu` VALUES (1, 3500);
 INSERT INTO `sys_role_menu` VALUES (1, 3600);
-INSERT INTO `sys_role_menu`
-VALUES (1, 8000);
-INSERT INTO `sys_role_menu`
-VALUES (1, 8001);
-INSERT INTO `sys_role_menu`
-VALUES (1, 9000);
-INSERT INTO `sys_role_menu`
-VALUES (1, 9001);
-INSERT INTO `sys_role_menu`
-VALUES (1, 9002);
-INSERT INTO `sys_role_menu`
-VALUES (1, 9003);
-INSERT INTO `sys_role_menu`
-VALUES (1, 9004);
-INSERT INTO `sys_role_menu`
-VALUES (1, 9005);
-INSERT INTO `sys_role_menu`
-VALUES (1, 9006);
-INSERT INTO `sys_role_menu`
-VALUES (1, 9007);
-INSERT INTO `sys_role_menu`
-VALUES (1, 15100);
-INSERT INTO `sys_role_menu`
-VALUES (1, 15101);
-INSERT INTO `sys_role_menu`
-VALUES (1, 15102);
-INSERT INTO `sys_role_menu`
-VALUES (1, 15103);
+INSERT INTO `sys_role_menu` VALUES (1, 8000);
+INSERT INTO `sys_role_menu` VALUES (1, 8001);
+INSERT INTO `sys_role_menu` VALUES (1, 9000);
+INSERT INTO `sys_role_menu` VALUES (1, 9001);
+INSERT INTO `sys_role_menu` VALUES (1, 9002);
+INSERT INTO `sys_role_menu` VALUES (1, 9003);
+INSERT INTO `sys_role_menu` VALUES (1, 9004);
+INSERT INTO `sys_role_menu` VALUES (1, 9005);
+INSERT INTO `sys_role_menu` VALUES (1, 9006);
+INSERT INTO `sys_role_menu` VALUES (1, 9007);
+INSERT INTO `sys_role_menu` VALUES (1, 15100);
+INSERT INTO `sys_role_menu` VALUES (1, 15101);
+INSERT INTO `sys_role_menu` VALUES (1, 15102);
+INSERT INTO `sys_role_menu` VALUES (1, 15103);
 COMMIT;
 
 -- ----------------------------
@@ -664,20 +622,20 @@ COMMIT;
 DROP TABLE IF EXISTS `sys_social_details`;
 CREATE TABLE `sys_social_details`
 (
-    `id`                                             bigint                       NOT NULL COMMENT '主鍵',
-    `type`                                           varchar(16) CHARACTER SET utf8mb4     DEFAULT NULL,
-    `remark`                                         varchar(64) CHARACTER SET utf8mb4     DEFAULT NULL,
-                                      `app_id` varchar(64) CHARACTER SET utf8mb4 DEFAULT NULL,
-                                      `app_secret` varchar(64) CHARACTER SET utf8mb4 DEFAULT NULL,
-                                      `redirect_url` varchar(128) CHARACTER SET utf8mb4 DEFAULT NULL,
-                                      `ext` varchar(255) CHARACTER SET utf8mb4 DEFAULT NULL COMMENT '拓展字段',
-                                      `create_by` varchar(64) CHARACTER SET utf8  NOT NULL DEFAULT ' ' COMMENT '创建人',
-                                      `update_by` varchar(64) CHARACTER SET utf8  NOT NULL DEFAULT ' ' COMMENT '修改人',
-                                      `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
-                                      `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
-                                      `del_flag` char(1) CHARACTER SET utf8mb4 DEFAULT '0',
-                                      `tenant_id` bigint NOT NULL DEFAULT '0' COMMENT '所属租户',
-                                      PRIMARY KEY (`id`) USING BTREE
+    `id`  bigint  NOT NULL COMMENT '主鍵',
+    `type`  varchar(16) CHARACTER SET utf8mb4     DEFAULT NULL,
+    `remark`  varchar(64) CHARACTER SET utf8mb4     DEFAULT NULL,
+    `app_id` varchar(64) CHARACTER SET utf8mb4 DEFAULT NULL,
+    `app_secret` varchar(64) CHARACTER SET utf8mb4 DEFAULT NULL,
+    `redirect_url` varchar(128) CHARACTER SET utf8mb4 DEFAULT NULL,
+    `ext` varchar(255) CHARACTER SET utf8mb4 DEFAULT NULL COMMENT '拓展字段',
+    `create_by` varchar(64) CHARACTER SET utf8  NOT NULL DEFAULT ' ' COMMENT '创建人',
+    `update_by` varchar(64) CHARACTER SET utf8  NOT NULL DEFAULT ' ' COMMENT '修改人',
+    `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+    `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
+    `del_flag` char(1) CHARACTER SET utf8mb4 DEFAULT '0',
+    `tenant_id` bigint NOT NULL DEFAULT '0' COMMENT '所属租户',
+    PRIMARY KEY (`id`) USING BTREE
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='系统社交登录账号表';
 
 

+ 1 - 3
pigx-auth/src/main/java/com/pig4cloud/pigx/auth/endpoint/PigxTokenEndpoint.java

@@ -89,14 +89,12 @@ public class PigxTokenEndpoint {
 
 	private final CacheManager cacheManager;
 
-
 	private final KeyStrResolver tenantKeyStrResolver;
 
 	/**
 	 * 认证页面
-	 *
 	 * @param modelAndView
-	 * @param error        表单登录失败处理回调的错误信息
+	 * @param error 表单登录失败处理回调的错误信息
 	 * @return ModelAndView
 	 */
 	@GetMapping("/login")

+ 9 - 6
pigx-auth/src/main/java/com/pig4cloud/pigx/auth/support/base/OAuth2ResourceOwnerBaseAuthenticationProvider.java

@@ -160,7 +160,8 @@ public abstract class OAuth2ResourceOwnerBaseAuthenticationProvider<T extends OA
 			return generatAuthenticationToken(resouceOwnerBaseAuthentication, clientPrincipal, registeredClient,
 					authorizedScopes, usernamePasswordAuthentication);
 
-		} catch (Exception ex) {
+		}
+		catch (Exception ex) {
 			throw oAuth2AuthenticationException(authentication, (AuthenticationException) ex);
 		}
 
@@ -168,8 +169,8 @@ public abstract class OAuth2ResourceOwnerBaseAuthenticationProvider<T extends OA
 
 	@NotNull
 	private OAuth2AccessTokenAuthenticationToken generatAuthenticationToken(T resouceOwnerBaseAuthentication,
-																			OAuth2ClientAuthenticationToken clientPrincipal, RegisteredClient registeredClient,
-																			Set<String> authorizedScopes, Authentication usernamePasswordAuthentication) {
+			OAuth2ClientAuthenticationToken clientPrincipal, RegisteredClient registeredClient,
+			Set<String> authorizedScopes, Authentication usernamePasswordAuthentication) {
 		// @formatter:off
 		DefaultOAuth2TokenContext.Builder tokenContextBuilder = DefaultOAuth2TokenContext.builder()
 				.registeredClient(registeredClient)
@@ -205,21 +206,23 @@ public abstract class OAuth2ResourceOwnerBaseAuthenticationProvider<T extends OA
 					// 0.4.0 新增的方法
 					.authorizedScopes(authorizedScopes)
 					.attribute(Principal.class.getName(), usernamePasswordAuthentication);
-		} else {
+		}
+		else {
 			authorizationBuilder.id(accessToken.getTokenValue()).accessToken(accessToken);
 		}
 
 		// ----- Refresh token -----
 		OAuth2RefreshToken refreshToken = null;
 		if (registeredClient.getAuthorizationGrantTypes().contains(AuthorizationGrantType.REFRESH_TOKEN) &&
-				// Do not issue refresh token to public client
+		// Do not issue refresh token to public client
 				!clientPrincipal.getClientAuthenticationMethod().equals(ClientAuthenticationMethod.NONE)) {
 
 			if (this.refreshTokenGenerator != null) {
 				Instant issuedAt = Instant.now();
 				Instant expiresAt = issuedAt.plus(registeredClient.getTokenSettings().getRefreshTokenTimeToLive());
 				refreshToken = new OAuth2RefreshToken(this.refreshTokenGenerator.get(), issuedAt, expiresAt);
-			} else {
+			}
+			else {
 				tokenContext = tokenContextBuilder.tokenType(OAuth2TokenType.REFRESH_TOKEN).build();
 				OAuth2Token generatedRefreshToken = this.tokenGenerator.generate(tokenContext);
 				if (!(generatedRefreshToken instanceof OAuth2RefreshToken)) {

+ 4 - 2
pigx-quartz/src/main/java/com/pig4cloud/pigx/quartz/controller/SysJobController.java

@@ -156,7 +156,8 @@ public class SysJobController {
 				.count(new LambdaQueryWrapper<SysJob>().eq(SysJob::getJobStatus, JOB_STATUS_RUNNING.getType()));
 		if (count <= 0) {
 			return R.ok("无正在运行定时任务");
-		} else {
+		}
+		else {
 			// 更新定时任务状态条件,运行状态2更新为暂停状态2
 			this.sysJobService.update(SysJob.builder().jobStatus(JOB_STATUS_NOT_RUNNING.getType()).build(),
 					new UpdateWrapper<SysJob>().lambda().eq(SysJob::getJobStatus, JOB_STATUS_RUNNING.getType()));
@@ -218,7 +219,8 @@ public class SysJobController {
 		SysJob querySysJob = this.sysJobService.getById(jobId);
 		if (querySysJob != null && JOB_LOG_STATUS_FAIL.getType().equals(querySysJob.getJobStatus())) {
 			taskUtil.addOrUpateJob(querySysJob, scheduler);
-		} else {
+		}
+		else {
 			taskUtil.resumeJob(querySysJob, scheduler);
 		}
 		// 更新定时任务状态条件,暂停状态3更新为运行状态2