JeecgBoot 2.4.2 积木报表版本发布,基于SpringBoot的低代码平台
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
Jeecg-Boot 低代码开发平台
|
||||
===============
|
||||
|
||||
当前最新版本: 2.4.0(发布日期:20201201)
|
||||
当前最新版本: 2.4.2(发布日期:20210126)
|
||||
|
||||
|
||||
## 后端技术架构
|
||||
|
||||
+1955
-224
File diff suppressed because one or more lines are too long
+4350
-1246
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,94 +0,0 @@
|
||||
|
||||
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);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
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 ('1334440962954936321', '1209733563293962241', 'MYSQL5.7', '4', NULL, '1', '1', 'admin', '2020-12-03 18:16:02', 'admin', '2020-12-03 18:16:02');
|
||||
UPDATE SYS_DICT_ITEM SET ITEM_TEXT = 'MySQL5.5' WHERE ID = '1209733775114702850';
|
||||
UPDATE SYS_DICT_ITEM SET SORT_ORDER = '3' WHERE ID = '1209733839933476865';
|
||||
UPDATE SYS_DICT_ITEM SET SORT_ORDER = '4' WHERE ID = '1209733903020003330';
|
||||
|
||||
ALTER TABLE `sys_gateway_route`
|
||||
CHANGE COLUMN `persist` `persistable` int(3) NULL DEFAULT NULL COMMENT '是否为保留数据:0-否 1-是' AFTER `strip_prefix`;
|
||||
|
||||
DROP TABLE IF EXISTS `test_online_link`;
|
||||
CREATE TABLE `test_online_link` (
|
||||
`id` varchar(32) NOT NULL,
|
||||
`pid` varchar(32) DEFAULT NULL COMMENT 'pid',
|
||||
`name` varchar(255) DEFAULT NULL COMMENT 'name',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
INSERT INTO `test_online_link` VALUES ('1', NULL, '中国');
|
||||
INSERT INTO `test_online_link` VALUES ('10', '8', '庐阳区');
|
||||
INSERT INTO `test_online_link` VALUES ('11', '7', '黄山市');
|
||||
INSERT INTO `test_online_link` VALUES ('2', '1', '山东省');
|
||||
INSERT INTO `test_online_link` VALUES ('3', '2', '济南市');
|
||||
INSERT INTO `test_online_link` VALUES ('4', '3', '历城区');
|
||||
INSERT INTO `test_online_link` VALUES ('5', '3', '长青区');
|
||||
INSERT INTO `test_online_link` VALUES ('6', '2', '青岛市');
|
||||
INSERT INTO `test_online_link` VALUES ('7', '1', '安徽省');
|
||||
INSERT INTO `test_online_link` VALUES ('8', '7', '合肥市');
|
||||
INSERT INTO `test_online_link` VALUES ('9', '8', '包河区');
|
||||
|
||||
update ONL_CGFORM_FIELD set DB_TYPE = 'Date' WHERE DB_TYPE = 'date';
|
||||
File diff suppressed because one or more lines are too long
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>jeecg-boot-base-api</artifactId>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<version>2.4.0</version>
|
||||
<version>2.4.2</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
+38
-14
@@ -140,7 +140,7 @@ public interface ISysBaseAPI extends CommonAPI {
|
||||
* 15根据业务类型 busType 及业务 busId 修改消息已读
|
||||
*/
|
||||
@GetMapping("/sys/api/updateSysAnnounReadFlag")
|
||||
public void updateSysAnnounReadFlag(@RequestParam("busType") String busType, @RequestParam("busId")String busId);
|
||||
public void updateSysAnnounReadFlag(@RequestParam("busType") String busType, @RequestParam("busId") String busId);
|
||||
|
||||
/**
|
||||
* 16查询表字典 支持过滤数据
|
||||
@@ -177,7 +177,7 @@ public interface ISysBaseAPI extends CommonAPI {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/sys/api/queryAllUser")
|
||||
public JSONObject queryAllUser(@RequestParam(name="userIds",required=false)String userIds, @RequestParam(name="pageNo",required=false) Integer pageNo,@RequestParam(name="pageSize",required=false) int pageSize);
|
||||
public JSONObject queryAllUser(@RequestParam(name = "userIds", required = false) String userIds, @RequestParam(name = "pageNo", required = false) Integer pageNo, @RequestParam(name = "pageSize", required = false) int pageSize);
|
||||
|
||||
|
||||
/**
|
||||
@@ -186,7 +186,7 @@ public interface ISysBaseAPI extends CommonAPI {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/sys/api/queryAllRole")
|
||||
public List<ComboModel> queryAllRole(@RequestParam(name = "roleIds",required = false)String[] roleIds);
|
||||
public List<ComboModel> queryAllRole(@RequestParam(name = "roleIds", required = false) String[] roleIds);
|
||||
|
||||
/**
|
||||
* 21通过用户账号查询角色Id集合
|
||||
@@ -194,7 +194,7 @@ public interface ISysBaseAPI extends CommonAPI {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/sys/api/getRoleIdsByUsername")
|
||||
public List<String> getRoleIdsByUsername(@RequestParam("username")String username);
|
||||
public List<String> getRoleIdsByUsername(@RequestParam("username") String username);
|
||||
|
||||
/**
|
||||
* 22通过部门编号查询部门id
|
||||
@@ -202,7 +202,7 @@ public interface ISysBaseAPI extends CommonAPI {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/sys/api/getDepartIdsByOrgCode")
|
||||
public String getDepartIdsByOrgCode(@RequestParam("orgCode")String orgCode);
|
||||
public String getDepartIdsByOrgCode(@RequestParam("orgCode") String orgCode);
|
||||
|
||||
/**
|
||||
* 23查询所有部门
|
||||
@@ -217,7 +217,7 @@ public interface ISysBaseAPI extends CommonAPI {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/sys/api/getParentDepartId")
|
||||
DictModel getParentDepartId(@RequestParam("departId")String departId);
|
||||
DictModel getParentDepartId(@RequestParam("departId") String departId);
|
||||
|
||||
/**
|
||||
* 25根据部门Id获取部门负责人
|
||||
@@ -233,7 +233,7 @@ public interface ISysBaseAPI extends CommonAPI {
|
||||
* @param cmd
|
||||
*/
|
||||
@GetMapping("/sys/api/sendWebSocketMsg")
|
||||
public void sendWebSocketMsg(@RequestParam("userIds")String[] userIds, @RequestParam("cmd") String cmd);
|
||||
public void sendWebSocketMsg(@RequestParam("userIds") String[] userIds, @RequestParam("cmd") String cmd);
|
||||
|
||||
/**
|
||||
* 27根据id获取所有参与用户
|
||||
@@ -250,7 +250,7 @@ public interface ISysBaseAPI extends CommonAPI {
|
||||
* @param userId
|
||||
*/
|
||||
@GetMapping("/sys/api/meetingSignWebsocket")
|
||||
void meetingSignWebsocket(@RequestParam("userId")String userId);
|
||||
void meetingSignWebsocket(@RequestParam("userId") String userId);
|
||||
|
||||
/**
|
||||
* 29根据name获取所有参与用户
|
||||
@@ -258,7 +258,7 @@ public interface ISysBaseAPI extends CommonAPI {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/sys/api/queryUserByNames")
|
||||
List<LoginUser> queryUserByNames(@RequestParam("userNames")String[] userNames);
|
||||
List<LoginUser> queryUserByNames(@RequestParam("userNames") String[] userNames);
|
||||
|
||||
|
||||
/**
|
||||
@@ -267,7 +267,7 @@ public interface ISysBaseAPI extends CommonAPI {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/sys/api/getUserRoleSet")
|
||||
Set<String> getUserRoleSet(@RequestParam("username")String username);
|
||||
Set<String> getUserRoleSet(@RequestParam("username") String username);
|
||||
|
||||
/**
|
||||
* 31获取用户的权限集合
|
||||
@@ -308,7 +308,7 @@ public interface ISysBaseAPI extends CommonAPI {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/sys/api/queryUserRoles")
|
||||
Set<String> queryUserRoles(@RequestParam("username")String username);
|
||||
Set<String> queryUserRoles(@RequestParam("username") String username);
|
||||
|
||||
/**
|
||||
* 36查询用户权限信息
|
||||
@@ -316,7 +316,7 @@ public interface ISysBaseAPI extends CommonAPI {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/sys/api/queryUserAuths")
|
||||
Set<String> queryUserAuths(@RequestParam("username")String username);
|
||||
Set<String> queryUserAuths(@RequestParam("username") String username);
|
||||
|
||||
/**
|
||||
* 37根据 id 查询数据库中存储的 DynamicDataSourceModel
|
||||
@@ -368,7 +368,7 @@ public interface ISysBaseAPI extends CommonAPI {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/sys/api/queryPermissionDataRule")
|
||||
List<SysPermissionDataRuleModel> queryPermissionDataRule(@RequestParam("component") String component, @RequestParam("requestPath")String requestPath, @RequestParam("username") String username);
|
||||
List<SysPermissionDataRuleModel> queryPermissionDataRule(@RequestParam("component") String component, @RequestParam("requestPath") String requestPath, @RequestParam("username") String username);
|
||||
|
||||
/**
|
||||
* 43查询用户信息
|
||||
@@ -387,10 +387,34 @@ public interface ISysBaseAPI extends CommonAPI {
|
||||
List<JSONObject> queryUsersByUsernames(String usernames);
|
||||
|
||||
/**
|
||||
* 37根据多个部门编码(逗号分隔),查询返回多个部门信息
|
||||
* 37根据多个用户ID(逗号分隔),查询返回多个用户信息
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/sys/api/queryUsersByIds")
|
||||
List<JSONObject> queryUsersByIds(String ids);
|
||||
|
||||
/**
|
||||
* 38根据多个部门编码(逗号分隔),查询返回多个部门信息
|
||||
* @param orgCodes
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/sys/api/queryDepartsByOrgcodes")
|
||||
List<JSONObject> queryDepartsByOrgcodes(String orgCodes);
|
||||
/**
|
||||
* 39根据多个部门编码(逗号分隔),查询返回多个部门信息
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/sys/api/queryDepartsByOrgIds")
|
||||
List<JSONObject> queryDepartsByOrgIds(String ids);
|
||||
|
||||
/**
|
||||
* 40发送邮件消息
|
||||
* @param email
|
||||
* @param title
|
||||
* @param content
|
||||
*/
|
||||
@GetMapping("/sys/api/sendEmailMsg")
|
||||
void sendEmailMsg(@RequestParam("email") String email, @RequestParam("title") String title, @RequestParam("content") String content);
|
||||
}
|
||||
|
||||
+14
@@ -245,8 +245,22 @@ public class SysBaseAPIFallback implements ISysBaseAPI {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<JSONObject> queryUsersByIds(String ids) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<JSONObject> queryDepartsByOrgcodes(String orgCodes) {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public void sendEmailMsg(String email,String title,String content) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<JSONObject> queryDepartsByOrgIds(String ids) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>jeecg-boot-base-api</artifactId>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<version>2.4.0</version>
|
||||
<version>2.4.2</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
+23
-1
@@ -269,10 +269,32 @@ public interface ISysBaseAPI extends CommonAPI {
|
||||
List<JSONObject> queryUsersByUsernames(String usernames);
|
||||
|
||||
/**
|
||||
* 37根据多个部门编码(逗号分隔),查询返回多个部门信息
|
||||
* 37根据多个用户ID(逗号分隔),查询返回多个用户信息
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
List<JSONObject> queryUsersByIds(String ids);
|
||||
|
||||
/**
|
||||
* 38根据多个部门编码(逗号分隔),查询返回多个部门信息
|
||||
* @param orgCodes
|
||||
* @return
|
||||
*/
|
||||
List<JSONObject> queryDepartsByOrgcodes(String orgCodes);
|
||||
|
||||
/**
|
||||
* 39根据多个部门id(逗号分隔),查询返回多个部门信息
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
List<JSONObject> queryDepartsByIds(String ids);
|
||||
|
||||
/**
|
||||
* 40发送邮件消息
|
||||
* @param email
|
||||
* @param title
|
||||
* @param content
|
||||
*/
|
||||
void sendEmailMsg(String email,String title,String content);
|
||||
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>jeecg-boot-base</artifactId>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<version>2.4.0</version>
|
||||
<version>2.4.2</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<artifactId>jeecg-boot-base</artifactId>
|
||||
<version>2.4.0</version>
|
||||
<version>2.4.2</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -75,13 +75,6 @@
|
||||
<artifactId>commons-lang</artifactId>
|
||||
<version>${commons.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 拼音库 -->
|
||||
<dependency>
|
||||
<groupId>com.belerweb</groupId>
|
||||
<artifactId>pinyin4j</artifactId>
|
||||
<version>${pinyin4j.version}</version>
|
||||
</dependency>
|
||||
<!-- freemarker -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
@@ -121,6 +114,7 @@
|
||||
<groupId>com.microsoft.sqlserver</groupId>
|
||||
<artifactId>sqljdbc4</artifactId>
|
||||
<version>${sqljdbc4.version}</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<!-- oracle驱动 -->
|
||||
<dependency>
|
||||
@@ -159,7 +153,7 @@
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-re</artifactId>
|
||||
<version>2.3.07</version>
|
||||
<version>2.4.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
@@ -226,17 +220,6 @@
|
||||
<dependency>
|
||||
<groupId>io.minio</groupId>
|
||||
<artifactId>minio</artifactId>
|
||||
<version>${minio.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>okio</artifactId>
|
||||
<groupId>com.squareup.okio</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>okhttp</artifactId>
|
||||
<groupId>com.squareup.okhttp3</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
@@ -260,17 +243,6 @@
|
||||
<dependency>
|
||||
<groupId>com.xkcoding.justauth</groupId>
|
||||
<artifactId>justauth-spring-boot-starter</artifactId>
|
||||
<version>${justauth-spring-boot-starter.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>hutool-core</artifactId>
|
||||
<groupId>cn.hutool</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>fastjson</artifactId>
|
||||
<groupId>com.alibaba</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.squareup.okhttp3</groupId>
|
||||
|
||||
+1
-1
@@ -52,7 +52,7 @@ public interface CacheConstant {
|
||||
/**
|
||||
* gateway路由缓存
|
||||
*/
|
||||
public static final String GATEWAY_ROUTES = "geteway_routes";
|
||||
public static final String GATEWAY_ROUTES = "gateway_routes";
|
||||
|
||||
|
||||
/**
|
||||
|
||||
+3
-7
@@ -1,6 +1,7 @@
|
||||
package org.jeecg.common.constant;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -14,10 +15,6 @@ import java.util.List;
|
||||
|
||||
@Component("pca")
|
||||
public class ProvinceCityArea {
|
||||
|
||||
@Value("classpath:static/pca.json")
|
||||
private Resource jsonData;
|
||||
|
||||
List<Area> areaList;
|
||||
|
||||
public String getText(String code){
|
||||
@@ -57,8 +54,7 @@ public class ProvinceCityArea {
|
||||
if(this.areaList==null || this.areaList.size()==0){
|
||||
this.areaList = new ArrayList<Area>();
|
||||
try {
|
||||
File file = jsonData.getFile();
|
||||
String jsonData = this.jsonRead(file);
|
||||
String jsonData = oConvertUtils.readStatic("classpath:static/pca.json");
|
||||
JSONObject baseJson = JSONObject.parseObject(jsonData);
|
||||
//第一层 省
|
||||
JSONObject provinceJson = baseJson.getJSONObject("86");
|
||||
@@ -83,7 +79,7 @@ public class ProvinceCityArea {
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ package org.jeecg.common.es;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.jeecg.common.util.RestUtil;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
|
||||
-1
@@ -1,6 +1,5 @@
|
||||
package org.jeecg.common.system.query;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
|
||||
/**
|
||||
|
||||
+96
-16
@@ -40,6 +40,10 @@ public class QueryGenerator {
|
||||
private static final String MULTI = "_MultiString";
|
||||
private static final String STAR = "*";
|
||||
private static final String COMMA = ",";
|
||||
/**
|
||||
* 查询 逗号转义符 相当于一个逗号【作废】
|
||||
*/
|
||||
public static final String QUERY_COMMA_ESCAPE = "++";
|
||||
private static final String NOT_EQUAL = "!";
|
||||
/**页面带有规则值查询,空格作为分隔符*/
|
||||
private static final String QUERY_SEPARATE_KEYWORD = " ";
|
||||
@@ -261,7 +265,16 @@ public class QueryGenerator {
|
||||
&& oConvertUtils.isNotEmpty(rule.getVal())) {
|
||||
|
||||
log.debug("SuperQuery ==> " + rule.toString());
|
||||
addEasyQuery(andWrapper, fieldColumnMap.get(rule.getField()), QueryRuleEnum.getByValue(rule.getRule()), rule.getVal());
|
||||
|
||||
//update-begin-author:taoyan date:20201228 for: 【高级查询】 oracle 日期等于查询报错
|
||||
Object queryValue = rule.getVal();
|
||||
if("date".equals(rule.getType())){
|
||||
queryValue = DateUtils.str2Date(rule.getVal(),DateUtils.date_sdf.get());
|
||||
}else if("datetime".equals(rule.getType())){
|
||||
queryValue = DateUtils.str2Date(rule.getVal(), DateUtils.datetimeFormat.get());
|
||||
}
|
||||
addEasyQuery(andWrapper, fieldColumnMap.get(rule.getField()), QueryRuleEnum.getByValue(rule.getRule()), queryValue);
|
||||
//update-end-author:taoyan date:20201228 for: 【高级查询】 oracle 日期等于查询报错
|
||||
|
||||
// 如果拼接方式是OR,就拼接OR
|
||||
if (MatchTypeEnum.OR == matchType && i < (conditions.size() - 1)) {
|
||||
@@ -324,6 +337,7 @@ public class QueryGenerator {
|
||||
rule = QueryRuleEnum.RIGHT_LIKE;
|
||||
}
|
||||
}
|
||||
|
||||
// step 4 in
|
||||
if (rule == null && val.contains(COMMA)) {
|
||||
//TODO in 查询这里应该有个bug 如果一字段本身就是多选 此时用in查询 未必能查询出来
|
||||
@@ -333,6 +347,18 @@ public class QueryGenerator {
|
||||
if(rule == null && val.startsWith(NOT_EQUAL)){
|
||||
rule = QueryRuleEnum.NE;
|
||||
}
|
||||
// step 6 xx+xx+xx 这种情况适用于如果想要用逗号作精确查询 但是系统默认逗号走in 所以可以用++替换【此逻辑作废】
|
||||
if(rule == null && val.indexOf(QUERY_COMMA_ESCAPE)>0){
|
||||
rule = QueryRuleEnum.EQ_WITH_ADD;
|
||||
}
|
||||
|
||||
//update-begin--Author:taoyan Date:20201229 for:initQueryWrapper组装sql查询条件错误 #284---------------------
|
||||
//特殊处理:Oracle的表达式to_date('xxx','yyyy-MM-dd')含有逗号,会被识别为in查询,转为等于查询
|
||||
if(rule == QueryRuleEnum.IN && val.indexOf("yyyy-MM-dd")>=0 && val.indexOf("to_date")>=0){
|
||||
rule = QueryRuleEnum.EQ;
|
||||
}
|
||||
//update-end--Author:taoyan Date:20201229 for:initQueryWrapper组装sql查询条件错误 #284---------------------
|
||||
|
||||
return rule != null ? rule : QueryRuleEnum.EQ;
|
||||
}
|
||||
|
||||
@@ -365,7 +391,9 @@ public class QueryGenerator {
|
||||
value = specialStrConvert(value.toString());
|
||||
} else if (rule == QueryRuleEnum.IN) {
|
||||
value = val.split(",");
|
||||
} else {
|
||||
} else if (rule == QueryRuleEnum.EQ_WITH_ADD) {
|
||||
value = val.replaceAll("\\+\\+", COMMA);
|
||||
}else {
|
||||
//update-begin--Author:scott Date:20190724 for:initQueryWrapper组装sql查询条件错误 #284-------------------
|
||||
if(val.startsWith(rule.getValue())){
|
||||
//TODO 此处逻辑应该注释掉-> 如果查询内容中带有查询匹配规则符号,就会被截取的(比如:>=您好)
|
||||
@@ -470,6 +498,7 @@ public class QueryGenerator {
|
||||
queryWrapper.le(name, value);
|
||||
break;
|
||||
case EQ:
|
||||
case EQ_WITH_ADD:
|
||||
queryWrapper.eq(name, value);
|
||||
break;
|
||||
case NE:
|
||||
@@ -653,34 +682,59 @@ public class QueryGenerator {
|
||||
* @return
|
||||
*/
|
||||
public static String getSingleQueryConditionSql(String field,String alias,Object value,boolean isString) {
|
||||
return getSingleQueryConditionSql(field, alias, value, isString,null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 报表获取查询条件 支持多数据源
|
||||
* @param field
|
||||
* @param alias
|
||||
* @param value
|
||||
* @param isString
|
||||
* @param dataBaseType
|
||||
* @return
|
||||
*/
|
||||
public static String getSingleQueryConditionSql(String field,String alias,Object value,boolean isString, String dataBaseType) {
|
||||
if (value == null) {
|
||||
return "";
|
||||
}
|
||||
field = alias+oConvertUtils.camelToUnderline(field);
|
||||
QueryRuleEnum rule = QueryGenerator.convert2Rule(value);
|
||||
return getSingleSqlByRule(rule, field, value, isString);
|
||||
return getSingleSqlByRule(rule, field, value, isString, dataBaseType);
|
||||
}
|
||||
|
||||
public static String getSingleSqlByRule(QueryRuleEnum rule,String field,Object value,boolean isString) {
|
||||
|
||||
/**
|
||||
* 获取单个查询条件的值
|
||||
* @param rule
|
||||
* @param field
|
||||
* @param value
|
||||
* @param isString
|
||||
* @param dataBaseType
|
||||
* @return
|
||||
*/
|
||||
public static String getSingleSqlByRule(QueryRuleEnum rule,String field,Object value,boolean isString, String dataBaseType) {
|
||||
String res = "";
|
||||
switch (rule) {
|
||||
case GT:
|
||||
res =field+rule.getValue()+getFieldConditionValue(value, isString);
|
||||
res =field+rule.getValue()+getFieldConditionValue(value, isString, dataBaseType);
|
||||
break;
|
||||
case GE:
|
||||
res = field+rule.getValue()+getFieldConditionValue(value, isString);
|
||||
res = field+rule.getValue()+getFieldConditionValue(value, isString, dataBaseType);
|
||||
break;
|
||||
case LT:
|
||||
res = field+rule.getValue()+getFieldConditionValue(value, isString);
|
||||
res = field+rule.getValue()+getFieldConditionValue(value, isString, dataBaseType);
|
||||
break;
|
||||
case LE:
|
||||
res = field+rule.getValue()+getFieldConditionValue(value, isString);
|
||||
res = field+rule.getValue()+getFieldConditionValue(value, isString, dataBaseType);
|
||||
break;
|
||||
case EQ:
|
||||
res = field+rule.getValue()+getFieldConditionValue(value, isString);
|
||||
res = field+rule.getValue()+getFieldConditionValue(value, isString, dataBaseType);
|
||||
break;
|
||||
case EQ_WITH_ADD:
|
||||
res = field+" = "+getFieldConditionValue(value, isString, dataBaseType);
|
||||
break;
|
||||
case NE:
|
||||
res = field+" <> "+getFieldConditionValue(value, isString);
|
||||
res = field+" <> "+getFieldConditionValue(value, isString, dataBaseType);
|
||||
break;
|
||||
case IN:
|
||||
res = field + " in "+getInConditionValue(value, isString);
|
||||
@@ -695,12 +749,33 @@ public class QueryGenerator {
|
||||
res = field + " like "+getLikeConditionValue(value);
|
||||
break;
|
||||
default:
|
||||
res = field+" = "+getFieldConditionValue(value, isString);
|
||||
res = field+" = "+getFieldConditionValue(value, isString, dataBaseType);
|
||||
break;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
private static String getFieldConditionValue(Object value,boolean isString) {
|
||||
|
||||
|
||||
/**
|
||||
* 获取单个查询条件的值
|
||||
* @param rule
|
||||
* @param field
|
||||
* @param value
|
||||
* @param isString
|
||||
* @return
|
||||
*/
|
||||
public static String getSingleSqlByRule(QueryRuleEnum rule,String field,Object value,boolean isString) {
|
||||
return getSingleSqlByRule(rule, field, value, isString, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取查询条件的值
|
||||
* @param value
|
||||
* @param isString
|
||||
* @param dataBaseType
|
||||
* @return
|
||||
*/
|
||||
private static String getFieldConditionValue(Object value,boolean isString, String dataBaseType) {
|
||||
String str = value.toString().trim();
|
||||
if(str.startsWith("!")) {
|
||||
str = str.substring(1);
|
||||
@@ -712,22 +787,27 @@ public class QueryGenerator {
|
||||
str = str.substring(1);
|
||||
}else if(str.startsWith("<")) {
|
||||
str = str.substring(1);
|
||||
}else if(str.indexOf(QUERY_COMMA_ESCAPE)>0) {
|
||||
str = str.replaceAll("\\+\\+", COMMA);
|
||||
}
|
||||
if(dataBaseType==null){
|
||||
dataBaseType = getDbType();
|
||||
}
|
||||
if(isString) {
|
||||
if(DataBaseConstant.DB_TYPE_SQLSERVER.equals(getDbType())){
|
||||
if(DataBaseConstant.DB_TYPE_SQLSERVER.equals(dataBaseType)){
|
||||
return " N'"+str+"' ";
|
||||
}else{
|
||||
return " '"+str+"' ";
|
||||
}
|
||||
}else {
|
||||
// 如果不是字符串 有一种特殊情况 popup调用都走这个逻辑 参数传递的可能是“‘admin’”这种格式的
|
||||
if(DataBaseConstant.DB_TYPE_SQLSERVER.equals(getDbType()) && str.endsWith("'") && str.startsWith("'")){
|
||||
if(DataBaseConstant.DB_TYPE_SQLSERVER.equals(dataBaseType) && str.endsWith("'") && str.startsWith("'")){
|
||||
return " N"+str;
|
||||
}
|
||||
return value.toString();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static String getInConditionValue(Object value,boolean isString) {
|
||||
if(isString) {
|
||||
String temp[] = value.toString().split(",");
|
||||
|
||||
+2
@@ -19,6 +19,8 @@ public enum QueryRuleEnum {
|
||||
LIKE("LIKE","like","全模糊"),
|
||||
LEFT_LIKE("LEFT_LIKE","left_like","左模糊"),
|
||||
RIGHT_LIKE("RIGHT_LIKE","right_like","右模糊"),
|
||||
EQ_WITH_ADD("EQWITHADD","eq_with_add","带加号等于"),
|
||||
LIKE_WITH_AND("LIKEWITHAND","like_with_and","多词模糊匹配————暂时未用上"),
|
||||
SQL_RULES("USE_SQL_RULES","ext","自定义SQL片段");
|
||||
|
||||
private String value;
|
||||
|
||||
-4
@@ -75,10 +75,6 @@ public class CommonUtils {
|
||||
}
|
||||
//替换上传文件名字的特殊字符
|
||||
fileName = fileName.replace("=","").replace(",","").replace("&","").replace("#", "");
|
||||
//替换上传文件名字中的中文
|
||||
if(ifContainChinese(fileName)){
|
||||
fileName= PinyinUtil.getPinyin(fileName, StrUtil.EMPTY);
|
||||
}
|
||||
//替换上传文件名字中的空格
|
||||
fileName=fileName.replaceAll("\\s","");
|
||||
return fileName;
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
package org.jeecg.common.util;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
public enum DySmsEnum {
|
||||
|
||||
|
||||
-436
@@ -1,436 +0,0 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -5,7 +5,7 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.jeecg.common.handler.IFillRuleHandler;
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
package org.jeecg.common.util;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.web.util.HtmlUtils;
|
||||
|
||||
/**
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ package org.jeecg.common.util;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
||||
+2
-2
@@ -47,7 +47,7 @@ public class ImportExcelUtil {
|
||||
throw new Exception(errorFlag);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
String message = e.getMessage();
|
||||
String message = e.getMessage().toLowerCase();
|
||||
int lineNumber = i + 1;
|
||||
// 通过索引名判断出错信息
|
||||
if (message.contains(CommonConstant.SQL_INDEX_UNIQ_SYS_ROLE_CODE)) {
|
||||
@@ -75,7 +75,7 @@ public class ImportExcelUtil {
|
||||
throw new Exception(errorFlag);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
String message = e.getMessage();
|
||||
String message = e.getMessage().toLowerCase();
|
||||
int lineNumber = i + 1;
|
||||
// 通过索引名判断出错信息
|
||||
if (message.contains(CommonConstant.SQL_INDEX_UNIQ_SYS_ROLE_CODE)) {
|
||||
|
||||
+30
-16
@@ -1,8 +1,6 @@
|
||||
package org.jeecg.common.util;
|
||||
|
||||
import io.minio.MinioClient;
|
||||
import io.minio.errors.InvalidEndpointException;
|
||||
import io.minio.errors.InvalidPortException;
|
||||
import io.minio.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.util.filter.StrAttackFilter;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
@@ -63,11 +61,11 @@ public class MinioUtil {
|
||||
try {
|
||||
initMinio(minioUrl, minioName,minioPass);
|
||||
// 检查存储桶是否已经存在
|
||||
if(minioClient.bucketExists(newBucket)) {
|
||||
if(minioClient.bucketExists(BucketExistsArgs.builder().bucket(newBucket).build())) {
|
||||
log.info("Bucket already exists.");
|
||||
} else {
|
||||
// 创建一个名为ota的存储桶
|
||||
minioClient.makeBucket(newBucket);
|
||||
minioClient.makeBucket(MakeBucketArgs.builder().bucket(newBucket).build());
|
||||
log.info("create a new bucket.");
|
||||
}
|
||||
InputStream stream = file.getInputStream();
|
||||
@@ -83,7 +81,11 @@ public class MinioUtil {
|
||||
if(objectName.startsWith("/")){
|
||||
objectName = objectName.substring(1);
|
||||
}
|
||||
minioClient.putObject(newBucket,objectName, stream,stream.available(),"application/octet-stream");
|
||||
PutObjectArgs objectArgs = PutObjectArgs.builder().object(objectName)
|
||||
.bucket(newBucket)
|
||||
.contentType("application/octet-stream")
|
||||
.stream(stream,stream.available(),-1).build();
|
||||
minioClient.putObject(objectArgs);
|
||||
stream.close();
|
||||
file_url = minioUrl+newBucket+"/"+objectName;
|
||||
}catch (Exception e){
|
||||
@@ -112,7 +114,9 @@ public class MinioUtil {
|
||||
InputStream inputStream = null;
|
||||
try {
|
||||
initMinio(minioUrl, minioName, minioPass);
|
||||
inputStream = minioClient.getObject(bucketName, objectName);
|
||||
GetObjectArgs objectArgs = GetObjectArgs.builder().object(objectName)
|
||||
.bucket(bucketName).build();
|
||||
inputStream = minioClient.getObject(objectArgs);
|
||||
} catch (Exception e) {
|
||||
log.info("文件获取失败" + e.getMessage());
|
||||
}
|
||||
@@ -128,7 +132,9 @@ public class MinioUtil {
|
||||
public static void removeObject(String bucketName, String objectName) {
|
||||
try {
|
||||
initMinio(minioUrl, minioName,minioPass);
|
||||
minioClient.removeObject(bucketName, objectName);
|
||||
RemoveObjectArgs objectArgs = RemoveObjectArgs.builder().object(objectName)
|
||||
.bucket(bucketName).build();
|
||||
minioClient.removeObject(objectArgs);
|
||||
}catch (Exception e){
|
||||
log.info("文件删除失败" + e.getMessage());
|
||||
}
|
||||
@@ -144,7 +150,10 @@ public class MinioUtil {
|
||||
public static String getObjectURL(String bucketName, String objectName, Integer expires) {
|
||||
initMinio(minioUrl, minioName,minioPass);
|
||||
try{
|
||||
String url = minioClient.presignedGetObject(bucketName, objectName, expires);
|
||||
GetPresignedObjectUrlArgs objectArgs = GetPresignedObjectUrlArgs.builder().object(objectName)
|
||||
.bucket(bucketName)
|
||||
.expiry(expires).build();
|
||||
String url = minioClient.getPresignedObjectUrl(objectArgs);
|
||||
return URLDecoder.decode(url,"UTF-8");
|
||||
}catch (Exception e){
|
||||
log.info("文件路径获取失败" + e.getMessage());
|
||||
@@ -162,10 +171,11 @@ public class MinioUtil {
|
||||
private static MinioClient initMinio(String minioUrl, String minioName,String minioPass) {
|
||||
if (minioClient == null) {
|
||||
try {
|
||||
minioClient = new MinioClient(minioUrl, minioName,minioPass);
|
||||
} catch (InvalidEndpointException e) {
|
||||
e.printStackTrace();
|
||||
} catch (InvalidPortException e) {
|
||||
minioClient = MinioClient.builder()
|
||||
.endpoint(minioUrl)
|
||||
.credentials(minioName, minioPass)
|
||||
.build();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
@@ -180,14 +190,18 @@ public class MinioUtil {
|
||||
*/
|
||||
public static String upload(InputStream stream,String relativePath) throws Exception {
|
||||
initMinio(minioUrl, minioName,minioPass);
|
||||
if(minioClient.bucketExists(bucketName)) {
|
||||
if(minioClient.bucketExists(BucketExistsArgs.builder().bucket(bucketName).build())) {
|
||||
log.info("Bucket already exists.");
|
||||
} else {
|
||||
// 创建一个名为ota的存储桶
|
||||
minioClient.makeBucket(bucketName);
|
||||
minioClient.makeBucket(MakeBucketArgs.builder().bucket(bucketName).build());
|
||||
log.info("create a new bucket.");
|
||||
}
|
||||
minioClient.putObject(bucketName,relativePath, stream, stream.available(),"application/octet-stream");
|
||||
PutObjectArgs objectArgs = PutObjectArgs.builder().object(relativePath)
|
||||
.bucket(bucketName)
|
||||
.contentType("application/octet-stream")
|
||||
.stream(stream,stream.available(),-1).build();
|
||||
minioClient.putObject(objectArgs);
|
||||
stream.close();
|
||||
return minioUrl+bucketName+"/"+relativePath;
|
||||
}
|
||||
|
||||
+42
-2
@@ -1,5 +1,6 @@
|
||||
package org.jeecg.common.util;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
@@ -7,8 +8,7 @@ import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.jeecg.common.exception.JeecgBootException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.data.redis.core.*;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
@@ -572,4 +572,44 @@ public class RedisUtil {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取指定前缀的一系列key
|
||||
* 使用scan命令代替keys, Redis是单线程处理,keys命令在KEY数量较多时,
|
||||
* 操作效率极低【时间复杂度为O(N)】,该命令一旦执行会严重阻塞线上其它命令的正常请求
|
||||
* @param keyPrefix
|
||||
* @return
|
||||
*/
|
||||
private Set<String> keys(String keyPrefix) {
|
||||
String realKey = keyPrefix + "*";
|
||||
|
||||
try {
|
||||
return redisTemplate.execute((RedisCallback<Set<String>>) connection -> {
|
||||
Set<String> binaryKeys = new HashSet<>();
|
||||
Cursor<byte[]> cursor = connection.scan(new ScanOptions.ScanOptionsBuilder().match(realKey).count(Integer.MAX_VALUE).build());
|
||||
while (cursor.hasNext()) {
|
||||
binaryKeys.add(new String(cursor.next()));
|
||||
}
|
||||
|
||||
return binaryKeys;
|
||||
});
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除指定前缀的一系列key
|
||||
* @param keyPrefix
|
||||
*/
|
||||
public void removeAll(String keyPrefix) {
|
||||
try {
|
||||
Set<String> keys = keys(keyPrefix);
|
||||
redisTemplate.delete(keys);
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ package org.jeecg.common.util;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.http.*;
|
||||
import org.springframework.http.client.SimpleClientHttpRequestFactory;
|
||||
import org.springframework.http.converter.StringHttpMessageConverter;
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
package org.jeecg.common.util;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.shiro.authc.AuthenticationException;
|
||||
import org.jeecg.common.api.CommonAPI;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ package org.jeecg.common.util.dynamic.db;
|
||||
|
||||
import com.alibaba.druid.pool.DruidDataSource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.jeecg.common.exception.JeecgBootException;
|
||||
import org.jeecg.common.exception.JeecgBootException;
|
||||
import org.jeecg.common.system.vo.DynamicDataSourceModel;
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ import freemarker.core.ParseException;
|
||||
import freemarker.template.Configuration;
|
||||
import freemarker.template.Template;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.jeecgframework.codegenerate.generate.util.SimpleFormat;
|
||||
|
||||
import java.io.StringWriter;
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
package org.jeecg.common.util.dynamic.db;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.jeecg.common.constant.DataBaseConstant;
|
||||
import org.jeecg.common.system.vo.DynamicDataSourceModel;
|
||||
|
||||
|
||||
+13
@@ -56,6 +56,8 @@ public abstract class CommonProperty implements Serializable{
|
||||
|
||||
protected String fieldExtendJson;//扩展参数
|
||||
|
||||
protected Integer dbPointLength;//小数点
|
||||
|
||||
public String getDefVal() {
|
||||
return defVal;
|
||||
}
|
||||
@@ -136,6 +138,14 @@ public abstract class CommonProperty implements Serializable{
|
||||
this.fieldExtendJson = fieldExtendJson;
|
||||
}
|
||||
|
||||
public Integer getDbPointLength() {
|
||||
return dbPointLength;
|
||||
}
|
||||
|
||||
public void setDbPointLength(Integer dbPointLength) {
|
||||
this.dbPointLength = dbPointLength;
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回一个map有两个key
|
||||
* <P>key ---> Property JSON的key
|
||||
@@ -175,6 +185,9 @@ public abstract class CommonProperty implements Serializable{
|
||||
if(fieldExtendJson != null){
|
||||
json.put("fieldExtendJson", fieldExtendJson);
|
||||
}
|
||||
if(dbPointLength !=null ) {
|
||||
json.put("dbPointLength", dbPointLength);
|
||||
}
|
||||
return json;
|
||||
}
|
||||
|
||||
|
||||
+19
@@ -1,9 +1,12 @@
|
||||
package org.jeecg.common.util;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.math.BigDecimal;
|
||||
@@ -646,4 +649,20 @@ public class oConvertUtils {
|
||||
return !listIsEmpty(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取静态文本内容
|
||||
* @param url
|
||||
* @return
|
||||
*/
|
||||
public static String readStatic(String url) {
|
||||
String json = "";
|
||||
try {
|
||||
//换个写法,解决springboot读取jar包中文件的问题
|
||||
InputStream stream = oConvertUtils.class.getClassLoader().getResourceAsStream(url.replace("classpath:", ""));
|
||||
json = IOUtils.toString(stream,"UTF-8");
|
||||
} catch (IOException e) {
|
||||
log.error(e.getMessage(),e);
|
||||
}
|
||||
return json;
|
||||
}
|
||||
}
|
||||
|
||||
+13
@@ -138,6 +138,19 @@ public class OssBootUtil {
|
||||
return FILE_URL;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取原始URL
|
||||
* @param url: 原始URL
|
||||
* @Return: java.lang.String
|
||||
*/
|
||||
public static String getOriginalUrl(String url) {
|
||||
String originalDomain = "https://" + bucketName + "." + endPoint;
|
||||
if(url.indexOf(staticDomain)!=-1){
|
||||
url = url.replace(staticDomain,originalDomain);
|
||||
}
|
||||
return url;
|
||||
}
|
||||
|
||||
/**
|
||||
* 文件上传
|
||||
* @param file
|
||||
|
||||
-167
@@ -1,167 +0,0 @@
|
||||
//package org.jeecg.config;
|
||||
//
|
||||
//import com.fasterxml.jackson.core.JsonGenerator;
|
||||
//import com.fasterxml.jackson.databind.*;
|
||||
//import com.fasterxml.jackson.databind.module.SimpleModule;
|
||||
//import com.fasterxml.jackson.databind.ser.BeanPropertyWriter;
|
||||
//import com.fasterxml.jackson.databind.ser.BeanSerializerModifier;
|
||||
//import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
//import lombok.extern.slf4j.Slf4j;
|
||||
//import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
//import org.springframework.context.annotation.Bean;
|
||||
//import org.springframework.context.annotation.Configuration;
|
||||
//import org.springframework.context.annotation.Primary;
|
||||
//import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
|
||||
//
|
||||
//import java.io.IOException;
|
||||
//import java.math.BigDecimal;
|
||||
//import java.text.SimpleDateFormat;
|
||||
//import java.util.Date;
|
||||
//import java.util.List;
|
||||
//import java.util.TimeZone;
|
||||
//
|
||||
//import static org.jeecg.config.JacksonAutoConfiguration.SerializerFeature.*;
|
||||
//
|
||||
//
|
||||
///**
|
||||
// * @author: zyf
|
||||
// * @date: 2019/5/20 14:56
|
||||
// * @description:
|
||||
// */
|
||||
//@Slf4j
|
||||
//@Configuration
|
||||
//public class JacksonAutoConfiguration {
|
||||
//
|
||||
// public enum SerializerFeature {
|
||||
// WriteNullListAsEmpty,
|
||||
// WriteNullStringAsEmpty,
|
||||
// WriteNullNumberAsZero,
|
||||
// WriteNullBooleanAsFalse,
|
||||
// WriteNullMapAsEmpty;
|
||||
//
|
||||
// public final int mask;
|
||||
//
|
||||
// SerializerFeature() {
|
||||
// mask = (1 << ordinal());
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public static class FastJsonSerializerFeatureCompatibleForJackson extends BeanSerializerModifier {
|
||||
// final private JsonSerializer<Object> nullBooleanJsonSerializer;
|
||||
// final private JsonSerializer<Object> nullNumberJsonSerializer;
|
||||
// final private JsonSerializer<Object> nullListJsonSerializer;
|
||||
// final private JsonSerializer<Object> nullStringJsonSerializer;
|
||||
// final private JsonSerializer<Object> nullMapJsonSerializer;
|
||||
//
|
||||
// FastJsonSerializerFeatureCompatibleForJackson(SerializerFeature... features) {
|
||||
// int config = 0;
|
||||
// for (SerializerFeature feature : features) {
|
||||
// config |= feature.mask;
|
||||
// }
|
||||
// nullBooleanJsonSerializer = (config & WriteNullBooleanAsFalse.mask) != 0 ? new NullBooleanSerializer() : null;
|
||||
// nullNumberJsonSerializer = (config & WriteNullNumberAsZero.mask) != 0 ? new NullNumberSerializer() : null;
|
||||
// nullListJsonSerializer = (config & WriteNullListAsEmpty.mask) != 0 ? new NullListJsonSerializer() : null;
|
||||
// nullStringJsonSerializer = (config & WriteNullStringAsEmpty.mask) != 0 ? new NullStringSerializer() : null;
|
||||
// nullMapJsonSerializer = (config & WriteNullMapAsEmpty.mask) != 0 ? new NullMapSerializer() : null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public List<BeanPropertyWriter> changeProperties(SerializationConfig config, BeanDescription beanDesc, List<BeanPropertyWriter> beanProperties) {
|
||||
// for (BeanPropertyWriter writer : beanProperties) {
|
||||
// final JavaType javaType = writer.getType();
|
||||
// final Class<?> rawClass = javaType.getRawClass();
|
||||
// if (javaType.isArrayType() || javaType.isCollectionLikeType()) {
|
||||
// writer.assignNullSerializer(nullListJsonSerializer);
|
||||
// } else if (Number.class.isAssignableFrom(rawClass) && (rawClass.getName().startsWith("java.lang") || rawClass.getName().startsWith("java.match"))) {
|
||||
// writer.assignNullSerializer(nullNumberJsonSerializer);
|
||||
// } else if (BigDecimal.class.isAssignableFrom(rawClass)) {
|
||||
// writer.assignNullSerializer(nullNumberJsonSerializer);
|
||||
// } else if (Boolean.class.equals(rawClass)) {
|
||||
// writer.assignNullSerializer(nullBooleanJsonSerializer);
|
||||
// } else if (String.class.equals(rawClass) || Date.class.equals(rawClass)) {
|
||||
// writer.assignNullSerializer(nullStringJsonSerializer);
|
||||
// } else if (!Date.class.equals(rawClass)) {
|
||||
// writer.assignNullSerializer(nullMapJsonSerializer);
|
||||
// }
|
||||
// }
|
||||
// return beanProperties;
|
||||
// }
|
||||
//
|
||||
// private static class NullListJsonSerializer extends JsonSerializer<Object> {
|
||||
// @Override
|
||||
// public void serialize(Object value, JsonGenerator jgen, SerializerProvider provider) throws IOException {
|
||||
// jgen.writeStartArray();
|
||||
// jgen.writeEndArray();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private static class NullNumberSerializer extends JsonSerializer<Object> {
|
||||
// @Override
|
||||
// public void serialize(Object value, JsonGenerator jgen, SerializerProvider provider) throws IOException {
|
||||
// jgen.writeNumber(0);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private static class NullBooleanSerializer extends JsonSerializer<Object> {
|
||||
// @Override
|
||||
// public void serialize(Object value, JsonGenerator jgen, SerializerProvider provider) throws IOException {
|
||||
// jgen.writeBoolean(false);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private static class NullStringSerializer extends JsonSerializer<Object> {
|
||||
// @Override
|
||||
// public void serialize(Object value, JsonGenerator jgen, SerializerProvider provider) throws IOException {
|
||||
// jgen.writeString("");
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private static class NullMapSerializer extends JsonSerializer<Object> {
|
||||
// @Override
|
||||
// public void serialize(Object value, JsonGenerator jgen, SerializerProvider provider) throws IOException {
|
||||
// jgen.writeStartObject();
|
||||
// jgen.writeEndObject();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Bean
|
||||
// @Primary
|
||||
// @ConditionalOnMissingBean(ObjectMapper.class)
|
||||
// public ObjectMapper jacksonObjectMapper(Jackson2ObjectMapperBuilder builder) {
|
||||
// ObjectMapper objectMapper = new ObjectMapper();
|
||||
// objectMapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"));
|
||||
// objectMapper.setTimeZone(TimeZone.getTimeZone("GMT+8"));
|
||||
// objectMapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
|
||||
// // 排序key
|
||||
// objectMapper.configure(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS, true);
|
||||
//
|
||||
// objectMapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
|
||||
// //忽略在json字符串中存在,在java类中不存在字段,防止错误。
|
||||
// objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
// objectMapper.configure(DeserializationFeature.READ_ENUMS_USING_TO_STRING, true);
|
||||
// /**
|
||||
// * 序列换成json时,将所有的long变成string
|
||||
// * js中long过长精度丢失
|
||||
// */
|
||||
// SimpleModule simpleModule = new SimpleModule();
|
||||
// simpleModule.addSerializer(Long.class, ToStringSerializer.instance);
|
||||
// simpleModule.addSerializer(Long.TYPE, ToStringSerializer.instance);
|
||||
// //注册xss解析器
|
||||
// //simpleModule.addSerializer(String.class, new XssStringJsonSerializer());
|
||||
// //simpleModule.addDeserializer(String.class, new XssStringJsonDeserializer());
|
||||
// objectMapper.registerModule(simpleModule);
|
||||
// // 兼容fastJson 的一些空值处理
|
||||
// SerializerFeature[] features = new SerializerFeature[]{
|
||||
// WriteNullListAsEmpty,
|
||||
// WriteNullStringAsEmpty,
|
||||
// WriteNullNumberAsZero,
|
||||
// WriteNullBooleanAsFalse,
|
||||
// WriteNullMapAsEmpty
|
||||
// };
|
||||
// objectMapper.setSerializerFactory(objectMapper.getSerializerFactory().withSerializerModifier(new FastJsonSerializerFeatureCompatibleForJackson(features)));
|
||||
// log.info("ObjectMapper [{}]", objectMapper);
|
||||
// return objectMapper;
|
||||
// }
|
||||
//
|
||||
//}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
package org.jeecg.config;
|
||||
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.springframework.context.annotation.Condition;
|
||||
import org.springframework.context.annotation.ConditionContext;
|
||||
import org.springframework.core.type.AnnotatedTypeMetadata;
|
||||
|
||||
/**
|
||||
* 微服务环境加载条件
|
||||
*/
|
||||
public class JeecgCloudCondition implements Condition {
|
||||
|
||||
@Override
|
||||
public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
|
||||
Object object = context.getEnvironment().getProperty(CommonConstant.CLOUD_SERVER_KEY);
|
||||
//如果没有服务注册发现的配置 说明是单体应用
|
||||
if(object==null){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
+2
-1
@@ -12,6 +12,7 @@ import net.sf.jsqlparser.expression.operators.relational.ExpressionList;
|
||||
import net.sf.jsqlparser.expression.operators.relational.InExpression;
|
||||
import net.sf.jsqlparser.schema.Column;
|
||||
import org.apache.ibatis.reflection.MetaObject;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
@@ -72,7 +73,7 @@ public class MybatisPlusConfig {
|
||||
|
||||
@Override
|
||||
public Expression getTenantId(boolean select) {
|
||||
String tenant_id = TenantContext.getTenant();
|
||||
String tenant_id = oConvertUtils.getString(TenantContext.getTenant(),"0");
|
||||
return new LongValue(tenant_id);
|
||||
}
|
||||
@Override
|
||||
|
||||
+9
-8
@@ -14,6 +14,7 @@ import org.crazycake.shiro.RedisClusterManager;
|
||||
import org.crazycake.shiro.RedisManager;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.config.shiro.filters.CustomShiroFilterFactoryBean;
|
||||
import org.jeecg.config.shiro.filters.JwtFilter;
|
||||
import org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -58,7 +59,7 @@ public class ShiroConfig {
|
||||
*/
|
||||
@Bean("shiroFilter")
|
||||
public ShiroFilterFactoryBean shiroFilter(SecurityManager securityManager) {
|
||||
ShiroFilterFactoryBean shiroFilterFactoryBean = new ShiroFilterFactoryBean();
|
||||
CustomShiroFilterFactoryBean shiroFilterFactoryBean = new CustomShiroFilterFactoryBean();
|
||||
shiroFilterFactoryBean.setSecurityManager(securityManager);
|
||||
// 拦截器
|
||||
Map<String, String> filterChainDefinitionMap = new LinkedHashMap<String, String>();
|
||||
@@ -87,8 +88,6 @@ public class ShiroConfig {
|
||||
filterChainDefinitionMap.put("/auth/2step-code", "anon");//登录验证码
|
||||
filterChainDefinitionMap.put("/sys/common/static/**", "anon");//图片预览 &下载文件不限制token
|
||||
filterChainDefinitionMap.put("/sys/common/pdf/**", "anon");//pdf预览
|
||||
//filterChainDefinitionMap.put("/sys/common/view/**", "anon");//图片预览不限制token
|
||||
//filterChainDefinitionMap.put("/sys/common/download/**", "anon");//文件下载不限制token
|
||||
filterChainDefinitionMap.put("/generic/**", "anon");//pdf预览需要文件
|
||||
filterChainDefinitionMap.put("/", "anon");
|
||||
filterChainDefinitionMap.put("/doc.html", "anon");
|
||||
@@ -101,11 +100,9 @@ public class ShiroConfig {
|
||||
filterChainDefinitionMap.put("/**/*.png", "anon");
|
||||
filterChainDefinitionMap.put("/**/*.ico", "anon");
|
||||
|
||||
// update-begin--Author:sunjianlei Date:20190813 for:排除字体格式的后缀
|
||||
filterChainDefinitionMap.put("/**/*.ttf", "anon");
|
||||
filterChainDefinitionMap.put("/**/*.woff", "anon");
|
||||
filterChainDefinitionMap.put("/**/*.woff2", "anon");
|
||||
// update-begin--Author:sunjianlei Date:20190813 for:排除字体格式的后缀
|
||||
|
||||
filterChainDefinitionMap.put("/druid/**", "anon");
|
||||
filterChainDefinitionMap.put("/swagger-ui.html", "anon");
|
||||
@@ -117,19 +114,23 @@ public class ShiroConfig {
|
||||
filterChainDefinitionMap.put("/jmreport/**", "anon");
|
||||
filterChainDefinitionMap.put("/**/*.js.map", "anon");
|
||||
filterChainDefinitionMap.put("/**/*.css.map", "anon");
|
||||
//大屏设计器排除
|
||||
filterChainDefinitionMap.put("/bigscreen/**", "anon");
|
||||
|
||||
//测试示例
|
||||
filterChainDefinitionMap.put("/test/jeecgDemo/rabbitMqClientTest/**", "anon"); //MQ测试
|
||||
filterChainDefinitionMap.put("/test/bigScreen/**", "anon"); //大屏模板例子
|
||||
//filterChainDefinitionMap.put("/test/jeecgDemo/rabbitMqClientTest/**", "anon"); //MQ测试
|
||||
//filterChainDefinitionMap.put("/test/jeecgDemo/html", "anon"); //模板页面
|
||||
//filterChainDefinitionMap.put("/test/jeecgDemo/redis/**", "anon"); //redis测试
|
||||
|
||||
//websocket排除
|
||||
filterChainDefinitionMap.put("/websocket/**", "anon");//系统通知和公告
|
||||
filterChainDefinitionMap.put("/newsWebsocket/**", "anon");//CMS模块
|
||||
filterChainDefinitionMap.put("/vxeSocket/**", "anon");//JVxeTable无痕刷新示例
|
||||
filterChainDefinitionMap.put("/eoaSocket/**","anon");//我的聊天
|
||||
|
||||
//性能监控 TODO 存在安全漏洞
|
||||
//filterChainDefinitionMap.put("/actuator/**", "anon");
|
||||
//性能监控 TODO 存在安全漏洞泄露TOEKN(durid连接池也有)
|
||||
filterChainDefinitionMap.put("/actuator/**", "anon");
|
||||
|
||||
// 添加自己的过滤器并且取名为jwt
|
||||
Map<String, Filter> filterMap = new HashMap<String, Filter>(1);
|
||||
|
||||
+1
-1
@@ -152,7 +152,7 @@ public class ShiroRealm extends AuthorizingRealm {
|
||||
// 设置超时时间
|
||||
redisUtil.set(CommonConstant.PREFIX_USER_TOKEN + token, newAuthorization);
|
||||
redisUtil.expire(CommonConstant.PREFIX_USER_TOKEN + token, JwtUtil.EXPIRE_TIME *2 / 1000);
|
||||
log.info("——————————用户在线操作,更新token保证不掉线—————————jwtTokenRefresh——————— "+ token);
|
||||
log.debug("——————————用户在线操作,更新token保证不掉线—————————jwtTokenRefresh——————— "+ token);
|
||||
}
|
||||
//update-begin--Author:scott Date:20191005 for:解决每次请求,都重写redis中 token缓存问题
|
||||
// else {
|
||||
|
||||
+76
@@ -0,0 +1,76 @@
|
||||
package org.jeecg.config.shiro.filters;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.shiro.spring.web.ShiroFilterFactoryBean;
|
||||
import org.apache.shiro.web.filter.InvalidRequestFilter;
|
||||
import org.apache.shiro.web.filter.mgt.DefaultFilter;
|
||||
import org.apache.shiro.web.filter.mgt.FilterChainManager;
|
||||
import org.apache.shiro.web.filter.mgt.FilterChainResolver;
|
||||
import org.apache.shiro.web.filter.mgt.PathMatchingFilterChainResolver;
|
||||
import org.apache.shiro.web.mgt.WebSecurityManager;
|
||||
import org.apache.shiro.web.servlet.AbstractShiroFilter;
|
||||
import org.apache.shiro.mgt.SecurityManager;
|
||||
import org.springframework.beans.factory.BeanInitializationException;
|
||||
|
||||
import javax.servlet.Filter;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 自定义ShiroFilterFactoryBean解决资源中文路径问题
|
||||
*/
|
||||
@Slf4j
|
||||
public class CustomShiroFilterFactoryBean extends ShiroFilterFactoryBean {
|
||||
@Override
|
||||
public Class getObjectType() {
|
||||
return MySpringShiroFilter.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AbstractShiroFilter createInstance() throws Exception {
|
||||
|
||||
SecurityManager securityManager = getSecurityManager();
|
||||
if (securityManager == null) {
|
||||
String msg = "SecurityManager property must be set.";
|
||||
throw new BeanInitializationException(msg);
|
||||
}
|
||||
|
||||
if (!(securityManager instanceof WebSecurityManager)) {
|
||||
String msg = "The security manager does not implement the WebSecurityManager interface.";
|
||||
throw new BeanInitializationException(msg);
|
||||
}
|
||||
|
||||
FilterChainManager manager = createFilterChainManager();
|
||||
//Expose the constructed FilterChainManager by first wrapping it in a
|
||||
// FilterChainResolver implementation. The AbstractShiroFilter implementations
|
||||
// do not know about FilterChainManagers - only resolvers:
|
||||
PathMatchingFilterChainResolver chainResolver = new PathMatchingFilterChainResolver();
|
||||
chainResolver.setFilterChainManager(manager);
|
||||
|
||||
Map<String, Filter> filterMap = manager.getFilters();
|
||||
Filter invalidRequestFilter = filterMap.get(DefaultFilter.invalidRequest.name());
|
||||
if (invalidRequestFilter instanceof InvalidRequestFilter) {
|
||||
//此处是关键,设置false跳过URL携带中文400,servletPath中文校验bug
|
||||
((InvalidRequestFilter) invalidRequestFilter).setBlockNonAscii(false);
|
||||
}
|
||||
//Now create a concrete ShiroFilter instance and apply the acquired SecurityManager and built
|
||||
//FilterChainResolver. It doesn't matter that the instance is an anonymous inner class
|
||||
//here - we're just using it because it is a concrete AbstractShiroFilter instance that accepts
|
||||
//injection of the SecurityManager and FilterChainResolver:
|
||||
return new MySpringShiroFilter((WebSecurityManager) securityManager, chainResolver);
|
||||
}
|
||||
|
||||
private static final class MySpringShiroFilter extends AbstractShiroFilter {
|
||||
protected MySpringShiroFilter(WebSecurityManager webSecurityManager, FilterChainResolver resolver) {
|
||||
if (webSecurityManager == null) {
|
||||
throw new IllegalArgumentException("WebSecurityManager property cannot be null.");
|
||||
} else {
|
||||
this.setSecurityManager(webSecurityManager);
|
||||
if (resolver != null) {
|
||||
this.setFilterChainResolver(resolver);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+5
@@ -54,6 +54,11 @@ public class JwtFilter extends BasicHttpAuthenticationFilter {
|
||||
protected boolean executeLogin(ServletRequest request, ServletResponse response) throws Exception {
|
||||
HttpServletRequest httpServletRequest = (HttpServletRequest) request;
|
||||
String token = httpServletRequest.getHeader(CommonConstant.X_ACCESS_TOKEN);
|
||||
// update-begin--Author:lvdandan Date:20210105 for:JT-355 OA聊天添加token验证,获取token参数
|
||||
if(token == null){
|
||||
token = httpServletRequest.getParameter("token");
|
||||
}
|
||||
// update-end--Author:lvdandan Date:20210105 for:JT-355 OA聊天添加token验证,获取token参数
|
||||
|
||||
JwtToken jwtToken = new JwtToken(token);
|
||||
// 提交给realm进行登入,如果错误他会抛出异常并被捕获
|
||||
|
||||
+16
-3
@@ -1,6 +1,7 @@
|
||||
package org.jeecg.modules.base.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.jeecg.common.api.dto.LogDTO;
|
||||
import org.jeecg.common.constant.CacheConstant;
|
||||
@@ -22,6 +23,7 @@ import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.*;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class BaseCommonServiceImpl implements BaseCommonService {
|
||||
|
||||
@Resource
|
||||
@@ -32,7 +34,13 @@ public class BaseCommonServiceImpl implements BaseCommonService {
|
||||
if(oConvertUtils.isEmpty(logDTO.getId())){
|
||||
logDTO.setId(String.valueOf(IdWorker.getId()));
|
||||
}
|
||||
baseCommonMapper.saveLog(logDTO);
|
||||
//保存日志(异常捕获处理,防止数据太大存储失败,导致业务失败)JT-238
|
||||
try {
|
||||
baseCommonMapper.saveLog(logDTO);
|
||||
} catch (Exception e) {
|
||||
log.warn(" LogContent length : "+logDTO.getLogContent().length());
|
||||
log.warn(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -64,8 +72,13 @@ public class BaseCommonServiceImpl implements BaseCommonService {
|
||||
sysLog.setUsername(user.getRealname());
|
||||
}
|
||||
sysLog.setCreateTime(new Date());
|
||||
//保存系统日志
|
||||
baseCommonMapper.saveLog(sysLog);
|
||||
//保存日志(异常捕获处理,防止数据太大存储失败,导致业务失败)JT-238
|
||||
try {
|
||||
baseCommonMapper.saveLog(sysLog);
|
||||
} catch (Exception e) {
|
||||
log.warn(" LogContent length : "+sysLog.getLogContent().length());
|
||||
log.warn(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<artifactId>jeecg-boot-base</artifactId>
|
||||
<version>2.4.0</version>
|
||||
<version>2.4.2</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<description>公共模块</description>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>jeecg-boot-parent</artifactId>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<version>2.4.0</version>
|
||||
<version>2.4.2</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>jeecg-boot-parent</artifactId>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<version>2.4.0</version>
|
||||
<version>2.4.2</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -16,5 +16,10 @@
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<artifactId>jeecg-boot-base-core</artifactId>
|
||||
</dependency>
|
||||
<!-- 引入微服务启动依赖 starter
|
||||
<dependency>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<artifactId>jeecg-boot-starter-cloud</artifactId>
|
||||
</dependency> -->
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -1,16 +0,0 @@
|
||||
/*
|
||||
package org.jeecg;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
|
||||
@SpringBootApplication
|
||||
@EnableFeignClients
|
||||
public class JeecgDemoApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(JeecgDemoApplication.class, args);
|
||||
}
|
||||
}
|
||||
*/
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
//package org.jeecg;
|
||||
//
|
||||
//import org.springframework.boot.SpringApplication;
|
||||
//import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
//import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
//
|
||||
//@SpringBootApplication
|
||||
//@EnableFeignClients
|
||||
//public class JeecgDemoCloudApplication {
|
||||
//
|
||||
// public static void main(String[] args) {
|
||||
// SpringApplication.run(JeecgDemoCloudApplication.class, args);
|
||||
// }
|
||||
//}
|
||||
+1
-1
@@ -8,7 +8,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.constant.VXESocketConst;
|
||||
import org.jeecg.common.system.query.MatchTypeEnum;
|
||||
|
||||
+1
-1
@@ -175,7 +175,7 @@ public class JoaDemoController {
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param requestFieldPresenceUtil
|
||||
* @param response
|
||||
*/
|
||||
@RequestMapping(value = "/exportXls")
|
||||
|
||||
-84
@@ -1,84 +0,0 @@
|
||||
package org.jeecg.modules.demo.test.controller;
|
||||
|
||||
import io.minio.MinioClient;
|
||||
import org.apache.tomcat.util.http.fileupload.IOUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.InputStream;
|
||||
|
||||
/**
|
||||
* @Author scott
|
||||
* @Date 2020/1/12 17:19
|
||||
* @Description: Minio文件服务测试
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/test/minio")
|
||||
public class MinioController {
|
||||
|
||||
//minio服务的IP端口
|
||||
private static String url = "http://111.225.?.?:9000";
|
||||
private static String accessKey = "admin";
|
||||
private static String secretKey = "??";
|
||||
private static String bucketName = "??";
|
||||
|
||||
/**
|
||||
* 上传文件到minio服务
|
||||
*
|
||||
* @param file
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("upload")
|
||||
public String upload(@RequestParam("file") MultipartFile file) {
|
||||
try {
|
||||
MinioClient minioClient = new MinioClient(url, accessKey, secretKey);
|
||||
InputStream is = file.getInputStream(); //得到文件流
|
||||
String fileName = "/upload/img/" + file.getOriginalFilename(); //文件名
|
||||
String contentType = file.getContentType(); //类型
|
||||
minioClient.putObject(bucketName, fileName, is, contentType); //把文件放置Minio桶(文件夹)
|
||||
return "上传成功";
|
||||
} catch (Exception e) {
|
||||
return "上传失败";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载minio服务的文件
|
||||
*
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("download")
|
||||
public String download(HttpServletResponse response) {
|
||||
try {
|
||||
MinioClient minioClient = new MinioClient(url, accessKey, secretKey);
|
||||
InputStream fileInputStream = minioClient.getObject(bucketName, "11.jpg");
|
||||
response.setHeader("Content-Disposition", "attachment;filename=" + "11.jpg");
|
||||
response.setContentType("application/force-download");
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
IOUtils.copy(fileInputStream, response.getOutputStream());
|
||||
return "下载完成";
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return "下载失败";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取minio文件的下载地址
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("url")
|
||||
public String getUrl() {
|
||||
try {
|
||||
MinioClient minioClient = new MinioClient(url, accessKey, secretKey);
|
||||
String url = minioClient.presignedGetObject(bucketName, "11.jpg");
|
||||
return url;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return "获取失败";
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -8,7 +8,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.system.query.MatchTypeEnum;
|
||||
import org.jeecg.common.system.query.QueryCondition;
|
||||
|
||||
@@ -1,65 +0,0 @@
|
||||
package org.jeecg;
|
||||
|
||||
import org.jeecg.modules.demo.mock.MockController;
|
||||
import org.jeecg.modules.demo.test.entity.JeecgDemo;
|
||||
import org.jeecg.modules.demo.test.mapper.JeecgDemoMapper;
|
||||
import org.jeecg.modules.demo.test.service.IJeecgDemoService;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
||||
public class SampleTest {
|
||||
|
||||
@Resource
|
||||
private JeecgDemoMapper jeecgDemoMapper;
|
||||
@Resource
|
||||
private IJeecgDemoService jeecgDemoService;
|
||||
// @Resource
|
||||
// private ISysDataLogService sysDataLogService;
|
||||
@Resource
|
||||
private MockController mock;
|
||||
|
||||
@Test
|
||||
public void testSelect() {
|
||||
System.out.println(("----- selectAll method test ------"));
|
||||
List<JeecgDemo> userList = jeecgDemoMapper.selectList(null);
|
||||
Assert.assertEquals(5, userList.size());
|
||||
userList.forEach(System.out::println);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testXmlSql() {
|
||||
System.out.println(("----- selectAll method test ------"));
|
||||
List<JeecgDemo> userList = jeecgDemoMapper.getDemoByName("Sandy12");
|
||||
userList.forEach(System.out::println);
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试事务
|
||||
*/
|
||||
@Test
|
||||
public void testTran() {
|
||||
jeecgDemoService.testTran();
|
||||
}
|
||||
|
||||
//author:lvdandan-----date:20190315---for:添加数据日志测试----
|
||||
/**
|
||||
* 测试数据日志添加
|
||||
*/
|
||||
// @Test
|
||||
// public void testDataLogSave() {
|
||||
// System.out.println(("----- datalog test ------"));
|
||||
// String tableName = "jeecg_demo";
|
||||
// String dataId = "4028ef81550c1a7901550c1cd6e70001";
|
||||
// String dataContent = mock.sysDataLogJson();
|
||||
// sysDataLogService.addDataLog(tableName, dataId, dataContent);
|
||||
// }
|
||||
//author:lvdandan-----date:20190315---for:添加数据日志测试----
|
||||
}
|
||||
@@ -10,6 +10,6 @@ WORKDIR /jeecg-boot
|
||||
|
||||
EXPOSE 8080
|
||||
|
||||
ADD ./target/jeecg-boot-module-system-2.4.0.jar ./
|
||||
ADD ./target/jeecg-boot-module-system-2.4.2.jar ./
|
||||
|
||||
CMD sleep 60;java -Djava.security.egd=file:/dev/./urandom -jar jeecg-boot-module-system-2.4.0.jar
|
||||
CMD sleep 60;java -Djava.security.egd=file:/dev/./urandom -jar jeecg-boot-module-system-2.4.2.jar
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<artifactId>jeecg-boot-parent</artifactId>
|
||||
<version>2.4.0</version>
|
||||
<version>2.4.2</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -34,13 +34,27 @@
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<artifactId>jeecg-system-local-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<artifactId>jeecg-boot-starter-redis</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<artifactId>jeecg-boot-module-demo</artifactId>
|
||||
<version>${jeecgboot.version}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- 积木报表 -->
|
||||
<dependency>
|
||||
<groupId>com.jimureport</groupId>
|
||||
<artifactId>spring-boot-starter-jimureport</artifactId>
|
||||
<version>1.1.08-beta</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>autopoi-web</artifactId>
|
||||
<groupId>org.jeecgframework</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
@@ -49,7 +63,7 @@
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<!--微服务模式下修改为 true,跳过此打包插件,否则微服务模块无法引用-->
|
||||
<!--微服务模式下修改为true,跳过此打包插件,否则微服务模块无法引用-->
|
||||
<skip>false</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
+1
-28
@@ -2,13 +2,11 @@ package org.jeecg;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.catalina.Context;
|
||||
import org.apache.catalina.connector.Connector;
|
||||
import org.apache.tomcat.util.scan.StandardJarScanner;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.boot.web.embedded.tomcat.TomcatConnectorCustomizer;
|
||||
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
|
||||
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
@@ -19,7 +17,7 @@ import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
/**
|
||||
* 单体启动类(采用此类启动项目为单体模式)
|
||||
* 单体启动类(采用此类启动为单体模式)
|
||||
*/
|
||||
@Slf4j
|
||||
@SpringBootApplication
|
||||
@@ -42,30 +40,5 @@ public class JeecgSystemApplication extends SpringBootServletInitializer {
|
||||
"External: \thttp://" + ip + ":" + port + path + "/\n\t" +
|
||||
"Swagger文档: \thttp://" + ip + ":" + port + path + "/doc.html\n" +
|
||||
"----------------------------------------------------------");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* tomcat-embed-jasper引用后提示jar找不到的问题
|
||||
*/
|
||||
@Bean
|
||||
public TomcatServletWebServerFactory tomcatFactory() {
|
||||
|
||||
TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory(){
|
||||
@Override
|
||||
protected void postProcessContext(Context context) {
|
||||
((StandardJarScanner) context.getJarScanner()).setScanManifest(false);
|
||||
}
|
||||
};
|
||||
|
||||
factory.addConnectorCustomizers(new TomcatConnectorCustomizer() {
|
||||
@Override
|
||||
public void customize(Connector connector) {
|
||||
connector.setProperty("relaxedPathChars", "\"<>[\\]^`{|}");
|
||||
connector.setProperty("relaxedQueryChars", "\"<>[\\]^`{|}");
|
||||
}
|
||||
});
|
||||
|
||||
return factory;
|
||||
}
|
||||
}
|
||||
+5
-2
@@ -1,11 +1,13 @@
|
||||
package org.jeecg.modules.init;
|
||||
package org.jeecg.config.init;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.constant.CacheConstant;
|
||||
import org.jeecg.config.JeecgCloudCondition;
|
||||
import org.jeecg.modules.system.service.ISysGatewayRouteService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.context.event.ApplicationReadyEvent;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.context.annotation.Conditional;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -15,6 +17,7 @@ import org.springframework.stereotype.Component;
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@Conditional(JeecgCloudCondition.class)
|
||||
public class SystemInitListener implements ApplicationListener<ApplicationReadyEvent>, Ordered {
|
||||
|
||||
|
||||
@@ -24,7 +27,7 @@ public class SystemInitListener implements ApplicationListener<ApplicationReadyE
|
||||
@Override
|
||||
public void onApplicationEvent(ApplicationReadyEvent applicationReadyEvent) {
|
||||
|
||||
log.info(" 服务已启动,准备初始化路由配置 ###################");
|
||||
log.info(" 服务已启动,初始化路由配置 ###################");
|
||||
if (applicationReadyEvent.getApplicationContext().getDisplayName().indexOf("AnnotationConfigServletWebServerApplicationContext") > -1) {
|
||||
sysGatewayRouteService.addRoute2Redis(CacheConstant.GATEWAY_ROUTES);
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
package org.jeecg.config.init;
|
||||
|
||||
import org.apache.catalina.Context;
|
||||
import org.apache.tomcat.util.scan.StandardJarScanner;
|
||||
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* @Description: TomcatFactoryConfig
|
||||
* @author: scott
|
||||
* @date: 2021年01月25日 11:40
|
||||
*/
|
||||
@Configuration
|
||||
public class TomcatFactoryConfig {
|
||||
/**
|
||||
* tomcat-embed-jasper引用后提示jar找不到的问题
|
||||
*/
|
||||
@Bean
|
||||
public TomcatServletWebServerFactory tomcatFactory() {
|
||||
TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory() {
|
||||
@Override
|
||||
protected void postProcessContext(Context context) {
|
||||
((StandardJarScanner) context.getJarScanner()).setScanManifest(false);
|
||||
}
|
||||
};
|
||||
factory.addConnectorCustomizers(connector -> {
|
||||
connector.setProperty("relaxedPathChars", "[]{}");
|
||||
connector.setProperty("relaxedQueryChars", "[]{}");
|
||||
});
|
||||
return factory;
|
||||
}
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
package org.jeecg.config.jimureport;
|
||||
|
||||
import org.jeecg.common.system.api.ISysBaseAPI;
|
||||
import org.jeecg.common.system.util.JwtUtil;
|
||||
import org.jeecg.common.util.RedisUtil;
|
||||
import org.jeecg.common.util.TokenUtils;
|
||||
import org.jeecg.modules.jmreport.api.JmReportTokenServiceI;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* 自定义积木报表鉴权实现类(如果不进行自定义,则所有请求不做权限控制)
|
||||
* 1.自定义获取登录token
|
||||
* 2.自定义获取登录用户
|
||||
*/
|
||||
@Component
|
||||
class JimuReportTokenService implements JmReportTokenServiceI {
|
||||
@Autowired
|
||||
private ISysBaseAPI sysBaseAPI;
|
||||
@Autowired
|
||||
@Lazy
|
||||
private RedisUtil redisUtil;
|
||||
|
||||
@Override
|
||||
public String getToken(HttpServletRequest request) {
|
||||
return TokenUtils.getTokenByRequest(request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUsername(String token) {
|
||||
return JwtUtil.getUsername(token);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean verifyToken(String token) {
|
||||
return TokenUtils.verifyToken(token, sysBaseAPI, redisUtil);
|
||||
}
|
||||
}
|
||||
+33
-2
@@ -1,8 +1,8 @@
|
||||
package org.jeecg.modules.api.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.jeecg.common.api.dto.message.*;
|
||||
import org.jeecg.common.api.dto.OnlineAuthDTO;
|
||||
import org.jeecg.common.api.dto.message.*;
|
||||
import org.jeecg.common.system.api.ISysBaseAPI;
|
||||
import org.jeecg.common.system.vo.*;
|
||||
import org.jeecg.modules.system.service.ISysUserService;
|
||||
@@ -482,7 +482,17 @@ public class SystemAPIController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 37根据多个部门编码(逗号分隔),查询返回多个部门信息
|
||||
* 37根据多个用户id(逗号分隔),查询返回多个用户信息
|
||||
* @param usernames
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/queryUsersByIds")
|
||||
List<JSONObject> queryUsersByIds(String ids){
|
||||
return this.sysBaseAPI.queryUsersByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 38根据多个部门编码(逗号分隔),查询返回多个部门信息
|
||||
* @param orgCodes
|
||||
* @return
|
||||
*/
|
||||
@@ -490,4 +500,25 @@ public class SystemAPIController {
|
||||
List<JSONObject> queryDepartsByOrgcodes(String orgCodes){
|
||||
return this.sysBaseAPI.queryDepartsByOrgcodes(orgCodes);
|
||||
}
|
||||
|
||||
/**
|
||||
* 39根据多个部门ID(逗号分隔),查询返回多个部门信息
|
||||
* @param orgCodes
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/queryDepartsByIds")
|
||||
List<JSONObject> queryDepartsByIds(String orgCodes){
|
||||
return this.sysBaseAPI.queryDepartsByIds(orgCodes);
|
||||
}
|
||||
|
||||
/**
|
||||
* 40发送邮件消息
|
||||
* @param email
|
||||
* @param title
|
||||
* @param content
|
||||
*/
|
||||
@GetMapping("/sendEmailMsg")
|
||||
public void sendEmailMsg(@RequestParam("email")String email,@RequestParam("title")String title,@RequestParam("content")String content){
|
||||
this.sysBaseAPI.sendEmailMsg(email,title,content);
|
||||
};
|
||||
}
|
||||
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
package org.jeecg.modules.message.websocket;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import org.jeecg.boot.starter.redis.listener.JeecgRedisListerer;
|
||||
import org.jeecg.common.base.BaseMap;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 监听消息(采用redis发布订阅方式发送消息)
|
||||
*/
|
||||
@Component
|
||||
public class SocketHandler implements JeecgRedisListerer {
|
||||
|
||||
@Autowired
|
||||
private WebSocket webSocket;
|
||||
|
||||
@Override
|
||||
public void onMessage(BaseMap map) {
|
||||
String userId = map.get("userId");
|
||||
String message = map.get("message");
|
||||
if (ObjectUtil.isNotEmpty(userId)) {
|
||||
webSocket.pushMessage(userId, message);
|
||||
} else {
|
||||
webSocket.pushMessage(message);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -25,7 +25,7 @@ public class TestSocketController {
|
||||
obj.put(WebsocketConst.MSG_CMD, WebsocketConst.CMD_TOPIC);
|
||||
obj.put(WebsocketConst.MSG_ID, "M0001");
|
||||
obj.put(WebsocketConst.MSG_TXT, message);
|
||||
webSocket.sendAllMessage(obj.toJSONString());
|
||||
webSocket.sendMessage(obj.toJSONString());
|
||||
result.setResult("群发!");
|
||||
return result;
|
||||
}
|
||||
@@ -40,7 +40,7 @@ public class TestSocketController {
|
||||
obj.put(WebsocketConst.MSG_USER_ID, userId);
|
||||
obj.put(WebsocketConst.MSG_ID, "M0001");
|
||||
obj.put(WebsocketConst.MSG_TXT, message);
|
||||
webSocket.sendOneMessage(userId, obj.toJSONString());
|
||||
webSocket.sendMessage(userId, obj.toJSONString());
|
||||
result.setResult("单发");
|
||||
return result;
|
||||
}
|
||||
|
||||
+105
-61
@@ -1,9 +1,11 @@
|
||||
package org.jeecg.modules.message.websocket;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.CopyOnWriteArraySet;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.websocket.OnClose;
|
||||
import javax.websocket.OnMessage;
|
||||
import javax.websocket.OnOpen;
|
||||
@@ -11,6 +13,10 @@ import javax.websocket.Session;
|
||||
import javax.websocket.server.PathParam;
|
||||
import javax.websocket.server.ServerEndpoint;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import org.jeecg.boot.starter.redis.client.JeecgRedisClient;
|
||||
import org.jeecg.boot.starter.redis.listener.JeecgRedisListerer;
|
||||
import org.jeecg.common.base.BaseMap;
|
||||
import org.jeecg.common.constant.WebsocketConst;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -27,83 +33,121 @@ import lombok.extern.slf4j.Slf4j;
|
||||
@Slf4j
|
||||
@ServerEndpoint("/websocket/{userId}") //此注解相当于设置访问URL
|
||||
public class WebSocket {
|
||||
|
||||
|
||||
private Session session;
|
||||
|
||||
private static CopyOnWriteArraySet<WebSocket> webSockets =new CopyOnWriteArraySet<>();
|
||||
private static Map<String,Session> sessionPool = new HashMap<String,Session>();
|
||||
|
||||
|
||||
private String userId;
|
||||
|
||||
private static final String REDIS_TOPIC_NAME = "socketHandler";
|
||||
|
||||
@Resource
|
||||
private JeecgRedisClient jeecgRedisClient;
|
||||
|
||||
private static CopyOnWriteArraySet<WebSocket> webSockets = new CopyOnWriteArraySet<>();
|
||||
private static Map<String, Session> sessionPool = new HashMap<String, Session>();
|
||||
|
||||
|
||||
@OnOpen
|
||||
public void onOpen(Session session, @PathParam(value="userId")String userId) {
|
||||
public void onOpen(Session session, @PathParam(value = "userId") String userId) {
|
||||
try {
|
||||
this.session = session;
|
||||
webSockets.add(this);
|
||||
sessionPool.put(userId, session);
|
||||
log.info("【websocket消息】有新的连接,总数为:"+webSockets.size());
|
||||
} catch (Exception e) {
|
||||
}
|
||||
this.session = session;
|
||||
this.userId = userId;
|
||||
webSockets.add(this);
|
||||
sessionPool.put(userId, session);
|
||||
log.info("【websocket消息】有新的连接,总数为:" + webSockets.size());
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@OnClose
|
||||
public void onClose() {
|
||||
try {
|
||||
webSockets.remove(this);
|
||||
log.info("【websocket消息】连接断开,总数为:"+webSockets.size());
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
|
||||
@OnMessage
|
||||
public void onMessage(String message) {
|
||||
//todo 现在有个定时任务刷,应该去掉
|
||||
log.debug("【websocket消息】收到客户端消息:"+message);
|
||||
JSONObject obj = new JSONObject();
|
||||
obj.put(WebsocketConst.MSG_CMD, WebsocketConst.CMD_CHECK);//业务类型
|
||||
obj.put(WebsocketConst.MSG_TXT, "心跳响应");//消息内容
|
||||
session.getAsyncRemote().sendText(obj.toJSONString());
|
||||
}
|
||||
|
||||
// 此为广播消息
|
||||
public void sendAllMessage(String message) {
|
||||
log.info("【websocket消息】广播消息:"+message);
|
||||
for(WebSocket webSocket : webSockets) {
|
||||
try {
|
||||
if(webSocket.session.isOpen()) {
|
||||
webSocket.session.getAsyncRemote().sendText(message);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
webSockets.remove(this);
|
||||
sessionPool.remove(this.userId);
|
||||
log.info("【websocket消息】连接断开,总数为:" + webSockets.size());
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
|
||||
// 此为单点消息
|
||||
public void sendOneMessage(String userId, String message) {
|
||||
|
||||
|
||||
/**
|
||||
* 服务端推送消息
|
||||
*
|
||||
* @param userId
|
||||
* @param message
|
||||
*/
|
||||
public void pushMessage(String userId, String message) {
|
||||
Session session = sessionPool.get(userId);
|
||||
if (session != null&&session.isOpen()) {
|
||||
if (session != null && session.isOpen()) {
|
||||
try {
|
||||
log.info("【websocket消息】 单点消息:"+message);
|
||||
log.info("【websocket消息】 单点消息:" + message);
|
||||
session.getAsyncRemote().sendText(message);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 此为单点消息(多人)
|
||||
public void sendMoreMessage(String[] userIds, String message) {
|
||||
for(String userId:userIds) {
|
||||
Session session = sessionPool.get(userId);
|
||||
if (session != null&&session.isOpen()) {
|
||||
try {
|
||||
log.info("【websocket消息】 单点消息:"+message);
|
||||
session.getAsyncRemote().sendText(message);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 服务器端推送消息
|
||||
*/
|
||||
public void pushMessage(String message) {
|
||||
try {
|
||||
webSockets.forEach(ws -> ws.session.getAsyncRemote().sendText(message));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@OnMessage
|
||||
public void onMessage(String message) {
|
||||
//todo 现在有个定时任务刷,应该去掉
|
||||
log.debug("【websocket消息】收到客户端消息:" + message);
|
||||
JSONObject obj = new JSONObject();
|
||||
obj.put(WebsocketConst.MSG_CMD, WebsocketConst.CMD_CHECK);//业务类型
|
||||
obj.put(WebsocketConst.MSG_TXT, "心跳响应");//消息内容
|
||||
for (WebSocket webSocket : webSockets) {
|
||||
webSocket.pushMessage(message);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 后台发送消息到redis
|
||||
*
|
||||
* @param message
|
||||
*/
|
||||
public void sendMessage(String message) {
|
||||
log.info("【websocket消息】广播消息:" + message);
|
||||
BaseMap baseMap = new BaseMap();
|
||||
baseMap.put("userId", "");
|
||||
baseMap.put("message", message);
|
||||
jeecgRedisClient.sendMessage(REDIS_TOPIC_NAME, baseMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 此为单点消息
|
||||
*
|
||||
* @param userId
|
||||
* @param message
|
||||
*/
|
||||
public void sendMessage(String userId, String message) {
|
||||
BaseMap baseMap = new BaseMap();
|
||||
baseMap.put("userId", userId);
|
||||
baseMap.put("message", message);
|
||||
jeecgRedisClient.sendMessage(REDIS_TOPIC_NAME, baseMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 此为单点消息(多人)
|
||||
*
|
||||
* @param userIds
|
||||
* @param message
|
||||
*/
|
||||
public void sendMessage(String[] userIds, String message) {
|
||||
for (String userId : userIds) {
|
||||
sendMessage(userId, message);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+39
-11
@@ -1,15 +1,7 @@
|
||||
package org.jeecg.modules.monitor.controller;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.swing.filechooser.FileSystemView;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.modules.monitor.domain.RedisInfo;
|
||||
import org.jeecg.modules.monitor.service.RedisService;
|
||||
@@ -18,7 +10,14 @@ import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.swing.filechooser.FileSystemView;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@@ -45,6 +44,35 @@ public class ActuatorRedisController {
|
||||
return redisService.getKeysSize();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取redis key数量 for 报表
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@GetMapping("/keysSizeForReport")
|
||||
public Map<String, JSONArray> getKeysSizeReport() throws Exception {
|
||||
return redisService.getMapForReport("1");
|
||||
}
|
||||
/**
|
||||
* 获取redis 内存 for 报表
|
||||
*
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@GetMapping("/memoryForReport")
|
||||
public Map<String, JSONArray> memoryForReport() throws Exception {
|
||||
return redisService.getMapForReport("2");
|
||||
}
|
||||
/**
|
||||
* 获取redis 全部信息 for 报表
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@GetMapping("/infoForReport")
|
||||
public Map<String, JSONArray> infoForReport() throws Exception {
|
||||
return redisService.getMapForReport("3");
|
||||
}
|
||||
|
||||
@GetMapping("/memoryInfo")
|
||||
public Map<String, Object> getMemoryInfo() throws Exception {
|
||||
return redisService.getMemoryInfo();
|
||||
|
||||
+7
-1
@@ -4,6 +4,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import org.jeecg.modules.monitor.domain.RedisInfo;
|
||||
import org.jeecg.modules.monitor.exception.RedisConnectException;
|
||||
|
||||
@@ -29,5 +30,10 @@ public interface RedisService {
|
||||
* @return Map
|
||||
*/
|
||||
Map<String, Object> getMemoryInfo() throws RedisConnectException;
|
||||
|
||||
/**
|
||||
* 获取 报表需要个redis信息
|
||||
*
|
||||
* @return Map
|
||||
*/
|
||||
Map<String, JSONArray> getMapForReport(String type) throws RedisConnectException ;
|
||||
}
|
||||
|
||||
+47
@@ -8,10 +8,15 @@ import java.util.Properties;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.google.common.collect.Maps;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.monitor.domain.RedisInfo;
|
||||
import org.jeecg.modules.monitor.exception.RedisConnectException;
|
||||
import org.jeecg.modules.monitor.service.RedisService;
|
||||
import org.springframework.cglib.beans.BeanMap;
|
||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -72,4 +77,46 @@ public class RedisServiceImpl implements RedisService {
|
||||
log.info("--getMemoryInfo--: " + map.toString());
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询redis信息for报表
|
||||
* @param type 1redis key数量 2 占用内存 3redis信息
|
||||
* @return
|
||||
* @throws RedisConnectException
|
||||
*/
|
||||
@Override
|
||||
public Map<String, JSONArray> getMapForReport(String type) throws RedisConnectException {
|
||||
Map<String,JSONArray> mapJson=new HashMap<String, JSONArray> ();
|
||||
JSONArray json = new JSONArray();
|
||||
if("3".equals(type)){
|
||||
List<RedisInfo> redisInfo = getRedisInfo();
|
||||
for(RedisInfo info:redisInfo){
|
||||
Map<String, Object> map= Maps.newHashMap();
|
||||
BeanMap beanMap = BeanMap.create(info);
|
||||
for (Object key : beanMap.keySet()) {
|
||||
map.put(key+"", beanMap.get(key));
|
||||
}
|
||||
json.add(map);
|
||||
}
|
||||
mapJson.put("data",json);
|
||||
return mapJson;
|
||||
}
|
||||
for(int i = 0; i < 5; i++){
|
||||
JSONObject jo = new JSONObject();
|
||||
Map<String, Object> map;
|
||||
if("1".equals(type)){
|
||||
map= getKeysSize();
|
||||
jo.put("value",map.get("dbSize"));
|
||||
}else{
|
||||
map = getMemoryInfo();
|
||||
Integer used_memory = Integer.valueOf(map.get("used_memory").toString());
|
||||
jo.put("value",used_memory/1000);
|
||||
}
|
||||
String create_time = DateUtil.formatTime(DateUtil.date((Long) map.get("create_time")-(4-i)*1000));
|
||||
jo.put("name",create_time);
|
||||
json.add(jo);
|
||||
}
|
||||
mapJson.put("data",json);
|
||||
return mapJson;
|
||||
}
|
||||
}
|
||||
|
||||
-1
@@ -16,7 +16,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service("ngAlainService")
|
||||
@Transactional
|
||||
public class NgAlainServiceImpl implements NgAlainService {
|
||||
@Autowired
|
||||
private ISysPermissionService sysPermissionService;
|
||||
|
||||
+4
-1
@@ -21,7 +21,10 @@ public class OSSFileServiceImpl extends ServiceImpl<OSSFileMapper, OSSFile> impl
|
||||
OSSFile ossFile = new OSSFile();
|
||||
ossFile.setFileName(fileName);
|
||||
String url = OssBootUtil.upload(multipartFile,"upload/test");
|
||||
ossFile.setUrl(url);
|
||||
//update-begin--Author:scott Date:20201227 for:JT-361【文件预览】阿里云原生域名可以文件预览,自己映射域名kkfileview提示文件下载失败-------------------
|
||||
// 返回阿里云原生域名前缀URL
|
||||
ossFile.setUrl(OssBootUtil.getOriginalUrl(url));
|
||||
//update-end--Author:scott Date:20201227 for:JT-361【文件预览】阿里云原生域名可以文件预览,自己映射域名kkfileview提示文件下载失败-------------------
|
||||
this.save(ossFile);
|
||||
}
|
||||
|
||||
|
||||
+10
-14
@@ -96,10 +96,6 @@ public class SysAnnouncementController {
|
||||
}
|
||||
}
|
||||
IPage<SysAnnouncement> pageList = sysAnnouncementService.page(page, queryWrapper);
|
||||
log.info("查询当前页:"+pageList.getCurrent());
|
||||
log.info("查询当前页数量:"+pageList.getSize());
|
||||
log.info("查询结果数量:"+pageList.getRecords().size());
|
||||
log.info("数据总数:"+pageList.getTotal());
|
||||
result.setSuccess(true);
|
||||
result.setResult(pageList);
|
||||
return result;
|
||||
@@ -233,7 +229,7 @@ public class SysAnnouncementController {
|
||||
obj.put(WebsocketConst.MSG_CMD, WebsocketConst.CMD_TOPIC);
|
||||
obj.put(WebsocketConst.MSG_ID, sysAnnouncement.getId());
|
||||
obj.put(WebsocketConst.MSG_TXT, sysAnnouncement.getTitile());
|
||||
webSocket.sendAllMessage(obj.toJSONString());
|
||||
webSocket.sendMessage(obj.toJSONString());
|
||||
}else {
|
||||
// 2.插入用户通告阅读标记表记录
|
||||
String userId = sysAnnouncement.getUserIds();
|
||||
@@ -244,7 +240,7 @@ public class SysAnnouncementController {
|
||||
obj.put(WebsocketConst.MSG_CMD, WebsocketConst.CMD_USER);
|
||||
obj.put(WebsocketConst.MSG_ID, sysAnnouncement.getId());
|
||||
obj.put(WebsocketConst.MSG_TXT, sysAnnouncement.getTitile());
|
||||
webSocket.sendMoreMessage(userIds, obj.toJSONString());
|
||||
webSocket.sendMessage(userIds, obj.toJSONString());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -285,15 +281,14 @@ public class SysAnnouncementController {
|
||||
LoginUser sysUser = (LoginUser)SecurityUtils.getSubject().getPrincipal();
|
||||
String userId = sysUser.getId();
|
||||
// 1.将系统消息补充到用户通告阅读标记表中
|
||||
Collection<String> anntIds = sysAnnouncementSendService.queryByUserId(userId);
|
||||
LambdaQueryWrapper<SysAnnouncement> querySaWrapper = new LambdaQueryWrapper<SysAnnouncement>();
|
||||
querySaWrapper.eq(SysAnnouncement::getMsgType,CommonConstant.MSG_TYPE_ALL); // 全部人员
|
||||
querySaWrapper.eq(SysAnnouncement::getDelFlag,CommonConstant.DEL_FLAG_0.toString()); // 未删除
|
||||
querySaWrapper.eq(SysAnnouncement::getSendStatus, CommonConstant.HAS_SEND); //已发布
|
||||
querySaWrapper.ge(SysAnnouncement::getEndTime, sysUser.getCreateTime()); //新注册用户不看结束通知
|
||||
if(anntIds!=null&&anntIds.size()>0) {
|
||||
querySaWrapper.notIn(SysAnnouncement::getId, anntIds);
|
||||
}
|
||||
//update-begin--Author:liusq Date:20210108 for:[JT-424] 【开源issue】bug处理--------------------
|
||||
querySaWrapper.notInSql(SysAnnouncement::getId,"select annt_id from sys_announcement_send where user_id='"+userId+"'");
|
||||
//update-begin--Author:liusq Date:20210108 for: [JT-424] 【开源issue】bug处理--------------------
|
||||
List<SysAnnouncement> announcements = sysAnnouncementService.list(querySaWrapper);
|
||||
if(announcements.size()>0) {
|
||||
for(int i=0;i<announcements.size();i++) {
|
||||
@@ -337,9 +332,10 @@ public class SysAnnouncementController {
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(SysAnnouncement sysAnnouncement,HttpServletRequest request) {
|
||||
// Step.1 组装查询条件
|
||||
QueryWrapper<SysAnnouncement> queryWrapper = QueryGenerator.initQueryWrapper(sysAnnouncement, request.getParameterMap());
|
||||
LambdaQueryWrapper<SysAnnouncement> queryWrapper = new LambdaQueryWrapper<SysAnnouncement>(sysAnnouncement);
|
||||
//Step.2 AutoPoi 导出Excel
|
||||
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
|
||||
queryWrapper.eq(SysAnnouncement::getDelFlag,CommonConstant.DEL_FLAG_0);
|
||||
List<SysAnnouncement> pageList = sysAnnouncementService.list(queryWrapper);
|
||||
//导出文件名称
|
||||
mv.addObject(NormalExcelConstants.FILE_NAME, "系统通告列表");
|
||||
@@ -407,7 +403,7 @@ public class SysAnnouncementController {
|
||||
obj.put(WebsocketConst.MSG_CMD, WebsocketConst.CMD_TOPIC);
|
||||
obj.put(WebsocketConst.MSG_ID, sysAnnouncement.getId());
|
||||
obj.put(WebsocketConst.MSG_TXT, sysAnnouncement.getTitile());
|
||||
webSocket.sendAllMessage(obj.toJSONString());
|
||||
webSocket.sendMessage(obj.toJSONString());
|
||||
}else {
|
||||
// 2.插入用户通告阅读标记表记录
|
||||
String userId = sysAnnouncement.getUserIds();
|
||||
@@ -416,14 +412,14 @@ public class SysAnnouncementController {
|
||||
obj.put(WebsocketConst.MSG_CMD, WebsocketConst.CMD_USER);
|
||||
obj.put(WebsocketConst.MSG_ID, sysAnnouncement.getId());
|
||||
obj.put(WebsocketConst.MSG_TXT, sysAnnouncement.getTitile());
|
||||
webSocket.sendMoreMessage(userIds, obj.toJSONString());
|
||||
webSocket.sendMessage(userIds, obj.toJSONString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
obj.put(WebsocketConst.MSG_CMD, WebsocketConst.CMD_TOPIC);
|
||||
obj.put(WebsocketConst.MSG_TXT, "批量设置已读");
|
||||
webSocket.sendAllMessage(obj.toJSONString());
|
||||
webSocket.sendMessage(obj.toJSONString());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
+23
-5
@@ -136,10 +136,8 @@ public class SysCategoryController {
|
||||
if(sysCategory==null) {
|
||||
result.error500("未找到对应实体");
|
||||
}else {
|
||||
boolean ok = sysCategoryService.removeById(id);
|
||||
if(ok) {
|
||||
result.success("删除成功!");
|
||||
}
|
||||
this.sysCategoryService.deleteSysCategory(id);
|
||||
result.success("删除成功!");
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -156,7 +154,7 @@ public class SysCategoryController {
|
||||
if(ids==null || "".equals(ids.trim())) {
|
||||
result.error500("参数不识别!");
|
||||
}else {
|
||||
this.sysCategoryService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
this.sysCategoryService.deleteSysCategory(ids);
|
||||
result.success("删除成功!");
|
||||
}
|
||||
return result;
|
||||
@@ -461,6 +459,26 @@ public class SysCategoryController {
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据父级id批量查询子节点
|
||||
* @param parentIds
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getChildListBatch")
|
||||
public Result getChildListBatch(@RequestParam("parentIds") String parentIds) {
|
||||
try {
|
||||
QueryWrapper<SysCategory> queryWrapper = new QueryWrapper<>();
|
||||
List<String> parentIdList = Arrays.asList(parentIds.split(","));
|
||||
queryWrapper.in("pid", parentIdList);
|
||||
List<SysCategory> list = sysCategoryService.list(queryWrapper);
|
||||
IPage<SysCategory> pageList = new Page<>(1, 10, list.size());
|
||||
pageList.setRecords(list);
|
||||
return Result.OK(pageList);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error("批量查询子节点失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
+20
-10
@@ -16,13 +16,11 @@ import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.system.vo.DictModel;
|
||||
import org.jeecg.common.system.vo.DictQuery;
|
||||
import org.jeecg.common.system.vo.LoginUser;
|
||||
import org.jeecg.common.util.FieldPresenceUtil;
|
||||
import org.jeecg.common.util.ImportExcelUtil;
|
||||
import org.jeecg.common.util.SqlInjectionUtil;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.system.entity.SysDict;
|
||||
import org.jeecg.modules.system.entity.SysDictItem;
|
||||
import org.jeecg.modules.system.entity.SysUser;
|
||||
import org.jeecg.modules.system.model.SysDictTree;
|
||||
import org.jeecg.modules.system.model.TreeSelectModel;
|
||||
import org.jeecg.modules.system.service.ISysDictItemService;
|
||||
@@ -32,6 +30,7 @@ import org.jeecgframework.poi.excel.ExcelImportUtil;
|
||||
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
||||
import org.jeecgframework.poi.excel.entity.ImportParams;
|
||||
import org.jeecgframework.poi.excel.entity.result.ExcelImportResult;
|
||||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -41,6 +40,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.*;
|
||||
@@ -152,7 +152,7 @@ public class SysDictController {
|
||||
|
||||
result.setSuccess(true);
|
||||
result.setResult(ls);
|
||||
log.info(result.toString());
|
||||
log.debug(result.toString());
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(),e);
|
||||
result.error500("操作失败");
|
||||
@@ -202,7 +202,10 @@ public class SysDictController {
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/loadDict/{dictCode}", method = RequestMethod.GET)
|
||||
public Result<List<DictModel>> loadDict(@PathVariable String dictCode,@RequestParam(name="keyword") String keyword, @RequestParam(value = "sign",required = false) String sign,HttpServletRequest request) {
|
||||
public Result<List<DictModel>> loadDict(@PathVariable String dictCode,
|
||||
@RequestParam(name="keyword") String keyword,
|
||||
@RequestParam(value = "sign",required = false) String sign,
|
||||
@RequestParam(value = "pageSize", required = false) Integer pageSize) {
|
||||
log.info(" 加载字典表数据,加载关键字: "+ keyword);
|
||||
Result<List<DictModel>> result = new Result<List<DictModel>>();
|
||||
List<DictModel> ls = null;
|
||||
@@ -213,7 +216,11 @@ public class SysDictController {
|
||||
result.error500("字典Code格式不正确!");
|
||||
return result;
|
||||
}
|
||||
ls = sysDictService.queryTableDictItems(params[0],params[1],params[2],keyword);
|
||||
if(pageSize!=null){
|
||||
ls = sysDictService.queryLittleTableDictItems(params[0],params[1],params[2],keyword, pageSize);
|
||||
}else{
|
||||
ls = sysDictService.queryTableDictItems(params[0],params[1],params[2],keyword);
|
||||
}
|
||||
result.setSuccess(true);
|
||||
result.setResult(ls);
|
||||
log.info(result.toString());
|
||||
@@ -400,10 +407,14 @@ public class SysDictController {
|
||||
Set keys2 = redisTemplate.keys(CacheConstant.SYS_DICT_TABLE_CACHE + "*");
|
||||
Set keys3 = redisTemplate.keys(CacheConstant.SYS_DEPARTS_CACHE + "*");
|
||||
Set keys4 = redisTemplate.keys(CacheConstant.SYS_DEPART_IDS_CACHE + "*");
|
||||
Set keys5 = redisTemplate.keys( "jmreport:cache:dict*");
|
||||
Set keys6 = redisTemplate.keys( "jmreport:cache:dictTable*");
|
||||
redisTemplate.delete(keys);
|
||||
redisTemplate.delete(keys2);
|
||||
redisTemplate.delete(keys3);
|
||||
redisTemplate.delete(keys4);
|
||||
redisTemplate.delete(keys5);
|
||||
redisTemplate.delete(keys6);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -461,12 +472,11 @@ public class SysDictController {
|
||||
params.setHeadRows(2);
|
||||
params.setNeedSave(true);
|
||||
try {
|
||||
//update-begin-author:wangshuai date:20201030 for:导入测试用例
|
||||
boolean aBoolean = FieldPresenceUtil.fieldPresence(file.getInputStream(), SysDictPage.class, params);
|
||||
if(!aBoolean){
|
||||
throw new RuntimeException("导入Excel标题格式不匹配!");
|
||||
//导入Excel格式校验,看匹配的字段文本概率
|
||||
ExcelImportResult t = ExcelImportUtil.importExcelVerify(file.getInputStream(), SysDictPage.class, params);
|
||||
if(t.isVerfiyFail()){
|
||||
throw new RuntimeException("导入Excel校验失败 !");
|
||||
}
|
||||
//update-end-author:wangshuai date:20201030 for:导入测试用例
|
||||
List<SysDictPage> list = ExcelImportUtil.importExcel(file.getInputStream(), SysDictPage.class, params);
|
||||
// 错误信息
|
||||
List<String> errorMessage = new ArrayList<>();
|
||||
|
||||
+31
@@ -6,6 +6,9 @@ import java.util.Date;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresRoles;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.constant.CacheConstant;
|
||||
@@ -148,5 +151,33 @@ public class SysDictItemController {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 字典值重复校验
|
||||
* @param sysDictItem
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/dictItemCheck", method = RequestMethod.GET)
|
||||
@ApiOperation("字典重复校验接口")
|
||||
public Result<Object> doDictItemCheck(SysDictItem sysDictItem, HttpServletRequest request) {
|
||||
int num = 0;
|
||||
LambdaQueryWrapper<SysDictItem> queryWrapper = new LambdaQueryWrapper<SysDictItem>();
|
||||
queryWrapper.eq(SysDictItem::getItemValue,sysDictItem.getItemValue());
|
||||
queryWrapper.eq(SysDictItem::getDictId,sysDictItem.getDictId());
|
||||
if (StringUtils.isNotBlank(sysDictItem.getId())) {
|
||||
// 编辑页面校验
|
||||
queryWrapper.ne(SysDictItem::getId,sysDictItem.getId());
|
||||
}
|
||||
num = sysDictItemService.count(queryWrapper);
|
||||
if (num == 0) {
|
||||
// 该值可用
|
||||
return Result.ok("该值可用!");
|
||||
} else {
|
||||
// 该值不可用
|
||||
log.info("该值不可用,系统中已存在!");
|
||||
return Result.error("该值不可用,系统中已存在!");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+1
@@ -472,6 +472,7 @@ public class SysPermissionController {
|
||||
json = new JSONObject();
|
||||
json.put("action", permission.getPerms());
|
||||
json.put("status", permission.getStatus());
|
||||
//1显示2禁用
|
||||
json.put("type", permission.getPermsType());
|
||||
json.put("describe", permission.getName());
|
||||
jsonArray.add(json);
|
||||
|
||||
+4
-4
@@ -460,7 +460,7 @@ public class SysUserController {
|
||||
successLines++;
|
||||
} catch (Exception e) {
|
||||
errorLines++;
|
||||
String message = e.getMessage();
|
||||
String message = e.getMessage().toLowerCase();
|
||||
int lineNumber = i + 1;
|
||||
// 通过索引名判断出错信息
|
||||
if (message.contains(CommonConstant.SQL_INDEX_UNIQ_SYS_USER_USERNAME)) {
|
||||
@@ -1043,10 +1043,10 @@ public class SysUserController {
|
||||
if (oConvertUtils.isEmpty(token)) {
|
||||
username = JwtUtil.getUserNameByToken(request);
|
||||
} else {
|
||||
username = JwtUtil.getUsername(token);
|
||||
username = JwtUtil.getUsername(token);
|
||||
}
|
||||
|
||||
log.info(" ------ 通过令牌获取部分用户信息,当前用户: " + username);
|
||||
log.debug(" ------ 通过令牌获取部分用户信息,当前用户: " + username);
|
||||
|
||||
// 根据用户名查询用户信息
|
||||
SysUser sysUser = sysUserService.getUserByName(username);
|
||||
@@ -1056,7 +1056,7 @@ public class SysUserController {
|
||||
map.put("sysUserName", sysUser.getRealname()); // 当前登录用户真实名称
|
||||
map.put("sysOrgCode", sysUser.getOrgCode()); // 当前登录用户部门编号
|
||||
|
||||
log.info(" ------ 通过令牌获取部分用户信息,已获取的用户信息: " + map);
|
||||
log.debug(" ------ 通过令牌获取部分用户信息,已获取的用户信息: " + map);
|
||||
|
||||
return Result.ok(map);
|
||||
} catch (Exception e) {
|
||||
|
||||
+4
-7
@@ -1,17 +1,14 @@
|
||||
package org.jeecg.modules.system.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
import lombok.Data;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @Description: 分类字典
|
||||
|
||||
+1
-1
@@ -47,7 +47,7 @@ public class SysDepart implements Serializable {
|
||||
/**描述*/
|
||||
@Excel(name="描述",width=15)
|
||||
private String description;
|
||||
/**机构类别 1组织机构,2岗位*/
|
||||
/**机构类别 1公司,2组织机构,2岗位*/
|
||||
@Excel(name="机构类别",width=15,dicCode="org_category")
|
||||
private String orgCategory;
|
||||
/**机构类型*/
|
||||
|
||||
+2
-2
@@ -72,10 +72,10 @@ public class SysGatewayRoute implements Serializable {
|
||||
private Integer retryable;
|
||||
|
||||
/**是否为保留数据:0-否 1-是*/
|
||||
@Excel(name = "是否重试", width = 15)
|
||||
@Excel(name = "保留数据", width = 15)
|
||||
@ApiModelProperty(value = "保留数据")
|
||||
@Dict(dicCode = "yn")
|
||||
private Integer persist;
|
||||
private Integer persistable;
|
||||
|
||||
/**是否在接口文档中展示:0-否 1-是*/
|
||||
@Excel(name = "在接口文档中展示", width = 15)
|
||||
|
||||
+14
-1
@@ -3,6 +3,7 @@ package org.jeecg.modules.system.mapper;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.ResultType;
|
||||
@@ -74,7 +75,19 @@ public interface SysDictMapper extends BaseMapper<SysDict> {
|
||||
* @return
|
||||
*/
|
||||
@Deprecated
|
||||
public List<DictModel> queryTableDictItems(@Param("table") String table,@Param("text") String text,@Param("code") String code,@Param("keyword") String keyword);
|
||||
public List<DictModel> queryTableDictItems(@Param("table") String table,@Param("text") String text,@Param("code") String code,@Param("keyword") String keyword);
|
||||
|
||||
|
||||
/**
|
||||
* 通过关键字查询出字典表
|
||||
* @param page
|
||||
* @param table
|
||||
* @param text
|
||||
* @param code
|
||||
* @param keyword
|
||||
* @return
|
||||
*/
|
||||
IPage<DictModel> queryTableDictItems(Page<DictModel> page, @Param("table") String table, @Param("text") String text, @Param("code") String code, @Param("keyword") String keyword);
|
||||
|
||||
/**
|
||||
* 根据表名、显示字段名、存储字段名 查询树
|
||||
|
||||
+6
@@ -52,5 +52,11 @@ public interface ISysCategoryService extends IService<SysCategory> {
|
||||
* @return
|
||||
*/
|
||||
public String queryIdByCode(String code);
|
||||
|
||||
/**
|
||||
* 删除节点时同时删除子节点及修改父级节点
|
||||
* @param ids
|
||||
*/
|
||||
void deleteSysCategory(String ids);
|
||||
|
||||
}
|
||||
|
||||
+10
-1
@@ -73,7 +73,16 @@ public interface ISysDictService extends IService<SysDict> {
|
||||
*/
|
||||
@Deprecated
|
||||
public List<DictModel> queryTableDictItems(String table, String text, String code,String keyword);
|
||||
|
||||
|
||||
/**
|
||||
* 查询字典表数据 只查询前10条
|
||||
* @param table
|
||||
* @param text
|
||||
* @param code
|
||||
* @param keyword
|
||||
* @return
|
||||
*/
|
||||
public List<DictModel> queryLittleTableDictItems(String table, String text, String code,String keyword, int pageSize);
|
||||
/**
|
||||
* 根据表名、显示字段名、存储字段名 查询树
|
||||
* @param table
|
||||
|
||||
+37
-7
@@ -27,6 +27,7 @@ import org.jeecg.common.util.SysAnnmentTypeEnum;
|
||||
import org.jeecg.common.util.YouBianCodeUtil;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.message.entity.SysMessageTemplate;
|
||||
import org.jeecg.modules.message.handle.impl.EmailSendMsgHandle;
|
||||
import org.jeecg.modules.message.service.ISysMessageTemplateService;
|
||||
import org.jeecg.modules.message.websocket.WebSocket;
|
||||
import org.jeecg.modules.system.entity.*;
|
||||
@@ -324,7 +325,9 @@ public class SysBaseApiImpl implements ISysBaseAPI {
|
||||
if(map!=null) {
|
||||
for (Map.Entry<String, String> entry : map.entrySet()) {
|
||||
String str = "${" + entry.getKey() + "}";
|
||||
title = title.replace(str, entry.getValue());
|
||||
if(oConvertUtils.isNotEmpty(title)){
|
||||
title = title.replace(str, entry.getValue());
|
||||
}
|
||||
content = content.replace(str, entry.getValue());
|
||||
}
|
||||
}
|
||||
@@ -360,7 +363,7 @@ public class SysBaseApiImpl implements ISysBaseAPI {
|
||||
obj.put(WebsocketConst.MSG_USER_ID, sysUser.getId());
|
||||
obj.put(WebsocketConst.MSG_ID, announcement.getId());
|
||||
obj.put(WebsocketConst.MSG_TXT, announcement.getTitile());
|
||||
webSocket.sendOneMessage(sysUser.getId(), obj.toJSONString());
|
||||
webSocket.sendMessage(sysUser.getId(), obj.toJSONString());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -427,7 +430,7 @@ public class SysBaseApiImpl implements ISysBaseAPI {
|
||||
obj.put(WebsocketConst.MSG_USER_ID, sysUser.getId());
|
||||
obj.put(WebsocketConst.MSG_ID, announcement.getId());
|
||||
obj.put(WebsocketConst.MSG_TXT, announcement.getTitile());
|
||||
webSocket.sendOneMessage(sysUser.getId(), obj.toJSONString());
|
||||
webSocket.sendMessage(sysUser.getId(), obj.toJSONString());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -666,7 +669,7 @@ public class SysBaseApiImpl implements ISysBaseAPI {
|
||||
public void sendWebSocketMsg(String[] userIds, String cmd) {
|
||||
JSONObject obj = new JSONObject();
|
||||
obj.put(WebsocketConst.MSG_CMD, cmd);
|
||||
webSocket.sendMoreMessage(userIds, obj.toJSONString());
|
||||
webSocket.sendMessage(userIds, obj.toJSONString());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -693,7 +696,7 @@ public class SysBaseApiImpl implements ISysBaseAPI {
|
||||
obj.put(WebsocketConst.MSG_CMD, WebsocketConst.CMD_SIGN);
|
||||
obj.put(WebsocketConst.MSG_USER_ID,userId);
|
||||
//TODO 目前全部推送,后面修改
|
||||
webSocket.sendAllMessage(obj.toJSONString());
|
||||
webSocket.sendMessage(obj.toJSONString());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -853,6 +856,13 @@ public class SysBaseApiImpl implements ISysBaseAPI {
|
||||
return JSON.parseArray(JSON.toJSONString(userMapper.selectList(queryWrapper))).toJavaList(JSONObject.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<JSONObject> queryUsersByIds(String ids) {
|
||||
LambdaQueryWrapper<SysUser> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.in(SysUser::getId,ids.split(","));
|
||||
return JSON.parseArray(JSON.toJSONString(userMapper.selectList(queryWrapper))).toJavaList(JSONObject.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 37根据多个部门编码(逗号分隔),查询返回多个部门信息
|
||||
* @param usernames
|
||||
@@ -865,6 +875,13 @@ public class SysBaseApiImpl implements ISysBaseAPI {
|
||||
return JSON.parseArray(JSON.toJSONString(sysDepartService.list(queryWrapper))).toJavaList(JSONObject.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<JSONObject> queryDepartsByIds(String ids) {
|
||||
LambdaQueryWrapper<SysDepart> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.in(SysDepart::getId,ids.split(","));
|
||||
return JSON.parseArray(JSON.toJSONString(sysDepartService.list(queryWrapper))).toJavaList(JSONObject.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 发消息
|
||||
* @param fromUser
|
||||
@@ -905,7 +922,7 @@ public class SysBaseApiImpl implements ISysBaseAPI {
|
||||
obj.put(WebsocketConst.MSG_USER_ID, sysUser.getId());
|
||||
obj.put(WebsocketConst.MSG_ID, announcement.getId());
|
||||
obj.put(WebsocketConst.MSG_TXT, announcement.getTitile());
|
||||
webSocket.sendOneMessage(sysUser.getId(), obj.toJSONString());
|
||||
webSocket.sendMessage(sysUser.getId(), obj.toJSONString());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -957,8 +974,21 @@ public class SysBaseApiImpl implements ISysBaseAPI {
|
||||
obj.put(WebsocketConst.MSG_USER_ID, sysUser.getId());
|
||||
obj.put(WebsocketConst.MSG_ID, announcement.getId());
|
||||
obj.put(WebsocketConst.MSG_TXT, announcement.getTitile());
|
||||
webSocket.sendOneMessage(sysUser.getId(), obj.toJSONString());
|
||||
webSocket.sendMessage(sysUser.getId(), obj.toJSONString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送邮件消息
|
||||
* @param email
|
||||
* @param title
|
||||
* @param content
|
||||
*/
|
||||
@Override
|
||||
public void sendEmailMsg(String email, String title, String content) {
|
||||
EmailSendMsgHandle emailHandle=new EmailSendMsgHandle();
|
||||
emailHandle.SendMsg(email, title, content);
|
||||
}
|
||||
|
||||
}
|
||||
+97
@@ -1,9 +1,12 @@
|
||||
package org.jeecg.modules.system.service.impl;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import org.jeecg.common.constant.FillRuleConstant;
|
||||
import org.jeecg.common.exception.JeecgBootException;
|
||||
import org.jeecg.common.util.FillRuleUtil;
|
||||
@@ -17,6 +20,7 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* @Description: 分类字典
|
||||
@@ -107,4 +111,97 @@ public class SysCategoryServiceImpl extends ServiceImpl<SysCategoryMapper, SysCa
|
||||
return baseMapper.queryIdByCode(code);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteSysCategory(String ids) {
|
||||
String allIds = this.queryTreeChildIds(ids);
|
||||
String pids = this.queryTreePids(ids);
|
||||
//1.删除时将节点下所有子节点一并删除
|
||||
this.baseMapper.deleteBatchIds(Arrays.asList(allIds.split(",")));
|
||||
//2.将父节点中已经没有下级的节点,修改为没有子节点
|
||||
if(oConvertUtils.isNotEmpty(pids)){
|
||||
LambdaUpdateWrapper<SysCategory> updateWrapper = new UpdateWrapper<SysCategory>()
|
||||
.lambda()
|
||||
.in(SysCategory::getId,Arrays.asList(pids.split(",")))
|
||||
.set(SysCategory::getHasChild,"0");
|
||||
this.update(updateWrapper);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询节点下所有子节点
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
private String queryTreeChildIds(String ids) {
|
||||
//获取id数组
|
||||
String[] idArr = ids.split(",");
|
||||
StringBuffer sb = new StringBuffer();
|
||||
for (String pidVal : idArr) {
|
||||
if(pidVal != null){
|
||||
if(!sb.toString().contains(pidVal)){
|
||||
if(sb.toString().length() > 0){
|
||||
sb.append(",");
|
||||
}
|
||||
sb.append(pidVal);
|
||||
this.getTreeChildIds(pidVal,sb);
|
||||
}
|
||||
}
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询需修改标识的父节点ids
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
private String queryTreePids(String ids) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
//获取id数组
|
||||
String[] idArr = ids.split(",");
|
||||
for (String id : idArr) {
|
||||
if(id != null){
|
||||
SysCategory category = this.baseMapper.selectById(id);
|
||||
//根据id查询pid值
|
||||
String metaPid = category.getPid();
|
||||
//查询此节点上一级是否还有其他子节点
|
||||
LambdaQueryWrapper<SysCategory> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(SysCategory::getPid,metaPid);
|
||||
queryWrapper.notIn(SysCategory::getId,Arrays.asList(idArr));
|
||||
List<SysCategory> dataList = this.baseMapper.selectList(queryWrapper);
|
||||
if((dataList == null || dataList.size()==0) && !Arrays.asList(idArr).contains(metaPid)
|
||||
&& !sb.toString().contains(metaPid)){
|
||||
//如果当前节点原本有子节点 现在木有了,更新状态
|
||||
sb.append(metaPid).append(",");
|
||||
}
|
||||
}
|
||||
}
|
||||
if(sb.toString().endsWith(",")){
|
||||
sb = sb.deleteCharAt(sb.length() - 1);
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归 根据父id获取子节点id
|
||||
* @param pidVal
|
||||
* @param sb
|
||||
* @return
|
||||
*/
|
||||
private StringBuffer getTreeChildIds(String pidVal,StringBuffer sb){
|
||||
LambdaQueryWrapper<SysCategory> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(SysCategory::getPid,pidVal);
|
||||
List<SysCategory> dataList = baseMapper.selectList(queryWrapper);
|
||||
if(dataList != null && dataList.size()>0){
|
||||
for(SysCategory category : dataList) {
|
||||
if(!sb.toString().contains(category.getId())){
|
||||
sb.append(",").append(category.getId());
|
||||
}
|
||||
this.getTreeChildIds(category.getId(), sb);
|
||||
}
|
||||
}
|
||||
return sb;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+11
-1
@@ -1,6 +1,7 @@
|
||||
package org.jeecg.modules.system.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -138,7 +139,9 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@Cacheable(value = CacheConstant.SYS_DICT_TABLE_BY_KEYS_CACHE)
|
||||
//update-begin--Author:lvdandan Date:20201204 for:JT-36【online】树形列表bug修改后,还是显示原来值 暂时去掉缓存
|
||||
//@Cacheable(value = CacheConstant.SYS_DICT_TABLE_BY_KEYS_CACHE)
|
||||
//update-end--Author:lvdandan Date:20201204 for:JT-36【online】树形列表bug修改后,还是显示原来值 暂时去掉缓存
|
||||
public List<String> queryTableDictByKeys(String table, String text, String code, String keys) {
|
||||
if(oConvertUtils.isEmpty(keys)){
|
||||
return null;
|
||||
@@ -201,6 +204,13 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
|
||||
return baseMapper.queryTableDictItems(table, text, code, "%"+keyword+"%");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DictModel> queryLittleTableDictItems(String table, String text, String code, String keyword, int pageSize) {
|
||||
Page<DictModel> page = new Page<DictModel>(1, pageSize);
|
||||
IPage<DictModel> pageList = baseMapper.queryTableDictItems(page, table, text, code, "%"+keyword+"%");
|
||||
return pageList.getRecords();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TreeSelectModel> queryTreeList(Map<String, String> query,String table, String text, String code, String pidField,String pid,String hasChildField) {
|
||||
return baseMapper.queryTreeList(query,table, text, code, pidField, pid,hasChildField);
|
||||
|
||||
+2
@@ -79,6 +79,8 @@ public class SysThirdAccountServiceImpl extends ServiceImpl<SysThirdAccountMappe
|
||||
user.setSalt(salt);
|
||||
String passwordEncode = PasswordUtil.encrypt(user.getUsername(), "123456", salt);
|
||||
user.setPassword(passwordEncode);
|
||||
user.setRealname(account.getRealname());
|
||||
user.setAvatar(account.getAvatar());
|
||||
String s = this.saveThirdUser(user);
|
||||
//更新用户第三方账户表的userId
|
||||
SysThirdAccount sysThirdAccount = new SysThirdAccount();
|
||||
|
||||
@@ -161,7 +161,7 @@ mybatis-plus:
|
||||
# 关闭MP3.0自带的banner
|
||||
banner: false
|
||||
db-config:
|
||||
#主键类型
|
||||
#主键类型 0:"数据库ID自增",1:"该类型为未设置主键类型", 2:"用户输入ID",3:"全局唯一ID (数字类型唯一ID)", 4:"全局唯一ID UUID",5:"字符串全局唯一ID (idWorker 的字符串表示)";
|
||||
id-type: ASSIGN_ID
|
||||
# 默认数据库表下划线命名
|
||||
table-underline: true
|
||||
@@ -210,6 +210,8 @@ jeecg :
|
||||
#大屏报表参数设置
|
||||
jmreport:
|
||||
mode: dev
|
||||
#数据字典是否可以全局看到
|
||||
saas: false
|
||||
#是否需要校验token
|
||||
is_verify_token: false
|
||||
#必须校验方法
|
||||
@@ -262,17 +264,17 @@ justauth:
|
||||
enabled: true
|
||||
type:
|
||||
GITHUB:
|
||||
client-id: ??
|
||||
client-secret: ??
|
||||
client-id: true
|
||||
client-secret: true
|
||||
redirect-uri: http://sso.test.com:8080/jeecg-boot/sys/thirdLogin/github/callback
|
||||
WECHAT_ENTERPRISE:
|
||||
client-id: ??
|
||||
client-secret: ??
|
||||
client-id: true
|
||||
client-secret: true
|
||||
redirect-uri: http://sso.test.com:8080/jeecg-boot/sys/thirdLogin/wechat_enterprise/callback
|
||||
agent-id: 1000002
|
||||
DINGTALK:
|
||||
client-id: ??
|
||||
client-secret: ??
|
||||
client-id: true
|
||||
client-secret: true
|
||||
redirect-uri: http://sso.test.com:8080/jeecg-boot/sys/thirdLogin/dingtalk/callback
|
||||
WECHAT_OPEN:
|
||||
client-id: ??
|
||||
|
||||
@@ -180,7 +180,7 @@ jeecg :
|
||||
#webapp文件路径
|
||||
webapp: /opt/jeecg-boot/webapp
|
||||
shiro:
|
||||
excludeUrls: /test/jeecgDemo/demo3,/test/jeecgDemo/redisDemo/**,/category/**,/visual/**,/map/**,/jmreport/bigscreen2/**,/api/getUserInfo
|
||||
excludeUrls: /test/jeecgDemo/demo3,/test/jeecgDemo/redisDemo/**,/category/**,/visual/**,/map/**,/jmreport/bigscreen2/**
|
||||
#阿里云oss存储配置
|
||||
oss:
|
||||
endpoint: oss-cn-beijing.aliyuncs.com
|
||||
@@ -191,7 +191,7 @@ jeecg :
|
||||
# ElasticSearch 设置
|
||||
elasticsearch:
|
||||
cluster-name: jeecg-ES
|
||||
cluster-nodes: 127.0.0.1:9200
|
||||
cluster-nodes: 111.225.222.176:9200
|
||||
check-enabled: true
|
||||
# 表单设计器配置
|
||||
desform:
|
||||
@@ -210,6 +210,8 @@ jeecg :
|
||||
#大屏报表参数设置
|
||||
jmreport:
|
||||
mode: prod
|
||||
#数据字典是否可以全局看到
|
||||
saas: false
|
||||
#是否需要校验token
|
||||
is_verify_token: true
|
||||
#必须校验方法
|
||||
@@ -217,8 +219,8 @@ jeecg :
|
||||
#Wps在线文档
|
||||
wps:
|
||||
domain: https://wwo.wps.cn/office/
|
||||
appid: ??
|
||||
appsecret: ??
|
||||
appid: true
|
||||
appsecret: true
|
||||
#xxl-job配置
|
||||
xxljob:
|
||||
enabled: false
|
||||
@@ -248,10 +250,10 @@ cas:
|
||||
#Mybatis输出sql日志
|
||||
logging:
|
||||
level:
|
||||
org.jeecg.modules.system.mapper : debug
|
||||
org.jeecg.modules.system.mapper : info
|
||||
#enable swagger
|
||||
swagger:
|
||||
enable: false
|
||||
enable: true
|
||||
production: false
|
||||
basic:
|
||||
enable: false
|
||||
@@ -262,21 +264,21 @@ justauth:
|
||||
enabled: true
|
||||
type:
|
||||
GITHUB:
|
||||
client-id: ??
|
||||
client-secret: ??
|
||||
client-id: true
|
||||
client-secret: true
|
||||
redirect-uri: http://sso.test.com:8080/jeecg-boot/sys/thirdLogin/github/callback
|
||||
WECHAT_ENTERPRISE:
|
||||
client-id: ??
|
||||
client-secret: ??
|
||||
client-id: true
|
||||
client-secret: true
|
||||
redirect-uri: http://sso.test.com:8080/jeecg-boot/sys/thirdLogin/wechat_enterprise/callback
|
||||
agent-id: 1000002
|
||||
DINGTALK:
|
||||
client-id: ??
|
||||
client-secret: ??
|
||||
client-id: true
|
||||
client-secret: true
|
||||
redirect-uri: http://sso.test.com:8080/jeecg-boot/sys/thirdLogin/dingtalk/callback
|
||||
WECHAT_OPEN:
|
||||
client-id: ??
|
||||
client-secret: ??
|
||||
client-id: true
|
||||
client-secret: true
|
||||
redirect-uri: http://sso.test.com:8080/jeecg-boot/sys/thirdLogin/wechat_open/callback
|
||||
cache:
|
||||
type: default
|
||||
|
||||
@@ -210,6 +210,8 @@ jeecg :
|
||||
#大屏报表参数设置
|
||||
jmreport:
|
||||
mode: prod
|
||||
#数据字典是否可以全局看到
|
||||
saas: false
|
||||
#是否需要校验token
|
||||
is_verify_token: false
|
||||
#必须校验方法
|
||||
@@ -245,7 +247,7 @@ jeecg :
|
||||
#Mybatis输出sql日志
|
||||
logging:
|
||||
level:
|
||||
org.jeecg.modules.system.mapper : debug
|
||||
org.jeecg.modules.system.mapper : info
|
||||
#cas单点登录
|
||||
cas:
|
||||
prefixUrl: http://cas.example.org:8443/cas
|
||||
|
||||
@@ -9,6 +9,6 @@ ${AnsiColor.BRIGHT_BLUE}
|
||||
|
||||
|
||||
${AnsiColor.BRIGHT_GREEN}
|
||||
Jeecg Boot Version: 2.4.0
|
||||
Jeecg Boot Version: 2.4.2
|
||||
Spring Boot Version: ${spring-boot.version}${spring-boot.formatted-version}
|
||||
${AnsiColor.BLACK}
|
||||
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
<#if po.fieldDbType=='Blob'>
|
||||
private transient java.lang.String ${po.fieldName}String;
|
||||
|
||||
private byte[] ${po.fieldName};
|
||||
|
||||
public byte[] get${po.fieldName?cap_first}(){
|
||||
if(${po.fieldName}String==null){
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return ${po.fieldName}String.getBytes("UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String get${po.fieldName?cap_first}String(){
|
||||
if(${po.fieldName}==null || ${po.fieldName}.length==0){
|
||||
return "";
|
||||
}
|
||||
try {
|
||||
return new String(${po.fieldName},"UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
<#else>
|
||||
@ApiModelProperty(value = "${po.filedComment}")
|
||||
private ${po.fieldType} ${po.fieldName};
|
||||
</#if>
|
||||
+10
@@ -56,6 +56,7 @@
|
||||
|| po.fieldValidType == 'n'
|
||||
|| po.fieldValidType == 'z'
|
||||
|| po.fieldValidType == 'money'
|
||||
|| po.fieldValidType != ''
|
||||
>
|
||||
<#return true>
|
||||
</#if>
|
||||
@@ -74,6 +75,15 @@
|
||||
</#if>
|
||||
</#function>
|
||||
|
||||
<#-- ** 如果Blob就显示 String * -->
|
||||
<#function autoStringSuffix po>
|
||||
<#if po.fieldDbType=='Blob'>
|
||||
<#return "'${po.fieldName}String'">
|
||||
<#else>
|
||||
<#return "'${po.fieldName}'">
|
||||
</#if>
|
||||
</#function>
|
||||
|
||||
<#-- ** 高级查询生成 * -->
|
||||
<#function superQueryFieldList po>
|
||||
<#assign superQuery_dictTable="">
|
||||
|
||||
+6
-3
@@ -19,10 +19,10 @@
|
||||
</#if>
|
||||
<#-- 唯一校验 -->
|
||||
<#if fieldValidType == 'only'>
|
||||
{ validator: (rule, value, callback) => validateDuplicateValue('${tableName}', '${po.fieldDbName}', value, this.model.id, callback)},
|
||||
{ validator: (rule, value, callback) => validateDuplicateValue(<#if sub?default("")?trim?length gt 1>'${sub.tableName}'<#else>'${tableName}'</#if>, '${po.fieldDbName}', value, this.model.id, callback)},
|
||||
<#-- 6到16位数字 -->
|
||||
<#elseif fieldValidType == 'n6-16'>
|
||||
{ pattern: /\d{6,18}/, message: '请输入6到16位数字!'},
|
||||
{ pattern: /^\d{6,16}$/, message: '请输入6到16位数字!'},
|
||||
<#-- 6到16位任意字符 -->
|
||||
<#elseif fieldValidType == '*6-16'>
|
||||
{ pattern: /^.{6,16}$/, message: '请输入6到16位任意字符!'},
|
||||
@@ -31,7 +31,7 @@
|
||||
{ pattern: /^.{6,18}$/, message: '请输入6到18位任意字符!'},
|
||||
<#-- 网址 -->
|
||||
<#elseif fieldValidType == 'url'>
|
||||
{ pattern: /^(?:([A-Za-z]+):)?(\/{0,3})([0-9.\-A-Za-z]+)(?::(\d+))?(?:\/([^?#]*))?(?:\?([^#]*))?(?:#(.*))?$/, message: '请输入正确的网址!'},
|
||||
{ pattern: /^((ht|f)tps?):\/\/[\w\-]+(\.[\w\-]+)+([\w\-.,@?^=%&:\/~+#]*[\w\-@?^=%&\/~+#])?$/, message: '请输入正确的网址!'},
|
||||
<#-- 电子邮件 -->
|
||||
<#elseif fieldValidType == 'e'>
|
||||
{ pattern: /^([\w]+\.*)([\w]+)@[\w]+\.\w{3}(\.\w{2}|)$/, message: '请输入正确的电子邮件!'},
|
||||
@@ -53,6 +53,9 @@
|
||||
<#-- 金额 -->
|
||||
<#elseif fieldValidType == 'money'>
|
||||
{ pattern: /^(([1-9][0-9]*)|([0]\.\d{0,2}|[1-9][0-9]*\.\d{0,2}))$/, message: '请输入正确的金额!'},
|
||||
<#-- 正则校验 -->
|
||||
<#elseif fieldValidType != '' && fieldValidType != '*'>
|
||||
{ pattern: '${fieldValidType}', message: '不符合校验规则!'},
|
||||
<#-- 无校验 -->
|
||||
<#else>
|
||||
<#t>
|
||||
|
||||
+1
-32
@@ -80,37 +80,6 @@ public class ${entityName} implements Serializable {
|
||||
</#if>
|
||||
</#if>-->
|
||||
</#if>
|
||||
<#if po.fieldDbType=='Blob'>
|
||||
private transient java.lang.String ${po.fieldName}String;
|
||||
|
||||
private byte[] ${po.fieldName};
|
||||
|
||||
public byte[] get${po.fieldName?cap_first}(){
|
||||
if(${po.fieldName}String==null){
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return ${po.fieldName}String.getBytes("UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String get${po.fieldName?cap_first}String(){
|
||||
if(${po.fieldName}==null || ${po.fieldName}.length==0){
|
||||
return "";
|
||||
}
|
||||
try {
|
||||
return new String(${po.fieldName},"UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
<#else>
|
||||
@ApiModelProperty(value = "${po.filedComment}")
|
||||
private ${po.fieldType} ${po.fieldName};
|
||||
</#if>
|
||||
<#include "/common/blob.ftl">
|
||||
</#list>
|
||||
}
|
||||
|
||||
+2
-90
@@ -5,21 +5,10 @@
|
||||
<a-form layout="inline" @keyup.enter.native="searchQuery">
|
||||
<a-row :gutter="24">
|
||||
<#assign query_field_no=0>
|
||||
<#assign query_field_select=false>
|
||||
<#assign query_field_date=false>
|
||||
<#assign query_flag=false>
|
||||
<#assign list_need_dict=false>
|
||||
<#assign list_need_category=false>
|
||||
<#assign query_field_pca=false>
|
||||
<#assign list_need_pca=false>
|
||||
<#assign query_flag=false>
|
||||
<#assign query_inp=false>
|
||||
<#assign query_popup=false>
|
||||
<#assign query_sel_user=false>
|
||||
<#assign query_sel_dep=false>
|
||||
<#assign query_sel_multi=false>
|
||||
<#assign query_sel_cat=false>
|
||||
<#assign query_sel_search=false>
|
||||
<#assign query_switch=false>
|
||||
<#assign list_need_switch=false>
|
||||
<#assign bpm_flag=false>
|
||||
|
||||
@@ -43,36 +32,26 @@
|
||||
<#if query_field_no gt 1> </#if><a-col :xl="6" :lg="7" :md="8" :sm="24">
|
||||
<#if query_field_no gt 1> </#if><a-form-item label="${po.filedComment}">
|
||||
<#if po.classType=='sel_search'>
|
||||
<#assign query_sel_search=true>
|
||||
<#if query_field_no gt 1> </#if><j-search-select-tag placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" dict="${po.dictTable},${po.dictText},${po.dictField}"/>
|
||||
<#elseif po.classType=='sel_user'>
|
||||
<#assign query_sel_user=true>
|
||||
<#if query_field_no gt 1> </#if><j-select-user-by-dep placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}"/>
|
||||
<#elseif po.classType=='switch'>
|
||||
<#assign query_switch=true>
|
||||
<#if query_field_no gt 1> </#if><j-switch placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" <#if po.dictField?default("")?trim?length gt 1>:options="${po.dictField}"</#if> query></j-switch>
|
||||
<#elseif po.classType=='sel_depart'>
|
||||
<#assign query_sel_dep=true>
|
||||
<#if query_field_no gt 1> </#if><j-select-depart placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}"/>
|
||||
<#elseif po.classType=='list_multi'>
|
||||
<#assign query_sel_multi=true>
|
||||
<#if query_field_no gt 1> </#if><j-multi-select-tag placeholder="请选择${po.filedComment}" dictCode="${query_field_dictCode?default("")}" v-model="queryParam.${po.fieldName}"/>
|
||||
<#elseif po.classType=='cat_tree'>
|
||||
<#assign query_sel_cat=true>
|
||||
<#if query_field_no gt 1> </#if><j-category-select placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" pcode="${po.dictField?default("")}"/>
|
||||
<#elseif po.classType=='date'>
|
||||
<#assign query_field_date=true>
|
||||
<#if query_field_no gt 1> </#if><j-date placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}"></j-date>
|
||||
<#elseif po.classType=='datetime'>
|
||||
<#assign query_field_date=true>
|
||||
<#if query_field_no gt 1> </#if><j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}"></j-date>
|
||||
<#elseif po.classType=='pca'>
|
||||
<#assign query_field_pca=true>
|
||||
<#if query_field_no gt 1> </#if><j-area-linkage type="cascader" v-model="queryParam.${po.fieldName}" placeholder="请选择省市区"/>
|
||||
<#elseif po.classType=='popup'>
|
||||
<#if query_field_no gt 1> </#if><j-popup placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" code="${po.dictTable}" org-fields="${po.dictField}" dest-fields="${po.dictText}" :field="getPopupField('${po.dictText}')"/>
|
||||
<#elseif po.classType=='list' || po.classType=='radio' || po.classType=='checkbox'>
|
||||
<#assign query_field_select=true>
|
||||
<#-- ---------------------------下拉或是单选 判断数据字典是表字典还是普通字典------------------------------- -->
|
||||
<#if po.dictTable?default("")?trim?length gt 1>
|
||||
<#if query_field_no gt 1> </#if><j-dict-select-tag placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" dictCode="${po.dictTable},${po.dictText},${po.dictField}"/>
|
||||
@@ -90,12 +69,10 @@
|
||||
<#if query_field_no gt 1> </#if><a-col :xl="10" :lg="11" :md="12" :sm="24">
|
||||
<#if query_field_no gt 1> </#if><a-form-item label="${po.filedComment}">
|
||||
<#if po.classType=='date'>
|
||||
<#assign query_field_date=true>
|
||||
<#if query_field_no gt 1> </#if><j-date placeholder="请选择开始日期" class="query-group-cust" v-model="queryParam.${po.fieldName}_begin"></j-date>
|
||||
<#if query_field_no gt 1> </#if><span class="query-group-split-cust"></span>
|
||||
<#if query_field_no gt 1> </#if><j-date placeholder="请选择结束日期" class="query-group-cust" v-model="queryParam.${po.fieldName}_end"></j-date>
|
||||
<#elseif po.classType=='datetime'>
|
||||
<#assign query_field_date=true>
|
||||
<#if query_field_no gt 1> </#if><j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择开始时间" class="query-group-cust" v-model="queryParam.${po.fieldName}_begin"></j-date>
|
||||
<#if query_field_no gt 1> </#if><span class="query-group-split-cust"></span>
|
||||
<#if query_field_no gt 1> </#if><j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择结束时间" class="query-group-cust" v-model="queryParam.${po.fieldName}_end"></j-date>
|
||||
@@ -118,9 +95,6 @@
|
||||
<#if po.classType=='pca'>
|
||||
<#assign list_need_pca=true>
|
||||
</#if>
|
||||
<#if po.classType=='switch'>
|
||||
<#assign list_need_switch=true>
|
||||
</#if>
|
||||
</#list>
|
||||
<#-- 结束循环 -->
|
||||
<#t>
|
||||
@@ -249,83 +223,21 @@
|
||||
<#if bpm_flag>
|
||||
import { postAction } from '@/api/manage'
|
||||
</#if>
|
||||
<#if query_field_select>
|
||||
import JDictSelectTag from '@/components/dict/JDictSelectTag.vue'
|
||||
</#if>
|
||||
<#if query_field_date>
|
||||
import JDate from '@/components/jeecg/JDate.vue'
|
||||
</#if>
|
||||
<#if list_need_category>
|
||||
import { loadCategoryData } from '@/api/api'
|
||||
</#if>
|
||||
<#if list_need_dict>
|
||||
import {filterMultiDictText} from '@/components/dict/JDictSelectUtil'
|
||||
</#if>
|
||||
<#if query_field_pca>
|
||||
import JAreaLinkage from '@comp/jeecg/JAreaLinkage'
|
||||
</#if>
|
||||
<#if list_need_pca>
|
||||
import Area from '@/components/_util/Area'
|
||||
</#if>
|
||||
<#if query_inp>
|
||||
import JInput from '@comp/jeecg/JInput'
|
||||
</#if>
|
||||
<#if query_sel_user>
|
||||
import JSelectUserByDep from '@/components/jeecgbiz/JSelectUserByDep'
|
||||
</#if>
|
||||
<#if query_sel_dep>
|
||||
import JSelectDepart from '@/components/jeecgbiz/JSelectDepart'
|
||||
</#if>
|
||||
<#if query_sel_multi>
|
||||
import JMultiSelectTag from '@/components/dict/JMultiSelectTag'
|
||||
</#if>
|
||||
<#if query_sel_cat>
|
||||
import JCategorySelect from '@comp/jeecg/JCategorySelect'
|
||||
</#if>
|
||||
<#if query_sel_search>
|
||||
import JSearchSelectTag from '@/components/dict/JSearchSelectTag'
|
||||
</#if>
|
||||
<#if query_switch>
|
||||
import JSwitch from '@/components/jeecg/JSwitch'
|
||||
</#if>
|
||||
import JSuperQuery from '@/components/jeecg/JSuperQuery.vue'
|
||||
|
||||
export default {
|
||||
name: '${entityName}List',
|
||||
mixins:[JeecgListMixin, mixinDevice],
|
||||
components: {
|
||||
<#if query_field_select>
|
||||
JDictSelectTag,
|
||||
</#if>
|
||||
<#if query_field_date>
|
||||
JDate,
|
||||
</#if>
|
||||
<#if query_field_pca>
|
||||
JAreaLinkage,
|
||||
</#if>
|
||||
<#if query_inp>
|
||||
JInput,
|
||||
</#if>
|
||||
<#if query_sel_user>
|
||||
JSelectUserByDep,
|
||||
</#if>
|
||||
<#if query_sel_dep>
|
||||
JSelectDepart,
|
||||
</#if>
|
||||
<#if query_sel_multi>
|
||||
JMultiSelectTag,
|
||||
</#if>
|
||||
<#if query_sel_cat>
|
||||
JCategorySelect,
|
||||
</#if>
|
||||
<#if query_sel_search>
|
||||
JSearchSelectTag,
|
||||
</#if>
|
||||
<#if query_switch>
|
||||
JSwitch,
|
||||
</#if>
|
||||
${entityName}Modal,
|
||||
JSuperQuery,
|
||||
${entityName}Modal
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
|
||||
+6
-112
@@ -5,21 +5,8 @@
|
||||
<j-form-container :disabled="formDisabled">
|
||||
<a-form :form="form" slot="detail">
|
||||
<a-row>
|
||||
<#assign form_date = false>
|
||||
<#assign form_select = false>
|
||||
<#assign form_select_multi = false>
|
||||
<#assign form_select_search = false>
|
||||
<#assign form_popup = false>
|
||||
<#assign form_sel_depart = false>
|
||||
<#assign form_sel_user = false>
|
||||
<#assign form_file = false>
|
||||
<#assign form_image = false>
|
||||
<#assign form_editor = false>
|
||||
<#assign form_cat_tree = false>
|
||||
<#assign form_cat_back = "">
|
||||
<#assign form_pca = false>
|
||||
<#assign form_md = false>
|
||||
<#assign form_switch=false>
|
||||
<#assign form_span = 24>
|
||||
<#if tableVo.fieldRowNum==2>
|
||||
<#assign form_span = 12>
|
||||
@@ -39,13 +26,12 @@
|
||||
<a-col :span="${form_span}">
|
||||
<a-form-item label="${po.filedComment}" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
||||
<#if po.classType =='date'>
|
||||
<#assign form_date=true>
|
||||
<j-date placeholder="请选择${po.filedComment}" v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true" style="width: 100%" <#if po.readonly=='Y'>disabled</#if>/>
|
||||
<#elseif po.classType =='datetime'>
|
||||
<#assign form_date=true>
|
||||
<j-date placeholder="请选择${po.filedComment}" v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true" :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" style="width: 100%" <#if po.readonly=='Y'>disabled</#if>/>
|
||||
<#elseif po.classType =='time'>
|
||||
<j-time placeholder="请选择${po.filedComment}" v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true" style="width: 100%" <#if po.readonly=='Y'>disabled</#if>/>
|
||||
<#elseif po.classType =='popup'>
|
||||
<#assign form_popup=true>
|
||||
<j-popup
|
||||
v-decorator="['${po.fieldName}'${autoWriteRules(po)}]"
|
||||
:trigger-change="true"
|
||||
@@ -55,32 +41,24 @@
|
||||
@callback="popupCallback"
|
||||
<#if po.readonly=='Y'>disabled</#if>/>
|
||||
<#elseif po.classType =='sel_depart'>
|
||||
<#assign form_sel_depart=true>
|
||||
<j-select-depart v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" multi <#if po.readonly=='Y'>disabled</#if> />
|
||||
<#elseif po.classType =='switch'>
|
||||
<#assign form_switch=true>
|
||||
<j-switch v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" <#if po.dictField?default("")?trim?length gt 1>:options="${po.dictField}"</#if> <#if po.readonly=='Y'>disabled</#if>></j-switch>
|
||||
<#elseif po.classType =='pca'>
|
||||
<#assign form_pca=true>
|
||||
<j-area-linkage type="cascader" v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" placeholder="请输入省市区" <#if po.readonly=='Y'>disabled</#if> />
|
||||
<#elseif po.classType =='markdown'>
|
||||
<#assign form_md=true>
|
||||
<j-markdown-editor v-decorator="['${po.fieldName}']" id="${po.fieldName}"></j-markdown-editor>
|
||||
<j-markdown-editor v-decorator="[${autoStringSuffix(po)},{initialValue:''}]" id="${po.fieldName}"></j-markdown-editor>
|
||||
<#elseif po.classType =='password'>
|
||||
<a-input-password v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" placeholder="请输入${po.filedComment}" <#if po.readonly=='Y'>disabled</#if>/>
|
||||
<#elseif po.classType =='sel_user'>
|
||||
<#assign form_sel_user = true>
|
||||
<j-select-user-by-dep v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" <#if po.readonly=='Y'>disabled</#if>/>
|
||||
<#elseif po.classType =='textarea'>
|
||||
<a-textarea v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" rows="4" placeholder="请输入${po.filedComment}" <#if po.readonly=='Y'>disabled</#if>/>
|
||||
<a-textarea v-decorator="[${autoStringSuffix(po)}${autoWriteRules(po)}]" rows="4" placeholder="请输入${po.filedComment}" <#if po.readonly=='Y'>disabled</#if>/>
|
||||
<#elseif po.classType=='list' || po.classType=='radio'>
|
||||
<#assign form_select = true>
|
||||
<j-dict-select-tag type="${po.classType}" v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true" dictCode="${form_field_dictCode}" placeholder="请选择${po.filedComment}" <#if po.readonly=='Y'>disabled</#if>/>
|
||||
<#elseif po.classType=='list_multi' || po.classType=='checkbox'>
|
||||
<#assign form_select_multi = true>
|
||||
<j-multi-select-tag type="${po.classType}" v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true" dictCode="${form_field_dictCode}" placeholder="请选择${po.filedComment}" <#if po.readonly=='Y'>disabled</#if>/>
|
||||
<#elseif po.classType=='sel_search'>
|
||||
<#assign form_select_search = true>
|
||||
<j-search-select-tag v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" dict="${form_field_dictCode}" <#if po.readonly=='Y'>disabled</#if> />
|
||||
<#elseif po.classType=='cat_tree'>
|
||||
<#assign form_cat_tree = true>
|
||||
@@ -91,18 +69,14 @@
|
||||
<#elseif po.fieldDbType=='int' || po.fieldDbType=='double' || po.fieldDbType=='BigDecimal'>
|
||||
<a-input-number v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" placeholder="请输入${po.filedComment}" style="width: 100%" <#if po.readonly=='Y'>disabled</#if>/>
|
||||
<#elseif po.classType=='file'>
|
||||
<#assign form_file = true>
|
||||
<j-upload v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true" <#if po.readonly=='Y'>disabled</#if> <#if po.uploadnum??>:number=${po.uploadnum}</#if>></j-upload>
|
||||
<#elseif po.classType=='image'>
|
||||
<#assign form_image = true>
|
||||
<j-image-upload isMultiple <#if po.uploadnum??>:number=${po.uploadnum}</#if> v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" <#if po.readonly=='Y'>disabled</#if>></j-image-upload>
|
||||
<#elseif po.classType=='umeditor'>
|
||||
<#assign form_editor = true>
|
||||
<j-editor v-decorator="['${po.fieldName}',{trigger:'input'}]" <#if po.readonly=='Y'>disabled</#if>/>
|
||||
<j-editor v-decorator="[${autoStringSuffix(po)},{trigger:'input'}]" <#if po.readonly=='Y'>disabled</#if>/>
|
||||
<#elseif po.fieldDbType=='Blob'>
|
||||
<a-input v-decorator="['${po.fieldName}String'${autoWriteRules(po)}]" placeholder="请输入${po.filedComment}" <#if po.readonly=='Y'>disabled</#if>></a-input>
|
||||
<a-input v-decorator="[${autoStringSuffix(po)}]" placeholder="请输入${po.filedComment}" <#if po.readonly=='Y'>disabled</#if>></a-input>
|
||||
<#elseif po.classType == 'sel_tree'>
|
||||
<#assign form_tree_select = true>
|
||||
<j-tree-select
|
||||
ref="treeSelect"
|
||||
placeholder="请选择${po.filedComment}"
|
||||
@@ -145,90 +119,10 @@
|
||||
import { httpAction, getAction } from '@/api/manage'
|
||||
import pick from 'lodash.pick'
|
||||
import { validateDuplicateValue } from '@/utils/util'
|
||||
import JFormContainer from '@/components/jeecg/JFormContainer'
|
||||
<#if form_date>
|
||||
import JDate from '@/components/jeecg/JDate'
|
||||
</#if>
|
||||
<#if form_file>
|
||||
import JUpload from '@/components/jeecg/JUpload'
|
||||
</#if>
|
||||
<#if form_image>
|
||||
import JImageUpload from '@/components/jeecg/JImageUpload'
|
||||
</#if>
|
||||
<#if form_sel_depart>
|
||||
import JSelectDepart from '@/components/jeecgbiz/JSelectDepart'
|
||||
</#if>
|
||||
<#if form_sel_user>
|
||||
import JSelectUserByDep from '@/components/jeecgbiz/JSelectUserByDep'
|
||||
</#if>
|
||||
<#if form_select>
|
||||
import JDictSelectTag from "@/components/dict/JDictSelectTag"
|
||||
</#if>
|
||||
<#if form_select_multi>
|
||||
import JMultiSelectTag from "@/components/dict/JMultiSelectTag"
|
||||
</#if>
|
||||
<#if form_select_search>
|
||||
import JSearchSelectTag from '@/components/dict/JSearchSelectTag'
|
||||
</#if>
|
||||
<#if form_editor>
|
||||
import JEditor from '@/components/jeecg/JEditor'
|
||||
</#if>
|
||||
<#if form_cat_tree>
|
||||
import JCategorySelect from '@/components/jeecg/JCategorySelect'
|
||||
</#if>
|
||||
<#if form_pca>
|
||||
import JAreaLinkage from '@comp/jeecg/JAreaLinkage'
|
||||
</#if>
|
||||
<#if form_md>
|
||||
import JMarkdownEditor from '@/components/jeecg/JMarkdownEditor/index'
|
||||
</#if>
|
||||
<#if form_switch==true >
|
||||
import JSwitch from '@/components/jeecg/JSwitch'
|
||||
</#if>
|
||||
|
||||
export default {
|
||||
name: '${entityName}Form',
|
||||
components: {
|
||||
JFormContainer,
|
||||
<#if form_date>
|
||||
JDate,
|
||||
</#if>
|
||||
<#if form_file>
|
||||
JUpload,
|
||||
</#if>
|
||||
<#if form_image>
|
||||
JImageUpload,
|
||||
</#if>
|
||||
<#if form_sel_depart>
|
||||
JSelectDepart,
|
||||
</#if>
|
||||
<#if form_sel_user>
|
||||
JSelectUserByDep,
|
||||
</#if>
|
||||
<#if form_select>
|
||||
JDictSelectTag,
|
||||
</#if>
|
||||
<#if form_select_multi>
|
||||
JMultiSelectTag,
|
||||
</#if>
|
||||
<#if form_select_search>
|
||||
JSearchSelectTag,
|
||||
</#if>
|
||||
<#if form_editor>
|
||||
JEditor,
|
||||
</#if>
|
||||
<#if form_pca>
|
||||
JAreaLinkage,
|
||||
</#if>
|
||||
<#if form_cat_tree>
|
||||
JCategorySelect,
|
||||
</#if>
|
||||
<#if form_md>
|
||||
JMarkdownEditor,
|
||||
</#if>
|
||||
<#if form_switch==true >
|
||||
JSwitch,
|
||||
</#if>
|
||||
},
|
||||
props: {
|
||||
//流程表单data
|
||||
|
||||
+3
-32
@@ -1,6 +1,7 @@
|
||||
package ${bussiPackage}.${entityPackage}.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.Date;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
@@ -67,37 +68,7 @@ public class ${entityName} implements Serializable {
|
||||
@Dict(${list_field_dictCode?substring(2)})
|
||||
</#if>
|
||||
</#if>
|
||||
<#if po.fieldDbType=='Blob'>
|
||||
private transient java.lang.String ${po.fieldName}String;
|
||||
|
||||
private byte[] ${po.fieldName};
|
||||
|
||||
public byte[] get${po.fieldName?cap_first}(){
|
||||
if(${po.fieldName}String==null){
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return ${po.fieldName}String.getBytes("UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String get${po.fieldName?cap_first}String(){
|
||||
if(${po.fieldName}==null || ${po.fieldName}.length==0){
|
||||
return "";
|
||||
}
|
||||
try {
|
||||
return new String(${po.fieldName},"UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
<#else>
|
||||
@ApiModelProperty(value = "${po.filedComment}")
|
||||
private ${po.fieldType} ${po.fieldName};
|
||||
</#if>
|
||||
<#-- 大字段转换 -->
|
||||
<#include "/common/blob.ftl">
|
||||
</#list>
|
||||
}
|
||||
|
||||
+3
-2
@@ -13,6 +13,7 @@ import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import java.util.Date;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
|
||||
/**
|
||||
* @Description: ${subTab.ftlDescription}
|
||||
@@ -65,8 +66,8 @@ public class ${subTab.entityName} implements Serializable {
|
||||
</#if>
|
||||
</#if>
|
||||
</#if>
|
||||
@ApiModelProperty(value = "${po.filedComment}")
|
||||
private <#if po.fieldType=='java.sql.Blob'>byte[]<#else>${po.fieldType}</#if> ${po.fieldName};
|
||||
<#-- 大字段转换 -->
|
||||
<#include "/common/blob.ftl">
|
||||
</#list>
|
||||
}
|
||||
</#list>
|
||||
+5
-1
@@ -68,7 +68,11 @@ public class ${entityName}Page {
|
||||
</#if>
|
||||
</#if>
|
||||
@ApiModelProperty(value = "${po.filedComment}")
|
||||
private <#if po.fieldType=='java.sql.Blob'>byte[]<#else>${po.fieldType}</#if> ${po.fieldName};
|
||||
<#if po.fieldDbType=='Blob'>
|
||||
private java.lang.String ${po.fieldName}String;
|
||||
<#else>
|
||||
private ${po.fieldType} ${po.fieldName};
|
||||
</#if>
|
||||
</#list>
|
||||
|
||||
<#list subTables as sub>
|
||||
|
||||
+2
-79
@@ -5,20 +5,10 @@
|
||||
<a-form layout="inline" @keyup.enter.native="searchQuery">
|
||||
<a-row :gutter="24">
|
||||
<#assign query_field_no=0>
|
||||
<#assign query_field_select=false>
|
||||
<#assign query_field_date=false>
|
||||
<#assign query_flag=false>
|
||||
<#assign list_need_dict=false>
|
||||
<#assign list_need_category=false>
|
||||
<#assign query_field_pca=false>
|
||||
<#assign list_need_pca=false>
|
||||
<#assign query_flag=false>
|
||||
<#assign query_inp=false>
|
||||
<#assign query_popup=false>
|
||||
<#assign query_sel_user=false>
|
||||
<#assign query_sel_dep=false>
|
||||
<#assign query_sel_multi=false>
|
||||
<#assign query_sel_cat=false>
|
||||
<#assign query_sel_search=false>
|
||||
<#assign bpm_flag=false>
|
||||
|
||||
<#-- 开始循环 -->
|
||||
@@ -41,33 +31,24 @@
|
||||
<#if query_field_no gt 1> </#if><a-col :xl="6" :lg="7" :md="8" :sm="24">
|
||||
<#if query_field_no gt 1> </#if><a-form-item label="${po.filedComment}">
|
||||
<#if po.classType=='sel_search'>
|
||||
<#assign query_sel_search=true>
|
||||
<#if query_field_no gt 1> </#if><j-search-select-tag placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" dict="${po.dictTable},${po.dictText},${po.dictField}"/>
|
||||
<#elseif po.classType=='sel_user'>
|
||||
<#assign query_sel_user=true>
|
||||
<#if query_field_no gt 1> </#if><j-select-user-by-dep placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}"/>
|
||||
<#elseif po.classType=='sel_depart'>
|
||||
<#assign query_sel_dep=true>
|
||||
<#if query_field_no gt 1> </#if><j-select-depart placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}"/>
|
||||
<#elseif po.classType=='list_multi'>
|
||||
<#assign query_sel_multi=true>
|
||||
<#if query_field_no gt 1> </#if><j-multi-select-tag placeholder="请选择${po.filedComment}" dictCode="${query_field_dictCode?default("")}" v-model="queryParam.${po.fieldName}"/>
|
||||
<#elseif po.classType=='cat_tree'>
|
||||
<#assign query_sel_cat=true>
|
||||
<#if query_field_no gt 1> </#if><j-category-select placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" pcode="${po.dictField?default("")}"/>
|
||||
<#elseif po.classType=='date'>
|
||||
<#assign query_field_date=true>
|
||||
<#if query_field_no gt 1> </#if><j-date placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}"></j-date>
|
||||
<#elseif po.classType=='datetime'>
|
||||
<#assign query_field_date=true>
|
||||
<#if query_field_no gt 1> </#if><j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}"></j-date>
|
||||
<#elseif po.classType=='pca'>
|
||||
<#assign query_field_pca=true>
|
||||
<#if query_field_no gt 1> </#if><j-area-linkage type="cascader" v-model="queryParam.${po.fieldName}" placeholder="请选择省市区"/>
|
||||
<#elseif po.classType=='popup'>
|
||||
<#if query_field_no gt 1> </#if><j-popup placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" code="${po.dictTable}" org-fields="${po.dictField}" dest-fields="${po.dictText}" :field="getPopupField('${po.dictText}')"/>
|
||||
<#elseif po.classType=='list' || po.classType=='radio' || po.classType=='checkbox'>
|
||||
<#assign query_field_select=true>
|
||||
<#-- ---------------------------下拉或是单选 判断数据字典是表字典还是普通字典------------------------------- -->
|
||||
<#if po.dictTable?default("")?trim?length gt 1>
|
||||
<#if query_field_no gt 1> </#if><j-dict-select-tag placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" dictCode="${po.dictTable},${po.dictText},${po.dictField}"/>
|
||||
@@ -85,12 +66,10 @@
|
||||
<#if query_field_no gt 1> </#if><a-col :xl="10" :lg="11" :md="12" :sm="24">
|
||||
<#if query_field_no gt 1> </#if><a-form-item label="${po.filedComment}">
|
||||
<#if po.classType=='date'>
|
||||
<#assign query_field_date=true>
|
||||
<#if query_field_no gt 1> </#if><j-date placeholder="请选择开始日期" class="query-group-cust" v-model="queryParam.${po.fieldName}_begin"></j-date>
|
||||
<#if query_field_no gt 1> </#if><span class="query-group-split-cust"></span>
|
||||
<#if query_field_no gt 1> </#if><j-date placeholder="请选择结束日期" class="query-group-cust" v-model="queryParam.${po.fieldName}_end"></j-date>
|
||||
<#elseif po.classType=='datetime'>
|
||||
<#assign query_field_date=true>
|
||||
<#if query_field_no gt 1> </#if><j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择开始时间" class="query-group-cust" v-model="queryParam.${po.fieldName}_begin"></j-date>
|
||||
<#if query_field_no gt 1> </#if><span class="query-group-split-cust"></span>
|
||||
<#if query_field_no gt 1> </#if><j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择结束时间" class="query-group-cust" v-model="queryParam.${po.fieldName}_end"></j-date>
|
||||
@@ -234,81 +213,25 @@
|
||||
|
||||
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
|
||||
import ${entityName}Modal from './modules/${entityName}Modal'
|
||||
<#if query_field_select>
|
||||
import JDictSelectTag from '@/components/dict/JDictSelectTag.vue'
|
||||
</#if>
|
||||
<#if query_field_date>
|
||||
import JDate from '@/components/jeecg/JDate.vue'
|
||||
</#if>
|
||||
<#if list_need_category>
|
||||
import { loadCategoryData } from '@/api/api'
|
||||
</#if>
|
||||
<#if list_need_dict>
|
||||
import {filterMultiDictText} from '@/components/dict/JDictSelectUtil'
|
||||
</#if>
|
||||
<#if query_field_pca>
|
||||
import JAreaLinkage from '@comp/jeecg/JAreaLinkage'
|
||||
</#if>
|
||||
<#if list_need_pca>
|
||||
import Area from '@/components/_util/Area'
|
||||
</#if>
|
||||
<#if query_inp>
|
||||
import JInput from '@comp/jeecg/JInput'
|
||||
</#if>
|
||||
<#if query_sel_user>
|
||||
import JSelectUserByDep from '@/components/jeecgbiz/JSelectUserByDep'
|
||||
</#if>
|
||||
<#if query_sel_dep>
|
||||
import JSelectDepart from '@/components/jeecgbiz/JSelectDepart'
|
||||
</#if>
|
||||
<#if query_sel_multi>
|
||||
import JMultiSelectTag from '@/components/dict/JMultiSelectTag'
|
||||
</#if>
|
||||
<#if query_sel_cat>
|
||||
import JCategorySelect from '@comp/jeecg/JCategorySelect'
|
||||
</#if>
|
||||
<#if query_sel_search>
|
||||
import JSearchSelectTag from '@/components/dict/JSearchSelectTag'
|
||||
</#if>
|
||||
import '@/assets/less/TableExpand.less'
|
||||
<#if bpm_flag>
|
||||
import { postAction } from '@/api/manage'
|
||||
</#if>
|
||||
import JSuperQuery from '@/components/jeecg/JSuperQuery.vue'
|
||||
|
||||
export default {
|
||||
name: "${entityName}List",
|
||||
mixins:[JeecgListMixin],
|
||||
components: {
|
||||
<#if query_field_select>
|
||||
JDictSelectTag,
|
||||
</#if>
|
||||
<#if query_field_date>
|
||||
JDate,
|
||||
</#if>
|
||||
<#if query_field_pca>
|
||||
JAreaLinkage,
|
||||
</#if>
|
||||
<#if query_inp>
|
||||
JInput,
|
||||
</#if>
|
||||
<#if query_sel_user>
|
||||
JSelectUserByDep,
|
||||
</#if>
|
||||
<#if query_sel_dep>
|
||||
JSelectDepart,
|
||||
</#if>
|
||||
<#if query_sel_multi>
|
||||
JMultiSelectTag,
|
||||
</#if>
|
||||
<#if query_sel_cat>
|
||||
JCategorySelect,
|
||||
</#if>
|
||||
<#if query_sel_search>
|
||||
JSearchSelectTag,
|
||||
</#if>
|
||||
${entityName}Modal,
|
||||
JSuperQuery
|
||||
${entityName}Modal
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user