Subversion Repositories SmartDukaan

Rev

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

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