| Line 69... |
Line 69... |
| 69 |
@Autowired
|
69 |
@Autowired
|
| 70 |
private ProviderTatRepository providerTatRepository;
|
70 |
private ProviderTatRepository providerTatRepository;
|
| 71 |
|
71 |
|
| 72 |
@Autowired
|
72 |
@Autowired
|
| 73 |
private LogisticsService logisticsService;
|
73 |
private LogisticsService logisticsService;
|
| - |
|
74 |
|
| - |
|
75 |
@Value("#{'${prod}'=='true' ? 'DEL81122' : 'DEL95932'}")
|
| - |
|
76 |
private String loginId;
|
| - |
|
77 |
|
| - |
|
78 |
@Value("#{'${prod}'=='true' ? '9sjnjt61hghmtjuvjio0osqkmujkphlt' : 'poehq2kiqjnllkrote9hxglo4teptfqf'}")
|
| - |
|
79 |
private String licencekey;
|
| - |
|
80 |
|
| 74 |
private static final Logger LOGGER = LogManager.getLogger(TrackingController.class);
|
81 |
private static final Logger LOGGER = LogManager.getLogger(TrackingController.class);
|
| 75 |
|
82 |
|
| 76 |
@RequestMapping(value = "/order/tracking", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
83 |
@RequestMapping(value = "/order/tracking", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
| 77 |
@ApiImplicitParams({
|
84 |
@ApiImplicitParams({
|
| 78 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header") })
|
85 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header") })
|
| Line 130... |
Line 137... |
| 130 |
LOGGER.info("tdm" + tdm);
|
137 |
LOGGER.info("tdm" + tdm);
|
| 131 |
|
138 |
|
| 132 |
return responseSender.ok(tdm);
|
139 |
return responseSender.ok(tdm);
|
| 133 |
}
|
140 |
}
|
| 134 |
|
141 |
|
| - |
|
142 |
@RequestMapping(value = "/order/tracking/bluedart", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
| - |
|
143 |
@ApiImplicitParams({
|
| - |
|
144 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header") })
|
| - |
|
145 |
public ResponseEntity<?> getBluedartOrderTracking(HttpServletRequest request) throws Throwable {
|
| - |
|
146 |
|
| - |
|
147 |
String airwayBillNo = "30585044895";
|
| - |
|
148 |
|
| - |
|
149 |
String url = "http://api.bluedart.com/servlet/RoutingServlet?handler=tnt&action=custawbquery";
|
| - |
|
150 |
|
| - |
|
151 |
OkHttpClient client = new OkHttpClient();
|
| - |
|
152 |
|
| - |
|
153 |
Request request1 = new Request.Builder().url(url + "&loginid=" + loginId + "&awb=awb&numbers="
|
| - |
|
154 |
+ String.join(",", airwayBillNo) + "&format=xml&lickey=" + licencekey + "&verno=1.3&scan=1").get()
|
| - |
|
155 |
.build();
|
| - |
|
156 |
|
| - |
|
157 |
LOGGER.info("request1" + request1);
|
| - |
|
158 |
|
| - |
|
159 |
Response response1 = client.newCall(request1).execute();
|
| - |
|
160 |
|
| - |
|
161 |
LOGGER.info("jsonbj" + response1);
|
| - |
|
162 |
|
| - |
|
163 |
TrackingDetailModel tdm = new TrackingDetailModel();
|
| - |
|
164 |
|
| - |
|
165 |
return responseSender.ok(tdm);
|
| - |
|
166 |
}
|
| - |
|
167 |
|
| 135 |
@RequestMapping(value = "/order/detail", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
168 |
@RequestMapping(value = "/order/detail", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
| 136 |
@ApiImplicitParams({
|
169 |
@ApiImplicitParams({
|
| 137 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header") })
|
170 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header") })
|
| 138 |
public ResponseEntity<?> getOrderDetails(HttpServletRequest request, HttpServletResponse response,
|
171 |
public ResponseEntity<?> getOrderDetails(HttpServletRequest request, HttpServletResponse response,
|
| 139 |
@RequestParam String airwayBillNo, @RequestParam int orderId) throws Throwable {
|
172 |
@RequestParam String airwayBillNo, @RequestParam int orderId) throws Throwable {
|
| Line 226... |
Line 259... |
| 226 |
} else {
|
259 |
} else {
|
| 227 |
if (co.getBillingTimestamp() != null) {
|
260 |
if (co.getBillingTimestamp() != null) {
|
| 228 |
co.setExpectedShipping(co.getBillingTimestamp());
|
261 |
co.setExpectedShipping(co.getBillingTimestamp());
|
| 229 |
|
262 |
|
| 230 |
if (LocalDate.now().isAfter(co.getExpectedShipping().toLocalDate())) {
|
263 |
if (LocalDate.now().isAfter(co.getExpectedShipping().toLocalDate())) {
|
| 231 |
long noOfDaysBetween = ChronoUnit.DAYS.between(
|
264 |
long noOfDaysBetween = ChronoUnit.DAYS.between(co.getExpectedShipping(),
|
| 232 |
co.getExpectedShipping(),LocalDate.now().atStartOfDay());
|
265 |
LocalDate.now().atStartOfDay());
|
| 233 |
|
266 |
|
| 234 |
co.setExpectedShipping(co.getBillingTimestamp().plusDays(noOfDaysBetween+1));
|
267 |
co.setExpectedShipping(co.getBillingTimestamp().plusDays(noOfDaysBetween + 1));
|
| 235 |
}
|
268 |
}
|
| 236 |
}
|
269 |
}
|
| 237 |
tm.setExpectedShipping(co.getExpectedShipping());
|
270 |
tm.setExpectedShipping(co.getExpectedShipping());
|
| 238 |
if (tm.isInTransitBilling()) {
|
271 |
if (tm.isInTransitBilling()) {
|
| 239 |
tm.setInTransitShipping(false);
|
272 |
tm.setInTransitShipping(false);
|