| Line 55... |
Line 55... |
| 55 |
import com.spice.profitmandi.common.model.TitleModel;
|
55 |
import com.spice.profitmandi.common.model.TitleModel;
|
| 56 |
import com.spice.profitmandi.common.web.util.ResponseSender;
|
56 |
import com.spice.profitmandi.common.web.util.ResponseSender;
|
| 57 |
import com.spice.profitmandi.dao.Interface.Campaign;
|
57 |
import com.spice.profitmandi.dao.Interface.Campaign;
|
| 58 |
import com.spice.profitmandi.dao.entity.auth.AuthUser;
|
58 |
import com.spice.profitmandi.dao.entity.auth.AuthUser;
|
| 59 |
import com.spice.profitmandi.dao.entity.auth.Menu;
|
59 |
import com.spice.profitmandi.dao.entity.auth.Menu;
|
| - |
|
60 |
import com.spice.profitmandi.dao.entity.catalog.Offer;
|
| - |
|
61 |
import com.spice.profitmandi.dao.entity.catalog.OfferPartner;
|
| - |
|
62 |
import com.spice.profitmandi.dao.entity.catalog.Offermargin;
|
| 60 |
import com.spice.profitmandi.dao.entity.cs.Position;
|
63 |
import com.spice.profitmandi.dao.entity.cs.Position;
|
| 61 |
import com.spice.profitmandi.dao.entity.dtr.Document;
|
64 |
import com.spice.profitmandi.dao.entity.dtr.Document;
|
| 62 |
import com.spice.profitmandi.dao.entity.dtr.NotificationCampaign;
|
65 |
import com.spice.profitmandi.dao.entity.dtr.NotificationCampaign;
|
| 63 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
66 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
| 64 |
import com.spice.profitmandi.dao.entity.fofo.PartnerDailyInvestment;
|
67 |
import com.spice.profitmandi.dao.entity.fofo.PartnerDailyInvestment;
|
| 65 |
import com.spice.profitmandi.dao.entity.fofo.PartnerTargetDetails;
|
68 |
import com.spice.profitmandi.dao.entity.fofo.PartnerTargetDetails;
|
| 66 |
import com.spice.profitmandi.dao.entity.fofo.PartnerType;
|
69 |
import com.spice.profitmandi.dao.entity.fofo.PartnerType;
|
| 67 |
import com.spice.profitmandi.dao.entity.user.Lead;
|
70 |
import com.spice.profitmandi.dao.entity.user.Lead;
|
| 68 |
import com.spice.profitmandi.dao.enumuration.cs.EscalationType;
|
71 |
import com.spice.profitmandi.dao.enumuration.cs.EscalationType;
|
| 69 |
import com.spice.profitmandi.dao.enumuration.dtr.LeadStatus;
|
72 |
import com.spice.profitmandi.dao.enumuration.dtr.LeadStatus;
|
| - |
|
73 |
import com.spice.profitmandi.dao.model.CreateOfferRequest;
|
| 70 |
import com.spice.profitmandi.dao.model.PartnerDetailModel;
|
74 |
import com.spice.profitmandi.dao.model.PartnerDetailModel;
|
| 71 |
import com.spice.profitmandi.dao.model.SimpleCampaign;
|
75 |
import com.spice.profitmandi.dao.model.SimpleCampaign;
|
| 72 |
import com.spice.profitmandi.dao.model.SimpleCampaignParams;
|
76 |
import com.spice.profitmandi.dao.model.SimpleCampaignParams;
|
| 73 |
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
|
77 |
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
|
| 74 |
import com.spice.profitmandi.dao.repository.auth.MenuCategoryRepository;
|
78 |
import com.spice.profitmandi.dao.repository.auth.MenuCategoryRepository;
|
| Line 438... |
Line 442... |
| 438 |
10, ProfitMandiConstants.CUTOFF_INVESTMENT));
|
442 |
10, ProfitMandiConstants.CUTOFF_INVESTMENT));
|
| 439 |
|
443 |
|
| 440 |
// Hardcoded for valentine
|
444 |
// Hardcoded for valentine
|
| 441 |
// Hardcoded for valentine
|
445 |
// Hardcoded for valentine
|
| 442 |
|
446 |
|
| 443 |
/*List<Offer> offers = offerRepository.selectAllBeforeEndDate();
|
447 |
List<Offer> offers = offerRepository.selectAllBeforeEndDate();
|
| 444 |
if (!offers.isEmpty()) {
|
448 |
if (!offers.isEmpty()) {
|
| 445 |
List<CreateOfferRequest> cors = new ArrayList<>();
|
449 |
List<CreateOfferRequest> cors = new ArrayList<>();
|
| 446 |
for (Offer offer : offers) {
|
450 |
for (Offer offer : offers) {
|
| 447 |
|
451 |
|
| 448 |
List<OfferPartner> offerPartners = offerPartnerRepository.selectByOfferId(offer.getId());
|
452 |
List<OfferPartner> offerPartners = offerPartnerRepository.selectByOfferId(offer.getId());
|
| Line 450... |
Line 454... |
| 450 |
for (OfferPartner offerPartner : offerPartners) {
|
454 |
for (OfferPartner offerPartner : offerPartners) {
|
| 451 |
|
455 |
|
| 452 |
if (offerPartner.getFofoId() == loginDetails.getFofoId()) {
|
456 |
if (offerPartner.getFofoId() == loginDetails.getFofoId()) {
|
| 453 |
if (LocalDateTime.now().isAfter(offer.getStartDateTime())
|
457 |
if (LocalDateTime.now().isAfter(offer.getStartDateTime())
|
| 454 |
&& LocalDateTime.now().isBefore(offer.getEndDateTime())) {
|
458 |
&& LocalDateTime.now().isBefore(offer.getEndDateTime())) {
|
| 455 |
LocalDateTime cur = LocalDate.now().minusMonths(4).atStartOfDay();
|
459 |
LocalDateTime cur = LocalDate.now().minusMonths(2).atStartOfDay();
|
| 456 |
LOGGER.info("value" + cur);
|
460 |
LOGGER.info("value" + cur);
|
| 457 |
Map<Integer, Double> value = offerRepository.selectSumOfferByRetailer(
|
461 |
Map<Integer, Double> value = offerRepository.selectSumOfferByRetailer(
|
| 458 |
offer.getStartDateTime(), offer.getEndDateTime(), loginDetails.getFofoId(),
|
462 |
offer.getStartDateTime(), offer.getEndDateTime(),
|
| 459 |
offer, true);
|
463 |
loginDetails.getFofoId(), offer, true);
|
| 460 |
CreateOfferRequest createOfferRequest = new CreateOfferRequest();
|
464 |
CreateOfferRequest createOfferRequest = new CreateOfferRequest();
|
| 461 |
List<Offermargin> offerMargins = offerMarginRepository
|
465 |
List<Offermargin> offerMargins = offerMarginRepository
|
| 462 |
.selectByOfferId(offer.getId());
|
466 |
.selectByOfferId(offer.getId());
|
| 463 |
LOGGER.info("value" + offer.getId());
|
467 |
LOGGER.info("value" + offer.getId());
|
| 464 |
LOGGER.info("value" + value);
|
468 |
LOGGER.info("value" + value);
|
| 465 |
for (Offermargin om : offerMargins) {
|
469 |
for (Offermargin om : offerMargins) {
|
| 466 |
if (value.get(loginDetails.getFofoId()) <= om.getValue()) {
|
470 |
if (value.get(loginDetails.getFofoId()) <= om.getValue()) {
|
| 467 |
createOfferRequest.setMargin(om.getMargin());
|
471 |
createOfferRequest.setMargin(om.getMargin());
|
| 468 |
createOfferRequest.setShortAmount(
|
472 |
createOfferRequest.setShortAmount(
|
| 469 |
om.getValue() - value.get(loginDetails.getFofoId()));
|
473 |
om.getValue() - value.get(loginDetails.getFofoId()));
|
| - |
|
474 |
|
| - |
|
475 |
|
| 470 |
break;
|
476 |
break;
|
| 471 |
} else {
|
477 |
} else {
|
| 472 |
createOfferRequest.setMargin(om.getMargin());
|
478 |
createOfferRequest.setMargin(om.getMargin());
|
| 473 |
|
479 |
|
| 474 |
}
|
480 |
}
|
| 475 |
|
481 |
|
| 476 |
}
|
482 |
}
|
| 477 |
|
483 |
|
| 478 |
createOfferRequest.setName(offer.getName());
|
484 |
createOfferRequest.setName(offer.getName());
|
| Line 490... |
Line 496... |
| 490 |
|
496 |
|
| 491 |
}
|
497 |
}
|
| 492 |
}
|
498 |
}
|
| 493 |
model.addAttribute("offers", cors);
|
499 |
model.addAttribute("offers", cors);
|
| 494 |
|
500 |
|
| 495 |
}*/
|
501 |
}
|
| 496 |
|
502 |
|
| 497 |
} catch (ProfitMandiBusinessException e) {
|
503 |
} catch (ProfitMandiBusinessException e) {
|
| 498 |
LOGGER.error("FofoStore Code not found of fofoId {}", loginDetails.getFofoId());
|
504 |
LOGGER.error("FofoStore Code not found of fofoId {}", loginDetails.getFofoId());
|
| 499 |
|
505 |
|
| 500 |
}
|
506 |
}
|