提交 7dac2cd0 authored 作者: liruixin's avatar liruixin

运费计算公式修改

上级 c0a1726c
...@@ -49,7 +49,15 @@ public class OrderChildFreightInfoVO { ...@@ -49,7 +49,15 @@ public class OrderChildFreightInfoVO {
@ApiModelProperty(value = "总运费(元)", example = "1.23") @ApiModelProperty(value = "总运费(元)", example = "1.23")
private BigDecimal totalFreight; private BigDecimal totalFreight;
public BigDecimal getTotalFreight() { public BigDecimal getTotalFreight() {
return freightPrice.multiply(weight).setScale(2, RoundingMode.HALF_UP); BigDecimal totalFreight = freightPrice.multiply(weight);
if (unloadNet != null){
totalFreight = freightPrice.multiply(unloadNet.compareTo(loadNet) < 0? unloadNet : loadNet);
BigDecimal dif = unloadNet.subtract(weight);
if (dif.compareTo(BigDecimal.ZERO) < 0){
totalFreight = totalFreight.add(lossPrice.multiply(dif));
}
}
return totalFreight.setScale(2, RoundingMode.HALF_UP);
} }
@ApiModelProperty(value = "亏吨扣款(元)", example = "1.23") @ApiModelProperty(value = "亏吨扣款(元)", example = "1.23")
......
...@@ -154,7 +154,15 @@ public class OrderChildVO { ...@@ -154,7 +154,15 @@ public class OrderChildVO {
@ApiModelProperty(value = "总运费(元)", example = "1.23") @ApiModelProperty(value = "总运费(元)", example = "1.23")
private BigDecimal totalFreight; private BigDecimal totalFreight;
public BigDecimal getTotalFreight() { public BigDecimal getTotalFreight() {
return freightPrice.multiply(weight).setScale(2, RoundingMode.HALF_UP); BigDecimal totalFreight = freightPrice.multiply(weight);
if (unloadNet != null){
totalFreight = freightPrice.multiply(unloadNet.compareTo(loadNet) < 0? unloadNet : loadNet);
BigDecimal dif = unloadNet.subtract(weight);
if (dif.compareTo(BigDecimal.ZERO) < 0){
totalFreight = totalFreight.add(lossPrice.multiply(dif));
}
}
return totalFreight.setScale(2, RoundingMode.HALF_UP);
} }
} }
\ No newline at end of file
...@@ -156,8 +156,12 @@ public class OrderChildPoundAuditServiceImpl implements OrderChildPoundAuditSer ...@@ -156,8 +156,12 @@ public class OrderChildPoundAuditServiceImpl implements OrderChildPoundAuditSer
* 运单拉运吨数计算 * 运单拉运吨数计算
*/ */
public BigDecimal orderChildWeightCalc(OrderChild orderChild){ public BigDecimal orderChildWeightCalc(OrderChild orderChild){
if (orderChild.getLoadNet() == null) {return orderChild.getTruckLoad();} if (orderChild.getUnloadNet() != null) {
else {return orderChild.getLoadNet();} return orderChild.getUnloadNet().compareTo(orderChild.getLoadNet()) < 0? orderChild.getUnloadNet() : orderChild.getLoadNet();
}
if (orderChild.getLoadNet() != null) {return orderChild.getLoadNet();}
return orderChild.getTruckLoad();
} }
/** /**
...@@ -166,6 +170,7 @@ public class OrderChildPoundAuditServiceImpl implements OrderChildPoundAuditSer ...@@ -166,6 +170,7 @@ public class OrderChildPoundAuditServiceImpl implements OrderChildPoundAuditSer
public BigDecimal orderChildFreightCalc(OrderChild orderChild){ public BigDecimal orderChildFreightCalc(OrderChild orderChild){
BigDecimal totalFreight = orderChild.getFreightPrice().multiply(orderChild.getWeight()); BigDecimal totalFreight = orderChild.getFreightPrice().multiply(orderChild.getWeight());
if (orderChild.getUnloadNet() != null){ if (orderChild.getUnloadNet() != null){
totalFreight = orderChild.getFreightPrice().multiply(orderChild.getUnloadNet().compareTo(orderChild.getLoadNet()) < 0? orderChild.getUnloadNet() : orderChild.getLoadNet());
BigDecimal dif = orderChild.getUnloadNet().subtract(orderChild.getWeight()); BigDecimal dif = orderChild.getUnloadNet().subtract(orderChild.getWeight());
if (dif.compareTo(BigDecimal.ZERO) < 0){ if (dif.compareTo(BigDecimal.ZERO) < 0){
totalFreight = totalFreight.add(orderChild.getLossPrice().multiply(dif)); totalFreight = totalFreight.add(orderChild.getLossPrice().multiply(dif));
......
...@@ -1281,13 +1281,15 @@ public class OrderChildServiceImpl implements OrderChildService { ...@@ -1281,13 +1281,15 @@ public class OrderChildServiceImpl implements OrderChildService {
carrierOrderChildDetailVO.setChildLogs(orderChildLogStruct.convert(orderChildLog)); carrierOrderChildDetailVO.setChildLogs(orderChildLogStruct.convert(orderChildLog));
//应付运费 //应付运费
BigDecimal payableFreight=BigDecimal.ZERO; BigDecimal payableFreight = orderChild.getFreightPrice().multiply(orderChild.getWeight());
if(Objects.nonNull(orderChild.getLoadNet())){ if (orderChild.getUnloadNet() != null){
payableFreight = orderChild.getLoadNet() payableFreight = orderChild.getFreightPrice()
.multiply(orderChild.getFreightPrice()) .multiply(orderChild.getUnloadNet().compareTo(orderChild.getLoadNet()) < 0? orderChild.getUnloadNet() : orderChild.getLoadNet())
.setScale(0,BigDecimal.ROUND_HALF_UP); .setScale(0,BigDecimal.ROUND_HALF_UP);
} }
//亏吨扣款(元) //亏吨扣款(元)
BigDecimal lossDeduction=BigDecimal.ZERO; BigDecimal lossDeduction=BigDecimal.ZERO;
if(Objects.nonNull(orderChild.getLoadNet()) && Objects.nonNull(orderChild.getUnloadNet())){ if(Objects.nonNull(orderChild.getLoadNet()) && Objects.nonNull(orderChild.getUnloadNet())){
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论