| Line 23... |
Line 23... |
| 23 |
import org.apache.logging.log4j.Logger;
|
23 |
import org.apache.logging.log4j.Logger;
|
| 24 |
import org.apache.thrift.TException;
|
24 |
import org.apache.thrift.TException;
|
| 25 |
import org.json.JSONArray;
|
25 |
import org.json.JSONArray;
|
| 26 |
import org.json.JSONObject;
|
26 |
import org.json.JSONObject;
|
| 27 |
import org.springframework.beans.factory.annotation.Autowired;
|
27 |
import org.springframework.beans.factory.annotation.Autowired;
|
| 28 |
import org.springframework.beans.factory.annotation.Qualifier;
|
- |
|
| 29 |
import org.springframework.core.io.ByteArrayResource;
|
28 |
import org.springframework.core.io.ByteArrayResource;
|
| 30 |
import org.springframework.http.HttpHeaders;
|
29 |
import org.springframework.http.HttpHeaders;
|
| 31 |
import org.springframework.http.HttpStatus;
|
30 |
import org.springframework.http.HttpStatus;
|
| 32 |
import org.springframework.http.ResponseEntity;
|
31 |
import org.springframework.http.ResponseEntity;
|
| 33 |
import org.springframework.mail.javamail.JavaMailSender;
|
32 |
import org.springframework.mail.javamail.JavaMailSender;
|
| Line 41... |
Line 40... |
| 41 |
|
40 |
|
| 42 |
import com.spice.profitmandi.common.enumuration.CounterSize;
|
41 |
import com.spice.profitmandi.common.enumuration.CounterSize;
|
| 43 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
42 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| 44 |
import com.spice.profitmandi.common.model.CatalogListingModel;
|
43 |
import com.spice.profitmandi.common.model.CatalogListingModel;
|
| 45 |
import com.spice.profitmandi.common.model.CustomRetailer;
|
44 |
import com.spice.profitmandi.common.model.CustomRetailer;
|
| 46 |
import com.spice.profitmandi.common.model.FocusedModelShortageModel;
|
- |
|
| 47 |
import com.spice.profitmandi.common.model.ItemIdAvailability;
|
45 |
import com.spice.profitmandi.common.model.ItemIdAvailability;
|
| 48 |
import com.spice.profitmandi.common.model.PlannedModel;
|
46 |
import com.spice.profitmandi.common.model.PlannedModel;
|
| 49 |
import com.spice.profitmandi.common.model.StockAllocationModel;
|
47 |
import com.spice.profitmandi.common.model.StockAllocationModel;
|
| 50 |
import com.spice.profitmandi.common.util.FileUtil;
|
48 |
import com.spice.profitmandi.common.util.FileUtil;
|
| 51 |
import com.spice.profitmandi.common.util.FormattingUtils;
|
- |
|
| 52 |
import com.spice.profitmandi.common.util.Utils;
|
49 |
import com.spice.profitmandi.common.util.Utils;
|
| 53 |
import com.spice.profitmandi.common.util.Utils.Attachment;
|
50 |
import com.spice.profitmandi.common.util.Utils.Attachment;
|
| 54 |
import com.spice.profitmandi.dao.entity.catalog.FocusedModel;
|
51 |
import com.spice.profitmandi.dao.entity.catalog.FocusedModel;
|
| 55 |
import com.spice.profitmandi.dao.entity.catalog.Item;
|
52 |
import com.spice.profitmandi.dao.entity.catalog.Item;
|
| 56 |
import com.spice.profitmandi.dao.entity.catalog.TagListing;
|
53 |
import com.spice.profitmandi.dao.entity.catalog.TagListing;
|
| - |
|
54 |
import com.spice.profitmandi.dao.entity.fofo.FofoOrder;
|
| 57 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
55 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
| 58 |
import com.spice.profitmandi.dao.entity.fofo.MonthlyPlanned;
|
56 |
import com.spice.profitmandi.dao.entity.fofo.MonthlyPlanned;
|
| 59 |
import com.spice.profitmandi.dao.entity.fofo.PlannedDetail;
|
57 |
import com.spice.profitmandi.dao.entity.fofo.PlannedDetail;
|
| 60 |
import com.spice.profitmandi.dao.entity.transaction.Order;
|
58 |
import com.spice.profitmandi.dao.entity.transaction.Order;
|
| 61 |
import com.spice.profitmandi.dao.entity.user.User;
|
59 |
import com.spice.profitmandi.dao.entity.user.User;
|
| Line 489... |
Line 487... |
| 489 |
.collect(Collectors.toMap(FocusedModel::getCatalogId, Function.identity()));
|
487 |
.collect(Collectors.toMap(FocusedModel::getCatalogId, Function.identity()));
|
| 490 |
LOGGER.info("fofoId" + loginDetails.getFofoId());
|
488 |
LOGGER.info("fofoId" + loginDetails.getFofoId());
|
| 491 |
Map<Integer, Item> items = itemRepository
|
489 |
Map<Integer, Item> items = itemRepository
|
| 492 |
.selectByIds(tagListings.stream().map(x -> x.getItemId()).collect(Collectors.toSet())).stream()
|
490 |
.selectByIds(tagListings.stream().map(x -> x.getItemId()).collect(Collectors.toSet())).stream()
|
| 493 |
.collect(Collectors.toMap(x -> x.getId(), x -> x));
|
491 |
.collect(Collectors.toMap(x -> x.getId(), x -> x));
|
| - |
|
492 |
List<FofoOrder> fofoOrderMaps = fofoOrderRepository.selectByFofoIdBetweenCreatedTimeStamp(
|
| - |
|
493 |
loginDetails.getFofoId(), LocalDateTime.now().minusDays(15), LocalDateTime.now());
|
| 494 |
|
494 |
|
| - |
|
495 |
LOGGER.info("fofoOrderMaps" + fofoOrderMaps);
|
| 495 |
Map<Integer, Integer> fofoOrderMap = fofoOrderRepository
|
496 |
Map<Integer, Integer> fofoOrderMap = fofoOrderRepository
|
| 496 |
.selectByFofoIdBetweenCreatedTimeStamp(loginDetails.getFofoId(), LocalDateTime.now().minusDays(15),
|
497 |
.selectByFofoIdBetweenCreatedTimeStamp(loginDetails.getFofoId(), LocalDateTime.now().minusDays(15),
|
| 497 |
LocalDateTime.now())
|
498 |
LocalDateTime.now())
|
| 498 |
.stream()
|
499 |
.stream()
|
| 499 |
.collect(Collectors.toMap(x -> x.getOrderItem().getItemId(), x -> x.getOrderItem().getQuantity()));
|
500 |
.collect(Collectors.toMap(x -> x.getOrderItem().getItemId(), x -> x.getOrderItem().getQuantity()));
|
| 500 |
|
501 |
|
| 501 |
LOGGER.info("fofoOrderMap" +fofoOrderMap);
|
502 |
LOGGER.info("fofoOrderMap" + fofoOrderMap);
|
| 502 |
Map<Integer, Integer> last15DaysMap = null;
|
503 |
Map<Integer, Integer> last15DaysMap = null;
|
| 503 |
if (!fofoOrderMap.isEmpty()) {
|
504 |
if (!fofoOrderMap.isEmpty()) {
|
| 504 |
last15DaysMap = itemRepository.selectByIds(fofoOrderMap.keySet()).stream().collect(Collectors
|
505 |
last15DaysMap = itemRepository.selectByIds(fofoOrderMap.keySet()).stream().collect(Collectors
|
| 505 |
.groupingBy(x -> x.getCatalogItemId(), Collectors.summingInt(x -> fofoOrderMap.get(x.getId()))));
|
506 |
.groupingBy(x -> x.getCatalogItemId(), Collectors.summingInt(x -> fofoOrderMap.get(x.getId()))));
|
| 506 |
}
|
507 |
}
|