Subversion Repositories SmartDukaan

Rev

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

Rev 34441 Rev 34527
Line 1... Line 1...
1
package com.spice.profitmandi.web.controller;
1
package com.spice.profitmandi.web.controller;
2
 
2
 
3
import com.spice.profitmandi.common.enumuration.MessageType;
3
import com.spice.profitmandi.common.enumuration.MessageType;
4
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
4
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
5
import com.spice.profitmandi.common.model.CustomRetailer;
5
import com.spice.profitmandi.common.model.CustomRetailer;
-
 
6
import com.spice.profitmandi.common.model.HdfcPaymentModel;
6
import com.spice.profitmandi.common.model.ProfitMandiConstants;
7
import com.spice.profitmandi.common.model.ProfitMandiConstants;
7
import com.spice.profitmandi.common.model.UnsettledPaymentModel;
8
import com.spice.profitmandi.common.model.UnsettledPaymentModel;
8
import com.spice.profitmandi.common.util.*;
9
import com.spice.profitmandi.common.util.*;
9
import com.spice.profitmandi.dao.entity.dtr.CreditAccount;
10
import com.spice.profitmandi.dao.entity.dtr.CreditAccount;
10
import com.spice.profitmandi.dao.entity.transaction.*;
11
import com.spice.profitmandi.dao.entity.transaction.*;
Line 1191... Line 1192...
1191
        model.addAttribute("customRetailers", customRetailers);
1192
        model.addAttribute("customRetailers", customRetailers);
1192
        return "partner-credit-detail-row";
1193
        return "partner-credit-detail-row";
1193
    }
1194
    }
1194
 
1195
 
1195
    @RequestMapping(value = "/downloadAddWalletRequestReport", method = RequestMethod.GET)
1196
    @RequestMapping(value = "/downloadAddWalletRequestReport", method = RequestMethod.GET)
1196
    public ResponseEntity<?> addWalletRequestPendingReport(@RequestParam LocalDate startDate, @RequestParam LocalDate endDate,@RequestParam AddWalletRequestStatus status, Model model) throws Exception {
1197
    public ResponseEntity<?> addWalletRequestPendingReport(@RequestParam LocalDate startDate, @RequestParam LocalDate endDate, @RequestParam AddWalletRequestStatus status, Model model) throws Exception {
1197
        if(endDate==null){
1198
        if (endDate == null) {
1198
            endDate=LocalDate.now();
1199
            endDate = LocalDate.now();
1199
        }
1200
        }
1200
        LocalDateTime form = startDate.atStartOfDay();
1201
        LocalDateTime form = startDate.atStartOfDay();
1201
        LocalDateTime to = endDate.atStartOfDay().plusDays(1);
1202
        LocalDateTime to = endDate.atStartOfDay().plusDays(1);
1202
        return walletService.createAddWalletRequestReport(form, to, status);
1203
        return walletService.createAddWalletRequestReport(form, to, status);
1203
    }
1204
    }
1204
 
1205
 
-
 
1206
    @GetMapping(value = "/getHdfcPaymentsReport")
-
 
1207
    public String upiPaymentReport(HttpServletRequest request, @RequestParam(required = false) LocalDate startDate, @RequestParam(required = false) LocalDate endDate,@RequestParam(defaultValue = "OTH") String transferMode, Model model) throws Exception {
-
 
1208
 
-
 
1209
        if (startDate == null) {
-
 
1210
            startDate = LocalDate.now().minusDays(7);
-
 
1211
        }
-
 
1212
        if (endDate == null) {
-
 
1213
            endDate = LocalDate.now();
-
 
1214
        }
-
 
1215
        LocalDateTime form = startDate.atStartOfDay();
-
 
1216
        LocalDateTime to = endDate.atStartOfDay().plusDays(1);
-
 
1217
        List<HdfcPayment> hdfcPayments = hdfcPaymentRepository.selectAllByTransferModeAndDataRange(transferMode, form, to);
-
 
1218
        Map<Integer, CustomRetailer> allFofoRetailers = retailerService.getAllFofoRetailers();
-
 
1219
        List<HdfcPaymentModel> hdfcPaymentModelList = new ArrayList<>();
-
 
1220
        if (hdfcPayments != null && hdfcPayments.size() > 0) {
-
 
1221
            for (HdfcPayment upiPayment : hdfcPayments) {
-
 
1222
                HdfcPaymentModel hdfcPaymentModel = new HdfcPaymentModel();
-
 
1223
                // remove prifix to get fofoId = "nwspic" from virtual account "nwspicFOFOID" eg "nwspic175140063" to "175140063"
-
 
1224
                String partnerIdString = upiPayment.getVirtualAccount().substring(6);
-
 
1225
                CustomRetailer customRetailer = allFofoRetailers.get(Integer.parseInt(partnerIdString));
-
 
1226
                hdfcPaymentModel.setAmount(upiPayment.getAmount());
-
 
1227
                hdfcPaymentModel.setName(customRetailer.getBusinessName() + "(" + customRetailer.getCode() + ")");
-
 
1228
                hdfcPaymentModel.setUtr(upiPayment.getUtr());
-
 
1229
                hdfcPaymentModel.setCreateTimestamp(upiPayment.getCreateTimestamp());
-
 
1230
                hdfcPaymentModel.setCreditTimestamp(upiPayment.getCreditTimestamp());
-
 
1231
                hdfcPaymentModel.setTransactionId(upiPayment.getTransactionId());
-
 
1232
                hdfcPaymentModel.setTransferMode(upiPayment.getTransferMode());
-
 
1233
                hdfcPaymentModelList.add(hdfcPaymentModel);
-
 
1234
            }
-
 
1235
        }
-
 
1236
 
-
 
1237
        List<String> transferModeList = Arrays.asList("OTH","FUND TRANS","IMPS","NEFT","RTGS");
-
 
1238
        model.addAttribute("hdfcPaymentModels", hdfcPaymentModelList);
-
 
1239
        model.addAttribute("startDate", startDate);
-
 
1240
        model.addAttribute("endDate", endDate);
-
 
1241
        model.addAttribute("mode", transferMode);
-
 
1242
        model.addAttribute("transferModeList", transferModeList);
-
 
1243
        return "upi-payments-report-panel";
-
 
1244
    }
-
 
1245
 
1205
 
1246
 
1206
}
1247
}