feat: 优化经营概览

This commit is contained in:
2026-08-18 23:41:02 +08:00
parent 63aeb330a2
commit 5c104446b2
8 changed files with 97 additions and 86 deletions
@@ -312,7 +312,7 @@ public class CategoryExportExcelServiceImpl implements CategoryExportExcelServic
}
/**
* 列顺序与前端 {@code CategoryComparisonTable.vue} 一致;费比列为「百分比数值」(×100,一位小数),与页面展示一致。
* 列顺序与工作台品类/商品汇总表一致:税额在订单成本后,费比在 ROI 前。
*/
private void writeCategoryMultidimensionalSheet(
Sheet sheet,
@@ -332,8 +332,8 @@ public class CategoryExportExcelServiceImpl implements CategoryExportExcelServic
+ "%税额";
String[] headers = {
dimensionColumnHeader, "实际销售额", "单量", "客单价",
"商品成本", "运费", "其他成本", "订单成本", "退款金额", "推广费", "刷单费用", "费比 %",
"税前盈亏", taxHeader, "ROI", "税后盈亏"
"商品成本", "运费", "其他成本", "订单成本", "退款金额", taxHeader, "推广费", "刷单费",
"税前盈亏", "费比 %", "ROI", "税后盈亏"
};
Row titleRow = sheet.createRow(0);
@@ -375,16 +375,16 @@ public class CategoryExportExcelServiceImpl implements CategoryExportExcelServic
setCell(row, 5, bd2Money(d.getShippingCost()), style);
setCell(row, 6, bd2Money(d.getOtherCost()), style);
setCell(row, 7, bd2Money(d.getOrderCost()), style);
setCell(row, 8, bd2Money(d.getRefundAmount()), style);
setCell(row, 9, bd2Money(d.getTotalPromotionFee()), style);
setCell(row, 10, bd2Money(d.getBrushFee()), style);
setCell(row, 11, bd2FeeRatioPercent(d.getFeeRatio()), style);
setCell(row, 12, bd2Money(d.getTotalProfitBeforeTax()), style);
BigDecimal salesTax = salesTaxOnNetForCategoryExport(d.getSalesAmount(), d.getRefundAmount(), taxRate);
BigDecimal profitAfterTax = (d.getTotalProfitBeforeTax() != null ? d.getTotalProfitBeforeTax() : BigDecimal.ZERO)
.subtract(salesTax)
.setScale(2, RoundingMode.HALF_UP);
setCell(row, 13, bd2Money(salesTax), style);
setCell(row, 8, bd2Money(d.getRefundAmount()), style);
setCell(row, 9, bd2Money(salesTax), style);
setCell(row, 10, bd2Money(d.getTotalPromotionFee()), style);
setCell(row, 11, bd2Money(d.getBrushFee()), style);
setCell(row, 12, bd2Money(d.getTotalProfitBeforeTax()), style);
setCell(row, 13, bd2FeeRatioPercent(d.getFeeRatio()), style);
setCell(row, 14, bd2Roi(d.getRoi()), style);
setCell(row, 15, bd2Money(profitAfterTax), style);
}
@@ -132,8 +132,8 @@ public class ExportServiceImpl implements ExportService {
String[] headers = {
firstColumnHeader, "目标单量", "单量达成率(%)", "目标额", "销售达成率(%)",
"实际销售额", "成交金额", "单量", "客单价",
"商品成本", "运费", "其他成本", "订单成本", "退款金额", "推广费", "刷单费用", "费比",
"毛利", "税前净利", taxLabel, "ROI", "税后净利"
"商品成本", "运费", "其他成本", "订单成本", "退款金额", taxLabel, "推广费", "刷单费",
"毛利", "税前净利", "费比", "ROI", "税后净利"
};
sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, headers.length - 1));
CellStyle headerStyle = createHeaderStyle(wb);
@@ -177,12 +177,6 @@ public class ExportServiceImpl implements ExportService {
setCell(row, 10, objToDouble(data.get("shippingCost")), style);
setCell(row, 11, objToDouble(data.get("otherCost")), style);
setCell(row, 12, objToDouble(data.get("orderCost")), style);
setCell(row, 13, objToDouble(data.get("refundAmount")), style);
setCell(row, 14, objToDouble(data.get("totalPromotionFee")), style);
setCell(row, 15, objToDouble(data.get("brushFee")), style);
setCell(row, 16, objToDouble(data.get("feeRatio")), style);
setCell(row, 17, objToDouble(data.get("grossProfit")), style);
setCell(row, 18, objToDouble(data.get("totalProfitBeforeTax")), style);
BigDecimal salesTax = salesTaxOnNetForExport(
mapToBigDecimal(data.get("salesAmount")),
mapToBigDecimal(data.get("refundAmount")),
@@ -190,7 +184,13 @@ public class ExportServiceImpl implements ExportService {
BigDecimal profitAfterTax = mapToBigDecimal(data.get("totalProfitBeforeTax"))
.subtract(salesTax)
.setScale(2, RoundingMode.HALF_UP);
setCell(row, 19, salesTax.doubleValue(), style);
setCell(row, 13, objToDouble(data.get("refundAmount")), style);
setCell(row, 14, salesTax.doubleValue(), style);
setCell(row, 15, objToDouble(data.get("totalPromotionFee")), style);
setCell(row, 16, objToDouble(data.get("brushFee")), style);
setCell(row, 17, objToDouble(data.get("grossProfit")), style);
setCell(row, 18, objToDouble(data.get("totalProfitBeforeTax")), style);
setCell(row, 19, objToDouble(data.get("feeRatio")), style);
setCell(row, 20, objToDouble(data.get("roi")), style);
setCell(row, 21, profitAfterTax.doubleValue(), style);
}