Subversion Repositories SmartDukaan

Rev

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

Rev 7888 Rev 7895
Line 89... Line 89...
89
			log.warn(e.getMessage()+"pincode : "+ pincode + " Actual referer : " + request.getHeader("referer") + e.getStackTrace());
89
			log.warn(e.getMessage()+"pincode : "+ pincode + " Actual referer : " + request.getHeader("referer") + e.getStackTrace());
90
		}
90
		}
91
    	return new DefaultHttpHeaders("index");
91
    	return new DefaultHttpHeaders("index");
92
    }
92
    }
93
    
93
    
-
 
94
    public static void main(String[] args) throws TException {
-
 
95
    	System.out.println(getDeliveryDateString(1, DeliveryType.COD));
-
 
96
    	System.out.println(getDeliveryDateString(2, DeliveryType.COD));
-
 
97
    	System.out.println(getDeliveryDateString(2, DeliveryType.PREPAID));
-
 
98
    	System.out.println(getDeliveryDateString(3, DeliveryType.PREPAID));
-
 
99
	}
94
    public static String getDeliveryDateString(int days, DeliveryType type) throws TException {
100
    public static String getDeliveryDateString(int days, DeliveryType type) throws TException {
95
    	Calendar now = new GregorianCalendar();
101
    	Calendar now = new GregorianCalendar();
96
    	int hour = now.get(Calendar.HOUR_OF_DAY);
102
    	int hour = now.get(Calendar.HOUR_OF_DAY);
97
    	if(type == DeliveryType.COD && hour < 15){
103
    	if(type == DeliveryType.COD && hour < 15){
98
			days = days + 1;
104
			days = days + 1;
Line 108... Line 114...
108
    
114
    
109
    	LogisticsClient logisticsServiceClient = null;
115
    	LogisticsClient logisticsServiceClient = null;
110
		logisticsServiceClient = new LogisticsClient();
116
		logisticsServiceClient = new LogisticsClient();
111
		Client logisticsClient = logisticsServiceClient.getClient();
117
		Client logisticsClient = logisticsServiceClient.getClient();
112
		
118
		
113
    	days = (int) logisticsClient.adjustDeliveryDays(now.getTimeInMillis(), days);
119
    	int newdays = (int) logisticsClient.adjustDeliveryDays(now.getTimeInMillis(), days);
114
    	now.add(Calendar.DAY_OF_MONTH, days);
120
    	now.add(Calendar.DAY_OF_MONTH, newdays);
115
    	
121
    	
116
    	SimpleDateFormat dateformat = new SimpleDateFormat("EEE dd-MMM-yy");
122
    	SimpleDateFormat dateformat = new SimpleDateFormat("EEE dd-MMM-yy");
117
    	if(days == 1){
123
    	if(newdays == 1){
118
    		businessDayToActualDateMap.put(days, "Tomorrow, " + dateformat.format(now.getTime()));
124
    		businessDayToActualDateMap.put(days, "Tomorrow, " + dateformat.format(now.getTime()));
119
    	}else{
125
    	}else{
120
    		businessDayToActualDateMap.put(days, dateformat.format(now.getTime()));
126
    		businessDayToActualDateMap.put(days, dateformat.format(now.getTime()));
121
    	}
127
    	}
122
    	return businessDayToActualDateMap.get(days);
128
    	return businessDayToActualDateMap.get(days);