Subversion Repositories SmartDukaan

Rev

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

Rev 32223 Rev 32307
Line 1151... Line 1151...
1151
        }
1151
        }
1152
    }
1152
    }
1153
 
1153
 
1154
    public void test() throws Exception {
1154
    public void test() throws Exception {
1155
        try {
1155
        try {
-
 
1156
 
1156
            itelImeiActivationNewService.checkItelImeiActivationNew(LocalDate.now(), 15);
1157
            //itelImeiActivationNewService.checkItelImeiActivationNew(LocalDate.now(), 15);
1157
        } catch (Throwable e) {
1158
        } catch (Throwable e) {
1158
            throw new Exception(e);
1159
            throw new Exception(e);
1159
        }
1160
        }
1160
 
1161
 
1161
        //this.sendMailForSamsungRebilling();
1162
        //this.sendMailForSamsungRebilling();
Line 3195... Line 3196...
3195
        String data = "";
3196
        String data = "";
3196
        data = new String(Files.readAllBytes(Paths.get(file)));
3197
        data = new String(Files.readAllBytes(Paths.get(file)));
3197
        return data;
3198
        return data;
3198
    }
3199
    }
3199
 
3200
 
3200
    public void markDelhiveryOrderDelivered() throws ProfitMandiBusinessException, IOException {
3201
    public void markDelhiveryOrderDelivered() throws Exception {
3201
        List<Order> orders = orderRepository.selectOrderByProviderIdAndStatus(ProfitMandiConstants.DELHIVERY_PROVIDERID, OrderStatus.SHIPPED_FROM_WH);
3202
        List<Order> orders = orderRepository.selectOrderByProviderIdAndStatus(ProfitMandiConstants.DELHIVERY_PROVIDERID, OrderStatus.SHIPPED_FROM_WH);
3202
 
3203
 
3203
        if (!orders.isEmpty()) {
3204
        if (!orders.isEmpty()) {
3204
            Set<String> airwayBill = orders.stream().map(x -> x.getAirwayBillNumber()).collect(Collectors.toSet());
3205
            Set<String> airwayBill = orders.stream().map(x -> x.getAirwayBillNumber()).collect(Collectors.toSet());
3205
 
3206
 
Line 3247... Line 3248...
3247
            }
3248
            }
3248
            markOrderDelivered(airwaybillStatus);
3249
            markOrderDelivered(airwaybillStatus);
3249
        }
3250
        }
3250
    }
3251
    }
3251
 
3252
 
3252
    public void markBlueDartOrderDelivered() throws ProfitMandiBusinessException, IOException {
3253
    public void markBlueDartOrderDelivered() throws Exception {
3253
 
3254
 
3254
        String loginId = "DEL81122";
3255
        String loginId = "DEL81122";
3255
 
3256
 
3256
        String licencekey = "uhfhlg2jpmnqfhfrlsgzfr1nhu1qfvel";
3257
        String licencekey = "uhfhlg2jpmnqfhfrlsgzfr1nhu1qfvel";
3257
 
3258
 
Line 3302... Line 3303...
3302
            markOrderDelivered(airwaybillStatus);
3303
            markOrderDelivered(airwaybillStatus);
3303
        }
3304
        }
3304
 
3305
 
3305
    }
3306
    }
3306
 
3307
 
3307
    private void markOrderDelivered(Set<String> airwaybillStatus) throws ProfitMandiBusinessException, HttpHostConnectException {
3308
    private void markOrderDelivered(Set<String> airwaybillStatus) throws Exception {
3308
        if (!airwaybillStatus.isEmpty()) {
3309
        if (!airwaybillStatus.isEmpty()) {
3309
            for (String aws : airwaybillStatus) {
3310
            for (String aws : airwaybillStatus) {
3310
 
3311
 
3311
                List<Order> deliverdOrders = orderRepository.selectByAirwayBillNumber(aws);
3312
                List<Order> deliverdOrders = orderRepository.selectByAirwayBillNumber(aws);
3312
 
3313
 
Line 3717... Line 3718...
3717
        uwh.setDescription("Amount adjusted against loan");
3718
        uwh.setDescription("Amount adjusted against loan");
3718
        userWalletHistoryRepository.persist(uwh);
3719
        userWalletHistoryRepository.persist(uwh);
3719
 
3720
 
3720
    }
3721
    }
3721
 
3722
 
3722
    public void dailyLoanAlert() throws ProfitMandiBusinessException, HttpHostConnectException, UnsupportedEncodingException {
3723
    public void dailyLoanAlert() throws Exception {
3723
        List<Loan> loans = loanRepository.selectAllActiveLoan();
3724
        List<Loan> loans = loanRepository.selectAllActiveLoan();
3724
 
3725
 
3725
        Map<Integer, Double> partnerLoanAmount = new HashMap<>();
3726
        Map<Integer, Double> partnerLoanAmount = new HashMap<>();
3726
 
3727
 
3727
        if (!loans.isEmpty()) {
3728
        if (!loans.isEmpty()) {
Line 3960... Line 3961...
3960
        sb.append("</tbody></table></body></html>");
3961
        sb.append("</tbody></table></body></html>");
3961
 
3962
 
3962
        return sb.toString();
3963
        return sb.toString();
3963
    }
3964
    }
3964
 
3965
 
3965
    public void notifyLoanDueDateCross() throws ProfitMandiBusinessException, MessagingException, IOException {
3966
    public void notifyLoanDueDateCross() throws Exception {
3966
 
3967
 
3967
        List<Loan> dueDateCrossLoans = sdCreditService.getDueDateCrossLoan();
3968
        List<Loan> dueDateCrossLoans = sdCreditService.getDueDateCrossLoan();
3968
        if (!dueDateCrossLoans.isEmpty()) {
3969
        if (!dueDateCrossLoans.isEmpty()) {
3969
            this.sendDueDateCrossLoanAlert(dueDateCrossLoans);
3970
            this.sendDueDateCrossLoanAlert(dueDateCrossLoans);
3970
        }
3971
        }
3971
 
3972
 
3972
    }
3973
    }
3973
 
3974
 
3974
    private void sendDueDateCrossLoanAlert(List<Loan> dueDateCrossLoans) throws ProfitMandiBusinessException, MessagingException, IOException {
3975
    private void sendDueDateCrossLoanAlert(List<Loan> dueDateCrossLoans) throws Exception {
3975
        List<Integer> categoryIds = Arrays.asList(ProfitMandiConstants.TICKET_CATEGORY_CATEGORY, ProfitMandiConstants.TICKET_CATEGORY_RBM, ProfitMandiConstants.TICKET_CATEGORY_SALES, ProfitMandiConstants.TICKET_CATEGORY_ACCOUNTS, ProfitMandiConstants.TICKET_CATEGORY_BUSINESSINTELLIGENT);
3976
        List<Integer> categoryIds = Arrays.asList(ProfitMandiConstants.TICKET_CATEGORY_CATEGORY, ProfitMandiConstants.TICKET_CATEGORY_RBM, ProfitMandiConstants.TICKET_CATEGORY_SALES, ProfitMandiConstants.TICKET_CATEGORY_ACCOUNTS, ProfitMandiConstants.TICKET_CATEGORY_BUSINESSINTELLIGENT);
3976
 
3977
 
3977
        for (Map.Entry<String, Set<Integer>> storeGuyEntry : csService.getAuthUserPartnerIdMappingByCategoryIds(categoryIds, false).entrySet()) {
3978
        for (Map.Entry<String, Set<Integer>> storeGuyEntry : csService.getAuthUserPartnerIdMappingByCategoryIds(categoryIds, false).entrySet()) {
3978
            List<Loan> filteredRows = new ArrayList<>();
3979
            List<Loan> filteredRows = new ArrayList<>();
3979
            for (Loan loan : dueDateCrossLoans) {
3980
            for (Loan loan : dueDateCrossLoans) {
Line 4019... Line 4020...
4019
            }
4020
            }
4020
        }
4021
        }
4021
 
4022
 
4022
    }
4023
    }
4023
 
4024
 
4024
    public void alertForDueDate() throws ProfitMandiBusinessException, MessagingException, IOException {
4025
    public void alertForDueDate() throws Exception {
4025
 
4026
 
4026
        List<Loan> loans = loanRepository.selectAllActiveLoan();
4027
        List<Loan> loans = loanRepository.selectAllActiveLoan();
4027
 
4028
 
4028
        if (!loans.isEmpty()) {
4029
        if (!loans.isEmpty()) {
4029
            for (Loan loan : loans) {
4030
            for (Loan loan : loans) {
Line 4059... Line 4060...
4059
            }
4060
            }
4060
        }
4061
        }
4061
 
4062
 
4062
    }
4063
    }
4063
 
4064
 
4064
    public void userMobileNumberOptIn() throws HttpHostConnectException, ProfitMandiBusinessException {
4065
    public void userMobileNumberOptIn() throws Exception {
4065
 
4066
 
4066
        List<FofoStore> fofoStores = fofoStoreRepository.selectActiveStores();
4067
        List<FofoStore> fofoStores = fofoStoreRepository.selectActiveStores();
4067
 
4068
 
4068
        List<com.spice.profitmandi.dao.entity.user.User> users = userUserRepository.selectByIds(fofoStores.stream().map(x -> x.getId()).collect(Collectors.toList()));
4069
        List<com.spice.profitmandi.dao.entity.user.User> users = userUserRepository.selectByIds(fofoStores.stream().map(x -> x.getId()).collect(Collectors.toList()));
4069
 
4070
 
4070
        List<Address> addresses = addressRepository.selectByIds(users.stream().map(x -> x.getAddressId()).collect(Collectors.toList()));
4071
        List<Address> addresses = addressRepository.selectByIds(users.stream().map(x -> x.getAddressId()).collect(Collectors.toList()));
4071
 
4072
 
4072
        LOGGER.info("addresses" + addresses);
4073
        LOGGER.info("addresses" + addresses);
4073
 
4074
 
4074
        for (Address address : addresses) {
4075
        for (Address address : addresses) {
4075
            Map<String, String> requestheaders = new HashMap<>();
-
 
4076
            requestheaders.put("Content-Type", "application/x-www-form-urlencoded");
-
 
4077
            Map<String, String> requestParams = new HashMap<>();
-
 
4078
            requestParams.put("userid", String.valueOf(2000215976));
-
 
4079
            requestParams.put("password", "MFRd!BBL");
-
 
4080
            requestParams.put("phone_number", address.getPhoneNumber());
4076
            notificationService.optIn(address.getPhoneNumber());
4081
            requestParams.put("auth_scheme", "plain");
-
 
4082
            requestParams.put("v", "1.1");
-
 
4083
            requestParams.put("format", "json");
-
 
4084
 
-
 
4085
            requestParams.put("method", "OPT_IN");
-
 
4086
 
4077
 
4087
            requestParams.put("channel", "WHATSAPP");
-
 
4088
            String response = restClient.get("https://media.smsgupshup.com/GatewayAPI/rest", requestParams, requestheaders);
-
 
4089
            LOGGER.info("response" + response);
-
 
4090
        }
4078
        }
4091
 
4079
 
4092
    }
4080
    }
4093
 
4081
 
4094
    public void authUserMobileNumberOptIn() throws HttpHostConnectException, ProfitMandiBusinessException {
4082
    public void authUserMobileNumberOptIn() throws HttpHostConnectException, ProfitMandiBusinessException {