| Line 263... |
Line 263... |
| 263 |
private PartnerTypeChangeRepository partnerTypeChangeRepository;
|
263 |
private PartnerTypeChangeRepository partnerTypeChangeRepository;
|
| 264 |
@Autowired
|
264 |
@Autowired
|
| 265 |
private SchemeService schemeService;
|
265 |
private SchemeService schemeService;
|
| 266 |
|
266 |
|
| 267 |
private static final String[] STOCK_AGEING_MAIL_LIST = new String[] { "uday.singh@smartudkaan.com",
|
267 |
private static final String[] STOCK_AGEING_MAIL_LIST = new String[] { "uday.singh@smartudkaan.com",
|
| 268 |
"adeel.yazdani@smartdukaan.com", "manoj.singh@smartdukaan.com", "kamini.sharma@smartdukaan.com",
|
268 |
"adeel.yazdani@smartdukaan.com", "kamini.sharma@smartdukaan.com",
|
| 269 |
"mohinder.mutreja@smartdukaan.com", "ankit.bhatia@smartdukaan.com", "tarun.verma@smartdukaan.com",
|
269 |
"mohinder.mutreja@smartdukaan.com", "ankit.bhatia@smartdukaan.com", "tarun.verma@smartdukaan.com",
|
| 270 |
"hemant.kaura@smartdukaan.com", "rajat.gupta@smartdukaan.com", "kuldeep.kumar@smartdukaan.com",
|
270 |
"hemant.kaura@smartdukaan.com", "rajat.gupta@smartdukaan.com", "kuldeep.kumar@smartdukaan.com",
|
| 271 |
"prakash.rai@smartdukaan.com" };
|
271 |
"prakash.rai@smartdukaan.com" };
|
| 272 |
|
272 |
|
| 273 |
private static final String[] ITEMWISE_PENDING_INDENT_MAIL_LIST = new String[] { "kamini.sharma@smartdukaan.com",
|
273 |
private static final String[] ITEMWISE_PENDING_INDENT_MAIL_LIST = new String[] { "kamini.sharma@smartdukaan.com",
|
| Line 2017... |
Line 2017... |
| 2017 |
Map<String, Object> equalsJoinMap = new HashMap<>();
|
2017 |
Map<String, Object> equalsJoinMap = new HashMap<>();
|
| 2018 |
equalsJoinMap.put("catalogId", focusedModelCatalogId);
|
2018 |
equalsJoinMap.put("catalogId", focusedModelCatalogId);
|
| 2019 |
|
2019 |
|
| 2020 |
Map<String, List<?>> notEqualsJoinMap = new HashMap<>();
|
2020 |
Map<String, List<?>> notEqualsJoinMap = new HashMap<>();
|
| 2021 |
|
2021 |
|
| 2022 |
List<Integer> catalogIds = itemRepository
|
2022 |
/* List<Integer> catalogIds = itemRepository
|
| 2023 |
.selectItems(FocusedModel.class, "catalogItemId", "catalogId", equalsMap, notEqualsMap,
|
2023 |
.selectItems(FocusedModel.class, "catalogItemId", "catalogId", equalsMap, notEqualsMap,
|
| 2024 |
equalsJoinMap, notEqualsJoinMap, "minimumQty")
|
2024 |
equalsJoinMap, notEqualsJoinMap, "minimumQty")
|
| 2025 |
.stream().map(x -> x.getCatalogId()).collect(Collectors.toList());
|
2025 |
.stream().map(x -> x.getCatalogId()).collect(Collectors.toList());
|
| 2026 |
|
2026 |
|
| - |
|
2027 |
*/
|
| 2027 |
Map<Integer, Integer> focusedCatalogIdAndQtyMap = focusedModelRepository
|
2028 |
Map<Integer, Optional<Integer>> focusedCatalogIdAndQtyMap = focusedModelRepository
|
| 2028 |
.selectByCatalogIdsAndRegionIds(catalogIds, regionIds).stream()
|
2029 |
.selectAllByRegionIds(regionIds).stream()
|
| 2029 |
.collect(Collectors.toMap(x -> x.getCatalogId(), x -> x.getMinimumQty()));
|
2030 |
.collect(Collectors.groupingBy(FocusedModel::getCatalogId,
|
| - |
|
2031 |
Collectors.mapping(FocusedModel::getMinimumQty,
|
| - |
|
2032 |
Collectors.maxBy(Integer::compareTo))));
|
| 2030 |
|
2033 |
|
| 2031 |
/*
|
2034 |
/*
|
| 2032 |
* Map<Integer, Integer> focusedCatalogIdAndQtyMap =
|
2035 |
* Map<Integer, Integer> focusedCatalogIdAndQtyMap =
|
| 2033 |
* focusedModelRepository.selectAll().stream() .collect(Collectors.toMap(x ->
|
2036 |
* focusedModelRepository.selectAll().stream() .collect(Collectors.toMap(x ->
|
| 2034 |
* x.getCatalogId(), x -> x.getMinimumQty()));
|
2037 |
* x.getCatalogId(), x -> x.getMinimumQty()));
|
| 2035 |
*/
|
2038 |
*/
|
| 2036 |
|
2039 |
|
| 2037 |
LOGGER.info("focusedCatalogIdAndQtyMap" + focusedCatalogIdAndQtyMap);
|
2040 |
LOGGER.info("focusedCatalogIdAndQtyMap" + focusedCatalogIdAndQtyMap);
|
| 2038 |
|
2041 |
|
| 2039 |
for (Map.Entry<Integer, Integer> entry : focusedCatalogIdAndQtyMap.entrySet()) {
|
2042 |
for (Map.Entry<Integer, Optional<Integer>> entry : focusedCatalogIdAndQtyMap.entrySet()) {
|
| - |
|
2043 |
int minQty = entry.getValue().get();
|
| 2040 |
int inStockQty = 0;
|
2044 |
int inStockQty = 0;
|
| 2041 |
int processingQty = 0;
|
2045 |
int processingQty = 0;
|
| 2042 |
int grnPendingQty = 0;
|
2046 |
int grnPendingQty = 0;
|
| 2043 |
if (processingOrderMap != null) {
|
2047 |
if (processingOrderMap != null) {
|
| 2044 |
processingQty = (processingOrderMap.get(entry.getKey()) == null) ? 0
|
2048 |
processingQty = (processingOrderMap.get(entry.getKey()) == null) ? 0
|
| Line 2055... |
Line 2059... |
| 2055 |
: catalogIdAndQtyMap.get(entry.getKey());
|
2059 |
: catalogIdAndQtyMap.get(entry.getKey());
|
| 2056 |
|
2060 |
|
| 2057 |
}
|
2061 |
}
|
| 2058 |
int totalQty = processingQty + grnPendingQty + inStockQty;
|
2062 |
int totalQty = processingQty + grnPendingQty + inStockQty;
|
| 2059 |
|
2063 |
|
| 2060 |
if (totalQty < entry.getValue()) {
|
2064 |
if (totalQty < minQty) {
|
| 2061 |
|
2065 |
|
| 2062 |
int shortageQty = entry.getValue() - totalQty;
|
2066 |
int shortageQty = minQty - totalQty;
|
| 2063 |
List<Item> item = itemRepository.selectAllByCatalogItemId(entry.getKey());
|
2067 |
List<Item> item = itemRepository.selectAllByCatalogItemId(entry.getKey());
|
| 2064 |
|
2068 |
|
| 2065 |
FocusedModelShortageModel fm = new FocusedModelShortageModel();
|
2069 |
FocusedModelShortageModel fm = new FocusedModelShortageModel();
|
| 2066 |
fm.setFofoId(fofoId);
|
2070 |
fm.setFofoId(fofoId);
|
| 2067 |
fm.setStoreName(customRetailer.getBusinessName());
|
2071 |
fm.setStoreName(customRetailer.getBusinessName());
|
| Line 2346... |
Line 2350... |
| 2346 |
|
2350 |
|
| 2347 |
return sb.toString();
|
2351 |
return sb.toString();
|
| 2348 |
}
|
2352 |
}
|
| 2349 |
|
2353 |
|
| 2350 |
}
|
2354 |
}
|
| - |
|
2355 |
|
| - |
|
2356 |
|
| - |
|
2357 |
|
| - |
|
2358 |
|
| - |
|
2359 |
|
| - |
|
2360 |
|