From c86174225a4b0a68d32111bf18ac401ff95d90ea Mon Sep 17 00:00:00 2001
From: java110 <928255095@qq.com>
Date: 星期四, 24 八月 2023 14:13:53 +0800
Subject: [PATCH] 仓库加入流程字段

---
 service-common/src/main/java/com/java110/common/smo/impl/AllocationStorehouseUserInnerServiceSMOImpl.java |   41 ++++++++++++++++++++---------------------
 1 files changed, 20 insertions(+), 21 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 4e6ed20..ce4579e 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
@@ -2,21 +2,18 @@
 
 import com.java110.core.base.smo.BaseServiceSMO;
 import com.java110.dto.PageDto;
-import com.java110.dto.allocationStorehouseApply.AllocationStorehouseApplyDto;
-import com.java110.dto.area.AreaDto;
-import com.java110.dto.businessDatabus.CustomBusinessDatabusDto;
-import com.java110.dto.purchaseApply.PurchaseApplyDto;
-import com.java110.dto.storehouse.StorehouseDto;
-import com.java110.dto.userLogin.UserLoginDto;
-import com.java110.dto.workflow.WorkflowDto;
-import com.java110.entity.audit.AuditUser;
+import com.java110.dto.purchase.AllocationStorehouseApplyDto;
+import com.java110.dto.data.DatabusDataDto;
+import com.java110.dto.purchase.PurchaseApplyDto;
+import com.java110.dto.store.StorehouseDto;
+import com.java110.dto.oaWorkflow.WorkflowDto;
+import com.java110.dto.audit.AuditUser;
 import com.java110.intf.common.IAllocationStorehouseUserInnerServiceSMO;
 import com.java110.intf.common.IWorkflowInnerServiceSMO;
 import com.java110.intf.job.IDataBusInnerServiceSMO;
 import com.java110.intf.store.IAllocationStorehouseApplyInnerServiceSMO;
 import com.java110.intf.store.IPurchaseApplyInnerServiceSMO;
 import com.java110.intf.store.IStorehouseInnerServiceSMO;
-import com.java110.intf.user.IUserLoginInnerServiceSMO;
 import com.java110.po.machine.MachineRecordPo;
 import com.java110.utils.constant.BusinessTypeConstant;
 import com.java110.utils.util.Assert;
@@ -43,7 +40,7 @@
 import java.util.List;
 import java.util.Map;
 
-import static com.java110.dto.storehouse.StorehouseDto.SH_TYPE_GROUP;
+import static com.java110.dto.store.StorehouseDto.SH_TYPE_GROUP;
 
 //@Service("resourceEntryStoreSMOImpl")
 @RestController
@@ -82,19 +79,15 @@
         variables.put("allocationStorehouseApplyDto", allocationStorehouseApplyDto);
         variables.put("userId", allocationStorehouseApplyDto.getCurrentUserId());
         variables.put("startUserId", allocationStorehouseApplyDto.getCurrentUserId());
+        variables.put("nextUserId", allocationStorehouseApplyDto.getNextUserId());
         //鏌ヨ璋冩嫧婧愪粨搴撴槸闆嗗洟浠撳簱杩樻槸灏忓尯浠撳簱锛屽皬鍖轰粨搴撹蛋琚皟鎷ㄦ祦绋嬪鎵�
         StorehouseDto storehouseDto = new StorehouseDto();
         storehouseDto.setShId(allocationStorehouseApplyDto.getShId());
         List<StorehouseDto> storehouseDtoList = iStorehouseInnerServiceSMO.queryStorehouses(storehouseDto);
         StorehouseDto storehouseDto1 = new StorehouseDto();
         String communityId = null;
-        if (storehouseDtoList != null && storehouseDtoList.size() == 1) {
+        if (storehouseDtoList != null && storehouseDtoList.size() > 0) {
             storehouseDto1 = storehouseDtoList.get(0);
-        }
-        if (SH_TYPE_GROUP.equals(storehouseDto1.getShType())) {//闆嗗洟浠撳簱
-            communityId = "9999";
-        } else {//灏忓尯浠撳簱
-            communityId = storehouseDto1.getShObjId();
         }
         //寮�鍚祦绋�
         ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(getWorkflowDto(allocationStorehouseApplyDto.getStoreId(), communityId), allocationStorehouseApplyDto.getApplyId(), variables);
@@ -117,7 +110,7 @@
                 machineRecordPo.setApplyOrderId(businessKey);
                 machineRecordPo.setPurchaseUserId(actRuTaskUserId);
                 //浼犻�乨atabus
-                dataBusInnerServiceSMOImpl.customExchange(CustomBusinessDatabusDto.getInstance(
+                dataBusInnerServiceSMOImpl.databusData(DatabusDataDto.getInstance(
                         BusinessTypeConstant.BUSINESS_TYPE_DATABUS_ALLOCATION_STOREHOUSE_APPLY, BeanConvertUtil.beanCovertJson(machineRecordPo)));
             }
         }
@@ -169,6 +162,7 @@
             String business_key = pi.getBusinessKey();
             appIyIds.add(business_key);
             taskBusinessKeyMap.put(business_key, task.getId());
+            taskBusinessKeyMap.put(business_key+"_ProcessDefinitionKey", pi.getProcessDefinitionKey());
         }
 
         if (appIyIds == null || appIyIds.size() == 0) {
@@ -182,6 +176,7 @@
         List<AllocationStorehouseApplyDto> tmpAllocationStorehouseApplyDtos = allocationStorehouseApplyInnerServiceSMOImpl.queryAllocationStorehouseApplys(allocationStorehouseApplyDto);
         for (AllocationStorehouseApplyDto tmpAllocationStorehouseApplyDto : tmpAllocationStorehouseApplyDtos) {
             tmpAllocationStorehouseApplyDto.setTaskId(taskBusinessKeyMap.get(tmpAllocationStorehouseApplyDto.getApplyId()));
+            tmpAllocationStorehouseApplyDto.setProcessDefinitionKey(taskBusinessKeyMap.get(tmpAllocationStorehouseApplyDto.getApplyId()+"_ProcessDefinitionKey"));
         }
         return tmpAllocationStorehouseApplyDtos;
     }
@@ -247,12 +242,15 @@
         workflowDto.setStoreId(storeId);
         List<WorkflowDto> workflowDtos = workflowInnerServiceSMOImpl.queryWorkflows(workflowDto);
         if (workflowDtos != null && workflowDtos.size() == 0) {
-            throw new IllegalArgumentException("鏈壘鍒� 璋冩嫧娴佺▼鎴栨壘鍒板鏉★紝璇峰湪鐗╀笟璐﹀彿绯荤粺绠$悊涓嬫祦绋嬬鐞嗕腑閰嶇疆娴佺▼!");
+            throw new IllegalArgumentException("鏈壘鍒� 璋冩嫧娴佺▼锛岃鍦ㄧ墿涓氳处鍙风郴缁熺鐞嗕笅娴佺▼绠$悊涓厤缃祦绋�!");
         }
         List<String> flowIdList = new ArrayList<String>();
         for (WorkflowDto workflowDto1 : workflowDtos) {
-            if (StringUtil.isEmpty(workflowDto1.getProcessDefinitionKey())) {
-                throw new IllegalArgumentException("璋冩嫧娴佺▼娴佺▼杩樻湭閮ㄧ讲");
+            if (StringUtil.isEmpty(workflowDto1.getProcessDefinitionKey()) && WorkflowDto.FLOW_TYPE_ALLOCATION_STOREHOUSE.equals(workflowDto1.getFlowType())) {
+                throw new IllegalArgumentException("灏忓尯缂栫爜=" + workflowDto1.getCommunityId() + "鐨勭墿鍝佽皟鎷ㄦ祦绋嬭繕鏈儴缃�");
+            }
+            if (StringUtil.isEmpty(workflowDto1.getProcessDefinitionKey()) && WorkflowDto.FLOW_TYPE_ALLOCATION_STOREHOUSE_GO.equals(workflowDto1.getFlowType())) {
+                throw new IllegalArgumentException("灏忓尯缂栫爜=" + workflowDto1.getCommunityId() + "鐨勭墿鍝佽璋冩嫧杩樻湭閮ㄧ讲");
             }
             flowIdList.add(WorkflowDto.DEFAULT_PROCESS + workflowDto1.getFlowId());
         }
@@ -358,6 +356,7 @@
         variables.put("currentUserId", allocationStorehouseApplyDto.getCurrentUserId());
         variables.put("flag", "1200".equals(allocationStorehouseApplyDto.getAuditCode()) ? "false" : "true");
         variables.put("startUserId", allocationStorehouseApplyDto.getStartUserId());
+        variables.put("nextUserId", allocationStorehouseApplyDto.getNextUserId());
         taskService.complete(allocationStorehouseApplyDto.getTaskId(), variables);
         ProcessInstance pi = runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
         if (pi == null) {
@@ -381,7 +380,7 @@
                 machineRecordPo.setNoticeState(noticeState);
                 machineRecordPo.setAuditMessage(auditMessage);
                 //浼犻�乨atabus
-                dataBusInnerServiceSMOImpl.customExchange(CustomBusinessDatabusDto.getInstance(
+                dataBusInnerServiceSMOImpl.databusData(DatabusDataDto.getInstance(
                         BusinessTypeConstant.BUSINESS_TYPE_DATABUS_ALLOCATION_STOREHOUSE_APPLY, BeanConvertUtil.beanCovertJson(machineRecordPo)));
             }
         }

--
Gitblit v1.8.0