Commit afa0d623dba39989d66e03dbc1e7359076583fd5

Authored by jason
1 parent 1c266988

增加 bpm-core-service 多模块

Showing 38 changed files with 401 additions and 747 deletions
... ... @@ -27,6 +27,9 @@
27 27 <maven.compiler.source>${java.version}</maven.compiler.source>
28 28 <maven.compiler.target>${java.version}</maven.compiler.target>
29 29 <maven-surefire-plugin.version>3.0.0-M5</maven-surefire-plugin.version>
  30 + <maven-compiler-plugin.version>3.8.0</maven-compiler-plugin.version>
  31 + <lombok.version>1.18.20</lombok.version>
  32 + <mapstruct.version>1.4.1.Final</mapstruct.version>
30 33 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
31 34 </properties>
32 35  
... ... @@ -52,6 +55,25 @@
52 55 <artifactId>maven-surefire-plugin</artifactId>
53 56 <version>${maven-surefire-plugin.version}</version>
54 57 </plugin>
  58 + <plugin>
  59 + <groupId>org.apache.maven.plugins</groupId>
  60 + <artifactId>maven-compiler-plugin</artifactId>
  61 + <version>${maven-compiler-plugin.version}</version>
  62 + <configuration>
  63 + <annotationProcessorPaths>
  64 + <path>
  65 + <groupId>org.projectlombok</groupId>
  66 + <artifactId>lombok</artifactId>
  67 + <version>${lombok.version}</version>
  68 + </path>
  69 + <path>
  70 + <groupId>org.mapstruct</groupId>
  71 + <artifactId>mapstruct-processor</artifactId>
  72 + <version>${mapstruct.version}</version>
  73 + </path>
  74 + </annotationProcessorPaths>
  75 + </configuration>
  76 + </plugin>
55 77 </plugins>
56 78 </pluginManagement>
57 79 </build>
... ...
yudao-admin-server/pom.xml
... ... @@ -49,7 +49,10 @@
49 49 <groupId>cn.iocoder.boot</groupId>
50 50 <artifactId>yudao-module-bpm-activiti</artifactId>
51 51 </dependency>
52   -
  52 + <dependency>
  53 + <groupId>cn.iocoder.boot</groupId>
  54 + <artifactId>yudao-module-bpm-core-service-impl</artifactId>
  55 + </dependency>
53 56 <!-- Web 相关 -->
54 57 <dependency>
55 58 <groupId>cn.iocoder.boot</groupId>
... ...
yudao-dependencies/pom.xml
... ... @@ -410,7 +410,12 @@
410 410 </dependency>
411 411 <dependency>
412 412 <groupId>cn.iocoder.boot</groupId>
413   - <artifactId>yudao-module-bpm-core-service</artifactId>
  413 + <artifactId>yudao-module-bpm-core-service-impl</artifactId>
  414 + <version>${revision}</version>
  415 + </dependency>
  416 + <dependency>
  417 + <groupId>cn.iocoder.boot</groupId>
  418 + <artifactId>yudao-module-bpm-core-service-api</artifactId>
414 419 <version>${revision}</version>
415 420 </dependency>
416 421 <dependency>
... ...
yudao-module-bpm/yudao-module-bpm-activiti/pom.xml
... ... @@ -19,6 +19,10 @@
19 19 <groupId>cn.iocoder.boot</groupId>
20 20 <artifactId>yudao-core-service</artifactId>
21 21 </dependency>
  22 + <dependency>
  23 + <groupId>cn.iocoder.boot</groupId>
  24 + <artifactId>yudao-module-bpm-core-service-api</artifactId>
  25 + </dependency>
22 26 <!-- Test 测试相关 -->
23 27 <dependency>
24 28 <groupId>cn.iocoder.boot</groupId>
... ... @@ -26,5 +30,4 @@
26 30 <scope>test</scope>
27 31 </dependency>
28 32 </dependencies>
29   -
30 33 </project>
31 34 \ No newline at end of file
... ...
yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/enums/BpmErrorCodeConstants.java
... ... @@ -57,8 +57,4 @@ public interface BpmErrorCodeConstants {
57 57 ErrorCode FORM_NOT_EXISTS = new ErrorCode(1009010000, "动态表单不存在");
58 58 ErrorCode FORM_FIELD_REPEAT = new ErrorCode(1009010000, "表单项({}) 和 ({}) 使用了相同的字段名({})");
59 59  
60   - // ========== 用户组模块 1-009-011-000 ==========
61   - ErrorCode USER_GROUP_NOT_EXISTS = new ErrorCode(1009011000, "用户组不存在");
62   - ErrorCode USER_GROUP_IS_DISABLE = new ErrorCode(1009011001, "名字为【{}】的用户组已被禁用");
63   -
64 60 }
... ...
yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/framework/activiti/config/BpmActivitiConfiguration.java
... ... @@ -6,11 +6,10 @@ import cn.iocoder.yudao.adminserver.modules.bpm.framework.activiti.core.event.Bp
6 6 import cn.iocoder.yudao.adminserver.modules.bpm.framework.activiti.core.identity.EmptyUserGroupManager;
7 7 import cn.iocoder.yudao.adminserver.modules.bpm.framework.activiti.core.listener.BpmTackActivitiEventListener;
8 8 import cn.iocoder.yudao.adminserver.modules.bpm.service.definition.BpmTaskAssignRuleService;
9   -import cn.iocoder.yudao.adminserver.modules.bpm.service.definition.BpmUserGroupService;
  9 +import cn.iocoder.yudao.coreservice.modules.bpm.api.group.BpmUserGroupServiceApi;
10 10 import cn.iocoder.yudao.coreservice.modules.system.service.dept.SysDeptCoreService;
11 11 import cn.iocoder.yudao.coreservice.modules.system.service.permission.SysPermissionCoreService;
12 12 import cn.iocoder.yudao.coreservice.modules.system.service.user.SysUserCoreService;
13   -import org.activiti.api.runtime.shared.identity.UserGroupManager;
14 13 import org.activiti.spring.boot.ProcessEngineConfigurationConfigurer;
15 14 import org.springframework.context.ApplicationEventPublisher;
16 15 import org.springframework.context.annotation.Bean;
... ... @@ -60,14 +59,14 @@ public class BpmActivitiConfiguration {
60 59 public BpmActivityBehaviorFactory bpmActivityBehaviorFactory(BpmTaskAssignRuleService taskRuleService,
61 60 SysPermissionCoreService permissionCoreService,
62 61 SysDeptCoreService deptCoreService,
63   - BpmUserGroupService userGroupService,
  62 + BpmUserGroupServiceApi userGroupServiceApi,
64 63 SysUserCoreService userCoreService,
65 64 List<BpmTaskAssignScript> scripts) {
66 65 BpmActivityBehaviorFactory bpmActivityBehaviorFactory = new BpmActivityBehaviorFactory();
67 66 bpmActivityBehaviorFactory.setBpmTaskRuleService(taskRuleService);
68 67 bpmActivityBehaviorFactory.setPermissionCoreService(permissionCoreService);
69 68 bpmActivityBehaviorFactory.setDeptCoreService(deptCoreService);
70   - bpmActivityBehaviorFactory.setUserGroupService(userGroupService);
  69 + bpmActivityBehaviorFactory.setUserGroupServiceApi(userGroupServiceApi);
71 70 bpmActivityBehaviorFactory.setUserCoreService(userCoreService);
72 71 bpmActivityBehaviorFactory.setScripts(scripts);
73 72 return bpmActivityBehaviorFactory;
... ...
yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/framework/activiti/core/behavior/BpmActivityBehaviorFactory.java
... ... @@ -2,7 +2,7 @@ package cn.iocoder.yudao.adminserver.modules.bpm.framework.activiti.core.behavio
2 2  
3 3 import cn.iocoder.yudao.adminserver.modules.bpm.framework.activiti.core.behavior.script.BpmTaskAssignScript;
4 4 import cn.iocoder.yudao.adminserver.modules.bpm.service.definition.BpmTaskAssignRuleService;
5   -import cn.iocoder.yudao.adminserver.modules.bpm.service.definition.BpmUserGroupService;
  5 +import cn.iocoder.yudao.coreservice.modules.bpm.api.group.BpmUserGroupServiceApi;
6 6 import cn.iocoder.yudao.coreservice.modules.system.service.dept.SysDeptCoreService;
7 7 import cn.iocoder.yudao.coreservice.modules.system.service.permission.SysPermissionCoreService;
8 8 import cn.iocoder.yudao.coreservice.modules.system.service.user.SysUserCoreService;
... ... @@ -34,7 +34,7 @@ public class BpmActivityBehaviorFactory extends DefaultActivityBehaviorFactory {
34 34 @Setter
35 35 private SysDeptCoreService deptCoreService;
36 36 @Setter
37   - private BpmUserGroupService userGroupService;
  37 + private BpmUserGroupServiceApi userGroupServiceApi;
38 38 @Setter
39 39 private SysUserCoreService userCoreService;
40 40 @Setter
... ... @@ -46,7 +46,7 @@ public class BpmActivityBehaviorFactory extends DefaultActivityBehaviorFactory {
46 46 userTaskActivityBehavior.setBpmTaskRuleService(bpmTaskRuleService);
47 47 userTaskActivityBehavior.setPermissionCoreService(permissionCoreService);
48 48 userTaskActivityBehavior.setDeptCoreService(deptCoreService);
49   - userTaskActivityBehavior.setUserGroupService(userGroupService);
  49 + userTaskActivityBehavior.setUserGroupServiceApi(userGroupServiceApi);
50 50 userTaskActivityBehavior.setSysUserCoreService(userCoreService);
51 51 userTaskActivityBehavior.setScripts(scripts);
52 52 return userTaskActivityBehavior;
... ...
yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/framework/activiti/core/behavior/BpmUserTaskActivitiBehavior.java
... ... @@ -4,11 +4,11 @@ import cn.hutool.core.collection.CollUtil;
4 4 import cn.hutool.core.util.RandomUtil;
5 5 import cn.hutool.core.util.StrUtil;
6 6 import cn.iocoder.yudao.adminserver.modules.bpm.dal.dataobject.definition.BpmTaskAssignRuleDO;
7   -import cn.iocoder.yudao.adminserver.modules.bpm.dal.dataobject.definition.BpmUserGroupDO;
8 7 import cn.iocoder.yudao.adminserver.modules.bpm.enums.definition.BpmTaskAssignRuleTypeEnum;
9 8 import cn.iocoder.yudao.adminserver.modules.bpm.framework.activiti.core.behavior.script.BpmTaskAssignScript;
10 9 import cn.iocoder.yudao.adminserver.modules.bpm.service.definition.BpmTaskAssignRuleService;
11   -import cn.iocoder.yudao.adminserver.modules.bpm.service.definition.BpmUserGroupService;
  10 +import cn.iocoder.yudao.coreservice.modules.bpm.api.group.BpmUserGroupServiceApi;
  11 +import cn.iocoder.yudao.coreservice.modules.bpm.api.group.dto.BpmUserGroupDTO;
12 12 import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.dept.SysDeptDO;
13 13 import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.user.SysUserDO;
14 14 import cn.iocoder.yudao.coreservice.modules.system.service.dept.SysDeptCoreService;
... ... @@ -30,7 +30,7 @@ import java.util.*;
30 30  
31 31 import static cn.iocoder.yudao.adminserver.modules.bpm.enums.BpmErrorCodeConstants.TASK_ASSIGN_SCRIPT_NOT_EXISTS;
32 32 import static cn.iocoder.yudao.adminserver.modules.bpm.enums.BpmErrorCodeConstants.TASK_CREATE_FAIL_NO_CANDIDATE_USER;
33   -import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.*;
  33 +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
34 34 import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap;
35 35 import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
36 36 import static cn.iocoder.yudao.framework.common.util.json.JsonUtils.toJsonString;
... ... @@ -53,7 +53,7 @@ public class BpmUserTaskActivitiBehavior extends UserTaskActivityBehavior {
53 53 @Setter
54 54 private SysDeptCoreService deptCoreService;
55 55 @Setter
56   - private BpmUserGroupService userGroupService;
  56 + private BpmUserGroupServiceApi userGroupServiceApi;
57 57 @Setter
58 58 private SysUserCoreService sysUserCoreService;
59 59 /**
... ... @@ -156,7 +156,7 @@ public class BpmUserTaskActivitiBehavior extends UserTaskActivityBehavior {
156 156 }
157 157  
158 158 private Set<Long> calculateTaskCandidateUsersByUserGroup(TaskEntity task, BpmTaskAssignRuleDO rule) {
159   - List<BpmUserGroupDO> userGroups = userGroupService.getUserGroupList(rule.getOptions());
  159 + List<BpmUserGroupDTO> userGroups = userGroupServiceApi.getUserGroupList(rule.getOptions());
160 160 Set<Long> userIds = new HashSet<>();
161 161 userGroups.forEach(bpmUserGroupDO -> userIds.addAll(bpmUserGroupDO.getMemberUserIds()));
162 162 return userIds;
... ...
yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/definition/impl/BpmTaskAssignRuleServiceImpl.java
1 1 package cn.iocoder.yudao.adminserver.modules.bpm.service.definition.impl;
2 2  
3 3 import cn.hutool.core.collection.CollUtil;
4   -import cn.hutool.core.collection.ListUtil;
5   -import cn.hutool.core.util.ArrayUtil;
6 4 import cn.hutool.core.util.ObjectUtil;
7 5 import cn.hutool.core.util.StrUtil;
8 6 import cn.iocoder.yudao.adminserver.modules.bpm.controller.definition.vo.rule.BpmTaskAssignRuleCreateReqVO;
... ... @@ -15,8 +13,7 @@ import cn.iocoder.yudao.adminserver.modules.bpm.enums.definition.BpmTaskAssignRu
15 13 import cn.iocoder.yudao.adminserver.modules.bpm.service.definition.BpmModelService;
16 14 import cn.iocoder.yudao.adminserver.modules.bpm.service.definition.BpmProcessDefinitionService;
17 15 import cn.iocoder.yudao.adminserver.modules.bpm.service.definition.BpmTaskAssignRuleService;
18   -import cn.iocoder.yudao.adminserver.modules.bpm.service.definition.BpmUserGroupService;
19   -
  16 +import cn.iocoder.yudao.coreservice.modules.bpm.api.group.BpmUserGroupServiceApi;
20 17 import cn.iocoder.yudao.coreservice.modules.system.enums.SysDictTypeConstants;
21 18 import cn.iocoder.yudao.coreservice.modules.system.service.dept.SysDeptCoreService;
22 19 import cn.iocoder.yudao.coreservice.modules.system.service.dept.SysPostCoreService;
... ... @@ -65,7 +62,7 @@ public class BpmTaskAssignRuleServiceImpl implements BpmTaskAssignRuleService {
65 62 @Resource
66 63 private SysUserCoreService userCoreService;
67 64 @Resource
68   - private BpmUserGroupService userGroupService;
  65 + private BpmUserGroupServiceApi userGroupServiceApi;
69 66 @Resource
70 67 private SysDictDataCoreService dictDataCoreService;
71 68  
... ... @@ -191,7 +188,7 @@ public class BpmTaskAssignRuleServiceImpl implements BpmTaskAssignRuleService {
191 188 } else if (Objects.equals(type, BpmTaskAssignRuleTypeEnum.USER.getType())) {
192 189 userCoreService.validUsers(options);
193 190 } else if (Objects.equals(type, BpmTaskAssignRuleTypeEnum.USER_GROUP.getType())) {
194   - userGroupService.validUserGroups(options);
  191 + userGroupServiceApi.validUserGroups(options);
195 192 } else if (Objects.equals(type, BpmTaskAssignRuleTypeEnum.SCRIPT.getType())) {
196 193 dictDataCoreService.validDictDatas(SysDictTypeConstants.BPM_TASK_ASSIGN_SCRIPT,
197 194 CollectionUtils.convertSet(options, String::valueOf));
... ...
yudao-module-bpm/yudao-module-bpm-activiti/src/test/java/cn/iocoder/yudao/adminserver/modules/bpm/framework/activiti/core/behavior/BpmUserTaskActivitiBehaviorTest.java
... ... @@ -2,12 +2,12 @@ package cn.iocoder.yudao.adminserver.modules.bpm.framework.activiti.core.behavio
2 2  
3 3 import cn.hutool.core.map.MapUtil;
4 4 import cn.iocoder.yudao.adminserver.modules.bpm.dal.dataobject.definition.BpmTaskAssignRuleDO;
5   -import cn.iocoder.yudao.adminserver.modules.bpm.dal.dataobject.definition.BpmUserGroupDO;
6 5 import cn.iocoder.yudao.adminserver.modules.bpm.enums.definition.BpmTaskAssignRuleTypeEnum;
7 6 import cn.iocoder.yudao.adminserver.modules.bpm.enums.definition.BpmTaskRuleScriptEnum;
8 7 import cn.iocoder.yudao.adminserver.modules.bpm.framework.activiti.core.behavior.script.BpmTaskAssignScript;
9 8 import cn.iocoder.yudao.adminserver.modules.bpm.service.definition.BpmTaskAssignRuleService;
10   -import cn.iocoder.yudao.adminserver.modules.bpm.service.definition.BpmUserGroupService;
  9 +import cn.iocoder.yudao.coreservice.modules.bpm.api.group.BpmUserGroupServiceApi;
  10 +import cn.iocoder.yudao.coreservice.modules.bpm.api.group.dto.BpmUserGroupDTO;
11 11 import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.dept.SysDeptDO;
12 12 import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.user.SysUserDO;
13 13 import cn.iocoder.yudao.coreservice.modules.system.service.dept.SysDeptCoreService;
... ... @@ -44,7 +44,7 @@ public class BpmUserTaskActivitiBehaviorTest extends BaseMockitoUnitTest {
44 44 @Mock
45 45 private SysDeptCoreService deptCoreService;
46 46 @Mock
47   - private BpmUserGroupService userGroupService;
  47 + private BpmUserGroupServiceApi userGroupServiceApi;
48 48 @Mock
49 49 private SysUserCoreService userCoreService;
50 50  
... ... @@ -135,9 +135,9 @@ public class BpmUserTaskActivitiBehaviorTest extends BaseMockitoUnitTest {
135 135 BpmTaskAssignRuleDO rule = new BpmTaskAssignRuleDO().setOptions(asSet(1L, 2L))
136 136 .setType(BpmTaskAssignRuleTypeEnum.USER_GROUP.getType());
137 137 // mock 方法
138   - BpmUserGroupDO userGroup1 = randomPojo(BpmUserGroupDO.class, o -> o.setMemberUserIds(asSet(11L, 12L)));
139   - BpmUserGroupDO userGroup2 = randomPojo(BpmUserGroupDO.class, o -> o.setMemberUserIds(asSet(21L, 22L)));
140   - when(userGroupService.getUserGroupList(eq(rule.getOptions()))).thenReturn(Arrays.asList(userGroup1, userGroup2));
  138 + BpmUserGroupDTO userGroup1 = randomPojo(BpmUserGroupDTO.class, o -> o.setMemberUserIds(asSet(11L, 12L)));
  139 + BpmUserGroupDTO userGroup2 = randomPojo(BpmUserGroupDTO.class, o -> o.setMemberUserIds(asSet(21L, 22L)));
  140 + when(userGroupServiceApi.getUserGroupList(eq(rule.getOptions()))).thenReturn(Arrays.asList(userGroup1, userGroup2));
141 141 mockGetUserMap(asSet(11L, 12L, 21L, 22L));
142 142  
143 143 // 调用
... ...
yudao-module-bpm/yudao-module-bpm-activiti/src/test/resources/sql/clean.sql
1   --- inf 开头的 DB
2   -DELETE FROM "inf_config";
3   -DELETE FROM "inf_file";
4   -DELETE FROM "inf_job";
5   -DELETE FROM "inf_job_log";
6   -DELETE FROM "inf_api_access_log";
7   -DELETE FROM "inf_api_error_log";
8   -
9   --- sys 开头的 DB
10   -DELETE FROM "sys_dept";
11   -DELETE FROM "sys_dict_data";
12   -DELETE FROM "sys_role";
13   -DELETE FROM "sys_role_menu";
14   -DELETE FROM "sys_menu";
15   -DELETE FROM "sys_user_role";
16   -DELETE FROM "sys_dict_type";
17   -DELETE FROM "sys_user_session";
18   -DELETE FROM "sys_post";
19   -DELETE FROM "sys_login_log";
20   -DELETE FROM "sys_operate_log";
21   -DELETE FROM "sys_user";
22   -DELETE FROM "sys_sms_channel";
23   -DELETE FROM "sys_sms_template";
24   -DELETE FROM "sys_sms_log";
25   -DELETE FROM "sys_error_code";
26   -DELETE FROM "sys_social_user";
27   -DELETE FROM "sys_tenant";
28   -
29   --- pay 开头的 DB
30   -DELETE FROM pay_merchant;
31   -DELETE FROM pay_app;
32   -DELETE FROM pay_channel;
33   -DELETE FROM pay_order;
34   -DELETE FROM pay_refund;
35   -
36 1 -- bpm 开头的 DB
37 2 DELETE FROM "bpm_form";
38   -DELETE FROM "bpm_user_group";
... ...
yudao-module-bpm/yudao-module-bpm-activiti/src/test/resources/sql/create_tables.sql
1   --- inf 开头的 DB
2   -
3   -CREATE TABLE IF NOT EXISTS "inf_config" (
4   - "id" bigint(20) NOT NULL GENERATED BY DEFAULT AS IDENTITY,
5   - "group" varchar(50) NOT NULL,
6   - "type" tinyint NOT NULL,
7   - "name" varchar(100) NOT NULL DEFAULT '',
8   - "key" varchar(100) NOT NULL DEFAULT '',
9   - "value" varchar(500) NOT NULL DEFAULT '',
10   - "sensitive" bit NOT NULL,
11   - "remark" varchar(500) DEFAULT NULL,
12   - "creator" varchar(64) DEFAULT '',
13   - "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
14   - "updater" varchar(64) DEFAULT '',
15   - "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
16   - "deleted" bit NOT NULL DEFAULT FALSE,
17   - PRIMARY KEY ("id")
18   -) COMMENT '参数配置表';
19   -
20   -CREATE TABLE IF NOT EXISTS "inf_file" (
21   - "id" varchar(188) NOT NULL,
22   - "type" varchar(63) DEFAULT NULL,
23   - "content" blob NOT NULL,
24   - "creator" varchar(64) DEFAULT '',
25   - "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
26   - "updater" varchar(64) DEFAULT '',
27   - "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
28   - "deleted" bit NOT NULL DEFAULT FALSE,
29   - "tenant_id" bigint not null default '0',
30   - PRIMARY KEY ("id")
31   -) COMMENT '文件表';
32   -
33   -CREATE TABLE IF NOT EXISTS "inf_job" (
34   - "id" bigint(20) NOT NULL GENERATED BY DEFAULT AS IDENTITY COMMENT '任务编号',
35   - "name" varchar(32) NOT NULL COMMENT '任务名称',
36   - "status" tinyint(4) NOT NULL COMMENT '任务状态',
37   - "handler_name" varchar(64) NOT NULL COMMENT '处理器的名字',
38   - "handler_param" varchar(255) DEFAULT NULL COMMENT '处理器的参数',
39   - "cron_expression" varchar(32) NOT NULL COMMENT 'CRON 表达式',
40   - "retry_count" int(11) NOT NULL DEFAULT '0' COMMENT '重试次数',
41   - "retry_interval" int(11) NOT NULL DEFAULT '0' COMMENT '重试间隔',
42   - "monitor_timeout" int(11) NOT NULL DEFAULT '0' COMMENT '监控超时时间',
43   - "creator" varchar(64) DEFAULT '' COMMENT '创建者',
44   - "create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
45   - "updater" varchar(64) DEFAULT '' COMMENT '更新者',
46   - "update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
47   - "deleted" bit NOT NULL DEFAULT FALSE COMMENT '是否删除',
48   - PRIMARY KEY ("id")
49   -) COMMENT='定时任务表';
50   -
51   -CREATE TABLE IF NOT EXISTS "inf_job_log" (
52   - "id" bigint(20) NOT NULL GENERATED BY DEFAULT AS IDENTITY COMMENT '日志编号',
53   - "job_id" bigint(20) NOT NULL COMMENT '任务编号',
54   - "handler_name" varchar(64) NOT NULL COMMENT '处理器的名字',
55   - "handler_param" varchar(255) DEFAULT NULL COMMENT '处理器的参数',
56   - "execute_index" tinyint(4) NOT NULL DEFAULT '1' COMMENT '第几次执行',
57   - "begin_time" datetime NOT NULL COMMENT '开始执行时间',
58   - "end_time" datetime DEFAULT NULL COMMENT '结束执行时间',
59   - "duration" int(11) DEFAULT NULL COMMENT '执行时长',
60   - "status" tinyint(4) NOT NULL COMMENT '任务状态',
61   - "result" varchar(4000) DEFAULT '' COMMENT '结果数据',
62   - "creator" varchar(64) DEFAULT '' COMMENT '创建者',
63   - "create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
64   - "updater" varchar(64) DEFAULT '' COMMENT '更新者',
65   - "update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
66   - "deleted" bit(1) NOT NULL DEFAULT FALSE COMMENT '是否删除',
67   - PRIMARY KEY ("id")
68   -)COMMENT='定时任务日志表';
69   -
70   --- sys 开头的 DB
71   -
72   -CREATE TABLE IF NOT EXISTS "sys_dept" (
73   - "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
74   - "name" varchar(30) NOT NULL DEFAULT '',
75   - "parent_id" bigint NOT NULL DEFAULT '0',
76   - "sort" int NOT NULL DEFAULT '0',
77   - "leader_user_id" bigint DEFAULT NULL,
78   - "phone" varchar(11) DEFAULT NULL,
79   - "email" varchar(50) DEFAULT NULL,
80   - "status" tinyint NOT NULL,
81   - "creator" varchar(64) DEFAULT '',
82   - "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
83   - "updater" varchar(64) DEFAULT '',
84   - "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
85   - "deleted" bit NOT NULL DEFAULT FALSE,
86   - "tenant_id" bigint not null default '0',
87   - PRIMARY KEY ("id")
88   -) COMMENT '部门表';
89   -
90   -CREATE TABLE IF NOT EXISTS "sys_dict_data" (
91   - "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
92   - "sort" int NOT NULL DEFAULT '0',
93   - "label" varchar(100) NOT NULL DEFAULT '',
94   - "value" varchar(100) NOT NULL DEFAULT '',
95   - "dict_type" varchar(100) NOT NULL DEFAULT '',
96   - "status" tinyint NOT NULL DEFAULT '0',
97   - "remark" varchar(500) DEFAULT NULL,
98   - "creator" varchar(64) DEFAULT '',
99   - "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
100   - "updater" varchar(64) DEFAULT '',
101   - "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
102   - "deleted" bit NOT NULL DEFAULT FALSE,
103   - PRIMARY KEY ("id")
104   -) COMMENT '字典数据表';
105   -
106   -CREATE TABLE IF NOT EXISTS "sys_role" (
107   - "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
108   - "name" varchar(30) NOT NULL,
109   - "code" varchar(100) NOT NULL,
110   - "sort" int NOT NULL,
111   - "data_scope" tinyint NOT NULL DEFAULT '1',
112   - "data_scope_dept_ids" varchar(500) NOT NULL DEFAULT '',
113   - "status" tinyint NOT NULL,
114   - "type" tinyint NOT NULL,
115   - "remark" varchar(500) DEFAULT NULL,
116   - "creator" varchar(64) DEFAULT '',
117   - "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
118   - "updater" varchar(64) DEFAULT '',
119   - "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
120   - "deleted" bit NOT NULL DEFAULT FALSE,
121   - PRIMARY KEY ("id")
122   -) COMMENT '角色信息表';
123   -
124   -CREATE TABLE IF NOT EXISTS "sys_role_menu" (
125   - "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
126   - "role_id" bigint NOT NULL,
127   - "menu_id" bigint NOT NULL,
128   - "creator" varchar(64) DEFAULT '',
129   - "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
130   - "updater" varchar(64) DEFAULT '',
131   - "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
132   - "deleted" bit NOT NULL DEFAULT FALSE,
133   - PRIMARY KEY ("id")
134   -) COMMENT '角色和菜单关联表';
135   -
136   -CREATE TABLE IF NOT EXISTS "sys_menu" (
137   - "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
138   - "name" varchar(50) NOT NULL,
139   - "permission" varchar(100) NOT NULL DEFAULT '',
140   - "menu_type" tinyint NOT NULL,
141   - "sort" int NOT NULL DEFAULT '0',
142   - "parent_id" bigint NOT NULL DEFAULT '0',
143   - "path" varchar(200) DEFAULT '',
144   - "icon" varchar(100) DEFAULT '#',
145   - "component" varchar(255) DEFAULT NULL,
146   - "status" tinyint NOT NULL DEFAULT '0',
147   - "creator" varchar(64) DEFAULT '',
148   - "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
149   - "updater" varchar(64) DEFAULT '',
150   - "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
151   - "deleted" bit NOT NULL DEFAULT FALSE,
152   - PRIMARY KEY ("id")
153   -) COMMENT '菜单权限表';
154   -
155   -CREATE TABLE IF NOT EXISTS "sys_user_role" (
156   - "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
157   - "user_id" bigint NOT NULL,
158   - "role_id" bigint NOT NULL,
159   - "creator" varchar(64) DEFAULT '',
160   - "create_time" timestamp DEFAULT NULL,
161   - "updater" varchar(64) DEFAULT '',
162   - "update_time" timestamp DEFAULT NULL,
163   - "deleted" bit DEFAULT FALSE,
164   - PRIMARY KEY ("id")
165   -) COMMENT '用户和角色关联表';
166   -
167   -CREATE TABLE IF NOT EXISTS "sys_dict_type" (
168   - "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
169   - "name" varchar(100) NOT NULL DEFAULT '',
170   - "type" varchar(100) NOT NULL DEFAULT '',
171   - "status" tinyint NOT NULL DEFAULT '0',
172   - "remark" varchar(500) DEFAULT NULL,
173   - "creator" varchar(64) DEFAULT '',
174   - "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
175   - "updater" varchar(64) DEFAULT '',
176   - "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
177   - "deleted" bit NOT NULL DEFAULT FALSE,
178   - PRIMARY KEY ("id")
179   -) COMMENT '字典类型表';
180   -
181   -CREATE TABLE IF NOT EXISTS `sys_user_session` (
182   - `id` varchar(32) NOT NULL,
183   - `user_id` bigint DEFAULT NULL,
184   - "user_type" tinyint NOT NULL,
185   - `username` varchar(50) NOT NULL DEFAULT '',
186   - `user_ip` varchar(50) DEFAULT NULL,
187   - `user_agent` varchar(512) DEFAULT NULL,
188   - `session_timeout` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
189   - "creator" varchar(64) DEFAULT '',
190   - "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
191   - `updater` varchar(64) DEFAULT '' ,
192   - "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
193   - "deleted" bit NOT NULL DEFAULT FALSE,
194   - "tenant_id" bigint not null default '0',
195   - PRIMARY KEY (`id`)
196   -) COMMENT '用户在线 Session';
197   -
198   -CREATE TABLE IF NOT EXISTS "sys_post" (
199   - "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
200   - "code" varchar(64) NOT NULL,
201   - "name" varchar(50) NOT NULL,
202   - "sort" integer NOT NULL,
203   - "status" tinyint NOT NULL,
204   - "remark" varchar(500) DEFAULT NULL,
205   - "creator" varchar(64) DEFAULT '',
206   - "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
207   - "updater" varchar(64) DEFAULT '',
208   - "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
209   - "deleted" bit NOT NULL DEFAULT FALSE,
210   - "tenant_id" bigint not null default '0',
211   - PRIMARY KEY ("id")
212   -) COMMENT '岗位信息表';
213   -
214   -CREATE TABLE IF NOT EXISTS "sys_notice" (
215   - "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
216   - "title" varchar(50) NOT NULL COMMENT '公告标题',
217   - "content" text NOT NULL COMMENT '公告内容',
218   - "notice_type" tinyint NOT NULL COMMENT '公告类型(1通知 2公告)',
219   - "status" tinyint NOT NULL DEFAULT '0' COMMENT '公告状态(0正常 1关闭)',
220   - "creator" varchar(64) DEFAULT '' COMMENT '创建者',
221   - "create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
222   - "updater" varchar(64) DEFAULT '' COMMENT '更新者',
223   - "update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
224   - "deleted" bit NOT NULL DEFAULT 0 COMMENT '是否删除',
225   - "tenant_id" bigint not null default '0',
226   - PRIMARY KEY("id")
227   -) COMMENT '通知公告表';
228   -
229   -CREATE TABLE IF NOT EXISTS `sys_login_log` (
230   - `id` bigint(20) NOT NULL GENERATED BY DEFAULT AS IDENTITY,
231   - `log_type` bigint(4) NOT NULL,
232   - "user_id" bigint not null default '0',
233   - "user_type" tinyint NOT NULL,
234   - `trace_id` varchar(64) NOT NULL DEFAULT '',
235   - `username` varchar(50) NOT NULL DEFAULT '',
236   - `result` tinyint(4) NOT NULL,
237   - `user_ip` varchar(50) NOT NULL,
238   - `user_agent` varchar(512) NOT NULL,
239   - `creator` varchar(64) DEFAULT '',
240   - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
241   - `updater` varchar(64) DEFAULT '',
242   - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
243   - `deleted` bit(1) NOT NULL DEFAULT '0',
244   - PRIMARY KEY (`id`)
245   -) COMMENT ='系统访问记录';
246   -
247   -CREATE TABLE IF NOT EXISTS `sys_operate_log` (
248   - `id` bigint(20) NOT NULL GENERATED BY DEFAULT AS IDENTITY,
249   - `trace_id` varchar(64) NOT NULL DEFAULT '',
250   - `user_id` bigint(20) NOT NULL,
251   - `module` varchar(50) NOT NULL,
252   - `name` varchar(50) NOT NULL,
253   - `operate_type` bigint(4) NOT NULL DEFAULT '0',
254   - `content` varchar(2000) NOT NULL DEFAULT '',
255   - `exts` varchar(512) NOT NULL DEFAULT '',
256   - `request_method` varchar(16) DEFAULT '',
257   - `request_url` varchar(255) DEFAULT '',
258   - `user_ip` varchar(50) DEFAULT NULL,
259   - `user_agent` varchar(200) DEFAULT NULL,
260   - `java_method` varchar(512) NOT NULL DEFAULT '',
261   - `java_method_args` varchar(8000) DEFAULT '',
262   - `start_time` datetime NOT NULL,
263   - `duration` int(11) NOT NULL,
264   - `result_code` int(11) NOT NULL DEFAULT '0',
265   - `result_msg` varchar(512) DEFAULT '',
266   - `result_data` varchar(4000) DEFAULT '',
267   - `creator` varchar(64) DEFAULT '',
268   - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
269   - `updater` varchar(64) DEFAULT '',
270   - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
271   - `deleted` bit(1) NOT NULL DEFAULT '0',
272   - "tenant_id" bigint not null default '0',
273   - PRIMARY KEY (`id`)
274   -) COMMENT ='操作日志记录';
275   -
276   -CREATE TABLE IF NOT EXISTS "sys_user" (
277   - "id" bigint not null GENERATED BY DEFAULT AS IDENTITY,
278   - "username" varchar(30) not null,
279   - "password" varchar(100) not null default '',
280   - "nickname" varchar(30) not null,
281   - "remark" varchar(500) default null,
282   - "dept_id" bigint default null,
283   - "post_ids" varchar(255) default null,
284   - "email" varchar(50) default '',
285   - "mobile" varchar(11) default '',
286   - "sex" tinyint default '0',
287   - "avatar" varchar(100) default '',
288   - "status" tinyint not null default '0',
289   - "login_ip" varchar(50) default '',
290   - "login_date" timestamp default null,
291   - "creator" varchar(64) default '',
292   - "create_time" timestamp not null default current_timestamp,
293   - "updater" varchar(64) default '',
294   - "update_time" timestamp not null default current_timestamp,
295   - "deleted" bit not null default false,
296   - "tenant_id" bigint not null default '0',
297   - primary key ("id")
298   -) comment '用户信息表';
299   -
300   -CREATE TABLE IF NOT EXISTS "inf_api_access_log" (
301   - "id" bigint not null GENERATED BY DEFAULT AS IDENTITY,
302   - "trace_id" varchar(64) not null default '',
303   - "user_id" bigint not null default '0',
304   - "user_type" tinyint not null default '0',
305   - "application_name" varchar(50) not null,
306   - "request_method" varchar(16) not null default '',
307   - "request_url" varchar(255) not null default '',
308   - "request_params" varchar(8000) not null default '',
309   - "user_ip" varchar(50) not null,
310   - "user_agent" varchar(512) not null,
311   - "begin_time" timestamp not null,
312   - "end_time" timestamp not null,
313   - "duration" integer not null,
314   - "result_code" integer not null default '0',
315   - "result_msg" varchar(512) default '',
316   - "creator" varchar(64) default '',
317   - "create_time" timestamp not null default current_timestamp,
318   - "updater" varchar(64) default '',
319   - "update_time" timestamp not null default current_timestamp,
320   - "deleted" bit not null default false,
321   - "tenant_id" bigint not null default '0',
322   - primary key ("id")
323   -) COMMENT 'API 访问日志表';
324   -
325   -CREATE TABLE IF NOT EXISTS "inf_api_error_log" (
326   - "id" bigint not null GENERATED BY DEFAULT AS IDENTITY,
327   - "trace_id" varchar(64) not null,
328   - "user_id" bigint not null default '0',
329   - "user_type" tinyint not null default '0',
330   - "application_name" varchar(50) not null,
331   - "request_method" varchar(16) not null,
332   - "request_url" varchar(255) not null,
333   - "request_params" varchar(8000) not null,
334   - "user_ip" varchar(50) not null,
335   - "user_agent" varchar(512) not null,
336   - "exception_time" timestamp not null,
337   - "exception_name" varchar(128) not null default '',
338   - "exception_message" clob not null,
339   - "exception_root_cause_message" clob not null,
340   - "exception_stack_trace" clob not null,
341   - "exception_class_name" varchar(512) not null,
342   - "exception_file_name" varchar(512) not null,
343   - "exception_method_name" varchar(512) not null,
344   - "exception_line_number" integer not null,
345   - "process_status" tinyint not null,
346   - "process_time" timestamp default null,
347   - "process_user_id" bigint default '0',
348   - "creator" varchar(64) default '',
349   - "create_time" timestamp not null default current_timestamp,
350   - "updater" varchar(64) default '',
351   - "update_time" timestamp not null default current_timestamp,
352   - "deleted" bit not null default false,
353   - "tenant_id" bigint not null default '0',
354   - primary key ("id")
355   -) COMMENT '系统异常日志';
356   -
357   -CREATE TABLE IF NOT EXISTS "sys_sms_channel" (
358   - "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
359   - "signature" varchar(10) NOT NULL,
360   - "code" varchar(63) NOT NULL,
361   - "status" tinyint NOT NULL,
362   - "remark" varchar(255) DEFAULT NULL,
363   - "api_key" varchar(63) NOT NULL,
364   - "api_secret" varchar(63) DEFAULT NULL,
365   - "callback_url" varchar(255) DEFAULT NULL,
366   - "creator" varchar(64) DEFAULT '',
367   - "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
368   - "updater" varchar(64) DEFAULT '',
369   - "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
370   - "deleted" bit NOT NULL DEFAULT FALSE,
371   - PRIMARY KEY ("id")
372   -) COMMENT '短信渠道';
373   -
374   -CREATE TABLE IF NOT EXISTS "sys_sms_template" (
375   - "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
376   - "type" tinyint NOT NULL,
377   - "status" tinyint NOT NULL,
378   - "code" varchar(63) NOT NULL,
379   - "name" varchar(63) NOT NULL,
380   - "content" varchar(255) NOT NULL,
381   - "params" varchar(255) NOT NULL,
382   - "remark" varchar(255) DEFAULT NULL,
383   - "api_template_id" varchar(63) NOT NULL,
384   - "channel_id" bigint NOT NULL,
385   - "channel_code" varchar(63) NOT NULL,
386   - "creator" varchar(64) DEFAULT '',
387   - "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
388   - "updater" varchar(64) DEFAULT '',
389   - "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
390   - "deleted" bit NOT NULL DEFAULT FALSE,
391   - PRIMARY KEY ("id")
392   -) COMMENT '短信模板';
393   -
394   -CREATE TABLE IF NOT EXISTS "sys_sms_log" (
395   - "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
396   - "channel_id" bigint NOT NULL,
397   - "channel_code" varchar(63) NOT NULL,
398   - "template_id" bigint NOT NULL,
399   - "template_code" varchar(63) NOT NULL,
400   - "template_type" tinyint NOT NULL,
401   - "template_content" varchar(255) NOT NULL,
402   - "template_params" varchar(255) NOT NULL,
403   - "api_template_id" varchar(63) NOT NULL,
404   - "mobile" varchar(11) NOT NULL,
405   - "user_id" bigint DEFAULT '0',
406   - "user_type" tinyint DEFAULT '0',
407   - "send_status" tinyint NOT NULL DEFAULT '0',
408   - "send_time" timestamp DEFAULT NULL,
409   - "send_code" int DEFAULT NULL,
410   - "send_msg" varchar(255) DEFAULT NULL,
411   - "api_send_code" varchar(63) DEFAULT NULL,
412   - "api_send_msg" varchar(255) DEFAULT NULL,
413   - "api_request_id" varchar(255) DEFAULT NULL,
414   - "api_serial_no" varchar(255) DEFAULT NULL,
415   - "receive_status" tinyint NOT NULL DEFAULT '0',
416   - "receive_time" timestamp DEFAULT NULL,
417   - "api_receive_code" varchar(63) DEFAULT NULL,
418   - "api_receive_msg" varchar(255) DEFAULT NULL,
419   - "creator" varchar(64) DEFAULT '',
420   - "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
421   - "updater" varchar(64) DEFAULT '',
422   - "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
423   - "deleted" bit NOT NULL DEFAULT FALSE,
424   - PRIMARY KEY ("id")
425   -) COMMENT '短信日志';
426   -
427   -CREATE TABLE IF NOT EXISTS "sys_error_code" (
428   - "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
429   - "type" tinyint NOT NULL DEFAULT '0',
430   - "application_name" varchar(50) NOT NULL,
431   - "code" int NOT NULL DEFAULT '0',
432   - "message" varchar(512) NOT NULL DEFAULT '',
433   - "memo" varchar(512) DEFAULT '',
434   - "creator" varchar(64) DEFAULT '',
435   - "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
436   - "updater" varchar(64) DEFAULT '',
437   - "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
438   - "deleted" bit NOT NULL DEFAULT FALSE,
439   - PRIMARY KEY ("id")
440   -) COMMENT '错误码表';
441   -
442   -CREATE TABLE IF NOT EXISTS "sys_social_user" (
443   - "id" number NOT NULL GENERATED BY DEFAULT AS IDENTITY,
444   - "user_id" bigint NOT NULL,
445   - "user_type" tinyint NOT NULL DEFAULT '0',
446   - "type" tinyint NOT NULL,
447   - "openid" varchar(32) NOT NULL,
448   - "token" varchar(256) DEFAULT NULL,
449   - "union_id" varchar(32) NOT NULL,
450   - "raw_token_info" varchar(1024) NOT NULL,
451   - "nickname" varchar(32) NOT NULL,
452   - "avatar" varchar(255) DEFAULT NULL,
453   - "raw_user_info" varchar(1024) NOT NULL,
454   - "creator" varchar(64) DEFAULT '',
455   - "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
456   - "updater" varchar(64) DEFAULT '',
457   - "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
458   - "deleted" bit NOT NULL DEFAULT FALSE,
459   - PRIMARY KEY ("id")
460   -) COMMENT '社交用户';
461   -
462   -CREATE TABLE IF NOT EXISTS "sys_tenant" (
463   - "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
464   - "name" varchar(63) NOT NULL,
465   - "contact_name" varchar(255) NOT NULL,
466   - "contact_mobile" varchar(255),
467   - "status" tinyint NOT NULL,
468   - "creator" varchar(64) DEFAULT '',
469   - "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
470   - "updater" varchar(64) DEFAULT '',
471   - "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
472   - "deleted" bit NOT NULL DEFAULT FALSE,
473   - PRIMARY KEY ("id")
474   -) COMMENT '租户';
475   -
476   -
477   -CREATE TABLE IF NOT EXISTS "pay_merchant"
478   -(
479   - "id" number NOT NULL GENERATED BY DEFAULT AS IDENTITY,
480   - "no" varchar(32) NOT NULL,
481   - "name" varchar(64) NOT NULL,
482   - "short_name" varchar(64) NOT NULL,
483   - "status" tinyint NOT NULL,
484   - "remark" varchar(255) DEFAULT NULL,
485   - "creator" varchar(64) DEFAULT '',
486   - "create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
487   - "updater" varchar(64) DEFAULT '',
488   - "update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
489   - "deleted" bit(1) NOT NULL DEFAULT FALSE,
490   - PRIMARY KEY ("id")
491   -) COMMENT '支付商户信息';
492   -
493   --- bpm 开头的 DB
494   -
495   -CREATE TABLE IF NOT EXISTS "pay_app" (
496   - "id" number NOT NULL GENERATED BY DEFAULT AS IDENTITY,
497   - "name" varchar(64) NOT NULL,
498   - "status" tinyint NOT NULL,
499   - "remark" varchar(255) DEFAULT NULL,
500   - `pay_notify_url` varchar(1024) NOT NULL,
501   - `refund_notify_url` varchar(1024) NOT NULL,
502   - `merchant_id` bigint(20) NOT NULL,
503   - "creator" varchar(64) DEFAULT '',
504   - "create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
505   - "updater" varchar(64) DEFAULT '',
506   - "update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
507   - "deleted" bit(1) NOT NULL DEFAULT FALSE,
508   - PRIMARY KEY ("id")
509   -) COMMENT = '支付应用信息';
510   -
511   -CREATE TABLE IF NOT EXISTS "pay_channel" (
512   - "id" number NOT NULL GENERATED BY DEFAULT AS IDENTITY,
513   - "code" varchar(32) NOT NULL,
514   - "status" tinyint(4) NOT NULL,
515   - "remark" varchar(255) DEFAULT NULL,
516   - "fee_rate" double NOT NULL DEFAULT 0,
517   - "merchant_id" bigint(20) NOT NULL,
518   - "app_id" bigint(20) NOT NULL,
519   - "config" varchar(10240) NOT NULL,
520   - "creator" varchar(64) NULL DEFAULT '',
521   - "create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
522   - "updater" varchar(64) NULL DEFAULT '',
523   - "update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
524   - "deleted" bit(1) NOT NULL DEFAULT FALSE,
525   - PRIMARY KEY ("id")
526   -) COMMENT = '支付渠道';
527   -
528   -CREATE TABLE IF NOT EXISTS `pay_order` (
529   - "id" number NOT NULL GENERATED BY DEFAULT AS IDENTITY,
530   - `merchant_id` bigint(20) NOT NULL,
531   - `app_id` bigint(20) NOT NULL,
532   - `channel_id` bigint(20) DEFAULT NULL,
533   - `channel_code` varchar(32) DEFAULT NULL,
534   - `merchant_order_id` varchar(64) NOT NULL,
535   - `subject` varchar(32) NOT NULL,
536   - `body` varchar(128) NOT NULL,
537   - `notify_url` varchar(1024) NOT NULL,
538   - `notify_status` tinyint(4) NOT NULL,
539   - `amount` bigint(20) NOT NULL,
540   - `channel_fee_rate` double DEFAULT 0,
541   - `channel_fee_amount` bigint(20) DEFAULT 0,
542   - `status` tinyint(4) NOT NULL,
543   - `user_ip` varchar(50) NOT NULL,
544   - `expire_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP,
545   - `success_time` datetime(0) DEFAULT CURRENT_TIMESTAMP,
546   - `notify_time` datetime(0) DEFAULT CURRENT_TIMESTAMP,
547   - `success_extension_id` bigint(20) DEFAULT NULL COMMENT '支付成功的订单拓展单编号',
548   - `refund_status` tinyint(4) NOT NULL,
549   - `refund_times` tinyint(4) NOT NULL,
550   - `refund_amount` bigint(20) NOT NULL,
551   - `channel_user_id` varchar(255) DEFAULT NULL,
552   - `channel_order_no` varchar(64) DEFAULT NULL,
553   - `creator` varchar(64) DEFAULT '',
554   - `create_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP,
555   - `updater` varchar(64) DEFAULT '',
556   - `update_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
557   - `deleted` bit(1) NOT NULL DEFAULT FALSE,
558   - PRIMARY KEY ("id")
559   -) COMMENT = '支付订单';
560   -
561   -CREATE TABLE IF NOT EXISTS `pay_refund` (
562   - "id" number NOT NULL GENERATED BY DEFAULT AS IDENTITY,
563   - `merchant_id` bigint(20) NOT NULL,
564   - `app_id` bigint(20) NOT NULL,
565   - `channel_id` bigint(20) NOT NULL,
566   - `channel_code` varchar(32) NOT NULL,
567   - `order_id` bigint(20) NOT NULL,
568   - `trade_no` varchar(64) NOT NULL,
569   - `merchant_order_id` varchar(64) NOT NULL,
570   - `merchant_refund_no` varchar(64) NOT NULL,
571   - `notify_url` varchar(1024) NOT NULL,
572   - `notify_status` tinyint(4) NOT NULL,
573   - `status` tinyint(4) NOT NULL,
574   - `type` tinyint(4) NOT NULL,
575   - `pay_amount` bigint(20) NOT NULL,
576   - `refund_amount` bigint(20) NOT NULL,
577   - `reason` varchar(256) NOT NULL,
578   - `user_ip` varchar(50) NULL DEFAULT NULL,
579   - `channel_order_no` varchar(64) NOT NULL,
580   - `channel_refund_no` varchar(64) NULL DEFAULT NULL,
581   - `channel_error_code` varchar(128) NULL DEFAULT NULL,
582   - `channel_error_msg` varchar(256) NULL DEFAULT NULL,
583   - `channel_extras` varchar(1024) NULL DEFAULT NULL,
584   - `expire_time` datetime(0) NULL DEFAULT NULL,
585   - `success_time` datetime(0) NULL DEFAULT NULL,
586   - `notify_time` datetime(0) NULL DEFAULT NULL,
587   - `creator` varchar(64) NULL DEFAULT '',
588   - `create_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP,
589   - `updater` varchar(64) NULL DEFAULT '',
590   - `update_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
591   - `deleted` bit(1) NOT NULL DEFAULT FALSE,
592   - PRIMARY KEY ("id")
593   -) COMMENT = '退款订单';
594   -
595 1 -- bpm 开头的 DB
596 2  
597 3 CREATE TABLE IF NOT EXISTS "bpm_form" (
... ... @@ -608,17 +14,3 @@ CREATE TABLE IF NOT EXISTS &quot;bpm_form&quot; (
608 14 "deleted" bit NOT NULL DEFAULT FALSE,
609 15 PRIMARY KEY ("id")
610 16 ) COMMENT '动态表单';
611   -
612   -CREATE TABLE IF NOT EXISTS "bpm_user_group" (
613   - "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
614   - "name" varchar(63) NOT NULL,
615   - "description" varchar(255) NOT NULL,
616   - "status" tinyint NOT NULL,
617   - "member_user_ids" varchar(255) NOT NULL,
618   - "creator" varchar(64) DEFAULT '',
619   - "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
620   - "updater" varchar(64) DEFAULT '',
621   - "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
622   - "deleted" bit NOT NULL DEFAULT FALSE,
623   - PRIMARY KEY ("id")
624   - ) COMMENT '用户组';
... ...
yudao-module-bpm/yudao-module-bpm-core-service/pom.xml
... ... @@ -8,7 +8,11 @@
8 8 <version>${revision}</version>
9 9 </parent>
10 10 <modelVersion>4.0.0</modelVersion>
11   -
  11 + <packaging>pom</packaging>
  12 + <modules>
  13 + <module>yudao-module-bpm-core-service-api</module>
  14 + <module>yudao-module-bpm-core-service-impl</module>
  15 + </modules>
12 16 <artifactId>yudao-module-bpm-core-service</artifactId>
13 17  
14 18  
... ...
yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-api/pom.xml 0 → 100644
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<project xmlns="http://maven.apache.org/POM/4.0.0"
  3 + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4 + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  5 + <parent>
  6 + <artifactId>yudao-module-bpm-core-service</artifactId>
  7 + <groupId>cn.iocoder.boot</groupId>
  8 + <version>${revision}</version>
  9 + </parent>
  10 + <modelVersion>4.0.0</modelVersion>
  11 +
  12 + <artifactId>yudao-module-bpm-core-service-api</artifactId>
  13 +
  14 + <dependencies>
  15 + <dependency>
  16 + <groupId>org.projectlombok</groupId>
  17 + <artifactId>lombok</artifactId>
  18 + </dependency>
  19 + </dependencies>
  20 +</project>
0 21 \ No newline at end of file
... ...
yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-api/src/main/java/cn/iocoder/yudao/coreservice/modules/bpm/api/group/BpmUserGroupServiceApi.java 0 → 100644
  1 +package cn.iocoder.yudao.coreservice.modules.bpm.api.group;
  2 +
  3 +import cn.iocoder.yudao.coreservice.modules.bpm.api.group.dto.BpmUserGroupDTO;
  4 +
  5 +import java.util.Collection;
  6 +import java.util.List;
  7 +import java.util.Set;
  8 +
  9 +/**
  10 + * Bpm 用户组 API 接口
  11 + *
  12 + * @author jason
  13 + */
  14 +public interface BpmUserGroupServiceApi {
  15 +
  16 + /**
  17 + * 获得用户组列表
  18 + *
  19 + * @param ids 编号
  20 + * @return 用户组列表
  21 + */
  22 + List<BpmUserGroupDTO> getUserGroupList(Collection<Long> ids);
  23 +
  24 + /**
  25 + * 校验用户组们是否有效。如下情况,视为无效:
  26 + * 1. 用户组编号不存在
  27 + * 2. 用户组被禁用
  28 + *
  29 + * @param ids 用户组编号数组
  30 + */
  31 + void validUserGroups(Set<Long> ids);
  32 +}
... ...
yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-api/src/main/java/cn/iocoder/yudao/coreservice/modules/bpm/api/group/dto/BpmUserGroupDTO.java 0 → 100644
  1 +package cn.iocoder.yudao.coreservice.modules.bpm.api.group.dto;
  2 +
  3 +import lombok.Data;
  4 +
  5 +import java.util.Set;
  6 +/**
  7 + * Bpm 用户组 DTO
  8 + *
  9 + * @author jason
  10 + */
  11 +@Data
  12 +public class BpmUserGroupDTO {
  13 + /**
  14 + * 成员用户编号数组
  15 + */
  16 + private Set<Long> memberUserIds;
  17 +}
... ...
yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl/pom.xml 0 → 100644
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<project xmlns="http://maven.apache.org/POM/4.0.0"
  3 + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4 + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  5 + <parent>
  6 + <artifactId>yudao-module-bpm-core-service</artifactId>
  7 + <groupId>cn.iocoder.boot</groupId>
  8 + <version>${revision}</version>
  9 + </parent>
  10 + <modelVersion>4.0.0</modelVersion>
  11 +
  12 + <artifactId>yudao-module-bpm-core-service-impl</artifactId>
  13 + <dependencies>
  14 + <dependency>
  15 + <groupId>cn.iocoder.boot</groupId>
  16 + <artifactId>yudao-spring-boot-starter-web</artifactId>
  17 + </dependency>
  18 + <dependency>
  19 + <groupId>cn.iocoder.boot</groupId>
  20 + <artifactId>yudao-spring-boot-starter-security</artifactId>
  21 + </dependency>
  22 + <dependency>
  23 + <groupId>cn.iocoder.boot</groupId>
  24 + <artifactId>yudao-spring-boot-starter-mybatis</artifactId>
  25 + </dependency>
  26 + <dependency>
  27 + <groupId>cn.iocoder.boot</groupId>
  28 + <artifactId>yudao-module-bpm-core-service-api</artifactId>
  29 + </dependency>
  30 + <dependency>
  31 + <groupId>cn.iocoder.boot</groupId>
  32 + <artifactId>yudao-spring-boot-starter-test</artifactId>
  33 + </dependency>
  34 + </dependencies>
  35 +</project>
0 36 \ No newline at end of file
... ...
yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/api/BpmUserGroupServiceApiImpl.java 0 → 100644
  1 +package cn.iocoder.yudao.adminserver.modules.bpm.api;
  2 +
  3 +import cn.hutool.core.collection.CollUtil;
  4 +import cn.iocoder.yudao.adminserver.modules.bpm.convert.definition.BpmUserGroupConvert;
  5 +import cn.iocoder.yudao.adminserver.modules.bpm.dal.dataobject.definition.BpmUserGroupDO;
  6 +import cn.iocoder.yudao.adminserver.modules.bpm.dal.mysql.definition.BpmUserGroupMapper;
  7 +import cn.iocoder.yudao.coreservice.modules.bpm.api.group.BpmUserGroupServiceApi;
  8 +import cn.iocoder.yudao.coreservice.modules.bpm.api.group.dto.BpmUserGroupDTO;
  9 +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
  10 +import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil;
  11 +import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
  12 +import org.springframework.stereotype.Service;
  13 +
  14 +import javax.annotation.Resource;
  15 +import java.util.Collection;
  16 +import java.util.List;
  17 +import java.util.Map;
  18 +import java.util.Set;
  19 +
  20 +import static cn.iocoder.yudao.adminserver.modules.bpm.enums.BpmErrorCodeConstants.USER_GROUP_IS_DISABLE;
  21 +import static cn.iocoder.yudao.adminserver.modules.bpm.enums.BpmErrorCodeConstants.USER_GROUP_NOT_EXISTS;
  22 +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
  23 +
  24 +/**
  25 + * Bpm 用户组 API 接口 实现类
  26 + *
  27 + * @author jason
  28 + */
  29 +@Service
  30 +public class BpmUserGroupServiceApiImpl implements BpmUserGroupServiceApi {
  31 +
  32 + @Resource
  33 + private BpmUserGroupMapper userGroupMapper;
  34 +
  35 + @Override
  36 + public List<BpmUserGroupDTO> getUserGroupList(Collection<Long> ids) {
  37 + return BpmUserGroupConvert.INSTANCE.convertList3(userGroupMapper.selectBatchIds(ids));
  38 + }
  39 +
  40 +
  41 + @Override
  42 + public void validUserGroups(Set<Long> ids) {
  43 +
  44 + if (CollUtil.isEmpty(ids)) {
  45 + return;
  46 + }
  47 + // 获得用户组信息
  48 + List<BpmUserGroupDO> userGroups = userGroupMapper.selectBatchIds(ids);
  49 + Map<Long, BpmUserGroupDO> userGroupMap = CollectionUtils.convertMap(userGroups, BpmUserGroupDO::getId);
  50 + // 校验
  51 + ids.forEach(id -> {
  52 + BpmUserGroupDO userGroup = userGroupMap.get(id);
  53 + if (userGroup == null) {
  54 + throw ServiceExceptionUtil.exception(USER_GROUP_NOT_EXISTS);
  55 + }
  56 + if (!CommonStatusEnum.ENABLE.getStatus().equals(userGroup.getStatus())) {
  57 + throw exception(USER_GROUP_IS_DISABLE, userGroup.getName());
  58 + }
  59 + });
  60 + }
  61 +}
... ...
yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/definition/BpmUserGroupController.java renamed to yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/definition/BpmUserGroupController.java
yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/definition/vo/group/BpmUserGroupBaseVO.java renamed to yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/definition/vo/group/BpmUserGroupBaseVO.java
yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/definition/vo/group/BpmUserGroupCreateReqVO.java renamed to yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/definition/vo/group/BpmUserGroupCreateReqVO.java
yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/definition/vo/group/BpmUserGroupPageReqVO.java renamed to yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/definition/vo/group/BpmUserGroupPageReqVO.java
1 1 package cn.iocoder.yudao.adminserver.modules.bpm.controller.definition.vo.group;
2 2  
3   -import lombok.*;
4   -import java.util.*;
5   -import io.swagger.annotations.*;
6 3 import cn.iocoder.yudao.framework.common.pojo.PageParam;
  4 +import cn.iocoder.yudao.framework.common.util.date.DateUtils;
  5 +import io.swagger.annotations.ApiModel;
  6 +import io.swagger.annotations.ApiModelProperty;
  7 +import lombok.Data;
  8 +import lombok.EqualsAndHashCode;
  9 +import lombok.ToString;
7 10 import org.springframework.format.annotation.DateTimeFormat;
8 11  
9   -import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
  12 +import java.util.Date;
10 13  
11 14 @ApiModel("用户组分页 Request VO")
12 15 @Data
... ... @@ -20,11 +23,11 @@ public class BpmUserGroupPageReqVO extends PageParam {
20 23 @ApiModelProperty(value = "状态", example = "1")
21 24 private Integer status;
22 25  
23   - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
  26 + @DateTimeFormat(pattern = DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
24 27 @ApiModelProperty(value = "开始创建时间")
25 28 private Date beginCreateTime;
26 29  
27   - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
  30 + @DateTimeFormat(pattern = DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
28 31 @ApiModelProperty(value = "结束创建时间")
29 32 private Date endCreateTime;
30 33  
... ...
yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/definition/vo/group/BpmUserGroupRespVO.java renamed to yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/definition/vo/group/BpmUserGroupRespVO.java
yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/definition/vo/group/BpmUserGroupSimpleRespVO.java renamed to yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/definition/vo/group/BpmUserGroupSimpleRespVO.java
yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/definition/vo/group/BpmUserGroupUpdateReqVO.java renamed to yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/definition/vo/group/BpmUserGroupUpdateReqVO.java
yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/convert/definition/BpmUserGroupConvert.java renamed to yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/convert/definition/BpmUserGroupConvert.java
... ... @@ -6,6 +6,7 @@ import cn.iocoder.yudao.adminserver.modules.bpm.controller.definition.vo.group.B
6 6 import cn.iocoder.yudao.adminserver.modules.bpm.controller.definition.vo.group.BpmUserGroupRespVO;
7 7 import cn.iocoder.yudao.adminserver.modules.bpm.controller.definition.vo.group.BpmUserGroupUpdateReqVO;
8 8 import cn.iocoder.yudao.adminserver.modules.bpm.dal.dataobject.definition.BpmUserGroupDO;
  9 +import cn.iocoder.yudao.coreservice.modules.bpm.api.group.dto.BpmUserGroupDTO;
9 10 import cn.iocoder.yudao.framework.common.pojo.PageResult;
10 11  
11 12 import org.mapstruct.Mapper;
... ... @@ -34,4 +35,6 @@ public interface BpmUserGroupConvert {
34 35  
35 36 @Named("convertList2")
36 37 List<BpmUserGroupRespVO> convertList2(List<BpmUserGroupDO> list);
  38 +
  39 + List<BpmUserGroupDTO> convertList3(List<BpmUserGroupDO> list);
37 40 }
... ...
yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/dal/dataobject/definition/BpmUserGroupDO.java renamed to yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/dal/dataobject/definition/BpmUserGroupDO.java
yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/dal/mysql/definition/BpmUserGroupMapper.java renamed to yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/dal/mysql/definition/BpmUserGroupMapper.java
yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/enums/BpmErrorCodeConstants.java 0 → 100644
  1 +package cn.iocoder.yudao.adminserver.modules.bpm.enums;
  2 +
  3 +import cn.iocoder.yudao.framework.common.exception.ErrorCode;
  4 +
  5 +public interface BpmErrorCodeConstants {
  6 + // ========== 用户组模块 1-009-011-000 ==========
  7 + ErrorCode USER_GROUP_NOT_EXISTS = new ErrorCode(1009011000, "用户组不存在");
  8 + ErrorCode USER_GROUP_IS_DISABLE = new ErrorCode(1009011001, "名字为【{}】的用户组已被禁用");
  9 +
  10 +}
... ...
yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/definition/BpmUserGroupService.java renamed to yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/definition/BpmUserGroupService.java
... ... @@ -47,14 +47,6 @@ public interface BpmUserGroupService {
47 47 BpmUserGroupDO getUserGroup(Long id);
48 48  
49 49 /**
50   - * 获得用户组列表
51   - *
52   - * @param ids 编号
53   - * @return 用户组列表
54   - */
55   - List<BpmUserGroupDO> getUserGroupList(Collection<Long> ids);
56   -
57   - /**
58 50 * 获得指定状态的用户组列表
59 51 *
60 52 * @param status 状态
... ... @@ -69,14 +61,4 @@ public interface BpmUserGroupService {
69 61 * @return 用户组分页
70 62 */
71 63 PageResult<BpmUserGroupDO> getUserGroupPage(BpmUserGroupPageReqVO pageReqVO);
72   -
73   - /**
74   - * 校验用户组们是否有效。如下情况,视为无效:
75   - * 1. 用户组编号不存在
76   - * 2. 用户组被禁用
77   - *
78   - * @param ids 用户组编号数组
79   - */
80   - void validUserGroups(Set<Long> ids);
81   -
82 64 }
... ...
yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/definition/impl/BpmUserGroupServiceImpl.java renamed to yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/definition/impl/BpmUserGroupServiceImpl.java
... ... @@ -9,6 +9,7 @@ import cn.iocoder.yudao.adminserver.modules.bpm.dal.dataobject.definition.BpmUse
9 9 import cn.iocoder.yudao.adminserver.modules.bpm.dal.mysql.definition.BpmUserGroupMapper;
10 10 import cn.iocoder.yudao.adminserver.modules.bpm.service.definition.BpmUserGroupService;
11 11 import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
  12 +import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil;
12 13 import cn.iocoder.yudao.framework.common.pojo.PageResult;
13 14 import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
14 15 import org.springframework.stereotype.Service;
... ... @@ -64,7 +65,7 @@ public class BpmUserGroupServiceImpl implements BpmUserGroupService {
64 65  
65 66 private void validateUserGroupExists(Long id) {
66 67 if (userGroupMapper.selectById(id) == null) {
67   - throw exception(USER_GROUP_NOT_EXISTS);
  68 + throw ServiceExceptionUtil.exception(USER_GROUP_NOT_EXISTS);
68 69 }
69 70 }
70 71  
... ... @@ -73,10 +74,6 @@ public class BpmUserGroupServiceImpl implements BpmUserGroupService {
73 74 return userGroupMapper.selectById(id);
74 75 }
75 76  
76   - @Override
77   - public List<BpmUserGroupDO> getUserGroupList(Collection<Long> ids) {
78   - return userGroupMapper.selectBatchIds(ids);
79   - }
80 77  
81 78 @Override
82 79 public List<BpmUserGroupDO> getUserGroupListByStatus(Integer status) {
... ... @@ -88,24 +85,4 @@ public class BpmUserGroupServiceImpl implements BpmUserGroupService {
88 85 return userGroupMapper.selectPage(pageReqVO);
89 86 }
90 87  
91   - @Override
92   - public void validUserGroups(Set<Long> ids) {
93   - if (CollUtil.isEmpty(ids)) {
94   - return;
95   - }
96   - // 获得用户组信息
97   - List<BpmUserGroupDO> userGroups = userGroupMapper.selectBatchIds(ids);
98   - Map<Long, BpmUserGroupDO> userGroupMap = CollectionUtils.convertMap(userGroups, BpmUserGroupDO::getId);
99   - // 校验
100   - ids.forEach(id -> {
101   - BpmUserGroupDO userGroup = userGroupMap.get(id);
102   - if (userGroup == null) {
103   - throw exception(USER_GROUP_NOT_EXISTS);
104   - }
105   - if (!CommonStatusEnum.ENABLE.getStatus().equals(userGroup.getStatus())) {
106   - throw exception(USER_GROUP_IS_DISABLE, userGroup.getName());
107   - }
108   - });
109   - }
110   -
111 88 }
... ...
yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl/src/test/java/cn/iocoder/yudao/adminserver/BaseDbUnitTest.java 0 → 100644
  1 +package cn.iocoder.yudao.adminserver;
  2 +
  3 +import cn.iocoder.yudao.framework.datasource.config.YudaoDataSourceAutoConfiguration;
  4 +import cn.iocoder.yudao.framework.mybatis.config.YudaoMybatisAutoConfiguration;
  5 +import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure;
  6 +import com.baomidou.mybatisplus.autoconfigure.MybatisPlusAutoConfiguration;
  7 +import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
  8 +import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration;
  9 +import org.springframework.boot.test.context.SpringBootTest;
  10 +import org.springframework.context.annotation.Import;
  11 +import org.springframework.test.context.ActiveProfiles;
  12 +import org.springframework.test.context.jdbc.Sql;
  13 +
  14 +/**
  15 + * 依赖内存 DB 的单元测试
  16 + *
  17 + * 注意,Service 层同样适用。对于 Service 层的单元测试,我们针对自己模块的 Mapper 走的是 H2 内存数据库,针对别的模块的 Service 走的是 Mock 方法
  18 + *
  19 + * @author 芋道源码
  20 + */
  21 +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE, classes = BaseDbUnitTest.Application.class)
  22 +@ActiveProfiles("unit-test") // 设置使用 application-unit-test 配置文件
  23 +@Sql(scripts = "/sql/clean.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD) // 每个单元测试结束后,清理 DB
  24 +public class BaseDbUnitTest {
  25 +
  26 + @Import({
  27 + // DB 配置类
  28 + YudaoDataSourceAutoConfiguration.class, // 自己的 DB 配置类
  29 + DataSourceAutoConfiguration.class, // Spring DB 自动配置类
  30 + DataSourceTransactionManagerAutoConfiguration.class, // Spring 事务自动配置类
  31 + DruidDataSourceAutoConfigure.class, // Druid 自动配置类
  32 + // MyBatis 配置类
  33 + YudaoMybatisAutoConfiguration.class, // 自己的 MyBatis 配置类
  34 + MybatisPlusAutoConfiguration.class, // MyBatis 的自动配置类
  35 + })
  36 + public static class Application {
  37 + }
  38 +
  39 +}
... ...
yudao-module-bpm/yudao-module-bpm-activiti/src/test/java/cn/iocoder/yudao/adminserver/modules/bpm/service/definition/BpmUserGroupServiceTest.java renamed to yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl/src/test/java/cn/iocoder/yudao/adminserver/modules/bpm/service/definition/BpmUserGroupServiceTest.java
1 1 package cn.iocoder.yudao.adminserver.modules.bpm.service.definition;
2 2  
3   -import cn.hutool.core.date.DateUtil;
4 3 import cn.iocoder.yudao.adminserver.BaseDbUnitTest;
5 4 import cn.iocoder.yudao.adminserver.modules.bpm.controller.definition.vo.group.BpmUserGroupCreateReqVO;
6 5 import cn.iocoder.yudao.adminserver.modules.bpm.controller.definition.vo.group.BpmUserGroupPageReqVO;
... ... @@ -11,6 +10,9 @@ import cn.iocoder.yudao.adminserver.modules.bpm.service.definition.impl.BpmUserG
11 10 import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
12 11 import cn.iocoder.yudao.framework.common.pojo.PageResult;
13 12 import cn.iocoder.yudao.framework.common.util.date.DateUtils;
  13 +import cn.iocoder.yudao.framework.test.core.util.AssertUtils;
  14 +import cn.iocoder.yudao.framework.test.core.util.RandomUtils;
  15 +import org.junit.jupiter.api.Assertions;
14 16 import org.junit.jupiter.api.Test;
15 17 import org.springframework.context.annotation.Import;
16 18  
... ... @@ -18,11 +20,6 @@ import javax.annotation.Resource;
18 20  
19 21 import static cn.iocoder.yudao.adminserver.modules.bpm.enums.BpmErrorCodeConstants.USER_GROUP_NOT_EXISTS;
20 22 import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId;
21   -import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
22   -import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException;
23   -import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomLongId;
24   -import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo;
25   -import static org.junit.jupiter.api.Assertions.*;
26 23  
27 24 /**
28 25 * {@link BpmUserGroupServiceImpl} 的单元测试类
... ... @@ -41,24 +38,24 @@ public class BpmUserGroupServiceTest extends BaseDbUnitTest {
41 38 @Test
42 39 public void testCreateUserGroup_success() {
43 40 // 准备参数
44   - BpmUserGroupCreateReqVO reqVO = randomPojo(BpmUserGroupCreateReqVO.class);
  41 + BpmUserGroupCreateReqVO reqVO = RandomUtils.randomPojo(BpmUserGroupCreateReqVO.class);
45 42  
46 43 // 调用
47 44 Long userGroupId = userGroupService.createUserGroup(reqVO);
48 45 // 断言
49   - assertNotNull(userGroupId);
  46 + Assertions.assertNotNull(userGroupId);
50 47 // 校验记录的属性是否正确
51 48 BpmUserGroupDO userGroup = userGroupMapper.selectById(userGroupId);
52   - assertPojoEquals(reqVO, userGroup);
  49 + AssertUtils.assertPojoEquals(reqVO, userGroup);
53 50 }
54 51  
55 52 @Test
56 53 public void testUpdateUserGroup_success() {
57 54 // mock 数据
58   - BpmUserGroupDO dbUserGroup = randomPojo(BpmUserGroupDO.class);
  55 + BpmUserGroupDO dbUserGroup = RandomUtils.randomPojo(BpmUserGroupDO.class);
59 56 userGroupMapper.insert(dbUserGroup);// @Sql: 先插入出一条存在的数据
60 57 // 准备参数
61   - BpmUserGroupUpdateReqVO reqVO = randomPojo(BpmUserGroupUpdateReqVO.class, o -> {
  58 + BpmUserGroupUpdateReqVO reqVO = RandomUtils.randomPojo(BpmUserGroupUpdateReqVO.class, o -> {
62 59 o.setId(dbUserGroup.getId()); // 设置更新的 ID
63 60 });
64 61  
... ... @@ -66,22 +63,22 @@ public class BpmUserGroupServiceTest extends BaseDbUnitTest {
66 63 userGroupService.updateUserGroup(reqVO);
67 64 // 校验是否更新正确
68 65 BpmUserGroupDO userGroup = userGroupMapper.selectById(reqVO.getId()); // 获取最新的
69   - assertPojoEquals(reqVO, userGroup);
  66 + AssertUtils.assertPojoEquals(reqVO, userGroup);
70 67 }
71 68  
72 69 @Test
73 70 public void testUpdateUserGroup_notExists() {
74 71 // 准备参数
75   - BpmUserGroupUpdateReqVO reqVO = randomPojo(BpmUserGroupUpdateReqVO.class);
  72 + BpmUserGroupUpdateReqVO reqVO = RandomUtils.randomPojo(BpmUserGroupUpdateReqVO.class);
76 73  
77 74 // 调用, 并断言异常
78   - assertServiceException(() -> userGroupService.updateUserGroup(reqVO), USER_GROUP_NOT_EXISTS);
  75 + AssertUtils.assertServiceException(() -> userGroupService.updateUserGroup(reqVO), USER_GROUP_NOT_EXISTS);
79 76 }
80 77  
81 78 @Test
82 79 public void testDeleteUserGroup_success() {
83 80 // mock 数据
84   - BpmUserGroupDO dbUserGroup = randomPojo(BpmUserGroupDO.class);
  81 + BpmUserGroupDO dbUserGroup = RandomUtils.randomPojo(BpmUserGroupDO.class);
85 82 userGroupMapper.insert(dbUserGroup);// @Sql: 先插入出一条存在的数据
86 83 // 准备参数
87 84 Long id = dbUserGroup.getId();
... ... @@ -89,22 +86,22 @@ public class BpmUserGroupServiceTest extends BaseDbUnitTest {
89 86 // 调用
90 87 userGroupService.deleteUserGroup(id);
91 88 // 校验数据不存在了
92   - assertNull(userGroupMapper.selectById(id));
  89 + Assertions.assertNull(userGroupMapper.selectById(id));
93 90 }
94 91  
95 92 @Test
96 93 public void testDeleteUserGroup_notExists() {
97 94 // 准备参数
98   - Long id = randomLongId();
  95 + Long id = RandomUtils.randomLongId();
99 96  
100 97 // 调用, 并断言异常
101   - assertServiceException(() -> userGroupService.deleteUserGroup(id), USER_GROUP_NOT_EXISTS);
  98 + AssertUtils.assertServiceException(() -> userGroupService.deleteUserGroup(id), USER_GROUP_NOT_EXISTS);
102 99 }
103 100  
104 101 @Test
105 102 public void testGetUserGroupPage() {
106 103 // mock 数据
107   - BpmUserGroupDO dbUserGroup = randomPojo(BpmUserGroupDO.class, o -> { // 等会查询到
  104 + BpmUserGroupDO dbUserGroup = RandomUtils.randomPojo(BpmUserGroupDO.class, o -> { // 等会查询到
108 105 o.setName("芋道源码");
109 106 o.setStatus(CommonStatusEnum.ENABLE.getStatus());
110 107 o.setCreateTime(DateUtils.buildTime(2021, 11, 11));
... ... @@ -126,9 +123,9 @@ public class BpmUserGroupServiceTest extends BaseDbUnitTest {
126 123 // 调用
127 124 PageResult<BpmUserGroupDO> pageResult = userGroupService.getUserGroupPage(reqVO);
128 125 // 断言
129   - assertEquals(1, pageResult.getTotal());
130   - assertEquals(1, pageResult.getList().size());
131   - assertPojoEquals(dbUserGroup, pageResult.getList().get(0));
  126 + Assertions.assertEquals(1, pageResult.getTotal());
  127 + Assertions.assertEquals(1, pageResult.getList().size());
  128 + AssertUtils.assertPojoEquals(dbUserGroup, pageResult.getList().get(0));
132 129 }
133 130  
134 131 }
... ...
yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl/src/test/resources/application-unit-test.yaml 0 → 100644
  1 +spring:
  2 + main:
  3 + lazy-initialization: true # 开启懒加载,加快速度
  4 + banner-mode: off # 单元测试,禁用 Banner
  5 +
  6 +--- #################### 数据库相关配置 ####################
  7 +
  8 +spring:
  9 + # 数据源配置项
  10 + datasource:
  11 + name: ruoyi-vue-pro
  12 + url: jdbc:h2:mem:testdb;MODE=MYSQL;DATABASE_TO_UPPER=false; # MODE 使用 MySQL 模式;DATABASE_TO_UPPER 配置表和字段使用小写
  13 + driver-class-name: org.h2.Driver
  14 + username: sa
  15 + password:
  16 + schema: classpath:sql/create_tables.sql # MySQL 转 H2 的语句,使用 https://www.jooq.org/translate/ 工具
  17 + druid:
  18 + async-init: true # 单元测试,异步初始化 Druid 连接池,提升启动速度
  19 + initial-size: 1 # 单元测试,配置为 1,提升启动速度
  20 +
  21 +mybatis:
  22 + lazy-initialization: true # 单元测试,设置 MyBatis Mapper 延迟加载,加速每个单元测试
  23 +
  24 +--- #################### 定时任务相关配置 ####################
  25 +
  26 +--- #################### 配置中心相关配置 ####################
  27 +
  28 +--- #################### 服务保障相关配置 ####################
  29 +
  30 +# Lock4j 配置项(单元测试,禁用 Lock4j)
  31 +
  32 +# Resilience4j 配置项
  33 +
  34 +--- #################### 监控相关配置 ####################
  35 +
  36 +--- #################### 芋道相关配置 ####################
  37 +
  38 +# 芋道配置项,设置当前项目所有自定义的配置
... ...
yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl/src/test/resources/application.yaml 0 → 100644
  1 +spring:
  2 + application:
  3 + name: yudao-module-bpm-service
  4 +
  5 + # Jackson 配置项
  6 + jackson:
  7 + serialization:
  8 + write-dates-as-timestamps: true # 设置 Date 的格式,使用时间戳
  9 + write-date-timestamps-as-nanoseconds: false # 设置不使用 nanoseconds 的格式。例如说 1611460870.401,而是直接 1611460870401
  10 + write-durations-as-timestamps: true # 设置 Duration 的格式,使用时间戳
  11 + fail-on-empty-beans: false # 允许序列化无属性的 Bean
  12 +
  13 +# MyBatis Plus 的配置项
  14 +mybatis-plus:
  15 + configuration:
  16 + map-underscore-to-camel-case: true # 虽然默认为 true ,但是还是显示去指定下。
  17 + log-impl: org.apache.ibatis.logging.stdout.StdOutImpl # 打印日志
  18 + global-config:
  19 + db-config:
  20 + id-type: AUTO # 自增 ID
  21 + logic-delete-value: 1 # 逻辑已删除值(默认为 1)
  22 + logic-not-delete-value: 0 # 逻辑未删除值(默认为 0)
  23 + mapper-locations: classpath*:mapper/*.xml
  24 + type-aliases-package: ${yudao.core-service.base-package}.modules.*.dal.dataobject
  25 +
  26 +--- #################### 芋道相关配置 ####################
  27 +
  28 +yudao:
  29 + info:
  30 + version: 1.0.0
  31 + base-package: cn.iocoder.yudao.adminserver
  32 + core-service:
  33 + base-package: cn.iocoder.yudao.coreservice
  34 +
  35 +debug: false
... ...
yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl/src/test/resources/logback-spring.xml 0 → 100644
  1 +<configuration>
  2 + <!-- 引用 Spring Boot 的 logback 基础配置 -->
  3 + <include resource="org/springframework/boot/logging/logback/defaults.xml" />
  4 +</configuration>
... ...
yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl/src/test/resources/sql/clean.sql 0 → 100644
  1 +-- bpm 开头的 DB
  2 +DELETE FROM "bpm_user_group";
... ...
yudao-module-bpm/yudao-module-bpm-core-service/yudao-module-bpm-core-service-impl/src/test/resources/sql/create_tables.sql 0 → 100644
  1 +-- bpm 开头的 DB
  2 +CREATE TABLE IF NOT EXISTS "bpm_user_group" (
  3 + "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
  4 + "name" varchar(63) NOT NULL,
  5 + "description" varchar(255) NOT NULL,
  6 + "status" tinyint NOT NULL,
  7 + "member_user_ids" varchar(255) NOT NULL,
  8 + "creator" varchar(64) DEFAULT '',
  9 + "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  10 + "updater" varchar(64) DEFAULT '',
  11 + "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  12 + "deleted" bit NOT NULL DEFAULT FALSE,
  13 + PRIMARY KEY ("id")
  14 + ) COMMENT '用户组';
... ...