diff --git a/.run/ruoyi-workflow.run.xml b/.run/ruoyi-workflow.run.xml new file mode 100644 index 00000000..4d1d25c5 --- /dev/null +++ b/.run/ruoyi-workflow.run.xml @@ -0,0 +1,12 @@ + + + + + + + + + diff --git a/config/nacos/ruoyi-workflow.yml b/config/nacos/ruoyi-workflow.yml index d87a2119..ed817040 100644 --- a/config/nacos/ruoyi-workflow.yml +++ b/config/nacos/ruoyi-workflow.yml @@ -3,7 +3,6 @@ spring: dynamic: # 设置默认的数据源或者数据源组,默认值即为 master primary: master - seata: false datasource: # 主库数据源 master: diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index d8bab5e6..b3b85954 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -275,6 +275,22 @@ services: privileged: true network_mode: "host" + ruoyi-workflow: + image: ruoyi/ruoyi-workflow:2.2.0 + container_name: ruoyi-workflow + environment: + # 时区上海 + TZ: Asia/Shanghai + ports: + - "9205:9205" + volumes: + # 配置文件 + - /docker/ruoyi-workflow/logs/:/ruoyi/workflow/logs + # skywalking 探针 + - /docker/skywalking/agent/:/ruoyi/skywalking/agent + privileged: true + network_mode: "host" + ################################################################################################# #################################### 以下为扩展根据需求搭建 ######################################### diff --git a/pom.xml b/pom.xml index a1285710..50b811a1 100644 --- a/pom.xml +++ b/pom.xml @@ -57,16 +57,13 @@ 3.2.1 + + 7.0.0 3.11.0 3.1.2 1.3.0 - - - 7.0.0 - 6.8.0 - 1.10 @@ -174,19 +171,6 @@ import - - org.flowable - flowable-json-converter - ${flowable-json-convertor.version} - - - - - org.apache.xmlgraphics - batik-all - ${xmlgraphics.version} - - cn.dev33 sa-token-core diff --git a/ruoyi-api/ruoyi-api-system/src/main/java/org/dromara/system/api/RemoteUserService.java b/ruoyi-api/ruoyi-api-system/src/main/java/org/dromara/system/api/RemoteUserService.java index a03241ea..b71eaa85 100644 --- a/ruoyi-api/ruoyi-api-system/src/main/java/org/dromara/system/api/RemoteUserService.java +++ b/ruoyi-api/ruoyi-api-system/src/main/java/org/dromara/system/api/RemoteUserService.java @@ -3,7 +3,7 @@ package org.dromara.system.api; import org.dromara.common.core.exception.ServiceException; import org.dromara.common.core.exception.user.UserException; import org.dromara.system.api.domain.bo.RemoteUserBo; -import org.dromara.system.api.domain.dto.UserDTO; +import org.dromara.system.api.domain.vo.RemoteUserVo; import org.dromara.system.api.model.LoginUser; import org.dromara.system.api.model.XcxLoginUser; @@ -84,6 +84,14 @@ public interface RemoteUserService { */ String selectNicknameById(Long userId); + /** + * 通过用户ID查询用户账户 + * + * @param userIds 用户ID 多个用逗号隔开 + * @return 用户名称 + */ + String selectNicknameByIds(String userIds); + /** * 通过用户ID查询用户手机号 * @@ -114,7 +122,7 @@ public interface RemoteUserService { * @param userIds 用户ids * @return 用户列表 */ - List selectListByIds(List userIds); + List selectListByIds(List userIds); /** * 通过角色ID查询用户ID diff --git a/ruoyi-api/ruoyi-api-system/src/main/java/org/dromara/system/api/domain/dto/UserDTO.java b/ruoyi-api/ruoyi-api-system/src/main/java/org/dromara/system/api/domain/vo/RemoteUserVo.java similarity index 91% rename from ruoyi-api/ruoyi-api-system/src/main/java/org/dromara/system/api/domain/dto/UserDTO.java rename to ruoyi-api/ruoyi-api-system/src/main/java/org/dromara/system/api/domain/vo/RemoteUserVo.java index 6badbb61..fb7f589c 100644 --- a/ruoyi-api/ruoyi-api-system/src/main/java/org/dromara/system/api/domain/dto/UserDTO.java +++ b/ruoyi-api/ruoyi-api-system/src/main/java/org/dromara/system/api/domain/vo/RemoteUserVo.java @@ -1,4 +1,4 @@ -package org.dromara.system.api.domain.dto; +package org.dromara.system.api.domain.vo; import lombok.Data; import lombok.NoArgsConstructor; @@ -15,7 +15,7 @@ import java.util.Date; */ @Data @NoArgsConstructor -public class UserDTO implements Serializable { +public class RemoteUserVo implements Serializable { @Serial private static final long serialVersionUID = 1L; diff --git a/ruoyi-api/ruoyi-api-workflow/pom.xml b/ruoyi-api/ruoyi-api-workflow/pom.xml index 13992051..5e9df772 100644 --- a/ruoyi-api/ruoyi-api-workflow/pom.xml +++ b/ruoyi-api/ruoyi-api-workflow/pom.xml @@ -12,7 +12,7 @@ ruoyi-api-workflow - ruoyi-api-resource 资源服务接口模块 + ruoyi-api-workflow 工作流接口模块 @@ -23,11 +23,6 @@ ruoyi-common-core - - org.dromara - ruoyi-common-translation - - diff --git a/ruoyi-api/ruoyi-api-workflow/src/main/java/org/dromara/workflow/api/domain/RemoteWorkflowService.java b/ruoyi-api/ruoyi-api-workflow/src/main/java/org/dromara/workflow/api/domain/RemoteWorkflowService.java index 1a61d511..6f9af618 100644 --- a/ruoyi-api/ruoyi-api-workflow/src/main/java/org/dromara/workflow/api/domain/RemoteWorkflowService.java +++ b/ruoyi-api/ruoyi-api-workflow/src/main/java/org/dromara/workflow/api/domain/RemoteWorkflowService.java @@ -1,7 +1,5 @@ package org.dromara.workflow.api.domain; -import org.dromara.workflow.api.domain.dto.BusinessInstanceDTO; - import java.util.List; import java.util.Map; @@ -35,20 +33,6 @@ public interface RemoteWorkflowService { */ String getBusinessStatus(String businessKey); - /** - * 获取流程实例对象 - * - * @param businessKey 业务id - */ - BusinessInstanceDTO getBusinessInstance(String businessKey); - - /** - * 获取流程实例对象 - * - * @param businessKeys 业务id集合 - */ - List getBusinessInstance(List businessKeys); - /** * 设置流程变量(全局变量) * diff --git a/ruoyi-api/ruoyi-api-workflow/src/main/java/org/dromara/workflow/api/domain/dto/BusinessInstanceDTO.java b/ruoyi-api/ruoyi-api-workflow/src/main/java/org/dromara/workflow/api/domain/dto/BusinessInstanceDTO.java deleted file mode 100644 index 30c3e5de..00000000 --- a/ruoyi-api/ruoyi-api-workflow/src/main/java/org/dromara/workflow/api/domain/dto/BusinessInstanceDTO.java +++ /dev/null @@ -1,72 +0,0 @@ -package org.dromara.workflow.api.domain.dto; - -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.io.Serial; -import java.io.Serializable; -import java.util.Date; - -/** - * 业务与流程实例关联对象 - * - * @Author ZETA - * @Date 2024/6/3 - */ -@Data -@NoArgsConstructor -public class BusinessInstanceDTO implements Serializable { - - @Serial - private static final long serialVersionUID = 1L; - - /** - * 流程实例id - */ - private String id; - - /** - * 流程定义id - */ - private String processDefinitionId; - - /** - * 流程定义名称 - */ - private String name; - - /** - * 业务id - */ - private String businessKey; - - /** - * 租户id - */ - private String tenantId; - - /** - * 启动时间 - */ - private Date startTime; - - /** - * 结束时间 - */ - private Date endTime; - - /** - * 启动人id - */ - private String startUserId; - - /** - * 流程状态 - */ - private String businessStatus; - - /** - * 流程状态 - */ - private String businessStatusName; -} diff --git a/ruoyi-api/ruoyi-api-workflow/src/main/java/org/dromara/workflow/api/domain/event/ProcessEvent.java b/ruoyi-api/ruoyi-api-workflow/src/main/java/org/dromara/workflow/api/domain/event/ProcessEvent.java index e758ffe0..5b7b121f 100644 --- a/ruoyi-api/ruoyi-api-workflow/src/main/java/org/dromara/workflow/api/domain/event/ProcessEvent.java +++ b/ruoyi-api/ruoyi-api-workflow/src/main/java/org/dromara/workflow/api/domain/event/ProcessEvent.java @@ -1,6 +1,5 @@ package org.dromara.workflow.api.domain.event; -import jakarta.servlet.http.HttpServletRequest; import lombok.Data; import java.io.Serial; @@ -38,10 +37,4 @@ public class ProcessEvent implements Serializable { */ private boolean submit; - /** - * 请求体 - */ - private HttpServletRequest request; - - } diff --git a/ruoyi-api/ruoyi-api-workflow/src/main/java/org/dromara/workflow/api/domain/event/ProcessTaskEvent.java b/ruoyi-api/ruoyi-api-workflow/src/main/java/org/dromara/workflow/api/domain/event/ProcessTaskEvent.java index e64b994b..8ba2caef 100644 --- a/ruoyi-api/ruoyi-api-workflow/src/main/java/org/dromara/workflow/api/domain/event/ProcessTaskEvent.java +++ b/ruoyi-api/ruoyi-api-workflow/src/main/java/org/dromara/workflow/api/domain/event/ProcessTaskEvent.java @@ -1,6 +1,5 @@ package org.dromara.workflow.api.domain.event; -import jakarta.servlet.http.HttpServletRequest; import lombok.Data; import java.io.Serial; @@ -33,9 +32,4 @@ public class ProcessTaskEvent implements Serializable { */ private String businessKey; - /** - * 请求体 - */ - private HttpServletRequest request; - } diff --git a/ruoyi-common/ruoyi-common-mybatis/src/main/java/org/dromara/common/mybatis/core/page/PageQuery.java b/ruoyi-common/ruoyi-common-mybatis/src/main/java/org/dromara/common/mybatis/core/page/PageQuery.java index b7e18bb3..f66fd165 100644 --- a/ruoyi-common/ruoyi-common-mybatis/src/main/java/org/dromara/common/mybatis/core/page/PageQuery.java +++ b/ruoyi-common/ruoyi-common-mybatis/src/main/java/org/dromara/common/mybatis/core/page/PageQuery.java @@ -58,13 +58,6 @@ public class PageQuery implements Serializable { */ public static final int DEFAULT_PAGE_SIZE = Integer.MAX_VALUE; - public static final PageQuery DEFAULT_PAGE = new PageQuery(DEFAULT_PAGE_NUM, DEFAULT_PAGE_SIZE); - - private PageQuery(Integer pageNum, Integer pageSize) { - this.pageSize = pageSize; - this.pageNum = pageNum; - } - public Page build() { Integer pageNum = ObjectUtil.defaultIfNull(getPageNum(), DEFAULT_PAGE_NUM); Integer pageSize = ObjectUtil.defaultIfNull(getPageSize(), DEFAULT_PAGE_SIZE); diff --git a/ruoyi-common/ruoyi-common-translation/src/main/java/org/dromara/common/translation/core/impl/NicknameTranslationImpl.java b/ruoyi-common/ruoyi-common-translation/src/main/java/org/dromara/common/translation/core/impl/NicknameTranslationImpl.java index 9b60a233..fa53c394 100644 --- a/ruoyi-common/ruoyi-common-translation/src/main/java/org/dromara/common/translation/core/impl/NicknameTranslationImpl.java +++ b/ruoyi-common/ruoyi-common-translation/src/main/java/org/dromara/common/translation/core/impl/NicknameTranslationImpl.java @@ -21,6 +21,11 @@ public class NicknameTranslationImpl implements TranslationInterface { @Override public String translation(Object key, String other) { - return remoteUserService.selectNicknameById(Long.valueOf(String.valueOf(key))); + if (key instanceof Long id) { + return remoteUserService.selectNicknameByIds(id.toString()); + } else if (key instanceof String ids) { + return remoteUserService.selectNicknameByIds(ids); + } + return null; } } diff --git a/ruoyi-modules/ruoyi-resource/src/main/java/org/dromara/resource/domain/convert/SysOssVoConvert.java b/ruoyi-modules/ruoyi-resource/src/main/java/org/dromara/resource/domain/convert/SysOssVoConvert.java new file mode 100644 index 00000000..d4f95620 --- /dev/null +++ b/ruoyi-modules/ruoyi-resource/src/main/java/org/dromara/resource/domain/convert/SysOssVoConvert.java @@ -0,0 +1,21 @@ +package org.dromara.resource.domain.convert; + +import io.github.linpeilie.BaseMapper; +import org.dromara.resource.api.domain.RemoteFile; +import org.dromara.resource.domain.vo.SysOssVo; +import org.mapstruct.Mapper; +import org.mapstruct.Mapping; +import org.mapstruct.MappingConstants; +import org.mapstruct.ReportingPolicy; + +/** + * 用户信息转换器 + * @author zhujie + */ +@Mapper(componentModel = MappingConstants.ComponentModel.SPRING, unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface SysOssVoConvert extends BaseMapper { + + @Mapping(target = "fileName", source = "name") + RemoteFile convert(SysOssVo sysOssVo); + +} diff --git a/ruoyi-modules/ruoyi-resource/src/main/java/org/dromara/resource/dubbo/RemoteFileServiceImpl.java b/ruoyi-modules/ruoyi-resource/src/main/java/org/dromara/resource/dubbo/RemoteFileServiceImpl.java index e9fed20a..f3fe1478 100644 --- a/ruoyi-modules/ruoyi-resource/src/main/java/org/dromara/resource/dubbo/RemoteFileServiceImpl.java +++ b/ruoyi-modules/ruoyi-resource/src/main/java/org/dromara/resource/dubbo/RemoteFileServiceImpl.java @@ -1,26 +1,24 @@ package org.dromara.resource.dubbo; -import cn.hutool.core.bean.BeanUtil; -import cn.hutool.core.bean.copier.CopyOptions; import cn.hutool.core.convert.Convert; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.dubbo.config.annotation.DubboService; import org.dromara.common.core.exception.ServiceException; +import org.dromara.common.core.utils.MapstructUtils; import org.dromara.common.core.utils.StringUtils; import org.dromara.common.oss.core.OssClient; import org.dromara.common.oss.entity.UploadResult; import org.dromara.common.oss.factory.OssFactory; import org.dromara.resource.api.RemoteFileService; +import org.dromara.resource.api.domain.RemoteFile; import org.dromara.resource.domain.bo.SysOssBo; import org.dromara.resource.domain.vo.SysOssVo; import org.dromara.resource.service.ISysOssService; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.apache.dubbo.config.annotation.DubboService; -import org.dromara.resource.api.domain.RemoteFile; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.List; -import java.util.Map; /** * 文件请求处理 @@ -57,6 +55,8 @@ public class RemoteFileServiceImpl implements RemoteFileService { sysFile.setOssId(oss.getOssId()); sysFile.setName(uploadResult.getFilename()); sysFile.setUrl(uploadResult.getUrl()); + sysFile.setOriginalName(originalFilename); + sysFile.setFileSuffix(suffix); return sysFile; } catch (Exception e) { log.error("上传文件失败", e); @@ -83,7 +83,6 @@ public class RemoteFileServiceImpl implements RemoteFileService { */ public List selectByIds(String ossIds){ List sysOssVos = sysOssService.listByIds(StringUtils.splitTo(ossIds, Convert::toLong)); - return BeanUtil.copyToList(sysOssVos, RemoteFile.class, - CopyOptions.create().setFieldMapping(Map.of("fileName", "name"))); + return MapstructUtils.convert(sysOssVos, RemoteFile.class); } } diff --git a/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/domain/convert/SysUserVoConvert.java b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/domain/convert/SysUserVoConvert.java new file mode 100644 index 00000000..d158031f --- /dev/null +++ b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/domain/convert/SysUserVoConvert.java @@ -0,0 +1,17 @@ +package org.dromara.system.domain.convert; + +import io.github.linpeilie.BaseMapper; +import org.dromara.system.api.domain.vo.RemoteUserVo; +import org.dromara.system.domain.vo.SysUserVo; +import org.mapstruct.Mapper; +import org.mapstruct.MappingConstants; +import org.mapstruct.ReportingPolicy; + +/** + * 租户转换器 + * @author zhujie + */ +@Mapper(componentModel = MappingConstants.ComponentModel.SPRING, unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface SysUserVoConvert extends BaseMapper { + +} diff --git a/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/dubbo/RemoteUserServiceImpl.java b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/dubbo/RemoteUserServiceImpl.java index 60d70f32..6eaa9cf1 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/dubbo/RemoteUserServiceImpl.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/dubbo/RemoteUserServiceImpl.java @@ -1,6 +1,7 @@ package org.dromara.system.dubbo; import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.convert.Convert; import cn.hutool.core.util.ObjectUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import lombok.RequiredArgsConstructor; @@ -10,11 +11,13 @@ import org.dromara.common.core.exception.ServiceException; import org.dromara.common.core.exception.user.UserException; import org.dromara.common.core.utils.DateUtils; 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.mybatis.helper.DataPermissionHelper; import org.dromara.common.tenant.helper.TenantHelper; import org.dromara.system.api.RemoteUserService; import org.dromara.system.api.domain.bo.RemoteUserBo; -import org.dromara.system.api.domain.dto.UserDTO; +import org.dromara.system.api.domain.vo.RemoteUserVo; import org.dromara.system.api.model.LoginUser; import org.dromara.system.api.model.RoleDTO; import org.dromara.system.api.model.XcxLoginUser; @@ -27,6 +30,7 @@ import org.dromara.system.mapper.SysUserMapper; import org.dromara.system.service.*; import org.springframework.stereotype.Service; +import java.util.ArrayList; import java.util.List; /** @@ -170,6 +174,24 @@ public class RemoteUserServiceImpl implements RemoteUserService { return userService.selectNicknameById(userId); } + /** + * 通过用户ID查询用户账户 + * + * @param userIds 用户ID 多个用逗号隔开 + * @return 用户账户 + */ + @Override + public String selectNicknameByIds(String userIds) { + List list = new ArrayList<>(); + for (Long id : StringUtils.splitTo(userIds, Convert::toLong)) { + String nickname = SpringUtils.getAopProxy(this).selectNicknameById(id); + if (StringUtils.isNotBlank(nickname)) { + list.add(nickname); + } + } + return String.join(StringUtils.SEPARATOR, list); + } + /** * 通过用户ID查询用户手机号 * @@ -236,9 +258,9 @@ public class RemoteUserServiceImpl implements RemoteUserService { } @Override - public List selectListByIds(List userIds) { + public List selectListByIds(List userIds) { List sysUserVos = userService.selectUserByIds(userIds, null); - return BeanUtil.copyToList(sysUserVos, UserDTO.class); + return MapstructUtils.convert(sysUserVos, RemoteUserVo.class); } @Override diff --git a/ruoyi-modules/ruoyi-workflow/Dockerfile b/ruoyi-modules/ruoyi-workflow/Dockerfile new file mode 100644 index 00000000..42a0ee94 --- /dev/null +++ b/ruoyi-modules/ruoyi-workflow/Dockerfile @@ -0,0 +1,23 @@ +#FROM findepi/graalvm:java17-native +FROM openjdk:17.0.2-oraclelinux8 + +MAINTAINER Lion Li + +RUN mkdir -p /ruoyi/workflow/logs \ + /ruoyi/workflow/temp \ + /ruoyi/skywalking/agent + +WORKDIR /ruoyi/workflow + +ENV SERVER_PORT=9205 LANG=C.UTF-8 LC_ALL=C.UTF-8 JAVA_OPTS="" + +EXPOSE ${SERVER_PORT} + +ADD ./target/ruoyi-workflow.jar ./app.jar + +ENTRYPOINT java -Djava.security.egd=file:/dev/./urandom -Dserver.port=${SERVER_PORT} \ + #-Dskywalking.agent.service_name=ruoyi-system \ + #-javaagent:/ruoyi/skywalking/agent/skywalking-agent.jar \ + -XX:+HeapDumpOnOutOfMemoryError -XX:+UseZGC ${JAVA_OPTS} \ + -jar app.jar + diff --git a/ruoyi-modules/ruoyi-workflow/pom.xml b/ruoyi-modules/ruoyi-workflow/pom.xml index 479b783d..85dd70ae 100644 --- a/ruoyi-modules/ruoyi-workflow/pom.xml +++ b/ruoyi-modules/ruoyi-workflow/pom.xml @@ -61,6 +61,7 @@ org.apache.xmlgraphics batik-all + 1.10 xalan diff --git a/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/controller/ActProcessInstanceController.java b/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/controller/ActProcessInstanceController.java index db7a2bba..931b9f56 100644 --- a/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/controller/ActProcessInstanceController.java +++ b/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/controller/ActProcessInstanceController.java @@ -11,9 +11,9 @@ 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.workflow.api.domain.bo.ProcessInstanceBo; -import org.dromara.workflow.api.domain.bo.ProcessInvalidBo; -import org.dromara.workflow.api.domain.bo.TaskUrgingBo; +import org.dromara.workflow.domain.bo.ProcessInstanceBo; +import org.dromara.workflow.domain.bo.ProcessInvalidBo; +import org.dromara.workflow.domain.bo.TaskUrgingBo; import org.dromara.workflow.domain.vo.ActHistoryInfoVo; import org.dromara.workflow.domain.vo.ProcessInstanceVo; import org.dromara.workflow.service.IActProcessInstanceService; diff --git a/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/testleave/controller/TestLeaveController.java b/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/controller/TestLeaveController.java similarity index 93% rename from ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/testleave/controller/TestLeaveController.java rename to ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/controller/TestLeaveController.java index f069f389..e1c246f0 100644 --- a/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/testleave/controller/TestLeaveController.java +++ b/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/controller/TestLeaveController.java @@ -1,4 +1,4 @@ -package org.dromara.workflow.testleave.controller; +package org.dromara.workflow.controller; import cn.dev33.satoken.annotation.SaCheckPermission; import jakarta.servlet.http.HttpServletResponse; @@ -15,9 +15,9 @@ 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.workflow.testleave.domain.bo.TestLeaveBo; -import org.dromara.workflow.testleave.domain.vo.TestLeaveVo; -import org.dromara.workflow.testleave.service.ITestLeaveService; +import org.dromara.workflow.domain.bo.TestLeaveBo; +import org.dromara.workflow.domain.vo.TestLeaveVo; +import org.dromara.workflow.service.ITestLeaveService; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; diff --git a/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/testleave/domain/TestLeave.java b/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/domain/TestLeave.java similarity index 95% rename from ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/testleave/domain/TestLeave.java rename to ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/domain/TestLeave.java index e48db561..18e1c8a4 100644 --- a/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/testleave/domain/TestLeave.java +++ b/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/domain/TestLeave.java @@ -1,4 +1,4 @@ -package org.dromara.workflow.testleave.domain; +package org.dromara.workflow.domain; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; diff --git a/ruoyi-api/ruoyi-api-workflow/src/main/java/org/dromara/workflow/api/domain/bo/ProcessInstanceBo.java b/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/domain/bo/ProcessInstanceBo.java similarity index 93% rename from ruoyi-api/ruoyi-api-workflow/src/main/java/org/dromara/workflow/api/domain/bo/ProcessInstanceBo.java rename to ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/domain/bo/ProcessInstanceBo.java index 76d4cb01..2833b3ec 100644 --- a/ruoyi-api/ruoyi-api-workflow/src/main/java/org/dromara/workflow/api/domain/bo/ProcessInstanceBo.java +++ b/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/domain/bo/ProcessInstanceBo.java @@ -1,4 +1,4 @@ -package org.dromara.workflow.api.domain.bo; +package org.dromara.workflow.domain.bo; import lombok.Data; diff --git a/ruoyi-api/ruoyi-api-workflow/src/main/java/org/dromara/workflow/api/domain/bo/ProcessInvalidBo.java b/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/domain/bo/ProcessInvalidBo.java similarity index 92% rename from ruoyi-api/ruoyi-api-workflow/src/main/java/org/dromara/workflow/api/domain/bo/ProcessInvalidBo.java rename to ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/domain/bo/ProcessInvalidBo.java index baf779b5..41e51c2a 100644 --- a/ruoyi-api/ruoyi-api-workflow/src/main/java/org/dromara/workflow/api/domain/bo/ProcessInvalidBo.java +++ b/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/domain/bo/ProcessInvalidBo.java @@ -1,4 +1,4 @@ -package org.dromara.workflow.api.domain.bo; +package org.dromara.workflow.domain.bo; import jakarta.validation.constraints.NotBlank; import lombok.Data; diff --git a/ruoyi-api/ruoyi-api-workflow/src/main/java/org/dromara/workflow/api/domain/bo/TaskUrgingBo.java b/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/domain/bo/TaskUrgingBo.java similarity index 92% rename from ruoyi-api/ruoyi-api-workflow/src/main/java/org/dromara/workflow/api/domain/bo/TaskUrgingBo.java rename to ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/domain/bo/TaskUrgingBo.java index 000d3b8b..20856efa 100644 --- a/ruoyi-api/ruoyi-api-workflow/src/main/java/org/dromara/workflow/api/domain/bo/TaskUrgingBo.java +++ b/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/domain/bo/TaskUrgingBo.java @@ -1,4 +1,4 @@ -package org.dromara.workflow.api.domain.bo; +package org.dromara.workflow.domain.bo; import lombok.Data; diff --git a/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/testleave/domain/bo/TestLeaveBo.java b/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/domain/bo/TestLeaveBo.java similarity index 94% rename from ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/testleave/domain/bo/TestLeaveBo.java rename to ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/domain/bo/TestLeaveBo.java index 1a677473..877e9816 100644 --- a/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/testleave/domain/bo/TestLeaveBo.java +++ b/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/domain/bo/TestLeaveBo.java @@ -1,4 +1,4 @@ -package org.dromara.workflow.testleave.domain.bo; +package org.dromara.workflow.domain.bo; import com.fasterxml.jackson.annotation.JsonFormat; import io.github.linpeilie.annotations.AutoMapper; @@ -9,7 +9,7 @@ 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.testleave.domain.TestLeave; +import org.dromara.workflow.domain.TestLeave; import java.util.Date; diff --git a/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/testleave/domain/vo/TestLeaveVo.java b/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/domain/vo/TestLeaveVo.java similarity index 81% rename from ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/testleave/domain/vo/TestLeaveVo.java rename to ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/domain/vo/TestLeaveVo.java index 0b427fd8..47886d72 100644 --- a/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/testleave/domain/vo/TestLeaveVo.java +++ b/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/domain/vo/TestLeaveVo.java @@ -1,11 +1,10 @@ -package org.dromara.workflow.testleave.domain.vo; +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.api.domain.dto.BusinessInstanceDTO; -import org.dromara.workflow.testleave.domain.TestLeave; +import org.dromara.workflow.domain.TestLeave; import java.io.Serial; import java.io.Serializable; @@ -68,10 +67,4 @@ public class TestLeaveVo implements Serializable { @ExcelProperty(value = "状态") private String status; - /** - * 业务与流程实例关联对象 - */ - private BusinessInstanceDTO businessInstanceDTO; - - } diff --git a/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/dubbo/RemoteWorkflowServiceImpl.java b/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/dubbo/RemoteWorkflowServiceImpl.java index 5b990c19..79239143 100644 --- a/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/dubbo/RemoteWorkflowServiceImpl.java +++ b/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/dubbo/RemoteWorkflowServiceImpl.java @@ -1,13 +1,8 @@ package org.dromara.workflow.dubbo; -import cn.hutool.core.bean.BeanUtil; -import cn.hutool.core.bean.copier.CopyOptions; import lombok.RequiredArgsConstructor; import org.apache.dubbo.config.annotation.DubboService; import org.dromara.workflow.api.domain.RemoteWorkflowService; -import org.dromara.workflow.api.domain.dto.BusinessInstanceDTO; -import org.dromara.workflow.common.enums.BusinessStatusEnum; -import org.dromara.workflow.domain.ActHiProcinst; import org.dromara.workflow.service.IActHiProcinstService; import org.dromara.workflow.service.WorkflowService; @@ -42,34 +37,6 @@ public class RemoteWorkflowServiceImpl implements RemoteWorkflowService { return workflowService.getBusinessStatus(businessKey); } - @Override - public BusinessInstanceDTO getBusinessInstance(String businessKey) { - - ActHiProcinst actHiProcinst = actHiProcinstService.selectByBusinessKey(businessKey); - if (actHiProcinst == null) { - BusinessInstanceDTO businessInstanceDTO = new BusinessInstanceDTO(); - businessInstanceDTO.setBusinessStatus(BusinessStatusEnum.DRAFT.getStatus()); - return businessInstanceDTO; - } - - BusinessInstanceDTO businessInstanceDTO = BeanUtil.toBean(actHiProcinst, BusinessInstanceDTO.class); - businessInstanceDTO.setBusinessStatusName(BusinessStatusEnum.findByStatus(businessInstanceDTO.getBusinessStatus())); - businessInstanceDTO.setProcessDefinitionId(actHiProcinst.getProcDefId()); - return businessInstanceDTO; - } - - @Override - public List getBusinessInstance(List businessKeys) { - List actHiProcinstList = actHiProcinstService.selectByBusinessKeyIn(businessKeys); - List businessInstanceList = BeanUtil.copyToList(actHiProcinstList, BusinessInstanceDTO.class, - CopyOptions.create().setFieldMapping(Map.of("procDefId", "processDefinitionId"))); - businessInstanceList.forEach(dto -> { - dto.setBusinessStatusName(BusinessStatusEnum.findByStatus(dto.getBusinessStatus())); - }); - - return businessInstanceList; - } - @Override public void setVariable(String taskId, String variableName, Object value) { workflowService.setVariable(taskId, variableName, value); diff --git a/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/flowable/handler/FlowProcessEventHandler.java b/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/flowable/handler/FlowProcessEventHandler.java index 001fd30f..8b376c96 100644 --- a/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/flowable/handler/FlowProcessEventHandler.java +++ b/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/flowable/handler/FlowProcessEventHandler.java @@ -1,6 +1,5 @@ package org.dromara.workflow.flowable.handler; -import org.dromara.common.core.utils.ServletUtils; import org.dromara.common.core.utils.SpringUtils; import org.dromara.workflow.api.domain.event.ProcessEvent; import org.dromara.workflow.api.domain.event.ProcessTaskEvent; @@ -29,7 +28,6 @@ public class FlowProcessEventHandler { processEvent.setBusinessKey(businessKey); processEvent.setStatus(status); processEvent.setSubmit(submit); - processEvent.setRequest(ServletUtils.getRequest()); SpringUtils.context().publishEvent(processEvent); } @@ -45,7 +43,6 @@ public class FlowProcessEventHandler { processTaskEvent.setKeyNode(keyNode); processTaskEvent.setTaskId(taskId); processTaskEvent.setBusinessKey(businessKey); - processTaskEvent.setRequest(ServletUtils.getRequest()); SpringUtils.context().publishEvent(processTaskEvent); } } diff --git a/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/testleave/mapper/TestLeaveMapper.java b/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/mapper/TestLeaveMapper.java similarity index 56% rename from ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/testleave/mapper/TestLeaveMapper.java rename to ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/mapper/TestLeaveMapper.java index bce5d813..cd1edba8 100644 --- a/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/testleave/mapper/TestLeaveMapper.java +++ b/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/mapper/TestLeaveMapper.java @@ -1,8 +1,8 @@ -package org.dromara.workflow.testleave.mapper; +package org.dromara.workflow.mapper; import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; -import org.dromara.workflow.testleave.domain.TestLeave; -import org.dromara.workflow.testleave.domain.vo.TestLeaveVo; +import org.dromara.workflow.domain.TestLeave; +import org.dromara.workflow.domain.vo.TestLeaveVo; /** * 请假Mapper接口 diff --git a/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/service/IActProcessInstanceService.java b/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/service/IActProcessInstanceService.java index 2faeef1a..ca3b6fb8 100644 --- a/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/service/IActProcessInstanceService.java +++ b/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/service/IActProcessInstanceService.java @@ -2,9 +2,9 @@ package org.dromara.workflow.service; import org.dromara.common.mybatis.core.page.PageQuery; import org.dromara.common.mybatis.core.page.TableDataInfo; -import org.dromara.workflow.api.domain.bo.ProcessInstanceBo; -import org.dromara.workflow.api.domain.bo.ProcessInvalidBo; -import org.dromara.workflow.api.domain.bo.TaskUrgingBo; +import org.dromara.workflow.domain.bo.ProcessInstanceBo; +import org.dromara.workflow.domain.bo.ProcessInvalidBo; +import org.dromara.workflow.domain.bo.TaskUrgingBo; import org.dromara.workflow.domain.vo.ActHistoryInfoVo; import org.dromara.workflow.domain.vo.ProcessInstanceVo; diff --git a/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/testleave/service/ITestLeaveService.java b/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/service/ITestLeaveService.java similarity index 83% rename from ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/testleave/service/ITestLeaveService.java rename to ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/service/ITestLeaveService.java index 472a5996..943c919a 100644 --- a/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/testleave/service/ITestLeaveService.java +++ b/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/service/ITestLeaveService.java @@ -1,9 +1,9 @@ -package org.dromara.workflow.testleave.service; +package org.dromara.workflow.service; import org.dromara.common.mybatis.core.page.PageQuery; import org.dromara.common.mybatis.core.page.TableDataInfo; -import org.dromara.workflow.testleave.domain.bo.TestLeaveBo; -import org.dromara.workflow.testleave.domain.vo.TestLeaveVo; +import org.dromara.workflow.domain.bo.TestLeaveBo; +import org.dromara.workflow.domain.vo.TestLeaveVo; import java.util.Collection; import java.util.List; diff --git a/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/service/WorkflowService.java b/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/service/WorkflowService.java index eb24cd2e..111f5d7f 100644 --- a/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/service/WorkflowService.java +++ b/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/service/WorkflowService.java @@ -32,23 +32,6 @@ public interface WorkflowService { */ String getBusinessStatus(String businessKey); - /** - * 设置流程实例对象 - * - * @param obj 业务对象 - * @param businessKey 业务id - */ - void setBusinessInstanceDTO(Object obj, String businessKey); - - /** - * 设置流程实例对象 - * - * @param obj 业务对象 - * @param idList 业务id - * @param fieldName 主键属性名称 - */ - void setBusinessInstanceListDTO(Object obj, List idList, String fieldName); - /** * 设置流程变量(全局变量) * diff --git a/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/service/impl/ActProcessInstanceServiceImpl.java b/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/service/impl/ActProcessInstanceServiceImpl.java index 68358766..7c1f0679 100644 --- a/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/service/impl/ActProcessInstanceServiceImpl.java +++ b/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/service/impl/ActProcessInstanceServiceImpl.java @@ -15,13 +15,13 @@ 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.workflow.api.domain.bo.ProcessInstanceBo; -import org.dromara.workflow.api.domain.bo.ProcessInvalidBo; -import org.dromara.workflow.api.domain.bo.TaskUrgingBo; import org.dromara.workflow.common.constant.FlowConstant; import org.dromara.workflow.common.enums.BusinessStatusEnum; import org.dromara.workflow.common.enums.TaskStatusEnum; import org.dromara.workflow.domain.ActHiProcinst; +import org.dromara.workflow.domain.bo.ProcessInstanceBo; +import org.dromara.workflow.domain.bo.ProcessInvalidBo; +import org.dromara.workflow.domain.bo.TaskUrgingBo; import org.dromara.workflow.domain.vo.*; import org.dromara.workflow.flowable.CustomDefaultProcessDiagramGenerator; import org.dromara.workflow.flowable.cmd.DeleteExecutionCmd; @@ -33,7 +33,7 @@ import org.dromara.workflow.service.IWfNodeConfigService; import org.dromara.workflow.service.IWfTaskBackNodeService; import org.dromara.workflow.utils.QueryUtils; import org.dromara.workflow.utils.WorkflowUtils; -import org.flowable.bpmn.model.*; +import org.flowable.bpmn.model.BpmnModel; import org.flowable.engine.*; import org.flowable.engine.history.HistoricActivityInstance; import org.flowable.engine.history.HistoricProcessInstance; diff --git a/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/service/impl/ActTaskServiceImpl.java b/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/service/impl/ActTaskServiceImpl.java index 6403ee95..7578931b 100644 --- a/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/service/impl/ActTaskServiceImpl.java +++ b/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/service/impl/ActTaskServiceImpl.java @@ -16,7 +16,7 @@ import org.dromara.common.mybatis.core.page.TableDataInfo; import org.dromara.common.satoken.utils.LoginHelper; import org.dromara.common.tenant.helper.TenantHelper; import org.dromara.system.api.RemoteUserService; -import org.dromara.system.api.domain.dto.UserDTO; +import org.dromara.system.api.domain.vo.RemoteUserVo; import org.dromara.system.api.model.RoleDTO; import org.dromara.workflow.common.constant.FlowConstant; import org.dromara.workflow.common.enums.BusinessStatusEnum; @@ -818,7 +818,7 @@ public class ActTaskServiceImpl implements IActTaskService { if (multiInstance.getType() instanceof SequentialMultiInstanceBehavior) { List userIds = StreamUtils.filter(assigneeList, e -> !String.valueOf(e).equals(task.getAssignee())); - List userList = userService.selectListByIds(userIds); + List userList = userService.selectListByIds(userIds); for (Long userId : userIds) { TaskVo taskVo = new TaskVo(); taskVo.setId("串行会签"); @@ -836,7 +836,7 @@ public class ActTaskServiceImpl implements IActTaskService { List tasks = StreamUtils.filter(taskList, e -> StringUtils.isBlank(e.getParentTaskId()) && !e.getExecutionId().equals(task.getExecutionId()) && e.getTaskDefinitionKey().equals(task.getTaskDefinitionKey())); if (CollUtil.isNotEmpty(tasks)) { List userIds = StreamUtils.toList(tasks, e -> Long.valueOf(e.getAssignee())); - List userList = userService.selectListByIds(userIds); + List userList = userService.selectListByIds(userIds); for (Task t : tasks) { TaskVo taskVo = new TaskVo(); taskVo.setId(t.getId()); diff --git a/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/testleave/service/impl/TestLeaveServiceImpl.java b/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/service/impl/TestLeaveServiceImpl.java similarity index 68% rename from ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/testleave/service/impl/TestLeaveServiceImpl.java rename to ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/service/impl/TestLeaveServiceImpl.java index 61a3e339..85d42dc1 100644 --- a/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/testleave/service/impl/TestLeaveServiceImpl.java +++ b/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/service/impl/TestLeaveServiceImpl.java @@ -1,6 +1,5 @@ package org.dromara.workflow.service.impl; -import cn.hutool.core.collection.CollUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; @@ -14,15 +13,14 @@ 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.api.domain.RemoteWorkflowService; -import org.dromara.workflow.api.domain.dto.BusinessInstanceDTO; import org.dromara.workflow.api.domain.event.ProcessEvent; import org.dromara.workflow.api.domain.event.ProcessTaskEvent; import org.dromara.workflow.common.enums.BusinessStatusEnum; -import org.dromara.workflow.testleave.domain.TestLeave; -import org.dromara.workflow.testleave.domain.bo.TestLeaveBo; -import org.dromara.workflow.testleave.domain.vo.TestLeaveVo; -import org.dromara.workflow.testleave.mapper.TestLeaveMapper; -import org.dromara.workflow.testleave.service.ITestLeaveService; +import org.dromara.workflow.domain.TestLeave; +import org.dromara.workflow.domain.bo.TestLeaveBo; +import org.dromara.workflow.domain.vo.TestLeaveVo; +import org.dromara.workflow.mapper.TestLeaveMapper; +import org.dromara.workflow.service.ITestLeaveService; import org.springframework.context.event.EventListener; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -50,10 +48,7 @@ public class TestLeaveServiceImpl implements ITestLeaveService { */ @Override public TestLeaveVo queryById(Long id) { - TestLeaveVo testLeaveVo = baseMapper.selectVoById(id); - BusinessInstanceDTO businessInstance = workflowService.getBusinessInstance(String.valueOf(id)); - testLeaveVo.setBusinessInstanceDTO(businessInstance); - return testLeaveVo; + return baseMapper.selectVoById(id); } /** @@ -63,23 +58,7 @@ public class TestLeaveServiceImpl implements ITestLeaveService { public TableDataInfo queryPageList(TestLeaveBo bo, PageQuery pageQuery) { LambdaQueryWrapper lqw = buildQueryWrapper(bo); Page result = baseMapper.selectVoPage(pageQuery.build(), lqw); - TableDataInfo build = TableDataInfo.build(result); - List rows = build.getRows(); - if (CollUtil.isNotEmpty(rows)) { - List ids = StreamUtils.toList(rows, e -> String.valueOf(e.getId())); - List processInstances = workflowService.getBusinessInstance(ids); - for (TestLeaveVo vo : rows) { - BusinessInstanceDTO processInstanceDTO = null; - for (BusinessInstanceDTO processInstance : processInstances) { - if (String.valueOf(vo.getId()).equals(processInstance.getBusinessKey())) { - processInstanceDTO = processInstance; - break; - } - } - vo.setBusinessInstanceDTO(processInstanceDTO); - } - } - return build; + return TableDataInfo.build(result); } /** @@ -110,10 +89,7 @@ public class TestLeaveServiceImpl implements ITestLeaveService { if (flag) { bo.setId(add.getId()); } - TestLeaveVo testLeaveVo = MapstructUtils.convert(add, TestLeaveVo.class); - BusinessInstanceDTO businessInstance = workflowService.getBusinessInstance(String.valueOf(add.getId())); - testLeaveVo.setBusinessInstanceDTO(businessInstance); - return testLeaveVo; + return MapstructUtils.convert(add, TestLeaveVo.class); } /** @@ -123,10 +99,7 @@ public class TestLeaveServiceImpl implements ITestLeaveService { public TestLeaveVo updateByBo(TestLeaveBo bo) { TestLeave update = MapstructUtils.convert(bo, TestLeave.class); baseMapper.updateById(update); - TestLeaveVo testLeaveVo = MapstructUtils.convert(update, TestLeaveVo.class); - BusinessInstanceDTO businessInstance = workflowService.getBusinessInstance(String.valueOf(update.getId())); - testLeaveVo.setBusinessInstanceDTO(businessInstance); - return testLeaveVo; + return MapstructUtils.convert(update, TestLeaveVo.class); } /** diff --git a/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/service/impl/WorkflowServiceImpl.java b/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/service/impl/WorkflowServiceImpl.java index a6ee7faa..d934f29d 100644 --- a/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/service/impl/WorkflowServiceImpl.java +++ b/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/service/impl/WorkflowServiceImpl.java @@ -53,29 +53,6 @@ public class WorkflowServiceImpl implements WorkflowService { return WorkflowUtils.getBusinessStatus(businessKey); } - /** - * 设置流程实例对象 - * - * @param obj 业务对象 - * @param businessKey 业务id - */ - @Override - public void setBusinessInstanceDTO(Object obj, String businessKey) { - WorkflowUtils.setBusinessInstanceDTO(obj, businessKey); - } - - /** - * 设置流程实例对象 - * - * @param obj 业务对象 - * @param idList 业务id - * @param fieldName 主键属性名称 - */ - @Override - public void setBusinessInstanceListDTO(Object obj, List idList, String fieldName) { - WorkflowUtils.setBusinessInstanceListDTO(obj, idList, fieldName); - } - /** * 设置流程变量(全局变量) * diff --git a/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/utils/WorkflowUtils.java b/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/utils/WorkflowUtils.java index f181d30e..26c1e3af 100644 --- a/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/utils/WorkflowUtils.java +++ b/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/utils/WorkflowUtils.java @@ -1,6 +1,5 @@ package org.dromara.workflow.utils; -import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; @@ -10,21 +9,17 @@ import lombok.NoArgsConstructor; 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.reflect.ReflectUtils; 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.system.api.RemoteUserService; -import org.dromara.system.api.domain.dto.UserDTO; +import org.dromara.system.api.domain.vo.RemoteUserVo; import org.dromara.system.api.model.RoleDTO; -import org.dromara.workflow.api.domain.dto.BusinessInstanceDTO; import org.dromara.workflow.common.constant.FlowConstant; -import org.dromara.workflow.common.enums.BusinessStatusEnum; import org.dromara.workflow.common.enums.MessageTypeEnum; import org.dromara.workflow.common.enums.TaskStatusEnum; -import org.dromara.workflow.domain.ActHiProcinst; import org.dromara.workflow.domain.ActHiTaskinst; import org.dromara.workflow.domain.vo.MultiInstanceVo; import org.dromara.workflow.domain.vo.ParticipantVo; @@ -46,8 +41,6 @@ import org.flowable.task.service.impl.persistence.entity.TaskEntity; import java.util.*; -import static org.dromara.workflow.common.constant.FlowConstant.BUSINESS_INSTANCE_DTO; - /** * 工作流工具 * @@ -146,10 +139,10 @@ public class WorkflowUtils { List userIds = USER_SERVICE.selectUserIdsByRoleIds(groupIds); if (CollUtil.isNotEmpty(userIds)) { participantVo.setGroupIds(groupIds); - List userList = USER_SERVICE.selectListByIds(userIds); + List userList = USER_SERVICE.selectListByIds(userIds); if (CollUtil.isNotEmpty(userList)) { - List userIdList = StreamUtils.toList(userList, UserDTO::getUserId); - List nickNames = StreamUtils.toList(userList, UserDTO::getNickName); + List userIdList = StreamUtils.toList(userList, RemoteUserVo::getUserId); + List nickNames = StreamUtils.toList(userList, RemoteUserVo::getNickName); participantVo.setCandidate(userIdList); participantVo.setCandidateName(nickNames); participantVo.setClaim(!StringUtils.isBlank(task.getAssignee())); @@ -165,10 +158,10 @@ public class WorkflowUtils { } } - List userList = USER_SERVICE.selectListByIds(userIdList); + List userList = USER_SERVICE.selectListByIds(userIdList); if (CollUtil.isNotEmpty(userList)) { - List userIds = StreamUtils.toList(userList, UserDTO::getUserId); - List nickNames = StreamUtils.toList(userList, UserDTO::getNickName); + List userIds = StreamUtils.toList(userList, RemoteUserVo::getUserId); + List nickNames = StreamUtils.toList(userList, RemoteUserVo::getNickName); participantVo.setCandidate(userIds); participantVo.setCandidateName(nickNames); // 判断当前任务是否具有多个办理人 @@ -235,67 +228,6 @@ public class WorkflowUtils { return historicProcessInstance.getBusinessStatus(); } - /** - * 设置流程实例对象 - * - * @param obj 业务对象 - * @param businessKey 业务id - */ - public static void setBusinessInstanceDTO(Object obj, String businessKey) { - if (StringUtils.isBlank(businessKey) || obj == null) { - return; - } - ActHiProcinst actHiProcinst = ACT_HI_PROCINST_SERVICE.selectByBusinessKey(businessKey); - if (actHiProcinst == null) { - BusinessInstanceDTO businessInstanceDTO = new BusinessInstanceDTO(); - businessInstanceDTO.setBusinessStatus(BusinessStatusEnum.DRAFT.getStatus()); - ReflectUtils.invokeSetter(obj, BUSINESS_INSTANCE_DTO, businessInstanceDTO); - return; - } - BusinessInstanceDTO businessInstanceDTO = BeanUtil.toBean(actHiProcinst, BusinessInstanceDTO.class); - businessInstanceDTO.setBusinessStatusName(BusinessStatusEnum.findByStatus(businessInstanceDTO.getBusinessStatus())); - businessInstanceDTO.setProcessDefinitionId(actHiProcinst.getProcDefId()); - ReflectUtils.invokeSetter(obj, BUSINESS_INSTANCE_DTO, businessInstanceDTO); - } - - /** - * 设置流程实例对象 - * - * @param obj 业务对象 - * @param idList 业务id - * @param fieldName 主键属性名称 - */ - public static void setBusinessInstanceListDTO(Object obj, List idList, String fieldName) { - if (CollUtil.isEmpty(idList) || obj == null) { - return; - } - List actHiProcinstList = ACT_HI_PROCINST_SERVICE.selectByBusinessKeyIn(idList); - if (obj instanceof Collection collection) { - for (Object o : collection) { - String fieldValue = ReflectUtils.invokeGetter(o, fieldName).toString(); - if (CollUtil.isEmpty(actHiProcinstList)) { - BusinessInstanceDTO businessInstanceDTO = new BusinessInstanceDTO(); - businessInstanceDTO.setBusinessStatus(BusinessStatusEnum.DRAFT.getStatus()); - businessInstanceDTO.setBusinessStatusName(BusinessStatusEnum.findByStatus(businessInstanceDTO.getBusinessStatus())); - ReflectUtils.invokeSetter(o, BUSINESS_INSTANCE_DTO, businessInstanceDTO); - } else { - ActHiProcinst actHiProcinst = actHiProcinstList.stream().filter(e -> e.getBusinessKey().equals(fieldValue)).findFirst().orElse(null); - if (ObjectUtil.isNotEmpty(actHiProcinst)) { - BusinessInstanceDTO businessInstanceDTO = BeanUtil.toBean(actHiProcinst, BusinessInstanceDTO.class); - businessInstanceDTO.setBusinessStatusName(BusinessStatusEnum.findByStatus(businessInstanceDTO.getBusinessStatus())); - businessInstanceDTO.setProcessDefinitionId(actHiProcinst.getProcDefId()); - ReflectUtils.invokeSetter(o, BUSINESS_INSTANCE_DTO, businessInstanceDTO); - } else { - BusinessInstanceDTO businessInstanceDTO = new BusinessInstanceDTO(); - businessInstanceDTO.setBusinessStatus(BusinessStatusEnum.DRAFT.getStatus()); - businessInstanceDTO.setBusinessStatusName(BusinessStatusEnum.findByStatus(businessInstanceDTO.getBusinessStatus())); - ReflectUtils.invokeSetter(o, BUSINESS_INSTANCE_DTO, businessInstanceDTO); - } - } - } - } - } - /** * 发送消息 * @@ -323,7 +255,7 @@ public class WorkflowUtils { } } if (CollUtil.isNotEmpty(userIds)) { - List userList = USER_SERVICE.selectListByIds(new ArrayList<>(userIds)); + List userList = USER_SERVICE.selectListByIds(new ArrayList<>(userIds)); for (String code : messageType) { MessageTypeEnum messageTypeEnum = MessageTypeEnum.getByCode(code); if (ObjectUtil.isNotEmpty(messageTypeEnum)) { @@ -335,7 +267,7 @@ public class WorkflowUtils { WebSocketUtils.publishMessage(dto); break; case EMAIL_MESSAGE: - MailUtils.sendText(StreamUtils.join(userList, UserDTO::getEmail), "单据审批提醒", message); + MailUtils.sendText(StreamUtils.join(userList, RemoteUserVo::getEmail), "单据审批提醒", message); break; case SMS_MESSAGE: //todo 短信发送 diff --git a/ruoyi-modules/ruoyi-workflow/src/main/resources/mapper/TestLeaveMapper.xml b/ruoyi-modules/ruoyi-workflow/src/main/resources/mapper/workflow/TestLeaveMapper.xml similarity index 69% rename from ruoyi-modules/ruoyi-workflow/src/main/resources/mapper/TestLeaveMapper.xml rename to ruoyi-modules/ruoyi-workflow/src/main/resources/mapper/workflow/TestLeaveMapper.xml index 63804fbe..d52f6b03 100644 --- a/ruoyi-modules/ruoyi-workflow/src/main/resources/mapper/TestLeaveMapper.xml +++ b/ruoyi-modules/ruoyi-workflow/src/main/resources/mapper/workflow/TestLeaveMapper.xml @@ -2,6 +2,6 @@ - + diff --git a/sql/ry-config.sql b/sql/ry-config.sql index 20fcc8d1..cbdc5de5 100644 --- a/sql/ry-config.sql +++ b/sql/ry-config.sql @@ -42,7 +42,8 @@ insert into config_info(id, data_id, group_id, content, md5, gmt_create, gmt_mod (7, 'ruoyi-gen.yml', 'DEFAULT_GROUP', '# 将项目路径:config/下对应文件中内容复制到此处', '2944a25cb97926efcaa43b3ad7a64cf0', '2022-01-09 15:20:18', '2022-01-09 15:21:51', NULL, '0:0:0:0:0:0:0:1', '', 'dev', '代码生成', NULL, NULL, 'yaml', NULL, ''), (8, 'ruoyi-job.yml', 'DEFAULT_GROUP', '# 将项目路径:config/下对应文件中内容复制到此处', '2944a25cb97926efcaa43b3ad7a64cf0', '2022-01-09 15:20:18', '2022-01-09 15:21:36', NULL, '0:0:0:0:0:0:0:1', '', 'dev', '定时任务', NULL, NULL, 'yaml', NULL, ''), (9, 'ruoyi-resource.yml', 'DEFAULT_GROUP', '# 将项目路径:config/下对应文件中内容复制到此处', '2944a25cb97926efcaa43b3ad7a64cf0', '2022-01-09 15:20:35', '2022-01-09 15:21:21', NULL, '0:0:0:0:0:0:0:1', '', 'dev', '文件服务', NULL, NULL, 'yaml', NULL, ''), -(10, 'sentinel-ruoyi-gateway.json', 'DEFAULT_GROUP', '# 将项目路径:config/下对应文件中内容复制到此处', '2944a25cb97926efcaa43b3ad7a64cf0', '2022-01-09 15:21:02', '2022-01-09 15:21:02', NULL, '0:0:0:0:0:0:0:1', '', 'dev', '限流策略', NULL, NULL, 'json', NULL, ''), +(9, 'ruoyi-workflow.yml', 'DEFAULT_GROUP', '# 将项目路径:config/下对应文件中内容复制到此处', '2944a25cb97926efcaa43b3ad7a64cf0', '2022-01-09 15:20:35', '2022-01-09 15:21:21', NULL, '0:0:0:0:0:0:0:1', '', 'dev', '工作流服务', NULL, NULL, 'yaml', NULL, ''), +(11, 'sentinel-ruoyi-gateway.json', 'DEFAULT_GROUP', '# 将项目路径:config/下对应文件中内容复制到此处', '2944a25cb97926efcaa43b3ad7a64cf0', '2022-01-09 15:21:02', '2022-01-09 15:21:02', NULL, '0:0:0:0:0:0:0:1', '', 'dev', '限流策略', NULL, NULL, 'json', NULL, ''), (12, 'seata-server.properties', 'DEFAULT_GROUP', '# 将项目路径:config/下对应文件中内容复制到此处', '2944a25cb97926efcaa43b3ad7a64cf0', '2022-01-09 15:21:02', '2022-01-09 15:21:02', NULL, '0:0:0:0:0:0:0:1', '', 'dev', 'seata配置文件', NULL, NULL, 'properties', NULL, ''), (13, 'ruoyi-sentinel-dashboard.yml', 'DEFAULT_GROUP', '# 将项目路径:config/下对应文件中内容复制到此处', '2944a25cb97926efcaa43b3ad7a64cf0', '2022-01-09 15:21:02', '2022-01-09 15:21:02', NULL, '0:0:0:0:0:0:0:1', '', 'dev', 'sentinel控制台配置文件', NULL, NULL, 'yaml', NULL, ''), (14, 'ruoyi-snailjob-server.yml', 'DEFAULT_GROUP', '# 将项目路径:config/下对应文件中内容复制到此处', '2944a25cb97926efcaa43b3ad7a64cf0', '2022-01-09 15:21:02', '2022-01-09 15:21:02', NULL, '0:0:0:0:0:0:0:1', '', 'dev', 'SJ定时任务控制台', NULL, NULL, 'yaml', NULL, ''), @@ -56,7 +57,8 @@ insert into config_info(id, data_id, group_id, content, md5, gmt_create, gmt_mod (107, 'ruoyi-gen.yml', 'DEFAULT_GROUP', '# 将项目路径:config/下对应文件中内容复制到此处', '2944a25cb97926efcaa43b3ad7a64cf0', '2022-01-09 15:23:00', '2022-01-09 15:23:00', NULL, '0:0:0:0:0:0:0:1', '', 'prod', '代码生成', NULL, NULL, 'yaml', NULL, ''), (108, 'ruoyi-job.yml', 'DEFAULT_GROUP', '# 将项目路径:config/下对应文件中内容复制到此处', '2944a25cb97926efcaa43b3ad7a64cf0', '2022-01-09 15:23:00', '2022-01-09 15:23:00', NULL, '0:0:0:0:0:0:0:1', '', 'prod', '定时任务', NULL, NULL, 'yaml', NULL, ''), (109, 'ruoyi-resource.yml', 'DEFAULT_GROUP', '# 将项目路径:config/下对应文件中内容复制到此处', '2944a25cb97926efcaa43b3ad7a64cf0', '2022-01-09 15:23:00', '2022-01-09 15:23:00', NULL, '0:0:0:0:0:0:0:1', '', 'prod', '文件服务', NULL, NULL, 'yaml', NULL, ''), -(110, 'sentinel-ruoyi-gateway.json', 'DEFAULT_GROUP', '# 将项目路径:config/下对应文件中内容复制到此处', '2944a25cb97926efcaa43b3ad7a64cf0', '2022-01-09 15:23:00', '2022-01-09 15:23:00', NULL, '0:0:0:0:0:0:0:1', '', 'prod', '限流策略', NULL, NULL, 'json', NULL, ''), +(110, 'ruoyi-workflow.yml', 'DEFAULT_GROUP', '# 将项目路径:config/下对应文件中内容复制到此处', '2944a25cb97926efcaa43b3ad7a64cf0', '2022-01-09 15:23:00', '2022-01-09 15:23:00', NULL, '0:0:0:0:0:0:0:1', '', 'prod', '工作流服务', NULL, NULL, 'yaml', NULL, ''), +(111, 'sentinel-ruoyi-gateway.json', 'DEFAULT_GROUP', '# 将项目路径:config/下对应文件中内容复制到此处', '2944a25cb97926efcaa43b3ad7a64cf0', '2022-01-09 15:23:00', '2022-01-09 15:23:00', NULL, '0:0:0:0:0:0:0:1', '', 'prod', '限流策略', NULL, NULL, 'json', NULL, ''), (112, 'seata-server.properties', 'DEFAULT_GROUP', '# 将项目路径:config/下对应文件中内容复制到此处', '2944a25cb97926efcaa43b3ad7a64cf0', '2022-01-09 15:21:02', '2022-01-09 15:21:02', NULL, '0:0:0:0:0:0:0:1', '', 'prod', 'seata配置文件', NULL, NULL, 'properties', NULL, ''), (113, 'ruoyi-sentinel-dashboard.yml', 'DEFAULT_GROUP', '# 将项目路径:config/下对应文件中内容复制到此处', '2944a25cb97926efcaa43b3ad7a64cf0', '2022-01-09 15:21:02', '2022-01-09 15:21:02', NULL, '0:0:0:0:0:0:0:1', '', 'prod', 'sentinel控制台配置文件', NULL, NULL, 'yaml', NULL, ''), (114, 'ruoyi-snailjob-server.yml', 'DEFAULT_GROUP', '# 将项目路径:config/下对应文件中内容复制到此处', '2944a25cb97926efcaa43b3ad7a64cf0', '2022-01-09 15:21:02', '2022-01-09 15:21:02', NULL, '0:0:0:0:0:0:0:1', '', 'prod', 'SJ定时任务控制台', NULL, NULL, 'yaml', NULL, '');