Subversion Repositories SmartDukaan

Rev

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

Rev 31384 Rev 31416
Line 55... Line 55...
55
import java.io.ByteArrayInputStream;
55
import java.io.ByteArrayInputStream;
56
import java.io.ByteArrayOutputStream;
56
import java.io.ByteArrayOutputStream;
57
import java.io.InputStream;
57
import java.io.InputStream;
58
import java.time.LocalDate;
58
import java.time.LocalDate;
59
import java.time.LocalDateTime;
59
import java.time.LocalDateTime;
-
 
60
import java.time.LocalTime;
60
import java.time.format.DateTimeFormatter;
61
import java.time.format.DateTimeFormatter;
61
import java.time.temporal.ChronoUnit;
62
import java.time.temporal.ChronoUnit;
62
import java.util.*;
63
import java.util.*;
63
import java.util.stream.Collectors;
64
import java.util.stream.Collectors;
64
 
65
 
Line 1365... Line 1366...
1365
			@RequestParam(name = "endDate", required = true, defaultValue = "") LocalDate endDate, Model model)
1366
			@RequestParam(name = "endDate", required = true, defaultValue = "") LocalDate endDate, Model model)
1366
			throws Exception {
1367
			throws Exception {
1367
 
1368
 
1368
		List<List<?>> rows = new ArrayList<>();
1369
		List<List<?>> rows = new ArrayList<>();
1369
		LoginDetails fofoDetails = cookiesProcessor.getCookiesObject(request);
1370
		LoginDetails fofoDetails = cookiesProcessor.getCookiesObject(request);
1370
 
-
 
1371
		LocalDateTime currentDate = LocalDate.now().atStartOfDay();
-
 
1372
		LocalDateTime currentStartMonth = currentDate.minusDays(30).toLocalDate().atStartOfDay();
-
 
1373
 
-
 
1374
		List<WalletSummaryReportModel> walletSummartList = fofoOrderRepository
1371
		List<WalletSummaryReportModel> walletSummartList = fofoOrderRepository.selectWalletSummaryReport(
1375
				.selectWalletSummaryReport(fofoDetails.getFofoId(), currentStartMonth, currentDate);
1372
				fofoDetails.getFofoId(), startDate.atStartOfDay(), endDate.atTime(LocalTime.MAX));
1376
		LOGGER.info("walletSummartList {}", walletSummartList);
1373
		LOGGER.info("walletSummartList {}", walletSummartList);
1377
		DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm");
1374
		DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm");
1378
 
1375
 
1379
		for (WalletSummaryReportModel walletSummart : walletSummartList) {
1376
		for (WalletSummaryReportModel walletSummart : walletSummartList) {
1380
 
1377
 
Line 1512... Line 1509...
1512
 
1509
 
1513
		return "price-drop-report";
1510
		return "price-drop-report";
1514
	}
1511
	}
1515
 
1512
 
1516
	@RequestMapping(value = "/downloadPriceDropReport", method = RequestMethod.GET)
1513
	@RequestMapping(value = "/downloadPriceDropReport", method = RequestMethod.GET)
1517
	public ResponseEntity<?> getSelectDownloadPriceDropReport(HttpServletRequest request, Model model)
1514
	public ResponseEntity<?> getSelectDownloadPriceDropReport(HttpServletRequest request,
-
 
1515
			@RequestParam(name = "startDate", required = true, defaultValue = "") LocalDate startDate,
-
 
1516
			@RequestParam(name = "endDate", required = true, defaultValue = "") LocalDate endDate, Model model)
1518
			throws Exception {
1517
			throws Exception {
1519
		LoginDetails fofoDetails = cookiesProcessor.getCookiesObject(request);
1518
		LoginDetails fofoDetails = cookiesProcessor.getCookiesObject(request);
1520
 
1519
 
1521
		LocalDateTime currentDate = LocalDate.now().atStartOfDay();
-
 
1522
		LocalDateTime currentStartMonth = currentDate.minusMonths(3).toLocalDate().atStartOfDay();
-
 
1523
		List<List<?>> rows = new ArrayList<>();
1520
		List<List<?>> rows = new ArrayList<>();
1524
		List<PriceDropReportModel> priceDropReports = orderRepository.selectPriceDropReport(fofoDetails.getFofoId(),
1521
		List<PriceDropReportModel> priceDropReports = orderRepository.selectPriceDropReport(fofoDetails.getFofoId(),
1525
				currentStartMonth, currentDate);
1522
				startDate.atStartOfDay(), endDate.atTime(LocalTime.MAX));
1526
 
1523
 
1527
		for (PriceDropReportModel pdr : priceDropReports) {
1524
		for (PriceDropReportModel pdr : priceDropReports) {
1528
 
1525
 
1529
			rows.add(Arrays.asList(pdr.getCode(), pdr.getId(), pdr.getBrand(), pdr.getModelName(), pdr.getModelNumber(),
1526
			rows.add(Arrays.asList(pdr.getCode(), pdr.getId(), pdr.getBrand(), pdr.getModelName(), pdr.getModelNumber(),
1530
					pdr.getAffectedOn(), pdr.getAmount(), pdr.getPartnerPayout(), pdr.getImei(), pdr.getStatus(),
1527
					pdr.getAffectedOn(), pdr.getAmount(), pdr.getPartnerPayout(), pdr.getImei(), pdr.getStatus(),
Line 1552... Line 1549...
1552
 
1549
 
1553
		LocalDateTime currentDate = LocalDate.now().atStartOfDay();
1550
		LocalDateTime currentDate = LocalDate.now().atStartOfDay();
1554
		LocalDateTime currentStartMonth = currentDate.minusMonths(3).toLocalDate().atStartOfDay();
1551
		LocalDateTime currentStartMonth = currentDate.minusMonths(3).toLocalDate().atStartOfDay();
1555
 
1552
 
1556
		List<PartnerBillingSummaryModel> partnerBillingSummaryReports = fofoOrderRepository
1553
		List<PartnerBillingSummaryModel> partnerBillingSummaryReports = fofoOrderRepository
1557
				.selectPartnerBillingSummaryReport(fofoDetails.getFofoId(), currentStartMonth, currentDate);
1554
				.selectPartnerBillingSummaryReport(fofoDetails.getFofoId(), startDate.atStartOfDay(),
-
 
1555
						endDate.atTime(LocalTime.MAX));
1558
		DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm");
1556
		DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm");
1559
 
1557
 
1560
		for (PartnerBillingSummaryModel pbsr : partnerBillingSummaryReports) {
1558
		for (PartnerBillingSummaryModel pbsr : partnerBillingSummaryReports) {
1561
 
1559
 
1562
			rows.add(Arrays.asList(pbsr.getId(), pbsr.getCreateTimestamp().format(dateTimeFormatter),
1560
			rows.add(Arrays.asList(pbsr.getId(), pbsr.getCreateTimestamp().format(dateTimeFormatter),
Line 1630... Line 1628...
1630
 
1628
 
1631
		return responseEntity;
1629
		return responseEntity;
1632
	}
1630
	}
1633
 
1631
 
1634
	@RequestMapping(value = "/schemePayoutReportDownload", method = RequestMethod.GET)
1632
	@RequestMapping(value = "/schemePayoutReportDownload", method = RequestMethod.GET)
1635
	public ResponseEntity<?> getSchemePayoutReportDownload(HttpServletRequest request, Model model) throws Exception {
1633
	public ResponseEntity<?> getSchemePayoutReportDownload(HttpServletRequest request,
-
 
1634
			@RequestParam(name = "startDate", required = true, defaultValue = "") LocalDate startDate,
-
 
1635
			@RequestParam(name = "endDate", required = true, defaultValue = "") LocalDate endDate, Model model)
-
 
1636
			throws Exception {
1636
		LoginDetails fofoDetails = cookiesProcessor.getCookiesObject(request);
1637
		LoginDetails fofoDetails = cookiesProcessor.getCookiesObject(request);
1637
 
1638
 
1638
		List<List<?>> rows = new ArrayList<>();
1639
		List<List<?>> rows = new ArrayList<>();
1639
		LocalDateTime currentDate = LocalDate.now().atStartOfDay();
1640
		LocalDateTime currentDate = LocalDate.now().atStartOfDay();
1640
		LocalDateTime currentStartMonth = currentDate.minusMonths(3).toLocalDate().atStartOfDay();
1641
		LocalDateTime currentStartMonth = currentDate.minusMonths(3).toLocalDate().atStartOfDay();