From 36d1d333b1f9ef6ca192f8ad7a033e4999b0ba7e Mon Sep 17 00:00:00 2001 From: "WIN-C27C5MSVTPO\\16961" <1696136552@qq.com> Date: Tue, 23 Sep 2025 15:13:56 +0800 Subject: [PATCH 01/21] =?UTF-8?q?=E4=BB=98=E6=AC=BE=E4=B8=8E=E6=94=B6?= =?UTF-8?q?=E6=AC=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/FinPaymentApplyController.php | 33 +++++ .../controller/FinReceiptController.php | 56 ++++++++ app/common/logic/FinPaymentApplyLogic.php | 17 +++ app/common/logic/FinReceiptLogic.php | 17 +++ app/common/model/FinPaymentApply.php | 65 +++++++++ app/common/model/FinPaymentStock.php | 67 +++++++++ app/common/model/FinReceipt.php | 65 +++++++++ app/common/model/StockOrders.php | 8 ++ app/common/service/FinPaymentApplyService.php | 107 +++++++++++++++ app/common/service/FinReceiptService.php | 127 ++++++++++++++++++ .../validate/FinPaymentApplyValidate.php | 29 ++++ app/common/validate/FinReceiptValidate.php | 56 ++++++++ app/controller/IndexController.php | 38 +++--- config/route.php | 18 +++ 14 files changed, 684 insertions(+), 19 deletions(-) create mode 100644 app/common/controller/FinPaymentApplyController.php create mode 100644 app/common/controller/FinReceiptController.php create mode 100644 app/common/logic/FinPaymentApplyLogic.php create mode 100644 app/common/logic/FinReceiptLogic.php create mode 100644 app/common/model/FinPaymentApply.php create mode 100644 app/common/model/FinPaymentStock.php create mode 100644 app/common/model/FinReceipt.php create mode 100644 app/common/service/FinPaymentApplyService.php create mode 100644 app/common/service/FinReceiptService.php create mode 100644 app/common/validate/FinPaymentApplyValidate.php create mode 100644 app/common/validate/FinReceiptValidate.php diff --git a/app/common/controller/FinPaymentApplyController.php b/app/common/controller/FinPaymentApplyController.php new file mode 100644 index 0000000..2d0f22e --- /dev/null +++ b/app/common/controller/FinPaymentApplyController.php @@ -0,0 +1,33 @@ +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; + // } +} \ No newline at end of file diff --git a/app/common/controller/FinReceiptController.php b/app/common/controller/FinReceiptController.php new file mode 100644 index 0000000..4acf899 --- /dev/null +++ b/app/common/controller/FinReceiptController.php @@ -0,0 +1,56 @@ +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; + } +} \ No newline at end of file diff --git a/app/common/logic/FinPaymentApplyLogic.php b/app/common/logic/FinPaymentApplyLogic.php new file mode 100644 index 0000000..09b93e1 --- /dev/null +++ b/app/common/logic/FinPaymentApplyLogic.php @@ -0,0 +1,17 @@ +hasOne(FinReceipt::class, 'payment_apply_id', 'id'); + } + + /** + * 备货单 + */ + public function stock() + { + return $this->belongsToMany(StockOrders::class, 'fin_payment_stock', 'payment_apply_id', 'stock_id'); + } +} \ No newline at end of file diff --git a/app/common/model/FinPaymentStock.php b/app/common/model/FinPaymentStock.php new file mode 100644 index 0000000..6f4a3ba --- /dev/null +++ b/app/common/model/FinPaymentStock.php @@ -0,0 +1,67 @@ +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'); + } +} \ No newline at end of file diff --git a/app/common/model/FinReceipt.php b/app/common/model/FinReceipt.php new file mode 100644 index 0000000..a98914f --- /dev/null +++ b/app/common/model/FinReceipt.php @@ -0,0 +1,65 @@ +hasOne(FinPaymentApply::class, 'id', 'payment_apply_id'); + } + + /** + * 备货单 + */ + public function stock() + { + return $this->belongsToMany(StockOrders::class, 'fin_payment_stock', 'receipt_id', 'stock_id'); + } +} \ No newline at end of file diff --git a/app/common/model/StockOrders.php b/app/common/model/StockOrders.php index 0b97fe4..0802afe 100644 --- a/app/common/model/StockOrders.php +++ b/app/common/model/StockOrders.php @@ -95,4 +95,12 @@ class StockOrders extends Model { return $this->hasOne(User::class, 'id', 'salesperson_id'); } + + /** + * 客户的标签 + */ + public function payment() + { + return $this->belongsToMany(FinPaymentApply::class, 'fin_payment_stock', 'stock_id', 'payment_apply_id'); + } } \ No newline at end of file diff --git a/app/common/service/FinPaymentApplyService.php b/app/common/service/FinPaymentApplyService.php new file mode 100644 index 0000000..00ad976 --- /dev/null +++ b/app/common/service/FinPaymentApplyService.php @@ -0,0 +1,107 @@ +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; + } +} \ No newline at end of file diff --git a/app/common/service/FinReceiptService.php b/app/common/service/FinReceiptService.php new file mode 100644 index 0000000..2cc781c --- /dev/null +++ b/app/common/service/FinReceiptService.php @@ -0,0 +1,127 @@ +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; + } +} \ No newline at end of file diff --git a/app/common/validate/FinPaymentApplyValidate.php b/app/common/validate/FinPaymentApplyValidate.php new file mode 100644 index 0000000..58145e3 --- /dev/null +++ b/app/common/validate/FinPaymentApplyValidate.php @@ -0,0 +1,29 @@ + [ + + ], + + 'update' => [ + + ] + ]; +} \ No newline at end of file diff --git a/app/common/validate/FinReceiptValidate.php b/app/common/validate/FinReceiptValidate.php new file mode 100644 index 0000000..c006dee --- /dev/null +++ b/app/common/validate/FinReceiptValidate.php @@ -0,0 +1,56 @@ + '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' => [ + + ] + ]; +} \ No newline at end of file diff --git a/app/controller/IndexController.php b/app/controller/IndexController.php index b25b5a4..cf30328 100644 --- a/app/controller/IndexController.php +++ b/app/controller/IndexController.php @@ -70,27 +70,27 @@ class IndexController public function createResource() { $options = [ - 'controller' => [ - 'module' => 'crm', - 'name' => 'approval_flows' - ], +// 'controller' => [ +// 'module' => 'common', +// 'name' => 'fin_payment_apply' +// ], 'model' => [ - 'module' => 'crm', - 'name' => 'approval_flows' + 'module' => 'common', + 'name' => 'fin_payment_stock' ], - 'service' => [ - 'module' => 'crm', - 'name' => 'approval_flows' - ], - 'logic' => [ - 'module' => 'crm', - 'name' => 'approval_flows' - ], - 'validate' => [ - 'module' => 'crm', - 'name' => 'approval_flows' - ], - 'table' => 'approval_flows' +// 'service' => [ +// 'module' => 'common', +// 'name' => 'fin_payment_apply' +// ], +// 'logic' => [ +// 'module' => 'common', +// 'name' => 'fin_payment_apply' +// ], +// 'validate' => [ +// 'module' => 'common', +// 'name' => 'fin_payment_apply' +// ], + 'table' => 'fin_payment_stock' ]; $result = (new Generate($options))->doGenerate(); diff --git a/config/route.php b/config/route.php index 887c683..087fcf8 100644 --- a/config/route.php +++ b/config/route.php @@ -351,6 +351,24 @@ Route::group('/admin', function () { 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']); + }); }); From 4717bb01ca52dfb3c8ebebf4c617b34155dc71ef Mon Sep 17 00:00:00 2001 From: "WIN-C27C5MSVTPO\\16961" <1696136552@qq.com> Date: Tue, 23 Sep 2025 15:14:08 +0800 Subject: [PATCH 02/21] =?UTF-8?q?=E4=BB=98=E6=AC=BE=E4=B8=8E=E6=94=B6?= =?UTF-8?q?=E6=AC=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/model/FinPaymentApply.php | 8 +++ app/common/model/FinPaymentStock.php | 4 +- app/common/model/FinReceipt.php | 14 ++++-- app/common/model/FinReceiptHis.php | 49 +++++++++++++++++++ app/common/model/StockOrders.php | 8 +++ app/common/service/FinPaymentApplyService.php | 19 +++++++ app/common/service/FinReceiptService.php | 4 +- app/controller/IndexController.php | 4 +- 8 files changed, 102 insertions(+), 8 deletions(-) create mode 100644 app/common/model/FinReceiptHis.php diff --git a/app/common/model/FinPaymentApply.php b/app/common/model/FinPaymentApply.php index 2fb04a7..0556210 100644 --- a/app/common/model/FinPaymentApply.php +++ b/app/common/model/FinPaymentApply.php @@ -62,4 +62,12 @@ class FinPaymentApply extends Model { return $this->belongsToMany(StockOrders::class, 'fin_payment_stock', 'payment_apply_id', 'stock_id'); } + + /** + * 关联的备货单(通过中间表) + */ + public function stocks() + { + return $this->belongsToMany(StockOrders::class, 'fin_payment_stock', 'payment_apply_id', 'stock_id'); + } } \ No newline at end of file diff --git a/app/common/model/FinPaymentStock.php b/app/common/model/FinPaymentStock.php index 6f4a3ba..d5b3d10 100644 --- a/app/common/model/FinPaymentStock.php +++ b/app/common/model/FinPaymentStock.php @@ -40,7 +40,7 @@ class FinPaymentStock extends Model /** * 允许自动填充模型字段 */ - protected $fillable = ['id', 'payment_apply_id', 'receipt_id', 'stock_id', 'allocated_amount', 'allocated_amount_cny']; + protected $fillable = ['id', 'pi_no', 'payment_apply_id', 'receipt_id', 'stock_id', 'allocated_amount', 'allocated_amount_cny', 'updated_at', 'created_at']; /** * 不允许自动填充模型字段 @@ -59,7 +59,7 @@ class FinPaymentStock extends Model return $this->belongsTo(FinReceipt::class, 'receipt_id', 'id'); } - // 付款申请 + // 备货单 public function stock() { return $this->belongsTo(StockOrders::class, 'stock_id', 'id'); diff --git a/app/common/model/FinReceipt.php b/app/common/model/FinReceipt.php index a98914f..c87ab12 100644 --- a/app/common/model/FinReceipt.php +++ b/app/common/model/FinReceipt.php @@ -40,7 +40,7 @@ class FinReceipt extends Model /** * 允许自动填充模型字段 */ - 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 $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_by', 'updated_by', 'created_at', 'updated_at']; /** * 不允许自动填充模型字段 @@ -48,11 +48,11 @@ class FinReceipt extends Model protected $guarded = []; /** - * 获取付款申请 + * 对应的付款申请(1-1,可为空) */ public function payment() { - return $this->hasOne(FinPaymentApply::class, 'id', 'payment_apply_id'); + return $this->belongsTo(FinPaymentApply::class, 'payment_apply_id', 'id'); } /** @@ -62,4 +62,12 @@ class FinReceipt extends Model { return $this->belongsToMany(StockOrders::class, 'fin_payment_stock', 'receipt_id', 'stock_id'); } + + /** + * 关联的备货单(通过中间表) + */ + public function stocks() + { + return $this->belongsToMany(StockOrders::class, 'fin_payment_stock', 'receipt_id', 'stock_id'); + } } \ No newline at end of file diff --git a/app/common/model/FinReceiptHis.php b/app/common/model/FinReceiptHis.php new file mode 100644 index 0000000..814b87f --- /dev/null +++ b/app/common/model/FinReceiptHis.php @@ -0,0 +1,49 @@ +belongsToMany(FinPaymentApply::class, 'fin_payment_stock', 'stock_id', 'payment_apply_id'); } + + /** + * 关联收款记录(多对多,经由中间表) + */ + public function receipts() + { + return $this->belongsToMany(FinReceipt::class, 'fin_payment_stock', 'stock_id', 'receipt_id'); + } } \ No newline at end of file diff --git a/app/common/service/FinPaymentApplyService.php b/app/common/service/FinPaymentApplyService.php index 00ad976..d7912e1 100644 --- a/app/common/service/FinPaymentApplyService.php +++ b/app/common/service/FinPaymentApplyService.php @@ -2,9 +2,11 @@ namespace app\common\service; +use app\common\model\FinPaymentStock; use app\common\validate\FinPaymentApplyValidate; use app\common\traits\crud\CrudServiceTrait; use app\common\model\FinPaymentApply; +use support\Redis; use support\Request; class FinPaymentApplyService @@ -61,10 +63,27 @@ class FinPaymentApplyService public function beforeServiceStore($data, Request $request) { $data['apply_no'] = $this->generateUniqueApplyNo(); + $data['doc_user_id'] = $request->user->uid; $data['submit_files'] = json_encode($data['submit_files']); + redis::set('stock'.$data['doc_user_id'],json_encode($request->post('stock'))); return $data; } + + public function afterServiceStore($res) + { + $data = [ + 'payment_apply_id' => $res['id'], + ]; + $stock = json_decode(redis::get('stock'.$res['doc_user_id']), true); + redis::del('stock'); + foreach ($stock as $k => $v) { + $data['stock_id'] = $v['stock_id']; + $data['pi_no'] = $v['pi_on']; + FinPaymentStock::create($data); + } + } + public function beforeServiceUpdate($data, Request $request) { $data['submit_files'] = json_encode($data['submit_files']); diff --git a/app/common/service/FinReceiptService.php b/app/common/service/FinReceiptService.php index 2cc781c..3a7832d 100644 --- a/app/common/service/FinReceiptService.php +++ b/app/common/service/FinReceiptService.php @@ -80,12 +80,14 @@ class FinReceiptService unset($data['payment_apply_id']); } $data['receipt_no'] = $this->generateUniqueReceipt(); - $data['arrived_at'] = strtotime( $data['arrived_at']); + $data['arrived_at'] = $request->user->uid; + $data['updated_by'] = $request->user->uid; return $data; } public function beforeServiceUpdate($data, Request $request) { + $data['updated_by'] = $request->user->uid; $data['arrived_at'] = strtotime( $data['arrived_at']); $data['received_at'] = strtotime( $data['received_at']); return $data; diff --git a/app/controller/IndexController.php b/app/controller/IndexController.php index cf30328..e92751b 100644 --- a/app/controller/IndexController.php +++ b/app/controller/IndexController.php @@ -76,7 +76,7 @@ class IndexController // ], 'model' => [ 'module' => 'common', - 'name' => 'fin_payment_stock' + 'name' => 'fin_receipt_his' ], // 'service' => [ // 'module' => 'common', @@ -90,7 +90,7 @@ class IndexController // 'module' => 'common', // 'name' => 'fin_payment_apply' // ], - 'table' => 'fin_payment_stock' + 'table' => 'fin_receipt_his' ]; $result = (new Generate($options))->doGenerate(); From e6d3cc3f047e365c0f76fc0ba0e6eb60c6ae8892 Mon Sep 17 00:00:00 2001 From: "WIN-C27C5MSVTPO\\16961" <1696136552@qq.com> Date: Tue, 23 Sep 2025 16:45:06 +0800 Subject: [PATCH 03/21] =?UTF-8?q?=E4=BB=98=E6=AC=BE=E7=94=B3=E8=AF=B7?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E7=9B=B8=E5=85=B3=E5=AD=97=E6=AE=B5=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/FinPaymentApplyController.php | 65 ++++++++++++++++--- app/common/service/FinPaymentApplyService.php | 6 +- app/common/service/FinReceiptService.php | 28 ++++++++ config/route.php | 2 +- 4 files changed, 89 insertions(+), 12 deletions(-) diff --git a/app/common/controller/FinPaymentApplyController.php b/app/common/controller/FinPaymentApplyController.php index 2d0f22e..76e51bf 100644 --- a/app/common/controller/FinPaymentApplyController.php +++ b/app/common/controller/FinPaymentApplyController.php @@ -1,7 +1,13 @@ first()->name; + if (isset($data['sales_user_id'])) //业务员 + $data['sales_user_name'] = User::where('id', $data['doc_user_id'])->first()->name; + if (isset($data['corp_id'])) //公司(渠道) + $data['corp_name'] = SysDictItem::where('id', $data['corp_id'])->first()->item_label; + if (isset($data['account_id'])) //收款账号 + $data['account_name'] = SysAccount::where('id', $data['account_id'])->first()->account_name; + if (isset($data['country_id'])) //付款来源国家 + $data['country_name'] = Country::where('id', $data['currency_id'])->first()->cn_addr; + if (isset($data['currency_id'])) //付款币种 + $data['currency_name'] = SysCurrency::where('id', $data['currency_id'])->first()->currency_name; + if (isset($data['submit_files'])) + $data['submit_files'] = json_decode($data['submit_files'], true); + 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; + } + + /** + * 数据格式化 + * + * @param array $data + * @return array + */ + protected function showFormat($data) + { + if (isset($data['doc_user_id'])) //内勤 + $data['doc_user_name'] = User::where('id', $data['doc_user_id'])->first()->name; + if (isset($data['sales_user_id'])) //业务员 + $data['sales_user_name'] = User::where('id', $data['doc_user_id'])->first()->name; + if (isset($data['corp_id'])) //公司(渠道) + $data['corp_name'] = SysDictItem::where('id', $data['corp_id'])->first()->item_label; + if (isset($data['account_id'])) //收款账号 + $data['account_name'] = SysAccount::where('id', $data['account_id'])->first()->account_name; + if (isset($data['country_id'])) //付款来源国家 + $data['country_name'] = Country::where('id', $data['currency_id'])->first()->cn_addr; + if (isset($data['currency_id'])) //付款币种 + $data['currency_name'] = SysCurrency::where('id', $data['currency_id'])->first()->currency_name; + if (isset($data['submit_files'])) + $data['submit_files'] = json_decode($data['submit_files'], true); + 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; + } } \ No newline at end of file diff --git a/app/common/service/FinPaymentApplyService.php b/app/common/service/FinPaymentApplyService.php index d7912e1..535d621 100644 --- a/app/common/service/FinPaymentApplyService.php +++ b/app/common/service/FinPaymentApplyService.php @@ -65,7 +65,7 @@ class FinPaymentApplyService $data['apply_no'] = $this->generateUniqueApplyNo(); $data['doc_user_id'] = $request->user->uid; $data['submit_files'] = json_encode($data['submit_files']); - redis::set('stock'.$data['doc_user_id'],json_encode($request->post('stock'))); + redis::set('stock_' . $data['doc_user_id'], json_encode($request->post('stock')), 'EX', 30); return $data; } @@ -75,8 +75,8 @@ class FinPaymentApplyService $data = [ 'payment_apply_id' => $res['id'], ]; - $stock = json_decode(redis::get('stock'.$res['doc_user_id']), true); - redis::del('stock'); + $stock = json_decode(redis::get('stock_' . $res['doc_user_id']), true); + redis::del('stock' . $res['doc_user_id']); foreach ($stock as $k => $v) { $data['stock_id'] = $v['stock_id']; $data['pi_no'] = $v['pi_on']; diff --git a/app/common/service/FinReceiptService.php b/app/common/service/FinReceiptService.php index 3a7832d..53d61ff 100644 --- a/app/common/service/FinReceiptService.php +++ b/app/common/service/FinReceiptService.php @@ -2,6 +2,7 @@ namespace app\common\service; +use app\common\model\FinReceiptHis; use app\common\validate\FinReceiptValidate; use app\common\traits\crud\CrudServiceTrait; use app\common\model\FinReceipt; @@ -50,10 +51,22 @@ class FinReceiptService if (isset($p['country_id']) && !empty($p['country_id'])) { $config['where']['country_id'] = $p['country_id']; } + + // 没有付款记录的收款记录 + if (isset($p['payment_apply']) && $p['payment_apply'] == 'not') { + $config['where']['payment_apply_id'] = ['not null']; + } + + // 收款账户筛选 + if (isset($p['payment_apply_id']) && !empty($p['payment_apply_id'])) { + $config['where']['payment_apply_id'] = $p['payment_apply_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'] . '%'; @@ -85,6 +98,14 @@ class FinReceiptService return $data; } + public function afterServiceStore($res) + { + $receipt = FinReceipt::where('id',$res->id)->first()->toArray(); + $receipt = array_merge($receipt,['receipt_id' => $res->id]); + unset($receipt['id']); + FinReceiptHis::create($receipt); + } + public function beforeServiceUpdate($data, Request $request) { $data['updated_by'] = $request->user->uid; @@ -92,6 +113,13 @@ class FinReceiptService $data['received_at'] = strtotime( $data['received_at']); return $data; } + public function afterServiceUpdate($res) + { + $receipt = FinReceipt::where('id',$res->id)->first()->toArray(); + $receipt = array_merge($receipt,['receipt_id' => $res->id]); + unset($receipt['id']); + FinReceiptHis::create($receipt); + } /** diff --git a/config/route.php b/config/route.php index 087fcf8..f2c9cb7 100644 --- a/config/route.php +++ b/config/route.php @@ -361,7 +361,7 @@ Route::group('/admin', function () { 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']); From 1d6caad7b08f15c56d69db3482f888675338e723 Mon Sep 17 00:00:00 2001 From: "WIN-C27C5MSVTPO\\16961" <1696136552@qq.com> Date: Tue, 23 Sep 2025 17:33:09 +0800 Subject: [PATCH 04/21] =?UTF-8?q?=E4=BB=98=E6=AC=BE=E7=94=B3=E8=AF=B7?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E7=BB=93=E6=9E=84=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/controller/FinReceiptController.php | 15 +++++++++++++++ app/common/service/FinPaymentApplyService.php | 14 ++++++++------ 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/app/common/controller/FinReceiptController.php b/app/common/controller/FinReceiptController.php index 4acf899..c80dc3a 100644 --- a/app/common/controller/FinReceiptController.php +++ b/app/common/controller/FinReceiptController.php @@ -2,6 +2,9 @@ namespace app\common\controller; use app\common\controller\BaseController; +use app\common\model\Country; +use app\common\model\SysAccount; +use app\common\model\SysCurrency; use app\common\traits\crud\CrudControllerTrait; use app\common\service\FinReceiptService; @@ -32,6 +35,12 @@ class FinReceiptController extends BaseController $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']); + if (isset($data['account_id'])) //收款账号 + $data['account_name'] = SysAccount::where('id', $data['account_id'])->first()->account_name; + if (isset($data['country_id'])) //付款来源国家 + $data['country_name'] = Country::where('id', $data['currency_id'])->first()->cn_addr; + if (isset($data['currency_id'])) //付款币种 + $data['currency_name'] = SysCurrency::where('id', $data['currency_id'])->first()->currency_name; return $data; } @@ -51,6 +60,12 @@ class FinReceiptController extends BaseController $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']); + if (isset($data['account_id'])) //收款账号 + $data['account_name'] = SysAccount::where('id', $data['account_id'])->first()->account_name; + if (isset($data['country_id'])) //付款来源国家 + $data['country_name'] = Country::where('id', $data['currency_id'])->first()->cn_addr; + if (isset($data['currency_id'])) //付款币种 + $data['currency_name'] = SysCurrency::where('id', $data['currency_id'])->first()->currency_name; return $data; } } \ No newline at end of file diff --git a/app/common/service/FinPaymentApplyService.php b/app/common/service/FinPaymentApplyService.php index 535d621..14b9d64 100644 --- a/app/common/service/FinPaymentApplyService.php +++ b/app/common/service/FinPaymentApplyService.php @@ -66,6 +66,7 @@ class FinPaymentApplyService $data['doc_user_id'] = $request->user->uid; $data['submit_files'] = json_encode($data['submit_files']); redis::set('stock_' . $data['doc_user_id'], json_encode($request->post('stock')), 'EX', 30); + unset($data['stock']); return $data; } @@ -75,12 +76,14 @@ class FinPaymentApplyService $data = [ 'payment_apply_id' => $res['id'], ]; - $stock = json_decode(redis::get('stock_' . $res['doc_user_id']), true); + $piStock = json_decode(redis::get('stock_' . $res['doc_user_id']), true); redis::del('stock' . $res['doc_user_id']); - foreach ($stock as $k => $v) { - $data['stock_id'] = $v['stock_id']; - $data['pi_no'] = $v['pi_on']; - FinPaymentStock::create($data); + foreach ($piStock as $stock) { + foreach ($stock['stock_id'] as $v) { + $data['stock_id'] = $v; + $data['pi_no'] = $stock['pi_on']; + FinPaymentStock::create($data); + } } } @@ -90,7 +93,6 @@ class FinPaymentApplyService return $data; } - /** * 生成唯一的付款申请编码 * 格式:PA + 日期 + 6位字母数字组合 From 870bca5e578a5d697491cd8b3f425c71962b6099 Mon Sep 17 00:00:00 2001 From: "WIN-C27C5MSVTPO\\16961" <1696136552@qq.com> Date: Tue, 23 Sep 2025 18:26:17 +0800 Subject: [PATCH 05/21] =?UTF-8?q?=E4=BB=98=E6=AC=BE=E8=AF=A6=E6=83=85-?= =?UTF-8?q?=E5=A4=87=E8=B4=A7=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/controller/FinPaymentApplyController.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/app/common/controller/FinPaymentApplyController.php b/app/common/controller/FinPaymentApplyController.php index 76e51bf..3d82e92 100644 --- a/app/common/controller/FinPaymentApplyController.php +++ b/app/common/controller/FinPaymentApplyController.php @@ -4,6 +4,7 @@ namespace app\common\controller; use app\common\controller\BaseController; use app\common\model\Country; +use app\common\model\FinPaymentStock; use app\common\model\SysAccount; use app\common\model\SysCurrency; use app\common\model\SysDictItem; @@ -39,7 +40,7 @@ class FinPaymentApplyController extends BaseController if (isset($data['account_id'])) //收款账号 $data['account_name'] = SysAccount::where('id', $data['account_id'])->first()->account_name; if (isset($data['country_id'])) //付款来源国家 - $data['country_name'] = Country::where('id', $data['currency_id'])->first()->cn_addr; + $data['country_name'] = Country::where('id', $data['country_id'])->first()->cn_addr; if (isset($data['currency_id'])) //付款币种 $data['currency_name'] = SysCurrency::where('id', $data['currency_id'])->first()->currency_name; if (isset($data['submit_files'])) @@ -68,7 +69,7 @@ class FinPaymentApplyController extends BaseController if (isset($data['account_id'])) //收款账号 $data['account_name'] = SysAccount::where('id', $data['account_id'])->first()->account_name; if (isset($data['country_id'])) //付款来源国家 - $data['country_name'] = Country::where('id', $data['currency_id'])->first()->cn_addr; + $data['country_name'] = Country::where('id', $data['country_id'])->first()->cn_addr; if (isset($data['currency_id'])) //付款币种 $data['currency_name'] = SysCurrency::where('id', $data['currency_id'])->first()->currency_name; if (isset($data['submit_files'])) @@ -77,6 +78,14 @@ class FinPaymentApplyController extends BaseController $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']); + + $finPaymentStock = FinPaymentStock::where('payment_apply_id', $data['id'])->get(); + $stock = []; + foreach ($finPaymentStock as $v) { + $stock[$v['pi_no']] = ['pi_no' => $v['pi_no']]; + $stock[$v['pi_no']]['stock_id'] = [$v['stock_id']]; + } + $data['stock'] = $stock; return $data; } } \ No newline at end of file From db10ece6b702b15188a2b74800018be5439a54a8 Mon Sep 17 00:00:00 2001 From: "WIN-C27C5MSVTPO\\16961" <1696136552@qq.com> Date: Tue, 23 Sep 2025 18:30:13 +0800 Subject: [PATCH 06/21] =?UTF-8?q?=E4=BB=98=E6=AC=BE=E8=AF=A6=E6=83=85-?= =?UTF-8?q?=E5=A4=87=E8=B4=A7=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/controller/FinPaymentApplyController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/common/controller/FinPaymentApplyController.php b/app/common/controller/FinPaymentApplyController.php index 3d82e92..abf31a8 100644 --- a/app/common/controller/FinPaymentApplyController.php +++ b/app/common/controller/FinPaymentApplyController.php @@ -85,7 +85,7 @@ class FinPaymentApplyController extends BaseController $stock[$v['pi_no']] = ['pi_no' => $v['pi_no']]; $stock[$v['pi_no']]['stock_id'] = [$v['stock_id']]; } - $data['stock'] = $stock; + $data['stock'] = array_values($stock); return $data; } } \ No newline at end of file From 54f83679ea79c08b3fd3366bc2f8a6b9f3537b37 Mon Sep 17 00:00:00 2001 From: "WIN-C27C5MSVTPO\\16961" <1696136552@qq.com> Date: Tue, 23 Sep 2025 18:38:02 +0800 Subject: [PATCH 07/21] =?UTF-8?q?=E6=94=B6=E6=AC=BE=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=E7=BC=96=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/service/FinReceiptService.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/common/service/FinReceiptService.php b/app/common/service/FinReceiptService.php index 53d61ff..e50bc7d 100644 --- a/app/common/service/FinReceiptService.php +++ b/app/common/service/FinReceiptService.php @@ -93,7 +93,8 @@ class FinReceiptService unset($data['payment_apply_id']); } $data['receipt_no'] = $this->generateUniqueReceipt(); - $data['arrived_at'] = $request->user->uid; + $data['arrived_at'] = strtotime( $data['arrived_at']); + $data['created_by'] = $request->user->uid; $data['updated_by'] = $request->user->uid; return $data; } @@ -109,8 +110,10 @@ class FinReceiptService public function beforeServiceUpdate($data, Request $request) { $data['updated_by'] = $request->user->uid; - $data['arrived_at'] = strtotime( $data['arrived_at']); - $data['received_at'] = strtotime( $data['received_at']); + $data['arrived_at'] = strtotime($data['arrived_at']); + if(isset($data['received_at'])) + $data['received_at'] = strtotime($data['received_at']); + return $data; } public function afterServiceUpdate($res) From abc1142e88e1707d4e1aeaf0070ff691fb8c3897 Mon Sep 17 00:00:00 2001 From: "WIN-C27C5MSVTPO\\16961" <1696136552@qq.com> Date: Wed, 24 Sep 2025 10:16:34 +0800 Subject: [PATCH 08/21] =?UTF-8?q?=E7=BB=91=E5=AE=9A=E4=BB=98=E6=AC=BE?= =?UTF-8?q?=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/service/FinReceiptService.php | 9 ++-- app/common/validate/FinReceiptValidate.php | 62 +++++++++++----------- config/route.php | 1 + 3 files changed, 38 insertions(+), 34 deletions(-) diff --git a/app/common/service/FinReceiptService.php b/app/common/service/FinReceiptService.php index e50bc7d..bf83f38 100644 --- a/app/common/service/FinReceiptService.php +++ b/app/common/service/FinReceiptService.php @@ -54,6 +54,8 @@ class FinReceiptService // 没有付款记录的收款记录 if (isset($p['payment_apply']) && $p['payment_apply'] == 'not') { + $config['where']['payment_apply_id'] = ['null']; + } elseif (isset($p['payment_apply']) && $p['payment_apply'] == 'already') { $config['where']['payment_apply_id'] = ['not null']; } @@ -110,7 +112,8 @@ class FinReceiptService public function beforeServiceUpdate($data, Request $request) { $data['updated_by'] = $request->user->uid; - $data['arrived_at'] = strtotime($data['arrived_at']); + if(isset($data['arrived_at'])) + $data['arrived_at'] = strtotime($data['arrived_at']); if(isset($data['received_at'])) $data['received_at'] = strtotime($data['received_at']); @@ -118,8 +121,8 @@ class FinReceiptService } public function afterServiceUpdate($res) { - $receipt = FinReceipt::where('id',$res->id)->first()->toArray(); - $receipt = array_merge($receipt,['receipt_id' => $res->id]); + $receipt = FinReceipt::where('id',$res['id'])->first()->toArray(); + $receipt = array_merge($receipt,['receipt_id' => $res['id']]); unset($receipt['id']); FinReceiptHis::create($receipt); } diff --git a/app/common/validate/FinReceiptValidate.php b/app/common/validate/FinReceiptValidate.php index c006dee..237b03e 100644 --- a/app/common/validate/FinReceiptValidate.php +++ b/app/common/validate/FinReceiptValidate.php @@ -8,49 +8,49 @@ 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', +// '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' => '是否回转内地必须是整数', +// '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' +// 'payment_apply_id', 'country_id', 'remitter', 'account_id', 'currency_id', 'amount', 'exchange_rate', 'arrived_at' ], 'update' => [ - +// 'payment_apply_id' ] ]; } \ No newline at end of file diff --git a/config/route.php b/config/route.php index f2c9cb7..be37a5b 100644 --- a/config/route.php +++ b/config/route.php @@ -358,6 +358,7 @@ Route::group('/admin', function () { 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('/payment', [app\common\controller\FinReceiptController::class, 'update']); Route::any('/destroy', [app\common\controller\FinReceiptController::class, 'destroy']); }); From 435d3ce67737213c36f5faaa5a307182b08f7dd7 Mon Sep 17 00:00:00 2001 From: "WIN-C27C5MSVTPO\\16961" <1696136552@qq.com> Date: Wed, 24 Sep 2025 15:23:47 +0800 Subject: [PATCH 09/21] =?UTF-8?q?=E4=BB=98=E6=AC=BE=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/FinPaymentApplyController.php | 14 ++- app/common/model/FinPaymentApply.php | 10 +- app/common/service/FinPaymentApplyService.php | 106 ++++++++++++++++++ 3 files changed, 120 insertions(+), 10 deletions(-) diff --git a/app/common/controller/FinPaymentApplyController.php b/app/common/controller/FinPaymentApplyController.php index abf31a8..3d35f09 100644 --- a/app/common/controller/FinPaymentApplyController.php +++ b/app/common/controller/FinPaymentApplyController.php @@ -9,6 +9,7 @@ use app\common\model\SysAccount; use app\common\model\SysCurrency; use app\common\model\SysDictItem; use app\common\model\User; +use app\common\service\OssService; use app\common\traits\crud\CrudControllerTrait; use app\common\service\FinPaymentApplyService; @@ -43,8 +44,19 @@ class FinPaymentApplyController extends BaseController $data['country_name'] = Country::where('id', $data['country_id'])->first()->cn_addr; if (isset($data['currency_id'])) //付款币种 $data['currency_name'] = SysCurrency::where('id', $data['currency_id'])->first()->currency_name; - if (isset($data['submit_files'])) + $OssService = new OssService(); + if (isset($data['submit_files'])){ $data['submit_files'] = json_decode($data['submit_files'], true); + foreach ($data['submit_files'] as $key => $value) { + $data['submit_files'][$key] = [ + 'file_src' => $value['file_src'], + 'file_full' => $OssService->generatePrivateUrl($value['file_src']), + 'file_name' => $value['file_name'], + ]; + } + } + if (isset($data['voucher_file'])) + $data['voucher_file_full'] = $OssService->generatePrivateUrl($data['voucher_file']); if (isset($data['created_at'])) $data['created_at'] = date('Y-m-d H:i:s', $data['created_at']); if (isset($data['updated_at'])) diff --git a/app/common/model/FinPaymentApply.php b/app/common/model/FinPaymentApply.php index 0556210..f02f137 100644 --- a/app/common/model/FinPaymentApply.php +++ b/app/common/model/FinPaymentApply.php @@ -40,7 +40,7 @@ class FinPaymentApply extends Model /** * 允许自动填充模型字段 */ - 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 $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', 'voucher_name', 'submit_files', 'created_at', 'updated_at']; /** * 不允许自动填充模型字段 @@ -55,14 +55,6 @@ class FinPaymentApply extends Model 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'); - } - /** * 关联的备货单(通过中间表) */ diff --git a/app/common/service/FinPaymentApplyService.php b/app/common/service/FinPaymentApplyService.php index 14b9d64..294bc01 100644 --- a/app/common/service/FinPaymentApplyService.php +++ b/app/common/service/FinPaymentApplyService.php @@ -45,6 +45,23 @@ class FinPaymentApplyService 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']; @@ -125,4 +142,93 @@ class FinPaymentApplyService $timestamp = substr(time(), -6); return $secondChar . $timestamp; } + + /** + * 根据相似度排序付款记录 + * @param Request $request + * @return \Illuminate\Contracts\Pagination\LengthAwarePaginator|\Illuminate\Pagination\LengthAwarePaginator + */ + public function complexQueryIndex(Request $request) + { + $limit = (int)$request->get('size', 15); + $page = (int)$request->get('current', 1); + $param = $request->all(); + + $where = []; + + // 汇款国家 + if (isset($param['country_id']) && !empty($param['country_id'])) { + $where[] = ['country_id', $param['country_id']]; + } + // 收款账户筛选 + if (isset($param['account_id']) && !empty($param['account_id'])) { + $where[] = ['account_id', $param['account_id']]; + } + + // 关键字 + if (isset($param['keyword']) && $param['keyword']) { + $k = '%' . $param['keyword'] . '%'; + $where[] = ['remitter', 'like', $k]; + } + + // 构建查询 + $query = $this->modelClass::where($where); + + // 应用是否有关联收款记录的筛选 + $correlation = $param['correlation']??''; + if ($correlation === 'receipt') { + $query->whereHas('receipt'); + } elseif ($correlation === 'unbind') { + $query->whereDoesntHave('receipt'); + } + + if (isset($param['scene']) && $param['scene'] == 'list') { + return $query->paginate($limit, ['*'], 'page', $page); + } + + // 计算七天前的时间戳 + $sevenDaysAgo = time() - (10 * 24 * 60 * 60); + + // 构建相似度排序逻辑 + $similarityOrder = []; + + // 如果有传入参数,计算相似度 + if (isset($param['account_id']) && !empty($param['account_id'])) { + $similarityOrder[] = "CASE WHEN account_id = {$param['account_id']} THEN 0 ELSE 1 END"; + } + + if (isset($param['country_id']) && !empty($param['country_id'])) { + $similarityOrder[] = "CASE WHEN country_id = {$param['country_id']} THEN 0 ELSE 1 END"; + } + + if (isset($param['keyword']) && $param['keyword']) { + $keyword = addslashes($param['keyword']); + $similarityOrder[] = "CASE WHEN remitter LIKE '%{$keyword}%' THEN 0 ELSE 1 END"; + } + + if (isset($param['amount']) && !empty($param['amount'])) { + $amount = (float)$param['amount']; + $similarityOrder[] = "ABS(amount - {$amount})"; + } + + // 构建排序SQL + $orderByClause = ""; + if (!empty($similarityOrder)) { + $orderByClause = "CASE + WHEN created_at >= {$sevenDaysAgo} THEN + (" . implode(' + ', $similarityOrder) . ") + ELSE 999999 + END ASC, "; + } + + $orderByClause .= "CASE + WHEN created_at < {$sevenDaysAgo} THEN id + ELSE 0 + END DESC"; + + $query->orderByRaw($orderByClause); + + return $query->paginate($limit, ['*'], 'page', $page); + } + } \ No newline at end of file From 82e4435a2cca7569342524a33d270f5018484385 Mon Sep 17 00:00:00 2001 From: "WIN-C27C5MSVTPO\\16961" <1696136552@qq.com> Date: Wed, 24 Sep 2025 17:49:14 +0800 Subject: [PATCH 10/21] =?UTF-8?q?=E6=94=B6=E6=B1=87=E9=99=84=E4=BB=B6?= =?UTF-8?q?=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/controller/FinReceiptController.php | 5 +++++ app/common/model/FinReceipt.php | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/common/controller/FinReceiptController.php b/app/common/controller/FinReceiptController.php index c80dc3a..a443537 100644 --- a/app/common/controller/FinReceiptController.php +++ b/app/common/controller/FinReceiptController.php @@ -5,6 +5,7 @@ use app\common\controller\BaseController; use app\common\model\Country; use app\common\model\SysAccount; use app\common\model\SysCurrency; +use app\common\service\OssService; use app\common\traits\crud\CrudControllerTrait; use app\common\service\FinReceiptService; @@ -41,6 +42,8 @@ class FinReceiptController extends BaseController $data['country_name'] = Country::where('id', $data['currency_id'])->first()->cn_addr; if (isset($data['currency_id'])) //付款币种 $data['currency_name'] = SysCurrency::where('id', $data['currency_id'])->first()->currency_name; + if (isset($data['fx_receipt_file'])) + $data['fx_receipt_file_full'] = (new OssService)->generatePrivateUrl($data['fx_receipt_file']); return $data; } @@ -66,6 +69,8 @@ class FinReceiptController extends BaseController $data['country_name'] = Country::where('id', $data['currency_id'])->first()->cn_addr; if (isset($data['currency_id'])) //付款币种 $data['currency_name'] = SysCurrency::where('id', $data['currency_id'])->first()->currency_name; + if (isset($data['fx_receipt_file'])) + $data['fx_receipt_file_full'] = (new OssService)->generatePrivateUrl($data['fx_receipt_file']); return $data; } } \ No newline at end of file diff --git a/app/common/model/FinReceipt.php b/app/common/model/FinReceipt.php index c87ab12..dbefafa 100644 --- a/app/common/model/FinReceipt.php +++ b/app/common/model/FinReceipt.php @@ -40,7 +40,7 @@ class FinReceipt extends Model /** * 允许自动填充模型字段 */ - 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_by', 'updated_by', 'created_at', 'updated_at']; + 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', 'fx_receipt_file_name', 'is_domestic_return', 'created_by', 'updated_by', 'created_at', 'updated_at']; /** * 不允许自动填充模型字段 From e0b11718a744fc3d1dd51ee53d6379ba1ecd4018 Mon Sep 17 00:00:00 2001 From: "WIN-C27C5MSVTPO\\16961" <1696136552@qq.com> Date: Wed, 24 Sep 2025 17:55:16 +0800 Subject: [PATCH 11/21] =?UTF-8?q?=E6=94=B6=E6=AC=BE=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=E5=85=B3=E8=81=94=E5=A4=87=E8=B4=A7=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/model/FinReceipt.php | 8 -------- 1 file changed, 8 deletions(-) diff --git a/app/common/model/FinReceipt.php b/app/common/model/FinReceipt.php index dbefafa..7347be0 100644 --- a/app/common/model/FinReceipt.php +++ b/app/common/model/FinReceipt.php @@ -55,14 +55,6 @@ class FinReceipt extends Model return $this->belongsTo(FinPaymentApply::class, 'payment_apply_id', 'id'); } - /** - * 备货单 - */ - public function stock() - { - return $this->belongsToMany(StockOrders::class, 'fin_payment_stock', 'receipt_id', 'stock_id'); - } - /** * 关联的备货单(通过中间表) */ From ec2502cd586a2060a0862ffa8b37b6fa1045dd47 Mon Sep 17 00:00:00 2001 From: "WIN-C27C5MSVTPO\\16961" <1696136552@qq.com> Date: Thu, 25 Sep 2025 17:48:31 +0800 Subject: [PATCH 12/21] =?UTF-8?q?=E6=94=B6=E6=AC=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/service/FinReceiptService.php | 95 +++++++++++++++++++++++- 1 file changed, 93 insertions(+), 2 deletions(-) diff --git a/app/common/service/FinReceiptService.php b/app/common/service/FinReceiptService.php index bf83f38..2f77af5 100644 --- a/app/common/service/FinReceiptService.php +++ b/app/common/service/FinReceiptService.php @@ -59,7 +59,7 @@ class FinReceiptService $config['where']['payment_apply_id'] = ['not null']; } - // 收款账户筛选 + // 收款申请筛选 if (isset($p['payment_apply_id']) && !empty($p['payment_apply_id'])) { $config['where']['payment_apply_id'] = $p['payment_apply_id']; } @@ -70,7 +70,7 @@ class FinReceiptService } // 关键字 - if (isset($p['keyword']) && $p['keyword']) { + if (isset($p['$query']) && $p['keyword']) { $k = '%' . $p['keyword'] . '%'; $config['orWhere'][] = ['remitter', 'like', $k]; } @@ -160,4 +160,95 @@ class FinReceiptService $timestamp = substr(time(), -6); return $secondChar . $timestamp; } + + /** + * 根据相似度排序付款记录 + * @param Request $request + * @return \Illuminate\Contracts\Pagination\LengthAwarePaginator|\Illuminate\Pagination\LengthAwarePaginator + */ + public function complexQueryIndex(Request $request) + { + $limit = (int)$request->get('size', 15); + $page = (int)$request->get('current', 1); + $param = $request->all(); + + $where = []; + + // 汇款国家 + if (isset($param['country_id']) && !empty($param['country_id'])) { + $where[] = ['country_id', $param['country_id']]; + } + // 收款账户筛选 + if (isset($param['account_id']) && !empty($param['account_id'])) { + $where[] = ['account_id', $param['account_id']]; + } + // 收款申请筛选 + if (isset($param['payment_apply_id']) && !empty($param['payment_apply_id'])) { + $where[]['payment_apply_id'] = $param['payment_apply_id']; + } + + // 关键字 + if (isset($param['keyword']) && $param['keyword']) { + $k = '%' . $param['keyword'] . '%'; + $where[] = ['remitter', 'like', $k]; + } + + // 构建查询 + $query = $this->modelClass::where($where); + + // 没有付款记录的收款记录 + if (isset($param['payment_apply']) && $param['payment_apply'] == 'not') { + $query->whereNull('payment_apply_id'); + } elseif (isset($param['payment_apply']) && $param['payment_apply'] == 'already') { + $query->whereNotNull('payment_apply_id'); + } + + if (isset($param['scene']) && $param['scene'] == 'list') { + return $query->paginate($limit, ['*'], 'page', $page); + } + + // 计算七天前的时间戳 + $sevenDaysAgo = time() - (10 * 24 * 60 * 60); + + // 构建相似度排序逻辑 + $similarityOrder = []; + + // 如果有传入参数,计算相似度 + if (isset($param['account_id']) && !empty($param['account_id'])) { + $similarityOrder[] = "CASE WHEN account_id = {$param['account_id']} THEN 0 ELSE 1 END"; + } + + if (isset($param['country_id']) && !empty($param['country_id'])) { + $similarityOrder[] = "CASE WHEN country_id = {$param['country_id']} THEN 0 ELSE 1 END"; + } + + if (isset($param['keyword']) && $param['keyword']) { + $keyword = addslashes($param['keyword']); + $similarityOrder[] = "CASE WHEN remitter LIKE '%{$keyword}%' THEN 0 ELSE 1 END"; + } + + if (isset($param['amount']) && !empty($param['amount'])) { + $amount = (float)$param['amount']; + $similarityOrder[] = "ABS(amount - {$amount})"; + } + + // 构建排序SQL + $orderByClause = ""; + if (!empty($similarityOrder)) { + $orderByClause = "CASE + WHEN created_at >= {$sevenDaysAgo} THEN + (" . implode(' + ', $similarityOrder) . ") + ELSE 999999 + END ASC, "; + } + + $orderByClause .= "CASE + WHEN created_at < {$sevenDaysAgo} THEN id + ELSE 0 + END DESC"; + + $query->orderByRaw($orderByClause); + + return $query->paginate($limit, ['*'], 'page', $page); + } } \ No newline at end of file From ae6cd4ec78739fee47a584d4b5c55b70c3ea157d Mon Sep 17 00:00:00 2001 From: "WIN-C27C5MSVTPO\\16961" <1696136552@qq.com> Date: Fri, 26 Sep 2025 16:43:09 +0800 Subject: [PATCH 13/21] =?UTF-8?q?=E5=8F=98=E6=9B=B4=E5=8E=86=E5=8F=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/FinReceiptHisController.php | 77 +++++++++++++++++++ app/common/logic/FinReceiptHisLogic.php | 17 ++++ app/common/service/FinReceiptHisService.php | 62 +++++++++++++++ app/common/validate/FinReceiptHisValidate.php | 29 +++++++ config/route.php | 5 ++ 5 files changed, 190 insertions(+) create mode 100644 app/common/controller/FinReceiptHisController.php create mode 100644 app/common/logic/FinReceiptHisLogic.php create mode 100644 app/common/service/FinReceiptHisService.php create mode 100644 app/common/validate/FinReceiptHisValidate.php diff --git a/app/common/controller/FinReceiptHisController.php b/app/common/controller/FinReceiptHisController.php new file mode 100644 index 0000000..eb57d99 --- /dev/null +++ b/app/common/controller/FinReceiptHisController.php @@ -0,0 +1,77 @@ +service = new FinReceiptHisService(); + } + + /** + * 列表页数据格式化 + * + * @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']); + if (isset($data['account_id'])) //收款账号 + $data['account_name'] = SysAccount::where('id', $data['account_id'])->first()->account_name; + if (isset($data['country_id'])) //付款来源国家 + $data['country_name'] = Country::where('id', $data['currency_id'])->first()->cn_addr; + if (isset($data['currency_id'])) //付款币种 + $data['currency_name'] = SysCurrency::where('id', $data['currency_id'])->first()->currency_name; + if (isset($data['fx_receipt_file'])) + $data['fx_receipt_file_full'] = (new OssService)->generatePrivateUrl($data['fx_receipt_file']); + 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']); + if (isset($data['account_id'])) //收款账号 + $data['account_name'] = SysAccount::where('id', $data['account_id'])->first()->account_name; + if (isset($data['country_id'])) //付款来源国家 + $data['country_name'] = Country::where('id', $data['currency_id'])->first()->cn_addr; + if (isset($data['currency_id'])) //付款币种 + $data['currency_name'] = SysCurrency::where('id', $data['currency_id'])->first()->currency_name; + if (isset($data['fx_receipt_file'])) + $data['fx_receipt_file_full'] = (new OssService)->generatePrivateUrl($data['fx_receipt_file']); + return $data; + } +} \ No newline at end of file diff --git a/app/common/logic/FinReceiptHisLogic.php b/app/common/logic/FinReceiptHisLogic.php new file mode 100644 index 0000000..3e90dac --- /dev/null +++ b/app/common/logic/FinReceiptHisLogic.php @@ -0,0 +1,17 @@ +validator; + } + + /** + * 构建查询条件 + */ + protected function buildQueryConfig(Request $request, string $scene = 'index'): array + { + $p = $request->all(); + + $config = []; + $config['model'] = $this->modelClass; + switch ($scene) { + case 'index': + if(empty($p['receipt_id'])){ + throw new BusinessException('receipt_id不能为空'); + } + // ====== ====== 排序 ====== ====== + $config['order']['id'] = 'desc'; + + // ====== ====== 筛选 ====== ====== + $config['where']['receipt_id'] = $p['receipt_id']; + + break; + case 'show': + $config['where']['id'] = $p['id']; + break; + } + + return $config; + } +} \ No newline at end of file diff --git a/app/common/validate/FinReceiptHisValidate.php b/app/common/validate/FinReceiptHisValidate.php new file mode 100644 index 0000000..7a1f7c4 --- /dev/null +++ b/app/common/validate/FinReceiptHisValidate.php @@ -0,0 +1,29 @@ + [ + + ], + + 'update' => [ + + ] + ]; +} \ No newline at end of file diff --git a/config/route.php b/config/route.php index be37a5b..3f7477f 100644 --- a/config/route.php +++ b/config/route.php @@ -361,6 +361,11 @@ Route::group('/admin', function () { Route::any('/payment', [app\common\controller\FinReceiptController::class, 'update']); Route::any('/destroy', [app\common\controller\FinReceiptController::class, 'destroy']); }); + // 收款记录历史 + Route::group('/receipt/his', function () { + Route::any('/list', [app\common\controller\FinReceiptHisController::class, 'index']); + Route::any('/show', [app\common\controller\FinReceiptHisController::class, 'show']); + }); // 付款申请 Route::group('/payment', function () { From 40dfd99f4e59d88952b30168e706af70b14c63b6 Mon Sep 17 00:00:00 2001 From: "WIN-C27C5MSVTPO\\16961" <1696136552@qq.com> Date: Sun, 28 Sep 2025 09:47:09 +0800 Subject: [PATCH 14/21] =?UTF-8?q?=E5=85=B3=E8=81=94=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/FinPaymentApplyController.php | 33 +++++++++++++------ .../controller/FinReceiptController.php | 15 +++++---- 2 files changed, 31 insertions(+), 17 deletions(-) diff --git a/app/common/controller/FinPaymentApplyController.php b/app/common/controller/FinPaymentApplyController.php index 3d35f09..d8158fa 100644 --- a/app/common/controller/FinPaymentApplyController.php +++ b/app/common/controller/FinPaymentApplyController.php @@ -37,13 +37,13 @@ class FinPaymentApplyController extends BaseController if (isset($data['sales_user_id'])) //业务员 $data['sales_user_name'] = User::where('id', $data['doc_user_id'])->first()->name; if (isset($data['corp_id'])) //公司(渠道) - $data['corp_name'] = SysDictItem::where('id', $data['corp_id'])->first()->item_label; + $data['corp_name'] = SysDictItem::where('id', $data['corp_id'])->value('item_label')??''; if (isset($data['account_id'])) //收款账号 - $data['account_name'] = SysAccount::where('id', $data['account_id'])->first()->account_name; + $data['account_name'] = SysAccount::where('id', $data['account_id'])->value('account_name')??''; if (isset($data['country_id'])) //付款来源国家 - $data['country_name'] = Country::where('id', $data['country_id'])->first()->cn_addr; + $data['country_name'] = Country::where('id', $data['country_id'])->value('cn_addr')??''; if (isset($data['currency_id'])) //付款币种 - $data['currency_name'] = SysCurrency::where('id', $data['currency_id'])->first()->currency_name; + $data['currency_name'] = SysCurrency::where('id', $data['currency_id'])->value('currency_name')??''; $OssService = new OssService(); if (isset($data['submit_files'])){ $data['submit_files'] = json_decode($data['submit_files'], true); @@ -55,7 +55,8 @@ class FinPaymentApplyController extends BaseController ]; } } - if (isset($data['voucher_file'])) + $data['voucher_file_full'] = ''; + if (!empty($data['voucher_file'])) $data['voucher_file_full'] = $OssService->generatePrivateUrl($data['voucher_file']); if (isset($data['created_at'])) $data['created_at'] = date('Y-m-d H:i:s', $data['created_at']); @@ -77,15 +78,27 @@ class FinPaymentApplyController extends BaseController if (isset($data['sales_user_id'])) //业务员 $data['sales_user_name'] = User::where('id', $data['doc_user_id'])->first()->name; if (isset($data['corp_id'])) //公司(渠道) - $data['corp_name'] = SysDictItem::where('id', $data['corp_id'])->first()->item_label; + $data['corp_name'] = SysDictItem::where('id', $data['corp_id'])->value('item_label')??''; if (isset($data['account_id'])) //收款账号 - $data['account_name'] = SysAccount::where('id', $data['account_id'])->first()->account_name; + $data['account_name'] = SysAccount::where('id', $data['account_id'])->value('account_name')??''; if (isset($data['country_id'])) //付款来源国家 - $data['country_name'] = Country::where('id', $data['country_id'])->first()->cn_addr; + $data['country_name'] = Country::where('id', $data['country_id'])->value('cn_addr')??''; if (isset($data['currency_id'])) //付款币种 - $data['currency_name'] = SysCurrency::where('id', $data['currency_id'])->first()->currency_name; - if (isset($data['submit_files'])) + $data['currency_name'] = SysCurrency::where('id', $data['currency_id'])->value('currency_name')??''; + $OssService = new OssService(); + if (isset($data['submit_files'])){ $data['submit_files'] = json_decode($data['submit_files'], true); + foreach ($data['submit_files'] as $key => $value) { + $data['submit_files'][$key] = [ + 'file_src' => $value['file_src'], + 'file_full' => $OssService->generatePrivateUrl($value['file_src']), + 'file_name' => $value['file_name'], + ]; + } + } + $data['voucher_file_full'] = ''; + if (!empty($data['voucher_file'])) + $data['voucher_file_full'] = $OssService->generatePrivateUrl($data['voucher_file']); if (isset($data['created_at'])) $data['created_at'] = date('Y-m-d H:i:s', $data['created_at']); if (isset($data['updated_at'])) diff --git a/app/common/controller/FinReceiptController.php b/app/common/controller/FinReceiptController.php index a443537..3dcdf72 100644 --- a/app/common/controller/FinReceiptController.php +++ b/app/common/controller/FinReceiptController.php @@ -37,12 +37,13 @@ class FinReceiptController extends BaseController if (isset($data['received_at'])) $data['received_at'] = date('Y-m-d H:i:s', $data['received_at']); if (isset($data['account_id'])) //收款账号 - $data['account_name'] = SysAccount::where('id', $data['account_id'])->first()->account_name; + $data['account_name'] = SysAccount::where('id', $data['account_id'])->value('account_name')??''; if (isset($data['country_id'])) //付款来源国家 - $data['country_name'] = Country::where('id', $data['currency_id'])->first()->cn_addr; + $data['country_name'] = Country::where('id', $data['country_id'])->value('cn_addr')??''; if (isset($data['currency_id'])) //付款币种 - $data['currency_name'] = SysCurrency::where('id', $data['currency_id'])->first()->currency_name; - if (isset($data['fx_receipt_file'])) + $data['currency_name'] = SysCurrency::where('id', $data['currency_id'])->value('currency_name')??''; + $data['fx_receipt_file_full'] = ''; + if (!empty($data['fx_receipt_file'])) $data['fx_receipt_file_full'] = (new OssService)->generatePrivateUrl($data['fx_receipt_file']); return $data; } @@ -64,11 +65,11 @@ class FinReceiptController extends BaseController if (isset($data['received_at'])) $data['received_at'] = date('Y-m-d H:i:s', $data['received_at']); if (isset($data['account_id'])) //收款账号 - $data['account_name'] = SysAccount::where('id', $data['account_id'])->first()->account_name; + $data['account_name'] = SysAccount::where('id', $data['account_id'])->value('account_name')??''; if (isset($data['country_id'])) //付款来源国家 - $data['country_name'] = Country::where('id', $data['currency_id'])->first()->cn_addr; + $data['country_name'] = Country::where('id', $data['country_id'])->value('cn_addr')??''; if (isset($data['currency_id'])) //付款币种 - $data['currency_name'] = SysCurrency::where('id', $data['currency_id'])->first()->currency_name; + $data['currency_name'] = SysCurrency::where('id', $data['currency_id'])->value('currency_name')??''; if (isset($data['fx_receipt_file'])) $data['fx_receipt_file_full'] = (new OssService)->generatePrivateUrl($data['fx_receipt_file']); return $data; From a3a6cfefc062b2c2d0a3c96da36054dfae973b91 Mon Sep 17 00:00:00 2001 From: "WIN-C27C5MSVTPO\\16961" <1696136552@qq.com> Date: Sun, 28 Sep 2025 09:56:01 +0800 Subject: [PATCH 15/21] =?UTF-8?q?=E6=94=B6=E6=AC=BE=E9=99=84=E4=BB=B6?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/controller/FinPaymentApplyController.php | 12 ++++++++---- app/common/controller/FinReceiptController.php | 11 ++++++++--- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/app/common/controller/FinPaymentApplyController.php b/app/common/controller/FinPaymentApplyController.php index d8158fa..8739043 100644 --- a/app/common/controller/FinPaymentApplyController.php +++ b/app/common/controller/FinPaymentApplyController.php @@ -55,9 +55,11 @@ class FinPaymentApplyController extends BaseController ]; } } - $data['voucher_file_full'] = ''; - if (!empty($data['voucher_file'])) + if (!empty($data['voucher_file'])) { $data['voucher_file_full'] = $OssService->generatePrivateUrl($data['voucher_file']); + } elseif (isset($data['voucher_file'])) { + $data['voucher_file_full'] = ''; + } if (isset($data['created_at'])) $data['created_at'] = date('Y-m-d H:i:s', $data['created_at']); if (isset($data['updated_at'])) @@ -96,9 +98,11 @@ class FinPaymentApplyController extends BaseController ]; } } - $data['voucher_file_full'] = ''; - if (!empty($data['voucher_file'])) + if (!empty($data['voucher_file'])) { $data['voucher_file_full'] = $OssService->generatePrivateUrl($data['voucher_file']); + } elseif (isset($data['voucher_file'])) { + $data['voucher_file_full'] = ''; + } if (isset($data['created_at'])) $data['created_at'] = date('Y-m-d H:i:s', $data['created_at']); if (isset($data['updated_at'])) diff --git a/app/common/controller/FinReceiptController.php b/app/common/controller/FinReceiptController.php index 3dcdf72..76b1ed8 100644 --- a/app/common/controller/FinReceiptController.php +++ b/app/common/controller/FinReceiptController.php @@ -42,9 +42,11 @@ class FinReceiptController extends BaseController $data['country_name'] = Country::where('id', $data['country_id'])->value('cn_addr')??''; if (isset($data['currency_id'])) //付款币种 $data['currency_name'] = SysCurrency::where('id', $data['currency_id'])->value('currency_name')??''; - $data['fx_receipt_file_full'] = ''; - if (!empty($data['fx_receipt_file'])) + if (!empty($data['fx_receipt_file'])){ $data['fx_receipt_file_full'] = (new OssService)->generatePrivateUrl($data['fx_receipt_file']); + }elseif (isset($data['fx_receipt_file'])){ + $data['fx_receipt_file_full'] = ''; + } return $data; } @@ -70,8 +72,11 @@ class FinReceiptController extends BaseController $data['country_name'] = Country::where('id', $data['country_id'])->value('cn_addr')??''; if (isset($data['currency_id'])) //付款币种 $data['currency_name'] = SysCurrency::where('id', $data['currency_id'])->value('currency_name')??''; - if (isset($data['fx_receipt_file'])) + if (!empty($data['fx_receipt_file'])) { $data['fx_receipt_file_full'] = (new OssService)->generatePrivateUrl($data['fx_receipt_file']); + } elseif (isset($data['fx_receipt_file'])) { + $data['fx_receipt_file_full'] = ''; + } return $data; } } \ No newline at end of file From 90cce108b0b3e27d15351b70b420308fc5187a82 Mon Sep 17 00:00:00 2001 From: "WIN-C27C5MSVTPO\\16961" <1696136552@qq.com> Date: Sun, 28 Sep 2025 10:10:15 +0800 Subject: [PATCH 16/21] =?UTF-8?q?=E6=94=B6=E6=AC=BE=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=E5=88=9B=E5=BB=BA=E4=B8=8E=E4=BF=AE=E6=94=B9=E4=BA=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/controller/FinPaymentApplyController.php | 8 ++++---- app/common/controller/FinReceiptHisController.php | 11 +++++++++++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/app/common/controller/FinPaymentApplyController.php b/app/common/controller/FinPaymentApplyController.php index 8739043..7dead81 100644 --- a/app/common/controller/FinPaymentApplyController.php +++ b/app/common/controller/FinPaymentApplyController.php @@ -33,9 +33,9 @@ class FinPaymentApplyController extends BaseController protected function indexFormat($data) { if (isset($data['doc_user_id'])) //内勤 - $data['doc_user_name'] = User::where('id', $data['doc_user_id'])->first()->name; + $data['doc_user_name'] = User::where('id', $data['doc_user_id'])->value('name')??''; if (isset($data['sales_user_id'])) //业务员 - $data['sales_user_name'] = User::where('id', $data['doc_user_id'])->first()->name; + $data['sales_user_name'] = User::where('id', $data['doc_user_id'])->value('name')??''; if (isset($data['corp_id'])) //公司(渠道) $data['corp_name'] = SysDictItem::where('id', $data['corp_id'])->value('item_label')??''; if (isset($data['account_id'])) //收款账号 @@ -76,9 +76,9 @@ class FinPaymentApplyController extends BaseController protected function showFormat($data) { if (isset($data['doc_user_id'])) //内勤 - $data['doc_user_name'] = User::where('id', $data['doc_user_id'])->first()->name; + $data['doc_user_name'] = User::where('id', $data['doc_user_id'])->value('name')??''; if (isset($data['sales_user_id'])) //业务员 - $data['sales_user_name'] = User::where('id', $data['doc_user_id'])->first()->name; + $data['sales_user_name'] = User::where('id', $data['doc_user_id'])->value('name')??''; if (isset($data['corp_id'])) //公司(渠道) $data['corp_name'] = SysDictItem::where('id', $data['corp_id'])->value('item_label')??''; if (isset($data['account_id'])) //收款账号 diff --git a/app/common/controller/FinReceiptHisController.php b/app/common/controller/FinReceiptHisController.php index eb57d99..e10d859 100644 --- a/app/common/controller/FinReceiptHisController.php +++ b/app/common/controller/FinReceiptHisController.php @@ -5,6 +5,7 @@ use app\common\controller\BaseController; use app\common\model\Country; use app\common\model\SysAccount; use app\common\model\SysCurrency; +use app\common\model\User; use app\common\service\OssService; use app\common\traits\crud\CrudControllerTrait; use app\common\service\FinReceiptHisService; @@ -45,6 +46,11 @@ class FinReceiptHisController extends BaseController $data['currency_name'] = SysCurrency::where('id', $data['currency_id'])->first()->currency_name; if (isset($data['fx_receipt_file'])) $data['fx_receipt_file_full'] = (new OssService)->generatePrivateUrl($data['fx_receipt_file']); + + if (isset($data['created_by'])) + $data['created_by'] = User::where('id', $data['created_by'])->value('name')??''; + if (isset($data['updated_by'])) + $data['updated_by'] = User::where('id', $data['updated_by'])->value('name')??''; return $data; } @@ -72,6 +78,11 @@ class FinReceiptHisController extends BaseController $data['currency_name'] = SysCurrency::where('id', $data['currency_id'])->first()->currency_name; if (isset($data['fx_receipt_file'])) $data['fx_receipt_file_full'] = (new OssService)->generatePrivateUrl($data['fx_receipt_file']); + + if (isset($data['created_by'])) + $data['created_by'] = User::where('id', $data['created_by'])->value('name')??''; + if (isset($data['updated_by'])) + $data['updated_by'] = User::where('id', $data['updated_by'])->value('name')??''; return $data; } } \ No newline at end of file From d05106f9dfc7cfc323ecc3f686c0d442a8f9de43 Mon Sep 17 00:00:00 2001 From: "WIN-C27C5MSVTPO\\16961" <1696136552@qq.com> Date: Thu, 9 Oct 2025 10:16:21 +0800 Subject: [PATCH 17/21] =?UTF-8?q?=E6=94=B6=E6=AC=BE=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/FinPaymentApplyController.php | 8 +++++--- app/common/controller/FinReceiptController.php | 4 +++- app/common/controller/FinReceiptHisController.php | 15 ++++++++++----- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/app/common/controller/FinPaymentApplyController.php b/app/common/controller/FinPaymentApplyController.php index 7dead81..9129390 100644 --- a/app/common/controller/FinPaymentApplyController.php +++ b/app/common/controller/FinPaymentApplyController.php @@ -81,8 +81,10 @@ class FinPaymentApplyController extends BaseController $data['sales_user_name'] = User::where('id', $data['doc_user_id'])->value('name')??''; if (isset($data['corp_id'])) //公司(渠道) $data['corp_name'] = SysDictItem::where('id', $data['corp_id'])->value('item_label')??''; - if (isset($data['account_id'])) //收款账号 + if (isset($data['account_id'])){ //收款账号 $data['account_name'] = SysAccount::where('id', $data['account_id'])->value('account_name')??''; + $data['account_short_desc'] = SysAccount::where('id', $data['account_id'])->value('short_desc')??''; + } if (isset($data['country_id'])) //付款来源国家 $data['country_name'] = Country::where('id', $data['country_id'])->value('cn_addr')??''; if (isset($data['currency_id'])) //付款币种 @@ -111,8 +113,8 @@ class FinPaymentApplyController extends BaseController $finPaymentStock = FinPaymentStock::where('payment_apply_id', $data['id'])->get(); $stock = []; foreach ($finPaymentStock as $v) { - $stock[$v['pi_no']] = ['pi_no' => $v['pi_no']]; - $stock[$v['pi_no']]['stock_id'] = [$v['stock_id']]; + $stock[$v['pi_no']]['pi_no'] = $v['pi_no']; + $stock[$v['pi_no']]['stock_id'][] = [$v['stock_id']]; } $data['stock'] = array_values($stock); return $data; diff --git a/app/common/controller/FinReceiptController.php b/app/common/controller/FinReceiptController.php index 76b1ed8..74052f7 100644 --- a/app/common/controller/FinReceiptController.php +++ b/app/common/controller/FinReceiptController.php @@ -36,8 +36,10 @@ class FinReceiptController extends BaseController $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']); - if (isset($data['account_id'])) //收款账号 + if (isset($data['account_id'])) { //收款账号 $data['account_name'] = SysAccount::where('id', $data['account_id'])->value('account_name')??''; + $data['account_short_desc'] = SysAccount::where('id', $data['account_id'])->value('short_desc')??''; + } if (isset($data['country_id'])) //付款来源国家 $data['country_name'] = Country::where('id', $data['country_id'])->value('cn_addr')??''; if (isset($data['currency_id'])) //付款币种 diff --git a/app/common/controller/FinReceiptHisController.php b/app/common/controller/FinReceiptHisController.php index e10d859..16e4b3c 100644 --- a/app/common/controller/FinReceiptHisController.php +++ b/app/common/controller/FinReceiptHisController.php @@ -70,14 +70,19 @@ class FinReceiptHisController extends BaseController $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']); - if (isset($data['account_id'])) //收款账号 - $data['account_name'] = SysAccount::where('id', $data['account_id'])->first()->account_name; + if (isset($data['account_id'])){ //收款账号 + $data['account_name'] = SysAccount::where('id', $data['account_id'])->value('account_name')??''; + $data['account_short_desc'] = SysAccount::where('id', $data['account_id'])->value('short_desc')??''; + } if (isset($data['country_id'])) //付款来源国家 - $data['country_name'] = Country::where('id', $data['currency_id'])->first()->cn_addr; + $data['country_name'] = Country::where('id', $data['country_id'])->value('cn_addr')??''; if (isset($data['currency_id'])) //付款币种 - $data['currency_name'] = SysCurrency::where('id', $data['currency_id'])->first()->currency_name; - if (isset($data['fx_receipt_file'])) + $data['currency_name'] = SysCurrency::where('id', $data['currency_id'])->value('currency_name')??''; + if (!empty($data['fx_receipt_file'])){ $data['fx_receipt_file_full'] = (new OssService)->generatePrivateUrl($data['fx_receipt_file']); + }elseif (isset($data['fx_receipt_file'])){ + $data['fx_receipt_file_full'] = ''; + } if (isset($data['created_by'])) $data['created_by'] = User::where('id', $data['created_by'])->value('name')??''; From 73ed4a413c84a81c76b2cacaf8a257f14b90feb6 Mon Sep 17 00:00:00 2001 From: "WIN-C27C5MSVTPO\\16961" <1696136552@qq.com> Date: Thu, 9 Oct 2025 10:24:13 +0800 Subject: [PATCH 18/21] =?UTF-8?q?=E4=BB=98=E6=AC=BE=E8=B4=A6=E5=8F=B7?= =?UTF-8?q?=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/FinPaymentApplyController.php | 4 +++- app/common/controller/FinReceiptController.php | 4 +++- .../controller/FinReceiptHisController.php | 17 +++++++++++------ 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/app/common/controller/FinPaymentApplyController.php b/app/common/controller/FinPaymentApplyController.php index 9129390..e916df4 100644 --- a/app/common/controller/FinPaymentApplyController.php +++ b/app/common/controller/FinPaymentApplyController.php @@ -38,8 +38,10 @@ class FinPaymentApplyController extends BaseController $data['sales_user_name'] = User::where('id', $data['doc_user_id'])->value('name')??''; if (isset($data['corp_id'])) //公司(渠道) $data['corp_name'] = SysDictItem::where('id', $data['corp_id'])->value('item_label')??''; - if (isset($data['account_id'])) //收款账号 + if (isset($data['account_id'])){ //收款账号 $data['account_name'] = SysAccount::where('id', $data['account_id'])->value('account_name')??''; + $data['account_short_desc'] = SysAccount::where('id', $data['account_id'])->value('short_desc')??''; + } if (isset($data['country_id'])) //付款来源国家 $data['country_name'] = Country::where('id', $data['country_id'])->value('cn_addr')??''; if (isset($data['currency_id'])) //付款币种 diff --git a/app/common/controller/FinReceiptController.php b/app/common/controller/FinReceiptController.php index 74052f7..ddddfac 100644 --- a/app/common/controller/FinReceiptController.php +++ b/app/common/controller/FinReceiptController.php @@ -68,8 +68,10 @@ class FinReceiptController extends BaseController $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']); - if (isset($data['account_id'])) //收款账号 + if (isset($data['account_id'])) { //收款账号 $data['account_name'] = SysAccount::where('id', $data['account_id'])->value('account_name')??''; + $data['account_short_desc'] = SysAccount::where('id', $data['account_id'])->value('short_desc')??''; + } if (isset($data['country_id'])) //付款来源国家 $data['country_name'] = Country::where('id', $data['country_id'])->value('cn_addr')??''; if (isset($data['currency_id'])) //付款币种 diff --git a/app/common/controller/FinReceiptHisController.php b/app/common/controller/FinReceiptHisController.php index 16e4b3c..7adcf0d 100644 --- a/app/common/controller/FinReceiptHisController.php +++ b/app/common/controller/FinReceiptHisController.php @@ -38,15 +38,20 @@ class FinReceiptHisController extends BaseController $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']); - if (isset($data['account_id'])) //收款账号 - $data['account_name'] = SysAccount::where('id', $data['account_id'])->first()->account_name; + if (isset($data['account_id'])) { //收款账号 + $data['account_name'] = SysAccount::where('id', $data['account_id'])->value('account_name')??''; + $data['account_short_desc'] = SysAccount::where('id', $data['account_id'])->value('short_desc')??''; + } if (isset($data['country_id'])) //付款来源国家 - $data['country_name'] = Country::where('id', $data['currency_id'])->first()->cn_addr; + $data['country_name'] = Country::where('id', $data['country_id'])->value('cn_addr')??''; if (isset($data['currency_id'])) //付款币种 - $data['currency_name'] = SysCurrency::where('id', $data['currency_id'])->first()->currency_name; - if (isset($data['fx_receipt_file'])) + $data['currency_name'] = SysCurrency::where('id', $data['currency_id'])->value('currency_name')??''; + if (!empty($data['fx_receipt_file'])){ $data['fx_receipt_file_full'] = (new OssService)->generatePrivateUrl($data['fx_receipt_file']); - + }elseif (isset($data['fx_receipt_file'])){ + $data['fx_receipt_file_full'] = ''; + } + if (isset($data['created_by'])) $data['created_by'] = User::where('id', $data['created_by'])->value('name')??''; if (isset($data['updated_by'])) From 6644cc1c58e01c3f8fb60cd4fe5eeb8832b7c4a6 Mon Sep 17 00:00:00 2001 From: "WIN-C27C5MSVTPO\\16961" <1696136552@qq.com> Date: Thu, 23 Oct 2025 11:27:24 +0800 Subject: [PATCH 19/21] =?UTF-8?q?=E6=94=B6=E6=AC=BE=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/controller/FinPaymentApplyController.php | 2 +- app/common/controller/FinReceiptController.php | 10 ++++++++++ app/common/service/FinReceiptService.php | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/app/common/controller/FinPaymentApplyController.php b/app/common/controller/FinPaymentApplyController.php index e916df4..57c4b75 100644 --- a/app/common/controller/FinPaymentApplyController.php +++ b/app/common/controller/FinPaymentApplyController.php @@ -75,7 +75,7 @@ class FinPaymentApplyController extends BaseController * @param array $data * @return array */ - protected function showFormat($data) + public function showFormat($data) { if (isset($data['doc_user_id'])) //内勤 $data['doc_user_name'] = User::where('id', $data['doc_user_id'])->value('name')??''; diff --git a/app/common/controller/FinReceiptController.php b/app/common/controller/FinReceiptController.php index ddddfac..c558d44 100644 --- a/app/common/controller/FinReceiptController.php +++ b/app/common/controller/FinReceiptController.php @@ -3,8 +3,12 @@ namespace app\common\controller; use app\common\controller\BaseController; use app\common\model\Country; +use app\common\model\FinPaymentApply; +use app\common\model\FinPaymentStock; use app\common\model\SysAccount; use app\common\model\SysCurrency; +use app\common\model\SysDictItem; +use app\common\model\User; use app\common\service\OssService; use app\common\traits\crud\CrudControllerTrait; use app\common\service\FinReceiptService; @@ -81,6 +85,12 @@ class FinReceiptController extends BaseController } elseif (isset($data['fx_receipt_file'])) { $data['fx_receipt_file_full'] = ''; } + + if (!empty($data['payment_apply_id'])) { + $paymentApply = FinPaymentApply::where('id', $data['payment_apply_id'])->first()->toArray(); + $paymentApply = (new FinPaymentApplyController())->showFormat($paymentApply); + $data['payment_apply'] = $paymentApply; + } return $data; } } \ No newline at end of file diff --git a/app/common/service/FinReceiptService.php b/app/common/service/FinReceiptService.php index 2f77af5..155aecd 100644 --- a/app/common/service/FinReceiptService.php +++ b/app/common/service/FinReceiptService.php @@ -70,7 +70,7 @@ class FinReceiptService } // 关键字 - if (isset($p['$query']) && $p['keyword']) { + if (isset($p['keyword']) && $p['keyword']) { $k = '%' . $p['keyword'] . '%'; $config['orWhere'][] = ['remitter', 'like', $k]; } From 0f505d5c567d1a70ec0a73126be73044e3921b3d Mon Sep 17 00:00:00 2001 From: "WIN-C27C5MSVTPO\\16961" <1696136552@qq.com> Date: Thu, 23 Oct 2025 16:25:02 +0800 Subject: [PATCH 20/21] =?UTF-8?q?=E6=94=B6=E6=AC=BE=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=E8=81=94=E6=9F=A5=E4=BB=98=E6=AC=BE=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/controller/FinReceiptController.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/common/controller/FinReceiptController.php b/app/common/controller/FinReceiptController.php index c558d44..ebfd956 100644 --- a/app/common/controller/FinReceiptController.php +++ b/app/common/controller/FinReceiptController.php @@ -87,7 +87,10 @@ class FinReceiptController extends BaseController } if (!empty($data['payment_apply_id'])) { - $paymentApply = FinPaymentApply::where('id', $data['payment_apply_id'])->first()->toArray(); + $paymentApply = FinPaymentApply::where('id', $data['payment_apply_id'])->first(); + if(!$paymentApply) + return $data; + $paymentApply = $paymentApply->toArray(); $paymentApply = (new FinPaymentApplyController())->showFormat($paymentApply); $data['payment_apply'] = $paymentApply; } From 7036e3b849803d8d2100836a77b5f3f6f55bfa9c Mon Sep 17 00:00:00 2001 From: "WIN-C27C5MSVTPO\\16961" <1696136552@qq.com> Date: Thu, 23 Oct 2025 17:09:40 +0800 Subject: [PATCH 21/21] =?UTF-8?q?=E6=8E=92=E5=BA=8F=E8=A7=84=E5=88=99?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/controller/FinReceiptController.php | 16 +++++++++++++++- app/common/service/FinPaymentApplyService.php | 6 ++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/app/common/controller/FinReceiptController.php b/app/common/controller/FinReceiptController.php index ebfd956..56d7bfb 100644 --- a/app/common/controller/FinReceiptController.php +++ b/app/common/controller/FinReceiptController.php @@ -12,6 +12,7 @@ use app\common\model\User; use app\common\service\OssService; use app\common\traits\crud\CrudControllerTrait; use app\common\service\FinReceiptService; +use support\Request; class FinReceiptController extends BaseController { @@ -23,7 +24,18 @@ class FinReceiptController extends BaseController { $this->service = new FinReceiptService(); } - + public function show(Request $request) + { + try { + $raw = $this->service->serviceShow($request); + $data = $this->transformData($raw, method_exists($this, 'showFormat') + ? [$this, 'showFormat'] + : null); + return $this->success($data); + } catch (\Throwable $e) { + return $this->error($e->getMessage()); + } + } /** * 列表页数据格式化 * @@ -91,6 +103,8 @@ class FinReceiptController extends BaseController if(!$paymentApply) return $data; $paymentApply = $paymentApply->toArray(); + $paymentApply['created_at'] = strtotime($paymentApply['created_at']); + $paymentApply['updated_at'] = strtotime($paymentApply['updated_at']); $paymentApply = (new FinPaymentApplyController())->showFormat($paymentApply); $data['payment_apply'] = $paymentApply; } diff --git a/app/common/service/FinPaymentApplyService.php b/app/common/service/FinPaymentApplyService.php index 294bc01..f451ce4 100644 --- a/app/common/service/FinPaymentApplyService.php +++ b/app/common/service/FinPaymentApplyService.php @@ -217,14 +217,16 @@ class FinPaymentApplyService $orderByClause = "CASE WHEN created_at >= {$sevenDaysAgo} THEN (" . implode(' + ', $similarityOrder) . ") - ELSE 999999 + ELSE 0 END ASC, "; } $orderByClause .= "CASE WHEN created_at < {$sevenDaysAgo} THEN id - ELSE 0 + ELSE 999999 END DESC"; + + $orderByClause .= ", id DESC"; $query->orderByRaw($orderByClause);