| 23527 |
ashik.ali |
1 |
package com.spice.profitmandi.dao.entity.dtr;
|
|
|
2 |
|
|
|
3 |
import java.io.Serializable;
|
|
|
4 |
import java.time.LocalDateTime;
|
|
|
5 |
import java.time.format.DateTimeFormatter;
|
|
|
6 |
|
|
|
7 |
import javax.persistence.Column;
|
|
|
8 |
import javax.persistence.Convert;
|
|
|
9 |
import javax.persistence.Entity;
|
| 23531 |
ashik.ali |
10 |
import javax.persistence.EnumType;
|
|
|
11 |
import javax.persistence.Enumerated;
|
| 23527 |
ashik.ali |
12 |
import javax.persistence.Id;
|
|
|
13 |
import javax.persistence.Table;
|
|
|
14 |
|
|
|
15 |
import org.hibernate.annotations.UpdateTimestamp;
|
|
|
16 |
|
|
|
17 |
import com.spice.profitmandi.dao.convertor.LocalDateTimeAttributeConverter;
|
|
|
18 |
import com.spice.profitmandi.dao.enumuration.catalog.AmountType;
|
|
|
19 |
|
|
|
20 |
/**
|
|
|
21 |
* This class basically contains recharge operator details
|
|
|
22 |
*
|
|
|
23 |
* @author ashikali
|
|
|
24 |
*
|
|
|
25 |
*/
|
|
|
26 |
|
|
|
27 |
@Entity
|
|
|
28 |
@Table(name="dtr.recharge_commission", schema = "dtr")
|
|
|
29 |
public class RechargeCommission implements Serializable{
|
|
|
30 |
|
|
|
31 |
private static final long serialVersionUID = 1L;
|
|
|
32 |
|
|
|
33 |
public RechargeCommission() {
|
|
|
34 |
}
|
|
|
35 |
|
|
|
36 |
@Id
|
|
|
37 |
@Column(name="operator_id", unique=true, updatable=false)
|
|
|
38 |
//@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
|
39 |
private int operatorId;
|
|
|
40 |
|
|
|
41 |
@Column(name="amount")
|
|
|
42 |
private float amount;
|
|
|
43 |
|
|
|
44 |
@Column(name = "amount_type")
|
| 23531 |
ashik.ali |
45 |
@Enumerated(EnumType.STRING)
|
| 23527 |
ashik.ali |
46 |
private AmountType amountType;
|
|
|
47 |
|
|
|
48 |
@Convert(converter = LocalDateTimeAttributeConverter.class)
|
|
|
49 |
@Column(name="create_timestamp", updatable = false)
|
|
|
50 |
private LocalDateTime createTimestamp = LocalDateTime.now();
|
|
|
51 |
|
|
|
52 |
@Convert(converter = LocalDateTimeAttributeConverter.class)
|
|
|
53 |
@Column(name="update_timestamp", updatable = false)
|
|
|
54 |
@UpdateTimestamp
|
|
|
55 |
private LocalDateTime updateTimestamp = LocalDateTime.now();
|
|
|
56 |
|
|
|
57 |
public int getOperatorId() {
|
|
|
58 |
return operatorId;
|
|
|
59 |
}
|
|
|
60 |
|
|
|
61 |
public void setOperatorId(int operatorId) {
|
|
|
62 |
this.operatorId = operatorId;
|
|
|
63 |
}
|
|
|
64 |
|
|
|
65 |
public float getAmount() {
|
|
|
66 |
return amount;
|
|
|
67 |
}
|
|
|
68 |
|
|
|
69 |
public void setAmount(float amount) {
|
|
|
70 |
this.amount = amount;
|
|
|
71 |
}
|
|
|
72 |
|
|
|
73 |
public AmountType getAmountType() {
|
|
|
74 |
return amountType;
|
|
|
75 |
}
|
|
|
76 |
|
|
|
77 |
public void setAmountType(AmountType amountType) {
|
|
|
78 |
this.amountType = amountType;
|
|
|
79 |
}
|
|
|
80 |
|
|
|
81 |
public LocalDateTime getCreateTimestamp() {
|
|
|
82 |
return createTimestamp;
|
|
|
83 |
}
|
|
|
84 |
|
|
|
85 |
public void setCreateTimestamp(LocalDateTime createTimestamp) {
|
|
|
86 |
this.createTimestamp = createTimestamp;
|
|
|
87 |
}
|
|
|
88 |
|
|
|
89 |
public LocalDateTime getUpdateTimestamp() {
|
|
|
90 |
return updateTimestamp;
|
|
|
91 |
}
|
|
|
92 |
|
|
|
93 |
public void setUpdateTimestamp(LocalDateTime updateTimestamp) {
|
|
|
94 |
this.updateTimestamp = updateTimestamp;
|
|
|
95 |
}
|
|
|
96 |
|
|
|
97 |
public String getFormattedCreateTimestamp(){
|
|
|
98 |
if(createTimestamp == null){
|
|
|
99 |
return null;
|
|
|
100 |
}
|
|
|
101 |
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd-MM-YYYY HH:mm");
|
|
|
102 |
return createTimestamp.format(formatter);
|
|
|
103 |
}
|
|
|
104 |
|
|
|
105 |
public String getFormattedUpdateTimestamp(){
|
|
|
106 |
if(updateTimestamp == null){
|
|
|
107 |
return null;
|
|
|
108 |
}
|
|
|
109 |
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd-MM-YYYY HH:mm");
|
|
|
110 |
return updateTimestamp.format(formatter);
|
|
|
111 |
}
|
|
|
112 |
|
|
|
113 |
@Override
|
|
|
114 |
public int hashCode() {
|
|
|
115 |
final int prime = 31;
|
|
|
116 |
int result = 1;
|
|
|
117 |
result = prime * result + operatorId;
|
|
|
118 |
return result;
|
|
|
119 |
}
|
|
|
120 |
|
|
|
121 |
@Override
|
|
|
122 |
public boolean equals(Object obj) {
|
|
|
123 |
if (this == obj)
|
|
|
124 |
return true;
|
|
|
125 |
if (obj == null)
|
|
|
126 |
return false;
|
|
|
127 |
if (getClass() != obj.getClass())
|
|
|
128 |
return false;
|
|
|
129 |
RechargeCommission other = (RechargeCommission) obj;
|
|
|
130 |
if (operatorId != other.operatorId)
|
|
|
131 |
return false;
|
|
|
132 |
return true;
|
|
|
133 |
}
|
|
|
134 |
|
|
|
135 |
@Override
|
|
|
136 |
public String toString() {
|
|
|
137 |
return "RechargeCommission [operatorId=" + operatorId + ", amount=" + amount + ", amountType=" + amountType
|
|
|
138 |
+ ", createTimestamp=" + createTimestamp + ", updateTimestamp=" + updateTimestamp + "]";
|
|
|
139 |
}
|
|
|
140 |
|
|
|
141 |
}
|