| Line 3... |
Line 3... |
| 3 |
import java.io.ByteArrayInputStream;
|
3 |
import java.io.ByteArrayInputStream;
|
| 4 |
import java.io.ByteArrayOutputStream;
|
4 |
import java.io.ByteArrayOutputStream;
|
| 5 |
import java.io.InputStream;
|
5 |
import java.io.InputStream;
|
| 6 |
import java.time.LocalDate;
|
6 |
import java.time.LocalDate;
|
| 7 |
import java.time.LocalDateTime;
|
7 |
import java.time.LocalDateTime;
|
| - |
|
8 |
import java.time.LocalTime;
|
| 8 |
import java.util.ArrayList;
|
9 |
import java.util.ArrayList;
|
| 9 |
import java.util.Arrays;
|
10 |
import java.util.Arrays;
|
| 10 |
import java.util.HashMap;
|
11 |
import java.util.HashMap;
|
| 11 |
import java.util.HashSet;
|
12 |
import java.util.HashSet;
|
| 12 |
import java.util.List;
|
13 |
import java.util.List;
|
| Line 252... |
Line 253... |
| 252 |
}
|
253 |
}
|
| 253 |
|
254 |
|
| 254 |
@RequestMapping(value = "/extendAllSchemes", method = RequestMethod.POST)
|
255 |
@RequestMapping(value = "/extendAllSchemes", method = RequestMethod.POST)
|
| 255 |
public String extendAllScheme(HttpServletRequest request, @RequestBody LocalDateTime extendDatetime, Model model)
|
256 |
public String extendAllScheme(HttpServletRequest request, @RequestBody LocalDateTime extendDatetime, Model model)
|
| 256 |
throws Exception {
|
257 |
throws Exception {
|
| 257 |
|
- |
|
| - |
|
258 |
extendDatetime = LocalDateTime.of(extendDatetime.toLocalDate(), LocalTime.MAX);
|
| 258 |
List<Scheme> schemes = schemeRepository.selectActiveAll();
|
259 |
List<Scheme> schemes = schemeRepository.selectActiveAll();
|
| 259 |
if (schemes.size() > 0) {
|
260 |
if (schemes.size() > 0) {
|
| 260 |
for (Scheme scheme : schemes) {
|
261 |
for (Scheme scheme : schemes) {
|
| 261 |
if (scheme.getExpireTimestamp() == null) {
|
262 |
if (scheme.getExpireTimestamp() == null) {
|
| 262 |
scheme.setEndDateTime(extendDatetime);
|
263 |
scheme.setEndDateTime(extendDatetime);
|
| Line 273... |
Line 274... |
| 273 |
@RequestMapping(value = "/extendSchemeById", method = RequestMethod.POST)
|
274 |
@RequestMapping(value = "/extendSchemeById", method = RequestMethod.POST)
|
| 274 |
public String extendSchemeById(HttpServletRequest request,
|
275 |
public String extendSchemeById(HttpServletRequest request,
|
| 275 |
|
276 |
|
| 276 |
@RequestParam(name = ProfitMandiConstants.SCHEME_ID) int schemeId,
|
277 |
@RequestParam(name = ProfitMandiConstants.SCHEME_ID) int schemeId,
|
| 277 |
@RequestBody LocalDateTime extendDatetime, Model model) throws Exception {
|
278 |
@RequestBody LocalDateTime extendDatetime, Model model) throws Exception {
|
| 278 |
|
- |
|
| 279 |
LOGGER.info("ExtendDatetime" + extendDatetime);
|
279 |
extendDatetime = LocalDateTime.of(extendDatetime.toLocalDate(), LocalTime.MAX);
|
| 280 |
LOGGER.info("schemeId" + schemeId);
|
- |
|
| 281 |
Scheme scheme = schemeRepository.selectById(schemeId);
|
280 |
Scheme scheme = schemeRepository.selectById(schemeId);
|
| 282 |
if ((!(scheme.getActiveTimestamp() == null)) && scheme.getExpireTimestamp() == null) {
|
281 |
if ((!(scheme.getActiveTimestamp() == null)) && scheme.getExpireTimestamp() == null) {
|
| 283 |
scheme.setEndDateTime(extendDatetime);
|
282 |
scheme.setEndDateTime(extendDatetime);
|
| 284 |
schemeRepository.persist(scheme);
|
283 |
schemeRepository.persist(scheme);
|
| 285 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
284 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
| Line 605... |
Line 604... |
| 605 |
@RequestParam(name = ProfitMandiConstants.SCHEME_ID) int schemeId,
|
604 |
@RequestParam(name = ProfitMandiConstants.SCHEME_ID) int schemeId,
|
| 606 |
@RequestParam(name = ProfitMandiConstants.EXPIRE_TIMESTAMP) LocalDateTime expiryTimestamp,
|
605 |
@RequestParam(name = ProfitMandiConstants.EXPIRE_TIMESTAMP) LocalDateTime expiryTimestamp,
|
| 607 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
606 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
| 608 |
@RequestParam(name = "limit", defaultValue = "10") int limit, Model model)
|
607 |
@RequestParam(name = "limit", defaultValue = "10") int limit, Model model)
|
| 609 |
throws ProfitMandiBusinessException {
|
608 |
throws ProfitMandiBusinessException {
|
| - |
|
609 |
expiryTimestamp = LocalDateTime.of(expiryTimestamp.toLocalDate(), LocalTime.MAX);
|
| 610 |
schemeService.expireSchemeById(schemeId, expiryTimestamp);
|
610 |
schemeService.expireSchemeById(schemeId, expiryTimestamp);
|
| 611 |
List<Scheme> schemes = schemeRepository.selectAll(offset, limit);
|
611 |
List<Scheme> schemes = schemeRepository.selectAll(offset, limit);
|
| 612 |
model.addAttribute("schemes", schemes);
|
612 |
model.addAttribute("schemes", schemes);
|
| 613 |
return "schemes-paginated";
|
613 |
return "schemes-paginated";
|
| 614 |
}
|
614 |
}
|