1
This commit is contained in:
@@ -318,7 +318,7 @@ public class InstructionServiceImpl implements IInstructionService {
|
||||
double rebateAmount = globalRebateAmounts.getOrDefault(model, 0.0);
|
||||
int count = entry.getValue();
|
||||
|
||||
// 计算单台价格(总付款金额 / 数量)
|
||||
// 计算单台价格(总付款金额 / 数量)用于显示
|
||||
double singlePayment = count > 0 ? paymentAmount / count : 0.0;
|
||||
double singleRebate = count > 0 ? rebateAmount / count : 0.0;
|
||||
|
||||
@@ -333,17 +333,18 @@ public class InstructionServiceImpl implements IInstructionService {
|
||||
// 如果获取失败,佣金为0
|
||||
}
|
||||
|
||||
// 计算净价(单台价格 - 返现 + 佣金)
|
||||
double netPrice = singlePayment - singleRebate + commission;
|
||||
// 计算总价
|
||||
double totalPrice = netPrice * count;
|
||||
// 用总金额计算,避免精度损失:总价 = 总付款 - 总返现 + (佣金 × 数量)
|
||||
double totalPrice = paymentAmount - rebateAmount + (commission * count);
|
||||
grandTotal += totalPrice;
|
||||
|
||||
// 计算净价用于显示(总价 / 数量)
|
||||
double netPrice = count > 0 ? totalPrice / count : 0.0;
|
||||
|
||||
// 格式:单台价格-返现+佣金=净价×数量=总价
|
||||
if (count == 1) {
|
||||
// 数量为1时,不显示×1
|
||||
calculationLines.append(String.format("%.1f-%.0f+%.0f=%.1f\n",
|
||||
singlePayment, singleRebate, commission, netPrice));
|
||||
singlePayment, singleRebate, commission, totalPrice));
|
||||
} else {
|
||||
calculationLines.append(String.format("%.1f-%.0f+%.0f=%.1f×%d=%.1f\n",
|
||||
singlePayment, singleRebate, commission, netPrice, count, totalPrice));
|
||||
@@ -364,9 +365,6 @@ public class InstructionServiceImpl implements IInstructionService {
|
||||
double rebateAmount = globalRebateAmounts.getOrDefault(model, 0.0);
|
||||
int count = entry.getValue();
|
||||
|
||||
double singlePayment = count > 0 ? paymentAmount / count : 0.0;
|
||||
double singleRebate = count > 0 ? rebateAmount / count : 0.0;
|
||||
|
||||
double commission = 0.0;
|
||||
try {
|
||||
com.ruoyi.jarvis.domain.ProductJdConfig config = productJdConfigService.selectProductJdConfigByModel(model);
|
||||
@@ -376,8 +374,8 @@ public class InstructionServiceImpl implements IInstructionService {
|
||||
} catch (Exception e) {
|
||||
}
|
||||
|
||||
double netPrice = singlePayment - singleRebate + commission;
|
||||
double totalPrice = netPrice * count;
|
||||
// 用总金额计算
|
||||
double totalPrice = paymentAmount - rebateAmount + (commission * count);
|
||||
|
||||
if (i > 0) {
|
||||
summaryFormula.append("+");
|
||||
|
||||
Reference in New Issue
Block a user