Subversion Repositories SmartDukaan

Rev

Rev 37101 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 37101 Rev 37630
Line 63... Line 63...
63
@Controller
63
@Controller
64
@Transactional(rollbackFor = Throwable.class)
64
@Transactional(rollbackFor = Throwable.class)
65
public class RetailerController {
65
public class RetailerController {
66
 
66
 
67
    private static final Logger LOGGER = LogManager.getLogger(RetailerController.class);
67
    private static final Logger LOGGER = LogManager.getLogger(RetailerController.class);
68
    private static final List<String> CHANGE_PARTNER_CATEGORY_PERMISSIONS = Arrays.asList("tarun.verma@smartdukaan.com", "kamini.sharma@smartdukaan.com", "shankar.mushra@smartdukaan.com");
68
    private static final List<String> CHANGE_PARTNER_CATEGORY_PERMISSIONS = Arrays.asList("tarun.verma@smartdukaan.com", "kamini.sharma@smartdukaan.com");
69
    @Autowired
69
    @Autowired
70
    PartnerOnBoardingPanelRepository partnerOnBoardingPanelRepository;
70
    PartnerOnBoardingPanelRepository partnerOnBoardingPanelRepository;
71
    @Autowired
71
    @Autowired
72
    BrandsService brandsService;
72
    BrandsService brandsService;
73
    @Autowired
73
    @Autowired
Line 510... Line 510...
510
                                  @RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
510
                                  @RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
511
        FofoStore fofoStore = fofoStoreRepository.selectByRetailerId(fofoId);
511
        FofoStore fofoStore = fofoStoreRepository.selectByRetailerId(fofoId);
512
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
512
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
513
        if (!Arrays
513
        if (!Arrays
514
                .asList("kamini.sharma@smartdukaan.com", "tarun.verma@smartdukaan.com", "amit.gupta@smartdukaan.com",
514
                .asList("kamini.sharma@smartdukaan.com", "tarun.verma@smartdukaan.com", "amit.gupta@smartdukaan.com",
515
                        "rahul.katyal@smartdukaan.com", "vikas.jangra@smartdukaan.com", "sm@smartdukaan.com")
515
                        "vikas.jangra@smartdukaan.com")
516
                .contains(loginDetails.getEmailId())) {
516
                .contains(loginDetails.getEmailId())) {
517
            throw new ProfitMandiBusinessException("Access Denied", "Unauthorised Access",
517
            throw new ProfitMandiBusinessException("Access Denied", "Unauthorised Access",
518
                    "You are not authorise to deactivate retailer");
518
                    "You are not authorise to deactivate retailer");
519
        }
519
        }
520
        if (fofoStore.isClosed()) {
520
        if (fofoStore.isClosed()) {
Line 533... Line 533...
533
                             @RequestParam(name = "storeCode") String storeCode, Model model) throws Exception {
533
                             @RequestParam(name = "storeCode") String storeCode, Model model) throws Exception {
534
        FofoStore fofoStore = fofoStoreRepository.selectByRetailerId(fofoId);
534
        FofoStore fofoStore = fofoStoreRepository.selectByRetailerId(fofoId);
535
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
535
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
536
        if (!Arrays
536
        if (!Arrays
537
                .asList("kamini.sharma@smartdukaan.com", "tarun.verma@smartdukaan.com", "amit.gupta@smartdukaan.com",
537
                .asList("kamini.sharma@smartdukaan.com", "tarun.verma@smartdukaan.com", "amit.gupta@smartdukaan.com",
538
                        "rahul.katyal@smartdukaan.com", "vikas.jangra@smartdukaan.com", "sm@smartdukaan.com")
538
                        "vikas.jangra@smartdukaan.com")
539
                .contains(loginDetails.getEmailId())) {
539
                .contains(loginDetails.getEmailId())) {
540
            throw new ProfitMandiBusinessException("Access Denied", "Unauthorised Access",
540
            throw new ProfitMandiBusinessException("Access Denied", "Unauthorised Access",
541
                    "You are not authorise to close store");
541
                    "You are not authorise to close store");
542
        }
542
        }
543
        if (fofoStore.isClosed()) {
543
        if (fofoStore.isClosed()) {
Line 559... Line 559...
559
    @PostMapping(value = "/activateStoreForever")
559
    @PostMapping(value = "/activateStoreForever")
560
    public String activateStoreForever(HttpServletRequest request,
560
    public String activateStoreForever(HttpServletRequest request,
561
                                       @RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
561
                                       @RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
562
        FofoStore fofoStore = fofoStoreRepository.selectByRetailerId(fofoId);
562
        FofoStore fofoStore = fofoStoreRepository.selectByRetailerId(fofoId);
563
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
563
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
564
        if (!Arrays.asList("kamini.sharma@smartdukaan.com", "tarun.verma@smartdukaan.com", "amit.gupta@smartdukaan.com",
564
        if (!Arrays.asList("kamini.sharma@smartdukaan.com", "tarun.verma@smartdukaan.com", "amit.gupta@smartdukaan.com").contains(loginDetails.getEmailId())) {
565
                "rahul.katyal@smartdukaan.com", "sm@smartdukaan.com").contains(loginDetails.getEmailId())) {
-
 
566
            throw new ProfitMandiBusinessException("Access Denied", "Unauthorised Access",
565
            throw new ProfitMandiBusinessException("Access Denied", "Unauthorised Access",
567
                    "You are not authorise to activate retailer");
566
                    "You are not authorise to activate retailer");
568
        }
567
        }
569
        if (fofoStore.isClosed()) {
568
        if (fofoStore.isClosed()) {
570
            throw new ProfitMandiBusinessException("Store Closed", "Store Permanently Closed",
569
            throw new ProfitMandiBusinessException("Store Closed", "Store Permanently Closed",
Line 581... Line 580...
581
                                         @RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId,
580
                                         @RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId,
582
                                         @RequestParam(name = "days", required = true) int days, Model model) throws Exception {
581
                                         @RequestParam(name = "days", required = true) int days, Model model) throws Exception {
583
 
582
 
584
        FofoStore fofoStore = fofoStoreRepository.selectByRetailerId(fofoId);
583
        FofoStore fofoStore = fofoStoreRepository.selectByRetailerId(fofoId);
585
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
584
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
586
        if (!Arrays.asList("kamini.sharma@smartdukaan.com", "tarun.verma@smartdukaan.com", "amit.gupta@smartdukaan.com",
585
        if (!Arrays.asList("kamini.sharma@smartdukaan.com", "tarun.verma@smartdukaan.com", "amit.gupta@smartdukaan.com").contains(loginDetails.getEmailId())) {
587
                "rahul.katyal@smartdukaan.com", "sm@smartdukaan.com").contains(loginDetails.getEmailId())) {
-
 
588
            throw new ProfitMandiBusinessException("Access Denied", "Unauthorised Access",
586
            throw new ProfitMandiBusinessException("Access Denied", "Unauthorised Access",
589
                    "You are not authorise to deactivate retailer");
587
                    "You are not authorise to deactivate retailer");
590
        }
588
        }
591
 
589
 
592
        if (fofoStore.isClosed()) {
590
        if (fofoStore.isClosed()) {
Line 635... Line 633...
635
    public String extendBilling(HttpServletRequest request,
633
    public String extendBilling(HttpServletRequest request,
636
                                @RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
634
                                @RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
637
        FofoStore fofoStore = fofoStoreRepository.selectByRetailerId(fofoId);
635
        FofoStore fofoStore = fofoStoreRepository.selectByRetailerId(fofoId);
638
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
636
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
639
        if (Arrays.asList("kamini.sharma@smartdukaan.com", "tarun.verma@smartdukaan.com", "amit.gupta@smartdukaan.com",
637
        if (Arrays.asList("kamini.sharma@smartdukaan.com", "tarun.verma@smartdukaan.com", "amit.gupta@smartdukaan.com",
640
                "rahul.katyal@smartdukaan.com", "sm@smartdukaan.com", "mohit.gulati@smartdukaan.com", "chiranjib.sarkar@smartdukaan.com").contains(loginDetails.getEmailId())) {
638
                "mohit.gulati@smartdukaan.com").contains(loginDetails.getEmailId())) {
641
            fofoStore.setGraceDate(LocalDate.now().plusDays(2));
639
            fofoStore.setGraceDate(LocalDate.now().plusDays(2));
642
            fofoStore.setGraceCount(fofoStore.getGraceCount() + 1);
640
            fofoStore.setGraceCount(fofoStore.getGraceCount() + 1);
643
            model.addAttribute("response1", mvcResponseSender.createResponseString(fofoStore.getGraceCount()));
641
            model.addAttribute("response1", mvcResponseSender.createResponseString(fofoStore.getGraceCount()));
644
        } else {
642
        } else {
645
            throw new ProfitMandiBusinessException("Access Denied", "Unauthorised Access",
643
            throw new ProfitMandiBusinessException("Access Denied", "Unauthorised Access",