| Line 9... |
Line 9... |
| 9 |
import com.spice.profitmandi.common.util.FileUtil;
|
9 |
import com.spice.profitmandi.common.util.FileUtil;
|
| 10 |
import com.spice.profitmandi.common.util.FormattingUtils;
|
10 |
import com.spice.profitmandi.common.util.FormattingUtils;
|
| 11 |
import com.spice.profitmandi.common.util.Utils;
|
11 |
import com.spice.profitmandi.common.util.Utils;
|
| 12 |
import com.spice.profitmandi.dao.entity.catalog.ItemCriteria;
|
12 |
import com.spice.profitmandi.dao.entity.catalog.ItemCriteria;
|
| 13 |
import com.spice.profitmandi.dao.entity.catalog.Offer;
|
13 |
import com.spice.profitmandi.dao.entity.catalog.Offer;
|
| 14 |
import com.spice.profitmandi.dao.entity.catalog.OfferPartner;
|
- |
|
| 15 |
import com.spice.profitmandi.dao.entity.catalog.TagListing;
|
14 |
import com.spice.profitmandi.dao.entity.catalog.TagListing;
|
| 16 |
import com.spice.profitmandi.dao.entity.catalog.TargetSlabEntity;
|
15 |
import com.spice.profitmandi.dao.entity.catalog.TargetSlabEntity;
|
| 17 |
import com.spice.profitmandi.dao.entity.fofo.FofoLineItem;
|
16 |
import com.spice.profitmandi.dao.entity.fofo.FofoLineItem;
|
| 18 |
import com.spice.profitmandi.dao.entity.fofo.FofoOrderItem;
|
17 |
import com.spice.profitmandi.dao.entity.fofo.FofoOrderItem;
|
| 19 |
import com.spice.profitmandi.dao.entity.fofo.InventoryItem;
|
18 |
import com.spice.profitmandi.dao.entity.fofo.InventoryItem;
|
| Line 28... |
Line 27... |
| 28 |
import com.spice.profitmandi.dao.enumuration.catalog.OfferSchemeType;
|
27 |
import com.spice.profitmandi.dao.enumuration.catalog.OfferSchemeType;
|
| 29 |
import com.spice.profitmandi.dao.enumuration.transaction.SchemePayoutStatus;
|
28 |
import com.spice.profitmandi.dao.enumuration.transaction.SchemePayoutStatus;
|
| 30 |
import com.spice.profitmandi.dao.model.*;
|
29 |
import com.spice.profitmandi.dao.model.*;
|
| 31 |
import com.spice.profitmandi.dao.repository.GenericRepository;
|
30 |
import com.spice.profitmandi.dao.repository.GenericRepository;
|
| 32 |
import com.spice.profitmandi.dao.repository.catalog.*;
|
31 |
import com.spice.profitmandi.dao.repository.catalog.*;
|
| 33 |
import com.spice.profitmandi.dao.repository.catalog.OfferPartnerRepository;
|
- |
|
| 34 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
32 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
| 35 |
import com.spice.profitmandi.dao.repository.fofo.ActivatedImeiRepository;
|
33 |
import com.spice.profitmandi.dao.repository.fofo.ActivatedImeiRepository;
|
| 36 |
import com.spice.profitmandi.dao.repository.fofo.InventoryItemRepository;
|
34 |
import com.spice.profitmandi.dao.repository.fofo.InventoryItemRepository;
|
| 37 |
import com.spice.profitmandi.dao.repository.fofo.OfferPayoutRepository;
|
35 |
import com.spice.profitmandi.dao.repository.fofo.OfferPayoutRepository;
|
| 38 |
import com.spice.profitmandi.dao.repository.transaction.LineItemImeisRepository;
|
36 |
import com.spice.profitmandi.dao.repository.transaction.LineItemImeisRepository;
|
| Line 97... |
Line 95... |
| 97 |
|
95 |
|
| 98 |
@Autowired
|
96 |
@Autowired
|
| 99 |
private OfferTargetSlabRepository offerTargetSlabRepository;
|
97 |
private OfferTargetSlabRepository offerTargetSlabRepository;
|
| 100 |
|
98 |
|
| 101 |
@Autowired
|
99 |
@Autowired
|
| 102 |
private OfferPartnerRepository offerPartnerRepository;
|
- |
|
| 103 |
|
- |
|
| 104 |
@Autowired
|
- |
|
| 105 |
private ItemCriteriaRepository itemCriteriaRepository;
|
100 |
private ItemCriteriaRepository itemCriteriaRepository;
|
| 106 |
|
101 |
|
| 107 |
@Autowired
|
102 |
@Autowired
|
| 108 |
private ItemRepository itemRepository;
|
103 |
private ItemRepository itemRepository;
|
| 109 |
|
104 |
|
| Line 1557... |
Line 1552... |
| 1557 |
if (partnerCriteria.getFofoIds() != null) {
|
1552 |
if (partnerCriteria.getFofoIds() != null) {
|
| 1558 |
partnerCriteria.getFofoIds().removeAll(fofoIds);
|
1553 |
partnerCriteria.getFofoIds().removeAll(fofoIds);
|
| 1559 |
}
|
1554 |
}
|
| 1560 |
offer.setPartnerCriteria(gson.toJson(partnerCriteria));
|
1555 |
offer.setPartnerCriteria(gson.toJson(partnerCriteria));
|
| 1561 |
genericRepository.persist(offer);
|
1556 |
genericRepository.persist(offer);
|
| 1562 |
offerPartnerRepository.deleteByOfferIdAndFofoIds(offerId, fofoIds);
|
- |
|
| 1563 |
LOGGER.info("Removed partners {} from offer {}", fofoIds, offerId);
|
1557 |
LOGGER.info("Removed partners {} from offer {}", fofoIds, offerId);
|
| 1564 |
}
|
1558 |
}
|
| 1565 |
|
1559 |
|
| 1566 |
@Override
|
1560 |
@Override
|
| 1567 |
public void addPartnersToOffer(int offerId, List<Integer> fofoIds) throws ProfitMandiBusinessException {
|
1561 |
public void addPartnersToOffer(int offerId, List<Integer> fofoIds) throws ProfitMandiBusinessException {
|
| Line 1575... |
Line 1569... |
| 1575 |
existingFofoIds = new ArrayList<>();
|
1569 |
existingFofoIds = new ArrayList<>();
|
| 1576 |
}
|
1570 |
}
|
| 1577 |
for (int fofoId : fofoIds) {
|
1571 |
for (int fofoId : fofoIds) {
|
| 1578 |
if (!existingFofoIds.contains(fofoId)) {
|
1572 |
if (!existingFofoIds.contains(fofoId)) {
|
| 1579 |
existingFofoIds.add(fofoId);
|
1573 |
existingFofoIds.add(fofoId);
|
| 1580 |
OfferPartner offerPartner = new OfferPartner();
|
- |
|
| 1581 |
offerPartner.setOfferId(offerId);
|
- |
|
| 1582 |
offerPartner.setFofoId(fofoId);
|
- |
|
| 1583 |
offerPartnerRepository.persist(offerPartner);
|
- |
|
| 1584 |
}
|
1574 |
}
|
| 1585 |
}
|
1575 |
}
|
| 1586 |
partnerCriteria.setFofoIds(existingFofoIds);
|
1576 |
partnerCriteria.setFofoIds(existingFofoIds);
|
| 1587 |
offer.setPartnerCriteria(gson.toJson(partnerCriteria));
|
1577 |
offer.setPartnerCriteria(gson.toJson(partnerCriteria));
|
| 1588 |
genericRepository.persist(offer);
|
1578 |
genericRepository.persist(offer);
|