付款与收款
This commit is contained in:
@@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
namespace app\common\controller;
|
||||||
|
|
||||||
|
use app\common\controller\BaseController;
|
||||||
|
use app\common\traits\crud\CrudControllerTrait;
|
||||||
|
use app\common\service\FinPaymentApplyService;
|
||||||
|
|
||||||
|
class FinPaymentApplyController extends BaseController
|
||||||
|
{
|
||||||
|
use CrudControllerTrait;
|
||||||
|
|
||||||
|
protected $service;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->service = new FinPaymentApplyService();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 列表页数据格式化
|
||||||
|
*
|
||||||
|
* @param array $data
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
// protected function indexFormat($data)
|
||||||
|
// {
|
||||||
|
// if (isset($data['created_at']))
|
||||||
|
// $data['created_at'] = date('Y-m-d H:i:s', $data['created_at']);
|
||||||
|
// if (isset($data['updated_at']))
|
||||||
|
// $data['updated_at'] = date('Y-m-d H:i:s', $data['updated_at']);
|
||||||
|
// return $data;
|
||||||
|
// }
|
||||||
|
}
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
<?php
|
||||||
|
namespace app\common\controller;
|
||||||
|
|
||||||
|
use app\common\controller\BaseController;
|
||||||
|
use app\common\traits\crud\CrudControllerTrait;
|
||||||
|
use app\common\service\FinReceiptService;
|
||||||
|
|
||||||
|
class FinReceiptController extends BaseController
|
||||||
|
{
|
||||||
|
use CrudControllerTrait;
|
||||||
|
|
||||||
|
protected $service;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->service = new FinReceiptService();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 列表页数据格式化
|
||||||
|
*
|
||||||
|
* @param array $data
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function indexFormat($data)
|
||||||
|
{
|
||||||
|
if (isset($data['created_at']))
|
||||||
|
$data['created_at'] = date('Y-m-d H:i:s', $data['created_at']);
|
||||||
|
if (isset($data['updated_at']))
|
||||||
|
$data['updated_at'] = date('Y-m-d H:i:s', $data['updated_at']);
|
||||||
|
if (isset($data['arrived_at']))
|
||||||
|
$data['arrived_at'] = date('Y-m-d H:i:s', $data['arrived_at']);
|
||||||
|
if (isset($data['received_at']))
|
||||||
|
$data['received_at'] = date('Y-m-d H:i:s', $data['received_at']);
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据格式化
|
||||||
|
*
|
||||||
|
* @param array $data
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function showFormat($data)
|
||||||
|
{
|
||||||
|
if (isset($data['created_at']))
|
||||||
|
$data['created_at'] = date('Y-m-d H:i:s', $data['created_at']);
|
||||||
|
if (isset($data['updated_at']))
|
||||||
|
$data['updated_at'] = date('Y-m-d H:i:s', $data['updated_at']);
|
||||||
|
if (isset($data['arrived_at']))
|
||||||
|
$data['arrived_at'] = date('Y-m-d H:i:s', $data['arrived_at']);
|
||||||
|
if (isset($data['received_at']))
|
||||||
|
$data['received_at'] = date('Y-m-d H:i:s', $data['received_at']);
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\common\logic;
|
||||||
|
|
||||||
|
use app\common\traits\crud\CrudLogicTrait;
|
||||||
|
use app\common\model\FinPaymentApply;
|
||||||
|
|
||||||
|
class FinPaymentApplyLogic
|
||||||
|
{
|
||||||
|
use CrudLogicTrait;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 指定当前要操作的模型
|
||||||
|
*/
|
||||||
|
protected string $modelClass = FinPaymentApply::class;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\common\logic;
|
||||||
|
|
||||||
|
use app\common\traits\crud\CrudLogicTrait;
|
||||||
|
use app\common\model\FinReceipt;
|
||||||
|
|
||||||
|
class FinReceiptLogic
|
||||||
|
{
|
||||||
|
use CrudLogicTrait;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 指定当前要操作的模型
|
||||||
|
*/
|
||||||
|
protected string $modelClass = FinReceipt::class;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\common\model;
|
||||||
|
|
||||||
|
use support\Model;
|
||||||
|
|
||||||
|
class FinPaymentApply extends Model
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The connection name for the model.
|
||||||
|
*
|
||||||
|
* @var string|null
|
||||||
|
*/
|
||||||
|
protected $connection = 'mysql';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The table associated with the model.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $table = 'fin_payment_apply';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The primary key associated with the table.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $primaryKey = 'id';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates if the model should be timestamped.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public $timestamps = true;
|
||||||
|
|
||||||
|
|
||||||
|
protected $dateFormat = 'U';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 允许自动填充模型字段
|
||||||
|
*/
|
||||||
|
protected $fillable = ['id', 'apply_no', 'doc_user_id', 'sales_user_id', 'corp_id', 'account_id', 'currency_id', 'amount', 'swift', 'remit_bank', 'country_id', 'remitter', 'exchange_rate', 'total_amount_cny', 'voucher_file', 'submit_files', 'created_at', 'updated_at'];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 不允许自动填充模型字段
|
||||||
|
*/
|
||||||
|
protected $guarded = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取对应的收款记录(1-1,可为空)
|
||||||
|
*/
|
||||||
|
public function receipt()
|
||||||
|
{
|
||||||
|
return $this->hasOne(FinReceipt::class, 'payment_apply_id', 'id');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备货单
|
||||||
|
*/
|
||||||
|
public function stock()
|
||||||
|
{
|
||||||
|
return $this->belongsToMany(StockOrders::class, 'fin_payment_stock', 'payment_apply_id', 'stock_id');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\common\model;
|
||||||
|
|
||||||
|
use support\Model;
|
||||||
|
|
||||||
|
class FinPaymentStock extends Model
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The connection name for the model.
|
||||||
|
*
|
||||||
|
* @var string|null
|
||||||
|
*/
|
||||||
|
protected $connection = 'mysql';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The table associated with the model.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $table = 'fin_payment_stock';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The primary key associated with the table.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $primaryKey = 'id';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates if the model should be timestamped.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public $timestamps = true;
|
||||||
|
|
||||||
|
|
||||||
|
protected $dateFormat = 'U';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 允许自动填充模型字段
|
||||||
|
*/
|
||||||
|
protected $fillable = ['id', 'payment_apply_id', 'receipt_id', 'stock_id', 'allocated_amount', 'allocated_amount_cny'];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 不允许自动填充模型字段
|
||||||
|
*/
|
||||||
|
protected $guarded = [];
|
||||||
|
|
||||||
|
// 付款申请
|
||||||
|
public function payment_apply()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(FinPaymentApply::class, 'payment_apply_id', 'id');
|
||||||
|
}
|
||||||
|
|
||||||
|
// 收款记录
|
||||||
|
public function receipt()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(FinReceipt::class, 'receipt_id', 'id');
|
||||||
|
}
|
||||||
|
|
||||||
|
// 付款申请
|
||||||
|
public function stock()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(StockOrders::class, 'stock_id', 'id');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\common\model;
|
||||||
|
|
||||||
|
use support\Model;
|
||||||
|
|
||||||
|
class FinReceipt extends Model
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The connection name for the model.
|
||||||
|
*
|
||||||
|
* @var string|null
|
||||||
|
*/
|
||||||
|
protected $connection = 'mysql';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The table associated with the model.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $table = 'fin_receipt';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The primary key associated with the table.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $primaryKey = 'id';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates if the model should be timestamped.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public $timestamps = true;
|
||||||
|
|
||||||
|
|
||||||
|
protected $dateFormat = 'U';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 允许自动填充模型字段
|
||||||
|
*/
|
||||||
|
protected $fillable = ['id', 'receipt_no', 'payment_apply_id', 'country_id', 'remitter', 'account_id', 'currency_id', 'amount', 'discount_amount', 'total_amount_cny', 'exchange_rate', 'arrived_at', 'received_at', 'voucher_no', 'fx_receipt_file', 'is_domestic_return', 'created_at', 'updated_at'];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 不允许自动填充模型字段
|
||||||
|
*/
|
||||||
|
protected $guarded = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取付款申请
|
||||||
|
*/
|
||||||
|
public function payment()
|
||||||
|
{
|
||||||
|
return $this->hasOne(FinPaymentApply::class, 'id', 'payment_apply_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备货单
|
||||||
|
*/
|
||||||
|
public function stock()
|
||||||
|
{
|
||||||
|
return $this->belongsToMany(StockOrders::class, 'fin_payment_stock', 'receipt_id', 'stock_id');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -95,4 +95,12 @@ class StockOrders extends Model
|
|||||||
{
|
{
|
||||||
return $this->hasOne(User::class, 'id', 'salesperson_id');
|
return $this->hasOne(User::class, 'id', 'salesperson_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 客户的标签
|
||||||
|
*/
|
||||||
|
public function payment()
|
||||||
|
{
|
||||||
|
return $this->belongsToMany(FinPaymentApply::class, 'fin_payment_stock', 'stock_id', 'payment_apply_id');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,107 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\common\service;
|
||||||
|
|
||||||
|
use app\common\validate\FinPaymentApplyValidate;
|
||||||
|
use app\common\traits\crud\CrudServiceTrait;
|
||||||
|
use app\common\model\FinPaymentApply;
|
||||||
|
use support\Request;
|
||||||
|
|
||||||
|
class FinPaymentApplyService
|
||||||
|
{
|
||||||
|
|
||||||
|
use CrudServiceTrait;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 指定当前要操作的模型
|
||||||
|
*/
|
||||||
|
protected string $modelClass = FinPaymentApply::class;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 验证器
|
||||||
|
*/
|
||||||
|
protected $validator = FinPaymentApplyValidate::class;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取验证器
|
||||||
|
*/
|
||||||
|
public function getValidator()
|
||||||
|
{
|
||||||
|
return new $this->validator;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 构建查询条件
|
||||||
|
*/
|
||||||
|
protected function buildQueryConfig(Request $request, string $scene = 'index'): array
|
||||||
|
{
|
||||||
|
$p = $request->all();
|
||||||
|
|
||||||
|
$config = [];
|
||||||
|
$config['model'] = $this->modelClass;
|
||||||
|
switch ($scene) {
|
||||||
|
case 'index':
|
||||||
|
// ====== ====== 排序 ====== ======
|
||||||
|
$config['order']['id'] = 'desc';
|
||||||
|
break;
|
||||||
|
case 'show':
|
||||||
|
$config['where']['id'] = $p['id'];
|
||||||
|
break;
|
||||||
|
case 'update':
|
||||||
|
case 'destroy':
|
||||||
|
$config['where']['id'] = $p['id'];
|
||||||
|
break;
|
||||||
|
case 'store':
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $config;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function beforeServiceStore($data, Request $request)
|
||||||
|
{
|
||||||
|
$data['apply_no'] = $this->generateUniqueApplyNo();
|
||||||
|
$data['submit_files'] = json_encode($data['submit_files']);
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function beforeServiceUpdate($data, Request $request)
|
||||||
|
{
|
||||||
|
$data['submit_files'] = json_encode($data['submit_files']);
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成唯一的付款申请编码
|
||||||
|
* 格式:PA + 日期 + 6位字母数字组合
|
||||||
|
*
|
||||||
|
* @return string 唯一编码
|
||||||
|
*/
|
||||||
|
public function generateUniqueApplyNo()
|
||||||
|
{
|
||||||
|
$chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||||
|
$maxAttempts = 10; // 防止无限循环
|
||||||
|
$secondChar = 'PA' . date('Ymd');
|
||||||
|
|
||||||
|
for ($attempt = 0; $attempt < $maxAttempts; $attempt++) {
|
||||||
|
// 生成后6位随机字符
|
||||||
|
$suffix = '';
|
||||||
|
for ($i = 0; $i < 6; $i++) {
|
||||||
|
$suffix .= $chars[rand(0, strlen($chars) - 1)];
|
||||||
|
}
|
||||||
|
|
||||||
|
$applyNo = $secondChar . $suffix;
|
||||||
|
|
||||||
|
// 检查是否已存在
|
||||||
|
$existing = FinPaymentApply::where('apply_no', $applyNo)->first();
|
||||||
|
if (!$existing) {
|
||||||
|
return $applyNo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果1000次尝试后仍然重复,使用时间戳确保唯一性
|
||||||
|
$timestamp = substr(time(), -6);
|
||||||
|
return $secondChar . $timestamp;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,127 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\common\service;
|
||||||
|
|
||||||
|
use app\common\validate\FinReceiptValidate;
|
||||||
|
use app\common\traits\crud\CrudServiceTrait;
|
||||||
|
use app\common\model\FinReceipt;
|
||||||
|
use support\Request;
|
||||||
|
|
||||||
|
class FinReceiptService
|
||||||
|
{
|
||||||
|
|
||||||
|
use CrudServiceTrait;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 指定当前要操作的模型
|
||||||
|
*/
|
||||||
|
protected string $modelClass = FinReceipt::class;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 验证器
|
||||||
|
*/
|
||||||
|
protected $validator = FinReceiptValidate::class;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取验证器
|
||||||
|
*/
|
||||||
|
public function getValidator()
|
||||||
|
{
|
||||||
|
return new $this->validator;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 构建查询条件
|
||||||
|
*/
|
||||||
|
protected function buildQueryConfig(Request $request, string $scene = 'index'): array
|
||||||
|
{
|
||||||
|
$p = $request->all();
|
||||||
|
|
||||||
|
$config = [];
|
||||||
|
$config['model'] = $this->modelClass;
|
||||||
|
switch ($scene) {
|
||||||
|
case 'index':
|
||||||
|
// ====== ====== 排序 ====== ======
|
||||||
|
$config['order']['id'] = 'desc';
|
||||||
|
|
||||||
|
// ====== ====== 筛选 ====== ======
|
||||||
|
// 汇款国家
|
||||||
|
if (isset($p['country_id']) && !empty($p['country_id'])) {
|
||||||
|
$config['where']['country_id'] = $p['country_id'];
|
||||||
|
}
|
||||||
|
// 收款账户筛选
|
||||||
|
if (isset($p['account_id']) && !empty($p['account_id'])) {
|
||||||
|
$config['where']['account_id'] = $p['account_id'];
|
||||||
|
}
|
||||||
|
// 关键字
|
||||||
|
if (isset($p['keyword']) && $p['keyword']) {
|
||||||
|
$k = '%' . $p['keyword'] . '%';
|
||||||
|
$config['orWhere'][] = ['remitter', 'like', $k];
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'show':
|
||||||
|
$config['where']['id'] = $p['id'];
|
||||||
|
break;
|
||||||
|
case 'update':
|
||||||
|
case 'destroy':
|
||||||
|
$config['where']['id'] = $p['id'];
|
||||||
|
break;
|
||||||
|
case 'store':
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $config;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function beforeServiceStore($data, Request $request)
|
||||||
|
{
|
||||||
|
if(isset($data['payment_apply_id']) && empty($data['payment_apply_id'])){
|
||||||
|
unset($data['payment_apply_id']);
|
||||||
|
}
|
||||||
|
$data['receipt_no'] = $this->generateUniqueReceipt();
|
||||||
|
$data['arrived_at'] = strtotime( $data['arrived_at']);
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function beforeServiceUpdate($data, Request $request)
|
||||||
|
{
|
||||||
|
$data['arrived_at'] = strtotime( $data['arrived_at']);
|
||||||
|
$data['received_at'] = strtotime( $data['received_at']);
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成唯一的付款申请编码
|
||||||
|
* 格式:PA + 日期 + 6位字母数字组合
|
||||||
|
*
|
||||||
|
* @return string 唯一编码
|
||||||
|
*/
|
||||||
|
public function generateUniqueReceipt()
|
||||||
|
{
|
||||||
|
$chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||||
|
$maxAttempts = 10; // 防止无限循环
|
||||||
|
$secondChar = 'RE' . date('Ymd');
|
||||||
|
|
||||||
|
for ($attempt = 0; $attempt < $maxAttempts; $attempt++) {
|
||||||
|
// 生成后6位随机字符
|
||||||
|
$suffix = '';
|
||||||
|
for ($i = 0; $i < 6; $i++) {
|
||||||
|
$suffix .= $chars[rand(0, strlen($chars) - 1)];
|
||||||
|
}
|
||||||
|
|
||||||
|
$ReceiptNo = $secondChar . $suffix;
|
||||||
|
|
||||||
|
// 检查是否已存在
|
||||||
|
$existing = FinReceipt::where('receipt_no', $ReceiptNo)->first();
|
||||||
|
if (!$existing) {
|
||||||
|
return $ReceiptNo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果1000次尝试后仍然重复,使用时间戳确保唯一性
|
||||||
|
$timestamp = substr(time(), -6);
|
||||||
|
return $secondChar . $timestamp;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\common\validate;
|
||||||
|
|
||||||
|
use think\Validate;
|
||||||
|
|
||||||
|
class FinPaymentApplyValidate extends Validate
|
||||||
|
{
|
||||||
|
// 规则
|
||||||
|
protected $rule = [
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
// 提示
|
||||||
|
protected $message = [
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
// 场景
|
||||||
|
protected $scene = [
|
||||||
|
'store' => [
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
'update' => [
|
||||||
|
|
||||||
|
]
|
||||||
|
];
|
||||||
|
}
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\common\validate;
|
||||||
|
|
||||||
|
use think\Validate;
|
||||||
|
|
||||||
|
class FinReceiptValidate extends Validate
|
||||||
|
{
|
||||||
|
// 规则
|
||||||
|
protected $rule = [
|
||||||
|
'payment_apply_id' => 'integer|gt:0',
|
||||||
|
'country_id' => 'require|integer|gt:0',
|
||||||
|
'remitter' => 'require',
|
||||||
|
'account_id' => 'require|integer|gt:0',
|
||||||
|
'currency_id' => 'require|integer|gt:0',
|
||||||
|
'amount' => 'require|gt:0',
|
||||||
|
'exchange_rate' => 'require|gt:0',
|
||||||
|
'arrived_at' => 'require',
|
||||||
|
'is_domestic_return' => 'require|integer',
|
||||||
|
];
|
||||||
|
|
||||||
|
// 提示
|
||||||
|
protected $message = [
|
||||||
|
'payment_apply_id.integer' => '付款申请ID必须是整数',
|
||||||
|
'payment_apply_id.gt' => '付款申请ID必须大于0',
|
||||||
|
'country_id.require' => '付款来源国家ID不能为空',
|
||||||
|
'country_id.integer' => '付款来源国家ID必须是整数',
|
||||||
|
'country_id.gt' => '付款来源国家ID必须大于0',
|
||||||
|
'remitter.require' => '汇款人不能为空',
|
||||||
|
'account_id.require' => '收款账号ID不能为空',
|
||||||
|
'account_id.integer' => '收款账号ID必须是整数',
|
||||||
|
'account_id.gt' => '收款账号ID必须大于0',
|
||||||
|
'currency_id.require' => '收款币种ID不能为空',
|
||||||
|
'currency_id.integer' => '收款币种ID必须是整数',
|
||||||
|
'currency_id.gt' => '收款币种ID必须大于0',
|
||||||
|
'amount.require' => '收款金额不能为空',
|
||||||
|
'amount.gt' => '收款金额必须大于0',
|
||||||
|
'exchange_rate.require' => '实际汇率不能为空',
|
||||||
|
'exchange_rate.gt' => '实际汇率必须大于0',
|
||||||
|
'arrived_at.require' => '到账时间不能为空',
|
||||||
|
'arrived_at.gt' => '到账时间必须大于0',
|
||||||
|
'is_domestic_return.require' => '是否回转内地不能为空',
|
||||||
|
'is_domestic_return.integer' => '是否回转内地必须是整数',
|
||||||
|
];
|
||||||
|
|
||||||
|
// 场景
|
||||||
|
protected $scene = [
|
||||||
|
'store' => [
|
||||||
|
'payment_apply_id', 'country_id', 'remitter', 'account_id', 'currency_id', 'amount', 'exchange_rate', 'arrived_at'
|
||||||
|
],
|
||||||
|
|
||||||
|
'update' => [
|
||||||
|
|
||||||
|
]
|
||||||
|
];
|
||||||
|
}
|
||||||
@@ -70,27 +70,27 @@ class IndexController
|
|||||||
public function createResource()
|
public function createResource()
|
||||||
{
|
{
|
||||||
$options = [
|
$options = [
|
||||||
'controller' => [
|
// 'controller' => [
|
||||||
'module' => 'crm',
|
// 'module' => 'common',
|
||||||
'name' => 'approval_flows'
|
// 'name' => 'fin_payment_apply'
|
||||||
],
|
// ],
|
||||||
'model' => [
|
'model' => [
|
||||||
'module' => 'crm',
|
'module' => 'common',
|
||||||
'name' => 'approval_flows'
|
'name' => 'fin_payment_stock'
|
||||||
],
|
],
|
||||||
'service' => [
|
// 'service' => [
|
||||||
'module' => 'crm',
|
// 'module' => 'common',
|
||||||
'name' => 'approval_flows'
|
// 'name' => 'fin_payment_apply'
|
||||||
],
|
// ],
|
||||||
'logic' => [
|
// 'logic' => [
|
||||||
'module' => 'crm',
|
// 'module' => 'common',
|
||||||
'name' => 'approval_flows'
|
// 'name' => 'fin_payment_apply'
|
||||||
],
|
// ],
|
||||||
'validate' => [
|
// 'validate' => [
|
||||||
'module' => 'crm',
|
// 'module' => 'common',
|
||||||
'name' => 'approval_flows'
|
// 'name' => 'fin_payment_apply'
|
||||||
],
|
// ],
|
||||||
'table' => 'approval_flows'
|
'table' => 'fin_payment_stock'
|
||||||
];
|
];
|
||||||
|
|
||||||
$result = (new Generate($options))->doGenerate();
|
$result = (new Generate($options))->doGenerate();
|
||||||
|
|||||||
@@ -351,6 +351,24 @@ Route::group('/admin', function () {
|
|||||||
Route::any('/user/achieved', [app\admin\targets\controller\StatisticsController::class, 'userAchieved']);
|
Route::any('/user/achieved', [app\admin\targets\controller\StatisticsController::class, 'userAchieved']);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 收款记录
|
||||||
|
Route::group('/receipt', function () {
|
||||||
|
Route::any('/list', [app\common\controller\FinReceiptController::class, 'index']);
|
||||||
|
Route::any('/show', [app\common\controller\FinReceiptController::class, 'show']);
|
||||||
|
Route::any('/store', [app\common\controller\FinReceiptController::class, 'store']);
|
||||||
|
Route::any('/update', [app\common\controller\FinReceiptController::class, 'update']);
|
||||||
|
Route::any('/destroy', [app\common\controller\FinReceiptController::class, 'destroy']);
|
||||||
|
});
|
||||||
|
|
||||||
|
// 收款记录
|
||||||
|
Route::group('/payment', function () {
|
||||||
|
Route::any('/list', [app\common\controller\FinPaymentApplyController::class, 'index']);
|
||||||
|
Route::any('/show', [app\common\controller\FinPaymentApplyController::class, 'show']);
|
||||||
|
Route::any('/store', [app\common\controller\FinPaymentApplyController::class, 'store']);
|
||||||
|
Route::any('/update', [app\common\controller\FinPaymentApplyController::class, 'update']);
|
||||||
|
Route::any('/destroy', [app\common\controller\FinPaymentApplyController::class, 'destroy']);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user