Subversion Repositories SmartDukaan

Rev

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

Rev 37311 Rev 37312
Line 1... Line 1...
1
package com.spice.profitmandi.dao.service;
1
package com.spice.profitmandi.dao.service;
2
 
2
 
3
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
3
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
4
import com.spice.profitmandi.common.model.CustomPaymentOption;
-
 
5
import com.spice.profitmandi.dao.entity.catalog.Item;
4
import com.spice.profitmandi.dao.entity.catalog.Item;
6
import com.spice.profitmandi.dao.entity.dtr.ScratchOffer;
5
import com.spice.profitmandi.dao.entity.dtr.ScratchOffer;
7
import com.spice.profitmandi.dao.entity.fofo.FofoOrder;
6
import com.spice.profitmandi.dao.entity.fofo.FofoOrder;
8
import com.spice.profitmandi.dao.entity.fofo.FofoOrderItem;
7
import com.spice.profitmandi.dao.entity.fofo.FofoOrderItem;
9
import com.spice.profitmandi.dao.entity.scratch.GiftEntity;
8
import com.spice.profitmandi.dao.entity.scratch.GiftEntity;
Line 42... Line 41...
42
    ItemRepository itemRepository;
41
    ItemRepository itemRepository;
43
    @Autowired
42
    @Autowired
44
    FofoOrderRepository fofoOrderRepository;
43
    FofoOrderRepository fofoOrderRepository;
45
 
44
 
46
 
45
 
47
    public void processScratchOffer(int fofoOrderId, Set<CustomPaymentOption> paymentOptions, Set<Integer> fofoOrderItemIds) throws ProfitMandiBusinessException {
46
    public void processScratchOffer(int fofoOrderId, Set<Integer> fofoOrderItemIds) throws ProfitMandiBusinessException {
-
 
47
        List<Item> items = itemRepository.selectByIds(fofoOrderItemIds);
-
 
48
        boolean smartPhone = items.stream().anyMatch(Item::isSmartPhone);
-
 
49
        if (smartPhone) {
-
 
50
            this.processScratchOfferCoupon(fofoOrderId);
-
 
51
        }
-
 
52
    }
-
 
53
 
-
 
54
    public void processScratchOfferCoupon(int fofoOrderId) throws ProfitMandiBusinessException {
48
        List<OfferEntity> activeOffers = seasonalOfferRepository.getOffersByDate(LocalDate.now());
55
        List<OfferEntity> activeOffers = seasonalOfferRepository.getOffersByDate(LocalDate.now());
49
        if (activeOffers.isEmpty()) {
56
        if (activeOffers.isEmpty()) {
50
            return;
57
            return;
51
        }
58
        }
52
 
59