| Line 18... |
Line 18... |
| 18 |
* @author ashikali
|
18 |
* @author ashikali
|
| 19 |
*/
|
19 |
*/
|
| 20 |
|
20 |
|
| 21 |
@Entity
|
21 |
@Entity
|
| 22 |
@Table(name = "transaction.`order`", schema = "transaction")
|
22 |
@Table(name = "transaction.`order`", schema = "transaction")
|
| 23 |
@NamedQueries({@NamedQuery(name = "Order.selectAll", query = "select o from Order o"),
|
23 |
@NamedQueries({ @NamedQuery(name = "Order.selectAll", query = "select o from Order o"),
|
| 24 |
@NamedQuery(name = "Order.selectById", query = "select o from Order o where o.id= :id"),
|
24 |
@NamedQuery(name = "Order.selectById", query = "select o from Order o where o.id= :id"),
|
| 25 |
@NamedQuery(name = "Order.selectByTransactionId", query = "select t.id, t.createTimestamp, o.retailerAddress1, o.retailerAddress2, o.retailerCity, "
|
25 |
@NamedQuery(name = "Order.selectByTransactionId", query = "select t.id, t.createTimestamp, o.retailerAddress1, o.retailerAddress2, o.retailerCity, "
|
| 26 |
+ "o.retailerPinCode, o.retailerState, o.shippingCost, o.statusDescription, o.invoiceNumber, o.airwayBillNumber, o.totalAmount, li.brand, li.modelName, "
|
26 |
+ "o.retailerPinCode, o.retailerState, o.shippingCost, o.statusDescription, o.invoiceNumber, o.airwayBillNumber, o.totalAmount, li.brand, li.modelName, "
|
| 27 |
+ "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 |
+ "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 "
|
| 28 |
+ "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"),
|
28 |
+ "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 174... |
Line 174... |
| 174 |
@NamedQuery(name = "Order.selectAllGrnPendingAccessoriesTvGroupByFofoId", query = "select new com.spice.profitmandi.dao.model.InStockAccessoriesTvFofoIdModel("
|
174 |
@NamedQuery(name = "Order.selectAllGrnPendingAccessoriesTvGroupByFofoId", query = "select new com.spice.profitmandi.dao.model.InStockAccessoriesTvFofoIdModel("
|
| 175 |
+ " o.retailerId, SUM(case when c.parentCategoryId = 10011 then CAST(o.totalAmount AS integer) else 0 end), SUM(case when c.parentCategoryId = 14200 then CAST(o.totalAmount AS integer) else 0 end))"
|
175 |
+ " o.retailerId, SUM(case when c.parentCategoryId = 10011 then CAST(o.totalAmount AS integer) else 0 end), SUM(case when c.parentCategoryId = 14200 then CAST(o.totalAmount AS integer) else 0 end))"
|
| 176 |
+ " from Order o join LineItem li on o.id = li.orderId join Item i on i.id = li.itemId join Category c on c.id = i.categoryId "
|
176 |
+ " from Order o join LineItem li on o.id = li.orderId join Item i on i.id = li.itemId join Category c on c.id = i.categoryId "
|
| 177 |
+ " where o.retailerId in :fofoIds and o.billingTimestamp is not null and o.refundTimestamp is null and o.partnerGrnTimestamp is null and i.categoryId != 10006 group by o.retailerId"),
|
177 |
+ " where o.retailerId in :fofoIds and o.billingTimestamp is not null and o.refundTimestamp is null and o.partnerGrnTimestamp is null and i.categoryId != 10006 group by o.retailerId"),
|
| 178 |
|
178 |
|
| 179 |
@NamedQuery(name = "Order.selectPartnersBilledBetweenDates", query = "select new com.spice.profitmandi.dao.model.PartnerSecondaryModel(fs.warehouseId, fs.id, count(o.id), sum(o.totalAmount) )" +
|
179 |
@NamedQuery(name = "Order.selectPartnersBilledBetweenDates", query = "select new com.spice.profitmandi.dao.model.PartnerSecondaryModel(fs.warehouseId, fs.id, count(o.id), sum(o.totalAmount) )"
|
| 180 |
" from FofoStore fs left join Order o on (fs.id=o.retailerId and o.billingTimestamp between :startDate and :endDate " +
|
180 |
+ " from FofoStore fs left join Order o on (fs.id=o.retailerId and o.billingTimestamp between :startDate and :endDate "
|
| 181 |
" and o.refundTimestamp is null) where" +
|
181 |
+ " and o.refundTimestamp is null) where"
|
| 182 |
" fs.internal = false and (fs.active= true or o.retailerId is not null) group by fs.warehouseId, fs.id"),
|
182 |
+ " fs.internal = false and (fs.active= true or o.retailerId is not null) group by fs.warehouseId, fs.id"),
|
| 183 |
|
183 |
|
| 184 |
@NamedQuery(name = "Order.selectCollectionSummary", query = "select new com.spice.profitmandi.dao.model.CollectionSummary(pot.createTimestamp, "
|
184 |
@NamedQuery(name = "Order.selectCollectionSummary", query = "select new com.spice.profitmandi.dao.model.CollectionSummary(pot.createTimestamp, "
|
| 185 |
+ " pot.referenceType,sum(case when po.name = 'CASH' then cast(pot.amount As int) else 0 end),"
|
185 |
+ " pot.referenceType,sum(case when po.name = 'CASH' then cast(pot.amount As int) else 0 end),"
|
| 186 |
+ " sum(case when po.name = 'PINELABS' then cast(pot.amount As int) else 0 end),"
|
186 |
+ " sum(case when po.name = 'PINELABS' then cast(pot.amount As int) else 0 end),"
|
| 187 |
+ " sum(case when po.name = 'BAJAJ FINSERV' then cast(pot.amount As int) else 0 end),"
|
187 |
+ " sum(case when po.name = 'BAJAJ FINSERV' then cast(pot.amount As int) else 0 end),"
|
| Line 197... |
Line 197... |
| 197 |
})
|
197 |
})
|
| 198 |
//@NamedNativeQuery(name = "Order.findByEmailAddress", query = "select * from transaction.`order` o where o.id = '1694173'", resultClass = Order.class)
|
198 |
//@NamedNativeQuery(name = "Order.findByEmailAddress", query = "select * from transaction.`order` o where o.id = '1694173'", resultClass = Order.class)
|
| 199 |
|
199 |
|
| 200 |
@NamedNativeQueries({
|
200 |
@NamedNativeQueries({
|
| 201 |
|
201 |
|
| - |
|
202 |
@NamedNativeQuery(name = "Order.selectAllOrderWeight", query = "select i.catalog_item_id from transaction.`order` o join transaction.lineitem li on o.id = li.order_id "
|
| - |
|
203 |
+ "join catalog.item i on i.id = li.item_id "
|
| - |
|
204 |
+ "where date(o.created_timestamp) between :startDate and :endDate and o.status = 12 and i.hsnCode = '85171300' "
|
| - |
|
205 |
+ " group by i.catalog_item_id order by sum((datediff(now(),o.created_timestamp)/30)*li.quantity) desc"),
|
| - |
|
206 |
|
| 202 |
@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 "
|
207 |
@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 "
|
| 203 |
+ "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 "
|
208 |
+ "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 "
|
| 204 |
+ "(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 "
|
209 |
+ "(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 "
|
| 205 |
+ "psp.active = 1 and psp.brand = li.brand ) where o.customer_id in :fofoIds and o.status in (7,9,10,12) and date(o.billing_timestamp) = :startDate"
|
210 |
+ "psp.active = 1 and psp.brand = li.brand ) where o.customer_id in :fofoIds and o.status in (7,9,10,12) and date(o.billing_timestamp) = :startDate"
|
| 206 |
+ " union select if(li.brand is null, null, o.customer_id) as customer_id, li.brand as sb, li.total_price, psp.fofo_id , psp.brand, psp.secondary_plan,psp.auth_id, psp.commited_timestamp "
|
211 |
+ " union select if(li.brand is null, null, o.customer_id) as customer_id, li.brand as sb, li.total_price, psp.fofo_id , psp.brand, psp.secondary_plan,psp.auth_id, psp.commited_timestamp "
|
| Line 222... |
Line 227... |
| 222 |
@ColumnResult(name = "id", type = Integer.class),
|
227 |
@ColumnResult(name = "id", type = Integer.class),
|
| 223 |
@ColumnResult(name = "brand", type = String.class),
|
228 |
@ColumnResult(name = "brand", type = String.class),
|
| 224 |
@ColumnResult(name = "secondary_plan", type = Long.class),
|
229 |
@ColumnResult(name = "secondary_plan", type = Long.class),
|
| 225 |
@ColumnResult(name = "total_price", type = Long.class),
|
230 |
@ColumnResult(name = "total_price", type = Long.class),
|
| 226 |
@ColumnResult(name = "auth_id", type = Integer.class),
|
231 |
@ColumnResult(name = "auth_id", type = Integer.class),
|
| 227 |
@ColumnResult(name = "commited_timestamp", type = LocalDateTime.class)})}),
|
232 |
@ColumnResult(name = "commited_timestamp", type = LocalDateTime.class) }) }),
|
| 228 |
|
233 |
|
| 229 |
@SqlResultSetMapping(name = "PriceDropReportModel", classes = {
|
234 |
@SqlResultSetMapping(name = "PriceDropReportModel", classes = {
|
| 230 |
@ConstructorResult(targetClass = PriceDropReportModel.class, columns = {
|
235 |
@ConstructorResult(targetClass = PriceDropReportModel.class, columns = {
|
| 231 |
@ColumnResult(name = "code", type = String.class),
|
236 |
@ColumnResult(name = "code", type = String.class),
|
| 232 |
@ColumnResult(name = "id", type = Integer.class),
|
237 |
@ColumnResult(name = "id", type = Integer.class),
|
| Line 237... |
Line 242... |
| 237 |
@ColumnResult(name = "amount", type = Float.class),
|
242 |
@ColumnResult(name = "amount", type = Float.class),
|
| 238 |
@ColumnResult(name = "partner_payout", type = Float.class),
|
243 |
@ColumnResult(name = "partner_payout", type = Float.class),
|
| 239 |
@ColumnResult(name = "imei", type = String.class),
|
244 |
@ColumnResult(name = "imei", type = String.class),
|
| 240 |
@ColumnResult(name = "status", type = String.class),
|
245 |
@ColumnResult(name = "status", type = String.class),
|
| 241 |
@ColumnResult(name = "update_timestamp", type = LocalDateTime.class),
|
246 |
@ColumnResult(name = "update_timestamp", type = LocalDateTime.class),
|
| 242 |
@ColumnResult(name = "rejection_reason", type = String.class),})})
|
247 |
@ColumnResult(name = "rejection_reason", type = String.class), }) })
|
| 243 |
|
248 |
|
| 244 |
})
|
249 |
})
|
| 245 |
|
250 |
|
| 246 |
public class Order implements Serializable {
|
251 |
public class Order implements Serializable {
|
| 247 |
|
252 |
|