Subversion Repositories SmartDukaan

Rev

Rev 25174 | Rev 25179 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 25174 Rev 25175
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;
-
 
8
import java.util.HashMap;
-
 
9
import java.util.LinkedHashMap;
7
import java.util.LinkedHashMap;
10
import java.util.List;
8
import java.util.List;
11
import java.util.Map;
9
import java.util.Map;
12
import java.util.stream.Collectors;
10
import java.util.stream.Collectors;
13
 
11
 
Line 22... Line 20...
22
import org.springframework.ui.Model;
20
import org.springframework.ui.Model;
23
import org.springframework.web.bind.annotation.RequestMapping;
21
import org.springframework.web.bind.annotation.RequestMapping;
24
import org.springframework.web.bind.annotation.RequestMethod;
22
import org.springframework.web.bind.annotation.RequestMethod;
25
 
23
 
26
import com.mongodb.DBObject;
24
import com.mongodb.DBObject;
27
import com.spice.profitmandi.common.enumuration.ItemType;
-
 
28
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
25
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
29
import com.spice.profitmandi.common.model.BrandStockPrice;
26
import com.spice.profitmandi.common.model.BrandStockPrice;
30
import com.spice.profitmandi.common.model.InventoryItemAgingModel;
-
 
31
import com.spice.profitmandi.common.model.ProfitMandiConstants;
27
import com.spice.profitmandi.common.model.ProfitMandiConstants;
32
import com.spice.profitmandi.dao.entity.fofo.FofoOrderItem;
28
import com.spice.profitmandi.dao.entity.fofo.FofoOrderItem;
33
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
29
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
34
import com.spice.profitmandi.dao.entity.fofo.PartnerDailyInvestment;
30
import com.spice.profitmandi.dao.entity.fofo.PartnerDailyInvestment;
35
import com.spice.profitmandi.dao.repository.catalog.ItemRepository;
31
import com.spice.profitmandi.dao.repository.catalog.ItemRepository;
36
import com.spice.profitmandi.dao.repository.catalog.TagListingRepository;
-
 
37
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
32
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
38
import com.spice.profitmandi.dao.repository.dtr.InsurancePolicyRepository;
33
import com.spice.profitmandi.dao.repository.dtr.InsurancePolicyRepository;
39
import com.spice.profitmandi.dao.repository.dtr.InsuranceProviderRepository;
34
import com.spice.profitmandi.dao.repository.dtr.InsuranceProviderRepository;
40
import com.spice.profitmandi.dao.repository.dtr.Mongo;
35
import com.spice.profitmandi.dao.repository.dtr.Mongo;
41
import com.spice.profitmandi.dao.repository.dtr.NotificationPanelRepository;
36
import com.spice.profitmandi.dao.repository.dtr.NotificationPanelRepository;
Line 169... Line 164...
169
		return salesMap;
164
		return salesMap;
170
	}
165
	}
171
 
166
 
172
	private List<BrandStockPrice> getBrandStockPrices(int fofoId) throws Exception {
167
	private List<BrandStockPrice> getBrandStockPrices(int fofoId) throws Exception {
173
		Map<String, BrandStockPrice> brandStockPricesMap = inventoryService.getBrandWiseStockValue(fofoId);
168
		Map<String, BrandStockPrice> brandStockPricesMap = inventoryService.getBrandWiseStockValue(fofoId);
174
		List<InventoryItemAgingModel> models = inventoryService.getItemAgingByInterval(fofoId, Arrays.asList(30));
-
 
175
		
169
 
176
		List<DBObject> mobileBrands = mongoClient.getMongoBrands(fofoId, "", 3);
170
		List<DBObject> mobileBrands = mongoClient.getMongoBrands(fofoId, "", 3);
177
		List<BrandStockPrice> brandStockPrices = new ArrayList<>();
171
		List<BrandStockPrice> brandStockPrices = new ArrayList<>();
178
 
172
 
179
		mobileBrands.stream().forEach(x -> {
173
		mobileBrands.stream().forEach(x -> {
180
			String brand = (String) x.get("name");
174
			String brand = (String) x.get("name");
Line 184... Line 178...
184
				brandStockPrice.setRank(((Double) x.get("rank")).intValue());
178
				brandStockPrice.setRank(((Double) x.get("rank")).intValue());
185
				brandStockPrices.add(brandStockPrice);
179
				brandStockPrices.add(brandStockPrice);
186
			}
180
			}
187
		});
181
		});
188
 
182
 
189
		return brandStockPrices.stream().filter(x->x.getTotalQty()>0).sorted((x, y) -> x.getRank() - y.getRank()).collect(Collectors.toList());
183
		return brandStockPrices.stream().filter(x -> x.getTotalQty() > 0).sorted((x, y) -> x.getRank() - y.getRank())
-
 
184
				.collect(Collectors.toList());
190
	}
185
	}
191
 
186
 
192
	@RequestMapping(value = "/dashboard", method = RequestMethod.GET)
187
	@RequestMapping(value = "/dashboard", method = RequestMethod.GET)
193
	public String dashboard(HttpServletRequest request, Model model) throws Exception {
188
	public String dashboard(HttpServletRequest request, Model model) throws Exception {
194
 
189