Subversion Repositories SmartDukaan

Rev

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

Rev 3907 Rev 3911
Line 9... Line 9...
9
import in.shop2020.catalog.dashboard.shared.VendorPricings;
9
import in.shop2020.catalog.dashboard.shared.VendorPricings;
10
import in.shop2020.config.ConfigException;
10
import in.shop2020.config.ConfigException;
11
import in.shop2020.content.ContentService;
11
import in.shop2020.content.ContentService;
12
import in.shop2020.content.ContentServiceException;
12
import in.shop2020.content.ContentServiceException;
13
import in.shop2020.model.v1.catalog.InventoryService;
13
import in.shop2020.model.v1.catalog.InventoryService;
-
 
14
import in.shop2020.model.v1.catalog.SourceItemPricing;
14
import in.shop2020.model.v1.catalog.status;
15
import in.shop2020.model.v1.catalog.status;
15
import in.shop2020.thrift.clients.CatalogClient;
16
import in.shop2020.thrift.clients.CatalogClient;
16
import in.shop2020.thrift.clients.ContentClient;
17
import in.shop2020.thrift.clients.ContentClient;
17
import in.shop2020.thrift.clients.config.ConfigClient;
18
import in.shop2020.thrift.clients.config.ConfigClient;
18
import in.shop2020.utils.CategoryManager;
19
import in.shop2020.utils.CategoryManager;
Line 602... Line 603...
602
                logger.error("Error updating item on production, returned Item Id: " + rItemId);
603
                logger.error("Error updating item on production, returned Item Id: " + rItemId);
603
                return "Error updating item prices on production";
604
                return "Error updating item prices on production";
604
            }
605
            }
605
            logger.info("Successfully updated item: " + item.getId());
606
            logger.info("Successfully updated item: " + item.getId());
606
 
607
 
607
            Map<Long, VendorPricings> vendorPricings = item.getVendorPricesMap();
-
 
608
            StringBuilder sb = new StringBuilder();
608
            StringBuilder sb = new StringBuilder();
-
 
609
            
-
 
610
            Map<Long, VendorPricings> vendorPricings = item.getVendorPricesMap();
609
            if(vendorPricings != null && !vendorPricings.isEmpty()) {
611
            if(vendorPricings != null && !vendorPricings.isEmpty()) {
610
                in.shop2020.model.v1.catalog.VendorItemPricing tVendorPricing;
612
                in.shop2020.model.v1.catalog.VendorItemPricing tVendorPricing;
611
                for(VendorPricings v : vendorPricings.values()) {
613
                for(VendorPricings v : vendorPricings.values()) {
612
                    tVendorPricing = new in.shop2020.model.v1.catalog.VendorItemPricing();
614
                    tVendorPricing = new in.shop2020.model.v1.catalog.VendorItemPricing();
613
                    tVendorPricing.setVendorId(v.getVendorId());
615
                    tVendorPricing.setVendorId(v.getVendorId());
Line 618... Line 620...
618
                    catalogClient_Prod.addVendorItemPricing(tVendorPricing);
620
                    catalogClient_Prod.addVendorItemPricing(tVendorPricing);
619
                    logger.info("VendorItemPricing updated. " + tVendorPricing.toString());
621
                    logger.info("VendorItemPricing updated. " + tVendorPricing.toString());
620
                    sb.append("[VId:" + v.getVendorId() + ",MOP=" + v.getMop() + ",TP=" + v.getTransferPrice() + ",DP=" + v.getDealerPrice() + "], ");
622
                    sb.append("[VId:" + v.getVendorId() + ",MOP=" + v.getMop() + ",TP=" + v.getTransferPrice() + ",DP=" + v.getDealerPrice() + "], ");
621
                }
623
                }
622
            }
624
            }
-
 
625
            
-
 
626
            Map<Long, SourcePricings> sourcePricings = item.getSourcePricesMap();
-
 
627
            if(sourcePricings != null && !sourcePricings.isEmpty()){
-
 
628
                in.shop2020.model.v1.catalog.SourceItemPricing tSourcePricing;
-
 
629
                for(SourcePricings s : sourcePricings.values()){
-
 
630
                    tSourcePricing = new in.shop2020.model.v1.catalog.SourceItemPricing();
-
 
631
                    tSourcePricing.setSourceId(s.getSourceId());
-
 
632
                    tSourcePricing.setItemId(item.getId());
-
 
633
                    tSourcePricing.setMrp(s.getMrp());
-
 
634
                    tSourcePricing.setSellingPrice(s.getSellingPrice());
-
 
635
                    catalogClient_Prod.addSourceItemPricing(tSourcePricing);
-
 
636
                    logger.info("SourceItemPricing updated. " + tSourcePricing.toString());
-
 
637
                    sb.append("[SId:" + s.getSourceId() + ",MRP=" + s.getMrp() + ",SP=" + s.getSellingPrice() + "], ");
-
 
638
                }
-
 
639
            }
-
 
640
            
623
            logItemDetails("Id=" + item.getId() + ",MRP=" + item.getMrp() + ",SP=" + " " + item.getSellingPrice() + sb.toString());
641
            logItemDetails("Id=" + item.getId() + ",MRP=" + item.getMrp() + ",SP=" + " " + item.getSellingPrice() + sb.toString());
624
        } catch (Exception e) {
642
        } catch (Exception e) {
625
            logger.error("Error while updating prices on production", e);
643
            logger.error("Error while updating prices on production", e);
626
            return "Error while updating all prices on production. Some of the prices may have been  updated";
644
            return "Error while updating all prices on production. Some of the prices may have been  updated";
627
        }
645
        }