From bfa34ed61c9efdaf2d50d7c061fa7834fc2c5329 Mon Sep 17 00:00:00 2001 From: aike <17730485278@139.com> Date: Fri, 18 Jul 2025 16:40:58 +0800 Subject: [PATCH] =?UTF-8?q?demand:=20TMS=E7=B3=BB=E7=BB=9F=20-=20=E6=8F=90?= =?UTF-8?q?=E6=88=90=E7=AE=A1=E7=90=86=20-=20=E5=91=98=E5=B7=A5=E6=8F=90?= =?UTF-8?q?=E6=88=90=E6=96=B9=E6=A1=88=E9=85=8D=E7=BD=AE=E7=95=8C=E9=9D=A2?= =?UTF-8?q?=E4=BC=98=E5=8C=96=20committer:=20heyu?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/EmisCommissionProfitServiceImpl.java | 113 +++++++++++------- 1 file changed, 72 insertions(+), 41 deletions(-) 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 b3e126c16..c14a4034d 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 @@ -11,10 +11,7 @@ package com.xdadan.erp.emis.service.impl; import java.math.BigDecimal; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; @@ -546,14 +543,19 @@ public class EmisCommissionProfitServiceImpl extends EmisBaseService implements } // 重量计算 else if ("2".equals(quoteItem.getCalcType())) { - if( isValueInExprScope(waybill.getBillWeight().doubleValue(),exprItem) ){ - calcExprStr = getCalcFeeExpStr(waybill.getBillWeight(),exprItem); - log.info("按重量计算:计算公式:" + calcExprStr + ",重量:" + waybill.getBillWeight().stripTrailingZeros().toPlainString()); + String transType = waybill.getTransType(); + BigDecimal usedWeight = ("1".equals(transType) || "2".equals(transType)) + ? waybill.getSettlementWeight() + : waybill.getBillWeight(); + if (isValueInExprScope(usedWeight != null ? usedWeight.doubleValue() : 0.0, exprItem)) { + calcExprStr = getCalcFeeExpStr(usedWeight, exprItem); + log.info("按重量计算:计算公式:" + calcExprStr + ",重量:" + + (usedWeight != null ? usedWeight.stripTrailingZeros().toPlainString() : "0")); Map env = new HashMap<>(); - env.put("w", waybill.getBillWeight()); + env.put("w", usedWeight); env.put("s", exprItem.getInitialWeight()); env.put("d", exprItem.getAdditionalWeight()); - profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExp,env).toString()); + profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExp, env).toString()); } } @@ -680,14 +682,19 @@ public class EmisCommissionProfitServiceImpl extends EmisBaseService implements } // 重量计算 else if ("2".equals(quoteItem.getCalcType())) { - if( isValueInExprScope(waybill.getBillWeight().doubleValue(),exprItem) ) { - calcExprStr = getCalcFeeExpStr(waybill.getBillWeight(),exprItem); - log.info("按重量计算:计算公式:" + calcExprStr + ",重量:" + waybill.getBillWeight().stripTrailingZeros().toPlainString()); + String transType = waybill.getTransType(); + BigDecimal usedWeight = ("1".equals(transType) || "2".equals(transType)) + ? waybill.getSettlementWeight() + : waybill.getBillWeight(); + if (isValueInExprScope(usedWeight != null ? usedWeight.doubleValue() : 0.0, exprItem)) { + calcExprStr = getCalcFeeExpStr(usedWeight, exprItem); + log.info("按重量计算:计算公式:" + calcExprStr + ",重量:" + + (usedWeight != null ? usedWeight.stripTrailingZeros().toPlainString() : "0")); Map env = new HashMap<>(); - env.put("w", waybill.getBillWeight()); + env.put("w", usedWeight); env.put("s", exprItem.getInitialWeight()); env.put("d", exprItem.getAdditionalWeight()); - profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExp,env).toString()); + profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExp, env).toString()); } } @@ -823,15 +830,19 @@ public class EmisCommissionProfitServiceImpl extends EmisBaseService implements } // 重量计算-结算重量 else if ("2".equals(quoteItem.getCalcType())) { - - if( isValueInExprScope(waybill.getBillWeight().doubleValue(),exprItem) ) { - calcExprStr = getCalcFeeExpStr(waybill.getBillWeight(),exprItem); - log.info("按重量计算:计算公式:" + calcExprStr + ",重量:" + waybill.getBillWeight().stripTrailingZeros().toPlainString()); + String transType = waybill.getTransType(); + BigDecimal usedWeight = ("1".equals(transType) || "2".equals(transType)) + ? waybill.getSettlementWeight() + : waybill.getBillWeight(); + if (isValueInExprScope(usedWeight != null ? usedWeight.doubleValue() : 0.0, exprItem)) { + calcExprStr = getCalcFeeExpStr(usedWeight, exprItem); + log.info("按重量计算:计算公式:" + calcExprStr + ",重量:" + + (usedWeight != null ? usedWeight.stripTrailingZeros().toPlainString() : "0")); Map env = new HashMap<>(); - env.put("w", waybill.getBillWeight()); + env.put("w", usedWeight); env.put("s", exprItem.getInitialWeight()); env.put("d", exprItem.getAdditionalWeight()); - profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExp,env).toString()); + profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExp, env).toString()); } } @@ -975,16 +986,20 @@ public class EmisCommissionProfitServiceImpl extends EmisBaseService implements } // 重量计算 else if ("2".equals(quoteItem.getCalcType())) { - - if( isValueInExprScope(waybill.getBillWeight().doubleValue(),exprItem) ) { - calcExprStr = getCalcFeeExpStr(waybill.getBillWeight(), exprItem); - log.info("按重量计算:计算公式:" + calcExprStr + ",重量:"+waybill.getBillWeight().stripTrailingZeros().toPlainString()); + String transType = waybill.getTransType(); + BigDecimal usedWeight = ("1".equals(transType) || "2".equals(transType)) + ? waybill.getSettlementWeight() + : waybill.getBillWeight(); + if (isValueInExprScope(usedWeight != null ? usedWeight.doubleValue() : 0.0, exprItem)) { + calcExprStr = getCalcFeeExpStr(usedWeight, exprItem); + log.info("按重量计算:计算公式:" + calcExprStr + ",重量:" + + waybill.getBillWeight().stripTrailingZeros().toPlainString()); Map env = new HashMap<>(); - env.put("w", waybill.getBillWeight()); + env.put("w", usedWeight); env.put("s", exprItem.getInitialWeight()); env.put("d", exprItem.getAdditionalWeight()); - profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExp,env).toString()); + profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExp, env).toString()); } } @@ -1121,16 +1136,21 @@ public class EmisCommissionProfitServiceImpl extends EmisBaseService implements } // 重量计算 else if ("2".equals(quoteItem.getCalcType())) { - if( isValueInExprScope(waybill.getBillWeight().doubleValue(),exprItem) ) { - calcExprStr = getCalcFeeExpStr(waybill.getBillWeight(), exprItem); - log.info("按重量计算:计算公式:" + calcExprStr + ",重量:"+waybill.getBillWeight().stripTrailingZeros().toPlainString()); + String transType = waybill.getTransType(); + BigDecimal usedWeight = ("1".equals(transType) || "2".equals(transType)) + ? waybill.getSettlementWeight() + : waybill.getBillWeight(); + if (isValueInExprScope(usedWeight != null ? usedWeight.doubleValue() : 0.0, exprItem)) { + calcExprStr = getCalcFeeExpStr(usedWeight, exprItem); + log.info("按重量计算:计算公式:" + calcExprStr + ",重量:" + + waybill.getBillWeight().stripTrailingZeros().toPlainString()); Map env = new HashMap<>(); - env.put("w", waybill.getBillWeight()); + env.put("w", usedWeight); env.put("s", exprItem.getInitialWeight()); env.put("d", exprItem.getAdditionalWeight()); - profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExp,env).toString()); + profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExp, env).toString()); } @@ -1263,18 +1283,22 @@ public class EmisCommissionProfitServiceImpl extends EmisBaseService implements } // 重量计算 else if ("2".equals(quoteItem.getCalcType())) { + String transType = waybill.getTransType(); + BigDecimal usedWeight = ("1".equals(transType) || "2".equals(transType)) + ? waybill.getSettlementWeight() + : waybill.getBillWeight(); + if (isValueInExprScope(usedWeight != null ? usedWeight.doubleValue() : 0.0, exprItem)) { + calcExprStr = getCalcFeeExpStr(usedWeight, exprItem); - if( isValueInExprScope(waybill.getBillWeight().doubleValue(),exprItem) ) { - calcExprStr = getCalcFeeExpStr(waybill.getBillWeight(), exprItem); - - log.info("按重量计算:计算公式:" + calcExprStr + ",重量:"+waybill.getBillWeight().stripTrailingZeros().toPlainString()); + log.info("按重量计算:计算公式:" + calcExprStr + ",重量:" + + waybill.getBillWeight().stripTrailingZeros().toPlainString()); Map env = new HashMap<>(); - env.put("w", waybill.getBillWeight()); + env.put("w", usedWeight); env.put("s", exprItem.getInitialWeight()); env.put("d", exprItem.getAdditionalWeight()); - profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExp,env).toString()); + profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExp, env).toString()); } @@ -1424,18 +1448,25 @@ public class EmisCommissionProfitServiceImpl extends EmisBaseService implements } // 重量计算 else if ("2".equals(quoteItem.getCalcType())) { - calcExprStr = calcExp.replaceAll("w", waybill.getBillWeight().stripTrailingZeros().toPlainString()) + String transType = waybill.getTransType(); + BigDecimal usedWeight = ("1".equals(transType) || "2".equals(transType)) + ? waybill.getSettlementWeight() + : waybill.getBillWeight(); + calcExprStr = calcExp + .replaceAll("w", + usedWeight != null ? usedWeight.stripTrailingZeros().toPlainString() : "0") .replaceAll("s", exprItem.getInitialWeight().toString()) .replaceAll("d", exprItem.getAdditionalWeight().toString()); - log.info("按重量计算:计算公式:" + calcExprStr + ",重量:"+waybill.getBillWeight().stripTrailingZeros().toPlainString()); + log.info("按重量计算:计算公式:" + calcExprStr + ",重量:" + + waybill.getBillWeight().stripTrailingZeros().toPlainString()); Map env = new HashMap<>(); - env.put("w", waybill.getBillWeight()); + env.put("w", usedWeight); env.put("s", exprItem.getInitialWeight()); env.put("d", exprItem.getAdditionalWeight()); - profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExp,env).toString()); + profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExp, env).toString()); } // 体积计算