From 4346cc5d4b082edfbbd661a1b8cf548607319212 Mon Sep 17 00:00:00 2001 From: wanghongjun <1445693971@qq,com> Date: Thu, 23 Jan 2025 14:36:04 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=B4=E6=97=B6=E8=8E=B7=E5=8F=96=E7=BB=93?= =?UTF-8?q?=E6=8A=A5=E9=80=BB=E8=BE=91=E6=94=B9=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/api/Test.php | 18 ++++++++++++++++++ app/service/invoice/TempInvoiceService.php | 20 ++++++++++++++++++++ route/apiRoute.php | 1 + 3 files changed, 39 insertions(+) diff --git a/app/controller/api/Test.php b/app/controller/api/Test.php index 04e700e..beee3cb 100644 --- a/app/controller/api/Test.php +++ b/app/controller/api/Test.php @@ -72,4 +72,22 @@ class Test extends Base return $this->buildFailed(0, $e->getMessage()); } } + + public function apiFinalReport() + { + try { + $param = $this->request->param(); + validate()->rule([ + 'report_date|结报日期' => 'require|date', + 'zje|float' => 'require', + ])->check($param); + $data = (new \app\service\invoice\TempInvoiceService())->tempFinalReport($param['report_date'], $param['zje']); + if (!is_array($data)) { + throw new \Exception($data); + } + return $this->buildSuccess($data); + } catch (\Exception $e) { + return $this->buildFailed(0, $e->getMessage()); + } + } } diff --git a/app/service/invoice/TempInvoiceService.php b/app/service/invoice/TempInvoiceService.php index 76589ec..0e3fadc 100644 --- a/app/service/invoice/TempInvoiceService.php +++ b/app/service/invoice/TempInvoiceService.php @@ -178,4 +178,24 @@ class TempInvoiceService } } + + public function tempFinalReport($report_date, $zje) + { + try { + $InvoiceIssuanceService = new InvoiceIssuanceService(); + $invoiceDate = $InvoiceIssuanceService->getInvoiceDate(strtotime($report_date)); + $ChinaTaxes = new ChinaTaxes([], $invoiceDate); + $result = $ChinaTaxes->daiZhengSummaryReport($zje); + if ($result) { + if ($result['code'] == 200 && $result['message'] == '结报完成') { + return true; + } else { + throw new FuncException($result['message'] ?? '结报失败'); + } + } + return true; + } catch (\Exception $e) { + return $e->getMessage(); + } + } } diff --git a/route/apiRoute.php b/route/apiRoute.php index b1f32f8..fac5538 100644 --- a/route/apiRoute.php +++ b/route/apiRoute.php @@ -20,6 +20,7 @@ Route::group('api', function() { Route::rule('Test1/index', 'api.Test1/index', 'get'); Route::rule('Test/index', 'api.Test/apiInvoiceIssuance', 'post'); Route::rule('Test/saveSummaryReport', 'api.Test/saveSummaryReport', 'post'); + Route::rule('Test/apiFinalReport', 'api.Test/apiFinalReport', 'post'); Route::rule('InvoiceIssuance/downFile', 'api.InvoiceIssuance/downFile', 'get'); //MISS路由定义 //Route::miss('api.Miss/index');