| Line 5... |
Line 5... |
| 5 |
import java.io.FileNotFoundException;
|
5 |
import java.io.FileNotFoundException;
|
| 6 |
import java.util.Map;
|
6 |
import java.util.Map;
|
| 7 |
|
7 |
|
| 8 |
import javax.servlet.http.HttpServletRequest;
|
8 |
import javax.servlet.http.HttpServletRequest;
|
| 9 |
|
9 |
|
| 10 |
import org.apache.logging.log4j.LogManager;
|
- |
|
| 11 |
import org.apache.logging.log4j.Logger;
|
10 |
import org.apache.logging.log4j.Logger;
|
| - |
|
11 |
import org.apache.logging.log4j.LogManager;
|
| 12 |
import org.springframework.beans.factory.annotation.Autowired;
|
12 |
import org.springframework.beans.factory.annotation.Autowired;
|
| 13 |
import org.springframework.core.io.InputStreamResource;
|
13 |
import org.springframework.core.io.InputStreamResource;
|
| 14 |
import org.springframework.http.HttpHeaders;
|
14 |
import org.springframework.http.HttpHeaders;
|
| 15 |
import org.springframework.http.HttpStatus;
|
15 |
import org.springframework.http.HttpStatus;
|
| 16 |
import org.springframework.http.ResponseEntity;
|
16 |
import org.springframework.http.ResponseEntity;
|
| Line 21... |
Line 21... |
| 21 |
import org.springframework.web.bind.annotation.RequestMapping;
|
21 |
import org.springframework.web.bind.annotation.RequestMapping;
|
| 22 |
import org.springframework.web.bind.annotation.RequestMethod;
|
22 |
import org.springframework.web.bind.annotation.RequestMethod;
|
| 23 |
import org.springframework.web.bind.annotation.RequestParam;
|
23 |
import org.springframework.web.bind.annotation.RequestParam;
|
| 24 |
|
24 |
|
| 25 |
import com.spice.profitmandi.common.enumuration.ContentType;
|
25 |
import com.spice.profitmandi.common.enumuration.ContentType;
|
| - |
|
26 |
import com.spice.profitmandi.common.enumuration.CounterSize;
|
| 26 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
27 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| 27 |
import com.spice.profitmandi.common.model.Location;
|
- |
|
| 28 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
28 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
| 29 |
import com.spice.profitmandi.common.model.UpdateRetailerRequest;
|
29 |
import com.spice.profitmandi.common.model.UpdateRetailerRequest;
|
| 30 |
import com.spice.profitmandi.common.web.util.ResponseSender;
|
30 |
import com.spice.profitmandi.common.web.util.ResponseSender;
|
| 31 |
import com.spice.profitmandi.dao.entity.dtr.Document;
|
31 |
import com.spice.profitmandi.dao.entity.dtr.Document;
|
| 32 |
import com.spice.profitmandi.dao.entity.dtr.Retailer;
|
32 |
import com.spice.profitmandi.dao.entity.dtr.Retailer;
|
| 33 |
import com.spice.profitmandi.dao.entity.dtr.Shop;
|
33 |
import com.spice.profitmandi.dao.entity.dtr.Shop;
|
| 34 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
- |
|
| 35 |
import com.spice.profitmandi.dao.repository.dtr.DocumentRepository;
|
34 |
import com.spice.profitmandi.dao.repository.dtr.DocumentRepository;
|
| 36 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
- |
|
| 37 |
import com.spice.profitmandi.dao.repository.dtr.RetailerRepository;
|
35 |
import com.spice.profitmandi.dao.repository.dtr.RetailerRepository;
|
| 38 |
import com.spice.profitmandi.dao.repository.dtr.ShopRepository;
|
36 |
import com.spice.profitmandi.dao.repository.dtr.ShopRepository;
|
| 39 |
import com.spice.profitmandi.service.user.RetailerService;
|
37 |
import com.spice.profitmandi.service.user.RetailerService;
|
| 40 |
import com.spice.profitmandi.web.model.LoginDetails;
|
- |
|
| 41 |
import com.spice.profitmandi.web.util.CookiesProcessor;
|
- |
|
| 42 |
|
38 |
|
| 43 |
@Controller
|
39 |
@Controller
|
| 44 |
@Transactional(rollbackFor = Throwable.class)
|
40 |
@Transactional(rollbackFor=Throwable.class)
|
| 45 |
public class RetailerController {
|
41 |
public class RetailerController {
|
| 46 |
|
42 |
|
| 47 |
private static final Logger LOGGER = LogManager.getLogger(RetailerController.class);
|
43 |
private static final Logger LOGGER = LogManager.getLogger(RetailerController.class);
|
| 48 |
|
44 |
|
| 49 |
@Autowired
|
45 |
@Autowired
|
| 50 |
private RetailerService retailerService;
|
46 |
private RetailerService retailerService;
|
| 51 |
|
47 |
|
| 52 |
@Autowired
|
48 |
@Autowired
|
| 53 |
private RetailerRepository retailerRepository;
|
49 |
private RetailerRepository retailerRepository;
|
| 54 |
|
50 |
|
| 55 |
@Autowired
|
51 |
@Autowired
|
| 56 |
private ShopRepository shopRepository;
|
52 |
private ShopRepository shopRepository;
|
| 57 |
|
53 |
|
| 58 |
@Autowired
|
54 |
@Autowired
|
| 59 |
private FofoStoreRepository fofoStoreRepository;
|
- |
|
| 60 |
|
- |
|
| 61 |
@Autowired
|
- |
|
| 62 |
private DocumentRepository documentRepository;
|
55 |
private DocumentRepository documentRepository;
|
| 63 |
|
56 |
|
| 64 |
@Autowired
|
57 |
@Autowired
|
| 65 |
private ResponseSender<?> responseSender;
|
58 |
private ResponseSender<?> responseSender;
|
| 66 |
|
59 |
|
| 67 |
@Autowired
|
- |
|
| 68 |
private CookiesProcessor cookiesProcessor;
|
- |
|
| 69 |
|
- |
|
| 70 |
@RequestMapping(value = "/retailerDetails", method = RequestMethod.GET)
|
60 |
@RequestMapping(value = "/retailerDetails", method = RequestMethod.GET)
|
| 71 |
public String retailerInfoByEmailIdOrMobileNumber(HttpServletRequest request,
|
- |
|
| 72 |
@RequestParam(name = ProfitMandiConstants.EMAIL_ID_OR_MOBILE_NUMBER) String emailIdOrMobileNumber,
|
61 |
public String retailerInfoByEmailIdOrMobileNumber(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.EMAIL_ID_OR_MOBILE_NUMBER) String emailIdOrMobileNumber, Model model) throws ProfitMandiBusinessException{
|
| 73 |
Model model) throws ProfitMandiBusinessException {
|
- |
|
| 74 |
LOGGER.info("Request Received at url {} with emailIdOrMobileNumber {}", request.getRequestURI(),
|
62 |
LOGGER.info("Request Received at url {} with emailIdOrMobileNumber {}", request.getRequestURI(), emailIdOrMobileNumber);
|
| 75 |
emailIdOrMobileNumber);
|
- |
|
| 76 |
Map<String, Object> map = retailerService.getByEmailIdOrMobileNumber(emailIdOrMobileNumber);
|
63 |
Map<String, Object> map = retailerService.getByEmailIdOrMobileNumber(emailIdOrMobileNumber);
|
| 77 |
model.addAllAttributes(map);
|
64 |
model.addAllAttributes(map);
|
| - |
|
65 |
model.addAttribute("counterSizes", CounterSize.values());
|
| 78 |
return "retailer-details";
|
66 |
return "retailer-details";
|
| 79 |
}
|
67 |
}
|
| 80 |
|
68 |
|
| 81 |
@RequestMapping(value = "/retailerDetails", method = RequestMethod.PUT)
|
69 |
@RequestMapping(value = "/retailerDetails", method = RequestMethod.PUT)
|
| 82 |
public String updateRetailerDetails(HttpServletRequest request,
|
- |
|
| 83 |
@RequestBody UpdateRetailerRequest updateRetailerRequest, Model model) throws ProfitMandiBusinessException {
|
70 |
public String updateRetailerDetails(HttpServletRequest request, @RequestBody UpdateRetailerRequest updateRetailerRequest, Model model) throws ProfitMandiBusinessException{
|
| 84 |
LOGGER.info("Request Received at url {} with body {}", request.getRequestURI(), updateRetailerRequest);
|
71 |
LOGGER.info("Request Received at url {} with body {}", request.getRequestURI(), updateRetailerRequest);
|
| 85 |
Map<String, Object> map = retailerService.updateRetailerDetails(updateRetailerRequest);
|
72 |
Map<String, Object> map = retailerService.updateRetailerDetails(updateRetailerRequest);
|
| 86 |
model.addAllAttributes(map);
|
73 |
model.addAllAttributes(map);
|
| - |
|
74 |
model.addAttribute("counterSizes", CounterSize.values());
|
| 87 |
return "retailer-details";
|
75 |
return "retailer-details";
|
| 88 |
}
|
76 |
}
|
| - |
|
77 |
|
| 89 |
|
78 |
|
| 90 |
@RequestMapping(value = "/retailerInfo", method = RequestMethod.GET)
|
79 |
@RequestMapping(value = "/retailerInfo", method = RequestMethod.GET)
|
| 91 |
public String retailerInfo(HttpServletRequest request) throws Exception {
|
80 |
public String retailerInfo(HttpServletRequest request) throws Exception{
|
| 92 |
return "retailer-info";
|
81 |
return "retailer-info";
|
| 93 |
}
|
82 |
}
|
| 94 |
|
83 |
|
| 95 |
@RequestMapping(value = "/district/all/stateName", method = RequestMethod.GET)
|
84 |
@RequestMapping(value = "/district/all/stateName", method = RequestMethod.GET)
|
| 96 |
public ResponseEntity<?> getAllDistrict(@RequestParam(name = "stateName") String stateName) {
|
85 |
public ResponseEntity<?> getAllDistrict(@RequestParam(name = "stateName") String stateName){
|
| 97 |
return responseSender.ok(retailerService.getAllDistrictMaster(stateName));
|
86 |
return responseSender.ok(retailerService.getAllDistrictMaster(stateName));
|
| 98 |
}
|
87 |
}
|
| 99 |
|
88 |
|
| 100 |
@RequestMapping(value = "/retailerDocument/documentId", method = RequestMethod.GET)
|
89 |
@RequestMapping(value = "/retailerDocument/documentId", method = RequestMethod.GET)
|
| 101 |
public ResponseEntity<?> retailerDocumentById(HttpServletRequest request,
|
- |
|
| 102 |
@RequestParam(name = ProfitMandiConstants.DOCUMENT_ID) int documentId,
|
- |
|
| 103 |
@RequestParam(name = ProfitMandiConstants.RETAILER_ID) int retailerId) throws ProfitMandiBusinessException {
|
90 |
public ResponseEntity<?> retailerDocumentById(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.DOCUMENT_ID) int documentId, @RequestParam(name = ProfitMandiConstants.RETAILER_ID) int retailerId) throws ProfitMandiBusinessException{
|
| 104 |
Document document = documentRepository.selectById(documentId);
|
91 |
Document document = documentRepository.selectById(documentId);
|
| 105 |
Retailer retailer = retailerRepository.selectById(retailerId);
|
92 |
Retailer retailer = retailerRepository.selectById(retailerId);
|
| 106 |
|
93 |
|
| 107 |
if (retailer.getDocumentId() == null) {
|
94 |
if(retailer.getDocumentId() == null) {
|
| 108 |
throw new ProfitMandiBusinessException(ProfitMandiConstants.RETAILER_ID, retailer.getId(), "RTLR_1012");
|
95 |
throw new ProfitMandiBusinessException(ProfitMandiConstants.RETAILER_ID, retailer.getId(), "RTLR_1012");
|
| 109 |
}
|
96 |
}
|
| 110 |
if (retailer.getDocumentId() != documentId) {
|
97 |
if(retailer.getDocumentId() != documentId) {
|
| 111 |
throw new ProfitMandiBusinessException(ProfitMandiConstants.DOCUMENT_ID, documentId, "RTLR_1014");
|
98 |
throw new ProfitMandiBusinessException(ProfitMandiConstants.DOCUMENT_ID, documentId, "RTLR_1014");
|
| 112 |
}
|
99 |
}
|
| 113 |
return responseSender.ok(document);
|
100 |
return responseSender.ok(document);
|
| 114 |
}
|
101 |
}
|
| 115 |
|
102 |
|
| 116 |
@RequestMapping(value = "/retailerDocument/download", method = RequestMethod.GET)
|
103 |
@RequestMapping(value = "/retailerDocument/download", method = RequestMethod.GET)
|
| 117 |
public ResponseEntity<?> downloadRetailerDocument(HttpServletRequest request,
|
- |
|
| 118 |
@RequestParam(name = ProfitMandiConstants.RETAILER_ID) int retailerId, Model model)
|
104 |
public ResponseEntity<?> downloadRetailerDocument(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.RETAILER_ID) int retailerId, Model model) throws ProfitMandiBusinessException{
|
| 119 |
throws ProfitMandiBusinessException {
|
- |
|
| 120 |
|
105 |
|
| 121 |
Retailer retailer = retailerRepository.selectById(retailerId);
|
106 |
Retailer retailer = retailerRepository.selectById(retailerId);
|
| 122 |
|
107 |
|
| 123 |
if (retailer.getDocumentId() == null) {
|
108 |
if(retailer.getDocumentId() == null) {
|
| 124 |
throw new ProfitMandiBusinessException(ProfitMandiConstants.RETAILER_ID, retailer.getId(), "RTLR_1012");
|
109 |
throw new ProfitMandiBusinessException(ProfitMandiConstants.RETAILER_ID, retailer.getId(), "RTLR_1012");
|
| 125 |
}
|
110 |
}
|
| 126 |
|
111 |
|
| 127 |
Document document = documentRepository.selectById(retailer.getDocumentId());
|
112 |
Document document = documentRepository.selectById(retailer.getDocumentId());
|
| 128 |
|
113 |
|
| 129 |
FileInputStream file = null;
|
114 |
FileInputStream file = null;
|
| 130 |
try {
|
115 |
try {
|
| 131 |
file = new FileInputStream(document.getPath() + File.separator + document.getName());
|
116 |
file = new FileInputStream(document.getPath() + File.separator + document.getName());
|
| 132 |
} catch (FileNotFoundException e) {
|
117 |
} catch (FileNotFoundException e) {
|
| 133 |
LOGGER.error("Retailer Document file not found : ", e);
|
118 |
LOGGER.error("Retailer Document file not found : ", e);
|
| 134 |
throw new ProfitMandiBusinessException(ProfitMandiConstants.DOCUMENT_ID, document.getId(), "RTLR_1013");
|
119 |
throw new ProfitMandiBusinessException(ProfitMandiConstants.DOCUMENT_ID, document.getId(), "RTLR_1013");
|
| 135 |
}
|
120 |
}
|
| 136 |
// ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
121 |
//ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
| 137 |
// ExcelUtils.writeSchemeModels(schemeModels, byteArrayOutputStream);
|
122 |
//ExcelUtils.writeSchemeModels(schemeModels, byteArrayOutputStream);
|
| 138 |
|
123 |
|
| 139 |
final HttpHeaders headers = new HttpHeaders();
|
124 |
final HttpHeaders headers=new HttpHeaders();
|
| 140 |
String contentType = "";
|
125 |
String contentType = "";
|
| 141 |
if (document.getContentType() == ContentType.JPEG) {
|
126 |
if(document.getContentType() == ContentType.JPEG) {
|
| 142 |
contentType = "image/jpeg";
|
127 |
contentType = "image/jpeg";
|
| 143 |
} else if (document.getContentType() == ContentType.PNG) {
|
128 |
}else if(document.getContentType() == ContentType.PNG) {
|
| 144 |
contentType = "image/png";
|
129 |
contentType = "image/png";
|
| 145 |
} else if (document.getContentType() == ContentType.PDF) {
|
130 |
}else if(document.getContentType() == ContentType.PDF) {
|
| 146 |
contentType = "application/pdf";
|
131 |
contentType = "application/pdf";
|
| 147 |
}
|
132 |
}
|
| 148 |
headers.set("Content-Type", contentType);
|
133 |
headers.set("Content-Type", contentType);
|
| 149 |
headers.set("Content-disposition", "inline; filename=" + document.getName());
|
134 |
headers.set("Content-disposition", "inline; filename="+document.getName());
|
| 150 |
headers.setContentLength(document.getSize());
|
135 |
headers.setContentLength(document.getSize());
|
| 151 |
final InputStreamResource inputStreamResource = new InputStreamResource(file);
|
136 |
final InputStreamResource inputStreamResource=new InputStreamResource(file);
|
| 152 |
return new ResponseEntity<InputStreamResource>(inputStreamResource, headers, HttpStatus.OK);
|
137 |
return new ResponseEntity<InputStreamResource>(inputStreamResource, headers, HttpStatus.OK);
|
| 153 |
|
138 |
|
| 154 |
// return responseSender.ok(ResponseCodeHolder.getMessage("ITM_AGNG_OK_1000"));
|
139 |
//return responseSender.ok(ResponseCodeHolder.getMessage("ITM_AGNG_OK_1000"));
|
| 155 |
}
|
140 |
}
|
| 156 |
|
141 |
|
| 157 |
@RequestMapping(value = "/retailerShopDocument/shopId", method = RequestMethod.GET)
|
142 |
@RequestMapping(value = "/retailerShopDocument/shopId", method = RequestMethod.GET)
|
| 158 |
public ResponseEntity<?> retailerShopDocumentById(HttpServletRequest request,
|
- |
|
| 159 |
@RequestParam(name = ProfitMandiConstants.SHOP_ID) int shopId,
|
- |
|
| 160 |
@RequestParam(name = ProfitMandiConstants.RETAILER_ID) int retailerId) throws ProfitMandiBusinessException {
|
143 |
public ResponseEntity<?> retailerShopDocumentById(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.SHOP_ID) int shopId, @RequestParam(name = ProfitMandiConstants.RETAILER_ID) int retailerId) throws ProfitMandiBusinessException{
|
| 161 |
Shop shop = shopRepository.selectById(shopId);
|
144 |
Shop shop = shopRepository.selectById(shopId);
|
| 162 |
|
145 |
|
| 163 |
if (shop.getRetailerId() != retailerId) {
|
146 |
if(shop.getRetailerId() != retailerId) {
|
| 164 |
throw new ProfitMandiBusinessException(ProfitMandiConstants.SHOP_ID, shop.getId(), "SHP_1004");
|
147 |
throw new ProfitMandiBusinessException(ProfitMandiConstants.SHOP_ID, shop.getId(), "SHP_1004");
|
| 165 |
}
|
148 |
}
|
| 166 |
|
149 |
|
| 167 |
if (shop.getDocumentId() == null) {
|
150 |
if(shop.getDocumentId() == null) {
|
| 168 |
throw new ProfitMandiBusinessException(ProfitMandiConstants.RETAILER_ID, shop.getId(), "SHP_1005");
|
151 |
throw new ProfitMandiBusinessException(ProfitMandiConstants.RETAILER_ID, shop.getId(), "SHP_1005");
|
| 169 |
}
|
152 |
}
|
| 170 |
|
153 |
|
| 171 |
Document document = documentRepository.selectById(shop.getDocumentId());
|
154 |
Document document = documentRepository.selectById(shop.getDocumentId());
|
| 172 |
return responseSender.ok(document);
|
155 |
return responseSender.ok(document);
|
| 173 |
}
|
156 |
}
|
| 174 |
|
157 |
|
| 175 |
@RequestMapping(value = "/retailerShopDocument/download", method = RequestMethod.GET)
|
158 |
@RequestMapping(value = "/retailerShopDocument/download", method = RequestMethod.GET)
|
| 176 |
public ResponseEntity<?> downloadRetailerShopDocument(HttpServletRequest request,
|
- |
|
| 177 |
@RequestParam(name = ProfitMandiConstants.SHOP_ID) int shopId,
|
- |
|
| 178 |
@RequestParam(name = ProfitMandiConstants.RETAILER_ID) int retailerId, Model model)
|
159 |
public ResponseEntity<?> downloadRetailerShopDocument(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.SHOP_ID) int shopId, @RequestParam(name = ProfitMandiConstants.RETAILER_ID) int retailerId, Model model) throws ProfitMandiBusinessException{
|
| 179 |
throws ProfitMandiBusinessException {
|
- |
|
| 180 |
|
160 |
|
| 181 |
Shop shop = shopRepository.selectById(shopId);
|
161 |
Shop shop = shopRepository.selectById(shopId);
|
| 182 |
|
162 |
|
| 183 |
if (shop.getRetailerId() != retailerId) {
|
163 |
if(shop.getRetailerId() != retailerId) {
|
| 184 |
throw new ProfitMandiBusinessException(ProfitMandiConstants.SHOP_ID, shop.getId(), "SHP_1004");
|
164 |
throw new ProfitMandiBusinessException(ProfitMandiConstants.SHOP_ID, shop.getId(), "SHP_1004");
|
| 185 |
}
|
165 |
}
|
| 186 |
|
166 |
|
| 187 |
if (shop.getDocumentId() == null) {
|
167 |
if(shop.getDocumentId() == null) {
|
| 188 |
throw new ProfitMandiBusinessException(ProfitMandiConstants.RETAILER_ID, shop.getId(), "SHP_1005");
|
168 |
throw new ProfitMandiBusinessException(ProfitMandiConstants.RETAILER_ID, shop.getId(), "SHP_1005");
|
| 189 |
}
|
169 |
}
|
| 190 |
|
170 |
|
| 191 |
Document document = documentRepository.selectById(shop.getDocumentId());
|
171 |
Document document = documentRepository.selectById(shop.getDocumentId());
|
| 192 |
|
172 |
|
| 193 |
FileInputStream file = null;
|
173 |
FileInputStream file = null;
|
| 194 |
try {
|
174 |
try {
|
| 195 |
file = new FileInputStream(document.getPath() + File.separator + document.getName());
|
175 |
file = new FileInputStream(document.getPath() + File.separator + document.getName());
|
| 196 |
} catch (FileNotFoundException e) {
|
176 |
} catch (FileNotFoundException e) {
|
| 197 |
LOGGER.error("Retailer Document file not found : ", e);
|
177 |
LOGGER.error("Retailer Document file not found : ", e);
|
| 198 |
throw new ProfitMandiBusinessException(ProfitMandiConstants.DOCUMENT_ID, document.getId(), "RTLR_1013");
|
178 |
throw new ProfitMandiBusinessException(ProfitMandiConstants.DOCUMENT_ID, document.getId(), "RTLR_1013");
|
| 199 |
}
|
179 |
}
|
| 200 |
// ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
180 |
//ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
| 201 |
// ExcelUtils.writeSchemeModels(schemeModels, byteArrayOutputStream);
|
181 |
//ExcelUtils.writeSchemeModels(schemeModels, byteArrayOutputStream);
|
| 202 |
|
182 |
|
| 203 |
final HttpHeaders headers = new HttpHeaders();
|
183 |
final HttpHeaders headers=new HttpHeaders();
|
| 204 |
String contentType = "";
|
184 |
String contentType = "";
|
| 205 |
if (document.getContentType() == ContentType.JPEG) {
|
185 |
if(document.getContentType() == ContentType.JPEG) {
|
| 206 |
contentType = "image/jpeg";
|
186 |
contentType = "image/jpeg";
|
| 207 |
} else if (document.getContentType() == ContentType.PNG) {
|
187 |
}else if(document.getContentType() == ContentType.PNG) {
|
| 208 |
contentType = "image/png";
|
188 |
contentType = "image/png";
|
| 209 |
} else if (document.getContentType() == ContentType.PDF) {
|
189 |
}else if(document.getContentType() == ContentType.PDF) {
|
| 210 |
contentType = "application/pdf";
|
190 |
contentType = "application/pdf";
|
| 211 |
}
|
191 |
}
|
| 212 |
headers.set("Content-Type", contentType);
|
192 |
headers.set("Content-Type", contentType);
|
| 213 |
headers.set("Content-disposition", "inline; filename=" + document.getName());
|
193 |
headers.set("Content-disposition", "inline; filename="+document.getName());
|
| 214 |
headers.setContentLength(document.getSize());
|
194 |
headers.setContentLength(document.getSize());
|
| 215 |
final InputStreamResource inputStreamResource = new InputStreamResource(file);
|
195 |
final InputStreamResource inputStreamResource=new InputStreamResource(file);
|
| 216 |
return new ResponseEntity<InputStreamResource>(inputStreamResource, headers, HttpStatus.OK);
|
196 |
return new ResponseEntity<InputStreamResource>(inputStreamResource, headers, HttpStatus.OK);
|
| 217 |
|
197 |
|
| 218 |
// return responseSender.ok(ResponseCodeHolder.getMessage("ITM_AGNG_OK_1000"));
|
198 |
//return responseSender.ok(ResponseCodeHolder.getMessage("ITM_AGNG_OK_1000"));
|
| 219 |
}
|
- |
|
| 220 |
|
- |
|
| 221 |
@RequestMapping(value = "/partner/location", method = RequestMethod.PUT)
|
- |
|
| 222 |
public ResponseEntity<?> updateLocation(HttpServletRequest request, @RequestBody Location location) throws ProfitMandiBusinessException{
|
- |
|
| 223 |
LoginDetails fofoDetails = cookiesProcessor.getCookiesObject(request);
|
- |
|
| 224 |
FofoStore fs = fofoStoreRepository.selectByRetailerId(fofoDetails.getFofoId());
|
- |
|
| 225 |
fs.setLatitude(location.getLatitude());
|
- |
|
| 226 |
fs.setLongitude(location.getLongitude());
|
- |
|
| 227 |
fofoStoreRepository.persist(fs);
|
- |
|
| 228 |
return responseSender.ok(true);
|
- |
|
| 229 |
}
|
199 |
}
|
| 230 |
}
|
200 |
}
|
| 231 |
|
201 |
|