Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lingxi-lxy-yanshou
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
后端-黄柯铭
lingxi-lxy-yanshou
Commits
4a058744
Commit
4a058744
authored
Jul 27, 2020
by
技术总监-万宁
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
业务平台会员管理功能开发中0727
parent
37705fa5
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
269 additions
and
1 deletion
+269
-1
IMultiParamsTaskExecuteService.java
...ngxi/workflow/service/IMultiParamsTaskExecuteService.java
+20
-0
ITaskExecuteService.java
.../com/ssy/lingxi/workflow/service/ITaskExecuteService.java
+1
-0
MultiParamsTaskExecuteServiceImpl.java
...rkflow/serviceimpl/MultiParamsTaskExecuteServiceImpl.java
+94
-0
TaskExecuteServiceImpl.java
...y/lingxi/workflow/serviceimpl/TaskExecuteServiceImpl.java
+3
-0
build.gradle
workflow-service/workflow-service-api/build.gradle
+2
-0
settings.gradle
workflow-service/workflow-service-api/settings.gradle
+2
-0
TaskExecuteControllerFeign.java
...lingxi/workflow/api/feign/TaskExecuteControllerFeign.java
+44
-0
MultiParamsTaskResultVO.java
...lingxi/workflow/api/model/vo/MultiParamsTaskResultVO.java
+53
-0
ProcessStartVO.java
.../com/ssy/lingxi/workflow/api/model/vo/ProcessStartVO.java
+1
-1
ProcessStartWithMultiParamsVO.java
.../workflow/api/model/vo/ProcessStartWithMultiParamsVO.java
+49
-0
No files found.
workflow-service/src/main/java/com/ssy/lingxi/workflow/service/IMultiParamsTaskExecuteService.java
0 → 100644
View file @
4a058744
package
com
.
ssy
.
lingxi
.
workflow
.
service
;
import
com.ssy.common.response.Wrapper
;
import
com.ssy.lingxi.workflow.api.model.vo.MultiParamsTaskResultVO
;
import
com.ssy.lingxi.workflow.api.model.vo.ProcessStartWithMultiParamsVO
;
/**
* 多参数任务执行接口
* @author 万宁
* @version 2.0.0
* @date 2020-07-27
*/
public
interface
IMultiParamsTaskExecuteService
{
/**
* 启动流程任务
* @return
*/
Wrapper
<
MultiParamsTaskResultVO
>
startProcess
(
ProcessStartWithMultiParamsVO
startVO
);
}
workflow-service/src/main/java/com/ssy/lingxi/workflow/service/ITaskExecuteService.java
View file @
4a058744
...
...
@@ -19,6 +19,7 @@ public interface ITaskExecuteService {
*/
Wrapper
<
TaskResultVO
>
startProcess
(
ProcessStartVO
startVO
);
/**
* 完成流程任务
* @param taskVO
...
...
workflow-service/src/main/java/com/ssy/lingxi/workflow/serviceimpl/MultiParamsTaskExecuteServiceImpl.java
0 → 100644
View file @
4a058744
package
com
.
ssy
.
lingxi
.
workflow
.
serviceimpl
;
import
com.ssy.common.response.ResponseCode
;
import
com.ssy.common.response.Wrapper
;
import
com.ssy.lingxi.workflow.api.model.contant.ProcessEnum
;
import
com.ssy.lingxi.workflow.api.model.vo.MultiParamsTaskResultVO
;
import
com.ssy.lingxi.workflow.api.model.vo.ProcessStartWithMultiParamsVO
;
import
com.ssy.lingxi.workflow.entity.ProcessTaskDefinitionDO
;
import
com.ssy.lingxi.workflow.repository.ProcessTaskDefinitionRepository
;
import
com.ssy.lingxi.workflow.service.IMultiParamsTaskExecuteService
;
import
org.camunda.bpm.engine.RepositoryService
;
import
org.camunda.bpm.engine.RuntimeService
;
import
org.camunda.bpm.engine.TaskService
;
import
org.camunda.bpm.engine.runtime.ProcessInstance
;
import
org.camunda.bpm.engine.task.Task
;
import
org.camunda.bpm.engine.variable.VariableMap
;
import
org.camunda.bpm.engine.variable.Variables
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* 多参数任务执行接口实现类
* @author 万宁
* @version 2.0.0
* @date 2020-07-27
*/
@Service
public
class
MultiParamsTaskExecuteServiceImpl
implements
IMultiParamsTaskExecuteService
{
/**
* 流程的第一步
*/
private
final
Integer
FIRST_STEP
=
1
;
/**
* 流程跳转时,参数的key
*/
private
final
String
TASK_JUMP_VAR_KEY
=
"status"
;
@Autowired
private
ProcessTaskDefinitionRepository
definitionRepository
;
@Autowired
private
TaskService
taskService
;
@Autowired
private
RuntimeService
runtimeService
;
@Autowired
private
RepositoryService
repositoryService
;
@Override
public
Wrapper
<
MultiParamsTaskResultVO
>
startProcess
(
ProcessStartWithMultiParamsVO
startVO
)
{
//判断枚举是否已经定义、流程步骤是否已经定义
List
<
ProcessTaskDefinitionDO
>
definitionDOList
=
definitionRepository
.
findProcessTaskDefinitionDOSByProcessEnum
(
startVO
.
getProcessEnum
());
if
(
CollectionUtils
.
isEmpty
(
definitionDOList
)
||
!
ProcessEnum
.
existProcessEnum
(
startVO
.
getProcessEnum
()))
{
return
Wrapper
.
fail
(
ResponseCode
.
WF_PROCESS_DEFINITION_DOES_NOT_EXIST
);
}
//判断工作流是否已经部署
String
processKey
=
ProcessEnum
.
getProcessKeyByCode
(
startVO
.
getProcessEnum
());
if
(
repositoryService
.
createProcessDefinitionQuery
().
processDefinitionKey
(
processKey
).
list
().
size
()
==
0
)
{
return
Wrapper
.
fail
(
ResponseCode
.
WF_PROCESS_DEPLOYMENT_DOES_NOT_EXIST
);
}
//设置流程参数
Map
<
String
,
Object
>
varMap
=
new
HashMap
<>();
for
(
Map
.
Entry
<
String
,
Long
>
m
:
startVO
.
getParamMap
().
entrySet
())
{
varMap
.
put
(
m
.
getKey
(),
m
.
getValue
());
}
VariableMap
variable
=
Variables
.
fromMap
(
varMap
);
//启动流程
ProcessInstance
process
=
runtimeService
.
startProcessInstanceByKey
(
processKey
,
variable
);
//获取任务Id
Task
task
=
taskService
.
createTaskQuery
().
processInstanceId
(
process
.
getProcessInstanceId
()).
list
().
get
(
0
);
//第一个步骤
Integer
firstTaskStep
=
definitionDOList
.
stream
().
mapToInt
(
ProcessTaskDefinitionDO:
:
getTaskStep
).
min
().
getAsInt
();
MultiParamsTaskResultVO
resultVO
=
new
MultiParamsTaskResultVO
();
resultVO
.
setParamMap
(
startVO
.
getParamMap
());
resultVO
.
setTaskId
(
task
.
getId
());
//状态为第最小步骤值 - 1
resultVO
.
setStatus
(
firstTaskStep
-
1
);
return
Wrapper
.
success
(
resultVO
);
}
}
workflow-service/src/main/java/com/ssy/lingxi/workflow/serviceimpl/TaskExecuteServiceImpl.java
View file @
4a058744
...
...
@@ -24,6 +24,7 @@ import org.springframework.stereotype.Service;
import
org.springframework.util.CollectionUtils
;
import
java.util.*
;
import
java.util.stream.Collectors
;
/**
* 任务执行服务接口实现类
...
...
@@ -97,6 +98,8 @@ public class TaskExecuteServiceImpl implements ITaskExecuteService {
return
Wrapper
.
success
(
resultVO
);
}
/**
* 执行流程任务
*
...
...
workflow-service/workflow-service-api/build.gradle
View file @
4a058744
...
...
@@ -18,6 +18,8 @@ repositories {
}
dependencies
{
compile
group:
'jakarta.validation'
,
name:
'jakarta.validation-api'
,
version:
'2.0.2'
compile
group:
'org.springframework.cloud'
,
name:
'spring-cloud-starter-openfeign'
,
version:
'2.2.2.RELEASE'
implementation
project
(
':common'
)
testCompile
group:
'junit'
,
name:
'junit'
,
version:
'4.12'
}
workflow-service/workflow-service-api/settings.gradle
0 → 100644
View file @
4a058744
rootProject
.
name
=
'workflow-service-api'
\ No newline at end of file
workflow-service/workflow-service-api/src/main/java/com/ssy/lingxi/workflow/api/feign/TaskExecuteControllerFeign.java
0 → 100644
View file @
4a058744
package
com
.
ssy
.
lingxi
.
workflow
.
api
.
feign
;
import
com.ssy.common.response.Wrapper
;
import
com.ssy.lingxi.workflow.api.model.vo.*
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
javax.validation.Valid
;
import
java.util.List
;
/**
* 工作流服务内部接口 - 带一个参数的任务执行接口
* @author 万宁
* @version 2.0.0
* @date 2020-07-27
*/
@FeignClient
(
name
=
"merchant-member-service"
)
@RequestMapping
(
"/workflow/task"
)
public
interface
TaskExecuteControllerFeign
{
/**
* 启动任务流程,带一个Long类型的参数
* @return
*/
@RequestMapping
(
"/start"
)
Wrapper
<
TaskResultVO
>
startProcess
(
@RequestBody
@Valid
ProcessStartVO
startVO
);
/**
* 执行流程任务,带一个Long类型的参数
* @param executeVO
* @return
*/
@RequestMapping
(
"/exec"
)
Wrapper
completeTask
(
@RequestBody
@Valid
CompleteTaskVO
executeVO
);
/**
* 查询流程中某步骤的参数列表
* @param queryVO
* @return
*/
@RequestMapping
(
"/param/list"
)
Wrapper
<
List
<
TaskParamVO
>>
listTaskParam
(
@Valid
TaskParamQueryVO
queryVO
);
}
workflow-service/workflow-service-api/src/main/java/com/ssy/lingxi/workflow/api/model/vo/MultiParamsTaskResultVO.java
0 → 100644
View file @
4a058744
package
com
.
ssy
.
lingxi
.
workflow
.
api
.
model
.
vo
;
import
java.io.Serializable
;
import
java.util.Map
;
/**
* 任务结果返回VO,带多个参数
* @author 万宁
* @version 2.0.0
* @date 2020-07-25
*/
public
class
MultiParamsTaskResultVO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
6083240167115495993L
;
/**
* 记录在调用方的状态
*/
private
Integer
status
;
/**
* 任务参数
*/
private
Map
<
String
,
Long
>
paramMap
;
/**
* 工作流任务Id
*/
private
String
taskId
;
public
Integer
getStatus
()
{
return
status
;
}
public
void
setStatus
(
Integer
status
)
{
this
.
status
=
status
;
}
public
Map
<
String
,
Long
>
getParamMap
()
{
return
paramMap
;
}
public
void
setParamMap
(
Map
<
String
,
Long
>
paramMap
)
{
this
.
paramMap
=
paramMap
;
}
public
String
getTaskId
()
{
return
taskId
;
}
public
void
setTaskId
(
String
taskId
)
{
this
.
taskId
=
taskId
;
}
}
workflow-service/workflow-service-api/src/main/java/com/ssy/lingxi/workflow/api/model/vo/ProcessStartVO.java
View file @
4a058744
...
...
@@ -7,7 +7,7 @@ import javax.validation.constraints.Positive;
import
java.io.Serializable
;
/**
* 工作流启动任务接口参数VO
* 工作流启动任务接口参数VO
,只带一个参数
* @author 万宁
* @version 2.0.0
* @date 2020-07-25
...
...
workflow-service/workflow-service-api/src/main/java/com/ssy/lingxi/workflow/api/model/vo/ProcessStartWithMultiParamsVO.java
0 → 100644
View file @
4a058744
package
com
.
ssy
.
lingxi
.
workflow
.
api
.
model
.
vo
;
import
com.ssy.lingxi.workflow.api.handler.annotation.ProcessEnumAnno
;
import
javax.validation.constraints.NotNull
;
import
javax.validation.constraints.Positive
;
import
java.io.Serializable
;
import
java.util.Map
;
/**
* 工作流启动任务接口参数VO,带多个参数
* @author 万宁
* @version 2.0.0
* @date 2020-07-25
*/
public
class
ProcessStartWithMultiParamsVO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
2600783390945537829L
;
/**
* 工作流类型枚举,定义在ProcessEnum中
*/
@NotNull
(
message
=
"工作流类型枚举不能为空"
)
@ProcessEnumAnno
private
Integer
processEnum
;
/**
* 任务参数的Value,有接口调用方传递,paramKey非空时必须传递
* 例如审核的会员Id,批准或拒绝的申请单Id等
*/
@NotNull
(
message
=
"任务参数不能为空"
)
@Positive
(
message
=
"任务参数要大于0"
)
private
Map
<
String
,
Long
>
paramMap
;
public
Integer
getProcessEnum
()
{
return
processEnum
;
}
public
void
setProcessEnum
(
Integer
processEnum
)
{
this
.
processEnum
=
processEnum
;
}
public
Map
<
String
,
Long
>
getParamMap
()
{
return
paramMap
;
}
public
void
setParamMap
(
Map
<
String
,
Long
>
paramMap
)
{
this
.
paramMap
=
paramMap
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment