| 21612 |
ashik.ali |
1 |
package com.spice.profitmandi.web.controller;
|
|
|
2 |
|
| 21689 |
ashik.ali |
3 |
import java.io.ByteArrayInputStream;
|
|
|
4 |
import java.io.ByteArrayOutputStream;
|
|
|
5 |
import java.io.InputStream;
|
| 23343 |
ashik.ali |
6 |
import java.util.HashMap;
|
| 21612 |
ashik.ali |
7 |
import java.util.HashSet;
|
| 21680 |
ashik.ali |
8 |
import java.util.List;
|
|
|
9 |
import java.util.Map;
|
| 21612 |
ashik.ali |
10 |
import java.util.Set;
|
|
|
11 |
|
|
|
12 |
import javax.servlet.http.HttpServletRequest;
|
| 21689 |
ashik.ali |
13 |
import javax.servlet.http.HttpServletResponse;
|
| 21612 |
ashik.ali |
14 |
|
|
|
15 |
import org.slf4j.Logger;
|
|
|
16 |
import org.slf4j.LoggerFactory;
|
|
|
17 |
import org.springframework.beans.factory.annotation.Autowired;
|
| 21689 |
ashik.ali |
18 |
import org.springframework.core.io.InputStreamResource;
|
|
|
19 |
import org.springframework.http.HttpHeaders;
|
|
|
20 |
import org.springframework.http.HttpStatus;
|
|
|
21 |
import org.springframework.http.MediaType;
|
|
|
22 |
import org.springframework.http.ResponseEntity;
|
| 21612 |
ashik.ali |
23 |
import org.springframework.stereotype.Controller;
|
| 22064 |
ashik.ali |
24 |
import org.springframework.transaction.annotation.Transactional;
|
| 21985 |
kshitij.so |
25 |
import org.springframework.ui.Model;
|
| 21612 |
ashik.ali |
26 |
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
27 |
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
28 |
import org.springframework.web.bind.annotation.RequestMethod;
|
| 21689 |
ashik.ali |
29 |
import org.springframework.web.bind.annotation.RequestParam;
|
| 21612 |
ashik.ali |
30 |
|
| 23203 |
ashik.ali |
31 |
import com.spice.profitmandi.common.enumuration.SearchType;
|
| 21612 |
ashik.ali |
32 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| 21985 |
kshitij.so |
33 |
import com.spice.profitmandi.common.model.CartFofo;
|
| 22860 |
ashik.ali |
34 |
import com.spice.profitmandi.common.model.CreateOrderRequest;
|
| 22660 |
ashik.ali |
35 |
import com.spice.profitmandi.common.model.PdfModel;
|
| 22581 |
ashik.ali |
36 |
import com.spice.profitmandi.common.model.PriceModel;
|
| 21612 |
ashik.ali |
37 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
| 21689 |
ashik.ali |
38 |
import com.spice.profitmandi.common.util.PdfUtils;
|
| 23298 |
ashik.ali |
39 |
import com.spice.profitmandi.common.util.Utils;
|
| 22244 |
ashik.ali |
40 |
import com.spice.profitmandi.common.web.util.ResponseSender;
|
| 22217 |
ashik.ali |
41 |
import com.spice.profitmandi.dao.entity.dtr.InsurancePolicy;
|
| 23343 |
ashik.ali |
42 |
import com.spice.profitmandi.dao.entity.dtr.InsuranceProvider;
|
| 21728 |
ashik.ali |
43 |
import com.spice.profitmandi.dao.entity.fofo.Customer;
|
|
|
44 |
import com.spice.profitmandi.dao.entity.fofo.CustomerAddress;
|
| 22927 |
ashik.ali |
45 |
import com.spice.profitmandi.dao.entity.fofo.FofoOrder;
|
| 22860 |
ashik.ali |
46 |
import com.spice.profitmandi.dao.entity.fofo.FofoOrderItem;
|
| 23366 |
ashik.ali |
47 |
import com.spice.profitmandi.dao.entity.fofo.FofoOrderPaymentOption;
|
| 21728 |
ashik.ali |
48 |
import com.spice.profitmandi.dao.entity.fofo.PaymentOption;
|
| 23298 |
ashik.ali |
49 |
import com.spice.profitmandi.dao.entity.user.Address;
|
| 22217 |
ashik.ali |
50 |
import com.spice.profitmandi.dao.repository.dtr.InsurancePolicyRepository;
|
| 23343 |
ashik.ali |
51 |
import com.spice.profitmandi.dao.repository.dtr.InsuranceProviderRepository;
|
| 23298 |
ashik.ali |
52 |
import com.spice.profitmandi.dao.repository.dtr.RetailerRegisteredAddressRepository;
|
| 21728 |
ashik.ali |
53 |
import com.spice.profitmandi.dao.repository.fofo.CustomerAddressRepository;
|
|
|
54 |
import com.spice.profitmandi.dao.repository.fofo.CustomerRepository;
|
| 22860 |
ashik.ali |
55 |
import com.spice.profitmandi.dao.repository.fofo.FofoOrderItemRepository;
|
| 23366 |
ashik.ali |
56 |
import com.spice.profitmandi.dao.repository.fofo.FofoOrderPaymentOptionRepository;
|
| 21728 |
ashik.ali |
57 |
import com.spice.profitmandi.dao.repository.fofo.FofoOrderRepository;
|
| 23366 |
ashik.ali |
58 |
import com.spice.profitmandi.dao.repository.fofo.FofoPartnerPaymentOptionRepository;
|
| 21728 |
ashik.ali |
59 |
import com.spice.profitmandi.dao.repository.fofo.PaymentOptionRepository;
|
| 23298 |
ashik.ali |
60 |
import com.spice.profitmandi.dao.repository.user.AddressRepository;
|
| 23366 |
ashik.ali |
61 |
import com.spice.profitmandi.service.order.OrderService;
|
| 22069 |
ashik.ali |
62 |
import com.spice.profitmandi.service.pricing.PricingService;
|
| 22139 |
amit.gupta |
63 |
import com.spice.profitmandi.web.model.LoginDetails;
|
| 22069 |
ashik.ali |
64 |
import com.spice.profitmandi.web.util.CookiesProcessor;
|
| 21612 |
ashik.ali |
65 |
|
|
|
66 |
@Controller
|
| 22037 |
amit.gupta |
67 |
@Transactional(rollbackFor=Throwable.class)
|
| 21612 |
ashik.ali |
68 |
public class OrderController {
|
|
|
69 |
|
|
|
70 |
private static final Logger LOGGER = LoggerFactory.getLogger(OrderController.class);
|
| 21985 |
kshitij.so |
71 |
|
| 21612 |
ashik.ali |
72 |
@Autowired
|
| 22860 |
ashik.ali |
73 |
private CustomerRepository customerRepository;
|
| 21985 |
kshitij.so |
74 |
|
| 21612 |
ashik.ali |
75 |
@Autowired
|
| 22860 |
ashik.ali |
76 |
private FofoOrderItemRepository fofoLineItemRepository;
|
| 21985 |
kshitij.so |
77 |
|
| 21612 |
ashik.ali |
78 |
@Autowired
|
| 22860 |
ashik.ali |
79 |
private PaymentOptionRepository paymentOptionRepository;
|
| 21985 |
kshitij.so |
80 |
|
| 21680 |
ashik.ali |
81 |
@Autowired
|
| 22860 |
ashik.ali |
82 |
private FofoOrderRepository fofoOrderRepository;
|
| 21985 |
kshitij.so |
83 |
|
| 21680 |
ashik.ali |
84 |
@Autowired
|
| 22860 |
ashik.ali |
85 |
private CustomerAddressRepository customerAddressRepository;
|
| 22217 |
ashik.ali |
86 |
|
|
|
87 |
@Autowired
|
| 22860 |
ashik.ali |
88 |
private InsurancePolicyRepository insurancePolicyRepository;
|
| 23343 |
ashik.ali |
89 |
|
|
|
90 |
@Autowired
|
|
|
91 |
private InsuranceProviderRepository insuranceProviderRepository;
|
| 21985 |
kshitij.so |
92 |
|
| 21896 |
ashik.ali |
93 |
@Autowired
|
| 22860 |
ashik.ali |
94 |
private CookiesProcessor cookiesProcessor;
|
| 22069 |
ashik.ali |
95 |
|
|
|
96 |
@Autowired
|
| 22860 |
ashik.ali |
97 |
private PricingService pricingService;
|
| 22244 |
ashik.ali |
98 |
|
| 22354 |
ashik.ali |
99 |
@Autowired
|
| 22860 |
ashik.ali |
100 |
private OrderService orderService;
|
| 22244 |
ashik.ali |
101 |
|
| 23298 |
ashik.ali |
102 |
@Autowired
|
|
|
103 |
private RetailerRegisteredAddressRepository retailerRegisteredAddressRepository;
|
| 22354 |
ashik.ali |
104 |
|
|
|
105 |
@Autowired
|
| 23298 |
ashik.ali |
106 |
private AddressRepository addressRepository;
|
|
|
107 |
|
|
|
108 |
@Autowired
|
| 23366 |
ashik.ali |
109 |
private FofoOrderPaymentOptionRepository fofoOrderPaymentOptionRepository;
|
|
|
110 |
|
|
|
111 |
@Autowired
|
|
|
112 |
private FofoPartnerPaymentOptionRepository fofoPartnerPaymentOptionRepository;
|
|
|
113 |
|
|
|
114 |
@Autowired
|
| 22860 |
ashik.ali |
115 |
private ResponseSender<?> responseSender;
|
| 22689 |
amit.gupta |
116 |
|
| 21985 |
kshitij.so |
117 |
@RequestMapping(value = "/order")
|
| 22927 |
ashik.ali |
118 |
public String orderIndex(HttpServletRequest request, @RequestParam(name = "cartData") String cartData, Model model) throws ProfitMandiBusinessException{
|
|
|
119 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);;
|
|
|
120 |
|
| 23298 |
ashik.ali |
121 |
int addressId = retailerRegisteredAddressRepository.selectAddressIdByRetailerId(loginDetails.getFofoId());
|
|
|
122 |
Address address = addressRepository.selectById(addressId);
|
|
|
123 |
|
| 22860 |
ashik.ali |
124 |
List<CartFofo> cartItems = orderService.cartCheckout(cartData);
|
|
|
125 |
Set<Integer> itemIds = new HashSet<>();
|
|
|
126 |
for(CartFofo cartFofo : cartItems){
|
|
|
127 |
itemIds.add(cartFofo.getItemId());
|
| 21985 |
kshitij.so |
128 |
}
|
| 22860 |
ashik.ali |
129 |
Map<Integer, PriceModel> mopPriceMap = pricingService.getPurchasePriceMopPriceNotFound(itemIds, loginDetails.getFofoId());
|
| 23366 |
ashik.ali |
130 |
List<Integer> paymentOptionIds = fofoPartnerPaymentOptionRepository.selectPaymentOptionIdsByFofoId(loginDetails.getFofoId());
|
|
|
131 |
List<PaymentOption> paymentOptions = paymentOptionRepository.selectByIds(new HashSet<>(paymentOptionIds));
|
| 22860 |
ashik.ali |
132 |
LOGGER.info("mopPriceMap {}", mopPriceMap);
|
| 23298 |
ashik.ali |
133 |
model.addAttribute("stateNames", Utils.getAllStateNames());
|
|
|
134 |
model.addAttribute("retailerStateName", address.getState());
|
| 22860 |
ashik.ali |
135 |
model.addAttribute("cartObj", cartItems);
|
|
|
136 |
model.addAttribute("mopPriceMap", mopPriceMap);
|
| 23366 |
ashik.ali |
137 |
model.addAttribute("paymentOptions", paymentOptions);
|
| 22860 |
ashik.ali |
138 |
return "order-index";
|
| 21985 |
kshitij.so |
139 |
}
|
| 22660 |
ashik.ali |
140 |
|
| 21612 |
ashik.ali |
141 |
|
| 22244 |
ashik.ali |
142 |
@RequestMapping(value = "/insurancePrices", method = RequestMethod.GET)
|
| 22927 |
ashik.ali |
143 |
public ResponseEntity<?> getInsurancePrices(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.PRICE) float price) throws ProfitMandiBusinessException{
|
| 22244 |
ashik.ali |
144 |
LOGGER.info("Request received at url : {}", request.getRequestURI());
|
| 22927 |
ashik.ali |
145 |
Set<Float> prices = new HashSet<>();
|
|
|
146 |
prices.add(price);
|
|
|
147 |
return responseSender.ok(pricingService.getInsurancePrices(prices, ProfitMandiConstants.GADGET_COPS));
|
| 22244 |
ashik.ali |
148 |
}
|
|
|
149 |
|
|
|
150 |
|
| 21985 |
kshitij.so |
151 |
@RequestMapping(value = "/get-order", method = RequestMethod.GET)
|
| 22927 |
ashik.ali |
152 |
public String getOrder(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.ORDER_ID) int orderId, Model model) throws ProfitMandiBusinessException{
|
|
|
153 |
LoginDetails fofoDetails = cookiesProcessor.getCookiesObject(request);
|
|
|
154 |
FofoOrder fofoOrder = fofoOrderRepository.selectByFofoIdAndOrderId(fofoDetails.getFofoId(), orderId);
|
|
|
155 |
List<FofoOrderItem> fofoLineItems = fofoLineItemRepository.selectByOrderId(fofoOrder.getId());
|
|
|
156 |
CustomerAddress customerAddress = customerAddressRepository.selectById(fofoOrder.getCustomerAddressId());
|
|
|
157 |
Customer customer = customerRepository.selectById(fofoOrder.getCustomerId());
|
|
|
158 |
customerAddress.setPhoneNumber(customer.getMobileNumber());
|
| 23366 |
ashik.ali |
159 |
List<FofoOrderPaymentOption> fofoOrderPaymentOptions = fofoOrderPaymentOptionRepository.selectByFofoOrderId(fofoOrder.getId());
|
|
|
160 |
Map<Integer, PaymentOption> paymentOptionIdPaymentOptionMap = this.paymentOptionIdPaymentOptionMap(fofoOrderPaymentOptions);
|
| 22927 |
ashik.ali |
161 |
List<InsurancePolicy> insurancePolicies = insurancePolicyRepository.selectByRetailerIdInvoiceNumber(fofoOrder.getFofoId(), fofoOrder.getInvoiceNumber());
|
| 23343 |
ashik.ali |
162 |
this.addInsuranceProvider(insurancePolicies);
|
| 22927 |
ashik.ali |
163 |
model.addAttribute("fofoOrder", fofoOrder);
|
|
|
164 |
model.addAttribute("fofoLineItems", fofoLineItems);
|
|
|
165 |
model.addAttribute("customerBillingAddress", orderService.getBillingAddress(customerAddress));
|
|
|
166 |
model.addAttribute("customerBillingAddressObj", customerAddress);
|
| 23366 |
ashik.ali |
167 |
model.addAttribute("fofoOrderPaymentOptions", fofoOrderPaymentOptions);
|
|
|
168 |
model.addAttribute("paymentOptionIdPaymentOptionMap", paymentOptionIdPaymentOptionMap);
|
| 22927 |
ashik.ali |
169 |
model.addAttribute("insurancePolicies", insurancePolicies);
|
|
|
170 |
return "order-details";
|
| 21985 |
kshitij.so |
171 |
}
|
| 22244 |
ashik.ali |
172 |
|
| 23343 |
ashik.ali |
173 |
private Map<Integer, InsuranceProvider> toInsuranceProviderIdInsuranceProvider(List<InsuranceProvider> insuranceProviders){
|
|
|
174 |
Map<Integer, InsuranceProvider> insuranceProviderIdInsuranceProviderMap = new HashMap<>();
|
|
|
175 |
for(InsuranceProvider insuranceProvider : insuranceProviders){
|
|
|
176 |
insuranceProviderIdInsuranceProviderMap.put(insuranceProvider.getId(), insuranceProvider);
|
|
|
177 |
}
|
|
|
178 |
return insuranceProviderIdInsuranceProviderMap;
|
|
|
179 |
}
|
| 22244 |
ashik.ali |
180 |
|
| 23343 |
ashik.ali |
181 |
private void addInsuranceProvider(List<InsurancePolicy> insurancePolicies){
|
|
|
182 |
if(insurancePolicies.isEmpty()){
|
|
|
183 |
return;
|
|
|
184 |
}
|
|
|
185 |
Set<Integer> insuranceProviderIds = new HashSet<>();
|
|
|
186 |
for(InsurancePolicy insurancePolicy : insurancePolicies){
|
|
|
187 |
insuranceProviderIds.add(insurancePolicy.getProviderId());
|
|
|
188 |
}
|
|
|
189 |
LOGGER.info("insuranceProviderIds {}", insuranceProviderIds);
|
|
|
190 |
List<InsuranceProvider> insuranceProviders = insuranceProviderRepository.selectByIds(insuranceProviderIds);
|
|
|
191 |
Map<Integer, InsuranceProvider> insuranceProviderIdInsuranceProviderMap = this.toInsuranceProviderIdInsuranceProvider(insuranceProviders);
|
|
|
192 |
for(InsurancePolicy insurancePolicy : insurancePolicies){
|
|
|
193 |
insurancePolicy.setInsuranceProvider(insuranceProviderIdInsuranceProviderMap.get(insurancePolicy.getProviderId()));
|
|
|
194 |
}
|
|
|
195 |
}
|
|
|
196 |
|
|
|
197 |
|
| 22244 |
ashik.ali |
198 |
@RequestMapping(value = "/saleDetails", method = RequestMethod.GET)
|
| 22927 |
ashik.ali |
199 |
public String getSaleDetails(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.ORDER_ID) int orderId, Model model) throws ProfitMandiBusinessException{
|
|
|
200 |
LoginDetails fofoDetails = cookiesProcessor.getCookiesObject(request);
|
|
|
201 |
|
|
|
202 |
FofoOrder fofoOrder = fofoOrderRepository.selectByFofoIdAndOrderId(fofoDetails.getFofoId(), orderId);
|
|
|
203 |
List<FofoOrderItem> fofoLineItems = fofoLineItemRepository.selectByOrderId(fofoOrder.getId());
|
|
|
204 |
CustomerAddress customerAddress = customerAddressRepository.selectById(fofoOrder.getCustomerAddressId());
|
| 23366 |
ashik.ali |
205 |
List<FofoOrderPaymentOption> fofoOrderPaymentOptions = fofoOrderPaymentOptionRepository.selectByFofoOrderId(fofoOrder.getId());
|
|
|
206 |
Map<Integer, PaymentOption> paymentOptionIdPaymentOptionMap = this.paymentOptionIdPaymentOptionMap(fofoOrderPaymentOptions);
|
| 22927 |
ashik.ali |
207 |
List<InsurancePolicy> insurancePolicies = insurancePolicyRepository.selectByRetailerIdInvoiceNumber(fofoOrder.getFofoId(), fofoOrder.getInvoiceNumber());
|
| 23343 |
ashik.ali |
208 |
this.addInsuranceProvider(insurancePolicies);
|
| 22927 |
ashik.ali |
209 |
model.addAttribute("fofoOrder", fofoOrder);
|
|
|
210 |
model.addAttribute("fofoLineItems", fofoLineItems);
|
|
|
211 |
model.addAttribute("customerBillingAddress", orderService.getBillingAddress(customerAddress));
|
|
|
212 |
model.addAttribute("customerBillingAddressObj", customerAddress);
|
| 23366 |
ashik.ali |
213 |
model.addAttribute("fofoOrderPaymentOptions", fofoOrderPaymentOptions);
|
|
|
214 |
model.addAttribute("paymentOptionIdPaymentOptionMap", paymentOptionIdPaymentOptionMap);
|
| 22927 |
ashik.ali |
215 |
model.addAttribute("insurancePolicies", insurancePolicies);
|
|
|
216 |
return "sale-details";
|
| 22244 |
ashik.ali |
217 |
}
|
|
|
218 |
|
| 23366 |
ashik.ali |
219 |
private Map<Integer, PaymentOption> paymentOptionIdPaymentOptionMap(List<FofoOrderPaymentOption> fofoOrderPaymentOptions){
|
|
|
220 |
Set<Integer> paymentOptionIds = new HashSet<>();
|
|
|
221 |
for(FofoOrderPaymentOption fofoOrderPaymentOption : fofoOrderPaymentOptions) {
|
|
|
222 |
paymentOptionIds.add(fofoOrderPaymentOption.getPaymentOptionId());
|
|
|
223 |
}
|
|
|
224 |
List<PaymentOption> paymentOptions = paymentOptionRepository.selectByIds(paymentOptionIds);
|
|
|
225 |
Map<Integer, PaymentOption> paymentOptionIdPaymentOptionMap = new HashMap<>();
|
|
|
226 |
for(PaymentOption paymentOption : paymentOptions) {
|
|
|
227 |
paymentOptionIdPaymentOptionMap.put(paymentOption.getId(), paymentOption);
|
|
|
228 |
}
|
|
|
229 |
return paymentOptionIdPaymentOptionMap;
|
|
|
230 |
}
|
|
|
231 |
|
| 21985 |
kshitij.so |
232 |
|
|
|
233 |
@RequestMapping(value = "/create-order", method = RequestMethod.POST)
|
| 22927 |
ashik.ali |
234 |
public String createOrder(HttpServletRequest request, @RequestBody CreateOrderRequest createOrderRequest, Model model) throws ProfitMandiBusinessException{
|
| 22064 |
ashik.ali |
235 |
LOGGER.info("request at uri {} body {}", request.getRequestURI(), createOrderRequest);
|
| 22927 |
ashik.ali |
236 |
LoginDetails fofoDetails = cookiesProcessor.getCookiesObject(request);
|
|
|
237 |
|
| 22860 |
ashik.ali |
238 |
int fofoOrderId = orderService.createOrder(createOrderRequest, fofoDetails.getFofoId());
|
| 22280 |
ashik.ali |
239 |
LOGGER.info("Order has been created successfully...");
|
| 22860 |
ashik.ali |
240 |
return "redirect:/get-order/?orderId="+fofoOrderId;
|
| 21612 |
ashik.ali |
241 |
}
|
| 21985 |
kshitij.so |
242 |
|
|
|
243 |
|
| 21689 |
ashik.ali |
244 |
@RequestMapping(value = "/generateInvoice")
|
| 22927 |
ashik.ali |
245 |
public ResponseEntity<?> generateInvoice(HttpServletRequest request, HttpServletResponse response, @RequestParam(name = ProfitMandiConstants.ORDER_ID) int orderId) throws ProfitMandiBusinessException{
|
| 22064 |
ashik.ali |
246 |
LOGGER.info("Request received at url {} with params [{}={}] ", request.getRequestURI(), ProfitMandiConstants.ORDER_ID, orderId);
|
| 22139 |
amit.gupta |
247 |
LoginDetails fofoDetails = cookiesProcessor.getCookiesObject(request);
|
| 22860 |
ashik.ali |
248 |
|
|
|
249 |
PdfModel pdfModel = orderService.getInvoicePdfModel(fofoDetails.getFofoId(), orderId);
|
| 22026 |
ashik.ali |
250 |
|
| 21689 |
ashik.ali |
251 |
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
|
|
252 |
PdfUtils.generateAndWrite(pdfModel, byteArrayOutputStream);
|
|
|
253 |
LOGGER.info("Pdf Stream length {}", byteArrayOutputStream.toByteArray().length);
|
| 22026 |
ashik.ali |
254 |
final HttpHeaders headers=new HttpHeaders();
|
|
|
255 |
headers.setContentType(MediaType.APPLICATION_PDF);
|
| 22860 |
ashik.ali |
256 |
headers.set("Content-disposition", "inline; filename=invoice-" + pdfModel.getInvoiceNumber() + ".pdf");
|
| 22026 |
ashik.ali |
257 |
headers.setContentLength(byteArrayOutputStream.toByteArray().length);
|
|
|
258 |
final InputStream inputStream=new ByteArrayInputStream(byteArrayOutputStream.toByteArray());
|
|
|
259 |
final InputStreamResource inputStreamResource=new InputStreamResource(inputStream);
|
|
|
260 |
return new ResponseEntity<InputStreamResource>(inputStreamResource, headers, HttpStatus.OK);
|
| 21689 |
ashik.ali |
261 |
}
|
| 22244 |
ashik.ali |
262 |
|
|
|
263 |
@RequestMapping(value = "/saleHistory")
|
| 23203 |
ashik.ali |
264 |
public String saleHistory(HttpServletRequest request, @RequestParam(name = "searchValue", defaultValue = "") String searchValue, @RequestParam(name = "searchType", defaultValue="") SearchType searchType, @RequestParam(name = ProfitMandiConstants.START_TIME, required = false) String startTimeString, @RequestParam(name = ProfitMandiConstants.END_TIME, required = false) String endTimeString, @RequestParam(name = "offset", defaultValue = "0") int offset, @RequestParam(name = "limit", defaultValue = "10") int limit, Model model) throws ProfitMandiBusinessException{
|
| 22927 |
ashik.ali |
265 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 22244 |
ashik.ali |
266 |
|
| 23203 |
ashik.ali |
267 |
Map<String, Object> map = orderService.getSaleHistory(loginDetails.getFofoId(), searchType, searchValue, startTimeString, endTimeString, offset, limit);
|
|
|
268 |
model.addAllAttributes(map);
|
| 22244 |
ashik.ali |
269 |
|
|
|
270 |
return "sale-history";
|
|
|
271 |
}
|
| 22291 |
ashik.ali |
272 |
|
|
|
273 |
|
|
|
274 |
@RequestMapping(value = "/getPaginatedSaleHistory")
|
| 23203 |
ashik.ali |
275 |
public String getSaleHistoryPaginated(HttpServletRequest request, @RequestParam(name = "searchValue", defaultValue="") String searchValue, @RequestParam(name = "searchType", defaultValue = "") SearchType searchType, @RequestParam(name = ProfitMandiConstants.START_TIME, required = false) String startTimeString, @RequestParam(name = ProfitMandiConstants.END_TIME, required = false) String endTimeString, @RequestParam(name = "offset", defaultValue = "0") int offset, @RequestParam(name = "limit", defaultValue="10") int limit, Model model) throws ProfitMandiBusinessException{
|
| 22927 |
ashik.ali |
276 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
|
|
277 |
|
| 23203 |
ashik.ali |
278 |
Map<String, Object> map = orderService.getSaleHistoryPaginated(loginDetails.getFofoId(), searchType, searchValue, startTimeString, endTimeString, offset, limit);
|
|
|
279 |
model.addAllAttributes(map);
|
|
|
280 |
|
| 22291 |
ashik.ali |
281 |
return "sale-history-paginated";
|
|
|
282 |
}
|
|
|
283 |
|
| 21612 |
ashik.ali |
284 |
}
|