Subversion Repositories SmartDukaan

Rev

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

Rev 30568 Rev 30570
Line 125... Line 125...
125
				} else {
125
				} else {
126
					Map<String, String> headersMap = new HashMap<>();
126
					Map<String, String> headersMap = new HashMap<>();
127
					headersMap.put("Authorization", "Basic " + Base64.getEncoder().encodeToString("smartdukaan:$smart@123#".getBytes()));
127
					headersMap.put("Authorization", "Basic " + Base64.getEncoder().encodeToString("smartdukaan:$smart@123#".getBytes()));
128
					if (invoiceNumbers.size() == 1) {
128
					if (invoiceNumbers.size() == 1) {
129
						String invoicePath = this.getInvoicePath(invoiceOrdersMap.get(invoiceNumbers.get(0)).get(0));
129
						String invoicePath = this.getInvoicePath(invoiceOrdersMap.get(invoiceNumbers.get(0)).get(0));
130
						HttpResponse response = restClient.getResponse("http://192.168.202.177/" + invoicePath, null, headersMap);
130
						HttpResponse response = restClient.getResponse("http://45.79.106.95/" + invoicePath, null, headersMap);
131
						InputStreamResource is = new InputStreamResource(response.getEntity().getContent());
131
						InputStreamResource is = new InputStreamResource(response.getEntity().getContent());
132
						return new ResponseEntity<>(is, headers, HttpStatus.OK);
132
						return new ResponseEntity<>(is, headers, HttpStatus.OK);
133
 
133
 
134
					} else {
134
					} else {
135
 
135
 
Line 137... Line 137...
137
						ZipOutputStream zipOut = new ZipOutputStream(fos);
137
						ZipOutputStream zipOut = new ZipOutputStream(fos);
138
 
138
 
139
						for (String invoice : invoiceNumbers) {
139
						for (String invoice : invoiceNumbers) {
140
							List<Order> orders = invoiceOrdersMap.get(invoice);
140
							List<Order> orders = invoiceOrdersMap.get(invoice);
141
							String invoicePath = this.getInvoicePath(orders.get(0));
141
							String invoicePath = this.getInvoicePath(orders.get(0));
142
							HttpResponse response = restClient.getResponse("http://192.168.202.177/" + invoicePath, null, headersMap);
142
							HttpResponse response = restClient.getResponse("http://45.79.106.95/" + invoicePath, null, headersMap);
143
							this.addFileToZip(zipOut, response.getEntity().getContent(), invoice + ".pdf");
143
							this.addFileToZip(zipOut, response.getEntity().getContent(), invoice + ".pdf");
144
						}
144
						}
145
						zipOut.close();
145
						zipOut.close();
146
						byte[] byteArray = fos.toByteArray();
146
						byte[] byteArray = fos.toByteArray();
147
						headers.set("Content-Type", ContentType.APPLICATION_OCTET_STREAM.getMimeType());
147
						headers.set("Content-Type", ContentType.APPLICATION_OCTET_STREAM.getMimeType());