✨ 新增毛利分析报表及提成设置
This commit is contained in:
+103
@@ -0,0 +1,103 @@
|
||||
package com.bms.web.controller.report;
|
||||
|
||||
import java.util.List;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.bms.common.annotation.Log;
|
||||
import com.bms.common.core.controller.BaseController;
|
||||
import com.bms.common.core.domain.AjaxResult;
|
||||
import com.bms.common.core.page.TableDataInfo;
|
||||
import com.bms.common.enums.BusinessType;
|
||||
import com.bms.common.utils.poi.ExcelUtil;
|
||||
import com.bms.price.domain.PrcProfitCommissionRate;
|
||||
import com.bms.price.domain.vo.PrcProfitReportOrderRow;
|
||||
import com.bms.price.domain.vo.PrcProfitReportProductRow;
|
||||
import com.bms.price.domain.vo.PrcProfitReportQuery;
|
||||
import com.bms.price.domain.vo.PrcProfitReportSummary;
|
||||
import com.bms.price.service.IPrcProfitReportService;
|
||||
|
||||
/** 产品/订单维度毛利报表。 */
|
||||
@RestController
|
||||
@RequestMapping("/report/profit")
|
||||
public class PrcProfitReportController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IPrcProfitReportService profitReportService;
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('report:profit:list')")
|
||||
@GetMapping("/summary")
|
||||
public AjaxResult summary(PrcProfitReportQuery query)
|
||||
{
|
||||
return success(profitReportService.selectSummary(query));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('report:profit:commission:list')")
|
||||
@GetMapping("/commission-rates")
|
||||
public AjaxResult commissionRates()
|
||||
{
|
||||
return success(profitReportService.selectCommissionRates());
|
||||
}
|
||||
|
||||
@Log(title = "毛利报表-业务员提成比例", businessType = BusinessType.INSERT)
|
||||
@PreAuthorize("@ss.hasPermi('report:profit:commission:save')")
|
||||
@PostMapping("/commission-rates")
|
||||
public AjaxResult saveCommissionRate(@RequestBody PrcProfitCommissionRate rate)
|
||||
{
|
||||
profitReportService.saveCommissionRate(rate);
|
||||
return success();
|
||||
}
|
||||
|
||||
@Log(title = "毛利报表-业务员提成比例", businessType = BusinessType.DELETE)
|
||||
@PreAuthorize("@ss.hasPermi('report:profit:commission:remove')")
|
||||
@DeleteMapping("/commission-rates/{rateId}")
|
||||
public AjaxResult deleteCommissionRate(@PathVariable Long rateId)
|
||||
{
|
||||
return toAjax(profitReportService.deleteCommissionRate(rateId));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('report:profit:list')")
|
||||
@GetMapping("/orders")
|
||||
public TableDataInfo orders(PrcProfitReportQuery query)
|
||||
{
|
||||
startPage();
|
||||
List<PrcProfitReportOrderRow> rows = profitReportService.selectOrderRows(query);
|
||||
return getDataTable(rows);
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('report:profit:list')")
|
||||
@GetMapping("/products")
|
||||
public TableDataInfo products(PrcProfitReportQuery query)
|
||||
{
|
||||
startPage();
|
||||
List<PrcProfitReportProductRow> rows = profitReportService.selectProductRows(query);
|
||||
return getDataTable(rows);
|
||||
}
|
||||
|
||||
@Log(title = "毛利报表-订单维度", businessType = BusinessType.EXPORT)
|
||||
@PreAuthorize("@ss.hasPermi('report:profit:export')")
|
||||
@PostMapping("/orders/export")
|
||||
public void exportOrders(HttpServletResponse response, PrcProfitReportQuery query)
|
||||
{
|
||||
List<PrcProfitReportOrderRow> rows = profitReportService.selectOrderRows(query);
|
||||
new ExcelUtil<PrcProfitReportOrderRow>(PrcProfitReportOrderRow.class)
|
||||
.exportExcel(response, rows, "订单毛利报表");
|
||||
}
|
||||
|
||||
@Log(title = "毛利报表-产品维度", businessType = BusinessType.EXPORT)
|
||||
@PreAuthorize("@ss.hasPermi('report:profit:export')")
|
||||
@PostMapping("/products/export")
|
||||
public void exportProducts(HttpServletResponse response, PrcProfitReportQuery query)
|
||||
{
|
||||
List<PrcProfitReportProductRow> rows = profitReportService.selectProductRows(query);
|
||||
new ExcelUtil<PrcProfitReportProductRow>(PrcProfitReportProductRow.class)
|
||||
.exportExcel(response, rows, "产品毛利报表");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user