| Line 285... |
Line 285... |
| 285 |
}
|
285 |
}
|
| 286 |
|
286 |
|
| 287 |
@RequestMapping(value = "/supplier/edit/{supplierId}", method = RequestMethod.GET)
|
287 |
@RequestMapping(value = "/supplier/edit/{supplierId}", method = RequestMethod.GET)
|
| 288 |
public String getEditSupplier(HttpServletRequest request, Model model, @PathVariable int supplierId) throws Exception {
|
288 |
public String getEditSupplier(HttpServletRequest request, Model model, @PathVariable int supplierId) throws Exception {
|
| 289 |
Supplier supplier = supplierRepository.selectById(supplierId);
|
289 |
Supplier supplier = supplierRepository.selectById(supplierId);
|
| 290 |
List<SellerWarehouse> sellerWarehouses = sellerWarehouseRepository.selectAll().stream()
|
- |
|
| 291 |
.filter(x -> x.getStatus() == WarehouseStatus.ACTIVE).collect(Collectors.toList());
|
- |
|
| 292 |
Map<Integer, WarehouseIdPrefixModel> warehouseIdAndState = new HashMap<>();
|
290 |
Map<Integer, WarehouseIdPrefixModel> warehouseIdAndState = new HashMap<>();
|
| 293 |
|
291 |
|
| 294 |
List<Warehouse> supplierWarehouses = warehouseRepository.selectVendorWarehouses(supplierId, WarehouseType.OURS, InventoryType.GOOD);
|
292 |
List<Warehouse> supplierWarehouses = warehouseRepository.selectVendorWarehouses(supplierId, WarehouseType.OURS, InventoryType.GOOD);
|
| 295 |
List<Integer> supplierPhysicalWarehouseIds = supplierWarehouses.stream().map(x -> x.getShippingWarehouseId()).collect(Collectors.toList());
|
293 |
List<Integer> supplierPhysicalWarehouseIds = supplierWarehouses.stream().map(x -> x.getShippingWarehouseId()).collect(Collectors.toList());
|
| 296 |
LOGGER.info("supplierPhysicalWarehouseIds" + supplierPhysicalWarehouseIds);
|
294 |
LOGGER.info("supplierPhysicalWarehouseIds" + supplierPhysicalWarehouseIds);
|
| - |
|
295 |
// Warehouses the supplier is already mapped to stay listed whatever their status, so existing mappings show.
|
| - |
|
296 |
List<SellerWarehouse> sellerWarehouses = sellerWarehouseRepository.selectAll().stream()
|
| - |
|
297 |
.filter(x -> x.getStatus() == WarehouseStatus.ACTIVE || supplierPhysicalWarehouseIds.contains(x.getWarehouseId()))
|
| - |
|
298 |
.collect(Collectors.toList());
|
| 297 |
for (SellerWarehouse sw : sellerWarehouses) {
|
299 |
for (SellerWarehouse sw : sellerWarehouses) {
|
| 298 |
WarehouseAddressMapping warehouseAddressMapping = warehouseAddressMappingRepository.selectByWarehouseId(sw.getWarehouseId());
|
300 |
WarehouseAddressMapping warehouseAddressMapping = warehouseAddressMappingRepository.selectByWarehouseId(sw.getWarehouseId());
|
| 299 |
if (warehouseAddressMapping != null) {
|
301 |
if (warehouseAddressMapping != null) {
|
| 300 |
WarehouseAddressMaster WarehouseAddressMaster = warehouseAddressMasterRepository.selectById(warehouseAddressMapping.getAddressId());
|
302 |
WarehouseAddressMaster WarehouseAddressMaster = warehouseAddressMasterRepository.selectById(warehouseAddressMapping.getAddressId());
|
| 301 |
State state = stateRepository.selectById(WarehouseAddressMaster.getStateId());
|
303 |
State state = stateRepository.selectById(WarehouseAddressMaster.getStateId());
|