update 优化 !pr164 代码结构与修复一些问题

2.X
疯狂的狮子Li 8 months ago
parent 992adc8589
commit bc05aabd5e

@ -0,0 +1,12 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="ruoyi-workflow" type="docker-deploy" factoryName="dockerfile" server-name="Docker">
<deployment type="dockerfile">
<settings>
<option name="imageTag" value="ruoyi/ruoyi-workflow:2.2.0" />
<option name="buildOnly" value="true" />
<option name="sourceFilePath" value="ruoyi-modules/ruoyi-workflow/Dockerfile" />
</settings>
</deployment>
<method v="2" />
</configuration>
</component>

@ -3,7 +3,6 @@ spring:
dynamic:
# 设置默认的数据源或者数据源组,默认值即为 master
primary: master
seata: false
datasource:
# 主库数据源
master:

@ -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"
#################################################################################################
#################################### 以下为扩展根据需求搭建 #########################################

@ -57,16 +57,13 @@
<!-- SMS 配置 -->
<sms4j.version>3.2.1</sms4j.version>
<!--工作流配置-->
<flowable.version>7.0.0</flowable.version>
<!-- 插件版本 -->
<maven-compiler-plugin.verison>3.11.0</maven-compiler-plugin.verison>
<maven-surefire-plugin.version>3.1.2</maven-surefire-plugin.version>
<flatten-maven-plugin.version>1.3.0</flatten-maven-plugin.version>
<!--工作流配置-->
<flowable.version>7.0.0</flowable.version>
<flowable-json-convertor.version>6.8.0</flowable-json-convertor.version>
<xmlgraphics.version>1.10</xmlgraphics.version>
</properties>
<profiles>
@ -174,19 +171,6 @@
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.flowable</groupId>
<artifactId>flowable-json-converter</artifactId>
<version>${flowable-json-convertor.version}</version>
</dependency>
<!-- svg转png图片工具-->
<dependency>
<groupId>org.apache.xmlgraphics</groupId>
<artifactId>batik-all</artifactId>
<version>${xmlgraphics.version}</version>
</dependency>
<dependency>
<groupId>cn.dev33</groupId>
<artifactId>sa-token-core</artifactId>

@ -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<UserDTO> selectListByIds(List<Long> userIds);
List<RemoteUserVo> selectListByIds(List<Long> userIds);
/**
* IDID

@ -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;

@ -12,7 +12,7 @@
<artifactId>ruoyi-api-workflow</artifactId>
<description>
ruoyi-api-resource 资源服务接口模块
ruoyi-api-workflow 工作流接口模块
</description>
<dependencies>
@ -23,11 +23,6 @@
<artifactId>ruoyi-common-core</artifactId>
</dependency>
<dependency>
<groupId>org.dromara</groupId>
<artifactId>ruoyi-common-translation</artifactId>
</dependency>
</dependencies>
</project>

@ -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<BusinessInstanceDTO> getBusinessInstance(List<String> businessKeys);
/**
* ()
*

@ -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;
}

@ -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;
}

@ -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;
}

@ -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 <T> Page<T> build() {
Integer pageNum = ObjectUtil.defaultIfNull(getPageNum(), DEFAULT_PAGE_NUM);
Integer pageSize = ObjectUtil.defaultIfNull(getPageSize(), DEFAULT_PAGE_SIZE);

@ -21,6 +21,11 @@ public class NicknameTranslationImpl implements TranslationInterface<String> {
@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;
}
}

@ -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<SysOssVo, RemoteFile> {
@Mapping(target = "fileName", source = "name")
RemoteFile convert(SysOssVo sysOssVo);
}

@ -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<RemoteFile> selectByIds(String ossIds){
List<SysOssVo> 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);
}
}

@ -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<SysUserVo, RemoteUserVo> {
}

@ -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<String> 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<UserDTO> selectListByIds(List<Long> userIds) {
public List<RemoteUserVo> selectListByIds(List<Long> userIds) {
List<SysUserVo> sysUserVos = userService.selectUserByIds(userIds, null);
return BeanUtil.copyToList(sysUserVos, UserDTO.class);
return MapstructUtils.convert(sysUserVos, RemoteUserVo.class);
}
@Override

@ -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

@ -61,6 +61,7 @@
<dependency>
<groupId>org.apache.xmlgraphics</groupId>
<artifactId>batik-all</artifactId>
<version>1.10</version>
<exclusions>
<exclusion>
<groupId>xalan</groupId>

@ -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;

@ -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.*;

@ -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;

@ -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;

@ -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;

@ -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;
}

@ -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<BusinessInstanceDTO> getBusinessInstance(List<String> businessKeys) {
List<ActHiProcinst> actHiProcinstList = actHiProcinstService.selectByBusinessKeyIn(businessKeys);
List<BusinessInstanceDTO> 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);

@ -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);
}
}

@ -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

@ -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;

@ -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;

@ -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<String> idList, String fieldName);
/**
* ()
*

@ -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;

@ -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<Long> userIds = StreamUtils.filter(assigneeList, e -> !String.valueOf(e).equals(task.getAssignee()));
List<UserDTO> userList = userService.selectListByIds(userIds);
List<RemoteUserVo> userList = userService.selectListByIds(userIds);
for (Long userId : userIds) {
TaskVo taskVo = new TaskVo();
taskVo.setId("串行会签");
@ -836,7 +836,7 @@ public class ActTaskServiceImpl implements IActTaskService {
List<Task> tasks = StreamUtils.filter(taskList, e -> StringUtils.isBlank(e.getParentTaskId()) && !e.getExecutionId().equals(task.getExecutionId()) && e.getTaskDefinitionKey().equals(task.getTaskDefinitionKey()));
if (CollUtil.isNotEmpty(tasks)) {
List<Long> userIds = StreamUtils.toList(tasks, e -> Long.valueOf(e.getAssignee()));
List<UserDTO> userList = userService.selectListByIds(userIds);
List<RemoteUserVo> userList = userService.selectListByIds(userIds);
for (Task t : tasks) {
TaskVo taskVo = new TaskVo();
taskVo.setId(t.getId());

@ -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<TestLeaveVo> queryPageList(TestLeaveBo bo, PageQuery pageQuery) {
LambdaQueryWrapper<TestLeave> lqw = buildQueryWrapper(bo);
Page<TestLeaveVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
TableDataInfo<TestLeaveVo> build = TableDataInfo.build(result);
List<TestLeaveVo> rows = build.getRows();
if (CollUtil.isNotEmpty(rows)) {
List<String> ids = StreamUtils.toList(rows, e -> String.valueOf(e.getId()));
List<BusinessInstanceDTO> 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);
}
/**

@ -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<String> idList, String fieldName) {
WorkflowUtils.setBusinessInstanceListDTO(obj, idList, fieldName);
}
/**
* ()
*

@ -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<Long> userIds = USER_SERVICE.selectUserIdsByRoleIds(groupIds);
if (CollUtil.isNotEmpty(userIds)) {
participantVo.setGroupIds(groupIds);
List<UserDTO> userList = USER_SERVICE.selectListByIds(userIds);
List<RemoteUserVo> userList = USER_SERVICE.selectListByIds(userIds);
if (CollUtil.isNotEmpty(userList)) {
List<Long> userIdList = StreamUtils.toList(userList, UserDTO::getUserId);
List<String> nickNames = StreamUtils.toList(userList, UserDTO::getNickName);
List<Long> userIdList = StreamUtils.toList(userList, RemoteUserVo::getUserId);
List<String> 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<UserDTO> userList = USER_SERVICE.selectListByIds(userIdList);
List<RemoteUserVo> userList = USER_SERVICE.selectListByIds(userIdList);
if (CollUtil.isNotEmpty(userList)) {
List<Long> userIds = StreamUtils.toList(userList, UserDTO::getUserId);
List<String> nickNames = StreamUtils.toList(userList, UserDTO::getNickName);
List<Long> userIds = StreamUtils.toList(userList, RemoteUserVo::getUserId);
List<String> 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<String> idList, String fieldName) {
if (CollUtil.isEmpty(idList) || obj == null) {
return;
}
List<ActHiProcinst> 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<UserDTO> userList = USER_SERVICE.selectListByIds(new ArrayList<>(userIds));
List<RemoteUserVo> 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 短信发送

@ -2,6 +2,6 @@
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.dromara.workflow.testleave.mapper.TestLeaveMapper">
<mapper namespace="org.dromara.workflow.mapper.TestLeaveMapper">
</mapper>

@ -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, '');

Loading…
Cancel
Save