diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 0000000..cd21d83 --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + FILE + + + + + + + + + + + + + + + + 1671436414908 + + + + + + \ No newline at end of file diff --git a/agile.env b/agile.env new file mode 100644 index 0000000..0d070ff --- /dev/null +++ b/agile.env @@ -0,0 +1,8 @@ +MYSQL_HOST=mysql +MYSQL_PORT=3306 +MYSQL_DATABASE=case_manager +MYSQL_USER=agile +MYSQL_PASSWORD=agile +MYSQL_ROOT_PASSWORD=agile +TZ=Asia/Shanghai +AUTH_FLAG=true diff --git a/case-server/sql/case-server.sql b/case-server/sql/case-server.sql index be4aa15..7540c07 100644 --- a/case-server/sql/case-server.sql +++ b/case-server/sql/case-server.sql @@ -2,7 +2,7 @@ CREATE TABLE `case_backup` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键id', `case_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '用例集id', `title` varchar(64) NOT NULL DEFAULT '' COMMENT '用例名称', - `creator` varchar(20) NOT NULL DEFAULT '' COMMENT '用例保存人', + `creator` varchar(1023) NOT NULL DEFAULT '' COMMENT '用例保存人', `gmt_created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '用例保存时间', `case_content` longtext CHARACTER SET utf8mb4, `record_content` longtext COMMENT '任务执行内容', @@ -22,9 +22,9 @@ CREATE TABLE `exec_record` ( `pass_count` int(10) NOT NULL DEFAULT '0' COMMENT '执行个数', `total_count` int(10) NOT NULL DEFAULT '0' COMMENT '需执行总个数', `success_count` int(10) NOT NULL DEFAULT '0' COMMENT '成功个数', - `creator` varchar(20) NOT NULL DEFAULT '' COMMENT '用例创建人', - `modifier` varchar(20) NOT NULL DEFAULT '' COMMENT '用例修改人', - `executors` varchar(200) NOT NULL DEFAULT '' COMMENT '执行人', + `creator` varchar(1023) NOT NULL DEFAULT '' COMMENT '用例创建人', + `modifier` varchar(1023) NOT NULL DEFAULT '' COMMENT '用例修改人', + `executors` varchar(1023) NOT NULL DEFAULT '' COMMENT '执行人', `description` varchar(1000) NOT NULL DEFAULT '' COMMENT '描述', `choose_content` varchar(200) NOT NULL DEFAULT '' COMMENT '圈选用例内容', `gmt_created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '记录创建时间', @@ -33,7 +33,7 @@ CREATE TABLE `exec_record` ( `expect_end_time` timestamp NOT NULL DEFAULT '1971-01-01 00:00:00' COMMENT '预计结束时间', `actual_start_time` timestamp NOT NULL DEFAULT '1971-01-01 00:00:00' COMMENT '实际开始时间', `actual_end_time` timestamp NOT NULL DEFAULT '1971-01-01 00:00:00' COMMENT '实际结束时间', - `owner` varchar(200) NOT NULL DEFAULT '' COMMENT '负责人', + `owner` varchar(1023) NOT NULL DEFAULT '' COMMENT '负责人', PRIMARY KEY (`id`), KEY `idx_caseId_isdelete` (`case_id`,`is_delete`) ) ENGINE=InnoDB AUTO_INCREMENT=898 DEFAULT CHARSET=utf8 COMMENT='用例执行记录'; @@ -44,7 +44,7 @@ CREATE TABLE `test_case` ( `title` varchar(64) NOT NULL DEFAULT 'testcase' COMMENT '用例名称', `description` varchar(512) NOT NULL DEFAULT '' COMMENT '用例描述', `is_delete` int(11) NOT NULL DEFAULT '0' COMMENT '用例状态 0-正常 1-删除', - `creator` varchar(20) NOT NULL DEFAULT '' COMMENT '用例创建人', + `creator` varchar(1023) NOT NULL DEFAULT '' COMMENT '用例创建人', `modifier` varchar(1000) NOT NULL DEFAULT '' COMMENT '用例修改人', `case_content` longtext CHARACTER SET utf8mb4, `gmt_created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '记录创建时间', @@ -86,7 +86,7 @@ alter table exec_record # 增加用户信息表 CREATE TABLE `user` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键id', - `username` varchar(255) NOT NULL DEFAULT '' COMMENT '用户名', + `username` varchar(1023) NOT NULL DEFAULT '' COMMENT '用户名', `password` varchar(1023) NOT NULL DEFAULT '' COMMENT '密码', `salt` varchar(1023) NOT NULL DEFAULT '' COMMENT '盐', `is_delete` int(1) NOT NULL DEFAULT '0' COMMENT '是否删除', @@ -94,6 +94,7 @@ CREATE TABLE `user` ( `product_line_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '业务线', `gmt_created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '注册时间', `gmt_updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `authority_name` varchar(63) NOT NULL DEFAULT ''COMMENT '权限名称,ROLE_开头,全大写', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=677 DEFAULT CHARSET=utf8 COMMENT='用户信息'; @@ -110,7 +111,9 @@ CREATE TABLE `authority` ( PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='权限信息'; -INSERT INTO `authority` (id,authority_name,authority_desc,authority_content) VALUES (1, 'ROLE_USER', '普通用户', '/api/dir/list,/api/record/list,/api/record/getRecordInfo,/api/user/**,/api/case/list*'); +INSERT INTO `authority` (id,authority_name,authority_desc,authority_content) VALUES (1, 'ROLE_USER', '普通用户', '/api/dir/list,/api/record/list,/api/record/getRecordInfo,/api/user/**,/api/case/list*,api/dir/cardTree,api/case/getCaseInfo'); INSERT INTO `authority` (id,authority_name,authority_desc,authority_content) VALUES (2, 'ROLE_ADMIN', '管理员', '/api/dir/list,/api/backup/**,/api/record/**,/api/file/**,/api/user/**,/api/case/**'); INSERT INTO `authority` (id,authority_name,authority_desc,authority_content) VALUES (3, 'ROLE_SA', '超级管理员','/api/**'); +INSERT INTO `authority` (id,authority_name,authority_desc,authority_content) VALUES (4, 'ROLE_QA', '普通测试人员','/api/**'); +INSERT INTO `authority` (id,authority_name,authority_desc,authority_content) VALUES (5, 'ROLE_RD', '普通开发人员','/api/dir/list,/api/record/list,/api/record/getRecordInfo,/api/user/**,/api/case/list*,/api/dir/cardTree,/api/case/**'); diff --git a/case-server/src/main/java/com/xiaoju/framework/constants/SystemConstant.java b/case-server/src/main/java/com/xiaoju/framework/constants/SystemConstant.java index b74856c..813dfec 100644 --- a/case-server/src/main/java/com/xiaoju/framework/constants/SystemConstant.java +++ b/case-server/src/main/java/com/xiaoju/framework/constants/SystemConstant.java @@ -13,13 +13,13 @@ public class SystemConstant { public final static String COMMA = ","; public final static Integer IS_DELETE = 1; - + public final static Integer NOT_DELETE = 0; public static final String POINT = "."; public static final String HTTP_USER_AGENT = "User-Agent"; - public static final String DEFAULT_AUTHORITY_NAME = "ROLE_USER"; + public static final String DEFAULT_AUTHORITY_NAME = "ROLE_RD"; } diff --git a/case-server/src/main/java/com/xiaoju/framework/handler/LockIngressTask.java b/case-server/src/main/java/com/xiaoju/framework/handler/LockIngressTask.java index db170fd..0d77506 100644 --- a/case-server/src/main/java/com/xiaoju/framework/handler/LockIngressTask.java +++ b/case-server/src/main/java/com/xiaoju/framework/handler/LockIngressTask.java @@ -1,5 +1,6 @@ package com.xiaoju.framework.handler; +import com.alibaba.fastjson.JSON; import com.corundumstudio.socketio.BroadcastOperations; import com.corundumstudio.socketio.SocketIOClient; import com.corundumstudio.socketio.SocketIOServer; @@ -16,6 +17,7 @@ public LockIngressTask(SocketIOClient client, SocketIOServer socketIOServer, Roo @Override public void run() { + LOGGER.info("websocket client:{}",JSON.toJSONString(client)); room.lock(); LOGGER.info(data.getMessage()); ClientEntity clientEntity = getRoomFromClient(client); diff --git a/case-server/src/main/resources/application.properties b/case-server/src/main/resources/application.properties index 8ddc204..8d179d3 100644 --- a/case-server/src/main/resources/application.properties +++ b/case-server/src/main/resources/application.properties @@ -59,4 +59,4 @@ spring.thymeleaf.suffix=.html spring.devtools.add-properties=false # 权限开关,默认关闭 -authority.flag=false \ No newline at end of file +authority.flag=true diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..a5bf546 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,34 @@ +version: '3' +services: + case-server: + image: yestodayhadrain/case-server:v1.0.6 + container_name: agileTC-caseserver + env_file: + - ./agile.env + command: bash -c "cd /app/ && java -jar case-server-1.0-SNAPSHOT.jar" + # docker 端口映射,如果宿主机 8080 端口被占用需要更改 + ports: + - "8080:8094" + depends_on: + - mysql + restart: always + networks: + - agile-net + mysql: + image: mysql:latest + container_name: agileTC-mysql + # 挂载到宿主机目录 /data/mysql/data + volumes: + - /data/mysql/data:/var/lib/mysql + env_file: + - ./agile.env + # docker 端口映射,如果宿主机 6666 端口被占用需要更改 + ports: + - "6666:3306" + restart: always + networks: + - agile-net + command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci +networks: + agile-net: + driver: bridge