This commit is contained in:
linfso 2025-07-04 10:22:18 +08:00
parent e841fc04c9
commit 42979545fe
3 changed files with 97 additions and 24 deletions

View File

@ -502,14 +502,22 @@ public class EmisCommissionProfitServiceImpl extends EmisBaseService implements
.replaceAll("d", exprItem.getAdditionalWeight().toString());
log.info("按票计算:计算公式:" + calcExprStr + ",票数:1");
profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExprStr).toString());
Map<String, Object> env = new HashMap<>();
env.put("w", new BigDecimal("1.0"));
env.put("s", exprItem.getInitialWeight());
env.put("d", exprItem.getAdditionalWeight());
profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExp,env).toString());
}
// 重量计算
else if ("2".equals(quoteItem.getCalcType())) {
if( isValueInExprScope(waybill.getBillWeight().doubleValue(),exprItem) ){
calcExprStr = getCalcFeeExpStr(waybill.getBillWeight(),exprItem);
log.info("按重量计算:计算公式:" + calcExprStr + ",重量:" + waybill.getBillWeight().stripTrailingZeros().toPlainString());
profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExprStr).toString());
Map<String, Object> env = new HashMap<>();
env.put("w", waybill.getBillWeight());
env.put("s", exprItem.getInitialWeight());
env.put("d", exprItem.getAdditionalWeight());
profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExp,env).toString());
}
}
@ -518,7 +526,11 @@ public class EmisCommissionProfitServiceImpl extends EmisBaseService implements
if( isValueInExprScope(waybill.getTotalVolume().doubleValue(),exprItem) ) {
calcExprStr = getCalcFeeExpStr(waybill.getTotalVolume(),exprItem);
log.info("按体积计算:计算公式:" + calcExprStr + ",体积:" + waybill.getTotalVolume().stripTrailingZeros().toPlainString());
profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExprStr).toString());
Map<String, Object> env = new HashMap<>();
env.put("w", waybill.getTotalVolume());
env.put("s", exprItem.getInitialWeight());
env.put("d", exprItem.getAdditionalWeight());
profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExp,env).toString());
}
}
// 包裹数
@ -528,7 +540,11 @@ public class EmisCommissionProfitServiceImpl extends EmisBaseService implements
.replaceAll("s", exprItem.getInitialWeight().toString())
.replaceAll("d", exprItem.getAdditionalWeight().toString());
log.info("按包裹数:计算公式:" + calcExprStr + ",包裹数:"+1);
profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExprStr).toString());
Map<String, Object> env = new HashMap<>();
env.put("w", new BigDecimal("1.0"));
env.put("s", exprItem.getInitialWeight());
env.put("d", exprItem.getAdditionalWeight());
profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExp,env).toString());
}
// 参与分成人员计算
@ -619,14 +635,23 @@ public class EmisCommissionProfitServiceImpl extends EmisBaseService implements
.replaceAll("d", exprItem.getAdditionalWeight().toString());
log.info("按票计算:计算公式:" + calcExprStr + ",票数:1");
profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExprStr).toString());
Map<String, Object> env = new HashMap<>();
env.put("w", new BigDecimal("1.0"));
env.put("s", exprItem.getInitialWeight());
env.put("d", exprItem.getAdditionalWeight());
profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExp,env).toString());
}
// 重量计算
else if ("2".equals(quoteItem.getCalcType())) {
if( isValueInExprScope(waybill.getBillWeight().doubleValue(),exprItem) ) {
calcExprStr = getCalcFeeExpStr(waybill.getBillWeight(),exprItem);
log.info("按重量计算:计算公式:" + calcExprStr + ",重量:" + waybill.getBillWeight().stripTrailingZeros().toPlainString());
profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExprStr).toString());
Map<String, Object> env = new HashMap<>();
env.put("w", waybill.getBillWeight());
env.put("s", exprItem.getInitialWeight());
env.put("d", exprItem.getAdditionalWeight());
profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExp,env).toString());
}
}
@ -635,7 +660,11 @@ public class EmisCommissionProfitServiceImpl extends EmisBaseService implements
if( isValueInExprScope(waybill.getTotalVolume().doubleValue(),exprItem) ) {
calcExprStr = getCalcFeeExpStr(waybill.getTotalVolume(),exprItem);
log.info("按体积计算:计算公式:" + calcExprStr + ",体积:" + waybill.getTotalVolume().stripTrailingZeros().toPlainString());
profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExprStr).toString());
Map<String, Object> env = new HashMap<>();
env.put("w", waybill.getTotalVolume());
env.put("s", exprItem.getInitialWeight());
env.put("d", exprItem.getAdditionalWeight());
profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExp,env).toString());
}
}
// 包裹数
@ -645,7 +674,12 @@ public class EmisCommissionProfitServiceImpl extends EmisBaseService implements
.replaceAll("s", exprItem.getInitialWeight().toString())
.replaceAll("d", exprItem.getAdditionalWeight().toString());
log.info("按包裹数:计算公式:" + calcExprStr + ",包裹数:"+1);
profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExprStr).toString());
Map<String, Object> env = new HashMap<>();
env.put("w", new BigDecimal("1.0"));
env.put("s", exprItem.getInitialWeight());
env.put("d", exprItem.getAdditionalWeight());
profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExp,env).toString());
}
// 插入参与分成人员
@ -745,7 +779,11 @@ public class EmisCommissionProfitServiceImpl extends EmisBaseService implements
.replaceAll("d", exprItem.getAdditionalWeight().toString());
log.info("按票计算:计算公式:" + calcExprStr + ",票数:1");
profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExprStr).toString());
Map<String, Object> env = new HashMap<>();
env.put("w", new BigDecimal("1.0"));
env.put("s", exprItem.getInitialWeight());
env.put("d", exprItem.getAdditionalWeight());
profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExp,env).toString());
}
// 重量计算-结算重量
else if ("2".equals(quoteItem.getCalcType())) {
@ -753,7 +791,11 @@ public class EmisCommissionProfitServiceImpl extends EmisBaseService implements
if( isValueInExprScope(waybill.getBillWeight().doubleValue(),exprItem) ) {
calcExprStr = getCalcFeeExpStr(waybill.getBillWeight(),exprItem);
log.info("按重量计算:计算公式:" + calcExprStr + ",重量:" + waybill.getBillWeight().stripTrailingZeros().toPlainString());
profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExprStr).toString());
Map<String, Object> env = new HashMap<>();
env.put("w", waybill.getBillWeight());
env.put("s", exprItem.getInitialWeight());
env.put("d", exprItem.getAdditionalWeight());
profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExp,env).toString());
}
}
@ -763,7 +805,11 @@ public class EmisCommissionProfitServiceImpl extends EmisBaseService implements
if( isValueInExprScope(waybill.getTotalVolume().doubleValue(),exprItem) ) {
calcExprStr = getCalcFeeExpStr(waybill.getTotalVolume(),exprItem);
log.info("按体积计算:计算公式:" + calcExprStr + ",体积:"+waybill.getTotalVolume().stripTrailingZeros().toPlainString());
profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExprStr).toString());
Map<String, Object> env = new HashMap<>();
env.put("w", waybill.getTotalVolume());
env.put("s", exprItem.getInitialWeight());
env.put("d", exprItem.getAdditionalWeight());
profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExp,env).toString());
}
}
@ -774,7 +820,12 @@ public class EmisCommissionProfitServiceImpl extends EmisBaseService implements
.replaceAll("s", exprItem.getInitialWeight().toString())
.replaceAll("d", exprItem.getAdditionalWeight().toString());
log.info("按包裹数:计算公式:" + calcExprStr + ",包裹数:"+1);
profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExprStr).toString());
Map<String, Object> env = new HashMap<>();
env.put("w", new BigDecimal("1.0"));
env.put("s", exprItem.getInitialWeight());
env.put("d", exprItem.getAdditionalWeight());
profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExp,env).toString());
}
// 插入提成
@ -874,7 +925,12 @@ public class EmisCommissionProfitServiceImpl extends EmisBaseService implements
.replaceAll("d", exprItem.getAdditionalWeight().toString());
log.info("按票计算:计算公式:" + calcExprStr + ",票数:1");
profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExprStr).toString());
Map<String, Object> env = new HashMap<>();
env.put("w", new BigDecimal("1"));
env.put("s", exprItem.getInitialWeight());
env.put("d", exprItem.getAdditionalWeight());
profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExp,env).toString());
}
// 重量计算
else if ("2".equals(quoteItem.getCalcType())) {
@ -882,7 +938,12 @@ public class EmisCommissionProfitServiceImpl extends EmisBaseService implements
if( isValueInExprScope(waybill.getBillWeight().doubleValue(),exprItem) ) {
calcExprStr = getCalcFeeExpStr(waybill.getBillWeight(), exprItem);
log.info("按重量计算:计算公式:" + calcExprStr + ",重量:"+waybill.getBillWeight().stripTrailingZeros().toPlainString());
profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExprStr).toString());
Map<String, Object> env = new HashMap<>();
env.put("w", waybill.getBillWeight());
env.put("s", exprItem.getInitialWeight());
env.put("d", exprItem.getAdditionalWeight());
profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExp,env).toString());
}
}
@ -891,7 +952,11 @@ public class EmisCommissionProfitServiceImpl extends EmisBaseService implements
if( isValueInExprScope(waybill.getTotalVolume().doubleValue(),exprItem) ) {
calcExprStr = getCalcFeeExpStr(waybill.getTotalVolume(), exprItem);
log.info("按体积计算:计算公式:" + calcExprStr + ",体积:"+waybill.getTotalVolume().stripTrailingZeros().toPlainString());
profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExprStr).toString());
Map<String, Object> env = new HashMap<>();
env.put("w", waybill.getTotalVolume());
env.put("s", exprItem.getInitialWeight());
env.put("d", exprItem.getAdditionalWeight());
profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExp,env).toString());
}
}
// 包裹数
@ -901,7 +966,13 @@ public class EmisCommissionProfitServiceImpl extends EmisBaseService implements
.replaceAll("s", exprItem.getInitialWeight().toString())
.replaceAll("d", exprItem.getAdditionalWeight().toString());
log.info("按包裹数:计算公式:" + calcExprStr + ",包裹数:"+1);
profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExprStr).toString());
Map<String, Object> env = new HashMap<>();
env.put("w", new BigDecimal("1"));
env.put("s", exprItem.getInitialWeight());
env.put("d", exprItem.getAdditionalWeight());
profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExp,env).toString());
}
// 插入提成

View File

@ -3959,8 +3959,11 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
.replaceAll("d", exprItem.getAdditionalWeight().toString());
log.info("计算公式:" + calcExprStr + ",重量:" + emisWaybill.getSettlementWeight());
double fee = Double.valueOf(AviatorEvaluator.execute(calcExprStr).toString());
Map<String, Object> env = new HashMap<>();
env.put("w", emisWaybill.getSettlementWeight());
env.put("s", exprItem.getInitialWeight());
env.put("d", exprItem.getAdditionalWeight());
double fee = Double.valueOf(AviatorEvaluator.execute(calcExp,env).toString());
fee = WaybillHelper.calcSettledFee(fee, quoteItem.getPriceType());
// 如果低于最低报价,则使用最低报价来计算
if (fee < quoteItem.getLeastPrice().doubleValue()) {
@ -4017,7 +4020,11 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
.replaceAll("d", exprItem.getAdditionalWeight().toString());
log.info("计算公式:" + calcExprStr + ",体积:" + emisWaybill.getTotalVolume());
double fee = Double.valueOf(AviatorEvaluator.execute(calcExprStr).toString());
Map<String, Object> env = new HashMap<>();
env.put("w", emisWaybill.getTotalVolume());
env.put("s", exprItem.getInitialWeight());
env.put("d", exprItem.getAdditionalWeight());
double fee = Double.valueOf(AviatorEvaluator.execute(calcExp,env).toString());
fee = WaybillHelper.calcSettledFee(fee, quoteItem.getPriceType());
// 如果低于最低报价,则使用最低报价来计算

View File

@ -240,10 +240,5 @@ public class Calculator {
// System.out.println(isDoubleEquals(1.0E24, executeExpression("1000000000000*1000000000000 = ")));
// System.out.println(executeExpression("100"));
// String exprStr= "(w-1)*35+100";
String exprStr= "w*35";
String calcExprStr=exprStr.replaceAll("w","7.2");
double fee = Double.valueOf(AviatorEvaluator.execute(calcExprStr).toString());
System.out.println(fee);
}
}