| Line 237... |
Line 237... |
| 237 |
|
237 |
|
| 238 |
private void addVendorPricingIfMissing(int itemId, int vendorId) throws ProfitMandiBusinessException {
|
238 |
private void addVendorPricingIfMissing(int itemId, int vendorId) throws ProfitMandiBusinessException {
|
| 239 |
Supplier supplier = supplierRepository.selectById(vendorId);
|
239 |
Supplier supplier = supplierRepository.selectById(vendorId);
|
| 240 |
Item item = itemRepository.selectById(itemId);
|
240 |
Item item = itemRepository.selectById(itemId);
|
| 241 |
int vendorWithPricing = 0;
|
241 |
int vendorWithPricing = 0;
|
| 242 |
if (supplier.isInternal() && item.getBrand().equals("Samsung")) {
|
242 |
if (supplier.isInternal() && (item.getBrand().equals("Samsung") || item.getCategoryId() != 10006)) {
|
| 243 |
VendorPriceCircularModel vendorPriceCircularModel = vendorCatalogPricingLogRepository.getVendorPriceOnDate(vendorId, item.getCatalogItemId(), LocalDate.now());
|
243 |
VendorPriceCircularModel vendorPriceCircularModel = vendorCatalogPricingLogRepository.getVendorPriceOnDate(vendorId, item.getCatalogItemId(), LocalDate.now());
|
| 244 |
LOGGER.info("VendorPriceCircularModel - {}", vendorPriceCircularModel);
|
244 |
LOGGER.info("VendorPriceCircularModel - {}", vendorPriceCircularModel);
|
| 245 |
if (vendorPriceCircularModel == null) {
|
245 |
if (vendorPriceCircularModel == null) {
|
| 246 |
if (item.getBrand().equals("Samsung")) {
|
246 |
if (item.getBrand().equals("Samsung")) {
|
| 247 |
//BSB
|
247 |
//BSB
|
| 248 |
vendorWithPricing = 334;
|
248 |
vendorWithPricing = 334;
|
| - |
|
249 |
} else if (item.getCategoryId() != 10006) {
|
| - |
|
250 |
vendorWithPricing = vendorCatalogPricingLogRepository.selectByCatalogId(item.getCatalogItemId(), VendorCatalogPricingStatus.APPROVED).stream().map(x -> x.getVendorId())
|
| - |
|
251 |
.findFirst().orElse(null);
|
| 249 |
}
|
252 |
}
|
| 250 |
VendorPriceCircularModel existingPriceCircular = vendorCatalogPricingLogRepository.getVendorPriceOnDate(vendorWithPricing, item.getCatalogItemId(), LocalDate.now());
|
253 |
VendorPriceCircularModel existingPriceCircular = vendorCatalogPricingLogRepository.getVendorPriceOnDate(vendorWithPricing, item.getCatalogItemId(), LocalDate.now());
|
| 251 |
LOGGER.info("Existing price circular - {}", existingPriceCircular);
|
254 |
LOGGER.info("Existing price circular - {}", existingPriceCircular);
|
| 252 |
if (existingPriceCircular == null) {
|
255 |
if (existingPriceCircular == null) {
|
| 253 |
throw new ProfitMandiBusinessException("Pricing missing for vendor - " + vendorId, "Pricing missing for vendor - " + vendorId, "Pricing missing for vendor - " + vendorId);
|
256 |
throw new ProfitMandiBusinessException("Pricing missing for vendor - " + vendorId, "Pricing missing for vendor - " + vendorId, "Pricing missing for vendor - " + vendorId);
|