Subversion Repositories SmartDukaan

Rev

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

Rev 34899 Rev 34902
Line 5... Line 5...
5
import com.google.gson.reflect.TypeToken;
5
import com.google.gson.reflect.TypeToken;
6
import com.spice.profitmandi.common.enumuration.MessageType;
6
import com.spice.profitmandi.common.enumuration.MessageType;
7
import com.spice.profitmandi.common.enumuration.SchemeType;
7
import com.spice.profitmandi.common.enumuration.SchemeType;
8
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
8
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
9
import com.spice.profitmandi.common.model.*;
9
import com.spice.profitmandi.common.model.*;
-
 
10
import com.spice.profitmandi.dao.entity.affiliate.AffiliateLinks;
-
 
11
import com.spice.profitmandi.dao.entity.affiliate.AffiliateProduct;
10
import com.spice.profitmandi.dao.entity.catalog.LiquidationDetail;
12
import com.spice.profitmandi.dao.entity.catalog.LiquidationDetail;
11
import com.spice.profitmandi.common.solr.SolrService;
13
import com.spice.profitmandi.common.solr.SolrService;
12
import com.spice.profitmandi.common.util.FormattingUtils;
14
import com.spice.profitmandi.common.util.FormattingUtils;
13
import com.spice.profitmandi.common.util.PdfUtils;
15
import com.spice.profitmandi.common.util.PdfUtils;
14
import com.spice.profitmandi.common.util.Utils;
16
import com.spice.profitmandi.common.util.Utils;
Line 26... Line 28...
26
import com.spice.profitmandi.dao.enumuration.dtr.OtpType;
28
import com.spice.profitmandi.dao.enumuration.dtr.OtpType;
27
import com.spice.profitmandi.dao.enumuration.dtr.WebListingSource;
29
import com.spice.profitmandi.dao.enumuration.dtr.WebListingSource;
28
import com.spice.profitmandi.dao.enumuration.transaction.OrderStatus;
30
import com.spice.profitmandi.dao.enumuration.transaction.OrderStatus;
29
import com.spice.profitmandi.dao.model.*;
31
import com.spice.profitmandi.dao.model.*;
30
import com.spice.profitmandi.dao.model.pendingOrder.PendingOrderDetail;
32
import com.spice.profitmandi.dao.model.pendingOrder.PendingOrderDetail;
-
 
33
import com.spice.profitmandi.dao.repository.affiliateLink.AffiliateLinkRepository;
31
import com.spice.profitmandi.dao.repository.catalog.BidRepository;
34
import com.spice.profitmandi.dao.repository.catalog.BidRepository;
32
import com.spice.profitmandi.dao.repository.catalog.ItemRepository;
35
import com.spice.profitmandi.dao.repository.catalog.ItemRepository;
33
import com.spice.profitmandi.dao.repository.catalog.LiquidationRepository;
36
import com.spice.profitmandi.dao.repository.catalog.LiquidationRepository;
34
import com.spice.profitmandi.dao.repository.catalog.TagListingRepository;
37
import com.spice.profitmandi.dao.repository.catalog.TagListingRepository;
35
import com.spice.profitmandi.dao.repository.cs.CsService;
38
import com.spice.profitmandi.dao.repository.cs.CsService;
Line 235... Line 238...
235
    BidService bidService;
238
    BidService bidService;
236
 
239
 
237
    @Autowired
240
    @Autowired
238
    WalletService walletService;
241
    WalletService walletService;
239
 
242
 
-
 
243
    @Autowired
-
 
244
    AffiliateLinkRepository affiliateLinkRepository;
-
 
245
 
240
    List<String> filterableParams = Arrays.asList("brand");
246
    List<String> filterableParams = Arrays.asList("brand");
241
 
247
 
242
    @RequestMapping(value = "/store/entity/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
248
    @RequestMapping(value = "/store/entity/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
243
    @ApiImplicitParams({@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
249
    @ApiImplicitParams({@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
244
    @ApiOperation(value = "Get unit deal object")
250
    @ApiOperation(value = "Get unit deal object")
Line 466... Line 472...
466
        pendingOrderItems.stream().forEach(x -> {
472
        pendingOrderItems.stream().forEach(x -> {
467
            CartItem ci = new CartItem();
473
            CartItem ci = new CartItem();
468
            ci.setItemId(x.getItemId());
474
            ci.setItemId(x.getItemId());
469
            ci.setQuantity(x.getQuantity());
475
            ci.setQuantity(x.getQuantity());
470
            ci.setSellingPrice(x.getSellingPrice());
476
            ci.setSellingPrice(x.getSellingPrice());
-
 
477
            ci.setSmartSellerId(x.getSmartSellerId());
471
            ci.setPendingOrderItemPolicyPlan(x.getPendingOrderItemPolicyPlan());
478
            ci.setPendingOrderItemPolicyPlan(x.getPendingOrderItemPolicyPlan());
472
            cartItems.add(ci);
479
            cartItems.add(ci);
473
        });
480
        });
474
        logger.info("cartItems {}", cartItems);
481
        logger.info("cartItems {}", cartItems);
475
        CartResponse cr = this.validateCart(storeId, cartItems);
482
        CartResponse cr = this.validateCart(storeId, cartItems);
Line 538... Line 545...
538
            sendNotificationModel.setCampaignName("Online Order Alert");
545
            sendNotificationModel.setCampaignName("Online Order Alert");
539
            sendNotificationModel.setTitle("Online Order Update");
546
            sendNotificationModel.setTitle("Online Order Update");
540
            sendNotificationModel.setMessage(String.format(
547
            sendNotificationModel.setMessage(String.format(
541
                    "You have new Online Order. Please check your Dashboard. In case of an activation scheme pls ensure the handset is activated, payout will be processed as per brand's activation report."));
548
                    "You have new Online Order. Please check your Dashboard. In case of an activation scheme pls ensure the handset is activated, payout will be processed as per brand's activation report."));
542
            sendNotificationModel.setType("url");
549
            sendNotificationModel.setType("url");
543
            sendNotificationModel.setUrl("https://app.smartdukaan.com/pages/home/notifications");
550
            sendNotificationModel.setUrl("https://smartdukaan.com/pages/home/notifications");
544
            sendNotificationModel.setExpiresat(LocalDateTime.now().plusDays(1));
551
            sendNotificationModel.setExpiresat(LocalDateTime.now().plusDays(1));
545
            sendNotificationModel.setMessageType(MessageType.notification);
552
            sendNotificationModel.setMessageType(MessageType.notification);
546
            int userId = userAccountRepository.selectUserIdByRetailerId(pendingOrder.getFofoId());
553
            int userId = userAccountRepository.selectUserIdByRetailerId(pendingOrder.getFofoId());
547
            sendNotificationModel.setUserIds(Arrays.asList(userId));
554
            sendNotificationModel.setUserIds(Arrays.asList(userId));
548
            notificationService.sendNotification(sendNotificationModel);
555
            notificationService.sendNotification(sendNotificationModel);
Line 550... Line 557...
550
            SendNotificationModel snm = new SendNotificationModel();
557
            SendNotificationModel snm = new SendNotificationModel();
551
            snm.setCampaignName("Online Order Alert");
558
            snm.setCampaignName("Online Order Alert");
552
            snm.setTitle("Online Order Update");
559
            snm.setTitle("Online Order Update");
553
            snm.setMessage(String.format("Your Partner " + customRetailer.getBusinessName() + " have new Online Order. Please inform your partner. In case of an activation scheme pls ensure the handset is activated, payout will be processed as per brand's activation report."));
560
            snm.setMessage(String.format("Your Partner " + customRetailer.getBusinessName() + " have new Online Order. Please inform your partner. In case of an activation scheme pls ensure the handset is activated, payout will be processed as per brand's activation report."));
554
            snm.setType("url");
561
            snm.setType("url");
555
            snm.setUrl("https://app.smartdukaan.com/pages/home/notifications");
562
            snm.setUrl("https://smartdukaan.com/pages/home/notifications");
556
            snm.setExpiresat(LocalDateTime.now().plusDays(1));
563
            snm.setExpiresat(LocalDateTime.now().plusDays(1));
557
            snm.setMessageType(MessageType.notification);
564
            snm.setMessageType(MessageType.notification);
558
            snm.setUserIds(userIds);
565
            snm.setUserIds(userIds);
559
            notificationService.sendNotification(snm);
566
            notificationService.sendNotification(snm);
560
 
567
 
Line 889... Line 896...
889
    @RequestMapping(value = "/store/cart", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
896
    @RequestMapping(value = "/store/cart", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
890
    @ApiImplicitParams({@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
897
    @ApiImplicitParams({@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
891
    @ApiOperation(value = "Get brand list and count for category")
898
    @ApiOperation(value = "Get brand list and count for category")
892
    public ResponseEntity<?> cart(HttpServletRequest request, @RequestBody AddCartRequest cartRequest) throws Exception {
899
    public ResponseEntity<?> cart(HttpServletRequest request, @RequestBody AddCartRequest cartRequest) throws Exception {
893
        UserInfo userInfo = (UserInfo) request.getAttribute("userInfo");
900
        UserInfo userInfo = (UserInfo) request.getAttribute("userInfo");
-
 
901
        logger.info("cartRequest: {}",cartRequest);
894
        Integer storeId = userInfo.getRetailerId();
902
        Integer storeId = userInfo.getRetailerId();
895
        ValidateCartResponse vc = new ValidateCartResponse(this.validateCart(storeId, cartRequest.getCartItems()), "Success", "Items added to cart successfully");
903
        ValidateCartResponse vc = new ValidateCartResponse(this.validateCart(storeId, cartRequest.getCartItems()), "Success", "Items added to cart successfully");
896
        return responseSender.ok(vc);
904
        return responseSender.ok(vc);
897
    }
905
    }
898
 
906
 
Line 984... Line 992...
984
            if (cartItem.getPendingOrderItemPolicyPlan() != null) {
992
            if (cartItem.getPendingOrderItemPolicyPlan() != null) {
985
                totalAmount += qtyRequired * itemSellingPrice + qtyRequired * cartItem.getPendingOrderItemPolicyPlan().getPrice();
993
                totalAmount += qtyRequired * itemSellingPrice + qtyRequired * cartItem.getPendingOrderItemPolicyPlan().getPrice();
986
            } else {
994
            } else {
987
                totalAmount += qtyRequired * itemSellingPrice;
995
                totalAmount += qtyRequired * itemSellingPrice;
988
            }
996
            }
-
 
997
            AffiliateProduct product = affiliateLinkRepository.findByCode(cartItem.getSmartSellerId());
-
 
998
 
-
 
999
            logger.info("product ===: {}", product);
-
 
1000
 
-
 
1001
            if (product != null && !product.getExpiryDate().isBefore(LocalDateTime.now())) {
-
 
1002
                cartItemResponseModel.setSmartSellerId(cartItem.getSmartSellerId());
-
 
1003
            }
989
 
1004
 
990
            cartItemResponseModel.setEstimate(estimate);
1005
            cartItemResponseModel.setEstimate(estimate);
991
            cartItemResponseModel.setTitle(item.getItemDescriptionNoColor());
1006
            cartItemResponseModel.setTitle(item.getItemDescriptionNoColor());
992
            cartItemResponseModel.setItemId(cartItem.getItemId());
1007
            cartItemResponseModel.setItemId(cartItem.getItemId());
993
            cartItemResponseModel.setMinBuyQuantity(1);
1008
            cartItemResponseModel.setMinBuyQuantity(1);
994
            cartItemResponseModel.setQuantity(qtyRequired);
1009
            cartItemResponseModel.setQuantity(qtyRequired);
995
            cartItemResponseModel.setCategoryId(item.getCategoryId());
1010
            cartItemResponseModel.setCategoryId(item.getCategoryId());
996
            cartItemResponseModel.setSmartSellerId(cartItem.getSmartSellerId());
-
 
997
            cartItemResponseModel.setQuantityStep(1);
1011
            cartItemResponseModel.setQuantityStep(1);
998
            cartItemResponseModel.setPromiseDelivery(promiseDeliveryTime);
1012
            cartItemResponseModel.setPromiseDelivery(promiseDeliveryTime);
999
            cartItemResponseModel.setMaxQuantity(availabilityModel.getMaxAvailability());
1013
            cartItemResponseModel.setMaxQuantity(availabilityModel.getMaxAvailability());
1000
            cartItemResponseModel.setCatalogItemId(item.getCatalogItemId());
1014
            cartItemResponseModel.setCatalogItemId(item.getCatalogItemId());
1001
            cartItemResponseModel.setImageUrl(contentMap.get(item.getCatalogItemId()).getString("imageUrl_s"));
1015
            cartItemResponseModel.setImageUrl(contentMap.get(item.getCatalogItemId()).getString("imageUrl_s"));