| | |
| | | BigDecimal left = pendingInventory.getInventoryQuantity().subtract(quantity); |
| | | if (left.compareTo(BigDecimal.ZERO) > 0) { |
| | | pendingInventory.setInventoryQuantity(left); |
| | | pendingInventory.setCoalPlanId(pendingInventoryDto.getCoalPlanId()); |
| | | pendingInventoryMapper.updateById(pendingInventory); |
| | | } else { |
| | | pendingInventoryMapper.deleteById(pendingInventoryDto.getPId()); |
| | |
| | | OfficialInventory officialInventory = new OfficialInventory(); |
| | | BeanUtils.copyProperties(pendingInventory, officialInventory); |
| | | officialInventory.setId(null); |
| | | officialInventory.setCoalPlanId(pendingInventoryDto.getCoalPlanId()); |
| | | officialInventory.setPendingId(pendingInventoryDto.getPId()); |
| | | officialInventory.setInventoryQuantity(quantity); |
| | | officialInventory.setRegistrantId(1L); |
| | | officialInventory.setSupplierId(pendingInventoryDto.getSupplierId()); |
| | | officialInventoryMapper.insert(officialInventory); |
| | | } else { |
| | | OfficialInventory officialInventory = officialInventoryMapper.selectById(pendingInventoryDto.getOfficialId()); |