Subversion Repositories SmartDukaan

Rev

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

Rev 32927 Rev 32942
Line 234... Line 234...
234
        return "response";
234
        return "response";
235
 
235
 
236
    }
236
    }
237
 
237
 
238
    private void addVendorPricingIfMissing(int itemId, int vendorId) throws ProfitMandiBusinessException {
238
    private void addVendorPricingIfMissing(int itemId, int vendorId) throws ProfitMandiBusinessException {
-
 
239
        Supplier supplier = supplierRepository.selectById(vendorId);
239
        Item item = itemRepository.selectById(itemId);
240
        Item item = itemRepository.selectById(itemId);
240
        int vendorWithPricing = 0;
241
        int vendorWithPricing = 0;
241
        if (vendorId == 406 || vendorId == 419) {
242
        if (supplier.isInternal() && item.getBrand().equals("Samsung")) {
242
            VendorPriceCircularModel vendorPriceCircularModel = vendorCatalogPricingLogRepository.getVendorPriceOnDate(vendorId, item.getCatalogItemId(), LocalDate.now());
243
            VendorPriceCircularModel vendorPriceCircularModel = vendorCatalogPricingLogRepository.getVendorPriceOnDate(vendorId, item.getCatalogItemId(), LocalDate.now());
243
            LOGGER.info("VendorPriceCircularModel - {}", vendorPriceCircularModel);
244
            LOGGER.info("VendorPriceCircularModel - {}", vendorPriceCircularModel);
244
            if (vendorPriceCircularModel == null) {
245
            if (vendorPriceCircularModel == null) {
245
 
-
 
246
                if (item.getBrand().equals("Oppo")) {
246
                if (item.getBrand().equals("Samsung")) {
247
                    //RS Distributions
-
 
248
                    vendorWithPricing = 438;
-
 
249
                } else if (item.getBrand().equals("Vivo")) {
-
 
250
                    //Nexg
247
                    //BSB
251
                    vendorWithPricing = 393;
-
 
252
                } else {
-
 
253
                    //NSSPL Delhi
-
 
254
                    vendorWithPricing = 325;
248
                    vendorWithPricing = 334;
255
                }
249
                }
256
                VendorPriceCircularModel existingPriceCircular = vendorCatalogPricingLogRepository.getVendorPriceOnDate(vendorWithPricing, item.getCatalogItemId(), LocalDate.now());
250
                VendorPriceCircularModel existingPriceCircular = vendorCatalogPricingLogRepository.getVendorPriceOnDate(vendorWithPricing, item.getCatalogItemId(), LocalDate.now());
257
                LOGGER.info("Existing price circular - {}", existingPriceCircular);
251
                LOGGER.info("Existing price circular - {}", existingPriceCircular);
258
                if (existingPriceCircular == null) {
252
                if (existingPriceCircular == null) {
259
                    throw new ProfitMandiBusinessException("Pricing missing for vendor - " + vendorId, "Pricing missing for vendor - " + vendorId, "Pricing missing for vendor - " + vendorId);
253
                    throw new ProfitMandiBusinessException("Pricing missing for vendor - " + vendorId, "Pricing missing for vendor - " + vendorId, "Pricing missing for vendor - " + vendorId);
Line 288... Line 282...
288
        try {
282
        try {
289
            itemId = Integer.parseInt(query1);
283
            itemId = Integer.parseInt(query1);
290
            addVendorPricingIfMissing(itemId, vendorId);
284
            addVendorPricingIfMissing(itemId, vendorId);
291
        } catch (NumberFormatException e) {
285
        } catch (NumberFormatException e) {
292
            LOGGER.info("Ignore number format exception");
286
            LOGGER.info("Ignore number format exception");
293
           // e.printStackTrace();
287
            // e.printStackTrace();
294
        }
288
        }
295
        LOGGER.info("Vendor Id - {}", vendorId);
289
        LOGGER.info("Vendor Id - {}", vendorId);
296
        List<ItemDescriptionModel> partnersItemDescription = warehouseService.getAllPartnerItemStringDescription(vendorId).parallelStream().filter(x -> x.getItemDescription().toLowerCase().matches(".*?" + query1 + ".*?")).collect(Collectors.toList());
290
        List<ItemDescriptionModel> partnersItemDescription = warehouseService.getAllPartnerItemStringDescription(vendorId).parallelStream().filter(x -> x.getItemDescription().toLowerCase().matches(".*?" + query1 + ".*?")).collect(Collectors.toList());
297
        LOGGER.info("partnersItemDescription" + partnersItemDescription);
291
        LOGGER.info("partnersItemDescription" + partnersItemDescription);
298
 
292