1
This commit is contained in:
@@ -173,6 +173,10 @@ public class JDOrder extends BaseEntity {
|
||||
/** 利润是否手动锁定(1 是:保存时不再自动重算) */
|
||||
private Integer profitManual;
|
||||
|
||||
/** 额外成本(计入自动利润:从 netReceipt − 成本中再减去此项,默认 0) */
|
||||
@Excel(name = "额外成本")
|
||||
private Double extraCost;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ public class JDOrderProfitServiceImpl implements IJDOrderProfitService {
|
||||
|
||||
if ("H-TF".equals(mark)) {
|
||||
if (!profitLocked) {
|
||||
// 与 F 单一致:利润 = 对客实收 − (下单付款 − 后返)。列表未填售价时默认直款并从型号配置取价。
|
||||
// 与 F 单一致:利润 = 对客实收 − (下单付款 − 后返) − 额外成本。列表未填售价时默认直款并从型号配置取价。
|
||||
String type = order.getSellingPriceType();
|
||||
if (type == null || type.isEmpty()) {
|
||||
order.setSellingPriceType("direct");
|
||||
@@ -61,7 +61,9 @@ public class JDOrderProfitServiceImpl implements IJDOrderProfitService {
|
||||
} else {
|
||||
String buyer = order.getBuyer();
|
||||
boolean fan = buyer != null && buyer.trim().startsWith("凡-");
|
||||
order.setProfit(fan ? 65.0 : 15.0);
|
||||
double base = fan ? 65.0 : 15.0;
|
||||
order.setProfit(BigDecimal.valueOf(base - extraCostOrZero(order))
|
||||
.setScale(2, RoundingMode.HALF_UP).doubleValue());
|
||||
}
|
||||
}
|
||||
return;
|
||||
@@ -127,13 +129,19 @@ public class JDOrderProfitServiceImpl implements IJDOrderProfitService {
|
||||
order.setProfit(null);
|
||||
return;
|
||||
}
|
||||
// 成本 = 下单付款 - 后返金额;利润 = 对客实收(直款=售价,闲鱼=扣点后的到账)- 成本
|
||||
// 成本 = 下单付款 - 后返金额;利润 = 对客实收 − 成本 − 额外成本
|
||||
double cost = BigDecimal.valueOf(pay).subtract(BigDecimal.valueOf(rebate))
|
||||
.setScale(2, RoundingMode.HALF_UP).doubleValue();
|
||||
order.setProfit(BigDecimal.valueOf(netReceipt - cost)
|
||||
double net = netReceipt - cost - extraCostOrZero(order);
|
||||
order.setProfit(BigDecimal.valueOf(net)
|
||||
.setScale(2, RoundingMode.HALF_UP).doubleValue());
|
||||
}
|
||||
|
||||
private static double extraCostOrZero(JDOrder order) {
|
||||
Double e = order == null ? null : order.getExtraCost();
|
||||
return e != null ? e : 0.0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int syncAutoProfitIfChanged(List<Long> ids) {
|
||||
if (ids == null || ids.isEmpty()) {
|
||||
|
||||
Reference in New Issue
Block a user