| Line 30... |
Line 30... |
| 30 |
import in.shop2020.thrift.clients.InventoryClient;
|
30 |
import in.shop2020.thrift.clients.InventoryClient;
|
| 31 |
import in.shop2020.utils.GmailUtils;
|
31 |
import in.shop2020.utils.GmailUtils;
|
| 32 |
|
32 |
|
| 33 |
public class StockSalesReportFetcher {
|
33 |
public class StockSalesReportFetcher {
|
| 34 |
private static final int NUMBER_OF_DAYS_SALE = 5;
|
34 |
private static final int NUMBER_OF_DAYS_SALE = 5;
|
| 35 |
private static final String[] mailTo = {"amar.kumar@shop2020.in", "rajveer.singh@shop2020.in"};
|
35 |
private static final String[] mailTo = {"amar.kumar@shop2020.in", "rajveer.singh@shop2020.in", "chaitnaya.vats@saholic.com",
|
| - |
|
36 |
"manoj.kumar@saholic.com", "chandan.kumar@saholic.com", "khushal.bhatia@saholic.com"};
|
| 36 |
private static final String senderAccountMail = "cnc.center@shop2020.in";
|
37 |
private static final String senderAccountMail = "cnc.center@shop2020.in";
|
| 37 |
private static final String senderAccountPswd = "5h0p2o2o";
|
38 |
private static final String senderAccountPswd = "5h0p2o2o";
|
| 38 |
|
39 |
|
| 39 |
private static Logger logger = LoggerFactory.getLogger(StockSalesReportFetcher.class);
|
40 |
private static Logger logger = LoggerFactory.getLogger(StockSalesReportFetcher.class);
|
| 40 |
|
41 |
|
| Line 64... |
Line 65... |
| 64 |
|
65 |
|
| 65 |
inventoryClient = new InventoryClient().getClient();
|
66 |
inventoryClient = new InventoryClient().getClient();
|
| 66 |
List<Warehouse> ourGoodWarehouses = inventoryClient.getWarehouses(WarehouseType.OURS, InventoryType.GOOD, 0, 0, 0);
|
67 |
List<Warehouse> ourGoodWarehouses = inventoryClient.getWarehouses(WarehouseType.OURS, InventoryType.GOOD, 0, 0, 0);
|
| 67 |
Map<Long, Warehouse> ourWarehouseMap = new Hashtable<Long, Warehouse>(200);
|
68 |
Map<Long, Warehouse> ourWarehouseMap = new Hashtable<Long, Warehouse>(200);
|
| 68 |
for(Warehouse warehouse : ourGoodWarehouses) {
|
69 |
for(Warehouse warehouse : ourGoodWarehouses) {
|
| 69 |
System.out.println("Warehouse = " + warehouse.getId());
|
70 |
//System.out.println("Warehouse = " + warehouse.getId());
|
| 70 |
ourWarehouseMap.put(warehouse.getId(), warehouse);
|
71 |
ourWarehouseMap.put(warehouse.getId(), warehouse);
|
| 71 |
}
|
72 |
}
|
| 72 |
|
73 |
|
| 73 |
inventoryClient = new InventoryClient().getClient();
|
74 |
inventoryClient = new InventoryClient().getClient();
|
| 74 |
List<VendorItemPricing> vendorItemPricings = inventoryClient.getAllVendorItemPricing(0, 0);
|
75 |
List<VendorItemPricing> vendorItemPricings = inventoryClient.getAllVendorItemPricing(0, 0);
|
| Line 122... |
Line 123... |
| 122 |
StringBuilder amzn_mfnSaleHistory = new StringBuilder("");
|
123 |
StringBuilder amzn_mfnSaleHistory = new StringBuilder("");
|
| 123 |
|
124 |
|
| 124 |
ItemInventory itemInventory = inventoryMap.get(item.getId());
|
125 |
ItemInventory itemInventory = inventoryMap.get(item.getId());
|
| 125 |
Map<Long, Long> availabilityMap;
|
126 |
Map<Long, Long> availabilityMap;
|
| 126 |
if(itemInventory!= null) {
|
127 |
if(itemInventory!= null) {
|
| 127 |
System.out.println("itemId =" + item.getId());
|
128 |
//System.out.println("itemId =" + item.getId());
|
| 128 |
availabilityMap = itemInventory.getAvailability();
|
129 |
availabilityMap = itemInventory.getAvailability();
|
| 129 |
for (Long warehouseId : availabilityMap.keySet()) {
|
130 |
for (Long warehouseId : availabilityMap.keySet()) {
|
| 130 |
//if(ourGoodWarehouses.contains(warehouseId)) {
|
- |
|
| 131 |
if(ourWarehouseMap.containsKey(warehouseId)) {
|
131 |
if(ourWarehouseMap.containsKey(warehouseId)) {
|
| 132 |
long currentAvailability = availabilityMap.get(warehouseId);
|
132 |
long currentAvailability = availabilityMap.get(warehouseId);
|
| 133 |
System.out.println("itemId =" + item.getId() + " availability = "+ currentAvailability);
|
133 |
//System.out.println("itemId =" + item.getId() + " availability = "+ currentAvailability);
|
| 134 |
stockCount += currentAvailability;
|
134 |
stockCount += currentAvailability;
|
| 135 |
if(currentAvailability>0) {
|
135 |
if(currentAvailability>0) {
|
| 136 |
List<VendorItemPricing> pricingList = itemPricingMap.get(item.getId());
|
136 |
List<VendorItemPricing> pricingList = itemPricingMap.get(item.getId());
|
| 137 |
for(VendorItemPricing vendorItemPricing: pricingList) {
|
137 |
for(VendorItemPricing vendorItemPricing: pricingList) {
|
| 138 |
if(vendorItemPricing.getVendorId() == ourWarehouseMap.get(warehouseId).getVendor().getId()) {
|
138 |
if(vendorItemPricing.getVendorId() == ourWarehouseMap.get(warehouseId).getVendor().getId()) {
|