| Line 145... |
Line 145... |
| 145 |
@Autowired
|
145 |
@Autowired
|
| 146 |
private CategoryRepository categoryRepository;
|
146 |
private CategoryRepository categoryRepository;
|
| 147 |
|
147 |
|
| 148 |
@Autowired
|
148 |
@Autowired
|
| 149 |
PriceCircularService priceCircularService;
|
149 |
PriceCircularService priceCircularService;
|
| 150 |
@Autowired
|
150 |
@Autowired
|
| 151 |
private FofoOrderRepository fofoOrderRepository;
|
151 |
private FofoOrderRepository fofoOrderRepository;
|
| 152 |
@Autowired
|
152 |
@Autowired
|
| 153 |
private PurchaseRepository purchaseRepository;
|
153 |
private PurchaseRepository purchaseRepository;
|
| 154 |
|
154 |
|
| 155 |
|
155 |
|
| 156 |
|
- |
|
| 157 |
@Autowired
|
156 |
@Autowired
|
| 158 |
private Gson gson;
|
157 |
private Gson gson;
|
| 159 |
|
158 |
|
| 160 |
private boolean getAccess(String emailId) {
|
159 |
private boolean getAccess(String emailId) {
|
| 161 |
|
160 |
|
| Line 196... |
Line 195... |
| 196 |
if (!roleManager.isAdmin(loginDetails.getRoleIds())) {
|
195 |
if (!roleManager.isAdmin(loginDetails.getRoleIds())) {
|
| 197 |
throw new ProfitMandiBusinessException("User", loginDetails.getEmailId(), "Unauthorised access");
|
196 |
throw new ProfitMandiBusinessException("User", loginDetails.getEmailId(), "Unauthorised access");
|
| 198 |
}
|
197 |
}
|
| 199 |
return "update-schemes-page";
|
198 |
return "update-schemes-page";
|
| 200 |
}
|
199 |
}
|
| - |
|
200 |
|
| 201 |
@RequestMapping(value = "/schemes/process-sellout", method = RequestMethod.POST)
|
201 |
@RequestMapping(value = "/schemes/process-sellout", method = RequestMethod.POST)
|
| 202 |
public String processSellout(HttpServletRequest request, Model model, @RequestBody List<String> invoiceNumbers) throws Exception {
|
202 |
public String processSellout(HttpServletRequest request, Model model, @RequestBody List<String> invoiceNumbers) throws Exception {
|
| 203 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
203 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 204 |
if (!roleManager.isAdmin(loginDetails.getRoleIds())) {
|
204 |
if (!roleManager.isAdmin(loginDetails.getRoleIds())) {
|
| 205 |
throw new ProfitMandiBusinessException("User", loginDetails.getEmailId(), "Unauthorised access");
|
205 |
throw new ProfitMandiBusinessException("User", loginDetails.getEmailId(), "Unauthorised access");
|
| Line 620... |
Line 620... |
| 620 |
Map<Integer, Scheme> schemeMap = new HashMap<>();
|
620 |
Map<Integer, Scheme> schemeMap = new HashMap<>();
|
| 621 |
double netEarnings = 0;
|
621 |
double netEarnings = 0;
|
| 622 |
if (inventoryItem != null) {
|
622 |
if (inventoryItem != null) {
|
| 623 |
// Offer payout
|
623 |
// Offer payout
|
| 624 |
List<OfferPayout> offerPayouts = offerPayoutRepository.selectAllBySerialNumber(fofoId, searchImei);
|
624 |
List<OfferPayout> offerPayouts = offerPayoutRepository.selectAllBySerialNumber(fofoId, searchImei);
|
| 625 |
Map<Integer, CreateOfferRequest> offerRequestMap = offerPayouts.stream().map(x->x.getOfferId())
|
625 |
Map<Integer, CreateOfferRequest> offerRequestMap = offerPayouts.stream().map(x -> x.getOfferId())
|
| 626 |
.distinct().map(offerId -> offerService.getOffer(fofoId, offerId.intValue() )).collect(Collectors.toMap(x -> x.getId(), x -> x));
|
626 |
.distinct().map(offerId -> offerService.getOffer(fofoId, offerId.intValue())).collect(Collectors.toMap(x -> x.getId(), x -> x));
|
| 627 |
|
627 |
|
| 628 |
schemeInOuts = schemeInOutRepository.selectByInventoryItemIds(new HashSet<>(Arrays.asList(inventoryItem.getId())));
|
628 |
schemeInOuts = schemeInOutRepository.selectByInventoryItemIds(new HashSet<>(Arrays.asList(inventoryItem.getId())));
|
| 629 |
|
629 |
|
| 630 |
if (!schemeInOuts.isEmpty()) {
|
630 |
if (!schemeInOuts.isEmpty()) {
|
| 631 |
netEarnings += schemeInOuts.stream().filter(x -> x.getStatus().equals(SchemePayoutStatus.CREDITED)).collect(Collectors.summingDouble(x -> x.getAmount()));
|
631 |
netEarnings += schemeInOuts.stream().filter(x -> x.getStatus().equals(SchemePayoutStatus.CREDITED)).collect(Collectors.summingDouble(x -> x.getAmount()));
|
| Line 738... |
Line 738... |
| 738 |
model.addAttribute("schemeRegionMap", schemeRegionMap);
|
738 |
model.addAttribute("schemeRegionMap", schemeRegionMap);
|
| 739 |
return "schemes";
|
739 |
return "schemes";
|
| 740 |
} else {
|
740 |
} else {
|
| 741 |
PriceCircularModel priceCircularModel = priceCircularService.getPriceCircularByOffer(loginDetails.getFofoId(), Arrays.asList(searchModel), date);
|
741 |
PriceCircularModel priceCircularModel = priceCircularService.getPriceCircularByOffer(loginDetails.getFofoId(), Arrays.asList(searchModel), date);
|
| 742 |
FofoStore fs = fofoStoreRepository.selectByRetailerId(loginDetails.getFofoId());
|
742 |
FofoStore fs = fofoStoreRepository.selectByRetailerId(loginDetails.getFofoId());
|
| 743 |
priceDropController.getPriceCircularView(priceCircularModel, model,fs.getCode());
|
743 |
priceDropController.getPriceCircularView(priceCircularModel, model, fs.getCode());
|
| 744 |
}
|
744 |
}
|
| 745 |
|
745 |
|
| 746 |
} else if (org.apache.commons.lang3.StringUtils.isNotEmpty(searchImei)) {
|
746 |
} else if (org.apache.commons.lang3.StringUtils.isNotEmpty(searchImei)) {
|
| 747 |
|
747 |
|
| 748 |
LOGGER.info("searchImei" + searchImei);
|
748 |
LOGGER.info("searchImei" + searchImei);
|
| Line 1435... |
Line 1435... |
| 1435 |
for (CustomerOffer customerOffer : customerOffers) {
|
1435 |
for (CustomerOffer customerOffer : customerOffers) {
|
| 1436 |
|
1436 |
|
| 1437 |
LOGGER.info("ss" + searchModel);
|
1437 |
LOGGER.info("ss" + searchModel);
|
| 1438 |
|
1438 |
|
| 1439 |
if (!StringUtils.isEmpty(customerOffer.getPartnerCriteria())) {
|
1439 |
if (!StringUtils.isEmpty(customerOffer.getPartnerCriteria())) {
|
| 1440 |
String partnerCriteria = retailerService.getPartnerCriteriaString(
|
- |
|
| 1441 |
gson.fromJson(customerOffer.getPartnerCriteria(), PartnerCriteria.class));
|
1440 |
String partnerCriteria = offerService.getPartnerCriteriaString(gson.fromJson(customerOffer.getPartnerCriteria(), PartnerCriteria.class));
|
| 1442 |
customerOffer.setPartnerCriteriaString(partnerCriteria);
|
1441 |
customerOffer.setPartnerCriteriaString(partnerCriteria);
|
| 1443 |
}
|
1442 |
}
|
| 1444 |
|
1443 |
|
| 1445 |
}
|
1444 |
}
|
| 1446 |
|
1445 |
|