feat(firstleg): add private warehouse delivery fee
This commit is contained in:
@@ -23,6 +23,7 @@ import java.util.List;
|
||||
@Service
|
||||
public class InboundFeeDetailService {
|
||||
private static final String FREIGHT_FEE_CODE = "FBA_HEAD_FREIGHT";
|
||||
private static final String PRIVATE_LAST_MILE_DELIVERY_FEE_CODE = "PRIVATE_LAST_MILE_DELIVERY";
|
||||
@Resource
|
||||
private FeeItemRepository repository;
|
||||
@Resource
|
||||
@@ -379,6 +380,7 @@ public class InboundFeeDetailService {
|
||||
|
||||
private void apply(InboundFeeDetailEntity value, InboundOrderEntity inbound,
|
||||
FeeItemEntity item, SaveRequest request, long operatorId) {
|
||||
ensureDestinationApplicable(item, inbound);
|
||||
ensureWarehouseApplicable(item, request.direction());
|
||||
value.setFeeItemId(item.getId());
|
||||
value.setInboundCode(inbound.getInboundCode());
|
||||
@@ -408,6 +410,13 @@ public class InboundFeeDetailService {
|
||||
value.setUpdatedBy(operatorId);
|
||||
}
|
||||
|
||||
private static void ensureDestinationApplicable(FeeItemEntity item, InboundOrderEntity inbound) {
|
||||
if (PRIVATE_LAST_MILE_DELIVERY_FEE_CODE.equals(item.getFeeCode())
|
||||
&& !"PRIVATE".equals(inbound.getDestinationType())) {
|
||||
throw conflict("私人仓尾程派送费只能绑定目的地类型为PRIVATE的入库单");
|
||||
}
|
||||
}
|
||||
|
||||
private void applySupplierSnapshot(InboundFeeDetailEntity value, FeeItemEntity item,
|
||||
String direction, Long supplierId) {
|
||||
if (!"PAYABLE".equals(direction)) {
|
||||
|
||||
Reference in New Issue
Block a user