Subversion Repositories SmartDukaan

Rev

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

Rev 28995 Rev 29107
Line 6... Line 6...
6
import java.time.Duration;
6
import java.time.Duration;
7
import java.time.LocalDate;
7
import java.time.LocalDate;
8
import java.time.LocalDateTime;
8
import java.time.LocalDateTime;
9
import java.time.LocalTime;
9
import java.time.LocalTime;
10
import java.time.Month;
10
import java.time.Month;
-
 
11
import java.time.YearMonth;
11
import java.time.format.DateTimeFormatter;
12
import java.time.format.DateTimeFormatter;
-
 
13
import java.time.temporal.ChronoField;
12
import java.time.temporal.ChronoUnit;
14
import java.time.temporal.ChronoUnit;
13
import java.util.ArrayList;
15
import java.util.ArrayList;
14
import java.util.Arrays;
16
import java.util.Arrays;
15
import java.util.Base64;
17
import java.util.Base64;
16
import java.util.Collections;
18
import java.util.Collections;
Line 782... Line 784...
782
		}
784
		}
783
		LOGGER.info("Cashbacks for Recharge processed Successfully");
785
		LOGGER.info("Cashbacks for Recharge processed Successfully");
784
	}
786
	}
785
	
787
	
786
	public void rollOutUpgardedMargins() throws Exception {
788
	public void rollOutUpgardedMargins() throws Exception {
787
		List<Integer> fofoIds = Arrays.asList(175138968, 175138957, 175138952, 175138934);
789
		LocalDate startOfPreviousMonth = LocalDate.now().with(ChronoField.DAY_OF_MONTH, 1).minusMonths(1);
788
		LocalDate today = LocalDate.now();
-
 
789
		LocalDate yesterday = today.minusDays(1);
-
 
790
		
790
		
791
		List<FofoStore> stores = fofoStoreRepository.selectActiveStores();
791
		List<FofoStore> stores = fofoStoreRepository.selectActiveStores();
792
		for(FofoStore store : stores) {
792
		for(FofoStore store : stores) {
793
			if(fofoIds.contains(store.getId())) {
-
 
794
				int fofoId = store.getId();
793
				int fofoId = store.getId();
-
 
794
				
795
				PartnerType yesterdayPartnerType = partnerTypeChangeService.getTypeOnDate(fofoId, yesterday);
795
				PartnerType startOfMonthPartnerType = partnerTypeChangeService.getTypeOnDate(fofoId, startOfPreviousMonth);
796
				PartnerType todayPartnerType = partnerTypeChangeService.getTypeOnDate(fofoId, today);
796
				PartnerType todayPartnerType = partnerTypeChangeService.getTypeOnMonth(fofoId, YearMonth.from(startOfPreviousMonth.atStartOfDay()));
797
				if(!yesterdayPartnerType.equals(todayPartnerType)) {
797
				if(!startOfMonthPartnerType.equals(todayPartnerType)) {
798
					LOGGER.info("Partner Type has been changed for code {} from {} to {}", store.getCode(), yesterdayPartnerType, todayPartnerType);
798
					LOGGER.info("Partner Type has been changed for code {} from {} to {}", store.getCode(), startOfMonthPartnerType, todayPartnerType);
799
					List<FofoOrder> fofoOrders = fofoOrderRepository.selectByFofoId(fofoId, yesterday.withDayOfMonth(1).atStartOfDay(), yesterday.atTime(LocalTime.MAX), 0,0);
799
					//List<FofoOrder> fofoOrders = fofoOrderRepository.selectByFofoId(fofoId, yesterday.withDayOfMonth(1).atStartOfDay(), yesterday.atTime(LocalTime.MAX), 0,0);
-
 
800
					/*
800
					for(FofoOrder fofoOrder : fofoOrders) {
801
					 * for(FofoOrder fofoOrder : fofoOrders) {
801
						//TODO - SCHEME
-
 
802
						//Skip this as of now to avoid any mishap 
-
 
803
						//schemeService.processSchemeOut(fofoOrder.getId(), fofoId);
802
					 * schemeService.processSchemeOut(fofoOrder.getId(), fofoId); }
804
					}
803
					 */
805
				}
804
				}
806
			}
-
 
807
		}
805
		}
808
	}
806
	}
809
 
807
 
810
	private class SaleRoles {
808
	private class SaleRoles {
811
 
809