From a13573d5ef8d16f4bc2535a3c89c2891e6f5b56c Mon Sep 17 00:00:00 2001
From: java110 <928255095@qq.com>
Date: 星期二, 30 五月 2023 15:33:30 +0800
Subject: [PATCH] optimize

---
 service-store/src/main/java/com/java110/store/cmd/resourceStore/DeleteAllocationStorehouseCmd.java |   27 +++++++++++++++++++++++++--
 1 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/service-store/src/main/java/com/java110/store/cmd/resourceStore/DeleteAllocationStorehouseCmd.java b/service-store/src/main/java/com/java110/store/cmd/resourceStore/DeleteAllocationStorehouseCmd.java
index 20fb8d3..3e81398 100644
--- a/service-store/src/main/java/com/java110/store/cmd/resourceStore/DeleteAllocationStorehouseCmd.java
+++ b/service-store/src/main/java/com/java110/store/cmd/resourceStore/DeleteAllocationStorehouseCmd.java
@@ -5,14 +5,17 @@
 import com.java110.core.context.ICmdDataFlowContext;
 import com.java110.core.event.cmd.Cmd;
 import com.java110.core.event.cmd.CmdEvent;
+import com.java110.core.factory.GenerateCodeFactory;
 import com.java110.dto.allocationStorehouse.AllocationStorehouseDto;
-import com.java110.dto.allocationStorehouseApply.AllocationStorehouseApplyDto;
+import com.java110.dto.allocationStorehouse.AllocationStorehouseApplyDto;
 import com.java110.dto.purchaseApply.PurchaseApplyDto;
+import com.java110.dto.resourceStoreTimes.ResourceStoreTimesDto;
 import com.java110.intf.community.IResourceStoreServiceSMO;
 import com.java110.intf.store.*;
 import com.java110.po.allocationStorehouse.AllocationStorehousePo;
 import com.java110.po.allocationStorehouseApply.AllocationStorehouseApplyPo;
 import com.java110.po.purchase.ResourceStorePo;
+import com.java110.po.resourceStoreTimes.ResourceStoreTimesPo;
 import com.java110.utils.exception.CmdException;
 import com.java110.utils.util.Assert;
 import com.java110.utils.util.BeanConvertUtil;
@@ -49,6 +52,9 @@
     @Autowired
     private IAllocationStorehouseApplyV1InnerServiceSMO allocationStorehouseApplyV1InnerServiceSMOImpl;
 
+    @Autowired
+    private IResourceStoreTimesV1InnerServiceSMO resourceStoreTimesV1InnerServiceSMOImpl;
+
     @Override
     public void validate(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException {
 
@@ -69,7 +75,7 @@
         if (!StringUtil.isEmpty(state) && state.equals("1200")) { //1200琛ㄧず璋冩嫧鐢宠鐘舵��
             deleteAllocationStorehouse(reqJson);
         } else {
-            ResponseEntity<String> responseEntity = ResultVo.createResponseEntity(ResultVo.CODE_BUSINESS_VERIFICATION, "鎮ㄧ殑璋冩嫧璁㈠崟宸茬粡鐘舵�佸凡鏀瑰彉锛屾棤娉曡繘琛屽彇娑堟搷浣滐紒锛�");
+            ResponseEntity<String> responseEntity = ResultVo.createResponseEntity(ResultVo.CODE_BUSINESS_VERIFICATION, "鎮ㄧ殑璋冩嫧璁㈠崟鐘舵�佸凡鏀瑰彉锛屾棤娉曡繘琛屽彇娑堟搷浣滐紒锛�");
             context.setResponseEntity(responseEntity);
             return;
         }
@@ -85,6 +91,7 @@
         int flag = 0;
         for (AllocationStorehouseDto tmpAllocationStorehouseDto : allocationStorehouseDtos) {
             AllocationStorehousePo allocationStorehousePo = BeanConvertUtil.covertBean(tmpAllocationStorehouseDto, AllocationStorehousePo.class);
+            allocationStorehousePo.setStatusCd("1");
             flag = allocationStorehouseV1InnerServiceSMOImpl.deleteAllocationStorehouse(allocationStorehousePo);
 
             if (flag < 1) {
@@ -130,11 +137,27 @@
                 purchaseDto1.setAssigneeUser("999999");
                 purchaseApplyInnerServiceSMOImpl.updateActRuTaskById(purchaseDto1);
             }
+            // 淇濆瓨鑷� 鐗╁搧 times琛�
+            //鏌ヨ璋冩嫧鎵规浠锋牸
+            ResourceStoreTimesDto resourceStoreTimesDto = new ResourceStoreTimesDto();
+            resourceStoreTimesDto.setTimesId(tmpAllocationStorehouseDto.getTimesId());
+            List<ResourceStoreTimesDto> resourceStoreTimesDtos = resourceStoreTimesV1InnerServiceSMOImpl.queryResourceStoreTimess(resourceStoreTimesDto);
+
+            ResourceStoreTimesPo resourceStoreTimesPo = new ResourceStoreTimesPo();
+            resourceStoreTimesPo.setApplyOrderId(tmpAllocationStorehouseDto.getApplyId());
+            resourceStoreTimesPo.setPrice(resourceStoreTimesDtos.get(0).getPrice());
+            resourceStoreTimesPo.setStock(tmpAllocationStorehouseDto.getStock());
+            resourceStoreTimesPo.setResCode(tmpAllocationStorehouseDto.getResCode());
+            resourceStoreTimesPo.setStoreId(tmpAllocationStorehouseDto.getStoreId());
+            resourceStoreTimesPo.setTimesId(GenerateCodeFactory.getGeneratorId("10"));
+            resourceStoreTimesPo.setShId(tmpAllocationStorehouseDto.getShIda());
+            resourceStoreTimesV1InnerServiceSMOImpl.saveOrUpdateResourceStoreTimes(resourceStoreTimesPo);
         }
 
         AllocationStorehouseApplyPo allocationStorehouseApplyPo = new AllocationStorehouseApplyPo();
         allocationStorehouseApplyPo.setApplyId(allocationStorehouseDto.getApplyId());
         allocationStorehouseApplyPo.setStoreId(allocationStorehouseDto.getStoreId());
+        allocationStorehouseApplyPo.setStatusCd("1");
         flag = allocationStorehouseApplyV1InnerServiceSMOImpl.updateAllocationStorehouseApply(allocationStorehouseApplyPo);
         if (flag < 1) {
             throw new CmdException("淇敼澶辫触");

--
Gitblit v1.8.0