Web approach uniformity done

This commit is contained in:
2026-08-30 19:54:54 +05:30
parent 372c2bc14d
commit eb39d5ff90
12 changed files with 2724 additions and 1201 deletions

View File

@@ -36,26 +36,26 @@ public class InventoryItemService {
return inventoryItemRepository.findById(itemId)
.filter(item -> item.getUserId().equals(userId))
.flatMap(existingItem -> {
existingItem.setTagNumber(updatedItem.getTagNumber());
existingItem.setSku(updatedItem.getSku());
existingItem.setHuid(updatedItem.getHuid());
existingItem.setPurity(updatedItem.getPurity());
existingItem.setGrossWeight(updatedItem.getGrossWeight());
existingItem.setNetWeight(updatedItem.getNetWeight());
existingItem.setStoneWeight(updatedItem.getStoneWeight());
existingItem.setDiamondWeight(updatedItem.getDiamondWeight());
existingItem.setFineWeight(updatedItem.getFineWeight());
existingItem.setMakingCharges(updatedItem.getMakingCharges());
existingItem.setMakingChargeType(updatedItem.getMakingChargeType());
existingItem.setPurchaseCost(updatedItem.getPurchaseCost());
existingItem.setMetalCost(updatedItem.getMetalCost());
existingItem.setStoneCost(updatedItem.getStoneCost());
existingItem.setCertificationCost(updatedItem.getCertificationCost());
existingItem.setTax(updatedItem.getTax());
existingItem.setVendorId(updatedItem.getVendorId());
existingItem.setBranchId(updatedItem.getBranchId());
existingItem.setPurchaseRef(updatedItem.getPurchaseRef());
existingItem.setStatus(updatedItem.getStatus());
if (updatedItem.getTagNumber() != null) existingItem.setTagNumber(updatedItem.getTagNumber());
if (updatedItem.getSku() != null) existingItem.setSku(updatedItem.getSku());
if (updatedItem.getHuid() != null) existingItem.setHuid(updatedItem.getHuid());
if (updatedItem.getPurity() != null) existingItem.setPurity(updatedItem.getPurity());
if (updatedItem.getGrossWeight() != null) existingItem.setGrossWeight(updatedItem.getGrossWeight());
if (updatedItem.getNetWeight() != null) existingItem.setNetWeight(updatedItem.getNetWeight());
if (updatedItem.getStoneWeight() != null) existingItem.setStoneWeight(updatedItem.getStoneWeight());
if (updatedItem.getDiamondWeight() != null) existingItem.setDiamondWeight(updatedItem.getDiamondWeight());
if (updatedItem.getFineWeight() != null) existingItem.setFineWeight(updatedItem.getFineWeight());
if (updatedItem.getMakingCharges() != null) existingItem.setMakingCharges(updatedItem.getMakingCharges());
if (updatedItem.getMakingChargeType() != null) existingItem.setMakingChargeType(updatedItem.getMakingChargeType());
if (updatedItem.getPurchaseCost() != null) existingItem.setPurchaseCost(updatedItem.getPurchaseCost());
if (updatedItem.getMetalCost() != null) existingItem.setMetalCost(updatedItem.getMetalCost());
if (updatedItem.getStoneCost() != null) existingItem.setStoneCost(updatedItem.getStoneCost());
if (updatedItem.getCertificationCost() != null) existingItem.setCertificationCost(updatedItem.getCertificationCost());
if (updatedItem.getTax() != null) existingItem.setTax(updatedItem.getTax());
if (updatedItem.getVendorId() != null) existingItem.setVendorId(updatedItem.getVendorId());
if (updatedItem.getBranchId() != null) existingItem.setBranchId(updatedItem.getBranchId());
if (updatedItem.getPurchaseRef() != null) existingItem.setPurchaseRef(updatedItem.getPurchaseRef());
if (updatedItem.getStatus() != null) existingItem.setStatus(updatedItem.getStatus());
existingItem.setUpdatedAt(LocalDateTime.now());
return inventoryItemRepository.save(existingItem);
});

View File

@@ -66,17 +66,16 @@ public class InvoiceService {
invoice.setUserId(userId);
invoice.setCreatedAt(LocalDateTime.now());
invoice.setUpdatedAt(LocalDateTime.now());
if (invoice.getStatus() == null || "DRAFT".equals(invoice.getStatus())) {
java.math.BigDecimal amountPaid = invoice.getAmountPaid() != null ? invoice.getAmountPaid() : java.math.BigDecimal.ZERO;
java.math.BigDecimal total = invoice.getTotalAmount() != null ? invoice.getTotalAmount() : java.math.BigDecimal.ZERO;
if (amountPaid.compareTo(total) >= 0 && total.compareTo(java.math.BigDecimal.ZERO) > 0) {
invoice.setStatus("PAID");
} else if (amountPaid.compareTo(java.math.BigDecimal.ZERO) > 0) {
invoice.setStatus("PARTIAL");
} else {
invoice.setStatus("DRAFT");
}
java.math.BigDecimal amountPaid = invoice.getAmountPaid() != null ? invoice.getAmountPaid() : java.math.BigDecimal.ZERO;
java.math.BigDecimal total = invoice.getTotalAmount() != null ? invoice.getTotalAmount() : java.math.BigDecimal.ZERO;
java.math.BigDecimal balance = total.subtract(amountPaid);
if (balance.abs().compareTo(new java.math.BigDecimal("0.01")) <= 0 || (amountPaid.compareTo(total) >= 0 && total.compareTo(java.math.BigDecimal.ZERO) > 0)) {
invoice.setStatus("PAID");
} else if (amountPaid.compareTo(java.math.BigDecimal.ZERO) > 0) {
invoice.setStatus("PARTIAL");
} else if (invoice.getStatus() == null || invoice.getStatus().isEmpty()) {
invoice.setStatus("DRAFT");
}
return invoiceRepository.save(invoice)