xiaogang
2021-04-19 cbfdaf976e300bbf5e14193156795d303276fb3b
service-api/src/main/java/com/java110/api/bmo/allocationStorehouse/impl/AllocationStorehouseBMOImpl.java
@@ -4,18 +4,26 @@
import com.java110.api.bmo.ApiBaseBMO;
import com.java110.api.bmo.allocationStorehouse.IAllocationStorehouseBMO;
import com.java110.core.context.DataFlowContext;
import com.java110.intf.community.IResourceStoreServiceSMO;
import com.java110.intf.store.IAllocationStorehouseInnerServiceSMO;
import com.java110.po.allocationStorehouse.AllocationStorehousePo;
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 +33,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 +50,6 @@
        super.update(dataFlowContext, allocationStorehousePo, BusinessTypeConstant.BUSINESS_TYPE_UPDATE_ALLOCATION_STOREHOUSE);
    }
    /**
     * 添加小区信息
     *
@@ -53,9 +58,23 @@
     * @return 订单服务能够接受的报文
     */
    public void deleteAllocationStorehouse(JSONObject paramInJson, DataFlowContext dataFlowContext) {
        AllocationStorehousePo allocationStorehousePo = BeanConvertUtil.covertBean(paramInJson, AllocationStorehousePo.class);
        super.update(dataFlowContext, allocationStorehousePo, BusinessTypeConstant.BUSINESS_TYPE_DELETE_ALLOCATION_STOREHOUSE);
        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;
        /*ResourceStoreDto resourceStoreDto = new ResourceStoreDto();
        resourceStoreDto.setResId(allocationStorehousePo.getResId());
        resourceStoreDto.setStock(String.valueOf(stock));*/
        resourceStorePo.setStock(String.valueOf(stock));
        super.update(dataFlowContext, resourceStorePo, BusinessTypeConstant.BUSINESS_TYPE_UPDATE_RESOURCE_STORE);
    }
}