| Line 65... |
Line 65... |
| 65 |
import com.spice.profitmandi.dao.entity.fofo.PurchaseReturnItem;
|
65 |
import com.spice.profitmandi.dao.entity.fofo.PurchaseReturnItem;
|
| 66 |
import com.spice.profitmandi.dao.entity.fofo.ScanRecord;
|
66 |
import com.spice.profitmandi.dao.entity.fofo.ScanRecord;
|
| 67 |
import com.spice.profitmandi.dao.entity.fofo.SchemeInOut;
|
67 |
import com.spice.profitmandi.dao.entity.fofo.SchemeInOut;
|
| 68 |
import com.spice.profitmandi.dao.entity.fofo.SchemeItem;
|
68 |
import com.spice.profitmandi.dao.entity.fofo.SchemeItem;
|
| 69 |
import com.spice.profitmandi.dao.entity.inventory.SaholicInventorySnapshot;
|
69 |
import com.spice.profitmandi.dao.entity.inventory.SaholicInventorySnapshot;
|
| - |
|
70 |
import com.spice.profitmandi.dao.entity.inventory.SaholicReservationSnapshot;
|
| 70 |
import com.spice.profitmandi.dao.entity.inventory.VendorItemPricing;
|
71 |
import com.spice.profitmandi.dao.entity.inventory.VendorItemPricing;
|
| 71 |
import com.spice.profitmandi.dao.entity.inventory.Warehouse;
|
72 |
import com.spice.profitmandi.dao.entity.inventory.Warehouse;
|
| 72 |
import com.spice.profitmandi.dao.entity.transaction.HdfcPayment;
|
73 |
import com.spice.profitmandi.dao.entity.transaction.HdfcPayment;
|
| 73 |
import com.spice.profitmandi.dao.entity.transaction.LineItem;
|
74 |
import com.spice.profitmandi.dao.entity.transaction.LineItem;
|
| 74 |
import com.spice.profitmandi.dao.entity.transaction.LineItemImei;
|
75 |
import com.spice.profitmandi.dao.entity.transaction.LineItemImei;
|
| Line 129... |
Line 130... |
| 129 |
import com.spice.profitmandi.dao.repository.user.UserRepository;
|
130 |
import com.spice.profitmandi.dao.repository.user.UserRepository;
|
| 130 |
import com.spice.profitmandi.dao.repository.warehouse.WarehouseInventoryItemRepository;
|
131 |
import com.spice.profitmandi.dao.repository.warehouse.WarehouseInventoryItemRepository;
|
| 131 |
import com.spice.profitmandi.dao.repository.warehouse.WarehouseScanRepository;
|
132 |
import com.spice.profitmandi.dao.repository.warehouse.WarehouseScanRepository;
|
| 132 |
import com.spice.profitmandi.service.inventory.InventoryService;
|
133 |
import com.spice.profitmandi.service.inventory.InventoryService;
|
| 133 |
import com.spice.profitmandi.service.inventory.PurchaseService;
|
134 |
import com.spice.profitmandi.service.inventory.PurchaseService;
|
| - |
|
135 |
import com.spice.profitmandi.service.inventory.SaholicInventoryService;
|
| 134 |
import com.spice.profitmandi.service.offers.OfferService;
|
136 |
import com.spice.profitmandi.service.offers.OfferService;
|
| 135 |
import com.spice.profitmandi.service.offers.PartnerCriteria;
|
137 |
import com.spice.profitmandi.service.offers.PartnerCriteria;
|
| 136 |
import com.spice.profitmandi.service.order.OrderService;
|
138 |
import com.spice.profitmandi.service.order.OrderService;
|
| 137 |
import com.spice.profitmandi.service.pricing.PriceDropService;
|
139 |
import com.spice.profitmandi.service.pricing.PriceDropService;
|
| 138 |
import com.spice.profitmandi.service.scheme.SchemeService;
|
140 |
import com.spice.profitmandi.service.scheme.SchemeService;
|
| Line 193... |
Line 195... |
| 193 |
|
195 |
|
| 194 |
@Autowired
|
196 |
@Autowired
|
| 195 |
private PrebookingOrderRepository prebookingOrderRepository;
|
197 |
private PrebookingOrderRepository prebookingOrderRepository;
|
| 196 |
|
198 |
|
| 197 |
@Autowired
|
199 |
@Autowired
|
| 198 |
private SaholicReservationSnapshotRepository saholicReservationInventorySnapshotRepository;
|
- |
|
| 199 |
|
- |
|
| 200 |
@Autowired
|
- |
|
| 201 |
private PartnerTargetRepository partnerTargetRepository;
|
200 |
private PartnerTargetRepository partnerTargetRepository;
|
| 202 |
|
201 |
|
| 203 |
@Autowired
|
202 |
@Autowired
|
| 204 |
private SellerWarehouseRepository sellerWarehouseRepository;
|
203 |
private SellerWarehouseRepository sellerWarehouseRepository;
|
| 205 |
|
204 |
|
| Line 1382... |
Line 1381... |
| 1382 |
offer.setItemCriteria(gson.toJson(itemCriteria));
|
1381 |
offer.setItemCriteria(gson.toJson(itemCriteria));
|
| 1383 |
}
|
1382 |
}
|
| 1384 |
|
1383 |
|
| 1385 |
}
|
1384 |
}
|
| 1386 |
}
|
1385 |
}
|
| - |
|
1386 |
|
| - |
|
1387 |
@Autowired
|
| - |
|
1388 |
SaholicReservationSnapshotRepository saholicReservationSnapshotRepository;
|
| - |
|
1389 |
|
| - |
|
1390 |
|
| - |
|
1391 |
@Autowired
|
| - |
|
1392 |
SaholicInventoryService saholicInventoryService;
|
| - |
|
1393 |
|
| - |
|
1394 |
|
| - |
|
1395 |
public void fixReservations() throws Exception {
|
| - |
|
1396 |
//Clear all Reservations
|
| - |
|
1397 |
saholicInventorySnapshotRepository.selectAll().stream().forEach(x->x.setReserved(0));
|
| - |
|
1398 |
saholicReservationSnapshotRepository.selectAll().forEach(x->saholicReservationSnapshotRepository.delete(x));
|
| - |
|
1399 |
List<Order> orders = orderRepository.selectAllOrderDatesBetweenByStatus(
|
| - |
|
1400 |
LocalDate.now().minusDays(40).atStartOfDay(), LocalDateTime.now(),
|
| - |
|
1401 |
OrderStatus.SUBMITTED_FOR_PROCESSING);
|
| - |
|
1402 |
for(Order order : orders) {
|
| - |
|
1403 |
SaholicReservationSnapshot saholicReservationSnapshot = saholicReservationSnapshotRepository.selectByOrderId(order.getId());
|
| - |
|
1404 |
if(saholicReservationSnapshot==null) {
|
| - |
|
1405 |
saholicInventoryService.addReservationCount(order.getLineItem().getItemId(), order.getFulfilmentWarehouseId(), order.getLineItem().getQuantity(), order.getId());
|
| - |
|
1406 |
}
|
| - |
|
1407 |
}
|
| - |
|
1408 |
}
|
| 1387 |
|
1409 |
|
| 1388 |
public void fixOrders() throws Exception {
|
1410 |
public void fixOrders() throws Exception {
|
| 1389 |
List<Order> orders = orderRepository.selectAllOrderDatesBetweenByStatus(LocalDate.now().minusDays(10).atStartOfDay(),
|
1411 |
List<Order> orders = orderRepository.selectAllOrderDatesBetweenByStatus(
|
| - |
|
1412 |
LocalDate.now().minusDays(10).atStartOfDay(), LocalDateTime.now(),
|
| 1390 |
LocalDateTime.now(), OrderStatus.SUBMITTED_FOR_PROCESSING);
|
1413 |
OrderStatus.SUBMITTED_FOR_PROCESSING);
|
| 1391 |
orders = orders.stream().filter(x -> x.getCreateTimestamp().isAfter(LocalDateTime.of(2021, 7, 21, 0, 0, 0)))
|
1414 |
orders = orders.stream().filter(x -> x.getCreateTimestamp().isAfter(LocalDateTime.of(2021, 7, 21, 0, 0, 0)))
|
| 1392 |
.collect(Collectors.toList());
|
1415 |
.collect(Collectors.toList());
|
| 1393 |
for (Order order : orders) {
|
1416 |
for (Order order : orders) {
|
| 1394 |
|
1417 |
|
| 1395 |
LineItem lineItem =
|
- |
|
| 1396 |
lineItemRepository.selectById(order.getLineItem().getId()); if
|
1418 |
LineItem lineItem = lineItemRepository.selectById(order.getLineItem().getId());
|
| 1397 |
(order.getOrderType() == null) { order.setProductCondition(0);
|
1419 |
if (order.getOrderType() == null) {
|
| - |
|
1420 |
order.setProductCondition(0);
|
| - |
|
1421 |
order.setOrderType(0);
|
| 1398 |
order.setOrderType(0); int itemId = order.getLineItem().getItemId(); int
|
1422 |
int itemId = order.getLineItem().getItemId();
|
| 1399 |
fulfillmentWarehouseId = order.getFulfilmentWarehouseId();
|
1423 |
int fulfillmentWarehouseId = order.getFulfilmentWarehouseId();
|
| 1400 |
System.out.println("Item id " + itemId); Item item =
|
1424 |
System.out.println("Item id " + itemId);
|
| 1401 |
itemRepository.selectById(itemId);
|
1425 |
Item item = itemRepository.selectById(itemId);
|
| 1402 |
|
1426 |
|
| 1403 |
VendorItemPricing vendorItemPricing =
|
1427 |
VendorItemPricing vendorItemPricing = vendorItemPricingRepository.selectByItemIdAndVendorId(itemId,
|
| 1404 |
vendorItemPricingRepository.selectByItemIdAndVendorId(itemId,
|
1428 |
fulfillmentWarehouseId);
|
| 1405 |
fulfillmentWarehouseId); if (vendorItemPricing == null) { vendorItemPricing =
|
1429 |
if (vendorItemPricing == null) {
|
| 1406 |
vendorItemPricingRepository.selectAll(itemId).get(0); }
|
1430 |
vendorItemPricing = vendorItemPricingRepository.selectAll(itemId).get(0);
|
| - |
|
1431 |
}
|
| 1407 |
System.out.println("vendorItemPricing " + vendorItemPricing);
|
1432 |
System.out.println("vendorItemPricing " + vendorItemPricing);
|
| 1408 |
lineItem.setProductGoup(item.getProductGroup());
|
1433 |
lineItem.setProductGoup(item.getProductGroup());
|
| 1409 |
lineItem.setColor(item.getColor());
|
1434 |
lineItem.setColor(item.getColor());
|
| 1410 |
lineItem.setNlc(vendorItemPricing.getNlc());
|
1435 |
lineItem.setNlc(vendorItemPricing.getNlc());
|
| 1411 |
lineItem.setTransferPrice(vendorItemPricing.getTp());
|
1436 |
lineItem.setTransferPrice(vendorItemPricing.getTp());
|
| - |
|
1437 |
lineItem.setLogisticsCost(0f);
|
| 1412 |
lineItem.setLogisticsCost(0f); lineItem.setCodCollectionCharges(0f);
|
1438 |
lineItem.setCodCollectionCharges(0f);
|
| 1413 |
|
1439 |
|
| 1414 |
}
|
- |
|
| 1415 |
|
1440 |
}
|
| 1416 |
|
1441 |
|
| 1417 |
int warehouseTo = fofoStoreRepository.selectByRetailerId(order.getRetailerId()).getWarehouseId();
|
1442 |
int warehouseTo = fofoStoreRepository.selectByRetailerId(order.getRetailerId()).getWarehouseId();
|
| 1418 |
int itemId = order.getLineItem().getItemId();
|
1443 |
int itemId = order.getLineItem().getItemId();
|
| 1419 |
Warehouse warehouse = transactionService.getFulfilmentWarehouseMap(Arrays.asList(itemId), warehouseTo).get(itemId);
|
1444 |
Warehouse warehouse = transactionService.getFulfilmentWarehouseMap(Arrays.asList(itemId), warehouseTo)
|
| - |
|
1445 |
.get(itemId);
|
| - |
|
1446 |
LOGGER.info(
|
| 1420 |
LOGGER.info("Order Id - {}, WarehouseTo - {}, Item Id - {}, Warehouse From - {}, Fulfilment Warehouse Id - {}",
|
1447 |
"Order Id - {}, WarehouseTo - {}, Item Id - {}, Warehouse From - {}, Fulfilment Warehouse Id - {}",
|
| 1421 |
order.getId(), warehouseTo, itemId, warehouse.getBillingWarehouseId(), warehouse.getId());
|
1448 |
order.getId(), warehouseTo, itemId, warehouse.getBillingWarehouseId(), warehouse.getId());
|
| 1422 |
order.setWarehouseId(warehouse.getBillingWarehouseId());
|
1449 |
order.setWarehouseId(warehouse.getBillingWarehouseId());
|
| 1423 |
order.setFulfilmentWarehouseId(warehouse.getId());
|
1450 |
order.setFulfilmentWarehouseId(warehouse.getId());
|
| 1424 |
|
1451 |
|
| 1425 |
}
|
1452 |
}
|