| Line 57... |
Line 57... |
| 57 |
import java.io.File;
|
57 |
import java.io.File;
|
| 58 |
import java.io.FileInputStream;
|
58 |
import java.io.FileInputStream;
|
| 59 |
import java.io.FileNotFoundException;
|
59 |
import java.io.FileNotFoundException;
|
| 60 |
import java.time.LocalDate;
|
60 |
import java.time.LocalDate;
|
| 61 |
import java.time.LocalDateTime;
|
61 |
import java.time.LocalDateTime;
|
| 62 |
import java.time.LocalTime;
|
- |
|
| 63 |
import java.util.*;
|
62 |
import java.util.*;
|
| 64 |
import java.util.stream.Collectors;
|
63 |
import java.util.stream.Collectors;
|
| 65 |
|
64 |
|
| 66 |
@Controller
|
65 |
@Controller
|
| 67 |
@Transactional(rollbackOn = Throwable.class)
|
66 |
@Transactional(rollbackOn = Throwable.class)
|
| Line 1320... |
Line 1319... |
| 1320 |
|
1319 |
|
| 1321 |
@GetMapping(value = "/pur-sale-ratio-panel")
|
1320 |
@GetMapping(value = "/pur-sale-ratio-panel")
|
| 1322 |
public String purchaseSaleRatioPanal(Model model) throws JsonProcessingException {
|
1321 |
public String purchaseSaleRatioPanal(Model model) throws JsonProcessingException {
|
| 1323 |
List<String> brands = Arrays.asList("Vivo", "Oppo", "Samsung", "Realme", "Xiaomi");
|
1322 |
List<String> brands = Arrays.asList("Vivo", "Oppo", "Samsung", "Realme", "Xiaomi");
|
| 1324 |
LocalDateTime startDate = LocalDate.now().minusDays(30).atStartOfDay();
|
1323 |
LocalDateTime startDate = LocalDate.now().minusDays(30).atStartOfDay();
|
| 1325 |
LocalDateTime endDate = LocalDate.now().atTime(LocalTime.MAX);
|
1324 |
LocalDateTime endDate = LocalDate.now().plusDays(1).atStartOfDay();
|
| 1326 |
List<PurchaseSaleQuantity> purchaseSaleQuantities = warehouseSupplierInvoiceRepository.selectPurchaseSaleQuantity(startDate, endDate, "Vivo", 0);
|
1325 |
List<PurchaseSaleQuantity> purchaseSaleQuantities = warehouseSupplierInvoiceRepository.selectPurchaseSaleQuantity(startDate, endDate, "Vivo", 0);
|
| 1327 |
List<BrandWiseSupplier> brandWiseSuppliers = warehouseSupplierInvoiceRepository.selectPeriodAndBrandWiseSuppliers(startDate, endDate, "Vivo");
|
1326 |
List<BrandWiseSupplier> brandWiseSuppliers = warehouseSupplierInvoiceRepository.selectPeriodAndBrandWiseSuppliers(startDate, endDate, "Vivo");
|
| 1328 |
ObjectMapper objectMapper = new ObjectMapper();
|
1327 |
ObjectMapper objectMapper = new ObjectMapper();
|
| 1329 |
String purchaseSaleQuantitiesJSON = objectMapper.writeValueAsString(purchaseSaleQuantities);
|
1328 |
String purchaseSaleQuantitiesJSON = objectMapper.writeValueAsString(purchaseSaleQuantities);
|
| 1330 |
model.addAttribute("brands", brands);
|
1329 |
model.addAttribute("brands", brands);
|
| Line 1338... |
Line 1337... |
| 1338 |
|
1337 |
|
| 1339 |
@GetMapping(value = "/brandSuppliers")
|
1338 |
@GetMapping(value = "/brandSuppliers")
|
| 1340 |
public ResponseEntity<?> brandWiseSuppliers(@RequestParam LocalDate startDate, @RequestParam LocalDate endDate,
|
1339 |
public ResponseEntity<?> brandWiseSuppliers(@RequestParam LocalDate startDate, @RequestParam LocalDate endDate,
|
| 1341 |
@RequestParam String brand, @RequestParam(required = false, defaultValue = "0") int supplierId, Model model) {
|
1340 |
@RequestParam String brand, @RequestParam(required = false, defaultValue = "0") int supplierId, Model model) {
|
| 1342 |
LocalDateTime startDate1 = startDate.atStartOfDay();
|
1341 |
LocalDateTime startDate1 = startDate.atStartOfDay();
|
| 1343 |
LocalDateTime endDate1 = endDate.atTime(LocalTime.MAX);
|
1342 |
LocalDateTime endDate1 = endDate.plusDays(1).atStartOfDay();
|
| 1344 |
List<BrandWiseSupplier> brandWiseSuppliers = warehouseSupplierInvoiceRepository.selectPeriodAndBrandWiseSuppliers(startDate1, endDate1, brand);
|
1343 |
List<BrandWiseSupplier> brandWiseSuppliers = warehouseSupplierInvoiceRepository.selectPeriodAndBrandWiseSuppliers(startDate1, endDate1, brand);
|
| 1345 |
List<PurchaseSaleQuantity> purchaseSaleQuantities = warehouseSupplierInvoiceRepository.selectPurchaseSaleQuantity(startDate1, endDate1, brand, supplierId);
|
1344 |
List<PurchaseSaleQuantity> purchaseSaleQuantities = warehouseSupplierInvoiceRepository.selectPurchaseSaleQuantity(startDate1, endDate1, brand, supplierId);
|
| 1346 |
Map<String, Object> response = new HashMap<>();
|
1345 |
Map<String, Object> response = new HashMap<>();
|
| 1347 |
response.put("brandWiseSuppliers", brandWiseSuppliers);
|
1346 |
response.put("brandWiseSuppliers", brandWiseSuppliers);
|
| 1348 |
response.put("purchaseSaleQuantities", purchaseSaleQuantities);
|
1347 |
response.put("purchaseSaleQuantities", purchaseSaleQuantities);
|
| Line 1351... |
Line 1350... |
| 1351 |
|
1350 |
|
| 1352 |
@GetMapping(value = "/pur-sale-quantity")
|
1351 |
@GetMapping(value = "/pur-sale-quantity")
|
| 1353 |
public ResponseEntity<?> purchaseSaleQuantity(@RequestParam LocalDate startDate, @RequestParam LocalDate endDate,
|
1352 |
public ResponseEntity<?> purchaseSaleQuantity(@RequestParam LocalDate startDate, @RequestParam LocalDate endDate,
|
| 1354 |
@RequestParam String brand, @RequestParam int supplierId, Model model) {
|
1353 |
@RequestParam String brand, @RequestParam int supplierId, Model model) {
|
| 1355 |
LocalDateTime startDate1 = startDate.atStartOfDay();
|
1354 |
LocalDateTime startDate1 = startDate.atStartOfDay();
|
| 1356 |
LocalDateTime endDate1 = endDate.atTime(LocalTime.MAX);
|
1355 |
LocalDateTime endDate1 = endDate.plusDays(1).atStartOfDay();
|
| 1357 |
List<PurchaseSaleQuantity> purchaseSaleQuantities = warehouseSupplierInvoiceRepository.selectPurchaseSaleQuantity(startDate1, endDate1, brand, supplierId);
|
1356 |
List<PurchaseSaleQuantity> purchaseSaleQuantities = warehouseSupplierInvoiceRepository.selectPurchaseSaleQuantity(startDate1, endDate1, brand, supplierId);
|
| 1358 |
return ResponseEntity.ok(purchaseSaleQuantities);
|
1357 |
return ResponseEntity.ok(purchaseSaleQuantities);
|
| 1359 |
}
|
1358 |
}
|
| 1360 |
|
1359 |
|
| 1361 |
@GetMapping(value = "/catalog-pur-sale-quantity")
|
1360 |
@GetMapping(value = "/catalog-pur-sale-quantity")
|
| 1362 |
public ResponseEntity<?> catalogSaleQuantity(@RequestParam LocalDate startDate, @RequestParam LocalDate endDate,
|
1361 |
public ResponseEntity<?> catalogSaleQuantity(@RequestParam LocalDate startDate, @RequestParam LocalDate endDate,
|
| 1363 |
@RequestParam String brand, @RequestParam int supplierId,
|
1362 |
@RequestParam String brand, @RequestParam int supplierId,
|
| 1364 |
@RequestParam CatalogMovingEnum label) {
|
1363 |
@RequestParam CatalogMovingEnum label) {
|
| 1365 |
LocalDateTime startDate1 = startDate.atStartOfDay();
|
1364 |
LocalDateTime startDate1 = startDate.atStartOfDay();
|
| 1366 |
LocalDateTime endDate1 = endDate.atTime(LocalTime.MAX);
|
1365 |
LocalDateTime endDate1 = endDate.atStartOfDay().plusDays(1);
|
| 1367 |
CatalogMovingEnum status;
|
1366 |
CatalogMovingEnum status;
|
| 1368 |
if (label.equals(CatalogMovingEnum.OTHER)) {
|
1367 |
if (label.equals(CatalogMovingEnum.OTHER)) {
|
| 1369 |
status = null;
|
1368 |
status = null;
|
| 1370 |
} else {
|
1369 |
} else {
|
| 1371 |
status = label;
|
1370 |
status = label;
|