入账资料附件格式处理
This commit is contained in:
@@ -47,7 +47,7 @@ class FinPaymentApplyController extends BaseController
|
|||||||
if (isset($data['currency_id'])) //付款币种
|
if (isset($data['currency_id'])) //付款币种
|
||||||
$data['currency_name'] = SysCurrency::where('id', $data['currency_id'])->value('currency_name')??'';
|
$data['currency_name'] = SysCurrency::where('id', $data['currency_id'])->value('currency_name')??'';
|
||||||
$OssService = new OssService();
|
$OssService = new OssService();
|
||||||
if (isset($data['submit_files'])){
|
if (!empty($data['submit_files'])){
|
||||||
$data['submit_files'] = json_decode($data['submit_files'], true);
|
$data['submit_files'] = json_decode($data['submit_files'], true);
|
||||||
foreach ($data['submit_files'] as $key => $value) {
|
foreach ($data['submit_files'] as $key => $value) {
|
||||||
$data['submit_files'][$key] = [
|
$data['submit_files'][$key] = [
|
||||||
@@ -56,6 +56,8 @@ class FinPaymentApplyController extends BaseController
|
|||||||
'file_name' => $value['file_name'],
|
'file_name' => $value['file_name'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
$data['submit_files'] = [];
|
||||||
}
|
}
|
||||||
if (!empty($data['voucher_file'])) {
|
if (!empty($data['voucher_file'])) {
|
||||||
$data['voucher_file_full'] = $OssService->generatePrivateUrl($data['voucher_file']);
|
$data['voucher_file_full'] = $OssService->generatePrivateUrl($data['voucher_file']);
|
||||||
@@ -106,7 +108,7 @@ class FinPaymentApplyController extends BaseController
|
|||||||
if (isset($data['currency_id'])) //付款币种
|
if (isset($data['currency_id'])) //付款币种
|
||||||
$data['currency_name'] = SysCurrency::where('id', $data['currency_id'])->value('currency_name')??'';
|
$data['currency_name'] = SysCurrency::where('id', $data['currency_id'])->value('currency_name')??'';
|
||||||
$OssService = new OssService();
|
$OssService = new OssService();
|
||||||
if (isset($data['submit_files'])){
|
if (!empty($data['submit_files'])){
|
||||||
$data['submit_files'] = json_decode($data['submit_files'], true);
|
$data['submit_files'] = json_decode($data['submit_files'], true);
|
||||||
foreach ($data['submit_files'] as $key => $value) {
|
foreach ($data['submit_files'] as $key => $value) {
|
||||||
$data['submit_files'][$key] = [
|
$data['submit_files'][$key] = [
|
||||||
@@ -115,7 +117,10 @@ class FinPaymentApplyController extends BaseController
|
|||||||
'file_name' => $value['file_name'],
|
'file_name' => $value['file_name'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
$data['submit_files'] = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($data['voucher_file'])) {
|
if (!empty($data['voucher_file'])) {
|
||||||
$data['voucher_file_full'] = $OssService->generatePrivateUrl($data['voucher_file']);
|
$data['voucher_file_full'] = $OssService->generatePrivateUrl($data['voucher_file']);
|
||||||
} elseif (isset($data['voucher_file'])) {
|
} elseif (isset($data['voucher_file'])) {
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ class FinReceiptHis extends Model
|
|||||||
/**
|
/**
|
||||||
* 允许自动填充模型字段
|
* 允许自动填充模型字段
|
||||||
*/
|
*/
|
||||||
protected $fillable = ['id', 'receipt_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_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', 'claimed_by', 'created_at', 'updated_at'];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 不允许自动填充模型字段
|
* 不允许自动填充模型字段
|
||||||
|
|||||||
@@ -90,6 +90,8 @@ class FinPaymentApplyService
|
|||||||
$data['submit_files'] = json_encode($data['submit_files']);
|
$data['submit_files'] = json_encode($data['submit_files']);
|
||||||
redis::set('stock_' . $data['doc_user_id'], json_encode($request->post('stock')), 'EX', 30);
|
redis::set('stock_' . $data['doc_user_id'], json_encode($request->post('stock')), 'EX', 30);
|
||||||
unset($data['stock']);
|
unset($data['stock']);
|
||||||
|
if($data['submit_files'] == '[]' || $data['submit_files'] == '{}' )
|
||||||
|
$data['submit_files'] = '';
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -113,6 +115,8 @@ class FinPaymentApplyService
|
|||||||
public function beforeServiceUpdate($data, Request $request)
|
public function beforeServiceUpdate($data, Request $request)
|
||||||
{
|
{
|
||||||
$data['submit_files'] = json_encode($data['submit_files']);
|
$data['submit_files'] = json_encode($data['submit_files']);
|
||||||
|
if($data['submit_files'] == '[]' || $data['submit_files'] == '{}' )
|
||||||
|
$data['submit_files'] = '';
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -174,10 +178,9 @@ class FinPaymentApplyService
|
|||||||
|
|
||||||
// 入账资料超时
|
// 入账资料超时
|
||||||
if (isset($param['scene']) && $param['scene'] == 'file_timeout') {
|
if (isset($param['scene']) && $param['scene'] == 'file_timeout') {
|
||||||
|
$where[] = ['submit_files', ''];
|
||||||
$where[] = ['claimed_at', '<', time()-24*60*60];
|
$where[] = ['claimed_at', '<', time()-24*60*60];
|
||||||
$where[] = ['claimed_at', '>', 1];
|
$where[] = ['claimed_at', '>', 1];
|
||||||
$orWhere[] = ['submit_files', '[]'];
|
|
||||||
$orWhere[] = ['submit_files', ''];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 关键字
|
// 关键字
|
||||||
@@ -187,9 +190,7 @@ class FinPaymentApplyService
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 构建查询
|
// 构建查询
|
||||||
$query = $this->modelClass::where($where)->where(function($query) use ($orWhere) {
|
$query = $this->modelClass::where($where);
|
||||||
$query->orWhere($orWhere);
|
|
||||||
});
|
|
||||||
|
|
||||||
// 是否已关联收款记录的筛选
|
// 是否已关联收款记录的筛选
|
||||||
$correlation = $param['correlation']??'';
|
$correlation = $param['correlation']??'';
|
||||||
|
|||||||
@@ -46,18 +46,13 @@ class Task
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Log::info('fin_payment_apply submit_files start', [time()]);
|
Log::info('fin_payment_apply submit_files start', [time()]);
|
||||||
$orWhere = [
|
|
||||||
['submit_files', '=', '[]'],
|
|
||||||
['submit_files', '=', ''],
|
|
||||||
];
|
|
||||||
$where = [
|
$where = [
|
||||||
|
['submit_files', '=', ''],
|
||||||
['warn', '<', 2],
|
['warn', '<', 2],
|
||||||
['created_at', '>', time() - 60 * 60 * 48],
|
['created_at', '>', time() - 60 * 60 * 48],
|
||||||
['created_at', '<', time() - 60 * 60 * 24],
|
['created_at', '<', time() - 60 * 60 * 24],
|
||||||
];
|
];
|
||||||
$payment = FinPaymentApply::where($where)->where(function($query) use ($orWhere) {
|
$payment = FinPaymentApply::where($where)->orderBy('id', 'desc')->get();
|
||||||
$query->orWhere($orWhere);
|
|
||||||
})->orderBy('id', 'desc')->get();
|
|
||||||
foreach ($payment as $item) {
|
foreach ($payment as $item) {
|
||||||
Log::info('fin_payment_apply submit_files ', [$item->toArray()]);
|
Log::info('fin_payment_apply submit_files ', [$item->toArray()]);
|
||||||
$notice = [
|
$notice = [
|
||||||
|
|||||||
Reference in New Issue
Block a user