Subversion Repositories SmartDukaan

Rev

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

Rev 30279 Rev 30289
Line 17... Line 17...
17
 * @author ashikali
17
 * @author ashikali
18
 */
18
 */
19
 
19
 
20
@Entity
20
@Entity
21
@Table(name = "transaction.`order`", schema = "transaction")
21
@Table(name = "transaction.`order`", schema = "transaction")
22
@NamedQueries({ @NamedQuery(name = "Order.selectAll", query = "select o from Order o"),
22
@NamedQueries({@NamedQuery(name = "Order.selectAll", query = "select o from Order o"),
23
		@NamedQuery(name = "Order.selectById", query = "select o from Order o where o.id= :id"),
23
		@NamedQuery(name = "Order.selectById", query = "select o from Order o where o.id= :id"),
24
		@NamedQuery(name = "Order.selectByTransactionId", query = "select t.id, t.createTimestamp, o.retailerAddress1, o.retailerAddress2, o.retailerCity, "
24
		@NamedQuery(name = "Order.selectByTransactionId", query = "select t.id, t.createTimestamp, o.retailerAddress1, o.retailerAddress2, o.retailerCity, "
25
				+ "o.retailerPinCode, o.retailerState, o.shippingCost, o.statusDescription, o.invoiceNumber, o.airwayBillNumber, o.totalAmount, li.brand, li.modelName, "
25
				+ "o.retailerPinCode, o.retailerState, o.shippingCost, o.statusDescription, o.invoiceNumber, o.airwayBillNumber, o.totalAmount, li.brand, li.modelName, "
26
				+ "li.modelNumber, li.color, li.quantity, li.unitPrice, p.id, p.name,  o.shippingTimestamp, o.status, o.promisedDeliveryTime, o.retailerName, t.status, i.catalogItemId  from Transaction t join Order o on o.transactionId = t.id "
26
				+ "li.modelNumber, li.color, li.quantity, li.unitPrice, p.id, p.name,  o.shippingTimestamp, o.status, o.promisedDeliveryTime, o.retailerName, t.status, i.catalogItemId  from Transaction t join Order o on o.transactionId = t.id "
27
				+ "join LineItem li on li.orderId = o.id left join Provider p on p.id = o.logisticsProviderId join Item i on i.id=li.itemId where o.transactionId = :transactionId"),
27
				+ "join LineItem li on li.orderId = o.id left join Provider p on p.id = o.logisticsProviderId join Item i on i.id=li.itemId where o.transactionId = :transactionId"),
Line 176... Line 176...
176
				+ "  sum(case when po.name = 'SAMSUNG SURE' then cast(pot.amount As int) else 0 end),sum(cast(pot.amount As int)))"
176
				+ "  sum(case when po.name = 'SAMSUNG SURE' then cast(pot.amount As int) else 0 end),sum(cast(pot.amount As int)))"
177
				+ "	 from PaymentOptionTransaction pot join PaymentOption po on pot.paymentOptionId=po.id join com.spice.profitmandi.dao.entity.user.User u on u.id=pot.fofoId"
177
				+ "	 from PaymentOptionTransaction pot join PaymentOption po on pot.paymentOptionId=po.id join com.spice.profitmandi.dao.entity.user.User u on u.id=pot.fofoId"
178
				+ "	 join Address a on a.id=u.addressId where 1=1 and  pot.fofoId = :fofoId and pot.createTimestamp between :startDate and :endDate "
178
				+ "	 join Address a on a.id=u.addressId where 1=1 and  pot.fofoId = :fofoId and pot.createTimestamp between :startDate and :endDate "
179
				+ "  group by (pot.createTimestamp), pot.referenceType "),
179
				+ "  group by (pot.createTimestamp), pot.referenceType "),
180
 
180
 
-
 
181
 
181
})
182
})
182
//@NamedNativeQuery(name = "Order.findByEmailAddress", query = "select * from transaction.`order` o where  o.id = '1694173'", resultClass = Order.class)
183
//@NamedNativeQuery(name = "Order.findByEmailAddress", query = "select * from transaction.`order` o where  o.id = '1694173'", resultClass = Order.class)
183
 
184
 
-
 
185
 
184
@NamedNativeQueries({
186
@NamedNativeQueries({
185
 
187
 
186
		@NamedNativeQuery(name = "selectPartnerSecondaryGroupByBrand", query = "select ifnull(a.customer_id,fs.id) as id,ifnull(a.sb,brand) as brand,a.secondary_plan,sum(a.total_price) as total_price,a.auth_id, a.commited_timestamp from "
188
		@NamedNativeQuery(name = "selectPartnerSecondaryGroupByBrand", query = "select ifnull(a.customer_id,fs.id) as id,ifnull(a.sb,brand) as brand,a.secondary_plan,sum(a.total_price) as total_price,a.auth_id, a.commited_timestamp from "
187
				+ "fofo.fofo_store fs left join (select o.customer_id , li.brand as sb, li.total_price, psp.fofo_id , psp.brand, psp.secondary_plan,psp.auth_id,psp.commited_timestamp from transaction.`order` o join transaction.lineitem li on "
189
				+ "fofo.fofo_store fs left join (select o.customer_id , li.brand as sb, li.total_price, psp.fofo_id , psp.brand, psp.secondary_plan,psp.auth_id,psp.commited_timestamp from transaction.`order` o join transaction.lineitem li on "
188
				+ "(o.id = li.order_id) left join  auth.partner_secondary_plan psp on (psp.fofo_id = o.customer_id  and date(psp.commited_timestamp) >= :startDate and "
190
				+ "(o.id = li.order_id) left join  auth.partner_secondary_plan psp on (psp.fofo_id = o.customer_id  and date(psp.commited_timestamp) >= :startDate and "
Line 197... Line 199...
197
				+ " from transaction.price_drop pd join transaction.price_drop_imei pdi on pdi.price_drop_id = pd.id join (select catalog_item_id, brand, model_name, model_number from catalog.item group by catalog_item_id )"
199
				+ " from transaction.price_drop pd join transaction.price_drop_imei pdi on pdi.price_drop_id = pd.id join (select catalog_item_id, brand, model_name, model_number from catalog.item group by catalog_item_id )"
198
				+ " ci on ci.catalog_item_id=pd.catalog_id join fofo.fofo_store fs on fs.id=pdi.retailer_id where  pdi.retailer_id = :fofoId and pd.affected_on between :startDate and :endDate and pd.amount > 0;", resultSetMapping = "PriceDropReportModel")
200
				+ " ci on ci.catalog_item_id=pd.catalog_id join fofo.fofo_store fs on fs.id=pdi.retailer_id where  pdi.retailer_id = :fofoId and pd.affected_on between :startDate and :endDate and pd.amount > 0;", resultSetMapping = "PriceDropReportModel")
199
 
201
 
200
})
202
})
201
 
203
 
-
 
204
 
202
@SqlResultSetMappings({
205
@SqlResultSetMappings({
203
 
206
 
204
		@SqlResultSetMapping(name = "partnerSecondaryPlanModel", classes = {
207
		@SqlResultSetMapping(name = "partnerSecondaryPlanModel", classes = {
205
				@ConstructorResult(targetClass = PartnerSecondaryPlanModel.class, columns = {
208
				@ConstructorResult(targetClass = PartnerSecondaryPlanModel.class, columns = {
206
						@ColumnResult(name = "id", type = Integer.class),
-
 
207
						@ColumnResult(name = "brand", type = String.class),
209
						@ColumnResult(name = "id", type = Integer.class), @ColumnResult(name = "brand", type = String.class),
208
						@ColumnResult(name = "secondary_plan", type = Long.class),
210
						@ColumnResult(name = "secondary_plan", type = Long.class),
209
						@ColumnResult(name = "total_price", type = Long.class),
211
						@ColumnResult(name = "total_price", type = Long.class),
210
						@ColumnResult(name = "auth_id", type = Integer.class),
212
						@ColumnResult(name = "auth_id", type = Integer.class),
211
						@ColumnResult(name = "commited_timestamp", type = LocalDateTime.class) }) }),
213
						@ColumnResult(name = "commited_timestamp", type = LocalDateTime.class)})}),
212
 
214
 
213
		@SqlResultSetMapping(name = "PriceDropReportModel", classes = {
215
		@SqlResultSetMapping(name = "PriceDropReportModel", classes = {
214
				@ConstructorResult(targetClass = PriceDropReportModel.class, columns = {
216
				@ConstructorResult(targetClass = PriceDropReportModel.class, columns = {
215
						@ColumnResult(name = "code", type = String.class),
217
						@ColumnResult(name = "code", type = String.class),
216
						@ColumnResult(name = "id", type = Integer.class),
218
						@ColumnResult(name = "id", type = Integer.class),
Line 221... Line 223...
221
						@ColumnResult(name = "amount", type = Float.class),
223
						@ColumnResult(name = "amount", type = Float.class),
222
						@ColumnResult(name = "partner_payout", type = Float.class),
224
						@ColumnResult(name = "partner_payout", type = Float.class),
223
						@ColumnResult(name = "imei", type = String.class),
225
						@ColumnResult(name = "imei", type = String.class),
224
						@ColumnResult(name = "status", type = String.class),
226
						@ColumnResult(name = "status", type = String.class),
225
						@ColumnResult(name = "update_timestamp", type = LocalDateTime.class),
227
						@ColumnResult(name = "update_timestamp", type = LocalDateTime.class),
226
						@ColumnResult(name = "rejection_reason", type = String.class), }) })
228
						@ColumnResult(name = "rejection_reason", type = String.class),
-
 
229
				})})
227
 
230
 
228
})
231
})
229
 
232
 
230
public class Order implements Serializable {
233
public class Order implements Serializable {
231
 
234
 
Line 522... Line 525...
522
	private Float netPayableAmount;
525
	private Float netPayableAmount;
523
 
526
 
524
	@Column(name = "shippingRefund")
527
	@Column(name = "shippingRefund")
525
	private Float shippingRefund;
528
	private Float shippingRefund;
526
 
529
 
-
 
530
	@Column(name = "irn_generated")
-
 
531
	private Boolean irnGenerated = false;
-
 
532
 
527
	@ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
533
	@ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
528
	@JoinColumn(name = "id", insertable = false, updatable = false, nullable = false, referencedColumnName = "order_id")
534
	@JoinColumn(name = "id", insertable = false, updatable = false, nullable = false, referencedColumnName = "order_id")
529
	private LineItem lineItem;
535
	private LineItem lineItem;
530
 
536
 
531
	public Integer getId() {
537
	public Integer getId() {
Line 1228... Line 1234...
1228
		} else if (!id.equals(other.id))
1234
		} else if (!id.equals(other.id))
1229
			return false;
1235
			return false;
1230
		return true;
1236
		return true;
1231
	}
1237
	}
1232
 
1238
 
-
 
1239
	public Boolean isIrnGenerated() {
-
 
1240
		return irnGenerated;
-
 
1241
	}
-
 
1242
 
-
 
1243
	public void setIrnGenerated(boolean irnGenerated) {
-
 
1244
		this.irnGenerated = irnGenerated;
-
 
1245
	}
-
 
1246
 
1233
	@Override
1247
	@Override
1234
	public String toString() {
1248
	public String toString() {
1235
		return "Order [id=" + id + ", warehouseId=" + warehouseId + ", sellerId=" + sellerId + ", warehouseAddressId="
1249
		return "Order [id=" + id + ", warehouseId=" + warehouseId + ", sellerId=" + sellerId + ", warehouseAddressId="
1236
				+ warehouseAddressId + ", logisticsProviderId=" + logisticsProviderId + ", airwayBillNumber="
1250
				+ warehouseAddressId + ", logisticsProviderId=" + logisticsProviderId + ", airwayBillNumber="
1237
				+ airwayBillNumber + ", trackingId=" + trackingId + ", expectedDeliveryTime=" + expectedDeliveryTime
1251
				+ airwayBillNumber + ", trackingId=" + trackingId + ", expectedDeliveryTime=" + expectedDeliveryTime