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
9b11d645
Commit
9b11d645
authored
Apr 12, 2020
by
王昆
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gsb
parent
6b041fca
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
192 additions
and
13 deletions
+192
-13
xgg-saas-platform/app/base/controller/impl/saas/invoiceCtl.js
+172
-11
xgg-saas-platform/app/base/service/impl/saas/orderSve.js
+1
-1
xgg-saas-platform/app/base/service/impl/saas/saasinvoiceSve.js
+5
-0
xgg-saas-platform/app/base/service/impl/trade/tradeSve.js
+8
-0
xgg-saas-platform/app/base/system.js
+1
-1
xgg-saas-platform/app/front/entry/public/apidoc/saas/invoice.md
+5
-0
No files found.
xgg-saas-platform/app/base/controller/impl/saas/invoiceCtl.js
View file @
9b11d645
...
@@ -6,7 +6,9 @@ class InvoiceCtl extends CtlBase {
...
@@ -6,7 +6,9 @@ class InvoiceCtl extends CtlBase {
constructor
()
{
constructor
()
{
super
();
super
();
this
.
saasinvoiceSve
=
system
.
getObject
(
"service.saas.saasinvoiceSve"
);
this
.
saasinvoiceSve
=
system
.
getObject
(
"service.saas.saasinvoiceSve"
);
this
.
orderSve
=
system
.
getObject
(
"service.saas.orderSve"
);
this
.
tradeSve
=
system
.
getObject
(
"service.trade.tradeSve"
);
this
.
tradeSve
=
system
.
getObject
(
"service.trade.tradeSve"
);
this
.
redisClient
=
system
.
getObject
(
"util.redisClient"
);
}
}
// 审核
// 审核
...
@@ -49,17 +51,25 @@ class InvoiceCtl extends CtlBase {
...
@@ -49,17 +51,25 @@ class InvoiceCtl extends CtlBase {
return
system
.
getResult
(
null
,
`系统错误 错误信息
${
error
}
`
);
return
system
.
getResult
(
null
,
`系统错误 错误信息
${
error
}
`
);
}
}
}
}
async
platformTitleAddr
(
params
,
pobj2
,
req
)
{
async
platformTitleAddr
(
params
,
pobj2
,
req
)
{
try
{
try
{
let
id
=
params
.
id
;
let
id
=
params
.
id
;
// this.saasinvoiceSve.byid
let
apply
=
await
this
.
saasinvoiceSve
.
invoiceapplyById
(
params
);
if
(
!
apply
.
data
||
!
apply
.
data
.
id
)
{
return
system
.
getResult
(
null
,
"发票申请不存在"
);
}
apply
=
apply
.
data
;
let
result
=
{};
let
result
=
{};
result
.
title
=
{
//
"merchant_name"
:
apply
.
from_name
,
result
.
title
=
{
"merchant_name"
:
"舟山兰和有限公司"
,
"merchant_credit_code"
:
"KHSDLKFJAFJ"
,
"merchant_tax_type"
:
"00"
,
"merchant_addr"
:
"河南信阳"
,
"merchant_mobile"
:
"18833836395"
,
"merchant_bank"
:
"北京银行栓秀支行"
,
"merchant_account"
:
"zhousanlanhe"
};
"merchant_credit_code"
:
apply
.
from_credit_code
,
result
.
addr
=
{
"mail_addr"
:
"北京朝阳区国创元"
,
"mail_mobile"
:
"010-4525821-44"
,
"mail_to"
:
"张娇哒哒哒"
,};
"merchant_addr"
:
apply
.
from_addr
,
"merchant_mobile"
:
apply
.
from_mobile
,
"merchant_bank"
:
apply
.
from_bank
,
"merchant_account"
:
apply
.
from_account
};
result
.
addr
=
{
"mail_addr"
:
""
,
"mail_mobile"
:
""
,
"mail_to"
:
""
};
return
system
.
getResultSuccess
(
result
);
return
system
.
getResultSuccess
(
result
);
}
catch
(
error
)
{
}
catch
(
error
)
{
let
msg
=
error
.
message
;
let
msg
=
error
.
message
;
...
@@ -72,9 +82,14 @@ class InvoiceCtl extends CtlBase {
...
@@ -72,9 +82,14 @@ class InvoiceCtl extends CtlBase {
async
platformInvoiceInfo
(
params
,
pobj2
,
req
)
{
async
platformInvoiceInfo
(
params
,
pobj2
,
req
)
{
try
{
try
{
let
result
=
{};
let
id
=
params
.
id
;
result
.
tax
=
{
"additional_tax_total"
:
5000
,
"personal_invoice_tax_total"
:
5000
,
"value_added_tax_total"
:
700
};
let
apply
=
await
this
.
saasinvoiceSve
.
invoiceapplyById
(
params
);
result
.
invoiceList
=
[{
"name"
:
"舟山兰和有限公司"
,
"credit_code"
:
"KHSDLKFJAFJ"
,
"is_bank"
:
0
,
"invoice_amount"
:
1000000
,
"personal_invoice_tax"
:
3000
,
"additional_tax"
:
5000
,
"service_tax"
:
5000
,
"value_added_tax"
:
700
,
"unit"
:
""
,
"quantity"
:
0
,
"price"
:
0
,
"remark"
:
""
},
{
"name"
:
"舟山兰和有限公司"
,
"credit_code"
:
"KHSDLKFJAFJ"
,
"is_bank"
:
0
,
"invoice_amount"
:
1000000
,
"personal_invoice_tax"
:
3000
,
"additional_tax"
:
5000
,
"service_tax"
:
5000
,
"value_added_tax"
:
700
,
"unit"
:
""
,
"quantity"
:
0
,
"price"
:
0
,
"remark"
:
""
}];
if
(
!
apply
.
data
||
!
apply
.
data
.
id
)
{
return
system
.
getResult
(
null
,
"发票申请不存在"
);
}
// apply = apply.data;
let
result
=
await
this
.
buildTradeInvoice
(
id
);
return
system
.
getResultSuccess
(
result
);
return
system
.
getResultSuccess
(
result
);
}
catch
(
error
)
{
}
catch
(
error
)
{
let
msg
=
error
.
message
;
let
msg
=
error
.
message
;
...
@@ -85,9 +100,155 @@ class InvoiceCtl extends CtlBase {
...
@@ -85,9 +100,155 @@ class InvoiceCtl extends CtlBase {
}
}
}
}
async
buildTradeInvoice
(
invoiceId
)
{
// 查交易
let
items
=
await
this
.
tradeSve
.
itemByInvoiceId
({
saas_invoice_id
:
invoiceId
});
items
=
items
.
data
;
if
(
!
items
||
items
.
length
==
0
)
{
return
system
.
getResult
(
null
,
"该发票缺少交易信息,请联系平台查看原因"
);
}
let
bmMap
=
{};
let
creditCodes
=
[];
for
(
let
item
of
items
)
{
let
creditCode
=
item
.
credit_code
;
let
list
=
bmMap
[
creditCode
]
||
[];
list
.
push
(
item
);
bmMap
[
creditCode
]
=
list
;
creditCodes
.
push
(
creditCode
);
}
let
businessmenMap
=
await
this
.
orderSve
.
mapByCreditCodes
({
creditCodes
:
creditCodes
});
businessmenMap
=
businessmenMap
.
data
;
let
invoiceList
=
[];
let
additional_tax_total
=
0
;
let
personal_invoice_tax_total
=
0
;
let
value_added_tax_total
=
0
;
let
service_tax_total
=
0
;
for
(
let
creditCode
in
bmMap
)
{
let
businessmen
=
businessmenMap
[
creditCode
];
let
itemList
=
bmMap
[
creditCode
];
let
amount
=
0
;
for
(
let
item
of
itemList
)
{
amount
=
amount
+
Number
(
item
.
amt
||
0
);
}
// TODO 总统计算 begin
let
invoiceCalc
=
{
"personal_invoice_tax"
:
3000
,
"additional_tax"
:
5000
,
"service_tax"
:
5000
,
"value_added_tax"
:
700
,
}
// TODO 总统计算 end
additional_tax_total
=
additional_tax_total
+
Number
(
invoiceCalc
.
additional_tax
);
personal_invoice_tax_total
=
personal_invoice_tax_total
+
Number
(
invoiceCalc
.
personal_invoice_tax
);
value_added_tax_total
=
value_added_tax_total
+
Number
(
invoiceCalc
.
value_added_tax
);
service_tax_total
=
service_tax_total
+
Number
(
invoiceCalc
.
service_tax
);
invoiceList
.
push
({
"name"
:
businessmen
.
name
,
"credit_code"
:
creditCode
,
"is_bank"
:
businessmen
.
isBank
,
"invoice_amount"
:
amount
,
"personal_invoice_tax"
:
Number
(
invoiceCalc
.
personal_invoice_tax
),
"additional_tax"
:
Number
(
invoiceCalc
.
additional_tax
),
"service_tax"
:
Number
(
invoiceCalc
.
service_tax
),
"value_added_tax"
:
Number
(
invoiceCalc
.
value_added_tax
),
"unit"
:
""
,
"quantity"
:
""
,
"price"
:
""
,
"remark"
:
""
});
}
return
{
tax
:
{
additional_tax_total
:
additional_tax_total
,
personal_invoice_tax_total
:
personal_invoice_tax_total
,
value_added_tax_total
:
value_added_tax_total
,
},
invoiceList
:
invoiceList
}
}
async
platformInvoiceApply
(
params
,
pobj2
,
req
)
{
async
platformInvoiceApply
(
params
,
pobj2
,
req
)
{
try
{
try
{
return
system
.
getResultSuccess
();
validation
.
check
(
params
,
"id"
,
{
name
:
"发票申请信息"
,
is_require
:
true
});
validation
.
check
(
params
,
"invoice_type"
,
{
name
:
"发票类型"
,
dics
:
[
'00'
,
"10"
,
"20"
]});
validation
.
check
(
params
,
"invoiceList"
,
{
name
:
"开票信息"
,
arr_require
:
true
});
validation
.
check
(
params
,
"mail_to"
,
{
name
:
"收件人"
,
arr_require
:
true
});
validation
.
check
(
params
,
"mail_mobile"
,
{
name
:
"联系电话"
,
arr_require
:
true
});
validation
.
check
(
params
,
"mail_addr"
,
{
name
:
"邮寄地址"
,
arr_require
:
true
});
let
invoiceList
=
params
.
invoiceList
;
let
apply
=
await
this
.
saasinvoiceSve
.
invoiceapplyById
({
id
:
params
.
id
});
if
(
!
apply
.
data
||
!
apply
.
data
.
id
)
{
return
system
.
getResult
(
null
,
"发票申请不存在"
);
}
apply
=
apply
.
data
;
if
(
apply
.
status
!=
1040
)
{
return
system
.
getResult
(
null
,
"已提交平台申请,请勿重复提交"
);
}
let
creditCodes
=
[];
for
(
let
invoice
of
invoiceList
)
{
creditCodes
.
push
(
invoice
.
credit_code
);
}
let
businessmenMap
=
await
this
.
orderSve
.
mapByCreditCodes
({
creditCodes
:
creditCodes
});
businessmenMap
=
businessmenMap
.
data
;
for
(
let
invoice
of
invoiceList
)
{
validation
.
check
(
businessmenMap
,
invoice
.
credit_code
,
{
name
:
`个体户[
${
invoice
.
credit_code
}
]`
,
is_require
:
true
});
}
let
applyList
=
[];
let
batch_no
=
await
this
.
redisClient
.
genrateId
(
"invoice_batch_no"
);
for
(
let
invoice
of
invoiceList
)
{
let
bussinessmen
=
businessmenMap
[
invoice
.
credit_code
];
let
apply_no
=
await
this
.
redisClient
.
genrateId
(
"invoice_apply_no"
);
let
data
=
{
saas_id
:
apply
.
saas_id
,
saas_merchant_id
:
apply
.
saas_merchant_id
,
parent_id
:
apply
.
id
,
owner_type
:
"10"
,
status
:
"1000"
,
batch_no
:
batch_no
,
apply_no
:
apply_no
,
fee_type
:
"10"
,
invoice_type
:
this
.
trim
(
params
.
invoice_type
),
from_name
:
bussinessmen
.
name
,
from_credit_code
:
bussinessmen
.
credit_code
,
from_mobile
:
bussinessmen
.
legal_mobile
,
from_addr
:
bussinessmen
.
business_place
,
from_bank
:
bussinessmen
.
bank_name
,
from_account
:
bussinessmen
.
bank_no
,
to_name
:
this
.
trim
(
apply
.
from_name
),
to_credit_code
:
this
.
trim
(
apply
.
from_credit_code
),
to_mobile
:
this
.
trim
(
apply
.
from_mobile
),
to_addr
:
this
.
trim
(
apply
.
from_addr
),
to_bank
:
this
.
trim
(
apply
.
from_bank
),
to_account
:
this
.
trim
(
apply
.
from_account
),
mail_addr
:
this
.
trim
(
params
.
mail_addr
),
mail_mobile
:
this
.
trim
(
params
.
mail_mobile
),
mail_to
:
this
.
trim
(
params
.
mail_to
),
};
applyList
.
push
(
data
);
}
let
rs
=
await
this
.
saasinvoiceSve
.
applyBulkSave
({
fee_type
:
apply
.
fee_type
,
dataList
:
applyList
,
parent_id
:
apply
.
id
,
updateStatus
:
{
id
:
apply
.
id
,
preStatus
:
"1040"
,
status
:
"1060"
,
}
});
return
system
.
getResultSuccess
(
rs
);
}
catch
(
error
)
{
}
catch
(
error
)
{
let
msg
=
error
.
message
;
let
msg
=
error
.
message
;
if
(
msg
.
startsWith
(
"bpo-validation-error:"
))
{
if
(
msg
.
startsWith
(
"bpo-validation-error:"
))
{
...
...
xgg-saas-platform/app/base/service/impl/saas/orderSve.js
View file @
9b11d645
...
@@ -90,7 +90,7 @@ class OrderService extends ServiceBase {
...
@@ -90,7 +90,7 @@ class OrderService extends ServiceBase {
}
}
// 交付信息 map by 信用代码
// 交付信息 map by 信用代码
async
mapByCreditCodes
(
params
)
{
async
mapByCreditCodes
(
params
)
{
let
rs
=
await
this
.
callms
(
"order"
,
"saas
OrderDeliver
MapByCreditCodes"
,
params
);
let
rs
=
await
this
.
callms
(
"order"
,
"saas
Businessmen
MapByCreditCodes"
,
params
);
return
rs
;
return
rs
;
}
}
...
...
xgg-saas-platform/app/base/service/impl/saas/saasinvoiceSve.js
View file @
9b11d645
...
@@ -39,6 +39,11 @@ class SaasinvoiceService extends ServiceBase {
...
@@ -39,6 +39,11 @@ class SaasinvoiceService extends ServiceBase {
return
rs
;
return
rs
;
}
}
async
applyBulkSave
(
params
){
var
rs
=
await
this
.
callms
(
"invoice"
,
"invoiceapplyBulkSave"
,
params
);
return
rs
;
}
transOrderField
(
rows
)
{
transOrderField
(
rows
)
{
if
(
!
rows
||
rows
.
length
==
0
)
{
if
(
!
rows
||
rows
.
length
==
0
)
{
return
;
return
;
...
...
xgg-saas-platform/app/base/service/impl/trade/tradeSve.js
View file @
9b11d645
...
@@ -67,6 +67,14 @@ class TradeService extends ServiceBase {
...
@@ -67,6 +67,14 @@ class TradeService extends ServiceBase {
return
rs
;
return
rs
;
}
}
async
itemByInvoiceId
(
params
)
{
let
rs
=
await
this
.
callms
(
"trade"
,
"itemByInvoiceId"
,
params
)
||
{};
if
(
rs
.
data
&&
rs
.
data
.
rows
)
{
this
.
transFields
(
rs
.
data
.
rows
);
}
return
rs
;
}
async
audit1
(
params
)
{
async
audit1
(
params
)
{
let
rs
=
await
this
.
callms
(
"trade"
,
"orderAudit1"
,
params
)
||
{};
let
rs
=
await
this
.
callms
(
"trade"
,
"orderAudit1"
,
params
)
||
{};
return
rs
;
return
rs
;
...
...
xgg-saas-platform/app/base/system.js
View file @
9b11d645
...
@@ -206,7 +206,7 @@ class System {
...
@@ -206,7 +206,7 @@ class System {
uc
:
dev
+
":3106"
+
path
,
uc
:
dev
+
":3106"
+
path
,
// 交易
// 交易
trade
:
dev
+
":3107"
+
path
,
trade
:
local
+
":3107"
+
path
,
}
}
}
else
{
}
else
{
return
{
return
{
...
...
xgg-saas-platform/app/front/entry/public/apidoc/saas/invoice.md
View file @
9b11d645
...
@@ -388,6 +388,8 @@ fee_type == "10" && status == 1040 平台发票申请
...
@@ -388,6 +388,8 @@ fee_type == "10" && status == 1040 平台发票申请
##### URL
##### URL
[
/web/saas/invoiceCtl/platformInvoiceInfo
]
[
/web/saas/invoiceCtl/platformInvoiceInfo
]
该接口如果失败,多请求几次就可以了,长时间不连接,阿里云经常切断开发服务器与数据库的连接
#### 参数格式 `JSON`
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
#### HTTP请求方式 `POST`
...
@@ -446,6 +448,9 @@ fee_type == "10" && status == 1040 平台发票申请
...
@@ -446,6 +448,9 @@ fee_type == "10" && status == 1040 平台发票申请
{
{
"id"
:
1
,
// 发票id
"id"
:
1
,
// 发票id
"invoice_type"
:
"10"
// 发票类型
"invoice_type"
:
"10"
// 发票类型
"mail_addr"
:
"北京朝阳区国创元"
,
//邮寄地址
"mail_mobile"
:
"010-4525821-44"
,
//邮寄电话
"mail_to"
:
"张娇"
//邮寄人
"invoiceList"
:
[
"invoiceList"
:
[
{
{
"name"
:
"舟山兰和有限公司"
,
// 个体户名称
"name"
:
"舟山兰和有限公司"
,
// 个体户名称
...
...
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