| 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.Item;
|
| 60 |
import com.spice.profitmandi.dao.entity.catalog.Offer;
|
61 |
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.OfferPartner;
|
| 62 |
import com.spice.profitmandi.dao.entity.catalog.Offermargin;
|
63 |
import com.spice.profitmandi.dao.entity.catalog.Offermargin;
|
| 63 |
import com.spice.profitmandi.dao.entity.cs.Position;
|
64 |
import com.spice.profitmandi.dao.entity.cs.Position;
|
| 64 |
import com.spice.profitmandi.dao.entity.dtr.Document;
|
65 |
import com.spice.profitmandi.dao.entity.dtr.Document;
|
| Line 66... |
Line 67... |
| 66 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
67 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
| 67 |
import com.spice.profitmandi.dao.entity.fofo.PartnerDailyInvestment;
|
68 |
import com.spice.profitmandi.dao.entity.fofo.PartnerDailyInvestment;
|
| 68 |
import com.spice.profitmandi.dao.entity.fofo.PartnerTargetDetails;
|
69 |
import com.spice.profitmandi.dao.entity.fofo.PartnerTargetDetails;
|
| 69 |
import com.spice.profitmandi.dao.entity.fofo.PartnerType;
|
70 |
import com.spice.profitmandi.dao.entity.fofo.PartnerType;
|
| 70 |
import com.spice.profitmandi.dao.entity.user.Lead;
|
71 |
import com.spice.profitmandi.dao.entity.user.Lead;
|
| - |
|
72 |
import com.spice.profitmandi.dao.enumuration.catalog.ItemCriteriaType;
|
| 71 |
import com.spice.profitmandi.dao.enumuration.cs.EscalationType;
|
73 |
import com.spice.profitmandi.dao.enumuration.cs.EscalationType;
|
| 72 |
import com.spice.profitmandi.dao.enumuration.dtr.LeadStatus;
|
74 |
import com.spice.profitmandi.dao.enumuration.dtr.LeadStatus;
|
| 73 |
import com.spice.profitmandi.dao.model.CreateOfferRequest;
|
75 |
import com.spice.profitmandi.dao.model.CreateOfferRequest;
|
| - |
|
76 |
import com.spice.profitmandi.dao.model.ItemTypeParams;
|
| 74 |
import com.spice.profitmandi.dao.model.PartnerDetailModel;
|
77 |
import com.spice.profitmandi.dao.model.PartnerDetailModel;
|
| 75 |
import com.spice.profitmandi.dao.model.SimpleCampaign;
|
78 |
import com.spice.profitmandi.dao.model.SimpleCampaign;
|
| 76 |
import com.spice.profitmandi.dao.model.SimpleCampaignParams;
|
79 |
import com.spice.profitmandi.dao.model.SimpleCampaignParams;
|
| 77 |
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
|
80 |
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
|
| 78 |
import com.spice.profitmandi.dao.repository.auth.MenuCategoryRepository;
|
81 |
import com.spice.profitmandi.dao.repository.auth.MenuCategoryRepository;
|
| 79 |
import com.spice.profitmandi.dao.repository.auth.MenuRepository;
|
82 |
import com.spice.profitmandi.dao.repository.auth.MenuRepository;
|
| - |
|
83 |
import com.spice.profitmandi.dao.repository.catalog.ItemRepository;
|
| 80 |
import com.spice.profitmandi.dao.repository.catalog.OfferMarginRepository;
|
84 |
import com.spice.profitmandi.dao.repository.catalog.OfferMarginRepository;
|
| 81 |
import com.spice.profitmandi.dao.repository.catalog.OfferPartnerRepository;
|
85 |
import com.spice.profitmandi.dao.repository.catalog.OfferPartnerRepository;
|
| 82 |
import com.spice.profitmandi.dao.repository.catalog.OfferRepository;
|
86 |
import com.spice.profitmandi.dao.repository.catalog.OfferRepository;
|
| 83 |
import com.spice.profitmandi.dao.repository.cs.CsService;
|
87 |
import com.spice.profitmandi.dao.repository.cs.CsService;
|
| 84 |
import com.spice.profitmandi.dao.repository.cs.PartnersPositionRepository;
|
88 |
import com.spice.profitmandi.dao.repository.cs.PartnersPositionRepository;
|
| Line 227... |
Line 231... |
| 227 |
@Autowired
|
231 |
@Autowired
|
| 228 |
private OfferPartnerRepository offerPartnerRepository;
|
232 |
private OfferPartnerRepository offerPartnerRepository;
|
| 229 |
|
233 |
|
| 230 |
@Autowired
|
234 |
@Autowired
|
| 231 |
private OfferMarginRepository offerMarginRepository;
|
235 |
private OfferMarginRepository offerMarginRepository;
|
| - |
|
236 |
@Autowired
|
| - |
|
237 |
private ItemRepository itemRepository;
|
| 232 |
|
238 |
|
| 233 |
private static final Logger LOGGER = LogManager.getLogger(DashboardController.class);
|
239 |
private static final Logger LOGGER = LogManager.getLogger(DashboardController.class);
|
| 234 |
|
240 |
|
| 235 |
@RequestMapping(value = "/12dashboard34", method = RequestMethod.GET)
|
241 |
@RequestMapping(value = "/12dashboard34", method = RequestMethod.GET)
|
| 236 |
public String dashboard1(HttpServletRequest request, Model model, @RequestParam int fofoId) throws Exception {
|
242 |
public String dashboard1(HttpServletRequest request, Model model, @RequestParam int fofoId) throws Exception {
|
| Line 540... |
Line 546... |
| 540 |
} else {
|
546 |
} else {
|
| 541 |
return "dashboard1";
|
547 |
return "dashboard1";
|
| 542 |
}
|
548 |
}
|
| 543 |
}
|
549 |
}
|
| 544 |
|
550 |
|
| - |
|
551 |
@RequestMapping(value = "/getOfferMargins", method = RequestMethod.GET)
|
| - |
|
552 |
public String getOfferMargins(HttpServletRequest request,
|
| - |
|
553 |
@RequestParam(name = "offerId", defaultValue = "0") int offerId, Model model) throws Exception {
|
| - |
|
554 |
Offer offer = offerRepository.selectById(offerId);
|
| - |
|
555 |
|
| - |
|
556 |
LOGGER.info("offerId" + offer.getId());
|
| - |
|
557 |
|
| - |
|
558 |
Map<Integer, Double> value = offerRepository.selectSumOfferByRetailer(offer.getStartDateTime(),
|
| - |
|
559 |
offer.getEndDateTime(), 0, offer, true);
|
| - |
|
560 |
|
| - |
|
561 |
LOGGER.info("value" + value);
|
| - |
|
562 |
List<Offermargin> offerMargin = offerMarginRepository.selectByOfferId(offerId);
|
| - |
|
563 |
|
| - |
|
564 |
ItemTypeParams scp = gson.fromJson(offer.getItemParam(), ItemTypeParams.class);
|
| - |
|
565 |
if (offer.getItemCriteria().equals(ItemCriteriaType.Multiple_Brand)) {
|
| - |
|
566 |
List<String> brands = scp.getBrands();
|
| - |
|
567 |
model.addAttribute("brands", brands);
|
| - |
|
568 |
}
|
| - |
|
569 |
if (offer.getItemCriteria().equals(ItemCriteriaType.Item_Model)) {
|
| - |
|
570 |
List<Integer> catalogIds = scp.getCatalogId();
|
| - |
|
571 |
List<Item> newList = new ArrayList<>();
|
| - |
|
572 |
Set<Integer> catalogId = new HashSet<>();
|
| - |
|
573 |
List<Item> items = itemRepository.selectAllByCatalogIds(catalogIds.stream().collect(Collectors.toSet()));
|
| - |
|
574 |
for (Item item : items) {
|
| - |
|
575 |
if (catalogId.add(item.getCatalogItemId())) {
|
| - |
|
576 |
newList.add(item);
|
| - |
|
577 |
}
|
| - |
|
578 |
}
|
| - |
|
579 |
model.addAttribute("items", newList);
|
| - |
|
580 |
}
|
| - |
|
581 |
|
| - |
|
582 |
model.addAttribute("offerMargin", offerMargin);
|
| - |
|
583 |
model.addAttribute("offer", offer);
|
| - |
|
584 |
|
| - |
|
585 |
return "offer_margin_detail_partner";
|
| - |
|
586 |
|
| - |
|
587 |
}
|
| - |
|
588 |
|
| 545 |
private ChartModel getBrandChart(int fofoId) {
|
589 |
private ChartModel getBrandChart(int fofoId) {
|
| 546 |
|
590 |
|
| 547 |
LocalDateTime curDate = LocalDate.now().atStartOfDay();
|
591 |
LocalDateTime curDate = LocalDate.now().atStartOfDay();
|
| 548 |
|
592 |
|
| 549 |
LOGGER.info("cur Date" + curDate.withDayOfMonth(1));
|
593 |
LOGGER.info("cur Date" + curDate.withDayOfMonth(1));
|