Subversion Repositories SmartDukaan

Rev

Rev 23663 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
23627 ashik.ali 1
package com.spice.profitmandi.dao.entity.dtr;
2
 
3
import java.io.Serializable;
4
import java.time.LocalDate;
5
import java.time.format.DateTimeFormatter;
6
 
7
import javax.persistence.Column;
8
import javax.persistence.Convert;
9
import javax.persistence.Entity;
10
import javax.persistence.Id;
11
import javax.persistence.Table;
12
 
13
import com.spice.profitmandi.dao.convertor.LocalDateAttributeConverter;
14
 
15
/**
16
 * This class basically contains daily recharge details
17
 * 
18
 * @author ashikali
19
 *
20
 */
21
 
22
@Entity
23
@Table(name="dtr.daily_recharge", schema = "dtr")
24
public class DailyRecharge implements Serializable{
25
 
26
	private static final long serialVersionUID = 1L;
27
 
28
	public DailyRecharge() {
29
	}
30
 
31
	@Id
32
	@Column(name = "provider_id")
33
	private int providerId;
34
 
35
	@Id
36
	@Convert(converter = LocalDateAttributeConverter.class)
37
	@Column(name="create_date", updatable = false, unique = true)
38
	private LocalDate createDate = LocalDate.now();
39
 
40
	@Column(name = "opening_balance")
41
	private float openingBalance;
42
 
43
	@Column(name = "closing_balance")
44
	private float closingBalance;
45
 
46
	@Column(name = "total_amount")
47
	private float totalAmount;
48
 
49
	@Column(name = "total_commission")
50
	private float totalCommission;
51
 
52
 
53
	public int getProviderId() {
54
		return providerId;
55
	}
56
 
57
	public void setProviderId(int providerId) {
58
		this.providerId = providerId;
59
	}
60
 
61
	public float getOpeningBalance() {
62
		return openingBalance;
63
	}
64
 
65
	public void setOpeningBalance(float openingBalance) {
66
		this.openingBalance = openingBalance;
67
	}
68
 
69
	public float getClosingBalance() {
70
		return closingBalance;
71
	}
72
 
73
	public void setClosingBalance(float closingBalance) {
74
		this.closingBalance = closingBalance;
75
	}
76
 
77
	public float getTotalAmount() {
78
		return totalAmount;
79
	}
80
 
81
	public void setTotalAmount(float totalAmount) {
82
		this.totalAmount = totalAmount;
83
	}
84
 
85
	public float getTotalCommission() {
86
		return totalCommission;
87
	}
88
 
89
	public void setTotalCommission(float totalCommission) {
90
		this.totalCommission = totalCommission;
91
	}
92
 
93
	public LocalDate getCreateDate() {
94
		return createDate;
95
	}
96
 
97
	public void setCreateDate(LocalDate createDate) {
98
		this.createDate = createDate;
99
	}
100
 
101
	public String getFormattedCreateDate(){
102
		if(createDate == null){
103
			return null;
104
		}
105
		DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd-MM-YYYY");
106
		return createDate.format(formatter);
107
    }
108
 
109
	@Override
110
	public int hashCode() {
111
		final int prime = 31;
112
		int result = 1;
113
		result = prime * result + ((createDate == null) ? 0 : createDate.hashCode());
114
		result = prime * result + providerId;
115
		return result;
116
	}
117
 
118
	@Override
119
	public boolean equals(Object obj) {
120
		if (this == obj)
121
			return true;
122
		if (obj == null)
123
			return false;
124
		if (getClass() != obj.getClass())
125
			return false;
126
		DailyRecharge other = (DailyRecharge) obj;
127
		if (createDate == null) {
128
			if (other.createDate != null)
129
				return false;
130
		} else if (!createDate.equals(other.createDate))
131
			return false;
132
		if (providerId != other.providerId)
133
			return false;
134
		return true;
135
	}
136
 
137
	@Override
138
	public String toString() {
139
		return "DailyRecharge [providerId=" + providerId + ", createDate=" + createDate + ", openingBalance="
140
				+ openingBalance + ", closingBalance=" + closingBalance + ", totalAmount=" + totalAmount
141
				+ ", totalCommission=" + totalCommission + "]";
142
	}
143
 
144
}