Merge remote-tracking branch 'origin/5.X' into 5.X
# Conflicts:
# pom.xml
# ruoyi-admin/src/main/resources/application-dev.yml
# ruoyi-admin/src/main/resources/application.yml
已添加77个文件
已复制1个文件
已重命名8个文件
已删除103个文件
已修改191个文件
| | |
| | | <configuration default="false" name="ruoyi-monitor-admin" type="docker-deploy" factoryName="dockerfile" server-name="Docker"> |
| | | <deployment type="dockerfile"> |
| | | <settings> |
| | | <option name="imageTag" value="ruoyi/ruoyi-monitor-admin:5.2.2" /> |
| | | <option name="imageTag" value="ruoyi/ruoyi-monitor-admin:5.3.0" /> |
| | | <option name="buildOnly" value="true" /> |
| | | <option name="sourceFilePath" value="ruoyi-extend/ruoyi-monitor-admin/Dockerfile" /> |
| | | </settings> |
| | |
| | | <component name="ProjectRunConfigurationManager"> |
| | | <configuration default="false" name="ruoyi-server" type="docker-deploy" factoryName="dockerfile" server-name="æ¼ç¤ºæº"> |
| | | <configuration default="false" name="ruoyi-server" type="docker-deploy" factoryName="dockerfile" server-name="Docker"> |
| | | <deployment type="dockerfile"> |
| | | <settings> |
| | | <option name="imageTag" value="ruoyi/ruoyi-server:5.2.2" /> |
| | | <option name="imageTag" value="ruoyi/ruoyi-server:5.3.0" /> |
| | | <option name="buildOnly" value="true" /> |
| | | <option name="sourceFilePath" value="ruoyi-admin/Dockerfile" /> |
| | | </settings> |
| | | </deployment> |
| | | <method v="2" /> |
| | | </configuration> |
| | | </component> |
| | | </component> |
| | |
| | | <configuration default="false" name="ruoyi-snailjob-server" type="docker-deploy" factoryName="dockerfile" server-name="Docker"> |
| | | <deployment type="dockerfile"> |
| | | <settings> |
| | | <option name="imageTag" value="ruoyi/ruoyi-snailjob-server:5.2.2" /> |
| | | <option name="imageTag" value="ruoyi/ruoyi-snailjob-server:5.3.0" /> |
| | | <option name="buildOnly" value="true" /> |
| | | <option name="sourceFilePath" value="ruoyi-extend/ruoyi-snailjob-server/Dockerfile" /> |
| | | </settings> |
| | |
| | | |
| | | [](https://gitee.com/dromara/RuoYi-Vue-Plus) |
| | | [](https://github.com/dromara/RuoYi-Vue-Plus) |
| | | [](https://gitcode.com/dromara/RuoYi-Vue-Plus) |
| | | [](https://gitee.com/dromara/RuoYi-Vue-Plus/blob/master/LICENSE) |
| | | [](https://www.jetbrains.com/?from=RuoYi-Vue-Plus) |
| | | <br> |
| | | [](https://gitee.com/dromara/RuoYi-Vue-Plus) |
| | | []() |
| | | [](https://gitee.com/dromara/RuoYi-Vue-Plus) |
| | | []() |
| | | []() |
| | | []() |
| | | |
| | | > RuoYi-Vue-Plus æ¯éå RuoYi-Vue é对 `åå¸å¼é群ä¸å¤ç§æ·` åºæ¯å
¨æ¹ä½å级(ä¸å
¼å®¹åæ¡æ¶) |
| | | > Dromara RuoYi-Vue-Plus æ¯éå RuoYi-Vue é对 `åå¸å¼é群ä¸å¤ç§æ·` åºæ¯å
¨æ¹ä½å级(ä¸å
¼å®¹åæ¡æ¶) |
| | | |
| | | > 项ç®ä»£ç ãææ¡£ å弿ºå
è´¹å¯åç¨ éµå¾ªå¼æºåè®®å¨é¡¹ç®ä¸ä¿ç弿ºåè®®æä»¶å³å¯<br> |
| | | æ´»å°èåå°è 为å
´è¶£è弿º 为å¦ä¹ è弿º ä¸ºè®©å¤§å®¶çæ£å¯ä»¥å¦å°ææ¯è弿º |
| | | |
| | | > ç³»ç»æ¼ç¤º: [ä¼ éé¨](https://plus-doc.dromara.org/#/common/demo_system) |
| | | |
| | | > å端项ç®å°å: [plus-ui](https://gitee.com/JavaLionLi/plus-ui) |
| | | > 宿¹å端项ç®å°å: [plus-ui](https://gitee.com/JavaLionLi/plus-ui)<br> |
| | | > æåå端项ç®å°å: åºäºvben5 [ruoyi-plus-vben5](https://gitee.com/dapppp/ruoyi-plus-vben5) |
| | | |
| | | > ææ¡£å°å: [plus-doc](https://plus-doc.dromara.org) |
| | | |
| | |
| | | CCFlow é©°èä½ä»£ç -æµç¨-表å - https://gitee.com/opencc/RuoYi-JFlow <br> |
| | | æ°èµç§æ 软件å®å¶å¼åAPPå°ç¨åºç - http://www.shuduokeji.com/ <br> |
| | | å¼è¿ä¿¡æ¯ 软件å¼åå¹³å° - https://www.jnpfsoft.com/index.html?from=plus-doc <br> |
| | | <font color="red">**å¯å±±ååç³»ç» å¤ç§æ·ååæºç å¯å
è´¹åç¨å¯äºæ¬¡å¼å - https://www.73app.cn/** </font><br> |
| | | [å¦ä½æä¸ºèµå©å å 群èç³»ä½è
详è°](https://plus-doc.dromara.org/#/common/add_group) |
| | | |
| | | # æ¬æ¡æ¶ä¸RuoYiçåè½å·®å¼ |
| | |
| | | |  |  | |
| | | |  |  | |
| | | |  |  | |
| | | |  |  | |
| | | |  |  | |
| | | |  |  | |
| | | |  |  | |
| | | |  |  | |
| | | |
| | | |
| | |
| | | <description>å
°å®è½¦é´è´¨é管çç³»ç»</description> |
| | | |
| | | <properties> |
| | | <revision>5.2.2</revision> |
| | | <spring-boot.version>3.2.9</spring-boot.version> |
| | | <revision>5.3.0</revision> |
| | | <spring-boot.version>3.4.2</spring-boot.version> |
| | | <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
| | | <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> |
| | | <java.version>17</java.version> |
| | | <mybatis.version>3.5.16</mybatis.version> |
| | | <springdoc.version>2.6.0</springdoc.version> |
| | | <springdoc.version>2.8.4</springdoc.version> |
| | | <therapi-javadoc.version>0.15.0</therapi-javadoc.version> |
| | | <easyexcel.version>4.0.2</easyexcel.version> |
| | | <easyexcel.version>4.0.3</easyexcel.version> |
| | | <velocity.version>2.3</velocity.version> |
| | | <satoken.version>1.38.0</satoken.version> |
| | | <mybatis-plus.version>3.5.7</mybatis-plus.version> |
| | | <satoken.version>1.40.0</satoken.version> |
| | | <mybatis-plus.version>3.5.10</mybatis-plus.version> |
| | | <p6spy.version>3.9.1</p6spy.version> |
| | | <hutool.version>5.8.31</hutool.version> |
| | | <okhttp.version>4.10.0</okhttp.version> |
| | | <spring-boot-admin.version>3.2.3</spring-boot-admin.version> |
| | | <redisson.version>3.34.1</redisson.version> |
| | | <hutool.version>5.8.35</hutool.version> |
| | | <spring-boot-admin.version>3.4.1</spring-boot-admin.version> |
| | | <redisson.version>3.44.0</redisson.version> |
| | | <lock4j.version>2.2.7</lock4j.version> |
| | | <dynamic-ds.version>4.3.1</dynamic-ds.version> |
| | | <snailjob.version>1.1.2</snailjob.version> |
| | | <mapstruct-plus.version>1.4.4</mapstruct-plus.version> |
| | | <snailjob.version>1.3.0</snailjob.version> |
| | | <mapstruct-plus.version>1.4.6</mapstruct-plus.version> |
| | | <mapstruct-plus.lombok.version>0.2.0</mapstruct-plus.lombok.version> |
| | | <lombok.version>1.18.34</lombok.version> |
| | | <lombok.version>1.18.36</lombok.version> |
| | | <bouncycastle.version>1.76</bouncycastle.version> |
| | | <justauth.version>1.16.6</justauth.version> |
| | | <justauth.version>1.16.7</justauth.version> |
| | | <!-- 离线IPå°åå®ä½åº --> |
| | | <ip2region.version>2.7.0</ip2region.version> |
| | | <undertow.version>2.3.15.Final</undertow.version> |
| | | |
| | | <!-- OSS é
ç½® --> |
| | | <aws.sdk.version>2.25.15</aws.sdk.version> |
| | | <aws.crt.version>0.29.13</aws.crt.version> |
| | | <aws.sdk.version>2.28.22</aws.sdk.version> |
| | | <aws.crt.version>0.31.3</aws.crt.version> |
| | | <!-- SMS é
ç½® --> |
| | | <sms4j.version>3.3.2</sms4j.version> |
| | | <sms4j.version>3.3.3</sms4j.version> |
| | | <!-- éå¶æ¡æ¶ä¸çfastjsonçæ¬ --> |
| | | <fastjson.version>1.2.83</fastjson.version> |
| | | <!-- é¢åè¿è¡æ¶çD-ORMä¾èµ --> |
| | | <anyline.version>8.7.2-20240808</anyline.version> |
| | | <anyline.version>8.7.2-20250101</anyline.version> |
| | | <!--工使µé
ç½®--> |
| | | <flowable.version>7.0.1</flowable.version> |
| | | <warm-flow.version>1.6.6</warm-flow.version> |
| | | |
| | | <!-- æä»¶çæ¬ --> |
| | | <maven-jar-plugin.version>3.2.2</maven-jar-plugin.version> |
| | | <maven-war-plugin.version>3.2.2</maven-war-plugin.version> |
| | | <maven-compiler-plugin.verison>3.11.0</maven-compiler-plugin.verison> |
| | | <maven-compiler-plugin.version>3.11.0</maven-compiler-plugin.version> |
| | | <maven-surefire-plugin.version>3.1.2</maven-surefire-plugin.version> |
| | | <flatten-maven-plugin.version>1.3.0</flatten-maven-plugin.version> |
| | | </properties> |
| | |
| | | <!-- ç¯å¢æ è¯ï¼éè¦ä¸é
ç½®æä»¶çåç§°ç¸å¯¹åº --> |
| | | <profiles.active>local</profiles.active> |
| | | <logging.level>info</logging.level> |
| | | <monitor.username>ruoyi</monitor.username> |
| | | <monitor.password>123456</monitor.password> |
| | | </properties> |
| | | </profile> |
| | | <profile> |
| | |
| | | <!-- ç¯å¢æ è¯ï¼éè¦ä¸é
ç½®æä»¶çåç§°ç¸å¯¹åº --> |
| | | <profiles.active>dev</profiles.active> |
| | | <logging.level>info</logging.level> |
| | | <monitor.username>ruoyi</monitor.username> |
| | | <monitor.password>123456</monitor.password> |
| | | </properties> |
| | | <activation> |
| | | <!-- é»è®¤ç¯å¢ --> |
| | |
| | | <properties> |
| | | <profiles.active>prod</profiles.active> |
| | | <logging.level>warn</logging.level> |
| | | <monitor.username>ruoyi</monitor.username> |
| | | <monitor.password>123456</monitor.password> |
| | | </properties> |
| | | </profile> |
| | | </profiles> |
| | |
| | | <scope>import</scope> |
| | | </dependency> |
| | | |
| | | <!-- Warm-Flowå½äº§å·¥ä½æµå¼æ, å¨çº¿ææ¡£ï¼http://warm-flow.cn/ --> |
| | | <dependency> |
| | | <groupId>org.flowable</groupId> |
| | | <artifactId>flowable-bom</artifactId> |
| | | <version>${flowable.version}</version> |
| | | <type>pom</type> |
| | | <scope>import</scope> |
| | | <groupId>org.dromara.warm</groupId> |
| | | <artifactId>warm-flow-mybatis-plus-sb3-starter</artifactId> |
| | | <version>${warm-flow.version}</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.dromara.warm</groupId> |
| | | <artifactId>warm-flow-plugin-ui-sb-web</artifactId> |
| | | <version>${warm-flow.version}</version> |
| | | </dependency> |
| | | |
| | | <!-- JustAuth çä¾èµé
ç½®--> |
| | |
| | | |
| | | <dependency> |
| | | <groupId>com.baomidou</groupId> |
| | | <artifactId>mybatis-plus-jsqlparser</artifactId> |
| | | <version>${mybatis-plus.version}</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>com.baomidou</groupId> |
| | | <artifactId>mybatis-plus-annotation</artifactId> |
| | | <version>${mybatis-plus.version}</version> |
| | | </dependency> |
| | |
| | | <groupId>p6spy</groupId> |
| | | <artifactId>p6spy</artifactId> |
| | | <version>${p6spy.version}</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>com.squareup.okhttp3</groupId> |
| | | <artifactId>okhttp</artifactId> |
| | | <version>${okhttp.version}</version> |
| | | </dependency> |
| | | |
| | | <!-- AWS SDK for Java 2.x --> |
| | |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>io.undertow</groupId> |
| | | <artifactId>undertow-core</artifactId> |
| | | <version>${undertow.version}</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>io.undertow</groupId> |
| | | <artifactId>undertow-servlet</artifactId> |
| | | <version>${undertow.version}</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>io.undertow</groupId> |
| | | <artifactId>undertow-websockets-jsr</artifactId> |
| | | <version>${undertow.version}</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <artifactId>commons-compress</artifactId> |
| | | <groupId>org.apache.commons</groupId> |
| | | <version>1.26.2</version> |
| | | <groupId>commons-io</groupId> |
| | | <artifactId>commons-io</artifactId> |
| | | <version>2.15.0</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | |
| | | <plugin> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-compiler-plugin</artifactId> |
| | | <version>${maven-compiler-plugin.verison}</version> |
| | | <version>${maven-compiler-plugin.version}</version> |
| | | <configuration> |
| | | <source>${java.version}</source> |
| | | <target>${java.version}</target> |
| | |
| | | # è´å°å®éªå®¤ Spring 宿¹æ¨èéå JDKä¸è½½å°å https://bell-sw.com/pages/downloads/ |
| | | FROM bellsoft/liberica-openjdk-debian:17.0.11-cds |
| | | #FROM bellsoft/liberica-openjdk-debian:21.0.3-cds |
| | | #FROM bellsoft/liberica-openjdk-debian:21.0.5-cds |
| | | #FROM findepi/graalvm:java17-native |
| | | |
| | | LABEL maintainer="Lion Li" |
| | |
| | | EXPOSE ${SERVER_PORT} |
| | | |
| | | ADD ./target/ruoyi-admin.jar ./app.jar |
| | | # 工使µå使件 |
| | | ADD ./zhFonts/ /usr/share/fonts/zhFonts/ |
| | | |
| | | SHELL ["/bin/bash", "-c"] |
| | | |
| | | ENTRYPOINT java -Djava.security.egd=file:/dev/./urandom -Dserver.port=${SERVER_PORT} \ |
| | | # åºç¨åç§° 妿æ³åºåé群èç¹çæ§ æ¹æä¸åçåç§°å³å¯ |
| | |
| | | |
| | | import cn.dev33.satoken.annotation.SaIgnore; |
| | | import cn.dev33.satoken.exception.NotLoginException; |
| | | import cn.dev33.satoken.stp.StpUtil; |
| | | import cn.hutool.core.codec.Base64; |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | |
| | | import me.zhyd.oauth.model.AuthUser; |
| | | import me.zhyd.oauth.request.AuthRequest; |
| | | import me.zhyd.oauth.utils.AuthStateUtils; |
| | | import org.dromara.common.core.constant.UserConstants; |
| | | import org.dromara.common.core.constant.SystemConstants; |
| | | import org.dromara.common.core.domain.R; |
| | | import org.dromara.common.core.domain.model.LoginBody; |
| | | import org.dromara.common.core.domain.model.RegisterBody; |
| | |
| | | if (ObjectUtil.isNull(client) || !StringUtils.contains(client.getGrantType(), grantType)) { |
| | | log.info("客æ·ç«¯id: {} 认è¯ç±»åï¼{} å¼å¸¸!.", clientId, grantType); |
| | | return R.fail(MessageUtils.message("auth.grant.type.error")); |
| | | } else if (!UserConstants.NORMAL.equals(client.getStatus())) { |
| | | } else if (!SystemConstants.NORMAL.equals(client.getStatus())) { |
| | | return R.fail(MessageUtils.message("auth.grant.type.blocked")); |
| | | } |
| | | // æ ¡éªç§æ· |
| | |
| | | } |
| | | |
| | | /** |
| | | * ç¬¬ä¸æ¹ç»å½è¯·æ± |
| | | * è·å跳转URL |
| | | * |
| | | * @param source ç»å½æ¥æº |
| | | * @return ç»æ |
| | |
| | | } |
| | | |
| | | /** |
| | | * ç¬¬ä¸æ¹ç»å½åè°ä¸å¡å¤ç ç»å®ææ |
| | | * å端åè°ç»å®ææ(éè¦token) |
| | | * |
| | | * @param loginBody 请æ±ä½ |
| | | * @return ç»æ |
| | | */ |
| | | @PostMapping("/social/callback") |
| | | public R<Void> socialCallback(@RequestBody SocialLoginBody loginBody) { |
| | | // æ ¡éªtoken |
| | | StpUtil.checkLogin(); |
| | | // è·åç¬¬ä¸æ¹ç»å½ä¿¡æ¯ |
| | | AuthResponse<AuthUser> response = SocialUtils.loginAuth( |
| | | loginBody.getSource(), loginBody.getSocialCode(), |
| | |
| | | |
| | | |
| | | /** |
| | | * åæ¶ææ |
| | | * åæ¶ææ(éè¦token) |
| | | * |
| | | * @param socialId socialId |
| | | */ |
| | | @DeleteMapping(value = "/unlock/{socialId}") |
| | | public R<Void> unlockSocial(@PathVariable Long socialId) { |
| | | // æ ¡éªtoken |
| | | StpUtil.checkLogin(); |
| | | Boolean rows = socialUserService.deleteWithValidById(socialId); |
| | | return rows ? R.ok() : R.fail("åæ¶ææå¤±è´¥"); |
| | | } |
| | |
| | | } |
| | | // æ ¹æ®ååè¿è¡çé |
| | | List<TenantListVo> list = StreamUtils.filter(voList, vo -> |
| | | StringUtils.equals(vo.getDomain(), host)); |
| | | StringUtils.equalsIgnoreCase(vo.getDomain(), host)); |
| | | result.setVoList(CollUtil.isNotEmpty(list) ? list : voList); |
| | | return R.ok(result); |
| | | } |
| | |
| | | import me.zhyd.oauth.model.AuthUser; |
| | | import org.dromara.common.core.constant.CacheConstants; |
| | | import org.dromara.common.core.constant.Constants; |
| | | import org.dromara.common.core.constant.SystemConstants; |
| | | import org.dromara.common.core.constant.TenantConstants; |
| | | import org.dromara.common.core.domain.dto.PostDTO; |
| | | import org.dromara.common.core.domain.dto.RoleDTO; |
| | | import org.dromara.common.core.domain.model.LoginUser; |
| | | import org.dromara.common.core.enums.LoginType; |
| | | import org.dromara.common.core.enums.TenantStatus; |
| | | import org.dromara.common.core.exception.ServiceException; |
| | | import org.dromara.common.core.exception.user.UserException; |
| | | import org.dromara.common.core.utils.*; |
| | |
| | | private final ISysSocialService sysSocialService; |
| | | private final ISysRoleService roleService; |
| | | private final ISysDeptService deptService; |
| | | private final ISysPostService postService; |
| | | private final SysUserMapper userMapper; |
| | | |
| | | |
| | |
| | | */ |
| | | public LoginUser buildLoginUser(SysUserVo user) { |
| | | LoginUser loginUser = new LoginUser(); |
| | | Long userId = user.getUserId(); |
| | | loginUser.setTenantId(user.getTenantId()); |
| | | loginUser.setUserId(user.getUserId()); |
| | | loginUser.setUserId(userId); |
| | | loginUser.setDeptId(user.getDeptId()); |
| | | loginUser.setUsername(user.getUserName()); |
| | | loginUser.setNickname(user.getNickName()); |
| | | loginUser.setUserType(user.getUserType()); |
| | | loginUser.setMenuPermission(permissionService.getMenuPermission(user.getUserId())); |
| | | loginUser.setRolePermission(permissionService.getRolePermission(user.getUserId())); |
| | | loginUser.setMenuPermission(permissionService.getMenuPermission(userId)); |
| | | loginUser.setRolePermission(permissionService.getRolePermission(userId)); |
| | | if (ObjectUtil.isNotNull(user.getDeptId())) { |
| | | Opt<SysDeptVo> deptOpt = Opt.of(user.getDeptId()).map(deptService::selectDeptById); |
| | | loginUser.setDeptName(deptOpt.map(SysDeptVo::getDeptName).orElse(StringUtils.EMPTY)); |
| | | loginUser.setDeptCategory(deptOpt.map(SysDeptVo::getDeptCategory).orElse(StringUtils.EMPTY)); |
| | | } |
| | | List<SysRoleVo> roles = roleService.selectRolesByUserId(user.getUserId()); |
| | | List<SysRoleVo> roles = roleService.selectRolesByUserId(userId); |
| | | List<SysPostVo> posts = postService.selectPostsByUserId(userId); |
| | | loginUser.setRoles(BeanUtil.copyToList(roles, RoleDTO.class)); |
| | | loginUser.setPosts(BeanUtil.copyToList(posts, PostDTO.class)); |
| | | return loginUser; |
| | | } |
| | | |
| | |
| | | if (!TenantHelper.isEnable()) { |
| | | return; |
| | | } |
| | | if (TenantConstants.DEFAULT_TENANT_ID.equals(tenantId)) { |
| | | return; |
| | | } |
| | | if (StringUtils.isBlank(tenantId)) { |
| | | throw new TenantException("tenant.number.not.blank"); |
| | | } |
| | | if (TenantConstants.DEFAULT_TENANT_ID.equals(tenantId)) { |
| | | return; |
| | | } |
| | | SysTenantVo tenant = tenantService.queryByTenantId(tenantId); |
| | | if (ObjectUtil.isNull(tenant)) { |
| | | log.info("ç»å½ç§æ·ï¼{} ä¸åå¨.", tenantId); |
| | | throw new TenantException("tenant.not.exists"); |
| | | } else if (TenantStatus.DISABLE.getCode().equals(tenant.getStatus())) { |
| | | } else if (SystemConstants.DISABLE.equals(tenant.getStatus())) { |
| | | log.info("ç»å½ç§æ·ï¼{} 已被åç¨.", tenantId); |
| | | throw new TenantException("tenant.blocked"); |
| | | } else if (ObjectUtil.isNotNull(tenant.getExpireTime()) |
| | |
| | | String captcha = RedisUtils.getCacheObject(verifyKey); |
| | | RedisUtils.deleteObject(verifyKey); |
| | | if (captcha == null) { |
| | | recordLogininfor(tenantId, username, Constants.REGISTER, MessageUtils.message("user.jcaptcha.expire")); |
| | | recordLogininfor(tenantId, username, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.expire")); |
| | | throw new CaptchaExpireException(); |
| | | } |
| | | if (!code.equalsIgnoreCase(captcha)) { |
| | | recordLogininfor(tenantId, username, Constants.REGISTER, MessageUtils.message("user.jcaptcha.error")); |
| | | recordLogininfor(tenantId, username, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.error")); |
| | | throw new CaptchaException(); |
| | | } |
| | | } |
| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.dromara.common.core.constant.Constants; |
| | | import org.dromara.common.core.constant.GlobalConstants; |
| | | import org.dromara.common.core.constant.SystemConstants; |
| | | import org.dromara.common.core.domain.model.EmailLoginBody; |
| | | import org.dromara.common.core.domain.model.LoginUser; |
| | | import org.dromara.common.core.enums.LoginType; |
| | | import org.dromara.common.core.enums.UserStatus; |
| | | import org.dromara.common.core.exception.user.CaptchaExpireException; |
| | | import org.dromara.common.core.exception.user.UserException; |
| | | import org.dromara.common.core.utils.MessageUtils; |
| | |
| | | if (ObjectUtil.isNull(user)) { |
| | | log.info("ç»å½ç¨æ·ï¼{} ä¸åå¨.", email); |
| | | throw new UserException("user.not.exists", email); |
| | | } else if (UserStatus.DISABLE.getCode().equals(user.getStatus())) { |
| | | } else if (SystemConstants.DISABLE.equals(user.getStatus())) { |
| | | log.info("ç»å½ç¨æ·ï¼{} 已被åç¨.", email); |
| | | throw new UserException("user.blocked", email); |
| | | } |
| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.dromara.common.core.constant.Constants; |
| | | import org.dromara.common.core.constant.GlobalConstants; |
| | | import org.dromara.common.core.constant.SystemConstants; |
| | | import org.dromara.common.core.domain.model.LoginUser; |
| | | import org.dromara.common.core.domain.model.PasswordLoginBody; |
| | | import org.dromara.common.core.enums.LoginType; |
| | | import org.dromara.common.core.enums.UserStatus; |
| | | import org.dromara.common.core.exception.user.CaptchaException; |
| | | import org.dromara.common.core.exception.user.CaptchaExpireException; |
| | | import org.dromara.common.core.exception.user.UserException; |
| | |
| | | if (ObjectUtil.isNull(user)) { |
| | | log.info("ç»å½ç¨æ·ï¼{} ä¸åå¨.", username); |
| | | throw new UserException("user.not.exists", username); |
| | | } else if (UserStatus.DISABLE.getCode().equals(user.getStatus())) { |
| | | } else if (SystemConstants.DISABLE.equals(user.getStatus())) { |
| | | log.info("ç»å½ç¨æ·ï¼{} 已被åç¨.", username); |
| | | throw new UserException("user.blocked", username); |
| | | } |
| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.dromara.common.core.constant.Constants; |
| | | import org.dromara.common.core.constant.GlobalConstants; |
| | | import org.dromara.common.core.constant.SystemConstants; |
| | | import org.dromara.common.core.domain.model.LoginUser; |
| | | import org.dromara.common.core.domain.model.SmsLoginBody; |
| | | import org.dromara.common.core.enums.LoginType; |
| | | import org.dromara.common.core.enums.UserStatus; |
| | | import org.dromara.common.core.exception.user.CaptchaExpireException; |
| | | import org.dromara.common.core.exception.user.UserException; |
| | | import org.dromara.common.core.utils.MessageUtils; |
| | |
| | | if (ObjectUtil.isNull(user)) { |
| | | log.info("ç»å½ç¨æ·ï¼{} ä¸åå¨.", phonenumber); |
| | | throw new UserException("user.not.exists", phonenumber); |
| | | } else if (UserStatus.DISABLE.getCode().equals(user.getStatus())) { |
| | | } else if (SystemConstants.DISABLE.equals(user.getStatus())) { |
| | | log.info("ç»å½ç¨æ·ï¼{} 已被åç¨.", phonenumber); |
| | | throw new UserException("user.blocked", phonenumber); |
| | | } |
| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import me.zhyd.oauth.model.AuthResponse; |
| | | import me.zhyd.oauth.model.AuthUser; |
| | | import org.dromara.common.core.constant.SystemConstants; |
| | | import org.dromara.common.core.domain.model.LoginUser; |
| | | import org.dromara.common.core.domain.model.SocialLoginBody; |
| | | import org.dromara.common.core.enums.UserStatus; |
| | | import org.dromara.common.core.exception.ServiceException; |
| | | import org.dromara.common.core.exception.user.UserException; |
| | | import org.dromara.common.core.utils.StreamUtils; |
| | |
| | | if (ObjectUtil.isNull(user)) { |
| | | log.info("ç»å½ç¨æ·ï¼{} ä¸åå¨.", ""); |
| | | throw new UserException("user.not.exists", ""); |
| | | } else if (UserStatus.DISABLE.getCode().equals(user.getStatus())) { |
| | | } else if (SystemConstants.DISABLE.equals(user.getStatus())) { |
| | | log.info("ç»å½ç¨æ·ï¼{} 已被åç¨.", ""); |
| | | throw new UserException("user.blocked", ""); |
| | | } |
| | |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import me.zhyd.oauth.config.AuthConfig; |
| | | import me.zhyd.oauth.model.AuthCallback; |
| | | import me.zhyd.oauth.model.AuthResponse; |
| | | import me.zhyd.oauth.model.AuthToken; |
| | | import me.zhyd.oauth.model.AuthUser; |
| | | import me.zhyd.oauth.request.AuthRequest; |
| | | import me.zhyd.oauth.request.AuthWechatMiniProgramRequest; |
| | | import org.dromara.common.core.constant.SystemConstants; |
| | | import org.dromara.common.core.domain.model.XcxLoginBody; |
| | | import org.dromara.common.core.domain.model.XcxLoginUser; |
| | | import org.dromara.common.core.enums.UserStatus; |
| | | import org.dromara.common.core.exception.ServiceException; |
| | | import org.dromara.common.core.utils.ValidatorUtils; |
| | | import org.dromara.common.json.utils.JsonUtils; |
| | | import org.dromara.common.satoken.utils.LoginHelper; |
| | | import org.dromara.system.domain.SysClient; |
| | | import org.dromara.system.domain.vo.SysClientVo; |
| | | import org.dromara.system.domain.vo.SysUserVo; |
| | | import org.dromara.web.domain.vo.LoginVo; |
| | |
| | | // å¤ä¸ªå°ç¨åºè¯å«ä½¿ç¨ |
| | | String appid = loginBody.getAppid(); |
| | | |
| | | // todo 以ä¸èªè¡å®ç° |
| | | // æ ¡éª appid + appsrcret + xcxCode è°ç¨ç»å½åè¯æ ¡éªæ¥å£ è·å session_key ä¸ openid |
| | | String openid = ""; |
| | | AuthRequest authRequest = new AuthWechatMiniProgramRequest(AuthConfig.builder() |
| | | .clientId(appid).clientSecret("èªè¡å¡«åå¯é¥ 坿 ¹æ®ä¸åappidå¡«å
¥ä¸åå¯é¥") |
| | | .ignoreCheckRedirectUri(true).ignoreCheckState(true).build()); |
| | | AuthCallback authCallback = new AuthCallback(); |
| | | authCallback.setCode(xcxCode); |
| | | AuthResponse<AuthUser> resp = authRequest.login(authCallback); |
| | | String openid, unionId; |
| | | if (resp.ok()) { |
| | | AuthToken token = resp.getData().getToken(); |
| | | openid = token.getOpenId(); |
| | | // 微信å°ç¨åºåªæå
³èå°å¾®ä¿¡å¼æ¾å¹³å°ä¸ä¹åæè½è·åå° unionIdï¼å æ¤unionIdä¸ä¸å®è½è¿åã |
| | | unionId = token.getUnionId(); |
| | | } else { |
| | | throw new ServiceException(resp.getMsg()); |
| | | } |
| | | // æ¡æ¶ç»å½ä¸éå¶ä»ä»ä¹è¡¨æ¥è¯¢ åªè¦æç»æå»ºåº LoginUser å³å¯ |
| | | SysUserVo user = loadUserByOpenid(openid); |
| | | |
| | | // æ¤å¤å¯æ ¹æ®ç»å½ç¨æ·çæ°æ®ä¸å èªè¡å建 loginUser 屿§ä¸å¤ç¨ç»§æ¿æ©å±å°±è¡äº |
| | | XcxLoginUser loginUser = new XcxLoginUser(); |
| | | loginUser.setTenantId(user.getTenantId()); |
| | |
| | | if (ObjectUtil.isNull(user)) { |
| | | log.info("ç»å½ç¨æ·ï¼{} ä¸åå¨.", openid); |
| | | // todo ç¨æ·ä¸åå¨ ä¸å¡é»è¾èªè¡å®ç° |
| | | } else if (UserStatus.DISABLE.getCode().equals(user.getStatus())) { |
| | | } else if (SystemConstants.DISABLE.equals(user.getStatus())) { |
| | | log.info("ç»å½ç¨æ·ï¼{} 已被åç¨.", openid); |
| | | // todo ç¨æ·å·²è¢«åç¨ ä¸å¡é»è¾èªè¡å®ç° |
| | | } |
| | |
| | | metadata: |
| | | username: ${spring.boot.admin.client.username} |
| | | userpassword: ${spring.boot.admin.client.password} |
| | | username: ruoyi |
| | | password: 123456 |
| | | username: @monitor.username@ |
| | | password: @monitor.password@ |
| | | |
| | | --- # snail-job é
ç½® |
| | | snail-job: |
| | |
| | | namespace: ${spring.profiles.active} |
| | | # é主åºç¨ç«¯å£é£é¸ |
| | | port: 2${server.port} |
| | | # 客æ·ç«¯ipæå® |
| | | host: |
| | | # RPCç±»å: netty, grpc |
| | | rpc-type: grpc |
| | | |
| | | --- # æ°æ®æºé
ç½® |
| | | spring: |
| | |
| | | redirect-uri: ${justauth.address}/social-callback?source=maxkey |
| | | topiam: |
| | | # topiam æå¡å¨å°å |
| | | server-url: http://127.0.0.1:1989/api/v1/authorize/y0q************spq***********8ol |
| | | server-url: http://127.0.0.1:1898/api/v1/authorize/y0q************spq***********8ol |
| | | client-id: 449c4*********937************759 |
| | | client-secret: ac7***********1e0************28d |
| | | redirect-uri: ${justauth.address}/social-callback?source=topiam |
| | |
| | | metadata: |
| | | username: ${spring.boot.admin.client.username} |
| | | userpassword: ${spring.boot.admin.client.password} |
| | | username: ruoyi |
| | | password: 123456 |
| | | username: @monitor.username@ |
| | | password: @monitor.password@ |
| | | |
| | | --- # snail-job é
ç½® |
| | | snail-job: |
| | | enabled: true |
| | | # éè¦å¨ SnailJob åå°ç»ç®¡çå建对åºåç§°çç»,ç¶åå建任å¡çæ¶å鿩坹åºçç»,æè½æ£ç¡®åæ´¾ä»»å¡ |
| | | group: "ruoyi_group" |
| | | # SnailJob æ¥å
¥éªè¯ä»¤ç è¯¦è§ script/sql/snail_job.sql `sj_group_config` 表 |
| | | # SnailJob æ¥å
¥éªè¯ä»¤ç è¯¦è§ script/sql/ry_job.sql `sj_group_config`表 |
| | | token: "SJ_cKqBTPzCsWA3VyuCfFoccmuIEGXjr5KT" |
| | | server: |
| | | host: 127.0.0.1 |
| | | port: 17888 |
| | | # è¯¦è§ script/sql/snail_job.sql `sj_namespace` 表 |
| | | # å½å空é´UUID è¯¦è§ script/sql/ry_job.sql `sj_namespace`表`unique_id`åæ®µ |
| | | namespace: ${spring.profiles.active} |
| | | # é主åºç¨ç«¯å£é£é¸ |
| | | # é主åºç¨ç«¯å£æ¼ç§» |
| | | port: 2${server.port} |
| | | # 客æ·ç«¯ipæå® |
| | | host: |
| | | # RPCç±»å: netty, grpc |
| | | rpc-type: grpc |
| | | |
| | | --- # æ°æ®æºé
ç½® |
| | | spring: |
| | |
| | | url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true |
| | | username: root |
| | | password: root |
| | | # ä»åºæ°æ®æº |
| | | slave: |
| | | lazy: true |
| | | type: ${spring.datasource.type} |
| | | driverClassName: com.mysql.cj.jdbc.Driver |
| | | url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true |
| | | username: |
| | | password: |
| | | # # ä»åºæ°æ®æº |
| | | # slave: |
| | | # lazy: true |
| | | # type: ${spring.datasource.type} |
| | | # driverClassName: com.mysql.cj.jdbc.Driver |
| | | # url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true |
| | | # username: |
| | | # password: |
| | | # oracle: |
| | | # type: ${spring.datasource.type} |
| | | # driverClassName: oracle.jdbc.OracleDriver |
| | |
| | | # swagger ææ¡£é
ç½® |
| | | - /*/api-docs |
| | | - /*/api-docs/** |
| | | - /warm-flow-ui/token-name |
| | | |
| | | # å¤ç§æ·é
ç½® |
| | | tenant: |
| | |
| | | # MyBatisPlusé
ç½® |
| | | # https://baomidou.com/config/ |
| | | mybatis-plus: |
| | | # èªå®ä¹é
ç½® æ¯å¦å
¨å±å¼å¯é»è¾å é¤ å
³éå ææé»è¾å é¤åè½å°å¤±æ |
| | | enableLogicDelete: true |
| | | # å¤å
åä½¿ç¨ ä¾å¦ org.dromara.**.mapper,org.xxx.**.mapper |
| | | mapperPackage: org.dromara.**.mapper,cn.shlanbao.**.mapper |
| | | # 对åºç XML æä»¶ä½ç½® |
| | |
| | | packages-to-scan: org.dromara.system |
| | | - group: 4.代ç çææ¨¡å |
| | | packages-to-scan: org.dromara.generator |
| | | - group: 5.è´¨éæ¨¡å |
| | | - group: 5.工使µæ¨¡å |
| | | packages-to-scan: org.dromara.workflow |
| | | - group: 6.è´¨éæ¨¡å |
| | | packages-to-scan: cn.shlanbao.qms |
| | | |
| | | # 鲿¢XSSæ»å» |
| | |
| | | # è¿æ»¤å¼å
³ |
| | | enabled: true |
| | | # æé¤é¾æ¥ï¼å¤ä¸ªç¨éå·åéï¼ |
| | | excludes: /system/notice |
| | | # å¹é
龿¥ |
| | | urlPatterns: /system/*,/monitor/*,/tool/* |
| | | excludeUrls: |
| | | - /system/notice |
| | | - /warm-flow/save-xml |
| | | |
| | | # å
¨å±çº¿ç¨æ± ç¸å
³é
ç½® |
| | | # å¦ä½¿ç¨JDK21è¯·ç´æ¥ä½¿ç¨èæçº¿ç¨ ä¸è¦å¼å¯æ¤é
ç½® |
| | |
| | | # è®¾ç½®è®¿é®æºå°å |
| | | allowedOrigins: '*' |
| | | |
| | | --- #flowableé
ç½® |
| | | flowable: |
| | | # å¼å
³ ç¨äºå¯å¨/åç¨å·¥ä½æµ |
| | | --- # warm-flow工使µé
ç½® |
| | | warm-flow: |
| | | # æ¯å¦å¼å¯å·¥ä½æµï¼é»è®¤true |
| | | enabled: true |
| | | process.enabled: ${flowable.enabled} |
| | | eventregistry.enabled: ${flowable.enabled} |
| | | async-executor-activate: false #å
³é宿¶ä»»å¡JOB |
| | | # å°databaseSchemaUpdate设置为trueãå½Flowableåç°åºä¸æ°æ®åºè¡¨ç»æä¸ä¸è´æ¶ï¼ä¼èªå¨å°æ°æ®åºè¡¨ç»æåçº§è³æ°çæ¬ã |
| | | database-schema-update: true |
| | | activity-font-name: å®ä½ |
| | | label-font-name: å®ä½ |
| | | annotation-font-name: å®ä½ |
| | | # å
³éå个模åçæè¡¨ï¼ç®ååªä½¿ç¨å·¥ä½æµåºç¡è¡¨ |
| | | idm: |
| | | enabled: false |
| | | cmmn: |
| | | enabled: false |
| | | dmn: |
| | | enabled: false |
| | | app: |
| | | enabled: false |
| | | # æ¯å¦å¼å¯è®¾è®¡å¨ui |
| | | ui: true |
| | | # é»è®¤Authorizationï¼å¦ææå¤ä¸ªtokenï¼ç¨éå·åé |
| | | token-name: ${sa-token.token-name},clientid |
| | |
| | | <configuration> |
| | | <property name="log.path" value="./logs"/> |
| | | <property name="console.log.pattern" |
| | | value="%red(%d{yyyy-MM-dd HH:mm:ss}) %green([%thread]) %highlight(%-5level) %boldMagenta(%logger{36}%n) - %msg%n"/> |
| | | value="%cyan(%d{yyyy-MM-dd HH:mm:ss}) %green([%thread]) %highlight(%-5level) %boldMagenta(%logger{36}%n) - %msg%n"/> |
| | | <property name="log.pattern" value="%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n"/> |
| | | |
| | | <!-- æ§å¶å°è¾åº --> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 3f2ee348-0303-40ca-bf03-03f48d2d2141 |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 3 |
| | | SIMSUN.TTC -misc-simsun-medium-r-normal--0-0-0-0-p-0-iso10646-1 |
| | | SIMSUN.TTC -misc-simsun-medium-r-normal--0-0-0-0-p-0-iso8859-1 |
| | | SIMSUN.TTC -misc-simsun-medium-r-normal--0-0-0-0-p-0-koi8-r |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 3 |
| | | SIMSUN.TTC -misc-simsun-medium-r-normal--0-0-0-0-p-0-iso10646-1 |
| | | SIMSUN.TTC -misc-simsun-medium-r-normal--0-0-0-0-p-0-iso8859-1 |
| | | SIMSUN.TTC -misc-simsun-medium-r-normal--0-0-0-0-p-0-koi8-r |
| | |
| | | </description> |
| | | |
| | | <properties> |
| | | <revision>5.2.2</revision> |
| | | <revision>5.3.0</revision> |
| | | </properties> |
| | | |
| | | <dependencyManagement> |
| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.concurrent.BasicThreadFactory; |
| | | import org.dromara.common.core.config.properties.ThreadPoolProperties; |
| | | import org.dromara.common.core.utils.SpringUtils; |
| | | import org.dromara.common.core.utils.Threads; |
| | | import org.springframework.boot.autoconfigure.AutoConfiguration; |
| | | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
| | | import org.springframework.boot.context.properties.EnableConfigurationProperties; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.core.task.VirtualThreadTaskExecutor; |
| | | import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; |
| | | |
| | | import java.util.concurrent.ScheduledExecutorService; |
| | |
| | | */ |
| | | @Bean(name = "scheduledExecutorService") |
| | | protected ScheduledExecutorService scheduledExecutorService() { |
| | | // daemon å¿
须为 true |
| | | BasicThreadFactory.Builder builder = new BasicThreadFactory.Builder().daemon(true); |
| | | if (SpringUtils.isVirtual()) { |
| | | builder.namingPattern("virtual-schedule-pool-%d").wrappedFactory(new VirtualThreadTaskExecutor().getVirtualThreadFactory()); |
| | | } else { |
| | | builder.namingPattern("schedule-pool-%d"); |
| | | } |
| | | ScheduledThreadPoolExecutor scheduledThreadPoolExecutor = new ScheduledThreadPoolExecutor(core, |
| | | new BasicThreadFactory.Builder().namingPattern("schedule-pool-%d").daemon(true).build(), |
| | | builder.build(), |
| | | new ThreadPoolExecutor.CallerRunsPolicy()) { |
| | | @Override |
| | | protected void afterExecute(Runnable r, Throwable t) { |
| | |
| | | String SYS_OSS = "sys_oss#30d"; |
| | | |
| | | /** |
| | | * è§è²èªå®ä¹æé |
| | | */ |
| | | String SYS_ROLE_CUSTOM = "sys_role_custom#30d"; |
| | | |
| | | /** |
| | | * é¨é¨å以䏿é |
| | | */ |
| | | String SYS_DEPT_AND_CHILD = "sys_dept_and_child#30d"; |
| | | |
| | | /** |
| | | * OSSé
ç½® |
| | | */ |
| | | String SYS_OSS_CONFIG = GlobalConstants.GLOBAL_REDIS_KEY + "sys_oss_config"; |
| | |
| | | Integer CAPTCHA_EXPIRATION = 2; |
| | | |
| | | /** |
| | | * 令ç |
| | | */ |
| | | String TOKEN = "token"; |
| | | |
| | | /** |
| | | * 顶级é¨é¨id |
| | | * 顶级ç¶çº§id |
| | | */ |
| | | Long TOP_PARENT_ID = 0L; |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.common.core.constant; |
| | | |
| | | /** |
| | | * ç³»ç»å¸¸éä¿¡æ¯ |
| | | * |
| | | * @author Lion Li |
| | | */ |
| | | public interface SystemConstants { |
| | | |
| | | /** |
| | | * æ£å¸¸ç¶æ |
| | | */ |
| | | String NORMAL = "0"; |
| | | |
| | | /** |
| | | * å¼å¸¸ç¶æ |
| | | */ |
| | | String DISABLE = "1"; |
| | | |
| | | /** |
| | | * æ¯å¦ä¸ºç³»ç»é»è®¤ï¼æ¯ï¼ |
| | | */ |
| | | String YES = "Y"; |
| | | |
| | | /** |
| | | * æ¯å¦ä¸ºç³»ç»é»è®¤ï¼å¦ï¼ |
| | | */ |
| | | String NO = "N"; |
| | | |
| | | /** |
| | | * æ¯å¦èåå¤é¾ï¼æ¯ï¼ |
| | | */ |
| | | String YES_FRAME = "0"; |
| | | |
| | | /** |
| | | * æ¯å¦èåå¤é¾ï¼å¦ï¼ |
| | | */ |
| | | String NO_FRAME = "1"; |
| | | |
| | | /** |
| | | * èåç±»åï¼ç®å½ï¼ |
| | | */ |
| | | String TYPE_DIR = "M"; |
| | | |
| | | /** |
| | | * èåç±»åï¼èåï¼ |
| | | */ |
| | | String TYPE_MENU = "C"; |
| | | |
| | | /** |
| | | * èåç±»åï¼æé®ï¼ |
| | | */ |
| | | String TYPE_BUTTON = "F"; |
| | | |
| | | /** |
| | | * Layoutç»ä»¶æ è¯ |
| | | */ |
| | | String LAYOUT = "Layout"; |
| | | |
| | | /** |
| | | * ParentViewç»ä»¶æ è¯ |
| | | */ |
| | | String PARENT_VIEW = "ParentView"; |
| | | |
| | | /** |
| | | * InnerLinkç»ä»¶æ è¯ |
| | | */ |
| | | String INNER_LINK = "InnerLink"; |
| | | |
| | | /** |
| | | * è¶
级管çåID |
| | | */ |
| | | Long SUPER_ADMIN_ID = 1L; |
| | | |
| | | } |
| | |
| | | public interface TenantConstants { |
| | | |
| | | /** |
| | | * ç§æ·æ£å¸¸ç¶æ |
| | | */ |
| | | String NORMAL = "0"; |
| | | |
| | | /** |
| | | * ç§æ·å°ç¦ç¶æ |
| | | */ |
| | | String DISABLE = "1"; |
| | | |
| | | /** |
| | | * è¶
级管çåID |
| | | */ |
| | | Long SUPER_ADMIN_ID = 1L; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.common.core.domain.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serial; |
| | | import java.io.Serializable; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * åçä»»å¡è¯·æ±å¯¹è±¡ |
| | | * |
| | | * @author may |
| | | */ |
| | | @Data |
| | | public class CompleteTaskDTO implements Serializable { |
| | | |
| | | @Serial |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * ä»»å¡id |
| | | */ |
| | | private Long taskId; |
| | | |
| | | /** |
| | | * éä»¶id |
| | | */ |
| | | private String fileId; |
| | | |
| | | /** |
| | | * æé人å |
| | | */ |
| | | private List<FlowCopyDTO> flowCopyList; |
| | | |
| | | /** |
| | | * æ¶æ¯ç±»å |
| | | */ |
| | | private List<String> messageType; |
| | | |
| | | /** |
| | | * åçæè§ |
| | | */ |
| | | private String message; |
| | | |
| | | /** |
| | | * æ¶æ¯éç¥ |
| | | */ |
| | | private String notice; |
| | | |
| | | /** |
| | | * æµç¨åé |
| | | */ |
| | | private Map<String, Object> variables; |
| | | |
| | | /** |
| | | * æ©å±åé(æ¤å¤ä¸ºéå·åéçossId) |
| | | */ |
| | | private String ext; |
| | | |
| | | public Map<String, Object> getVariables() { |
| | | if (variables == null) { |
| | | return new HashMap<>(16); |
| | | } |
| | | variables.entrySet().removeIf(entry -> Objects.isNull(entry.getValue())); |
| | | return variables; |
| | | } |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.common.core.domain.dto; |
| | | |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | import java.io.Serial; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * é¨é¨ |
| | | * |
| | | * @author AprilWind |
| | | */ |
| | | |
| | | @Data |
| | | @NoArgsConstructor |
| | | public class DeptDTO implements Serializable { |
| | | |
| | | @Serial |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * é¨é¨ID |
| | | */ |
| | | private Long deptId; |
| | | |
| | | /** |
| | | * ç¶é¨é¨ID |
| | | */ |
| | | private Long parentId; |
| | | |
| | | /** |
| | | * é¨é¨åç§° |
| | | */ |
| | | private String deptName; |
| | | |
| | | } |
copy from ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/domain/vo/WfCopy.java
copy to ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/domain/dto/FlowCopyDTO.java
Îļþ´Ó ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/domain/vo/WfCopy.java ¸´ÖÆ |
| | |
| | | package org.dromara.workflow.domain.vo; |
| | | package org.dromara.common.core.domain.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serial; |
| | | import java.io.Serializable; |
| | | |
| | | |
| | | /** |
| | | * æé |
| | |
| | | * @author may |
| | | */ |
| | | @Data |
| | | public class WfCopy implements Serializable { |
| | | public class FlowCopyDTO implements Serializable { |
| | | |
| | | @Serial |
| | | private static final long serialVersionUID = 1L; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.common.core.domain.dto; |
| | | |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | import java.io.Serial; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * å²ä½ |
| | | * |
| | | * @author AprilWind |
| | | */ |
| | | @Data |
| | | @NoArgsConstructor |
| | | public class PostDTO implements Serializable { |
| | | |
| | | @Serial |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * å²ä½ID |
| | | */ |
| | | private Long postId; |
| | | |
| | | /** |
| | | * é¨é¨id |
| | | */ |
| | | private Long deptId; |
| | | |
| | | /** |
| | | * å²ä½ç¼ç |
| | | */ |
| | | private String postCode; |
| | | |
| | | /** |
| | | * å²ä½åç§° |
| | | */ |
| | | private String postName; |
| | | |
| | | /** |
| | | * å²ä½ç±»å«ç¼ç |
| | | */ |
| | | private String postCategory; |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.common.core.domain.dto; |
| | | |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serial; |
| | | import java.io.Serializable; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * å¯å¨æµç¨å¯¹è±¡ |
| | | * |
| | | * @author may |
| | | */ |
| | | @Data |
| | | public class StartProcessDTO implements Serializable { |
| | | |
| | | @Serial |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * ä¸å¡å¯ä¸å¼id |
| | | */ |
| | | private String businessId; |
| | | |
| | | /** |
| | | * æµç¨å®ä¹ç¼ç |
| | | */ |
| | | private String flowCode; |
| | | |
| | | /** |
| | | * æµç¨åéï¼åç«¯ä¼æäº¤ä¸ä¸ªå
ç´ {'entity': {ä¸å¡è¯¦æ
æ°æ®å¯¹è±¡}} |
| | | */ |
| | | private Map<String, Object> variables; |
| | | |
| | | public Map<String, Object> getVariables() { |
| | | if (variables == null) { |
| | | return new HashMap<>(16); |
| | | } |
| | | variables.entrySet().removeIf(entry -> Objects.isNull(entry.getValue())); |
| | | return variables; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.common.core.domain.dto; |
| | | |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serial; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * å¯å¨æµç¨è¿å对象 |
| | | * |
| | | * @author Lion Li |
| | | */ |
| | | @Data |
| | | public class StartProcessReturnDTO implements Serializable { |
| | | |
| | | @Serial |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * æµç¨å®ä¾id |
| | | */ |
| | | private Long processInstanceId; |
| | | |
| | | /** |
| | | * ä»»å¡id |
| | | */ |
| | | private Long taskId; |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.common.core.domain.dto; |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | import java.io.Serial; |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.function.Function; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * ä»»å¡å让人 |
| | | * |
| | | * @author AprilWind |
| | | */ |
| | | @Data |
| | | @NoArgsConstructor |
| | | public class TaskAssigneeDTO implements Serializable { |
| | | |
| | | @Serial |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * æ»å¤§å° |
| | | */ |
| | | private Long total = 0L; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | private List<TaskHandler> list; |
| | | |
| | | public TaskAssigneeDTO(Long total, List<TaskHandler> list) { |
| | | this.total = total; |
| | | this.list = list; |
| | | } |
| | | |
| | | /** |
| | | * å°æºå表转æ¢ä¸º TaskHandler å表 |
| | | * |
| | | * @param <T> éç¨ç±»å |
| | | * @param sourceList å¾
转æ¢çæºå表 |
| | | * @param storageId æå storageId ç彿° |
| | | * @param handlerCode æå handlerCode ç彿° |
| | | * @param handlerName æå handlerName ç彿° |
| | | * @param groupName æå groupName ç彿° |
| | | * @param createTimeMapper æå createTime ç彿° |
| | | * @return 转æ¢åç TaskHandler å表 |
| | | */ |
| | | public static <T> List<TaskHandler> convertToHandlerList( |
| | | List<T> sourceList, |
| | | Function<T, Long> storageId, |
| | | Function<T, String> handlerCode, |
| | | Function<T, String> handlerName, |
| | | Function<T, Long> groupName, |
| | | Function<T, Date> createTimeMapper) { |
| | | return sourceList.stream() |
| | | .map(item -> new TaskHandler( |
| | | String.valueOf(storageId.apply(item)), |
| | | handlerCode.apply(item), |
| | | handlerName.apply(item), |
| | | groupName != null ? String.valueOf(groupName.apply(item)) : null, |
| | | createTimeMapper.apply(item) |
| | | )).collect(Collectors.toList()); |
| | | } |
| | | |
| | | @Data |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | public static class TaskHandler { |
| | | |
| | | /** |
| | | * ä¸»é® |
| | | */ |
| | | private String storageId; |
| | | |
| | | /** |
| | | * æéç¼ç |
| | | */ |
| | | private String handlerCode; |
| | | |
| | | /** |
| | | * æéåç§° |
| | | */ |
| | | private String handlerName; |
| | | |
| | | /** |
| | | * æéåç» |
| | | */ |
| | | private String groupName; |
| | | |
| | | /** |
| | | * å建æ¶é´ |
| | | */ |
| | | private Date createTime; |
| | | } |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.common.core.domain.event; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serial; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * å 餿µç¨çå¬ |
| | | * |
| | | * @author AprilWind |
| | | */ |
| | | @Data |
| | | public class ProcessDeleteEvent implements Serializable { |
| | | |
| | | @Serial |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * ç§æ·ID |
| | | */ |
| | | private String tenantId; |
| | | |
| | | /** |
| | | * æµç¨å®ä¹ç¼ç |
| | | */ |
| | | private String flowCode; |
| | | |
| | | /** |
| | | * ä¸å¡id |
| | | */ |
| | | private String businessId; |
| | | |
| | | } |
| | |
| | | |
| | | import java.io.Serial; |
| | | import java.io.Serializable; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * æ»ä½æµç¨çå¬ |
| | | * |
| | | * @author may |
| | | */ |
| | | |
| | | @Data |
| | | public class ProcessEvent implements Serializable { |
| | | |
| | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * æµç¨å®ä¹key |
| | | * ç§æ·ID |
| | | */ |
| | | private String key; |
| | | private String tenantId; |
| | | |
| | | /** |
| | | * æµç¨å®ä¹ç¼ç |
| | | */ |
| | | private String flowCode; |
| | | |
| | | /** |
| | | * ä¸å¡id |
| | | */ |
| | | private String businessKey; |
| | | private String businessId; |
| | | |
| | | /** |
| | | * ç¶æ |
| | |
| | | private String status; |
| | | |
| | | /** |
| | | * åçåæ° |
| | | */ |
| | | private Map<String, Object> params; |
| | | |
| | | /** |
| | | * å½ä¸ºtrueæ¶ä¸ºç³è¯·äººèç¹åç |
| | | */ |
| | | private boolean submit; |
| | | |
| | | |
| | | } |
| | |
| | | * |
| | | * @author may |
| | | */ |
| | | |
| | | @Data |
| | | public class ProcessTaskEvent implements Serializable { |
| | | |
| | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * æµç¨å®ä¹key |
| | | * ç§æ·ID |
| | | */ |
| | | private String key; |
| | | private String tenantId; |
| | | |
| | | /** |
| | | * 审æ¹èç¹key |
| | | * æµç¨å®ä¹ç¼ç |
| | | */ |
| | | private String taskDefinitionKey; |
| | | private String flowCode; |
| | | |
| | | /** |
| | | * 审æ¹èç¹ç¼ç |
| | | */ |
| | | private String nodeCode; |
| | | |
| | | /** |
| | | * ä»»å¡id |
| | | */ |
| | | private String taskId; |
| | | private Long taskId; |
| | | |
| | | /** |
| | | * ä¸å¡id |
| | | */ |
| | | private String businessKey; |
| | | private String businessId; |
| | | |
| | | } |
| | |
| | | package org.dromara.common.core.domain.model; |
| | | |
| | | import org.dromara.common.core.domain.dto.RoleDTO; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | import org.dromara.common.core.domain.dto.PostDTO; |
| | | import org.dromara.common.core.domain.dto.RoleDTO; |
| | | |
| | | import java.io.Serial; |
| | | import java.io.Serializable; |
| | |
| | | private List<RoleDTO> roles; |
| | | |
| | | /** |
| | | * å²ä½å¯¹è±¡ |
| | | */ |
| | | private List<PostDTO> posts; |
| | | |
| | | /** |
| | | * æ°æ®æé å½åè§è²ID |
| | | */ |
| | | private Long roleId; |
| | |
| | | import lombok.EqualsAndHashCode; |
| | | import org.hibernate.validator.constraints.Length; |
| | | |
| | | import static org.dromara.common.core.constant.UserConstants.*; |
| | | |
| | | /** |
| | | * å¯ç ç»å½å¯¹è±¡ |
| | | * |
| | |
| | | * ç¨æ·å |
| | | */ |
| | | @NotBlank(message = "{user.username.not.blank}") |
| | | @Length(min = USERNAME_MIN_LENGTH, max = USERNAME_MAX_LENGTH, message = "{user.username.length.valid}") |
| | | @Length(min = 2, max = 20, message = "{user.username.length.valid}") |
| | | private String username; |
| | | |
| | | /** |
| | | * ç¨æ·å¯ç |
| | | */ |
| | | @NotBlank(message = "{user.password.not.blank}") |
| | | @Length(min = PASSWORD_MIN_LENGTH, max = PASSWORD_MAX_LENGTH, message = "{user.password.length.valid}") |
| | | @Length(min = 5, max = 20, message = "{user.password.length.valid}") |
| | | private String password; |
| | | |
| | | } |
| | |
| | | import lombok.EqualsAndHashCode; |
| | | import org.hibernate.validator.constraints.Length; |
| | | |
| | | import static org.dromara.common.core.constant.UserConstants.*; |
| | | |
| | | /** |
| | | * ç¨æ·æ³¨å对象 |
| | | * |
| | |
| | | * ç¨æ·å |
| | | */ |
| | | @NotBlank(message = "{user.username.not.blank}") |
| | | @Length(min = USERNAME_MIN_LENGTH, max = USERNAME_MAX_LENGTH, message = "{user.username.length.valid}") |
| | | @Length(min = 2, max = 20, message = "{user.username.length.valid}") |
| | | private String username; |
| | | |
| | | /** |
| | | * ç¨æ·å¯ç |
| | | */ |
| | | @NotBlank(message = "{user.password.not.blank}") |
| | | @Length(min = PASSWORD_MIN_LENGTH, max = PASSWORD_MAX_LENGTH, message = "{user.password.length.valid}") |
| | | @Length(min = 5, max = 20, message = "{user.password.length.valid}") |
| | | private String password; |
| | | |
| | | private String userType; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.common.core.domain.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | import java.io.Serial; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * ä»»å¡å让人 |
| | | * |
| | | * @author AprilWind |
| | | */ |
| | | @Data |
| | | @NoArgsConstructor |
| | | public class TaskAssigneeBody implements Serializable { |
| | | |
| | | @Serial |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * æéç¼ç |
| | | */ |
| | | private String handlerCode; |
| | | |
| | | /** |
| | | * æéåç§° |
| | | */ |
| | | private String handlerName; |
| | | |
| | | /** |
| | | * æéåç» |
| | | */ |
| | | private String groupId; |
| | | |
| | | /** |
| | | * å¼å§æ¶é´ |
| | | */ |
| | | private String beginTime; |
| | | |
| | | /** |
| | | * ç»ææ¶é´ |
| | | */ |
| | | private String endTime; |
| | | |
| | | /** |
| | | * å½å页 |
| | | */ |
| | | private Integer pageNum = 1; |
| | | |
| | | /** |
| | | * æ¯é¡µæ¾ç¤ºæ¡æ° |
| | | */ |
| | | private Integer pageSize = 10; |
| | | |
| | | } |
| | |
| | | import org.dromara.common.core.utils.StringUtils; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.function.Function; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * ä¸å¡ç¶ææä¸¾ |
| | |
| | | @Getter |
| | | @AllArgsConstructor |
| | | public enum BusinessStatusEnum { |
| | | |
| | | /** |
| | | * å·²æ¤é |
| | | */ |
| | | CANCEL("cancel", "å·²æ¤é"), |
| | | |
| | | /** |
| | | * è稿 |
| | | */ |
| | | DRAFT("draft", "è稿"), |
| | | |
| | | /** |
| | | * å¾
å®¡æ ¸ |
| | | */ |
| | | WAITING("waiting", "å¾
å®¡æ ¸"), |
| | | |
| | | /** |
| | | * 已宿 |
| | | */ |
| | | FINISH("finish", "已宿"), |
| | | |
| | | /** |
| | | * å·²ä½åº |
| | | */ |
| | | INVALID("invalid", "å·²ä½åº"), |
| | | |
| | | /** |
| | | * å·²éå |
| | | */ |
| | | BACK("back", "å·²éå"), |
| | | |
| | | /** |
| | | * å·²ç»æ¢ |
| | | */ |
| | |
| | | */ |
| | | private final String desc; |
| | | |
| | | private static final Map<String, BusinessStatusEnum> STATUS_MAP = Arrays.stream(BusinessStatusEnum.values()) |
| | | .collect(Collectors.toConcurrentMap(BusinessStatusEnum::getStatus, Function.identity())); |
| | | |
| | | /** |
| | | * è·åä¸å¡ç¶æ |
| | | * æ ¹æ®ç¶æè·å对åºç BusinessStatusEnum æä¸¾ |
| | | * |
| | | * @param status ç¶æ |
| | | * @param status ä¸å¡ç¶æç |
| | | * @return 对åºç BusinessStatusEnum æä¸¾ï¼å¦ææ¾ä¸å°åè¿å null |
| | | */ |
| | | public static BusinessStatusEnum getByStatus(String status) { |
| | | // ä½¿ç¨ STATUS_MAP è·å对åºçæä¸¾ï¼è¥æ¾ä¸å°åè¿å null |
| | | return STATUS_MAP.get(status); |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®ç¶æè·å对åºçä¸å¡ç¶ææè¿°ä¿¡æ¯ |
| | | * |
| | | * @param status ä¸å¡ç¶æç |
| | | * @return è¿åä¸å¡ç¶ææè¿°ï¼è¥ç¶æç ä¸ºç©ºææªæ¾å°å¯¹åºçæä¸¾ï¼è¿å空å符串 |
| | | */ |
| | | public static String findByStatus(String status) { |
| | | if (StringUtils.isBlank(status)) { |
| | | return StrUtil.EMPTY; |
| | | } |
| | | return Arrays.stream(BusinessStatusEnum.values()) |
| | | .filter(statusEnum -> statusEnum.getStatus().equals(status)) |
| | | .findFirst() |
| | | .map(BusinessStatusEnum::getDesc) |
| | | .orElse(StrUtil.EMPTY); |
| | | BusinessStatusEnum statusEnum = STATUS_MAP.get(status); |
| | | return (statusEnum != null) ? statusEnum.getDesc() : StrUtil.EMPTY; |
| | | } |
| | | |
| | | /** |
| | | * 夿æ¯å¦ä¸ºæå®çç¶æä¹ä¸ï¼è稿ãå·²æ¤éæå·²éå |
| | | * |
| | | * @param status è¦æ£æ¥çç¶æ |
| | | * @return å¦æç¶æä¸ºè稿ãå·²æ¤éæå·²éåä¹ä¸ï¼åè¿å trueï¼å¦åè¿å false |
| | | */ |
| | | public static boolean isDraftOrCancelOrBack(String status) { |
| | | return DRAFT.status.equals(status) || CANCEL.status.equals(status) || BACK.status.equals(status); |
| | | } |
| | | |
| | | /** |
| | | * 夿æ¯å¦ä¸ºæ¤éï¼éåï¼ä½åºï¼ç»æ¢ |
| | | * |
| | | * @param status status |
| | | * @return ç»æ |
| | | */ |
| | | public static boolean initialState(String status) { |
| | | return CANCEL.status.equals(status) || BACK.status.equals(status) || INVALID.status.equals(status) || TERMINATION.status.equals(status); |
| | | } |
| | | |
| | | /** |
| | | * è·åè¿è¡ä¸çå®ä¾ç¶æå表 |
| | | * |
| | | * @return å
å«è¿è¡ä¸å®ä¾ç¶æçä¸å¯åå表 |
| | | * ï¼å
å« DRAFTãWAITINGãBACK å CANCEL ç¶æï¼ |
| | | */ |
| | | public static List<String> runningStatus() { |
| | | return Arrays.asList(DRAFT.status, WAITING.status, BACK.status, CANCEL.status); |
| | | } |
| | | |
| | | /** |
| | | * è·åç»æå®ä¾çç¶æå表 |
| | | * |
| | | * @return å
å«ç»æå®ä¾ç¶æçä¸å¯åå表 |
| | | * ï¼å
å« FINISHãINVALID å TERMINATION ç¶æï¼ |
| | | */ |
| | | public static List<String> finishStatus() { |
| | | return Arrays.asList(FINISH.status, INVALID.status, TERMINATION.status); |
| | | } |
| | | |
| | | /** |
| | |
| | | throw new ServiceException("æµç¨ç¶æä¸ºç©ºï¼"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.common.core.enums; |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Getter; |
| | | import org.dromara.common.core.utils.StringUtils; |
| | | |
| | | /* |
| | | * æ¥ææ ¼å¼ |
| | | * "yyyy"ï¼4使°ç年份ï¼ä¾å¦ï¼2023年表示为"2023"ã |
| | | * "yy"ï¼2使°ç年份ï¼ä¾å¦ï¼2023年表示为"23"ã |
| | | * "MM"ï¼2使°çæä»½ï¼åå¼èå´ä¸º01å°12ï¼ä¾å¦ï¼7æè¡¨ç¤ºä¸º"07"ã |
| | | * "M"ï¼ä¸å¸¦å导é¶çæä»½ï¼åå¼èå´ä¸º1å°12ï¼ä¾å¦ï¼7æè¡¨ç¤ºä¸º"7"ã |
| | | * "dd"ï¼2使°çæ¥æï¼åå¼èå´ä¸º01å°31ï¼ä¾å¦ï¼22æ¥è¡¨ç¤ºä¸º"22"ã |
| | | * "d"ï¼ä¸å¸¦å导é¶çæ¥æï¼åå¼èå´ä¸º1å°31ï¼ä¾å¦ï¼22æ¥è¡¨ç¤ºä¸º"22"ã |
| | | * "EEEE"ï¼ææçå
¨åï¼ä¾å¦ï¼ææä¸è¡¨ç¤ºä¸º"Wednesday"ã |
| | | * "E"ï¼ææç缩åï¼ä¾å¦ï¼ææä¸è¡¨ç¤ºä¸º"Wed"ã |
| | | * "DDD" æ "D"ï¼ä¸å¹´ä¸ç第å 天ï¼åå¼èå´ä¸º001å°366ï¼ä¾å¦ï¼ç¬¬200天表示为"200"ã |
| | | * æ¶é´æ ¼å¼ |
| | | * "HH"ï¼24å°æ¶å¶çå°æ¶æ°ï¼åå¼èå´ä¸º00å°23ï¼ä¾å¦ï¼ä¸å5ç¹è¡¨ç¤ºä¸º"17"ã |
| | | * "hh"ï¼12å°æ¶å¶çå°æ¶æ°ï¼åå¼èå´ä¸º01å°12ï¼ä¾å¦ï¼ä¸å5ç¹è¡¨ç¤ºä¸º"05"ã |
| | | * "mm"ï¼åéæ°ï¼åå¼èå´ä¸º00å°59ï¼ä¾å¦ï¼30åé表示为"30"ã |
| | | * "ss"ï¼ç§æ°ï¼åå¼èå´ä¸º00å°59ï¼ä¾å¦ï¼45ç§è¡¨ç¤ºä¸º"45"ã |
| | | * "SSS"ï¼æ¯«ç§æ°ï¼åå¼èå´ä¸º000å°999ï¼ä¾å¦ï¼123毫ç§è¡¨ç¤ºä¸º"123"ã |
| | | */ |
| | | |
| | | /** |
| | | * æ¥ææ ¼å¼ä¸æ¶é´æ ¼å¼æä¸¾ |
| | | */ |
| | | @Getter |
| | | @AllArgsConstructor |
| | | public enum FormatsType { |
| | | |
| | | /** |
| | | * ä¾å¦ï¼2023年表示为"23" |
| | | */ |
| | | YY("yy"), |
| | | |
| | | /** |
| | | * ä¾å¦ï¼2023年表示为"2023" |
| | | */ |
| | | YYYY("yyyy"), |
| | | |
| | | /** |
| | | * ä¾ä¾å¦ï¼2023å¹´7æå¯ä»¥è¡¨ç¤ºä¸º "2023-07" |
| | | */ |
| | | YYYY_MM("yyyy-MM"), |
| | | |
| | | /** |
| | | * ä¾å¦ï¼æ¥æ "2023å¹´7æ22æ¥" å¯ä»¥è¡¨ç¤ºä¸º "2023-07-22" |
| | | */ |
| | | YYYY_MM_DD("yyyy-MM-dd"), |
| | | |
| | | /** |
| | | * ä¾å¦ï¼å½åæ¶é´å¦ææ¯ "2023å¹´7æ22æ¥ä¸å3ç¹30å"ï¼åå¯ä»¥è¡¨ç¤ºä¸º "2023-07-22 15:30" |
| | | */ |
| | | YYYY_MM_DD_HH_MM("yyyy-MM-dd HH:mm"), |
| | | |
| | | /** |
| | | * ä¾å¦ï¼å½åæ¶é´å¦ææ¯ "2023å¹´7æ22æ¥ä¸å3ç¹30å45ç§"ï¼åå¯ä»¥è¡¨ç¤ºä¸º "2023-07-22 15:30:45" |
| | | */ |
| | | YYYY_MM_DD_HH_MM_SS("yyyy-MM-dd HH:mm:ss"), |
| | | |
| | | /** |
| | | * ä¾å¦ï¼ä¸å3ç¹30å45ç§ï¼è¡¨ç¤ºä¸º "15:30:45" |
| | | */ |
| | | HH_MM_SS("HH:mm:ss"), |
| | | |
| | | /** |
| | | * ä¾ä¾å¦ï¼2023å¹´7æå¯ä»¥è¡¨ç¤ºä¸º "2023/07" |
| | | */ |
| | | YYYY_MM_SLASH("yyyy/MM"), |
| | | |
| | | /** |
| | | * ä¾å¦ï¼æ¥æ "2023å¹´7æ22æ¥" å¯ä»¥è¡¨ç¤ºä¸º "2023/07/22" |
| | | */ |
| | | YYYY_MM_DD_SLASH("yyyy/MM/dd"), |
| | | |
| | | /** |
| | | * ä¾å¦ï¼å½åæ¶é´å¦ææ¯ "2023å¹´7æ22æ¥ä¸å3ç¹30å45ç§"ï¼åå¯ä»¥è¡¨ç¤ºä¸º "2023/07/22 15:30:45" |
| | | */ |
| | | YYYY_MM_DD_HH_MM_SLASH("yyyy/MM/dd HH:mm"), |
| | | |
| | | /** |
| | | * ä¾å¦ï¼å½åæ¶é´å¦ææ¯ "2023å¹´7æ22æ¥ä¸å3ç¹30å45ç§"ï¼åå¯ä»¥è¡¨ç¤ºä¸º "2023/07/22 15:30:45" |
| | | */ |
| | | YYYY_MM_DD_HH_MM_SS_SLASH("yyyy/MM/dd HH:mm:ss"), |
| | | |
| | | /** |
| | | * ä¾ä¾å¦ï¼2023å¹´7æå¯ä»¥è¡¨ç¤ºä¸º "2023.07" |
| | | */ |
| | | YYYY_MM_DOT("yyyy.MM"), |
| | | |
| | | /** |
| | | * ä¾å¦ï¼æ¥æ "2023å¹´7æ22æ¥" å¯ä»¥è¡¨ç¤ºä¸º "2023.07.22" |
| | | */ |
| | | YYYY_MM_DD_DOT("yyyy.MM.dd"), |
| | | |
| | | /** |
| | | * ä¾å¦ï¼å½åæ¶é´å¦ææ¯ "2023å¹´7æ22æ¥ä¸å3ç¹30å"ï¼åå¯ä»¥è¡¨ç¤ºä¸º "2023.07.22 15:30" |
| | | */ |
| | | YYYY_MM_DD_HH_MM_DOT("yyyy.MM.dd HH:mm"), |
| | | |
| | | /** |
| | | * ä¾å¦ï¼å½åæ¶é´å¦ææ¯ "2023å¹´7æ22æ¥ä¸å3ç¹30å45ç§"ï¼åå¯ä»¥è¡¨ç¤ºä¸º "2023.07.22 15:30:45" |
| | | */ |
| | | YYYY_MM_DD_HH_MM_SS_DOT("yyyy.MM.dd HH:mm:ss"), |
| | | |
| | | /** |
| | | * ä¾å¦ï¼2023å¹´7æå¯ä»¥è¡¨ç¤ºä¸º "202307" |
| | | */ |
| | | YYYYMM("yyyyMM"), |
| | | |
| | | /** |
| | | * ä¾å¦ï¼2023å¹´7æ22æ¥å¯ä»¥è¡¨ç¤ºä¸º "20230722" |
| | | */ |
| | | YYYYMMDD("yyyyMMdd"), |
| | | |
| | | /** |
| | | * ä¾å¦ï¼2023å¹´7æ22æ¥ä¸å3ç¹å¯ä»¥è¡¨ç¤ºä¸º "2023072215" |
| | | */ |
| | | YYYYMMDDHH("yyyyMMddHH"), |
| | | |
| | | /** |
| | | * ä¾å¦ï¼2023å¹´7æ22æ¥ä¸å3ç¹30åå¯ä»¥è¡¨ç¤ºä¸º "202307221530" |
| | | */ |
| | | YYYYMMDDHHMM("yyyyMMddHHmm"), |
| | | |
| | | /** |
| | | * ä¾å¦ï¼2023å¹´7æ22æ¥ä¸å3ç¹30å45ç§å¯ä»¥è¡¨ç¤ºä¸º "20230722153045" |
| | | */ |
| | | YYYYMMDDHHMMSS("yyyyMMddHHmmss"); |
| | | |
| | | /** |
| | | * æ¶é´æ ¼å¼ |
| | | */ |
| | | private final String timeFormat; |
| | | |
| | | public static FormatsType getFormatsType(String str) { |
| | | for (FormatsType value : values()) { |
| | | if (StringUtils.contains(str, value.getTimeFormat())) { |
| | | return value; |
| | | } |
| | | } |
| | | throw new RuntimeException("'FormatsType' not found By " + str); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.common.core.exception; |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | import java.io.Serial; |
| | | |
| | | /** |
| | | * sse ç¹å¶å¼å¸¸ |
| | | * |
| | | * @author LionLi |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | public final class SseException extends RuntimeException { |
| | | |
| | | @Serial |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * é误ç |
| | | */ |
| | | private Integer code; |
| | | |
| | | /** |
| | | * é误æç¤º |
| | | */ |
| | | private String message; |
| | | |
| | | /** |
| | | * é误æç»ï¼å
é¨è°è¯é误 |
| | | */ |
| | | private String detailMessage; |
| | | |
| | | public SseException(String message) { |
| | | this.message = message; |
| | | } |
| | | |
| | | public SseException(String message, Integer code) { |
| | | this.message = message; |
| | | this.code = code; |
| | | } |
| | | |
| | | @Override |
| | | public String getMessage() { |
| | | return message; |
| | | } |
| | | |
| | | public SseException setMessage(String message) { |
| | | this.message = message; |
| | | return this; |
| | | } |
| | | |
| | | public SseException setDetailMessage(String detailMessage) { |
| | | this.detailMessage = detailMessage; |
| | | return this; |
| | | } |
| | | } |
| | |
| | | package org.dromara.common.core.service; |
| | | |
| | | import org.dromara.common.core.domain.dto.DeptDTO; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * éç¨ é¨é¨æå¡ |
| | | * |
| | |
| | | */ |
| | | String selectDeptNameByIds(String deptIds); |
| | | |
| | | /** |
| | | * æ ¹æ®é¨é¨IDæ¥è¯¢é¨é¨è´è´£äºº |
| | | * |
| | | * @param deptId é¨é¨IDï¼ç¨äºæå®éè¦æ¥è¯¢çé¨é¨ |
| | | * @return è¿å该é¨é¨çè´è´£äººID |
| | | */ |
| | | Long selectDeptLeaderById(Long deptId); |
| | | |
| | | /** |
| | | * æ¥è¯¢é¨é¨ |
| | | * |
| | | * @return é¨é¨å表 |
| | | */ |
| | | List<DeptDTO> selectDeptsByList(); |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.common.core.service; |
| | | |
| | | /** |
| | | * éç¨ å²ä½æå¡ |
| | | * |
| | | * @author AprilWind |
| | | */ |
| | | public interface PostService { |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.common.core.service; |
| | | |
| | | /** |
| | | * éç¨ è§è²æå¡ |
| | | * |
| | | * @author AprilWind |
| | | */ |
| | | public interface RoleService { |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.common.core.service; |
| | | |
| | | import org.dromara.common.core.domain.dto.TaskAssigneeDTO; |
| | | import org.dromara.common.core.domain.model.TaskAssigneeBody; |
| | | |
| | | /** |
| | | * 工使µè®¾è®¡å¨è·å任塿§è¡äºº |
| | | * |
| | | * @author Lion Li |
| | | */ |
| | | public interface TaskAssigneeService { |
| | | |
| | | /** |
| | | * æ¥è¯¢è§è²å¹¶è¿åä»»å¡ææ´¾çåè¡¨ï¼æ¯æå页 |
| | | * |
| | | * @param taskQuery æ¥è¯¢æ¡ä»¶ |
| | | * @return åç人 |
| | | */ |
| | | TaskAssigneeDTO selectRolesByTaskAssigneeList(TaskAssigneeBody taskQuery); |
| | | |
| | | /** |
| | | * æ¥è¯¢å²ä½å¹¶è¿åä»»å¡ææ´¾çåè¡¨ï¼æ¯æå页 |
| | | * |
| | | * @param taskQuery æ¥è¯¢æ¡ä»¶ |
| | | * @return åç人 |
| | | */ |
| | | TaskAssigneeDTO selectPostsByTaskAssigneeList(TaskAssigneeBody taskQuery); |
| | | |
| | | /** |
| | | * æ¥è¯¢é¨é¨å¹¶è¿åä»»å¡ææ´¾çåè¡¨ï¼æ¯æå页 |
| | | * |
| | | * @param taskQuery æ¥è¯¢æ¡ä»¶ |
| | | * @return åç人 |
| | | */ |
| | | TaskAssigneeDTO selectDeptsByTaskAssigneeList(TaskAssigneeBody taskQuery); |
| | | |
| | | /** |
| | | * æ¥è¯¢ç¨æ·å¹¶è¿åä»»å¡ææ´¾çåè¡¨ï¼æ¯æå页 |
| | | * |
| | | * @param taskQuery æ¥è¯¢æ¡ä»¶ |
| | | * @return åç人 |
| | | */ |
| | | TaskAssigneeDTO selectUsersByTaskAssigneeList(TaskAssigneeBody taskQuery); |
| | | |
| | | } |
| | |
| | | * @return ç¨æ· |
| | | */ |
| | | List<UserDTO> selectUsersByDeptIds(List<Long> deptIds); |
| | | |
| | | /** |
| | | * éè¿å²ä½IDæ¥è¯¢ç¨æ· |
| | | * |
| | | * @param postIds å²ä½ids |
| | | * @return ç¨æ· |
| | | */ |
| | | List<UserDTO> selectUsersByPostIds(List<Long> postIds); |
| | | |
| | | } |
| | |
| | | package org.dromara.common.core.service; |
| | | |
| | | import org.dromara.common.core.domain.dto.CompleteTaskDTO; |
| | | import org.dromara.common.core.domain.dto.StartProcessDTO; |
| | | import org.dromara.common.core.domain.dto.StartProcessReturnDTO; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | |
| | | /** |
| | | * è¿è¡ä¸çå®ä¾ å é¤ç¨å®ä¾ï¼å é¤åå²è®°å½ï¼å é¤ä¸å¡ä¸æµç¨å
³èä¿¡æ¯ |
| | | * |
| | | * @param businessKeys ä¸å¡id |
| | | * @param businessIds ä¸å¡id |
| | | * @return ç»æ |
| | | */ |
| | | boolean deleteRunAndHisInstance(List<String> businessKeys); |
| | | boolean deleteInstance(List<Long> businessIds); |
| | | |
| | | /** |
| | | * è·åå½åæµç¨ç¶æ |
| | | * |
| | | * @param taskId ä»»å¡id |
| | | * @return ç¶æ |
| | | */ |
| | | String getBusinessStatusByTaskId(String taskId); |
| | | String getBusinessStatusByTaskId(Long taskId); |
| | | |
| | | /** |
| | | * è·åå½åæµç¨ç¶æ |
| | | * |
| | | * @param businessKey ä¸å¡id |
| | | * @param businessId ä¸å¡id |
| | | * @return ç¶æ |
| | | */ |
| | | String getBusinessStatus(String businessKey); |
| | | String getBusinessStatus(String businessId); |
| | | |
| | | /** |
| | | * 设置æµç¨åé(å
¨å±åé) |
| | | * 设置æµç¨åé |
| | | * |
| | | * @param taskId ä»»å¡id |
| | | * @param variableName åéåç§° |
| | | * @param value åéå¼ |
| | | * @param instanceId æµç¨å®ä¾id |
| | | * @param variable æµç¨åé |
| | | */ |
| | | void setVariable(String taskId, String variableName, Object value); |
| | | void setVariable(Long instanceId, Map<String, Object> variable); |
| | | |
| | | /** |
| | | * 设置æµç¨åé(å
¨å±åé) |
| | | * è·åæµç¨åé |
| | | * |
| | | * @param taskId ä»»å¡id |
| | | * @param variables æµç¨åé |
| | | * @param instanceId æµç¨å®ä¾id |
| | | */ |
| | | void setVariables(String taskId, Map<String, Object> variables); |
| | | |
| | | /** |
| | | * 设置æµç¨åé(æ¬å°åé,éå
¨å±åé) |
| | | * |
| | | * @param taskId ä»»å¡id |
| | | * @param variableName åéåç§° |
| | | * @param value åéå¼ |
| | | */ |
| | | void setVariableLocal(String taskId, String variableName, Object value); |
| | | |
| | | /** |
| | | * 设置æµç¨åé(æ¬å°åé,éå
¨å±åé) |
| | | * |
| | | * @param taskId ä»»å¡id |
| | | * @param variables æµç¨åé |
| | | */ |
| | | void setVariablesLocal(String taskId, Map<String, Object> variables); |
| | | Map<String, Object> instanceVariable(Long instanceId); |
| | | |
| | | /** |
| | | * æç
§ä¸å¡idæ¥è¯¢æµç¨å®ä¾id |
| | | * |
| | | * @param businessKey ä¸å¡id |
| | | * @param businessId ä¸å¡id |
| | | * @return ç»æ |
| | | */ |
| | | String getInstanceIdByBusinessKey(String businessKey); |
| | | Long getInstanceIdByBusinessId(String businessId); |
| | | |
| | | /** |
| | | * æ°å¢ç§æ·æµç¨å®ä¹ |
| | | * |
| | | * @param tenantId ç§æ·id |
| | | */ |
| | | void syncDef(String tenantId); |
| | | |
| | | /** |
| | | * å¯å¨æµç¨ |
| | | * |
| | | * @param startProcess åæ° |
| | | * @return ç»æ |
| | | */ |
| | | StartProcessReturnDTO startWorkFlow(StartProcessDTO startProcess); |
| | | |
| | | /** |
| | | * åçä»»å¡ |
| | | * |
| | | * @param completeTask åæ° |
| | | * @return ç»æ |
| | | */ |
| | | boolean completeTask(CompleteTaskDTO completeTask); |
| | | } |
| | |
| | | package org.dromara.common.core.utils; |
| | | |
| | | import lombok.AccessLevel; |
| | | import lombok.NoArgsConstructor; |
| | | import org.apache.commons.lang3.time.DateFormatUtils; |
| | | import org.dromara.common.core.enums.FormatsType; |
| | | import org.dromara.common.core.exception.ServiceException; |
| | | |
| | | import java.lang.management.ManagementFactory; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.LocalTime; |
| | | import java.time.ZoneId; |
| | | import java.time.ZonedDateTime; |
| | | import java.time.*; |
| | | import java.util.Date; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | /** |
| | | * æ¶é´å·¥å
·ç±» |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @NoArgsConstructor(access = AccessLevel.PRIVATE) |
| | | public class DateUtils extends org.apache.commons.lang3.time.DateUtils { |
| | | |
| | | public static final String YYYY = "yyyy"; |
| | | |
| | | public static final String YYYY_MM = "yyyy-MM"; |
| | | |
| | | public static final String YYYY_MM_DD = "yyyy-MM-dd"; |
| | | |
| | | public static final String YYYYMMDDHHMMSS = "yyyyMMddHHmmss"; |
| | | |
| | | public static final String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss"; |
| | | |
| | | private static final String[] PARSE_PATTERNS = { |
| | | "yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy-MM", |
| | | "yyyy/MM/dd", "yyyy/MM/dd HH:mm:ss", "yyyy/MM/dd HH:mm", "yyyy/MM", |
| | | "yyyy.MM.dd", "yyyy.MM.dd HH:mm:ss", "yyyy.MM.dd HH:mm", "yyyy.MM"}; |
| | | |
| | | @Deprecated |
| | | private DateUtils() { |
| | | } |
| | | |
| | | /** |
| | | * è·åå½åDate忥æ |
| | | * è·åå½åæ¥æåæ¶é´ |
| | | * |
| | | * @return Date() å½åæ¥æ |
| | | * @return å½åæ¥æåæ¶é´ç Date 对象表示 |
| | | */ |
| | | public static Date getNowDate() { |
| | | return new Date(); |
| | | } |
| | | |
| | | /** |
| | | * è·åå½åæ¥æ, é»è®¤æ ¼å¼ä¸ºyyyy-MM-dd |
| | | * è·åå½åæ¥æçåç¬¦ä¸²è¡¨ç¤ºï¼æ ¼å¼ä¸ºYYYY-MM-DD |
| | | * |
| | | * @return String |
| | | * @return å½åæ¥æçå符串表示 |
| | | */ |
| | | public static String getDate() { |
| | | return dateTimeNow(YYYY_MM_DD); |
| | | return dateTimeNow(FormatsType.YYYY_MM_DD); |
| | | } |
| | | |
| | | /** |
| | | * è·åå½åæ¥æçåç¬¦ä¸²è¡¨ç¤ºï¼æ ¼å¼ä¸ºyyyyMMdd |
| | | * |
| | | * @return å½åæ¥æçå符串表示 |
| | | */ |
| | | public static String getCurrentDate() { |
| | | return DateFormatUtils.format(new Date(), FormatsType.YYYYMMDD.getTimeFormat()); |
| | | } |
| | | |
| | | /** |
| | | * è·åå½åæ¥æçè·¯å¾æ ¼å¼åç¬¦ä¸²ï¼æ ¼å¼ä¸º"yyyy/MM/dd" |
| | | * |
| | | * @return å½åæ¥æçè·¯å¾æ ¼å¼å符串 |
| | | */ |
| | | public static String datePath() { |
| | | Date now = new Date(); |
| | | return DateFormatUtils.format(now, FormatsType.YYYY_MM_DD_SLASH.getTimeFormat()); |
| | | } |
| | | |
| | | /** |
| | | * è·åå½åæ¶é´çåç¬¦ä¸²è¡¨ç¤ºï¼æ ¼å¼ä¸ºYYYY-MM-DD HH:MM:SS |
| | | * |
| | | * @return å½åæ¶é´çå符串表示 |
| | | */ |
| | | public static String getTime() { |
| | | return dateTimeNow(YYYY_MM_DD_HH_MM_SS); |
| | | return dateTimeNow(FormatsType.YYYY_MM_DD_HH_MM_SS); |
| | | } |
| | | |
| | | /** |
| | | * è·åå½åæ¶é´çåç¬¦ä¸²è¡¨ç¤ºï¼æ ¼å¼ä¸º "HH:MM:SS" |
| | | * |
| | | * @return å½åæ¶é´çåç¬¦ä¸²è¡¨ç¤ºï¼æ ¼å¼ä¸º "HH:MM:SS" |
| | | */ |
| | | public static String getTimeWithHourMinuteSecond() { |
| | | return dateTimeNow(FormatsType.HH_MM_SS); |
| | | } |
| | | |
| | | /** |
| | | * è·åå½åæ¥æåæ¶é´çåç¬¦ä¸²è¡¨ç¤ºï¼æ ¼å¼ä¸ºYYYYMMDDHHMMSS |
| | | * |
| | | * @return å½åæ¥æåæ¶é´çå符串表示 |
| | | */ |
| | | public static String dateTimeNow() { |
| | | return dateTimeNow(YYYYMMDDHHMMSS); |
| | | return dateTimeNow(FormatsType.YYYYMMDDHHMMSS); |
| | | } |
| | | |
| | | public static String dateTimeNow(final String format) { |
| | | /** |
| | | * è·åå½åæ¥æåæ¶é´çæå®æ ¼å¼çå符串表示 |
| | | * |
| | | * @param format æ¥ææ¶é´æ ¼å¼ï¼ä¾å¦"YYYY-MM-DD HH:MM:SS" |
| | | * @return å½åæ¥æåæ¶é´çå符串表示 |
| | | */ |
| | | public static String dateTimeNow(final FormatsType format) { |
| | | return parseDateToStr(format, new Date()); |
| | | } |
| | | |
| | | public static String dateTime(final Date date) { |
| | | return parseDateToStr(YYYY_MM_DD, date); |
| | | /** |
| | | * 尿宿¥ææ ¼å¼å为 YYYY-MM-DD æ ¼å¼çå符串 |
| | | * |
| | | * @param date è¦æ ¼å¼åçæ¥æå¯¹è±¡ |
| | | * @return æ ¼å¼ååçæ¥æå符串 |
| | | */ |
| | | public static String formatDate(final Date date) { |
| | | return parseDateToStr(FormatsType.YYYY_MM_DD, date); |
| | | } |
| | | |
| | | public static String parseDateToStr(final String format, final Date date) { |
| | | return new SimpleDateFormat(format).format(date); |
| | | /** |
| | | * 尿宿¥ææ ¼å¼å为 YYYY-MM-DD HH:MM:SS æ ¼å¼çå符串 |
| | | * |
| | | * @param date è¦æ ¼å¼åçæ¥æå¯¹è±¡ |
| | | * @return æ ¼å¼ååçæ¥ææ¶é´å符串 |
| | | */ |
| | | public static String formatDateTime(final Date date) { |
| | | return parseDateToStr(FormatsType.YYYY_MM_DD_HH_MM_SS, date); |
| | | } |
| | | |
| | | public static Date dateTime(final String format, final String ts) { |
| | | /** |
| | | * 尿宿¥ææç
§æå®æ ¼å¼è¿è¡æ ¼å¼å |
| | | * |
| | | * @param format è¦ä½¿ç¨çæ¥ææ¶é´æ ¼å¼ï¼ä¾å¦"YYYY-MM-DD HH:MM:SS" |
| | | * @param date è¦æ ¼å¼åçæ¥æå¯¹è±¡ |
| | | * @return æ ¼å¼ååçæ¥ææ¶é´å符串 |
| | | */ |
| | | public static String parseDateToStr(final FormatsType format, final Date date) { |
| | | return new SimpleDateFormat(format.getTimeFormat()).format(date); |
| | | } |
| | | |
| | | /** |
| | | * 尿宿 ¼å¼çæ¥ææ¶é´å符串转æ¢ä¸º Date 对象 |
| | | * |
| | | * @param format è¦è§£æçæ¥ææ¶é´æ ¼å¼ï¼ä¾å¦"YYYY-MM-DD HH:MM:SS" |
| | | * @param ts è¦è§£æçæ¥ææ¶é´å符串 |
| | | * @return è§£æåç Date 对象 |
| | | * @throws RuntimeException å¦æè§£æè¿ç¨ä¸åçå¼å¸¸ |
| | | */ |
| | | public static Date parseDateTime(final FormatsType format, final String ts) { |
| | | try { |
| | | return new SimpleDateFormat(format).parse(ts); |
| | | return new SimpleDateFormat(format.getTimeFormat()).parse(ts); |
| | | } catch (ParseException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * æ¥æè·¯å¾ å³å¹´/æ/æ¥ å¦2018/08/08 |
| | | */ |
| | | public static String datePath() { |
| | | Date now = new Date(); |
| | | return DateFormatUtils.format(now, "yyyy/MM/dd"); |
| | | } |
| | | |
| | | /** |
| | | * æ¥æè·¯å¾ å³å¹´/æ/æ¥ å¦20180808 |
| | | */ |
| | | public static String dateTime() { |
| | | Date now = new Date(); |
| | | return DateFormatUtils.format(now, "yyyyMMdd"); |
| | | } |
| | | |
| | | /** |
| | | * æ¥æåå符串转åä¸ºæ¥æ æ ¼å¼ |
| | | * å°å¯¹è±¡è½¬æ¢ä¸ºæ¥æå¯¹è±¡ |
| | | * |
| | | * @param str è¦è½¬æ¢ç对象ï¼é常æ¯å符串 |
| | | * @return 转æ¢åçæ¥æå¯¹è±¡ï¼å¦æè½¬æ¢å¤±è´¥æè¾å
¥ä¸ºnullï¼åè¿ånull |
| | | */ |
| | | public static Date parseDate(Object str) { |
| | | if (str == null) { |
| | |
| | | |
| | | /** |
| | | * è·åæå¡å¨å¯å¨æ¶é´ |
| | | * |
| | | * @return æå¡å¨å¯å¨æ¶é´ç Date 对象表示 |
| | | */ |
| | | public static Date getServerStartDate() { |
| | | long time = ManagementFactory.getRuntimeMXBean().getStartTime(); |
| | |
| | | } |
| | | |
| | | /** |
| | | * 计ç®ç¸å·®å¤©æ° |
| | | * 计ç®ä¸¤ä¸ªæ¥æä¹é´ç天æ°å·®ï¼ä»¥æ¯«ç§ä¸ºåä½ï¼ |
| | | * |
| | | * @param date1 第ä¸ä¸ªæ¥æ |
| | | * @param date2 第äºä¸ªæ¥æ |
| | | * @return ä¸¤ä¸ªæ¥æä¹é´ç天æ°å·®çç»å¯¹å¼ |
| | | */ |
| | | public static int differentDaysByMillisecond(Date date1, Date date2) { |
| | | return Math.abs((int) ((date2.getTime() - date1.getTime()) / (1000 * 3600 * 24))); |
| | | } |
| | | |
| | | /** |
| | | * 计ç®ä¸¤ä¸ªæ¶é´å·® |
| | | * 计ç®ä¸¤ä¸ªæ¥æä¹é´çæ¶é´å·®ï¼å¹¶ä»¥å¤©ãå°æ¶ååéçæ ¼å¼è¿å |
| | | * |
| | | * @param endDate ç»ææ¥æ |
| | | * @param nowDate å½åæ¥æ |
| | | * @return 表示æ¶é´å·®çåç¬¦ä¸²ï¼æ ¼å¼ä¸º"天 å°æ¶ åé" |
| | | */ |
| | | public static String getDatePoor(Date endDate, Date nowDate) { |
| | | long nd = 1000 * 24 * 60 * 60; |
| | | long nh = 1000 * 60 * 60; |
| | | long nm = 1000 * 60; |
| | | // long ns = 1000; |
| | | // è·å¾ä¸¤ä¸ªæ¶é´çæ¯«ç§æ¶é´å·®å¼ |
| | | long diff = endDate.getTime() - nowDate.getTime(); |
| | | // 计ç®å·®å¤å°å¤© |
| | | long day = diff / nd; |
| | | // 计ç®å·®å¤å°å°æ¶ |
| | | long hour = diff % nd / nh; |
| | | // 计ç®å·®å¤å°åé |
| | | long min = diff % nd % nh / nm; |
| | | // 计ç®å·®å¤å°ç§//è¾åºç»æ |
| | | // long sec = diff % nd % nh % nm / ns; |
| | | return day + "天" + hour + "å°æ¶" + min + "åé"; |
| | | long diffInMillis = endDate.getTime() - nowDate.getTime(); |
| | | long day = TimeUnit.MILLISECONDS.toDays(diffInMillis); |
| | | long hour = TimeUnit.MILLISECONDS.toHours(diffInMillis) % 24; |
| | | long min = TimeUnit.MILLISECONDS.toMinutes(diffInMillis) % 60; |
| | | return String.format("%d天 %då°æ¶ %dåé", day, hour, min); |
| | | } |
| | | |
| | | /** |
| | | * å¢å LocalDateTime ==> Date |
| | | * 计ç®ä¸¤ä¸ªæ¶é´ç¹çå·®å¼ï¼å¤©ãå°æ¶ãåéãç§ï¼ï¼å½å¼ä¸º0æ¶ä¸æ¾ç¤ºè¯¥åä½ |
| | | * |
| | | * @param endDate ç»ææ¶é´ |
| | | * @param nowDate å½åæ¶é´ |
| | | * @return æ¶é´å·®åç¬¦ä¸²ï¼æ ¼å¼ä¸º "x天 xå°æ¶ xåé xç§"ï¼è¥ä¸º 0 å䏿¾ç¤º |
| | | */ |
| | | public static String getTimeDifference(Date endDate, Date nowDate) { |
| | | long diffInMillis = endDate.getTime() - nowDate.getTime(); |
| | | long day = TimeUnit.MILLISECONDS.toDays(diffInMillis); |
| | | long hour = TimeUnit.MILLISECONDS.toHours(diffInMillis) % 24; |
| | | long min = TimeUnit.MILLISECONDS.toMinutes(diffInMillis) % 60; |
| | | long sec = TimeUnit.MILLISECONDS.toSeconds(diffInMillis) % 60; |
| | | // æå»ºæ¶é´å·®åç¬¦ä¸²ï¼æ¡ä»¶æ¯å¼ä¸ä¸º0ææ¾ç¤º |
| | | StringBuilder result = new StringBuilder(); |
| | | if (day > 0) { |
| | | result.append(String.format("%d天 ", day)); |
| | | } |
| | | if (hour > 0) { |
| | | result.append(String.format("%då°æ¶ ", hour)); |
| | | } |
| | | if (min > 0) { |
| | | result.append(String.format("%dåé ", min)); |
| | | } |
| | | if (sec > 0) { |
| | | result.append(String.format("%dç§", sec)); |
| | | } |
| | | return result.length() > 0 ? result.toString().trim() : "0ç§"; |
| | | } |
| | | |
| | | /** |
| | | * å° LocalDateTime 对象转æ¢ä¸º Date 对象 |
| | | * |
| | | * @param temporalAccessor è¦è½¬æ¢ç LocalDateTime 对象 |
| | | * @return 转æ¢åç Date 对象 |
| | | */ |
| | | public static Date toDate(LocalDateTime temporalAccessor) { |
| | | ZonedDateTime zdt = temporalAccessor.atZone(ZoneId.systemDefault()); |
| | |
| | | } |
| | | |
| | | /** |
| | | * å¢å LocalDate ==> Date |
| | | * å° LocalDate 对象转æ¢ä¸º Date 对象 |
| | | * |
| | | * @param temporalAccessor è¦è½¬æ¢ç LocalDate 对象 |
| | | * @return 转æ¢åç Date 对象 |
| | | */ |
| | | public static Date toDate(LocalDate temporalAccessor) { |
| | | LocalDateTime localDateTime = LocalDateTime.of(temporalAccessor, LocalTime.of(0, 0, 0)); |
| | | ZonedDateTime zdt = localDateTime.atZone(ZoneId.systemDefault()); |
| | | return Date.from(zdt.toInstant()); |
| | | } |
| | | |
| | | /** |
| | | * æ ¡éªæ¥æèå´ |
| | | * |
| | | * @param startDate å¼å§æ¥æ |
| | | * @param endDate ç»ææ¥æ |
| | | * @param maxValue æå¤§æ¶é´è·¨åº¦çéå¶å¼ |
| | | * @param unit æ¶é´è·¨åº¦çåä½ï¼å¯éæ© "DAYS"ã"HOURS" æ "MINUTES" |
| | | */ |
| | | public static void validateDateRange(Date startDate, Date endDate, int maxValue, TimeUnit unit) { |
| | | // æ ¡éªç»ææ¥æä¸è½æ©äºå¼å§æ¥æ |
| | | if (endDate.before(startDate)) { |
| | | throw new ServiceException("ç»ææ¥æä¸è½æ©äºå¼å§æ¥æ"); |
| | | } |
| | | |
| | | // è®¡ç®æ¶é´è·¨åº¦ |
| | | long diffInMillis = endDate.getTime() - startDate.getTime(); |
| | | |
| | | // æ ¹æ®åä½è½¬æ¢æ¶é´è·¨åº¦ |
| | | long diff = switch (unit) { |
| | | case DAYS -> TimeUnit.MILLISECONDS.toDays(diffInMillis); |
| | | case HOURS -> TimeUnit.MILLISECONDS.toHours(diffInMillis); |
| | | case MINUTES -> TimeUnit.MILLISECONDS.toMinutes(diffInMillis); |
| | | default -> throw new IllegalArgumentException("䏿¯æçæ¶é´åä½"); |
| | | }; |
| | | |
| | | // æ ¡éªæ¶é´è·¨åº¦ä¸è¶
è¿æå¤§éå¶ |
| | | if (diff > maxValue) { |
| | | throw new ServiceException("æå¤§æ¶é´è·¨åº¦ä¸º " + maxValue + " " + unit.toString().toLowerCase()); |
| | | } |
| | | } |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.common.core.utils;
|
| | |
|
| | | import cn.hutool.core.util.ObjectUtil;
|
| | | import lombok.AccessLevel;
|
| | | import lombok.NoArgsConstructor;
|
| | |
|
| | | import java.util.function.Function;
|
| | |
|
| | | /**
|
| | | * 对象工å
·ç±»
|
| | | *
|
| | | * @author ç§è¾æªå¯
|
| | | */
|
| | | @NoArgsConstructor(access = AccessLevel.PRIVATE)
|
| | | public class ObjectUtils extends ObjectUtil {
|
| | |
|
| | | /**
|
| | | * å¦æå¯¹è±¡ä¸ä¸ºç©ºï¼åè·å对象ä¸çæä¸ªå段 ObjectUtils.notNullGetter(user, User::getName);
|
| | | *
|
| | | * @param obj 对象
|
| | | * @param func è·åæ¹æ³
|
| | | * @return å¯¹è±¡åæ®µ
|
| | | */
|
| | | public static <T, E> E notNullGetter(T obj, Function<T, E> func) {
|
| | | if (isNotNull(obj) && isNotNull(func)) {
|
| | | return func.apply(obj);
|
| | | }
|
| | | return null;
|
| | | }
|
| | |
|
| | | /**
|
| | | * å¦æå¯¹è±¡ä¸ä¸ºç©ºï¼åè·å对象ä¸çæä¸ªå段ï¼å¦åè¿åé»è®¤å¼
|
| | | *
|
| | | * @param obj 对象
|
| | | * @param func è·åæ¹æ³
|
| | | * @param defaultValue é»è®¤å¼
|
| | | * @return å¯¹è±¡åæ®µ
|
| | | */
|
| | | public static <T, E> E notNullGetter(T obj, Function<T, E> func, E defaultValue) {
|
| | | if (isNotNull(obj) && isNotNull(func)) {
|
| | | return func.apply(obj);
|
| | | }
|
| | | return defaultValue;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 妿å¼ä¸ä¸ºç©ºï¼åè¿åå¼ï¼å¦åè¿åé»è®¤å¼
|
| | | *
|
| | | * @param obj 对象
|
| | | * @param defaultValue é»è®¤å¼
|
| | | * @return å¯¹è±¡åæ®µ
|
| | | */
|
| | | public static <T> T notNull(T obj, T defaultValue) {
|
| | | if (isNotNull(obj)) {
|
| | | return obj;
|
| | | }
|
| | | return defaultValue;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 客æ·ç«¯å·¥å
·ç±» |
| | | * 客æ·ç«¯å·¥å
·ç±»ï¼æä¾è·å请æ±åæ°ãååºå¤çã头é¨ä¿¡æ¯çå¸¸ç¨æä½ |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | |
| | | public class ServletUtils extends JakartaServletUtil { |
| | | |
| | | /** |
| | | * è·åStringåæ° |
| | | * è·åæå®åç§°ç String ç±»åç请æ±åæ° |
| | | * |
| | | * @param name åæ°å |
| | | * @return åæ°å¼ |
| | | */ |
| | | public static String getParameter(String name) { |
| | | return getRequest().getParameter(name); |
| | | } |
| | | |
| | | /** |
| | | * è·åStringåæ° |
| | | * è·åæå®åç§°ç String ç±»åç请æ±åæ°ï¼è¥åæ°ä¸åå¨ï¼åè¿åé»è®¤å¼ |
| | | * |
| | | * @param name åæ°å |
| | | * @param defaultValue é»è®¤å¼ |
| | | * @return 忰弿é»è®¤å¼ |
| | | */ |
| | | public static String getParameter(String name, String defaultValue) { |
| | | return Convert.toStr(getRequest().getParameter(name), defaultValue); |
| | | } |
| | | |
| | | /** |
| | | * è·åIntegeråæ° |
| | | * è·åæå®åç§°ç Integer ç±»åç请æ±åæ° |
| | | * |
| | | * @param name åæ°å |
| | | * @return åæ°å¼ |
| | | */ |
| | | public static Integer getParameterToInt(String name) { |
| | | return Convert.toInt(getRequest().getParameter(name)); |
| | | } |
| | | |
| | | /** |
| | | * è·åIntegeråæ° |
| | | * è·åæå®åç§°ç Integer ç±»åç请æ±åæ°ï¼è¥åæ°ä¸åå¨ï¼åè¿åé»è®¤å¼ |
| | | * |
| | | * @param name åæ°å |
| | | * @param defaultValue é»è®¤å¼ |
| | | * @return 忰弿é»è®¤å¼ |
| | | */ |
| | | public static Integer getParameterToInt(String name, Integer defaultValue) { |
| | | return Convert.toInt(getRequest().getParameter(name), defaultValue); |
| | | } |
| | | |
| | | /** |
| | | * è·åBooleanåæ° |
| | | * è·åæå®åç§°ç Boolean ç±»åç请æ±åæ° |
| | | * |
| | | * @param name åæ°å |
| | | * @return åæ°å¼ |
| | | */ |
| | | public static Boolean getParameterToBool(String name) { |
| | | return Convert.toBool(getRequest().getParameter(name)); |
| | | } |
| | | |
| | | /** |
| | | * è·åBooleanåæ° |
| | | * è·åæå®åç§°ç Boolean ç±»åç请æ±åæ°ï¼è¥åæ°ä¸åå¨ï¼åè¿åé»è®¤å¼ |
| | | * |
| | | * @param name åæ°å |
| | | * @param defaultValue é»è®¤å¼ |
| | | * @return 忰弿é»è®¤å¼ |
| | | */ |
| | | public static Boolean getParameterToBool(String name, Boolean defaultValue) { |
| | | return Convert.toBool(getRequest().getParameter(name), defaultValue); |
| | | } |
| | | |
| | | /** |
| | | * è·å¾ææè¯·æ±åæ° |
| | | * è·åææè¯·æ±åæ°ï¼ä»¥ Map çå½¢å¼è¿åï¼ |
| | | * |
| | | * @param request 请æ±å¯¹è±¡{@link ServletRequest} |
| | | * @return Map |
| | | * @return 请æ±åæ°ç Mapï¼é®ä¸ºåæ°åï¼å¼ä¸ºåæ°å¼æ°ç» |
| | | */ |
| | | public static Map<String, String[]> getParams(ServletRequest request) { |
| | | final Map<String, String[]> map = request.getParameterMap(); |
| | |
| | | } |
| | | |
| | | /** |
| | | * è·å¾ææè¯·æ±åæ° |
| | | * è·åææè¯·æ±åæ°ï¼ä»¥ Map çå½¢å¼è¿åï¼å¼ä¸ºå符串形å¼çæ¼æ¥ï¼ |
| | | * |
| | | * @param request 请æ±å¯¹è±¡{@link ServletRequest} |
| | | * @return Map |
| | | * @return 请æ±åæ°ç Mapï¼é®ä¸ºåæ°åï¼å¼ä¸ºæ¼æ¥åçå符串 |
| | | */ |
| | | public static Map<String, String> getParamMap(ServletRequest request) { |
| | | Map<String, String> params = new HashMap<>(); |
| | |
| | | } |
| | | |
| | | /** |
| | | * è·årequest |
| | | * è·åå½å HTTP 请æ±å¯¹è±¡ |
| | | * |
| | | * @return å½å HTTP 请æ±å¯¹è±¡ |
| | | */ |
| | | public static HttpServletRequest getRequest() { |
| | | try { |
| | |
| | | } |
| | | |
| | | /** |
| | | * è·åresponse |
| | | * è·åå½å HTTP ååºå¯¹è±¡ |
| | | * |
| | | * @return å½å HTTP ååºå¯¹è±¡ |
| | | */ |
| | | public static HttpServletResponse getResponse() { |
| | | try { |
| | |
| | | } |
| | | |
| | | /** |
| | | * è·åsession |
| | | * è·åå½å请æ±ç HttpSession 对象 |
| | | * <p> |
| | | * 妿å½å请æ±å·²ç»å
³èäºä¸ä¸ªä¼è¯ï¼å³å·²ç»å卿æç session IDï¼ï¼ |
| | | * åè¿å该ä¼è¯å¯¹è±¡ï¼å¦ææ²¡æå
³èä¼è¯ï¼åä¼å建ä¸ä¸ªæ°çä¼è¯å¯¹è±¡å¹¶è¿åã |
| | | * <p> |
| | | * HttpSession ç¨äºåå¨ä¼è¯çº§å«çæ°æ®ï¼å¦ç¨æ·ç»å½ä¿¡æ¯ãè´ç©è½¦å
容çï¼ |
| | | * å¯ä»¥å¨å¤ä¸ªè¯·æ±ä¹é´å
±äº«ä¼è¯æ°æ® |
| | | * |
| | | * @return å½å请æ±ç HttpSession 对象 |
| | | */ |
| | | public static HttpSession getSession() { |
| | | return getRequest().getSession(); |
| | | } |
| | | |
| | | /** |
| | | * è·åå½å请æ±ç请æ±å±æ§ |
| | | * |
| | | * @return {@link ServletRequestAttributes} 请æ±å±æ§å¯¹è±¡ |
| | | */ |
| | | public static ServletRequestAttributes getRequestAttributes() { |
| | | try { |
| | | RequestAttributes attributes = RequestContextHolder.getRequestAttributes(); |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * è·åæå®è¯·æ±å¤´çå¼ï¼å¦æå¤´é¨ä¸ºç©ºåè¿å空å符串 |
| | | * |
| | | * @param request 请æ±å¯¹è±¡ |
| | | * @param name 头é¨åç§° |
| | | * @return 头é¨å¼ |
| | | */ |
| | | public static String getHeader(HttpServletRequest request, String name) { |
| | | String value = request.getHeader(name); |
| | | if (StringUtils.isEmpty(value)) { |
| | |
| | | return urlDecode(value); |
| | | } |
| | | |
| | | /** |
| | | * è·åææè¯·æ±å¤´ç Mapï¼é®ä¸ºå¤´é¨åç§°ï¼å¼ä¸ºå¤´é¨å¼ |
| | | * |
| | | * @param request 请æ±å¯¹è±¡ |
| | | * @return 请æ±å¤´ç Map |
| | | */ |
| | | public static Map<String, String> getHeaders(HttpServletRequest request) { |
| | | Map<String, String> map = new LinkedCaseInsensitiveMap<>(); |
| | | Enumeration<String> enumeration = request.getHeaderNames(); |
| | |
| | | } |
| | | |
| | | /** |
| | | * å°å符串渲æå°å®¢æ·ç«¯ |
| | | * å°å符串渲æå°å®¢æ·ç«¯ï¼ä»¥ JSON æ ¼å¼è¿åï¼ |
| | | * |
| | | * @param response 渲æå¯¹è±¡ |
| | | * @param string å¾
渲æçå符串 |
| | |
| | | } |
| | | |
| | | /** |
| | | * æ¯å¦æ¯Ajax弿¥è¯·æ± |
| | | * 夿å½åè¯·æ±æ¯å¦ä¸º Ajax 弿¥è¯·æ± |
| | | * |
| | | * @param request |
| | | * @param request 请æ±å¯¹è±¡ |
| | | * @return æ¯å¦ä¸º Ajax è¯·æ± |
| | | */ |
| | | public static boolean isAjaxRequest(HttpServletRequest request) { |
| | | |
| | | // 夿 Accept 头鍿¯å¦å
å« application/json |
| | | String accept = request.getHeader("accept"); |
| | | if (accept != null && accept.contains(MediaType.APPLICATION_JSON_VALUE)) { |
| | | return true; |
| | | } |
| | | |
| | | // 夿 X-Requested-With 头鍿¯å¦å
å« XMLHttpRequest |
| | | String xRequestedWith = request.getHeader("X-Requested-With"); |
| | | if (xRequestedWith != null && xRequestedWith.contains("XMLHttpRequest")) { |
| | | return true; |
| | | } |
| | | |
| | | // 夿 URI åç¼æ¯å¦ä¸º .json æ .xml |
| | | String uri = request.getRequestURI(); |
| | | if (StringUtils.equalsAnyIgnoreCase(uri, ".json", ".xml")) { |
| | | return true; |
| | | } |
| | | |
| | | // å¤æè¯·æ±åæ° __ajax æ¯å¦ä¸º json æ xml |
| | | String ajax = request.getParameter("__ajax"); |
| | | return StringUtils.equalsAnyIgnoreCase(ajax, "json", "xml"); |
| | | } |
| | | |
| | | /** |
| | | * è·å客æ·ç«¯ IP å°å |
| | | * |
| | | * @return 客æ·ç«¯ IP å°å |
| | | */ |
| | | public static String getClientIP() { |
| | | return getClientIP(getRequest()); |
| | | } |
| | | |
| | | /** |
| | | * å
容ç¼ç |
| | | * 对å
容è¿è¡ URL ç¼ç |
| | | * |
| | | * @param str å
容 |
| | | * @return ç¼ç åçå
容 |
| | |
| | | } |
| | | |
| | | /** |
| | | * å
容解ç |
| | | * 对å
容è¿è¡ URL è§£ç |
| | | * |
| | | * @param str å
容 |
| | | * @return è§£ç åçå
容 |
| | |
| | | import cn.hutool.core.convert.Convert; |
| | | import cn.hutool.core.lang.Validator; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import lombok.AccessLevel; |
| | | import lombok.NoArgsConstructor; |
| | | import org.springframework.util.AntPathMatcher; |
| | | |
| | | import java.util.*; |
| | |
| | | * |
| | | * @author Lion Li |
| | | */ |
| | | @NoArgsConstructor(access = AccessLevel.PRIVATE) |
| | | public class StringUtils extends org.apache.commons.lang3.StringUtils { |
| | | |
| | | public static final String SEPARATOR = ","; |
| | | |
| | | public static final String SLASH = "/"; |
| | | |
| | | @Deprecated |
| | | private StringUtils() { |
| | | } |
| | | |
| | | /** |
| | | * è·ååæ°ä¸ä¸ºç©ºå¼ |
| | |
| | | .stream() |
| | | .filter(Objects::nonNull) |
| | | .map(mapper) |
| | | .filter(Objects::nonNull) |
| | | .collect(Collectors.toList()); |
| | | } |
| | | |
| | | /** |
| | | * ä¸åºå大å°åæ£æ¥ CharSequence æ¯å¦ä»¥æå®çåç¼å¼å¤´ã |
| | | * |
| | | * @param str è¦æ£æ¥ç CharSequence å¯è½ä¸º null |
| | | * @param prefixs è¦æ¥æ¾çåç¼å¯è½ä¸º null |
| | | * @return æ¯å¦å
å« |
| | | */ |
| | | public static boolean startWithAnyIgnoreCase(CharSequence str, CharSequence... prefixs) { |
| | | // 夿æ¯å¦æ¯ä»¥æå®å符串å¼å¤´ |
| | | for (CharSequence prefix : prefixs) { |
| | | if (StringUtils.startsWithIgnoreCase(str, prefix)) { |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | } |
| | |
| | | @Slf4j |
| | | @NoArgsConstructor(access = AccessLevel.PRIVATE) |
| | | public class Threads { |
| | | |
| | | /** |
| | | * sleepçå¾
,åä½ä¸ºæ¯«ç§ |
| | | */ |
| | | public static void sleep(long milliseconds) { |
| | | try { |
| | | Thread.sleep(milliseconds); |
| | | } catch (InterruptedException e) { |
| | | return; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * åæ¢çº¿ç¨æ± |
| | | * å
使ç¨shutdown, åæ¢æ¥æ¶æ°ä»»å¡å¹¶å°è¯å®æææå·²åå¨ä»»å¡. |
| | |
| | | import cn.hutool.core.lang.tree.TreeNodeConfig; |
| | | import cn.hutool.core.lang.tree.TreeUtil; |
| | | import cn.hutool.core.lang.tree.parser.NodeParser; |
| | | import org.dromara.common.core.utils.reflect.ReflectUtils; |
| | | import lombok.AccessLevel; |
| | | import lombok.NoArgsConstructor; |
| | | import org.dromara.common.core.utils.reflect.ReflectUtils; |
| | | |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | import java.util.stream.Stream; |
| | | |
| | | /** |
| | | * æ©å± hutool TreeUtil å°è£
ç³»ç»æ æå»º |
| | |
| | | */ |
| | | public static final TreeNodeConfig DEFAULT_CONFIG = TreeNodeConfig.DEFAULT_CONFIG.setNameKey("label"); |
| | | |
| | | /** |
| | | * æå»ºæ å½¢ç»æ |
| | | * |
| | | * @param <T> è¾å
¥èç¹çç±»å |
| | | * @param <K> èç¹IDçç±»å |
| | | * @param list èç¹å表ï¼å
¶ä¸å
å«äºè¦æå»ºæ å½¢ç»æçææèç¹ |
| | | * @param nodeParser è§£æå¨ï¼ç¨äºå°è¾å
¥èç¹è½¬æ¢ä¸ºæ èç¹ |
| | | * @return æå»ºå¥½çæ å½¢ç»æå表 |
| | | */ |
| | | public static <T, K> List<Tree<K>> build(List<T> list, NodeParser<T, K> nodeParser) { |
| | | if (CollUtil.isEmpty(list)) { |
| | | return null; |
| | | return CollUtil.newArrayList(); |
| | | } |
| | | K k = ReflectUtils.invokeGetter(list.get(0), "parentId"); |
| | | return TreeUtil.build(list, k, DEFAULT_CONFIG, nodeParser); |
| | | } |
| | | |
| | | /** |
| | | * æå»ºæ å½¢ç»æ |
| | | * |
| | | * @param <T> è¾å
¥èç¹çç±»å |
| | | * @param <K> èç¹IDçç±»å |
| | | * @param parentId 顶级èç¹ |
| | | * @param list èç¹å表ï¼å
¶ä¸å
å«äºè¦æå»ºæ å½¢ç»æçææèç¹ |
| | | * @param nodeParser è§£æå¨ï¼ç¨äºå°è¾å
¥èç¹è½¬æ¢ä¸ºæ èç¹ |
| | | * @return æå»ºå¥½çæ å½¢ç»æå表 |
| | | */ |
| | | public static <T, K> List<Tree<K>> build(List<T> list, K parentId, NodeParser<T, K> nodeParser) { |
| | | if (CollUtil.isEmpty(list)) { |
| | | return CollUtil.newArrayList(); |
| | | } |
| | | return TreeUtil.build(list, parentId, DEFAULT_CONFIG, nodeParser); |
| | | } |
| | | |
| | | /** |
| | | * è·åèç¹åè¡¨ä¸ææèç¹çå¶åèç¹ |
| | | * |
| | | * @param <K> èç¹IDçç±»å |
| | | * @param nodes èç¹å表 |
| | | * @return å
嫿æå¶åèç¹çå表 |
| | | */ |
| | | public static <K> List<Tree<K>> getLeafNodes(List<Tree<K>> nodes) { |
| | | if (CollUtil.isEmpty(nodes)) { |
| | | return CollUtil.newArrayList(); |
| | | } |
| | | return nodes.stream() |
| | | .flatMap(TreeBuildUtils::extractLeafNodes) |
| | | .collect(Collectors.toList()); |
| | | } |
| | | |
| | | /** |
| | | * è·åæå®èç¹ä¸çææå¶åèç¹ |
| | | * |
| | | * @param <K> èç¹IDçç±»å |
| | | * @param node è¦æ¥æ¾å¶åèç¹çæ ¹èç¹ |
| | | * @return å
嫿æå¶åèç¹çå表 |
| | | */ |
| | | private static <K> Stream<Tree<K>> extractLeafNodes(Tree<K> node) { |
| | | if (!node.hasChild()) { |
| | | return Stream.of(node); |
| | | } else { |
| | | // éå½è°ç¨ï¼è·åææåèç¹çå¶åèç¹ |
| | | return node.getChildren().stream() |
| | | .flatMap(TreeBuildUtils::extractLeafNodes); |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | */ |
| | | public static String extractFromString(String input, String regex, String defaultInput) { |
| | | try { |
| | | return ReUtil.get(regex, input, 1); |
| | | String str = ReUtil.get(regex, input, 1); |
| | | return str == null ? defaultInput : str; |
| | | } catch (Exception e) { |
| | | return defaultInput; |
| | | } |
| | |
| | | /** |
| | | * å®ä¹å¸¸ç¨ç sqlå
³é®å |
| | | */ |
| | | public static final String SQL_REGEX = "select |insert |delete |update |drop |count |exec |chr |mid |master |truncate |char |and |declare "; |
| | | public static String SQL_REGEX = "\u000B|and |extractvalue|updatexml|sleep|exec |insert |select |delete |update |drop |count |chr |mid |master |truncate |char |declare |or |union |like |+|/*|user()"; |
| | | |
| | | /** |
| | | * ä»
æ¯æåæ¯ãæ°åãä¸å线ãç©ºæ ¼ãéå·ãå°æ°ç¹ï¼æ¯æå¤ä¸ªå段æåºï¼ |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.common.core.validate.enumd;
|
| | |
|
| | | import jakarta.validation.Constraint;
|
| | | import jakarta.validation.Payload;
|
| | |
|
| | | import java.lang.annotation.*;
|
| | |
|
| | | import static java.lang.annotation.ElementType.*;
|
| | | import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
| | |
|
| | | /**
|
| | | * èªå®ä¹æä¸¾æ ¡éª
|
| | | *
|
| | | * @author ç§è¾æªå¯
|
| | | * @date 2024-12-09
|
| | | */
|
| | | @Documented
|
| | | @Target({METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER, TYPE_USE})
|
| | | @Retention(RUNTIME)
|
| | | @Repeatable(EnumPattern.List.class) // å
许å¨åä¸å
ç´ ä¸å¤æ¬¡ä½¿ç¨è¯¥æ³¨è§£
|
| | | @Constraint(validatedBy = {EnumPatternValidator.class})
|
| | | public @interface EnumPattern {
|
| | |
|
| | | /**
|
| | | * éè¦æ ¡éªçæä¸¾ç±»å
|
| | | */
|
| | | Class<? extends Enum<?>> type();
|
| | |
|
| | | /**
|
| | | * æä¸¾ç±»åæ ¡éªå¼å段åç§°
|
| | | * éç¡®ä¿è¯¥å段å®ç°äº getter æ¹æ³
|
| | | */
|
| | | String fieldName();
|
| | |
|
| | | String message() default "è¾å
¥å¼ä¸å¨æä¸¾èå´å
";
|
| | |
|
| | | Class<?>[] groups() default {};
|
| | |
|
| | | Class<? extends Payload>[] payload() default {};
|
| | |
|
| | | @Documented
|
| | | @Target({METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER, TYPE_USE})
|
| | | @Retention(RUNTIME)
|
| | | @interface List {
|
| | | EnumPattern[] value();
|
| | | }
|
| | |
|
| | | }
|
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.common.core.validate.enumd;
|
| | |
|
| | | import jakarta.validation.ConstraintValidator;
|
| | | import jakarta.validation.ConstraintValidatorContext;
|
| | | import org.dromara.common.core.utils.StringUtils;
|
| | | import org.dromara.common.core.utils.reflect.ReflectUtils;
|
| | |
|
| | | /**
|
| | | * èªå®ä¹æä¸¾æ ¡éªæ³¨è§£å®ç°
|
| | | *
|
| | | * @author ç§è¾æªå¯
|
| | | * @date 2024-12-09
|
| | | */
|
| | | public class EnumPatternValidator implements ConstraintValidator<EnumPattern, String> {
|
| | |
|
| | | private EnumPattern annotation;;
|
| | |
|
| | | @Override
|
| | | public void initialize(EnumPattern annotation) {
|
| | | ConstraintValidator.super.initialize(annotation);
|
| | | this.annotation = annotation;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public boolean isValid(String value, ConstraintValidatorContext constraintValidatorContext) {
|
| | | if (StringUtils.isNotBlank(value)) {
|
| | | String fieldName = annotation.fieldName();
|
| | | for (Object e : annotation.type().getEnumConstants()) {
|
| | | if (value.equals(ReflectUtils.invokeGetter(e, fieldName))) {
|
| | | return true;
|
| | | }
|
| | | }
|
| | | }
|
| | | return false;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | package org.dromara.common.encrypt.core; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import cn.hutool.core.util.ReflectUtil; |
| | | import lombok.NoArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.ibatis.io.Resources; |
| | | import org.dromara.common.core.utils.ObjectUtils; |
| | | import org.dromara.common.core.utils.StringUtils; |
| | | import org.dromara.common.encrypt.annotation.EncryptField; |
| | | import org.springframework.context.ConfigurableApplicationContext; |
| | |
| | | import org.springframework.util.ClassUtils; |
| | | |
| | | import java.lang.reflect.Field; |
| | | import java.util.*; |
| | | import java.util.Arrays; |
| | | import java.util.HashSet; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | /** |
| | | * ç¼åå å¯å¨ |
| | | */ |
| | | Map<EncryptContext, IEncryptor> encryptorMap = new ConcurrentHashMap<>(); |
| | | Map<Integer, IEncryptor> encryptorMap = new ConcurrentHashMap<>(); |
| | | |
| | | /** |
| | | * ç±»å å¯å段ç¼å |
| | |
| | | * è·åç±»å å¯å段ç¼å |
| | | */ |
| | | public Set<Field> getFieldCache(Class<?> sourceClazz) { |
| | | if (ObjectUtil.isNotNull(fieldCache)) { |
| | | return fieldCache.get(sourceClazz); |
| | | } |
| | | return null; |
| | | return ObjectUtils.notNullGetter(fieldCache, f -> f.get(sourceClazz)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @param encryptContext å 坿§è¡è
éè¦çç¸å
³é
ç½®åæ° |
| | | */ |
| | | public IEncryptor registAndGetEncryptor(EncryptContext encryptContext) { |
| | | if (encryptorMap.containsKey(encryptContext)) { |
| | | return encryptorMap.get(encryptContext); |
| | | int key = encryptContext.hashCode(); |
| | | if (encryptorMap.containsKey(key)) { |
| | | return encryptorMap.get(key); |
| | | } |
| | | IEncryptor encryptor = ReflectUtil.newInstance(encryptContext.getAlgorithm().getClazz(), encryptContext); |
| | | encryptorMap.put(encryptContext, encryptor); |
| | | encryptorMap.put(key, encryptor); |
| | | return encryptor; |
| | | } |
| | | |
| | |
| | | * @param encryptContext å 坿§è¡è
éè¦çç¸å
³é
ç½®åæ° |
| | | */ |
| | | public void removeEncryptor(EncryptContext encryptContext) { |
| | | this.encryptorMap.remove(encryptContext); |
| | | this.encryptorMap.remove(encryptContext.hashCode()); |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | return null; |
| | | } |
| | | return null; |
| | | } |
| | |
| | | * @author è马 |
| | | */ |
| | | public class EncryptUtils { |
| | | |
| | | /** |
| | | * å
¬é¥ |
| | | */ |
| | | public static final String PUBLIC_KEY = "publicKey"; |
| | | |
| | | /** |
| | | * ç§é¥ |
| | | */ |
| | |
| | | /** |
| | | * AESå å¯ |
| | | * |
| | | * @param data å¾
è§£å¯æ°æ® |
| | | * @param data å¾
å 坿°æ® |
| | | * @param password ç§é¥å符串 |
| | | * @return å å¯åå符串, éç¨Base64ç¼ç |
| | | */ |
| | |
| | | /** |
| | | * AESå å¯ |
| | | * |
| | | * @param data å¾
è§£å¯æ°æ® |
| | | * @param data å¾
å 坿°æ® |
| | | * @param password ç§é¥å符串 |
| | | * @return å å¯åå符串, éç¨Hexç¼ç |
| | | */ |
| | |
| | | /** |
| | | * sm2ç§é¥è§£å¯ |
| | | * |
| | | * @param data å¾
å 坿°æ® |
| | | * @param data å¾
è§£å¯æ°æ® |
| | | * @param privateKey ç§é¥ |
| | | * @return è§£å¯åå符串 |
| | | */ |
| | |
| | | /** |
| | | * rsaç§é¥è§£å¯ |
| | | * |
| | | * @param data å¾
å 坿°æ® |
| | | * @param data å¾
è§£å¯æ°æ® |
| | | * @param privateKey ç§é¥ |
| | | * @return è§£å¯åå符串 |
| | | */ |
| | |
| | | <groupId>com.alibaba</groupId> |
| | | <artifactId>easyexcel</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <artifactId>commons-compress</artifactId> |
| | | <groupId>org.apache.commons</groupId> |
| | | <version>1.26.2</version> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | </project> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.common.excel.annotation; |
| | | |
| | | import java.lang.annotation.ElementType; |
| | | import java.lang.annotation.Retention; |
| | | import java.lang.annotation.RetentionPolicy; |
| | | import java.lang.annotation.Target; |
| | | |
| | | /** |
| | | * æ¹æ³¨ |
| | | * @author guzhouyanyu |
| | | */ |
| | | @Target({ElementType.FIELD}) |
| | | @Retention(RetentionPolicy.RUNTIME) |
| | | public @interface ExcelNotation { |
| | | |
| | | /** |
| | | * col index |
| | | */ |
| | | int index() default -1; |
| | | /** |
| | | * æ¹æ³¨å
容 |
| | | */ |
| | | String value() default ""; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.common.excel.annotation; |
| | | |
| | | import org.apache.poi.ss.usermodel.IndexedColors; |
| | | |
| | | import java.lang.annotation.ElementType; |
| | | import java.lang.annotation.Retention; |
| | | import java.lang.annotation.RetentionPolicy; |
| | | import java.lang.annotation.Target; |
| | | |
| | | /** |
| | | * æ¯å¦å¿
å¡« |
| | | * @author guzhouyanyu |
| | | */ |
| | | @Target({ElementType.FIELD}) |
| | | @Retention(RetentionPolicy.RUNTIME) |
| | | public @interface ExcelRequired { |
| | | |
| | | /** |
| | | * col index |
| | | */ |
| | | int index() default -1; |
| | | /** |
| | | * åä½é¢è² |
| | | */ |
| | | IndexedColors fontColor() default IndexedColors.RED; |
| | | } |
| | |
| | | * 䏿å¯é项 |
| | | */ |
| | | private final List<DropDownOptions> dropDownOptions; |
| | | private final DictService dictService; |
| | | /** |
| | | * å½ååéè¿åº¦ |
| | | */ |
| | |
| | | * å½åèå¨éæ©è¿åº¦ |
| | | */ |
| | | private int currentLinkedOptionsSheetIndex; |
| | | private final DictService dictService; |
| | | |
| | | public ExcelDownHandler(List<DropDownOptions> options) { |
| | | this.dropDownOptions = options; |
| | |
| | | } else if (everyOptions.getOptions().size() > 10) { |
| | | // å½ä¸çº§éé¡¹åæ°ä¸ªæ°å¤§äº10ï¼ä½¿ç¨é¢å¤è¡¨çå½¢å¼ |
| | | dropDownWithSheet(helper, workbook, sheet, everyOptions.getIndex(), everyOptions.getOptions()); |
| | | } else if (everyOptions.getOptions().size() != 0) { |
| | | // å½ä¸çº§é项个æ°ä¸ä¸ºç©ºï¼ä½¿ç¨é»è®¤å½¢å¼ |
| | | } else { |
| | | // å¦å使ç¨é»è®¤å½¢å¼ |
| | | dropDownWithSimple(helper, sheet, everyOptions.getIndex(), everyOptions.getOptions()); |
| | | } |
| | | }); |
| | |
| | | Sheet linkedOptionsDataSheet = workbook.createSheet(WorkbookUtil.createSafeSheetName(linkedOptionsSheetName)); |
| | | // å°ä¸æè¡¨éè |
| | | workbook.setSheetHidden(workbook.getSheetIndex(linkedOptionsDataSheet), true); |
| | | // å®å横åçä¸çº§éé¡¹æ°æ®è¡¨ |
| | | // éé¡¹æ°æ® |
| | | List<String> firstOptions = options.getOptions(); |
| | | Map<String, List<String>> secoundOptionsMap = options.getNextOptions(); |
| | | |
| | | // éç¨æè¡å¡«å
æ°æ®çæ¹å¼ï¼é¿å
EasyExcelåºç°æ°æ®æ æ³åå
¥çé®é¢ |
| | | // Attempting to write a row in the range that is already written to disk |
| | | |
| | | // 使ç¨ArrayListè®°è½½æ°æ®ï¼é²æ¢ä¹±åº |
| | | List<String> columnNames = new ArrayList<>(); |
| | | // åå
¥ç¬¬ä¸è¡ï¼å³ç¬¬ä¸çº§çæ°æ® |
| | | Row firstRow = linkedOptionsDataSheet.createRow(0); |
| | | for (int columnIndex = 0; columnIndex < firstOptions.size(); columnIndex++) { |
| | | String columnName = firstOptions.get(columnIndex); |
| | | firstRow.createCell(columnIndex) |
| | | .setCellValue(columnName); |
| | | columnNames.add(columnName); |
| | | } |
| | | |
| | | // å建å称管çå¨ |
| | | Name name = workbook.createName(); |
| | |
| | | // è®¾ç½®æ°æ®æ ¡éªä¸ºåºå模å¼ï¼å¼ç¨çæ¯å称管çå¨ä¸çå«å |
| | | this.markOptionsToSheet(helper, sheet, options.getIndex(), helper.createFormulaListConstraint(linkedOptionsSheetName)); |
| | | |
| | | for (int columIndex = 0; columIndex < firstOptions.size(); columIndex++) { |
| | | // å
æå主表ä¸ä¸çº§ä¸æçåå |
| | | // å建äºçº§é项çå称管çå¨ |
| | | for (int columIndex = 0; columIndex < columnNames.size(); columIndex++) { |
| | | // åå |
| | | String firstOptionsColumnName = getExcelColumnName(columIndex); |
| | | // 䏿¬¡å¾ªç¯æ¯æ¯ä¸ä¸ªä¸çº§é项 |
| | | int finalI = columIndex; |
| | | // æ¬æ¬¡å¾ªç¯çä¸çº§éé¡¹å¼ |
| | | String thisFirstOptionsValue = firstOptions.get(columIndex); |
| | | // å建第ä¸è¡çæ°æ® |
| | | Optional.ofNullable(linkedOptionsDataSheet.getRow(0)) |
| | | // 妿ä¸åå¨åå建第ä¸è¡ |
| | | .orElseGet(() -> linkedOptionsDataSheet.createRow(finalI)) |
| | | // 第ä¸è¡å½åå |
| | | .createCell(columIndex) |
| | | // 设置å¼ä¸ºå½åä¸çº§éé¡¹å¼ |
| | | .setCellValue(thisFirstOptionsValue); |
| | | |
| | | // 第äºè¡å¼å§ï¼è®¾ç½®ç¬¬äºçº§å«é项忰 |
| | | List<String> secondOptions = secoundOptionsMap.get(thisFirstOptionsValue); |
| | | if (CollUtil.isEmpty(secondOptions)) { |
| | | // å¿
é¡»ä¿è¯è³å°æä¸ä¸ªå
³èé项ï¼å¦åå°å¯¼è´Excelè§£æé误 |
| | | secondOptions = Collections.singletonList("ææ _0"); |
| | | } |
| | | // 对åºçä¸çº§å¼ |
| | | String thisFirstOptionsValue = columnNames.get(columIndex); |
| | | |
| | | // 以该ä¸çº§é项å¼å建åå称管çå¨ |
| | | Name sonName = workbook.createName(); |
| | |
| | | linkedOptionsSheetName, |
| | | firstOptionsColumnName, |
| | | firstOptionsColumnName, |
| | | secondOptions.size() + 1 |
| | | // äºçº§é项åå¨å设置为(é项个æ°+1)è¡ï¼å¦å设置为2è¡ |
| | | Math.max(Optional.ofNullable(secoundOptionsMap.get(thisFirstOptionsValue)) |
| | | .orElseGet(ArrayList::new).size(), 1) + 1 |
| | | ); |
| | | // 设置å称管çå¨çå¼ç¨ä½ç½® |
| | | sonName.setRefersToFormula(sonFunction); |
| | |
| | | // äºçº§åªè½ä¸»è¡¨æ¯ä¸è¡çæ¯ä¸åæ·»å äºçº§æ ¡éª |
| | | markLinkedOptionsToSheet(helper, sheet, i, options.getNextIndex(), helper.createFormulaListConstraint(secondOptionsFunction)); |
| | | } |
| | | } |
| | | |
| | | for (int rowIndex = 0; rowIndex < secondOptions.size(); rowIndex++) { |
| | | // ä»ç¬¬äºè¡å¼å§å¡«å
äºçº§é项 |
| | | int finalRowIndex = rowIndex + 1; |
| | | int finalColumIndex = columIndex; |
| | | |
| | | Row row = Optional.ofNullable(linkedOptionsDataSheet.getRow(finalRowIndex)) |
| | | // 没æåå建 |
| | | .orElseGet(() -> linkedOptionsDataSheet.createRow(finalRowIndex)); |
| | | Optional |
| | | // 卿¬çº§ä¸çº§é项æå¨çå |
| | | .ofNullable(row.getCell(finalColumIndex)) |
| | | // ä¸åå¨åå建 |
| | | .orElseGet(() -> row.createCell(finalColumIndex)) |
| | | // 设置äºçº§éé¡¹å¼ |
| | | .setCellValue(secondOptions.get(rowIndex)); |
| | | // å°äºçº§æ°æ®å¤ç为æè¡åºå |
| | | Map<Integer, List<String>> columnValueMap = new HashMap<>(); |
| | | int currentRow = 1; |
| | | while (currentRow >= 0) { |
| | | boolean flag = false; |
| | | List<String> rowData = new ArrayList<>(); |
| | | for (String columnName : columnNames) { |
| | | List<String> data = secoundOptionsMap.get(columnName); |
| | | if (CollUtil.isEmpty(data)) { |
| | | // æ·»å 空å符串填å
ä½ç½® |
| | | rowData.add(" "); |
| | | continue; |
| | | } |
| | | // å第ä¸ä¸ª |
| | | String str = data.get(0); |
| | | rowData.add(str); |
| | | // éè¿ç§»é¤çæ¹å¼é¿å
éå¤ |
| | | data.remove(0); |
| | | // 设置å¯ä»¥ç»§ç» |
| | | flag = true; |
| | | } |
| | | columnValueMap.put(currentRow, rowData); |
| | | // å¯ä»¥ç»§ç»ï¼åå¢å è¡æ°ï¼å¦åç½®ä¸ºè´æ°è·³åºå¾ªç¯ |
| | | if (flag) { |
| | | currentRow++; |
| | | } else { |
| | | currentRow = -1; |
| | | } |
| | | } |
| | | |
| | | // å¡«å
第äºçº§éé¡¹æ°æ® |
| | | columnValueMap.forEach((rowIndex, rowValues) -> { |
| | | Row row = linkedOptionsDataSheet.createRow(rowIndex); |
| | | for (int columnIndex = 0; columnIndex < rowValues.size(); columnIndex++) { |
| | | String rowValue = rowValues.get(columnIndex); |
| | | // å¡«å
ä½ç½®çé¨å䏿¸²æ |
| | | if (StrUtil.isNotBlank(rowValue)) { |
| | | row.createCell(columnIndex) |
| | | .setCellValue(rowValue); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | currentLinkedOptionsSheetIndex++; |
| | | } |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.common.excel.handler; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import com.alibaba.excel.metadata.data.DataFormatData; |
| | | import com.alibaba.excel.metadata.data.WriteCellData; |
| | | import com.alibaba.excel.util.StyleUtil; |
| | | import com.alibaba.excel.write.handler.CellWriteHandler; |
| | | import com.alibaba.excel.write.handler.SheetWriteHandler; |
| | | import com.alibaba.excel.write.handler.context.CellWriteHandlerContext; |
| | | import com.alibaba.excel.write.metadata.holder.WriteSheetHolder; |
| | | import com.alibaba.excel.write.metadata.style.WriteCellStyle; |
| | | import com.alibaba.excel.write.metadata.style.WriteFont; |
| | | import org.apache.poi.ss.usermodel.*; |
| | | import org.apache.poi.xssf.usermodel.XSSFClientAnchor; |
| | | import org.apache.poi.xssf.usermodel.XSSFRichTextString; |
| | | import org.dromara.common.core.utils.reflect.ReflectUtils; |
| | | import org.dromara.common.excel.annotation.ExcelNotation; |
| | | import org.dromara.common.excel.annotation.ExcelRequired; |
| | | |
| | | import java.lang.reflect.Field; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * æ¹æ³¨ãå¿
å¡« |
| | | * |
| | | * @author guzhouyanyu |
| | | */ |
| | | public class DataWriteHandler implements SheetWriteHandler, CellWriteHandler { |
| | | |
| | | /** |
| | | * æ¹æ³¨ |
| | | */ |
| | | private final Map<Integer, String> notationMap; |
| | | |
| | | /** |
| | | * 头ååä½é¢è² |
| | | */ |
| | | private final Map<Integer, Short> headColumnMap; |
| | | |
| | | |
| | | public DataWriteHandler(Class<?> clazz) { |
| | | notationMap = getNotationMap(clazz); |
| | | headColumnMap = getRequiredMap(clazz); |
| | | } |
| | | |
| | | @Override |
| | | public void afterCellDispose(CellWriteHandlerContext context) { |
| | | if (CollUtil.isEmpty(notationMap) && CollUtil.isEmpty(headColumnMap)) { |
| | | return; |
| | | } |
| | | WriteCellData<?> cellData = context.getFirstCellData(); |
| | | WriteCellStyle writeCellStyle = cellData.getOrCreateStyle(); |
| | | |
| | | DataFormatData dataFormatData = new DataFormatData(); |
| | | // åå
æ ¼è®¾ç½®ä¸ºææ¬æ ¼å¼ |
| | | dataFormatData.setIndex((short) 49); |
| | | writeCellStyle.setDataFormatData(dataFormatData); |
| | | |
| | | if (context.getHead()) { |
| | | Cell cell = context.getCell(); |
| | | WriteSheetHolder writeSheetHolder = context.getWriteSheetHolder(); |
| | | Sheet sheet = writeSheetHolder.getSheet(); |
| | | Workbook workbook = writeSheetHolder.getSheet().getWorkbook(); |
| | | Drawing<?> drawing = sheet.createDrawingPatriarch(); |
| | | // 设置æ é¢å使 ·å¼ |
| | | WriteFont headWriteFont = new WriteFont(); |
| | | // å ç² |
| | | headWriteFont.setBold(true); |
| | | if (CollUtil.isNotEmpty(headColumnMap) && headColumnMap.containsKey(cell.getColumnIndex())) { |
| | | // 设置åä½é¢è² |
| | | headWriteFont.setColor(headColumnMap.get(cell.getColumnIndex())); |
| | | } |
| | | writeCellStyle.setWriteFont(headWriteFont); |
| | | CellStyle cellStyle = StyleUtil.buildCellStyle(workbook, null, writeCellStyle); |
| | | cell.setCellStyle(cellStyle); |
| | | |
| | | if (CollUtil.isNotEmpty(notationMap) && notationMap.containsKey(cell.getColumnIndex())) { |
| | | // æ¹æ³¨å
容 |
| | | String notationContext = notationMap.get(cell.getColumnIndex()); |
| | | // å建ç»å¾å¯¹è±¡ |
| | | Comment comment = drawing.createCellComment(new XSSFClientAnchor(0, 0, 0, 0, (short) cell.getColumnIndex(), 0, (short) 5, 5)); |
| | | comment.setString(new XSSFRichTextString(notationContext)); |
| | | cell.setCellComment(comment); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * è·åå¿
å¡«å |
| | | */ |
| | | private static Map<Integer, Short> getRequiredMap(Class<?> clazz) { |
| | | Map<Integer, Short> requiredMap = new HashMap<>(); |
| | | Field[] fields = clazz.getDeclaredFields(); |
| | | // æ£æ¥ fields æ°ç»æ¯å¦ä¸ºç©º |
| | | if (fields.length == 0) { |
| | | return requiredMap; |
| | | } |
| | | Field[] filteredFields = ReflectUtils.getFields(clazz, field -> !"serialVersionUID".equals(field.getName())); |
| | | |
| | | for (int i = 0; i < filteredFields.length; i++) { |
| | | Field field = filteredFields[i]; |
| | | if (!field.isAnnotationPresent(ExcelRequired.class)) { |
| | | continue; |
| | | } |
| | | ExcelRequired excelRequired = field.getAnnotation(ExcelRequired.class); |
| | | int columnIndex = excelRequired.index() == -1 ? i : excelRequired.index(); |
| | | requiredMap.put(columnIndex, excelRequired.fontColor().getIndex()); |
| | | } |
| | | return requiredMap; |
| | | } |
| | | |
| | | /** |
| | | * è·åæ¹æ³¨ |
| | | */ |
| | | private static Map<Integer, String> getNotationMap(Class<?> clazz) { |
| | | Map<Integer, String> notationMap = new HashMap<>(); |
| | | Field[] fields = clazz.getDeclaredFields(); |
| | | // æ£æ¥ fields æ°ç»æ¯å¦ä¸ºç©º |
| | | if (fields.length == 0) { |
| | | return notationMap; |
| | | } |
| | | Field[] filteredFields = ReflectUtils.getFields(clazz, field -> !"serialVersionUID".equals(field.getName())); |
| | | for (int i = 0; i < filteredFields.length; i++) { |
| | | Field field = filteredFields[i]; |
| | | if (!field.isAnnotationPresent(ExcelNotation.class)) { |
| | | continue; |
| | | } |
| | | ExcelNotation excelNotation = field.getAnnotation(ExcelNotation.class); |
| | | int columnIndex = excelNotation.index() == -1 ? i : excelNotation.index(); |
| | | notationMap.put(columnIndex, excelNotation.value()); |
| | | } |
| | | return notationMap; |
| | | } |
| | | } |
| | |
| | | import org.dromara.common.core.utils.file.FileUtils; |
| | | import org.dromara.common.excel.convert.ExcelBigNumberConvert; |
| | | import org.dromara.common.excel.core.*; |
| | | import org.dromara.common.excel.handler.DataWriteHandler; |
| | | |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | |
| | | .registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()) |
| | | // 大æ°å¼èªå¨è½¬æ¢ 鲿¢å¤±ç |
| | | .registerConverter(new ExcelBigNumberConvert()) |
| | | .registerWriteHandler(new DataWriteHandler(clazz)) |
| | | .sheet(sheetName); |
| | | if (merge) { |
| | | // åå¹¶å¤çå¨ |
| | |
| | | * @param data 模æ¿éè¦çæ°æ® |
| | | * @param response ååºä½ |
| | | */ |
| | | public static void exportTemplate(List<Object> data, String filename, String templatePath, HttpServletResponse response) { |
| | | public static <T> void exportTemplate(List<T> data, String filename, String templatePath, HttpServletResponse response) { |
| | | try { |
| | | resetResponse(filename, response); |
| | | ServletOutputStream os = response.getOutputStream(); |
| | |
| | | * @param data 模æ¿éè¦çæ°æ® |
| | | * @param os è¾åºæµ |
| | | */ |
| | | public static void exportTemplate(List<Object> data, String templatePath, OutputStream os) { |
| | | public static <T> void exportTemplate(List<T> data, String templatePath, OutputStream os) { |
| | | if (CollUtil.isEmpty(data)) { |
| | | throw new IllegalArgumentException("æ°æ®ä¸ºç©º"); |
| | | } |
| | | ClassPathResource templateResource = new ClassPathResource(templatePath); |
| | | ExcelWriter excelWriter = EasyExcel.write(os) |
| | | .withTemplate(templateResource.getStream()) |
| | | .autoCloseStream(false) |
| | | // 大æ°å¼èªå¨è½¬æ¢ 鲿¢å¤±ç |
| | | .registerConverter(new ExcelBigNumberConvert()) |
| | | .registerWriteHandler(new DataWriteHandler(data.get(0).getClass())) |
| | | .build(); |
| | | WriteSheet writeSheet = EasyExcel.writerSheet().build(); |
| | | if (CollUtil.isEmpty(data)) { |
| | | throw new IllegalArgumentException("æ°æ®ä¸ºç©º"); |
| | | } |
| | | // åè¡¨å¤æ°æ®å¯¼åº æ¨¡æ¿æ ¼å¼ä¸º {.屿§} |
| | | for (Object d : data) { |
| | | for (T d : data) { |
| | | excelWriter.fill(d, writeSheet); |
| | | } |
| | | excelWriter.finish(); |
| | |
| | | * @param os è¾åºæµ |
| | | */ |
| | | public static void exportTemplateMultiList(Map<String, Object> data, String templatePath, OutputStream os) { |
| | | if (CollUtil.isEmpty(data)) { |
| | | throw new IllegalArgumentException("æ°æ®ä¸ºç©º"); |
| | | } |
| | | ClassPathResource templateResource = new ClassPathResource(templatePath); |
| | | ExcelWriter excelWriter = EasyExcel.write(os) |
| | | .withTemplate(templateResource.getStream()) |
| | |
| | | .registerConverter(new ExcelBigNumberConvert()) |
| | | .build(); |
| | | WriteSheet writeSheet = EasyExcel.writerSheet().build(); |
| | | if (CollUtil.isEmpty(data)) { |
| | | throw new IllegalArgumentException("æ°æ®ä¸ºç©º"); |
| | | } |
| | | for (Map.Entry<String, Object> map : data.entrySet()) { |
| | | // 设置å表åç»è¿ææ°æ® |
| | | FillConfig fillConfig = FillConfig.builder().forceNewRow(Boolean.TRUE).build(); |
| | |
| | | * @param os è¾åºæµ |
| | | */ |
| | | public static void exportTemplateMultiSheet(List<Map<String, Object>> data, String templatePath, OutputStream os) { |
| | | if (CollUtil.isEmpty(data)) { |
| | | throw new IllegalArgumentException("æ°æ®ä¸ºç©º"); |
| | | } |
| | | ClassPathResource templateResource = new ClassPathResource(templatePath); |
| | | ExcelWriter excelWriter = EasyExcel.write(os) |
| | | .withTemplate(templateResource.getStream()) |
| | |
| | | // 大æ°å¼èªå¨è½¬æ¢ 鲿¢å¤±ç |
| | | .registerConverter(new ExcelBigNumberConvert()) |
| | | .build(); |
| | | if (CollUtil.isEmpty(data)) { |
| | | throw new IllegalArgumentException("æ°æ®ä¸ºç©º"); |
| | | } |
| | | for (int i = 0; i < data.size(); i++) { |
| | | WriteSheet writeSheet = EasyExcel.writerSheet(i).build(); |
| | | for (Map.Entry<String, Object> map : data.get(i).entrySet()) { |
| | |
| | | |
| | | @Override |
| | | public void serialize(Number value, JsonGenerator gen, SerializerProvider provider) throws IOException { |
| | | // è¶
åºèå´ åºååä½å符串 |
| | | // è¶
åºèå´ åºåå为å符串 |
| | | if (value.longValue() > MIN_SAFE_INTEGER && value.longValue() < MAX_SAFE_INTEGER) { |
| | | super.serialize(value, gen, provider); |
| | | } else { |
| | |
| | | |
| | | if (e != null) { |
| | | operLog.setStatus(BusinessStatus.FAIL.ordinal()); |
| | | operLog.setErrorMsg(StringUtils.substring(e.getMessage(), 0, 2000)); |
| | | operLog.setErrorMsg(StringUtils.substring(e.getMessage(), 0, 3800)); |
| | | } |
| | | // è®¾ç½®æ¹æ³åç§° |
| | | String className = joinPoint.getTarget().getClass().getName(); |
| | |
| | | // 设置æ¶èæ¶é´ |
| | | StopWatch stopWatch = KEY_CACHE.get(); |
| | | stopWatch.stop(); |
| | | operLog.setCostTime(stopWatch.getTime()); |
| | | operLog.setCostTime(stopWatch.getDuration().toMillis()); |
| | | // åå¸äºä»¶ä¿åæ°æ®åº |
| | | SpringUtils.context().publishEvent(operLog); |
| | | } catch (Exception exp) { |
| | | // è®°å½æ¬å°å¼å¸¸æ¥å¿ |
| | | log.error("å¼å¸¸ä¿¡æ¯:{}", exp.getMessage()); |
| | | exp.printStackTrace(); |
| | | } finally { |
| | | KEY_CACHE.remove(); |
| | | } |
| | |
| | | } |
| | | // æ¯å¦éè¦ä¿åresponseï¼åæ°åå¼ |
| | | if (log.isSaveResponseData() && ObjectUtil.isNotNull(jsonResult)) { |
| | | operLog.setJsonResult(StringUtils.substring(JsonUtils.toJsonString(jsonResult), 0, 2000)); |
| | | operLog.setJsonResult(StringUtils.substring(JsonUtils.toJsonString(jsonResult), 0, 3800)); |
| | | } |
| | | } |
| | | |
| | |
| | | private void setRequestValue(JoinPoint joinPoint, OperLogEvent operLog, String[] excludeParamNames) throws Exception { |
| | | Map<String, String> paramsMap = ServletUtils.getParamMap(ServletUtils.getRequest()); |
| | | String requestMethod = operLog.getRequestMethod(); |
| | | if (MapUtil.isEmpty(paramsMap) |
| | | && HttpMethod.PUT.name().equals(requestMethod) || HttpMethod.POST.name().equals(requestMethod)) { |
| | | if (MapUtil.isEmpty(paramsMap) && StringUtils.equalsAny(requestMethod, HttpMethod.PUT.name(), HttpMethod.POST.name(), HttpMethod.DELETE.name())) { |
| | | String params = argsArrayToString(joinPoint.getArgs(), excludeParamNames); |
| | | operLog.setOperParam(StringUtils.substring(params, 0, 2000)); |
| | | operLog.setOperParam(StringUtils.substring(params, 0, 3800)); |
| | | } else { |
| | | MapUtil.removeAny(paramsMap, EXCLUDE_PROPERTIES); |
| | | MapUtil.removeAny(paramsMap, excludeParamNames); |
| | | operLog.setOperParam(StringUtils.substring(JsonUtils.toJsonString(paramsMap), 0, 2000)); |
| | | operLog.setOperParam(StringUtils.substring(JsonUtils.toJsonString(paramsMap), 0, 3800)); |
| | | } |
| | | } |
| | | |
| | |
| | | private String pass; |
| | | |
| | | /** |
| | | * åéæ¹ï¼éµå¾ªRFC-822æ å |
| | | * åéæ¹ï¼éµå¾ªRFC-822æ å<br> |
| | | * å件人å¯ä»¥æ¯ä»¥ä¸å½¢å¼ï¼ |
| | | * |
| | | * <pre> |
| | | * 1. user@xxx.xx |
| | | * 2. name <user@xxx.xx> |
| | | * </pre> |
| | | */ |
| | | private String from; |
| | | |
| | |
| | | <artifactId>mybatis-plus-spring-boot3-starter</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>com.baomidou</groupId> |
| | | <artifactId>mybatis-plus-jsqlparser</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- sqlæ§è½åææä»¶ --> |
| | | <dependency> |
| | | <groupId>p6spy</groupId> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.common.mybatis.aspect; |
| | | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.aspectj.lang.JoinPoint; |
| | | import org.aspectj.lang.annotation.AfterReturning; |
| | | import org.aspectj.lang.annotation.AfterThrowing; |
| | | import org.aspectj.lang.annotation.Aspect; |
| | | import org.aspectj.lang.annotation.Before; |
| | | import org.dromara.common.mybatis.annotation.DataPermission; |
| | | import org.dromara.common.mybatis.helper.DataPermissionHelper; |
| | | |
| | | /** |
| | | * æ°æ®æéå¤ç |
| | | * |
| | | * @author Lion Li |
| | | */ |
| | | @Slf4j |
| | | @Aspect |
| | | public class DataPermissionAspect { |
| | | |
| | | /** |
| | | * å¤ç请æ±åæ§è¡ |
| | | */ |
| | | @Before(value = "@annotation(dataPermission)") |
| | | public void doBefore(JoinPoint joinPoint, DataPermission dataPermission) { |
| | | DataPermissionHelper.setPermission(dataPermission); |
| | | } |
| | | |
| | | /** |
| | | * å¤çå®è¯·æ±åæ§è¡ |
| | | * |
| | | * @param joinPoint åç¹ |
| | | */ |
| | | @AfterReturning(pointcut = "@annotation(dataPermission)") |
| | | public void doAfterReturning(JoinPoint joinPoint, DataPermission dataPermission) { |
| | | DataPermissionHelper.removePermission(); |
| | | } |
| | | |
| | | /** |
| | | * æ¦æªå¼å¸¸æä½ |
| | | * |
| | | * @param joinPoint åç¹ |
| | | * @param e å¼å¸¸ |
| | | */ |
| | | @AfterThrowing(value = "@annotation(dataPermission)", throwing = "e") |
| | | public void doAfterThrowing(JoinPoint joinPoint, DataPermission dataPermission, Exception e) { |
| | | DataPermissionHelper.removePermission(); |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | import cn.hutool.core.net.NetUtil; |
| | | import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler; |
| | | import com.baomidou.mybatisplus.core.handlers.PostInitTableInfoHandler; |
| | | import com.baomidou.mybatisplus.core.incrementer.DefaultIdentifierGenerator; |
| | | import com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator; |
| | | import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor; |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.inner.TenantLineInnerInterceptor; |
| | | import org.dromara.common.core.factory.YmlPropertySourceFactory; |
| | | import org.dromara.common.core.utils.SpringUtils; |
| | | import org.dromara.common.mybatis.aspect.DataPermissionAspect; |
| | | import org.dromara.common.mybatis.handler.InjectionMetaObjectHandler; |
| | | import org.dromara.common.mybatis.handler.MybatisExceptionHandler; |
| | | import org.dromara.common.mybatis.handler.PlusPostInitTableInfoHandler; |
| | | import org.dromara.common.mybatis.interceptor.PlusDataPermissionInterceptor; |
| | | import org.mybatis.spring.annotation.MapperScan; |
| | | import org.springframework.beans.BeansException; |
| | |
| | | } |
| | | |
| | | /** |
| | | * æ°æ®æéåé¢å¤çå¨ |
| | | */ |
| | | @Bean |
| | | public DataPermissionAspect dataPermissionAspect() { |
| | | return new DataPermissionAspect(); |
| | | } |
| | | |
| | | /** |
| | | * å页æä»¶ï¼èªå¨è¯å«æ°æ®åºç±»å |
| | | */ |
| | | public PaginationInnerInterceptor paginationInnerInterceptor() { |
| | |
| | | } |
| | | |
| | | /** |
| | | * åå§å表对象å¤çå¨ |
| | | */ |
| | | @Bean |
| | | public PostInitTableInfoHandler postInitTableInfoHandler() { |
| | | return new PlusPostInitTableInfoHandler(); |
| | | } |
| | | |
| | | /** |
| | | * PaginationInnerInterceptor å页æä»¶ï¼èªå¨è¯å«æ°æ®åºç±»å |
| | | * https://baomidou.com/pages/97710a/ |
| | | * OptimisticLockerInnerInterceptor ä¹è§éæä»¶ |
| | |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | import java.util.function.Function; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * èªå®ä¹ Mapper æ¥å£, å®ç° èªå®ä¹æ©å± |
| | |
| | | * @return æå
¥æä½æ¯å¦æåçå¸å°å¼ |
| | | */ |
| | | default boolean insertBatch(Collection<T> entityList) { |
| | | Db.saveBatch(entityList); |
| | | // 临æ¶è§£å³ æ°çæ¬ mp æå
¥ç¶æå¤æé误é®é¢ |
| | | return true; |
| | | return Db.saveBatch(entityList); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return æ´æ°æä½æ¯å¦æåçå¸å°å¼ |
| | | */ |
| | | default boolean updateBatchById(Collection<T> entityList) { |
| | | Db.updateBatchById(entityList); |
| | | // 临æ¶è§£å³ æ°çæ¬ mp æå
¥ç¶æå¤æé误é®é¢ |
| | | return true; |
| | | return Db.updateBatchById(entityList); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return æå
¥ææ´æ°æä½æ¯å¦æåçå¸å°å¼ |
| | | */ |
| | | default boolean insertOrUpdateBatch(Collection<T> entityList) { |
| | | Db.saveOrUpdateBatch(entityList); |
| | | // 临æ¶è§£å³ æ°çæ¬ mp æå
¥ç¶æå¤æé误é®é¢ |
| | | return true; |
| | | return Db.saveOrUpdateBatch(entityList); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return æå
¥æä½æ¯å¦æåçå¸å°å¼ |
| | | */ |
| | | default boolean insertBatch(Collection<T> entityList, int batchSize) { |
| | | Db.saveBatch(entityList, batchSize); |
| | | // 临æ¶è§£å³ æ°çæ¬ mp æå
¥ç¶æå¤æé误é®é¢ |
| | | return true; |
| | | return Db.saveBatch(entityList, batchSize); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return æ´æ°æä½æ¯å¦æåçå¸å°å¼ |
| | | */ |
| | | default boolean updateBatchById(Collection<T> entityList, int batchSize) { |
| | | Db.updateBatchById(entityList, batchSize); |
| | | // 临æ¶è§£å³ æ°çæ¬ mp æå
¥ç¶æå¤æé误é®é¢ |
| | | return true; |
| | | return Db.updateBatchById(entityList, batchSize); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return æå
¥ææ´æ°æä½æ¯å¦æåçå¸å°å¼ |
| | | */ |
| | | default boolean insertOrUpdateBatch(Collection<T> entityList, int batchSize) { |
| | | Db.saveOrUpdateBatch(entityList, batchSize); |
| | | // 临æ¶è§£å³ æ°çæ¬ mp æå
¥ç¶æå¤æé误é®é¢ |
| | | return true; |
| | | return Db.saveOrUpdateBatch(entityList, batchSize); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @param idList 主é®IDéå |
| | | * @return æ¥è¯¢å°çVO对象å表 |
| | | */ |
| | | default List<V> selectVoBatchIds(Collection<? extends Serializable> idList) { |
| | | return selectVoBatchIds(idList, this.currentVoClass()); |
| | | default List<V> selectVoByIds(Collection<? extends Serializable> idList) { |
| | | return selectVoByIds(idList, this.currentVoClass()); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @param <C> VOç±»çç±»å |
| | | * @return æ¥è¯¢å°çVO对象å表ï¼ç»è¿è½¬æ¢ä¸ºæå®çVOç±»åè¿å |
| | | */ |
| | | default <C> List<C> selectVoBatchIds(Collection<? extends Serializable> idList, Class<C> voClass) { |
| | | List<T> list = this.selectBatchIds(idList); |
| | | default <C> List<C> selectVoByIds(Collection<? extends Serializable> idList, Class<C> voClass) { |
| | | List<T> list = this.selectByIds(idList); |
| | | if (CollUtil.isEmpty(list)) { |
| | | return CollUtil.newArrayList(); |
| | | } |
| | |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import com.baomidou.mybatisplus.core.metadata.OrderItem; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.fasterxml.jackson.annotation.JsonIgnore; |
| | | import lombok.Data; |
| | | import org.dromara.common.core.exception.ServiceException; |
| | | import org.dromara.common.core.utils.StringUtils; |
| | |
| | | return list; |
| | | } |
| | | |
| | | @JsonIgnore |
| | | public Integer getFirstNum() { |
| | | return (pageNum - 1) * pageSize; |
| | | } |
| | | |
| | | public PageQuery(Integer pageSize, Integer pageNum) { |
| | | this.pageSize = pageSize; |
| | | this.pageNum = pageNum; |
| | | } |
| | | |
| | | } |
| | |
| | | public TableDataInfo(List<T> list, long total) { |
| | | this.rows = list; |
| | | this.total = total; |
| | | this.code = HttpStatus.HTTP_OK; |
| | | this.msg = "æ¥è¯¢æå"; |
| | | } |
| | | |
| | | /** |
| | |
| | | /** |
| | | * ä»
æ¬äººæ°æ®æé |
| | | */ |
| | | SELF("5", " #{#userName} = #{#user.userId} ", " 1 = 0 "); |
| | | SELF("5", " #{#userName} = #{#user.userId} ", " 1 = 0 "), |
| | | |
| | | /** |
| | | * é¨é¨å以䏿æ¬äººæ°æ®æé |
| | | */ |
| | | DEPT_AND_CHILD_OR_SELF("6", " #{#deptName} IN ( #{@sdss.getDeptAndChild( #user.deptId )} ) OR #{#userName} = #{#user.userId} ", " 1 = 0 "); |
| | | |
| | | private final String code; |
| | | |
| | |
| | | import org.apache.ibatis.reflection.MetaObject; |
| | | import org.dromara.common.core.domain.model.LoginUser; |
| | | import org.dromara.common.core.exception.ServiceException; |
| | | import org.dromara.common.core.utils.ObjectUtils; |
| | | import org.dromara.common.mybatis.core.domain.BaseEntity; |
| | | import org.dromara.common.satoken.utils.LoginHelper; |
| | | |
| | |
| | | try { |
| | | if (ObjectUtil.isNotNull(metaObject) && metaObject.getOriginalObject() instanceof BaseEntity baseEntity) { |
| | | // è·åå½åæ¶é´ä½ä¸ºå建æ¶é´åæ´æ°æ¶é´ï¼å¦æå建æ¶é´ä¸ä¸ºç©ºï¼å使ç¨å建æ¶é´ï¼å¦å使ç¨å½åæ¶é´ |
| | | Date current = ObjectUtil.isNotNull(baseEntity.getCreateTime()) |
| | | ? baseEntity.getCreateTime() : new Date(); |
| | | Date current = ObjectUtils.notNull(baseEntity.getCreateTime(), new Date()); |
| | | baseEntity.setCreateTime(current); |
| | | baseEntity.setUpdateTime(current); |
| | | |
| | |
| | | // å¡«å
åå»ºäººãæ´æ°äººåå建é¨é¨ä¿¡æ¯ |
| | | baseEntity.setCreateBy(userId); |
| | | baseEntity.setUpdateBy(userId); |
| | | baseEntity.setCreateDept(ObjectUtil.isNotNull(baseEntity.getCreateDept()) |
| | | ? baseEntity.getCreateDept() : loginUser.getDeptId()); |
| | | baseEntity.setCreateDept(ObjectUtils.notNull(baseEntity.getCreateDept(), loginUser.getDeptId())); |
| | | } |
| | | } |
| | | } else { |
| | |
| | | import cn.hutool.core.annotation.AnnotationUtil; |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import net.sf.jsqlparser.JSQLParserException; |
| | | import net.sf.jsqlparser.expression.Expression; |
| | | import net.sf.jsqlparser.expression.Parenthesis; |
| | | import net.sf.jsqlparser.expression.operators.conditional.AndExpression; |
| | | import net.sf.jsqlparser.expression.operators.relational.ParenthesedExpressionList; |
| | | import net.sf.jsqlparser.parser.CCJSqlParserUtil; |
| | | import org.apache.ibatis.io.Resources; |
| | | import org.dromara.common.core.domain.dto.RoleDTO; |
| | |
| | | import org.springframework.core.io.support.ResourcePatternResolver; |
| | | import org.springframework.core.type.ClassMetadata; |
| | | import org.springframework.core.type.classreading.CachingMetadataReaderFactory; |
| | | import org.springframework.expression.BeanResolver; |
| | | import org.springframework.expression.ExpressionParser; |
| | | import org.springframework.expression.ParserContext; |
| | | import org.springframework.expression.*; |
| | | import org.springframework.expression.common.TemplateParserContext; |
| | | import org.springframework.expression.spel.standard.SpelExpressionParser; |
| | | import org.springframework.expression.spel.support.StandardEvaluationContext; |
| | | import org.springframework.util.ClassUtils; |
| | | |
| | | import java.lang.reflect.Method; |
| | | import java.util.Arrays; |
| | | import java.util.HashSet; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | import java.util.*; |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | | import java.util.function.Function; |
| | | |
| | |
| | | public class PlusDataPermissionHandler { |
| | | |
| | | /** |
| | | * æ¹æ³æç±»(åç§°) ä¸ æ³¨è§£çæ å°å
³ç³»ç¼å |
| | | * ç±»åç§°ä¸æ³¨è§£çæ å°å
³ç³»ç¼å(ç±äºaopæ æ³æ¦æªmybatisæ¥å£ç±»ä¸ç注解 åªè½éè¿å¯å¨é¢æ«æçæ¹å¼è¿è¡) |
| | | */ |
| | | private final Map<String, DataPermission> dataPermissionCacheMap = new ConcurrentHashMap<>(); |
| | | |
| | |
| | | * @return æ°æ®è¿æ»¤æ¡ä»¶ç SQL çæ®µ |
| | | */ |
| | | public Expression getSqlSegment(Expression where, String mappedStatementId, boolean isSelect) { |
| | | // è·åæ°æ®æéé
ç½® |
| | | DataPermission dataPermission = getDataPermission(mappedStatementId); |
| | | // è·åå½åç»å½ç¨æ·ä¿¡æ¯ |
| | | LoginUser currentUser = DataPermissionHelper.getVariable("user"); |
| | | if (ObjectUtil.isNull(currentUser)) { |
| | | currentUser = LoginHelper.getLoginUser(); |
| | | DataPermissionHelper.setVariable("user", currentUser); |
| | | } |
| | | // 妿æ¯è¶
级管çåæç§æ·ç®¡çåï¼åä¸è¿æ»¤æ°æ® |
| | | if (LoginHelper.isSuperAdmin() || LoginHelper.isTenantAdmin()) { |
| | | return where; |
| | | } |
| | | // æé æ°æ®è¿æ»¤æ¡ä»¶ç SQL çæ®µ |
| | | String dataFilterSql = buildDataFilter(dataPermission, isSelect); |
| | | if (StringUtils.isBlank(dataFilterSql)) { |
| | | return where; |
| | | } |
| | | try { |
| | | // è·åæ°æ®æéé
ç½® |
| | | DataPermission dataPermission = getDataPermission(mappedStatementId); |
| | | // è·åå½åç»å½ç¨æ·ä¿¡æ¯ |
| | | LoginUser currentUser = DataPermissionHelper.getVariable("user"); |
| | | if (ObjectUtil.isNull(currentUser)) { |
| | | currentUser = LoginHelper.getLoginUser(); |
| | | DataPermissionHelper.setVariable("user", currentUser); |
| | | } |
| | | // 妿æ¯è¶
级管çåæç§æ·ç®¡çåï¼åä¸è¿æ»¤æ°æ® |
| | | if (LoginHelper.isSuperAdmin() || LoginHelper.isTenantAdmin()) { |
| | | return where; |
| | | } |
| | | // æé æ°æ®è¿æ»¤æ¡ä»¶ç SQL çæ®µ |
| | | String dataFilterSql = buildDataFilter(dataPermission, isSelect); |
| | | if (StringUtils.isBlank(dataFilterSql)) { |
| | | return where; |
| | | } |
| | | Expression expression = CCJSqlParserUtil.parseExpression(dataFilterSql); |
| | | // æ°æ®æé使ç¨åç¬çæ¬å· 鲿¢ä¸å
¶ä»æ¡ä»¶å²çª |
| | | Parenthesis parenthesis = new Parenthesis(expression); |
| | | ParenthesedExpressionList<Expression> parenthesis = new ParenthesedExpressionList<>(expression); |
| | | if (ObjectUtil.isNotNull(where)) { |
| | | return new AndExpression(where, parenthesis); |
| | | } else { |
| | |
| | | } |
| | | } catch (JSQLParserException e) { |
| | | throw new ServiceException("æ°æ®æéè§£æå¼å¸¸ => " + e.getMessage()); |
| | | } finally { |
| | | DataPermissionHelper.removePermission(); |
| | | } |
| | | } |
| | | |
| | |
| | | joinStr = " " + dataPermission.joinStr() + " "; |
| | | } |
| | | LoginUser user = DataPermissionHelper.getVariable("user"); |
| | | StandardEvaluationContext context = new StandardEvaluationContext(); |
| | | Object defaultValue = "-1"; |
| | | NullSafeStandardEvaluationContext context = new NullSafeStandardEvaluationContext(defaultValue); |
| | | context.addPropertyAccessor(new NullSafePropertyAccessor(context.getPropertyAccessors().get(0), defaultValue)); |
| | | context.setBeanResolver(beanResolver); |
| | | DataPermissionHelper.getContext().forEach(context::setVariable); |
| | | Set<String> conditions = new HashSet<>(); |
| | | // ä¼å
设置åé |
| | | List<String> keys = new ArrayList<>(); |
| | | Map<DataColumn, Boolean> ignoreMap = new HashMap<>(); |
| | | for (DataColumn dataColumn : dataPermission.value()) { |
| | | if (dataColumn.key().length != dataColumn.value().length) { |
| | | throw new ServiceException("è§è²æ°æ®èå´å¼å¸¸ => keyä¸valueé¿åº¦ä¸å¹é
"); |
| | | } |
| | | // å
å«æéæ è¯ç¬¦ è¿ç´æ¥è·³è¿ |
| | | if (StringUtils.isNotBlank(dataColumn.permission()) && |
| | | CollUtil.contains(user.getMenuPermission(), dataColumn.permission()) |
| | | ) { |
| | | ignoreMap.put(dataColumn, Boolean.TRUE); |
| | | continue; |
| | | } |
| | | // 设置注解åé key 为表达å¼åé value 为åéå¼ |
| | | for (int i = 0; i < dataColumn.key().length; i++) { |
| | | context.setVariable(dataColumn.key()[i], dataColumn.value()[i]); |
| | | } |
| | | keys.addAll(Arrays.stream(dataColumn.key()).map(key -> "#" + key).toList()); |
| | | } |
| | | |
| | | for (RoleDTO role : user.getRoles()) { |
| | | user.setRoleId(role.getRoleId()); |
| | | // è·åè§è²æéæ³å |
| | |
| | | } |
| | | // å
¨é¨æ°æ®æéç´æ¥è¿å |
| | | if (type == DataScopeType.ALL) { |
| | | return ""; |
| | | return StringUtils.EMPTY; |
| | | } |
| | | boolean isSuccess = false; |
| | | for (DataColumn dataColumn : dataPermission.value()) { |
| | | if (dataColumn.key().length != dataColumn.value().length) { |
| | | throw new ServiceException("è§è²æ°æ®èå´å¼å¸¸ => keyä¸valueé¿åº¦ä¸å¹é
"); |
| | | } |
| | | // ä¸å
å« key åé åä¸å¤ç |
| | | if (!StringUtils.containsAny(type.getSqlTemplate(), |
| | | Arrays.stream(dataColumn.key()).map(key -> "#" + key).toArray(String[]::new) |
| | | )) { |
| | | continue; |
| | | } |
| | | // å
å«æéæ è¯ç¬¦ è¿ç´æ¥è·³è¿ |
| | | if (StringUtils.isNotBlank(dataColumn.permission()) && |
| | | CollUtil.contains(user.getMenuPermission(), dataColumn.permission()) |
| | | ) { |
| | | if (ignoreMap.containsKey(dataColumn)) { |
| | | // ä¿®å¤å¤è§è²ä¸æéæ è¯ç¬¦å
±ç¨é®é¢ https://gitee.com/dromara/RuoYi-Vue-Plus/issues/IB4CS4 |
| | | conditions.add(joinStr + " 1 = 1 "); |
| | | isSuccess = true; |
| | | continue; |
| | | } |
| | | // 设置注解åé key 为表达å¼åé value 为åéå¼ |
| | | for (int i = 0; i < dataColumn.key().length; i++) { |
| | | context.setVariable(dataColumn.key()[i], dataColumn.value()[i]); |
| | | // ä¸å
å« key åé åä¸å¤ç |
| | | if (!StringUtils.containsAny(type.getSqlTemplate(), keys.toArray(String[]::new))) { |
| | | continue; |
| | | } |
| | | |
| | | // å½åæ³¨è§£ä¸æ»¡è¶³æ¨¡æ¿ ä¸å¤ç |
| | | if (!StringUtils.containsAny(type.getSqlTemplate(), dataColumn.key())) { |
| | | continue; |
| | | } |
| | | // å¿½ç¥æ°æ®æé 鲿¢spel表达å¼å
æå
¶ä»sqlæ¥è¯¢å¯¼è´æ»å¾ªç¯è°ç¨ |
| | | String sql = DataPermissionHelper.ignore(() -> |
| | | parser.parseExpression(type.getSqlTemplate(), parserContext).getValue(context, String.class) |
| | | ); |
| | | // è§£æsql模æ¿å¹¶å¡«å
|
| | | String sql = parser.parseExpression(type.getSqlTemplate(), parserContext).getValue(context, String.class); |
| | | conditions.add(joinStr + sql); |
| | | isSuccess = true; |
| | | } |
| | |
| | | String sql = StreamUtils.join(conditions, Function.identity(), ""); |
| | | return sql.substring(joinStr.length()); |
| | | } |
| | | return ""; |
| | | return StringUtils.EMPTY; |
| | | } |
| | | |
| | | /** |
| | |
| | | // è·åèµæºå¯¹åºç类对象 |
| | | Class<?> clazz = Resources.classForName(classMetadata.getClassName()); |
| | | // æ¥æ¾ç±»ä¸çç¹å®æ³¨è§£ |
| | | findAnnotation(clazz); |
| | | if (AnnotationUtil.hasAnnotation(clazz, DataPermission.class)) { |
| | | DataPermission dataPermission = AnnotationUtil.getAnnotation(clazz, DataPermission.class); |
| | | dataPermissionCacheMap.put(clazz.getName(), dataPermission); |
| | | } |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("åå§åæ°æ®å®å
¨ç¼åæ¶åºé:{}", e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 卿å®çç±»ä¸æ¥æ¾ç¹å®ç注解 DataPermissionï¼å¹¶å°å¸¦æè¿ä¸ªæ³¨è§£çæ¹æ³æç±»åå¨å° dataPermissionCacheMap ä¸ |
| | | * |
| | | * @param clazz è¦æ¥æ¾çç±» |
| | | */ |
| | | private void findAnnotation(Class<?> clazz) { |
| | | DataPermission dataPermission; |
| | | for (Method method : clazz.getMethods()) { |
| | | if (method.isDefault() || method.isVarArgs()) { |
| | | continue; |
| | | } |
| | | String mappedStatementId = clazz.getName() + "." + method.getName(); |
| | | if (AnnotationUtil.hasAnnotation(method, DataPermission.class)) { |
| | | dataPermission = AnnotationUtil.getAnnotation(method, DataPermission.class); |
| | | dataPermissionCacheMap.put(mappedStatementId, dataPermission); |
| | | } |
| | | } |
| | | if (AnnotationUtil.hasAnnotation(clazz, DataPermission.class)) { |
| | | dataPermission = AnnotationUtil.getAnnotation(clazz, DataPermission.class); |
| | | dataPermissionCacheMap.put(clazz.getName(), dataPermission); |
| | | } |
| | | } |
| | | |
| | |
| | | * @return DataPermission 注解对象ï¼å¦æä¸åå¨åè¿å null |
| | | */ |
| | | public DataPermission getDataPermission(String mapperId) { |
| | | // æ£æ¥ç¼å䏿¯å¦å
嫿 å°è¯å¥ ID 对åºç DataPermission 注解对象 |
| | | if (dataPermissionCacheMap.containsKey(mapperId)) { |
| | | return dataPermissionCacheMap.get(mapperId); |
| | | // æ£æ¥ä¸ä¸æä¸æ¯å¦å
嫿 å°è¯å¥ ID 对åºç DataPermission 注解对象 |
| | | if (DataPermissionHelper.getPermission() != null) { |
| | | return DataPermissionHelper.getPermission(); |
| | | } |
| | | // 妿ç¼åä¸ä¸å
嫿 å°è¯å¥ ID 对åºç DataPermission 注解对象ï¼åå°è¯ä½¿ç¨ç±»åä½ä¸ºé®æ¥æ¾ |
| | | String clazzName = mapperId.substring(0, mapperId.lastIndexOf(".")); |
| | |
| | | public boolean invalid(String mapperId) { |
| | | return getDataPermission(mapperId) == null; |
| | | } |
| | | |
| | | /** |
| | | * 对æænullåéæ¾ä¸å°çåéè¿åé»è®¤å¼ |
| | | */ |
| | | @AllArgsConstructor |
| | | private static class NullSafeStandardEvaluationContext extends StandardEvaluationContext { |
| | | |
| | | private final Object defaultValue; |
| | | |
| | | @Override |
| | | public Object lookupVariable(String name) { |
| | | Object obj = super.lookupVariable(name); |
| | | // å¦æè¯»åå°ç弿¯ nullï¼åè¿åé»è®¤å¼ |
| | | if (obj == null) { |
| | | return defaultValue; |
| | | } |
| | | return obj; |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 对æænullåéæ¾ä¸å°çåéè¿åé»è®¤å¼ å§ææ¨¡å¼ å°ä¸éè¦å¤ççæ¹æ³å§æç»åå¤çå¨ |
| | | */ |
| | | @AllArgsConstructor |
| | | private static class NullSafePropertyAccessor implements PropertyAccessor { |
| | | |
| | | private final PropertyAccessor delegate; |
| | | private final Object defaultValue; |
| | | |
| | | @Override |
| | | public Class<?>[] getSpecificTargetClasses() { |
| | | return delegate.getSpecificTargetClasses(); |
| | | } |
| | | |
| | | @Override |
| | | public boolean canRead(EvaluationContext context, Object target, String name) throws AccessException { |
| | | return delegate.canRead(context, target, name); |
| | | } |
| | | |
| | | @Override |
| | | public TypedValue read(EvaluationContext context, Object target, String name) throws AccessException { |
| | | TypedValue value = delegate.read(context, target, name); |
| | | // å¦æè¯»åå°ç弿¯ nullï¼åè¿åé»è®¤å¼ |
| | | if (value.getValue() == null) { |
| | | return new TypedValue(defaultValue); |
| | | } |
| | | return value; |
| | | } |
| | | |
| | | @Override |
| | | public boolean canWrite(EvaluationContext context, Object target, String name) throws AccessException { |
| | | return delegate.canWrite(context, target, name); |
| | | } |
| | | |
| | | @Override |
| | | public void write(EvaluationContext context, Object target, String name, Object newValue) throws AccessException { |
| | | delegate.write(context, target, name, newValue); |
| | | } |
| | | } |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.common.mybatis.handler; |
| | | |
| | | import cn.hutool.core.convert.Convert; |
| | | import com.baomidou.mybatisplus.core.handlers.PostInitTableInfoHandler; |
| | | import com.baomidou.mybatisplus.core.metadata.TableInfo; |
| | | import org.apache.ibatis.session.Configuration; |
| | | import org.dromara.common.core.utils.SpringUtils; |
| | | import org.dromara.common.core.utils.reflect.ReflectUtils; |
| | | |
| | | /** |
| | | * ä¿®æ¹è¡¨ä¿¡æ¯åå§åæ¹å¼ |
| | | * ç®åç¨äºå
¨å±ä¿®æ¹æ¯å¦ä½¿ç¨é»è¾å é¤ |
| | | * |
| | | * @author Lion Li |
| | | */ |
| | | public class PlusPostInitTableInfoHandler implements PostInitTableInfoHandler { |
| | | |
| | | @Override |
| | | public void postTableInfo(TableInfo tableInfo, Configuration configuration) { |
| | | String flag = SpringUtils.getProperty("mybatis-plus.enableLogicDelete", "true"); |
| | | // åªæå
³éæ¶ ç»ä¸è®¾ç½®false 为trueæ¶mpèªå¨å¤æä¸å¤ç |
| | | if (!Convert.toBool(flag)) { |
| | | ReflectUtils.setFieldValue(tableInfo, "withLogicDelete", false); |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | // charindex(',100,' , ',0,100,101,') <> 0 |
| | | return "charindex(',%s,' , ','+%s+',') <> 0".formatted(var, var2); |
| | | } else if (dataBasyType == DataBaseType.POSTGRE_SQL) { |
| | | // (select position(',100,' in ',0,100,101,')) <> 0 |
| | | return "(select position(',%s,' in ','||%s||',')) <> 0".formatted(var, var2); |
| | | // (select strpos(',0,100,101,' , ',100,')) <> 0 |
| | | return "(select strpos(','||%s||',' , ',%s,')) <> 0".formatted(var2, var); |
| | | } else if (dataBasyType == DataBaseType.ORACLE) { |
| | | // instr(',0,100,101,' , ',100,') <> 0 |
| | | return "instr(','||%s||',' , ',%s,') <> 0".formatted(var2, var); |
| | |
| | | import lombok.AccessLevel; |
| | | import lombok.NoArgsConstructor; |
| | | import org.dromara.common.core.utils.reflect.ReflectUtils; |
| | | import org.dromara.common.mybatis.annotation.DataPermission; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | |
| | | |
| | | private static final ThreadLocal<Stack<Integer>> REENTRANT_IGNORE = ThreadLocal.withInitial(Stack::new); |
| | | |
| | | private static final ThreadLocal<DataPermission> PERMISSION_CACHE = new ThreadLocal<>(); |
| | | |
| | | /** |
| | | * è·åå½åæ§è¡mapperæé注解 |
| | | * |
| | | * @return è¿åå½åæ§è¡mapperæé注解 |
| | | */ |
| | | public static DataPermission getPermission() { |
| | | return PERMISSION_CACHE.get(); |
| | | } |
| | | |
| | | /** |
| | | * 设置å½åæ§è¡mapperæé注解 |
| | | * |
| | | * @param dataPermission æ°æ®æé注解 |
| | | */ |
| | | public static void setPermission(DataPermission dataPermission) { |
| | | PERMISSION_CACHE.set(dataPermission); |
| | | } |
| | | |
| | | /** |
| | | * å é¤å½åæ§è¡mapperæé注解 |
| | | */ |
| | | public static void removePermission() { |
| | | PERMISSION_CACHE.remove(); |
| | | } |
| | | |
| | | /** |
| | | * ä»ä¸ä¸æä¸è·åæå®é®çåéå¼ï¼å¹¶å°å
¶è½¬æ¢ä¸ºæå®çç±»å |
| | | * |
| | |
| | | # 主é®ç±»å |
| | | # AUTO èªå¢ NONE 空 INPUT ç¨æ·è¾å
¥ ASSIGN_ID éªè± ASSIGN_UUID å¯ä¸ UUID |
| | | idType: ASSIGN_ID |
| | | # é»è¾å·²å é¤å¼(æ¡æ¶è¡¨åä½¿ç¨æ¤å¼ ç¦æ¢éæä¿®æ¹) |
| | | logicDeleteValue: 2 |
| | | # é»è¾å·²å é¤å¼(坿鿱éæä¿®æ¹) |
| | | logicDeleteValue: 1 |
| | | # é»è¾æªå é¤å¼ |
| | | logicNotDeleteValue: 0 |
| | | insertStrategy: NOT_NULL |
| | |
| | | import org.dromara.common.oss.constant.OssConstant; |
| | | import org.dromara.common.oss.entity.UploadResult; |
| | | import org.dromara.common.oss.enumd.AccessPolicyType; |
| | | import org.dromara.common.oss.enumd.PolicyType; |
| | | import org.dromara.common.oss.exception.OssException; |
| | | import org.dromara.common.oss.properties.OssProperties; |
| | | import software.amazon.awssdk.auth.credentials.AwsBasicCredentials; |
| | | import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider; |
| | | import software.amazon.awssdk.core.ResponseInputStream; |
| | | import software.amazon.awssdk.core.async.AsyncRequestBody; |
| | | import software.amazon.awssdk.core.async.AsyncResponseTransformer; |
| | | import software.amazon.awssdk.core.async.BlockingInputStreamAsyncRequestBody; |
| | | import software.amazon.awssdk.regions.Region; |
| | | import software.amazon.awssdk.services.s3.S3AsyncClient; |
| | | import software.amazon.awssdk.services.s3.S3Configuration; |
| | | import software.amazon.awssdk.services.s3.crt.S3CrtHttpConfiguration; |
| | | import software.amazon.awssdk.services.s3.model.GetObjectResponse; |
| | | import software.amazon.awssdk.services.s3.model.NoSuchBucketException; |
| | | import software.amazon.awssdk.services.s3.model.S3Exception; |
| | | import software.amazon.awssdk.services.s3.presigner.S3Presigner; |
| | | import software.amazon.awssdk.transfer.s3.S3TransferManager; |
| | | import software.amazon.awssdk.transfer.s3.model.*; |
| | |
| | | import java.nio.file.Files; |
| | | import java.nio.file.Path; |
| | | import java.time.Duration; |
| | | import java.util.function.Consumer; |
| | | |
| | | /** |
| | | * S3 åå¨åè®® ææå
¼å®¹S3åè®®çäºåå忝æ |
| | |
| | | StaticCredentialsProvider credentialsProvider = StaticCredentialsProvider.create( |
| | | AwsBasicCredentials.create(properties.getAccessKey(), properties.getSecretKey())); |
| | | |
| | | //MinIO ä½¿ç¨ HTTPS éå¶ä½¿ç¨åå访é®ï¼ç«ç¹å¡«ååãéè¦å¯ç¨è·¯å¾æ ·å¼è®¿é® |
| | | // MinIO ä½¿ç¨ HTTPS éå¶ä½¿ç¨åå访é®ï¼ç«ç¹å¡«ååãéè¦å¯ç¨è·¯å¾æ ·å¼è®¿é® |
| | | boolean isStyle = !StringUtils.containsAny(properties.getEndpoint(), OssConstant.CLOUD_SERVICE); |
| | | |
| | | //å建AWSåºäº CRT ç S3 客æ·ç«¯ |
| | | // å建AWSåºäº CRT ç S3 客æ·ç«¯ |
| | | this.client = S3AsyncClient.crtBuilder() |
| | | .credentialsProvider(credentialsProvider) |
| | | .endpointOverride(URI.create(getEndpoint())) |
| | |
| | | .minimumPartSizeInBytes(10 * 1025 * 1024L) |
| | | .checksumValidationEnabled(false) |
| | | .forcePathStyle(isStyle) |
| | | .httpConfiguration(S3CrtHttpConfiguration.builder() |
| | | .connectionTimeout(Duration.ofSeconds(60)) // è®¾ç½®è¿æ¥è¶
æ¶ |
| | | .build()) |
| | | .build(); |
| | | |
| | | //AWSåºäº CRT ç S3 AsyncClient å®ä¾ç¨ä½ S3 ä¼ è¾ç®¡çå¨çåºå±å®¢æ·ç«¯ |
| | |
| | | .serviceConfiguration(config) |
| | | .build(); |
| | | |
| | | // å建å卿¡¶ |
| | | createBucket(); |
| | | } catch (Exception e) { |
| | | if (e instanceof OssException) { |
| | | throw e; |
| | | } |
| | | throw new OssException("é
ç½®é误! è¯·æ£æ¥ç³»ç»é
ç½®:[" + e.getMessage() + "]"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 忥å建å卿¡¶ |
| | | * 妿å卿¡¶ä¸åå¨ï¼ä¼è¿è¡å建ï¼å¦æå卿¡¶åå¨ï¼ä¸æ§è¡ä»»ä½æä½ |
| | | * |
| | | * @throws OssException å½å建å卿¡¶æ¶åçå¼å¸¸æ¶æåº |
| | | */ |
| | | public void createBucket() { |
| | | String bucketName = properties.getBucketName(); |
| | | try { |
| | | // å°è¯è·åå卿¡¶çä¿¡æ¯ |
| | | client.headBucket( |
| | | x -> x.bucket(bucketName) |
| | | .build()) |
| | | .join(); |
| | | } catch (Exception ex) { |
| | | if (ex.getCause() instanceof NoSuchBucketException) { |
| | | try { |
| | | // å卿¡¶ä¸åå¨ï¼å°è¯å建å卿¡¶ |
| | | client.createBucket( |
| | | x -> x.bucket(bucketName)) |
| | | .join(); |
| | | |
| | | // 设置å卿¡¶ç访é®çç¥ï¼Bucket Policyï¼ |
| | | client.putBucketPolicy( |
| | | x -> x.bucket(bucketName) |
| | | .policy(getPolicy(bucketName, getAccessPolicy().getPolicyType()))) |
| | | .join(); |
| | | } catch (S3Exception e) { |
| | | // å卿¡¶å建æçç¥è®¾ç½®å¤±è´¥ |
| | | throw new OssException("å建Bucket失败, è¯·æ ¸å¯¹é
置信æ¯:[" + e.getMessage() + "]"); |
| | | } |
| | | } else { |
| | | throw new OssException("夿Bucketæ¯å¦åå¨å¤±è´¥ï¼è¯·æ ¸å¯¹é
置信æ¯:[" + ex.getMessage() + "]"); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | .key(key) |
| | | .contentMD5(StringUtils.isNotEmpty(md5Digest) ? md5Digest : null) |
| | | .contentType(contentType) |
| | | .acl(getAccessPolicy().getObjectCannedACL()) |
| | | // ç¨äºè®¾ç½®å¯¹è±¡çè®¿é®æ§å¶å表ï¼ACLï¼ãä¸åäºåå对ACLçæ¯æåå®ç°æ¹å¼ææä¸åï¼ |
| | | // å æ¤æ ¹æ®å
·ä½çäºæå¡æä¾åï¼ä½ å¯è½éè¦è¿è¡ä¸åçé
ç½®ï¼èªè¡å¼å¯ï¼é¿éäºæaclæéé
ç½®ï¼è
¾è®¯äºæ²¡æaclæéé
ç½®ï¼ |
| | | //.acl(getAccessPolicy().getObjectCannedACL()) |
| | | .build()) |
| | | .addTransferListener(LoggingTransferListener.create()) |
| | | .source(filePath).build()); |
| | |
| | | } |
| | | try { |
| | | // åå»ºå¼æ¥è¯·æ±ä½ï¼lengthå¦æä¸ºç©ºä¼æ¥éï¼ |
| | | BlockingInputStreamAsyncRequestBody body = AsyncRequestBody.forBlockingInputStream(length); |
| | | BlockingInputStreamAsyncRequestBody body = BlockingInputStreamAsyncRequestBody.builder() |
| | | .contentLength(length) |
| | | .subscribeTimeout(Duration.ofSeconds(30)) |
| | | .build(); |
| | | |
| | | // ä½¿ç¨ transferManager è¿è¡ä¸ä¼ |
| | | Upload upload = transferManager.upload( |
| | |
| | | y -> y.bucket(properties.getBucketName()) |
| | | .key(key) |
| | | .contentType(contentType) |
| | | .acl(getAccessPolicy().getObjectCannedACL()) |
| | | // ç¨äºè®¾ç½®å¯¹è±¡çè®¿é®æ§å¶å表ï¼ACLï¼ãä¸åäºåå对ACLçæ¯æåå®ç°æ¹å¼ææä¸åï¼ |
| | | // å æ¤æ ¹æ®å
·ä½çäºæå¡æä¾åï¼ä½ å¯è½éè¦è¿è¡ä¸åçé
ç½®ï¼èªè¡å¼å¯ï¼é¿éäºæaclæéé
ç½®ï¼è
¾è®¯äºæ²¡æaclæéé
ç½®ï¼ |
| | | //.acl(getAccessPolicy().getObjectCannedACL()) |
| | | .build()) |
| | | .build()); |
| | | |
| | |
| | | * |
| | | * @param key æä»¶å¨ Amazon S3 ä¸çå¯¹è±¡é® |
| | | * @param out è¾åºæµ |
| | | * @param consumer èªå®ä¹å¤çé»è¾ |
| | | * @return è¾åºæµä¸åå
¥çåèæ°ï¼é¿åº¦ï¼ |
| | | * @throws OssException 妿ä¸è½½å¤±è´¥ï¼æåºèªå®ä¹å¼å¸¸ |
| | | */ |
| | | public long download(String key, OutputStream out) { |
| | | public void download(String key, OutputStream out, Consumer<Long> consumer) { |
| | | try { |
| | | // æå»ºä¸è½½è¯·æ± |
| | | DownloadRequest<ResponseInputStream<GetObjectResponse>> downloadRequest = DownloadRequest.builder() |
| | |
| | | Download<ResponseInputStream<GetObjectResponse>> responseFuture = transferManager.download(downloadRequest); |
| | | // è¾åºå°æµä¸ |
| | | try (ResponseInputStream<GetObjectResponse> responseStream = responseFuture.completionFuture().join().result()) { // auto-closeable stream |
| | | return responseStream.transferTo(out); // é»å¡è°ç¨çº¿ç¨ blocks the calling thread |
| | | if (consumer != null) { |
| | | consumer.accept(responseStream.response().contentLength()); |
| | | } |
| | | responseStream.transferTo(out); // é»å¡è°ç¨çº¿ç¨ blocks the calling thread |
| | | } |
| | | } catch (Exception e) { |
| | | throw new OssException("æä»¶ä¸è½½å¤±è´¥ï¼é误信æ¯:[" + e.getMessage() + "]"); |
| | |
| | | /** |
| | | * è·åç§æURL龿¥ |
| | | * |
| | | * @param objectKey 对象KEY |
| | | * @param second æææ¶é´ |
| | | * @param objectKey 对象KEY |
| | | * @param expiredTime 龿¥ææå°ææ¶é´ |
| | | */ |
| | | public String getPrivateUrl(String objectKey, Integer second) { |
| | | public String getPrivateUrl(String objectKey, Duration expiredTime) { |
| | | // ä½¿ç¨ AWS S3 é¢ç¾å URL ççæå¨ è·å对象çé¢ç¾å URL |
| | | URL url = presigner.presignGetObject( |
| | | x -> x.signatureDuration(Duration.ofSeconds(second)) |
| | | x -> x.signatureDuration(expiredTime) |
| | | .getObjectRequest( |
| | | y -> y.bucket(properties.getBucketName()) |
| | | .key(objectKey) |
| | |
| | | * @return UploadResult å
å«ä¸ä¼ åçæä»¶ä¿¡æ¯ |
| | | * @throws OssException 妿ä¸ä¼ å¤±è´¥ï¼æåºèªå®ä¹å¼å¸¸ |
| | | */ |
| | | public UploadResult uploadSuffix(byte[] data, String suffix) { |
| | | return upload(new ByteArrayInputStream(data), getPath(properties.getPrefix(), suffix), Long.valueOf(data.length), FileUtils.getMimeType(suffix)); |
| | | public UploadResult uploadSuffix(byte[] data, String suffix, String contentType) { |
| | | return upload(new ByteArrayInputStream(data), getPath(properties.getPrefix(), suffix), Long.valueOf(data.length), contentType); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return UploadResult å
å«ä¸ä¼ åçæä»¶ä¿¡æ¯ |
| | | * @throws OssException 妿ä¸ä¼ å¤±è´¥ï¼æåºèªå®ä¹å¼å¸¸ |
| | | */ |
| | | public UploadResult uploadSuffix(InputStream inputStream, String suffix, Long length) { |
| | | return upload(inputStream, getPath(properties.getPrefix(), suffix), length, FileUtils.getMimeType(suffix)); |
| | | public UploadResult uploadSuffix(InputStream inputStream, String suffix, Long length, String contentType) { |
| | | return upload(inputStream, getPath(properties.getPrefix(), suffix), length, contentType); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | public AccessPolicyType getAccessPolicy() { |
| | | return AccessPolicyType.getByType(properties.getAccessPolicy()); |
| | | } |
| | | |
| | | /** |
| | | * çæ AWS S3 å卿¡¶è®¿é®çç¥ |
| | | * |
| | | * @param bucketName å卿¡¶ |
| | | * @param policyType æ¡¶çç¥ç±»å |
| | | * @return 符å AWS S3 å卿¡¶è®¿é®çç¥æ ¼å¼çå符串 |
| | | */ |
| | | private static String getPolicy(String bucketName, PolicyType policyType) { |
| | | String policy = switch (policyType) { |
| | | case WRITE -> """ |
| | | { |
| | | "Version": "2012-10-17", |
| | | "Statement": [] |
| | | } |
| | | """; |
| | | case READ_WRITE -> """ |
| | | { |
| | | "Version": "2012-10-17", |
| | | "Statement": [ |
| | | { |
| | | "Effect": "Allow", |
| | | "Principal": "*", |
| | | "Action": [ |
| | | "s3:GetBucketLocation", |
| | | "s3:ListBucket", |
| | | "s3:ListBucketMultipartUploads" |
| | | ], |
| | | "Resource": "arn:aws:s3:::bucketName" |
| | | }, |
| | | { |
| | | "Effect": "Allow", |
| | | "Principal": "*", |
| | | "Action": [ |
| | | "s3:AbortMultipartUpload", |
| | | "s3:DeleteObject", |
| | | "s3:GetObject", |
| | | "s3:ListMultipartUploadParts", |
| | | "s3:PutObject" |
| | | ], |
| | | "Resource": "arn:aws:s3:::bucketName/*" |
| | | } |
| | | ] |
| | | } |
| | | """; |
| | | case READ -> """ |
| | | { |
| | | "Version": "2012-10-17", |
| | | "Statement": [ |
| | | { |
| | | "Effect": "Allow", |
| | | "Principal": "*", |
| | | "Action": ["s3:GetBucketLocation"], |
| | | "Resource": "arn:aws:s3:::bucketName" |
| | | }, |
| | | { |
| | | "Effect": "Deny", |
| | | "Principal": "*", |
| | | "Action": ["s3:ListBucket"], |
| | | "Resource": "arn:aws:s3:::bucketName" |
| | | }, |
| | | { |
| | | "Effect": "Allow", |
| | | "Principal": "*", |
| | | "Action": "s3:GetObject", |
| | | "Resource": "arn:aws:s3:::bucketName/*" |
| | | } |
| | | ] |
| | | } |
| | | """; |
| | | }; |
| | | return policy.replaceAll("bucketName", bucketName); |
| | | } |
| | | |
| | | } |
| | |
| | | /** |
| | | * private |
| | | */ |
| | | PRIVATE("0", BucketCannedACL.PRIVATE, ObjectCannedACL.PRIVATE, PolicyType.WRITE), |
| | | PRIVATE("0", BucketCannedACL.PRIVATE, ObjectCannedACL.PRIVATE), |
| | | |
| | | /** |
| | | * public |
| | | */ |
| | | PUBLIC("1", BucketCannedACL.PUBLIC_READ_WRITE, ObjectCannedACL.PUBLIC_READ_WRITE, PolicyType.READ_WRITE), |
| | | PUBLIC("1", BucketCannedACL.PUBLIC_READ_WRITE, ObjectCannedACL.PUBLIC_READ_WRITE), |
| | | |
| | | /** |
| | | * custom |
| | | */ |
| | | CUSTOM("2", BucketCannedACL.PUBLIC_READ, ObjectCannedACL.PUBLIC_READ, PolicyType.READ); |
| | | CUSTOM("2", BucketCannedACL.PUBLIC_READ, ObjectCannedACL.PUBLIC_READ); |
| | | |
| | | /** |
| | | * æ¡¶ æéç±»åï¼æ°æ®åºå¼ï¼ |
| | |
| | | * æä»¶å¯¹è±¡ æéç±»å |
| | | */ |
| | | private final ObjectCannedACL objectCannedACL; |
| | | |
| | | /** |
| | | * æ¡¶çç¥ç±»å |
| | | */ |
| | | private final PolicyType policyType; |
| | | |
| | | public static AccessPolicyType getByType(String type) { |
| | | for (AccessPolicyType value : values()) { |
| | |
| | | * æç¤ºæ¶æ¯ æ¯æå½é
å æ ¼å¼ä¸º {code} |
| | | */ |
| | | String message() default "{rate.limiter.message}"; |
| | | |
| | | /** |
| | | * éæµçç¥è¶
æ¶æ¶é´ é»è®¤ä¸å¤©(çç¥åæ´»æ¶é´ 伿¸
é¤å·²åå¨ççç¥æ°æ®) |
| | | */ |
| | | int timeout() default 86400; |
| | | |
| | | } |
| | |
| | | public void doBefore(JoinPoint point, RateLimiter rateLimiter) { |
| | | int time = rateLimiter.time(); |
| | | int count = rateLimiter.count(); |
| | | int timeout = rateLimiter.timeout(); |
| | | try { |
| | | String combineKey = getCombineKey(rateLimiter, point); |
| | | RateType rateType = RateType.OVERALL; |
| | | if (rateLimiter.limitType() == LimitType.CLUSTER) { |
| | | rateType = RateType.PER_CLIENT; |
| | | } |
| | | long number = RedisUtils.rateLimiter(combineKey, rateType, count, time); |
| | | long number = RedisUtils.rateLimiter(combineKey, rateType, count, time, timeout); |
| | | if (number == -1) { |
| | | String message = rateLimiter.message(); |
| | | if (StringUtils.startsWith(message, "{") && StringUtils.endsWith(message, "}")) { |
| | |
| | | <groupId>com.fasterxml.jackson.datatype</groupId> |
| | | <artifactId>jackson-datatype-jsr310</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- <!– redisåºååæ¿ä»£æ¹æ¡ æ¯jsonå¿«æ æ°çè·¨è¯è¨äºè¿å¶åºåå –>--> |
| | | <!-- <dependency>--> |
| | | <!-- <groupId>org.apache.fury</groupId>--> |
| | | <!-- <artifactId>fury-core</artifactId>--> |
| | | <!-- <version>0.9.0</version>--> |
| | | <!-- </dependency>--> |
| | | <!-- <dependency>--> |
| | | <!-- <groupId>org.slf4j</groupId>--> |
| | | <!-- <artifactId>slf4j-api</artifactId>--> |
| | | <!-- </dependency>--> |
| | | |
| | | </dependencies> |
| | | |
| | | </project> |
| | |
| | | om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY); |
| | | // æå®åºååè¾å
¥çç±»åï¼ç±»å¿
é¡»æ¯éfinal修饰çãåºååæ¶å°å¯¹è±¡å
¨ç±»åä¸èµ·ä¿å䏿¥ |
| | | om.activateDefaultTyping(LaissezFaireSubTypeValidator.instance, ObjectMapper.DefaultTyping.NON_FINAL); |
| | | // LoggerFactory.useSlf4jLogging(true); |
| | | // FuryCodec furyCodec = new FuryCodec(); |
| | | // CompositeCodec codec = new CompositeCodec(StringCodec.INSTANCE, furyCodec, furyCodec); |
| | | TypedJsonJacksonCodec jsonCodec = new TypedJsonJacksonCodec(Object.class, om); |
| | | // ç»ååºåå key ä½¿ç¨ String å
容使ç¨éç¨ json æ ¼å¼ |
| | | CompositeCodec codec = new CompositeCodec(StringCodec.INSTANCE, jsonCodec, jsonCodec); |
| | |
| | | } |
| | | |
| | | @SuppressWarnings("unchecked") |
| | | @Override |
| | | public <T> T get(Object key, Class<T> type) { |
| | | Object o = CAFFEINE.get(getUniqueKey(key), k -> cache.get(key, type)); |
| | | return (T) o; |
| | |
| | | cache.put(key, value); |
| | | } |
| | | |
| | | @Override |
| | | public ValueWrapper putIfAbsent(Object key, Object value) { |
| | | CAFFEINE.invalidate(getUniqueKey(key)); |
| | | return cache.putIfAbsent(key, value); |
| | |
| | | evictIfPresent(key); |
| | | } |
| | | |
| | | @Override |
| | | public boolean evictIfPresent(Object key) { |
| | | boolean b = cache.evictIfPresent(key); |
| | | if (b) { |
| | |
| | | cache.clear(); |
| | | } |
| | | |
| | | @Override |
| | | public boolean invalidate() { |
| | | return cache.invalidate(); |
| | | } |
| | |
| | | package org.dromara.common.redis.utils; |
| | | |
| | | import org.dromara.common.core.utils.SpringUtils; |
| | | import lombok.AccessLevel; |
| | | import lombok.NoArgsConstructor; |
| | | import org.redisson.api.RMap; |
| | | import org.dromara.common.core.utils.SpringUtils; |
| | | import org.springframework.cache.Cache; |
| | | import org.springframework.cache.CacheManager; |
| | | |
| | | import java.util.Set; |
| | | |
| | | /** |
| | | * ç¼åæä½å·¥å
·ç±» {@link } |
| | | * ç¼åæä½å·¥å
·ç±» |
| | | * |
| | | * @author Michelle.Chung |
| | | * @date 2022/8/13 |
| | | */ |
| | | @NoArgsConstructor(access = AccessLevel.PRIVATE) |
| | | @SuppressWarnings(value = {"unchecked"}) |
| | | public class CacheUtils { |
| | | |
| | | private static final CacheManager CACHE_MANAGER = SpringUtils.getBean(CacheManager.class); |
| | | |
| | | /** |
| | | * è·åç¼åç»å
ææçKEY |
| | | * |
| | | * @param cacheNames ç¼åç»åç§° |
| | | */ |
| | | public static Set<Object> keys(String cacheNames) { |
| | | RMap<Object, Object> rmap = (RMap<Object, Object>) CACHE_MANAGER.getCache(cacheNames).getNativeCache(); |
| | | return rmap.keySet(); |
| | | } |
| | | |
| | | /** |
| | | * è·åç¼åå¼ |
| | |
| | | * |
| | | * @param queueName éåå |
| | | * @param capacity 容é |
| | | * @param destroy å·²å卿¯å¦éæ¯ |
| | | * @param destroy æ¯å¦éæ¯ |
| | | */ |
| | | public static <T> boolean trySetBoundedQueueCapacity(String queueName, int capacity, boolean destroy) { |
| | | RBoundedBlockingQueue<T> boundedBlockingQueue = CLIENT.getBoundedBlockingQueue(queueName); |
| | | if (boundedBlockingQueue.isExists() && destroy) { |
| | | destroyQueue(queueName); |
| | | if (destroy) { |
| | | boundedBlockingQueue.delete(); |
| | | } |
| | | return boundedBlockingQueue.trySetCapacity(capacity); |
| | | } |
| | |
| | | import lombok.NoArgsConstructor; |
| | | import org.dromara.common.core.utils.SpringUtils; |
| | | import org.redisson.api.*; |
| | | import org.redisson.api.options.KeysScanOptions; |
| | | |
| | | import java.time.Duration; |
| | | import java.util.Collection; |
| | |
| | | * @return -1 表示失败 |
| | | */ |
| | | public static long rateLimiter(String key, RateType rateType, int rate, int rateInterval) { |
| | | return rateLimiter(key, rateType, rate, rateInterval, 0); |
| | | } |
| | | |
| | | /** |
| | | * éæµ |
| | | * |
| | | * @param key éæµkey |
| | | * @param rateType éæµç±»å |
| | | * @param rate éç |
| | | * @param rateInterval éçé´é |
| | | * @param timeout è¶
æ¶æ¶é´ |
| | | * @return -1 表示失败 |
| | | */ |
| | | public static long rateLimiter(String key, RateType rateType, int rate, int rateInterval, int timeout) { |
| | | RRateLimiter rateLimiter = CLIENT.getRateLimiter(key); |
| | | rateLimiter.trySetRate(rateType, rate, rateInterval, RateIntervalUnit.SECONDS); |
| | | rateLimiter.trySetRate(rateType, rate, Duration.ofSeconds(rateInterval), Duration.ofSeconds(timeout)); |
| | | if (rateLimiter.tryAcquire()) { |
| | | return rateLimiter.availablePermits(); |
| | | } else { |
| | |
| | | } |
| | | |
| | | /** |
| | | * è·å¾ç¼åçåºæ¬å¯¹è±¡å表 |
| | | * |
| | | * è·å¾ç¼åçåºæ¬å¯¹è±¡å表(å
¨å±å¹é
忽ç¥ç§æ· èªè¡æ¼æ¥ç§æ·id) |
| | | * <P> |
| | | * limit-è®¾ç½®æ«æçéå¶æ°é(é»è®¤ä¸º0,æ¥è¯¢å
¨é¨) |
| | | * pattern-设置é®çå¹é
模å¼(é»è®¤ä¸ºnull) |
| | | * chunkSize-è®¾ç½®æ¯æ¬¡æ«æçå大å°(é»è®¤ä¸º0,æ¬æ¹æ³è®¾ç½®ä¸º1000) |
| | | * type-设置é®çç±»å(é»è®¤ä¸ºnull,æ¥è¯¢å
¨é¨ç±»å) |
| | | * </P> |
| | | * @see KeysScanOptions |
| | | * @param pattern å符串åç¼ |
| | | * @return 对象å表 |
| | | */ |
| | | public static Collection<String> keys(final String pattern) { |
| | | Stream<String> stream = CLIENT.getKeys().getKeysStreamByPattern(pattern); |
| | | return stream.collect(Collectors.toList()); |
| | | return keys(KeysScanOptions.defaults().pattern(pattern).chunkSize(1000)); |
| | | } |
| | | |
| | | /** |
| | | * å é¤ç¼åçåºæ¬å¯¹è±¡å表 |
| | | * éè¿æ«æåæ°è·åç¼åçåºæ¬å¯¹è±¡å表 |
| | | * @param keysScanOptions æ«æåæ° |
| | | * <P> |
| | | * limit-è®¾ç½®æ«æçéå¶æ°é(é»è®¤ä¸º0,æ¥è¯¢å
¨é¨) |
| | | * pattern-设置é®çå¹é
模å¼(é»è®¤ä¸ºnull) |
| | | * chunkSize-è®¾ç½®æ¯æ¬¡æ«æçå大å°(é»è®¤ä¸º0) |
| | | * type-设置é®çç±»å(é»è®¤ä¸ºnull,æ¥è¯¢å
¨é¨ç±»å) |
| | | * </P> |
| | | * @see KeysScanOptions |
| | | */ |
| | | public static Collection<String> keys(final KeysScanOptions keysScanOptions) { |
| | | Stream<String> keysStream = CLIENT.getKeys().getKeysStream(keysScanOptions); |
| | | return keysStream.collect(Collectors.toList()); |
| | | } |
| | | |
| | | /** |
| | | * å é¤ç¼åçåºæ¬å¯¹è±¡å表(å
¨å±å¹é
忽ç¥ç§æ· èªè¡æ¼æ¥ç§æ·id) |
| | | * |
| | | * @param pattern å符串åç¼ |
| | | */ |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.common.redis.utils;
|
| | |
|
| | | import cn.hutool.core.date.DatePattern;
|
| | | import cn.hutool.core.date.DateUtil;
|
| | | import org.dromara.common.core.utils.SpringUtils;
|
| | | import org.dromara.common.core.utils.StringUtils;
|
| | | import lombok.AccessLevel;
|
| | | import lombok.NoArgsConstructor;
|
| | | import org.redisson.api.RIdGenerator;
|
| | | import org.redisson.api.RedissonClient;
|
| | |
|
| | | import java.time.Duration;
|
| | |
|
| | | /**
|
| | | * åå·å¨å·¥å
·ç±»
|
| | | *
|
| | | * @author ç§è¾æªå¯
|
| | | * @date 2024-12-10
|
| | | */
|
| | | @NoArgsConstructor(access = AccessLevel.PRIVATE)
|
| | | public class SequenceUtils {
|
| | |
|
| | | /**
|
| | | * é»è®¤åå§å¼
|
| | | */
|
| | | public static final Long DEFAULT_INIT_VALUE = 1L;
|
| | | /**
|
| | | * é»è®¤æ¥é¿
|
| | | */
|
| | | public static final Long DEFAULT_STEP_VALUE = 1L;
|
| | | /**
|
| | | * é»è®¤è¿ææ¶é´-天
|
| | | */
|
| | | public static final Duration DEFAULT_EXPIRE_TIME_DAY = Duration.ofDays(1);
|
| | | /**
|
| | | * é»è®¤è¿ææ¶é´-åé
|
| | | */
|
| | | public static final Duration DEFAULT_EXPIRE_TIME_MINUTE = Duration.ofMinutes(1);
|
| | |
|
| | | /**
|
| | | * è·åRedisson客æ·ç«¯å®ä¾
|
| | | */
|
| | | private static final RedissonClient REDISSON_CLIENT = SpringUtils.getBean(RedissonClient.class);
|
| | |
|
| | | /**
|
| | | * è·åIDçæå¨
|
| | | *
|
| | | * @param key ä¸å¡key
|
| | | * @param expireTime è¿ææ¶é´
|
| | | * @param initValue IDåå§å¼
|
| | | * @param stepValue IDæ¥é¿
|
| | | * @return IDçæå¨
|
| | | */
|
| | | private static RIdGenerator getIdGenerator(String key, Duration expireTime, Long initValue, Long stepValue) {
|
| | | if (initValue == null || initValue <= 0) {
|
| | | initValue = DEFAULT_INIT_VALUE;
|
| | | }
|
| | | if (stepValue == null || stepValue <= 0) {
|
| | | stepValue = DEFAULT_STEP_VALUE;
|
| | | }
|
| | | RIdGenerator idGenerator = REDISSON_CLIENT.getIdGenerator(key);
|
| | | // 设置åå§å¼åæ¥é¿
|
| | | idGenerator.tryInit(initValue, stepValue);
|
| | | // è®¾ç½®è¿ææ¶é´
|
| | | idGenerator.expire(expireTime);
|
| | | return idGenerator;
|
| | | }
|
| | |
|
| | | /**
|
| | | * è·åæå®ä¸å¡keyçå¯ä¸id
|
| | | *
|
| | | * @param key ä¸å¡key
|
| | | * @param expireTime è¿ææ¶é´
|
| | | * @param initValue IDåå§å¼
|
| | | * @param stepValue IDæ¥é¿
|
| | | * @return å¯ä¸id
|
| | | */
|
| | | public static long nextId(String key, Duration expireTime, Long initValue, Long stepValue) {
|
| | | return getIdGenerator(key, expireTime, initValue, stepValue).nextId();
|
| | | }
|
| | |
|
| | | /**
|
| | | * è·åæå®ä¸å¡keyçå¯ä¸idå符串
|
| | | *
|
| | | * @param key ä¸å¡key
|
| | | * @param expireTime è¿ææ¶é´
|
| | | * @param initValue IDåå§å¼
|
| | | * @param stepValue IDæ¥é¿
|
| | | * @return å¯ä¸id
|
| | | */
|
| | | public static String nextIdStr(String key, Duration expireTime, Long initValue, Long stepValue) {
|
| | | return String.valueOf(nextId(key, expireTime, initValue, stepValue));
|
| | | }
|
| | |
|
| | | /**
|
| | | * è·åæå®ä¸å¡keyçå¯ä¸id (IDåå§å¼=1,IDæ¥é¿=1)
|
| | | *
|
| | | * @param key ä¸å¡key
|
| | | * @param expireTime è¿ææ¶é´
|
| | | * @return å¯ä¸id
|
| | | */
|
| | | public static long nextId(String key, Duration expireTime) {
|
| | | return getIdGenerator(key, expireTime, DEFAULT_INIT_VALUE, DEFAULT_STEP_VALUE).nextId();
|
| | | }
|
| | |
|
| | | /**
|
| | | * è·åæå®ä¸å¡keyçå¯ä¸idå符串 (IDåå§å¼=1,IDæ¥é¿=1)
|
| | | *
|
| | | * @param key ä¸å¡key
|
| | | * @param expireTime è¿ææ¶é´
|
| | | * @return å¯ä¸id
|
| | | */
|
| | | public static String nextIdStr(String key, Duration expireTime) {
|
| | | return String.valueOf(nextId(key, expireTime));
|
| | | }
|
| | |
|
| | | /**
|
| | | * è·å yyyyMMdd å¼å¤´çå¯ä¸id
|
| | | *
|
| | | * @return å¯ä¸id
|
| | | */
|
| | | public static String nextIdDate() {
|
| | | return nextIdDate("");
|
| | | }
|
| | |
|
| | | /**
|
| | | * è·å prefix + yyyyMMdd å¼å¤´çå¯ä¸id
|
| | | *
|
| | | * @param prefix ä¸å¡åç¼
|
| | | * @return å¯ä¸id
|
| | | */
|
| | | public static String nextIdDate(String prefix) {
|
| | | // åç¼+æ¥æ æå»º prefixKey
|
| | | String prefixKey = StringUtils.format("{}{}", StringUtils.blankToDefault(prefix, ""), DateUtil.format(DateUtil.date(), DatePattern.PURE_DATE_FORMATTER));
|
| | | // è·åä¸ä¸ä¸ªid
|
| | | long nextId = getIdGenerator(prefixKey, DEFAULT_EXPIRE_TIME_DAY, DEFAULT_INIT_VALUE, DEFAULT_STEP_VALUE).nextId();
|
| | | // è¿å宿´id
|
| | | return StringUtils.format("{}{}", prefixKey, nextId);
|
| | | }
|
| | |
|
| | | /**
|
| | | * è·å yyyyMMddHHmmss å¼å¤´çå¯ä¸id
|
| | | *
|
| | | * @return å¯ä¸id
|
| | | */
|
| | | public static String nextIdDateTime() {
|
| | | return nextIdDateTime("");
|
| | | }
|
| | |
|
| | | /**
|
| | | * è·å prefix + yyyyMMddHHmmss å¼å¤´çå¯ä¸id
|
| | | *
|
| | | * @param prefix ä¸å¡åç¼
|
| | | * @return å¯ä¸id
|
| | | */
|
| | | public static String nextIdDateTime(String prefix) {
|
| | | // åç¼+æ¥ææ¶é´ æå»º prefixKey
|
| | | String prefixKey = StringUtils.format("{}{}", StringUtils.blankToDefault(prefix, ""), DateUtil.format(DateUtil.date(), DatePattern.PURE_DATETIME_FORMATTER));
|
| | | // è·åä¸ä¸ä¸ªid
|
| | | long nextId = getIdGenerator(prefixKey, DEFAULT_EXPIRE_TIME_MINUTE, DEFAULT_INIT_VALUE, DEFAULT_STEP_VALUE).nextId();
|
| | | // è¿å宿´id
|
| | | return StringUtils.format("{}{}", prefixKey, nextId);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | if (timeout == NEVER_EXPIRE) { |
| | | RedisUtils.setCacheObject(key, value); |
| | | } else { |
| | | RedisUtils.setCacheObject(key, value, Duration.ofSeconds(timeout)); |
| | | if (RedisUtils.hasKey(key)) { |
| | | RedisUtils.setCacheObject(key, value, true); |
| | | } else { |
| | | RedisUtils.setCacheObject(key, value, Duration.ofSeconds(timeout)); |
| | | } |
| | | } |
| | | CAFFEINE.invalidate(key); |
| | | } |
| | |
| | | if (timeout == NEVER_EXPIRE) { |
| | | RedisUtils.setCacheObject(key, object); |
| | | } else { |
| | | RedisUtils.setCacheObject(key, object, Duration.ofSeconds(timeout)); |
| | | if (RedisUtils.hasKey(key)) { |
| | | RedisUtils.setCacheObject(key, object, true); |
| | | } else { |
| | | RedisUtils.setCacheObject(key, object, Duration.ofSeconds(timeout)); |
| | | } |
| | | } |
| | | CAFFEINE.invalidate(key); |
| | | } |
| | |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import lombok.AccessLevel; |
| | | import lombok.NoArgsConstructor; |
| | | import org.dromara.common.core.constant.SystemConstants; |
| | | import org.dromara.common.core.constant.TenantConstants; |
| | | import org.dromara.common.core.constant.UserConstants; |
| | | import org.dromara.common.core.domain.model.LoginUser; |
| | | import org.dromara.common.core.enums.UserType; |
| | | |
| | | import java.util.Set; |
| | | |
| | | |
| | | /** |
| | | * ç»å½é´æå©æ |
| | |
| | | } |
| | | |
| | | /** |
| | | * è·åç¨æ·id |
| | | */ |
| | | public static String getUserIdStr() { |
| | | return Convert.toStr(getExtra(USER_KEY)); |
| | | } |
| | | |
| | | /** |
| | | * è·åç¨æ·è´¦æ· |
| | | */ |
| | | public static String getUsername() { |
| | |
| | | * @return ç»æ |
| | | */ |
| | | public static boolean isSuperAdmin(Long userId) { |
| | | return UserConstants.SUPER_ADMIN_ID.equals(userId); |
| | | return SystemConstants.SUPER_ADMIN_ID.equals(userId); |
| | | } |
| | | |
| | | /** |
| | |
| | | import cn.dev33.satoken.router.SaRouter; |
| | | import cn.dev33.satoken.stp.StpUtil; |
| | | import cn.dev33.satoken.util.SaResult; |
| | | import jakarta.servlet.http.HttpServletRequest; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.dromara.common.core.constant.HttpStatus; |
| | | import org.dromara.common.core.exception.SseException; |
| | | import org.dromara.common.core.utils.ServletUtils; |
| | | import org.dromara.common.core.utils.SpringUtils; |
| | | import org.dromara.common.core.utils.StringUtils; |
| | |
| | | .match(allUrlHandler.getUrls()) |
| | | // å¯¹æªæé¤çè·¯å¾è¿è¡æ£æ¥ |
| | | .check(() -> { |
| | | HttpServletRequest request = ServletUtils.getRequest(); |
| | | // æ£æ¥æ¯å¦ç»å½ æ¯å¦ætoken |
| | | StpUtil.checkLogin(); |
| | | try { |
| | | StpUtil.checkLogin(); |
| | | } catch (NotLoginException e) { |
| | | if (request.getRequestURI().contains("sse")) { |
| | | throw new SseException(e.getMessage(), e.getCode()); |
| | | } else { |
| | | throw e; |
| | | } |
| | | } |
| | | |
| | | // æ£æ¥ header ä¸ param éç clientid ä¸ token éçæ¯å¦ä¸è´ |
| | | String headerCid = ServletUtils.getRequest().getHeader(LoginHelper.CLIENT_KEY); |
| | | String headerCid = request.getHeader(LoginHelper.CLIENT_KEY); |
| | | String paramCid = ServletUtils.getParameter(LoginHelper.CLIENT_KEY); |
| | | String clientId = StpUtil.getExtra(LoginHelper.CLIENT_KEY).toString(); |
| | | if (!StringUtils.equalsAny(clientId, headerCid, paramCid)) { |
| | |
| | | public @interface Sensitive { |
| | | SensitiveStrategy strategy(); |
| | | |
| | | String roleKey() default ""; |
| | | /** |
| | | * è§è²æ è¯ç¬¦ å¤ä¸ªè§è²æ»¡è¶³ä¸ä¸ªå³å¯ |
| | | */ |
| | | String[] roleKey() default {}; |
| | | |
| | | String perms() default ""; |
| | | /** |
| | | * æéæ è¯ç¬¦ å¤ä¸ªæé满足ä¸ä¸ªå³å¯ |
| | | */ |
| | | String[] perms() default {}; |
| | | } |
| | |
| | | /** |
| | | * æ¯å¦è±æ |
| | | */ |
| | | boolean isSensitive(String roleKey, String perms); |
| | | boolean isSensitive(String[] roleKey, String[] perms); |
| | | |
| | | } |
| | |
| | | FIRST_MASK(DesensitizedUtil::firstMask), |
| | | |
| | | /** |
| | | * æ¸
空为null |
| | | * æ¸
空为"" |
| | | */ |
| | | CLEAR(s -> DesensitizedUtil.clear()), |
| | | |
| | | /** |
| | | * æ¸
空为"" |
| | | * æ¸
空为null |
| | | */ |
| | | CLEAR_TO_NULL(s -> DesensitizedUtil.clearToNull()); |
| | | |
| | |
| | | public class SensitiveHandler extends JsonSerializer<String> implements ContextualSerializer { |
| | | |
| | | private SensitiveStrategy strategy; |
| | | private String roleKey; |
| | | private String perms; |
| | | private String[] roleKey; |
| | | private String[] perms; |
| | | |
| | | @Override |
| | | public void serialize(String value, JsonGenerator gen, SerializerProvider serializers) throws IOException { |
| | |
| | | */ |
| | | @Override |
| | | public void clean() { |
| | | RedisUtils.deleteObject(GlobalConstants.GLOBAL_REDIS_KEY + "sms:"); |
| | | RedisUtils.deleteKeys(GlobalConstants.GLOBAL_REDIS_KEY + "sms:*"); |
| | | } |
| | | |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | protected AuthToken getAccessToken(AuthCallback authCallback) { |
| | | public AuthToken getAccessToken(AuthCallback authCallback) { |
| | | String body = doPostAuthorizationCode(authCallback.getCode()); |
| | | Dict object = JsonUtils.parseMap(body); |
| | | // oauth/token éªè¯å¼å¸¸ |
| | |
| | | } |
| | | |
| | | @Override |
| | | protected AuthUser getUserInfo(AuthToken authToken) { |
| | | public AuthUser getUserInfo(AuthToken authToken) { |
| | | String body = doGetUserInfo(authToken); |
| | | Dict object = JsonUtils.parseMap(body); |
| | | // oauth/token éªè¯å¼å¸¸ |
| | |
| | | package org.dromara.common.social.topiam; |
| | | |
| | | import cn.hutool.core.codec.Base64; |
| | | import cn.hutool.core.lang.Dict; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import cn.hutool.http.HttpRequest; |
| | | import cn.hutool.http.HttpResponse; |
| | | import com.xkcoding.http.support.HttpHeader; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import me.zhyd.oauth.cache.AuthStateCache; |
| | |
| | | import org.dromara.common.core.utils.SpringUtils; |
| | | import org.dromara.common.json.utils.JsonUtils; |
| | | |
| | | import static org.dromara.common.social.topiam.AuthTopiamSource.TOPIAM; |
| | | import static org.dromara.common.social.topiam.AuthTopIamSource.TOPIAM; |
| | | |
| | | /** |
| | | * TopIAM 认è¯è¯·æ± |
| | |
| | | } |
| | | |
| | | @Override |
| | | protected AuthToken getAccessToken(AuthCallback authCallback) { |
| | | public AuthToken getAccessToken(AuthCallback authCallback) { |
| | | String body = doPostAuthorizationCode(authCallback.getCode()); |
| | | Dict object = JsonUtils.parseMap(body); |
| | | checkResponse(object); |
| | |
| | | } |
| | | |
| | | @Override |
| | | protected AuthUser getUserInfo(AuthToken authToken) { |
| | | public AuthUser getUserInfo(AuthToken authToken) { |
| | | String body = doGetUserInfo(authToken); |
| | | Dict object = JsonUtils.parseMap(body); |
| | | checkResponse(object); |
| | |
| | | .build(); |
| | | } |
| | | |
| | | @Override |
| | | protected String doPostAuthorizationCode(String code) { |
| | | HttpRequest request = HttpRequest.post(source.accessToken()) |
| | | .header("Authorization", "Basic " + Base64.encode("%s:%s".formatted(config.getClientId(), config.getClientSecret()))) |
| | | .form("grant_type", "authorization_code") |
| | | .form("code", code) |
| | | .form("redirect_uri", config.getRedirectUri()); |
| | | HttpResponse response = request.execute(); |
| | | return response.body(); |
| | | } |
| | | |
| | | @Override |
| | | protected String doGetUserInfo(AuthToken authToken) { |
| | |
| | | .build(); |
| | | } |
| | | |
| | | public static void checkResponse(Dict object) { |
| | | private static void checkResponse(Dict object) { |
| | | // oauth/token éªè¯å¼å¸¸ |
| | | if (object.containsKey("error")) { |
| | | throw new AuthException(object.getStr("error_description")); |
ÎļþÃû´Ó ruoyi-common/ruoyi-common-social/src/main/java/org/dromara/common/social/topiam/AuthTopiamSource.java ÐÞ¸Ä |
| | |
| | | * @author xlsea |
| | | * @since 2024-01-06 |
| | | */ |
| | | public enum AuthTopiamSource implements AuthSource { |
| | | public enum AuthTopIamSource implements AuthSource { |
| | | |
| | | /** |
| | | * æµè¯ |
| | |
| | | case "linkedin" -> new AuthLinkedinRequest(builder.build(), STATE_CACHE); |
| | | case "microsoft" -> new AuthMicrosoftRequest(builder.build(), STATE_CACHE); |
| | | case "renren" -> new AuthRenrenRequest(builder.build(), STATE_CACHE); |
| | | case "stack_overflow" -> new AuthStackOverflowRequest(builder.build(), STATE_CACHE); |
| | | case "huawei" -> new AuthHuaweiRequest(builder.build(), STATE_CACHE); |
| | | case "wechat_enterprise" -> new AuthWeChatEnterpriseQrcodeRequest(builder.build(), STATE_CACHE); |
| | | case "stack_overflow" -> new AuthStackOverflowRequest(builder.stackOverflowKey(obj.getStackOverflowKey()).build(), STATE_CACHE); |
| | | case "huawei" -> new AuthHuaweiV3Request(builder.build(), STATE_CACHE); |
| | | case "wechat_enterprise" -> new AuthWeChatEnterpriseQrcodeRequest(builder.agentId(obj.getAgentId()).build(), STATE_CACHE); |
| | | case "gitlab" -> new AuthGitlabRequest(builder.build(), STATE_CACHE); |
| | | case "wechat_mp" -> new AuthWeChatMpRequest(builder.build(), STATE_CACHE); |
| | | case "aliyun" -> new AuthAliyunRequest(builder.build(), STATE_CACHE); |
| | |
| | | package org.dromara.common.sse.core; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.map.MapUtil; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.dromara.common.redis.utils.RedisUtils; |
| | | import org.dromara.common.sse.dto.SseMessageDto; |
| | | import org.springframework.web.servlet.mvc.method.annotation.SseEmitter; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | | import java.util.function.Consumer; |
| | |
| | | * @param token ç¨æ·çå¯ä¸ä»¤çï¼ç¨äºè¯å«å
·ä½çè¿æ¥ |
| | | */ |
| | | public void disconnect(Long userId, String token) { |
| | | if (userId == null || token == null) { |
| | | return; |
| | | } |
| | | Map<String, SseEmitter> emitters = USER_TOKEN_EMITTERS.get(userId); |
| | | if (emitters != null) { |
| | | if (MapUtil.isNotEmpty(emitters)) { |
| | | try { |
| | | emitters.get(token).send(SseEmitter.event().comment("disconnected")); |
| | | SseEmitter sseEmitter = emitters.get(token); |
| | | sseEmitter.send(SseEmitter.event().comment("disconnected")); |
| | | sseEmitter.complete(); |
| | | } catch (Exception ignore) { |
| | | } |
| | | emitters.remove(token); |
| | | } else { |
| | | USER_TOKEN_EMITTERS.remove(userId); |
| | | } |
| | | } |
| | | |
| | |
| | | */ |
| | | public void sendMessage(Long userId, String message) { |
| | | Map<String, SseEmitter> emitters = USER_TOKEN_EMITTERS.get(userId); |
| | | if (emitters != null) { |
| | | if (MapUtil.isNotEmpty(emitters)) { |
| | | for (Map.Entry<String, SseEmitter> entry : emitters.entrySet()) { |
| | | try { |
| | | entry.getValue().send(SseEmitter.event() |
| | |
| | | emitters.remove(entry.getKey()); |
| | | } |
| | | } |
| | | } else { |
| | | USER_TOKEN_EMITTERS.remove(userId); |
| | | } |
| | | } |
| | | |
| | |
| | | * @param sseMessageDto è¦åå¸çSSEæ¶æ¯å¯¹è±¡ |
| | | */ |
| | | public void publishMessage(SseMessageDto sseMessageDto) { |
| | | List<Long> unsentUserIds = new ArrayList<>(); |
| | | // å½åæå¡å
ç¨æ·,ç´æ¥åéæ¶æ¯ |
| | | for (Long userId : sseMessageDto.getUserIds()) { |
| | | if (USER_TOKEN_EMITTERS.containsKey(userId)) { |
| | | sendMessage(userId, sseMessageDto.getMessage()); |
| | | continue; |
| | | } |
| | | unsentUserIds.add(userId); |
| | | } |
| | | // ä¸å¨å½åæå¡å
ç¨æ·,åå¸è®¢é
æ¶æ¯ |
| | | if (CollUtil.isNotEmpty(unsentUserIds)) { |
| | | SseMessageDto broadcastMessage = new SseMessageDto(); |
| | | broadcastMessage.setMessage(sseMessageDto.getMessage()); |
| | | broadcastMessage.setUserIds(unsentUserIds); |
| | | RedisUtils.publish(SSE_TOPIC, broadcastMessage, consumer -> { |
| | | log.info("SSEåé主é¢è®¢é
æ¶æ¯topic:{} session keys:{} message:{}", |
| | | SSE_TOPIC, unsentUserIds, sseMessageDto.getMessage()); |
| | | }); |
| | | } |
| | | SseMessageDto broadcastMessage = new SseMessageDto(); |
| | | broadcastMessage.setMessage(sseMessageDto.getMessage()); |
| | | broadcastMessage.setUserIds(sseMessageDto.getUserIds()); |
| | | RedisUtils.publish(SSE_TOPIC, broadcastMessage, consumer -> { |
| | | log.info("SSEåé主é¢è®¢é
æ¶æ¯topic:{} session keys:{} message:{}", |
| | | SSE_TOPIC, sseMessageDto.getUserIds(), sseMessageDto.getMessage()); |
| | | }); |
| | | } |
| | | |
| | | /** |
| | |
| | | @NoArgsConstructor(access = AccessLevel.PRIVATE) |
| | | public class SseMessageUtils { |
| | | |
| | | private final static SseEmitterManager MANAGER = SpringUtils.getBean(SseEmitterManager.class); |
| | | private final static Boolean SSE_ENABLE = SpringUtils.getProperty("sse.enabled", Boolean.class, true); |
| | | private static SseEmitterManager MANAGER; |
| | | |
| | | static { |
| | | if (isEnable() && MANAGER == null) { |
| | | MANAGER = SpringUtils.getBean(SseEmitterManager.class); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * åæå®çWebSocketä¼è¯åéæ¶æ¯ |
| | |
| | | * @param message è¦åéçæ¶æ¯å
容 |
| | | */ |
| | | public static void sendMessage(Long userId, String message) { |
| | | if (!isEnable()) { |
| | | return; |
| | | } |
| | | MANAGER.sendMessage(userId, message); |
| | | } |
| | | |
| | |
| | | * @param message è¦åéçæ¶æ¯å
容 |
| | | */ |
| | | public static void sendMessage(String message) { |
| | | if (!isEnable()) { |
| | | return; |
| | | } |
| | | MANAGER.sendMessage(message); |
| | | } |
| | | |
| | |
| | | * @param sseMessageDto è¦åå¸çSSEæ¶æ¯å¯¹è±¡ |
| | | */ |
| | | public static void publishMessage(SseMessageDto sseMessageDto) { |
| | | if (!isEnable()) { |
| | | return; |
| | | } |
| | | MANAGER.publishMessage(sseMessageDto); |
| | | } |
| | | |
| | |
| | | * @param message è¦åå¸çæ¶æ¯å
容 |
| | | */ |
| | | public static void publishAll(String message) { |
| | | if (!isEnable()) { |
| | | return; |
| | | } |
| | | MANAGER.publishAll(message); |
| | | } |
| | | |
| | | /** |
| | | * æ¯å¦å¼å¯ |
| | | */ |
| | | public static Boolean isEnable() { |
| | | return SSE_ENABLE; |
| | | } |
| | | |
| | | } |
| | |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import com.baomidou.mybatisplus.extension.plugins.inner.TenantLineInnerInterceptor; |
| | | import org.dromara.common.core.utils.reflect.ReflectUtils; |
| | | import org.dromara.common.mybatis.config.MybatisPlusConfig; |
| | | import org.dromara.common.redis.config.RedisConfig; |
| | | import org.dromara.common.redis.config.properties.RedissonProperties; |
| | | import org.dromara.common.tenant.core.TenantSaTokenDao; |
| | |
| | | import org.redisson.config.SingleServerConfig; |
| | | import org.redisson.spring.starter.RedissonAutoConfigurationCustomizer; |
| | | import org.springframework.boot.autoconfigure.AutoConfiguration; |
| | | import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; |
| | | import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; |
| | | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
| | | import org.springframework.boot.context.properties.EnableConfigurationProperties; |
| | | import org.springframework.cache.CacheManager; |
| | |
| | | @ConditionalOnProperty(value = "tenant.enable", havingValue = "true") |
| | | public class TenantConfig { |
| | | |
| | | @ConditionalOnBean(MybatisPlusConfig.class) |
| | | @AutoConfiguration(after = {MybatisPlusConfig.class}) |
| | | @ConditionalOnClass(TenantLineInnerInterceptor.class) |
| | | @AutoConfiguration |
| | | static class MybatisPlusConfiguration { |
| | | |
| | | /** |
| | |
| | | // 使ç¨åæºæ¨¡å¼ |
| | | // 设置å¤ç§æ· redis keyåç¼ |
| | | singleServerConfig.setNameMapper(nameMapper); |
| | | ReflectUtils.invokeSetter(config, "singleServerConfig", singleServerConfig); |
| | | } |
| | | ClusterServersConfig clusterServersConfig = ReflectUtils.invokeGetter(config, "clusterServersConfig"); |
| | | // é群é
ç½®æ¹å¼ åè䏿¹æ³¨é |
| | | if (ObjectUtil.isNotNull(clusterServersConfig)) { |
| | | // 设置å¤ç§æ· redis keyåç¼ |
| | | clusterServersConfig.setNameMapper(nameMapper); |
| | | ReflectUtils.invokeSetter(config, "clusterServersConfig", clusterServersConfig); |
| | | } |
| | | }; |
| | | } |
| | |
| | | if (StringUtils.isBlank(name)) { |
| | | return null; |
| | | } |
| | | if (InterceptorIgnoreHelper.willIgnoreTenantLine("")) { |
| | | return super.map(name); |
| | | try { |
| | | if (InterceptorIgnoreHelper.willIgnoreTenantLine("")) { |
| | | return super.map(name); |
| | | } |
| | | } catch (NoClassDefFoundError ignore) { |
| | | // æäºæå¡ä¸éè¦mp导è´ç±»ä¸åå¨ å¿½ç¥å³å¯ |
| | | } |
| | | if (StringUtils.contains(name, GlobalConstants.GLOBAL_REDIS_KEY)) { |
| | | return super.map(name); |
| | | } |
| | | String tenantId = TenantHelper.getTenantId(); |
| | | if (StringUtils.isBlank(tenantId)) { |
| | | log.error("æ æ³è·åææçç§æ·id -> Null"); |
| | | log.debug("æ æ³è·åææçç§æ·id -> Null"); |
| | | return super.map(name); |
| | | } |
| | | if (StringUtils.startsWith(name, tenantId + "")) { |
| | | // 妿åå¨åç´æ¥è¿å |
| | |
| | | if (StringUtils.isBlank(unmap)) { |
| | | return null; |
| | | } |
| | | if (InterceptorIgnoreHelper.willIgnoreTenantLine("")) { |
| | | return super.unmap(name); |
| | | try { |
| | | if (InterceptorIgnoreHelper.willIgnoreTenantLine("")) { |
| | | return unmap; |
| | | } |
| | | } catch (NoClassDefFoundError ignore) { |
| | | // æäºæå¡ä¸éè¦mp导è´ç±»ä¸åå¨ å¿½ç¥å³å¯ |
| | | } |
| | | if (StringUtils.contains(name, GlobalConstants.GLOBAL_REDIS_KEY)) { |
| | | return super.unmap(name); |
| | | return unmap; |
| | | } |
| | | String tenantId = TenantHelper.getTenantId(); |
| | | if (StringUtils.isBlank(tenantId)) { |
| | | log.error("æ æ³è·åææçç§æ·id -> Null"); |
| | | log.debug("æ æ³è·åææçç§æ·id -> Null"); |
| | | return unmap; |
| | | } |
| | | if (StringUtils.startsWith(unmap, tenantId + "")) { |
| | | // 妿åå¨åå é¤ |
| | |
| | | package org.dromara.common.tenant.helper; |
| | | |
| | | import cn.dev33.satoken.stp.StpUtil; |
| | | import cn.dev33.satoken.context.SaHolder; |
| | | import cn.dev33.satoken.context.model.SaStorage; |
| | | import cn.hutool.core.collection.CollectionUtil; |
| | | import cn.hutool.core.convert.Convert; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | |
| | | if (!isEnable()) { |
| | | return; |
| | | } |
| | | if (!isLogin() || !global) { |
| | | if (!LoginHelper.isLogin() || !global) { |
| | | TEMP_DYNAMIC_TENANT.set(tenantId); |
| | | return; |
| | | } |
| | | String cacheKey = DYNAMIC_TENANT_KEY + ":" + LoginHelper.getUserId(); |
| | | RedisUtils.setCacheObject(cacheKey, tenantId); |
| | | SaHolder.getStorage().set(cacheKey, tenantId); |
| | | } |
| | | |
| | | /** |
| | |
| | | if (!isEnable()) { |
| | | return null; |
| | | } |
| | | if (!isLogin()) { |
| | | if (!LoginHelper.isLogin()) { |
| | | return TEMP_DYNAMIC_TENANT.get(); |
| | | } |
| | | // å¦æçº¿ç¨å
æå¼ ä¼å
è¿å |
| | |
| | | if (StringUtils.isNotBlank(tenantId)) { |
| | | return tenantId; |
| | | } |
| | | SaStorage storage = SaHolder.getStorage(); |
| | | String cacheKey = DYNAMIC_TENANT_KEY + ":" + LoginHelper.getUserId(); |
| | | tenantId = storage.getString(cacheKey); |
| | | // å¦æä¸º -1 说æå·²ç»æ¥è¿rediså¹¶ä¸ä¸åå¨å¼ åç´æ¥è¿ånull |
| | | if (StringUtils.isNotBlank(tenantId)) { |
| | | return tenantId.equals("-1") ? null : tenantId; |
| | | } |
| | | tenantId = RedisUtils.getCacheObject(cacheKey); |
| | | storage.set(cacheKey, StringUtils.isBlank(tenantId) ? "-1" : tenantId); |
| | | return tenantId; |
| | | } |
| | | |
| | |
| | | if (!isEnable()) { |
| | | return; |
| | | } |
| | | if (!isLogin()) { |
| | | if (!LoginHelper.isLogin()) { |
| | | TEMP_DYNAMIC_TENANT.remove(); |
| | | return; |
| | | } |
| | | TEMP_DYNAMIC_TENANT.remove(); |
| | | String cacheKey = DYNAMIC_TENANT_KEY + ":" + LoginHelper.getUserId(); |
| | | RedisUtils.deleteObject(cacheKey); |
| | | SaHolder.getStorage().delete(cacheKey); |
| | | } |
| | | |
| | | /** |
| | |
| | | tenantId = LoginHelper.getTenantId(); |
| | | } |
| | | return tenantId; |
| | | } |
| | | |
| | | private static boolean isLogin() { |
| | | try { |
| | | StpUtil.checkLogin(); |
| | | return true; |
| | | } catch (Exception e) { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | if (ObjectUtil.isNotNull(trans)) { |
| | | // 妿æ å°å段ä¸ä¸ºç©º ååæ å°å段çå¼ |
| | | if (StringUtils.isNotBlank(translation.mapper())) { |
| | | value = ReflectUtils.invokeGetter(gen.getCurrentValue(), translation.mapper()); |
| | | value = ReflectUtils.invokeGetter(gen.currentValue(), translation.mapper()); |
| | | } |
| | | // å¦æä¸º null ç´æ¥ååº |
| | | if (ObjectUtil.isNull(value)) { |
| | |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>io.undertow</groupId> |
| | | <artifactId>undertow-core</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>io.undertow</groupId> |
| | | <artifactId>undertow-servlet</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>io.undertow</groupId> |
| | | <artifactId>undertow-websockets-jsr</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-actuator</artifactId> |
| | | </dependency> |
| | |
| | | package org.dromara.common.web.config; |
| | | |
| | | import org.dromara.common.core.utils.StringUtils; |
| | | import jakarta.servlet.DispatcherType; |
| | | import org.dromara.common.web.config.properties.XssProperties; |
| | | import org.dromara.common.web.filter.RepeatableFilter; |
| | | import org.dromara.common.web.filter.XssFilter; |
| | | import jakarta.servlet.DispatcherType; |
| | | import org.springframework.boot.autoconfigure.AutoConfiguration; |
| | | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
| | | import org.springframework.boot.context.properties.EnableConfigurationProperties; |
| | | import org.springframework.boot.web.servlet.FilterRegistrationBean; |
| | | import org.springframework.context.annotation.Bean; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * Filteré
ç½® |
| | |
| | | @EnableConfigurationProperties(XssProperties.class) |
| | | public class FilterConfig { |
| | | |
| | | @SuppressWarnings({"rawtypes", "unchecked"}) |
| | | @Bean |
| | | @ConditionalOnProperty(value = "xss.enabled", havingValue = "true") |
| | | public FilterRegistrationBean xssFilterRegistration(XssProperties xssProperties) { |
| | | FilterRegistrationBean registration = new FilterRegistrationBean(); |
| | | public FilterRegistrationBean<XssFilter> xssFilterRegistration() { |
| | | FilterRegistrationBean<XssFilter> registration = new FilterRegistrationBean<>(); |
| | | registration.setDispatcherTypes(DispatcherType.REQUEST); |
| | | registration.setFilter(new XssFilter()); |
| | | registration.addUrlPatterns(StringUtils.split(xssProperties.getUrlPatterns(), StringUtils.SEPARATOR)); |
| | | registration.addUrlPatterns("/*"); |
| | | registration.setName("xssFilter"); |
| | | registration.setOrder(FilterRegistrationBean.HIGHEST_PRECEDENCE); |
| | | Map<String, String> initParameters = new HashMap<>(); |
| | | initParameters.put("excludes", xssProperties.getExcludes()); |
| | | registration.setInitParameters(initParameters); |
| | | registration.setOrder(FilterRegistrationBean.HIGHEST_PRECEDENCE + 1); |
| | | return registration; |
| | | } |
| | | |
| | | @SuppressWarnings({"rawtypes", "unchecked"}) |
| | | @Bean |
| | | public FilterRegistrationBean someFilterRegistration() { |
| | | FilterRegistrationBean registration = new FilterRegistrationBean(); |
| | | public FilterRegistrationBean<RepeatableFilter> someFilterRegistration() { |
| | | FilterRegistrationBean<RepeatableFilter> registration = new FilterRegistrationBean<>(); |
| | | registration.setFilter(new RepeatableFilter()); |
| | | registration.addUrlPatterns("/*"); |
| | | registration.setName("repeatableFilter"); |
| | |
| | | package org.dromara.common.web.config; |
| | | |
| | | import io.undertow.server.DefaultByteBufferPool; |
| | | import io.undertow.server.handlers.DisallowedMethodsHandler; |
| | | import io.undertow.util.HttpString; |
| | | import io.undertow.websockets.jsr.WebSocketDeploymentInfo; |
| | | import org.dromara.common.core.utils.SpringUtils; |
| | | import org.springframework.boot.autoconfigure.AutoConfiguration; |
| | |
| | | @AutoConfiguration |
| | | public class UndertowConfig implements WebServerFactoryCustomizer<UndertowServletWebServerFactory> { |
| | | |
| | | /** |
| | | * èªå®ä¹ Undertow é
ç½® |
| | | * <p> |
| | | * 主è¦é
ç½®å
容å
æ¬ï¼ |
| | | * 1. é
ç½® WebSocket é¨ç½²ä¿¡æ¯ |
| | | * 2. å¨èæçº¿ç¨æ¨¡å¼ä¸ä½¿ç¨èæçº¿ç¨æ± |
| | | * 3. ç¦ç¨ä¸å®å
¨ç HTTP æ¹æ³ï¼å¦ CONNECTãTRACEãTRACK |
| | | * </p> |
| | | * |
| | | * @param factory Undertow ç Web æå¡å¨å·¥å |
| | | */ |
| | | @Override |
| | | public void customize(UndertowServletWebServerFactory factory) { |
| | | factory.addDeploymentInfoCustomizers(deploymentInfo -> { |
| | | // é
ç½® WebSocket é¨ç½²ä¿¡æ¯ï¼è®¾ç½® WebSocket 使ç¨çç¼å²åºæ± |
| | | WebSocketDeploymentInfo webSocketDeploymentInfo = new WebSocketDeploymentInfo(); |
| | | webSocketDeploymentInfo.setBuffers(new DefaultByteBufferPool(true, 1024)); |
| | | deploymentInfo.addServletContextAttribute("io.undertow.websockets.jsr.WebSocketDeploymentInfo", webSocketDeploymentInfo); |
| | | // 使ç¨èæçº¿ç¨ |
| | | |
| | | // 妿å¯ç¨äºèæçº¿ç¨ï¼é
ç½® Undertow 使ç¨èæçº¿ç¨æ± |
| | | if (SpringUtils.isVirtual()) { |
| | | // å建èæçº¿ç¨æ± ï¼çº¿ç¨æ± åç¼ä¸º "undertow-" |
| | | VirtualThreadTaskExecutor executor = new VirtualThreadTaskExecutor("undertow-"); |
| | | // 设置èæçº¿ç¨æ± 为æ§è¡å¨å弿¥æ§è¡å¨ |
| | | deploymentInfo.setExecutor(executor); |
| | | deploymentInfo.setAsyncExecutor(executor); |
| | | } |
| | | |
| | | // é
ç½®ç¦æ¢æäºä¸å®å
¨ç HTTP æ¹æ³ï¼å¦ CONNECTãTRACEãTRACKï¼ |
| | | deploymentInfo.addInitialHandlerChainWrapper(handler -> { |
| | | // ç¦æ¢ä¸ä¸ªæ¹æ³ CONNECT/TRACE/TRACK 乿¯ä¸å®å
¨ç é¿å
ç¬è«éªæ° |
| | | HttpString[] disallowedHttpMethods = { |
| | | HttpString.tryFromString("CONNECT"), |
| | | HttpString.tryFromString("TRACE"), |
| | | HttpString.tryFromString("TRACK") |
| | | }; |
| | | // ä½¿ç¨ DisallowedMethodsHandler æ¦æªå¹¶æç»è¿äºæ¹æ³çè¯·æ± |
| | | return new DisallowedMethodsHandler(handler, disallowedHttpMethods); |
| | | }); |
| | | }); |
| | | } |
| | | |
| | |
| | | import lombok.Data; |
| | | import org.springframework.boot.context.properties.ConfigurationProperties; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * xssè¿æ»¤ é
ç½®å±æ§ |
| | | * |
| | |
| | | public class XssProperties { |
| | | |
| | | /** |
| | | * è¿æ»¤å¼å
³ |
| | | * Xsså¼å
³ |
| | | */ |
| | | private String enabled; |
| | | private Boolean enabled; |
| | | |
| | | /** |
| | | * æé¤é¾æ¥ï¼å¤ä¸ªç¨éå·åéï¼ |
| | | * æé¤è·¯å¾ |
| | | */ |
| | | private String excludes; |
| | | |
| | | /** |
| | | * å¹é
龿¥ |
| | | */ |
| | | private String urlPatterns; |
| | | private List<String> excludeUrls = new ArrayList<>(); |
| | | |
| | | } |
| | |
| | | package org.dromara.common.web.filter; |
| | | |
| | | import org.dromara.common.core.utils.SpringUtils; |
| | | import org.dromara.common.core.utils.StringUtils; |
| | | import org.dromara.common.web.config.properties.XssProperties; |
| | | import org.springframework.http.HttpMethod; |
| | | |
| | | import jakarta.servlet.*; |
| | |
| | | |
| | | @Override |
| | | public void init(FilterConfig filterConfig) throws ServletException { |
| | | String tempExcludes = filterConfig.getInitParameter("excludes"); |
| | | if (StringUtils.isNotEmpty(tempExcludes)) { |
| | | String[] url = tempExcludes.split(StringUtils.SEPARATOR); |
| | | for (int i = 0; url != null && i < url.length; i++) { |
| | | excludes.add(url[i]); |
| | | } |
| | | } |
| | | XssProperties properties = SpringUtils.getBean(XssProperties.class); |
| | | excludes.addAll(properties.getExcludeUrls()); |
| | | } |
| | | |
| | | @Override |
| | |
| | | package org.dromara.common.web.filter; |
| | | |
| | | import cn.hutool.core.io.IoUtil; |
| | | import cn.hutool.core.map.MapUtil; |
| | | import cn.hutool.core.util.ArrayUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import cn.hutool.http.HtmlUtil; |
| | | import org.dromara.common.core.utils.StringUtils; |
| | | import org.springframework.http.HttpHeaders; |
| | | import org.springframework.http.MediaType; |
| | | |
| | | import jakarta.servlet.ReadListener; |
| | | import jakarta.servlet.ServletInputStream; |
| | | import jakarta.servlet.http.HttpServletRequest; |
| | | import jakarta.servlet.http.HttpServletRequestWrapper; |
| | | import org.dromara.common.core.utils.StringUtils; |
| | | import org.springframework.http.HttpHeaders; |
| | | import org.springframework.http.MediaType; |
| | | |
| | | import java.io.ByteArrayInputStream; |
| | | import java.io.IOException; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * XSSè¿æ»¤å¤ç |
| | |
| | | } |
| | | |
| | | @Override |
| | | public String getParameter(String name) { |
| | | String value = super.getParameter(name); |
| | | if (value == null) { |
| | | return null; |
| | | } |
| | | return HtmlUtil.cleanHtmlTag(value).trim(); |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, String[]> getParameterMap() { |
| | | Map<String, String[]> valueMap = super.getParameterMap(); |
| | | if (MapUtil.isEmpty(valueMap)) { |
| | | return valueMap; |
| | | } |
| | | // é¿å
æäºå®¹å¨ä¸å
许æ¹åæ°çæ
åµ copyä¸ä»½éæ°æ¹ |
| | | Map<String, String[]> map = new HashMap<>(valueMap.size()); |
| | | map.putAll(valueMap); |
| | | for (Map.Entry<String, String[]> entry : map.entrySet()) { |
| | | String[] values = entry.getValue(); |
| | | if (values != null) { |
| | | int length = values.length; |
| | | String[] escapseValues = new String[length]; |
| | | for (int i = 0; i < length; i++) { |
| | | // é²xssæ»å»åè¿æ»¤ååç©ºæ ¼ |
| | | escapseValues[i] = HtmlUtil.cleanHtmlTag(values[i]).trim(); |
| | | } |
| | | map.put(entry.getKey(), escapseValues); |
| | | } |
| | | } |
| | | return map; |
| | | } |
| | | |
| | | @Override |
| | | public String[] getParameterValues(String name) { |
| | | String[] values = super.getParameterValues(name); |
| | | if (values != null) { |
| | | int length = values.length; |
| | | String[] escapseValues = new String[length]; |
| | | for (int i = 0; i < length; i++) { |
| | | // é²xssæ»å»åè¿æ»¤ååç©ºæ ¼ |
| | | escapseValues[i] = HtmlUtil.cleanHtmlTag(values[i]).trim(); |
| | | } |
| | | return escapseValues; |
| | | if (ArrayUtil.isEmpty(values)) { |
| | | return values; |
| | | } |
| | | return super.getParameterValues(name); |
| | | int length = values.length; |
| | | String[] escapseValues = new String[length]; |
| | | for (int i = 0; i < length; i++) { |
| | | // é²xssæ»å»åè¿æ»¤ååç©ºæ ¼ |
| | | escapseValues[i] = HtmlUtil.cleanHtmlTag(values[i]).trim(); |
| | | } |
| | | return escapseValues; |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import cn.hutool.http.HttpStatus; |
| | | import jakarta.servlet.ServletException; |
| | | import jakarta.servlet.http.HttpServletRequest; |
| | | import jakarta.validation.ConstraintViolation; |
| | | import jakarta.validation.ConstraintViolationException; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.dromara.common.core.domain.R; |
| | | import org.dromara.common.core.exception.ServiceException; |
| | | import org.dromara.common.core.exception.SseException; |
| | | import org.dromara.common.core.exception.base.BaseException; |
| | | import org.dromara.common.core.utils.StreamUtils; |
| | | import org.dromara.common.json.utils.JsonUtils; |
| | | import org.springframework.context.support.DefaultMessageSourceResolvable; |
| | | import org.springframework.validation.BindException; |
| | | import org.springframework.web.HttpRequestMethodNotSupportedException; |
| | |
| | | log.error(e.getMessage()); |
| | | Integer code = e.getCode(); |
| | | return ObjectUtil.isNotNull(code) ? R.fail(code, e.getMessage()) : R.fail(e.getMessage()); |
| | | } |
| | | |
| | | /** |
| | | * 认è¯å¤±è´¥ |
| | | */ |
| | | @ResponseStatus(org.springframework.http.HttpStatus.UNAUTHORIZED) |
| | | @ExceptionHandler(SseException.class) |
| | | public String handleNotLoginException(SseException e, HttpServletRequest request) { |
| | | String requestURI = request.getRequestURI(); |
| | | log.debug("请æ±å°å'{}',认è¯å¤±è´¥'{}',æ æ³è®¿é®ç³»ç»èµæº", requestURI, e.getMessage()); |
| | | return JsonUtils.toJsonString(R.fail(HttpStatus.HTTP_UNAUTHORIZED, "认è¯å¤±è´¥ï¼æ æ³è®¿é®ç³»ç»èµæº")); |
| | | } |
| | | |
| | | /** |
| | | * servletå¼å¸¸ |
| | | */ |
| | | @ExceptionHandler(ServletException.class) |
| | | public R<Void> handleServletException(ServletException e, HttpServletRequest request) { |
| | | String requestURI = request.getRequestURI(); |
| | | log.error("请æ±å°å'{}',åçæªç¥å¼å¸¸.", requestURI, e); |
| | | return R.fail(e.getMessage()); |
| | | } |
| | | |
| | | /** |
| | |
| | | @ExceptionHandler(MethodArgumentNotValidException.class) |
| | | public R<Void> handleMethodArgumentNotValidException(MethodArgumentNotValidException e) { |
| | | log.error(e.getMessage()); |
| | | String message = e.getBindingResult().getFieldError().getDefaultMessage(); |
| | | String message = StreamUtils.join(e.getBindingResult().getAllErrors(), DefaultMessageSourceResolvable::getDefaultMessage, ", "); |
| | | return R.fail(message); |
| | | } |
| | | |
| | |
| | | |
| | | import cn.hutool.core.io.IoUtil; |
| | | import cn.hutool.core.map.MapUtil; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import jakarta.servlet.http.HttpServletRequest; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | @Override |
| | | public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception { |
| | | StopWatch stopWatch = KEY_CACHE.get(); |
| | | stopWatch.stop(); |
| | | log.info("[PLUS]ç»æè¯·æ± => URL[{}],èæ¶:[{}]毫ç§", request.getMethod() + " " + request.getRequestURI(), stopWatch.getTime()); |
| | | KEY_CACHE.remove(); |
| | | if (ObjectUtil.isNotNull(stopWatch)) { |
| | | stopWatch.stop(); |
| | | log.info("[PLUS]ç»æè¯·æ± => URL[{}],èæ¶:[{}]毫ç§", request.getMethod() + " " + request.getRequestURI(), stopWatch.getDuration().toMillis()); |
| | | KEY_CACHE.remove(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-websocket</artifactId> |
| | | <exclusions> |
| | | <exclusion> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-tomcat</artifactId> |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | </dependencies> |
| | | </project> |
| | |
| | | |
| | | import lombok.AccessLevel; |
| | | import lombok.NoArgsConstructor; |
| | | import org.springframework.web.socket.CloseStatus; |
| | | import org.springframework.web.socket.WebSocketSession; |
| | | |
| | | import java.util.Map; |
| | |
| | | * @param session è¦æ·»å çWebSocketä¼è¯ |
| | | */ |
| | | public static void addSession(Long sessionKey, WebSocketSession session) { |
| | | removeSession(sessionKey); |
| | | USER_SESSION_MAP.put(sessionKey, session); |
| | | } |
| | | |
| | |
| | | * @param sessionKey è¦ç§»é¤çä¼è¯é® |
| | | */ |
| | | public static void removeSession(Long sessionKey) { |
| | | if (USER_SESSION_MAP.containsKey(sessionKey)) { |
| | | USER_SESSION_MAP.remove(sessionKey); |
| | | WebSocketSession session = USER_SESSION_MAP.remove(sessionKey); |
| | | try { |
| | | session.close(CloseStatus.BAD_DATA); |
| | | } catch (Exception ignored) { |
| | | } |
| | | } |
| | | |
| | |
| | | # è´å°å®éªå®¤ Spring 宿¹æ¨èéå JDKä¸è½½å°å https://bell-sw.com/pages/downloads/ |
| | | FROM bellsoft/liberica-openjdk-debian:17.0.11-cds |
| | | #FROM bellsoft/liberica-openjdk-debian:21.0.3-cds |
| | | #FROM bellsoft/liberica-openjdk-debian:21.0.5-cds |
| | | #FROM findepi/graalvm:java17-native |
| | | |
| | | LABEL maintainer="Lion Li" |
| | |
| | | |
| | | ADD ./target/ruoyi-monitor-admin.jar ./app.jar |
| | | |
| | | SHELL ["/bin/bash", "-c"] |
| | | |
| | | ENTRYPOINT java -Djava.security.egd=file:/dev/./urandom \ |
| | | -XX:+HeapDumpOnOutOfMemoryError -XX:+UseZGC ${JAVA_OPTS} \ |
| | | -jar app.jar |
| | |
| | | spring: |
| | | security: |
| | | user: |
| | | name: ruoyi |
| | | password: 123456 |
| | | name: @monitor.username@ |
| | | password: @monitor.password@ |
| | | boot: |
| | | admin: |
| | | ui: |
| | |
| | | metadata: |
| | | username: ${spring.boot.admin.client.username} |
| | | userpassword: ${spring.boot.admin.client.password} |
| | | username: ruoyi |
| | | password: 123456 |
| | | username: @monitor.username@ |
| | | password: @monitor.password@ |
| | |
| | | <contextName>logback</contextName> |
| | | <property name="log.path" value="./logs/ruoyi-monitor-admin"/> |
| | | <property name="console.log.pattern" |
| | | value="%red(%d{yyyy-MM-dd HH:mm:ss}) %green([%thread]) %highlight(%-5level) %boldMagenta(%logger{36}%n) - %msg%n"/> |
| | | value="%cyan(%d{yyyy-MM-dd HH:mm:ss}) %green([%thread]) %highlight(%-5level) %boldMagenta(%logger{36}%n) - %msg%n"/> |
| | | <property name="log.pattern" value="%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n"/> |
| | | |
| | | <appender name="console" class="ch.qos.logback.core.ConsoleAppender"> |
| | |
| | | <appender-ref ref="file"/> |
| | | </root> |
| | | |
| | | </configuration> |
| | | </configuration> |
| | |
| | | # è´å°å®éªå®¤ Spring 宿¹æ¨èéå JDKä¸è½½å°å https://bell-sw.com/pages/downloads/ |
| | | FROM bellsoft/liberica-openjdk-debian:17.0.11-cds |
| | | #FROM bellsoft/liberica-openjdk-debian:21.0.3-cds |
| | | #FROM bellsoft/liberica-openjdk-debian:21.0.5-cds |
| | | #FROM findepi/graalvm:java17-native |
| | | |
| | | LABEL maintainer="Lion Li" |
| | |
| | | |
| | | ADD ./target/ruoyi-snailjob-server.jar ./app.jar |
| | | |
| | | SHELL ["/bin/bash", "-c"] |
| | | |
| | | ENTRYPOINT java -Djava.security.egd=file:/dev/./urandom \ |
| | | -XX:+HeapDumpOnOutOfMemoryError -XX:+UseZGC ${JAVA_OPTS} \ |
| | | -jar app.jar |
| | |
| | | <groupId>com.aizuda</groupId> |
| | | <artifactId>snail-job-server-starter</artifactId> |
| | | <version>${snailjob.version}</version> |
| | | <exclusions> |
| | | <exclusion> |
| | | <groupId>org.scala-lang</groupId> |
| | | <artifactId>scala-library</artifactId> |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.scala-lang</groupId> |
| | | <artifactId>scala-library</artifactId> |
| | | <version>2.13.9</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | |
| | | public FilterRegistrationBean<ActuatorAuthFilter> actuatorFilterRegistrationBean() { |
| | | FilterRegistrationBean<ActuatorAuthFilter> registrationBean = new FilterRegistrationBean<>(); |
| | | registrationBean.setFilter(new ActuatorAuthFilter(username, password)); |
| | | registrationBean.addUrlPatterns("/actuator", "/actuator/**"); |
| | | registrationBean.addUrlPatterns("/actuator", "/actuator/*"); |
| | | return registrationBean; |
| | | } |
| | | |
| | |
| | | retry-pull-page-size: 1000 |
| | | # æåéè¯æ°æ®çæ¯æ¹æ¬¡çå¤§å° |
| | | job-pull-page-size: 1000 |
| | | # æå¡ç«¯nettyç«¯å£ |
| | | netty-port: 17888 |
| | | # æå¡å¨ç«¯å£ |
| | | server-port: 17888 |
| | | # ä¸ä¸ªå®¢æ·ç«¯æ¯ç§æå¤æ¥æ¶çéè¯æ°éæä»¤ |
| | | limiter: 1000 |
| | | # å·æ®µæ¨¡å¼ä¸æ¥é¿é
ç½® |
| | |
| | | max-count: 288 |
| | | #é´éæ¶é´ |
| | | trigger-interval: 900 |
| | | # éè¯æ¯æ¬¡æåçæ¬¡æ° |
| | | retry-max-pull-count: 10 |
| | | # RPCé讯类å: netty,grpc |
| | | rpc-type: grpc |
| | | |
| | | --- # çæ§ä¸å¿é
ç½® |
| | | spring.boot.admin.client: |
| | |
| | | metadata: |
| | | username: ${spring.boot.admin.client.username} |
| | | userpassword: ${spring.boot.admin.client.password} |
| | | username: ruoyi |
| | | password: 123456 |
| | | username: @monitor.username@ |
| | | password: @monitor.password@ |
| | |
| | | retry-pull-page-size: 1000 |
| | | # æåéè¯æ°æ®çæ¯æ¹æ¬¡çå¤§å° |
| | | job-pull-page-size: 1000 |
| | | # æå¡ç«¯ netty ç«¯å£ |
| | | netty-port: 17888 |
| | | # æå¡å¨ç«¯å£ |
| | | server-port: 17888 |
| | | # ä¸ä¸ªå®¢æ·ç«¯æ¯ç§æå¤æ¥æ¶çéè¯æ°éæä»¤ |
| | | limiter: 1000 |
| | | # å·æ®µæ¨¡å¼ä¸æ¥é¿é
ç½® |
| | |
| | | max-count: 288 |
| | | #é´éæ¶é´ |
| | | trigger-interval: 900 |
| | | # éè¯æ¯æ¬¡æåçæ¬¡æ° |
| | | retry-max-pull-count: 10 |
| | | # RPCé讯类å: netty,grpc |
| | | rpc-type: grpc |
| | | |
| | | --- # çæ§ä¸å¿é
ç½® |
| | | spring.boot.admin.client: |
| | |
| | | metadata: |
| | | username: ${spring.boot.admin.client.username} |
| | | userpassword: ${spring.boot.admin.client.password} |
| | | username: ruoyi |
| | | password: 123456 |
| | | username: @monitor.username@ |
| | | password: @monitor.password@ |
| | |
| | | <configuration> |
| | | <property name="log.path" value="./logs/ruoyi-snailjob-server" /> |
| | | <property name="console.log.pattern" |
| | | value="%red(%d{yyyy-MM-dd HH:mm:ss}) %green([%thread]) %highlight(%-5level) %boldMagenta(%logger{36}%n) - %msg%n"/> |
| | | value="%cyan(%d{yyyy-MM-dd HH:mm:ss}) %green([%thread]) %highlight(%-5level) %boldMagenta(%logger{36}%n) - %msg%n"/> |
| | | <property name="log.pattern" value="%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n"/> |
| | | |
| | | |
| | |
| | | package org.dromara.demo.controller; |
| | | |
| | | import cn.dev33.satoken.annotation.SaIgnore; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.dromara.common.core.domain.R; |
| | | import org.dromara.common.mail.utils.MailUtils; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.io.File; |
| | | import java.util.Arrays; |
| | | |
| | | |
| | | /** |
| | |
| | | * |
| | | * @author Michelle.Chung |
| | | */ |
| | | @SaIgnore |
| | | @Validated |
| | | @RequiredArgsConstructor |
| | | @RestController |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * åéé®ä»¶ï¼å¤éä»¶ï¼ |
| | | * |
| | | * @param to æ¥æ¶äºº |
| | | * @param subject æ é¢ |
| | | * @param text å
容 |
| | | * @param paths éä»¶è·¯å¾ |
| | | */ |
| | | @GetMapping("/sendMessageWithAttachments") |
| | | public R<Void> sendMessageWithAttachments(String to, String subject, String text, String[] paths) { |
| | | File[] array = Arrays.stream(paths).map(File::new).toArray(File[]::new); |
| | | MailUtils.sendText(to, subject, text, array); |
| | | return R.ok(); |
| | | } |
| | | |
| | | } |
| | |
| | | package org.dromara.demo.controller; |
| | | |
| | | import cn.hutool.core.thread.ThreadUtil; |
| | | import org.dromara.common.core.constant.CacheNames; |
| | | import org.dromara.common.core.domain.R; |
| | | import org.dromara.common.redis.utils.RedisUtils; |
| | |
| | | RedisUtils.setCacheObject(key, value); |
| | | boolean flag = RedisUtils.expire(key, Duration.ofSeconds(10)); |
| | | System.out.println("***********" + flag); |
| | | try { |
| | | Thread.sleep(11 * 1000); |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | ThreadUtil.sleep(11 * 1000); |
| | | Object obj = RedisUtils.getCacheObject(key); |
| | | return R.ok(value.equals(obj)); |
| | | } |
| | |
| | | package org.dromara.demo.controller; |
| | | |
| | | import cn.hutool.core.thread.ThreadUtil; |
| | | import com.baomidou.lock.LockInfo; |
| | | import com.baomidou.lock.LockTemplate; |
| | | import com.baomidou.lock.annotation.Lock4j; |
| | |
| | | @Lock4j(keys = {"#key"}) |
| | | @GetMapping("/testLock4j") |
| | | public R<String> testLock4j(String key, String value) { |
| | | System.out.println("start:" + key + ",time:" + LocalTime.now().toString()); |
| | | try { |
| | | Thread.sleep(10000); |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | System.out.println("end :" + key + ",time:" + LocalTime.now().toString()); |
| | | System.out.println("start:" + key + ",time:" + LocalTime.now()); |
| | | ThreadUtil.sleep(10000); |
| | | System.out.println("end :" + key + ",time:" + LocalTime.now()); |
| | | return R.ok("æä½æå", value); |
| | | } |
| | | |
| | |
| | | } |
| | | // è·åéæåï¼å¤çä¸å¡ |
| | | try { |
| | | try { |
| | | Thread.sleep(8000); |
| | | } catch (InterruptedException e) { |
| | | // |
| | | } |
| | | ThreadUtil.sleep(8000); |
| | | System.out.println("æ§è¡ç®åæ¹æ³1 , å½å线ç¨:" + Thread.currentThread().getName()); |
| | | } finally { |
| | | //éæ¾é |
| | |
| | | import org.dromara.common.excel.convert.ExcelDictConvert; |
| | | import org.dromara.common.excel.convert.ExcelEnumConvert; |
| | | |
| | | import java.io.Serial; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * 带æä¸æéçExcelå¯¼åº |
| | | * |
| | |
| | | @ExcelIgnoreUnannotated |
| | | @AllArgsConstructor |
| | | @NoArgsConstructor |
| | | public class ExportDemoVo { |
| | | public class ExportDemoVo implements Serializable { |
| | | |
| | | @Serial |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | |
| | | |
| | | import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
| | | import com.alibaba.excel.annotation.ExcelProperty; |
| | | import org.dromara.common.excel.annotation.ExcelNotation; |
| | | import org.dromara.common.excel.annotation.ExcelRequired; |
| | | import org.dromara.common.translation.annotation.Translation; |
| | | import org.dromara.common.translation.constant.TransConstant; |
| | | import org.dromara.demo.domain.TestDemo; |
| | |
| | | /** |
| | | * é¨é¨id |
| | | */ |
| | | @ExcelRequired |
| | | @ExcelProperty(value = "é¨é¨id") |
| | | private Long deptId; |
| | | |
| | | /** |
| | | * ç¨æ·id |
| | | */ |
| | | @ExcelRequired |
| | | @ExcelProperty(value = "ç¨æ·id") |
| | | private Long userId; |
| | | |
| | | /** |
| | | * æåºå· |
| | | */ |
| | | @ExcelRequired |
| | | @ExcelProperty(value = "æåºå·") |
| | | private Integer orderNum; |
| | | |
| | | /** |
| | | * keyé® |
| | | */ |
| | | @ExcelNotation(value = "æµè¯key") |
| | | @ExcelProperty(value = "keyé®") |
| | | private String testKey; |
| | | |
| | | /** |
| | | * å¼ |
| | | */ |
| | | @ExcelNotation(value = "æµè¯value") |
| | | @ExcelProperty(value = "å¼") |
| | | private String value; |
| | | |
| | |
| | | @DataColumn(key = "deptName", value = "dept_id"), |
| | | @DataColumn(key = "userName", value = "user_id") |
| | | }) |
| | | List<TestDemo> selectList(IPage<TestDemo> page, @Param(Constants.WRAPPER) Wrapper<TestDemo> queryWrapper); |
| | | default <P extends IPage<TestDemoVo>> P selectVoPage(IPage<TestDemo> page, Wrapper<TestDemo> wrapper) { |
| | | return selectVoPage(page, wrapper, this.currentVoClass()); |
| | | } |
| | | |
| | | @Override |
| | | @DataPermission({ |
| | | @DataColumn(key = "deptName", value = "dept_id"), |
| | | @DataColumn(key = "userName", value = "user_id") |
| | | }) |
| | | List<TestDemo> selectList(@Param(Constants.WRAPPER) Wrapper<TestDemo> queryWrapper); |
| | | default List<TestDemoVo> selectVoList(Wrapper<TestDemo> wrapper) { |
| | | return selectVoList(wrapper, this.currentVoClass()); |
| | | } |
| | | |
| | | @Override |
| | | @DataPermission(value = { |
| | | @DataColumn(key = "deptName", value = "dept_id"), |
| | | @DataColumn(key = "userName", value = "user_id") |
| | | }, joinStr = "AND") |
| | | List<TestDemo> selectBatchIds(@Param(Constants.COLL) Collection<? extends Serializable> idList); |
| | | List<TestDemo> selectByIds(@Param(Constants.COLL) Collection<? extends Serializable> idList); |
| | | |
| | | @Override |
| | | @DataPermission({ |
| | |
| | | package org.dromara.demo.service.impl; |
| | | |
| | | import cn.hutool.core.util.RandomUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.Data; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.dromara.common.core.enums.UserStatus; |
| | | import org.dromara.common.core.constant.SystemConstants; |
| | | import org.dromara.common.core.utils.StreamUtils; |
| | | import org.dromara.common.excel.core.DropDownOptions; |
| | | import org.dromara.common.excel.utils.ExcelUtil; |
| | |
| | | // æ¨¡ææ°æ®åºä¸ç䏿¡æ°æ® |
| | | ExportDemoVo everyRowData = new ExportDemoVo(); |
| | | everyRowData.setNickName("ç¨æ·-" + i); |
| | | everyRowData.setUserStatus(UserStatus.OK.getCode()); |
| | | everyRowData.setUserStatus(SystemConstants.NORMAL); |
| | | everyRowData.setGender("1"); |
| | | everyRowData.setPhoneNumber(String.format("175%08d", i)); |
| | | everyRowData.setEmail(String.format("175%08d", i) + "@163.com"); |
| | |
| | | List<DemoCityData> provinceList = new ArrayList<>(); |
| | | |
| | | // å®é
ä¸å¡ä¸ä¸è¬éç¨æ°æ®åºè¯»åçå½¢å¼ï¼è¿éç´æ¥æ¼æ¥å建 |
| | | provinceList.add(new DemoCityData(0, null, "å®å¾½ç")); |
| | | provinceList.add(new DemoCityData(1, null, "æ±èç")); |
| | | provinceList.add(new DemoCityData(0, null, "P100000")); |
| | | provinceList.add(new DemoCityData(1, null, "P200000")); |
| | | provinceList.add(new DemoCityData(2, null, "P300000")); |
| | | |
| | | return provinceList; |
| | | } |
| | |
| | | List<DemoCityData> cityList = new ArrayList<>(); |
| | | |
| | | // å®é
ä¸å¡ä¸ä¸è¬éç¨æ°æ®åºè¯»åçå½¢å¼ï¼è¿éç´æ¥æ¼æ¥å建 |
| | | cityList.add(new DemoCityData(0, 0, "åè¥å¸")); |
| | | cityList.add(new DemoCityData(1, 0, "èæ¹å¸")); |
| | | cityList.add(new DemoCityData(2, 1, "å京å¸")); |
| | | cityList.add(new DemoCityData(3, 1, "æ é¡å¸")); |
| | | cityList.add(new DemoCityData(4, 1, "å¾å·å¸")); |
| | | cityList.add(new DemoCityData(0, 0, "C110000")); |
| | | cityList.add(new DemoCityData(1, 0, "C120000")); |
| | | cityList.add(new DemoCityData(2, 1, "C210000")); |
| | | cityList.add(new DemoCityData(3, 1, "C220000")); |
| | | cityList.add(new DemoCityData(4, 1, "C230000")); |
| | | |
| | | selectParentData(provinceList, cityList); |
| | | |
| | |
| | | private List<DemoCityData> getAreaList(List<DemoCityData> cityList) { |
| | | List<DemoCityData> areaList = new ArrayList<>(); |
| | | |
| | | int minCount = 500; |
| | | int maxCount = 10000; |
| | | |
| | | // å®é
ä¸å¡ä¸ä¸è¬éç¨æ°æ®åºè¯»åçå½¢å¼ï¼è¿éç´æ¥æ¼æ¥å建 |
| | | areaList.add(new DemoCityData(0, 0, "ç¶æµ·åº")); |
| | | areaList.add(new DemoCityData(1, 0, "åºæ±åº")); |
| | | areaList.add(new DemoCityData(2, 1, "åå®å¿")); |
| | | areaList.add(new DemoCityData(3, 1, "éæ¹åº")); |
| | | areaList.add(new DemoCityData(4, 2, "çæ¦åº")); |
| | | areaList.add(new DemoCityData(5, 2, "秦淮åº")); |
| | | areaList.add(new DemoCityData(6, 3, "å®å
´å¸")); |
| | | areaList.add(new DemoCityData(7, 3, "æ°å´åº")); |
| | | areaList.add(new DemoCityData(8, 4, "鼿¥¼åº")); |
| | | areaList.add(new DemoCityData(9, 4, "丰å¿")); |
| | | for (int i = 0; i < RandomUtil.randomInt(minCount, maxCount); i++) { |
| | | areaList.add(new DemoCityData(areaList.size(), 0, String.format("A11%04d", i))); |
| | | } |
| | | |
| | | for (int i = 0; i < RandomUtil.randomInt(minCount, maxCount); i++) { |
| | | areaList.add(new DemoCityData(areaList.size(), 1, String.format("A12%04d", i))); |
| | | } |
| | | |
| | | for (int i = 0; i < RandomUtil.randomInt(minCount, maxCount); i++) { |
| | | areaList.add(new DemoCityData(areaList.size(), 2, String.format("A21%04d", i))); |
| | | } |
| | | |
| | | for (int i = 0; i < RandomUtil.randomInt(minCount, maxCount); i++) { |
| | | areaList.add(new DemoCityData(areaList.size(), 3, String.format("A22%04d", i))); |
| | | } |
| | | |
| | | for (int i = 0; i < RandomUtil.randomInt(minCount, maxCount); i++) { |
| | | areaList.add(new DemoCityData(areaList.size(), 4, String.format("A23%04d", i))); |
| | | } |
| | | |
| | | selectParentData(cityList, areaList); |
| | | |
| | |
| | | public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) { |
| | | if (isValid) { |
| | | // åä¸äºä¸å¡ä¸çæ ¡éª,夿æ¯å¦éè¦æ ¡éª |
| | | List<TestDemo> list = baseMapper.selectBatchIds(ids); |
| | | List<TestDemo> list = baseMapper.selectByIds(ids); |
| | | if (list.size() != ids.size()) { |
| | | throw new ServiceException("æ¨æ²¡æå 餿é!"); |
| | | } |
| | |
| | | <!-- <dependency>--> |
| | | <!-- <groupId>org.anyline</groupId>--> |
| | | <!-- <artifactId>anyline-data-jdbc-oracle</artifactId>--> |
| | | <!-- <version>${anyline.version}</version>--> |
| | | <!-- <version>${anyline.version}</version>--> |
| | | <!-- </dependency>--> |
| | | |
| | | <!-- <dependency>--> |
| | | <!-- <groupId>org.anyline</groupId>--> |
| | | <!-- <artifactId>anyline-data-jdbc-postgresql</artifactId>--> |
| | | <!-- <version>${anyline.version}</version>--> |
| | | <!-- <version>${anyline.version}</version>--> |
| | | <!-- </dependency>--> |
| | | |
| | | <!-- <dependency>--> |
| | | <!-- <groupId>org.anyline</groupId>--> |
| | | <!-- <artifactId>anyline-data-jdbc-mssql</artifactId>--> |
| | | <!-- <version>${anyline.version}</version>--> |
| | | <!-- <version>${anyline.version}</version>--> |
| | | <!-- </dependency>--> |
| | | |
| | | </dependencies> |
| | |
| | | * æ°æ®åºæ¶é´ç±»å |
| | | */ |
| | | String[] COLUMNTYPE_TIME = {"datetime", "time", "date", "timestamp", "year", "interval", |
| | | "smalldatetime", "datetime2", "datetimeoffset"}; |
| | | "smalldatetime", "datetime2", "datetimeoffset", "timestamptz"}; |
| | | |
| | | /** |
| | | * æ°æ®åºæ°åç±»å |
| | | */ |
| | | String[] COLUMNTYPE_NUMBER = {"tinyint", "smallint", "mediumint", "int", "number", "integer", |
| | | "bit", "bigint", "float", "double", "decimal", "numeric", "real", "double precision", |
| | | String[] COLUMNTYPE_NUMBER = {"tinyint", "smallint", "mediumint", "int", "int2", "int4", "int8", "number", "integer", |
| | | "bit", "bigint", "float", "float4", "float8", "double", "decimal", "numeric", "real", "double precision", |
| | | "smallserial", "serial", "bigserial", "money", "smallmoney"}; |
| | | |
| | | /** |
| | |
| | | * ä¸çº§èåIDåæ®µ |
| | | */ |
| | | @TableField(exist = false) |
| | | private String parentMenuId; |
| | | private Long parentMenuId; |
| | | |
| | | /** |
| | | * ä¸çº§èååç§°åæ®µ |
| | |
| | | } |
| | | |
| | | public boolean isEdit() { |
| | | return isInsert(this.isEdit); |
| | | return isEdit(this.isEdit); |
| | | } |
| | | |
| | | public boolean isEdit(String isEdit) { |
| | |
| | | |
| | | import com.baomidou.dynamic.datasource.annotation.DS; |
| | | import com.baomidou.mybatisplus.annotation.InterceptorIgnore; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; |
| | | import org.dromara.generator.domain.GenTable; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | */ |
| | | GenTable selectGenTableByName(String tableName); |
| | | |
| | | /** |
| | | * æ¥è¯¢æå®æ°æ®æºä¸çææè¡¨åå表 |
| | | * |
| | | * @param dataName æ°æ®æºåç§°ï¼ç¨äºéæ©ä¸åçæ°æ®æº |
| | | * @return å½åæ°æ®åºä¸ç表åå表 |
| | | * |
| | | * @DS("") 使ç¨é»è®¤æ°æ®æºæ§è¡æ¥è¯¢æä½ |
| | | */ |
| | | @DS("") |
| | | List<String> selectTableNameList(String dataName); |
| | | } |
| | |
| | | import org.dromara.common.json.utils.JsonUtils; |
| | | import org.dromara.common.mybatis.core.page.PageQuery; |
| | | import org.dromara.common.mybatis.core.page.TableDataInfo; |
| | | import org.dromara.common.satoken.utils.LoginHelper; |
| | | import org.dromara.generator.constant.GenConstants; |
| | | import org.dromara.generator.domain.GenTable; |
| | | import org.dromara.generator.domain.GenTableColumn; |
| | |
| | | private final GenTableColumnMapper genTableColumnMapper; |
| | | private final IdentifierGenerator identifierGenerator; |
| | | |
| | | private static final String[] TABLE_IGNORE = new String[]{"sj_", "act_", "flw_", "gen_"}; |
| | | private static final String[] TABLE_IGNORE = new String[]{"sj_", "flow_", "gen_"}; |
| | | |
| | | /** |
| | | * æ¥è¯¢ä¸å¡å段å表 |
| | |
| | | .like(StringUtils.isNotBlank(genTable.getTableName()), "lower(table_name)", StringUtils.lowerCase(genTable.getTableName())) |
| | | .like(StringUtils.isNotBlank(genTable.getTableComment()), "lower(table_comment)", StringUtils.lowerCase(genTable.getTableComment())) |
| | | .between(params.get("beginTime") != null && params.get("endTime") != null, |
| | | "create_time", params.get("beginTime"), params.get("endTime")); |
| | | "create_time", params.get("beginTime"), params.get("endTime")) |
| | | .orderByDesc("update_time"); |
| | | return wrapper; |
| | | } |
| | | |
| | |
| | | } |
| | | // è¿æ»¤å¹¶è½¬æ¢è¡¨æ ¼æ°æ® |
| | | List<GenTable> tables = tablesMap.values().stream() |
| | | .filter(x -> !StringUtils.containsAnyIgnoreCase(x.getName(), TABLE_IGNORE)) |
| | | .filter(x -> !StringUtils.startWithAnyIgnoreCase(x.getName(), TABLE_IGNORE)) |
| | | .filter(x -> { |
| | | if (CollUtil.isEmpty(tableNames)) { |
| | | return true; |
| | |
| | | GenTable gen = new GenTable(); |
| | | gen.setTableName(x.getName()); |
| | | gen.setTableComment(x.getComment()); |
| | | gen.setCreateTime(x.getCreateTime()); |
| | | // postgresqlç表å
æ°æ®æ²¡æå建æ¶é´è¿ä¸ªä¸è¥¿(好å¥è©) åªè½new Dateä»£æ¿ |
| | | gen.setCreateTime(ObjectUtil.defaultIfNull(x.getCreateTime(), new Date())); |
| | | gen.setUpdateTime(x.getUpdateTime()); |
| | | return gen; |
| | | }).toList(); |
| | | }).sorted(Comparator.comparing(GenTable::getCreateTime).reversed()) |
| | | .toList(); |
| | | |
| | | IPage<GenTable> page = pageQuery.build(); |
| | | page.setTotal(tables.size()); |
| | |
| | | } |
| | | |
| | | List<Table<?>> tableList = tablesMap.values().stream() |
| | | .filter(x -> !StringUtils.containsAnyIgnoreCase(x.getName(), TABLE_IGNORE)) |
| | | .filter(x -> !StringUtils.startWithAnyIgnoreCase(x.getName(), TABLE_IGNORE)) |
| | | .filter(x -> tableNameSet.contains(x.getName())).toList(); |
| | | |
| | | if (CollUtil.isEmpty(tableList)) { |
| | |
| | | @DSTransactional |
| | | @Override |
| | | public void importGenTable(List<GenTable> tableList, String dataName) { |
| | | Long operId = LoginHelper.getUserId(); |
| | | try { |
| | | for (GenTable table : tableList) { |
| | | String tableName = table.getTableName(); |
| | | GenUtils.initTable(table, operId); |
| | | GenUtils.initTable(table); |
| | | table.setDataName(dataName); |
| | | int row = baseMapper.insert(table); |
| | | if (row > 0) { |
| | |
| | | @DS("#dataName") |
| | | @Override |
| | | public List<GenTableColumn> selectDbTableColumnsByName(String tableName, String dataName) { |
| | | LinkedHashMap<String, Column> columns = ServiceProxy.metadata().columns(tableName); |
| | | Table<?> table = ServiceProxy.metadata().table(tableName); |
| | | if (ObjectUtil.isNull(table)) { |
| | | return new ArrayList<>(); |
| | | } |
| | | LinkedHashMap<String, Column> columns = table.getColumns(); |
| | | List<GenTableColumn> tableColumns = new ArrayList<>(); |
| | | columns.forEach((columnName, column) -> { |
| | | GenTableColumn tableColumn = new GenTableColumn(); |
| | | tableColumn.setIsPk(String.valueOf(column.isPrimaryKey())); |
| | | tableColumn.setColumnName(column.getName()); |
| | | tableColumn.setColumnComment(column.getComment()); |
| | | tableColumn.setColumnType(column.getTypeName().toLowerCase()); |
| | | tableColumn.setColumnType(column.getOriginType().toLowerCase()); |
| | | tableColumn.setSort(column.getPosition()); |
| | | tableColumn.setIsRequired(column.isNullable() == 0 ? "1" : "0"); |
| | | tableColumn.setIsIncrement(column.isAutoIncrement() == -1 ? "0" : "1"); |
| | |
| | | String treeCode = paramsObj.getStr(GenConstants.TREE_CODE); |
| | | String treeParentCode = paramsObj.getStr(GenConstants.TREE_PARENT_CODE); |
| | | String treeName = paramsObj.getStr(GenConstants.TREE_NAME); |
| | | String parentMenuId = paramsObj.getStr(GenConstants.PARENT_MENU_ID); |
| | | Long parentMenuId = paramsObj.getLong(GenConstants.PARENT_MENU_ID); |
| | | String parentMenuName = paramsObj.getStr(GenConstants.PARENT_MENU_NAME); |
| | | |
| | | genTable.setTreeCode(treeCode); |
| | |
| | | /** |
| | | * åå§åè¡¨ä¿¡æ¯ |
| | | */ |
| | | public static void initTable(GenTable genTable, Long operId) { |
| | | public static void initTable(GenTable genTable) { |
| | | genTable.setClassName(convertClassName(genTable.getTableName())); |
| | | genTable.setPackageName(GenConfig.getPackageName()); |
| | | genTable.setModuleName(getModuleName(GenConfig.getPackageName())); |
| | | genTable.setBusinessName(getBusinessName(genTable.getTableName())); |
| | | genTable.setFunctionName(replaceText(genTable.getTableComment())); |
| | | genTable.setFunctionAuthor(GenConfig.getAuthor()); |
| | | genTable.setCreateBy(operId); |
| | | genTable.setCreateTime(null); |
| | | genTable.setUpdateTime(null); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | public static void initColumnField(GenTableColumn column, GenTable table) { |
| | | String dataType = getDbType(column.getColumnType()); |
| | | String columnName = column.getColumnName(); |
| | | // ç»ä¸è½¬å°å é¿å
æäºæ°æ®åºé»è®¤å¤§åé®é¢ 妿éè¦ç¹å«ä¹¦åæ¹å¼ 请å¨å®ä½ç±»å¢å æ³¨è§£æ æ³¨å«å |
| | | String columnName = column.getColumnName().toLowerCase(); |
| | | column.setTableId(table.getTableId()); |
| | | column.setCreateBy(table.getCreateBy()); |
| | | column.setCreateTime(null); |
| | | column.setUpdateTime(null); |
| | | // 设置javaåæ®µå |
| | | column.setJavaField(StringUtils.toCamelCase(columnName)); |
| | | // 设置é»è®¤ç±»å |
| | |
| | | column.setHtmlType(GenConstants.HTML_DATETIME); |
| | | } else if (arraysContains(GenConstants.COLUMNTYPE_NUMBER, dataType)) { |
| | | column.setHtmlType(GenConstants.HTML_INPUT); |
| | | |
| | | // å¦ææ¯æµ®ç¹å ç»ä¸ç¨BigDecimal |
| | | String[] str = StringUtils.split(StringUtils.substringBetween(column.getColumnType(), "(", ")"), StringUtils.SEPARATOR); |
| | | if (str != null && str.length == 2 && Integer.parseInt(str[1]) > 0) { |
| | | column.setJavaType(GenConstants.TYPE_BIGDECIMAL); |
| | | } |
| | | // å¦ææ¯æ´å½¢ |
| | | else if (str != null && str.length == 1 && Integer.parseInt(str[0]) <= 10) { |
| | | column.setJavaType(GenConstants.TYPE_INTEGER); |
| | | } |
| | | // é¿æ´å½¢ |
| | | else { |
| | | column.setJavaType(GenConstants.TYPE_LONG); |
| | | } |
| | | // æ°æ®åºçæ°ååæ®µä¸javaä¸å¹é
ä¸å¾å¤æ°æ®åºçæ°ååæ®µå¾æ¨¡ç³ ä¾å¦oracleåªænumber没æç»å |
| | | // æä»¥é»è®¤æ°åç±»åå
¨ä¸ºLongå¯å¨çé¢ä¸èªè¡ç¼è¾æ³è¦çç±»å æä»ä¹ç¹æ®éæ±ä¹å¯ä»¥å¨è¿éç¹æ®å¤ç |
| | | column.setJavaType(GenConstants.TYPE_LONG); |
| | | } |
| | | |
| | | // BO对象 é»è®¤æå
¥å¾é |
| | |
| | | // BO对象 é»è®¤ç¼è¾å¾é |
| | | if (!arraysContains(GenConstants.COLUMNNAME_NOT_EDIT, columnName)) { |
| | | column.setIsEdit(GenConstants.REQUIRE); |
| | | } |
| | | // BO对象 é»è®¤æ¯å¦å¿
å¡«å¾é |
| | | if (!arraysContains(GenConstants.COLUMNNAME_NOT_EDIT, columnName)) { |
| | | column.setIsRequired(GenConstants.REQUIRE); |
| | | } |
| | | // VO对象 é»è®¤è¿åå¾é |
| | | if (!arraysContains(GenConstants.COLUMNNAME_NOT_LIST, columnName)) { |
| | |
| | | ${ClassName}::get$AttrName ,params.get("begin$AttrName"), params.get("end$AttrName")); |
| | | #end |
| | | #end |
| | | #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) |
| | | #if($column.isPk==1) |
| | | lqw.orderByAsc(${ClassName}::get$AttrName); |
| | | #end |
| | | #end |
| | | return lqw; |
| | | } |
| | |
| | | * ${column.columnComment}Url |
| | | */ |
| | | @Translation(type = TransConstant.OSS_ID_TO_URL, mapper = "${column.javaField}") |
| | | private String ${column.javaField}Url"; |
| | | private String ${column.javaField}Url; |
| | | #end |
| | | #end |
| | | #end |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Collection; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | |
| | | @GetMapping("/list") |
| | | public TableDataInfo<SysUserOnline> list(String ipaddr, String userName) { |
| | | // è·åæææªè¿æç token |
| | | List<String> keys = StpUtil.searchTokenValue("", 0, -1, false); |
| | | Collection<String> keys = RedisUtils.keys(CacheConstants.ONLINE_TOKEN_KEY + "*"); |
| | | List<UserOnlineDTO> userOnlineDTOList = new ArrayList<>(); |
| | | for (String key : keys) { |
| | | String token = StringUtils.substringAfterLast(key, ":"); |
| | |
| | | * @param tokenId tokenå¼ |
| | | */ |
| | | @Log(title = "å¨çº¿è®¾å¤", businessType = BusinessType.FORCE) |
| | | @PostMapping("/{tokenId}") |
| | | @DeleteMapping("/myself/{tokenId}") |
| | | public R<Void> remove(@PathVariable("tokenId") String tokenId) { |
| | | try { |
| | | // è·åæå®è´¦å· id ç token éå |
| | |
| | | @Log(title = "客æ·ç«¯ç®¡ç", businessType = BusinessType.UPDATE) |
| | | @PutMapping("/changeStatus") |
| | | public R<Void> changeStatus(@RequestBody SysClientBo bo) { |
| | | return toAjax(sysClientService.updateUserStatus(bo.getClientId(), bo.getStatus())); |
| | | return toAjax(sysClientService.updateClientStatus(bo.getClientId(), bo.getStatus())); |
| | | } |
| | | |
| | | /** |
| | |
| | | import cn.dev33.satoken.annotation.SaCheckPermission; |
| | | import cn.hutool.core.convert.Convert; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.dromara.common.core.constant.UserConstants; |
| | | import org.dromara.common.core.constant.SystemConstants; |
| | | import org.dromara.common.core.domain.R; |
| | | import org.dromara.common.core.utils.StringUtils; |
| | | import org.dromara.common.log.annotation.Log; |
| | |
| | | return R.fail("ä¿®æ¹é¨é¨'" + dept.getDeptName() + "'失败ï¼é¨é¨åç§°å·²åå¨"); |
| | | } else if (dept.getParentId().equals(deptId)) { |
| | | return R.fail("ä¿®æ¹é¨é¨'" + dept.getDeptName() + "'失败ï¼ä¸çº§é¨é¨ä¸è½æ¯èªå·±"); |
| | | } else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus())) { |
| | | } else if (StringUtils.equals(SystemConstants.DISABLE, dept.getStatus())) { |
| | | if (deptService.selectNormalChildrenDeptById(deptId) > 0) { |
| | | return R.fail("该é¨é¨å
嫿ªåç¨çåé¨é¨!"); |
| | | } else if (deptService.checkDeptExistUser(deptId)) { |
| | |
| | | import cn.dev33.satoken.annotation.SaCheckRole; |
| | | import cn.dev33.satoken.annotation.SaMode; |
| | | import cn.hutool.core.lang.tree.Tree; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.dromara.common.core.constant.SystemConstants; |
| | | import org.dromara.common.core.constant.TenantConstants; |
| | | import org.dromara.common.core.constant.UserConstants; |
| | | import org.dromara.common.core.domain.R; |
| | | import org.dromara.common.core.utils.StringUtils; |
| | | import org.dromara.common.log.annotation.Log; |
| | |
| | | import org.dromara.system.domain.vo.RouterVo; |
| | | import org.dromara.system.domain.vo.SysMenuVo; |
| | | import org.dromara.system.service.ISysMenuService; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | public R<Void> add(@Validated @RequestBody SysMenuBo menu) { |
| | | if (!menuService.checkMenuNameUnique(menu)) { |
| | | return R.fail("æ°å¢èå'" + menu.getMenuName() + "'失败ï¼èååç§°å·²åå¨"); |
| | | } else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath())) { |
| | | } else if (SystemConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath())) { |
| | | return R.fail("æ°å¢èå'" + menu.getMenuName() + "'失败ï¼å°åå¿
须以http(s)://å¼å¤´"); |
| | | } |
| | | return toAjax(menuService.insertMenu(menu)); |
| | |
| | | public R<Void> edit(@Validated @RequestBody SysMenuBo menu) { |
| | | if (!menuService.checkMenuNameUnique(menu)) { |
| | | return R.fail("ä¿®æ¹èå'" + menu.getMenuName() + "'失败ï¼èååç§°å·²åå¨"); |
| | | } else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath())) { |
| | | } else if (SystemConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath())) { |
| | | return R.fail("ä¿®æ¹èå'" + menu.getMenuName() + "'失败ï¼å°åå¿
须以http(s)://å¼å¤´"); |
| | | } else if (menu.getMenuId().equals(menu.getParentId())) { |
| | | return R.fail("ä¿®æ¹èå'" + menu.getMenuName() + "'失败ï¼ä¸çº§èåä¸è½éæ©èªå·±"); |
| | |
| | | * |
| | | * @param ossIds OSS对象ID串 |
| | | */ |
| | | @SaCheckPermission("system:oss:list") |
| | | @SaCheckPermission("system:oss:query") |
| | | @GetMapping("/listByIds/{ossIds}") |
| | | public R<List<SysOssVo>> listByIds(@NotEmpty(message = "主é®ä¸è½ä¸ºç©º") |
| | | @PathVariable Long[] ossIds) { |
| | |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.dromara.common.core.constant.UserConstants; |
| | | import org.dromara.common.core.constant.SystemConstants; |
| | | import org.dromara.common.core.domain.R; |
| | | import org.dromara.common.excel.utils.ExcelUtil; |
| | | import org.dromara.common.log.annotation.Log; |
| | |
| | | return R.fail("ä¿®æ¹å²ä½'" + post.getPostName() + "'失败ï¼å²ä½åç§°å·²åå¨"); |
| | | } else if (!postService.checkPostCodeUnique(post)) { |
| | | return R.fail("ä¿®æ¹å²ä½'" + post.getPostName() + "'失败ï¼å²ä½ç¼ç å·²åå¨"); |
| | | } else if (UserConstants.POST_DISABLE.equals(post.getStatus()) |
| | | } else if (SystemConstants.DISABLE.equals(post.getStatus()) |
| | | && postService.countUserPostById(post.getPostId()) > 0) { |
| | | return R.fail("该å²ä½ä¸åå¨å·²åé
ç¨æ·ï¼ä¸è½ç¦ç¨!"); |
| | | } |
| | |
| | | if (BCrypt.checkpw(bo.getNewPassword(), password)) { |
| | | return R.fail("æ°å¯ç ä¸è½ä¸æ§å¯ç ç¸å"); |
| | | } |
| | | |
| | | if (userService.resetUserPwd(user.getUserId(), BCrypt.hashpw(bo.getNewPassword())) > 0) { |
| | | int rows = DataPermissionHelper.ignore(() -> userService.resetUserPwd(user.getUserId(), BCrypt.hashpw(bo.getNewPassword()))); |
| | | if (rows > 0) { |
| | | return R.ok(); |
| | | } |
| | | return R.fail("ä¿®æ¹å¯ç å¼å¸¸ï¼è¯·è系管çå"); |
| | |
| | | } |
| | | SysOssVo oss = ossService.upload(avatarfile); |
| | | String avatar = oss.getUrl(); |
| | | if (userService.updateUserAvatar(LoginHelper.getUserId(), oss.getOssId())) { |
| | | boolean updateSuccess = DataPermissionHelper.ignore(() -> userService.updateUserAvatar(LoginHelper.getUserId(), oss.getOssId())); |
| | | if (updateSuccess) { |
| | | AvatarVo avatarVo = new AvatarVo(); |
| | | avatarVo.setImgUrl(avatar); |
| | | return R.ok(avatarVo); |
| | |
| | | */ |
| | | @SaCheckRole(TenantConstants.SUPER_ADMIN_ROLE_KEY) |
| | | @SaCheckPermission("system:tenant:export") |
| | | @Log(title = "ç§æ·", businessType = BusinessType.EXPORT) |
| | | @Log(title = "ç§æ·ç®¡ç", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/export") |
| | | public void export(SysTenantBo bo, HttpServletResponse response) { |
| | | List<SysTenantVo> list = tenantService.queryList(bo); |
| | |
| | | @ApiEncrypt |
| | | @SaCheckRole(TenantConstants.SUPER_ADMIN_ROLE_KEY) |
| | | @SaCheckPermission("system:tenant:add") |
| | | @Log(title = "ç§æ·", businessType = BusinessType.INSERT) |
| | | @Log(title = "ç§æ·ç®¡ç", businessType = BusinessType.INSERT) |
| | | @Lock4j |
| | | @RepeatSubmit() |
| | | @PostMapping() |
| | |
| | | */ |
| | | @SaCheckRole(TenantConstants.SUPER_ADMIN_ROLE_KEY) |
| | | @SaCheckPermission("system:tenant:edit") |
| | | @Log(title = "ç§æ·", businessType = BusinessType.UPDATE) |
| | | @Log(title = "ç§æ·ç®¡ç", businessType = BusinessType.UPDATE) |
| | | @RepeatSubmit() |
| | | @PutMapping() |
| | | public R<Void> edit(@Validated(EditGroup.class) @RequestBody SysTenantBo bo) { |
| | |
| | | */ |
| | | @SaCheckRole(TenantConstants.SUPER_ADMIN_ROLE_KEY) |
| | | @SaCheckPermission("system:tenant:edit") |
| | | @Log(title = "ç§æ·", businessType = BusinessType.UPDATE) |
| | | @Log(title = "ç§æ·ç®¡ç", businessType = BusinessType.UPDATE) |
| | | @PutMapping("/changeStatus") |
| | | public R<Void> changeStatus(@RequestBody SysTenantBo bo) { |
| | | tenantService.checkTenantAllowed(bo.getTenantId()); |
| | |
| | | */ |
| | | @SaCheckRole(TenantConstants.SUPER_ADMIN_ROLE_KEY) |
| | | @SaCheckPermission("system:tenant:remove") |
| | | @Log(title = "ç§æ·", businessType = BusinessType.DELETE) |
| | | @Log(title = "ç§æ·ç®¡ç", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{ids}") |
| | | public R<Void> remove(@NotEmpty(message = "主é®ä¸è½ä¸ºç©º") |
| | | @PathVariable Long[] ids) { |
| | |
| | | */ |
| | | @SaCheckRole(TenantConstants.SUPER_ADMIN_ROLE_KEY) |
| | | @SaCheckPermission("system:tenant:edit") |
| | | @Log(title = "ç§æ·", businessType = BusinessType.UPDATE) |
| | | @Log(title = "ç§æ·ç®¡ç", businessType = BusinessType.UPDATE) |
| | | @GetMapping("/syncTenantPackage") |
| | | public R<Void> syncTenantPackage(@NotBlank(message = "ç§æ·IDä¸è½ä¸ºç©º") String tenantId, |
| | | @NotNull(message = "å¥é¤IDä¸è½ä¸ºç©º") Long packageId) { |
| | | return toAjax(TenantHelper.ignore(() -> tenantService.syncTenantPackage(tenantId, packageId))); |
| | | } |
| | | |
| | | /** |
| | | * åæ¥ç§æ·åå
¸ |
| | | */ |
| | | @SaCheckRole(TenantConstants.SUPER_ADMIN_ROLE_KEY) |
| | | @Log(title = "ç§æ·ç®¡ç", businessType = BusinessType.INSERT) |
| | | @GetMapping("/syncTenantDict") |
| | | public R<Void> syncTenantDict() { |
| | | if (!TenantHelper.isEnable()) { |
| | | return R.fail("å½åæªå¼å¯ç§æ·æ¨¡å¼"); |
| | | } |
| | | tenantService.syncTenantDict(); |
| | | return R.ok("åæ¥ç§æ·åå
¸æå"); |
| | | } |
| | | |
| | | } |
| | |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.dromara.common.core.constant.UserConstants; |
| | | import org.dromara.common.core.constant.SystemConstants; |
| | | import org.dromara.common.core.domain.R; |
| | | import org.dromara.common.core.domain.model.LoginUser; |
| | | import org.dromara.common.core.utils.StreamUtils; |
| | |
| | | @SaCheckPermission("system:user:query") |
| | | @GetMapping(value = {"/", "/{userId}"}) |
| | | public R<SysUserInfoVo> getInfo(@PathVariable(value = "userId", required = false) Long userId) { |
| | | userService.checkUserDataScope(userId); |
| | | SysUserInfoVo userInfoVo = new SysUserInfoVo(); |
| | | SysRoleBo roleBo = new SysRoleBo(); |
| | | roleBo.setStatus(UserConstants.ROLE_NORMAL); |
| | | List<SysRoleVo> roles = roleService.selectRoleList(roleBo); |
| | | userInfoVo.setRoles(LoginHelper.isSuperAdmin(userId) ? roles : StreamUtils.filter(roles, r -> !r.isSuperAdmin())); |
| | | if (ObjectUtil.isNotNull(userId)) { |
| | | userService.checkUserDataScope(userId); |
| | | SysUserVo sysUser = userService.selectUserById(userId); |
| | | userInfoVo.setUser(sysUser); |
| | | userInfoVo.setRoleIds(roleService.selectRoleListByUserId(userId)); |
| | |
| | | userInfoVo.setPostIds(postService.selectPostListByUserId(userId)); |
| | | } |
| | | } |
| | | SysRoleBo roleBo = new SysRoleBo(); |
| | | roleBo.setStatus(SystemConstants.NORMAL); |
| | | List<SysRoleVo> roles = roleService.selectRoleList(roleBo); |
| | | userInfoVo.setRoles(LoginHelper.isSuperAdmin(userId) ? roles : StreamUtils.filter(roles, r -> !r.isSuperAdmin())); |
| | | return R.ok(userInfoVo); |
| | | } |
| | | |
| | |
| | | @GetMapping("/optionselect") |
| | | public R<List<SysUserVo>> optionselect(@RequestParam(required = false) Long[] userIds, |
| | | @RequestParam(required = false) Long deptId) { |
| | | return R.ok(userService.selectUserByIds(userIds == null ? null : List.of(userIds), deptId)); |
| | | return R.ok(userService.selectUserByIds(ArrayUtil.isEmpty(userIds) ? null : List.of(userIds), deptId)); |
| | | } |
| | | |
| | | /** |
| | |
| | | private String status; |
| | | |
| | | /** |
| | | * å 餿 å¿ï¼0代表åå¨ 2代表å é¤ï¼ |
| | | * å 餿 å¿ï¼0代表åå¨ 1代表å é¤ï¼ |
| | | */ |
| | | @TableLogic |
| | | private String delFlag; |
| | |
| | | private String status; |
| | | |
| | | /** |
| | | * å 餿 å¿ï¼0代表åå¨ 2代表å é¤ï¼ |
| | | * å 餿 å¿ï¼0代表åå¨ 1代表å é¤ï¼ |
| | | */ |
| | | @TableLogic |
| | | private String delFlag; |
| | |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import org.dromara.common.core.constant.UserConstants; |
| | | import org.dromara.common.tenant.core.TenantEntity; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import org.dromara.common.core.constant.SystemConstants; |
| | | import org.dromara.common.tenant.core.TenantEntity; |
| | | |
| | | /** |
| | | * åå
¸æ°æ®è¡¨ sys_dict_data |
| | |
| | | private String remark; |
| | | |
| | | public boolean getDefault() { |
| | | return UserConstants.YES.equals(this.isDefault); |
| | | return SystemConstants.YES.equals(this.isDefault); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import org.dromara.common.core.constant.Constants; |
| | | import org.dromara.common.core.constant.UserConstants; |
| | | import org.dromara.common.core.utils.StringUtils; |
| | | import org.dromara.common.mybatis.core.domain.BaseEntity; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import org.dromara.common.core.constant.Constants; |
| | | import org.dromara.common.core.constant.SystemConstants; |
| | | import org.dromara.common.core.utils.StringUtils; |
| | | import org.dromara.common.mybatis.core.domain.BaseEntity; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | |
| | | routerPath = innerLinkReplaceEach(routerPath); |
| | | } |
| | | // éå¤é¾å¹¶ä¸æ¯ä¸çº§ç®å½ï¼ç±»å为ç®å½ï¼ |
| | | if (0L == getParentId() && UserConstants.TYPE_DIR.equals(getMenuType()) |
| | | && UserConstants.NO_FRAME.equals(getIsFrame())) { |
| | | if (0L == getParentId() && SystemConstants.TYPE_DIR.equals(getMenuType()) |
| | | && SystemConstants.NO_FRAME.equals(getIsFrame())) { |
| | | routerPath = "/" + this.path; |
| | | } |
| | | // éå¤é¾å¹¶ä¸æ¯ä¸çº§ç®å½ï¼ç±»å为èåï¼ |
| | |
| | | * è·åç»ä»¶ä¿¡æ¯ |
| | | */ |
| | | public String getComponentInfo() { |
| | | String component = UserConstants.LAYOUT; |
| | | String component = SystemConstants.LAYOUT; |
| | | if (StringUtils.isNotEmpty(this.component) && !isMenuFrame()) { |
| | | component = this.component; |
| | | } else if (StringUtils.isEmpty(this.component) && getParentId() != 0L && isInnerLink()) { |
| | | component = UserConstants.INNER_LINK; |
| | | component = SystemConstants.INNER_LINK; |
| | | } else if (StringUtils.isEmpty(this.component) && isParentView()) { |
| | | component = UserConstants.PARENT_VIEW; |
| | | component = SystemConstants.PARENT_VIEW; |
| | | } |
| | | return component; |
| | | } |
| | |
| | | * æ¯å¦ä¸ºèåå
é¨è·³è½¬ |
| | | */ |
| | | public boolean isMenuFrame() { |
| | | return getParentId() == 0L && UserConstants.TYPE_MENU.equals(menuType) && isFrame.equals(UserConstants.NO_FRAME); |
| | | return getParentId() == 0L && SystemConstants.TYPE_MENU.equals(menuType) && isFrame.equals(SystemConstants.NO_FRAME); |
| | | } |
| | | |
| | | /** |
| | | * æ¯å¦ä¸ºå
é¾ç»ä»¶ |
| | | */ |
| | | public boolean isInnerLink() { |
| | | return isFrame.equals(UserConstants.NO_FRAME) && StringUtils.ishttp(path); |
| | | return isFrame.equals(SystemConstants.NO_FRAME) && StringUtils.ishttp(path); |
| | | } |
| | | |
| | | /** |
| | | * æ¯å¦ä¸ºparent_viewç»ä»¶ |
| | | */ |
| | | public boolean isParentView() { |
| | | return getParentId() != 0L && UserConstants.TYPE_DIR.equals(menuType); |
| | | return getParentId() != 0L && SystemConstants.TYPE_DIR.equals(menuType); |
| | | } |
| | | |
| | | /** |
| | |
| | | private String status; |
| | | |
| | | /** |
| | | * å 餿 å¿ï¼0代表åå¨ 2代表å é¤ï¼ |
| | | * å 餿 å¿ï¼0代表åå¨ 1代表å é¤ï¼ |
| | | */ |
| | | @TableLogic |
| | | private String delFlag; |
| | |
| | | private String status; |
| | | |
| | | /** |
| | | * å 餿 å¿ï¼0代表åå¨ 2代表å é¤ï¼ |
| | | * å 餿 å¿ï¼0代表åå¨ 1代表å é¤ï¼ |
| | | */ |
| | | @TableLogic |
| | | private String delFlag; |
| | |
| | | */ |
| | | @TableId(value = "package_id") |
| | | private Long packageId; |
| | | |
| | | /** |
| | | * å¥é¤åç§° |
| | | */ |
| | | private String packageName; |
| | | |
| | | /** |
| | | * å
³èèåid |
| | | */ |
| | | private String menuIds; |
| | | |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | private String remark; |
| | | |
| | | /** |
| | | * èåæ éæ©é¡¹æ¯å¦å
³èæ¾ç¤ºï¼ 0ï¼ç¶åä¸äºç¸å
³èæ¾ç¤º 1ï¼ç¶åäºç¸å
³èæ¾ç¤ºï¼ |
| | | */ |
| | | private Boolean menuCheckStrictly; |
| | | |
| | | /** |
| | | * ç¶æï¼0æ£å¸¸ 1åç¨ï¼ |
| | | */ |
| | | private String status; |
| | | |
| | | /** |
| | | * å 餿 å¿ï¼0代表åå¨ 2代表å é¤ï¼ |
| | | * å 餿 å¿ï¼0代表åå¨ 1代表å é¤ï¼ |
| | | */ |
| | | @TableLogic |
| | | private String delFlag; |
| | |
| | | package org.dromara.system.domain; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import org.dromara.common.core.constant.UserConstants; |
| | | import org.dromara.common.tenant.core.TenantEntity; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.NoArgsConstructor; |
| | | import org.dromara.common.core.constant.SystemConstants; |
| | | import org.dromara.common.tenant.core.TenantEntity; |
| | | |
| | | import java.util.Date; |
| | | |
| | |
| | | private String status; |
| | | |
| | | /** |
| | | * å 餿 å¿ï¼0代表åå¨ 2代表å é¤ï¼ |
| | | * å 餿 å¿ï¼0代表åå¨ 1代表å é¤ï¼ |
| | | */ |
| | | @TableLogic |
| | | private String delFlag; |
| | |
| | | } |
| | | |
| | | public boolean isSuperAdmin() { |
| | | return UserConstants.SUPER_ADMIN_ID.equals(this.userId); |
| | | return SystemConstants.SUPER_ADMIN_ID.equals(this.userId); |
| | | } |
| | | |
| | | } |
| | |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.NoArgsConstructor; |
| | | import org.dromara.common.core.constant.UserConstants; |
| | | import org.dromara.common.core.constant.SystemConstants; |
| | | import org.dromara.common.mybatis.core.domain.BaseEntity; |
| | | import org.dromara.system.domain.SysRole; |
| | | |
| | |
| | | } |
| | | |
| | | public boolean isSuperAdmin() { |
| | | return UserConstants.SUPER_ADMIN_ID.equals(this.roleId); |
| | | return SystemConstants.SUPER_ADMIN_ID.equals(this.roleId); |
| | | } |
| | | |
| | | } |
| | |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.NoArgsConstructor; |
| | | import org.dromara.common.core.constant.UserConstants; |
| | | import org.dromara.common.core.constant.SystemConstants; |
| | | import org.dromara.common.core.xss.Xss; |
| | | import org.dromara.common.mybatis.core.domain.BaseEntity; |
| | | import org.dromara.system.domain.SysUser; |
| | |
| | | } |
| | | |
| | | public boolean isSuperAdmin() { |
| | | return UserConstants.SUPER_ADMIN_ID.equals(this.userId); |
| | | return SystemConstants.SUPER_ADMIN_ID.equals(this.userId); |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
| | | import com.alibaba.excel.annotation.ExcelProperty; |
| | | import org.dromara.common.core.constant.UserConstants; |
| | | import io.github.linpeilie.annotations.AutoMapper; |
| | | import lombok.Data; |
| | | import org.dromara.common.core.constant.SystemConstants; |
| | | import org.dromara.common.excel.annotation.ExcelDictFormat; |
| | | import org.dromara.common.excel.convert.ExcelDictConvert; |
| | | import org.dromara.system.domain.SysRole; |
| | | import io.github.linpeilie.annotations.AutoMapper; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serial; |
| | | import java.io.Serializable; |
| | |
| | | private boolean flag = false; |
| | | |
| | | public boolean isSuperAdmin() { |
| | | return UserConstants.SUPER_ADMIN_ID.equals(this.roleId); |
| | | return SystemConstants.SUPER_ADMIN_ID.equals(this.roleId); |
| | | } |
| | | |
| | | } |
| | |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import cn.hutool.crypto.digest.BCrypt; |
| | | import cn.hutool.http.HtmlUtil; |
| | | import com.alibaba.excel.context.AnalysisContext; |
| | | import com.alibaba.excel.event.AnalysisEventListener; |
| | | import jakarta.validation.ConstraintViolation; |
| | | import jakarta.validation.ConstraintViolationException; |
| | | import org.dromara.common.core.exception.ServiceException; |
| | | import org.dromara.common.core.utils.SpringUtils; |
| | | import org.dromara.common.core.utils.StreamUtils; |
| | | import org.dromara.common.core.utils.ValidatorUtils; |
| | | import org.dromara.common.excel.core.ExcelListener; |
| | | import org.dromara.common.excel.core.ExcelResult; |
| | |
| | | } |
| | | } catch (Exception e) { |
| | | failureNum++; |
| | | String msg = "<br/>" + failureNum + "ãè´¦å· " + userVo.getUserName() + " 导å
¥å¤±è´¥ï¼"; |
| | | failureMsg.append(msg).append(e.getMessage()); |
| | | String msg = "<br/>" + failureNum + "ãè´¦å· " + HtmlUtil.cleanHtmlTag(userVo.getUserName()) + " 导å
¥å¤±è´¥ï¼"; |
| | | String message = e.getMessage(); |
| | | if (e instanceof ConstraintViolationException cvException) { |
| | | message = StreamUtils.join(cvException.getConstraintViolations(), ConstraintViolation::getMessage, ", "); |
| | | } |
| | | failureMsg.append(msg).append(message); |
| | | log.error(msg, e); |
| | | } |
| | | } |
| | |
| | | package org.dromara.system.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Constants; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.dromara.common.mybatis.annotation.DataColumn; |
| | | import org.dromara.common.mybatis.annotation.DataPermission; |
| | | import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; |
| | | import org.dromara.common.mybatis.helper.DataBaseHelper; |
| | | import org.dromara.system.domain.SysDept; |
| | | import org.dromara.system.domain.vo.SysDeptVo; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | }) |
| | | List<SysDeptVo> selectDeptList(@Param(Constants.WRAPPER) Wrapper<SysDept> queryWrapper); |
| | | |
| | | /** |
| | | * å页æ¥è¯¢é¨é¨ç®¡çæ°æ® |
| | | * |
| | | * @param queryWrapper æ¥è¯¢æ¡ä»¶ |
| | | * @return é¨é¨ä¿¡æ¯éå |
| | | */ |
| | | @DataPermission({ |
| | | @DataColumn(key = "deptName", value = "dept_id"), |
| | | }) |
| | | Page<SysDeptVo> selectPageDeptList(@Param("page") Page<SysDeptVo> page, @Param(Constants.WRAPPER) Wrapper<SysDept> queryWrapper); |
| | | |
| | | /** |
| | | * ç»è®¡æå®é¨é¨IDçé¨é¨æ°é |
| | | * |
| | | * @param deptId é¨é¨ID |
| | | * @return 该é¨é¨IDçé¨é¨æ°é |
| | | */ |
| | | @DataPermission({ |
| | | @DataColumn(key = "deptName", value = "dept_id") |
| | | }) |
| | | long countDeptById(Long deptId); |
| | | |
| | | /** |
| | | * æ ¹æ®ç¶é¨é¨IDæ¥è¯¢å
¶ææåé¨é¨çå表 |
| | | * |
| | | * @param parentId ç¶é¨é¨ID |
| | | * @return å
å«åé¨é¨çå表 |
| | | */ |
| | | default List<SysDept> selectListByParentId(Long parentId) { |
| | | return this.selectList(new LambdaQueryWrapper<SysDept>() |
| | | .select(SysDept::getDeptId) |
| | | .apply(DataBaseHelper.findInSet(parentId, "ancestors"))); |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®è§è²IDæ¥è¯¢é¨é¨æ ä¿¡æ¯ |
| | | * |
| | | * @param roleId è§è²ID |
| | |
| | | */ |
| | | public interface SysDictDataMapper extends BaseMapperPlus<SysDictData, SysDictDataVo> { |
| | | |
| | | /** |
| | | * æ ¹æ®åå
¸ç±»åæ¥è¯¢åå
¸æ°æ®å表 |
| | | * |
| | | * @param dictType åå
¸ç±»å |
| | | * @return ç¬¦åæ¡ä»¶çåå
¸æ°æ®å表 |
| | | */ |
| | | default List<SysDictDataVo> selectDictDataByType(String dictType) { |
| | | return selectVoList( |
| | | new LambdaQueryWrapper<SysDictData>() |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Constants; |
| | | import org.dromara.common.core.constant.UserConstants; |
| | | import org.dromara.system.domain.SysMenu; |
| | | import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; |
| | | import org.dromara.system.domain.vo.SysMenuVo; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.dromara.common.core.constant.SystemConstants; |
| | | import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; |
| | | import org.dromara.system.domain.SysMenu; |
| | | import org.dromara.system.domain.vo.SysMenuVo; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | */ |
| | | default List<SysMenu> selectMenuTreeAll() { |
| | | LambdaQueryWrapper<SysMenu> lqw = new LambdaQueryWrapper<SysMenu>() |
| | | .in(SysMenu::getMenuType, UserConstants.TYPE_DIR, UserConstants.TYPE_MENU) |
| | | .eq(SysMenu::getStatus, UserConstants.MENU_NORMAL) |
| | | .in(SysMenu::getMenuType, SystemConstants.TYPE_DIR, SystemConstants.TYPE_MENU) |
| | | .eq(SysMenu::getStatus, SystemConstants.NORMAL) |
| | | .orderByAsc(SysMenu::getParentId) |
| | | .orderByAsc(SysMenu::getOrderNum); |
| | | return this.selectList(lqw); |
| | |
| | | */ |
| | | public interface SysPostMapper extends BaseMapperPlus<SysPost, SysPostVo> { |
| | | |
| | | /** |
| | | * å页æ¥è¯¢å²ä½å表 |
| | | * |
| | | * @param page å页对象 |
| | | * @param queryWrapper æ¥è¯¢æ¡ä»¶ |
| | | * @return å
å«å²ä½ä¿¡æ¯çåé¡µç»æ |
| | | */ |
| | | @DataPermission({ |
| | | @DataColumn(key = "deptName", value = "dept_id"), |
| | | @DataColumn(key = "userName", value = "create_by") |
| | |
| | | */ |
| | | public interface SysRoleMapper extends BaseMapperPlus<SysRole, SysRoleVo> { |
| | | |
| | | /** |
| | | * å页æ¥è¯¢è§è²å表 |
| | | * |
| | | * @param page å页对象 |
| | | * @param queryWrapper æ¥è¯¢æ¡ä»¶ |
| | | * @return å
å«è§è²ä¿¡æ¯çåé¡µç»æ |
| | | */ |
| | | @DataPermission({ |
| | | @DataColumn(key = "deptName", value = "d.dept_id"), |
| | | @DataColumn(key = "userName", value = "r.create_by") |
| | |
| | | }) |
| | | List<SysRoleVo> selectRoleList(@Param(Constants.WRAPPER) Wrapper<SysRole> queryWrapper); |
| | | |
| | | /** |
| | | * æ ¹æ®è§è²IDæ¥è¯¢è§è²ä¿¡æ¯ |
| | | * |
| | | * @param roleId è§è²ID |
| | | * @return 对åºçè§è²ä¿¡æ¯ |
| | | */ |
| | | @DataPermission({ |
| | | @DataColumn(key = "deptName", value = "d.dept_id"), |
| | | @DataColumn(key = "userName", value = "r.create_by") |
| | |
| | | */ |
| | | public interface SysUserMapper extends BaseMapperPlus<SysUser, SysUserVo> { |
| | | |
| | | /** |
| | | * å页æ¥è¯¢ç¨æ·å表ï¼å¹¶è¿è¡æ°æ®æéæ§å¶ |
| | | * |
| | | * @param page å页忰 |
| | | * @param queryWrapper æ¥è¯¢æ¡ä»¶ |
| | | * @return å页çç¨æ·ä¿¡æ¯ |
| | | */ |
| | | @DataPermission({ |
| | | @DataColumn(key = "deptName", value = "u.dept_id"), |
| | | @DataColumn(key = "userName", value = "u.user_id") |
| | | }) |
| | | Page<SysUserVo> selectPageUserList(@Param("page") Page<SysUser> page, @Param(Constants.WRAPPER) Wrapper<SysUser> queryWrapper); |
| | | |
| | | /** |
| | | * æ¥è¯¢ç¨æ·å表ï¼å¹¶è¿è¡æ°æ®æéæ§å¶ |
| | | * |
| | | * @param queryWrapper æ¥è¯¢æ¡ä»¶ |
| | | * @return ç¨æ·ä¿¡æ¯éå |
| | | */ |
| | | @DataPermission({ |
| | | @DataColumn(key = "deptName", value = "dept_id"), |
| | | @DataColumn(key = "userName", value = "user_id") |
| | |
| | | }) |
| | | Page<SysUserVo> selectUnallocatedList(@Param("page") Page<SysUser> page, @Param(Constants.WRAPPER) Wrapper<SysUser> queryWrapper); |
| | | |
| | | /** |
| | | * æ ¹æ®ç¨æ·IDç»è®¡ç¨æ·æ°é |
| | | * |
| | | * @param userId ç¨æ·ID |
| | | * @return ç¨æ·æ°é |
| | | */ |
| | | @DataPermission({ |
| | | @DataColumn(key = "deptName", value = "dept_id"), |
| | | @DataColumn(key = "userName", value = "user_id") |
| | | }) |
| | | long countUserById(Long userId); |
| | | |
| | | /** |
| | | * æ ¹æ®æ¡ä»¶æ´æ°ç¨æ·æ°æ® |
| | | * |
| | | * @param user è¦æ´æ°çç¨æ·å®ä½ |
| | | * @param updateWrapper æ´æ°æ¡ä»¶å°è£
å¨ |
| | | * @return æ´æ°æä½å½±åçè¡æ° |
| | | */ |
| | | @Override |
| | | @DataPermission({ |
| | | @DataColumn(key = "deptName", value = "dept_id"), |
| | |
| | | }) |
| | | int update(@Param(Constants.ENTITY) SysUser user, @Param(Constants.WRAPPER) Wrapper<SysUser> updateWrapper); |
| | | |
| | | /** |
| | | * æ ¹æ®ç¨æ·IDæ´æ°ç¨æ·æ°æ® |
| | | * |
| | | * @param user è¦æ´æ°çç¨æ·å®ä½ |
| | | * @return æ´æ°æä½å½±åçè¡æ° |
| | | */ |
| | | @Override |
| | | @DataPermission({ |
| | | @DataColumn(key = "deptName", value = "dept_id"), |
| | |
| | | */ |
| | | public interface SysUserRoleMapper extends BaseMapperPlus<SysUserRole, SysUserRole> { |
| | | |
| | | /** |
| | | * æ ¹æ®è§è²IDæ¥è¯¢å
³èçç¨æ·IDå表 |
| | | * |
| | | * @param roleId è§è²ID |
| | | * @return å
³èå°æå®è§è²çç¨æ·IDå表 |
| | | */ |
| | | List<Long> selectUserIdsByRoleId(Long roleId); |
| | | |
| | | } |
| | |
| | | /** |
| | | * ä¿®æ¹ç¶æ |
| | | */ |
| | | int updateUserStatus(String clientId, String status); |
| | | int updateClientStatus(String clientId, String status); |
| | | |
| | | /** |
| | | * æ ¡éªå¹¶æ¹éå é¤å®¢æ·ç«¯ç®¡çä¿¡æ¯ |
| | |
| | | List<SysPostVo> selectPostList(SysPostBo post); |
| | | |
| | | /** |
| | | * æ¥è¯¢ç¨æ·æå±å²ä½ç» |
| | | * |
| | | * @param userId ç¨æ·ID |
| | | * @return å²ä½ID |
| | | */ |
| | | List<SysPostVo> selectPostsByUserId(Long userId); |
| | | |
| | | /** |
| | | * æ¥è¯¢ææå²ä½ |
| | | * |
| | | * @return å²ä½å表 |
| | |
| | | |
| | | void cleanOnlineUserByRole(Long roleId); |
| | | |
| | | void cleanOnlineUser(List<Long> userIds); |
| | | |
| | | } |
| | |
| | | * åæ¥ç§æ·å¥é¤ |
| | | */ |
| | | Boolean syncTenantPackage(String tenantId, Long packageId); |
| | | |
| | | /** |
| | | * åæ¥ç§æ·åå
¸ |
| | | */ |
| | | void syncTenantDict(); |
| | | } |
| | |
| | | */ |
| | | @CacheEvict(cacheNames = CacheNames.SYS_CLIENT, key = "#clientId") |
| | | @Override |
| | | public int updateUserStatus(String clientId, String status) { |
| | | public int updateClientStatus(String clientId, String status) { |
| | | return baseMapper.update(null, |
| | | new LambdaUpdateWrapper<SysClient>() |
| | | .set(SysClient::getStatus, status) |
| | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import org.dromara.common.core.constant.CacheNames; |
| | | import org.dromara.common.core.constant.UserConstants; |
| | | import org.dromara.common.core.constant.SystemConstants; |
| | | import org.dromara.common.core.exception.ServiceException; |
| | | import org.dromara.common.core.service.ConfigService; |
| | | import org.dromara.common.core.utils.MapstructUtils; |
| | | import org.dromara.common.core.utils.ObjectUtils; |
| | | import org.dromara.common.core.utils.SpringUtils; |
| | | import org.dromara.common.core.utils.StringUtils; |
| | | import org.dromara.common.mybatis.core.page.PageQuery; |
| | |
| | | public String selectConfigByKey(String configKey) { |
| | | SysConfig retConfig = baseMapper.selectOne(new LambdaQueryWrapper<SysConfig>() |
| | | .eq(SysConfig::getConfigKey, configKey)); |
| | | if (ObjectUtil.isNotNull(retConfig)) { |
| | | return retConfig.getConfigValue(); |
| | | } |
| | | return StringUtils.EMPTY; |
| | | return ObjectUtils.notNullGetter(retConfig, SysConfig::getConfigValue, StringUtils.EMPTY); |
| | | } |
| | | |
| | | /** |
| | |
| | | public void deleteConfigByIds(Long[] configIds) { |
| | | for (Long configId : configIds) { |
| | | SysConfig config = baseMapper.selectById(configId); |
| | | if (StringUtils.equals(UserConstants.YES, config.getConfigType())) { |
| | | if (StringUtils.equals(SystemConstants.YES, config.getConfigType())) { |
| | | throw new ServiceException(String.format("å
ç½®åæ°ã%1$sãä¸è½å é¤ ", config.getConfigKey())); |
| | | } |
| | | CacheUtils.evict(CacheNames.SYS_CONFIG, config.getConfigKey()); |
| | |
| | | */ |
| | | @Override |
| | | public boolean checkConfigKeyUnique(SysConfigBo config) { |
| | | long configId = ObjectUtil.isNull(config.getConfigId()) ? -1L : config.getConfigId(); |
| | | long configId = ObjectUtils.notNull(config.getConfigId(), -1L); |
| | | SysConfig info = baseMapper.selectOne(new LambdaQueryWrapper<SysConfig>().eq(SysConfig::getConfigKey, config.getConfigKey())); |
| | | if (ObjectUtil.isNotNull(info) && info.getConfigId() != configId) { |
| | | return false; |
| | |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.dromara.common.core.constant.CacheNames; |
| | | import org.dromara.common.core.utils.StreamUtils; |
| | | import org.dromara.common.mybatis.helper.DataBaseHelper; |
| | | import org.dromara.system.domain.SysDept; |
| | | import org.dromara.system.domain.SysRoleDept; |
| | | import org.dromara.system.mapper.SysDeptMapper; |
| | | import org.dromara.system.mapper.SysRoleDeptMapper; |
| | | import org.dromara.system.service.ISysDataScopeService; |
| | | import org.springframework.cache.annotation.Cacheable; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | |
| | | * @param roleId è§è²Id |
| | | * @return é¨é¨Idç» |
| | | */ |
| | | @Cacheable(cacheNames = CacheNames.SYS_ROLE_CUSTOM, key = "#roleId", condition = "#roleId != null") |
| | | @Override |
| | | public String getRoleCustom(Long roleId) { |
| | | if (ObjectUtil.isNull(roleId)) { |
| | |
| | | * @param deptId é¨é¨Id |
| | | * @return é¨é¨Idç» |
| | | */ |
| | | @Cacheable(cacheNames = CacheNames.SYS_DEPT_AND_CHILD, key = "#deptId", condition = "#deptId != null") |
| | | @Override |
| | | public String getDeptAndChild(Long deptId) { |
| | | if (ObjectUtil.isNull(deptId)) { |
| | | return "-1"; |
| | | } |
| | | List<SysDept> deptList = deptMapper.selectList(new LambdaQueryWrapper<SysDept>() |
| | | .select(SysDept::getDeptId) |
| | | .apply(DataBaseHelper.findInSet(deptId, "ancestors"))); |
| | | List<SysDept> deptList = deptMapper.selectListByParentId(deptId); |
| | | List<Long> ids = StreamUtils.toList(deptList, SysDept::getDeptId); |
| | | ids.add(deptId); |
| | | if (CollUtil.isNotEmpty(ids)) { |
| | |
| | | package org.dromara.system.service.impl; |
| | | |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.convert.Convert; |
| | | import cn.hutool.core.lang.tree.Tree; |
| | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.dromara.common.core.constant.CacheNames; |
| | | import org.dromara.common.core.constant.UserConstants; |
| | | import org.dromara.common.core.constant.SystemConstants; |
| | | import org.dromara.common.core.domain.dto.DeptDTO; |
| | | import org.dromara.common.core.exception.ServiceException; |
| | | import org.dromara.common.core.service.DeptService; |
| | | import org.dromara.common.core.utils.MapstructUtils; |
| | | import org.dromara.common.core.utils.SpringUtils; |
| | | import org.dromara.common.core.utils.StringUtils; |
| | | import org.dromara.common.core.utils.TreeBuildUtils; |
| | | import org.dromara.common.core.utils.*; |
| | | import org.dromara.common.mybatis.helper.DataBaseHelper; |
| | | import org.dromara.common.redis.utils.CacheUtils; |
| | | import org.dromara.common.satoken.utils.LoginHelper; |
| | |
| | | import org.dromara.system.service.ISysDeptService; |
| | | import org.springframework.cache.annotation.CacheEvict; |
| | | import org.springframework.cache.annotation.Cacheable; |
| | | import org.springframework.cache.annotation.Caching; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | |
| | | */ |
| | | @Override |
| | | public List<Tree<Long>> selectDeptTreeList(SysDeptBo bo) { |
| | | // åªæ¥è¯¢æªç¦ç¨é¨é¨ |
| | | bo.setStatus(UserConstants.DEPT_NORMAL); |
| | | LambdaQueryWrapper<SysDept> lqw = buildQueryWrapper(bo); |
| | | List<SysDeptVo> depts = baseMapper.selectDeptList(lqw); |
| | | return buildDeptTreeSelect(depts); |
| | |
| | | |
| | | private LambdaQueryWrapper<SysDept> buildQueryWrapper(SysDeptBo bo) { |
| | | LambdaQueryWrapper<SysDept> lqw = Wrappers.lambdaQuery(); |
| | | lqw.eq(SysDept::getDelFlag, UserConstants.DEL_FLAG_NORMAL); |
| | | lqw.eq(SysDept::getDelFlag, SystemConstants.NORMAL); |
| | | lqw.eq(ObjectUtil.isNotNull(bo.getDeptId()), SysDept::getDeptId, bo.getDeptId()); |
| | | lqw.eq(ObjectUtil.isNotNull(bo.getParentId()), SysDept::getParentId, bo.getParentId()); |
| | | lqw.like(StringUtils.isNotBlank(bo.getDeptName()), SysDept::getDeptName, bo.getDeptName()); |
| | |
| | | if (CollUtil.isEmpty(depts)) { |
| | | return CollUtil.newArrayList(); |
| | | } |
| | | return TreeBuildUtils.build(depts, (dept, tree) -> |
| | | tree.setId(dept.getDeptId()) |
| | | .setParentId(dept.getParentId()) |
| | | .setName(dept.getDeptName()) |
| | | .setWeight(dept.getOrderNum())); |
| | | // è·åå½ååè¡¨ä¸æ¯ä¸ä¸ªèç¹çparentIdï¼ç¶åå¨åè¡¨ä¸æ¥æ¾æ¯å¦æidä¸å
¶parentId对åºï¼è¥æ 对åºï¼åè¡¨ææ¤æ¶èç¹å表ä¸ï¼è¯¥èç¹å¨å½åå表ä¸å±äºé¡¶çº§èç¹ |
| | | List<Tree<Long>> treeList = CollUtil.newArrayList(); |
| | | for (SysDeptVo d : depts) { |
| | | Long parentId = d.getParentId(); |
| | | SysDeptVo sysDeptVo = StreamUtils.findFirst(depts, it -> it.getDeptId().longValue() == parentId); |
| | | if (ObjectUtil.isNull(sysDeptVo)) { |
| | | List<Tree<Long>> trees = TreeBuildUtils.build(depts, parentId, (dept, tree) -> |
| | | tree.setId(dept.getDeptId()) |
| | | .setParentId(dept.getParentId()) |
| | | .setName(dept.getDeptName()) |
| | | .setWeight(dept.getOrderNum()) |
| | | .putExtra("disabled", SystemConstants.DISABLE.equals(dept.getStatus()))); |
| | | Tree<Long> tree = StreamUtils.findFirst(trees, it -> it.getId().longValue() == d.getDeptId()); |
| | | treeList.add(tree); |
| | | } |
| | | } |
| | | return treeList; |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | SysDeptVo parentDept = baseMapper.selectVoOne(new LambdaQueryWrapper<SysDept>() |
| | | .select(SysDept::getDeptName).eq(SysDept::getDeptId, dept.getParentId())); |
| | | dept.setParentName(ObjectUtil.isNotNull(parentDept) ? parentDept.getDeptName() : null); |
| | | dept.setParentName(ObjectUtils.notNullGetter(parentDept, SysDeptVo::getDeptName)); |
| | | return dept; |
| | | } |
| | | |
| | |
| | | public List<SysDeptVo> selectDeptByIds(List<Long> deptIds) { |
| | | return baseMapper.selectDeptList(new LambdaQueryWrapper<SysDept>() |
| | | .select(SysDept::getDeptId, SysDept::getDeptName, SysDept::getLeader) |
| | | .eq(SysDept::getStatus, UserConstants.DEPT_NORMAL) |
| | | .eq(SysDept::getStatus, SystemConstants.NORMAL) |
| | | .in(CollUtil.isNotEmpty(deptIds), SysDept::getDeptId, deptIds)); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®é¨é¨IDæ¥è¯¢é¨é¨è´è´£äºº |
| | | * |
| | | * @param deptId é¨é¨IDï¼ç¨äºæå®éè¦æ¥è¯¢çé¨é¨ |
| | | * @return è¿å该é¨é¨çè´è´£äººID |
| | | */ |
| | | @Override |
| | | public Long selectDeptLeaderById(Long deptId) { |
| | | SysDeptVo vo = SpringUtils.getAopProxy(this).selectDeptById(deptId); |
| | | return vo.getLeader(); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢é¨é¨ |
| | | * |
| | | * @return é¨é¨å表 |
| | | */ |
| | | @Override |
| | | public List<DeptDTO> selectDeptsByList() { |
| | | List<SysDeptVo> list = baseMapper.selectDeptList(new LambdaQueryWrapper<SysDept>() |
| | | .select(SysDept::getDeptId, SysDept::getDeptName, SysDept::getParentId) |
| | | .eq(SysDept::getStatus, SystemConstants.NORMAL)); |
| | | return BeanUtil.copyToList(list, DeptDTO.class); |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®IDæ¥è¯¢ææåé¨é¨æ°ï¼æ£å¸¸ç¶æï¼ |
| | | * |
| | | * @param deptId é¨é¨ID |
| | |
| | | @Override |
| | | public long selectNormalChildrenDeptById(Long deptId) { |
| | | return baseMapper.selectCount(new LambdaQueryWrapper<SysDept>() |
| | | .eq(SysDept::getStatus, UserConstants.DEPT_NORMAL) |
| | | .eq(SysDept::getStatus, SystemConstants.NORMAL) |
| | | .apply(DataBaseHelper.findInSet(deptId, "ancestors"))); |
| | | } |
| | | |
| | |
| | | * @param bo é¨é¨ä¿¡æ¯ |
| | | * @return ç»æ |
| | | */ |
| | | @CacheEvict(cacheNames = CacheNames.SYS_DEPT_AND_CHILD, allEntries = true) |
| | | @Override |
| | | public int insertDept(SysDeptBo bo) { |
| | | SysDept info = baseMapper.selectById(bo.getParentId()); |
| | | // 妿ç¶èç¹ä¸ä¸ºæ£å¸¸ç¶æ,åä¸å
许æ°å¢åèç¹ |
| | | if (!UserConstants.DEPT_NORMAL.equals(info.getStatus())) { |
| | | if (!SystemConstants.NORMAL.equals(info.getStatus())) { |
| | | throw new ServiceException("é¨é¨åç¨ï¼ä¸å
许æ°å¢"); |
| | | } |
| | | SysDept dept = MapstructUtils.convert(bo, SysDept.class); |
| | |
| | | * @param bo é¨é¨ä¿¡æ¯ |
| | | * @return ç»æ |
| | | */ |
| | | @CacheEvict(cacheNames = CacheNames.SYS_DEPT, key = "#bo.deptId") |
| | | @Caching(evict = { |
| | | @CacheEvict(cacheNames = CacheNames.SYS_DEPT, key = "#bo.deptId"), |
| | | @CacheEvict(cacheNames = CacheNames.SYS_DEPT_AND_CHILD, allEntries = true) |
| | | }) |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int updateDept(SysDeptBo bo) { |
| | | SysDept dept = MapstructUtils.convert(bo, SysDept.class); |
| | | SysDept oldDept = baseMapper.selectById(dept.getDeptId()); |
| | | if (ObjectUtil.isNull(oldDept)) { |
| | | throw new ServiceException("é¨é¨ä¸åå¨ï¼æ æ³ä¿®æ¹"); |
| | | } |
| | | if (!oldDept.getParentId().equals(dept.getParentId())) { |
| | | // å¦ææ¯æ°ç¶é¨é¨ åæ ¡éªæ¯å¦å
·ææ°ç¶é¨é¨æé é¿å
è¶æ |
| | | this.checkDeptDataScope(dept.getParentId()); |
| | | SysDept newParentDept = baseMapper.selectById(dept.getParentId()); |
| | | if (ObjectUtil.isNotNull(newParentDept) && ObjectUtil.isNotNull(oldDept)) { |
| | | if (ObjectUtil.isNotNull(newParentDept)) { |
| | | String newAncestors = newParentDept.getAncestors() + StringUtils.SEPARATOR + newParentDept.getDeptId(); |
| | | String oldAncestors = oldDept.getAncestors(); |
| | | dept.setAncestors(newAncestors); |
| | | updateDeptChildren(dept.getDeptId(), newAncestors, oldAncestors); |
| | | } |
| | | } else { |
| | | dept.setAncestors(oldDept.getAncestors()); |
| | | } |
| | | int result = baseMapper.updateById(dept); |
| | | if (UserConstants.DEPT_NORMAL.equals(dept.getStatus()) && StringUtils.isNotEmpty(dept.getAncestors()) |
| | | && !StringUtils.equals(UserConstants.DEPT_NORMAL, dept.getAncestors())) { |
| | | if (SystemConstants.NORMAL.equals(dept.getStatus()) && StringUtils.isNotEmpty(dept.getAncestors()) |
| | | && !StringUtils.equals(SystemConstants.NORMAL, dept.getAncestors())) { |
| | | // å¦æè¯¥é¨é¨æ¯å¯ç¨ç¶æï¼åå¯ç¨è¯¥é¨é¨çææä¸çº§é¨é¨ |
| | | updateParentDeptStatusNormal(dept); |
| | | } |
| | |
| | | String ancestors = dept.getAncestors(); |
| | | Long[] deptIds = Convert.toLongArray(ancestors); |
| | | baseMapper.update(null, new LambdaUpdateWrapper<SysDept>() |
| | | .set(SysDept::getStatus, UserConstants.DEPT_NORMAL) |
| | | .set(SysDept::getStatus, SystemConstants.NORMAL) |
| | | .in(SysDept::getDeptId, Arrays.asList(deptIds))); |
| | | } |
| | | |
| | |
| | | * @param deptId é¨é¨ID |
| | | * @return ç»æ |
| | | */ |
| | | @CacheEvict(cacheNames = CacheNames.SYS_DEPT, key = "#deptId") |
| | | @Caching(evict = { |
| | | @CacheEvict(cacheNames = CacheNames.SYS_DEPT, key = "#deptId"), |
| | | @CacheEvict(cacheNames = CacheNames.SYS_DEPT_AND_CHILD, key = "#deptId") |
| | | }) |
| | | @Override |
| | | public int deleteDeptById(Long deptId) { |
| | | return baseMapper.deleteById(deptId); |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import org.dromara.common.core.constant.CacheNames; |
| | | import org.dromara.common.core.utils.MapstructUtils; |
| | | import org.dromara.common.core.utils.ObjectUtils; |
| | | import org.dromara.common.mybatis.core.page.PageQuery; |
| | | import org.dromara.system.domain.SysDictData; |
| | | import org.dromara.common.mybatis.core.page.TableDataInfo; |
| | |
| | | */ |
| | | @Override |
| | | public boolean checkDictDataUnique(SysDictDataBo dict) { |
| | | Long dictCode = ObjectUtil.isNull(dict.getDictCode()) ? -1L : dict.getDictCode(); |
| | | Long dictCode = ObjectUtils.notNull(dict.getDictCode(), -1L); |
| | | SysDictData entity = baseMapper.selectOne(new LambdaQueryWrapper<SysDictData>() |
| | | .eq(SysDictData::getDictType, dict.getDictType()).eq(SysDictData::getDictValue, dict.getDictValue())); |
| | | if (ObjectUtil.isNotNull(entity) && !dictCode.equals(entity.getDictCode())) { |
| | |
| | | .between(params.get("beginTime") != null && params.get("endTime") != null, |
| | | SysLogininfor::getLoginTime, params.get("beginTime"), params.get("endTime")); |
| | | if (StringUtils.isBlank(pageQuery.getOrderByColumn())) { |
| | | pageQuery.setOrderByColumn("info_id"); |
| | | pageQuery.setIsAsc("desc"); |
| | | lqw.orderByDesc(SysLogininfor::getInfoId); |
| | | } |
| | | Page<SysLogininforVo> page = baseMapper.selectVoPage(pageQuery.build(), lqw); |
| | | return TableDataInfo.build(page); |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.dromara.common.core.constant.UserConstants; |
| | | import org.dromara.common.core.constant.SystemConstants; |
| | | import org.dromara.common.core.utils.MapstructUtils; |
| | | import org.dromara.common.core.utils.StreamUtils; |
| | | import org.dromara.common.core.utils.StringUtils; |
| | |
| | | router.setQuery(menu.getQueryParam()); |
| | | router.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), StringUtils.equals("1", menu.getIsCache()), menu.getPath())); |
| | | List<SysMenu> cMenus = menu.getChildren(); |
| | | if (CollUtil.isNotEmpty(cMenus) && UserConstants.TYPE_DIR.equals(menu.getMenuType())) { |
| | | if (CollUtil.isNotEmpty(cMenus) && SystemConstants.TYPE_DIR.equals(menu.getMenuType())) { |
| | | router.setAlwaysShow(true); |
| | | router.setRedirect("noRedirect"); |
| | | router.setChildren(buildMenus(cMenus)); |
| | |
| | | String routerPath = SysMenu.innerLinkReplaceEach(menu.getPath()); |
| | | String innerLinkName = StringUtils.capitalize(routerPath) + menu.getMenuId(); |
| | | children.setPath(routerPath); |
| | | children.setComponent(UserConstants.INNER_LINK); |
| | | children.setComponent(SystemConstants.INNER_LINK); |
| | | children.setName(innerLinkName); |
| | | children.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), menu.getPath())); |
| | | childrenList.add(children); |
| | |
| | | if (CollUtil.isEmpty(menus)) { |
| | | return CollUtil.newArrayList(); |
| | | } |
| | | return TreeBuildUtils.build(menus, (menu, tree) -> |
| | | tree.setId(menu.getMenuId()) |
| | | return TreeBuildUtils.build(menus, (menu, tree) -> { |
| | | Tree<Long> menuTree = tree.setId(menu.getMenuId()) |
| | | .setParentId(menu.getParentId()) |
| | | .setName(menu.getMenuName()) |
| | | .setWeight(menu.getOrderNum())); |
| | | .setWeight(menu.getOrderNum()); |
| | | menuTree.put("menuType", menu.getMenuType()); |
| | | menuTree.put("icon", menu.getIcon()); |
| | | }); |
| | | } |
| | | |
| | | /** |
| | |
| | | package org.dromara.system.service.impl; |
| | | |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import org.dromara.common.core.utils.MapstructUtils; |
| | | import org.dromara.common.core.utils.ObjectUtils; |
| | | import org.dromara.common.core.utils.StringUtils; |
| | | import org.dromara.common.mybatis.core.page.PageQuery; |
| | | import org.dromara.common.mybatis.core.page.TableDataInfo; |
| | |
| | | lqw.eq(StringUtils.isNotBlank(bo.getNoticeType()), SysNotice::getNoticeType, bo.getNoticeType()); |
| | | if (StringUtils.isNotBlank(bo.getCreateByName())) { |
| | | SysUserVo sysUser = userMapper.selectVoOne(new LambdaQueryWrapper<SysUser>().eq(SysUser::getUserName, bo.getCreateByName())); |
| | | lqw.eq(SysNotice::getCreateBy, ObjectUtil.isNotNull(sysUser) ? sysUser.getUserId() : null); |
| | | lqw.eq(SysNotice::getCreateBy, ObjectUtils.notNullGetter(sysUser, SysUserVo::getUserId)); |
| | | } |
| | | lqw.orderByAsc(SysNotice::getNoticeId); |
| | | return lqw; |
| | |
| | | import cn.hutool.core.util.ArrayUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.dromara.common.core.utils.MapstructUtils; |
| | | import org.dromara.common.mybatis.core.page.PageQuery; |
| | | import org.dromara.common.mybatis.core.page.TableDataInfo; |
| | | import org.dromara.common.core.utils.StringUtils; |
| | | import org.dromara.common.core.utils.ip.AddressUtils; |
| | | import org.dromara.common.log.event.OperLogEvent; |
| | | import org.dromara.common.mybatis.core.page.PageQuery; |
| | | import org.dromara.common.mybatis.core.page.TableDataInfo; |
| | | import org.dromara.system.domain.SysOperLog; |
| | | import org.dromara.system.domain.bo.SysOperLogBo; |
| | | import org.dromara.system.domain.vo.SysOperLogVo; |
| | | import org.dromara.system.mapper.SysOperLogMapper; |
| | | import org.dromara.system.service.ISysOperLogService; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.context.event.EventListener; |
| | | import org.springframework.scheduling.annotation.Async; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | |
| | | @Override |
| | | public TableDataInfo<SysOperLogVo> selectPageOperLogList(SysOperLogBo operLog, PageQuery pageQuery) { |
| | | LambdaQueryWrapper<SysOperLog> lqw = buildQueryWrapper(operLog); |
| | | if (StringUtils.isBlank(pageQuery.getOrderByColumn())) { |
| | | lqw.orderByDesc(SysOperLog::getOperId); |
| | | } |
| | | Page<SysOperLogVo> page = baseMapper.selectVoPage(pageQuery.build(), lqw); |
| | | return TableDataInfo.build(page); |
| | | } |
| | | |
| | | private LambdaQueryWrapper<SysOperLog> buildQueryWrapper(SysOperLogBo operLog) { |
| | | Map<String, Object> params = operLog.getParams(); |
| | | LambdaQueryWrapper<SysOperLog> lqw = new LambdaQueryWrapper<SysOperLog>() |
| | | return new LambdaQueryWrapper<SysOperLog>() |
| | | .like(StringUtils.isNotBlank(operLog.getOperIp()), SysOperLog::getOperIp, operLog.getOperIp()) |
| | | .like(StringUtils.isNotBlank(operLog.getTitle()), SysOperLog::getTitle, operLog.getTitle()) |
| | | .eq(operLog.getBusinessType() != null && operLog.getBusinessType() > 0, |
| | |
| | | .like(StringUtils.isNotBlank(operLog.getOperName()), SysOperLog::getOperName, operLog.getOperName()) |
| | | .between(params.get("beginTime") != null && params.get("endTime") != null, |
| | | SysOperLog::getOperTime, params.get("beginTime"), params.get("endTime")); |
| | | if (StringUtils.isBlank(pageQuery.getOrderByColumn())) { |
| | | pageQuery.setOrderByColumn("oper_id"); |
| | | pageQuery.setIsAsc("desc"); |
| | | } |
| | | Page<SysOperLogVo> page = baseMapper.selectVoPage(pageQuery.build(), lqw); |
| | | return TableDataInfo.build(page); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Override |
| | | public List<SysOperLogVo> selectOperLogList(SysOperLogBo operLog) { |
| | | Map<String, Object> params = operLog.getParams(); |
| | | return baseMapper.selectVoList(new LambdaQueryWrapper<SysOperLog>() |
| | | .like(StringUtils.isNotBlank(operLog.getOperIp()), SysOperLog::getOperIp, operLog.getOperIp()) |
| | | .like(StringUtils.isNotBlank(operLog.getTitle()), SysOperLog::getTitle, operLog.getTitle()) |
| | | .eq(operLog.getBusinessType() != null && operLog.getBusinessType() > 0, |
| | | SysOperLog::getBusinessType, operLog.getBusinessType()) |
| | | .func(f -> { |
| | | if (ArrayUtil.isNotEmpty(operLog.getBusinessTypes())) { |
| | | f.in(SysOperLog::getBusinessType, Arrays.asList(operLog.getBusinessTypes())); |
| | | } |
| | | }) |
| | | .eq(operLog.getStatus() != null && operLog.getStatus() > 0, |
| | | SysOperLog::getStatus, operLog.getStatus()) |
| | | .like(StringUtils.isNotBlank(operLog.getOperName()), SysOperLog::getOperName, operLog.getOperName()) |
| | | .between(params.get("beginTime") != null && params.get("endTime") != null, |
| | | SysOperLog::getOperTime, params.get("beginTime"), params.get("endTime")) |
| | | .orderByDesc(SysOperLog::getOperId)); |
| | | LambdaQueryWrapper<SysOperLog> lqw = buildQueryWrapper(operLog); |
| | | return baseMapper.selectVoList(lqw.orderByDesc(SysOperLog::getOperId)); |
| | | } |
| | | |
| | | /** |
| | |
| | | import org.dromara.common.core.constant.CacheNames; |
| | | import org.dromara.common.core.exception.ServiceException; |
| | | import org.dromara.common.core.utils.MapstructUtils; |
| | | import org.dromara.common.core.utils.ObjectUtils; |
| | | import org.dromara.common.core.utils.StringUtils; |
| | | import org.dromara.common.json.utils.JsonUtils; |
| | | import org.dromara.common.mybatis.core.page.PageQuery; |
| | |
| | | * 夿configKeyæ¯å¦å¯ä¸ |
| | | */ |
| | | private boolean checkConfigKeyUnique(SysOssConfig sysOssConfig) { |
| | | long ossConfigId = ObjectUtil.isNull(sysOssConfig.getOssConfigId()) ? -1L : sysOssConfig.getOssConfigId(); |
| | | long ossConfigId = ObjectUtils.notNull(sysOssConfig.getOssConfigId(), -1L); |
| | | SysOssConfig info = baseMapper.selectOne(new LambdaQueryWrapper<SysOssConfig>() |
| | | .select(SysOssConfig::getOssConfigId, SysOssConfig::getConfigKey) |
| | | .eq(SysOssConfig::getConfigKey, sysOssConfig.getConfigKey())); |
| | |
| | | |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.time.Duration; |
| | | import java.util.ArrayList; |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | |
| | | FileUtils.setAttachmentResponseHeader(response, sysOss.getOriginalName()); |
| | | response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE + "; charset=UTF-8"); |
| | | OssClient storage = OssFactory.instance(sysOss.getService()); |
| | | long contentLength = storage.download(sysOss.getFileName(), response.getOutputStream()); |
| | | response.setContentLengthLong(contentLength); |
| | | storage.download(sysOss.getFileName(), response.getOutputStream(), response::setContentLengthLong); |
| | | } |
| | | |
| | | /** |
| | |
| | | OssClient storage = OssFactory.instance(); |
| | | UploadResult uploadResult; |
| | | try { |
| | | uploadResult = storage.uploadSuffix(file.getBytes(), suffix); |
| | | uploadResult = storage.uploadSuffix(file.getBytes(), suffix, file.getContentType()); |
| | | } catch (IOException e) { |
| | | throw new ServiceException(e.getMessage()); |
| | | } |
| | |
| | | if (isValid) { |
| | | // åä¸äºä¸å¡ä¸çæ ¡éª,夿æ¯å¦éè¦æ ¡éª |
| | | } |
| | | List<SysOss> list = baseMapper.selectBatchIds(ids); |
| | | List<SysOss> list = baseMapper.selectByIds(ids); |
| | | for (SysOss sysOss : list) { |
| | | OssClient storage = OssFactory.instance(sysOss.getService()); |
| | | storage.delete(sysOss.getUrl()); |
| | |
| | | OssClient storage = OssFactory.instance(oss.getService()); |
| | | // ä»
ä¿®æ¹æ¡¶ç±»å为 private çURLï¼ä¸´æ¶URLæ¶é¿ä¸º120s |
| | | if (AccessPolicyType.PRIVATE == storage.getAccessPolicy()) { |
| | | oss.setUrl(storage.getPrivateUrl(oss.getFileName(), 120)); |
| | | oss.setUrl(storage.getPrivateUrl(oss.getFileName(), Duration.ofSeconds(120))); |
| | | } |
| | | return oss; |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.dromara.common.core.constant.UserConstants; |
| | | import org.dromara.common.core.constant.SystemConstants; |
| | | import org.dromara.common.core.exception.ServiceException; |
| | | import org.dromara.common.core.service.PostService; |
| | | import org.dromara.common.core.utils.MapstructUtils; |
| | | import org.dromara.common.core.utils.StreamUtils; |
| | | import org.dromara.common.core.utils.StringUtils; |
| | | import org.dromara.common.mybatis.core.page.PageQuery; |
| | | import org.dromara.common.mybatis.core.page.TableDataInfo; |
| | | import org.dromara.common.mybatis.helper.DataBaseHelper; |
| | | import org.dromara.system.domain.SysDept; |
| | | import org.dromara.system.domain.SysPost; |
| | | import org.dromara.system.domain.SysUserPost; |
| | |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * å²ä½ä¿¡æ¯ æå¡å±å¤ç |
| | |
| | | */ |
| | | @RequiredArgsConstructor |
| | | @Service |
| | | public class SysPostServiceImpl implements ISysPostService { |
| | | public class SysPostServiceImpl implements ISysPostService, PostService { |
| | | |
| | | private final SysPostMapper baseMapper; |
| | | private final SysDeptMapper deptMapper; |
| | |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢ç¨æ·æå±å²ä½ç» |
| | | * |
| | | * @param userId ç¨æ·ID |
| | | * @return å²ä½ID |
| | | */ |
| | | @Override |
| | | public List<SysPostVo> selectPostsByUserId(Long userId) { |
| | | return baseMapper.selectPostsByUserId(userId); |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®æ¥è¯¢æ¡ä»¶æå»ºæ¥è¯¢å
è£
å¨ |
| | | * |
| | | * @param bo æ¥è¯¢æ¡ä»¶å¯¹è±¡ |
| | |
| | | } else if (ObjectUtil.isNotNull(bo.getBelongDeptId())) { |
| | | //é¨é¨æ æç´¢ |
| | | wrapper.and(x -> { |
| | | List<Long> deptIds = deptMapper.selectList(new LambdaQueryWrapper<SysDept>() |
| | | .select(SysDept::getDeptId) |
| | | .apply(DataBaseHelper.findInSet(bo.getBelongDeptId(), "ancestors"))) |
| | | .stream() |
| | | .map(SysDept::getDeptId) |
| | | .collect(Collectors.toList()); |
| | | List<SysDept> deptList = deptMapper.selectListByParentId(bo.getBelongDeptId()); |
| | | List<Long> deptIds = StreamUtils.toList(deptList, SysDept::getDeptId); |
| | | deptIds.add(bo.getBelongDeptId()); |
| | | x.in(SysPost::getDeptId, deptIds); |
| | | }); |
| | |
| | | public List<SysPostVo> selectPostByIds(List<Long> postIds) { |
| | | return baseMapper.selectVoList(new LambdaQueryWrapper<SysPost>() |
| | | .select(SysPost::getPostId, SysPost::getPostName, SysPost::getPostCode) |
| | | .eq(SysPost::getStatus, UserConstants.POST_NORMAL) |
| | | .eq(SysPost::getStatus, SystemConstants.NORMAL) |
| | | .in(CollUtil.isNotEmpty(postIds), SysPost::getPostId, postIds)); |
| | | } |
| | | |
| | |
| | | SysPost post = MapstructUtils.convert(bo, SysPost.class); |
| | | return baseMapper.updateById(post); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.dromara.common.core.constant.CacheNames; |
| | | import org.dromara.common.core.constant.SystemConstants; |
| | | import org.dromara.common.core.constant.TenantConstants; |
| | | import org.dromara.common.core.constant.UserConstants; |
| | | import org.dromara.common.core.domain.model.LoginUser; |
| | | import org.dromara.common.core.exception.ServiceException; |
| | | import org.dromara.common.core.service.RoleService; |
| | | import org.dromara.common.core.utils.MapstructUtils; |
| | | import org.dromara.common.core.utils.StreamUtils; |
| | | import org.dromara.common.core.utils.StringUtils; |
| | |
| | | import org.dromara.system.mapper.SysRoleMenuMapper; |
| | | import org.dromara.system.mapper.SysUserRoleMapper; |
| | | import org.dromara.system.service.ISysRoleService; |
| | | import org.springframework.cache.annotation.CacheEvict; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | |
| | | */ |
| | | @RequiredArgsConstructor |
| | | @Service |
| | | public class SysRoleServiceImpl implements ISysRoleService { |
| | | public class SysRoleServiceImpl implements ISysRoleService, RoleService { |
| | | |
| | | private final SysRoleMapper baseMapper; |
| | | private final SysRoleMenuMapper roleMenuMapper; |
| | |
| | | private Wrapper<SysRole> buildQueryWrapper(SysRoleBo bo) { |
| | | Map<String, Object> params = bo.getParams(); |
| | | QueryWrapper<SysRole> wrapper = Wrappers.query(); |
| | | wrapper.eq("r.del_flag", UserConstants.ROLE_NORMAL) |
| | | wrapper.eq("r.del_flag", SystemConstants.NORMAL) |
| | | .eq(ObjectUtil.isNotNull(bo.getRoleId()), "r.role_id", bo.getRoleId()) |
| | | .like(StringUtils.isNotBlank(bo.getRoleName()), "r.role_name", bo.getRoleName()) |
| | | .eq(StringUtils.isNotBlank(bo.getStatus()), "r.status", bo.getStatus()) |
| | |
| | | @Override |
| | | public List<SysRoleVo> selectRoleByIds(List<Long> roleIds) { |
| | | return baseMapper.selectRoleList(new QueryWrapper<SysRole>() |
| | | .eq("r.status", UserConstants.ROLE_NORMAL) |
| | | .eq("r.status", SystemConstants.NORMAL) |
| | | .in(CollUtil.isNotEmpty(roleIds), "r.role_id", roleIds)); |
| | | } |
| | | |
| | |
| | | public int updateRole(SysRoleBo bo) { |
| | | SysRole role = MapstructUtils.convert(bo, SysRole.class); |
| | | |
| | | if (UserConstants.ROLE_DISABLE.equals(role.getStatus()) && this.countUserRoleByRoleId(role.getRoleId()) > 0) { |
| | | if (SystemConstants.DISABLE.equals(role.getStatus()) && this.countUserRoleByRoleId(role.getRoleId()) > 0) { |
| | | throw new ServiceException("è§è²å·²åé
ï¼ä¸è½ç¦ç¨!"); |
| | | } |
| | | // ä¿®æ¹è§è²ä¿¡æ¯ |
| | |
| | | */ |
| | | @Override |
| | | public int updateRoleStatus(Long roleId, String status) { |
| | | if (UserConstants.ROLE_DISABLE.equals(status) && this.countUserRoleByRoleId(roleId) > 0) { |
| | | if (SystemConstants.DISABLE.equals(status) && this.countUserRoleByRoleId(roleId) > 0) { |
| | | throw new ServiceException("è§è²å·²åé
ï¼ä¸è½ç¦ç¨!"); |
| | | } |
| | | return baseMapper.update(null, |
| | |
| | | * @param bo è§è²ä¿¡æ¯ |
| | | * @return ç»æ |
| | | */ |
| | | @CacheEvict(cacheNames = CacheNames.SYS_ROLE_CUSTOM, key = "#bo.roleId") |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int authDataScope(SysRoleBo bo) { |
| | |
| | | private int insertRoleMenu(SysRoleBo role) { |
| | | int rows = 1; |
| | | // æ°å¢ç¨æ·ä¸è§è²ç®¡ç |
| | | List<SysRoleMenu> list = new ArrayList<SysRoleMenu>(); |
| | | List<SysRoleMenu> list = new ArrayList<>(); |
| | | for (Long menuId : role.getMenuIds()) { |
| | | SysRoleMenu rm = new SysRoleMenu(); |
| | | rm.setRoleId(role.getRoleId()); |
| | |
| | | private int insertRoleDept(SysRoleBo role) { |
| | | int rows = 1; |
| | | // æ°å¢è§è²ä¸é¨é¨ï¼æ°æ®æéï¼ç®¡ç |
| | | List<SysRoleDept> list = new ArrayList<SysRoleDept>(); |
| | | List<SysRoleDept> list = new ArrayList<>(); |
| | | for (Long deptId : role.getDeptIds()) { |
| | | SysRoleDept rd = new SysRoleDept(); |
| | | rd.setRoleId(role.getRoleId()); |
| | |
| | | * @param roleId è§è²ID |
| | | * @return ç»æ |
| | | */ |
| | | @CacheEvict(cacheNames = CacheNames.SYS_ROLE_CUSTOM, key = "#roleId") |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int deleteRoleById(Long roleId) { |
| | |
| | | * @param roleIds éè¦å é¤çè§è²ID |
| | | * @return ç»æ |
| | | */ |
| | | @CacheEvict(cacheNames = CacheNames.SYS_ROLE_CUSTOM, allEntries = true) |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int deleteRoleByIds(Long[] roleIds) { |
| | |
| | | .eq(SysUserRole::getRoleId, userRole.getRoleId()) |
| | | .eq(SysUserRole::getUserId, userRole.getUserId())); |
| | | if (rows > 0) { |
| | | cleanOnlineUserByRole(userRole.getRoleId()); |
| | | cleanOnlineUser(List.of(userRole.getUserId())); |
| | | } |
| | | return rows; |
| | | } |
| | |
| | | */ |
| | | @Override |
| | | public int deleteAuthUsers(Long roleId, Long[] userIds) { |
| | | List<Long> ids = List.of(userIds); |
| | | int rows = userRoleMapper.delete(new LambdaQueryWrapper<SysUserRole>() |
| | | .eq(SysUserRole::getRoleId, roleId) |
| | | .in(SysUserRole::getUserId, Arrays.asList(userIds))); |
| | | .in(SysUserRole::getUserId, ids)); |
| | | if (rows > 0) { |
| | | cleanOnlineUserByRole(roleId); |
| | | cleanOnlineUser(ids); |
| | | } |
| | | return rows; |
| | | } |
| | |
| | | public int insertAuthUsers(Long roleId, Long[] userIds) { |
| | | // æ°å¢ç¨æ·ä¸è§è²ç®¡ç |
| | | int rows = 1; |
| | | List<SysUserRole> list = StreamUtils.toList(List.of(userIds), userId -> { |
| | | List<Long> ids = List.of(userIds); |
| | | List<SysUserRole> list = StreamUtils.toList(ids, userId -> { |
| | | SysUserRole ur = new SysUserRole(); |
| | | ur.setUserId(userId); |
| | | ur.setRoleId(roleId); |
| | |
| | | rows = userRoleMapper.insertBatch(list) ? list.size() : 0; |
| | | } |
| | | if (rows > 0) { |
| | | cleanOnlineUserByRole(roleId); |
| | | cleanOnlineUser(ids); |
| | | } |
| | | return rows; |
| | | } |
| | |
| | | return; |
| | | } |
| | | LoginUser loginUser = LoginHelper.getLoginUser(token); |
| | | if (ObjectUtil.isNull(loginUser) || CollUtil.isEmpty(loginUser.getRoles())) { |
| | | return; |
| | | } |
| | | if (loginUser.getRoles().stream().anyMatch(r -> r.getRoleId().equals(roleId))) { |
| | | try { |
| | | StpUtil.logoutByTokenValue(token); |
| | |
| | | } |
| | | }); |
| | | } |
| | | |
| | | @Override |
| | | public void cleanOnlineUser(List<Long> userIds) { |
| | | List<String> keys = StpUtil.searchTokenValue("", 0, -1, false); |
| | | if (CollUtil.isEmpty(keys)) { |
| | | return; |
| | | } |
| | | // è§è²å
³èçå¨çº¿ç¨æ·éè¿å¤§ä¼å¯¼è´redisé»å¡å¡é¡¿ è°¨æ
æä½ |
| | | keys.parallelStream().forEach(key -> { |
| | | String token = StringUtils.substringAfterLast(key, ":"); |
| | | // 妿已ç»è¿æåè·³è¿ |
| | | if (StpUtil.stpLogic.getTokenActiveTimeoutByToken(token) < -1) { |
| | | return; |
| | | } |
| | | LoginUser loginUser = LoginHelper.getLoginUser(token); |
| | | if (ObjectUtil.isNull(loginUser)) { |
| | | return; |
| | | } |
| | | if (userIds.contains(loginUser.getUserId())) { |
| | | try { |
| | | StpUtil.logoutByTokenValue(token); |
| | | } catch (NotLoginException ignored) { |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | |
| | | } |
| | |
| | | package org.dromara.system.service.impl; |
| | | |
| | | import cn.dev33.satoken.stp.StpUtil; |
| | | import org.dromara.common.core.utils.StringUtils; |
| | | import cn.hutool.core.util.ArrayUtil; |
| | | import org.dromara.common.satoken.utils.LoginHelper; |
| | | import org.dromara.common.sensitive.core.SensitiveService; |
| | | import org.dromara.common.tenant.helper.TenantHelper; |
| | |
| | | * æ¯å¦è±æ |
| | | */ |
| | | @Override |
| | | public boolean isSensitive(String roleKey, String perms) { |
| | | public boolean isSensitive(String[] roleKey, String[] perms) { |
| | | if (!LoginHelper.isLogin()) { |
| | | return true; |
| | | } |
| | | boolean roleExist = StringUtils.isNotBlank(roleKey); |
| | | boolean permsExist = StringUtils.isNotBlank(perms); |
| | | boolean roleExist = ArrayUtil.isNotEmpty(roleKey); |
| | | boolean permsExist = ArrayUtil.isNotEmpty(perms); |
| | | if (roleExist && permsExist) { |
| | | if (StpUtil.hasRole(roleKey) && StpUtil.hasPermission(perms)) { |
| | | if (StpUtil.hasRoleOr(roleKey) && StpUtil.hasPermissionOr(perms)) { |
| | | return false; |
| | | } |
| | | } else if (roleExist && StpUtil.hasRole(roleKey)) { |
| | | } else if (roleExist && StpUtil.hasRoleOr(roleKey)) { |
| | | return false; |
| | | } else if (permsExist && StpUtil.hasPermission(perms)) { |
| | | } else if (permsExist && StpUtil.hasPermissionOr(perms)) { |
| | | return false; |
| | | } |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.dromara.common.core.constant.SystemConstants; |
| | | import org.dromara.common.core.domain.dto.TaskAssigneeDTO; |
| | | import org.dromara.common.core.domain.model.TaskAssigneeBody; |
| | | import org.dromara.common.core.service.TaskAssigneeService; |
| | | import org.dromara.common.core.utils.StreamUtils; |
| | | import org.dromara.common.core.utils.StringUtils; |
| | | import org.dromara.common.mybatis.core.page.PageQuery; |
| | | import org.dromara.system.domain.SysDept; |
| | | import org.dromara.system.domain.SysPost; |
| | | import org.dromara.system.domain.SysRole; |
| | | import org.dromara.system.domain.SysUser; |
| | | import org.dromara.system.domain.vo.SysDeptVo; |
| | | import org.dromara.system.domain.vo.SysPostVo; |
| | | import org.dromara.system.domain.vo.SysRoleVo; |
| | | import org.dromara.system.domain.vo.SysUserVo; |
| | | import org.dromara.system.mapper.SysDeptMapper; |
| | | import org.dromara.system.mapper.SysPostMapper; |
| | | import org.dromara.system.mapper.SysRoleMapper; |
| | | import org.dromara.system.mapper.SysUserMapper; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 工使µè®¾è®¡å¨è·å任塿§è¡äºº |
| | | * |
| | | * @author Lion Li |
| | | */ |
| | | @RequiredArgsConstructor |
| | | @Service |
| | | public class SysTaskAssigneeServiceImpl implements TaskAssigneeService { |
| | | |
| | | private final SysPostMapper postMapper; |
| | | private final SysDeptMapper deptMapper; |
| | | private final SysUserMapper userMapper; |
| | | private final SysRoleMapper roleMapper; |
| | | |
| | | /** |
| | | * æ¥è¯¢è§è²å¹¶è¿åä»»å¡ææ´¾çåè¡¨ï¼æ¯æå页 |
| | | * |
| | | * @param taskQuery æ¥è¯¢æ¡ä»¶ |
| | | * @return åç人 |
| | | */ |
| | | @Override |
| | | public TaskAssigneeDTO selectRolesByTaskAssigneeList(TaskAssigneeBody taskQuery) { |
| | | PageQuery pageQuery = new PageQuery(taskQuery.getPageSize(), taskQuery.getPageNum()); |
| | | QueryWrapper<SysRole> wrapper = Wrappers.query(); |
| | | wrapper.eq("r.del_flag", SystemConstants.NORMAL) |
| | | .like(StringUtils.isNotBlank(taskQuery.getHandlerCode()), "r.role_name", taskQuery.getHandlerCode()) |
| | | .like(StringUtils.isNotBlank(taskQuery.getHandlerName()), "r.role_key", taskQuery.getHandlerName()) |
| | | .between(StringUtils.isNotBlank(taskQuery.getBeginTime()) && StringUtils.isNotBlank(taskQuery.getEndTime()), |
| | | "r.create_time", taskQuery.getBeginTime(), taskQuery.getEndTime()) |
| | | .orderByAsc("r.role_sort").orderByAsc("r.create_time"); |
| | | Page<SysRoleVo> page = roleMapper.selectPageRoleList(pageQuery.build(), wrapper); |
| | | // 使ç¨å°è£
çåæ®µæ å°æ¹æ³è¿è¡è½¬æ¢ |
| | | List<TaskAssigneeDTO.TaskHandler> handlers = TaskAssigneeDTO.convertToHandlerList(page.getRecords(), |
| | | SysRoleVo::getRoleId, SysRoleVo::getRoleKey, SysRoleVo::getRoleName, null, SysRoleVo::getCreateTime); |
| | | return new TaskAssigneeDTO(page.getTotal(), handlers); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢å²ä½å¹¶è¿åä»»å¡ææ´¾çåè¡¨ï¼æ¯æå页 |
| | | * |
| | | * @param taskQuery æ¥è¯¢æ¡ä»¶ |
| | | * @return åç人 |
| | | */ |
| | | @Override |
| | | public TaskAssigneeDTO selectPostsByTaskAssigneeList(TaskAssigneeBody taskQuery) { |
| | | PageQuery pageQuery = new PageQuery(taskQuery.getPageSize(), taskQuery.getPageNum()); |
| | | LambdaQueryWrapper<SysPost> wrapper = Wrappers.<SysPost>lambdaQuery() |
| | | .like(StringUtils.isNotBlank(taskQuery.getHandlerCode()), SysPost::getPostCategory, taskQuery.getHandlerCode()) |
| | | .like(StringUtils.isNotBlank(taskQuery.getHandlerName()), SysPost::getPostName, taskQuery.getHandlerName()) |
| | | .between(StringUtils.isNotBlank(taskQuery.getBeginTime()) && StringUtils.isNotBlank(taskQuery.getEndTime()), |
| | | SysPost::getCreateTime, taskQuery.getBeginTime(), taskQuery.getEndTime()); |
| | | if (StringUtils.isNotBlank(taskQuery.getGroupId())) { |
| | | Long belongDeptId = Long.valueOf(taskQuery.getGroupId()); |
| | | wrapper.and(x -> { |
| | | List<SysDept> deptList = deptMapper.selectListByParentId(belongDeptId); |
| | | List<Long> deptIds = StreamUtils.toList(deptList, SysDept::getDeptId); |
| | | deptIds.add(belongDeptId); |
| | | x.in(SysPost::getDeptId, deptIds); |
| | | }); |
| | | } |
| | | Page<SysPostVo> page = postMapper.selectPagePostList(pageQuery.build(), wrapper); |
| | | // 使ç¨å°è£
çåæ®µæ å°æ¹æ³è¿è¡è½¬æ¢ |
| | | List<TaskAssigneeDTO.TaskHandler> handlers = TaskAssigneeDTO.convertToHandlerList(page.getRecords(), |
| | | SysPostVo::getPostId, SysPostVo::getPostCategory, SysPostVo::getPostName, SysPostVo::getDeptId, SysPostVo::getCreateTime); |
| | | return new TaskAssigneeDTO(page.getTotal(), handlers); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢é¨é¨å¹¶è¿åä»»å¡ææ´¾çåè¡¨ï¼æ¯æå页 |
| | | * |
| | | * @param taskQuery æ¥è¯¢æ¡ä»¶ |
| | | * @return åç人 |
| | | */ |
| | | @Override |
| | | public TaskAssigneeDTO selectDeptsByTaskAssigneeList(TaskAssigneeBody taskQuery) { |
| | | PageQuery pageQuery = new PageQuery(taskQuery.getPageSize(), taskQuery.getPageNum()); |
| | | LambdaQueryWrapper<SysDept> wrapper = Wrappers.<SysDept>lambdaQuery() |
| | | .eq(SysDept::getDelFlag, SystemConstants.NORMAL) |
| | | .like(StringUtils.isNotBlank(taskQuery.getHandlerCode()), SysDept::getDeptCategory, taskQuery.getHandlerCode()) |
| | | .like(StringUtils.isNotBlank(taskQuery.getHandlerName()), SysDept::getDeptName, taskQuery.getHandlerName()) |
| | | .between(StringUtils.isNotBlank(taskQuery.getBeginTime()) && StringUtils.isNotBlank(taskQuery.getEndTime()), |
| | | SysDept::getCreateTime, taskQuery.getBeginTime(), taskQuery.getEndTime()) |
| | | .orderByAsc(SysDept::getAncestors) |
| | | .orderByAsc(SysDept::getParentId) |
| | | .orderByAsc(SysDept::getOrderNum) |
| | | .orderByAsc(SysDept::getDeptId); |
| | | if (StringUtils.isNotBlank(taskQuery.getGroupId())) { |
| | | //é¨é¨æ æç´¢ |
| | | wrapper.and(x -> { |
| | | Long parentId = Long.valueOf(taskQuery.getGroupId()); |
| | | List<SysDept> deptList = deptMapper.selectListByParentId(parentId); |
| | | List<Long> deptIds = StreamUtils.toList(deptList, SysDept::getDeptId); |
| | | deptIds.add(parentId); |
| | | x.in(SysDept::getDeptId, deptIds); |
| | | }); |
| | | } |
| | | Page<SysDeptVo> page = deptMapper.selectPageDeptList(pageQuery.build(), wrapper); |
| | | // 使ç¨å°è£
çåæ®µæ å°æ¹æ³è¿è¡è½¬æ¢ |
| | | List<TaskAssigneeDTO.TaskHandler> handlers = TaskAssigneeDTO.convertToHandlerList(page.getRecords(), |
| | | SysDeptVo::getDeptId, SysDeptVo::getDeptCategory, SysDeptVo::getDeptName, SysDeptVo::getParentId, SysDeptVo::getCreateTime); |
| | | return new TaskAssigneeDTO(page.getTotal(), handlers); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * æ¥è¯¢ç¨æ·å¹¶è¿åä»»å¡ææ´¾çåè¡¨ï¼æ¯æå页 |
| | | * |
| | | * @param taskQuery æ¥è¯¢æ¡ä»¶ |
| | | * @return åç人 |
| | | */ |
| | | @Override |
| | | public TaskAssigneeDTO selectUsersByTaskAssigneeList(TaskAssigneeBody taskQuery) { |
| | | PageQuery pageQuery = new PageQuery(taskQuery.getPageSize(), taskQuery.getPageNum()); |
| | | QueryWrapper<SysUser> wrapper = Wrappers.query(); |
| | | wrapper.eq("u.del_flag", SystemConstants.NORMAL) |
| | | .like(StringUtils.isNotBlank(taskQuery.getHandlerCode()), "u.user_name", taskQuery.getHandlerCode()) |
| | | .like(StringUtils.isNotBlank(taskQuery.getHandlerName()), "u.nick_name", taskQuery.getHandlerName()) |
| | | .between(taskQuery.getBeginTime() != null && taskQuery.getEndTime() != null, |
| | | "u.create_time", taskQuery.getBeginTime(), taskQuery.getEndTime()) |
| | | .orderByAsc("u.user_id"); |
| | | if (StringUtils.isNotBlank(taskQuery.getGroupId())) { |
| | | //é¨é¨æ æç´¢ |
| | | wrapper.and(x -> { |
| | | Long parentId = Long.valueOf(taskQuery.getGroupId()); |
| | | List<SysDept> deptList = deptMapper.selectListByParentId(parentId); |
| | | List<Long> deptIds = StreamUtils.toList(deptList, SysDept::getDeptId); |
| | | deptIds.add(parentId); |
| | | x.in("u.dept_id", deptIds); |
| | | }); |
| | | } |
| | | Page<SysUserVo> page = userMapper.selectPageUserList(pageQuery.build(), wrapper); |
| | | // 使ç¨å°è£
çåæ®µæ å°æ¹æ³è¿è¡è½¬æ¢ |
| | | List<TaskAssigneeDTO.TaskHandler> handlers = TaskAssigneeDTO.convertToHandlerList(page.getRecords(), |
| | | SysUserVo::getUserId, SysUserVo::getUserName, SysUserVo::getNickName, SysUserVo::getDeptId, SysUserVo::getCreateTime); |
| | | return new TaskAssigneeDTO(page.getTotal(), handlers); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.dromara.common.core.constant.TenantConstants; |
| | | import org.dromara.common.core.constant.SystemConstants; |
| | | import org.dromara.common.core.exception.ServiceException; |
| | | import org.dromara.common.core.utils.MapstructUtils; |
| | | import org.dromara.common.core.utils.StringUtils; |
| | |
| | | @Override |
| | | public List<SysTenantPackageVo> selectList() { |
| | | return baseMapper.selectVoList(new LambdaQueryWrapper<SysTenantPackage>() |
| | | .eq(SysTenantPackage::getStatus, TenantConstants.NORMAL)); |
| | | .eq(SysTenantPackage::getStatus, SystemConstants.NORMAL)); |
| | | } |
| | | |
| | | /** |
| | |
| | | package org.dromara.system.service.impl; |
| | | |
| | | import cn.dev33.satoken.secure.BCrypt; |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.convert.Convert; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import cn.hutool.core.util.RandomUtil; |
| | |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.dromara.common.core.constant.CacheNames; |
| | | import org.dromara.common.core.constant.Constants; |
| | | import org.dromara.common.core.constant.SystemConstants; |
| | | import org.dromara.common.core.constant.TenantConstants; |
| | | import org.dromara.common.core.exception.ServiceException; |
| | | import org.dromara.common.core.service.WorkflowService; |
| | | import org.dromara.common.core.utils.MapstructUtils; |
| | | import org.dromara.common.core.utils.SpringUtils; |
| | | import org.dromara.common.core.utils.StreamUtils; |
| | | import org.dromara.common.core.utils.StringUtils; |
| | | import org.dromara.common.mybatis.core.page.PageQuery; |
| | | import org.dromara.common.mybatis.core.page.TableDataInfo; |
| | | import org.dromara.common.redis.utils.CacheUtils; |
| | | import org.dromara.common.tenant.core.TenantEntity; |
| | | import org.dromara.common.tenant.helper.TenantHelper; |
| | | import org.dromara.system.domain.*; |
| | | import org.dromara.system.domain.bo.SysTenantBo; |
| | | import org.dromara.system.domain.vo.SysTenantVo; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Collection; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * ç§æ·Serviceä¸å¡å±å¤ç |
| | |
| | | |
| | | // è·åææç§æ·ç¼å· |
| | | List<String> tenantIds = baseMapper.selectObjs( |
| | | new LambdaQueryWrapper<SysTenant>().select(SysTenant::getTenantId), x -> {return Convert.toStr(x);}); |
| | | new LambdaQueryWrapper<SysTenant>().select(SysTenant::getTenantId), x -> { |
| | | return Convert.toStr(x); |
| | | }); |
| | | String tenantId = generateTenantId(tenantIds); |
| | | add.setTenantId(tenantId); |
| | | boolean flag = baseMapper.insert(add) > 0; |
| | |
| | | config.setTenantId(tenantId); |
| | | } |
| | | configMapper.insertBatch(sysConfigList); |
| | | |
| | | // æªå¼å¯å·¥ä½æµä¸æ§è¡ä¸æ¹æä½ |
| | | if (SpringUtils.getProperty("warm-flow.enabled", Boolean.class, false)) { |
| | | WorkflowService workflowService = SpringUtils.getBean(WorkflowService.class); |
| | | // æ°å¢ç§æ·æµç¨å®ä¹ |
| | | workflowService.syncDef(tenantId); |
| | | } |
| | | return true; |
| | | } |
| | | |
| | |
| | | String numbers = RandomUtil.randomNumbers(6); |
| | | // 夿æ¯å¦åå¨ï¼å¦æåå¨åéæ°çæ |
| | | if (tenantIds.contains(numbers)) { |
| | | generateTenantId(tenantIds); |
| | | return generateTenantId(tenantIds); |
| | | } |
| | | return numbers; |
| | | } |
| | |
| | | role.setRoleName(TenantConstants.TENANT_ADMIN_ROLE_NAME); |
| | | role.setRoleKey(TenantConstants.TENANT_ADMIN_ROLE_KEY); |
| | | role.setRoleSort(1); |
| | | role.setStatus(TenantConstants.NORMAL); |
| | | role.setStatus(SystemConstants.NORMAL); |
| | | roleMapper.insert(role); |
| | | Long roleId = role.getRoleId(); |
| | | |
| | |
| | | @CacheEvict(cacheNames = CacheNames.SYS_TENANT, key = "#bo.tenantId") |
| | | @Override |
| | | public int updateTenantStatus(SysTenantBo bo) { |
| | | SysTenant tenant = MapstructUtils.convert(bo, SysTenant.class); |
| | | SysTenant tenant = new SysTenant(); |
| | | tenant.setId(bo.getId()); |
| | | tenant.setStatus(bo.getStatus()); |
| | | return baseMapper.updateById(tenant); |
| | | } |
| | | |
| | |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * åæ¥ç§æ·åå
¸ |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Override |
| | | public void syncTenantDict() { |
| | | // æ¥è¯¢è¶
管 ææåå
¸æ°æ® |
| | | List<SysDictType> dictTypeList = new ArrayList<>(); |
| | | List<SysDictData> dictDataList = new ArrayList<>(); |
| | | TenantHelper.ignore(() -> { |
| | | dictTypeList.addAll(dictTypeMapper.selectList()); |
| | | dictDataList.addAll(dictDataMapper.selectList()); |
| | | }); |
| | | Map<String, List<SysDictType>> typeMap = StreamUtils.groupByKey(dictTypeList, TenantEntity::getTenantId); |
| | | Map<String, Map<String, List<SysDictData>>> typeDataMap = StreamUtils.groupBy2Key( |
| | | dictDataList, TenantEntity::getTenantId, SysDictData::getDictType); |
| | | // 管çç§æ·åå
¸æ°æ® |
| | | List<SysDictType> defaultTypeMap = typeMap.get(TenantConstants.DEFAULT_TENANT_ID); |
| | | Map<String, List<SysDictData>> defaultTypeDataMap = typeDataMap.get(TenantConstants.DEFAULT_TENANT_ID); |
| | | |
| | | // è·åææç§æ·ç¼å· |
| | | List<String> tenantIds = baseMapper.selectObjs( |
| | | new LambdaQueryWrapper<SysTenant>().select(SysTenant::getTenantId) |
| | | .eq(SysTenant::getStatus, SystemConstants.NORMAL), x -> { |
| | | return Convert.toStr(x); |
| | | }); |
| | | List<SysDictType> saveTypeList = new ArrayList<>(); |
| | | List<SysDictData> saveDataList = new ArrayList<>(); |
| | | Set<String> set = new HashSet<>(); |
| | | for (String tenantId : tenantIds) { |
| | | if (TenantConstants.DEFAULT_TENANT_ID.equals(tenantId)) { |
| | | continue; |
| | | } |
| | | for (SysDictType dictType : defaultTypeMap) { |
| | | List<String> typeList = StreamUtils.toList(typeMap.get(tenantId), SysDictType::getDictType); |
| | | List<SysDictData> dataList = defaultTypeDataMap.get(dictType.getDictType()); |
| | | if (typeList.contains(dictType.getDictType())) { |
| | | List<SysDictData> dataListTenant = typeDataMap.get(tenantId).get(dictType.getDictType()); |
| | | Map<String, SysDictData> map = StreamUtils.toIdentityMap(dataListTenant, SysDictData::getDictValue); |
| | | for (SysDictData dictData : dataList) { |
| | | if (!map.containsKey(dictData.getDictValue())) { |
| | | SysDictData data = BeanUtil.toBean(dictData, SysDictData.class); |
| | | // 设置åå
¸ç¼ç 为 null |
| | | data.setDictCode(null); |
| | | data.setTenantId(tenantId); |
| | | data.setCreateTime(null); |
| | | data.setUpdateTime(null); |
| | | set.add(tenantId); |
| | | saveDataList.add(data); |
| | | } |
| | | } |
| | | } else { |
| | | SysDictType type = BeanUtil.toBean(dictType, SysDictType.class); |
| | | type.setDictId(null); |
| | | type.setTenantId(tenantId); |
| | | type.setCreateTime(null); |
| | | type.setUpdateTime(null); |
| | | set.add(tenantId); |
| | | saveTypeList.add(type); |
| | | if (CollUtil.isNotEmpty(dataList)) { |
| | | // çéåº dictType 对åºç data |
| | | for (SysDictData dictData : dataList) { |
| | | SysDictData data = BeanUtil.toBean(dictData, SysDictData.class); |
| | | // 设置åå
¸ç¼ç 为 null |
| | | data.setDictCode(null); |
| | | data.setTenantId(tenantId); |
| | | data.setCreateTime(null); |
| | | data.setUpdateTime(null); |
| | | set.add(tenantId); |
| | | saveDataList.add(data); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | TenantHelper.ignore(() -> { |
| | | if (CollUtil.isNotEmpty(saveTypeList)) { |
| | | dictTypeMapper.insertBatch(saveTypeList); |
| | | } |
| | | if (CollUtil.isNotEmpty(saveDataList)) { |
| | | dictDataMapper.insertBatch(saveDataList); |
| | | } |
| | | }); |
| | | for (String tenantId : set) { |
| | | TenantHelper.dynamic(tenantId, () -> CacheUtils.clear(CacheNames.SYS_DICT)); |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.dromara.common.core.constant.CacheNames; |
| | | import org.dromara.common.core.constant.UserConstants; |
| | | import org.dromara.common.core.constant.SystemConstants; |
| | | import org.dromara.common.core.domain.dto.UserDTO; |
| | | import org.dromara.common.core.exception.ServiceException; |
| | | import org.dromara.common.core.service.UserService; |
| | | import org.dromara.common.core.utils.MapstructUtils; |
| | | import org.dromara.common.core.utils.SpringUtils; |
| | | import org.dromara.common.core.utils.StreamUtils; |
| | | import org.dromara.common.core.utils.StringUtils; |
| | | import org.dromara.common.core.utils.*; |
| | | import org.dromara.common.mybatis.core.page.PageQuery; |
| | | import org.dromara.common.mybatis.core.page.TableDataInfo; |
| | | import org.dromara.common.mybatis.helper.DataBaseHelper; |
| | | import org.dromara.common.satoken.utils.LoginHelper; |
| | | import org.dromara.system.domain.*; |
| | | import org.dromara.system.domain.bo.SysUserBo; |
| | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | |
| | | /** |
| | | * ç¨æ· ä¸å¡å±å¤ç |
| | |
| | | private Wrapper<SysUser> buildQueryWrapper(SysUserBo user) { |
| | | Map<String, Object> params = user.getParams(); |
| | | QueryWrapper<SysUser> wrapper = Wrappers.query(); |
| | | wrapper.eq("u.del_flag", UserConstants.USER_NORMAL) |
| | | wrapper.eq("u.del_flag", SystemConstants.NORMAL) |
| | | .eq(ObjectUtil.isNotNull(user.getUserId()), "u.user_id", user.getUserId()) |
| | | .like(StringUtils.isNotBlank(user.getUserName()), "u.user_name", user.getUserName()) |
| | | .eq(StringUtils.isNotBlank(user.getStatus()), "u.status", user.getStatus()) |
| | |
| | | .between(params.get("beginTime") != null && params.get("endTime") != null, |
| | | "u.create_time", params.get("beginTime"), params.get("endTime")) |
| | | .and(ObjectUtil.isNotNull(user.getDeptId()), w -> { |
| | | List<SysDept> deptList = deptMapper.selectList(new LambdaQueryWrapper<SysDept>() |
| | | .select(SysDept::getDeptId) |
| | | .apply(DataBaseHelper.findInSet(user.getDeptId(), "ancestors"))); |
| | | List<SysDept> deptList = deptMapper.selectListByParentId(user.getDeptId()); |
| | | List<Long> ids = StreamUtils.toList(deptList, SysDept::getDeptId); |
| | | ids.add(user.getDeptId()); |
| | | w.in("u.dept_id", ids); |
| | |
| | | @Override |
| | | public TableDataInfo<SysUserVo> selectAllocatedList(SysUserBo user, PageQuery pageQuery) { |
| | | QueryWrapper<SysUser> wrapper = Wrappers.query(); |
| | | wrapper.eq("u.del_flag", UserConstants.USER_NORMAL) |
| | | wrapper.eq("u.del_flag", SystemConstants.NORMAL) |
| | | .eq(ObjectUtil.isNotNull(user.getRoleId()), "r.role_id", user.getRoleId()) |
| | | .like(StringUtils.isNotBlank(user.getUserName()), "u.user_name", user.getUserName()) |
| | | .eq(StringUtils.isNotBlank(user.getStatus()), "u.status", user.getStatus()) |
| | |
| | | public TableDataInfo<SysUserVo> selectUnallocatedList(SysUserBo user, PageQuery pageQuery) { |
| | | List<Long> userIds = userRoleMapper.selectUserIdsByRoleId(user.getRoleId()); |
| | | QueryWrapper<SysUser> wrapper = Wrappers.query(); |
| | | wrapper.eq("u.del_flag", UserConstants.USER_NORMAL) |
| | | wrapper.eq("u.del_flag", SystemConstants.NORMAL) |
| | | .and(w -> w.ne("r.role_id", user.getRoleId()).or().isNull("r.role_id")) |
| | | .notIn(CollUtil.isNotEmpty(userIds), "u.user_id", userIds) |
| | | .like(StringUtils.isNotBlank(user.getUserName()), "u.user_name", user.getUserName()) |
| | |
| | | public List<SysUserVo> selectUserByIds(List<Long> userIds, Long deptId) { |
| | | return baseMapper.selectUserList(new LambdaQueryWrapper<SysUser>() |
| | | .select(SysUser::getUserId, SysUser::getUserName, SysUser::getNickName) |
| | | .eq(SysUser::getStatus, UserConstants.USER_NORMAL) |
| | | .eq(SysUser::getStatus, SystemConstants.NORMAL) |
| | | .eq(ObjectUtil.isNotNull(deptId), SysUser::getDeptId, deptId) |
| | | .in(CollUtil.isNotEmpty(userIds), SysUser::getUserId, userIds)); |
| | | } |
| | |
| | | if (ArrayUtil.isNotEmpty(roleIds)) { |
| | | List<Long> roleList = new ArrayList<>(List.of(roleIds)); |
| | | if (!LoginHelper.isSuperAdmin(userId)) { |
| | | roleList.remove(UserConstants.SUPER_ADMIN_ID); |
| | | roleList.remove(SystemConstants.SUPER_ADMIN_ID); |
| | | } |
| | | // 夿æ¯å¦å
·ææ¤è§è²çæä½æé |
| | | List<SysRoleVo> roles = roleMapper.selectRoleList( |
| | |
| | | public String selectUserNameById(Long userId) { |
| | | SysUser sysUser = baseMapper.selectOne(new LambdaQueryWrapper<SysUser>() |
| | | .select(SysUser::getUserName).eq(SysUser::getUserId, userId)); |
| | | return ObjectUtil.isNull(sysUser) ? null : sysUser.getUserName(); |
| | | return ObjectUtils.notNullGetter(sysUser, SysUser::getUserName); |
| | | } |
| | | |
| | | /** |
| | |
| | | public String selectNicknameById(Long userId) { |
| | | SysUser sysUser = baseMapper.selectOne(new LambdaQueryWrapper<SysUser>() |
| | | .select(SysUser::getNickName).eq(SysUser::getUserId, userId)); |
| | | return ObjectUtil.isNull(sysUser) ? null : sysUser.getNickName(); |
| | | return ObjectUtils.notNullGetter(sysUser, SysUser::getNickName); |
| | | } |
| | | |
| | | /** |
| | |
| | | public String selectPhonenumberById(Long userId) { |
| | | SysUser sysUser = baseMapper.selectOne(new LambdaQueryWrapper<SysUser>() |
| | | .select(SysUser::getPhonenumber).eq(SysUser::getUserId, userId)); |
| | | return ObjectUtil.isNull(sysUser) ? null : sysUser.getPhonenumber(); |
| | | return ObjectUtils.notNullGetter(sysUser, SysUser::getPhonenumber); |
| | | } |
| | | |
| | | /** |
| | |
| | | public String selectEmailById(Long userId) { |
| | | SysUser sysUser = baseMapper.selectOne(new LambdaQueryWrapper<SysUser>() |
| | | .select(SysUser::getEmail).eq(SysUser::getUserId, userId)); |
| | | return ObjectUtil.isNull(sysUser) ? null : sysUser.getEmail(); |
| | | return ObjectUtils.notNullGetter(sysUser, SysUser::getEmail); |
| | | } |
| | | |
| | | /** |
| | | * éè¿ç¨æ·IDæ¥è¯¢ç¨æ·å表 |
| | | * |
| | | * @param userIds ç¨æ·ids |
| | | * @return ç¨æ·å表 |
| | | */ |
| | | @Override |
| | | public List<UserDTO> selectListByIds(List<Long> userIds) { |
| | | if (CollUtil.isEmpty(userIds)) { |
| | |
| | | } |
| | | List<SysUserVo> list = baseMapper.selectVoList(new LambdaQueryWrapper<SysUser>() |
| | | .select(SysUser::getUserId, SysUser::getUserName, SysUser::getNickName, SysUser::getEmail, SysUser::getPhonenumber) |
| | | .eq(SysUser::getStatus, UserConstants.USER_NORMAL) |
| | | .in(CollUtil.isNotEmpty(userIds), SysUser::getUserId, userIds)); |
| | | .eq(SysUser::getStatus, SystemConstants.NORMAL) |
| | | .in(SysUser::getUserId, userIds)); |
| | | return BeanUtil.copyToList(list, UserDTO.class); |
| | | } |
| | | |
| | | /** |
| | | * éè¿è§è²IDæ¥è¯¢ç¨æ·ID |
| | | * |
| | | * @param roleIds è§è²ids |
| | | * @return ç¨æ·ids |
| | | */ |
| | | @Override |
| | | public List<Long> selectUserIdsByRoleIds(List<Long> roleIds) { |
| | | List<SysUserRole> userRoles = userRoleMapper.selectList( |
| | | new LambdaQueryWrapper<SysUserRole>().in(SysUserRole::getRoleId, roleIds)); |
| | | return StreamUtils.toList(userRoles, SysUserRole::getUserId); |
| | | } |
| | | |
| | | @Override |
| | | public List<UserDTO> selectUsersByRoleIds(List<Long> roleIds) { |
| | | if (CollUtil.isEmpty(roleIds)) { |
| | | return List.of(); |
| | | } |
| | | List<SysUserRole> userRoles = userRoleMapper.selectList( |
| | | new LambdaQueryWrapper<SysUserRole>().in(SysUserRole::getRoleId, roleIds)); |
| | | List<Long> userIds = StreamUtils.toList(userRoles, SysUserRole::getUserId); |
| | | return selectListByIds(userIds); |
| | | return StreamUtils.toList(userRoles, SysUserRole::getUserId); |
| | | } |
| | | |
| | | /** |
| | | * éè¿è§è²IDæ¥è¯¢ç¨æ· |
| | | * |
| | | * @param roleIds è§è²ids |
| | | * @return ç¨æ· |
| | | */ |
| | | @Override |
| | | public List<UserDTO> selectUsersByRoleIds(List<Long> roleIds) { |
| | | if (CollUtil.isEmpty(roleIds)) { |
| | | return List.of(); |
| | | } |
| | | |
| | | // éè¿è§è²IDè·åç¨æ·è§è²ä¿¡æ¯ |
| | | List<SysUserRole> userRoles = userRoleMapper.selectList( |
| | | new LambdaQueryWrapper<SysUserRole>().in(SysUserRole::getRoleId, roleIds)); |
| | | |
| | | // è·åç¨æ·IDå表 |
| | | Set<Long> userIds = StreamUtils.toSet(userRoles, SysUserRole::getUserId); |
| | | |
| | | return selectListByIds(new ArrayList<>(userIds)); |
| | | } |
| | | |
| | | /** |
| | | * éè¿é¨é¨IDæ¥è¯¢ç¨æ· |
| | | * |
| | | * @param deptIds é¨é¨ids |
| | | * @return ç¨æ· |
| | | */ |
| | | @Override |
| | | public List<UserDTO> selectUsersByDeptIds(List<Long> deptIds) { |
| | | if (CollUtil.isEmpty(deptIds)) { |
| | |
| | | } |
| | | List<SysUserVo> list = baseMapper.selectVoList(new LambdaQueryWrapper<SysUser>() |
| | | .select(SysUser::getUserId, SysUser::getUserName, SysUser::getNickName, SysUser::getEmail, SysUser::getPhonenumber) |
| | | .eq(SysUser::getStatus, UserConstants.USER_NORMAL) |
| | | .in(CollUtil.isNotEmpty(deptIds), SysUser::getDeptId, deptIds)); |
| | | .eq(SysUser::getStatus, SystemConstants.NORMAL) |
| | | .in(SysUser::getDeptId, deptIds)); |
| | | return BeanUtil.copyToList(list, UserDTO.class); |
| | | } |
| | | |
| | | /** |
| | | * éè¿å²ä½IDæ¥è¯¢ç¨æ· |
| | | * |
| | | * @param postIds å²ä½ids |
| | | * @return ç¨æ· |
| | | */ |
| | | @Override |
| | | public List<UserDTO> selectUsersByPostIds(List<Long> postIds) { |
| | | if (CollUtil.isEmpty(postIds)) { |
| | | return List.of(); |
| | | } |
| | | |
| | | // éè¿å²ä½IDè·åç¨æ·å²ä½ä¿¡æ¯ |
| | | List<SysUserPost> userPosts = userPostMapper.selectList( |
| | | new LambdaQueryWrapper<SysUserPost>().in(SysUserPost::getPostId, postIds)); |
| | | |
| | | // è·åç¨æ·IDå表 |
| | | Set<Long> userIds = StreamUtils.toSet(userPosts, SysUserPost::getUserId); |
| | | |
| | | return selectListByIds(new ArrayList<>(userIds)); |
| | | } |
| | | |
| | | } |
| | |
| | | from sys_dept ${ew.getCustomSqlSegment} |
| | | </select> |
| | | |
| | | <select id="selectPageDeptList" resultMap="SysDeptResult"> |
| | | select |
| | | <if test="ew.getSqlSelect != null"> |
| | | ${ew.getSqlSelect} |
| | | </if> |
| | | <if test="ew.getSqlSelect == null"> |
| | | * |
| | | </if> |
| | | from sys_dept ${ew.getCustomSqlSegment} |
| | | </select> |
| | | |
| | | <select id="countDeptById" resultType="Long"> |
| | | select count(*) from sys_dept where del_flag = '0' and dept_id = #{deptId} |
| | | </select> |
| | |
| | | |
| | | <dependencies> |
| | | |
| | | <!--å¼å
¥flowableä¾èµ--> |
| | | <dependency> |
| | | <groupId>org.flowable</groupId> |
| | | <artifactId>flowable-spring-boot-autoconfigure</artifactId> |
| | | <exclusions> |
| | | <exclusion> |
| | | <groupId>org.flowable</groupId> |
| | | <artifactId>flowable-spring-security</artifactId> |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.flowable</groupId> |
| | | <artifactId>flowable-spring-configurator</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.flowable</groupId> |
| | | <artifactId>flowable-spring-boot-starter-actuator</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- ç»å¶flowableæµç¨å¾ --> |
| | | <dependency> |
| | | <groupId>org.flowable</groupId> |
| | | <artifactId>flowable-image-generator</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- flowable json è½¬æ¢ --> |
| | | <dependency> |
| | | <groupId>org.flowable</groupId> |
| | | <artifactId>flowable-json-converter</artifactId> |
| | | <version>6.8.0</version> |
| | | </dependency> |
| | | |
| | | <!-- svg转pngå¾çå·¥å
·--> |
| | | <dependency> |
| | | <groupId>org.apache.xmlgraphics</groupId> |
| | | <artifactId>batik-all</artifactId> |
| | | <version>1.17</version> |
| | | <exclusions> |
| | | <exclusion> |
| | | <groupId>xalan</groupId> |
| | | <artifactId>xalan</artifactId> |
| | | </exclusion> |
| | | </exclusions> |
| | | <groupId>org.dromara</groupId> |
| | | <artifactId>ruoyi-common-sse</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.dromara</groupId> |
| | | <artifactId>ruoyi-common-websocket</artifactId> |
| | | <artifactId>ruoyi-common-doc</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | |
| | | <groupId>org.dromara</groupId> |
| | | <artifactId>ruoyi-common-security</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.dromara.warm</groupId> |
| | | <artifactId>warm-flow-mybatis-plus-sb3-starter</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.dromara.warm</groupId> |
| | | <artifactId>warm-flow-plugin-ui-sb-web</artifactId> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | </project> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.common; |
| | | |
| | | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
| | | |
| | | import java.lang.annotation.ElementType; |
| | | import java.lang.annotation.Retention; |
| | | import java.lang.annotation.RetentionPolicy; |
| | | import java.lang.annotation.Target; |
| | | |
| | | @Retention(RetentionPolicy.RUNTIME) |
| | | @Target({ ElementType.TYPE, ElementType.METHOD }) |
| | | @ConditionalOnProperty(value = "warm-flow.enabled", havingValue = "true") |
| | | public @interface ConditionalOnEnable { |
| | | } |
| | |
| | | */ |
| | | public interface FlowConstant { |
| | | |
| | | String MESSAGE_CURRENT_TASK_IS_NULL = "å½åä»»å¡ä¸åå¨æä½ ä¸æ¯ä»»å¡åç人ï¼"; |
| | | |
| | | String MESSAGE_SUSPENDED = "å½åä»»å¡å·²æèµ·ä¸å¯å®¡æ¹ï¼"; |
| | | |
| | | /** |
| | | * è¿çº¿ |
| | | */ |
| | | String SEQUENCE_FLOW = "sequenceFlow"; |
| | | |
| | | /** |
| | | * å¹¶è¡ç½å
³ |
| | | */ |
| | | String PARALLEL_GATEWAY = "parallelGateway"; |
| | | |
| | | /** |
| | | * æå®ç½å
³ |
| | | */ |
| | | String EXCLUSIVE_GATEWAY = "exclusiveGateway"; |
| | | |
| | | /** |
| | | * å
å«ç½å
³ |
| | | */ |
| | | String INCLUSIVE_GATEWAY = "inclusiveGateway"; |
| | | |
| | | /** |
| | | * ç»æèç¹ |
| | | */ |
| | | String END_EVENT = "endEvent"; |
| | | |
| | | |
| | | /** |
| | | * æµç¨å§æ´¾æ è¯ |
| | | */ |
| | | String PENDING = "PENDING"; |
| | | |
| | | /** |
| | | * åé人æ è¯ |
| | | */ |
| | | String CANDIDATE = "candidate"; |
| | | |
| | | /** |
| | | * ä¼ç¾ä»»å¡æ»æ° |
| | | */ |
| | | String NUMBER_OF_INSTANCES = "nrOfInstances"; |
| | | |
| | | /** |
| | | * æ£å¨æ§è¡çä¼ç¾æ»æ° |
| | | */ |
| | | String NUMBER_OF_ACTIVE_INSTANCES = "nrOfActiveInstances"; |
| | | |
| | | /** |
| | | * 已宿çä¼ç¾ä»»å¡æ»æ° |
| | | */ |
| | | String NUMBER_OF_COMPLETED_INSTANCES = "nrOfCompletedInstances"; |
| | | |
| | | /** |
| | | * 循ç¯çç´¢å¼å¼ï¼å¯ä»¥ä½¿ç¨elementIndexVariable屿§ä¿®æ¹loopCounterçåéå |
| | | */ |
| | | String LOOP_COUNTER = "loopCounter"; |
| | | |
| | | String ZIP = "ZIP"; |
| | | |
| | | /** |
| | | * ä¸å¡ä¸æµç¨å®ä¾å
³è对象 |
| | | */ |
| | | String BUSINESS_INSTANCE_DTO = "businessInstanceDTO"; |
| | | |
| | | /** |
| | | * æµç¨å®ä¹é
ç½® |
| | | */ |
| | | String WF_DEFINITION_CONFIG_VO = "wfDefinitionConfigVo"; |
| | | |
| | | /** |
| | | * èç¹é
ç½® |
| | | */ |
| | | String WF_NODE_CONFIG_VO = "wfNodeConfigVo"; |
| | | |
| | | /** |
| | | * æµç¨å起人 |
| | | */ |
| | |
| | | /** |
| | | * ä¸å¡id |
| | | */ |
| | | String BUSINESS_KEY = "businessKey"; |
| | | String BUSINESS_ID = "businessId"; |
| | | |
| | | /** |
| | | * æµç¨å®ä¹id |
| | | * ä»»å¡id |
| | | */ |
| | | String PROCESS_DEFINITION_ID = "processDefinitionId"; |
| | | String TASK_ID = "taskId"; |
| | | |
| | | /** |
| | | * å¼å¯è·³è¿è¡¨è¾¾å¼åé |
| | | * å§æ |
| | | */ |
| | | String FLOWABLE_SKIP_EXPRESSION_ENABLED = "_FLOWABLE_SKIP_EXPRESSION_ENABLED"; |
| | | String DELEGATE_TASK = "delegateTask"; |
| | | |
| | | /** |
| | | * æ¨¡åæ è¯keyå½åè§èæ£åè¡¨è¾¾å¼ |
| | | * 转å |
| | | */ |
| | | String MODEL_KEY_PATTERN = "^[a-zA-Z][a-zA-Z0-9_]{0,254}$"; |
| | | String TRANSFER_TASK = "transferTask"; |
| | | |
| | | /** |
| | | * ç¨æ·ä»»å¡ |
| | | * å ç¾ |
| | | */ |
| | | String USER_TASK = "userTask"; |
| | | String ADD_SIGNATURE = "addSignature"; |
| | | |
| | | /** |
| | | * ä¼ç¾ |
| | | * åç¾ |
| | | */ |
| | | String MULTI_INSTANCE = "multiInstance"; |
| | | String REDUCTION_SIGNATURE = "reductionSignature"; |
| | | |
| | | /** |
| | | * æ¯ |
| | | * æµç¨åç±»Id转åç§° |
| | | */ |
| | | String TRUE = "0"; |
| | | String CATEGORY_ID_TO_NAME = "category_id_to_name"; |
| | | |
| | | /** |
| | | * å¦ |
| | | * æµç¨åç±»åç§° |
| | | */ |
| | | String FALSE = "1"; |
| | | String FLOW_CATEGORY_NAME = "flow_category_name#30d"; |
| | | |
| | | /** |
| | | * é»è®¤ç§æ·OAç³è¯·åç±»id |
| | | */ |
| | | Long FLOW_CATEGORY_ID = 100L; |
| | | |
| | | } |
| | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Getter; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.Map; |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | | import java.util.function.Function; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * æ¶æ¯ç±»åæä¸¾ |
| | |
| | | @Getter |
| | | @AllArgsConstructor |
| | | public enum MessageTypeEnum { |
| | | |
| | | /** |
| | | * ç«å
ä¿¡ |
| | | */ |
| | | SYSTEM_MESSAGE("1", "ç«å
ä¿¡"), |
| | | |
| | | /** |
| | | * é®ç®± |
| | | */ |
| | | EMAIL_MESSAGE("2", "é®ç®±"), |
| | | |
| | | /** |
| | | * çä¿¡ |
| | | */ |
| | |
| | | |
| | | private final String desc; |
| | | |
| | | private final static Map<String, MessageTypeEnum> MESSAGE_TYPE_ENUM_MAP = new ConcurrentHashMap<>(MessageTypeEnum.values().length); |
| | | |
| | | static { |
| | | for (MessageTypeEnum messageType : MessageTypeEnum.values()) { |
| | | MESSAGE_TYPE_ENUM_MAP.put(messageType.code, messageType); |
| | | } |
| | | } |
| | | private static final Map<String, MessageTypeEnum> MESSAGE_TYPE_ENUM_MAP = Arrays.stream(values()) |
| | | .collect(Collectors.toConcurrentMap(MessageTypeEnum::getCode, Function.identity())); |
| | | |
| | | /** |
| | | * æ ¹æ®æ¶æ¯ç±»å code è·å MessageTypeEnum |
| | | * |
| | | * @param code æ¶æ¯ç±»åcode |
| | | * @return MessageTypeEnum |
| | | */ |
| | | public static MessageTypeEnum getByCode(String code) { |
| | | return MESSAGE_TYPE_ENUM_MAP.get(code); |
| | | return MESSAGE_TYPE_ENUM_MAP.getOrDefault(code, null); |
| | | } |
| | | |
| | | } |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.common.enums; |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Getter; |
| | | import org.dromara.common.core.exception.ServiceException; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * ä»»å¡åé
人æä¸¾ |
| | | * |
| | | * @author AprilWind |
| | | */ |
| | | @Getter |
| | | @AllArgsConstructor |
| | | public enum TaskAssigneeEnum { |
| | | |
| | | /** |
| | | * ç¨æ· |
| | | */ |
| | | USER("ç¨æ·", ""), |
| | | |
| | | /** |
| | | * è§è² |
| | | */ |
| | | ROLE("è§è²", "role:"), |
| | | |
| | | /** |
| | | * é¨é¨ |
| | | */ |
| | | DEPT("é¨é¨", "dept:"), |
| | | |
| | | /** |
| | | * å²ä½ |
| | | */ |
| | | POST("å²ä½", "post:"); |
| | | |
| | | private final String desc; |
| | | private final String code; |
| | | |
| | | /** |
| | | * æ ¹æ®æè¿°è·å对åºçæä¸¾ç±»å |
| | | * <p> |
| | | * éè¿ä¼ å
¥æè¿°ï¼æ¥æ¾å¹¶è¿åå¹é
çæä¸¾é¡¹ãå¦ææªæ¾å°å¹é
项ï¼ä¼æåº {@link ServiceException}ã |
| | | * </p> |
| | | * |
| | | * @param desc æè¿°ï¼ç¨äºå¹é
对åºçæä¸¾é¡¹ |
| | | * @return TaskAssigneeEnum è¿å对åºçæä¸¾ç±»å |
| | | * @throws ServiceException å¦ææªæ¾å°å¹é
çæä¸¾é¡¹ |
| | | */ |
| | | public static TaskAssigneeEnum fromDesc(String desc) { |
| | | for (TaskAssigneeEnum type : values()) { |
| | | if (type.getDesc().equals(desc)) { |
| | | return type; |
| | | } |
| | | } |
| | | throw new ServiceException("æªç¥çåç人类å: " + desc); |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®ä»£ç è·å对åºçæä¸¾ç±»å |
| | | * <p> |
| | | * éè¿ä¼ å
¥ä»£ç ï¼æ¥æ¾å¹¶è¿åå¹é
çæä¸¾é¡¹ãå¦ææªæ¾å°å¹é
项ï¼ä¼æåº {@link ServiceException}ã |
| | | * </p> |
| | | * |
| | | * @param code 代ç ï¼ç¨äºå¹é
对åºçæä¸¾é¡¹ |
| | | * @return TaskAssigneeEnum è¿å对åºçæä¸¾ç±»å |
| | | * @throws IllegalArgumentException å¦ææªæ¾å°å¹é
çæä¸¾é¡¹ |
| | | */ |
| | | public static TaskAssigneeEnum fromCode(String code) { |
| | | for (TaskAssigneeEnum type : values()) { |
| | | if (type.getCode().equals(code)) { |
| | | return type; |
| | | } |
| | | } |
| | | throw new ServiceException("æªç¥çåç人类å代ç : " + code); |
| | | } |
| | | |
| | | /** |
| | | * è·åææåç人类åçæè¿°å表 |
| | | * <p> |
| | | * è·åå½åæä¸¾ç±»ææé¡¹çæè¿°å段å表ï¼é常ç¨äºå±ç¤ºéæ©é¡¹ã |
| | | * </p> |
| | | * |
| | | * @return List<String> è¿åææåç人类åçæè¿°å表 |
| | | */ |
| | | public static List<String> getAssigneeTypeList() { |
| | | return Arrays.stream(values()) |
| | | .map(TaskAssigneeEnum::getDesc) |
| | | .collect(Collectors.toList()); |
| | | } |
| | | |
| | | /** |
| | | * è·åææåç人类åç代ç å表 |
| | | * <p> |
| | | * è·åå½åæä¸¾ç±»ææé¡¹ç代ç åæ®µå表ï¼é常ç¨äºç¨åºå
é¨é»è¾ç夿ã |
| | | * </p> |
| | | * |
| | | * @return List<String> è¿åææåç人类åç代ç å表 |
| | | */ |
| | | public static List<String> getAssigneeCodeList() { |
| | | return Arrays.stream(values()) |
| | | .map(TaskAssigneeEnum::getCode) |
| | | .collect(Collectors.toList()); |
| | | } |
| | | } |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.common.enums; |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Getter; |
| | | |
| | | /** |
| | | * 人åç±»å |
| | | * |
| | | * @author AprilWind |
| | | */ |
| | | @Getter |
| | | @AllArgsConstructor |
| | | public enum TaskAssigneeType { |
| | | |
| | | /** |
| | | * å¾
åä»»å¡ç审æ¹äººæé |
| | | * <p>该æéè¡¨ç¤ºç¨æ·æ¯å¾
åä»»å¡ç审æ¹äººï¼è´è´£å®¡æ ¸ä»»å¡çæ§è¡æ
åµã</p> |
| | | */ |
| | | APPROVER("1", "å¾
åä»»å¡ç审æ¹äººæé"), |
| | | |
| | | /** |
| | | * å¾
åä»»å¡ç转å人æé |
| | | * <p>该æéè¡¨ç¤ºç¨æ·æ¯å¾
åä»»å¡ç转å人ï¼è´è´£å°ä»»å¡åé
ç»å
¶ä»äººåã</p> |
| | | */ |
| | | TRANSFER("2", "å¾
åä»»å¡ç转å人æé"), |
| | | |
| | | /** |
| | | * å¾
åä»»å¡çå§æäººæé |
| | | * <p>该æéè¡¨ç¤ºç¨æ·æ¯å¾
åä»»å¡çå§æäººï¼è½å¤å§æå
¶ä»äººä»£ä¸ºå¤çä»»å¡ã</p> |
| | | */ |
| | | DELEGATE("3", "å¾
åä»»å¡çå§æäººæé"), |
| | | |
| | | /** |
| | | * å¾
åä»»å¡çæé人æé |
| | | * <p>该æéè¡¨ç¤ºç¨æ·æ¯å¾
åä»»å¡çæé人ï¼ä»
æ¥æ¶ä»»å¡ä¿¡æ¯çéç¥ï¼ä¸åä¸ä»»å¡çå®¡æ¹æå¤çã</p> |
| | | */ |
| | | COPY("4", "å¾
åä»»å¡çæé人æé"); |
| | | |
| | | /** |
| | | * ç±»å |
| | | */ |
| | | private final String code; |
| | | |
| | | /** |
| | | * æè¿° |
| | | */ |
| | | private final String description; |
| | | |
| | | } |
| | |
| | | import cn.hutool.core.util.StrUtil; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Getter; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * ä»»å¡ç¶ææä¸¾ |
| | |
| | | @Getter |
| | | @AllArgsConstructor |
| | | public enum TaskStatusEnum { |
| | | |
| | | /** |
| | | * æ¤é |
| | | */ |
| | | CANCEL("cancel", "æ¤é"), |
| | | |
| | | /** |
| | | * éè¿ |
| | | */ |
| | | PASS("pass", "éè¿"), |
| | | |
| | | /** |
| | | * å¾
å®¡æ ¸ |
| | | */ |
| | | WAITING("waiting", "å¾
å®¡æ ¸"), |
| | | |
| | | /** |
| | | * ä½åº |
| | | */ |
| | | INVALID("invalid", "ä½åº"), |
| | | |
| | | /** |
| | | * éå |
| | | */ |
| | | BACK("back", "éå"), |
| | | |
| | | /** |
| | | * ç»æ¢ |
| | | */ |
| | | TERMINATION("termination", "ç»æ¢"), |
| | | |
| | | /** |
| | | * 转å |
| | | */ |
| | | TRANSFER("transfer", "转å"), |
| | | |
| | | /** |
| | | * å§æ |
| | | */ |
| | | PENDING("pending", "å§æ"), |
| | | DEPUTE("depute", "å§æ"), |
| | | |
| | | /** |
| | | * æé |
| | | */ |
| | | COPY("copy", "æé"), |
| | | |
| | | /** |
| | | * å ç¾ |
| | | */ |
| | | SIGN("sign", "å ç¾"), |
| | | |
| | | /** |
| | | * åç¾ |
| | | */ |
| | | SIGN_OFF("sign_off", "åç¾"), |
| | | |
| | | /** |
| | | * è¶
æ¶ |
| | | */ |
| | |
| | | */ |
| | | private final String desc; |
| | | |
| | | private static final Map<String, String> STATUS_DESC_MAP = Arrays.stream(values()) |
| | | .collect(Collectors.toConcurrentMap(TaskStatusEnum::getStatus, TaskStatusEnum::getDesc)); |
| | | |
| | | /** |
| | | * ä»»å¡ä¸å¡ç¶æ |
| | | * |
| | | * @param status ç¶æ |
| | | */ |
| | | public static String findByStatus(String status) { |
| | | if (StringUtils.isBlank(status)) { |
| | | return StrUtil.EMPTY; |
| | | } |
| | | |
| | | return Arrays.stream(TaskStatusEnum.values()) |
| | | .filter(statusEnum -> statusEnum.getStatus().equals(status)) |
| | | .findFirst() |
| | | .map(TaskStatusEnum::getDesc) |
| | | .orElse(StrUtil.EMPTY); |
| | | // ä»ç¼åä¸ç´æ¥è·åæè¿° |
| | | return STATUS_DESC_MAP.getOrDefault(status, StrUtil.EMPTY); |
| | | } |
| | | |
| | | } |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.config; |
| | | |
| | | import org.dromara.workflow.common.ConditionalOnEnable; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | /** |
| | | * warmFlowé
ç½® |
| | | * |
| | | * @author may |
| | | */ |
| | | @ConditionalOnEnable |
| | | @Configuration |
| | | public class WarmFlowConfig { |
| | | |
| | | } |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.controller; |
| | | |
| | | import cn.dev33.satoken.annotation.SaCheckPermission; |
| | | import cn.hutool.core.lang.tree.Tree; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.dromara.common.core.domain.R; |
| | | import org.dromara.common.core.validate.AddGroup; |
| | | import org.dromara.common.core.validate.EditGroup; |
| | | import org.dromara.common.excel.utils.ExcelUtil; |
| | | import org.dromara.common.idempotent.annotation.RepeatSubmit; |
| | | import org.dromara.common.log.annotation.Log; |
| | | import org.dromara.common.log.enums.BusinessType; |
| | | import org.dromara.common.web.core.BaseController; |
| | | import org.dromara.workflow.common.ConditionalOnEnable; |
| | | import org.dromara.workflow.domain.bo.FlowCategoryBo; |
| | | import org.dromara.workflow.domain.vo.FlowCategoryVo; |
| | | import org.dromara.workflow.service.IFlwCategoryService; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * æµç¨åç±» |
| | | * |
| | | * @author may |
| | | */ |
| | | @ConditionalOnEnable |
| | | @Validated |
| | | @RequiredArgsConstructor |
| | | @RestController |
| | | @RequestMapping("/workflow/category") |
| | | public class FlwCategoryController extends BaseController { |
| | | |
| | | private final IFlwCategoryService flwCategoryService; |
| | | |
| | | /** |
| | | * æ¥è¯¢æµç¨åç±»å表 |
| | | */ |
| | | @SaCheckPermission("workflow:category:list") |
| | | @GetMapping("/list") |
| | | public R<List<FlowCategoryVo>> list(FlowCategoryBo bo) { |
| | | List<FlowCategoryVo> list = flwCategoryService.queryList(bo); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | /** |
| | | * å¯¼åºæµç¨åç±»å表 |
| | | */ |
| | | @SaCheckPermission("workflow:category:export") |
| | | @Log(title = "æµç¨åç±»", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/export") |
| | | public void export(FlowCategoryBo bo, HttpServletResponse response) { |
| | | List<FlowCategoryVo> list = flwCategoryService.queryList(bo); |
| | | ExcelUtil.exportExcel(list, "æµç¨åç±»", FlowCategoryVo.class, response); |
| | | } |
| | | |
| | | /** |
| | | * è·åæµç¨å类详ç»ä¿¡æ¯ |
| | | * |
| | | * @param categoryId ä¸»é® |
| | | */ |
| | | @SaCheckPermission("workflow:category:query") |
| | | @GetMapping("/{categoryId}") |
| | | public R<FlowCategoryVo> getInfo(@NotNull(message = "主é®ä¸è½ä¸ºç©º") @PathVariable Long categoryId) { |
| | | flwCategoryService.checkCategoryDataScope(categoryId); |
| | | return R.ok(flwCategoryService.queryById(categoryId)); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢æµç¨åç±» |
| | | */ |
| | | @SaCheckPermission("workflow:category:add") |
| | | @Log(title = "æµç¨åç±»", businessType = BusinessType.INSERT) |
| | | @RepeatSubmit() |
| | | @PostMapping() |
| | | public R<Void> add(@Validated(AddGroup.class) @RequestBody FlowCategoryBo category) { |
| | | if (!flwCategoryService.checkCategoryNameUnique(category)) { |
| | | return R.fail("æ°å¢æµç¨åç±»'" + category.getCategoryName() + "'å¤±è´¥ï¼æµç¨åç±»åç§°å·²åå¨"); |
| | | } |
| | | return toAjax(flwCategoryService.insertByBo(category)); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹æµç¨åç±» |
| | | */ |
| | | @SaCheckPermission("workflow:category:edit") |
| | | @Log(title = "æµç¨åç±»", businessType = BusinessType.UPDATE) |
| | | @RepeatSubmit() |
| | | @PutMapping() |
| | | public R<Void> edit(@Validated(EditGroup.class) @RequestBody FlowCategoryBo category) { |
| | | Long categoryId = category.getCategoryId(); |
| | | flwCategoryService.checkCategoryDataScope(categoryId); |
| | | if (!flwCategoryService.checkCategoryNameUnique(category)) { |
| | | return R.fail("ä¿®æ¹æµç¨åç±»'" + category.getCategoryName() + "'å¤±è´¥ï¼æµç¨åç±»åç§°å·²åå¨"); |
| | | } else if (category.getParentId().equals(categoryId)) { |
| | | return R.fail("ä¿®æ¹æµç¨åç±»'" + category.getCategoryName() + "'失败ï¼ä¸çº§æµç¨åç±»ä¸è½æ¯èªå·±"); |
| | | } |
| | | return toAjax(flwCategoryService.updateByBo(category)); |
| | | } |
| | | |
| | | /** |
| | | * å 餿µç¨åç±» |
| | | * |
| | | * @param categoryId ä¸»é® |
| | | */ |
| | | @SaCheckPermission("workflow:category:remove") |
| | | @Log(title = "æµç¨åç±»", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{categoryId}") |
| | | public R<Void> remove(@PathVariable Long categoryId) { |
| | | if (flwCategoryService.hasChildByCategoryId(categoryId)) { |
| | | return R.warn("åå¨ä¸çº§æµç¨åç±»,ä¸å
许å é¤"); |
| | | } |
| | | if (flwCategoryService.checkCategoryExistDefinition(categoryId)) { |
| | | return R.warn("æµç¨åç±»å卿µç¨å®ä¹,ä¸å
许å é¤"); |
| | | } |
| | | return toAjax(flwCategoryService.deleteWithValidById(categoryId)); |
| | | } |
| | | |
| | | /** |
| | | * è·åæµç¨åç±»æ å表 |
| | | * |
| | | * @param categoryBo æµç¨åç±» |
| | | */ |
| | | @GetMapping("/categoryTree") |
| | | public R<List<Tree<String>>> categoryTree(FlowCategoryBo categoryBo) { |
| | | return R.ok(flwCategoryService.selectCategoryTreeList(categoryBo)); |
| | | } |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.controller; |
| | | |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.dromara.common.core.domain.R; |
| | | import org.dromara.common.idempotent.annotation.RepeatSubmit; |
| | | import org.dromara.common.log.annotation.Log; |
| | | import org.dromara.common.log.enums.BusinessType; |
| | | import org.dromara.common.mybatis.core.page.PageQuery; |
| | | import org.dromara.common.mybatis.core.page.TableDataInfo; |
| | | import org.dromara.common.web.core.BaseController; |
| | | import org.dromara.warm.flow.core.entity.Definition; |
| | | import org.dromara.warm.flow.core.service.DefService; |
| | | import org.dromara.warm.flow.orm.entity.FlowDefinition; |
| | | import org.dromara.workflow.common.ConditionalOnEnable; |
| | | import org.dromara.workflow.domain.vo.FlowDefinitionVo; |
| | | import org.dromara.workflow.service.IFlwDefinitionService; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * æµç¨å®ä¹ç®¡ç æ§å¶å± |
| | | * |
| | | * @author may |
| | | */ |
| | | @ConditionalOnEnable |
| | | @Validated |
| | | @RequiredArgsConstructor |
| | | @RestController |
| | | @RequestMapping("/workflow/definition") |
| | | public class FlwDefinitionController extends BaseController { |
| | | |
| | | private final DefService defService; |
| | | private final IFlwDefinitionService flwDefinitionService; |
| | | |
| | | /** |
| | | * æ¥è¯¢æµç¨å®ä¹å表 |
| | | * |
| | | * @param flowDefinition åæ° |
| | | * @param pageQuery å页 |
| | | */ |
| | | @GetMapping("/list") |
| | | public TableDataInfo<FlowDefinitionVo> list(FlowDefinition flowDefinition, PageQuery pageQuery) { |
| | | return flwDefinitionService.queryList(flowDefinition, pageQuery); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢æªåå¸çæµç¨å®ä¹å表 |
| | | * |
| | | * @param flowDefinition åæ° |
| | | * @param pageQuery å页 |
| | | */ |
| | | @GetMapping("/unPublishList") |
| | | public TableDataInfo<FlowDefinitionVo> unPublishList(FlowDefinition flowDefinition, PageQuery pageQuery) { |
| | | return flwDefinitionService.unPublishList(flowDefinition, pageQuery); |
| | | } |
| | | |
| | | /** |
| | | * è·åæµç¨å®ä¹è¯¦ç»ä¿¡æ¯ |
| | | * |
| | | * @param id æµç¨å®ä¹id |
| | | */ |
| | | @GetMapping(value = "/{id}") |
| | | public R<Definition> getInfo(@PathVariable Long id) { |
| | | return R.ok(defService.getById(id)); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢æµç¨å®ä¹ |
| | | * |
| | | * @param flowDefinition åæ° |
| | | */ |
| | | @Log(title = "æµç¨å®ä¹", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | @RepeatSubmit() |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R<Boolean> add(@RequestBody FlowDefinition flowDefinition) { |
| | | return R.ok(defService.checkAndSave(flowDefinition)); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹æµç¨å®ä¹ |
| | | * |
| | | * @param flowDefinition åæ° |
| | | */ |
| | | @Log(title = "æµç¨å®ä¹", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | @RepeatSubmit() |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R<Boolean> edit(@RequestBody FlowDefinition flowDefinition) { |
| | | return R.ok(defService.updateById(flowDefinition)); |
| | | } |
| | | |
| | | /** |
| | | * å叿µç¨å®ä¹ |
| | | * |
| | | * @param id æµç¨å®ä¹id |
| | | */ |
| | | @Log(title = "æµç¨å®ä¹", businessType = BusinessType.INSERT) |
| | | @PutMapping("/publish/{id}") |
| | | @RepeatSubmit() |
| | | public R<Boolean> publish(@PathVariable Long id) { |
| | | return R.ok(flwDefinitionService.publish(id)); |
| | | } |
| | | |
| | | /** |
| | | * åæ¶å叿µç¨å®ä¹ |
| | | * |
| | | * @param id æµç¨å®ä¹id |
| | | */ |
| | | @Log(title = "æµç¨å®ä¹", businessType = BusinessType.INSERT) |
| | | @PutMapping("/unPublish/{id}") |
| | | @RepeatSubmit() |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R<Boolean> unPublish(@PathVariable Long id) { |
| | | return R.ok(defService.unPublish(id)); |
| | | } |
| | | |
| | | /** |
| | | * å 餿µç¨å®ä¹ |
| | | */ |
| | | @Log(title = "æµç¨å®ä¹", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{ids}") |
| | | public R<Void> remove(@PathVariable List<Long> ids) { |
| | | return toAjax(flwDefinitionService.removeDef(ids)); |
| | | } |
| | | |
| | | /** |
| | | * å¤å¶æµç¨å®ä¹ |
| | | * |
| | | * @param id æµç¨å®ä¹id |
| | | */ |
| | | @Log(title = "æµç¨å®ä¹", businessType = BusinessType.INSERT) |
| | | @PostMapping("/copy/{id}") |
| | | @RepeatSubmit() |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R<Boolean> copy(@PathVariable Long id) { |
| | | return R.ok(defService.copyDef(id)); |
| | | } |
| | | |
| | | /** |
| | | * 导å
¥æµç¨å®ä¹ |
| | | * |
| | | * @param file æä»¶ |
| | | * @param category åç±» |
| | | */ |
| | | @Log(title = "æµç¨å®ä¹", businessType = BusinessType.IMPORT) |
| | | @PostMapping("/importDef") |
| | | public R<Boolean> importDef(MultipartFile file, String category) { |
| | | return R.ok(flwDefinitionService.importJson(file, category)); |
| | | } |
| | | |
| | | /** |
| | | * å¯¼åºæµç¨å®ä¹ |
| | | * |
| | | * @param id æµç¨å®ä¹id |
| | | * @param response ååº |
| | | * @throws IOException å¼å¸¸ |
| | | */ |
| | | @Log(title = "æµç¨å®ä¹", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/exportDef/{id}") |
| | | public void exportDef(@PathVariable Long id, HttpServletResponse response) throws IOException { |
| | | flwDefinitionService.exportDef(id, response); |
| | | } |
| | | |
| | | /** |
| | | * è·åæµç¨å®ä¹JSONå符串 |
| | | * |
| | | * @param id æµç¨å®ä¹id |
| | | */ |
| | | @GetMapping("/xmlString/{id}") |
| | | public R<String> xmlString(@PathVariable Long id) { |
| | | return R.ok("æä½æå", defService.exportJson(id)); |
| | | } |
| | | |
| | | /** |
| | | * æ¿æ´»/æèµ·æµç¨å®ä¹ |
| | | * |
| | | * @param id æµç¨å®ä¹id |
| | | * @param active æ¿æ´»/æèµ· |
| | | */ |
| | | @RepeatSubmit() |
| | | @PutMapping("/active/{id}") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R<Boolean> active(@PathVariable Long id, @RequestParam boolean active) { |
| | | return R.ok(active ? defService.active(id) : defService.unActive(id)); |
| | | } |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.controller; |
| | | |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.dromara.common.core.domain.R; |
| | | import org.dromara.common.idempotent.annotation.RepeatSubmit; |
| | | import org.dromara.common.log.annotation.Log; |
| | | import org.dromara.common.log.enums.BusinessType; |
| | | import org.dromara.common.mybatis.core.page.PageQuery; |
| | | import org.dromara.common.mybatis.core.page.TableDataInfo; |
| | | import org.dromara.common.web.core.BaseController; |
| | | import org.dromara.warm.flow.core.service.InsService; |
| | | import org.dromara.workflow.common.ConditionalOnEnable; |
| | | import org.dromara.workflow.domain.bo.FlowCancelBo; |
| | | import org.dromara.workflow.domain.bo.FlowInstanceBo; |
| | | import org.dromara.workflow.domain.bo.FlowInvalidBo; |
| | | import org.dromara.workflow.domain.vo.FlowInstanceVo; |
| | | import org.dromara.workflow.service.IFlwInstanceService; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * æµç¨å®ä¾ç®¡ç æ§å¶å± |
| | | * |
| | | * @author may |
| | | */ |
| | | @ConditionalOnEnable |
| | | @Validated |
| | | @RequiredArgsConstructor |
| | | @RestController |
| | | @RequestMapping("/workflow/instance") |
| | | public class FlwInstanceController extends BaseController { |
| | | |
| | | private final InsService insService; |
| | | private final IFlwInstanceService flwInstanceService; |
| | | |
| | | /** |
| | | * æ¥è¯¢æ£å¨è¿è¡çæµç¨å®ä¾å表 |
| | | * |
| | | * @param flowInstanceBo æµç¨å®ä¾ |
| | | * @param pageQuery å页 |
| | | */ |
| | | @GetMapping("/pageByRunning") |
| | | public TableDataInfo<FlowInstanceVo> selectRunningInstanceList(FlowInstanceBo flowInstanceBo, PageQuery pageQuery) { |
| | | return flwInstanceService.selectRunningInstanceList(flowInstanceBo, pageQuery); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢å·²ç»æçæµç¨å®ä¾å表 |
| | | * |
| | | * @param flowInstanceBo æµç¨å®ä¾ |
| | | * @param pageQuery å页 |
| | | */ |
| | | @GetMapping("/pageByFinish") |
| | | public TableDataInfo<FlowInstanceVo> selectFinishInstanceList(FlowInstanceBo flowInstanceBo, PageQuery pageQuery) { |
| | | return flwInstanceService.selectFinishInstanceList(flowInstanceBo, pageQuery); |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®ä¸å¡idæ¥è¯¢æµç¨å®ä¾è¯¦ç»ä¿¡æ¯ |
| | | * |
| | | * @param businessId ä¸å¡id |
| | | */ |
| | | @GetMapping("/getInfo/{businessId}") |
| | | public R<FlowInstanceVo> getInfo(@PathVariable Long businessId) { |
| | | return R.ok(flwInstanceService.queryByBusinessId(businessId)); |
| | | } |
| | | |
| | | /** |
| | | * æç
§ä¸å¡idå 餿µç¨å®ä¾ |
| | | * |
| | | * @param businessIds ä¸å¡id |
| | | */ |
| | | @DeleteMapping("/deleteByBusinessIds/{businessIds}") |
| | | public R<Void> deleteByBusinessIds(@PathVariable List<Long> businessIds) { |
| | | return toAjax(flwInstanceService.deleteByBusinessIds(businessIds)); |
| | | } |
| | | |
| | | /** |
| | | * æç
§å®ä¾idå 餿µç¨å®ä¾ |
| | | * |
| | | * @param instanceIds å®ä¾id |
| | | */ |
| | | @DeleteMapping("/deleteByInstanceIds/{instanceIds}") |
| | | public R<Void> deleteByInstanceIds(@PathVariable List<Long> instanceIds) { |
| | | return toAjax(flwInstanceService.deleteByInstanceIds(instanceIds)); |
| | | } |
| | | |
| | | /** |
| | | * æ¤éæµç¨ |
| | | * |
| | | * @param bo åæ° |
| | | */ |
| | | @RepeatSubmit() |
| | | @PutMapping("/cancelProcessApply") |
| | | public R<Void> cancelProcessApply(@RequestBody FlowCancelBo bo) { |
| | | return toAjax(flwInstanceService.cancelProcessApply(bo)); |
| | | } |
| | | |
| | | /** |
| | | * æ¿æ´»/æèµ·æµç¨å®ä¾ |
| | | * |
| | | * @param id æµç¨å®ä¾id |
| | | * @param active æ¿æ´»/æèµ· |
| | | */ |
| | | @RepeatSubmit() |
| | | @PutMapping("/active/{id}") |
| | | public R<Boolean> active(@PathVariable Long id, @RequestParam boolean active) { |
| | | return R.ok(active ? insService.active(id) : insService.unActive(id)); |
| | | } |
| | | |
| | | /** |
| | | * è·åå½åç»é人åèµ·çæµç¨å®ä¾ |
| | | * |
| | | * @param flowInstanceBo åæ° |
| | | * @param pageQuery å页 |
| | | */ |
| | | @GetMapping("/pageByCurrent") |
| | | public TableDataInfo<FlowInstanceVo> selectCurrentInstanceList(FlowInstanceBo flowInstanceBo, PageQuery pageQuery) { |
| | | return flwInstanceService.selectCurrentInstanceList(flowInstanceBo, pageQuery); |
| | | } |
| | | |
| | | /** |
| | | * è·åæµç¨å¾ï¼æµç¨è®°å½ |
| | | * |
| | | * @param businessId ä¸å¡id |
| | | */ |
| | | @GetMapping("/flowImage/{businessId}") |
| | | public R<Map<String, Object>> flowImage(@PathVariable String businessId) { |
| | | return R.ok(flwInstanceService.flowImage(businessId)); |
| | | } |
| | | |
| | | /** |
| | | * è·åæµç¨åé |
| | | * |
| | | * @param instanceId æµç¨å®ä¾id |
| | | */ |
| | | @GetMapping("/instanceVariable/{instanceId}") |
| | | public R<Map<String, Object>> instanceVariable(@PathVariable Long instanceId) { |
| | | return R.ok(flwInstanceService.instanceVariable(instanceId)); |
| | | } |
| | | |
| | | /** |
| | | * ä½åºæµç¨ |
| | | * |
| | | * @param bo åæ° |
| | | */ |
| | | @Log(title = "æµç¨å®ä¾ç®¡ç", businessType = BusinessType.INSERT) |
| | | @RepeatSubmit() |
| | | @PostMapping("/invalid") |
| | | public R<Boolean> invalid(@Validated @RequestBody FlowInvalidBo bo) { |
| | | return R.ok(flwInstanceService.processInvalid(bo)); |
| | | } |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.controller; |
| | | |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.dromara.common.core.domain.R; |
| | | import org.dromara.common.core.domain.dto.StartProcessReturnDTO; |
| | | import org.dromara.common.core.domain.dto.UserDTO; |
| | | import org.dromara.common.core.validate.AddGroup; |
| | | import org.dromara.common.idempotent.annotation.RepeatSubmit; |
| | | import org.dromara.common.log.annotation.Log; |
| | | import org.dromara.common.log.enums.BusinessType; |
| | | import org.dromara.common.mybatis.core.page.PageQuery; |
| | | import org.dromara.common.mybatis.core.page.TableDataInfo; |
| | | import org.dromara.common.web.core.BaseController; |
| | | import org.dromara.warm.flow.core.entity.Node; |
| | | import org.dromara.workflow.common.ConditionalOnEnable; |
| | | import org.dromara.workflow.domain.bo.*; |
| | | import org.dromara.workflow.domain.vo.FlowHisTaskVo; |
| | | import org.dromara.workflow.domain.vo.FlowTaskVo; |
| | | import org.dromara.workflow.service.IFlwTaskService; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * ä»»å¡ç®¡ç æ§å¶å± |
| | | * |
| | | * @author may |
| | | */ |
| | | @ConditionalOnEnable |
| | | @Validated |
| | | @RequiredArgsConstructor |
| | | @RestController |
| | | @RequestMapping("/workflow/task") |
| | | public class FlwTaskController extends BaseController { |
| | | |
| | | private final IFlwTaskService flwTaskService; |
| | | |
| | | /** |
| | | * å¯å¨ä»»å¡ |
| | | * |
| | | * @param startProcessBo å¯å¨æµç¨åæ° |
| | | */ |
| | | @Log(title = "ä»»å¡ç®¡ç", businessType = BusinessType.INSERT) |
| | | @RepeatSubmit() |
| | | @PostMapping("/startWorkFlow") |
| | | public R<StartProcessReturnDTO> startWorkFlow(@Validated(AddGroup.class) @RequestBody StartProcessBo startProcessBo) { |
| | | StartProcessReturnDTO startProcessReturn = flwTaskService.startWorkFlow(startProcessBo); |
| | | return R.ok("æäº¤æå", startProcessReturn); |
| | | } |
| | | |
| | | /** |
| | | * åçä»»å¡ |
| | | * |
| | | * @param completeTaskBo åçä»»å¡åæ° |
| | | */ |
| | | @Log(title = "ä»»å¡ç®¡ç", businessType = BusinessType.INSERT) |
| | | @RepeatSubmit() |
| | | @PostMapping("/completeTask") |
| | | public R<Void> completeTask(@Validated(AddGroup.class) @RequestBody CompleteTaskBo completeTaskBo) { |
| | | return toAjax(flwTaskService.completeTask(completeTaskBo)); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢å½åç¨æ·çå¾
åä»»å¡ |
| | | * |
| | | * @param flowTaskBo åæ° |
| | | * @param pageQuery å页 |
| | | */ |
| | | @GetMapping("/pageByTaskWait") |
| | | public TableDataInfo<FlowTaskVo> pageByTaskWait(FlowTaskBo flowTaskBo, PageQuery pageQuery) { |
| | | return flwTaskService.pageByTaskWait(flowTaskBo, pageQuery); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢å½åç¨æ·çå·²åä»»å¡ |
| | | * |
| | | * @param flowTaskBo åæ° |
| | | * @param pageQuery å页 |
| | | */ |
| | | |
| | | @GetMapping("/pageByTaskFinish") |
| | | public TableDataInfo<FlowHisTaskVo> pageByTaskFinish(FlowTaskBo flowTaskBo, PageQuery pageQuery) { |
| | | return flwTaskService.pageByTaskFinish(flowTaskBo, pageQuery); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢å¾
åä»»å¡ |
| | | * |
| | | * @param flowTaskBo åæ° |
| | | * @param pageQuery å页 |
| | | */ |
| | | @GetMapping("/pageByAllTaskWait") |
| | | public TableDataInfo<FlowTaskVo> pageByAllTaskWait(FlowTaskBo flowTaskBo, PageQuery pageQuery) { |
| | | return flwTaskService.pageByAllTaskWait(flowTaskBo, pageQuery); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢å·²åä»»å¡ |
| | | * |
| | | * @param flowTaskBo åæ° |
| | | * @param pageQuery å页 |
| | | */ |
| | | @GetMapping("/pageByAllTaskFinish") |
| | | public TableDataInfo<FlowHisTaskVo> pageByAllTaskFinish(FlowTaskBo flowTaskBo, PageQuery pageQuery) { |
| | | return flwTaskService.pageByAllTaskFinish(flowTaskBo, pageQuery); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢å½åç¨æ·çæé |
| | | * |
| | | * @param flowTaskBo åæ° |
| | | * @param pageQuery å页 |
| | | */ |
| | | @GetMapping("/pageByTaskCopy") |
| | | public TableDataInfo<FlowTaskVo> pageByTaskCopy(FlowTaskBo flowTaskBo, PageQuery pageQuery) { |
| | | return flwTaskService.pageByTaskCopy(flowTaskBo, pageQuery); |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®taskIdæ¥è¯¢ä»£è¡¨ä»»å¡ |
| | | * |
| | | * @param taskId ä»»å¡id |
| | | */ |
| | | @GetMapping("/getTask/{taskId}") |
| | | public R<FlowTaskVo> getTask(@PathVariable Long taskId) { |
| | | return R.ok(flwTaskService.selectById(taskId)); |
| | | } |
| | | |
| | | /** |
| | | * ç»æ¢ä»»å¡ |
| | | * |
| | | * @param bo åæ° |
| | | */ |
| | | @Log(title = "ä»»å¡ç®¡ç", businessType = BusinessType.INSERT) |
| | | @RepeatSubmit() |
| | | @PostMapping("/terminationTask") |
| | | public R<Boolean> terminationTask(@RequestBody FlowTerminationBo bo) { |
| | | return R.ok(flwTaskService.terminationTask(bo)); |
| | | } |
| | | |
| | | /** |
| | | * ä»»å¡æä½ |
| | | * |
| | | * @param bo åæ° |
| | | * @param taskOperation æä½ç±»åï¼å§æ´¾ delegateTaskã转å transferTaskãå ç¾ addSignatureãåç¾ reductionSignature |
| | | */ |
| | | @Log(title = "ä»»å¡ç®¡ç", businessType = BusinessType.UPDATE) |
| | | @RepeatSubmit |
| | | @PostMapping("/taskOperation/{taskOperation}") |
| | | public R<Void> taskOperation(@Validated @RequestBody TaskOperationBo bo, @PathVariable String taskOperation) { |
| | | return toAjax(flwTaskService.taskOperation(bo, taskOperation)); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹ä»»å¡åç人 |
| | | * |
| | | * @param taskIdList ä»»å¡id |
| | | * @param userId åç人id |
| | | */ |
| | | @Log(title = "ä»»å¡ç®¡ç", businessType = BusinessType.UPDATE) |
| | | @RepeatSubmit() |
| | | @PutMapping("/updateAssignee/{userId}") |
| | | public R<Void> updateAssignee(@RequestBody List<Long> taskIdList, @PathVariable String userId) { |
| | | return toAjax(flwTaskService.updateAssignee(taskIdList, userId)); |
| | | } |
| | | |
| | | /** |
| | | * 驳åå®¡æ¹ |
| | | * |
| | | * @param bo åæ° |
| | | */ |
| | | @Log(title = "ä»»å¡ç®¡ç", businessType = BusinessType.INSERT) |
| | | @RepeatSubmit() |
| | | @PostMapping("/backProcess") |
| | | public R<Void> backProcess(@Validated({AddGroup.class}) @RequestBody BackProcessBo bo) { |
| | | return toAjax(flwTaskService.backProcess(bo)); |
| | | } |
| | | |
| | | /** |
| | | * è·åå¯é©³åçåç½®èç¹ |
| | | * |
| | | * @param definitionId æµç¨å®ä¹id |
| | | * @param nowNodeCode å½åèç¹ |
| | | */ |
| | | @GetMapping("/getBackTaskNode/{definitionId}/{nowNodeCode}") |
| | | public R<List<Node>> getBackTaskNode(@PathVariable Long definitionId, @PathVariable String nowNodeCode) { |
| | | return R.ok(flwTaskService.getBackTaskNode(definitionId, nowNodeCode)); |
| | | } |
| | | |
| | | /** |
| | | * è·åå½åä»»å¡çææåç人 |
| | | * |
| | | * @param taskId ä»»å¡id |
| | | */ |
| | | @GetMapping("/currentTaskAllUser/{taskId}") |
| | | public R<List<UserDTO>> currentTaskAllUser(@PathVariable Long taskId) { |
| | | return R.ok(flwTaskService.currentTaskAllUser(taskId)); |
| | | } |
| | | |
| | | } |
| | |
| | | import org.dromara.common.mybatis.core.page.PageQuery; |
| | | import org.dromara.common.mybatis.core.page.TableDataInfo; |
| | | import org.dromara.common.web.core.BaseController; |
| | | import org.dromara.workflow.common.ConditionalOnEnable; |
| | | import org.dromara.workflow.domain.bo.TestLeaveBo; |
| | | import org.dromara.workflow.domain.vo.TestLeaveVo; |
| | | import org.dromara.workflow.service.ITestLeaveService; |
| | |
| | | * @author may |
| | | * @date 2023-07-21 |
| | | */ |
| | | @ConditionalOnEnable |
| | | @Validated |
| | | @RequiredArgsConstructor |
| | | @RestController |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.domain; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import org.dromara.common.tenant.core.TenantEntity; |
| | | |
| | | import java.io.Serial; |
| | | |
| | | /** |
| | | * æµç¨å类对象 wf_category |
| | | * |
| | | * @author may |
| | | * @date 2023-06-27 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @TableName("flow_category") |
| | | public class FlowCategory extends TenantEntity { |
| | | |
| | | @Serial |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * æµç¨åç±»ID |
| | | */ |
| | | @TableId(value = "category_id") |
| | | private Long categoryId; |
| | | |
| | | /** |
| | | * ç¶æµç¨åç±»id |
| | | */ |
| | | private Long parentId; |
| | | |
| | | /** |
| | | * ç¥çº§å表 |
| | | */ |
| | | private String ancestors; |
| | | |
| | | /** |
| | | * æµç¨åç±»åç§° |
| | | */ |
| | | private String categoryName; |
| | | |
| | | /** |
| | | * æ¾ç¤ºé¡ºåº |
| | | */ |
| | | private Long orderNum; |
| | | |
| | | /** |
| | | * å 餿 å¿ï¼0代表åå¨ 1代表å é¤ï¼ |
| | | */ |
| | | @TableLogic |
| | | private String delFlag; |
| | | |
| | | } |
| | |
| | | package org.dromara.workflow.domain.bo; |
| | | |
| | | import jakarta.validation.constraints.NotBlank; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import lombok.Data; |
| | | import org.dromara.common.core.validate.AddGroup; |
| | | |
| | | import java.io.Serial; |
| | | import java.io.Serializable; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | |
| | | |
| | | /** |
| | |
| | | /** |
| | | * ä»»å¡ID |
| | | */ |
| | | @NotBlank(message = "ä»»å¡IDä¸è½ä¸ºç©º", groups = AddGroup.class) |
| | | private String taskId; |
| | | @NotNull(message = "ä»»å¡IDä¸è½ä¸ºç©º", groups = AddGroup.class) |
| | | private Long taskId; |
| | | |
| | | /** |
| | | * éä»¶id |
| | | */ |
| | | private String fileId; |
| | | |
| | | /** |
| | | * æ¶æ¯ç±»å |
| | |
| | | * 驳åçèç¹id(ç®åæªä½¿ç¨ï¼ç´æ¥é©³åå°ç³è¯·äºº) |
| | | */ |
| | | @NotBlank(message = "驳åçèç¹ä¸è½ä¸ºç©º", groups = AddGroup.class) |
| | | private String targetActivityId; |
| | | private String nodeCode; |
| | | |
| | | /** |
| | | * åçæè§ |
| | | */ |
| | | private String message; |
| | | |
| | | /** |
| | | * éç¥ |
| | | */ |
| | | private String notice; |
| | | |
| | | /** |
| | | * æµç¨åé |
| | | */ |
| | | private Map<String, Object> variables; |
| | | |
| | | public Map<String, Object> getVariables() { |
| | | if (variables == null) { |
| | | return new HashMap<>(16); |
| | | } |
| | | variables.entrySet().removeIf(entry -> Objects.isNull(entry.getValue())); |
| | | return variables; |
| | | } |
| | | } |
| | |
| | | package org.dromara.workflow.domain.bo; |
| | | |
| | | import jakarta.validation.constraints.NotBlank; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import lombok.Data; |
| | | import org.dromara.common.core.validate.AddGroup; |
| | | import org.dromara.workflow.domain.vo.WfCopy; |
| | | |
| | | import java.io.Serial; |
| | | import java.io.Serializable; |
| | |
| | | /** |
| | | * ä»»å¡id |
| | | */ |
| | | @NotBlank(message = "ä»»å¡idä¸è½ä¸ºç©º", groups = {AddGroup.class}) |
| | | private String taskId; |
| | | @NotNull(message = "ä»»å¡idä¸è½ä¸ºç©º", groups = {AddGroup.class}) |
| | | private Long taskId; |
| | | |
| | | /** |
| | | * éä»¶id |
| | |
| | | /** |
| | | * æé人å |
| | | */ |
| | | private List<WfCopy> wfCopyList; |
| | | private List<FlowCopyBo> flowCopyList; |
| | | |
| | | /** |
| | | * æ¶æ¯ç±»å |
| | |
| | | private String message; |
| | | |
| | | /** |
| | | * æ¶æ¯éç¥ |
| | | */ |
| | | private String notice; |
| | | |
| | | /** |
| | | * æµç¨åé |
| | | */ |
| | | private Map<String, Object> variables; |
| | | |
| | | /** |
| | | * æ©å±åé(æ¤å¤ä¸ºéå·åéçossId) |
| | | * @return |
| | | */ |
| | | private String ext; |
| | | |
| | | public Map<String, Object> getVariables() { |
| | | if (variables == null) { |
| | | return new HashMap<>(16); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.domain.bo; |
| | | |
| | | import jakarta.validation.constraints.NotBlank; |
| | | import lombok.Data; |
| | | import org.dromara.common.core.validate.AddGroup; |
| | | |
| | | import java.io.Serial; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * æ¤éä»»å¡è¯·æ±å¯¹è±¡ |
| | | * |
| | | * @author may |
| | | */ |
| | | @Data |
| | | public class FlowCancelBo implements Serializable { |
| | | |
| | | @Serial |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * ä»»å¡ID |
| | | */ |
| | | @NotBlank(message = "ä¸å¡IDä¸è½ä¸ºç©º", groups = AddGroup.class) |
| | | private String businessId; |
| | | |
| | | /** |
| | | * åçæè§ |
| | | */ |
| | | private String message; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.domain.bo; |
| | | |
| | | import io.github.linpeilie.annotations.AutoMapper; |
| | | import jakarta.validation.constraints.NotBlank; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import org.dromara.common.core.validate.AddGroup; |
| | | import org.dromara.common.core.validate.EditGroup; |
| | | import org.dromara.common.mybatis.core.domain.BaseEntity; |
| | | import org.dromara.workflow.domain.FlowCategory; |
| | | |
| | | /** |
| | | * æµç¨åç±»ä¸å¡å¯¹è±¡ wf_category |
| | | * |
| | | * @author may |
| | | * @date 2023-06-27 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @AutoMapper(target = FlowCategory.class, reverseConvertGenerate = false) |
| | | public class FlowCategoryBo extends BaseEntity { |
| | | |
| | | /** |
| | | * æµç¨åç±»ID |
| | | */ |
| | | @NotNull(message = "æµç¨åç±»IDä¸è½ä¸ºç©º", groups = { EditGroup.class }) |
| | | private Long categoryId; |
| | | |
| | | /** |
| | | * ç¶æµç¨åç±»id |
| | | */ |
| | | @NotNull(message = "ç¶æµç¨åç±»idä¸è½ä¸ºç©º", groups = {AddGroup.class, EditGroup.class}) |
| | | private Long parentId; |
| | | |
| | | /** |
| | | * æµç¨åç±»åç§° |
| | | */ |
| | | @NotBlank(message = "æµç¨åç±»åç§°ä¸è½ä¸ºç©º", groups = {AddGroup.class, EditGroup.class}) |
| | | private String categoryName; |
| | | |
| | | /** |
| | | * æ¾ç¤ºé¡ºåº |
| | | */ |
| | | private Long orderNum; |
| | | |
| | | } |
ÎļþÃû´Ó ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/domain/vo/WfCopy.java ÐÞ¸Ä |
| | |
| | | package org.dromara.workflow.domain.vo; |
| | | package org.dromara.workflow.domain.bo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serial; |
| | | import java.io.Serializable; |
| | | |
| | | |
| | | /** |
| | | * æé |
| | |
| | | * @author may |
| | | */ |
| | | @Data |
| | | public class WfCopy implements Serializable { |
| | | public class FlowCopyBo implements Serializable { |
| | | |
| | | @Serial |
| | | private static final long serialVersionUID = 1L; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.domain.bo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serial; |
| | | import java.io.Serializable; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * æµç¨å®ä¾è¯·æ±å¯¹è±¡ |
| | | * |
| | | * @author may |
| | | */ |
| | | @Data |
| | | public class FlowInstanceBo implements Serializable { |
| | | |
| | | @Serial |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * æµç¨å®ä¹åç§° |
| | | */ |
| | | private String flowName; |
| | | |
| | | /** |
| | | * æµç¨å®ä¹ç¼ç |
| | | */ |
| | | private String flowCode; |
| | | |
| | | /** |
| | | * ä»»å¡å起人 |
| | | */ |
| | | private String startUserId; |
| | | |
| | | /** |
| | | * ä¸å¡id |
| | | */ |
| | | private String businessId; |
| | | |
| | | /** |
| | | * æµç¨åç±»id |
| | | */ |
| | | private String category; |
| | | |
| | | /** |
| | | * ä»»å¡åç§° |
| | | */ |
| | | private String nodeName; |
| | | |
| | | /** |
| | | * ç³è¯·äººIds |
| | | */ |
| | | private List<Long> createByIds; |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.domain.bo; |
| | | |
| | | import jakarta.validation.constraints.NotNull; |
| | | import lombok.Data; |
| | | import org.dromara.common.core.validate.AddGroup; |
| | | |
| | | import java.io.Serial; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * ä½åºè¯·æ±å¯¹è±¡ |
| | | * |
| | | * @author may |
| | | */ |
| | | @Data |
| | | public class FlowInvalidBo implements Serializable { |
| | | |
| | | @Serial |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * æµç¨å®ä¾id |
| | | */ |
| | | @NotNull(message = "æµç¨å®ä¾id为空", groups = AddGroup.class) |
| | | private Long id; |
| | | |
| | | /** |
| | | * å®¡æ¹æè§ |
| | | */ |
| | | private String comment; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.domain.bo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serial; |
| | | import java.io.Serializable; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * ä»»å¡è¯·æ±å¯¹è±¡ |
| | | * |
| | | * @author may |
| | | */ |
| | | @Data |
| | | public class FlowTaskBo implements Serializable { |
| | | |
| | | @Serial |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * ä»»å¡åç§° |
| | | */ |
| | | private String nodeName; |
| | | |
| | | /** |
| | | * æµç¨å®ä¹åç§° |
| | | */ |
| | | private String flowName; |
| | | |
| | | /** |
| | | * æµç¨å®ä¹ç¼ç |
| | | */ |
| | | private String flowCode; |
| | | |
| | | /** |
| | | * æµç¨åç±»id |
| | | */ |
| | | private String category; |
| | | |
| | | /** |
| | | * æµç¨å®ä¾id |
| | | */ |
| | | private Long instanceId; |
| | | |
| | | /** |
| | | * æéå表 |
| | | */ |
| | | private List<String> permissionList; |
| | | |
| | | /** |
| | | * ç³è¯·äººIds |
| | | */ |
| | | private List<Long> createByIds; |
| | | |
| | | } |
ÎļþÃû´Ó ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/domain/bo/TerminationBo.java ÐÞ¸Ä |
| | |
| | | package org.dromara.workflow.domain.bo; |
| | | |
| | | import jakarta.validation.constraints.NotBlank; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import lombok.Data; |
| | | import org.dromara.common.core.validate.AddGroup; |
| | | |
| | |
| | | * @author may |
| | | */ |
| | | @Data |
| | | public class TerminationBo implements Serializable { |
| | | public class FlowTerminationBo implements Serializable { |
| | | |
| | | @Serial |
| | | private static final long serialVersionUID = 1L; |
| | |
| | | /** |
| | | * ä»»å¡id |
| | | */ |
| | | @NotBlank(message = "ä»»å¡id为空", groups = AddGroup.class) |
| | | private String taskId; |
| | | @NotNull(message = "ä»»å¡id为空", groups = AddGroup.class) |
| | | private Long taskId; |
| | | |
| | | /** |
| | | * å®¡æ¹æè§ |
| | |
| | | * ä¸å¡å¯ä¸å¼id |
| | | */ |
| | | @NotBlank(message = "ä¸å¡IDä¸è½ä¸ºç©º", groups = {AddGroup.class}) |
| | | private String businessKey; |
| | | private String businessId; |
| | | |
| | | /** |
| | | * 表å |
| | | * æµç¨å®ä¹ç¼ç |
| | | */ |
| | | @NotBlank(message = "表åä¸è½ä¸ºç©º", groups = {AddGroup.class}) |
| | | private String tableName; |
| | | @NotBlank(message = "æµç¨å®ä¹ç¼ç ä¸è½ä¸ºç©º", groups = {AddGroup.class}) |
| | | private String flowCode; |
| | | |
| | | /** |
| | | * æµç¨åéï¼åç«¯ä¼æäº¤ä¸ä¸ªå
ç´ {'entity': {ä¸å¡è¯¦æ
æ°æ®å¯¹è±¡}} |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.domain.bo; |
| | | |
| | | import jakarta.validation.constraints.NotNull; |
| | | import lombok.Data; |
| | | import org.dromara.common.core.validate.AddGroup; |
| | | import org.dromara.common.core.validate.EditGroup; |
| | | |
| | | import java.io.Serial; |
| | | import java.io.Serializable; |
| | | import java.util.List; |
| | | |
| | | |
| | | /** |
| | | * 任塿ä½ä¸å¡å¯¹è±¡ï¼ç¨äºæè¿°ä»»å¡å§æ´¾ã转åãå ç¾çæä½çå¿
è¦åæ° |
| | | * å
å«äºç¨æ·IDãä»»å¡IDãä»»å¡ç¸å
³çæ¶æ¯ã以åå ç¾/åç¾çç¨æ·ID |
| | | * |
| | | * @author AprilWind |
| | | */ |
| | | @Data |
| | | public class TaskOperationBo implements Serializable { |
| | | |
| | | @Serial |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * å§æ´¾/转å人çç¨æ·IDï¼å¿
å¡«ï¼å坹姿´¾/转å人æä½ï¼ |
| | | */ |
| | | @NotNull(message = "å§æ´¾/转å人idä¸è½ä¸ºç©º", groups = {AddGroup.class}) |
| | | private String userId; |
| | | |
| | | /** |
| | | * å ç¾/åç¾äººçç¨æ·IDå表ï¼å¿
å¡«ï¼é对å ç¾/åç¾æä½ï¼ |
| | | */ |
| | | @NotNull(message = "å ç¾/åç¾idä¸è½ä¸ºç©º", groups = {EditGroup.class}) |
| | | private List<String> userIds; |
| | | |
| | | /** |
| | | * ä»»å¡IDï¼å¿
å¡«ï¼ |
| | | */ |
| | | @NotNull(message = "ä»»å¡idä¸è½ä¸ºç©º") |
| | | private Long taskId; |
| | | |
| | | /** |
| | | * æè§æå¤æ³¨ä¿¡æ¯ï¼å¯éï¼ |
| | | */ |
| | | private String message; |
| | | |
| | | } |
| | |
| | | /** |
| | | * 请åå¤©æ° |
| | | */ |
| | | @NotNull(message = "请å天æ°ä¸è½ä¸ºç©º", groups = {AddGroup.class, EditGroup.class}) |
| | | private Integer leaveDays; |
| | | |
| | | /** |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.domain.vo; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
| | | import com.alibaba.excel.annotation.ExcelProperty; |
| | | import io.github.linpeilie.annotations.AutoMapper; |
| | | import lombok.Data; |
| | | import org.dromara.workflow.domain.FlowCategory; |
| | | |
| | | import java.io.Serial; |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | |
| | | /** |
| | | * æµç¨åç±»è§å¾å¯¹è±¡ wf_category |
| | | * |
| | | * @author may |
| | | * @date 2023-06-27 |
| | | */ |
| | | @Data |
| | | @ExcelIgnoreUnannotated |
| | | @AutoMapper(target = FlowCategory.class) |
| | | public class FlowCategoryVo implements Serializable { |
| | | |
| | | @Serial |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * æµç¨åç±»ID |
| | | */ |
| | | @ExcelProperty(value = "æµç¨åç±»ID") |
| | | private Long categoryId; |
| | | |
| | | /** |
| | | * ç¶çº§id |
| | | */ |
| | | private Long parentId; |
| | | |
| | | /** |
| | | * ç¶ç±»å«åç§° |
| | | */ |
| | | private String parentName; |
| | | |
| | | /** |
| | | * ç¥çº§å表 |
| | | */ |
| | | private String ancestors; |
| | | |
| | | /** |
| | | * æµç¨åç±»åç§° |
| | | */ |
| | | @ExcelProperty(value = "æµç¨åç±»åç§°") |
| | | private String categoryName; |
| | | |
| | | /** |
| | | * æ¾ç¤ºé¡ºåº |
| | | */ |
| | | @ExcelProperty(value = "æ¾ç¤ºé¡ºåº") |
| | | private Long orderNum; |
| | | |
| | | /** |
| | | * å建æ¶é´ |
| | | */ |
| | | @ExcelProperty(value = "å建æ¶é´") |
| | | private Date createTime; |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.domain.vo; |
| | | |
| | | import lombok.Data; |
| | | import org.dromara.common.translation.annotation.Translation; |
| | | import org.dromara.workflow.common.constant.FlowConstant; |
| | | |
| | | import java.io.Serial; |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * æµç¨å®ä¹è§å¾ |
| | | * |
| | | * @author may |
| | | */ |
| | | @Data |
| | | public class FlowDefinitionVo implements Serializable { |
| | | |
| | | @Serial |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | private Long id; |
| | | |
| | | /** |
| | | * å建æ¶é´ |
| | | */ |
| | | private Date createTime; |
| | | |
| | | /** |
| | | * æ´æ°æ¶é´ |
| | | */ |
| | | private Date updateTime; |
| | | |
| | | /** |
| | | * ç§æ·ID |
| | | */ |
| | | private String tenantId; |
| | | |
| | | /** |
| | | * å 餿 è®° |
| | | */ |
| | | private String delFlag; |
| | | |
| | | /** |
| | | * æµç¨å®ä¹ç¼ç |
| | | */ |
| | | private String flowCode; |
| | | |
| | | /** |
| | | * æµç¨å®ä¹åç§° |
| | | */ |
| | | private String flowName; |
| | | |
| | | /** |
| | | * æµç¨åç±»id |
| | | */ |
| | | private String category; |
| | | |
| | | /** |
| | | * æµç¨åç±»åç§° |
| | | */ |
| | | @Translation(type = FlowConstant.CATEGORY_ID_TO_NAME, mapper = "category") |
| | | private String categoryName; |
| | | |
| | | /** |
| | | * æµç¨çæ¬ |
| | | */ |
| | | private String version; |
| | | |
| | | /** |
| | | * æ¯å¦åå¸ï¼0æªåå¸ 1å·²åå¸ 9失æï¼ |
| | | */ |
| | | private Integer isPublish; |
| | | |
| | | /** |
| | | * 审æ¹è¡¨åæ¯å¦èªå®ä¹ï¼Yæ¯ Nå¦ï¼ |
| | | */ |
| | | private String formCustom; |
| | | |
| | | /** |
| | | * 审æ¹è¡¨åè·¯å¾ |
| | | */ |
| | | private String formPath; |
| | | |
| | | /** |
| | | * æµç¨æ¿æ´»ç¶æï¼0æèµ· 1æ¿æ´»ï¼ |
| | | */ |
| | | private Integer activityStatus; |
| | | |
| | | /** |
| | | * çå¬å¨ç±»å |
| | | */ |
| | | private String listenerType; |
| | | |
| | | /** |
| | | * çå¬å¨è·¯å¾ |
| | | */ |
| | | private String listenerPath; |
| | | |
| | | /** |
| | | * æ©å±å段ï¼é¢çç»ä¸å¡ç³»ç»ä½¿ç¨ |
| | | */ |
| | | private String ext; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.domain.vo; |
| | | |
| | | import lombok.Data; |
| | | import org.dromara.common.core.utils.DateUtils; |
| | | import org.dromara.common.translation.annotation.Translation; |
| | | import org.dromara.common.translation.constant.TransConstant; |
| | | import org.dromara.warm.flow.core.enums.CooperateType; |
| | | import org.dromara.workflow.common.constant.FlowConstant; |
| | | |
| | | import java.io.Serial; |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * åå²ä»»å¡è§å¾ |
| | | * |
| | | * @author may |
| | | */ |
| | | @Data |
| | | public class FlowHisTaskVo implements Serializable { |
| | | |
| | | @Serial |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | private Long id; |
| | | |
| | | /** |
| | | * å建æ¶é´ |
| | | */ |
| | | private Date createTime; |
| | | |
| | | /** |
| | | * æ´æ°æ¶é´ |
| | | */ |
| | | private Date updateTime; |
| | | |
| | | /** |
| | | * ç§æ·ID |
| | | */ |
| | | private String tenantId; |
| | | |
| | | /** |
| | | * å 餿 è®° |
| | | */ |
| | | private String delFlag; |
| | | |
| | | /** |
| | | * 对åºflow_definition表çid |
| | | */ |
| | | private Long definitionId; |
| | | |
| | | /** |
| | | * æµç¨å®ä¹åç§° |
| | | */ |
| | | private String flowName; |
| | | |
| | | /** |
| | | * æµç¨å®ä¾è¡¨id |
| | | */ |
| | | private Long instanceId; |
| | | |
| | | /** |
| | | * ä»»å¡è¡¨id |
| | | */ |
| | | private Long taskId; |
| | | |
| | | /** |
| | | * å使¹å¼(1å®¡æ¹ 2转å 3å§æ´¾ 4ä¼ç¾ 5ç¥¨ç¾ 6å ç¾ 7åç¾) |
| | | */ |
| | | private Integer cooperateType; |
| | | |
| | | /** |
| | | * å使¹å¼(1å®¡æ¹ 2转å 3å§æ´¾ 4ä¼ç¾ 5ç¥¨ç¾ 6å ç¾ 7åç¾) |
| | | */ |
| | | private String cooperateTypeName; |
| | | |
| | | /** |
| | | * ä¸å¡id |
| | | */ |
| | | private String businessId; |
| | | |
| | | /** |
| | | * å¼å§èç¹ç¼ç |
| | | */ |
| | | private String nodeCode; |
| | | |
| | | /** |
| | | * å¼å§èç¹åç§° |
| | | */ |
| | | private String nodeName; |
| | | |
| | | /** |
| | | * å¼å§èç¹ç±»åï¼0å¼å§èç¹ 1ä¸é´èç¹ 2ç»æèç¹ 3äºæ¥ç½å
³ 4å¹¶è¡ç½å
³ï¼ |
| | | */ |
| | | private Integer nodeType; |
| | | |
| | | /** |
| | | * ç®æ èç¹ç¼ç |
| | | */ |
| | | private String targetNodeCode; |
| | | |
| | | /** |
| | | * ç»æèç¹åç§° |
| | | */ |
| | | private String targetNodeName; |
| | | |
| | | /** |
| | | * 审æ¹è
|
| | | */ |
| | | private String approver; |
| | | |
| | | /** |
| | | * 审æ¹è
|
| | | */ |
| | | @Translation(type = TransConstant.USER_ID_TO_NICKNAME, mapper = "approver") |
| | | private String approveName; |
| | | |
| | | /** |
| | | * åä½äºº(åªæè½¬åãä¼ç¾ã票ç¾ãå§æ´¾) |
| | | */ |
| | | private String collaborator; |
| | | |
| | | /** |
| | | * æéæ è¯ permissionFlagçlistå½¢å¼ |
| | | */ |
| | | private List<String> permissionList; |
| | | |
| | | /** |
| | | * 跳转类åï¼PASSéè¿ REJECTéå NONEæ å¨ä½ï¼ |
| | | */ |
| | | private String skipType; |
| | | |
| | | /** |
| | | * æµç¨ç¶æ |
| | | */ |
| | | private String flowStatus; |
| | | |
| | | /** |
| | | * ä»»å¡ç¶æ |
| | | */ |
| | | private String flowTaskStatus; |
| | | |
| | | /** |
| | | * æµç¨ç¶æ |
| | | */ |
| | | private String flowStatusName; |
| | | |
| | | /** |
| | | * å®¡æ¹æè§ |
| | | */ |
| | | private String message; |
| | | |
| | | /** |
| | | * ä¸å¡è¯¦æ
åä¸å¡ç±»çjson |
| | | */ |
| | | private String ext; |
| | | |
| | | /** |
| | | * å建è
|
| | | */ |
| | | private String createBy; |
| | | |
| | | /** |
| | | * ç³è¯·äºº |
| | | */ |
| | | @Translation(type = TransConstant.USER_ID_TO_NICKNAME, mapper = "createBy") |
| | | private String createByName; |
| | | |
| | | /** |
| | | * æµç¨åç±»id |
| | | */ |
| | | private String category; |
| | | |
| | | /** |
| | | * æµç¨åç±»åç§° |
| | | */ |
| | | @Translation(type = FlowConstant.CATEGORY_ID_TO_NAME, mapper = "category") |
| | | private String categoryName; |
| | | |
| | | /** |
| | | * 审æ¹è¡¨åæ¯å¦èªå®ä¹ï¼Yæ¯ Nå¦ï¼ |
| | | */ |
| | | private String formCustom; |
| | | |
| | | /** |
| | | * 审æ¹è¡¨åè·¯å¾ |
| | | */ |
| | | private String formPath; |
| | | |
| | | /** |
| | | * æµç¨å®ä¹ç¼ç |
| | | */ |
| | | private String flowCode; |
| | | |
| | | /** |
| | | * æµç¨çæ¬å· |
| | | */ |
| | | private String version; |
| | | |
| | | /** |
| | | * è¿è¡æ¶é¿ |
| | | */ |
| | | private String runDuration; |
| | | |
| | | /** |
| | | * 设置å建æ¶é´å¹¶è®¡ç®ä»»å¡è¿è¡æ¶é¿ |
| | | * |
| | | * @param createTime å建æ¶é´ |
| | | */ |
| | | public void setCreateTime(Date createTime) { |
| | | this.createTime = createTime; |
| | | updateRunDuration(); |
| | | } |
| | | |
| | | /** |
| | | * è®¾ç½®æ´æ°æ¶é´å¹¶è®¡ç®ä»»å¡è¿è¡æ¶é¿ |
| | | * |
| | | * @param updateTime æ´æ°æ¶é´ |
| | | */ |
| | | public void setUpdateTime(Date updateTime) { |
| | | this.updateTime = updateTime; |
| | | updateRunDuration(); |
| | | } |
| | | |
| | | /** |
| | | * æ´æ°è¿è¡æ¶é¿ |
| | | */ |
| | | private void updateRunDuration() { |
| | | // 妿å建æ¶é´åæ´æ°æ¶é´åä¸ä¸ºç©ºï¼è®¡ç®å®ä»¬ä¹é´çæ¶é¿ |
| | | if (this.updateTime != null && this.createTime != null) { |
| | | this.runDuration = DateUtils.getTimeDifference(this.updateTime, this.createTime); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 设置å使¹å¼ï¼å¹¶éè¿å使¹å¼è·ååç§° |
| | | */ |
| | | public void setCooperateType(Integer cooperateType) { |
| | | this.cooperateType = cooperateType; |
| | | this.cooperateTypeName = CooperateType.getValueByKey(cooperateType); |
| | | } |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.domain.vo; |
| | | |
| | | import lombok.Data; |
| | | import org.dromara.common.translation.annotation.Translation; |
| | | import org.dromara.common.translation.constant.TransConstant; |
| | | import org.dromara.workflow.common.constant.FlowConstant; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * æµç¨å®ä¾è§å¾ |
| | | * |
| | | * @author may |
| | | */ |
| | | @Data |
| | | public class FlowInstanceVo { |
| | | |
| | | private Long id; |
| | | |
| | | /** |
| | | * å建æ¶é´ |
| | | */ |
| | | private Date createTime; |
| | | |
| | | /** |
| | | * æ´æ°æ¶é´ |
| | | */ |
| | | private Date updateTime; |
| | | |
| | | /** |
| | | * ç§æ·ID |
| | | */ |
| | | private String tenantId; |
| | | |
| | | /** |
| | | * å 餿 è®° |
| | | */ |
| | | private String delFlag; |
| | | |
| | | /** |
| | | * 对åºflow_definition表çid |
| | | */ |
| | | private Long definitionId; |
| | | |
| | | /** |
| | | * æµç¨å®ä¹åç§° |
| | | */ |
| | | private String flowName; |
| | | |
| | | /** |
| | | * æµç¨å®ä¹ç¼ç |
| | | */ |
| | | private String flowCode; |
| | | |
| | | /** |
| | | * ä¸å¡id |
| | | */ |
| | | private String businessId; |
| | | |
| | | /** |
| | | * èç¹ç±»åï¼0å¼å§èç¹ 1ä¸é´èç¹ 2ç»æèç¹ 3äºæ¥ç½å
³ 4å¹¶è¡ç½å
³ï¼ |
| | | */ |
| | | private Integer nodeType; |
| | | |
| | | /** |
| | | * æµç¨èç¹ç¼ç æ¯ä¸ªæµç¨çnodeCodeæ¯å¯ä¸ç,å³definitionId+nodeCodeå¯ä¸,卿°æ®åºå±é¢åäºæ§å¶ |
| | | */ |
| | | private String nodeCode; |
| | | |
| | | /** |
| | | * æµç¨èç¹åç§° |
| | | */ |
| | | private String nodeName; |
| | | |
| | | /** |
| | | * æµç¨åé |
| | | */ |
| | | private String variable; |
| | | |
| | | /** |
| | | * æµç¨ç¶æï¼0å¾
æäº¤ 1审æ¹ä¸ 2 审æ¹éè¿ 3èªå¨éè¿ 8已宿 9å·²éå 10失æï¼ |
| | | */ |
| | | private String flowStatus; |
| | | |
| | | /** |
| | | * æµç¨ç¶æ |
| | | */ |
| | | private String flowStatusName; |
| | | |
| | | /** |
| | | * æµç¨æ¿æ´»ç¶æï¼0æèµ· 1æ¿æ´»ï¼ |
| | | */ |
| | | private Integer activityStatus; |
| | | |
| | | /** |
| | | * 审æ¹è¡¨åæ¯å¦èªå®ä¹ï¼Yæ¯ Nå¦ï¼ |
| | | */ |
| | | private String formCustom; |
| | | |
| | | /** |
| | | * 审æ¹è¡¨åè·¯å¾ |
| | | */ |
| | | private String formPath; |
| | | |
| | | /** |
| | | * æ©å±å段ï¼é¢çç»ä¸å¡ç³»ç»ä½¿ç¨ |
| | | */ |
| | | private String ext; |
| | | |
| | | /** |
| | | * æµç¨å®ä¹çæ¬ |
| | | */ |
| | | private String version; |
| | | |
| | | /** |
| | | * å建è
|
| | | */ |
| | | private String createBy; |
| | | |
| | | /** |
| | | * ç³è¯·äºº |
| | | */ |
| | | @Translation(type = TransConstant.USER_ID_TO_NICKNAME, mapper = "createBy") |
| | | private String createByName; |
| | | |
| | | /** |
| | | * æµç¨åç±»id |
| | | */ |
| | | private String category; |
| | | |
| | | /** |
| | | * æµç¨åç±»åç§° |
| | | */ |
| | | @Translation(type = FlowConstant.CATEGORY_ID_TO_NAME, mapper = "category") |
| | | private String categoryName; |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.domain.vo; |
| | | |
| | | import lombok.Data; |
| | | import org.dromara.common.translation.annotation.Translation; |
| | | import org.dromara.common.translation.constant.TransConstant; |
| | | import org.dromara.warm.flow.core.entity.User; |
| | | import org.dromara.workflow.common.constant.FlowConstant; |
| | | |
| | | import java.io.Serial; |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * ä»»å¡è§å¾ |
| | | * |
| | | * @author may |
| | | */ |
| | | @Data |
| | | public class FlowTaskVo implements Serializable { |
| | | |
| | | @Serial |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | private Long id; |
| | | |
| | | /** |
| | | * å建æ¶é´ |
| | | */ |
| | | private Date createTime; |
| | | |
| | | /** |
| | | * æ´æ°æ¶é´ |
| | | */ |
| | | private Date updateTime; |
| | | |
| | | /** |
| | | * ç§æ·ID |
| | | */ |
| | | private String tenantId; |
| | | |
| | | /** |
| | | * å 餿 è®° |
| | | */ |
| | | private String delFlag; |
| | | |
| | | /** |
| | | * 对åºflow_definition表çid |
| | | */ |
| | | private Long definitionId; |
| | | |
| | | /** |
| | | * æµç¨å®ä¾è¡¨id |
| | | */ |
| | | private Long instanceId; |
| | | |
| | | /** |
| | | * æµç¨å®ä¹åç§° |
| | | */ |
| | | private String flowName; |
| | | |
| | | /** |
| | | * ä¸å¡id |
| | | */ |
| | | private String businessId; |
| | | |
| | | /** |
| | | * èç¹ç¼ç |
| | | */ |
| | | private String nodeCode; |
| | | |
| | | /** |
| | | * èç¹åç§° |
| | | */ |
| | | private String nodeName; |
| | | |
| | | /** |
| | | * èç¹ç±»åï¼0å¼å§èç¹ 1ä¸é´èç¹ 2ç»æèç¹ 3äºæ¥ç½å
³ 4å¹¶è¡ç½å
³ï¼ |
| | | */ |
| | | private Integer nodeType; |
| | | |
| | | /** |
| | | * æéæ è¯ permissionFlagçlistå½¢å¼ |
| | | */ |
| | | private List<String> permissionList; |
| | | |
| | | /** |
| | | * æµç¨ç¨æ·å表 |
| | | */ |
| | | private List<User> userList; |
| | | |
| | | /** |
| | | * 审æ¹è¡¨åæ¯å¦èªå®ä¹ï¼Yæ¯ Nå¦ï¼ |
| | | */ |
| | | private String formCustom; |
| | | |
| | | /** |
| | | * 审æ¹è¡¨å |
| | | */ |
| | | private String formPath; |
| | | |
| | | /** |
| | | * æµç¨å®ä¹ç¼ç |
| | | */ |
| | | private String flowCode; |
| | | |
| | | /** |
| | | * æµç¨çæ¬å· |
| | | */ |
| | | private String version; |
| | | |
| | | /** |
| | | * æµç¨ç¶æ |
| | | */ |
| | | private String flowStatus; |
| | | |
| | | /** |
| | | * æµç¨åç±»id |
| | | */ |
| | | private String category; |
| | | |
| | | /** |
| | | * æµç¨åç±»åç§° |
| | | */ |
| | | @Translation(type = FlowConstant.CATEGORY_ID_TO_NAME, mapper = "category") |
| | | private String categoryName; |
| | | |
| | | /** |
| | | * æµç¨ç¶æ |
| | | */ |
| | | @Translation(type = TransConstant.DICT_TYPE_TO_LABEL, mapper = "flowStatus", other = "wf_business_status") |
| | | private String flowStatusName; |
| | | |
| | | /** |
| | | * åç人类å |
| | | */ |
| | | private String type; |
| | | |
| | | /** |
| | | * åç人ids |
| | | */ |
| | | private String assigneeIds; |
| | | |
| | | /** |
| | | * åç人åç§° |
| | | */ |
| | | private String assigneeNames; |
| | | |
| | | /** |
| | | * æé人id |
| | | */ |
| | | private String processedBy; |
| | | |
| | | /** |
| | | * æé人åç§° |
| | | */ |
| | | @Translation(type = TransConstant.USER_ID_TO_NICKNAME, mapper = "processedBy") |
| | | private String processedByName; |
| | | |
| | | /** |
| | | * æµç¨ç¾ç½²æ¯ä¾å¼ 大äº0为票ç¾ï¼ä¼ç¾ |
| | | */ |
| | | private BigDecimal nodeRatio; |
| | | |
| | | /** |
| | | * ç³è¯·äººid |
| | | */ |
| | | private String createBy; |
| | | |
| | | /** |
| | | * ç³è¯·äººåç§° |
| | | */ |
| | | @Translation(type = TransConstant.USER_ID_TO_NICKNAME, mapper = "createBy") |
| | | private String createByName; |
| | | } |
ÎļþÃû´Ó ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/domain/vo/VariableVo.java ÐÞ¸Ä |
| | |
| | | * @author may |
| | | */ |
| | | @Data |
| | | public class VariableVo implements Serializable { |
| | | public class FlowVariableVo implements Serializable { |
| | | |
| | | @Serial |
| | | private static final long serialVersionUID = 1L; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.handler; |
| | | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.dromara.common.core.domain.event.ProcessDeleteEvent; |
| | | import org.dromara.common.core.domain.event.ProcessEvent; |
| | | import org.dromara.common.core.domain.event.ProcessTaskEvent; |
| | | import org.dromara.common.core.utils.SpringUtils; |
| | | import org.dromara.common.tenant.helper.TenantHelper; |
| | | import org.dromara.workflow.common.ConditionalOnEnable; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * æµç¨çå¬æå¡ |
| | | * |
| | | * @author may |
| | | * @date 2024-06-02 |
| | | */ |
| | | @ConditionalOnEnable |
| | | @Slf4j |
| | | @Component |
| | | public class FlowProcessEventHandler { |
| | | |
| | | /** |
| | | * æ»ä½æµç¨çå¬(ä¾å¦: èç¨¿ï¼æ¤éï¼éåï¼ä½åºï¼ç»æ¢ï¼å·²å®æç) |
| | | * |
| | | * @param flowCode æµç¨å®ä¹ç¼ç |
| | | * @param businessId ä¸å¡id |
| | | * @param status ç¶æ |
| | | * @param submit å½ä¸ºtrueæ¶ä¸ºç³è¯·äººèç¹åç |
| | | */ |
| | | public void processHandler(String flowCode, String businessId, String status, Map<String, Object> params, boolean submit) { |
| | | String tenantId = TenantHelper.getTenantId(); |
| | | log.info("å叿µç¨äºä»¶ï¼ç§æ·ID: {}, æµç¨ç¶æ: {}, æµç¨ç¼ç : {}, ä¸å¡ID: {}, æ¯å¦ç³è¯·äººèç¹åç: {}", tenantId, status, flowCode, businessId, submit); |
| | | ProcessEvent processEvent = new ProcessEvent(); |
| | | processEvent.setTenantId(tenantId); |
| | | processEvent.setFlowCode(flowCode); |
| | | processEvent.setBusinessId(businessId); |
| | | processEvent.setStatus(status); |
| | | processEvent.setParams(params); |
| | | processEvent.setSubmit(submit); |
| | | SpringUtils.context().publishEvent(processEvent); |
| | | } |
| | | |
| | | /** |
| | | * æ§è¡åçä»»å¡çå¬ |
| | | * |
| | | * @param flowCode æµç¨å®ä¹ç¼ç |
| | | * @param nodeCode 审æ¹èç¹ç¼ç |
| | | * @param taskId ä»»å¡id |
| | | * @param businessId ä¸å¡id |
| | | */ |
| | | public void processTaskHandler(String flowCode, String nodeCode, Long taskId, String businessId) { |
| | | String tenantId = TenantHelper.getTenantId(); |
| | | log.info("å叿µç¨ä»»å¡äºä»¶, ç§æ·ID: {}, æµç¨ç¼ç : {}, èç¹ç¼ç : {}, ä»»å¡ID: {}, ä¸å¡ID: {}", tenantId, flowCode, nodeCode, taskId, businessId); |
| | | ProcessTaskEvent processTaskEvent = new ProcessTaskEvent(); |
| | | processTaskEvent.setTenantId(tenantId); |
| | | processTaskEvent.setFlowCode(flowCode); |
| | | processTaskEvent.setNodeCode(nodeCode); |
| | | processTaskEvent.setTaskId(taskId); |
| | | processTaskEvent.setBusinessId(businessId); |
| | | SpringUtils.context().publishEvent(processTaskEvent); |
| | | } |
| | | |
| | | /** |
| | | * å 餿µç¨çå¬ |
| | | * |
| | | * @param flowCode æµç¨å®ä¹ç¼ç |
| | | * @param businessId ä¸å¡ID |
| | | */ |
| | | public void processDeleteHandler(String flowCode, String businessId) { |
| | | String tenantId = TenantHelper.getTenantId(); |
| | | log.info("åå¸å 餿µç¨äºä»¶, ç§æ·ID: {}, æµç¨ç¼ç : {}, ä¸å¡ID: {}", tenantId, flowCode, businessId); |
| | | ProcessDeleteEvent processDeleteEvent = new ProcessDeleteEvent(); |
| | | processDeleteEvent.setTenantId(tenantId); |
| | | processDeleteEvent.setFlowCode(flowCode); |
| | | processDeleteEvent.setBusinessId(businessId); |
| | | SpringUtils.context().publishEvent(processDeleteEvent); |
| | | } |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.handler; |
| | | |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.dromara.common.core.domain.model.LoginUser; |
| | | import org.dromara.workflow.common.ConditionalOnEnable; |
| | | import org.dromara.workflow.common.enums.TaskAssigneeEnum; |
| | | import org.dromara.common.satoken.utils.LoginHelper; |
| | | import org.dromara.warm.flow.core.dto.FlowParams; |
| | | import org.dromara.warm.flow.core.handler.PermissionHandler; |
| | | import org.dromara.warm.flow.core.service.impl.TaskServiceImpl; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | import java.util.stream.Stream; |
| | | |
| | | /** |
| | | * åç人æéå¤çå¨ |
| | | * |
| | | * @author AprilWind |
| | | */ |
| | | @ConditionalOnEnable |
| | | @RequiredArgsConstructor |
| | | @Component |
| | | @Slf4j |
| | | public class WorkflowPermissionHandler implements PermissionHandler { |
| | | |
| | | /** |
| | | * 审æ¹åè·åå½ååç人ï¼åçæ¶ä¼æ ¡éªç该æééå |
| | | * åç»å¨{@link TaskServiceImpl#checkAuth(Task, FlowParams)} ä¸è°ç¨ |
| | | * è¿åå½åç¨æ·æééå |
| | | */ |
| | | @Override |
| | | public List<String> permissions() { |
| | | LoginUser loginUser = LoginHelper.getLoginUser(); |
| | | if (ObjectUtil.isNull(loginUser)) { |
| | | return new ArrayList<>(); |
| | | } |
| | | // 使ç¨ä¸ä¸ªæµæ¥æå»ºæéå表 |
| | | return Stream.of( |
| | | // è§è²æéåç¼ |
| | | loginUser.getRoles().stream() |
| | | .map(role -> TaskAssigneeEnum.ROLE.getCode() + role.getRoleId()), |
| | | |
| | | // å²ä½æéåç¼ |
| | | Stream.ofNullable(loginUser.getPosts()) |
| | | .flatMap(Collection::stream) |
| | | .map(post -> TaskAssigneeEnum.POST.getCode() + post.getPostId()), |
| | | |
| | | // ç¨æ·åé¨é¨æé |
| | | Stream.of(String.valueOf(loginUser.getUserId()), |
| | | TaskAssigneeEnum.DEPT.getCode() + loginUser.getDeptId() |
| | | ) |
| | | ) |
| | | .flatMap(stream -> stream) |
| | | .collect(Collectors.toList()); |
| | | } |
| | | |
| | | /** |
| | | * è·åå½ååç人 |
| | | * |
| | | * @return å½ååç人 |
| | | */ |
| | | @Override |
| | | public String getHandler() { |
| | | return LoginHelper.getUserIdStr(); |
| | | } |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.listener; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.dromara.common.core.enums.BusinessStatusEnum; |
| | | import org.dromara.common.core.utils.StringUtils; |
| | | import org.dromara.warm.flow.core.dto.FlowParams; |
| | | import org.dromara.warm.flow.core.entity.Definition; |
| | | import org.dromara.warm.flow.core.entity.Instance; |
| | | import org.dromara.warm.flow.core.entity.Task; |
| | | import org.dromara.warm.flow.core.listener.GlobalListener; |
| | | import org.dromara.warm.flow.core.listener.ListenerVariable; |
| | | import org.dromara.warm.flow.orm.entity.FlowTask; |
| | | import org.dromara.workflow.common.ConditionalOnEnable; |
| | | import org.dromara.workflow.handler.FlowProcessEventHandler; |
| | | import org.dromara.workflow.service.IFlwInstanceService; |
| | | import org.dromara.workflow.service.IFlwTaskService; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * å
¨å±ä»»å¡åççå¬ |
| | | * |
| | | * @author may |
| | | */ |
| | | @ConditionalOnEnable |
| | | @Component |
| | | @Slf4j |
| | | @RequiredArgsConstructor |
| | | public class WorkflowGlobalListener implements GlobalListener { |
| | | |
| | | private final IFlwTaskService taskService; |
| | | private final IFlwInstanceService instanceService; |
| | | private final FlowProcessEventHandler flowProcessEventHandler; |
| | | |
| | | /** |
| | | * å建çå¬å¨ï¼ä»»å¡åå»ºæ¶æ§è¡ |
| | | * |
| | | * @param listenerVariable çå¬å¨åé |
| | | */ |
| | | @Override |
| | | public void create(ListenerVariable listenerVariable) { |
| | | Instance instance = listenerVariable.getInstance(); |
| | | Definition definition = listenerVariable.getDefinition(); |
| | | String businessId = instance.getBusinessId(); |
| | | String flowStatus = instance.getFlowStatus(); |
| | | Task task = listenerVariable.getTask(); |
| | | if (task != null && BusinessStatusEnum.WAITING.getStatus().equals(flowStatus)) { |
| | | // 夿æµç¨ç¶æï¼åå¸å®¡æ¹ä¸äºä»¶ï¼ |
| | | flowProcessEventHandler.processTaskHandler(definition.getFlowCode(), task.getNodeCode(), task.getId(), businessId); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * å¼å§çå¬å¨ï¼ä»»å¡å¼å§åçæ¶æ§è¡ |
| | | * |
| | | * @param listenerVariable çå¬å¨åé |
| | | */ |
| | | @Override |
| | | public void start(ListenerVariable listenerVariable) { |
| | | } |
| | | |
| | | /** |
| | | * åæ´¾çå¬å¨ï¼å¨æä¿®æ¹ä»£åä»»å¡ä¿¡æ¯ |
| | | * |
| | | * @param listenerVariable çå¬å¨åé |
| | | */ |
| | | @Override |
| | | public void assignment(ListenerVariable listenerVariable) { |
| | | } |
| | | |
| | | /** |
| | | * 宿çå¬å¨ï¼å½åä»»å¡å®æåæ§è¡ |
| | | * |
| | | * @param listenerVariable çå¬å¨åé |
| | | */ |
| | | @Override |
| | | public void finish(ListenerVariable listenerVariable) { |
| | | Instance instance = listenerVariable.getInstance(); |
| | | Definition definition = listenerVariable.getDefinition(); |
| | | String businessId = instance.getBusinessId(); |
| | | String flowStatus = instance.getFlowStatus(); |
| | | Map<String, Object> params = new HashMap<>(); |
| | | FlowParams flowParams = listenerVariable.getFlowParams(); |
| | | if (ObjectUtil.isNotNull(flowParams)) { |
| | | // åå²ä»»å¡æ©å±(é常为éä»¶) |
| | | params.put("hisTaskExt", flowParams.getHisTaskExt()); |
| | | // åç人 |
| | | params.put("handler", flowParams.getHandler()); |
| | | // åçæè§ |
| | | params.put("message", flowParams.getMessage()); |
| | | } |
| | | // 夿æµç¨ç¶æï¼åå¸ï¼æ¤éï¼éåï¼ä½åºï¼ç»æ¢ï¼å·²å®æäºä»¶ï¼ |
| | | String status = determineFlowStatus(instance, flowStatus); |
| | | if (StringUtils.isNotBlank(status)) { |
| | | flowProcessEventHandler.processHandler(definition.getFlowCode(), businessId, status, params, false); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®æµç¨å®ä¾åå½åæµç¨ç¶æç¡®å®æç»ç¶æ |
| | | * |
| | | * @param instance æµç¨å®ä¾ |
| | | * @param flowStatus æµç¨å®ä¾å½åç¶æ |
| | | * @return æµç¨æç»ç¶æ |
| | | */ |
| | | private String determineFlowStatus(Instance instance, String flowStatus) { |
| | | if (StringUtils.isNotBlank(flowStatus) && BusinessStatusEnum.initialState(flowStatus)) { |
| | | log.info("æµç¨å®ä¾å½åç¶æ: {}", flowStatus); |
| | | return flowStatus; |
| | | } else { |
| | | Long instanceId = instance.getId(); |
| | | List<FlowTask> flowTasks = taskService.selectByInstId(instanceId); |
| | | if (CollUtil.isEmpty(flowTasks)) { |
| | | String status = BusinessStatusEnum.FINISH.getStatus(); |
| | | // æ´æ°æµç¨ç¶æä¸ºå·²å®æ |
| | | instanceService.updateStatus(instanceId, status); |
| | | log.info("æµç¨å·²ç»æï¼ç¶ææ´æ°ä¸º: {}", status); |
| | | return status; |
| | | } |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import org.dromara.common.mybatis.annotation.DataColumn; |
| | | import org.dromara.common.mybatis.annotation.DataPermission; |
| | | import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; |
| | | import org.dromara.common.mybatis.helper.DataBaseHelper; |
| | | import org.dromara.workflow.domain.FlowCategory; |
| | | import org.dromara.workflow.domain.vo.FlowCategoryVo; |
| | | |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | import java.util.stream.Stream; |
| | | |
| | | /** |
| | | * æµç¨åç±»Mapperæ¥å£ |
| | | * |
| | | * @author may |
| | | * @date 2023-06-27 |
| | | */ |
| | | public interface FlwCategoryMapper extends BaseMapperPlus<FlowCategory, FlowCategoryVo> { |
| | | |
| | | /** |
| | | * ç»è®¡æå®æµç¨åç±»IDçåç±»æ°é |
| | | * |
| | | * @param categoryId æµç¨åç±»ID |
| | | * @return 该æµç¨åç±»IDçåç±»æ°é |
| | | */ |
| | | @DataPermission({ |
| | | @DataColumn(key = "deptName", value = "createDept") |
| | | }) |
| | | long countCategoryById(Long categoryId); |
| | | |
| | | /** |
| | | * æ ¹æ®ç¶æµç¨åç±»IDæ¥è¯¢å
¶ææåæµç¨åç±»çå表 |
| | | * |
| | | * @param parentId ç¶æµç¨åç±»ID |
| | | * @return å
å«åæµç¨åç±»çå表 |
| | | */ |
| | | default List<FlowCategory> selectListByParentId(Long parentId) { |
| | | return this.selectList(new LambdaQueryWrapper<FlowCategory>() |
| | | .select(FlowCategory::getCategoryId) |
| | | .apply(DataBaseHelper.findInSet(parentId, "ancestors"))); |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®ç¶æµç¨åç±»IDæ¥è¯¢å
æ¬ç¶IDåå
¶ææåæµç¨åç±»IDçå表 |
| | | * |
| | | * @param parentId ç¶æµç¨åç±»ID |
| | | * @return å
å«ç¶IDååæµç¨åç±»IDçå表 |
| | | */ |
| | | default List<Long> selectCategoryIdsByParentId(Long parentId) { |
| | | return Stream.concat( |
| | | this.selectListByParentId(parentId).stream() |
| | | .map(FlowCategory::getCategoryId), |
| | | Stream.of(parentId) |
| | | ).collect(Collectors.toList()); |
| | | } |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Constants; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.dromara.workflow.domain.bo.FlowInstanceBo; |
| | | import org.dromara.workflow.domain.vo.FlowInstanceVo; |
| | | |
| | | /** |
| | | * å®ä¾ä¿¡æ¯Mapperæ¥å£ |
| | | * |
| | | * @author may |
| | | * @date 2024-03-02 |
| | | */ |
| | | public interface FlwInstanceMapper { |
| | | |
| | | /** |
| | | * æµç¨å®ä¾ä¿¡æ¯ |
| | | * |
| | | * @param page å页 |
| | | * @param queryWrapper æ¡ä»¶ |
| | | * @return ç»æ |
| | | */ |
| | | Page<FlowInstanceVo> selectInstanceList(@Param("page") Page<FlowInstanceVo> page, @Param(Constants.WRAPPER) Wrapper<FlowInstanceBo> queryWrapper); |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Constants; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.dromara.workflow.domain.bo.FlowTaskBo; |
| | | import org.dromara.workflow.domain.vo.FlowHisTaskVo; |
| | | import org.dromara.workflow.domain.vo.FlowTaskVo; |
| | | |
| | | import java.util.List; |
| | | |
| | | |
| | | /** |
| | | * ä»»å¡ä¿¡æ¯Mapperæ¥å£ |
| | | * |
| | | * @author may |
| | | * @date 2024-03-02 |
| | | */ |
| | | public interface FlwTaskMapper { |
| | | |
| | | /** |
| | | * è·åå¾
åä¿¡æ¯ |
| | | * |
| | | * @param page å页 |
| | | * @param queryWrapper æ¡ä»¶ |
| | | * @return ç»æ |
| | | */ |
| | | Page<FlowTaskVo> getListRunTask(@Param("page") Page<FlowTaskVo> page, @Param(Constants.WRAPPER) Wrapper<FlowTaskBo> queryWrapper); |
| | | |
| | | /** |
| | | * è·åå¾
åä¿¡æ¯ |
| | | * |
| | | * @param queryWrapper æ¡ä»¶ |
| | | * @return ç»æ |
| | | */ |
| | | List<FlowTaskVo> getListRunTask(@Param(Constants.WRAPPER) Wrapper<FlowTaskBo> queryWrapper); |
| | | |
| | | /** |
| | | * è·åå·²å |
| | | * |
| | | * @param page å页 |
| | | * @param queryWrapper æ¡ä»¶ |
| | | * @return ç»æ |
| | | */ |
| | | Page<FlowHisTaskVo> getListFinishTask(@Param("page") Page<FlowTaskVo> page, @Param(Constants.WRAPPER) Wrapper<FlowTaskBo> queryWrapper); |
| | | |
| | | /** |
| | | * æ¥è¯¢å½åç¨æ·çæé |
| | | * |
| | | * @param page å页 |
| | | * @param queryWrapper æ¡ä»¶ |
| | | * @return ç»æ |
| | | */ |
| | | Page<FlowTaskVo> getTaskCopyByPage(@Param("page") Page<FlowTaskVo> page, @Param(Constants.WRAPPER) QueryWrapper<FlowTaskBo> queryWrapper); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.service; |
| | | |
| | | import cn.hutool.core.lang.tree.Tree; |
| | | import org.dromara.workflow.domain.bo.FlowCategoryBo; |
| | | import org.dromara.workflow.domain.vo.FlowCategoryVo; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * æµç¨åç±»Serviceæ¥å£ |
| | | * |
| | | * @author may |
| | | */ |
| | | public interface IFlwCategoryService { |
| | | |
| | | /** |
| | | * æ¥è¯¢æµç¨åç±» |
| | | * |
| | | * @param categoryId ä¸»é® |
| | | * @return æµç¨åç±» |
| | | */ |
| | | FlowCategoryVo queryById(Long categoryId); |
| | | |
| | | /** |
| | | * æ ¹æ®æµç¨åç±»IDæ¥è¯¢æµç¨åç±»åç§° |
| | | * |
| | | * @param categoryId æµç¨åç±»ID |
| | | * @return æµç¨åç±»åç§° |
| | | */ |
| | | String selectCategoryNameById(Long categoryId); |
| | | |
| | | /** |
| | | * æ¥è¯¢ç¬¦åæ¡ä»¶çæµç¨åç±»å表 |
| | | * |
| | | * @param bo æ¥è¯¢æ¡ä»¶ |
| | | * @return æµç¨åç±»å表 |
| | | */ |
| | | List<FlowCategoryVo> queryList(FlowCategoryBo bo); |
| | | |
| | | /** |
| | | * æ¥è¯¢æµç¨åç±»æ ç»æä¿¡æ¯ |
| | | * |
| | | * @param category æµç¨åç±»ä¿¡æ¯ |
| | | * @return æµç¨åç±»æ ä¿¡æ¯éå |
| | | */ |
| | | List<Tree<String>> selectCategoryTreeList(FlowCategoryBo category); |
| | | |
| | | /** |
| | | * æ ¡éªæµç¨åç±»æ¯å¦ææ°æ®æé |
| | | * |
| | | * @param categoryId æµç¨åç±»ID |
| | | */ |
| | | void checkCategoryDataScope(Long categoryId); |
| | | |
| | | /** |
| | | * æ ¡éªæµç¨åç±»åç§°æ¯å¦å¯ä¸ |
| | | * |
| | | * @param category æµç¨åç±»ä¿¡æ¯ |
| | | * @return ç»æ |
| | | */ |
| | | boolean checkCategoryNameUnique(FlowCategoryBo category); |
| | | |
| | | /** |
| | | * æ¥è¯¢æµç¨åç±»æ¯å¦å卿µç¨å®ä¹ |
| | | * |
| | | * @param categoryId æµç¨åç±»ID |
| | | * @return ç»æ true åå¨ false ä¸åå¨ |
| | | */ |
| | | boolean checkCategoryExistDefinition(Long categoryId); |
| | | |
| | | /** |
| | | * æ¯å¦å卿µç¨åç±»åèç¹ |
| | | * |
| | | * @param categoryId æµç¨åç±»ID |
| | | * @return ç»æ |
| | | */ |
| | | boolean hasChildByCategoryId(Long categoryId); |
| | | |
| | | /** |
| | | * æ°å¢æµç¨åç±» |
| | | * |
| | | * @param bo æµç¨åç±» |
| | | * @return æ¯å¦æ°å¢æå |
| | | */ |
| | | int insertByBo(FlowCategoryBo bo); |
| | | |
| | | /** |
| | | * ä¿®æ¹æµç¨åç±» |
| | | * |
| | | * @param bo æµç¨åç±» |
| | | * @return æ¯å¦ä¿®æ¹æå |
| | | */ |
| | | int updateByBo(FlowCategoryBo bo); |
| | | |
| | | /** |
| | | * å 餿µç¨åç±»ä¿¡æ¯ |
| | | * |
| | | * @param categoryId ä¸»é® |
| | | * @return æ¯å¦å 餿å |
| | | */ |
| | | int deleteWithValidById(Long categoryId); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.service; |
| | | |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import org.dromara.common.mybatis.core.page.PageQuery; |
| | | import org.dromara.common.mybatis.core.page.TableDataInfo; |
| | | import org.dromara.warm.flow.orm.entity.FlowDefinition; |
| | | import org.dromara.workflow.domain.vo.FlowDefinitionVo; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * æµç¨å®ä¹ æå¡å± |
| | | * |
| | | * @author may |
| | | */ |
| | | public interface IFlwDefinitionService { |
| | | |
| | | /** |
| | | * æ¥è¯¢æµç¨å®ä¹å表 |
| | | * |
| | | * @param flowDefinition åæ° |
| | | * @param pageQuery å页 |
| | | * @return è¿åå页å表 |
| | | */ |
| | | TableDataInfo<FlowDefinitionVo> queryList(FlowDefinition flowDefinition, PageQuery pageQuery); |
| | | |
| | | /** |
| | | * æ¥è¯¢æªåå¸çæµç¨å®ä¹å表 |
| | | * |
| | | * @param flowDefinition åæ° |
| | | * @param pageQuery å页 |
| | | * @return è¿åå页å表 |
| | | */ |
| | | TableDataInfo<FlowDefinitionVo> unPublishList(FlowDefinition flowDefinition, PageQuery pageQuery); |
| | | |
| | | |
| | | /** |
| | | * å叿µç¨å®ä¹ |
| | | * |
| | | * @param id æµç¨å®ä¹id |
| | | * @return ç»æ |
| | | */ |
| | | boolean publish(Long id); |
| | | |
| | | /** |
| | | * å¯¼åºæµç¨å®ä¹ |
| | | * |
| | | * @param id æµç¨å®ä¹id |
| | | * @param response ååº |
| | | * @throws IOException å¼å¸¸ |
| | | */ |
| | | void exportDef(Long id, HttpServletResponse response) throws IOException; |
| | | |
| | | /** |
| | | * 导å
¥æµç¨å®ä¹ |
| | | * |
| | | * @param file æä»¶ |
| | | * @param category åç±» |
| | | * @return ç»æ |
| | | */ |
| | | boolean importJson(MultipartFile file, String category); |
| | | |
| | | /** |
| | | * å 餿µç¨å®ä¹ |
| | | * |
| | | * @param ids æµç¨å®ä¹id |
| | | * @return ç»æ |
| | | */ |
| | | boolean removeDef(List<Long> ids); |
| | | |
| | | /** |
| | | * æ°å¢ç§æ·æµç¨å®ä¹ |
| | | * |
| | | * @param tenantId ç§æ·id |
| | | */ |
| | | void syncDef(String tenantId); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.service; |
| | | |
| | | import org.dromara.common.mybatis.core.page.PageQuery; |
| | | import org.dromara.common.mybatis.core.page.TableDataInfo; |
| | | import org.dromara.warm.flow.orm.entity.FlowInstance; |
| | | import org.dromara.workflow.domain.bo.FlowCancelBo; |
| | | import org.dromara.workflow.domain.bo.FlowInstanceBo; |
| | | import org.dromara.workflow.domain.bo.FlowInvalidBo; |
| | | import org.dromara.workflow.domain.vo.FlowInstanceVo; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * æµç¨å®ä¾ æå¡å± |
| | | * |
| | | * @author may |
| | | */ |
| | | public interface IFlwInstanceService { |
| | | |
| | | /** |
| | | * å页æ¥è¯¢æ£å¨è¿è¡çæµç¨å®ä¾ |
| | | * |
| | | * @param flowInstanceBo æµç¨å®ä¾ |
| | | * @param pageQuery å页 |
| | | * @return ç»æ |
| | | */ |
| | | TableDataInfo<FlowInstanceVo> selectRunningInstanceList(FlowInstanceBo flowInstanceBo, PageQuery pageQuery); |
| | | |
| | | /** |
| | | * å页æ¥è¯¢å·²ç»æçæµç¨å®ä¾ |
| | | * |
| | | * @param flowInstanceBo æµç¨å®ä¾ |
| | | * @param pageQuery å页 |
| | | * @return ç»æ |
| | | */ |
| | | TableDataInfo<FlowInstanceVo> selectFinishInstanceList(FlowInstanceBo flowInstanceBo, PageQuery pageQuery); |
| | | |
| | | /** |
| | | * æ ¹æ®ä¸å¡idæ¥è¯¢æµç¨å®ä¾è¯¦ç»ä¿¡æ¯ |
| | | * |
| | | * @param businessId ä¸å¡id |
| | | * @return ç»æ |
| | | */ |
| | | FlowInstanceVo queryByBusinessId(Long businessId); |
| | | |
| | | /** |
| | | * æç
§ä¸å¡idæ¥è¯¢æµç¨å®ä¾ |
| | | * |
| | | * @param businessId ä¸å¡id |
| | | * @return ç»æ |
| | | */ |
| | | FlowInstance selectInstByBusinessId(String businessId); |
| | | |
| | | /** |
| | | * æç
§å®ä¾idæ¥è¯¢æµç¨å®ä¾ |
| | | * |
| | | * @param instanceId å®ä¾id |
| | | * @return ç»æ |
| | | */ |
| | | FlowInstance selectInstById(Long instanceId); |
| | | |
| | | /** |
| | | * æç
§å®ä¾idæ¥è¯¢æµç¨å®ä¾ |
| | | * |
| | | * @param instanceIds å®ä¾id |
| | | * @return ç»æ |
| | | */ |
| | | List<FlowInstance> selectInstListByIdList(List<Long> instanceIds); |
| | | |
| | | /** |
| | | * æç
§ä¸å¡idå 餿µç¨å®ä¾ |
| | | * |
| | | * @param businessIds ä¸å¡id |
| | | * @return ç»æ |
| | | */ |
| | | boolean deleteByBusinessIds(List<Long> businessIds); |
| | | |
| | | /** |
| | | * æç
§å®ä¾idå 餿µç¨å®ä¾ |
| | | * |
| | | * @param instanceIds å®ä¾id |
| | | * @return ç»æ |
| | | */ |
| | | boolean deleteByInstanceIds(List<Long> instanceIds); |
| | | |
| | | /** |
| | | * æ¤éæµç¨ |
| | | * |
| | | * @param bo åæ° |
| | | * @return ç»æ |
| | | */ |
| | | boolean cancelProcessApply(FlowCancelBo bo); |
| | | |
| | | /** |
| | | * è·åå½åç»é人åèµ·çæµç¨å®ä¾ |
| | | * |
| | | * @param instanceBo æµç¨å®ä¾ |
| | | * @param pageQuery å页 |
| | | * @return ç»æ |
| | | */ |
| | | TableDataInfo<FlowInstanceVo> selectCurrentInstanceList(FlowInstanceBo instanceBo, PageQuery pageQuery); |
| | | |
| | | /** |
| | | * è·åæµç¨å¾,æµç¨è®°å½ |
| | | * |
| | | * @param businessId ä¸å¡id |
| | | * @return ç»æ |
| | | */ |
| | | Map<String, Object> flowImage(String businessId); |
| | | |
| | | /** |
| | | * æç
§å®ä¾idæ´æ°ç¶æ |
| | | * |
| | | * @param instanceId å®ä¾id |
| | | * @param status ç¶æ |
| | | */ |
| | | void updateStatus(Long instanceId, String status); |
| | | |
| | | /** |
| | | * è·åæµç¨åé |
| | | * |
| | | * @param instanceId å®ä¾id |
| | | * @return ç»æ |
| | | */ |
| | | Map<String, Object> instanceVariable(Long instanceId); |
| | | |
| | | /** |
| | | * 设置æµç¨åé |
| | | * |
| | | * @param instanceId å®ä¾id |
| | | * @param variable æµç¨åé |
| | | */ |
| | | void setVariable(Long instanceId, Map<String, Object> variable); |
| | | |
| | | /** |
| | | * æä»»å¡idæ¥è¯¢å®ä¾ |
| | | * |
| | | * @param taskId ä»»å¡id |
| | | * @return ç»æ |
| | | */ |
| | | FlowInstance selectByTaskId(Long taskId); |
| | | |
| | | /** |
| | | * æä»»å¡idæ¥è¯¢å®ä¾ |
| | | * |
| | | * @param taskIdList ä»»å¡id |
| | | * @return ç»æ |
| | | */ |
| | | List<FlowInstance> selectByTaskIdList(List<Long> taskIdList); |
| | | |
| | | /** |
| | | * ä½åºæµç¨ |
| | | * |
| | | * @param bo æµç¨å®ä¾ |
| | | * @return ç»æ |
| | | */ |
| | | boolean processInvalid(FlowInvalidBo bo); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.service; |
| | | |
| | | import org.dromara.common.core.domain.dto.UserDTO; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * æµç¨è®¾è®¡å¨-è·ååç人 |
| | | * |
| | | * @author AprilWind |
| | | */ |
| | | public interface IFlwTaskAssigneeService { |
| | | |
| | | /** |
| | | * æ ¹æ®å卿 è¯ç¬¦ï¼storageIdï¼è§£æåé
ç±»ååIDï¼å¹¶è·å对åºçç¨æ·å表 |
| | | * |
| | | * @param storageId å
å«åé
ç±»ååIDçå符串ï¼ä¾å¦ "user:123" æ "role:456"ï¼ |
| | | * @return ä¸åé
ç±»ååIDå¹é
çç¨æ·å表ï¼å¦ææ ¼å¼æ æåè¿å空å表 |
| | | */ |
| | | List<UserDTO> fetchUsersByStorageId(String storageId); |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.service; |
| | | |
| | | import org.dromara.common.core.domain.dto.StartProcessReturnDTO; |
| | | import org.dromara.common.core.domain.dto.UserDTO; |
| | | import org.dromara.common.mybatis.core.page.PageQuery; |
| | | import org.dromara.common.mybatis.core.page.TableDataInfo; |
| | | import org.dromara.warm.flow.core.entity.Node; |
| | | import org.dromara.warm.flow.orm.entity.FlowHisTask; |
| | | import org.dromara.warm.flow.orm.entity.FlowTask; |
| | | import org.dromara.workflow.domain.bo.*; |
| | | import org.dromara.workflow.domain.vo.FlowHisTaskVo; |
| | | import org.dromara.workflow.domain.vo.FlowTaskVo; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * ä»»å¡ æå¡å± |
| | | * |
| | | * @author may |
| | | */ |
| | | public interface IFlwTaskService { |
| | | |
| | | /** |
| | | * å¯å¨ä»»å¡ |
| | | * |
| | | * @param startProcessBo å¯å¨æµç¨åæ° |
| | | * @return ç»æ |
| | | */ |
| | | StartProcessReturnDTO startWorkFlow(StartProcessBo startProcessBo); |
| | | |
| | | /** |
| | | * åçä»»å¡ |
| | | * |
| | | * @param completeTaskBo åçä»»å¡åæ° |
| | | * @return ç»æ |
| | | */ |
| | | boolean completeTask(CompleteTaskBo completeTaskBo); |
| | | |
| | | /** |
| | | * æ¥è¯¢å½åç¨æ·çå¾
åä»»å¡ |
| | | * |
| | | * @param flowTaskBo åæ° |
| | | * @param pageQuery å页 |
| | | * @return ç»æ |
| | | */ |
| | | TableDataInfo<FlowTaskVo> pageByTaskWait(FlowTaskBo flowTaskBo, PageQuery pageQuery); |
| | | |
| | | /** |
| | | * æ¥è¯¢å½åç§æ·ææå¾
åä»»å¡ |
| | | * |
| | | * @param flowTaskBo åæ° |
| | | * @param pageQuery å页 |
| | | * @return ç»æ |
| | | */ |
| | | TableDataInfo<FlowHisTaskVo> pageByTaskFinish(FlowTaskBo flowTaskBo, PageQuery pageQuery); |
| | | |
| | | /** |
| | | * æ¥è¯¢å¾
åä»»å¡ |
| | | * |
| | | * @param flowTaskBo åæ° |
| | | * @param pageQuery å页 |
| | | * @return ç»æ |
| | | */ |
| | | TableDataInfo<FlowTaskVo> pageByAllTaskWait(FlowTaskBo flowTaskBo, PageQuery pageQuery); |
| | | |
| | | /** |
| | | * æ¥è¯¢å·²åä»»å¡ |
| | | * |
| | | * @param flowTaskBo åæ° |
| | | * @param pageQuery å页 |
| | | * @return ç»æ |
| | | */ |
| | | TableDataInfo<FlowHisTaskVo> pageByAllTaskFinish(FlowTaskBo flowTaskBo, PageQuery pageQuery); |
| | | |
| | | /** |
| | | * æ¥è¯¢å½åç¨æ·çæé |
| | | * |
| | | * @param flowTaskBo åæ° |
| | | * @param pageQuery å页 |
| | | * @return ç»æ |
| | | */ |
| | | TableDataInfo<FlowTaskVo> pageByTaskCopy(FlowTaskBo flowTaskBo, PageQuery pageQuery); |
| | | |
| | | /** |
| | | * ä¿®æ¹ä»»å¡åç人 |
| | | * |
| | | * @param taskIdList ä»»å¡id |
| | | * @param userId ç¨æ·id |
| | | * @return ç»æ |
| | | */ |
| | | boolean updateAssignee(List<Long> taskIdList, String userId); |
| | | |
| | | /** |
| | | * 驳åå®¡æ¹ |
| | | * |
| | | * @param bo åæ° |
| | | * @return ç»æ |
| | | */ |
| | | boolean backProcess(BackProcessBo bo); |
| | | |
| | | /** |
| | | * è·åå¯é©³åçåç½®èç¹ |
| | | * |
| | | * @param definitionId æµç¨å®ä¹id |
| | | * @param nowNodeCode å½åèç¹ |
| | | * @return ç»æ |
| | | */ |
| | | List<Node> getBackTaskNode(Long definitionId, String nowNodeCode); |
| | | |
| | | /** |
| | | * ç»æ¢ä»»å¡ |
| | | * |
| | | * @param bo åæ° |
| | | * @return ç»æ |
| | | */ |
| | | boolean terminationTask(FlowTerminationBo bo); |
| | | |
| | | /** |
| | | * æç
§ä»»å¡idæ¥è¯¢ä»»å¡ |
| | | * |
| | | * @param taskIdList ä»»å¡id |
| | | * @return ç»æ |
| | | */ |
| | | List<FlowTask> selectByIdList(List<Long> taskIdList); |
| | | |
| | | /** |
| | | * æç
§ä»»å¡idæ¥è¯¢ä»»å¡ |
| | | * |
| | | * @param taskId ä»»å¡id |
| | | * @return ç»æ |
| | | */ |
| | | FlowTaskVo selectById(Long taskId); |
| | | |
| | | /** |
| | | * æç
§ä»»å¡idæ¥è¯¢ä»»å¡ |
| | | * |
| | | * @param taskIdList ä»»å¡id |
| | | * @return ç»æ |
| | | */ |
| | | List<FlowHisTask> selectHisTaskByIdList(List<Long> taskIdList); |
| | | |
| | | /** |
| | | * æç
§ä»»å¡idæ¥è¯¢ä»»å¡ |
| | | * |
| | | * @param taskId ä»»å¡id |
| | | * @return ç»æ |
| | | */ |
| | | FlowHisTask selectHisTaskById(Long taskId); |
| | | |
| | | /** |
| | | * æç
§å®ä¾idæ¥è¯¢ä»»å¡ |
| | | * |
| | | * @param instanceIdList æµç¨å®ä¾id |
| | | * @return ç»æ |
| | | */ |
| | | List<FlowTask> selectByInstIdList(List<Long> instanceIdList); |
| | | |
| | | /** |
| | | * æç
§å®ä¾idæ¥è¯¢ä»»å¡ |
| | | * |
| | | * @param instanceId æµç¨å®ä¾id |
| | | * @return ç»æ |
| | | */ |
| | | List<FlowTask> selectByInstId(Long instanceId); |
| | | |
| | | /** |
| | | * ä»»å¡æä½ |
| | | * |
| | | * @param bo åæ° |
| | | * @param taskOperation æä½ç±»åï¼å§æ´¾ delegateTaskã转å transferTaskãå ç¾ addSignatureãåç¾ reductionSignature |
| | | * @return ç»æ |
| | | */ |
| | | boolean taskOperation(TaskOperationBo bo, String taskOperation); |
| | | |
| | | /** |
| | | * è·å任塿æåç人 |
| | | * |
| | | * @param taskIdList ä»»å¡id |
| | | * @return ç»æ |
| | | */ |
| | | Map<Long, List<UserDTO>> currentTaskAllUser(List<Long> taskIdList); |
| | | |
| | | /** |
| | | * è·åå½åä»»å¡çææåç人 |
| | | * |
| | | * @param taskId ä»»å¡id |
| | | * @return ç»æ |
| | | */ |
| | | List<UserDTO> currentTaskAllUser(Long taskId); |
| | | } |
| | |
| | | import org.dromara.workflow.domain.bo.TestLeaveBo; |
| | | import org.dromara.workflow.domain.vo.TestLeaveVo; |
| | | |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | /** |
| | | * æ ¡éªå¹¶æ¹éå é¤è¯·åä¿¡æ¯ |
| | | */ |
| | | Boolean deleteWithValidByIds(Collection<Long> ids); |
| | | Boolean deleteWithValidByIds(List<Long> ids); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.service.impl; |
| | | |
| | | import cn.hutool.core.convert.Convert; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.dromara.common.translation.annotation.TranslationType; |
| | | import org.dromara.common.translation.core.TranslationInterface; |
| | | import org.dromara.workflow.common.ConditionalOnEnable; |
| | | import org.dromara.workflow.common.constant.FlowConstant; |
| | | import org.dromara.workflow.service.IFlwCategoryService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * æµç¨åç±»åç§°ç¿»è¯å®ç° |
| | | * |
| | | * @author AprilWind |
| | | */ |
| | | @ConditionalOnEnable |
| | | @Slf4j |
| | | @RequiredArgsConstructor |
| | | @Service |
| | | @TranslationType(type = FlowConstant.CATEGORY_ID_TO_NAME) |
| | | public class CategoryNameTranslationImpl implements TranslationInterface<String> { |
| | | |
| | | private final IFlwCategoryService flwCategoryService; |
| | | |
| | | @Override |
| | | public String translation(Object key, String other) { |
| | | Long id = null; |
| | | if (key instanceof String categoryId) { |
| | | id = Convert.toLong(categoryId); |
| | | } else if (key instanceof Long categoryId) { |
| | | id = categoryId; |
| | | } |
| | | return flwCategoryService.selectCategoryNameById(id); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.service.impl; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.lang.tree.Tree; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.dromara.common.core.constant.SystemConstants; |
| | | import org.dromara.common.core.exception.ServiceException; |
| | | import org.dromara.common.core.utils.*; |
| | | import org.dromara.common.mybatis.helper.DataBaseHelper; |
| | | import org.dromara.common.satoken.utils.LoginHelper; |
| | | import org.dromara.warm.flow.core.service.DefService; |
| | | import org.dromara.warm.flow.orm.entity.FlowDefinition; |
| | | import org.dromara.workflow.common.ConditionalOnEnable; |
| | | import org.dromara.workflow.common.constant.FlowConstant; |
| | | import org.dromara.workflow.domain.FlowCategory; |
| | | import org.dromara.workflow.domain.bo.FlowCategoryBo; |
| | | import org.dromara.workflow.domain.vo.FlowCategoryVo; |
| | | import org.dromara.workflow.mapper.FlwCategoryMapper; |
| | | import org.dromara.workflow.service.IFlwCategoryService; |
| | | import org.springframework.cache.annotation.CacheEvict; |
| | | import org.springframework.cache.annotation.Cacheable; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * æµç¨åç±»Serviceä¸å¡å±å¤ç |
| | | * |
| | | * @author may |
| | | */ |
| | | @ConditionalOnEnable |
| | | @RequiredArgsConstructor |
| | | @Service |
| | | public class FlwCategoryServiceImpl implements IFlwCategoryService { |
| | | |
| | | private final DefService defService; |
| | | private final FlwCategoryMapper baseMapper; |
| | | |
| | | /** |
| | | * æ¥è¯¢æµç¨åç±» |
| | | * |
| | | * @param categoryId ä¸»é® |
| | | * @return æµç¨åç±» |
| | | */ |
| | | @Override |
| | | public FlowCategoryVo queryById(Long categoryId) { |
| | | FlowCategoryVo category = baseMapper.selectVoById(categoryId); |
| | | if (ObjectUtil.isNull(category)) { |
| | | return null; |
| | | } |
| | | FlowCategoryVo parentCategory = baseMapper.selectVoOne(new LambdaQueryWrapper<FlowCategory>() |
| | | .select(FlowCategory::getCategoryName).eq(FlowCategory::getCategoryId, category.getParentId())); |
| | | category.setParentName(ObjectUtils.notNullGetter(parentCategory, FlowCategoryVo::getCategoryName)); |
| | | return category; |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®æµç¨åç±»IDæ¥è¯¢æµç¨åç±»åç§° |
| | | * |
| | | * @param categoryId æµç¨åç±»ID |
| | | * @return æµç¨åç±»åç§° |
| | | */ |
| | | @Cacheable(cacheNames = FlowConstant.FLOW_CATEGORY_NAME, key = "#categoryId") |
| | | @Override |
| | | public String selectCategoryNameById(Long categoryId) { |
| | | if (ObjectUtil.isNull(categoryId)) { |
| | | return null; |
| | | } |
| | | FlowCategory category = baseMapper.selectOne(new LambdaQueryWrapper<FlowCategory>() |
| | | .select(FlowCategory::getCategoryName).eq(FlowCategory::getCategoryId, categoryId)); |
| | | return ObjectUtils.notNullGetter(category, FlowCategory::getCategoryName); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢ç¬¦åæ¡ä»¶çæµç¨åç±»å表 |
| | | * |
| | | * @param bo æ¥è¯¢æ¡ä»¶ |
| | | * @return æµç¨åç±»å表 |
| | | */ |
| | | @Override |
| | | public List<FlowCategoryVo> queryList(FlowCategoryBo bo) { |
| | | LambdaQueryWrapper<FlowCategory> lqw = buildQueryWrapper(bo); |
| | | return baseMapper.selectVoList(lqw); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢æµç¨åç±»æ ç»æä¿¡æ¯ |
| | | * |
| | | * @param category æµç¨åç±»ä¿¡æ¯ |
| | | * @return æµç¨åç±»æ ä¿¡æ¯éå |
| | | */ |
| | | @Override |
| | | public List<Tree<String>> selectCategoryTreeList(FlowCategoryBo category) { |
| | | LambdaQueryWrapper<FlowCategory> lqw = buildQueryWrapper(category); |
| | | List<FlowCategoryVo> categorys = baseMapper.selectVoList(lqw); |
| | | if (CollUtil.isEmpty(categorys)) { |
| | | return CollUtil.newArrayList(); |
| | | } |
| | | // è·åå½ååè¡¨ä¸æ¯ä¸ä¸ªèç¹çparentIdï¼ç¶åå¨åè¡¨ä¸æ¥æ¾æ¯å¦æidä¸å
¶parentId对åºï¼è¥æ 对åºï¼åè¡¨ææ¤æ¶èç¹å表ä¸ï¼è¯¥èç¹å¨å½åå表ä¸å±äºé¡¶çº§èç¹ |
| | | List<Tree<String>> treeList = CollUtil.newArrayList(); |
| | | for (FlowCategoryVo d : categorys) { |
| | | String parentId = d.getParentId().toString(); |
| | | FlowCategoryVo categoryVo = StreamUtils.findFirst(categorys, it -> it.getCategoryId().toString().equals(parentId)); |
| | | if (ObjectUtil.isNull(categoryVo)) { |
| | | List<Tree<String>> trees = TreeBuildUtils.build(categorys, parentId, (dept, tree) -> |
| | | tree.setId(dept.getCategoryId().toString()) |
| | | .setParentId(dept.getParentId().toString()) |
| | | .setName(dept.getCategoryName()) |
| | | .setWeight(dept.getOrderNum())); |
| | | Tree<String> tree = StreamUtils.findFirst(trees, it -> it.getId().equals(d.getCategoryId().toString())); |
| | | treeList.add(tree); |
| | | } |
| | | } |
| | | return treeList; |
| | | } |
| | | |
| | | /** |
| | | * æ ¡éªæµç¨åç±»æ¯å¦ææ°æ®æé |
| | | * |
| | | * @param categoryId æµç¨åç±»ID |
| | | */ |
| | | @Override |
| | | public void checkCategoryDataScope(Long categoryId) { |
| | | if (ObjectUtil.isNull(categoryId)) { |
| | | return; |
| | | } |
| | | if (LoginHelper.isSuperAdmin()) { |
| | | return; |
| | | } |
| | | if (baseMapper.countCategoryById(categoryId) == 0) { |
| | | throw new ServiceException("没ææéè®¿é®æµç¨åç±»æ°æ®ï¼"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * æ ¡éªæµç¨åç±»åç§°æ¯å¦å¯ä¸ |
| | | * |
| | | * @param category æµç¨åç±»ä¿¡æ¯ |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public boolean checkCategoryNameUnique(FlowCategoryBo category) { |
| | | boolean exist = baseMapper.exists(new LambdaQueryWrapper<FlowCategory>() |
| | | .eq(FlowCategory::getCategoryName, category.getCategoryName()) |
| | | .eq(FlowCategory::getParentId, category.getParentId()) |
| | | .ne(ObjectUtil.isNotNull(category.getCategoryId()), FlowCategory::getCategoryId, category.getCategoryId())); |
| | | return !exist; |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢æµç¨åç±»æ¯å¦å卿µç¨å®ä¹ |
| | | * |
| | | * @param categoryId æµç¨åç±»ID |
| | | * @return ç»æ true åå¨ false ä¸åå¨ |
| | | */ |
| | | @Override |
| | | public boolean checkCategoryExistDefinition(Long categoryId) { |
| | | FlowDefinition definition = new FlowDefinition(); |
| | | definition.setCategory(categoryId.toString()); |
| | | return defService.exists(definition); |
| | | } |
| | | |
| | | /** |
| | | * æ¯å¦å卿µç¨åç±»åèç¹ |
| | | * |
| | | * @param categoryId æµç¨åç±»ID |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public boolean hasChildByCategoryId(Long categoryId) { |
| | | return baseMapper.exists(new LambdaQueryWrapper<FlowCategory>() |
| | | .eq(FlowCategory::getParentId, categoryId)); |
| | | } |
| | | |
| | | private LambdaQueryWrapper<FlowCategory> buildQueryWrapper(FlowCategoryBo bo) { |
| | | LambdaQueryWrapper<FlowCategory> lqw = Wrappers.lambdaQuery(); |
| | | lqw.eq(FlowCategory::getDelFlag, SystemConstants.NORMAL); |
| | | lqw.eq(ObjectUtil.isNotNull(bo.getCategoryId()), FlowCategory::getCategoryId, bo.getCategoryId()); |
| | | lqw.eq(ObjectUtil.isNotNull(bo.getParentId()), FlowCategory::getParentId, bo.getParentId()); |
| | | lqw.like(StringUtils.isNotBlank(bo.getCategoryName()), FlowCategory::getCategoryName, bo.getCategoryName()); |
| | | lqw.orderByAsc(FlowCategory::getAncestors); |
| | | lqw.orderByAsc(FlowCategory::getParentId); |
| | | lqw.orderByAsc(FlowCategory::getOrderNum); |
| | | lqw.orderByAsc(FlowCategory::getCategoryId); |
| | | return lqw; |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢æµç¨åç±» |
| | | * |
| | | * @param bo æµç¨åç±» |
| | | * @return æ¯å¦æ°å¢æå |
| | | */ |
| | | @Override |
| | | public int insertByBo(FlowCategoryBo bo) { |
| | | FlowCategory info = baseMapper.selectById(bo.getParentId()); |
| | | FlowCategory category = MapstructUtils.convert(bo, FlowCategory.class); |
| | | category.setAncestors(info.getAncestors() + StringUtils.SEPARATOR + category.getParentId()); |
| | | return baseMapper.insert(category); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹æµç¨åç±» |
| | | * |
| | | * @param bo æµç¨åç±» |
| | | * @return æ¯å¦ä¿®æ¹æå |
| | | */ |
| | | @CacheEvict(cacheNames = FlowConstant.FLOW_CATEGORY_NAME, key = "#bo.categoryId") |
| | | @Override |
| | | public int updateByBo(FlowCategoryBo bo) { |
| | | FlowCategory category = MapstructUtils.convert(bo, FlowCategory.class); |
| | | FlowCategory oldCategory = baseMapper.selectById(category.getCategoryId()); |
| | | if (ObjectUtil.isNull(oldCategory)) { |
| | | throw new ServiceException("æµç¨åç±»ä¸åå¨ï¼æ æ³ä¿®æ¹"); |
| | | } |
| | | if (!oldCategory.getParentId().equals(category.getParentId())) { |
| | | // å¦ææ¯æ°ç¶æµç¨åç±» åæ ¡éªæ¯å¦å
·ææ°ç¶æµç¨åç±»æé é¿å
è¶æ |
| | | this.checkCategoryDataScope(category.getParentId()); |
| | | FlowCategory newParentCategory = baseMapper.selectById(category.getParentId()); |
| | | if (ObjectUtil.isNotNull(newParentCategory)) { |
| | | String newAncestors = newParentCategory.getAncestors() + StringUtils.SEPARATOR + newParentCategory.getCategoryId(); |
| | | String oldAncestors = oldCategory.getAncestors(); |
| | | category.setAncestors(newAncestors); |
| | | updateCategoryChildren(category.getCategoryId(), newAncestors, oldAncestors); |
| | | } |
| | | } else { |
| | | category.setAncestors(oldCategory.getAncestors()); |
| | | } |
| | | return baseMapper.updateById(category); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹åå
ç´ å
³ç³» |
| | | * |
| | | * @param categoryId 被修æ¹çæµç¨åç±»ID |
| | | * @param newAncestors æ°çç¶IDéå |
| | | * @param oldAncestors æ§çç¶IDéå |
| | | */ |
| | | private void updateCategoryChildren(Long categoryId, String newAncestors, String oldAncestors) { |
| | | List<FlowCategory> children = baseMapper.selectList(new LambdaQueryWrapper<FlowCategory>() |
| | | .apply(DataBaseHelper.findInSet(categoryId, "ancestors"))); |
| | | List<FlowCategory> list = new ArrayList<>(); |
| | | for (FlowCategory child : children) { |
| | | FlowCategory category = new FlowCategory(); |
| | | category.setCategoryId(child.getCategoryId()); |
| | | category.setAncestors(child.getAncestors().replaceFirst(oldAncestors, newAncestors)); |
| | | list.add(category); |
| | | } |
| | | if (CollUtil.isNotEmpty(list)) { |
| | | baseMapper.updateBatchById(list); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * å 餿µç¨åç±»ä¿¡æ¯ |
| | | * |
| | | * @param categoryId ä¸»é® |
| | | * @return æ¯å¦å 餿å |
| | | */ |
| | | @CacheEvict(cacheNames = FlowConstant.FLOW_CATEGORY_NAME, key = "#categoryId") |
| | | @Override |
| | | public int deleteWithValidById(Long categoryId) { |
| | | return baseMapper.deleteById(categoryId); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.service.impl; |
| | | |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.convert.Convert; |
| | | import cn.hutool.core.io.IoUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.dromara.common.core.exception.ServiceException; |
| | | import org.dromara.common.core.utils.StreamUtils; |
| | | import org.dromara.common.core.utils.StringUtils; |
| | | import org.dromara.common.json.utils.JsonUtils; |
| | | import org.dromara.common.mybatis.core.page.PageQuery; |
| | | import org.dromara.common.mybatis.core.page.TableDataInfo; |
| | | import org.dromara.warm.flow.core.dto.DefJson; |
| | | import org.dromara.warm.flow.core.enums.NodeType; |
| | | import org.dromara.warm.flow.core.enums.PublishStatus; |
| | | import org.dromara.warm.flow.core.service.DefService; |
| | | import org.dromara.warm.flow.orm.entity.FlowDefinition; |
| | | import org.dromara.warm.flow.orm.entity.FlowHisTask; |
| | | import org.dromara.warm.flow.orm.entity.FlowNode; |
| | | import org.dromara.warm.flow.orm.entity.FlowSkip; |
| | | import org.dromara.warm.flow.orm.mapper.FlowDefinitionMapper; |
| | | import org.dromara.warm.flow.orm.mapper.FlowHisTaskMapper; |
| | | import org.dromara.warm.flow.orm.mapper.FlowNodeMapper; |
| | | import org.dromara.warm.flow.orm.mapper.FlowSkipMapper; |
| | | import org.dromara.workflow.common.ConditionalOnEnable; |
| | | import org.dromara.workflow.common.constant.FlowConstant; |
| | | import org.dromara.workflow.domain.FlowCategory; |
| | | import org.dromara.workflow.domain.vo.FlowDefinitionVo; |
| | | import org.dromara.workflow.mapper.FlwCategoryMapper; |
| | | import org.dromara.workflow.service.IFlwDefinitionService; |
| | | import org.dromara.workflow.utils.WorkflowUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.io.IOException; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | import static org.dromara.common.core.constant.TenantConstants.DEFAULT_TENANT_ID; |
| | | |
| | | /** |
| | | * æµç¨å®ä¹ æå¡å±å®ç° |
| | | * |
| | | * @author may |
| | | */ |
| | | @ConditionalOnEnable |
| | | @Slf4j |
| | | @RequiredArgsConstructor |
| | | @Service |
| | | public class FlwDefinitionServiceImpl implements IFlwDefinitionService { |
| | | |
| | | private final DefService defService; |
| | | private final FlowDefinitionMapper flowDefinitionMapper; |
| | | private final FlowHisTaskMapper flowHisTaskMapper; |
| | | private final FlowNodeMapper flowNodeMapper; |
| | | private final FlowSkipMapper flowSkipMapper; |
| | | private final FlwCategoryMapper flwCategoryMapper; |
| | | |
| | | /** |
| | | * æ¥è¯¢æµç¨å®ä¹å表 |
| | | * |
| | | * @param flowDefinition æµç¨å®ä¹ä¿¡æ¯ |
| | | * @param pageQuery å页 |
| | | * @return è¿åå页å表 |
| | | */ |
| | | @Override |
| | | public TableDataInfo<FlowDefinitionVo> queryList(FlowDefinition flowDefinition, PageQuery pageQuery) { |
| | | LambdaQueryWrapper<FlowDefinition> wrapper = buildQueryWrapper(flowDefinition); |
| | | wrapper.eq(FlowDefinition::getIsPublish, PublishStatus.PUBLISHED.getKey()); |
| | | Page<FlowDefinition> page = flowDefinitionMapper.selectPage(pageQuery.build(), wrapper); |
| | | TableDataInfo<FlowDefinitionVo> build = TableDataInfo.build(); |
| | | build.setRows(BeanUtil.copyToList(page.getRecords(), FlowDefinitionVo.class)); |
| | | build.setTotal(page.getTotal()); |
| | | return build; |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢æªåå¸çæµç¨å®ä¹å表 |
| | | * |
| | | * @param flowDefinition æµç¨å®ä¹ä¿¡æ¯ |
| | | * @param pageQuery å页 |
| | | * @return è¿åå页å表 |
| | | */ |
| | | @Override |
| | | public TableDataInfo<FlowDefinitionVo> unPublishList(FlowDefinition flowDefinition, PageQuery pageQuery) { |
| | | LambdaQueryWrapper<FlowDefinition> wrapper = buildQueryWrapper(flowDefinition); |
| | | wrapper.in(FlowDefinition::getIsPublish, Arrays.asList(PublishStatus.UNPUBLISHED.getKey(), PublishStatus.EXPIRED.getKey())); |
| | | Page<FlowDefinition> page = flowDefinitionMapper.selectPage(pageQuery.build(), wrapper); |
| | | TableDataInfo<FlowDefinitionVo> build = TableDataInfo.build(); |
| | | build.setRows(BeanUtil.copyToList(page.getRecords(), FlowDefinitionVo.class)); |
| | | build.setTotal(page.getTotal()); |
| | | return build; |
| | | } |
| | | |
| | | private LambdaQueryWrapper<FlowDefinition> buildQueryWrapper(FlowDefinition flowDefinition) { |
| | | LambdaQueryWrapper<FlowDefinition> wrapper = Wrappers.lambdaQuery(); |
| | | wrapper.like(StringUtils.isNotBlank(flowDefinition.getFlowCode()), FlowDefinition::getFlowCode, flowDefinition.getFlowCode()); |
| | | wrapper.like(StringUtils.isNotBlank(flowDefinition.getFlowName()), FlowDefinition::getFlowName, flowDefinition.getFlowName()); |
| | | if (StringUtils.isNotBlank(flowDefinition.getCategory())) { |
| | | List<Long> categoryIds = flwCategoryMapper.selectCategoryIdsByParentId(Convert.toLong(flowDefinition.getCategory())); |
| | | wrapper.in(FlowDefinition::getCategory, StreamUtils.toList(categoryIds, Convert::toStr)); |
| | | } |
| | | wrapper.orderByDesc(FlowDefinition::getCreateTime); |
| | | return wrapper; |
| | | } |
| | | |
| | | /** |
| | | * å叿µç¨å®ä¹ |
| | | * |
| | | * @param id æµç¨å®ä¹id |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean publish(Long id) { |
| | | List<FlowNode> flowNodes = flowNodeMapper.selectList(new LambdaQueryWrapper<FlowNode>().eq(FlowNode::getDefinitionId, id)); |
| | | List<String> errorMsg = new ArrayList<>(); |
| | | if (CollUtil.isNotEmpty(flowNodes)) { |
| | | for (FlowNode flowNode : flowNodes) { |
| | | String applyNodeCode = WorkflowUtils.applyNodeCode(id); |
| | | if (StringUtils.isBlank(flowNode.getPermissionFlag()) && !applyNodeCode.equals(flowNode.getNodeCode()) && NodeType.BETWEEN.getKey().equals(flowNode.getNodeType())) { |
| | | errorMsg.add(flowNode.getNodeName()); |
| | | } |
| | | } |
| | | if (CollUtil.isNotEmpty(errorMsg)) { |
| | | throw new ServiceException("èç¹ã" + StringUtils.join(errorMsg, ",") + "ãæªé
ç½®åç人!"); |
| | | } |
| | | } |
| | | return defService.publish(id); |
| | | } |
| | | |
| | | /** |
| | | * 导å
¥æµç¨å®ä¹ |
| | | * |
| | | * @param file æä»¶ |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean importJson(MultipartFile file, String category) { |
| | | try { |
| | | DefJson defJson = JsonUtils.parseObject(file.getBytes(), DefJson.class); |
| | | defJson.setCategory(category); |
| | | defService.importDef(defJson); |
| | | } catch (IOException e) { |
| | | log.error("读åæä»¶æµé误: {}", e.getMessage(), e); |
| | | throw new IllegalStateException("æä»¶è¯»å失败ï¼è¯·æ£æ¥æä»¶å
容", e); |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * å¯¼åºæµç¨å®ä¹ |
| | | * |
| | | * @param id æµç¨å®ä¹id |
| | | * @param response ååº |
| | | * @throws IOException å¼å¸¸ |
| | | */ |
| | | @Override |
| | | public void exportDef(Long id, HttpServletResponse response) throws IOException { |
| | | byte[] data = defService.exportJson(id).getBytes(StandardCharsets.UTF_8); |
| | | // 设置ååºå¤´åå
容类å |
| | | response.reset(); |
| | | response.setCharacterEncoding(StandardCharsets.UTF_8.name()); |
| | | response.setContentType("application/text"); |
| | | response.setHeader("Content-Disposition", "attachment;"); |
| | | response.addHeader("Content-Length", "" + data.length); |
| | | IoUtil.write(response.getOutputStream(), false, data); |
| | | } |
| | | |
| | | /** |
| | | * å 餿µç¨å®ä¹ |
| | | * |
| | | * @param ids æµç¨å®ä¹id |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean removeDef(List<Long> ids) { |
| | | LambdaQueryWrapper<FlowHisTask> wrapper = Wrappers.lambdaQuery(); |
| | | wrapper.in(FlowHisTask::getDefinitionId, ids); |
| | | List<FlowHisTask> flowHisTasks = flowHisTaskMapper.selectList(wrapper); |
| | | if (CollUtil.isNotEmpty(flowHisTasks)) { |
| | | List<FlowDefinition> flowDefinitions = flowDefinitionMapper.selectByIds(StreamUtils.toList(flowHisTasks, FlowHisTask::getDefinitionId)); |
| | | if (CollUtil.isNotEmpty(flowDefinitions)) { |
| | | String join = StreamUtils.join(flowDefinitions, FlowDefinition::getFlowCode); |
| | | log.error("æµç¨å®ä¹ã{}ã已被使ç¨ä¸å¯è¢«å é¤ï¼", join); |
| | | throw new ServiceException("æµç¨å®ä¹ã" + join + "ã已被使ç¨ä¸å¯è¢«å é¤ï¼"); |
| | | } |
| | | } |
| | | try { |
| | | defService.removeDef(ids); |
| | | } catch (Exception e) { |
| | | log.error("Error removing flow definitions: {}", e.getMessage(), e); |
| | | throw new RuntimeException("Failed to remove flow definitions", e); |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢ç§æ·æµç¨å®ä¹ |
| | | * |
| | | * @param tenantId ç§æ·id |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void syncDef(String tenantId) { |
| | | List<FlowDefinition> flowDefinitions = flowDefinitionMapper.selectList(new LambdaQueryWrapper<FlowDefinition>().eq(FlowDefinition::getTenantId, DEFAULT_TENANT_ID)); |
| | | if (CollUtil.isEmpty(flowDefinitions)) { |
| | | return; |
| | | } |
| | | FlowCategory flowCategory = flwCategoryMapper.selectOne(new LambdaQueryWrapper<FlowCategory>() |
| | | .eq(FlowCategory::getTenantId, DEFAULT_TENANT_ID).eq(FlowCategory::getCategoryId, FlowConstant.FLOW_CATEGORY_ID)); |
| | | flowCategory.setCategoryId(null); |
| | | flowCategory.setTenantId(tenantId); |
| | | flwCategoryMapper.insert(flowCategory); |
| | | List<Long> defIds = StreamUtils.toList(flowDefinitions, FlowDefinition::getId); |
| | | List<FlowNode> flowNodes = flowNodeMapper.selectList(new LambdaQueryWrapper<FlowNode>().in(FlowNode::getDefinitionId, defIds)); |
| | | List<FlowSkip> flowSkips = flowSkipMapper.selectList(new LambdaQueryWrapper<FlowSkip>().in(FlowSkip::getDefinitionId, defIds)); |
| | | for (FlowDefinition definition : flowDefinitions) { |
| | | FlowDefinition flowDefinition = BeanUtil.toBean(definition, FlowDefinition.class); |
| | | flowDefinition.setId(null); |
| | | flowDefinition.setTenantId(tenantId); |
| | | flowDefinition.setIsPublish(0); |
| | | flowDefinition.setCategory(String.valueOf(flowCategory.getCategoryId())); |
| | | int insert = flowDefinitionMapper.insert(flowDefinition); |
| | | if (insert <= 0) { |
| | | log.info("忥æµç¨å®ä¹ã{}ã失败ï¼", definition.getFlowCode()); |
| | | continue; |
| | | } |
| | | log.info("忥æµç¨å®ä¹ã{}ãæåï¼", definition.getFlowCode()); |
| | | Long definitionId = flowDefinition.getId(); |
| | | if (CollUtil.isNotEmpty(flowNodes)) { |
| | | List<FlowNode> nodes = StreamUtils.filter(flowNodes, node -> node.getDefinitionId().equals(definition.getId())); |
| | | if (CollUtil.isNotEmpty(nodes)) { |
| | | List<FlowNode> flowNodeList = BeanUtil.copyToList(nodes, FlowNode.class); |
| | | flowNodeList.forEach(e -> { |
| | | e.setId(null); |
| | | e.setDefinitionId(definitionId); |
| | | e.setTenantId(tenantId); |
| | | e.setPermissionFlag(null); |
| | | }); |
| | | flowNodeMapper.insertOrUpdate(flowNodeList); |
| | | } |
| | | } |
| | | if (CollUtil.isNotEmpty(flowSkips)) { |
| | | List<FlowSkip> skips = StreamUtils.filter(flowSkips, skip -> skip.getDefinitionId().equals(definition.getId())); |
| | | if (CollUtil.isNotEmpty(skips)) { |
| | | List<FlowSkip> flowSkipList = BeanUtil.copyToList(skips, FlowSkip.class); |
| | | flowSkipList.forEach(e -> { |
| | | e.setId(null); |
| | | e.setDefinitionId(definitionId); |
| | | e.setTenantId(tenantId); |
| | | }); |
| | | flowSkipMapper.insertOrUpdate(flowSkipList); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.service.impl; |
| | | |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.convert.Convert; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.dromara.common.core.domain.dto.UserDTO; |
| | | import org.dromara.common.core.enums.BusinessStatusEnum; |
| | | import org.dromara.common.core.exception.ServiceException; |
| | | import org.dromara.common.core.utils.StreamUtils; |
| | | import org.dromara.common.core.utils.StringUtils; |
| | | import org.dromara.common.mybatis.core.page.PageQuery; |
| | | import org.dromara.common.mybatis.core.page.TableDataInfo; |
| | | import org.dromara.common.satoken.utils.LoginHelper; |
| | | import org.dromara.warm.flow.core.FlowEngine; |
| | | import org.dromara.warm.flow.core.constant.ExceptionCons; |
| | | import org.dromara.warm.flow.core.dto.FlowParams; |
| | | import org.dromara.warm.flow.core.entity.Definition; |
| | | import org.dromara.warm.flow.core.entity.Instance; |
| | | import org.dromara.warm.flow.core.entity.Task; |
| | | import org.dromara.warm.flow.core.enums.NodeType; |
| | | import org.dromara.warm.flow.core.service.ChartService; |
| | | import org.dromara.warm.flow.core.service.DefService; |
| | | import org.dromara.warm.flow.core.service.InsService; |
| | | import org.dromara.warm.flow.core.service.TaskService; |
| | | import org.dromara.warm.flow.orm.entity.FlowHisTask; |
| | | import org.dromara.warm.flow.orm.entity.FlowInstance; |
| | | import org.dromara.warm.flow.orm.entity.FlowTask; |
| | | import org.dromara.warm.flow.orm.mapper.FlowHisTaskMapper; |
| | | import org.dromara.warm.flow.orm.mapper.FlowInstanceMapper; |
| | | import org.dromara.workflow.common.ConditionalOnEnable; |
| | | import org.dromara.workflow.common.enums.TaskStatusEnum; |
| | | import org.dromara.workflow.domain.bo.FlowCancelBo; |
| | | import org.dromara.workflow.domain.bo.FlowInstanceBo; |
| | | import org.dromara.workflow.domain.bo.FlowInvalidBo; |
| | | import org.dromara.workflow.domain.vo.FlowHisTaskVo; |
| | | import org.dromara.workflow.domain.vo.FlowInstanceVo; |
| | | import org.dromara.workflow.domain.vo.FlowVariableVo; |
| | | import org.dromara.workflow.handler.FlowProcessEventHandler; |
| | | import org.dromara.workflow.mapper.FlwCategoryMapper; |
| | | import org.dromara.workflow.mapper.FlwInstanceMapper; |
| | | import org.dromara.workflow.service.IFlwInstanceService; |
| | | import org.dromara.workflow.service.IFlwTaskService; |
| | | import org.dromara.workflow.utils.WorkflowUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * æµç¨å®ä¾ æå¡å±å®ç° |
| | | * |
| | | * @author may |
| | | */ |
| | | @ConditionalOnEnable |
| | | @Slf4j |
| | | @RequiredArgsConstructor |
| | | @Service |
| | | public class FlwInstanceServiceImpl implements IFlwInstanceService { |
| | | |
| | | private final InsService insService; |
| | | private final DefService defService; |
| | | private final ChartService chartService; |
| | | private final TaskService taskService; |
| | | private final FlowHisTaskMapper flowHisTaskMapper; |
| | | private final FlowInstanceMapper flowInstanceMapper; |
| | | private final FlowProcessEventHandler flowProcessEventHandler; |
| | | private final IFlwTaskService flwTaskService; |
| | | private final FlwInstanceMapper flwInstanceMapper; |
| | | private final FlwCategoryMapper flwCategoryMapper; |
| | | |
| | | /** |
| | | * å页æ¥è¯¢æ£å¨è¿è¡çæµç¨å®ä¾ |
| | | * |
| | | * @param flowInstanceBo æµç¨å®ä¾ |
| | | * @param pageQuery å页 |
| | | */ |
| | | @Override |
| | | public TableDataInfo<FlowInstanceVo> selectRunningInstanceList(FlowInstanceBo flowInstanceBo, PageQuery pageQuery) { |
| | | QueryWrapper<FlowInstanceBo> queryWrapper = buildQueryWrapper(flowInstanceBo); |
| | | queryWrapper.in("fi.flow_status", BusinessStatusEnum.runningStatus()); |
| | | Page<FlowInstanceVo> page = flwInstanceMapper.selectInstanceList(pageQuery.build(), queryWrapper); |
| | | return TableDataInfo.build(page); |
| | | } |
| | | |
| | | /** |
| | | * å页æ¥è¯¢å·²ç»æçæµç¨å®ä¾ |
| | | * |
| | | * @param flowInstanceBo æµç¨å®ä¾ |
| | | * @param pageQuery å页 |
| | | */ |
| | | @Override |
| | | public TableDataInfo<FlowInstanceVo> selectFinishInstanceList(FlowInstanceBo flowInstanceBo, PageQuery pageQuery) { |
| | | QueryWrapper<FlowInstanceBo> queryWrapper = buildQueryWrapper(flowInstanceBo); |
| | | queryWrapper.in("fi.flow_status", BusinessStatusEnum.finishStatus()); |
| | | Page<FlowInstanceVo> page = flwInstanceMapper.selectInstanceList(pageQuery.build(), queryWrapper); |
| | | return TableDataInfo.build(page); |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®ä¸å¡idæ¥è¯¢æµç¨å®ä¾è¯¦ç»ä¿¡æ¯ |
| | | * |
| | | * @param businessId ä¸å¡id |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public FlowInstanceVo queryByBusinessId(Long businessId) { |
| | | FlowInstance instance = this.selectInstByBusinessId(String.valueOf(businessId)); |
| | | FlowInstanceVo instanceVo = BeanUtil.toBean(instance, FlowInstanceVo.class); |
| | | Definition definition = defService.getById(instanceVo.getDefinitionId()); |
| | | instanceVo.setFlowName(definition.getFlowName()); |
| | | instanceVo.setFlowCode(definition.getFlowCode()); |
| | | instanceVo.setVersion(definition.getVersion()); |
| | | instanceVo.setFormCustom(definition.getFormCustom()); |
| | | instanceVo.setFormPath(definition.getFormPath()); |
| | | instanceVo.setCategory(definition.getCategory()); |
| | | return instanceVo; |
| | | } |
| | | |
| | | /** |
| | | * éç¨æ¥è¯¢æ¡ä»¶ |
| | | * |
| | | * @param flowInstanceBo æ¥è¯¢æ¡ä»¶ |
| | | * @return æ¥è¯¢æ¡ä»¶æé æ¹æ³ |
| | | */ |
| | | private QueryWrapper<FlowInstanceBo> buildQueryWrapper(FlowInstanceBo flowInstanceBo) { |
| | | QueryWrapper<FlowInstanceBo> queryWrapper = Wrappers.query(); |
| | | queryWrapper.like(StringUtils.isNotBlank(flowInstanceBo.getNodeName()), "fi.node_name", flowInstanceBo.getNodeName()); |
| | | queryWrapper.like(StringUtils.isNotBlank(flowInstanceBo.getFlowName()), "fd.flow_name", flowInstanceBo.getFlowName()); |
| | | queryWrapper.like(StringUtils.isNotBlank(flowInstanceBo.getFlowCode()), "fd.flow_code", flowInstanceBo.getFlowCode()); |
| | | if (StringUtils.isNotBlank(flowInstanceBo.getCategory())) { |
| | | List<Long> categoryIds = flwCategoryMapper.selectCategoryIdsByParentId(Convert.toLong(flowInstanceBo.getCategory())); |
| | | queryWrapper.in("fd.category", StreamUtils.toList(categoryIds, Convert::toStr)); |
| | | } |
| | | queryWrapper.eq(StringUtils.isNotBlank(flowInstanceBo.getBusinessId()), "fi.business_id", flowInstanceBo.getBusinessId()); |
| | | queryWrapper.in(CollUtil.isNotEmpty(flowInstanceBo.getCreateByIds()), "fi.create_by", flowInstanceBo.getCreateByIds()); |
| | | queryWrapper.eq("fi.del_flag", "0"); |
| | | queryWrapper.orderByDesc("fi.create_time"); |
| | | return queryWrapper; |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®ä¸å¡idæ¥è¯¢æµç¨å®ä¾ |
| | | * |
| | | * @param businessId ä¸å¡id |
| | | */ |
| | | @Override |
| | | public FlowInstance selectInstByBusinessId(String businessId) { |
| | | return flowInstanceMapper.selectOne(new LambdaQueryWrapper<FlowInstance>().eq(FlowInstance::getBusinessId, businessId)); |
| | | } |
| | | |
| | | /** |
| | | * æç
§å®ä¾idæ¥è¯¢æµç¨å®ä¾ |
| | | * |
| | | * @param instanceId å®ä¾id |
| | | */ |
| | | @Override |
| | | public FlowInstance selectInstById(Long instanceId) { |
| | | return flowInstanceMapper.selectById(instanceId); |
| | | } |
| | | |
| | | /** |
| | | * æç
§å®ä¾idæ¥è¯¢æµç¨å®ä¾ |
| | | * |
| | | * @param instanceIds å®ä¾id |
| | | */ |
| | | @Override |
| | | public List<FlowInstance> selectInstListByIdList(List<Long> instanceIds) { |
| | | return flowInstanceMapper.selectByIds(instanceIds); |
| | | } |
| | | |
| | | /** |
| | | * æç
§ä¸å¡idå 餿µç¨å®ä¾ |
| | | * |
| | | * @param businessIds ä¸å¡id |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean deleteByBusinessIds(List<Long> businessIds) { |
| | | List<FlowInstance> flowInstances = flowInstanceMapper.selectList(new LambdaQueryWrapper<FlowInstance>().in(FlowInstance::getBusinessId, businessIds)); |
| | | if (CollUtil.isEmpty(flowInstances)) { |
| | | log.warn("æªæ¾å°å¯¹åºçæµç¨å®ä¾ä¿¡æ¯ï¼æ æ³æ§è¡å 餿ä½ã"); |
| | | return false; |
| | | } |
| | | return insService.remove(StreamUtils.toList(flowInstances, FlowInstance::getId)); |
| | | } |
| | | |
| | | /** |
| | | * æç
§å®ä¾idå 餿µç¨å®ä¾ |
| | | * |
| | | * @param instanceIds å®ä¾id |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean deleteByInstanceIds(List<Long> instanceIds) { |
| | | // è·åå®ä¾ä¿¡æ¯ |
| | | List<Instance> instances = insService.getByIds(instanceIds); |
| | | if (CollUtil.isEmpty(instances)) { |
| | | log.warn("æªæ¾å°å¯¹åºçæµç¨å®ä¾ä¿¡æ¯ï¼æ æ³æ§è¡å 餿ä½ã"); |
| | | return false; |
| | | } |
| | | // è·åå®ä¹ä¿¡æ¯ |
| | | Map<Long, Definition> definitionMap = defService.getByIds( |
| | | StreamUtils.toList(instances, Instance::getDefinitionId) |
| | | ).stream().collect(Collectors.toMap(Definition::getId, definition -> definition)); |
| | | |
| | | // éä¸è§¦åå é¤äºä»¶ |
| | | instances.forEach(instance -> { |
| | | Definition definition = definitionMap.get(instance.getDefinitionId()); |
| | | if (ObjectUtil.isNull(definition)) { |
| | | log.warn("å®ä¾ ID: {} 对åºçæµç¨å®ä¹ä¿¡æ¯æªæ¾å°ï¼è·³è¿å é¤äºä»¶è§¦åã", instance.getId()); |
| | | return; |
| | | } |
| | | flowProcessEventHandler.processDeleteHandler(definition.getFlowCode(), instance.getBusinessId()); |
| | | }); |
| | | |
| | | // å é¤å®ä¾ |
| | | return insService.remove(instanceIds); |
| | | } |
| | | |
| | | /** |
| | | * æ¤éæµç¨ |
| | | * |
| | | * @param bo åæ° |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean cancelProcessApply(FlowCancelBo bo) { |
| | | try { |
| | | Instance instance = selectInstByBusinessId(bo.getBusinessId()); |
| | | if (instance == null) { |
| | | throw new ServiceException(ExceptionCons.NOT_FOUNT_INSTANCE); |
| | | } |
| | | Definition definition = defService.getById(instance.getDefinitionId()); |
| | | if (definition == null) { |
| | | throw new ServiceException(ExceptionCons.NOT_FOUNT_DEF); |
| | | } |
| | | String message = bo.getMessage(); |
| | | BusinessStatusEnum.checkCancelStatus(instance.getFlowStatus()); |
| | | String applyNodeCode = WorkflowUtils.applyNodeCode(definition.getId()); |
| | | //æ¤é |
| | | WorkflowUtils.backTask(message, instance.getId(), applyNodeCode, BusinessStatusEnum.CANCEL.getStatus(), BusinessStatusEnum.CANCEL.getStatus()); |
| | | //夿æç¾èç¹æ¯å¦æå¤ä¸ªï¼åªä¿çä¸ä¸ª |
| | | List<Task> currentTaskList = taskService.list(FlowEngine.newTask().setInstanceId(instance.getId())); |
| | | if (CollUtil.isNotEmpty(currentTaskList)) { |
| | | if (currentTaskList.size() > 1) { |
| | | currentTaskList.remove(0); |
| | | WorkflowUtils.deleteRunTask(StreamUtils.toList(currentTaskList, Task::getId)); |
| | | } |
| | | } |
| | | |
| | | } catch (Exception e) { |
| | | log.error("æ¤é失败: {}", e.getMessage(), e); |
| | | throw new ServiceException(e.getMessage()); |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * è·åå½åç»é人åèµ·çæµç¨å®ä¾ |
| | | * |
| | | * @param instanceBo æµç¨å®ä¾ |
| | | * @param pageQuery å页 |
| | | */ |
| | | @Override |
| | | public TableDataInfo<FlowInstanceVo> selectCurrentInstanceList(FlowInstanceBo instanceBo, PageQuery pageQuery) { |
| | | QueryWrapper<FlowInstanceBo> queryWrapper = buildQueryWrapper(instanceBo); |
| | | queryWrapper.eq("fi.create_by", LoginHelper.getUserIdStr()); |
| | | Page<FlowInstanceVo> page = flwInstanceMapper.selectInstanceList(pageQuery.build(), queryWrapper); |
| | | return TableDataInfo.build(page); |
| | | } |
| | | |
| | | /** |
| | | * è·åæµç¨å¾,æµç¨è®°å½ |
| | | * |
| | | * @param businessId ä¸å¡id |
| | | */ |
| | | @Override |
| | | public Map<String, Object> flowImage(String businessId) { |
| | | FlowInstance flowInstance = this.selectInstByBusinessId(businessId); |
| | | if (ObjectUtil.isNull(flowInstance)) { |
| | | throw new ServiceException(ExceptionCons.NOT_FOUNT_INSTANCE); |
| | | } |
| | | Long instanceId = flowInstance.getId(); |
| | | //è¿è¡ä¸çä»»å¡ |
| | | List<FlowHisTaskVo> list = new ArrayList<>(); |
| | | List<FlowTask> flowTaskList = flwTaskService.selectByInstId(instanceId); |
| | | if (CollUtil.isNotEmpty(flowTaskList)) { |
| | | List<FlowHisTaskVo> flowHisTaskVos = BeanUtil.copyToList(flowTaskList, FlowHisTaskVo.class); |
| | | for (FlowHisTaskVo flowHisTaskVo : flowHisTaskVos) { |
| | | flowHisTaskVo.setFlowStatus(TaskStatusEnum.WAITING.getStatus()); |
| | | flowHisTaskVo.setUpdateTime(null); |
| | | flowHisTaskVo.setRunDuration(null); |
| | | List<UserDTO> allUser = flwTaskService.currentTaskAllUser(flowHisTaskVo.getId()); |
| | | if (CollUtil.isNotEmpty(allUser)) { |
| | | String join = StreamUtils.join(allUser, e -> String.valueOf(e.getUserId())); |
| | | flowHisTaskVo.setApprover(join); |
| | | } |
| | | if (BusinessStatusEnum.isDraftOrCancelOrBack(flowInstance.getFlowStatus())) { |
| | | flowHisTaskVo.setApprover(LoginHelper.getUserIdStr()); |
| | | flowHisTaskVo.setApproveName(LoginHelper.getLoginUser().getNickname()); |
| | | } |
| | | } |
| | | list.addAll(flowHisTaskVos); |
| | | } |
| | | //åå²ä»»å¡ |
| | | LambdaQueryWrapper<FlowHisTask> wrapper = Wrappers.lambdaQuery(); |
| | | wrapper.eq(FlowHisTask::getInstanceId, instanceId); |
| | | wrapper.eq(FlowHisTask::getNodeType, NodeType.BETWEEN.getKey()); |
| | | wrapper.orderByDesc(FlowHisTask::getCreateTime).orderByDesc(FlowHisTask::getUpdateTime); |
| | | List<FlowHisTask> flowHisTasks = flowHisTaskMapper.selectList(wrapper); |
| | | if (CollUtil.isNotEmpty(flowHisTasks)) { |
| | | list.addAll(BeanUtil.copyToList(flowHisTasks, FlowHisTaskVo.class)); |
| | | } |
| | | String flowChart = chartService.chartIns(instanceId); |
| | | return Map.of("list", list, "image", flowChart); |
| | | } |
| | | |
| | | /** |
| | | * æç
§å®ä¾idæ´æ°ç¶æ |
| | | * |
| | | * @param instanceId å®ä¾id |
| | | * @param status ç¶æ |
| | | */ |
| | | @Override |
| | | public void updateStatus(Long instanceId, String status) { |
| | | LambdaUpdateWrapper<FlowInstance> wrapper = new LambdaUpdateWrapper<>(); |
| | | wrapper.set(FlowInstance::getFlowStatus, status); |
| | | wrapper.eq(FlowInstance::getId, instanceId); |
| | | flowInstanceMapper.update(wrapper); |
| | | } |
| | | |
| | | /** |
| | | * è·åæµç¨åé |
| | | * |
| | | * @param instanceId å®ä¾id |
| | | */ |
| | | @Override |
| | | public Map<String, Object> instanceVariable(Long instanceId) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | FlowInstance flowInstance = flowInstanceMapper.selectById(instanceId); |
| | | Map<String, Object> variableMap = flowInstance.getVariableMap(); |
| | | List<FlowVariableVo> list = new ArrayList<>(); |
| | | if (CollUtil.isNotEmpty(variableMap)) { |
| | | for (Map.Entry<String, Object> entry : variableMap.entrySet()) { |
| | | FlowVariableVo flowVariableVo = new FlowVariableVo(); |
| | | flowVariableVo.setKey(entry.getKey()); |
| | | flowVariableVo.setValue(entry.getValue().toString()); |
| | | list.add(flowVariableVo); |
| | | } |
| | | } |
| | | map.put("variableList", list); |
| | | map.put("variable", flowInstance.getVariable()); |
| | | return map; |
| | | } |
| | | |
| | | /** |
| | | * 设置æµç¨åé |
| | | * |
| | | * @param instanceId å®ä¾id |
| | | * @param variable æµç¨åé |
| | | */ |
| | | @Override |
| | | public void setVariable(Long instanceId, Map<String, Object> variable) { |
| | | Instance instance = insService.getById(instanceId); |
| | | if (instance != null) { |
| | | taskService.mergeVariable(instance, variable); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * æä»»å¡idæ¥è¯¢å®ä¾ |
| | | * |
| | | * @param taskId ä»»å¡id |
| | | */ |
| | | @Override |
| | | public FlowInstance selectByTaskId(Long taskId) { |
| | | Task task = taskService.getById(taskId); |
| | | if (task == null) { |
| | | FlowHisTask flowHisTask = flwTaskService.selectHisTaskById(taskId); |
| | | if (flowHisTask != null) { |
| | | return this.selectInstById(flowHisTask.getInstanceId()); |
| | | } |
| | | } else { |
| | | return this.selectInstById(task.getInstanceId()); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * æä»»å¡idæ¥è¯¢å®ä¾ |
| | | * |
| | | * @param taskIdList ä»»å¡id |
| | | */ |
| | | @Override |
| | | public List<FlowInstance> selectByTaskIdList(List<Long> taskIdList) { |
| | | if (CollUtil.isEmpty(taskIdList)) { |
| | | return Collections.emptyList(); |
| | | } |
| | | Set<Long> instanceIds = new HashSet<>(); |
| | | List<FlowTask> flowTaskList = flwTaskService.selectByIdList(taskIdList); |
| | | for (FlowTask flowTask : flowTaskList) { |
| | | instanceIds.add(flowTask.getInstanceId()); |
| | | } |
| | | List<FlowHisTask> flowHisTaskList = flwTaskService.selectHisTaskByIdList(taskIdList); |
| | | for (FlowHisTask flowHisTask : flowHisTaskList) { |
| | | instanceIds.add(flowHisTask.getInstanceId()); |
| | | } |
| | | if (!instanceIds.isEmpty()) { |
| | | return this.selectInstListByIdList(new ArrayList<>(instanceIds)); |
| | | } |
| | | return Collections.emptyList(); |
| | | } |
| | | |
| | | /** |
| | | * ä½åºæµç¨ |
| | | * |
| | | * @param bo åæ° |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean processInvalid(FlowInvalidBo bo) { |
| | | try { |
| | | Instance instance = insService.getById(bo.getId()); |
| | | if (instance != null) { |
| | | BusinessStatusEnum.checkInvalidStatus(instance.getFlowStatus()); |
| | | } |
| | | List<FlowTask> flowTaskList = flwTaskService.selectByInstId(bo.getId()); |
| | | for (FlowTask flowTask : flowTaskList) { |
| | | FlowParams flowParams = new FlowParams(); |
| | | flowParams.message(bo.getComment()); |
| | | flowParams.flowStatus(BusinessStatusEnum.INVALID.getStatus()) |
| | | .hisStatus(TaskStatusEnum.INVALID.getStatus()); |
| | | flowParams.ignore(true); |
| | | taskService.termination(flowTask.getId(), flowParams); |
| | | } |
| | | return true; |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage(), e); |
| | | throw new ServiceException(e.getMessage()); |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.service.impl; |
| | | |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.dromara.common.core.domain.dto.DeptDTO; |
| | | import org.dromara.common.core.domain.dto.TaskAssigneeDTO; |
| | | import org.dromara.common.core.domain.dto.UserDTO; |
| | | import org.dromara.common.core.domain.model.TaskAssigneeBody; |
| | | import org.dromara.common.core.enums.FormatsType; |
| | | import org.dromara.common.core.exception.ServiceException; |
| | | import org.dromara.common.core.service.DeptService; |
| | | import org.dromara.common.core.service.TaskAssigneeService; |
| | | import org.dromara.common.core.service.UserService; |
| | | import org.dromara.common.core.utils.DateUtils; |
| | | import org.dromara.common.core.utils.StringUtils; |
| | | import org.dromara.warm.flow.ui.dto.HandlerFunDto; |
| | | import org.dromara.warm.flow.ui.dto.HandlerQuery; |
| | | import org.dromara.warm.flow.ui.dto.TreeFunDto; |
| | | import org.dromara.warm.flow.ui.service.HandlerSelectService; |
| | | import org.dromara.warm.flow.ui.vo.HandlerSelectVo; |
| | | import org.dromara.workflow.common.ConditionalOnEnable; |
| | | import org.dromara.workflow.common.enums.TaskAssigneeEnum; |
| | | import org.dromara.workflow.service.IFlwTaskAssigneeService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Optional; |
| | | |
| | | /** |
| | | * æµç¨è®¾è®¡å¨-è·ååç人æé设置å表 |
| | | * |
| | | * @author AprilWind |
| | | */ |
| | | @ConditionalOnEnable |
| | | @Slf4j |
| | | @RequiredArgsConstructor |
| | | @Service |
| | | public class FlwTaskAssigneeServiceImpl implements IFlwTaskAssigneeService, HandlerSelectService { |
| | | |
| | | private static final String DEFAULT_GROUP_NAME = "é»è®¤åç»"; |
| | | private final TaskAssigneeService taskAssigneeService; |
| | | private final UserService userService; |
| | | private final DeptService deptService; |
| | | |
| | | /** |
| | | * è·ååç人æé设置å表tabsé¡µç¾ |
| | | * |
| | | * @return tabsé¡µç¾ |
| | | */ |
| | | @Override |
| | | public List<String> getHandlerType() { |
| | | return TaskAssigneeEnum.getAssigneeTypeList(); |
| | | } |
| | | |
| | | /** |
| | | * è·ååçå表, åæ¶æå»ºå·¦ä¾§é¨é¨æ ç¶ç»æ |
| | | * |
| | | * @param query æ¥è¯¢æ¡ä»¶ |
| | | * @return HandlerSelectVo |
| | | */ |
| | | @Override |
| | | public HandlerSelectVo getHandlerSelect(HandlerQuery query) { |
| | | // è·åä»»å¡åçç±»å |
| | | TaskAssigneeEnum type = TaskAssigneeEnum.fromDesc(query.getHandlerType()); |
| | | // è½¬æ¢æ¥è¯¢æ¡ä»¶ä¸º TaskAssigneeBody |
| | | TaskAssigneeBody taskQuery = BeanUtil.toBean(query, TaskAssigneeBody.class); |
| | | |
| | | // ç»ä¸æ¥è¯¢å¹¶æå»ºä¸å¡æ°æ® |
| | | TaskAssigneeDTO dto = fetchTaskAssigneeData(type, taskQuery); |
| | | List<DeptDTO> depts = fetchDeptData(type); |
| | | |
| | | return getHandlerSelectVo(buildHandlerData(dto, type), buildDeptTree(depts)); |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®ä»»å¡åçç±»åæ¥è¯¢å¯¹åºçæ°æ® |
| | | */ |
| | | private TaskAssigneeDTO fetchTaskAssigneeData(TaskAssigneeEnum type, TaskAssigneeBody taskQuery) { |
| | | return switch (type) { |
| | | case USER -> taskAssigneeService.selectUsersByTaskAssigneeList(taskQuery); |
| | | case ROLE -> taskAssigneeService.selectRolesByTaskAssigneeList(taskQuery); |
| | | case DEPT -> taskAssigneeService.selectDeptsByTaskAssigneeList(taskQuery); |
| | | case POST -> taskAssigneeService.selectPostsByTaskAssigneeList(taskQuery); |
| | | default -> throw new ServiceException("Unsupported handler type"); |
| | | }; |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®ä»»å¡åçç±»åè·åé¨é¨æ°æ® |
| | | */ |
| | | private List<DeptDTO> fetchDeptData(TaskAssigneeEnum type) { |
| | | if (type == TaskAssigneeEnum.USER || type == TaskAssigneeEnum.DEPT || type == TaskAssigneeEnum.POST) { |
| | | return deptService.selectDeptsByList(); |
| | | } |
| | | return new ArrayList<>(); |
| | | } |
| | | |
| | | /** |
| | | * æå»ºé¨é¨æ ç¶ç»æ |
| | | */ |
| | | private TreeFunDto<DeptDTO> buildDeptTree(List<DeptDTO> depts) { |
| | | return new TreeFunDto<>(depts) |
| | | .setId(dept -> String.valueOf(dept.getDeptId())) |
| | | .setName(DeptDTO::getDeptName) |
| | | .setParentId(dept -> String.valueOf(dept.getParentId())); |
| | | } |
| | | |
| | | /** |
| | | * æå»ºä»»å¡åçäººæ°æ® |
| | | */ |
| | | private HandlerFunDto<TaskAssigneeDTO.TaskHandler> buildHandlerData(TaskAssigneeDTO dto, TaskAssigneeEnum type) { |
| | | return new HandlerFunDto<>(dto.getList(), dto.getTotal()) |
| | | .setStorageId(assignee -> type.getCode() + assignee.getStorageId()) |
| | | .setHandlerCode(assignee -> StringUtils.blankToDefault(assignee.getHandlerCode(), "æ ")) |
| | | .setHandlerName(assignee -> StringUtils.blankToDefault(assignee.getHandlerName(), "æ ")) |
| | | .setGroupName(assignee -> StringUtils.defaultIfBlank( |
| | | Optional.ofNullable(assignee.getGroupName()) |
| | | .map(deptService::selectDeptNameByIds) |
| | | .orElse(DEFAULT_GROUP_NAME), DEFAULT_GROUP_NAME)) |
| | | .setCreateTime(assignee -> DateUtils.parseDateToStr(FormatsType.YYYY_MM_DD_HH_MM_SS, assignee.getCreateTime())); |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®å卿 è¯ç¬¦ï¼storageIdï¼è§£æåé
ç±»ååIDï¼å¹¶è·å对åºçç¨æ·å表 |
| | | * |
| | | * @param storageId å
å«åé
ç±»ååIDçå符串ï¼ä¾å¦ "user:123" æ "role:456"ï¼ |
| | | * @return ä¸åé
ç±»ååIDå¹é
çç¨æ·å表ï¼å¦ææ ¼å¼æ æåè¿å空å表 |
| | | */ |
| | | @Override |
| | | public List<UserDTO> fetchUsersByStorageId(String storageId) { |
| | | List<UserDTO> list = new ArrayList<>(); |
| | | for (String str : storageId.split(StrUtil.COMMA)) { |
| | | String[] parts = str.split(StrUtil.COLON, 2); |
| | | if (parts.length < 2) { |
| | | list.addAll(getUsersByType(TaskAssigneeEnum.USER, List.of(Long.valueOf(parts[0])))); |
| | | } else { |
| | | list.addAll(getUsersByType(TaskAssigneeEnum.fromCode(parts[0] + StrUtil.COLON), List.of(Long.valueOf(parts[1])))); |
| | | } |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®æå®çä»»å¡åé
ç±»åï¼TaskAssigneeEnumï¼å ID å表ï¼è·å对åºçç¨æ·ä¿¡æ¯å表 |
| | | * |
| | | * @param type ä»»å¡åé
ç±»åï¼è¡¨ç¤ºç¨æ·ãè§è²ãé¨é¨æå
¶ä»ï¼TaskAssigneeEnum æä¸¾å¼ï¼ |
| | | * @param ids 䏿å®åé
ç±»åå
³èç ID å表ï¼ä¾å¦ç¨æ·IDãè§è²IDãé¨é¨IDçï¼ |
| | | * @return è¿åå
å«ç¨æ·ä¿¡æ¯çå表ãå¦æç±»åä¸ºç¨æ·ï¼USERï¼ï¼åéè¿ç¨æ·IDå表æ¥è¯¢ï¼ |
| | | * å¦æç±»å为è§è²ï¼ROLEï¼ï¼åéè¿è§è²IDå表æ¥è¯¢ï¼ |
| | | * å¦æç±»å为é¨é¨ï¼DEPTï¼ï¼åéè¿é¨é¨IDå表æ¥è¯¢ï¼ |
| | | * å¦æç±»å为å²ä½ï¼POSTï¼ææ æ³è¯å«çç±»åï¼åè¿å空å表 |
| | | */ |
| | | private List<UserDTO> getUsersByType(TaskAssigneeEnum type, List<Long> ids) { |
| | | return switch (type) { |
| | | case USER -> userService.selectListByIds(ids); |
| | | case ROLE -> userService.selectUsersByRoleIds(ids); |
| | | case DEPT -> userService.selectUsersByDeptIds(ids); |
| | | case POST -> userService.selectUsersByPostIds(ids); |
| | | }; |
| | | } |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.service.impl; |
| | | |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.convert.Convert; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.dromara.common.core.domain.dto.StartProcessReturnDTO; |
| | | import org.dromara.common.core.domain.dto.UserDTO; |
| | | import org.dromara.common.core.enums.BusinessStatusEnum; |
| | | import org.dromara.common.core.exception.ServiceException; |
| | | import org.dromara.common.core.service.UserService; |
| | | import org.dromara.common.core.utils.SpringUtils; |
| | | import org.dromara.common.core.utils.StreamUtils; |
| | | import org.dromara.common.core.utils.StringUtils; |
| | | import org.dromara.common.core.utils.ValidatorUtils; |
| | | import org.dromara.common.core.validate.AddGroup; |
| | | import org.dromara.common.core.validate.EditGroup; |
| | | import org.dromara.common.mybatis.core.page.PageQuery; |
| | | import org.dromara.common.mybatis.core.page.TableDataInfo; |
| | | import org.dromara.common.satoken.utils.LoginHelper; |
| | | import org.dromara.warm.flow.core.dto.FlowParams; |
| | | import org.dromara.warm.flow.core.entity.*; |
| | | import org.dromara.warm.flow.core.enums.NodeType; |
| | | import org.dromara.warm.flow.core.enums.SkipType; |
| | | import org.dromara.warm.flow.core.service.*; |
| | | import org.dromara.warm.flow.orm.entity.*; |
| | | import org.dromara.warm.flow.orm.mapper.FlowHisTaskMapper; |
| | | import org.dromara.warm.flow.orm.mapper.FlowInstanceMapper; |
| | | import org.dromara.warm.flow.orm.mapper.FlowTaskMapper; |
| | | import org.dromara.workflow.common.ConditionalOnEnable; |
| | | import org.dromara.workflow.common.enums.TaskAssigneeType; |
| | | import org.dromara.workflow.common.enums.TaskStatusEnum; |
| | | import org.dromara.workflow.domain.bo.*; |
| | | import org.dromara.workflow.domain.vo.FlowHisTaskVo; |
| | | import org.dromara.workflow.domain.vo.FlowTaskVo; |
| | | import org.dromara.workflow.handler.FlowProcessEventHandler; |
| | | import org.dromara.workflow.handler.WorkflowPermissionHandler; |
| | | import org.dromara.workflow.mapper.FlwCategoryMapper; |
| | | import org.dromara.workflow.mapper.FlwTaskMapper; |
| | | import org.dromara.workflow.service.IFlwTaskService; |
| | | import org.dromara.workflow.utils.WorkflowUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import static org.dromara.workflow.common.constant.FlowConstant.*; |
| | | |
| | | /** |
| | | * ä»»å¡ æå¡å±å®ç° |
| | | * |
| | | * @author may |
| | | */ |
| | | @ConditionalOnEnable |
| | | @Slf4j |
| | | @RequiredArgsConstructor |
| | | @Service |
| | | public class FlwTaskServiceImpl implements IFlwTaskService { |
| | | |
| | | private final TaskService taskService; |
| | | private final InsService insService; |
| | | private final DefService defService; |
| | | private final HisTaskService hisTaskService; |
| | | private final NodeService nodeService; |
| | | private final FlowInstanceMapper flowInstanceMapper; |
| | | private final FlowTaskMapper flowTaskMapper; |
| | | private final FlowHisTaskMapper flowHisTaskMapper; |
| | | private final IdentifierGenerator identifierGenerator; |
| | | private final FlowProcessEventHandler flowProcessEventHandler; |
| | | private final UserService userService; |
| | | private final FlwTaskMapper flwTaskMapper; |
| | | private final FlwCategoryMapper flwCategoryMapper; |
| | | |
| | | /** |
| | | * å¯å¨ä»»å¡ |
| | | * |
| | | * @param startProcessBo å¯å¨æµç¨åæ° |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public StartProcessReturnDTO startWorkFlow(StartProcessBo startProcessBo) { |
| | | String businessId = startProcessBo.getBusinessId(); |
| | | if (StringUtils.isBlank(businessId)) { |
| | | throw new ServiceException("å¯å¨å·¥ä½æµæ¶å¿
é¡»å
å«ä¸å¡ID"); |
| | | } |
| | | // å¯å¨æµç¨å®ä¾ï¼æäº¤ç³è¯·ï¼ |
| | | Map<String, Object> variables = startProcessBo.getVariables(); |
| | | // æµç¨å起人 |
| | | variables.put(INITIATOR, LoginHelper.getUserIdStr()); |
| | | // ä¸å¡id |
| | | variables.put(BUSINESS_ID, businessId); |
| | | FlowInstance flowInstance = flowInstanceMapper.selectOne(new LambdaQueryWrapper<>(FlowInstance.class) |
| | | .eq(FlowInstance::getBusinessId, businessId)); |
| | | if (ObjectUtil.isNotNull(flowInstance)) { |
| | | BusinessStatusEnum.checkStartStatus(flowInstance.getFlowStatus()); |
| | | List<Task> taskList = taskService.list(new FlowTask().setInstanceId(flowInstance.getId())); |
| | | StartProcessReturnDTO dto = new StartProcessReturnDTO(); |
| | | dto.setProcessInstanceId(taskList.get(0).getInstanceId()); |
| | | dto.setTaskId(taskList.get(0).getId()); |
| | | return dto; |
| | | } |
| | | FlowParams flowParams = new FlowParams(); |
| | | flowParams.flowCode(startProcessBo.getFlowCode()); |
| | | flowParams.variable(startProcessBo.getVariables()); |
| | | flowParams.flowStatus(BusinessStatusEnum.DRAFT.getStatus()); |
| | | Instance instance; |
| | | try { |
| | | instance = insService.start(businessId, flowParams); |
| | | } catch (Exception e) { |
| | | throw new ServiceException(e.getMessage()); |
| | | } |
| | | // ç³è¯·äººæ§è¡æµç¨ |
| | | List<Task> taskList = taskService.list(new FlowTask().setInstanceId(instance.getId())); |
| | | if (taskList.size() > 1) { |
| | | throw new ServiceException("è¯·æ£æ¥æµç¨ç¬¬ä¸ä¸ªç¯èæ¯å¦ä¸ºç³è¯·äººï¼"); |
| | | } |
| | | StartProcessReturnDTO dto = new StartProcessReturnDTO(); |
| | | dto.setProcessInstanceId(instance.getId()); |
| | | dto.setTaskId(taskList.get(0).getId()); |
| | | return dto; |
| | | } |
| | | |
| | | /** |
| | | * åçä»»å¡ |
| | | * |
| | | * @param completeTaskBo åçä»»å¡åæ° |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean completeTask(CompleteTaskBo completeTaskBo) { |
| | | try { |
| | | // è·åä»»å¡IDå¹¶æ¥è¯¢å¯¹åºçæµç¨ä»»å¡åå®ä¾ä¿¡æ¯ |
| | | Long taskId = completeTaskBo.getTaskId(); |
| | | List<String> messageType = completeTaskBo.getMessageType(); |
| | | String notice = completeTaskBo.getNotice(); |
| | | // è·åæé人 |
| | | List<FlowCopyBo> flowCopyList = completeTaskBo.getFlowCopyList(); |
| | | FlowTask flowTask = flowTaskMapper.selectById(taskId); |
| | | if (ObjectUtil.isNull(flowTask)) { |
| | | throw new ServiceException("æµç¨ä»»å¡ä¸å卿任å¡å·²å®¡æ¹ï¼"); |
| | | } |
| | | Instance ins = insService.getById(flowTask.getInstanceId()); |
| | | // è·åæµç¨å®ä¹ä¿¡æ¯ |
| | | Definition definition = defService.getById(flowTask.getDefinitionId()); |
| | | // æ£æ¥æµç¨ç¶ææ¯å¦ä¸ºè稿ãå·²æ¤éæå·²éåç¶æï¼è¥æ¯åæ§è¡æµç¨æäº¤çå¬ |
| | | if (BusinessStatusEnum.isDraftOrCancelOrBack(ins.getFlowStatus())) { |
| | | flowProcessEventHandler.processHandler(definition.getFlowCode(), ins.getBusinessId(), ins.getFlowStatus(), null, true); |
| | | } |
| | | // æå»ºæµç¨åæ°ï¼å
æ¬åéã跳转类åãæ¶æ¯ãå¤ç人ãæéçä¿¡æ¯ |
| | | FlowParams flowParams = new FlowParams(); |
| | | flowParams.variable(completeTaskBo.getVariables()); |
| | | flowParams.skipType(SkipType.PASS.getKey()); |
| | | flowParams.message(completeTaskBo.getMessage()); |
| | | flowParams.flowStatus(BusinessStatusEnum.WAITING.getStatus()).hisStatus(TaskStatusEnum.PASS.getStatus()); |
| | | |
| | | flowParams.hisTaskExt(completeTaskBo.getFileId()); |
| | | // æ§è¡ä»»å¡è·³è½¬ï¼å¹¶æ ¹æ®è¿åçå¤ç人设置ä¸ä¸æ¥å¤ç人 |
| | | Instance instance = taskService.skip(taskId, flowParams); |
| | | this.setHandler(instance, flowTask, flowCopyList); |
| | | // æ¶æ¯éç¥ |
| | | WorkflowUtils.sendMessage(definition.getFlowName(), ins.getId(), messageType, notice); |
| | | return true; |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage(), e); |
| | | throw new ServiceException(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 设置åç人 |
| | | * |
| | | * @param instance å®ä¾ |
| | | * @param task (å½åä»»å¡)æªåççä»»å¡ |
| | | * @param flowCopyList æé人 |
| | | */ |
| | | private void setHandler(Instance instance, FlowTask task, List<FlowCopyBo> flowCopyList) { |
| | | if (ObjectUtil.isNull(instance)) { |
| | | return; |
| | | } |
| | | // æ·»å æé人 |
| | | this.setCopy(task, flowCopyList); |
| | | // æ ¹æ®æµç¨å®ä¾IDæ¥è¯¢ææå
³èçä»»å¡ |
| | | List<FlowTask> flowTasks = this.selectByInstId(instance.getId()); |
| | | if (CollUtil.isEmpty(flowTasks)) { |
| | | return; |
| | | } |
| | | List<Long> taskIdList = StreamUtils.toList(flowTasks, FlowTask::getId); |
| | | // è·åä¸å½åä»»å¡å
³èçç¨æ·å表 |
| | | List<User> associatedUsers = WorkflowUtils.getFlowUserService().getByAssociateds(taskIdList); |
| | | if (CollUtil.isEmpty(associatedUsers)) { |
| | | return; |
| | | } |
| | | List<User> userList = new ArrayList<>(); |
| | | // éåä»»å¡å表ï¼å¤çæ¯ä¸ªä»»å¡çåç人 |
| | | for (FlowTask flowTask : flowTasks) { |
| | | List<User> users = StreamUtils.filter(associatedUsers, user -> Objects.equals(user.getAssociated(), flowTask.getId())); |
| | | if (CollUtil.isNotEmpty(users)) { |
| | | userList.addAll(WorkflowUtils.buildUser(users, flowTask.getId())); |
| | | } |
| | | } |
| | | // æ¹éå é¤ç°æä»»å¡çåçäººè®°å½ |
| | | WorkflowUtils.getFlowUserService().deleteByTaskIds(taskIdList); |
| | | // ç¡®ä¿è¦ä¿åç userList ä¸ä¸ºç©º |
| | | if (CollUtil.isEmpty(userList)) { |
| | | return; |
| | | } |
| | | WorkflowUtils.getFlowUserService().saveBatch(userList); |
| | | } |
| | | |
| | | /** |
| | | * æ·»å æé人 |
| | | * |
| | | * @param task ä»»å¡ä¿¡æ¯ |
| | | * @param flowCopyList æé人 |
| | | */ |
| | | public void setCopy(FlowTask task, List<FlowCopyBo> flowCopyList) { |
| | | if (CollUtil.isEmpty(flowCopyList)) { |
| | | return; |
| | | } |
| | | // æ·»å æéäººè®°å½ |
| | | FlowHisTask flowHisTask = flowHisTaskMapper.selectList(new LambdaQueryWrapper<>(FlowHisTask.class).eq(FlowHisTask::getTaskId, task.getId())).get(0); |
| | | FlowNode flowNode = new FlowNode(); |
| | | flowNode.setNodeCode(flowHisTask.getTargetNodeCode()); |
| | | flowNode.setNodeName(flowHisTask.getTargetNodeName()); |
| | | //çææ°çä»»å¡id |
| | | long taskId = identifierGenerator.nextId(null).longValue(); |
| | | task.setId(taskId); |
| | | task.setNodeName("ãæéã" + task.getNodeName()); |
| | | Date updateTime = new Date(flowHisTask.getUpdateTime().getTime() - 1000); |
| | | FlowParams flowParams = FlowParams.build(); |
| | | flowParams.skipType(SkipType.NONE.getKey()); |
| | | flowParams.hisStatus(TaskStatusEnum.COPY.getStatus()); |
| | | flowParams.message("ãæéç»ã" + StreamUtils.join(flowCopyList, FlowCopyBo::getUserName)); |
| | | HisTask hisTask = hisTaskService.setSkipHisTask(task, flowNode, flowParams); |
| | | hisTask.setCreateTime(updateTime); |
| | | hisTask.setUpdateTime(updateTime); |
| | | hisTaskService.save(hisTask); |
| | | List<User> userList = flowCopyList.stream() |
| | | .map(flowCopy -> { |
| | | FlowUser flowUser = new FlowUser(); |
| | | flowUser.setType(TaskAssigneeType.COPY.getCode()); |
| | | flowUser.setProcessedBy(String.valueOf(flowCopy.getUserId())); |
| | | flowUser.setAssociated(taskId); |
| | | return flowUser; |
| | | }).collect(Collectors.toList()); |
| | | // æ¹éä¿åæé人å |
| | | WorkflowUtils.getFlowUserService().saveBatch(userList); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢å½åç¨æ·çå¾
åä»»å¡ |
| | | * |
| | | * @param flowTaskBo åæ° |
| | | * @param pageQuery å页 |
| | | */ |
| | | @Override |
| | | public TableDataInfo<FlowTaskVo> pageByTaskWait(FlowTaskBo flowTaskBo, PageQuery pageQuery) { |
| | | QueryWrapper<FlowTaskBo> queryWrapper = buildQueryWrapper(flowTaskBo); |
| | | queryWrapper.eq("t.node_type", NodeType.BETWEEN.getKey()); |
| | | queryWrapper.in("t.processed_by", SpringUtils.getBean(WorkflowPermissionHandler.class).permissions()); |
| | | queryWrapper.in("t.flow_status", BusinessStatusEnum.WAITING.getStatus()); |
| | | Page<FlowTaskVo> page = this.getFlowTaskVoPage(pageQuery, queryWrapper); |
| | | return TableDataInfo.build(page); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢å½åç¨æ·çå·²åä»»å¡ |
| | | * |
| | | * @param flowTaskBo åæ° |
| | | * @param pageQuery å页 |
| | | */ |
| | | @Override |
| | | public TableDataInfo<FlowHisTaskVo> pageByTaskFinish(FlowTaskBo flowTaskBo, PageQuery pageQuery) { |
| | | QueryWrapper<FlowTaskBo> queryWrapper = buildQueryWrapper(flowTaskBo); |
| | | queryWrapper.eq("t.node_type", NodeType.BETWEEN.getKey()); |
| | | queryWrapper.in("t.approver", LoginHelper.getUserIdStr()); |
| | | queryWrapper.orderByDesc("t.create_time").orderByDesc("t.update_time"); |
| | | Page<FlowHisTaskVo> page = flwTaskMapper.getListFinishTask(pageQuery.build(), queryWrapper); |
| | | return TableDataInfo.build(page); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢å¾
åä»»å¡ |
| | | * |
| | | * @param flowTaskBo åæ° |
| | | * @param pageQuery å页 |
| | | */ |
| | | @Override |
| | | public TableDataInfo<FlowTaskVo> pageByAllTaskWait(FlowTaskBo flowTaskBo, PageQuery pageQuery) { |
| | | QueryWrapper<FlowTaskBo> queryWrapper = buildQueryWrapper(flowTaskBo); |
| | | queryWrapper.eq("t.node_type", NodeType.BETWEEN.getKey()); |
| | | Page<FlowTaskVo> page = getFlowTaskVoPage(pageQuery, queryWrapper); |
| | | return TableDataInfo.build(page); |
| | | } |
| | | |
| | | private Page<FlowTaskVo> getFlowTaskVoPage(PageQuery pageQuery, QueryWrapper<FlowTaskBo> queryWrapper) { |
| | | Page<FlowTaskVo> page = flwTaskMapper.getListRunTask(pageQuery.build(), queryWrapper); |
| | | List<FlowTaskVo> records = page.getRecords(); |
| | | if (CollUtil.isNotEmpty(records)) { |
| | | List<Long> taskIds = StreamUtils.toList(records, FlowTaskVo::getId); |
| | | Map<Long, List<UserDTO>> listMap = currentTaskAllUser(taskIds); |
| | | records.forEach(t -> { |
| | | List<UserDTO> userList = listMap.getOrDefault(t.getId(), Collections.emptyList()); |
| | | if (CollUtil.isNotEmpty(userList)) { |
| | | t.setAssigneeIds(StreamUtils.join(userList, e -> String.valueOf(e.getUserId()))); |
| | | t.setAssigneeNames(StreamUtils.join(userList, UserDTO::getNickName)); |
| | | } |
| | | }); |
| | | } |
| | | return page; |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢å·²åä»»å¡ |
| | | * |
| | | * @param flowTaskBo åæ° |
| | | * @param pageQuery å页 |
| | | */ |
| | | @Override |
| | | public TableDataInfo<FlowHisTaskVo> pageByAllTaskFinish(FlowTaskBo flowTaskBo, PageQuery pageQuery) { |
| | | QueryWrapper<FlowTaskBo> queryWrapper = buildQueryWrapper(flowTaskBo); |
| | | Page<FlowHisTaskVo> page = flwTaskMapper.getListFinishTask(pageQuery.build(), queryWrapper); |
| | | return TableDataInfo.build(page); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢å½åç¨æ·çæé |
| | | * |
| | | * @param flowTaskBo åæ° |
| | | * @param pageQuery å页 |
| | | */ |
| | | @Override |
| | | public TableDataInfo<FlowTaskVo> pageByTaskCopy(FlowTaskBo flowTaskBo, PageQuery pageQuery) { |
| | | QueryWrapper<FlowTaskBo> queryWrapper = buildQueryWrapper(flowTaskBo); |
| | | queryWrapper.in("t.processed_by", LoginHelper.getUserIdStr()); |
| | | Page<FlowTaskVo> page = flwTaskMapper.getTaskCopyByPage(pageQuery.build(), queryWrapper); |
| | | return TableDataInfo.build(page); |
| | | } |
| | | |
| | | private QueryWrapper<FlowTaskBo> buildQueryWrapper(FlowTaskBo flowTaskBo) { |
| | | QueryWrapper<FlowTaskBo> wrapper = Wrappers.query(); |
| | | wrapper.like(StringUtils.isNotBlank(flowTaskBo.getNodeName()), "t.node_name", flowTaskBo.getNodeName()); |
| | | wrapper.like(StringUtils.isNotBlank(flowTaskBo.getFlowName()), "t.flow_name", flowTaskBo.getFlowName()); |
| | | wrapper.like(StringUtils.isNotBlank(flowTaskBo.getFlowCode()), "t.flow_code", flowTaskBo.getFlowCode()); |
| | | wrapper.in(CollUtil.isNotEmpty(flowTaskBo.getCreateByIds()), "t.create_by", flowTaskBo.getCreateByIds()); |
| | | if (StringUtils.isNotBlank(flowTaskBo.getCategory())) { |
| | | List<Long> categoryIds = flwCategoryMapper.selectCategoryIdsByParentId(Convert.toLong(flowTaskBo.getCategory())); |
| | | wrapper.in("t.category", StreamUtils.toList(categoryIds, Convert::toStr)); |
| | | } |
| | | wrapper.orderByDesc("t.create_time"); |
| | | return wrapper; |
| | | } |
| | | |
| | | /** |
| | | * 驳åä»»å¡ |
| | | * |
| | | * @param bo åæ° |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean backProcess(BackProcessBo bo) { |
| | | try { |
| | | Long taskId = bo.getTaskId(); |
| | | String notice = bo.getNotice(); |
| | | List<String> messageType = bo.getMessageType(); |
| | | String message = bo.getMessage(); |
| | | FlowTask task = flowTaskMapper.selectById(taskId); |
| | | if (ObjectUtil.isNull(task)) { |
| | | throw new ServiceException("ä»»å¡ä¸åå¨ï¼"); |
| | | } |
| | | Instance inst = insService.getById(task.getInstanceId()); |
| | | BusinessStatusEnum.checkBackStatus(inst.getFlowStatus()); |
| | | Long definitionId = task.getDefinitionId(); |
| | | Definition definition = defService.getById(definitionId); |
| | | String applyNodeCode = WorkflowUtils.applyNodeCode(definitionId); |
| | | FlowParams flowParams = FlowParams.build(); |
| | | flowParams.nodeCode(bo.getNodeCode()); |
| | | flowParams.message(message); |
| | | flowParams.skipType(SkipType.REJECT.getKey()); |
| | | flowParams.flowStatus(applyNodeCode.equals(bo.getNodeCode()) ? TaskStatusEnum.BACK.getStatus() : TaskStatusEnum.WAITING.getStatus()) |
| | | .hisStatus(TaskStatusEnum.BACK.getStatus()); |
| | | flowParams.hisTaskExt(bo.getFileId()); |
| | | taskService.skip(task.getId(), flowParams); |
| | | |
| | | Instance instance = insService.getById(inst.getId()); |
| | | this.setHandler(instance, task, null); |
| | | // æ¶æ¯éç¥ |
| | | WorkflowUtils.sendMessage(definition.getFlowName(), instance.getId(), messageType, notice); |
| | | return true; |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage(), e); |
| | | throw new ServiceException(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * è·åå¯é©³åçåç½®èç¹ |
| | | * |
| | | * @param definitionId æµç¨å®ä¹id |
| | | * @param nowNodeCode å½åèç¹ |
| | | */ |
| | | @Override |
| | | public List<Node> getBackTaskNode(Long definitionId, String nowNodeCode) { |
| | | List<Node> nodeCodes = nodeService.getByNodeCodes(Collections.singletonList(nowNodeCode), definitionId); |
| | | if (!CollUtil.isNotEmpty(nodeCodes)) { |
| | | return nodeCodes; |
| | | } |
| | | //夿æ¯å¦é
ç½®äºåºå®é©³åèç¹ |
| | | Node node = nodeCodes.get(0); |
| | | if (StringUtils.isNotBlank(node.getAnyNodeSkip())) { |
| | | return nodeService.getByNodeCodes(Collections.singletonList(node.getAnyNodeSkip()), definitionId); |
| | | } |
| | | //è·åå¯é©³åçåç½®èç¹ |
| | | List<Node> nodes = nodeService.previousNodeList(definitionId, nowNodeCode); |
| | | if (CollUtil.isNotEmpty(nodes)) { |
| | | return StreamUtils.filter(nodes, e -> NodeType.BETWEEN.getKey().equals(e.getNodeType())); |
| | | } |
| | | return nodes; |
| | | } |
| | | |
| | | /** |
| | | * ç»æ¢ä»»å¡ |
| | | * |
| | | * @param bo åæ° |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean terminationTask(FlowTerminationBo bo) { |
| | | try { |
| | | Long taskId = bo.getTaskId(); |
| | | Task task = taskService.getById(taskId); |
| | | if (task == null) { |
| | | throw new ServiceException("ä»»å¡ä¸åå¨ï¼"); |
| | | } |
| | | Instance instance = insService.getById(task.getInstanceId()); |
| | | if (ObjectUtil.isNotNull(instance)) { |
| | | BusinessStatusEnum.checkInvalidStatus(instance.getFlowStatus()); |
| | | } |
| | | FlowParams flowParams = new FlowParams(); |
| | | flowParams.message(bo.getComment()); |
| | | flowParams.flowStatus(BusinessStatusEnum.TERMINATION.getStatus()) |
| | | .hisStatus(TaskStatusEnum.TERMINATION.getStatus()); |
| | | taskService.termination(taskId, flowParams); |
| | | return true; |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage(), e); |
| | | throw new ServiceException(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * æç
§ä»»å¡idæ¥è¯¢ä»»å¡ |
| | | * |
| | | * @param taskIdList ä»»å¡id |
| | | */ |
| | | @Override |
| | | public List<FlowTask> selectByIdList(List<Long> taskIdList) { |
| | | return flowTaskMapper.selectList(new LambdaQueryWrapper<>(FlowTask.class) |
| | | .in(FlowTask::getId, taskIdList)); |
| | | } |
| | | |
| | | /** |
| | | * æç
§ä»»å¡idæ¥è¯¢ä»»å¡ |
| | | * |
| | | * @param taskId ä»»å¡id |
| | | */ |
| | | @Override |
| | | public FlowTaskVo selectById(Long taskId) { |
| | | Task task = taskService.getById(taskId); |
| | | if (ObjectUtil.isNull(task)) { |
| | | return null; |
| | | } |
| | | FlowTaskVo flowTaskVo = BeanUtil.toBean(task, FlowTaskVo.class); |
| | | Instance instance = insService.getById(task.getInstanceId()); |
| | | Definition definition = defService.getById(task.getDefinitionId()); |
| | | flowTaskVo.setFlowStatus(instance.getFlowStatus()); |
| | | flowTaskVo.setVersion(definition.getVersion()); |
| | | flowTaskVo.setFlowCode(definition.getFlowCode()); |
| | | flowTaskVo.setFlowName(definition.getFlowName()); |
| | | flowTaskVo.setBusinessId(instance.getBusinessId()); |
| | | List<Node> nodeList = nodeService.getByNodeCodes(Collections.singletonList(flowTaskVo.getNodeCode()), instance.getDefinitionId()); |
| | | if (CollUtil.isNotEmpty(nodeList)) { |
| | | Node node = nodeList.get(0); |
| | | flowTaskVo.setNodeRatio(node.getNodeRatio()); |
| | | } |
| | | return flowTaskVo; |
| | | } |
| | | |
| | | /** |
| | | * æç
§ä»»å¡idæ¥è¯¢ä»»å¡ |
| | | * |
| | | * @param taskIdList ä»»å¡id |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public List<FlowHisTask> selectHisTaskByIdList(List<Long> taskIdList) { |
| | | return flowHisTaskMapper.selectList(new LambdaQueryWrapper<>(FlowHisTask.class) |
| | | .in(FlowHisTask::getId, taskIdList)); |
| | | } |
| | | |
| | | /** |
| | | * æç
§ä»»å¡idæ¥è¯¢ä»»å¡ |
| | | * |
| | | * @param taskId ä»»å¡id |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public FlowHisTask selectHisTaskById(Long taskId) { |
| | | return flowHisTaskMapper.selectOne(new LambdaQueryWrapper<>(FlowHisTask.class) |
| | | .eq(FlowHisTask::getId, taskId)); |
| | | } |
| | | |
| | | /** |
| | | * æç
§å®ä¾idæ¥è¯¢ä»»å¡ |
| | | * |
| | | * @param instanceIdList æµç¨å®ä¾id |
| | | */ |
| | | @Override |
| | | public List<FlowTask> selectByInstIdList(List<Long> instanceIdList) { |
| | | return flowTaskMapper.selectList(new LambdaQueryWrapper<>(FlowTask.class) |
| | | .in(FlowTask::getInstanceId, instanceIdList)); |
| | | } |
| | | |
| | | /** |
| | | * æç
§å®ä¾idæ¥è¯¢ä»»å¡ |
| | | * |
| | | * @param instanceId æµç¨å®ä¾id |
| | | */ |
| | | @Override |
| | | public List<FlowTask> selectByInstId(Long instanceId) { |
| | | return flowTaskMapper.selectList(new LambdaQueryWrapper<>(FlowTask.class) |
| | | .eq(FlowTask::getInstanceId, instanceId)); |
| | | } |
| | | |
| | | /** |
| | | * ä»»å¡æä½ |
| | | * |
| | | * @param bo åæ° |
| | | * @param taskOperation æä½ç±»åï¼å§æ´¾ delegateTaskã转å transferTaskãå ç¾ addSignatureãåç¾ reductionSignature |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean taskOperation(TaskOperationBo bo, String taskOperation) { |
| | | FlowParams flowParams = new FlowParams(); |
| | | flowParams.message(bo.getMessage()); |
| | | if (LoginHelper.isSuperAdmin() || LoginHelper.isTenantAdmin()) { |
| | | flowParams.ignore(true); |
| | | } |
| | | |
| | | // æ ¹æ®æä½ç±»åæå»º FlowParams |
| | | switch (taskOperation) { |
| | | case DELEGATE_TASK, TRANSFER_TASK -> { |
| | | ValidatorUtils.validate(bo, AddGroup.class); |
| | | flowParams.addHandlers(Collections.singletonList(bo.getUserId())); |
| | | } |
| | | case ADD_SIGNATURE -> { |
| | | ValidatorUtils.validate(bo, EditGroup.class); |
| | | flowParams.addHandlers(bo.getUserIds()); |
| | | } |
| | | case REDUCTION_SIGNATURE -> { |
| | | ValidatorUtils.validate(bo, EditGroup.class); |
| | | flowParams.reductionHandlers(bo.getUserIds()); |
| | | } |
| | | default -> { |
| | | log.error("Invalid operation type:{} ", taskOperation); |
| | | throw new ServiceException("Invalid operation type " + taskOperation); |
| | | } |
| | | } |
| | | |
| | | Long taskId = bo.getTaskId(); |
| | | FlowTaskVo flowTaskVo = selectById(taskId); |
| | | if ("addSignature".equals(taskOperation) || "reductionSignature".equals(taskOperation)) { |
| | | if (flowTaskVo.getNodeRatio().compareTo(BigDecimal.ZERO) == 0) { |
| | | throw new ServiceException(flowTaskVo.getNodeName() + "䏿¯ä¼ç¾èç¹ï¼"); |
| | | } |
| | | } |
| | | // 设置任å¡ç¶æå¹¶æ§è¡å¯¹åºçä»»å¡æä½ |
| | | switch (taskOperation) { |
| | | //å§æ´¾ä»»å¡ |
| | | case DELEGATE_TASK -> { |
| | | flowParams.hisStatus(TaskStatusEnum.DEPUTE.getStatus()); |
| | | return taskService.depute(taskId, flowParams); |
| | | } |
| | | //转åä»»å¡ |
| | | case TRANSFER_TASK -> { |
| | | flowParams.hisStatus(TaskStatusEnum.TRANSFER.getStatus()); |
| | | return taskService.transfer(taskId, flowParams); |
| | | } |
| | | //å ç¾ï¼å¢å åç人 |
| | | case ADD_SIGNATURE -> { |
| | | flowParams.hisStatus(TaskStatusEnum.SIGN.getStatus()); |
| | | return taskService.addSignature(taskId, flowParams); |
| | | } |
| | | //åç¾ï¼åå°åç人 |
| | | case REDUCTION_SIGNATURE -> { |
| | | flowParams.hisStatus(TaskStatusEnum.SIGN_OFF.getStatus()); |
| | | return taskService.reductionSignature(taskId, flowParams); |
| | | } |
| | | default -> { |
| | | log.error("Invalid operation type:{} ", taskOperation); |
| | | throw new ServiceException("Invalid operation type " + taskOperation); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹ä»»å¡åçäººï¼æ¤æ¹æ³å°ä¼æ¹éä¿®æ¹ææä»»å¡çåçäººï¼ |
| | | * |
| | | * @param taskIdList ä»»å¡id |
| | | * @param userId ç¨æ·id |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean updateAssignee(List<Long> taskIdList, String userId) { |
| | | if (CollUtil.isEmpty(taskIdList)) { |
| | | return false; |
| | | } |
| | | try { |
| | | List<FlowTask> flowTasks = this.selectByIdList(taskIdList); |
| | | // æ¹éå é¤ç°æä»»å¡çåçäººè®°å½ |
| | | if (CollUtil.isNotEmpty(flowTasks)) { |
| | | WorkflowUtils.getFlowUserService().deleteByTaskIds(StreamUtils.toList(flowTasks, FlowTask::getId)); |
| | | List<User> userList = flowTasks.stream() |
| | | .map(flowTask -> { |
| | | FlowUser flowUser = new FlowUser(); |
| | | flowUser.setType(TaskAssigneeType.APPROVER.getCode()); |
| | | flowUser.setProcessedBy(userId); |
| | | flowUser.setAssociated(flowTask.getId()); |
| | | return flowUser; |
| | | }) |
| | | .collect(Collectors.toList()); |
| | | if (CollUtil.isNotEmpty(userList)) { |
| | | WorkflowUtils.getFlowUserService().saveBatch(userList); |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage(), e); |
| | | throw new ServiceException(e.getMessage()); |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * è·å任塿æåç人 |
| | | * |
| | | * @param taskIdList ä»»å¡id |
| | | */ |
| | | @Override |
| | | public Map<Long, List<UserDTO>> currentTaskAllUser(List<Long> taskIdList) { |
| | | Map<Long, List<UserDTO>> map = new HashMap<>(); |
| | | // è·åä¸å½åä»»å¡å
³èçç¨æ·å表 |
| | | List<User> associatedUsers = WorkflowUtils.getFlowUserService().getByAssociateds(taskIdList); |
| | | Map<Long, List<User>> listMap = StreamUtils.groupByKey(associatedUsers, User::getAssociated); |
| | | for (Map.Entry<Long, List<User>> entry : listMap.entrySet()) { |
| | | List<User> value = entry.getValue(); |
| | | if (CollUtil.isNotEmpty(value)) { |
| | | List<UserDTO> userDTOS = userService.selectListByIds(StreamUtils.toList(value, e -> Long.valueOf(e.getProcessedBy()))); |
| | | map.put(entry.getKey(), userDTOS); |
| | | } |
| | | } |
| | | return map; |
| | | } |
| | | |
| | | /** |
| | | * è·åå½åä»»å¡çææåç人 |
| | | * |
| | | * @param taskId ä»»å¡id |
| | | */ |
| | | @Override |
| | | public List<UserDTO> currentTaskAllUser(Long taskId) { |
| | | // è·åä¸å½åä»»å¡å
³èçç¨æ·å表 |
| | | List<User> userList = WorkflowUtils.getFlowUserService().getByAssociateds(Collections.singletonList(taskId)); |
| | | if (CollUtil.isEmpty(userList)) { |
| | | return Collections.emptyList(); |
| | | } |
| | | return userService.selectListByIds(StreamUtils.toList(userList, e -> Long.valueOf(e.getProcessedBy()))); |
| | | } |
| | | } |
| | |
| | | package org.dromara.workflow.service.impl; |
| | | |
| | | import cn.hutool.core.convert.Convert; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import cn.hutool.core.map.MapUtil; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.dromara.common.core.domain.event.ProcessDeleteEvent; |
| | | import org.dromara.common.core.domain.event.ProcessEvent; |
| | | import org.dromara.common.core.domain.event.ProcessTaskEvent; |
| | | import org.dromara.common.core.enums.BusinessStatusEnum; |
| | | import org.dromara.common.core.service.WorkflowService; |
| | | import org.dromara.common.core.utils.MapstructUtils; |
| | | import org.dromara.common.core.utils.StreamUtils; |
| | | import org.dromara.common.core.utils.StringUtils; |
| | | import org.dromara.common.mybatis.core.domain.BaseEntity; |
| | | import org.dromara.common.mybatis.core.page.PageQuery; |
| | | import org.dromara.common.mybatis.core.page.TableDataInfo; |
| | | import org.dromara.workflow.common.ConditionalOnEnable; |
| | | import org.dromara.workflow.domain.TestLeave; |
| | | import org.dromara.workflow.domain.bo.TestLeaveBo; |
| | | import org.dromara.workflow.domain.vo.TestLeaveVo; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 请åServiceä¸å¡å±å¤ç |
| | |
| | | * @author may |
| | | * @date 2023-07-21 |
| | | */ |
| | | @ConditionalOnEnable |
| | | @RequiredArgsConstructor |
| | | @Service |
| | | @Slf4j |
| | |
| | | */ |
| | | @Override |
| | | public TestLeaveVo insertByBo(TestLeaveBo bo) { |
| | | long day = DateUtil.betweenDay(bo.getStartDate(), bo.getEndDate(), true); |
| | | // æªæ¢æ¥æä¹ç®ä¸å¤© |
| | | bo.setLeaveDays((int) day + 1); |
| | | TestLeave add = MapstructUtils.convert(bo, TestLeave.class); |
| | | if (StringUtils.isBlank(add.getStatus())) { |
| | | add.setStatus(BusinessStatusEnum.DRAFT.getStatus()); |
| | |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Boolean deleteWithValidByIds(Collection<Long> ids) { |
| | | List<String> idList = StreamUtils.toList(ids, String::valueOf); |
| | | workflowService.deleteRunAndHisInstance(idList); |
| | | public Boolean deleteWithValidByIds(List<Long> ids) { |
| | | workflowService.deleteInstance(ids); |
| | | return baseMapper.deleteByIds(ids) > 0; |
| | | } |
| | | |
| | | /** |
| | | * æ»ä½æµç¨çå¬(ä¾å¦: æäº¤ éå æ¤é ç»æ¢ ä½åºç) |
| | | * æ£å¸¸ä½¿ç¨åªé#processEvent.key=='leave1' |
| | | * æ»ä½æµç¨çå¬(ä¾å¦: èç¨¿ï¼æ¤éï¼éåï¼ä½åºï¼ç»æ¢ï¼å·²å®æç) |
| | | * æ£å¸¸ä½¿ç¨åªé#processEvent.flowCode=='leave1' |
| | | * 示ä¾ä¸ºäºæ¹ä¾¿å使ç¨startsWithå¹é
äºå
¨é¨ç¤ºä¾key |
| | | * |
| | | * @param processEvent åæ° |
| | | */ |
| | | @EventListener(condition = "#processEvent.key.startsWith('leave')") |
| | | @EventListener(condition = "#processEvent.flowCode.startsWith('leave')") |
| | | public void processHandler(ProcessEvent processEvent) { |
| | | log.info("å½å任塿§è¡äº{}", processEvent.toString()); |
| | | TestLeave testLeave = baseMapper.selectById(Long.valueOf(processEvent.getBusinessKey())); |
| | | TestLeave testLeave = baseMapper.selectById(Long.valueOf(processEvent.getBusinessId())); |
| | | testLeave.setStatus(processEvent.getStatus()); |
| | | // ç¨äºä¾å¦å®¡æ¹éä»¶ å®¡æ¹æè§ç åå¨å°ä¸å¡è¡¨å
èªè¡æ ¹æ®ä¸å¡å®ç°å卿µç¨ |
| | | Map<String, Object> params = processEvent.getParams(); |
| | | if (MapUtil.isNotEmpty(params)) { |
| | | // åå²ä»»å¡æ©å±(é常为éä»¶) |
| | | String hisTaskExt = Convert.toStr(params.get("hisTaskExt")); |
| | | // åç人 |
| | | String handler = Convert.toStr(params.get("handler")); |
| | | // åçæè§ |
| | | String message = Convert.toStr(params.get("message")); |
| | | } |
| | | if (processEvent.isSubmit()) { |
| | | testLeave.setStatus(BusinessStatusEnum.WAITING.getStatus()); |
| | | } |
| | |
| | | |
| | | /** |
| | | * æ§è¡åçä»»å¡çå¬ |
| | | * 示ä¾ï¼ä¹å¯éè¿ @EventListener(condition = "#processTaskEvent.key=='leave1'")è¿è¡å¤æ |
| | | * 示ä¾ï¼ä¹å¯éè¿ @EventListener(condition = "#processTaskEvent.flowCode=='leave1'")è¿è¡å¤æ |
| | | * 卿¹æ³ä¸å¤ææµç¨èç¹key |
| | | * if ("xxx".equals(processTaskEvent.getTaskDefinitionKey())) { |
| | | * if ("xxx".equals(processTaskEvent.getNodeCode())) { |
| | | * //æ§è¡ä¸å¡é»è¾ |
| | | * } |
| | | * |
| | | * @param processTaskEvent åæ° |
| | | */ |
| | | @EventListener(condition = "#processTaskEvent.key=='leave1' && #processTaskEvent.taskDefinitionKey=='Activity_14633hx'") |
| | | @EventListener(condition = "#processTaskEvent.flowCode.startsWith('leave')") |
| | | public void processTaskHandler(ProcessTaskEvent processTaskEvent) { |
| | | log.info("å½å任塿§è¡äº{}", processTaskEvent.toString()); |
| | | TestLeave testLeave = baseMapper.selectById(Long.valueOf(processTaskEvent.getBusinessKey())); |
| | | TestLeave testLeave = baseMapper.selectById(Long.valueOf(processTaskEvent.getBusinessId())); |
| | | testLeave.setStatus(BusinessStatusEnum.WAITING.getStatus()); |
| | | baseMapper.updateById(testLeave); |
| | | } |
| | | |
| | | /** |
| | | * çå¬å 餿µç¨äºä»¶ |
| | | * æ£å¸¸ä½¿ç¨åªé#processDeleteEvent.flowCode=='leave1' |
| | | * 示ä¾ä¸ºäºæ¹ä¾¿å使ç¨startsWithå¹é
äºå
¨é¨ç¤ºä¾key |
| | | * |
| | | * @param processDeleteEvent åæ° |
| | | */ |
| | | @EventListener(condition = "#processDeleteEvent.flowCode.startsWith('leave')") |
| | | public void processDeleteHandler(ProcessDeleteEvent processDeleteEvent) { |
| | | log.info("çå¬å 餿µç¨äºä»¶ï¼å½å任塿§è¡äº{}", processDeleteEvent.toString()); |
| | | TestLeave testLeave = baseMapper.selectById(Long.valueOf(processDeleteEvent.getBusinessId())); |
| | | if (ObjectUtil.isNull(testLeave)) { |
| | | return; |
| | | } |
| | | baseMapper.deleteById(testLeave.getId()); |
| | | } |
| | | |
| | | } |
| | |
| | | package org.dromara.workflow.service.impl; |
| | | |
| | | import cn.hutool.core.util.StrUtil; |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.dromara.common.core.domain.dto.CompleteTaskDTO; |
| | | import org.dromara.common.core.domain.dto.StartProcessDTO; |
| | | import org.dromara.common.core.domain.dto.StartProcessReturnDTO; |
| | | import org.dromara.common.core.service.WorkflowService; |
| | | import org.dromara.workflow.domain.ActHiProcinst; |
| | | import org.dromara.workflow.service.IActHiProcinstService; |
| | | import org.dromara.workflow.service.IActProcessInstanceService; |
| | | import org.dromara.workflow.utils.WorkflowUtils; |
| | | import org.flowable.engine.RuntimeService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.dromara.common.core.utils.StringUtils; |
| | | import org.dromara.warm.flow.orm.entity.FlowInstance; |
| | | import org.dromara.workflow.common.ConditionalOnEnable; |
| | | import org.dromara.workflow.domain.bo.CompleteTaskBo; |
| | | import org.dromara.workflow.domain.bo.StartProcessBo; |
| | | import org.dromara.workflow.service.IFlwDefinitionService; |
| | | import org.dromara.workflow.service.IFlwInstanceService; |
| | | import org.dromara.workflow.service.IFlwTaskService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | |
| | | * |
| | | * @author may |
| | | */ |
| | | @ConditionalOnEnable |
| | | @RequiredArgsConstructor |
| | | @Service |
| | | public class WorkflowServiceImpl implements WorkflowService { |
| | | |
| | | @Autowired(required = false) |
| | | private RuntimeService runtimeService; |
| | | private final IActProcessInstanceService iActProcessInstanceService; |
| | | private final IActHiProcinstService iActHiProcinstService; |
| | | private final IFlwInstanceService flwInstanceService; |
| | | private final IFlwDefinitionService flwDefinitionService; |
| | | private final IFlwTaskService flwTaskService; |
| | | |
| | | /** |
| | | * è¿è¡ä¸çå®ä¾ å é¤ç¨å®ä¾ï¼å é¤åå²è®°å½ï¼å é¤ä¸å¡ä¸æµç¨å
³èä¿¡æ¯ |
| | | * å 餿µç¨å®ä¾ |
| | | * |
| | | * @param businessKeys ä¸å¡id |
| | | * @param businessIds ä¸å¡id |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public boolean deleteRunAndHisInstance(List<String> businessKeys) { |
| | | return iActProcessInstanceService.deleteRunAndHisInstance(businessKeys); |
| | | public boolean deleteInstance(List<Long> businessIds) { |
| | | return flwInstanceService.deleteByBusinessIds(businessIds); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @param taskId ä»»å¡id |
| | | */ |
| | | @Override |
| | | public String getBusinessStatusByTaskId(String taskId) { |
| | | return WorkflowUtils.getBusinessStatusByTaskId(taskId); |
| | | public String getBusinessStatusByTaskId(Long taskId) { |
| | | FlowInstance flowInstance = flwInstanceService.selectByTaskId(taskId); |
| | | return ObjectUtil.isNotNull(flowInstance) ? flowInstance.getFlowStatus() : StringUtils.EMPTY; |
| | | } |
| | | |
| | | /** |
| | | * è·åå½åæµç¨ç¶æ |
| | | * |
| | | * @param businessKey ä¸å¡id |
| | | * @param businessId ä¸å¡id |
| | | */ |
| | | @Override |
| | | public String getBusinessStatus(String businessKey) { |
| | | return WorkflowUtils.getBusinessStatus(businessKey); |
| | | public String getBusinessStatus(String businessId) { |
| | | FlowInstance flowInstance = flwInstanceService.selectInstByBusinessId(businessId); |
| | | return ObjectUtil.isNotNull(flowInstance) ? flowInstance.getFlowStatus() : StringUtils.EMPTY; |
| | | } |
| | | |
| | | /** |
| | | * 设置æµç¨åé(å
¨å±åé) |
| | | * 设置æµç¨åé |
| | | * |
| | | * @param taskId ä»»å¡id |
| | | * @param variableName åéåç§° |
| | | * @param value åéå¼ |
| | | * @param instanceId æµç¨å®ä¾id |
| | | * @param variables æµç¨åé |
| | | */ |
| | | @Override |
| | | public void setVariable(String taskId, String variableName, Object value) { |
| | | runtimeService.setVariable(taskId, variableName, value); |
| | | public void setVariable(Long instanceId, Map<String, Object> variables) { |
| | | flwInstanceService.setVariable(instanceId, variables); |
| | | } |
| | | |
| | | /** |
| | | * 设置æµç¨åé(å
¨å±åé) |
| | | * è·åæµç¨åé |
| | | * |
| | | * @param taskId ä»»å¡id |
| | | * @param variables æµç¨åé |
| | | * @param instanceId æµç¨å®ä¾id |
| | | */ |
| | | @Override |
| | | public void setVariables(String taskId, Map<String, Object> variables) { |
| | | runtimeService.setVariables(taskId, variables); |
| | | } |
| | | |
| | | /** |
| | | * 设置æµç¨åé(æ¬å°åé,éå
¨å±åé) |
| | | * |
| | | * @param taskId ä»»å¡id |
| | | * @param variableName åéåç§° |
| | | * @param value åéå¼ |
| | | */ |
| | | @Override |
| | | public void setVariableLocal(String taskId, String variableName, Object value) { |
| | | runtimeService.setVariableLocal(taskId, variableName, value); |
| | | } |
| | | |
| | | /** |
| | | * 设置æµç¨åé(æ¬å°åé,éå
¨å±åé) |
| | | * |
| | | * @param taskId ä»»å¡id |
| | | * @param variables æµç¨åé |
| | | */ |
| | | @Override |
| | | public void setVariablesLocal(String taskId, Map<String, Object> variables) { |
| | | runtimeService.setVariablesLocal(taskId, variables); |
| | | public Map<String, Object> instanceVariable(Long instanceId) { |
| | | return flwInstanceService.instanceVariable(instanceId); |
| | | } |
| | | |
| | | /** |
| | | * æç
§ä¸å¡idæ¥è¯¢æµç¨å®ä¾id |
| | | * |
| | | * @param businessKey ä¸å¡id |
| | | * @param businessId ä¸å¡id |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public String getInstanceIdByBusinessKey(String businessKey) { |
| | | ActHiProcinst actHiProcinst = iActHiProcinstService.selectByBusinessKey(businessKey); |
| | | if (actHiProcinst == null) { |
| | | return StrUtil.EMPTY; |
| | | } |
| | | return actHiProcinst.getId(); |
| | | public Long getInstanceIdByBusinessId(String businessId) { |
| | | FlowInstance flowInstance = flwInstanceService.selectInstByBusinessId(businessId); |
| | | return ObjectUtil.isNotNull(flowInstance) ? flowInstance.getId() : null; |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢ç§æ·æµç¨å®ä¹ |
| | | * |
| | | * @param tenantId ç§æ·id |
| | | */ |
| | | @Override |
| | | public void syncDef(String tenantId) { |
| | | flwDefinitionService.syncDef(tenantId); |
| | | } |
| | | |
| | | /** |
| | | * å¯å¨æµç¨ |
| | | * |
| | | * @param startProcess åæ° |
| | | */ |
| | | @Override |
| | | public StartProcessReturnDTO startWorkFlow(StartProcessDTO startProcess) { |
| | | return flwTaskService.startWorkFlow(BeanUtil.toBean(startProcess, StartProcessBo.class)); |
| | | } |
| | | |
| | | /** |
| | | * åçä»»å¡ |
| | | * |
| | | * @param completeTask åæ° |
| | | */ |
| | | @Override |
| | | public boolean completeTask(CompleteTaskDTO completeTask) { |
| | | return flwTaskService.completeTask(BeanUtil.toBean(completeTask, CompleteTaskBo.class)); |
| | | } |
| | | } |
| | |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import lombok.AccessLevel; |
| | | import lombok.NoArgsConstructor; |
| | | import org.dromara.common.core.domain.dto.RoleDTO; |
| | | import org.dromara.common.core.domain.dto.UserDTO; |
| | | import org.dromara.common.core.service.UserService; |
| | | import org.dromara.common.core.utils.SpringUtils; |
| | | import org.dromara.common.core.utils.StreamUtils; |
| | | import org.dromara.common.core.utils.StringUtils; |
| | | import org.dromara.common.mail.utils.MailUtils; |
| | | import org.dromara.common.satoken.utils.LoginHelper; |
| | | import org.dromara.common.tenant.helper.TenantHelper; |
| | | import org.dromara.common.websocket.dto.WebSocketMessageDto; |
| | | import org.dromara.common.websocket.utils.WebSocketUtils; |
| | | import org.dromara.workflow.common.constant.FlowConstant; |
| | | import org.dromara.common.sse.dto.SseMessageDto; |
| | | import org.dromara.common.sse.utils.SseMessageUtils; |
| | | import org.dromara.warm.flow.core.constant.ExceptionCons; |
| | | import org.dromara.warm.flow.core.dto.FlowParams; |
| | | import org.dromara.warm.flow.core.entity.Node; |
| | | import org.dromara.warm.flow.core.entity.Task; |
| | | import org.dromara.warm.flow.core.entity.User; |
| | | import org.dromara.warm.flow.core.enums.NodeType; |
| | | import org.dromara.warm.flow.core.enums.SkipType; |
| | | import org.dromara.warm.flow.core.service.NodeService; |
| | | import org.dromara.warm.flow.core.service.TaskService; |
| | | import org.dromara.warm.flow.core.service.UserService; |
| | | import org.dromara.warm.flow.core.utils.AssertUtil; |
| | | import org.dromara.warm.flow.orm.entity.FlowNode; |
| | | import org.dromara.warm.flow.orm.entity.FlowTask; |
| | | import org.dromara.warm.flow.orm.entity.FlowUser; |
| | | import org.dromara.warm.flow.orm.mapper.FlowNodeMapper; |
| | | import org.dromara.warm.flow.orm.mapper.FlowTaskMapper; |
| | | import org.dromara.workflow.common.enums.MessageTypeEnum; |
| | | import org.dromara.workflow.common.enums.TaskStatusEnum; |
| | | import org.dromara.workflow.domain.ActHiTaskinst; |
| | | import org.dromara.workflow.domain.vo.MultiInstanceVo; |
| | | import org.dromara.workflow.domain.vo.ParticipantVo; |
| | | import org.dromara.workflow.flowable.cmd.UpdateHiTaskInstCmd; |
| | | import org.dromara.workflow.mapper.ActHiTaskinstMapper; |
| | | import org.flowable.bpmn.model.BpmnModel; |
| | | import org.flowable.bpmn.model.FlowNode; |
| | | import org.flowable.common.engine.api.delegate.Expression; |
| | | import org.flowable.engine.ProcessEngine; |
| | | import org.flowable.engine.history.HistoricProcessInstance; |
| | | import org.flowable.engine.impl.bpmn.behavior.ParallelMultiInstanceBehavior; |
| | | import org.flowable.engine.impl.bpmn.behavior.SequentialMultiInstanceBehavior; |
| | | import org.flowable.identitylink.api.history.HistoricIdentityLink; |
| | | import org.flowable.task.api.Task; |
| | | import org.flowable.task.api.TaskQuery; |
| | | import org.flowable.task.api.history.HistoricTaskInstance; |
| | | import org.flowable.task.service.impl.persistence.entity.TaskEntity; |
| | | import org.dromara.workflow.service.IFlwTaskAssigneeService; |
| | | import org.dromara.workflow.service.IFlwTaskService; |
| | | |
| | | import java.util.*; |
| | | import java.util.ArrayList; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | import java.util.stream.Collectors; |
| | | |
| | | |
| | | /** |
| | | * 工使µå·¥å
· |
| | |
| | | @NoArgsConstructor(access = AccessLevel.PRIVATE) |
| | | public class WorkflowUtils { |
| | | |
| | | private static final ProcessEngine PROCESS_ENGINE = SpringUtils.getBean(ProcessEngine.class); |
| | | private static final ActHiTaskinstMapper ACT_HI_TASKINST_MAPPER = SpringUtils.getBean(ActHiTaskinstMapper.class); |
| | | private static final IFlwTaskAssigneeService TASK_ASSIGNEE_SERVICE = SpringUtils.getBean(IFlwTaskAssigneeService.class); |
| | | private static final IFlwTaskService FLW_TASK_SERVICE = SpringUtils.getBean(IFlwTaskService.class); |
| | | private static final FlowNodeMapper FLOW_NODE_MAPPER = SpringUtils.getBean(FlowNodeMapper.class); |
| | | private static final FlowTaskMapper FLOW_TASK_MAPPER = SpringUtils.getBean(FlowTaskMapper.class); |
| | | private static final UserService USER_SERVICE = SpringUtils.getBean(UserService.class); |
| | | private static final TaskService TASK_SERVICE = SpringUtils.getBean(TaskService.class); |
| | | private static final NodeService NODE_SERVICE = SpringUtils.getBean(NodeService.class); |
| | | |
| | | /** |
| | | * å建ä¸ä¸ªæ°ä»»å¡ |
| | | * |
| | | * @param currentTask åæ° |
| | | * è·å工使µç¨æ·service |
| | | */ |
| | | public static TaskEntity createNewTask(Task currentTask) { |
| | | TaskEntity task = null; |
| | | if (ObjectUtil.isNotEmpty(currentTask)) { |
| | | task = (TaskEntity) PROCESS_ENGINE.getTaskService().newTask(); |
| | | task.setCategory(currentTask.getCategory()); |
| | | task.setDescription(currentTask.getDescription()); |
| | | task.setAssignee(currentTask.getAssignee()); |
| | | task.setName(currentTask.getName()); |
| | | task.setProcessDefinitionId(currentTask.getProcessDefinitionId()); |
| | | task.setProcessInstanceId(currentTask.getProcessInstanceId()); |
| | | task.setTaskDefinitionKey(currentTask.getTaskDefinitionKey()); |
| | | task.setPriority(currentTask.getPriority()); |
| | | task.setCreateTime(new Date()); |
| | | task.setTenantId(TenantHelper.getTenantId()); |
| | | PROCESS_ENGINE.getTaskService().saveTask(task); |
| | | } |
| | | if (ObjectUtil.isNotNull(task)) { |
| | | UpdateHiTaskInstCmd updateHiTaskInstCmd = new UpdateHiTaskInstCmd(Collections.singletonList(task.getId()), task.getProcessDefinitionId(), task.getProcessInstanceId()); |
| | | PROCESS_ENGINE.getManagementService().executeCommand(updateHiTaskInstCmd); |
| | | } |
| | | return task; |
| | | public static UserService getFlowUserService() { |
| | | return USER_SERVICE; |
| | | } |
| | | |
| | | /** |
| | | * æéä»»å¡ |
| | | * æå»ºå·¥ä½æµç¨æ· |
| | | * |
| | | * @param parentTaskList ç¶çº§ä»»å¡ |
| | | * @param userIds 人åid |
| | | * @param userList åçç¨æ· |
| | | * @param taskId ä»»å¡ID |
| | | * @return ç¨æ· |
| | | */ |
| | | public static void createCopyTask(List<Task> parentTaskList, List<Long> userIds) { |
| | | List<Task> list = new ArrayList<>(); |
| | | String tenantId = TenantHelper.getTenantId(); |
| | | for (Task parentTask : parentTaskList) { |
| | | for (Long userId : userIds) { |
| | | TaskEntity newTask = (TaskEntity) PROCESS_ENGINE.getTaskService().newTask(); |
| | | newTask.setParentTaskId(parentTask.getId()); |
| | | newTask.setAssignee(userId.toString()); |
| | | newTask.setName("ãæéã-" + parentTask.getName()); |
| | | newTask.setProcessDefinitionId(parentTask.getProcessDefinitionId()); |
| | | newTask.setProcessInstanceId(parentTask.getProcessInstanceId()); |
| | | newTask.setTaskDefinitionKey(parentTask.getTaskDefinitionKey()); |
| | | newTask.setTenantId(tenantId); |
| | | list.add(newTask); |
| | | public static Set<User> buildUser(List<User> userList, Long taskId) { |
| | | if (CollUtil.isEmpty(userList)) { |
| | | return Set.of(); |
| | | } |
| | | Set<User> list = new HashSet<>(); |
| | | Set<String> processedBySet = new HashSet<>(); |
| | | for (User user : userList) { |
| | | // æ ¹æ® processedBy åç¼å¤æå¤ç人类åï¼åå«è·åç¨æ·å表 |
| | | List<UserDTO> users = TASK_ASSIGNEE_SERVICE.fetchUsersByStorageId(user.getProcessedBy()); |
| | | // 转æ¢ä¸º FlowUser å¹¶æ·»å å°ç»æéå |
| | | if (CollUtil.isNotEmpty(users)) { |
| | | users.forEach(dto -> { |
| | | String processedBy = String.valueOf(dto.getUserId()); |
| | | if (!processedBySet.contains(processedBy)) { |
| | | FlowUser flowUser = new FlowUser(); |
| | | flowUser.setType(user.getType()); |
| | | flowUser.setProcessedBy(processedBy); |
| | | flowUser.setAssociated(taskId); |
| | | list.add(flowUser); |
| | | processedBySet.add(processedBy); |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | PROCESS_ENGINE.getTaskService().bulkSaveTasks(list); |
| | | if (CollUtil.isNotEmpty(list) && CollUtil.isNotEmpty(parentTaskList)) { |
| | | String processInstanceId = parentTaskList.get(0).getProcessInstanceId(); |
| | | String processDefinitionId = parentTaskList.get(0).getProcessDefinitionId(); |
| | | List<String> taskIds = StreamUtils.toList(list, Task::getId); |
| | | ActHiTaskinst actHiTaskinst = new ActHiTaskinst(); |
| | | actHiTaskinst.setProcDefId(processDefinitionId); |
| | | actHiTaskinst.setProcInstId(processInstanceId); |
| | | actHiTaskinst.setScopeType(TaskStatusEnum.COPY.getStatus()); |
| | | actHiTaskinst.setTenantId(tenantId); |
| | | LambdaUpdateWrapper<ActHiTaskinst> updateWrapper = new LambdaUpdateWrapper<>(); |
| | | updateWrapper.in(ActHiTaskinst::getId, taskIds); |
| | | ACT_HI_TASKINST_MAPPER.update(actHiTaskinst, updateWrapper); |
| | | for (Task task : list) { |
| | | PROCESS_ENGINE.getTaskService().addComment(task.getId(), task.getProcessInstanceId(), TaskStatusEnum.COPY.getStatus(), StrUtil.EMPTY); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * è·åå½åä»»å¡åä¸è
|
| | | * |
| | | * @param taskId ä»»å¡id |
| | | */ |
| | | public static ParticipantVo getCurrentTaskParticipant(String taskId, UserService userService) { |
| | | ParticipantVo participantVo = new ParticipantVo(); |
| | | List<HistoricIdentityLink> linksForTask = PROCESS_ENGINE.getHistoryService().getHistoricIdentityLinksForTask(taskId); |
| | | Task task = QueryUtils.taskQuery().taskId(taskId).singleResult(); |
| | | if (task != null && CollUtil.isNotEmpty(linksForTask)) { |
| | | List<HistoricIdentityLink> groupList = StreamUtils.filter(linksForTask, e -> StringUtils.isNotBlank(e.getGroupId())); |
| | | if (CollUtil.isNotEmpty(groupList)) { |
| | | List<Long> groupIds = StreamUtils.toList(groupList, e -> Long.valueOf(e.getGroupId())); |
| | | List<Long> userIds = userService.selectUserIdsByRoleIds(groupIds); |
| | | if (CollUtil.isNotEmpty(userIds)) { |
| | | participantVo.setGroupIds(groupIds); |
| | | List<UserDTO> userList = userService.selectListByIds(userIds); |
| | | if (CollUtil.isNotEmpty(userList)) { |
| | | List<Long> userIdList = StreamUtils.toList(userList, UserDTO::getUserId); |
| | | List<String> nickNames = StreamUtils.toList(userList, UserDTO::getNickName); |
| | | participantVo.setCandidate(userIdList); |
| | | participantVo.setCandidateName(nickNames); |
| | | participantVo.setClaim(!StringUtils.isBlank(task.getAssignee())); |
| | | } |
| | | } |
| | | } else { |
| | | List<HistoricIdentityLink> candidateList = StreamUtils.filter(linksForTask, e -> FlowConstant.CANDIDATE.equals(e.getType())); |
| | | List<Long> userIdList = new ArrayList<>(); |
| | | for (HistoricIdentityLink historicIdentityLink : linksForTask) { |
| | | try { |
| | | userIdList.add(Long.valueOf(historicIdentityLink.getUserId())); |
| | | } catch (NumberFormatException ignored) { |
| | | |
| | | } |
| | | } |
| | | List<UserDTO> userList = userService.selectListByIds(userIdList); |
| | | if (CollUtil.isNotEmpty(userList)) { |
| | | List<Long> userIds = StreamUtils.toList(userList, UserDTO::getUserId); |
| | | List<String> nickNames = StreamUtils.toList(userList, UserDTO::getNickName); |
| | | participantVo.setCandidate(userIds); |
| | | participantVo.setCandidateName(nickNames); |
| | | // 夿å½å任塿¯å¦å
·æå¤ä¸ªåç人 |
| | | if (CollUtil.isNotEmpty(candidateList) && candidateList.size() > 1) { |
| | | // 妿 assignee åå¨ï¼å设置å½åä»»å¡å·²ç»è¢«è®¤é¢ |
| | | participantVo.setClaim(StringUtils.isNotBlank(task.getAssignee())); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return participantVo; |
| | | } |
| | | |
| | | /** |
| | | * 夿å½åèç¹æ¯å¦ä¸ºä¼ç¾èç¹ |
| | | * |
| | | * @param processDefinitionId æµç¨å®ä¹id |
| | | * @param taskDefinitionKey æµç¨å®ä¹id |
| | | */ |
| | | public static MultiInstanceVo isMultiInstance(String processDefinitionId, String taskDefinitionKey) { |
| | | BpmnModel bpmnModel = PROCESS_ENGINE.getRepositoryService().getBpmnModel(processDefinitionId); |
| | | FlowNode flowNode = (FlowNode) bpmnModel.getFlowElement(taskDefinitionKey); |
| | | MultiInstanceVo multiInstanceVo = new MultiInstanceVo(); |
| | | //夿æ¯å¦ä¸ºå¹¶è¡ä¼ç¾èç¹ |
| | | if (flowNode.getBehavior() instanceof ParallelMultiInstanceBehavior behavior && behavior.getCollectionExpression() != null) { |
| | | Expression collectionExpression = behavior.getCollectionExpression(); |
| | | String assigneeList = collectionExpression.getExpressionText(); |
| | | String assignee = behavior.getCollectionElementVariable(); |
| | | multiInstanceVo.setType(behavior); |
| | | multiInstanceVo.setAssignee(assignee); |
| | | multiInstanceVo.setAssigneeList(assigneeList); |
| | | return multiInstanceVo; |
| | | //夿æ¯å¦ä¸ºä¸²è¡ä¼ç¾èç¹ |
| | | } else if (flowNode.getBehavior() instanceof SequentialMultiInstanceBehavior behavior && behavior.getCollectionExpression() != null) { |
| | | Expression collectionExpression = behavior.getCollectionExpression(); |
| | | String assigneeList = collectionExpression.getExpressionText(); |
| | | String assignee = behavior.getCollectionElementVariable(); |
| | | multiInstanceVo.setType(behavior); |
| | | multiInstanceVo.setAssignee(assignee); |
| | | multiInstanceVo.setAssigneeList(assigneeList); |
| | | return multiInstanceVo; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * è·åå½åæµç¨ç¶æ |
| | | * |
| | | * @param taskId ä»»å¡id |
| | | */ |
| | | public static String getBusinessStatusByTaskId(String taskId) { |
| | | HistoricTaskInstance historicTaskInstance = QueryUtils.hisTaskInstanceQuery().taskId(taskId).singleResult(); |
| | | HistoricProcessInstance historicProcessInstance = QueryUtils.hisInstanceQuery(historicTaskInstance.getProcessInstanceId()).singleResult(); |
| | | return historicProcessInstance.getBusinessStatus(); |
| | | } |
| | | |
| | | /** |
| | | * è·åå½åæµç¨ç¶æ |
| | | * |
| | | * @param businessKey ä¸å¡id |
| | | */ |
| | | public static String getBusinessStatus(String businessKey) { |
| | | HistoricProcessInstance historicProcessInstance = QueryUtils.hisBusinessKeyQuery(businessKey).singleResult(); |
| | | return historicProcessInstance.getBusinessStatus(); |
| | | return list; |
| | | } |
| | | |
| | | /** |
| | | * åéæ¶æ¯ |
| | | * |
| | | * @param list ä»»å¡ |
| | | * @param name æµç¨åç§° |
| | | * @param flowName æµç¨å®ä¹åç§° |
| | | * @param messageType æ¶æ¯ç±»å |
| | | * @param message æ¶æ¯å
容ï¼ä¸ºç©ºååéé»è®¤é
ç½®çæ¶æ¯å
容 |
| | | */ |
| | | public static void sendMessage(List<Task> list, String name, List<String> messageType, String message, UserService userService) { |
| | | Set<Long> userIds = new HashSet<>(); |
| | | public static void sendMessage(String flowName, Long instId, List<String> messageType, String message) { |
| | | List<UserDTO> userList = new ArrayList<>(); |
| | | List<FlowTask> list = FLW_TASK_SERVICE.selectByInstId(instId); |
| | | if (StringUtils.isBlank(message)) { |
| | | message = "ææ°çã" + name + "ãåæ®å·²ç»æäº¤è³æ¨çå¾
åï¼è¯·æ¨åæ¶å¤çã"; |
| | | message = "ææ°çã" + flowName + "ãåæ®å·²ç»æäº¤è³æ¨ï¼è¯·æ¨åæ¶å¤çã"; |
| | | } |
| | | for (Task t : list) { |
| | | ParticipantVo taskParticipant = WorkflowUtils.getCurrentTaskParticipant(t.getId(), userService); |
| | | if (CollUtil.isNotEmpty(taskParticipant.getGroupIds())) { |
| | | List<Long> userIdList = userService.selectUserIdsByRoleIds(taskParticipant.getGroupIds()); |
| | | if (CollUtil.isNotEmpty(userIdList)) { |
| | | userIds.addAll(userIdList); |
| | | } |
| | | } |
| | | List<Long> candidate = taskParticipant.getCandidate(); |
| | | if (CollUtil.isNotEmpty(candidate)) { |
| | | userIds.addAll(candidate); |
| | | for (Task task : list) { |
| | | List<UserDTO> users = FLW_TASK_SERVICE.currentTaskAllUser(task.getId()); |
| | | if (CollUtil.isNotEmpty(users)) { |
| | | userList.addAll(users); |
| | | } |
| | | } |
| | | if (CollUtil.isNotEmpty(userIds)) { |
| | | List<UserDTO> userList = userService.selectListByIds(new ArrayList<>(userIds)); |
| | | if (CollUtil.isNotEmpty(userList)) { |
| | | for (String code : messageType) { |
| | | MessageTypeEnum messageTypeEnum = MessageTypeEnum.getByCode(code); |
| | | if (ObjectUtil.isNotEmpty(messageTypeEnum)) { |
| | | switch (messageTypeEnum) { |
| | | case SYSTEM_MESSAGE: |
| | | WebSocketMessageDto dto = new WebSocketMessageDto(); |
| | | dto.setSessionKeys(new ArrayList<>(userIds)); |
| | | SseMessageDto dto = new SseMessageDto(); |
| | | dto.setUserIds(StreamUtils.toList(userList, UserDTO::getUserId).stream().distinct().collect(Collectors.toList())); |
| | | dto.setMessage(message); |
| | | WebSocketUtils.publishMessage(dto); |
| | | SseMessageUtils.publishMessage(dto); |
| | | break; |
| | | case EMAIL_MESSAGE: |
| | | MailUtils.sendText(StreamUtils.join(userList, UserDTO::getEmail), "åæ®å®¡æ¹æé", message); |
| | |
| | | case SMS_MESSAGE: |
| | | //todo çä¿¡åé |
| | | break; |
| | | default: |
| | | throw new IllegalStateException("Unexpected value: " + messageTypeEnum); |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®ä»»å¡idæ¥è¯¢ å½åç¨æ·çä»»å¡ï¼æ£æ¥ å½åäººå æ¯å¦æ¯è¯¥ taskId çåç人 |
| | | * 驳å |
| | | * |
| | | * @param taskId ä»»å¡id |
| | | * @return ç»æ |
| | | * @param message å®¡æ¹æè§ |
| | | * @param instanceId æµç¨å®ä¾id |
| | | * @param targetNodeCode ç®æ èç¹ |
| | | * @param flowStatus æµç¨ç¶æ |
| | | * @param flowHisStatus èç¹æä½ç¶æ |
| | | */ |
| | | public static Task getTaskByCurrentUser(String taskId) { |
| | | TaskQuery taskQuery = QueryUtils.taskQuery(); |
| | | taskQuery.taskId(taskId).taskCandidateOrAssigned(String.valueOf(LoginHelper.getUserId())); |
| | | |
| | | List<RoleDTO> roles = LoginHelper.getLoginUser().getRoles(); |
| | | if (CollUtil.isNotEmpty(roles)) { |
| | | List<String> groupIds = StreamUtils.toList(roles, e -> String.valueOf(e.getRoleId())); |
| | | taskQuery.taskCandidateGroupIn(groupIds); |
| | | public static void backTask(String message, Long instanceId, String targetNodeCode, String flowStatus, String flowHisStatus) { |
| | | List<FlowTask> list = FLW_TASK_SERVICE.selectByInstId(instanceId); |
| | | if (CollUtil.isNotEmpty(list)) { |
| | | List<FlowTask> tasks = StreamUtils.filter(list, e -> e.getNodeCode().equals(targetNodeCode)); |
| | | if (list.size() == tasks.size()) { |
| | | return; |
| | | } |
| | | } |
| | | return taskQuery.singleResult(); |
| | | for (FlowTask task : list) { |
| | | List<UserDTO> userList = FLW_TASK_SERVICE.currentTaskAllUser(task.getId()); |
| | | FlowParams flowParams = FlowParams.build(); |
| | | flowParams.nodeCode(targetNodeCode); |
| | | flowParams.message(message); |
| | | flowParams.skipType(SkipType.PASS.getKey()); |
| | | flowParams.flowStatus(flowStatus).hisStatus(flowHisStatus); |
| | | flowParams.ignore(true); |
| | | //è§£å³ä¼ç¾æ²¡æéé®é¢ |
| | | if (CollUtil.isNotEmpty(userList)) { |
| | | flowParams.handler(userList.get(0).getUserId().toString()); |
| | | } |
| | | TASK_SERVICE.skip(task.getId(), flowParams); |
| | | } |
| | | //è§£å³ä¼ç¾å¤äººå®¡æ¹é®é¢ |
| | | backTask(message, instanceId, targetNodeCode, flowStatus, flowHisStatus); |
| | | } |
| | | |
| | | /** |
| | | * ç³è¯·äººèç¹ç¼ç |
| | | * |
| | | * @param definitionId æµç¨å®ä¹id |
| | | * @return ç³è¯·äººèç¹ç¼ç |
| | | */ |
| | | public static String applyNodeCode(Long definitionId) { |
| | | //è·åå·²åå¸çæµç¨èç¹ |
| | | List<FlowNode> flowNodes = FLOW_NODE_MAPPER.selectList(new LambdaQueryWrapper<FlowNode>().eq(FlowNode::getDefinitionId, definitionId)); |
| | | AssertUtil.isTrue(CollUtil.isEmpty(flowNodes), ExceptionCons.NOT_PUBLISH_NODE); |
| | | Node startNode = flowNodes.stream().filter(t -> NodeType.isStart(t.getNodeType())).findFirst().orElse(null); |
| | | AssertUtil.isNull(startNode, ExceptionCons.LOST_START_NODE); |
| | | Node nextNode = NODE_SERVICE.getNextNode(definitionId, startNode.getNodeCode(), null, SkipType.PASS.getKey()); |
| | | return nextNode.getNodeCode(); |
| | | } |
| | | |
| | | /** |
| | | * å é¤è¿è¡ä¸çä»»å¡ |
| | | * |
| | | * @param taskIds ä»»å¡id |
| | | */ |
| | | public static void deleteRunTask(List<Long> taskIds) { |
| | | if (CollUtil.isEmpty(taskIds)) { |
| | | return; |
| | | } |
| | | USER_SERVICE.deleteByTaskIds(taskIds); |
| | | FLOW_TASK_MAPPER.deleteByIds(taskIds); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper |
| | | PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="org.dromara.workflow.mapper.FlwCategoryMapper"> |
| | | |
| | | <select id="countCategoryById" resultType="Long"> |
| | | select count(*) from flow_category where del_flag = '0' and category_id = #{categoryId} |
| | | </select> |
| | | |
| | | </mapper> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper |
| | | PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="org.dromara.workflow.mapper.FlwInstanceMapper"> |
| | | <resultMap type="org.dromara.workflow.domain.vo.FlowInstanceVo" id="FlowInstanceResult"> |
| | | </resultMap> |
| | | |
| | | <select id="selectInstanceList" resultMap="FlowInstanceResult"> |
| | | select fi.id, |
| | | fi.create_time, |
| | | fi.update_time, |
| | | fi.tenant_id, |
| | | fi.del_flag, |
| | | fi.definition_id, |
| | | fi.business_id, |
| | | fi.node_type, |
| | | fi.node_code, |
| | | fi.node_name, |
| | | fi.variable, |
| | | fi.flow_status, |
| | | fi.activity_status, |
| | | fi.create_by, |
| | | fi.ext, |
| | | fd.flow_name, |
| | | fd.flow_code, |
| | | fd.version, |
| | | fd.form_custom, |
| | | fd.form_path, |
| | | fd.category |
| | | from flow_instance fi |
| | | left join flow_definition fd on fi.definition_id = fd.id |
| | | ${ew.getCustomSqlSegment} |
| | | </select> |
| | | |
| | | </mapper> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper |
| | | PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="org.dromara.workflow.mapper.FlwTaskMapper"> |
| | | <resultMap type="org.dromara.workflow.domain.vo.FlowTaskVo" id="FlowTaskResult"> |
| | | </resultMap> |
| | | <resultMap type="org.dromara.workflow.domain.vo.FlowHisTaskVo" id="FlowHisTaskResult"> |
| | | </resultMap> |
| | | |
| | | <select id="getListRunTask" resultMap="FlowTaskResult"> |
| | | select * from ( |
| | | select distinct |
| | | t.id, |
| | | t.node_code, |
| | | t.node_name, |
| | | t.node_type, |
| | | t.definition_id, |
| | | t.instance_id, |
| | | t.create_time, |
| | | t.update_time, |
| | | t.tenant_id, |
| | | i.business_id, |
| | | i.flow_status, |
| | | i.create_by, |
| | | d.flow_name, |
| | | d.flow_code, |
| | | d.form_custom, |
| | | d.category, |
| | | COALESCE(t.form_path, d.form_path) as form_path, |
| | | d.version, |
| | | uu.processed_by, |
| | | uu.type |
| | | from flow_task as t |
| | | left join flow_user uu on uu.associated = t.id |
| | | left join flow_definition d on t.definition_id = d.id |
| | | left join flow_instance i on t.instance_id = i.id |
| | | where t.node_type = 1 |
| | | and t.del_flag = '0' |
| | | and uu.del_flag = '0' |
| | | and uu.type in ('1','2','3') |
| | | ) t |
| | | ${ew.getCustomSqlSegment} |
| | | </select> |
| | | |
| | | <select id="getListFinishTask" resultMap="FlowHisTaskResult"> |
| | | select * from ( |
| | | select |
| | | a.id, |
| | | a.node_code, |
| | | a.node_name, |
| | | a.cooperate_type, |
| | | a.approver, |
| | | a.collaborator, |
| | | a.node_type, |
| | | a.target_node_code, |
| | | a.target_node_name, |
| | | a.definition_id, |
| | | a.instance_id, |
| | | a.flow_status flow_task_status, |
| | | a.message, |
| | | a.ext, |
| | | a.create_time, |
| | | a.update_time, |
| | | a.tenant_id, |
| | | a.form_custom, |
| | | a.form_path, |
| | | b.flow_status, |
| | | b.business_id, |
| | | b.create_by, |
| | | c.flow_name, |
| | | c.flow_code, |
| | | c.category, |
| | | c.version |
| | | from flow_his_task a |
| | | left join flow_instance b on a.instance_id = b.id |
| | | left join flow_definition c on a.definition_id = c.id |
| | | where a.del_flag ='0' |
| | | and b.del_flag = '0' |
| | | and c.del_flag = '0' |
| | | and a.node_type in ('1','3','4') |
| | | ) t |
| | | ${ew.getCustomSqlSegment} |
| | | </select> |
| | | |
| | | <select id="getTaskCopyByPage" resultMap="FlowTaskResult"> |
| | | select * from ( |
| | | select |
| | | b.id, |
| | | b.update_time, |
| | | c.business_id, |
| | | c.flow_status, |
| | | c.create_by, |
| | | a.processed_by, |
| | | a.create_time, |
| | | b.form_custom, |
| | | b.form_path, |
| | | b.node_name, |
| | | b.node_code, |
| | | d.flow_name, |
| | | d.flow_code, |
| | | d.category, |
| | | d.version |
| | | from flow_user a |
| | | left join flow_his_task b on a.associated = b.task_id |
| | | left join flow_instance c on b.instance_id = c.id |
| | | left join flow_definition d on c.definition_id=d.id |
| | | where a.type = '4' |
| | | and a.del_flag = '0' |
| | | and b.del_flag = '0' |
| | | and d.del_flag = '0' |
| | | ) t |
| | | ${ew.getCustomSqlSegment} |
| | | </select> |
| | | </mapper> |
| | |
| | | version: '3' |
| | | |
| | | services: |
| | | # æ¤éåä»
ç¨äºæµè¯ æ£å¼ç¯å¢éèªè¡å®è£
æ°æ®åº |
| | | # SID: XE user: system password: oracle |
| | |
| | | version: '3' |
| | | |
| | | services: |
| | | mysql: |
| | | image: mysql:8.0.33 |
| | |
| | | network_mode: "host" |
| | | |
| | | ruoyi-server1: |
| | | image: ruoyi/ruoyi-server:5.2.2 |
| | | image: ruoyi/ruoyi-server:5.3.0 |
| | | container_name: ruoyi-server1 |
| | | environment: |
| | | # æ¶åºä¸æµ· |
| | |
| | | network_mode: "host" |
| | | |
| | | ruoyi-server2: |
| | | image: ruoyi/ruoyi-server:5.2.2 |
| | | image: ruoyi/ruoyi-server:5.3.0 |
| | | container_name: ruoyi-server2 |
| | | environment: |
| | | # æ¶åºä¸æµ· |
| | |
| | | network_mode: "host" |
| | | |
| | | ruoyi-monitor-admin: |
| | | image: ruoyi/ruoyi-monitor-admin:5.2.2 |
| | | image: ruoyi/ruoyi-monitor-admin:5.3.0 |
| | | container_name: ruoyi-monitor-admin |
| | | environment: |
| | | # æ¶åºä¸æµ· |
| | |
| | | network_mode: "host" |
| | | |
| | | ruoyi-snailjob-server: |
| | | image: ruoyi/ruoyi-snailjob-server:5.2.2 |
| | | image: ruoyi/ruoyi-snailjob-server:5.3.0 |
| | | container_name: ruoyi-snailjob-server |
| | | environment: |
| | | # æ¶åºä¸æµ· |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "flowCode" : "leave1", |
| | | "flowName" : "请åç³è¯·-æ®é", |
| | | "category" : "1", |
| | | "version" : "1", |
| | | "formCustom" : "N", |
| | | "formPath" : "/workflow/leaveEdit/index", |
| | | "nodeList" : [ { |
| | | "nodeType" : 0, |
| | | "nodeCode" : "d5ee3ddf-3968-4379-a86f-9ceabde5faac", |
| | | "nodeName" : "å¼å§", |
| | | "nodeRatio" : 0.000, |
| | | "coordinate" : "200,200|200,200", |
| | | "skipAnyNode" : "N", |
| | | "formCustom" : "N", |
| | | "skipList" : [ { |
| | | "nowNodeCode" : "d5ee3ddf-3968-4379-a86f-9ceabde5faac", |
| | | "nextNodeCode" : "dd515cdd-59f6-446f-94ca-25ca062afb42", |
| | | "skipType" : "PASS", |
| | | "coordinate" : "220,200;310,200" |
| | | } ] |
| | | }, { |
| | | "nodeType" : 1, |
| | | "nodeCode" : "dd515cdd-59f6-446f-94ca-25ca062afb42", |
| | | "nodeName" : "ç³è¯·äºº", |
| | | "nodeRatio" : 0.000, |
| | | "coordinate" : "360,200|360,200", |
| | | "skipAnyNode" : "N", |
| | | "formCustom" : "N", |
| | | "skipList" : [ { |
| | | "nowNodeCode" : "dd515cdd-59f6-446f-94ca-25ca062afb42", |
| | | "nextNodeCode" : "78fa8e5b-e809-44ed-978a-41092409ebcf", |
| | | "skipType" : "PASS", |
| | | "coordinate" : "410,200;490,200" |
| | | } ] |
| | | }, { |
| | | "nodeType" : 1, |
| | | "nodeCode" : "78fa8e5b-e809-44ed-978a-41092409ebcf", |
| | | "nodeName" : "ç»é¿", |
| | | "permissionFlag" : "role:1", |
| | | "nodeRatio" : 0.000, |
| | | "coordinate" : "540,200|540,200", |
| | | "skipAnyNode" : "N", |
| | | "formCustom" : "N", |
| | | "skipList" : [ { |
| | | "nowNodeCode" : "78fa8e5b-e809-44ed-978a-41092409ebcf", |
| | | "nextNodeCode" : "a8abf15f-b83e-428a-86cc-033555ea9bbe", |
| | | "skipType" : "PASS", |
| | | "coordinate" : "590,200;670,200" |
| | | } ] |
| | | }, { |
| | | "nodeType" : 1, |
| | | "nodeCode" : "a8abf15f-b83e-428a-86cc-033555ea9bbe", |
| | | "nodeName" : "é¨é¨ä¸»ç®¡", |
| | | "permissionFlag" : "role:3,role:4", |
| | | "nodeRatio" : 0.000, |
| | | "coordinate" : "720,200|720,200", |
| | | "skipAnyNode" : "N", |
| | | "formCustom" : "N", |
| | | "skipList" : [ { |
| | | "nowNodeCode" : "a8abf15f-b83e-428a-86cc-033555ea9bbe", |
| | | "nextNodeCode" : "8b82b7d7-8660-455e-b880-d6d22ea3eb6d", |
| | | "skipType" : "PASS", |
| | | "coordinate" : "770,200;880,200" |
| | | } ] |
| | | }, { |
| | | "nodeType" : 2, |
| | | "nodeCode" : "8b82b7d7-8660-455e-b880-d6d22ea3eb6d", |
| | | "nodeName" : "ç»æ", |
| | | "nodeRatio" : 0.000, |
| | | "coordinate" : "900,200|900,200", |
| | | "skipAnyNode" : "N", |
| | | "formCustom" : "N" |
| | | } ] |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "flowCode" : "leave2", |
| | | "flowName" : "请åç³è¯·-æä»ç½å
³", |
| | | "category" : "1", |
| | | "version" : "1", |
| | | "formCustom" : "N", |
| | | "formPath" : "/workflow/leaveEdit/index", |
| | | "nodeList" : [ { |
| | | "nodeType" : 0, |
| | | "nodeCode" : "cef3895c-f7d8-4598-8bf3-8ec2ef6ce84a", |
| | | "nodeName" : "å¼å§", |
| | | "nodeRatio" : 0.000, |
| | | "coordinate" : "300,240|300,240", |
| | | "skipAnyNode" : "N", |
| | | "formCustom" : "N", |
| | | "skipList" : [ { |
| | | "nowNodeCode" : "cef3895c-f7d8-4598-8bf3-8ec2ef6ce84a", |
| | | "nextNodeCode" : "fdcae93b-b69c-498a-b231-09255e74bcbd", |
| | | "skipType" : "PASS", |
| | | "coordinate" : "320,240;390,240" |
| | | } ] |
| | | }, { |
| | | "nodeType" : 1, |
| | | "nodeCode" : "fdcae93b-b69c-498a-b231-09255e74bcbd", |
| | | "nodeName" : "ç³è¯·äºº", |
| | | "nodeRatio" : 0.000, |
| | | "coordinate" : "440,240|440,240", |
| | | "skipAnyNode" : "N", |
| | | "formCustom" : "N", |
| | | "skipList" : [ { |
| | | "nowNodeCode" : "fdcae93b-b69c-498a-b231-09255e74bcbd", |
| | | "nextNodeCode" : "7b8c7ead-7dc8-4951-a7f3-f0c41995909e", |
| | | "skipType" : "PASS", |
| | | "coordinate" : "490,240;535,240" |
| | | } ] |
| | | }, { |
| | | "nodeType" : 3, |
| | | "nodeCode" : "7b8c7ead-7dc8-4951-a7f3-f0c41995909e", |
| | | "nodeRatio" : 0.000, |
| | | "coordinate" : "560,240", |
| | | "skipAnyNode" : "N", |
| | | "formCustom" : "N", |
| | | "skipList" : [ { |
| | | "nowNodeCode" : "7b8c7ead-7dc8-4951-a7f3-f0c41995909e", |
| | | "nextNodeCode" : "b3528155-dcb7-4445-bbdf-3d00e3499e86", |
| | | "skipType" : "PASS", |
| | | "skipCondition" : "le@@leaveDays|2", |
| | | "coordinate" : "560,265;560,320;670,320" |
| | | }, { |
| | | "nowNodeCode" : "7b8c7ead-7dc8-4951-a7f3-f0c41995909e", |
| | | "nextNodeCode" : "5ed2362b-fc0c-4d52-831f-95208b830605", |
| | | "skipName" : "大äºä¸¤å¤©", |
| | | "skipType" : "PASS", |
| | | "skipCondition" : "gt@@leaveDays|2", |
| | | "coordinate" : "560,215;560,160;670,160|560,187" |
| | | } ] |
| | | }, { |
| | | "nodeType" : 1, |
| | | "nodeCode" : "b3528155-dcb7-4445-bbdf-3d00e3499e86", |
| | | "nodeName" : "ç»é¿", |
| | | "permissionFlag" : "3,4", |
| | | "nodeRatio" : 0.000, |
| | | "coordinate" : "720,320|720,320", |
| | | "skipAnyNode" : "N", |
| | | "formCustom" : "N", |
| | | "skipList" : [ { |
| | | "nowNodeCode" : "b3528155-dcb7-4445-bbdf-3d00e3499e86", |
| | | "nextNodeCode" : "c9fa6d7d-2a74-4e78-b947-0cad8a6af869", |
| | | "skipType" : "PASS", |
| | | "coordinate" : "770,320;860,320;860,280" |
| | | } ] |
| | | }, { |
| | | "nodeType" : 1, |
| | | "nodeCode" : "c9fa6d7d-2a74-4e78-b947-0cad8a6af869", |
| | | "nodeName" : "æ»ç»ç", |
| | | "permissionFlag" : "role:1", |
| | | "nodeRatio" : 0.000, |
| | | "coordinate" : "860,240|860,240", |
| | | "skipAnyNode" : "N", |
| | | "formCustom" : "N", |
| | | "skipList" : [ { |
| | | "nowNodeCode" : "c9fa6d7d-2a74-4e78-b947-0cad8a6af869", |
| | | "nextNodeCode" : "40aa65fd-0712-4d23-b6f7-d0432b920fd1", |
| | | "skipType" : "PASS", |
| | | "coordinate" : "910,240;980,240" |
| | | } ] |
| | | }, { |
| | | "nodeType" : 2, |
| | | "nodeCode" : "40aa65fd-0712-4d23-b6f7-d0432b920fd1", |
| | | "nodeName" : "ç»æ", |
| | | "nodeRatio" : 0.000, |
| | | "coordinate" : "1000,240|1000,240", |
| | | "skipAnyNode" : "N", |
| | | "formCustom" : "N" |
| | | }, { |
| | | "nodeType" : 1, |
| | | "nodeCode" : "5ed2362b-fc0c-4d52-831f-95208b830605", |
| | | "nodeName" : "é¨é¨é¢å¯¼", |
| | | "permissionFlag" : "role:1", |
| | | "nodeRatio" : 0.000, |
| | | "coordinate" : "720,160|720,160", |
| | | "skipAnyNode" : "N", |
| | | "formCustom" : "N", |
| | | "skipList" : [ { |
| | | "nowNodeCode" : "5ed2362b-fc0c-4d52-831f-95208b830605", |
| | | "nextNodeCode" : "c9fa6d7d-2a74-4e78-b947-0cad8a6af869", |
| | | "skipType" : "PASS", |
| | | "coordinate" : "770,160;860,160;860,200" |
| | | } ] |
| | | } ] |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "flowCode" : "leave3", |
| | | "flowName" : "请åç³è¯·-å¹¶è¡ç½å
³", |
| | | "category" : "1", |
| | | "version" : "1", |
| | | "formCustom" : "N", |
| | | "formPath" : "/workflow/leaveEdit/index", |
| | | "nodeList" : [ { |
| | | "nodeType" : 0, |
| | | "nodeCode" : "a80ecf9f-f465-4ae5-a429-e30ec5d0f957", |
| | | "nodeName" : "å¼å§", |
| | | "nodeRatio" : 0.000, |
| | | "coordinate" : "380,220|380,220", |
| | | "skipAnyNode" : "N", |
| | | "formCustom" : "N", |
| | | "skipList" : [ { |
| | | "nowNodeCode" : "a80ecf9f-f465-4ae5-a429-e30ec5d0f957", |
| | | "nextNodeCode" : "b7bbb571-06de-455c-8083-f83c07bf0b99", |
| | | "skipType" : "PASS", |
| | | "coordinate" : "400,220;470,220" |
| | | } ] |
| | | }, { |
| | | "nodeType" : 1, |
| | | "nodeCode" : "b7bbb571-06de-455c-8083-f83c07bf0b99", |
| | | "nodeName" : "ç³è¯·äºº", |
| | | "nodeRatio" : 0.000, |
| | | "coordinate" : "520,220|520,220", |
| | | "skipAnyNode" : "N", |
| | | "formCustom" : "N", |
| | | "skipList" : [ { |
| | | "nowNodeCode" : "b7bbb571-06de-455c-8083-f83c07bf0b99", |
| | | "nextNodeCode" : "84d7ed24-bb44-4ba1-bf1f-e6f5092d3f0a", |
| | | "skipType" : "PASS", |
| | | "coordinate" : "570,220;655,220" |
| | | } ] |
| | | }, { |
| | | "nodeType" : 4, |
| | | "nodeCode" : "84d7ed24-bb44-4ba1-bf1f-e6f5092d3f0a", |
| | | "nodeRatio" : 0.000, |
| | | "coordinate" : "680,220", |
| | | "skipAnyNode" : "N", |
| | | "formCustom" : "N", |
| | | "skipList" : [ { |
| | | "nowNodeCode" : "84d7ed24-bb44-4ba1-bf1f-e6f5092d3f0a", |
| | | "nextNodeCode" : "4b7743cd-940c-431b-926f-e7b614fbf1fe", |
| | | "skipType" : "PASS", |
| | | "coordinate" : "680,195;680,140;750,140" |
| | | }, { |
| | | "nowNodeCode" : "84d7ed24-bb44-4ba1-bf1f-e6f5092d3f0a", |
| | | "nextNodeCode" : "762cb975-37d8-4276-b6db-79a4c3606394", |
| | | "skipType" : "PASS", |
| | | "coordinate" : "680,245;680,300;750,300" |
| | | } ] |
| | | }, { |
| | | "nodeType" : 1, |
| | | "nodeCode" : "4b7743cd-940c-431b-926f-e7b614fbf1fe", |
| | | "nodeName" : "å¸åºé¨", |
| | | "permissionFlag" : "role:1", |
| | | "nodeRatio" : 0.000, |
| | | "coordinate" : "800,140|800,140", |
| | | "skipAnyNode" : "N", |
| | | "formCustom" : "N", |
| | | "skipList" : [ { |
| | | "nowNodeCode" : "4b7743cd-940c-431b-926f-e7b614fbf1fe", |
| | | "nextNodeCode" : "b66b6563-f9fe-41cc-a782-f7837bb6f3d2", |
| | | "skipType" : "PASS", |
| | | "coordinate" : "850,140;920,140;920,195" |
| | | } ] |
| | | }, { |
| | | "nodeType" : 4, |
| | | "nodeCode" : "b66b6563-f9fe-41cc-a782-f7837bb6f3d2", |
| | | "nodeRatio" : 0.000, |
| | | "coordinate" : "920,220", |
| | | "skipAnyNode" : "N", |
| | | "formCustom" : "N", |
| | | "skipList" : [ { |
| | | "nowNodeCode" : "b66b6563-f9fe-41cc-a782-f7837bb6f3d2", |
| | | "nextNodeCode" : "23e7429e-2b47-4431-b93e-40db7c431ce6", |
| | | "skipType" : "PASS", |
| | | "coordinate" : "945,220;975,220;975,220;960,220;960,220;990,220" |
| | | } ] |
| | | }, { |
| | | "nodeType" : 1, |
| | | "nodeCode" : "23e7429e-2b47-4431-b93e-40db7c431ce6", |
| | | "nodeName" : "CEO", |
| | | "permissionFlag" : "1", |
| | | "nodeRatio" : 0.000, |
| | | "coordinate" : "1040,220|1040,220", |
| | | "skipAnyNode" : "N", |
| | | "formCustom" : "N", |
| | | "skipList" : [ { |
| | | "nowNodeCode" : "23e7429e-2b47-4431-b93e-40db7c431ce6", |
| | | "nextNodeCode" : "f5ace37f-5a5e-4e64-a6f6-913ab9a71cd1", |
| | | "skipType" : "PASS", |
| | | "coordinate" : "1090,220;1140,220" |
| | | } ] |
| | | }, { |
| | | "nodeType" : 2, |
| | | "nodeCode" : "f5ace37f-5a5e-4e64-a6f6-913ab9a71cd1", |
| | | "nodeName" : "ç»æ", |
| | | "nodeRatio" : 0.000, |
| | | "coordinate" : "1160,220|1160,220", |
| | | "skipAnyNode" : "N", |
| | | "formCustom" : "N" |
| | | }, { |
| | | "nodeType" : 1, |
| | | "nodeCode" : "762cb975-37d8-4276-b6db-79a4c3606394", |
| | | "nodeName" : "综åé¨", |
| | | "permissionFlag" : "role:3,role:4", |
| | | "nodeRatio" : 0.000, |
| | | "coordinate" : "800,300|800,300", |
| | | "skipAnyNode" : "N", |
| | | "formCustom" : "N", |
| | | "skipList" : [ { |
| | | "nowNodeCode" : "762cb975-37d8-4276-b6db-79a4c3606394", |
| | | "nextNodeCode" : "b66b6563-f9fe-41cc-a782-f7837bb6f3d2", |
| | | "skipType" : "PASS", |
| | | "coordinate" : "850,300;920,300;920,245" |
| | | } ] |
| | | } ] |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "flowCode" : "leave4", |
| | | "flowName" : "请åç³è¯·-ä¼ç¾", |
| | | "category" : "1", |
| | | "version" : "1", |
| | | "formCustom" : "N", |
| | | "formPath" : "/workflow/leaveEdit/index", |
| | | "nodeList" : [ { |
| | | "nodeType" : 0, |
| | | "nodeCode" : "9ce8bf00-f25b-4fc6-91b8-827082fc4876", |
| | | "nodeName" : "å¼å§", |
| | | "nodeRatio" : 0.000, |
| | | "coordinate" : "320,240|320,240", |
| | | "skipAnyNode" : "N", |
| | | "formCustom" : "N", |
| | | "skipList" : [ { |
| | | "nowNodeCode" : "9ce8bf00-f25b-4fc6-91b8-827082fc4876", |
| | | "nextNodeCode" : "e90b98ef-35b4-410c-a663-bae8b7624b9f", |
| | | "skipType" : "PASS", |
| | | "coordinate" : "340,240;410,240" |
| | | } ] |
| | | }, { |
| | | "nodeType" : 1, |
| | | "nodeCode" : "e90b98ef-35b4-410c-a663-bae8b7624b9f", |
| | | "nodeName" : "ç³è¯·äºº", |
| | | "nodeRatio" : 0.000, |
| | | "coordinate" : "460,240|460,240", |
| | | "skipAnyNode" : "N", |
| | | "formCustom" : "N", |
| | | "skipList" : [ { |
| | | "nowNodeCode" : "e90b98ef-35b4-410c-a663-bae8b7624b9f", |
| | | "nextNodeCode" : "768b5b1a-6726-4d67-8853-4cc70d5b1045", |
| | | "skipType" : "PASS", |
| | | "coordinate" : "510,240;590,240" |
| | | } ] |
| | | }, { |
| | | "nodeType" : 1, |
| | | "nodeCode" : "768b5b1a-6726-4d67-8853-4cc70d5b1045", |
| | | "nodeName" : "ç¾åä¹60éè¿", |
| | | "permissionFlag" : "${userList}", |
| | | "nodeRatio" : 60.000, |
| | | "coordinate" : "640,240|640,240", |
| | | "skipAnyNode" : "N", |
| | | "formCustom" : "N", |
| | | "skipList" : [ { |
| | | "nowNodeCode" : "768b5b1a-6726-4d67-8853-4cc70d5b1045", |
| | | "nextNodeCode" : "2f9f2e21-9bcf-42a3-a07c-13037aad22d1", |
| | | "skipType" : "PASS", |
| | | "coordinate" : "690,240;770,240" |
| | | } ] |
| | | }, { |
| | | "nodeType" : 1, |
| | | "nodeCode" : "2f9f2e21-9bcf-42a3-a07c-13037aad22d1", |
| | | "nodeName" : "å
¨é¨å®¡æ¹éè¿", |
| | | "permissionFlag" : "role:1,role:3", |
| | | "nodeRatio" : 100.000, |
| | | "coordinate" : "820,240|820,240", |
| | | "skipAnyNode" : "N", |
| | | "formCustom" : "N", |
| | | "skipList" : [ { |
| | | "nowNodeCode" : "2f9f2e21-9bcf-42a3-a07c-13037aad22d1", |
| | | "nextNodeCode" : "27461e01-3d9f-4530-8fe3-bd5ec7f9571f", |
| | | "skipType" : "PASS", |
| | | "coordinate" : "870,240;950,240" |
| | | } ] |
| | | }, { |
| | | "nodeType" : 1, |
| | | "nodeCode" : "27461e01-3d9f-4530-8fe3-bd5ec7f9571f", |
| | | "nodeName" : "CEO", |
| | | "permissionFlag" : "1", |
| | | "nodeRatio" : 0.000, |
| | | "coordinate" : "1000,240|1000,240", |
| | | "skipAnyNode" : "N", |
| | | "formCustom" : "N", |
| | | "skipList" : [ { |
| | | "nowNodeCode" : "27461e01-3d9f-4530-8fe3-bd5ec7f9571f", |
| | | "nextNodeCode" : "b62b88c3-8d8d-4969-911e-2aaea219e7fc", |
| | | "skipType" : "PASS", |
| | | "coordinate" : "1050,240;1080,240;1080,240;1070,240;1070,240;1100,240" |
| | | } ] |
| | | }, { |
| | | "nodeType" : 2, |
| | | "nodeCode" : "b62b88c3-8d8d-4969-911e-2aaea219e7fc", |
| | | "nodeName" : "ç»æ", |
| | | "nodeRatio" : 0.000, |
| | | "coordinate" : "1120,240|1120,240", |
| | | "skipAnyNode" : "N", |
| | | "formCustom" : "N" |
| | | } ] |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "flowCode" : "leave5", |
| | | "flowName" : "请åç³è¯·-å¹¶è¡ä¼ç¾ç½å
³", |
| | | "category" : "1", |
| | | "version" : "1", |
| | | "formCustom" : "N", |
| | | "formPath" : "/workflow/leaveEdit/index", |
| | | "nodeList" : [ { |
| | | "nodeType" : 0, |
| | | "nodeCode" : "ebebaf26-9cb6-497e-8119-4c9fed4c597c", |
| | | "nodeName" : "å¼å§", |
| | | "nodeRatio" : 0.000, |
| | | "coordinate" : "300,220|300,220", |
| | | "skipAnyNode" : "N", |
| | | "formCustom" : "N", |
| | | "skipList" : [ { |
| | | "nowNodeCode" : "ebebaf26-9cb6-497e-8119-4c9fed4c597c", |
| | | "nextNodeCode" : "e1b04e96-dc81-4858-a309-2fe945d2f374", |
| | | "skipType" : "PASS", |
| | | "coordinate" : "320,220;350,220;350,220;340,220;340,220;370,220" |
| | | } ] |
| | | }, { |
| | | "nodeType" : 1, |
| | | "nodeCode" : "e1b04e96-dc81-4858-a309-2fe945d2f374", |
| | | "nodeName" : "ç³è¯·äºº", |
| | | "nodeRatio" : 0.000, |
| | | "coordinate" : "420,220|420,220", |
| | | "skipAnyNode" : "N", |
| | | "formCustom" : "N", |
| | | "skipList" : [ { |
| | | "nowNodeCode" : "e1b04e96-dc81-4858-a309-2fe945d2f374", |
| | | "nextNodeCode" : "3e743f4f-51ca-41d4-8e94-21f5dd9b59c9", |
| | | "skipType" : "PASS", |
| | | "coordinate" : "470,220;535,220" |
| | | } ] |
| | | }, { |
| | | "nodeType" : 4, |
| | | "nodeCode" : "3e743f4f-51ca-41d4-8e94-21f5dd9b59c9", |
| | | "nodeRatio" : 0.000, |
| | | "coordinate" : "560,220", |
| | | "skipAnyNode" : "N", |
| | | "formCustom" : "N", |
| | | "skipList" : [ { |
| | | "nowNodeCode" : "3e743f4f-51ca-41d4-8e94-21f5dd9b59c9", |
| | | "nextNodeCode" : "c80f273e-1f17-4bd8-9ad1-04a4a94ea862", |
| | | "skipType" : "PASS", |
| | | "coordinate" : "560,245;560,320;650,320" |
| | | }, { |
| | | "nowNodeCode" : "3e743f4f-51ca-41d4-8e94-21f5dd9b59c9", |
| | | "nextNodeCode" : "1e3e8d3b-18ae-4d6c-a814-ce0d724adfa4", |
| | | "skipType" : "PASS", |
| | | "coordinate" : "560,195;560,120;650,120" |
| | | } ] |
| | | }, { |
| | | "nodeType" : 1, |
| | | "nodeCode" : "c80f273e-1f17-4bd8-9ad1-04a4a94ea862", |
| | | "nodeName" : "ä¼ç¾", |
| | | "permissionFlag" : "role:1,role:3", |
| | | "nodeRatio" : 100.000, |
| | | "coordinate" : "700,320|700,320", |
| | | "skipAnyNode" : "N", |
| | | "formCustom" : "N", |
| | | "skipList" : [ { |
| | | "nowNodeCode" : "c80f273e-1f17-4bd8-9ad1-04a4a94ea862", |
| | | "nextNodeCode" : "1a20169e-3d82-4926-a151-e2daad28de1b", |
| | | "skipType" : "PASS", |
| | | "coordinate" : "750,320;860,320;860,245" |
| | | } ] |
| | | }, { |
| | | "nodeType" : 4, |
| | | "nodeCode" : "1a20169e-3d82-4926-a151-e2daad28de1b", |
| | | "nodeRatio" : 0.000, |
| | | "coordinate" : "860,220", |
| | | "skipAnyNode" : "N", |
| | | "formCustom" : "N", |
| | | "skipList" : [ { |
| | | "nowNodeCode" : "1a20169e-3d82-4926-a151-e2daad28de1b", |
| | | "nextNodeCode" : "7a8f0473-e409-442e-a843-5c2b813d00e9", |
| | | "skipType" : "PASS", |
| | | "coordinate" : "885,220;950,220" |
| | | } ] |
| | | }, { |
| | | "nodeType" : 1, |
| | | "nodeCode" : "7a8f0473-e409-442e-a843-5c2b813d00e9", |
| | | "nodeName" : "CEO", |
| | | "permissionFlag" : "1", |
| | | "nodeRatio" : 0.000, |
| | | "coordinate" : "1000,220|1000,220", |
| | | "skipAnyNode" : "N", |
| | | "formCustom" : "N", |
| | | "skipList" : [ { |
| | | "nowNodeCode" : "7a8f0473-e409-442e-a843-5c2b813d00e9", |
| | | "nextNodeCode" : "03c4d2bc-58b5-4408-a2e4-65afb046f169", |
| | | "skipType" : "PASS", |
| | | "coordinate" : "1050,220;1120,220" |
| | | } ] |
| | | }, { |
| | | "nodeType" : 2, |
| | | "nodeCode" : "03c4d2bc-58b5-4408-a2e4-65afb046f169", |
| | | "nodeName" : "ç»æ", |
| | | "nodeRatio" : 0.000, |
| | | "coordinate" : "1140,220|1140,220", |
| | | "skipAnyNode" : "N", |
| | | "formCustom" : "N" |
| | | }, { |
| | | "nodeType" : 1, |
| | | "nodeCode" : "1e3e8d3b-18ae-4d6c-a814-ce0d724adfa4", |
| | | "nodeName" : "ç¾åä¹60票ç¾", |
| | | "permissionFlag" : "${userList}", |
| | | "nodeRatio" : 60.000, |
| | | "coordinate" : "700,120|700,120", |
| | | "skipAnyNode" : "N", |
| | | "formCustom" : "N", |
| | | "skipList" : [ { |
| | | "nowNodeCode" : "1e3e8d3b-18ae-4d6c-a814-ce0d724adfa4", |
| | | "nextNodeCode" : "1a20169e-3d82-4926-a151-e2daad28de1b", |
| | | "skipType" : "PASS", |
| | | "coordinate" : "750,120;860,120;860,195" |
| | | } ] |
| | | } ] |
| | | } |
ÎļþÃû´Ó script/sql/oracle/snail_job_oracle.sql ÐÞ¸Ä |
| | |
| | | SnailJob Database Transfer Tool |
| | | Source Server Type : MySQL |
| | | Target Server Type : Oracle |
| | | Date: 2024-07-06 12:49:36 |
| | | Date: 2024-12-27 22:22:15 |
| | | */ |
| | | |
| | | |
| | |
| | | COMMENT ON TABLE sj_group_config IS 'ç»é
ç½®'; |
| | | |
| | | INSERT INTO sj_group_config (namespace_id, group_name, description, token, group_status, version, group_partition, id_generator_mode, init_scene, bucket_index, create_dt, update_dt) VALUES ('dev', 'ruoyi_group', '', 'SJ_cKqBTPzCsWA3VyuCfFoccmuIEGXjr5KT', 1, 1, 0, 1, 1, 4, sysdate, sysdate); |
| | | INSERT INTO sj_group_config (namespace_id, group_name, description, token, group_status, version, group_partition, id_generator_mode, init_scene, bucket_index, create_dt, update_dt) VALUES ('prod', 'ruoyi_group', '', 'SJ_cKqBTPzCsWA3VyuCfFoccmuIEGXjr5KT', 1, 1, 0, 1, 1, 4, sysdate, sysdate); |
| | | |
| | | -- sj_notify_config |
| | | CREATE TABLE sj_notify_config |
| | |
| | | id number GENERATED ALWAYS AS IDENTITY, |
| | | namespace_id varchar2(64) DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' NULL, |
| | | group_name varchar2(64) NULL, |
| | | business_id varchar2(64) NULL, |
| | | notify_name varchar2(64) DEFAULT '' NULL, |
| | | system_task_type smallint DEFAULT 3 NOT NULL, |
| | | notify_status smallint DEFAULT 0 NOT NULL, |
| | | recipient_ids varchar2(128) NULL, |
| | |
| | | ALTER TABLE sj_notify_config |
| | | ADD CONSTRAINT pk_sj_notify_config PRIMARY KEY (id); |
| | | |
| | | CREATE INDEX idx_sj_notify_config_01 ON sj_notify_config (namespace_id, group_name, business_id); |
| | | CREATE INDEX idx_sj_notify_config_01 ON sj_notify_config (namespace_id, group_name); |
| | | |
| | | COMMENT ON COLUMN sj_notify_config.id IS '主é®'; |
| | | COMMENT ON COLUMN sj_notify_config.namespace_id IS 'å½å空é´id'; |
| | | COMMENT ON COLUMN sj_notify_config.group_name IS 'ç»åç§°'; |
| | | COMMENT ON COLUMN sj_notify_config.business_id IS 'ä¸å¡id ( job_idæworkflow_idæscene_name ) '; |
| | | COMMENT ON COLUMN sj_notify_config.notify_name IS 'éç¥åç§°'; |
| | | COMMENT ON COLUMN sj_notify_config.system_task_type IS 'ä»»å¡ç±»å 1. éè¯ä»»å¡ 2. éè¯åè° 3ãJOBä»»å¡ 4ãWORKFLOWä»»å¡'; |
| | | COMMENT ON COLUMN sj_notify_config.notify_status IS 'éç¥ç¶æ 0ãæªå¯ç¨ 1ãå¯ç¨'; |
| | | COMMENT ON COLUMN sj_notify_config.recipient_ids IS 'æ¥æ¶äººidå表'; |
| | |
| | | max_retry_count number DEFAULT 5 NOT NULL, |
| | | back_off smallint DEFAULT 1 NOT NULL, |
| | | trigger_interval varchar2(16) DEFAULT '' NULL, |
| | | notify_ids varchar2(128) DEFAULT '' NULL, |
| | | deadline_request number DEFAULT 60000 NOT NULL, |
| | | executor_timeout number DEFAULT 5 NOT NULL, |
| | | route_key smallint DEFAULT 4 NOT NULL, |
| | |
| | | COMMENT ON COLUMN sj_retry_scene_config.max_retry_count IS 'æå¤§éè¯æ¬¡æ°'; |
| | | COMMENT ON COLUMN sj_retry_scene_config.back_off IS '1ãé»è®¤ç级 2ãåºå®é´éæ¶é´ 3ãCRON 表达å¼'; |
| | | COMMENT ON COLUMN sj_retry_scene_config.trigger_interval IS 'é´éæ¶é¿'; |
| | | COMMENT ON COLUMN sj_retry_scene_config.notify_ids IS 'éç¥åè¦åºæ¯é
ç½®idå表'; |
| | | COMMENT ON COLUMN sj_retry_scene_config.deadline_request IS 'Deadline Request è°ç¨é¾è¶
æ¶ å使¯«ç§'; |
| | | COMMENT ON COLUMN sj_retry_scene_config.executor_timeout IS '任塿§è¡è¶
æ¶æ¶é´ï¼åä½ç§'; |
| | | COMMENT ON COLUMN sj_retry_scene_config.route_key IS 'è·¯ç±çç¥'; |
| | |
| | | retry_interval number DEFAULT 0 NOT NULL, |
| | | bucket_index number DEFAULT 0 NOT NULL, |
| | | resident smallint DEFAULT 0 NOT NULL, |
| | | notify_ids varchar2(128) DEFAULT '' NULL, |
| | | owner_id number NULL, |
| | | description varchar2(256) DEFAULT '' NULL, |
| | | ext_attrs varchar2(256) DEFAULT '' NULL, |
| | | deleted smallint DEFAULT 0 NOT NULL, |
| | |
| | | COMMENT ON COLUMN sj_job.retry_interval IS 'éè¯é´é ( s ) '; |
| | | COMMENT ON COLUMN sj_job.bucket_index IS 'bucket'; |
| | | COMMENT ON COLUMN sj_job.resident IS 'æ¯å¦æ¯å¸¸é©»ä»»å¡'; |
| | | COMMENT ON COLUMN sj_job.notify_ids IS 'éç¥åè¦åºæ¯é
ç½®idå表'; |
| | | COMMENT ON COLUMN sj_job.owner_id IS 'è´è´£äººid'; |
| | | COMMENT ON COLUMN sj_job.description IS 'æè¿°'; |
| | | COMMENT ON COLUMN sj_job.ext_attrs IS 'æ©å±å段'; |
| | | COMMENT ON COLUMN sj_job.deleted IS 'é»è¾å é¤ 1ãå é¤'; |
| | |
| | | COMMENT ON COLUMN sj_job.update_dt IS 'ä¿®æ¹æ¶é´'; |
| | | COMMENT ON TABLE sj_job IS 'ä»»å¡ä¿¡æ¯'; |
| | | |
| | | INSERT INTO sj_job(namespace_id, group_name, job_name, args_str, args_type, next_trigger_at, job_status, task_type, route_key, executor_type, executor_info, trigger_type, trigger_interval, block_strategy,executor_timeout, max_retry_times, parallel_num, retry_interval, bucket_index, resident, description, ext_attrs, deleted, create_dt, update_dt) VALUES ('dev', 'ruoyi_group', 'demo-job', NULL, 1, 1710344035622, 1, 1, 4, 1, 'testJobExecutor', 2, '60', 1, 60, 3, 1, 1, 116, 0, '', '', 0, sysdate, sysdate); |
| | | INSERT INTO sj_job(namespace_id, group_name, job_name, args_str, args_type, next_trigger_at, job_status, task_type, route_key, executor_type, executor_info, trigger_type, trigger_interval, block_strategy,executor_timeout, max_retry_times, parallel_num, retry_interval, bucket_index, resident, notify_ids, owner_id, description, ext_attrs, deleted, create_dt, update_dt) VALUES ('dev', 'ruoyi_group', 'demo-job', NULL, 1, 1710344035622, 1, 1, 4, 1, 'testJobExecutor', 2, '60', 1, 60, 3, 1, 1, 116, 0, '', 1,'', '', 0, sysdate, sysdate); |
| | | |
| | | -- sj_job_log_message |
| | | CREATE TABLE sj_job_log_message |
| | |
| | | description varchar2(256) DEFAULT '' NULL, |
| | | flow_info clob DEFAULT NULL NULL, |
| | | wf_context clob DEFAULT NULL NULL, |
| | | notify_ids varchar2(128) DEFAULT '' NULL, |
| | | bucket_index number DEFAULT 0 NOT NULL, |
| | | version number NOT NULL, |
| | | ext_attrs varchar2(256) DEFAULT '' NULL, |
| | |
| | | COMMENT ON COLUMN sj_workflow.description IS 'æè¿°'; |
| | | COMMENT ON COLUMN sj_workflow.flow_info IS 'æµç¨ä¿¡æ¯'; |
| | | COMMENT ON COLUMN sj_workflow.wf_context IS 'ä¸ä¸æ'; |
| | | COMMENT ON COLUMN sj_workflow.notify_ids IS 'éç¥åè¦åºæ¯é
ç½®idå表'; |
| | | COMMENT ON COLUMN sj_workflow.bucket_index IS 'bucket'; |
| | | COMMENT ON COLUMN sj_workflow.version IS 'çæ¬å·'; |
| | | COMMENT ON COLUMN sj_workflow.ext_attrs IS 'æ©å±å段'; |
| | |
| | | ( |
| | | id number(20) not null, |
| | | user_id number(20) not null, |
| | | tenant_id varchar2(20) default null, |
| | | tenant_id varchar2(20) default '000000', |
| | | auth_id varchar2(255) not null, |
| | | source varchar2(255) not null, |
| | | open_id varchar2(255) default null, |
| | |
| | | comment on column sys_social.create_time is 'å建æ¶é´'; |
| | | comment on column sys_social.update_by is 'æ´æ°è
'; |
| | | comment on column sys_social.update_time is 'æ´æ°æ¶é´'; |
| | | comment on column sys_social.del_flag is 'å 餿 å¿ï¼0代表åå¨ 2代表å é¤ï¼'; |
| | | comment on column sys_social.del_flag is 'å 餿 å¿ï¼0代表åå¨ 1代表å é¤ï¼'; |
| | | |
| | | -- ---------------------------- |
| | | -- ç§æ·è¡¨ |
| | |
| | | comment on column sys_tenant.expire_time is 'è¿ææ¶é´'; |
| | | comment on column sys_tenant.account_count is 'ç¨æ·æ°éï¼-1ä¸éå¶ï¼'; |
| | | comment on column sys_tenant.status is 'ç§æ·ç¶æï¼0æ£å¸¸ 1åç¨ï¼'; |
| | | comment on column sys_tenant.del_flag is 'å 餿 å¿ï¼0代表åå¨ 2代表å é¤ï¼'; |
| | | comment on column sys_tenant.del_flag is 'å 餿 å¿ï¼0代表åå¨ 1代表å é¤ï¼'; |
| | | comment on column sys_tenant.create_dept is 'å建é¨é¨'; |
| | | comment on column sys_tenant.create_by is 'å建è
'; |
| | | comment on column sys_tenant.create_time is 'å建æ¶é´'; |
| | |
| | | comment on column sys_tenant_package.menu_ids is 'å
³èèåid'; |
| | | comment on column sys_tenant_package.remark is '夿³¨'; |
| | | comment on column sys_tenant_package.status is 'ç¶æï¼0æ£å¸¸ 1åç¨ï¼'; |
| | | comment on column sys_tenant_package.del_flag is 'å 餿 å¿ï¼0代表åå¨ 2代表å é¤ï¼'; |
| | | comment on column sys_tenant_package.del_flag is 'å 餿 å¿ï¼0代表åå¨ 1代表å é¤ï¼'; |
| | | comment on column sys_tenant_package.create_dept is 'å建é¨é¨'; |
| | | comment on column sys_tenant_package.create_by is 'å建è
'; |
| | | comment on column sys_tenant_package.create_time is 'å建æ¶é´'; |
| | |
| | | comment on column sys_dept.phone is 'èç³»çµè¯'; |
| | | comment on column sys_dept.email is 'é®ç®±'; |
| | | comment on column sys_dept.status is 'é¨é¨ç¶æï¼0æ£å¸¸ 1åç¨ï¼'; |
| | | comment on column sys_dept.del_flag is 'å 餿 å¿ï¼0代表åå¨ 2代表å é¤ï¼'; |
| | | comment on column sys_dept.del_flag is 'å 餿 å¿ï¼0代表åå¨ 1代表å é¤ï¼'; |
| | | comment on column sys_dept.create_dept is 'å建é¨é¨'; |
| | | comment on column sys_dept.create_by is 'å建è
'; |
| | | comment on column sys_dept.create_time is 'å建æ¶é´'; |
| | |
| | | comment on column sys_user.avatar is '头åè·¯å¾'; |
| | | comment on column sys_user.password is 'å¯ç '; |
| | | comment on column sys_user.status is 'å¸å·ç¶æï¼0æ£å¸¸ 1åç¨ï¼'; |
| | | comment on column sys_user.del_flag is 'å 餿 å¿ï¼0代表åå¨ 2代表å é¤ï¼'; |
| | | comment on column sys_user.del_flag is 'å 餿 å¿ï¼0代表åå¨ 1代表å é¤ï¼'; |
| | | comment on column sys_user.login_ip is 'æåç»å½IP'; |
| | | comment on column sys_user.login_date is 'æåç»å½æ¶é´'; |
| | | comment on column sys_user.create_dept is 'å建é¨é¨'; |
| | |
| | | comment on column sys_role.menu_check_strictly is 'èåæ éæ©é¡¹æ¯å¦å
³èæ¾ç¤º'; |
| | | comment on column sys_role.dept_check_strictly is 'é¨é¨æ 鿩项æ¯å¦å
³èæ¾ç¤º'; |
| | | comment on column sys_role.status is 'è§è²ç¶æï¼0æ£å¸¸ 1åç¨ï¼'; |
| | | comment on column sys_role.del_flag is 'å 餿 å¿ï¼0代表åå¨ 2代表å é¤ï¼'; |
| | | comment on column sys_role.del_flag is 'å 餿 å¿ï¼0代表åå¨ 1代表å é¤ï¼'; |
| | | comment on column sys_role.create_dept is 'å建é¨é¨'; |
| | | comment on column sys_role.create_by is 'å建è
'; |
| | | comment on column sys_role.create_time is 'å建æ¶é´'; |
| | |
| | | insert into sys_role_menu values ('3', '106'); |
| | | insert into sys_role_menu values ('3', '107'); |
| | | insert into sys_role_menu values ('3', '108'); |
| | | insert into sys_role_menu values ('3', '118'); |
| | | insert into sys_role_menu values ('3', '123'); |
| | | insert into sys_role_menu values ('3', '500'); |
| | | insert into sys_role_menu values ('3', '501'); |
| | | insert into sys_role_menu values ('3', '1001'); |
| | |
| | | insert into sys_role_menu values ('3', '1043'); |
| | | insert into sys_role_menu values ('3', '1044'); |
| | | insert into sys_role_menu values ('3', '1045'); |
| | | insert into sys_role_menu values ('3', '1050'); |
| | | insert into sys_role_menu values ('3', '1061'); |
| | | insert into sys_role_menu values ('3', '1062'); |
| | | insert into sys_role_menu values ('3', '1063'); |
| | | insert into sys_role_menu values ('3', '1064'); |
| | | insert into sys_role_menu values ('3', '1065'); |
| | | insert into sys_role_menu values ('3', '1500'); |
| | | insert into sys_role_menu values ('3', '1501'); |
| | | insert into sys_role_menu values ('3', '1502'); |
| | |
| | | insert into sys_role_menu values ('3', '1509'); |
| | | insert into sys_role_menu values ('3', '1510'); |
| | | insert into sys_role_menu values ('3', '1511'); |
| | | insert into sys_role_menu values ('3', '1600'); |
| | | insert into sys_role_menu values ('3', '1601'); |
| | | insert into sys_role_menu values ('3', '1602'); |
| | | insert into sys_role_menu values ('3', '1603'); |
| | | insert into sys_role_menu values ('3', '1620'); |
| | | insert into sys_role_menu values ('3', '1621'); |
| | | insert into sys_role_menu values ('3', '1622'); |
| | | insert into sys_role_menu values ('3', '1623'); |
| | | insert into sys_role_menu values ('3', '11618'); |
| | | insert into sys_role_menu values ('3', '11619'); |
| | | insert into sys_role_menu values ('3', '11629'); |
| | | insert into sys_role_menu values ('3', '11632'); |
| | | insert into sys_role_menu values ('3', '11633'); |
| | | insert into sys_role_menu values ('3', '11638'); |
| | | insert into sys_role_menu values ('3', '11639'); |
| | | insert into sys_role_menu values ('3', '11640'); |
| | | insert into sys_role_menu values ('3', '11641'); |
| | | insert into sys_role_menu values ('3', '11642'); |
| | | insert into sys_role_menu values ('3', '11643'); |
| | | insert into sys_role_menu values ('4', '5'); |
| | | insert into sys_role_menu values ('4', '1500'); |
| | | insert into sys_role_menu values ('4', '1501'); |
| | |
| | | oper_url varchar2(255) default '', |
| | | oper_ip varchar2(128) default '', |
| | | oper_location varchar2(255) default '', |
| | | oper_param varchar2(2100) default '', |
| | | json_result varchar2(2100) default '', |
| | | oper_param varchar2(4000) default '', |
| | | json_result varchar2(4000) default '', |
| | | status number(1) default 0, |
| | | error_msg varchar2(2100) default '', |
| | | error_msg varchar2(4000) default '', |
| | | oper_time date, |
| | | cost_time number(20) default 0 |
| | | ); |
| | |
| | | comment on column sys_client.active_timeout is 'tokenæ´»è·è¶
æ¶æ¶é´'; |
| | | comment on column sys_client.timeout is 'tokenåºå®è¶
æ¶'; |
| | | comment on column sys_client.status is 'ç¶æï¼0æ£å¸¸ 1åç¨ï¼'; |
| | | comment on column sys_client.del_flag is 'å 餿 å¿ï¼0代表åå¨ 2代表å é¤ï¼'; |
| | | comment on column sys_client.del_flag is 'å 餿 å¿ï¼0代表åå¨ 1代表å é¤ï¼'; |
| | | comment on column sys_client.create_dept is 'å建é¨é¨'; |
| | | comment on column sys_client.create_by is 'å建è
'; |
| | | comment on column sys_client.create_time is 'å建æ¶é´'; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | create table FLOW_DEFINITION |
| | | ( |
| | | ID NUMBER(20) not null, |
| | | FLOW_CODE VARCHAR2(40) not null, |
| | | FLOW_NAME VARCHAR2(100) not null, |
| | | CATEGORY VARCHAR2(100), |
| | | VERSION VARCHAR2(20) not null, |
| | | IS_PUBLISH NUMBER(1) default 0 not null, |
| | | FORM_CUSTOM VARCHAR2(1) default 'N', |
| | | FORM_PATH VARCHAR2(100), |
| | | ACTIVITY_STATUS NUMBER(1) default 1, |
| | | LISTENER_TYPE VARCHAR2(100), |
| | | LISTENER_PATH VARCHAR2(500), |
| | | EXT VARCHAR2(500), |
| | | CREATE_TIME DATE, |
| | | UPDATE_TIME DATE, |
| | | DEL_FLAG VARCHAR2(1) default '0', |
| | | TENANT_ID VARCHAR2(40) |
| | | ); |
| | | |
| | | alter table FLOW_DEFINITION add constraint PK_FLOW_DEFINITION primary key (ID); |
| | | |
| | | comment on table FLOW_DEFINITION is 'æµç¨å®ä¹è¡¨'; |
| | | comment on column FLOW_DEFINITION.ID is '主é®id'; |
| | | comment on column FLOW_DEFINITION.FLOW_CODE is 'æµç¨ç¼ç '; |
| | | comment on column FLOW_DEFINITION.FLOW_NAME is 'æµç¨åç§°'; |
| | | comment on column FLOW_DEFINITION.CATEGORY is 'æµç¨ç±»å«'; |
| | | comment on column FLOW_DEFINITION.VERSION is 'æµç¨çæ¬'; |
| | | comment on column FLOW_DEFINITION.IS_PUBLISH is 'æ¯å¦åå¸ (0æªåå¸ 1å·²åå¸ 9失æ)'; |
| | | comment on column FLOW_DEFINITION.FORM_CUSTOM is '审æ¹è¡¨åæ¯å¦èªå®ä¹ (Yæ¯ Nå¦)'; |
| | | comment on column FLOW_DEFINITION.FORM_PATH is '审æ¹è¡¨åè·¯å¾'; |
| | | comment on column FLOW_DEFINITION.ACTIVITY_STATUS is 'æµç¨æ¿æ´»ç¶æï¼0æèµ· 1æ¿æ´»ï¼'; |
| | | comment on column FLOW_DEFINITION.LISTENER_TYPE is 'çå¬å¨ç±»å'; |
| | | comment on column FLOW_DEFINITION.LISTENER_PATH is 'çå¬å¨è·¯å¾'; |
| | | comment on column FLOW_DEFINITION.EXT is 'æ©å±å段ï¼é¢çç»ä¸å¡ç³»ç»ä½¿ç¨'; |
| | | comment on column FLOW_DEFINITION.CREATE_TIME is 'å建æ¶é´'; |
| | | comment on column FLOW_DEFINITION.UPDATE_TIME is 'æ´æ°æ¶é´'; |
| | | comment on column FLOW_DEFINITION.DEL_FLAG is 'å 餿 å¿'; |
| | | comment on column FLOW_DEFINITION.TENANT_ID is 'ç§æ·id'; |
| | | |
| | | create table FLOW_NODE |
| | | ( |
| | | ID NUMBER(20) not null, |
| | | NODE_TYPE NUMBER(1) not null, |
| | | DEFINITION_ID NUMBER(20) not null, |
| | | NODE_CODE VARCHAR2(100) not null, |
| | | NODE_NAME VARCHAR2(100), |
| | | NODE_RATIO NUMBER(6, 3), |
| | | COORDINATE VARCHAR2(100), |
| | | SKIP_ANY_NODE VARCHAR2(100) default 'N', |
| | | ANY_NODE_SKIP VARCHAR2(100), |
| | | LISTENER_TYPE VARCHAR2(100), |
| | | LISTENER_PATH VARCHAR2(500), |
| | | HANDLER_TYPE VARCHAR2(100), |
| | | HANDLER_PATH VARCHAR2(400), |
| | | FORM_CUSTOM VARCHAR2(1) default 'N', |
| | | FORM_PATH VARCHAR2(100), |
| | | VERSION VARCHAR2(20), |
| | | CREATE_TIME DATE, |
| | | UPDATE_TIME DATE, |
| | | DEL_FLAG VARCHAR2(1) default '0', |
| | | TENANT_ID VARCHAR2(40), |
| | | PERMISSION_FLAG VARCHAR2(200) |
| | | ); |
| | | |
| | | alter table FLOW_NODE add constraint PK_FLOW_NODE primary key (ID); |
| | | |
| | | comment on table FLOW_NODE is 'æµç¨èç¹è¡¨'; |
| | | comment on column FLOW_NODE.ID is '主é®id'; |
| | | comment on column FLOW_NODE.NODE_TYPE is 'èç¹ç±»åï¼0å¼å§èç¹ 1ä¸é´èç¹ 2ç»æèç¹ 3äºæ¥ç½å
³ 4å¹¶è¡ç½å
³ï¼'; |
| | | comment on column FLOW_NODE.DEFINITION_ID is '对åºflow_definition表çid'; |
| | | comment on column FLOW_NODE.NODE_CODE is 'æµç¨èç¹ç¼ç '; |
| | | comment on column FLOW_NODE.NODE_NAME is 'æµç¨èç¹åç§°'; |
| | | comment on column FLOW_NODE.NODE_RATIO is 'æµç¨ç¾ç½²æ¯ä¾å¼'; |
| | | comment on column FLOW_NODE.COORDINATE is 'åæ '; |
| | | comment on column FLOW_NODE.SKIP_ANY_NODE is 'æ¯å¦å¯ä»¥éåä»»æèç¹ï¼Yæ¯ Nå¦ï¼å³å°å é¤'; |
| | | comment on column FLOW_NODE.ANY_NODE_SKIP is 'ä»»æç»ç¹è·³è½¬'; |
| | | comment on column FLOW_NODE.LISTENER_TYPE is 'çå¬å¨ç±»å'; |
| | | comment on column FLOW_NODE.LISTENER_PATH is 'çå¬å¨è·¯å¾'; |
| | | comment on column FLOW_NODE.HANDLER_TYPE is 'å¤çå¨ç±»å'; |
| | | comment on column FLOW_NODE.HANDLER_PATH is 'å¤çå¨è·¯å¾'; |
| | | comment on column FLOW_NODE.FORM_CUSTOM is '审æ¹è¡¨åæ¯å¦èªå®ä¹ (Yæ¯ Nå¦)'; |
| | | comment on column FLOW_NODE.FORM_PATH is '审æ¹è¡¨åè·¯å¾'; |
| | | comment on column FLOW_NODE.VERSION is 'çæ¬'; |
| | | comment on column FLOW_NODE.CREATE_TIME is 'å建æ¶é´'; |
| | | comment on column FLOW_NODE.UPDATE_TIME is 'æ´æ°æ¶é´'; |
| | | comment on column FLOW_NODE.DEL_FLAG is 'å 餿 å¿'; |
| | | comment on column FLOW_NODE.TENANT_ID is 'ç§æ·id'; |
| | | comment on column FLOW_NODE.PERMISSION_FLAG is 'æéæ è¯ï¼æéç±»å:æéæ è¯ï¼å¯ä»¥å¤ä¸ªï¼ç¨éå·éå¼)'; |
| | | |
| | | create table FLOW_SKIP |
| | | ( |
| | | ID NUMBER(20) not null, |
| | | DEFINITION_ID NUMBER(20) not null, |
| | | NOW_NODE_CODE VARCHAR2(100) not null, |
| | | NOW_NODE_TYPE NUMBER(1), |
| | | NEXT_NODE_CODE VARCHAR2(100) not null, |
| | | NEXT_NODE_TYPE NUMBER(1), |
| | | SKIP_NAME VARCHAR2(100), |
| | | SKIP_TYPE VARCHAR2(40), |
| | | SKIP_CONDITION VARCHAR2(200), |
| | | COORDINATE VARCHAR2(100), |
| | | CREATE_TIME DATE, |
| | | UPDATE_TIME DATE, |
| | | DEL_FLAG VARCHAR2(1) default '0', |
| | | TENANT_ID VARCHAR2(40) |
| | | ); |
| | | |
| | | alter table FLOW_SKIP add constraint PK_FLOW_SKIP primary key (ID); |
| | | |
| | | comment on table FLOW_SKIP is 'èç¹è·³è½¬å
³è表'; |
| | | comment on column FLOW_SKIP.ID is '主é®id'; |
| | | comment on column FLOW_SKIP.DEFINITION_ID is 'æµç¨å®ä¹id'; |
| | | comment on column FLOW_SKIP.NOW_NODE_CODE is 'å½åæµç¨èç¹ç±»å (0å¼å§èç¹ 1ä¸é´èç¹ 2ç»æèç¹ 3äºæ¥ç½å
³ 4å¹¶è¡ç½å
³)'; |
| | | comment on column FLOW_SKIP.NOW_NODE_TYPE is 'ä¸ä¸ä¸ªæµç¨èç¹ç±»å (0å¼å§èç¹ 1ä¸é´èç¹ 2ç»æèç¹ 3äºæ¥ç½å
³ 4å¹¶è¡ç½å
³)'; |
| | | comment on column FLOW_SKIP.NEXT_NODE_CODE is 'ä¸ä¸ä¸ªæµç¨èç¹ç¼ç '; |
| | | comment on column FLOW_SKIP.NEXT_NODE_TYPE is 'ä¸ä¸ä¸ªæµç¨èç¹ç±»å (0å¼å§èç¹ 1ä¸é´èç¹ 2ç»æèç¹ 3äºæ¥ç½å
³ 4å¹¶è¡ç½å
³)'; |
| | | comment on column FLOW_SKIP.SKIP_NAME is '跳转åç§°'; |
| | | comment on column FLOW_SKIP.SKIP_TYPE is '跳转类å (PASS审æ¹éè¿ REJECTéå)'; |
| | | comment on column FLOW_SKIP.SKIP_CONDITION is '跳转æ¡ä»¶'; |
| | | comment on column FLOW_SKIP.COORDINATE is 'åæ '; |
| | | comment on column FLOW_SKIP.CREATE_TIME is 'å建æ¶é´'; |
| | | comment on column FLOW_SKIP.UPDATE_TIME is 'æ´æ°æ¶é´'; |
| | | comment on column FLOW_SKIP.DEL_FLAG is 'å 餿 å¿'; |
| | | comment on column FLOW_SKIP.TENANT_ID is 'ç§æ·id'; |
| | | |
| | | create table FLOW_INSTANCE |
| | | ( |
| | | ID NUMBER not null, |
| | | DEFINITION_ID NUMBER not null, |
| | | BUSINESS_ID VARCHAR2(40) not null, |
| | | NODE_TYPE NUMBER(1), |
| | | NODE_CODE VARCHAR2(100), |
| | | NODE_NAME VARCHAR2(100), |
| | | VARIABLE CLOB, |
| | | FLOW_STATUS VARCHAR2(20), |
| | | ACTIVITY_STATUS NUMBER(1) default 1, |
| | | DEF_JSON CLOB, |
| | | CREATE_BY VARCHAR2(64) default '', |
| | | CREATE_TIME DATE, |
| | | UPDATE_TIME DATE, |
| | | EXT VARCHAR2(500), |
| | | DEL_FLAG VARCHAR2(1) default '0', |
| | | TENANT_ID VARCHAR2(40) |
| | | ); |
| | | |
| | | alter table FLOW_INSTANCE add constraint PK_FLOW_INSTANCE primary key (ID); |
| | | |
| | | comment on table FLOW_INSTANCE is 'æµç¨å®ä¾è¡¨'; |
| | | comment on column FLOW_INSTANCE.ID is '主é®id'; |
| | | comment on column FLOW_INSTANCE.DEFINITION_ID is '对åºflow_definition表çid'; |
| | | comment on column FLOW_INSTANCE.BUSINESS_ID is 'ä¸å¡id'; |
| | | comment on column FLOW_INSTANCE.NODE_TYPE is 'å¼å§èç¹ç±»å (0å¼å§èç¹ 1ä¸é´èç¹ 2ç»æèç¹ 3äºæ¥ç½å
³ 4å¹¶è¡ç½å
³)'; |
| | | comment on column FLOW_INSTANCE.NODE_CODE is 'å¼å§èç¹ç¼ç '; |
| | | comment on column FLOW_INSTANCE.NODE_NAME is 'å¼å§èç¹åç§°'; |
| | | comment on column FLOW_INSTANCE.VARIABLE is 'ä»»å¡åé'; |
| | | comment on column FLOW_INSTANCE.FLOW_STATUS is 'æµç¨ç¶æï¼0å¾
æäº¤ 1审æ¹ä¸ 2 审æ¹éè¿ 3èªå¨éè¿ 4ç»æ¢ 5ä½åº 6æ¤é 7åå 8已宿 9å·²éå 10失æï¼'; |
| | | comment on column FLOW_INSTANCE.ACTIVITY_STATUS is 'æµç¨æ¿æ´»ç¶æï¼0æèµ· 1æ¿æ´»ï¼'; |
| | | comment on column FLOW_INSTANCE.DEF_JSON is 'æµç¨å®ä¹json'; |
| | | comment on column FLOW_INSTANCE.CREATE_BY is 'å建è
'; |
| | | comment on column FLOW_INSTANCE.CREATE_TIME is 'å建æ¶é´'; |
| | | comment on column FLOW_INSTANCE.UPDATE_TIME is 'æ´æ°æ¶é´'; |
| | | comment on column FLOW_INSTANCE.EXT is 'æ©å±å段ï¼é¢çç»ä¸å¡ç³»ç»ä½¿ç¨'; |
| | | comment on column FLOW_INSTANCE.DEL_FLAG is 'å 餿 å¿'; |
| | | comment on column FLOW_INSTANCE.TENANT_ID is 'ç§æ·id'; |
| | | |
| | | create table FLOW_TASK |
| | | ( |
| | | ID NUMBER(20) not null, |
| | | DEFINITION_ID NUMBER(20) not null, |
| | | INSTANCE_ID NUMBER(20) not null, |
| | | NODE_CODE VARCHAR2(100), |
| | | NODE_NAME VARCHAR2(100), |
| | | NODE_TYPE NUMBER(1), |
| | | FORM_CUSTOM VARCHAR2(1) default 'N', |
| | | FORM_PATH VARCHAR2(100), |
| | | CREATE_TIME DATE, |
| | | UPDATE_TIME DATE, |
| | | DEL_FLAG VARCHAR2(1) default '0', |
| | | TENANT_ID VARCHAR2(40) |
| | | ); |
| | | |
| | | alter table FLOW_TASK add constraint PK_FLOW_TASK primary key (ID); |
| | | |
| | | comment on table FLOW_TASK is 'å¾
åä»»å¡è¡¨'; |
| | | comment on column FLOW_TASK.ID is '主é®id'; |
| | | comment on column FLOW_TASK.DEFINITION_ID is '对åºflow_definition表çid'; |
| | | comment on column FLOW_TASK.INSTANCE_ID is '对åºflow_instance表çid'; |
| | | comment on column FLOW_TASK.NODE_CODE is 'èç¹ç¼ç '; |
| | | comment on column FLOW_TASK.NODE_NAME is 'èç¹åç§°'; |
| | | comment on column FLOW_TASK.NODE_TYPE is 'èç¹ç±»å (0å¼å§èç¹ 1ä¸é´èç¹ 2ç»æèç¹ 3äºæ¥ç½å
³ 4å¹¶è¡ç½å
³)'; |
| | | comment on column FLOW_TASK.FORM_CUSTOM is '审æ¹è¡¨åæ¯å¦èªå®ä¹ (Yæ¯ Nå¦)'; |
| | | comment on column FLOW_TASK.FORM_PATH is '审æ¹è¡¨åè·¯å¾'; |
| | | comment on column FLOW_TASK.CREATE_TIME is 'å建æ¶é´'; |
| | | comment on column FLOW_TASK.UPDATE_TIME is 'æ´æ°æ¶é´'; |
| | | comment on column FLOW_TASK.DEL_FLAG is 'å 餿 å¿'; |
| | | comment on column FLOW_TASK.TENANT_ID is 'ç§æ·id'; |
| | | |
| | | create table FLOW_HIS_TASK |
| | | ( |
| | | ID NUMBER(20) not null, |
| | | DEFINITION_ID NUMBER(20) not null, |
| | | INSTANCE_ID NUMBER(20) not null, |
| | | TASK_ID NUMBER(20) not null, |
| | | NODE_CODE VARCHAR2(100), |
| | | NODE_NAME VARCHAR2(100), |
| | | NODE_TYPE NUMBER(1), |
| | | TARGET_NODE_CODE VARCHAR2(200), |
| | | TARGET_NODE_NAME VARCHAR2(200), |
| | | APPROVER VARCHAR2(40), |
| | | COOPERATE_TYPE NUMBER(1) default 0, |
| | | COLLABORATOR VARCHAR2(40), |
| | | SKIP_TYPE VARCHAR2(10), |
| | | FLOW_STATUS VARCHAR2(20), |
| | | FORM_CUSTOM VARCHAR2(1) default 'N', |
| | | FORM_PATH VARCHAR2(100), |
| | | MESSAGE VARCHAR2(500), |
| | | VARIABLE CLOB, |
| | | EXT VARCHAR2(500), |
| | | CREATE_TIME DATE, |
| | | UPDATE_TIME DATE, |
| | | DEL_FLAG VARCHAR2(1) default '0', |
| | | TENANT_ID VARCHAR2(40) |
| | | |
| | | ); |
| | | |
| | | alter table FLOW_HIS_TASK add constraint PK_FLOW_HIS_TASK primary key (ID); |
| | | |
| | | comment on table FLOW_HIS_TASK is 'åå²ä»»å¡è®°å½è¡¨'; |
| | | comment on column FLOW_HIS_TASK.ID is '主é®id'; |
| | | comment on column FLOW_HIS_TASK.DEFINITION_ID is '对åºflow_definition表çid'; |
| | | comment on column FLOW_HIS_TASK.INSTANCE_ID is '对åºflow_instance表çid'; |
| | | comment on column FLOW_HIS_TASK.TASK_ID is '对åºflow_task表çid'; |
| | | comment on column FLOW_HIS_TASK.NODE_CODE is 'å¼å§èç¹ç¼ç '; |
| | | comment on column FLOW_HIS_TASK.NODE_NAME is 'å¼å§èç¹åç§°'; |
| | | comment on column FLOW_HIS_TASK.NODE_TYPE is 'å¼å§èç¹ç±»å (0å¼å§èç¹ 1ä¸é´èç¹ 2ç»æèç¹ 3äºæ¥ç½å
³ 4å¹¶è¡ç½å
³)'; |
| | | comment on column FLOW_HIS_TASK.TARGET_NODE_CODE is 'ç®æ èç¹ç¼ç '; |
| | | comment on column FLOW_HIS_TASK.TARGET_NODE_NAME is 'ç®æ èç¹åç§°'; |
| | | comment on column FLOW_HIS_TASK.SKIP_TYPE is 'æµè½¬ç±»åï¼PASSéè¿ REJECTéå NONEæ å¨ä½ï¼'; |
| | | comment on column FLOW_HIS_TASK.FLOW_STATUS is 'æµç¨ç¶æï¼1审æ¹ä¸ 2 审æ¹éè¿ 9å·²éå 10失æï¼'; |
| | | comment on column FLOW_HIS_TASK.FORM_CUSTOM is '审æ¹è¡¨åæ¯å¦èªå®ä¹ (Yæ¯ Nå¦)'; |
| | | comment on column FLOW_HIS_TASK.FORM_PATH is '审æ¹è¡¨åè·¯å¾'; |
| | | comment on column FLOW_HIS_TASK.MESSAGE is 'å®¡æ¹æè§'; |
| | | comment on column FLOW_HIS_TASK.VARIABLE is 'ä»»å¡åé'; |
| | | comment on column FLOW_HIS_TASK.EXT is 'æ©å±å段ï¼é¢çç»ä¸å¡ç³»ç»ä½¿ç¨'; |
| | | comment on column FLOW_HIS_TASK.CREATE_TIME is 'ä»»å¡å¼å§æ¶é´'; |
| | | comment on column FLOW_HIS_TASK.UPDATE_TIME is '审æ¹å®ææ¶é´'; |
| | | comment on column FLOW_HIS_TASK.DEL_FLAG is 'å 餿 å¿'; |
| | | comment on column FLOW_HIS_TASK.TENANT_ID is 'ç§æ·id'; |
| | | comment on column FLOW_HIS_TASK.APPROVER is '审æ¹è
'; |
| | | comment on column FLOW_HIS_TASK.COOPERATE_TYPE is 'å使¹å¼(1å®¡æ¹ 2转å 3å§æ´¾ 4ä¼ç¾ 5ç¥¨ç¾ 6å ç¾ 7åç¾)'; |
| | | comment on column FLOW_HIS_TASK.COLLABORATOR is 'åä½äºº'; |
| | | |
| | | create table FLOW_USER |
| | | ( |
| | | ID NUMBER(20) not null, |
| | | TYPE VARCHAR2(1) not null, |
| | | PROCESSED_BY VARCHAR2(80), |
| | | ASSOCIATED NUMBER(20) not null, |
| | | CREATE_TIME DATE, |
| | | CREATE_BY VARCHAR2(80), |
| | | UPDATE_TIME DATE, |
| | | DEL_FLAG VARCHAR2(1) default '0', |
| | | TENANT_ID VARCHAR2(40) |
| | | ); |
| | | |
| | | alter table FLOW_USER add constraint PK_FLOW_USER primary key (ID); |
| | | |
| | | comment on table FLOW_USER is 'å¾
åä»»å¡è¡¨'; |
| | | comment on column FLOW_USER.ID is '主é®id'; |
| | | comment on column FLOW_USER.TYPE is '人åç±»åï¼1å¾
åä»»å¡ç审æ¹äººæé 2å¾
åä»»å¡ç转å人æé 3å¾
åä»»å¡çå§æäººæéï¼'; |
| | | comment on column FLOW_USER.PROCESSED_BY is 'æé人)'; |
| | | comment on column FLOW_USER.ASSOCIATED is 'ä»»å¡è¡¨id'; |
| | | comment on column FLOW_USER.CREATE_TIME is 'å建æ¶é´'; |
| | | comment on column FLOW_USER.CREATE_BY is 'èç¹åç§°'; |
| | | comment on column FLOW_USER.UPDATE_TIME is 'æ´æ°æ¶é´'; |
| | | comment on column FLOW_USER.DEL_FLAG is 'å 餿 å¿'; |
| | | comment on column FLOW_USER.TENANT_ID is 'ç§æ·id'; |
| | | |
| | | create index USER_PROCESSED_TYPE on FLOW_USER (PROCESSED_BY, TYPE); |
| | | |
| | | -- ---------------------------- |
| | | -- æµç¨å类表 |
| | | -- ---------------------------- |
| | | CREATE TABLE flow_category |
| | | ( |
| | | category_id NUMBER (20) NOT NULL, |
| | | tenant_id VARCHAR2 (20) DEFAULT '000000', |
| | | parent_id NUMBER (20) DEFAULT 0, |
| | | ancestors VARCHAR2 (500) DEFAULT '', |
| | | category_name VARCHAR2 (30) NOT NULL, |
| | | order_num NUMBER (4) DEFAULT 0, |
| | | del_flag CHAR(1) DEFAULT '0', |
| | | create_dept NUMBER (20), |
| | | create_by NUMBER (20), |
| | | create_time DATE, |
| | | update_by NUMBER (20), |
| | | update_time DATE |
| | | ); |
| | | |
| | | alter table flow_category add constraint pk_flow_category primary key (category_id); |
| | | |
| | | COMMENT ON TABLE flow_category IS 'æµç¨åç±»'; |
| | | COMMENT ON COLUMN flow_category.category_id IS 'æµç¨åç±»ID'; |
| | | COMMENT ON COLUMN flow_category.tenant_id IS 'ç§æ·ç¼å·'; |
| | | COMMENT ON COLUMN flow_category.parent_id IS 'ç¶æµç¨åç±»id'; |
| | | COMMENT ON COLUMN flow_category.ancestors IS 'ç¥çº§å表'; |
| | | COMMENT ON COLUMN flow_category.category_name IS 'æµç¨åç±»åç§°'; |
| | | COMMENT ON COLUMN flow_category.order_num IS 'æ¾ç¤ºé¡ºåº'; |
| | | COMMENT ON COLUMN flow_category.del_flag IS 'å 餿 å¿ï¼0代表åå¨ 1代表å é¤ï¼'; |
| | | COMMENT ON COLUMN flow_category.create_dept IS 'å建é¨é¨'; |
| | | COMMENT ON COLUMN flow_category.create_by IS 'å建è
'; |
| | | COMMENT ON COLUMN flow_category.create_time IS 'å建æ¶é´'; |
| | | COMMENT ON COLUMN flow_category.update_by IS 'æ´æ°è
'; |
| | | COMMENT ON COLUMN flow_category.update_time IS 'æ´æ°æ¶é´'; |
| | | |
| | | INSERT INTO flow_category VALUES (100, '000000', 0, '0', 'OA审æ¹', 0, '0', 103, 1, SYSDATE, NULL, NULL); |
| | | INSERT INTO flow_category VALUES (101, '000000', 100, '0,100', 'åå¤ç®¡ç', 0, '0', 103, 1, SYSDATE, NULL, NULL); |
| | | INSERT INTO flow_category VALUES (102, '000000', 100, '0,100', '人äºç®¡ç', 1, '0', 103, 1, SYSDATE, NULL, NULL); |
| | | INSERT INTO flow_category VALUES (103, '000000', 101, '0,100,101', '请å', 0, '0', 103, 1, SYSDATE, NULL, NULL); |
| | | INSERT INTO flow_category VALUES (104, '000000', 101, '0,100,101', 'åºå·®', 1, '0', 103, 1, SYSDATE, NULL, NULL); |
| | | INSERT INTO flow_category VALUES (105, '000000', 101, '0,100,101', 'å ç', 2, '0', 103, 1, SYSDATE, NULL, NULL); |
| | | INSERT INTO flow_category VALUES (106, '000000', 101, '0,100,101', 'æ¢ç', 3, '0', 103, 1, SYSDATE, NULL, NULL); |
| | | INSERT INTO flow_category VALUES (107, '000000', 101, '0,100,101', 'å¤åº', 4, '0', 103, 1, SYSDATE, NULL, NULL); |
| | | INSERT INTO flow_category VALUES (108, '000000', 102, '0,100,102', '转æ£', 1, '0', 103, 1, SYSDATE, NULL, NULL); |
| | | INSERT INTO flow_category VALUES (109, '000000', 102, '0,100,102', '离è', 2, '0', 103, 1, SYSDATE, NULL, NULL); |
| | | |
| | | |
| | | -- ---------------------------- |
| | | -- 请ååä¿¡æ¯ |
| | | -- ---------------------------- |
| | | CREATE TABLE test_leave |
| | | ( |
| | | id NUMBER (20) NOT NULL, |
| | | tenant_id VARCHAR2 (20) DEFAULT '000000', |
| | | leave_type VARCHAR2 (255) NOT NULL, |
| | | start_date DATE NOT NULL, |
| | | end_date DATE NOT NULL, |
| | | leave_days NUMBER (10) NOT NULL, |
| | | remark VARCHAR2 (255), |
| | | status VARCHAR2 (255), |
| | | create_dept NUMBER (20), |
| | | create_by NUMBER (20), |
| | | create_time DATE, |
| | | update_by NUMBER (20), |
| | | update_time DATE |
| | | ); |
| | | |
| | | alter table test_leave add constraint pk_test_leave primary key (id); |
| | | |
| | | COMMENT ON TABLE test_leave IS '请åç³è¯·è¡¨'; |
| | | COMMENT ON COLUMN test_leave.id IS 'ID'; |
| | | COMMENT ON COLUMN test_leave.tenant_id IS 'ç§æ·ç¼å·'; |
| | | COMMENT ON COLUMN test_leave.leave_type IS '请åç±»å'; |
| | | COMMENT ON COLUMN test_leave.start_date IS 'å¼å§æ¶é´'; |
| | | COMMENT ON COLUMN test_leave.end_date IS 'ç»ææ¶é´'; |
| | | COMMENT ON COLUMN test_leave.leave_days IS '请å天æ°'; |
| | | COMMENT ON COLUMN test_leave.remark IS '请ååå '; |
| | | COMMENT ON COLUMN test_leave.status IS 'ç¶æ'; |
| | | COMMENT ON COLUMN test_leave.create_dept IS 'å建é¨é¨'; |
| | | COMMENT ON COLUMN test_leave.create_by IS 'å建è
'; |
| | | COMMENT ON COLUMN test_leave.create_time IS 'å建æ¶é´'; |
| | | COMMENT ON COLUMN test_leave.update_by IS 'æ´æ°è
'; |
| | | COMMENT ON COLUMN test_leave.update_time IS 'æ´æ°æ¶é´'; |
| | | |
| | | INSERT INTO sys_menu VALUES ('11616', '工使µ', '0', '6', 'workflow', '', '', '1', '0', 'M', '0', '0', '', 'workflow', 103, 1, SYSDATE, NULL, NULL, ''); |
| | | INSERT INTO sys_menu VALUES ('11618', 'æçä»»å¡', '0', '7', 'task', '', '', '1', '0', 'M', '0', '0', '', 'my-task', 103, 1, SYSDATE, NULL, NULL, ''); |
| | | INSERT INTO sys_menu VALUES ('11619', 'æçå¾
å', '11618', '2', 'taskWaiting', 'workflow/task/taskWaiting', '', '1', '1', 'C', '0', '0', '', 'waiting', 103, 1, SYSDATE, NULL, NULL, ''); |
| | | INSERT INTO sys_menu VALUES ('11632', 'æçå·²å', '11618', '3', 'taskFinish', 'workflow/task/taskFinish', '', '1', '1', 'C', '0', '0', '', 'finish', 103, 1, SYSDATE, NULL, NULL, ''); |
| | | INSERT INTO sys_menu VALUES ('11633', 'æçæé', '11618', '4', 'taskCopyList', 'workflow/task/taskCopyList', '', '1', '1', 'C', '0', '0', '', 'my-copy', 103, 1, SYSDATE, NULL, NULL, ''); |
| | | INSERT INTO sys_menu VALUES ('11620', 'æµç¨å®ä¹', '11616', '3', 'processDefinition', 'workflow/processDefinition/index', '', '1', '1', 'C', '0', '0', '', 'process-definition', 103, 1, SYSDATE, NULL, NULL, ''); |
| | | INSERT INTO sys_menu VALUES ('11621', 'æµç¨å®ä¾', '11630', '1', 'processInstance', 'workflow/processInstance/index', '', '1', '1', 'C', '0', '0', '', 'tree-table', 103, 1, SYSDATE, NULL, NULL, ''); |
| | | INSERT INTO sys_menu VALUES ('11622', 'æµç¨åç±»', '11616', '1', 'category', 'workflow/category/index', '', '1', '0', 'C', '0', '0', 'workflow:category:list', 'category', 103, 1, SYSDATE, NULL, NULL, ''); |
| | | INSERT INTO sys_menu VALUES ('11629', 'æåèµ·ç', '11618', '1', 'myDocument', 'workflow/task/myDocument', '', '1', '1', 'C', '0', '0', '', 'guide', 103, 1, SYSDATE, NULL, NULL, ''); |
| | | INSERT INTO sys_menu VALUES ('11630', 'æµç¨çæ§', '11616', '4', 'monitor', '', '', '1', '0', 'M', '0', '0', '', 'monitor', 103, 1, SYSDATE, NULL, NULL, ''); |
| | | INSERT INTO sys_menu VALUES ('11631', 'å¾
åä»»å¡', '11630', '2', 'allTaskWaiting', 'workflow/task/allTaskWaiting', '', '1', '1', 'C', '0', '0', '', 'waiting', 103, 1, SYSDATE, NULL, NULL, ''); |
| | | |
| | | INSERT INTO sys_menu VALUES ('11623', 'æµç¨åç±»æ¥è¯¢', '11622', '1', '#', '', '', '1', '0', 'F', '0', '0', 'workflow:category:query', '#', 103, 1, SYSDATE, NULL, NULL, ''); |
| | | INSERT INTO sys_menu VALUES ('11624', 'æµç¨åç±»æ°å¢', '11622', '2', '#', '', '', '1', '0', 'F', '0', '0', 'workflow:category:add', '#', 103, 1, SYSDATE, NULL, NULL, ''); |
| | | INSERT INTO sys_menu VALUES ('11625', 'æµç¨å类修æ¹', '11622', '3', '#', '', '', '1', '0', 'F', '0', '0', 'workflow:category:edit', '#', 103, 1, SYSDATE, NULL, NULL, ''); |
| | | INSERT INTO sys_menu VALUES ('11626', 'æµç¨åç±»å é¤', '11622', '4', '#', '', '', '1', '0', 'F', '0', '0', 'workflow:category:remove', '#', 103, 1, SYSDATE, NULL, NULL, ''); |
| | | INSERT INTO sys_menu VALUES ('11627', 'æµç¨å类导åº', '11622', '5', '#', '', '', '1', '0', 'F', '0', '0', 'workflow:category:export', '#', 103, 1, SYSDATE, NULL, NULL, ''); |
| | | |
| | | INSERT INTO sys_menu VALUES ('11638', '请åç³è¯·', '5', '1', 'leave', 'workflow/leave/index', '', '1', '0', 'C', '0', '0', 'workflow:leave:list', '#', 103, 1, SYSDATE, NULL, NULL, '请åç³è¯·èå'); |
| | | INSERT INTO sys_menu VALUES ('11639', '请åç³è¯·æ¥è¯¢', '11638', '1', '#', '', '', '1', '0', 'F', '0', '0', 'workflow:leave:query', '#', 103, 1, SYSDATE, NULL, NULL, ''); |
| | | INSERT INTO sys_menu VALUES ('11640', '请åç³è¯·æ°å¢', '11638', '2', '#', '', '', '1', '0', 'F', '0', '0', 'workflow:leave:add', '#', 103, 1, SYSDATE, NULL, NULL, ''); |
| | | INSERT INTO sys_menu VALUES ('11641', '请åç³è¯·ä¿®æ¹', '11638', '3', '#', '', '', '1', '0', 'F', '0', '0', 'workflow:leave:edit', '#', 103, 1, SYSDATE, NULL, NULL, ''); |
| | | INSERT INTO sys_menu VALUES ('11642', '请åç³è¯·å é¤', '11638', '4', '#', '', '', '1', '0', 'F', '0', '0', 'workflow:leave:remove', '#', 103, 1, SYSDATE, NULL, NULL, ''); |
| | | INSERT INTO sys_menu VALUES ('11643', '请åç³è¯·å¯¼åº', '11638', '5', '#', '', '', '1', '0', 'F', '0', '0', 'workflow:leave:export', '#', 103, 1, SYSDATE, NULL, NULL, ''); |
| | | |
| | | INSERT INTO sys_dict_type VALUES (13, '000000', 'ä¸å¡ç¶æ', 'wf_business_status', 103, 1, SYSDATE, NULL, NULL, 'ä¸å¡ç¶æå表'); |
| | | INSERT INTO sys_dict_type VALUES (14, '000000', '表åç±»å', 'wf_form_type', 103, 1, SYSDATE, NULL, NULL, '表åç±»åå表'); |
| | | INSERT INTO sys_dict_type VALUES (15, '000000', 'ä»»å¡ç¶æ', 'wf_task_status', 103, 1, SYSDATE, NULL, NULL, 'ä»»å¡ç¶æ'); |
| | | INSERT INTO sys_dict_data VALUES (39, '000000', 1, 'å·²æ¤é', 'cancel', 'wf_business_status', '', 'danger', 'N', 103, 1, SYSDATE, NULL, NULL, 'å·²æ¤é'); |
| | | INSERT INTO sys_dict_data VALUES (40, '000000', 2, 'è稿', 'draft', 'wf_business_status', '', 'info', 'N', 103, 1, SYSDATE, NULL, NULL, 'è稿'); |
| | | INSERT INTO sys_dict_data VALUES (41, '000000', 3, 'å¾
å®¡æ ¸', 'waiting', 'wf_business_status', '', 'primary', 'N', 103, 1, SYSDATE, NULL, NULL, 'å¾
å®¡æ ¸'); |
| | | INSERT INTO sys_dict_data VALUES (42, '000000', 4, '已宿', 'finish', 'wf_business_status', '', 'success', 'N', 103, 1, SYSDATE, NULL, NULL, '已宿'); |
| | | INSERT INTO sys_dict_data VALUES (43, '000000', 5, 'å·²ä½åº', 'invalid', 'wf_business_status', '', 'danger', 'N', 103, 1, SYSDATE, NULL, NULL, 'å·²ä½åº'); |
| | | INSERT INTO sys_dict_data VALUES (44, '000000', 6, 'å·²éå', 'back', 'wf_business_status', '', 'danger', 'N', 103, 1, SYSDATE, NULL, NULL, 'å·²éå'); |
| | | INSERT INTO sys_dict_data VALUES (45, '000000', 7, 'å·²ç»æ¢', 'termination', 'wf_business_status', '', 'danger', 'N', 103, 1, SYSDATE, NULL, NULL, 'å·²ç»æ¢'); |
| | | INSERT INTO sys_dict_data VALUES (46, '000000', 1, 'èªå®ä¹è¡¨å', 'static', 'wf_form_type', '', 'success', 'N', 103, 1, SYSDATE, NULL, NULL, 'èªå®ä¹è¡¨å'); |
| | | INSERT INTO sys_dict_data VALUES (47, '000000', 2, 'å¨æè¡¨å', 'dynamic', 'wf_form_type', '', 'primary', 'N', 103, 1, SYSDATE, NULL, NULL, 'å¨æè¡¨å'); |
| | | INSERT INTO sys_dict_data VALUES (48, '000000', 1, 'æ¤é', 'cancel', 'wf_task_status', '', 'danger', 'N', 103, 1, SYSDATE, NULL, NULL, 'æ¤é'); |
| | | INSERT INTO sys_dict_data VALUES (49, '000000', 2, 'éè¿', 'pass', 'wf_task_status', '', 'success', 'N', 103, 1, SYSDATE, NULL, NULL, 'éè¿'); |
| | | INSERT INTO sys_dict_data VALUES (50, '000000', 3, 'å¾
å®¡æ ¸', 'waiting', 'wf_task_status', '', 'primary', 'N', 103, 1, SYSDATE, NULL, NULL, 'å¾
å®¡æ ¸'); |
| | | INSERT INTO sys_dict_data VALUES (51, '000000', 4, 'ä½åº', 'invalid', 'wf_task_status', '', 'danger', 'N', 103, 1, SYSDATE, NULL, NULL, 'ä½åº'); |
| | | INSERT INTO sys_dict_data VALUES (52, '000000', 5, 'éå', 'back', 'wf_task_status', '', 'danger', 'N', 103, 1, SYSDATE, NULL, NULL, 'éå'); |
| | | INSERT INTO sys_dict_data VALUES (53, '000000', 6, 'ç»æ¢', 'termination', 'wf_task_status', '', 'danger', 'N', 103, 1, SYSDATE, NULL, NULL, 'ç»æ¢'); |
| | | INSERT INTO sys_dict_data VALUES (54, '000000', 7, '转å', 'transfer', 'wf_task_status', '', 'primary', 'N', 103, 1, SYSDATE, NULL, NULL, '转å'); |
| | | INSERT INTO sys_dict_data VALUES (55, '000000', 8, 'å§æ', 'depute', 'wf_task_status', '', 'primary', 'N', 103, 1, SYSDATE, NULL, NULL, 'å§æ'); |
| | | INSERT INTO sys_dict_data VALUES (56, '000000', 9, 'æé', 'copy', 'wf_task_status', '', 'primary', 'N', 103, 1, SYSDATE, NULL, NULL, 'æé'); |
| | | INSERT INTO sys_dict_data VALUES (57, '000000', 10, 'å ç¾', 'sign', 'wf_task_status', '', 'primary', 'N', 103, 1, SYSDATE, NULL, NULL, 'å ç¾'); |
| | | INSERT INTO sys_dict_data VALUES (58, '000000', 11, 'åç¾', 'sign_off', 'wf_task_status', '', 'danger', 'N', 103, 1, SYSDATE, NULL, NULL, 'åç¾'); |
| | | INSERT INTO sys_dict_data VALUES (59, '000000', 11, 'è¶
æ¶', 'timeout', 'wf_task_status', '', 'danger', 'N', 103, 1, SYSDATE, NULL, NULL, 'è¶
æ¶'); |
ÎļþÃû´Ó script/sql/postgres/snail_job_postgre.sql ÐÞ¸Ä |
| | |
| | | SnailJob Database Transfer Tool |
| | | Source Server Type : MySQL |
| | | Target Server Type : PostgreSQL |
| | | Date: 2024-07-06 11:45:40 |
| | | Date: 2024-12-27 22:13:49 |
| | | */ |
| | | |
| | | |
| | |
| | | COMMENT ON TABLE sj_group_config IS 'ç»é
ç½®'; |
| | | |
| | | INSERT INTO sj_group_config VALUES (1, 'dev', 'ruoyi_group', '', 'SJ_cKqBTPzCsWA3VyuCfFoccmuIEGXjr5KT', 1, 1, 0, 1, 1, 4, now(), now()); |
| | | INSERT INTO sj_group_config VALUES (2, 'prod', 'ruoyi_group', '', 'SJ_cKqBTPzCsWA3VyuCfFoccmuIEGXjr5KT', 1, 1, 0, 1, 1, 4, now(), now()); |
| | | |
| | | -- sj_notify_config |
| | | CREATE TABLE sj_notify_config |
| | |
| | | id bigserial PRIMARY KEY, |
| | | namespace_id varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a', |
| | | group_name varchar(64) NOT NULL, |
| | | business_id varchar(64) NOT NULL, |
| | | notify_name varchar(64) NOT NULL DEFAULT '', |
| | | system_task_type smallint NOT NULL DEFAULT 3, |
| | | notify_status smallint NOT NULL DEFAULT 0, |
| | | recipient_ids varchar(128) NOT NULL, |
| | |
| | | update_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP |
| | | ); |
| | | |
| | | CREATE INDEX idx_sj_notify_config_01 ON sj_notify_config (namespace_id, group_name, business_id); |
| | | CREATE INDEX idx_sj_notify_config_01 ON sj_notify_config (namespace_id, group_name); |
| | | |
| | | COMMENT ON COLUMN sj_notify_config.id IS '主é®'; |
| | | COMMENT ON COLUMN sj_notify_config.namespace_id IS 'å½å空é´id'; |
| | | COMMENT ON COLUMN sj_notify_config.group_name IS 'ç»åç§°'; |
| | | COMMENT ON COLUMN sj_notify_config.business_id IS 'ä¸å¡id ( job_idæworkflow_idæscene_name ) '; |
| | | COMMENT ON COLUMN sj_notify_config.notify_name IS 'éç¥åç§°'; |
| | | COMMENT ON COLUMN sj_notify_config.system_task_type IS 'ä»»å¡ç±»å 1. éè¯ä»»å¡ 2. éè¯åè° 3ãJOBä»»å¡ 4ãWORKFLOWä»»å¡'; |
| | | COMMENT ON COLUMN sj_notify_config.notify_status IS 'éç¥ç¶æ 0ãæªå¯ç¨ 1ãå¯ç¨'; |
| | | COMMENT ON COLUMN sj_notify_config.recipient_ids IS 'æ¥æ¶äººidå表'; |
| | |
| | | max_retry_count int NOT NULL DEFAULT 5, |
| | | back_off smallint NOT NULL DEFAULT 1, |
| | | trigger_interval varchar(16) NOT NULL DEFAULT '', |
| | | notify_ids varchar(128) NOT NULL DEFAULT '', |
| | | deadline_request bigint NOT NULL DEFAULT 60000, |
| | | executor_timeout int NOT NULL DEFAULT 5, |
| | | route_key smallint NOT NULL DEFAULT 4, |
| | |
| | | COMMENT ON COLUMN sj_retry_scene_config.max_retry_count IS 'æå¤§éè¯æ¬¡æ°'; |
| | | COMMENT ON COLUMN sj_retry_scene_config.back_off IS '1ãé»è®¤ç级 2ãåºå®é´éæ¶é´ 3ãCRON 表达å¼'; |
| | | COMMENT ON COLUMN sj_retry_scene_config.trigger_interval IS 'é´éæ¶é¿'; |
| | | COMMENT ON COLUMN sj_retry_scene_config.notify_ids IS 'éç¥åè¦åºæ¯é
ç½®idå表'; |
| | | COMMENT ON COLUMN sj_retry_scene_config.deadline_request IS 'Deadline Request è°ç¨é¾è¶
æ¶ å使¯«ç§'; |
| | | COMMENT ON COLUMN sj_retry_scene_config.executor_timeout IS '任塿§è¡è¶
æ¶æ¶é´ï¼åä½ç§'; |
| | | COMMENT ON COLUMN sj_retry_scene_config.route_key IS 'è·¯ç±çç¥'; |
| | |
| | | retry_interval int NOT NULL DEFAULT 0, |
| | | bucket_index int NOT NULL DEFAULT 0, |
| | | resident smallint NOT NULL DEFAULT 0, |
| | | notify_ids varchar(128) NOT NULL DEFAULT '', |
| | | owner_id bigint NULL, |
| | | description varchar(256) NOT NULL DEFAULT '', |
| | | ext_attrs varchar(256) NULL DEFAULT '', |
| | | deleted smallint NOT NULL DEFAULT 0, |
| | |
| | | COMMENT ON COLUMN sj_job.retry_interval IS 'éè¯é´é ( s ) '; |
| | | COMMENT ON COLUMN sj_job.bucket_index IS 'bucket'; |
| | | COMMENT ON COLUMN sj_job.resident IS 'æ¯å¦æ¯å¸¸é©»ä»»å¡'; |
| | | COMMENT ON COLUMN sj_job.notify_ids IS 'éç¥åè¦åºæ¯é
ç½®idå表'; |
| | | COMMENT ON COLUMN sj_job.owner_id IS 'è´è´£äººid'; |
| | | COMMENT ON COLUMN sj_job.description IS 'æè¿°'; |
| | | COMMENT ON COLUMN sj_job.ext_attrs IS 'æ©å±å段'; |
| | | COMMENT ON COLUMN sj_job.deleted IS 'é»è¾å é¤ 1ãå é¤'; |
| | |
| | | COMMENT ON COLUMN sj_job.update_dt IS 'ä¿®æ¹æ¶é´'; |
| | | COMMENT ON TABLE sj_job IS 'ä»»å¡ä¿¡æ¯'; |
| | | |
| | | INSERT INTO sj_job VALUES (1, 'dev', 'ruoyi_group', 'demo-job', null, 1, 1710344035622, 1, 1, 4, 1, 'testJobExecutor', 2, '60', 1, 60, 3, 1, 1, 116, 0, '', '', 0, now(), now()); |
| | | INSERT INTO sj_job VALUES (1, 'dev', 'ruoyi_group', 'demo-job', null, 1, 1710344035622, 1, 1, 4, 1, 'testJobExecutor', 2, '60', 1, 60, 3, 1, 1, 116, 0, '', 1, '', '', 0, now(), now()); |
| | | |
| | | -- sj_job_log_message |
| | | CREATE TABLE sj_job_log_message |
| | |
| | | description varchar(256) NOT NULL DEFAULT '', |
| | | flow_info text NULL DEFAULT NULL, |
| | | wf_context text NULL DEFAULT NULL, |
| | | notify_ids varchar(128) NOT NULL DEFAULT '', |
| | | bucket_index int NOT NULL DEFAULT 0, |
| | | version int NOT NULL, |
| | | ext_attrs varchar(256) NULL DEFAULT '', |
| | |
| | | COMMENT ON COLUMN sj_workflow.description IS 'æè¿°'; |
| | | COMMENT ON COLUMN sj_workflow.flow_info IS 'æµç¨ä¿¡æ¯'; |
| | | COMMENT ON COLUMN sj_workflow.wf_context IS 'ä¸ä¸æ'; |
| | | COMMENT ON COLUMN sj_workflow.notify_ids IS 'éç¥åè¦åºæ¯é
ç½®idå表'; |
| | | COMMENT ON COLUMN sj_workflow.bucket_index IS 'bucket'; |
| | | COMMENT ON COLUMN sj_workflow.version IS 'çæ¬å·'; |
| | | COMMENT ON COLUMN sj_workflow.ext_attrs IS 'æ©å±å段'; |
| | |
| | | ( |
| | | id int8 not null, |
| | | user_id int8 not null, |
| | | tenant_id varchar(20) default null::varchar, |
| | | tenant_id varchar(20) default '000000'::varchar, |
| | | auth_id varchar(255) not null, |
| | | source varchar(255) not null, |
| | | open_id varchar(255) default null::varchar, |
| | |
| | | comment on column sys_social.create_time is 'å建æ¶é´'; |
| | | comment on column sys_social.update_by is 'æ´æ°è
'; |
| | | comment on column sys_social.update_time is 'æ´æ°æ¶é´'; |
| | | comment on column sys_social.del_flag is 'å 餿 å¿ï¼0代表åå¨ 2代表å é¤ï¼'; |
| | | comment on column sys_social.del_flag is 'å 餿 å¿ï¼0代表åå¨ 1代表å é¤ï¼'; |
| | | |
| | | -- ---------------------------- |
| | | -- ç§æ·è¡¨ |
| | |
| | | comment on column sys_tenant.expire_time is 'è¿ææ¶é´'; |
| | | comment on column sys_tenant.account_count is 'ç¨æ·æ°éï¼-1ä¸éå¶ï¼'; |
| | | comment on column sys_tenant.status is 'ç§æ·ç¶æï¼0æ£å¸¸ 1åç¨ï¼'; |
| | | comment on column sys_tenant.del_flag is 'å 餿 å¿ï¼0代表åå¨ 2代表å é¤ï¼'; |
| | | comment on column sys_tenant.del_flag is 'å 餿 å¿ï¼0代表åå¨ 1代表å é¤ï¼'; |
| | | comment on column sys_tenant.create_dept is 'å建é¨é¨'; |
| | | comment on column sys_tenant.create_by is 'å建è
'; |
| | | comment on column sys_tenant.create_time is 'å建æ¶é´'; |
| | |
| | | comment on column sys_tenant_package.menu_ids is 'å
³èèåid'; |
| | | comment on column sys_tenant_package.remark is '夿³¨'; |
| | | comment on column sys_tenant_package.status is 'ç¶æï¼0æ£å¸¸ 1åç¨ï¼'; |
| | | comment on column sys_tenant_package.del_flag is 'å 餿 å¿ï¼0代表åå¨ 2代表å é¤ï¼'; |
| | | comment on column sys_tenant_package.del_flag is 'å 餿 å¿ï¼0代表åå¨ 1代表å é¤ï¼'; |
| | | comment on column sys_tenant_package.create_dept is 'å建é¨é¨'; |
| | | comment on column sys_tenant_package.create_by is 'å建è
'; |
| | | comment on column sys_tenant_package.create_time is 'å建æ¶é´'; |
| | |
| | | comment on column sys_dept.phone is 'èç³»çµè¯'; |
| | | comment on column sys_dept.email is 'é®ç®±'; |
| | | comment on column sys_dept.status is 'é¨é¨ç¶æï¼0æ£å¸¸ 1åç¨ï¼'; |
| | | comment on column sys_dept.del_flag is 'å 餿 å¿ï¼0代表åå¨ 2代表å é¤ï¼'; |
| | | comment on column sys_dept.del_flag is 'å 餿 å¿ï¼0代表åå¨ 1代表å é¤ï¼'; |
| | | comment on column sys_dept.create_dept is 'å建é¨é¨'; |
| | | comment on column sys_dept.create_by is 'å建è
'; |
| | | comment on column sys_dept.create_time is 'å建æ¶é´'; |
| | |
| | | comment on column sys_user.avatar is '头åå°å'; |
| | | comment on column sys_user.password is 'å¯ç '; |
| | | comment on column sys_user.status is 'å¸å·ç¶æï¼0æ£å¸¸ 1åç¨ï¼'; |
| | | comment on column sys_user.del_flag is 'å 餿 å¿ï¼0代表åå¨ 2代表å é¤ï¼'; |
| | | comment on column sys_user.del_flag is 'å 餿 å¿ï¼0代表åå¨ 1代表å é¤ï¼'; |
| | | comment on column sys_user.login_ip is 'æåç»éIP'; |
| | | comment on column sys_user.login_date is 'æåç»éæ¶é´'; |
| | | comment on column sys_user.create_dept is 'å建é¨é¨'; |
| | |
| | | comment on column sys_role.menu_check_strictly is 'èåæ éæ©é¡¹æ¯å¦å
³èæ¾ç¤º'; |
| | | comment on column sys_role.dept_check_strictly is 'é¨é¨æ 鿩项æ¯å¦å
³èæ¾ç¤º'; |
| | | comment on column sys_role.status is 'è§è²ç¶æï¼0æ£å¸¸ 1åç¨ï¼'; |
| | | comment on column sys_role.del_flag is 'å 餿 å¿ï¼0代表åå¨ 2代表å é¤ï¼'; |
| | | comment on column sys_role.del_flag is 'å 餿 å¿ï¼0代表åå¨ 1代表å é¤ï¼'; |
| | | comment on column sys_role.create_dept is 'å建é¨é¨'; |
| | | comment on column sys_role.create_by is 'å建è
'; |
| | | comment on column sys_role.create_time is 'å建æ¶é´'; |
| | |
| | | -- ---------------------------- |
| | | -- ä¸çº§èå |
| | | insert into sys_menu values('1', 'ç³»ç»ç®¡ç', '0', '1', 'system', null, '', '1', '0', 'M', '0', '0', '', 'system', 103, 1, now(), null, null, 'ç³»ç»ç®¡çç®å½'); |
| | | insert into sys_menu values('6', 'ç³»ç»ç®¡ç', '0', '2', 'tenant', null, '', '1', '0', 'M', '0', '0', '', 'chart', 103, 1, now(), null, null, 'ç§æ·ç®¡çç®å½'); |
| | | insert into sys_menu values('6', 'ç§æ·ç®¡ç', '0', '2', 'tenant', null, '', '1', '0', 'M', '0', '0', '', 'chart', 103, 1, now(), null, null, 'ç§æ·ç®¡çç®å½'); |
| | | insert into sys_menu values('2', 'ç³»ç»çæ§', '0', '3', 'monitor', null, '', '1', '0', 'M', '0', '0', '', 'monitor', 103, 1, now(), null, null, 'ç³»ç»çæ§ç®å½'); |
| | | insert into sys_menu values('3', 'ç³»ç»å·¥å
·', '0', '4', 'tool', null, '', '1', '0', 'M', '0', '0', '', 'tool', 103, 1, now(), null, null, 'ç³»ç»å·¥å
·ç®å½'); |
| | | insert into sys_menu values('4', 'PLUSå®ç½', '0', '5', 'https://gitee.com/dromara/RuoYi-Vue-Plus', null, '', '0', '0', 'M', '0', '0', '', 'guide', 103, 1, now(), null, null, 'RuoYi-Vue-Pluså®ç½å°å'); |
| | |
| | | insert into sys_role_menu values ('3', '106'); |
| | | insert into sys_role_menu values ('3', '107'); |
| | | insert into sys_role_menu values ('3', '108'); |
| | | insert into sys_role_menu values ('3', '118'); |
| | | insert into sys_role_menu values ('3', '123'); |
| | | insert into sys_role_menu values ('3', '500'); |
| | | insert into sys_role_menu values ('3', '501'); |
| | | insert into sys_role_menu values ('3', '1001'); |
| | |
| | | insert into sys_role_menu values ('3', '1043'); |
| | | insert into sys_role_menu values ('3', '1044'); |
| | | insert into sys_role_menu values ('3', '1045'); |
| | | insert into sys_role_menu values ('3', '1050'); |
| | | insert into sys_role_menu values ('3', '1061'); |
| | | insert into sys_role_menu values ('3', '1062'); |
| | | insert into sys_role_menu values ('3', '1063'); |
| | | insert into sys_role_menu values ('3', '1064'); |
| | | insert into sys_role_menu values ('3', '1065'); |
| | | insert into sys_role_menu values ('3', '1500'); |
| | | insert into sys_role_menu values ('3', '1501'); |
| | | insert into sys_role_menu values ('3', '1502'); |
| | |
| | | insert into sys_role_menu values ('3', '1509'); |
| | | insert into sys_role_menu values ('3', '1510'); |
| | | insert into sys_role_menu values ('3', '1511'); |
| | | insert into sys_role_menu values ('3', '1600'); |
| | | insert into sys_role_menu values ('3', '1601'); |
| | | insert into sys_role_menu values ('3', '1602'); |
| | | insert into sys_role_menu values ('3', '1603'); |
| | | insert into sys_role_menu values ('3', '1620'); |
| | | insert into sys_role_menu values ('3', '1621'); |
| | | insert into sys_role_menu values ('3', '1622'); |
| | | insert into sys_role_menu values ('3', '1623'); |
| | | insert into sys_role_menu values ('3', '11618'); |
| | | insert into sys_role_menu values ('3', '11619'); |
| | | insert into sys_role_menu values ('3', '11629'); |
| | | insert into sys_role_menu values ('3', '11632'); |
| | | insert into sys_role_menu values ('3', '11633'); |
| | | insert into sys_role_menu values ('3', '11638'); |
| | | insert into sys_role_menu values ('3', '11639'); |
| | | insert into sys_role_menu values ('3', '11640'); |
| | | insert into sys_role_menu values ('3', '11641'); |
| | | insert into sys_role_menu values ('3', '11642'); |
| | | insert into sys_role_menu values ('3', '11643'); |
| | | insert into sys_role_menu values ('4', '5'); |
| | | insert into sys_role_menu values ('4', '1500'); |
| | | insert into sys_role_menu values ('4', '1501'); |
| | |
| | | oper_url varchar(255) default ''::varchar, |
| | | oper_ip varchar(128) default ''::varchar, |
| | | oper_location varchar(255) default ''::varchar, |
| | | oper_param varchar(2000) default ''::varchar, |
| | | json_result varchar(2000) default ''::varchar, |
| | | oper_param varchar(4000) default ''::varchar, |
| | | json_result varchar(4000) default ''::varchar, |
| | | status int4 default 0, |
| | | error_msg varchar(2000) default ''::varchar, |
| | | error_msg varchar(4000) default ''::varchar, |
| | | oper_time timestamp, |
| | | cost_time int8 default 0, |
| | | constraint sys_oper_log_pk primary key (oper_id) |
| | |
| | | insert into sys_oss_config values (1, '000000', 'minio', 'ruoyi', 'ruoyi123', 'ruoyi', '', '127.0.0.1:9000', '','N', '', '1', '0', '', 103, 1, now(), 1, now(), null); |
| | | insert into sys_oss_config values (2, '000000', 'qiniu', 'XXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXX', 'ruoyi', '', 's3-cn-north-1.qiniucs.com', '','N', '', '1', '1', '', 103, 1, now(), 1, now(), null); |
| | | insert into sys_oss_config values (3, '000000', 'aliyun', 'XXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXX', 'ruoyi', '', 'oss-cn-beijing.aliyuncs.com', '','N', '', '1', '1', '', 103, 1, now(), 1, now(), null); |
| | | insert into sys_oss_config values (4, '000000', 'qcloud', 'XXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXX', 'ruoyi-1250000000', '', 'cos.ap-beijing.myqcloud.com', '','N', 'ap-beijing', '1', '1', '', 103, 1, now(), 1, now(), null); |
| | | insert into sys_oss_config values (4, '000000', 'qcloud', 'XXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXX', 'ruoyi-1240000000', '', 'cos.ap-beijing.myqcloud.com', '','N', 'ap-beijing', '1', '1', '', 103, 1, now(), 1, now(), null); |
| | | insert into sys_oss_config values (5, '000000', 'image', 'ruoyi', 'ruoyi123', 'ruoyi', 'image', '127.0.0.1:9000', '','N', '', '1', '1', '', 103, 1, now(), 1, now(), NULL); |
| | | |
| | | -- ---------------------------- |
| | |
| | | comment on column sys_client.active_timeout is 'tokenæ´»è·è¶
æ¶æ¶é´'; |
| | | comment on column sys_client.timeout is 'tokenåºå®è¶
æ¶'; |
| | | comment on column sys_client.status is 'ç¶æï¼0æ£å¸¸ 1åç¨ï¼'; |
| | | comment on column sys_client.del_flag is 'å 餿 å¿ï¼0代表åå¨ 2代表å é¤ï¼'; |
| | | comment on column sys_client.del_flag is 'å 餿 å¿ï¼0代表åå¨ 1代表å é¤ï¼'; |
| | | comment on column sys_client.create_dept is 'å建é¨é¨'; |
| | | comment on column sys_client.create_by is 'å建è
'; |
| | | comment on column sys_client.create_time is 'å建æ¶é´'; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | -- ---------------------------- |
| | | -- 0ãwarm-flow-all.sqlï¼å°åï¼https://gitee.com/dromara/warm-flow/blob/master/sql/postgresql/postgresql-warm-flow-all.sql |
| | | -- ---------------------------- |
| | | CREATE TABLE flow_definition |
| | | ( |
| | | id int8 NOT NULL, -- 主é®id |
| | | flow_code varchar(40) NOT NULL, -- æµç¨ç¼ç |
| | | flow_name varchar(100) NOT NULL, -- æµç¨åç§° |
| | | category varchar(100) NULL, -- æµç¨ç±»å« |
| | | "version" varchar(20) NOT NULL, -- æµç¨çæ¬ |
| | | is_publish int2 NOT NULL DEFAULT 0, -- æ¯å¦åå¸ï¼0æªåå¸ 1å·²åå¸ 9失æï¼ |
| | | form_custom bpchar(1) NULL DEFAULT 'N':: character varying, -- 审æ¹è¡¨åæ¯å¦èªå®ä¹ï¼Yæ¯ Nå¦ï¼ |
| | | form_path varchar(100) NULL, -- 审æ¹è¡¨åè·¯å¾ |
| | | activity_status int2 NOT NULL DEFAULT 1, -- æµç¨æ¿æ´»ç¶æï¼0æèµ· 1æ¿æ´»ï¼ |
| | | listener_type varchar(100) NULL, -- çå¬å¨ç±»å |
| | | listener_path varchar(400) NULL, -- çå¬å¨è·¯å¾ |
| | | ext varchar(500) NULL, -- æ©å±å段ï¼é¢çç»ä¸å¡ç³»ç»ä½¿ç¨ |
| | | create_time timestamp NULL, -- å建æ¶é´ |
| | | update_time timestamp NULL, -- æ´æ°æ¶é´ |
| | | del_flag bpchar(1) NULL DEFAULT '0':: character varying, -- å 餿 å¿ |
| | | tenant_id varchar(40) NULL, -- ç§æ·id |
| | | CONSTRAINT flow_definition_pkey PRIMARY KEY (id) |
| | | ); |
| | | COMMENT ON TABLE flow_definition IS 'æµç¨å®ä¹è¡¨'; |
| | | |
| | | COMMENT ON COLUMN flow_definition.id IS '主é®id'; |
| | | COMMENT ON COLUMN flow_definition.flow_code IS 'æµç¨ç¼ç '; |
| | | COMMENT ON COLUMN flow_definition.flow_name IS 'æµç¨åç§°'; |
| | | COMMENT ON COLUMN flow_definition.category IS 'æµç¨ç±»å«'; |
| | | COMMENT ON COLUMN flow_definition."version" IS 'æµç¨çæ¬'; |
| | | COMMENT ON COLUMN flow_definition.is_publish IS 'æ¯å¦åå¸ï¼0æªåå¸ 1å·²åå¸ 9失æï¼'; |
| | | COMMENT ON COLUMN flow_definition.form_custom IS '审æ¹è¡¨åæ¯å¦èªå®ä¹ï¼Yæ¯ Nå¦ï¼'; |
| | | COMMENT ON COLUMN flow_definition.form_path IS '审æ¹è¡¨åè·¯å¾'; |
| | | COMMENT ON COLUMN flow_definition.activity_status IS 'æµç¨æ¿æ´»ç¶æï¼0æèµ· 1æ¿æ´»ï¼'; |
| | | COMMENT ON COLUMN flow_definition.listener_type IS 'çå¬å¨ç±»å'; |
| | | COMMENT ON COLUMN flow_definition.listener_path IS 'çå¬å¨è·¯å¾'; |
| | | COMMENT ON COLUMN flow_definition.ext IS 'æ©å±å段ï¼é¢çç»ä¸å¡ç³»ç»ä½¿ç¨'; |
| | | COMMENT ON COLUMN flow_definition.create_time IS 'å建æ¶é´'; |
| | | COMMENT ON COLUMN flow_definition.update_time IS 'æ´æ°æ¶é´'; |
| | | COMMENT ON COLUMN flow_definition.del_flag IS 'å 餿 å¿'; |
| | | COMMENT ON COLUMN flow_definition.tenant_id IS 'ç§æ·id'; |
| | | |
| | | CREATE TABLE flow_node |
| | | ( |
| | | id int8 NOT NULL, -- 主é®id |
| | | node_type int2 NOT NULL, -- èç¹ç±»åï¼0å¼å§èç¹ 1ä¸é´èç¹ 2ç»æèç¹ 3äºæ¥ç½å
³ 4å¹¶è¡ç½å
³ï¼ |
| | | definition_id int8 NOT NULL, -- æµç¨å®ä¹id |
| | | node_code varchar(100) NOT NULL, -- æµç¨èç¹ç¼ç |
| | | node_name varchar(100) NULL, -- æµç¨èç¹åç§° |
| | | permission_flag varchar(200) NULL, -- æéæ è¯ï¼æéç±»å:æéæ è¯ï¼å¯ä»¥å¤ä¸ªï¼ç¨éå·éå¼) |
| | | node_ratio numeric(6, 3) NULL, -- æµç¨ç¾ç½²æ¯ä¾å¼ |
| | | coordinate varchar(100) NULL, -- åæ |
| | | skip_any_node varchar(100) NULL DEFAULT 'N':: character varying, -- æ¯å¦å¯ä»¥éåä»»æèç¹ï¼Yæ¯ Nå¦ï¼å³å°å é¤ |
| | | any_node_skip varchar(100) NULL, -- ä»»æç»ç¹è·³è½¬ |
| | | listener_type varchar(100) NULL, -- çå¬å¨ç±»å |
| | | listener_path varchar(400) NULL, -- çå¬å¨è·¯å¾ |
| | | handler_type varchar(100) NULL, -- å¤çå¨ç±»å |
| | | handler_path varchar(400) NULL, -- å¤çå¨è·¯å¾ |
| | | form_custom bpchar(1) NULL DEFAULT 'N':: character varying, -- 审æ¹è¡¨åæ¯å¦èªå®ä¹ï¼Yæ¯ Nå¦ï¼ |
| | | form_path varchar(100) NULL, -- 审æ¹è¡¨åè·¯å¾ |
| | | "version" varchar(20) NOT NULL, -- çæ¬ |
| | | create_time timestamp NULL, -- å建æ¶é´ |
| | | update_time timestamp NULL, -- æ´æ°æ¶é´ |
| | | del_flag bpchar(1) NULL DEFAULT '0':: character varying, -- å 餿 å¿ |
| | | tenant_id varchar(40) NULL, -- ç§æ·id |
| | | CONSTRAINT flow_node_pkey PRIMARY KEY (id) |
| | | ); |
| | | COMMENT ON TABLE flow_node IS 'æµç¨èç¹è¡¨'; |
| | | |
| | | COMMENT ON COLUMN flow_node.id IS '主é®id'; |
| | | COMMENT ON COLUMN flow_node.node_type IS 'èç¹ç±»åï¼0å¼å§èç¹ 1ä¸é´èç¹ 2ç»æèç¹ 3äºæ¥ç½å
³ 4å¹¶è¡ç½å
³ï¼'; |
| | | COMMENT ON COLUMN flow_node.definition_id IS 'æµç¨å®ä¹id'; |
| | | COMMENT ON COLUMN flow_node.node_code IS 'æµç¨èç¹ç¼ç '; |
| | | COMMENT ON COLUMN flow_node.node_name IS 'æµç¨èç¹åç§°'; |
| | | COMMENT ON COLUMN flow_node.permission_flag IS 'æéæ è¯ï¼æéç±»å:æéæ è¯ï¼å¯ä»¥å¤ä¸ªï¼ç¨éå·éå¼)'; |
| | | COMMENT ON COLUMN flow_node.node_ratio IS 'æµç¨ç¾ç½²æ¯ä¾å¼'; |
| | | COMMENT ON COLUMN flow_node.coordinate IS 'åæ '; |
| | | COMMENT ON COLUMN flow_node.skip_any_node IS 'æ¯å¦å¯ä»¥éåä»»æèç¹ï¼Yæ¯ Nå¦ï¼å³å°å é¤'; |
| | | COMMENT ON COLUMN flow_node.any_node_skip IS 'ä»»æç»ç¹è·³è½¬'; |
| | | COMMENT ON COLUMN flow_node.listener_type IS 'çå¬å¨ç±»å'; |
| | | COMMENT ON COLUMN flow_node.listener_path IS 'çå¬å¨è·¯å¾'; |
| | | COMMENT ON COLUMN flow_node.handler_type IS 'å¤çå¨ç±»å'; |
| | | COMMENT ON COLUMN flow_node.handler_path IS 'å¤çå¨è·¯å¾'; |
| | | COMMENT ON COLUMN flow_node.form_custom IS '审æ¹è¡¨åæ¯å¦èªå®ä¹ï¼Yæ¯ Nå¦ï¼'; |
| | | COMMENT ON COLUMN flow_node.form_path IS '审æ¹è¡¨åè·¯å¾'; |
| | | COMMENT ON COLUMN flow_node."version" IS 'çæ¬'; |
| | | COMMENT ON COLUMN flow_node.create_time IS 'å建æ¶é´'; |
| | | COMMENT ON COLUMN flow_node.update_time IS 'æ´æ°æ¶é´'; |
| | | COMMENT ON COLUMN flow_node.del_flag IS 'å 餿 å¿'; |
| | | COMMENT ON COLUMN flow_node.tenant_id IS 'ç§æ·id'; |
| | | |
| | | |
| | | CREATE TABLE flow_skip |
| | | ( |
| | | id int8 NOT NULL, -- 主é®id |
| | | definition_id int8 NOT NULL, -- æµç¨å®ä¹id |
| | | now_node_code varchar(100) NOT NULL, -- å½åæµç¨èç¹çç¼ç |
| | | now_node_type int2 NULL, -- å½åèç¹ç±»åï¼0å¼å§èç¹ 1ä¸é´èç¹ 2ç»æèç¹ 3äºæ¥ç½å
³ 4å¹¶è¡ç½å
³ï¼ |
| | | next_node_code varchar(100) NOT NULL, -- ä¸ä¸ä¸ªæµç¨èç¹çç¼ç |
| | | next_node_type int2 NULL, -- ä¸ä¸ä¸ªèç¹ç±»åï¼0å¼å§èç¹ 1ä¸é´èç¹ 2ç»æèç¹ 3äºæ¥ç½å
³ 4å¹¶è¡ç½å
³ï¼ |
| | | skip_name varchar(100) NULL, -- 跳转åç§° |
| | | skip_type varchar(40) NULL, -- 跳转类åï¼PASS审æ¹éè¿ REJECTéåï¼ |
| | | skip_condition varchar(200) NULL, -- 跳转æ¡ä»¶ |
| | | coordinate varchar(100) NULL, -- åæ |
| | | create_time timestamp NULL, -- å建æ¶é´ |
| | | update_time timestamp NULL, -- æ´æ°æ¶é´ |
| | | del_flag bpchar(1) NULL DEFAULT '0':: character varying, -- å 餿 å¿ |
| | | tenant_id varchar(40) NULL, -- ç§æ·id |
| | | CONSTRAINT flow_skip_pkey PRIMARY KEY (id) |
| | | ); |
| | | COMMENT ON TABLE flow_skip IS 'èç¹è·³è½¬å
³è表'; |
| | | |
| | | COMMENT ON COLUMN flow_skip.id IS '主é®id'; |
| | | COMMENT ON COLUMN flow_skip.definition_id IS 'æµç¨å®ä¹id'; |
| | | COMMENT ON COLUMN flow_skip.now_node_code IS 'å½åæµç¨èç¹çç¼ç '; |
| | | COMMENT ON COLUMN flow_skip.now_node_type IS 'å½åèç¹ç±»åï¼0å¼å§èç¹ 1ä¸é´èç¹ 2ç»æèç¹ 3äºæ¥ç½å
³ 4å¹¶è¡ç½å
³ï¼'; |
| | | COMMENT ON COLUMN flow_skip.next_node_code IS 'ä¸ä¸ä¸ªæµç¨èç¹çç¼ç '; |
| | | COMMENT ON COLUMN flow_skip.next_node_type IS 'ä¸ä¸ä¸ªèç¹ç±»åï¼0å¼å§èç¹ 1ä¸é´èç¹ 2ç»æèç¹ 3äºæ¥ç½å
³ 4å¹¶è¡ç½å
³ï¼'; |
| | | COMMENT ON COLUMN flow_skip.skip_name IS '跳转åç§°'; |
| | | COMMENT ON COLUMN flow_skip.skip_type IS '跳转类åï¼PASS审æ¹éè¿ REJECTéåï¼'; |
| | | COMMENT ON COLUMN flow_skip.skip_condition IS '跳转æ¡ä»¶'; |
| | | COMMENT ON COLUMN flow_skip.coordinate IS 'åæ '; |
| | | COMMENT ON COLUMN flow_skip.create_time IS 'å建æ¶é´'; |
| | | COMMENT ON COLUMN flow_skip.update_time IS 'æ´æ°æ¶é´'; |
| | | COMMENT ON COLUMN flow_skip.del_flag IS 'å 餿 å¿'; |
| | | COMMENT ON COLUMN flow_skip.tenant_id IS 'ç§æ·id'; |
| | | |
| | | CREATE TABLE flow_instance |
| | | ( |
| | | id int8 NOT NULL, -- 主é®id |
| | | definition_id int8 NOT NULL, -- 对åºflow_definition表çid |
| | | business_id varchar(40) NOT NULL, -- ä¸å¡id |
| | | node_type int2 NOT NULL, -- èç¹ç±»åï¼0å¼å§èç¹ 1ä¸é´èç¹ 2ç»æèç¹ 3äºæ¥ç½å
³ 4å¹¶è¡ç½å
³ï¼ |
| | | node_code varchar(40) NOT NULL, -- æµç¨èç¹ç¼ç |
| | | node_name varchar(100) NULL, -- æµç¨èç¹åç§° |
| | | variable text NULL, -- ä»»å¡åé |
| | | flow_status varchar(20) NOT NULL, -- æµç¨ç¶æï¼0å¾
æäº¤ 1审æ¹ä¸ 2 审æ¹éè¿ 8已宿 9å·²éå 10失æï¼ |
| | | activity_status int2 NOT NULL DEFAULT 1, -- æµç¨æ¿æ´»ç¶æï¼0æèµ· 1æ¿æ´»ï¼ |
| | | def_json text NULL, -- æµç¨å®ä¹json |
| | | create_by varchar(64) NULL DEFAULT '':: character varying, -- å建è
|
| | | create_time timestamp NULL, -- å建æ¶é´ |
| | | update_time timestamp NULL, -- æ´æ°æ¶é´ |
| | | ext varchar(500) NULL, -- æ©å±å段ï¼é¢çç»ä¸å¡ç³»ç»ä½¿ç¨ |
| | | del_flag bpchar(1) NULL DEFAULT '0':: character varying, -- å 餿 å¿ |
| | | tenant_id varchar(40) NULL, -- ç§æ·id |
| | | CONSTRAINT flow_instance_pkey PRIMARY KEY (id) |
| | | ); |
| | | COMMENT ON TABLE flow_instance IS 'æµç¨å®ä¾è¡¨'; |
| | | |
| | | COMMENT ON COLUMN flow_instance.id IS '主é®id'; |
| | | COMMENT ON COLUMN flow_instance.definition_id IS '对åºflow_definition表çid'; |
| | | COMMENT ON COLUMN flow_instance.business_id IS 'ä¸å¡id'; |
| | | COMMENT ON COLUMN flow_instance.node_type IS 'èç¹ç±»åï¼0å¼å§èç¹ 1ä¸é´èç¹ 2ç»æèç¹ 3äºæ¥ç½å
³ 4å¹¶è¡ç½å
³ï¼'; |
| | | COMMENT ON COLUMN flow_instance.node_code IS 'æµç¨èç¹ç¼ç '; |
| | | COMMENT ON COLUMN flow_instance.node_name IS 'æµç¨èç¹åç§°'; |
| | | COMMENT ON COLUMN flow_instance.variable IS 'ä»»å¡åé'; |
| | | COMMENT ON COLUMN flow_instance.flow_status IS 'æµç¨ç¶æï¼0å¾
æäº¤ 1审æ¹ä¸ 2 审æ¹éè¿ 3èªå¨éè¿ 4ç»æ¢ 5ä½åº 6æ¤é 7åå 8已宿 9å·²éå 10失æï¼'; |
| | | COMMENT ON COLUMN flow_instance.activity_status IS 'æµç¨æ¿æ´»ç¶æï¼0æèµ· 1æ¿æ´»ï¼'; |
| | | COMMENT ON COLUMN flow_instance.def_json IS 'æµç¨å®ä¹json'; |
| | | COMMENT ON COLUMN flow_instance.create_by IS 'å建è
'; |
| | | COMMENT ON COLUMN flow_instance.create_time IS 'å建æ¶é´'; |
| | | COMMENT ON COLUMN flow_instance.update_time IS 'æ´æ°æ¶é´'; |
| | | COMMENT ON COLUMN flow_instance.ext IS 'æ©å±å段ï¼é¢çç»ä¸å¡ç³»ç»ä½¿ç¨'; |
| | | COMMENT ON COLUMN flow_instance.del_flag IS 'å 餿 å¿'; |
| | | COMMENT ON COLUMN flow_instance.tenant_id IS 'ç§æ·id'; |
| | | |
| | | CREATE TABLE flow_task |
| | | ( |
| | | id int8 NOT NULL, -- 主é®id |
| | | definition_id int8 NOT NULL, -- 对åºflow_definition表çid |
| | | instance_id int8 NOT NULL, -- 对åºflow_instance表çid |
| | | node_code varchar(100) NOT NULL, -- èç¹ç¼ç |
| | | node_name varchar(100) NULL, -- èç¹åç§° |
| | | node_type int2 NOT NULL, -- èç¹ç±»åï¼0å¼å§èç¹ 1ä¸é´èç¹ 2ç»æèç¹ 3äºæ¥ç½å
³ 4å¹¶è¡ç½å
³ï¼ |
| | | form_custom bpchar(1) NULL DEFAULT 'N':: character varying, -- 审æ¹è¡¨åæ¯å¦èªå®ä¹ï¼Yæ¯ Nå¦ï¼ |
| | | form_path varchar(100) NULL, -- 审æ¹è¡¨åè·¯å¾ |
| | | create_time timestamp NULL, -- å建æ¶é´ |
| | | update_time timestamp NULL, -- æ´æ°æ¶é´ |
| | | del_flag bpchar(1) NULL DEFAULT '0':: character varying, -- å 餿 å¿ |
| | | tenant_id varchar(40) NULL, -- ç§æ·id |
| | | CONSTRAINT flow_task_pkey PRIMARY KEY (id) |
| | | ); |
| | | COMMENT ON TABLE flow_task IS 'å¾
åä»»å¡è¡¨'; |
| | | |
| | | COMMENT ON COLUMN flow_task.id IS '主é®id'; |
| | | COMMENT ON COLUMN flow_task.definition_id IS '对åºflow_definition表çid'; |
| | | COMMENT ON COLUMN flow_task.instance_id IS '对åºflow_instance表çid'; |
| | | COMMENT ON COLUMN flow_task.node_code IS 'èç¹ç¼ç '; |
| | | COMMENT ON COLUMN flow_task.node_name IS 'èç¹åç§°'; |
| | | COMMENT ON COLUMN flow_task.node_type IS 'èç¹ç±»åï¼0å¼å§èç¹ 1ä¸é´èç¹ 2ç»æèç¹ 3äºæ¥ç½å
³ 4å¹¶è¡ç½å
³ï¼'; |
| | | COMMENT ON COLUMN flow_task.form_custom IS '审æ¹è¡¨åæ¯å¦èªå®ä¹ï¼Yæ¯ Nå¦ï¼'; |
| | | COMMENT ON COLUMN flow_task.form_path IS '审æ¹è¡¨åè·¯å¾'; |
| | | COMMENT ON COLUMN flow_task.create_time IS 'å建æ¶é´'; |
| | | COMMENT ON COLUMN flow_task.update_time IS 'æ´æ°æ¶é´'; |
| | | COMMENT ON COLUMN flow_task.del_flag IS 'å 餿 å¿'; |
| | | COMMENT ON COLUMN flow_task.tenant_id IS 'ç§æ·id'; |
| | | |
| | | CREATE TABLE flow_his_task |
| | | ( |
| | | id int8 NOT NULL, -- 主é®id |
| | | definition_id int8 NOT NULL, -- 对åºflow_definition表çid |
| | | instance_id int8 NOT NULL, -- 对åºflow_instance表çid |
| | | task_id int8 NOT NULL, -- 对åºflow_task表çid |
| | | node_code varchar(200) NULL, -- å¼å§èç¹ç¼ç |
| | | node_name varchar(200) NULL, -- å¼å§èç¹åç§° |
| | | node_type int2 NULL, -- å¼å§èç¹ç±»åï¼0å¼å§èç¹ 1ä¸é´èç¹ 2ç»æèç¹ 3äºæ¥ç½å
³ 4å¹¶è¡ç½å
³ï¼ |
| | | target_node_code varchar(200) NULL, -- ç®æ èç¹ç¼ç |
| | | target_node_name varchar(200) NULL, -- ç»æèç¹åç§° |
| | | approver varchar(40) NULL, -- 审æ¹è
|
| | | cooperate_type int2 NOT NULL DEFAULT 0, -- å使¹å¼(1å®¡æ¹ 2转å 3å§æ´¾ 4ä¼ç¾ 5ç¥¨ç¾ 6å ç¾ 7åç¾) |
| | | collaborator varchar(40) NULL, -- åä½äºº(åªæè½¬åãä¼ç¾ã票ç¾ãå§æ´¾) |
| | | skip_type varchar(10) NULL, -- æµè½¬ç±»åï¼PASSéè¿ REJECTéå NONEæ å¨ä½ï¼ |
| | | flow_status varchar(20) NOT NULL, -- æµç¨ç¶æï¼0å¾
æäº¤ 1审æ¹ä¸ 2 审æ¹éè¿ 8已宿 9å·²éå 10失æï¼ |
| | | form_custom bpchar(1) NULL DEFAULT 'N':: character varying, -- 审æ¹è¡¨åæ¯å¦èªå®ä¹ï¼Yæ¯ Nå¦ï¼ |
| | | form_path varchar(100) NULL, -- 审æ¹è¡¨åè·¯å¾ |
| | | ext varchar(500) NULL, -- æ©å±å段ï¼é¢çç»ä¸å¡ç³»ç»ä½¿ç¨ |
| | | message varchar(500) NULL, -- å®¡æ¹æè§ |
| | | variable text NULL, -- ä»»å¡åé |
| | | create_time timestamp NULL, -- å建æ¶é´ |
| | | update_time timestamp NULL, -- æ´æ°æ¶é´ |
| | | del_flag bpchar(1) NULL DEFAULT '0':: character varying, -- å 餿 å¿ |
| | | tenant_id varchar(40) NULL, -- ç§æ·id |
| | | CONSTRAINT flow_his_task_pkey PRIMARY KEY (id) |
| | | ); |
| | | COMMENT ON TABLE flow_his_task IS 'åå²ä»»å¡è®°å½è¡¨'; |
| | | |
| | | COMMENT ON COLUMN flow_his_task.id IS '主é®id'; |
| | | COMMENT ON COLUMN flow_his_task.definition_id IS '对åºflow_definition表çid'; |
| | | COMMENT ON COLUMN flow_his_task.instance_id IS '对åºflow_instance表çid'; |
| | | COMMENT ON COLUMN flow_his_task.task_id IS '对åºflow_task表çid'; |
| | | COMMENT ON COLUMN flow_his_task.node_code IS 'å¼å§èç¹ç¼ç '; |
| | | COMMENT ON COLUMN flow_his_task.node_name IS 'å¼å§èç¹åç§°'; |
| | | COMMENT ON COLUMN flow_his_task.node_type IS 'å¼å§èç¹ç±»åï¼0å¼å§èç¹ 1ä¸é´èç¹ 2ç»æèç¹ 3äºæ¥ç½å
³ 4å¹¶è¡ç½å
³ï¼'; |
| | | COMMENT ON COLUMN flow_his_task.target_node_code IS 'ç®æ èç¹ç¼ç '; |
| | | COMMENT ON COLUMN flow_his_task.target_node_name IS 'ç»æèç¹åç§°'; |
| | | COMMENT ON COLUMN flow_his_task.approver IS '审æ¹è
'; |
| | | COMMENT ON COLUMN flow_his_task.cooperate_type IS 'å使¹å¼(1å®¡æ¹ 2转å 3å§æ´¾ 4ä¼ç¾ 5ç¥¨ç¾ 6å ç¾ 7åç¾)'; |
| | | COMMENT ON COLUMN flow_his_task.collaborator IS 'åä½äºº'; |
| | | COMMENT ON COLUMN flow_his_task.skip_type IS 'æµè½¬ç±»åï¼PASSéè¿ REJECTéå NONEæ å¨ä½ï¼'; |
| | | COMMENT ON COLUMN flow_his_task.flow_status IS 'æµç¨ç¶æï¼1审æ¹ä¸ 2 审æ¹éè¿ 9å·²éå 10失æï¼'; |
| | | COMMENT ON COLUMN flow_his_task.form_custom IS '审æ¹è¡¨åæ¯å¦èªå®ä¹ï¼Yæ¯ Nå¦ï¼'; |
| | | COMMENT ON COLUMN flow_his_task.form_path IS '审æ¹è¡¨åè·¯å¾'; |
| | | COMMENT ON COLUMN flow_his_task.message IS 'å®¡æ¹æè§'; |
| | | COMMENT ON COLUMN flow_his_task.variable IS 'ä»»å¡åé'; |
| | | COMMENT ON COLUMN flow_his_task.ext IS 'æ©å±å段ï¼é¢çç»ä¸å¡ç³»ç»ä½¿ç¨'; |
| | | COMMENT ON COLUMN flow_his_task.create_time IS 'ä»»å¡å¼å§æ¶é´'; |
| | | COMMENT ON COLUMN flow_his_task.update_time IS '审æ¹å®ææ¶é´'; |
| | | COMMENT ON COLUMN flow_his_task.del_flag IS 'å 餿 å¿'; |
| | | COMMENT ON COLUMN flow_his_task.tenant_id IS 'ç§æ·id'; |
| | | |
| | | CREATE TABLE flow_user |
| | | ( |
| | | id int8 NOT NULL, -- 主é®id |
| | | "type" bpchar(1) NOT NULL, -- 人åç±»åï¼1å¾
åä»»å¡ç审æ¹äººæé 2å¾
åä»»å¡ç转å人æé 3æµç¨å®ä¾çæé人æé 4å¾
åä»»å¡çå§æäººæéï¼ |
| | | processed_by varchar(80) NULL, -- æé人 |
| | | associated int8 NOT NULL, -- ä»»å¡è¡¨id |
| | | create_time timestamp NULL, -- å建æ¶é´ |
| | | create_by varchar(80) NULL, -- å建人 |
| | | update_time timestamp NULL, -- æ´æ°æ¶é´ |
| | | del_flag bpchar(1) NULL DEFAULT '0':: character varying, -- å 餿 å¿ |
| | | tenant_id varchar(40) NULL, -- ç§æ·id |
| | | CONSTRAINT flow_user_pk PRIMARY KEY (id) |
| | | ); |
| | | CREATE INDEX user_processed_type ON flow_user USING btree (processed_by, type); |
| | | COMMENT ON TABLE flow_user IS 'æµç¨ç¨æ·è¡¨'; |
| | | |
| | | COMMENT ON COLUMN flow_user.id IS '主é®id'; |
| | | COMMENT ON COLUMN flow_user."type" IS '人åç±»åï¼1å¾
åä»»å¡ç审æ¹äººæé 2å¾
åä»»å¡ç转å人æé 3å¾
åä»»å¡çå§æäººæéï¼'; |
| | | COMMENT ON COLUMN flow_user.processed_by IS 'æé人'; |
| | | COMMENT ON COLUMN flow_user.associated IS 'ä»»å¡è¡¨id'; |
| | | COMMENT ON COLUMN flow_user.create_time IS 'å建æ¶é´'; |
| | | COMMENT ON COLUMN flow_user.create_by IS 'å建人'; |
| | | COMMENT ON COLUMN flow_user.update_time IS 'æ´æ°æ¶é´'; |
| | | COMMENT ON COLUMN flow_user.del_flag IS 'å 餿 å¿'; |
| | | COMMENT ON COLUMN flow_user.tenant_id IS 'ç§æ·id'; |
| | | |
| | | -- ---------------------------- |
| | | -- æµç¨å类表 |
| | | -- ---------------------------- |
| | | CREATE TABLE flow_category |
| | | ( |
| | | category_id int8 NOT NULL, |
| | | tenant_id VARCHAR(20) DEFAULT '000000'::varchar, |
| | | parent_id int8 DEFAULT 0, |
| | | ancestors VARCHAR(500) DEFAULT ''::varchar, |
| | | category_name VARCHAR(30) NOT NULL, |
| | | order_num INT DEFAULT 0, |
| | | del_flag CHAR DEFAULT '0'::bpchar, |
| | | create_dept int8, |
| | | create_by int8, |
| | | create_time TIMESTAMP, |
| | | update_by int8, |
| | | update_time TIMESTAMP, |
| | | PRIMARY KEY (category_id) |
| | | ); |
| | | |
| | | COMMENT ON TABLE flow_category IS 'æµç¨åç±»'; |
| | | COMMENT ON COLUMN flow_category.category_id IS 'æµç¨åç±»ID'; |
| | | COMMENT ON COLUMN flow_category.tenant_id IS 'ç§æ·ç¼å·'; |
| | | COMMENT ON COLUMN flow_category.parent_id IS 'ç¶æµç¨åç±»id'; |
| | | COMMENT ON COLUMN flow_category.ancestors IS 'ç¥çº§å表'; |
| | | COMMENT ON COLUMN flow_category.category_name IS 'æµç¨åç±»åç§°'; |
| | | COMMENT ON COLUMN flow_category.order_num IS 'æ¾ç¤ºé¡ºåº'; |
| | | COMMENT ON COLUMN flow_category.del_flag IS 'å 餿 å¿ï¼0代表åå¨ 1代表å é¤ï¼'; |
| | | COMMENT ON COLUMN flow_category.create_dept IS 'å建é¨é¨'; |
| | | COMMENT ON COLUMN flow_category.create_by IS 'å建è
'; |
| | | COMMENT ON COLUMN flow_category.create_time IS 'å建æ¶é´'; |
| | | COMMENT ON COLUMN flow_category.update_by IS 'æ´æ°è
'; |
| | | COMMENT ON COLUMN flow_category.update_time IS 'æ´æ°æ¶é´'; |
| | | |
| | | INSERT INTO flow_category VALUES (100, '000000', 0, '0', 'OA审æ¹', 0, '0', 103, 1, now(), NULL, NULL); |
| | | INSERT INTO flow_category VALUES (101, '000000', 100, '0,100', 'åå¤ç®¡ç', 0, '0', 103, 1, now(), NULL, NULL); |
| | | INSERT INTO flow_category VALUES (102, '000000', 100, '0,100', '人äºç®¡ç', 1, '0', 103, 1, now(), NULL, NULL); |
| | | INSERT INTO flow_category VALUES (103, '000000', 101, '0,100,101', '请å', 0, '0', 103, 1, now(), NULL, NULL); |
| | | INSERT INTO flow_category VALUES (104, '000000', 101, '0,100,101', 'åºå·®', 1, '0', 103, 1, now(), NULL, NULL); |
| | | INSERT INTO flow_category VALUES (105, '000000', 101, '0,100,101', 'å ç', 2, '0', 103, 1, now(), NULL, NULL); |
| | | INSERT INTO flow_category VALUES (106, '000000', 101, '0,100,101', 'æ¢ç', 3, '0', 103, 1, now(), NULL, NULL); |
| | | INSERT INTO flow_category VALUES (107, '000000', 101, '0,100,101', 'å¤åº', 4, '0', 103, 1, now(), NULL, NULL); |
| | | INSERT INTO flow_category VALUES (108, '000000', 102, '0,100,102', '转æ£', 1, '0', 103, 1, now(), NULL, NULL); |
| | | INSERT INTO flow_category VALUES (109, '000000', 102, '0,100,102', '离è', 2, '0', 103, 1, now(), NULL, NULL); |
| | | |
| | | -- ---------------------------- |
| | | -- 请ååä¿¡æ¯ |
| | | -- ---------------------------- |
| | | CREATE TABLE test_leave |
| | | ( |
| | | id int8 NOT NULL, |
| | | tenant_id VARCHAR(20) DEFAULT '000000'::varchar, |
| | | leave_type VARCHAR(255) NOT NULL, |
| | | start_date TIMESTAMP NOT NULL, |
| | | end_date TIMESTAMP NOT NULL, |
| | | leave_days int2 NOT NULL, |
| | | remark VARCHAR(255), |
| | | status VARCHAR(255), |
| | | create_dept int8, |
| | | create_by int8, |
| | | create_time TIMESTAMP, |
| | | update_by int8, |
| | | update_time TIMESTAMP, |
| | | PRIMARY KEY (id) |
| | | ); |
| | | |
| | | COMMENT ON TABLE test_leave IS '请åç³è¯·è¡¨'; |
| | | COMMENT ON COLUMN test_leave.id IS 'id'; |
| | | COMMENT ON COLUMN test_leave.tenant_id IS 'ç§æ·ç¼å·'; |
| | | COMMENT ON COLUMN test_leave.leave_type IS '请åç±»å'; |
| | | COMMENT ON COLUMN test_leave.start_date IS 'å¼å§æ¶é´'; |
| | | COMMENT ON COLUMN test_leave.end_date IS 'ç»ææ¶é´'; |
| | | COMMENT ON COLUMN test_leave.leave_days IS '请å天æ°'; |
| | | COMMENT ON COLUMN test_leave.remark IS '请ååå '; |
| | | COMMENT ON COLUMN test_leave.status IS 'ç¶æ'; |
| | | COMMENT ON COLUMN test_leave.create_dept IS 'å建é¨é¨'; |
| | | COMMENT ON COLUMN test_leave.create_by IS 'å建è
'; |
| | | COMMENT ON COLUMN test_leave.create_time IS 'å建æ¶é´'; |
| | | COMMENT ON COLUMN test_leave.update_by IS 'æ´æ°è
'; |
| | | COMMENT ON COLUMN test_leave.update_time IS 'æ´æ°æ¶é´'; |
| | | |
| | | INSERT INTO sys_menu VALUES ('11616', '工使µ', '0', '6', 'workflow', '', '', '1', '0', 'M', '0', '0', '', 'workflow', 103, 1, now(), NULL, NULL, ''); |
| | | INSERT INTO sys_menu VALUES ('11618', 'æçä»»å¡', '0', '7', 'task', '', '', '1', '0', 'M', '0', '0', '', 'my-task', 103, 1, now(), NULL, NULL, ''); |
| | | INSERT INTO sys_menu VALUES ('11619', 'æçå¾
å', '11618', '2', 'taskWaiting', 'workflow/task/taskWaiting', '', '1', '1', 'C', '0', '0', '', 'waiting', 103, 1, now(), NULL, NULL, ''); |
| | | INSERT INTO sys_menu VALUES ('11632', 'æçå·²å', '11618', '3', 'taskFinish', 'workflow/task/taskFinish', '', '1', '1', 'C', '0', '0', '', 'finish', 103, 1, now(), NULL, NULL, ''); |
| | | INSERT INTO sys_menu VALUES ('11633', 'æçæé', '11618', '4', 'taskCopyList', 'workflow/task/taskCopyList', '', '1', '1', 'C', '0', '0', '', 'my-copy', 103, 1, now(), NULL, NULL, ''); |
| | | INSERT INTO sys_menu VALUES ('11620', 'æµç¨å®ä¹', '11616', '3', 'processDefinition', 'workflow/processDefinition/index', '', '1', '1', 'C', '0', '0', '', 'process-definition', 103, 1, now(), NULL, NULL, ''); |
| | | INSERT INTO sys_menu VALUES ('11621', 'æµç¨å®ä¾', '11630', '1', 'processInstance', 'workflow/processInstance/index', '', '1', '1', 'C', '0', '0', '', 'tree-table', 103, 1, now(), NULL, NULL, ''); |
| | | INSERT INTO sys_menu VALUES ('11622', 'æµç¨åç±»', '11616', '1', 'category', 'workflow/category/index', '', '1', '0', 'C', '0', '0', 'workflow:category:list', 'category', 103, 1, now(), NULL, NULL, ''); |
| | | INSERT INTO sys_menu VALUES ('11629', 'æåèµ·ç', '11618', '1', 'myDocument', 'workflow/task/myDocument', '', '1', '1', 'C', '0', '0', '', 'guide', 103, 1, now(), NULL, NULL, ''); |
| | | INSERT INTO sys_menu VALUES ('11630', 'æµç¨çæ§', '11616', '4', 'monitor', '', '', '1', '0', 'M', '0', '0', '', 'monitor', 103, 1, now(), NULL, NULL, ''); |
| | | INSERT INTO sys_menu VALUES ('11631', 'å¾
åä»»å¡', '11630', '2', 'allTaskWaiting', 'workflow/task/allTaskWaiting', '', '1', '1', 'C', '0', '0', '', 'waiting', 103, 1, now(), NULL, NULL, ''); |
| | | INSERT INTO sys_menu VALUES ('11623', 'æµç¨åç±»æ¥è¯¢', '11622', '1', '#', '', '', '1', '0', 'F', '0', '0', 'workflow:category:query', '#', 103, 1, now(), NULL, NULL, ''); |
| | | INSERT INTO sys_menu VALUES ('11624', 'æµç¨åç±»æ°å¢', '11622', '2', '#', '', '', '1', '0', 'F', '0', '0', 'workflow:category:add', '#', 103, 1, now(), NULL, NULL, ''); |
| | | INSERT INTO sys_menu VALUES ('11625', 'æµç¨å类修æ¹', '11622', '3', '#', '', '', '1', '0', 'F', '0', '0', 'workflow:category:edit', '#', 103, 1, now(), NULL, NULL, ''); |
| | | INSERT INTO sys_menu VALUES ('11626', 'æµç¨åç±»å é¤', '11622', '4', '#', '', '', '1', '0', 'F', '0', '0', 'workflow:category:remove', '#', 103, 1, now(), NULL, NULL, ''); |
| | | INSERT INTO sys_menu VALUES ('11627', 'æµç¨å类导åº', '11622', '5', '#', '', '', '1', '0', 'F', '0', '0', 'workflow:category:export', '#', 103, 1, now(), NULL, NULL, ''); |
| | | INSERT INTO sys_menu VALUES ('11638', '请åç³è¯·', '5', '1', 'leave', 'workflow/leave/index', '', '1', '0', 'C', '0', '0', 'workflow:leave:list', '#', 103, 1, now(), NULL, NULL, '请åç³è¯·èå'); |
| | | INSERT INTO sys_menu VALUES ('11639', '请åç³è¯·æ¥è¯¢', '11638', '1', '#', '', '', '1', '0', 'F', '0', '0', 'workflow:leave:query', '#', 103, 1, now(), NULL, NULL, ''); |
| | | INSERT INTO sys_menu VALUES ('11640', '请åç³è¯·æ°å¢', '11638', '2', '#', '', '', '1', '0', 'F', '0', '0', 'workflow:leave:add', '#', 103, 1, now(), NULL, NULL, ''); |
| | | INSERT INTO sys_menu VALUES ('11641', '请åç³è¯·ä¿®æ¹', '11638', '3', '#', '', '', '1', '0', 'F', '0', '0', 'workflow:leave:edit', '#', 103, 1, now(), NULL, NULL, ''); |
| | | INSERT INTO sys_menu VALUES ('11642', '请åç³è¯·å é¤', '11638', '4', '#', '', '', '1', '0', 'F', '0', '0', 'workflow:leave:remove', '#', 103, 1, now(), NULL, NULL, ''); |
| | | INSERT INTO sys_menu VALUES ('11643', '请åç³è¯·å¯¼åº', '11638', '5', '#', '', '', '1', '0', 'F', '0', '0', 'workflow:leave:export', '#', 103, 1, now(), NULL, NULL, ''); |
| | | |
| | | INSERT INTO sys_dict_type VALUES (13, '000000', 'ä¸å¡ç¶æ', 'wf_business_status', 103, 1, now(), NULL, NULL, 'ä¸å¡ç¶æå表'); |
| | | INSERT INTO sys_dict_type VALUES (14, '000000', '表åç±»å', 'wf_form_type', 103, 1, now(), NULL, NULL, '表åç±»åå表'); |
| | | INSERT INTO sys_dict_type VALUES (15, '000000', 'ä»»å¡ç¶æ', 'wf_task_status', 103, 1, now(), NULL, NULL, 'ä»»å¡ç¶æ'); |
| | | INSERT INTO sys_dict_data VALUES (39, '000000', 1, 'å·²æ¤é', 'cancel', 'wf_business_status', '', 'danger', 'N', 103, 1, now(), NULL, NULL, 'å·²æ¤é'); |
| | | INSERT INTO sys_dict_data VALUES (40, '000000', 2, 'è稿', 'draft', 'wf_business_status', '', 'info', 'N', 103, 1, now(), NULL, NULL, 'è稿'); |
| | | INSERT INTO sys_dict_data VALUES (41, '000000', 3, 'å¾
å®¡æ ¸', 'waiting', 'wf_business_status', '', 'primary', 'N', 103, 1, now(), NULL, NULL, 'å¾
å®¡æ ¸'); |
| | | INSERT INTO sys_dict_data VALUES (42, '000000', 4, '已宿', 'finish', 'wf_business_status', '', 'success', 'N', 103, 1, now(), NULL, NULL, '已宿'); |
| | | INSERT INTO sys_dict_data VALUES (43, '000000', 5, 'å·²ä½åº', 'invalid', 'wf_business_status', '', 'danger', 'N', 103, 1, now(), NULL, NULL, 'å·²ä½åº'); |
| | | INSERT INTO sys_dict_data VALUES (44, '000000', 6, 'å·²éå', 'back', 'wf_business_status', '', 'danger', 'N', 103, 1, now(), NULL, NULL, 'å·²éå'); |
| | | INSERT INTO sys_dict_data VALUES (45, '000000', 7, 'å·²ç»æ¢', 'termination', 'wf_business_status', '', 'danger', 'N', 103, 1, now(), NULL, NULL, 'å·²ç»æ¢'); |
| | | INSERT INTO sys_dict_data VALUES (46, '000000', 1, 'èªå®ä¹è¡¨å', 'static', 'wf_form_type', '', 'success', 'N', 103, 1, now(), NULL, NULL, 'èªå®ä¹è¡¨å'); |
| | | INSERT INTO sys_dict_data VALUES (47, '000000', 2, 'å¨æè¡¨å', 'dynamic', 'wf_form_type', '', 'primary', 'N', 103, 1, now(), NULL, NULL, 'å¨æè¡¨å'); |
| | | INSERT INTO sys_dict_data VALUES (48, '000000', 1, 'æ¤é', 'cancel', 'wf_task_status', '', 'danger', 'N', 103, 1, now(), NULL, NULL, 'æ¤é'); |
| | | INSERT INTO sys_dict_data VALUES (49, '000000', 2, 'éè¿', 'pass', 'wf_task_status', '', 'success', 'N', 103, 1, now(), NULL, NULL, 'éè¿'); |
| | | INSERT INTO sys_dict_data VALUES (50, '000000', 3, 'å¾
å®¡æ ¸', 'waiting', 'wf_task_status', '', 'primary', 'N', 103, 1, now(), NULL, NULL, 'å¾
å®¡æ ¸'); |
| | | INSERT INTO sys_dict_data VALUES (51, '000000', 4, 'ä½åº', 'invalid', 'wf_task_status', '', 'danger', 'N', 103, 1, now(), NULL, NULL, 'ä½åº'); |
| | | INSERT INTO sys_dict_data VALUES (52, '000000', 5, 'éå', 'back', 'wf_task_status', '', 'danger', 'N', 103, 1, now(), NULL, NULL, 'éå'); |
| | | INSERT INTO sys_dict_data VALUES (53, '000000', 6, 'ç»æ¢', 'termination', 'wf_task_status', '', 'danger', 'N', 103, 1, now(), NULL, NULL, 'ç»æ¢'); |
| | | INSERT INTO sys_dict_data VALUES (54, '000000', 7, '转å', 'transfer', 'wf_task_status', '', 'primary', 'N', 103, 1, now(), NULL, NULL, '转å'); |
| | | INSERT INTO sys_dict_data VALUES (55, '000000', 8, 'å§æ', 'depute', 'wf_task_status', '', 'primary', 'N', 103, 1, now(), NULL, NULL, 'å§æ'); |
| | | INSERT INTO sys_dict_data VALUES (56, '000000', 9, 'æé', 'copy', 'wf_task_status', '', 'primary', 'N', 103, 1, now(), NULL, NULL, 'æé'); |
| | | INSERT INTO sys_dict_data VALUES (57, '000000', 10, 'å ç¾', 'sign', 'wf_task_status', '', 'primary', 'N', 103, 1, now(), NULL, NULL, 'å ç¾'); |
| | | INSERT INTO sys_dict_data VALUES (58, '000000', 11, 'åç¾', 'sign_off', 'wf_task_status', '', 'danger', 'N', 103, 1, now(), NULL, NULL, 'åç¾'); |
| | | INSERT INTO sys_dict_data VALUES (59, '000000', 11, 'è¶
æ¶', 'timeout', 'wf_task_status', '', 'danger', 'N', 103, 1, now(), NULL, NULL, 'è¶
æ¶'); |
| | | |
ÎļþÃû´Ó script/sql/snail_job.sql ÐÞ¸Ä |
| | |
| | | DEFAULT CHARSET = utf8mb4 COMMENT ='ç»é
ç½®'; |
| | | |
| | | INSERT INTO `sj_group_config` VALUES (1, 'dev', 'ruoyi_group', '', 'SJ_cKqBTPzCsWA3VyuCfFoccmuIEGXjr5KT', 1, 1, 0, 1, 1, 4, now(), now()); |
| | | INSERT INTO `sj_group_config` VALUES (2, 'prod', 'ruoyi_group', '', 'SJ_cKqBTPzCsWA3VyuCfFoccmuIEGXjr5KT', 1, 1, 0, 1, 1, 4, now(), now()); |
| | | |
| | | CREATE TABLE `sj_notify_config` |
| | | ( |
| | | `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主é®', |
| | | `namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT 'å½å空é´id', |
| | | `group_name` varchar(64) NOT NULL COMMENT 'ç»åç§°', |
| | | `business_id` varchar(64) NOT NULL COMMENT 'ä¸å¡id (job_idæworkflow_idæscene_name)', |
| | | `notify_name` varchar(64) NOT NULL DEFAULT '' COMMENT 'éç¥åç§°', |
| | | `system_task_type` tinyint(4) NOT NULL DEFAULT 3 COMMENT 'ä»»å¡ç±»å 1. éè¯ä»»å¡ 2. éè¯åè° 3ãJOBä»»å¡ 4ãWORKFLOWä»»å¡', |
| | | `notify_status` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'éç¥ç¶æ 0ãæªå¯ç¨ 1ãå¯ç¨', |
| | | `recipient_ids` varchar(128) NOT NULL COMMENT 'æ¥æ¶äººidå表', |
| | |
| | | `create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'å建æ¶é´', |
| | | `update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'ä¿®æ¹æ¶é´', |
| | | PRIMARY KEY (`id`), |
| | | KEY `idx_namespace_id_group_name_scene_name` (`namespace_id`, `group_name`, `business_id`) |
| | | KEY `idx_namespace_id_group_name_scene_name` (`namespace_id`, `group_name`) |
| | | ) ENGINE = InnoDB |
| | | AUTO_INCREMENT = 0 |
| | | DEFAULT CHARSET = utf8mb4 COMMENT ='éç¥é
ç½®'; |
| | |
| | | `max_retry_count` int(11) NOT NULL DEFAULT 5 COMMENT 'æå¤§éè¯æ¬¡æ°', |
| | | `back_off` tinyint(4) NOT NULL DEFAULT 1 COMMENT '1ãé»è®¤ç级 2ãåºå®é´éæ¶é´ 3ãCRON 表达å¼', |
| | | `trigger_interval` varchar(16) NOT NULL DEFAULT '' COMMENT 'é´éæ¶é¿', |
| | | `notify_ids` varchar(128) NOT NULL DEFAULT '' COMMENT 'éç¥åè¦åºæ¯é
ç½®idå表', |
| | | `deadline_request` bigint(20) unsigned NOT NULL DEFAULT 60000 COMMENT 'Deadline Request è°ç¨é¾è¶
æ¶ å使¯«ç§', |
| | | `executor_timeout` int(11) unsigned NOT NULL DEFAULT 5 COMMENT '任塿§è¡è¶
æ¶æ¶é´ï¼åä½ç§', |
| | | `route_key` tinyint(4) NOT NULL DEFAULT 4 COMMENT 'è·¯ç±çç¥', |
| | |
| | | `retry_interval` int(11) NOT NULL DEFAULT 0 COMMENT 'éè¯é´é(s)', |
| | | `bucket_index` int(11) NOT NULL DEFAULT 0 COMMENT 'bucket', |
| | | `resident` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'æ¯å¦æ¯å¸¸é©»ä»»å¡', |
| | | `notify_ids` varchar(128) NOT NULL DEFAULT '' COMMENT 'éç¥åè¦åºæ¯é
ç½®idå表', |
| | | `owner_id` bigint(20) NULL COMMENT 'è´è´£äººid', |
| | | `description` varchar(256) NOT NULL DEFAULT '' COMMENT 'æè¿°', |
| | | `ext_attrs` varchar(256) NULL DEFAULT '' COMMENT 'æ©å±å段', |
| | | `deleted` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'é»è¾å é¤ 1ãå é¤', |
| | |
| | | AUTO_INCREMENT = 0 |
| | | DEFAULT CHARSET = utf8mb4 COMMENT ='ä»»å¡ä¿¡æ¯'; |
| | | |
| | | INSERT INTO `sj_job` VALUES (1, 'dev', 'ruoyi_group', 'demo-job', null, 1, 1710344035622, 1, 1, 4, 1, 'testJobExecutor', 2, '60', 1, 60, 3, 1, 1, 116, 0, '', '', 0 , now(), now()); |
| | | INSERT INTO `sj_job` VALUES (1, 'dev', 'ruoyi_group', 'demo-job', null, 1, 1710344035622, 1, 1, 4, 1, 'testJobExecutor', 2, '60', 1, 60, 3, 1, 1, 116, 0, '', 1, '', '', 0 , now(), now()); |
| | | |
| | | CREATE TABLE `sj_job_log_message` |
| | | ( |
| | |
| | | `description` varchar(256) NOT NULL DEFAULT '' COMMENT 'æè¿°', |
| | | `flow_info` text DEFAULT NULL COMMENT 'æµç¨ä¿¡æ¯', |
| | | `wf_context` text DEFAULT NULL COMMENT 'ä¸ä¸æ', |
| | | `notify_ids` varchar(128) NOT NULL DEFAULT '' COMMENT 'éç¥åè¦åºæ¯é
ç½®idå表', |
| | | `bucket_index` int(11) NOT NULL DEFAULT 0 COMMENT 'bucket', |
| | | `version` int(11) NOT NULL COMMENT 'çæ¬å·', |
| | | `ext_attrs` varchar(256) NULL DEFAULT '' COMMENT 'æ©å±å段', |
| | |
| | | ( |
| | | id bigint not null comment '主é®', |
| | | user_id bigint not null comment 'ç¨æ·ID', |
| | | tenant_id varchar(20) default null comment 'ç§æ·id', |
| | | tenant_id varchar(20) default '000000' comment 'ç§æ·id', |
| | | auth_id varchar(255) not null comment 'å¹³å°+å¹³å°å¯ä¸id', |
| | | source varchar(255) not null comment 'ç¨æ·æ¥æº', |
| | | open_id varchar(255) default null comment 'å¹³å°ç¼å·å¯ä¸id', |
| | |
| | | create_time datetime comment 'å建æ¶é´', |
| | | update_by bigint(20) comment 'æ´æ°è
', |
| | | update_time datetime comment 'æ´æ°æ¶é´', |
| | | del_flag char(1) default '0' comment 'å 餿 å¿ï¼0代表åå¨ 2代表å é¤ï¼', |
| | | del_flag char(1) default '0' comment 'å 餿 å¿ï¼0代表åå¨ 1代表å é¤ï¼', |
| | | PRIMARY KEY (id) |
| | | ) engine=innodb comment = '社ä¼åå
³ç³»è¡¨'; |
| | | |
| | |
| | | expire_time datetime comment 'è¿ææ¶é´', |
| | | account_count int default -1 comment 'ç¨æ·æ°éï¼-1ä¸éå¶ï¼', |
| | | status char(1) default '0' comment 'ç§æ·ç¶æï¼0æ£å¸¸ 1åç¨ï¼', |
| | | del_flag char(1) default '0' comment 'å 餿 å¿ï¼0代表åå¨ 2代表å é¤ï¼', |
| | | del_flag char(1) default '0' comment 'å 餿 å¿ï¼0代表åå¨ 1代表å é¤ï¼', |
| | | create_dept bigint(20) comment 'å建é¨é¨', |
| | | create_by bigint(20) comment 'å建è
', |
| | | create_time datetime comment 'å建æ¶é´', |
| | |
| | | remark varchar(200) comment '夿³¨', |
| | | menu_check_strictly tinyint(1) default 1 comment 'èåæ éæ©é¡¹æ¯å¦å
³èæ¾ç¤º', |
| | | status char(1) default '0' comment 'ç¶æï¼0æ£å¸¸ 1åç¨ï¼', |
| | | del_flag char(1) default '0' comment 'å 餿 å¿ï¼0代表åå¨ 2代表å é¤ï¼', |
| | | del_flag char(1) default '0' comment 'å 餿 å¿ï¼0代表åå¨ 1代表å é¤ï¼', |
| | | create_dept bigint(20) comment 'å建é¨é¨', |
| | | create_by bigint(20) comment 'å建è
', |
| | | create_time datetime comment 'å建æ¶é´', |
| | |
| | | phone varchar(11) default null comment 'èç³»çµè¯', |
| | | email varchar(50) default null comment 'é®ç®±', |
| | | status char(1) default '0' comment 'é¨é¨ç¶æï¼0æ£å¸¸ 1åç¨ï¼', |
| | | del_flag char(1) default '0' comment 'å 餿 å¿ï¼0代表åå¨ 2代表å é¤ï¼', |
| | | del_flag char(1) default '0' comment 'å 餿 å¿ï¼0代表åå¨ 1代表å é¤ï¼', |
| | | create_dept bigint(20) default null comment 'å建é¨é¨', |
| | | create_by bigint(20) default null comment 'å建è
', |
| | | create_time datetime comment 'å建æ¶é´', |
| | |
| | | avatar bigint(20) comment '头åå°å', |
| | | password varchar(100) default '' comment 'å¯ç ', |
| | | status char(1) default '0' comment 'å¸å·ç¶æï¼0æ£å¸¸ 1åç¨ï¼', |
| | | del_flag char(1) default '0' comment 'å 餿 å¿ï¼0代表åå¨ 2代表å é¤ï¼', |
| | | del_flag char(1) default '0' comment 'å 餿 å¿ï¼0代表åå¨ 1代表å é¤ï¼', |
| | | login_ip varchar(128) default '' comment 'æåç»å½IP', |
| | | login_date datetime comment 'æåç»å½æ¶é´', |
| | | create_dept bigint(20) default null comment 'å建é¨é¨', |
| | |
| | | menu_check_strictly tinyint(1) default 1 comment 'èåæ éæ©é¡¹æ¯å¦å
³èæ¾ç¤º', |
| | | dept_check_strictly tinyint(1) default 1 comment 'é¨é¨æ 鿩项æ¯å¦å
³èæ¾ç¤º', |
| | | status char(1) not null comment 'è§è²ç¶æï¼0æ£å¸¸ 1åç¨ï¼', |
| | | del_flag char(1) default '0' comment 'å 餿 å¿ï¼0代表åå¨ 2代表å é¤ï¼', |
| | | del_flag char(1) default '0' comment 'å 餿 å¿ï¼0代表åå¨ 1代表å é¤ï¼', |
| | | create_dept bigint(20) default null comment 'å建é¨é¨', |
| | | create_by bigint(20) default null comment 'å建è
', |
| | | create_time datetime comment 'å建æ¶é´', |
| | |
| | | insert into sys_role_menu values ('3', '106'); |
| | | insert into sys_role_menu values ('3', '107'); |
| | | insert into sys_role_menu values ('3', '108'); |
| | | insert into sys_role_menu values ('3', '118'); |
| | | insert into sys_role_menu values ('3', '123'); |
| | | insert into sys_role_menu values ('3', '500'); |
| | | insert into sys_role_menu values ('3', '501'); |
| | | insert into sys_role_menu values ('3', '1001'); |
| | |
| | | insert into sys_role_menu values ('3', '1043'); |
| | | insert into sys_role_menu values ('3', '1044'); |
| | | insert into sys_role_menu values ('3', '1045'); |
| | | insert into sys_role_menu values ('3', '1050'); |
| | | insert into sys_role_menu values ('3', '1061'); |
| | | insert into sys_role_menu values ('3', '1062'); |
| | | insert into sys_role_menu values ('3', '1063'); |
| | | insert into sys_role_menu values ('3', '1064'); |
| | | insert into sys_role_menu values ('3', '1065'); |
| | | insert into sys_role_menu values ('3', '1500'); |
| | | insert into sys_role_menu values ('3', '1501'); |
| | | insert into sys_role_menu values ('3', '1502'); |
| | |
| | | insert into sys_role_menu values ('3', '1509'); |
| | | insert into sys_role_menu values ('3', '1510'); |
| | | insert into sys_role_menu values ('3', '1511'); |
| | | insert into sys_role_menu values ('3', '1600'); |
| | | insert into sys_role_menu values ('3', '1601'); |
| | | insert into sys_role_menu values ('3', '1602'); |
| | | insert into sys_role_menu values ('3', '1603'); |
| | | insert into sys_role_menu values ('3', '1620'); |
| | | insert into sys_role_menu values ('3', '1621'); |
| | | insert into sys_role_menu values ('3', '1622'); |
| | | insert into sys_role_menu values ('3', '1623'); |
| | | insert into sys_role_menu values ('3', '11618'); |
| | | insert into sys_role_menu values ('3', '11619'); |
| | | insert into sys_role_menu values ('3', '11629'); |
| | | insert into sys_role_menu values ('3', '11632'); |
| | | insert into sys_role_menu values ('3', '11633'); |
| | | insert into sys_role_menu values ('3', '11638'); |
| | | insert into sys_role_menu values ('3', '11639'); |
| | | insert into sys_role_menu values ('3', '11640'); |
| | | insert into sys_role_menu values ('3', '11641'); |
| | | insert into sys_role_menu values ('3', '11642'); |
| | | insert into sys_role_menu values ('3', '11643'); |
| | | insert into sys_role_menu values ('4', '5'); |
| | | insert into sys_role_menu values ('4', '1500'); |
| | | insert into sys_role_menu values ('4', '1501'); |
| | |
| | | oper_url varchar(255) default '' comment '请æ±URL', |
| | | oper_ip varchar(128) default '' comment '主æºå°å', |
| | | oper_location varchar(255) default '' comment 'æä½å°ç¹', |
| | | oper_param varchar(2000) default '' comment '请æ±åæ°', |
| | | json_result varchar(2000) default '' comment 'è¿ååæ°', |
| | | oper_param varchar(4000) default '' comment '请æ±åæ°', |
| | | json_result varchar(4000) default '' comment 'è¿ååæ°', |
| | | status int(1) default 0 comment 'æä½ç¶æï¼0æ£å¸¸ 1å¼å¸¸ï¼', |
| | | error_msg varchar(2000) default '' comment 'éè¯¯æ¶æ¯', |
| | | error_msg varchar(4000) default '' comment 'éè¯¯æ¶æ¯', |
| | | oper_time datetime comment 'æä½æ¶é´', |
| | | cost_time bigint(20) default 0 comment 'æ¶èæ¶é´', |
| | | primary key (oper_id), |
| | |
| | | insert into sys_oss_config values (1, '000000', 'minio', 'ruoyi', 'ruoyi123', 'ruoyi', '', '127.0.0.1:9000', '','N', '', '1' ,'0', '', 103, 1, sysdate(), 1, sysdate(), null); |
| | | insert into sys_oss_config values (2, '000000', 'qiniu', 'XXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXX', 'ruoyi', '', 's3-cn-north-1.qiniucs.com', '','N', '', '1' ,'1', '', 103, 1, sysdate(), 1, sysdate(), null); |
| | | insert into sys_oss_config values (3, '000000', 'aliyun', 'XXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXX', 'ruoyi', '', 'oss-cn-beijing.aliyuncs.com', '','N', '', '1' ,'1', '', 103, 1, sysdate(), 1, sysdate(), null); |
| | | insert into sys_oss_config values (4, '000000', 'qcloud', 'XXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXX', 'ruoyi-1250000000', '', 'cos.ap-beijing.myqcloud.com', '','N', 'ap-beijing', '1' ,'1', '', 103, 1, sysdate(), 1, sysdate(), null); |
| | | insert into sys_oss_config values (4, '000000', 'qcloud', 'XXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXX', 'ruoyi-1240000000', '', 'cos.ap-beijing.myqcloud.com', '','N', 'ap-beijing', '1' ,'1', '', 103, 1, sysdate(), 1, sysdate(), null); |
| | | insert into sys_oss_config values (5, '000000', 'image', 'ruoyi', 'ruoyi123', 'ruoyi', 'image', '127.0.0.1:9000', '','N', '', '1' ,'1', '', 103, 1, sysdate(), 1, sysdate(), null); |
| | | |
| | | -- ---------------------------- |
| | |
| | | active_timeout int(11) default 1800 comment 'tokenæ´»è·è¶
æ¶æ¶é´', |
| | | timeout int(11) default 604800 comment 'tokenåºå®è¶
æ¶', |
| | | status char(1) default '0' comment 'ç¶æï¼0æ£å¸¸ 1åç¨ï¼', |
| | | del_flag char(1) default '0' comment 'å 餿 å¿ï¼0代表åå¨ 2代表å é¤ï¼', |
| | | del_flag char(1) default '0' comment 'å 餿 å¿ï¼0代表åå¨ 1代表å é¤ï¼', |
| | | create_dept bigint(20) default null comment 'å建é¨é¨', |
| | | create_by bigint(20) default null comment 'å建è
', |
| | | create_time datetime default null comment 'å建æ¶é´', |
¶Ô±ÈÐÂÎļþ |
| | |
| | | -- ---------------------------- |
| | | -- 0ãwarm-flow-all.sqlï¼å°åï¼https://gitee.com/dromara/warm-flow/blob/master/sql/mysql/warm-flow-all.sql |
| | | -- ---------------------------- |
| | | CREATE TABLE `flow_definition` |
| | | ( |
| | | `id` bigint unsigned NOT NULL COMMENT '主é®id', |
| | | `flow_code` varchar(40) NOT NULL COMMENT 'æµç¨ç¼ç ', |
| | | `flow_name` varchar(100) NOT NULL COMMENT 'æµç¨åç§°', |
| | | `category` varchar(100) DEFAULT NULL COMMENT 'æµç¨ç±»å«', |
| | | `version` varchar(20) NOT NULL COMMENT 'æµç¨çæ¬', |
| | | `is_publish` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'æ¯å¦åå¸ï¼0æªåå¸ 1å·²åå¸ 9失æï¼', |
| | | `form_custom` char(1) DEFAULT 'N' COMMENT '审æ¹è¡¨åæ¯å¦èªå®ä¹ï¼Yæ¯ Nå¦ï¼', |
| | | `form_path` varchar(100) DEFAULT NULL COMMENT '审æ¹è¡¨åè·¯å¾', |
| | | `activity_status` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'æµç¨æ¿æ´»ç¶æï¼0æèµ· 1æ¿æ´»ï¼', |
| | | `listener_type` varchar(100) DEFAULT NULL COMMENT 'çå¬å¨ç±»å', |
| | | `listener_path` varchar(400) DEFAULT NULL COMMENT 'çå¬å¨è·¯å¾', |
| | | `ext` varchar(500) DEFAULT NULL COMMENT 'ä¸å¡è¯¦æ
åä¸å¡è¡¨å¯¹è±¡jsonå符串', |
| | | `create_time` datetime DEFAULT NULL COMMENT 'å建æ¶é´', |
| | | `update_time` datetime DEFAULT NULL COMMENT 'æ´æ°æ¶é´', |
| | | `del_flag` char(1) DEFAULT '0' COMMENT 'å 餿 å¿', |
| | | `tenant_id` varchar(40) DEFAULT NULL COMMENT 'ç§æ·id', |
| | | PRIMARY KEY (`id`) USING BTREE |
| | | ) ENGINE = InnoDB COMMENT ='æµç¨å®ä¹è¡¨'; |
| | | |
| | | CREATE TABLE `flow_node` |
| | | ( |
| | | `id` bigint unsigned NOT NULL COMMENT '主é®id', |
| | | `node_type` tinyint(1) NOT NULL COMMENT 'èç¹ç±»åï¼0å¼å§èç¹ 1ä¸é´èç¹ 2ç»æèç¹ 3äºæ¥ç½å
³ 4å¹¶è¡ç½å
³ï¼', |
| | | `definition_id` bigint NOT NULL COMMENT 'æµç¨å®ä¹id', |
| | | `node_code` varchar(100) NOT NULL COMMENT 'æµç¨èç¹ç¼ç ', |
| | | `node_name` varchar(100) DEFAULT NULL COMMENT 'æµç¨èç¹åç§°', |
| | | `permission_flag` varchar(200) DEFAULT NULL COMMENT 'æéæ è¯ï¼æéç±»å:æéæ è¯ï¼å¯ä»¥å¤ä¸ªï¼ç¨éå·éå¼)', |
| | | `node_ratio` decimal(6, 3) DEFAULT NULL COMMENT 'æµç¨ç¾ç½²æ¯ä¾å¼', |
| | | `coordinate` varchar(100) DEFAULT NULL COMMENT 'åæ ', |
| | | `skip_any_node` varchar(100) DEFAULT 'N' COMMENT 'æ¯å¦å¯ä»¥éåä»»æèç¹ï¼Yæ¯ Nå¦ï¼å³å°å é¤', |
| | | `any_node_skip` varchar(100) DEFAULT NULL COMMENT 'ä»»æç»ç¹è·³è½¬', |
| | | `listener_type` varchar(100) DEFAULT NULL COMMENT 'çå¬å¨ç±»å', |
| | | `listener_path` varchar(400) DEFAULT NULL COMMENT 'çå¬å¨è·¯å¾', |
| | | `handler_type` varchar(100) DEFAULT NULL COMMENT 'å¤çå¨ç±»å', |
| | | `handler_path` varchar(400) DEFAULT NULL COMMENT 'å¤çå¨è·¯å¾', |
| | | `form_custom` char(1) DEFAULT 'N' COMMENT '审æ¹è¡¨åæ¯å¦èªå®ä¹ï¼Yæ¯ Nå¦ï¼', |
| | | `form_path` varchar(100) DEFAULT NULL COMMENT '审æ¹è¡¨åè·¯å¾', |
| | | `version` varchar(20) NOT NULL COMMENT 'çæ¬', |
| | | `create_time` datetime DEFAULT NULL COMMENT 'å建æ¶é´', |
| | | `update_time` datetime DEFAULT NULL COMMENT 'æ´æ°æ¶é´', |
| | | `del_flag` char(1) DEFAULT '0' COMMENT 'å 餿 å¿', |
| | | `tenant_id` varchar(40) DEFAULT NULL COMMENT 'ç§æ·id', |
| | | PRIMARY KEY (`id`) USING BTREE |
| | | ) ENGINE = InnoDB COMMENT ='æµç¨èç¹è¡¨'; |
| | | |
| | | CREATE TABLE `flow_skip` |
| | | ( |
| | | `id` bigint unsigned NOT NULL COMMENT '主é®id', |
| | | `definition_id` bigint NOT NULL COMMENT 'æµç¨å®ä¹id', |
| | | `now_node_code` varchar(100) NOT NULL COMMENT 'å½åæµç¨èç¹çç¼ç ', |
| | | `now_node_type` tinyint(1) DEFAULT NULL COMMENT 'å½åèç¹ç±»åï¼0å¼å§èç¹ 1ä¸é´èç¹ 2ç»æèç¹ 3äºæ¥ç½å
³ 4å¹¶è¡ç½å
³ï¼', |
| | | `next_node_code` varchar(100) NOT NULL COMMENT 'ä¸ä¸ä¸ªæµç¨èç¹çç¼ç ', |
| | | `next_node_type` tinyint(1) DEFAULT NULL COMMENT 'ä¸ä¸ä¸ªèç¹ç±»åï¼0å¼å§èç¹ 1ä¸é´èç¹ 2ç»æèç¹ 3äºæ¥ç½å
³ 4å¹¶è¡ç½å
³ï¼', |
| | | `skip_name` varchar(100) DEFAULT NULL COMMENT '跳转åç§°', |
| | | `skip_type` varchar(40) DEFAULT NULL COMMENT '跳转类åï¼PASS审æ¹éè¿ REJECTéåï¼', |
| | | `skip_condition` varchar(200) DEFAULT NULL COMMENT '跳转æ¡ä»¶', |
| | | `coordinate` varchar(100) DEFAULT NULL COMMENT 'åæ ', |
| | | `create_time` datetime DEFAULT NULL COMMENT 'å建æ¶é´', |
| | | `update_time` datetime DEFAULT NULL COMMENT 'æ´æ°æ¶é´', |
| | | `del_flag` char(1) DEFAULT '0' COMMENT 'å 餿 å¿', |
| | | `tenant_id` varchar(40) DEFAULT NULL COMMENT 'ç§æ·id', |
| | | PRIMARY KEY (`id`) USING BTREE |
| | | ) ENGINE = InnoDB COMMENT ='èç¹è·³è½¬å
³è表'; |
| | | |
| | | CREATE TABLE `flow_instance` |
| | | ( |
| | | `id` bigint NOT NULL COMMENT '主é®id', |
| | | `definition_id` bigint NOT NULL COMMENT '对åºflow_definition表çid', |
| | | `business_id` varchar(40) NOT NULL COMMENT 'ä¸å¡id', |
| | | `node_type` tinyint(1) NOT NULL COMMENT 'èç¹ç±»åï¼0å¼å§èç¹ 1ä¸é´èç¹ 2ç»æèç¹ 3äºæ¥ç½å
³ 4å¹¶è¡ç½å
³ï¼', |
| | | `node_code` varchar(40) NOT NULL COMMENT 'æµç¨èç¹ç¼ç ', |
| | | `node_name` varchar(100) DEFAULT NULL COMMENT 'æµç¨èç¹åç§°', |
| | | `variable` text COMMENT 'ä»»å¡åé', |
| | | `flow_status` varchar(20) NOT NULL COMMENT 'æµç¨ç¶æï¼0å¾
æäº¤ 1审æ¹ä¸ 2 审æ¹éè¿ 3èªå¨éè¿ 4ç»æ¢ 5ä½åº 6æ¤é 7åå 8已宿 9å·²éå 10失æï¼', |
| | | `activity_status` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'æµç¨æ¿æ´»ç¶æï¼0æèµ· 1æ¿æ´»ï¼', |
| | | `def_json` text COMMENT 'æµç¨å®ä¹json', |
| | | `create_by` varchar(64) DEFAULT '' COMMENT 'å建è
', |
| | | `create_time` datetime DEFAULT NULL COMMENT 'å建æ¶é´', |
| | | `update_time` datetime DEFAULT NULL COMMENT 'æ´æ°æ¶é´', |
| | | `ext` varchar(500) DEFAULT NULL COMMENT 'æ©å±å段ï¼é¢çç»ä¸å¡ç³»ç»ä½¿ç¨', |
| | | `del_flag` char(1) DEFAULT '0' COMMENT 'å 餿 å¿', |
| | | `tenant_id` varchar(40) DEFAULT NULL COMMENT 'ç§æ·id', |
| | | PRIMARY KEY (`id`) USING BTREE |
| | | ) ENGINE = InnoDB COMMENT ='æµç¨å®ä¾è¡¨'; |
| | | |
| | | CREATE TABLE `flow_task` |
| | | ( |
| | | `id` bigint NOT NULL COMMENT '主é®id', |
| | | `definition_id` bigint NOT NULL COMMENT '对åºflow_definition表çid', |
| | | `instance_id` bigint NOT NULL COMMENT '对åºflow_instance表çid', |
| | | `node_code` varchar(100) NOT NULL COMMENT 'èç¹ç¼ç ', |
| | | `node_name` varchar(100) DEFAULT NULL COMMENT 'èç¹åç§°', |
| | | `node_type` tinyint(1) NOT NULL COMMENT 'èç¹ç±»åï¼0å¼å§èç¹ 1ä¸é´èç¹ 2ç»æèç¹ 3äºæ¥ç½å
³ 4å¹¶è¡ç½å
³ï¼', |
| | | `form_custom` char(1) DEFAULT 'N' COMMENT '审æ¹è¡¨åæ¯å¦èªå®ä¹ï¼Yæ¯ Nå¦ï¼', |
| | | `form_path` varchar(100) DEFAULT NULL COMMENT '审æ¹è¡¨åè·¯å¾', |
| | | `create_time` datetime DEFAULT NULL COMMENT 'å建æ¶é´', |
| | | `update_time` datetime DEFAULT NULL COMMENT 'æ´æ°æ¶é´', |
| | | `del_flag` char(1) DEFAULT '0' COMMENT 'å 餿 å¿', |
| | | `tenant_id` varchar(40) DEFAULT NULL COMMENT 'ç§æ·id', |
| | | PRIMARY KEY (`id`) USING BTREE |
| | | ) ENGINE = InnoDB COMMENT ='å¾
åä»»å¡è¡¨'; |
| | | |
| | | CREATE TABLE `flow_his_task` |
| | | ( |
| | | `id` bigint(20) unsigned NOT NULL COMMENT '主é®id', |
| | | `definition_id` bigint(20) NOT NULL COMMENT '对åºflow_definition表çid', |
| | | `instance_id` bigint(20) NOT NULL COMMENT '对åºflow_instance表çid', |
| | | `task_id` bigint(20) NOT NULL COMMENT '对åºflow_task表çid', |
| | | `node_code` varchar(100) DEFAULT NULL COMMENT 'å¼å§èç¹ç¼ç ', |
| | | `node_name` varchar(100) DEFAULT NULL COMMENT 'å¼å§èç¹åç§°', |
| | | `node_type` tinyint(1) DEFAULT NULL COMMENT 'å¼å§èç¹ç±»åï¼0å¼å§èç¹ 1ä¸é´èç¹ 2ç»æèç¹ 3äºæ¥ç½å
³ 4å¹¶è¡ç½å
³ï¼', |
| | | `target_node_code` varchar(200) DEFAULT NULL COMMENT 'ç®æ èç¹ç¼ç ', |
| | | `target_node_name` varchar(200) DEFAULT NULL COMMENT 'ç»æèç¹åç§°', |
| | | `approver` varchar(40) DEFAULT NULL COMMENT '审æ¹è
', |
| | | `cooperate_type` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'å使¹å¼(1å®¡æ¹ 2转å 3å§æ´¾ 4ä¼ç¾ 5ç¥¨ç¾ 6å ç¾ 7åç¾)', |
| | | `collaborator` varchar(40) DEFAULT NULL COMMENT 'åä½äºº', |
| | | `skip_type` varchar(10) NOT NULL COMMENT 'æµè½¬ç±»åï¼PASSéè¿ REJECTéå NONEæ å¨ä½ï¼', |
| | | `flow_status` varchar(20) NOT NULL COMMENT 'æµç¨ç¶æï¼1审æ¹ä¸ 2 审æ¹éè¿ 9å·²éå 10失æï¼', |
| | | `form_custom` char(1) DEFAULT 'N' COMMENT '审æ¹è¡¨åæ¯å¦èªå®ä¹ï¼Yæ¯ Nå¦ï¼', |
| | | `form_path` varchar(100) DEFAULT NULL COMMENT '审æ¹è¡¨åè·¯å¾', |
| | | `message` varchar(500) DEFAULT NULL COMMENT 'å®¡æ¹æè§', |
| | | `variable` TEXT DEFAULT NULL COMMENT 'ä»»å¡åé', |
| | | `ext` varchar(500) DEFAULT NULL COMMENT 'ä¸å¡è¯¦æ
åä¸å¡è¡¨å¯¹è±¡jsonå符串', |
| | | `create_time` datetime DEFAULT NULL COMMENT 'ä»»å¡å¼å§æ¶é´', |
| | | `update_time` datetime DEFAULT NULL COMMENT '审æ¹å®ææ¶é´', |
| | | `del_flag` char(1) DEFAULT '0' COMMENT 'å 餿 å¿', |
| | | `tenant_id` varchar(40) DEFAULT NULL COMMENT 'ç§æ·id', |
| | | PRIMARY KEY (`id`) USING BTREE |
| | | ) ENGINE = InnoDB COMMENT ='åå²ä»»å¡è®°å½è¡¨'; |
| | | |
| | | |
| | | CREATE TABLE `flow_user` |
| | | ( |
| | | `id` bigint unsigned NOT NULL COMMENT '主é®id', |
| | | `type` char(1) NOT NULL COMMENT '人åç±»åï¼1å¾
åä»»å¡ç审æ¹äººæé 2å¾
åä»»å¡ç转å人æé 3å¾
åä»»å¡çå§æäººæéï¼', |
| | | `processed_by` varchar(80) DEFAULT NULL COMMENT 'æé人', |
| | | `associated` bigint NOT NULL COMMENT 'ä»»å¡è¡¨id', |
| | | `create_time` datetime DEFAULT NULL COMMENT 'å建æ¶é´', |
| | | `create_by` varchar(80) DEFAULT NULL COMMENT 'å建人', |
| | | `update_time` datetime DEFAULT NULL COMMENT 'æ´æ°æ¶é´', |
| | | `del_flag` char(1) DEFAULT '0' COMMENT 'å 餿 å¿', |
| | | `tenant_id` varchar(40) DEFAULT NULL COMMENT 'ç§æ·id', |
| | | PRIMARY KEY (`id`) USING BTREE, |
| | | KEY `user_processed_type` (`processed_by`, `type`) |
| | | ) ENGINE = InnoDB COMMENT ='æµç¨ç¨æ·è¡¨'; |
| | | |
| | | -- ---------------------------- |
| | | -- æµç¨å类表 |
| | | -- ---------------------------- |
| | | create table flow_category |
| | | ( |
| | | category_id bigint(20) not null comment 'æµç¨åç±»ID', |
| | | tenant_id varchar(20) default '000000' comment 'ç§æ·ç¼å·', |
| | | parent_id bigint(20) default 0 comment 'ç¶æµç¨åç±»id', |
| | | ancestors varchar(500) default '' comment 'ç¥çº§å表', |
| | | category_name varchar(30) not null comment 'æµç¨åç±»åç§°', |
| | | order_num int(4) default 0 comment 'æ¾ç¤ºé¡ºåº', |
| | | del_flag char(1) default '0' comment 'å 餿 å¿ï¼0代表åå¨ 1代表å é¤ï¼', |
| | | create_dept bigint(20) null comment 'å建é¨é¨', |
| | | create_by bigint(20) null comment 'å建è
', |
| | | create_time datetime null comment 'å建æ¶é´', |
| | | update_by bigint(20) null comment 'æ´æ°è
', |
| | | update_time datetime null comment 'æ´æ°æ¶é´', |
| | | primary key (category_id) |
| | | ) engine = innodb comment = 'æµç¨åç±»'; |
| | | |
| | | INSERT INTO flow_category values (100, '000000', 0, '0', 'OA审æ¹', 0, '0', 103, 1, sysdate(), null, null); |
| | | INSERT INTO flow_category values (101, '000000', 100, '0,100', 'åå¤ç®¡ç', 0, '0', 103, 1, sysdate(), null, null); |
| | | INSERT INTO flow_category values (102, '000000', 100, '0,100', '人äºç®¡ç', 1, '0', 103, 1, sysdate(), null, null); |
| | | INSERT INTO flow_category values (103, '000000', 101, '0,100,101', '请å', 0, '0', 103, 1, sysdate(), null, null); |
| | | INSERT INTO flow_category values (104, '000000', 101, '0,100,101', 'åºå·®', 1, '0', 103, 1, sysdate(), null, null); |
| | | INSERT INTO flow_category values (105, '000000', 101, '0,100,101', 'å ç', 2, '0', 103, 1, sysdate(), null, null); |
| | | INSERT INTO flow_category values (106, '000000', 101, '0,100,101', 'æ¢ç', 3, '0', 103, 1, sysdate(), null, null); |
| | | INSERT INTO flow_category values (107, '000000', 101, '0,100,101', 'å¤åº', 4, '0', 103, 1, sysdate(), null, null); |
| | | INSERT INTO flow_category values (108, '000000', 102, '0,100,102', '转æ£', 1, '0', 103, 1, sysdate(), null, null); |
| | | INSERT INTO flow_category values (109, '000000', 102, '0,100,102', '离è', 2, '0', 103, 1, sysdate(), null, null); |
| | | |
| | | -- ---------------------------- |
| | | -- 请ååä¿¡æ¯ |
| | | -- ---------------------------- |
| | | create table test_leave |
| | | ( |
| | | id bigint(20) not null comment 'id', |
| | | tenant_id varchar(20) default '000000' comment 'ç§æ·ç¼å·', |
| | | leave_type varchar(255) not null comment '请åç±»å', |
| | | start_date datetime not null comment 'å¼å§æ¶é´', |
| | | end_date datetime not null comment 'ç»ææ¶é´', |
| | | leave_days int(10) not null comment '请å天æ°', |
| | | remark varchar(255) null comment '请ååå ', |
| | | status varchar(255) null comment 'ç¶æ', |
| | | create_dept bigint null comment 'å建é¨é¨', |
| | | create_by bigint null comment 'å建è
', |
| | | create_time datetime null comment 'å建æ¶é´', |
| | | update_by bigint null comment 'æ´æ°è
', |
| | | update_time datetime null comment 'æ´æ°æ¶é´', |
| | | PRIMARY KEY (id) USING BTREE |
| | | ) ENGINE = InnoDB COMMENT = '请åç³è¯·è¡¨'; |
| | | |
| | | insert into sys_menu values ('11616', '工使µ', '0', '6', 'workflow', '', '', '1', '0', 'M', '0', '0', '', 'workflow', 103, 1, sysdate(),NULL, NULL, ''); |
| | | insert into sys_menu values ('11618', 'æçä»»å¡', '0', '7', 'task', '', '', '1', '0', 'M', '0', '0', '', 'my-task', 103, 1, sysdate(), NULL, NULL, ''); |
| | | insert into sys_menu values ('11619', 'æçå¾
å', '11618', '2', 'taskWaiting', 'workflow/task/taskWaiting', '', '1', '1', 'C', '0', '0', '', 'waiting', 103, 1, sysdate(), NULL, NULL, ''); |
| | | insert into sys_menu values ('11632', 'æçå·²å', '11618', '3', 'taskFinish', 'workflow/task/taskFinish', '', '1', '1', 'C', '0', '0', '', 'finish', 103, 1, sysdate(), NULL, NULL, ''); |
| | | insert into sys_menu values ('11633', 'æçæé', '11618', '4', 'taskCopyList', 'workflow/task/taskCopyList', '', '1', '1', 'C', '0', '0', '', 'my-copy', 103, 1, sysdate(), NULL, NULL, ''); |
| | | insert into sys_menu values ('11620', 'æµç¨å®ä¹', '11616', '3', 'processDefinition', 'workflow/processDefinition/index', '', '1', '1', 'C', '0', '0', '', 'process-definition', 103, 1, sysdate(), NULL, NULL, ''); |
| | | insert into sys_menu values ('11621', 'æµç¨å®ä¾', '11630', '1', 'processInstance', 'workflow/processInstance/index', '', '1', '1', 'C', '0', '0', '', 'tree-table', 103, 1, sysdate(), NULL, NULL, ''); |
| | | insert into sys_menu values ('11622', 'æµç¨åç±»', '11616', '1', 'category', 'workflow/category/index', '', '1', '0', 'C', '0', '0', 'workflow:category:list', 'category', 103, 1, sysdate(), NULL, NULL, ''); |
| | | insert into sys_menu values ('11629', 'æåèµ·ç', '11618', '1', 'myDocument', 'workflow/task/myDocument', '', '1', '1', 'C', '0', '0', '', 'guide', 103, 1, sysdate(), NULL, NULL, ''); |
| | | insert into sys_menu values ('11630', 'æµç¨çæ§', '11616', '4', 'monitor', '', '', '1', '0', 'M', '0', '0', '', 'monitor', 103, 1, sysdate(), NULL, NULL, ''); |
| | | insert into sys_menu values ('11631', 'å¾
åä»»å¡', '11630', '2', 'allTaskWaiting', 'workflow/task/allTaskWaiting', '', '1', '1', 'C', '0', '0', '', 'waiting', 103, 1, sysdate(), NULL, NULL, ''); |
| | | -- æµç¨å类管çç¸å
³æé® |
| | | insert into sys_menu values ('11623', 'æµç¨åç±»æ¥è¯¢', '11622', '1', '#', '', '', 1, 0, 'F', '0', '0', 'workflow:category:query', '#', 103, 1,sysdate(), null, null, ''); |
| | | insert into sys_menu values ('11624', 'æµç¨åç±»æ°å¢', '11622', '2', '#', '', '', 1, 0, 'F', '0', '0', 'workflow:category:add', '#', 103, 1,sysdate(), null, null, ''); |
| | | insert into sys_menu values ('11625', 'æµç¨å类修æ¹', '11622', '3', '#', '', '', 1, 0, 'F', '0', '0', 'workflow:category:edit', '#', 103, 1,sysdate(), null, null, ''); |
| | | insert into sys_menu values ('11626', 'æµç¨åç±»å é¤', '11622', '4', '#', '', '', 1, 0, 'F', '0', '0', 'workflow:category:remove', '#', 103,1, sysdate(), null, null, ''); |
| | | insert into sys_menu values ('11627', 'æµç¨å类导åº', '11622', '5', '#', '', '', 1, 0, 'F', '0', '0', 'workflow:category:export', '#', 103,1, sysdate(), null, null, ''); |
| | | -- è¯·åæµè¯ç¸å
³æé® |
| | | insert into sys_menu VALUES (11638, '请åç³è¯·', 5, 1, 'leave', 'workflow/leave/index', '', 1, 0, 'C', '0', '0', 'workflow:leave:list', '#', 103, 1, sysdate(), NULL, NULL, '请åç³è¯·èå'); |
| | | insert into sys_menu VALUES (11639, '请åç³è¯·æ¥è¯¢', 11638, 1, '#', '', '', 1, 0, 'F', '0', '0', 'workflow:leave:query', '#', 103, 1, sysdate(), NULL, NULL, ''); |
| | | insert into sys_menu VALUES (11640, '请åç³è¯·æ°å¢', 11638, 2, '#', '', '', 1, 0, 'F', '0', '0', 'workflow:leave:add', '#', 103, 1, sysdate(), NULL, NULL, ''); |
| | | insert into sys_menu VALUES (11641, '请åç³è¯·ä¿®æ¹', 11638, 3, '#', '', '', 1, 0, 'F', '0', '0', 'workflow:leave:edit', '#', 103, 1, sysdate(), NULL, NULL, ''); |
| | | insert into sys_menu VALUES (11642, '请åç³è¯·å é¤', 11638, 4, '#', '', '', 1, 0, 'F', '0', '0', 'workflow:leave:remove', '#', 103, 1, sysdate(), NULL, NULL, ''); |
| | | insert into sys_menu VALUES (11643, '请åç³è¯·å¯¼åº', 11638, 5, '#', '', '', 1, 0, 'F', '0', '0', 'workflow:leave:export', '#', 103, 1, sysdate(), NULL, NULL, ''); |
| | | |
| | | INSERT INTO sys_dict_type VALUES (13, '000000', 'ä¸å¡ç¶æ', 'wf_business_status', 103, 1, sysdate(), NULL, NULL, 'ä¸å¡ç¶æå表'); |
| | | INSERT INTO sys_dict_type VALUES (14, '000000', '表åç±»å', 'wf_form_type', 103, 1, sysdate(), NULL, NULL, '表åç±»åå表'); |
| | | INSERT INTO sys_dict_type VALUES (15, '000000', 'ä»»å¡ç¶æ', 'wf_task_status', 103, 1, sysdate(), NULL, NULL, 'ä»»å¡ç¶æ'); |
| | | INSERT INTO sys_dict_data VALUES (39, '000000', 1, 'å·²æ¤é', 'cancel', 'wf_business_status', '', 'danger', 'N', 103, 1, sysdate(), NULL, NULL,'å·²æ¤é'); |
| | | INSERT INTO sys_dict_data VALUES (40, '000000', 2, 'è稿', 'draft', 'wf_business_status', '', 'info', 'N', 103, 1, sysdate(), NULL, NULL, 'è稿'); |
| | | INSERT INTO sys_dict_data VALUES (41, '000000', 3, 'å¾
å®¡æ ¸', 'waiting', 'wf_business_status', '', 'primary', 'N', 103, 1, sysdate(), NULL, NULL,'å¾
å®¡æ ¸'); |
| | | INSERT INTO sys_dict_data VALUES (42, '000000', 4, '已宿', 'finish', 'wf_business_status', '', 'success', 'N', 103, 1, sysdate(), NULL, NULL,'已宿'); |
| | | INSERT INTO sys_dict_data VALUES (43, '000000', 5, 'å·²ä½åº', 'invalid', 'wf_business_status', '', 'danger', 'N', 103, 1, sysdate(), NULL, NULL,'å·²ä½åº'); |
| | | INSERT INTO sys_dict_data VALUES (44, '000000', 6, 'å·²éå', 'back', 'wf_business_status', '', 'danger', 'N', 103, 1, sysdate(), NULL, NULL,'å·²éå'); |
| | | INSERT INTO sys_dict_data VALUES (45, '000000', 7, 'å·²ç»æ¢', 'termination', 'wf_business_status', '', 'danger', 'N', 103, 1, sysdate(), NULL,NULL, 'å·²ç»æ¢'); |
| | | INSERT INTO sys_dict_data VALUES (46, '000000', 1, 'èªå®ä¹è¡¨å', 'static', 'wf_form_type', '', 'success', 'N', 103, 1, sysdate(), NULL, NULL,'èªå®ä¹è¡¨å'); |
| | | INSERT INTO sys_dict_data VALUES (47, '000000', 2, 'å¨æè¡¨å', 'dynamic', 'wf_form_type', '', 'primary', 'N', 103, 1, sysdate(), NULL, NULL,'å¨æè¡¨å'); |
| | | INSERT INTO sys_dict_data VALUES (48, '000000', 1, 'æ¤é', 'cancel', 'wf_task_status', '', 'danger', 'N', 103, 1, sysdate(), NULL, NULL, 'æ¤é'); |
| | | INSERT INTO sys_dict_data VALUES (49, '000000', 2, 'éè¿', 'pass', 'wf_task_status', '', 'success', 'N', 103, 1, sysdate(), NULL, NULL, 'éè¿'); |
| | | INSERT INTO sys_dict_data VALUES (50, '000000', 3, 'å¾
å®¡æ ¸', 'waiting', 'wf_task_status', '', 'primary', 'N', 103, 1, sysdate(), NULL, NULL, 'å¾
å®¡æ ¸'); |
| | | INSERT INTO sys_dict_data VALUES (51, '000000', 4, 'ä½åº', 'invalid', 'wf_task_status', '', 'danger', 'N', 103, 1, sysdate(), NULL, NULL, 'ä½åº'); |
| | | INSERT INTO sys_dict_data VALUES (52, '000000', 5, 'éå', 'back', 'wf_task_status', '', 'danger', 'N', 103, 1, sysdate(), NULL, NULL, 'éå'); |
| | | INSERT INTO sys_dict_data VALUES (53, '000000', 6, 'ç»æ¢', 'termination', 'wf_task_status', '', 'danger', 'N', 103, 1, sysdate(), NULL, NULL, 'ç»æ¢'); |
| | | INSERT INTO sys_dict_data VALUES (54, '000000', 7, '转å', 'transfer', 'wf_task_status', '', 'primary', 'N', 103, 1, sysdate(), NULL, NULL, '转å'); |
| | | INSERT INTO sys_dict_data VALUES (55, '000000', 8, 'å§æ', 'depute', 'wf_task_status', '', 'primary', 'N', 103, 1, sysdate(), NULL, NULL, 'å§æ'); |
| | | INSERT INTO sys_dict_data VALUES (56, '000000', 9, 'æé', 'copy', 'wf_task_status', '', 'primary', 'N', 103, 1, sysdate(), NULL, NULL, 'æé'); |
| | | INSERT INTO sys_dict_data VALUES (57, '000000', 10, 'å ç¾', 'sign', 'wf_task_status', '', 'primary', 'N', 103, 1, sysdate(), NULL, NULL, 'å ç¾'); |
| | | INSERT INTO sys_dict_data VALUES (58, '000000', 11, 'åç¾', 'sign_off', 'wf_task_status', '', 'danger', 'N', 103, 1, sysdate(), NULL, NULL, 'åç¾'); |
| | | INSERT INTO sys_dict_data VALUES (59, '000000', 11, 'è¶
æ¶', 'timeout', 'wf_task_status', '', 'danger', 'N', 103, 1, sysdate(), NULL, NULL, 'è¶
æ¶'); |
| | | |
ÎļþÃû´Ó script/sql/sqlserver/snail_job_sqlserver.sql ÐÞ¸Ä |
| | |
| | | SnailJob Database Transfer Tool |
| | | Source Server Type : MySQL |
| | | Target Server Type : Microsoft SQL Server |
| | | Date: 2024-07-06 12:55:47 |
| | | Date: 2024-12-27 22:24:37 |
| | | */ |
| | | |
| | | |
| | |
| | | |
| | | INSERT INTO sj_group_config(namespace_id, group_name, description, token, group_status, version, group_partition, id_generator_mode, init_scene, bucket_index, create_dt, update_dt) VALUES (N'dev', N'ruoyi_group', N'', N'SJ_cKqBTPzCsWA3VyuCfFoccmuIEGXjr5KT', N'1', N'1', N'0', N'1', N'1', N'4', getdate(), getdate()) |
| | | GO |
| | | INSERT INTO sj_group_config(namespace_id, group_name, description, token, group_status, version, group_partition, id_generator_mode, init_scene, bucket_index, create_dt, update_dt) VALUES (N'prod', N'ruoyi_group', N'', N'SJ_cKqBTPzCsWA3VyuCfFoccmuIEGXjr5KT', N'1', N'1', N'0', N'1', N'1', N'4', getdate(), getdate()) |
| | | GO |
| | | |
| | | -- sj_notify_config |
| | | CREATE TABLE sj_notify_config |
| | |
| | | id bigint NOT NULL PRIMARY KEY IDENTITY, |
| | | namespace_id nvarchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a', |
| | | group_name nvarchar(64) NOT NULL, |
| | | business_id nvarchar(64) NOT NULL, |
| | | notify_name nvarchar(64) NOT NULL DEFAULT '', |
| | | system_task_type tinyint NOT NULL DEFAULT 3, |
| | | notify_status tinyint NOT NULL DEFAULT 0, |
| | | recipient_ids nvarchar(128) NOT NULL, |
| | |
| | | ) |
| | | GO |
| | | |
| | | CREATE INDEX idx_sj_notify_config_01 ON sj_notify_config (namespace_id, group_name, business_id) |
| | | CREATE INDEX idx_sj_notify_config_01 ON sj_notify_config (namespace_id, group_name) |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'ä¸å¡id ( job_idæworkflow_idæscene_name ) ', |
| | | 'MS_Description', N'éç¥åç§°', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'sj_notify_config', |
| | | 'COLUMN', N'business_id' |
| | | 'COLUMN', N'notify_name' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | |
| | | max_retry_count int NOT NULL DEFAULT 5, |
| | | back_off tinyint NOT NULL DEFAULT 1, |
| | | trigger_interval nvarchar(16) NOT NULL DEFAULT '', |
| | | notify_ids nvarchar(128) NOT NULL DEFAULT '', |
| | | deadline_request bigint NOT NULL DEFAULT 60000, |
| | | executor_timeout int NOT NULL DEFAULT 5, |
| | | route_key tinyint NOT NULL DEFAULT 4, |
| | |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'sj_retry_scene_config', |
| | | 'COLUMN', N'trigger_interval' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'éç¥åè¦åºæ¯é
ç½®idå表', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'sj_retry_scene_config', |
| | | 'COLUMN', N'notify_ids' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | |
| | | retry_interval int NOT NULL DEFAULT 0, |
| | | bucket_index int NOT NULL DEFAULT 0, |
| | | resident tinyint NOT NULL DEFAULT 0, |
| | | notify_ids nvarchar(128) NOT NULL DEFAULT '', |
| | | owner_id bigint NULL, |
| | | description nvarchar(256) NOT NULL DEFAULT '', |
| | | ext_attrs nvarchar(256) NULL DEFAULT '', |
| | | deleted tinyint NOT NULL DEFAULT 0, |
| | |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'éç¥åè¦åºæ¯é
ç½®idå表', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'sj_job', |
| | | 'COLUMN', N'notify_ids' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'è´è´£äººid', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'sj_job', |
| | | 'COLUMN', N'owner_id' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'æè¿°', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'sj_job', |
| | |
| | | 'TABLE', N'sj_job' |
| | | GO |
| | | |
| | | INSERT INTO sj_job (namespace_id, group_name, job_name, args_str, args_type, next_trigger_at, job_status, task_type, route_key, executor_type, executor_info, trigger_type, trigger_interval, block_strategy,executor_timeout, max_retry_times, parallel_num, retry_interval, bucket_index, resident, description, ext_attrs, deleted, create_dt, update_dt) VALUES (N'dev', N'ruoyi_group', N'demo-job', null, 1, 1710344035622, 1, 1, 4, 1, N'testJobExecutor', 2, N'60', 1, 60, 3, 1, 1, 116, 0, N'', N'', 0, getdate(), getdate()) |
| | | INSERT INTO sj_job (namespace_id, group_name, job_name, args_str, args_type, next_trigger_at, job_status, task_type, route_key, executor_type, executor_info, trigger_type, trigger_interval, block_strategy,executor_timeout, max_retry_times, parallel_num, retry_interval, bucket_index, resident, notify_ids, owner_id, description, ext_attrs, deleted, create_dt, update_dt) VALUES (N'dev', N'ruoyi_group', N'demo-job', null, 1, 1710344035622, 1, 1, 4, 1, N'testJobExecutor', 2, N'60', 1, 60, 3, 1, 1, 116, 0, N'', 1, N'', N'', 0, getdate(), getdate()) |
| | | GO |
| | | |
| | | -- sj_job_log_message |
| | |
| | | description nvarchar(256) NOT NULL DEFAULT '', |
| | | flow_info nvarchar(max) NULL DEFAULT NULL, |
| | | wf_context nvarchar(max) NULL DEFAULT NULL, |
| | | notify_ids nvarchar(128) NOT NULL DEFAULT '', |
| | | bucket_index int NOT NULL DEFAULT 0, |
| | | version int NOT NULL, |
| | | ext_attrs nvarchar(256) NULL DEFAULT '', |
| | |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'sj_workflow', |
| | | 'COLUMN', N'wf_context' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'éç¥åè¦åºæ¯é
ç½®idå表', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'sj_workflow', |
| | | 'COLUMN', N'notify_ids' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'sj_workflow_task_batch' |
| | | GO |
| | | |
| | |
| | | ( |
| | | id bigint NOT NULL, |
| | | user_id bigint NOT NULL, |
| | | tenant_id nvarchar(20) NULL, |
| | | tenant_id nvarchar(20) DEFAULT ('000000') NULL, |
| | | auth_id nvarchar(255) NOT NULL, |
| | | source nvarchar(255) NOT NULL, |
| | | open_id nvarchar(255) NULL, |
| | |
| | | 'COLUMN', N'oauth_token_secret' |
| | | GO |
| | | EXEC sys.sp_addextendedproperty |
| | | 'MS_Description', N'å 餿 å¿ï¼0代表åå¨ 2代表å é¤ï¼' , |
| | | 'MS_Description', N'å 餿 å¿ï¼0代表åå¨ 1代表å é¤ï¼' , |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'sys_social', |
| | | 'COLUMN', N'del_flag' |
| | |
| | | 'TABLE', N'sys_social', |
| | | 'COLUMN', N'update_time' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'社ä¼åå
³ç³»è¡¨', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'sys_social' |
| | | GO |
| | | |
| | | CREATE TABLE sys_tenant |
| | | ( |
| | |
| | | 'COLUMN', N'status' |
| | | GO |
| | | EXEC sys.sp_addextendedproperty |
| | | 'MS_Description', N'å 餿 å¿ï¼0代表åå¨ 2代表å é¤ï¼' , |
| | | 'MS_Description', N'å 餿 å¿ï¼0代表åå¨ 1代表å é¤ï¼' , |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'sys_tenant', |
| | | 'COLUMN', N'del_flag' |
| | |
| | | 'COLUMN', N'status' |
| | | GO |
| | | EXEC sys.sp_addextendedproperty |
| | | 'MS_Description', N'å 餿 å¿ï¼0代表åå¨ 2代表å é¤ï¼' , |
| | | 'MS_Description', N'å 餿 å¿ï¼0代表åå¨ 1代表å é¤ï¼' , |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'sys_tenant_package', |
| | | 'COLUMN', N'del_flag' |
| | |
| | | 'COLUMN', N'status' |
| | | GO |
| | | EXEC sys.sp_addextendedproperty |
| | | 'MS_Description', N'å 餿 å¿ï¼0代表åå¨ 2代表å é¤ï¼' , |
| | | 'MS_Description', N'å 餿 å¿ï¼0代表åå¨ 1代表å é¤ï¼' , |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'sys_dept', |
| | | 'COLUMN', N'del_flag' |
| | |
| | | GO |
| | | INSERT sys_dict_data VALUES (19, N'000000', 2, N'ä¿®æ¹', N'2', N'sys_oper_type', N'', N'info', N'N', 103, 1, getdate(), NULL, NULL, N'ä¿®æ¹æä½') |
| | | GO |
| | | INSERT sys_dict_data VALUES (20, N'000000', 3, N'å é¤', N'3', N'sys_oper_type', N'', N'danger', N'N', 103, 1, getdate(), NULL, NULL, N'å 餿ä½') |
| | | INSERT sys_dict_data VALUES (20, N'000000', 3, N'å é¤', N3, N'sys_oper_type', N'', N'danger', N'N', 103, 1, getdate(), NULL, NULL, N'å 餿ä½') |
| | | GO |
| | | INSERT sys_dict_data VALUES (21, N'000000', 4, N'ææ', N'4', N'sys_oper_type', N'', N'primary', N'N', 103, 1, getdate(), NULL, NULL, N'æææä½') |
| | | GO |
| | |
| | | oper_url nvarchar(255) DEFAULT '' NULL, |
| | | oper_ip nvarchar(128) DEFAULT '' NULL, |
| | | oper_location nvarchar(255) DEFAULT '' NULL, |
| | | oper_param nvarchar(2000) DEFAULT '' NULL, |
| | | json_result nvarchar(2000) DEFAULT '' NULL, |
| | | oper_param nvarchar(4000) DEFAULT '' NULL, |
| | | json_result nvarchar(4000) DEFAULT '' NULL, |
| | | status int DEFAULT ((0)) NULL, |
| | | error_msg nvarchar(2000) DEFAULT '' NULL, |
| | | error_msg nvarchar(4000) DEFAULT '' NULL, |
| | | oper_time datetime2(7) NULL, |
| | | cost_time bigint DEFAULT ((0)) NULL, |
| | | CONSTRAINT PK__sys_oper__34723BF9BD954573 PRIMARY KEY CLUSTERED (oper_id) |
| | |
| | | 'COLUMN', N'status' |
| | | GO |
| | | EXEC sys.sp_addextendedproperty |
| | | 'MS_Description', N'å 餿 å¿ï¼0代表åå¨ 2代表å é¤ï¼' , |
| | | 'MS_Description', N'å 餿 å¿ï¼0代表åå¨ 1代表å é¤ï¼' , |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'sys_role', |
| | | 'COLUMN', N'del_flag' |
| | |
| | | GO |
| | | INSERT sys_role_menu VALUES (3, 108); |
| | | GO |
| | | INSERT sys_role_menu VALUES (3, 118); |
| | | GO |
| | | INSERT sys_role_menu VALUES (3, 123); |
| | | GO |
| | | INSERT sys_role_menu VALUES (3, 500); |
| | | GO |
| | | INSERT sys_role_menu VALUES (3, 501); |
| | |
| | | GO |
| | | INSERT sys_role_menu VALUES (3, 1045); |
| | | GO |
| | | INSERT sys_role_menu VALUES (3, 1050); |
| | | GO |
| | | INSERT sys_role_menu VALUES (3, 1061); |
| | | GO |
| | | INSERT sys_role_menu VALUES (3, 1062); |
| | | GO |
| | | INSERT sys_role_menu VALUES (3, 1063); |
| | | GO |
| | | INSERT sys_role_menu VALUES (3, 1064); |
| | | GO |
| | | INSERT sys_role_menu VALUES (3, 1065); |
| | | GO |
| | | INSERT sys_role_menu VALUES (3, 1500); |
| | | GO |
| | | INSERT sys_role_menu VALUES (3, 1501); |
| | |
| | | INSERT sys_role_menu VALUES (3, 1510); |
| | | GO |
| | | INSERT sys_role_menu VALUES (3, 1511); |
| | | GO |
| | | INSERT sys_role_menu VALUES (3, 1600); |
| | | GO |
| | | INSERT sys_role_menu VALUES (3, 1601); |
| | | GO |
| | | INSERT sys_role_menu VALUES (3, 1602); |
| | | GO |
| | | INSERT sys_role_menu VALUES (3, 1603); |
| | | GO |
| | | INSERT sys_role_menu VALUES (3, 1620); |
| | | GO |
| | | INSERT sys_role_menu VALUES (3, 1621); |
| | | GO |
| | | INSERT sys_role_menu VALUES (3, 1622); |
| | | GO |
| | | INSERT sys_role_menu VALUES (3, 1623); |
| | | GO |
| | | INSERT sys_role_menu VALUES (3, 11618); |
| | | GO |
| | | INSERT sys_role_menu VALUES (3, 11619); |
| | | GO |
| | | INSERT sys_role_menu VALUES (3, 11629); |
| | | GO |
| | | INSERT sys_role_menu VALUES (3, 11632); |
| | | GO |
| | | INSERT sys_role_menu VALUES (3, 11633); |
| | | GO |
| | | INSERT sys_role_menu VALUES (3, 11638); |
| | | GO |
| | | INSERT sys_role_menu VALUES (3, 11639); |
| | | GO |
| | | INSERT sys_role_menu VALUES (3, 11640); |
| | | GO |
| | | INSERT sys_role_menu VALUES (3, 11641); |
| | | GO |
| | | INSERT sys_role_menu VALUES (3, 11642); |
| | | GO |
| | | INSERT sys_role_menu VALUES (3, 11643); |
| | | GO |
| | | INSERT sys_role_menu VALUES (4, 5); |
| | | GO |
| | |
| | | 'COLUMN', N'status' |
| | | GO |
| | | EXEC sys.sp_addextendedproperty |
| | | 'MS_Description', N'å 餿 å¿ï¼0代表åå¨ 2代表å é¤ï¼' , |
| | | 'MS_Description', N'å 餿 å¿ï¼0代表åå¨ 1代表å é¤ï¼' , |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'sys_user', |
| | | 'COLUMN', N'del_flag' |
| | |
| | | GO |
| | | INSERT INTO sys_oss_config VALUES (N'2', N'000000', N'qiniu', N'XXXXXXXXXXXXXXXX', N'XXXXXXXXXXXXXXX', N'ruoyi', N'', N's3-cn-north-1.qiniucs.com', N'',N'N', N'', N'1', N'1', N'', 103, 1, getdate(), 1, getdate(), NULL) |
| | | GO |
| | | INSERT INTO sys_oss_config VALUES (N'3', N'000000', N'aliyun', N'XXXXXXXXXXXXXXX', N'XXXXXXXXXXXXXXX', N'ruoyi', N'', N'oss-cn-beijing.aliyuncs.com', N'',N'N', N'', N'1', N'1', N'', 103, 1, getdate(), 1, getdate(), NULL) |
| | | INSERT INTO sys_oss_config VALUES (N3, N'000000', N'aliyun', N'XXXXXXXXXXXXXXX', N'XXXXXXXXXXXXXXX', N'ruoyi', N'', N'oss-cn-beijing.aliyuncs.com', N'',N'N', N'', N'1', N'1', N'', 103, 1, getdate(), 1, getdate(), NULL) |
| | | GO |
| | | INSERT INTO sys_oss_config VALUES (N'4', N'000000', N'qcloud', N'XXXXXXXXXXXXXXX', N'XXXXXXXXXXXXXXX', N'ruoyi-1250000000', N'', N'cos.ap-beijing.myqcloud.com', N'',N'N', N'ap-beijing', N'1', N'1', N'', 103, 1, getdate(), 1, getdate(), NULL) |
| | | GO |
| | |
| | | 'COLUMN', N'status' |
| | | GO |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'å 餿 å¿ï¼0代表åå¨ 2代表å é¤ï¼', |
| | | 'MS_Description', N'å 餿 å¿ï¼0代表åå¨ 1代表å é¤ï¼', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'sys_client', |
| | | 'COLUMN', N'del_flag' |
¶Ô±ÈÐÂÎļþ |
| | |
| | | CREATE TABLE flow_definition ( |
| | | id bigint NOT NULL, |
| | | flow_code nvarchar(40) NOT NULL, |
| | | flow_name nvarchar(100) NOT NULL, |
| | | category nvarchar(100) NULL, |
| | | version nvarchar(20) NOT NULL, |
| | | is_publish tinyint DEFAULT('0') NULL, |
| | | form_custom nchar(1) DEFAULT('N') NULL, |
| | | form_path nvarchar(100) NULL, |
| | | activity_status tinyint DEFAULT('1') NULL, |
| | | listener_type nvarchar(100) NULL, |
| | | listener_path nvarchar(400) NULL, |
| | | ext nvarchar(500) NULL, |
| | | create_time datetime2(7) NULL, |
| | | update_time datetime2(7) NULL, |
| | | del_flag nchar(1) DEFAULT('0') NULL, |
| | | tenant_id nvarchar(40) NULL, |
| | | CONSTRAINT PK__flow_def__3213E83FEE39AE33 PRIMARY KEY CLUSTERED (id) |
| | | WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) |
| | | ON [PRIMARY] |
| | | ) |
| | | ON [PRIMARY] |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'主é®id', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_definition', |
| | | 'COLUMN', N'id' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'æµç¨ç¼ç ', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_definition', |
| | | 'COLUMN', N'flow_code' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'æµç¨åç§°', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_definition', |
| | | 'COLUMN', N'flow_name' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'æµç¨ç±»å«', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_definition', |
| | | 'COLUMN', N'category' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'æµç¨çæ¬', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_definition', |
| | | 'COLUMN', N'version' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'æ¯å¦åå¸ï¼0æªåå¸ 1å·²åå¸ 9失æï¼', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_definition', |
| | | 'COLUMN', N'is_publish' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'审æ¹è¡¨åæ¯å¦èªå®ä¹ï¼Yæ¯ Nå¦ï¼', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_definition', |
| | | 'COLUMN', N'form_custom' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'审æ¹è¡¨åè·¯å¾', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_definition', |
| | | 'COLUMN', N'form_path' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'æµç¨æ¿æ´»ç¶æï¼0æèµ· 1æ¿æ´»ï¼', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_definition', |
| | | 'COLUMN', N'activity_status' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'çå¬å¨ç±»å', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_definition', |
| | | 'COLUMN', N'listener_type' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'çå¬å¨è·¯å¾', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_definition', |
| | | 'COLUMN', N'listener_path' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'ä¸å¡è¯¦æ
åä¸å¡è¡¨å¯¹è±¡jsonå符串', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_definition', |
| | | 'COLUMN', N'ext' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'å建æ¶é´', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_definition', |
| | | 'COLUMN', N'create_time' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'æ´æ°æ¶é´', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_definition', |
| | | 'COLUMN', N'update_time' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'å 餿 å¿', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_definition', |
| | | 'COLUMN', N'del_flag' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'ç§æ·id', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_definition', |
| | | 'COLUMN', N'tenant_id' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'æµç¨å®ä¹è¡¨', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_definition' |
| | | GO |
| | | |
| | | CREATE TABLE flow_node ( |
| | | id bigint NOT NULL, |
| | | node_type tinyint NOT NULL, |
| | | definition_id bigint NOT NULL, |
| | | node_code nvarchar(100) NOT NULL, |
| | | node_name nvarchar(100) NULL, |
| | | permission_flag nvarchar(200) NULL, |
| | | node_ratio decimal(6,3) NULL, |
| | | coordinate nvarchar(100) NULL, |
| | | skip_any_node nvarchar(100) DEFAULT('N') NULL, |
| | | any_node_skip nvarchar(100) NULL, |
| | | listener_type nvarchar(100) NULL, |
| | | listener_path nvarchar(400) NULL, |
| | | handler_type nvarchar(100) NULL, |
| | | handler_path nvarchar(400) NULL, |
| | | form_custom nchar(1) DEFAULT('N') NULL, |
| | | form_path nvarchar(100) NULL, |
| | | version nvarchar(20) NOT NULL, |
| | | create_time datetime2(7) NULL, |
| | | update_time datetime2(7) NULL, |
| | | del_flag nchar(1) DEFAULT('0') NULL, |
| | | tenant_id nvarchar(40) NULL, |
| | | CONSTRAINT PK__flow_nod__3213E83F372470DE PRIMARY KEY CLUSTERED (id) |
| | | WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) |
| | | ON [PRIMARY] |
| | | ) |
| | | ON [PRIMARY] |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'主é®id', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_node', |
| | | 'COLUMN', N'id' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'èç¹ç±»åï¼0å¼å§èç¹ 1ä¸é´èç¹ 2ç»æèç¹ 3äºæ¥ç½å
³ 4å¹¶è¡ç½å
³ï¼', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_node', |
| | | 'COLUMN', N'node_type' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'æµç¨å®ä¹id', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_node', |
| | | 'COLUMN', N'definition_id' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'æµç¨èç¹ç¼ç ', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_node', |
| | | 'COLUMN', N'node_code' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'æµç¨èç¹åç§°', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_node', |
| | | 'COLUMN', N'node_name' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'æéæ è¯ï¼æéç±»å:æéæ è¯ï¼å¯ä»¥å¤ä¸ªï¼ç¨éå·éå¼)', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_node', |
| | | 'COLUMN', N'permission_flag' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'æµç¨ç¾ç½²æ¯ä¾å¼', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_node', |
| | | 'COLUMN', N'node_ratio' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'åæ ', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_node', |
| | | 'COLUMN', N'coordinate' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'æ¯å¦å¯ä»¥éåä»»æèç¹ï¼Yæ¯ Nå¦ï¼å³å°å é¤', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_node', |
| | | 'COLUMN', N'skip_any_node' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'ä»»æç»ç¹è·³è½¬', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_node', |
| | | 'COLUMN', N'any_node_skip' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'çå¬å¨ç±»å', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_node', |
| | | 'COLUMN', N'listener_type' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'çå¬å¨è·¯å¾', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_node', |
| | | 'COLUMN', N'listener_path' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'å¤çå¨ç±»å', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_node', |
| | | 'COLUMN', N'handler_type' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'å¤çå¨è·¯å¾', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_node', |
| | | 'COLUMN', N'handler_path' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'审æ¹è¡¨åæ¯å¦èªå®ä¹ï¼Yæ¯ Nå¦ï¼', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_node', |
| | | 'COLUMN', N'form_custom' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'审æ¹è¡¨åè·¯å¾', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_node', |
| | | 'COLUMN', N'form_path' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'çæ¬', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_node', |
| | | 'COLUMN', N'version' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'å建æ¶é´', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_node', |
| | | 'COLUMN', N'create_time' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'æ´æ°æ¶é´', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_node', |
| | | 'COLUMN', N'update_time' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'å 餿 å¿', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_node', |
| | | 'COLUMN', N'del_flag' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'ç§æ·id', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_node', |
| | | 'COLUMN', N'tenant_id' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'æµç¨èç¹è¡¨', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_node' |
| | | GO |
| | | |
| | | CREATE TABLE flow_skip ( |
| | | id bigint NOT NULL, |
| | | definition_id bigint NOT NULL, |
| | | now_node_code nvarchar(100) NOT NULL, |
| | | now_node_type tinyint NULL, |
| | | next_node_code nvarchar(100) NOT NULL, |
| | | next_node_type tinyint NULL, |
| | | skip_name nvarchar(100) NULL, |
| | | skip_type nvarchar(40) NULL, |
| | | skip_condition nvarchar(200) NULL, |
| | | coordinate nvarchar(100) NULL, |
| | | create_time datetime2(7) NULL, |
| | | update_time datetime2(7) NULL, |
| | | del_flag nchar(1) DEFAULT('0') NULL, |
| | | tenant_id nvarchar(40) NULL, |
| | | CONSTRAINT PK__flow_ski__3213E83F073FEE6E PRIMARY KEY CLUSTERED (id) |
| | | WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) |
| | | ON [PRIMARY] |
| | | ) |
| | | ON [PRIMARY] |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'主é®id', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_skip', |
| | | 'COLUMN', N'id' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'æµç¨å®ä¹id', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_skip', |
| | | 'COLUMN', N'definition_id' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'å½åæµç¨èç¹çç¼ç ', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_skip', |
| | | 'COLUMN', N'now_node_code' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'å½åèç¹ç±»åï¼0å¼å§èç¹ 1ä¸é´èç¹ 2ç»æèç¹ 3äºæ¥ç½å
³ 4å¹¶è¡ç½å
³ï¼', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_skip', |
| | | 'COLUMN', N'now_node_type' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'ä¸ä¸ä¸ªæµç¨èç¹çç¼ç ', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_skip', |
| | | 'COLUMN', N'next_node_code' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'ä¸ä¸ä¸ªèç¹ç±»åï¼0å¼å§èç¹ 1ä¸é´èç¹ 2ç»æèç¹ 3äºæ¥ç½å
³ 4å¹¶è¡ç½å
³ï¼', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_skip', |
| | | 'COLUMN', N'next_node_type' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'跳转åç§°', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_skip', |
| | | 'COLUMN', N'skip_name' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'跳转类åï¼PASS审æ¹éè¿ REJECTéåï¼', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_skip', |
| | | 'COLUMN', N'skip_type' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'跳转æ¡ä»¶', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_skip', |
| | | 'COLUMN', N'skip_condition' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'åæ ', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_skip', |
| | | 'COLUMN', N'coordinate' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'å建æ¶é´', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_skip', |
| | | 'COLUMN', N'create_time' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'æ´æ°æ¶é´', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_skip', |
| | | 'COLUMN', N'update_time' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'å 餿 å¿', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_skip', |
| | | 'COLUMN', N'del_flag' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'ç§æ·id', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_skip', |
| | | 'COLUMN', N'tenant_id' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'èç¹è·³è½¬å
³è表', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_skip' |
| | | GO |
| | | |
| | | CREATE TABLE flow_instance ( |
| | | id bigint NOT NULL, |
| | | definition_id bigint NOT NULL, |
| | | business_id nvarchar(40) NOT NULL, |
| | | node_type tinyint NOT NULL, |
| | | node_code nvarchar(40) NOT NULL, |
| | | node_name nvarchar(100) NULL, |
| | | variable nvarchar(max) NULL, |
| | | flow_status nvarchar(20) NOT NULL, |
| | | activity_status tinyint DEFAULT('1') NULL, |
| | | def_json nvarchar(max) NULL, |
| | | create_by nvarchar(64) NULL, |
| | | create_time datetime2(7) NULL, |
| | | update_time datetime2(7) NULL, |
| | | ext nvarchar(500) NULL, |
| | | del_flag nchar(1) DEFAULT('0') NULL, |
| | | tenant_id nvarchar(40) NULL, |
| | | CONSTRAINT PK__flow_ins__3213E83F5190FEE1 PRIMARY KEY CLUSTERED (id) |
| | | WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) |
| | | ON [PRIMARY] |
| | | ) |
| | | ON [PRIMARY] |
| | | TEXTIMAGE_ON [PRIMARY] |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'主é®id', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_instance', |
| | | 'COLUMN', N'id' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'对åºflow_definition表çid', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_instance', |
| | | 'COLUMN', N'definition_id' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'ä¸å¡id', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_instance', |
| | | 'COLUMN', N'business_id' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'èç¹ç±»åï¼0å¼å§èç¹ 1ä¸é´èç¹ 2ç»æèç¹ 3äºæ¥ç½å
³ 4å¹¶è¡ç½å
³ï¼', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_instance', |
| | | 'COLUMN', N'node_type' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'æµç¨èç¹ç¼ç ', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_instance', |
| | | 'COLUMN', N'node_code' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'æµç¨èç¹åç§°', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_instance', |
| | | 'COLUMN', N'node_name' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'ä»»å¡åé', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_instance', |
| | | 'COLUMN', N'variable' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'æµç¨ç¶æï¼0å¾
æäº¤ 1审æ¹ä¸ 2 审æ¹éè¿ 3èªå¨éè¿ 4ç»æ¢ 5ä½åº 6æ¤é 7åå 8已宿 9å·²éå 10失æï¼', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_instance', |
| | | 'COLUMN', N'flow_status' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'æµç¨æ¿æ´»ç¶æï¼0æèµ· 1æ¿æ´»ï¼', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_instance', |
| | | 'COLUMN', N'activity_status' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'æµç¨å®ä¹json', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_instance', |
| | | 'COLUMN', N'def_json' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'å建è
', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_instance', |
| | | 'COLUMN', N'create_by' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'å建æ¶é´', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_instance', |
| | | 'COLUMN', N'create_time' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'æ´æ°æ¶é´', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_instance', |
| | | 'COLUMN', N'update_time' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'æ©å±å段ï¼é¢çç»ä¸å¡ç³»ç»ä½¿ç¨', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_instance', |
| | | 'COLUMN', N'ext' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'å 餿 å¿', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_instance', |
| | | 'COLUMN', N'del_flag' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'ç§æ·id', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_instance', |
| | | 'COLUMN', N'tenant_id' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'æµç¨å®ä¾è¡¨', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_instance' |
| | | GO |
| | | |
| | | CREATE TABLE flow_task ( |
| | | id bigint NOT NULL, |
| | | definition_id bigint NOT NULL, |
| | | instance_id bigint NOT NULL, |
| | | node_code nvarchar(100) NOT NULL, |
| | | node_name nvarchar(100) NULL, |
| | | node_type tinyint NOT NULL, |
| | | form_custom nchar(1) DEFAULT('N') NULL, |
| | | form_path nvarchar(100) NULL, |
| | | create_time datetime2(7) NULL, |
| | | update_time datetime2(7) NULL, |
| | | del_flag nchar(1) DEFAULT('0') NULL, |
| | | tenant_id nvarchar(40) NULL, |
| | | CONSTRAINT PK__flow_tas__3213E83F5AE1F1BA PRIMARY KEY CLUSTERED (id) |
| | | WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) |
| | | ON [PRIMARY] |
| | | ) |
| | | ON [PRIMARY] |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'主é®id', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_task', |
| | | 'COLUMN', N'id' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'对åºflow_definition表çid', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_task', |
| | | 'COLUMN', N'definition_id' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'对åºflow_instance表çid', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_task', |
| | | 'COLUMN', N'instance_id' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'èç¹ç¼ç ', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_task', |
| | | 'COLUMN', N'node_code' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'èç¹åç§°', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_task', |
| | | 'COLUMN', N'node_name' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'èç¹ç±»åï¼0å¼å§èç¹ 1ä¸é´èç¹ 2ç»æèç¹ 3äºæ¥ç½å
³ 4å¹¶è¡ç½å
³ï¼', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_task', |
| | | 'COLUMN', N'node_type' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'审æ¹è¡¨åæ¯å¦èªå®ä¹ï¼Yæ¯ Nå¦ï¼', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_task', |
| | | 'COLUMN', N'form_custom' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'审æ¹è¡¨åè·¯å¾', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_task', |
| | | 'COLUMN', N'form_path' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'å建æ¶é´', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_task', |
| | | 'COLUMN', N'create_time' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'æ´æ°æ¶é´', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_task', |
| | | 'COLUMN', N'update_time' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'å 餿 å¿', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_task', |
| | | 'COLUMN', N'del_flag' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'ç§æ·id', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_task', |
| | | 'COLUMN', N'tenant_id' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'å¾
åä»»å¡è¡¨', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_task' |
| | | GO |
| | | |
| | | CREATE TABLE flow_his_task ( |
| | | id bigint NOT NULL, |
| | | definition_id bigint NOT NULL, |
| | | instance_id bigint NOT NULL, |
| | | task_id bigint NOT NULL, |
| | | node_code nvarchar(200) NULL, |
| | | node_name nvarchar(200) NULL, |
| | | node_type tinyint NULL, |
| | | target_node_code nvarchar(100) NULL, |
| | | target_node_name nvarchar(100) NULL, |
| | | approver nvarchar(40) NULL, |
| | | cooperate_type tinyint DEFAULT('0') NULL, |
| | | collaborator nvarchar(40) NULL, |
| | | skip_type nvarchar(10) NOT NULL, |
| | | flow_status nvarchar(20) NOT NULL, |
| | | form_custom nchar(1) DEFAULT('N') NULL, |
| | | form_path nvarchar(100) NULL, |
| | | message nvarchar(500) NULL, |
| | | variable nvarchar(max) NULL, |
| | | ext nvarchar(500) NULL, |
| | | create_time datetime2(7) NULL, |
| | | update_time datetime2(7) NULL, |
| | | del_flag nchar(1) DEFAULT('0') NULL, |
| | | tenant_id nvarchar(40) NULL, |
| | | CONSTRAINT PK__flow_his__3213E83F67951564 PRIMARY KEY CLUSTERED (id) |
| | | WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) |
| | | ON [PRIMARY] |
| | | ) |
| | | ON [PRIMARY] |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'主é®id', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_his_task', |
| | | 'COLUMN', N'id' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'对åºflow_definition表çid', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_his_task', |
| | | 'COLUMN', N'definition_id' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'对åºflow_instance表çid', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_his_task', |
| | | 'COLUMN', N'instance_id' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'对åºflow_task表çid', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_his_task', |
| | | 'COLUMN', N'task_id' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'å¼å§èç¹ç¼ç ', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_his_task', |
| | | 'COLUMN', N'node_code' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'å¼å§èç¹åç§°', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_his_task', |
| | | 'COLUMN', N'node_name' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'å¼å§èç¹ç±»åï¼0å¼å§èç¹ 1ä¸é´èç¹ 2ç»æèç¹ 3äºæ¥ç½å
³ 4å¹¶è¡ç½å
³ï¼', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_his_task', |
| | | 'COLUMN', N'node_type' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'ç®æ èç¹ç¼ç ', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_his_task', |
| | | 'COLUMN', N'target_node_code' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'ç»æèç¹åç§°', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_his_task', |
| | | 'COLUMN', N'target_node_name' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'审æ¹è
', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_his_task', |
| | | 'COLUMN', N'approver' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'å使¹å¼(1å®¡æ¹ 2转å 3å§æ´¾ 4ä¼ç¾ 5ç¥¨ç¾ 6å ç¾ 7åç¾)', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_his_task', |
| | | 'COLUMN', N'cooperate_type' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'åä½äºº', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_his_task', |
| | | 'COLUMN', N'collaborator' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'æµè½¬ç±»åï¼PASSéè¿ REJECTéå NONEæ å¨ä½ï¼', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_his_task', |
| | | 'COLUMN', N'skip_type' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'æµç¨ç¶æï¼1审æ¹ä¸ 2 审æ¹éè¿ 9å·²éå 10失æï¼', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_his_task', |
| | | 'COLUMN', N'flow_status' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'审æ¹è¡¨åæ¯å¦èªå®ä¹ï¼Yæ¯ Nå¦ï¼', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_his_task', |
| | | 'COLUMN', N'form_custom' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'审æ¹è¡¨åè·¯å¾', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_his_task', |
| | | 'COLUMN', N'form_path' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'å®¡æ¹æè§', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_his_task', |
| | | 'COLUMN', N'message' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'ä»»å¡åé', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_his_task', |
| | | 'COLUMN', N'variable' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'ä¸å¡è¯¦æ
åä¸å¡è¡¨å¯¹è±¡jsonå符串', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_his_task', |
| | | 'COLUMN', N'ext' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'ä»»å¡å¼å§æ¶é´', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_his_task', |
| | | 'COLUMN', N'create_time' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'审æ¹å®ææ¶é´', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_his_task', |
| | | 'COLUMN', N'update_time' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'å 餿 å¿', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_his_task', |
| | | 'COLUMN', N'del_flag' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'ç§æ·id', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_his_task', |
| | | 'COLUMN', N'tenant_id' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'åå²ä»»å¡è®°å½è¡¨', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_his_task' |
| | | GO |
| | | |
| | | CREATE TABLE flow_user ( |
| | | id bigint NOT NULL, |
| | | type nchar(1) NOT NULL, |
| | | processed_by nvarchar(80) NULL, |
| | | associated bigint NOT NULL, |
| | | create_time datetime2(7) NULL, |
| | | create_by nvarchar(80) NULL, |
| | | update_time datetime2(7) NULL, |
| | | del_flag nchar(1) DEFAULT('0') NULL, |
| | | tenant_id nvarchar(40) NULL, |
| | | CONSTRAINT PK__flow_use__3213E83FFA38CA8B PRIMARY KEY CLUSTERED (id) |
| | | WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) |
| | | ON [PRIMARY] |
| | | ) |
| | | ON [PRIMARY] |
| | | GO |
| | | |
| | | CREATE NONCLUSTERED INDEX user_processed_type ON flow_user (processed_by ASC, type ASC) |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'主é®id', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_user', |
| | | 'COLUMN', N'id' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'人åç±»åï¼1å¾
åä»»å¡ç审æ¹äººæé 2å¾
åä»»å¡ç转å人æé 3å¾
åä»»å¡çå§æäººæéï¼', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_user', |
| | | 'COLUMN', N'type' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'æé人', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_user', |
| | | 'COLUMN', N'processed_by' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'ä»»å¡è¡¨id', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_user', |
| | | 'COLUMN', N'associated' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'å建æ¶é´', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_user', |
| | | 'COLUMN', N'create_time' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'å建人', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_user', |
| | | 'COLUMN', N'create_by' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'æ´æ°æ¶é´', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_user', |
| | | 'COLUMN', N'update_time' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'å 餿 å¿', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_user', |
| | | 'COLUMN', N'del_flag' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'ç§æ·id', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_user', |
| | | 'COLUMN', N'tenant_id' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'æµç¨ç¨æ·è¡¨', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_user' |
| | | GO |
| | | |
| | | CREATE TABLE flow_category ( |
| | | category_id bigint NOT NULL, |
| | | tenant_id nvarchar(20) DEFAULT('000000') NULL, |
| | | parent_id bigint DEFAULT(0) NULL, |
| | | ancestors nvarchar(500) DEFAULT('') NULL, |
| | | category_name nvarchar(30) NOT NULL, |
| | | order_num int DEFAULT(0) NULL, |
| | | del_flag nchar(1) DEFAULT('0') NULL, |
| | | create_dept bigint NULL, |
| | | create_by bigint NULL, |
| | | create_time datetime2(7) NULL, |
| | | update_by bigint NULL, |
| | | update_time datetime2(7) NULL, |
| | | CONSTRAINT PK__flow_cat__D54EE9B4AE98B9C1 PRIMARY KEY CLUSTERED (category_id) |
| | | WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) |
| | | ON [PRIMARY] |
| | | ) |
| | | ON [PRIMARY] |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'æµç¨åç±»ID', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_category', |
| | | 'COLUMN', N'category_id' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'ç§æ·ç¼å·', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_category', |
| | | 'COLUMN', N'tenant_id' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'ç¶æµç¨åç±»id', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_category', |
| | | 'COLUMN', N'parent_id' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'ç¥çº§å表', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_category', |
| | | 'COLUMN', N'ancestors' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'æµç¨åç±»åç§°', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_category', |
| | | 'COLUMN', N'category_name' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'æ¾ç¤ºé¡ºåº', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_category', |
| | | 'COLUMN', N'order_num' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'å 餿 å¿ï¼0代表åå¨ 1代表å é¤ï¼', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_category', |
| | | 'COLUMN', N'del_flag' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'å建é¨é¨', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_category', |
| | | 'COLUMN', N'create_dept' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'å建è
', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_category', |
| | | 'COLUMN', N'create_by' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'å建æ¶é´', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_category', |
| | | 'COLUMN', N'create_time' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'æ´æ°è
', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_category', |
| | | 'COLUMN', N'update_by' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'æ´æ°æ¶é´', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_category', |
| | | 'COLUMN', N'update_time' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'æµç¨åç±»', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'flow_category' |
| | | GO |
| | | |
| | | INSERT flow_category VALUES (100, N'000000', 0, N'0', N'OA审æ¹', 0, N'0', 103, 1, getdate(), NULL, NULL); |
| | | GO |
| | | INSERT flow_category VALUES (101, N'000000', 100, N'0,100', N'åå¤ç®¡ç', 0, N'0', 103, 1, getdate(), NULL, NULL); |
| | | GO |
| | | INSERT flow_category VALUES (102, N'000000', 100, N'0,100', N'人äºç®¡ç', 1, N'0', 103, 1, getdate(), NULL, NULL); |
| | | GO |
| | | INSERT flow_category VALUES (103, N'000000', 101, N'0,100,101', N'请å', 0, N'0', 103, 1, getdate(), NULL, NULL); |
| | | GO |
| | | INSERT flow_category VALUES (104, N'000000', 101, N'0,100,101', N'åºå·®', 1, N'0', 103, 1, getdate(), NULL, NULL); |
| | | GO |
| | | INSERT flow_category VALUES (105, N'000000', 101, N'0,100,101', N'å ç', 2, N'0', 103, 1, getdate(), NULL, NULL); |
| | | GO |
| | | INSERT flow_category VALUES (106, N'000000', 101, N'0,100,101', N'æ¢ç', 3, N'0', 103, 1, getdate(), NULL, NULL); |
| | | GO |
| | | INSERT flow_category VALUES (107, N'000000', 101, N'0,100,101', N'å¤åº', 4, N'0', 103, 1, getdate(), NULL, NULL); |
| | | GO |
| | | INSERT flow_category VALUES (108, N'000000', 102, N'0,100,102', N'转æ£', 1, N'0', 103, 1, getdate(), NULL, NULL); |
| | | GO |
| | | INSERT flow_category VALUES (109, N'000000', 102, N'0,100,102', N'离è', 2, N'0', 103, 1, getdate(), NULL, NULL); |
| | | GO |
| | | |
| | | CREATE TABLE test_leave ( |
| | | id bigint NOT NULL, |
| | | tenant_id nvarchar(20) DEFAULT('000000') NULL, |
| | | leave_type nvarchar(255) NOT NULL, |
| | | start_date datetime2(7) NOT NULL, |
| | | end_date datetime2(7) NOT NULL, |
| | | leave_days int NOT NULL, |
| | | remark nvarchar(255) NULL, |
| | | status nvarchar(255) NULL, |
| | | create_dept bigint NULL, |
| | | create_by bigint NULL, |
| | | create_time datetime2(7) NULL, |
| | | update_by bigint NULL, |
| | | update_time datetime2(7) NULL, |
| | | CONSTRAINT PK__test_lea__3213E83F348788FA PRIMARY KEY CLUSTERED (id) |
| | | WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) |
| | | ON [PRIMARY] |
| | | ) |
| | | ON [PRIMARY] |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'id', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'test_leave', |
| | | 'COLUMN', N'id' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'ç§æ·ç¼å·', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'test_leave', |
| | | 'COLUMN', N'tenant_id' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'请åç±»å', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'test_leave', |
| | | 'COLUMN', N'leave_type' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'å¼å§æ¶é´', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'test_leave', |
| | | 'COLUMN', N'start_date' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'ç»ææ¶é´', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'test_leave', |
| | | 'COLUMN', N'end_date' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'请å天æ°', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'test_leave', |
| | | 'COLUMN', N'leave_days' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'请ååå ', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'test_leave', |
| | | 'COLUMN', N'remark' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'ç¶æ', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'test_leave', |
| | | 'COLUMN', N'status' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'å建é¨é¨', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'test_leave', |
| | | 'COLUMN', N'create_dept' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'å建è
', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'test_leave', |
| | | 'COLUMN', N'create_by' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'å建æ¶é´', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'test_leave', |
| | | 'COLUMN', N'create_time' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'æ´æ°è
', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'test_leave', |
| | | 'COLUMN', N'update_by' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'æ´æ°æ¶é´', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'test_leave', |
| | | 'COLUMN', N'update_time' |
| | | GO |
| | | |
| | | EXEC sp_addextendedproperty |
| | | 'MS_Description', N'请åç³è¯·è¡¨', |
| | | 'SCHEMA', N'dbo', |
| | | 'TABLE', N'test_leave' |
| | | GO |
| | | |
| | | INSERT sys_menu VALUES (11616, N'工使µ', 0, 6, N'workflow', NULL, N'', 1, 0, N'M', N'0', N'0', N'', N'workflow', 103, 1, GETDATE(), NULL, NULL, N''); |
| | | GO |
| | | INSERT sys_menu VALUES (11618, N'æçä»»å¡', 0, 7, N'task', NULL, N'', 1, 0, N'M', N'0', N'0', N'', N'my-task', 103, 1, GETDATE(), NULL, NULL, N''); |
| | | GO |
| | | INSERT sys_menu VALUES (11619, N'æçå¾
å', 11618, 2, N'taskWaiting', N'workflow/task/taskWaiting', N'', 1, 1, N'C', N'0', N'0', N'', N'waiting', 103, 1, GETDATE(), NULL, NULL, N''); |
| | | GO |
| | | INSERT sys_menu VALUES (11632, N'æçå·²å', 11618, 3, N'taskFinish', N'workflow/task/taskFinish', N'', 1, 1, N'C', N'0', N'0', N'', N'finish', 103, 1, GETDATE(), NULL, NULL, N''); |
| | | GO |
| | | INSERT sys_menu VALUES (11633, N'æçæé', 11618, 4, N'taskCopyList', N'workflow/task/taskCopyList', N'', 1, 1, N'C', N'0', N'0', N'', N'my-copy', 103, 1, GETDATE(), NULL, NULL, N''); |
| | | GO |
| | | INSERT sys_menu VALUES (11620, N'æµç¨å®ä¹', 11616, 3, N'processDefinition', N'workflow/processDefinition/index', N'', 1, 1, N'C', N'0', N'0', N'', N'process-definition', 103, 1, GETDATE(), NULL, NULL, N''); |
| | | GO |
| | | INSERT sys_menu VALUES (11621, N'æµç¨å®ä¾', 11630, 1, N'processInstance', N'workflow/processInstance/index', N'', 1, 1, N'C', N'0', N'0', N'', N'tree-table', 103, 1, GETDATE(), NULL, NULL, N''); |
| | | GO |
| | | INSERT sys_menu VALUES (11622, N'æµç¨åç±»', 11616, 1, N'category', N'workflow/category/index', N'', 1, 0, N'C', N'0', N'0', N'workflow:category:list', N'category', 103, 1, GETDATE(), NULL, NULL, N''); |
| | | GO |
| | | INSERT sys_menu VALUES (11629, N'æåèµ·ç', 11618, 1, N'myDocument', N'workflow/task/myDocument', N'', 1, 1, N'C', N'0', N'0', N'', N'guide', 103, 1, GETDATE(), NULL, NULL, N''); |
| | | GO |
| | | INSERT sys_menu VALUES (11630, N'æµç¨çæ§', 11616, 4, N'monitor', NULL, N'', 1, 0, N'M', N'0', N'0', N'', N'monitor', 103, 1, GETDATE(), NULL, NULL, N''); |
| | | GO |
| | | INSERT sys_menu VALUES (11631, N'å¾
åä»»å¡', 11630, 2, N'allTaskWaiting', N'workflow/task/allTaskWaiting', N'', 1, 1, N'C', N'0', N'0', N'', N'waiting', 103, 1, GETDATE(), NULL, NULL, N''); |
| | | GO |
| | | |
| | | -- æµç¨å类管çç¸å
³æé® |
| | | INSERT sys_menu VALUES (11623, N'æµç¨åç±»æ¥è¯¢', 11622, 1, N'#', N'', N'', 1, 0, N'F', N'0', N'0', N'workflow:category:query', N'#', 103, 1, GETDATE(), NULL, NULL, N''); |
| | | GO |
| | | INSERT sys_menu VALUES (11624, N'æµç¨åç±»æ°å¢', 11622, 2, N'#', N'', N'', 1, 0, N'F', N'0', N'0', N'workflow:category:add', N'#', 103, 1, GETDATE(), NULL, NULL, N''); |
| | | GO |
| | | INSERT sys_menu VALUES (11625, N'æµç¨å类修æ¹', 11622, 3, N'#', N'', N'', 1, 0, N'F', N'0', N'0', N'workflow:category:edit', N'#', 103, 1, GETDATE(), NULL, NULL, N''); |
| | | GO |
| | | INSERT sys_menu VALUES (11626, N'æµç¨åç±»å é¤', 11622, 4, N'#', N'', N'', 1, 0, N'F', N'0', N'0', N'workflow:category:remove', N'#', 103, 1, GETDATE(), NULL, NULL, N''); |
| | | GO |
| | | INSERT sys_menu VALUES (11627, N'æµç¨å类导åº', 11622, 5, N'#', N'', N'', 1, 0, N'F', N'0', N'0', N'workflow:category:export', N'#', 103, 1, GETDATE(), NULL, NULL, N''); |
| | | GO |
| | | |
| | | -- è¯·åæµè¯ç¸å
³æé® |
| | | INSERT sys_menu VALUES (11638, N'请åç³è¯·', 5, 1, N'leave', N'workflow/leave/index', N'', 1, 0, N'C', N'0', N'0', N'workflow:leave:list', N'#', 103, 1, GETDATE(), NULL, NULL, N'请åç³è¯·èå'); |
| | | GO |
| | | INSERT sys_menu VALUES (11639, N'请åç³è¯·æ¥è¯¢', 11638, 1, N'#', N'', N'', 1, 0, N'F', N'0', N'0', N'workflow:leave:query', N'#', 103, 1, GETDATE(), NULL, NULL, N''); |
| | | GO |
| | | INSERT sys_menu VALUES (11640, N'请åç³è¯·æ°å¢', 11638, 2, N'#', N'', N'', 1, 0, N'F', N'0', N'0', N'workflow:leave:add', N'#', 103, 1, GETDATE(), NULL, NULL, N''); |
| | | GO |
| | | INSERT sys_menu VALUES (11641, N'请åç³è¯·ä¿®æ¹', 11638, 3, N'#', N'', N'', 1, 0, N'F', N'0', N'0', N'workflow:leave:edit', N'#', 103, 1, GETDATE(), NULL, NULL, N''); |
| | | GO |
| | | INSERT sys_menu VALUES (11642, N'请åç³è¯·å é¤', 11638, 4, N'#', N'', N'', 1, 0, N'F', N'0', N'0', N'workflow:leave:remove', N'#', 103, 1, GETDATE(), NULL, NULL, N''); |
| | | GO |
| | | INSERT sys_menu VALUES (11643, N'请åç³è¯·å¯¼åº', 11638, 5, N'#', N'', N'', 1, 0, N'F', N'0', N'0', N'workflow:leave:export', N'#', 103, 1, GETDATE(), NULL, NULL, N''); |
| | | |
| | | INSERT sys_dict_type VALUES (13, N'000000', N'ä¸å¡ç¶æ', N'wf_business_status', 103, 1, GETDATE(), NULL, NULL, N'ä¸å¡ç¶æå表'); |
| | | GO |
| | | INSERT sys_dict_type VALUES (14, N'000000', N'表åç±»å', N'wf_form_type', 103, 1, GETDATE(), NULL, NULL, N'表åç±»åå表'); |
| | | GO |
| | | INSERT sys_dict_type VALUES (15, N'000000', N'ä»»å¡ç¶æ', N'wf_task_status', 103, 1, GETDATE(), NULL, NULL, N'ä»»å¡ç¶æ'); |
| | | GO |
| | | |
| | | INSERT sys_dict_data VALUES (39, N'000000', 1, N'å·²æ¤é', N'cancel', N'wf_business_status', N'', N'danger', N'N', 103, 1, GETDATE(), NULL, NULL, N'å·²æ¤é'); |
| | | GO |
| | | INSERT sys_dict_data VALUES (40, N'000000', 2, N'è稿', N'draft', N'wf_business_status', N'', N'info', N'N', 103, 1, GETDATE(), NULL, NULL, N'è稿'); |
| | | GO |
| | | INSERT sys_dict_data VALUES (41, N'000000', 3, N'å¾
å®¡æ ¸', N'waiting', N'wf_business_status', N'', N'primary', N'N', 103, 1, GETDATE(), NULL, NULL, N'å¾
å®¡æ ¸'); |
| | | GO |
| | | INSERT sys_dict_data VALUES (42, N'000000', 4, N'已宿', N'finish', N'wf_business_status', N'', N'success', N'N', 103, 1, GETDATE(), NULL, NULL, N'已宿'); |
| | | GO |
| | | INSERT sys_dict_data VALUES (43, N'000000', 5, N'å·²ä½åº', N'invalid', N'wf_business_status', N'', N'danger', N'N', 103, 1, GETDATE(), NULL, NULL, N'å·²ä½åº'); |
| | | GO |
| | | INSERT sys_dict_data VALUES (44, N'000000', 6, N'å·²éå', N'back', N'wf_business_status', N'', N'danger', N'N', 103, 1, GETDATE(), NULL, NULL, N'å·²éå'); |
| | | GO |
| | | INSERT sys_dict_data VALUES (45, N'000000', 7, N'å·²ç»æ¢', N'termination', N'wf_business_status', N'', N'danger', N'N', 103, 1, GETDATE(), NULL, NULL, N'å·²ç»æ¢'); |
| | | GO |
| | | INSERT sys_dict_data VALUES (46, N'000000', 1, N'èªå®ä¹è¡¨å', N'static', N'wf_form_type', N'', N'success', N'N', 103, 1, GETDATE(), NULL, NULL, N'èªå®ä¹è¡¨å'); |
| | | GO |
| | | INSERT sys_dict_data VALUES (47, N'000000', 2, N'å¨æè¡¨å', N'dynamic', N'wf_form_type', N'', N'primary', N'N', 103, 1, GETDATE(), NULL, NULL, N'å¨æè¡¨å'); |
| | | GO |
| | | INSERT sys_dict_data VALUES (48, N'000000', 1, N'æ¤é', N'cancel', N'wf_task_status', N'', N'danger', N'N', 103, 1, GETDATE(), NULL, NULL, N'æ¤é'); |
| | | GO |
| | | INSERT sys_dict_data VALUES (49, N'000000', 2, N'éè¿', N'pass', N'wf_task_status', N'', N'success', N'N', 103, 1, GETDATE(), NULL, NULL, N'éè¿'); |
| | | GO |
| | | INSERT sys_dict_data VALUES (50, N'000000', 3, N'å¾
å®¡æ ¸', N'waiting', N'wf_task_status', N'', N'primary', N'N', 103, 1, GETDATE(), NULL, NULL, N'å¾
å®¡æ ¸'); |
| | | GO |
| | | INSERT sys_dict_data VALUES (51, N'000000', 4, N'ä½åº', N'invalid', N'wf_task_status', N'', N'danger', N'N', 103, 1, GETDATE(), NULL, NULL, N'ä½åº'); |
| | | GO |
| | | INSERT sys_dict_data VALUES (52, N'000000', 5, N'éå', N'back', N'wf_task_status', N'', N'danger', N'N', 103, 1, GETDATE(), NULL, NULL, N'éå'); |
| | | GO |
| | | INSERT sys_dict_data VALUES (53, N'000000', 6, N'ç»æ¢', N'termination', N'wf_task_status', N'', N'danger', N'N', 103, 1, GETDATE(), NULL, NULL, N'ç»æ¢'); |
| | | GO |
| | | INSERT sys_dict_data VALUES (54, N'000000', 7, N'转å', N'transfer', N'wf_task_status', N'', N'primary', N'N', 103, 1, GETDATE(), NULL, NULL, N'转å'); |
| | | GO |
| | | INSERT sys_dict_data VALUES (55, N'000000', 8, N'å§æ', N'depute', N'wf_task_status', N'', N'primary', N'N', 103, 1, GETDATE(), NULL, NULL, N'å§æ'); |
| | | GO |
| | | INSERT sys_dict_data VALUES (56, N'000000', 9, N'æé', N'copy', N'wf_task_status', N'', N'primary', N'N', 103, 1, GETDATE(), NULL, NULL, N'æé'); |
| | | GO |
| | | INSERT sys_dict_data VALUES (57, N'000000', 10, N'å ç¾', N'sign', N'wf_task_status', N'', N'primary', N'N', 103, 1, GETDATE(), NULL, NULL, N'å ç¾'); |
| | | GO |
| | | INSERT sys_dict_data VALUES (58, N'000000', 11, N'åç¾', N'sign_off', N'wf_task_status', N'', N'danger', N'N', 103, 1, GETDATE(), NULL, NULL, N'åç¾'); |
| | | GO |
| | | INSERT sys_dict_data VALUES (59, N'000000', 11, N'è¶
æ¶', N'timeout', N'wf_task_status', N'', N'danger', N'N', 103, 1, GETDATE(), NULL, NULL, N'è¶
æ¶'); |
| | | GO |