Subversion Repositories SmartDukaan

Rev

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

Rev 32508 Rev 32627
Line 235... Line 235...
235
    public String getOrder(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.ORDER_ID) int orderId,
235
    public String getOrder(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.ORDER_ID) int orderId,
236
                           Model model) throws ProfitMandiBusinessException {
236
                           Model model) throws ProfitMandiBusinessException {
237
        LoginDetails fofoDetails = cookiesProcessor.getCookiesObject(request);
237
        LoginDetails fofoDetails = cookiesProcessor.getCookiesObject(request);
238
        FofoOrder fofoOrder = fofoOrderRepository.selectByFofoIdAndOrderId(fofoDetails.getFofoId(), orderId);
238
        FofoOrder fofoOrder = fofoOrderRepository.selectByFofoIdAndOrderId(fofoDetails.getFofoId(), orderId);
239
        List<FofoOrderItem> fofoLineItems = fofoOrderItemRepository.selectByOrderId(fofoOrder.getId());
239
        List<FofoOrderItem> fofoLineItems = fofoOrderItemRepository.selectByOrderId(fofoOrder.getId());
-
 
240
        CustomerAddress customerAddress = null;
-
 
241
        if (fofoOrder.getCustomerAddressId() != 0) {
240
        CustomerAddress customerAddress = customerAddressRepository.selectById(fofoOrder.getCustomerAddressId());
242
            customerAddress = customerAddressRepository.selectById(fofoOrder.getCustomerAddressId());
-
 
243
        }
-
 
244
 
241
        Customer customer = customerRepository.selectById(fofoOrder.getCustomerId());
245
        Customer customer = customerRepository.selectById(fofoOrder.getCustomerId());
-
 
246
        if (customerAddress != null) {
242
        customerAddress.setPhoneNumber(customer.getMobileNumber());
247
            customerAddress.setPhoneNumber(customer.getMobileNumber());
-
 
248
        }
-
 
249
        LOGGER.info("Added to get invoice - {}, {}", customer, 123);
243
        List<PaymentOptionTransaction> paymentOptionTransactions = paymentOptionTransactionRepository
250
        List<PaymentOptionTransaction> paymentOptionTransactions = paymentOptionTransactionRepository
244
                .selectByReferenceIdAndType(fofoOrder.getId(), PaymentOptionReferenceType.ORDER);
251
                .selectByReferenceIdAndType(fofoOrder.getId(), PaymentOptionReferenceType.ORDER);
245
        Map<Integer, PaymentOption> paymentOptionIdPaymentOptionMap = this
252
        Map<Integer, PaymentOption> paymentOptionIdPaymentOptionMap = this
246
                .paymentOptionIdPaymentOptionMap(paymentOptionTransactions);
253
                .paymentOptionIdPaymentOptionMap(paymentOptionTransactions);
247
        List<InsurancePolicy> insurancePolicies = insurancePolicyRepository
254
        List<InsurancePolicy> insurancePolicies = insurancePolicyRepository
248
                .selectByRetailerIdInvoiceNumber(fofoOrder.getInvoiceNumber());
255
                .selectByRetailerIdInvoiceNumber(fofoOrder.getInvoiceNumber());
249
        this.addInsuranceProvider(insurancePolicies);
256
        this.addInsuranceProvider(insurancePolicies);
250
 
257
 
251
        model.addAttribute("fofoOrder", fofoOrder);
258
        model.addAttribute("fofoOrder", fofoOrder);
252
        model.addAttribute("fofoLineItems", fofoLineItems);
259
        model.addAttribute("fofoLineItems", fofoLineItems);
-
 
260
        if (customerAddress != null) {
253
        model.addAttribute("customerBillingAddress", orderService.getBillingAddress(customerAddress));
261
            model.addAttribute("customerBillingAddress", orderService.getBillingAddress(customerAddress));
-
 
262
        }
254
        model.addAttribute("customerBillingAddressObj", customerAddress);
263
        model.addAttribute("customerBillingAddressObj", customerAddress);
-
 
264
        model.addAttribute("customerDetailsObj", customer);
255
        model.addAttribute("paymentOptionTransactions", paymentOptionTransactions);
265
        model.addAttribute("paymentOptionTransactions", paymentOptionTransactions);
256
        model.addAttribute("paymentOptionIdPaymentOptionMap", paymentOptionIdPaymentOptionMap);
266
        model.addAttribute("paymentOptionIdPaymentOptionMap", paymentOptionIdPaymentOptionMap);
257
        model.addAttribute("insurancePolicies", insurancePolicies);
267
        model.addAttribute("insurancePolicies", insurancePolicies);
258
        return "order-details";
268
        return "order-details";
259
    }
269
    }