Subversion Repositories SmartDukaan

Rev

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

Rev 27410 Rev 27690
Line 1... Line 1...
1
package com.spice.profitmandi.web.controller;
1
package com.spice.profitmandi.web.controller;
2
 
2
 
3
import java.time.LocalDateTime;
-
 
4
import java.util.ArrayList;
-
 
5
import java.util.Arrays;
-
 
6
import java.util.HashSet;
-
 
7
import java.util.List;
-
 
8
import java.util.Map;
-
 
9
import java.util.Optional;
-
 
10
import java.util.Set;
-
 
11
import java.util.stream.Collectors;
-
 
12
 
-
 
13
import javax.servlet.http.HttpServletRequest;
-
 
14
import javax.swing.SortOrder;
-
 
15
 
-
 
16
import org.apache.logging.log4j.LogManager;
-
 
17
import org.apache.logging.log4j.Logger;
-
 
18
import org.springframework.beans.factory.annotation.Autowired;
-
 
19
import org.springframework.mail.javamail.JavaMailSender;
-
 
20
import org.springframework.stereotype.Controller;
-
 
21
import org.springframework.transaction.annotation.Transactional;
-
 
22
import org.springframework.ui.Model;
-
 
23
import org.springframework.web.bind.annotation.DeleteMapping;
-
 
24
import org.springframework.web.bind.annotation.GetMapping;
-
 
25
import org.springframework.web.bind.annotation.PostMapping;
-
 
26
import org.springframework.web.bind.annotation.RequestBody;
-
 
27
import org.springframework.web.bind.annotation.RequestParam;
-
 
28
 
-
 
29
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
3
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
30
import com.spice.profitmandi.common.model.CustomRetailer;
4
import com.spice.profitmandi.common.model.CustomRetailer;
31
import com.spice.profitmandi.common.util.Utils;
5
import com.spice.profitmandi.common.util.Utils;
32
import com.spice.profitmandi.dao.entity.auth.AuthUser;
6
import com.spice.profitmandi.dao.entity.auth.AuthUser;
33
import com.spice.profitmandi.dao.entity.cs.Activity;
-
 
34
import com.spice.profitmandi.dao.entity.cs.ActivityAttachment;
-
 
35
import com.spice.profitmandi.dao.entity.cs.PartnerPosition;
-
 
36
import com.spice.profitmandi.dao.entity.cs.Position;
-
 
37
import com.spice.profitmandi.dao.entity.cs.Region;
-
 
38
import com.spice.profitmandi.dao.entity.cs.Ticket;
7
import com.spice.profitmandi.dao.entity.cs.*;
39
import com.spice.profitmandi.dao.entity.cs.TicketAssigned;
-
 
40
import com.spice.profitmandi.dao.entity.cs.TicketCategory;
-
 
41
import com.spice.profitmandi.dao.entity.cs.TicketSearchType;
-
 
42
import com.spice.profitmandi.dao.entity.cs.TicketSubCategory;
-
 
43
import com.spice.profitmandi.dao.entity.dtr.Document;
8
import com.spice.profitmandi.dao.entity.dtr.Document;
44
import com.spice.profitmandi.dao.entity.fofo.ActivityType;
9
import com.spice.profitmandi.dao.entity.fofo.ActivityType;
45
import com.spice.profitmandi.dao.enumuration.cs.EscalationType;
10
import com.spice.profitmandi.dao.enumuration.cs.EscalationType;
46
import com.spice.profitmandi.dao.enumuration.cs.TicketStatus;
11
import com.spice.profitmandi.dao.enumuration.cs.TicketStatus;
47
import com.spice.profitmandi.dao.model.CreatePositionModel;
12
import com.spice.profitmandi.dao.model.CreatePositionModel;
48
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
13
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
49
import com.spice.profitmandi.dao.repository.catalog.DeviceRepository;
-
 
50
import com.spice.profitmandi.dao.repository.cs.ActivityAttachmentRepository;
-
 
51
import com.spice.profitmandi.dao.repository.cs.ActivityRepository;
-
 
52
import com.spice.profitmandi.dao.repository.cs.CsService;
14
import com.spice.profitmandi.dao.repository.cs.*;
53
import com.spice.profitmandi.dao.repository.cs.PartnerRegionRepository;
-
 
54
import com.spice.profitmandi.dao.repository.cs.PartnersPositionRepository;
-
 
55
import com.spice.profitmandi.dao.repository.cs.PositionRepository;
-
 
56
import com.spice.profitmandi.dao.repository.cs.RegionRepository;
-
 
57
import com.spice.profitmandi.dao.repository.cs.TicketAssignedRepository;
-
 
58
import com.spice.profitmandi.dao.repository.cs.TicketCategoryRepository;
-
 
59
import com.spice.profitmandi.dao.repository.cs.TicketRepository;
-
 
60
import com.spice.profitmandi.dao.repository.cs.TicketSubCategoryRepository;
-
 
61
import com.spice.profitmandi.dao.repository.dtr.DocumentRepository;
15
import com.spice.profitmandi.dao.repository.dtr.DocumentRepository;
62
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
16
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
63
import com.spice.profitmandi.service.authentication.RoleManager;
17
import com.spice.profitmandi.service.authentication.RoleManager;
64
import com.spice.profitmandi.service.slab.TargetSlabService;
-
 
65
import com.spice.profitmandi.service.user.RetailerService;
18
import com.spice.profitmandi.service.user.RetailerService;
66
import com.spice.profitmandi.web.model.LoginDetails;
19
import com.spice.profitmandi.web.model.LoginDetails;
67
import com.spice.profitmandi.web.util.CookiesProcessor;
20
import com.spice.profitmandi.web.util.CookiesProcessor;
68
import com.spice.profitmandi.web.util.MVCResponseSender;
21
import com.spice.profitmandi.web.util.MVCResponseSender;
-
 
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.mail.javamail.JavaMailSender;
-
 
26
import org.springframework.stereotype.Controller;
-
 
27
import org.springframework.transaction.annotation.Transactional;
-
 
28
import org.springframework.ui.Model;
-
 
29
import org.springframework.web.bind.annotation.*;
-
 
30
 
-
 
31
import javax.servlet.http.HttpServletRequest;
-
 
32
import javax.swing.*;
-
 
33
import java.time.LocalDateTime;
-
 
34
import java.util.*;
-
 
35
import java.util.stream.Collectors;
69
 
36
 
70
@Controller
37
@Controller
71
@Transactional(rollbackFor = Throwable.class)
38
@Transactional(rollbackFor = Throwable.class)
72
public class CsController {
39
public class CsController {
73
 
40
 
Line 94... Line 61...
94
	private TicketSubCategoryRepository ticketSubCategoryRepository;
61
	private TicketSubCategoryRepository ticketSubCategoryRepository;
95
 
62
 
96
	@Autowired
63
	@Autowired
97
	private RegionRepository regionRepository;
64
	private RegionRepository regionRepository;
98
 
65
 
99
	@Autowired
-
 
100
	private TargetSlabService targetSlabService;
-
 
101
 
66
 
102
	@Autowired
67
	@Autowired
103
	private RetailerService retailerService;
68
	private RetailerService retailerService;
104
 
69
 
105
	@Autowired
70
	@Autowired
Line 219... Line 184...
219
	}
184
	}
220
 
185
 
221
	@GetMapping(value = "/cs/getPartners")
186
	@GetMapping(value = "/cs/getPartners")
222
	public String getPartners(HttpServletRequest request,
187
	public String getPartners(HttpServletRequest request,
223
			@RequestParam(name = "regionId", defaultValue = "0") int regionId, Model model) {
188
			@RequestParam(name = "regionId", defaultValue = "0") int regionId, Model model) {
224
		List<Integer> fofoIds = targetSlabService.getfofoIdsFromfofoStore();
189
		List<Integer> fofoIds = fofoStoreRepository.selectAll().stream().map(x->x.getId()).collect(Collectors.toList());
225
		List<Integer> addedfofoIds = partnerRegionRepository.selectByRegionId(regionId).stream().map(x -> x.getFofoId())
190
		List<Integer> addedfofoIds = partnerRegionRepository.selectByRegionId(regionId).stream().map(x -> x.getFofoId())
226
				.collect(Collectors.toList());
191
				.collect(Collectors.toList());
227
		Map<Integer, CustomRetailer> fofoRetailers = retailerService.getFofoRetailers(fofoIds);
192
		Map<Integer, CustomRetailer> fofoRetailers = retailerService.getFofoRetailers(fofoIds);
228
		model.addAttribute("fofoRetailers", fofoRetailers);
193
		model.addAttribute("fofoRetailers", fofoRetailers);
229
		model.addAttribute("addedfofoIds", addedfofoIds);
194
		model.addAttribute("addedfofoIds", addedfofoIds);