Browse Source

修改包名

matianxiang 3 weeks ago
parent
commit
eae630dbe3
100 changed files with 11246 additions and 10 deletions
  1. 1 0
      .gitignore
  2. 2 6
      README.md
  3. 4 4
      docker-compose.yml
  4. 7 0
      eitc-admin/Dockerfile
  5. 0 0
      eitc-admin/db/activiti/mysql.sql
  6. 0 0
      eitc-admin/db/activiti/oracle.sql
  7. 0 0
      eitc-admin/db/activiti/postgresql.sql
  8. 0 0
      eitc-admin/db/activiti/sqlserver.sql
  9. 207 0
      eitc-admin/db/generator/mysql.sql
  10. 293 0
      eitc-admin/db/generator/oracle.sql
  11. 297 0
      eitc-admin/db/generator/postgresql.sql
  12. 209 0
      eitc-admin/db/generator/sqlserver.sql
  13. 0 0
      eitc-admin/db/generator/template/Controller.java.ftl
  14. 0 0
      eitc-admin/db/generator/template/DTO.java.ftl
  15. 0 0
      eitc-admin/db/generator/template/Dao.java.ftl
  16. 0 0
      eitc-admin/db/generator/template/Dao.xml.ftl
  17. 0 0
      eitc-admin/db/generator/template/Entity.java.ftl
  18. 0 0
      eitc-admin/db/generator/template/Excel.java.ftl
  19. 0 0
      eitc-admin/db/generator/template/Service.java.ftl
  20. 0 0
      eitc-admin/db/generator/template/ServiceImpl.java.ftl
  21. 241 0
      eitc-admin/db/generator/template/add-or-update.vue.ftl
  22. 0 0
      eitc-admin/db/generator/template/list.vue.ftl
  23. 1058 0
      eitc-admin/db/mysql.sql
  24. 1391 0
      eitc-admin/db/oracle.sql
  25. 1401 0
      eitc-admin/db/postgresql.sql
  26. 0 0
      eitc-admin/db/region_data/mysql.sql
  27. 0 0
      eitc-admin/db/region_data/oracle.sql
  28. 0 0
      eitc-admin/db/region_data/postgresql.sql
  29. 0 0
      eitc-admin/db/region_data/sqlserver.sql
  30. 1223 0
      eitc-admin/db/sqlserver.sql
  31. 232 0
      eitc-admin/pom.xml
  32. 28 0
      eitc-admin/src/main/java/com/eitc/AdminApplication.java
  33. 29 0
      eitc-admin/src/main/java/com/eitc/common/annotation/DataFilter.java
  34. 20 0
      eitc-admin/src/main/java/com/eitc/common/annotation/LogOperation.java
  35. 100 0
      eitc-admin/src/main/java/com/eitc/common/aspect/DataFilterAspect.java
  36. 102 0
      eitc-admin/src/main/java/com/eitc/common/aspect/LogOperationAspect.java
  37. 36 0
      eitc-admin/src/main/java/com/eitc/common/config/MybatisPlusConfig.java
  38. 57 0
      eitc-admin/src/main/java/com/eitc/common/config/SwaggerConfig.java
  39. 29 0
      eitc-admin/src/main/java/com/eitc/common/context/TenantContext.java
  40. 95 0
      eitc-admin/src/main/java/com/eitc/common/exception/RenExceptionHandler.java
  41. 56 0
      eitc-admin/src/main/java/com/eitc/common/handler/FieldMetaObjectHandler.java
  42. 109 0
      eitc-admin/src/main/java/com/eitc/common/interceptor/DataFilterInterceptor.java
  43. 28 0
      eitc-admin/src/main/java/com/eitc/common/interceptor/DataScope.java
  44. 65 0
      eitc-admin/src/main/java/com/eitc/common/utils/ExcelUtils.java
  45. 9 0
      eitc-admin/src/main/java/com/eitc/common/validator/group/AliyunGroup.java
  46. 9 0
      eitc-admin/src/main/java/com/eitc/common/validator/group/FastDFSGroup.java
  47. 9 0
      eitc-admin/src/main/java/com/eitc/common/validator/group/LocalGroup.java
  48. 9 0
      eitc-admin/src/main/java/com/eitc/common/validator/group/MinioGroup.java
  49. 9 0
      eitc-admin/src/main/java/com/eitc/common/validator/group/QcloudGroup.java
  50. 9 0
      eitc-admin/src/main/java/com/eitc/common/validator/group/QiniuGroup.java
  51. 27 0
      eitc-admin/src/main/java/com/eitc/modules/activiti/config/ProcessEngineConfig.java
  52. 98 0
      eitc-admin/src/main/java/com/eitc/modules/activiti/controller/ActModelController.java
  53. 214 0
      eitc-admin/src/main/java/com/eitc/modules/activiti/controller/ActProcessController.java
  54. 77 0
      eitc-admin/src/main/java/com/eitc/modules/activiti/controller/ActRunningController.java
  55. 293 0
      eitc-admin/src/main/java/com/eitc/modules/activiti/controller/ActTaskController.java
  56. 133 0
      eitc-admin/src/main/java/com/eitc/modules/activiti/controller/HistoryController.java
  57. 22 0
      eitc-admin/src/main/java/com/eitc/modules/activiti/dao/ProcessActivityDao.java
  58. 18 0
      eitc-admin/src/main/java/com/eitc/modules/activiti/dao/ProcessBizRouteDao.java
  59. 117 0
      eitc-admin/src/main/java/com/eitc/modules/activiti/demo/controller/CorrectionController.java
  60. 16 0
      eitc-admin/src/main/java/com/eitc/modules/activiti/demo/dao/CorrectionDao.java
  61. 51 0
      eitc-admin/src/main/java/com/eitc/modules/activiti/demo/dto/CorrectionDTO.java
  62. 43 0
      eitc-admin/src/main/java/com/eitc/modules/activiti/demo/entity/CorrectionEntity.java
  63. 16 0
      eitc-admin/src/main/java/com/eitc/modules/activiti/demo/service/CorrectionService.java
  64. 37 0
      eitc-admin/src/main/java/com/eitc/modules/activiti/demo/service/impl/CorrectionServiceImpl.java
  65. 53 0
      eitc-admin/src/main/java/com/eitc/modules/activiti/dto/HistoryDetailDTO.java
  66. 31 0
      eitc-admin/src/main/java/com/eitc/modules/activiti/dto/ModelDTO.java
  67. 50 0
      eitc-admin/src/main/java/com/eitc/modules/activiti/dto/ProcessActivityDTO.java
  68. 29 0
      eitc-admin/src/main/java/com/eitc/modules/activiti/dto/ProcessBizRouteAndProcessInstanceDTO.java
  69. 37 0
      eitc-admin/src/main/java/com/eitc/modules/activiti/dto/ProcessBizRouteDTO.java
  70. 69 0
      eitc-admin/src/main/java/com/eitc/modules/activiti/dto/ProcessInstanceDTO.java
  71. 27 0
      eitc-admin/src/main/java/com/eitc/modules/activiti/dto/ProcessStartDTO.java
  72. 80 0
      eitc-admin/src/main/java/com/eitc/modules/activiti/dto/TaskDTO.java
  73. 40 0
      eitc-admin/src/main/java/com/eitc/modules/activiti/entity/HistoryDetailEntity.java
  74. 37 0
      eitc-admin/src/main/java/com/eitc/modules/activiti/entity/ProcessActivityEntity.java
  75. 24 0
      eitc-admin/src/main/java/com/eitc/modules/activiti/entity/ProcessBizRouteEntity.java
  76. 30 0
      eitc-admin/src/main/java/com/eitc/modules/activiti/org/activiti/rest/editor/main/StencilsetRestResource.java
  77. 61 0
      eitc-admin/src/main/java/com/eitc/modules/activiti/org/activiti/rest/editor/model/ModelEditorJsonRestResource.java
  78. 82 0
      eitc-admin/src/main/java/com/eitc/modules/activiti/org/activiti/rest/editor/model/ModelSaveRestResource.java
  79. 290 0
      eitc-admin/src/main/java/com/eitc/modules/activiti/service/ActHistoryService.java
  80. 191 0
      eitc-admin/src/main/java/com/eitc/modules/activiti/service/ActModelService.java
  81. 206 0
      eitc-admin/src/main/java/com/eitc/modules/activiti/service/ActProcessService.java
  82. 153 0
      eitc-admin/src/main/java/com/eitc/modules/activiti/service/ActRunningService.java
  83. 558 0
      eitc-admin/src/main/java/com/eitc/modules/activiti/service/ActTaskService.java
  84. 22 0
      eitc-admin/src/main/java/com/eitc/modules/activiti/service/ActivitiService.java
  85. 19 0
      eitc-admin/src/main/java/com/eitc/modules/activiti/service/ProcessBizRouteService.java
  86. 46 0
      eitc-admin/src/main/java/com/eitc/modules/activiti/service/impl/ActivitiServiceImpl.java
  87. 47 0
      eitc-admin/src/main/java/com/eitc/modules/activiti/service/impl/ProcessBizRouteServiceImpl.java
  88. 104 0
      eitc-admin/src/main/java/com/eitc/modules/demo/controller/NewsController.java
  89. 101 0
      eitc-admin/src/main/java/com/eitc/modules/demo/controller/ProductController.java
  90. 20 0
      eitc-admin/src/main/java/com/eitc/modules/demo/dao/NewsDao.java
  91. 15 0
      eitc-admin/src/main/java/com/eitc/modules/demo/dao/ProductDao.java
  92. 19 0
      eitc-admin/src/main/java/com/eitc/modules/demo/dao/ProductParamsDao.java
  93. 46 0
      eitc-admin/src/main/java/com/eitc/modules/demo/dto/NewsDTO.java
  94. 37 0
      eitc-admin/src/main/java/com/eitc/modules/demo/dto/ProductDTO.java
  95. 25 0
      eitc-admin/src/main/java/com/eitc/modules/demo/dto/ProductParamsDTO.java
  96. 50 0
      eitc-admin/src/main/java/com/eitc/modules/demo/entity/NewsEntity.java
  97. 41 0
      eitc-admin/src/main/java/com/eitc/modules/demo/entity/ProductEntity.java
  98. 45 0
      eitc-admin/src/main/java/com/eitc/modules/demo/entity/ProductParamsEntity.java
  99. 25 0
      eitc-admin/src/main/java/com/eitc/modules/demo/service/NewsService.java
  100. 0 0
      eitc-admin/src/main/java/com/eitc/modules/demo/service/ProductParamsService.java

+ 1 - 0
.gitignore

@@ -1 +1,2 @@
1 1
 /.idea/*
2
+/*/target/

+ 2 - 6
README.md

@@ -1,9 +1,5 @@
1
-renren-security【企业版】版权声明
1
+etic-security【企业版】版权声明
2 2
 
3
-1. renren-security【企业版】已申请软件著作权,未经授权的企业或个人,请购买正版授权,否则我们会根据事态轻重追究相应法律责任。
3
+1. eitc-security【企业版】已申请软件著作权,未经授权的企业或个人,请购买正版授权,否则我们会根据事态轻重追究相应法律责任。
4 4
 2. 授权者不得擅自将源码上传到包括但不限于GitHub、Gitee、CSDN、百度网盘等互联网分享平台,不得直接对授权的产品本身进行二次转售或倒卖等,否则我们收回产品授权,并移交司法机关处理。
5 5
 3. 未经授权的任何公司及个人,无权使用、重构及二次开发,否则,我们将收集并固定相关证据,对侵权者采取一切必要的法律措施,追究侵权行为人的法律责任以维护我司的合法权益。
6
-
7
-律师声明函:
8
-![律师声明函](https://www.renren.io/res/images/lawyer_letter-1.jpg "在这里输入图片标题")
9
-![律师声明函](https://www.renren.io/res/images/lawyer_letter-2.jpg "在这里输入图片标题")

+ 4 - 4
docker-compose.yml

@@ -1,13 +1,13 @@
1 1
 version: '2'
2 2
 services:
3
-  renren-admin:
4
-    image: renren/renren-admin
3
+  eitc-admin:
4
+    image: eitc/eitc-admin
5 5
     ports:
6 6
     - "8080:8080"
7 7
     environment:
8 8
     - spring.profiles.active=dev
9
-  renren-api:
10
-    image: renren/renren-api
9
+  eitc-api:
10
+    image: eitc/eitc-api
11 11
     ports:
12 12
     - "8081:8081"
13 13
     environment:

+ 7 - 0
eitc-admin/Dockerfile

@@ -0,0 +1,7 @@
1
+FROM java:8
2
+EXPOSE 8080
3
+
4
+VOLUME /tmp
5
+ADD eitc-admin.jar /app.jar
6
+RUN bash -c 'touch /app.jar'
7
+ENTRYPOINT ["java","-jar","/app.jar"]

renren-admin/db/activiti/mysql.sql → eitc-admin/db/activiti/mysql.sql


renren-admin/db/activiti/oracle.sql → eitc-admin/db/activiti/oracle.sql


renren-admin/db/activiti/postgresql.sql → eitc-admin/db/activiti/postgresql.sql


renren-admin/db/activiti/sqlserver.sql → eitc-admin/db/activiti/sqlserver.sql


File diff suppressed because it is too large
+ 207 - 0
eitc-admin/db/generator/mysql.sql


+ 293 - 0
eitc-admin/db/generator/oracle.sql

@@ -0,0 +1,293 @@
1
+CREATE TABLE gen_datasource (
2
+    id NUMBER(20, 0) NOT NULL,
3
+    db_type varchar2(200),
4
+    conn_name varchar2(200),
5
+    conn_url varchar2(500),
6
+    username varchar2(200),
7
+    password varchar2(200),
8
+    status NUMBER(2, 0),
9
+    create_date date,
10
+    primary key (id)
11
+);
12
+
13
+COMMENT ON TABLE gen_datasource IS '数据源管理';
14
+COMMENT ON COLUMN gen_datasource.id IS 'id';
15
+COMMENT ON COLUMN gen_datasource.db_type IS '数据库类型 MySQL、Oracle、SQLServer、PostgreSQL';
16
+COMMENT ON COLUMN gen_datasource.conn_name IS '连接名';
17
+COMMENT ON COLUMN gen_datasource.conn_url IS 'URL';
18
+COMMENT ON COLUMN gen_datasource.username IS '用户名';
19
+COMMENT ON COLUMN gen_datasource.password IS '密码';
20
+COMMENT ON COLUMN gen_datasource.status IS '状态  0:启用   1:禁用';
21
+COMMENT ON COLUMN gen_datasource.create_date IS '创建时间';
22
+
23
+
24
+
25
+CREATE TABLE gen_field_type (
26
+    id NUMBER(20, 0) NOT NULL,
27
+    column_type varchar2(200),
28
+    attr_type varchar2(200),
29
+    package_name varchar2(200),
30
+    create_date date,
31
+    primary key (id)
32
+);
33
+
34
+CREATE UNIQUE INDEX uk_gen_field_type_column_type on gen_field_type(column_type);
35
+
36
+COMMENT ON TABLE gen_field_type IS '字段类型管理';
37
+COMMENT ON COLUMN gen_field_type.id IS 'id';
38
+COMMENT ON COLUMN gen_field_type.column_type IS '字段类型';
39
+COMMENT ON COLUMN gen_field_type.attr_type IS '属性类型';
40
+COMMENT ON COLUMN gen_field_type.package_name IS '属性包名';
41
+COMMENT ON COLUMN gen_field_type.create_date IS '创建时间';
42
+
43
+
44
+CREATE TABLE gen_base_class (
45
+    id NUMBER(20, 0) NOT NULL,
46
+    package_name varchar2(200),
47
+    code varchar2(200),
48
+    fields varchar2(200),
49
+    remark varchar2(200),
50
+    create_date date,
51
+    primary key (id)
52
+);
53
+
54
+COMMENT ON TABLE gen_base_class IS '基类管理';
55
+COMMENT ON COLUMN gen_base_class.id IS 'id';
56
+COMMENT ON COLUMN gen_base_class.package_name IS '基类包名';
57
+COMMENT ON COLUMN gen_base_class.code IS '基类编码';
58
+COMMENT ON COLUMN gen_base_class.fields IS '基类字段,多个用英文逗号分隔';
59
+COMMENT ON COLUMN gen_base_class.remark IS '备注';
60
+COMMENT ON COLUMN gen_base_class.create_date IS '创建时间';
61
+
62
+
63
+CREATE TABLE gen_table_info (
64
+    id NUMBER(20, 0) NOT NULL,
65
+    table_name varchar2(200),
66
+    class_name varchar2(200),
67
+    table_comment varchar2(200),
68
+    author varchar2(200),
69
+    email varchar2(200),
70
+    package_name varchar2(200),
71
+    version varchar2(200),
72
+    backend_path varchar2(500),
73
+    frontend_path varchar2(500),
74
+    module_name varchar2(200),
75
+    sub_module_name varchar2(200),
76
+    datasource_id NUMBER(20, 0),
77
+    baseclass_id NUMBER(20, 0),
78
+    create_date date,
79
+    primary key (id)
80
+);
81
+
82
+CREATE UNIQUE INDEX uk_gen_table_info_table_name on gen_table_info(table_name);
83
+
84
+COMMENT ON TABLE gen_table_info IS '代码生成表';
85
+COMMENT ON COLUMN gen_table_info.id IS 'id';
86
+COMMENT ON COLUMN gen_table_info.table_name IS '表名';
87
+COMMENT ON COLUMN gen_table_info.class_name IS '类名';
88
+COMMENT ON COLUMN gen_table_info.table_comment IS '功能名';
89
+COMMENT ON COLUMN gen_table_info.author IS '作者';
90
+COMMENT ON COLUMN gen_table_info.email IS '邮箱';
91
+COMMENT ON COLUMN gen_table_info.package_name IS '项目包名';
92
+COMMENT ON COLUMN gen_table_info.version IS '项目版本号';
93
+COMMENT ON COLUMN gen_table_info.backend_path IS '后端生成路径';
94
+COMMENT ON COLUMN gen_table_info.frontend_path IS '前端生成路径';
95
+COMMENT ON COLUMN gen_table_info.module_name IS '模块名';
96
+COMMENT ON COLUMN gen_table_info.sub_module_name IS '子模块名';
97
+COMMENT ON COLUMN gen_table_info.datasource_id IS '数据源ID';
98
+COMMENT ON COLUMN gen_table_info.baseclass_id IS '基类ID';
99
+COMMENT ON COLUMN gen_table_info.create_date IS '创建时间';
100
+
101
+
102
+CREATE TABLE gen_table_field (
103
+    id NUMBER(20, 0) NOT NULL,
104
+    table_id NUMBER(20, 0),
105
+    table_name varchar2(200),
106
+    column_name varchar2(200),
107
+    column_type varchar2(200),
108
+    column_comment varchar2(200),
109
+    attr_name varchar2(200),
110
+    attr_type varchar2(200),
111
+    package_name varchar2(200),
112
+    is_pk NUMBER(2, 0),
113
+    is_required NUMBER(2, 0),
114
+    is_form NUMBER(2, 0),
115
+    is_list NUMBER(2, 0),
116
+    is_query NUMBER(2, 0),
117
+    query_type varchar2(200),
118
+    form_type varchar2(200),
119
+    dict_name varchar2(200),
120
+    validator_type varchar2(200),
121
+    sort NUMBER(10, 0),
122
+    primary key (id)
123
+);
124
+
125
+CREATE INDEX idx_gen_table_field_table_name on gen_table_field(table_name);
126
+
127
+COMMENT ON TABLE gen_table_field IS '代码生成表列';
128
+COMMENT ON COLUMN gen_table_field.id IS 'id';
129
+COMMENT ON COLUMN gen_table_field.table_id IS '表ID';
130
+COMMENT ON COLUMN gen_table_field.table_name IS '表名';
131
+COMMENT ON COLUMN gen_table_field.column_name IS '列名';
132
+COMMENT ON COLUMN gen_table_field.column_type IS '类型';
133
+COMMENT ON COLUMN gen_table_field.column_comment IS '列说明';
134
+COMMENT ON COLUMN gen_table_field.attr_name IS '属性名';
135
+COMMENT ON COLUMN gen_table_field.attr_type IS '属性类型';
136
+COMMENT ON COLUMN gen_table_field.package_name IS '属性包名';
137
+COMMENT ON COLUMN gen_table_field.is_pk IS '是否主键 0:否  1:是';
138
+COMMENT ON COLUMN gen_table_field.is_required IS '是否必填 0:否  1:是';
139
+COMMENT ON COLUMN gen_table_field.is_form IS '是否表单字段 0:否  1:是';
140
+COMMENT ON COLUMN gen_table_field.is_list IS '是否列表字段 0:否  1:是';
141
+COMMENT ON COLUMN gen_table_field.is_query IS '是否查询字段 0:否  1:是';
142
+COMMENT ON COLUMN gen_table_field.query_type IS '查询方式';
143
+COMMENT ON COLUMN gen_table_field.form_type IS '表单类型';
144
+COMMENT ON COLUMN gen_table_field.dict_name IS '字典名称';
145
+COMMENT ON COLUMN gen_table_field.validator_type IS '效验方式';
146
+COMMENT ON COLUMN gen_table_field.sort IS '排序';
147
+
148
+CREATE TABLE gen_template (
149
+    id NUMBER(20, 0) NOT NULL,
150
+    name varchar2(200),
151
+    file_name varchar2(200),
152
+    content clob,
153
+    path varchar2(500),
154
+    status NUMBER(2, 0),
155
+    create_date date,
156
+    primary key (id)
157
+);
158
+
159
+COMMENT ON TABLE gen_template IS '模板管理';
160
+COMMENT ON COLUMN gen_template.id IS 'id';
161
+COMMENT ON COLUMN gen_template.name IS '名称';
162
+COMMENT ON COLUMN gen_template.file_name IS '文件名';
163
+COMMENT ON COLUMN gen_template.content IS '内容';
164
+COMMENT ON COLUMN gen_template.path IS '生成路径';
165
+COMMENT ON COLUMN gen_template.status IS '状态  0:启用   1:禁用';
166
+COMMENT ON COLUMN gen_template.create_date IS '创建时间';
167
+
168
+
169
+CREATE TABLE gen_test_data (
170
+    id NUMBER(20, 0) NOT NULL,
171
+    username varchar2(50),
172
+    real_name varchar2(50),
173
+    gender NUMBER(2, 0),
174
+    email varchar2(100),
175
+    notice_type NUMBER(2, 0),
176
+    content clob,
177
+    creator NUMBER(20, 0),
178
+    create_date date,
179
+    updater NUMBER(20, 0),
180
+    update_date date,
181
+    PRIMARY KEY (id)
182
+);
183
+
184
+COMMENT ON TABLE gen_test_data IS '测试功能';
185
+COMMENT ON COLUMN gen_test_data.id IS 'id';
186
+COMMENT ON COLUMN gen_test_data.username IS '用户名';
187
+COMMENT ON COLUMN gen_test_data.real_name IS '姓名';
188
+COMMENT ON COLUMN gen_test_data.gender IS '性别';
189
+COMMENT ON COLUMN gen_test_data.email IS '邮箱';
190
+COMMENT ON COLUMN gen_test_data.notice_type IS '类型';
191
+COMMENT ON COLUMN gen_test_data.content IS '内容';
192
+COMMENT ON COLUMN gen_test_data.creator IS '创建者';
193
+COMMENT ON COLUMN gen_test_data.create_date IS '创建时间';
194
+COMMENT ON COLUMN gen_test_data.updater IS '更新者';
195
+COMMENT ON COLUMN gen_test_data.update_date IS '更新时间';
196
+
197
+
198
+INSERT INTO sys_menu(id, pid, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1302850622416084993, 0, '', '', 0, 'icon-rocket', 3, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
199
+INSERT INTO sys_menu(id, pid, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1302850783288614913, 1305532398162145281, 'devtools/datasource', '', 0, 'icon-sync', 0, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
200
+INSERT INTO sys_menu(id, pid, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1302862890696564738, 1305532398162145281, 'devtools/fieldtype', '', 0, 'icon-eye', 1, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
201
+INSERT INTO sys_menu(id, pid, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1302874751835848705, 1305532398162145281, 'devtools/baseclass', '', 0, 'icon-info-circle', 3, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
202
+INSERT INTO sys_menu(id, pid, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1304081184014635010, 1305532398162145281, 'devtools/template', '', 0, 'icon-up-circle', 3, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
203
+INSERT INTO sys_menu(id, pid, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1304802103569809410, 1302850622416084993, 'devtools/generator', '', 0, 'icon-tags', 0, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
204
+INSERT INTO sys_menu(id, pid, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1305513187675144193, 1305532398162145281, 'devtools/param', '', 0, 'icon-setting', 5, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
205
+INSERT INTO sys_menu(id, pid, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1305532398162145281, 1302850622416084993, '', '', 0, 'icon-setting', 3, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
206
+
207
+INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1302850622416084993, 'name', 'DevTools', 'en-US');
208
+INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1302850622416084993, 'name', '开发者工具', 'zh-CN');
209
+INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1302850622416084993, 'name', '開發者工具', 'zh-TW');
210
+INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1302850783288614913, 'name', 'DataSource', 'en-US');
211
+INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1302850783288614913, 'name', '数据源管理', 'zh-CN');
212
+INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1302850783288614913, 'name', '數據源管理', 'zh-TW');
213
+INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1302862890696564738, 'name', 'Field Management', 'en-US');
214
+INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1302862890696564738, 'name', '字段管理', 'zh-CN');
215
+INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1302862890696564738, 'name', '字段管理', 'zh-TW');
216
+INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1302874751835848705, 'name', 'BaseClass', 'en-US');
217
+INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1302874751835848705, 'name', '基类管理', 'zh-CN');
218
+INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1302874751835848705, 'name', '基類管理', 'zh-TW');
219
+INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1304081184014635010, 'name', 'Template', 'en-US');
220
+INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1304081184014635010, 'name', '模板管理', 'zh-CN');
221
+INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1304081184014635010, 'name', '模板管理', 'zh-TW');
222
+INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1304802103569809410, 'name', 'Code Generation', 'en-US');
223
+INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1304802103569809410, 'name', '代码生成工具', 'zh-CN');
224
+INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1304802103569809410, 'name', '代碼生成工具', 'zh-TW');
225
+INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1305513187675144193, 'name', 'Parameter Config', 'en-US');
226
+INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1305513187675144193, 'name', '参数配置', 'zh-CN');
227
+INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1305513187675144193, 'name', '參數配置', 'zh-TW');
228
+INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1305532398162145281, 'name', 'Config Info', 'en-US');
229
+INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1305532398162145281, 'name', '配置信息', 'zh-CN');
230
+INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1305532398162145281, 'name', '配置信息', 'zh-TW');
231
+
232
+INSERT INTO sys_params(id, param_code, param_value, param_type, remark, creator, create_date, updater, update_date) VALUES (1067246875800000072, 'DEV_TOOLS_PARAM_KEY', '{"packageName":"com.eitc","version":"3.0","author":"Mark","email":"eitc@163.com","backendPath":"D:\\adminio\\eitc-erm-tenant\\eitc-admin","frontendPath":"D:\\adminio\\eitc-erm-tenant-admin"}', 0, '代码生成器配置信息', 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
233
+
234
+INSERT INTO gen_base_class(id, package_name, code, fields, remark, create_date) VALUES (1302875019642159105, '${package}.common.entity.BaseEntity', 'BaseEntity', 'id,creator,create_date', '专业版', CURRENT_DATE);
235
+INSERT INTO gen_datasource(id, db_type, conn_name, conn_url, username, password, status, create_date) VALUES (1302855887882412034, 'MySQL', '本地', 'jdbc:mysql://localhost:3306/security_enterprise?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true', 'admin', '123456', 0, CURRENT_DATE);
236
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152452777352425473, 'datetime', 'Date', 'java.util.Date', CURRENT_DATE);
237
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152453412995002369, 'date', 'Date', 'java.util.Date', CURRENT_DATE);
238
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152453603525455873, 'tinyint', 'Integer', NULL, CURRENT_DATE);
239
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152453660052090881, 'smallint', 'Integer', NULL, CURRENT_DATE);
240
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152453722136178689, 'mediumint', 'Integer', NULL, CURRENT_DATE);
241
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152453808874385409, 'int', 'Integer', NULL, CURRENT_DATE);
242
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152453849735294977, 'integer', 'Integer', NULL, CURRENT_DATE);
243
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152453895029583873, 'bigint', 'Long', NULL, CURRENT_DATE);
244
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152453931373228033, 'float', 'Float', NULL, CURRENT_DATE);
245
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152453967880450050, 'double', 'Double', NULL, CURRENT_DATE);
246
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152454047601586177, 'decimal', 'BigDecimal', 'java.math.BigDecimal', CURRENT_DATE);
247
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152454090760974338, 'bit', 'Boolean', NULL, CURRENT_DATE);
248
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152454147010785282, 'char', 'String', NULL, CURRENT_DATE);
249
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152454183136325633, 'varchar', 'String', NULL, CURRENT_DATE);
250
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152454312664821761, 'tinytext', 'String', NULL, CURRENT_DATE);
251
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152454343820111874, 'text', 'String', NULL, CURRENT_DATE);
252
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152454372077137921, 'mediumtext', 'String', NULL, CURRENT_DATE);
253
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152454401378545665, 'longtext', 'String', NULL, CURRENT_DATE);
254
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152454486267064322, 'timestamp', 'Date', 'java.util.Date', CURRENT_DATE);
255
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152454630295269378, 'NUMBER', 'Integer', NULL, CURRENT_DATE);
256
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152454715645161474, 'BINARY_INTEGER', 'Integer', NULL, CURRENT_DATE);
257
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152454778828156930, 'BINARY_FLOAT', 'Float', NULL, CURRENT_DATE);
258
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152454828987838466, 'BINARY_DOUBLE', 'Double', NULL, CURRENT_DATE);
259
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152454885745160193, 'VARCHAR2', 'String', NULL, CURRENT_DATE);
260
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152454919756771329, 'NVARCHAR', 'String', NULL, CURRENT_DATE);
261
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152454952568811521, 'NVARCHAR2', 'String', NULL, CURRENT_DATE);
262
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152454986349735938, 'CLOB', 'String', NULL, CURRENT_DATE);
263
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152455109695827970, 'int8', 'Long', NULL, CURRENT_DATE);
264
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152455153002016770, 'int4', 'Integer', NULL, CURRENT_DATE);
265
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152455184669011969, 'int2', 'Integer', NULL, CURRENT_DATE);
266
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152455217359417345, 'numeric', 'BigDecimal', 'java.math.BigDecimal', CURRENT_DATE);
267
+
268
+INSERT INTO gen_table_info(id, table_name, class_name, table_comment, author, email, package_name, version, backend_path, frontend_path, module_name, sub_module_name, datasource_id, baseclass_id, create_date) VALUES (1308327671447859201, 'gen_test_data', 'TestData', '测试功能', 'Mark', 'eitc@163.com', 'com.eitc', '3.0', 'D:\\adminio\\eitc-erm-tenant\\eitc-admin', 'D:\\adminio\\eitc-erm-tenant-admin', 'gen', NULL, 0, 1302875019642159105, CURRENT_DATE);
269
+
270
+INSERT INTO gen_table_field(id, table_id, table_name, column_name, column_type, column_comment, attr_name, attr_type, package_name, is_pk, is_required, is_form, is_list, is_query, query_type, form_type, dict_name, validator_type, sort) VALUES (1308327671502385153, 1308327671447859201, 'gen_test_data', 'id', 'BIGINT', 'id', 'id', 'Long', NULL, 1, 0, 0, 0, 0, '=', 'text', NULL, NULL, 0);
271
+INSERT INTO gen_table_field(id, table_id, table_name, column_name, column_type, column_comment, attr_name, attr_type, package_name, is_pk, is_required, is_form, is_list, is_query, query_type, form_type, dict_name, validator_type, sort) VALUES (1308327671510773761, 1308327671447859201, 'gen_test_data', 'username', 'VARCHAR', '用户名', 'username', 'String', NULL, 0, 1, 1, 1, 1, 'like', 'text', NULL, NULL, 1);
272
+INSERT INTO gen_table_field(id, table_id, table_name, column_name, column_type, column_comment, attr_name, attr_type, package_name, is_pk, is_required, is_form, is_list, is_query, query_type, form_type, dict_name, validator_type, sort) VALUES (1308327671510773762, 1308327671447859201, 'gen_test_data', 'real_name', 'VARCHAR', '姓名', 'realName', 'String', NULL, 0, 1, 1, 1, 0, 'like', 'text', NULL, NULL, 2);
273
+INSERT INTO gen_table_field(id, table_id, table_name, column_name, column_type, column_comment, attr_name, attr_type, package_name, is_pk, is_required, is_form, is_list, is_query, query_type, form_type, dict_name, validator_type, sort) VALUES (1308327671510773763, 1308327671447859201, 'gen_test_data', 'gender', 'TINYINT', '性别', 'gender', 'Integer', NULL, 0, 1, 1, 1, 1, '=', 'select', 'gender', NULL, 3);
274
+INSERT INTO gen_table_field(id, table_id, table_name, column_name, column_type, column_comment, attr_name, attr_type, package_name, is_pk, is_required, is_form, is_list, is_query, query_type, form_type, dict_name, validator_type, sort) VALUES (1308327671510773764, 1308327671447859201, 'gen_test_data', 'email', 'VARCHAR', '邮箱', 'email', 'String', NULL, 0, 1, 1, 1, 0, '=', 'text', NULL, NULL, 4);
275
+INSERT INTO gen_table_field(id, table_id, table_name, column_name, column_type, column_comment, attr_name, attr_type, package_name, is_pk, is_required, is_form, is_list, is_query, query_type, form_type, dict_name, validator_type, sort) VALUES (1308327671514968065, 1308327671447859201, 'gen_test_data', 'notice_type', 'TINYINT', '类型', 'noticeType', 'Integer', NULL, 0, 1, 1, 1, 0, '=', 'radio', 'notice_type', NULL, 5);
276
+INSERT INTO gen_table_field(id, table_id, table_name, column_name, column_type, column_comment, attr_name, attr_type, package_name, is_pk, is_required, is_form, is_list, is_query, query_type, form_type, dict_name, validator_type, sort) VALUES (1308327671514968066, 1308327671447859201, 'gen_test_data', 'content', 'TEXT', '内容', 'content', 'String', NULL, 0, 1, 1, 0, 0, '=', 'editor', NULL, NULL, 6);
277
+INSERT INTO gen_table_field(id, table_id, table_name, column_name, column_type, column_comment, attr_name, attr_type, package_name, is_pk, is_required, is_form, is_list, is_query, query_type, form_type, dict_name, validator_type, sort) VALUES (1308327671514968067, 1308327671447859201, 'gen_test_data', 'creator', 'BIGINT', '创建者', 'creator', 'Long', NULL, 0, 0, 0, 0, 0, '=', 'text', NULL, NULL, 7);
278
+INSERT INTO gen_table_field(id, table_id, table_name, column_name, column_type, column_comment, attr_name, attr_type, package_name, is_pk, is_required, is_form, is_list, is_query, query_type, form_type, dict_name, validator_type, sort) VALUES (1308327671514968068, 1308327671447859201, 'gen_test_data', 'create_date', 'DATETIME', '创建时间', 'createDate', 'Date', 'java.util.Date', 0, 0, 0, 1, 1, '=', 'date', NULL, NULL, 8);
279
+INSERT INTO gen_table_field(id, table_id, table_name, column_name, column_type, column_comment, attr_name, attr_type, package_name, is_pk, is_required, is_form, is_list, is_query, query_type, form_type, dict_name, validator_type, sort) VALUES (1308327671514968069, 1308327671447859201, 'gen_test_data', 'updater', 'BIGINT', '更新者', 'updater', 'Long', NULL, 0, 0, 0, 0, 0, '=', 'text', NULL, NULL, 9);
280
+INSERT INTO gen_table_field(id, table_id, table_name, column_name, column_type, column_comment, attr_name, attr_type, package_name, is_pk, is_required, is_form, is_list, is_query, query_type, form_type, dict_name, validator_type, sort) VALUES (1308327671523356674, 1308327671447859201, 'gen_test_data', 'update_date', 'DATETIME', '更新时间', 'updateDate', 'Date', 'java.util.Date', 0, 0, 0, 0, 0, '=', 'text', NULL, NULL, 10);
281
+
282
+INSERT INTO gen_template(id, name, file_name, content, path, status, create_date) VALUES (1144564443498168321, 'Entity.java', '${ClassName}Entity.java', '', '${backendPath}/src/main/java/${packagePath}/modules/${moduleName}/entity/${subModuleName!}', 0, CURRENT_DATE);
283
+INSERT INTO gen_template(id, name, file_name, content, path, status, create_date) VALUES (1151104918417948674, 'Dao.java', '${ClassName}Dao.java', '', '${backendPath}/src/main/java/${packagePath}/modules/${moduleName}/dao/${subModuleName!}', 0, CURRENT_DATE);
284
+INSERT INTO gen_template(id, name, file_name, content, path, status, create_date) VALUES (1222102542519422977, 'Dao.xml', '${ClassName}Dao.xml', '', '${backendPath}/src/main/resources/mapper/${moduleName}', 0, CURRENT_DATE);
285
+INSERT INTO gen_template(id, name, file_name, content, path, status, create_date) VALUES (1222811087900602369, 'Service.java', '${ClassName}Service.java', '', '${backendPath}/src/main/java/${packagePath}/modules/${moduleName}/service/${subModuleName!}', 0, CURRENT_DATE);
286
+INSERT INTO gen_template(id, name, file_name, content, path, status, create_date) VALUES (1222811738672033793, 'ServiceImpl.java', '${ClassName}ServiceImpl.java', '', '${backendPath}/src/main/java/${packagePath}/modules/${moduleName}/service/${subModuleName!}/impl', 0, CURRENT_DATE);
287
+INSERT INTO gen_template(id, name, file_name, content, path, status, create_date) VALUES (1222814109661753346, 'Excel.java', '${ClassName}Excel.java', '', '${backendPath}/src/main/java/${packagePath}/modules/${moduleName}/excel/${subModuleName!}', 0, CURRENT_DATE);
288
+INSERT INTO gen_template(id, name, file_name, content, path, status, create_date) VALUES (1222816187301851138, 'DTO.java', '${ClassName}DTO.java', '', '${backendPath}/src/main/java/${packagePath}/modules/${moduleName}/dto/${subModuleName!}', 0, CURRENT_DATE);
289
+INSERT INTO gen_template(id, name, file_name, content, path, status, create_date) VALUES (1222817622663983106, 'Controller.java', '${ClassName}Controller.java', '', '${backendPath}/src/main/java/${packagePath}/modules/${moduleName}/controller/${subModuleName!}', 0, CURRENT_DATE);
290
+INSERT INTO gen_template(id, name, file_name, content, path, status, create_date) VALUES (1304292858898309122, 'list.vue', '${classname}.vue', '', '${frontendPath}/src/views/modules/${moduleName}', 0, CURRENT_DATE);
291
+INSERT INTO gen_template(id, name, file_name, content, path, status, create_date) VALUES (1304293015698169857, 'add-or-update.vue', '${classname}-add-or-update.vue', '', '${frontendPath}/src/views/modules/${moduleName}', 0, CURRENT_DATE);
292
+
293
+INSERT INTO gen_test_data(id, username, real_name, gender, email, notice_type, content, creator, create_date, updater, update_date) VALUES (1067246875800000001, 'sunlightcs', 'Mark', 0, 'root@admin.163.com', 0, '<p>智汇口腔代码生成器!</p>', 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);

+ 297 - 0
eitc-admin/db/generator/postgresql.sql

@@ -0,0 +1,297 @@
1
+CREATE TABLE gen_datasource (
2
+    id int8 NOT NULL,
3
+    db_type varchar(200),
4
+    conn_name varchar(200),
5
+    conn_url varchar(500),
6
+    username varchar(200),
7
+    password varchar(200),
8
+    status int,
9
+    create_date timestamp,
10
+    primary key (id)
11
+);
12
+
13
+COMMENT ON TABLE gen_datasource IS '数据源管理';
14
+COMMENT ON COLUMN gen_datasource.id IS 'id';
15
+COMMENT ON COLUMN gen_datasource.db_type IS '数据库类型 MySQL、Oracle、SQLServer、PostgreSQL';
16
+COMMENT ON COLUMN gen_datasource.conn_name IS '连接名';
17
+COMMENT ON COLUMN gen_datasource.conn_url IS 'URL';
18
+COMMENT ON COLUMN gen_datasource.username IS '用户名';
19
+COMMENT ON COLUMN gen_datasource.password IS '密码';
20
+COMMENT ON COLUMN gen_datasource.status IS '状态  0:启用   1:禁用';
21
+COMMENT ON COLUMN gen_datasource.create_date IS '创建时间';
22
+
23
+
24
+
25
+CREATE TABLE gen_field_type (
26
+    id int8 NOT NULL,
27
+    column_type varchar(200),
28
+    attr_type varchar(200),
29
+    package_name varchar(200),
30
+    create_date timestamp,
31
+    primary key (id)
32
+);
33
+
34
+CREATE UNIQUE INDEX uk_gen_field_type_column_type on gen_field_type(column_type);
35
+
36
+COMMENT ON TABLE gen_field_type IS '字段类型管理';
37
+COMMENT ON COLUMN gen_field_type.id IS 'id';
38
+COMMENT ON COLUMN gen_field_type.column_type IS '字段类型';
39
+COMMENT ON COLUMN gen_field_type.attr_type IS '属性类型';
40
+COMMENT ON COLUMN gen_field_type.package_name IS '属性包名';
41
+COMMENT ON COLUMN gen_field_type.create_date IS '创建时间';
42
+
43
+
44
+CREATE TABLE gen_base_class (
45
+    id int8 NOT NULL,
46
+    package_name varchar(200),
47
+    code varchar(200),
48
+    fields varchar(200),
49
+    remark varchar(200),
50
+    create_date timestamp,
51
+    primary key (id)
52
+);
53
+
54
+COMMENT ON TABLE gen_base_class IS '基类管理';
55
+COMMENT ON COLUMN gen_base_class.id IS 'id';
56
+COMMENT ON COLUMN gen_base_class.package_name IS '基类包名';
57
+COMMENT ON COLUMN gen_base_class.code IS '基类编码';
58
+COMMENT ON COLUMN gen_base_class.fields IS '基类字段,多个用英文逗号分隔';
59
+COMMENT ON COLUMN gen_base_class.remark IS '备注';
60
+COMMENT ON COLUMN gen_base_class.create_date IS '创建时间';
61
+
62
+
63
+CREATE TABLE gen_table_info (
64
+    id int8 NOT NULL,
65
+    table_name varchar(200),
66
+    class_name varchar(200),
67
+    table_comment varchar(200),
68
+    author varchar(200),
69
+    email varchar(200),
70
+    package_name varchar(200),
71
+    version varchar(200),
72
+    backend_path varchar(500),
73
+    frontend_path varchar(500),
74
+    module_name varchar(200),
75
+    sub_module_name varchar(200),
76
+    datasource_id int8,
77
+    baseclass_id int8,
78
+    create_date timestamp,
79
+    primary key (id)
80
+);
81
+
82
+CREATE UNIQUE INDEX uk_gen_table_info_table_name on gen_table_info(table_name);
83
+
84
+COMMENT ON TABLE gen_table_info IS '代码生成表';
85
+COMMENT ON COLUMN gen_table_info.id IS 'id';
86
+COMMENT ON COLUMN gen_table_info.table_name IS '表名';
87
+COMMENT ON COLUMN gen_table_info.class_name IS '类名';
88
+COMMENT ON COLUMN gen_table_info.column_comment IS '功能名';
89
+COMMENT ON COLUMN gen_table_info.author IS '作者';
90
+COMMENT ON COLUMN gen_table_info.email IS '邮箱';
91
+COMMENT ON COLUMN gen_table_info.package_name IS '项目包名';
92
+COMMENT ON COLUMN gen_table_info.version IS '项目版本号';
93
+COMMENT ON COLUMN gen_table_info.backend_path IS '后端生成路径';
94
+COMMENT ON COLUMN gen_table_info.frontend_path IS '前端生成路径';
95
+COMMENT ON COLUMN gen_table_info.module_name IS '模块名';
96
+COMMENT ON COLUMN gen_table_info.sub_module_name IS '子模块名';
97
+COMMENT ON COLUMN gen_table_info.datasource_id IS '数据源ID';
98
+COMMENT ON COLUMN gen_table_info.baseclass_id IS '基类ID';
99
+COMMENT ON COLUMN gen_table_info.create_date IS '创建时间';
100
+
101
+
102
+CREATE TABLE gen_table_field (
103
+    id int8 NOT NULL,
104
+    table_id int8,
105
+    table_name varchar(200),
106
+    column_name varchar(200),
107
+    column_type varchar(200),
108
+    column_comment varchar(200),
109
+    attr_name varchar(200),
110
+    attr_type varchar(200),
111
+    package_name varchar(200),
112
+    is_pk boolean,
113
+    is_required boolean,
114
+    is_form boolean,
115
+    is_list boolean,
116
+    is_query boolean,
117
+    query_type varchar(200),
118
+    form_type varchar(200),
119
+    dict_name varchar(200),
120
+    validator_type varchar(200),
121
+    sort int,
122
+    primary key (id)
123
+);
124
+
125
+CREATE INDEX idx_gen_table_field_table_name on gen_table_field(table_name);
126
+
127
+COMMENT ON TABLE gen_table_field IS '代码生成表列';
128
+COMMENT ON COLUMN gen_table_field.id IS 'id';
129
+COMMENT ON COLUMN gen_table_field.table_id IS '表ID';
130
+COMMENT ON COLUMN gen_table_field.table_name IS '表名';
131
+COMMENT ON COLUMN gen_table_field.column_name IS '列名';
132
+COMMENT ON COLUMN gen_table_field.column_type IS '类型';
133
+COMMENT ON COLUMN gen_table_field.column_comment IS '列说明';
134
+COMMENT ON COLUMN gen_table_field.attr_name IS '属性名';
135
+COMMENT ON COLUMN gen_table_field.attr_type IS '属性类型';
136
+COMMENT ON COLUMN gen_table_field.package_name IS '属性包名';
137
+COMMENT ON COLUMN gen_table_field.is_pk IS '是否主键 0:否  1:是';
138
+COMMENT ON COLUMN gen_table_field.is_required IS '是否必填 0:否  1:是';
139
+COMMENT ON COLUMN gen_table_field.is_form IS '是否表单字段 0:否  1:是';
140
+COMMENT ON COLUMN gen_table_field.is_list IS '是否列表字段 0:否  1:是';
141
+COMMENT ON COLUMN gen_table_field.is_query IS '是否查询字段 0:否  1:是';
142
+COMMENT ON COLUMN gen_table_field.query_type IS '查询方式';
143
+COMMENT ON COLUMN gen_table_field.form_type IS '表单类型';
144
+COMMENT ON COLUMN gen_table_field.dict_name IS '字典名称';
145
+COMMENT ON COLUMN gen_table_field.validator_type IS '效验方式';
146
+COMMENT ON COLUMN gen_table_field.sort IS '排序';
147
+
148
+CREATE TABLE gen_template (
149
+    id int8 NOT NULL,
150
+    name varchar(200),
151
+    file_name varchar(200),
152
+    content text,
153
+    path varchar(500),
154
+    status int,
155
+    create_date timestamp,
156
+    primary key (id)
157
+);
158
+
159
+COMMENT ON TABLE gen_template IS '模板管理';
160
+COMMENT ON COLUMN gen_template.id IS 'id';
161
+COMMENT ON COLUMN gen_template.name IS '名称';
162
+COMMENT ON COLUMN gen_template.file_name IS '文件名';
163
+COMMENT ON COLUMN gen_template.content IS '内容';
164
+COMMENT ON COLUMN gen_template.path IS '生成路径';
165
+COMMENT ON COLUMN gen_template.status IS '状态  0:启用   1:禁用';
166
+COMMENT ON COLUMN gen_template.create_date IS '创建时间';
167
+
168
+
169
+CREATE TABLE gen_test_data (
170
+    id int8 NOT NULL,
171
+    username varchar(50),
172
+    real_name varchar(50),
173
+    gender int,
174
+    email varchar(100),
175
+    notice_type int,
176
+    content text,
177
+    creator int8,
178
+    create_date timestamp,
179
+    updater int8,
180
+    update_date timestamp,
181
+    PRIMARY KEY (id)
182
+);
183
+
184
+COMMENT ON TABLE gen_test_data IS '测试功能';
185
+COMMENT ON COLUMN gen_test_data.id IS 'id';
186
+COMMENT ON COLUMN gen_test_data.username IS '用户名';
187
+COMMENT ON COLUMN gen_test_data.real_name IS '姓名';
188
+COMMENT ON COLUMN gen_test_data.gender IS '性别';
189
+COMMENT ON COLUMN gen_test_data.email IS '邮箱';
190
+COMMENT ON COLUMN gen_test_data.notice_type IS '类型';
191
+COMMENT ON COLUMN gen_test_data.content IS '内容';
192
+COMMENT ON COLUMN gen_test_data.creator IS '创建者';
193
+COMMENT ON COLUMN gen_test_data.create_date IS '创建时间';
194
+COMMENT ON COLUMN gen_test_data.updater IS '更新者';
195
+COMMENT ON COLUMN gen_test_data.update_date IS '更新时间';
196
+
197
+
198
+INSERT INTO sys_menu(id, pid, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1302850622416084993, 0, '', '', 0, 'icon-rocket', 3, 1067246875800000001, now(), 1067246875800000001, now());
199
+INSERT INTO sys_menu(id, pid, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1302850783288614913, 1305532398162145281, 'devtools/datasource', '', 0, 'icon-sync', 0, 1067246875800000001, now(), 1067246875800000001, now());
200
+INSERT INTO sys_menu(id, pid, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1302862890696564738, 1305532398162145281, 'devtools/fieldtype', '', 0, 'icon-eye', 1, 1067246875800000001, now(), 1067246875800000001, now());
201
+INSERT INTO sys_menu(id, pid, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1302874751835848705, 1305532398162145281, 'devtools/baseclass', '', 0, 'icon-info-circle', 3, 1067246875800000001, now(), 1067246875800000001, now());
202
+INSERT INTO sys_menu(id, pid, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1304081184014635010, 1305532398162145281, 'devtools/template', '', 0, 'icon-up-circle', 3, 1067246875800000001, now(), 1067246875800000001, now());
203
+INSERT INTO sys_menu(id, pid, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1304802103569809410, 1302850622416084993, 'devtools/generator', '', 0, 'icon-tags', 0, 1067246875800000001, now(), 1067246875800000001, now());
204
+INSERT INTO sys_menu(id, pid, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1305513187675144193, 1305532398162145281, 'devtools/param', '', 0, 'icon-setting', 5, 1067246875800000001, now(), 1067246875800000001, now());
205
+INSERT INTO sys_menu(id, pid, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1305532398162145281, 1302850622416084993, '', '', 0, 'icon-setting', 3, 1067246875800000001, now(), 1067246875800000001, now());
206
+
207
+
208
+INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1302850622416084993, 'name', 'DevTools', 'en-US');
209
+INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1302850622416084993, 'name', '开发者工具', 'zh-CN');
210
+INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1302850622416084993, 'name', '開發者工具', 'zh-TW');
211
+INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1302850783288614913, 'name', 'DataSource', 'en-US');
212
+INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1302850783288614913, 'name', '数据源管理', 'zh-CN');
213
+INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1302850783288614913, 'name', '數據源管理', 'zh-TW');
214
+INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1302862890696564738, 'name', 'Field Management', 'en-US');
215
+INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1302862890696564738, 'name', '字段管理', 'zh-CN');
216
+INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1302862890696564738, 'name', '字段管理', 'zh-TW');
217
+INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1302874751835848705, 'name', 'BaseClass', 'en-US');
218
+INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1302874751835848705, 'name', '基类管理', 'zh-CN');
219
+INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1302874751835848705, 'name', '基類管理', 'zh-TW');
220
+INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1304081184014635010, 'name', 'Template', 'en-US');
221
+INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1304081184014635010, 'name', '模板管理', 'zh-CN');
222
+INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1304081184014635010, 'name', '模板管理', 'zh-TW');
223
+INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1304802103569809410, 'name', 'Code Generation', 'en-US');
224
+INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1304802103569809410, 'name', '代码生成工具', 'zh-CN');
225
+INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1304802103569809410, 'name', '代碼生成工具', 'zh-TW');
226
+INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1305513187675144193, 'name', 'Parameter Config', 'en-US');
227
+INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1305513187675144193, 'name', '参数配置', 'zh-CN');
228
+INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1305513187675144193, 'name', '參數配置', 'zh-TW');
229
+INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1305532398162145281, 'name', 'Config Info', 'en-US');
230
+INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1305532398162145281, 'name', '配置信息', 'zh-CN');
231
+INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1305532398162145281, 'name', '配置信息', 'zh-TW');
232
+
233
+INSERT INTO sys_params(id, param_code, param_value, param_type, remark, creator, create_date, updater, update_date) VALUES (1067246875800000072, 'DEV_TOOLS_PARAM_KEY', '{"packageName":"com.eitc","version":"3.0","author":"Mark","email":"eitc@163.com","backendPath":"D:\\adminio\\eitc-erm-tenant\\eitc-admin","frontendPath":"D:\\adminio\\eitc-erm-tenant-admin"}', 0, '代码生成器配置信息', 1067246875800000001, now(), 1067246875800000001, now());
234
+
235
+INSERT INTO gen_base_class(id, package_name, code, fields, remark, create_date) VALUES (1302875019642159105, '${package}.common.entity.BaseEntity', 'BaseEntity', 'id,creator,create_date', '专业版', now());
236
+INSERT INTO gen_datasource(id, db_type, conn_name, conn_url, username, password, status, create_date) VALUES (1302855887882412034, 'MySQL', '本地', 'jdbc:mysql://localhost:3306/security_enterprise?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true', 'admin', '123456', 0, now());
237
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152452777352425473, 'datetime', 'Date', 'java.util.Date', now());
238
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152453412995002369, 'date', 'Date', 'java.util.Date', now());
239
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152453603525455873, 'tinyint', 'Integer', NULL, now());
240
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152453660052090881, 'smallint', 'Integer', NULL, now());
241
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152453722136178689, 'mediumint', 'Integer', NULL, now());
242
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152453808874385409, 'int', 'Integer', NULL, now());
243
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152453849735294977, 'integer', 'Integer', NULL, now());
244
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152453895029583873, 'bigint', 'Long', NULL, now());
245
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152453931373228033, 'float', 'Float', NULL, now());
246
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152453967880450050, 'double', 'Double', NULL, now());
247
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152454047601586177, 'decimal', 'BigDecimal', 'java.math.BigDecimal', now());
248
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152454090760974338, 'bit', 'Boolean', NULL, now());
249
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152454147010785282, 'char', 'String', NULL, now());
250
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152454183136325633, 'varchar', 'String', NULL, now());
251
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152454312664821761, 'tinytext', 'String', NULL, now());
252
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152454343820111874, 'text', 'String', NULL, now());
253
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152454372077137921, 'mediumtext', 'String', NULL, now());
254
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152454401378545665, 'longtext', 'String', NULL, now());
255
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152454486267064322, 'timestamp', 'Date', 'java.util.Date', now());
256
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152454630295269378, 'NUMBER', 'Integer', NULL, now());
257
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152454715645161474, 'BINARY_INTEGER', 'Integer', NULL, now());
258
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152454778828156930, 'BINARY_FLOAT', 'Float', NULL, now());
259
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152454828987838466, 'BINARY_DOUBLE', 'Double', NULL, now());
260
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152454885745160193, 'VARCHAR2', 'String', NULL, now());
261
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152454919756771329, 'NVARCHAR', 'String', NULL, now());
262
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152454952568811521, 'NVARCHAR2', 'String', NULL, now());
263
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152454986349735938, 'CLOB', 'String', NULL, now());
264
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152455109695827970, 'int8', 'Long', NULL, now());
265
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152455153002016770, 'int4', 'Integer', NULL, now());
266
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152455184669011969, 'int2', 'Integer', NULL, now());
267
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152455217359417345, 'numeric', 'BigDecimal', 'java.math.BigDecimal', now());
268
+
269
+INSERT INTO gen_table_info(id, table_name, class_name, table_comment, author, email, package_name, version, backend_path, frontend_path, module_name, sub_module_name, datasource_id, baseclass_id, create_date) VALUES (1308327671447859201, 'gen_test_data', 'TestData', '测试功能', 'Mark', 'eitc@163.com', 'com.eitc', '3.0', 'D:\\adminio\\eitc-erm-tenant\\eitc-admin', 'D:\\adminio\\eitc-erm-tenant-admin', 'gen', NULL, 0, 1302875019642159105, now());
270
+
271
+INSERT INTO gen_table_field(id, table_id, table_name, column_name, column_type, column_comment, attr_name, attr_type, package_name, is_pk, is_required, is_form, is_list, is_query, query_type, form_type, dict_name, validator_type, sort) VALUES (1308327671502385153, 1308327671447859201, 'gen_test_data', 'id', 'BIGINT', 'id', 'id', 'Long', NULL, true, false, false, false, false, '=', 'text', NULL, NULL, 0);
272
+INSERT INTO gen_table_field(id, table_id, table_name, column_name, column_type, column_comment, attr_name, attr_type, package_name, is_pk, is_required, is_form, is_list, is_query, query_type, form_type, dict_name, validator_type, sort) VALUES (1308327671510773761, 1308327671447859201, 'gen_test_data', 'username', 'VARCHAR', '用户名', 'username', 'String', NULL, false, true, true, true, true, 'like', 'text', NULL, NULL, 1);
273
+INSERT INTO gen_table_field(id, table_id, table_name, column_name, column_type, column_comment, attr_name, attr_type, package_name, is_pk, is_required, is_form, is_list, is_query, query_type, form_type, dict_name, validator_type, sort) VALUES (1308327671510773762, 1308327671447859201, 'gen_test_data', 'real_name', 'VARCHAR', '姓名', 'realName', 'String', NULL, false, true, true, true, false, 'like', 'text', NULL, NULL, 2);
274
+INSERT INTO gen_table_field(id, table_id, table_name, column_name, column_type, column_comment, attr_name, attr_type, package_name, is_pk, is_required, is_form, is_list, is_query, query_type, form_type, dict_name, validator_type, sort) VALUES (1308327671510773763, 1308327671447859201, 'gen_test_data', 'gender', 'TINYINT', '性别', 'gender', 'Integer', NULL, false, true, true, true, true, '=', 'select', 'gender', NULL, 3);
275
+INSERT INTO gen_table_field(id, table_id, table_name, column_name, column_type, column_comment, attr_name, attr_type, package_name, is_pk, is_required, is_form, is_list, is_query, query_type, form_type, dict_name, validator_type, sort) VALUES (1308327671510773764, 1308327671447859201, 'gen_test_data', 'email', 'VARCHAR', '邮箱', 'email', 'String', NULL, false, true, true, true, false, '=', 'text', NULL, NULL, 4);
276
+INSERT INTO gen_table_field(id, table_id, table_name, column_name, column_type, column_comment, attr_name, attr_type, package_name, is_pk, is_required, is_form, is_list, is_query, query_type, form_type, dict_name, validator_type, sort) VALUES (1308327671514968065, 1308327671447859201, 'gen_test_data', 'notice_type', 'TINYINT', '类型', 'noticeType', 'Integer', NULL, false, true, true, true, false, '=', 'radio', 'notice_type', NULL, 5);
277
+INSERT INTO gen_table_field(id, table_id, table_name, column_name, column_type, column_comment, attr_name, attr_type, package_name, is_pk, is_required, is_form, is_list, is_query, query_type, form_type, dict_name, validator_type, sort) VALUES (1308327671514968066, 1308327671447859201, 'gen_test_data', 'content', 'TEXT', '内容', 'content', 'String', NULL, false, true, true, false, false, '=', 'editor', NULL, NULL, 6);
278
+INSERT INTO gen_table_field(id, table_id, table_name, column_name, column_type, column_comment, attr_name, attr_type, package_name, is_pk, is_required, is_form, is_list, is_query, query_type, form_type, dict_name, validator_type, sort) VALUES (1308327671514968067, 1308327671447859201, 'gen_test_data', 'creator', 'BIGINT', '创建者', 'creator', 'Long', NULL, false, false, false, false, false, '=', 'text', NULL, NULL, 7);
279
+INSERT INTO gen_table_field(id, table_id, table_name, column_name, column_type, column_comment, attr_name, attr_type, package_name, is_pk, is_required, is_form, is_list, is_query, query_type, form_type, dict_name, validator_type, sort) VALUES (1308327671514968068, 1308327671447859201, 'gen_test_data', 'create_date', 'DATETIME', '创建时间', 'createDate', 'Date', 'java.util.Date', false, false, false, true, true, '=', 'date', NULL, NULL, 8);
280
+INSERT INTO gen_table_field(id, table_id, table_name, column_name, column_type, column_comment, attr_name, attr_type, package_name, is_pk, is_required, is_form, is_list, is_query, query_type, form_type, dict_name, validator_type, sort) VALUES (1308327671514968069, 1308327671447859201, 'gen_test_data', 'updater', 'BIGINT', '更新者', 'updater', 'Long', NULL, false, false, false, false, false, '=', 'text', NULL, NULL, 9);
281
+INSERT INTO gen_table_field(id, table_id, table_name, column_name, column_type, column_comment, attr_name, attr_type, package_name, is_pk, is_required, is_form, is_list, is_query, query_type, form_type, dict_name, validator_type, sort) VALUES (1308327671523356674, 1308327671447859201, 'gen_test_data', 'update_date', 'DATETIME', '更新时间', 'updateDate', 'Date', 'java.util.Date', false, false, false, false, false, '=', 'text', NULL, NULL, 10);
282
+
283
+
284
+INSERT INTO gen_template(id, name, file_name, content, path, status, create_date) VALUES (1144564443498168321, 'Entity.java', '${ClassName}Entity.java', '', '${backendPath}/src/main/java/${packagePath}/modules/${moduleName}/entity/${subModuleName!}', 0, now());
285
+INSERT INTO gen_template(id, name, file_name, content, path, status, create_date) VALUES (1151104918417948674, 'Dao.java', '${ClassName}Dao.java', '', '${backendPath}/src/main/java/${packagePath}/modules/${moduleName}/dao/${subModuleName!}', 0, now());
286
+INSERT INTO gen_template(id, name, file_name, content, path, status, create_date) VALUES (1222102542519422977, 'Dao.xml', '${ClassName}Dao.xml', '', '${backendPath}/src/main/resources/mapper/${moduleName}', 0, now());
287
+INSERT INTO gen_template(id, name, file_name, content, path, status, create_date) VALUES (1222811087900602369, 'Service.java', '${ClassName}Service.java', '', '${backendPath}/src/main/java/${packagePath}/modules/${moduleName}/service/${subModuleName!}', 0, now());
288
+INSERT INTO gen_template(id, name, file_name, content, path, status, create_date) VALUES (1222811738672033793, 'ServiceImpl.java', '${ClassName}ServiceImpl.java', '', '${backendPath}/src/main/java/${packagePath}/modules/${moduleName}/service/${subModuleName!}/impl', 0, now());
289
+INSERT INTO gen_template(id, name, file_name, content, path, status, create_date) VALUES (1222814109661753346, 'Excel.java', '${ClassName}Excel.java', '', '${backendPath}/src/main/java/${packagePath}/modules/${moduleName}/excel/${subModuleName!}', 0, now());
290
+INSERT INTO gen_template(id, name, file_name, content, path, status, create_date) VALUES (1222816187301851138, 'DTO.java', '${ClassName}DTO.java', '', '${backendPath}/src/main/java/${packagePath}/modules/${moduleName}/dto/${subModuleName!}', 0, now());
291
+INSERT INTO gen_template(id, name, file_name, content, path, status, create_date) VALUES (1222817622663983106, 'Controller.java', '${ClassName}Controller.java', '', '${backendPath}/src/main/java/${packagePath}/modules/${moduleName}/controller/${subModuleName!}', 0, now());
292
+INSERT INTO gen_template(id, name, file_name, content, path, status, create_date) VALUES (1304292858898309122, 'list.vue', '${classname}.vue', '', '${frontendPath}/src/views/modules/${moduleName}', 0, now());
293
+INSERT INTO gen_template(id, name, file_name, content, path, status, create_date) VALUES (1304293015698169857, 'add-or-update.vue', '${classname}-add-or-update.vue', '', '${frontendPath}/src/views/modules/${moduleName}', 0, now());
294
+
295
+
296
+
297
+INSERT INTO gen_test_data(id, username, real_name, gender, email, notice_type, content, creator, create_date, updater, update_date) VALUES (1067246875800000001, 'sunlightcs', 'Mark', 0, 'root@admin.163.com', 0, '<p>智汇口腔代码生成器!</p>', 1067246875800000001, now(), 1067246875800000001, now());

+ 209 - 0
eitc-admin/db/generator/sqlserver.sql

@@ -0,0 +1,209 @@
1
+CREATE TABLE gen_datasource (
2
+    id bigint NOT NULL,
3
+    db_type varchar(200),
4
+    conn_name varchar(200),
5
+    conn_url varchar(500),
6
+    username varchar(200),
7
+    password varchar(200),
8
+    status int,
9
+    create_date datetime,
10
+    primary key (id)
11
+);
12
+
13
+
14
+CREATE TABLE gen_field_type (
15
+    id bigint NOT NULL,
16
+    column_type varchar(200),
17
+    attr_type varchar(200),
18
+    package_name varchar(200),
19
+    create_date datetime,
20
+    primary key (id)
21
+);
22
+
23
+CREATE UNIQUE INDEX uk_gen_field_type_column_type on gen_field_type(column_type);
24
+
25
+
26
+CREATE TABLE gen_base_class (
27
+    id bigint NOT NULL,
28
+    package_name varchar(200),
29
+    code varchar(200),
30
+    fields varchar(200),
31
+    remark varchar(200),
32
+    create_date datetime,
33
+    primary key (id)
34
+);
35
+
36
+
37
+CREATE TABLE gen_table_info (
38
+    id bigint NOT NULL,
39
+    table_name varchar(200),
40
+    class_name varchar(200),
41
+    table_comment varchar(200),
42
+    author varchar(200),
43
+    email varchar(200),
44
+    package_name varchar(200),
45
+    version varchar(200),
46
+    backend_path varchar(500),
47
+    frontend_path varchar(500),
48
+    module_name varchar(200),
49
+    sub_module_name varchar(200),
50
+    datasource_id bigint,
51
+    baseclass_id bigint,
52
+    create_date datetime,
53
+    primary key (id)
54
+);
55
+
56
+CREATE UNIQUE INDEX uk_gen_table_info_table_name on gen_table_info(table_name);
57
+
58
+
59
+CREATE TABLE gen_table_field (
60
+    id bigint NOT NULL,
61
+    table_id bigint,
62
+    table_name varchar(200),
63
+    column_name varchar(200),
64
+    column_type varchar(200),
65
+    column_comment varchar(200),
66
+    attr_name varchar(200),
67
+    attr_type varchar(200),
68
+    package_name varchar(200),
69
+    is_pk int,
70
+    is_required int,
71
+    is_form int,
72
+    is_list int,
73
+    is_query int,
74
+    query_type varchar(200),
75
+    form_type varchar(200),
76
+    dict_name varchar(200),
77
+    validator_type varchar(200),
78
+    sort int,
79
+    primary key (id)
80
+);
81
+
82
+CREATE INDEX idx_gen_table_field_table_name on gen_table_field(table_name);
83
+
84
+
85
+CREATE TABLE gen_template (
86
+    id bigint NOT NULL,
87
+    name varchar(200),
88
+    file_name varchar(200),
89
+    content text,
90
+    path varchar(500),
91
+    status int,
92
+    create_date datetime,
93
+    primary key (id)
94
+);
95
+
96
+
97
+CREATE TABLE gen_test_data (
98
+    id bigint NOT NULL,
99
+    username varchar(50),
100
+    real_name varchar(50),
101
+    gender int,
102
+    email varchar(100),
103
+    notice_type int,
104
+    content text,
105
+    creator bigint,
106
+    create_date datetime,
107
+    updater bigint,
108
+    update_date datetime,
109
+    PRIMARY KEY (id)
110
+);
111
+
112
+
113
+
114
+INSERT INTO sys_menu(id, pid, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1302850622416084993, 0, '', '', 0, 'icon-rocket', 3, 1067246875800000001, getdate(), 1067246875800000001, getdate());
115
+INSERT INTO sys_menu(id, pid, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1302850783288614913, 1305532398162145281, 'devtools/datasource', '', 0, 'icon-sync', 0, 1067246875800000001, getdate(), 1067246875800000001, getdate());
116
+INSERT INTO sys_menu(id, pid, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1302862890696564738, 1305532398162145281, 'devtools/fieldtype', '', 0, 'icon-eye', 1, 1067246875800000001, getdate(), 1067246875800000001, getdate());
117
+INSERT INTO sys_menu(id, pid, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1302874751835848705, 1305532398162145281, 'devtools/baseclass', '', 0, 'icon-info-circle', 3, 1067246875800000001, getdate(), 1067246875800000001, getdate());
118
+INSERT INTO sys_menu(id, pid, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1304081184014635010, 1305532398162145281, 'devtools/template', '', 0, 'icon-up-circle', 3, 1067246875800000001, getdate(), 1067246875800000001, getdate());
119
+INSERT INTO sys_menu(id, pid, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1304802103569809410, 1302850622416084993, 'devtools/generator', '', 0, 'icon-tags', 0, 1067246875800000001, getdate(), 1067246875800000001, getdate());
120
+INSERT INTO sys_menu(id, pid, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1305513187675144193, 1305532398162145281, 'devtools/param', '', 0, 'icon-setting', 5, 1067246875800000001, getdate(), 1067246875800000001, getdate());
121
+INSERT INTO sys_menu(id, pid, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1305532398162145281, 1302850622416084993, '', '', 0, 'icon-setting', 3, 1067246875800000001, getdate(), 1067246875800000001, getdate());
122
+
123
+INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1302850622416084993, 'name', 'DevTools', 'en-US');
124
+INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1302850622416084993, 'name', '开发者工具', 'zh-CN');
125
+INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1302850622416084993, 'name', '開發者工具', 'zh-TW');
126
+INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1302850783288614913, 'name', 'DataSource', 'en-US');
127
+INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1302850783288614913, 'name', '数据源管理', 'zh-CN');
128
+INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1302850783288614913, 'name', '數據源管理', 'zh-TW');
129
+INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1302862890696564738, 'name', 'Field Management', 'en-US');
130
+INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1302862890696564738, 'name', '字段管理', 'zh-CN');
131
+INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1302862890696564738, 'name', '字段管理', 'zh-TW');
132
+INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1302874751835848705, 'name', 'BaseClass', 'en-US');
133
+INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1302874751835848705, 'name', '基类管理', 'zh-CN');
134
+INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1302874751835848705, 'name', '基類管理', 'zh-TW');
135
+INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1304081184014635010, 'name', 'Template', 'en-US');
136
+INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1304081184014635010, 'name', '模板管理', 'zh-CN');
137
+INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1304081184014635010, 'name', '模板管理', 'zh-TW');
138
+INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1304802103569809410, 'name', 'Code Generation', 'en-US');
139
+INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1304802103569809410, 'name', '代码生成工具', 'zh-CN');
140
+INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1304802103569809410, 'name', '代碼生成工具', 'zh-TW');
141
+INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1305513187675144193, 'name', 'Parameter Config', 'en-US');
142
+INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1305513187675144193, 'name', '参数配置', 'zh-CN');
143
+INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1305513187675144193, 'name', '參數配置', 'zh-TW');
144
+INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1305532398162145281, 'name', 'Config Info', 'en-US');
145
+INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1305532398162145281, 'name', '配置信息', 'zh-CN');
146
+INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1305532398162145281, 'name', '配置信息', 'zh-TW');
147
+
148
+INSERT INTO sys_params(id, param_code, param_value, param_type, remark, creator, create_date, updater, update_date) VALUES (1067246875800000072, 'DEV_TOOLS_PARAM_KEY', '{"packageName":"com.eitc","version":"3.0","author":"Mark","email":"eitc@163.com","backendPath":"D:\\adminio\\eitc-erm-tenant\\eitc-admin","frontendPath":"D:\\adminio\\eitc-erm-tenant-admin"}', 0, '代码生成器配置信息', 1067246875800000001, getdate(), 1067246875800000001, getdate());
149
+
150
+INSERT INTO gen_base_class(id, package_name, code, fields, remark, create_date) VALUES (1302875019642159105, '${package}.common.entity.BaseEntity', 'BaseEntity', 'id,creator,create_date', '专业版', getdate());
151
+INSERT INTO gen_datasource(id, db_type, conn_name, conn_url, username, password, status, create_date) VALUES (1302855887882412034, 'MySQL', '本地', 'jdbc:mysql://localhost:3306/security_enterprise?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true', 'admin', '123456', 0, getdate());
152
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152452777352425473, 'datetime', 'Date', 'java.util.Date', getdate());
153
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152453412995002369, 'date', 'Date', 'java.util.Date', getdate());
154
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152453603525455873, 'tinyint', 'Integer', NULL, getdate());
155
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152453660052090881, 'smallint', 'Integer', NULL, getdate());
156
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152453722136178689, 'mediumint', 'Integer', NULL, getdate());
157
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152453808874385409, 'int', 'Integer', NULL, getdate());
158
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152453849735294977, 'integer', 'Integer', NULL, getdate());
159
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152453895029583873, 'bigint', 'Long', NULL, getdate());
160
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152453931373228033, 'float', 'Float', NULL, getdate());
161
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152453967880450050, 'double', 'Double', NULL, getdate());
162
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152454047601586177, 'decimal', 'BigDecimal', 'java.math.BigDecimal', getdate());
163
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152454090760974338, 'bit', 'Boolean', NULL, getdate());
164
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152454147010785282, 'char', 'String', NULL, getdate());
165
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152454183136325633, 'varchar', 'String', NULL, getdate());
166
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152454312664821761, 'tinytext', 'String', NULL, getdate());
167
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152454343820111874, 'text', 'String', NULL, getdate());
168
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152454372077137921, 'mediumtext', 'String', NULL, getdate());
169
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152454401378545665, 'longtext', 'String', NULL, getdate());
170
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152454486267064322, 'timestamp', 'Date', 'java.util.Date', getdate());
171
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152454630295269378, 'NUMBER', 'Integer', NULL, getdate());
172
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152454715645161474, 'BINARY_INTEGER', 'Integer', NULL, getdate());
173
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152454778828156930, 'BINARY_FLOAT', 'Float', NULL, getdate());
174
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152454828987838466, 'BINARY_DOUBLE', 'Double', NULL, getdate());
175
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152454885745160193, 'VARCHAR2', 'String', NULL, getdate());
176
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152454919756771329, 'NVARCHAR', 'String', NULL, getdate());
177
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152454952568811521, 'NVARCHAR2', 'String', NULL, getdate());
178
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152454986349735938, 'CLOB', 'String', NULL, getdate());
179
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152455109695827970, 'int8', 'Long', NULL, getdate());
180
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152455153002016770, 'int4', 'Integer', NULL, getdate());
181
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152455184669011969, 'int2', 'Integer', NULL, getdate());
182
+INSERT INTO gen_field_type(id, column_type, attr_type, package_name, create_date) VALUES (1152455217359417345, 'numeric', 'BigDecimal', 'java.math.BigDecimal', getdate());
183
+
184
+INSERT INTO gen_table_info(id, table_name, class_name, table_comment, author, email, package_name, version, backend_path, frontend_path, module_name, sub_module_name, datasource_id, baseclass_id, create_date) VALUES (1308327671447859201, 'gen_test_data', 'TestData', '测试功能', 'Mark', 'eitc@163.com', 'com.eitc', '3.0', 'D:\\adminio\\eitc-erm-tenant\\eitc-admin', 'D:\\adminio\\eitc-erm-tenant-admin', 'gen', NULL, 0, 1302875019642159105, getdate());
185
+
186
+INSERT INTO gen_table_field(id, table_id, table_name, column_name, column_type, column_comment, attr_name, attr_type, package_name, is_pk, is_required, is_form, is_list, is_query, query_type, form_type, dict_name, validator_type, sort) VALUES (1308327671502385153, 1308327671447859201, 'gen_test_data', 'id', 'BIGINT', 'id', 'id', 'Long', NULL, 1, 0, 0, 0, 0, '=', 'text', NULL, NULL, 0);
187
+INSERT INTO gen_table_field(id, table_id, table_name, column_name, column_type, column_comment, attr_name, attr_type, package_name, is_pk, is_required, is_form, is_list, is_query, query_type, form_type, dict_name, validator_type, sort) VALUES (1308327671510773761, 1308327671447859201, 'gen_test_data', 'username', 'VARCHAR', '用户名', 'username', 'String', NULL, 0, 1, 1, 1, 1, 'like', 'text', NULL, NULL, 1);
188
+INSERT INTO gen_table_field(id, table_id, table_name, column_name, column_type, column_comment, attr_name, attr_type, package_name, is_pk, is_required, is_form, is_list, is_query, query_type, form_type, dict_name, validator_type, sort) VALUES (1308327671510773762, 1308327671447859201, 'gen_test_data', 'real_name', 'VARCHAR', '姓名', 'realName', 'String', NULL, 0, 1, 1, 1, 0, 'like', 'text', NULL, NULL, 2);
189
+INSERT INTO gen_table_field(id, table_id, table_name, column_name, column_type, column_comment, attr_name, attr_type, package_name, is_pk, is_required, is_form, is_list, is_query, query_type, form_type, dict_name, validator_type, sort) VALUES (1308327671510773763, 1308327671447859201, 'gen_test_data', 'gender', 'TINYINT', '性别', 'gender', 'Integer', NULL, 0, 1, 1, 1, 1, '=', 'select', 'gender', NULL, 3);
190
+INSERT INTO gen_table_field(id, table_id, table_name, column_name, column_type, column_comment, attr_name, attr_type, package_name, is_pk, is_required, is_form, is_list, is_query, query_type, form_type, dict_name, validator_type, sort) VALUES (1308327671510773764, 1308327671447859201, 'gen_test_data', 'email', 'VARCHAR', '邮箱', 'email', 'String', NULL, 0, 1, 1, 1, 0, '=', 'text', NULL, NULL, 4);
191
+INSERT INTO gen_table_field(id, table_id, table_name, column_name, column_type, column_comment, attr_name, attr_type, package_name, is_pk, is_required, is_form, is_list, is_query, query_type, form_type, dict_name, validator_type, sort) VALUES (1308327671514968065, 1308327671447859201, 'gen_test_data', 'notice_type', 'TINYINT', '类型', 'noticeType', 'Integer', NULL, 0, 1, 1, 1, 0, '=', 'radio', 'notice_type', NULL, 5);
192
+INSERT INTO gen_table_field(id, table_id, table_name, column_name, column_type, column_comment, attr_name, attr_type, package_name, is_pk, is_required, is_form, is_list, is_query, query_type, form_type, dict_name, validator_type, sort) VALUES (1308327671514968066, 1308327671447859201, 'gen_test_data', 'content', 'TEXT', '内容', 'content', 'String', NULL, 0, 1, 1, 0, 0, '=', 'editor', NULL, NULL, 6);
193
+INSERT INTO gen_table_field(id, table_id, table_name, column_name, column_type, column_comment, attr_name, attr_type, package_name, is_pk, is_required, is_form, is_list, is_query, query_type, form_type, dict_name, validator_type, sort) VALUES (1308327671514968067, 1308327671447859201, 'gen_test_data', 'creator', 'BIGINT', '创建者', 'creator', 'Long', NULL, 0, 0, 0, 0, 0, '=', 'text', NULL, NULL, 7);
194
+INSERT INTO gen_table_field(id, table_id, table_name, column_name, column_type, column_comment, attr_name, attr_type, package_name, is_pk, is_required, is_form, is_list, is_query, query_type, form_type, dict_name, validator_type, sort) VALUES (1308327671514968068, 1308327671447859201, 'gen_test_data', 'create_date', 'DATETIME', '创建时间', 'createDate', 'Date', 'java.util.Date', 0, 0, 0, 1, 1, '=', 'date', NULL, NULL, 8);
195
+INSERT INTO gen_table_field(id, table_id, table_name, column_name, column_type, column_comment, attr_name, attr_type, package_name, is_pk, is_required, is_form, is_list, is_query, query_type, form_type, dict_name, validator_type, sort) VALUES (1308327671514968069, 1308327671447859201, 'gen_test_data', 'updater', 'BIGINT', '更新者', 'updater', 'Long', NULL, 0, 0, 0, 0, 0, '=', 'text', NULL, NULL, 9);
196
+INSERT INTO gen_table_field(id, table_id, table_name, column_name, column_type, column_comment, attr_name, attr_type, package_name, is_pk, is_required, is_form, is_list, is_query, query_type, form_type, dict_name, validator_type, sort) VALUES (1308327671523356674, 1308327671447859201, 'gen_test_data', 'update_date', 'DATETIME', '更新时间', 'updateDate', 'Date', 'java.util.Date', 0, 0, 0, 0, 0, '=', 'text', NULL, NULL, 10);
197
+
198
+INSERT INTO gen_template(id, name, file_name, content, path, status, create_date) VALUES (1144564443498168321, 'Entity.java', '${ClassName}Entity.java', '', '${backendPath}/src/main/java/${packagePath}/modules/${moduleName}/entity/${subModuleName!}', 0, getdate());
199
+INSERT INTO gen_template(id, name, file_name, content, path, status, create_date) VALUES (1151104918417948674, 'Dao.java', '${ClassName}Dao.java', '', '${backendPath}/src/main/java/${packagePath}/modules/${moduleName}/dao/${subModuleName!}', 0, getdate());
200
+INSERT INTO gen_template(id, name, file_name, content, path, status, create_date) VALUES (1222102542519422977, 'Dao.xml', '${ClassName}Dao.xml', '', '${backendPath}/src/main/resources/mapper/${moduleName}', 0, getdate());
201
+INSERT INTO gen_template(id, name, file_name, content, path, status, create_date) VALUES (1222811087900602369, 'Service.java', '${ClassName}Service.java', '', '${backendPath}/src/main/java/${packagePath}/modules/${moduleName}/service/${subModuleName!}', 0, getdate());
202
+INSERT INTO gen_template(id, name, file_name, content, path, status, create_date) VALUES (1222811738672033793, 'ServiceImpl.java', '${ClassName}ServiceImpl.java', '', '${backendPath}/src/main/java/${packagePath}/modules/${moduleName}/service/${subModuleName!}/impl', 0, getdate());
203
+INSERT INTO gen_template(id, name, file_name, content, path, status, create_date) VALUES (1222814109661753346, 'Excel.java', '${ClassName}Excel.java', '', '${backendPath}/src/main/java/${packagePath}/modules/${moduleName}/excel/${subModuleName!}', 0, getdate());
204
+INSERT INTO gen_template(id, name, file_name, content, path, status, create_date) VALUES (1222816187301851138, 'DTO.java', '${ClassName}DTO.java', '', '${backendPath}/src/main/java/${packagePath}/modules/${moduleName}/dto/${subModuleName!}', 0, getdate());
205
+INSERT INTO gen_template(id, name, file_name, content, path, status, create_date) VALUES (1222817622663983106, 'Controller.java', '${ClassName}Controller.java', '', '${backendPath}/src/main/java/${packagePath}/modules/${moduleName}/controller/${subModuleName!}', 0, getdate());
206
+INSERT INTO gen_template(id, name, file_name, content, path, status, create_date) VALUES (1304292858898309122, 'list.vue', '${classname}.vue', '', '${frontendPath}/src/views/modules/${moduleName}', 0, getdate());
207
+INSERT INTO gen_template(id, name, file_name, content, path, status, create_date) VALUES (1304293015698169857, 'add-or-update.vue', '${classname}-add-or-update.vue', '', '${frontendPath}/src/views/modules/${moduleName}', 0, getdate());
208
+
209
+INSERT INTO gen_test_data(id, username, real_name, gender, email, notice_type, content, creator, create_date, updater, update_date) VALUES (1067246875800000001, 'sunlightcs', 'Mark', 0, 'root@admin.163.com', 0, '<p>智汇口腔代码生成器!</p>', 1067246875800000001, getdate(), 1067246875800000001, getdate());

renren-admin/db/generator/template/Controller.java.ftl → eitc-admin/db/generator/template/Controller.java.ftl


renren-admin/db/generator/template/DTO.java.ftl → eitc-admin/db/generator/template/DTO.java.ftl


renren-admin/db/generator/template/Dao.java.ftl → eitc-admin/db/generator/template/Dao.java.ftl


renren-admin/db/generator/template/Dao.xml.ftl → eitc-admin/db/generator/template/Dao.xml.ftl


renren-admin/db/generator/template/Entity.java.ftl → eitc-admin/db/generator/template/Entity.java.ftl


renren-admin/db/generator/template/Excel.java.ftl → eitc-admin/db/generator/template/Excel.java.ftl


renren-admin/db/generator/template/Service.java.ftl → eitc-admin/db/generator/template/Service.java.ftl


renren-admin/db/generator/template/ServiceImpl.java.ftl → eitc-admin/db/generator/template/ServiceImpl.java.ftl


+ 241 - 0
eitc-admin/db/generator/template/add-or-update.vue.ftl

@@ -0,0 +1,241 @@
1
+<#assign editor=false/>
2
+<template>
3
+  <el-dialog :visible.sync="visible" :title="!dataForm.${pk.attrName} ? $t('add') : $t('update')" :close-on-click-modal="false" :close-on-press-escape="false">
4
+    <el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmitHandle()" :label-width="$i18n.locale === 'en-US' ? '120px' : '80px'">
5
+<#list columnList as column>
6
+  <#if column.form>
7
+      <#if column.formType == 'text'>
8
+      <el-form-item label="${column.comment!}" prop="${column.attrName}">
9
+        <el-input v-model="dataForm.${column.attrName}" placeholder="${column.comment!}"></el-input>
10
+      </el-form-item>
11
+      <#elseif column.formType == 'textarea'>
12
+      <el-form-item label="${column.comment!}" prop="${column.attrName}">
13
+        <el-input type="textarea" v-model="dataForm.${column.attrName}"></el-input>
14
+      </el-form-item>
15
+      <#elseif column.formType == 'editor'>
16
+      <el-form-item label="${column.comment!}" prop="${column.attrName}">
17
+        <!-- 富文本编辑器, 容器 -->
18
+        <div id="J_quillEditor"></div>
19
+        <!-- 自定义上传图片功能 (使用element upload组件) -->
20
+        <el-upload
21
+          :action="uploadUrl"
22
+          :show-file-list="false"
23
+          :before-upload="uploadBeforeUploadHandle"
24
+          :on-success="uploadSuccessHandle"
25
+          style="display: none;">
26
+          <el-button ref="uploadBtn" type="primary" size="small">{{ $t('upload.button') }}</el-button>
27
+        </el-upload>
28
+      </el-form-item>
29
+      <#assign editor=true/>
30
+      <#assign editorName="${column.attrName}"/>
31
+      <#elseif column.formType == 'select'>
32
+      <#if column.dictName??>
33
+      <el-form-item label="${column.comment!}" prop="${column.attrName}">
34
+        <ren-select v-model="dataForm.${column.attrName}" dict-type="${column.dictName}" placeholder="${column.comment!}"></ren-select>
35
+      </el-form-item>
36
+      <#else>
37
+      <el-form-item label="${column.comment!}" prop="${column.attrName}">
38
+        <el-select v-model="dataForm.${column.attrName}" placeholder="请选择">
39
+          <el-option label="智汇口腔" value="0"></el-option>
40
+        </el-select>
41
+      </el-form-item>
42
+      </#if>
43
+      <#elseif column.formType == 'radio'>
44
+      <#if column.dictName??>
45
+      <el-form-item label="${column.comment!}" prop="${column.attrName}">
46
+        <ren-radio-group v-model="dataForm.${column.attrName}" dict-type="${column.dictName}"></ren-radio-group>
47
+      </el-form-item>
48
+      <#else>
49
+      <el-form-item label="${column.comment!}" prop="${column.attrName}">
50
+        <el-radio-group v-model="dataForm.${column.attrName}">
51
+          <el-radio :label="0">启用</el-radio>
52
+          <el-radio :label="1">禁用</el-radio>
53
+        </el-radio-group>
54
+      </el-form-item>
55
+      </#if>
56
+      <#elseif column.formType == 'checkbox'>
57
+      <el-form-item label="${column.comment!}" prop="${column.attrName}">
58
+        <el-checkbox-group v-model="dataForm.${column.attrName}">
59
+          <el-checkbox label="启用" name="type"></el-checkbox>
60
+          <el-checkbox label="禁用" name="type"></el-checkbox>
61
+        </el-checkbox-group>
62
+      </el-form-item>
63
+      <#elseif column.formType == 'date'>
64
+      <el-form-item label="${column.comment!}" prop="${column.attrName}">
65
+        <el-date-picker type="date" placeholder="${column.comment!}" v-model="dataForm.${column.attrName}"></el-date-picker>
66
+      </el-form-item>
67
+      <#elseif column.formType == 'datetime'>
68
+      <el-form-item label="${column.comment!}" prop="${column.attrName}">
69
+        <el-date-picker type="datetime" placeholder="${column.comment!}" v-model="dataForm.${column.attrName}"></el-date-picker>
70
+      </el-form-item>
71
+      <#else>
72
+      <el-form-item label="${column.comment!}" prop="${column.attrName}">
73
+        <el-input v-model="dataForm.${column.attrName}" placeholder="${column.comment!}"></el-input>
74
+      </el-form-item>
75
+      </#if>
76
+  </#if>
77
+</#list>
78
+    </el-form>
79
+    <template slot="footer">
80
+      <el-button @click="visible = false">{{ $t('cancel') }}</el-button>
81
+      <el-button type="primary" @click="dataFormSubmitHandle()">{{ $t('confirm') }}</el-button>
82
+    </template>
83
+  </el-dialog>
84
+</template>
85
+
86
+<script>
87
+import debounce from 'lodash/debounce'
88
+<#if editor>
89
+import Cookies from 'js-cookie'
90
+import 'quill/dist/quill.snow.css'
91
+import Quill from 'quill'
92
+</#if>
93
+export default {
94
+  data () {
95
+    return {
96
+      visible: false,
97
+      <#if editor>
98
+      quillEditor: null,
99
+      quillEditorToolbarOptions: [
100
+        ['bold', 'italic', 'underline', 'strike'],
101
+        ['blockquote', 'code-block', 'image'],
102
+        [{ 'header': 1 }, { 'header': 2 }],
103
+        [{ 'list': 'ordered' }, { 'list': 'bullet' }],
104
+        [{ 'script': 'sub' }, { 'script': 'super' }],
105
+        [{ 'indent': '-1' }, { 'indent': '+1' }],
106
+        [{ 'direction': 'rtl' }],
107
+        [{ 'size': ['small', false, 'large', 'huge'] }],
108
+        [{ 'header': [1, 2, 3, 4, 5, 6, false] }],
109
+        [{ 'color': [] }, { 'background': [] }],
110
+        [{ 'font': [] }],
111
+        [{ 'align': [] }],
112
+        ['clean']
113
+      ],
114
+      uploadUrl: '',
115
+      </#if>
116
+      dataForm: {
117
+<#list columnList as column>
118
+        ${column.attrName}: '',
119
+</#list>
120
+      }
121
+    }
122
+  },
123
+  computed: {
124
+    dataRule () {
125
+      <#if editor>
126
+      const validate${editorName} = (rule, value, callback) => {
127
+        if (this.quillEditor.getLength() <= 1) {
128
+          return callback(new Error(this.$t('validate.required')))
129
+        }
130
+        callback()
131
+      }
132
+      </#if>
133
+      return {
134
+<#list columnList as column>
135
+<#if column.form && column.required>
136
+        <#if editor && column.attrName == editorName>
137
+        ${column.attrName}: [
138
+          { required: true, message: this.$t('validate.required'), trigger: 'blur' },
139
+          { validator: validate${editorName}, trigger: 'blur' }
140
+        ],
141
+        <#else>
142
+        ${column.attrName}: [
143
+          { required: true, message: this.$t('validate.required'), trigger: 'blur' }
144
+        ],
145
+        </#if>
146
+</#if>
147
+</#list>
148
+      }
149
+    }
150
+  },
151
+  methods: {
152
+    init () {
153
+      this.visible = true
154
+      this.$nextTick(() => {
155
+        <#if editor>
156
+        if (this.quillEditor) {
157
+          this.quillEditor.deleteText(0, this.quillEditor.getLength())
158
+        } else {
159
+          this.quillEditorHandle()
160
+        }
161
+        </#if>
162
+        this.$refs['dataForm'].resetFields()
163
+        if (this.dataForm.${pk.attrName}) {
164
+          this.getInfo()
165
+        }
166
+      })
167
+    },
168
+    // 获取信息
169
+    getInfo () {
170
+      this.$http.get('/${moduleName}/${classname}/' + this.dataForm.${pk.attrName}).then(({ data: res }) => {
171
+        if (res.code !== 0) {
172
+          return this.$message.error(res.msg)
173
+        }
174
+        this.dataForm = {
175
+          ...this.dataForm,
176
+          ...res.data
177
+        }
178
+        <#if editor>
179
+        this.quillEditor.root.innerHTML = this.dataForm.${editorName}
180
+        </#if>
181
+      }).catch(() => {})
182
+    },
183
+    <#if editor>
184
+    // 富文本编辑器
185
+    quillEditorHandle () {
186
+      this.quillEditor = new Quill('#J_quillEditor', {
187
+        modules: {
188
+          toolbar: this.quillEditorToolbarOptions
189
+        },
190
+        theme: 'snow'
191
+      })
192
+      // 自定义上传图片功能 (使用element upload组件)
193
+      this.uploadUrl = window.SITE_CONFIG['apiURL'] + '/sys/oss/upload?token=' + Cookies.get('token')
194
+      this.quillEditor.getModule('toolbar').addHandler('image', () => {
195
+        this.$refs.uploadBtn.$el.click()
196
+      })
197
+      // 监听内容变化,动态赋值
198
+      this.quillEditor.on('text-change', () => {
199
+        this.dataForm.${editorName} = this.quillEditor.root.innerHTML
200
+      })
201
+    },
202
+    // 上传图片之前
203
+    uploadBeforeUploadHandle (file) {
204
+      if (file.type !== 'image/jpg' && file.type !== 'image/jpeg' && file.type !== 'image/png' && file.type !== 'image/gif') {
205
+        this.$message.error('只支持jpg、png、gif格式的图片!')
206
+        return false
207
+      }
208
+    },
209
+    // 上传图片成功
210
+    uploadSuccessHandle (res, file, fileList) {
211
+      if (res.code !== 0) {
212
+        return this.$message.error(res.msg)
213
+      }
214
+      this.quillEditor.insertEmbed(this.quillEditor.getSelection().index, 'image', res.data.src)
215
+    },
216
+    </#if>
217
+    // 表单提交
218
+    dataFormSubmitHandle: debounce(function () {
219
+      this.$refs['dataForm'].validate((valid) => {
220
+        if (!valid) {
221
+          return false
222
+        }
223
+        this.$http[!this.dataForm.${pk.attrName} ? 'post' : 'put']('/${moduleName}/${classname}/', this.dataForm).then(({ data: res }) => {
224
+          if (res.code !== 0) {
225
+            return this.$message.error(res.msg)
226
+          }
227
+          this.$message({
228
+            message: this.$t('prompt.success'),
229
+            type: 'success',
230
+            duration: 500,
231
+            onClose: () => {
232
+              this.visible = false
233
+              this.$emit('refreshDataList')
234
+            }
235
+          })
236
+        }).catch(() => {})
237
+      })
238
+    }, 1000, { 'leading': true, 'trailing': false })
239
+  }
240
+}
241
+</script>

renren-admin/db/generator/template/list.vue.ftl → eitc-admin/db/generator/template/list.vue.ftl


File diff suppressed because it is too large
+ 1058 - 0
eitc-admin/db/mysql.sql


File diff suppressed because it is too large
+ 1391 - 0
eitc-admin/db/oracle.sql


File diff suppressed because it is too large
+ 1401 - 0
eitc-admin/db/postgresql.sql


renren-admin/db/region_data/mysql.sql → eitc-admin/db/region_data/mysql.sql


renren-admin/db/region_data/oracle.sql → eitc-admin/db/region_data/oracle.sql


renren-admin/db/region_data/postgresql.sql → eitc-admin/db/region_data/postgresql.sql


renren-admin/db/region_data/sqlserver.sql → eitc-admin/db/region_data/sqlserver.sql


File diff suppressed because it is too large
+ 1223 - 0
eitc-admin/db/sqlserver.sql


+ 232 - 0
eitc-admin/pom.xml

@@ -0,0 +1,232 @@
1
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
2
+	<parent>
3
+		<groupId>com.eitc</groupId>
4
+		<artifactId>eitc-erm-tenant</artifactId>
5
+		<version>1.0.1</version>
6
+	</parent>
7
+	<modelVersion>4.0.0</modelVersion>
8
+	<artifactId>eitc-admin</artifactId>
9
+	<packaging>jar</packaging>
10
+	<description>eitc-admin</description>
11
+
12
+	<properties>
13
+		<quartz.version>2.3.0</quartz.version>
14
+		<shiro.version>1.6.0</shiro.version>
15
+		<captcha.version>1.6.2</captcha.version>
16
+		<easyexcel.version>2.2.6</easyexcel.version>
17
+		<qiniu.version>7.2.27</qiniu.version>
18
+		<aliyun.oss.version>2.8.3</aliyun.oss.version>
19
+		<aliyun.core.version>3.2.2</aliyun.core.version>
20
+		<aliyun.dysmsapi.version>1.1.0</aliyun.dysmsapi.version>
21
+		<qcloud.cos.version>5.4.4</qcloud.cos.version>
22
+		<qcloud.qcloudsms.version>1.0.5</qcloud.qcloudsms.version>
23
+		<fastdfs.version>1.26.2</fastdfs.version>
24
+		<minio.version>6.0.13</minio.version>
25
+		<mail.version>1.6.2</mail.version>
26
+		<freemarker.version>2.3.28</freemarker.version>
27
+		<activiti.version>5.22.0</activiti.version>
28
+		<ureport2.version>2.2.9</ureport2.version>
29
+	</properties>
30
+
31
+	<dependencies>
32
+		<dependency>
33
+			<groupId>com.eitc</groupId>
34
+			<artifactId>eitc-common</artifactId>
35
+			<version>1.0.1</version>
36
+		</dependency>
37
+		<dependency>
38
+			<groupId>com.eitc</groupId>
39
+			<artifactId>eitc-dynamic-datasource</artifactId>
40
+			<version>1.0.1</version>
41
+		</dependency>
42
+		<dependency>
43
+			<groupId>org.quartz-scheduler</groupId>
44
+			<artifactId>quartz</artifactId>
45
+			<version>${quartz.version}</version>
46
+			<exclusions>
47
+				<exclusion>
48
+					<groupId>com.mchange</groupId>
49
+					<artifactId>c3p0</artifactId>
50
+				</exclusion>
51
+				<exclusion>
52
+					<groupId>com.zaxxer</groupId>
53
+					<artifactId>HikariCP-java6</artifactId>
54
+				</exclusion>
55
+			</exclusions>
56
+		</dependency>
57
+		<dependency>
58
+		    <groupId>org.apache.shiro</groupId>
59
+		    <artifactId>shiro-core</artifactId>
60
+		    <version>${shiro.version}</version>
61
+		</dependency>
62
+		<dependency>
63
+		    <groupId>org.apache.shiro</groupId>
64
+		    <artifactId>shiro-spring</artifactId>
65
+		    <version>${shiro.version}</version>
66
+		</dependency>
67
+		<dependency>
68
+			<groupId>com.github.whvcse</groupId>
69
+			<artifactId>easy-captcha</artifactId>
70
+			<version>${captcha.version}</version>
71
+		</dependency>
72
+		<dependency>
73
+			<groupId>com.alibaba</groupId>
74
+			<artifactId>easyexcel</artifactId>
75
+			<version>${easyexcel.version}</version>
76
+		</dependency>
77
+		<dependency>
78
+			<groupId>com.qiniu</groupId>
79
+			<artifactId>qiniu-java-sdk</artifactId>
80
+			<version>${qiniu.version}</version>
81
+		</dependency>
82
+		<dependency>
83
+			<groupId>com.aliyun.oss</groupId>
84
+			<artifactId>aliyun-sdk-oss</artifactId>
85
+			<version>${aliyun.oss.version}</version>
86
+		</dependency>
87
+		<dependency>
88
+			<groupId>com.qcloud</groupId>
89
+			<artifactId>cos_api</artifactId>
90
+			<version>${qcloud.cos.version}</version>
91
+			<exclusions>
92
+				<exclusion>
93
+					<groupId>org.slf4j</groupId>
94
+					<artifactId>slf4j-log4j12</artifactId>
95
+				</exclusion>
96
+			</exclusions>
97
+		</dependency>
98
+		<dependency>
99
+			<groupId>com.aliyun</groupId>
100
+			<artifactId>aliyun-java-sdk-core</artifactId>
101
+			<version>${aliyun.core.version}</version>
102
+		</dependency>
103
+		<dependency>
104
+			<groupId>com.aliyun</groupId>
105
+			<artifactId>aliyun-java-sdk-dysmsapi</artifactId>
106
+			<version>${aliyun.dysmsapi.version}</version>
107
+		</dependency>
108
+		<dependency>
109
+			<groupId>com.github.qcloudsms</groupId>
110
+			<artifactId>qcloudsms</artifactId>
111
+			<version>${qcloud.qcloudsms.version}</version>
112
+		</dependency>
113
+		<dependency>
114
+			<groupId>com.sun.mail</groupId>
115
+			<artifactId>javax.mail</artifactId>
116
+			<version>${mail.version}</version>
117
+		</dependency>
118
+		<dependency>
119
+			<groupId>org.freemarker</groupId>
120
+			<artifactId>freemarker</artifactId>
121
+			<version>${freemarker.version}</version>
122
+		</dependency>
123
+		<dependency>
124
+			<groupId>com.github.tobato</groupId>
125
+			<artifactId>fastdfs-client</artifactId>
126
+			<version>${fastdfs.version}</version>
127
+		</dependency>
128
+		<dependency>
129
+			<groupId>io.minio</groupId>
130
+			<artifactId>minio</artifactId>
131
+			<version>${minio.version}</version>
132
+		</dependency>
133
+		<dependency>
134
+			<groupId>org.springframework.boot</groupId>
135
+			<artifactId>spring-boot-starter-websocket</artifactId>
136
+		</dependency>
137
+		<!-- activiti -->
138
+		<dependency>
139
+			<groupId>org.activiti</groupId>
140
+			<artifactId>activiti-spring-boot-starter-basic</artifactId>
141
+			<version>${activiti.version}</version>
142
+			<exclusions>
143
+				<exclusion>
144
+					<groupId>org.mybatis</groupId>
145
+					<artifactId>mybatis</artifactId>
146
+				</exclusion>
147
+			</exclusions>
148
+		</dependency>
149
+		<dependency>
150
+			<groupId>org.activiti</groupId>
151
+			<artifactId>activiti-explorer</artifactId>
152
+			<version>${activiti.version}</version>
153
+			<exclusions>
154
+				<exclusion>
155
+					<artifactId>vaadin</artifactId>
156
+					<groupId>com.vaadin</groupId>
157
+				</exclusion>
158
+				<exclusion>
159
+					<artifactId>dcharts-widget</artifactId>
160
+					<groupId>org.vaadin.addons</groupId>
161
+				</exclusion>
162
+				<exclusion>
163
+					<artifactId>activiti-simple-workflow</artifactId>
164
+					<groupId>org.activiti</groupId>
165
+				</exclusion>
166
+				<exclusion>
167
+					<artifactId>slf4j-log4j12</artifactId>
168
+					<groupId>org.slf4j</groupId>
169
+				</exclusion>
170
+				<exclusion>
171
+					<artifactId>groovy-all</artifactId>
172
+					<groupId>org.codehaus.groovy</groupId>
173
+				</exclusion>
174
+			</exclusions>
175
+		</dependency>
176
+		<!-- 支持JDK11 -->
177
+		<dependency>
178
+			<groupId>org.codehaus.groovy</groupId>
179
+			<artifactId>groovy-all</artifactId>
180
+			<version>2.4.17</version>
181
+		</dependency>
182
+		<dependency>
183
+			<groupId>org.activiti</groupId>
184
+			<artifactId>activiti-diagram-rest</artifactId>
185
+			<version>${activiti.version}</version>
186
+		</dependency>
187
+		<dependency>
188
+			<groupId>org.activiti</groupId>
189
+			<artifactId>activiti-modeler</artifactId>
190
+			<version>${activiti.version}</version>
191
+		</dependency>
192
+		<!-- end activiti -->
193
+		<dependency>
194
+			<groupId>com.bstek.ureport</groupId>
195
+			<artifactId>ureport2-console</artifactId>
196
+			<version>${ureport2.version}</version>
197
+		</dependency>
198
+	</dependencies>
199
+
200
+	<build>
201
+		<finalName>${project.artifactId}</finalName>
202
+		<plugins>
203
+			<plugin>
204
+				<groupId>org.springframework.boot</groupId>
205
+				<artifactId>spring-boot-maven-plugin</artifactId>
206
+			</plugin>
207
+			<plugin>
208
+				<groupId>org.apache.maven.plugins</groupId>
209
+				<artifactId>maven-surefire-plugin</artifactId>
210
+				<configuration>
211
+					<skipTests>true</skipTests>
212
+				</configuration>
213
+			</plugin>
214
+			<plugin>
215
+				<groupId>com.spotify</groupId>
216
+				<artifactId>docker-maven-plugin</artifactId>
217
+				<version>${docker.plugin.version}</version>
218
+				<configuration>
219
+					<imageName>eitc/${project.artifactId}</imageName>
220
+					<dockerDirectory>${project.basedir}/</dockerDirectory>
221
+					<resources>
222
+						<resource>
223
+							<targetPath>/</targetPath>
224
+							<directory>${project.build.directory}</directory>
225
+							<include>${project.build.finalName}.jar</include>
226
+						</resource>
227
+					</resources>
228
+				</configuration>
229
+			</plugin>
230
+		</plugins>
231
+	</build>
232
+</project>

+ 28 - 0
eitc-admin/src/main/java/com/eitc/AdminApplication.java

@@ -0,0 +1,28 @@
1
+package com.eitc;
2
+
3
+import org.springframework.boot.SpringApplication;
4
+import org.springframework.boot.autoconfigure.SpringBootApplication;
5
+import org.springframework.boot.builder.SpringApplicationBuilder;
6
+import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
7
+
8
+
9
+/**
10
+ * eitc-admin
11
+ *
12
+ * @author Mark eitc@163.com
13
+ */
14
+@SpringBootApplication(exclude = {
15
+	org.activiti.spring.boot.SecurityAutoConfiguration.class,
16
+	org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration.class
17
+})
18
+public class AdminApplication extends SpringBootServletInitializer {
19
+
20
+	public static void main(String[] args) {
21
+		SpringApplication.run(AdminApplication.class, args);
22
+	}
23
+
24
+	@Override
25
+	protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
26
+		return application.sources(AdminApplication.class);
27
+	}
28
+}

+ 29 - 0
eitc-admin/src/main/java/com/eitc/common/annotation/DataFilter.java

@@ -0,0 +1,29 @@
1
+package com.eitc.common.annotation;
2
+
3
+import java.lang.annotation.*;
4
+
5
+/**
6
+ * 数据过滤注解
7
+ *
8
+ * @author Mark eitc@163.com
9
+ */
10
+@Target(ElementType.METHOD)
11
+@Retention(RetentionPolicy.RUNTIME)
12
+@Documented
13
+public @interface DataFilter {
14
+    /**
15
+     * 表的别名
16
+     */
17
+    String tableAlias() default "";
18
+
19
+    /**
20
+     * 用户ID
21
+     */
22
+    String userId() default "creator";
23
+
24
+    /**
25
+     * 部门ID
26
+     */
27
+    String deptId() default "dept_id";
28
+
29
+}

+ 20 - 0
eitc-admin/src/main/java/com/eitc/common/annotation/LogOperation.java

@@ -0,0 +1,20 @@
1
+package com.eitc.common.annotation;
2
+
3
+import java.lang.annotation.Documented;
4
+import java.lang.annotation.ElementType;
5
+import java.lang.annotation.Retention;
6
+import java.lang.annotation.RetentionPolicy;
7
+import java.lang.annotation.Target;
8
+
9
+/**
10
+ * 操作日志注解
11
+ *
12
+ * @author Mark eitc@163.com
13
+ */
14
+@Target(ElementType.METHOD)
15
+@Retention(RetentionPolicy.RUNTIME)
16
+@Documented
17
+public @interface LogOperation {
18
+
19
+	String value() default "";
20
+}

+ 100 - 0
eitc-admin/src/main/java/com/eitc/common/aspect/DataFilterAspect.java

@@ -0,0 +1,100 @@
1
+package com.eitc.common.aspect;
2
+
3
+import cn.hutool.core.collection.CollUtil;
4
+import com.eitc.common.annotation.DataFilter;
5
+import com.eitc.common.constant.Constant;
6
+import com.eitc.common.exception.ErrorCode;
7
+import com.eitc.common.interceptor.DataScope;
8
+import com.eitc.modules.security.user.SecurityUser;
9
+import com.eitc.modules.security.user.UserDetail;
10
+import com.eitc.modules.sys.enums.SuperAdminEnum;
11
+import com.eitc.modules.sys.enums.SuperTenantEnum;
12
+import org.apache.commons.lang3.StringUtils;
13
+import org.aspectj.lang.JoinPoint;
14
+import org.aspectj.lang.annotation.Aspect;
15
+import org.aspectj.lang.annotation.Before;
16
+import org.aspectj.lang.annotation.Pointcut;
17
+import org.aspectj.lang.reflect.MethodSignature;
18
+import org.springframework.stereotype.Component;
19
+
20
+import java.lang.reflect.Method;
21
+import java.util.List;
22
+import java.util.Map;
23
+
24
+/**
25
+ * 数据过滤,切面处理类
26
+ *
27
+ * @author Mark eitc@163.com
28
+ */
29
+@Aspect
30
+@Component
31
+public class DataFilterAspect {
32
+
33
+    @Pointcut("@annotation(com.eitc.common.annotation.DataFilter)")
34
+    public void dataFilterCut() {
35
+
36
+    }
37
+
38
+    @Before("dataFilterCut()")
39
+    public void dataFilter(JoinPoint point) {
40
+        Object params = point.getArgs()[0];
41
+        if(params != null && params instanceof Map){
42
+            UserDetail user = SecurityUser.getUser();
43
+
44
+            //如果是超级管理员或超级租户,则不进行数据过滤
45
+            if(user.getSuperAdmin() == SuperAdminEnum.YES.value() ||
46
+                user.getSuperTenant() == SuperTenantEnum.YES.value()) {
47
+                return ;
48
+            }
49
+
50
+            try {
51
+                //否则进行数据过滤
52
+                Map map = (Map)params;
53
+                String sqlFilter = getSqlFilter(user, point);
54
+                map.put(Constant.SQL_FILTER, new DataScope(sqlFilter));
55
+            }catch (Exception e){
56
+
57
+            }
58
+
59
+            return ;
60
+        }
61
+
62
+        throw new com.eitc.common.exception.RenException(ErrorCode.DATA_SCOPE_PARAMS_ERROR);
63
+    }
64
+
65
+    /**
66
+     * 获取数据过滤的SQL
67
+     */
68
+    private String getSqlFilter(UserDetail user, JoinPoint point) throws Exception {
69
+        MethodSignature signature = (MethodSignature) point.getSignature();
70
+        Method method = point.getTarget().getClass().getDeclaredMethod(signature.getName(), signature.getParameterTypes());
71
+        DataFilter dataFilter = method.getAnnotation(DataFilter.class);
72
+
73
+        //获取表的别名
74
+        String tableAlias = dataFilter.tableAlias();
75
+        if(StringUtils.isNotBlank(tableAlias)){
76
+            tableAlias +=  ".";
77
+        }
78
+
79
+        StringBuilder sqlFilter = new StringBuilder();
80
+        sqlFilter.append(" (");
81
+
82
+        //部门ID列表
83
+        List<Long> deptIdList = user.getDeptIdList();
84
+        if(CollUtil.isNotEmpty(deptIdList)){
85
+            sqlFilter.append(tableAlias).append(dataFilter.deptId());
86
+
87
+            sqlFilter.append(" in(").append(StringUtils.join(deptIdList, ",")).append(")");
88
+        }
89
+
90
+        //查询本人数据
91
+        if(CollUtil.isNotEmpty(deptIdList)){
92
+            sqlFilter.append(" or ");
93
+        }
94
+        sqlFilter.append(tableAlias).append(dataFilter.userId()).append("=").append(user.getId());
95
+
96
+        sqlFilter.append(")");
97
+
98
+        return sqlFilter.toString();
99
+    }
100
+}

+ 102 - 0
eitc-admin/src/main/java/com/eitc/common/aspect/LogOperationAspect.java

@@ -0,0 +1,102 @@
1
+package com.eitc.common.aspect;
2
+
3
+import com.alibaba.fastjson.JSON;
4
+import com.eitc.common.annotation.LogOperation;
5
+import com.eitc.common.utils.HttpContextUtils;
6
+import com.eitc.common.utils.IpUtils;
7
+import com.eitc.modules.log.entity.SysLogOperationEntity;
8
+import com.eitc.modules.log.enums.OperationStatusEnum;
9
+import com.eitc.modules.log.service.SysLogOperationService;
10
+import com.eitc.modules.security.user.SecurityUser;
11
+import com.eitc.modules.security.user.UserDetail;
12
+import org.aspectj.lang.ProceedingJoinPoint;
13
+import org.aspectj.lang.annotation.Around;
14
+import org.aspectj.lang.annotation.Aspect;
15
+import org.aspectj.lang.annotation.Pointcut;
16
+import org.aspectj.lang.reflect.MethodSignature;
17
+import org.springframework.beans.factory.annotation.Autowired;
18
+import org.springframework.http.HttpHeaders;
19
+import org.springframework.stereotype.Component;
20
+
21
+import javax.servlet.http.HttpServletRequest;
22
+import java.lang.reflect.Method;
23
+
24
+/**
25
+ * 操作日志,切面处理类
26
+ *
27
+ * @author Mark eitc@163.com
28
+ */
29
+@Aspect
30
+@Component
31
+public class LogOperationAspect {
32
+    @Autowired
33
+    private SysLogOperationService sysLogOperationService;
34
+
35
+    @Pointcut("@annotation(com.eitc.common.annotation.LogOperation)")
36
+    public void logPointCut() {
37
+
38
+    }
39
+
40
+    @Around("logPointCut()")
41
+    public Object around(ProceedingJoinPoint point) throws Throwable {
42
+        long beginTime = System.currentTimeMillis();
43
+        try {
44
+            //执行方法
45
+            Object result = point.proceed();
46
+
47
+            //执行时长(毫秒)
48
+            long time = System.currentTimeMillis() - beginTime;
49
+            //保存日志
50
+            saveLog(point, time, OperationStatusEnum.SUCCESS.value());
51
+
52
+            return result;
53
+        }catch(Exception e) {
54
+            //执行时长(毫秒)
55
+            long time = System.currentTimeMillis() - beginTime;
56
+            //保存日志
57
+            saveLog(point, time, OperationStatusEnum.FAIL.value());
58
+
59
+            throw e;
60
+        }
61
+    }
62
+
63
+    private void saveLog(ProceedingJoinPoint joinPoint, long time, Integer status) throws Exception {
64
+        MethodSignature signature = (MethodSignature) joinPoint.getSignature();
65
+        Method method = joinPoint.getTarget().getClass().getDeclaredMethod(signature.getName(), signature.getParameterTypes());
66
+        LogOperation annotation = method.getAnnotation(LogOperation.class);
67
+
68
+        SysLogOperationEntity log = new SysLogOperationEntity();
69
+        if(annotation != null){
70
+            //注解上的描述
71
+            log.setOperation(annotation.value());
72
+        }
73
+
74
+        //登录用户信息
75
+        UserDetail user = SecurityUser.getUser();
76
+        if(user != null){
77
+            log.setCreatorName(user.getUsername());
78
+        }
79
+
80
+        log.setStatus(status);
81
+        log.setRequestTime((int)time);
82
+
83
+        //请求相关信息
84
+        HttpServletRequest request = HttpContextUtils.getHttpServletRequest();
85
+        log.setIp(IpUtils.getIpAddr(request));
86
+        log.setUserAgent(request.getHeader(HttpHeaders.USER_AGENT));
87
+        log.setRequestUri(request.getRequestURI());
88
+        log.setRequestMethod(request.getMethod());
89
+
90
+        //请求参数
91
+        Object[] args = joinPoint.getArgs();
92
+        try{
93
+            String params = JSON.toJSONString(args[0]);
94
+            log.setRequestParams(params);
95
+        }catch (Exception e){
96
+
97
+        }
98
+
99
+        //保存到DB
100
+        sysLogOperationService.save(log);
101
+    }
102
+}

+ 36 - 0
eitc-admin/src/main/java/com/eitc/common/config/MybatisPlusConfig.java

@@ -0,0 +1,36 @@
1
+package com.eitc.common.config;
2
+
3
+import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
4
+import com.eitc.common.interceptor.DataFilterInterceptor;
5
+import org.springframework.context.annotation.Bean;
6
+import org.springframework.context.annotation.Configuration;
7
+import org.springframework.core.annotation.Order;
8
+
9
+/**
10
+ * mybatis-plus配置
11
+ *
12
+ * @author Mark eitc@163.com
13
+ * @since 1.0.0
14
+ */
15
+@Configuration
16
+public class MybatisPlusConfig {
17
+
18
+    /**
19
+     * 配置数据权限
20
+     */
21
+    @Bean
22
+    @Order(1)
23
+    public DataFilterInterceptor dataFilterInterceptor() {
24
+        return new DataFilterInterceptor();
25
+    }
26
+
27
+    /**
28
+     * 配置分页
29
+     */
30
+    @Bean
31
+    @Order(0)
32
+    public PaginationInterceptor paginationInterceptor() {
33
+        return new PaginationInterceptor();
34
+    }
35
+
36
+}

+ 57 - 0
eitc-admin/src/main/java/com/eitc/common/config/SwaggerConfig.java

@@ -0,0 +1,57 @@
1
+package com.eitc.common.config;
2
+
3
+import com.eitc.common.constant.Constant;
4
+import io.swagger.annotations.ApiOperation;
5
+import org.springframework.context.annotation.Bean;
6
+import org.springframework.context.annotation.Configuration;
7
+import springfox.documentation.builders.ApiInfoBuilder;
8
+import springfox.documentation.builders.PathSelectors;
9
+import springfox.documentation.builders.RequestHandlerSelectors;
10
+import springfox.documentation.service.ApiInfo;
11
+import springfox.documentation.service.ApiKey;
12
+import springfox.documentation.spi.DocumentationType;
13
+import springfox.documentation.spring.web.plugins.Docket;
14
+import springfox.documentation.swagger2.annotations.EnableSwagger2;
15
+
16
+import java.util.List;
17
+
18
+import static com.google.common.collect.Lists.newArrayList;
19
+
20
+/**
21
+ * Swagger配置
22
+ *
23
+ * @author Mark eitc@163.com
24
+ */
25
+@Configuration
26
+@EnableSwagger2
27
+public class SwaggerConfig{
28
+
29
+    @Bean
30
+    public Docket createRestApi() {
31
+        return new Docket(DocumentationType.SWAGGER_2)
32
+            .apiInfo(apiInfo())
33
+            .select()
34
+            //加了ApiOperation注解的类,生成接口文档
35
+            .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
36
+            //包下的类,生成接口文档
37
+            //.apis(RequestHandlerSelectors.basePackage("com.eitc.modules.job.controller"))
38
+            .paths(PathSelectors.any())
39
+            .build()
40
+            .directModelSubstitute(java.util.Date.class, String.class)
41
+            .securitySchemes(security());
42
+    }
43
+
44
+    private ApiInfo apiInfo() {
45
+        return new ApiInfoBuilder()
46
+            .title("智汇口腔")
47
+            .description("eitc-admin文档")
48
+            .version("2.0.0")
49
+            .build();
50
+    }
51
+
52
+    private List<ApiKey> security() {
53
+        return newArrayList(
54
+            new ApiKey(Constant.TOKEN_HEADER, Constant.TOKEN_HEADER, "header")
55
+        );
56
+    }
57
+}

+ 29 - 0
eitc-admin/src/main/java/com/eitc/common/context/TenantContext.java

@@ -0,0 +1,29 @@
1
+package com.eitc.common.context;
2
+
3
+import com.eitc.common.utils.HttpContextUtils;
4
+import com.eitc.modules.security.user.UserDetail;
5
+import com.eitc.modules.sys.enums.SuperAdminEnum;
6
+import org.apache.commons.lang3.StringUtils;
7
+
8
+/**
9
+ * 租户
10
+ *
11
+ * @author Mark eitc@163.com
12
+ */
13
+public class TenantContext {
14
+
15
+    public static Long getTenantCode(UserDetail user){
16
+        if(user.getTenantCode() == null){
17
+            return null;
18
+        }
19
+
20
+        String tenantCode = HttpContextUtils.getTenantCode();
21
+        //超级管理员,才可以切换租户
22
+        if(user.getSuperAdmin() == SuperAdminEnum.YES.value()){
23
+            if(StringUtils.isNotBlank(tenantCode)){
24
+                return Long.parseLong(tenantCode);
25
+            }
26
+        }
27
+        return user.getTenantCode();
28
+    }
29
+}

+ 95 - 0
eitc-admin/src/main/java/com/eitc/common/exception/RenExceptionHandler.java

@@ -0,0 +1,95 @@
1
+package com.eitc.common.exception;
2
+
3
+import cn.hutool.core.map.MapUtil;
4
+import com.alibaba.fastjson.JSON;
5
+import com.eitc.common.utils.HttpContextUtils;
6
+import com.eitc.common.utils.IpUtils;
7
+import com.eitc.common.utils.Result;
8
+import com.eitc.modules.log.entity.SysLogErrorEntity;
9
+import com.eitc.modules.log.service.SysLogErrorService;
10
+import org.apache.shiro.authz.UnauthorizedException;
11
+import org.slf4j.Logger;
12
+import org.slf4j.LoggerFactory;
13
+import org.springframework.beans.factory.annotation.Autowired;
14
+import org.springframework.dao.DuplicateKeyException;
15
+import org.springframework.http.HttpHeaders;
16
+import org.springframework.web.bind.annotation.ExceptionHandler;
17
+import org.springframework.web.bind.annotation.RestControllerAdvice;
18
+
19
+import javax.servlet.http.HttpServletRequest;
20
+import java.util.Map;
21
+
22
+
23
+/**
24
+ * 异常处理器
25
+ *
26
+ * @author Mark eitc@163.com
27
+ * @since 1.0.0
28
+ */
29
+@RestControllerAdvice
30
+public class RenExceptionHandler {
31
+	private static final Logger logger = LoggerFactory.getLogger(RenExceptionHandler.class);
32
+
33
+	@Autowired
34
+	private SysLogErrorService sysLogErrorService;
35
+
36
+	/**
37
+	 * 处理自定义异常
38
+	 */
39
+	@ExceptionHandler(RenException.class)
40
+	public Result handleRenException(RenException ex){
41
+		Result result = new Result();
42
+		result.error(ex.getCode(), ex.getMsg());
43
+
44
+		return result;
45
+	}
46
+
47
+	@ExceptionHandler(DuplicateKeyException.class)
48
+	public Result handleDuplicateKeyException(DuplicateKeyException ex){
49
+		Result result = new Result();
50
+		result.error(ErrorCode.DB_RECORD_EXISTS);
51
+
52
+		return result;
53
+	}
54
+
55
+	@ExceptionHandler(Exception.class)
56
+	public Result handleException(Exception ex){
57
+		logger.error(ex.getMessage(), ex);
58
+
59
+		saveLog(ex);
60
+
61
+		return new Result().error();
62
+	}
63
+
64
+	@ExceptionHandler(UnauthorizedException.class)
65
+	public Result handleUnauthorizedException(UnauthorizedException ex){
66
+		Result result = new Result();
67
+		result.error(ErrorCode.FORBIDDEN);
68
+
69
+		return result;
70
+	}
71
+
72
+	/**
73
+	 * 保存异常日志
74
+	 */
75
+	private void saveLog(Exception ex){
76
+		SysLogErrorEntity log = new SysLogErrorEntity();
77
+
78
+		//请求相关信息
79
+		HttpServletRequest request = HttpContextUtils.getHttpServletRequest();
80
+		log.setIp(IpUtils.getIpAddr(request));
81
+		log.setUserAgent(request.getHeader(HttpHeaders.USER_AGENT));
82
+		log.setRequestUri(request.getRequestURI());
83
+		log.setRequestMethod(request.getMethod());
84
+		Map<String, String> params = HttpContextUtils.getParameterMap(request);
85
+		if(MapUtil.isNotEmpty(params)){
86
+			log.setRequestParams(JSON.toJSONString(params));
87
+		}
88
+
89
+		//异常信息
90
+		log.setErrorInfo(ExceptionUtils.getErrorStackTrace(ex));
91
+
92
+		//保存
93
+		sysLogErrorService.save(log);
94
+	}
95
+}

+ 56 - 0
eitc-admin/src/main/java/com/eitc/common/handler/FieldMetaObjectHandler.java

@@ -0,0 +1,56 @@
1
+package com.eitc.common.handler;
2
+
3
+import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
4
+import com.eitc.common.context.TenantContext;
5
+import com.eitc.modules.security.user.SecurityUser;
6
+import com.eitc.modules.security.user.UserDetail;
7
+import org.apache.ibatis.reflection.MetaObject;
8
+import org.springframework.stereotype.Component;
9
+
10
+import java.util.Date;
11
+
12
+/**
13
+ * 公共字段,自动填充值
14
+ *
15
+ * @author Mark eitc@163.com
16
+ */
17
+@Component
18
+public class FieldMetaObjectHandler implements MetaObjectHandler {
19
+    private final static String CREATE_DATE = "createDate";
20
+    private final static String CREATOR = "creator";
21
+    private final static String UPDATE_DATE = "updateDate";
22
+    private final static String UPDATER = "updater";
23
+    private final static String DEPT_ID = "deptId";
24
+    private final static String TENANT_CODE = "tenantCode";
25
+
26
+    @Override
27
+    public void insertFill(MetaObject metaObject) {
28
+        UserDetail user = SecurityUser.getUser();
29
+        Date date = new Date();
30
+
31
+        //创建者
32
+        strictInsertFill(metaObject, CREATOR, Long.class, user.getId());
33
+        //创建时间
34
+        strictInsertFill(metaObject, CREATE_DATE, Date.class, date);
35
+
36
+        //创建者所属部门
37
+        strictInsertFill(metaObject, DEPT_ID, Long.class, user.getDeptId());
38
+
39
+
40
+        //租户编码
41
+        strictInsertFill(metaObject, TENANT_CODE, Long.class, TenantContext.getTenantCode(user));
42
+
43
+        //更新者
44
+        strictInsertFill(metaObject, UPDATER, Long.class, user.getId());
45
+        //更新时间
46
+        strictInsertFill(metaObject, UPDATE_DATE, Date.class, date);
47
+    }
48
+
49
+    @Override
50
+    public void updateFill(MetaObject metaObject) {
51
+        //更新者
52
+        strictUpdateFill(metaObject, UPDATER, Long.class, SecurityUser.getUserId());
53
+        //更新时间
54
+        strictUpdateFill(metaObject, UPDATE_DATE, Date.class, new Date());
55
+    }
56
+}

+ 109 - 0
eitc-admin/src/main/java/com/eitc/common/interceptor/DataFilterInterceptor.java

@@ -0,0 +1,109 @@
1
+package com.eitc.common.interceptor;
2
+
3
+import com.baomidou.mybatisplus.core.toolkit.PluginUtils;
4
+import com.baomidou.mybatisplus.extension.handlers.AbstractSqlParserHandler;
5
+import net.sf.jsqlparser.JSQLParserException;
6
+import net.sf.jsqlparser.expression.Expression;
7
+import net.sf.jsqlparser.expression.StringValue;
8
+import net.sf.jsqlparser.expression.operators.conditional.AndExpression;
9
+import net.sf.jsqlparser.parser.CCJSqlParserUtil;
10
+import net.sf.jsqlparser.statement.select.PlainSelect;
11
+import net.sf.jsqlparser.statement.select.Select;
12
+import org.apache.ibatis.executor.statement.StatementHandler;
13
+import org.apache.ibatis.mapping.BoundSql;
14
+import org.apache.ibatis.mapping.MappedStatement;
15
+import org.apache.ibatis.mapping.SqlCommandType;
16
+import org.apache.ibatis.plugin.*;
17
+import org.apache.ibatis.reflection.MetaObject;
18
+import org.apache.ibatis.reflection.SystemMetaObject;
19
+
20
+import java.sql.Connection;
21
+import java.util.Map;
22
+import java.util.Properties;
23
+
24
+/**
25
+ * 数据过滤
26
+ *
27
+ * @author Mark eitc@163.com
28
+ * @since 1.0.0
29
+ */
30
+@Intercepts({@Signature(type = StatementHandler.class, method = "prepare", args = {Connection.class, Integer.class})})
31
+public class DataFilterInterceptor extends AbstractSqlParserHandler implements Interceptor {
32
+
33
+    @Override
34
+    public Object intercept(Invocation invocation) throws Throwable {
35
+        StatementHandler statementHandler = (StatementHandler) PluginUtils.realTarget(invocation.getTarget());
36
+        MetaObject metaObject = SystemMetaObject.forObject(statementHandler);
37
+
38
+        // SQL解析
39
+        this.sqlParser(metaObject);
40
+
41
+        // 先判断是不是SELECT操作
42
+        MappedStatement mappedStatement = (MappedStatement) metaObject.getValue("delegate.mappedStatement");
43
+        if (!SqlCommandType.SELECT.equals(mappedStatement.getSqlCommandType())) {
44
+            return invocation.proceed();
45
+        }
46
+
47
+        // 针对定义了rowBounds,做为mapper接口方法的参数
48
+        BoundSql boundSql = (BoundSql) metaObject.getValue("delegate.boundSql");
49
+        String originalSql = boundSql.getSql();
50
+        Object paramObj = boundSql.getParameterObject();
51
+
52
+        // 判断参数里是否有DataScope对象
53
+        DataScope scope = null;
54
+        if (paramObj instanceof DataScope) {
55
+            scope = (DataScope) paramObj;
56
+        } else if (paramObj instanceof Map) {
57
+            for (Object arg : ((Map) paramObj).values()) {
58
+                if (arg instanceof DataScope) {
59
+                    scope = (DataScope) arg;
60
+                    break;
61
+                }
62
+            }
63
+        }
64
+
65
+        // 不用数据过滤
66
+        if(scope == null){
67
+            return invocation.proceed();
68
+        }
69
+
70
+        // 拼接新SQL
71
+        originalSql = getSelect(originalSql, scope);
72
+
73
+        // 重写SQL
74
+        metaObject.setValue("delegate.boundSql.sql", originalSql);
75
+        return invocation.proceed();
76
+    }
77
+
78
+    private String getSelect(String originalSql, DataScope scope){
79
+        try {
80
+            Select select = (Select) CCJSqlParserUtil.parse(originalSql);
81
+            PlainSelect plainSelect = (PlainSelect) select.getSelectBody();
82
+
83
+            Expression expression = plainSelect.getWhere();
84
+            if(expression == null){
85
+                plainSelect.setWhere(new StringValue(scope.getSqlFilter()));
86
+            }else{
87
+                AndExpression andExpression =  new AndExpression(expression, new StringValue(scope.getSqlFilter()));
88
+                plainSelect.setWhere(andExpression);
89
+            }
90
+
91
+            return select.toString().replaceAll("'", "");
92
+        }catch (JSQLParserException e){
93
+            return originalSql;
94
+        }
95
+    }
96
+
97
+    @Override
98
+    public Object plugin(Object target) {
99
+        if (target instanceof StatementHandler) {
100
+            return Plugin.wrap(target, this);
101
+        }
102
+        return target;
103
+    }
104
+
105
+    @Override
106
+    public void setProperties(Properties properties) {
107
+
108
+    }
109
+}

+ 28 - 0
eitc-admin/src/main/java/com/eitc/common/interceptor/DataScope.java

@@ -0,0 +1,28 @@
1
+package com.eitc.common.interceptor;
2
+
3
+/**
4
+ * 数据范围
5
+ *
6
+ * @author Mark eitc@163.com
7
+ * @since 1.0.0
8
+ */
9
+public class DataScope {
10
+    private String sqlFilter;
11
+
12
+    public DataScope(String sqlFilter) {
13
+        this.sqlFilter = sqlFilter;
14
+    }
15
+
16
+    public String getSqlFilter() {
17
+        return sqlFilter;
18
+    }
19
+
20
+    public void setSqlFilter(String sqlFilter) {
21
+        this.sqlFilter = sqlFilter;
22
+    }
23
+
24
+    @Override
25
+    public String toString() {
26
+        return this.sqlFilter;
27
+    }
28
+}

+ 65 - 0
eitc-admin/src/main/java/com/eitc/common/utils/ExcelUtils.java

@@ -0,0 +1,65 @@
1
+package com.eitc.common.utils;
2
+
3
+import com.alibaba.excel.EasyExcel;
4
+import org.apache.commons.lang3.StringUtils;
5
+import org.springframework.beans.BeanUtils;
6
+
7
+import javax.servlet.http.HttpServletResponse;
8
+import java.io.IOException;
9
+import java.net.URLEncoder;
10
+import java.util.ArrayList;
11
+import java.util.Date;
12
+import java.util.List;
13
+
14
+/**
15
+ * excel工具类
16
+ *
17
+ * @author Mark eitc@163.com
18
+ */
19
+public class ExcelUtils {
20
+
21
+    /**
22
+     * Excel导出
23
+     *
24
+     * @param response      response
25
+     * @param fileName      文件名
26
+     * @param sheetName     sheetName
27
+     * @param list          数据List
28
+     * @param pojoClass     对象Class
29
+     */
30
+    public static void exportExcel(HttpServletResponse response, String fileName, String sheetName, List<?> list,
31
+                                     Class<?> pojoClass) throws IOException {
32
+        if(StringUtils.isBlank(fileName)){
33
+            //当前日期
34
+            fileName = DateUtils.format(new Date());
35
+        }
36
+
37
+        response.setContentType("application/vnd.ms-excel");
38
+        response.setCharacterEncoding("UTF-8");
39
+        fileName = URLEncoder.encode(fileName, "UTF-8");
40
+        response.setHeader("Content-disposition", "attachment;filename=" +  fileName + ".xlsx");
41
+        EasyExcel.write(response.getOutputStream(), pojoClass).sheet(sheetName).doWrite(list);
42
+    }
43
+
44
+    /**
45
+     * Excel导出,先sourceList转换成List<targetClass>,再导出
46
+     *
47
+     * @param response      response
48
+     * @param fileName      文件名
49
+     * @param sheetName     sheetName
50
+     * @param sourceList    原数据List
51
+     * @param targetClass   目标对象Class
52
+     */
53
+    public static void exportExcelToTarget(HttpServletResponse response, String fileName, String sheetName, List<?> sourceList,
54
+                                     Class<?> targetClass) throws Exception {
55
+        List targetList = new ArrayList<>(sourceList.size());
56
+        for(Object source : sourceList){
57
+            Object target = targetClass.newInstance();
58
+            BeanUtils.copyProperties(source, target);
59
+            targetList.add(target);
60
+        }
61
+
62
+        exportExcel(response, fileName, sheetName, targetList, targetClass);
63
+    }
64
+
65
+}

+ 9 - 0
eitc-admin/src/main/java/com/eitc/common/validator/group/AliyunGroup.java

@@ -0,0 +1,9 @@
1
+package com.eitc.common.validator.group;
2
+
3
+/**
4
+ * 阿里云
5
+ *
6
+ * @author Mark eitc@163.com
7
+ */
8
+public interface AliyunGroup {
9
+}

+ 9 - 0
eitc-admin/src/main/java/com/eitc/common/validator/group/FastDFSGroup.java

@@ -0,0 +1,9 @@
1
+package com.eitc.common.validator.group;
2
+
3
+/**
4
+ * FastDFS
5
+ *
6
+ * @author Mark eitc@163.com
7
+ */
8
+public interface FastDFSGroup {
9
+}

+ 9 - 0
eitc-admin/src/main/java/com/eitc/common/validator/group/LocalGroup.java

@@ -0,0 +1,9 @@
1
+package com.eitc.common.validator.group;
2
+
3
+/**
4
+ * 本地上传
5
+ *
6
+ * @author Mark eitc@163.com
7
+ */
8
+public interface LocalGroup {
9
+}

+ 9 - 0
eitc-admin/src/main/java/com/eitc/common/validator/group/MinioGroup.java

@@ -0,0 +1,9 @@
1
+package com.eitc.common.validator.group;
2
+
3
+/**
4
+ * MinIO
5
+ *
6
+ * @author Mark eitc@163.com
7
+ */
8
+public interface MinioGroup {
9
+}

+ 9 - 0
eitc-admin/src/main/java/com/eitc/common/validator/group/QcloudGroup.java

@@ -0,0 +1,9 @@
1
+package com.eitc.common.validator.group;
2
+
3
+/**
4
+ * 腾讯云
5
+ *
6
+ * @author Mark eitc@163.com
7
+ */
8
+public interface QcloudGroup {
9
+}

+ 9 - 0
eitc-admin/src/main/java/com/eitc/common/validator/group/QiniuGroup.java

@@ -0,0 +1,9 @@
1
+package com.eitc.common.validator.group;
2
+
3
+/**
4
+ * 七牛
5
+ *
6
+ * @author Mark eitc@163.com
7
+ */
8
+public interface QiniuGroup {
9
+}

+ 27 - 0
eitc-admin/src/main/java/com/eitc/modules/activiti/config/ProcessEngineConfig.java

@@ -0,0 +1,27 @@
1
+package com.eitc.modules.activiti.config;
2
+
3
+import org.activiti.spring.SpringProcessEngineConfiguration;
4
+import org.activiti.spring.boot.ProcessEngineConfigurationConfigurer;
5
+import org.springframework.context.annotation.Configuration;
6
+
7
+/**
8
+ * 流程配置信息
9
+ *
10
+ * @author Mark eitc@163.com
11
+ */
12
+@Configuration
13
+public class ProcessEngineConfig implements ProcessEngineConfigurationConfigurer {
14
+
15
+    @Override
16
+    public void configure(SpringProcessEngineConfiguration processEngineConfiguration) {
17
+        processEngineConfiguration.setActivityFontName("宋体");
18
+        processEngineConfiguration.setLabelFontName("宋体");
19
+        processEngineConfiguration.setAnnotationFontName("宋体");
20
+
21
+        processEngineConfiguration.setJobExecutorActivate(false);
22
+        processEngineConfiguration.setAsyncExecutorEnabled(false);
23
+
24
+        //自定义流程图样式
25
+        //processEngineConfiguration.setProcessDiagramGenerator(customProcessDiagramGenerator);
26
+    }
27
+}

+ 98 - 0
eitc-admin/src/main/java/com/eitc/modules/activiti/controller/ActModelController.java

@@ -0,0 +1,98 @@
1
+package com.eitc.modules.activiti.controller;
2
+
3
+import com.eitc.common.annotation.LogOperation;
4
+import com.eitc.common.constant.Constant;
5
+import com.eitc.common.page.PageData;
6
+import com.eitc.common.utils.Result;
7
+import com.eitc.common.validator.ValidatorUtils;
8
+import com.eitc.modules.activiti.dto.ModelDTO;
9
+import com.eitc.modules.activiti.service.ActModelService;
10
+import io.swagger.annotations.Api;
11
+import io.swagger.annotations.ApiImplicitParam;
12
+import io.swagger.annotations.ApiImplicitParams;
13
+import io.swagger.annotations.ApiOperation;
14
+import org.activiti.engine.repository.Model;
15
+import org.apache.shiro.authz.annotation.RequiresPermissions;
16
+import org.springframework.beans.factory.annotation.Autowired;
17
+import org.springframework.web.bind.annotation.*;
18
+import springfox.documentation.annotations.ApiIgnore;
19
+
20
+import javax.servlet.http.HttpServletResponse;
21
+import java.util.Map;
22
+
23
+/**
24
+ * 模型管理
25
+ *
26
+ * @author Mark eitc@163.com
27
+ */
28
+@RestController
29
+@RequestMapping("/act/model")
30
+@Api(tags="模型管理")
31
+public class ActModelController {
32
+    @Autowired
33
+    private ActModelService actModelService;
34
+
35
+    @GetMapping("page")
36
+    @ApiOperation("分页")
37
+    @ApiImplicitParams({
38
+        @ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType="int") ,
39
+        @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") ,
40
+        @ApiImplicitParam(name = "key", value = "key", paramType = "query", dataType="String"),
41
+        @ApiImplicitParam(name = "name", value = "name", paramType = "query", dataType="String")
42
+    })
43
+    @RequiresPermissions("sys:model:all")
44
+    public Result<PageData<Model>> page(@ApiIgnore @RequestParam Map<String, Object> params){
45
+        PageData<Model> page = actModelService.page(params);
46
+
47
+        return new Result<PageData<Model>>().ok(page);
48
+    }
49
+
50
+    @PostMapping
51
+    @ApiOperation("新增模型")
52
+    @LogOperation("新增模型")
53
+    @RequiresPermissions("sys:model:all")
54
+    public Result save(@RequestBody ModelDTO dto) throws Exception{
55
+        //效验数据
56
+        ValidatorUtils.validateEntity(dto);
57
+
58
+        actModelService.save(dto.getName(), dto.getKey(), dto.getDescription());
59
+
60
+        return new Result();
61
+    }
62
+
63
+    @PostMapping("deploy/{id}")
64
+    @ApiOperation("部署")
65
+    @LogOperation("部署")
66
+    @RequiresPermissions("sys:model:all")
67
+    public Result deploy(@PathVariable("id") String id) {
68
+        actModelService.deploy(id);
69
+        return new Result();
70
+    }
71
+
72
+    @GetMapping("export/{id}")
73
+    @ApiOperation("导出")
74
+    @LogOperation("导出")
75
+    @RequiresPermissions("sys:model:all")
76
+    public void export(@PathVariable("id") String id, @ApiIgnore HttpServletResponse response) {
77
+        actModelService.export(id, response);
78
+    }
79
+
80
+    @DeleteMapping
81
+    @ApiOperation("删除")
82
+    @LogOperation("删除")
83
+    @RequiresPermissions("sys:model:all")
84
+    public Result delete(@RequestBody String[] ids) {
85
+        for(String id : ids) {
86
+            actModelService.delete(id);
87
+        }
88
+        return new Result();
89
+    }
90
+
91
+    @GetMapping("image/{deploymentId}")
92
+    @ApiOperation(value = "查看流程图", produces="application/octet-stream")
93
+    @LogOperation("查看流程图")
94
+    @RequiresPermissions("sys:model:all")
95
+    public void viewDeployImage(@PathVariable("deploymentId") String deploymentId, @ApiIgnore HttpServletResponse response){
96
+        actModelService.deployImage(deploymentId, response);
97
+    }
98
+}

+ 214 - 0
eitc-admin/src/main/java/com/eitc/modules/activiti/controller/ActProcessController.java

@@ -0,0 +1,214 @@
1
+package com.eitc.modules.activiti.controller;
2
+
3
+import com.eitc.common.annotation.LogOperation;
4
+import com.eitc.common.constant.Constant;
5
+import com.eitc.common.exception.ErrorCode;
6
+import com.eitc.common.page.PageData;
7
+import com.eitc.common.utils.ConvertUtils;
8
+import com.eitc.common.utils.Result;
9
+import com.eitc.modules.activiti.dto.ProcessBizRouteAndProcessInstanceDTO;
10
+import com.eitc.modules.activiti.dto.ProcessBizRouteDTO;
11
+import com.eitc.modules.activiti.dto.ProcessInstanceDTO;
12
+import com.eitc.modules.activiti.service.ActHistoryService;
13
+import com.eitc.modules.activiti.service.ActProcessService;
14
+import com.eitc.modules.activiti.service.ProcessBizRouteService;
15
+import io.swagger.annotations.Api;
16
+import io.swagger.annotations.ApiImplicitParam;
17
+import io.swagger.annotations.ApiImplicitParams;
18
+import io.swagger.annotations.ApiOperation;
19
+import org.apache.commons.io.IOUtils;
20
+import org.apache.commons.lang3.StringUtils;
21
+import org.apache.shiro.authz.annotation.RequiresPermissions;
22
+import org.springframework.beans.factory.annotation.Autowired;
23
+import org.springframework.web.bind.annotation.*;
24
+import org.springframework.web.multipart.MultipartFile;
25
+import springfox.documentation.annotations.ApiIgnore;
26
+
27
+import javax.servlet.http.HttpServletResponse;
28
+import java.io.IOException;
29
+import java.io.InputStream;
30
+import java.util.Map;
31
+
32
+/**
33
+ * 流程管理
34
+ *
35
+ * @author Mark eitc@163.com
36
+ */
37
+@RestController
38
+@RequestMapping("/act/process")
39
+@Api(tags="流程管理")
40
+public class ActProcessController {
41
+    @Autowired
42
+    private ActProcessService actProcessService;
43
+
44
+    @Autowired
45
+    private ProcessBizRouteService processBizRouteService;
46
+
47
+    @Autowired
48
+    private ActHistoryService historyService;
49
+
50
+    @GetMapping("page")
51
+    @ApiOperation("流程管理-分页")
52
+    @ApiImplicitParams({
53
+        @ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType="int") ,
54
+        @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") ,
55
+        @ApiImplicitParam(name = "key", value = "key", paramType = "query", dataType="String"),
56
+        @ApiImplicitParam(name = "processName", value = "processName", paramType = "query", dataType="String")
57
+    })
58
+    @RequiresPermissions("sys:process:all")
59
+    public Result<PageData<Map<String, Object>>> page(@ApiIgnore @RequestParam Map<String, Object> params){
60
+        PageData<Map<String, Object>> page = actProcessService.page(params);
61
+        return new Result<PageData<Map<String, Object>>>().ok(page);
62
+    }
63
+
64
+    @GetMapping("lastestPage")
65
+    @ApiOperation("发起流程-分页")
66
+    @ApiImplicitParams({
67
+        @ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType="int") ,
68
+        @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") ,
69
+        @ApiImplicitParam(name = "key", value = "key", paramType = "query", dataType="String"),
70
+        @ApiImplicitParam(name = "processName", value = "processName", paramType = "query", dataType="String")
71
+    })
72
+    @RequiresPermissions("sys:process:all")
73
+    public Result<PageData<Map<String, Object>>> lastestPage(@ApiIgnore @RequestParam Map<String, Object> params){
74
+        params.put("isLatestVersion", true);
75
+        PageData<Map<String, Object>> page = actProcessService.page(params);
76
+        return new Result<PageData<Map<String, Object>>>().ok(page);
77
+    }
78
+
79
+    @PostMapping("deploy")
80
+    @ApiOperation("部署流程文件")
81
+    @LogOperation("部署流程文件")
82
+    @ApiImplicitParam(name = "processFile", value = "流程文件", paramType = "query", dataType="file")
83
+    @RequiresPermissions("sys:process:all")
84
+    public Result deploy(@RequestParam("processFile") MultipartFile file) throws IOException {
85
+        if (file.isEmpty()) {
86
+            return new Result().error(ErrorCode.UPLOAD_FILE_EMPTY);
87
+        }
88
+
89
+        actProcessService.deploy(file);
90
+
91
+        return new Result();
92
+    }
93
+
94
+    @PutMapping("active/{id}")
95
+    @LogOperation("激活流程")
96
+    @RequiresPermissions("sys:process:all")
97
+    public Result active(@PathVariable("id") String id) {
98
+        actProcessService.active(id);
99
+
100
+        return new Result();
101
+    }
102
+
103
+    @PutMapping("suspend/{id}")
104
+    @ApiOperation("挂起流程")
105
+    @LogOperation("挂起流程")
106
+    @RequiresPermissions("sys:process:all")
107
+    public Result suspend(@PathVariable("id") String id) {
108
+        actProcessService.suspend(id);
109
+
110
+        return new Result();
111
+    }
112
+
113
+    @PostMapping("convertToModel/{id}")
114
+    @ApiOperation("将部署的流程转换为模型")
115
+    @LogOperation("将部署的流程转换为模型")
116
+    @RequiresPermissions("sys:process:all")
117
+    public Result convertToModel(@PathVariable("id") String id) throws Exception {
118
+        actProcessService.convertToModel(id);
119
+
120
+        return new Result();
121
+    }
122
+
123
+    @DeleteMapping
124
+    @ApiOperation("删除流程")
125
+    @LogOperation("删除流程")
126
+    @RequiresPermissions("sys:process:all")
127
+    public Result delete(@RequestBody String[] deploymentIds) {
128
+        for(String deploymentId : deploymentIds) {
129
+            actProcessService.deleteDeployment(deploymentId);
130
+        }
131
+        return new Result();
132
+    }
133
+
134
+    @GetMapping(value = "resource")
135
+    @ApiOperation(value="获取资源文件", produces="application/octet-stream")
136
+    @ApiImplicitParams({
137
+        @ApiImplicitParam(name = "deploymentId", value = "部署ID", paramType = "query", dataType="String"),
138
+        @ApiImplicitParam(name = "resourceName", value = "资源名称", paramType = "query", dataType="String")
139
+    })
140
+    @RequiresPermissions("sys:process:all")
141
+    public void resource(String deploymentId, String resourceName, @ApiIgnore HttpServletResponse response) throws Exception {
142
+        InputStream resourceAsStream = actProcessService.getResourceAsStream(deploymentId, resourceName);
143
+        String[] fileNames = resourceName.split("\\.");
144
+        if(fileNames.length>1){
145
+            if(fileNames[fileNames.length-1].toLowerCase().equals("png")){
146
+                response.setHeader("Content-Type","image/png");
147
+            } else if(fileNames[fileNames.length-1].toLowerCase().equals("xml")){
148
+                response.setHeader("Content-Type", "text/xml");
149
+                response.setHeader("Content-Disposition", "attachment; filename=" + java.net.URLEncoder.encode(resourceName, "UTF-8"));
150
+            }
151
+        }
152
+
153
+        response.setHeader("Cache-Control", "no-store, no-cache");
154
+        IOUtils.copy(resourceAsStream, response.getOutputStream());
155
+    }
156
+
157
+    @GetMapping(value = "getProcDefBizRoute/{id}")
158
+    @ApiOperation("根据流程ID获取业务路由配置")
159
+    public Result getProcDefBizRoute(@PathVariable("id") String id){
160
+        ProcessBizRouteDTO processBizRouteDTO = processBizRouteService.getProcDefBizRoute(id);
161
+        return new Result().ok(processBizRouteDTO);
162
+    }
163
+
164
+    @GetMapping(value = "getLatestProcDefBizRoute")
165
+    @ApiOperation("根据流程定义KEY获取最新的流程配置信息")
166
+    @ApiImplicitParam(name = "procDefKey", value = "流程定义KEY", paramType = "query", dataType="String")
167
+    public Result getLatestProcDefBizRoute(String procDefKey){
168
+        ProcessBizRouteDTO processBizRouteDTO = processBizRouteService.getLatestProcDefBizRoute(procDefKey);
169
+        return new Result().ok(processBizRouteDTO);
170
+    }
171
+
172
+    @GetMapping(value = "getProcDefBizRouteAndProcessInstance")
173
+    @ApiOperation("根据业务ID获取流程业务路由配置和实例信息")
174
+    @ApiImplicitParams({
175
+        @ApiImplicitParam(name = "procDefKey", value = "流程定义KEY", required = true, paramType = "query", dataType="String"),
176
+        @ApiImplicitParam(name = "businessKey", value = "业务KEY", required = true, paramType = "query", dataType="String")
177
+    })
178
+    public Result getProcDefBizRouteAndProcessInstance(String procDefKey, String businessKey) {
179
+        if(StringUtils.isEmpty(businessKey)){
180
+            return new Result().error(ErrorCode.PARAMS_GET_ERROR);
181
+        }
182
+        if(StringUtils.isEmpty(procDefKey)){
183
+            return new Result().error(ErrorCode.PARAMS_GET_ERROR);
184
+        }
185
+        ProcessInstanceDTO processInstanceDTO = historyService.getHistoryProcessInstanceByBusinessKey(procDefKey, businessKey);
186
+        if(null == processInstanceDTO){
187
+            return new Result();
188
+        }
189
+        ProcessBizRouteDTO processBizRouteDTO = processBizRouteService.getProcDefBizRoute(processInstanceDTO.getProcessDefinitionId());
190
+        ProcessBizRouteAndProcessInstanceDTO dto = ConvertUtils.sourceToTarget(processBizRouteDTO, ProcessBizRouteAndProcessInstanceDTO.class);
191
+        if(null != dto) {
192
+            dto.setProcessDefinitionId(processInstanceDTO.getProcessDefinitionId());
193
+            dto.setProcessDefinitionKey(procDefKey);
194
+            dto.setProcessDefinitionName(processInstanceDTO.getProcessDefinitionName());
195
+            dto.setProcessInstanceId(processInstanceDTO.getProcessInstanceId());
196
+        }
197
+        return new Result().ok(dto);
198
+    }
199
+
200
+    @PostMapping("saveProcBizRoute")
201
+    @ApiOperation("保存业务路由配置")
202
+    public Result saveProcBizRoute(@RequestBody ProcessBizRouteDTO processBizRouteDTO){
203
+        processBizRouteService.save(processBizRouteDTO);
204
+        return new Result();
205
+    }
206
+
207
+    @PutMapping("saveProcBizRoute")
208
+    @ApiOperation("更新业务路由配置")
209
+    public Result updateProcBizRoute(@RequestBody ProcessBizRouteDTO processBizRouteDTO){
210
+        processBizRouteService.updateProcBizRoute(processBizRouteDTO);
211
+        return new Result();
212
+    }
213
+
214
+}

+ 77 - 0
eitc-admin/src/main/java/com/eitc/modules/activiti/controller/ActRunningController.java

@@ -0,0 +1,77 @@
1
+package com.eitc.modules.activiti.controller;
2
+
3
+import com.eitc.common.annotation.LogOperation;
4
+import com.eitc.common.constant.Constant;
5
+import com.eitc.common.page.PageData;
6
+import com.eitc.common.utils.Result;
7
+import com.eitc.modules.activiti.dto.ProcessInstanceDTO;
8
+import com.eitc.modules.activiti.dto.ProcessStartDTO;
9
+import com.eitc.modules.activiti.service.ActRunningService;
10
+import io.swagger.annotations.Api;
11
+import io.swagger.annotations.ApiImplicitParam;
12
+import io.swagger.annotations.ApiImplicitParams;
13
+import io.swagger.annotations.ApiOperation;
14
+import org.apache.shiro.authz.annotation.RequiresPermissions;
15
+import org.springframework.beans.factory.annotation.Autowired;
16
+import org.springframework.web.bind.annotation.*;
17
+import springfox.documentation.annotations.ApiIgnore;
18
+
19
+import java.util.Map;
20
+
21
+/**
22
+ * 运行中的流程
23
+ *
24
+ * @author Mark eitc@163.com
25
+ */
26
+@RestController
27
+@RequestMapping("/act/running")
28
+@Api(tags="运行中的流程")
29
+public class ActRunningController {
30
+    @Autowired
31
+    private ActRunningService actRunningService;
32
+
33
+    @GetMapping("page")
34
+    @ApiOperation("分页")
35
+    @ApiImplicitParams({
36
+        @ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType="int") ,
37
+        @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") ,
38
+        @ApiImplicitParam(name = "id", value = "实例ID", paramType = "query", dataType="String"),
39
+        @ApiImplicitParam(name = "definitionKey", value = "definitionKey", paramType = "query", dataType="String")
40
+    })
41
+    @RequiresPermissions("sys:running:all")
42
+    public Result<PageData<Map<String, Object>>> page(@ApiIgnore @RequestParam Map<String, Object> params){
43
+        PageData<Map<String, Object>> page = actRunningService.page(params);
44
+
45
+        return new Result<PageData<Map<String, Object>>>().ok(page);
46
+    }
47
+
48
+    @DeleteMapping("{id}")
49
+    @ApiOperation("删除")
50
+    @LogOperation("删除")
51
+    @RequiresPermissions("sys:running:all")
52
+    @ApiImplicitParam(name = "id", value = "ID", paramType = "query", dataType="String")
53
+    public Result deleteInstance(@PathVariable("id") String id) {
54
+        actRunningService.delete(id);
55
+        return new Result();
56
+    }
57
+
58
+    @PostMapping("start")
59
+    @ApiOperation("启动流程实例,依据流程定义KEY,启动流程实例")
60
+    @LogOperation("启动流程实例,依据流程定义KEY,启动流程实例")
61
+    @ApiImplicitParam(name = "key", value = "流程定义标识key", paramType = "query", dataType="String")
62
+    @RequiresPermissions("sys:running:all")
63
+    public Result<ProcessInstanceDTO> start(String key){
64
+        ProcessInstanceDTO dto = actRunningService.startProcess(key);
65
+        return new Result().ok(dto);
66
+    }
67
+
68
+    @PostMapping("startOfBusinessKey")
69
+    @ApiOperation("启动流程实例,依据流程定义ID和业务唯一标示启动实例")
70
+    @LogOperation("启动流程实例,依据流程定义ID和业务唯一标示启动实例")
71
+    @RequiresPermissions("sys:running:all")
72
+    public Result<ProcessInstanceDTO> startOfBusinessKey(@RequestBody ProcessStartDTO processStartDTO){
73
+        ProcessInstanceDTO dto = actRunningService.startOfBusinessKey(processStartDTO);
74
+        return new Result().ok(dto);
75
+    }
76
+
77
+}

+ 293 - 0
eitc-admin/src/main/java/com/eitc/modules/activiti/controller/ActTaskController.java

@@ -0,0 +1,293 @@
1
+package com.eitc.modules.activiti.controller;
2
+
3
+import com.eitc.common.annotation.LogOperation;
4
+import com.eitc.common.constant.Constant;
5
+import com.eitc.common.exception.ErrorCode;
6
+import com.eitc.common.page.PageData;
7
+import com.eitc.common.utils.Result;
8
+import com.eitc.modules.activiti.dto.TaskDTO;
9
+import com.eitc.modules.activiti.service.ActTaskService;
10
+import com.eitc.modules.security.user.SecurityUser;
11
+import com.eitc.modules.sys.dto.SysUserDTO;
12
+import com.eitc.modules.sys.service.SysUserService;
13
+import io.swagger.annotations.Api;
14
+import io.swagger.annotations.ApiImplicitParam;
15
+import io.swagger.annotations.ApiImplicitParams;
16
+import io.swagger.annotations.ApiOperation;
17
+import org.apache.shiro.authz.annotation.RequiresPermissions;
18
+import org.springframework.beans.factory.annotation.Autowired;
19
+import org.springframework.util.StringUtils;
20
+import org.springframework.web.bind.annotation.*;
21
+import springfox.documentation.annotations.ApiIgnore;
22
+
23
+import java.util.Map;
24
+
25
+/**
26
+ * 任务管理
27
+ * @author Jone
28
+ */
29
+@RestController
30
+@RequestMapping("/act/task")
31
+@Api(tags="任务管理")
32
+public class ActTaskController {
33
+
34
+    @Autowired
35
+    private ActTaskService actTaskService;
36
+
37
+    @Autowired
38
+    private SysUserService sysUserService;
39
+
40
+
41
+    /**
42
+     * 获取用户任务列表
43
+     * 根据用户ID或角色组获取任务信息
44
+     * @return
45
+     */
46
+    @GetMapping("page")
47
+    @ApiOperation("待办任务,默认查询所有待办任务。根据用户ID或角色ID查询个人或组的任务")
48
+    @ApiImplicitParams({
49
+        @ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType="int") ,
50
+        @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") ,
51
+        @ApiImplicitParam(name = "roleIds", value = "roleIds", paramType = "query", dataType="String"),
52
+        @ApiImplicitParam(name = "userId", value = "userId", paramType = "query", dataType="String"),
53
+        @ApiImplicitParam(name = "isRoleGroup", value = "是否查询分组", paramType = "query", dataType="String")
54
+    })
55
+    @RequiresPermissions("sys:task:all")
56
+    public Result<PageData<TaskDTO>> queryUserTaskPage(@ApiIgnore @RequestParam Map<String, Object> params){
57
+        PageData<TaskDTO> page = actTaskService.page(params);
58
+        return new Result<PageData<TaskDTO>>().ok(page);
59
+    }
60
+
61
+    /**
62
+     * 我的待办列表
63
+     * @return
64
+     */
65
+    @GetMapping("myToDoTaskPage")
66
+    @ApiOperation("我的待办列表")
67
+    @ApiImplicitParams({
68
+        @ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType="int") ,
69
+        @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int"),
70
+        @ApiImplicitParam(name = "taskName", value = "任务名称", paramType = "query", dataType="String")
71
+    })
72
+    @RequiresPermissions("sys:task:all")
73
+    public Result<PageData<TaskDTO>> myToDoTaskPage(@ApiIgnore @RequestParam Map<String, Object> params){
74
+        params.put("userId", SecurityUser.getUserId().toString());
75
+        PageData<TaskDTO> page = actTaskService.page(params);
76
+        for(TaskDTO taskDTO : page.getList()){
77
+            if(!StringUtils.isEmpty(taskDTO.getAssignee())){
78
+                SysUserDTO userDTO = sysUserService.get(Long.valueOf(taskDTO.getAssignee()));
79
+                taskDTO.setAssigneeName(userDTO.getRealName());
80
+            }
81
+        }
82
+        return new Result<PageData<TaskDTO>>().ok(page);
83
+    }
84
+
85
+    /**
86
+     * 获取任务详情
87
+     */
88
+    @GetMapping("task/{id}")
89
+    @ApiOperation("获取任务详情")
90
+    @LogOperation("获取任务详情")
91
+    @RequiresPermissions("sys:task:all")
92
+    public Result getTaskById(@PathVariable("id") String id){
93
+        TaskDTO task = actTaskService.taskDetail(id);
94
+        return new Result().ok(task);
95
+    }
96
+
97
+    /**
98
+     * 认领任务
99
+     */
100
+    @PostMapping("claim")
101
+    @ApiOperation("认领任务")
102
+    @ApiImplicitParam(name = "taskId", value = "taskId", paramType = "query", dataType="String")
103
+    @RequiresPermissions("sys:task:all")
104
+    public Result claimTask(String taskId){
105
+        if(StringUtils.isEmpty(taskId)){
106
+            return new Result().error(ErrorCode.PARAMS_GET_ERROR);
107
+        }
108
+        actTaskService.claimTask(taskId);
109
+        return new Result();
110
+    }
111
+
112
+    /**
113
+     * 释放任务
114
+     */
115
+    @PostMapping("unclaim")
116
+    @ApiOperation("释放任务")
117
+    @ApiImplicitParam(name = "taskId", value = "任务ID", paramType = "query", dataType="String")
118
+    @RequiresPermissions("sys:task:all")
119
+    public Result unclaimTask(String taskId){
120
+        if(StringUtils.isEmpty(taskId)){
121
+            return new Result().error(ErrorCode.PARAMS_GET_ERROR);
122
+        }
123
+        actTaskService.unclaimTask(taskId);
124
+        return new Result();
125
+    }
126
+
127
+    /**
128
+     * 任务处理
129
+     */
130
+    @PostMapping("complete")
131
+    @ApiOperation("任务处理(完成任务)")
132
+    @ApiImplicitParams({
133
+        @ApiImplicitParam(name = "taskId", value = "任务ID", paramType = "query", dataType="String"),
134
+        @ApiImplicitParam(name = "comment", value = "审批意见", paramType = "query", dataType="String")
135
+    })
136
+    @RequiresPermissions("sys:task:all")
137
+    public Result completeTask(String taskId, String comment){
138
+        if(StringUtils.isEmpty(taskId)){
139
+            return new Result().error(ErrorCode.PARAMS_GET_ERROR);
140
+        }
141
+        actTaskService.completeTask(taskId, comment);
142
+        return new Result();
143
+    }
144
+    /**
145
+     * 带参数的任务处理
146
+     */
147
+    @PostMapping("completeByVariables")
148
+    @ApiOperation("带参数的任务处理(完成任务)")
149
+    @RequiresPermissions("sys:task:all")
150
+    public Result completeTaskByVariables(@RequestBody TaskDTO taskDTO){
151
+        if(StringUtils.isEmpty(taskDTO.getTaskId())){
152
+            return new Result().error(ErrorCode.PARAMS_GET_ERROR);
153
+        }
154
+        actTaskService.completeTaskByVariables(taskDTO);
155
+        return new Result();
156
+    }
157
+
158
+    /**
159
+     * 任务委托
160
+     */
161
+    @PostMapping("entrust")
162
+    @ApiOperation("任务委托")
163
+    @ApiImplicitParams({
164
+        @ApiImplicitParam(name = "taskId", value = "任务ID", paramType = "query", dataType="String"),
165
+        @ApiImplicitParam(name = "assignee", value = "受理人", paramType = "query", dataType="String")
166
+    })
167
+    @RequiresPermissions("sys:task:all")
168
+    public Result taskEntrust(String taskId, String assignee){
169
+        if(StringUtils.isEmpty(taskId) || StringUtils.isEmpty(assignee)){
170
+            return new Result().error(ErrorCode.PARAMS_GET_ERROR);
171
+        }
172
+        String depositorId = SecurityUser.getUserId().toString();
173
+        actTaskService.changeTaskAssignee(taskId, depositorId, assignee);
174
+        return new Result();
175
+    }
176
+
177
+    /**
178
+     * 获取流程变量
179
+     */
180
+    @GetMapping("getTaskVariables")
181
+    @ApiOperation("获取流程变量")
182
+    @ApiImplicitParams({
183
+        @ApiImplicitParam(name = "taskId", value = "当前任务ID", paramType = "query", dataType="String"),
184
+        @ApiImplicitParam(name = "variableName", value = "参数的键", paramType = "query", dataType="String")
185
+    })
186
+    @RequiresPermissions("sys:task:all")
187
+    public Result getTaskVariables(String taskId, String variableName){
188
+        if(StringUtils.isEmpty(taskId) || StringUtils.isEmpty(variableName)){
189
+            return new Result().error(ErrorCode.PARAMS_GET_ERROR);
190
+        }
191
+        return new Result().ok(actTaskService.getTaskVariables(taskId, variableName));
192
+    }
193
+
194
+    /**
195
+     * 更新任务变量
196
+     */
197
+    @PostMapping("updateTaskVariable")
198
+    @ApiOperation("更新任务变量")
199
+    @RequiresPermissions("sys:task:all")
200
+    public Result updateTaskVariable(@RequestBody TaskDTO taskDTO){
201
+        if(StringUtils.isEmpty(taskDTO.getTaskId())){
202
+            return new Result().error(ErrorCode.PARAMS_GET_ERROR);
203
+        }
204
+        actTaskService.updateTaskVariable(taskDTO);
205
+        return new Result();
206
+    }
207
+
208
+    /**
209
+     * 删除任务的所有变量
210
+     */
211
+    @DeleteMapping("deleteTaskVariables")
212
+    @ApiOperation("删除任务的所有变量")
213
+    @ApiImplicitParam(name = "taskId", value = "当前任务ID", paramType = "query", dataType="String")
214
+    @RequiresPermissions("sys:task:all")
215
+    public Result deleteTaskVariables(String taskId){
216
+        if(StringUtils.isEmpty(taskId)){
217
+            return new Result().error(ErrorCode.PARAMS_GET_ERROR);
218
+        }
219
+        actTaskService.deleteTaskVariables(taskId);
220
+        return new Result();
221
+    }
222
+
223
+    /**
224
+     * 删除指定变量
225
+     */
226
+    @DeleteMapping("deleteVariable")
227
+    @ApiOperation("删除指定变量,默认删除本地变量")
228
+    @ApiImplicitParams({
229
+        @ApiImplicitParam(name = "taskId", value = "当前任务ID", paramType = "query", dataType="String"),
230
+        @ApiImplicitParam(name = "variableName", value = "变量名", paramType = "query", dataType="String"),
231
+        @ApiImplicitParam(name = "scope", value = "变量的范围(local:本地;global,全局)", paramType = "query", dataType="String")
232
+    })
233
+    @RequiresPermissions("sys:task:all")
234
+    public Result deleteVariable(String taskId, String variableName, String scope){
235
+        if(StringUtils.isEmpty(taskId) || StringUtils.isEmpty(variableName)){
236
+            return new Result().error(ErrorCode.PARAMS_GET_ERROR);
237
+        }
238
+        actTaskService.deleteTaskVariable(taskId, variableName, scope);
239
+        return new Result();
240
+    }
241
+
242
+    /**
243
+     * 回退任务到上一节点
244
+     */
245
+    @PostMapping("backPreviousTask")
246
+    @ApiOperation("回退任务到上一节点")
247
+    @ApiImplicitParams({
248
+        @ApiImplicitParam(name = "taskId", value = "任务ID", paramType = "query", dataType="String"),
249
+        @ApiImplicitParam(name = "comment", value = "回退审核意见", paramType = "query", dataType="String")
250
+    })
251
+    @RequiresPermissions("sys:task:all")
252
+    public Result backPreviousTask(String taskId, String comment){
253
+        if(StringUtils.isEmpty(taskId)){
254
+            return new Result().error(ErrorCode.PARAMS_GET_ERROR);
255
+        }
256
+        actTaskService.doBackPreviousTask(taskId, comment);
257
+        return new Result();
258
+    }
259
+
260
+    /**
261
+     * 终止流程
262
+     */
263
+    @PostMapping("endProcess")
264
+    @ApiOperation("终止流程")
265
+    @ApiImplicitParams({
266
+        @ApiImplicitParam(name = "taskId", value = "任务ID", paramType = "query", dataType="String"),
267
+        @ApiImplicitParam(name = "comment", value = "终止审核意见", paramType = "query", dataType="String")
268
+    })
269
+    @RequiresPermissions("sys:task:all")
270
+    public Result endProcess(String taskId, String comment){
271
+        actTaskService.endProcess(taskId, comment);
272
+        return new Result();
273
+    }
274
+
275
+    /**
276
+     * 驳回
277
+     */
278
+    @PostMapping("backToFirst")
279
+    @ApiOperation("驳回,回退至第一个用户任务")
280
+    @ApiImplicitParams({
281
+        @ApiImplicitParam(name = "taskId", value = "任务ID", paramType = "query", dataType="String"),
282
+        @ApiImplicitParam(name = "comment", value = "驳回审核意见", paramType = "query", dataType="String")
283
+    })
284
+    @RequiresPermissions("sys:task:all")
285
+    public Result backToFirst(String taskId, String comment){
286
+        if(StringUtils.isEmpty(taskId)){
287
+            return new Result().error(ErrorCode.PARAMS_GET_ERROR);
288
+        }
289
+        actTaskService.backToFirst(taskId, comment);
290
+        return new Result();
291
+    }
292
+
293
+}

+ 133 - 0
eitc-admin/src/main/java/com/eitc/modules/activiti/controller/HistoryController.java

@@ -0,0 +1,133 @@
1
+package com.eitc.modules.activiti.controller;
2
+
3
+import com.eitc.common.constant.Constant;
4
+import com.eitc.common.page.PageData;
5
+import com.eitc.common.utils.Result;
6
+import com.eitc.modules.activiti.dto.HistoryDetailDTO;
7
+import com.eitc.modules.activiti.dto.ProcessActivityDTO;
8
+import com.eitc.modules.activiti.dto.ProcessInstanceDTO;
9
+import com.eitc.modules.activiti.service.ActHistoryService;
10
+import com.eitc.modules.activiti.service.ActivitiService;
11
+import com.eitc.modules.sys.dto.SysUserDTO;
12
+import com.eitc.modules.sys.service.SysUserService;
13
+import io.swagger.annotations.Api;
14
+import io.swagger.annotations.ApiImplicitParam;
15
+import io.swagger.annotations.ApiImplicitParams;
16
+import io.swagger.annotations.ApiOperation;
17
+import org.apache.commons.lang3.StringUtils;
18
+import org.apache.shiro.authz.annotation.RequiresPermissions;
19
+import org.springframework.beans.factory.annotation.Autowired;
20
+import org.springframework.web.bind.annotation.GetMapping;
21
+import org.springframework.web.bind.annotation.RequestMapping;
22
+import org.springframework.web.bind.annotation.RequestParam;
23
+import org.springframework.web.bind.annotation.RestController;
24
+import springfox.documentation.annotations.ApiIgnore;
25
+
26
+import javax.servlet.http.HttpServletResponse;
27
+import java.util.List;
28
+import java.util.Map;
29
+
30
+/**
31
+ * 流程的历史信息
32
+ * @author Jone
33
+ */
34
+@RestController
35
+@RequestMapping("/act/his")
36
+@Api(tags="流程历史")
37
+public class HistoryController {
38
+
39
+    @Autowired
40
+    private ActHistoryService historyService;
41
+
42
+    @Autowired
43
+    private ActivitiService activitiService;
44
+    @Autowired
45
+    private SysUserService sysUserService;
46
+
47
+    @GetMapping("getInstImage")
48
+    @ApiOperation(value ="获取流程活动图", produces="application/octet-stream")
49
+    @ApiImplicitParam(name = "processInstanceId", value = "流程实例ID", paramType = "query", dataType="String")
50
+    @RequiresPermissions("sys:his:all")
51
+    public void getProcessInstanceDiagram(String processInstanceId, @ApiIgnore HttpServletResponse response) throws Exception {
52
+        historyService.getProcessInstanceDiagram(processInstanceId, response);
53
+    }
54
+
55
+    @GetMapping("getHistoryProcessInstancePage")
56
+    @ApiOperation("历史流程实例列表")
57
+    @ApiImplicitParams({
58
+        @ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType="int") ,
59
+        @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") ,
60
+        @ApiImplicitParam(name = "processInstanceId", value = "实例ID", paramType = "query", dataType="String"),
61
+        @ApiImplicitParam(name = "businessKey", value = "业务KEY", paramType = "query", dataType="String"),
62
+        @ApiImplicitParam(name = "processDefinitionId", value = "流程定义ID", paramType = "query", dataType="String"),
63
+        @ApiImplicitParam(name = "finishedBeginTime", value = "流程完成开始时间", paramType = "query", dataType="Date"),
64
+        @ApiImplicitParam(name = "finishedEndTime", value = "流程完成结束时间", paramType = "query", dataType="Date"),
65
+        @ApiImplicitParam(name = "startBeginTime", value = "流程启动开始时间", paramType = "query", dataType="Date"),
66
+        @ApiImplicitParam(name = "startEndTime", value = "流程启动结束时间", paramType = "query", dataType="Date"),
67
+        @ApiImplicitParam(name = "ended", value = "是否完成(true, false)", paramType = "query", dataType="String")
68
+    })
69
+    @RequiresPermissions("sys:his:all")
70
+    public Result<ProcessInstanceDTO> getHistoryProcessInstancePage(@ApiIgnore @RequestParam Map<String, Object> params){
71
+        PageData<ProcessInstanceDTO> page = historyService.getHistoryProcessInstancePage(params);
72
+        return new Result().ok(page);
73
+    }
74
+
75
+    @GetMapping("getMyProcessInstancePage")
76
+    @ApiOperation("我发起的流程")
77
+    @ApiImplicitParams({
78
+        @ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType="int") ,
79
+        @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") ,
80
+        @ApiImplicitParam(name = "processInstanceId", value = "实例ID", paramType = "query", dataType="String"),
81
+        @ApiImplicitParam(name = "businessKey", value = "业务KEY", paramType = "query", dataType="String"),
82
+        @ApiImplicitParam(name = "processDefinitionId", value = "流程定义ID", paramType = "query", dataType="String"),
83
+        @ApiImplicitParam(name = "startBeginTime", value = "流程启动开始时间", paramType = "query", dataType="Date"),
84
+        @ApiImplicitParam(name = "startEndTime", value = "流程启动结束时间", paramType = "query", dataType="Date"),
85
+        @ApiImplicitParam(name = "ended", value = "是否接受(true:是,false:否)", paramType = "query", dataType="String")
86
+    })
87
+    @RequiresPermissions("sys:his:all")
88
+    public Result<ProcessInstanceDTO> getMyProcessInstancePage(@ApiIgnore @RequestParam Map<String, Object> params){
89
+        PageData<ProcessInstanceDTO> page = historyService.getMyProcessInstancePage(params);
90
+        return new Result().ok(page);
91
+    }
92
+
93
+    @GetMapping("getMyHandledInstancePage")
94
+    @ApiOperation("已办任务:根据登录账号查询用户已办任务")
95
+    @ApiImplicitParams({
96
+        @ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType="int") ,
97
+        @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") ,
98
+        @ApiImplicitParam(name = "processInstanceId", value = "实例ID", paramType = "query", dataType="String"),
99
+        @ApiImplicitParam(name = "businessKey", value = "业务KEY", paramType = "query", dataType="String"),
100
+        @ApiImplicitParam(name = "processDefinitionId", value = "流程定义ID", paramType = "query", dataType="String"),
101
+        @ApiImplicitParam(name = "startBeginTime", value = "流程启动开始时间", paramType = "query", dataType="Date"),
102
+        @ApiImplicitParam(name = "startEndTime", value = "流程启动结束时间", paramType = "query", dataType="Date"),
103
+        @ApiImplicitParam(name = "finishedBeginTime", value = "流程完成开始时间", paramType = "query", dataType="Date"),
104
+        @ApiImplicitParam(name = "finishedEndTime", value = "流程完成结束时间", paramType = "query", dataType="Date")
105
+    })
106
+    @RequiresPermissions("sys:his:all")
107
+    public Result<ProcessActivityDTO> getMyHandledInstancePage(@ApiIgnore @RequestParam Map<String, Object> params){
108
+        PageData<ProcessActivityDTO> page = activitiService.getMyProcessInstancePage(params);
109
+        for(ProcessActivityDTO activityDTO : page.getList()){
110
+            if(StringUtils.isNotEmpty(activityDTO.getStartUserId())){
111
+                SysUserDTO userDTO = sysUserService.get(Long.valueOf(activityDTO.getStartUserId()));
112
+                activityDTO.setStartUserName(userDTO.getRealName());
113
+            }
114
+            if(StringUtils.isNotEmpty(activityDTO.getAssignee())){
115
+                SysUserDTO userDTO = sysUserService.get(Long.valueOf(activityDTO.getAssignee()));
116
+                activityDTO.setAssigneeName(userDTO.getRealName());
117
+            }
118
+        }
119
+        return new Result().ok(page);
120
+    }
121
+
122
+    @GetMapping("getTaskHandleDetailInfo")
123
+    @ApiOperation("获取流程处理详情")
124
+    @ApiImplicitParams({
125
+        @ApiImplicitParam(name = "processInstanceId", value = "实例ID", paramType = "query", dataType="String")
126
+    })
127
+    @RequiresPermissions("sys:his:all")
128
+    public Result<HistoryDetailDTO> getTaskHandleDetailInfo(String processInstanceId){
129
+        List<HistoryDetailDTO> list = activitiService.getTaskHandleDetailInfo(processInstanceId);
130
+        return new Result().ok(list);
131
+    }
132
+
133
+}

+ 22 - 0
eitc-admin/src/main/java/com/eitc/modules/activiti/dao/ProcessActivityDao.java

@@ -0,0 +1,22 @@
1
+package com.eitc.modules.activiti.dao;
2
+
3
+import com.eitc.common.dao.BaseDao;
4
+import com.eitc.modules.activiti.entity.HistoryDetailEntity;
5
+import com.eitc.modules.activiti.entity.ProcessActivityEntity;
6
+import org.apache.ibatis.annotations.Mapper;
7
+import org.springframework.context.annotation.Primary;
8
+
9
+import java.util.List;
10
+import java.util.Map;
11
+
12
+/**
13
+ * @author Jone
14
+ */
15
+@Mapper
16
+@Primary
17
+public interface ProcessActivityDao extends BaseDao<ProcessActivityEntity> {
18
+
19
+    List<ProcessActivityEntity> getMyProcessInstancePage(Map<String, Object> params);
20
+
21
+    List<HistoryDetailEntity> getTaskHandleDetailInfo(String processInstanceId);
22
+}

+ 18 - 0
eitc-admin/src/main/java/com/eitc/modules/activiti/dao/ProcessBizRouteDao.java

@@ -0,0 +1,18 @@
1
+package com.eitc.modules.activiti.dao;
2
+
3
+import com.eitc.common.dao.BaseDao;
4
+import com.eitc.modules.activiti.entity.ProcessBizRouteEntity;
5
+import org.apache.ibatis.annotations.Mapper;
6
+import org.apache.ibatis.annotations.Param;
7
+
8
+import java.util.List;
9
+
10
+/**
11
+ * @Author:Jone
12
+ */
13
+@Mapper
14
+public interface ProcessBizRouteDao extends BaseDao<ProcessBizRouteEntity> {
15
+    ProcessBizRouteEntity getProcDefBizRoute(@Param("proDefId") String id);
16
+
17
+    List<ProcessBizRouteEntity> getLatestProcDefBizRoute(@Param("procDefKey") String procDefKey);
18
+}

+ 117 - 0
eitc-admin/src/main/java/com/eitc/modules/activiti/demo/controller/CorrectionController.java

@@ -0,0 +1,117 @@
1
+package com.eitc.modules.activiti.demo.controller;
2
+
3
+import com.eitc.common.annotation.LogOperation;
4
+import com.eitc.common.constant.Constant;
5
+import com.eitc.common.page.PageData;
6
+import com.eitc.common.utils.Result;
7
+import com.eitc.common.validator.AssertUtils;
8
+import com.eitc.common.validator.ValidatorUtils;
9
+import com.eitc.common.validator.group.AddGroup;
10
+import com.eitc.common.validator.group.DefaultGroup;
11
+import com.eitc.common.validator.group.UpdateGroup;
12
+import com.eitc.modules.activiti.demo.dto.CorrectionDTO;
13
+import com.eitc.modules.activiti.demo.service.CorrectionService;
14
+import io.swagger.annotations.Api;
15
+import io.swagger.annotations.ApiImplicitParam;
16
+import io.swagger.annotations.ApiImplicitParams;
17
+import io.swagger.annotations.ApiOperation;
18
+import org.apache.shiro.authz.annotation.RequiresPermissions;
19
+import org.springframework.beans.factory.annotation.Autowired;
20
+import org.springframework.web.bind.annotation.*;
21
+import springfox.documentation.annotations.ApiIgnore;
22
+
23
+import java.util.HashMap;
24
+import java.util.Map;
25
+
26
+
27
+/**
28
+ * 转正申请
29
+ *
30
+ * @author Mark eitc@163.com
31
+ */
32
+@RestController
33
+@RequestMapping("act/demo/correction")
34
+@Api(tags="转正申请")
35
+public class CorrectionController {
36
+    @Autowired
37
+    private CorrectionService correctionService;
38
+
39
+    @GetMapping("page")
40
+    @ApiOperation("分页")
41
+    @ApiImplicitParams({
42
+        @ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType="int") ,
43
+        @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") ,
44
+        @ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") ,
45
+        @ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String")
46
+    })
47
+    @RequiresPermissions("sys:correction:all")
48
+    public Result<PageData<CorrectionDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){
49
+        PageData<CorrectionDTO> page = correctionService.page(params);
50
+
51
+        return new Result<PageData<CorrectionDTO>>().ok(page);
52
+    }
53
+
54
+    @GetMapping("{id}")
55
+    @ApiOperation("信息")
56
+    @RequiresPermissions("sys:correction:all")
57
+    public Result<CorrectionDTO> get(@PathVariable("id") Long id){
58
+        CorrectionDTO data = correctionService.get(id);
59
+
60
+        return new Result<CorrectionDTO>().ok(data);
61
+    }
62
+
63
+    @PostMapping
64
+    @ApiOperation("保存")
65
+    @LogOperation("保存")
66
+    @RequiresPermissions("sys:correction:all")
67
+    public Result save(@RequestBody CorrectionDTO dto){
68
+        //效验数据
69
+        ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
70
+
71
+        correctionService.save(dto);
72
+        Map<String, Object> map = new HashMap<>();
73
+        map.put("businessKey", dto.getId().toString());
74
+        return new Result().ok(map);
75
+    }
76
+
77
+    @PutMapping
78
+    @ApiOperation("修改")
79
+    @LogOperation("修改")
80
+    @RequiresPermissions("sys:correction:all")
81
+    public Result update(@RequestBody CorrectionDTO dto){
82
+        //效验数据
83
+        ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
84
+
85
+        correctionService.update(dto);
86
+
87
+        return new Result();
88
+    }
89
+
90
+    @DeleteMapping
91
+    @ApiOperation("删除")
92
+    @LogOperation("删除")
93
+    @RequiresPermissions("sys:correction:all")
94
+    public Result delete(@RequestBody Long[] ids){
95
+        //效验数据
96
+        AssertUtils.isArrayEmpty(ids, "id");
97
+
98
+        correctionService.delete(ids);
99
+
100
+        return new Result();
101
+    }
102
+
103
+    @PostMapping("updateInstanceId")
104
+    @ApiOperation("更新实例ID")
105
+    @LogOperation("更新实例ID")
106
+    @RequiresPermissions("sys:correction:all")
107
+    @ApiImplicitParams({
108
+        @ApiImplicitParam(name = "businessKey", value = "业务KEY", paramType = "query", required = true, dataType="String"),
109
+        @ApiImplicitParam(name = "processInstanceId", value = "实例ID", paramType = "query",required = true, dataType="String")
110
+    })
111
+    public Result updateInstanceId(String businessKey, String processInstanceId){
112
+        Long id = Long.valueOf(businessKey);
113
+        correctionService.updateInstanceId(processInstanceId, id);
114
+        return new Result();
115
+    }
116
+
117
+}

+ 16 - 0
eitc-admin/src/main/java/com/eitc/modules/activiti/demo/dao/CorrectionDao.java

@@ -0,0 +1,16 @@
1
+package com.eitc.modules.activiti.demo.dao;
2
+
3
+import com.eitc.common.dao.BaseDao;
4
+import com.eitc.modules.activiti.demo.entity.CorrectionEntity;
5
+import org.apache.ibatis.annotations.Mapper;
6
+
7
+/**
8
+ * 转正申请
9
+ *
10
+ * @author Mark eitc@163.com
11
+ */
12
+@Mapper
13
+public interface CorrectionDao extends BaseDao<CorrectionEntity> {
14
+
15
+    void updateInstanceId(String instanceId, Long id);
16
+}

+ 51 - 0
eitc-admin/src/main/java/com/eitc/modules/activiti/demo/dto/CorrectionDTO.java

@@ -0,0 +1,51 @@
1
+package com.eitc.modules.activiti.demo.dto;
2
+
3
+import com.fasterxml.jackson.annotation.JsonFormat;
4
+import io.swagger.annotations.ApiModel;
5
+import io.swagger.annotations.ApiModelProperty;
6
+import lombok.Data;
7
+
8
+import java.io.Serializable;
9
+import java.util.Date;
10
+
11
+
12
+/**
13
+ * 转正申请
14
+ *
15
+ * @author Mark eitc@163.com
16
+ */
17
+@Data
18
+@ApiModel(value = "转正申请")
19
+public class CorrectionDTO implements Serializable {
20
+    private static final long serialVersionUID = 1L;
21
+
22
+	@ApiModelProperty(value = "id")
23
+	private Long id;
24
+
25
+	@ApiModelProperty(value = "申请岗位")
26
+	private String applyPost;
27
+
28
+	@ApiModelProperty(value = "入职日期")
29
+	@JsonFormat(pattern="yyyy-MM-dd")
30
+	private Date entryDate;
31
+
32
+	@ApiModelProperty(value = "转正日期")
33
+	@JsonFormat(pattern="yyyy-MM-dd")
34
+	private Date correctionDate;
35
+
36
+	@ApiModelProperty(value = "工作内容")
37
+	private String workContent;
38
+
39
+	@ApiModelProperty(value = "工作成绩")
40
+	private String achievement;
41
+
42
+	@ApiModelProperty(value = "创建者")
43
+	private Long creator;
44
+
45
+	@ApiModelProperty(value = "创建时间")
46
+	private Date createDate;
47
+
48
+	@ApiModelProperty(value = "实例ID")
49
+	private String instanceId;
50
+
51
+}

+ 43 - 0
eitc-admin/src/main/java/com/eitc/modules/activiti/demo/entity/CorrectionEntity.java

@@ -0,0 +1,43 @@
1
+package com.eitc.modules.activiti.demo.entity;
2
+
3
+import com.baomidou.mybatisplus.annotation.TableName;
4
+import com.eitc.common.entity.BaseEntity;
5
+import lombok.Data;
6
+import lombok.EqualsAndHashCode;
7
+
8
+import java.util.Date;
9
+
10
+/**
11
+ * 转正申请
12
+ *
13
+ * @author Mark eitc@163.com
14
+ */
15
+@Data
16
+@EqualsAndHashCode(callSuper=false)
17
+@TableName("tb_correction")
18
+public class CorrectionEntity extends BaseEntity {
19
+	private static final long serialVersionUID = 1L;
20
+
21
+    /**
22
+     * 申请岗位
23
+     */
24
+	private String applyPost;
25
+    /**
26
+     * 入职日期
27
+     */
28
+	private Date entryDate;
29
+    /**
30
+     * 转正日期
31
+     */
32
+	private Date correctionDate;
33
+    /**
34
+     * 工作内容
35
+     */
36
+	private String workContent;
37
+    /**
38
+     * 工作成绩
39
+     */
40
+	private String achievement;
41
+
42
+	private String instanceId;
43
+}

+ 16 - 0
eitc-admin/src/main/java/com/eitc/modules/activiti/demo/service/CorrectionService.java

@@ -0,0 +1,16 @@
1
+package com.eitc.modules.activiti.demo.service;
2
+
3
+
4
+import com.eitc.common.service.CrudService;
5
+import com.eitc.modules.activiti.demo.dto.CorrectionDTO;
6
+import com.eitc.modules.activiti.demo.entity.CorrectionEntity;
7
+
8
+/**
9
+ * 转正申请
10
+ *
11
+ * @author Mark eitc@163.com
12
+ */
13
+public interface CorrectionService extends CrudService<CorrectionEntity, CorrectionDTO> {
14
+
15
+    void updateInstanceId(String instanceId, Long id);
16
+}

+ 37 - 0
eitc-admin/src/main/java/com/eitc/modules/activiti/demo/service/impl/CorrectionServiceImpl.java

@@ -0,0 +1,37 @@
1
+package com.eitc.modules.activiti.demo.service.impl;
2
+
3
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4
+import com.eitc.common.service.impl.CrudServiceImpl;
5
+import com.eitc.modules.activiti.demo.dao.CorrectionDao;
6
+import com.eitc.modules.activiti.demo.dto.CorrectionDTO;
7
+import com.eitc.modules.activiti.demo.entity.CorrectionEntity;
8
+import com.eitc.modules.activiti.demo.service.CorrectionService;
9
+import org.apache.commons.lang3.StringUtils;
10
+import org.springframework.stereotype.Service;
11
+
12
+import java.util.Map;
13
+
14
+/**
15
+ * 转正申请
16
+ *
17
+ * @author Mark eitc@163.com
18
+ */
19
+@Service
20
+public class CorrectionServiceImpl extends CrudServiceImpl<CorrectionDao, CorrectionEntity, CorrectionDTO> implements CorrectionService {
21
+
22
+    @Override
23
+    public QueryWrapper<CorrectionEntity> getWrapper(Map<String, Object> params){
24
+        String id = (String)params.get("id");
25
+
26
+        QueryWrapper<CorrectionEntity> wrapper = new QueryWrapper<>();
27
+        wrapper.eq(StringUtils.isNotBlank(id), "id", id);
28
+
29
+        return wrapper;
30
+    }
31
+
32
+
33
+    @Override
34
+    public void updateInstanceId(String instanceId, Long id) {
35
+        baseDao.updateInstanceId(instanceId, id);
36
+    }
37
+}

+ 53 - 0
eitc-admin/src/main/java/com/eitc/modules/activiti/dto/HistoryDetailDTO.java

@@ -0,0 +1,53 @@
1
+package com.eitc.modules.activiti.dto;
2
+
3
+import io.swagger.annotations.Api;
4
+import io.swagger.annotations.ApiModelProperty;
5
+import lombok.Data;
6
+
7
+import java.util.Date;
8
+
9
+/**
10
+ * 历史细节
11
+ *
12
+ * @author Jone
13
+ */
14
+@Data
15
+@Api(tags="历史细节")
16
+public class HistoryDetailDTO {
17
+
18
+    @ApiModelProperty(value = "ID")
19
+    private String id;
20
+
21
+    @ApiModelProperty(value = "环节名称")
22
+    private String activityName;
23
+
24
+    @ApiModelProperty(value = "环节类型")
25
+    private String activityType;
26
+
27
+    @ApiModelProperty(value = "流程定义ID")
28
+    private String processDefinitionId;
29
+
30
+    @ApiModelProperty(value = "实例ID")
31
+    private String processInstanceId;
32
+
33
+    @ApiModelProperty(value = "任务ID")
34
+    private String taskId;
35
+
36
+    @ApiModelProperty(value = "执行ID")
37
+    private String executionId;
38
+
39
+    @ApiModelProperty(value = "受理人")
40
+    private String assignee;
41
+
42
+    @ApiModelProperty(value = "开始时间")
43
+    private Date startTime;
44
+
45
+    @ApiModelProperty(value = "结束时间")
46
+    private Date endTime;
47
+
48
+    @ApiModelProperty(value = "时长(秒)")
49
+    private Long durationInSeconds;
50
+
51
+    @ApiModelProperty(value = "审批意见")
52
+    private String comment;
53
+}

+ 31 - 0
eitc-admin/src/main/java/com/eitc/modules/activiti/dto/ModelDTO.java

@@ -0,0 +1,31 @@
1
+package com.eitc.modules.activiti.dto;
2
+
3
+import io.swagger.annotations.Api;
4
+import io.swagger.annotations.ApiModelProperty;
5
+import lombok.Data;
6
+
7
+import javax.validation.constraints.NotBlank;
8
+import java.io.Serializable;
9
+
10
+/**
11
+ * 模型
12
+ *
13
+ * @author Mark eitc@163.com
14
+ */
15
+@Data
16
+@Api(tags="模型")
17
+public class ModelDTO implements Serializable {
18
+    private static final long serialVersionUID = 1L;
19
+
20
+    @ApiModelProperty(value = "模型名称")
21
+    @NotBlank(message="{model.name.require}")
22
+    private String name;
23
+
24
+    @ApiModelProperty(value = "模型标识")
25
+    @NotBlank(message="{model.key.require}")
26
+    private String key;
27
+
28
+    @ApiModelProperty(value = "模型描述")
29
+    private String description;
30
+
31
+}

+ 50 - 0
eitc-admin/src/main/java/com/eitc/modules/activiti/dto/ProcessActivityDTO.java

@@ -0,0 +1,50 @@
1
+package com.eitc.modules.activiti.dto;
2
+
3
+import io.swagger.annotations.Api;
4
+import io.swagger.annotations.ApiModelProperty;
5
+import lombok.Data;
6
+
7
+import java.util.Date;
8
+
9
+/**
10
+ * @author Jone
11
+ */
12
+@Data
13
+@Api(tags="流程活动")
14
+public class ProcessActivityDTO {
15
+
16
+
17
+    @ApiModelProperty(value = "流程定义ID")
18
+    private String processDefinitionId;
19
+
20
+    @ApiModelProperty(value = "流程定义名称")
21
+    private String processDefinitionName;
22
+
23
+    @ApiModelProperty(value = "流程定义版本")
24
+    private Integer processDefinitionVersion;
25
+
26
+    @ApiModelProperty(value = "实例ID")
27
+    private String processInstanceId;
28
+
29
+    @ApiModelProperty(value = "业务KEY")
30
+    private String businessKey;
31
+
32
+    @ApiModelProperty(value = "发起时间")
33
+    private Date startTime;
34
+
35
+    @ApiModelProperty(value = "结束时间")
36
+    private Date endTime;
37
+
38
+    @ApiModelProperty(value = "发起人")
39
+    private String startUserId;
40
+
41
+    @ApiModelProperty(value = "发起人姓名")
42
+    private String startUserName;
43
+
44
+    @ApiModelProperty(value = "受理人")
45
+    private String assignee;
46
+
47
+    @ApiModelProperty(value = "受理人姓名")
48
+    private String assigneeName;
49
+
50
+}

+ 29 - 0
eitc-admin/src/main/java/com/eitc/modules/activiti/dto/ProcessBizRouteAndProcessInstanceDTO.java

@@ -0,0 +1,29 @@
1
+package com.eitc.modules.activiti.dto;
2
+
3
+import io.swagger.annotations.Api;
4
+import io.swagger.annotations.ApiModelProperty;
5
+import lombok.Data;
6
+import lombok.EqualsAndHashCode;
7
+
8
+/**
9
+ * @Author:Jone
10
+ * @Description:
11
+ */
12
+@Data
13
+@EqualsAndHashCode(callSuper=false)
14
+@Api(tags="流程业务配置和实例信息")
15
+public class ProcessBizRouteAndProcessInstanceDTO extends ProcessBizRouteDTO {
16
+
17
+    @ApiModelProperty(value = "实例ID")
18
+    private String processInstanceId;
19
+
20
+    @ApiModelProperty(value = "流程定义ID")
21
+    private String processDefinitionId;
22
+
23
+    @ApiModelProperty(value = "流程定义名称")
24
+    private String processDefinitionName;
25
+
26
+    @ApiModelProperty(value = "流程定义KEY")
27
+    private String processDefinitionKey;
28
+
29
+}

+ 37 - 0
eitc-admin/src/main/java/com/eitc/modules/activiti/dto/ProcessBizRouteDTO.java

@@ -0,0 +1,37 @@
1
+package com.eitc.modules.activiti.dto;
2
+
3
+import io.swagger.annotations.Api;
4
+import io.swagger.annotations.ApiModelProperty;
5
+import lombok.Data;
6
+
7
+import javax.validation.constraints.NotBlank;
8
+import javax.validation.constraints.NotNull;
9
+
10
+/**
11
+ * @Author:Jone
12
+ */
13
+@Data
14
+@Api(tags="流程业务配置")
15
+public class ProcessBizRouteDTO {
16
+
17
+    private static final long serialVersionUID = 1L;
18
+
19
+    @ApiModelProperty(value = "id")
20
+    private Long id;
21
+
22
+    @ApiModelProperty(value = "流程定义ID")
23
+    @NotBlank(message="{processBizRoute.procDefId.require}")
24
+    private String procDefId;
25
+
26
+    @ApiModelProperty(value = "业务路由")
27
+    @NotBlank(message="{processBizRoute.bizRoute.require}")
28
+    private String bizRoute;
29
+
30
+    @ApiModelProperty(value = "流程定义KEY")
31
+    @NotBlank(message="{processBizRoute.procDefKey.require}")
32
+    private String procDefKey;
33
+
34
+    @ApiModelProperty(value = "版本号")
35
+    @NotNull(message="{processBizRoute.version.require}")
36
+    private Integer version;
37
+}

+ 69 - 0
eitc-admin/src/main/java/com/eitc/modules/activiti/dto/ProcessInstanceDTO.java

@@ -0,0 +1,69 @@
1
+package com.eitc.modules.activiti.dto;
2
+
3
+import io.swagger.annotations.Api;
4
+import io.swagger.annotations.ApiModelProperty;
5
+import lombok.Data;
6
+
7
+import javax.validation.constraints.NotBlank;
8
+import java.util.Date;
9
+import java.util.List;
10
+
11
+/**
12
+ * @author Jone
13
+ */
14
+@Data
15
+@Api(tags="实例")
16
+public class ProcessInstanceDTO {
17
+
18
+    private static final long serialVersionUID = 1L;
19
+
20
+    @ApiModelProperty(value = "实例ID")
21
+    private String processInstanceId;
22
+
23
+    @ApiModelProperty(value = "流程定义ID")
24
+    private String processDefinitionId;
25
+
26
+    @ApiModelProperty(value = "流程定义名称")
27
+    private String processDefinitionName;
28
+
29
+    @ApiModelProperty(value = "流程定义KEY")
30
+    private String processDefinitionKey;
31
+
32
+    @ApiModelProperty(value = "流程定义版本")
33
+    private Integer processDefinitionVersion;
34
+
35
+    @ApiModelProperty(value = "部署ID")
36
+    private String deploymentId;
37
+
38
+    @ApiModelProperty(value = "业务唯一KEY")
39
+    private String businessKey;
40
+
41
+    @ApiModelProperty(value = "实例名称")
42
+    private String name;
43
+
44
+    @ApiModelProperty(value = "描述")
45
+    private String description;
46
+
47
+    @ApiModelProperty(value = "是否结束")
48
+    private boolean isEnded;
49
+
50
+    @ApiModelProperty(value = "是否挂起")
51
+    private boolean isSuspended;
52
+
53
+    @ApiModelProperty(value = "结束时间")
54
+    private Date endTime;
55
+
56
+    @ApiModelProperty(value = "开始时间")
57
+    private Date startTime;
58
+
59
+    @ApiModelProperty(value = "发起人ID")
60
+    private String createUserId;
61
+
62
+    @ApiModelProperty(value = "当前任务")
63
+    private List<TaskDTO> currentTaskList;
64
+
65
+
66
+
67
+
68
+
69
+}

+ 27 - 0
eitc-admin/src/main/java/com/eitc/modules/activiti/dto/ProcessStartDTO.java

@@ -0,0 +1,27 @@
1
+package com.eitc.modules.activiti.dto;
2
+
3
+import io.swagger.annotations.Api;
4
+import io.swagger.annotations.ApiModelProperty;
5
+import lombok.Data;
6
+
7
+import javax.validation.constraints.NotBlank;
8
+import java.util.Map;
9
+
10
+/**
11
+ * @Author:Jone
12
+ */
13
+@Data
14
+@Api(tags="流程启动参数")
15
+public class ProcessStartDTO {
16
+
17
+    @ApiModelProperty(value = "流程KEY")
18
+    @NotBlank(message="{ProcessStart.processDefinitionKey.require}")
19
+    private String processDefinitionKey;
20
+
21
+    @ApiModelProperty(value = "业务KEY")
22
+    @NotBlank(message="{ProcessStart.businessKey.require}")
23
+    private String businessKey;
24
+
25
+    @ApiModelProperty(value = "流程参数")
26
+    private Map<String, Object> variables;
27
+}

+ 80 - 0
eitc-admin/src/main/java/com/eitc/modules/activiti/dto/TaskDTO.java

@@ -0,0 +1,80 @@
1
+package com.eitc.modules.activiti.dto;
2
+
3
+import io.swagger.annotations.Api;
4
+import io.swagger.annotations.ApiModelProperty;
5
+import lombok.Data;
6
+
7
+import javax.validation.constraints.NotBlank;
8
+import java.util.Date;
9
+import java.util.List;
10
+import java.util.Map;
11
+
12
+/**
13
+ * @author Jone
14
+ */
15
+@Data
16
+@Api(tags="任务")
17
+public class TaskDTO {
18
+    private static final long serialVersionUID = 1L;
19
+
20
+    @ApiModelProperty(value = "任务ID")
21
+    private String taskId;
22
+
23
+    @ApiModelProperty(value = "任务名称")
24
+    private String taskName;
25
+
26
+    @ApiModelProperty(value = "用户ID")
27
+    private String userId;
28
+
29
+    @ApiModelProperty(value = "任务参数")
30
+    private Map<String,Object> params;
31
+
32
+    @ApiModelProperty(value = "流程定义ID")
33
+    private String processDefinitionId;
34
+
35
+    @ApiModelProperty(value = "实例ID")
36
+    private String processInstanceId;
37
+
38
+    @ApiModelProperty(value = "角色")
39
+    private String roleIds;
40
+
41
+    @ApiModelProperty(value = "受理人")
42
+    private String assignee;
43
+
44
+    @ApiModelProperty(value = "受理人姓名")
45
+    private String assigneeName;
46
+
47
+    @ApiModelProperty(value = "任务所有人")
48
+    private String owner;
49
+
50
+    @ApiModelProperty(value = "审核意见")
51
+    private String comment;
52
+
53
+    @ApiModelProperty(value = "活动节点ID")
54
+    private String activityId;
55
+
56
+    @ApiModelProperty(value = "角色组")
57
+    private List<String> lstGroupId;
58
+
59
+    @ApiModelProperty(value = "候选人")
60
+    private List<String> lstUserIds;
61
+
62
+    @ApiModelProperty(value = "处理时间")
63
+    private Date dueDate;
64
+
65
+    @ApiModelProperty(value = "创建时间")
66
+    private Date createTime;
67
+
68
+    @ApiModelProperty(value = "业务ID")
69
+    private String businessKey;
70
+
71
+    @ApiModelProperty(value = "流程定义名称")
72
+    private String processDefinitionName;
73
+
74
+    @ApiModelProperty(value = "流程定义KEY")
75
+    private String processDefinitionKey;
76
+
77
+    @ApiModelProperty(value = "流程发起时间")
78
+    private Date startTime;
79
+
80
+}

+ 40 - 0
eitc-admin/src/main/java/com/eitc/modules/activiti/entity/HistoryDetailEntity.java

@@ -0,0 +1,40 @@
1
+package com.eitc.modules.activiti.entity;
2
+
3
+import lombok.Data;
4
+import lombok.EqualsAndHashCode;
5
+
6
+import java.util.Date;
7
+
8
+/**
9
+ * @author Jone
10
+ */
11
+@Data
12
+@EqualsAndHashCode(callSuper=false)
13
+public class HistoryDetailEntity {
14
+    private static final long serialVersionUID = 1L;
15
+
16
+    private String id;
17
+
18
+    private String activityName;
19
+
20
+    private String activityType;
21
+
22
+    private String processDefinitionId;
23
+
24
+    private String processInstanceId;
25
+
26
+    private String taskId;
27
+
28
+    private String executionId;
29
+
30
+    private String assignee;
31
+
32
+    private Date startTime;
33
+
34
+    private Date endTime;
35
+
36
+    private Long durationInSeconds;
37
+
38
+    private String comment;
39
+
40
+}

+ 37 - 0
eitc-admin/src/main/java/com/eitc/modules/activiti/entity/ProcessActivityEntity.java

@@ -0,0 +1,37 @@
1
+
2
+package com.eitc.modules.activiti.entity;
3
+
4
+import com.eitc.common.entity.BaseEntity;
5
+import lombok.Data;
6
+import lombok.EqualsAndHashCode;
7
+
8
+import java.util.Date;
9
+
10
+/**
11
+ * @author Jone
12
+ */
13
+@Data
14
+@EqualsAndHashCode(callSuper=false)
15
+public class ProcessActivityEntity extends BaseEntity {
16
+
17
+    private static final long serialVersionUID = 1L;
18
+
19
+    private String processDefinitionId;
20
+
21
+    private String processDefinitionName;
22
+
23
+    private Integer processDefinitionVersion;
24
+
25
+    private String processInstanceId;
26
+
27
+    private String businessKey;
28
+
29
+    private Date startTime;
30
+
31
+    private Date endTime;
32
+
33
+    private String startUserId;
34
+
35
+    private String assignee;
36
+
37
+}

+ 24 - 0
eitc-admin/src/main/java/com/eitc/modules/activiti/entity/ProcessBizRouteEntity.java

@@ -0,0 +1,24 @@
1
+package com.eitc.modules.activiti.entity;
2
+
3
+import com.baomidou.mybatisplus.annotation.TableName;
4
+import lombok.Data;
5
+
6
+/**
7
+ * @Author:Jone
8
+ */
9
+@Data
10
+@TableName("tb_process_biz_route")
11
+public class ProcessBizRouteEntity {
12
+
13
+    private static final long serialVersionUID = 1L;
14
+
15
+    private Long id;
16
+
17
+    private String procDefId;
18
+
19
+    private String bizRoute;
20
+
21
+    private String procDefKey;
22
+
23
+    private Integer version;
24
+}

+ 30 - 0
eitc-admin/src/main/java/com/eitc/modules/activiti/org/activiti/rest/editor/main/StencilsetRestResource.java

@@ -0,0 +1,30 @@
1
+package com.eitc.modules.activiti.org.activiti.rest.editor.main;
2
+
3
+import org.activiti.engine.ActivitiException;
4
+import org.apache.commons.io.IOUtils;
5
+import org.springframework.web.bind.annotation.RequestMapping;
6
+import org.springframework.web.bind.annotation.RequestMethod;
7
+import org.springframework.web.bind.annotation.ResponseBody;
8
+import org.springframework.web.bind.annotation.RestController;
9
+
10
+import java.io.InputStream;
11
+
12
+/**
13
+ * Stencilset
14
+ *
15
+ * @author Mark eitc@163.com
16
+ */
17
+@RestController
18
+@RequestMapping("service")
19
+public class StencilsetRestResource {
20
+
21
+  @RequestMapping(value="/editor/stencilset", method = RequestMethod.GET, produces = "application/json;charset=utf-8")
22
+  public @ResponseBody String getStencilset() {
23
+    InputStream stencilsetStream = this.getClass().getClassLoader().getResourceAsStream("stencilset.json");
24
+    try {
25
+      return IOUtils.toString(stencilsetStream, "utf-8");
26
+    } catch (Exception e) {
27
+      throw new ActivitiException("Error while loading stencil set", e);
28
+    }
29
+  }
30
+}

+ 61 - 0
eitc-admin/src/main/java/com/eitc/modules/activiti/org/activiti/rest/editor/model/ModelEditorJsonRestResource.java

@@ -0,0 +1,61 @@
1
+package com.eitc.modules.activiti.org.activiti.rest.editor.model;
2
+
3
+import com.fasterxml.jackson.databind.ObjectMapper;
4
+import com.fasterxml.jackson.databind.node.ObjectNode;
5
+import org.activiti.editor.constants.ModelDataJsonConstants;
6
+import org.activiti.engine.ActivitiException;
7
+import org.activiti.engine.RepositoryService;
8
+import org.activiti.engine.repository.Model;
9
+import org.apache.commons.lang3.StringUtils;
10
+import org.slf4j.Logger;
11
+import org.slf4j.LoggerFactory;
12
+import org.springframework.beans.factory.annotation.Autowired;
13
+import org.springframework.web.bind.annotation.PathVariable;
14
+import org.springframework.web.bind.annotation.RequestMapping;
15
+import org.springframework.web.bind.annotation.RequestMethod;
16
+import org.springframework.web.bind.annotation.RestController;
17
+
18
+/**
19
+ * Model Editor
20
+ *
21
+ * @author Mark eitc@163.com
22
+ */
23
+@RestController
24
+@RequestMapping("service")
25
+public class ModelEditorJsonRestResource implements ModelDataJsonConstants {
26
+
27
+  protected static final Logger LOGGER = LoggerFactory.getLogger(ModelEditorJsonRestResource.class);
28
+
29
+  @Autowired
30
+  private RepositoryService repositoryService;
31
+
32
+  @Autowired
33
+  private ObjectMapper objectMapper;
34
+
35
+  @RequestMapping(value="/model/{modelId}/json", method = RequestMethod.GET, produces = "application/json")
36
+  public ObjectNode getEditorJson(@PathVariable String modelId) {
37
+    ObjectNode modelNode = null;
38
+
39
+    Model model = repositoryService.getModel(modelId);
40
+
41
+    if (model != null) {
42
+      try {
43
+        if (StringUtils.isNotEmpty(model.getMetaInfo())) {
44
+          modelNode = (ObjectNode) objectMapper.readTree(model.getMetaInfo());
45
+        } else {
46
+          modelNode = objectMapper.createObjectNode();
47
+          modelNode.put(MODEL_NAME, model.getName());
48
+        }
49
+        modelNode.put(MODEL_ID, model.getId());
50
+        ObjectNode editorJsonNode = (ObjectNode) objectMapper.readTree(
51
+            new String(repositoryService.getModelEditorSource(model.getId()), "utf-8"));
52
+        modelNode.set("model", editorJsonNode);
53
+
54
+      } catch (Exception e) {
55
+        LOGGER.error("Error creating model JSON", e);
56
+        throw new ActivitiException("Error creating model JSON", e);
57
+      }
58
+    }
59
+    return modelNode;
60
+  }
61
+}

+ 82 - 0
eitc-admin/src/main/java/com/eitc/modules/activiti/org/activiti/rest/editor/model/ModelSaveRestResource.java

@@ -0,0 +1,82 @@
1
+package com.eitc.modules.activiti.org.activiti.rest.editor.model;
2
+
3
+import com.fasterxml.jackson.databind.ObjectMapper;
4
+import com.fasterxml.jackson.databind.node.ObjectNode;
5
+import com.eitc.common.xss.XssHttpServletRequestWrapper;
6
+import org.activiti.editor.constants.ModelDataJsonConstants;
7
+import org.activiti.engine.ActivitiException;
8
+import org.activiti.engine.RepositoryService;
9
+import org.activiti.engine.repository.Model;
10
+import org.apache.batik.transcoder.TranscoderInput;
11
+import org.apache.batik.transcoder.TranscoderOutput;
12
+import org.apache.batik.transcoder.image.PNGTranscoder;
13
+import org.slf4j.Logger;
14
+import org.slf4j.LoggerFactory;
15
+import org.springframework.beans.factory.annotation.Autowired;
16
+import org.springframework.http.HttpStatus;
17
+import org.springframework.web.bind.annotation.*;
18
+
19
+import javax.servlet.http.HttpServletRequest;
20
+import java.io.ByteArrayInputStream;
21
+import java.io.ByteArrayOutputStream;
22
+import java.io.InputStream;
23
+
24
+/**
25
+ * Model Rest
26
+ *
27
+ * @author Mark eitc@163.com
28
+ */
29
+@RestController
30
+@RequestMapping("service")
31
+public class ModelSaveRestResource implements ModelDataJsonConstants {
32
+    protected static final Logger LOGGER = LoggerFactory.getLogger(ModelSaveRestResource.class);
33
+
34
+    @Autowired
35
+    private RepositoryService repositoryService;
36
+    @Autowired
37
+    private ObjectMapper objectMapper;
38
+
39
+    @RequestMapping(value="/model/{modelId}/save", method = RequestMethod.PUT)
40
+    @ResponseStatus(value = HttpStatus.OK)
41
+    public void saveModel(@PathVariable String modelId, HttpServletRequest request) {
42
+        try {
43
+            HttpServletRequest orgRequest = XssHttpServletRequestWrapper.getOrgRequest(request);
44
+            String name = orgRequest.getParameter("name");
45
+            String description = orgRequest.getParameter("description");
46
+            String jsonXml = orgRequest.getParameter("json_xml");
47
+            String svgXml = orgRequest.getParameter("svg_xml");
48
+
49
+            Model model = repositoryService.getModel(modelId);
50
+
51
+            ObjectNode modelJson = (ObjectNode) objectMapper.readTree(model.getMetaInfo());
52
+
53
+            modelJson.put(MODEL_NAME, name);
54
+            modelJson.put(MODEL_DESCRIPTION, description);
55
+            model.setMetaInfo(modelJson.toString());
56
+            model.setName(name);
57
+
58
+            repositoryService.saveModel(model);
59
+
60
+            repositoryService.addModelEditorSource(model.getId(), jsonXml.getBytes("utf-8"));
61
+
62
+            InputStream svgStream = new ByteArrayInputStream(svgXml.getBytes("utf-8"));
63
+            TranscoderInput input = new TranscoderInput(svgStream);
64
+
65
+            PNGTranscoder transcoder = new PNGTranscoder();
66
+            // Setup output
67
+            ByteArrayOutputStream outStream = new ByteArrayOutputStream();
68
+            TranscoderOutput output = new TranscoderOutput(outStream);
69
+
70
+            // Do the transformation
71
+            transcoder.transcode(input, output);
72
+            final byte[] result = outStream.toByteArray();
73
+            repositoryService.addModelEditorSourceExtra(model.getId(), result);
74
+            outStream.close();
75
+
76
+        } catch (Exception e) {
77
+            LOGGER.error("Error saving model", e);
78
+            throw new ActivitiException("Error saving model", e);
79
+        }
80
+    }
81
+
82
+}

+ 290 - 0
eitc-admin/src/main/java/com/eitc/modules/activiti/service/ActHistoryService.java

@@ -0,0 +1,290 @@
1
+package com.eitc.modules.activiti.service;
2
+
3
+import com.eitc.common.constant.Constant;
4
+import com.eitc.common.page.PageData;
5
+import com.eitc.modules.activiti.dto.ProcessInstanceDTO;
6
+import com.eitc.modules.activiti.dto.TaskDTO;
7
+import com.eitc.modules.security.user.SecurityUser;
8
+import com.eitc.modules.sys.dto.SysUserDTO;
9
+import com.eitc.modules.sys.service.SysUserService;
10
+import org.activiti.bpmn.model.BpmnModel;
11
+import org.activiti.engine.*;
12
+import org.activiti.engine.history.HistoricActivityInstance;
13
+import org.activiti.engine.history.HistoricProcessInstance;
14
+import org.activiti.engine.history.HistoricProcessInstanceQuery;
15
+import org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl;
16
+import org.activiti.engine.impl.context.Context;
17
+import org.activiti.engine.impl.persistence.entity.ExecutionEntity;
18
+import org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity;
19
+import org.activiti.engine.impl.pvm.PvmTransition;
20
+import org.activiti.engine.impl.pvm.process.ActivityImpl;
21
+import org.activiti.engine.task.Task;
22
+import org.activiti.image.ProcessDiagramGenerator;
23
+import org.activiti.spring.ProcessEngineFactoryBean;
24
+import org.apache.commons.lang3.StringUtils;
25
+import org.springframework.beans.factory.annotation.Autowired;
26
+import org.springframework.stereotype.Service;
27
+
28
+import javax.imageio.ImageIO;
29
+import javax.servlet.http.HttpServletResponse;
30
+import java.awt.image.BufferedImage;
31
+import java.io.InputStream;
32
+import java.util.ArrayList;
33
+import java.util.Date;
34
+import java.util.List;
35
+import java.util.Map;
36
+
37
+/**
38
+ * 工作流
39
+ *
40
+ * @author Jone
41
+ */
42
+@Service
43
+public class ActHistoryService {
44
+
45
+    @Autowired
46
+    protected RepositoryService repositoryService;
47
+
48
+    @Autowired
49
+    protected RuntimeService runtimeService;
50
+
51
+    @Autowired
52
+    protected HistoryService historyService;
53
+
54
+    @Autowired
55
+    protected ProcessEngineConfiguration processEngineConfiguration;
56
+
57
+    @Autowired
58
+    protected ProcessEngineFactoryBean processEngine;
59
+
60
+    @Autowired
61
+    protected TaskService taskService;
62
+
63
+    @Autowired
64
+    private SysUserService sysUserService;
65
+
66
+
67
+
68
+    public void getProcessInstanceDiagram(String processInstanceId, HttpServletResponse response) throws Exception {
69
+        if(StringUtils.isEmpty(processInstanceId)){
70
+            return;
71
+        }
72
+        HistoricProcessInstance processInstance =  historyService.createHistoricProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
73
+        BpmnModel bpmnModel = repositoryService.getBpmnModel(processInstance.getProcessDefinitionId());
74
+        processEngineConfiguration = processEngine.getProcessEngineConfiguration();
75
+        Context.setProcessEngineConfiguration((ProcessEngineConfigurationImpl) processEngineConfiguration);
76
+
77
+        ProcessDiagramGenerator diagramGenerator = processEngineConfiguration.getProcessDiagramGenerator();
78
+        ProcessDefinitionEntity definitionEntity = (ProcessDefinitionEntity)repositoryService.getProcessDefinition(processInstance.getProcessDefinitionId());
79
+
80
+        List<HistoricActivityInstance> highLightedActivitList =  historyService.createHistoricActivityInstanceQuery().processInstanceId(processInstanceId).orderByHistoricActivityInstanceStartTime()
81
+                .asc().list();
82
+        //高亮环节id集合
83
+        List<String> highLightedActivitis = new ArrayList<String>();
84
+        for (HistoricActivityInstance tempActivity : highLightedActivitList) {
85
+            String activityId = tempActivity.getActivityId();
86
+            highLightedActivitis.add(activityId);
87
+        }
88
+
89
+        //高亮线路id集合
90
+        List<String> highLightedFlows = getHighLightedFlows(definitionEntity,highLightedActivitList);
91
+
92
+        ExecutionEntity execution = (ExecutionEntity) runtimeService.createExecutionQuery().executionId(processInstanceId).singleResult();
93
+        if(null != execution) {
94
+            highLightedActivitis.add(execution.getActivityId());
95
+        }
96
+
97
+        InputStream imageStream = diagramGenerator.generateDiagram(bpmnModel, "png", highLightedActivitis,highLightedFlows,"宋体","宋体", "宋体",null,1.0);
98
+
99
+        response.setHeader("Content-Type","image/png");
100
+        response.setHeader("Cache-Control", "no-store, no-cache");
101
+        BufferedImage bufferedImage =  ImageIO.read(imageStream);
102
+        ImageIO.write(bufferedImage, "png", response.getOutputStream());
103
+
104
+    }
105
+    /**
106
+     * 获取需要高亮的线
107
+     * @param processDefinitionEntity
108
+     * @param historicActivityInstances
109
+     * @return
110
+     */
111
+    private List<String> getHighLightedFlows(ProcessDefinitionEntity processDefinitionEntity,
112
+            List<HistoricActivityInstance> historicActivityInstances) {
113
+        List<String> highFlows = new ArrayList<>();
114
+        for (int i = 0; i < historicActivityInstances.size() - 1; i++) {
115
+            ActivityImpl activityImpl = processDefinitionEntity.findActivity(historicActivityInstances.get(i).getActivityId());
116
+            List<ActivityImpl> sameStartTimeNodes = new ArrayList<>();
117
+            ActivityImpl sameActivityImpl1 = processDefinitionEntity.findActivity(historicActivityInstances.get(i + 1).getActivityId());
118
+            sameStartTimeNodes.add(sameActivityImpl1);
119
+            for (int j = i + 1; j < historicActivityInstances.size() - 1; j++) {
120
+                HistoricActivityInstance activityImpl1 = historicActivityInstances.get(j);
121
+                HistoricActivityInstance activityImpl2 = historicActivityInstances.get(j + 1);
122
+                if (Math.abs(activityImpl1.getStartTime().getTime()-activityImpl2.getStartTime().getTime()) < 200) {
123
+                    ActivityImpl sameActivityImpl2 = processDefinitionEntity.findActivity(activityImpl2.getActivityId());
124
+                    sameStartTimeNodes.add(sameActivityImpl2);
125
+                } else {
126
+                    break;
127
+                }
128
+            }
129
+            for(int j = i+1; j < historicActivityInstances.size() - 1; j++){
130
+                HistoricActivityInstance activityImpl1 = historicActivityInstances.get(j);
131
+                if(null != historicActivityInstances.get(i).getEndTime()){
132
+                    if (Math.abs(activityImpl1.getStartTime().getTime()-historicActivityInstances.get(i).getEndTime().getTime()) < 200) {
133
+                        ActivityImpl sameActivityImpl2 = processDefinitionEntity.findActivity(activityImpl1.getActivityId());
134
+                        sameStartTimeNodes.add(sameActivityImpl2);
135
+                    }
136
+                }
137
+            }
138
+            List<PvmTransition> pvmTransitions = activityImpl.getOutgoingTransitions();
139
+            for (PvmTransition pvmTransition : pvmTransitions) {
140
+                ActivityImpl pvmActivityImpl = (ActivityImpl) pvmTransition.getDestination();
141
+                if (sameStartTimeNodes.contains(pvmActivityImpl)) {
142
+                    highFlows.add(pvmTransition.getId());
143
+                }
144
+            }
145
+        }
146
+        return highFlows;
147
+    }
148
+
149
+
150
+    public PageData<ProcessInstanceDTO> getHistoryProcessInstancePage(Map<String, Object> params) {
151
+        HistoricProcessInstanceQuery query = historyService.createHistoricProcessInstanceQuery();
152
+        Integer curPage = 1;
153
+        Integer limit = 10;
154
+        if(params.get(Constant.PAGE) != null){
155
+            curPage = Integer.parseInt((String)params.get(Constant.PAGE));
156
+        }
157
+        if(params.get(Constant.LIMIT) != null){
158
+            limit = Integer.parseInt((String)params.get(Constant.LIMIT));
159
+        }
160
+
161
+        if(StringUtils.isNotEmpty((String)params.get("processInstanceId"))){
162
+            query.processInstanceId((String)params.get("processInstanceId"));
163
+        }
164
+
165
+        if(StringUtils.isNotEmpty((String)params.get("businessKey"))){
166
+            query.processInstanceBusinessKey((String)params.get("businessKey"));
167
+        }
168
+
169
+        if(StringUtils.isNotEmpty((String)params.get("processDefinitionId"))){
170
+            query.processDefinitionId((String)params.get("processDefinitionId"));
171
+        }
172
+        if(StringUtils.isNotEmpty((String)params.get("ended"))){
173
+            if("true".equals((String)params.get("ended"))){
174
+                query.finished();
175
+            } else if("false".equals((String)params.get("ended"))){
176
+                query.unfinished();
177
+            }
178
+        }
179
+        if(null != params.get("finishedBeginTime")){
180
+            query.finishedAfter((Date) params.get("finishedBeginTime"));
181
+        }
182
+        if(null != params.get("finishedEndTime")){
183
+            query.finishedBefore((Date) params.get("finishedEndTime"));
184
+        }
185
+        if(null != params.get("startBeginTime")){
186
+            query.startedAfter((Date) params.get("startBeginTime"));
187
+        }
188
+        if(null != params.get("startEndTime")){
189
+            query.startedBefore((Date) params.get("startEndTime"));
190
+        }
191
+        if(StringUtils.isNotEmpty((String)params.get("startBy"))){
192
+            query.startedBy((String)params.get("startBy"));
193
+        }
194
+        query.orderByProcessInstanceStartTime().desc();
195
+        List<HistoricProcessInstance> list =  query.listPage((curPage-1)*limit, limit);
196
+        List<ProcessInstanceDTO> listInstance = new ArrayList<>();
197
+        if(!list.isEmpty()){
198
+            this.converHistoricProcessInstance(list, listInstance);
199
+        }
200
+
201
+        return new PageData<ProcessInstanceDTO>(listInstance, (int) query.count());
202
+    }
203
+
204
+    private void converHistoricProcessInstance(List<HistoricProcessInstance> list, List<ProcessInstanceDTO> listInstance) {
205
+        for(HistoricProcessInstance historicProcessInstance : list){
206
+            ProcessInstanceDTO dto = new ProcessInstanceDTO();
207
+            dto.setProcessDefinitionId(historicProcessInstance.getProcessDefinitionId());
208
+            dto.setProcessInstanceId(historicProcessInstance.getId());
209
+            dto.setProcessDefinitionVersion(historicProcessInstance.getProcessDefinitionVersion());
210
+            dto.setProcessDefinitionName(historicProcessInstance.getProcessDefinitionName());
211
+            dto.setProcessDefinitionKey(historicProcessInstance.getProcessDefinitionKey());
212
+            if(null != historicProcessInstance.getEndTime()){
213
+                dto.setEnded(true);
214
+            } else {
215
+                dto.setEnded(false);
216
+            }
217
+            dto.setEndTime(historicProcessInstance.getEndTime());
218
+            dto.setStartTime(historicProcessInstance.getStartTime());
219
+            dto.setBusinessKey(historicProcessInstance.getBusinessKey());
220
+            dto.setCreateUserId(historicProcessInstance.getStartUserId());
221
+            listInstance.add(dto);
222
+        }
223
+
224
+    }
225
+
226
+    /**
227
+     * 我发起的流程
228
+     * 根据登录用户信息获取处理中的示例和任务信息
229
+     * @param params
230
+     * @return
231
+     */
232
+    public PageData<ProcessInstanceDTO> getMyProcessInstancePage(Map<String, Object> params) {
233
+        params.put("startBy", SecurityUser.getUserId().toString());
234
+        PageData<ProcessInstanceDTO> pageData = this.getHistoryProcessInstancePage(params);
235
+        List<ProcessInstanceDTO> list = pageData.getList();
236
+        for(ProcessInstanceDTO dto : list){
237
+            if(dto.isEnded()){
238
+                continue;
239
+            }
240
+            List<Task> listTask = taskService.createTaskQuery().processInstanceId(dto.getProcessInstanceId()).list();
241
+            List<TaskDTO> taskDTOList = new ArrayList<>();
242
+            for(Task task : listTask){
243
+                TaskDTO taskDTO = new TaskDTO();
244
+                this.convertTaskInfo(task, taskDTO);
245
+                if(StringUtils.isNotEmpty(taskDTO.getAssignee())){
246
+                    SysUserDTO userDTO = sysUserService.get(Long.valueOf(taskDTO.getAssignee()));
247
+                    taskDTO.setAssigneeName(userDTO.getRealName());
248
+                }
249
+                taskDTOList.add(taskDTO);
250
+            }
251
+            dto.setCurrentTaskList(taskDTOList);
252
+        }
253
+        return pageData;
254
+    }
255
+
256
+    /**
257
+     * 转换Task对象
258
+     * @param task
259
+     * @param dto
260
+     */
261
+    private void convertTaskInfo(Task task, TaskDTO dto) {
262
+        dto.setTaskId(task.getId());
263
+        dto.setTaskName(task.getName());
264
+        dto.setActivityId(task.getExecutionId());
265
+        dto.setAssignee(task.getAssignee());
266
+        dto.setProcessDefinitionId(task.getProcessDefinitionId());
267
+        dto.setProcessInstanceId(task.getProcessInstanceId());
268
+        dto.setOwner(task.getOwner());
269
+        dto.setCreateTime(task.getCreateTime());
270
+    }
271
+
272
+    public ProcessInstanceDTO getHistoryProcessInstanceByBusinessKey(String procDefKey, String businessKey) {
273
+        HistoricProcessInstanceQuery query = historyService.createHistoricProcessInstanceQuery();
274
+        if(StringUtils.isNotEmpty(businessKey)){
275
+            query.processInstanceBusinessKey(businessKey);
276
+        }
277
+
278
+        if(StringUtils.isNotEmpty(procDefKey)){
279
+            query.processDefinitionKey(procDefKey);
280
+        }
281
+        List<HistoricProcessInstance> list =  query.list();
282
+        List<ProcessInstanceDTO> listInstance = new ArrayList<>();
283
+        if(!list.isEmpty()){
284
+            this.converHistoricProcessInstance(list, listInstance);
285
+        } else {
286
+            return null;
287
+        }
288
+        return listInstance.get(0);
289
+    }
290
+}

+ 191 - 0
eitc-admin/src/main/java/com/eitc/modules/activiti/service/ActModelService.java

@@ -0,0 +1,191 @@
1
+package com.eitc.modules.activiti.service;
2
+
3
+import com.fasterxml.jackson.databind.JsonNode;
4
+import com.fasterxml.jackson.databind.ObjectMapper;
5
+import com.fasterxml.jackson.databind.node.ObjectNode;
6
+import com.eitc.common.constant.Constant;
7
+import com.eitc.common.exception.ErrorCode;
8
+import com.eitc.common.exception.RenException;
9
+import com.eitc.common.page.PageData;
10
+import org.activiti.bpmn.converter.BpmnXMLConverter;
11
+import org.activiti.bpmn.model.BpmnModel;
12
+import org.activiti.editor.constants.ModelDataJsonConstants;
13
+import org.activiti.editor.language.json.converter.BpmnJsonConverter;
14
+import org.activiti.engine.RepositoryService;
15
+import org.activiti.engine.repository.Deployment;
16
+import org.activiti.engine.repository.Model;
17
+import org.activiti.engine.repository.ModelQuery;
18
+import org.activiti.engine.repository.ProcessDefinition;
19
+import org.apache.commons.io.IOUtils;
20
+import org.apache.commons.lang3.StringUtils;
21
+import org.springframework.beans.factory.annotation.Autowired;
22
+import org.springframework.stereotype.Service;
23
+
24
+import javax.imageio.ImageIO;
25
+import javax.servlet.http.HttpServletResponse;
26
+import java.awt.image.BufferedImage;
27
+import java.io.ByteArrayInputStream;
28
+import java.io.IOException;
29
+import java.io.InputStream;
30
+import java.io.UnsupportedEncodingException;
31
+import java.net.URLEncoder;
32
+import java.util.List;
33
+import java.util.Map;
34
+
35
+/**
36
+ * 模型管理
37
+ *
38
+ * @author Mark eitc@163.com
39
+ */
40
+@Service
41
+public class ActModelService {
42
+    @Autowired
43
+    protected RepositoryService repositoryService;
44
+    @Autowired
45
+    private ObjectMapper objectMapper;
46
+
47
+    public PageData<Model> page(Map<String, Object> params) {
48
+        String key = (String)params.get("key");
49
+        String name = (String)params.get("name");
50
+
51
+        //分页参数
52
+        int curPage = 1;
53
+        int limit = 10;
54
+        if(params.get(Constant.PAGE) != null){
55
+            curPage = Integer.parseInt((String)params.get(Constant.PAGE));
56
+        }
57
+        if(params.get(Constant.LIMIT) != null){
58
+            limit = Integer.parseInt((String)params.get(Constant.LIMIT));
59
+        }
60
+
61
+        ModelQuery modelQuery = repositoryService.createModelQuery().latestVersion().orderByLastUpdateTime().desc();
62
+
63
+        if(StringUtils.isNotEmpty(key)){
64
+            modelQuery.modelKey(key);
65
+        }
66
+        if(StringUtils.isNotEmpty(name)){
67
+            modelQuery.modelName(name);
68
+        }
69
+
70
+        List<Model> list = modelQuery.listPage((curPage - 1) * limit, limit);
71
+        return new PageData<>(list, (int)modelQuery.count());
72
+    }
73
+
74
+    public void save(String name, String key, String description) throws UnsupportedEncodingException {
75
+        //新建一个空模型
76
+        Model model = repositoryService.newModel();
77
+
78
+        //metaInfo信息
79
+        ObjectNode metaInfo = objectMapper.createObjectNode();
80
+        metaInfo.put(ModelDataJsonConstants.MODEL_NAME, name);
81
+        metaInfo.put(ModelDataJsonConstants.MODEL_DESCRIPTION, description);
82
+        metaInfo.put(ModelDataJsonConstants.MODEL_REVISION, model.getVersion());
83
+
84
+        model.setKey(key);
85
+        model.setName(name);
86
+        model.setMetaInfo(metaInfo.toString());
87
+
88
+        repositoryService.saveModel(model);
89
+
90
+        ObjectNode editorNode = objectMapper.createObjectNode();
91
+        editorNode.put("id", "canvas");
92
+        editorNode.put("resourceId", "canvas");
93
+        ObjectNode stencilset = objectMapper.createObjectNode();
94
+        stencilset.put("namespace", "http://b3mn.org/stencilset/bpmn2.0#");
95
+        editorNode.set("stencilset", stencilset);
96
+        repositoryService.addModelEditorSource(model.getId(), editorNode.toString().getBytes("utf-8"));
97
+    }
98
+
99
+    public void deploy(String id) {
100
+        try {
101
+            Model model = repositoryService.getModel(id);
102
+            BpmnJsonConverter jsonConverter = new BpmnJsonConverter();
103
+            JsonNode editorNode = new ObjectMapper().readTree(repositoryService.getModelEditorSource(model.getId()));
104
+            BpmnModel bpmnModel = jsonConverter.convertToBpmnModel(editorNode);
105
+            BpmnXMLConverter xmlConverter = new BpmnXMLConverter();
106
+            byte[] bpmnBytes = xmlConverter.convertToXML(bpmnModel);
107
+            if(bpmnModel.getProcesses().isEmpty()){
108
+                throw new RenException(ErrorCode.ACT_DEPLOY_ERROR);
109
+            }
110
+            String processName = model.getName();
111
+            if (!StringUtils.endsWith(processName, ".bpmn20.xml")){
112
+                processName += ".bpmn20.xml";
113
+            }
114
+
115
+            ByteArrayInputStream in = new ByteArrayInputStream(bpmnBytes);
116
+            Deployment deployment = repositoryService.createDeployment().name(model.getName()).addInputStream(processName, in).deploy();
117
+
118
+            List<ProcessDefinition> list = repositoryService.createProcessDefinitionQuery().deploymentId(deployment.getId()).list();
119
+            if (list.size() == 0){
120
+                throw new RenException(ErrorCode.ACT_DEPLOY_ERROR);
121
+            }
122
+        } catch (Exception e) {
123
+            throw new RenException(ErrorCode.ACT_MODEL_IMG_ERROR, e);
124
+        }
125
+    }
126
+
127
+    /**
128
+     * 导出模型
129
+     */
130
+    public void export(String id, HttpServletResponse response) {
131
+        try {
132
+            Model model = repositoryService.getModel(id);
133
+            BpmnJsonConverter jsonConverter = new BpmnJsonConverter();
134
+            JsonNode editorNode = new ObjectMapper().readTree(repositoryService.getModelEditorSource(model.getId()));
135
+            BpmnModel bpmnModel = jsonConverter.convertToBpmnModel(editorNode);
136
+            BpmnXMLConverter xmlConverter = new BpmnXMLConverter();
137
+            byte[] bpmnBytes = xmlConverter.convertToXML(bpmnModel);
138
+
139
+            ByteArrayInputStream in = new ByteArrayInputStream(bpmnBytes);
140
+            IOUtils.copy(in, response.getOutputStream());
141
+            String filename = bpmnModel.getMainProcess().getId() + ".bpmn20.xml";
142
+            response.setHeader("Content-Disposition", "attachment; filename=" + filename);
143
+            response.flushBuffer();
144
+        } catch (Exception e) {
145
+            throw new RenException(ErrorCode.ACT_MODEL_EXPORT_ERROR, id);
146
+        }
147
+    }
148
+
149
+    /**
150
+     * 删除模型
151
+     * @param id  模型ID
152
+     */
153
+    public void delete(String id) {
154
+        repositoryService.deleteModel(id);
155
+    }
156
+
157
+    public void deployImage(String deploymentId, HttpServletResponse response) {
158
+        List <String> names = repositoryService.getDeploymentResourceNames(deploymentId);
159
+        String imageName = null;
160
+        for(String name: names){
161
+            if(name.indexOf(".png")>=0){
162
+                imageName = name;
163
+                break;
164
+            }
165
+        }
166
+        InputStream in = null;
167
+        InputStream in1 = null;
168
+        try {
169
+            if(StringUtils.isNotEmpty(imageName)){
170
+                in = repositoryService.getResourceAsStream(deploymentId,imageName);
171
+                response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(imageName, "UTF-8"));
172
+                response.setHeader("Content-Type","image/png");
173
+                response.setHeader("Cache-Control", "no-store, no-cache");
174
+                BufferedImage bufferedImage =  ImageIO.read(in);
175
+                ImageIO.write(bufferedImage, "png", response.getOutputStream());
176
+            } else {
177
+                response.getWriter().println("No image Info!");
178
+            }
179
+        } catch (IOException e) {
180
+            e.printStackTrace();
181
+        } finally {
182
+            try {
183
+                if(null != in){
184
+                    in.close();
185
+                }
186
+            } catch (IOException e) {
187
+                e.printStackTrace();
188
+            }
189
+        }
190
+    }
191
+}

+ 206 - 0
eitc-admin/src/main/java/com/eitc/modules/activiti/service/ActProcessService.java

@@ -0,0 +1,206 @@
1
+package com.eitc.modules.activiti.service;
2
+
3
+import com.fasterxml.jackson.databind.ObjectMapper;
4
+import com.fasterxml.jackson.databind.node.ObjectNode;
5
+import com.eitc.common.constant.Constant;
6
+import com.eitc.common.exception.ErrorCode;
7
+import com.eitc.common.exception.RenException;
8
+import com.eitc.common.page.PageData;
9
+import org.activiti.bpmn.converter.BpmnXMLConverter;
10
+import org.activiti.bpmn.model.BpmnModel;
11
+import org.activiti.editor.constants.ModelDataJsonConstants;
12
+import org.activiti.editor.language.json.converter.BpmnJsonConverter;
13
+import org.activiti.engine.HistoryService;
14
+import org.activiti.engine.ProcessEngineConfiguration;
15
+import org.activiti.engine.RepositoryService;
16
+import org.activiti.engine.repository.Deployment;
17
+import org.activiti.engine.repository.Model;
18
+import org.activiti.engine.repository.ProcessDefinition;
19
+import org.activiti.engine.repository.ProcessDefinitionQuery;
20
+import org.apache.commons.io.FilenameUtils;
21
+import org.apache.commons.lang3.StringUtils;
22
+import org.springframework.beans.factory.annotation.Autowired;
23
+import org.springframework.stereotype.Service;
24
+import org.springframework.web.multipart.MultipartFile;
25
+
26
+import javax.xml.stream.XMLInputFactory;
27
+import javax.xml.stream.XMLStreamException;
28
+import javax.xml.stream.XMLStreamReader;
29
+import java.io.IOException;
30
+import java.io.InputStream;
31
+import java.io.InputStreamReader;
32
+import java.io.UnsupportedEncodingException;
33
+import java.util.ArrayList;
34
+import java.util.HashMap;
35
+import java.util.List;
36
+import java.util.Map;
37
+import java.util.zip.ZipInputStream;
38
+
39
+/**
40
+ * 流程管理
41
+ *
42
+ * @author Mark eitc@163.com
43
+ */
44
+@Service
45
+public class ActProcessService {
46
+    @Autowired
47
+    protected RepositoryService repositoryService;
48
+
49
+    @Autowired
50
+    protected HistoryService historyService;
51
+
52
+    @Autowired
53
+    protected ProcessEngineConfiguration processEngineConfiguration;
54
+
55
+    /**
56
+     * 流程列表
57
+     */
58
+    public PageData<Map<String, Object>> page(Map<String, Object> params) {
59
+        String key = (String)params.get("key");
60
+        String processName = (String)params.get("processName");
61
+        boolean isLatestVersion = params.get("isLatestVersion")== null? false : (boolean)params.get("isLatestVersion");
62
+
63
+        //分页参数
64
+        int curPage = 1;
65
+        int limit = 10;
66
+        if(params.get(Constant.PAGE) != null){
67
+            curPage = Integer.parseInt((String)params.get(Constant.PAGE));
68
+        }
69
+        if(params.get(Constant.LIMIT) != null){
70
+            limit = Integer.parseInt((String)params.get(Constant.LIMIT));
71
+        }
72
+
73
+        ProcessDefinitionQuery processDefinitionQuery = repositoryService.createProcessDefinitionQuery()
74
+            .orderByProcessDefinitionId().desc().orderByProcessDefinitionKey().desc();
75
+        if(isLatestVersion){
76
+            processDefinitionQuery.latestVersion();
77
+        }
78
+        if(StringUtils.isNotEmpty(key)){
79
+            processDefinitionQuery.processDefinitionKeyLike(key);
80
+        }
81
+        if(StringUtils.isNotEmpty(processName)){
82
+            processDefinitionQuery.processDefinitionNameLike(processName);
83
+        }
84
+
85
+        List<ProcessDefinition> processDefinitionList = processDefinitionQuery.listPage((curPage - 1) * limit, limit);
86
+
87
+        List<Map<String, Object>> objectList = new ArrayList<>();
88
+        for (ProcessDefinition processDefinition : processDefinitionList) {
89
+            objectList.add(processDefinitionConvert(processDefinition));
90
+        }
91
+
92
+        return new PageData<>(objectList, (int)processDefinitionQuery.count());
93
+    }
94
+
95
+
96
+    /**
97
+     * 流程定义信息
98
+     */
99
+    private Map<String, Object> processDefinitionConvert(ProcessDefinition processDefinition) {
100
+        String deploymentId = processDefinition.getDeploymentId();
101
+        Deployment deployment = repositoryService.createDeploymentQuery().deploymentId(deploymentId).singleResult();
102
+
103
+        Map<String, Object> map = new HashMap<>(9);
104
+        map.put("suspended", processDefinition.isSuspended());
105
+        map.put("id", processDefinition.getId());
106
+        map.put("deploymentId", processDefinition.getDeploymentId());
107
+        map.put("name", processDefinition.getName());
108
+        map.put("key", processDefinition.getKey());
109
+        map.put("version", processDefinition.getVersion());
110
+        map.put("resourceName", processDefinition.getResourceName());
111
+        map.put("diagramResourceName", processDefinition.getDiagramResourceName());
112
+        map.put("deploymentTime", deployment.getDeploymentTime());
113
+
114
+        return map;
115
+    }
116
+
117
+    /**
118
+     * 部署
119
+     * @param file 文件
120
+     */
121
+    public void deploy(MultipartFile file) throws IOException {
122
+        String fileName = file.getOriginalFilename();
123
+        String extension = FilenameUtils.getExtension(fileName);
124
+        if("zip".equalsIgnoreCase(extension) || "bar".equalsIgnoreCase(extension)) {
125
+            ZipInputStream zip = new ZipInputStream(file.getInputStream());
126
+            repositoryService.createDeployment().addZipInputStream(zip).deploy();
127
+        }else if(fileName.indexOf("bpmn20.xml") != -1){
128
+            repositoryService.createDeployment().addInputStream(fileName, file.getInputStream()).deploy();
129
+        }else if("bpmn".equalsIgnoreCase(extension)){
130
+            repositoryService.createDeployment().addInputStream(fileName, file.getInputStream()).deploy();
131
+        }else{
132
+            throw new RenException(ErrorCode.ACT_DEPLOY_FORMAT_ERROR);
133
+        }
134
+    }
135
+
136
+    /**
137
+     * 激活流程
138
+     * @param id 流程ID
139
+     */
140
+    public void active(String id){
141
+        repositoryService.activateProcessDefinitionById(id, true, null);
142
+    }
143
+
144
+    /**
145
+     * 挂起流程
146
+     * @param id 流程ID
147
+     */
148
+    public void suspend(String id){
149
+        repositoryService.suspendProcessDefinitionById(id, true, null);
150
+    }
151
+
152
+    /**
153
+     * 将部署的流程转换为模型
154
+     * @param id 流程ID
155
+     */
156
+    public Model convertToModel(String id) throws UnsupportedEncodingException, XMLStreamException {
157
+        ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionId(id).singleResult();
158
+        InputStream bpmnStream = repositoryService.getResourceAsStream(processDefinition.getDeploymentId(),
159
+                processDefinition.getResourceName());
160
+        XMLInputFactory xif = XMLInputFactory.newInstance();
161
+        InputStreamReader in = new InputStreamReader(bpmnStream, "UTF-8");
162
+        XMLStreamReader xtr = xif.createXMLStreamReader(in);
163
+        BpmnModel bpmnModel = new BpmnXMLConverter().convertToBpmnModel(xtr);
164
+
165
+        BpmnJsonConverter converter = new BpmnJsonConverter();
166
+        ObjectNode modelNode = converter.convertToJson(bpmnModel);
167
+        org.activiti.engine.repository.Model modelData = repositoryService.newModel();
168
+        modelData.setKey(processDefinition.getKey());
169
+        modelData.setName(processDefinition.getResourceName());
170
+        modelData.setCategory(processDefinition.getCategory());
171
+        modelData.setDeploymentId(processDefinition.getDeploymentId());
172
+        modelData.setVersion(Integer.parseInt(String.valueOf(repositoryService.createModelQuery().modelKey(modelData.getKey()).count()+1)));
173
+
174
+        ObjectNode modelObjectNode = new ObjectMapper().createObjectNode();
175
+        modelObjectNode.put(ModelDataJsonConstants.MODEL_NAME, processDefinition.getName());
176
+        modelObjectNode.put(ModelDataJsonConstants.MODEL_REVISION, modelData.getVersion());
177
+        modelObjectNode.put(ModelDataJsonConstants.MODEL_DESCRIPTION, processDefinition.getDescription());
178
+        modelData.setMetaInfo(modelObjectNode.toString());
179
+
180
+        repositoryService.saveModel(modelData);
181
+
182
+        repositoryService.addModelEditorSource(modelData.getId(), modelNode.toString().getBytes("utf-8"));
183
+
184
+        return modelData;
185
+    }
186
+
187
+    /**
188
+     * 删除部署
189
+     * @param deploymentId  部署ID
190
+     */
191
+    public void deleteDeployment(String deploymentId){
192
+        repositoryService.deleteDeployment(deploymentId, true);
193
+    }
194
+
195
+    /**
196
+     * 获取资源文件
197
+     * @param deploymentId  部署ID
198
+     * @param resourceName 资源名称
199
+     */
200
+    public InputStream getResourceAsStream(String deploymentId, String resourceName) {
201
+        InputStream resourceAsStream = repositoryService.getResourceAsStream(deploymentId, resourceName);
202
+
203
+        return resourceAsStream;
204
+    }
205
+
206
+}

+ 153 - 0
eitc-admin/src/main/java/com/eitc/modules/activiti/service/ActRunningService.java

@@ -0,0 +1,153 @@
1
+package com.eitc.modules.activiti.service;
2
+
3
+import com.eitc.common.constant.Constant;
4
+import com.eitc.common.exception.ErrorCode;
5
+import com.eitc.common.exception.RenException;
6
+import com.eitc.common.page.PageData;
7
+import com.eitc.modules.activiti.dto.ProcessInstanceDTO;
8
+import com.eitc.modules.activiti.dto.ProcessStartDTO;
9
+import com.eitc.modules.security.user.SecurityUser;
10
+import org.activiti.engine.IdentityService;
11
+import org.activiti.engine.RepositoryService;
12
+import org.activiti.engine.RuntimeService;
13
+import org.activiti.engine.impl.RepositoryServiceImpl;
14
+import org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity;
15
+import org.activiti.engine.impl.pvm.process.ActivityImpl;
16
+import org.activiti.engine.runtime.ProcessInstance;
17
+import org.activiti.engine.runtime.ProcessInstanceQuery;
18
+import org.apache.commons.lang3.StringUtils;
19
+import org.springframework.beans.factory.annotation.Autowired;
20
+import org.springframework.stereotype.Service;
21
+
22
+import java.util.ArrayList;
23
+import java.util.HashMap;
24
+import java.util.List;
25
+import java.util.Map;
26
+
27
+/**
28
+ * 运行中的流程
29
+ *
30
+ * @author Mark eitc@163.com
31
+ */
32
+@Service
33
+public class ActRunningService {
34
+    @Autowired
35
+    private RuntimeService runtimeService;
36
+
37
+    @Autowired
38
+    private IdentityService identityService;
39
+
40
+    @Autowired
41
+    protected RepositoryService repositoryService;
42
+
43
+    /**
44
+     * 流程定义列表
45
+     */
46
+    public PageData<Map<String, Object>> page(Map<String, Object> params) {
47
+        String id = (String)params.get("id");
48
+        String definitionKey = (String)params.get("definitionKey");
49
+
50
+        //分页参数
51
+        int curPage = 1;
52
+        int limit = 10;
53
+        if(params.get(Constant.PAGE) != null){
54
+            curPage = Integer.parseInt((String)params.get(Constant.PAGE));
55
+        }
56
+        if(params.get(Constant.LIMIT) != null){
57
+            limit = Integer.parseInt((String)params.get(Constant.LIMIT));
58
+        }
59
+
60
+        ProcessInstanceQuery processInstanceQuery = runtimeService.createProcessInstanceQuery();
61
+        if (StringUtils.isNotBlank(id)){
62
+            processInstanceQuery.processInstanceId(id);
63
+        }
64
+        if (StringUtils.isNotBlank(definitionKey)){
65
+            processInstanceQuery.processDefinitionKey(definitionKey);
66
+        }
67
+
68
+        List<ProcessInstance> processInstanceList = processInstanceQuery.listPage((curPage - 1) * limit, limit);
69
+        List<Map<String, Object>> objectList = new ArrayList<>();
70
+        for (ProcessInstance processInstance : processInstanceList) {
71
+            objectList.add(processInstanceConvert(processInstance));
72
+        }
73
+        return new PageData<>(objectList, (int)processInstanceQuery.count());
74
+    }
75
+
76
+    /**
77
+     * 流程实例信息
78
+     */
79
+    private Map<String, Object> processInstanceConvert(ProcessInstance processInstance) {
80
+        Map<String, Object> map = new HashMap<>(9);
81
+        map.put("id", processInstance.getId());
82
+        map.put("processInstanceId", processInstance.getProcessInstanceId());
83
+        map.put("processDefinitionId", processInstance.getProcessDefinitionId());
84
+        map.put("processDefinitionName", processInstance.getProcessDefinitionName());
85
+        map.put("processDefinitionKey", processInstance.getProcessDefinitionKey());
86
+        map.put("businessKey", processInstance.getBusinessKey());
87
+        map.put("activityId", processInstance.getActivityId());
88
+
89
+        ProcessDefinitionEntity definition = (ProcessDefinitionEntity)((RepositoryServiceImpl)repositoryService).getDeployedProcessDefinition(processInstance.getProcessDefinitionId());
90
+        ActivityImpl activity = definition.findActivity(processInstance.getActivityId());
91
+        map.put("activityName", activity.getProperty("name"));
92
+        map.put("suspended", processInstance.isSuspended());
93
+
94
+        return map;
95
+    }
96
+
97
+    /**
98
+     * 删除实例
99
+     * @param id  实例ID
100
+     */
101
+    public void delete(String id){
102
+        runtimeService.deleteProcessInstance(id, null);
103
+    }
104
+
105
+    /**
106
+     * 启动流程实例
107
+     * @param key 流程定义标识key
108
+     */
109
+    public ProcessInstanceDTO startProcess(String key){
110
+        String userId = SecurityUser.getUserId().toString();
111
+        identityService.setAuthenticatedUserId(userId);
112
+        ProcessDefinitionEntity definition = (ProcessDefinitionEntity)repositoryService.createProcessDefinitionQuery().processDefinitionKey(key).latestVersion().singleResult();
113
+        if(definition.isSuspended()){
114
+            throw new RenException(ErrorCode.PROCESS_START_ERROR);
115
+        }
116
+        ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(key);
117
+        ProcessInstanceDTO dto = new ProcessInstanceDTO();
118
+        this.convertInstance(processInstance, dto);
119
+        return dto;
120
+    }
121
+
122
+    private void convertInstance(ProcessInstance processInstance, ProcessInstanceDTO dto) {
123
+        dto.setBusinessKey(processInstance.getBusinessKey());
124
+        dto.setDeploymentId(processInstance.getDeploymentId());
125
+        dto.setDescription(processInstance.getDescription());
126
+        dto.setName(processInstance.getName());
127
+        dto.setEnded(processInstance.isEnded());
128
+        dto.setSuspended(processInstance.isSuspended());
129
+        dto.setProcessDefinitionId(processInstance.getProcessDefinitionId());
130
+        dto.setProcessDefinitionKey(processInstance.getProcessDefinitionKey());
131
+        dto.setProcessDefinitionName(processInstance.getProcessDefinitionName());
132
+        dto.setProcessDefinitionVersion(processInstance.getProcessDefinitionVersion());
133
+        dto.setProcessInstanceId(processInstance.getProcessInstanceId());
134
+    }
135
+
136
+    /**
137
+     * 根据流程Key,启动实例
138
+     * @param processStartDTO
139
+     * @return
140
+     */
141
+    public ProcessInstanceDTO startOfBusinessKey(ProcessStartDTO processStartDTO) {
142
+        String userId = SecurityUser.getUserId().toString();
143
+        identityService.setAuthenticatedUserId(userId);
144
+        ProcessDefinitionEntity definition = (ProcessDefinitionEntity)repositoryService.createProcessDefinitionQuery().processDefinitionKey(processStartDTO.getProcessDefinitionKey()).latestVersion().singleResult();
145
+        if(definition.isSuspended()){
146
+            throw new RenException(ErrorCode.PROCESS_START_ERROR);
147
+        }
148
+        ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(processStartDTO.getProcessDefinitionKey(), processStartDTO.getBusinessKey(),processStartDTO.getVariables());
149
+        ProcessInstanceDTO dto = new ProcessInstanceDTO();
150
+        this.convertInstance(processInstance, dto);
151
+        return dto;
152
+    }
153
+}

+ 558 - 0
eitc-admin/src/main/java/com/eitc/modules/activiti/service/ActTaskService.java

@@ -0,0 +1,558 @@
1
+package com.eitc.modules.activiti.service;
2
+
3
+import com.baomidou.mybatisplus.core.toolkit.IdWorker;
4
+import com.eitc.common.constant.Constant;
5
+import com.eitc.common.exception.ErrorCode;
6
+import com.eitc.common.exception.RenException;
7
+import com.eitc.common.page.PageData;
8
+import com.eitc.common.service.impl.BaseServiceImpl;
9
+import com.eitc.common.utils.MessageUtils;
10
+import com.eitc.modules.activiti.dto.TaskDTO;
11
+import com.eitc.modules.security.user.SecurityUser;
12
+import com.eitc.modules.sys.service.SysRoleUserService;
13
+import org.activiti.engine.HistoryService;
14
+import org.activiti.engine.RepositoryService;
15
+import org.activiti.engine.RuntimeService;
16
+import org.activiti.engine.TaskService;
17
+import org.activiti.engine.delegate.Expression;
18
+import org.activiti.engine.history.HistoricActivityInstance;
19
+import org.activiti.engine.history.HistoricProcessInstance;
20
+import org.activiti.engine.history.HistoricTaskInstance;
21
+import org.activiti.engine.impl.RepositoryServiceImpl;
22
+import org.activiti.engine.impl.bpmn.behavior.ParallelMultiInstanceBehavior;
23
+import org.activiti.engine.impl.bpmn.behavior.UserTaskActivityBehavior;
24
+import org.activiti.engine.impl.persistence.entity.ExecutionEntity;
25
+import org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity;
26
+import org.activiti.engine.impl.pvm.PvmTransition;
27
+import org.activiti.engine.impl.pvm.process.ActivityImpl;
28
+import org.activiti.engine.impl.pvm.process.TransitionImpl;
29
+import org.activiti.engine.impl.task.TaskDefinition;
30
+import org.activiti.engine.repository.ProcessDefinition;
31
+import org.activiti.engine.runtime.ProcessInstance;
32
+import org.activiti.engine.task.Task;
33
+import org.activiti.engine.task.TaskInfo;
34
+import org.activiti.engine.task.TaskQuery;
35
+import org.apache.commons.lang3.StringUtils;
36
+import org.springframework.beans.factory.annotation.Autowired;
37
+import org.springframework.stereotype.Service;
38
+import org.springframework.transaction.annotation.Transactional;
39
+
40
+import java.util.*;
41
+
42
+/**
43
+ * 任务管理
44
+ *
45
+ * @author Jone
46
+ */
47
+@Service
48
+public class ActTaskService extends BaseServiceImpl {
49
+    @Autowired
50
+    protected TaskService taskService;
51
+    @Autowired
52
+    protected HistoryService historyService;
53
+    @Autowired
54
+    protected RepositoryService repositoryService;
55
+    @Autowired
56
+    protected RuntimeService runtimeService;
57
+    @Autowired
58
+    private SysRoleUserService sysRoleUserService;
59
+
60
+    /**
61
+     * 根据参数获取当前运行的任务信息
62
+     *
63
+     * @param params
64
+     * @return
65
+     */
66
+    public PageData<TaskDTO> page(Map<String, Object> params) {
67
+        String userId = (String) params.get("userId");
68
+        Integer curPage = 1;
69
+        Integer limit = 10;
70
+        if (params.get(Constant.PAGE) != null) {
71
+            curPage = Integer.parseInt((String) params.get(Constant.PAGE));
72
+        }
73
+        if (params.get(Constant.LIMIT) != null) {
74
+            limit = Integer.parseInt((String) params.get(Constant.LIMIT));
75
+        }
76
+        TaskQuery taskQuery = taskService.createTaskQuery();
77
+        if (StringUtils.isNotEmpty(userId)) {
78
+            taskQuery.taskAssignee(userId);
79
+        }
80
+        if (StringUtils.isNotEmpty((String)params.get("taskName"))){
81
+            taskQuery.taskNameLike("%"+(String)params.get("taskName")+"%");
82
+        }
83
+        if(StringUtils.isNotEmpty((String)params.get("isRoleGroup"))&&"1".equals(params.get("isRoleGroup"))){
84
+            List<Long> listRoles = sysRoleUserService.getRoleIdList(SecurityUser.getUserId());
85
+            List<String> listStr = new ArrayList<>();
86
+            for(Long role : listRoles){
87
+                listStr.add(role.toString());
88
+            }
89
+            listStr.add(SecurityUser.getUserId().toString());
90
+            if(!listStr.isEmpty()){
91
+                taskQuery.taskCandidateGroupIn(listStr);
92
+            } else {
93
+                return new PageData<>(new ArrayList<>(), 0);
94
+            }
95
+        }
96
+        taskQuery.orderByTaskCreateTime().desc();
97
+        List<Task> list = taskQuery.listPage((curPage - 1) * limit, limit);
98
+        List<TaskDTO> listDto = new ArrayList<>();
99
+        for (Task task : list) {
100
+            TaskDTO dto = new TaskDTO();
101
+            this.convertTaskInfo(task, dto);
102
+            listDto.add(dto);
103
+        }
104
+        return new PageData<>(listDto, (int) taskQuery.count());
105
+    }
106
+
107
+    /**
108
+     * 获取任务详情信息
109
+     *
110
+     * @param id
111
+     * @return
112
+     */
113
+    public TaskDTO taskDetail(String id) {
114
+        Task task = taskService.createTaskQuery().taskId(id).singleResult();
115
+        TaskDTO dto = new TaskDTO();
116
+        this.convertTaskInfo(task, dto);
117
+        return dto;
118
+    }
119
+
120
+    /**
121
+     * 签收任务
122
+     *
123
+     * @param taskId
124
+     */
125
+    public void claimTask(String taskId) {
126
+        String userId = SecurityUser.getUserId().toString();
127
+        Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
128
+        if(StringUtils.isNotEmpty(task.getAssignee())){
129
+            throw new RenException(ErrorCode.TASK_CLIME_FAIL);
130
+        }
131
+        taskService.claim(taskId, userId);
132
+    }
133
+
134
+    /**
135
+     * 释放任务
136
+     *
137
+     * @param taskId
138
+     */
139
+    public void unclaimTask(String taskId) {
140
+        Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
141
+        String procInstId = task.getProcessInstanceId();
142
+        String processDefinitionId = historyService.createHistoricProcessInstanceQuery().processInstanceId(procInstId)
143
+                .singleResult().getProcessDefinitionId();
144
+        ProcessDefinitionEntity def = (ProcessDefinitionEntity) ((RepositoryServiceImpl) repositoryService).getDeployedProcessDefinition(processDefinitionId);
145
+        ExecutionEntity execution = (ExecutionEntity) runtimeService.createProcessInstanceQuery().processInstanceId(procInstId).singleResult();
146
+        String activitiId = execution.getActivityId();
147
+        List<ActivityImpl> activitiList = def.getActivities();
148
+        List<String> lstGroupId = new ArrayList<>();
149
+        for (ActivityImpl activityImpl : activitiList) {
150
+            if (activitiId.equals(activityImpl.getId())) {
151
+                TaskDefinition taskDef = ((UserTaskActivityBehavior) activityImpl.getActivityBehavior()).getTaskDefinition();
152
+                Set<Expression> groupIds = taskDef.getCandidateGroupIdExpressions();
153
+                for (Expression exp : groupIds) {
154
+                    lstGroupId.add(exp.getExpressionText());
155
+                }
156
+            }
157
+        }
158
+        if(lstGroupId.isEmpty()){
159
+            throw new RenException(ErrorCode.UNCLAIM_ERROR_MESSAGE);
160
+        }
161
+        taskService.unclaim(taskId);
162
+    }
163
+
164
+    /**
165
+     * 处理任务
166
+     *
167
+     * @param taskId
168
+     * @param comment
169
+     */
170
+    public void completeTask(String taskId, String comment) {
171
+        String userId = SecurityUser.getUserId().toString();
172
+        Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
173
+        if(StringUtils.isNotEmpty(task.getAssignee())){
174
+            taskService.setAssignee(taskId, userId);
175
+        }
176
+        if(StringUtils.isNotEmpty(comment)){
177
+            taskService.addComment(taskId, task.getProcessInstanceId(), comment);
178
+        }
179
+        taskService.complete(taskId);
180
+    }
181
+
182
+    /**
183
+     * 任务转办
184
+     *
185
+     * @param taskId
186
+     * @param depositorId
187
+     * @param assignee
188
+     */
189
+    public void changeTaskAssignee(String taskId, String depositorId, String assignee) {
190
+        taskService.setOwner(taskId, depositorId);
191
+        taskService.setAssignee(taskId, assignee);
192
+    }
193
+
194
+    /**
195
+     * 获取流程参数
196
+     *
197
+     * @param taskId
198
+     * @param variableName
199
+     * @return
200
+     */
201
+    public Map<String, Object> getTaskVariables(String taskId, String variableName) {
202
+        Map<String, Object> map = null;
203
+        if (StringUtils.isNotBlank(variableName)) {
204
+            Object value = taskService.getVariable(taskId, variableName);
205
+            if(null != value){
206
+                map = new HashMap<>();
207
+                map.put(variableName, value);
208
+            }
209
+        } else {
210
+            map = taskService.getVariables(taskId);
211
+        }
212
+        return map;
213
+    }
214
+
215
+    /**
216
+     * 更新任务变量
217
+     * @param taskDTO
218
+     */
219
+    public void updateTaskVariable(TaskDTO taskDTO) {
220
+        taskService.setVariables(taskDTO.getTaskId(), taskDTO.getParams());
221
+    }
222
+
223
+
224
+    /**
225
+     * 根据任务ID判断是否为多实例任务
226
+     * @param taskId
227
+     * @return
228
+     */
229
+    private boolean isMultiInstance(String taskId) {
230
+        boolean flag = false;
231
+        Task task=taskService.createTaskQuery().taskId(taskId).singleResult();
232
+        if(task != null){
233
+            // 获取流程定义id
234
+            String processDefinitionId=task.getProcessDefinitionId();
235
+            ProcessDefinitionEntity processDefinitionEntity=(ProcessDefinitionEntity) repositoryService.getProcessDefinition(processDefinitionId);
236
+            // 根据活动id获取活动实例
237
+            ActivityImpl activityImpl=processDefinitionEntity.findActivity(task.getTaskDefinitionKey());
238
+            if((activityImpl).getActivityBehavior() instanceof ParallelMultiInstanceBehavior){
239
+                ParallelMultiInstanceBehavior behavior = (ParallelMultiInstanceBehavior)activityImpl.getActivityBehavior();
240
+                if(behavior != null && behavior.getCollectionExpression() != null){
241
+                    flag = true;
242
+                }
243
+            }
244
+        }
245
+
246
+        return flag;
247
+    }
248
+
249
+    /**
250
+     * 删除任务下的所有变量
251
+     *
252
+     * @param taskId
253
+     * @return
254
+     */
255
+    public void deleteTaskVariables(String taskId) {
256
+        Collection<String> currentVariables = taskService.getVariablesLocal(taskId).keySet();
257
+        taskService.removeVariables(taskId, currentVariables);
258
+    }
259
+
260
+    public void deleteTaskVariable(String taskId, String variableName, String scope) {
261
+        if (StringUtils.isNotEmpty(scope)) {
262
+            if ("global".equals(scope.toLowerCase())) {
263
+                Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
264
+                runtimeService.removeVariable(task.getExecutionId(), variableName);
265
+            } else if ("local".equals(scope.toLowerCase())) {
266
+                taskService.removeVariable(taskId, variableName);
267
+            }
268
+        } else {
269
+            taskService.removeVariable(taskId, variableName);
270
+        }
271
+    }
272
+
273
+    /**
274
+     * 任务回退至上一用户任务节点
275
+     * @param taskId
276
+     * @return
277
+     */
278
+    @Transactional(rollbackFor = Exception.class)
279
+    public void doBackPreviousTask(String taskId, String comment) {
280
+        Map<String, Object> variables = null;
281
+        HistoricTaskInstance currTask = historyService.createHistoricTaskInstanceQuery().taskId(taskId).singleResult();
282
+        if(this.isMultiInstance(taskId)){
283
+            throw new RenException(ErrorCode.BACK_PROCESS_PARALLEL_ERROR);
284
+        }
285
+        ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(currTask.getProcessInstanceId()).singleResult();
286
+        ProcessDefinitionEntity processDefinitionEntity = (ProcessDefinitionEntity) ((RepositoryServiceImpl) repositoryService)
287
+                .getDeployedProcessDefinition(currTask.getProcessDefinitionId());
288
+        ActivityImpl currActivity = processDefinitionEntity.findActivity(currTask.getTaskDefinitionKey());
289
+        List<ActivityImpl>  canBackActivitys = new ArrayList<>();
290
+        this.getCanBackUpActivitys(currActivity, canBackActivitys);
291
+        if(canBackActivitys.isEmpty()) {
292
+            throw new RenException(ErrorCode.SUPERIOR_NOT_EXIST);
293
+        }
294
+        List<PvmTransition> originPvmTransitionList = new ArrayList<PvmTransition>();
295
+        List<PvmTransition> pvmTransitionList = currActivity.getOutgoingTransitions();
296
+        for (PvmTransition pvmTransition : pvmTransitionList) {
297
+            originPvmTransitionList.add(pvmTransition);
298
+        }
299
+        pvmTransitionList.clear();
300
+        List<HistoricActivityInstance> historicActivityInstances = historyService
301
+                .createHistoricActivityInstanceQuery().activityType("userTask")
302
+                .processInstanceId(processInstance.getId())
303
+                .finished().orderByHistoricActivityInstanceEndTime().desc().list();
304
+        List<ActivityImpl> backActivitys = new ArrayList<>();
305
+        for(HistoricActivityInstance historicActivityInstance: historicActivityInstances){
306
+            for(ActivityImpl activity : canBackActivitys){
307
+                if(historicActivityInstance.getActivityId().equals(activity.getId())){
308
+                    boolean flag = false;
309
+                    for(ActivityImpl activity1 : backActivitys){
310
+                        if(activity.getId().equals(activity1.getId())){
311
+                            flag = true;
312
+                            break;
313
+                        }
314
+                    }
315
+                    if(!flag){
316
+                        backActivitys.add(activity);
317
+                    }
318
+                }
319
+            }
320
+        }
321
+
322
+        if(backActivitys.isEmpty()){
323
+            throw new RenException(ErrorCode.SUPERIOR_NOT_EXIST);
324
+        }
325
+        List<TransitionImpl> transitionList = new ArrayList<>();
326
+        for(ActivityImpl activity : backActivitys) {
327
+            TransitionImpl transition = currActivity.createOutgoingTransition(IdWorker.get32UUID());
328
+            transition.setDestination(activity);
329
+            transitionList.add(transition);
330
+        }
331
+
332
+        variables = processInstance.getProcessVariables();
333
+        List<Task> tasks = taskService.createTaskQuery().processInstanceId(processInstance.getId())
334
+                .taskDefinitionKey(currTask.getTaskDefinitionKey()).list();
335
+        for (Task task : tasks) {
336
+            String commentMode = MessageUtils.getMessage(ErrorCode.ROLLBACK_MESSAGE);
337
+            if(StringUtils.isNotEmpty(comment)){
338
+                commentMode += "[" +comment+"]";
339
+            }
340
+            taskService.addComment(task.getId(), task.getProcessInstanceId(), commentMode);
341
+            taskService.complete(task.getId(), variables);
342
+        }
343
+        currActivity.getOutgoingTransitions().clear();
344
+        for (PvmTransition pvmTransition : originPvmTransitionList) {
345
+            currActivity.getOutgoingTransitions().add(pvmTransition);
346
+        }
347
+        for(ActivityImpl activity : backActivitys) {
348
+            List<PvmTransition> incomingTransitions = activity.getIncomingTransitions();
349
+            Iterator<PvmTransition> iterator = incomingTransitions.iterator();
350
+            while (iterator.hasNext()) {
351
+                PvmTransition pvmTransition = iterator.next();
352
+                for(TransitionImpl transition : transitionList) {
353
+                    if(transition.getId().equals(pvmTransition.getId())){
354
+                        iterator.remove();
355
+                    }
356
+                }
357
+            }
358
+        }
359
+    }
360
+
361
+    private void getCanBackUpActivitys(ActivityImpl currActivity, List<ActivityImpl> rtnList) {
362
+        List<PvmTransition> incomingTransitions = currActivity.getIncomingTransitions();
363
+        for(PvmTransition pvmTransition : incomingTransitions){
364
+            TransitionImpl transitionImpl = (TransitionImpl) pvmTransition;
365
+            ActivityImpl activityImpl = transitionImpl.getSource();
366
+            String type = (String) activityImpl.getProperty("type");
367
+            if ("parallelGateway".equals(type)){
368
+                // 并行路线
369
+                if(activityImpl.getOutgoingTransitions().size() > 1){
370
+                    throw new RenException(ErrorCode.BACK_PROCESS_HANDLEING_ERROR);
371
+                }
372
+                this.getCanBackUpActivitys(activityImpl, rtnList);
373
+            } else if ("startEvent".equals(type)) {
374
+                return;
375
+            } else if ("userTask".equals(type)) {
376
+                rtnList.add(activityImpl);
377
+            } else if ("exclusiveGateway".equals(type)) {
378
+                this.getCanBackUpActivitys(activityImpl, rtnList);
379
+            } else if("inclusiveGateway".equals(type)) {
380
+                if(activityImpl.getOutgoingTransitions().size() > 1){
381
+                    return;
382
+                }
383
+                this.getCanBackUpActivitys(activityImpl, rtnList);
384
+            }
385
+        }
386
+    }
387
+
388
+    @Transactional(rollbackFor = Exception.class)
389
+    public void endProcess(String taskId, String comment) {
390
+        if(isMultiInstance(taskId)){
391
+            throw new RenException(ErrorCode.END_PROCESS_PARALLEL_ERROR);
392
+        }
393
+        Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
394
+        List<Task> tasks = taskService.createTaskQuery().processInstanceId(task.getProcessInstanceId())
395
+                .taskDefinitionKey(task.getTaskDefinitionKey()).list();
396
+        if(tasks.size() > 1){
397
+            throw new RenException(ErrorCode.END_PROCESS_HANDLEING_ERROR);
398
+        }
399
+        ActivityImpl endActivity = findActivitiImpl(taskId, "end");
400
+        if (endActivity == null) {
401
+            return;
402
+        }
403
+        if (StringUtils.isEmpty(endActivity.getId())) {
404
+            if (!StringUtils.isEmpty(task.getOwner())) {
405
+                taskService.resolveTask(task.getId());
406
+            }
407
+            taskService.addComment(task.getId(), task.getProcessInstanceId(), comment);
408
+            taskService.complete(taskId);
409
+        } else {
410
+            ActivityImpl currActivity = findActivitiImpl(taskId, null);
411
+            List<PvmTransition> oriPvmTransitionList = new ArrayList<PvmTransition>();
412
+            List<PvmTransition> pvmTransitionList = currActivity
413
+                    .getOutgoingTransitions();
414
+            for (PvmTransition pvmTransition : pvmTransitionList) {
415
+                oriPvmTransitionList.add(pvmTransition);
416
+            }
417
+            pvmTransitionList.clear();
418
+            TransitionImpl newTransition = currActivity.createOutgoingTransition();
419
+            ActivityImpl pointActivity = findActivitiImpl(taskId, endActivity.getId());
420
+            newTransition.setDestination(pointActivity);
421
+            if (StringUtils.isNotEmpty(task.getOwner())) {
422
+                taskService.resolveTask(task.getId());
423
+            }
424
+            String message = MessageUtils.getMessage(ErrorCode.END_PROCESS_MESSAGE);
425
+            comment = message + "["+ comment+ "]";
426
+            taskService.addComment(task.getId(), task.getProcessInstanceId(), comment);
427
+            taskService.complete(taskId);
428
+            pointActivity.getIncomingTransitions().remove(newTransition);
429
+            List<PvmTransition> pvmTransitionListC = currActivity.getOutgoingTransitions();
430
+            pvmTransitionListC.clear();
431
+            for (PvmTransition pvmTransition : oriPvmTransitionList) {
432
+                pvmTransitionListC.add(pvmTransition);
433
+            }
434
+        }
435
+
436
+    }
437
+
438
+    private ActivityImpl findActivitiImpl(String taskId, String activityId) {
439
+        Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
440
+        if (task == null) {
441
+            return null;
442
+        }
443
+        ProcessDefinitionEntity processDefinition = (ProcessDefinitionEntity) ((RepositoryServiceImpl) repositoryService).getDeployedProcessDefinition(task.getProcessDefinitionId());
444
+        if (processDefinition == null) {
445
+            throw new RenException(ErrorCode.NONE_EXIST_PROCESS);
446
+        }
447
+        if (StringUtils.isEmpty(activityId)) {
448
+            activityId = task.getTaskDefinitionKey();
449
+        }
450
+        if ("END".equals(activityId.toUpperCase())) {
451
+            for (ActivityImpl activityImpl : processDefinition.getActivities()) {
452
+                String type = (String)activityImpl.getProperty("type");
453
+                if("endEvent".equals(type)){
454
+                    return activityImpl;
455
+                }
456
+            }
457
+        }
458
+        ActivityImpl activityImpl = processDefinition.findActivity(activityId);
459
+        return activityImpl;
460
+    }
461
+
462
+    /**
463
+     * 转换Task对象
464
+     * @param task
465
+     * @param dto
466
+     */
467
+    private void convertTaskInfo(Task task, TaskDTO dto) {
468
+        dto.setTaskId(task.getId());
469
+        dto.setTaskName(task.getName());
470
+        dto.setActivityId(task.getExecutionId());
471
+        dto.setAssignee(task.getAssignee());
472
+        dto.setProcessDefinitionId(task.getProcessDefinitionId());
473
+        ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionId(task.getProcessDefinitionId()).singleResult();
474
+        dto.setProcessDefinitionName(processDefinition.getName());
475
+        dto.setProcessDefinitionKey(processDefinition.getKey());
476
+        HistoricProcessInstance processInstance =  historyService.createHistoricProcessInstanceQuery().processInstanceId(task.getProcessInstanceId()).singleResult();
477
+        dto.setStartTime(processInstance.getStartTime());
478
+        dto.setBusinessKey(processInstance.getBusinessKey());
479
+        dto.setProcessInstanceId(task.getProcessInstanceId());
480
+        dto.setOwner(task.getOwner());
481
+        dto.setCreateTime(task.getCreateTime());
482
+        dto.setDueDate(task.getDueDate());
483
+    }
484
+
485
+    /**
486
+     * 驳回至第一个用户任务
487
+     * @param taskId
488
+     */
489
+    @Transactional(rollbackFor = Exception.class)
490
+    public void backToFirst(String taskId, String comment) {
491
+        if(this.isMultiInstance(taskId)){
492
+            throw new RenException(ErrorCode.REJECT_PROCESS_PARALLEL_ERROR);
493
+        }
494
+        Map variables = null;
495
+        HistoricTaskInstance currTask = historyService.createHistoricTaskInstanceQuery().taskId(taskId).singleResult();
496
+        ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(currTask.getProcessInstanceId()).singleResult();
497
+        ProcessDefinitionEntity processDefinitionEntity = (ProcessDefinitionEntity) ((RepositoryServiceImpl) repositoryService)
498
+                .getDeployedProcessDefinition(currTask.getProcessDefinitionId());
499
+        if (processDefinitionEntity == null) {
500
+            throw new RenException(ErrorCode.NONE_EXIST_PROCESS);
501
+        }
502
+        List<Task> tasks = taskService.createTaskQuery().processInstanceId(currTask.getProcessInstanceId())
503
+                .taskDefinitionKey(currTask.getTaskDefinitionKey()).list();
504
+        if(tasks.size() > 1){
505
+            throw new RenException(ErrorCode.REJECT_PROCESS_HANDLEING_ERROR);
506
+        }
507
+        ActivityImpl currActivity = processDefinitionEntity.findActivity(currTask.getTaskDefinitionKey());
508
+        List<PvmTransition> originPvmTransitionList = new ArrayList<>();
509
+        List<PvmTransition> pvmTransitionList = currActivity.getOutgoingTransitions();
510
+        for (PvmTransition pvmTransition : pvmTransitionList) {
511
+            originPvmTransitionList.add(pvmTransition);
512
+        }
513
+        pvmTransitionList.clear();
514
+        List<HistoricActivityInstance> historicActivityInstances = historyService
515
+                .createHistoricActivityInstanceQuery().activityType("userTask")
516
+                .processInstanceId(processInstance.getId())
517
+                .finished().orderByHistoricActivityInstanceEndTime().asc().list();
518
+        TransitionImpl transitionImpl = null;
519
+        if (historicActivityInstances.size() > 0) {
520
+            ActivityImpl lastActivity = processDefinitionEntity.findActivity(historicActivityInstances.get(0).getActivityId());
521
+            transitionImpl = currActivity.createOutgoingTransition();
522
+            transitionImpl.setDestination(lastActivity);
523
+        } else {
524
+            throw new RenException(ErrorCode.SUPERIOR_NOT_EXIST);
525
+        }
526
+        variables = processInstance.getProcessVariables();
527
+        for (Task task : tasks) {
528
+            String commentMode = MessageUtils.getMessage(ErrorCode.REJECT_MESSAGE);
529
+            if(StringUtils.isNotEmpty(comment)){
530
+                commentMode += "[" + comment+"]";
531
+            }
532
+            taskService.addComment(task.getId(), task.getProcessInstanceId(), commentMode);
533
+            taskService.complete(task.getId(), variables);
534
+        }
535
+        currActivity.getOutgoingTransitions().remove(transitionImpl);
536
+
537
+        for (PvmTransition pvmTransition : originPvmTransitionList) {
538
+            pvmTransitionList.add(pvmTransition);
539
+        }
540
+    }
541
+
542
+    public void completeTaskByVariables(TaskDTO taskDTO) {
543
+        if(null != taskDTO.getParams()){
544
+            Set keySet = taskDTO.getParams().keySet();
545
+            Iterator iterator = keySet.iterator();
546
+            while(iterator.hasNext()){
547
+                String key = (String)iterator.next();
548
+                this.setTaskVariable(taskDTO.getTaskId(),key , taskDTO.getParams().get(key));
549
+            }
550
+        }
551
+        this.completeTask(taskDTO.getTaskId(), taskDTO.getComment());
552
+    }
553
+
554
+    private void setTaskVariable(String taskId, String key, Object value){
555
+        TaskInfo taskInfo = taskService.createTaskQuery().taskId(taskId).singleResult();
556
+        runtimeService.setVariable(taskInfo.getExecutionId(), key, value);
557
+    }
558
+}

+ 22 - 0
eitc-admin/src/main/java/com/eitc/modules/activiti/service/ActivitiService.java

@@ -0,0 +1,22 @@
1
+package com.eitc.modules.activiti.service;
2
+
3
+import com.eitc.common.page.PageData;
4
+import com.eitc.common.service.BaseService;
5
+import com.eitc.modules.activiti.dto.HistoryDetailDTO;
6
+import com.eitc.modules.activiti.dto.ProcessActivityDTO;
7
+import com.eitc.modules.activiti.entity.ProcessActivityEntity;
8
+
9
+import java.util.List;
10
+import java.util.Map;
11
+
12
+/**
13
+ * 流程自定义查询
14
+ *
15
+ * @author Jone
16
+ */
17
+public interface ActivitiService  extends BaseService<ProcessActivityEntity> {
18
+
19
+    PageData<ProcessActivityDTO> getMyProcessInstancePage(Map<String, Object> params);
20
+
21
+    List<HistoryDetailDTO> getTaskHandleDetailInfo(String processInstanceId);
22
+}

+ 19 - 0
eitc-admin/src/main/java/com/eitc/modules/activiti/service/ProcessBizRouteService.java

@@ -0,0 +1,19 @@
1
+package com.eitc.modules.activiti.service;
2
+
3
+import com.eitc.common.service.BaseService;
4
+import com.eitc.modules.activiti.dto.ProcessBizRouteDTO;
5
+import com.eitc.modules.activiti.entity.ProcessBizRouteEntity;
6
+
7
+/**
8
+ * @Author:Jone
9
+ */
10
+public interface ProcessBizRouteService  extends BaseService<ProcessBizRouteEntity> {
11
+
12
+    ProcessBizRouteDTO getProcDefBizRoute(String id);
13
+
14
+    void save(ProcessBizRouteDTO processBizRouteDTO);
15
+
16
+    void updateProcBizRoute(ProcessBizRouteDTO processBizRouteDTO);
17
+
18
+    ProcessBizRouteDTO getLatestProcDefBizRoute(String procDefKey);
19
+}

+ 46 - 0
eitc-admin/src/main/java/com/eitc/modules/activiti/service/impl/ActivitiServiceImpl.java

@@ -0,0 +1,46 @@
1
+package com.eitc.modules.activiti.service.impl;
2
+
3
+import com.baomidou.mybatisplus.core.metadata.IPage;
4
+import com.eitc.common.page.PageData;
5
+import com.eitc.common.service.impl.BaseServiceImpl;
6
+import com.eitc.common.utils.ConvertUtils;
7
+import com.eitc.modules.activiti.dao.ProcessActivityDao;
8
+import com.eitc.modules.activiti.dto.HistoryDetailDTO;
9
+import com.eitc.modules.activiti.dto.ProcessActivityDTO;
10
+import com.eitc.modules.activiti.entity.HistoryDetailEntity;
11
+import com.eitc.modules.activiti.entity.ProcessActivityEntity;
12
+import com.eitc.modules.activiti.service.ActivitiService;
13
+import com.eitc.modules.security.user.SecurityUser;
14
+import org.springframework.stereotype.Service;
15
+
16
+import java.util.List;
17
+import java.util.Map;
18
+
19
+/**
20
+ * 工作流
21
+ *
22
+ * @author Jone
23
+ */
24
+@Service
25
+public class ActivitiServiceImpl extends BaseServiceImpl<ProcessActivityDao, ProcessActivityEntity> implements ActivitiService {
26
+
27
+    @Override
28
+    public PageData<ProcessActivityDTO> getMyProcessInstancePage(Map<String, Object> params) {
29
+        params.put("userId", SecurityUser.getUserId().toString());
30
+        IPage<ProcessActivityEntity> page = getPage(params, null, false);
31
+        List<ProcessActivityEntity> list = baseDao.getMyProcessInstancePage(params);
32
+        return getPageData(list, page.getTotal(), ProcessActivityDTO.class);
33
+    }
34
+
35
+    @Override
36
+    public List<HistoryDetailDTO> getTaskHandleDetailInfo(String processInstanceId) {
37
+        List<HistoryDetailEntity> listEntity = baseDao.getTaskHandleDetailInfo(processInstanceId);
38
+        for(HistoryDetailEntity entity : listEntity){
39
+            if(entity.getEndTime() != null && entity.getStartTime() != null){
40
+                long diff = entity.getEndTime().getTime() - entity.getStartTime().getTime();
41
+                entity.setDurationInSeconds(diff/1000);
42
+            }
43
+        }
44
+        return ConvertUtils.sourceToTarget(listEntity, HistoryDetailDTO.class);
45
+    }
46
+}

+ 47 - 0
eitc-admin/src/main/java/com/eitc/modules/activiti/service/impl/ProcessBizRouteServiceImpl.java

@@ -0,0 +1,47 @@
1
+package com.eitc.modules.activiti.service.impl;
2
+
3
+import com.eitc.common.service.impl.BaseServiceImpl;
4
+import com.eitc.common.utils.ConvertUtils;
5
+import com.eitc.modules.activiti.dao.ProcessBizRouteDao;
6
+import com.eitc.modules.activiti.dto.ProcessBizRouteDTO;
7
+import com.eitc.modules.activiti.entity.ProcessBizRouteEntity;
8
+import com.eitc.modules.activiti.service.ProcessBizRouteService;
9
+import org.springframework.stereotype.Service;
10
+
11
+import java.util.List;
12
+
13
+/**
14
+ * @Author:Jone
15
+ */
16
+@Service
17
+public class ProcessBizRouteServiceImpl  extends BaseServiceImpl<ProcessBizRouteDao, ProcessBizRouteEntity> implements ProcessBizRouteService {
18
+
19
+    @Override
20
+    public ProcessBizRouteDTO getProcDefBizRoute(String id) {
21
+        ProcessBizRouteEntity entity = baseDao.getProcDefBizRoute(id);
22
+        ProcessBizRouteDTO dto = ConvertUtils.sourceToTarget(entity, ProcessBizRouteDTO.class);
23
+        return dto;
24
+    }
25
+
26
+    @Override
27
+    public void save(ProcessBizRouteDTO processBizRouteDTO) {
28
+        ProcessBizRouteEntity entity = ConvertUtils.sourceToTarget(processBizRouteDTO, ProcessBizRouteEntity.class);
29
+        this.insert(entity);
30
+    }
31
+
32
+    @Override
33
+    public void updateProcBizRoute(ProcessBizRouteDTO processBizRouteDTO) {
34
+        ProcessBizRouteEntity entity = ConvertUtils.sourceToTarget(processBizRouteDTO, ProcessBizRouteEntity.class);
35
+        this.updateById(entity);
36
+    }
37
+
38
+    @Override
39
+    public ProcessBizRouteDTO getLatestProcDefBizRoute(String procDefKey) {
40
+        List<ProcessBizRouteEntity> list = baseDao.getLatestProcDefBizRoute(procDefKey);
41
+        if(list.isEmpty()){
42
+            return null;
43
+        }
44
+        ProcessBizRouteEntity entity = list.get(0);
45
+        return ConvertUtils.sourceToTarget(entity, ProcessBizRouteDTO.class);
46
+    }
47
+}

+ 104 - 0
eitc-admin/src/main/java/com/eitc/modules/demo/controller/NewsController.java

@@ -0,0 +1,104 @@
1
+package com.eitc.modules.demo.controller;
2
+
3
+import com.eitc.common.annotation.LogOperation;
4
+import com.eitc.common.constant.Constant;
5
+import com.eitc.common.page.PageData;
6
+import com.eitc.common.utils.Result;
7
+import com.eitc.common.validator.AssertUtils;
8
+import com.eitc.common.validator.ValidatorUtils;
9
+import com.eitc.common.validator.group.AddGroup;
10
+import com.eitc.common.validator.group.DefaultGroup;
11
+import com.eitc.common.validator.group.UpdateGroup;
12
+import com.eitc.modules.demo.dto.NewsDTO;
13
+import com.eitc.modules.demo.service.NewsService;
14
+import io.swagger.annotations.Api;
15
+import io.swagger.annotations.ApiImplicitParam;
16
+import io.swagger.annotations.ApiImplicitParams;
17
+import io.swagger.annotations.ApiOperation;
18
+import org.apache.shiro.authz.annotation.RequiresPermissions;
19
+import org.springframework.beans.factory.annotation.Autowired;
20
+import org.springframework.web.bind.annotation.*;
21
+import springfox.documentation.annotations.ApiIgnore;
22
+
23
+import java.util.Arrays;
24
+import java.util.Map;
25
+
26
+/**
27
+ * 新闻
28
+ *
29
+ * @author Mark eitc@163.com
30
+ */
31
+@RestController
32
+@RequestMapping("demo/news")
33
+@Api(tags="新闻管理")
34
+public class NewsController {
35
+    @Autowired
36
+    private NewsService newsService;
37
+
38
+    @GetMapping("page")
39
+    @ApiOperation("分页")
40
+    @ApiImplicitParams({
41
+        @ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType="int") ,
42
+        @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") ,
43
+        @ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") ,
44
+        @ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String") ,
45
+        @ApiImplicitParam(name = "title", value = "标题", paramType = "query", dataType="String"),
46
+        @ApiImplicitParam(name = "startDate", value = "开始时间", paramType = "query", dataType="String"),
47
+        @ApiImplicitParam(name = "endDate", value = "结束时间", paramType = "query", dataType="String")
48
+    })
49
+    @RequiresPermissions("demo:news:all")
50
+    public Result<PageData<NewsDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){
51
+        PageData<NewsDTO> page = newsService.page(params);
52
+
53
+        return new Result<PageData<NewsDTO>>().ok(page);
54
+    }
55
+
56
+    @ApiOperation("信息")
57
+    @GetMapping("{id}")
58
+    @RequiresPermissions("demo:news:all")
59
+    public Result<NewsDTO> info(@PathVariable("id") Long id){
60
+        NewsDTO news = newsService.get(id);
61
+
62
+        return new Result<NewsDTO>().ok(news);
63
+    }
64
+
65
+    @PostMapping
66
+    @ApiOperation("保存")
67
+    @LogOperation("保存")
68
+    @RequiresPermissions("demo:news:all")
69
+    public Result save(NewsDTO dto){
70
+        //效验数据
71
+        ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
72
+
73
+        newsService.save(dto);
74
+
75
+        return new Result();
76
+    }
77
+
78
+    @PutMapping
79
+    @ApiOperation("修改")
80
+    @LogOperation("修改")
81
+    @RequiresPermissions("demo:news:all")
82
+    public Result update(NewsDTO dto){
83
+        //效验数据
84
+        ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
85
+
86
+        newsService.update(dto);
87
+
88
+        return new Result();
89
+    }
90
+
91
+    @DeleteMapping
92
+    @ApiOperation("删除")
93
+    @LogOperation("删除")
94
+    @RequiresPermissions("demo:news:all")
95
+    public Result delete(@RequestBody Long[] ids){
96
+        //效验数据
97
+        AssertUtils.isArrayEmpty(ids, "id");
98
+
99
+        newsService.deleteBatchIds(Arrays.asList(ids));
100
+
101
+        return new Result();
102
+    }
103
+
104
+}

+ 101 - 0
eitc-admin/src/main/java/com/eitc/modules/demo/controller/ProductController.java

@@ -0,0 +1,101 @@
1
+package com.eitc.modules.demo.controller;
2
+
3
+import com.eitc.common.annotation.LogOperation;
4
+import com.eitc.common.constant.Constant;
5
+import com.eitc.common.page.PageData;
6
+import com.eitc.common.utils.Result;
7
+import com.eitc.common.validator.AssertUtils;
8
+import com.eitc.common.validator.ValidatorUtils;
9
+import com.eitc.common.validator.group.AddGroup;
10
+import com.eitc.common.validator.group.DefaultGroup;
11
+import com.eitc.common.validator.group.UpdateGroup;
12
+import com.eitc.modules.demo.dto.ProductDTO;
13
+import com.eitc.modules.demo.service.ProductService;
14
+import io.swagger.annotations.Api;
15
+import io.swagger.annotations.ApiImplicitParam;
16
+import io.swagger.annotations.ApiImplicitParams;
17
+import io.swagger.annotations.ApiOperation;
18
+import org.apache.shiro.authz.annotation.RequiresPermissions;
19
+import org.springframework.beans.factory.annotation.Autowired;
20
+import org.springframework.web.bind.annotation.*;
21
+import springfox.documentation.annotations.ApiIgnore;
22
+
23
+import java.util.Map;
24
+
25
+
26
+/**
27
+ * 产品管理
28
+ *
29
+ * @author Mark eitc@163.com
30
+ */
31
+@RestController
32
+@RequestMapping("demo/product")
33
+@Api(tags="产品管理")
34
+public class ProductController {
35
+    @Autowired
36
+    private ProductService productService;
37
+
38
+    @GetMapping("page")
39
+    @ApiOperation("分页")
40
+    @ApiImplicitParams({
41
+        @ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType="int") ,
42
+        @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") ,
43
+        @ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") ,
44
+        @ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String")
45
+    })
46
+    @RequiresPermissions("demo:product:page")
47
+    public Result<PageData<ProductDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){
48
+        PageData<ProductDTO> page = productService.page(params);
49
+
50
+        return new Result<PageData<ProductDTO>>().ok(page);
51
+    }
52
+
53
+    @GetMapping("{id}")
54
+    @ApiOperation("信息")
55
+    @RequiresPermissions("demo:product:info")
56
+    public Result<ProductDTO> get(@PathVariable("id") Long id){
57
+        ProductDTO data = productService.get(id);
58
+
59
+        return new Result<ProductDTO>().ok(data);
60
+    }
61
+
62
+    @PostMapping
63
+    @ApiOperation("保存")
64
+    @LogOperation("保存")
65
+    @RequiresPermissions("demo:product:save")
66
+    public Result save(@RequestBody ProductDTO dto){
67
+        //效验数据
68
+        ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
69
+
70
+        productService.save(dto);
71
+
72
+        return new Result();
73
+    }
74
+
75
+    @PutMapping
76
+    @ApiOperation("修改")
77
+    @LogOperation("修改")
78
+    @RequiresPermissions("demo:product:update")
79
+    public Result update(@RequestBody ProductDTO dto){
80
+        //效验数据
81
+        ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
82
+
83
+        productService.update(dto);
84
+
85
+        return new Result();
86
+    }
87
+
88
+    @DeleteMapping
89
+    @ApiOperation("删除")
90
+    @LogOperation("删除")
91
+    @RequiresPermissions("demo:product:delete")
92
+    public Result delete(@RequestBody Long[] ids){
93
+        //效验数据
94
+        AssertUtils.isArrayEmpty(ids, "id");
95
+
96
+        productService.delete(ids);
97
+
98
+        return new Result();
99
+    }
100
+
101
+}

+ 20 - 0
eitc-admin/src/main/java/com/eitc/modules/demo/dao/NewsDao.java

@@ -0,0 +1,20 @@
1
+package com.eitc.modules.demo.dao;
2
+
3
+import com.eitc.common.dao.BaseDao;
4
+import com.eitc.modules.demo.entity.NewsEntity;
5
+import org.apache.ibatis.annotations.Mapper;
6
+
7
+import java.util.List;
8
+import java.util.Map;
9
+
10
+/**
11
+ * 新闻
12
+ *
13
+ * @author Mark eitc@163.com
14
+ */
15
+@Mapper
16
+public interface NewsDao extends BaseDao<NewsEntity> {
17
+
18
+    List<NewsEntity> getList(Map<String, Object> params);
19
+
20
+}

+ 15 - 0
eitc-admin/src/main/java/com/eitc/modules/demo/dao/ProductDao.java

@@ -0,0 +1,15 @@
1
+package com.eitc.modules.demo.dao;
2
+
3
+import com.eitc.common.dao.BaseDao;
4
+import com.eitc.modules.demo.entity.ProductEntity;
5
+import org.apache.ibatis.annotations.Mapper;
6
+
7
+/**
8
+ * 产品管理
9
+ *
10
+ * @author Mark eitc@163.com
11
+ */
12
+@Mapper
13
+public interface ProductDao extends BaseDao<ProductEntity> {
14
+
15
+}

+ 19 - 0
eitc-admin/src/main/java/com/eitc/modules/demo/dao/ProductParamsDao.java

@@ -0,0 +1,19 @@
1
+package com.eitc.modules.demo.dao;
2
+
3
+import com.eitc.common.dao.BaseDao;
4
+import com.eitc.modules.demo.entity.ProductParamsEntity;
5
+import org.apache.ibatis.annotations.Mapper;
6
+
7
+/**
8
+ * 产品参数管理
9
+ *
10
+ * @author Mark eitc@163.com
11
+ */
12
+@Mapper
13
+public interface ProductParamsDao extends BaseDao<ProductParamsEntity> {
14
+
15
+    /**
16
+     * 根据产品id,删除产品参数
17
+     */
18
+    void deleteByProductIds(Long[] productIds);
19
+}

+ 46 - 0
eitc-admin/src/main/java/com/eitc/modules/demo/dto/NewsDTO.java

@@ -0,0 +1,46 @@
1
+package com.eitc.modules.demo.dto;
2
+
3
+import com.fasterxml.jackson.annotation.JsonProperty;
4
+import com.eitc.common.validator.group.AddGroup;
5
+import com.eitc.common.validator.group.DefaultGroup;
6
+import com.eitc.common.validator.group.UpdateGroup;
7
+import io.swagger.annotations.ApiModel;
8
+import io.swagger.annotations.ApiModelProperty;
9
+import lombok.Data;
10
+
11
+import javax.validation.constraints.NotBlank;
12
+import javax.validation.constraints.NotNull;
13
+import javax.validation.constraints.Null;
14
+import java.io.Serializable;
15
+import java.util.Date;
16
+
17
+/**
18
+ * 新闻管理
19
+ *
20
+ * @author Mark eitc@163.com
21
+ */
22
+@Data
23
+@ApiModel(value = "新闻管理")
24
+public class NewsDTO implements Serializable {
25
+
26
+    @ApiModelProperty(value = "id")
27
+    @Null(message="{id.null}", groups = AddGroup.class)
28
+    @NotNull(message="{id.require}", groups = UpdateGroup.class)
29
+    private Long id;
30
+
31
+    @ApiModelProperty(value = "标题")
32
+    @NotBlank(message="{news.title.require}", groups = DefaultGroup.class)
33
+    private String title;
34
+
35
+    @ApiModelProperty(value = "内容")
36
+    @NotBlank(message="{news.content.require}", groups = DefaultGroup.class)
37
+    private String content;
38
+
39
+    @ApiModelProperty(value = "发布时间")
40
+    private Date pubDate;
41
+
42
+    @ApiModelProperty(value = "创建时间")
43
+    @JsonProperty(access = JsonProperty.Access.READ_ONLY)
44
+    private Date createDate;
45
+
46
+}

+ 37 - 0
eitc-admin/src/main/java/com/eitc/modules/demo/dto/ProductDTO.java

@@ -0,0 +1,37 @@
1
+package com.eitc.modules.demo.dto;
2
+
3
+import io.swagger.annotations.ApiModel;
4
+import io.swagger.annotations.ApiModelProperty;
5
+import lombok.Data;
6
+
7
+import java.io.Serializable;
8
+import java.util.Date;
9
+import java.util.List;
10
+
11
+
12
+/**
13
+ * 产品管理
14
+ *
15
+ * @author Mark eitc@163.com
16
+ */
17
+@Data
18
+@ApiModel(value = "产品管理")
19
+public class ProductDTO implements Serializable {
20
+    private static final long serialVersionUID = 1L;
21
+
22
+	@ApiModelProperty(value = "id")
23
+	private Long id;
24
+
25
+	@ApiModelProperty(value = "产品名称")
26
+	private String name;
27
+
28
+	@ApiModelProperty(value = "产品介绍")
29
+	private String content;
30
+
31
+	@ApiModelProperty(value = "创建时间")
32
+	private Date createDate;
33
+
34
+	@ApiModelProperty(value = "产品参数列表")
35
+	private List<ProductParamsDTO> subList;
36
+
37
+}

+ 25 - 0
eitc-admin/src/main/java/com/eitc/modules/demo/dto/ProductParamsDTO.java

@@ -0,0 +1,25 @@
1
+package com.eitc.modules.demo.dto;
2
+
3
+import io.swagger.annotations.ApiModel;
4
+import io.swagger.annotations.ApiModelProperty;
5
+import lombok.Data;
6
+
7
+import java.io.Serializable;
8
+
9
+
10
+/**
11
+ * 产品参数管理
12
+ *
13
+ * @author Mark eitc@163.com
14
+ */
15
+@Data
16
+@ApiModel(value = "产品参数管理")
17
+public class ProductParamsDTO implements Serializable {
18
+    private static final long serialVersionUID = 1L;
19
+
20
+	@ApiModelProperty(value = "参数名")
21
+	private String paramName;
22
+
23
+	@ApiModelProperty(value = "参数值")
24
+	private String paramValue;
25
+}

+ 50 - 0
eitc-admin/src/main/java/com/eitc/modules/demo/entity/NewsEntity.java

@@ -0,0 +1,50 @@
1
+package com.eitc.modules.demo.entity;
2
+
3
+import com.baomidou.mybatisplus.annotation.FieldFill;
4
+import com.baomidou.mybatisplus.annotation.TableField;
5
+import com.baomidou.mybatisplus.annotation.TableName;
6
+import com.eitc.common.entity.BaseEntity;
7
+import lombok.Data;
8
+import lombok.EqualsAndHashCode;
9
+
10
+import java.util.Date;
11
+
12
+/**
13
+ * 新闻
14
+ *
15
+ * @author Mark eitc@163.com
16
+ */
17
+@Data
18
+@EqualsAndHashCode(callSuper=false)
19
+@TableName("tb_news")
20
+public class NewsEntity extends BaseEntity {
21
+	private static final long serialVersionUID = 1L;
22
+
23
+	/**
24
+	 * 标题
25
+	 */
26
+	private String title;
27
+	/**
28
+	 * 内容
29
+	 */
30
+	private String content;
31
+	/**
32
+	 * 发布时间
33
+	 */
34
+	private Date pubDate;
35
+	/**
36
+	 * 创建者dept_id
37
+	 */
38
+	@TableField(fill = FieldFill.INSERT)
39
+	private Long deptId;
40
+	/**
41
+	 * 更新者
42
+	 */
43
+	@TableField(fill = FieldFill.INSERT_UPDATE)
44
+	private Long updater;
45
+	/**
46
+	 * 更新时间
47
+	 */
48
+	@TableField(fill = FieldFill.INSERT_UPDATE)
49
+	private Date updateDate;
50
+}

+ 41 - 0
eitc-admin/src/main/java/com/eitc/modules/demo/entity/ProductEntity.java

@@ -0,0 +1,41 @@
1
+package com.eitc.modules.demo.entity;
2
+
3
+import com.baomidou.mybatisplus.annotation.FieldFill;
4
+import com.baomidou.mybatisplus.annotation.TableField;
5
+import com.baomidou.mybatisplus.annotation.TableName;
6
+import com.eitc.common.entity.BaseEntity;
7
+import lombok.Data;
8
+import lombok.EqualsAndHashCode;
9
+
10
+import java.util.Date;
11
+
12
+/**
13
+ * 产品管理
14
+ *
15
+ * @author Mark eitc@163.com
16
+ */
17
+@Data
18
+@EqualsAndHashCode(callSuper=false)
19
+@TableName("tb_product")
20
+public class ProductEntity extends BaseEntity {
21
+	private static final long serialVersionUID = 1L;
22
+
23
+    /**
24
+     * 产品名称
25
+     */
26
+	private String name;
27
+    /**
28
+     * 产品介绍
29
+     */
30
+	private String content;
31
+    /**
32
+     * 更新者
33
+     */
34
+	@TableField(fill = FieldFill.INSERT_UPDATE)
35
+	private Long updater;
36
+    /**
37
+     * 更新时间
38
+     */
39
+	@TableField(fill = FieldFill.INSERT_UPDATE)
40
+	private Date updateDate;
41
+}

+ 45 - 0
eitc-admin/src/main/java/com/eitc/modules/demo/entity/ProductParamsEntity.java

@@ -0,0 +1,45 @@
1
+package com.eitc.modules.demo.entity;
2
+
3
+import com.baomidou.mybatisplus.annotation.FieldFill;
4
+import com.baomidou.mybatisplus.annotation.TableField;
5
+import com.baomidou.mybatisplus.annotation.TableName;
6
+import com.eitc.common.entity.BaseEntity;
7
+import lombok.Data;
8
+import lombok.EqualsAndHashCode;
9
+
10
+import java.util.Date;
11
+
12
+/**
13
+ * 产品参数管理
14
+ *
15
+ * @author Mark eitc@163.com
16
+ */
17
+@Data
18
+@EqualsAndHashCode(callSuper=false)
19
+@TableName("tb_product_params")
20
+public class ProductParamsEntity extends BaseEntity {
21
+	private static final long serialVersionUID = 1L;
22
+
23
+    /**
24
+     * 参数名
25
+     */
26
+	private String paramName;
27
+    /**
28
+     * 参数值
29
+     */
30
+	private String paramValue;
31
+    /**
32
+     * 产品ID
33
+     */
34
+	private Long productId;
35
+    /**
36
+     * 更新者
37
+     */
38
+	@TableField(fill = FieldFill.INSERT_UPDATE)
39
+	private Long updater;
40
+    /**
41
+     * 更新时间
42
+     */
43
+	@TableField(fill = FieldFill.INSERT_UPDATE)
44
+	private Date updateDate;
45
+}

+ 25 - 0
eitc-admin/src/main/java/com/eitc/modules/demo/service/NewsService.java

@@ -0,0 +1,25 @@
1
+package com.eitc.modules.demo.service;
2
+
3
+import com.eitc.common.page.PageData;
4
+import com.eitc.common.service.BaseService;
5
+import com.eitc.modules.demo.dto.NewsDTO;
6
+import com.eitc.modules.demo.entity.NewsEntity;
7
+
8
+import java.util.Map;
9
+
10
+/**
11
+ * 新闻
12
+ *
13
+ * @author Mark eitc@163.com
14
+ */
15
+public interface NewsService extends BaseService<NewsEntity> {
16
+
17
+    PageData<NewsDTO> page(Map<String, Object> params);
18
+
19
+    NewsDTO get(Long id);
20
+
21
+    void save(NewsDTO dto);
22
+
23
+    void update(NewsDTO dto);
24
+}
25
+

+ 0 - 0
eitc-admin/src/main/java/com/eitc/modules/demo/service/ProductParamsService.java


Some files were not shown because too many files changed in this diff