客户余额记录
This commit is contained in:
+121
@@ -0,0 +1,121 @@
|
||||
package com.ruoyi.web.controller.customer.customermoney;
|
||||
|
||||
import java.util.Collections;
|
||||
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.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
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.CustomerBalanceFlow;
|
||||
import com.ruoyi.customer.customermoney.domain.CustomerReceipt;
|
||||
import com.ruoyi.customer.customermoney.service.ICustomerMoneyService;
|
||||
|
||||
/**
|
||||
* 客户余额/收款/流水 Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-09-11
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/customersupplier/customermoney")
|
||||
public class CustomerMoneyController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ICustomerMoneyService customerMoneyService;
|
||||
|
||||
/**
|
||||
* 查询客户各币种账户余额
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('customersupplier:customerinfo:list')")
|
||||
@GetMapping("/account/list/{customerId}")
|
||||
public AjaxResult accountList(@PathVariable("customerId") Long customerId)
|
||||
{
|
||||
return success(customerMoneyService.selectAccountList(customerId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询收款记录列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('customersupplier:customerinfo:list')")
|
||||
@GetMapping("/receipt/list")
|
||||
public TableDataInfo receiptList(CustomerReceipt query)
|
||||
{
|
||||
// customerId 为空或为 0,直接返回空数据
|
||||
if (query == null || query.getCustomerId() == null || query.getCustomerId() == 0L) {
|
||||
return getDataTable(Collections.emptyList());
|
||||
}
|
||||
|
||||
startPage();
|
||||
List<CustomerReceipt> list = customerMoneyService.selectReceiptList(query);
|
||||
return getDataTable(list);
|
||||
}
|
||||
/**
|
||||
* 获取收款单详情(含收款附件)
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('customersupplier:customerinfo:query')")
|
||||
@GetMapping("/receipt/{id}")
|
||||
public AjaxResult getReceipt(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(customerMoneyService.selectReceiptById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 登记收款(默认待确认,同时保存收款凭证附件)
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('customersupplier:customerinfo:add')")
|
||||
@Log(title = "客户收款", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/receipt")
|
||||
public AjaxResult addReceipt(@RequestBody CustomerReceipt receipt)
|
||||
{
|
||||
receipt.setCreateBy(getUsername());
|
||||
return toAjax(customerMoneyService.insertReceipt(receipt));
|
||||
}
|
||||
|
||||
/**
|
||||
* 审核通过收款单:确认后变动客户余额并生成余额流水
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('customersupplier:customerinfo:edit')")
|
||||
@Log(title = "客户收款审核", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/receipt/confirm/{id}")
|
||||
public AjaxResult confirmReceipt(@PathVariable("id") Long id)
|
||||
{
|
||||
return toAjax(customerMoneyService.confirmReceipt(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消收款单(仅待确认可取消)
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('customersupplier:customerinfo:edit')")
|
||||
@Log(title = "客户收款取消", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/receipt/cancel/{id}")
|
||||
public AjaxResult cancelReceipt(@PathVariable("id") Long id)
|
||||
{
|
||||
return toAjax(customerMoneyService.cancelReceipt(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询余额流水列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('customersupplier:customerinfo:list')")
|
||||
@GetMapping("/flow/list")
|
||||
public TableDataInfo flowList(CustomerBalanceFlow query)
|
||||
{
|
||||
// customerId 为空或为 0,直接返回空数据
|
||||
if (query == null || query.getCustomerId() == null || query.getCustomerId() == 0L) {
|
||||
return getDataTable(Collections.emptyList());
|
||||
}
|
||||
startPage();
|
||||
List<CustomerBalanceFlow> list = customerMoneyService.selectFlowList(query);
|
||||
return getDataTable(list);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user