Subversion Repositories SmartDukaan

Rev

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

Rev 23203 Rev 23298
Line 33... Line 33...
33
import com.spice.profitmandi.common.model.CreateOrderRequest;
33
import com.spice.profitmandi.common.model.CreateOrderRequest;
34
import com.spice.profitmandi.common.model.PdfModel;
34
import com.spice.profitmandi.common.model.PdfModel;
35
import com.spice.profitmandi.common.model.PriceModel;
35
import com.spice.profitmandi.common.model.PriceModel;
36
import com.spice.profitmandi.common.model.ProfitMandiConstants;
36
import com.spice.profitmandi.common.model.ProfitMandiConstants;
37
import com.spice.profitmandi.common.util.PdfUtils;
37
import com.spice.profitmandi.common.util.PdfUtils;
-
 
38
import com.spice.profitmandi.common.util.Utils;
38
import com.spice.profitmandi.common.web.util.ResponseSender;
39
import com.spice.profitmandi.common.web.util.ResponseSender;
39
import com.spice.profitmandi.dao.entity.dtr.InsurancePolicy;
40
import com.spice.profitmandi.dao.entity.dtr.InsurancePolicy;
-
 
41
import com.spice.profitmandi.dao.entity.dtr.RetailerRegisteredAddress;
40
import com.spice.profitmandi.dao.entity.fofo.Customer;
42
import com.spice.profitmandi.dao.entity.fofo.Customer;
41
import com.spice.profitmandi.dao.entity.fofo.CustomerAddress;
43
import com.spice.profitmandi.dao.entity.fofo.CustomerAddress;
42
import com.spice.profitmandi.dao.entity.fofo.FofoOrder;
44
import com.spice.profitmandi.dao.entity.fofo.FofoOrder;
43
import com.spice.profitmandi.dao.entity.fofo.FofoOrderItem;
45
import com.spice.profitmandi.dao.entity.fofo.FofoOrderItem;
44
import com.spice.profitmandi.dao.entity.fofo.PaymentOption;
46
import com.spice.profitmandi.dao.entity.fofo.PaymentOption;
-
 
47
import com.spice.profitmandi.dao.entity.user.Address;
45
import com.spice.profitmandi.dao.repository.dtr.InsurancePolicyRepository;
48
import com.spice.profitmandi.dao.repository.dtr.InsurancePolicyRepository;
-
 
49
import com.spice.profitmandi.dao.repository.dtr.RetailerRegisteredAddressRepository;
46
import com.spice.profitmandi.dao.repository.fofo.CustomerAddressRepository;
50
import com.spice.profitmandi.dao.repository.fofo.CustomerAddressRepository;
47
import com.spice.profitmandi.dao.repository.fofo.CustomerRepository;
51
import com.spice.profitmandi.dao.repository.fofo.CustomerRepository;
48
import com.spice.profitmandi.dao.repository.fofo.FofoOrderItemRepository;
52
import com.spice.profitmandi.dao.repository.fofo.FofoOrderItemRepository;
49
import com.spice.profitmandi.dao.repository.fofo.FofoOrderRepository;
53
import com.spice.profitmandi.dao.repository.fofo.FofoOrderRepository;
50
import com.spice.profitmandi.dao.repository.fofo.PaymentOptionRepository;
54
import com.spice.profitmandi.dao.repository.fofo.PaymentOptionRepository;
-
 
55
import com.spice.profitmandi.dao.repository.user.AddressRepository;
51
import com.spice.profitmandi.service.inventory.OrderService;
56
import com.spice.profitmandi.service.inventory.OrderService;
52
import com.spice.profitmandi.service.pricing.PricingService;
57
import com.spice.profitmandi.service.pricing.PricingService;
53
import com.spice.profitmandi.web.model.LoginDetails;
58
import com.spice.profitmandi.web.model.LoginDetails;
54
import com.spice.profitmandi.web.util.CookiesProcessor;
59
import com.spice.profitmandi.web.util.CookiesProcessor;
55
 
60
 
Line 84... Line 89...
84
	private PricingService pricingService;
89
	private PricingService pricingService;
85
	
90
	
86
	@Autowired
91
	@Autowired
87
	private OrderService orderService;
92
	private OrderService orderService;
88
	
93
	
-
 
94
	@Autowired
-
 
95
	private RetailerRegisteredAddressRepository retailerRegisteredAddressRepository;
-
 
96
	
-
 
97
	@Autowired
-
 
98
	private AddressRepository addressRepository;
89
	
99
	
90
	@Autowired
100
	@Autowired
91
	private ResponseSender<?> responseSender;
101
	private ResponseSender<?> responseSender;
92
	
102
	
93
	@RequestMapping(value = "/order")
103
	@RequestMapping(value = "/order")
94
	public String orderIndex(HttpServletRequest request, @RequestParam(name = "cartData") String cartData, Model model) throws ProfitMandiBusinessException{
104
	public String orderIndex(HttpServletRequest request, @RequestParam(name = "cartData") String cartData, Model model) throws ProfitMandiBusinessException{
95
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);;
105
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);;
96
		
106
		
-
 
107
		int addressId = retailerRegisteredAddressRepository.selectAddressIdByRetailerId(loginDetails.getFofoId());
-
 
108
		Address address = addressRepository.selectById(addressId);
-
 
109
		
97
		List<CartFofo> cartItems = orderService.cartCheckout(cartData);
110
		List<CartFofo> cartItems = orderService.cartCheckout(cartData);
98
		Set<Integer> itemIds = new HashSet<>();
111
		Set<Integer> itemIds = new HashSet<>();
99
		for(CartFofo cartFofo : cartItems){
112
		for(CartFofo cartFofo : cartItems){
100
			itemIds.add(cartFofo.getItemId());
113
			itemIds.add(cartFofo.getItemId());
101
		}
114
		}
102
		Map<Integer, PriceModel> mopPriceMap = pricingService.getPurchasePriceMopPriceNotFound(itemIds, loginDetails.getFofoId());
115
		Map<Integer, PriceModel> mopPriceMap = pricingService.getPurchasePriceMopPriceNotFound(itemIds, loginDetails.getFofoId());
103
		LOGGER.info("mopPriceMap {}", mopPriceMap);
116
		LOGGER.info("mopPriceMap {}", mopPriceMap);
-
 
117
		model.addAttribute("stateNames", Utils.getAllStateNames());
-
 
118
		model.addAttribute("retailerStateName", address.getState());
104
		model.addAttribute("cartObj", cartItems);
119
		model.addAttribute("cartObj", cartItems);
105
		model.addAttribute("mopPriceMap", mopPriceMap);
120
		model.addAttribute("mopPriceMap", mopPriceMap);
106
		return "order-index";
121
		return "order-index";
107
	}
122
	}
108
	
123