Subversion Repositories SmartDukaan

Rev

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

Rev 32546 Rev 32586
Line 1043... Line 1043...
1043
    @RequestMapping(value = "/store/checkEligibilityStoreOffers", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
1043
    @RequestMapping(value = "/store/checkEligibilityStoreOffers", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
1044
    public ResponseEntity<?> checkEligibilityStoreOffers(HttpServletRequest request, @RequestParam(value = "id") int id) throws Exception {
1044
    public ResponseEntity<?> checkEligibilityStoreOffers(HttpServletRequest request, @RequestParam(value = "id") int id) throws Exception {
1045
 
1045
 
1046
        boolean eligibility = false;
1046
        boolean eligibility = false;
1047
 
1047
 
1048
        LocalDateTime startDate = LocalDateTime.of(LocalDate.now().getYear(), LocalDate.now().getMonth(), 22, 0, 0);
-
 
1049
 
1048
 
1050
        List<ScratchOffer> scratchOffers = scratchOfferRepository.selectBycCustomerIdAndDate(id, startDate.toLocalDate());
1049
        List<ScratchOffer> scratchOffers = scratchOfferRepository.selectBycCustomerIdAndDate(id,
-
 
1050
                ProfitMandiConstants.SCRATCH_OFFER_START_DATE, ProfitMandiConstants.SCRATCH_OFFER_END_DATE);
1051
 
1051
 
1052
        if (!scratchOffers.isEmpty()) {
1052
        if (!scratchOffers.isEmpty()) {
1053
            eligibility = true;
1053
            eligibility = true;
1054
 
1054
 
1055
        } else {
-
 
1056
            eligibility = false;
-
 
1057
        }
1055
        }
1058
 
-
 
1059
        return responseSender.ok(eligibility);
1056
        return responseSender.ok(eligibility);
1060
    }
1057
    }
1061
 
1058
 
1062
    @RequestMapping(value = "/store/ScratchOffers", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
1059
    @RequestMapping(value = "/store/ScratchOffers", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
1063
    public ResponseEntity<?> scratchOffers(HttpServletRequest request, @RequestParam(value = "id") int id) throws Exception {
1060
    public ResponseEntity<?> scratchOffers(HttpServletRequest request, @RequestParam(value = "id") int id) throws Exception {
1064
 
1061
 
1065
        LocalDateTime startDate = LocalDateTime.of(LocalDate.now().getYear(), LocalDate.now().getMonth(), 22, 0, 0);
1062
        List<ScratchOffer> scratchOffers = scratchOfferRepository.selectBycCustomerIdAndDate(id,
1066
 
-
 
1067
        List<ScratchOffer> scratchOffers = scratchOfferRepository.selectBycCustomerIdAndDate(id, startDate.toLocalDate());
1063
                ProfitMandiConstants.SCRATCH_OFFER_START_DATE, ProfitMandiConstants.SCRATCH_OFFER_END_DATE);
1068
 
-
 
1069
 
1064
 
1070
        logger.info("scratchOffers {}", scratchOffers);
1065
        logger.info("scratchOffers {}", scratchOffers);
1071
        // List<ScratchOffer> scratchOffers =
1066
        // List<ScratchOffer> scratchOffers =
1072
        // scratchOfferRepository.selectBycCustomerId(id);
1067
        // scratchOfferRepository.selectBycCustomerId(id);
1073
        for (ScratchOffer so : scratchOffers) {
1068
        for (ScratchOffer so : scratchOffers) {
1074
            LocalDateTime endDate = LocalDateTime.of(LocalDate.now().getYear(), LocalDate.now().getMonth(), 27, 21, 00);
-
 
1075
 
-
 
1076
 
-
 
1077
            if (LocalDateTime.now().isAfter(so.getUnlockedAt())) {
1069
            if (LocalDateTime.now().isAfter(so.getUnlockedAt())) {
1078
                so.setUnlocked(true);
1070
                so.setUnlocked(true);
1079
            } else {
1071
            } else {
1080
                so.setUnlocked(false);
1072
                so.setUnlocked(false);
1081
            }
1073
            }