]> git.mxchange.org Git - jfinancials-core.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Sat, 16 Jun 2018 13:16:16 +0000 (15:16 +0200)
committerRoland Häder <roland@mxchange.org>
Sat, 16 Jun 2018 13:16:16 +0000 (15:16 +0200)
- added transaction number to receipt as some receipts contain it
- added coupon number to equals()/hashcode() method

Signed-off-by: Roland Häder <roland@mxchange.org>
src/org/mxchange/jfinancials/model/receipt/BillableReceipt.java
src/org/mxchange/jfinancials/model/receipt/FinancialReceipt.java
src/org/mxchange/jfinancials/model/receipt_item/FinancialReceiptItem.java

index 7938dcbd24f9fb19c8aa358a9f2348655ef7a150..06867ca4a630f2838497070d0582e37e2d56b327 100644 (file)
@@ -199,6 +199,20 @@ public interface BillableReceipt extends Comparable<BillableReceipt>, Serializab
         */
        void setReceiptSequenceNumber (final Long receiptSequenceNumber);
 
+       /**
+        * Getter for receipt transaction number
+        * <p>
+        * @return Receipt transaction number
+        */
+       Long getReceiptTransactionNumber ();
+
+       /**
+        * Setter for receipt transaction number
+        * <p>
+        * @param receiptTransactionNumber Receipt transaction number
+        */
+       void setReceiptTransactionNumber (final Long receiptTransactionNumber);
+
        @Override
        boolean equals (final Object object);
 
index 818496fa59dc59f60175f4452cb62408f240ffe0..8d5d54551cc3042d6f9a02c0e97f39c2ee86b628 100644 (file)
@@ -53,7 +53,8 @@ import org.mxchange.jusercore.model.user.User;
 import org.mxchange.jusercore.model.user.Users;
 
 /**
- *
+ * Receipt POJO
+ * <p>
  * @author Roland Häder<roland@mxchange.org>
  */
 @Entity (name = "receipts")
@@ -152,6 +153,12 @@ public class FinancialReceipt implements BillableReceipt {
        @Column (name = "receipt_sequence_number")
        private Long receiptSequenceNumber;
 
+       /**
+        * Receipt transaction number
+        */
+       @Column (name = "receipt_transaction_number")
+       private Long receiptTransactionNumber;
+
        /**
         * Which user this receipt belongs to
         */
@@ -253,6 +260,8 @@ public class FinancialReceipt implements BillableReceipt {
                        StringUtils.compare(this.getReceiptBarCodeNumber(), billableReceipt.getReceiptBarCodeNumber()),
                        // ... sequence number
                        SafeNumberUtils.compare(this.getReceiptSequenceNumber(), billableReceipt.getReceiptSequenceNumber()),
+                       // ... transaction number
+                       SafeNumberUtils.compare(this.getReceiptTransactionNumber(), billableReceipt.getReceiptTransactionNumber()),
                        // ... payment type
                        this.getReceiptPaymentType().compareTo(billableReceipt.getReceiptPaymentType()),
                        // ... register number
@@ -292,6 +301,10 @@ public class FinancialReceipt implements BillableReceipt {
                        return false;
                } else if (!Objects.equals(this.getReceiptNumber(), receipt.getReceiptNumber())) {
                        return false;
+               } else if (!Objects.equals(this.getReceiptSequenceNumber(), receipt.getReceiptSequenceNumber())) {
+                       return false;
+               } else if (!Objects.equals(this.getReceiptTransactionNumber(), receipt.getReceiptTransactionNumber())) {
+                       return false;
                } else if (this.getReceiptPaymentType() != receipt.getReceiptPaymentType()) {
                        return false;
                } else if (!Objects.equals(this.getReceiptBranchOffice(), receipt.getReceiptBranchOffice())) {
@@ -419,6 +432,16 @@ public class FinancialReceipt implements BillableReceipt {
                this.receiptSequenceNumber = receiptSequenceNumber;
        }
 
+       @Override
+       public Long getReceiptTransactionNumber () {
+               return this.receiptTransactionNumber;
+       }
+
+       @Override
+       public void setReceiptTransactionNumber (final Long receiptTransactionNumber) {
+               this.receiptTransactionNumber = receiptTransactionNumber;
+       }
+
        @Override
        public User getReceiptUser () {
                return this.receiptUser;
@@ -435,6 +458,8 @@ public class FinancialReceipt implements BillableReceipt {
 
                hash = 89 * hash + Objects.hashCode(this.getReceiptId());
                hash = 89 * hash + Objects.hashCode(this.getReceiptNumber());
+               hash = 89 * hash + Objects.hashCode(this.getReceiptSequenceNumber());
+               hash = 89 * hash + Objects.hashCode(this.getReceiptTransactionNumber());
                hash = 89 * hash + Objects.hashCode(this.getReceiptPaymentType());
                hash = 89 * hash + Objects.hashCode(this.getReceiptBranchOffice());
                hash = 89 * hash + Objects.hashCode(this.getReceiptUser());
index 0b5071ac16cbfb9669e073cd097f6c862e1709e5..b8c69a6da07b104a14f0624359d795ded6209520 100644 (file)
@@ -256,12 +256,16 @@ public class FinancialReceiptItem implements BillableReceiptItem {
 
                if (!Objects.equals(this.getItemId(), receiptItem.getItemId())) {
                        return false;
+               } else if (!Objects.equals(this.getItemNumber(), receiptItem.getItemNumber())) {
+                       return false;
                } else if (!Objects.equals(this.getItemProduct(), receiptItem.getItemProduct())) {
                        return false;
                } else if (!Objects.equals(this.getItemProductQuantity(), receiptItem.getItemProductQuantity())) {
                        return false;
                } else if (!Objects.equals(this.getItemReceipt(), receiptItem.getItemReceipt())) {
                        return false;
+               } else if (!Objects.equals(this.getItemCouponNumber(), receiptItem.getItemCouponNumber())) {
+                       return false;
                }
 
                return true;
@@ -424,9 +428,11 @@ public class FinancialReceiptItem implements BillableReceiptItem {
                int hash = 5;
 
                hash = 53 * hash + Objects.hashCode(this.getItemId());
+               hash = 53 * hash + Objects.hashCode(this.getItemNumber());
                hash = 53 * hash + Objects.hashCode(this.getItemProduct());
                hash = 53 * hash + Objects.hashCode(this.getItemProductQuantity());
                hash = 53 * hash + Objects.hashCode(this.getItemReceipt());
+               hash = 53 * hash + Objects.hashCode(this.getItemCouponNumber());
 
                return hash;
        }