Subversion Repositories SmartDukaan

Rev

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

Rev 34516 Rev 34568
Line 1416... Line 1416...
1416
            }
1416
            }
1417
        }
1417
        }
1418
        return "schemes";
1418
        return "schemes";
1419
    }
1419
    }
1420
 
1420
 
-
 
1421
    @RequestMapping(value = "/activeSchemeByIds", method = RequestMethod.PUT)
-
 
1422
    public String activeSchemeByIds(@RequestParam(name = ProfitMandiConstants.SCHEME_ID) String schemeIds, @RequestParam(name = "offset", defaultValue = "0") int offset, @RequestParam(name = "limit", defaultValue = "10") int limit, Model model) throws ProfitMandiBusinessException {
-
 
1423
        List<Integer> ids = Arrays.stream(schemeIds.split(",")).map(String::trim).filter(s -> !s.isEmpty()).map(Integer::parseInt).collect(Collectors.toList());
-
 
1424
        List<Scheme> schemes = schemeRepository.selectBySchemeIds(ids);
-
 
1425
        schemeService.activeSchemeByIds(schemes);
-
 
1426
        List<Scheme> allSchemes = schemeRepository.selectAll(offset, limit);
-
 
1427
        for (Scheme scheme : allSchemes) {
-
 
1428
            if (scheme.getAmountType().equals(AmountType.PERCENTAGE)) {
-
 
1429
                scheme.setAmountModel(scheme.getAmount() + "%");
-
 
1430
            } else {
-
 
1431
                scheme.setAmountModel(scheme.getAmount() + "");
-
 
1432
            }
-
 
1433
        }
-
 
1434
        return "schemes";
-
 
1435
    }
-
 
1436
 
1421
    @RequestMapping(value = "/expireSchemeById", method = RequestMethod.PUT)
1437
    @RequestMapping(value = "/expireSchemeById", method = RequestMethod.PUT)
1422
    public String expireSchemeById(HttpServletRequest request,
1438
    public String expireSchemeById(HttpServletRequest request,
1423
                                   @RequestParam(name = ProfitMandiConstants.SCHEME_ID) int schemeId,
1439
                                   @RequestParam(name = ProfitMandiConstants.SCHEME_ID) int schemeId,
1424
                                   @RequestParam(name = ProfitMandiConstants.EXPIRE_TIMESTAMP) LocalDateTime expiryTimestamp, Model model)
1440
                                   @RequestParam(name = ProfitMandiConstants.EXPIRE_TIMESTAMP) LocalDateTime expiryTimestamp, Model model)
1425
            throws ProfitMandiBusinessException {
1441
            throws ProfitMandiBusinessException {