| 24417 |
govind |
1 |
package com.spice.profitmandi.web.controller;
|
|
|
2 |
|
|
|
3 |
import java.time.LocalDateTime;
|
| 24572 |
amit.gupta |
4 |
import java.util.ArrayList;
|
| 27139 |
amit.gupta |
5 |
import java.util.Arrays;
|
| 24417 |
govind |
6 |
import java.util.HashSet;
|
|
|
7 |
import java.util.List;
|
|
|
8 |
import java.util.Map;
|
|
|
9 |
import java.util.Optional;
|
| 24572 |
amit.gupta |
10 |
import java.util.Set;
|
| 24500 |
govind |
11 |
import java.util.stream.Collectors;
|
| 24417 |
govind |
12 |
|
|
|
13 |
import javax.servlet.http.HttpServletRequest;
|
| 24699 |
govind |
14 |
import javax.swing.SortOrder;
|
| 24417 |
govind |
15 |
|
|
|
16 |
import org.apache.logging.log4j.LogManager;
|
|
|
17 |
import org.apache.logging.log4j.Logger;
|
|
|
18 |
import org.springframework.beans.factory.annotation.Autowired;
|
| 24620 |
govind |
19 |
import org.springframework.mail.javamail.JavaMailSender;
|
| 24417 |
govind |
20 |
import org.springframework.stereotype.Controller;
|
|
|
21 |
import org.springframework.transaction.annotation.Transactional;
|
|
|
22 |
import org.springframework.ui.Model;
|
| 24471 |
govind |
23 |
import org.springframework.web.bind.annotation.DeleteMapping;
|
| 24417 |
govind |
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;
|
|
|
30 |
import com.spice.profitmandi.common.model.CustomRetailer;
|
| 24620 |
govind |
31 |
import com.spice.profitmandi.common.util.Utils;
|
| 24417 |
govind |
32 |
import com.spice.profitmandi.dao.entity.auth.AuthUser;
|
|
|
33 |
import com.spice.profitmandi.dao.entity.cs.Activity;
|
| 27270 |
tejbeer |
34 |
import com.spice.profitmandi.dao.entity.cs.ActivityAttachment;
|
| 25570 |
tejbeer |
35 |
import com.spice.profitmandi.dao.entity.cs.PartnerPosition;
|
| 24417 |
govind |
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;
|
| 24500 |
govind |
39 |
import com.spice.profitmandi.dao.entity.cs.TicketAssigned;
|
| 24417 |
govind |
40 |
import com.spice.profitmandi.dao.entity.cs.TicketCategory;
|
| 24747 |
govind |
41 |
import com.spice.profitmandi.dao.entity.cs.TicketSearchType;
|
| 24417 |
govind |
42 |
import com.spice.profitmandi.dao.entity.cs.TicketSubCategory;
|
| 27270 |
tejbeer |
43 |
import com.spice.profitmandi.dao.entity.dtr.Document;
|
| 24417 |
govind |
44 |
import com.spice.profitmandi.dao.entity.fofo.ActivityType;
|
|
|
45 |
import com.spice.profitmandi.dao.enumuration.cs.EscalationType;
|
| 24699 |
govind |
46 |
import com.spice.profitmandi.dao.enumuration.cs.TicketStatus;
|
| 25570 |
tejbeer |
47 |
import com.spice.profitmandi.dao.model.CreatePositionModel;
|
| 24417 |
govind |
48 |
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
|
| 27270 |
tejbeer |
49 |
import com.spice.profitmandi.dao.repository.catalog.DeviceRepository;
|
|
|
50 |
import com.spice.profitmandi.dao.repository.cs.ActivityAttachmentRepository;
|
| 24417 |
govind |
51 |
import com.spice.profitmandi.dao.repository.cs.ActivityRepository;
|
|
|
52 |
import com.spice.profitmandi.dao.repository.cs.CsService;
|
| 24557 |
govind |
53 |
import com.spice.profitmandi.dao.repository.cs.PartnerRegionRepository;
|
| 25570 |
tejbeer |
54 |
import com.spice.profitmandi.dao.repository.cs.PartnersPositionRepository;
|
| 24417 |
govind |
55 |
import com.spice.profitmandi.dao.repository.cs.PositionRepository;
|
|
|
56 |
import com.spice.profitmandi.dao.repository.cs.RegionRepository;
|
| 24500 |
govind |
57 |
import com.spice.profitmandi.dao.repository.cs.TicketAssignedRepository;
|
| 24417 |
govind |
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;
|
| 27270 |
tejbeer |
61 |
import com.spice.profitmandi.dao.repository.dtr.DocumentRepository;
|
| 25570 |
tejbeer |
62 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
| 24417 |
govind |
63 |
import com.spice.profitmandi.service.authentication.RoleManager;
|
|
|
64 |
import com.spice.profitmandi.service.slab.TargetSlabService;
|
|
|
65 |
import com.spice.profitmandi.service.user.RetailerService;
|
|
|
66 |
import com.spice.profitmandi.web.model.LoginDetails;
|
|
|
67 |
import com.spice.profitmandi.web.util.CookiesProcessor;
|
|
|
68 |
import com.spice.profitmandi.web.util.MVCResponseSender;
|
|
|
69 |
|
|
|
70 |
@Controller
|
|
|
71 |
@Transactional(rollbackFor = Throwable.class)
|
|
|
72 |
public class CsController {
|
|
|
73 |
|
|
|
74 |
private static final Logger LOGGER = LogManager.getLogger(CsController.class);
|
| 24620 |
govind |
75 |
private static final String ACTIVITY_SUBJECT = "Message related ticketId#%s";
|
| 24699 |
govind |
76 |
private static final String PARTNER_RESOLVED_TICKET_MAIL = "Dear Partner , we have resolved your ticket # %s , request to kindly accept the same. In case you still have any concerns regarding the same pls click on %s so that we can help you.Regards\nSmartdukaan";
|
|
|
77 |
private static final String PARTNER_REOPEN = "Dear Partner , Your ticket # %s has been re-opened as per your confirmation & we are committed to resolve it on priority.Regards\nSmartdukaan";
|
| 27205 |
amit.gupta |
78 |
private static final String INTERNAL_REOPEN_MAIL = "Team, Pls note that the Ticket Id %s has been re-opened by %s , pls respond on priority";
|
|
|
79 |
private static final String INTERNAL_REOPEN_ACTIVITY_MESSAGE = "Hi,My ticket is not resolved yet,so I have reopened it";
|
| 24699 |
govind |
80 |
|
| 24417 |
govind |
81 |
@Autowired
|
| 24620 |
govind |
82 |
JavaMailSender mailSender;
|
|
|
83 |
|
|
|
84 |
@Autowired
|
| 24417 |
govind |
85 |
private CsService csService;
|
|
|
86 |
|
|
|
87 |
@Autowired
|
|
|
88 |
private CookiesProcessor cookiesProcessor;
|
|
|
89 |
|
|
|
90 |
@Autowired
|
|
|
91 |
private TicketCategoryRepository ticketCategoryRepository;
|
|
|
92 |
|
|
|
93 |
@Autowired
|
|
|
94 |
private TicketSubCategoryRepository ticketSubCategoryRepository;
|
|
|
95 |
|
|
|
96 |
@Autowired
|
|
|
97 |
private RegionRepository regionRepository;
|
|
|
98 |
|
|
|
99 |
@Autowired
|
|
|
100 |
private TargetSlabService targetSlabService;
|
|
|
101 |
|
|
|
102 |
@Autowired
|
|
|
103 |
private RetailerService retailerService;
|
|
|
104 |
|
|
|
105 |
@Autowired
|
|
|
106 |
private MVCResponseSender mvcResponseSender;
|
|
|
107 |
|
|
|
108 |
@Autowired
|
|
|
109 |
private AuthRepository authRepository;
|
|
|
110 |
|
|
|
111 |
@Autowired
|
|
|
112 |
private PositionRepository positionRepository;
|
|
|
113 |
|
|
|
114 |
@Autowired
|
|
|
115 |
private TicketRepository ticketRepository;
|
|
|
116 |
|
|
|
117 |
@Autowired
|
|
|
118 |
private RoleManager roleManager;
|
|
|
119 |
|
|
|
120 |
@Autowired
|
|
|
121 |
private ActivityRepository activityRepository;
|
|
|
122 |
|
| 24500 |
govind |
123 |
@Autowired
|
| 27270 |
tejbeer |
124 |
private ActivityAttachmentRepository activityAttachmentRepository;
|
|
|
125 |
|
|
|
126 |
@Autowired
|
| 24500 |
govind |
127 |
private TicketAssignedRepository ticketAssignedRepository;
|
| 24569 |
govind |
128 |
|
|
|
129 |
@Autowired
|
| 24557 |
govind |
130 |
private PartnerRegionRepository partnerRegionRepository;
|
| 24500 |
govind |
131 |
|
| 25570 |
tejbeer |
132 |
@Autowired
|
|
|
133 |
PartnersPositionRepository partnersPositionRepository;
|
|
|
134 |
|
|
|
135 |
@Autowired
|
|
|
136 |
FofoStoreRepository fofoStoreRepository;
|
|
|
137 |
|
| 27270 |
tejbeer |
138 |
@Autowired
|
|
|
139 |
DocumentRepository documentRepository;
|
|
|
140 |
|
| 24417 |
govind |
141 |
@GetMapping(value = "/cs/createCategory")
|
|
|
142 |
public String getCreateCategory(HttpServletRequest request, Model model) {
|
|
|
143 |
List<TicketCategory> ticketCategories = ticketCategoryRepository.selectAll();
|
|
|
144 |
model.addAttribute("ticketCategories", ticketCategories);
|
|
|
145 |
return "create-ticket-category";
|
|
|
146 |
}
|
|
|
147 |
|
|
|
148 |
@PostMapping(value = "/cs/createCategory")
|
|
|
149 |
public String createCategory(HttpServletRequest request, @RequestParam(name = "name") String name,
|
|
|
150 |
@RequestParam(name = "description") String description, Model model) throws ProfitMandiBusinessException {
|
|
|
151 |
|
|
|
152 |
TicketCategory ticketCategory = ticketCategoryRepository.selectByName(name);
|
|
|
153 |
if (ticketCategory != null) {
|
|
|
154 |
throw new ProfitMandiBusinessException("name", name, "already exists!");
|
|
|
155 |
}
|
|
|
156 |
ticketCategory = new TicketCategory();
|
|
|
157 |
ticketCategory.setName(name);
|
|
|
158 |
ticketCategory.setDescription(description);
|
|
|
159 |
ticketCategoryRepository.persist(ticketCategory);
|
|
|
160 |
return "create-ticket-category";
|
|
|
161 |
}
|
|
|
162 |
|
|
|
163 |
@GetMapping(value = "/cs/createSubCategory")
|
|
|
164 |
public String getCreateSubCategory(HttpServletRequest request, Model model) {
|
|
|
165 |
List<TicketCategory> ticketCategories = ticketCategoryRepository.selectAll();
|
|
|
166 |
model.addAttribute("ticketCategories", ticketCategories);
|
|
|
167 |
return "create-ticket-sub-category";
|
|
|
168 |
}
|
|
|
169 |
|
|
|
170 |
@GetMapping(value = "/cs/getSubCategoryByCategoryId")
|
|
|
171 |
public String getSubCategoryByCategoryId(HttpServletRequest request,
|
|
|
172 |
@RequestParam(name = "ticketCategoryId", defaultValue = "") int ticketCategoryId, Model model) {
|
|
|
173 |
List<TicketSubCategory> ticketSubCategories = ticketSubCategoryRepository.selectAll(ticketCategoryId);
|
|
|
174 |
TicketCategory ticketCategory = ticketCategoryRepository.selectById(ticketCategoryId);
|
|
|
175 |
model.addAttribute("ticketSubCategories", ticketSubCategories);
|
|
|
176 |
model.addAttribute("ticketCategory", ticketCategory);
|
|
|
177 |
return "ticket-sub-category";
|
|
|
178 |
}
|
|
|
179 |
|
|
|
180 |
@PostMapping(value = "/cs/createSubCategory")
|
|
|
181 |
public String createSubCategory(HttpServletRequest request,
|
|
|
182 |
@RequestParam(name = "categoryId", defaultValue = "0") int categoryId,
|
|
|
183 |
@RequestParam(name = "name") String name, @RequestParam(name = "description") String description,
|
|
|
184 |
Model model) throws ProfitMandiBusinessException {
|
|
|
185 |
|
|
|
186 |
TicketSubCategory ticketSubCategory = ticketSubCategoryRepository.selectTicketSubCategory(categoryId, name);
|
|
|
187 |
if (ticketSubCategory != null) {
|
|
|
188 |
throw new ProfitMandiBusinessException("name & categoryId", name + " " + categoryId, "already exists!");
|
|
|
189 |
}
|
|
|
190 |
|
|
|
191 |
ticketSubCategory = new TicketSubCategory();
|
| 27124 |
amit.gupta |
192 |
ticketSubCategory.setCategoryId(categoryId);
|
| 24417 |
govind |
193 |
ticketSubCategory.setName(name);
|
|
|
194 |
ticketSubCategory.setDescription(description);
|
|
|
195 |
ticketSubCategoryRepository.persist(ticketSubCategory);
|
|
|
196 |
return "create-ticket-sub-category";
|
|
|
197 |
}
|
|
|
198 |
|
|
|
199 |
@GetMapping(value = "/cs/createRegion")
|
|
|
200 |
public String createRegion(HttpServletRequest request, Model model) {
|
|
|
201 |
List<Region> regions = regionRepository.selectAll();
|
|
|
202 |
model.addAttribute("regions", regions);
|
|
|
203 |
return "create-region";
|
|
|
204 |
}
|
|
|
205 |
|
|
|
206 |
@PostMapping(value = "/cs/createRegion")
|
|
|
207 |
public String createRegion(HttpServletRequest request, @RequestParam(name = "name") String name,
|
|
|
208 |
@RequestParam(name = "description") String description, Model model) throws Exception {
|
|
|
209 |
Region region = regionRepository.selectByName(name);
|
|
|
210 |
if (region != null) {
|
|
|
211 |
throw new ProfitMandiBusinessException("name", name, "already exists!");
|
|
|
212 |
}
|
|
|
213 |
region = new Region();
|
|
|
214 |
region.setName(name);
|
|
|
215 |
region.setDescription(description);
|
|
|
216 |
regionRepository.persist(region);
|
|
|
217 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
|
|
218 |
return "response";
|
|
|
219 |
}
|
|
|
220 |
|
| 24557 |
govind |
221 |
@GetMapping(value = "/cs/getPartners")
|
| 24569 |
govind |
222 |
public String getPartners(HttpServletRequest request,
|
|
|
223 |
@RequestParam(name = "regionId", defaultValue = "0") int regionId, Model model) {
|
| 24557 |
govind |
224 |
List<Integer> fofoIds = targetSlabService.getfofoIdsFromfofoStore();
|
| 24569 |
govind |
225 |
List<Integer> addedfofoIds = partnerRegionRepository.selectByRegionId(regionId).stream().map(x -> x.getFofoId())
|
|
|
226 |
.collect(Collectors.toList());
|
| 24557 |
govind |
227 |
Map<Integer, CustomRetailer> fofoRetailers = retailerService.getFofoRetailers(fofoIds);
|
|
|
228 |
model.addAttribute("fofoRetailers", fofoRetailers);
|
|
|
229 |
model.addAttribute("addedfofoIds", addedfofoIds);
|
|
|
230 |
return "added-region-partners";
|
|
|
231 |
}
|
| 24569 |
govind |
232 |
|
| 25570 |
tejbeer |
233 |
@GetMapping(value = "/cs/getPartnersByRegion")
|
|
|
234 |
public String getPartnersByRegion(HttpServletRequest request,
|
|
|
235 |
@RequestParam(name = "regionId", defaultValue = "0") int regionId, Model model) {
|
|
|
236 |
List<Integer> fofoIds = null;
|
|
|
237 |
fofoIds = partnerRegionRepository.selectByRegionId(regionId).stream().map(x -> x.getFofoId())
|
|
|
238 |
.collect(Collectors.toList());
|
|
|
239 |
|
|
|
240 |
if (fofoIds.contains(0)) {
|
|
|
241 |
fofoIds = fofoStoreRepository.selectAll().stream().filter(x -> x.isActive()).collect(Collectors.toList())
|
|
|
242 |
.stream().map(x -> x.getId()).collect(Collectors.toList());
|
|
|
243 |
|
|
|
244 |
}
|
|
|
245 |
Map<Integer, CustomRetailer> fofoRetailers = retailerService.getFofoRetailers(fofoIds);
|
|
|
246 |
|
|
|
247 |
model.addAttribute("fofoRetailers", fofoRetailers);
|
|
|
248 |
return "added-subregion-partners";
|
|
|
249 |
}
|
|
|
250 |
|
| 24417 |
govind |
251 |
@GetMapping(value = "/cs/createPartnerRegion")
|
|
|
252 |
public String createPartnerRegion(HttpServletRequest request, Model model) {
|
|
|
253 |
List<Region> regions = regionRepository.selectAll();
|
|
|
254 |
model.addAttribute("regions", regions);
|
|
|
255 |
return "create-partner-region";
|
|
|
256 |
}
|
|
|
257 |
|
|
|
258 |
@PostMapping(value = "/cs/createPartnerRegion")
|
|
|
259 |
public String createPartnerRegion(HttpServletRequest request, @RequestParam(name = "regionId") int regionId,
|
|
|
260 |
@RequestBody List<Integer> selectedFofoIds, Model model) throws Exception {
|
| 24557 |
govind |
261 |
partnerRegionRepository.delete(regionId);
|
|
|
262 |
LOGGER.info("successfully removed");
|
|
|
263 |
LOGGER.info(selectedFofoIds.size());
|
| 24417 |
govind |
264 |
csService.addPartnerToRegion(regionId, selectedFofoIds);
|
|
|
265 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
|
|
266 |
return "response";
|
|
|
267 |
}
|
|
|
268 |
|
| 27410 |
tejbeer |
269 |
@GetMapping(value = "/cs/getPosition")
|
|
|
270 |
public String getPosition(HttpServletRequest request, @RequestParam int positionId, Model model) {
|
|
|
271 |
|
|
|
272 |
Position position = positionRepository.selectById(positionId);
|
|
|
273 |
|
|
|
274 |
|
|
|
275 |
List<CustomRetailer> positionIdCustomRetailer = csService.getPositionCustomRetailerMap(Arrays.asList(position))
|
|
|
276 |
.get(position.getId());
|
|
|
277 |
|
|
|
278 |
Map<Integer, CustomRetailer> regionRetailerMap = csService.getRegionPartners(Arrays.asList(position))
|
|
|
279 |
.get(position.getRegionId()).stream().collect(Collectors.toMap(x -> x.getPartnerId(), x -> x));
|
|
|
280 |
|
|
|
281 |
|
|
|
282 |
model.addAttribute("position", position);
|
|
|
283 |
model.addAttribute("regionRetailerMap", regionRetailerMap);
|
|
|
284 |
model.addAttribute("positionIdCustomRetailer", positionIdCustomRetailer);
|
|
|
285 |
|
|
|
286 |
|
|
|
287 |
return "position-partner";
|
|
|
288 |
}
|
|
|
289 |
|
| 24417 |
govind |
290 |
@GetMapping(value = "/cs/createPosition")
|
| 24500 |
govind |
291 |
public String createPosition(HttpServletRequest request,
|
|
|
292 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
| 24471 |
govind |
293 |
@RequestParam(name = "limit", defaultValue = "10") int limit, Model model) {
|
| 25570 |
tejbeer |
294 |
List<AuthUser> authUsers = authRepository.selectAllActiveUser();
|
| 24417 |
govind |
295 |
List<TicketCategory> ticketCategories = ticketCategoryRepository.selectAll();
|
|
|
296 |
List<Region> regions = regionRepository.selectAll();
|
|
|
297 |
model.addAttribute("escalationTypes", EscalationType.values());
|
|
|
298 |
model.addAttribute("authUsers", authUsers);
|
|
|
299 |
model.addAttribute("ticketCategories", ticketCategories);
|
|
|
300 |
model.addAttribute("regions", regions);
|
| 24500 |
govind |
301 |
|
|
|
302 |
List<Position> positions = positionRepository.selectAll(offset, limit);
|
|
|
303 |
LOGGER.info(positions);
|
|
|
304 |
Map<Integer, AuthUser> authUserIdAndAuthUserMap = csService
|
|
|
305 |
.getAuthUserIdAndAuthUserMapUsingPositions(positions);
|
|
|
306 |
Map<Integer, TicketCategory> categoryIdAndCategoryMap = csService
|
|
|
307 |
.getCategoryIdAndCategoryUsingPositions(positions);
|
|
|
308 |
Map<Integer, Region> regionIdAndRegionMap = csService.getRegionIdAndRegionMap(positions);
|
| 25570 |
tejbeer |
309 |
|
| 27410 |
tejbeer |
310 |
// Map<Integer, List<CustomRetailer>> positionIdAndpartnerRegionMap = csService
|
|
|
311 |
// .getpositionIdAndpartnerRegionMap(positions);
|
| 25570 |
tejbeer |
312 |
|
| 27410 |
tejbeer |
313 |
// Map<Integer, List<CustomRetailer>> addedpositionIdAndCustomRetailerMap = csService
|
|
|
314 |
// .getPositionCustomRetailerMap(positions);
|
|
|
315 |
// LOGGER.info("fofoIdAndCustomRetailerMap" + addedpositionIdAndCustomRetailerMap);
|
| 24500 |
govind |
316 |
long size = positionRepository.selectAllCount();
|
|
|
317 |
|
| 24471 |
govind |
318 |
if (size < limit) {
|
|
|
319 |
model.addAttribute("end", offset + size);
|
|
|
320 |
} else {
|
|
|
321 |
model.addAttribute("end", offset + limit);
|
|
|
322 |
}
|
| 25570 |
tejbeer |
323 |
|
| 24471 |
govind |
324 |
model.addAttribute("start", offset + 1);
|
|
|
325 |
model.addAttribute("size", size);
|
|
|
326 |
model.addAttribute("positions", positions);
|
|
|
327 |
model.addAttribute("authUserIdAndAuthUserMap", authUserIdAndAuthUserMap);
|
|
|
328 |
model.addAttribute("categoryIdAndCategoryMap", categoryIdAndCategoryMap);
|
|
|
329 |
model.addAttribute("regionIdAndRegionMap", regionIdAndRegionMap);
|
| 27410 |
tejbeer |
330 |
// model.addAttribute("positionIdAndCustomRetailerMap",
|
|
|
331 |
// addedpositionIdAndCustomRetailerMap);
|
|
|
332 |
// model.addAttribute("positionIdAndpartnerRegionMap",
|
|
|
333 |
// positionIdAndpartnerRegionMap);
|
| 25570 |
tejbeer |
334 |
|
| 24417 |
govind |
335 |
return "create-position";
|
|
|
336 |
}
|
| 24500 |
govind |
337 |
|
| 24471 |
govind |
338 |
@GetMapping(value = "/cs/position-paginated")
|
| 24500 |
govind |
339 |
public String positionPaginated(HttpServletRequest request,
|
|
|
340 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
| 24471 |
govind |
341 |
@RequestParam(name = "limit", defaultValue = "10") int limit, Model model) {
|
| 24500 |
govind |
342 |
|
|
|
343 |
List<Position> positions = positionRepository.selectAll(offset, limit);
|
|
|
344 |
Map<Integer, AuthUser> authUserIdAndAuthUserMap = csService
|
|
|
345 |
.getAuthUserIdAndAuthUserMapUsingPositions(positions);
|
|
|
346 |
Map<Integer, TicketCategory> categoryIdAndCategoryMap = csService
|
|
|
347 |
.getCategoryIdAndCategoryUsingPositions(positions);
|
|
|
348 |
Map<Integer, Region> regionIdAndRegionMap = csService.getRegionIdAndRegionMap(positions);
|
| 27410 |
tejbeer |
349 |
/*
|
|
|
350 |
* Map<Integer, List<CustomRetailer>> positionIdAndpartnerRegionMap = csService
|
|
|
351 |
* .getpositionIdAndpartnerRegionMap(positions);
|
|
|
352 |
*
|
|
|
353 |
* Map<Integer, List<CustomRetailer>> addedpositionIdAndCustomRetailerMap =
|
|
|
354 |
* csService .getPositionCustomRetailerMap(positions);
|
|
|
355 |
*/
|
| 25570 |
tejbeer |
356 |
|
| 24471 |
govind |
357 |
model.addAttribute("positions", positions);
|
|
|
358 |
model.addAttribute("authUserIdAndAuthUserMap", authUserIdAndAuthUserMap);
|
|
|
359 |
model.addAttribute("categoryIdAndCategoryMap", categoryIdAndCategoryMap);
|
|
|
360 |
model.addAttribute("regionIdAndRegionMap", regionIdAndRegionMap);
|
| 27410 |
tejbeer |
361 |
// model.addAttribute("positionIdAndCustomRetailerMap",
|
|
|
362 |
// addedpositionIdAndCustomRetailerMap);
|
|
|
363 |
// model.addAttribute("positionIdAndpartnerRegionMap",
|
|
|
364 |
// positionIdAndpartnerRegionMap);
|
| 25570 |
tejbeer |
365 |
|
| 24471 |
govind |
366 |
return "position-paginated";
|
|
|
367 |
}
|
| 24417 |
govind |
368 |
|
|
|
369 |
@PostMapping(value = "/cs/createPosition")
|
| 25570 |
tejbeer |
370 |
public String createPosition(HttpServletRequest request, @RequestBody CreatePositionModel createPositionModel,
|
|
|
371 |
Model model) throws Exception {
|
| 24417 |
govind |
372 |
|
| 25570 |
tejbeer |
373 |
Position position = positionRepository.selectPosition(createPositionModel.getAuthUserId(),
|
|
|
374 |
createPositionModel.getCategoryId(), createPositionModel.getRegionId(),
|
|
|
375 |
createPositionModel.getEscalationType());
|
| 24417 |
govind |
376 |
if (position == null) {
|
|
|
377 |
position = new Position();
|
| 25570 |
tejbeer |
378 |
position.setAuthUserId(createPositionModel.getAuthUserId());
|
|
|
379 |
position.setCategoryId(createPositionModel.getCategoryId());
|
|
|
380 |
position.setEscalationType(createPositionModel.getEscalationType());
|
|
|
381 |
position.setRegionId(createPositionModel.getRegionId());
|
| 24417 |
govind |
382 |
position.setCreateTimestamp(LocalDateTime.now());
|
|
|
383 |
positionRepository.persist(position);
|
| 25570 |
tejbeer |
384 |
|
|
|
385 |
for (int fofoId : createPositionModel.getFofoIds()) {
|
|
|
386 |
|
|
|
387 |
PartnerPosition partnerPosition = new PartnerPosition();
|
|
|
388 |
partnerPosition.setFofoId(fofoId);
|
|
|
389 |
partnerPosition.setRegionId(createPositionModel.getRegionId());
|
|
|
390 |
partnerPosition.setPositionId(position.getId());
|
|
|
391 |
partnersPositionRepository.persist(partnerPosition);
|
|
|
392 |
LOGGER.info("partnerPosition" + partnerPosition);
|
|
|
393 |
}
|
|
|
394 |
|
| 24417 |
govind |
395 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
|
|
396 |
} else {
|
| 25570 |
tejbeer |
397 |
throw new ProfitMandiBusinessException("Position", createPositionModel.getAuthUserId(), "already exists!");
|
| 24417 |
govind |
398 |
}
|
|
|
399 |
return "response";
|
|
|
400 |
}
|
|
|
401 |
|
| 25570 |
tejbeer |
402 |
@PostMapping(value = "/cs/updatePartnerPosition")
|
|
|
403 |
public String updatePartnerPosition(HttpServletRequest request, @RequestParam(name = "regionId") int regionId,
|
|
|
404 |
@RequestBody List<Integer> selectedFofoIds, @RequestParam(name = "positionId") int positionId, Model model)
|
|
|
405 |
throws Exception {
|
|
|
406 |
|
|
|
407 |
partnersPositionRepository.delete(positionId);
|
|
|
408 |
for (int fofoId : selectedFofoIds) {
|
|
|
409 |
PartnerPosition partnerPosition = new PartnerPosition();
|
|
|
410 |
partnerPosition.setFofoId(fofoId);
|
|
|
411 |
partnerPosition.setRegionId(regionId);
|
|
|
412 |
partnerPosition.setPositionId(positionId);
|
|
|
413 |
partnersPositionRepository.persist(partnerPosition);
|
|
|
414 |
}
|
|
|
415 |
|
|
|
416 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
|
|
417 |
|
|
|
418 |
return "response";
|
|
|
419 |
}
|
|
|
420 |
|
| 24417 |
govind |
421 |
@GetMapping(value = "/cs/createTicket")
|
| 24824 |
govind |
422 |
public String createTicket(HttpServletRequest request, Model model) throws ProfitMandiBusinessException {
|
|
|
423 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 24500 |
govind |
424 |
List<TicketCategory> ticketCategories = csService.getAllTicketCategotyFromSubCategory();
|
| 24824 |
govind |
425 |
model.addAttribute("roleType", roleManager.isAdmin(loginDetails.getRoleIds()));
|
| 24417 |
govind |
426 |
model.addAttribute("ticketCategories", ticketCategories);
|
|
|
427 |
return "create-ticket";
|
|
|
428 |
}
|
|
|
429 |
|
|
|
430 |
@GetMapping(value = "/cs/getSubCategoriesByCategoryId")
|
|
|
431 |
public String getSubCategoriesByCategoryId(HttpServletRequest request,
|
|
|
432 |
@RequestParam(name = "categoryId", defaultValue = "0") int categoryId, Model model) {
|
|
|
433 |
List<TicketSubCategory> ticketSubCategories = ticketSubCategoryRepository.selectAll(categoryId);
|
|
|
434 |
LOGGER.info(ticketSubCategories);
|
|
|
435 |
model.addAttribute("ticketSubCategories", ticketSubCategories);
|
|
|
436 |
return "ticket-sub-categories";
|
|
|
437 |
}
|
|
|
438 |
|
|
|
439 |
@PostMapping(value = "/cs/createTicket")
|
|
|
440 |
public String createTicket(HttpServletRequest request, @RequestParam(name = "categoryId") int categoryId,
|
|
|
441 |
@RequestParam(name = "subCategoryId") int subCategoryId, @RequestParam(name = "message") String message,
|
|
|
442 |
Model model) throws Exception {
|
|
|
443 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 24837 |
govind |
444 |
List<Ticket> tickets = ticketRepository.selectAllResolvedMarkedTicketByCreator(loginDetails.getFofoId());
|
| 24620 |
govind |
445 |
if (tickets.size() > 3 || tickets.size() == 3) {
|
|
|
446 |
model.addAttribute("response", mvcResponseSender.createResponseString(false));
|
|
|
447 |
} else {
|
|
|
448 |
csService.createTicket(loginDetails.getFofoId(), categoryId, subCategoryId, message);
|
|
|
449 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
|
|
450 |
}
|
| 24417 |
govind |
451 |
return "response";
|
|
|
452 |
}
|
|
|
453 |
|
|
|
454 |
@GetMapping(value = "/cs/myticket")
|
| 24699 |
govind |
455 |
public String getTicket(HttpServletRequest request,
|
|
|
456 |
@RequestParam(name = "orderby", defaultValue = "DESCENDING") SortOrder sortOrder,
|
|
|
457 |
@RequestParam(name = "ticketStatus", defaultValue = "OPENED") TicketStatus ticketStatus,
|
| 24787 |
govind |
458 |
@RequestParam(name = "ticketSearchType", defaultValue = "") TicketSearchType ticketSearchType,
|
|
|
459 |
@RequestParam(name = "searchTerm", defaultValue = "0") int searchTerm,
|
| 24699 |
govind |
460 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
| 24417 |
govind |
461 |
@RequestParam(name = "limit", defaultValue = "10") int limit, Model model)
|
|
|
462 |
throws ProfitMandiBusinessException {
|
|
|
463 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
|
|
464 |
List<Ticket> tickets = null;
|
| 24500 |
govind |
465 |
List<TicketAssigned> ticketAssigneds = null;
|
| 24417 |
govind |
466 |
long size = 0;
|
| 24500 |
govind |
467 |
Map<Integer, AuthUser> authUserIdAndAuthUserMap = null;
|
| 24417 |
govind |
468 |
if (roleManager.isAdmin(new HashSet<>(loginDetails.getRoleIds()))) {
|
|
|
469 |
AuthUser authUser = authRepository.selectByEmailOrMobile(loginDetails.getEmailId());
|
| 24787 |
govind |
470 |
if (ticketSearchType == null) {
|
| 24791 |
govind |
471 |
if (ticketStatus.equals(TicketStatus.RESOLVED)) {
|
|
|
472 |
tickets = ticketRepository.selectAllByAssignee(authUser.getId(), Optional.empty(), sortOrder, null,
|
|
|
473 |
searchTerm, offset, limit);
|
|
|
474 |
size = ticketRepository.selectAllCountByAssignee(authUser.getId(), Optional.empty(), null,
|
|
|
475 |
searchTerm);
|
|
|
476 |
} else {
|
| 24787 |
govind |
477 |
tickets = ticketRepository.selectAllByAssignee(authUser.getId(),
|
| 27124 |
amit.gupta |
478 |
Optional.of(TicketStatus.CLOSED.equals(ticketStatus)), sortOrder, null, searchTerm, offset,
|
| 24787 |
govind |
479 |
limit);
|
|
|
480 |
size = ticketRepository.selectAllCountByAssignee(authUser.getId(),
|
| 27124 |
amit.gupta |
481 |
Optional.of(TicketStatus.CLOSED.equals(ticketStatus)), null, searchTerm);
|
| 24791 |
govind |
482 |
}
|
|
|
483 |
|
| 24787 |
govind |
484 |
} else {
|
| 24791 |
govind |
485 |
|
|
|
486 |
if (ticketStatus.equals(TicketStatus.RESOLVED)) {
|
|
|
487 |
tickets = ticketRepository.selectAllByAssignee(authUser.getId(), Optional.empty(), sortOrder,
|
|
|
488 |
ticketSearchType, searchTerm, offset, limit);
|
|
|
489 |
size = ticketRepository.selectAllCountByAssignee(authUser.getId(), Optional.empty(),
|
|
|
490 |
ticketSearchType, searchTerm);
|
|
|
491 |
} else {
|
| 24787 |
govind |
492 |
tickets = ticketRepository.selectAllByAssignee(authUser.getId(),
|
| 27124 |
amit.gupta |
493 |
Optional.of(TicketStatus.CLOSED.equals(ticketStatus)), sortOrder, ticketSearchType,
|
| 24787 |
govind |
494 |
searchTerm, offset, limit);
|
|
|
495 |
size = ticketRepository.selectAllCountByAssignee(authUser.getId(),
|
| 27124 |
amit.gupta |
496 |
Optional.of(TicketStatus.CLOSED.equals(ticketStatus)), ticketSearchType, searchTerm);
|
| 24791 |
govind |
497 |
}
|
| 24787 |
govind |
498 |
}
|
| 24824 |
govind |
499 |
// LOGGER.info(size + "size");
|
| 24791 |
govind |
500 |
if (tickets.size() > 0) {
|
|
|
501 |
ticketAssigneds = ticketAssignedRepository
|
|
|
502 |
.selectByTicketIds(tickets.stream().map(x -> x.getId()).collect(Collectors.toList()));
|
|
|
503 |
authUserIdAndAuthUserMap = csService.getAuthUserIdAndAuthUserMap(ticketAssigneds);
|
|
|
504 |
Map<Integer, CustomRetailer> fofoIdsAndCustomRetailer = csService.getPartnerByFofoIds(tickets);
|
|
|
505 |
model.addAttribute("fofoIdsAndCustomRetailer", fofoIdsAndCustomRetailer);
|
| 24787 |
govind |
506 |
}
|
| 24620 |
govind |
507 |
|
| 24417 |
govind |
508 |
} else {
|
| 24699 |
govind |
509 |
tickets = ticketRepository.selectAllByCreator(loginDetails.getFofoId(),
|
| 24751 |
govind |
510 |
Optional.of(TicketStatus.OPENED.equals(ticketStatus)), sortOrder, offset, limit);
|
| 24699 |
govind |
511 |
size = ticketRepository.selectAllCountByCreator(loginDetails.getFofoId(),
|
| 24751 |
govind |
512 |
Optional.of(TicketStatus.OPENED.equals(ticketStatus)));
|
| 24699 |
govind |
513 |
}
|
|
|
514 |
authUserIdAndAuthUserMap = csService.getTicketIdAndAuthUserMapUsingTickets(tickets);
|
| 24500 |
govind |
515 |
|
| 24417 |
govind |
516 |
if (size < limit) {
|
|
|
517 |
model.addAttribute("end", offset + size);
|
|
|
518 |
} else {
|
|
|
519 |
model.addAttribute("end", offset + limit);
|
|
|
520 |
}
|
|
|
521 |
model.addAttribute("start", offset + 1);
|
|
|
522 |
model.addAttribute("size", size);
|
| 24500 |
govind |
523 |
model.addAttribute("roleType", roleManager.isAdmin(new HashSet<>(loginDetails.getRoleIds())));
|
| 24417 |
govind |
524 |
Map<Integer, TicketSubCategory> subCategoryIdAndSubCategoryMap = csService
|
|
|
525 |
.getSubCategoryIdAndSubCategoryMap(tickets);
|
|
|
526 |
model.addAttribute("tickets", tickets);
|
| 24620 |
govind |
527 |
model.addAttribute("resolved", ActivityType.RESOLVED);
|
|
|
528 |
model.addAttribute("resolved-accepted", ActivityType.RESOLVED_ACCEPTED);
|
|
|
529 |
model.addAttribute("resolved-rejected", ActivityType.RESOLVED_REJECTED);
|
| 24417 |
govind |
530 |
model.addAttribute("authUserIdAndAuthUserMap", authUserIdAndAuthUserMap);
|
|
|
531 |
model.addAttribute("subCategoryIdAndSubCategoryMap", subCategoryIdAndSubCategoryMap);
|
| 24699 |
govind |
532 |
model.addAttribute("ticketStatusValues", TicketStatus.values());
|
|
|
533 |
model.addAttribute("orderByValues", SortOrder.values());
|
|
|
534 |
model.addAttribute("selectedticketStatus", ticketStatus);
|
|
|
535 |
model.addAttribute("selectedorderby", sortOrder);
|
| 24787 |
govind |
536 |
model.addAttribute("ticketSearchTypes", TicketSearchType.values());
|
|
|
537 |
model.addAttribute("ticketSearchType", ticketSearchType);
|
|
|
538 |
model.addAttribute("searchTerm", searchTerm);
|
| 24417 |
govind |
539 |
return "ticket";
|
|
|
540 |
}
|
| 24500 |
govind |
541 |
|
| 24417 |
govind |
542 |
@GetMapping(value = "/cs/myticketPaginated")
|
| 24500 |
govind |
543 |
public String getMyTicketPaginated(HttpServletRequest request,
|
| 24699 |
govind |
544 |
@RequestParam(name = "orderby", defaultValue = "DESCENDING") SortOrder sortOrder,
|
|
|
545 |
@RequestParam(name = "ticketStatus", defaultValue = "OPENED") TicketStatus ticketStatus,
|
| 24787 |
govind |
546 |
@RequestParam(name = "ticketSearchType", defaultValue = "") TicketSearchType ticketSearchType,
|
|
|
547 |
@RequestParam(name = "searchTerm", defaultValue = "0") int searchTerm,
|
| 24500 |
govind |
548 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
| 24417 |
govind |
549 |
@RequestParam(name = "limit", defaultValue = "10") int limit, Model model)
|
|
|
550 |
throws ProfitMandiBusinessException {
|
|
|
551 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
|
|
552 |
List<Ticket> tickets = null;
|
| 24500 |
govind |
553 |
List<TicketAssigned> ticketAssigneds = null;
|
| 24824 |
govind |
554 |
|
| 24500 |
govind |
555 |
Map<Integer, AuthUser> authUserIdAndAuthUserMap = null;
|
| 24824 |
govind |
556 |
|
| 24417 |
govind |
557 |
if (roleManager.isAdmin(new HashSet<>(loginDetails.getRoleIds()))) {
|
|
|
558 |
AuthUser authUser = authRepository.selectByEmailOrMobile(loginDetails.getEmailId());
|
| 24791 |
govind |
559 |
if (ticketSearchType == null) {
|
|
|
560 |
if (ticketStatus.equals(TicketStatus.RESOLVED)) {
|
|
|
561 |
tickets = ticketRepository.selectAllByAssignee(authUser.getId(), Optional.empty(), sortOrder, null,
|
|
|
562 |
searchTerm, offset, limit);
|
|
|
563 |
} else {
|
|
|
564 |
tickets = ticketRepository.selectAllByAssignee(authUser.getId(),
|
| 27195 |
amit.gupta |
565 |
Optional.of(TicketStatus.CLOSED.equals(ticketStatus)), sortOrder, null, searchTerm, offset,
|
| 24791 |
govind |
566 |
limit);
|
|
|
567 |
}
|
| 24787 |
govind |
568 |
|
|
|
569 |
} else {
|
| 24791 |
govind |
570 |
|
|
|
571 |
if (ticketStatus.equals(TicketStatus.RESOLVED)) {
|
|
|
572 |
tickets = ticketRepository.selectAllByAssignee(authUser.getId(), Optional.empty(), sortOrder,
|
|
|
573 |
ticketSearchType, searchTerm, offset, limit);
|
|
|
574 |
} else {
|
|
|
575 |
tickets = ticketRepository.selectAllByAssignee(authUser.getId(),
|
| 27195 |
amit.gupta |
576 |
Optional.of(TicketStatus.CLOSED.equals(ticketStatus)), sortOrder, ticketSearchType,
|
| 24791 |
govind |
577 |
searchTerm, offset, limit);
|
|
|
578 |
}
|
| 24787 |
govind |
579 |
}
|
| 24747 |
govind |
580 |
ticketAssigneds = ticketAssignedRepository
|
|
|
581 |
.selectByTicketIds(tickets.stream().map(x -> x.getId()).collect(Collectors.toList()));
|
| 24620 |
govind |
582 |
authUserIdAndAuthUserMap = csService.getAuthUserIdAndAuthUserMap(ticketAssigneds);
|
|
|
583 |
Map<Integer, CustomRetailer> fofoIdsAndCustomRetailer = csService.getPartnerByFofoIds(tickets);
|
|
|
584 |
model.addAttribute("fofoIdsAndCustomRetailer", fofoIdsAndCustomRetailer);
|
| 24417 |
govind |
585 |
} else {
|
| 24747 |
govind |
586 |
tickets = ticketRepository.selectAllByCreator(loginDetails.getFofoId(),
|
| 24751 |
govind |
587 |
Optional.of(TicketStatus.OPENED.equals(ticketStatus)), sortOrder, offset, limit);
|
| 24500 |
govind |
588 |
authUserIdAndAuthUserMap = csService.getTicketIdAndAuthUserMapUsingTickets(tickets);
|
| 24417 |
govind |
589 |
}
|
| 24500 |
govind |
590 |
model.addAttribute("roleType", roleManager.isAdmin(new HashSet<>(loginDetails.getRoleIds())));
|
| 24417 |
govind |
591 |
Map<Integer, TicketSubCategory> subCategoryIdAndSubCategoryMap = csService
|
|
|
592 |
.getSubCategoryIdAndSubCategoryMap(tickets);
|
|
|
593 |
model.addAttribute("tickets", tickets);
|
|
|
594 |
model.addAttribute("authUserIdAndAuthUserMap", authUserIdAndAuthUserMap);
|
|
|
595 |
model.addAttribute("subCategoryIdAndSubCategoryMap", subCategoryIdAndSubCategoryMap);
|
| 24699 |
govind |
596 |
model.addAttribute("resolved", ActivityType.RESOLVED);
|
|
|
597 |
model.addAttribute("resolved-accepted", ActivityType.RESOLVED_ACCEPTED);
|
|
|
598 |
model.addAttribute("resolved-rejected", ActivityType.RESOLVED_REJECTED);
|
| 24417 |
govind |
599 |
return "ticket-paginated";
|
|
|
600 |
}
|
|
|
601 |
|
|
|
602 |
@GetMapping(value = "/cs/getActivities")
|
|
|
603 |
public String getActivity(HttpServletRequest request,
|
|
|
604 |
@RequestParam(name = "ticketId", defaultValue = "0") int ticketId, Model model) throws Exception {
|
| 24824 |
govind |
605 |
List<Activity> allactivities = activityRepository.selectAll(ticketId);
|
| 27270 |
tejbeer |
606 |
List<List<ActivityAttachment>> activityAttachments = allactivities.stream().map(x -> x.getActivityAttachment())
|
|
|
607 |
.collect(Collectors.toList());
|
|
|
608 |
for (List<ActivityAttachment> aA : activityAttachments) {
|
|
|
609 |
// List<ActivityAttachment> documentId = aA.stream().map(x ->
|
|
|
610 |
// x).collect(Collectors.toList());
|
|
|
611 |
for (ActivityAttachment attachment : aA) {
|
|
|
612 |
Document document = documentRepository.selectById(attachment.getDocumentId());
|
|
|
613 |
attachment.setDocumentName(document.getDisplayName());
|
|
|
614 |
activityAttachmentRepository.persist(attachment);
|
|
|
615 |
}
|
|
|
616 |
}
|
| 24824 |
govind |
617 |
List<Activity> activities = null;
|
| 24572 |
amit.gupta |
618 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 24620 |
govind |
619 |
if (roleManager.isAdmin(loginDetails.getRoleIds())) {
|
| 24824 |
govind |
620 |
Set<Integer> authUserIds = allactivities.stream().map(x -> x.getCreatedBy()).collect(Collectors.toSet());
|
| 24572 |
amit.gupta |
621 |
List<AuthUser> users = authRepository.selectAllAuthUserByIds(new ArrayList<>(authUserIds));
|
| 24620 |
govind |
622 |
Map<Integer, String> authUserNameMap = users.stream()
|
|
|
623 |
.collect(Collectors.toMap(AuthUser::getId, x -> x.getFirstName() + " " + x.getLastName()));
|
| 24824 |
govind |
624 |
allactivities.stream().forEach(x -> x.setName(authUserNameMap.get(x.getCreatedBy())));
|
|
|
625 |
activities = allactivities;
|
|
|
626 |
} else {
|
| 27139 |
amit.gupta |
627 |
activities = allactivities.stream().filter(x -> ActivityType.PARTNER_ACTIVITIES.contains(x.getType()))
|
| 24824 |
govind |
628 |
.collect(Collectors.toList());
|
| 24572 |
amit.gupta |
629 |
}
|
| 24417 |
govind |
630 |
if (activities == null) {
|
|
|
631 |
throw new ProfitMandiBusinessException("Activity", ticketId, "No Activity Found");
|
|
|
632 |
}
|
|
|
633 |
model.addAttribute("response", mvcResponseSender.createResponseString(activities));
|
|
|
634 |
return "response";
|
|
|
635 |
|
|
|
636 |
}
|
|
|
637 |
|
|
|
638 |
@PostMapping(value = "/cs/createActivity")
|
|
|
639 |
public String createActivity(HttpServletRequest request,
|
|
|
640 |
@RequestParam(name = "ticketId", defaultValue = "0") int ticketId,
|
| 24500 |
govind |
641 |
@RequestParam(name = "assigneeId", defaultValue = "0") int assigneeId,
|
| 24824 |
govind |
642 |
@RequestParam(name = "internal", defaultValue = "true") boolean internal,
|
| 27270 |
tejbeer |
643 |
@RequestParam(name = "message", defaultValue = "") String message, @RequestBody List<Integer> documentIds,
|
|
|
644 |
|
|
|
645 |
Model model) throws Exception {
|
|
|
646 |
|
|
|
647 |
LOGGER.info("documentIds" + documentIds);
|
| 24417 |
govind |
648 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 24500 |
govind |
649 |
Ticket ticket = ticketRepository.selectById(ticketId);
|
| 27150 |
amit.gupta |
650 |
List<TicketAssigned> ticketAssignedList = ticketAssignedRepository.selectByTicketIds(Arrays.asList(ticketId));
|
| 27270 |
tejbeer |
651 |
List<Integer> authUserIds = ticketAssignedList.stream().map(x -> x.getAssineeId()).collect(Collectors.toList());
|
|
|
652 |
authUserIds.add(ticketAssignedList.get(ticketAssignedList.size() - 1).getManagerId());
|
|
|
653 |
Map<Integer, AuthUser> authUsersMap = authRepository.selectAllAuthUserByIds(authUserIds).stream()
|
|
|
654 |
.collect(Collectors.toMap(x -> x.getId(), x -> x));
|
| 24500 |
govind |
655 |
if (ticket.getCloseTimestamp() == null) {
|
| 27124 |
amit.gupta |
656 |
Activity activity = new Activity();
|
|
|
657 |
activity.setCreatedBy(0);
|
|
|
658 |
activity.setCreateTimestamp(LocalDateTime.now());
|
| 27150 |
amit.gupta |
659 |
String subject = null;
|
| 27270 |
tejbeer |
660 |
String mailMessage = null;
|
| 27159 |
amit.gupta |
661 |
activity.setMessage(message);
|
| 24500 |
govind |
662 |
if (!roleManager.isAdmin(new HashSet<>(loginDetails.getRoleIds()))) {
|
| 27150 |
amit.gupta |
663 |
CustomRetailer customRetailer = retailerService.getFofoRetailers(true).get(loginDetails.getFofoId());
|
| 24500 |
govind |
664 |
activity.setType(ActivityType.COMMUNICATION_IN);
|
| 27270 |
tejbeer |
665 |
subject = String.format("Ticket Update #%s by franchisee %s", ticket.getId(),
|
|
|
666 |
customRetailer.getBusinessName() + "(" + customRetailer.getCode() + ")");
|
| 27197 |
amit.gupta |
667 |
mailMessage = String.format("Franchisee message - %s", message);
|
| 24500 |
govind |
668 |
} else {
|
| 27156 |
amit.gupta |
669 |
AuthUser authUser = authRepository.selectByEmailOrMobile(loginDetails.getEmailId());
|
| 27164 |
amit.gupta |
670 |
activity.setCreatedBy(authUser.getId());
|
| 27162 |
amit.gupta |
671 |
authUsersMap.remove(authUser.getId());
|
| 27150 |
amit.gupta |
672 |
subject = String.format("Ticket Update #%s by %s", ticket.getId(), authUser.getName());
|
| 27197 |
amit.gupta |
673 |
mailMessage = String.format("%s's message - %s", authUser.getFirstName(), message);
|
| 24824 |
govind |
674 |
if (internal) {
|
|
|
675 |
activity.setType(ActivityType.COMMUNICATION_INTERNAL);
|
| 27124 |
amit.gupta |
676 |
// String subject = String.format(ACTIVITY_SUBJECT, ticket.getId());
|
| 24824 |
govind |
677 |
} else {
|
| 27186 |
amit.gupta |
678 |
String updatedBy = "SD Team";
|
| 27192 |
amit.gupta |
679 |
CustomRetailer customRetailer = retailerService.getFofoRetailers(true).get(ticket.getFofoId());
|
| 27186 |
amit.gupta |
680 |
subject = String.format("Ticket Update #%s by %s", ticket.getId(), updatedBy);
|
| 27197 |
amit.gupta |
681 |
String partnerMessage = String.format("%s's message - %s", updatedBy, message);
|
|
|
682 |
this.activityRelatedMail(customRetailer.getEmail(), null, "subject", partnerMessage);
|
| 24824 |
govind |
683 |
activity.setType(ActivityType.COMMUNICATION_OUT);
|
|
|
684 |
}
|
| 24500 |
govind |
685 |
}
|
| 27124 |
amit.gupta |
686 |
activityRepository.persist(activity);
|
| 27270 |
tejbeer |
687 |
|
|
|
688 |
for (Integer documentId : documentIds) {
|
|
|
689 |
ActivityAttachment activityAttachment = new ActivityAttachment();
|
|
|
690 |
activityAttachment.setActivityId(activity.getId());
|
|
|
691 |
activityAttachment.setDocumentId(documentId);
|
|
|
692 |
activityAttachmentRepository.persist(activityAttachment);
|
|
|
693 |
}
|
|
|
694 |
|
| 27124 |
amit.gupta |
695 |
csService.addActivity(ticket, activity);
|
| 27150 |
amit.gupta |
696 |
AuthUser authUser = authUsersMap.remove(authUserIds.get(0));
|
| 27270 |
tejbeer |
697 |
if (authUser == null) {
|
| 27163 |
amit.gupta |
698 |
authUser = authUsersMap.remove(authUserIds.get(1));
|
|
|
699 |
}
|
| 27150 |
amit.gupta |
700 |
model.addAttribute("response", mvcResponseSender.createResponseString(authUser));
|
| 27410 |
tejbeer |
701 |
String[] cc = authUsersMap.entrySet().stream().map(x -> x.getValue().getEmailId()).toArray(String[]::new);
|
| 27197 |
amit.gupta |
702 |
this.activityRelatedMail(authUser.getEmailId(), cc, subject, mailMessage);
|
| 24417 |
govind |
703 |
} else {
|
|
|
704 |
throw new ProfitMandiBusinessException("Ticket", ticket.getId(), "Already closed ticket");
|
|
|
705 |
}
|
|
|
706 |
return "response";
|
|
|
707 |
}
|
| 24500 |
govind |
708 |
|
| 24620 |
govind |
709 |
private void activityRelatedMail(String to, String[] cc, String subject, String message)
|
|
|
710 |
throws ProfitMandiBusinessException {
|
|
|
711 |
try {
|
|
|
712 |
Utils.sendMailWithAttachments(mailSender, to, cc, subject, message, null);
|
|
|
713 |
} catch (Exception e) {
|
|
|
714 |
throw new ProfitMandiBusinessException("Ticket Activity", to, "Could not send ticket activity mail");
|
|
|
715 |
}
|
|
|
716 |
}
|
|
|
717 |
|
| 24500 |
govind |
718 |
@PostMapping(value = "/cs/closeTicket")
|
| 24417 |
govind |
719 |
public String closeTicket(HttpServletRequest request,
|
| 24439 |
govind |
720 |
@RequestParam(name = "ticketId", defaultValue = "0") int ticketId,
|
| 24500 |
govind |
721 |
@RequestParam(name = "happyCode") String happyCode, Model model) throws Exception {
|
|
|
722 |
Ticket ticket = ticketRepository.selectById(ticketId);
|
|
|
723 |
if (ticket.getHappyCode().equals(happyCode)) {
|
|
|
724 |
ticket.setCloseTimestamp(LocalDateTime.now());
|
|
|
725 |
ticketRepository.persist(ticket);
|
|
|
726 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
|
|
727 |
} else {
|
|
|
728 |
throw new ProfitMandiBusinessException("Ticket", ticketId, "Happy Code can't match");
|
| 24439 |
govind |
729 |
}
|
| 24417 |
govind |
730 |
return "response";
|
|
|
731 |
}
|
| 24500 |
govind |
732 |
|
|
|
733 |
@GetMapping(value = "/cs/managerTicket")
|
| 27124 |
amit.gupta |
734 |
public String getManagerTickets(HttpServletRequest request,
|
| 24699 |
govind |
735 |
@RequestParam(name = "orderby", defaultValue = "DESCENDING") SortOrder sortOrder,
|
|
|
736 |
@RequestParam(name = "ticketStatus", defaultValue = "OPENED") TicketStatus ticketStatus,
|
| 24747 |
govind |
737 |
@RequestParam(name = "ticketSearchType", defaultValue = "") TicketSearchType ticketSearchType,
|
|
|
738 |
@RequestParam(name = "searchTerm", defaultValue = "0") int searchTerm,
|
| 24500 |
govind |
739 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
|
|
740 |
@RequestParam(name = "limit", defaultValue = "10") int limit, Model model)
|
|
|
741 |
throws ProfitMandiBusinessException {
|
| 24439 |
govind |
742 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
|
|
743 |
long size = 0;
|
| 24500 |
govind |
744 |
AuthUser authUser = authRepository.selectByEmailOrMobile(loginDetails.getEmailId());
|
|
|
745 |
List<Ticket> tickets = null;
|
| 24569 |
govind |
746 |
Map<Integer, List<AuthUser>> authUserListMap = null;
|
| 27318 |
amit.gupta |
747 |
if (ticketSearchType == null) {
|
|
|
748 |
if (ticketStatus.equals(TicketStatus.RESOLVED)) {
|
|
|
749 |
tickets = ticketRepository.selectAllManagerTicket(authUser.getId(), sortOrder, Optional.empty(), null,
|
|
|
750 |
searchTerm, offset, limit);
|
|
|
751 |
size = ticketRepository.selectAllCountByManagerTicket(authUser.getId(), Optional.empty(), null, 0);
|
|
|
752 |
} else {
|
|
|
753 |
tickets = ticketRepository.selectAllManagerTicket(authUser.getId(), sortOrder,
|
|
|
754 |
Optional.of(TicketStatus.CLOSED.equals(ticketStatus)), null, searchTerm, offset, limit);
|
|
|
755 |
size = ticketRepository.selectAllCountByManagerTicket(authUser.getId(),
|
|
|
756 |
Optional.of(TicketStatus.CLOSED.equals(ticketStatus)), null, 0);
|
|
|
757 |
}
|
| 24500 |
govind |
758 |
} else {
|
| 27318 |
amit.gupta |
759 |
if (ticketStatus.equals(TicketStatus.RESOLVED)) {
|
|
|
760 |
tickets = ticketRepository.selectAllManagerTicket(authUser.getId(), sortOrder, Optional.empty(),
|
|
|
761 |
ticketSearchType, searchTerm, offset, limit);
|
|
|
762 |
size = ticketRepository.selectAllCountByManagerTicket(authUser.getId(), Optional.empty(),
|
|
|
763 |
ticketSearchType, searchTerm);
|
| 24747 |
govind |
764 |
} else {
|
| 27318 |
amit.gupta |
765 |
tickets = ticketRepository.selectAllManagerTicket(authUser.getId(), sortOrder,
|
|
|
766 |
Optional.of(TicketStatus.CLOSED.equals(ticketStatus)), ticketSearchType, searchTerm, offset,
|
|
|
767 |
limit);
|
|
|
768 |
size = ticketRepository.selectAllCountByManagerTicket(authUser.getId(),
|
|
|
769 |
Optional.of(TicketStatus.CLOSED.equals(ticketStatus)), ticketSearchType, searchTerm);
|
| 24747 |
govind |
770 |
}
|
|
|
771 |
|
| 24439 |
govind |
772 |
}
|
| 27318 |
amit.gupta |
773 |
authUserListMap = csService.getAssignedAuthList(tickets);
|
|
|
774 |
|
|
|
775 |
if (tickets.size() > 0) {
|
|
|
776 |
Map<Integer, CustomRetailer> fofoIdsAndCustomRetailer = csService.getPartnerByFofoIds(tickets);
|
|
|
777 |
model.addAttribute("fofoIdsAndCustomRetailer", fofoIdsAndCustomRetailer);
|
|
|
778 |
}
|
| 24439 |
govind |
779 |
if (size < limit) {
|
|
|
780 |
model.addAttribute("end", offset + size);
|
|
|
781 |
} else {
|
|
|
782 |
model.addAttribute("end", offset + limit);
|
|
|
783 |
}
|
|
|
784 |
model.addAttribute("start", offset + 1);
|
|
|
785 |
model.addAttribute("size", size);
|
|
|
786 |
model.addAttribute("tickets", tickets);
|
| 24500 |
govind |
787 |
|
| 24439 |
govind |
788 |
Map<Integer, TicketSubCategory> subCategoryIdAndSubCategoryMap = csService
|
|
|
789 |
.getSubCategoryIdAndSubCategoryMap(tickets);
|
| 24699 |
govind |
790 |
model.addAttribute("ticketStatusValues", TicketStatus.values());
|
|
|
791 |
model.addAttribute("orderByValues", SortOrder.values());
|
|
|
792 |
model.addAttribute("selectedticketStatus", ticketStatus);
|
|
|
793 |
model.addAttribute("selectedorderby", sortOrder);
|
| 24439 |
govind |
794 |
model.addAttribute("tickets", tickets);
|
| 24747 |
govind |
795 |
model.addAttribute("ticketSearchTypes", TicketSearchType.values());
|
| 24750 |
govind |
796 |
model.addAttribute("ticketSearchType", ticketSearchType);
|
| 24747 |
govind |
797 |
model.addAttribute("searchTerm", searchTerm);
|
| 24500 |
govind |
798 |
model.addAttribute("authUserListMap", authUserListMap);
|
| 24439 |
govind |
799 |
model.addAttribute("subCategoryIdAndSubCategoryMap", subCategoryIdAndSubCategoryMap);
|
|
|
800 |
return "managerTicket";
|
|
|
801 |
}
|
| 24500 |
govind |
802 |
|
|
|
803 |
@GetMapping(value = "/cs/managerTicket-paginated")
|
| 27205 |
amit.gupta |
804 |
public String getManagerTicketsPaginated(HttpServletRequest request,
|
| 24699 |
govind |
805 |
@RequestParam(name = "orderby", defaultValue = "DESCENDING") SortOrder sortOrder,
|
|
|
806 |
@RequestParam(name = "ticketStatus", defaultValue = "OPENED") TicketStatus ticketStatus,
|
| 24747 |
govind |
807 |
@RequestParam(name = "ticketSearchType", defaultValue = "") TicketSearchType ticketSearchType,
|
|
|
808 |
@RequestParam(name = "searchTerm", defaultValue = "0") int searchTerm,
|
| 24500 |
govind |
809 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
|
|
810 |
@RequestParam(name = "limit", defaultValue = "10") int limit, Model model)
|
|
|
811 |
throws ProfitMandiBusinessException {
|
| 24467 |
govind |
812 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 24500 |
govind |
813 |
AuthUser authUser = authRepository.selectByEmailOrMobile(loginDetails.getEmailId());
|
| 24557 |
govind |
814 |
Map<Integer, List<AuthUser>> authUserListMap = null;
|
| 24500 |
govind |
815 |
List<Ticket> tickets = null;
|
| 27318 |
amit.gupta |
816 |
if (ticketSearchType == null) {
|
|
|
817 |
if (ticketStatus.equals(TicketStatus.RESOLVED)) {
|
|
|
818 |
tickets = ticketRepository.selectAllManagerTicket(authUser.getId(), sortOrder, Optional.empty(), null,
|
|
|
819 |
searchTerm, offset, limit);
|
| 24787 |
govind |
820 |
|
| 24747 |
govind |
821 |
} else {
|
| 27318 |
amit.gupta |
822 |
tickets = ticketRepository.selectAllManagerTicket(authUser.getId(), sortOrder,
|
|
|
823 |
Optional.of(TicketStatus.CLOSED.equals(ticketStatus)), null, searchTerm, offset, limit);
|
| 24787 |
govind |
824 |
|
| 27318 |
amit.gupta |
825 |
}
|
|
|
826 |
} else {
|
|
|
827 |
if (ticketStatus.equals(TicketStatus.RESOLVED)) {
|
|
|
828 |
tickets = ticketRepository.selectAllManagerTicket(authUser.getId(), sortOrder, Optional.empty(),
|
|
|
829 |
ticketSearchType, searchTerm, offset, limit);
|
| 24787 |
govind |
830 |
|
| 27318 |
amit.gupta |
831 |
} else {
|
|
|
832 |
tickets = ticketRepository.selectAllManagerTicket(authUser.getId(), sortOrder,
|
|
|
833 |
Optional.of(TicketStatus.CLOSED.equals(ticketStatus)), ticketSearchType, searchTerm, offset,
|
|
|
834 |
limit);
|
| 24747 |
govind |
835 |
}
|
| 27318 |
amit.gupta |
836 |
|
| 24467 |
govind |
837 |
}
|
| 27318 |
amit.gupta |
838 |
authUserListMap = csService.getAssignedAuthList(tickets);
|
|
|
839 |
if (tickets.size() > 0) {
|
|
|
840 |
Map<Integer, CustomRetailer> fofoIdsAndCustomRetailer = csService.getPartnerByFofoIds(tickets);
|
|
|
841 |
model.addAttribute("fofoIdsAndCustomRetailer", fofoIdsAndCustomRetailer);
|
|
|
842 |
}
|
| 24467 |
govind |
843 |
model.addAttribute("tickets", tickets);
|
|
|
844 |
Map<Integer, TicketSubCategory> subCategoryIdAndSubCategoryMap = csService
|
|
|
845 |
.getSubCategoryIdAndSubCategoryMap(tickets);
|
|
|
846 |
model.addAttribute("tickets", tickets);
|
| 24500 |
govind |
847 |
model.addAttribute("authUserListMap", authUserListMap);
|
| 24467 |
govind |
848 |
model.addAttribute("subCategoryIdAndSubCategoryMap", subCategoryIdAndSubCategoryMap);
|
|
|
849 |
return "managerTicket-paginated";
|
|
|
850 |
}
|
| 24500 |
govind |
851 |
|
|
|
852 |
@GetMapping(value = "/cs/edit-ticket")
|
|
|
853 |
public String getEditTicket(HttpServletRequest request,
|
|
|
854 |
@RequestParam(name = "ticketId", defaultValue = "0") int ticketId, Model model) {
|
|
|
855 |
Ticket ticket = ticketRepository.selectById(ticketId);
|
|
|
856 |
List<TicketCategory> ticketCategories = csService.getAllTicketCategotyFromSubCategory();
|
|
|
857 |
TicketSubCategory ticketSubCategory = ticketSubCategoryRepository.selectById(ticket.getSubCategoryId());
|
|
|
858 |
List<TicketSubCategory> ticketSubCategories = ticketSubCategoryRepository
|
| 27124 |
amit.gupta |
859 |
.selectAll(ticketSubCategory.getCategoryId());
|
|
|
860 |
List<AuthUser> authUsers = new ArrayList<>();
|
| 24467 |
govind |
861 |
model.addAttribute("ticket", ticket);
|
|
|
862 |
model.addAttribute("ticketCategories", ticketCategories);
|
|
|
863 |
model.addAttribute("ticketSubCategories", ticketSubCategories);
|
| 24575 |
govind |
864 |
model.addAttribute("ticketSubCategory", ticketSubCategory);
|
| 24500 |
govind |
865 |
model.addAttribute("authUsers", authUsers);
|
| 24467 |
govind |
866 |
return "edit-ticket-modal";
|
|
|
867 |
}
|
| 24500 |
govind |
868 |
|
|
|
869 |
@PostMapping(value = "/cs/edit-ticket")
|
|
|
870 |
public String editTicket(HttpServletRequest request,
|
|
|
871 |
@RequestParam(name = "ticketId", defaultValue = "0") int ticketId,
|
|
|
872 |
@RequestParam(name = "subCategoryId", defaultValue = "0") int subCategoryId,
|
|
|
873 |
@RequestParam(name = "categoryId", defaultValue = "0") int categoryId,
|
|
|
874 |
@RequestParam(name = "authUserId", defaultValue = "0") int authUserId, Model model) throws Exception {
|
| 27152 |
amit.gupta |
875 |
LOGGER.info("Ticket Id {}, CategoryId {}, SubCategory Id {}", ticketId, categoryId, subCategoryId);
|
| 24500 |
govind |
876 |
Ticket ticket = ticketRepository.selectById(ticketId);
|
| 27124 |
amit.gupta |
877 |
csService.updateTicket(categoryId, subCategoryId, ticket);
|
|
|
878 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
| 24467 |
govind |
879 |
return "response";
|
| 27124 |
amit.gupta |
880 |
|
| 24467 |
govind |
881 |
}
|
| 24500 |
govind |
882 |
|
|
|
883 |
@DeleteMapping(value = "/cs/removePosition")
|
|
|
884 |
public String removePosition(HttpServletRequest request,
|
|
|
885 |
@RequestParam(name = "positionId", defaultValue = "0") int positionId, Model model) throws Exception {
|
| 24471 |
govind |
886 |
positionRepository.delete(positionId);
|
|
|
887 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
|
|
888 |
return "response";
|
|
|
889 |
}
|
| 24620 |
govind |
890 |
|
|
|
891 |
@PostMapping(value = "/cs/create-last-activity")
|
|
|
892 |
public String createlastActivity(HttpServletRequest request, @RequestParam(name = "ticketId") int ticketId,
|
|
|
893 |
@RequestParam(name = "lastactivity") ActivityType lastActivity, Model model) throws Exception {
|
|
|
894 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
|
|
895 |
Ticket ticket = ticketRepository.selectById(ticketId);
|
|
|
896 |
Activity activity = new Activity();
|
|
|
897 |
String subject = String.format(ACTIVITY_SUBJECT, ticket.getId());
|
|
|
898 |
if (roleManager.isAdmin(loginDetails.getRoleIds())) {
|
|
|
899 |
ticket.setLastActivity(lastActivity);
|
|
|
900 |
String to = retailerService.getFofoRetailer(ticket.getFofoId()).getEmail();
|
| 24699 |
govind |
901 |
String message = String.format(PARTNER_RESOLVED_TICKET_MAIL, ticketId, "REOPEN");
|
| 24620 |
govind |
902 |
activity.setMessage(message);
|
|
|
903 |
activity.setCreatedBy(authRepository.selectByEmailOrMobile(loginDetails.getEmailId()).getId());
|
|
|
904 |
activity.setTicketId(ticketId);
|
|
|
905 |
activity.setCreateTimestamp(LocalDateTime.now());
|
|
|
906 |
activity.setType(ActivityType.COMMUNICATION_OUT);
|
| 24621 |
govind |
907 |
this.activityRelatedMail(to, null, subject, message);
|
| 24620 |
govind |
908 |
} else {
|
|
|
909 |
if (ActivityType.RESOLVED_ACCEPTED == lastActivity) {
|
|
|
910 |
ticket.setLastActivity(lastActivity);
|
|
|
911 |
ticket.setCloseTimestamp(LocalDateTime.now());
|
| 27139 |
amit.gupta |
912 |
activity.setMessage(ActivityType.RESOLVED_ACCEPTED.toString());
|
| 24620 |
govind |
913 |
activity.setCreatedBy(0);
|
|
|
914 |
activity.setTicketId(ticketId);
|
|
|
915 |
activity.setType(ActivityType.COMMUNICATION_IN);
|
|
|
916 |
activity.setCreateTimestamp(LocalDateTime.now());
|
|
|
917 |
} else {
|
| 24699 |
govind |
918 |
String message = String.format(INTERNAL_REOPEN_MAIL, ticketId,
|
|
|
919 |
retailerService.getFofoRetailer(loginDetails.getFofoId()).getBusinessName());
|
| 24620 |
govind |
920 |
String to = authRepository.selectById(ticket.getL1AuthUser()).getEmailId();
|
| 27270 |
tejbeer |
921 |
String[] ccTo = authRepository
|
|
|
922 |
.selectAllAuthUserByIds(Arrays.asList(ticket.getL2AuthUser(), ticket.getL3AuthUser(),
|
|
|
923 |
ticket.getL4AuthUser(), ticket.getL5AuthUser()))
|
|
|
924 |
.stream().map(x -> x.getEmailId()).toArray(String[]::new);
|
| 24620 |
govind |
925 |
ticket.setLastActivity(lastActivity);
|
| 24638 |
govind |
926 |
ticket.setUpdateTimestamp(LocalDateTime.now());
|
|
|
927 |
ticketAssignedRepository.deleteByTicketId(ticketId);
|
| 24699 |
govind |
928 |
TicketAssigned ticketAssigned = new TicketAssigned();
|
| 24638 |
govind |
929 |
ticketAssigned.setAssineeId(ticket.getL1AuthUser());
|
|
|
930 |
ticketAssigned.setTicketId(ticketId);
|
|
|
931 |
ticketAssignedRepository.persist(ticketAssigned);
|
| 24620 |
govind |
932 |
activity.setMessage(INTERNAL_REOPEN_ACTIVITY_MESSAGE);
|
|
|
933 |
activity.setCreatedBy(0);
|
|
|
934 |
activity.setTicketId(ticketId);
|
|
|
935 |
activity.setType(ActivityType.COMMUNICATION_IN);
|
|
|
936 |
activity.setCreateTimestamp(LocalDateTime.now());
|
| 27139 |
amit.gupta |
937 |
this.activityRelatedMail(to, ccTo, subject, message);
|
| 24699 |
govind |
938 |
this.activityRelatedMail(retailerService.getFofoRetailer(loginDetails.getFofoId()).getEmail(), null,
|
|
|
939 |
subject, String.format(PARTNER_REOPEN, ticketId));
|
| 24620 |
govind |
940 |
}
|
|
|
941 |
|
|
|
942 |
}
|
|
|
943 |
activityRepository.persist(activity);
|
|
|
944 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
|
|
945 |
return "response";
|
|
|
946 |
}
|
|
|
947 |
|
| 24417 |
govind |
948 |
}
|