This commit is contained in:
Leo
2025-11-21 23:26:29 +08:00
parent 2ead103faa
commit e7c991ed9c

View File

@@ -375,42 +375,29 @@ public class JDOrderListController extends BaseController
// 数量固定为1
String quantity = "1";
// 姓名(下单人)
String buyer = o.getBuyer() != null ? o.getBuyer() : "";
// 地址
String address = o.getAddress() != null ? o.getAddress() : "";
// 售价(京粉实际价格,如果没有则用付款金额-后返金额
Double sellingPrice = o.getJingfenActualPrice();
if (sellingPrice == null || sellingPrice == 0) {
Double payment = o.getPaymentAmount() != null ? o.getPaymentAmount() : 0.0;
Double rebate = o.getRebateAmount() != null ? o.getRebateAmount() : 0.0;
sellingPrice = payment - rebate;
}
String sellingPriceStr = sellingPrice != null && sellingPrice > 0
? String.format(java.util.Locale.ROOT, "%.2f", sellingPrice) : "";
// 成本(售价 - 利润,利润可能是后返金额)
Double cost = null;
Double rebate = o.getRebateAmount() != null ? o.getRebateAmount() : 0.0;
if (sellingPrice != null && sellingPrice > 0 && rebate > 0) {
cost = sellingPrice - rebate;
}
String costStr = cost != null && cost > 0
? String.format(java.util.Locale.ROOT, "%.2f", cost) : "";
// 利润(后返金额,或者售价-成本)
String profitStr = "";
if (rebate > 0) {
profitStr = String.format(java.util.Locale.ROOT, "%.2f", rebate);
} else if (sellingPrice != null && sellingPrice > 0 && cost != null && cost > 0) {
double profit = sellingPrice - cost;
if (profit > 0) {
profitStr = String.format(java.util.Locale.ROOT, "%.2f", profit);
// 姓名(从地址中提取,地址格式通常是"姓名 电话 详细地址"
String buyer = "";
if (address != null && !address.trim().isEmpty()) {
String[] addressParts = address.trim().split("\\s+");
if (addressParts.length > 0) {
buyer = addressParts[0];
}
}
// 售价固定为0
String sellingPriceStr = "0";
// 成本售价是0成本也设为空
String costStr = "";
// 利润(后返金额)
Double rebate = o.getRebateAmount() != null ? o.getRebateAmount() : 0.0;
String profitStr = rebate > 0
? String.format(java.util.Locale.ROOT, "%.2f", rebate) : "";
// 京东单号
String orderId = o.getOrderId() != null ? o.getOrderId() : "";