Subversion Repositories SmartDukaan

Rev

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

Rev 27795 Rev 27892
Line 646... Line 646...
646
	public void processScheme(int offset, boolean dryRun) throws Exception {
646
	public void processScheme(int offset, boolean dryRun) throws Exception {
647
		LocalDateTime startDate = LocalDateTime.of(LocalDate.now(), LocalTime.MIDNIGHT).minusDays(offset);
647
		LocalDateTime startDate = LocalDateTime.of(LocalDate.now(), LocalTime.MIDNIGHT).minusDays(offset);
648
		LocalDateTime endDate = startDate.plusDays(30);
648
		LocalDateTime endDate = startDate.plusDays(30);
649
		processScheme(startDate, endDate, dryRun);
649
		processScheme(startDate, endDate, dryRun);
650
	}
650
	}
-
 
651
	
-
 
652
	public void processSchemeOut(List<String> invoiceNumbers) throws Exception {
-
 
653
		for(String invoiceNumber : invoiceNumbers) {
-
 
654
			FofoOrder fofoOrder = fofoOrderRepository.selectByInvoiceNumber(invoiceNumber);
-
 
655
			schemeService.processSchemeOut(fofoOrder.getId(), fofoOrder.getFofoId());
-
 
656
		}
-
 
657
	}
651
 
658
 
652
	public void processScheme(int offset, int durationDays, boolean dryRun) throws Exception {
659
	public void processScheme(int offset, int durationDays, boolean dryRun) throws Exception {
653
		LocalDateTime startDate = LocalDateTime.of(LocalDate.now(), LocalTime.MIDNIGHT).minusDays(offset);
660
		LocalDateTime startDate = LocalDateTime.of(LocalDate.now(), LocalTime.MIDNIGHT).minusDays(offset);
654
		LocalDateTime endDate = startDate.plusDays(durationDays);
661
		LocalDateTime endDate = startDate.plusDays(durationDays);
655
		processScheme(startDate, endDate, dryRun);
662
		processScheme(startDate, endDate, dryRun);
Line 2365... Line 2372...
2365
					if(sio.getCreateTimestamp().toLocalDate().equals(localDate)) {
2372
					if(sio.getCreateTimestamp().toLocalDate().equals(localDate)) {
2366
						LOGGER.info("SIO - {}", sio);
2373
						LOGGER.info("SIO - {}", sio);
2367
						sio.setRolledBackTimestamp(LocalDateTime.now());
2374
						sio.setRolledBackTimestamp(LocalDateTime.now());
2368
					}
2375
					}
2369
				}
2376
				}
2370
				//Rollback entry with reversal reason
-
 
2371
				/*if(fofoOrder.getCreateTimestamp().isAfter(LocalDate.of(2020, 4, 1).atStartOfDay())) {
-
 
2372
					List<UserWalletHistory> userWalletHistory = userWalletHistoryRepository.selectAllByreferenceIdandreferenceType(fofoOrder.getId(), WalletReferenceType.SCHEME_OUT);
-
 
2373
					totalAmount += userWalletHistory.stream().collect(Collectors.summingInt(y->y.getAmount()));
-
 
2374
					walletService.rollbackAmountFromWallet(fofoOrder.getFofoId(), totalAmount, fofoOrder.getId(), WalletReferenceType.SCHEME_OUT, 
-
 
2375
							"Same order for Invoice-"+ invoiceNumber + "created twice, duplicate invoice rollback", fofoOrder.getCancelledTimestamp());
-
 
2376
					List<SchemeInOut> schemeInOuts = schemeInOutRepository.selectByInventoryItemIds(new HashSet<>(Arrays.asList(inventoryItemId)));
-
 
2377
					for(SchemeInOut sio : schemeInOuts) {
-
 
2378
						LOGGER.info(sio);
-
 
2379
					}
-
 
2380
					
-
 
2381
				}*/ 
-
 
2382
 
-
 
2383
				
2377
				
2384
			}
2378
			}
2385
		}
2379
		}
2386
		
2380
		
2387
	}
2381
	}