✨ 客户账单弹窗增加汇总和导出

This commit is contained in:
caojia
2026-10-27 17:21:12 +08:00
parent b4e696b27c
commit db787ec7f7
8 changed files with 166 additions and 16 deletions
@@ -1,7 +1,9 @@
package com.bms.web.controller.customer.customermoney;
import java.util.ArrayList;
import java.util.Collections;
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;
@@ -13,7 +15,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.bms.ar.domain.ArBill;
import com.bms.ar.domain.ArBalanceWriteoff;
import com.bms.ar.domain.vo.ArBillListExportRow;
import com.bms.ar.domain.vo.ArBillQuery;
import com.bms.ar.domain.vo.ArBillSummary;
import com.bms.ar.service.IArBalanceWriteoffService;
import com.bms.ar.service.IArBillService;
import com.bms.common.annotation.Log;
@@ -21,6 +25,7 @@ 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;
/**
* 客户余额账单查询与核销 Controller
@@ -43,17 +48,50 @@ public class CustomerBillController extends BaseController
*/
@PreAuthorize("@ss.hasPermi('customersupplier:customerinfo:list')")
@GetMapping("/list/{customerId}")
public TableDataInfo billList(@PathVariable("customerId") Long customerId, ArBillQuery query)
public AjaxResult billList(@PathVariable("customerId") Long customerId, ArBillQuery query)
{
if (customerId == null || customerId <= 0L)
{
return getDataTable(Collections.emptyList());
AjaxResult result = success();
result.put("rows", Collections.emptyList());
result.put("total", 0L);
result.put("summary", new ArBillSummary());
return result;
}
ArBillQuery billQuery = query == null ? new ArBillQuery() : query;
billQuery.setCustomerId(customerId);
startPage();
List<ArBill> list = billService.selectArBillList(billQuery);
return getDataTable(list);
TableDataInfo pageData = getDataTable(list);
AjaxResult result = success();
result.put("rows", pageData.getRows());
result.put("total", pageData.getTotal());
result.put("summary", billService.selectArBillSummary(billQuery));
return result;
}
/**
* 按当前筛选条件导出指定客户的全部应收账单,不受列表分页参数影响。
*/
@PreAuthorize("@ss.hasPermi('customersupplier:customerinfo:export')")
@Log(title = "客户账单", businessType = BusinessType.EXPORT)
@PostMapping("/export/{customerId}")
public void export(HttpServletResponse response, @PathVariable("customerId") Long customerId, ArBillQuery query)
{
List<ArBillListExportRow> rows = new ArrayList<>();
if (customerId != null && customerId > 0L)
{
ArBillQuery billQuery = query == null ? new ArBillQuery() : query;
// 客户ID固定取自路径,忽略请求参数中可能出现的 customerId。
billQuery.setCustomerId(customerId);
List<ArBill> bills = billService.selectArBillList(billQuery);
for (ArBill bill : bills)
{
rows.add(ArBillListExportRow.from(bill));
}
}
ExcelUtil<ArBillListExportRow> util = new ExcelUtil<>(ArBillListExportRow.class);
util.exportExcel(response, rows, "客户账单");
}
/**