Subversion Repositories SmartDukaan

Rev

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

Rev 35456 Rev 35458
Line 256... Line 256...
256
    List<String> filterableParams = Arrays.asList("brand");
256
    List<String> filterableParams = Arrays.asList("brand");
257
 
257
 
258
    @RequestMapping(value = "/store/entity/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
258
    @RequestMapping(value = "/store/entity/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
259
    @ApiImplicitParams({@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
259
    @ApiImplicitParams({@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
260
    @ApiOperation(value = "Get unit deal object")
260
    @ApiOperation(value = "Get unit deal object")
261
    @Transactional(readOnly = true)
-
 
262
    public ResponseEntity<?> getUnitFocoDeal(HttpServletRequest request, @PathVariable(value = "id") long id) throws ProfitMandiBusinessException {
261
    public ResponseEntity<?> getUnitFocoDeal(HttpServletRequest request, @PathVariable(value = "id") long id) throws ProfitMandiBusinessException {
263
        List<FofoCatalogResponse> dealResponses = new ArrayList<>();
262
        List<FofoCatalogResponse> dealResponses = new ArrayList<>();
264
        List<Integer> tagIds = Arrays.asList(4);
263
        List<Integer> tagIds = Arrays.asList(4);
265
        FofoCatalogResponse fofoCatalogResponse = null;
264
        FofoCatalogResponse fofoCatalogResponse = null;
266
        UserInfo userInfo = (UserInfo) request.getAttribute("userInfo");
265
        UserInfo userInfo = (UserInfo) request.getAttribute("userInfo");
Line 305... Line 304...
305
    }
304
    }
306
 
305
 
307
    @RequestMapping(value = "/store/brands", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
306
    @RequestMapping(value = "/store/brands", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
308
    @ApiImplicitParams({@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
307
    @ApiImplicitParams({@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
309
    @ApiOperation(value = "Get brand list and count for category")
308
    @ApiOperation(value = "Get brand list and count for category")
310
    @Transactional(readOnly = true)
-
 
311
    public ResponseEntity<?> getBrands(HttpServletRequest request, @RequestParam(value = "category_id") String category_id) throws ProfitMandiBusinessException {
309
    public ResponseEntity<?> getBrands(HttpServletRequest request, @RequestParam(value = "category_id") String category_id) throws ProfitMandiBusinessException {
312
        logger.info("Request " + request.getParameterMap());
310
        logger.info("Request " + request.getParameterMap());
313
        String response = null;
311
        String response = null;
314
        // TODO: move to properties
312
        // TODO: move to properties
315
        String uri = ProfitMandiConstants.URL_BRANDS;
313
        String uri = ProfitMandiConstants.URL_BRANDS;
Line 328... Line 326...
328
 
326
 
329
        return responseSender.ok(dealBrandsResponse);
327
        return responseSender.ok(dealBrandsResponse);
330
    }
328
    }
331
 
329
 
332
    @RequestMapping(value = "/store/listing/{listingUrl}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
330
    @RequestMapping(value = "/store/listing/{listingUrl}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
333
    @Transactional(readOnly = true)
-
 
334
    public ResponseEntity<?> bestSellers(HttpServletRequest request, @PathVariable String listingUrl) throws Exception {
331
    public ResponseEntity<?> bestSellers(HttpServletRequest request, @PathVariable String listingUrl) throws Exception {
335
        UserInfo userInfo = (UserInfo) request.getAttribute("userInfo");
332
        UserInfo userInfo = (UserInfo) request.getAttribute("userInfo");
336
        WebListing webListing = webListingRepository.selectByUrl(listingUrl);
333
        WebListing webListing = webListingRepository.selectByUrl(listingUrl);
337
        webListing.setFofoCatalogResponses(getDealResponses(userInfo, webListing));
334
        webListing.setFofoCatalogResponses(getDealResponses(userInfo, webListing));
338
        return responseSender.ok(webListing);
335
        return responseSender.ok(webListing);
Line 363... Line 360...
363
        }
360
        }
364
    }
361
    }
365
 
362
 
366
 
363
 
367
    @RequestMapping(value = "/store/getCustomerById/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
364
    @RequestMapping(value = "/store/getCustomerById/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
368
    @Transactional(readOnly = true)
-
 
369
    public ResponseEntity<?> getCustomerById(HttpServletRequest request, @PathVariable int id) throws Exception {
365
    public ResponseEntity<?> getCustomerById(HttpServletRequest request, @PathVariable int id) throws Exception {
370
 
366
 
371
        Customer customer = customerRepository.selectById(id);
367
        Customer customer = customerRepository.selectById(id);
372
        customer.setPasswordExist(StringUtils.isNotEmpty(customer.getPassword()));
368
        customer.setPasswordExist(StringUtils.isNotEmpty(customer.getPassword()));
373
 
369
 
Line 608... Line 604...
608
 
604
 
609
    }
605
    }
610
    @RequestMapping(value = "/store/address", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
606
    @RequestMapping(value = "/store/address", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
611
    @ApiImplicitParams({@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
607
    @ApiImplicitParams({@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
612
    @ApiOperation(value = "Get brand list and count for category")
608
    @ApiOperation(value = "Get brand list and count for category")
613
    @Transactional(readOnly = true)
-
 
614
    public ResponseEntity<?> getAddress(HttpServletRequest request) throws Exception {
609
    public ResponseEntity<?> getAddress(HttpServletRequest request) throws Exception {
615
        UserInfo userInfo = (UserInfo) request.getAttribute("userInfo");
610
        UserInfo userInfo = (UserInfo) request.getAttribute("userInfo");
616
        Integer storeId = userInfo.getRetailerId();
611
        Integer storeId = userInfo.getRetailerId();
617
        CustomRetailer customRetailer = retailerService.getFofoRetailer(storeId);
612
        CustomRetailer customRetailer = retailerService.getFofoRetailer(storeId);
618
 
613
 
Line 645... Line 640...
645
    }
640
    }
646
 
641
 
647
    @RequestMapping(value = "/store/address/{pincode}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
642
    @RequestMapping(value = "/store/address/{pincode}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
648
    @ApiImplicitParams({@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
643
    @ApiImplicitParams({@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
649
    @ApiOperation(value = "Get brand list and count for category")
644
    @ApiOperation(value = "Get brand list and count for category")
650
    @Transactional(readOnly = true)
-
 
651
    public ResponseEntity<?> getStoresByPincode(HttpServletRequest request, @PathVariable String pincode) throws Exception {
645
    public ResponseEntity<?> getStoresByPincode(HttpServletRequest request, @PathVariable String pincode) throws Exception {
652
        List<PincodePartner> pincodePartners = pincodePartnerRepository.selectPartnersByPincode(pincode);
646
        List<PincodePartner> pincodePartners = pincodePartnerRepository.selectPartnersByPincode(pincode);
653
        int fofoId = ProfitMandiConstants.DEFAULT_STORE;
647
        int fofoId = ProfitMandiConstants.DEFAULT_STORE;
654
        if (pincodePartners.size() > 0) {
648
        if (pincodePartners.size() > 0) {
655
            List<Integer> fofoIds = pincodePartners.stream().map(x -> x.getFofoId()).collect(Collectors.toList());
649
            List<Integer> fofoIds = pincodePartners.stream().map(x -> x.getFofoId()).collect(Collectors.toList());
Line 663... Line 657...
663
    }
657
    }
664
 
658
 
665
    @RequestMapping(value = "/store/addresses", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
659
    @RequestMapping(value = "/store/addresses", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
666
    @ApiImplicitParams({@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
660
    @ApiImplicitParams({@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
667
    @ApiOperation(value = "Get brand list and count for category")
661
    @ApiOperation(value = "Get brand list and count for category")
668
    @Transactional(readOnly = true)
-
 
669
    public ResponseEntity<?> getStoresByPincod(HttpServletRequest request, @RequestParam String pincode, @RequestParam(name = "fofoCode", defaultValue = "", required = false) String fofoCode) throws Exception {
662
    public ResponseEntity<?> getStoresByPincod(HttpServletRequest request, @RequestParam String pincode, @RequestParam(name = "fofoCode", defaultValue = "", required = false) String fofoCode) throws Exception {
670
 
663
 
671
        List<CustomRetailer> customerRetailers = new ArrayList<>();
664
        List<CustomRetailer> customerRetailers = new ArrayList<>();
672
 
665
 
673
        logger.info("fofoCode" + fofoCode);
666
        logger.info("fofoCode" + fofoCode);
Line 716... Line 709...
716
    }
709
    }
717
 
710
 
718
    @RequestMapping(value = "/store/address/detail/{pincode}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
711
    @RequestMapping(value = "/store/address/detail/{pincode}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
719
    @ApiImplicitParams({@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
712
    @ApiImplicitParams({@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
720
    @ApiOperation(value = "Get brand list and count for category")
713
    @ApiOperation(value = "Get brand list and count for category")
721
    @Transactional(readOnly = true)
-
 
722
    public ResponseEntity<?> getStoresDetailsByPincode(HttpServletRequest request, @PathVariable String pincode) throws Exception {
714
    public ResponseEntity<?> getStoresDetailsByPincode(HttpServletRequest request, @PathVariable String pincode) throws Exception {
723
        List<CustomRetailer> customerRetailers = new ArrayList<>();
715
        List<CustomRetailer> customerRetailers = new ArrayList<>();
724
        List<PincodePartner> pincodePartners = pincodePartnerRepository.selectPartnersByPincode(pincode);
716
        List<PincodePartner> pincodePartners = pincodePartnerRepository.selectPartnersByPincode(pincode);
725
 
717
 
726
        if (!pincodePartners.isEmpty()) {
718
        if (!pincodePartners.isEmpty()) {
Line 737... Line 729...
737
        logger.info("customerRetailers" + customerRetailers);
729
        logger.info("customerRetailers" + customerRetailers);
738
        return responseSender.ok(customerRetailers);
730
        return responseSender.ok(customerRetailers);
739
    }
731
    }
740
 
732
 
741
    @RequestMapping(value = "/store/order", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
733
    @RequestMapping(value = "/store/order", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
742
    @Transactional(readOnly = true)
-
 
743
    public ResponseEntity<?> getOrderDetail(HttpServletRequest request, @RequestParam(value = "id") int id, @RequestParam(name = "offset") int offset, @RequestParam(name = "limit") int limit) throws Exception {
734
    public ResponseEntity<?> getOrderDetail(HttpServletRequest request, @RequestParam(value = "id") int id, @RequestParam(name = "offset") int offset, @RequestParam(name = "limit") int limit) throws Exception {
744
 
735
 
745
        List<PendingOrderDetail> pendingOrderDetails = new ArrayList<>();
736
        List<PendingOrderDetail> pendingOrderDetails = new ArrayList<>();
746
        List<Integer> catalogIds = new ArrayList<>();
737
        List<Integer> catalogIds = new ArrayList<>();
747
        List<PendingOrder> pendingOrders = pendingOrderRepository.selectByCustomerId(id, offset, limit);
738
        List<PendingOrder> pendingOrders = pendingOrderRepository.selectByCustomerId(id, offset, limit);
Line 790... Line 781...
790
 
781
 
791
        return responseSender.ok(pendingOrderDetails);
782
        return responseSender.ok(pendingOrderDetails);
792
    }
783
    }
793
 
784
 
794
    @RequestMapping(value = "/store/invoiceOrder", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
785
    @RequestMapping(value = "/store/invoiceOrder", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
795
    @Transactional(readOnly = true)
-
 
796
    public ResponseEntity<?> getOrderInvoiceDetail(HttpServletRequest request, @RequestParam(value = "id") int id, @RequestParam(name = "offset") int offset, @RequestParam(name = "limit") int limit) throws Exception {
786
    public ResponseEntity<?> getOrderInvoiceDetail(HttpServletRequest request, @RequestParam(value = "id") int id, @RequestParam(name = "offset") int offset, @RequestParam(name = "limit") int limit) throws Exception {
797
        List<CustomerOrderAndInsuranceDetails> customerOrderAndInsuranceDetails = new ArrayList<>();
787
        List<CustomerOrderAndInsuranceDetails> customerOrderAndInsuranceDetails = new ArrayList<>();
798
        List<Integer> catalogIds = new ArrayList<>();
788
        List<Integer> catalogIds = new ArrayList<>();
799
        List<FofoOrder> fofoOrders = fofoOrderRepository.selectOrderByCustomerId(id, offset, limit);
789
        List<FofoOrder> fofoOrders = fofoOrderRepository.selectOrderByCustomerId(id, offset, limit);
800
 
790
 
Line 834... Line 824...
834
        }
824
        }
835
        return responseSender.ok(customerOrderAndInsuranceDetails);
825
        return responseSender.ok(customerOrderAndInsuranceDetails);
836
    }
826
    }
837
 
827
 
838
    @RequestMapping(value = "/store/generateInvoice", method = RequestMethod.GET)
828
    @RequestMapping(value = "/store/generateInvoice", method = RequestMethod.GET)
839
    @Transactional(readOnly = true)
-
 
840
    public ResponseEntity<?> generateInvoice(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.ORDER_ID) int orderId) throws ProfitMandiBusinessException {
829
    public ResponseEntity<?> generateInvoice(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.ORDER_ID) int orderId) throws ProfitMandiBusinessException {
841
        InvoicePdfModel pdfModel = null;
830
        InvoicePdfModel pdfModel = null;
842
        FofoOrder fo = fofoOrderRepository.selectByOrderId(orderId);
831
        FofoOrder fo = fofoOrderRepository.selectByOrderId(orderId);
843
        pdfModel = orderService.getInvoicePdfModel(fo.getFofoId(), orderId);
832
        pdfModel = orderService.getInvoicePdfModel(fo.getFofoId(), orderId);
844
        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
833
        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
Line 874... Line 863...
874
 
863
 
875
    }
864
    }
876
 
865
 
877
    @RequestMapping(value = "/store/listing", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
866
    @RequestMapping(value = "/store/listing", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
878
    @Cacheable(value = "storesListing", cacheManager = "thirtyMinsTimeOutCacheManager")
867
    @Cacheable(value = "storesListing", cacheManager = "thirtyMinsTimeOutCacheManager")
879
    @Transactional(readOnly = true)
-
 
880
    public ResponseEntity<?> getStoresListing(HttpServletRequest request) throws Exception {
868
    public ResponseEntity<?> getStoresListing(HttpServletRequest request) throws Exception {
881
        List<WebListing> webListings = webListingRepository.selectAllWebListingByType(Optional.of(true), WebListingSource.store);
869
        List<WebListing> webListings = webListingRepository.selectAllWebListingByType(Optional.of(true), WebListingSource.store);
882
        UserInfo userInfo = (UserInfo) request.getAttribute("userInfo");
870
        UserInfo userInfo = (UserInfo) request.getAttribute("userInfo");
883
        for (WebListing webListing : webListings) {
871
        for (WebListing webListing : webListings) {
884
            webListing.setFofoCatalogResponses(getDealResponses(userInfo, webListing));
872
            webListing.setFofoCatalogResponses(getDealResponses(userInfo, webListing));
Line 888... Line 876...
888
 
876
 
889
    @Autowired
877
    @Autowired
890
    StateRepository stateRepository;
878
    StateRepository stateRepository;
891
 
879
 
892
    @RequestMapping(value = "/store/stateList", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
880
    @RequestMapping(value = "/store/stateList", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
893
    @Transactional(readOnly = true)
-
 
894
    public ResponseEntity<?> getStateList(HttpServletRequest request) throws Exception {
881
    public ResponseEntity<?> getStateList(HttpServletRequest request) throws Exception {
895
        List<State> states = stateRepository.selectAll();
882
        List<State> states = stateRepository.selectAll();
896
        return responseSender.ok(states);
883
        return responseSender.ok(states);
897
    }
884
    }
898
    /*@RequestMapping(value = "/store/listing", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
885
    /*@RequestMapping(value = "/store/listing", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
Line 1077... Line 1064...
1077
        return cartResponse;
1064
        return cartResponse;
1078
 
1065
 
1079
    }
1066
    }
1080
 
1067
 
1081
    @RequestMapping(value = "/store/partnerStock", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
1068
    @RequestMapping(value = "/store/partnerStock", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
1082
    @Transactional(readOnly = true)
-
 
1083
    public ResponseEntity<?> partnerStock(HttpServletRequest request, @RequestParam(required = false, defaultValue = "3") String categoryId, @RequestParam int offset,
1069
    public ResponseEntity<?> partnerStock(HttpServletRequest request, @RequestParam(required = false, defaultValue = "3") String categoryId, @RequestParam int offset,
1084
      @RequestParam int limit, @RequestParam(required = false) String sort, @RequestParam(required = false) String brand,
1070
      @RequestParam int limit, @RequestParam(required = false) String sort, @RequestParam(required = false) String brand,
1085
      @RequestParam(value = "subCategoryId", required = false) int subCategoryId, @RequestParam(required = false) String queryTerm,
1071
      @RequestParam(value = "subCategoryId", required = false) int subCategoryId, @RequestParam(required = false) String queryTerm,
1086
      @RequestParam(required = false) String listing, @RequestParam(required = false, defaultValue = "true") boolean partnerStockOnly) throws Throwable {
1072
      @RequestParam(required = false) String listing, @RequestParam(required = false, defaultValue = "true") boolean partnerStockOnly) throws Throwable {
1087
        List<FofoCatalogResponse> dealResponse = new ArrayList<>();
1073
        List<FofoCatalogResponse> dealResponse = new ArrayList<>();
Line 1185... Line 1171...
1185
        }
1171
        }
1186
        return dealResponse.stream().sorted(Comparator.comparing(FofoCatalogResponse::getItems, (s1, s2) -> (s2.get(0).isActive() ? 1 : 0) - (s1.get(0).isActive() ? 1 : 0)).thenComparing(FofoCatalogResponse::getItems, (x, y) -> y.get(0).getAvailability() - x.get(0).getAvailability())).collect(Collectors.toList());
1172
        return dealResponse.stream().sorted(Comparator.comparing(FofoCatalogResponse::getItems, (s1, s2) -> (s2.get(0).isActive() ? 1 : 0) - (s1.get(0).isActive() ? 1 : 0)).thenComparing(FofoCatalogResponse::getItems, (x, y) -> y.get(0).getAvailability() - x.get(0).getAvailability())).collect(Collectors.toList());
1187
    }
1173
    }
1188
 
1174
 
1189
    @GetMapping(value = "store/order-status/{pendingOrderId}")
1175
    @GetMapping(value = "store/order-status/{pendingOrderId}")
1190
    @Transactional(readOnly = true)
-
 
1191
    public ResponseEntity<?> orderStatus(HttpServletRequest request, @PathVariable int pendingOrderId) throws Exception {
1176
    public ResponseEntity<?> orderStatus(HttpServletRequest request, @PathVariable int pendingOrderId) throws Exception {
1192
        PendingOrder pendingOrder = pendingOrderRepository.selectById(pendingOrderId);
1177
        PendingOrder pendingOrder = pendingOrderRepository.selectById(pendingOrderId);
1193
        List<PendingOrderItem> pendingOrderItems = pendingOrderItemRepository.selectByOrderId(pendingOrder.getId());
1178
        List<PendingOrderItem> pendingOrderItems = pendingOrderItemRepository.selectByOrderId(pendingOrder.getId());
1194
        List<Integer> catalogIds = new ArrayList<>();
1179
        List<Integer> catalogIds = new ArrayList<>();
1195
        for (PendingOrderItem pendingOrderItem : pendingOrderItems) {
1180
        for (PendingOrderItem pendingOrderItem : pendingOrderItems) {
Line 1213... Line 1198...
1213
 
1198
 
1214
        return responseSender.ok(pendingOrder);
1199
        return responseSender.ok(pendingOrder);
1215
    }
1200
    }
1216
 
1201
 
1217
    @RequestMapping(value = "/store/addresses/{customerId}", method = RequestMethod.GET)
1202
    @RequestMapping(value = "/store/addresses/{customerId}", method = RequestMethod.GET)
1218
    @Transactional(readOnly = true)
-
 
1219
    public ResponseEntity<?> getAll(HttpServletRequest request, @PathVariable int customerId) throws Throwable {
1203
    public ResponseEntity<?> getAll(HttpServletRequest request, @PathVariable int customerId) throws Throwable {
1220
        return responseSender.ok(customerAddressRepository.selectByActiveCustomerId(customerId));
1204
        return responseSender.ok(customerAddressRepository.selectByActiveCustomerId(customerId));
1221
    }
1205
    }
1222
 
1206
 
1223
    @RequestMapping(value = "/store/address", method = RequestMethod.POST)
1207
    @RequestMapping(value = "/store/address", method = RequestMethod.POST)
Line 1327... Line 1311...
1327
        return responseSender.ok(true);
1311
        return responseSender.ok(true);
1328
 
1312
 
1329
    }
1313
    }
1330
 
1314
 
1331
    @RequestMapping(value = "/store/checkEligibilityStoreOffers", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
1315
    @RequestMapping(value = "/store/checkEligibilityStoreOffers", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
1332
    @Transactional(readOnly = true)
-
 
1333
    public ResponseEntity<?> checkEligibilityStoreOffers(HttpServletRequest request, @RequestParam(value = "id") int id) throws Exception {
1316
    public ResponseEntity<?> checkEligibilityStoreOffers(HttpServletRequest request, @RequestParam(value = "id") int id) throws Exception {
1334
 
1317
 
1335
        boolean eligibility = false;
1318
        boolean eligibility = false;
1336
 
1319
 
1337
        List<ScratchOffer> scratchOffers = scratchOfferRepository.selectBycCustomerIdAndDate(id, ProfitMandiConstants.SCRATCH_OFFER_START_DATE, ProfitMandiConstants.SCRATCH_OFFER_END_DATE);
1320
        List<ScratchOffer> scratchOffers = scratchOfferRepository.selectBycCustomerIdAndDate(id, ProfitMandiConstants.SCRATCH_OFFER_START_DATE, ProfitMandiConstants.SCRATCH_OFFER_END_DATE);
Line 1342... Line 1325...
1342
        }
1325
        }
1343
        return responseSender.ok(eligibility);
1326
        return responseSender.ok(eligibility);
1344
    }
1327
    }
1345
 
1328
 
1346
    @RequestMapping(value = "/store/ScratchOffers", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
1329
    @RequestMapping(value = "/store/ScratchOffers", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
1347
    @Transactional(readOnly = true)
-
 
1348
    public ResponseEntity<?> scratchOffers(HttpServletRequest request, @RequestParam(value = "id") int id) throws Exception {
1330
    public ResponseEntity<?> scratchOffers(HttpServletRequest request, @RequestParam(value = "id") int id) throws Exception {
1349
 
1331
 
1350
        List<ScratchOffer> scratchOffers = scratchOfferRepository.selectBycCustomerIdAndDate(id, ProfitMandiConstants.SCRATCH_OFFER_START_DATE, ProfitMandiConstants.SCRATCH_OFFER_END_DATE);
1332
        List<ScratchOffer> scratchOffers = scratchOfferRepository.selectBycCustomerIdAndDate(id, ProfitMandiConstants.SCRATCH_OFFER_START_DATE, ProfitMandiConstants.SCRATCH_OFFER_END_DATE);
1351
 
1333
 
1352
        logger.info("scratchOffers {}", scratchOffers);
1334
        logger.info("scratchOffers {}", scratchOffers);
Line 1377... Line 1359...
1377
 
1359
 
1378
        return responseSender.ok(true);
1360
        return responseSender.ok(true);
1379
    }
1361
    }
1380
 
1362
 
1381
    @RequestMapping(value = "/store/navbar", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
1363
    @RequestMapping(value = "/store/navbar", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
1382
    @Transactional(readOnly = true)
-
 
1383
    public ResponseEntity<?> navBars() throws Exception {
1364
    public ResponseEntity<?> navBars() throws Exception {
1384
        List<NavBar> navBars = navBarRepository.selectAllActive();
1365
        List<NavBar> navBars = navBarRepository.selectAllActive();
1385
        return responseSender.ok(navBars);
1366
        return responseSender.ok(navBars);
1386
    }
1367
    }
1387
 
1368
 
1388
 
1369
 
1389
    @RequestMapping(value = "/getMonthSale", method = RequestMethod.GET)
1370
    @RequestMapping(value = "/getMonthSale", method = RequestMethod.GET)
1390
    @Transactional(readOnly = true)
-
 
1391
    public ResponseEntity<?> getMonthsale(HttpServletRequest request) throws Exception {
1371
    public ResponseEntity<?> getMonthsale(HttpServletRequest request) throws Exception {
1392
        UserInfo userInfo = (UserInfo) request.getAttribute("userInfo");
1372
        UserInfo userInfo = (UserInfo) request.getAttribute("userInfo");
1393
        int fofoId = userInfo.getRetailerId();
1373
        int fofoId = userInfo.getRetailerId();
1394
        logger.info("getting the user resonse {} ",userInfo);
1374
        logger.info("getting the user resonse {} ",userInfo);
1395
        Map<String, MonthSaleModel> monthSaleMap = new HashMap<>();
1375
        Map<String, MonthSaleModel> monthSaleMap = new HashMap<>();
Line 1412... Line 1392...
1412
        logger.info("getting the month sale map {}",monthSaleMap);
1392
        logger.info("getting the month sale map {}",monthSaleMap);
1413
        return responseSender.ok(monthSaleMap);
1393
        return responseSender.ok(monthSaleMap);
1414
    }
1394
    }
1415
    @RequestMapping(value = "/getBrandwisePartnerSale", method = RequestMethod.GET)
1395
    @RequestMapping(value = "/getBrandwisePartnerSale", method = RequestMethod.GET)
1416
    @ResponseBody
1396
    @ResponseBody
1417
    @Transactional(readOnly = true)
-
 
1418
    public ResponseEntity<?> getBrandwisePartnerSale(HttpServletRequest request, @RequestParam(name = "month", required = true, defaultValue = "0") int month, Model model) throws Exception {
1397
    public ResponseEntity<?> getBrandwisePartnerSale(HttpServletRequest request, @RequestParam(name = "month", required = true, defaultValue = "0") int month, Model model) throws Exception {
1419
        UserInfo userInfo = (UserInfo) request.getAttribute("userInfo");
1398
        UserInfo userInfo = (UserInfo) request.getAttribute("userInfo");
1420
        int fofoId = userInfo.getRetailerId();
1399
        int fofoId = userInfo.getRetailerId();
1421
        List<BrandWisePartnerSaleModel> brandWisePartnerSaleModels = fofoStoreRepository.selectBrandWiseMonthlyPartnerSale(Collections.singletonList(fofoId), month);
1400
        List<BrandWisePartnerSaleModel> brandWisePartnerSaleModels = fofoStoreRepository.selectBrandWiseMonthlyPartnerSale(Collections.singletonList(fofoId), month);
1422
        List<Map<String, Object>> response = new ArrayList<>();
1401
        List<Map<String, Object>> response = new ArrayList<>();
Line 1435... Line 1414...
1435
        logger.info("brandItemWisePartnerSaleModels {}", response);
1414
        logger.info("brandItemWisePartnerSaleModels {}", response);
1436
        return responseSender.ok(response);
1415
        return responseSender.ok(response);
1437
    }
1416
    }
1438
    @RequestMapping(value = "/getBrandItemwisePartnerSale", method = RequestMethod.GET)
1417
    @RequestMapping(value = "/getBrandItemwisePartnerSale", method = RequestMethod.GET)
1439
    @ResponseBody
1418
    @ResponseBody
1440
    @Transactional(readOnly = true)
-
 
1441
    public ResponseEntity<?> getBrandItemwisePartnerSale(HttpServletRequest request, @RequestParam(name = "month", required = true, defaultValue = "0") int month, @RequestParam(name = "brand") String brand) throws Exception {
1419
    public ResponseEntity<?> getBrandItemwisePartnerSale(HttpServletRequest request, @RequestParam(name = "month", required = true, defaultValue = "0") int month, @RequestParam(name = "brand") String brand) throws Exception {
1442
        UserInfo userInfo = (UserInfo) request.getAttribute("userInfo");
1420
        UserInfo userInfo = (UserInfo) request.getAttribute("userInfo");
1443
        int fofoId = userInfo.getRetailerId();
1421
        int fofoId = userInfo.getRetailerId();
1444
        List<BrandItemWisePartnerSaleModel> brandItemWisePartnerSaleModels = fofoStoreRepository.selectPartnerBrandItemMonthlySale(Collections.singletonList(fofoId), month, brand);
1422
        List<BrandItemWisePartnerSaleModel> brandItemWisePartnerSaleModels = fofoStoreRepository.selectPartnerBrandItemMonthlySale(Collections.singletonList(fofoId), month, brand);
1445
        logger.info("getting brandwise item sale {}",brandItemWisePartnerSaleModels);
1423
        logger.info("getting brandwise item sale {}",brandItemWisePartnerSaleModels);
1446
        return responseSender.ok(brandItemWisePartnerSaleModels);
1424
        return responseSender.ok(brandItemWisePartnerSaleModels);
1447
    }
1425
    }
1448
 
1426
 
1449
 
1427
 
1450
    @RequestMapping(value = "/store/clearance", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
1428
    @RequestMapping(value = "/store/clearance", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
1451
    @Transactional(readOnly = true)
-
 
1452
    public ResponseEntity<?> getLiquidations() throws Exception {
1429
    public ResponseEntity<?> getLiquidations() throws Exception {
1453
        List<Integer> catalogIds = new ArrayList<>();
1430
        List<Integer> catalogIds = new ArrayList<>();
1454
        Map<Integer, JSONObject> contentMap = null;
1431
        Map<Integer, JSONObject> contentMap = null;
1455
        List<Liquidation> liquidations = liquidationRepository.selectAllByStatus(ProfitMandiConstants.LIQUIDATION_ENUM.PUBLISHED);
1432
        List<Liquidation> liquidations = liquidationRepository.selectAllByStatus(ProfitMandiConstants.LIQUIDATION_ENUM.PUBLISHED);
1456
 
1433