| Line 1... |
Line 1... |
| 1 |
package com.spice.profitmandi.web.controller;
|
1 |
package com.spice.profitmandi.web.controller;
|
| 2 |
|
2 |
|
| - |
|
3 |
import java.io.ByteArrayInputStream;
|
| - |
|
4 |
import java.io.ByteArrayOutputStream;
|
| - |
|
5 |
import java.io.IOException;
|
| - |
|
6 |
import java.io.InputStream;
|
| 3 |
import java.time.LocalDateTime;
|
7 |
import java.time.LocalDateTime;
|
| 4 |
import java.time.LocalTime;
|
8 |
import java.time.LocalTime;
|
| 5 |
import java.time.format.DateTimeFormatter;
|
9 |
import java.time.format.DateTimeFormatter;
|
| 6 |
import java.util.ArrayList;
|
10 |
import java.util.ArrayList;
|
| 7 |
import java.util.Arrays;
|
11 |
import java.util.Arrays;
|
| Line 23... |
Line 27... |
| 23 |
import org.apache.logging.log4j.Logger;
|
27 |
import org.apache.logging.log4j.Logger;
|
| 24 |
import org.json.JSONArray;
|
28 |
import org.json.JSONArray;
|
| 25 |
import org.json.JSONObject;
|
29 |
import org.json.JSONObject;
|
| 26 |
import org.springframework.beans.factory.annotation.Autowired;
|
30 |
import org.springframework.beans.factory.annotation.Autowired;
|
| 27 |
import org.springframework.beans.factory.annotation.Value;
|
31 |
import org.springframework.beans.factory.annotation.Value;
|
| - |
|
32 |
import org.springframework.core.io.InputStreamResource;
|
| - |
|
33 |
import org.springframework.http.HttpHeaders;
|
| - |
|
34 |
import org.springframework.http.HttpStatus;
|
| 28 |
import org.springframework.http.MediaType;
|
35 |
import org.springframework.http.MediaType;
|
| 29 |
import org.springframework.http.ResponseEntity;
|
36 |
import org.springframework.http.ResponseEntity;
|
| 30 |
import org.springframework.stereotype.Controller;
|
37 |
import org.springframework.stereotype.Controller;
|
| 31 |
import org.springframework.transaction.annotation.Transactional;
|
38 |
import org.springframework.transaction.annotation.Transactional;
|
| 32 |
import org.springframework.web.bind.annotation.GetMapping;
|
39 |
import org.springframework.web.bind.annotation.GetMapping;
|
| Line 44... |
Line 51... |
| 44 |
import com.spice.profitmandi.common.enumuration.SchemeType;
|
51 |
import com.spice.profitmandi.common.enumuration.SchemeType;
|
| 45 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
52 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| 46 |
import com.spice.profitmandi.common.model.CreatePendingOrderItem;
|
53 |
import com.spice.profitmandi.common.model.CreatePendingOrderItem;
|
| 47 |
import com.spice.profitmandi.common.model.CreatePendingOrderRequest;
|
54 |
import com.spice.profitmandi.common.model.CreatePendingOrderRequest;
|
| 48 |
import com.spice.profitmandi.common.model.CustomRetailer;
|
55 |
import com.spice.profitmandi.common.model.CustomRetailer;
|
| - |
|
56 |
import com.spice.profitmandi.common.model.PdfModel;
|
| 49 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
57 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
| 50 |
import com.spice.profitmandi.common.model.SendNotificationModel;
|
58 |
import com.spice.profitmandi.common.model.SendNotificationModel;
|
| 51 |
import com.spice.profitmandi.common.model.UserInfo;
|
59 |
import com.spice.profitmandi.common.model.UserInfo;
|
| 52 |
import com.spice.profitmandi.common.solr.SolrService;
|
60 |
import com.spice.profitmandi.common.solr.SolrService;
|
| 53 |
import com.spice.profitmandi.common.util.FormattingUtils;
|
61 |
import com.spice.profitmandi.common.util.FormattingUtils;
|
| - |
|
62 |
import com.spice.profitmandi.common.util.PdfUtils;
|
| 54 |
import com.spice.profitmandi.common.util.Utils;
|
63 |
import com.spice.profitmandi.common.util.Utils;
|
| 55 |
import com.spice.profitmandi.common.web.client.RestClient;
|
64 |
import com.spice.profitmandi.common.web.client.RestClient;
|
| 56 |
import com.spice.profitmandi.common.web.util.ResponseSender;
|
65 |
import com.spice.profitmandi.common.web.util.ResponseSender;
|
| 57 |
import com.spice.profitmandi.dao.entity.catalog.Item;
|
66 |
import com.spice.profitmandi.dao.entity.catalog.Item;
|
| 58 |
import com.spice.profitmandi.dao.entity.catalog.TagListing;
|
67 |
import com.spice.profitmandi.dao.entity.catalog.TagListing;
|
| 59 |
import com.spice.profitmandi.dao.entity.dtr.User;
|
68 |
import com.spice.profitmandi.dao.entity.dtr.User;
|
| 60 |
import com.spice.profitmandi.dao.entity.dtr.WebListing;
|
69 |
import com.spice.profitmandi.dao.entity.dtr.WebListing;
|
| 61 |
import com.spice.profitmandi.dao.entity.dtr.WebOffer;
|
70 |
import com.spice.profitmandi.dao.entity.dtr.WebOffer;
|
| 62 |
import com.spice.profitmandi.dao.entity.fofo.Customer;
|
71 |
import com.spice.profitmandi.dao.entity.fofo.Customer;
|
| 63 |
import com.spice.profitmandi.dao.entity.fofo.CustomerAddress;
|
72 |
import com.spice.profitmandi.dao.entity.fofo.CustomerAddress;
|
| - |
|
73 |
import com.spice.profitmandi.dao.entity.fofo.FofoOrder;
|
| - |
|
74 |
import com.spice.profitmandi.dao.entity.fofo.FofoOrderItem;
|
| 64 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
75 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
| 65 |
import com.spice.profitmandi.dao.entity.fofo.PendingOrder;
|
76 |
import com.spice.profitmandi.dao.entity.fofo.PendingOrder;
|
| 66 |
import com.spice.profitmandi.dao.entity.fofo.PendingOrderItem;
|
77 |
import com.spice.profitmandi.dao.entity.fofo.PendingOrderItem;
|
| 67 |
import com.spice.profitmandi.dao.entity.fofo.PincodePartner;
|
78 |
import com.spice.profitmandi.dao.entity.fofo.PincodePartner;
|
| 68 |
import com.spice.profitmandi.dao.enumuration.dtr.OtpType;
|
79 |
import com.spice.profitmandi.dao.enumuration.dtr.OtpType;
|
| Line 75... |
Line 86... |
| 75 |
import com.spice.profitmandi.dao.repository.catalog.ItemRepository;
|
86 |
import com.spice.profitmandi.dao.repository.catalog.ItemRepository;
|
| 76 |
import com.spice.profitmandi.dao.repository.catalog.TagListingRepository;
|
87 |
import com.spice.profitmandi.dao.repository.catalog.TagListingRepository;
|
| 77 |
import com.spice.profitmandi.dao.repository.cs.CsService;
|
88 |
import com.spice.profitmandi.dao.repository.cs.CsService;
|
| 78 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
89 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
| 79 |
import com.spice.profitmandi.dao.repository.dtr.UserAccountRepository;
|
90 |
import com.spice.profitmandi.dao.repository.dtr.UserAccountRepository;
|
| - |
|
91 |
import com.spice.profitmandi.dao.repository.user.UserRepository;
|
| 80 |
import com.spice.profitmandi.dao.repository.dtr.WebListingRepository;
|
92 |
import com.spice.profitmandi.dao.repository.dtr.WebListingRepository;
|
| 81 |
import com.spice.profitmandi.dao.repository.dtr.WebOfferRepository;
|
93 |
import com.spice.profitmandi.dao.repository.dtr.WebOfferRepository;
|
| 82 |
import com.spice.profitmandi.dao.repository.dtr.WebProductListingRepository;
|
94 |
import com.spice.profitmandi.dao.repository.dtr.WebProductListingRepository;
|
| 83 |
import com.spice.profitmandi.dao.repository.fofo.CurrentInventorySnapshotRepository;
|
95 |
import com.spice.profitmandi.dao.repository.fofo.CurrentInventorySnapshotRepository;
|
| 84 |
import com.spice.profitmandi.dao.repository.fofo.CustomerAddressRepository;
|
96 |
import com.spice.profitmandi.dao.repository.fofo.CustomerAddressRepository;
|
| 85 |
import com.spice.profitmandi.dao.repository.fofo.CustomerRepository;
|
97 |
import com.spice.profitmandi.dao.repository.fofo.CustomerRepository;
|
| - |
|
98 |
import com.spice.profitmandi.dao.repository.fofo.FofoOrderItemRepository;
|
| - |
|
99 |
import com.spice.profitmandi.dao.repository.fofo.FofoOrderRepository;
|
| 86 |
import com.spice.profitmandi.dao.repository.fofo.PendingOrderItemRepository;
|
100 |
import com.spice.profitmandi.dao.repository.fofo.PendingOrderItemRepository;
|
| 87 |
import com.spice.profitmandi.dao.repository.fofo.PendingOrderRepository;
|
101 |
import com.spice.profitmandi.dao.repository.fofo.PendingOrderRepository;
|
| 88 |
import com.spice.profitmandi.dao.repository.fofo.PendingOrderService;
|
102 |
import com.spice.profitmandi.dao.repository.fofo.PendingOrderService;
|
| 89 |
import com.spice.profitmandi.dao.repository.fofo.PincodePartnerRepository;
|
103 |
import com.spice.profitmandi.dao.repository.fofo.PincodePartnerRepository;
|
| 90 |
import com.spice.profitmandi.dao.repository.inventory.ItemAvailabilityCacheRepository;
|
104 |
import com.spice.profitmandi.dao.repository.inventory.ItemAvailabilityCacheRepository;
|
| Line 95... |
Line 109... |
| 95 |
import com.spice.profitmandi.service.inventory.AvailabilityModel;
|
109 |
import com.spice.profitmandi.service.inventory.AvailabilityModel;
|
| 96 |
import com.spice.profitmandi.service.inventory.FofoAvailabilityInfo;
|
110 |
import com.spice.profitmandi.service.inventory.FofoAvailabilityInfo;
|
| 97 |
import com.spice.profitmandi.service.inventory.FofoCatalogResponse;
|
111 |
import com.spice.profitmandi.service.inventory.FofoCatalogResponse;
|
| 98 |
import com.spice.profitmandi.service.inventory.InventoryService;
|
112 |
import com.spice.profitmandi.service.inventory.InventoryService;
|
| 99 |
import com.spice.profitmandi.service.inventory.SaholicInventoryService;
|
113 |
import com.spice.profitmandi.service.inventory.SaholicInventoryService;
|
| - |
|
114 |
import com.spice.profitmandi.service.order.OrderService;
|
| 100 |
import com.spice.profitmandi.service.scheme.SchemeService;
|
115 |
import com.spice.profitmandi.service.scheme.SchemeService;
|
| 101 |
import com.spice.profitmandi.service.user.RetailerService;
|
116 |
import com.spice.profitmandi.service.user.RetailerService;
|
| - |
|
117 |
|
| 102 |
import com.spice.profitmandi.web.processor.OtpProcessor;
|
118 |
import com.spice.profitmandi.web.processor.OtpProcessor;
|
| 103 |
import com.spice.profitmandi.web.res.DealBrands;
|
119 |
import com.spice.profitmandi.web.res.DealBrands;
|
| 104 |
import com.spice.profitmandi.web.res.DealObjectResponse;
|
120 |
import com.spice.profitmandi.web.res.DealObjectResponse;
|
| 105 |
import com.spice.profitmandi.web.res.DealsResponse;
|
121 |
import com.spice.profitmandi.web.res.DealsResponse;
|
| 106 |
import com.spice.profitmandi.web.res.ValidateCartResponse;
|
122 |
import com.spice.profitmandi.web.res.ValidateCartResponse;
|
| Line 191... |
Line 207... |
| 191 |
|
207 |
|
| 192 |
@Autowired
|
208 |
@Autowired
|
| 193 |
private SchemeService schemeService;
|
209 |
private SchemeService schemeService;
|
| 194 |
|
210 |
|
| 195 |
@Autowired
|
211 |
@Autowired
|
| - |
|
212 |
private UserRepository userRepository;
|
| - |
|
213 |
|
| - |
|
214 |
@Autowired
|
| 196 |
private ItemAvailabilityCacheRepository itemAvailabilityCacheRepository;
|
215 |
private ItemAvailabilityCacheRepository itemAvailabilityCacheRepository;
|
| 197 |
|
216 |
|
| 198 |
@Autowired
|
217 |
@Autowired
|
| 199 |
private WebListingRepository webListingRepository;
|
218 |
private WebListingRepository webListingRepository;
|
| 200 |
|
219 |
|
| Line 214... |
Line 233... |
| 214 |
private NotificationService notificationService;
|
233 |
private NotificationService notificationService;
|
| 215 |
|
234 |
|
| 216 |
@Autowired
|
235 |
@Autowired
|
| 217 |
private com.spice.profitmandi.dao.repository.dtr.UserRepository dtrUserRepository;
|
236 |
private com.spice.profitmandi.dao.repository.dtr.UserRepository dtrUserRepository;
|
| 218 |
|
237 |
|
| - |
|
238 |
@Autowired
|
| - |
|
239 |
private FofoOrderRepository fofoOrderRepository;
|
| - |
|
240 |
|
| - |
|
241 |
@Autowired
|
| - |
|
242 |
private FofoOrderItemRepository fofoOrderItemRepository;
|
| - |
|
243 |
|
| - |
|
244 |
@Autowired
|
| - |
|
245 |
private OrderService orderService;
|
| 219 |
private static final List<String> offlineOrders = Arrays.asList("EMIOD", "POD");
|
246 |
private static final List<String> offlineOrders = Arrays.asList("EMIOD", "POD");
|
| 220 |
|
247 |
|
| 221 |
List<String> filterableParams = Arrays.asList("brand");
|
248 |
List<String> filterableParams = Arrays.asList("brand");
|
| 222 |
|
249 |
|
| 223 |
@RequestMapping(value = "/store/entity/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
250 |
@RequestMapping(value = "/store/entity/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
| Line 490... |
Line 517... |
| 490 |
|
517 |
|
| 491 |
}
|
518 |
}
|
| 492 |
return responseSender.ok(fofoStoreRepository.selectByRetailerId(fofoId).getCode());
|
519 |
return responseSender.ok(fofoStoreRepository.selectByRetailerId(fofoId).getCode());
|
| 493 |
}
|
520 |
}
|
| 494 |
|
521 |
|
| - |
|
522 |
@RequestMapping(value = "/store/addresses", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
| - |
|
523 |
@ApiImplicitParams({
|
| - |
|
524 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header") })
|
| - |
|
525 |
@ApiOperation(value = "Get brand list and count for category")
|
| - |
|
526 |
public ResponseEntity<?> getStoresByPincod(HttpServletRequest request, @RequestParam String pincode,
|
| - |
|
527 |
@RequestParam(name = "fofoCode", defaultValue = "", required = false) String fofoCode) throws Exception {
|
| - |
|
528 |
|
| - |
|
529 |
List<CustomRetailer> customerRetailers = new ArrayList<>();
|
| - |
|
530 |
|
| - |
|
531 |
logger.info("fofoCode" + fofoCode);
|
| - |
|
532 |
|
| - |
|
533 |
if (fofoCode != null) {
|
| - |
|
534 |
FofoStore fs = fofoStoreRepository.selectByStoreCode(fofoCode.toUpperCase());
|
| - |
|
535 |
PincodePartner pp = pincodePartnerRepository.selectPartnerByPincode(pincode, fs.getId());
|
| - |
|
536 |
if (pp != null) {
|
| - |
|
537 |
return responseSender.ok(customerRetailers.add(retailerService.getFofoRetailer(pp.getFofoId())));
|
| - |
|
538 |
} else {
|
| - |
|
539 |
|
| - |
|
540 |
List<PincodePartner> pincodePartners = pincodePartnerRepository.selectPartnersByPincode(pincode);
|
| - |
|
541 |
if (pincodePartners.size() > 0) {
|
| - |
|
542 |
|
| - |
|
543 |
List<Integer> fofoIds = pincodePartners.stream().map(x -> x.getFofoId())
|
| - |
|
544 |
.collect(Collectors.toList());
|
| - |
|
545 |
List<Integer> activefofoIds = fofoStoreRepository.selectByRetailerIds(fofoIds).stream()
|
| - |
|
546 |
.filter(x -> x.isActive()).map(x -> x.getId()).collect(Collectors.toList());
|
| - |
|
547 |
|
| - |
|
548 |
Map<Integer, CustomRetailer> customerRetailerMap = retailerService.getFofoRetailers(activefofoIds);
|
| - |
|
549 |
customerRetailers.addAll(customerRetailerMap.values());
|
| - |
|
550 |
|
| - |
|
551 |
}
|
| - |
|
552 |
return responseSender.ok(customerRetailers);
|
| - |
|
553 |
|
| - |
|
554 |
}
|
| - |
|
555 |
} else {
|
| - |
|
556 |
|
| - |
|
557 |
List<PincodePartner> pincodePartners = pincodePartnerRepository.selectPartnersByPincode(pincode);
|
| - |
|
558 |
if (pincodePartners.size() > 0) {
|
| - |
|
559 |
List<Integer> fofoIds = pincodePartners.stream().map(x -> x.getFofoId()).collect(Collectors.toList());
|
| - |
|
560 |
List<Integer> activefofoIds = fofoStoreRepository.selectByRetailerIds(fofoIds).stream()
|
| - |
|
561 |
.filter(x -> x.isActive()).map(x -> x.getId()).collect(Collectors.toList());
|
| - |
|
562 |
|
| - |
|
563 |
Map<Integer, CustomRetailer> customerRetailerMap = retailerService.getFofoRetailers(activefofoIds);
|
| - |
|
564 |
customerRetailers.addAll(customerRetailerMap.values());
|
| - |
|
565 |
}
|
| - |
|
566 |
|
| - |
|
567 |
return responseSender.ok(customerRetailers);
|
| - |
|
568 |
|
| - |
|
569 |
}
|
| - |
|
570 |
|
| - |
|
571 |
}
|
| - |
|
572 |
|
| 495 |
@RequestMapping(value = "/store/address/detail/{pincode}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
573 |
@RequestMapping(value = "/store/address/detail/{pincode}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
| 496 |
@ApiImplicitParams({
|
574 |
@ApiImplicitParams({
|
| 497 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header") })
|
575 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header") })
|
| 498 |
@ApiOperation(value = "Get brand list and count for category")
|
576 |
@ApiOperation(value = "Get brand list and count for category")
|
| 499 |
public ResponseEntity<?> getStoresDetailsByPincode(HttpServletRequest request, @PathVariable String pincode)
|
577 |
public ResponseEntity<?> getStoresDetailsByPincode(HttpServletRequest request, @PathVariable String pincode)
|
| Line 517... |
Line 595... |
| 517 |
public ResponseEntity<?> getOrderDetail(HttpServletRequest request, @RequestParam(value = "id") int id,
|
595 |
public ResponseEntity<?> getOrderDetail(HttpServletRequest request, @RequestParam(value = "id") int id,
|
| 518 |
@RequestParam(name = "offset") int offset, @RequestParam(name = "limit") int limit) throws Exception {
|
596 |
@RequestParam(name = "offset") int offset, @RequestParam(name = "limit") int limit) throws Exception {
|
| 519 |
List<CustomerOrderDetail> customerOrderDetails = new ArrayList<>();
|
597 |
List<CustomerOrderDetail> customerOrderDetails = new ArrayList<>();
|
| 520 |
List<Integer> catalogIds = new ArrayList<>();
|
598 |
List<Integer> catalogIds = new ArrayList<>();
|
| 521 |
List<PendingOrder> pendingOrders = pendingOrderRepository.selectByCustomerId(id, offset, limit);
|
599 |
List<PendingOrder> pendingOrders = pendingOrderRepository.selectByCustomerId(id, offset, limit);
|
| - |
|
600 |
|
| 522 |
if (!pendingOrders.isEmpty()) {
|
601 |
if (!pendingOrders.isEmpty()) {
|
| 523 |
for (PendingOrder po : pendingOrders) {
|
602 |
for (PendingOrder po : pendingOrders) {
|
| 524 |
List<PendingOrderItem> pois = pendingOrderItemRepository.selectByOrderId(po.getId());
|
603 |
List<PendingOrderItem> pois = pendingOrderItemRepository.selectByOrderId(po.getId());
|
| 525 |
for (PendingOrderItem pendingOrderItem : pois) {
|
604 |
for (PendingOrderItem pendingOrderItem : pois) {
|
| 526 |
Item item = itemRepository.selectById(pendingOrderItem.getItemId());
|
605 |
Item item = itemRepository.selectById(pendingOrderItem.getItemId());
|
| Line 556... |
Line 635... |
| 556 |
}
|
635 |
}
|
| 557 |
|
636 |
|
| 558 |
return responseSender.ok(customerOrderDetails);
|
637 |
return responseSender.ok(customerOrderDetails);
|
| 559 |
}
|
638 |
}
|
| 560 |
|
639 |
|
| - |
|
640 |
@RequestMapping(value = "/store/invoiceOrder", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
| - |
|
641 |
public ResponseEntity<?> getOrderInvoiceDetail(HttpServletRequest request, @RequestParam(value = "id") int id,
|
| - |
|
642 |
@RequestParam(name = "offset") int offset, @RequestParam(name = "limit") int limit) throws Exception {
|
| - |
|
643 |
List<CustomerOrderDetail> customerOrderDetails = new ArrayList<>();
|
| - |
|
644 |
List<Integer> catalogIds = new ArrayList<>();
|
| - |
|
645 |
List<FofoOrder> fofoOrders = fofoOrderRepository.selectOrderByCustomerId(id, offset, limit);
|
| - |
|
646 |
|
| - |
|
647 |
if (!fofoOrders.isEmpty()) {
|
| - |
|
648 |
for (FofoOrder fo : fofoOrders) {
|
| - |
|
649 |
List<FofoOrderItem> fofoOrderItems = fofoOrderItemRepository.selectByOrderId(fo.getId());
|
| - |
|
650 |
for (FofoOrderItem fofoOrderItem : fofoOrderItems) {
|
| - |
|
651 |
Item item = itemRepository.selectById(fofoOrderItem.getItemId());
|
| - |
|
652 |
fofoOrderItem.setItemName(item.getItemDescription());
|
| - |
|
653 |
catalogIds.add(item.getCatalogItemId());
|
| - |
|
654 |
}
|
| - |
|
655 |
|
| - |
|
656 |
Map<Integer, JSONObject> contentMap = commonSolrService.getContentByCatalogIds(catalogIds);
|
| - |
|
657 |
for (FofoOrderItem foi : fofoOrderItems) {
|
| - |
|
658 |
|
| - |
|
659 |
CustomerOrderDetail customerOrderDetail = new CustomerOrderDetail();
|
| - |
|
660 |
|
| - |
|
661 |
Item item = itemRepository.selectById(foi.getItemId());
|
| - |
|
662 |
JSONObject jsonObj = contentMap.get(item.getCatalogItemId());
|
| - |
|
663 |
customerOrderDetail.setImageUrl(jsonObj.getString("imageUrl_s"));
|
| - |
|
664 |
customerOrderDetail.setBrand(item.getBrand());
|
| - |
|
665 |
customerOrderDetail.setColor(item.getColor());
|
| - |
|
666 |
customerOrderDetail.setFofoOrderItemId(foi.getId());
|
| - |
|
667 |
customerOrderDetail.setFofoOrderId(foi.getOrderId());
|
| - |
|
668 |
customerOrderDetail.setItemId(foi.getItemId());
|
| - |
|
669 |
customerOrderDetail.setModelName(item.getModelName());
|
| - |
|
670 |
customerOrderDetail.setModelNumber(item.getModelNumber());
|
| - |
|
671 |
customerOrderDetail.setQuantity(foi.getQuantity());
|
| - |
|
672 |
customerOrderDetail.setTotalPrice(foi.getSellingPrice());
|
| - |
|
673 |
customerOrderDetail.setCreatedTimeStamp(foi.getCreateTimestamp());
|
| - |
|
674 |
customerOrderDetail.setInvoiceNumber(fo.getInvoiceNumber());
|
| - |
|
675 |
customerOrderDetail.setCancelledTimestamp(fo.getCancelledTimestamp());
|
| - |
|
676 |
customerOrderDetails.add(customerOrderDetail);
|
| - |
|
677 |
}
|
| - |
|
678 |
}
|
| - |
|
679 |
|
| - |
|
680 |
}
|
| - |
|
681 |
return responseSender.ok(customerOrderDetails);
|
| - |
|
682 |
}
|
| - |
|
683 |
|
| - |
|
684 |
@RequestMapping(value = "/store/generateInvoice", method = RequestMethod.GET)
|
| - |
|
685 |
public ResponseEntity<?> generateInvoice(HttpServletRequest request,
|
| - |
|
686 |
@RequestParam(name = ProfitMandiConstants.ORDER_ID) int orderId) throws ProfitMandiBusinessException {
|
| - |
|
687 |
PdfModel pdfModel = null;
|
| - |
|
688 |
FofoOrder fo = fofoOrderRepository.selectByOrderId(orderId);
|
| - |
|
689 |
pdfModel = orderService.getInvoicePdfModel(fo.getFofoId(), orderId);
|
| - |
|
690 |
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
| - |
|
691 |
PdfUtils.generateAndWrite(Arrays.asList(pdfModel), byteArrayOutputStream);
|
| - |
|
692 |
try {
|
| - |
|
693 |
byteArrayOutputStream.close();
|
| - |
|
694 |
} catch (IOException e) {
|
| - |
|
695 |
// TODO Auto-generated catch block
|
| - |
|
696 |
e.printStackTrace();
|
| - |
|
697 |
}
|
| - |
|
698 |
final HttpHeaders headers = new HttpHeaders();
|
| - |
|
699 |
headers.setContentType(MediaType.APPLICATION_PDF);
|
| - |
|
700 |
// headers.setCacheControl("must-revalidate, post-check=0, pre-check=0");
|
| - |
|
701 |
|
| - |
|
702 |
headers.setContentType(MediaType.parseMediaType("application/pdf"));
|
| - |
|
703 |
headers.set("Content-disposition", "inline; filename=invoice-" + pdfModel.getInvoiceNumber() + ".pdf");
|
| - |
|
704 |
headers.add("Cache-Control", "no-cache, no-store, must-revalidate");
|
| - |
|
705 |
headers.add("Pragma", "no-cache");
|
| - |
|
706 |
headers.add("Expires", "0");
|
| - |
|
707 |
|
| - |
|
708 |
headers.setContentLength(byteArrayOutputStream.toByteArray().length);
|
| - |
|
709 |
final InputStream inputStream = new ByteArrayInputStream(byteArrayOutputStream.toByteArray());
|
| - |
|
710 |
final InputStreamResource inputStreamResource = new InputStreamResource(inputStream);
|
| - |
|
711 |
return new ResponseEntity<>(inputStreamResource, headers, HttpStatus.OK);
|
| - |
|
712 |
// return responseSender.ok(new
|
| - |
|
713 |
// ResponseEntity<byte[]>(byteArrayOutputStream.toByteArray(),
|
| - |
|
714 |
// headers,HttpStatus.OK));
|
| - |
|
715 |
/*
|
| - |
|
716 |
* ResponseEntity<byte[]> response = new
|
| - |
|
717 |
* ResponseEntity<byte[]>(byteArrayOutputStream.toByteArray(), headers,
|
| - |
|
718 |
* HttpStatus.OK); return response;
|
| - |
|
719 |
*/
|
| - |
|
720 |
|
| - |
|
721 |
}
|
| - |
|
722 |
|
| 561 |
@RequestMapping(value = "/store/listing", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
723 |
@RequestMapping(value = "/store/listing", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
| 562 |
public ResponseEntity<?> getStoresListing(HttpServletRequest request) throws Exception {
|
724 |
public ResponseEntity<?> getStoresListing(HttpServletRequest request) throws Exception {
|
| 563 |
List<WebListing> webListings = webListingRepository.selectAllWebListing(Optional.of(true));
|
725 |
List<WebListing> webListings = webListingRepository.selectAllWebListing(Optional.of(true));
|
| 564 |
UserInfo userInfo = (UserInfo) request.getAttribute("userInfo");
|
726 |
UserInfo userInfo = (UserInfo) request.getAttribute("userInfo");
|
| 565 |
for (WebListing webListing : webListings) {
|
727 |
for (WebListing webListing : webListings) {
|
| Line 953... |
Line 1115... |
| 953 |
|
1115 |
|
| 954 |
return responseSender.ok(true);
|
1116 |
return responseSender.ok(true);
|
| 955 |
|
1117 |
|
| 956 |
}
|
1118 |
}
|
| 957 |
|
1119 |
|
| 958 |
}
|
- |
|
| 959 |
|
- |
|
| 960 |
class UserModel {
|
1120 |
class UserModel {
|
| 961 |
@JsonProperty(required = true)
|
1121 |
@JsonProperty(required = true)
|
| 962 |
private String mobile;
|
1122 |
private String mobile;
|
| 963 |
@JsonProperty(required = true)
|
1123 |
@JsonProperty(required = true)
|
| 964 |
private String password;
|
1124 |
private String password;
|
| 965 |
@JsonProperty(required = false)
|
1125 |
@JsonProperty(required = false)
|
| 966 |
private String firstName;
|
1126 |
private String firstName;
|
| 967 |
@JsonProperty(required = false)
|
1127 |
@JsonProperty(required = false)
|
| 968 |
private String lastName;
|
1128 |
private String lastName;
|
| 969 |
@JsonProperty(required = false)
|
1129 |
@JsonProperty(required = false)
|
| 970 |
private String email;
|
1130 |
private String email;
|
| - |
|
1131 |
|
| - |
|
1132 |
@Override
|
| - |
|
1133 |
public String toString() {
|
| - |
|
1134 |
return "UserModel [mobile=" + mobile + ", password=" + password + "]";
|
| - |
|
1135 |
}
|
| 971 |
|
1136 |
|
| 972 |
@Override
|
- |
|
| 973 |
public String toString() {
|
1137 |
public String getMobile() {
|
| 974 |
return "UserModel [mobile=" + mobile + ", password=" + password + "]";
|
1138 |
return mobile;
|
| 975 |
}
|
1139 |
}
|
| 976 |
|
1140 |
|
| 977 |
public String getMobile() {
|
1141 |
public void setMobile(String mobile) {
|
| 978 |
return mobile;
|
1142 |
this.mobile = mobile;
|
| 979 |
}
|
1143 |
}
|
| 980 |
|
1144 |
|
| 981 |
public void setMobile(String mobile) {
|
1145 |
public String getPassword() {
|
| 982 |
this.mobile = mobile;
|
1146 |
return password;
|
| 983 |
}
|
1147 |
}
|
| 984 |
|
1148 |
|
| 985 |
public String getPassword() {
|
1149 |
public void setPassword(String password) {
|
| 986 |
return password;
|
1150 |
this.password = password;
|
| 987 |
}
|
1151 |
}
|
| 988 |
|
1152 |
|
| 989 |
public void setPassword(String password) {
|
1153 |
public String getFirstName() {
|
| 990 |
this.password = password;
|
1154 |
return firstName;
|
| 991 |
}
|
1155 |
}
|
| 992 |
|
1156 |
|
| 993 |
public String getFirstName() {
|
1157 |
public void setFirstName(String firstName) {
|
| 994 |
return firstName;
|
1158 |
this.firstName = firstName;
|
| 995 |
}
|
1159 |
}
|
| 996 |
|
1160 |
|
| 997 |
public void setFirstName(String firstName) {
|
1161 |
public String getLastName() {
|
| 998 |
this.firstName = firstName;
|
1162 |
return lastName;
|
| 999 |
}
|
1163 |
}
|
| 1000 |
|
1164 |
|
| 1001 |
public String getLastName() {
|
1165 |
public void setLastName(String lastName) {
|
| 1002 |
return lastName;
|
1166 |
this.lastName = lastName;
|
| 1003 |
}
|
1167 |
}
|
| 1004 |
|
1168 |
|
| 1005 |
public void setLastName(String lastName) {
|
1169 |
public String getEmail() {
|
| 1006 |
this.lastName = lastName;
|
1170 |
return email;
|
| 1007 |
}
|
1171 |
}
|
| 1008 |
|
1172 |
|
| 1009 |
public String getEmail() {
|
1173 |
public void setEmail(String email) {
|
| 1010 |
return email;
|
1174 |
this.email = email;
|
| 1011 |
}
|
1175 |
}
|
| 1012 |
|
1176 |
|
| 1013 |
public void setEmail(String email) {
|
- |
|
| 1014 |
this.email = email;
|
- |
|
| 1015 |
}
|
1177 |
}
|
| 1016 |
|
1178 |
|
| 1017 |
}
|
- |
|
| 1018 |
|
- |
|
| 1019 |
class CustomerModel {
|
1179 |
class CustomerModel {
|
| 1020 |
|
1180 |
|
| 1021 |
@JsonProperty(required = false)
|
1181 |
@JsonProperty(required = false)
|
| 1022 |
private Customer customer;
|
1182 |
private Customer customer;
|
| 1023 |
@JsonProperty(required = true)
|
1183 |
@JsonProperty(required = true)
|
| 1024 |
private boolean exists;
|
1184 |
private boolean exists;
|
| 1025 |
|
1185 |
|
| 1026 |
public CustomerModel(boolean exists, Customer customer) {
|
1186 |
public CustomerModel(boolean exists, Customer customer) {
|
| 1027 |
super();
|
1187 |
super();
|
| 1028 |
this.customer = customer;
|
1188 |
this.customer = customer;
|
| 1029 |
this.exists = exists;
|
1189 |
this.exists = exists;
|
| 1030 |
}
|
1190 |
}
|
| 1031 |
|
1191 |
|
| 1032 |
@Override
|
1192 |
@Override
|
| 1033 |
public String toString() {
|
1193 |
public String toString() {
|
| 1034 |
return "CustomerModel [customer=" + customer + ", exists=" + exists + "]";
|
1194 |
return "CustomerModel [customer=" + customer + ", exists=" + exists + "]";
|
| 1035 |
}
|
1195 |
}
|
| 1036 |
|
1196 |
|
| 1037 |
public Customer getCustomer() {
|
1197 |
public Customer getCustomer() {
|
| 1038 |
return customer;
|
1198 |
return customer;
|
| 1039 |
}
|
1199 |
}
|
| 1040 |
|
1200 |
|
| 1041 |
public void setCustomer(Customer customer) {
|
1201 |
public void setCustomer(Customer customer) {
|
| 1042 |
this.customer = customer;
|
1202 |
this.customer = customer;
|
| 1043 |
}
|
1203 |
}
|
| 1044 |
|
1204 |
|
| 1045 |
public boolean isExists() {
|
1205 |
public boolean isExists() {
|
| 1046 |
return exists;
|
1206 |
return exists;
|
| 1047 |
}
|
1207 |
}
|
| 1048 |
|
1208 |
|
| 1049 |
public void setExists(boolean exists) {
|
1209 |
public void setExists(boolean exists) {
|
| 1050 |
this.exists = exists;
|
1210 |
this.exists = exists;
|
| - |
|
1211 |
}
|
| 1051 |
}
|
1212 |
}
|
| 1052 |
}
|
1213 |
}
|
| 1053 |
|
1214 |
|