This commit is contained in:
wuweihua
2026-09-22 10:15:22 +08:00
30 changed files with 1089 additions and 122 deletions
@@ -1,12 +1,17 @@
package com.ruoyi.web.controller.ar;
import java.util.List;
import java.util.Date;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.validation.annotation.Validated;
import org.springframework.beans.propertyeditors.CustomDateEditor;
import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
@@ -31,6 +36,7 @@ import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.uuid.IdUtils;
@@ -49,12 +55,23 @@ public class ArBillController extends BaseController {
@Autowired
private IArBillService billService;
/**
* 查询参数中的日期必须严格按 yyyy-MM-dd 解析,禁止非法日期自动滚动到其他日期。
*/
@InitBinder
public void initDateBinder(WebDataBinder binder) {
java.text.SimpleDateFormat formatter = new java.text.SimpleDateFormat("yyyy-MM-dd");
formatter.setLenient(false);
binder.registerCustomEditor(Date.class, new CustomDateEditor(formatter, true));
}
/**
* 查询账单列表;分页参数由 BaseController.startPage 交给 MyBatis PageHelper 处理。
*/
@PreAuthorize("@ss.hasPermi('ar:bill:list')")
@GetMapping("/list")
public TableDataInfo list(ArBillQuery query) {
public TableDataInfo list(ArBillQuery query, HttpServletRequest request) {
rejectMultiValueParameter(request, "customerId");
startPage();
List<ArBill> list = billService.selectArBillList(query);
return getDataTable(list);
@@ -104,7 +121,8 @@ public class ArBillController extends BaseController {
*/
@PreAuthorize("@ss.hasPermi('ar:bill:generate')")
@GetMapping("/generate/preview")
public AjaxResult preview(ArBillGenerateQuery query) {
public AjaxResult preview(ArBillGenerateQuery query, HttpServletRequest request) {
rejectMultiValueParameter(request, "customerId");
startPage();
List<PrcOrderBill> list = billService.previewBill(query);
TableDataInfo pageData = getDataTable(list);
@@ -252,4 +270,17 @@ public class ArBillController extends BaseController {
if (StringUtils.isNotEmpty(headerRequestId)) return headerRequestId;
return IdUtils.fastSimpleUUID();
}
/**
* 禁止把 customerId 以数组参数或重复参数提交,避免参数绑定失败后悄悄退化为无客户条件查询。
*/
private void rejectMultiValueParameter(HttpServletRequest request, String parameterName) {
if (request.getParameterMap().containsKey(parameterName + "[]")) {
throw new ServiceException("查询参数[" + parameterName + "]格式不正确,请传入单个客户ID");
}
String[] values = request.getParameterValues(parameterName);
if (values != null && values.length > 1) {
throw new ServiceException("查询参数[" + parameterName + "]只能传入一个值");
}
}
}
@@ -2,6 +2,8 @@ package com.ruoyi.web.controller.customer.customermoney;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
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;
@@ -17,6 +19,7 @@ import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.customer.customermoney.api.ICustomerAccountApi;
import com.ruoyi.customer.customermoney.domain.CustomerBalanceFlow;
import com.ruoyi.customer.customermoney.domain.CustomerCreditApply;
@@ -25,6 +28,9 @@ import com.ruoyi.customer.customermoney.domain.CustomerReceipt;
import com.ruoyi.customer.customermoney.service.ICreditQuotaService;
import com.ruoyi.customer.customermoney.service.ICustomerMoneyService;
import com.ruoyi.customer.customermoney.vo.CustomerAccountStatusVO;
import com.ruoyi.customer.customermoney.vo.CustomerBalanceFlowExportVO;
import com.ruoyi.customer.customermoney.vo.CustomerCreditFlowExportVO;
import com.ruoyi.customer.customermoney.vo.CustomerReceiptExportVO;
import com.ruoyi.common.utils.SecurityUtils;
/**
@@ -89,6 +95,24 @@ public class CustomerMoneyController extends BaseController
List<CustomerReceipt> list = customerMoneyService.selectReceiptList(query);
return getDataTable(list);
}
/**
* 导出收款记录(按当前筛选条件,全量导出不分页)
*/
@PreAuthorize("@ss.hasPermi('customersupplier:customerinfo:export')")
@Log(title = "客户收款记录", businessType = BusinessType.EXPORT)
@PostMapping("/receipt/export")
public void receiptExport(HttpServletResponse response, CustomerReceipt query)
{
List<CustomerReceiptExportVO> list = Collections.emptyList();
if (query != null && query.getCustomerId() != null && query.getCustomerId() != 0L)
{
list = customerMoneyService.selectReceiptList(query).stream()
.map(CustomerReceiptExportVO::from).collect(Collectors.toList());
}
ExcelUtil<CustomerReceiptExportVO> util = new ExcelUtil<>(CustomerReceiptExportVO.class);
util.exportExcel(response, list, "收款记录");
}
/**
* 获取收款单详情(含收款附件)
*/
@@ -149,6 +173,24 @@ public class CustomerMoneyController extends BaseController
return getDataTable(list);
}
/**
* 导出余额流水(按当前筛选条件,全量导出不分页)
*/
@PreAuthorize("@ss.hasPermi('customersupplier:customerinfo:export')")
@Log(title = "客户余额流水", businessType = BusinessType.EXPORT)
@PostMapping("/flow/export")
public void flowExport(HttpServletResponse response, CustomerBalanceFlow query)
{
List<CustomerBalanceFlowExportVO> list = Collections.emptyList();
if (query != null && query.getCustomerId() != null && query.getCustomerId() != 0L)
{
list = customerMoneyService.selectFlowList(query).stream()
.map(CustomerBalanceFlowExportVO::from).collect(Collectors.toList());
}
ExcelUtil<CustomerBalanceFlowExportVO> util = new ExcelUtil<>(CustomerBalanceFlowExportVO.class);
util.exportExcel(response, list, "余额流水");
}
/**
* 查询额度流水列表
*/
@@ -164,6 +206,24 @@ public class CustomerMoneyController extends BaseController
return getDataTable(list);
}
/**
* 导出额度流水(按当前筛选条件,全量导出不分页)
*/
@PreAuthorize("@ss.hasPermi('customersupplier:customerinfo:export')")
@Log(title = "客户额度流水", businessType = BusinessType.EXPORT)
@PostMapping("/credit/flow/export")
public void creditFlowExport(HttpServletResponse response, CustomerCreditFlow query)
{
List<CustomerCreditFlowExportVO> list = Collections.emptyList();
if (query != null && query.getCustomerId() != null && query.getCustomerId() != 0L)
{
list = customerMoneyService.selectCreditFlowList(query).stream()
.map(CustomerCreditFlowExportVO::from).collect(Collectors.toList());
}
ExcelUtil<CustomerCreditFlowExportVO> util = new ExcelUtil<>(CustomerCreditFlowExportVO.class);
util.exportExcel(response, list, "额度流水");
}
/**
* 提交额度调整申请(信用额度/临时额度),申请待审批通过后才真正调整额度
*/