Subversion Repositories SmartDukaan

Rev

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

Rev 32510 Rev 32532
Line 272... Line 272...
272
    private void sendWhatsapp(Offer offer, List<Integer> fofoIds, String imageUrl) throws Exception {
272
    private void sendWhatsapp(Offer offer, List<Integer> fofoIds, String imageUrl) throws Exception {
273
        if (fofoIds == null) {
273
        if (fofoIds == null) {
274
            fofoIds = fofoStoreRepository.selectActiveStores().stream().map(x -> x.getId()).collect(Collectors.toList());
274
            fofoIds = fofoStoreRepository.selectActiveStores().stream().map(x -> x.getId()).collect(Collectors.toList());
275
        }
275
        }
276
        final List<Integer> finalFofoIds = fofoIds;
276
        final List<Integer> finalFofoIds = fofoIds;
277
        List<String> mobileNumbers = retailerService.getAllFofoRetailers().entrySet().stream().filter(x -> finalFofoIds.contains(x.getKey())).map(x -> x.getValue().getMobileNumber()).collect(Collectors.toList());
277
        //List<String> mobileNumbers = retailerService.getAllFofoRetailers().entrySet().stream().filter(x -> finalFofoIds.contains(x.getKey())).map(x -> x.getValue().getMobileNumber()).collect(Collectors.toList());
-
 
278
        List<String> mobileNumbers = new ArrayList<>();
-
 
279
        mobileNumbers.add("9911565032");
278
        String message = "%s\n" +
280
        String message = "%s\n" +
279
                "On %s of select models\n" +
281
                "On %s of select models\n" +
280
                "From %s to %s\n" +
282
                "From %s to %s\n" +
281
                "\n" +
283
                "\n" +
282
                "Happy Selling\n" +
284
                "Happy Selling\n" +
283
                "Team Smartdukaan";
285
                "Team Smartdukaan";
284
        //TV's mobile
286
        //TV's mobile
285
        mobileNumbers.add("9911565032");
-
 
286
        for (String mobileNumber : mobileNumbers) {
287
        for (String mobileNumber : mobileNumbers) {
287
            notificationService.sendWhatsappMediaMessage(String.format(message, offer.getName(), offer.getSchemeType().toString(), FormattingUtils.formatDate(offer.getStartDate()), FormattingUtils.formatDate(offer.getEndDate())), mobileNumber, imageUrl, "offer-" + offer.getId() + ".png");
288
            notificationService.sendWhatsappMediaMessage(String.format(message, offer.getName(), offer.getSchemeType().toString(), FormattingUtils.formatDate(offer.getStartDate()), FormattingUtils.formatDate(offer.getEndDate())), mobileNumber, imageUrl, "offer-" + offer.getId() + ".png");
288
        }
289
        }
289
    }
290
    }
290
 
291