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
0f59cd59
Commit
0f59cd59
authored
Mar 11, 2020
by
孙亚楠
Browse files
Options
Browse Files
Download
Plain Diff
d
parents
170c60cd
62e6de9d
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
102 additions
and
28 deletions
+102
-28
xggsve-invoice/app/base/api/impl/op/action.js
+3
-2
xggsve-invoice/app/base/db/impl/invoice/iinvoiceDao.js
+8
-8
xggsve-invoice/app/base/db/impl/invoice/iinvoicedeliverDao.js
+0
-0
xggsve-invoice/app/base/db/models/invoice/iinvoice.js
+4
-4
xggsve-invoice/app/base/service/impl/invoice/iinvoiceSve.js
+10
-10
xggsve-invoice/app/base/service/impl/invoice/iinvoicedeliverSve.js
+77
-4
No files found.
xggsve-invoice/app/base/api/impl/op/action.js
View file @
0f59cd59
...
...
@@ -5,10 +5,11 @@ class ActionAPI extends APIBase {
constructor
()
{
super
();
this
.
iinvoiceSve
=
system
.
getObject
(
"service.invoice.iinvoiceSve"
);
this
.
iinvoicedeliverSve
=
system
.
getObject
(
"service.invoice.iinvoicedeliverSve"
);
this
.
iproductSve
=
system
.
getObject
(
"service.product.iproductSve"
);
this
.
iprocessSve
=
system
.
getObject
(
"service.product.iprocessSve"
);
}
/**
* 接口跳转
...
...
@@ -36,7 +37,7 @@ class ActionAPI extends APIBase {
opResult
=
await
this
.
iinvoiceSve
.
invoicePage
(
action_body
);
break
;
case
"deliverInvoicePage"
:
// 发票申请列表页(交付商)
opResult
=
await
this
.
iinvoice
Sve
.
deliverI
nvoicePage
(
action_body
);
opResult
=
await
this
.
iinvoice
deliverSve
.
i
nvoicePage
(
action_body
);
break
;
case
"handleStatus"
:
//进度处理
break
;
...
...
xggsve-invoice/app/base/db/impl/invoice/iinvoiceDao.js
View file @
0f59cd59
...
...
@@ -30,7 +30,7 @@ class IInvoiceDao extends Dao {
this
.
setCondition
(
params
,
sql
);
sql
.
push
(
"ORDER BY id DESC"
);
sql
.
push
(
"ORDER BY
t1.
id DESC"
);
sql
.
push
(
"LIMIT :startRow, :pageSize"
);
params
.
startRow
=
startRow
||
0
;
params
.
pageSize
=
pageSize
||
10
;
...
...
@@ -39,16 +39,16 @@ class IInvoiceDao extends Dao {
setCondition
(
params
,
sql
)
{
if
(
params
.
apply_no
)
{
sql
.
push
(
"AND t
2
.`apply_no` = :apply_no"
);
sql
.
push
(
"AND t
1
.`apply_no` = :apply_no"
);
}
if
(
params
.
status
)
{
sql
.
push
(
"AND t
2
.`status` = :status"
);
sql
.
push
(
"AND t
1
.`status` = :status"
);
}
if
(
params
.
statuses
&&
params
.
statuses
.
length
>
0
){
sql
.
push
(
"AND t
2
.`status` in (:statuses)"
);
sql
.
push
(
"AND t
1
.`status` in (:statuses)"
);
}
if
(
params
.
invoice_type
)
{
sql
.
push
(
"AND t
2
.`invoice_type` = :invoice_type"
);
sql
.
push
(
"AND t
1
.`invoice_type` = :invoice_type"
);
}
if
(
params
.
invoiceTimeBegin
)
{
sql
.
push
(
"AND t1.`invoice_time` >= :invoiceTimeBegin"
);
...
...
@@ -61,14 +61,14 @@ class IInvoiceDao extends Dao {
sql
.
push
(
"AND t1.`red_status` = :red_status"
);
}
if
(
params
.
deliver_id
)
{
sql
.
push
(
"AND t
2
.`deliver_id` = :deliver_id"
);
sql
.
push
(
"AND t
1
.`deliver_id` = :deliver_id"
);
}
if
(
params
.
bd_id
)
{
sql
.
push
(
"AND t
2
.`bd_id` = :bd_id"
);
sql
.
push
(
"AND t
1
.`bd_id` = :bd_id"
);
}
if
(
params
.
bd_path
)
{
params
.
bd_path_like
=
params
.
bd_path
+
"%"
;
sql
.
push
(
"AND t
2
.`bd_path` = :bd_path_like"
);
sql
.
push
(
"AND t
1
.`bd_path` = :bd_path_like"
);
}
}
...
...
xggsve-invoice/app/base/db/impl/invoice/iinvoicedeliverDao.js
View file @
0f59cd59
This diff is collapsed.
Click to expand it.
xggsve-invoice/app/base/db/models/invoice/iinvoice.js
View file @
0f59cd59
...
...
@@ -33,12 +33,12 @@ module.exports = (db, DataTypes) => {
businessmen_account
:
{
type
:
DataTypes
.
STRING
(
45
),
allowNull
:
false
,
COMMENT
:
'销售方银行账号'
},
apply_no
:
{
type
:
DataTypes
.
STRING
(
45
),
allowNull
:
true
,
defaultValue
:
""
,
COMMENT
:
'发票申请编号'
},
apply_time
:
{
type
:
DataTypes
.
DATE
,
allowNull
:
true
,
defaultValue
:
null
,
COMMENT
:
'发票申请时间'
},
invoice_amount
:
{
type
:
DataTypes
.
INTEGER
,
allowNull
:
true
,
defaultValue
:
0
,
COMMENT
:
'价税合计总金额'
},
invoice_amount
:
{
type
:
DataTypes
.
BIGINT
,
allowNull
:
true
,
defaultValue
:
0
,
COMMENT
:
'价税合计总金额'
},
invoice_content
:
{
type
:
DataTypes
.
STRING
(
300
),
allowNull
:
false
,
defaultValue
:
null
,
COMMENT
:
'开票内容'
},
contract
:
{
type
:
DataTypes
.
STRING
(
500
),
allowNull
:
true
,
delaultValue
:
""
,
COMMENT
:
'合同'
},
personal_invoice_tax
:
{
type
:
DataTypes
.
INTEGER
,
allowNull
:
false
,
defaultValue
:
null
,
COMMENT
:
'个税'
},
additional_tax
:
{
type
:
DataTypes
.
INTEGER
,
allowNull
:
false
,
defaultValue
:
null
,
COMMENT
:
'附加税'
},
value_added_tax
:
{
type
:
DataTypes
.
INTEGER
,
allowNull
:
false
,
defaultValue
:
null
,
COMMENT
:
'增值税'
},
personal_invoice_tax
:
{
type
:
DataTypes
.
BIGINT
,
allowNull
:
false
,
defaultValue
:
null
,
COMMENT
:
'个税'
},
additional_tax
:
{
type
:
DataTypes
.
BIGINT
,
allowNull
:
false
,
defaultValue
:
null
,
COMMENT
:
'附加税'
},
value_added_tax
:
{
type
:
DataTypes
.
BIGINT
,
allowNull
:
false
,
defaultValue
:
null
,
COMMENT
:
'增值税'
},
mail_addr
:
{
type
:
DataTypes
.
STRING
(
200
),
allowNull
:
true
,
defaultValue
:
null
,
COMMENT
:
'邮寄地址'
},
mail_mobile
:
{
type
:
DataTypes
.
STRING
(
20
),
allowNull
:
true
,
defaultValue
:
null
,
COMMENT
:
'邮寄电话'
},
mail_to
:
{
type
:
DataTypes
.
STRING
(
20
),
allowNull
:
true
,
defaultValue
:
null
,
COMMENT
:
'邮寄人'
},
...
...
xggsve-invoice/app/base/service/impl/invoice/iinvoiceSve.js
View file @
0f59cd59
...
...
@@ -129,15 +129,16 @@ class IInvoiceService extends ServiceBase {
try
{
await
this
.
db
.
transaction
(
async
t
=>
{
_invoice
=
await
this
.
dao
.
create
(
_invoice
);
_iinvoiceinforeg
=
await
this
.
iinvoiceinforegDao
.
create
({
id
:
_invoice
.
id
},
t
);
let
processList
=
await
this
.
buildProcess
(
_invoice
.
product_id
)
||
[];
for
(
let
process
of
processList
)
{
process
.
invoice_id
=
_invoice
.
id
;
}
_invoice
=
await
this
.
dao
.
create
(
_invoice
,
t
);
await
this
.
iinvoiceinforegDao
.
create
({
id
:
_invoice
.
id
},
t
);
await
this
.
iinvoiceprocessDao
.
model
.
bulkCreate
(
processList
);
});
let
processList
=
await
this
.
buildProcess
(
_invoice
.
product_id
)
||
[];
for
(
let
process
of
processList
)
{
process
.
invoice_id
=
_invoice
.
id
;
}
_invoice
.
status
=
processList
[
0
].
status
;
await
_invoice
.
save
();
return
system
.
getResult
(
`success`
);
}
catch
(
error
)
{
...
...
@@ -145,7 +146,6 @@ class IInvoiceService extends ServiceBase {
return
system
.
getResult
(
null
,
`系统错误`
);
}
}
async
invoicePage
(
params
)
{
params
.
currentPage
=
Number
(
params
.
currentPage
||
1
);
...
...
@@ -162,7 +162,7 @@ class IInvoiceService extends ServiceBase {
for
(
var
item
of
list
)
{
this
.
handleDate
(
item
,
[
'updated_at'
,
'created_at'
],
'YYYY-MM-DD HH:mm:ss'
);
}
//格式化
订单
产品
//格式化产品
await
this
.
setDeliver
(
list
);
//格式化业务员
await
this
.
setStatus
(
list
);
...
...
@@ -173,7 +173,7 @@ class IInvoiceService extends ServiceBase {
}
/**
* 格式化
订单
产品
* 格式化产品
* @param {*} list
*/
async
setProduct
(
list
)
{
...
...
xggsve-invoice/app/base/service/impl/invoice/iinvoicedeliverSve.js
View file @
0f59cd59
...
...
@@ -4,9 +4,82 @@ const moment = require('moment');
/**
* 平台提交的信息
*/
class
Iinvoicedeliver
er
Service
extends
ServiceBase
{
class
IinvoicedeliverService
extends
ServiceBase
{
constructor
()
{
super
(
"invoice"
,
ServiceBase
.
getDaoName
(
DelivererService
));
super
(
"invoice"
,
ServiceBase
.
getDaoName
(
IinvoicedeliverService
));
this
.
iinvoiceDao
=
system
.
getObject
(
"db.invoice.iinvoiceDao"
);
this
.
iinvoiceprocessDao
=
system
.
getObject
(
"db.invoice.iinvoiceprocessDao"
);
this
.
iinvoiceinforegDao
=
system
.
getObject
(
"db.invoice.iinvoiceinforegDao"
);
this
.
iproductDao
=
system
.
getObject
(
"db.product.iproductDao"
);
this
.
iprocessDao
=
system
.
getObject
(
"db.product.iprocessDao"
);
this
.
iproductprocessDao
=
system
.
getObject
(
"db.product.iproductprocessDao"
);
}
async
invoicePage
(
params
)
{
params
.
currentPage
=
Number
(
params
.
currentPage
||
1
);
params
.
pageSize
=
Number
(
params
.
pageSize
||
10
);
params
.
startRow
=
Number
((
params
.
currentPage
-
1
)
*
params
.
pageSize
);
let
deliver_id
=
params
.
deliver_id
;
let
total
=
await
this
.
dao
.
countByParams
(
params
);
if
(
total
==
0
)
{
return
{
count
:
0
,
rows
:
[]
};
}
let
list
=
await
this
.
dao
.
pageByParams
(
params
);
if
(
list
)
{
for
(
var
item
of
list
)
{
this
.
handleDate
(
item
,
[
'updated_at'
,
'created_at'
],
'YYYY-MM-DD HH:mm:ss'
);
this
.
handleDate
(
item
,
[
'updated_at'
,
'created_at'
],
'YYYY-MM-DD HH:mm:ss'
);
}
await
this
.
setStatus
(
list
);
await
this
.
setProduct
(
list
);
}
return
{
count
:
total
,
rows
:
list
};
}
/**
* 格式化产品
* @param {*} list
*/
async
setProduct
(
list
)
{
let
productIdList
=
[];
for
(
let
item
of
list
)
{
if
(
item
.
product_id
)
{
productIdList
.
push
(
item
.
product_id
);
}
}
let
productMap
=
await
this
.
iproductDao
.
mapByIds
(
productIdList
);
for
(
let
item
of
list
)
{
item
.
oproduct
=
productMap
[
item
.
product_id
]
||
{}
}
}
/**
* 处理状态数据
* @param list
* @returns {Promise<void>}
*/
async
setStatus
(
list
)
{
let
ids
=
[];
let
statuses
=
[];
for
(
let
item
of
list
)
{
ids
.
push
(
item
.
id
);
statuses
.
push
(
item
.
status
);
}
let
map
=
await
this
.
iinvoiceprocessDao
.
mapByInvoiceIdsAndStatus
(
ids
,
statuses
);
for
(
let
item
of
list
)
{
let
key
=
item
.
id
+
"_"
+
item
.
status
;
let
v
=
map
[
key
]
||
{};
item
.
status_name
=
v
.
name
;
item
.
next_status
=
JSON
.
parse
(
v
.
next_status
||
"[]"
);
}
console
.
log
(
list
);
}
}
module
.
exports
=
IinvoicedelivererService
;
\ No newline at end of file
module
.
exports
=
IinvoicedeliverService
;
\ No newline at end of file
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