| Line 4... |
Line 4... |
| 4 |
import java.io.ByteArrayOutputStream;
|
4 |
import java.io.ByteArrayOutputStream;
|
| 5 |
import java.io.IOException;
|
5 |
import java.io.IOException;
|
| 6 |
import java.io.InputStream;
|
6 |
import java.io.InputStream;
|
| 7 |
import java.io.InputStreamReader;
|
7 |
import java.io.InputStreamReader;
|
| 8 |
import java.net.URISyntaxException;
|
8 |
import java.net.URISyntaxException;
|
| 9 |
import java.time.Duration;
|
- |
|
| 10 |
import java.time.LocalDate;
|
9 |
import java.time.LocalDate;
|
| 11 |
import java.time.LocalDateTime;
|
10 |
import java.time.LocalDateTime;
|
| 12 |
import java.time.LocalTime;
|
- |
|
| 13 |
import java.time.YearMonth;
|
11 |
import java.time.YearMonth;
|
| 14 |
import java.time.format.DateTimeFormatter;
|
12 |
import java.time.format.DateTimeFormatter;
|
| 15 |
import java.time.temporal.ChronoUnit;
|
13 |
import java.time.temporal.ChronoUnit;
|
| 16 |
import java.util.ArrayList;
|
14 |
import java.util.ArrayList;
|
| 17 |
import java.util.Arrays;
|
15 |
import java.util.Arrays;
|
| 18 |
import java.util.Collection;
|
16 |
import java.util.Collection;
|
| 19 |
import java.util.Comparator;
|
17 |
import java.util.Comparator;
|
| 20 |
import java.util.Date;
|
- |
|
| 21 |
import java.util.HashMap;
|
18 |
import java.util.HashMap;
|
| 22 |
import java.util.HashSet;
|
19 |
import java.util.HashSet;
|
| 23 |
import java.util.Iterator;
|
20 |
import java.util.Iterator;
|
| 24 |
import java.util.List;
|
21 |
import java.util.List;
|
| 25 |
import java.util.Map;
|
22 |
import java.util.Map;
|
| Line 36... |
Line 33... |
| 36 |
import org.apache.commons.csv.CSVRecord;
|
33 |
import org.apache.commons.csv.CSVRecord;
|
| 37 |
import org.apache.commons.io.FileUtils;
|
34 |
import org.apache.commons.io.FileUtils;
|
| 38 |
import org.apache.commons.lang3.StringUtils;
|
35 |
import org.apache.commons.lang3.StringUtils;
|
| 39 |
import org.apache.logging.log4j.LogManager;
|
36 |
import org.apache.logging.log4j.LogManager;
|
| 40 |
import org.apache.logging.log4j.Logger;
|
37 |
import org.apache.logging.log4j.Logger;
|
| 41 |
import org.apache.poi.ss.formula.functions.Days360;
|
- |
|
| 42 |
import org.apache.thrift.TException;
|
38 |
import org.apache.thrift.TException;
|
| 43 |
import org.hibernate.type.CurrencyType;
|
- |
|
| 44 |
import org.json.JSONObject;
|
39 |
import org.json.JSONObject;
|
| 45 |
import org.springframework.beans.factory.annotation.Autowired;
|
40 |
import org.springframework.beans.factory.annotation.Autowired;
|
| 46 |
import org.springframework.beans.factory.annotation.Qualifier;
|
41 |
import org.springframework.beans.factory.annotation.Qualifier;
|
| 47 |
import org.springframework.beans.factory.annotation.Value;
|
42 |
import org.springframework.beans.factory.annotation.Value;
|
| - |
|
43 |
import org.springframework.core.io.ByteArrayResource;
|
| 48 |
import org.springframework.core.io.ClassPathResource;
|
44 |
import org.springframework.core.io.ClassPathResource;
|
| 49 |
import org.springframework.core.io.InputStreamResource;
|
45 |
import org.springframework.core.io.InputStreamResource;
|
| 50 |
import org.springframework.http.HttpHeaders;
|
46 |
import org.springframework.http.HttpHeaders;
|
| 51 |
import org.springframework.http.HttpStatus;
|
47 |
import org.springframework.http.HttpStatus;
|
| 52 |
import org.springframework.http.MediaType;
|
48 |
import org.springframework.http.MediaType;
|
| Line 77... |
Line 73... |
| 77 |
import com.spice.profitmandi.common.model.PdfModel;
|
73 |
import com.spice.profitmandi.common.model.PdfModel;
|
| 78 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
74 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
| 79 |
import com.spice.profitmandi.common.model.SendNotificationModel;
|
75 |
import com.spice.profitmandi.common.model.SendNotificationModel;
|
| 80 |
import com.spice.profitmandi.common.util.ExcelUtils;
|
76 |
import com.spice.profitmandi.common.util.ExcelUtils;
|
| 81 |
import com.spice.profitmandi.common.util.PdfUtils;
|
77 |
import com.spice.profitmandi.common.util.PdfUtils;
|
| - |
|
78 |
import com.spice.profitmandi.common.util.Utils;
|
| - |
|
79 |
import com.spice.profitmandi.common.util.Utils.Attachment;
|
| 82 |
import com.spice.profitmandi.dao.entity.catalog.Item;
|
80 |
import com.spice.profitmandi.dao.entity.catalog.Item;
|
| 83 |
import com.spice.profitmandi.dao.entity.catalog.TagListing;
|
81 |
import com.spice.profitmandi.dao.entity.catalog.TagListing;
|
| 84 |
import com.spice.profitmandi.dao.entity.catalog.TagRanking;
|
82 |
import com.spice.profitmandi.dao.entity.catalog.TagRanking;
|
| 85 |
import com.spice.profitmandi.dao.entity.fofo.CurrentInventorySnapshot;
|
- |
|
| 86 |
import com.spice.profitmandi.dao.entity.fofo.FofoOrder;
|
83 |
import com.spice.profitmandi.dao.entity.fofo.FofoOrder;
|
| 87 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
84 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
| 88 |
import com.spice.profitmandi.dao.entity.fofo.InventoryItem;
|
85 |
import com.spice.profitmandi.dao.entity.fofo.InventoryItem;
|
| 89 |
import com.spice.profitmandi.dao.entity.fofo.LiveDemoSerialNumber;
|
86 |
import com.spice.profitmandi.dao.entity.fofo.LiveDemoSerialNumber;
|
| 90 |
import com.spice.profitmandi.dao.entity.transaction.NotifyCancel;
|
87 |
import com.spice.profitmandi.dao.entity.transaction.NotifyCancel;
|
| Line 557... |
Line 554... |
| 557 |
headers.setContentLength(bytes.length);
|
554 |
headers.setContentLength(bytes.length);
|
| 558 |
final InputStream inputStream = new ByteArrayInputStream(bytes);
|
555 |
final InputStream inputStream = new ByteArrayInputStream(bytes);
|
| 559 |
final InputStreamResource inputStreamResource = new InputStreamResource(inputStream);
|
556 |
final InputStreamResource inputStreamResource = new InputStreamResource(inputStream);
|
| 560 |
return new ResponseEntity<InputStreamResource>(inputStreamResource, headers, HttpStatus.OK);
|
557 |
return new ResponseEntity<InputStreamResource>(inputStreamResource, headers, HttpStatus.OK);
|
| 561 |
}
|
558 |
}
|
| - |
|
559 |
|
| - |
|
560 |
@RequestMapping(value = "/dummy-invoices-bulk")
|
| - |
|
561 |
public ResponseEntity<?> downloadInvoicesBulk(HttpServletRequest request, @RequestParam List<String> serialNumbers,
|
| - |
|
562 |
Model model) throws Exception {
|
| - |
|
563 |
byte[] bytes = null;
|
| - |
|
564 |
List<Attachment> attachments= new ArrayList<>();
|
| - |
|
565 |
for(String serialNumber : serialNumbers) {
|
| - |
|
566 |
if (!imeis.contains(serialNumber)) {
|
| - |
|
567 |
|
| - |
|
568 |
PdfModel pdfModel = orderService.getDummyPdfModel(serialNumber);
|
| - |
|
569 |
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
| - |
|
570 |
PdfUtils.generateAndWrite(Arrays.asList(pdfModel), byteArrayOutputStream);
|
| - |
|
571 |
bytes = byteArrayOutputStream.toByteArray();
|
| - |
|
572 |
} else {
|
| - |
|
573 |
ClassPathResource resource = new ClassPathResource("/META-INF/" + serialNumber + ".pdf");
|
| - |
|
574 |
try {
|
| - |
|
575 |
bytes = FileUtils.readFileToByteArray(resource.getFile());
|
| - |
|
576 |
} catch (Exception e) {
|
| - |
|
577 |
|
| - |
|
578 |
}
|
| - |
|
579 |
}
|
| - |
|
580 |
attachments.add(new Attachment("invoice-" + serialNumber + ".pdf", new ByteArrayResource(bytes)));
|
| - |
|
581 |
}
|
| - |
|
582 |
|
| - |
|
583 |
Utils.sendMailWithAttachments(mailSender, new String[] {"kuldeep.kumar@smartdukaan.com"}, null, "Invoices List", null, attachments.toArray(new Attachment[attachments.size()]));
|
| - |
|
584 |
return new ResponseEntity<Boolean>(true, HttpStatus.OK);
|
| - |
|
585 |
}
|
| 562 |
|
586 |
|
| 563 |
@RequestMapping(value = "/getInventoryItemAgingByInterval", method = RequestMethod.POST)
|
587 |
@RequestMapping(value = "/getInventoryItemAgingByInterval", method = RequestMethod.POST)
|
| 564 |
public String getInventoryItemAgingByInterval(HttpServletRequest request, @RequestBody List<Integer> intervals,
|
588 |
public String getInventoryItemAgingByInterval(HttpServletRequest request, @RequestBody List<Integer> intervals,
|
| 565 |
Model model, @RequestParam(name = "searchContent", defaultValue = "") String searchContent,
|
589 |
Model model, @RequestParam(name = "searchContent", defaultValue = "") String searchContent,
|
| 566 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
590 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|