Subversion Repositories SmartDukaan

Rev

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

Rev 30580 Rev 30599
Line 8... Line 8...
8
import com.spice.profitmandi.common.model.SchemeModel;
8
import com.spice.profitmandi.common.model.SchemeModel;
9
import com.spice.profitmandi.common.services.ReporticoService;
9
import com.spice.profitmandi.common.services.ReporticoService;
10
import com.spice.profitmandi.common.util.ExcelUtils;
10
import com.spice.profitmandi.common.util.ExcelUtils;
11
import com.spice.profitmandi.common.util.FileUtil;
11
import com.spice.profitmandi.common.util.FileUtil;
12
import com.spice.profitmandi.common.util.FormattingUtils;
12
import com.spice.profitmandi.common.util.FormattingUtils;
13
import com.spice.profitmandi.common.util.Utils;
-
 
14
import com.spice.profitmandi.common.web.util.ResponseSender;
13
import com.spice.profitmandi.common.web.util.ResponseSender;
15
import com.spice.profitmandi.dao.entity.catalog.*;
14
import com.spice.profitmandi.dao.entity.catalog.*;
16
import com.spice.profitmandi.dao.entity.fofo.*;
15
import com.spice.profitmandi.dao.entity.fofo.*;
17
import com.spice.profitmandi.dao.entity.transaction.PriceDrop;
16
import com.spice.profitmandi.dao.entity.transaction.PriceDrop;
18
import com.spice.profitmandi.dao.entity.transaction.PriceDropIMEI;
17
import com.spice.profitmandi.dao.entity.transaction.PriceDropIMEI;
Line 498... Line 497...
498
	}
497
	}
499
 
498
 
500
	@RequestMapping(value = "/extendAllSchemes", method = RequestMethod.POST)
499
	@RequestMapping(value = "/extendAllSchemes", method = RequestMethod.POST)
501
	public String extendAllScheme(HttpServletRequest request, @RequestBody LocalDateTime extendDatetime, Model model)
500
	public String extendAllScheme(HttpServletRequest request, @RequestBody LocalDateTime extendDatetime, Model model)
502
			throws Exception {
501
			throws Exception {
503
		extendDatetime = LocalDateTime.of(extendDatetime.toLocalDate(), Utils.MAX_TIME);
-
 
504
		List<Scheme> schemes = schemeRepository.selectActiveAll();
502
		List<Scheme> schemes = schemeRepository.selectActiveAll();
505
		if (schemes.size() > 0) {
503
		if (schemes.size() > 0) {
506
			for (Scheme scheme : schemes) {
504
			for (Scheme scheme : schemes) {
507
				if (scheme.getExpireTimestamp() == null) {
505
				if (scheme.getExpireTimestamp() == null) {
508
					scheme.setEndDateTime(extendDatetime);
506
					scheme.setEndDateTime(extendDatetime);
Line 519... Line 517...
519
	@RequestMapping(value = "/extendSchemeById", method = RequestMethod.POST)
517
	@RequestMapping(value = "/extendSchemeById", method = RequestMethod.POST)
520
	public String extendSchemeById(HttpServletRequest request,
518
	public String extendSchemeById(HttpServletRequest request,
521
 
519
 
522
			@RequestParam(name = ProfitMandiConstants.SCHEME_ID) int schemeId,
520
			@RequestParam(name = ProfitMandiConstants.SCHEME_ID) int schemeId,
523
			@RequestBody LocalDateTime extendDatetime, Model model) throws Exception {
521
			@RequestBody LocalDateTime extendDatetime, Model model) throws Exception {
524
		extendDatetime = LocalDateTime.of(extendDatetime.toLocalDate(), Utils.MAX_TIME);
-
 
525
		Scheme scheme = schemeRepository.selectById(schemeId);
522
		Scheme scheme = schemeRepository.selectById(schemeId);
526
		if ((!(scheme.getActiveTimestamp() == null)) && scheme.getExpireTimestamp() == null) {
523
		if ((!(scheme.getActiveTimestamp() == null)) && scheme.getExpireTimestamp() == null) {
527
			scheme.setEndDateTime(extendDatetime);
524
			scheme.setEndDateTime(extendDatetime);
528
			schemeRepository.persist(scheme);
525
			schemeRepository.persist(scheme);
529
			model.addAttribute("response", mvcResponseSender.createResponseString(true));
526
			model.addAttribute("response", mvcResponseSender.createResponseString(true));
Line 1292... Line 1289...
1292
	@RequestMapping(value = "/expireSchemeById", method = RequestMethod.PUT)
1289
	@RequestMapping(value = "/expireSchemeById", method = RequestMethod.PUT)
1293
	public String expireSchemeById(HttpServletRequest request,
1290
	public String expireSchemeById(HttpServletRequest request,
1294
			@RequestParam(name = ProfitMandiConstants.SCHEME_ID) int schemeId,
1291
			@RequestParam(name = ProfitMandiConstants.SCHEME_ID) int schemeId,
1295
			@RequestParam(name = ProfitMandiConstants.EXPIRE_TIMESTAMP) LocalDateTime expiryTimestamp, Model model)
1292
			@RequestParam(name = ProfitMandiConstants.EXPIRE_TIMESTAMP) LocalDateTime expiryTimestamp, Model model)
1296
			throws ProfitMandiBusinessException {
1293
			throws ProfitMandiBusinessException {
1297
		expiryTimestamp = LocalDateTime.of(expiryTimestamp.toLocalDate(), Utils.MAX_TIME);
-
 
1298
		schemeService.expireSchemeById(schemeId, expiryTimestamp);
1294
		schemeService.expireSchemeById(schemeId, expiryTimestamp);
1299
		return getDefaultSchemes(request, model);
1295
		return getDefaultSchemes(request, model);
1300
	}
1296
	}
1301
 
1297
 
1302
	@RequestMapping(value = "/getSchemesJson", method = RequestMethod.GET)
1298
	@RequestMapping(value = "/getSchemesJson", method = RequestMethod.GET)
Line 1374... Line 1370...
1374
			} else {
1370
			} else {
1375
				CustomerOfferItem coi = customerOfferItemRepository.selectById(Integer.parseInt(record.get(0)));
1371
				CustomerOfferItem coi = customerOfferItemRepository.selectById(Integer.parseInt(record.get(0)));
1376
				coi.setSchemePayout(Integer.parseInt(record.get(2)));
1372
				coi.setSchemePayout(Integer.parseInt(record.get(2)));
1377
				coi.setDealerPayout(Integer.parseInt(record.get(3)));
1373
				coi.setDealerPayout(Integer.parseInt(record.get(3)));
1378
				coi.setUpdatedTimestamp(LocalDateTime.now());
1374
				coi.setUpdatedTimestamp(LocalDateTime.now());
1379
 
-
 
1380
			}
1375
			}
1381
 
1376
 
1382
		}
1377
		}
1383
 
1378
 
1384
		model.addAttribute("response", mvcResponseSender.createResponseString(true));
1379
		model.addAttribute("response", mvcResponseSender.createResponseString(true));