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
7281dc05
Commit
7281dc05
authored
Mar 10, 2020
by
王昆
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gsb
parent
4e16b406
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
289 additions
and
270 deletions
+289
-270
xggsve-invoice/app/base/service/impl/invoice/iinvoiceSve.js
+4
-270
xggsve-invoice/app/base/service/impl/invoice/iinvoiceSvebak.js
+285
-0
No files found.
xggsve-invoice/app/base/service/impl/invoice/iinvoiceSve.js
View file @
7281dc05
...
...
@@ -10,275 +10,10 @@ class InvoiceService extends ServiceBase {
let
is
=
system
.
getObject
(
"util.invoiceStatus"
);
this
.
invoiceStatus
=
is
.
status
;
this
.
applyDao
=
system
.
getObject
(
"db.invoice.applyDao"
);
this
.
delivererDao
=
system
.
getObject
(
"db.invoice.delivererDao"
);
this
.
iinvoicesummaryinfoDao
=
system
.
getObject
(
"db.invoice.iinvoicesummaryinfoDao"
);
this
.
iinvoiceprocessDao
=
system
.
getObject
(
"db.invoice.iinvoiceprocessDao"
);
this
.
iinvoiceinforegDao
=
system
.
getObject
(
"db.invoice.iinvoiceinforegDao"
);
this
.
iinvoicedeliverDao
=
system
.
getObject
(
"db.invoice.iinvoicedeliverDao"
);
}
// /**
// * 完税证明
// * @param {*} params
// */
// async apiTxPayment(params) {
// if (!params.id) {
// return system.getResult(null, `参数错误 发票ID不合法`);
// }
// try {
// let res = await this.txPayment(params);
// return res;
// } catch (error) {
// return system.getResult(null, `参数错误 错误信息 ${error}`);
// }
// }
// /**
// * 查看完税证明
// * @param {*} params
// */
// async apiQueryTxPayment(params) {
// if (!params.id) {
// return system.getResult(null, `参数错误 发票ID不合法`);
// }
// try {
// return await this.queryTxPayment(params);
// } catch (error) {
// return system.getResult(null, `参数错误 错误信息 ${error}`);
// }
// }
// /**
// * 发票列表(平台)
// * @param {*} params
// */
// async apiQueryInvoices(params) {
// try {
// if(params.applyNo){params.applyNo=this.trim(params.applyNo)}
// if(params.type){params.type=this.trim(params.type);}
// if(params.invoiceTime){params.invoiceTime=this.trim(params.invoiceTime);}
// return await this.queryInvoices(params);
// } catch (error) {
// return system.getResult(null, `系统错误 错误信息 ${error}`);
// }
// }
// /**
// * 发票红冲列表
// * @param {*} params
// */
// async apiRedRushList(params) {
// try {
// if(params){}
// let res = await this.redRushList(params);
// return res;
// } catch (error) {
// return system.getResult(null, `参数错误 错误信息 ${error}`);
// }
// }
// //==============================================================
// /**
// * 红冲列表
// * @param {*} params
// */
// async redRushList(params){
// try {
// if (params.delivererId) {
// params.delivererId=this.trim(params.delivererId);
// }
// if (this.trim(params.applyNo)) {
// params.applyNo=this.trim(params.applyNo);
// }
// if (this.trim(params.invoiceNo)) {
// params.invoiceNo=this.trim(params.invoiceNo);
// }
// if (this.trim(params.invoiceTime)) {
// params.invoiceTime=this.trim(params.invoiceTime);
// }
// if (this.trim(params.startTime)) {
// params.startTime=this.trim(params.startTime);
// }
// if (this.trim(params.endTime)) {
// params.endTime=this.trim(params.endTime);
// }
// if (this.trim(params.type)) {
// params.type=this.trim(params.type);
// }
// if (this.trim(params.status)) {
// params.status=this.trim(params.status);
// }
// if (this.trim(params.redStatus)) {
// params.redStatus=this.trim(params.redStatus);
// }
// params.statRow = (Number(this.trim(params.pageIndex)) - 1) * Number(this.trim(params.pageSize));
// if (params.statRow <= 0) { params.statRow = 0; }
// params.pageSize = Number(this.trim(params.pageSize)) <= 0 ? 10 : Number(this.trim(params.pageSize));
// let total = await this.dao.countRedRushListByParams(params);
// if (total == 0 || total[0].count == 0) {
// let res = { rows: [], count: 0 };
// return system.getResult(res);
// }
// let rows = await this.dao.redRushListByParams(params);
// for (let item of rows) {
// if (item.type == "10") {
// item.type = "普通发票";
// } else if (item.type == "20") {
// item.type = "增值税专用发票";
// } else if (item.type == "30") {
// item.type = "电子发票";
// } else {
// item.type = "";
// }
// this.handleDate(item, ["invoice_time"], "YYYY-MM-DD HH:mm:ss", -8);
// this.dao.setRowCodeName(item, "status");
// }
// let res = { count: total[0].count, rows: rows };
// return system.getResult(res);
// } catch (error) {
// return system.getResult(null, `系统错误 错误信息 ${error}`);
// }
// }
// /**
// * 完税证明
// * @param {*} params
// * {
// * id:xxx //完税证明
// * }
// */
// async txPayment(params) {
// try {
// let _invoice = await this.dao.findOne({
// id: this.trim(params.id)
// });
// if (!_invoice) {
// return system.getResult(null, `发票不存在`);
// }
// let res = await this.dao.update({
// id: this.trim(params.id),
// taxNo: this.trim(params.taxNo),
// complateTax: 1,
// taxTime: this.trim(params.taxTime),
// taxVoucher: this.trim(params.taxVoucher)
// });
// return system.getResult(res);
// } catch (error) {
// return system.getResult(null, `参数错误 错误信息 ${error}`);
// }
// }
// /**
// * 查看完税证明
// * @param {*} params
// * {
// * id:xxx //完税证明
// * }
// */
// async queryTxPayment(params) {
// try {
// let _invoice = await this.dao.model.findOne({
// where: {
// id: this.trim(params.id),
// complateTax: 1
// },
// attributes: ['id', 'taxNo', 'complateTax', 'taxTime', 'taxVoucher']
// });
// if (!_invoice) {
// return system.getResult(null, `完税证明不存在`);
// }
// return system.getResult(_invoice);
// } catch (error) {
// return system.getResult(null, `参数错误 错误信息 ${error}`);
// }
// }
// /**
// * 发票列表查询(平台)
// * @param {*} params
// * @param applyNo 发票的申请编号
// * @param invoiceTime 发票的申请时间
// * @param type 发票的类型
// * @param status 业务进度
// */
// async queryInvoices(params) {
// try {
// var pageIndex = Number(params.pageIndex || 1);
// var pageSize = Number(params.pageSize || 10);
// var total = await this.dao.countByParams(params);
// if (total == 0) {
// return system.getResultSuccess({
// count: 0,
// rows: []
// });
// }
// var startRow = (pageIndex - 1) * pageSize;
// var list = await this.dao.pageByParams(params, startRow, pageSize);
// await this.setApply(list);
// for (var item of list) {
// // item.redStatusName = this.dao.getRowCodeName(item, "red_status");
// if (item.red_status == 1) {
// item.red_status = '未红冲';
// } else if (item.red_status == 2) {
// item.red_status = '红冲中';
// } else if (item.red_status == 3) {
// item.red_status = '红冲失败'
// } else if (item.red_status == 4) {
// item.red_status = '红冲成功';
// } else {
// item.red_status = '';
// }
// this.dao.getRowCodeName(item.apply,"status");
// item.complate_tax = item.complate_tax == 1 ? '已完税' : '未完税';
// item.month = moment(item.invoice_time).month() + 1;
// this.handleDate(item,['invoice_time'],null,-8);
// if (item.apply['type'] == '10') {
// item.apply['type'] = "普通发票";
// } else if (item.apply['type'] == '20') {
// item.apply['type'] = "增值税专用发票";
// } else {
// item.apply['type'] = "电子发票";
// }
// }
// var page = {
// count: total,
// rows: list
// };
// return system.getResultSuccess(page);
// } catch (error) {
// console.log(error);
// return system.getResult(`系统错误 错误信息 ${error}`);
// }
// }
// async setApply(list) {
// if (!list || list.length == 0) {
// return;
// }
// var ids = [];
// for (var item of list) {
// ids.push(item.id);
// }
// var applyMap = await this.applyDao.findMapByIds(ids) || {};
// for (var item of list) {
// item.apply = applyMap[item.id] || {};
// }
// }
}
module
.
exports
=
InvoiceService
;
\ No newline at end of file
xggsve-invoice/app/base/service/impl/invoice/iinvoiceSvebak.js
0 → 100644
View file @
7281dc05
const
ServiceBase
=
require
(
"../../sve.base"
);
const
system
=
require
(
"../../../system"
);
const
moment
=
require
(
'moment'
)
/**
* 交付商 提交的信息
*/
class
InvoiceService
extends
ServiceBase
{
constructor
()
{
super
(
"invoice"
,
ServiceBase
.
getDaoName
(
InvoiceService
));
let
is
=
system
.
getObject
(
"util.invoiceStatus"
);
this
.
invoiceStatus
=
is
.
status
;
this
.
applyDao
=
system
.
getObject
(
"db.invoice.applyDao"
);
this
.
delivererDao
=
system
.
getObject
(
"db.invoice.delivererDao"
);
}
/**
* 完税证明
* @param {*} params
*/
async
apiTxPayment
(
params
)
{
if
(
!
params
.
id
)
{
return
system
.
getResult
(
null
,
`参数错误 发票ID不合法`
);
}
try
{
let
res
=
await
this
.
txPayment
(
params
);
return
res
;
}
catch
(
error
)
{
return
system
.
getResult
(
null
,
`参数错误 错误信息
${
error
}
`
);
}
}
/**
* 查看完税证明
* @param {*} params
*/
async
apiQueryTxPayment
(
params
)
{
if
(
!
params
.
id
)
{
return
system
.
getResult
(
null
,
`参数错误 发票ID不合法`
);
}
try
{
return
await
this
.
queryTxPayment
(
params
);
}
catch
(
error
)
{
return
system
.
getResult
(
null
,
`参数错误 错误信息
${
error
}
`
);
}
}
/**
* 发票列表(平台)
* @param {*} params
*/
async
apiQueryInvoices
(
params
)
{
try
{
if
(
params
.
applyNo
){
params
.
applyNo
=
this
.
trim
(
params
.
applyNo
)}
if
(
params
.
type
){
params
.
type
=
this
.
trim
(
params
.
type
);}
if
(
params
.
invoiceTime
){
params
.
invoiceTime
=
this
.
trim
(
params
.
invoiceTime
);}
return
await
this
.
queryInvoices
(
params
);
}
catch
(
error
)
{
return
system
.
getResult
(
null
,
`系统错误 错误信息
${
error
}
`
);
}
}
/**
* 发票红冲列表
* @param {*} params
*/
async
apiRedRushList
(
params
)
{
try
{
if
(
params
){}
let
res
=
await
this
.
redRushList
(
params
);
return
res
;
}
catch
(
error
)
{
return
system
.
getResult
(
null
,
`参数错误 错误信息
${
error
}
`
);
}
}
//==============================================================
/**
* 红冲列表
* @param {*} params
*/
async
redRushList
(
params
){
try
{
if
(
params
.
delivererId
)
{
params
.
delivererId
=
this
.
trim
(
params
.
delivererId
);
}
if
(
this
.
trim
(
params
.
applyNo
))
{
params
.
applyNo
=
this
.
trim
(
params
.
applyNo
);
}
if
(
this
.
trim
(
params
.
invoiceNo
))
{
params
.
invoiceNo
=
this
.
trim
(
params
.
invoiceNo
);
}
if
(
this
.
trim
(
params
.
invoiceTime
))
{
params
.
invoiceTime
=
this
.
trim
(
params
.
invoiceTime
);
}
if
(
this
.
trim
(
params
.
startTime
))
{
params
.
startTime
=
this
.
trim
(
params
.
startTime
);
}
if
(
this
.
trim
(
params
.
endTime
))
{
params
.
endTime
=
this
.
trim
(
params
.
endTime
);
}
if
(
this
.
trim
(
params
.
type
))
{
params
.
type
=
this
.
trim
(
params
.
type
);
}
if
(
this
.
trim
(
params
.
status
))
{
params
.
status
=
this
.
trim
(
params
.
status
);
}
if
(
this
.
trim
(
params
.
redStatus
))
{
params
.
redStatus
=
this
.
trim
(
params
.
redStatus
);
}
params
.
statRow
=
(
Number
(
this
.
trim
(
params
.
pageIndex
))
-
1
)
*
Number
(
this
.
trim
(
params
.
pageSize
));
if
(
params
.
statRow
<=
0
)
{
params
.
statRow
=
0
;
}
params
.
pageSize
=
Number
(
this
.
trim
(
params
.
pageSize
))
<=
0
?
10
:
Number
(
this
.
trim
(
params
.
pageSize
));
let
total
=
await
this
.
dao
.
countRedRushListByParams
(
params
);
if
(
total
==
0
||
total
[
0
].
count
==
0
)
{
let
res
=
{
rows
:
[],
count
:
0
};
return
system
.
getResult
(
res
);
}
let
rows
=
await
this
.
dao
.
redRushListByParams
(
params
);
for
(
let
item
of
rows
)
{
if
(
item
.
type
==
"10"
)
{
item
.
type
=
"普通发票"
;
}
else
if
(
item
.
type
==
"20"
)
{
item
.
type
=
"增值税专用发票"
;
}
else
if
(
item
.
type
==
"30"
)
{
item
.
type
=
"电子发票"
;
}
else
{
item
.
type
=
""
;
}
this
.
handleDate
(
item
,
[
"invoice_time"
],
"YYYY-MM-DD HH:mm:ss"
,
-
8
);
this
.
dao
.
setRowCodeName
(
item
,
"status"
);
}
let
res
=
{
count
:
total
[
0
].
count
,
rows
:
rows
};
return
system
.
getResult
(
res
);
}
catch
(
error
)
{
return
system
.
getResult
(
null
,
`系统错误 错误信息
${
error
}
`
);
}
}
/**
* 完税证明
* @param {*} params
* {
* id:xxx //完税证明
* }
*/
async
txPayment
(
params
)
{
try
{
let
_invoice
=
await
this
.
dao
.
findOne
({
id
:
this
.
trim
(
params
.
id
)
});
if
(
!
_invoice
)
{
return
system
.
getResult
(
null
,
`发票不存在`
);
}
let
res
=
await
this
.
dao
.
update
({
id
:
this
.
trim
(
params
.
id
),
taxNo
:
this
.
trim
(
params
.
taxNo
),
complateTax
:
1
,
taxTime
:
this
.
trim
(
params
.
taxTime
),
taxVoucher
:
this
.
trim
(
params
.
taxVoucher
)
});
return
system
.
getResult
(
res
);
}
catch
(
error
)
{
return
system
.
getResult
(
null
,
`参数错误 错误信息
${
error
}
`
);
}
}
/**
* 查看完税证明
* @param {*} params
* {
* id:xxx //完税证明
* }
*/
async
queryTxPayment
(
params
)
{
try
{
let
_invoice
=
await
this
.
dao
.
model
.
findOne
({
where
:
{
id
:
this
.
trim
(
params
.
id
),
complateTax
:
1
},
attributes
:
[
'id'
,
'taxNo'
,
'complateTax'
,
'taxTime'
,
'taxVoucher'
]
});
if
(
!
_invoice
)
{
return
system
.
getResult
(
null
,
`完税证明不存在`
);
}
return
system
.
getResult
(
_invoice
);
}
catch
(
error
)
{
return
system
.
getResult
(
null
,
`参数错误 错误信息
${
error
}
`
);
}
}
/**
* 发票列表查询(平台)
* @param {*} params
* @param applyNo 发票的申请编号
* @param invoiceTime 发票的申请时间
* @param type 发票的类型
* @param status 业务进度
*/
async
queryInvoices
(
params
)
{
try
{
var
pageIndex
=
Number
(
params
.
pageIndex
||
1
);
var
pageSize
=
Number
(
params
.
pageSize
||
10
);
var
total
=
await
this
.
dao
.
countByParams
(
params
);
if
(
total
==
0
)
{
return
system
.
getResultSuccess
({
count
:
0
,
rows
:
[]
});
}
var
startRow
=
(
pageIndex
-
1
)
*
pageSize
;
var
list
=
await
this
.
dao
.
pageByParams
(
params
,
startRow
,
pageSize
);
await
this
.
setApply
(
list
);
for
(
var
item
of
list
)
{
// item.redStatusName = this.dao.getRowCodeName(item, "red_status");
if
(
item
.
red_status
==
1
)
{
item
.
red_status
=
'未红冲'
;
}
else
if
(
item
.
red_status
==
2
)
{
item
.
red_status
=
'红冲中'
;
}
else
if
(
item
.
red_status
==
3
)
{
item
.
red_status
=
'红冲失败'
}
else
if
(
item
.
red_status
==
4
)
{
item
.
red_status
=
'红冲成功'
;
}
else
{
item
.
red_status
=
''
;
}
this
.
dao
.
getRowCodeName
(
item
.
apply
,
"status"
);
item
.
complate_tax
=
item
.
complate_tax
==
1
?
'已完税'
:
'未完税'
;
item
.
month
=
moment
(
item
.
invoice_time
).
month
()
+
1
;
this
.
handleDate
(
item
,[
'invoice_time'
],
null
,
-
8
);
if
(
item
.
apply
[
'type'
]
==
'10'
)
{
item
.
apply
[
'type'
]
=
"普通发票"
;
}
else
if
(
item
.
apply
[
'type'
]
==
'20'
)
{
item
.
apply
[
'type'
]
=
"增值税专用发票"
;
}
else
{
item
.
apply
[
'type'
]
=
"电子发票"
;
}
}
var
page
=
{
count
:
total
,
rows
:
list
};
return
system
.
getResultSuccess
(
page
);
}
catch
(
error
)
{
console
.
log
(
error
);
return
system
.
getResult
(
`系统错误 错误信息
${
error
}
`
);
}
}
async
setApply
(
list
)
{
if
(
!
list
||
list
.
length
==
0
)
{
return
;
}
var
ids
=
[];
for
(
var
item
of
list
)
{
ids
.
push
(
item
.
id
);
}
var
applyMap
=
await
this
.
applyDao
.
findMapByIds
(
ids
)
||
{};
for
(
var
item
of
list
)
{
item
.
apply
=
applyMap
[
item
.
id
]
||
{};
}
}
}
module
.
exports
=
InvoiceService
;
\ 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