diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ShiroConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ShiroConfig.java index f307fc563e4575bea7dd2c97881898492dc1feb0..d3292f415df866b13426b90ef32f09f1d4399cd6 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ShiroConfig.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ShiroConfig.java @@ -297,6 +297,13 @@ public class ShiroConfig // 系统权限列表 // filterChainDefinitionMap.putAll(SpringUtils.getBean(IMenuService.class).selectPermsAll()); + + + filterChainDefinitionMap.put("/v3/api-docs**", "anon"); + filterChainDefinitionMap.put("/swagger**", "anon"); + + + Map filters = new LinkedHashMap(); filters.put("onlineSession", onlineSessionFilter()); filters.put("syncOnlineSession", syncOnlineSessionFilter()); diff --git a/sql/xzf.sql b/sql/xzf.sql index 61923ff29579dd3307f6a026f8f854d32b037983..2cc62c22e2034d2eec22def99352636296743d9a 100644 --- a/sql/xzf.sql +++ b/sql/xzf.sql @@ -22,39 +22,38 @@ CREATE TABLE `tester_interface` ( `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '更新者', `update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间', PRIMARY KEY (`interface_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 10 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '接口表' ROW_FORMAT = Dynamic; -INSERT INTO `tester_interface`(`interface_id`, `desc`, `mapping`, `http_method`, `content_type`, `query_param`, `body_param`, `path_param`, `judge_expression`, `status`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (1, 'XZF/在线用户/查询', '/monitor/online/list', 'POST', 'application/x-www-form-urlencoded', NULL, NULL, NULL, 'check=innate().at(0).map(\"code\").eq(0);return check;', '0', '', now(), '', NULL); -INSERT INTO `tester_interface`(`interface_id`, `desc`, `mapping`, `http_method`, `content_type`, `query_param`, `body_param`, `path_param`, `judge_expression`, `status`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (2, 'XZF/用户管理/查询', '/system/user/list', 'POST', 'application/x-www-form-urlencoded', NULL, NULL, NULL, 'return innate().at(0).map(\"code\").eq(0)', '0', '', now(), '', NULL); -INSERT INTO `tester_interface`(`interface_id`, `desc`, `mapping`, `http_method`, `content_type`, `query_param`, `body_param`, `path_param`, `judge_expression`, `status`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (3, 'XZF/部门管理/查询', '/system/dept/list', 'POST', 'application/x-www-form-urlencoded', NULL, '{\"deptName\":\"研发部门\"}', NULL, 'resp=innate().at(0);return resp.size().gt(0);', '0', '', now(), '', NULL); -INSERT INTO `tester_interface`(`interface_id`, `desc`, `mapping`, `http_method`, `content_type`, `query_param`, `body_param`, `path_param`, `judge_expression`, `status`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (4, 'XZF/自动化测试/新增登录配置', '/tester/login_config/add', 'POST', 'application/x-www-form-urlencoded', '', '{\"desc\":\"测试新增登录配置\",\"loginType\":\"XZF\",\"loginUrl\":\"http://127.0.0.1/login\",\"term\":1500,\"status\":0}', '', 'return innate().at(0).map(\"code\").eq(0);', '0', '', now(), '', NULL); -INSERT INTO `tester_interface`(`interface_id`, `desc`, `mapping`, `http_method`, `content_type`, `query_param`, `body_param`, `path_param`, `judge_expression`, `status`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (5, 'XZF/自动化测试/修改登录配置', '/tester/login_config/edit', 'POST', 'application/x-www-form-urlencoded', '', '{\"loginConfigId\":${loginConfigId}, \"desc\":\"测试新增登录配置\",\"loginType\":\"XZF\",\"loginUrl\":\"http://127.0.0.1/login\",\"term\":1800,\"status\":0}', '', 'return innate().at(0).map(\"code\").eq(0);', '0', '', now(), '', NULL); -INSERT INTO `tester_interface`(`interface_id`, `desc`, `mapping`, `http_method`, `content_type`, `query_param`, `body_param`, `path_param`, `judge_expression`, `status`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (6, 'XZF/自动化测试/删除登录配置', '/tester/login_config/remove', 'POST', 'application/x-www-form-urlencoded', NULL, '{\"ids\":${loginConfigId}}', NULL, 'return innate().at(0).map(\"code\").eq(0);', '0', '', now(), '', NULL); -INSERT INTO `tester_interface`(`interface_id`, `desc`, `mapping`, `http_method`, `content_type`, `query_param`, `body_param`, `path_param`, `judge_expression`, `status`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (7, 'XZF/自动化测试/新增接口信息', '/tester/task_interface/add', 'POST', 'application/x-www-form-urlencoded', NULL, '{\"desc\":\"测试新增接口信息\",\"mapping\":\"/tester/task_interface/add\",\"httpMethod\":\"POST\",\"contentType\":\"application/x-www-form-urlencoded; charset=UTF-8\",\"queryParam\":\"{}\",\"bodyParam\":\"{}\",\"status\":0}', NULL, 'return innate().at(0).map(\"code\").eq(0);', '0', '', now(), '', NULL); -INSERT INTO `tester_interface`(`interface_id`, `desc`, `mapping`, `http_method`, `content_type`, `query_param`, `body_param`, `path_param`, `judge_expression`, `status`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (8, 'XZF/自动化测试/修改接口信息', '/tester/task_interface/edit', 'POST', 'application/x-www-form-urlencoded', NULL, '{\"interfaceId\":\"${interfaceId}\",\"desc\":\"测试新增接口信息\",\"mapping\":\"/tester/task_interface/add\",\"httpMethod\":\"POST\",\"contentType\":\"application/x-www-form-urlencoded; charset=UTF-8\",\"queryParam\":\"{}\",\"bodyParam\":\"{}\",\"status\":0}', NULL, 'return innate().at(0).map(\"code\").eq(0);', '0', '', now(), '', NULL); -INSERT INTO `tester_interface`(`interface_id`, `desc`, `mapping`, `http_method`, `content_type`, `query_param`, `body_param`, `path_param`, `judge_expression`, `status`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (9, 'XZF/自动化测试/删除接口信息', '/tester/task_interface/remove', 'POST', 'application/x-www-form-urlencoded', NULL, '{\"ids\":${interfaceId}}', NULL, 'return innate().at(0).map(\"code\").eq(0);', '0', '', now(), '', NULL); -INSERT INTO `tester_interface`(`interface_id`, `desc`, `mapping`, `http_method`, `content_type`, `query_param`, `body_param`, `path_param`, `judge_expression`, `status`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (10, 'XZF/自动化测试/新增任务信息', '/tester/task/add', 'POST', 'application/x-www-form-urlencoded', NULL, '{\"desc\":\"测试新增任务接口\",\"host\":\"127.0.0.1\",\"status\":0}', NULL, 'return innate().at(0).map(\"code\").eq(0);', '0', '', now(), '', NULL); -INSERT INTO `tester_interface`(`interface_id`, `desc`, `mapping`, `http_method`, `content_type`, `query_param`, `body_param`, `path_param`, `judge_expression`, `status`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (11, 'XZF/自动化测试/修改任务信息', '/tester/task/edit', 'POST', 'application/x-www-form-urlencoded', NULL, '{\"taskId\":${taskId},\"desc\":\"测试修改任务接口\",\"host\":\"127.0.0.1\",\"status\":0}', NULL, 'return innate().at(0).map(\"code\").eq(0);', '0', '', now(), '', NULL); -INSERT INTO `tester_interface`(`interface_id`, `desc`, `mapping`, `http_method`, `content_type`, `query_param`, `body_param`, `path_param`, `judge_expression`, `status`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (12, 'XZF/自动化测试/删除任务信息', '/tester/task/remove', 'POST', 'application/x-www-form-urlencoded', NULL, '{\"ids\":${taskId}}', NULL, 'return innate().at(0).map(\"code\").eq(0);', '0', '', now(), '', NULL); +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '接口表' ROW_FORMAT = Dynamic; +INSERT INTO `tester_interface`(`interface_id`, `desc`, `mapping`, `http_method`, `content_type`, `query_param`, `body_param`, `path_param`, `judge_expression`, `status`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (1, 'XZF/用户管理/查询', '/system/user/list', 'POST', 'application/x-www-form-urlencoded', NULL, NULL, NULL, 'return innate().at(0).map(\"code\").eq(0)', '0', '', now(), '', NULL); +INSERT INTO `tester_interface`(`interface_id`, `desc`, `mapping`, `http_method`, `content_type`, `query_param`, `body_param`, `path_param`, `judge_expression`, `status`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (2, 'XZF/自动化测试/新增登录配置', '/tester/login_config/add', 'POST', 'application/x-www-form-urlencoded', '', '{\"desc\":\"测试新增登录配置\",\"loginType\":\"XZF\",\"loginUrl\":\"http://127.0.0.1/login\",\"term\":1500,\"status\":0}', '', 'return innate().at(0).map(\"code\").eq(0);', '0', '', now(), '', NULL); +INSERT INTO `tester_interface`(`interface_id`, `desc`, `mapping`, `http_method`, `content_type`, `query_param`, `body_param`, `path_param`, `judge_expression`, `status`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (3, 'XZF/自动化测试/修改登录配置', '/tester/login_config/edit', 'POST', 'application/x-www-form-urlencoded', '', '{\"loginConfigId\":${loginConfigId}, \"desc\":\"测试新增登录配置\",\"loginType\":\"XZF\",\"loginUrl\":\"http://127.0.0.1/login\",\"term\":1800,\"status\":0}', '', 'return innate().at(0).map(\"code\").eq(0);', '0', '', now(), '', NULL); +INSERT INTO `tester_interface`(`interface_id`, `desc`, `mapping`, `http_method`, `content_type`, `query_param`, `body_param`, `path_param`, `judge_expression`, `status`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (4, 'XZF/自动化测试/删除登录配置', '/tester/login_config/remove', 'POST', 'application/x-www-form-urlencoded', NULL, '{\"ids\":${loginConfigId}}', NULL, 'return innate().at(0).map(\"code\").eq(0);', '0', '', now(), '', NULL); +INSERT INTO `tester_interface`(`interface_id`, `desc`, `mapping`, `http_method`, `content_type`, `query_param`, `body_param`, `path_param`, `judge_expression`, `status`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (5, 'XZF/自动化测试/新增接口信息', '/tester/task_interface/add', 'POST', 'application/x-www-form-urlencoded', NULL, '{\"desc\":\"测试新增接口信息\",\"mapping\":\"/tester/task_interface/add\",\"httpMethod\":\"POST\",\"contentType\":\"application/x-www-form-urlencoded; charset=UTF-8\",\"queryParam\":\"{}\",\"bodyParam\":\"{}\",\"status\":0}', NULL, 'return innate().at(0).map(\"code\").eq(0);', '0', '', now(), '', NULL); +INSERT INTO `tester_interface`(`interface_id`, `desc`, `mapping`, `http_method`, `content_type`, `query_param`, `body_param`, `path_param`, `judge_expression`, `status`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (6, 'XZF/自动化测试/修改接口信息', '/tester/task_interface/edit', 'POST', 'application/x-www-form-urlencoded', NULL, '{\"interfaceId\":\"${interfaceId}\",\"desc\":\"测试新增接口信息\",\"mapping\":\"/tester/task_interface/add\",\"httpMethod\":\"POST\",\"contentType\":\"application/x-www-form-urlencoded; charset=UTF-8\",\"queryParam\":\"{}\",\"bodyParam\":\"{}\",\"status\":0}', NULL, 'return innate().at(0).map(\"code\").eq(0);', '0', '', now(), '', NULL); +INSERT INTO `tester_interface`(`interface_id`, `desc`, `mapping`, `http_method`, `content_type`, `query_param`, `body_param`, `path_param`, `judge_expression`, `status`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (7, 'XZF/自动化测试/删除接口信息', '/tester/task_interface/remove', 'POST', 'application/x-www-form-urlencoded', NULL, '{\"ids\":${interfaceId}}', NULL, 'return innate().at(0).map(\"code\").eq(0);', '0', '', now(), '', NULL); +INSERT INTO `tester_interface`(`interface_id`, `desc`, `mapping`, `http_method`, `content_type`, `query_param`, `body_param`, `path_param`, `judge_expression`, `status`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (8, 'XZF/自动化测试/新增任务信息', '/tester/task/add', 'POST', 'application/x-www-form-urlencoded', NULL, '{\"desc\":\"测试新增任务接口\",\"host\":\"127.0.0.1\",\"status\":0}', NULL, 'return innate().at(0).map(\"code\").eq(0);', '0', '', now(), '', NULL); +INSERT INTO `tester_interface`(`interface_id`, `desc`, `mapping`, `http_method`, `content_type`, `query_param`, `body_param`, `path_param`, `judge_expression`, `status`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (9, 'XZF/自动化测试/修改任务信息', '/tester/task/edit', 'POST', 'application/x-www-form-urlencoded', NULL, '{\"taskId\":${taskId},\"desc\":\"测试修改任务接口\",\"host\":\"127.0.0.1\",\"status\":0}', NULL, 'return innate().at(0).map(\"code\").eq(0);', '0', '', now(), '', NULL); +INSERT INTO `tester_interface`(`interface_id`, `desc`, `mapping`, `http_method`, `content_type`, `query_param`, `body_param`, `path_param`, `judge_expression`, `status`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (10, 'XZF/自动化测试/删除任务信息', '/tester/task/remove', 'POST', 'application/x-www-form-urlencoded', NULL, '{\"ids\":${taskId}}', NULL, 'return innate().at(0).map(\"code\").eq(0);', '0', '', now(), '', NULL); -- ---------------------------- -- Table structure for tester_interface_call_log -- ---------------------------- DROP TABLE IF EXISTS `tester_interface_call_log`; -CREATE TABLE `tester_interface_call_log` ( +CREATE TABLE `tester_interface_call_log` ( `interface_call_log_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '接口调用日志id', `task_call_log_id` bigint(20) NOT NULL COMMENT '任务调用日志id', - `interface_id` bigint(20) NULL DEFAULT 0 COMMENT '接口id', - `interface_desc` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '接口描述', - `http_method` varchar(8) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'http方式', - `final_url` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '实际url', - `body_param` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '实际body参数', - `headers` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'headers', - `content_type` varchar(32) DEFAULT NULL COMMENT 'content_type', - `status` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '返回状态', - `judge_expression` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '判定表达式', - `response` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '返回结果', + `interface_id` bigint(20) DEFAULT '0' COMMENT '接口id', + `interface_desc` varchar(50) DEFAULT '' COMMENT '接口描述', + `http_method` varchar(8) DEFAULT NULL COMMENT 'http方式', + `final_url` varchar(512) DEFAULT '' COMMENT '实际url', + `body_param` varchar(512) DEFAULT NULL COMMENT '实际body参数', + `headers` varchar(512) DEFAULT NULL COMMENT 'request_headers', + `content_type` varchar(32) DEFAULT NULL COMMENT 'request_content_type', + `status` varchar(10) DEFAULT NULL COMMENT '返回状态', + `judge_expression` varchar(255) DEFAULT NULL COMMENT '判定表达式', + `response` varchar(512) DEFAULT NULL COMMENT '返回结果', + `response_headers` varchar(512) DEFAULT NULL COMMENT '返回headers', `exception` varchar(255) DEFAULT NULL COMMENT '异常消息', - `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `create_time` datetime DEFAULT NULL COMMENT '创建时间', PRIMARY KEY (`interface_call_log_id`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '接口调用日志表' ROW_FORMAT = Dynamic; @@ -94,7 +93,7 @@ CREATE TABLE `tester_task` ( `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '更新者', `update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间', PRIMARY KEY (`task_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 10 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '任务表' ROW_FORMAT = Dynamic; +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '任务表' ROW_FORMAT = Dynamic; INSERT INTO `tester_task`(`task_id`, `desc`, `host`, `port`, `login_config_id`, `status`, `create_time`) VALUES (1, '小钻风本地自动测试', '127.0.0.1', NULL, 1, '0', now()); -- ---------------------------- @@ -139,19 +138,17 @@ CREATE TABLE `tester_task_interface_relation` ( `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '更新者', `update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间', PRIMARY KEY (`relation_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 10 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '任务接口关系表' ROW_FORMAT = Dynamic; -INSERT INTO `tester_task_interface_relation`(`relation_id`, `task_id`, `interface_id`, `description`, `host`, `port`, `depend_relation_ids`, `depend_param`, `content_type`, `query_param`, `body_param`, `path_param`, `login_config_id`, `status`, `create_time`) VALUES (1, 1, 1, '小钻风/在线用户查询', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '0', now()); -INSERT INTO `tester_task_interface_relation`(`relation_id`, `task_id`, `interface_id`, `description`, `host`, `port`, `depend_relation_ids`, `depend_param`, `content_type`, `query_param`, `body_param`, `path_param`, `login_config_id`, `status`, `create_time`) VALUES (2, 1, 2, '小钻风/用户管理查询', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '0', now()); -INSERT INTO `tester_task_interface_relation`(`relation_id`, `task_id`, `interface_id`, `description`, `host`, `port`, `depend_relation_ids`, `depend_param`, `content_type`, `query_param`, `body_param`, `path_param`, `login_config_id`, `status`, `create_time`) VALUES (3, 1, 3, '小钻风/部门管理查询', NULL, NULL, '2', 'deptName=innate().at(0).map(\"rows\").at(0).map(\"dept\").map(\"deptName\");return deptName currentTime(\"day\",1);', NULL, NULL, '{\"deptName\":\"${deptName}\", \"time\":\"$[1]\"}', NULL, NULL, '0', now()); -INSERT INTO `tester_task_interface_relation`(`relation_id`, `task_id`, `interface_id`, `description`, `host`, `port`, `depend_relation_ids`, `depend_param`, `content_type`, `query_param`, `body_param`, `path_param`, `login_config_id`, `status`, `create_time`) VALUES (10, 1, 4, 'XZF/自动化测试/新增登录配置', '', NULL, NULL, '', '', '', '', '', NULL, '0', now()); -INSERT INTO `tester_task_interface_relation`(`relation_id`, `task_id`, `interface_id`, `description`, `host`, `port`, `depend_relation_ids`, `depend_param`, `content_type`, `query_param`, `body_param`, `path_param`, `login_config_id`, `status`, `create_time`) VALUES (11, 1, 5, 'XZF/自动化测试/修改登录配置', '', NULL, '10', 'loginConfigId=innate().at(0).map(\"data\");\r\nreturn loginConfigId;', '', '', '', '', NULL, '0', now()); -INSERT INTO `tester_task_interface_relation`(`relation_id`, `task_id`, `interface_id`, `description`, `host`, `port`, `depend_relation_ids`, `depend_param`, `content_type`, `query_param`, `body_param`, `path_param`, `login_config_id`, `status`, `create_time`) VALUES (12, 1, 6, 'XZF/自动化测试/删除登录配置', '', NULL, '10,11', 'loginConfigId=innate().at(0).map(\"data\");\r\nreturn loginConfigId;', '', '', '', '', NULL, '0', now()); -INSERT INTO `tester_task_interface_relation`(`relation_id`, `task_id`, `interface_id`, `description`, `host`, `port`, `depend_relation_ids`, `depend_param`, `content_type`, `query_param`, `body_param`, `path_param`, `login_config_id`, `status`, `create_time`) VALUES (13, 1, 7, 'XZF/自动化测试/新增接口信息', '', NULL, NULL, '', '', '', '', '', NULL, '0', now()); -INSERT INTO `tester_task_interface_relation`(`relation_id`, `task_id`, `interface_id`, `description`, `host`, `port`, `depend_relation_ids`, `depend_param`, `content_type`, `query_param`, `body_param`, `path_param`, `login_config_id`, `status`, `create_time`) VALUES (14, 1, 8, 'XZF/自动化测试/修改接口信息', '', NULL, '13', 'interfaceId=innate().at(0).map(\"data\");\r\nreturn interfaceId;', '', '', '', '', NULL, '0', now()); -INSERT INTO `tester_task_interface_relation`(`relation_id`, `task_id`, `interface_id`, `description`, `host`, `port`, `depend_relation_ids`, `depend_param`, `content_type`, `query_param`, `body_param`, `path_param`, `login_config_id`, `status`, `create_time`) VALUES (15, 1, 9, 'XZF/自动化测试/删除接口信息', '', NULL, '13,14', 'interfaceId=innate().at(0).map(\"data\");\r\nreturn interfaceId;', '', '', '', '', NULL, '0', now()); -INSERT INTO `tester_task_interface_relation`(`relation_id`, `task_id`, `interface_id`, `description`, `host`, `port`, `depend_relation_ids`, `depend_param`, `content_type`, `query_param`, `body_param`, `path_param`, `login_config_id`, `status`, `create_time`) VALUES (16, 1, 10, 'XZF/自动化测试/新增任务信息', '', NULL, NULL, '', '', '', '', '', NULL, '0', now()); -INSERT INTO `tester_task_interface_relation`(`relation_id`, `task_id`, `interface_id`, `description`, `host`, `port`, `depend_relation_ids`, `depend_param`, `content_type`, `query_param`, `body_param`, `path_param`, `login_config_id`, `status`, `create_time`) VALUES (17, 1, 11, 'XZF/自动化测试/修改任务信息', '', NULL, '16', 'taskId=innate().at(0).map(\"data\");\r\nreturn taskId;', '', '', '', '', NULL, '0', now()); -INSERT INTO `tester_task_interface_relation`(`relation_id`, `task_id`, `interface_id`, `description`, `host`, `port`, `depend_relation_ids`, `depend_param`, `content_type`, `query_param`, `body_param`, `path_param`, `login_config_id`, `status`, `create_time`) VALUES (18, 1, 12, 'XZF/自动化测试/删除任务信息', '', NULL, '16,17', 'taskId=innate().at(0).map(\"data\");\r\nreturn taskId;', '', '', '', '', NULL, '0', now()); +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '任务接口关系表' ROW_FORMAT = Dynamic; +INSERT INTO `tester_task_interface_relation`(`relation_id`, `task_id`, `interface_id`, `description`, `host`, `port`, `depend_relation_ids`, `depend_param`, `content_type`, `query_param`, `body_param`, `path_param`, `login_config_id`, `status`, `create_time`) VALUES (1, 1, 1, '小钻风/用户管理查询', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '0', now()); +INSERT INTO `tester_task_interface_relation`(`relation_id`, `task_id`, `interface_id`, `description`, `host`, `port`, `depend_relation_ids`, `depend_param`, `content_type`, `query_param`, `body_param`, `path_param`, `login_config_id`, `status`, `create_time`) VALUES (2, 1, 2, 'XZF/自动化测试/新增登录配置', '', NULL, NULL, '', '', '', '', '', NULL, '0', now()); +INSERT INTO `tester_task_interface_relation`(`relation_id`, `task_id`, `interface_id`, `description`, `host`, `port`, `depend_relation_ids`, `depend_param`, `content_type`, `query_param`, `body_param`, `path_param`, `login_config_id`, `status`, `create_time`) VALUES (3, 1, 3, 'XZF/自动化测试/修改登录配置', '', NULL, '2', 'loginConfigId=innate().at(0).map(\"data\");\r\nreturn loginConfigId;', '', '', '', '', NULL, '0', now()); +INSERT INTO `tester_task_interface_relation`(`relation_id`, `task_id`, `interface_id`, `description`, `host`, `port`, `depend_relation_ids`, `depend_param`, `content_type`, `query_param`, `body_param`, `path_param`, `login_config_id`, `status`, `create_time`) VALUES (4, 1, 4, 'XZF/自动化测试/删除登录配置', '', NULL, '2,3', 'loginConfigId=innate().at(0).map(\"data\");\r\nreturn loginConfigId;', '', '', '', '', NULL, '0', now()); +INSERT INTO `tester_task_interface_relation`(`relation_id`, `task_id`, `interface_id`, `description`, `host`, `port`, `depend_relation_ids`, `depend_param`, `content_type`, `query_param`, `body_param`, `path_param`, `login_config_id`, `status`, `create_time`) VALUES (5, 1, 5, 'XZF/自动化测试/新增接口信息', '', NULL, NULL, '', '', '', '', '', NULL, '0', now()); +INSERT INTO `tester_task_interface_relation`(`relation_id`, `task_id`, `interface_id`, `description`, `host`, `port`, `depend_relation_ids`, `depend_param`, `content_type`, `query_param`, `body_param`, `path_param`, `login_config_id`, `status`, `create_time`) VALUES (6, 1, 6, 'XZF/自动化测试/修改接口信息', '', NULL, '5', 'interfaceId=innate().at(0).map(\"data\");\r\nreturn interfaceId;', '', '', '', '', NULL, '0', now()); +INSERT INTO `tester_task_interface_relation`(`relation_id`, `task_id`, `interface_id`, `description`, `host`, `port`, `depend_relation_ids`, `depend_param`, `content_type`, `query_param`, `body_param`, `path_param`, `login_config_id`, `status`, `create_time`) VALUES (7, 1, 7, 'XZF/自动化测试/删除接口信息', '', NULL, '5,6', 'interfaceId=innate().at(0).map(\"data\");\r\nreturn interfaceId;', '', '', '', '', NULL, '0', now()); +INSERT INTO `tester_task_interface_relation`(`relation_id`, `task_id`, `interface_id`, `description`, `host`, `port`, `depend_relation_ids`, `depend_param`, `content_type`, `query_param`, `body_param`, `path_param`, `login_config_id`, `status`, `create_time`) VALUES (8, 1, 8, 'XZF/自动化测试/新增任务信息', '', NULL, NULL, '', '', '', '', '', NULL, '0', now()); +INSERT INTO `tester_task_interface_relation`(`relation_id`, `task_id`, `interface_id`, `description`, `host`, `port`, `depend_relation_ids`, `depend_param`, `content_type`, `query_param`, `body_param`, `path_param`, `login_config_id`, `status`, `create_time`) VALUES (9, 1, 9, 'XZF/自动化测试/修改任务信息', '', NULL, '8', 'taskId=innate().at(0).map(\"data\");\r\nreturn taskId;', '', '', '', '', NULL, '0', now()); +INSERT INTO `tester_task_interface_relation`(`relation_id`, `task_id`, `interface_id`, `description`, `host`, `port`, `depend_relation_ids`, `depend_param`, `content_type`, `query_param`, `body_param`, `path_param`, `login_config_id`, `status`, `create_time`) VALUES (10, 1, 10, 'XZF/自动化测试/删除任务信息', '', NULL, '8,9', 'taskId=innate().at(0).map(\"data\");\r\nreturn taskId;', '', '', '', '', NULL, '0', now()); @@ -160,15 +157,18 @@ INSERT INTO `sys_dict_type`(`dict_id`, `dict_name`, `dict_type`, `status`, `crea INSERT INTO `sys_dict_data`(`dict_code`, `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (30, 1, 'GET', 'GET', 'http_method', '', 'primary', 'N', '0', 'admin', sysdate(), '', NULL, 'GET方式'); INSERT INTO `sys_dict_data`(`dict_code`, `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (31, 2, 'POST', 'POST', 'http_method', '', 'primary', 'N', '0', 'admin', sysdate(), '', NULL, 'POST方式'); -INSERT INTO `sys_dict_data`(`dict_code`, `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (33, 4, 'PUT', 'PUT', 'http_method', '', 'primary', 'N', '0', 'admin', sysdate(), '', NULL, 'PUT方式'); -INSERT INTO `sys_dict_data`(`dict_code`, `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (34, 5, 'DELETE', 'DELETE', 'http_method', '', 'primary', 'N', '0', 'admin', sysdate(), '', NULL, 'DELETE方式'); -INSERT INTO `sys_dict_data`(`dict_code`, `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (35, 6, 'PATCH', 'PATCH', 'http_method', '', 'primary', 'N', '0', 'admin', sysdate(), '', NULL, 'PATCH方式'); +INSERT INTO `sys_dict_data`(`dict_code`, `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (32, 3, 'PUT', 'PUT', 'http_method', '', 'primary', 'N', '0', 'admin', sysdate(), '', NULL, 'PUT方式'); +INSERT INTO `sys_dict_data`(`dict_code`, `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (33, 4, 'DELETE', 'DELETE', 'http_method', '', 'primary', 'N', '0', 'admin', sysdate(), '', NULL, 'DELETE方式'); +INSERT INTO `sys_dict_data`(`dict_code`, `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (34, 5, 'PATCH', 'PATCH', 'http_method', '', 'primary', 'N', '0', 'admin', sysdate(), '', NULL, 'PATCH方式'); +INSERT INTO `sys_dict_data`(`dict_code`, `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (35, 6, 'HEAD', 'HEAD', 'http_method', '', 'primary', 'N', '0', 'admin', sysdate(), '', NULL, 'HEAD方式'); +INSERT INTO `sys_dict_data`(`dict_code`, `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (36, 7, 'TRACE', 'TRACE', 'http_method', '', 'primary', 'N', '0', 'admin', sysdate(), '', NULL, 'TRACE方式'); +INSERT INTO `sys_dict_data`(`dict_code`, `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (37, 8, 'OPTIONS', 'OPTIONS', 'http_method', '', 'primary', 'N', '0', 'admin', sysdate(), '', NULL, 'OPTIONS方式'); -- 插入登录类型 INSERT INTO `sys_dict_type`(`dict_id`, `dict_name`, `dict_type`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (12, '登录类型', 'login_type', '0', 'admin', sysdate(), '', NULL, '登录类型列表'); -INSERT INTO `sys_dict_data`(`dict_code`, `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (36, 1, '小钻风登录', 'XZF', 'login_type', '', 'primary', 'N', '0', 'admin', sysdate(), '', NULL, '小钻风用户登录'); +INSERT INTO `sys_dict_data`(`dict_code`, `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (38, 1, '小钻风登录', 'XZF', 'login_type', '', 'primary', 'N', '0', 'admin', sysdate(), '', NULL, '小钻风用户登录'); -- 插入任务执行进度类型 diff --git a/tester/pom.xml b/tester/pom.xml index 54badaa4f04db3457ba1ec2172738578dae0a8a1..bb6c60ccfef59f75e36d8d3c630381b0be0fc53f 100644 --- a/tester/pom.xml +++ b/tester/pom.xml @@ -29,5 +29,15 @@ unirest-java 1.4.9 + + com.ejlchina + okhttps + 3.5.2 + + + io.swagger + swagger-models + 1.6.2 + \ No newline at end of file diff --git a/tester/src/main/java/com/ruoyi/tester/controller/TesterExecutorController.java b/tester/src/main/java/com/ruoyi/tester/controller/TesterExecutorController.java index 882bc6a497c11c552b3eb92caafe0bcd96275584..84c03fea219ab0f1e113dbf245f0664fb1db8575 100644 --- a/tester/src/main/java/com/ruoyi/tester/controller/TesterExecutorController.java +++ b/tester/src/main/java/com/ruoyi/tester/controller/TesterExecutorController.java @@ -6,6 +6,7 @@ import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.tester.domain.TaskCallLogOut; import com.ruoyi.tester.executor.expression.ExpressionContainer; import com.ruoyi.tester.service.ITesterExecutorService; +import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; @@ -34,6 +35,7 @@ public class TesterExecutorController extends BaseController { return toAjax(true); } + @ApiOperation("查看任务日志") @GetMapping("/task/log") @ResponseBody public TableDataInfo getTaskLog() diff --git a/tester/src/main/java/com/ruoyi/tester/controller/TesterInterfaceController.java b/tester/src/main/java/com/ruoyi/tester/controller/TesterInterfaceController.java index d67492262499c4211891d3ddf287c9d6b292e6f7..acec972e04ff0d5ca34045d78821f6080167ab1d 100644 --- a/tester/src/main/java/com/ruoyi/tester/controller/TesterInterfaceController.java +++ b/tester/src/main/java/com/ruoyi/tester/controller/TesterInterfaceController.java @@ -7,6 +7,7 @@ import java.util.stream.Collectors; import com.ruoyi.common.json.JSONObject; import com.ruoyi.tester.executor.expression.ExpressionContainer; import com.ruoyi.tester.service.ITesterExecutorService; +import io.swagger.annotations.ApiOperation; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @@ -49,6 +50,7 @@ public class TesterInterfaceController extends BaseController /** * 查询接口信息列表 */ + @ApiOperation("查询接口信息列表") @RequiresPermissions("tester:task_interface:list") @PostMapping("/list") @ResponseBody @@ -88,6 +90,7 @@ public class TesterInterfaceController extends BaseController /** * 新增保存接口信息 */ + @ApiOperation("新增保存接口信息") @RequiresPermissions("tester:task_interface:add") @Log(title = "接口信息", businessType = BusinessType.INSERT) @PostMapping("/add") @@ -117,6 +120,7 @@ public class TesterInterfaceController extends BaseController /** * 修改保存接口信息 */ + @ApiOperation("修改保存接口信息") @RequiresPermissions("tester:task_interface:edit") @Log(title = "接口信息", businessType = BusinessType.UPDATE) @PostMapping("/edit") @@ -129,6 +133,7 @@ public class TesterInterfaceController extends BaseController /** * 删除接口信息 */ + @ApiOperation("删除接口信息") @RequiresPermissions("tester:task_interface:remove") @Log(title = "接口信息", businessType = BusinessType.DELETE) @PostMapping( "/remove") @@ -144,9 +149,11 @@ public class TesterInterfaceController extends BaseController { return prefix + "/swagger_import"; } + /** * 查询swagger接口信息 */ + @ApiOperation("查询swagger接口信息") @RequiresPermissions("tester:task_interface:swagger_import") @PostMapping("/swagger_import") @ResponseBody diff --git a/tester/src/main/java/com/ruoyi/tester/controller/TesterLoginConfigController.java b/tester/src/main/java/com/ruoyi/tester/controller/TesterLoginConfigController.java index 7687be3ae1dc6f21e3f0feaf9bdb0c844379bf1b..da18d3c7b58560694e40a9449cf24e61fd8399cd 100644 --- a/tester/src/main/java/com/ruoyi/tester/controller/TesterLoginConfigController.java +++ b/tester/src/main/java/com/ruoyi/tester/controller/TesterLoginConfigController.java @@ -1,6 +1,8 @@ package com.ruoyi.tester.controller; import java.util.List; + +import io.swagger.annotations.ApiOperation; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @@ -44,6 +46,7 @@ public class TesterLoginConfigController extends BaseController /** * 查询登录配置列表 */ + @ApiOperation("查询登录配置列表") @RequiresPermissions("tester:login_config:list") @PostMapping("/list") @ResponseBody @@ -80,6 +83,7 @@ public class TesterLoginConfigController extends BaseController /** * 新增保存登录配置 */ + @ApiOperation("新增保存登录配置") @RequiresPermissions("tester:login_config:add") @Log(title = "登录配置", businessType = BusinessType.INSERT) @PostMapping("/add") @@ -105,6 +109,7 @@ public class TesterLoginConfigController extends BaseController /** * 修改保存登录配置 */ + @ApiOperation("修改保存登录配置") @RequiresPermissions("tester:login_config:edit") @Log(title = "登录配置", businessType = BusinessType.UPDATE) @PostMapping("/edit") @@ -117,6 +122,7 @@ public class TesterLoginConfigController extends BaseController /** * 删除登录配置 */ + @ApiOperation("删除登录配置") @RequiresPermissions("tester:login_config:remove") @Log(title = "登录配置", businessType = BusinessType.DELETE) @PostMapping( "/remove") diff --git a/tester/src/main/java/com/ruoyi/tester/controller/TesterTaskCallLogController.java b/tester/src/main/java/com/ruoyi/tester/controller/TesterTaskCallLogController.java index ad23b42dd50da60dabb5616398c3affc00250af1..4eb98afbb3c6a83a9bf8252f049db38ada76c871 100644 --- a/tester/src/main/java/com/ruoyi/tester/controller/TesterTaskCallLogController.java +++ b/tester/src/main/java/com/ruoyi/tester/controller/TesterTaskCallLogController.java @@ -4,15 +4,12 @@ import java.util.List; import com.ruoyi.tester.domain.TaskCallLogOut; import com.ruoyi.tester.service.ITesterExecutorService; +import io.swagger.annotations.ApiOperation; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.*; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.tester.domain.TesterTaskCallLog; @@ -49,6 +46,7 @@ public class TesterTaskCallLogController extends BaseController /** * 查询任务调用日志列表 */ + @ApiOperation("查询任务调用日志列表") @RequiresPermissions("tester:task_call_log:list") @PostMapping("/list") @ResponseBody @@ -73,54 +71,31 @@ public class TesterTaskCallLogController extends BaseController return util.exportExcel(list, "任务调用日志数据"); } - /** - * 新增任务调用日志 - */ - @GetMapping("/add") - public String add() - { - return prefix + "/add"; - } - - /** - * 新增保存任务调用日志 - */ - @RequiresPermissions("tester:task_call_log:add") - @Log(title = "任务调用日志", businessType = BusinessType.INSERT) - @PostMapping("/add") - @ResponseBody - public AjaxResult addSave(TesterTaskCallLog testerTaskCallLog) - { - return toAjax(testerTaskCallLogService.insertTesterTaskCallLog(testerTaskCallLog)); - } /** - * 修改任务调用日志 + * 查看调用日志明细 */ @RequiresPermissions("tester:task_call_log:edit") @GetMapping("/edit/{taskCallLogId}") public String edit(@PathVariable("taskCallLogId") Long taskCallLogId, ModelMap mmap) { - TesterTaskCallLog testerTaskCallLog = testerTaskCallLogService.selectTesterTaskCallLogByTaskCallLogId(taskCallLogId); + TesterTaskCallLog testerTaskCallLog = testerTaskCallLogService.selectTesterTaskCallLogByTaskCallLogId(taskCallLogId, null, null); mmap.put("testerTaskCallLog", testerTaskCallLog); return prefix + "/edit"; } - /** - * 修改保存任务调用日志 - */ - @RequiresPermissions("tester:task_call_log:edit") - @Log(title = "任务调用日志", businessType = BusinessType.UPDATE) - @PostMapping("/edit") + //过滤调用日志明细 + @GetMapping( "/search") @ResponseBody - public AjaxResult editSave(TesterTaskCallLog testerTaskCallLog) - { - return toAjax(true); + public AjaxResult remove(@RequestParam Long taskCallLogId, @RequestParam(required = false) String interfaceDesc, @RequestParam(required = false) String status){ + TesterTaskCallLog testerTaskCallLog = testerTaskCallLogService.selectTesterTaskCallLogByTaskCallLogId(taskCallLogId, interfaceDesc, status); + return success(testerTaskCallLog); } /** * 删除任务调用日志 */ + @ApiOperation("删除任务调用日志") @RequiresPermissions("tester:task_call_log:remove") @Log(title = "任务调用日志", businessType = BusinessType.DELETE) @PostMapping( "/remove") diff --git a/tester/src/main/java/com/ruoyi/tester/controller/TesterTaskController.java b/tester/src/main/java/com/ruoyi/tester/controller/TesterTaskController.java index 41a17393591c2cadb52e57d513b527a155e24846..7258a55c9d36e5e31115e7047dd24ea96e287c54 100644 --- a/tester/src/main/java/com/ruoyi/tester/controller/TesterTaskController.java +++ b/tester/src/main/java/com/ruoyi/tester/controller/TesterTaskController.java @@ -4,6 +4,7 @@ import java.util.List; import com.ruoyi.tester.domain.TesterLoginConfig; import com.ruoyi.tester.service.ITesterLoginConfigService; +import io.swagger.annotations.ApiOperation; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @@ -49,6 +50,7 @@ public class TesterTaskController extends BaseController /** * 查询任务信息列表 */ + @ApiOperation("查询任务信息列表") @RequiresPermissions("tester:task:list") @PostMapping("/list") @ResponseBody @@ -87,6 +89,7 @@ public class TesterTaskController extends BaseController /** * 新增保存任务信息 */ + @ApiOperation("新增保存任务信息") @RequiresPermissions("tester:task:add") @Log(title = "任务信息", businessType = BusinessType.INSERT) @PostMapping("/add") @@ -114,6 +117,7 @@ public class TesterTaskController extends BaseController /** * 修改保存任务信息 */ + @ApiOperation("修改保存任务信息") @RequiresPermissions("tester:task:edit") @Log(title = "任务信息", businessType = BusinessType.UPDATE) @PostMapping("/edit") @@ -126,6 +130,7 @@ public class TesterTaskController extends BaseController /** * 删除任务信息 */ + @ApiOperation("删除任务信息") @RequiresPermissions("tester:task:remove") @Log(title = "任务信息", businessType = BusinessType.DELETE) @PostMapping( "/remove") diff --git a/tester/src/main/java/com/ruoyi/tester/controller/TesterTaskInterfaceRelationController.java b/tester/src/main/java/com/ruoyi/tester/controller/TesterTaskInterfaceRelationController.java index b10c7644cd59d3220057013dfa13701246053208..762e10d75c7b856c529a21318e929e7d18a1d803 100644 --- a/tester/src/main/java/com/ruoyi/tester/controller/TesterTaskInterfaceRelationController.java +++ b/tester/src/main/java/com/ruoyi/tester/controller/TesterTaskInterfaceRelationController.java @@ -10,6 +10,7 @@ import com.ruoyi.tester.executor.expression.ExpressionContainer; import com.ruoyi.tester.service.ITesterInterfaceService; import com.ruoyi.tester.service.ITesterLoginConfigService; import com.ruoyi.tester.service.ITesterTaskService; +import io.swagger.annotations.ApiOperation; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @@ -63,6 +64,7 @@ public class TesterTaskInterfaceRelationController extends BaseController /** * 查询任务-接口关联关系列表 */ + @ApiOperation("查询任务-接口关联关系列表") @RequiresPermissions("tester:task_interface_relation:list") @PostMapping("/list") @ResponseBody @@ -111,6 +113,7 @@ public class TesterTaskInterfaceRelationController extends BaseController /** * 新增保存任务-接口关联关系 */ + @ApiOperation("新增保存任务-接口关联关系") @RequiresPermissions("tester:task_interface_relation:add") @Log(title = "任务-接口关联关系", businessType = BusinessType.INSERT) @PostMapping("/add") @@ -164,6 +167,7 @@ public class TesterTaskInterfaceRelationController extends BaseController /** * 修改保存任务-接口关联关系 */ + @ApiOperation("修改保存任务-接口关联关系") @RequiresPermissions("tester:task_interface_relation:edit") @Log(title = "任务-接口关联关系", businessType = BusinessType.UPDATE) @PostMapping("/edit") @@ -176,6 +180,7 @@ public class TesterTaskInterfaceRelationController extends BaseController /** * 删除任务-接口关联关系 */ + @ApiOperation("删除任务-接口关联关系") @RequiresPermissions("tester:task_interface_relation:remove") @Log(title = "任务-接口关联关系", businessType = BusinessType.DELETE) @PostMapping( "/remove") diff --git a/tester/src/main/java/com/ruoyi/tester/domain/InterfaceCallLog.java b/tester/src/main/java/com/ruoyi/tester/domain/InterfaceCallLog.java index 910ee0c005570ff2fedfd94cc662027899aea5d8..ff1788baf5ce444a08829a47eed68bf88165eca1 100644 --- a/tester/src/main/java/com/ruoyi/tester/domain/InterfaceCallLog.java +++ b/tester/src/main/java/com/ruoyi/tester/domain/InterfaceCallLog.java @@ -21,10 +21,11 @@ public class InterfaceCallLog { private String status; private String judgeExpression; private String response; + private String responseHeaders; private String exception; private Date createTime; - public InterfaceCallLog(TaskInterfaceEffectiveInfo interfaceInfo, Map headers, String response, String exception){ + public InterfaceCallLog(TaskInterfaceEffectiveInfo interfaceInfo, Map headers, String response, String responseHeaders, String exception){ setTaskCallLogId(interfaceInfo.getTaskCallLogId()); setInterfaceId(interfaceInfo.getInterfaceId()); setInterfaceDesc(interfaceInfo.getInterfaceDesc()); @@ -34,6 +35,7 @@ public class InterfaceCallLog { setContentType(interfaceInfo.getContentType()); setHeaders(headers.toString()); setResponse(response); + setResponseHeaders(responseHeaders); setCreateTime(new Date()); setStatus(InterfaceCallStatus.FAULT); setJudgeExpression(interfaceInfo.getJudgeExpression()); @@ -136,6 +138,14 @@ public class InterfaceCallLog { this.response = response; } + public String getResponseHeaders() { + return responseHeaders; + } + + public void setResponseHeaders(String responseHeaders) { + this.responseHeaders = responseHeaders; + } + public Date getCreateTime() { return createTime; } diff --git a/tester/src/main/java/com/ruoyi/tester/domain/TesterInterfaceCallLog.java b/tester/src/main/java/com/ruoyi/tester/domain/TesterInterfaceCallLog.java index b1d458f5798d04a9cd369a78733928543fa0c10c..8ed07ff47762860b00bc577d9145516690d940f5 100644 --- a/tester/src/main/java/com/ruoyi/tester/domain/TesterInterfaceCallLog.java +++ b/tester/src/main/java/com/ruoyi/tester/domain/TesterInterfaceCallLog.java @@ -61,6 +61,10 @@ public class TesterInterfaceCallLog extends BaseEntity @Excel(name = "返回结果") private String response; + /** 返回headers */ + @Excel(name = "返回headers") + private String responseHeaders; + /** 异常消息 */ @Excel(name = "异常消息") private String exception; @@ -173,6 +177,14 @@ public class TesterInterfaceCallLog extends BaseEntity return response; } + public String getResponseHeaders() { + return responseHeaders; + } + + public void setResponseHeaders(String responseHeaders) { + this.responseHeaders = responseHeaders; + } + public String getException() { return exception; } @@ -196,6 +208,7 @@ public class TesterInterfaceCallLog extends BaseEntity .append("status", getStatus()) .append("judgeExpression", getJudgeExpression()) .append("response", getResponse()) + .append("responseHeaders", getResponseHeaders()) .append("exception", getException()) .append("createTime", getCreateTime()) .toString(); diff --git a/tester/src/main/java/com/ruoyi/tester/executor/ExtraHandlerImpl.java b/tester/src/main/java/com/ruoyi/tester/executor/ExtraHandlerImpl.java index ae981c92bf671625ff9b8654ff3c960c17ec2c47..b2b330d44be9a4c6d7588b57f1d53572b4a64c1f 100644 --- a/tester/src/main/java/com/ruoyi/tester/executor/ExtraHandlerImpl.java +++ b/tester/src/main/java/com/ruoyi/tester/executor/ExtraHandlerImpl.java @@ -150,6 +150,9 @@ public class ExtraHandlerImpl implements IExtraHandler { if(interfaceCallLog.getResponse() != null && interfaceCallLog.getResponse().length() > 512){ interfaceCallLog.setResponse(interfaceCallLog.getResponse().substring(0, 512)); } + if(interfaceCallLog.getResponseHeaders() != null && interfaceCallLog.getResponseHeaders().length() > 512){ + interfaceCallLog.setResponseHeaders(interfaceCallLog.getResponseHeaders().substring(0, 512)); + } if(interfaceCallLog.getException() != null && interfaceCallLog.getException().length() > 255){ interfaceCallLog.setException(interfaceCallLog.getException().substring(0, 255)); } diff --git a/tester/src/main/java/com/ruoyi/tester/executor/InterfaceCallUtils.java b/tester/src/main/java/com/ruoyi/tester/executor/InterfaceCallUtils.java index 2a32a902b15d5fbe1e686d3a7e3c54687fee2c42..fa2f9ac2ac2f8bcb3243732df1c2360b054206f7 100644 --- a/tester/src/main/java/com/ruoyi/tester/executor/InterfaceCallUtils.java +++ b/tester/src/main/java/com/ruoyi/tester/executor/InterfaceCallUtils.java @@ -1,16 +1,10 @@ package com.ruoyi.tester.executor; -import com.mashape.unirest.http.HttpResponse; -import com.mashape.unirest.http.Unirest; import com.mashape.unirest.http.exceptions.UnirestException; -import com.mashape.unirest.request.GetRequest; -import com.mashape.unirest.request.HttpRequestWithBody; -import com.mashape.unirest.request.body.RequestBodyEntity; import com.ruoyi.tester.domain.TaskInterfaceEffectiveInfo; import com.ruoyi.tester.executor.http.HttpUtils; import com.ruoyi.tester.executor.http.HttpUtilsFactory; import com.ruoyi.tester.executor.http.XzfHttpResult; -import org.json.JSONObject; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.util.StringUtils; @@ -29,22 +23,30 @@ public class InterfaceCallUtils { String finalUrl = composeUrl(interfaceInfo.getHost(), interfaceInfo.getPort(), interfaceInfo.getMapping(), interfaceInfo.getQueryParam()); interfaceInfo.setFinalUrl(finalUrl); HttpUtils httpUtils = HttpUtilsFactory.getHttpUtils(); + String contentType = StringUtils.hasLength(interfaceInfo.getContentType()) ? interfaceInfo.getContentType() : "application/x-www-form-urlencoded"; if("GET".equalsIgnoreCase(interfaceInfo.getHttpMethod())){ - XzfHttpResult result = httpUtils.get(finalUrl, interfaceInfo.getContentType(), headers, interfaceInfo.getQueryParam(), interfaceInfo.getPathParam()); + XzfHttpResult result = httpUtils.get(finalUrl, contentType, headers, interfaceInfo.getQueryParam(), interfaceInfo.getPathParam()); + return result; + } else if("HEAD".equalsIgnoreCase(interfaceInfo.getHttpMethod())){ + XzfHttpResult result = httpUtils.head(finalUrl, contentType, headers, interfaceInfo.getQueryParam(), interfaceInfo.getPathParam()); return result; } else if ("POST".equalsIgnoreCase(interfaceInfo.getHttpMethod())) { - XzfHttpResult result = httpUtils.post(finalUrl, interfaceInfo.getContentType(), headers, interfaceInfo.getQueryParam(), interfaceInfo.getBodyParam(), interfaceInfo.getPathParam()); + XzfHttpResult result = httpUtils.post(finalUrl, contentType, headers, interfaceInfo.getQueryParam(), interfaceInfo.getBodyParam(), interfaceInfo.getPathParam()); return result; -// } else if ("FORM".equalsIgnoreCase(interfaceInfo.getHttpMethod())) { -// return InterfaceCallUtils.form(finalUrl, interfaceInfo.getBodyParam(), headers); } else if ("PUT".equalsIgnoreCase(interfaceInfo.getHttpMethod())) { - XzfHttpResult result = httpUtils.put(finalUrl, interfaceInfo.getContentType(), headers, interfaceInfo.getQueryParam(), interfaceInfo.getBodyParam(), interfaceInfo.getPathParam()); + XzfHttpResult result = httpUtils.put(finalUrl, contentType, headers, interfaceInfo.getQueryParam(), interfaceInfo.getBodyParam(), interfaceInfo.getPathParam()); return result; } else if ("DELETE".equalsIgnoreCase(interfaceInfo.getHttpMethod())) { - XzfHttpResult result = httpUtils.delete(finalUrl, interfaceInfo.getContentType(), headers, interfaceInfo.getQueryParam(), interfaceInfo.getBodyParam(), interfaceInfo.getPathParam()); + XzfHttpResult result = httpUtils.delete(finalUrl, contentType, headers, interfaceInfo.getQueryParam(), interfaceInfo.getBodyParam(), interfaceInfo.getPathParam()); return result; } else if ("PATCH".equalsIgnoreCase(interfaceInfo.getHttpMethod())) { - XzfHttpResult result = httpUtils.patch(finalUrl, interfaceInfo.getContentType(), headers, interfaceInfo.getQueryParam(), interfaceInfo.getBodyParam(), interfaceInfo.getPathParam()); + XzfHttpResult result = httpUtils.patch(finalUrl, contentType, headers, interfaceInfo.getQueryParam(), interfaceInfo.getBodyParam(), interfaceInfo.getPathParam()); + return result; + } else if ("TRACE".equalsIgnoreCase(interfaceInfo.getHttpMethod())) { + XzfHttpResult result = httpUtils.trace(finalUrl, contentType, headers, interfaceInfo.getQueryParam(), interfaceInfo.getBodyParam(), interfaceInfo.getPathParam()); + return result; + } else if ("OPTIONS".equalsIgnoreCase(interfaceInfo.getHttpMethod())) { + XzfHttpResult result = httpUtils.options(finalUrl, contentType, headers, interfaceInfo.getQueryParam(), interfaceInfo.getBodyParam(), interfaceInfo.getPathParam()); return result; } else { return null; diff --git a/tester/src/main/java/com/ruoyi/tester/executor/InterfaceCallable.java b/tester/src/main/java/com/ruoyi/tester/executor/InterfaceCallable.java index 0a357a4daa7fa220593d1c743188328c910841eb..e24eaac164caa61a8d012dfe129975176d858cfc 100644 --- a/tester/src/main/java/com/ruoyi/tester/executor/InterfaceCallable.java +++ b/tester/src/main/java/com/ruoyi/tester/executor/InterfaceCallable.java @@ -49,11 +49,13 @@ public class InterfaceCallable implements Runnable { XzfHttpResult xzfHttpResult = null; String response = null; + Map responseHeaders = null; String exception = null; try { extraHandler.cureDependParam(interfaceInfo, calledStatus); xzfHttpResult = InterfaceCallUtils.execute(interfaceInfo, headers); response = xzfHttpResult.getBody(); + responseHeaders = xzfHttpResult.getHeaders(); } catch (Exception e){ logger.error("", e); exception = e.getMessage(); @@ -81,7 +83,7 @@ public class InterfaceCallable implements Runnable { interfaceStatus = InterfaceCallStatus.FAULT; } - InterfaceCallLog interfaceCallLog = new InterfaceCallLog(interfaceInfo, headers, response, exception); + InterfaceCallLog interfaceCallLog = new InterfaceCallLog(interfaceInfo, headers, response, responseHeaders.toString(), exception); interfaceCallLog.setStatus(interfaceStatus); extraHandler.saveResult(interfaceCallLog, taskProgres); diff --git a/tester/src/main/java/com/ruoyi/tester/executor/expression/ExpExist.java b/tester/src/main/java/com/ruoyi/tester/executor/expression/ExpExist.java new file mode 100644 index 0000000000000000000000000000000000000000..6ee5536752ef34e5bf04607479d8a20ee21e7bd0 --- /dev/null +++ b/tester/src/main/java/com/ruoyi/tester/executor/expression/ExpExist.java @@ -0,0 +1,28 @@ +package com.ruoyi.tester.executor.expression; + +import com.ruoyi.tester.executor.ExpressionContext; +import org.springframework.stereotype.Component; + +/** + * @author SongJun + * @description TODO: + * @date 2022/6/2 14:39 + */ +@Component +public class ExpExist implements ExpressionAnalysis { + @Override + public String getExpressionName() { + return "exist"; + } + + @Override + public String getDescription() { + return "exist() 返回当前上下文是否存在(不等于null);"; + } + + @Override + public Object analysis(ExpressionContext context, String... param) { + String strBody = context.getContext().toString(); + return strBody != null; + } +} diff --git a/tester/src/main/java/com/ruoyi/tester/executor/http/HttpUtils.java b/tester/src/main/java/com/ruoyi/tester/executor/http/HttpUtils.java index 344d09e6995775cc7238cc5c203235db59e785b7..5fd9b5c129f3b151cd55943464431033379d6435 100644 --- a/tester/src/main/java/com/ruoyi/tester/executor/http/HttpUtils.java +++ b/tester/src/main/java/com/ruoyi/tester/executor/http/HttpUtils.java @@ -9,4 +9,6 @@ public interface HttpUtils { XzfHttpResult put(String url, String contentType, Map headers, String queryParam, String bodyParam, String pathParam); XzfHttpResult delete(String url, String contentType, Map headers, String queryParam, String bodyParam, String pathParam); XzfHttpResult patch(String url, String contentType, Map headers, String queryParam, String bodyParam, String pathParam); + XzfHttpResult trace(String url, String contentType, Map headers, String queryParam, String bodyParam, String pathParam); + XzfHttpResult options(String url, String contentType, Map headers, String queryParam, String bodyParam, String pathParam); } diff --git a/tester/src/main/java/com/ruoyi/tester/executor/http/OkhttpsUtil.java b/tester/src/main/java/com/ruoyi/tester/executor/http/OkhttpsUtil.java index ceed7d9a6eddc80e89f623250ee5edeba928a139..9afbde84927693bfe0d7ad24ec36bc7bfd4b84a3 100644 --- a/tester/src/main/java/com/ruoyi/tester/executor/http/OkhttpsUtil.java +++ b/tester/src/main/java/com/ruoyi/tester/executor/http/OkhttpsUtil.java @@ -92,4 +92,14 @@ public class OkhttpsUtil implements HttpUtils { public XzfHttpResult patch(String url, String contentType, Map headers, String queryParam, String bodyParam, String pathParam) { return null; } + + @Override + public XzfHttpResult options(String url, String contentType, Map headers, String queryParam, String bodyParam, String pathParam) { + return null; + } + + @Override + public XzfHttpResult trace(String url, String contentType, Map headers, String queryParam, String bodyParam, String pathParam) { + return null; + } } diff --git a/tester/src/main/java/com/ruoyi/tester/executor/http/UnirestUtil.java b/tester/src/main/java/com/ruoyi/tester/executor/http/UnirestUtil.java index 4b2405a0a12775c22e191f9c4337b7eb36d243fd..e1fed6044f22321bbec1443291c99a567e870e72 100644 --- a/tester/src/main/java/com/ruoyi/tester/executor/http/UnirestUtil.java +++ b/tester/src/main/java/com/ruoyi/tester/executor/http/UnirestUtil.java @@ -89,6 +89,8 @@ public class UnirestUtil implements HttpUtils { } else if(StringUtils.hasLength(bodyParam)) { requestWithBody.body(bodyParam); } + } else if(StringUtils.hasLength(bodyParam)) { + requestWithBody.body(bodyParam); } HttpResponse httpResponse = requestWithBody.asString(); Headers respHeaders = httpResponse.getHeaders(); @@ -115,4 +117,14 @@ public class UnirestUtil implements HttpUtils { public XzfHttpResult patch(String url, String contentType, Map headers, String queryParam, String bodyParam, String pathParam) { return new XzfHttpResult(false, -1, "patch方法未实现", null); } + + @Override + public XzfHttpResult options(String url, String contentType, Map headers, String queryParam, String bodyParam, String pathParam) { + return null; + } + + @Override + public XzfHttpResult trace(String url, String contentType, Map headers, String queryParam, String bodyParam, String pathParam) { + return null; + } } diff --git a/tester/src/main/java/com/ruoyi/tester/mapper/TesterTaskCallLogMapper.java b/tester/src/main/java/com/ruoyi/tester/mapper/TesterTaskCallLogMapper.java index fb9a6bbfe9df9444b371abc909a9b6daaf4eb933..ea676f827e7360b8f6293eeaa56ffa0b522f1aad 100644 --- a/tester/src/main/java/com/ruoyi/tester/mapper/TesterTaskCallLogMapper.java +++ b/tester/src/main/java/com/ruoyi/tester/mapper/TesterTaskCallLogMapper.java @@ -3,6 +3,7 @@ package com.ruoyi.tester.mapper; import java.util.List; import com.ruoyi.tester.domain.TesterTaskCallLog; import com.ruoyi.tester.domain.TesterInterfaceCallLog; +import org.apache.ibatis.annotations.Param; /** * 任务调用日志Mapper接口 @@ -18,7 +19,7 @@ public interface TesterTaskCallLogMapper * @param taskCallLogId 任务调用日志主键 * @return 任务调用日志 */ - public TesterTaskCallLog selectTesterTaskCallLogByTaskCallLogId(Long taskCallLogId); + public TesterTaskCallLog selectTesterTaskCallLogByTaskCallLogId(@Param("taskCallLogId") Long taskCallLogId, @Param("interfaceDesc") String interfaceDesc, @Param("status") String status); /** * 查询任务调用日志列表 diff --git a/tester/src/main/java/com/ruoyi/tester/service/ITesterTaskCallLogService.java b/tester/src/main/java/com/ruoyi/tester/service/ITesterTaskCallLogService.java index d55c98b536492f1c0439614b50d9f09ff21f4492..bf4931a10b9e57e8e0c6461f461dc264761a2f2e 100644 --- a/tester/src/main/java/com/ruoyi/tester/service/ITesterTaskCallLogService.java +++ b/tester/src/main/java/com/ruoyi/tester/service/ITesterTaskCallLogService.java @@ -17,7 +17,7 @@ public interface ITesterTaskCallLogService * @param taskCallLogId 任务调用日志主键 * @return 任务调用日志 */ - public TesterTaskCallLog selectTesterTaskCallLogByTaskCallLogId(Long taskCallLogId); + public TesterTaskCallLog selectTesterTaskCallLogByTaskCallLogId(Long taskCallLogId, String interfaceDesc, String status); /** * 查询任务调用日志列表 diff --git a/tester/src/main/java/com/ruoyi/tester/service/impl/TesterTaskCallLogServiceImpl.java b/tester/src/main/java/com/ruoyi/tester/service/impl/TesterTaskCallLogServiceImpl.java index 620f8a38395dcb5df704832e3ca440e3b8d77576..03db5baf50e4cd9dd3387a75ebd92393ce697484 100644 --- a/tester/src/main/java/com/ruoyi/tester/service/impl/TesterTaskCallLogServiceImpl.java +++ b/tester/src/main/java/com/ruoyi/tester/service/impl/TesterTaskCallLogServiceImpl.java @@ -32,9 +32,9 @@ public class TesterTaskCallLogServiceImpl implements ITesterTaskCallLogService * @return 任务调用日志 */ @Override - public TesterTaskCallLog selectTesterTaskCallLogByTaskCallLogId(Long taskCallLogId) + public TesterTaskCallLog selectTesterTaskCallLogByTaskCallLogId(Long taskCallLogId, String interfaceDesc, String status) { - return testerTaskCallLogMapper.selectTesterTaskCallLogByTaskCallLogId(taskCallLogId); + return testerTaskCallLogMapper.selectTesterTaskCallLogByTaskCallLogId(taskCallLogId, interfaceDesc, status); } /** diff --git a/tester/src/main/java/com/ruoyi/tester/swagger/SwaggerParserV3.java b/tester/src/main/java/com/ruoyi/tester/swagger/SwaggerParserV3.java index 3ce01a03d6f1a18736f95c703d30fca6826a0d3b..98c56f20dcc26d892bf38ff8c0eb3fd073d7adfd 100644 --- a/tester/src/main/java/com/ruoyi/tester/swagger/SwaggerParserV3.java +++ b/tester/src/main/java/com/ruoyi/tester/swagger/SwaggerParserV3.java @@ -33,20 +33,28 @@ public class SwaggerParserV3 implements SwaggerParser { TesterInterface testerInterface = new TesterInterface(); testerInterface.setDesc(""); testerInterface.setQueryParam(""); + testerInterface.setPathParam(""); testerInterface.setBodyParam(""); testerInterface.setContentType(""); ret.add(testerInterface); JSONObject itf = path.getJSONObject(httpMethod); testerInterface.setMapping(mapping); - testerInterface.setHttpMethod(httpMethod); + testerInterface.setHttpMethod(httpMethod.toUpperCase()); + testerInterface.setDesc(itf.getString("summary")); if(itf.has("parameters")){ - JSONObject bodyParam = new JSONObject(); + JSONObject queryParam = null; + JSONObject bodyParam = null; + JSONObject pathParam = null; JSONArray parameters = itf.getJSONArray("parameters"); for (int i=0; istatus, judge_expression, response, + response_headers, `exception`, create_time, @@ -114,6 +115,7 @@ #{status}, #{judgeExpression}, #{response}, + #{responseHeaders}, #{exception}, #{createTime}, diff --git a/tester/src/main/resources/mapper/tester/TesterTaskCallLogMapper.xml b/tester/src/main/resources/mapper/tester/TesterTaskCallLogMapper.xml index 524a97c52a8f88d295934ec92091fc6656b4fb05..b7993fd4c937c66a4bb5b13d73ac59e29414cfb9 100644 --- a/tester/src/main/resources/mapper/tester/TesterTaskCallLogMapper.xml +++ b/tester/src/main/resources/mapper/tester/TesterTaskCallLogMapper.xml @@ -34,6 +34,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -54,10 +55,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" diff --git a/tester/src/main/resources/templates/tester/task/task.html b/tester/src/main/resources/templates/tester/task/task.html index 152c7ced9945e987af7659bc9956297458c3f936..e1f7d709aced6102ad3e466a68d83c81902b7ddc 100644 --- a/tester/src/main/resources/templates/tester/task/task.html +++ b/tester/src/main/resources/templates/tester/task/task.html @@ -126,7 +126,7 @@ dataType: "json", success:function (repdata) { if (repdata.code == '0') { - alert(repdata.msg); + $.modal.msgSuccess(repdata.msg); } } }); diff --git a/tester/src/main/resources/templates/tester/task_call_log/edit.html b/tester/src/main/resources/templates/tester/task_call_log/edit.html index 51198edabf2d43746ac61dbf0889626253886775..b31d86d8018211ce39d7eadb75d0102a923e6a70 100644 --- a/tester/src/main/resources/templates/tester/task_call_log/edit.html +++ b/tester/src/main/resources/templates/tester/task_call_log/edit.html @@ -7,6 +7,26 @@

接口调用日志

+
+
    +
  • + + +
  • +
  • + + +
  • +
  • +  搜索 +  重置 +
  • +
+
@@ -25,9 +45,25 @@ parent.layer.close(index);//关闭当前页 } + function doSearch(){ + var taskCallLogId = [[${testerTaskCallLog.taskCallLogId}]]; + var interfaceDesc = $("#interfaceDesc").val(); + var status = $("#status").val(); + $.get(prefix+"/search?taskCallLogId="+taskCallLogId+"&interfaceDesc="+interfaceDesc+"&status="+status,function(data,status){ + testerInterfaceCallLogList = data.data == null ? [] : data.data.testerInterfaceCallLogList; + initTable(testerInterfaceCallLogList); + }); + } + $(function() { + var data = [[${testerTaskCallLog.testerInterfaceCallLogList}]]; + initTable(data); + }); + + function initTable(rowsData){ + $.table.destroy(); var options = { - data: [[${testerTaskCallLog.testerInterfaceCallLogList}]], + data: rowsData, pagination: false, showSearch: false, showRefresh: false, @@ -35,126 +71,135 @@ showColumns: false, sidePagination: "client", columns: [ - { - field: 'index', - align: 'center', - title: "序号", - formatter: function (value, row, index) { - var columnIndex = $.common.sprintf("", $.table.serialNumber(index)); - return columnIndex + $.table.serialNumber(index); - } - }, - { - field: 'interfaceId', - align: 'center', - title: '接口id', - formatter: function(value, row, index) { - var html = "
"+value+"
"; - return html; - } - }, - { - field: 'interfaceDesc', - align: 'center', - title: '接口描述', - formatter: function(value, row, index) { - var html = "
"+value+"
"; - return html; - } - }, - { - field: 'status', - align: 'center', - title: '返回状态', - formatter: function(value, row, index) { - var html = "
"+value+"
"; - return html; - } - }, - { - field: 'response', - align: 'center', - title: '返回结果', - formatter: function(value, row, index) { - var html = "
"+value+"
"; - return html; - } - }, - { - field: 'judgeExpression', - align: 'center', - title: '判定表达式', - formatter: function(value, row, index) { - var html = "
"+value+"
"; - return html; - } - }, - { - field: 'httpMethod', - align: 'center', - title: 'http方式', - formatter: function(value, row, index) { - var html = "
"+value+"
"; - return html; - } - }, - { - field: 'finalUrl', - align: 'center', - title: '实际url', - formatter: function(value, row, index) { - var html = "
"+value+"
"; - return html; - } - }, - { - field: 'bodyParam', - align: 'center', - title: '实际body参数', - formatter: function(value, row, index) { - var html = "
"+value+"
"; - return html; - } - }, - { - field: 'headers', - align: 'center', - title: 'headers', - formatter: function(value, row, index) { - var html = "
"+value+"
"; - return html; - } - }, - { - field: 'contentType', - align: 'center', - title: 'contentType', - formatter: function(value, row, index) { - var html = "
"+value+"
"; - return html; - } - }, - { - field: 'exception', - align: 'center', - title: 'exception', - formatter: function(value, row, index) { - var html = "
"+value+"
"; - return html; - } - }, - { - field: 'createTime', - align: 'center', - title: '创建时间', - formatter: function(value, row, index) { - var html = "
"+value+"
"; - return html; - } - }] + { + field: 'index', + align: 'center', + title: "序号", + formatter: function (value, row, index) { + var columnIndex = $.common.sprintf("", $.table.serialNumber(index)); + return columnIndex + $.table.serialNumber(index); + } + }, + { + field: 'interfaceId', + align: 'center', + title: '接口id', + formatter: function(value, row, index) { + var html = "
"+value+"
"; + return html; + } + }, + { + field: 'interfaceDesc', + align: 'center', + title: '接口描述', + formatter: function(value, row, index) { + var html = "
"+value+"
"; + return html; + } + }, + { + field: 'status', + align: 'center', + title: '返回状态', + formatter: function(value, row, index) { + var html = "
"+value+"
"; + return html; + } + }, + { + field: 'response', + align: 'center', + title: '返回结果', + formatter: function(value, row, index) { + var html = "
"+value+"
"; + return html; + } + }, + { + field: 'responseHeaders', + align: 'center', + title: '返回headers', + formatter: function(value, row, index) { + var html = "
"+value+"
"; + return html; + } + }, + { + field: 'judgeExpression', + align: 'center', + title: '判定表达式', + formatter: function(value, row, index) { + var html = "
"+value+"
"; + return html; + } + }, + { + field: 'httpMethod', + align: 'center', + title: 'http方式', + formatter: function(value, row, index) { + var html = "
"+value+"
"; + return html; + } + }, + { + field: 'finalUrl', + align: 'center', + title: '实际url', + formatter: function(value, row, index) { + var html = "
"+value+"
"; + return html; + } + }, + { + field: 'bodyParam', + align: 'center', + title: '实际body参数', + formatter: function(value, row, index) { + var html = "
"+value+"
"; + return html; + } + }, + { + field: 'headers', + align: 'center', + title: 'headers', + formatter: function(value, row, index) { + var html = "
"+value+"
"; + return html; + } + }, + { + field: 'contentType', + align: 'center', + title: 'contentType', + formatter: function(value, row, index) { + var html = "
"+value+"
"; + return html; + } + }, + { + field: 'exception', + align: 'center', + title: 'exception', + formatter: function(value, row, index) { + var html = "
"+value+"
"; + return html; + } + }, + { + field: 'createTime', + align: 'center', + title: '创建时间', + formatter: function(value, row, index) { + var html = "
"+value+"
"; + return html; + } + }] }; $.table.init(options); - }); + } function addColumn() { var count = $("#" + table.options.id).bootstrapTable('getData').length; diff --git a/tester/src/main/resources/templates/tester/task_call_log/task_call_log.html b/tester/src/main/resources/templates/tester/task_call_log/task_call_log.html index 26f62fb710bd496a031b01d195d6121aea49cf1a..49e5ee544dd2fd33f7a06127f691bd1a122bd4a3 100644 --- a/tester/src/main/resources/templates/tester/task_call_log/task_call_log.html +++ b/tester/src/main/resources/templates/tester/task_call_log/task_call_log.html @@ -76,11 +76,11 @@ }, { field: 'callCount', - title: '总调用次数' + title: '总调用接口数' }, { field: 'doneCount', - title: '已完成次数' + title: '已完成接口数' }, { field: 'progres', diff --git a/tester/src/main/resources/templates/tester/task_interface/swagger_import.html b/tester/src/main/resources/templates/tester/task_interface/swagger_import.html index 52f9c63c6f499c5ce714e9f00909e39999bfb2b1..7e6e404381ccb3448678a934ed2faefba870154f 100644 --- a/tester/src/main/resources/templates/tester/task_interface/swagger_import.html +++ b/tester/src/main/resources/templates/tester/task_interface/swagger_import.html @@ -40,7 +40,7 @@
- +
@@ -48,7 +48,7 @@
- +
@@ -71,16 +71,17 @@ success: function (result) { $("#bootstrap-table thead").empty(); $("#bootstrap-table tbody").empty(); - $("#bootstrap-table thead").append('接口描述接口mappinghttp方式content_typequery参数body参数'); + $("#bootstrap-table thead").append('接口描述接口mappinghttp方式content_typequery参数body参数path参数操作'); for(var i=0; i'+rowDesc+''+rowMapping+''+rowHttpMethod+''+rowContentType+''+rowQueryParam+''+rowBodyParam+'移除'); + $("#bootstrap-table tbody").append(''+rowDesc+''+rowMapping+''+rowHttpMethod+''+rowContentType+''+rowQueryParam+''+rowBodyParam+''+rowPathParam+'移除'); } } }); @@ -105,9 +106,10 @@ row.desc = grossDesc + ($(rows[i]).children()[0].innerText == "-" ? "" : $(rows[i]).children()[0].innerText); row.mapping = grossMapping + $(rows[i]).children()[1].innerText; row.httpMethod = $(rows[i]).children()[2].innerText; - row.contentType = $(rows[i]).children()[3].innerText; + row.contentType = $(rows[i]).children()[3].innerText == "-" ? "" : $(rows[i]).children()[3].innerText; row.queryParam = $(rows[i]).children()[4].innerText == "-" ? "" : $(rows[i]).children()[4].innerText; row.bodyParam = $(rows[i]).children()[5].innerText == "-" ? "" : $(rows[i]).children()[5].innerText; + row.pathParam = $(rows[i]).children()[6].innerText == "-" ? "" : $(rows[i]).children()[6].innerText; row.judgeExpression = grossJudgeExpression; table.push(row); } diff --git a/tester/src/main/resources/templates/tester/task_interface_relation/add.html b/tester/src/main/resources/templates/tester/task_interface_relation/add.html index 8e9a3160aa5e66916ff43faf886a78b20bb0ee7c..482feb9e9fb40ec777871cc648036fd8fda84497 100644 --- a/tester/src/main/resources/templates/tester/task_interface_relation/add.html +++ b/tester/src/main/resources/templates/tester/task_interface_relation/add.html @@ -20,7 +20,7 @@
@@ -64,19 +64,19 @@
- +
- +
- +
@@ -113,8 +113,26 @@ } $("#interfaceId").change(function () { - var text = $("#interfaceId").find("option:selected").text(); - $("#description").val(text); + var desc = $(this).find("option:selected").text(); + $("#description").val(''); + if(desc != null){ + $("#description").val(desc); + } + var queryParam = $(this).find("option:selected").attr("data-queryParam"); + $("#queryParam").val(''); + if(queryParam != null){ + $("#queryParam").val(queryParam); + } + var bodyParam = $(this).find("option:selected").attr("data-bodyParam"); + $("#bodyParam").val(''); + if(bodyParam != null){ + $("#bodyParam").val(bodyParam); + } + var pathParam = $(this).find("option:selected").attr("data-pathParam"); + $("#pathParam").val(''); + if(pathParam != null){ + $("#pathParam").val(pathParam); + } }); $("#taskId").change(function () {