| Line 40... |
Line 40... |
| 40 |
import com.spice.profitmandi.common.model.SchemeItems;
|
40 |
import com.spice.profitmandi.common.model.SchemeItems;
|
| 41 |
import com.spice.profitmandi.common.model.SchemeModel;
|
41 |
import com.spice.profitmandi.common.model.SchemeModel;
|
| 42 |
import com.spice.profitmandi.common.util.ExcelUtils;
|
42 |
import com.spice.profitmandi.common.util.ExcelUtils;
|
| 43 |
import com.spice.profitmandi.common.util.FormattingUtils;
|
43 |
import com.spice.profitmandi.common.util.FormattingUtils;
|
| 44 |
import com.spice.profitmandi.common.util.StringUtils;
|
44 |
import com.spice.profitmandi.common.util.StringUtils;
|
| - |
|
45 |
import com.spice.profitmandi.common.util.Utils;
|
| 45 |
import com.spice.profitmandi.common.web.util.ResponseSender;
|
46 |
import com.spice.profitmandi.common.web.util.ResponseSender;
|
| 46 |
import com.spice.profitmandi.dao.entity.catalog.Item;
|
47 |
import com.spice.profitmandi.dao.entity.catalog.Item;
|
| 47 |
import com.spice.profitmandi.dao.entity.catalog.Scheme;
|
48 |
import com.spice.profitmandi.dao.entity.catalog.Scheme;
|
| 48 |
import com.spice.profitmandi.dao.entity.catalog.TagListing;
|
49 |
import com.spice.profitmandi.dao.entity.catalog.TagListing;
|
| 49 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
50 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
| Line 253... |
Line 254... |
| 253 |
}
|
254 |
}
|
| 254 |
|
255 |
|
| 255 |
@RequestMapping(value = "/extendAllSchemes", method = RequestMethod.POST)
|
256 |
@RequestMapping(value = "/extendAllSchemes", method = RequestMethod.POST)
|
| 256 |
public String extendAllScheme(HttpServletRequest request, @RequestBody LocalDateTime extendDatetime, Model model)
|
257 |
public String extendAllScheme(HttpServletRequest request, @RequestBody LocalDateTime extendDatetime, Model model)
|
| 257 |
throws Exception {
|
258 |
throws Exception {
|
| 258 |
extendDatetime = LocalDateTime.of(extendDatetime.toLocalDate(), LocalTime.MAX);
|
259 |
extendDatetime = LocalDateTime.of(extendDatetime.toLocalDate(), Utils.MAX_TIME);
|
| 259 |
List<Scheme> schemes = schemeRepository.selectActiveAll();
|
260 |
List<Scheme> schemes = schemeRepository.selectActiveAll();
|
| 260 |
if (schemes.size() > 0) {
|
261 |
if (schemes.size() > 0) {
|
| 261 |
for (Scheme scheme : schemes) {
|
262 |
for (Scheme scheme : schemes) {
|
| 262 |
if (scheme.getExpireTimestamp() == null) {
|
263 |
if (scheme.getExpireTimestamp() == null) {
|
| 263 |
scheme.setEndDateTime(extendDatetime);
|
264 |
scheme.setEndDateTime(extendDatetime);
|
| Line 274... |
Line 275... |
| 274 |
@RequestMapping(value = "/extendSchemeById", method = RequestMethod.POST)
|
275 |
@RequestMapping(value = "/extendSchemeById", method = RequestMethod.POST)
|
| 275 |
public String extendSchemeById(HttpServletRequest request,
|
276 |
public String extendSchemeById(HttpServletRequest request,
|
| 276 |
|
277 |
|
| 277 |
@RequestParam(name = ProfitMandiConstants.SCHEME_ID) int schemeId,
|
278 |
@RequestParam(name = ProfitMandiConstants.SCHEME_ID) int schemeId,
|
| 278 |
@RequestBody LocalDateTime extendDatetime, Model model) throws Exception {
|
279 |
@RequestBody LocalDateTime extendDatetime, Model model) throws Exception {
|
| 279 |
extendDatetime = LocalDateTime.of(extendDatetime.toLocalDate(), LocalTime.MAX);
|
280 |
extendDatetime = LocalDateTime.of(extendDatetime.toLocalDate(), Utils.MAX_TIME);
|
| 280 |
Scheme scheme = schemeRepository.selectById(schemeId);
|
281 |
Scheme scheme = schemeRepository.selectById(schemeId);
|
| 281 |
if ((!(scheme.getActiveTimestamp() == null)) && scheme.getExpireTimestamp() == null) {
|
282 |
if ((!(scheme.getActiveTimestamp() == null)) && scheme.getExpireTimestamp() == null) {
|
| 282 |
scheme.setEndDateTime(extendDatetime);
|
283 |
scheme.setEndDateTime(extendDatetime);
|
| 283 |
schemeRepository.persist(scheme);
|
284 |
schemeRepository.persist(scheme);
|
| 284 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
285 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
| Line 604... |
Line 605... |
| 604 |
@RequestParam(name = ProfitMandiConstants.SCHEME_ID) int schemeId,
|
605 |
@RequestParam(name = ProfitMandiConstants.SCHEME_ID) int schemeId,
|
| 605 |
@RequestParam(name = ProfitMandiConstants.EXPIRE_TIMESTAMP) LocalDateTime expiryTimestamp,
|
606 |
@RequestParam(name = ProfitMandiConstants.EXPIRE_TIMESTAMP) LocalDateTime expiryTimestamp,
|
| 606 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
607 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
| 607 |
@RequestParam(name = "limit", defaultValue = "10") int limit, Model model)
|
608 |
@RequestParam(name = "limit", defaultValue = "10") int limit, Model model)
|
| 608 |
throws ProfitMandiBusinessException {
|
609 |
throws ProfitMandiBusinessException {
|
| 609 |
expiryTimestamp = LocalDateTime.of(expiryTimestamp.toLocalDate(), LocalTime.MAX);
|
610 |
expiryTimestamp = LocalDateTime.of(expiryTimestamp.toLocalDate(), Utils.MAX_TIME);
|
| 610 |
schemeService.expireSchemeById(schemeId, expiryTimestamp);
|
611 |
schemeService.expireSchemeById(schemeId, expiryTimestamp);
|
| 611 |
List<Scheme> schemes = schemeRepository.selectAll(offset, limit);
|
612 |
List<Scheme> schemes = schemeRepository.selectAll(offset, limit);
|
| 612 |
model.addAttribute("schemes", schemes);
|
613 |
model.addAttribute("schemes", schemes);
|
| 613 |
return "schemes-paginated";
|
614 |
return "schemes-paginated";
|
| 614 |
}
|
615 |
}
|