| Line 306... |
Line 306... |
| 306 |
@RequestMapping(value = "/store/getCustomerById/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
306 |
@RequestMapping(value = "/store/getCustomerById/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
| 307 |
public ResponseEntity<?> getCustomerById(HttpServletRequest request, @PathVariable int id) throws Exception {
|
307 |
public ResponseEntity<?> getCustomerById(HttpServletRequest request, @PathVariable int id) throws Exception {
|
| 308 |
|
308 |
|
| 309 |
Customer customer = customerRepository.selectById(id);
|
309 |
Customer customer = customerRepository.selectById(id);
|
| 310 |
customer.setPasswordExist(StringUtils.isNotEmpty(customer.getPassword()));
|
310 |
customer.setPasswordExist(StringUtils.isNotEmpty(customer.getPassword()));
|
| 311 |
|
311 |
|
| 312 |
return responseSender.ok(customer);
|
312 |
return responseSender.ok(customer);
|
| 313 |
|
313 |
|
| 314 |
}
|
314 |
}
|
| 315 |
|
315 |
|
| 316 |
@RequestMapping(value = "/store/signin", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
316 |
@RequestMapping(value = "/store/signin", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
| Line 1026... |
Line 1026... |
| 1026 |
@RequestMapping(value = "/store/checkEligibilityStoreOffers", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
1026 |
@RequestMapping(value = "/store/checkEligibilityStoreOffers", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
| 1027 |
public ResponseEntity<?> checkEligibilityStoreOffers(HttpServletRequest request, @RequestParam(value = "id") int id) throws Exception {
|
1027 |
public ResponseEntity<?> checkEligibilityStoreOffers(HttpServletRequest request, @RequestParam(value = "id") int id) throws Exception {
|
| 1028 |
|
1028 |
|
| 1029 |
boolean eligibility = false;
|
1029 |
boolean eligibility = false;
|
| 1030 |
|
1030 |
|
| 1031 |
LocalDateTime startDate = LocalDateTime.of(LocalDate.now().getYear(), LocalDate.now().getMonth(), 14, 0, 0);
|
1031 |
LocalDateTime startDate = LocalDateTime.of(LocalDate.now().getYear(), LocalDate.now().getMonth(), 22, 0, 0);
|
| 1032 |
|
1032 |
|
| 1033 |
List<ScratchOffer> scratchOffers = scratchOfferRepository.selectBycCustomerIdAndDate(id, startDate.toLocalDate());
|
1033 |
List<ScratchOffer> scratchOffers = scratchOfferRepository.selectBycCustomerIdAndDate(id, startDate.toLocalDate());
|
| 1034 |
|
1034 |
|
| 1035 |
if (!scratchOffers.isEmpty()) {
|
1035 |
if (!scratchOffers.isEmpty()) {
|
| 1036 |
eligibility = true;
|
1036 |
eligibility = true;
|
| Line 1043... |
Line 1043... |
| 1043 |
}
|
1043 |
}
|
| 1044 |
|
1044 |
|
| 1045 |
@RequestMapping(value = "/store/ScratchOffers", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
1045 |
@RequestMapping(value = "/store/ScratchOffers", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
| 1046 |
public ResponseEntity<?> scratchOffers(HttpServletRequest request, @RequestParam(value = "id") int id) throws Exception {
|
1046 |
public ResponseEntity<?> scratchOffers(HttpServletRequest request, @RequestParam(value = "id") int id) throws Exception {
|
| 1047 |
|
1047 |
|
| 1048 |
LocalDateTime startDate = LocalDateTime.of(LocalDate.now().getYear(), LocalDate.now().getMonth(), 14, 0, 0);
|
1048 |
LocalDateTime startDate = LocalDateTime.of(LocalDate.now().getYear(), LocalDate.now().getMonth(), 22, 0, 0);
|
| 1049 |
|
1049 |
|
| 1050 |
List<ScratchOffer> scratchOffers = scratchOfferRepository.selectBycCustomerIdAndDate(id, startDate.toLocalDate());
|
1050 |
List<ScratchOffer> scratchOffers = scratchOfferRepository.selectBycCustomerIdAndDate(id, startDate.toLocalDate());
|
| 1051 |
|
1051 |
|
| - |
|
1052 |
|
| - |
|
1053 |
logger.info("scratchOffers {}", scratchOffers);
|
| 1052 |
// List<ScratchOffer> scratchOffers =
|
1054 |
// List<ScratchOffer> scratchOffers =
|
| 1053 |
// scratchOfferRepository.selectBycCustomerId(id);
|
1055 |
// scratchOfferRepository.selectBycCustomerId(id);
|
| 1054 |
for (ScratchOffer so : scratchOffers) {
|
1056 |
for (ScratchOffer so : scratchOffers) {
|
| 1055 |
LocalDateTime endDate = LocalDateTime.of(LocalDate.now().getYear(), LocalDate.now().getMonth(), 27, 21, 00);
|
1057 |
LocalDateTime endDate = LocalDateTime.of(LocalDate.now().getYear(), LocalDate.now().getMonth(), 27, 21, 00);
|
| 1056 |
|
1058 |
|
| 1057 |
if (so.getOfferName() != null) {
|
- |
|
| 1058 |
so.setExpiredTimestamp(endDate);
|
- |
|
| 1059 |
}
|
1059 |
|
| 1060 |
if (LocalDateTime.now().isAfter(so.getUnlockedAt())) {
|
1060 |
if (LocalDateTime.now().isAfter(so.getUnlockedAt())) {
|
| 1061 |
so.setUnlocked(true);
|
1061 |
so.setUnlocked(true);
|
| 1062 |
} else {
|
1062 |
} else {
|
| 1063 |
so.setUnlocked(false);
|
1063 |
so.setUnlocked(false);
|
| 1064 |
}
|
1064 |
}
|