Quellcode durchsuchen

权限管理系统初始化。

huangbo vor 3 Jahren
Ursprung
Commit
5e9c2ca255
59 geänderte Dateien mit 2472 neuen und 0 gelöschten Zeilen
  1. 8 0
      qb-auth-server/.gitignore
  2. 133 0
      qb-auth-server/pom.xml
  3. 294 0
      qb-auth-server/sql/系统权限管理v1.4.1.sql
  4. 78 0
      qb-auth-server/src/main/assembly-package.xml
  5. 30 0
      qb-auth-server/src/main/java/com/ipu/logicflow/server/LogicflowServerStart.java
  6. 40 0
      qb-auth-server/src/main/java/com/ipu/logicflow/server/biz/logic/control/LogicController.java
  7. 15 0
      qb-auth-server/src/main/java/com/ipu/logicflow/server/biz/logic/service/LogicService.java
  8. 23 0
      qb-auth-server/src/main/java/com/ipu/logicflow/server/biz/logic/service/impl/LogicServiceImpl.java
  9. 54 0
      qb-auth-server/src/main/java/com/ipu/logicflow/server/util/LogicFlowConfig.java
  10. 4 0
      qb-auth-server/src/main/resources/banner.txt
  11. 44 0
      qb-auth-server/src/main/resources/dev/application.yml
  12. 32 0
      qb-auth-server/src/main/resources/dev/ipu-cache.xml
  13. 28 0
      qb-auth-server/src/main/resources/dev/ipu-mybatis-config.xml
  14. 15 0
      qb-auth-server/src/main/resources/dev/log4j2.xml
  15. 43 0
      qb-auth-server/src/main/resources/dev/menu.json
  16. 0 0
      qb-auth-server/src/main/resources/exception_messages_zh_CN.properties
  17. 99 0
      qb-auth-server/src/main/resources/flow/menu/menu_delete.xml
  18. 27 0
      qb-auth-server/src/main/resources/flow/menu/menu_insert.xml
  19. 0 0
      qb-auth-server/src/main/resources/flow/menu/menu_select.xml
  20. 0 0
      qb-auth-server/src/main/resources/flow/menu/menu_update.xml
  21. 55 0
      qb-auth-server/src/main/resources/flow/menu/model/sec_menu.xml
  22. 57 0
      qb-auth-server/src/main/resources/flow/menu/model/sec_priv_entity.xml
  23. 0 0
      qb-auth-server/src/main/resources/flow/menu/priv_entity_delete.xml
  24. 27 0
      qb-auth-server/src/main/resources/flow/menu/priv_entity_insert.xml
  25. 0 0
      qb-auth-server/src/main/resources/flow/menu/priv_entity_select.xml
  26. 56 0
      qb-auth-server/src/main/resources/flow/org/model/sec_org_user_rel.xml
  27. 56 0
      qb-auth-server/src/main/resources/flow/org/model/sec_organize.xml
  28. 27 0
      qb-auth-server/src/main/resources/flow/org/organize_insert.xml
  29. 27 0
      qb-auth-server/src/main/resources/flow/org/organize_select.xml
  30. 0 0
      qb-auth-server/src/main/resources/flow/org/user_role_delete.xml
  31. 0 0
      qb-auth-server/src/main/resources/flow/org/user_role_insert.xml
  32. 0 0
      qb-auth-server/src/main/resources/flow/org/user_role_select.xml
  33. 48 0
      qb-auth-server/src/main/resources/flow/role/model/sec_role.xml
  34. 57 0
      qb-auth-server/src/main/resources/flow/role/model/sec_role_grant.xml
  35. 0 0
      qb-auth-server/src/main/resources/flow/role/role_delete.xml
  36. 27 0
      qb-auth-server/src/main/resources/flow/role/role_grant_insert.xml
  37. 0 0
      qb-auth-server/src/main/resources/flow/role/role_insert.xml
  38. 0 0
      qb-auth-server/src/main/resources/flow/role/role_select_by_cond.xml
  39. 0 0
      qb-auth-server/src/main/resources/flow/role/role_select_by_id.xml
  40. 0 0
      qb-auth-server/src/main/resources/flow/role/role_update.xml
  41. 83 0
      qb-auth-server/src/main/resources/flow/user/model/sec_user.xml
  42. 53 0
      qb-auth-server/src/main/resources/flow/user/user_disable_with_aggregate.xml
  43. 43 0
      qb-auth-server/src/main/resources/flow/user/user_insert.xml
  44. 27 0
      qb-auth-server/src/main/resources/flow/user/user_select.xml
  45. 37 0
      qb-auth-server/src/main/resources/flow/user/user_select_by_id.xml
  46. 27 0
      qb-auth-server/src/main/resources/flow/user/user_select_by_name.xml
  47. 29 0
      qb-auth-server/src/main/resources/flow/user/user_update.xml
  48. 15 0
      qb-auth-server/src/main/resources/ipu-spring-mvc.xml
  49. 54 0
      qb-auth-server/src/main/resources/pro/application.yml
  50. 41 0
      qb-auth-server/src/main/resources/pro/ipu-mybatis-config.xml
  51. 14 0
      qb-auth-server/src/main/resources/pro/log4j2.xml
  52. 54 0
      qb-auth-server/src/main/resources/test/application.yml
  53. 41 0
      qb-auth-server/src/main/resources/test/ipu-mybatis-config.xml
  54. 14 0
      qb-auth-server/src/main/resources/test/log4j2.xml
  55. 91 0
      qb-auth-server/src/test/java/com/ipu/logicflow/server/MenuTest.java
  56. 93 0
      qb-auth-server/src/test/java/com/ipu/logicflow/server/OrganizeTest.java
  57. 67 0
      qb-auth-server/src/test/java/com/ipu/logicflow/server/PrivEntityTest.java
  58. 66 0
      qb-auth-server/src/test/java/com/ipu/logicflow/server/RoleGrantTest.java
  59. 219 0
      qb-auth-server/src/test/java/com/ipu/logicflow/server/UserTest.java

+ 8 - 0
qb-auth-server/.gitignore

@ -0,0 +1,8 @@
1
bin/
2
target/
3
.settings/
4
*.iml
5
.classpath
6
.project
7
.DS_Store
8
.idea/

+ 133 - 0
qb-auth-server/pom.xml

@ -0,0 +1,133 @@
1
<?xml version="1.0" encoding="UTF-8"?>
2
<project xmlns="http://maven.apache.org/POM/4.0.0"
3
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5
    <parent>
6
        <groupId>com.ai.ipu.server</groupId>
7
        <artifactId>ipu-assembly-parent</artifactId>
8
        <version>3.3-SNAPSHOT</version>
9
    </parent>
10
    <modelVersion>4.0.0</modelVersion>
11
12
    <artifactId>qb-auth-server</artifactId>
13
14
    <repositories>
15
        <!-- 阿里私服 -->
16
        <repository>
17
            <id>ali</id>
18
            <url>http://maven.aliyun.com/nexus/content/groups/public</url>
19
            <releases>
20
                <enabled>true</enabled>
21
            </releases>
22
            <snapshots>
23
                <enabled>true</enabled>
24
                <updatePolicy>always</updatePolicy>
25
                <checksumPolicy>fail</checksumPolicy>
26
            </snapshots>
27
        </repository>
28
        <!-- IPU仓库 -->
29
        <repository>
30
            <id>ipu</id>
31
            <name>ipu repository</name>
32
            <url>http://114.215.100.48:9090/nexus/content/groups/public/</url>
33
            <releases>
34
                <enabled>true</enabled>
35
            </releases>
36
            <snapshots>
37
                <enabled>true</enabled>
38
                <updatePolicy>always</updatePolicy>
39
            </snapshots>
40
        </repository>
41
    </repositories>
42
43
    <properties>
44
        <start-class>com.ipu.logicflow.server.LogicflowServerStart</start-class>
45
        <spring-boot>2.3.1.RELEASE</spring-boot>
46
        <ipu>3.3-SNAPSHOT</ipu>
47
        <ipu-rest>3.3-SNAPSHOT</ipu-rest>
48
        <nuosi-logicflow>1.1</nuosi-logicflow>
49
    </properties>
50
51
    <dependencyManagement>
52
        <dependencies>
53
            <dependency>
54
                <groupId>com.ai.ipu.server</groupId>
55
                <artifactId>ipu-dependencies</artifactId>
56
                <version>${ipu}</version>
57
                <type>pom</type>
58
                <scope>import</scope>
59
            </dependency>
60
            <dependency>
61
                <groupId>org.springframework.boot</groupId>
62
                <artifactId>spring-boot-dependencies</artifactId>
63
                <version>${spring-boot}</version>
64
                <type>pom</type>
65
                <scope>import</scope>
66
            </dependency>
67
        </dependencies>
68
    </dependencyManagement>
69
    <dependencies>
70
        <dependency>
71
            <groupId>junit</groupId>
72
            <artifactId>junit</artifactId>
73
            <scope>test</scope>
74
        </dependency>
75
        <dependency>
76
            <groupId>com.ai.ipu.server</groupId>
77
            <artifactId>ipu-restful</artifactId>
78
            <version>${ipu-rest}</version>
79
        </dependency>
80
        <dependency>
81
            <groupId>com.ipu.flow</groupId>
82
            <artifactId>ipu-logicflow</artifactId>
83
            <version>${nuosi-logicflow}</version>
84
        </dependency>
85
86
        <!--<dependency>
87
            <groupId>io.github.reynolds2019</groupId>
88
            <artifactId>nuosi-logicflow</artifactId>
89
            <version>${nuosi-logicflow}</version>
90
        </dependency>-->
91
        <!-- Spring引入 -->
92
        <dependency>
93
            <groupId>org.springframework.boot</groupId>
94
            <artifactId>spring-boot-starter-web</artifactId>
95
        </dependency>
96
    </dependencies>
97
98
    <build>
99
        <plugins>
100
            <!-- ==========应用包和依赖包分离的打包方法================ -->
101
            <plugin>
102
                <groupId>org.apache.maven.plugins</groupId>
103
                <artifactId>maven-resources-plugin</artifactId>
104
            </plugin>
105
            <!-- 复制依赖包 -->
106
            <plugin>
107
                <groupId>org.apache.maven.plugins</groupId>
108
                <artifactId>maven-dependency-plugin</artifactId>
109
            </plugin>
110
            <plugin>
111
                <groupId>org.apache.maven.plugins</groupId>
112
                <artifactId>maven-jar-plugin</artifactId>
113
            </plugin>
114
            <plugin>
115
                <groupId>org.apache.maven.plugins</groupId>
116
                <artifactId>maven-assembly-plugin</artifactId>
117
            </plugin>
118
            <plugin>
119
                <groupId>org.apache.maven.plugins</groupId>
120
                <artifactId>maven-surefire-plugin</artifactId>
121
                <configuration>
122
                    <skipTests>true</skipTests>
123
                </configuration>
124
            </plugin>
125
126
            <!-- 添加docker镜像功能 -->
127
            <!--<plugin>
128
                <groupId>com.spotify</groupId>
129
                <artifactId>dockerfile-maven-plugin</artifactId>
130
            </plugin>-->
131
        </plugins>
132
    </build>
133
</project>

+ 294 - 0
qb-auth-server/sql/系统权限管理v1.4.1.sql

@ -0,0 +1,294 @@
1
/*==============================================================*/
2
/* DBMS name:      MySQL 5.0                                    */
3
/* Created on:     2022/2/10 23:08:37                           */
4
/*==============================================================*/
5
6
7
drop table if exists sec_menu;
8
9
drop table if exists sec_org_user_rel;
10
11
drop table if exists sec_organize;
12
13
drop table if exists sec_priv_entity;
14
15
drop table if exists sec_role;
16
17
drop table if exists sec_role_grant;
18
19
drop table if exists sec_role_user_rel;
20
21
drop table if exists sec_user;
22
23
/*==============================================================*/
24
/* Table: sec_menu                                              */
25
/*==============================================================*/
26
create table sec_menu
27
(
28
   MENU_ID              bigint(20) not null auto_increment comment '菜单标识',
29
   PARENT_MENU_ID       bigint(20) default NULL comment '上级菜单标识',
30
   SUB_COUNT            int(5) default NULL comment '子菜单数目',
31
   MENU_TYPE            varchar(3),
32
   MENU_NAME            varchar(256),
33
   MENU_TITLE           varchar(256),
34
   LEVEL                int(11) unsigned default NULL comment '层级 ',
35
   MENU_SORT            int(5) default NULL comment '排序',
36
   MENU_COMPONENT       varchar(256),
37
   MENU_ICON            varchar(256),
38
   LINK_URL             varchar(256),
39
   IFRAME_FLAG          int(1) default NULL comment '是否外链',
40
   CACHE_FLAG           int(1) default NULL comment '缓存',
41
   HIDDEN_FLAG          int(1) default NULL comment '隐藏',
42
   VALID_DATE           datetime default NULL comment '生效日期',
43
   EXPIRE_DATE          datetime default NULL comment '失效日期',
44
   DATA_STATUS          varchar(8),
45
   CREATE_DATE          datetime default NULL comment '创建日期',
46
   CREATE_OP_ID         varchar(32),
47
   CREATE_ORG_ID        varchar(32),
48
   DONE_CODE            bigint(22) default NULL comment '事务编号',
49
   DONE_DATE            datetime default NULL comment '操作日期',
50
   OP_ID                varchar(32),
51
   ORG_ID               varchar(32),
52
   MGMT_DISTRICT        varchar(8),
53
   MGMT_COUNTY          varchar(8),
54
   REGION_ID            varchar(8),
55
   TENANT_CODE          varchar(32),
56
   primary key (MENU_ID)
57
)
58
ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
59
60
/*==============================================================*/
61
/* Table: sec_org_user_rel                                      */
62
/*==============================================================*/
63
create table sec_org_user_rel
64
(
65
   ORG_USER_REL_ID      bigint(20) not null auto_increment comment '用户组织关系标识',
66
   ORGANIZE_ID          bigint(20) default NULL comment '组织标识',
67
   USER_ID              bigint(20) default NULL comment '用户标识',
68
   VALID_DATE           datetime default NULL comment '生效日期',
69
   EXPIRE_DATE          datetime default NULL comment '失效日期',
70
   DATA_STATUS          varchar(8),
71
   CREATE_DATE          datetime default NULL comment '创建日期',
72
   CREATE_OP_ID         varchar(32),
73
   CREATE_ORG_ID        varchar(32),
74
   DONE_CODE            bigint(22) default NULL comment '事务编号',
75
   DONE_DATE            datetime default NULL comment '操作日期',
76
   OP_ID                varchar(32),
77
   ORG_ID               varchar(32),
78
   MGMT_DISTRICT        varchar(8),
79
   MGMT_COUNTY          varchar(8),
80
   REGION_ID            varchar(8),
81
   TENANT_CODE          varchar(32),
82
   primary key (ORG_USER_REL_ID)
83
)
84
ENGINE=InnoDB AUTO_INCREMENT=101 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
85
86
/*==============================================================*/
87
/* Table: sec_organize                                          */
88
/*==============================================================*/
89
create table sec_organize
90
(
91
   ORGANIZE_ID          bigint(20) not null auto_increment comment '组织标识',
92
   ORGANIZE_TYPE        varchar(3),
93
   PARTY_ID             bigint(20) default NULL comment '参与人标识',
94
   ORGANIZE_NAME        varchar(200),
95
   ORGANIZE_CODE        varchar(100),
96
   PARENT_ORGANIZE_ID   bigint(20) default NULL comment '父组织标识',
97
   DISTRICT_ID          varchar(40),
98
   SHORT_NAME           varchar(200),
99
   ENGLISH_NAME         varchar(200),
100
   DEPT_FULL_ID         varchar(400),
101
   DEPT_FULL_NAME       varchar(400),
102
   LEVEL                int(5) default NULL comment '层级,顶层为1,依次类推',
103
   DEPT_LEADER          bigint(20) default NULL comment '部门负责人,关联 user_id',
104
   MEMBER_NUM           int(5) default NULL comment '组织人数',
105
   MANAGER_NAME         varchar(40),
106
   EMAIL                varchar(50),
107
   LINK_PHONE_ID        varchar(50),
108
   FAX_ID               varchar(50),
109
   ORG_ADDRESS          varchar(255),
110
   CONTACT_NAME         varchar(100),
111
   CONTACT_CARD_TYPE    varchar(3),
112
   CONTACT_CARD_ID      varchar(40),
113
   CONTACT_BILL_ID      varchar(50),
114
   POSTCODE             varchar(10),
115
   POST_PROVINCE        varchar(32),
116
   POST_CITY            varchar(32),
117
   POST_ADDRESS         varchar(255),
118
   POST_POSTCOD         varchar(32),
119
   COUNTY_ID            varchar(32),
120
   LEAF_FLAG            int(1) default NULL comment '是否叶子节点\r\n            1--是 0-否\r\n            ',
121
   ORG_LEVEL            varchar(3),
122
   ORG_AREA_TYPE        varchar(3),
123
   ORG_COOP_TYPE        varchar(3),
124
   CHANNEL_TYPE         varchar(3),
125
   REMARK               varchar(255),
126
   VALID_DATE           datetime default NULL comment '生效日期',
127
   EXPIRE_DATE          datetime default NULL comment '失效日期',
128
   DATA_STATUS          varchar(8),
129
   CREATE_DATE          datetime default NULL comment '创建日期',
130
   CREATE_OP_ID         varchar(32),
131
   CREATE_ORG_ID        varchar(32),
132
   DONE_CODE            bigint(22) default NULL comment '事务编号',
133
   DONE_DATE            datetime default NULL comment '操作日期',
134
   OP_ID                varchar(32),
135
   ORG_ID               varchar(32),
136
   MGMT_DISTRICT        varchar(8),
137
   MGMT_COUNTY          varchar(8),
138
   REGION_ID            varchar(8),
139
   TENANT_CODE          varchar(32),
140
   primary key (ORGANIZE_ID)
141
)
142
ENGINE=InnoDB AUTO_INCREMENT=33 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
143
144
/*==============================================================*/
145
/* Table: sec_priv_entity                                       */
146
/*==============================================================*/
147
create table sec_priv_entity
148
(
149
   PRIV_ENT_ID          bigint(20) not null auto_increment comment '权限实体标识',
150
   PRIV_ENT_NAME        varchar(255),
151
   PRIV_ENT_CODE        varchar(255),
152
   APP_ID               bigint(20) default NULL comment '使用系统标识',
153
   PRIV_ENT_TYPE_ID     bigint(20) default NULL comment '权限对象类型标识(用户权限分组管理)',
154
   BUSI_OBJ_ID          bigint(20) default NULL comment '实体对象标识(应用、菜单本身作为权限实体的标识)',
155
   BUSI_OBJ_TYPE        varchar(10),
156
   SENSITIVE_LEVEL      varchar(3),
157
   REMARK               varchar(100),
158
   VALID_DATE           datetime default NULL comment '生效日期',
159
   EXPIRE_DATE          datetime default NULL comment '失效日期',
160
   DATA_STATUS          varchar(8),
161
   CREATE_DATE          datetime default NULL comment '创建日期',
162
   CREATE_OP_ID         varchar(32),
163
   CREATE_ORG_ID        varchar(32),
164
   DONE_CODE            bigint(22) default NULL comment '事务编号',
165
   DONE_DATE            datetime default NULL comment '操作日期',
166
   OP_ID                varchar(32),
167
   ORG_ID               varchar(32),
168
   MGMT_DISTRICT        varchar(8),
169
   MGMT_COUNTY          varchar(8),
170
   REGION_ID            varchar(8),
171
   TENANT_CODE          varchar(32),
172
   primary key (PRIV_ENT_ID)
173
)
174
ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
175
176
/*==============================================================*/
177
/* Table: sec_role                                              */
178
/*==============================================================*/
179
create table sec_role
180
(
181
   ROLE_ID              bigint(20) not null auto_increment comment '角色标识',
182
   JOB_ID               bigint(20) default NULL comment '岗位标识',
183
   ROLE_NAME            varchar(256),
184
   ROLE_TYPE            varchar(3),
185
   ROLE_LEVEL           int(5) default NULL comment '角色级别\r\n            1:低;2:中;3:高;',
186
   DESCRIPTION          varchar(256),
187
   VALID_DATE           datetime default NULL comment '生效日期',
188
   EXPIRE_DATE          datetime default NULL comment '失效日期',
189
   DATA_STATUS          varchar(8),
190
   CREATE_DATE          datetime default NULL comment '创建日期',
191
   CREATE_OP_ID         varchar(32),
192
   CREATE_ORG_ID        varchar(32),
193
   DONE_CODE            bigint(22) default NULL comment '事务编号',
194
   DONE_DATE            datetime default NULL comment '操作日期',
195
   OP_ID                varchar(32),
196
   ORG_ID               varchar(32),
197
   MGMT_DISTRICT        varchar(8),
198
   MGMT_COUNTY          varchar(8),
199
   REGION_ID            varchar(8),
200
   TENANT_CODE          varchar(32),
201
   primary key (ROLE_ID)
202
)
203
ENGINE=InnoDB AUTO_INCREMENT=1001 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
204
205
/*==============================================================*/
206
/* Table: sec_role_grant                                        */
207
/*==============================================================*/
208
create table sec_role_grant
209
(
210
   ROLE_GRANT_ID        bigint(20) not null auto_increment comment '角色授权标识',
211
   ROLE_ID              bigint(20) default NULL comment '角色标识',
212
   PRIV_ENT_ID          bigint(20) default NULL comment '实体标识',
213
   REMARK               varchar(100),
214
   VALID_DATE           datetime default NULL comment '生效日期',
215
   EXPIRE_DATE          datetime default NULL comment '失效日期',
216
   DATA_STATUS          varchar(8),
217
   CREATE_DATE          datetime default NULL comment '创建日期',
218
   CREATE_OP_ID         varchar(32),
219
   CREATE_ORG_ID        varchar(32),
220
   DONE_CODE            bigint(22) default NULL comment '事务编号',
221
   DONE_DATE            datetime default NULL comment '操作日期',
222
   OP_ID                varchar(32),
223
   ORG_ID               varchar(32),
224
   MGMT_DISTRICT        varchar(8),
225
   MGMT_COUNTY          varchar(8),
226
   REGION_ID            varchar(8),
227
   TENANT_CODE          varchar(32),
228
   primary key (ROLE_GRANT_ID)
229
)
230
ENGINE=InnoDB AUTO_INCREMENT=1002 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
231
232
/*==============================================================*/
233
/* Table: sec_role_user_rel                                     */
234
/*==============================================================*/
235
create table sec_role_user_rel
236
(
237
   ROLE_USER_REL_ID     bigint(20) not null auto_increment comment '角色关联用户标识',
238
   USER_ID              bigint(20) not null comment '用户标识',
239
   ROLE_ID              bigint(20) not null comment '角色标识',
240
   VALID_DATE           datetime default NULL comment '生效日期',
241
   EXPIRE_DATE          datetime default NULL comment '失效日期',
242
   DATA_STATUS          varchar(8),
243
   CREATE_DATE          datetime default NULL comment '创建日期',
244
   CREATE_OP_ID         varchar(32),
245
   CREATE_ORG_ID        varchar(32),
246
   DONE_CODE            bigint(22) default NULL comment '事务编号',
247
   DONE_DATE            datetime default NULL comment '操作日期',
248
   OP_ID                varchar(32),
249
   ORG_ID               varchar(32),
250
   MGMT_DISTRICT        varchar(8),
251
   MGMT_COUNTY          varchar(8),
252
   REGION_ID            varchar(8),
253
   TENANT_CODE          varchar(32),
254
   primary key (ROLE_USER_REL_ID)
255
)
256
ENGINE=InnoDB AUTO_INCREMENT=101 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
257
258
/*==============================================================*/
259
/* Table: sec_user                                              */
260
/*==============================================================*/
261
create table sec_user
262
(
263
   USER_ID              bigint(20) not null auto_increment comment '用户标识',
264
   NICK_NAME            varchar(256),
265
   USER_ACCOUNT         varchar(500),
266
   GENDER               varchar(2),
267
   AVATAR_NAME          varchar(256),
268
   AVATAR_PATH          varchar(256),
269
   EMAIL                varchar(256),
270
   LINK_PHONE           varchar(256),
271
   PASSWORD             varchar(256),
272
   ADMIN_FLAG           int(1) default NULL comment '是否为ADMIN账号',
273
   SEC_LEVEL            char(1),
274
   ENABLED_FLAG         int(1) default NULL comment '状态:1启用、0禁用',
275
   PWD_RESET_TIME       varchar(2),
276
   VALID_DATE           datetime default NULL comment '生效日期',
277
   EXPIRE_DATE          datetime default NULL comment '失效日期',
278
   DATA_STATUS          varchar(8),
279
   CREATE_DATE          datetime default NULL comment '创建日期',
280
   CREATE_OP_ID         varchar(32),
281
   CREATE_ORG_ID        varchar(32),
282
   DONE_CODE            bigint(22) default NULL comment '事务编号',
283
   DONE_DATE            datetime default NULL comment '操作日期',
284
   OP_ID                varchar(32),
285
   ORG_ID               varchar(32),
286
   MGMT_DISTRICT        varchar(8),
287
   MGMT_COUNTY          varchar(8),
288
   REGION_ID            varchar(8),
289
   TENANT_CODE          varchar(32),
290
   SURNAME              varchar(500),
291
   primary key (USER_ID)
292
)
293
ENGINE=InnoDB AUTO_INCREMENT=1482980362203303937 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
294

+ 78 - 0
qb-auth-server/src/main/assembly-package.xml

@ -0,0 +1,78 @@
1
<assembly>
2
    <id>bin</id>
3
    <formats>
4
        <!-- <format>zip</format> -->
5
        <format>tar.gz</format>
6
    </formats>
7
    <fileSets>
8
    	<!-- 把项目相关的说明文件,打包进zip文件的根目录 -->
9
        <fileSet>
10
            <directory>${project.basedir}</directory>
11
            <outputDirectory>/</outputDirectory>
12
            <includes>
13
                <include>README*</include>
14
                <include>LICENSE*</include>
15
                <include>NOTICE*</include>
16
            </includes>
17
        </fileSet>
18
        <!-- /${project.build.finalName}/conf => /conf -->
19
        
20
        <!-- 把项目的配置文件,打包进zip包的conf目录 -->
21
        <fileSet>
22
            <directory>${project.build.directory}/conf</directory>
23
            <outputDirectory>/conf</outputDirectory>
24
            <directoryMode>0755</directoryMode>
25
            <fileMode>0644</fileMode>
26
        </fileSet>
27
        
28
        <!-- 把项目依赖的jar包,打包进zip包的lib目录 -->
29
        <fileSet>
30
            <directory>${project.build.directory}/lib</directory>
31
            <outputDirectory>/lib</outputDirectory>
32
            <directoryMode>0755</directoryMode>
33
            <fileMode>0644</fileMode>
34
        </fileSet>
35
    
36
        <!-- 把项目编译的jar包,打包进zip包的根目录 -->
37
        <fileSet>
38
            <directory>${project.build.directory}</directory>
39
            <outputDirectory>/</outputDirectory>
40
            <includes>
41
                <include>${project.build.finalName}.jar</include>
42
            </includes>
43
        </fileSet>
44
        
45
        <!-- 把项目的脚本文件,打包进zip包的bin目录 -->
46
         <fileSet>
47
             <directory>${project.basedir}/src/bin</directory>
48
             <outputDirectory>/bin</outputDirectory>
49
             <directoryMode>0755</directoryMode>
50
             <fileMode>0755</fileMode>
51
             <lineEnding>unix</lineEnding>
52
             <includes>
53
                 <include>*.sh</include>
54
                 <include>*.conf</include>
55
             </includes>
56
         </fileSet>
57
        <fileSet>
58
            <directory>${project.basedir}/src/bin</directory>
59
            <outputDirectory>/bin</outputDirectory>
60
            <directoryMode>0755</directoryMode>
61
            <fileMode>0755</fileMode>
62
            <lineEnding>dos</lineEnding>
63
            <includes>
64
                <include>*.bat</include>
65
            </includes>
66
        </fileSet>
67
    </fileSets>
68
    
69
    <!-- 把工程编译的jar打包进zip包的根目录 -->
70
    <!-- 
71
    <files>
72
		<file>
73
			<source>${project.build.directory}/${project.artifactId}.jar</source>
74
			<outputDirectory>/</outputDirectory>
75
		</file>
76
	</files> 
77
	-->
78
</assembly>

+ 30 - 0
qb-auth-server/src/main/java/com/ipu/logicflow/server/LogicflowServerStart.java

@ -0,0 +1,30 @@
1
package com.ipu.logicflow.server;
2
3
import com.ai.ipu.basic.util.IpuBaseException;
4
import com.ai.ipu.restful.boot.IpuRestApplication;
5
import com.ipu.logicflow.server.util.LogicFlowConfig;
6
7
/**
8
 * <p>desc: 逻辑编排服务启动类 </p>
9
 * <p>date: 2021/11/25 14:42 </p>
10
 *
11
 * @author nuosi fsofs@163.com
12
 * @version v1.0.0
13
 */
14
public class LogicflowServerStart {
15
16
    public static void main(String[] args) {
17
        // 初始化加载服务配置
18
        LogicFlowConfig.init();
19
        // 注册异常信息编码配置。
20
        registerExceptionCode();
21
        // 启动服务
22
        IpuRestApplication.start(args);
23
    }
24
25
    private static void registerExceptionCode(){
26
        // 热部署会多次加载,因此需要捕获并忽略异常
27
        String exceptionMessagesConfig = "exception_messages";
28
        IpuBaseException.registerCode(exceptionMessagesConfig);
29
    }
30
}

+ 40 - 0
qb-auth-server/src/main/java/com/ipu/logicflow/server/biz/logic/control/LogicController.java

@ -0,0 +1,40 @@
1
package com.ipu.logicflow.server.biz.logic.control;
2
3
import com.ai.ipu.data.JMap;
4
import com.ai.ipu.data.impl.JsonMap;
5
import com.alibaba.fastjson.JSONObject;
6
import com.ipu.logicflow.server.biz.logic.service.LogicService;
7
import org.slf4j.Logger;
8
import org.slf4j.LoggerFactory;
9
import org.springframework.beans.factory.annotation.Autowired;
10
import org.springframework.stereotype.Controller;
11
import org.springframework.web.bind.annotation.PathVariable;
12
import org.springframework.web.bind.annotation.RequestBody;
13
import org.springframework.web.bind.annotation.RequestMapping;
14
import org.springframework.web.bind.annotation.ResponseBody;
15
16
/**
17
 * <p>desc: 逻辑服务调用的入口 </p>
18
 * <p>date: 2021/11/25 15:00 </p>
19
 *
20
 * @author nuosi fsofs@163.com
21
 * @version v1.0.0
22
 */
23
@Controller
24
public class LogicController {
25
    private static final Logger log = LoggerFactory.getLogger(LogicController.class);
26
27
    @Autowired
28
    private LogicService logicService;
29
30
    @ResponseBody
31
    @RequestMapping("/logic/{logicId}")
32
    public Object logic(@PathVariable("logicId") String logicId, @RequestBody JSONObject input) throws Exception {
33
        System.out.println("logicId="+logicId);
34
        System.out.println("input="+input);
35
        JMap param = new JsonMap(input.toJSONString());
36
        Object result = logicService.execute(logicId, param);
37
        return result;
38
    }
39
40
}

+ 15 - 0
qb-auth-server/src/main/java/com/ipu/logicflow/server/biz/logic/service/LogicService.java

@ -0,0 +1,15 @@
1
package com.ipu.logicflow.server.biz.logic.service;
2
3
import com.ai.ipu.data.JMap;
4
5
/**
6
 * <p>desc: 逻辑服务的实现接口 </p>
7
 * <p>date: 2021/11/25 15:01 </p>
8
 *
9
 * @author nuosi fsofs@163.com
10
 * @version v1.0.0
11
 */
12
public interface LogicService {
13
14
    public Object execute(String logicName, JMap param) throws Exception;
15
}

+ 23 - 0
qb-auth-server/src/main/java/com/ipu/logicflow/server/biz/logic/service/impl/LogicServiceImpl.java

@ -0,0 +1,23 @@
1
package com.ipu.logicflow.server.biz.logic.service.impl;
2
3
import com.ai.ipu.data.JMap;
4
import com.nuosi.flow.logic.LogicFlowEngine;
5
import com.ipu.logicflow.server.biz.logic.service.LogicService;
6
import org.springframework.stereotype.Service;
7
8
/**
9
 * <p>desc: 逻辑服务的实现 </p>
10
 * <p>date: 2021/12/4 1:07 </p>
11
 *
12
 * @author nuosi fsofs@163.com
13
 * @version v1.0.0
14
 */
15
16
@Service
17
public class LogicServiceImpl implements LogicService {
18
    @Override
19
    public Object execute(String logicName, JMap param) throws Exception {
20
        Object result = LogicFlowEngine.execute(logicName, param);
21
        return result;
22
    }
23
}

+ 54 - 0
qb-auth-server/src/main/java/com/ipu/logicflow/server/util/LogicFlowConfig.java

@ -0,0 +1,54 @@
1
package com.ipu.logicflow.server.util;
2
3
import com.nuosi.flow.util.LogicFlowUtil;
4
5
import java.util.HashMap;
6
import java.util.Iterator;
7
import java.util.Map;
8
9
/**
10
 * <p>desc: LogicFlow配置类 </p>
11
 * <p>date: 2021/12/30 23:58 </p>
12
 *
13
 * @author nuosi fsofs@163.com
14
 * @version v1.0.0
15
 */
16
public class LogicFlowConfig {
17
    private static Map<String, String> modelPathMap = new HashMap<String, String>();
18
    private static Map<String, String> flowPathMap = new HashMap<String, String>();
19
20
    public static void init(){
21
        initModel();
22
        initFlow();
23
    }
24
25
    public static void initModel(){
26
        modelPathMap.put("sec_user", "flow/user/model/sec_user.xml");
27
        modelPathMap.put("sec_organize", "flow/org/model/sec_organize.xml");
28
        Iterator<String> it = modelPathMap.values().iterator();
29
        while(it.hasNext()){
30
            LogicFlowUtil.loadLogicModel(it.next());
31
32
        }
33
    }
34
35
    public static void initFlow(){
36
        flowPathMap.put("user_insert", "flow/user/user_insert.xml");
37
        flowPathMap.put("user_select", "flow/user/user_select.xml");
38
        flowPathMap.put("user_select_by_name", "flow/user/user_select_by_name.xml");
39
        flowPathMap.put("organize_select", "flow/org/organize_select.xml");
40
41
        Iterator<String> it = flowPathMap.values().iterator();
42
        while(it.hasNext()){
43
            LogicFlowUtil.loadLogicFlow(it.next());
44
        }
45
    }
46
47
    public static Map<String, String> getModelPathMap() {
48
        return modelPathMap;
49
    }
50
51
    public static Map<String, String> getFlowPathMap() {
52
        return flowPathMap;
53
    }
54
}

+ 4 - 0
qb-auth-server/src/main/resources/banner.txt

@ -0,0 +1,4 @@
1
======================
2
Nuosi Logicflow Server is running
3
${spring-boot.formatted-version}
4
======================

+ 44 - 0
qb-auth-server/src/main/resources/dev/application.yml

@ -0,0 +1,44 @@
1
#一、context-path配置的版本差异
2
#2.x:server.servlet.context-path=/ipu
3
#1.x:server.context-path=/ipu
4
#二、默认:server.servlet-path=/
5
6
server:
7
  servlet:
8
    context-path: /ipu
9
  #通过启动命令传参指定端口
10
  port: unknown
11
spring:
12
  application:
13
    #使用maven中的变量project.artifactId
14
    name: ${project.artifactId}
15
  mvc:
16
    #无拦截
17
    static-path-pattern: /**
18
  resources:
19
    static-locations: classpath:/${web.root}
20
  session:
21
    #session使用redis
22
    #store-type: redis
23
    #Demo不处理Session
24
    store-type: none
25
  #redis集群和连接池相关配置
26
  redis:
27
    host: 47.105.160.21
28
    port: 7111
29
    password: ipu
30
    pool:
31
      max-active: 8
32
      max-idle: 8
33
      max-wait: -1
34
      #默认0,不回收
35
      min-idle: 8
36
web:
37
  root: webapp/
38
logging:
39
  level: 
40
    root: DEBUG
41
  file: /data/logs/boot.log
42
define:
43
  session:
44
    timeout: 1800

+ 32 - 0
qb-auth-server/src/main/resources/dev/ipu-cache.xml

@ -0,0 +1,32 @@
1
<?xml version = '1.0' encoding = 'UTF-8'?>
2
<caches>
3
	<!-- ====================redis缓存============================ -->
4
	<cache name="ssn" type="redis">
5
		<servers>
6
			<!-- 如果不是cluster,则只使用第一个redis -->
7
			<server ip="121.42.183.206" port="7101" />
8
			<server ip="121.42.183.206" port="7102" />
9
			<server ip="121.42.183.206" port="7103" />
10
			<server ip="121.42.183.206" port="7104" />
11
			<server ip="121.42.183.206" port="7105" />
12
			<server ip="121.42.183.206" port="7106" />
13
		</servers>
14
		<!-- 客户端类型:Jedis,JedisCluster -->
15
		<config name="clientType" value="JedisCluster" />
16
		<!-- 访问redis的密码,可以为空 -->
17
		<config name="auth" value="Ipu@321!" />
18
		<!-- redis池的可用连接实例的最大数目,缺省为8 -->
19
		<config name="poolSize" value="10" />
20
		<!-- redis池最多有多少个状态为idle(空闲的)的jedis实例,缺省为8,空闲连接大于这个数会进行回收 -->
21
		<config name="maxIdle" />
22
		<!-- 最小空闲数,空闲连接小于这个数会建立新的连接,缺省为0 -->
23
		<config name="minIdle" />
24
		<!-- 等待Response超时时间,默认5000ms -->
25
		<config name="soTimeout" />
26
		<!-- 连接Redis Server超时时间,默认5000ms -->
27
		<config name="connTimeout" />
28
		<!-- 出现异常最大重试次数 -->
29
		<config name="maxAttempts" />
30
	</cache>
31
32
</caches>

+ 28 - 0
qb-auth-server/src/main/resources/dev/ipu-mybatis-config.xml

@ -0,0 +1,28 @@
1
<?xml version="1.0" encoding="UTF-8" ?>
2
<!DOCTYPE configuration
3
    PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
4
    "http://mybatis.org/dtd/mybatis-3-config.dtd">
5
6
<configuration>
7
    <settings>
8
		<setting name="defaultFetchSize" value="1000" /> <!-- 结果集获取数量提示值,分批传输 -->
9
		<!-- 当没有为参数提供特定的 JDBC 类型时,为空值指定 JDBC 类型。 某些驱动需要指定列的 JDBC 类型,多数情况直接用一般类型即可,比如 NULL、VARCHAR 或 OTHER。mybatis缺省为OTHER -->
10
		<setting name="jdbcTypeForNull" value="NULL" />
11
	</settings>
12
    <plugins>
13
        <!-- 分页插件,可根据参数定制化 -->
14
	    <plugin interceptor="com.github.pagehelper.PageInterceptor"></plugin>
15
	</plugins>
16
	<environments default="test">
17
		<environment id="auth">
18
			<transactionManager type="jdbc" />
19
			<dataSource type="com.ai.ipu.database.datasource.DruidDataSourceFactory">
20
				<property name="jdbcUrl" value="jdbc:mysql://127.0.0.1:3307/auth" />
21
				<property name="username" value="root" />
22
				<property name="password" value="rootroot" />
23
				<!-- 配置获取连接的等待超时时间 -->
24
				<property name="maxWait" value="5000" />
25
			</dataSource>
26
		</environment>
27
	</environments>
28
</configuration>

+ 15 - 0
qb-auth-server/src/main/resources/dev/log4j2.xml

@ -0,0 +1,15 @@
1
<?xml version="1.0" encoding="UTF-8"?>
2
<Configuration status="WARN">
3
    <Appenders>
4
        <Console name="Console" target="SYSTEM_OUT">
5
            <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
6
        </Console>
7
    </Appenders>
8
    <Loggers>
9
        <Root level="ERROR">
10
            <AppenderRef ref="Console"/>
11
        </Root>
12
        <logger name="com.ai" level="DEBUG"></logger>
13
        <logger name="org" level="ERROR"></logger>
14
    </Loggers>
15
</Configuration>

+ 43 - 0
qb-auth-server/src/main/resources/dev/menu.json

@ -0,0 +1,43 @@
1
[
2
  {
3
    "id": "1",
4
    "name": "帮助ReadMe",
5
    "path": "/help",
6
    "icon": "aid-help-circle",
7
    "type": "R",
8
    "remark": "",
9
    "subMenu": []
10
  },
11
  {
12
    "id": "2",
13
    "name": "百度",
14
    "path": "/iframe",
15
    "icon": "aid-search-web",
16
    "type": "F",
17
    "remark": "https://www.baidu.com/",
18
    "subMenu": []
19
  },
20
  {
21
    "id": "3",
22
    "name": "二级菜单",
23
    "path": "",
24
    "icon": "aid-air-conditioner",
25
    "remark": "",
26
    "subMenu": [
27
      {
28
        "id": "1",
29
        "name": "帮助ReadMe2",
30
        "path": "/help2",
31
        "type": "R",
32
        "remark": "备注"
33
      },
34
      {
35
        "id": "2",
36
        "name": "百度2",
37
        "path": "/iframe2",
38
        "type": "F",
39
        "remark": "https://www.baidu.com/"
40
      }
41
    ]
42
  }
43
]

+ 0 - 0
qb-auth-server/src/main/resources/exception_messages_zh_CN.properties


+ 99 - 0
qb-auth-server/src/main/resources/flow/menu/menu_delete.xml

@ -0,0 +1,99 @@
1
<?xml version="1.0" encoding="UTF-8"?>
2
<logic-flow id="menu_delete"
3
            name="菜单删除"
4
            desc="菜单删除">
5
    <declare>
6
        <!-- 引入model定义 -->
7
        <import model="sec_menu"/>
8
        <import model="sec_priv_entity"/>
9
    </declare>
10
11
    <start id="start" name="开始节点" next="selectMenuCount">
12
        <var key="menu_id" model="sec_menu" attr="menu_id"/>
13
    </start>
14
15
    <action id="selectMenuCount" name="查询判断" next="printParentMenu">
16
        <input>
17
            <var key="menu_id" model="sec_menu" attr="menu_id"/>
18
        </input>
19
        <sql conn="auth">
20
            <![CDATA[
21
            select menu_id, parent_menu_id from sec_menu where parent_menu_id = ${menu_id};
22
        ]]>
23
        </sql>
24
        <output>
25
            <var key="menus"/>
26
        </output>
27
    </action>
28
29
    <action id="printParentMenu" name="判断" next="menuCountCond">
30
        <expression>
31
            <![CDATA[
32
            System.out.println("parent_menu_id==="+DATABUS.menus);
33
        ]]>
34
        </expression>
35
    </action>
36
37
    <action id="menuCountCond" name="判断菜单条件" next="deleteRoleGrant">
38
        <input>
39
            <var key="menus"/>
40
        </input>
41
        <if test="menus.size>=1" interrupt="【${menu_id}】存在父级菜单无法删除!"/>
42
        <if test="menus.size==0" next="deleteRoleGrant"/>
43
    </action>
44
45
    <action id="deleteRoleGrant" name="删除角色权限" next="aggregateMenuId">
46
        <input>
47
            <var key="menu_id" model="sec_menu" attr="menu_id"/>
48
        </input>
49
        <sql conn="auth">
50
            delete from sec_role_grant where priv_ent_id in (
51
            select priv_ent_id from sec_priv_entity where busi_obj_id = ${menu_id}
52
            )
53
        </sql>
54
        <output>
55
            <var key="delete_menu_num"/>
56
        </output>
57
    </action>
58
59
    <action id="aggregateMenuId" name="聚合菜单条件" next="printPrivEntity">
60
        <input>
61
            <var key="menu_id" model="sec_menu" attr="menu_id"/>
62
        </input>
63
        <aggregate>
64
            <![CDATA[
65
            {"menu_id":"busi_obj_id"}
66
        ]]>
67
        </aggregate>
68
        <output>
69
            <var key="priv_entity"/>
70
        </output>
71
    </action>
72
73
    <action id="printPrivEntity" name="判断" next="deletePrivEntity">
74
        <expression>
75
            <![CDATA[
76
            System.out.println("priv_entity==="+DATABUS.priv_entity);
77
        ]]>
78
        </expression>
79
    </action>
80
81
    <action id="deletePrivEntity" name="删除角色授权表" next="end">
82
        <input>
83
            <var key="priv_entity" model="sec_priv_entity" attrExists="false"/>
84
        </input>
85
        <function domain="DB" name="deleteByCond">
86
            <param value="auth" type="string"/>
87
            <param value="sec_priv_entity" type="string"/>
88
            <param key="priv_entity" type="map"/>
89
            <param value="uppercase" type="string"/>
90
        </function>
91
        <output>
92
            <var key="delete_num"/>
93
        </output>
94
    </action>
95
96
    <end id="end" name="结束节点">
97
        <var key="delete_num"/>
98
    </end>
99
</logic-flow>

+ 27 - 0
qb-auth-server/src/main/resources/flow/menu/menu_insert.xml

@ -0,0 +1,27 @@
1
<?xml version="1.0" encoding="UTF-8"?>
2
<logic-flow id="menu_insert"
3
            name="菜单新增"
4
            desc="菜单新增">
5
    <declare>
6
        <!-- 引入model定义 -->
7
        <import model="sec_menu"/>
8
    </declare>
9
10
    <start id="start" name="开始节点" next="insertMenu">
11
        <var key="menu" model="sec_menu"/>
12
    </start>
13
14
    <action id="insertMenu" name="新增菜单" next="end">
15
        <input>
16
            <var key="menu"/>
17
        </input>
18
        <behavior model="sec_menu" id="insertMenu"/>
19
        <output>
20
            <var key="insert_num"/>
21
        </output>
22
    </action>
23
24
    <end id="end" name="结束节点">
25
        <var key="insert_num"/>
26
    </end>
27
</logic-flow>

+ 0 - 0
qb-auth-server/src/main/resources/flow/menu/menu_select.xml


+ 0 - 0
qb-auth-server/src/main/resources/flow/menu/menu_update.xml


+ 55 - 0
qb-auth-server/src/main/resources/flow/menu/model/sec_menu.xml

@ -0,0 +1,55 @@
1
<?xml version="1.0" encoding="UTF-8"?>
2
<model id="sec_menu" name="用户信息模型">
3
    <attr id="menu_id" type="int" name="菜单标识"/>
4
    <attr id="parent_menu_id" type="int" name="父菜单标识"/>
5
    <attr id="menu_type" type="string" name="菜单类型"/>
6
    <attr id="menu_name" type="string" name="菜单名称"/>
7
    <attr id="menu_title" type="string" name="菜单标题"/>
8
    <attr id="level" type="int" name="菜单层级"/>
9
    <attr id="menu_sort" type="int" name="菜单顺序"/>
10
    <attr id="menu_component" type="string" name="菜单组件"/>
11
    <attr id="menu_icon" type="string" name="菜单图标"/>
12
    <attr id="link_url" type="string" name="菜单链接"/>
13
    <attr id="iframe_flag" type="int" name="框架标记"/>
14
    <attr id="hidden_flag" type="int" name="隐藏标记"/>
15
    <attr id="data_status" type="string" name="数据状态"/>
16
    <attr id="create_date" type="datetime" name="创建日期"/>
17
    <attr id="done_date" type="datetime" name="操作日期"/>
18
    <attr id="op_id" type="string" name="操作人员"/>
19
    
20
    <behavior id="insertMenu" name="新增菜单信息">
21
        <function domain="DB" name="insert">
22
            <param value="auth" type="string"/>
23
            <param value="sec_menu" type="string"/>
24
            <param key="menu" type="map"/>
25
            <param value="uppercase" type="string"/>
26
        </function>
27
    </behavior>
28
29
    <behavior id="selectMenu" name="查询菜单信息">
30
        <function domain="DB" name="select">
31
            <param value="auth" type="string"/>
32
            <param value="sec_menu" type="string"/>
33
            <param key="menu" type="map"/>
34
            <param value="uppercase" type="string"/>
35
        </function>
36
    </behavior>
37
38
    <behavior id="updateMenu" name="修改菜单信息">
39
        <function domain="DB" name="update">
40
            <param value="auth" type="string"/>
41
            <param value="sec_menu" type="string"/>
42
            <param key="menu" type="map"/>
43
            <param value="uppercase" type="string"/>
44
        </function>
45
    </behavior>
46
47
    <behavior id="deletetMenu" name="删除菜单信息">
48
        <function domain="DB" name="delete">
49
            <param value="auth" type="string"/>
50
            <param value="sec_menu" type="string"/>
51
            <param key="menu" type="map"/>
52
            <param value="uppercase" type="string"/>
53
        </function>
54
    </behavior>
55
</model>

+ 57 - 0
qb-auth-server/src/main/resources/flow/menu/model/sec_priv_entity.xml

@ -0,0 +1,57 @@
1
<?xml version="1.0" encoding="UTF-8"?>
2
<model id="sec_priv_entity" name="角色关联菜单信息模型">
3
    <attr id="priv_ent_id" type="int" name="角色关联菜单标识"/>
4
    <attr id="priv_ent_name" type="string" name="菜单名称"/>
5
    <attr id="busi_obj_id" type="string" name="业务对象标识"/>
6
    <attr id="busi_obj_type" type="int" name="业务对象类型"/>
7
    <attr id="data_status" type="string" name="数据状态"/>
8
    <attr id="create_date" type="datetime" name="创建日期"/>
9
    <attr id="create_op_id" type="string" name="创建人员"/>
10
    <attr id="done_date" type="datetime" name="操作日期"/>
11
    <attr id="op_id" type="string" name="操作人员"/>
12
13
    <behavior id="insertPrivEntity" name="新增角色关联菜单信息">
14
        <function domain="DB" name="insert">
15
            <param value="auth" type="string"/>
16
            <param value="sec_priv_entity" type="string"/>
17
            <param key="priv_entity" type="map"/>
18
            <param value="uppercase" type="string"/>
19
        </function>
20
    </behavior>
21
22
    <behavior id="selectPrivEntity" name="查询角色关联菜单信息">
23
        <function domain="DB" name="select">
24
            <param value="auth" type="string"/>
25
            <param value="sec_priv_entity" type="string"/>
26
            <param key="priv_entity" type="map"/>
27
            <param value="uppercase" type="string"/>
28
        </function>
29
    </behavior>
30
31
    <behavior id="updatePrivEntity" name="修改角色关联菜单信息">
32
        <function domain="DB" name="update">
33
            <param value="auth" type="string"/>
34
            <param value="sec_priv_entity" type="string"/>
35
            <param key="priv_entity" type="map"/>
36
            <param value="uppercase" type="string"/>
37
        </function>
38
    </behavior>
39
40
    <behavior id="deletetPrivEntity" name="删除角色关联菜单信息">
41
        <function domain="DB" name="delete">
42
            <param value="auth" type="string"/>
43
            <param value="sec_priv_entity" type="string"/>
44
            <param key="priv_entity" type="map"/>
45
            <param value="uppercase" type="string"/>
46
        </function>
47
    </behavior>
48
49
    <behavior id="deletetByCondPrivEntity" name="删除角色关联菜单信息">
50
        <function domain="DB" name="deleteByCond">
51
            <param value="auth" type="string"/>
52
            <param value="sec_priv_entity" type="string"/>
53
            <param key="priv_entity" type="map"/>
54
            <param value="uppercase" type="string"/>
55
        </function>
56
    </behavior>
57
</model>

+ 0 - 0
qb-auth-server/src/main/resources/flow/menu/priv_entity_delete.xml


+ 27 - 0
qb-auth-server/src/main/resources/flow/menu/priv_entity_insert.xml

@ -0,0 +1,27 @@
1
<?xml version="1.0" encoding="UTF-8"?>
2
<logic-flow id="priv_entity_insert"
3
            name="角色关联菜单新增"
4
            desc="角色关联菜单新增">
5
    <declare>
6
        <!-- 引入model定义 -->
7
        <import model="sec_priv_entity"/>
8
    </declare>
9
10
    <start id="start" name="开始节点" next="insertPrivEntity">
11
        <var key="priv_entity" model="sec_priv_entity"/>
12
    </start>
13
14
    <action id="insertPrivEntity" name="新增角色关联菜单" next="end">
15
        <input>
16
            <var key="priv_entity"/>
17
        </input>
18
        <behavior model="sec_priv_entity" id="insertPrivEntity"/>
19
        <output>
20
            <var key="insert_num"/>
21
        </output>
22
    </action>
23
24
    <end id="end" name="结束节点">
25
        <var key="insert_num"/>
26
    </end>
27
</logic-flow>

+ 0 - 0
qb-auth-server/src/main/resources/flow/menu/priv_entity_select.xml


+ 56 - 0
qb-auth-server/src/main/resources/flow/org/model/sec_org_user_rel.xml

@ -0,0 +1,56 @@
1
<?xml version="1.0" encoding="UTF-8"?>
2
<model id="sec_org_user_rel" name="用户组织信息模型">
3
    <attr id="role_user_rel_id" type="int" name="角色关联用户标识"/>
4
    <attr id="user_id" type="int" name="用户标识"/>
5
    <attr id="role_id" type="int" name="角色标识"/>
6
    <attr id="valid_date" type="datetime" name="生效日期"/>
7
    <attr id="expire_date" type="datetime" name="失效日期"/>
8
    <attr id="data_status" type="string" name="数据状态"/>
9
    <attr id="create_date" type="datetime" name="创建日期"/>
10
    <attr id="create_op_id" type="string" name="创建人员"/>
11
    <attr id="create_org_id" type="string" name="创建组织"/>
12
    <attr id="done_code" type="datetime" name="事务编号"/>
13
    <attr id="done_date" type="datetime" name="操作日期"/>
14
    <attr id="op_id" type="string" name="操作人员"/>
15
    <attr id="org_id" type="string" name="操作组织"/>
16
    <attr id="mgmt_district" type="string" name="管理地区"/>
17
    <attr id="mgmt_county" type="string" name="管理国家"/>
18
    <attr id="region_id" type="string" name="区域ID"/>
19
    <attr id="tenant_code" type="string" name="租户编码"/>
20
21
    <behavior id="insertOrgUserRel" name="新增用户组织信息">
22
        <function domain="DB" name="insert">
23
            <param value="auth" type="string"/>
24
            <param value="sec_org_user_rel" type="string"/>
25
            <param key="org_user_rel" type="map"/>
26
            <param value="uppercase" type="string"/>
27
        </function>
28
    </behavior>
29
30
    <behavior id="selectOrgUserRel" name="查询用户组织信息">
31
        <function domain="DB" name="select">
32
            <param value="auth" type="string"/>
33
            <param value="sec_org_user_rel" type="string"/>
34
            <param key="org_user_rel" type="map"/>
35
            <param value="uppercase" type="string"/>
36
        </function>
37
    </behavior>
38
39
    <behavior id="updateOrgUserRel" name="修改用户组织信息">
40
        <function domain="DB" name="update">
41
            <param value="auth" type="string"/>
42
            <param value="sec_org_user_rel" type="string"/>
43
            <param key="org_user_rel" type="map"/>
44
            <param value="uppercase" type="string"/>
45
        </function>
46
    </behavior>
47
48
    <behavior id="deletetOrgUserRel" name="删除用户组织信息">
49
        <function domain="DB" name="delete">
50
            <param value="auth" type="string"/>
51
            <param value="sec_org_user_rel" type="string"/>
52
            <param key="org_user_rel" type="map"/>
53
            <param value="uppercase" type="string"/>
54
        </function>
55
    </behavior>
56
</model>

+ 56 - 0
qb-auth-server/src/main/resources/flow/org/model/sec_organize.xml

@ -0,0 +1,56 @@
1
<?xml version="1.0" encoding="UTF-8"?>
2
<model id="sec_organize" name="用户信息模型">
3
    <attr id="organize_id" type="int" name="组织标识"/>
4
    <attr id="organize_type" type="string" name="组织类型"/>
5
    <attr id="organize_name" type="string" name="组织名称"/>
6
    <attr id="parent_organize_id" type="int" name="父组织标识"/>
7
    <attr id="short_name" type="string" name="组织简称"/>
8
    <attr id="english_name" type="string" name="组织英文名称"/>
9
    <attr id="dept_full_id" type="int" name="部门ID"/>
10
    <attr id="dept_full_name" type="string" name="部门名称"/>
11
    <attr id="level" type="int" name="部门层级"/>
12
    <attr id="dept_leader" type="int" name="部门领导"/>
13
    <attr id="org_level" type="string" name="组织层级"/>   <!-- 1-启用,0-禁用 -->
14
    <attr id="remark" type="string" name="备注"/>
15
    <attr id="data_status" type="string" name="数据状态"/>
16
    <attr id="create_date" type="datetime" name="创建日期"/>
17
    <attr id="create_op_id" type="string" name="创建人员"/>
18
    <attr id="done_date" type="datetime" name="操作日期"/>
19
    <attr id="op_id" type="string" name="操作人员"/>
20
21
    <behavior id="insertOrganize" name="新增组织信息">
22
        <function domain="DB" name="insert">
23
            <param value="auth" type="string"/>
24
            <param value="sec_organize" type="string"/>
25
            <param key="organize" type="map"/>
26
            <param value="uppercase" type="string"/>
27
        </function>
28
    </behavior>
29
30
    <behavior id="selectOrganize" name="查询组织信息">
31
        <function domain="DB" name="select">
32
            <param value="auth" type="string"/>
33
            <param value="sec_organize" type="string"/>
34
            <param key="organize" type="map"/>
35
            <param value="uppercase" type="string"/>
36
        </function>
37
    </behavior>
38
39
    <behavior id="updateOrganize" name="修改组织信息">
40
        <function domain="DB" name="update">
41
            <param value="auth" type="string"/>
42
            <param value="sec_organize" type="string"/>
43
            <param key="organize" type="map"/>
44
            <param value="uppercase" type="string"/>
45
        </function>
46
    </behavior>
47
48
    <behavior id="deletetOrganize" name="删除组织信息">
49
        <function domain="DB" name="delete">
50
            <param value="auth" type="string"/>
51
            <param value="sec_organize" type="string"/>
52
            <param key="organize" type="map"/>
53
            <param value="uppercase" type="string"/>
54
        </function>
55
    </behavior>
56
</model>

+ 27 - 0
qb-auth-server/src/main/resources/flow/org/organize_insert.xml

@ -0,0 +1,27 @@
1
<?xml version="1.0" encoding="UTF-8"?>
2
<logic-flow id="organize_insert"
3
            name="组织新增"
4
            desc="组织新增">
5
    <declare>
6
        <!-- 引入model定义 -->
7
        <import model="sec_organize"/>
8
    </declare>
9
10
    <start id="start" name="开始节点" next="insertOrganize">
11
        <var key="organize" model="sec_organize" attrExists="false"/>
12
    </start>
13
14
    <action id="insertOrganize" name="新增组织" next="end">
15
        <input>
16
            <var key="organize"/>
17
        </input>
18
        <behavior model="sec_organize" id="insertOrganize"/>
19
        <output>
20
            <var key="insert_num"/>
21
        </output>
22
    </action>
23
24
    <end id="end" name="结束节点">
25
        <var key="insert_num"/>
26
    </end>
27
</logic-flow>

+ 27 - 0
qb-auth-server/src/main/resources/flow/org/organize_select.xml

@ -0,0 +1,27 @@
1
<?xml version="1.0" encoding="UTF-8"?>
2
<logic-flow id="organize_select"
3
            name="组织查询"
4
            desc="组织查询">
5
    <declare>
6
        <!-- 引入model定义 -->
7
        <import model="sec_organize"/>
8
    </declare>
9
10
    <start id="start" name="开始节点" next="selectOrganize">
11
        <var key="organize" model="sec_organize" attrExists="false"/>
12
    </start>
13
14
    <action id="selectOrganize" name="查询组织" next="end">
15
        <input>
16
            <var key="organize" />
17
        </input>
18
        <behavior model="sec_organize" id="selectOrganize"/>
19
        <output>
20
            <var key="organize_info"/>
21
        </output>
22
    </action>
23
24
    <end id="end" name="结束节点">
25
        <var key="organize_info"/>
26
    </end>
27
</logic-flow>

+ 0 - 0
qb-auth-server/src/main/resources/flow/org/user_role_delete.xml


+ 0 - 0
qb-auth-server/src/main/resources/flow/org/user_role_insert.xml


+ 0 - 0
qb-auth-server/src/main/resources/flow/org/user_role_select.xml


+ 48 - 0
qb-auth-server/src/main/resources/flow/role/model/sec_role.xml

@ -0,0 +1,48 @@
1
<?xml version="1.0" encoding="UTF-8"?>
2
<model id="sec_role" name="角色信息模型">
3
    <attr id="role_id" type="int" name="角色标识"/>
4
    <attr id="role_name" type="string" name="角色名称"/>
5
    <attr id="role_type" type="int" name="角色类型"/>
6
    <attr id="description" type="string" name="角色描述"/>
7
    <attr id="data_status" type="string" name="数据状态"/>
8
    <attr id="create_date" type="datetime" name="创建日期"/>
9
    <attr id="create_op_id" type="string" name="创建人员"/>
10
    <attr id="done_date" type="datetime" name="操作日期"/>
11
    <attr id="op_id" type="datetime" name="操作人员"/>
12
13
    <behavior id="insertRole" name="新增角色信息">
14
        <function domain="DB" name="insert">
15
            <param value="auth" type="string"/>
16
            <param value="sec_role" type="string"/>
17
            <param key="role" type="map"/>
18
            <param value="uppercase" type="string"/>
19
        </function>
20
    </behavior>
21
22
    <behavior id="selectRole" name="查询角色信息">
23
        <function domain="DB" name="select">
24
            <param value="auth" type="string"/>
25
            <param value="sec_role" type="string"/>
26
            <param key="role" type="map"/>
27
            <param value="uppercase" type="string"/>
28
        </function>
29
    </behavior>
30
31
    <behavior id="updateRole" name="修改角色信息">
32
        <function domain="DB" name="update">
33
            <param value="auth" type="string"/>
34
            <param value="sec_role" type="string"/>
35
            <param key="role" type="map"/>
36
            <param value="uppercase" type="string"/>
37
        </function>
38
    </behavior>
39
40
    <behavior id="deletetRole" name="删除角色信息">
41
        <function domain="DB" name="delete">
42
            <param value="auth" type="string"/>
43
            <param value="sec_role" type="string"/>
44
            <param key="role" type="map"/>
45
            <param value="uppercase" type="string"/>
46
        </function>
47
    </behavior>
48
</model>

+ 57 - 0
qb-auth-server/src/main/resources/flow/role/model/sec_role_grant.xml

@ -0,0 +1,57 @@
1
<?xml version="1.0" encoding="UTF-8"?>
2
<model id="sec_role_grant" name="角色授权信息模型">
3
    <attr id="role_grant_id" type="int" name="角色授权标识"/>
4
    <attr id="role_id" type="int" name="角色标识"/>
5
    <attr id="priv_ent_id" type="int" name="角色关联菜单标识"/>
6
    <attr id="remark" type="string" name="标注信息"/>
7
    <attr id="valid_date" type="datetime" name="生效日期"/>
8
    <attr id="expire_date" type="datetime" name="失效日期"/>
9
    <attr id="data_status" type="string" name="数据状态"/>
10
    <attr id="create_date" type="datetime" name="创建日期"/>
11
    <attr id="create_op_id" type="string" name="创建人员"/>
12
    <attr id="create_org_id" type="string" name="创建组织"/>
13
    <attr id="done_code" type="datetime"    name="操作编码"/>
14
    <attr id="done_date" type="datetime"    name="操作日期"/>
15
    <attr id="op_id" type="string" name="操作人员"/>
16
    <attr id="org_id" type="string" name="操作组织"/>
17
    <attr id="mgmt_district" type="string" name="管理地区"/>
18
    <attr id="mgmt_county" type="string" name="管理国家"/>
19
    <attr id="region_id" type="string" name="区域ID"/>
20
    <attr id="tenant_code" type="string" name="租户编码"/>
21
22
    <behavior id="insertRoleGrant" name="新增角色授权信息">
23
        <function domain="DB" name="insert">
24
            <param value="auth" type="string"/>
25
            <param value="sec_role_grant" type="string"/>
26
            <param key="role_grant" type="map"/>
27
            <param value="uppercase" type="string"/>
28
        </function>
29
    </behavior>
30
31
    <behavior id="selectRoleGrant" name="查询角色授权信息">
32
        <function domain="DB" name="select">
33
            <param value="auth" type="string"/>
34
            <param value="sec_role_grant" type="string"/>
35
            <param key="role_grant" type="map"/>
36
            <param value="uppercase" type="string"/>
37
        </function>
38
    </behavior>
39
40
    <behavior id="updateRoleGrant" name="修改角色授权信息">
41
        <function domain="DB" name="update">
42
            <param value="auth" type="string"/>
43
            <param value="sec_role_grant" type="string"/>
44
            <param key="role_grant" type="map"/>
45
            <param value="uppercase" type="string"/>
46
        </function>
47
    </behavior>
48
49
    <behavior id="deletetRoleGrant" name="删除角色授权信息">
50
        <function domain="DB" name="delete">
51
            <param value="auth" type="string"/>
52
            <param value="sec_role_grant" type="string"/>
53
            <param key="role_grant" type="map"/>
54
            <param value="uppercase" type="string"/>
55
        </function>
56
    </behavior>
57
</model>

+ 0 - 0
qb-auth-server/src/main/resources/flow/role/role_delete.xml


+ 27 - 0
qb-auth-server/src/main/resources/flow/role/role_grant_insert.xml

@ -0,0 +1,27 @@
1
<?xml version="1.0" encoding="UTF-8"?>
2
<logic-flow id="role_grant_insert"
3
            name="角色授权新增"
4
            desc="角色授权新增">
5
    <declare>
6
        <!-- 引入model定义 -->
7
        <import model="sec_role_grant"/>
8
    </declare>
9
10
    <start id="start" name="开始节点" next="insertRoleGrant">
11
        <var key="role_grant" model="sec_role_grant" attrExists="false"/>
12
    </start>
13
14
    <action id="insertRoleGrant" name="新增角色授权" next="end">
15
        <input>
16
            <var key="role_grant"/>
17
        </input>
18
        <behavior model="sec_role_grant" id="insertRoleGrant"/>
19
        <output>
20
            <var key="insert_num"/>
21
        </output>
22
    </action>
23
24
    <end id="end" name="结束节点">
25
        <var key="insert_num"/>
26
    </end>
27
</logic-flow>

+ 0 - 0
qb-auth-server/src/main/resources/flow/role/role_insert.xml


+ 0 - 0
qb-auth-server/src/main/resources/flow/role/role_select_by_cond.xml


+ 0 - 0
qb-auth-server/src/main/resources/flow/role/role_select_by_id.xml


+ 0 - 0
qb-auth-server/src/main/resources/flow/role/role_update.xml


+ 83 - 0
qb-auth-server/src/main/resources/flow/user/model/sec_user.xml

@ -0,0 +1,83 @@
1
<?xml version="1.0" encoding="UTF-8"?>
2
<model id="sec_user" name="用户信息模型">
3
    <attr id="user_id" type="int" name="用户标识"/>
4
    <attr id="nick_name" type="string" name="用户昵称">
5
    </attr>
6
    <attr id="user_account" type="string" name="用户账号"/>
7
    <attr id="gender" type="string" name="性别"/>
8
    <attr id="avatar_name" type="string" name="用户头像"/>
9
    <attr id="avatar_path" type="string" name="用户头像路径"/>
10
    <attr id="email" type="string" name="电子邮箱"/>
11
    <attr id="link_phone" type="string" name="电话号码">
12
        <validateString equal="11"/>
13
    </attr>
14
    <attr id="password" type="string" name="密码"/>
15
    <attr id="admin_flag" type="int" name="是否管理员"/>
16
    <attr id="sec_level" type="string" name="sec_level"/>
17
    <attr id="enabled_flag" type="string" name="启用状态"/>   <!-- 1-启用,0-禁用 -->
18
    <attr id="pwd_reset_time" type="string" name="密码重置次数"/>
19
    <attr id="valid_date" type="datetime" name="生效日期"/>
20
    <attr id="expire_date" type="datetime" name="失效日期"/>
21
    <attr id="data_status" type="string" name="数据状态"/>
22
    <attr id="valid_date" type="datetime" name="生效日期"/>
23
    <attr id="create_date" type="datetime" name="创建日期"/>
24
    <attr id="create_op_id" type="string" name="创建人员"/>
25
    <attr id="done_date" type="datetime"    name="操作日期"/>
26
    <attr id="op_id" type="string" name="操作人员"/>
27
28
    <behavior id="insertUser" name="新增用户信息">
29
        <function domain="DB" name="insert">
30
            <param value="auth" type="string"/>
31
            <param value="sec_user" type="string"/>
32
            <param key="user" type="map"/>
33
            <param value="uppercase" type="string"/>
34
        </function>
35
    </behavior>
36
37
    <behavior id="selectUser" name="查询用户信息">
38
        <function domain="DB" name="select">
39
            <param value="auth" type="string"/>
40
            <param value="sec_user" type="string"/>
41
            <param key="user" type="map"/>
42
            <param value="uppercase" type="string"/>
43
        </function>
44
    </behavior>
45
46
    <behavior id="selectUserByName" name="查询用户信息列表">
47
        <sql conn="auth">
48
            <![CDATA[
49
            select user_id, nick_name, surname, user_account, avatar_name, link_phone, sec_level, enabled_flag, done_date
50
            from sec_user
51
            WHERE nick_name like "%"#{nick_name}"%" and data_status = '1';
52
        ]]>
53
        </sql>
54
    </behavior>
55
56
    <behavior id="updateUser" name="修改用户信息">
57
        <function domain="DB" name="update">
58
            <param value="auth" type="string"/>
59
            <param value="sec_user" type="string"/>
60
            <param key="user" type="map"/>
61
            <param value="uppercase" type="string"/>
62
        </function>
63
    </behavior>
64
65
    <behavior id="deletetUser" name="删除用户信息">
66
        <function domain="DB" name="delete">
67
            <param value="auth" type="string"/>
68
            <param value="sec_user" type="string"/>
69
            <param key="user" type="map"/>
70
            <param value="uppercase" type="string"/>
71
        </function>
72
    </behavior>
73
74
    <behavior id="updateUserByCond" name="根据条件修改用户信息">
75
        <function domain="DB" name="updateByCond">
76
            <param value="auth" type="string"/>
77
            <param value="sec_user" type="string"/>
78
            <param key="user" type="map"/>
79
            <param key="user_cond" type="map"/>
80
            <param value="uppercase" type="string"/>
81
        </function>
82
    </behavior>
83
</model>

+ 53 - 0
qb-auth-server/src/main/resources/flow/user/user_disable_with_aggregate.xml

@ -0,0 +1,53 @@
1
<?xml version="1.0" encoding="UTF-8"?>
2
<logic-flow id="user_disable_with_aggregate"
3
            name="用户禁用"
4
            desc="用户禁用">
5
    <declare>
6
        <!-- 引入model定义 -->
7
        <import model="sec_user"/>
8
        <attr id="done_date" type="datetime">
9
            <validateDatetime nullable="false"/>
10
        </attr>
11
    </declare>
12
13
    <start id="start" name="开始节点" next="aggregateUser">
14
        <var key="user_id" model="sec_user" attr="user_id"/>
15
    </start>
16
17
    <action id="aggregateUser" name="聚合用户信息" next="aggregateUserCond">
18
        <input>
19
            <var key="user_id" model="sec_user" attr="user_id"/>
20
        </input>
21
        <aggregate />
22
        <output>
23
            <var key="user_cond"/>
24
        </output>
25
    </action>
26
27
    <action id="aggregateUserCond" name="聚合用户信息" next="disableUser">
28
        <input>
29
            <var key="enabled_flag" model="sec_user" attr="enabled_flag" initial="0"/>
30
            <var key="done_date" model="sec_user" attr="done_date" initialMethod="getDatetime"/>
31
            <var key="op_id" model="sec_user" attr="op_id" initial="1"/>
32
        </input>
33
        <aggregate />
34
        <output>
35
            <var key="user"/>
36
        </output>
37
    </action>
38
39
    <action id="disableUser" name="禁用用户" next="end">
40
        <input>
41
            <var key="user" model="sec_user" attrExists="false"/>
42
            <var key="user_cond" model="sec_user" attrExists="false"/>
43
        </input>
44
        <behavior model="sec_user" id="updateUserByCond"/>
45
        <output>
46
            <var key="update_num"/>
47
        </output>
48
    </action>
49
50
    <end id="end" name="结束节点">
51
        <var key="update_num"/>
52
    </end>
53
</logic-flow>

+ 43 - 0
qb-auth-server/src/main/resources/flow/user/user_insert.xml

@ -0,0 +1,43 @@
1
<?xml version="1.0" encoding="UTF-8"?>
2
<logic-flow id="user_insert"
3
            name="用户新增"
4
            desc="用户新增">
5
    <declare>
6
        <!-- 引入model定义 -->
7
        <import model="sec_user"/>
8
    </declare>
9
10
    <start id="start" name="开始节点" next="insertUser">
11
        <var key="user" model="sec_user"/>
12
    </start>
13
14
    <!--<action id="aggregateUser" name="聚合用户信息" next="insertUser">
15
        <input>
16
            <var key="user_id" />
17
            <var key="user_name"/>
18
            <var key="gender" />
19
            <var key="user_state"/>
20
            <var key="email" />
21
            <var key="link_phone"/>
22
            <var key="valid_date" initialMethod="getDatetime"/>
23
        </input>
24
        <aggregate />
25
        <output>
26
            <var key="user_param"/>
27
        </output>
28
    </action>-->
29
30
    <action id="insertUser" name="新增用户" next="end">
31
        <input>
32
            <var key="user"/>
33
        </input>
34
        <behavior model="sec_user" id="insertUser"/>
35
        <output>
36
            <var key="insert_num"/>
37
        </output>
38
    </action>
39
40
    <end id="end" name="结束节点">
41
        <var key="insert_num"/>
42
    </end>
43
</logic-flow>

+ 27 - 0
qb-auth-server/src/main/resources/flow/user/user_select.xml

@ -0,0 +1,27 @@
1
<?xml version="1.0" encoding="UTF-8"?>
2
<logic-flow id="user_select"
3
            name="用户查询"
4
            desc="用户查询">
5
    <declare>
6
        <!-- 引入model定义 -->
7
        <import model="sec_user"/>
8
    </declare>
9
10
    <start id="start" name="开始节点" next="selectUser">
11
        <var key="user" model="sec_user" attrExists="false"/>
12
    </start>
13
14
    <action id="selectUser" name="查询用户" next="end">
15
        <input>
16
            <var key="user" />
17
        </input>
18
        <behavior model="sec_user" id="selectUser"/>
19
        <output>
20
            <var key="user_info"/>
21
        </output>
22
    </action>
23
24
    <end id="end" name="结束节点">
25
        <var key="user_info"/>
26
    </end>
27
</logic-flow>

+ 37 - 0
qb-auth-server/src/main/resources/flow/user/user_select_by_id.xml

@ -0,0 +1,37 @@
1
<?xml version="1.0" encoding="UTF-8"?>
2
<logic-flow id="user_select_by_id"
3
            name="用户查询"
4
            desc="用户查询">
5
    <declare>
6
        <!-- 引入model定义 -->
7
        <import model="sec_user"/>
8
    </declare>
9
10
    <start id="start" name="开始节点" next="aggregateUser">
11
        <var key="user_id" model="sec_user" attr="user_id"/>
12
    </start>
13
14
    <action id="aggregateUser" name="聚合用户信息" next="selectUser">
15
        <input>
16
            <var key="user_id" />
17
        </input>
18
        <aggregate />
19
        <output>
20
            <var key="user"/>
21
        </output>
22
    </action>
23
24
    <action id="selectUser" name="查询用户" next="end">
25
        <input>
26
            <var key="user" model="sec_user" attrExists="false"/>
27
        </input>
28
        <behavior model="sec_user" id="selectUser"/>
29
        <output>
30
            <var key="user_info"/>
31
        </output>
32
    </action>
33
34
    <end id="end" name="结束节点">
35
        <var key="user_info"/>
36
    </end>
37
</logic-flow>

+ 27 - 0
qb-auth-server/src/main/resources/flow/user/user_select_by_name.xml

@ -0,0 +1,27 @@
1
<?xml version="1.0" encoding="UTF-8"?>
2
<logic-flow id="user_select_by_name"
3
            name="查询用户列表"
4
            desc="查询用户列表">
5
    <declare>
6
        <!-- 引入model定义 -->
7
        <import model="sec_user"/>
8
    </declare>
9
10
    <start id="start" name="开始节点" next="selectUserByName">
11
        <var key="nick_name" model="sec_user" attr="nick_name"/>
12
    </start>
13
14
    <action id="selectUserByName" name="根据用户名查询用户" next="end">
15
        <input>
16
            <var key="nick_name" model="sec_user" attr="nick_name"/>
17
        </input>
18
        <behavior model="sec_user" id="selectUserByName"/>
19
        <output>
20
            <var key="user_list"/>
21
        </output>
22
    </action>
23
24
    <end id="end" name="结束节点">
25
        <var key="user_list"/>
26
    </end>
27
</logic-flow>

+ 29 - 0
qb-auth-server/src/main/resources/flow/user/user_update.xml

@ -0,0 +1,29 @@
1
<?xml version="1.0" encoding="UTF-8"?>
2
<logic-flow id="user_update"
3
            name="用户启用"
4
            desc="用户启用">
5
    <declare>
6
        <!-- 引入model定义 -->
7
        <import model="sec_user"/>
8
    </declare>
9
10
    <start id="start" name="开始节点" next="updateUser">
11
        <var key="user" model="sec_user" attrExists="false"/>
12
        <var key="user_cond" model="sec_user" attrExists="false"/>
13
    </start>
14
15
    <action id="updateUser" name="启用用户" next="end">
16
        <input>
17
            <var key="user" model="sec_user" attrExists="false"/>
18
            <var key="user_cond" model="sec_user" attrExists="false"/>
19
        </input>
20
        <behavior model="sec_user" id="updateUserByCond"/>
21
        <output>
22
            <var key="update_num"/>
23
        </output>
24
    </action>
25
26
    <end id="end" name="结束节点">
27
        <var key="update_num"/>
28
    </end>
29
</logic-flow>

+ 15 - 0
qb-auth-server/src/main/resources/ipu-spring-mvc.xml

@ -0,0 +1,15 @@
1
<?xml version="1.0" encoding="UTF-8"?>
2
<beans xmlns="http://www.springframework.org/schema/beans"
3
	   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
	   xmlns:context="http://www.springframework.org/schema/context"
5
	   xmlns:mvc="http://www.springframework.org/schema/mvc"
6
	   xsi:schemaLocation="http://www.springframework.org/schema/beans
7
           http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
8
           http://www.springframework.org/schema/context  
9
        http://www.springframework.org/schema/context/spring-context-3.0.xsd
10
        http://www.springframework.org/schema/mvc
11
		http://www.springframework.org/schema/mvc/spring-mvc.xsd">
12
13
    <context:component-scan base-package="com.ipu.logicflow.server" />
14
    <context:component-scan base-package="com.ai.ipu.portal" />
15
</beans>

+ 54 - 0
qb-auth-server/src/main/resources/pro/application.yml

@ -0,0 +1,54 @@
1
#一、context-path配置的版本差异
2
#2.x:server.servlet.context-path=/ipu
3
#1.x:server.context-path=/ipu
4
#二、默认:server.servlet-path=/
5
server:
6
  servlet:
7
    context-path: /ipu
8
  #通过启动命令传参指定端口
9
  port: unknown
10
spring:
11
  application:
12
    #使用maven中的变量project.artifactId
13
    name: ${project.artifactId}
14
  mvc:
15
    #无拦截
16
    static-path-pattern: /**
17
  resources:
18
    static-locations: classpath:/${web.root}
19
  session:
20
    #session使用redis
21
    store-type: redis
22
  #sba监控
23
  boot:
24
    admin:
25
      client:
26
        metadata:
27
          user:
28
            name: ${security.user.name}
29
            password: ${security.user.password}
30
      url: http://www.aiipu.com:8888
31
  #redis集群和连接池相关配置
32
  redis:
33
    cluster:
34
      max-redirects: 3
35
      nodes: 123.57.35.51:11001,123.57.35.51:11002,123.57.35.51:11003,123.57.35.51:11004,123.57.35.51:11005,123.57.35.51:11006
36
      timeout: 5
37
    password: ipu
38
    pool:
39
      max-active: 8
40
      max-idle: 8
41
      max-wait: -1
42
      #默认0,不回收
43
      min-idle: 8
44
web:
45
  root: webapp/
46
logging:
47
  file: target/logs/${project.artifactId}.log
48
management:
49
  security:
50
    enabled: false
51
security:
52
  user:
53
    name: ipu
54
    password: ipu

+ 41 - 0
qb-auth-server/src/main/resources/pro/ipu-mybatis-config.xml

@ -0,0 +1,41 @@
1
<?xml version="1.0" encoding="UTF-8" ?>
2
<!DOCTYPE configuration
3
    PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
4
    "http://mybatis.org/dtd/mybatis-3-config.dtd">
5
6
<configuration>
7
    <settings>
8
		<setting name="defaultFetchSize" value="1000" /> <!-- 结果集获取数量提示值,分批传输 -->
9
		<!-- 当没有为参数提供特定的 JDBC 类型时,为空值指定 JDBC 类型。 某些驱动需要指定列的 JDBC 类型,多数情况直接用一般类型即可,比如 NULL、VARCHAR 或 OTHER。mybatis缺省为OTHER -->
10
		<setting name="jdbcTypeForNull" value="NULL" />
11
	</settings>
12
    <plugins>
13
        <!-- 分页插件,可根据参数定制化 -->
14
	    <plugin interceptor="com.github.pagehelper.PageInterceptor">
15
	        <!-- config params as the following -->
16
		</plugin>
17
	</plugins>
18
	<environments default="test">
19
		<environment id="test">
20
			<transactionManager type="JDBC" />
21
			<dataSource type="com.ai.ipu.database.datasource.C3P0DataSourceFactory">
22
				<property name="driverClass" value="com.mysql.jdbc.Driver" />
23
				<property name="jdbcUrl" value="jdbc:mysql://121.42.183.206:3307/test" />
24
				<property name="user" value="ipu" />
25
				<property name="password" value="ipumysql" />
26
				<!-- 连接池用完时,等待获取新连接的时间 (毫秒) -->
27
				<property name="checkoutTimeout" value="5000" />
28
				<!--定义在从数据库获取新连接失败后重复尝试的次数。Default: 30 -->
29
				<property name="acquireRetryAttempts" value="5" />
30
				<!--两次连接中间隔时间,单位毫秒。Default: 1000 -->
31
				<property name="acquireRetryDelay" value="1000" />
32
				<property name="initialPoolSize" value="3" />
33
				<property name="minPoolSize" value="3" />
34
				<property name="maxPoolSize" value="3" />
35
				<property name="maxIdleTime" value="600" />
36
				<property name="idleConnectionTestPeriod" value="60" />
37
				<property name="preferredTestQuery" value="SELECT 1" />
38
			</dataSource>
39
		</environment>
40
	</environments>
41
</configuration>

+ 14 - 0
qb-auth-server/src/main/resources/pro/log4j2.xml

@ -0,0 +1,14 @@
1
<?xml version="1.0" encoding="UTF-8"?>
2
<Configuration status="WARN">
3
    <Appenders>
4
        <Console name="Console" target="SYSTEM_OUT">
5
            <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
6
        </Console>
7
    </Appenders>
8
    <Loggers>
9
        <Root level="ERROR">
10
            <AppenderRef ref="Console"/>
11
        </Root>
12
        <logger name="com.ai" level="DEBUG"></logger>
13
    </Loggers>
14
</Configuration>

+ 54 - 0
qb-auth-server/src/main/resources/test/application.yml

@ -0,0 +1,54 @@
1
#一、context-path配置的版本差异
2
#2.x:server.servlet.context-path=/ipu
3
#1.x:server.context-path=/ipu
4
#二、默认:server.servlet-path=/
5
server:
6
  servlet:
7
    context-path: /ipu
8
  #通过启动命令传参指定端口
9
  port: unknown
10
spring:
11
  application:
12
    #使用maven中的变量project.artifactId
13
    name: ${project.artifactId}
14
  mvc:
15
    #无拦截
16
    static-path-pattern: /**
17
  resources:
18
    static-locations: classpath:/${web.root}
19
  session:
20
    #session使用redis
21
    store-type: redis
22
  #sba监控
23
  boot:
24
    admin:
25
      client:
26
        metadata:
27
          user:
28
            name: ${security.user.name}
29
            password: ${security.user.password}
30
      url: http://www.aiipu.com:8888
31
  #redis集群和连接池相关配置
32
  redis:
33
    cluster:
34
      max-redirects: 3
35
      nodes: 47.105.160.21:7101,47.105.160.21:7102,47.105.160.21:7103
36
      timeout: 5
37
    password: ipu
38
    pool:
39
      max-active: 8
40
      max-idle: 8
41
      max-wait: -1
42
      #默认0,不回收
43
      min-idle: 8
44
web:
45
  root: webapp/
46
logging:
47
  file: target/logs/${project.artifactId}.log
48
management:
49
  security:
50
    enabled: false
51
security:
52
  user:
53
    name: ipu
54
    password: ipu

+ 41 - 0
qb-auth-server/src/main/resources/test/ipu-mybatis-config.xml

@ -0,0 +1,41 @@
1
<?xml version="1.0" encoding="UTF-8" ?>
2
<!DOCTYPE configuration
3
    PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
4
    "http://mybatis.org/dtd/mybatis-3-config.dtd">
5
6
<configuration>
7
    <settings>
8
		<setting name="defaultFetchSize" value="1000" /> <!-- 结果集获取数量提示值,分批传输 -->
9
		<!-- 当没有为参数提供特定的 JDBC 类型时,为空值指定 JDBC 类型。 某些驱动需要指定列的 JDBC 类型,多数情况直接用一般类型即可,比如 NULL、VARCHAR 或 OTHER。mybatis缺省为OTHER -->
10
		<setting name="jdbcTypeForNull" value="NULL" />
11
	</settings>
12
    <plugins>
13
        <!-- 分页插件,可根据参数定制化 -->
14
	    <plugin interceptor="com.github.pagehelper.PageInterceptor">
15
	        <!-- config params as the following -->
16
		</plugin>
17
	</plugins>
18
	<environments default="test">
19
		<environment id="test">
20
			<transactionManager type="JDBC" />
21
			<dataSource type="com.ai.ipu.database.datasource.C3P0DataSourceFactory">
22
				<property name="driverClass" value="com.mysql.jdbc.Driver" />
23
				<property name="jdbcUrl" value="jdbc:mysql://121.42.183.206:3307/test" />
24
				<property name="user" value="ipu" />
25
				<property name="password" value="ipumysql" />
26
				<!-- 连接池用完时,等待获取新连接的时间 (毫秒) -->
27
				<property name="checkoutTimeout" value="5000" />
28
				<!--定义在从数据库获取新连接失败后重复尝试的次数。Default: 30 -->
29
				<property name="acquireRetryAttempts" value="5" />
30
				<!--两次连接中间隔时间,单位毫秒。Default: 1000 -->
31
				<property name="acquireRetryDelay" value="1000" />
32
				<property name="initialPoolSize" value="3" />
33
				<property name="minPoolSize" value="3" />
34
				<property name="maxPoolSize" value="3" />
35
				<property name="maxIdleTime" value="600" />
36
				<property name="idleConnectionTestPeriod" value="60" />
37
				<property name="preferredTestQuery" value="SELECT 1" />
38
			</dataSource>
39
		</environment>
40
	</environments>
41
</configuration>

+ 14 - 0
qb-auth-server/src/main/resources/test/log4j2.xml

@ -0,0 +1,14 @@
1
<?xml version="1.0" encoding="UTF-8"?>
2
<Configuration status="WARN">
3
    <Appenders>
4
        <Console name="Console" target="SYSTEM_OUT">
5
            <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
6
        </Console>
7
    </Appenders>
8
    <Loggers>
9
        <Root level="ERROR">
10
            <AppenderRef ref="Console"/>
11
        </Root>
12
        <logger name="com.ai" level="DEBUG"></logger>
13
    </Loggers>
14
</Configuration>

+ 91 - 0
qb-auth-server/src/test/java/com/ipu/logicflow/server/MenuTest.java

@ -0,0 +1,91 @@
1
package com.ipu.logicflow.server;
2
3
import com.ai.ipu.data.JMap;
4
import com.ai.ipu.data.impl.JsonMap;
5
import com.alibaba.fastjson.JSONObject;
6
import com.nuosi.flow.logic.LogicFlowEngine;
7
import com.nuosi.flow.logic.inject.initial.InitialMethod;
8
import com.nuosi.flow.util.LogicFlowUtil;
9
import org.junit.Assert;
10
import org.junit.Before;
11
import org.junit.Test;
12
13
import java.io.IOException;
14
15
/**
16
 * <p>desc: 菜单对象逻辑的测试 </p>
17
 * <p>date: 2022/3/18 22:10 </p>
18
 *
19
 * @author nuosi fsofs@163.com
20
 * @version v1.0.0
21
 */
22
public class MenuTest {
23
24
    @Test
25
    public void testInsertMenu(){
26
        JMap result = null;
27
        try {
28
            JMap param = new JsonMap();
29
            param.put("menu", new JSONObject(createMenu()));
30
            result = LogicFlowEngine.execute("menu_insert", param, false);
31
            System.out.println("执行结果:" + result);
32
            Assert.assertEquals("新增菜单信息失败!", result.getInt("insert_num"), 1);
33
        } catch (Exception e) {
34
            System.out.println("错误信息:" + e.getMessage());
35
            Assert.assertTrue(false);
36
        }
37
    }
38
39
    @Test
40
    public void testDeleteMenu(){
41
        JMap result = null;
42
        try {
43
            JMap param = new JsonMap();
44
            param.put("menu_id", 4);
45
            result = LogicFlowEngine.execute("menu_delete", param, false);
46
            System.out.println("执行结果:" + result);
47
            Assert.assertEquals("删除菜单信息失败!", result.getInt("delete_num"), 1);
48
        } catch (Exception e) {
49
            System.out.println("错误信息:" + e.getMessage());
50
            Assert.assertTrue(false);
51
        }
52
    }
53
54
    @Before
55
    public void before() throws IOException {
56
        String[] models = {
57
                "flow/menu/model/sec_menu.xml",
58
                "flow/menu/model/sec_priv_entity.xml"
59
        };
60
        LogicFlowUtil.loadLogicModels(models);
61
62
        String[] flows = {
63
                "flow/menu/menu_insert.xml",
64
                "flow/menu/menu_delete.xml"
65
        };
66
67
        LogicFlowUtil.loadLogicFlows(flows);
68
    }
69
70
    private JMap createMenu() throws Exception {
71
        String menu_id = String.valueOf(System.currentTimeMillis()).substring(7);
72
        JMap menuParam = new JsonMap();
73
        menuParam.put("menu_id", menu_id);
74
        menuParam.put("parent_menu_id", "1");
75
        menuParam.put("menu_type", "2");
76
        menuParam.put("menu_name", "系统管理");
77
        menuParam.put("menu_title", "1");
78
        menuParam.put("level", "1");
79
        menuParam.put("menu_sort", "1");
80
        menuParam.put("menu_component", "md-home");
81
        menuParam.put("menu_icon", "/sys");
82
        menuParam.put("link_url", null);
83
        menuParam.put("iframe_flag", "0");
84
        menuParam.put("hidden_flag", "1");
85
        menuParam.put("data_status", "1");
86
        menuParam.put("create_date", new InitialMethod().getDatetime());
87
        menuParam.put("done_date", new InitialMethod().getDatetime());
88
        menuParam.put("op_id", "1");
89
        return menuParam;
90
    }
91
}

+ 93 - 0
qb-auth-server/src/test/java/com/ipu/logicflow/server/OrganizeTest.java

@ -0,0 +1,93 @@
1
package com.ipu.logicflow.server;
2
3
import com.ai.ipu.data.JMap;
4
import com.ai.ipu.data.impl.JsonMap;
5
import com.alibaba.fastjson.JSONObject;
6
import com.nuosi.flow.logic.LogicFlowEngine;
7
import com.nuosi.flow.logic.inject.initial.InitialMethod;
8
import com.nuosi.flow.util.LogicFlowUtil;
9
import org.junit.Assert;
10
import org.junit.Before;
11
import org.junit.Test;
12
13
import java.io.IOException;
14
15
/**
16
 * <p>desc: 组织对象逻辑的测试 </p>
17
 * <p>date: 2022/3/13 10:53 </p>
18
 *
19
 * @author nuosi fsofs@163.com
20
 * @version v1.0.0
21
 */
22
public class OrganizeTest {
23
24
    @Test
25
    public void testInsertOrganize(){
26
        JMap result = null;
27
        try {
28
            JMap param = new JsonMap();
29
            param.put("organize", new JSONObject(createOrganize()));
30
            result = LogicFlowEngine.execute("organize_insert", param);
31
            System.out.println("执行结果:" + result);
32
            Assert.assertEquals("新增组织信息失败!", result.getInt("insert_num"), 1);
33
        } catch (Exception e) {
34
            System.out.println("错误信息:" + e.getMessage());
35
            Assert.assertTrue(false);
36
        }
37
    }
38
39
    @Test
40
    public void testSelectOrganize() {
41
        JMap param = new JsonMap();
42
        JSONObject organize = new JSONObject();
43
        organize.put("organize_id", "33");
44
        param.put("organize", organize);
45
        try{
46
            JMap result = LogicFlowEngine.execute("organize_select", param);
47
            System.out.println("执行结果:" + result);
48
            Assert.assertTrue(true);
49
        }catch (Exception e){
50
            e.printStackTrace();
51
            System.out.println("错误信息:" + e.getMessage());
52
            Assert.assertTrue(false);
53
        }
54
    }
55
56
    @Before
57
    public void before() throws IOException {
58
        String[] models = {
59
                "flow/org/model/sec_organize.xml"
60
        };
61
        LogicFlowUtil.loadLogicModels(models);
62
63
        String[] flows = {
64
                "flow/org/organize_insert.xml",
65
                "flow/org/organize_select.xml"
66
        };
67
68
        LogicFlowUtil.loadLogicFlows(flows);
69
    }
70
71
    private JMap createOrganize() throws Exception {
72
        String organize_id = String.valueOf(System.currentTimeMillis()).substring(7);
73
        JMap userParam = new JsonMap();
74
        userParam.put("organize_id", organize_id);
75
        userParam.put("organize_type", "0");
76
        userParam.put("organize_name", "亚信科技有限责任公司");
77
        userParam.put("parent_organize_id", "0");
78
        userParam.put("short_name", "亚信科技");
79
        userParam.put("english_name", "asiainfo");
80
        userParam.put("dept_full_id", "1");
81
        userParam.put("dept_full_name", "亚信科技");
82
        userParam.put("level", 1);
83
        userParam.put("dept_leader", 1);
84
        userParam.put("org_level", "1");
85
        userParam.put("remark", "NULL");
86
        userParam.put("data_status", "1");
87
        userParam.put("create_date", "2022-1-10 16:09:12");
88
        userParam.put("create_op_id", "1");
89
        userParam.put("done_date", new InitialMethod().getDatetime());
90
        userParam.put("op_id", new InitialMethod().getDatetime());
91
        return userParam;
92
    }
93
}

+ 67 - 0
qb-auth-server/src/test/java/com/ipu/logicflow/server/PrivEntityTest.java

@ -0,0 +1,67 @@
1
package com.ipu.logicflow.server;
2
3
import com.ai.ipu.data.JMap;
4
import com.ai.ipu.data.impl.JsonMap;
5
import com.alibaba.fastjson.JSONObject;
6
import com.nuosi.flow.logic.LogicFlowEngine;
7
import com.nuosi.flow.logic.inject.initial.InitialMethod;
8
import com.nuosi.flow.util.LogicFlowUtil;
9
import org.junit.Assert;
10
import org.junit.Before;
11
import org.junit.Test;
12
13
import java.io.IOException;
14
15
/**
16
 * <p>desc: 角色关联菜单对象逻辑的测试 </p>
17
 * <p>date: 2022/3/18 23:19 </p>
18
 *
19
 * @author nuosi fsofs@163.com
20
 * @version v1.0.0
21
 */
22
public class PrivEntityTest {
23
24
    @Test
25
    public void testInsertPrivEntity(){
26
        JMap result = null;
27
        try {
28
            JMap param = new JsonMap();
29
            param.put("priv_entity", new JSONObject(createPrivEntity()));
30
            result = LogicFlowEngine.execute("priv_entity_insert", param);
31
            System.out.println("执行结果:" + result);
32
            Assert.assertEquals("新增角色关联菜单信息失败!", result.getInt("insert_num"), 1);
33
        } catch (Exception e) {
34
            System.out.println("错误信息:" + e.getMessage());
35
            Assert.assertTrue(false);
36
        }
37
    }
38
39
    @Before
40
    public void before() throws IOException {
41
        String[] models = {
42
                "flow/menu/model/sec_priv_entity.xml"
43
        };
44
        LogicFlowUtil.loadLogicModels(models);
45
46
        String[] flows = {
47
                "flow/menu/priv_entity_insert.xml",
48
        };
49
50
        LogicFlowUtil.loadLogicFlows(flows);
51
    }
52
53
    private JMap createPrivEntity() throws Exception {
54
        String priv_ent_id = String.valueOf(System.currentTimeMillis()).substring(7);
55
        JMap param = new JsonMap();
56
        param.put("priv_ent_id", priv_ent_id);
57
        param.put("priv_ent_name", "角色关联菜单范例");
58
        param.put("busi_obj_id", "4");
59
        param.put("busi_obj_type", "1");
60
        param.put("data_status", "1");
61
        param.put("create_date", new InitialMethod().getDatetime());
62
        param.put("create_op_id", "1");
63
        param.put("done_date", new InitialMethod().getDatetime());
64
        param.put("op_id", "1");
65
        return param;
66
    }
67
}

+ 66 - 0
qb-auth-server/src/test/java/com/ipu/logicflow/server/RoleGrantTest.java

@ -0,0 +1,66 @@
1
package com.ipu.logicflow.server;
2
3
import com.ai.ipu.data.JMap;
4
import com.ai.ipu.data.impl.JsonMap;
5
import com.alibaba.fastjson.JSONObject;
6
import com.nuosi.flow.logic.LogicFlowEngine;
7
import com.nuosi.flow.logic.inject.initial.InitialMethod;
8
import com.nuosi.flow.util.LogicFlowUtil;
9
import org.junit.Assert;
10
import org.junit.Before;
11
import org.junit.Test;
12
13
import java.io.IOException;
14
15
/**
16
 * <p>desc: 角色授权对象逻辑的测试 </p>
17
 * <p>date: 2022/3/18 23:03 </p>
18
 *
19
 * @author nuosi fsofs@163.com
20
 * @version v1.0.0
21
 */
22
public class RoleGrantTest {
23
24
    @Test
25
    public void testInsertRoleGrant(){
26
        JMap result = null;
27
        try {
28
            JMap param = new JsonMap();
29
            param.put("role_grant", new JSONObject(createRoleGrant()));
30
            result = LogicFlowEngine.execute("role_grant_insert", param);
31
            System.out.println("执行结果:" + result);
32
            Assert.assertEquals("新增角色授权信息失败!", result.getInt("insert_num"), 1);
33
        } catch (Exception e) {
34
            System.out.println("错误信息:" + e.getMessage());
35
            Assert.assertTrue(false);
36
        }
37
    }
38
39
    @Before
40
    public void before() throws IOException {
41
        String[] models = {
42
                "flow/role/model/sec_role_grant.xml"
43
        };
44
        LogicFlowUtil.loadLogicModels(models);
45
46
        String[] flows = {
47
                "flow/role/role_grant_insert.xml",
48
        };
49
50
        LogicFlowUtil.loadLogicFlows(flows);
51
    }
52
53
    private JMap createRoleGrant() throws Exception {
54
        String role_grant_id = String.valueOf(System.currentTimeMillis()).substring(7);
55
        JMap menuParam = new JsonMap();
56
        menuParam.put("role_grant_id", role_grant_id);
57
        menuParam.put("role_id", "1");
58
        menuParam.put("priv_ent_id", "2");
59
        menuParam.put("valid_date", new InitialMethod().getDatetime());
60
        menuParam.put("data_status", "1");
61
        menuParam.put("create_date", new InitialMethod().getDatetime());
62
        menuParam.put("done_date", new InitialMethod().getDatetime());
63
        menuParam.put("op_id", "1");
64
        return menuParam;
65
    }
66
}

+ 219 - 0
qb-auth-server/src/test/java/com/ipu/logicflow/server/UserTest.java

@ -0,0 +1,219 @@
1
package com.ipu.logicflow.server;
2
3
import com.ai.ipu.data.JMap;
4
import com.ai.ipu.data.impl.JsonMap;
5
import com.alibaba.fastjson.JSONObject;
6
import com.nuosi.flow.logic.LogicFlowEngine;
7
import com.nuosi.flow.logic.inject.initial.InitialMethod;
8
import com.nuosi.flow.util.LogicFlowUtil;
9
import org.junit.Assert;
10
import org.junit.Before;
11
import org.junit.Test;
12
13
import java.io.IOException;
14
import java.util.List;
15
16
/**
17
 * <p>desc: 用户对象逻辑的测试 </p>
18
 * <p>date: 2022/1/18 19:43 </p>
19
 *
20
 * @author nuosi fsofs@163.com
21
 * @version v1.0.0
22
 */
23
public class UserTest {
24
25
    @Test
26
    public void testInsertUser(){
27
        JMap result = null;
28
        try {
29
            JMap param = new JsonMap();
30
            param.put("user", new JSONObject(createUser()));
31
            result = LogicFlowEngine.execute("user_insert", param);
32
            System.out.println("执行结果:" + result);
33
            Assert.assertEquals("新增用户信息失败!", result.getInt("insert_num"), 1);
34
        } catch (Exception e) {
35
            System.out.println("错误信息:" + e.getMessage());
36
            Assert.assertTrue(false);
37
        }
38
    }
39
40
    @Test
41
    public void testSelectUser() {
42
        JMap param = new JsonMap();
43
        JSONObject user = new JSONObject();
44
        user.put("user_id", "331843");
45
        param.put("user", user);
46
        try{
47
            JMap result = LogicFlowEngine.execute("user_select", param);
48
            System.out.println("执行结果:" + result);
49
            Assert.assertTrue(true);
50
        }catch (Exception e){
51
            e.printStackTrace();
52
            System.out.println("错误信息:" + e.getMessage());
53
            Assert.assertTrue(false);
54
        }
55
    }
56
57
    @Test
58
    public void testSelectUserById() {
59
        JMap param = new JsonMap();
60
        param.put("user_id", "331843");
61
        try{
62
            JMap result = LogicFlowEngine.execute("user_select_by_id", param);
63
            System.out.println("执行结果:" + result);
64
            Assert.assertTrue(true);
65
        }catch (Exception e){
66
            System.out.println("错误信息:" + e.getMessage());
67
            Assert.assertTrue(false);
68
        }
69
    }
70
71
    @Test
72
    public void testSelectUserByName() throws Exception {
73
        JMap param = new JsonMap();
74
        param.put("nick_name", "嘉信立恒");
75
76
        try{
77
            JMap result = LogicFlowEngine.execute("user_select_by_name", param);
78
            System.out.println("执行结果:" + result);
79
            Assert.assertTrue("查询用户列表失败!", ((List)result.get("user_list")).size()>=1);
80
        }catch (Exception e){
81
            System.out.println("错误信息:" + e.getMessage());
82
            Assert.assertTrue(false);
83
        }
84
    }
85
86
    @Test
87
    public void testDisableUser(){
88
        String user_id = "331843";
89
        JSONObject user_cond = new JSONObject();
90
        user_cond.put("user_id", user_id);
91
92
        JSONObject user = new JSONObject();
93
        user.put("enabled_flag", "0");
94
        user.put("done_date", new InitialMethod().getDatetime());
95
        user.put("op_id", "1");
96
97
        JMap param = new JsonMap();
98
        param.put("user_cond", user_cond);
99
        param.put("user", user);
100
        try{
101
            JMap result = LogicFlowEngine.execute("user_update", param);
102
            System.out.println("执行结果:" + result);
103
            Assert.assertTrue(true);
104
105
            // 还原数据
106
            user.put("enabled_flag", "1");
107
            user.put("op_id", user_id);
108
            param.put("user", user);
109
            LogicFlowEngine.execute("user_update", param);
110
        }catch (Exception e){
111
            e.printStackTrace();
112
            System.out.println("错误信息:" + e.getMessage());
113
            Assert.assertTrue(false);
114
        }
115
    }
116
117
    @Test
118
    public void testDisableUserWithAggregate(){
119
        String user_id = "331843";
120
        JMap param = new JsonMap();
121
        param.put("user_id", user_id);
122
        try{
123
            JMap result = LogicFlowEngine.execute("user_disable_with_aggregate", param);
124
            System.out.println("执行结果:" + result);
125
            Assert.assertTrue(true);
126
127
            // 还原数据
128
            JSONObject user = new JSONObject();
129
            user.put("enabled_flag", "1");
130
            user.put("op_id", user_id);
131
            param.put("user", user);
132
133
            JSONObject user_cond = new JSONObject();
134
            user_cond.put("user_id", user_id);
135
            param.put("user_cond", user_cond);
136
137
            LogicFlowEngine.execute("user_update", param);
138
        }catch (Exception e){
139
            e.printStackTrace();
140
            System.out.println("错误信息:" + e.getMessage());
141
            Assert.assertTrue(false);
142
        }
143
    }
144
145
    @Test
146
    public void testEnableUser(){
147
        String user_id = "331843";
148
        JSONObject user_cond = new JSONObject();
149
        user_cond.put("user_id", user_id);
150
151
        JSONObject user = new JSONObject();
152
        user.put("enabled_flag", "1");
153
        user.put("done_date", new InitialMethod().getDatetime());
154
        user.put("op_id", "1");
155
156
        JMap param = new JsonMap();
157
        param.put("user_cond", user_cond);
158
        param.put("user", user);
159
        try{
160
            JMap result = LogicFlowEngine.execute("user_update", param);
161
            System.out.println("执行结果:" + result);
162
            Assert.assertTrue(true);
163
164
            // 还原数据
165
            user.put("enabled_flag", "0");
166
            user.put("op_id", user_id);
167
            param.put("user", user);
168
            LogicFlowEngine.execute("user_update", param);
169
        }catch (Exception e){
170
            e.printStackTrace();
171
            System.out.println("错误信息:" + e.getMessage());
172
            Assert.assertTrue(false);
173
        }
174
    }
175
176
    @Before
177
    public void before() throws IOException {
178
        String[] models = {
179
                "flow/user/model/sec_user.xml"
180
        };
181
        LogicFlowUtil.loadLogicModels(models);
182
183
        String[] flows = {
184
                "flow/user/user_insert.xml",
185
                "flow/user/user_select.xml",
186
                "flow/user/user_select_by_id.xml",
187
                "flow/user/user_select_by_name.xml",
188
                "flow/user/user_update.xml",
189
                "flow/user/user_disable_with_aggregate.xml"
190
        };
191
192
        LogicFlowUtil.loadLogicFlows(flows);
193
    }
194
195
    private JMap createUser() throws Exception {
196
        String user_id = String.valueOf(System.currentTimeMillis()).substring(7);
197
        JMap userParam = new JsonMap();
198
        userParam.put("user_id", user_id);
199
        userParam.put("nick_name", "嘉信立恒管理员");
200
        userParam.put("user_account", "superadmin");
201
        userParam.put("gender", "1");
202
        userParam.put("avatar_name", "head.png");
203
        userParam.put("email", "zhangsan@163.com");
204
        userParam.put("link_phone", "13788888888");
205
        userParam.put("password", "qwerasdf");
206
        userParam.put("admin_flag", 0);
207
        userParam.put("sec_level", "4");
208
        userParam.put("enabled_flag", "1");
209
        userParam.put("pwd_reset_time", 0);
210
        userParam.put("valid_date", "2022-1-10 15:22:27");
211
        userParam.put("expire_date", "2099-12-31 15:22:32");
212
        userParam.put("data_status", "1");
213
        userParam.put("create_date", new InitialMethod().getDatetime());
214
        userParam.put("done_date", new InitialMethod().getDatetime());
215
        userParam.put("create_op_id", user_id);
216
        userParam.put("op_id", user_id);
217
        return userParam;
218
    }
219
}