Subversion Repositories SmartDukaan

Rev

Rev 30640 | Rev 31170 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 30640 Rev 30896
Line 11... Line 11...
11
import java.time.format.DateTimeFormatter;
11
import java.time.format.DateTimeFormatter;
12
import java.util.*;
12
import java.util.*;
13
 
13
 
14
/**
14
/**
15
 * This class basically contains scheme details
15
 * This class basically contains scheme details
16
 * 
-
 
17
 * @author ashikali
-
 
18
 *
16
 *
-
 
17
 * @author ashikali
19
 */
18
 */
-
 
19
 
-
 
20
@NamedNativeQueries({
-
 
21
		@NamedNativeQuery(name = "scheme.selectMissedActivationSale",
-
 
22
				query = "select cs.id as scheme_id, ai.serial_number, sr.order_id, ii.id as inventory_item_id, ai.activation_timestamp" +
-
 
23
						" from fofo.activated_imei ai " +
-
 
24
						"   join fofo.inventory_item ii on ai.serial_number = ii.serial_number " +
-
 
25
						"   join catalog.item i on i.id = ii.item_id " +
-
 
26
						"   join catalog.scheme cs on (date(ai.activation_timestamp) between cs.start_date_time and cs.end_date_time) " +
-
 
27
						"   join fofo.scheme_item si on (si.scheme_id = cs.id and i.catalog_item_id = si.catalog_id) " +
-
 
28
						"	join fofo.scan_record sr on (sr.inventory_item_id = ii.id)" +
-
 
29
						"	left join fofo.scheme_in_out sio on (sio.scheme_id = cs.id and sio.inventory_item_id = ii.id) " +
-
 
30
						" where cs.active_timestamp is not null " +
-
 
31
						" and cs.type in ('SPECIAL_SUPPORT', 'ACTIVATION')" +
-
 
32
						" and sr.type = 'SALE'" +
-
 
33
						" and (sio.id is null or sio.status='REJECTED') " +
-
 
34
						" and ai.checked = false", resultSetMapping = "missedActivationSaleMapping")
-
 
35
})
-
 
36
 
-
 
37
@SqlResultSetMappings({
-
 
38
		@SqlResultSetMapping(name = "missedActivationSaleMapping", classes = {
-
 
39
				@ConstructorResult(targetClass = SchemesImeisModel.class, columns = {
-
 
40
						@ColumnResult(name = "serial_number", type = String.class),
-
 
41
						@ColumnResult(name = "activation_timestamp", type = LocalDateTime.class),
-
 
42
						@ColumnResult(name = "order_id", type = Integer.class),
-
 
43
						@ColumnResult(name = "inventory_item_id", type = Integer.class),
-
 
44
						@ColumnResult(name = "scheme_id", type = Integer.class),
-
 
45
				})
-
 
46
		})})
20
@Entity
47
@Entity
21
@Table(name = "catalog.scheme", schema = "catalog")
48
@Table(name = "catalog.scheme", schema = "catalog")
22
public class Scheme implements Serializable {
49
public class Scheme implements Serializable {
23
 
50
 
24
	public PartnerType getPartnerType() {
51
	public PartnerType getPartnerType() {
Line 85... Line 112...
85
	@Column
112
	@Column
86
	private boolean cashback;
113
	private boolean cashback;
87
 
114
 
88
	@Transient
115
	@Transient
89
	private Set<Integer> retailerIds = new HashSet<>();
116
	private Set<Integer> retailerIds = new HashSet<>();
90
	
117
 
91
	@Transient
118
	@Transient
92
	private String amountModel;
119
	private String amountModel;
93
	
120
 
94
	@Transient
121
	@Transient
95
	private float schemeValue;
122
	private float schemeValue;
96
	
-
 
97
	
123
 
98
 
124
 
99
	public float getSchemeValue() {
125
	public float getSchemeValue() {
100
		return schemeValue;
126
		return schemeValue;
101
	}
127
	}
102
 
128
 
Line 155... Line 181...
155
	}
181
	}
156
 
182
 
157
	public void setId(int id) {
183
	public void setId(int id) {
158
		this.id = id;
184
		this.id = id;
159
	}
185
	}
160
	
-
 
161
	
186
 
162
 
187
 
163
	public String getAmountModel() {
188
	public String getAmountModel() {
164
		return amountModel;
189
		return amountModel;
165
	}
190
	}
166
 
191
 
Line 341... Line 366...
341
	}
366
	}
342
 
367
 
343
	public boolean isWithinRange(LocalDateTime testDate) {
368
	public boolean isWithinRange(LocalDateTime testDate) {
344
		return !(testDate.isBefore(this.startDateTime) || testDate.isAfter(endDateTime));
369
		return !(testDate.isBefore(this.startDateTime) || testDate.isAfter(endDateTime));
345
	}
370
	}
346
 
-
 
347
 
-
 
348
}
371
}
349
372