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
bb302cc5
Commit
bb302cc5
authored
Mar 10, 2020
by
孙亚楠
Browse files
Options
Browse Files
Download
Plain Diff
dd
parents
fb55a5e9
04a0b5e9
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
194 additions
and
89 deletions
+194
-89
xggsve-invoice/app/base/api/impl/op/action.js
+5
-2
xggsve-invoice/app/base/db/impl/invoice/iinvoiceDao.js
+66
-71
xggsve-invoice/app/base/db/impl/invoice/iinvoicedeliverDao.js
+15
-0
xggsve-invoice/app/base/db/impl/invoice/iinvoiceprocessDao.js
+15
-15
xggsve-invoice/app/base/db/models/invoice/iinvoice.js
+6
-0
xggsve-invoice/app/base/service/impl/invoice/iinvoiceSve.js
+87
-1
No files found.
xggsve-invoice/app/base/api/impl/op/action.js
View file @
bb302cc5
...
...
@@ -5,6 +5,10 @@ class ActionAPI extends APIBase {
constructor
()
{
super
();
this
.
iinvoiceSve
=
system
.
getObject
(
"service.invoice.iinvoiceSve"
);
this
.
iproductSve
=
system
.
getObject
(
"service.product.iproductSve"
);
this
.
iprocessSve
=
system
.
getObject
(
"service.product.iprocessSve"
);
}
/**
* 接口跳转
...
...
@@ -40,9 +44,8 @@ class ActionAPI extends APIBase {
case
"productDics"
:
// 查询产品字典
// opResult = await this.oproductSve.productDics(action_body);
break
;
case
"allProcess"
:
// 查询业务进度
// opResult = await this.o
processSve.allNames(action_body);
opResult
=
await
this
.
i
processSve
.
allNames
(
action_body
);
break
;
// case "verificationAndCalculation": // 发票试算接口
...
...
xggsve-invoice/app/base/db/impl/invoice/iinvoiceDao.js
View file @
bb302cc5
...
...
@@ -5,83 +5,78 @@ class IInvoiceDao extends Dao {
constructor
()
{
super
(
Dao
.
getModelName
(
IInvoiceDao
));
}
async
findByChannelAndApplyNo
(
channel_id
,
apply_no
){
let
sql
=
`select count(1) as total from i_invoice where channel_id = "
${
channel_id
}
" and apply_no = "
${
apply_no
}
"`
;
var
counts
=
await
this
.
customQuery
(
sql
);
return
counts
[
0
];
async
countByParams
(
params
)
{
var
sql
=
[];
sql
.
push
(
"SELECT"
);
sql
.
push
(
"COUNT(1) as total"
);
sql
.
push
(
"FROM `i_invoice` t1"
);
sql
.
push
(
"WHERE 1 = 1 "
);
this
.
setCondition
(
params
,
sql
);
var
counts
=
await
this
.
customQuery
(
sql
.
join
(
" "
),
params
);
if
(
!
counts
||
counts
.
length
==
0
)
{
return
0
;
}
return
counts
[
0
].
total
||
0
;
}
async
pageByParams
(
params
,
startRow
,
pageSize
)
{
var
sql
=
[];
sql
.
push
(
"SELECT"
);
sql
.
push
(
"t1.*"
);
sql
.
push
(
"FROM `i_invoice` t1"
);
sql
.
push
(
"WHERE 1 = 1 "
);
// async countByParams(params) {
// var sql = [];
// sql.push("SELECT");
// sql.push("COUNT(1) as total");
// sql.push("FROM `invoice` t1");
// sql.push("INNER JOIN `invoice_apply` t2 ON t1.`id` = t2.`id`");
// sql.push("WHERE 1 = 1 and t2.status in('1070','1080','1090')");
// this.setCondition(params, sql);
// var counts = await this.customQuery(sql.join(" "), params);
// if(!counts || counts.length == 0) {
// return 0;
// }
// return counts[0].total || 0;
// }
this
.
setCondition
(
params
,
sql
);
// async pageByParams(params, startRow, pageSize) {
// var sql = [];
// sql.push("SELECT");
// sql.push("t1.*");
// sql.push("FROM `invoice` t1");
// sql.push("INNER JOIN `invoice_apply` t2 ON t1.`id` = t2.`id`");
// sql.push("WHERE 1 = 1 ");
// this.setCondition(params, sql);
// sql.push("ORDER BY id DESC");
// sql.push("LIMIT :startRow, :pageSize");
// params.startRow = startRow || 0;
// params.pageSize = pageSize || 10;
// return await this.customQuery(sql.join(" "), params);
// }
// setCondition(params, sql) {
// var complateTax = params.complateTax;
// if (complateTax != "-1") {
// params.complateTax = Number(complateTax);
// sql.push("AND t1.`complate_tax` = :complateTax");
// }
// // invoiceTimeBegin 2019-01-01 2019-01-01 00:00:00
// // invoiceTimeEnd 2019-11-01 2019-11-01 23:59:59
// if(params.invoiceTimeBegin) {
// sql.push("AND t1.`invoice_time` >= :invoiceTimeBegin");
// }
// if(params.invoiceTimeEnd) {
// sql.push("AND t1.`invoice_time` <= :invoiceTimeEnd");
// }
// if(params.invoiceTime){
// sql.push("AND t1.`invoice_time` >= :invoiceTime");
// }
// if(params.applyNo) {
// sql.push("AND t2.`apply_no` = :applyNo");
// }
// if(params.redStatus) {
// sql.push("AND t1.`red_status` = :redStatus");
// }
sql
.
push
(
"ORDER BY id DESC"
);
sql
.
push
(
"LIMIT :startRow, :pageSize"
);
params
.
startRow
=
startRow
||
0
;
params
.
pageSize
=
pageSize
||
10
;
return
await
this
.
customQuery
(
sql
.
join
(
" "
),
params
);
}
// if (params.type) {
// sql.push("AND t2.`type` = :type");
// }
// if(params.statuses && params.statuses.length > 0){
// sql.push("AND t2.`status` in (:statuses)");
// }
// }
setCondition
(
params
,
sql
)
{
if
(
params
.
apply_no
)
{
sql
.
push
(
"AND t2.`apply_no` = :apply_no"
);
}
if
(
params
.
status
)
{
sql
.
push
(
"AND t2.`status` = :status"
);
}
if
(
params
.
statuses
&&
params
.
statuses
.
length
>
0
){
sql
.
push
(
"AND t2.`status` in (:statuses)"
);
}
if
(
params
.
invoice_type
)
{
sql
.
push
(
"AND t2.`invoice_type` = :invoice_type"
);
}
if
(
params
.
invoiceTimeBegin
)
{
sql
.
push
(
"AND t1.`invoice_time` >= :invoiceTimeBegin"
);
}
if
(
params
.
invoiceTimeEnd
)
{
sql
.
push
(
"AND t1.`invoice_time` <= :invoiceTimeEnd"
);
}
if
(
params
.
red_status
)
{
sql
.
push
(
"AND t1.`red_status` = :red_status"
);
}
if
(
params
.
deliver_id
)
{
sql
.
push
(
"AND t2.`deliver_id` = :deliver_id"
);
}
if
(
params
.
bd_id
)
{
sql
.
push
(
"AND t2.`bd_id` = :bd_id"
);
}
if
(
params
.
bd_path
)
{
params
.
bd_path_like
=
params
.
bd_path
+
"%"
;
sql
.
push
(
"AND t2.`bd_path` = :bd_path_like"
);
}
}
async
findByChannelAndApplyNo
(
channel_id
,
apply_no
){
let
sql
=
`select count(1) as total from i_invoice where channel_id = "
${
channel_id
}
" and apply_no = "
${
apply_no
}
"`
;
var
counts
=
await
this
.
customQuery
(
sql
);
return
counts
[
0
];
}
// /**
// * 红冲列表总计
...
...
xggsve-invoice/app/base/db/impl/invoice/iinvoicedeliverDao.js
View file @
bb302cc5
...
...
@@ -6,6 +6,21 @@ class IinvoicedeliverDao extends Dao {
this
.
tableName
=
this
.
model
.
tableName
;
}
async
findMapByIds
(
ids
)
{
var
result
=
{};
var
sql
=
`SELECT * FROM
${
this
.
tableName
}
WHERE id IN (:ids)`
;
var
list
=
await
this
.
customQuery
(
sql
,
{
ids
:
ids
});
if
(
!
list
||
list
.
length
==
0
)
{
return
result
;
}
for
(
var
item
of
list
)
{
result
[
item
.
id
]
=
item
;
}
return
result
;
}
//交付商业务概览
async
countStat
(
params
)
{
var
sql
=
[];
...
...
xggsve-invoice/app/base/db/impl/invoice/iinvoiceprocessDao.js
View file @
bb302cc5
...
...
@@ -7,16 +7,16 @@ class IInvoiceprocessDao extends Dao {
this
.
tableName
=
this
.
model
.
tableName
;
}
async
delBy
OrderId
(
order
_id
)
{
if
(
!
order
_id
)
{
async
delBy
InvoiceId
(
invoice
_id
)
{
if
(
!
invoice
_id
)
{
return
;
}
let
sql
=
`DELETE FROM
${
this
.
tableName
}
WHERE
order_id = :order
_id`
;
await
this
.
customUpdate
(
sql
,
{
order_id
:
order
_id
});
let
sql
=
`DELETE FROM
${
this
.
tableName
}
WHERE
invoice_id = :invoice
_id`
;
await
this
.
customUpdate
(
sql
,
{
invoice_id
:
invoice
_id
});
}
async
findBy
OrderIdAndStatus
(
order
Id
,
status
)
{
if
(
!
order
Id
||
!
status
)
{
async
findBy
InvoiceIdAndStatus
(
invoice
Id
,
status
)
{
if
(
!
invoice
Id
||
!
status
)
{
return
null
;
}
let
sql
=
[];
...
...
@@ -24,19 +24,19 @@ class IInvoiceprocessDao extends Dao {
sql
.
push
(
"*"
);
sql
.
push
(
"FROM"
);
sql
.
push
(
this
.
tableName
);
sql
.
push
(
"WHERE
order_id = :order
Id"
);
sql
.
push
(
"WHERE
invoice_id = :invoice
Id"
);
sql
.
push
(
"AND `status` = :status"
);
let
list
=
await
this
.
customQuery
(
sql
.
join
(
" "
),
{
orderId
:
order
Id
,
status
:
status
});
let
list
=
await
this
.
customQuery
(
sql
.
join
(
" "
),
{
invoiceId
:
invoice
Id
,
status
:
status
});
if
(
!
list
||
list
.
length
==
0
)
{
return
null
;
}
return
list
[
0
];
}
async
listBy
OrderIdsAndStatus
(
order
Ids
,
statuses
)
{
async
listBy
InvoiceIdsAndStatus
(
invoice
Ids
,
statuses
)
{
var
result
=
{};
if
(
!
orderIds
||
order
Ids
.
length
==
0
||
!
statuses
||
statuses
.
length
==
0
)
{
if
(
!
invoiceIds
||
invoice
Ids
.
length
==
0
||
!
statuses
||
statuses
.
length
==
0
)
{
return
result
;
}
let
sql
=
[];
...
...
@@ -44,21 +44,21 @@ class IInvoiceprocessDao extends Dao {
sql
.
push
(
"*"
);
sql
.
push
(
"FROM"
);
sql
.
push
(
this
.
tableName
);
sql
.
push
(
"WHERE
order_id IN (:order
Ids)"
);
sql
.
push
(
"WHERE
invoice_id IN (:invoice
Ids)"
);
sql
.
push
(
"AND `status` IN (:statuses)"
);
return
await
this
.
customQuery
(
sql
.
join
(
" "
),
{
orderIds
:
order
Ids
,
statuses
:
statuses
});
return
await
this
.
customQuery
(
sql
.
join
(
" "
),
{
invoiceIds
:
invoice
Ids
,
statuses
:
statuses
});
}
async
mapBy
OrderIdsAndStatus
(
order
Ids
,
statuses
)
{
async
mapBy
InvoiceIdsAndStatus
(
invoice
Ids
,
statuses
)
{
var
result
=
{};
let
list
=
await
this
.
listBy
OrderIdsAndStatus
(
order
Ids
,
statuses
);
let
list
=
await
this
.
listBy
InvoiceIdsAndStatus
(
invoice
Ids
,
statuses
);
if
(
!
list
||
list
.
length
==
0
)
{
return
result
;
}
for
(
let
item
of
list
)
{
result
[
item
.
order
_id
+
"_"
+
item
.
status
]
=
item
;
result
[
item
.
invoice
_id
+
"_"
+
item
.
status
]
=
item
;
}
return
result
;
}
...
...
xggsve-invoice/app/base/db/models/invoice/iinvoice.js
View file @
bb302cc5
...
...
@@ -49,10 +49,16 @@ module.exports = (db, DataTypes) => {
bd_path
:{
type
:
DataTypes
.
STRING
(
200
),
allowNull
:
true
,
defaultValue
:
null
,
comment
:
"业务员权限"
},
channel_id
:{
type
:
DataTypes
.
STRING
(
32
),
allowNull
:
true
,
delaultValue
:
''
,
comment
:
"渠道ID"
},
product_id
:{
type
:
DataTypes
.
STRING
(
32
),
allowNull
:
true
,
delaultValue
:
''
,
comment
:
"商品ID"
},
<<<<<<<
HEAD
created_at
:
{
type
:
DataTypes
.
DATE
,
field
:
'created_at'
,
allowNull
:
false
,
defaultValue
:
DataTypes
.
NOW
},
updated_at
:
{
type
:
DataTypes
.
DATE
,
field
:
'updated_at'
,
allowNull
:
false
,
defaultValue
:
DataTypes
.
NOW
},
deleted_at
:
{
type
:
DataTypes
.
DATE
,
field
:
'deleted_at'
,
allowNull
:
true
},
version
:
{
type
:
DataTypes
.
INTEGER
,
allowNull
:
true
,
defaultValue
:
0
}
=======
created_at
:
{
type
:
DataTypes
.
DATE
,
allowNull
:
true
},
updated_at
:
{
type
:
DataTypes
.
DATE
,
allowNull
:
true
},
deleted_at
:
{
type
:
DataTypes
.
DATE
,
allowNull
:
true
},
>>>>>>>
04
a0b5e93a1f0074627779a207d7a1380983e60f
},
{
timestamps
:
false
,
paranoid
:
true
,
...
...
xggsve-invoice/app/base/service/impl/invoice/iinvoiceSve.js
View file @
bb302cc5
...
...
@@ -135,7 +135,92 @@ class IInvoiceService extends ServiceBase {
}
}
/*
async
invoicePage
(
params
)
{
params
.
currentPage
=
Number
(
params
.
currentPage
||
1
);
params
.
pageSize
=
Number
(
params
.
pageSize
||
10
);
params
.
startRow
=
Number
((
params
.
currentPage
-
1
)
*
params
.
pageSize
);
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'
);
}
//格式化订单产品
await
this
.
setDeliver
(
list
);
//格式化业务员
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
]
||
{}
}
}
async
setDeliver
(
list
)
{
if
(
!
list
||
list
.
length
==
0
)
{
return
;
}
let
ids
=
[];
for
(
let
item
of
list
)
{
if
(
!
item
.
invoice_deliver_id
)
{
continue
;
}
ids
.
push
(
item
.
invoice_deliver_id
)
}
let
map
=
await
this
.
iinvoicedeliverDao
.
findMapByIds
(
ids
);
for
(
let
item
of
list
)
{
item
.
invoice_deliver
=
map
[
item
.
invoice_deliver_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
);
}
/**
* 构建产品流程对象
* @param productPid
* @param chooseProductIds
...
...
@@ -183,6 +268,7 @@ class IInvoiceService extends ServiceBase {
invoiceProcessList
.
push
(
orderProcess
);
}
// await this.iinvoiceprocessDao.model.bulkCreate(invoiceProcessList);
return
invoiceProcessList
;
}
...
...
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