提交代码
parent
a341eb2d5a
commit
e32178da57
6
pom.xml
6
pom.xml
|
@ -30,6 +30,7 @@
|
|||
<velocity.version>2.3</velocity.version>
|
||||
<jwt.version>0.9.1</jwt.version>
|
||||
<flowable.version>6.8.0</flowable.version>
|
||||
<hutool.version>5.8.20</hutool.version>
|
||||
</properties>
|
||||
|
||||
<!-- 依赖声明 -->
|
||||
|
@ -205,6 +206,11 @@
|
|||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
<version>3.4.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-poi</artifactId>
|
||||
<version>${hutool.version}</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
|
|
@ -126,6 +126,12 @@
|
|||
<artifactId>javax.servlet-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-core</artifactId>
|
||||
<version>${hutool.version}</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
|
@ -89,6 +89,11 @@ public class Constants
|
|||
*/
|
||||
public static final Integer CAPTCHA_EXPIRATION = 2;
|
||||
|
||||
/**
|
||||
* 基础数据有效期(分钟)
|
||||
*/
|
||||
public static final Integer DATA_EXPIRATION = 2;
|
||||
|
||||
/**
|
||||
* 基础数据有效期(分钟)
|
||||
*/
|
||||
|
|
|
@ -3,7 +3,11 @@ package com.yanzhu.common.utils.file;
|
|||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Arrays;
|
||||
import java.util.Objects;
|
||||
|
||||
import cn.hutool.core.img.ImgUtil;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import com.yanzhu.common.config.YanZhuConfig;
|
||||
|
@ -114,9 +118,26 @@ public class FileUploadUtils
|
|||
|
||||
String absPath = getAbsoluteFile(baseDir, fileName).getAbsolutePath();
|
||||
file.transferTo(Paths.get(absPath));
|
||||
makeMiniImage(absPath);
|
||||
return getPathFileName(baseDir, fileName);
|
||||
}
|
||||
|
||||
private static void makeMiniImage(String absPath) {
|
||||
try {
|
||||
String ext = FileUtils.getFileExt(absPath).toLowerCase();
|
||||
String exts = Arrays.toString(new String[]{"jpg", "jpeg", "png", "bmp"});
|
||||
if (exts.contains(ext)) {
|
||||
if (new File(absPath).exists()) {
|
||||
int w = ImgUtil.read(FileUtil.file(absPath)).getWidth();
|
||||
ImgUtil.scale(FileUtil.file(absPath),
|
||||
FileUtil.file(absPath + ".min.jpg"), (float) (300.0 / w));
|
||||
}
|
||||
}
|
||||
}catch (Exception ex){
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 编码文件名
|
||||
*/
|
||||
|
|
|
@ -273,6 +273,10 @@ public class FileUtils
|
|||
return fileName.substring(index + 1);
|
||||
}
|
||||
|
||||
public static String getFileExt(String fileName){
|
||||
return FilenameUtils.getExtension(fileName).toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取不带后缀文件名称 /profile/upload/2022/04/16/yanZhu.png -- yanZhu
|
||||
*
|
||||
|
|
|
@ -3,14 +3,14 @@ package com.yanzhu.flowable.service;
|
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.yanzhu.common.core.domain.AjaxResult;
|
||||
import com.yanzhu.project.domain.ProProjectApply;
|
||||
import com.yanzhu.system.domain.flowable.FlowQueryVo;
|
||||
import com.yanzhu.system.domain.FlowProcDefDto;
|
||||
import com.yanzhu.system.domain.flowable.FlowQueryVo;
|
||||
import org.flowable.bpmn.model.FlowElement;
|
||||
import org.flowable.bpmn.model.UserTask;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Tony
|
||||
|
@ -52,6 +52,13 @@ public interface IFlowDefinitionService {
|
|||
*/
|
||||
public List<FlowElement> readNodes(String deployId);
|
||||
|
||||
/**
|
||||
* 读取流程节点
|
||||
* @param deployId
|
||||
* @return
|
||||
*/
|
||||
public List<UserTask> findFlowNodes(String deployId);
|
||||
|
||||
/**
|
||||
* 根据流程定义ID启动流程实例
|
||||
*
|
||||
|
|
|
@ -27,6 +27,7 @@ import org.apache.commons.collections4.CollectionUtils;
|
|||
import org.apache.commons.io.IOUtils;
|
||||
import org.flowable.bpmn.model.BpmnModel;
|
||||
import org.flowable.bpmn.model.FlowElement;
|
||||
import org.flowable.bpmn.model.UserTask;
|
||||
import org.flowable.engine.repository.Deployment;
|
||||
import org.flowable.engine.repository.ProcessDefinition;
|
||||
import org.flowable.engine.repository.ProcessDefinitionQuery;
|
||||
|
@ -203,7 +204,6 @@ public class FlowDefinitionServiceImpl extends FlowServiceFactory implements IFl
|
|||
List<FlowElement> list = new ArrayList<>();
|
||||
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().deploymentId(deployId).singleResult();
|
||||
//获得图片流
|
||||
DefaultProcessDiagramGenerator diagramGenerator = new DefaultProcessDiagramGenerator();
|
||||
BpmnModel bpmnModel = repositoryService.getBpmnModel(processDefinition.getId());
|
||||
Collection<FlowElement> flowElements = bpmnModel.getProcesses().get(0).getFlowElements();
|
||||
if(flowElements.size()>0){
|
||||
|
@ -211,7 +211,20 @@ public class FlowDefinitionServiceImpl extends FlowServiceFactory implements IFl
|
|||
list.add(fe);
|
||||
}
|
||||
}
|
||||
//输出为节点描述
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取流程节点
|
||||
* @param deployId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<UserTask> findFlowNodes(String deployId){
|
||||
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().deploymentId(deployId).singleResult();
|
||||
//获得图片流
|
||||
BpmnModel bpmnModel = repositoryService.getBpmnModel(processDefinition.getId());
|
||||
List<UserTask> list = bpmnModel.getProcesses().get(0).findFlowElementsOfType(UserTask.class);
|
||||
return list;
|
||||
}
|
||||
|
||||
|
|
|
@ -660,10 +660,11 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
|
|||
if(Objects.isNull(processInstance)) {
|
||||
throw new RuntimeException("流程已结束或已挂起,无法执行撤回操作");
|
||||
}
|
||||
String userIdStr = Convert.toStr(SecurityUtils.getUserId());
|
||||
// 获取待撤回任务实例
|
||||
HistoricTaskInstance currTaskIns = historyService.createHistoricTaskInstanceQuery()
|
||||
.taskId(taskId)
|
||||
.taskAssignee(flowTaskVo.getUserId())
|
||||
.taskAssignee(userIdStr)
|
||||
.singleResult();
|
||||
if (Objects.isNull(currTaskIns)) {
|
||||
throw new RuntimeException("当前任务不存在,无法执行撤回操作");
|
||||
|
@ -694,8 +695,8 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
|
|||
// 检查激活的任务节点是否存在下一级中,如果存在,则加入到需要撤回的节点
|
||||
if (StringUtils.contains(nextUserTaskKeys, task.getTaskDefinitionKey())) {
|
||||
// 添加撤回审批信息
|
||||
taskService.setAssignee(task.getId(), flowTaskVo.getUserId());
|
||||
taskService.addComment(task.getId(), task.getProcessInstanceId(), FlowComment.REVOKE.getType(), flowTaskVo.getAssignee() + "撤回流程审批");
|
||||
taskService.setAssignee(task.getId(), userIdStr);
|
||||
taskService.addComment(task.getId(), task.getProcessInstanceId(), FlowComment.REVOKE.getType(), SecurityUtils.getLoginUser().getUser().getNickName() + "撤回流程审批");
|
||||
revokeExecutionIds.add(task.getExecutionId());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.yanzhu.wechat.controller;
|
||||
|
||||
import com.yanzhu.common.annotation.Log;
|
||||
import com.yanzhu.common.constant.Constants;
|
||||
import com.yanzhu.common.core.controller.BaseController;
|
||||
import com.yanzhu.common.core.domain.AjaxResult;
|
||||
import com.yanzhu.common.core.domain.entity.SysRole;
|
||||
|
@ -21,6 +22,8 @@ import com.yanzhu.wechat.domain.StartProcessInstanceVo;
|
|||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.flowable.bpmn.model.FlowElement;
|
||||
import org.flowable.bpmn.model.UserTask;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
@ -28,6 +31,7 @@ import javax.validation.Valid;
|
|||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
|
@ -85,7 +89,32 @@ public class WxFlowableController extends BaseController {
|
|||
@ApiOperation(value = "查询流程节点")
|
||||
@GetMapping("/readNotes/{deployId}")
|
||||
public AjaxResult readNotes(@ApiParam(value = "流程定义id") @PathVariable(value = "deployId") String deployId) {
|
||||
return success(flowDefinitionService.readNodes(deployId));
|
||||
String key = "YANZHU.FLOW.readNotes:" + deployId;
|
||||
Object object = redisCache.getCacheObject(key);
|
||||
if (object != null) {
|
||||
//return success(object);
|
||||
}
|
||||
List<FlowElement> list = flowDefinitionService.readNodes(deployId);
|
||||
redisCache.setCacheObject(key, list, Constants.DATA_EXPIRATION, TimeUnit.MINUTES);
|
||||
return success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询流程节点
|
||||
* @param deployId
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "查询流程节点")
|
||||
@GetMapping("/readDeployNotes/{deployId}")
|
||||
public AjaxResult readDeployNotes(@ApiParam(value = "流程定义id") @PathVariable(value = "deployId") String deployId) {
|
||||
String key = "YANZHU.FLOW.readDeployNotes:" + deployId;
|
||||
Object object = redisCache.getCacheObject(key);
|
||||
if (object != null) {
|
||||
return success(object);
|
||||
}
|
||||
List<UserTask> list = flowDefinitionService.findFlowNodes(deployId);
|
||||
redisCache.setCacheObject(key, list, Constants.DATA_EXPIRATION, TimeUnit.MINUTES);
|
||||
return success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -150,6 +179,12 @@ public class WxFlowableController extends BaseController {
|
|||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除流程实例
|
||||
* @param instanceId 流程实例ID
|
||||
* @param deleteReason 删除原因
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "删除流程实例")
|
||||
@Log(title = "删除流程", businessType = BusinessType.DELETE, operatorType = OperatorType.MOBILE)
|
||||
@DeleteMapping(value = "/delete/{instanceId}")
|
||||
|
@ -159,6 +194,11 @@ public class WxFlowableController extends BaseController {
|
|||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 委派任务
|
||||
* @param flowTaskVo
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "委派任务")
|
||||
@Log(title = "委派流程", businessType = BusinessType.UPDATE, operatorType = OperatorType.MOBILE)
|
||||
@PostMapping(value = "/delegateTask")
|
||||
|
@ -167,6 +207,11 @@ public class WxFlowableController extends BaseController {
|
|||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 转办任务
|
||||
* @param flowTaskVo
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "转办任务")
|
||||
@Log(title = "转办流程", businessType = BusinessType.UPDATE, operatorType = OperatorType.MOBILE)
|
||||
@PostMapping(value = "/assignTask")
|
||||
|
|
Loading…
Reference in New Issue