| Line 4... |
Line 4... |
| 4 |
import java.io.ByteArrayOutputStream;
|
4 |
import java.io.ByteArrayOutputStream;
|
| 5 |
import java.io.IOException;
|
5 |
import java.io.IOException;
|
| 6 |
import java.io.InputStream;
|
6 |
import java.io.InputStream;
|
| 7 |
import java.io.InputStreamReader;
|
7 |
import java.io.InputStreamReader;
|
| 8 |
import java.net.URISyntaxException;
|
8 |
import java.net.URISyntaxException;
|
| - |
|
9 |
import java.time.LocalDate;
|
| 9 |
import java.time.LocalDateTime;
|
10 |
import java.time.LocalDateTime;
|
| - |
|
11 |
import java.time.LocalTime;
|
| - |
|
12 |
import java.time.YearMonth;
|
| 10 |
import java.time.format.DateTimeFormatter;
|
13 |
import java.time.format.DateTimeFormatter;
|
| 11 |
import java.util.ArrayList;
|
14 |
import java.util.ArrayList;
|
| 12 |
import java.util.Arrays;
|
15 |
import java.util.Arrays;
|
| 13 |
import java.util.Collection;
|
16 |
import java.util.Collection;
|
| 14 |
import java.util.HashMap;
|
17 |
import java.util.HashMap;
|
| Line 81... |
Line 84... |
| 81 |
import com.spice.profitmandi.dao.entity.transaction.NotifyCancel;
|
84 |
import com.spice.profitmandi.dao.entity.transaction.NotifyCancel;
|
| 82 |
import com.spice.profitmandi.dao.entity.transaction.NotifyColorChange;
|
85 |
import com.spice.profitmandi.dao.entity.transaction.NotifyColorChange;
|
| 83 |
import com.spice.profitmandi.dao.entity.transaction.NotifyMessage;
|
86 |
import com.spice.profitmandi.dao.entity.transaction.NotifyMessage;
|
| 84 |
import com.spice.profitmandi.dao.entity.transaction.NotifyOrder;
|
87 |
import com.spice.profitmandi.dao.entity.transaction.NotifyOrder;
|
| 85 |
import com.spice.profitmandi.dao.entity.transaction.Order;
|
88 |
import com.spice.profitmandi.dao.entity.transaction.Order;
|
| - |
|
89 |
import com.spice.profitmandi.dao.model.BrandItemWiseTertiaryModel;
|
| 86 |
import com.spice.profitmandi.dao.model.BrandWiseTertiaryModel;
|
90 |
import com.spice.profitmandi.dao.model.BrandWiseTertiaryModel;
|
| 87 |
import com.spice.profitmandi.dao.model.ContentPojo;
|
91 |
import com.spice.profitmandi.dao.model.ContentPojo;
|
| - |
|
92 |
import com.spice.profitmandi.dao.model.OpenPoItemModel;
|
| 88 |
import com.spice.profitmandi.dao.model.OpenPoModel;
|
93 |
import com.spice.profitmandi.dao.model.OpenPoModel;
|
| - |
|
94 |
import com.spice.profitmandi.dao.model.OurPurchaseItemModel;
|
| 89 |
import com.spice.profitmandi.dao.model.OurPurchaseModel;
|
95 |
import com.spice.profitmandi.dao.model.OurPurchaseModel;
|
| 90 |
import com.spice.profitmandi.dao.model.SecondaryOrderBillingModel;
|
96 |
import com.spice.profitmandi.dao.model.SecondaryOrderBillingModel;
|
| - |
|
97 |
import com.spice.profitmandi.dao.model.SecondaryOrderItemBillingModel;
|
| 91 |
import com.spice.profitmandi.dao.model.Specification;
|
98 |
import com.spice.profitmandi.dao.model.Specification;
|
| 92 |
import com.spice.profitmandi.dao.model.SpecificationGroup;
|
99 |
import com.spice.profitmandi.dao.model.SpecificationGroup;
|
| 93 |
import com.spice.profitmandi.dao.repository.catalog.ItemRepository;
|
100 |
import com.spice.profitmandi.dao.repository.catalog.ItemRepository;
|
| 94 |
import com.spice.profitmandi.dao.repository.catalog.TagListingRepository;
|
101 |
import com.spice.profitmandi.dao.repository.catalog.TagListingRepository;
|
| 95 |
import com.spice.profitmandi.dao.repository.catalog.TagRankingRepository;
|
102 |
import com.spice.profitmandi.dao.repository.catalog.TagRankingRepository;
|
| Line 1302... |
Line 1309... |
| 1302 |
model.addAttribute("billing", billing);
|
1309 |
model.addAttribute("billing", billing);
|
| 1303 |
|
1310 |
|
| 1304 |
return "inventory-listing";
|
1311 |
return "inventory-listing";
|
| 1305 |
|
1312 |
|
| 1306 |
}
|
1313 |
}
|
| - |
|
1314 |
|
| - |
|
1315 |
@RequestMapping(value = "/getOpenPoItemByBrand", method = RequestMethod.GET)
|
| - |
|
1316 |
public String Inventory(HttpServletRequest request,
|
| - |
|
1317 |
@RequestParam(name = "warehouseIds", required = true, defaultValue = "0") List<Integer> warehouseIds,
|
| - |
|
1318 |
String brand, int timeValue, Model model) throws Exception {
|
| - |
|
1319 |
model.addAttribute("warehouseId", warehouseIds);
|
| - |
|
1320 |
LOGGER.info("warehouseIds" + warehouseIds);
|
| - |
|
1321 |
|
| - |
|
1322 |
Map<Integer, String> warehouseMap = ProfitMandiConstants.WAREHOUSE_MAP;
|
| - |
|
1323 |
if (warehouseIds.contains(0)) {
|
| - |
|
1324 |
warehouseIds.addAll(warehouseMap.keySet());
|
| - |
|
1325 |
}
|
| - |
|
1326 |
LocalDateTime curDate = LocalDate.now().atStartOfDay();
|
| - |
|
1327 |
List<OpenPoItemModel> openPOItem = null;
|
| - |
|
1328 |
if (timeValue != 0) {
|
| - |
|
1329 |
openPOItem = warehousePurchaseOrderRepository.selectOpenPoItem(warehouseIds, brand,
|
| - |
|
1330 |
curDate.minusDays(timeValue), curDate);
|
| - |
|
1331 |
} else {
|
| - |
|
1332 |
openPOItem = warehousePurchaseOrderRepository.selectTodayOpenPoItem(warehouseIds, brand, curDate);
|
| - |
|
1333 |
}
|
| - |
|
1334 |
LOGGER.info("openPOItem" + openPOItem);
|
| - |
|
1335 |
|
| - |
|
1336 |
model.addAttribute("openPOItem", openPOItem);
|
| - |
|
1337 |
|
| - |
|
1338 |
return "inventory-listing-po-item";
|
| - |
|
1339 |
|
| - |
|
1340 |
}
|
| - |
|
1341 |
|
| - |
|
1342 |
@RequestMapping(value = "/getOurPurchaseItemByBrand", method = RequestMethod.GET)
|
| - |
|
1343 |
public String getOurPurchaseItemByBrand(HttpServletRequest request,
|
| - |
|
1344 |
@RequestParam(name = "warehouseIds", required = true, defaultValue = "0") List<Integer> warehouseIds,
|
| - |
|
1345 |
String brand, int timeValue, Model model) throws Exception {
|
| - |
|
1346 |
model.addAttribute("warehouseId", warehouseIds);
|
| - |
|
1347 |
LOGGER.info("warehouseIds" + warehouseIds);
|
| - |
|
1348 |
|
| - |
|
1349 |
Map<Integer, String> warehouseMap = ProfitMandiConstants.WAREHOUSE_MAP;
|
| - |
|
1350 |
if (warehouseIds.contains(0)) {
|
| - |
|
1351 |
warehouseIds.addAll(warehouseMap.keySet());
|
| - |
|
1352 |
}
|
| - |
|
1353 |
LocalDateTime curDate = LocalDate.now().atStartOfDay();
|
| - |
|
1354 |
List<OurPurchaseItemModel> ourPurchaseItem = null;
|
| - |
|
1355 |
if (timeValue != 0) {
|
| - |
|
1356 |
if (timeValue != 1) {
|
| - |
|
1357 |
ourPurchaseItem = warehouseScanRepository.selectOurPurchaseItemByBrand(warehouseIds, brand,
|
| - |
|
1358 |
curDate.minusDays(timeValue), curDate);
|
| - |
|
1359 |
} else {
|
| - |
|
1360 |
ourPurchaseItem = warehouseScanRepository.selectOurPurchaseItemByBrand(warehouseIds, brand,
|
| - |
|
1361 |
curDate.withDayOfMonth(1), curDate.plusDays(1));
|
| - |
|
1362 |
}
|
| - |
|
1363 |
} else {
|
| - |
|
1364 |
ourPurchaseItem = warehouseScanRepository.selectTodayOurPurchaseItemByBrand(warehouseIds, brand, curDate);
|
| - |
|
1365 |
}
|
| - |
|
1366 |
LOGGER.info("ourPurchaseItem" + ourPurchaseItem);
|
| - |
|
1367 |
|
| - |
|
1368 |
model.addAttribute("ourPurchaseItem", ourPurchaseItem);
|
| - |
|
1369 |
|
| - |
|
1370 |
return "inventory-listing-purchase-item";
|
| - |
|
1371 |
|
| - |
|
1372 |
}
|
| - |
|
1373 |
|
| - |
|
1374 |
@RequestMapping(value = "/getSecondaryBillingItemByBrand", method = RequestMethod.GET)
|
| - |
|
1375 |
public String getSecondaryBillingItemByBrand(HttpServletRequest request,
|
| - |
|
1376 |
@RequestParam(name = "warehouseIds", required = true, defaultValue = "0") List<Integer> warehouseIds,
|
| - |
|
1377 |
String brand, int timeValue, Model model) throws Exception {
|
| - |
|
1378 |
model.addAttribute("warehouseId", warehouseIds);
|
| - |
|
1379 |
LOGGER.info("warehouseIds" + warehouseIds);
|
| - |
|
1380 |
|
| - |
|
1381 |
Map<Integer, String> warehouseMap = ProfitMandiConstants.WAREHOUSE_MAP;
|
| - |
|
1382 |
if (warehouseIds.contains(0)) {
|
| - |
|
1383 |
warehouseIds.addAll(warehouseMap.keySet());
|
| - |
|
1384 |
}
|
| - |
|
1385 |
LocalDateTime curDate = LocalDate.now().atStartOfDay();
|
| - |
|
1386 |
List<SecondaryOrderItemBillingModel> billedItem = null;
|
| - |
|
1387 |
if (timeValue != 0) {
|
| - |
|
1388 |
if (timeValue == 1) {
|
| - |
|
1389 |
billedItem = orderRepository.selectAllBilledOrderItemByBrand(warehouseIds, brand,
|
| - |
|
1390 |
curDate.withDayOfMonth(1), curDate.plusDays(1));
|
| - |
|
1391 |
|
| - |
|
1392 |
} else if (timeValue == 2) {
|
| - |
|
1393 |
billedItem = orderRepository.selectAllBilledOrderItemByBrand(warehouseIds, brand,
|
| - |
|
1394 |
curDate.withDayOfMonth(1).minusMonths(1),
|
| - |
|
1395 |
curDate.with(LocalTime.MAX).minusMonths(1).plusDays(1));
|
| - |
|
1396 |
|
| - |
|
1397 |
} else {
|
| - |
|
1398 |
billedItem = orderRepository.selectAllBilledOrderItemByBrand(warehouseIds, brand,
|
| - |
|
1399 |
curDate.minusDays(timeValue), curDate);
|
| - |
|
1400 |
}
|
| - |
|
1401 |
|
| - |
|
1402 |
} else {
|
| - |
|
1403 |
billedItem = orderRepository.selectTodayBilledOrderItemByBrand(warehouseIds, brand, curDate);
|
| - |
|
1404 |
}
|
| - |
|
1405 |
LOGGER.info("billedItem" + billedItem);
|
| - |
|
1406 |
|
| - |
|
1407 |
model.addAttribute("billedItem", billedItem);
|
| - |
|
1408 |
|
| - |
|
1409 |
return "inventory-listing-billing-item";
|
| - |
|
1410 |
|
| - |
|
1411 |
}
|
| - |
|
1412 |
|
| - |
|
1413 |
@RequestMapping(value = "/getPartnerTertiaryItemByBrand", method = RequestMethod.GET)
|
| - |
|
1414 |
public String getPartnerTertiaryItemByBrand(HttpServletRequest request,
|
| - |
|
1415 |
@RequestParam(name = "warehouseIds", required = true, defaultValue = "0") List<Integer> warehouseIds,
|
| - |
|
1416 |
String brand, int timeValue, Model model) throws Exception {
|
| - |
|
1417 |
model.addAttribute("warehouseId", warehouseIds);
|
| - |
|
1418 |
LOGGER.info("warehouseIds" + warehouseIds);
|
| - |
|
1419 |
|
| - |
|
1420 |
Map<Integer, String> warehouseMap = ProfitMandiConstants.WAREHOUSE_MAP;
|
| - |
|
1421 |
if (warehouseIds.contains(0)) {
|
| - |
|
1422 |
warehouseIds.addAll(warehouseMap.keySet());
|
| - |
|
1423 |
}
|
| - |
|
1424 |
LocalDateTime curDate = LocalDate.now().atStartOfDay();
|
| - |
|
1425 |
int dayOfMonth = curDate.getDayOfMonth();
|
| - |
|
1426 |
LocalDateTime startOfMonth = curDate.withDayOfMonth(1);
|
| - |
|
1427 |
int lengthOfMonth = YearMonth.from(startOfMonth).lengthOfMonth();
|
| - |
|
1428 |
|
| - |
|
1429 |
List<BrandItemWiseTertiaryModel> tertiaryItem = null;
|
| - |
|
1430 |
if (timeValue != 0) {
|
| - |
|
1431 |
if (timeValue == 1) {
|
| - |
|
1432 |
tertiaryItem = fofoOrderRepository.selectItemPartnerTertiaryByBrand(warehouseIds, brand,
|
| - |
|
1433 |
curDate.withDayOfMonth(1), curDate.plusDays(1));
|
| - |
|
1434 |
|
| - |
|
1435 |
} else if (timeValue == 2) {
|
| - |
|
1436 |
LOGGER.info("curDate" + curDate.withDayOfMonth(1).minusMonths(1));
|
| - |
|
1437 |
LOGGER.info("curDate" + curDate.minusMonths(1).plusDays(Math.min(dayOfMonth, lengthOfMonth)));
|
| - |
|
1438 |
|
| - |
|
1439 |
tertiaryItem = fofoOrderRepository.selectItemPartnerTertiaryByBrand(warehouseIds, brand,
|
| - |
|
1440 |
curDate.withDayOfMonth(1).minusMonths(1),
|
| - |
|
1441 |
startOfMonth.minusMonths(1).plusDays(Math.min(dayOfMonth, lengthOfMonth)));
|
| - |
|
1442 |
|
| - |
|
1443 |
} else {
|
| - |
|
1444 |
tertiaryItem = fofoOrderRepository.selectItemPartnerTertiaryByBrand(warehouseIds, brand,
|
| - |
|
1445 |
curDate.minusDays(timeValue), curDate);
|
| - |
|
1446 |
}
|
| - |
|
1447 |
|
| - |
|
1448 |
} else {
|
| - |
|
1449 |
tertiaryItem = fofoOrderRepository.selectTodayItemPartnerTertiaryByBrand(warehouseIds, brand, curDate);
|
| - |
|
1450 |
}
|
| - |
|
1451 |
LOGGER.info("tertiaryItem" + tertiaryItem);
|
| - |
|
1452 |
|
| - |
|
1453 |
model.addAttribute("tertiaryItem", tertiaryItem);
|
| - |
|
1454 |
|
| - |
|
1455 |
return "inventory-item-tertiary-item";
|
| - |
|
1456 |
|
| - |
|
1457 |
}
|
| 1307 |
}
|
1458 |
}
|
| 1308 |
|
1459 |
|