| Line 7... |
Line 7... |
| 7 |
import com.spice.profitmandi.common.model.CustomRetailer;
|
7 |
import com.spice.profitmandi.common.model.CustomRetailer;
|
| 8 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
8 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
| 9 |
import com.spice.profitmandi.common.model.SendNotificationModel;
|
9 |
import com.spice.profitmandi.common.model.SendNotificationModel;
|
| 10 |
import com.spice.profitmandi.common.util.FormattingUtils;
|
10 |
import com.spice.profitmandi.common.util.FormattingUtils;
|
| 11 |
import com.spice.profitmandi.common.web.util.ResponseSender;
|
11 |
import com.spice.profitmandi.common.web.util.ResponseSender;
|
| - |
|
12 |
import com.spice.profitmandi.dao.entity.catalog.Catalog;
|
| 12 |
import com.spice.profitmandi.dao.entity.catalog.Offer;
|
13 |
import com.spice.profitmandi.dao.entity.catalog.Offer;
|
| 13 |
import com.spice.profitmandi.dao.entity.fofo.PartnerType;
|
14 |
import com.spice.profitmandi.dao.entity.fofo.PartnerType;
|
| 14 |
import com.spice.profitmandi.dao.enumuration.catalog.ItemCriteriaType;
|
15 |
import com.spice.profitmandi.dao.enumuration.catalog.ItemCriteriaType;
|
| 15 |
import com.spice.profitmandi.dao.enumuration.catalog.OfferSchemeType;
|
16 |
import com.spice.profitmandi.dao.enumuration.catalog.OfferSchemeType;
|
| 16 |
import com.spice.profitmandi.dao.model.CreateOfferRequest;
|
17 |
import com.spice.profitmandi.dao.model.CreateOfferRequest;
|
| 17 |
import com.spice.profitmandi.dao.model.ItemCriteriaPayout;
|
18 |
import com.spice.profitmandi.dao.model.ItemCriteriaPayout;
|
| 18 |
import com.spice.profitmandi.dao.repository.catalog.ItemRepository;
|
19 |
import com.spice.profitmandi.dao.repository.catalog.*;
|
| 19 |
import com.spice.profitmandi.dao.repository.catalog.OfferMarginRepository;
|
- |
|
| 20 |
import com.spice.profitmandi.dao.repository.catalog.OfferPartnerRepository;
|
- |
|
| 21 |
import com.spice.profitmandi.dao.repository.catalog.OfferRepository;
|
- |
|
| 22 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
20 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
| 23 |
import com.spice.profitmandi.dao.repository.dtr.Mongo;
|
21 |
import com.spice.profitmandi.dao.repository.dtr.Mongo;
|
| 24 |
import com.spice.profitmandi.dao.repository.dtr.UserAccountRepository;
|
22 |
import com.spice.profitmandi.dao.repository.dtr.UserAccountRepository;
|
| 25 |
import com.spice.profitmandi.dao.repository.fofo.PartnerTypeChangeService;
|
23 |
import com.spice.profitmandi.dao.repository.fofo.PartnerTypeChangeService;
|
| 26 |
import com.spice.profitmandi.service.NotificationService;
|
24 |
import com.spice.profitmandi.service.NotificationService;
|
| Line 37... |
Line 35... |
| 37 |
import org.apache.commons.io.output.ByteArrayOutputStream;
|
35 |
import org.apache.commons.io.output.ByteArrayOutputStream;
|
| 38 |
import org.apache.logging.log4j.LogManager;
|
36 |
import org.apache.logging.log4j.LogManager;
|
| 39 |
import org.apache.logging.log4j.Logger;
|
37 |
import org.apache.logging.log4j.Logger;
|
| 40 |
import org.apache.velocity.app.VelocityEngine;
|
38 |
import org.apache.velocity.app.VelocityEngine;
|
| 41 |
import org.springframework.beans.factory.annotation.Autowired;
|
39 |
import org.springframework.beans.factory.annotation.Autowired;
|
| - |
|
40 |
import org.springframework.beans.factory.annotation.Qualifier;
|
| 42 |
import org.springframework.beans.factory.annotation.Value;
|
41 |
import org.springframework.beans.factory.annotation.Value;
|
| 43 |
import org.springframework.cache.CacheManager;
|
42 |
import org.springframework.cache.CacheManager;
|
| 44 |
import org.springframework.core.io.InputStreamResource;
|
43 |
import org.springframework.core.io.InputStreamResource;
|
| 45 |
import org.springframework.http.HttpHeaders;
|
44 |
import org.springframework.http.HttpHeaders;
|
| 46 |
import org.springframework.http.HttpStatus;
|
45 |
import org.springframework.http.HttpStatus;
|
| Line 121... |
Line 120... |
| 121 |
@Autowired
|
120 |
@Autowired
|
| 122 |
private VelocityEngine velocityEngine;
|
121 |
private VelocityEngine velocityEngine;
|
| 123 |
|
122 |
|
| 124 |
@Autowired
|
123 |
@Autowired
|
| 125 |
BrandsService brandsService;
|
124 |
BrandsService brandsService;
|
| - |
|
125 |
@Qualifier("catalogRepository")
|
| - |
|
126 |
@Autowired
|
| - |
|
127 |
private CatalogRepository catalogRepository;
|
| 126 |
|
128 |
|
| 127 |
@RequestMapping(value = "/getCreateOffer", method = RequestMethod.GET)
|
129 |
@RequestMapping(value = "/getCreateOffer", method = RequestMethod.GET)
|
| 128 |
public String getCreateOffer(HttpServletRequest request, Model model) throws ProfitMandiBusinessException {
|
130 |
public String getCreateOffer(HttpServletRequest request, Model model) throws ProfitMandiBusinessException {
|
| 129 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
131 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 130 |
List<Integer> fofoIds = fofoStoreRepository.selectActiveStores().stream().map(x -> x.getId())
|
132 |
List<Integer> fofoIds = fofoStoreRepository.selectActiveStores().stream().map(x -> x.getId())
|
| Line 226... |
Line 228... |
| 226 |
return;
|
228 |
return;
|
| 227 |
}
|
229 |
}
|
| 228 |
String fileName = "offer-" + offer.getId() + ".png";
|
230 |
String fileName = "offer-" + offer.getId() + ".png";
|
| 229 |
//String htmlFileName = fileName.replace("png", "html");
|
231 |
//String htmlFileName = fileName.replace("png", "html");
|
| 230 |
CreateOfferRequest createOfferRequest = offerService.getCreateOfferRequest(offer);
|
232 |
CreateOfferRequest createOfferRequest = offerService.getCreateOfferRequest(offer);
|
| - |
|
233 |
List<Integer> catalogIds = createOfferRequest.getItemCriteria().getCatalogIds();
|
| - |
|
234 |
if (catalogIds.size() > 0) {
|
| - |
|
235 |
Catalog catalog = catalogRepository.selectCatalogById(catalogIds.get(0));
|
| - |
|
236 |
if (catalog.getBrand().equals("Live Demo")) return;
|
| - |
|
237 |
}
|
| 231 |
SendNotificationModel sendNotificationModel = new SendNotificationModel();
|
238 |
SendNotificationModel sendNotificationModel = new SendNotificationModel();
|
| 232 |
sendNotificationModel.setCampaignName("SchemeOffer");
|
239 |
sendNotificationModel.setCampaignName("SchemeOffer");
|
| 233 |
sendNotificationModel.setTitle(offer.getName());
|
240 |
sendNotificationModel.setTitle(offer.getName());
|
| 234 |
sendNotificationModel.setMessage(createOfferRequest.getSchemeType().name() + " of select models, "
|
241 |
sendNotificationModel.setMessage(createOfferRequest.getSchemeType().name() + " of select models, "
|
| 235 |
+ FormattingUtils.formatDateMonth(offer.getStartDate()) + " to "
|
242 |
+ FormattingUtils.formatDateMonth(offer.getStartDate()) + " to "
|