Subversion Repositories SmartDukaan

Rev

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

Rev 31792 Rev 32493
Line 1... Line 1...
1
package com.spice.profitmandi.dao.cart;
1
package com.spice.profitmandi.dao.cart;
2
 
2
 
3
import java.time.LocalDateTime;
-
 
4
import java.util.ArrayList;
-
 
5
import java.util.Arrays;
-
 
6
import java.util.Collections;
-
 
7
import java.util.HashMap;
-
 
8
import java.util.HashSet;
-
 
9
import java.util.LinkedHashMap;
-
 
10
import java.util.List;
-
 
11
import java.util.Map;
-
 
12
import java.util.Set;
-
 
13
import java.util.Map.Entry;
-
 
14
import java.util.stream.Collectors;
-
 
15
 
-
 
16
import com.spice.profitmandi.dao.entity.inventory.SaholicCISTable;
-
 
17
import com.spice.profitmandi.dao.repository.inventory.SaholicCISTableRepository;
-
 
18
import com.spice.profitmandi.dao.repository.warehouse.BrandRegionMappingRepository;
-
 
19
import org.apache.logging.log4j.LogManager;
-
 
20
import org.apache.logging.log4j.Logger;
-
 
21
import org.springframework.beans.factory.annotation.Autowired;
-
 
22
import org.springframework.stereotype.Component;
-
 
23
 
-
 
24
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
3
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
25
import com.spice.profitmandi.common.model.ProfitMandiConstants;
4
import com.spice.profitmandi.common.model.ProfitMandiConstants;
26
import com.spice.profitmandi.dao.entity.catalog.Item;
5
import com.spice.profitmandi.dao.entity.catalog.Item;
27
import com.spice.profitmandi.dao.entity.catalog.TagListing;
6
import com.spice.profitmandi.dao.entity.catalog.TagListing;
28
import com.spice.profitmandi.dao.entity.cs.PartnerRegion;
7
import com.spice.profitmandi.dao.entity.cs.PartnerRegion;
29
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
8
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
-
 
9
import com.spice.profitmandi.dao.entity.inventory.SaholicCISTable;
30
import com.spice.profitmandi.dao.entity.user.Cart;
10
import com.spice.profitmandi.dao.entity.user.Cart;
31
import com.spice.profitmandi.dao.entity.user.CartLine;
11
import com.spice.profitmandi.dao.entity.user.CartLine;
32
import com.spice.profitmandi.dao.entity.user.User;
12
import com.spice.profitmandi.dao.entity.user.User;
33
import com.spice.profitmandi.dao.model.CartItem;
13
import com.spice.profitmandi.dao.model.CartItem;
34
import com.spice.profitmandi.dao.model.CartItemResponseModel;
14
import com.spice.profitmandi.dao.model.CartItemResponseModel;
Line 39... Line 19...
39
import com.spice.profitmandi.dao.repository.catalog.TagListingRepository;
19
import com.spice.profitmandi.dao.repository.catalog.TagListingRepository;
40
import com.spice.profitmandi.dao.repository.cs.PartnerRegionRepository;
20
import com.spice.profitmandi.dao.repository.cs.PartnerRegionRepository;
41
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
21
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
42
import com.spice.profitmandi.dao.repository.dtr.RetailerBlockBrandsRepository;
22
import com.spice.profitmandi.dao.repository.dtr.RetailerBlockBrandsRepository;
43
import com.spice.profitmandi.dao.repository.fofo.CurrentInventorySnapshotRepository;
23
import com.spice.profitmandi.dao.repository.fofo.CurrentInventorySnapshotRepository;
-
 
24
import com.spice.profitmandi.dao.repository.inventory.SaholicCISTableRepository;
44
import com.spice.profitmandi.dao.repository.transaction.OrderRepository;
25
import com.spice.profitmandi.dao.repository.transaction.OrderRepository;
45
import com.spice.profitmandi.dao.repository.user.CartLineRepository;
26
import com.spice.profitmandi.dao.repository.user.CartLineRepository;
46
import com.spice.profitmandi.dao.repository.user.CartRepository;
27
import com.spice.profitmandi.dao.repository.user.CartRepository;
47
import com.spice.profitmandi.dao.repository.user.UserRepository;
28
import com.spice.profitmandi.dao.repository.user.UserRepository;
-
 
29
import com.spice.profitmandi.dao.repository.warehouse.BrandRegionMappingRepository;
48
import com.spice.profitmandi.service.NotificationService;
30
import com.spice.profitmandi.service.NotificationService;
49
import com.spice.profitmandi.service.inventory.FocusedShortageModel;
31
import com.spice.profitmandi.service.inventory.FocusedShortageModel;
50
import com.spice.profitmandi.service.inventory.SaholicInventoryService;
32
import com.spice.profitmandi.service.inventory.SaholicInventoryService;
51
import com.spice.profitmandi.service.transaction.TransactionService;
33
import com.spice.profitmandi.service.transaction.TransactionService;
-
 
34
import org.apache.logging.log4j.LogManager;
-
 
35
import org.apache.logging.log4j.Logger;
-
 
36
import org.springframework.beans.factory.annotation.Autowired;
-
 
37
import org.springframework.stereotype.Component;
-
 
38
 
-
 
39
import java.time.LocalDateTime;
-
 
40
import java.util.*;
-
 
41
import java.util.Map.Entry;
-
 
42
import java.util.stream.Collectors;
52
 
43
 
53
@Component
44
@Component
54
public class CartServiceImpl implements CartService {
45
public class CartServiceImpl implements CartService {
55
 
46
 
56
    private static final Set<Integer> tagIds = new HashSet<>(Arrays.asList(4));
47
    private static final Set<Integer> tagIds = new HashSet<>(Arrays.asList(4));
Line 313... Line 304...
313
            if (!itemCartLineMap.containsKey(cartItem.getItemId())) {
304
            if (!itemCartLineMap.containsKey(cartItem.getItemId())) {
314
                CartLine cartLineNew = new CartLine();
305
                CartLine cartLineNew = new CartLine();
315
                cartLineNew.setItemId(cartItem.getItemId());
306
                cartLineNew.setItemId(cartItem.getItemId());
316
                cartLineNew.setQuantity(cartItem.getQuantity());
307
                cartLineNew.setQuantity(cartItem.getQuantity());
317
                cartLineNew.setCartId(cartId);
308
                cartLineNew.setCartId(cartId);
-
 
309
                cartLineNew.setActualPrice((float) cartItem.getSellingPrice());
318
                cartLineNew.setCreateTimestamp(LocalDateTime.now());
310
                cartLineNew.setCreateTimestamp(LocalDateTime.now());
319
                cartLineRepository.persist(cartLineNew);
311
                cartLineRepository.persist(cartLineNew);
320
            }
312
            }
321
        }
313
        }
322
 
314