| Line 17... |
Line 17... |
| 17 |
|
17 |
|
| 18 |
import org.apache.commons.io.output.ByteArrayOutputStream;
|
18 |
import org.apache.commons.io.output.ByteArrayOutputStream;
|
| 19 |
import org.apache.logging.log4j.LogManager;
|
19 |
import org.apache.logging.log4j.LogManager;
|
| 20 |
import org.apache.logging.log4j.Logger;
|
20 |
import org.apache.logging.log4j.Logger;
|
| 21 |
import org.apache.thrift.TException;
|
21 |
import org.apache.thrift.TException;
|
| - |
|
22 |
import org.json.JSONArray;
|
| 22 |
import org.json.JSONObject;
|
23 |
import org.json.JSONObject;
|
| 23 |
import org.springframework.beans.factory.annotation.Autowired;
|
24 |
import org.springframework.beans.factory.annotation.Autowired;
|
| 24 |
import org.springframework.core.io.ByteArrayResource;
|
25 |
import org.springframework.core.io.ByteArrayResource;
|
| 25 |
import org.springframework.http.HttpHeaders;
|
26 |
import org.springframework.http.HttpHeaders;
|
| 26 |
import org.springframework.http.HttpStatus;
|
27 |
import org.springframework.http.HttpStatus;
|
| Line 252... |
Line 253... |
| 252 |
}
|
253 |
}
|
| 253 |
}
|
254 |
}
|
| 254 |
List<List<Object>> listOfRows = new ArrayList<>();
|
255 |
List<List<Object>> listOfRows = new ArrayList<>();
|
| 255 |
for (CatalogListingModel clm : catalogListingMap.values()) {
|
256 |
for (CatalogListingModel clm : catalogListingMap.values()) {
|
| 256 |
CustomRetailer cr = customRetailersMap.get(clm.getFofoId());
|
257 |
CustomRetailer cr = customRetailersMap.get(clm.getFofoId());
|
| 257 |
listOfRows
|
- |
|
| 258 |
.add(Arrays.asList(cr.getPartnerId(), cr.getBusinessName(), clm.getCatalogId(), clm.getBrand(),
|
258 |
listOfRows.add(Arrays.asList(cr.getPartnerId(), cr.getBusinessName(), clm.getCatalogId(),
|
| 259 |
clm.getModelName(), clm.getModelNumber(), clm.getDp(), clm.getMop(), clm.getAllocatedQuantity(),
|
259 |
clm.getBrand(), clm.getModelName(), clm.getModelNumber(), clm.getDp(), clm.getMop(),
|
| 260 |
clm.getInTransitQuantity(), clm.getStockInHand(), clm.getToBeOrdered()));
|
260 |
clm.getAllocatedQuantity(), clm.getInTransitQuantity(), clm.getStockInHand(),
|
| - |
|
261 |
clm.getToBeOrdered()));
|
| 261 |
}
|
262 |
}
|
| - |
|
263 |
ByteArrayOutputStream baos = FileUtil
|
| - |
|
264 |
.getCSVByteStream(
|
| 262 |
ByteArrayOutputStream baos = FileUtil.getCSVByteStream(Arrays.asList("StoreId", "StoreName", "Catalog Id",
|
265 |
Arrays.asList("StoreId", "StoreName", "Catalog Id", "Brand", "Model Name", "Model Number",
|
| 263 |
"Brand", "Model Name", "Model Number", "DP", "MOP", "Allocated Quantity", "In Transit", "Stock In hand", "Shortage"),
|
266 |
"DP", "MOP", "Allocated Quantity", "In Transit", "Stock In hand", "Shortage"),
|
| 264 |
listOfRows);
|
267 |
listOfRows);
|
| 265 |
HttpHeaders headers = new HttpHeaders();
|
268 |
HttpHeaders headers = new HttpHeaders();
|
| 266 |
headers.set("Content-Type", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
269 |
headers.set("Content-Type", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
| 267 |
headers.set("Content-disposition", "inline; filename=retailer-allocation.csv");
|
270 |
headers.set("Content-disposition", "inline; filename=retailer-allocation.csv");
|
| 268 |
return new ResponseEntity<ByteArrayResource>(new ByteArrayResource(baos.toByteArray()), headers,
|
271 |
return new ResponseEntity<ByteArrayResource>(new ByteArrayResource(baos.toByteArray()), headers,
|
| 269 |
HttpStatus.OK);
|
272 |
HttpStatus.OK);
|
| 270 |
}
|
273 |
}
|
| 271 |
return null;
|
274 |
return null;
|
| 272 |
|
275 |
|
| 273 |
}
|
276 |
}
|
| 274 |
|
277 |
|
| - |
|
278 |
@RequestMapping(value = "/itemsByCatalogId")
|
| - |
|
279 |
public String getItemsByCatalogId(HttpServletRequest request, Model model,
|
| - |
|
280 |
@RequestParam int catalogId) {
|
| - |
|
281 |
List<Item> items = itemRepository.selectAllByCatalogItemId(catalogId);
|
| - |
|
282 |
JSONArray response = new JSONArray();
|
| - |
|
283 |
items.stream().forEach(x->
|
| - |
|
284 |
{
|
| - |
|
285 |
response.put(new JSONObject().put("color", x.getColor()).put("id", x.getId()));
|
| - |
|
286 |
});
|
| - |
|
287 |
model.addAttribute("response", response.toString());
|
| - |
|
288 |
return "response";
|
| - |
|
289 |
|
| - |
|
290 |
}
|
| - |
|
291 |
|
| 275 |
@RequestMapping(value = "/indent/loadIndent")
|
292 |
@RequestMapping(value = "/indent/loadIndent")
|
| 276 |
public String loadOpenIndent(HttpServletRequest request, Model model,
|
293 |
public String loadOpenIndent(HttpServletRequest request, Model model,
|
| 277 |
@RequestParam(required = false, defaultValue = "0") int fofoId,
|
294 |
@RequestParam(required = false, defaultValue = "0") int fofoId,
|
| 278 |
@RequestParam(defaultValue = "TEN_LAC") CounterSize counterSize) throws ProfitMandiBusinessException {
|
295 |
@RequestParam(defaultValue = "TEN_LAC") CounterSize counterSize) throws ProfitMandiBusinessException {
|
| 279 |
Set<Integer> roleIds = cookiesProcessor.getCookiesObject(request).getRoleIds();
|
296 |
Set<Integer> roleIds = cookiesProcessor.getCookiesObject(request).getRoleIds();
|