提交 f7a8514e authored 作者: aiqingguo's avatar aiqingguo

运费计算

上级 84f77a31
......@@ -154,15 +154,7 @@ public class OrderChildVO {
@ApiModelProperty(value = "总运费(元)", example = "1.23")
private BigDecimal totalFreight;
public BigDecimal getTotalFreight() {
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);
return freightPrice.multiply(weight).setScale(2, RoundingMode.HALF_UP);
}
}
\ No newline at end of file
......@@ -163,7 +163,7 @@ public class OrderChildPoundAuditServiceImpl implements OrderChildPoundAuditSer
* 运费计算
*/
public BigDecimal orderChildFreightCalc(OrderChild orderChild){
BigDecimal totalFreight = orderChild.getFreightPrice().multiply(orderChild.getUnloadNet().compareTo(orderChild.getLoadNet()) < 0? orderChild.getUnloadNet() : orderChild.getLoadNet());
BigDecimal totalFreight = orderChild.getFreightPrice().multiply(orderChild.getWeight());
BigDecimal dif = orderChild.getUnloadNet().subtract(orderChild.getLoadNet());
if (dif.compareTo(BigDecimal.ZERO) < 0){
totalFreight = totalFreight.add(orderChild.getLossPrice().multiply(dif));
......
......@@ -1198,8 +1198,7 @@ public class OrderChildServiceImpl implements OrderChildService {
private BigDecimal orderChildFreightCalc(OrderChild orderChild){
BigDecimal totalFreight = orderChild.getFreightPrice().multiply(orderChild.getWeight());
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.getLoadNet());
if (dif.compareTo(BigDecimal.ZERO) < 0){
totalFreight = totalFreight.add(orderChild.getLossPrice().multiply(dif));
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论