From ef73a35d0eecb7673a3129c117684300e8ee9e12 Mon Sep 17 00:00:00 2001
From: java110 <928255095@qq.com>
Date: 星期四, 29 四月 2021 19:35:39 +0800
Subject: [PATCH] 优化代码

---
 service-common/src/main/java/com/java110/common/smo/impl/AllocationStorehouseUserInnerServiceSMOImpl.java |   99 +++++++++++++++++++++++++------------------------
 1 files changed, 51 insertions(+), 48 deletions(-)

diff --git a/service-common/src/main/java/com/java110/common/smo/impl/AllocationStorehouseUserInnerServiceSMOImpl.java b/service-common/src/main/java/com/java110/common/smo/impl/AllocationStorehouseUserInnerServiceSMOImpl.java
index 3fe0022..48b279c 100644
--- a/service-common/src/main/java/com/java110/common/smo/impl/AllocationStorehouseUserInnerServiceSMOImpl.java
+++ b/service-common/src/main/java/com/java110/common/smo/impl/AllocationStorehouseUserInnerServiceSMOImpl.java
@@ -3,13 +3,13 @@
 
 import com.java110.core.base.smo.BaseServiceSMO;
 import com.java110.dto.PageDto;
-import com.java110.dto.allocationStorehouse.AllocationStorehouseDto;
+import com.java110.dto.allocationStorehouseApply.AllocationStorehouseApplyDto;
 import com.java110.dto.workflow.WorkflowDto;
 import com.java110.entity.audit.AuditUser;
 import com.java110.intf.common.IAllocationStorehouseUserInnerServiceSMO;
 import com.java110.intf.common.IWorkflowInnerServiceSMO;
+import com.java110.intf.store.IAllocationStorehouseApplyInnerServiceSMO;
 import com.java110.intf.store.IAllocationStorehouseInnerServiceSMO;
-import com.java110.intf.store.IContractInnerServiceSMO;
 import com.java110.utils.util.Assert;
 import com.java110.utils.util.StringUtil;
 import org.activiti.engine.HistoryService;
@@ -50,6 +50,9 @@
     private IAllocationStorehouseInnerServiceSMO allocationStorehouseInnerServiceSMOImpl;
 
     @Autowired
+    private IAllocationStorehouseApplyInnerServiceSMO allocationStorehouseApplyInnerServiceSMOImpl;
+
+    @Autowired
     private IWorkflowInnerServiceSMO workflowInnerServiceSMOImpl;
 
 
@@ -58,21 +61,21 @@
      *
      * @return
      */
-    public AllocationStorehouseDto startProcess(@RequestBody AllocationStorehouseDto allocationStorehouseDto) {
+    public AllocationStorehouseApplyDto startProcess(@RequestBody AllocationStorehouseApplyDto allocationStorehouseApplyDto) {
         //灏嗕俊鎭姞鍏ap,浠ヤ究浼犲叆娴佺▼涓�
         Map<String, Object> variables = new HashMap<String, Object>();
-        variables.put("allocationStorehouseDto", allocationStorehouseDto);
-        variables.put("userId", allocationStorehouseDto.getCurrentUserId());
-        variables.put("startUserId", allocationStorehouseDto.getCurrentUserId());
+        variables.put("allocationStorehouseApplyDto", allocationStorehouseApplyDto);
+        variables.put("userId", allocationStorehouseApplyDto.getCurrentUserId());
+        variables.put("startUserId", allocationStorehouseApplyDto.getCurrentUserId());
         //寮�鍚祦绋�
-        ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(getWorkflowDto(allocationStorehouseDto.getStoreId()), allocationStorehouseDto.getAsId(), variables);
+        ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(getWorkflowDto(allocationStorehouseApplyDto.getStoreId()), allocationStorehouseApplyDto.getApplyId(), variables);
         //灏嗗緱鍒扮殑瀹炰緥娴佺▼id鍊艰祴缁欎箣鍓嶈缃殑鍙橀噺
         String processInstanceId = processInstance.getId();
         // System.out.println("娴佺▼寮�鍚垚鍔�.......瀹炰緥娴佺▼id:" + processInstanceId);
 
-        allocationStorehouseDto.setProcessInstanceId(processInstanceId);
+        allocationStorehouseApplyDto.setProcessInstanceId(processInstanceId);
 
-        return allocationStorehouseDto;
+        return allocationStorehouseApplyDto;
 
     }
 
@@ -94,7 +97,7 @@
      *
      * @param user 鐢ㄦ埛淇℃伅
      */
-    public List<AllocationStorehouseDto> getUserTasks(@RequestBody AuditUser user) {
+    public List<AllocationStorehouseApplyDto> getUserTasks(@RequestBody AuditUser user) {
         TaskService taskService = processEngine.getTaskService();
         TaskQuery query = taskService.createTaskQuery().processDefinitionKey(getWorkflowDto(user.getStoreId()));
         query.taskAssignee(user.getUserId());
@@ -109,7 +112,7 @@
             list = query.list();
         }
 
-        List<String> asIds = new ArrayList<>();
+        List<String> appIyIds = new ArrayList<>();
         Map<String, String> taskBusinessKeyMap = new HashMap<>();
         for (Task task : list) {
             String processInstanceId = task.getProcessInstanceId();
@@ -117,52 +120,52 @@
             ProcessInstance pi = runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
             //4.浣跨敤娴佺▼瀹炰緥瀵硅薄鑾峰彇BusinessKey
             String business_key = pi.getBusinessKey();
-            asIds.add(business_key);
+            appIyIds.add(business_key);
             taskBusinessKeyMap.put(business_key, task.getId());
         }
 
-        if (asIds == null || asIds.size() == 0) {
+        if (appIyIds == null || appIyIds.size() == 0) {
             return new ArrayList<>();
         }
 
         //鏌ヨ 鎶曡瘔淇℃伅
-        AllocationStorehouseDto allocationStorehouseDto = new AllocationStorehouseDto();
-        allocationStorehouseDto.setStoreId(user.getStoreId());
-        allocationStorehouseDto.setAsIds(asIds.toArray(new String[asIds.size()]));
-        List<AllocationStorehouseDto> tmpAllocationStorehouseDtos = allocationStorehouseInnerServiceSMOImpl.queryAllocationStorehouses(allocationStorehouseDto);
+        AllocationStorehouseApplyDto allocationStorehouseApplyDto = new AllocationStorehouseApplyDto();
+        allocationStorehouseApplyDto.setStoreId(user.getStoreId());
+        allocationStorehouseApplyDto.setApplyIds(appIyIds.toArray(new String[appIyIds.size()]));
+        List<AllocationStorehouseApplyDto> tmpAllocationStorehouseApplyDtos = allocationStorehouseApplyInnerServiceSMOImpl.queryAllocationStorehouseApplys(allocationStorehouseApplyDto);
 
-        for (AllocationStorehouseDto tmpAllocationStorehouseDto : tmpAllocationStorehouseDtos) {
-            tmpAllocationStorehouseDto.setTaskId(taskBusinessKeyMap.get(tmpAllocationStorehouseDto.getAsId()));
+        for (AllocationStorehouseApplyDto tmpAllocationStorehouseApplyDto : tmpAllocationStorehouseApplyDtos) {
+            tmpAllocationStorehouseApplyDto.setTaskId(taskBusinessKeyMap.get(tmpAllocationStorehouseApplyDto.getApplyId()));
         }
-        return tmpAllocationStorehouseDtos;
+        return tmpAllocationStorehouseApplyDtos;
     }
 
-    public boolean agreeCompleteTask(@RequestBody AllocationStorehouseDto allocationStorehouseDto) {
+    public boolean agreeCompleteTask(@RequestBody AllocationStorehouseApplyDto allocationStorehouseApplyDto) {
         TaskService taskService = processEngine.getTaskService();
         Map<String, Object> variables = new HashMap<String, Object>();
-        variables.put("auditCode", allocationStorehouseDto.getAuditCode());
-        taskService.complete(allocationStorehouseDto.getTaskId(), variables);
+        variables.put("auditCode", allocationStorehouseApplyDto.getAuditCode());
+        taskService.complete(allocationStorehouseApplyDto.getTaskId(), variables);
         return true;
     }
 
-    public boolean refuteCompleteTask(@RequestBody AllocationStorehouseDto allocationStorehouseDto) {
+    public boolean refuteCompleteTask(@RequestBody AllocationStorehouseApplyDto allocationStorehouseApplyDto) {
         TaskService taskService = processEngine.getTaskService();
         Map<String, Object> variables = new HashMap<String, Object>();
-        variables.put("auditCode", allocationStorehouseDto.getAuditCode());
-        taskService.complete(allocationStorehouseDto.getTaskId(), variables);
+        variables.put("auditCode", allocationStorehouseApplyDto.getAuditCode());
+        taskService.complete(allocationStorehouseApplyDto.getTaskId(), variables);
         return true;
     }
 
     /**
      * 瀹℃牳 褰撳墠浠诲姟
      *
-     * @param allocationStorehouseDto 璧勬簮璁㈠崟
+     * @param allocationStorehouseApplyDto 璧勬簮璁㈠崟
      * @return
      */
-    public boolean complete(@RequestBody AllocationStorehouseDto allocationStorehouseDto) {
+    public boolean complete(@RequestBody AllocationStorehouseApplyDto allocationStorehouseApplyDto) {
         TaskService taskService = processEngine.getTaskService();
 
-        taskService.complete(allocationStorehouseDto.getTaskId());
+        taskService.complete(allocationStorehouseApplyDto.getTaskId());
 
 
         return true;
@@ -216,7 +219,7 @@
      *
      * @param user 鐢ㄦ埛淇℃伅
      */
-    public List<AllocationStorehouseDto> getUserHistoryTasks(@RequestBody AuditUser user) {
+    public List<AllocationStorehouseApplyDto> getUserHistoryTasks(@RequestBody AuditUser user) {
         HistoryService historyService = processEngine.getHistoryService();
 
         HistoricTaskInstanceQuery historicTaskInstanceQuery = historyService.createHistoricTaskInstanceQuery()
@@ -238,7 +241,7 @@
             list = query.list();
         }
 
-        List<String> asIds = new ArrayList<>();
+        List<String> appIyIds = new ArrayList<>();
         Map<String, String> taskBusinessKeyMap = new HashMap<>();
 
         for (HistoricTaskInstance task : list) {
@@ -247,35 +250,35 @@
             HistoricProcessInstance pi = historyService.createHistoricProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
             //4.浣跨敤娴佺▼瀹炰緥瀵硅薄鑾峰彇BusinessKey
             String business_key = pi.getBusinessKey();
-            asIds.add(business_key);
+            appIyIds.add(business_key);
             taskBusinessKeyMap.put(business_key, task.getId());
         }
 
         //鏌ヨ 鎶曡瘔淇℃伅
-        AllocationStorehouseDto allocationStorehouseDto = new AllocationStorehouseDto();
-        allocationStorehouseDto.setStoreId(user.getStoreId());
-        allocationStorehouseDto.setAsIds(asIds.toArray(new String[asIds.size()]));
-        List<AllocationStorehouseDto> tmpAllocationStorehouseDtos = allocationStorehouseInnerServiceSMOImpl.queryAllocationStorehouses(allocationStorehouseDto);
+        AllocationStorehouseApplyDto allocationStorehouseApplyDto = new AllocationStorehouseApplyDto();
+        allocationStorehouseApplyDto.setStoreId(user.getStoreId());
+        allocationStorehouseApplyDto.setApplyIds(appIyIds.toArray(new String[appIyIds.size()]));
+        List<AllocationStorehouseApplyDto> tmpAllocationStorehouseApplyDtos = allocationStorehouseApplyInnerServiceSMOImpl.queryAllocationStorehouseApplys(allocationStorehouseApplyDto);
 
-        for (AllocationStorehouseDto tmpAllocationStorehouseDto : tmpAllocationStorehouseDtos) {
-            tmpAllocationStorehouseDto.setTaskId(taskBusinessKeyMap.get(tmpAllocationStorehouseDto.getAsId()));
+        for (AllocationStorehouseApplyDto tmpAllocationStorehouseApplyDto : tmpAllocationStorehouseApplyDtos) {
+            tmpAllocationStorehouseApplyDto.setTaskId(taskBusinessKeyMap.get(tmpAllocationStorehouseApplyDto.getApplyId()));
         }
-        return tmpAllocationStorehouseDtos;
+        return tmpAllocationStorehouseApplyDtos;
     }
 
 
-    public boolean completeTask(@RequestBody AllocationStorehouseDto allocationStorehouseDto) {
+    public boolean completeTask(@RequestBody AllocationStorehouseApplyDto allocationStorehouseApplyDto) {
         TaskService taskService = processEngine.getTaskService();
-        Task task = taskService.createTaskQuery().taskId(allocationStorehouseDto.getTaskId()).singleResult();
+        Task task = taskService.createTaskQuery().taskId(allocationStorehouseApplyDto.getTaskId()).singleResult();
         String processInstanceId = task.getProcessInstanceId();
-        Authentication.setAuthenticatedUserId(allocationStorehouseDto.getCurrentUserId());
-        taskService.addComment(allocationStorehouseDto.getTaskId(), processInstanceId, allocationStorehouseDto.getAuditMessage());
+        Authentication.setAuthenticatedUserId(allocationStorehouseApplyDto.getCurrentUserId());
+        taskService.addComment(allocationStorehouseApplyDto.getTaskId(), processInstanceId, allocationStorehouseApplyDto.getAuditMessage());
         Map<String, Object> variables = new HashMap<String, Object>();
-        variables.put("auditCode", allocationStorehouseDto.getAuditCode());
-        variables.put("currentUserId", allocationStorehouseDto.getCurrentUserId());
-        variables.put("flag", "1200".equals(allocationStorehouseDto.getAuditCode()) ? "false" : "true");
-        variables.put("startUserId", allocationStorehouseDto.getStartUserId());
-        taskService.complete(allocationStorehouseDto.getTaskId(), variables);
+        variables.put("auditCode", allocationStorehouseApplyDto.getAuditCode());
+        variables.put("currentUserId", allocationStorehouseApplyDto.getCurrentUserId());
+        variables.put("flag", "1200".equals(allocationStorehouseApplyDto.getAuditCode()) ? "false" : "true");
+        variables.put("startUserId", allocationStorehouseApplyDto.getStartUserId());
+        taskService.complete(allocationStorehouseApplyDto.getTaskId(), variables);
 
         ProcessInstance pi = runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
         if (pi == null) {

--
Gitblit v1.8.0