| Line 2... |
Line 2... |
| 2 |
|
2 |
|
| 3 |
import java.time.LocalDate;
|
3 |
import java.time.LocalDate;
|
| 4 |
import java.time.LocalDateTime;
|
4 |
import java.time.LocalDateTime;
|
| 5 |
import java.time.LocalTime;
|
5 |
import java.time.LocalTime;
|
| 6 |
import java.util.ArrayList;
|
6 |
import java.util.ArrayList;
|
| - |
|
7 |
import java.util.Arrays;
|
| 7 |
import java.util.LinkedHashMap;
|
8 |
import java.util.LinkedHashMap;
|
| 8 |
import java.util.List;
|
9 |
import java.util.List;
|
| 9 |
import java.util.Map;
|
10 |
import java.util.Map;
|
| 10 |
import java.util.stream.Collectors;
|
11 |
import java.util.stream.Collectors;
|
| 11 |
|
12 |
|
| Line 20... |
Line 21... |
| 20 |
import org.springframework.ui.Model;
|
21 |
import org.springframework.ui.Model;
|
| 21 |
import org.springframework.web.bind.annotation.RequestMapping;
|
22 |
import org.springframework.web.bind.annotation.RequestMapping;
|
| 22 |
import org.springframework.web.bind.annotation.RequestMethod;
|
23 |
import org.springframework.web.bind.annotation.RequestMethod;
|
| 23 |
|
24 |
|
| 24 |
import com.mongodb.DBObject;
|
25 |
import com.mongodb.DBObject;
|
| - |
|
26 |
import com.spice.profitmandi.common.enumuration.ItemType;
|
| 25 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
27 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| 26 |
import com.spice.profitmandi.common.model.BrandStockPrice;
|
28 |
import com.spice.profitmandi.common.model.BrandStockPrice;
|
| - |
|
29 |
import com.spice.profitmandi.common.model.InventoryItemAgingModel;
|
| 27 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
30 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
| 28 |
import com.spice.profitmandi.dao.entity.fofo.FofoOrderItem;
|
31 |
import com.spice.profitmandi.dao.entity.fofo.FofoOrderItem;
|
| 29 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
32 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
| 30 |
import com.spice.profitmandi.dao.entity.fofo.PartnerDailyInvestment;
|
33 |
import com.spice.profitmandi.dao.entity.fofo.PartnerDailyInvestment;
|
| 31 |
import com.spice.profitmandi.dao.repository.catalog.ItemRepository;
|
34 |
import com.spice.profitmandi.dao.repository.catalog.ItemRepository;
|
| Line 162... |
Line 165... |
| 162 |
salesMap.put("todaySale", todaySale);
|
165 |
salesMap.put("todaySale", todaySale);
|
| 163 |
salesMap.put("mtdSale", mtdSale);
|
166 |
salesMap.put("mtdSale", mtdSale);
|
| 164 |
return salesMap;
|
167 |
return salesMap;
|
| 165 |
}
|
168 |
}
|
| 166 |
|
169 |
|
| 167 |
private List<BrandStockPrice> getBrandStockPrices(int fofoId) {
|
170 |
private List<BrandStockPrice> getBrandStockPrices(int fofoId) throws Exception {
|
| 168 |
Map<String, BrandStockPrice> brandStockPricesMap = inventoryService.getBrandWiseStockValue(fofoId);
|
171 |
Map<String, BrandStockPrice> brandStockPricesMap = inventoryService.getBrandWiseStockValue(fofoId);
|
| - |
|
172 |
List<InventoryItemAgingModel> models = inventoryService.getItemAgingByInterval(fofoId, Arrays.asList(30));
|
| - |
|
173 |
Map<String,Integer> brandWiseQty = models.stream()
|
| - |
|
174 |
.filter(x->x.getItemType().equals(ItemType.SERIALIZED.toString()))
|
| - |
|
175 |
.collect(
|
| - |
|
176 |
Collectors.groupingBy(x->x.getBrand(),
|
| - |
|
177 |
Collectors.summingInt(x->x.getValues().get(1).getQuantity())));
|
| - |
|
178 |
Map<String,Double> brandWiseValue = models.stream()
|
| - |
|
179 |
.filter(x->x.getItemType().equals(ItemType.SERIALIZED.toString()))
|
| - |
|
180 |
.collect(
|
| - |
|
181 |
Collectors.groupingBy(x->x.getBrand(),
|
| - |
|
182 |
Collectors.summingDouble(x->x.getValues().get(1).getQuantity()*x.getValues().get(1).getPrice())));
|
| 169 |
List<DBObject> mobileBrands = mongoClient.getMongoBrands(fofoId, "", 3);
|
183 |
List<DBObject> mobileBrands = mongoClient.getMongoBrands(fofoId, "", 3);
|
| 170 |
List<BrandStockPrice> brandStockPrices = new ArrayList<>();
|
184 |
List<BrandStockPrice> brandStockPrices = new ArrayList<>();
|
| - |
|
185 |
|
| 171 |
mobileBrands.stream().forEach(x -> {
|
186 |
mobileBrands.stream().forEach(x -> {
|
| 172 |
String brand = (String) x.get("name");
|
187 |
String brand = (String) x.get("name");
|
| 173 |
if (brandStockPricesMap.containsKey(brand)) {
|
188 |
if (brandStockPricesMap.containsKey(brand)) {
|
| 174 |
BrandStockPrice brandStockPrice = brandStockPricesMap.get(brand);
|
189 |
BrandStockPrice brandStockPrice = brandStockPricesMap.get(brand);
|
| - |
|
190 |
brandStockPrice.setAgedQty(brandWiseQty.get(brand));
|
| - |
|
191 |
brandStockPrice.setAgedValue(brandWiseValue.get(brand));
|
| 175 |
brandStockPrice.setBrandUrl((String) x.get("url"));
|
192 |
brandStockPrice.setBrandUrl((String) x.get("url"));
|
| 176 |
brandStockPrice.setRank(((Double) x.get("rank")).intValue());
|
193 |
brandStockPrice.setRank(((Double) x.get("rank")).intValue());
|
| 177 |
brandStockPrices.add(brandStockPrice);
|
194 |
brandStockPrices.add(brandStockPrice);
|
| 178 |
} else {
|
195 |
} else {
|
| 179 |
}
|
196 |
}
|