| Line 78... |
Line 78... |
| 78 |
import com.spice.profitmandi.dao.model.ItemTypeParams;
|
78 |
import com.spice.profitmandi.dao.model.ItemTypeParams;
|
| 79 |
import com.spice.profitmandi.dao.model.MonthSaleModel;
|
79 |
import com.spice.profitmandi.dao.model.MonthSaleModel;
|
| 80 |
import com.spice.profitmandi.dao.model.PartnerDetailModel;
|
80 |
import com.spice.profitmandi.dao.model.PartnerDetailModel;
|
| 81 |
import com.spice.profitmandi.dao.model.SimpleCampaign;
|
81 |
import com.spice.profitmandi.dao.model.SimpleCampaign;
|
| 82 |
import com.spice.profitmandi.dao.model.SimpleCampaignParams;
|
82 |
import com.spice.profitmandi.dao.model.SimpleCampaignParams;
|
| - |
|
83 |
import com.spice.profitmandi.dao.model.WarehouseWiseBrandStockModel;
|
| - |
|
84 |
import com.spice.profitmandi.dao.model.WarehouseWiseStockModel;
|
| - |
|
85 |
import com.spice.profitmandi.dao.model.WarehouseWiseitemStockModel;
|
| 83 |
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
|
86 |
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
|
| 84 |
import com.spice.profitmandi.dao.repository.auth.MenuCategoryRepository;
|
87 |
import com.spice.profitmandi.dao.repository.auth.MenuCategoryRepository;
|
| 85 |
import com.spice.profitmandi.dao.repository.auth.MenuRepository;
|
88 |
import com.spice.profitmandi.dao.repository.auth.MenuRepository;
|
| 86 |
import com.spice.profitmandi.dao.repository.catalog.ItemRepository;
|
89 |
import com.spice.profitmandi.dao.repository.catalog.ItemRepository;
|
| 87 |
import com.spice.profitmandi.dao.repository.catalog.OfferMarginRepository;
|
90 |
import com.spice.profitmandi.dao.repository.catalog.OfferMarginRepository;
|
| Line 106... |
Line 109... |
| 106 |
import com.spice.profitmandi.dao.repository.fofo.InventoryItemRepository;
|
109 |
import com.spice.profitmandi.dao.repository.fofo.InventoryItemRepository;
|
| 107 |
import com.spice.profitmandi.dao.repository.fofo.PartnerDailyInvestmentRepository;
|
110 |
import com.spice.profitmandi.dao.repository.fofo.PartnerDailyInvestmentRepository;
|
| 108 |
import com.spice.profitmandi.dao.repository.fofo.PartnerTargetRepository;
|
111 |
import com.spice.profitmandi.dao.repository.fofo.PartnerTargetRepository;
|
| 109 |
import com.spice.profitmandi.dao.repository.fofo.PartnerTypeChangeRepository;
|
112 |
import com.spice.profitmandi.dao.repository.fofo.PartnerTypeChangeRepository;
|
| 110 |
import com.spice.profitmandi.dao.repository.fofo.PartnerTypeChangeService;
|
113 |
import com.spice.profitmandi.dao.repository.fofo.PartnerTypeChangeService;
|
| - |
|
114 |
import com.spice.profitmandi.dao.repository.inventory.SaholicInventorySnapshotRepository;
|
| 111 |
import com.spice.profitmandi.service.PartnerInvestmentService;
|
115 |
import com.spice.profitmandi.service.PartnerInvestmentService;
|
| 112 |
import com.spice.profitmandi.service.PartnerStatsService;
|
116 |
import com.spice.profitmandi.service.PartnerStatsService;
|
| 113 |
import com.spice.profitmandi.service.authentication.RoleManager;
|
117 |
import com.spice.profitmandi.service.authentication.RoleManager;
|
| 114 |
import com.spice.profitmandi.service.inventory.InventoryService;
|
118 |
import com.spice.profitmandi.service.inventory.InventoryService;
|
| 115 |
import com.spice.profitmandi.service.user.RetailerService;
|
119 |
import com.spice.profitmandi.service.user.RetailerService;
|
| Line 240... |
Line 244... |
| 240 |
@Autowired
|
244 |
@Autowired
|
| 241 |
private OfferMarginRepository offerMarginRepository;
|
245 |
private OfferMarginRepository offerMarginRepository;
|
| 242 |
@Autowired
|
246 |
@Autowired
|
| 243 |
private ItemRepository itemRepository;
|
247 |
private ItemRepository itemRepository;
|
| 244 |
|
248 |
|
| - |
|
249 |
@Autowired
|
| - |
|
250 |
private SaholicInventorySnapshotRepository saholicInventorySnapshotRepository;
|
| 245 |
private static final Logger LOGGER = LogManager.getLogger(DashboardController.class);
|
251 |
private static final Logger LOGGER = LogManager.getLogger(DashboardController.class);
|
| 246 |
|
252 |
|
| 247 |
@RequestMapping(value = "/12dashboard34", method = RequestMethod.GET)
|
253 |
@RequestMapping(value = "/12dashboard34", method = RequestMethod.GET)
|
| 248 |
public String dashboard1(HttpServletRequest request, Model model, @RequestParam int fofoId) throws Exception {
|
254 |
public String dashboard1(HttpServletRequest request, Model model, @RequestParam int fofoId) throws Exception {
|
| 249 |
boolean isAdmin = false;
|
255 |
boolean isAdmin = false;
|
| Line 751... |
Line 757... |
| 751 |
List<Menu> menus = null;
|
757 |
List<Menu> menus = null;
|
| 752 |
try {
|
758 |
try {
|
| 753 |
AuthUser authUser = authRepository.selectByEmailOrMobile(email);
|
759 |
AuthUser authUser = authRepository.selectByEmailOrMobile(email);
|
| 754 |
List<Position> positions = positionRepository.selectAll(authUser.getId());
|
760 |
List<Position> positions = positionRepository.selectAll(authUser.getId());
|
| 755 |
Map<Integer, AuthUser> authIdAndAuthUserMap = null;
|
761 |
Map<Integer, AuthUser> authIdAndAuthUserMap = null;
|
| - |
|
762 |
|
| - |
|
763 |
Map<Integer, WarehouseWiseStockModel> warehouseStockMap = new HashMap<>();
|
| - |
|
764 |
Map<Integer, String> warehouseMap = ProfitMandiConstants.WAREHOUSE_MAP;
|
| 756 |
Map<Integer, PartnerDetailModel> authIdAndallValues = null;
|
765 |
Map<Integer, PartnerDetailModel> authIdAndallValues = null;
|
| 757 |
if (positions.size() > 0) {
|
766 |
if (positions.size() > 0) {
|
| 758 |
if (positions.stream()
|
767 |
if (positions.stream()
|
| 759 |
.filter(x -> x.getEscalationType().equals(EscalationType.L3)
|
768 |
.filter(x -> x.getEscalationType().equals(EscalationType.L3)
|
| 760 |
|| x.getEscalationType().equals(EscalationType.L4)
|
769 |
|| x.getEscalationType().equals(EscalationType.L4)
|
| Line 771... |
Line 780... |
| 771 |
|
780 |
|
| 772 |
AuthUser dummyAuthUser = new AuthUser();
|
781 |
AuthUser dummyAuthUser = new AuthUser();
|
| 773 |
dummyAuthUser.setFirstName("Total");
|
782 |
dummyAuthUser.setFirstName("Total");
|
| 774 |
dummyAuthUser.setLastName("Values");
|
783 |
dummyAuthUser.setLastName("Values");
|
| 775 |
authIdAndAuthUserMap.put(0, dummyAuthUser);
|
784 |
authIdAndAuthUserMap.put(0, dummyAuthUser);
|
| - |
|
785 |
warehouseStockMap = saholicInventorySnapshotRepository.selectGroupByWarehouse().stream()
|
| - |
|
786 |
.collect(Collectors.toMap(x -> x.getWarehouseId(), x -> x));
|
| 776 |
|
787 |
|
| - |
|
788 |
LOGGER.info("warehouseStockMap" + warehouseStockMap);
|
| 777 |
authIdAndallValues = this.getL2AuthUserPartnerDetail();
|
789 |
authIdAndallValues = this.getL2AuthUserPartnerDetail();
|
| 778 |
}
|
790 |
}
|
| 779 |
}
|
791 |
}
|
| 780 |
|
792 |
|
| 781 |
if (Arrays.asList("amit.gupta@shop2020.in", "tejbeer.kaur@shop2020.in", "manish.tiwari@smartdukaan.com")
|
793 |
if (Arrays.asList("amit.gupta@shop2020.in", "tejbeer.kaur@shop2020.in", "manish.tiwari@smartdukaan.com")
|
| Line 817... |
Line 829... |
| 817 |
model.addAttribute("warehouses", getWarehouses(positionRetailers));
|
829 |
model.addAttribute("warehouses", getWarehouses(positionRetailers));
|
| 818 |
}
|
830 |
}
|
| 819 |
model.addAttribute("authId", authUser.getId());
|
831 |
model.addAttribute("authId", authUser.getId());
|
| 820 |
|
832 |
|
| 821 |
}
|
833 |
}
|
| - |
|
834 |
|
| 822 |
model.addAttribute("authIdAndallValues", authIdAndallValues);
|
835 |
model.addAttribute("authIdAndallValues", authIdAndallValues);
|
| 823 |
model.addAttribute("authIdAndAuthUserMap", authIdAndAuthUserMap);
|
836 |
model.addAttribute("authIdAndAuthUserMap", authIdAndAuthUserMap);
|
| 824 |
|
- |
|
| - |
|
837 |
model.addAttribute("warehouseMap", warehouseMap);
|
| - |
|
838 |
model.addAttribute("warehouseStockMap", warehouseStockMap);
|
| 825 |
} catch (ProfitMandiBusinessException e) {
|
839 |
} catch (ProfitMandiBusinessException e) {
|
| 826 |
}
|
840 |
}
|
| 827 |
List<Menu> menuList = (menus != null) ? this.prepareMenu(menus) : new ArrayList<>();
|
841 |
List<Menu> menuList = (menus != null) ? this.prepareMenu(menus) : new ArrayList<>();
|
| 828 |
LOGGER.info("menu" + menuList);
|
842 |
LOGGER.info("menu" + menuList);
|
| 829 |
model.addAttribute("menu", menuList);
|
843 |
model.addAttribute("menu", menuList);
|
| Line 936... |
Line 950... |
| 936 |
model.addAttribute("fofoIdAndPartnerMap", fofoIdAndPartnerMap);
|
950 |
model.addAttribute("fofoIdAndPartnerMap", fofoIdAndPartnerMap);
|
| 937 |
|
951 |
|
| 938 |
return "auth_user_partner_detail";
|
952 |
return "auth_user_partner_detail";
|
| 939 |
}
|
953 |
}
|
| 940 |
|
954 |
|
| - |
|
955 |
@RequestMapping(value = "/getWarehouseWiseBrandStock", method = RequestMethod.GET)
|
| - |
|
956 |
public String getWarehouseWiseBrandStock(HttpServletRequest request, Model model, @RequestParam int warehouseId)
|
| - |
|
957 |
throws Exception {
|
| - |
|
958 |
|
| - |
|
959 |
List<WarehouseWiseBrandStockModel> warehouseWiseBrandStock = saholicInventorySnapshotRepository
|
| - |
|
960 |
.selectGroupByWarehouseAndBrand(warehouseId);
|
| - |
|
961 |
Map<Integer, String> warehouseMap = ProfitMandiConstants.WAREHOUSE_MAP;
|
| - |
|
962 |
model.addAttribute("warehouseWiseBrandStock", warehouseWiseBrandStock);
|
| - |
|
963 |
model.addAttribute("warehouseMap", warehouseMap);
|
| - |
|
964 |
LOGGER.info("warehouseWiseBrandStock" + warehouseWiseBrandStock);
|
| - |
|
965 |
return "warehouse_brand_stock";
|
| - |
|
966 |
}
|
| - |
|
967 |
|
| - |
|
968 |
@RequestMapping(value = "/getWarehouseWiseBrandItemStock", method = RequestMethod.GET)
|
| - |
|
969 |
public String getWarehouseWiseBrandItemStock(HttpServletRequest request, Model model, @RequestParam int warehouseId,
|
| - |
|
970 |
@RequestParam String brand) throws Exception {
|
| - |
|
971 |
|
| - |
|
972 |
List<WarehouseWiseitemStockModel> warehouseWiseItemStock = saholicInventorySnapshotRepository
|
| - |
|
973 |
.selectWarehouseItemStock(warehouseId, brand);
|
| - |
|
974 |
Map<Integer, String> warehouseMap = ProfitMandiConstants.WAREHOUSE_MAP;
|
| - |
|
975 |
List<String> brands = mongoClient.getAllBrandsToDisplay(0).stream().map(x -> (String) x.get("name"))
|
| - |
|
976 |
.collect(Collectors.toList());
|
| - |
|
977 |
|
| - |
|
978 |
model.addAttribute("warehouseWiseItemStock", warehouseWiseItemStock);
|
| - |
|
979 |
model.addAttribute("warehouseMap", warehouseMap);
|
| - |
|
980 |
model.addAttribute("brands", brands);
|
| - |
|
981 |
LOGGER.info("warehouseWiseItemStock" + warehouseWiseItemStock);
|
| - |
|
982 |
return "warehouse_brand_item_stock";
|
| - |
|
983 |
}
|
| - |
|
984 |
|
| 941 |
private String getWarehouses(Set<CustomRetailer> positionRetailers) {
|
985 |
private String getWarehouses(Set<CustomRetailer> positionRetailers) {
|
| 942 |
Map<Integer, String> warehouses = new HashMap<>();
|
986 |
Map<Integer, String> warehouses = new HashMap<>();
|
| 943 |
positionRetailers.stream().forEach(x -> {
|
987 |
positionRetailers.stream().forEach(x -> {
|
| 944 |
if (x.getWarehouseId() != 0) {
|
988 |
if (x.getWarehouseId() != 0) {
|
| 945 |
warehouses.put(x.getWarehouseId(), ProfitMandiConstants.WAREHOUSE_MAP.get(x.getWarehouseId()));
|
989 |
warehouses.put(x.getWarehouseId(), ProfitMandiConstants.WAREHOUSE_MAP.get(x.getWarehouseId()));
|