Subversion Repositories SmartDukaan

Rev

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

Rev 37287 Rev 37324
Line 275... Line 275...
275
    @Autowired
275
    @Autowired
276
    private RbmRatingRepository rbmRatingRepository;
276
    private RbmRatingRepository rbmRatingRepository;
277
 
277
 
278
    List<LeadStatus> status = Arrays.asList(LeadStatus.notInterested, LeadStatus.finalized);
278
    List<LeadStatus> status = Arrays.asList(LeadStatus.notInterested, LeadStatus.finalized);
279
 
279
 
-
 
280
    /**
-
 
281
     * Restricted lead view applies only to field-level sales positions (L1-L3: ASM/CM/DM).
-
 
282
     * L4+ sales (BM/RSM/NSM and above, incl. co-founder-level L7) keep the full lead list —
-
 
283
     * a senior head can hold a SALES position for approver/head flows without losing
-
 
284
     * Lead Management visibility.
-
 
285
     */
-
 
286
    private boolean isFieldSales(int authUserId) {
-
 
287
        return positionRepository.selectPositionByAuthId(authUserId).stream()
-
 
288
                .filter(p -> p.getCategoryId() == ProfitMandiConstants.TICKET_CATEGORY_SALES)
-
 
289
                .anyMatch(p -> p.getEscalationType() == null
-
 
290
                        || !p.getEscalationType().isGreaterThanEqualTo(EscalationType.L4));
-
 
291
    }
-
 
292
 
280
    @RequestMapping(value = "/getOpenLead", method = RequestMethod.GET)
293
    @RequestMapping(value = "/getOpenLead", method = RequestMethod.GET)
281
    public String getOpenLead(HttpServletRequest request, @RequestParam(name = "leadStatus", required = false, defaultValue = "All") List<LeadStatus> leadStatus, @RequestParam(name = "color", required = false, defaultValue = "All") List<String> color, @RequestParam(name = "startDate", required = false) LocalDate startDate, @RequestParam(name = "endDate", required = false) LocalDate endDate, Model model) throws Exception {
294
    public String getOpenLead(HttpServletRequest request, @RequestParam(name = "leadStatus", required = false, defaultValue = "All") List<LeadStatus> leadStatus, @RequestParam(name = "color", required = false, defaultValue = "All") List<String> color, @RequestParam(name = "startDate", required = false) LocalDate startDate, @RequestParam(name = "endDate", required = false) LocalDate endDate, Model model) throws Exception {
282
 
295
 
283
 
296
 
284
        LocalDateTime startDateTime = startDate != null ? startDate.atStartOfDay() : null;
297
        LocalDateTime startDateTime = startDate != null ? startDate.atStartOfDay() : null;
Line 287... Line 300...
287
 
300
 
288
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
301
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
289
        String emailId = loginDetails.getEmailId();
302
        String emailId = loginDetails.getEmailId();
290
        AuthUser authUser = authRepository.selectByEmailOrMobile(emailId);
303
        AuthUser authUser = authRepository.selectByEmailOrMobile(emailId);
291
 
304
 
292
        boolean isPositionSales = positionRepository.hasCategory(authUser.getId(), ProfitMandiConstants.TICKET_CATEGORY_SALES);
305
        boolean isPositionSales = this.isFieldSales(authUser.getId());
293
 
306
 
294
        if (leadStatus.contains(LeadStatus.All)) {
307
        if (leadStatus.contains(LeadStatus.All)) {
295
 
308
 
296
            leadStatus.add(LeadStatus.pending);
309
            leadStatus.add(LeadStatus.pending);
297
            leadStatus.add(LeadStatus.notInterested);
310
            leadStatus.add(LeadStatus.notInterested);
Line 643... Line 656...
643
            color.add("yellow");
656
            color.add("yellow");
644
            color.add("green");
657
            color.add("green");
645
        }
658
        }
646
 
659
 
647
        Map<Integer, List<LeadActivity>> leadActivityMap = new HashMap<>();
660
        Map<Integer, List<LeadActivity>> leadActivityMap = new HashMap<>();
648
        boolean authPositon = positionRepository.hasCategory(authUser.getId(), ProfitMandiConstants.TICKET_CATEGORY_SALES);
661
        boolean authPositon = this.isFieldSales(authUser.getId());
649
        List<Integer> authUserIds = null;
662
        List<Integer> authUserIds = null;
650
        List<Lead> leadFollowUp = new ArrayList<>();
663
        List<Lead> leadFollowUp = new ArrayList<>();
651
 
664
 
652
        if (authPositon) {
665
        if (authPositon) {
653
            authUserIds = authService.getAllReportees(authUser.getId());
666
            authUserIds = authService.getAllReportees(authUser.getId());