md
This commit is contained in:
parent
93c12a6e72
commit
fe60f49f68
@ -18,7 +18,9 @@ import java.util.concurrent.CountDownLatch;
|
|||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.googlecode.aviator.AviatorEvaluator;
|
import com.googlecode.aviator.AviatorEvaluator;
|
||||||
|
import com.googlecode.aviator.Options;
|
||||||
import com.xdadan.erp.common.core.domain.entity.SysUser;
|
import com.xdadan.erp.common.core.domain.entity.SysUser;
|
||||||
import com.xdadan.erp.common.utils.DateUtils;
|
import com.xdadan.erp.common.utils.DateUtils;
|
||||||
import com.xdadan.erp.emis.domain.*;
|
import com.xdadan.erp.emis.domain.*;
|
||||||
@ -325,7 +327,11 @@ public class EmisTmsCostFeeServiceImpl extends EmisBaseService implements IEmisT
|
|||||||
itemCalcExpr="s";
|
itemCalcExpr="s";
|
||||||
}
|
}
|
||||||
String calcExprStr=getCalcFeeExpStr(itemCalcExpr,mainWaybill.getBillWeight(),BigDecimal.valueOf(10.0D),BigDecimal.valueOf(1.0D));
|
String calcExprStr=getCalcFeeExpStr(itemCalcExpr,mainWaybill.getBillWeight(),BigDecimal.valueOf(10.0D),BigDecimal.valueOf(1.0D));
|
||||||
double costFee = Double.valueOf(AviatorEvaluator.execute(calcExprStr).toString());
|
Map<String, Object> env = new HashMap<>();
|
||||||
|
env.put("w", mainWaybill.getBillWeight());
|
||||||
|
env.put("s", BigDecimal.valueOf(10.0D));
|
||||||
|
env.put("d", BigDecimal.valueOf(1.0D));
|
||||||
|
double costFee = Double.valueOf(AviatorEvaluator.execute(itemCalcExpr,env).toString());
|
||||||
log.info("网点取件费:计算公式:" + calcExprStr + ",重量:" + mainWaybill.getBillWeight().stripTrailingZeros().toPlainString());
|
log.info("网点取件费:计算公式:" + calcExprStr + ",重量:" + mainWaybill.getBillWeight().stripTrailingZeros().toPlainString());
|
||||||
|
|
||||||
// 取件费按进1获取
|
// 取件费按进1获取
|
||||||
@ -417,7 +423,12 @@ public class EmisTmsCostFeeServiceImpl extends EmisBaseService implements IEmisT
|
|||||||
}
|
}
|
||||||
|
|
||||||
String calcExprStr=getCalcFeeExpStr(itemCalcExpr,mainWaybill.getBillWeight(),BigDecimal.valueOf(15.0D),BigDecimal.valueOf(1.5D));
|
String calcExprStr=getCalcFeeExpStr(itemCalcExpr,mainWaybill.getBillWeight(),BigDecimal.valueOf(15.0D),BigDecimal.valueOf(1.5D));
|
||||||
double costFee = Double.valueOf(AviatorEvaluator.execute(calcExprStr).toString());
|
|
||||||
|
Map<String, Object> env = new HashMap<>();
|
||||||
|
env.put("w", mainWaybill.getBillWeight());
|
||||||
|
env.put("s", BigDecimal.valueOf(15.0D));
|
||||||
|
env.put("d", BigDecimal.valueOf(1.5D));
|
||||||
|
double costFee = Double.valueOf(AviatorEvaluator.execute(itemCalcExpr,env).toString());
|
||||||
log.info("网点派送费:计算公式:" + calcExprStr + ",重量:" + mainWaybill.getBillWeight().stripTrailingZeros().toPlainString());
|
log.info("网点派送费:计算公式:" + calcExprStr + ",重量:" + mainWaybill.getBillWeight().stripTrailingZeros().toPlainString());
|
||||||
|
|
||||||
costFee=WaybillHelper.calcSettledFee(costFee,"5");
|
costFee=WaybillHelper.calcSettledFee(costFee,"5");
|
||||||
@ -497,7 +508,11 @@ public class EmisTmsCostFeeServiceImpl extends EmisBaseService implements IEmisT
|
|||||||
.replaceAll("t", quotePriceItem.getTransWeight().stripTrailingZeros().toPlainString())
|
.replaceAll("t", quotePriceItem.getTransWeight().stripTrailingZeros().toPlainString())
|
||||||
.replaceAll("c", totalDbCostFee.stripTrailingZeros().toPlainString());
|
.replaceAll("c", totalDbCostFee.stripTrailingZeros().toPlainString());
|
||||||
|
|
||||||
double costFee = Double.valueOf(AviatorEvaluator.execute(calcExprStr).toString());
|
Map<String, Object> env = new HashMap<>();
|
||||||
|
env.put("w", mainWaybill.getBillWeight());
|
||||||
|
env.put("t", quotePriceItem.getTransWeight());
|
||||||
|
env.put("c", totalDbCostFee);
|
||||||
|
double costFee = Double.valueOf(AviatorEvaluator.execute(itemCalcExpr,env).toString());
|
||||||
|
|
||||||
log.info("网点机场短驳费:计算公式:" + calcExprStr + ",重量:" + waybill.getBillWeight().stripTrailingZeros().toPlainString());
|
log.info("网点机场短驳费:计算公式:" + calcExprStr + ",重量:" + waybill.getBillWeight().stripTrailingZeros().toPlainString());
|
||||||
|
|
||||||
@ -588,7 +603,12 @@ public class EmisTmsCostFeeServiceImpl extends EmisBaseService implements IEmisT
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
double costFee = Double.valueOf(AviatorEvaluator.execute(calcExprStr).toString());
|
Map<String, Object> env = new HashMap<>();
|
||||||
|
env.put("w", mainWaybill.getBillWeight());
|
||||||
|
env.put("t", quotePriceItem.getTransWeight());
|
||||||
|
env.put("d", quotePriceItem.getPrice());
|
||||||
|
env.put("c", totalDbCostFee);
|
||||||
|
double costFee = Double.valueOf(AviatorEvaluator.execute(itemCalcExpr,env).toString());
|
||||||
|
|
||||||
log.info("机场提货费操作费:计算公式:" + calcExprStr + ",重量:" + waybill.getBillWeight().stripTrailingZeros().toPlainString());
|
log.info("机场提货费操作费:计算公式:" + calcExprStr + ",重量:" + waybill.getBillWeight().stripTrailingZeros().toPlainString());
|
||||||
|
|
||||||
@ -884,7 +904,11 @@ public class EmisTmsCostFeeServiceImpl extends EmisBaseService implements IEmisT
|
|||||||
.replaceAll("t", oldCostFee.getRealTotalWeight().stripTrailingZeros().toPlainString())
|
.replaceAll("t", oldCostFee.getRealTotalWeight().stripTrailingZeros().toPlainString())
|
||||||
.replaceAll("c", totalDbCostFee.stripTrailingZeros().toPlainString());
|
.replaceAll("c", totalDbCostFee.stripTrailingZeros().toPlainString());
|
||||||
|
|
||||||
costFee = Double.valueOf(AviatorEvaluator.execute(calcExprStr).toString());
|
Map<String, Object> env = new HashMap<>();
|
||||||
|
env.put("w", waybill.getBillWeight());
|
||||||
|
env.put("t", oldCostFee.getRealTotalWeight());
|
||||||
|
env.put("c", totalDbCostFee);
|
||||||
|
costFee = Double.valueOf(AviatorEvaluator.execute(itemCalcExpr,env).toString());
|
||||||
log.info("按重量分摊:计算公式:" + calcExprStr + ",重量:" + waybill.getBillWeight().stripTrailingZeros().toPlainString());
|
log.info("按重量分摊:计算公式:" + calcExprStr + ",重量:" + waybill.getBillWeight().stripTrailingZeros().toPlainString());
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -894,7 +918,11 @@ public class EmisTmsCostFeeServiceImpl extends EmisBaseService implements IEmisT
|
|||||||
calcExprStr=itemCalcExpr.replaceAll("w", waybill.getTotalVolume().stripTrailingZeros().toPlainString())
|
calcExprStr=itemCalcExpr.replaceAll("w", waybill.getTotalVolume().stripTrailingZeros().toPlainString())
|
||||||
.replaceAll("t", oldCostFee.getRealTotalVolume().stripTrailingZeros().toPlainString())
|
.replaceAll("t", oldCostFee.getRealTotalVolume().stripTrailingZeros().toPlainString())
|
||||||
.replaceAll("c", totalDbCostFee.stripTrailingZeros().toPlainString());
|
.replaceAll("c", totalDbCostFee.stripTrailingZeros().toPlainString());
|
||||||
costFee = Double.valueOf(AviatorEvaluator.execute(calcExprStr).toString());
|
Map<String, Object> env = new HashMap<>();
|
||||||
|
env.put("w", waybill.getBillWeight());
|
||||||
|
env.put("t", oldCostFee.getRealTotalVolume());
|
||||||
|
env.put("c", totalDbCostFee);
|
||||||
|
costFee = Double.valueOf(AviatorEvaluator.execute(itemCalcExpr,env).toString());
|
||||||
log.info("按体积分摊:计算公式:" + calcExprStr + ",重量:" + waybill.getBillWeight().stripTrailingZeros().toPlainString());
|
log.info("按体积分摊:计算公式:" + calcExprStr + ",重量:" + waybill.getBillWeight().stripTrailingZeros().toPlainString());
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -903,7 +931,10 @@ public class EmisTmsCostFeeServiceImpl extends EmisBaseService implements IEmisT
|
|||||||
itemCalcExpr="(1/t)*c";
|
itemCalcExpr="(1/t)*c";
|
||||||
calcExprStr=itemCalcExpr.replaceAll("t",sendPieceSum.toString())
|
calcExprStr=itemCalcExpr.replaceAll("t",sendPieceSum.toString())
|
||||||
.replaceAll("c", totalDbCostFee.stripTrailingZeros().toPlainString());
|
.replaceAll("c", totalDbCostFee.stripTrailingZeros().toPlainString());
|
||||||
costFee = Double.valueOf(AviatorEvaluator.execute(calcExprStr).toString());
|
Map<String, Object> env = new HashMap<>();
|
||||||
|
env.put("t", new BigDecimal(sendPieceSum.toString()));
|
||||||
|
env.put("c", totalDbCostFee);
|
||||||
|
costFee = Double.valueOf(AviatorEvaluator.execute(itemCalcExpr,env).toString());
|
||||||
log.info("按票分摊:计算公式:" + calcExprStr + ",票数:1");
|
log.info("按票分摊:计算公式:" + calcExprStr + ",票数:1");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1117,8 +1148,23 @@ public class EmisTmsCostFeeServiceImpl extends EmisBaseService implements IEmisT
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
double costFee=WaybillHelper.calcSettledFee(0.001,"5");
|
// double costFee=WaybillHelper.calcSettledFee(0.001,"5");
|
||||||
// BigDecimal splitCostFee = BigDecimal.valueOf(costFee).setScale(0,BigDecimal.ROUND_HALF_UP);
|
// BigDecimal splitCostFee = BigDecimal.valueOf(costFee).setScale(0,BigDecimal.ROUND_HALF_UP);
|
||||||
|
// double costFee = AviatorEvaluator.execute("(19/234)*150");
|
||||||
|
// 设置全局选项
|
||||||
|
String itemCalcExpr="(w/t)*c";
|
||||||
|
|
||||||
|
AviatorEvaluator.setOption(Options.ALWAYS_PARSE_FLOATING_POINT_NUMBER_INTO_DECIMAL, true);
|
||||||
|
String calcExprStr="(19/234)*150";
|
||||||
|
// System.out.println(JSON.toJSONString(AviatorEvaluator.execute(calcExprStr)));
|
||||||
|
|
||||||
|
|
||||||
|
Map<String, Object> env = new HashMap<>();
|
||||||
|
env.put("w", new BigDecimal("19"));
|
||||||
|
env.put("t", new BigDecimal("234"));
|
||||||
|
env.put("c", new BigDecimal("150"));
|
||||||
|
double costFee = Double.valueOf(AviatorEvaluator.execute(itemCalcExpr,env).toString());
|
||||||
|
|
||||||
System.out.println(costFee);
|
System.out.println(costFee);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user