Subversion Repositories SmartDukaan

Rev

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

Rev 34939 Rev 34941
Line 1500... Line 1500...
1500
        for(Integer fofoId :fofoIds){
1500
        for(Integer fofoId :fofoIds){
1501
            smartCartSuggestionRepository.deleteByFofoId(fofoId);
1501
            smartCartSuggestionRepository.deleteByFofoId(fofoId);
1502
            List<SoldAllCatalogitemQtyByPartnerModel> soldAllCatalogitemQtyByPartnerModels = smartCartService.getAllSoldCatalogItemByPartner(fofoId,fortyFiveAgoDate,todayDate);
1502
            List<SoldAllCatalogitemQtyByPartnerModel> soldAllCatalogitemQtyByPartnerModels = smartCartService.getAllSoldCatalogItemByPartner(fofoId,fortyFiveAgoDate,todayDate);
1503
            for(SoldAllCatalogitemQtyByPartnerModel soldAllCatalogitemQtyByPartnerModel : soldAllCatalogitemQtyByPartnerModels){
1503
            for(SoldAllCatalogitemQtyByPartnerModel soldAllCatalogitemQtyByPartnerModel : soldAllCatalogitemQtyByPartnerModels){
1504
               SmartCartSuggestion smartCartSuggestion = new SmartCartSuggestion();
1504
               SmartCartSuggestion smartCartSuggestion = new SmartCartSuggestion();
-
 
1505
 
-
 
1506
                // weekly average = total sold qty / 6 weeks
-
 
1507
                long avgWeeklyQty = Math.round((float) soldAllCatalogitemQtyByPartnerModel.getSoldQty() / 6);
-
 
1508
 
-
 
1509
                // ensure minimum 2
-
 
1510
                long suggestedQty = Math.max(1, avgWeeklyQty);
-
 
1511
 
1505
               smartCartSuggestion.setCatalogId(soldAllCatalogitemQtyByPartnerModel.getCatalogId());
1512
               smartCartSuggestion.setCatalogId(soldAllCatalogitemQtyByPartnerModel.getCatalogId());
1506
               smartCartSuggestion.setFofoId(fofoId);
1513
               smartCartSuggestion.setFofoId(fofoId);
1507
               smartCartSuggestion.setSoldQty(soldAllCatalogitemQtyByPartnerModel.getSoldQty());
1514
               smartCartSuggestion.setSoldQty(soldAllCatalogitemQtyByPartnerModel.getSoldQty());
-
 
1515
               smartCartSuggestion.setSuggestedQty(suggestedQty);
1508
               smartCartSuggestion.setCreationDate(LocalDate.now());
1516
               smartCartSuggestion.setCreationDate(LocalDate.now());
1509
               smartCartSuggestionRepository.persist(smartCartSuggestion);
1517
               smartCartSuggestionRepository.persist(smartCartSuggestion);
1510
            }
1518
            }
1511
        }
1519
        }
1512
 
1520