Subversion Repositories SmartDukaan

Rev

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

Rev 33795 Rev 33838
Line 1... Line 1...
1
package com.spice.profitmandi.dao.entity.catalog;
1
package com.spice.profitmandi.dao.entity.catalog;
2
 
2
 
-
 
3
import com.spice.profitmandi.common.enumuration.UpgradeOfferPaymentStatus;
-
 
4
 
3
import javax.persistence.*;
5
import javax.persistence.*;
4
import java.time.LocalDateTime;
6
import java.time.LocalDateTime;
5
import java.util.Objects;
7
import java.util.Objects;
6
 
8
 
7
@Entity
9
@Entity
8
@Table(name = "catalog.upgrade_offer")
10
@Table(name = "catalog.upgrade_offer")
-
 
11
@NamedQueries({
-
 
12
        @NamedQuery(name = "UpgradeOffer.selectUpgradeOfferGroupByYearMonth", query = "select new com.spice.profitmandi.dao.model.PendingPaymentUpgradeOfferModel(" +
-
 
13
                " sum(cast(coi.schemePayout as long)),cast(fo.fofoId as int), u.name, uo.paymentStatus,uo.customerOfferItemId, DATE_FORMAT(uo.createdTimestamp, '%m-%Y')) " +
-
 
14
                " from UpgradeOffer uo" +
-
 
15
                " JOIN CustomerOfferItem coi on uo.customerOfferItemId = coi.id" +
-
 
16
                " JOIN FofoOrder fo on fo.id = uo.orderId" +
-
 
17
                " JOIN userUser u on u.id = fo.fofoId" +
-
 
18
                " where fo.fofoId = (:fofoId) and uo.paymentStatus = :status and uo.createdTimestamp >= :startDate" +
-
 
19
                " group by DATE_FORMAT(uo.createdTimestamp, '%m-%Y')"),
-
 
20
 
-
 
21
//        @NamedQuery(name = "UpgradeOffer.selectUpgradeOfferBeforeSixMonth", query = "select new com.spice.profitmandi.dao.model.PendingPaymentUpgradeOfferModel(" +
-
 
22
//                " sum(coi.schemePayout),fo.fofoId, u.name, uo.paymentStatus,uo.customerOfferItemId, DATE_FORMAT(uo.createdTimestamp, '%m-%Y')) " +
-
 
23
//                " from UpgradeOffer uo" +
-
 
24
//                " JOIN CustomerOfferItem coi on uo.customerOfferItemId = coi.id" +
-
 
25
//                " JOIN FofoOrder fo on fo.id = uo.orderId" +
-
 
26
//                " JOIN userUser u on u.id = fo.fofoId" +
-
 
27
//                " where fo.fofoId = (:fofoId) and uo.paymentStatus = 'PENDING' and uo.createdTimestamp <= :endDate ")
-
 
28
})
9
public class UpgradeOffer {
29
public class UpgradeOffer {
10
 
30
 
11
    @Id
31
    @Id
12
    @GeneratedValue(strategy = GenerationType.IDENTITY)
32
    @GeneratedValue(strategy = GenerationType.IDENTITY)
13
    private int id;
33
    private int id;
Line 25... Line 45...
25
    private int customerOfferItemId;
45
    private int customerOfferItemId;
26
 
46
 
27
    @Column(name = "created_timestamp")
47
    @Column(name = "created_timestamp")
28
    private LocalDateTime createdTimestamp;
48
    private LocalDateTime createdTimestamp;
29
 
49
 
-
 
50
    @Column(name = "payment_status")
-
 
51
    private UpgradeOfferPaymentStatus paymentStatus;
-
 
52
 
-
 
53
    @Column(name = "status_description")
-
 
54
    private String statusDescription;
-
 
55
 
30
    public int getId() {
56
    public int getId() {
31
        return id;
57
        return id;
32
    }
58
    }
33
 
59
 
34
    public void setId(int id) {
60
    public void setId(int id) {
Line 73... Line 99...
73
 
99
 
74
    public void setItemId(int itemId) {
100
    public void setItemId(int itemId) {
75
        this.itemId = itemId;
101
        this.itemId = itemId;
76
    }
102
    }
77
 
103
 
-
 
104
    public UpgradeOfferPaymentStatus getPaymentStatus() {
-
 
105
        return paymentStatus;
-
 
106
    }
-
 
107
 
-
 
108
    public void setPaymentStatus(UpgradeOfferPaymentStatus paymentStatus) {
-
 
109
        this.paymentStatus = paymentStatus;
-
 
110
    }
-
 
111
 
-
 
112
    public String getStatusDescription() {
-
 
113
        return statusDescription;
-
 
114
    }
-
 
115
 
-
 
116
    public void setStatusDescription(String statusDescription) {
-
 
117
        this.statusDescription = statusDescription;
-
 
118
    }
-
 
119
 
78
    @Override
120
    @Override
79
    public boolean equals(Object o) {
121
    public boolean equals(Object o) {
80
        if (this == o) return true;
122
        if (this == o) return true;
81
        if (o == null || getClass() != o.getClass()) return false;
123
        if (o == null || getClass() != o.getClass()) return false;
82
        UpgradeOffer that = (UpgradeOffer) o;
124
        UpgradeOffer that = (UpgradeOffer) o;
83
        return id == that.id && orderId == that.orderId && itemId == that.itemId && customerOfferItemId == that.customerOfferItemId && Objects.equals(serialNumber, that.serialNumber) && Objects.equals(createdTimestamp, that.createdTimestamp);
125
        return id == that.id && orderId == that.orderId && itemId == that.itemId && customerOfferItemId == that.customerOfferItemId && Objects.equals(serialNumber, that.serialNumber) && Objects.equals(createdTimestamp, that.createdTimestamp) && paymentStatus == that.paymentStatus && Objects.equals(statusDescription, that.statusDescription);
84
    }
126
    }
85
 
127
 
86
    @Override
128
    @Override
87
    public int hashCode() {
129
    public int hashCode() {
88
        return Objects.hash(id, orderId, itemId, serialNumber, customerOfferItemId, createdTimestamp);
130
        return Objects.hash(id, orderId, itemId, serialNumber, customerOfferItemId, createdTimestamp, paymentStatus, statusDescription);
89
    }
131
    }
90
 
132
 
91
    @Override
133
    @Override
92
    public String toString() {
134
    public String toString() {
93
        return "UpgradeOffer{" +
135
        return "UpgradeOffer{" +
Line 95... Line 137...
95
                ", orderId=" + orderId +
137
                ", orderId=" + orderId +
96
                ", itemId=" + itemId +
138
                ", itemId=" + itemId +
97
                ", serialNumber='" + serialNumber + '\'' +
139
                ", serialNumber='" + serialNumber + '\'' +
98
                ", customerOfferItemId=" + customerOfferItemId +
140
                ", customerOfferItemId=" + customerOfferItemId +
99
                ", createdTimestamp=" + createdTimestamp +
141
                ", createdTimestamp=" + createdTimestamp +
-
 
142
                ", paymentStatus=" + paymentStatus +
-
 
143
                ", statusDescription='" + statusDescription + '\'' +
100
                '}';
144
                '}';
101
    }
145
    }
102
}
146
}