| Line 8... |
Line 8... |
| 8 |
|
8 |
|
| 9 |
import javax.servlet.http.HttpServletRequest;
|
9 |
import javax.servlet.http.HttpServletRequest;
|
| 10 |
|
10 |
|
| 11 |
import org.apache.logging.log4j.LogManager;
|
11 |
import org.apache.logging.log4j.LogManager;
|
| 12 |
import org.apache.logging.log4j.Logger;
|
12 |
import org.apache.logging.log4j.Logger;
|
| 13 |
import org.apache.logging.log4j.message.Message;
|
- |
|
| 14 |
import org.springframework.beans.factory.annotation.Autowired;
|
13 |
import org.springframework.beans.factory.annotation.Autowired;
|
| 15 |
import org.springframework.stereotype.Controller;
|
14 |
import org.springframework.stereotype.Controller;
|
| 16 |
import org.springframework.transaction.annotation.Transactional;
|
15 |
import org.springframework.transaction.annotation.Transactional;
|
| 17 |
import org.springframework.ui.Model;
|
16 |
import org.springframework.ui.Model;
|
| 18 |
import org.springframework.web.bind.annotation.GetMapping;
|
17 |
import org.springframework.web.bind.annotation.GetMapping;
|
| Line 32... |
Line 31... |
| 32 |
import com.spice.profitmandi.dao.entity.fofo.ActivityType;
|
31 |
import com.spice.profitmandi.dao.entity.fofo.ActivityType;
|
| 33 |
import com.spice.profitmandi.dao.enumuration.cs.EscalationType;
|
32 |
import com.spice.profitmandi.dao.enumuration.cs.EscalationType;
|
| 34 |
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
|
33 |
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
|
| 35 |
import com.spice.profitmandi.dao.repository.cs.ActivityRepository;
|
34 |
import com.spice.profitmandi.dao.repository.cs.ActivityRepository;
|
| 36 |
import com.spice.profitmandi.dao.repository.cs.CsService;
|
35 |
import com.spice.profitmandi.dao.repository.cs.CsService;
|
| 37 |
import com.spice.profitmandi.dao.repository.cs.PartnerRegionRepository;
|
- |
|
| 38 |
import com.spice.profitmandi.dao.repository.cs.PositionRepository;
|
36 |
import com.spice.profitmandi.dao.repository.cs.PositionRepository;
|
| 39 |
import com.spice.profitmandi.dao.repository.cs.RegionRepository;
|
37 |
import com.spice.profitmandi.dao.repository.cs.RegionRepository;
|
| 40 |
import com.spice.profitmandi.dao.repository.cs.TicketCategoryRepository;
|
38 |
import com.spice.profitmandi.dao.repository.cs.TicketCategoryRepository;
|
| 41 |
import com.spice.profitmandi.dao.repository.cs.TicketRepository;
|
39 |
import com.spice.profitmandi.dao.repository.cs.TicketRepository;
|
| 42 |
import com.spice.profitmandi.dao.repository.cs.TicketSubCategoryRepository;
|
40 |
import com.spice.profitmandi.dao.repository.cs.TicketSubCategoryRepository;
|
| 43 |
import com.spice.profitmandi.dao.repository.dtr.UserRepository;
|
- |
|
| 44 |
import com.spice.profitmandi.service.authentication.RoleManager;
|
41 |
import com.spice.profitmandi.service.authentication.RoleManager;
|
| 45 |
import com.spice.profitmandi.service.slab.TargetSlabService;
|
42 |
import com.spice.profitmandi.service.slab.TargetSlabService;
|
| 46 |
import com.spice.profitmandi.service.user.RetailerService;
|
43 |
import com.spice.profitmandi.service.user.RetailerService;
|
| 47 |
import com.spice.profitmandi.web.model.LoginDetails;
|
44 |
import com.spice.profitmandi.web.model.LoginDetails;
|
| 48 |
import com.spice.profitmandi.web.util.CookiesProcessor;
|
45 |
import com.spice.profitmandi.web.util.CookiesProcessor;
|
| Line 68... |
Line 65... |
| 68 |
|
65 |
|
| 69 |
@Autowired
|
66 |
@Autowired
|
| 70 |
private RegionRepository regionRepository;
|
67 |
private RegionRepository regionRepository;
|
| 71 |
|
68 |
|
| 72 |
@Autowired
|
69 |
@Autowired
|
| 73 |
private PartnerRegionRepository partnerRegionRepository;
|
- |
|
| 74 |
|
- |
|
| 75 |
@Autowired
|
- |
|
| 76 |
private TargetSlabService targetSlabService;
|
70 |
private TargetSlabService targetSlabService;
|
| 77 |
|
71 |
|
| 78 |
@Autowired
|
72 |
@Autowired
|
| 79 |
private RetailerService retailerService;
|
73 |
private RetailerService retailerService;
|
| 80 |
|
74 |
|
| Line 231... |
Line 225... |
| 231 |
return "response";
|
225 |
return "response";
|
| 232 |
}
|
226 |
}
|
| 233 |
|
227 |
|
| 234 |
@GetMapping(value = "/cs/createTicket")
|
228 |
@GetMapping(value = "/cs/createTicket")
|
| 235 |
public String createTicket(HttpServletRequest request, Model model) {
|
229 |
public String createTicket(HttpServletRequest request, Model model) {
|
| 236 |
List<TicketCategory> ticketCategories = ticketCategoryRepository.selectAll();
|
230 |
List<TicketCategory> ticketCategories=csService.getAllTicketCategotyFromSubCategory();
|
| 237 |
model.addAttribute("ticketCategories", ticketCategories);
|
231 |
model.addAttribute("ticketCategories", ticketCategories);
|
| 238 |
return "create-ticket";
|
232 |
return "create-ticket";
|
| 239 |
}
|
233 |
}
|
| 240 |
|
234 |
|
| 241 |
@GetMapping(value = "/cs/getSubCategoriesByCategoryId")
|
235 |
@GetMapping(value = "/cs/getSubCategoriesByCategoryId")
|
| Line 363... |
Line 357... |
| 363 |
}
|
357 |
}
|
| 364 |
return "response";
|
358 |
return "response";
|
| 365 |
}
|
359 |
}
|
| 366 |
@PostMapping(value="/cs/closeTicket")
|
360 |
@PostMapping(value="/cs/closeTicket")
|
| 367 |
public String closeTicket(HttpServletRequest request,
|
361 |
public String closeTicket(HttpServletRequest request,
|
| 368 |
@RequestParam(name = "ticketId", defaultValue = "0") int ticketId,Model model) throws Exception
|
362 |
@RequestParam(name = "ticketId", defaultValue = "0") int ticketId,
|
| - |
|
363 |
@RequestParam (name="happyCode")String happyCode,Model model) throws Exception
|
| 369 |
{
|
364 |
{
|
| 370 |
Ticket ticket=ticketRepository.selectById(ticketId);
|
365 |
Ticket ticket=ticketRepository.selectById(ticketId);
|
| - |
|
366 |
if(ticket.getHappyCode().equals(happyCode))
|
| - |
|
367 |
{
|
| 371 |
ticket.setCloseTimestamp(LocalDateTime.now());
|
368 |
ticket.setCloseTimestamp(LocalDateTime.now());
|
| 372 |
ticketRepository.persist(ticket);
|
369 |
ticketRepository.persist(ticket);
|
| 373 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
370 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
| - |
|
371 |
}
|
| - |
|
372 |
else
|
| - |
|
373 |
{
|
| - |
|
374 |
throw new ProfitMandiBusinessException("Ticket",ticketId, "Happy Code can't match");
|
| - |
|
375 |
}
|
| 374 |
return "response";
|
376 |
return "response";
|
| 375 |
}
|
377 |
}
|
| - |
|
378 |
@GetMapping(value="/cs/managerTicket")
|
| - |
|
379 |
public String getL2L3AndL4Tickets(HttpServletRequest request, @RequestParam(name = "offset", defaultValue = "0") int offset,
|
| - |
|
380 |
@RequestParam(name = "limit", defaultValue = "10") int limit, Model model) throws ProfitMandiBusinessException
|
| - |
|
381 |
{
|
| - |
|
382 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| - |
|
383 |
long size = 0;
|
| - |
|
384 |
AuthUser authUser=authRepository.selectByEmailOrMobile(loginDetails.getEmailId());
|
| - |
|
385 |
List<Ticket> tickets=null;
|
| - |
|
386 |
if(loginDetails.getEmailId().equals(""))
|
| - |
|
387 |
{
|
| - |
|
388 |
tickets=ticketRepository.selectAll(offset, limit,Optional.empty());
|
| - |
|
389 |
size=ticketRepository.selectAllCount();
|
| - |
|
390 |
}
|
| - |
|
391 |
else
|
| - |
|
392 |
{
|
| - |
|
393 |
tickets=ticketRepository.selectAllByEscalatedUserType(authUser.getId(),EscalationType.L2, offset, limit);
|
| - |
|
394 |
if(tickets==null)
|
| - |
|
395 |
{
|
| - |
|
396 |
tickets=ticketRepository.selectAllByEscalatedUserType(authUser.getId(),EscalationType.L3, offset, limit);
|
| - |
|
397 |
size=ticketRepository.selectAllCountByEscalatedUserType(authUser.getId(),EscalationType.L3);
|
| - |
|
398 |
Map<Integer, CustomRetailer> fofoIdsAndCustomRetailer=csService.getPartnerByFofoIds(tickets);
|
| - |
|
399 |
model.addAttribute("fofoIdsAndCustomRetailer", fofoIdsAndCustomRetailer);
|
| - |
|
400 |
}
|
| - |
|
401 |
else
|
| - |
|
402 |
{
|
| - |
|
403 |
size=ticketRepository.selectAllCountByEscalatedUserType(authUser.getId(),EscalationType.L2);
|
| - |
|
404 |
Map<Integer, CustomRetailer> fofoIdsAndCustomRetailer=csService.getPartnerByFofoIds(tickets);
|
| - |
|
405 |
model.addAttribute("fofoIdsAndCustomRetailer", fofoIdsAndCustomRetailer);
|
| - |
|
406 |
}
|
| - |
|
407 |
}
|
| - |
|
408 |
if (size < limit) {
|
| - |
|
409 |
model.addAttribute("end", offset + size);
|
| - |
|
410 |
} else {
|
| - |
|
411 |
model.addAttribute("end", offset + limit);
|
| - |
|
412 |
}
|
| - |
|
413 |
model.addAttribute("start", offset + 1);
|
| - |
|
414 |
model.addAttribute("size", size);
|
| - |
|
415 |
model.addAttribute("tickets", tickets);
|
| - |
|
416 |
Map<Integer, AuthUser> authUserIdAndAuthUserMap = csService.getAuthUserIdAndAuthUserMap(tickets);
|
| - |
|
417 |
Map<Integer, TicketSubCategory> subCategoryIdAndSubCategoryMap = csService
|
| - |
|
418 |
.getSubCategoryIdAndSubCategoryMap(tickets);
|
| - |
|
419 |
model.addAttribute("tickets", tickets);
|
| - |
|
420 |
model.addAttribute("authUserIdAndAuthUserMap", authUserIdAndAuthUserMap);
|
| - |
|
421 |
model.addAttribute("subCategoryIdAndSubCategoryMap", subCategoryIdAndSubCategoryMap);
|
| - |
|
422 |
return "managerTicket";
|
| - |
|
423 |
}
|
| 376 |
}
|
424 |
}
|