| Line 65... |
Line 65... |
| 65 |
import java.text.MessageFormat;
|
65 |
import java.text.MessageFormat;
|
| 66 |
import java.time.*;
|
66 |
import java.time.*;
|
| 67 |
import java.util.*;
|
67 |
import java.util.*;
|
| 68 |
import java.util.stream.Collectors;
|
68 |
import java.util.stream.Collectors;
|
| 69 |
|
69 |
|
| - |
|
70 |
import static com.spice.profitmandi.dao.enumuration.transaction.AddWalletRequestStatus.approved;
|
| - |
|
71 |
|
| 70 |
@Controller
|
72 |
@Controller
|
| 71 |
@Transactional(rollbackOn = Throwable.class)
|
73 |
@Transactional(rollbackOn = Throwable.class)
|
| 72 |
public class WalletController {
|
74 |
public class WalletController {
|
| 73 |
|
75 |
|
| 74 |
private static final int IDX_PERIOD = 1;
|
76 |
private static final int IDX_PERIOD = 1;
|
| Line 326... |
Line 328... |
| 326 |
|
328 |
|
| 327 |
return "add-wallet-request-paginated";
|
329 |
return "add-wallet-request-paginated";
|
| 328 |
}
|
330 |
}
|
| 329 |
|
331 |
|
| 330 |
@RequestMapping(value = "/getAddWalletApproved", method = RequestMethod.GET)
|
332 |
@RequestMapping(value = "/getAddWalletApproved", method = RequestMethod.GET)
|
| 331 |
public String getAddwalletRequestApproved(HttpServletRequest request, @RequestParam(name = "offset", defaultValue = "0") int offset, @RequestParam(name = "limit", defaultValue = "10") int limit, Model model) throws ProfitMandiBusinessException {
|
333 |
public String walletAddnAccept(HttpServletRequest request, Model model) throws Exception {
|
| - |
|
334 |
|
| 332 |
List<AddWalletRequest> walletRequest = null;
|
335 |
return "add-wallet-req";
|
| - |
|
336 |
}
|
| 333 |
|
337 |
|
| - |
|
338 |
@RequestMapping(value = "/getAddWalletApprovedByDate", method = RequestMethod.GET)
|
| - |
|
339 |
public String getAddwalletRequestApproved(HttpServletRequest request, @RequestParam(name = "offset", defaultValue = "0") int offset, @RequestParam(name = "limit", defaultValue = "10") int limit, @RequestParam(name = "startDate") LocalDateTime startDate,
|
| - |
|
340 |
@RequestParam(name = "endDate") LocalDateTime endDate, Model model) throws ProfitMandiBusinessException {
|
| - |
|
341 |
LOGGER.info("requested startDate=[{}], EndDate = [{}]", startDate, endDate);
|
| - |
|
342 |
List<AddWalletRequest> walletRequest = null;
|
| 334 |
long size = 0;
|
343 |
long size = 0;
|
| 335 |
walletRequest = addWalletRequestRepository.selectAllByStatus(offset, limit, AddWalletRequestStatus.approved);
|
344 |
walletRequest = addWalletRequestRepository.selectAllRetailerIdByDateAndStatus(startDate, endDate, AddWalletRequestStatus.approved);
|
| 336 |
size = addWalletRequestRepository.selectCountByStatus(AddWalletRequestStatus.approved);
|
345 |
// walletRequest = addWalletRequestRepository.selectAllByStatus(offset, limit, approved);
|
| 337 |
LOGGER.info("walletRequest" + walletRequest);
|
346 |
size = addWalletRequestRepository.selectCountByStatus(approved);
|
| 338 |
if (!walletRequest.isEmpty()) {
|
347 |
if (!walletRequest.isEmpty()) {
|
| 339 |
List<Integer> fofoIds = this.getFofoIdsFromWalletRequest(walletRequest);
|
348 |
List<Integer> fofoIds = this.getFofoIdsFromWalletRequest(walletRequest);
|
| 340 |
Map<Integer, CustomRetailer> customRetailerMap = retailerService.getAllFofoRetailers();
|
349 |
Map<Integer, CustomRetailer> customRetailerMap = retailerService.getAllFofoRetailers();
|
| 341 |
|
350 |
|
| 342 |
Map<Integer, CustomRetailer> fofoIdsAndRetailerName = fofoIds.stream().map(x -> customRetailerMap.get(x)).filter(x -> x != null).collect(Collectors.toList()).stream().collect(Collectors.toMap(x -> x.getPartnerId(), x -> x));
|
351 |
Map<Integer, CustomRetailer> fofoIdsAndRetailerName = fofoIds.stream().map(x -> customRetailerMap.get(x)).filter(x -> x != null).collect(Collectors.toList()).stream().collect(Collectors.toMap(x -> x.getPartnerId(), x -> x));
|
| Line 356... |
Line 365... |
| 356 |
|
365 |
|
| 357 |
model.addAttribute("walletRequest", walletRequest);
|
366 |
model.addAttribute("walletRequest", walletRequest);
|
| 358 |
model.addAttribute("size", size);
|
367 |
model.addAttribute("size", size);
|
| 359 |
|
368 |
|
| 360 |
}
|
369 |
}
|
| 361 |
return "add-wallet-request";
|
370 |
return "add-wallet-request-paginated";
|
| 362 |
}
|
371 |
}
|
| 363 |
|
372 |
|
| 364 |
@RequestMapping(value = "/getPaginatedWalletApproved", method = RequestMethod.GET)
|
373 |
@RequestMapping(value = "/getPaginatedWalletApproved", method = RequestMethod.GET)
|
| 365 |
public String getPaginatedWalletApproved(HttpServletRequest request, @RequestParam(name = "offset", defaultValue = "0") int offset, @RequestParam(name = "limit", defaultValue = "10") int limit, Model model) throws ProfitMandiBusinessException {
|
374 |
public String getPaginatedWalletApproved(HttpServletRequest request, @RequestParam(name = "offset", defaultValue = "0") int offset, @RequestParam(name = "limit", defaultValue = "10") int limit, @RequestParam(name = "startDate") LocalDateTime startDate,
|
| - |
|
375 |
@RequestParam(name = "endDate") LocalDateTime endDate, Model model) throws ProfitMandiBusinessException {
|
| 366 |
LOGGER.info("requested offset=[{}], limit = [{}]", offset, limit);
|
376 |
LOGGER.info("requested offset=[{}], limit = [{}]", offset, limit);
|
| 367 |
List<AddWalletRequest> walletRequest = null;
|
377 |
List<AddWalletRequest> walletRequest = null;
|
| - |
|
378 |
long size = 0;
|
| - |
|
379 |
walletRequest = addWalletRequestRepository.selectAllRetailerIdByDateAndStatus(startDate, endDate, AddWalletRequestStatus.approved);
|
| - |
|
380 |
|
| 368 |
walletRequest = addWalletRequestRepository.selectAllByStatus(offset, limit, AddWalletRequestStatus.approved);
|
381 |
// walletRequest = addWalletRequestRepository.selectAllByStatus(offset, limit, AddWalletRequestStatus.approved);
|
| 369 |
LOGGER.info("walletRequest" + walletRequest);
|
382 |
LOGGER.info("walletRequest" + walletRequest);
|
| 370 |
if (!walletRequest.isEmpty()) {
|
383 |
if (!walletRequest.isEmpty()) {
|
| 371 |
List<Integer> fofoIds = this.getFofoIdsFromWalletRequest(walletRequest);
|
384 |
List<Integer> fofoIds = this.getFofoIdsFromWalletRequest(walletRequest);
|
| 372 |
Map<Integer, CustomRetailer> customRetailerMap = retailerService.getAllFofoRetailers();
|
385 |
Map<Integer, CustomRetailer> customRetailerMap = retailerService.getAllFofoRetailers();
|
| 373 |
|
386 |
|
| Line 382... |
Line 395... |
| 382 |
}
|
395 |
}
|
| 383 |
return "add-wallet-request-paginated";
|
396 |
return "add-wallet-request-paginated";
|
| 384 |
}
|
397 |
}
|
| 385 |
|
398 |
|
| 386 |
@RequestMapping(value = "/getAddWalletRequestRejected", method = RequestMethod.GET)
|
399 |
@RequestMapping(value = "/getAddWalletRequestRejected", method = RequestMethod.GET)
|
| - |
|
400 |
public String walletAddnReject(HttpServletRequest request, Model model) throws Exception {
|
| - |
|
401 |
|
| - |
|
402 |
return "add-wallet-rejected";
|
| - |
|
403 |
}
|
| - |
|
404 |
|
| - |
|
405 |
@RequestMapping(value = "/getAddWalletRequestRejectedByDate", method = RequestMethod.GET)
|
| 387 |
public String getAddwalletRequestRejected(HttpServletRequest request, @RequestParam(name = "offset", defaultValue = "0") int offset, @RequestParam(name = "limit", defaultValue = "10") int limit, Model model) throws ProfitMandiBusinessException {
|
406 |
public String getAddwalletRequestRejected(HttpServletRequest request, @RequestParam(name = "offset", defaultValue = "0") int offset, @RequestParam(name = "limit", defaultValue = "10") int limit, @RequestParam(name = "startDate") LocalDateTime startDate,
|
| - |
|
407 |
@RequestParam(name = "endDate") LocalDateTime endDate, Model model) throws ProfitMandiBusinessException {
|
| 388 |
List<AddWalletRequest> walletRequest = null;
|
408 |
List<AddWalletRequest> walletRequest = null;
|
| 389 |
|
409 |
|
| 390 |
long size = 0;
|
410 |
long size = 0;
|
| 391 |
walletRequest = addWalletRequestRepository.selectAllByStatus(offset, limit, AddWalletRequestStatus.rejected);
|
411 |
walletRequest = addWalletRequestRepository.selectAllRetailerIdByDateAndStatus(startDate, endDate, AddWalletRequestStatus.rejected);
|
| 392 |
size = addWalletRequestRepository.selectCountByStatus(AddWalletRequestStatus.rejected);
|
412 |
size = addWalletRequestRepository.selectCountByStatus(AddWalletRequestStatus.rejected);
|
| 393 |
LOGGER.info("walletRequest" + walletRequest);
|
413 |
LOGGER.info("walletRequest" + walletRequest);
|
| 394 |
if (!walletRequest.isEmpty()) {
|
414 |
if (!walletRequest.isEmpty()) {
|
| 395 |
List<Integer> fofoIds = this.getFofoIdsFromWalletRequest(walletRequest);
|
415 |
List<Integer> fofoIds = this.getFofoIdsFromWalletRequest(walletRequest);
|
| 396 |
Map<Integer, CustomRetailer> customRetailerMap = retailerService.getAllFofoRetailers();
|
416 |
Map<Integer, CustomRetailer> customRetailerMap = retailerService.getAllFofoRetailers();
|
| Line 411... |
Line 431... |
| 411 |
} else {
|
431 |
} else {
|
| 412 |
model.addAttribute("walletRequest", walletRequest);
|
432 |
model.addAttribute("walletRequest", walletRequest);
|
| 413 |
model.addAttribute("size", size);
|
433 |
model.addAttribute("size", size);
|
| 414 |
}
|
434 |
}
|
| 415 |
|
435 |
|
| 416 |
return "add-wallet-request";
|
436 |
return "add-wallet-request-paginated";
|
| 417 |
}
|
437 |
}
|
| 418 |
|
438 |
|
| 419 |
@RequestMapping(value = "/getPaginatedWalletRequestRejected", method = RequestMethod.GET)
|
439 |
@RequestMapping(value = "/getPaginatedWalletRequestRejected", method = RequestMethod.GET)
|
| 420 |
public String getPaginatedWalletRequestRejected(HttpServletRequest request, @RequestParam(name = "offset", defaultValue = "0") int offset, @RequestParam(name = "limit", defaultValue = "10") int limit, Model model) throws ProfitMandiBusinessException {
|
440 |
public String getPaginatedWalletRequestRejected(HttpServletRequest request, @RequestParam(name = "offset", defaultValue = "0") int offset, @RequestParam(name = "limit", defaultValue = "10") int limit, @RequestParam(name = "startDate") LocalDateTime startDate,
|
| - |
|
441 |
@RequestParam(name = "endDate") LocalDateTime endDate, Model model) throws ProfitMandiBusinessException {
|
| 421 |
LOGGER.info("requested offset=[{}], limit = [{}]", offset, limit);
|
442 |
LOGGER.info("requested offset=[{}], limit = [{}]", offset, limit);
|
| 422 |
List<AddWalletRequest> walletRequest = null;
|
443 |
List<AddWalletRequest> walletRequest = null;
|
| 423 |
walletRequest = addWalletRequestRepository.selectAllByStatus(offset, limit, AddWalletRequestStatus.rejected);
|
444 |
walletRequest = addWalletRequestRepository.selectAllRetailerIdByDateAndStatus(startDate, endDate, AddWalletRequestStatus.rejected);
|
| 424 |
LOGGER.info("walletRequest" + walletRequest);
|
445 |
LOGGER.info("walletRequest" + walletRequest);
|
| 425 |
if (!walletRequest.isEmpty()) {
|
446 |
if (!walletRequest.isEmpty()) {
|
| 426 |
List<Integer> fofoIds = this.getFofoIdsFromWalletRequest(walletRequest);
|
447 |
List<Integer> fofoIds = this.getFofoIdsFromWalletRequest(walletRequest);
|
| 427 |
Map<Integer, CustomRetailer> customRetailerMap = retailerService.getAllFofoRetailers();
|
448 |
Map<Integer, CustomRetailer> customRetailerMap = retailerService.getAllFofoRetailers();
|
| 428 |
|
449 |
|
| Line 1057... |
Line 1078... |
| 1057 |
|
1078 |
|
| 1058 |
@RequestMapping(value = "/addMoney", method = RequestMethod.POST)
|
1079 |
@RequestMapping(value = "/addMoney", method = RequestMethod.POST)
|
| 1059 |
public String addMoney(HttpServletRequest request, @RequestParam float amount, @RequestParam String transactionReference, @RequestParam LocalDateTime referenceTime, @RequestParam String bankName, @RequestParam int fofoId, Model model) throws Exception {
|
1080 |
public String addMoney(HttpServletRequest request, @RequestParam float amount, @RequestParam String transactionReference, @RequestParam LocalDateTime referenceTime, @RequestParam String bankName, @RequestParam int fofoId, Model model) throws Exception {
|
| 1060 |
transactionReference = transactionReference.toUpperCase().trim();
|
1081 |
transactionReference = transactionReference.toUpperCase().trim();
|
| 1061 |
List<AddWalletRequest> addWalletRequests = addWalletRequestRepository.selectByReference(transactionReference);
|
1082 |
List<AddWalletRequest> addWalletRequests = addWalletRequestRepository.selectByReference(transactionReference);
|
| 1062 |
addWalletRequests = addWalletRequests.stream().filter(x -> Arrays.asList(AddWalletRequestStatus.approved, AddWalletRequestStatus.pending).contains(x.getStatus())).collect(Collectors.toList());
|
1083 |
addWalletRequests = addWalletRequests.stream().filter(x -> Arrays.asList(approved, AddWalletRequestStatus.pending).contains(x.getStatus())).collect(Collectors.toList());
|
| 1063 |
if (addWalletRequests.size() > 0) {
|
1084 |
if (addWalletRequests.size() > 0) {
|
| 1064 |
throw new ProfitMandiBusinessException("Transaction Reference (UTR)", transactionReference, "Already added");
|
1085 |
throw new ProfitMandiBusinessException("Transaction Reference (UTR)", transactionReference, "Already added");
|
| 1065 |
}
|
1086 |
}
|
| 1066 |
HdfcPayment hdfcPayment = hdfcPaymentRepository.selectByUtrNo(transactionReference);
|
1087 |
HdfcPayment hdfcPayment = hdfcPaymentRepository.selectByUtrNo(transactionReference);
|
| 1067 |
if (hdfcPayment != null) {
|
1088 |
if (hdfcPayment != null) {
|