|
|
|
@ -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 |
|
|
|
|