| Line 79... |
Line 79... |
| 79 |
import com.spice.profitmandi.dao.model.ItemTypeParams;
|
79 |
import com.spice.profitmandi.dao.model.ItemTypeParams;
|
| 80 |
import com.spice.profitmandi.dao.model.MonthSaleModel;
|
80 |
import com.spice.profitmandi.dao.model.MonthSaleModel;
|
| 81 |
import com.spice.profitmandi.dao.model.PartnerDetailModel;
|
81 |
import com.spice.profitmandi.dao.model.PartnerDetailModel;
|
| 82 |
import com.spice.profitmandi.dao.model.SimpleCampaign;
|
82 |
import com.spice.profitmandi.dao.model.SimpleCampaign;
|
| 83 |
import com.spice.profitmandi.dao.model.SimpleCampaignParams;
|
83 |
import com.spice.profitmandi.dao.model.SimpleCampaignParams;
|
| - |
|
84 |
import com.spice.profitmandi.dao.model.WarehouseBrandWiseItemSaleModel;
|
| - |
|
85 |
import com.spice.profitmandi.dao.model.WarehouseWiseBrandSaleModel;
|
| 84 |
import com.spice.profitmandi.dao.model.WarehouseWiseBrandStockModel;
|
86 |
import com.spice.profitmandi.dao.model.WarehouseWiseBrandStockModel;
|
| - |
|
87 |
import com.spice.profitmandi.dao.model.WarehouseWisePartnerSaleModel;
|
| 85 |
import com.spice.profitmandi.dao.model.WarehouseWiseStockModel;
|
88 |
import com.spice.profitmandi.dao.model.WarehouseWiseStockModel;
|
| 86 |
import com.spice.profitmandi.dao.model.WarehouseWiseitemStockModel;
|
89 |
import com.spice.profitmandi.dao.model.WarehouseWiseitemStockModel;
|
| 87 |
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
|
90 |
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
|
| 88 |
import com.spice.profitmandi.dao.repository.auth.MenuCategoryRepository;
|
91 |
import com.spice.profitmandi.dao.repository.auth.MenuCategoryRepository;
|
| 89 |
import com.spice.profitmandi.dao.repository.auth.MenuRepository;
|
92 |
import com.spice.profitmandi.dao.repository.auth.MenuRepository;
|
| Line 772... |
Line 775... |
| 772 |
private String adminPanel(int fofoId, String email, Model model) throws Exception {
|
775 |
private String adminPanel(int fofoId, String email, Model model) throws Exception {
|
| 773 |
List<Menu> menus = null;
|
776 |
List<Menu> menus = null;
|
| 774 |
try {
|
777 |
try {
|
| 775 |
AuthUser authUser = authRepository.selectByEmailOrMobile(email);
|
778 |
AuthUser authUser = authRepository.selectByEmailOrMobile(email);
|
| 776 |
List<Position> positions = positionRepository.selectAll(authUser.getId());
|
779 |
List<Position> positions = positionRepository.selectAll(authUser.getId());
|
| 777 |
Map<Integer, AuthUser> authIdAndAuthUserMap = null;
|
- |
|
| 778 |
Map<Integer, PartnerDetailModel> warehousePartnerDetailMap = null;
|
780 |
Map<Integer, PartnerDetailModel> warehousePartnerDetailMap = null;
|
| 779 |
ReporticoCacheTable rct = null;
|
781 |
ReporticoCacheTable rct = null;
|
| 780 |
Map<Integer, WarehouseWiseStockModel> warehouseStockMap = new HashMap<>();
|
782 |
Map<Integer, WarehouseWiseStockModel> warehouseStockMap = new HashMap<>();
|
| 781 |
Map<Integer, String> warehouseMap = ProfitMandiConstants.WAREHOUSE_MAP;
|
783 |
Map<Integer, String> warehouseMap = ProfitMandiConstants.WAREHOUSE_MAP;
|
| 782 |
LinkedHashMap<Integer, String> wm = new LinkedHashMap<Integer, String>();
|
784 |
LinkedHashMap<Integer, String> wm = new LinkedHashMap<Integer, String>();
|
| 783 |
LinkedHashMap<Integer, String> sortedwm = new LinkedHashMap<Integer, String>();
|
785 |
LinkedHashMap<Integer, String> sortedwm = new LinkedHashMap<Integer, String>();
|
| 784 |
|
786 |
|
| - |
|
787 |
Map<Integer, WarehouseWisePartnerSaleModel> warehousePartnersSales = null;
|
| - |
|
788 |
|
| 785 |
for (Map.Entry<Integer, String> entry : warehouseMap.entrySet()) {
|
789 |
for (Map.Entry<Integer, String> entry : warehouseMap.entrySet()) {
|
| 786 |
wm.put(entry.getKey(), entry.getValue());
|
790 |
wm.put(entry.getKey(), entry.getValue());
|
| 787 |
}
|
791 |
}
|
| 788 |
|
792 |
|
| 789 |
wm.put(0, "Total Values");
|
793 |
wm.put(0, "Total Values");
|
| 790 |
long stockValue = 0;
|
794 |
long stockValue = 0;
|
| 791 |
long stockQty = 0;
|
795 |
long stockQty = 0;
|
| 792 |
long pendingIndent = 0;
|
796 |
long pendingIndent = 0;
|
| 793 |
long tertiary = 0;
|
797 |
long tertiary = 0;
|
| 794 |
|
- |
|
| 795 |
Map<Integer, PartnerDetailModel> authIdAndallValues = null;
|
- |
|
| 796 |
if (positions.size() > 0) {
|
798 |
if (positions.size() > 0) {
|
| 797 |
if (positions.stream()
|
799 |
if (positions.stream()
|
| 798 |
.filter(x -> x.getEscalationType().equals(EscalationType.L3)
|
800 |
.filter(x -> x.getEscalationType().equals(EscalationType.L3)
|
| 799 |
|| x.getEscalationType().equals(EscalationType.L4)
|
801 |
|| x.getEscalationType().equals(EscalationType.L4)
|
| 800 |
|| x.getEscalationType().equals(EscalationType.L5))
|
802 |
|| x.getEscalationType().equals(EscalationType.L5))
|
| 801 |
.count() > 0) {
|
803 |
.count() > 0) {
|
| 802 |
|
804 |
|
| 803 |
warehouseStockMap = saholicInventoryCISRepository.selectGroupByWarehouse().stream()
|
- |
|
| 804 |
.collect(Collectors.toMap(x -> x.getWarehouseId(), x -> x));
|
- |
|
| 805 |
|
- |
|
| 806 |
List<WarehouseWiseStockModel> warehouseStocks = saholicInventoryCISRepository
|
805 |
List<WarehouseWiseStockModel> warehouseStocks = saholicInventoryCISRepository
|
| 807 |
.selectGroupByWarehouse();
|
806 |
.selectGroupByWarehouse();
|
| - |
|
807 |
|
| - |
|
808 |
warehouseStockMap = warehouseStocks.stream()
|
| - |
|
809 |
.collect(Collectors.toMap(x -> x.getWarehouseId(), x -> x));
|
| - |
|
810 |
|
| 808 |
if (!warehouseStocks.isEmpty()) {
|
811 |
if (!warehouseStocks.isEmpty()) {
|
| 809 |
for (WarehouseWiseStockModel warehouseStock : warehouseStocks) {
|
812 |
for (WarehouseWiseStockModel warehouseStock : warehouseStocks) {
|
| 810 |
stockValue += warehouseStock.getStockValue();
|
813 |
stockValue += warehouseStock.getStockValue();
|
| 811 |
stockQty += warehouseStock.getStockQty();
|
814 |
stockQty += warehouseStock.getStockQty();
|
| 812 |
pendingIndent += warehouseStock.getPendingIndent();
|
815 |
pendingIndent += warehouseStock.getPendingIndent();
|
| Line 819... |
Line 822... |
| 819 |
ws.setTertiary(tertiary);
|
822 |
ws.setTertiary(tertiary);
|
| 820 |
ws.setWarehouseId(0);
|
823 |
ws.setWarehouseId(0);
|
| 821 |
warehouseStockMap.put(0, ws);
|
824 |
warehouseStockMap.put(0, ws);
|
| 822 |
|
825 |
|
| 823 |
}
|
826 |
}
|
| 824 |
|
- |
|
| - |
|
827 |
warehousePartnersSales = this.getWarehousePartnerSale();
|
| 825 |
rct = reporticoCacheTableRepository.selectByTableName("SaholicInventoryCIS");
|
828 |
rct = reporticoCacheTableRepository.selectByTableName("SaholicInventoryCIS");
|
| 826 |
LOGGER.info("warehouseStockMap" + warehouseStockMap);
|
829 |
LOGGER.info("warehouseStockMap" + warehouseStockMap);
|
| 827 |
warehousePartnerDetailMap = this.getWarehousePartnerDetail();
|
830 |
warehousePartnerDetailMap = this.getWarehousePartnerDetail();
|
| 828 |
LOGGER.info("warehousePartnerDetailMap" + warehousePartnerDetailMap);
|
831 |
LOGGER.info("warehousePartnerDetailMap" + warehousePartnerDetailMap);
|
| 829 |
|
832 |
|
| Line 875... |
Line 878... |
| 875 |
model.addAttribute("reporticoDate", rct);
|
878 |
model.addAttribute("reporticoDate", rct);
|
| 876 |
|
879 |
|
| 877 |
model.addAttribute("warehousePartnerDetailMap", warehousePartnerDetailMap);
|
880 |
model.addAttribute("warehousePartnerDetailMap", warehousePartnerDetailMap);
|
| 878 |
model.addAttribute("warehouseMap", wm);
|
881 |
model.addAttribute("warehouseMap", wm);
|
| 879 |
model.addAttribute("warehouseStockMap", warehouseStockMap);
|
882 |
model.addAttribute("warehouseStockMap", warehouseStockMap);
|
| - |
|
883 |
model.addAttribute("brandSales", warehousePartnersSales);
|
| - |
|
884 |
|
| 880 |
} catch (ProfitMandiBusinessException e) {
|
885 |
} catch (ProfitMandiBusinessException e) {
|
| 881 |
}
|
886 |
}
|
| 882 |
List<Menu> menuList = (menus != null) ? this.prepareMenu(menus) : new ArrayList<>();
|
887 |
List<Menu> menuList = (menus != null) ? this.prepareMenu(menus) : new ArrayList<>();
|
| 883 |
LOGGER.info("menu" + menuList);
|
888 |
LOGGER.info("menu" + menuList);
|
| 884 |
model.addAttribute("menu", menuList);
|
889 |
model.addAttribute("menu", menuList);
|
| Line 1082... |
Line 1087... |
| 1082 |
});
|
1087 |
});
|
| 1083 |
return gson.toJson(warehouses);
|
1088 |
return gson.toJson(warehouses);
|
| 1084 |
|
1089 |
|
| 1085 |
}
|
1090 |
}
|
| 1086 |
|
1091 |
|
| - |
|
1092 |
@RequestMapping(value = "/getWarehouseWiseBrandPartnerSale", method = RequestMethod.GET)
|
| - |
|
1093 |
public String getWarehouseWiseBrandPartnerSale(HttpServletRequest request, Model model,
|
| - |
|
1094 |
@RequestParam int warehouseId) throws Exception {
|
| - |
|
1095 |
List<WarehouseWiseBrandSaleModel> warehouseBrandPartnerSales = fofoStoreRepository
|
| - |
|
1096 |
.selectGroupByBrandWarehousePartnerSale(warehouseId);
|
| - |
|
1097 |
Map<Integer, String> warehouseMap = ProfitMandiConstants.WAREHOUSE_MAP;
|
| - |
|
1098 |
model.addAttribute("warehouseBrandPartnerSales", warehouseBrandPartnerSales);
|
| - |
|
1099 |
model.addAttribute("warehouseId", warehouseId);
|
| - |
|
1100 |
model.addAttribute("warehouseMap", warehouseMap);
|
| - |
|
1101 |
LOGGER.info("warehouseBrandPartnerSales" + warehouseBrandPartnerSales);
|
| - |
|
1102 |
return "warehouse_partner_brandwise_sale";
|
| - |
|
1103 |
}
|
| - |
|
1104 |
|
| - |
|
1105 |
@RequestMapping(value = "/getWarehouseBrandWiseItemSale", method = RequestMethod.GET)
|
| - |
|
1106 |
public String getWarehouseBrandWiseItemSale(HttpServletRequest request, Model model,
|
| - |
|
1107 |
@RequestParam List<Integer> warehouseId, @RequestParam String brand) throws Exception {
|
| - |
|
1108 |
Map<Integer, String> warehouseMap = ProfitMandiConstants.WAREHOUSE_MAP;
|
| - |
|
1109 |
if (warehouseId.contains(0)) {
|
| - |
|
1110 |
warehouseId.addAll(warehouseMap.keySet());
|
| - |
|
1111 |
}
|
| - |
|
1112 |
List<WarehouseBrandWiseItemSaleModel> branditemSales = fofoStoreRepository
|
| - |
|
1113 |
.selectWarehouseBrandItemSale(warehouseId, brand);
|
| - |
|
1114 |
model.addAttribute("branditemSales", branditemSales);
|
| - |
|
1115 |
model.addAttribute("warehouseMap", warehouseMap);
|
| - |
|
1116 |
return "warehouse_partner_itemwise_sale";
|
| - |
|
1117 |
}
|
| - |
|
1118 |
|
| 1087 |
private List<Menu> prepareMenu(List<Menu> menus) {
|
1119 |
private List<Menu> prepareMenu(List<Menu> menus) {
|
| 1088 |
List<Menu> returnMenu = new ArrayList<>();
|
1120 |
List<Menu> returnMenu = new ArrayList<>();
|
| 1089 |
Map<Menu, List<Menu>> subMenuMap = new HashMap<Menu, List<Menu>>();
|
1121 |
Map<Menu, List<Menu>> subMenuMap = new HashMap<Menu, List<Menu>>();
|
| 1090 |
for (Menu menu : menus) {
|
1122 |
for (Menu menu : menus) {
|
| 1091 |
if (menu.get_parent() == null) {
|
1123 |
if (menu.get_parent() == null) {
|
| Line 1343... |
Line 1375... |
| 1343 |
warehouseIdAndallValues.put(0, partnerDetailModel);
|
1375 |
warehouseIdAndallValues.put(0, partnerDetailModel);
|
| 1344 |
|
1376 |
|
| 1345 |
return warehouseIdAndallValues;
|
1377 |
return warehouseIdAndallValues;
|
| 1346 |
}
|
1378 |
}
|
| 1347 |
|
1379 |
|
| - |
|
1380 |
private Map<Integer, WarehouseWisePartnerSaleModel> getWarehousePartnerSale() {
|
| - |
|
1381 |
|
| - |
|
1382 |
Map<Integer, WarehouseWisePartnerSaleModel> warehousePartnersSalesMap = new HashMap<>();
|
| - |
|
1383 |
List<WarehouseWisePartnerSaleModel> warehousePartnersSales = fofoStoreRepository
|
| - |
|
1384 |
.selectGroupByWarehousePartnerSale();
|
| - |
|
1385 |
|
| - |
|
1386 |
warehousePartnersSalesMap = warehousePartnersSales.stream()
|
| - |
|
1387 |
.collect(Collectors.toMap(x -> x.getWarehouseId(), x -> x));
|
| - |
|
1388 |
|
| - |
|
1389 |
long lmtd = 0;
|
| - |
|
1390 |
long lmtdQty = 0;
|
| - |
|
1391 |
long mtd = 0;
|
| - |
|
1392 |
long mtdQty = 0;
|
| - |
|
1393 |
if (!warehousePartnersSales.isEmpty()) {
|
| - |
|
1394 |
|
| - |
|
1395 |
for (WarehouseWisePartnerSaleModel sale : warehousePartnersSales) {
|
| - |
|
1396 |
lmtd += sale.getLmtd();
|
| - |
|
1397 |
lmtdQty += sale.getLmtdQty();
|
| - |
|
1398 |
mtd += sale.getMtd();
|
| - |
|
1399 |
mtdQty += sale.getMtdQty();
|
| - |
|
1400 |
}
|
| - |
|
1401 |
|
| - |
|
1402 |
WarehouseWisePartnerSaleModel wp = new WarehouseWisePartnerSaleModel();
|
| - |
|
1403 |
wp.setLmtd(lmtd);
|
| - |
|
1404 |
wp.setLmtdQty(lmtdQty);
|
| - |
|
1405 |
wp.setMtd(mtd);
|
| - |
|
1406 |
wp.setMtdQty(mtdQty);
|
| - |
|
1407 |
wp.setWarehouseId(0);
|
| - |
|
1408 |
warehousePartnersSales.add(wp);
|
| - |
|
1409 |
warehousePartnersSalesMap.put(0, wp);
|
| - |
|
1410 |
}
|
| - |
|
1411 |
return warehousePartnersSalesMap;
|
| - |
|
1412 |
}
|
| - |
|
1413 |
|
| 1348 |
}
|
1414 |
}
|