From 950757cb3468ea9fa371d673f863334f8aadbd14 Mon Sep 17 00:00:00 2001
From: java110 <928255095@qq.com>
Date: 星期四, 25 六月 2020 16:37:55 +0800
Subject: [PATCH] 优化 投诉建议查询
---
service-common/src/main/java/com/java110/common/smo/impl/ComplaintUserInnerServiceSMOImpl.java | 42 ++++++++++++++++++++++--------------------
1 files changed, 22 insertions(+), 20 deletions(-)
diff --git a/service-common/src/main/java/com/java110/common/smo/impl/ComplaintUserInnerServiceSMOImpl.java b/service-common/src/main/java/com/java110/common/smo/impl/ComplaintUserInnerServiceSMOImpl.java
index 3074b30..dac1e07 100644
--- a/service-common/src/main/java/com/java110/common/smo/impl/ComplaintUserInnerServiceSMOImpl.java
+++ b/service-common/src/main/java/com/java110/common/smo/impl/ComplaintUserInnerServiceSMOImpl.java
@@ -69,23 +69,8 @@
Map<String, Object> variables = new HashMap<String, Object>();
//variables.put("complaintDto", complaintDto);
variables.put("startUserId", complaintDto.getCurrentUserId());
- //寮�鍚祦绋�
- //WorkflowDto.DEFAULT_PROCESS + workflowDto.getFlowId()
- WorkflowDto workflowDto = new WorkflowDto();
- workflowDto.setFlowType(WorkflowDto.FLOW_TYPE_COMPLAINT);
- workflowDto.setCommunityId(complaintDto.getCommunityId());
- List<WorkflowDto> workflowDtos = workflowInnerServiceSMOImpl.queryWorkflows(workflowDto);
- Assert.listOnlyOne(workflowDtos, "鏈壘鍒� 鎶曡瘔寤鸿娴佺▼鎴栨壘鍒板鏉�");
-
- WorkflowDto tmpWorkflowDto = workflowDtos.get(0);
- if (StringUtil.isEmpty(tmpWorkflowDto.getProcessDefinitionKey())) {
- throw new IllegalArgumentException("娴佺▼杩樻湭閮ㄧ讲");
- }
-
- String deployId = tmpWorkflowDto.getProcessDefinitionKey();
-
- ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(WorkflowDto.DEFAULT_PROCESS + tmpWorkflowDto.getFlowId(), complaintDto.getComplaintId(), variables);
+ ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(getWorkflowDto(complaintDto.getCommunityId()), complaintDto.getComplaintId(), variables);
//灏嗗緱鍒扮殑瀹炰緥娴佺▼id鍊艰祴缁欎箣鍓嶈缃殑鍙橀噺
String processInstanceId = processInstance.getId();
// System.out.println("娴佺▼寮�鍚垚鍔�.......瀹炰緥娴佺▼id:" + processInstanceId);
@@ -94,6 +79,23 @@
//绗竴涓妭鐐硅嚜鍔ㄦ彁浜�
//autoFinishFirstTask(complaintDto);
return complaintDto;
+ }
+
+ private String getWorkflowDto(String communityId) {
+ //寮�鍚祦绋�
+ //WorkflowDto.DEFAULT_PROCESS + workflowDto.getFlowId()
+ WorkflowDto workflowDto = new WorkflowDto();
+ workflowDto.setFlowType(WorkflowDto.FLOW_TYPE_COMPLAINT);
+ workflowDto.setCommunityId(communityId);
+ List<WorkflowDto> workflowDtos = workflowInnerServiceSMOImpl.queryWorkflows(workflowDto);
+
+ Assert.listOnlyOne(workflowDtos, "鏈壘鍒� 鎶曡瘔寤鸿娴佺▼鎴栨壘鍒板鏉�");
+
+ WorkflowDto tmpWorkflowDto = workflowDtos.get(0);
+ if (StringUtil.isEmpty(tmpWorkflowDto.getProcessDefinitionKey())) {
+ throw new IllegalArgumentException("娴佺▼杩樻湭閮ㄧ讲");
+ }
+ return WorkflowDto.DEFAULT_PROCESS + tmpWorkflowDto.getFlowId();
}
/**
@@ -125,7 +127,7 @@
*/
public long getUserTaskCount(@RequestBody AuditUser user) {
TaskService taskService = processEngine.getTaskService();
- TaskQuery query = taskService.createTaskQuery().processDefinitionKey("complaint");
+ TaskQuery query = taskService.createTaskQuery().processDefinitionKey(getWorkflowDto(user.getCommunityId()));
query.taskAssignee(user.getUserId());
return query.count();
}
@@ -137,7 +139,7 @@
*/
public List<ComplaintDto> getUserTasks(@RequestBody AuditUser user) {
TaskService taskService = processEngine.getTaskService();
- TaskQuery query = taskService.createTaskQuery().processDefinitionKey("complaint");
+ TaskQuery query = taskService.createTaskQuery().processDefinitionKey(getWorkflowDto(user.getCommunityId()));
;
query.taskAssignee(user.getUserId());
query.orderByTaskCreateTime().desc();
@@ -191,7 +193,7 @@
// .taskAssignee(user.getUserId());
HistoricTaskInstanceQuery historicTaskInstanceQuery = historyService.createHistoricTaskInstanceQuery()
- .processDefinitionKey("complaint")
+ .processDefinitionKey(getWorkflowDto(user.getCommunityId()))
.taskAssignee(user.getUserId());
if (!StringUtil.isEmpty(user.getAuditLink()) && "START".equals(user.getAuditLink())) {
historicTaskInstanceQuery.taskName("complaint");
@@ -212,7 +214,7 @@
HistoryService historyService = processEngine.getHistoryService();
HistoricTaskInstanceQuery historicTaskInstanceQuery = historyService.createHistoricTaskInstanceQuery()
- .processDefinitionKey("complaint")
+ .processDefinitionKey(getWorkflowDto(user.getCommunityId()))
.taskAssignee(user.getUserId());
if (!StringUtil.isEmpty(user.getAuditLink()) && "START".equals(user.getAuditLink())) {
historicTaskInstanceQuery.taskName("complaint");
--
Gitblit v1.8.0