Subversion Repositories SmartDukaan

Rev

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

Rev 36058 Rev 37567
Line 9... Line 9...
9
import com.spice.profitmandi.dao.repository.dtr.WebListingRepository;
9
import com.spice.profitmandi.dao.repository.dtr.WebListingRepository;
10
import com.spice.profitmandi.dao.repository.dtr.WebProductListingRepository;
10
import com.spice.profitmandi.dao.repository.dtr.WebProductListingRepository;
11
import com.spice.profitmandi.dao.repository.transaction.OrderRepository;
11
import com.spice.profitmandi.dao.repository.transaction.OrderRepository;
12
import com.spice.profitmandi.dao.repository.transaction.PriceDropRepository;
12
import com.spice.profitmandi.dao.repository.transaction.PriceDropRepository;
13
import com.spice.profitmandi.dao.service.solr.FofoSolr;
13
import com.spice.profitmandi.dao.service.solr.FofoSolr;
-
 
14
import com.spice.profitmandi.service.catalog.CatalogDelistService;
14
import in.shop2020.model.v1.order.OrderStatus;
15
import in.shop2020.model.v1.order.OrderStatus;
15
import org.apache.logging.log4j.LogManager;
16
import org.apache.logging.log4j.LogManager;
16
import org.apache.logging.log4j.Logger;
17
import org.apache.logging.log4j.Logger;
17
import org.springframework.beans.factory.annotation.Autowired;
18
import org.springframework.beans.factory.annotation.Autowired;
-
 
19
import org.springframework.beans.factory.annotation.Value;
18
import org.springframework.scheduling.annotation.Scheduled;
20
import org.springframework.scheduling.annotation.Scheduled;
19
import org.springframework.stereotype.Component;
21
import org.springframework.stereotype.Component;
20
import org.springframework.transaction.annotation.Transactional;
22
import org.springframework.transaction.annotation.Transactional;
21
 
23
 
22
import java.time.LocalDate;
24
import java.time.LocalDate;
Line 52... Line 54...
52
    SchemeRepository schemeRepository;
54
    SchemeRepository schemeRepository;
53
 
55
 
54
    @Autowired
56
    @Autowired
55
    TagListingRepository tagListingRepository;
57
    TagListingRepository tagListingRepository;
56
 
58
 
-
 
59
    @Autowired
-
 
60
    CatalogDelistService catalogDelistService;
-
 
61
 
-
 
62
    // Inline default: env profiles have NO fallback between each other, so a key
-
 
63
    // missing from one profile's properties would otherwise stop the context booting.
-
 
64
    @Value("${catalog.autoDelist.enabled:true}")
-
 
65
    private boolean autoDelistEnabled;
-
 
66
 
57
 
67
 
58
    private static final Logger LOGGER = LogManager.getLogger(Listing.class);
68
    private static final Logger LOGGER = LogManager.getLogger(Listing.class);
59
 
69
 
60
    @Autowired
70
    @Autowired
61
    private WebProductListingRepository webProductListingRepository;
71
    private WebProductListingRepository webProductListingRepository;
Line 187... Line 197...
187
    @Scheduled(cron = "0 0 6,18 * * *")
197
    @Scheduled(cron = "0 0 6,18 * * *")
188
    public void scheduledPushDataToSolr() throws Throwable {
198
    public void scheduledPushDataToSolr() throws Throwable {
189
        this.pushDataToSolr();
199
        this.pushDataToSolr();
190
    }
200
    }
191
 
201
 
-
 
202
    /**
-
 
203
     * Retire dead catalogue, 30 minutes ahead of the 06:00 reindex above so the
-
 
204
     * same morning's Solr pass publishes it - a bulk UPDATE fires no
-
 
205
     * TagListingChangeListener event, so without that ordering the portal would
-
 
206
     * lag until 18:00.
-
 
207
     *
-
 
208
     * <p>Steady state is small: the 2026-09-10 backfill cleared a 2.5-year
-
 
209
     * backlog, so a run now catches only listings newly crossing the 24-month
-
 
210
     * line plus items whose stock just went to zero.
-
 
211
     */
-
 
212
    @Scheduled(cron = "0 30 5 * * *")
-
 
213
    public void scheduledDelistDeadListings() {
-
 
214
        if (!autoDelistEnabled) {
-
 
215
            LOGGER.info("catalog delist skipped: catalog.autoDelist.enabled=false");
-
 
216
            return;
-
 
217
        }
-
 
218
        LOGGER.info("catalog delist starting");
-
 
219
        LOGGER.info("catalog delist finished: {}", catalogDelistService.delistDeadListings());
-
 
220
    }
-
 
221
 
192
    @Scheduled(cron = "0 0 8 * * *")
222
    @Scheduled(cron = "0 0 8 * * *")
193
    public void scheduledGetBestSeller() throws Throwable {
223
    public void scheduledGetBestSeller() throws Throwable {
194
        this.getBestSeller();
224
        this.getBestSeller();
195
    }
225
    }
196
 
226