新加额度池配置功能

This commit is contained in:
luojiaquan
2026-09-20 10:26:30 +08:00
parent f529067ae3
commit d40adf1318
28 changed files with 1669 additions and 414 deletions
@@ -22,8 +22,10 @@ import com.ruoyi.customer.customermoney.domain.CustomerBalanceFlow;
import com.ruoyi.customer.customermoney.domain.CustomerCreditApply;
import com.ruoyi.customer.customermoney.domain.CustomerCreditFlow;
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.common.utils.SecurityUtils;
/**
* 客户余额/收款/流水 Controller
@@ -41,6 +43,9 @@ public class CustomerMoneyController extends BaseController
@Autowired
private ICustomerAccountApi customerAccountApi;
@Autowired
private ICreditQuotaService creditQuotaService;
/**
* 查询客户账号状态(收货扣件准入控制用)。支持 customerId 或 customerCode 二选一。
* 只读轻量查询,不锁账户也不物化临时额度失效。
@@ -197,7 +202,8 @@ public class CustomerMoneyController extends BaseController
}
/**
* 审批通过额度调整申请:通过后调整账户额度并生成额度流水
* 审批通过额度调整申请:通过后调整账户额度并生成额度流水。
* 非超管审批净增额度时 body 须带 approveRoleId(占用该角色额度池)。
*/
@PreAuthorize("@ss.hasPermi('customer:credit:approve')")
@Log(title = "客户额度调整审批", businessType = BusinessType.UPDATE)
@@ -206,7 +212,18 @@ public class CustomerMoneyController extends BaseController
@RequestBody(required = false) CustomerCreditApply body)
{
String remark = body != null ? body.getApproveRemark() : null;
return toAjax(customerMoneyService.approveCreditApply(applyId, remark));
Long approveRoleId = body != null ? body.getApproveRoleId() : null;
return toAjax(customerMoneyService.approveCreditApply(applyId, remark, approveRoleId));
}
/**
* 当前登录用户审批时可选择的角色额度池(超管返回空列表,前端不展示选框)。
*/
@PreAuthorize("@ss.hasPermi('customer:credit:approve')")
@GetMapping("/credit/quota/my-pools")
public AjaxResult myCreditPools()
{
return success(creditQuotaService.myPools(SecurityUtils.getUserId()));
}
/**
@@ -0,0 +1,66 @@
package com.ruoyi.web.controller.system;
import java.util.List;
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.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
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.enums.BusinessType;
import com.ruoyi.customer.customermoney.domain.CustomerCreditGrant;
import com.ruoyi.customer.customermoney.service.ICreditQuotaService;
import com.ruoyi.customer.customermoney.vo.RoleCreditQuotaVo;
/**
* 角色可分配额度总额(角色额度池)管理
*
* @author ruoyi
* @date 2026-09-20
*/
@RestController
@RequestMapping("/system/role/creditQuota")
public class RoleCreditQuotaController extends BaseController
{
@Autowired
private ICreditQuotaService creditQuotaService;
/**
* 全部角色额度池列表(含已分配/剩余可分配,实时统计)
*/
@PreAuthorize("@ss.hasPermi('system:role:list')")
@GetMapping("/list")
public AjaxResult list()
{
return success(creditQuotaService.listRoleQuotas());
}
/**
* 设置角色可分配额度总额(不能小于该池当前已分配额)
*/
@PreAuthorize("@ss.hasPermi('system:role:edit')")
@Log(title = "角色额度池设置", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult set(@RequestBody RoleCreditQuotaVo body)
{
creditQuotaService.setRoleQuota(body.getRoleId(), body.getTotalQuota(), body.getRemark());
return success();
}
/**
* 额度池占用台账查询(可按角色/客户/类型/状态筛选)
*/
@PreAuthorize("@ss.hasPermi('system:role:list')")
@GetMapping("/grants")
public TableDataInfo grants(CustomerCreditGrant query)
{
startPage();
List<CustomerCreditGrant> list = creditQuotaService.listGrants(query);
return getDataTable(list);
}
}