This commit is contained in:
linfso 2025-06-09 22:09:04 +08:00
parent eac599fe8b
commit da0ddd434c
2 changed files with 77 additions and 66 deletions

View File

@ -1812,7 +1812,7 @@ public class EmisBaseService {
// 新费用
newTotalFee = emisSettleSubBill.getBillFee();
// 若果新费用和老费用不相同,需要走审核流程:设置初始账单未确认
// 如果新费用和老费用不相同,需要走审核流程:设置初始账单未确认
if(oldTotalFee.compareTo(newTotalFee)!=0) {
emisSettleSubBill.setBlConfirmSite("0");
emisSettleSubBill.setBlConfirmCenter("0");

View File

@ -291,7 +291,20 @@ public class EmisCommissionProfitServiceImpl extends EmisBaseService implements
}
private boolean isValueInExprScope(double checkValue,EmisCommissionExpression exprItem){
if (exprItem.getStartWeight().doubleValue() < checkValue && exprItem.getEndWeight().doubleValue() >= checkValue) {
return true;
}
else{
return false;
}
}
private String getCalcFeeExpStr(BigDecimal w,EmisCommissionExpression exprItem){
return exprItem.getCalculateExpression().replaceAll("w", w.stripTrailingZeros().toPlainString())
.replaceAll("s", exprItem.getInitialWeight().toString())
.replaceAll("d", exprItem.getAdditionalWeight().toString());
}
/**
* 根据单号重新计算提成
*/
@ -493,21 +506,20 @@ public class EmisCommissionProfitServiceImpl extends EmisBaseService implements
}
// 重量计算
else if ("2".equals(quoteItem.getCalcType())) {
calcExprStr = calcExp.replaceAll("w", waybill.getSettlementWeight().stripTrailingZeros().toPlainString())
.replaceAll("s", exprItem.getInitialWeight().toString())
.replaceAll("d", exprItem.getAdditionalWeight().toString());
log.info("按重量计算:计算公式:" + calcExprStr + ",重量:"+waybill.getSettlementWeight().stripTrailingZeros().toPlainString());
profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExprStr).toString());
if( isValueInExprScope(waybill.getSettlementWeight().doubleValue(),exprItem) ){
calcExprStr = getCalcFeeExpStr(waybill.getSettlementWeight(),exprItem);
log.info("按重量计算:计算公式:" + calcExprStr + ",重量:" + waybill.getSettlementWeight().stripTrailingZeros().toPlainString());
profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExprStr).toString());
}
}
// 体积计算
else if ("3".equals(quoteItem.getCalcType())) {
calcExprStr = calcExp.replaceAll("w", waybill.getTotalVolume().stripTrailingZeros().toPlainString())
.replaceAll("s", exprItem.getInitialWeight().toString())
.replaceAll("d", exprItem.getAdditionalWeight().toString());
log.info("按体积计算:计算公式:" + calcExprStr + ",体积:"+waybill.getTotalVolume().stripTrailingZeros().toPlainString());
profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExprStr).toString());
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());
}
}
// 包裹数
else if ("4".equals(quoteItem.getCalcType())) {
@ -611,21 +623,20 @@ public class EmisCommissionProfitServiceImpl extends EmisBaseService implements
}
// 重量计算
else if ("2".equals(quoteItem.getCalcType())) {
calcExprStr = calcExp.replaceAll("w", waybill.getSettlementWeight().stripTrailingZeros().toPlainString())
.replaceAll("s", exprItem.getInitialWeight().toString())
.replaceAll("d", exprItem.getAdditionalWeight().toString());
log.info("按重量计算:计算公式:" + calcExprStr + ",重量:"+waybill.getSettlementWeight().stripTrailingZeros().toPlainString());
profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExprStr).toString());
if( isValueInExprScope(waybill.getSettlementWeight().doubleValue(),exprItem) ) {
calcExprStr = getCalcFeeExpStr(waybill.getSettlementWeight(),exprItem);
log.info("按重量计算:计算公式:" + calcExprStr + ",重量:" + waybill.getSettlementWeight().stripTrailingZeros().toPlainString());
profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExprStr).toString());
}
}
// 体积计算
else if ("3".equals(quoteItem.getCalcType())) {
calcExprStr = calcExp.replaceAll("w", waybill.getTotalVolume().stripTrailingZeros().toPlainString())
.replaceAll("s", exprItem.getInitialWeight().toString())
.replaceAll("d", exprItem.getAdditionalWeight().toString());
log.info("按体积计算:计算公式:" + calcExprStr + ",体积:"+waybill.getTotalVolume().stripTrailingZeros().toPlainString());
profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExprStr).toString());
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());
}
}
// 包裹数
else if ("4".equals(quoteItem.getCalcType())) {
@ -721,6 +732,9 @@ public class EmisCommissionProfitServiceImpl extends EmisBaseService implements
for (EmisCommissionExpression exprItem : exprList) {
log.info("计算项目表达式:" + JSONObject.toJSONString(exprItem));
double startValue=exprItem.getStartWeight();
double endValue=exprItem.getEndWeight();
String calcExp = exprItem.getCalculateExpression();
double profitMoney = 0.0D;
@ -735,21 +749,23 @@ public class EmisCommissionProfitServiceImpl extends EmisBaseService implements
}
// 重量计算-结算重量
else if ("2".equals(quoteItem.getCalcType())) {
calcExprStr = calcExp.replaceAll("w", waybill.getBillWeight().stripTrailingZeros().toPlainString())
.replaceAll("s", exprItem.getInitialWeight().toString())
.replaceAll("d", exprItem.getAdditionalWeight().toString());
log.info("按重量计算:计算公式:" + calcExprStr + ",重量:"+waybill.getBillWeight().stripTrailingZeros().toPlainString());
profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExprStr).toString());
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());
}
}
// 体积计算
else if ("3".equals(quoteItem.getCalcType())) {
calcExprStr = calcExp.replaceAll("w", waybill.getTotalVolume().stripTrailingZeros().toPlainString())
.replaceAll("s", exprItem.getInitialWeight().toString())
.replaceAll("d", exprItem.getAdditionalWeight().toString());
log.info("按体积计算:计算公式:" + calcExprStr + ",体积:"+waybill.getTotalVolume().stripTrailingZeros().toPlainString());
profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExprStr).toString());
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());
}
}
// 包裹数
else if ("4".equals(quoteItem.getCalcType())) {
@ -862,21 +878,21 @@ public class EmisCommissionProfitServiceImpl extends EmisBaseService implements
}
// 重量计算
else if ("2".equals(quoteItem.getCalcType())) {
calcExprStr = calcExp.replaceAll("w", waybill.getSettlementWeight().stripTrailingZeros().toPlainString())
.replaceAll("s", exprItem.getInitialWeight().toString())
.replaceAll("d", exprItem.getAdditionalWeight().toString());
log.info("按重量计算:计算公式:" + calcExprStr + ",重量:"+waybill.getSettlementWeight().stripTrailingZeros().toPlainString());
profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExprStr).toString());
if( isValueInExprScope(waybill.getSettlementWeight().doubleValue(),exprItem) ) {
calcExprStr = getCalcFeeExpStr(waybill.getSettlementWeight(), exprItem);
log.info("按重量计算:计算公式:" + calcExprStr + ",重量:"+waybill.getSettlementWeight().stripTrailingZeros().toPlainString());
profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExprStr).toString());
}
}
// 体积计算
else if ("3".equals(quoteItem.getCalcType())) {
calcExprStr = calcExp.replaceAll("w", waybill.getTotalVolume().stripTrailingZeros().toPlainString())
.replaceAll("s", exprItem.getInitialWeight().toString())
.replaceAll("d", exprItem.getAdditionalWeight().toString());
log.info("按体积计算:计算公式:" + calcExprStr + ",体积:"+waybill.getTotalVolume().stripTrailingZeros().toPlainString());
profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExprStr).toString());
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());
}
}
// 包裹数
else if ("4".equals(quoteItem.getCalcType())) {
@ -987,21 +1003,23 @@ public class EmisCommissionProfitServiceImpl extends EmisBaseService implements
}
// 重量计算
else if ("2".equals(quoteItem.getCalcType())) {
calcExprStr = calcExp.replaceAll("w", waybill.getSettlementWeight().stripTrailingZeros().toPlainString())
.replaceAll("s", exprItem.getInitialWeight().toString())
.replaceAll("d", exprItem.getAdditionalWeight().toString());
if( isValueInExprScope(waybill.getSettlementWeight().doubleValue(),exprItem) ) {
calcExprStr = getCalcFeeExpStr(waybill.getSettlementWeight(), exprItem);
log.info("按重量计算:计算公式:" + calcExprStr + ",重量:"+waybill.getSettlementWeight().stripTrailingZeros().toPlainString());
profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExprStr).toString());
}
log.info("按重量计算:计算公式:" + calcExprStr + ",重量:"+waybill.getSettlementWeight().stripTrailingZeros().toPlainString());
profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExprStr).toString());
}
// 体积计算
else if ("3".equals(quoteItem.getCalcType())) {
calcExprStr = calcExp.replaceAll("w", waybill.getTotalVolume().stripTrailingZeros().toPlainString())
.replaceAll("s", exprItem.getInitialWeight().toString())
.replaceAll("d", exprItem.getAdditionalWeight().toString());
log.info("按体积计算:计算公式:" + calcExprStr + ",体积:"+waybill.getTotalVolume().stripTrailingZeros().toPlainString());
profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExprStr).toString());
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());
}
}
// 包裹数
else if ("4".equals(quoteItem.getCalcType())) {
@ -1102,32 +1120,25 @@ public class EmisCommissionProfitServiceImpl extends EmisBaseService implements
// 重量计算
else if ("2".equals(quoteItem.getCalcType())) {
if (exprItem.getStartWeight().doubleValue() < waybill.getSettlementWeight().doubleValue()
&& exprItem.getEndWeight().doubleValue() >= waybill.getSettlementWeight().doubleValue()
) {
calcExprStr = calcExp.replaceAll("w", waybill.getSettlementWeight().stripTrailingZeros().toPlainString())
.replaceAll("s", exprItem.getInitialWeight().toString())
.replaceAll("d", exprItem.getAdditionalWeight().toString());
if( isValueInExprScope(waybill.getSettlementWeight().doubleValue(),exprItem) ) {
calcExprStr = getCalcFeeExpStr(waybill.getSettlementWeight(), exprItem);
log.info("按重量计算:计算公式:" + calcExprStr + ",重量:"+waybill.getSettlementWeight().stripTrailingZeros().toPlainString());
profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExprStr).toString());
}
}
// 体积计算
else if ("3".equals(quoteItem.getCalcType())) {
if (exprItem.getStartWeight().doubleValue() < waybill.getTotalVolume().doubleValue()
&& exprItem.getEndWeight().doubleValue() >= waybill.getTotalVolume().doubleValue()
) {
if( isValueInExprScope(waybill.getTotalVolume().doubleValue(),exprItem) ) {
calcExprStr = getCalcFeeExpStr(waybill.getTotalVolume(), exprItem);
calcExprStr = calcExp.replaceAll("w", waybill.getTotalVolume().stripTrailingZeros().toPlainString())
.replaceAll("s", exprItem.getInitialWeight().toString())
.replaceAll("d", exprItem.getAdditionalWeight().toString());
log.info("按体积计算:计算公式:" + calcExprStr + ",体积:"+waybill.getTotalVolume().stripTrailingZeros().toPlainString());
profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExprStr).toString());
}
}