Subversion Repositories SmartDukaan

Rev

Rev 37040 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 37040 Rev 37043
Line 2120... Line 2120...
2120
        LocalDateTime now = LocalDateTime.now();
2120
        LocalDateTime now = LocalDateTime.now();
2121
        LocalDateTime thirtyDaysAgo = now.minusDays(30);
2121
        LocalDateTime thirtyDaysAgo = now.minusDays(30);
2122
        LocalDateTime sixtyDaysAgo = now.minusDays(60);
2122
        LocalDateTime sixtyDaysAgo = now.minusDays(60);
2123
        long threshold = 99_999L;
2123
        long threshold = 99_999L;
2124
 
2124
 
2125
        List<FofoStore> candidates = fofoStoreRepository.selectByStatus(true).stream().filter(x-> !x.isInternal()).collect(toList());
2125
        List<FofoStore> candidates = fofoStoreRepository.selectAllFranchiseStores().stream()
-
 
2126
                .filter(s -> s.isActive() && !s.isInternal() && !s.isClosed())
-
 
2127
                .filter(s -> s.getActivationType() == ActivationType.ACTIVE
-
 
2128
                        || s.getActivationType() == ActivationType.FOCUS)
-
 
2129
                .collect(Collectors.toList());
2126
 
2130
 
2127
        if (candidates.isEmpty()) {
2131
        if (candidates.isEmpty()) {
2128
            LOGGER.info("updatePartnerActivationTypeByMonthlySale: no candidate stores");
2132
            LOGGER.info("updatePartnerActivationTypeByMonthlySale: no candidate stores");
2129
            return;
2133
            return;
2130
        }
2134
        }
Line 2150... Line 2154...
2150
 
2154
 
2151
            if (target != current) {
2155
            if (target != current) {
2152
                LOGGER.info("Auto-downgrade fofoId={} code={} from {} to {} (below30={}, below60={})",
2156
                LOGGER.info("Auto-downgrade fofoId={} code={} from {} to {} (below30={}, below60={})",
2153
                        id, store.getCode(), current, target, below30, below60);
2157
                        id, store.getCode(), current, target, below30, below60);
2154
                store.setActivationType(target);
2158
                store.setActivationType(target);
2155
                store.setActive(false);
-
 
2156
                store.setActiveTimeStamp(null);
-
 
2157
                fofoStoreRepository.persist(store);
2159
                fofoStoreRepository.persist(store);
2158
                if (target == ActivationType.FOCUS) {
2160
                if (target == ActivationType.FOCUS) {
2159
                    toFocus++;
2161
                    toFocus++;
2160
                } else {
2162
                } else {
2161
                    toRevival++;
2163
                    toRevival++;