| Line 1... |
Line 1... |
| 1 |
package com.spice.profitmandi.service;
|
1 |
package com.spice.profitmandi.service;
|
| 2 |
|
2 |
|
| 3 |
import java.time.LocalDate;
|
- |
|
| 4 |
import java.time.LocalDateTime;
|
- |
|
| 5 |
import java.time.LocalTime;
|
- |
|
| 6 |
import java.time.Period;
|
- |
|
| 7 |
import java.time.YearMonth;
|
- |
|
| 8 |
import java.time.ZoneOffset;
|
- |
|
| 9 |
import java.time.format.DateTimeFormatter;
|
- |
|
| 10 |
import java.util.ArrayList;
|
- |
|
| 11 |
import java.util.Arrays;
|
- |
|
| 12 |
import java.util.Collection;
|
- |
|
| 13 |
import java.util.HashMap;
|
- |
|
| 14 |
import java.util.HashSet;
|
- |
|
| 15 |
import java.util.LinkedHashMap;
|
- |
|
| 16 |
import java.util.LinkedHashSet;
|
- |
|
| 17 |
import java.util.List;
|
- |
|
| 18 |
import java.util.Map;
|
- |
|
| 19 |
import java.util.Optional;
|
- |
|
| 20 |
import java.util.TreeMap;
|
- |
|
| 21 |
import java.util.Map.Entry;
|
- |
|
| 22 |
import java.util.stream.Collectors;
|
- |
|
| 23 |
|
- |
|
| 24 |
import org.apache.logging.log4j.LogManager;
|
- |
|
| 25 |
import org.apache.logging.log4j.Logger;
|
- |
|
| 26 |
import org.springframework.beans.factory.annotation.Autowired;
|
- |
|
| 27 |
import org.springframework.stereotype.Component;
|
- |
|
| 28 |
|
- |
|
| 29 |
import com.google.common.collect.ArrayListMultimap;
|
- |
|
| 30 |
import com.google.common.collect.Multimap;
|
- |
|
| 31 |
import com.google.gson.Gson;
|
3 |
import com.google.gson.Gson;
|
| 32 |
import com.mongodb.DBObject;
|
4 |
import com.mongodb.DBObject;
|
| 33 |
import com.spice.profitmandi.common.enumuration.MessageType;
|
5 |
import com.spice.profitmandi.common.enumuration.MessageType;
|
| 34 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
6 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| 35 |
import com.spice.profitmandi.common.model.Axis;
|
7 |
import com.spice.profitmandi.common.model.*;
|
| 36 |
import com.spice.profitmandi.common.model.BrandStockPrice;
|
- |
|
| 37 |
import com.spice.profitmandi.common.model.ChartInvestmentModel;
|
- |
|
| 38 |
import com.spice.profitmandi.common.model.ChartModel;
|
- |
|
| 39 |
import com.spice.profitmandi.common.model.Data;
|
- |
|
| 40 |
import com.spice.profitmandi.common.model.DataInvestmentModel;
|
- |
|
| 41 |
import com.spice.profitmandi.common.model.DataModel;
|
- |
|
| 42 |
import com.spice.profitmandi.common.model.DatasetModel;
|
- |
|
| 43 |
import com.spice.profitmandi.common.model.HoverModel;
|
- |
|
| 44 |
import com.spice.profitmandi.common.model.Legend;
|
- |
|
| 45 |
import com.spice.profitmandi.common.model.LegendModel;
|
- |
|
| 46 |
import com.spice.profitmandi.common.model.Notification;
|
- |
|
| 47 |
import com.spice.profitmandi.common.model.OptionModel;
|
- |
|
| 48 |
import com.spice.profitmandi.common.model.OptionsModel;
|
- |
|
| 49 |
import com.spice.profitmandi.common.model.PieLables;
|
- |
|
| 50 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
- |
|
| 51 |
import com.spice.profitmandi.common.model.ScalesModel;
|
- |
|
| 52 |
import com.spice.profitmandi.common.model.TitleModel;
|
- |
|
| 53 |
import com.spice.profitmandi.common.model.Tooltips;
|
- |
|
| 54 |
import com.spice.profitmandi.dao.Interface.Campaign;
|
8 |
import com.spice.profitmandi.dao.Interface.Campaign;
|
| 55 |
import com.spice.profitmandi.dao.entity.dtr.Document;
|
9 |
import com.spice.profitmandi.dao.entity.dtr.Document;
|
| 56 |
import com.spice.profitmandi.dao.entity.dtr.NotificationCampaign;
|
10 |
import com.spice.profitmandi.dao.entity.dtr.NotificationCampaign;
|
| 57 |
import com.spice.profitmandi.dao.entity.fofo.PartnerDailyInvestment;
|
11 |
import com.spice.profitmandi.dao.entity.fofo.PartnerDailyInvestment;
|
| 58 |
import com.spice.profitmandi.dao.entity.fofo.PartnerTargetDetails;
|
12 |
import com.spice.profitmandi.dao.entity.fofo.PartnerTargetDetails;
|
| 59 |
import com.spice.profitmandi.dao.entity.fofo.PartnerType;
|
13 |
import com.spice.profitmandi.dao.entity.fofo.PartnerType;
|
| 60 |
import com.spice.profitmandi.dao.model.BrandWiseModel;
|
14 |
import com.spice.profitmandi.dao.model.BrandWiseModel;
|
| 61 |
import com.spice.profitmandi.dao.model.SecondaryOrderBilledLmsModel;
|
- |
|
| 62 |
import com.spice.profitmandi.dao.model.SimpleCampaign;
|
15 |
import com.spice.profitmandi.dao.model.SimpleCampaign;
|
| 63 |
import com.spice.profitmandi.dao.model.SimpleCampaignParams;
|
16 |
import com.spice.profitmandi.dao.model.SimpleCampaignParams;
|
| 64 |
import com.spice.profitmandi.dao.repository.cs.CsService;
|
- |
|
| 65 |
import com.spice.profitmandi.dao.repository.dtr.DocumentRepository;
|
17 |
import com.spice.profitmandi.dao.repository.dtr.DocumentRepository;
|
| 66 |
import com.spice.profitmandi.dao.repository.dtr.Mongo;
|
18 |
import com.spice.profitmandi.dao.repository.dtr.Mongo;
|
| 67 |
import com.spice.profitmandi.dao.repository.fofo.CurrentInventorySnapshotRepository;
|
- |
|
| 68 |
import com.spice.profitmandi.dao.repository.fofo.FofoOrderItemRepository;
|
- |
|
| 69 |
import com.spice.profitmandi.dao.repository.fofo.FofoOrderRepository;
|
19 |
import com.spice.profitmandi.dao.repository.fofo.*;
|
| 70 |
import com.spice.profitmandi.dao.repository.fofo.PartnerDailyInvestmentRepository;
|
- |
|
| 71 |
import com.spice.profitmandi.dao.repository.fofo.PartnerTargetRepository;
|
- |
|
| 72 |
import com.spice.profitmandi.dao.repository.fofo.PartnerTypeChangeService;
|
- |
|
| 73 |
import com.spice.profitmandi.dao.repository.transaction.OrderRepository;
|
20 |
import com.spice.profitmandi.dao.repository.transaction.OrderRepository;
|
| 74 |
import com.spice.profitmandi.service.inventory.InventoryService;
|
21 |
import com.spice.profitmandi.service.inventory.InventoryService;
|
| - |
|
22 |
import org.apache.logging.log4j.LogManager;
|
| - |
|
23 |
import org.apache.logging.log4j.Logger;
|
| - |
|
24 |
import org.springframework.beans.factory.annotation.Autowired;
|
| - |
|
25 |
import org.springframework.stereotype.Component;
|
| - |
|
26 |
|
| - |
|
27 |
import java.time.*;
|
| - |
|
28 |
import java.time.format.DateTimeFormatter;
|
| - |
|
29 |
import java.util.*;
|
| - |
|
30 |
import java.util.Map.Entry;
|
| - |
|
31 |
import java.util.stream.Collectors;
|
| 75 |
|
32 |
|
| 76 |
@Component
|
33 |
@Component
|
| 77 |
public class FofoUser {
|
34 |
public class FofoUser {
|
| 78 |
|
35 |
|
| 79 |
@Autowired
|
36 |
@Autowired
|
| Line 170... |
Line 127... |
| 170 |
brandStockPrice.setRank(((Double) x.get("rank")).intValue());
|
127 |
brandStockPrice.setRank(((Double) x.get("rank")).intValue());
|
| 171 |
brandStockPrices.add(brandStockPrice);
|
128 |
brandStockPrices.add(brandStockPrice);
|
| 172 |
}
|
129 |
}
|
| 173 |
});
|
130 |
});
|
| 174 |
|
131 |
|
| 175 |
return brandStockPrices.stream().filter(x -> x.getTotalQty() > 0).sorted((x, y) -> x.getRank() - y.getRank())
|
132 |
return brandStockPrices.stream().filter(x -> x.getTotalQty() > 0).sorted(Comparator.comparingInt(BrandStockPrice::getRank))
|
| 176 |
.collect(Collectors.toList());
|
133 |
.collect(Collectors.toList());
|
| 177 |
}
|
134 |
}
|
| 178 |
|
135 |
|
| 179 |
public Map<String, Object> getInvestments(int fofoId) throws Exception {
|
136 |
public Map<String, Object> getInvestments(int fofoId) throws Exception {
|
| 180 |
Map<String, Object> investments = new LinkedHashMap<>();
|
137 |
Map<String, Object> investments = new LinkedHashMap<>();
|