| Line 1321... |
Line 1321... |
| 1321 |
@GetMapping(value = "/pur-sale-ratio-panel")
|
1321 |
@GetMapping(value = "/pur-sale-ratio-panel")
|
| 1322 |
public String purchaseSaleRatioPanal(Model model) throws JsonProcessingException {
|
1322 |
public String purchaseSaleRatioPanal(Model model) throws JsonProcessingException {
|
| 1323 |
List<String> brands = Arrays.asList("Vivo", "Oppo", "Samsung", "Realme", "Xiaomi");
|
1323 |
List<String> brands = Arrays.asList("Vivo", "Oppo", "Samsung", "Realme", "Xiaomi");
|
| 1324 |
LocalDateTime startDate = LocalDate.now().minusDays(30).atStartOfDay();
|
1324 |
LocalDateTime startDate = LocalDate.now().minusDays(30).atStartOfDay();
|
| 1325 |
LocalDateTime endDate = LocalDate.now().atTime(LocalTime.MAX);
|
1325 |
LocalDateTime endDate = LocalDate.now().atTime(LocalTime.MAX);
|
| 1326 |
List<PurchaseSaleQuantity> purchaseSaleQuantities = warehouseSupplierInvoiceRepository.selectPurchaseSaleQuantity(startDate, endDate, "Vivo");
|
1326 |
List<PurchaseSaleQuantity> purchaseSaleQuantities = warehouseSupplierInvoiceRepository.selectPurchaseSaleQuantity(startDate, endDate, "Vivo", 0);
|
| 1327 |
List<BrandWiseSupplier> brandWiseSuppliers = warehouseSupplierInvoiceRepository.selectPeriodAndBrandWiseSuppliers(startDate, endDate, "Vivo");
|
1327 |
List<BrandWiseSupplier> brandWiseSuppliers = warehouseSupplierInvoiceRepository.selectPeriodAndBrandWiseSuppliers(startDate, endDate, "Vivo");
|
| 1328 |
ObjectMapper objectMapper = new ObjectMapper();
|
1328 |
ObjectMapper objectMapper = new ObjectMapper();
|
| 1329 |
String purchaseSaleQuantitiesJSON = objectMapper.writeValueAsString(purchaseSaleQuantities);
|
1329 |
String purchaseSaleQuantitiesJSON = objectMapper.writeValueAsString(purchaseSaleQuantities);
|
| 1330 |
model.addAttribute("brands", brands);
|
1330 |
model.addAttribute("brands", brands);
|
| 1331 |
model.addAttribute("selectedBrand", "Vivo");
|
1331 |
model.addAttribute("selectedBrand", "Vivo");
|
| Line 1336... |
Line 1336... |
| 1336 |
return "analysis/purchase-sale-ratio-panel";
|
1336 |
return "analysis/purchase-sale-ratio-panel";
|
| 1337 |
}
|
1337 |
}
|
| 1338 |
|
1338 |
|
| 1339 |
@GetMapping(value = "/brandSuppliers")
|
1339 |
@GetMapping(value = "/brandSuppliers")
|
| 1340 |
public ResponseEntity<?> brandWiseSuppliers(@RequestParam LocalDate startDate, @RequestParam LocalDate endDate,
|
1340 |
public ResponseEntity<?> brandWiseSuppliers(@RequestParam LocalDate startDate, @RequestParam LocalDate endDate,
|
| 1341 |
@RequestParam String brand, Model model) {
|
1341 |
@RequestParam String brand, @RequestParam(required = false, defaultValue = "0") int supplierId, Model model) {
|
| 1342 |
LocalDateTime startDate1 = startDate.atStartOfDay();
|
1342 |
LocalDateTime startDate1 = startDate.atStartOfDay();
|
| 1343 |
LocalDateTime endDate1 = endDate.atTime(LocalTime.MAX);
|
1343 |
LocalDateTime endDate1 = endDate.atTime(LocalTime.MAX);
|
| 1344 |
List<BrandWiseSupplier> brandWiseSuppliers = warehouseSupplierInvoiceRepository.selectPeriodAndBrandWiseSuppliers(startDate1, endDate1, brand);
|
1344 |
List<BrandWiseSupplier> brandWiseSuppliers = warehouseSupplierInvoiceRepository.selectPeriodAndBrandWiseSuppliers(startDate1, endDate1, brand);
|
| 1345 |
List<PurchaseSaleQuantity> purchaseSaleQuantities = warehouseSupplierInvoiceRepository.selectPurchaseSaleQuantity(startDate1, endDate1, brand);
|
1345 |
List<PurchaseSaleQuantity> purchaseSaleQuantities = warehouseSupplierInvoiceRepository.selectPurchaseSaleQuantity(startDate1, endDate1, brand, supplierId);
|
| 1346 |
Map<String, Object> response = new HashMap<>();
|
1346 |
Map<String, Object> response = new HashMap<>();
|
| 1347 |
response.put("brandWiseSuppliers", brandWiseSuppliers);
|
1347 |
response.put("brandWiseSuppliers", brandWiseSuppliers);
|
| 1348 |
response.put("purchaseSaleQuantities", purchaseSaleQuantities);
|
1348 |
response.put("purchaseSaleQuantities", purchaseSaleQuantities);
|
| 1349 |
return ResponseEntity.ok(response);
|
1349 |
return ResponseEntity.ok(response);
|
| 1350 |
}
|
1350 |
}
|