Subversion Repositories SmartDukaan

Rev

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

Rev 28653 Rev 29261
Line 14... Line 14...
14
import org.apache.logging.log4j.Logger;
14
import org.apache.logging.log4j.Logger;
15
import org.springframework.beans.factory.annotation.Autowired;
15
import org.springframework.beans.factory.annotation.Autowired;
16
import org.springframework.stereotype.Component;
16
import org.springframework.stereotype.Component;
17
 
17
 
18
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
18
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
-
 
19
import com.spice.profitmandi.common.model.ProfitMandiConstants;
19
import com.spice.profitmandi.dao.entity.catalog.Item;
20
import com.spice.profitmandi.dao.entity.catalog.Item;
20
import com.spice.profitmandi.dao.entity.catalog.TagListing;
21
import com.spice.profitmandi.dao.entity.catalog.TagListing;
21
import com.spice.profitmandi.dao.entity.user.Cart;
22
import com.spice.profitmandi.dao.entity.user.Cart;
22
import com.spice.profitmandi.dao.entity.user.CartLine;
23
import com.spice.profitmandi.dao.entity.user.CartLine;
23
import com.spice.profitmandi.dao.entity.user.User;
24
import com.spice.profitmandi.dao.entity.user.User;
Line 64... Line 65...
64
 
65
 
65
	@Autowired
66
	@Autowired
66
	CurrentInventorySnapshotRepository currentInventorySnapshotRepository;
67
	CurrentInventorySnapshotRepository currentInventorySnapshotRepository;
67
 
68
 
68
	@Override
69
	@Override
-
 
70
	//Unused method
69
	public CartModel addToCart(int cartId, int itemId, int quantity, float sellingPrice) {
71
	public CartModel addToCart(int cartId, int itemId, int quantity, float sellingPrice) {
70
		CartLine cartItem = cartLineRepository.selectByCartItem(cartId, itemId);
72
		CartLine cartItem = cartLineRepository.selectByCartItem(cartId, itemId);
71
		if (cartItem == null) {
73
		if (cartItem == null) {
72
			this.createCartItem(cartId, itemId, quantity, sellingPrice);
74
			this.createCartItem(cartId, itemId, quantity, sellingPrice);
73
		} else {
75
		} else {
74
			cartItem.setQuantity(quantity);
76
			cartItem.setQuantity(quantity);
75
			cartItem.setActualPrice(sellingPrice);
77
			cartItem.setActualPrice(sellingPrice);
76
		}
78
		}
77
		return null;
79
		return null;
78
	}
80
	}
79
 
81
	
80
	private void createCartItem(int cartId, int itemId, int quantity, float sellingPrice) {
82
	private void createCartItem(int cartId, int itemId, int quantity, float sellingPrice) {
81
		CartLine cartLine = new CartLine();
83
		CartLine cartLine = new CartLine();
82
		cartLine.setActualPrice(sellingPrice);
84
		cartLine.setActualPrice(sellingPrice);
83
		cartLine.setCartId(cartId);
85
		cartLine.setCartId(cartId);
84
		cartLine.setQuantity(quantity);
86
		cartLine.setQuantity(quantity);
Line 304... Line 306...
304
	}
306
	}
305
 
307
 
306
	@Override
308
	@Override
307
	public void addShoppingBag(int cartId, long qty) {
309
	public void addShoppingBag(int cartId, long qty) {
308
		CartLine cl = new CartLine();
310
		CartLine cl = new CartLine();
309
		cl.setItemId(32046);
311
		cl.setItemId(ProfitMandiConstants.ITEM_CARRY_BAG);
310
		cl.setQuantity((int) qty);
312
		cl.setQuantity((int) qty);
311
		cl.setCartId(cartId);
313
		cl.setCartId(cartId);
312
		cl.setCreateTimestamp(LocalDateTime.now());
314
		cl.setCreateTimestamp(LocalDateTime.now());
313
		cl.setDataProtectionAmount(0);
315
		cl.setDataProtectionAmount(0);
314
		cl.setEstimate(0);
316
		cl.setEstimate(0);
315
		cl.setInsuranceAmount((float) 0);
317
		cl.setInsuranceAmount(0f);
316
		cl.setDataProtectionInsurer(0);
318
		cl.setDataProtectionInsurer(0);
317
		cl.setActualPrice((float) 0.01 * qty);
319
		cl.setActualPrice(0.01f);
318
		cartLineRepository.persist(cl);
320
		cartLineRepository.persist(cl);
319
 
321
 
320
	}
322
	}
321
 
323
 
322
	@Override
324
	@Override