Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
openApi
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hj
openApi
Commits
ef773c4c
Commit
ef773c4c
authored
Feb 24, 2023
by
hangjun83
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
财务开票模块更新
parent
09fb88ac
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
82 additions
and
8 deletions
+82
-8
server/app/Finance/Repositories/Eloquent/RhawnInvoiceRepositoryEloquent.php
.../Repositories/Eloquent/RhawnInvoiceRepositoryEloquent.php
+5
-0
server/app/Finance/Services/InvoiceService.php
server/app/Finance/Services/InvoiceService.php
+77
-8
No files found.
server/app/Finance/Repositories/Eloquent/RhawnInvoiceRepositoryEloquent.php
View file @
ef773c4c
...
...
@@ -31,4 +31,9 @@ class RhawnInvoiceRepositoryEloquent extends BaseRepository implements RhawnInvo
}
return
null
;
}
public
function
updateInvoiceById
(
$id
,
$updateParams
)
{
return
$this
->
updateOrCreate
([
'id'
=>
$id
],
$updateParams
)
->
toArray
();
}
}
server/app/Finance/Services/InvoiceService.php
View file @
ef773c4c
...
...
@@ -179,7 +179,7 @@ class InvoiceService
$applyInvoiceParams
[
'zpFppzdm'
]
=
$invoiceParams
[
'invoice_category'
]
==
2
?
'1130'
:
'04'
;
$applyInvoiceParams
[
'jshj'
]
=
bcmul
(
$invoiceParams
[
'invoice_money'
],
1
,
2
);
$applyInvoiceParams
[
'hjje'
]
=
bcdiv
(
$applyInvoiceParams
[
'jshj'
],
1.13
,
2
);
$applyInvoiceParams
[
'hjse'
]
=
bcmul
(
$applyInvoiceParams
[
'hjje'
],
bcdiv
(
$platformInfo
[
'tax_rate'
],
100
,
3
),
2
);
$applyInvoiceParams
[
'hjse'
]
=
bc
sub
(
$applyInvoiceParams
[
'jshj'
],
$applyInvoiceParams
[
'hjje'
],
2
);
//bc
mul($applyInvoiceParams['hjje'],bcdiv($platformInfo['tax_rate'],100,3),2);
//初始化非必填项
$applyInvoiceParams
[
'bz'
]
=
''
;
...
...
@@ -385,21 +385,90 @@ class InvoiceService
public
function
apiCallBack
(
$params
)
{
if
(
isset
(
$params
)
&&
!
empty
(
$params
)){
$queueParams
=
[];
//现将返回的数据进行存储
//$this->apiService->storePlatformDataEntries('invoice_callBack_',$params);
switch
(
$params
[
'ywlxdm'
]){
case
'fpkj'
:
$this
->
apiService
->
storePlatformDataEntries
(
'invoice_callBack_'
.
$params
[
'ddlsh'
]
.
'_applyInvoice'
,
$params
);
break
;
case
'fpkj'
:
$this
->
apiService
->
storePlatformDataEntries
(
'invoice_callBack_'
.
$params
[
'ddlsh'
]
.
'_applyInvoice'
,
$params
);
$queueParams
=
[
'params'
=>
$params
,
'type'
=>
'applyInvoiceCallBack'
];
break
;
}
//塞入队列
/*
$this->apiService->pushQueue([
'params' =>
['invoice_number' => $params['ddlsh'],'type' => 'applyInvoice']
,
$this
->
apiService
->
pushQueue
([
'params'
=>
$queueParams
,
'consumer'
=>
__CLASS__
,
'method' => 'applyInvoiceCallBack'
],'invoiceCallBack');*/
'method'
=>
'invoiceApiCallBack'
],
'invoiceCallBack'
);
}
}
public
function
invoiceApiCallBack
(
$params
)
{
if
(
empty
(
$params
)){
return
false
;
}
//记录日志
SimpleLogs
::
writeLog
(
$params
,
__CLASS__
.
':'
.
__FUNCTION__
.
' callback params => '
);
//根据type回调相应方法处理逻辑
if
(
$params
[
'type'
]
&&
method_exists
(
__CLASS__
,
$params
[
'type'
])){
app
(
__CLASS__
)
->
$params
[
'type'
](
$params
[
'params'
]);
}
}
public
function
applyInvoiceCallBack
(
$callBackParams
)
{
if
(
empty
(
$callBackParams
)){
return
false
;
}
//根据发票流水找到相应数据
if
(
isset
(
$callBackParams
[
'ddlsh'
])
&&
!
empty
(
$callBackParams
[
'ddlsh'
])){
$invoiceInfo
=
$this
->
invoiceRecordRepository
->
getInvoiceRecordByNumber
(
$callBackParams
[
'ddlsh'
]);
if
(
!
$invoiceInfo
){
SimpleLogs
::
writeLog
(
$callBackParams
,
__CLASS__
.
':'
.
__FUNCTION__
.
' 无法找到发票流水号:'
.
$callBackParams
[
'ddlsh'
]
.
'的数据'
,
'error'
);
return
false
;
}
//更新对应的发票数据,并反写回相应的平台发票
try
{
$updateInvoice
=
[];
if
(
$callBackParams
[
'status'
]
==
1
){
$updateInvoice
[
'inovice_number'
]
=
$callBackParams
[
'ddlsh'
];
$updateInvoice
[
'invoice_status'
]
=
1
;
$updateInvoice
[
'invoice_real_number'
]
=
$callBackParams
[
'fphm'
];
$updateInvoice
[
'invoice_real_date'
]
=
$callBackParams
[
'kprq'
];
$updateInvoice
[
'invoice_pdf_url'
]
=
$callBackParams
[
'pdf'
];
$updatedInvoiceResult
=
$this
->
invoiceRecordRepository
->
saveInvoice
(
$updateInvoice
);
if
(
$updatedInvoiceResult
){
//对平台的发票信息进行更新
$updateResult
=
null
;
switch
(
$updatedInvoiceResult
[
'invoice_platform'
]){
case
'rhawn'
:
$updateResult
=
$this
->
rhawnInvoiceRepository
->
updateInvoiceById
(
$updatedInvoiceResult
[
'platform_invoice_id'
],
[
'soi_api_status'
=>
1
,
'soi_no'
=>
$callBackParams
[
'fphm'
],
'soi_date'
=>
strtotime
(
$callBackParams
[
'kprq'
]),
//'soi_total' => bcmul($callBackParams['jshj'],1,2),
'soi_tax'
=>
bcmul
(
$callBackParams
[
'hjse'
],
1
,
2
),
'soi_amount'
=>
bcmul
(
$callBackParams
[
'hjje'
],
1
,
2
)
]
);
}
if
(
$updateResult
){
//发送邮件
}
}
}
}
catch
(
\Throwable
$exception
){
SimpleLogs
::
writeLog
(
$exception
->
getMessage
(),
__CLASS__
.
':'
.
__FUNCTION__
,
'error'
);
}
}
}
public
function
applyInvoiceCallBack
()
public
function
getInvoicePdfDownloadUrl
()
{
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment