提交 1dc56e9b authored 作者: liuhaiquan's avatar liuhaiquan

补充超吨率

上级 3c369893
...@@ -23,13 +23,13 @@ import java.math.BigDecimal; ...@@ -23,13 +23,13 @@ import java.math.BigDecimal;
public class OrderChildBussInfoVO { public class OrderChildBussInfoVO {
@ApiModelProperty(value = "运单完成数量") @ApiModelProperty(value = "运单完成数量")
private Integer complateNum; private Integer completeNum;
@ApiModelProperty(value = "历史装车总量") @ApiModelProperty(value = "历史装车总量")
private BigDecimal historyLoadWeight; private BigDecimal historyLoadWeight;
@ApiModelProperty(value = "完成拉运总量") @ApiModelProperty(value = "完成拉运总量")
private BigDecimal complateCarryWeight; private BigDecimal completeCarryWeight;
@ApiModelProperty(value = "亏吨数量总计") @ApiModelProperty(value = "亏吨数量总计")
...@@ -38,5 +38,8 @@ public class OrderChildBussInfoVO { ...@@ -38,5 +38,8 @@ public class OrderChildBussInfoVO {
@ApiModelProperty(value = "亏吨率") @ApiModelProperty(value = "亏吨率")
private BigDecimal loseRate; private BigDecimal loseRate;
@ApiModelProperty(value = "超吨率")
private BigDecimal overRate;
} }
...@@ -1146,11 +1146,20 @@ public class OrderChildServiceImpl implements OrderChildService { ...@@ -1146,11 +1146,20 @@ public class OrderChildServiceImpl implements OrderChildService {
//完成拉运总量 //完成拉运总量
BigDecimal complateCarryWeight = childList.stream().map(OrderChild::getUnloadNet).reduce(BigDecimal::add).get(); BigDecimal complateCarryWeight = childList.stream().map(OrderChild::getUnloadNet).reduce(BigDecimal::add).get();
//亏吨数量总计 //亏吨数量总计
BigDecimal loseWeight = complateCarryWeight.subtract(historyLoadWeight).compareTo(BigDecimal.ZERO) < 0 ?BigDecimal.ZERO : historyLoadWeight.subtract(complateCarryWeight);
BigDecimal loseWeight = BigDecimal.ZERO;
BigDecimal overWeight = BigDecimal.ZERO;
if(complateCarryWeight.subtract(historyLoadWeight).compareTo(BigDecimal.ZERO) <= 0){
overWeight = complateCarryWeight.subtract(historyLoadWeight); //超吨
}else{
loseWeight = complateCarryWeight.subtract(historyLoadWeight);//亏吨
}
//亏吨率 //亏吨率
BigDecimal loseRate = loseWeight.divide(historyLoadWeight).setScale(2,RoundingMode.HALF_UP); BigDecimal loseRate = loseWeight.divide(historyLoadWeight).setScale(2,RoundingMode.HALF_UP);
OrderChildBussInfoVO vo = OrderChildBussInfoVO.builder().complateNum(complateNum).historyLoadWeight(historyLoadWeight).complateCarryWeight(complateCarryWeight) BigDecimal overRate = overWeight.divide(historyLoadWeight).setScale(2,RoundingMode.HALF_UP);
.loseWeight(loseWeight).loseRate(loseRate).build(); OrderChildBussInfoVO vo = OrderChildBussInfoVO.builder().completeNum(complateNum).historyLoadWeight(historyLoadWeight).completeCarryWeight(complateCarryWeight)
.loseWeight(loseWeight).loseRate(loseRate).overRate(overRate).build();
return vo; return vo;
} }
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论