Subversion Repositories SmartDukaan

Rev

Rev 32903 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 32903 Rev 33729
Line 1... Line 1...
1
package com.spice.profitmandi.dao.model;
1
package com.spice.profitmandi.dao.model;
2
 
2
 
3
import java.time.LocalDate;
3
import java.time.LocalDate;
4
 
-
 
5
import com.spice.profitmandi.dao.enumuration.inventory.VendorCatalogPricingStatus;
4
import java.util.Objects;
6
 
5
 
7
public class VendorPriceCircularModel {
6
public class VendorPriceCircularModel {
8
 
7
 
9
    private int id;;
8
    private int id;;
10
    private int vendorId;
9
    private int vendorId;
Line 12... Line 11...
12
    private float transferPrice;
11
    private float transferPrice;
13
    private float dealerPrice;
12
    private float dealerPrice;
14
    private float mop;
13
    private float mop;
15
    private LocalDate effectedOn;
14
    private LocalDate effectedOn;
16
    private String status;
15
    private String status;
-
 
16
    private float marginPercent;
17
 
17
 
18
 
18
 
19
    public VendorPriceCircularModel(int id, int vendorId, int catalogId, float transferPrice, float dealerPrice, float mop, LocalDate effectedOn, String status) {
19
    public VendorPriceCircularModel(int id, int vendorId, int catalogId, float transferPrice, float dealerPrice, float mop, LocalDate effectedOn, String status) {
20
        super();
20
        super();
21
        this.id = id;
21
        this.id = id;
Line 24... Line 24...
24
        this.transferPrice = transferPrice;
24
        this.transferPrice = transferPrice;
25
        this.dealerPrice = dealerPrice;
25
        this.dealerPrice = dealerPrice;
26
        this.mop = mop;
26
        this.mop = mop;
27
        this.effectedOn = effectedOn;
27
        this.effectedOn = effectedOn;
28
        this.status = status;
28
        this.status = status;
-
 
29
        this.marginPercent = Float.parseFloat((String.format("%.2f", ((dealerPrice - transferPrice) / transferPrice))));
29
    }
30
    }
30
 
31
 
31
 
32
 
32
    public int getId() {
33
    public int getId() {
33
        return id;
34
        return id;
Line 106... Line 107...
106
 
107
 
107
    public void setStatus(String status) {
108
    public void setStatus(String status) {
108
        this.status = status;
109
        this.status = status;
109
    }
110
    }
110
 
111
 
-
 
112
    public float getMarginPercent() {
-
 
113
        return marginPercent;
-
 
114
    }
-
 
115
 
-
 
116
    public void setMarginPercent(float marginPercent) {
-
 
117
        this.marginPercent = marginPercent;
-
 
118
    }
111
 
119
 
112
    @Override
120
    @Override
113
    public int hashCode() {
121
    public boolean equals(Object o) {
114
        final int prime = 31;
-
 
115
        int result = 1;
-
 
116
        result = prime * result + catalogId;
-
 
117
        result = prime * result + Float.floatToIntBits(dealerPrice);
-
 
118
        result = prime * result + ((effectedOn == null) ? 0 : effectedOn.hashCode());
-
 
119
        result = prime * result + id;
122
        if (this == o) return true;
120
        result = prime * result + Float.floatToIntBits(mop);
123
        if (o == null || getClass() != o.getClass()) return false;
121
        result = prime * result + ((status == null) ? 0 : status.hashCode());
124
        VendorPriceCircularModel that = (VendorPriceCircularModel) o;
122
        result = prime * result + Float.floatToIntBits(transferPrice);
-
 
123
        result = prime * result + vendorId;
-
 
124
        return result;
125
        return id == that.id && vendorId == that.vendorId && catalogId == that.catalogId && Float.compare(transferPrice, that.transferPrice) == 0 && Float.compare(dealerPrice, that.dealerPrice) == 0 && Float.compare(mop, that.mop) == 0 && Float.compare(marginPercent, that.marginPercent) == 0 && Objects.equals(effectedOn, that.effectedOn) && Objects.equals(status, that.status);
125
    }
126
    }
126
 
127
 
127
    @Override
128
    @Override
128
    public boolean equals(Object obj) {
129
    public int hashCode() {
129
        if (this == obj) return true;
-
 
130
        if (obj == null) return false;
-
 
131
        if (getClass() != obj.getClass()) return false;
-
 
132
        VendorPriceCircularModel other = (VendorPriceCircularModel) obj;
-
 
133
        if (catalogId != other.catalogId) return false;
-
 
134
        if (Float.floatToIntBits(dealerPrice) != Float.floatToIntBits(other.dealerPrice)) return false;
-
 
135
        if (effectedOn == null) {
-
 
136
            if (other.effectedOn != null) return false;
-
 
137
        } else if (!effectedOn.equals(other.effectedOn)) return false;
-
 
138
        if (id != other.id) return false;
-
 
139
        if (Float.floatToIntBits(mop) != Float.floatToIntBits(other.mop)) return false;
-
 
140
        if (status != other.status) return false;
-
 
141
        if (Float.floatToIntBits(transferPrice) != Float.floatToIntBits(other.transferPrice)) return false;
130
        return Objects.hash(id, vendorId, catalogId, transferPrice, dealerPrice, mop, effectedOn, status, marginPercent);
142
        if (vendorId != other.vendorId) return false;
-
 
143
        return true;
-
 
144
    }
131
    }
145
 
132
 
146
    @Override
133
    @Override
147
    public String toString() {
134
    public String toString() {
148
        return "VendorPriceCircularModel{" +
135
        return "VendorPriceCircularModel{" +
Line 152... Line 139...
152
                ", transferPrice=" + transferPrice +
139
                ", transferPrice=" + transferPrice +
153
                ", dealerPrice=" + dealerPrice +
140
                ", dealerPrice=" + dealerPrice +
154
                ", mop=" + mop +
141
                ", mop=" + mop +
155
                ", effectedOn=" + effectedOn +
142
                ", effectedOn=" + effectedOn +
156
                ", status='" + status + '\'' +
143
                ", status='" + status + '\'' +
-
 
144
                ", marginPercent=" + marginPercent +
157
                '}';
145
                '}';
158
    }
146
    }
159
}
147
}