mirror of
https://github.com/jeecgboot/JeecgBoot.git
synced 2025-12-30 00:32:26 +08:00
JeecgBoot 2.4 微服务正式版本发布,基于SpringBoot的低代码平台
This commit is contained in:
@ -1,17 +1,17 @@
|
||||
Jeecg-Boot 低代码开发平台
|
||||
===============
|
||||
|
||||
当前最新版本: 2.3(发布日期:20200914)
|
||||
当前最新版本: 2.4.0(发布日期:20201201)
|
||||
|
||||
|
||||
## 后端技术架构
|
||||
- 基础框架:Spring Boot 2.1.3.RELEASE
|
||||
- 基础框架:Spring Boot 2.3.5.RELEASE
|
||||
|
||||
- 持久层框架:Mybatis-plus_3.3.2
|
||||
- 持久层框架:Mybatis-plus 3.4.1
|
||||
|
||||
- 安全框架:Apache Shiro 1.4.0,Jwt_3.7.0
|
||||
- 安全框架:Apache Shiro 1.7.0,Jwt 3.11.0
|
||||
|
||||
- 数据库连接池:阿里巴巴Druid 1.1.17
|
||||
- 数据库连接池:阿里巴巴Druid 1.1.22
|
||||
|
||||
- 缓存框架:redis
|
||||
|
||||
@ -29,7 +29,7 @@ Jeecg-Boot 低代码开发平台
|
||||
|
||||
- 依赖管理:Maven
|
||||
|
||||
- 数据库:MySQL5.0 & Oracle 11g
|
||||
- 数据库:MySQL5.7+ & Oracle 11g
|
||||
|
||||
- 缓存:Redis
|
||||
|
||||
@ -43,7 +43,7 @@ Jeecg-Boot 低代码开发平台
|
||||
|
||||
- 常见问题: [入门常见问题大全](http://bbs.jeecg.com/forum.php?mod=viewthread&tid=7816&extra=page%3D1)
|
||||
|
||||
- QQ交流群 : ①284271917、②769925425
|
||||
- QQ交流群 : ③816531124、①284271917、②769925425
|
||||
|
||||
|
||||
## 专项文档
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,116 +0,0 @@
|
||||
|
||||
-- author:sunjianlei--------date:20200721------for: 新增JVXETable示例菜单 --------
|
||||
INSERT INTO `sys_permission` (`id`, `parent_id`, `name`, `url`, `component`, `is_route`, `component_name`, `redirect`, `menu_type`, `perms`, `perms_type`, `sort_no`, `always_show`, `icon`, `is_leaf`, `keep_alive`, `hidden`, `description`, `create_by`, `create_time`, `update_by`, `update_time`, `del_flag`, `rule_flag`, `status`, `internal_or_external`) VALUES ('1285157614715457537', '2a470fc0c3954d9dbb61de6d80846549', 'JVXETable示例', '/jeecg/j-vxe-table-demo', 'jeecg/JVXETableDemo', '1', NULL, NULL, '1', NULL, '1', '10', '0', NULL, '1', '0', '0', NULL, 'admin', '2020-07-20 18:20:27', 'admin', '2020-07-20 18:20:36', '0', '0', '1', '0');
|
||||
-- author:sunjianlei--------date:20200721------for: 新增JVXETable示例菜单 --------
|
||||
|
||||
-- author:sunjianlei--------date:20200727------for: 新增JVXETable示例菜单 --------
|
||||
-- 删除旧菜单
|
||||
DELETE FROM `sys_permission` WHERE (`id`='1285157614715457537');
|
||||
DELETE FROM `sys_role_permission` WHERE (`permission_id`='1285157614715457537');
|
||||
-- 添加新菜单
|
||||
INSERT INTO `sys_permission` (`id`, `parent_id`, `name`, `url`, `component`, `is_route`, `component_name`, `redirect`, `menu_type`, `perms`, `perms_type`, `sort_no`, `always_show`, `icon`, `is_leaf`, `keep_alive`, `hidden`, `description`, `create_by`, `create_time`, `update_by`, `update_time`, `del_flag`, `rule_flag`, `status`, `internal_or_external`) VALUES ('1287715272999944193', '2a470fc0c3954d9dbb61de6d80846549', 'JVXETable示例', '/jeecg/j-vxe-table-demo', 'layouts/RouteView', '1', NULL, NULL, '1', NULL, '1', '10', '0', '', '0', '0', '0', NULL, 'admin', '2020-07-27 19:43:40', 'admin', '2020-07-27 19:47:19', '0', '0', '1', '0');
|
||||
INSERT INTO `sys_permission` (`id`, `parent_id`, `name`, `url`, `component`, `is_route`, `component_name`, `redirect`, `menu_type`, `perms`, `perms_type`, `sort_no`, `always_show`, `icon`, `is_leaf`, `keep_alive`, `hidden`, `description`, `create_by`, `create_time`, `update_by`, `update_time`, `del_flag`, `rule_flag`, `status`, `internal_or_external`) VALUES ('1287715783966834689', '1287715272999944193', '普通示例', '/jeecg/j-vxe-table-demo/normal', 'jeecg/JVXETableDemo', '1', NULL, NULL, '1', NULL, '1', '1', '0', NULL, '1', '0', '0', NULL, 'admin', '2020-07-27 19:45:42', NULL, NULL, '0', '0', '1', '0');
|
||||
INSERT INTO `sys_permission` (`id`, `parent_id`, `name`, `url`, `component`, `is_route`, `component_name`, `redirect`, `menu_type`, `perms`, `perms_type`, `sort_no`, `always_show`, `icon`, `is_leaf`, `keep_alive`, `hidden`, `description`, `create_by`, `create_time`, `update_by`, `update_time`, `del_flag`, `rule_flag`, `status`, `internal_or_external`) VALUES ('1287716451494510593', '1287715272999944193', '布局模板', '/jeecg/j-vxe-table-demo/layout', 'jeecg/JVxeDemo/layout-demo/Index', '1', NULL, NULL, '1', NULL, '1', '2', '0', NULL, '1', '0', '0', NULL, 'admin', '2020-07-27 19:48:21', NULL, NULL, '0', '0', '1', '0');
|
||||
INSERT INTO `sys_permission` (`id`, `parent_id`, `name`, `url`, `component`, `is_route`, `component_name`, `redirect`, `menu_type`, `perms`, `perms_type`, `sort_no`, `always_show`, `icon`, `is_leaf`, `keep_alive`, `hidden`, `description`, `create_by`, `create_time`, `update_by`, `update_time`, `del_flag`, `rule_flag`, `status`, `internal_or_external`) VALUES ('1287718919049691137', '1287715272999944193', '即时保存', '/jeecg/j-vxe-table-demo/jsbc', 'jeecg/JVxeDemo/demo/JSBCDemo', '1', NULL, NULL, '1', NULL, '1', '3', '0', NULL, '1', '0', '0', NULL, 'admin', '2020-07-27 19:57:36', 'admin', '2020-07-27 20:03:37', '0', '0', '1', '0');
|
||||
INSERT INTO `sys_permission` (`id`, `parent_id`, `name`, `url`, `component`, `is_route`, `component_name`, `redirect`, `menu_type`, `perms`, `perms_type`, `sort_no`, `always_show`, `icon`, `is_leaf`, `keep_alive`, `hidden`, `description`, `create_by`, `create_time`, `update_by`, `update_time`, `del_flag`, `rule_flag`, `status`, `internal_or_external`) VALUES ('1287718938179911682', '1287715272999944193', '弹出子表', '/jeecg/j-vxe-table-demo/tczb', 'jeecg/JVxeDemo/demo/PopupSubTable', '1', NULL, NULL, '1', NULL, '1', '4', '0', NULL, '1', '0', '0', NULL, 'admin', '2020-07-27 19:57:41', 'admin', '2020-07-27 20:03:47', '0', '0', '1', '0');
|
||||
INSERT INTO `sys_permission` (`id`, `parent_id`, `name`, `url`, `component`, `is_route`, `component_name`, `redirect`, `menu_type`, `perms`, `perms_type`, `sort_no`, `always_show`, `icon`, `is_leaf`, `keep_alive`, `hidden`, `description`, `create_by`, `create_time`, `update_by`, `update_time`, `del_flag`, `rule_flag`, `status`, `internal_or_external`) VALUES ('1287718956957810689', '1287715272999944193', '无痕刷新', '/jeecg/j-vxe-table-demo/whsx', 'jeecg/JVxeDemo/demo/SocketReload', '1', NULL, NULL, '1', NULL, '1', '5', '0', NULL, '1', '0', '0', NULL, 'admin', '2020-07-27 19:57:44', 'admin', '2020-07-27 20:03:57', '0', '0', '1', '0');
|
||||
-- author:sunjianlei--------date:20200727------for: 新增JVXETable示例菜单 --------
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `sys_gateway_route`;
|
||||
CREATE TABLE `sys_gateway_route` (
|
||||
`id` varchar(36) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
|
||||
`name` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '服务名',
|
||||
`uri` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '服务地址',
|
||||
`predicates` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '断言',
|
||||
`filters` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '过滤器',
|
||||
`retryable` int(3) NULL DEFAULT NULL COMMENT '是否重试:0-否 1-是',
|
||||
`strip_prefix` int(3) NULL DEFAULT NULL COMMENT '是否忽略前缀0-否 1-是',
|
||||
`persist` int(3) NULL DEFAULT NULL COMMENT '是否为保留数据:0-否 1-是',
|
||||
`show_api` int(3) NULL DEFAULT NULL COMMENT '是否在接口文档中展示:0-否 1-是',
|
||||
`status` int(3) NULL DEFAULT NULL COMMENT '状态:0-无效 1-有效',
|
||||
`create_by` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建人',
|
||||
`create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建日期',
|
||||
`update_by` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '更新人',
|
||||
`update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新日期',
|
||||
`sys_org_code` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '所属部门',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
|
||||
-- author:taoyan--------date:20200815---for: gateway 路由配置管理
|
||||
|
||||
-- author:liusq--------date:20200904---for: 新增字段
|
||||
ALTER TABLE `sys_user`
|
||||
ADD COLUMN `client_id` varchar(64) NULL COMMENT '设备ID' AFTER `rel_tenant_ids`;
|
||||
-- author:liusq--------date:20200904---for:新增字段
|
||||
|
||||
|
||||
|
||||
-- author:taoyan--------date:20200723--------for: online权限改造
|
||||
-- ----------------------------
|
||||
-- Table structure for onl_auth_data
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `onl_auth_data`;
|
||||
CREATE TABLE `onl_auth_data` (
|
||||
`id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '主键',
|
||||
`cgform_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'online表ID',
|
||||
`rule_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '规则名',
|
||||
`rule_column` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '规则列',
|
||||
`rule_operator` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '规则条件 大于小于like',
|
||||
`rule_value` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '规则值',
|
||||
`status` int(1) NULL DEFAULT NULL COMMENT '1有效 0无效',
|
||||
`create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
|
||||
`create_by` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建人',
|
||||
`update_by` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新人',
|
||||
`update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新日期',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for onl_auth_page
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `onl_auth_page`;
|
||||
CREATE TABLE `onl_auth_page` (
|
||||
`id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT ' 主键',
|
||||
`cgform_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'online表id',
|
||||
`code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '字段名/按钮编码',
|
||||
`type` int(1) NULL DEFAULT NULL COMMENT '1字段 2按钮',
|
||||
`control` int(1) NULL DEFAULT NULL COMMENT '3可编辑 5可见(仅支持两种状态值3,5)',
|
||||
`page` int(1) NULL DEFAULT NULL COMMENT '3列表 5表单(仅支持两种状态值3,5)',
|
||||
`status` int(1) NULL DEFAULT NULL COMMENT '1有效 0无效',
|
||||
`create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
|
||||
`create_by` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建人',
|
||||
`update_by` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新人',
|
||||
`update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新日期',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for onl_auth_relation
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `onl_auth_relation`;
|
||||
CREATE TABLE `onl_auth_relation` (
|
||||
`id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
|
||||
`role_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '角色id',
|
||||
`auth_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '权限id',
|
||||
`type` int(1) NULL DEFAULT NULL COMMENT '1字段 2按钮 3数据权限',
|
||||
`cgform_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'online表单ID',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||||
-- author:taoyan--------date:20200723--------for: online权限改造
|
||||
|
||||
|
||||
|
||||
|
||||
-- author:liusq----date:20200909----for: 更新大屏表单模版url ------------
|
||||
-- 生产销售监控 --
|
||||
update sys_permission set url='{{ window._CONFIG[\'domianURL\'] }}/test/bigScreen/templat/index1' where id='1205098241075453953';
|
||||
-- 智慧物流监控 --
|
||||
update sys_permission set url='{{ window._CONFIG[\'domianURL\'] }}/test/bigScreen/templat/index2' where id='1205306106780364802';
|
||||
-- author:liusq----date:20200909----for: 更新大屏表单模版url ------------
|
||||
|
||||
|
||||
|
||||
|
||||
94
jeecg-boot/db/增量SQL/2.3升级到2.4增量mysql.sql
Normal file
94
jeecg-boot/db/增量SQL/2.3升级到2.4增量mysql.sql
Normal file
@ -0,0 +1,94 @@
|
||||
|
||||
UPDATE `sys_data_source`
|
||||
SET `id` = '1209779538310004737',
|
||||
`db_password` = 'f5b6775e8d1749483f2320627de0e706'
|
||||
WHERE
|
||||
(`id` = '1209779538310004737');
|
||||
|
||||
delete from `sys_permission` where id='a2b11669e98c5fe54a53c3e3c4f35d14';
|
||||
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `sys_third_account`;
|
||||
CREATE TABLE `sys_third_account` (
|
||||
`id` varchar(32) NOT NULL COMMENT '编号',
|
||||
`sys_user_id` varchar(32) DEFAULT NULL COMMENT '第三方登录id',
|
||||
`third_type` varchar(255) DEFAULT NULL COMMENT '登录来源',
|
||||
`avatar` varchar(255) DEFAULT NULL COMMENT '头像',
|
||||
`status` tinyint(1) DEFAULT NULL COMMENT '状态(1-正常,2-冻结)',
|
||||
`del_flag` tinyint(1) DEFAULT NULL COMMENT '删除状态(0-正常,1-已删除)',
|
||||
`realname` varchar(100) DEFAULT NULL COMMENT '真实姓名',
|
||||
`third_user_uuid` varchar(100) DEFAULT NULL COMMENT '第三方账号',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
ALTER TABLE `sys_user`
|
||||
DROP COLUMN `third_id`
|
||||
DROP COLUMN `third_type`;
|
||||
|
||||
update sys_permission set component = 'examples/list/UserList' where id = '05b3c82ddb2536a4a5ee1a4c46b5abef';
|
||||
update sys_permission set component = 'examples/list/TableList' where id = '078f9558cdeab239aecb2bda1a8ed0d1';
|
||||
update sys_permission set component = 'examples/list/TableList' where id = '200006f0edf145a2b50eacca07585451';
|
||||
update sys_permission set component = 'examples/form/BasicForm' where id = '277bfabef7d76e89b33062b16a9a5020';
|
||||
update sys_permission set component = 'examples/list/TableList' where id = '418964ba087b90a84897b62474496b93';
|
||||
update sys_permission set component = 'examples/list/RoleList' where id = '4f84f9400e5e92c95f05b554724c2b58';
|
||||
update sys_permission set component = 'examples/form/stepForm/StepForm' where id = '6531cf3421b1265aeeeabaab5e176e6d';
|
||||
update sys_permission set component = 'examples/list/PermissionList' where id = '73678f9daa45ed17a3674131b03432fb';
|
||||
update sys_permission set component = 'examples/list/CardList' where id = '7ac9eb9ccbde2f7a033cd4944272bf1e';
|
||||
update sys_permission set component = 'examples/list/TableInnerEditList' where id = 'ae4fed059f67086fd52a73d913cf473d';
|
||||
update sys_permission set component = 'examples/profile/advanced/Advanced' where id = 'b3c824fc22bd953e2eb16ae6914ac8f9';
|
||||
update sys_permission set component = 'examples/profile/basic/Index' where id = 'cc50656cf9ca528e6f2150eba4714ad2';
|
||||
update sys_permission set component = 'examples/list/TableList' where id = 'de13e0f6328c069748de7399fcc1dbbd';
|
||||
update sys_permission set component = 'examples/form/advancedForm/AdvancedForm' where id = 'e5973686ed495c379d829ea8b2881fc6';
|
||||
update sys_permission set component = 'examples/list/StandardList' where id = 'f23d9bfff4d9aa6b68569ba2cff38415';
|
||||
update sys_permission set component = 'examples/list/search/SearchLayout' where id = 'fb07ca05a3e13674dbf6d3245956da2e';
|
||||
|
||||
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `url`, `component`, `component_name`, `redirect`, `menu_type`, `perms`, `perms_type`, `sort_no`, `always_show`, `icon`, `is_route`, `is_leaf`, `keep_alive`, `hidden`, `description`, `status`, `del_flag`, `rule_flag`, `create_by`, `create_time`, `update_by`, `update_time`, `internal_or_external`) VALUES ('1304032910990495745', 'e41b69c57a941a3bbcce45032fe57605', 'AUTO在线表单TAB', '/online/cgformTabList/:code', 'modules/online/cgform/auto/tab/OnlCgformTabList', NULL, NULL, 1, NULL, '1', 8.00, 0, NULL, 1, 1, 0, 1, NULL, '1', 0, 0, 'admin', '2020-09-10 20:24:08', 'admin', '2020-09-10 20:36:37', 0);
|
||||
|
||||
INSERT INTO `sys_dict_item`(`id`, `dict_id`, `item_text`, `item_value`, `description`, `sort_order`, `status`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES ('1305827309355302914', 'bd1b8bc28e65d6feefefb6f3c79f42fd', 'API', 'api', '', 3, 1, 'admin', '2020-09-15 19:14:26', 'admin', '2020-09-15 19:14:41');
|
||||
|
||||
ALTER TABLE `onl_cgreport_item`
|
||||
ADD COLUMN `is_total` varchar(2) COMMENT '是否合计 0否,1是(仅对数值有效)' AFTER `replace_val`;
|
||||
|
||||
ALTER TABLE `onl_cgform_head`
|
||||
ADD COLUMN `is_des_form` varchar(2) COMMENT '是否用设计器表单' AFTER `theme_template`,
|
||||
ADD COLUMN `des_form_code` varchar(50) COMMENT '设计器表单编码' AFTER `is_des_form`;
|
||||
|
||||
ALTER TABLE `onl_cgreport_item`
|
||||
ADD COLUMN `group_title` varchar(50) COMMENT '分组标题' AFTER `is_total`;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `sys_gateway_route`;
|
||||
CREATE TABLE `sys_gateway_route` (
|
||||
`id` varchar(36) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
|
||||
`router_id` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '路由ID',
|
||||
`name` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '服务名',
|
||||
`uri` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '服务地址',
|
||||
`predicates` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '断言',
|
||||
`filters` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '过滤器',
|
||||
`retryable` int(3) NULL DEFAULT NULL COMMENT '是否重试:0-否 1-是',
|
||||
`strip_prefix` int(3) NULL DEFAULT NULL COMMENT '是否忽略前缀0-否 1-是',
|
||||
`persist` int(3) NULL DEFAULT NULL COMMENT '是否为保留数据:0-否 1-是',
|
||||
`show_api` int(3) NULL DEFAULT NULL COMMENT '是否在接口文档中展示:0-否 1-是',
|
||||
`status` int(3) NULL DEFAULT NULL COMMENT '状态:0-无效 1-有效',
|
||||
`create_by` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建人',
|
||||
`create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建日期',
|
||||
`update_by` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '更新人',
|
||||
`update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新日期',
|
||||
`sys_org_code` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '所属部门',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of sys_gateway_route
|
||||
-- ----------------------------
|
||||
delete from `sys_gateway_route`;
|
||||
INSERT INTO `sys_gateway_route`(`id`, `router_id`, `name`, `uri`, `predicates`, `filters`, `retryable`, `strip_prefix`, `persist`, `show_api`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `sys_org_code`) VALUES ('1331051599401857026', 'jeecg-demo-websocket', 'jeecg-demo-websocket', 'lb:ws://jeecg-demo', '[{\"args\":[\"/vxeSocket/**\"],\"name\":\"Path\"}]', '[]', NULL, NULL, NULL, NULL, 1, 'admin', '2020-11-24 09:46:46', NULL, NULL, NULL);
|
||||
INSERT INTO `sys_gateway_route`(`id`, `router_id`, `name`, `uri`, `predicates`, `filters`, `retryable`, `strip_prefix`, `persist`, `show_api`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `sys_org_code`) VALUES ('jeecg-cloud-websocket', 'jeecg-system-websocket', 'jeecg-system-websocket', 'lb:ws://jeecg-system', '[{\"args\":[\"/websocket/**\",\"/eoaSocket/**\",\"/newsWebsocket/**\"],\"name\":\"Path\"}]', '[]', NULL, NULL, NULL, NULL, 1, 'admin', '2020-11-16 19:41:51', NULL, NULL, NULL);
|
||||
INSERT INTO `sys_gateway_route`(`id`, `router_id`, `name`, `uri`, `predicates`, `filters`, `retryable`, `strip_prefix`, `persist`, `show_api`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `sys_org_code`) VALUES ('jeecg-demo', 'jeecg-demo', 'jeecg-demo', 'lb://jeecg-demo', '[{\"args\":[\"/mock/**\",\"/test/**\",\"/bigscreen/template1/**\",\"/bigscreen/template2/**\"],\"name\":\"Path\"}]', '[]', NULL, NULL, NULL, NULL, 1, 'admin', '2020-11-16 19:41:51', NULL, NULL, NULL);
|
||||
INSERT INTO `sys_gateway_route`(`id`, `router_id`, `name`, `uri`, `predicates`, `filters`, `retryable`, `strip_prefix`, `persist`, `show_api`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `sys_org_code`) VALUES ('jeecg-system', 'jeecg-system', 'jeecg-system', 'lb://jeecg-system', '[{\"args\":[\"/sys/**\",\"/eoa/**\",\"/joa/**\",\"/online/**\",\"/bigscreen/**\",\"/jmreport/**\",\"/desform/**\",\"/process/**\",\"/act/**\",\"/plug-in/***/\",\"/druid/**\",\"/generic/**\"],\"name\":\"Path\"}]', '[]', NULL, NULL, NULL, NULL, 1, 'admin', '2020-11-16 19:41:51', NULL, NULL, NULL);
|
||||
|
||||
|
||||
|
||||
|
||||
@ -1,54 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>jeecg-boot-base-api</artifactId>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<version>2.3.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>jeecg-system-cloud-api</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<!-- spring-cloud begin -->
|
||||
<!-- nacos -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
</dependency>
|
||||
<!-- feign -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- sentinel 熔断限流 -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
|
||||
</dependency>
|
||||
<!-- spring-cloud end -->
|
||||
</dependencies>
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<!-- spring-cloud-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-dependencies</artifactId>
|
||||
<version>Greenwich.SR3</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-alibaba-dependencies</artifactId>
|
||||
<version>2.1.0.RELEASE</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
</project>
|
||||
@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>jeecg-boot-base-api</artifactId>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<version>2.4.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>jeecg-system-cloud-api</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<!-- feign -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@ -11,6 +11,9 @@ import org.jeecg.common.system.vo.*;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 进入fallback的方法 检查是否token未设置
|
||||
*/
|
||||
@Slf4j
|
||||
public class SysBaseAPIFallback implements ISysBaseAPI {
|
||||
|
||||
@ -212,6 +215,7 @@ public class SysBaseAPIFallback implements ISysBaseAPI {
|
||||
|
||||
@Override
|
||||
public LoginUser getUserByName(String username) {
|
||||
log.error("通过用户名获取当前登录用户信息 {}", cause);
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>jeecg-boot-base-api</artifactId>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<version>2.3.0</version>
|
||||
<version>2.4.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@ -3,9 +3,9 @@
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>jeecg-boot-parent</artifactId>
|
||||
<artifactId>jeecg-boot-base</artifactId>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<version>2.3.0</version>
|
||||
<version>2.4.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<artifactId>jeecg-boot-base-common</artifactId>
|
||||
<artifactId>jeecg-boot-base-core</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@ -3,12 +3,12 @@
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<artifactId>jeecg-boot-parent</artifactId>
|
||||
<version>2.3.0</version>
|
||||
<artifactId>jeecg-boot-base</artifactId>
|
||||
<version>2.4.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>jeecg-boot-base-common</artifactId>
|
||||
<artifactId>jeecg-boot-base-core</artifactId>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
@ -29,21 +29,13 @@
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<properties>
|
||||
<java.version>1.8</java.version>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<mybatis-plus.version>3.3.2</mybatis-plus.version>
|
||||
<druid.version>1.1.17</druid.version>
|
||||
<jwt.version>0.9.1</jwt.version>
|
||||
<commons.version>2.6</commons.version>
|
||||
<aliyun-java-sdk-dysmsapi.version>1.0.0</aliyun-java-sdk-dysmsapi.version>
|
||||
<aliyun.oss.version>3.6.0</aliyun.oss.version>
|
||||
<guava.version>26.0-jre</guava.version>
|
||||
</properties>
|
||||
|
||||
|
||||
<dependencies>
|
||||
<!--jeecg-tools-->
|
||||
<dependency>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<artifactId>jeecg-boot-base-tools</artifactId>
|
||||
</dependency>
|
||||
<!--集成springmvc框架并实现自动配置 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
@ -66,6 +58,11 @@
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
</dependency>
|
||||
<!--springboot2.3+ 需引入validation对应的包-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-validation</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- commons -->
|
||||
<dependency>
|
||||
@ -103,34 +100,34 @@
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>dynamic-datasource-spring-boot-starter</artifactId>
|
||||
<version>2.5.4</version>
|
||||
<version>${dynamic-datasource-spring-boot-starter.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!--mysql-->
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>8.0.20</version>
|
||||
<version>${mysql-connector-java.version}</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<!-- sqlserver-->
|
||||
<dependency>
|
||||
<groupId>com.microsoft.sqlserver</groupId>
|
||||
<artifactId>sqljdbc4</artifactId>
|
||||
<version>4.0</version>
|
||||
<version>${sqljdbc4.version}</version>
|
||||
</dependency>
|
||||
<!-- oracle驱动 -->
|
||||
<dependency>
|
||||
<groupId>com.oracle</groupId>
|
||||
<artifactId>ojdbc6</artifactId>
|
||||
<version>11.2.0.3</version>
|
||||
<version>${ojdbc6.version}</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<!-- postgresql驱动 -->
|
||||
<dependency>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
<version>42.2.6</version>
|
||||
<version>${postgresql.version}</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
|
||||
@ -144,32 +141,19 @@
|
||||
<dependency>
|
||||
<groupId>com.auth0</groupId>
|
||||
<artifactId>java-jwt</artifactId>
|
||||
<version>3.7.0</version>
|
||||
<version>${java-jwt.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!--shiro-->
|
||||
<dependency>
|
||||
<groupId>org.apache.shiro</groupId>
|
||||
<artifactId>shiro-spring-boot-starter</artifactId>
|
||||
<version>1.5.3</version>
|
||||
<version>${shiro.version}</version>
|
||||
</dependency>
|
||||
<!-- shiro-redis -->
|
||||
<dependency>
|
||||
<groupId>org.crazycake</groupId>
|
||||
<artifactId>shiro-redis</artifactId>
|
||||
<version>3.1.0</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.apache.shiro</groupId>
|
||||
<artifactId>shiro-core</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-re</artifactId>
|
||||
<version>2.3.01</version>
|
||||
<version>2.3.06</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
@ -181,44 +165,24 @@
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- Swagger API文档 -->
|
||||
<!-- shiro-redis -->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger2</artifactId>
|
||||
<version>2.9.2</version>
|
||||
<groupId>org.crazycake</groupId>
|
||||
<artifactId>shiro-redis</artifactId>
|
||||
<version>${shiro-redis.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-annotations</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-models</artifactId>
|
||||
<groupId>org.apache.shiro</groupId>
|
||||
<artifactId>shiro-core</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger-ui</artifactId>
|
||||
<version>2.9.2</version>
|
||||
</dependency>
|
||||
|
||||
<!-- knife4j -->
|
||||
<dependency>
|
||||
<groupId>com.github.xiaoymin</groupId>
|
||||
<artifactId>swagger-bootstrap-ui</artifactId>
|
||||
<version>1.9.6</version>
|
||||
</dependency>
|
||||
<!-- # 增加两个配置解决 NumberFormatException -->
|
||||
<dependency>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-annotations</artifactId>
|
||||
<version>1.5.22</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-models</artifactId>
|
||||
<version>1.5.22</version>
|
||||
<artifactId>knife4j-spring-boot-starter</artifactId>
|
||||
<version>${knife4j-spring-boot-starter.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Redis -->
|
||||
@ -236,14 +200,14 @@
|
||||
<dependency>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<artifactId>codegenerate</artifactId>
|
||||
<version>1.2.2</version>
|
||||
<version>${codegenerate.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- AutoPoi Excel工具类-->
|
||||
<dependency>
|
||||
<groupId>org.jeecgframework</groupId>
|
||||
<artifactId>autopoi-web</artifactId>
|
||||
<version>1.2.2</version>
|
||||
<version>${autopoi-web.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>commons-codec</groupId>
|
||||
@ -252,17 +216,18 @@
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!-- hutool工具类-->
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
<version>5.3.8</version>
|
||||
<version>${hutool-all.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- mini文件存储服务 -->
|
||||
<dependency>
|
||||
<groupId>io.minio</groupId>
|
||||
<artifactId>minio</artifactId>
|
||||
<version>4.0.0</version>
|
||||
<version>${minio.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
@ -282,12 +247,11 @@
|
||||
<artifactId>aliyun-sdk-oss</artifactId>
|
||||
<version>${aliyun.oss.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 第三方登录 -->
|
||||
<dependency>
|
||||
<groupId>com.xkcoding.justauth</groupId>
|
||||
<artifactId>justauth-spring-boot-starter</artifactId>
|
||||
<version>1.3.2</version>
|
||||
<version>${justauth-spring-boot-starter.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
@ -51,7 +51,7 @@ public class PermissionDataAspect {
|
||||
String requestMethod = request.getMethod();
|
||||
String requestPath = request.getRequestURI().substring(request.getContextPath().length());
|
||||
requestPath = filterUrl(requestPath);
|
||||
log.info("拦截请求 >> "+requestPath+";请求类型 >> "+requestMethod);
|
||||
log.debug("拦截请求 >> "+requestPath+";请求类型 >> "+requestMethod);
|
||||
String username = JwtUtil.getUserNameByToken(request);
|
||||
//查询数据权限信息
|
||||
//TODO 微服务情况下也得支持缓存机制
|
||||
@ -48,11 +48,11 @@ public enum UrlMatchEnum {
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
/**
|
||||
* 比如request真实请求URL: /online/cgform/api/getData/81fcf7d8922d45069b0d5ba983612d3a
|
||||
* 转换匹配路由URL后(对应配置的菜单路径):/online/cgformList/81fcf7d8922d45069b0d5ba983612d3a
|
||||
*/
|
||||
System.out.println(UrlMatchEnum.getMatchResultByUrl("/online/cgform/api/getData/81fcf7d8922d45069b0d5ba983612d3a"));
|
||||
}
|
||||
// public static void main(String[] args) {
|
||||
// /**
|
||||
// * 比如request真实请求URL: /online/cgform/api/getData/81fcf7d8922d45069b0d5ba983612d3a
|
||||
// * 转换匹配路由URL后(对应配置的菜单路径):/online/cgformList/81fcf7d8922d45069b0d5ba983612d3a
|
||||
// */
|
||||
// System.out.println(UrlMatchEnum.getMatchResultByUrl("/online/cgform/api/getData/81fcf7d8922d45069b0d5ba983612d3a"));
|
||||
// }
|
||||
}
|
||||
@ -59,4 +59,15 @@ public interface CacheConstant {
|
||||
* gateway路由 reload key
|
||||
*/
|
||||
public static final String ROUTE_JVM_RELOAD_TOPIC = "gateway_jvm_route_reload_topic";
|
||||
|
||||
/**
|
||||
* TODO 冗余代码 待删除
|
||||
*插件商城排行榜
|
||||
*/
|
||||
public static final String PLUGIN_MALL_RANKING = "pluginMall::rankingList";
|
||||
/**
|
||||
* TODO 冗余代码 待删除
|
||||
*插件商城排行榜
|
||||
*/
|
||||
public static final String PLUGIN_MALL_PAGE_LIST = "pluginMall::queryPageList";
|
||||
}
|
||||
@ -30,4 +30,9 @@ public interface ServiceNameConstants {
|
||||
*/
|
||||
String SYSTEM_SERVICE = "jeecg-system";
|
||||
|
||||
/**
|
||||
* gateway通过header传递根路径 basePath
|
||||
*/
|
||||
String X_GATEWAY_BASE_PATH = "X_GATEWAY_BASE_PATH";
|
||||
|
||||
}
|
||||
@ -70,6 +70,16 @@ public class JeecgController<T, S extends IService<T>> {
|
||||
return mv;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据权限导出excel,传入导出字段参数
|
||||
*
|
||||
* @param request
|
||||
*/
|
||||
protected ModelAndView exportXls(HttpServletRequest request, T object, Class<T> clazz, String title,String exportFields) {
|
||||
ModelAndView mv = this.exportXls(request,object,clazz,title);
|
||||
mv.addObject(NormalExcelConstants.EXPORT_FIELDS,exportFields);
|
||||
return mv;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取对象ID
|
||||
@ -1,6 +1,5 @@
|
||||
package org.jeecg.common.system.query;
|
||||
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
@ -19,7 +18,6 @@ import org.springframework.util.NumberUtils;
|
||||
|
||||
import java.beans.PropertyDescriptor;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.lang.reflect.Array;
|
||||
import java.lang.reflect.Field;
|
||||
import java.math.BigDecimal;
|
||||
import java.net.URLDecoder;
|
||||
@ -28,6 +26,7 @@ import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
public class QueryGenerator {
|
||||
@ -55,6 +54,9 @@ public class QueryGenerator {
|
||||
/**排序方式*/
|
||||
private static final String ORDER_TYPE = "order";
|
||||
private static final String ORDER_TYPE_ASC = "ASC";
|
||||
|
||||
/**mysql 模糊查询之特殊字符下划线 (_、\)*/
|
||||
public static final String LIKE_MYSQL_SPECIAL_STRS = "_,%";
|
||||
|
||||
/**时间格式化 */
|
||||
private static final ThreadLocal<SimpleDateFormat> local = new ThreadLocal<SimpleDateFormat>();
|
||||
@ -80,7 +82,7 @@ public class QueryGenerator {
|
||||
log.debug("---查询条件构造器初始化完成,耗时:"+(System.currentTimeMillis()-start)+"毫秒----");
|
||||
return queryWrapper;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 组装Mybatis Plus 查询条件
|
||||
* <p>使用此方法 需要有如下几点注意:
|
||||
@ -109,7 +111,10 @@ public class QueryGenerator {
|
||||
}
|
||||
}
|
||||
|
||||
String name, type;
|
||||
String name, type, column;
|
||||
// update-begin--Author:taoyan Date:20200923 for:issues/1671 如果字段加注解了@TableField(exist = false),不走DB查询-------
|
||||
//定义实体字段和数据库字段名称的映射 高级查询中 只能获取实体字段 如果设置TableField注解 那么查询条件会出问题
|
||||
Map<String,String> fieldColumnMap = new HashMap<String,String>();
|
||||
for (int i = 0; i < origDescriptors.length; i++) {
|
||||
//aliasName = origDescriptors[i].getName(); mybatis 不存在实体属性 不用处理别名的情况
|
||||
name = origDescriptors[i].getName();
|
||||
@ -120,52 +125,24 @@ public class QueryGenerator {
|
||||
}
|
||||
|
||||
Object value = PropertyUtils.getSimpleProperty(searchObj, name);
|
||||
// update-begin--Author:taoyan Date:20200910 for:issues/1671 如果字段加注解了@TableField(exist = false),不走DB查询-------
|
||||
//如果字段加注解了@TableField(exist = false),不走DB查询
|
||||
//TODO 存在缺陷,这个写法 clazz.getDeclaredField(name) 获取不到继承的父实体字段
|
||||
try {
|
||||
if (oConvertUtils.isNotEmpty(value)) {
|
||||
Field field = searchObj.getClass().getDeclaredField(name);
|
||||
if (field != null) {
|
||||
TableField tableField = field.getAnnotation(TableField.class);
|
||||
if (tableField != null && tableField.exist() == false) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
column = getTableFieldName(searchObj.getClass(), name);
|
||||
if(column==null){
|
||||
//column为null只有一种情况 那就是 添加了注解@TableField(exist = false) 后续都不用处理了
|
||||
continue;
|
||||
}
|
||||
// update-end--Author:taoyan Date:20200910 for:issues/1671 如果字段加注解了@TableField(exist = false),不走DB查询 -------
|
||||
|
||||
fieldColumnMap.put(name,column);
|
||||
//数据权限查询
|
||||
if(ruleMap.containsKey(name)) {
|
||||
addRuleToQueryWrapper(ruleMap.get(name), name, origDescriptors[i].getPropertyType(), queryWrapper);
|
||||
addRuleToQueryWrapper(ruleMap.get(name), column, origDescriptors[i].getPropertyType(), queryWrapper);
|
||||
}
|
||||
|
||||
// 添加 判断是否有区间值
|
||||
String endValue = null,beginValue = null;
|
||||
if (parameterMap != null && parameterMap.containsKey(name + BEGIN)) {
|
||||
beginValue = parameterMap.get(name + BEGIN)[0].trim();
|
||||
addQueryByRule(queryWrapper, name, type, beginValue, QueryRuleEnum.GE);
|
||||
|
||||
}
|
||||
if (parameterMap != null && parameterMap.containsKey(name + END)) {
|
||||
endValue = parameterMap.get(name + END)[0].trim();
|
||||
addQueryByRule(queryWrapper, name, type, endValue, QueryRuleEnum.LE);
|
||||
}
|
||||
//多值查询
|
||||
if (parameterMap != null && parameterMap.containsKey(name + MULTI)) {
|
||||
endValue = parameterMap.get(name + MULTI)[0].trim();
|
||||
addQueryByRule(queryWrapper, name.replace(MULTI,""), type, endValue, QueryRuleEnum.IN);
|
||||
}
|
||||
|
||||
//区间查询
|
||||
doIntervalQuery(queryWrapper, parameterMap, type, name, column);
|
||||
//判断单值 参数带不同标识字符串 走不同的查询
|
||||
//TODO 这种前后带逗号的支持分割后模糊查询需要否 使多选字段的查询生效
|
||||
if (null != value && value.toString().startsWith(COMMA) && value.toString().endsWith(COMMA)) {
|
||||
String multiLikeval = value.toString().replace(",,", COMMA);
|
||||
String[] vals = multiLikeval.substring(1, multiLikeval.length()).split(COMMA);
|
||||
final String field = oConvertUtils.camelToUnderline(name);
|
||||
final String field = oConvertUtils.camelToUnderline(column);
|
||||
if(vals.length>1) {
|
||||
queryWrapper.and(j -> {
|
||||
j = j.like(field,vals[0]);
|
||||
@ -187,7 +164,7 @@ public class QueryGenerator {
|
||||
//rule = QueryRuleEnum.LIKE;
|
||||
//}
|
||||
// add -end 添加判断为字符串时设为全模糊查询
|
||||
addEasyQuery(queryWrapper, name, rule, value);
|
||||
addEasyQuery(queryWrapper, column, rule, value);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
@ -198,9 +175,38 @@ public class QueryGenerator {
|
||||
doMultiFieldsOrder(queryWrapper, parameterMap);
|
||||
|
||||
//高级查询
|
||||
doSuperQuery(queryWrapper, parameterMap);
|
||||
doSuperQuery(queryWrapper, parameterMap, fieldColumnMap);
|
||||
// update-end--Author:taoyan Date:20200923 for:issues/1671 如果字段加注解了@TableField(exist = false),不走DB查询-------
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 区间查询
|
||||
* @param queryWrapper query对象
|
||||
* @param parameterMap 参数map
|
||||
* @param type 字段类型
|
||||
* @param filedName 字段名称
|
||||
* @param columnName 列名称
|
||||
*/
|
||||
private static void doIntervalQuery(QueryWrapper<?> queryWrapper, Map<String, String[]> parameterMap, String type, String filedName, String columnName) throws ParseException {
|
||||
// 添加 判断是否有区间值
|
||||
String endValue = null,beginValue = null;
|
||||
if (parameterMap != null && parameterMap.containsKey(filedName + BEGIN)) {
|
||||
beginValue = parameterMap.get(filedName + BEGIN)[0].trim();
|
||||
addQueryByRule(queryWrapper, columnName, type, beginValue, QueryRuleEnum.GE);
|
||||
|
||||
}
|
||||
if (parameterMap != null && parameterMap.containsKey(filedName + END)) {
|
||||
endValue = parameterMap.get(filedName + END)[0].trim();
|
||||
addQueryByRule(queryWrapper, columnName, type, endValue, QueryRuleEnum.LE);
|
||||
}
|
||||
//多值查询
|
||||
if (parameterMap != null && parameterMap.containsKey(filedName + MULTI)) {
|
||||
endValue = parameterMap.get(filedName + MULTI)[0].trim();
|
||||
addQueryByRule(queryWrapper, columnName.replace(MULTI,""), type, endValue, QueryRuleEnum.IN);
|
||||
}
|
||||
}
|
||||
|
||||
//多字段排序 TODO 需要修改前端
|
||||
public static void doMultiFieldsOrder(QueryWrapper<?> queryWrapper,Map<String, String[]> parameterMap) {
|
||||
@ -230,10 +236,11 @@ public class QueryGenerator {
|
||||
|
||||
/**
|
||||
* 高级查询
|
||||
* @param queryWrapper
|
||||
* @param parameterMap
|
||||
* @param queryWrapper 查询对象
|
||||
* @param parameterMap 参数对象
|
||||
* @param fieldColumnMap 实体字段和数据库列对应的map
|
||||
*/
|
||||
public static void doSuperQuery(QueryWrapper<?> queryWrapper,Map<String, String[]> parameterMap) {
|
||||
public static void doSuperQuery(QueryWrapper<?> queryWrapper,Map<String, String[]> parameterMap, Map<String,String> fieldColumnMap) {
|
||||
if(parameterMap!=null&& parameterMap.containsKey(SUPER_QUERY_PARAMS)){
|
||||
String superQueryParams = parameterMap.get(SUPER_QUERY_PARAMS)[0];
|
||||
String superQueryMatchType = parameterMap.get(SUPER_QUERY_MATCH_TYPE) != null ? parameterMap.get(SUPER_QUERY_MATCH_TYPE)[0] : MatchTypeEnum.AND.getValue();
|
||||
@ -254,7 +261,7 @@ public class QueryGenerator {
|
||||
&& oConvertUtils.isNotEmpty(rule.getVal())) {
|
||||
|
||||
log.debug("SuperQuery ==> " + rule.toString());
|
||||
addEasyQuery(andWrapper, rule.getField(), QueryRuleEnum.getByValue(rule.getRule()), rule.getVal());
|
||||
addEasyQuery(andWrapper, fieldColumnMap.get(rule.getField()), QueryRuleEnum.getByValue(rule.getRule()), rule.getVal());
|
||||
|
||||
// 如果拼接方式是OR,就拼接OR
|
||||
if (MatchTypeEnum.OR == matchType && i < (conditions.size() - 1)) {
|
||||
@ -346,10 +353,16 @@ public class QueryGenerator {
|
||||
String val = (value + "").toString().trim();
|
||||
if (rule == QueryRuleEnum.LIKE) {
|
||||
value = val.substring(1, val.length() - 1);
|
||||
//mysql 模糊查询之特殊字符下划线 (_、\)
|
||||
value = specialStrConvert(value.toString());
|
||||
} else if (rule == QueryRuleEnum.LEFT_LIKE || rule == QueryRuleEnum.NE) {
|
||||
value = val.substring(1);
|
||||
//mysql 模糊查询之特殊字符下划线 (_、\)
|
||||
value = specialStrConvert(value.toString());
|
||||
} else if (rule == QueryRuleEnum.RIGHT_LIKE) {
|
||||
value = val.substring(0, val.length() - 1);
|
||||
//mysql 模糊查询之特殊字符下划线 (_、\)
|
||||
value = specialStrConvert(value.toString());
|
||||
} else if (rule == QueryRuleEnum.IN) {
|
||||
value = val.split(",");
|
||||
} else {
|
||||
@ -707,6 +720,10 @@ public class QueryGenerator {
|
||||
return " '"+str+"' ";
|
||||
}
|
||||
}else {
|
||||
// 如果不是字符串 有一种特殊情况 popup调用都走这个逻辑 参数传递的可能是“‘admin’”这种格式的
|
||||
if(DataBaseConstant.DB_TYPE_SQLSERVER.equals(getDbType()) && str.endsWith("'") && str.startsWith("'")){
|
||||
return " N"+str;
|
||||
}
|
||||
return value.toString();
|
||||
}
|
||||
}
|
||||
@ -790,13 +807,17 @@ public class QueryGenerator {
|
||||
sb.append(sql_and+getSqlRuleValue(ruleMap.get(c).getRuleValue()));
|
||||
}
|
||||
}
|
||||
String name;
|
||||
String name, column;
|
||||
for (int i = 0; i < origDescriptors.length; i++) {
|
||||
name = origDescriptors[i].getName();
|
||||
if (judgedIsUselessField(name)) {
|
||||
continue;
|
||||
}
|
||||
if(ruleMap.containsKey(name)) {
|
||||
column = getTableFieldName(clazz, name);
|
||||
if(column==null){
|
||||
continue;
|
||||
}
|
||||
SysPermissionDataRuleModel dataRule = ruleMap.get(name);
|
||||
QueryRuleEnum rule = QueryRuleEnum.getByValue(dataRule.getRuleConditions());
|
||||
Class propType = origDescriptors[i].getPropertyType();
|
||||
@ -807,7 +828,7 @@ public class QueryGenerator {
|
||||
}else {
|
||||
value = NumberUtils.parseNumber(dataRule.getRuleValue(),propType);
|
||||
}
|
||||
String filedSql = getSingleSqlByRule(rule, oConvertUtils.camelToUnderline(name), value,isString);
|
||||
String filedSql = getSingleSqlByRule(rule, oConvertUtils.camelToUnderline(column), value,isString);
|
||||
sb.append(sql_and+filedSql);
|
||||
}
|
||||
}
|
||||
@ -830,14 +851,18 @@ public class QueryGenerator {
|
||||
queryWrapper.and(i ->i.apply(getSqlRuleValue(ruleMap.get(c).getRuleValue())));
|
||||
}
|
||||
}
|
||||
String name;
|
||||
String name, column;
|
||||
for (int i = 0; i < origDescriptors.length; i++) {
|
||||
name = origDescriptors[i].getName();
|
||||
if (judgedIsUselessField(name)) {
|
||||
continue;
|
||||
}
|
||||
column = getTableFieldName(clazz, name);
|
||||
if(column==null){
|
||||
continue;
|
||||
}
|
||||
if(ruleMap.containsKey(name)) {
|
||||
addRuleToQueryWrapper(ruleMap.get(name), name, origDescriptors[i].getPropertyType(), queryWrapper);
|
||||
addRuleToQueryWrapper(ruleMap.get(name), column, origDescriptors[i].getPropertyType(), queryWrapper);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -895,5 +920,87 @@ public class QueryGenerator {
|
||||
private static String getDbType(){
|
||||
return CommonUtils.getDatabaseType();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取class的 包括父类的
|
||||
* @param clazz
|
||||
* @return
|
||||
*/
|
||||
private static List<Field> getClassFields(Class<?> clazz) {
|
||||
List<Field> list = new ArrayList<Field>();
|
||||
Field[] fields;
|
||||
do{
|
||||
fields = clazz.getDeclaredFields();
|
||||
for(int i = 0;i<fields.length;i++){
|
||||
list.add(fields[i]);
|
||||
}
|
||||
clazz = clazz.getSuperclass();
|
||||
}while(clazz!= Object.class&&clazz!=null);
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取表字段名
|
||||
* @param clazz
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
private static String getTableFieldName(Class<?> clazz, String name) {
|
||||
try {
|
||||
//如果字段加注解了@TableField(exist = false),不走DB查询
|
||||
Field field = null;
|
||||
try {
|
||||
field = clazz.getDeclaredField(name);
|
||||
} catch (NoSuchFieldException e) {
|
||||
//e.printStackTrace();
|
||||
}
|
||||
|
||||
//如果为空,则去父类查找字段
|
||||
if (field == null) {
|
||||
List<Field> allFields = getClassFields(clazz);
|
||||
List<Field> searchFields = allFields.stream().filter(a -> a.getName().equals(name)).collect(Collectors.toList());
|
||||
if(searchFields!=null && searchFields.size()>0){
|
||||
field = searchFields.get(0);
|
||||
}
|
||||
}
|
||||
|
||||
if (field != null) {
|
||||
TableField tableField = field.getAnnotation(TableField.class);
|
||||
if (tableField != null){
|
||||
if(tableField.exist() == false){
|
||||
//如果设置了TableField false 这个字段不需要处理
|
||||
return null;
|
||||
}else{
|
||||
String column = tableField.value();
|
||||
//如果设置了TableField value 这个字段是实体字段
|
||||
if(!"".equals(column)){
|
||||
return column;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* mysql 模糊查询之特殊字符下划线 (_、\)
|
||||
*
|
||||
* @param value:
|
||||
* @Return: java.lang.String
|
||||
*/
|
||||
private static String specialStrConvert(String value) {
|
||||
if (DataBaseConstant.DB_TYPE_MYSQL.equals(getDbType())) {
|
||||
String[] special_str = QueryGenerator.LIKE_MYSQL_SPECIAL_STRS.split(",");
|
||||
for (String str : special_str) {
|
||||
if (value.indexOf(str) !=-1) {
|
||||
value = value.replace(str, "\\" + str);
|
||||
}
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
||||
@ -201,8 +201,8 @@ public class JwtUtil {
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
String token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1NjUzMzY1MTMsInVzZXJuYW1lIjoiYWRtaW4ifQ.xjhud_tWCNYBOg_aRlMgOdlZoWFFKB_givNElHNw3X0";
|
||||
System.out.println(JwtUtil.getUsername(token));
|
||||
}
|
||||
// public static void main(String[] args) {
|
||||
// String token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1NjUzMzY1MTMsInVzZXJuYW1lIjoiYWRtaW4ifQ.xjhud_tWCNYBOg_aRlMgOdlZoWFFKB_givNElHNw3X0";
|
||||
// System.out.println(JwtUtil.getUsername(token));
|
||||
// }
|
||||
}
|
||||
@ -114,10 +114,9 @@ public class DySmsHelper {
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) throws ClientException, InterruptedException {
|
||||
JSONObject obj = new JSONObject();
|
||||
obj.put("code", "1234");
|
||||
sendSms("13800138000", obj, DySmsEnum.FORGET_PASSWORD_TEMPLATE_CODE);
|
||||
|
||||
}
|
||||
// public static void main(String[] args) throws ClientException, InterruptedException {
|
||||
// JSONObject obj = new JSONObject();
|
||||
// obj.put("code", "1234");
|
||||
// sendSms("13800138000", obj, DySmsEnum.FORGET_PASSWORD_TEMPLATE_CODE);
|
||||
// }
|
||||
}
|
||||
@ -0,0 +1,436 @@
|
||||
package org.jeecg.common.util;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.poi.POIXMLDocument;
|
||||
import org.apache.poi.hssf.usermodel.HSSFSheet;
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
||||
import org.apache.poi.openxml4j.opc.OPCPackage;
|
||||
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
|
||||
import org.apache.poi.ss.usermodel.*;
|
||||
import org.apache.poi.xssf.usermodel.XSSFSheet;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.jeecgframework.core.util.ApplicationContextUtil;
|
||||
import org.jeecgframework.dict.service.AutoPoiDictServiceI;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.jeecgframework.poi.excel.annotation.ExcelCollection;
|
||||
import org.jeecgframework.poi.excel.annotation.ExcelTarget;
|
||||
import org.jeecgframework.poi.excel.annotation.ExcelVerify;
|
||||
import org.jeecgframework.poi.excel.entity.ImportParams;
|
||||
import org.jeecgframework.poi.excel.entity.params.ExcelCollectionParams;
|
||||
import org.jeecgframework.poi.excel.entity.params.ExcelImportEntity;
|
||||
import org.jeecgframework.poi.excel.entity.params.ExcelVerifyEntity;
|
||||
import org.jeecgframework.poi.exception.excel.ExcelImportException;
|
||||
import org.jeecgframework.poi.exception.excel.enums.ExcelImportEnum;
|
||||
import org.jeecgframework.poi.util.ExcelUtil;
|
||||
import org.jeecgframework.poi.util.PoiPublicUtil;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.PushbackInputStream;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.ParameterizedType;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 验证excel标题是否存在,当前默认有0.8(80%)即可通过验证
|
||||
*/
|
||||
public class FieldPresenceUtil {
|
||||
/**当有标题到达多少可以通过验证*/
|
||||
public static final Double NUM = 0.8;
|
||||
|
||||
public static Boolean fieldPresence(InputStream inputstream, Class<?> pojoClass, ImportParams params) {
|
||||
Workbook book = null;
|
||||
int errorNum = 0;
|
||||
int successNum = 0;
|
||||
if (!(inputstream.markSupported())) {
|
||||
inputstream = new PushbackInputStream(inputstream, 8);
|
||||
}
|
||||
try {
|
||||
if (POIFSFileSystem.hasPOIFSHeader(inputstream)) {
|
||||
book = new HSSFWorkbook(inputstream);
|
||||
} else if (POIXMLDocument.hasOOXMLHeader(inputstream)) {
|
||||
book = new XSSFWorkbook(OPCPackage.open(inputstream));
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} catch (InvalidFormatException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
for (int i = 0; i < params.getSheetNum(); i++) {
|
||||
Row row = null;
|
||||
//跳过表头和标题行
|
||||
Iterator<Row> rows;
|
||||
try{
|
||||
rows= book.getSheetAt(i).rowIterator();
|
||||
}catch (Exception e){
|
||||
//为空说明读取不到,故不是excel
|
||||
throw new RuntimeException("请导入正确格式的excel文件!");
|
||||
}
|
||||
|
||||
|
||||
for (int j = 0; j < params.getTitleRows() + params.getHeadRows(); j++) {
|
||||
try{
|
||||
row = rows.next();
|
||||
}catch (NoSuchElementException e){
|
||||
//为空说明标题不出在,excel格式错误
|
||||
throw new RuntimeException("请填写内容标题!");
|
||||
}
|
||||
}
|
||||
Sheet sheet = book.getSheetAt(i);
|
||||
Map<Integer, String> titlemap = null;
|
||||
try {
|
||||
titlemap = getTitleMap(sheet, params);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
Set<Integer> columnIndexSet = titlemap.keySet();
|
||||
Integer maxColumnIndex = Collections.max(columnIndexSet);
|
||||
Integer minColumnIndex = Collections.min(columnIndexSet);
|
||||
while (rows.hasNext() && (row == null || sheet.getLastRowNum() - row.getRowNum() > params.getLastOfInvalidRow())) {
|
||||
row = rows.next();
|
||||
Map<String, ExcelImportEntity> excelParams = new HashMap<String, ExcelImportEntity>();
|
||||
List<ExcelCollectionParams> excelCollection = new ArrayList<ExcelCollectionParams>();
|
||||
String targetId = null;
|
||||
if (!Map.class.equals(pojoClass)) {
|
||||
Field fileds[] = PoiPublicUtil.getClassFields(pojoClass);
|
||||
ExcelTarget etarget = pojoClass.getAnnotation(ExcelTarget.class);
|
||||
if (etarget != null) {
|
||||
targetId = etarget.value();
|
||||
}
|
||||
try {
|
||||
getAllExcelField(targetId, fileds, excelParams, excelCollection, pojoClass, null);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
try {
|
||||
int firstCellNum = row.getFirstCellNum();
|
||||
if (firstCellNum > minColumnIndex) {
|
||||
firstCellNum = minColumnIndex;
|
||||
}
|
||||
int lastCellNum = row.getLastCellNum();
|
||||
if (lastCellNum < maxColumnIndex + 1) {
|
||||
lastCellNum = maxColumnIndex + 1;
|
||||
}
|
||||
for (int j = firstCellNum, le = lastCellNum; j < le; j++) {
|
||||
String titleString = (String) titlemap.get(j);
|
||||
if (excelParams.containsKey(titleString) || Map.class.equals(pojoClass)) {
|
||||
successNum+=1;
|
||||
}else{
|
||||
if(excelCollection.size()>0){
|
||||
Iterator var33 = excelCollection.iterator();
|
||||
ExcelCollectionParams param = (ExcelCollectionParams)var33.next();
|
||||
if (param.getExcelParams().containsKey(titleString)) {
|
||||
successNum+=1;
|
||||
}else{
|
||||
errorNum+=1;
|
||||
}
|
||||
}else{
|
||||
errorNum+=1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(successNum<errorNum){
|
||||
return false;
|
||||
}else if(successNum>errorNum){
|
||||
if(errorNum>0){
|
||||
double newNumber = (double) successNum / (successNum + errorNum);
|
||||
BigDecimal bg = new BigDecimal(newNumber);
|
||||
double f1 = bg.setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||
if(f1<NUM){
|
||||
return false;
|
||||
}else{
|
||||
return true;
|
||||
}
|
||||
}else{
|
||||
return true;
|
||||
}
|
||||
}else if(successNum==errorNum){
|
||||
return false;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
} catch (ExcelImportException e) {
|
||||
if (!e.getType().equals(ExcelImportEnum.VERIFY_ERROR)) {
|
||||
throw new ExcelImportException(e.getType(), e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文件名称标题
|
||||
* @Author JEECG
|
||||
* @date 20201023
|
||||
* @throws Exception
|
||||
*/
|
||||
private static Map<Integer, String> getTitleMap(Sheet sheet, ImportParams params) throws Exception {
|
||||
Map<Integer, String> titlemap = new HashMap<Integer, String>();
|
||||
Iterator<Cell> cellTitle = null;
|
||||
String collectionName = null;
|
||||
Row headRow = null;
|
||||
int headBegin = params.getTitleRows();
|
||||
int allRowNum = sheet.getPhysicalNumberOfRows();
|
||||
while(headRow == null && headBegin < allRowNum){
|
||||
headRow = sheet.getRow(headBegin++);
|
||||
}
|
||||
if(headRow==null){
|
||||
throw new Exception("不识别该文件");
|
||||
}
|
||||
if (ExcelUtil.isMergedRegion(sheet, headRow.getRowNum(), 0)) {
|
||||
params.setHeadRows(2);
|
||||
}else{
|
||||
params.setHeadRows(1);
|
||||
}
|
||||
cellTitle = headRow.cellIterator();
|
||||
while (cellTitle.hasNext()) {
|
||||
Cell cell = cellTitle.next();
|
||||
String value = getKeyValue(cell);
|
||||
if (StringUtils.isNotEmpty(value)) {
|
||||
titlemap.put(cell.getColumnIndex(), value);//加入表头列表
|
||||
}
|
||||
}
|
||||
|
||||
//多行表头
|
||||
for (int j = headBegin; j < headBegin + params.getHeadRows()-1; j++) {
|
||||
headRow = sheet.getRow(j);
|
||||
cellTitle = headRow.cellIterator();
|
||||
while (cellTitle.hasNext()) {
|
||||
Cell cell = cellTitle.next();
|
||||
String value = getKeyValue(cell);
|
||||
if (StringUtils.isNotEmpty(value)) {
|
||||
int columnIndex = cell.getColumnIndex();
|
||||
//当前cell的上一行是否为合并单元格
|
||||
if(ExcelUtil.isMergedRegion(sheet, cell.getRowIndex()-1, columnIndex)){
|
||||
collectionName = ExcelUtil.getMergedRegionValue(sheet, cell.getRowIndex()-1, columnIndex);
|
||||
if(params.isIgnoreHeader(collectionName)){
|
||||
titlemap.put(cell.getColumnIndex(), value);
|
||||
}else{
|
||||
titlemap.put(cell.getColumnIndex(), collectionName + "_" + value);
|
||||
}
|
||||
}else{
|
||||
titlemap.put(cell.getColumnIndex(), value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return titlemap;
|
||||
}
|
||||
/**
|
||||
* 获取key的值,针对不同类型获取不同的值
|
||||
*
|
||||
* @Author JEECG
|
||||
* @date 20201023
|
||||
* @param cell
|
||||
* @return
|
||||
*/
|
||||
private static String getKeyValue(Cell cell) {
|
||||
if(cell==null){
|
||||
return null;
|
||||
}
|
||||
Object obj = null;
|
||||
switch (cell.getCellType()) {
|
||||
case Cell.CELL_TYPE_STRING:
|
||||
obj = cell.getStringCellValue();
|
||||
break;
|
||||
case Cell.CELL_TYPE_BOOLEAN:
|
||||
obj = cell.getBooleanCellValue();
|
||||
break;
|
||||
case Cell.CELL_TYPE_NUMERIC:
|
||||
obj = cell.getNumericCellValue();
|
||||
break;
|
||||
case Cell.CELL_TYPE_FORMULA:
|
||||
obj = cell.getCellFormula();
|
||||
break;
|
||||
}
|
||||
return obj == null ? null : obj.toString().trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取需要导出的全部字段
|
||||
*
|
||||
*
|
||||
*
|
||||
* @param targetId
|
||||
* 目标ID
|
||||
* @param fields
|
||||
* @param excelCollection
|
||||
* @throws Exception
|
||||
*/
|
||||
public static void getAllExcelField(String targetId, Field[] fields, Map<String, ExcelImportEntity> excelParams, List<ExcelCollectionParams> excelCollection, Class<?> pojoClass, List<Method> getMethods) throws Exception {
|
||||
ExcelImportEntity excelEntity = null;
|
||||
for (int i = 0; i < fields.length; i++) {
|
||||
Field field = fields[i];
|
||||
if (PoiPublicUtil.isNotUserExcelUserThis(null, field, targetId)) {
|
||||
continue;
|
||||
}
|
||||
if (PoiPublicUtil.isCollection(field.getType())) {
|
||||
// 集合对象设置属性
|
||||
ExcelCollectionParams collection = new ExcelCollectionParams();
|
||||
collection.setName(field.getName());
|
||||
Map<String, ExcelImportEntity> temp = new HashMap();
|
||||
ParameterizedType pt = (ParameterizedType)field.getGenericType();
|
||||
Class<?> clz = (Class)pt.getActualTypeArguments()[0];
|
||||
collection.setType(clz);
|
||||
getExcelFieldList(targetId, PoiPublicUtil.getClassFields(clz), clz, temp, (List)null);
|
||||
collection.setExcelParams(temp);
|
||||
collection.setExcelName(((ExcelCollection)field.getAnnotation(ExcelCollection.class)).name());
|
||||
additionalCollectionName(collection);
|
||||
excelCollection.add(collection);
|
||||
} else if (PoiPublicUtil.isJavaClass(field)) {
|
||||
addEntityToMap(targetId, field, (ExcelImportEntity)excelEntity, pojoClass, getMethods, excelParams);
|
||||
} else {
|
||||
List<Method> newMethods = new ArrayList<Method>();
|
||||
if (getMethods != null) {
|
||||
newMethods.addAll(getMethods);
|
||||
}
|
||||
newMethods.add(PoiPublicUtil.getMethod(field.getName(), pojoClass));
|
||||
getAllExcelField(targetId, PoiPublicUtil.getClassFields(field.getType()), excelParams, excelCollection, field.getType(), newMethods);
|
||||
}
|
||||
}
|
||||
}
|
||||
public static void getExcelFieldList(String targetId, Field[] fields, Class<?> pojoClass, Map<String, ExcelImportEntity> temp, List<Method> getMethods) throws Exception {
|
||||
ExcelImportEntity excelEntity = null;
|
||||
for (int i = 0; i < fields.length; i++) {
|
||||
Field field = fields[i];
|
||||
if (!PoiPublicUtil.isNotUserExcelUserThis((List)null, field, targetId)) {
|
||||
if (PoiPublicUtil.isJavaClass(field)) {
|
||||
addEntityToMap(targetId, field, (ExcelImportEntity)excelEntity, pojoClass, getMethods, temp);
|
||||
} else {
|
||||
List<Method> newMethods = new ArrayList();
|
||||
if (getMethods != null) {
|
||||
newMethods.addAll(getMethods);
|
||||
}
|
||||
|
||||
newMethods.add(PoiPublicUtil.getMethod(field.getName(), pojoClass, field.getType()));
|
||||
getExcelFieldList(targetId, PoiPublicUtil.getClassFields(field.getType()), field.getType(), temp, newMethods);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 追加集合名称到前面
|
||||
*
|
||||
* @param collection
|
||||
*/
|
||||
private static void additionalCollectionName(ExcelCollectionParams collection) {
|
||||
Set<String> keys = new HashSet();
|
||||
keys.addAll(collection.getExcelParams().keySet());
|
||||
Iterator var3 = keys.iterator();
|
||||
|
||||
while(var3.hasNext()) {
|
||||
String key = (String)var3.next();
|
||||
collection.getExcelParams().put(collection.getExcelName() + "_" + key, collection.getExcelParams().get(key));
|
||||
collection.getExcelParams().remove(key);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 把这个注解解析放到类型对象中
|
||||
*
|
||||
* @param targetId
|
||||
* @param field
|
||||
* @param excelEntity
|
||||
* @param pojoClass
|
||||
* @param getMethods
|
||||
* @param temp
|
||||
* @throws Exception
|
||||
*/
|
||||
public static void addEntityToMap(String targetId, Field field, ExcelImportEntity excelEntity, Class<?> pojoClass, List<Method> getMethods, Map<String, ExcelImportEntity> temp) throws Exception {
|
||||
Excel excel = field.getAnnotation(Excel.class);
|
||||
excelEntity = new ExcelImportEntity();
|
||||
excelEntity.setType(excel.type());
|
||||
excelEntity.setSaveUrl(excel.savePath());
|
||||
excelEntity.setSaveType(excel.imageType());
|
||||
excelEntity.setReplace(excel.replace());
|
||||
excelEntity.setDatabaseFormat(excel.databaseFormat());
|
||||
excelEntity.setVerify(getImportVerify(field));
|
||||
excelEntity.setSuffix(excel.suffix());
|
||||
excelEntity.setNumFormat(excel.numFormat());
|
||||
excelEntity.setGroupName(excel.groupName());
|
||||
//update-begin-author:taoYan date:20180202 for:TASK #2067 【bug excel 问题】excel导入字典文本翻译问题
|
||||
excelEntity.setMultiReplace(excel.multiReplace());
|
||||
if(StringUtils.isNotEmpty(excel.dicCode())){
|
||||
AutoPoiDictServiceI jeecgDictService = null;
|
||||
try {
|
||||
jeecgDictService = ApplicationContextUtil.getContext().getBean(AutoPoiDictServiceI.class);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
if(jeecgDictService!=null){
|
||||
String[] dictReplace = jeecgDictService.queryDict(excel.dictTable(), excel.dicCode(), excel.dicText());
|
||||
if(excelEntity.getReplace()!=null && dictReplace!=null && dictReplace.length!=0){
|
||||
excelEntity.setReplace(dictReplace);
|
||||
}
|
||||
}
|
||||
}
|
||||
//update-end-author:taoYan date:20180202 for:TASK #2067 【bug excel 问题】excel导入字典文本翻译问题
|
||||
getExcelField(targetId, field, excelEntity, excel, pojoClass);
|
||||
if (getMethods != null) {
|
||||
List<Method> newMethods = new ArrayList<Method>();
|
||||
newMethods.addAll(getMethods);
|
||||
newMethods.add(excelEntity.getMethod());
|
||||
excelEntity.setMethods(newMethods);
|
||||
}
|
||||
temp.put(excelEntity.getName(), excelEntity);
|
||||
|
||||
}
|
||||
public static void getExcelField(String targetId, Field field, ExcelImportEntity excelEntity, Excel excel, Class<?> pojoClass) throws Exception {
|
||||
excelEntity.setName(getExcelName(excel.name(), targetId));
|
||||
String fieldname = field.getName();
|
||||
//update-begin-author:taoyan for:TASK #2798 【例子】导入扩展方法,支持自定义导入字段转换规则
|
||||
excelEntity.setMethod(PoiPublicUtil.getMethod(fieldname, pojoClass, field.getType(),excel.importConvert()));
|
||||
//update-end-author:taoyan for:TASK #2798 【例子】导入扩展方法,支持自定义导入字段转换规则
|
||||
if (StringUtils.isNotEmpty(excel.importFormat())) {
|
||||
excelEntity.setFormat(excel.importFormat());
|
||||
} else {
|
||||
excelEntity.setFormat(excel.format());
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 判断在这个单元格显示的名称
|
||||
*
|
||||
* @param exportName
|
||||
* @param targetId
|
||||
* @return
|
||||
*/
|
||||
public static String getExcelName(String exportName, String targetId) {
|
||||
if (exportName.indexOf("_") < 0) {
|
||||
return exportName;
|
||||
}
|
||||
String[] arr = exportName.split(",");
|
||||
for (String str : arr) {
|
||||
if (str.indexOf(targetId) != -1) {
|
||||
return str.split("_")[0];
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* 获取导入校验参数
|
||||
*
|
||||
* @param field
|
||||
* @return
|
||||
*/
|
||||
public static ExcelVerifyEntity getImportVerify(Field field) {
|
||||
ExcelVerify verify = field.getAnnotation(ExcelVerify.class);
|
||||
if (verify != null) {
|
||||
ExcelVerifyEntity entity = new ExcelVerifyEntity();
|
||||
entity.setEmail(verify.isEmail());
|
||||
entity.setInterHandler(verify.interHandler());
|
||||
entity.setMaxLength(verify.maxLength());
|
||||
entity.setMinLength(verify.minLength());
|
||||
entity.setMobile(verify.isMobile());
|
||||
entity.setNotNull(verify.notNull());
|
||||
entity.setRegex(verify.regex());
|
||||
entity.setRegexTip(verify.regexTip());
|
||||
entity.setTel(verify.isTel());
|
||||
return entity;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -3,6 +3,7 @@ package org.jeecg.common.util;
|
||||
import io.minio.MinioClient;
|
||||
import io.minio.errors.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.util.filter.StrAttackFilter;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
||||
|
||||
@ -55,6 +56,9 @@ public class MinioUtil {
|
||||
*/
|
||||
public static String upload(MultipartFile file, String bizPath, String customBucket) {
|
||||
String file_url = "";
|
||||
//update-begin-author:wangshuai date:20201012 for: 过滤上传文件夹名特殊字符,防止攻击
|
||||
bizPath=StrAttackFilter.filter(bizPath);
|
||||
//update-end-author:wangshuai date:20201012 for: 过滤上传文件夹名特殊字符,防止攻击
|
||||
String newBucket = bucketName;
|
||||
if(oConvertUtils.isNotEmpty(customBucket)){
|
||||
newBucket = customBucket;
|
||||
@ -19,7 +19,7 @@ public class RestDesformUtil {
|
||||
|
||||
static {
|
||||
domain = SpringContextUtils.getDomain();
|
||||
path = SpringContextUtils.getApplicationContext().getEnvironment().getProperty("server.servlet.context-path");
|
||||
path = oConvertUtils.getString(SpringContextUtils.getApplicationContext().getEnvironment().getProperty("server.servlet.context-path"));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1,6 +1,7 @@
|
||||
package org.jeecg.common.util;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.http.*;
|
||||
import org.springframework.http.client.SimpleClientHttpRequestFactory;
|
||||
@ -16,6 +17,7 @@ import java.util.Map;
|
||||
*
|
||||
* @author sunjianlei
|
||||
*/
|
||||
@Slf4j
|
||||
public class RestUtil {
|
||||
|
||||
private static String domain = null;
|
||||
@ -33,11 +35,13 @@ public class RestUtil {
|
||||
if (path == null) {
|
||||
path = SpringContextUtils.getApplicationContext().getEnvironment().getProperty("server.servlet.context-path");
|
||||
}
|
||||
return path;
|
||||
return oConvertUtils.getString(path);
|
||||
}
|
||||
|
||||
public static String getBaseUrl() {
|
||||
return getDomain() + getPath();
|
||||
String basepath = getDomain() + getPath();
|
||||
log.info(" RestUtil.getBaseUrl: " + basepath);
|
||||
return basepath;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -182,6 +186,7 @@ public class RestUtil {
|
||||
* @return ResponseEntity<responseType>
|
||||
*/
|
||||
public static <T> ResponseEntity<T> request(String url, HttpMethod method, HttpHeaders headers, JSONObject variables, Object params, Class<T> responseType) {
|
||||
log.info(" RestUtil --- request --- url = "+ url);
|
||||
if (StringUtils.isEmpty(url)) {
|
||||
throw new RuntimeException("url 不能为空");
|
||||
}
|
||||
@ -2,6 +2,7 @@ package org.jeecg.common.util;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.jeecg.common.constant.ServiceNameConstants;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
@ -38,10 +39,19 @@ public class SpringContextUtils implements ApplicationContextAware {
|
||||
return ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取项目根路径 basePath
|
||||
*/
|
||||
public static String getDomain(){
|
||||
HttpServletRequest request = getHttpServletRequest();
|
||||
StringBuffer url = request.getRequestURL();
|
||||
return url.delete(url.length() - request.getRequestURI().length(), url.length()).toString();
|
||||
//微服务情况下,获取gateway的basePath
|
||||
String basePath = request.getHeader(ServiceNameConstants.X_GATEWAY_BASE_PATH);
|
||||
if(oConvertUtils.isNotEmpty(basePath)){
|
||||
return basePath;
|
||||
}else{
|
||||
return url.delete(url.length() - request.getRequestURI().length(), url.length()).toString();
|
||||
}
|
||||
}
|
||||
|
||||
public static String getOrigin(){
|
||||
@ -17,7 +17,7 @@ public class SqlInjectionUtil {
|
||||
* (上线修改值 20200501,同步修改前端的盐值)
|
||||
*/
|
||||
private final static String TABLE_DICT_SIGN_SALT = "20200501";
|
||||
private final static String xssStr = "'|and |exec |insert |select |delete |update |drop |count |chr |mid |master |truncate |char |declare |;|or |+|,";
|
||||
private final static String xssStr = "'|and |exec |insert |select |delete |update |drop |count |chr |mid |master |truncate |char |declare |;|or |+";
|
||||
|
||||
/*
|
||||
* 针对表字典进行额外的sign签名校验(增加安全机制)
|
||||
@ -36,7 +36,7 @@ public class TokenUtils {
|
||||
* 验证Token
|
||||
*/
|
||||
public static boolean verifyToken(HttpServletRequest request, CommonAPI commonAPI, RedisUtil redisUtil) {
|
||||
log.info(" -- url --" + request.getRequestURL());
|
||||
log.debug(" -- url --" + request.getRequestURL());
|
||||
String token = getTokenByRequest(request);
|
||||
|
||||
if (StringUtils.isBlank(token)) {
|
||||
@ -165,9 +165,9 @@ public class YouBianCodeUtil {
|
||||
}
|
||||
|
||||
}
|
||||
public static void main(String[] args) {
|
||||
// org.jeecgframework.core.util.LogUtil.info(getNextZiMu('C'));
|
||||
// org.jeecgframework.core.util.LogUtil.info(getNextNum(8));
|
||||
// org.jeecgframework.core.util.LogUtil.info(cutYouBianCode("C99A01B01")[2]);
|
||||
}
|
||||
// public static void main(String[] args) {
|
||||
// // org.jeecgframework.core.util.LogUtil.info(getNextZiMu('C'));
|
||||
// // org.jeecgframework.core.util.LogUtil.info(getNextNum(8));
|
||||
// // org.jeecgframework.core.util.LogUtil.info(cutYouBianCode("C99A01B01")[2]);
|
||||
// }
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user