| Line 1... |
Line 1... |
| 1 |
package com.spice.profitmandi.web.controller;
|
1 |
package com.spice.profitmandi.web.controller;
|
| 2 |
|
2 |
|
| 3 |
import com.fasterxml.jackson.core.JsonProcessingException;
|
- |
|
| 4 |
import com.fasterxml.jackson.databind.ObjectMapper;
|
- |
|
| 5 |
import com.spice.profitmandi.common.enumuration.ContentType;
|
3 |
import com.spice.profitmandi.common.enumuration.ContentType;
|
| 6 |
import com.spice.profitmandi.common.enumuration.CounterSize;
|
4 |
import com.spice.profitmandi.common.enumuration.CounterSize;
|
| 7 |
import com.spice.profitmandi.common.enumuration.FofoType;
|
5 |
import com.spice.profitmandi.common.enumuration.FofoType;
|
| 8 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
6 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| 9 |
import com.spice.profitmandi.common.model.*;
|
7 |
import com.spice.profitmandi.common.model.*;
|
| Line 13... |
Line 11... |
| 13 |
import com.spice.profitmandi.dao.entity.dtr.*;
|
11 |
import com.spice.profitmandi.dao.entity.dtr.*;
|
| 14 |
import com.spice.profitmandi.dao.entity.fofo.*;
|
12 |
import com.spice.profitmandi.dao.entity.fofo.*;
|
| 15 |
import com.spice.profitmandi.dao.entity.user.Location;
|
13 |
import com.spice.profitmandi.dao.entity.user.Location;
|
| 16 |
import com.spice.profitmandi.dao.entity.user.Promoter;
|
14 |
import com.spice.profitmandi.dao.entity.user.Promoter;
|
| 17 |
import com.spice.profitmandi.dao.entity.user.User;
|
15 |
import com.spice.profitmandi.dao.entity.user.User;
|
| 18 |
import com.spice.profitmandi.dao.enumuration.inventory.CatalogMovingEnum;
|
- |
|
| 19 |
import com.spice.profitmandi.dao.model.purchaseSaleRatio.BrandWiseSupplier;
|
- |
|
| 20 |
import com.spice.profitmandi.dao.model.purchaseSaleRatio.CatalogPurchaseSaleModel;
|
- |
|
| 21 |
import com.spice.profitmandi.dao.model.purchaseSaleRatio.PurchaseSaleQuantity;
|
- |
|
| 22 |
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
|
16 |
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
|
| 23 |
import com.spice.profitmandi.dao.repository.cs.CsService;
|
17 |
import com.spice.profitmandi.dao.repository.cs.CsService;
|
| 24 |
import com.spice.profitmandi.dao.repository.cs.RetailerBrandsLimitService;
|
18 |
import com.spice.profitmandi.dao.repository.cs.RetailerBrandsLimitService;
|
| 25 |
import com.spice.profitmandi.dao.repository.dtr.*;
|
19 |
import com.spice.profitmandi.dao.repository.dtr.*;
|
| 26 |
import com.spice.profitmandi.dao.repository.fofo.PartnerTypeChangeRepository;
|
20 |
import com.spice.profitmandi.dao.repository.fofo.PartnerTypeChangeRepository;
|
| Line 1315... |
Line 1309... |
| 1315 |
|
1309 |
|
| 1316 |
return "retailer-contact-list";
|
1310 |
return "retailer-contact-list";
|
| 1317 |
|
1311 |
|
| 1318 |
}
|
1312 |
}
|
| 1319 |
|
1313 |
|
| 1320 |
@GetMapping(value = "/pur-sale-ratio-panel")
|
- |
|
| 1321 |
public String purchaseSaleRatioPanal(Model model) throws JsonProcessingException {
|
- |
|
| 1322 |
List<String> brands = Arrays.asList("Vivo", "Oppo", "Samsung", "Realme", "Xiaomi");
|
- |
|
| 1323 |
LocalDateTime startDate = LocalDate.now().minusDays(30).atStartOfDay();
|
- |
|
| 1324 |
LocalDateTime endDate = LocalDate.now().plusDays(1).atStartOfDay();
|
- |
|
| 1325 |
List<PurchaseSaleQuantity> purchaseSaleQuantities = warehouseSupplierInvoiceRepository.selectPurchaseSaleQuantity(startDate, endDate, "Vivo", 0);
|
- |
|
| 1326 |
List<BrandWiseSupplier> brandWiseSuppliers = warehouseSupplierInvoiceRepository.selectPeriodAndBrandWiseSuppliers(startDate, endDate, "Vivo");
|
- |
|
| 1327 |
ObjectMapper objectMapper = new ObjectMapper();
|
- |
|
| 1328 |
String purchaseSaleQuantitiesJSON = objectMapper.writeValueAsString(purchaseSaleQuantities);
|
- |
|
| 1329 |
model.addAttribute("brands", brands);
|
- |
|
| 1330 |
model.addAttribute("selectedBrand", "Vivo");
|
- |
|
| 1331 |
model.addAttribute("startDate", startDate.toLocalDate());
|
- |
|
| 1332 |
model.addAttribute("endDate", endDate.toLocalDate());
|
- |
|
| 1333 |
model.addAttribute("purchaseSaleQuantities", purchaseSaleQuantitiesJSON);
|
- |
|
| 1334 |
model.addAttribute("brandWiseSuppliers", brandWiseSuppliers);
|
- |
|
| 1335 |
return "analysis/purchase-sale-ratio-panel";
|
- |
|
| 1336 |
}
|
- |
|
| 1337 |
|
- |
|
| 1338 |
@GetMapping(value = "/brandSuppliers")
|
- |
|
| 1339 |
public ResponseEntity<?> brandWiseSuppliers(@RequestParam LocalDate startDate, @RequestParam LocalDate endDate,
|
- |
|
| 1340 |
@RequestParam String brand, @RequestParam(required = false, defaultValue = "0") int supplierId, Model model) {
|
- |
|
| 1341 |
LocalDateTime startDate1 = startDate.atStartOfDay();
|
- |
|
| 1342 |
LocalDateTime endDate1 = endDate.plusDays(1).atStartOfDay();
|
- |
|
| 1343 |
List<BrandWiseSupplier> brandWiseSuppliers = warehouseSupplierInvoiceRepository.selectPeriodAndBrandWiseSuppliers(startDate1, endDate1, brand);
|
- |
|
| 1344 |
List<PurchaseSaleQuantity> purchaseSaleQuantities = warehouseSupplierInvoiceRepository.selectPurchaseSaleQuantity(startDate1, endDate1, brand, supplierId);
|
- |
|
| 1345 |
Map<String, Object> response = new HashMap<>();
|
- |
|
| 1346 |
response.put("brandWiseSuppliers", brandWiseSuppliers);
|
- |
|
| 1347 |
response.put("purchaseSaleQuantities", purchaseSaleQuantities);
|
- |
|
| 1348 |
return ResponseEntity.ok(response);
|
- |
|
| 1349 |
}
|
- |
|
| 1350 |
|
- |
|
| 1351 |
@GetMapping(value = "/pur-sale-quantity")
|
- |
|
| 1352 |
public ResponseEntity<?> purchaseSaleQuantity(@RequestParam LocalDate startDate, @RequestParam LocalDate endDate,
|
- |
|
| 1353 |
@RequestParam String brand, @RequestParam int supplierId, Model model) {
|
- |
|
| 1354 |
LocalDateTime startDate1 = startDate.atStartOfDay();
|
- |
|
| 1355 |
LocalDateTime endDate1 = endDate.plusDays(1).atStartOfDay();
|
- |
|
| 1356 |
List<PurchaseSaleQuantity> purchaseSaleQuantities = warehouseSupplierInvoiceRepository.selectPurchaseSaleQuantity(startDate1, endDate1, brand, supplierId);
|
- |
|
| 1357 |
return ResponseEntity.ok(purchaseSaleQuantities);
|
- |
|
| 1358 |
}
|
- |
|
| 1359 |
|
- |
|
| 1360 |
@GetMapping(value = "/catalog-pur-sale-quantity")
|
- |
|
| 1361 |
public ResponseEntity<?> catalogSaleQuantity(@RequestParam LocalDate startDate, @RequestParam LocalDate endDate,
|
- |
|
| 1362 |
@RequestParam String brand, @RequestParam int supplierId,
|
- |
|
| 1363 |
@RequestParam CatalogMovingEnum label) {
|
- |
|
| 1364 |
LocalDateTime startDate1 = startDate.atStartOfDay();
|
- |
|
| 1365 |
LocalDateTime endDate1 = endDate.atStartOfDay().plusDays(1);
|
- |
|
| 1366 |
CatalogMovingEnum status;
|
- |
|
| 1367 |
if (label.equals(CatalogMovingEnum.OTHER)) {
|
- |
|
| 1368 |
status = null;
|
- |
|
| 1369 |
} else {
|
- |
|
| 1370 |
status = label;
|
- |
|
| 1371 |
}
|
- |
|
| 1372 |
List<CatalogPurchaseSaleModel> catalogPurchaseSaleModels =
|
- |
|
| 1373 |
warehouseSupplierInvoiceRepository.selectCatalogPurchaseSale(startDate1, endDate1, brand, supplierId, status);
|
- |
|
| 1374 |
return ResponseEntity.ok(catalogPurchaseSaleModels);
|
- |
|
| 1375 |
}
|
- |
|
| 1376 |
|
- |
|
| 1377 |
|
1314 |
|
| 1378 |
}
|
1315 |
}
|
| 1379 |
|
1316 |
|