From 130a52f59500889530be3786a72e8cfaca74c8ce Mon Sep 17 00:00:00 2001
From: shiyj1101 <1098226878@qq.com>
Date: 星期三, 30 六月 2021 11:26:53 +0800
Subject: [PATCH] Merge branch 'master' of http://git.homecommunity.cn/supervip/MicroCommunity
---
service-api/src/main/java/com/java110/api/bmo/allocationStorehouse/impl/AllocationStorehouseBMOImpl.java | 45 +++++++++++++++++++++++++++++++++++++++------
1 files changed, 39 insertions(+), 6 deletions(-)
diff --git a/service-api/src/main/java/com/java110/api/bmo/allocationStorehouse/impl/AllocationStorehouseBMOImpl.java b/service-api/src/main/java/com/java110/api/bmo/allocationStorehouse/impl/AllocationStorehouseBMOImpl.java
index 891e1a4..8090ce4 100644
--- a/service-api/src/main/java/com/java110/api/bmo/allocationStorehouse/impl/AllocationStorehouseBMOImpl.java
+++ b/service-api/src/main/java/com/java110/api/bmo/allocationStorehouse/impl/AllocationStorehouseBMOImpl.java
@@ -4,18 +4,28 @@
import com.java110.api.bmo.ApiBaseBMO;
import com.java110.api.bmo.allocationStorehouse.IAllocationStorehouseBMO;
import com.java110.core.context.DataFlowContext;
+import com.java110.dto.allocationStorehouse.AllocationStorehouseDto;
+import com.java110.intf.community.IResourceStoreServiceSMO;
import com.java110.intf.store.IAllocationStorehouseInnerServiceSMO;
import com.java110.po.allocationStorehouse.AllocationStorehousePo;
+import com.java110.po.allocationStorehouseApply.AllocationStorehouseApplyPo;
+import com.java110.po.purchase.ResourceStorePo;
import com.java110.utils.constant.BusinessTypeConstant;
+import com.java110.utils.util.Assert;
import com.java110.utils.util.BeanConvertUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
+
+import java.util.List;
@Service("allocationStorehouseBMOImpl")
public class AllocationStorehouseBMOImpl extends ApiBaseBMO implements IAllocationStorehouseBMO {
@Autowired
private IAllocationStorehouseInnerServiceSMO allocationStorehouseInnerServiceSMOImpl;
+
+ @Autowired
+ private IResourceStoreServiceSMO resourceStoreServiceSMOImpl;
/**
* 娣诲姞灏忓尯淇℃伅
@@ -25,12 +35,10 @@
* @return 璁㈠崟鏈嶅姟鑳藉鎺ュ彈鐨勬姤鏂�
*/
public void addAllocationStorehouse(JSONObject paramInJson, DataFlowContext dataFlowContext) {
-
paramInJson.put("asId", "-1");
AllocationStorehousePo allocationStorehousePo = BeanConvertUtil.covertBean(paramInJson, AllocationStorehousePo.class);
super.insert(dataFlowContext, allocationStorehousePo, BusinessTypeConstant.BUSINESS_TYPE_SAVE_ALLOCATION_STOREHOUSE);
}
-
/**
* 娣诲姞娲诲姩淇℃伅
@@ -44,7 +52,6 @@
super.update(dataFlowContext, allocationStorehousePo, BusinessTypeConstant.BUSINESS_TYPE_UPDATE_ALLOCATION_STOREHOUSE);
}
-
/**
* 娣诲姞灏忓尯淇℃伅
*
@@ -54,8 +61,34 @@
*/
public void deleteAllocationStorehouse(JSONObject paramInJson, DataFlowContext dataFlowContext) {
- AllocationStorehousePo allocationStorehousePo = BeanConvertUtil.covertBean(paramInJson, AllocationStorehousePo.class);
- super.update(dataFlowContext, allocationStorehousePo, BusinessTypeConstant.BUSINESS_TYPE_DELETE_ALLOCATION_STOREHOUSE);
- }
+ AllocationStorehouseDto allocationStorehouseDto = new AllocationStorehouseDto();
+ allocationStorehouseDto.setApplyId(paramInJson.getString("applyId"));
+ allocationStorehouseDto.setStoreId(paramInJson.getString("storeId"));
+ List<AllocationStorehouseDto> allocationStorehouseDtos = allocationStorehouseInnerServiceSMOImpl.queryAllocationStorehouses(allocationStorehouseDto);
+
+ for (AllocationStorehouseDto tmpAllocationStorehouseDto : allocationStorehouseDtos) {
+ AllocationStorehousePo allocationStorehousePo = BeanConvertUtil.covertBean(tmpAllocationStorehouseDto, AllocationStorehousePo.class);
+ super.delete(dataFlowContext, allocationStorehousePo, BusinessTypeConstant.BUSINESS_TYPE_DELETE_ALLOCATION_STOREHOUSE);
+ ResourceStorePo resourceStorePo = new ResourceStorePo();
+ resourceStorePo.setResId(allocationStorehousePo.getResId());
+ //鏌ヨ璧勬簮鐗╁搧琛�
+ List<ResourceStorePo> resourceStores = resourceStoreServiceSMOImpl.getResourceStores(resourceStorePo);
+ Assert.listOnlyOne(resourceStores, "璧勬簮鐗╁搧淇℃伅閿欒");
+ //鑾峰彇搴撳瓨鏁伴噺
+ int resourceStoreStock = Integer.parseInt(resourceStores.get(0).getStock());
+ //鑾峰彇璋冩嫧鐨勬暟閲�
+ int storehouseStock = Integer.parseInt(allocationStorehousePo.getStock());
+ //搴撳瓨鏁伴噺
+ int stock = resourceStoreStock + storehouseStock;
+ resourceStorePo.setStock(String.valueOf(stock));
+ super.update(dataFlowContext, resourceStorePo, BusinessTypeConstant.BUSINESS_TYPE_UPDATE_RESOURCE_STORE);
+ }
+
+ AllocationStorehouseApplyPo allocationStorehouseApplyPo = new AllocationStorehouseApplyPo();
+ allocationStorehouseApplyPo.setApplyId(allocationStorehouseDto.getApplyId());
+ allocationStorehouseApplyPo.setStoreId(allocationStorehouseDto.getStoreId());
+ super.update(dataFlowContext, allocationStorehouseApplyPo, BusinessTypeConstant.BUSINESS_TYPE_DELETE_ALLOCATION_STOREHOUSE_APPLY);
+
+ }
}
--
Gitblit v1.8.0