| Line 1... |
Line 1... |
| 1 |
package com.spice.profitmandi.web.controller;
|
1 |
package com.spice.profitmandi.web.controller;
|
| 2 |
|
2 |
|
| - |
|
3 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| 3 |
import com.spice.profitmandi.common.model.ItemDescriptionModel;
|
4 |
import com.spice.profitmandi.common.model.ItemDescriptionModel;
|
| 4 |
import com.spice.profitmandi.dao.entity.auth.AuthUser;
|
5 |
import com.spice.profitmandi.dao.entity.auth.AuthUser;
|
| 5 |
import com.spice.profitmandi.dao.entity.catalog.Item;
|
6 |
import com.spice.profitmandi.dao.entity.catalog.Item;
|
| 6 |
import com.spice.profitmandi.dao.entity.inventory.Vendor;
|
7 |
import com.spice.profitmandi.dao.entity.inventory.Vendor;
|
| 7 |
import com.spice.profitmandi.dao.entity.inventory.VendorCatalogPricing;
|
8 |
import com.spice.profitmandi.dao.entity.inventory.VendorCatalogPricing;
|
| Line 221... |
Line 222... |
| 221 |
}
|
222 |
}
|
| 222 |
|
223 |
|
| 223 |
@RequestMapping(value = "/getPricing", method = RequestMethod.GET)
|
224 |
@RequestMapping(value = "/getPricing", method = RequestMethod.GET)
|
| 224 |
public String getPricing(HttpServletRequest request, @RequestParam int vendorId, @RequestParam int itemId, @RequestParam LocalDate onDate, Model model) throws Exception {
|
225 |
public String getPricing(HttpServletRequest request, @RequestParam int vendorId, @RequestParam int itemId, @RequestParam LocalDate onDate, Model model) throws Exception {
|
| 225 |
|
226 |
|
| 226 |
Item item = itemRepository.selectById(itemId);
|
227 |
vendorId = this.getVendorId(itemId, vendorId);
|
| 227 |
if (vendorId==406 || vendorId == 419) {
|
- |
|
| 228 |
vendorId = 325;
|
- |
|
| 229 |
}
|
- |
|
| 230 |
VendorPriceCircularModel vendorPriceCircularModel = vendorCatalogPricingLogRepository.getVendorPriceOnDate(vendorId, item.getCatalogItemId(), onDate);
|
228 |
VendorPriceCircularModel vendorPriceCircularModel = vendorCatalogPricingLogRepository.getVendorPriceOnDate(vendorId, item.getCatalogItemId(), onDate);
|
| 231 |
|
229 |
|
| 232 |
LOGGER.info("vendorCatalogPricing {}", vendorPriceCircularModel);
|
230 |
LOGGER.info("vendorCatalogPricing {}", vendorPriceCircularModel);
|
| 233 |
|
231 |
|
| 234 |
|
- |
|
| 235 |
model.addAttribute("response1", mvcResponseSender.createResponseString(vendorPriceCircularModel));
|
232 |
model.addAttribute("response1", mvcResponseSender.createResponseString(vendorPriceCircularModel));
|
| 236 |
|
233 |
|
| 237 |
return "response";
|
234 |
return "response";
|
| 238 |
|
235 |
|
| 239 |
}
|
236 |
}
|
| 240 |
|
237 |
|
| - |
|
238 |
private int getVendorId(int itemId, int vendorId) throws ProfitMandiBusinessException {
|
| - |
|
239 |
Item item = itemRepository.selectById(itemId);
|
| - |
|
240 |
if (vendorId == 406 || vendorId == 419) {
|
| - |
|
241 |
if (item.getBrand().equals("Oppo")) {
|
| - |
|
242 |
//RS Distributions
|
| - |
|
243 |
vendorId = 438;
|
| - |
|
244 |
} else if (item.getBrand().equals("Vivo")) {
|
| - |
|
245 |
//Nexg
|
| - |
|
246 |
vendorId = 393;
|
| - |
|
247 |
} else {
|
| - |
|
248 |
//NSSPL Delhi
|
| - |
|
249 |
vendorId = 325;
|
| - |
|
250 |
}
|
| - |
|
251 |
}
|
| - |
|
252 |
return vendorId;
|
| - |
|
253 |
}
|
| - |
|
254 |
|
| 241 |
@RequestMapping(value = "/vendorItem", method = RequestMethod.GET)
|
255 |
@RequestMapping(value = "/vendorItem", method = RequestMethod.GET)
|
| 242 |
public String getItemPricing(HttpServletRequest request, Model model, @RequestParam int vendorId, @RequestParam String query) throws Throwable {
|
256 |
public String getItemPricing(HttpServletRequest request, Model model, @RequestParam int vendorId,
|
| - |
|
257 |
@RequestParam String query) throws Throwable {
|
| 243 |
String query1 = query.toLowerCase();
|
258 |
String query1 = query.toLowerCase();
|
| 244 |
//UK or rudrapur
|
259 |
int itemId = 0;
|
| - |
|
260 |
try {
|
| - |
|
261 |
itemId = Integer.parseInt(query1);
|
| 245 |
if (vendorId==406 || vendorId == 419) {
|
262 |
vendorId = this.getVendorId(itemId, vendorId);
|
| 246 |
vendorId = 325;
|
263 |
} catch (Exception e) {
|
| - |
|
264 |
//
|
| 247 |
}
|
265 |
}
|
| - |
|
266 |
//UK or rudrapu
|
| 248 |
List<ItemDescriptionModel> partnersItemDescription = warehouseService.getAllPartnerItemStringDescription(vendorId).parallelStream().filter(x -> x.getItemDescription().toLowerCase().matches(".*?" + query1 + ".*?")).collect(Collectors.toList());
|
267 |
List<ItemDescriptionModel> partnersItemDescription = warehouseService.getAllPartnerItemStringDescription(vendorId).parallelStream().filter(x -> x.getItemDescription().toLowerCase().matches(".*?" + query1 + ".*?")).collect(Collectors.toList());
|
| 249 |
LOGGER.info("partnersItemDescription" + partnersItemDescription);
|
268 |
LOGGER.info("partnersItemDescription" + partnersItemDescription);
|
| 250 |
|
269 |
|
| 251 |
model.addAttribute("response1", mvcResponseSender.createResponseString(partnersItemDescription));
|
270 |
model.addAttribute("response1", mvcResponseSender.createResponseString(partnersItemDescription));
|
| 252 |
return "response";
|
271 |
return "response";
|