diff --git a/blade-auth/pom.xml b/blade-auth/pom.xml
index 3727c88c..0f5b9e8a 100644
--- a/blade-auth/pom.xml
+++ b/blade-auth/pom.xml
@@ -8,7 +8,7 @@
BladeX
org.springblade
- 2.0.0.RC8
+ 2.0.0.RC9
blade-auth
diff --git a/blade-common/pom.xml b/blade-common/pom.xml
index 4ac17eb5..6851ce06 100644
--- a/blade-common/pom.xml
+++ b/blade-common/pom.xml
@@ -5,7 +5,7 @@
BladeX
org.springblade
- 2.0.0.RC8
+ 2.0.0.RC9
4.0.0
diff --git a/blade-gateway/pom.xml b/blade-gateway/pom.xml
index f0ac945e..5cefd523 100644
--- a/blade-gateway/pom.xml
+++ b/blade-gateway/pom.xml
@@ -5,7 +5,7 @@
BladeX
org.springblade
- 2.0.0.RC8
+ 2.0.0.RC9
4.0.0
diff --git a/blade-ops/blade-admin/pom.xml b/blade-ops/blade-admin/pom.xml
index 4b608a90..78a3221a 100644
--- a/blade-ops/blade-admin/pom.xml
+++ b/blade-ops/blade-admin/pom.xml
@@ -5,7 +5,7 @@
blade-ops
org.springblade
- 2.0.0.RC8
+ 2.0.0.RC9
4.0.0
diff --git a/blade-ops/blade-develop/pom.xml b/blade-ops/blade-develop/pom.xml
index 3cd5d1ff..85ca8903 100644
--- a/blade-ops/blade-develop/pom.xml
+++ b/blade-ops/blade-develop/pom.xml
@@ -6,7 +6,7 @@
org.springblade
blade-ops
- 2.0.0.RC8
+ 2.0.0.RC9
4.0.0
diff --git a/blade-ops/blade-flowdesign/pom.xml b/blade-ops/blade-flowdesign/pom.xml
index cb34379d..4fdd887e 100644
--- a/blade-ops/blade-flowdesign/pom.xml
+++ b/blade-ops/blade-flowdesign/pom.xml
@@ -5,7 +5,7 @@
blade-ops
org.springblade
- 2.0.0.RC8
+ 2.0.0.RC9
4.0.0
diff --git a/blade-ops/pom.xml b/blade-ops/pom.xml
index 760c76e4..ac195f8c 100644
--- a/blade-ops/pom.xml
+++ b/blade-ops/pom.xml
@@ -5,7 +5,7 @@
BladeX
org.springblade
- 2.0.0.RC8
+ 2.0.0.RC9
4.0.0
diff --git a/blade-service-api/blade-desk-api/pom.xml b/blade-service-api/blade-desk-api/pom.xml
index ec9a3ec3..19295939 100644
--- a/blade-service-api/blade-desk-api/pom.xml
+++ b/blade-service-api/blade-desk-api/pom.xml
@@ -5,7 +5,7 @@
blade-service-api
org.springblade
- 2.0.0.RC8
+ 2.0.0.RC9
4.0.0
diff --git a/blade-service-api/blade-desk-api/src/main/java/org/springblade/desk/entity/Notice.java b/blade-service-api/blade-desk-api/src/main/java/org/springblade/desk/entity/Notice.java
index 75c03f29..806c5bed 100644
--- a/blade-service-api/blade-desk-api/src/main/java/org/springblade/desk/entity/Notice.java
+++ b/blade-service-api/blade-desk-api/src/main/java/org/springblade/desk/entity/Notice.java
@@ -30,8 +30,8 @@ import java.util.Date;
* @author Chill
*/
@Data
-@EqualsAndHashCode(callSuper = true)
@TableName("blade_notice")
+@EqualsAndHashCode(callSuper = true)
public class Notice extends BaseEntity {
private static final long serialVersionUID = 1L;
diff --git a/blade-service-api/blade-dict-api/pom.xml b/blade-service-api/blade-dict-api/pom.xml
index 7f5e998a..702c39d9 100644
--- a/blade-service-api/blade-dict-api/pom.xml
+++ b/blade-service-api/blade-dict-api/pom.xml
@@ -5,7 +5,7 @@
blade-service-api
org.springblade
- 2.0.0.RC8
+ 2.0.0.RC9
4.0.0
diff --git a/blade-service-api/blade-flow-api/pom.xml b/blade-service-api/blade-flow-api/pom.xml
new file mode 100644
index 00000000..bde51297
--- /dev/null
+++ b/blade-service-api/blade-flow-api/pom.xml
@@ -0,0 +1,19 @@
+
+
+
+ blade-service-api
+ org.springblade
+ 2.0.0.RC9
+
+ 4.0.0
+
+ blade-flow-api
+ ${project.artifactId}
+ ${bladex.project.version}
+ jar
+
+
+
+
diff --git a/blade-service-api/blade-flow-api/src/main/java/org/springblade/flowable/core/constant/ProcessConstant.java b/blade-service-api/blade-flow-api/src/main/java/org/springblade/flowable/core/constant/ProcessConstant.java
new file mode 100644
index 00000000..b2e657aa
--- /dev/null
+++ b/blade-service-api/blade-flow-api/src/main/java/org/springblade/flowable/core/constant/ProcessConstant.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the dreamlu.net developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.flowable.core.constant;
+
+/**
+ * 流程常量.
+ *
+ * @author Chill
+ */
+public interface ProcessConstant {
+
+ /**
+ * 请假流程标识
+ */
+ String LEAVE_KEY = "Leave";
+
+}
diff --git a/blade-service-api/blade-flow-api/src/main/java/org/springblade/flowable/core/entity/BladeFlow.java b/blade-service-api/blade-flow-api/src/main/java/org/springblade/flowable/core/entity/BladeFlow.java
new file mode 100644
index 00000000..dd019dfe
--- /dev/null
+++ b/blade-service-api/blade-flow-api/src/main/java/org/springblade/flowable/core/entity/BladeFlow.java
@@ -0,0 +1,120 @@
+/*
+ * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the dreamlu.net developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.flowable.core.entity;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 工作流通用实体类
+ *
+ * @author Chill
+ */
+@Data
+public class BladeFlow implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 任务编号
+ */
+ private String taskId;
+ /**
+ * 任务名称
+ */
+ private String taskName;
+ /**
+ * 任务定义Key
+ */
+ private String taskDefinitionKey;
+ /**
+ * 任务执行人编号
+ */
+ private String assignee;
+ /**
+ * 任务执行人名称
+ */
+ private String assigneeName;
+
+ /**
+ * 历史任务结束时间
+ */
+ private Date historyTaskEndTime;
+ private String executionId;
+ /**
+ * 流程实例ID
+ */
+ private String processInstanceId;
+ /**
+ * 流程信息
+ */
+ private String processDefinitionId;
+ private String processDefinitionKey;
+ private String processDefinitionName;
+ private int processDefinitionVersion;
+ private String processDefinitionDesc;
+ private String processDefinitionDiagramResName;
+ private String processDefinitionResName;
+
+ /**
+ * 已办任务流程实例ID 查看流程图会用到
+ */
+ private String historyProcessInstanceId;
+ /**
+ * 流程实例是否结束(true:结束,false:未结束)
+ */
+ private String processIsFinished;
+
+ /**
+ * 历史活动流程
+ */
+ private String hisActInsActName;
+ /**
+ * 历史活动耗时
+ */
+ private String hisActInsDuTime;
+
+ /**
+ * 业务绑定Table
+ */
+ private String businessTable;
+ /**
+ * 业务绑定ID
+ */
+ private String businessId;
+ /**
+ * 任务状态
+ */
+ private String status;
+ /**
+ * 任务意见
+ */
+ private String comment;
+ /**
+ * 是否继续
+ */
+ private String isPass;
+ /**
+ * 开始查询日期
+ */
+ private Date beginDate;
+ /**
+ * 结束查询日期
+ */
+ private Date endDate;
+}
diff --git a/blade-service-api/blade-flow-api/src/main/java/org/springblade/flowable/core/feign/IFlowClient.java b/blade-service-api/blade-flow-api/src/main/java/org/springblade/flowable/core/feign/IFlowClient.java
new file mode 100644
index 00000000..2711f7ac
--- /dev/null
+++ b/blade-service-api/blade-flow-api/src/main/java/org/springblade/flowable/core/feign/IFlowClient.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the dreamlu.net developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.flowable.core.feign;
+
+import org.springblade.core.launch.constant.AppConstant;
+import org.springblade.flowable.core.entity.BladeFlow;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestParam;
+
+import java.util.Map;
+
+/**
+ * 工作流远程调用接口.
+ *
+ * @author Chill
+ */
+@FeignClient(
+ value = AppConstant.APPLICATION_FLOW_NAME,
+ fallback = IFlowClientFallback.class
+)
+public interface IFlowClient {
+
+ String API_PREFIX = "/client";
+ String START_PROCESS_INSTANCE_BY_Id = API_PREFIX + "start-process-instance-by-id";
+
+ /**
+ * 开启流程
+ *
+ * @param processDefinitionId 流程id
+ * @param businessKey 业务key
+ * @param variables 参数
+ * @return BladeFlow
+ */
+ @PostMapping(START_PROCESS_INSTANCE_BY_Id)
+ BladeFlow startProcessInstanceById(@RequestParam("processDefinitionId") String processDefinitionId, @RequestParam("businessKey") String businessKey, @RequestBody Map variables);
+
+}
diff --git a/blade-service-api/blade-flow-api/src/main/java/org/springblade/flowable/core/feign/IFlowClientFallback.java b/blade-service-api/blade-flow-api/src/main/java/org/springblade/flowable/core/feign/IFlowClientFallback.java
new file mode 100644
index 00000000..fa9795fa
--- /dev/null
+++ b/blade-service-api/blade-flow-api/src/main/java/org/springblade/flowable/core/feign/IFlowClientFallback.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the dreamlu.net developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.flowable.core.feign;
+
+import org.springblade.flowable.core.entity.BladeFlow;
+import org.springframework.stereotype.Component;
+
+import java.util.Map;
+
+/**
+ * 流程远程调用失败处理类
+ *
+ * @author Chill
+ */
+@Component
+public class IFlowClientFallback implements IFlowClient {
+ @Override
+ public BladeFlow startProcessInstanceById(String processDefinitionId, String businessKey, Map variables) {
+ return null;
+ }
+}
diff --git a/blade-service-api/blade-flow-api/src/main/java/org/springblade/flowable/core/utils/FlowUtil.java b/blade-service-api/blade-flow-api/src/main/java/org/springblade/flowable/core/utils/FlowUtil.java
new file mode 100644
index 00000000..3561052e
--- /dev/null
+++ b/blade-service-api/blade-flow-api/src/main/java/org/springblade/flowable/core/utils/FlowUtil.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the dreamlu.net developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.flowable.core.utils;
+
+import org.springblade.core.tool.utils.Func;
+import org.springblade.core.tool.utils.StringUtil;
+import org.springblade.flowable.core.constant.ProcessConstant;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * 工作流工具类
+ *
+ * @author Chill
+ */
+public class FlowUtil {
+
+ /**
+ * 定义流程key对应的表名
+ */
+ private final static Map BUSINESS_TABLE = new HashMap<>();
+
+ /**
+ * 初始化加载
+ */
+ static {
+ BUSINESS_TABLE.put(ProcessConstant.LEAVE_KEY, "blade_process_leave");
+ }
+
+ /**
+ * 通过流程key获取业务表名
+ *
+ * @param key 流程key
+ */
+ public static String getBusinessTable(String key) {
+ String businessTable = BUSINESS_TABLE.get(key);
+ if (Func.isEmpty(businessTable)) {
+ throw new RuntimeException("流程启动失败,未找到相关业务表");
+ }
+ return businessTable;
+ }
+
+ /**
+ * 获取业务标识
+ *
+ * @param businessTable 业务表
+ * @param businessId 业务表主键
+ * @return businessKey
+ */
+ public static String getBusinessKey(String businessTable, String businessId) {
+ return StringUtil.format("{}:{}", businessTable, businessId);
+ }
+
+}
diff --git a/blade-service-api/blade-system-api/pom.xml b/blade-service-api/blade-system-api/pom.xml
index d0368c53..39a258d5 100644
--- a/blade-service-api/blade-system-api/pom.xml
+++ b/blade-service-api/blade-system-api/pom.xml
@@ -5,7 +5,7 @@
blade-service-api
org.springblade
- 2.0.0.RC8
+ 2.0.0.RC9
4.0.0
diff --git a/blade-service-api/blade-user-api/pom.xml b/blade-service-api/blade-user-api/pom.xml
index de91965d..09c21383 100644
--- a/blade-service-api/blade-user-api/pom.xml
+++ b/blade-service-api/blade-user-api/pom.xml
@@ -5,7 +5,7 @@
blade-service-api
org.springblade
- 2.0.0.RC8
+ 2.0.0.RC9
4.0.0
diff --git a/blade-service-api/pom.xml b/blade-service-api/pom.xml
index 75433621..0e70aee4 100644
--- a/blade-service-api/pom.xml
+++ b/blade-service-api/pom.xml
@@ -5,13 +5,13 @@
BladeX
org.springblade
- 2.0.0.RC8
+ 2.0.0.RC9
4.0.0
blade-service-api
${project.artifactId}
- 2.0.0.RC8
+ 2.0.0.RC9
pom
BladeX 微服务API集合
@@ -20,6 +20,7 @@
blade-dict-api
blade-system-api
blade-user-api
+ blade-flow-api
diff --git a/blade-service/blade-desk/pom.xml b/blade-service/blade-desk/pom.xml
index 0eadff5b..3598072e 100644
--- a/blade-service/blade-desk/pom.xml
+++ b/blade-service/blade-desk/pom.xml
@@ -6,7 +6,7 @@
org.springblade
blade-service
- 2.0.0.RC8
+ 2.0.0.RC9
4.0.0
@@ -37,6 +37,11 @@
blade-dict-api
${bladex.project.version}
+
+ org.springblade
+ blade-flow-api
+ ${bladex.project.version}
+
diff --git a/blade-service/blade-desk/src/main/java/org/springblade/desk/controller/LeaveController.java b/blade-service/blade-desk/src/main/java/org/springblade/desk/controller/LeaveController.java
new file mode 100644
index 00000000..6286969c
--- /dev/null
+++ b/blade-service/blade-desk/src/main/java/org/springblade/desk/controller/LeaveController.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the dreamlu.net developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.desk.controller;
+
+import lombok.AllArgsConstructor;
+import org.springblade.common.cache.CacheNames;
+import org.springblade.core.boot.ctrl.BladeController;
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.tool.api.R;
+import org.springblade.desk.entity.ProcessLeave;
+import org.springblade.desk.service.ILeaveService;
+import org.springframework.web.bind.annotation.*;
+import springfox.documentation.annotations.ApiIgnore;
+
+/**
+ * 控制器
+ *
+ * @author Chill
+ */
+@ApiIgnore
+@RestController
+@RequestMapping("/process/leave")
+@AllArgsConstructor
+public class LeaveController extends BladeController implements CacheNames {
+
+ private ILeaveService leaveService;
+
+ /**
+ * 详情
+ */
+ @GetMapping("/detail")
+ public R detail(ProcessLeave leave) {
+ ProcessLeave detail = leaveService.getOne(Condition.getQueryWrapper(leave));
+ return R.data(detail);
+ }
+
+ /**
+ * 新增或修改
+ */
+ @PostMapping("/start")
+ public R start(@RequestBody ProcessLeave leave) {
+ return R.status(leaveService.start(leave));
+ }
+
+
+}
diff --git a/blade-service/blade-desk/src/main/java/org/springblade/desk/entity/ProcessLeave.java b/blade-service/blade-desk/src/main/java/org/springblade/desk/entity/ProcessLeave.java
new file mode 100644
index 00000000..3247455d
--- /dev/null
+++ b/blade-service/blade-desk/src/main/java/org/springblade/desk/entity/ProcessLeave.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the dreamlu.net developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.desk.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.core.mp.base.BaseEntity;
+
+import java.time.LocalDateTime;
+
+/**
+ * 请假流程实体类
+ *
+ * @author Chill
+ */
+@Data
+@TableName("blade_process_leave")
+@EqualsAndHashCode(callSuper = true)
+public class ProcessLeave extends BaseEntity {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 流程定义id
+ */
+ private String processId;
+ /**
+ * 流程实例id
+ */
+ private String instanceId;
+ /**
+ * 请假开始时间
+ */
+ private LocalDateTime startTime;
+ /**
+ * 请假结束时间
+ */
+ private LocalDateTime endTime;
+ /**
+ * 请假理由
+ */
+ private String reason;
+ /**
+ * 批复
+ */
+ private String comment;
+ /**
+ * 流程申请时间
+ */
+ private LocalDateTime applyTime;
+
+}
diff --git a/blade-service/blade-desk/src/main/java/org/springblade/desk/mapper/LeaveMapper.java b/blade-service/blade-desk/src/main/java/org/springblade/desk/mapper/LeaveMapper.java
new file mode 100644
index 00000000..461bf4f2
--- /dev/null
+++ b/blade-service/blade-desk/src/main/java/org/springblade/desk/mapper/LeaveMapper.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the dreamlu.net developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.desk.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.springblade.desk.entity.ProcessLeave;
+
+/**
+ * Mapper 接口
+ *
+ * @author Chill
+ */
+public interface LeaveMapper extends BaseMapper {
+
+}
diff --git a/blade-service/blade-desk/src/main/java/org/springblade/desk/mapper/LeaveMapper.xml b/blade-service/blade-desk/src/main/java/org/springblade/desk/mapper/LeaveMapper.xml
new file mode 100644
index 00000000..37e86b89
--- /dev/null
+++ b/blade-service/blade-desk/src/main/java/org/springblade/desk/mapper/LeaveMapper.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/blade-service/blade-desk/src/main/java/org/springblade/desk/service/ILeaveService.java b/blade-service/blade-desk/src/main/java/org/springblade/desk/service/ILeaveService.java
new file mode 100644
index 00000000..d0f2425f
--- /dev/null
+++ b/blade-service/blade-desk/src/main/java/org/springblade/desk/service/ILeaveService.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the dreamlu.net developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.desk.service;
+
+import org.springblade.core.mp.base.BaseService;
+import org.springblade.desk.entity.ProcessLeave;
+
+/**
+ * 服务类
+ *
+ * @author Chill
+ */
+public interface ILeaveService extends BaseService {
+
+ /**
+ * 开启流程
+ *
+ * @param leave 请假实体
+ * @return boolean
+ */
+ boolean start(ProcessLeave leave);
+
+}
diff --git a/blade-service/blade-desk/src/main/java/org/springblade/desk/service/impl/LeaveServiceImpl.java b/blade-service/blade-desk/src/main/java/org/springblade/desk/service/impl/LeaveServiceImpl.java
new file mode 100644
index 00000000..744da5be
--- /dev/null
+++ b/blade-service/blade-desk/src/main/java/org/springblade/desk/service/impl/LeaveServiceImpl.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the dreamlu.net developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.desk.service.impl;
+
+import lombok.AllArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springblade.core.mp.base.BaseServiceImpl;
+import org.springblade.core.secure.utils.SecureUtil;
+import org.springblade.core.tool.utils.Func;
+import org.springblade.desk.entity.ProcessLeave;
+import org.springblade.desk.mapper.LeaveMapper;
+import org.springblade.desk.service.ILeaveService;
+import org.springblade.flowable.core.constant.ProcessConstant;
+import org.springblade.flowable.core.entity.BladeFlow;
+import org.springblade.flowable.core.feign.IFlowClient;
+import org.springblade.flowable.core.utils.FlowUtil;
+import org.springframework.stereotype.Service;
+
+import java.time.Duration;
+import java.time.LocalDateTime;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * 服务实现类
+ *
+ * @author Chill
+ */
+@Slf4j
+@Service
+@AllArgsConstructor
+public class LeaveServiceImpl extends BaseServiceImpl implements ILeaveService {
+
+ private IFlowClient flowClient;
+
+ @Override
+ public boolean start(ProcessLeave leave) {
+ String businessTable = FlowUtil.getBusinessTable(ProcessConstant.LEAVE_KEY);
+ Map variables = new HashMap<>(16);
+ if (Func.isEmpty(leave.getId())) {
+ // 保存leave
+ leave.setApplyTime(LocalDateTime.now());
+ save(leave);
+ // 启动流程
+ variables.put("taskUser", SecureUtil.getUser().getUserId());
+ variables.put("days", Duration.between(leave.getEndTime(), leave.getStartTime()).toDays());
+ BladeFlow bladeFlow = flowClient.startProcessInstanceById(leave.getProcessId(), FlowUtil.getBusinessKey(businessTable, String.valueOf(leave.getId())), variables);
+ log.debug("流程已启动,流程ID:" + bladeFlow.getProcessInstanceId());
+ leave.setInstanceId(bladeFlow.getProcessInstanceId());
+ updateById(leave);
+ } else {
+
+ updateById(leave);
+ }
+ return true;
+ }
+}
diff --git a/blade-service/blade-flow/pom.xml b/blade-service/blade-flow/pom.xml
index eeea3fbf..a225514b 100644
--- a/blade-service/blade-flow/pom.xml
+++ b/blade-service/blade-flow/pom.xml
@@ -5,7 +5,7 @@
blade-service
org.springblade
- 2.0.0.RC8
+ 2.0.0.RC9
4.0.0
@@ -37,6 +37,11 @@
${bladex.tool.version}
provided
+
+ org.springblade
+ blade-flow-api
+ ${bladex.tool.version}
+
org.mybatis
mybatis-spring
diff --git a/blade-service/blade-flow/src/main/java/org/springblade/flowable/business/controller/LeaveController.java b/blade-service/blade-flow/src/main/java/org/springblade/flowable/business/controller/LeaveController.java
index b44de833..15876a02 100644
--- a/blade-service/blade-flow/src/main/java/org/springblade/flowable/business/controller/LeaveController.java
+++ b/blade-service/blade-flow/src/main/java/org/springblade/flowable/business/controller/LeaveController.java
@@ -17,20 +17,14 @@
package org.springblade.flowable.business.controller;
import lombok.AllArgsConstructor;
-import org.flowable.bpmn.model.BpmnModel;
-import org.flowable.engine.*;
-import org.flowable.engine.runtime.Execution;
+import org.flowable.engine.RuntimeService;
+import org.flowable.engine.TaskService;
import org.flowable.engine.runtime.ProcessInstance;
-import org.flowable.image.ProcessDiagramGenerator;
import org.flowable.task.api.Task;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
-import javax.servlet.http.HttpServletResponse;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -48,10 +42,6 @@ public class LeaveController {
private TaskService taskService;
- private RepositoryService repositoryService;
-
- private ProcessEngine processEngine;
-
/**
* 添加报销
*
@@ -113,56 +103,4 @@ public class LeaveController {
taskService.complete(taskId, map);
return "reject";
}
-
- /**
- * 生成流程图
- *
- * @param processId 任务ID
- */
- @RequestMapping(value = "processDiagram")
- public void genProcessDiagram(HttpServletResponse httpServletResponse, String processId) throws Exception {
- ProcessInstance pi = runtimeService.createProcessInstanceQuery().processInstanceId(processId).singleResult();
-
- //流程走完的不显示图
- if (pi == null) {
- return;
- }
- Task task = taskService.createTaskQuery().processInstanceId(pi.getId()).singleResult();
- //使用流程实例ID,查询正在执行的执行对象表,返回流程实例对象
- String instanceId = task.getProcessInstanceId();
- List executions = runtimeService
- .createExecutionQuery()
- .processInstanceId(instanceId)
- .list();
-
- //得到正在执行的Activity的Id
- List activityIds = new ArrayList<>();
- List flows = new ArrayList<>();
- for (Execution exe : executions) {
- List ids = runtimeService.getActiveActivityIds(exe.getId());
- activityIds.addAll(ids);
- }
-
- //获取流程图
- BpmnModel bpmnModel = repositoryService.getBpmnModel(pi.getProcessDefinitionId());
- ProcessEngineConfiguration engconf = processEngine.getProcessEngineConfiguration();
- ProcessDiagramGenerator diagramGenerator = engconf.getProcessDiagramGenerator();
- InputStream in = diagramGenerator.generateDiagram(bpmnModel, "png", activityIds, flows, engconf.getActivityFontName(), engconf.getLabelFontName(), engconf.getAnnotationFontName(), engconf.getClassLoader(), 1.0, true);
- OutputStream out = null;
- byte[] buf = new byte[1024];
- int legth = 0;
- try {
- out = httpServletResponse.getOutputStream();
- while ((legth = in.read(buf)) != -1) {
- out.write(buf, 0, legth);
- }
- } finally {
- if (in != null) {
- in.close();
- }
- if (out != null) {
- out.close();
- }
- }
- }
}
diff --git a/blade-service/blade-flow/src/main/java/org/springblade/flowable/business/feign/FlowClient.java b/blade-service/blade-flow/src/main/java/org/springblade/flowable/business/feign/FlowClient.java
new file mode 100644
index 00000000..c8d64a99
--- /dev/null
+++ b/blade-service/blade-flow/src/main/java/org/springblade/flowable/business/feign/FlowClient.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the dreamlu.net developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.flowable.business.feign;
+
+import lombok.AllArgsConstructor;
+import org.flowable.engine.RuntimeService;
+import org.flowable.engine.TaskService;
+import org.flowable.engine.runtime.ProcessInstance;
+import org.springblade.flowable.core.entity.BladeFlow;
+import org.springblade.flowable.core.feign.IFlowClient;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.Map;
+
+/**
+ * 流程远程调用实现类
+ *
+ * @author Chill
+ */
+@RestController
+@AllArgsConstructor
+public class FlowClient implements IFlowClient {
+
+ private RuntimeService runtimeService;
+
+ private TaskService taskService;
+
+ @Override
+ @PostMapping(START_PROCESS_INSTANCE_BY_Id)
+ public BladeFlow startProcessInstanceById(String processDefinitionId, String businessKey, @RequestBody Map variables) {
+ ProcessInstance processInstance = runtimeService.startProcessInstanceById(processDefinitionId, businessKey, variables);
+ BladeFlow flow = new BladeFlow();
+ flow.setProcessInstanceId(processInstance.getId());
+ return flow;
+ }
+
+}
diff --git a/blade-service/blade-flow/src/main/java/org/springblade/flowable/launch/FlowableLauncherServiceImpl.java b/blade-service/blade-flow/src/main/java/org/springblade/flowable/launch/FlowableLauncherServiceImpl.java
index b0c54dcd..fbbae980 100644
--- a/blade-service/blade-flow/src/main/java/org/springblade/flowable/launch/FlowableLauncherServiceImpl.java
+++ b/blade-service/blade-flow/src/main/java/org/springblade/flowable/launch/FlowableLauncherServiceImpl.java
@@ -26,7 +26,7 @@ import java.util.Properties;
/**
* 启动参数拓展
*
- * @author smallchil
+ * @author Chill
*/
@AutoService(LauncherService.class)
public class FlowableLauncherServiceImpl implements LauncherService {
diff --git a/blade-service/blade-log/pom.xml b/blade-service/blade-log/pom.xml
index d7a6bb5d..9cab34de 100644
--- a/blade-service/blade-log/pom.xml
+++ b/blade-service/blade-log/pom.xml
@@ -5,7 +5,7 @@
blade-service
org.springblade
- 2.0.0.RC8
+ 2.0.0.RC9
4.0.0
diff --git a/blade-service/blade-system/pom.xml b/blade-service/blade-system/pom.xml
index ffe91f69..7455c24e 100644
--- a/blade-service/blade-system/pom.xml
+++ b/blade-service/blade-system/pom.xml
@@ -5,7 +5,7 @@
blade-service
org.springblade
- 2.0.0.RC8
+ 2.0.0.RC9
4.0.0
diff --git a/blade-service/blade-user/pom.xml b/blade-service/blade-user/pom.xml
index 63941761..b379610b 100644
--- a/blade-service/blade-user/pom.xml
+++ b/blade-service/blade-user/pom.xml
@@ -5,7 +5,7 @@
blade-service
org.springblade
- 2.0.0.RC8
+ 2.0.0.RC9
4.0.0
diff --git a/blade-service/pom.xml b/blade-service/pom.xml
index bf3aea5d..5c6abf18 100644
--- a/blade-service/pom.xml
+++ b/blade-service/pom.xml
@@ -6,14 +6,14 @@
blade-service
${project.artifactId}
- 2.0.0.RC8
+ 2.0.0.RC9
pom
BladeX 微服务集合
org.springblade
BladeX
- 2.0.0.RC8
+ 2.0.0.RC9
diff --git a/doc/sql/bladex-update-RC9.sql b/doc/sql/bladex-update-RC9.sql
index 1138c980..882c0d1f 100644
--- a/doc/sql/bladex-update-RC9.sql
+++ b/doc/sql/bladex-update-RC9.sql
@@ -88,3 +88,27 @@ INSERT INTO `bladex`.`blade_dict`(`parent_id`, `code`, `dict_key`, `dict_value`,
VALUES (@dictid, 'flow', 1, '请假流程', 1, NULL, 0);
INSERT INTO `bladex`.`blade_dict`(`parent_id`, `code`, `dict_key`, `dict_value`, `sort`, `remark`, `is_deleted`)
VALUES (@dictid, 'flow', 2, '报销流程', 2, NULL, 0);
+
+-- ----------------------------
+-- 增加业务流程表
+-- ----------------------------
+DROP TABLE IF EXISTS `blade_process_leave`;
+CREATE TABLE `blade_process_leave` (
+`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '编号',
+`process_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '流程定义主键',
+`instance_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '流程实例主键',
+`start_time` datetime(0) NULL DEFAULT NULL COMMENT '开始时间',
+`end_time` datetime(0) NULL DEFAULT NULL COMMENT '结束时间',
+`reason` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '请假理由',
+`comment` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '领导意见',
+`apply_time` datetime(0) NULL DEFAULT NULL COMMENT '申请时间',
+`create_user` int(11) NULL DEFAULT NULL COMMENT '创建人',
+`create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
+`update_user` int(11) NULL DEFAULT NULL COMMENT '修改人',
+`update_time` datetime(0) NULL DEFAULT NULL COMMENT '修改时间',
+`status` int(2) NULL DEFAULT NULL COMMENT '状态',
+`is_deleted` int(2) NULL DEFAULT NULL COMMENT '是否已删除',
+PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci;
+
+SET FOREIGN_KEY_CHECKS = 1;
diff --git a/pom.xml b/pom.xml
index a2b54665..4408427b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,17 +5,17 @@
org.springblade
BladeX
- 2.0.0.RC8
+ 2.0.0.RC9
pom
- 2.0.0.RC8
- 2.0.0.RC8
+ 2.0.0.RC9
+ 2.0.0.RC9
1.8
2.9.2
1.5.21
- 1.9.2
+ 1.9.3
3.1.0
4.0.1
1.6.0
diff --git a/script/docker/.env b/script/docker/.env
index b681c25c..6ceead26 100644
--- a/script/docker/.env
+++ b/script/docker/.env
@@ -1,2 +1,2 @@
REGISTER=192.168.0.157/blade
-TAG=2.0.0.RC8
+TAG=2.0.0.RC9