增加红线价计费
This commit is contained in:
+12
-4
@@ -1417,7 +1417,7 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
|
||||
return fees;
|
||||
}
|
||||
|
||||
/** 应收主表与订单计费一对一落库;销售价=套餐计费,产品价=产品目录价;红线价预留。 */
|
||||
/** 应收主表与订单计费一对一落库;销售价=套餐计费,产品价=产品目录价,红线价=红线目录价(含 REDLINE 附加费)。 */
|
||||
private PrcIncomeBill persistIncomeBill(PrcOrderBill bill, TmsPriceQuoteResult result)
|
||||
{
|
||||
if (bill == null || StringUtils.isEmpty(bill.getBillId()))
|
||||
@@ -1434,8 +1434,9 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
|
||||
row.setCreateBy(bill.getCreateBy());
|
||||
}
|
||||
row.setCurrency(StringUtils.isEmpty(bill.getCurrency()) ? "CNY" : bill.getCurrency());
|
||||
// 产品价=目录价;红线价预留
|
||||
// product catalog + redline from quote
|
||||
row.setProductAmount(result == null ? null : result.getProductAmount());
|
||||
row.setRedlineAmount(result == null ? null : result.getRedlineAmount());
|
||||
row.setSalesAmount(sales);
|
||||
row.setIncomeTotal(sales);
|
||||
row.setBelongSaler(bill.getBelongSaler());
|
||||
@@ -1480,7 +1481,7 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
|
||||
return fees;
|
||||
}
|
||||
|
||||
/** 应付主表与订单计费一对一落库;成本价/应付=产品目录价,同步写入 product_amount;红线价预留。 */
|
||||
/** 应付主表与订单计费一对一落库;成本价/应付=产品目录价,同步写入 product_amount;红线价同步写入 redline_amount。 */
|
||||
private PrcPayBill persistPayBill(PrcOrderBill bill, TmsPriceQuoteResult result)
|
||||
{
|
||||
if (bill == null || StringUtils.isEmpty(bill.getBillId()))
|
||||
@@ -1497,9 +1498,10 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
|
||||
row.setCreateBy(bill.getCreateBy());
|
||||
}
|
||||
row.setCurrency(StringUtils.isEmpty(bill.getCurrency()) ? "CNY" : bill.getCurrency());
|
||||
// 产品价/成本价=目录价;红线价预留
|
||||
// product/cost = catalog; redline from quote
|
||||
BigDecimal product = result == null ? null : result.getProductAmount();
|
||||
row.setProductAmount(product);
|
||||
row.setRedlineAmount(result == null ? null : result.getRedlineAmount());
|
||||
row.setCostAmount(pay);
|
||||
row.setPayTotal(pay);
|
||||
row.setBelongSaler(bill.getBelongSaler());
|
||||
@@ -1563,6 +1565,12 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
|
||||
r.setBizDate(bill.getBizDate());
|
||||
r.setFeeDetails(toIncomeFeeLines(incomeFees));
|
||||
r.setPayFeeDetails(toPayFeeLines(payFees));
|
||||
PrcIncomeBill incomeBill = incomeBillMapper.selectByBillId(bill.getBillId());
|
||||
if (incomeBill != null)
|
||||
{
|
||||
r.setProductAmount(incomeBill.getProductAmount());
|
||||
r.setRedlineAmount(incomeBill.getRedlineAmount());
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
+42
-1
@@ -989,7 +989,27 @@ public class TmsPriceQuoteServiceImpl implements ITmsPriceQuoteService
|
||||
}
|
||||
BigDecimal baseReg = base.getRegistrationFee() == null ? BigDecimal.ZERO : base.getRegistrationFee();
|
||||
BigDecimal freight = base.getFreightPrice().multiply(weight).setScale(2, rm);
|
||||
r.setRedlineAmount(freight.add(baseReg).setScale(2, rm));
|
||||
BigDecimal regScaled = baseReg.setScale(2, rm);
|
||||
r.setRedlineAmount(freight.add(regScaled).setScale(2, rm));
|
||||
// Stash freight/reg on existing payFeeDetails for income fee-line apportionment
|
||||
if (r.getPayFeeDetails() != null)
|
||||
{
|
||||
for (TmsPriceQuoteFeeLine line : r.getPayFeeDetails())
|
||||
{
|
||||
if (line == null || line.getFeeType() == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (FEE_BASIC.equals(line.getFeeType()))
|
||||
{
|
||||
line.setRedlineAmount(freight);
|
||||
}
|
||||
else if (FEE_REG.equals(line.getFeeType()))
|
||||
{
|
||||
line.setRedlineAmount(regScaled);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void applySurchargesAndFees(TmsPriceQuoteResult result)
|
||||
@@ -1006,11 +1026,15 @@ public class TmsPriceQuoteServiceImpl implements ITmsPriceQuoteService
|
||||
List<TmsPriceQuoteFeeLine> lines = new ArrayList<TmsPriceQuoteFeeLine>();
|
||||
BigDecimal productFreight = productAmountOf(result.getPayFeeDetails(), FEE_BASIC);
|
||||
BigDecimal productReg = productAmountOf(result.getPayFeeDetails(), FEE_REG);
|
||||
BigDecimal redlineFreight = redlineAmountOf(result.getPayFeeDetails(), FEE_BASIC);
|
||||
BigDecimal redlineReg = redlineAmountOf(result.getPayFeeDetails(), FEE_REG);
|
||||
TmsPriceQuoteFeeLine basicLine = feeLine(FEE_BASIC, feeNameOf(FEE_BASIC), 0L, freightAmount, currency, result.getRoundMode(), null);
|
||||
basicLine.setProductAmount(productFreight);
|
||||
basicLine.setRedlineAmount(redlineFreight);
|
||||
lines.add(basicLine);
|
||||
TmsPriceQuoteFeeLine regLine = feeLine(FEE_REG, feeNameOf(FEE_REG), 0L, registrationFee, currency, result.getRoundMode(), null);
|
||||
regLine.setProductAmount(productReg);
|
||||
regLine.setRedlineAmount(redlineReg);
|
||||
lines.add(regLine);
|
||||
|
||||
BigDecimal surchargeTotal = BigDecimal.ZERO;
|
||||
@@ -1477,6 +1501,23 @@ public class TmsPriceQuoteServiceImpl implements ITmsPriceQuoteService
|
||||
return null;
|
||||
}
|
||||
|
||||
/** Read redline catalog amount for a fee type from payFeeDetails. */
|
||||
private static BigDecimal redlineAmountOf(List<TmsPriceQuoteFeeLine> payLines, String feeType)
|
||||
{
|
||||
if (payLines == null || feeType == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
for (TmsPriceQuoteFeeLine line : payLines)
|
||||
{
|
||||
if (line != null && feeType.equals(line.getFeeType()))
|
||||
{
|
||||
return line.getRedlineAmount();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static TmsPriceQuoteFeeLine feeLine(String feeType, String feeName, Long scId, BigDecimal amount,
|
||||
String currency, String roundMode, String remark)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user