Subversion Repositories SmartDukaan

Rev

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

Rev 37019 Rev 37095
Line 423... Line 423...
423
    @RequestMapping(value = "/dasboard/getDateWiseBulletins", method = RequestMethod.GET)
423
    @RequestMapping(value = "/dasboard/getDateWiseBulletins", method = RequestMethod.GET)
424
    public String getDateWiseBulletins(HttpServletRequest request,
424
    public String getDateWiseBulletins(HttpServletRequest request,
425
                                       @RequestParam("date") String date,
425
                                       @RequestParam("date") String date,
426
                                       Model model) throws Exception {
426
                                       Model model) throws Exception {
427
 
427
 
-
 
428
        // Callers on the partner-facing domain don't always carry the fofo admin
-
 
429
        // cookies (FOFO_ID / EMAIL_ID / ROLE_IDS) — cookiesProcessor would then
-
 
430
        // throw ProfitMandiBusinessException and the global handler would turn it
-
 
431
        // into a 400. Bulletins are per-position, so a session-less request has
-
 
432
        // nothing to show — return an empty bulletin list instead of failing.
-
 
433
        LoginDetails loginDetails;
-
 
434
        try {
428
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
435
            loginDetails = cookiesProcessor.getCookiesObject(request);
-
 
436
        } catch (ProfitMandiBusinessException e) {
-
 
437
            model.addAttribute("bulletins", new LinkedHashMap<>());
-
 
438
            return "bulletin-list";
-
 
439
        }
429
        String email = loginDetails.getEmailId();
440
        String email = loginDetails.getEmailId();
430
        AuthUser authUser = authRepository.selectByEmailOrMobile(email);
441
        AuthUser authUser = authRepository.selectByEmailOrMobile(email);
-
 
442
        List<Position> positions = authUser == null
-
 
443
                ? new ArrayList<>()
431
        List<Position> positions = positionRepository.selectAllByAuthUserId(authUser.getId());
444
                : positionRepository.selectAllByAuthUserId(authUser.getId());
432
        LocalDate selectedDate = LocalDate.parse(date);
445
        LocalDate selectedDate = LocalDate.parse(date);
433
 
446
 
434
        // Short-circuit when the caller has no Position rows. getTodayBulletin's
447
        // Short-circuit when the caller has no Position rows. getTodayBulletin's
435
        // `positions` parameter is @NotEmpty validated — handing it an empty list
448
        // `positions` parameter is @NotEmpty validated — handing it an empty list
436
        // throws "List should not be empty" and 500s the dashboard. A user with
449
        // throws "List should not be empty" and 500s the dashboard. A user with