mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-24 01:59:20 +08:00
feat(ecom): 产品概况同步增加总成本字段
- ProductOverviewVO.SpecSummaryItem 和 SpecSummaryTotal 新增 totalCost 字段 - ShopOverviewStatisticsVO 也新增 totalCost - ProductOverviewServiceImpl / ShopOverviewStatisticsServiceImpl 计算并赋值总成本 - 前端 types.vo.ts 及各表格组件同步展示
This commit is contained in:
+6
@@ -204,6 +204,9 @@ public class ShopOverviewStatisticsVO {
|
||||
@Schema(description = "其他成本", example = "1000.00")
|
||||
private BigDecimal otherCost;
|
||||
|
||||
@Schema(description = "总成本(商品成本+运费+其他成本)", example = "5000.00")
|
||||
private BigDecimal totalCost;
|
||||
|
||||
@Schema(description = "退款金额", example = "1000.00")
|
||||
private BigDecimal refundAmount;
|
||||
|
||||
@@ -259,6 +262,9 @@ public class ShopOverviewStatisticsVO {
|
||||
@Schema(description = "其他成本", example = "1000.00")
|
||||
private BigDecimal otherCost;
|
||||
|
||||
@Schema(description = "总成本(商品成本+运费+其他成本)", example = "5000.00")
|
||||
private BigDecimal totalCost;
|
||||
|
||||
@Schema(description = "退款金额", example = "1000.00")
|
||||
private BigDecimal refundAmount;
|
||||
|
||||
|
||||
+4
@@ -510,6 +510,7 @@ public class ShopOverviewStatisticsServiceImpl implements ShopOverviewStatistics
|
||||
comparison.setProductCost(productCost);
|
||||
comparison.setShippingCost(shippingCost);
|
||||
comparison.setOtherCost(otherCost);
|
||||
comparison.setTotalCost(productCost.add(shippingCost).add(otherCost));
|
||||
comparison.setRefundAmount(refundAmount);
|
||||
comparison.setTotalPromotionFee(productPromotionFee);
|
||||
comparison.setBrushFee(brushFee);
|
||||
@@ -581,6 +582,7 @@ public class ShopOverviewStatisticsServiceImpl implements ShopOverviewStatistics
|
||||
total.setProductCost(totalProductCost);
|
||||
total.setShippingCost(totalShippingCost);
|
||||
total.setOtherCost(totalOtherCost);
|
||||
total.setTotalCost(totalCost);
|
||||
total.setRefundAmount(totalRefund);
|
||||
total.setTotalPromotionFee(totalPromoFee);
|
||||
total.setBrushFee(totalBrushFee);
|
||||
@@ -842,6 +844,7 @@ public class ShopOverviewStatisticsServiceImpl implements ShopOverviewStatistics
|
||||
cc.setProductCost(productCost);
|
||||
cc.setShippingCost(shippingCost);
|
||||
cc.setOtherCost(otherCost);
|
||||
cc.setTotalCost(totalCost);
|
||||
cc.setRefundAmount(refundAmount);
|
||||
cc.setTotalPromotionFee(catPromotionFee);
|
||||
cc.setBrushFee(catBrushFee);
|
||||
@@ -912,6 +915,7 @@ public class ShopOverviewStatisticsServiceImpl implements ShopOverviewStatistics
|
||||
total.setProductCost(totalProductCost);
|
||||
total.setShippingCost(totalShippingCost);
|
||||
total.setOtherCost(totalOtherCost);
|
||||
total.setTotalCost(totalCost);
|
||||
total.setRefundAmount(totalRefund);
|
||||
total.setTotalPromotionFee(totalPromoFee);
|
||||
total.setBrushFee(totalBrushFee);
|
||||
|
||||
+12
@@ -255,6 +255,12 @@ public class ProductOverviewVO {
|
||||
@Schema(description = "其他成本")
|
||||
private BigDecimal otherCost;
|
||||
|
||||
/**
|
||||
* 总成本(商品成本+运费+其他成本)
|
||||
*/
|
||||
@Schema(description = "总成本(商品成本+运费+其他成本)")
|
||||
private BigDecimal totalCost;
|
||||
|
||||
/**
|
||||
* 退款金额
|
||||
*/
|
||||
@@ -340,6 +346,12 @@ public class ProductOverviewVO {
|
||||
@Schema(description = "其他成本")
|
||||
private BigDecimal otherCost;
|
||||
|
||||
/**
|
||||
* 总成本(商品成本+运费+其他成本)
|
||||
*/
|
||||
@Schema(description = "总成本(商品成本+运费+其他成本)")
|
||||
private BigDecimal totalCost;
|
||||
|
||||
/**
|
||||
* 退款金额
|
||||
*/
|
||||
|
||||
+5
@@ -521,6 +521,7 @@ public class ProductOverviewServiceImpl implements ProductOverviewService {
|
||||
item.setProductCost(productCostTotal);
|
||||
item.setShippingCost(shippingCostTotal);
|
||||
item.setOtherCost(otherCostTotal);
|
||||
item.setTotalCost(productCostTotal.add(shippingCostTotal).add(otherCostTotal));
|
||||
item.setRefundAmount(refundAmount);
|
||||
item.setPromotionFee(specPromotionFee);
|
||||
item.setFeeRatio(feeRatio.multiply(new BigDecimal("100"))
|
||||
@@ -551,6 +552,9 @@ public class ProductOverviewServiceImpl implements ProductOverviewService {
|
||||
total.setOtherCost(specItems.stream()
|
||||
.map(ProductOverviewVO.SpecSummaryItem::getOtherCost)
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add));
|
||||
total.setTotalCost(specItems.stream()
|
||||
.map(ProductOverviewVO.SpecSummaryItem::getTotalCost)
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add));
|
||||
total.setRefundAmount(specItems.stream()
|
||||
.map(ProductOverviewVO.SpecSummaryItem::getRefundAmount)
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add));
|
||||
@@ -600,6 +604,7 @@ public class ProductOverviewServiceImpl implements ProductOverviewService {
|
||||
total.setProductCost(BigDecimal.ZERO);
|
||||
total.setShippingCost(BigDecimal.ZERO);
|
||||
total.setOtherCost(BigDecimal.ZERO);
|
||||
total.setTotalCost(BigDecimal.ZERO);
|
||||
total.setRefundAmount(BigDecimal.ZERO);
|
||||
total.setPromotionFee(BigDecimal.ZERO);
|
||||
total.setFeeRatio(BigDecimal.ZERO);
|
||||
|
||||
+11
-10
@@ -196,7 +196,6 @@ public class ShopExportServiceImpl implements ShopExportService {
|
||||
Cell titleCell = titleRow.createCell(0);
|
||||
titleCell.setCellValue("核心商品多维度损益汇总表 | " + dateRangeLabel);
|
||||
titleCell.setCellStyle(createTitleStyle(sheet.getWorkbook()));
|
||||
sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, 12));
|
||||
|
||||
CellStyle headerStyle = createHeaderStyle(sheet.getWorkbook());
|
||||
CellStyle dataStyle = createDataStyle(sheet.getWorkbook());
|
||||
@@ -204,9 +203,10 @@ public class ShopExportServiceImpl implements ShopExportService {
|
||||
String taxLabel = (taxRate.multiply(new BigDecimal("100")).setScale(0, RoundingMode.HALF_UP)).toPlainString() + "%税额";
|
||||
String[] headers = {
|
||||
"商品详情", "销售额", "单量", "客单价",
|
||||
"商品成本", "运费", "其他成本", "退款金额", "推广费", "刷单费用",
|
||||
"商品成本", "运费", "其他成本", "总成本", "退款金额", "推广费", "刷单费用",
|
||||
"费比(%)", "单品ROI", "税前盈亏", taxLabel, "税后净利"
|
||||
};
|
||||
sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, headers.length - 1));
|
||||
|
||||
Row headerRow = sheet.createRow(1);
|
||||
for (int i = 0; i < headers.length; i++) {
|
||||
@@ -225,14 +225,15 @@ public class ShopExportServiceImpl implements ShopExportService {
|
||||
setCell(row, 4, nvl(p.getProductCost(), BigDecimal.ZERO).setScale(2, RoundingMode.HALF_UP).doubleValue(), dataStyle);
|
||||
setCell(row, 5, nvl(p.getShippingCost(), BigDecimal.ZERO).setScale(2, RoundingMode.HALF_UP).doubleValue(), dataStyle);
|
||||
setCell(row, 6, nvl(p.getOtherCost(), BigDecimal.ZERO).setScale(2, RoundingMode.HALF_UP).doubleValue(), dataStyle);
|
||||
setCell(row, 7, nvl(p.getRefundAmount(), BigDecimal.ZERO).setScale(2, RoundingMode.HALF_UP).doubleValue(), dataStyle);
|
||||
setCell(row, 8, nvl(p.getTotalPromotionFee(), BigDecimal.ZERO).setScale(2, RoundingMode.HALF_UP).doubleValue(), dataStyle);
|
||||
setCell(row, 9, nvl(p.getBrushFee(), BigDecimal.ZERO).setScale(2, RoundingMode.HALF_UP).doubleValue(), dataStyle);
|
||||
setCell(row, 10, nvl(p.getFeeRatio(), BigDecimal.ZERO).setScale(4, RoundingMode.HALF_UP).doubleValue(), dataStyle);
|
||||
setCell(row, 11, nvl(p.getRoi(), BigDecimal.ZERO).setScale(2, RoundingMode.HALF_UP).doubleValue(), dataStyle);
|
||||
setCell(row, 12, nvl(p.getTotalProfitBeforeTax(), BigDecimal.ZERO).setScale(2, RoundingMode.HALF_UP).doubleValue(), dataStyle);
|
||||
setCell(row, 13, nvl(p.getSalesTaxAmount(), BigDecimal.ZERO).setScale(2, RoundingMode.HALF_UP).doubleValue(), dataStyle);
|
||||
setCell(row, 14, nvl(p.getProfitAfterTax(), BigDecimal.ZERO).setScale(2, RoundingMode.HALF_UP).doubleValue(), dataStyle);
|
||||
setCell(row, 7, nvl(p.getTotalCost(), BigDecimal.ZERO).setScale(2, RoundingMode.HALF_UP).doubleValue(), dataStyle);
|
||||
setCell(row, 8, nvl(p.getRefundAmount(), BigDecimal.ZERO).setScale(2, RoundingMode.HALF_UP).doubleValue(), dataStyle);
|
||||
setCell(row, 9, nvl(p.getTotalPromotionFee(), BigDecimal.ZERO).setScale(2, RoundingMode.HALF_UP).doubleValue(), dataStyle);
|
||||
setCell(row, 10, nvl(p.getBrushFee(), BigDecimal.ZERO).setScale(2, RoundingMode.HALF_UP).doubleValue(), dataStyle);
|
||||
setCell(row, 11, nvl(p.getFeeRatio(), BigDecimal.ZERO).setScale(4, RoundingMode.HALF_UP).doubleValue(), dataStyle);
|
||||
setCell(row, 12, nvl(p.getRoi(), BigDecimal.ZERO).setScale(2, RoundingMode.HALF_UP).doubleValue(), dataStyle);
|
||||
setCell(row, 13, nvl(p.getTotalProfitBeforeTax(), BigDecimal.ZERO).setScale(2, RoundingMode.HALF_UP).doubleValue(), dataStyle);
|
||||
setCell(row, 14, nvl(p.getSalesTaxAmount(), BigDecimal.ZERO).setScale(2, RoundingMode.HALF_UP).doubleValue(), dataStyle);
|
||||
setCell(row, 15, nvl(p.getProfitAfterTax(), BigDecimal.ZERO).setScale(2, RoundingMode.HALF_UP).doubleValue(), dataStyle);
|
||||
}
|
||||
|
||||
sheet.setColumnWidth(0, 5000);
|
||||
|
||||
Reference in New Issue
Block a user