| Line 49... |
Line 49... |
| 49 |
import com.spice.profitmandi.common.model.PlannedModel;
|
49 |
import com.spice.profitmandi.common.model.PlannedModel;
|
| 50 |
import com.spice.profitmandi.common.model.StockAllocationModel;
|
50 |
import com.spice.profitmandi.common.model.StockAllocationModel;
|
| 51 |
import com.spice.profitmandi.common.util.FileUtil;
|
51 |
import com.spice.profitmandi.common.util.FileUtil;
|
| 52 |
import com.spice.profitmandi.common.util.Utils;
|
52 |
import com.spice.profitmandi.common.util.Utils;
|
| 53 |
import com.spice.profitmandi.common.util.Utils.Attachment;
|
53 |
import com.spice.profitmandi.common.util.Utils.Attachment;
|
| - |
|
54 |
import com.spice.profitmandi.dao.entity.auth.AuthUser;
|
| 54 |
import com.spice.profitmandi.dao.entity.catalog.FocusedModel;
|
55 |
import com.spice.profitmandi.dao.entity.catalog.FocusedModel;
|
| 55 |
import com.spice.profitmandi.dao.entity.catalog.Item;
|
56 |
import com.spice.profitmandi.dao.entity.catalog.Item;
|
| 56 |
import com.spice.profitmandi.dao.entity.catalog.TagListing;
|
57 |
import com.spice.profitmandi.dao.entity.catalog.TagListing;
|
| 57 |
import com.spice.profitmandi.dao.entity.fofo.CurrentInventorySnapshot;
|
58 |
import com.spice.profitmandi.dao.entity.fofo.CurrentInventorySnapshot;
|
| 58 |
import com.spice.profitmandi.dao.entity.fofo.FofoOrderItem;
|
59 |
import com.spice.profitmandi.dao.entity.fofo.FofoOrderItem;
|
| 59 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
60 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
| 60 |
import com.spice.profitmandi.dao.entity.fofo.MonthlyPlanned;
|
61 |
import com.spice.profitmandi.dao.entity.fofo.MonthlyPlanned;
|
| 61 |
import com.spice.profitmandi.dao.entity.fofo.PlannedDetail;
|
62 |
import com.spice.profitmandi.dao.entity.fofo.PlannedDetail;
|
| 62 |
import com.spice.profitmandi.dao.entity.transaction.Order;
|
63 |
import com.spice.profitmandi.dao.entity.transaction.Order;
|
| 63 |
import com.spice.profitmandi.dao.entity.user.User;
|
64 |
import com.spice.profitmandi.dao.entity.user.User;
|
| - |
|
65 |
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
|
| 64 |
import com.spice.profitmandi.dao.repository.catalog.FocusedModelRepository;
|
66 |
import com.spice.profitmandi.dao.repository.catalog.FocusedModelRepository;
|
| 65 |
import com.spice.profitmandi.dao.repository.catalog.ItemRepository;
|
67 |
import com.spice.profitmandi.dao.repository.catalog.ItemRepository;
|
| 66 |
import com.spice.profitmandi.dao.repository.catalog.TagListingRepository;
|
68 |
import com.spice.profitmandi.dao.repository.catalog.TagListingRepository;
|
| 67 |
import com.spice.profitmandi.dao.repository.cs.CsService;
|
69 |
import com.spice.profitmandi.dao.repository.cs.CsService;
|
| 68 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
70 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
| Line 186... |
Line 188... |
| 186 |
|
188 |
|
| 187 |
@Autowired
|
189 |
@Autowired
|
| 188 |
private InventoryService inventoryService;
|
190 |
private InventoryService inventoryService;
|
| 189 |
|
191 |
|
| 190 |
@Autowired
|
192 |
@Autowired
|
| 191 |
CsService csService;
|
193 |
private CsService csService;
|
| - |
|
194 |
|
| - |
|
195 |
@Autowired
|
| - |
|
196 |
private AuthRepository authRepository;
|
| 192 |
|
197 |
|
| 193 |
/*
|
198 |
/*
|
| 194 |
* @RequestMapping(value = "/open-indent/save", method = RequestMethod.POST)
|
199 |
* @RequestMapping(value = "/open-indent/save", method = RequestMethod.POST)
|
| 195 |
* public String saveOpenIndent(HttpServletRequest request, Model model,
|
200 |
* public String saveOpenIndent(HttpServletRequest request, Model model,
|
| 196 |
*
|
201 |
*
|
| Line 833... |
Line 838... |
| 833 |
LocalDateTime curDate = LocalDate.now().atStartOfDay();
|
838 |
LocalDateTime curDate = LocalDate.now().atStartOfDay();
|
| 834 |
List<Integer> fofoOrderIds = fofoOrderRepository
|
839 |
List<Integer> fofoOrderIds = fofoOrderRepository
|
| 835 |
.selectByFofoIdBetweenCreatedTimeStamp(loginDetails.getFofoId(),
|
840 |
.selectByFofoIdBetweenCreatedTimeStamp(loginDetails.getFofoId(),
|
| 836 |
curDate.withDayOfMonth(1).minusMonths(1), curDate.with(LocalTime.MAX).minusMonths(1))
|
841 |
curDate.withDayOfMonth(1).minusMonths(1), curDate.with(LocalTime.MAX).minusMonths(1))
|
| 837 |
.stream().map(x -> x.getId()).collect(Collectors.toList());
|
842 |
.stream().map(x -> x.getId()).collect(Collectors.toList());
|
| - |
|
843 |
|
| 838 |
LOGGER.info("fofoOrderIds" + fofoOrderIds);
|
844 |
LOGGER.info("fofoOrderIds" + fofoOrderIds);
|
| 839 |
Map<String, Object> equalsJoinMap = new HashMap<>();
|
845 |
Map<String, Object> equalsJoinMap = new HashMap<>();
|
| 840 |
equalsJoinMap.put("orderId", fofoOrderIds);
|
846 |
equalsJoinMap.put("orderId", fofoOrderIds);
|
| 841 |
|
- |
|
| 842 |
Map<Integer, Integer> lastMonthSaleMap = itemRepository
|
847 |
Map<Integer, Integer> lastMonthSaleMap = null;
|
| - |
|
848 |
if (!fofoOrderIds.isEmpty()) {
|
| - |
|
849 |
lastMonthSaleMap = itemRepository
|
| 843 |
.selectItems(FofoOrderItem.class, "id", "itemId", equalsMap, notEqualsMap, equalsJoinMap,
|
850 |
.selectItems(FofoOrderItem.class, "id", "itemId", equalsMap, notEqualsMap, equalsJoinMap,
|
| 844 |
notEqualsJoinMap, "quantity")
|
851 |
notEqualsJoinMap, "quantity")
|
| 845 |
.stream().collect(Collectors.toMap(x -> x.getCatalogId(), x -> (int) x.getAggregateValue()));
|
852 |
.stream().collect(Collectors.toMap(x -> x.getCatalogId(), x -> (int) x.getAggregateValue()));
|
| 846 |
|
853 |
}
|
| 847 |
LOGGER.info("lastMonthSaleMap" + lastMonthSaleMap);
|
854 |
LOGGER.info("lastMonthSaleMap" + lastMonthSaleMap);
|
| 848 |
|
855 |
|
| 849 |
Map<Integer, TagListing> taglistingMap = tagListings.stream()
|
856 |
Map<Integer, TagListing> taglistingMap = tagListings.stream()
|
| 850 |
.collect(Collectors.toMap(x -> x.getItemId(), x -> x));
|
857 |
.collect(Collectors.toMap(x -> x.getItemId(), x -> x));
|
| 851 |
List<Item> items = itemRepository.selectByIds(taglistingMap.keySet());
|
858 |
List<Item> items = itemRepository.selectByIds(taglistingMap.keySet());
|
| Line 1230... |
Line 1237... |
| 1230 |
|
1237 |
|
| 1231 |
return brandStockPrices.stream().filter(x -> x.getTotalQty() > 0).sorted((x, y) -> x.getRank() - y.getRank())
|
1238 |
return brandStockPrices.stream().filter(x -> x.getTotalQty() > 0).sorted((x, y) -> x.getRank() - y.getRank())
|
| 1232 |
.collect(Collectors.toList());
|
1239 |
.collect(Collectors.toList());
|
| 1233 |
}
|
1240 |
}
|
| 1234 |
|
1241 |
|
| - |
|
1242 |
@RequestMapping(value = "/getPartnerAllocation")
|
| - |
|
1243 |
public String getPartnerAllocation(HttpServletRequest request, Model model) throws Exception {
|
| - |
|
1244 |
|
| - |
|
1245 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| - |
|
1246 |
AuthUser authUser = authRepository.selectByEmailOrMobile(loginDetails.getEmailId());
|
| - |
|
1247 |
|
| - |
|
1248 |
Map<Integer, List<Integer>> pp = csService.getAuthUserIdPartnerIdMapping();
|
| - |
|
1249 |
|
| - |
|
1250 |
List<Integer> fofoIds = pp.get(authUser.getId());
|
| - |
|
1251 |
|
| - |
|
1252 |
Map<Integer, CustomRetailer> customRetailersMap = retailerService.getFofoRetailers(fofoIds);
|
| - |
|
1253 |
Map<Integer, FofoStore> fofoStoreMap = fofoStoreRepository.selectByRetailerIds(fofoIds).stream()
|
| - |
|
1254 |
.collect(Collectors.toMap(x -> x.getId(), x -> x));
|
| - |
|
1255 |
|
| - |
|
1256 |
model.addAttribute("customRetailersMap", customRetailersMap);
|
| - |
|
1257 |
model.addAttribute("fofoStoreMap", fofoStoreMap);
|
| - |
|
1258 |
return "partners_allocation";
|
| - |
|
1259 |
|
| - |
|
1260 |
}
|
| - |
|
1261 |
|
| 1235 |
}
|
1262 |
}
|
| 1236 |
|
1263 |
|