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
01e9cb85
Commit
01e9cb85
authored
Mar 12, 2020
by
孙亚楠
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'xggsve-invoice-dev' of gitlab.gongsibao.com:jiangyong/zhichan into xggsve-invoice-dev
parents
7dbe31bf
d5a08535
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
59 additions
and
58 deletions
+59
-58
xggsve-invoice/app/base/db/impl/invoice/iinvoiceDao.js
+1
-1
xggsve-invoice/app/base/service/impl/invoice/iinvoiceSve.js
+57
-56
xggsve-invoice/app/base/service/impl/invoice/iinvoicedeliverSve.js
+1
-1
No files found.
xggsve-invoice/app/base/db/impl/invoice/iinvoiceDao.js
View file @
01e9cb85
...
@@ -66,7 +66,7 @@ class IInvoiceDao extends Dao {
...
@@ -66,7 +66,7 @@ class IInvoiceDao extends Dao {
}
}
if
(
params
.
bd_path
)
{
if
(
params
.
bd_path
)
{
params
.
bd_path_like
=
params
.
bd_path
+
"%"
;
params
.
bd_path_like
=
params
.
bd_path
+
"%"
;
sql
.
push
(
"AND t1.`bd_path`
=
:bd_path_like"
);
sql
.
push
(
"AND t1.`bd_path`
LIKE
:bd_path_like"
);
}
}
}
}
...
...
xggsve-invoice/app/base/service/impl/invoice/iinvoiceSve.js
View file @
01e9cb85
...
@@ -14,8 +14,8 @@ class IInvoiceService extends ServiceBase {
...
@@ -14,8 +14,8 @@ class IInvoiceService extends ServiceBase {
this
.
iinvoiceprocessDao
=
system
.
getObject
(
"db.invoice.iinvoiceprocessDao"
);
this
.
iinvoiceprocessDao
=
system
.
getObject
(
"db.invoice.iinvoiceprocessDao"
);
this
.
iinvoiceinforegDao
=
system
.
getObject
(
"db.invoice.iinvoiceinforegDao"
);
this
.
iinvoiceinforegDao
=
system
.
getObject
(
"db.invoice.iinvoiceinforegDao"
);
this
.
iinvoicedeliverDao
=
system
.
getObject
(
"db.invoice.iinvoicedeliverDao"
);
this
.
iinvoicedeliverDao
=
system
.
getObject
(
"db.invoice.iinvoicedeliverDao"
);
this
.
RULE_INVOICE_TYPE
=
[
"10"
,
'20'
,
'30'
];
//发票类型
this
.
RULE_INVOICE_TYPE
=
[
"10"
,
'20'
,
'30'
];
//发票类型
this
.
RULE_BUSINESSMEN_TYPE
=
[
'10'
,
'20'
];
//销售方类型
this
.
RULE_BUSINESSMEN_TYPE
=
[
'10'
,
'20'
];
//销售方类型
this
.
DEFAULT_PRODUCT_ID
=
"50010000"
;
//默认产品ID
this
.
DEFAULT_PRODUCT_ID
=
"50010000"
;
//默认产品ID
this
.
iproductDao
=
system
.
getObject
(
"db.product.iproductDao"
);
this
.
iproductDao
=
system
.
getObject
(
"db.product.iproductDao"
);
this
.
iprocessDao
=
system
.
getObject
(
"db.product.iprocessDao"
);
this
.
iprocessDao
=
system
.
getObject
(
"db.product.iprocessDao"
);
...
@@ -26,31 +26,31 @@ class IInvoiceService extends ServiceBase {
...
@@ -26,31 +26,31 @@ class IInvoiceService extends ServiceBase {
* 发票申请
* 发票申请
* @param {*} params
* @param {*} params
*/
*/
async
invoiceApply
(
params
){
async
invoiceApply
(
params
)
{
if
(
!
params
.
channel_id
)
{
if
(
!
params
.
channel_id
)
{
return
system
.
getResult
(
null
,
`渠道ID不能为空`
);
return
system
.
getResult
(
null
,
`渠道ID不能为空`
);
}
}
if
(
!
params
.
apply_no
)
{
if
(
!
params
.
apply_no
)
{
return
system
.
getResult
(
null
,
`发票申请编号不能为空`
);
return
system
.
getResult
(
null
,
`发票申请编号不能为空`
);
}
}
try
{
try
{
let
invoiceExists
=
await
this
.
dao
.
findByChannelAndApplyNo
(
this
.
trim
(
params
.
channel_id
),
this
.
trim
(
params
.
apply_no
));
let
invoiceExists
=
await
this
.
dao
.
findByChannelAndApplyNo
(
this
.
trim
(
params
.
channel_id
),
this
.
trim
(
params
.
apply_no
));
if
(
invoiceExists
.
total
!=
0
)
{
if
(
invoiceExists
.
total
!=
0
)
{
return
system
.
getResult
(
null
,
`发票编号[
${
params
.
apply_no
}
]已存在`
);
return
system
.
getResult
(
null
,
`发票编号[
${
params
.
apply_no
}
]已存在`
);
}
}
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
error
);
console
.
log
(
error
);
return
system
.
getResult
(
null
,
`系统错误
${
error
}
`
);
return
system
.
getResult
(
null
,
`系统错误
${
error
}
`
);
}
}
if
(
this
.
RULE_INVOICE_TYPE
.
indexOf
(
this
.
trim
(
params
.
invoice_type
))
==-
1
)
{
if
(
this
.
RULE_INVOICE_TYPE
.
indexOf
(
this
.
trim
(
params
.
invoice_type
))
==
-
1
)
{
return
system
.
getResult
(
null
,
`发票类型不存在`
);
return
system
.
getResult
(
null
,
`发票类型不存在`
);
}
}
// if(!params.apply_time){
// if(!params.apply_time){
// return system.getResult(null,`发票申请时间错误`);
// return system.getResult(null,`发票申请时间错误`);
// }
// }
if
(
!
params
.
invoice_content
)
{
if
(
!
params
.
invoice_content
)
{
return
system
.
getResult
(
null
,
`开票内容不能为空`
);
return
system
.
getResult
(
null
,
`开票内容不能为空`
);
}
}
// if(!params.contract){
// if(!params.contract){
// return system.getResult(null,`合同不能为空`);
// return system.getResult(null,`合同不能为空`);
...
@@ -64,27 +64,27 @@ class IInvoiceService extends ServiceBase {
...
@@ -64,27 +64,27 @@ class IInvoiceService extends ServiceBase {
_invoice
.
invoice_amount
=
this
.
trim
(
params
.
invoice_amount
)
||
0
;
_invoice
.
invoice_amount
=
this
.
trim
(
params
.
invoice_amount
)
||
0
;
_invoice
.
invoice_content
=
this
.
trim
(
params
.
invoice_content
)
||
"服务费"
;
_invoice
.
invoice_content
=
this
.
trim
(
params
.
invoice_content
)
||
"服务费"
;
_invoice
.
contract
=
this
.
trim
(
params
.
contract
)
||
""
;
_invoice
.
contract
=
this
.
trim
(
params
.
contract
)
||
""
;
_invoice
.
personal_invoice_tax
=
this
.
trim
(
params
.
personal_invoice_tax
)
||
0
;
_invoice
.
personal_invoice_tax
=
this
.
trim
(
params
.
personal_invoice_tax
)
||
0
;
_invoice
.
additional_tax
=
this
.
trim
(
params
.
additional_tax
)
||
0
;
_invoice
.
additional_tax
=
this
.
trim
(
params
.
additional_tax
)
||
0
;
_invoice
.
value_added_tax
=
this
.
trim
(
params
.
value_added_tax
)
||
0
;
_invoice
.
value_added_tax
=
this
.
trim
(
params
.
value_added_tax
)
||
0
;
_invoice
.
product_id
=
params
.
product_id
||
this
.
DEFAULT_PRODUCT_ID
;
_invoice
.
product_id
=
params
.
product_id
||
this
.
DEFAULT_PRODUCT_ID
;
if
(
!
params
.
merchant_name
)
{
if
(
!
params
.
merchant_name
)
{
return
system
.
getResult
(
null
,
`购买方名称不能为空`
);
return
system
.
getResult
(
null
,
`购买方名称不能为空`
);
}
}
if
(
!
params
.
merchant_credit_code
)
{
if
(
!
params
.
merchant_credit_code
)
{
return
system
.
getResult
(
null
,
`购买方社会统一信用代码不能为空`
);
return
system
.
getResult
(
null
,
`购买方社会统一信用代码不能为空`
);
}
}
if
(
!
params
.
merchant_addr
)
{
if
(
!
params
.
merchant_addr
)
{
return
system
.
getResult
(
null
,
`购买方地址不能为空`
);
return
system
.
getResult
(
null
,
`购买方地址不能为空`
);
}
}
if
(
!
params
.
merchant_mobile
)
{
if
(
!
params
.
merchant_mobile
)
{
return
system
.
getResult
(
null
,
`购买方电话不能为空`
);
return
system
.
getResult
(
null
,
`购买方电话不能为空`
);
}
}
if
(
!
params
.
merchant_bank
)
{
if
(
!
params
.
merchant_bank
)
{
return
system
.
getResult
(
null
,
`购买方开户行不能为空`
);
return
system
.
getResult
(
null
,
`购买方开户行不能为空`
);
}
}
if
(
!
params
.
merchant_account
)
{
if
(
!
params
.
merchant_account
)
{
return
system
.
getResult
(
null
,
`购买方对公账户不能为空`
);
return
system
.
getResult
(
null
,
`购买方对公账户不能为空`
);
}
}
_invoice
.
merchant_id
=
this
.
trim
(
params
.
merchant_id
);
_invoice
.
merchant_id
=
this
.
trim
(
params
.
merchant_id
);
_invoice
.
merchant_name
=
this
.
trim
(
params
.
merchant_name
);
_invoice
.
merchant_name
=
this
.
trim
(
params
.
merchant_name
);
...
@@ -94,26 +94,26 @@ class IInvoiceService extends ServiceBase {
...
@@ -94,26 +94,26 @@ class IInvoiceService extends ServiceBase {
_invoice
.
merchant_bank
=
this
.
trim
(
params
.
merchant_bank
);
_invoice
.
merchant_bank
=
this
.
trim
(
params
.
merchant_bank
);
_invoice
.
merchant_account
=
this
.
trim
(
params
.
merchant_account
);
_invoice
.
merchant_account
=
this
.
trim
(
params
.
merchant_account
);
if
(
!
params
.
businessmen_name
)
{
if
(
!
params
.
businessmen_name
)
{
return
system
.
getResult
(
null
,
`销售方名称不能为空`
);
return
system
.
getResult
(
null
,
`销售方名称不能为空`
);
}
}
if
(
!
params
.
businessmen_credit_code
)
{
if
(
!
params
.
businessmen_credit_code
)
{
return
system
.
getResult
(
null
,
`销售方社会统一信用代码不能为空`
);
return
system
.
getResult
(
null
,
`销售方社会统一信用代码不能为空`
);
}
}
if
(
!
params
.
businessmen_addr
)
{
if
(
!
params
.
businessmen_addr
)
{
return
system
.
getResult
(
null
,
`销售方地址不能为空`
);
return
system
.
getResult
(
null
,
`销售方地址不能为空`
);
}
}
if
(
!
params
.
businessmen_mobile
)
{
if
(
!
params
.
businessmen_mobile
)
{
return
system
.
getResult
(
null
,
`销售方电话不能为空`
);
return
system
.
getResult
(
null
,
`销售方电话不能为空`
);
}
}
if
(
!
params
.
businessmen_bank
)
{
if
(
!
params
.
businessmen_bank
)
{
return
system
.
getResult
(
null
,
`销售方开户行不能为空`
);
return
system
.
getResult
(
null
,
`销售方开户行不能为空`
);
}
}
if
(
!
params
.
businessmen_account
)
{
if
(
!
params
.
businessmen_account
)
{
return
system
.
getResult
(
null
,
`销售方对公账户不能为空`
);
return
system
.
getResult
(
null
,
`销售方对公账户不能为空`
);
}
}
if
(
this
.
RULE_BUSINESSMEN_TYPE
.
indexOf
(
this
.
trim
(
params
.
businessmen_type
))
==-
1
)
{
if
(
this
.
RULE_BUSINESSMEN_TYPE
.
indexOf
(
this
.
trim
(
params
.
businessmen_type
))
==
-
1
)
{
return
system
.
getResult
(
null
,
`销售方类型错误`
);
return
system
.
getResult
(
null
,
`销售方类型错误`
);
}
}
_invoice
.
businessmen_type
=
this
.
trim
(
params
.
businessmen_type
);
_invoice
.
businessmen_type
=
this
.
trim
(
params
.
businessmen_type
);
_invoice
.
businessmen_id
=
this
.
trim
(
params
.
businessmen_id
);
_invoice
.
businessmen_id
=
this
.
trim
(
params
.
businessmen_id
);
...
@@ -137,11 +137,11 @@ class IInvoiceService extends ServiceBase {
...
@@ -137,11 +137,11 @@ class IInvoiceService extends ServiceBase {
_invoice
.
status
=
processList
[
0
].
status
;
_invoice
.
status
=
processList
[
0
].
status
;
await
this
.
db
.
transaction
(
async
t
=>
{
await
this
.
db
.
transaction
(
async
t
=>
{
_invoice
=
await
this
.
dao
.
create
(
_invoice
,
t
);
_invoice
=
await
this
.
dao
.
create
(
_invoice
,
t
);
await
this
.
iinvoiceinforegDao
.
create
({
id
:
_invoice
.
id
},
t
);
await
this
.
iinvoiceinforegDao
.
create
({
id
:
_invoice
.
id
},
t
);
await
this
.
iinvoicesummaryinfoDao
.
create
({
id
:
_invoice
.
id
},
t
);
await
this
.
iinvoicesummaryinfoDao
.
create
({
id
:
_invoice
.
id
},
t
);
for
(
let
process
of
processList
)
{
for
(
let
process
of
processList
)
{
process
.
invoice_id
=
_invoice
.
id
;
process
.
invoice_id
=
_invoice
.
id
;
}
}
await
this
.
iinvoiceprocessDao
.
model
.
bulkCreate
(
processList
,
{
transaction
:
t
});
await
this
.
iinvoiceprocessDao
.
model
.
bulkCreate
(
processList
,
{
transaction
:
t
});
...
@@ -149,10 +149,10 @@ class IInvoiceService extends ServiceBase {
...
@@ -149,10 +149,10 @@ class IInvoiceService extends ServiceBase {
return
system
.
getResult
(
`success`
);
return
system
.
getResult
(
`success`
);
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
error
);
console
.
log
(
error
);
return
system
.
getResult
(
null
,
`系统错误`
);
return
system
.
getResult
(
null
,
`系统错误`
);
}
}
}
}
async
invoicePage
(
params
)
{
async
invoicePage
(
params
)
{
params
.
currentPage
=
Number
(
params
.
currentPage
||
1
);
params
.
currentPage
=
Number
(
params
.
currentPage
||
1
);
params
.
pageSize
=
Number
(
params
.
pageSize
||
10
);
params
.
pageSize
=
Number
(
params
.
pageSize
||
10
);
...
@@ -175,7 +175,7 @@ class IInvoiceService extends ServiceBase {
...
@@ -175,7 +175,7 @@ class IInvoiceService extends ServiceBase {
await
this
.
setProduct
(
list
);
await
this
.
setProduct
(
list
);
}
}
return
{
count
:
total
,
rows
:
list
}
;
return
system
.
getResultSuccess
({
count
:
total
,
rows
:
list
})
;
}
}
/**
/**
...
@@ -189,7 +189,7 @@ class IInvoiceService extends ServiceBase {
...
@@ -189,7 +189,7 @@ class IInvoiceService extends ServiceBase {
productIdList
.
push
(
item
.
product_id
);
productIdList
.
push
(
item
.
product_id
);
}
}
}
}
if
(
!
productIdList
||
productIdList
.
length
===
0
)
{
if
(
!
productIdList
||
productIdList
.
length
===
0
)
{
return
;
return
;
}
}
let
productMap
=
await
this
.
iproductDao
.
mapByIds
(
productIdList
);
let
productMap
=
await
this
.
iproductDao
.
mapByIds
(
productIdList
);
...
@@ -205,12 +205,13 @@ class IInvoiceService extends ServiceBase {
...
@@ -205,12 +205,13 @@ class IInvoiceService extends ServiceBase {
let
ids
=
[];
let
ids
=
[];
for
(
let
item
of
list
)
{
for
(
let
item
of
list
)
{
item
.
invoice_deliver
=
{};
if
(
!
item
.
invoice_deliver_id
)
{
if
(
!
item
.
invoice_deliver_id
)
{
continue
;
continue
;
}
}
ids
.
push
(
item
.
invoice_deliver_id
)
ids
.
push
(
item
.
invoice_deliver_id
)
}
}
if
(
!
ids
||
ids
.
length
===
0
)
{
if
(
!
ids
||
ids
.
length
===
0
)
{
return
;
return
;
}
}
...
@@ -233,7 +234,7 @@ class IInvoiceService extends ServiceBase {
...
@@ -233,7 +234,7 @@ class IInvoiceService extends ServiceBase {
statuses
.
push
(
item
.
status
);
statuses
.
push
(
item
.
status
);
}
}
if
(
!
ids
||
ids
.
length
===
0
||
!
statuses
||
statuses
.
length
===
0
)
{
if
(
!
ids
||
ids
.
length
===
0
||
!
statuses
||
statuses
.
length
===
0
)
{
return
;
return
;
}
}
...
...
xggsve-invoice/app/base/service/impl/invoice/iinvoicedeliverSve.js
View file @
01e9cb85
...
@@ -39,7 +39,7 @@ class IinvoicedeliverService extends ServiceBase {
...
@@ -39,7 +39,7 @@ class IinvoicedeliverService extends ServiceBase {
await
this
.
setStatus
(
list
);
await
this
.
setStatus
(
list
);
await
this
.
setProduct
(
list
);
await
this
.
setProduct
(
list
);
}
}
return
{
count
:
total
,
rows
:
list
}
;
return
system
.
getResultSuccess
({
count
:
total
,
rows
:
list
})
;
}
}
/**
/**
...
...
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