| Line 1... |
Line 1... |
| 1 |
package com.spice.profitmandi.service;
|
1 |
package com.spice.profitmandi.service;
|
| 2 |
|
2 |
|
| 3 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
3 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| 4 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
4 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
| 5 |
import com.spice.profitmandi.dao.entity.logistics.Provider;
|
5 |
import com.spice.profitmandi.dao.entity.logistics.*;
|
| 6 |
import com.spice.profitmandi.dao.entity.logistics.ProviderTat;
|
- |
|
| 7 |
import com.spice.profitmandi.dao.entity.logistics.WarehouseProvider;
|
- |
|
| 8 |
import com.spice.profitmandi.dao.entity.logistics.WarehouseRider;
|
- |
|
| 9 |
import com.spice.profitmandi.dao.entity.transaction.Order;
|
6 |
import com.spice.profitmandi.dao.entity.transaction.Order;
|
| - |
|
7 |
import com.spice.profitmandi.dao.entity.transaction.Transaction;
|
| 10 |
import com.spice.profitmandi.dao.entity.transaction.TransactionShipmentSequence;
|
8 |
import com.spice.profitmandi.dao.entity.transaction.TransactionShipmentSequence;
|
| 11 |
import com.spice.profitmandi.dao.model.DispatchNotificationModel;
|
9 |
import com.spice.profitmandi.dao.model.DispatchNotificationModel;
|
| 12 |
import com.spice.profitmandi.dao.repository.logistics.*;
|
10 |
import com.spice.profitmandi.dao.repository.logistics.*;
|
| - |
|
11 |
import com.spice.profitmandi.dao.repository.transaction.TransactionRepository;
|
| 13 |
import com.spice.profitmandi.dao.repository.transaction.TransactionShipmentSequenceRepository;
|
12 |
import com.spice.profitmandi.dao.repository.transaction.TransactionShipmentSequenceRepository;
|
| 14 |
import com.spice.profitmandi.service.integrations.gstpro.api.model.E_InvoiceCommon;
|
13 |
import com.spice.profitmandi.service.integrations.gstpro.api.model.E_InvoiceCommon;
|
| 15 |
import in.shop2020.model.v1.order.OrderStatus;
|
14 |
import in.shop2020.model.v1.order.OrderStatus;
|
| 16 |
import org.apache.commons.lang.StringUtils;
|
15 |
import org.apache.commons.lang.StringUtils;
|
| - |
|
16 |
import org.apache.logging.log4j.LogManager;
|
| - |
|
17 |
import org.apache.logging.log4j.Logger;
|
| 17 |
import org.springframework.beans.factory.annotation.Autowired;
|
18 |
import org.springframework.beans.factory.annotation.Autowired;
|
| 18 |
import org.springframework.stereotype.Component;
|
19 |
import org.springframework.stereotype.Component;
|
| 19 |
|
20 |
|
| 20 |
import java.time.DayOfWeek;
|
21 |
import java.time.DayOfWeek;
|
| 21 |
import java.time.LocalDate;
|
22 |
import java.time.LocalDate;
|
| Line 35... |
Line 36... |
| 35 |
private ProviderTatRepository providerTatRepository;
|
36 |
private ProviderTatRepository providerTatRepository;
|
| 36 |
|
37 |
|
| 37 |
@Autowired
|
38 |
@Autowired
|
| 38 |
ProviderRepository providerRepository;
|
39 |
ProviderRepository providerRepository;
|
| 39 |
|
40 |
|
| - |
|
41 |
private static final Logger LOGGER = LogManager.getLogger(LogisticsServiceImpl.class);
|
| - |
|
42 |
|
| - |
|
43 |
|
| 40 |
@Override
|
44 |
@Override
|
| 41 |
public LocalDate calculateDeliveryTimeline(LocalDate date, ProviderTat providerTat, int delayDays) {
|
45 |
public LocalDate calculateDeliveryTimeline(LocalDate date, ProviderTat providerTat, int delayDays) {
|
| 42 |
int businessDays = 0;
|
46 |
int businessDays = 0;
|
| 43 |
int deliveryTat = 3;
|
47 |
int deliveryTat = 3;
|
| 44 |
if (providerTat != null) {
|
48 |
if (providerTat != null) {
|
| Line 130... |
Line 134... |
| 130 |
WarehouseRiderRepository warehouseRiderRepository;
|
134 |
WarehouseRiderRepository warehouseRiderRepository;
|
| 131 |
|
135 |
|
| 132 |
@Autowired
|
136 |
@Autowired
|
| 133 |
TransactionShipmentSequenceRepository transactionShipmentSequenceRepository;
|
137 |
TransactionShipmentSequenceRepository transactionShipmentSequenceRepository;
|
| 134 |
|
138 |
|
| - |
|
139 |
@Autowired
|
| - |
|
140 |
TransactionRepository transactionRepository;
|
| - |
|
141 |
|
| - |
|
142 |
@Autowired
|
| - |
|
143 |
WarehousePartnerDistanceMappingRepository warehousePartnerDistanceMappingRepository;
|
| 135 |
|
144 |
|
| 136 |
@Override
|
145 |
@Override
|
| 137 |
public E_InvoiceCommon.ReqPlGenIRN.EwbDetails getEwbDetails(Order order) {
|
146 |
public E_InvoiceCommon.ReqPlGenIRN.EwbDetails getEwbDetails(Order order) throws ProfitMandiBusinessException {
|
| 138 |
|
147 |
|
| 139 |
E_InvoiceCommon.ReqPlGenIRN.EwbDetails ewbDetails = new E_InvoiceCommon.ReqPlGenIRN.EwbDetails();
|
148 |
E_InvoiceCommon.ReqPlGenIRN.EwbDetails ewbDetails = new E_InvoiceCommon.ReqPlGenIRN.EwbDetails();
|
| 140 |
//ewbDetails.Distance = String.valueOf(200);
|
149 |
//ewbDetails.Distance = String.valueOf(200);
|
| 141 |
//1 is road, 2 is rail, 3 is air, 4 is ship
|
150 |
//1 is road, 2 is rail, 3 is air, 4 is ship
|
| 142 |
|
151 |
|
| Line 154... |
Line 163... |
| 154 |
//Get logistics Provider Detail here
|
163 |
//Get logistics Provider Detail here
|
| 155 |
ewbDetails.TransId = warehouseProvider.getGstin();
|
164 |
ewbDetails.TransId = warehouseProvider.getGstin();
|
| 156 |
ewbDetails.TransName = provider.getName();
|
165 |
ewbDetails.TransName = provider.getName();
|
| 157 |
}
|
166 |
}
|
| 158 |
|
167 |
|
| - |
|
168 |
String distance = "0";
|
| - |
|
169 |
WarehousePartnerDistanceMapping distanceMapping = warehousePartnerDistanceMappingRepository.selectByWarehouseIdAndFofoId(order.getWarehouseId(), order.getRetailerId());
|
| - |
|
170 |
if (distanceMapping != null) {
|
| - |
|
171 |
distance = distanceMapping.getDistance();
|
| - |
|
172 |
}
|
| - |
|
173 |
LOGGER.info("distance - " + distance);
|
| 159 |
ewbDetails.Distance = "0";
|
174 |
ewbDetails.Distance = distance;
|
| 160 |
return ewbDetails;
|
175 |
return ewbDetails;
|
| 161 |
|
176 |
|
| 162 |
}
|
177 |
}
|
| 163 |
|
178 |
|
| 164 |
}
|
179 |
}
|