diff --git a/emis-biz/src/main/java/com/xdadan/erp/emis/service/impl/EmisCommissionProfitServiceImpl.java b/emis-biz/src/main/java/com/xdadan/erp/emis/service/impl/EmisCommissionProfitServiceImpl.java index 89f613d18..9ea80adcb 100644 --- a/emis-biz/src/main/java/com/xdadan/erp/emis/service/impl/EmisCommissionProfitServiceImpl.java +++ b/emis-biz/src/main/java/com/xdadan/erp/emis/service/impl/EmisCommissionProfitServiceImpl.java @@ -735,21 +735,35 @@ public class EmisCommissionProfitServiceImpl extends EmisBaseService implements } // 重量计算 else if ("2".equals(quoteItem.getCalcType())) { - calcExprStr = calcExp.replaceAll("w", waybill.getSettlementWeight().toString()) - .replaceAll("s", exprItem.getInitialWeight().toString()) - .replaceAll("d", exprItem.getAdditionalWeight().toString()); - log.info("按重量计算:计算公式:" + calcExprStr + ",重量:"+waybill.getSettlementWeight().toString()); - profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExprStr).toString()); + if (exprItem.getStartWeight().doubleValue() < waybill.getSettlementWeight().doubleValue() + && exprItem.getEndWeight().doubleValue() >= waybill.getSettlementWeight().doubleValue() + ) { + calcExprStr = calcExp.replaceAll("w", waybill.getSettlementWeight().toString()) + .replaceAll("s", exprItem.getInitialWeight().toString()) + .replaceAll("d", exprItem.getAdditionalWeight().toString()); + + log.info("按重量计算:计算公式:" + calcExprStr + ",重量:"+waybill.getSettlementWeight().toString()); + profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExprStr).toString()); + + } } // 体积计算 else if ("3".equals(quoteItem.getCalcType())) { - calcExprStr = calcExp.replaceAll("w", waybill.getSettlementWeight().toString()) - .replaceAll("s", exprItem.getInitialWeight().toString()) - .replaceAll("d", exprItem.getAdditionalWeight().toString()); - log.info("按体积计算:计算公式:" + calcExprStr + ",体积:"+waybill.getTotalVolume().toString()); - profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExprStr).toString()); + + if (exprItem.getStartWeight().doubleValue() < waybill.getTotalVolume().doubleValue() + && exprItem.getEndWeight().doubleValue() >= waybill.getTotalVolume().doubleValue() + ) { + + calcExprStr = calcExp.replaceAll("w", waybill.getTotalVolume().toString()) + .replaceAll("s", exprItem.getInitialWeight().toString()) + .replaceAll("d", exprItem.getAdditionalWeight().toString()); + log.info("按体积计算:计算公式:" + calcExprStr + ",体积:"+waybill.getTotalVolume().toString()); + profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExprStr).toString()); + + } + } // 包裹数 else if ("4".equals(quoteItem.getCalcType())) { @@ -787,12 +801,12 @@ public class EmisCommissionProfitServiceImpl extends EmisBaseService implements } }else{ - log.error("网点客服未配置表达式"); + log.error("销售员提成未配置表达式"); } } }else{ - log.error("网点客服无报价"); + log.error("销售员提成无报价"); } }