Subversion Repositories SmartDukaan

Rev

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

Rev 35543 Rev 35583
Line 21... Line 21...
21
import com.spice.profitmandi.dao.entity.transaction.LineItem;
21
import com.spice.profitmandi.dao.entity.transaction.LineItem;
22
import com.spice.profitmandi.dao.entity.transaction.Order;
22
import com.spice.profitmandi.dao.entity.transaction.Order;
23
import com.spice.profitmandi.dao.enumuration.catalog.UpgradeOfferStatus;
23
import com.spice.profitmandi.dao.enumuration.catalog.UpgradeOfferStatus;
24
import com.spice.profitmandi.dao.enumuration.fofo.Milestone;
24
import com.spice.profitmandi.dao.enumuration.fofo.Milestone;
25
import com.spice.profitmandi.dao.enumuration.transaction.OrderStatus;
25
import com.spice.profitmandi.dao.enumuration.transaction.OrderStatus;
26
import com.spice.profitmandi.dao.model.*;
-
 
27
import com.spice.profitmandi.dao.model.SamsungUpgradeOfferModel;
26
import com.spice.profitmandi.dao.model.SamsungUpgradeOfferModel;
-
 
27
import com.spice.profitmandi.dao.model.*;
28
import com.spice.profitmandi.dao.model.warehouse.LMSGraphRequest;
28
import com.spice.profitmandi.dao.model.warehouse.LMSGraphRequest;
29
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
29
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
30
import com.spice.profitmandi.dao.repository.catalog.*;
30
import com.spice.profitmandi.dao.repository.catalog.*;
31
import com.spice.profitmandi.dao.repository.cs.*;
31
import com.spice.profitmandi.dao.repository.cs.*;
32
import com.spice.profitmandi.dao.repository.dtr.*;
32
import com.spice.profitmandi.dao.repository.dtr.*;
Line 44... Line 44...
44
import com.spice.profitmandi.service.SshServer.SSHService;
44
import com.spice.profitmandi.service.SshServer.SSHService;
45
import com.spice.profitmandi.service.authentication.RoleManager;
45
import com.spice.profitmandi.service.authentication.RoleManager;
46
import com.spice.profitmandi.service.catalog.BrandsService;
46
import com.spice.profitmandi.service.catalog.BrandsService;
47
import com.spice.profitmandi.service.integrations.psismart.PsiSmartService;
47
import com.spice.profitmandi.service.integrations.psismart.PsiSmartService;
48
import com.spice.profitmandi.service.inventory.InventoryService;
48
import com.spice.profitmandi.service.inventory.InventoryService;
49
import com.spice.profitmandi.service.offers.ItemCriteria;
-
 
50
import com.spice.profitmandi.service.offers.OfferService;
49
import com.spice.profitmandi.service.offers.OfferService;
51
import com.spice.profitmandi.service.scheme.SchemeService;
50
import com.spice.profitmandi.service.scheme.SchemeService;
52
import com.spice.profitmandi.service.transaction.TransactionService;
51
import com.spice.profitmandi.service.transaction.TransactionService;
53
import com.spice.profitmandi.service.user.RetailerService;
52
import com.spice.profitmandi.service.user.RetailerService;
54
import com.spice.profitmandi.web.model.LoginDetails;
53
import com.spice.profitmandi.web.model.LoginDetails;
Line 412... Line 411...
412
        List<BrandItemWisePartnerSaleModel> brandItemWisePartnerSaleModels = fofoStoreRepository.selectPartnerBrandItemMonthlySecondarySale(Collections.singletonList(fofoId), month, brand);
411
        List<BrandItemWisePartnerSaleModel> brandItemWisePartnerSaleModels = fofoStoreRepository.selectPartnerBrandItemMonthlySecondarySale(Collections.singletonList(fofoId), month, brand);
413
        LOGGER.info("brandItemWisePartnerSaleModels {}", brandItemWisePartnerSaleModels);
412
        LOGGER.info("brandItemWisePartnerSaleModels {}", brandItemWisePartnerSaleModels);
414
        return brandItemWisePartnerSaleModels;
413
        return brandItemWisePartnerSaleModels;
415
    }
414
    }
416
 
415
 
-
 
416
    @RequestMapping(value = "/dasboard/getDateWiseBulletins", method = RequestMethod.GET)
-
 
417
    public String getDateWiseBulletins(HttpServletRequest request,
-
 
418
                                       @RequestParam("date") String date,
-
 
419
                                       Model model) throws Exception {
-
 
420
 
-
 
421
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
-
 
422
        String email = loginDetails.getEmailId();
-
 
423
        AuthUser authUser = authRepository.selectByEmailOrMobile(email);
-
 
424
        List<Position> positions = positionRepository.selectAllByAuthUserId(authUser.getId());
-
 
425
        LocalDate selectedDate = LocalDate.parse(date);
-
 
426
 
-
 
427
        // DB data
-
 
428
        Map<ProfitMandiConstants.BULLETIN_TYPE_ENUM, List<BulletinOfferModal>> dbBulletins =
-
 
429
                adminUser.getTodayBulletin(positions, selectedDate.atStartOfDay());
-
 
430
 
-
 
431
        // Final ordered map
-
 
432
        Map<ProfitMandiConstants.BULLETIN_TYPE_ENUM, List<BulletinOfferModal>> bulletins =
-
 
433
                new LinkedHashMap<>();
-
 
434
 
-
 
435
        // 1️⃣ First add types that HAVE data
-
 
436
        dbBulletins.forEach((key, value) -> {
-
 
437
            if (value != null && !value.isEmpty()) {
-
 
438
                bulletins.put(key, value);
-
 
439
            }
-
 
440
        });
-
 
441
 
-
 
442
        // 2️⃣ Then add missing enum types as empty
-
 
443
        for (ProfitMandiConstants.BULLETIN_TYPE_ENUM type :
-
 
444
                ProfitMandiConstants.BULLETIN_TYPE_ENUM.values()) {
-
 
445
            bulletins.putIfAbsent(type, new ArrayList<>());
-
 
446
        }
-
 
447
 
-
 
448
        model.addAttribute("bulletins", bulletins);
-
 
449
        return "bulletin-list";
-
 
450
    }
-
 
451
 
-
 
452
 
417
 
453
 
418
    @RequestMapping(value = "/dashboard", method = RequestMethod.GET)
454
    @RequestMapping(value = "/dashboard", method = RequestMethod.GET)
419
    public String dashboard(HttpServletRequest request, Model model) throws Exception {
455
    public String dashboard(HttpServletRequest request, Model model) throws Exception {
420
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
456
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
421
        String email = loginDetails.getEmailId();
457
        String email = loginDetails.getEmailId();