Browse Source

汇总结报脚本

master
wanghongjun 11 months ago
parent
commit
e336d560b4
  1. 40
      app/controller/task/InvoiceIssuanceTask.php
  2. 4
      app/service/invoice/InvoiceIssuanceService.php
  3. 1
      route/taskRoute.php

40
app/controller/task/InvoiceIssuanceTask.php

@ -6,23 +6,24 @@ use app\model\InvoiceIssuance as InvoiceIssuanceModel;
use app\service\invoice\InvoiceIssuanceService;
use app\service\user\EmailService;
use app\service\user\SmsService;
use think\facade\Request;
use think\Response;
class InvoiceIssuanceTask extends Base
{
protected $limit = 100;
/**
* 申请开票任务
* @return \think\Response
* @return Response
* @throws \fast\FuncException
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function runIssueAnInvoice()
public function runIssueAnInvoice(): Response
{
$limit = 100;
$where = ['status' => 0, 'delete_time' => 0];
$InvoiceIssuanceData = (new InvoiceIssuanceModel())->where($where)->page(1, $limit)->select();
$InvoiceIssuanceData = (new InvoiceIssuanceModel())->where($where)->page(1, $this->limit)->select();
foreach ($InvoiceIssuanceData as $InvoiceIssuanceValue) {
$result = (new InvoiceIssuanceService())->IssueAnInvoice($InvoiceIssuanceValue);
if ($result === true) {
@ -35,16 +36,16 @@ class InvoiceIssuanceTask extends Base
/**
* 开票失败 修改为虚拟 继续发起
* @return \think\Response
* @return Response
* @throws \fast\FuncException
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function runCancelInitiateAgain()
public function runCancelInitiateAgain(): Response
{
$limit = 100;
$where = ['status' => 1, 'delete_time' => 0];
$InvoiceIssuanceData = (new InvoiceIssuanceModel())->where($where)->page(1, $limit)->select();
$InvoiceIssuanceData = (new InvoiceIssuanceModel())->where($where)->page(1, $this->limit)->select();
foreach ($InvoiceIssuanceData as $InvoiceIssuanceValue) {
$result = (new InvoiceIssuanceService())->cancelInitiateAgain($InvoiceIssuanceValue);
if ($result === true) {
@ -54,6 +55,27 @@ class InvoiceIssuanceTask extends Base
return $this->buildSuccess();
}
/**
*
* @return Response
* @throws \fast\FuncException
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function runSummaryReport(): Response
{
$where = ['status' => 3, 'delete_time' => 0];
$InvoiceIssuanceData = (new InvoiceIssuanceModel())->where($where)->page(1, $this->limit)->select();
foreach ($InvoiceIssuanceData as $InvoiceIssuanceValue) {
$result = (new InvoiceIssuanceService())->summaryReport($InvoiceIssuanceValue);
if ($result === true) {
$this->invoiceSuccess($InvoiceIssuanceValue);
}
}
return $this->buildSuccess();
}
/**
* 开票成功 发送邮箱及短信提示
* @param $InvoiceIssuanceValue

4
app/service/invoice/InvoiceIssuanceService.php

@ -406,9 +406,10 @@ class InvoiceIssuanceService
/**
* 汇总结报 (汇总、结报)
* @param $invoiceIssuance
* @return bool
* @throws FuncException
*/
public function SummaryReport($invoiceIssuance)
public function summaryReport($invoiceIssuance)
{
if (empty($invoiceIssuance['expire_time'])) {
@ -425,6 +426,7 @@ class InvoiceIssuanceService
$ChinaTaxes->daiZhengSummaryReport($ydzse);
return true;
}
public function writeLog($e)

1
route/taskRoute.php

@ -8,4 +8,5 @@ use think\facade\Route;
Route::group('task', function() {
Route::rule('InvoiceIssuanceTask/runIssueAnInvoice', 'task.InvoiceIssuanceTask/runIssueAnInvoice', 'get');
Route::rule('InvoiceIssuanceTask/runCancelInitiateAgain', 'task.InvoiceIssuanceTask/runCancelInitiateAgain', 'get');
Route::rule('InvoiceIssuanceTask/runSummaryReport', 'task.InvoiceIssuanceTask/runSummaryReport', 'get');
});//->middleware(app\middleware\ApiResponse::class)

Loading…
Cancel
Save