Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Z
zhichan
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
蒋勇
zhichan
Commits
8d4b6562
Commit
8d4b6562
authored
Apr 13, 2020
by
王昆
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dd
parent
947f848b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
82 additions
and
10 deletions
+82
-10
xgg-saas-platform/app/base/controller/impl/saas/invoiceCtl.js
+23
-4
xgg-saas-platform/app/base/service/impl/saas/saasinvoiceSve.js
+57
-6
xgg-saas-platform/app/config/settings.js
+2
-0
No files found.
xgg-saas-platform/app/base/controller/impl/saas/invoiceCtl.js
View file @
8d4b6562
...
...
@@ -134,11 +134,30 @@ class InvoiceCtl extends CtlBase {
}
// TODO 总统计算 begin
let
notifyApi
=
settings
.
outApi
().
deliverNotifyApi
;
let
data
=
{
"credit_code"
:
creditCode
,
"invoiced_time"
:
moment
(
pobj
.
invoiced_time
).
format
(
"YYYY-MM-DD hh:mm:ss"
),
"invoice_type"
:
pobj
.
invoice_type
,
"invoice_amount"
:
pobj
.
invoice_amount
};
// 推送订单到交付平台
let
url
=
settings
.
deliverSysApi
().
calcInvoice
;
let
res
=
await
axios
({
method
:
'post'
,
url
:
url
,
data
:
data
});
if
(
!
res
||
!
res
.
data
||
res
.
status
!=
0
){
return
system
.
getResult
(
null
,
`试算错误`
);
}
let
data
=
res
.
data
;
let
invoiceCalc
=
{
"personal_invoice_tax"
:
3000
,
"additional_tax"
:
5000
,
"service_tax"
:
5000
,
"value_added_tax"
:
700
,
"personal_invoice_tax"
:
data
.
personal_invoice_tax
,
"additional_tax"
:
data
.
additional_tax
,
"service_tax"
:
data
.
service_tax
,
"value_added_tax"
:
data
.
value_added_tax
,
}
// TODO 总统计算 end
...
...
xgg-saas-platform/app/base/service/impl/saas/saasinvoiceSve.js
View file @
8d4b6562
...
...
@@ -5,9 +5,11 @@ const settings = require("../../../../config/settings")
class
SaasinvoiceService
extends
ServiceBase
{
constructor
()
{
super
();
this
.
DEFAULT_BUSINESSMEN_TYPE
=
"10"
;
//默认的 销售方类型 个体工商户
this
.
DEFAULT_CHANNEL_ID
=
"2"
;
//默认的 渠道类型
}
async
platforminvoicePage
(
params
){
async
platforminvoicePage
(
params
)
{
let
rs
=
await
this
.
callms
(
"invoice"
,
"platforminvoicePage"
,
params
);
if
(
rs
&&
rs
.
data
&&
rs
.
data
.
rows
)
{
this
.
transOrderField
(
rs
.
data
.
rows
);
...
...
@@ -16,7 +18,7 @@ class SaasinvoiceService extends ServiceBase {
}
async
platforminvoiceapplyPage
(
params
){
async
platforminvoiceapplyPage
(
params
)
{
let
rs
=
await
this
.
callms
(
"invoice"
,
"platforminvoiceapplyPage"
,
params
);
if
(
rs
&&
rs
.
data
&&
rs
.
data
.
rows
)
{
this
.
transOrderField
(
rs
.
data
.
rows
);
...
...
@@ -39,7 +41,7 @@ class SaasinvoiceService extends ServiceBase {
return
rs
;
}
async
applyBulkSave
(
params
){
async
applyBulkSave
(
params
)
{
let
rs
=
await
this
.
callms
(
"invoice"
,
"invoiceapplyBulkSave"
,
params
);
return
rs
;
}
...
...
@@ -59,7 +61,7 @@ class SaasinvoiceService extends ServiceBase {
return
rs
;
}
async
platformHandle
(
params
){
async
platformHandle
(
params
)
{
let
apply
=
await
this
.
invoiceapplyById
(
params
);
apply
=
apply
.
data
;
if
(
!
apply
)
{
...
...
@@ -69,7 +71,7 @@ class SaasinvoiceService extends ServiceBase {
return
system
.
getResult
(
null
,
"发票状态错误,请刷新重试"
);
}
// TODO 总统 推送发票信息 begin
await
this
.
pushInvoiceToDeliver
(
apply
);
// TODO 总统 推送发票信息 end
let
updateStatus
=
{
...
...
@@ -85,9 +87,57 @@ class SaasinvoiceService extends ServiceBase {
* fn:发票推送
* @param {*} params
*/
async
saveSaasInvoice
(
params
){
async
saveSaasInvoice
(
params
)
{
var
rs
=
await
this
.
callms
(
"invoice"
,
"saveSaasInvoice"
,
params
);
return
rs
;
}
/**
* fn:发票申请推送到交付系统
* @param {*} invoice 发票实体对象
*
* 1. 开票方类型 不存在 (目前默认是个体工商户)
* 2. 开票内容 不存在
* 3. 核对channel ID 是不是SAAS_ID
* 4. 申请时间 不存在
*/
async
pushInvoiceToDeliver
(
invoice
)
{
try
{
let
params
=
{
"businessmen_type"
:
this
.
DEFAULT_BUSINESSMEN_TYPE
,
"from_id"
:
invoice
.
from_id
||
""
,
"from_credit_code"
:
invoice
.
from_credit_code
,
"from_name"
:
invoice
.
from_name
,
"from_addr"
:
invoice
.
from_addr
,
"from_mobile"
:
invoice
.
from_mobile
,
"from_bank"
:
invoice
.
from_bank
||
""
,
"from_account"
:
invoice
.
from_account
||
""
,
"mail_to"
:
invoice
.
mail_to
,
"mail_mobile"
:
invoice
.
mail_mobile
,
"mail_addr"
:
invoice
.
mail_addr
,
"to_id"
:
invoice
.
to_id
||
""
,
"to_name"
:
invoice
.
to_name
,
"to_credit_code"
:
invoice
.
to_credit_code
,
"to_addr"
:
invoice
.
to_addr
,
"to_mobile"
:
invoice
.
to_mobile
,
"to_bank"
:
invoice
.
to_bank
,
"to_account"
:
invoice
.
to_account
,
"apply_no"
:
invoice
.
id
,
"invoice_type"
:
invoice
.
invoice_type
,
"apply_time"
:
invoice
.
apply_time
,
"invoice_amount"
:
invoice
.
invoice_amount
,
"invoice_content"
:
invoice_content
||
""
,
"personal_invoice_tax"
:
invoice
.
personal_invoice_tax
,
"additional_tax"
:
invoice
.
additional_tax
,
"value_added_tax"
:
invoice
.
value_added_tax
,
"channel_id"
:
this
.
DEFAULT_CHANNEL_ID
}
let
rs
=
await
this
.
callms
(
"invoice"
,
"invoiceApply"
,
params
);
return
rs
;
}
catch
(
error
)
{
console
.
log
(
error
);
return
system
.
getResult
(
null
,
`系统错误`
);
}
}
}
module
.
exports
=
SaasinvoiceService
;
\ No newline at end of file
xgg-saas-platform/app/config/settings.js
View file @
8d4b6562
...
...
@@ -97,6 +97,8 @@ var settings = {
return
{
// 推送订单s
orderPushApi
:
domain
+
"/web/order/orderCtl/addSourceOrder"
,
//发票是试算
calcInvoice
:
domain
+
"/web/invoice/invoiceCtl/calcInvoice"
}
},
paasUrl
:
function
()
{
...
...
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