Subversion Repositories SmartDukaan

Rev

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

Rev 29198 Rev 30056
Line 1... Line 1...
1
package com.spice.profitmandi.service;
1
package com.spice.profitmandi.service;
2
 
2
 
3
import java.io.FileInputStream;
-
 
4
import java.io.ObjectInputStream;
-
 
5
import java.time.LocalDate;
-
 
6
import java.time.LocalDateTime;
-
 
7
import java.time.Period;
-
 
8
import java.time.YearMonth;
-
 
9
import java.time.format.DateTimeFormatter;
-
 
10
import java.util.ArrayList;
-
 
11
import java.util.Arrays;
-
 
12
import java.util.Comparator;
-
 
13
import java.util.HashMap;
-
 
14
import java.util.HashSet;
-
 
15
import java.util.LinkedHashMap;
-
 
16
import java.util.List;
-
 
17
import java.util.Map;
-
 
18
import java.util.Optional;
-
 
19
import java.util.Set;
-
 
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
import org.springframework.ui.Model;
-
 
29
 
-
 
30
import com.google.gson.Gson;
3
import com.google.gson.Gson;
31
import com.spice.profitmandi.common.enumuration.ReporticoProject;
4
import com.spice.profitmandi.common.enumuration.ReporticoProject;
32
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
5
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
33
import com.spice.profitmandi.common.model.ChartInvestmentModel;
-
 
34
import com.spice.profitmandi.common.model.ChartModel;
-
 
35
import com.spice.profitmandi.common.model.CustomRetailer;
-
 
36
import com.spice.profitmandi.common.model.Data;
6
import com.spice.profitmandi.common.model.*;
37
import com.spice.profitmandi.common.model.DataInvestmentModel;
-
 
38
import com.spice.profitmandi.common.model.Legend;
-
 
39
import com.spice.profitmandi.common.model.OptionModel;
-
 
40
import com.spice.profitmandi.common.model.PieLables;
-
 
41
import com.spice.profitmandi.common.model.ProfitMandiConstants;
-
 
42
import com.spice.profitmandi.dao.entity.auth.AuthUser;
7
import com.spice.profitmandi.dao.entity.auth.AuthUser;
43
import com.spice.profitmandi.dao.entity.auth.Menu;
8
import com.spice.profitmandi.dao.entity.auth.Menu;
44
import com.spice.profitmandi.dao.entity.cs.Position;
9
import com.spice.profitmandi.dao.entity.cs.Position;
45
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
10
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
46
import com.spice.profitmandi.dao.entity.fofo.PartnerType;
11
import com.spice.profitmandi.dao.entity.fofo.PartnerType;
47
import com.spice.profitmandi.dao.entity.inventory.ReporticoCacheTable;
12
import com.spice.profitmandi.dao.entity.inventory.ReporticoCacheTable;
48
import com.spice.profitmandi.dao.enumuration.cs.EscalationType;
13
import com.spice.profitmandi.dao.enumuration.cs.EscalationType;
49
import com.spice.profitmandi.dao.model.BrandWiseActivatedModel;
-
 
50
import com.spice.profitmandi.dao.model.BrandWiseModel;
14
import com.spice.profitmandi.dao.model.BrandWiseModel;
51
import com.spice.profitmandi.dao.model.PartnerDetailModel;
15
import com.spice.profitmandi.dao.model.PartnerDetailModel;
52
import com.spice.profitmandi.dao.model.WarehouseWiseStockModel;
16
import com.spice.profitmandi.dao.model.WarehouseWiseStockModel;
53
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
17
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
54
import com.spice.profitmandi.dao.repository.auth.MenuCategoryRepository;
18
import com.spice.profitmandi.dao.repository.auth.MenuCategoryRepository;
Line 60... Line 24...
60
import com.spice.profitmandi.dao.repository.fofo.ActivatedImeiRepository;
24
import com.spice.profitmandi.dao.repository.fofo.ActivatedImeiRepository;
61
import com.spice.profitmandi.dao.repository.inventory.ReporticoCacheTableRepository;
25
import com.spice.profitmandi.dao.repository.inventory.ReporticoCacheTableRepository;
62
import com.spice.profitmandi.dao.repository.inventory.SaholicInventoryCISRepository;
26
import com.spice.profitmandi.dao.repository.inventory.SaholicInventoryCISRepository;
63
import com.spice.profitmandi.dao.repository.transaction.OrderRepository;
27
import com.spice.profitmandi.dao.repository.transaction.OrderRepository;
64
import com.spice.profitmandi.service.user.RetailerService;
28
import com.spice.profitmandi.service.user.RetailerService;
-
 
29
import org.apache.logging.log4j.LogManager;
-
 
30
import org.apache.logging.log4j.Logger;
-
 
31
import org.springframework.beans.factory.annotation.Autowired;
-
 
32
import org.springframework.stereotype.Component;
-
 
33
import org.springframework.ui.Model;
-
 
34
 
-
 
35
import java.io.FileInputStream;
-
 
36
import java.io.ObjectInputStream;
-
 
37
import java.time.LocalDate;
-
 
38
import java.time.LocalDateTime;
-
 
39
import java.time.Period;
-
 
40
import java.time.YearMonth;
-
 
41
import java.time.format.DateTimeFormatter;
-
 
42
import java.util.*;
-
 
43
import java.util.Map.Entry;
-
 
44
import java.util.stream.Collectors;
65
 
45
 
66
@Component
46
@Component
67
public class AdminUser {
47
public class AdminUser {
68
	@Autowired
48
	@Autowired
69
	private Gson gson;
49
	private Gson gson;
Line 481... Line 461...
481
					Set<CustomRetailer> positionRetailers = new HashSet<>();
461
					Set<CustomRetailer> positionRetailers = new HashSet<>();
482
					csService.getPositionCustomRetailerMap(warehousePositions).values().forEach(customRetailers -> {
462
					csService.getPositionCustomRetailerMap(warehousePositions).values().forEach(customRetailers -> {
483
						positionRetailers.addAll(customRetailers);
463
						positionRetailers.addAll(customRetailers);
484
					});
464
					});
485
					model.addAttribute("reporticoProjectMap", ReporticoProject.warehouseReporticoMap);
465
					model.addAttribute("reporticoProjectMap", ReporticoProject.warehouseReporticoMap);
-
 
466
					model.addAttribute("retailers", gson.toJson(positionRetailers));
-
 
467
					model.addAttribute("warehouses", getWarehouses(positionRetailers));
-
 
468
				}
-
 
469
				List<Position> categoryPositions = positions.stream()
-
 
470
						.filter(x -> x.getCategoryId() == ProfitMandiConstants.TICKET_CATEGORY_CATEGORY)
-
 
471
						.collect(Collectors.toList());
-
 
472
				if (categoryPositions.size() > 0) {
-
 
473
					Set<CustomRetailer> positionRetailers = new HashSet<>();
-
 
474
					csService.getPositionCustomRetailerMap(warehousePositions).values().forEach(customRetailers -> {
-
 
475
						positionRetailers.addAll(customRetailers);
-
 
476
					});
-
 
477
					model.addAttribute("reporticoProjectMap", ReporticoProject.warehouseReporticoMap);
486
					model.addAttribute("retailers", gson.toJson(positionRetailers));
478
					model.addAttribute("retailers", gson.toJson(positionRetailers));
487
					model.addAttribute("warehouses", getWarehouses(positionRetailers));
479
					model.addAttribute("warehouses", getWarehouses(positionRetailers));
488
				}
480
				}
489
			}
481
			}
490
 
482