| Line 55... |
Line 55... |
| 55 |
import org.apache.poi.xssf.usermodel.XSSFSheet;
|
55 |
import org.apache.poi.xssf.usermodel.XSSFSheet;
|
| 56 |
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
56 |
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
| 57 |
import org.springframework.beans.factory.annotation.Autowired;
|
57 |
import org.springframework.beans.factory.annotation.Autowired;
|
| 58 |
import org.springframework.cache.CacheManager;
|
58 |
import org.springframework.cache.CacheManager;
|
| 59 |
import org.springframework.cache.annotation.Cacheable;
|
59 |
import org.springframework.cache.annotation.Cacheable;
|
| - |
|
60 |
import org.springframework.transaction.annotation.Propagation;
|
| 60 |
import org.springframework.transaction.annotation.Transactional;
|
61 |
import org.springframework.transaction.annotation.Transactional;
|
| 61 |
import org.springframework.stereotype.Component;
|
62 |
import org.springframework.stereotype.Component;
|
| 62 |
|
63 |
|
| 63 |
import java.io.IOException;
|
64 |
import java.io.IOException;
|
| 64 |
import java.io.InputStream;
|
65 |
import java.io.InputStream;
|
| Line 162... |
Line 163... |
| 162 |
public void evictOfferDefinitionCache(int offerId) {
|
163 |
public void evictOfferDefinitionCache(int offerId) {
|
| 163 |
redisCacheManager.getCache("offer.definition").evict(offerId);
|
164 |
redisCacheManager.getCache("offer.definition").evict(offerId);
|
| 164 |
}
|
165 |
}
|
| 165 |
|
166 |
|
| 166 |
@Override
|
167 |
@Override
|
| - |
|
168 |
@Transactional(propagation = Propagation.REQUIRES_NEW)
|
| - |
|
169 |
public List<Offer> activateOffers(List<Integer> offerIds, boolean active) throws ProfitMandiBusinessException {
|
| - |
|
170 |
List<Offer> offers = offerRepository.selectAllByIds(offerIds);
|
| - |
|
171 |
offers = offers.stream().filter(x -> x.isActive() != active).collect(Collectors.toList());
|
| - |
|
172 |
for (Offer offer : offers) {
|
| - |
|
173 |
offer.setActive(active);
|
| - |
|
174 |
}
|
| - |
|
175 |
return offers;
|
| - |
|
176 |
}
|
| - |
|
177 |
|
| - |
|
178 |
@Override
|
| 167 |
public void addOfferService(CreateOfferRequest createOfferRequest) throws ProfitMandiBusinessException {
|
179 |
public void addOfferService(CreateOfferRequest createOfferRequest) throws ProfitMandiBusinessException {
|
| 168 |
LOGGER.info("createOfferRequest -- {}", createOfferRequest);
|
180 |
LOGGER.info("createOfferRequest -- {}", createOfferRequest);
|
| 169 |
this.createOffer(createOfferRequest);
|
181 |
this.createOffer(createOfferRequest);
|
| 170 |
this.createTargetSlabs(createOfferRequest);
|
182 |
this.createTargetSlabs(createOfferRequest);
|
| 171 |
}
|
183 |
}
|
| Line 1956... |
Line 1968... |
| 1956 |
genericRepository.delete(offer);
|
1968 |
genericRepository.delete(offer);
|
| 1957 |
LOGGER.info("Deleted offer {} and {} target slabs", offerId, targetSlabs.size());
|
1969 |
LOGGER.info("Deleted offer {} and {} target slabs", offerId, targetSlabs.size());
|
| 1958 |
}
|
1970 |
}
|
| 1959 |
|
1971 |
|
| 1960 |
@Override
|
1972 |
@Override
|
| - |
|
1973 |
@Transactional(propagation = Propagation.REQUIRES_NEW)
|
| 1961 |
public List<Offer> publishAllUnpublished(YearMonth yearMonth) throws ProfitMandiBusinessException {
|
1974 |
public List<Offer> publishAllUnpublished(YearMonth yearMonth) throws ProfitMandiBusinessException {
|
| 1962 |
List<Offer> allOffers = offerRepository.selectAll(yearMonth, false);
|
1975 |
List<Offer> allOffers = offerRepository.selectAll(yearMonth, false);
|
| 1963 |
List<Offer> unpublished = allOffers.stream().filter(o -> !o.isActive()).collect(Collectors.toList());
|
1976 |
List<Offer> unpublished = allOffers.stream().filter(o -> !o.isActive()).collect(Collectors.toList());
|
| 1964 |
for (Offer offer : unpublished) {
|
1977 |
for (Offer offer : unpublished) {
|
| 1965 |
offer.setActive(true);
|
1978 |
offer.setActive(true);
|