Skip to content

Commit 898b04a

Browse files
committed
重构工作流(7)
1 parent 3d8ee2e commit 898b04a

File tree

15 files changed

+224
-174
lines changed

15 files changed

+224
-174
lines changed

hsweb-system/hsweb-system-workflow/hsweb-system-workflow-local/src/main/java/org/hswebframework/web/workflow/dao/entity/ActivityConfigEntity.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,6 @@ public class ActivityConfigEntity extends SimpleGenericEntity<String> {
3838
*/
3939
private String formId;
4040

41-
/**
42-
* 前端表单模版ID
43-
*/
44-
private String formTemplateId;
45-
4641
/**
4742
* 节点办理候选人维度,用于设置该环节的办理人,json格式,由CandidateDimensionParser解析
4843
*/

hsweb-system/hsweb-system-workflow/hsweb-system-workflow-local/src/main/java/org/hswebframework/web/workflow/dao/entity/ProcessDefineConfigEntity.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,6 @@ public class ProcessDefineConfigEntity extends SimpleGenericEntity<String> {
3232
@NotBlank(groups = CreateGroup.class)
3333
private String formId;
3434

35-
/**
36-
* 前端表单模版ID
37-
*/
38-
private String formTemplateId;
39-
4035
/**
4136
* 权限维度,用于控制不同人,可发起不同的流程
4237
*/

hsweb-system/hsweb-system-workflow/hsweb-system-workflow-local/src/main/java/org/hswebframework/web/workflow/dao/entity/ProcessHistoryEntity.java

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
import javax.validation.constraints.NotNull;
88
import java.util.Date;
9+
import java.util.HashMap;
910
import java.util.Map;
1011

1112
/**
@@ -33,20 +34,9 @@ public class ProcessHistoryEntity extends SimpleGenericEntity<String> {
3334
@NotBlank(message = "[processInstanceId]不能为空")
3435
private String processInstanceId;
3536

36-
@NotBlank(message = "[taskId]不能为空")
37-
private String taskId;
38-
39-
@NotBlank(message = "[taskDefineKey]不能为空")
40-
private String taskDefineKey;
41-
42-
@NotBlank(message = "[taskName]不能为空")
43-
private String taskName;
44-
4537
@NotBlank(message = "[businessKey]不能为空")
4638
private String businessKey;
4739

48-
private Map<String, Object> data;
49-
5040
@NotNull(message = "[createTime]不能为空")
5141
private Date createTime;
5242

@@ -56,4 +46,11 @@ public class ProcessHistoryEntity extends SimpleGenericEntity<String> {
5646
@NotBlank(message = "[creatorName]不能为空")
5747
private String creatorName;
5848

49+
private Map<String, Object> data = new HashMap<>();
50+
51+
private String taskId;
52+
53+
private String taskDefineKey;
54+
55+
private String taskName;
5956
}

hsweb-system/hsweb-system-workflow/hsweb-system-workflow-local/src/main/java/org/hswebframework/web/workflow/service/BpmTaskService.java

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import org.activiti.engine.impl.pvm.process.ActivityImpl;
55
import org.activiti.engine.task.Task;
66
import org.hswebframework.web.workflow.service.request.CompleteTaskRequest;
7+
import org.hswebframework.web.workflow.service.request.RejectTaskRequest;
78

89
import java.util.Collection;
910
import java.util.List;
@@ -68,24 +69,6 @@ public interface BpmTaskService {
6869
void claim(String taskId, String userId);
6970

7071

71-
/**
72-
* 预留等待签收的任务
73-
*
74-
* @param userId 用户id
75-
* @return 任务信息
76-
* @throws Exception
77-
*/
78-
List<Task> claimList(String userId);
79-
80-
/**
81-
* 已签收待办理的任务
82-
*
83-
* @param userId 用户id
84-
* @return 任务信息
85-
* @throws Exception
86-
*/
87-
List<Task> todoList(String userId);
88-
8972
/**
9073
* 完成任务
9174
*
@@ -104,9 +87,9 @@ public interface BpmTaskService {
10487
/**
10588
* 驳回
10689
*
107-
* @param taskId
90+
* @param request
10891
*/
109-
void reject(String taskId);
92+
void reject(RejectTaskRequest request);
11093

11194
/**
11295
* 设置办理人

hsweb-system/hsweb-system-workflow/hsweb-system-workflow-local/src/main/java/org/hswebframework/web/workflow/service/WorkFlowFormService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
public interface WorkFlowFormService {
1717
void saveProcessForm(ProcessInstance instance, SaveFormRequest request);
1818

19-
void saveTaskForm(Task task, SaveFormRequest request);
19+
void saveTaskForm(ProcessInstance instance,Task task, SaveFormRequest request);
2020

2121
<T> PagerResult<T> selectProcessForm(String processDefineId, QueryParamEntity queryParam);
2222

hsweb-system/hsweb-system-workflow/hsweb-system-workflow-local/src/main/java/org/hswebframework/web/workflow/service/imp/BpmProcessServiceImpl.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
package org.hswebframework.web.workflow.service.imp;
22

3+
import org.activiti.engine.impl.persistence.entity.ExecutionEntity;
34
import org.activiti.engine.repository.ProcessDefinition;
45
import org.activiti.engine.runtime.Job;
56
import org.activiti.engine.runtime.ProcessInstance;
67
import org.activiti.engine.task.Task;
78
import org.hswebframework.utils.StringUtils;
89
import org.hswebframework.web.NotFoundException;
910
import org.hswebframework.web.id.IDGenerator;
11+
import org.hswebframework.web.workflow.dao.entity.ProcessHistoryEntity;
1012
import org.hswebframework.web.workflow.service.BpmProcessService;
1113
import org.hswebframework.web.workflow.service.BpmTaskService;
14+
import org.hswebframework.web.workflow.service.ProcessHistoryService;
1215
import org.hswebframework.web.workflow.service.WorkFlowFormService;
1316
import org.hswebframework.web.workflow.service.request.SaveFormRequest;
1417
import org.hswebframework.web.workflow.service.request.StartProcessRequest;
@@ -37,6 +40,9 @@ public class BpmProcessServiceImpl extends AbstractFlowableService implements Bp
3740
@Autowired
3841
private WorkFlowFormService workFlowFormService;
3942

43+
@Autowired
44+
private ProcessHistoryService processHistoryService;
45+
4046
@Override
4147
public List<ProcessDefinition> getAllProcessDefinition() {
4248
return repositoryService.createProcessDefinitionQuery().latestVersion().active().list();
@@ -113,6 +119,20 @@ public ProcessInstance startProcessInstance(StartProcessRequest request) {
113119
.userName(request.getCreatorName())
114120
.formData(request.getFormData())
115121
.build());
122+
123+
ProcessHistoryEntity history = ProcessHistoryEntity.builder()
124+
.type("start")
125+
.typeText("启动流程")
126+
.businessKey(businessKey)
127+
.creatorId(request.getCreatorId())
128+
.creatorName(request.getCreatorName())
129+
.processInstanceId(processInstance.getProcessInstanceId())
130+
.processDefineId(processInstance.getProcessDefinitionId())
131+
.build();
132+
133+
processHistoryService.insert(history);
134+
135+
116136
} finally {
117137
identityService.setAuthenticatedUserId(null);
118138
}

0 commit comments

Comments
 (0)