| Line 31... |
Line 31... |
| 31 |
@SuppressWarnings("serial")
|
31 |
@SuppressWarnings("serial")
|
| 32 |
public class BulkBillingServlet extends HttpServlet {
|
32 |
public class BulkBillingServlet extends HttpServlet {
|
| 33 |
protected void doPost(HttpServletRequest request, HttpServletResponse
|
33 |
protected void doPost(HttpServletRequest request, HttpServletResponse
|
| 34 |
response) throws ServletException, IOException {
|
34 |
response) throws ServletException, IOException {
|
| 35 |
|
35 |
|
| - |
|
36 |
|
| 36 |
System.out.println("LogisticsTransactionId"+request.getAttribute("logisticsTransactionId"));
|
37 |
System.out.println("LogisticsTransactionId"+request.getAttribute("logisticsTransactionId"));
|
| 37 |
System.out.println("PackageDimensions"+request.getAttribute("packageDimensions"));
|
38 |
System.out.println("PackageDimensions"+request.getAttribute("packageDimensions"));
|
| 38 |
|
39 |
|
| 39 |
FileItem uploadItem = getFileItem(request);
|
40 |
FileItem uploadItem = getFileItem(request);
|
| 40 |
if (uploadItem == null) {
|
41 |
if (uploadItem == null) {
|
| Line 53... |
Line 54... |
| 53 |
uploadItem.write(file);
|
54 |
uploadItem.write(file);
|
| 54 |
} catch (Exception e) {
|
55 |
} catch (Exception e) {
|
| 55 |
// TODO Auto-generated catch block
|
56 |
// TODO Auto-generated catch block
|
| 56 |
e.printStackTrace();
|
57 |
e.printStackTrace();
|
| 57 |
}
|
58 |
}
|
| 58 |
ProcessShipmentDelay processShipmentDelay = new ProcessShipmentDelay();
|
- |
|
| 59 |
List<ShipmentDelayDetail> notUpdated = processShipmentDelay.processReport(fileName);
|
59 |
ProcessBulkBilling processBulkBilling = new ProcessBulkBilling(fileName,request.getAttribute("logisticsTransactionId")+"",request.getAttribute("packageDimensions")+"");
|
| 60 |
response.setContentType("text/html");
|
- |
|
| 61 |
if (notUpdated == null){
|
60 |
String result = "";
|
| 62 |
response.getWriter().write("Service error.");
|
61 |
if (processBulkBilling.processReport()){
|
| 63 |
}
|
- |
|
| 64 |
else if (notUpdated.size() == 0){
|
- |
|
| 65 |
response.getWriter().write("All records updated.");
|
62 |
result = processBulkBilling.checkBillingDetails();
|
| 66 |
}
|
63 |
}
|
| 67 |
else{
|
64 |
else{
|
| 68 |
response.getWriter().write(notUpdated.size()+" "+"orders not updated.Check with report.");
|
65 |
result = "Unable to validate uploaded sheet";
|
| 69 |
}
|
66 |
}
|
| - |
|
67 |
response.setContentType("text/html");
|
| - |
|
68 |
response.getWriter().write(result);
|
| 70 |
}
|
69 |
}
|
| 71 |
|
70 |
|
| 72 |
private long getTimeInMilliseconds(){
|
71 |
private long getTimeInMilliseconds(){
|
| 73 |
Calendar cal=GregorianCalendar.getInstance();
|
72 |
Calendar cal=GregorianCalendar.getInstance();
|
| 74 |
return cal.getTimeInMillis();
|
73 |
return cal.getTimeInMillis();
|