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
221f00aa
Commit
221f00aa
authored
Jun 16, 2020
by
王昆
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gsb
parent
f286e654
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
215 additions
and
32 deletions
+215
-32
bpo-stat/app/base/controller/impl/all/transactioninCtl.js
+3
-0
bpo-stat/app/base/db/impl/all/electroniccontractDao.js
+8
-4
bpo-stat/app/base/db/impl/all/loadDao.js
+9
-3
bpo-stat/app/base/db/impl/all/merchantaccountDao.js
+41
-0
bpo-stat/app/base/db/impl/all/recruitDao.js
+9
-3
bpo-stat/app/base/db/impl/all/taxinfoDao.js
+19
-7
bpo-stat/app/base/db/impl/all/transactioninDao.js
+18
-6
bpo-stat/app/base/db/models/all/merchantaccount.js
+52
-0
bpo-stat/app/base/db/models/all/transactionin.js
+4
-0
bpo-stat/app/base/service/impl/all/merchantSve.js
+14
-8
bpo-stat/app/base/service/impl/all/merchantaccountSve.js
+36
-0
bpo-stat/app/base/service/impl/all/transactioninSve.js
+1
-1
bpo-stat/app/config/environment.js
+1
-0
No files found.
bpo-stat/app/base/controller/impl/all/transactioninCtl.js
View file @
221f00aa
...
...
@@ -4,6 +4,8 @@ const CtlBase = require("../../ctl.base");
class
TransactioninCtl
extends
CtlBase
{
constructor
()
{
super
(
"all"
,
CtlBase
.
getServiceName
(
TransactioninCtl
));
this
.
merchantaccountSve
=
system
.
getObject
(
"service.all.merchantaccountSve"
);
}
async
allList
(
qobj
){
...
...
@@ -11,6 +13,7 @@ class TransactioninCtl extends CtlBase {
this
.
doTimeCondition
(
params
,
[
"signBegin"
,
"signEnd"
]);
try
{
var
page
=
await
this
.
service
.
signPage
(
params
);
await
this
.
merchantaccountSve
.
setAccount
(
page
.
rows
);
return
system
.
getResult2
(
page
);
}
catch
(
e
)
{
console
.
log
(
e
);
...
...
bpo-stat/app/base/db/impl/all/electroniccontractDao.js
View file @
221f00aa
...
...
@@ -6,15 +6,19 @@ class electroniccontractDao extends Dao {
super
(
Dao
.
getModelName
(
electroniccontractDao
));
}
async
statCount
(
companyNames
)
{
async
statCount
(
companyNames
,
sign_body
)
{
var
result
=
{};
if
(
!
companyNames
||
companyNames
.
length
==
0
)
{
return
result
;
}
var
sql
=
"SELECT company_name, COUNT(1) AS num FROM `electronic_contract_info` WHERE company_name IN (:companyNames) GROUP BY company_name"
;
let
list
=
await
this
.
customQuery
(
sql
,
{
companyNames
:
companyNames
});
let
and
=
[];
and
.
push
(
"company_name IN (:companyNames)"
);
if
(
sign_body
)
{
and
.
push
(
"AND sign_body = :sign_body"
);
}
var
sql
=
`SELECT company_name, COUNT(1) AS num FROM electronic_contract_info WHERE
${
and
.
join
(
" "
)}
GROUP BY company_name`
;
let
list
=
await
this
.
customQuery
(
sql
,
{
companyNames
:
companyNames
,
sign_body
:
sign_body
});
if
(
!
list
||
list
.
length
==
0
)
{
return
result
;
}
...
...
bpo-stat/app/base/db/impl/all/loadDao.js
View file @
221f00aa
...
...
@@ -6,14 +6,20 @@ class LoadDao extends Dao {
super
(
Dao
.
getModelName
(
LoadDao
));
}
async
statCount
(
companyNames
)
{
async
statCount
(
companyNames
,
sign_body
)
{
var
result
=
{};
if
(
!
companyNames
||
companyNames
.
length
==
0
)
{
return
result
;
}
var
sql
=
"SELECT company_name, COUNT(1) AS num FROM `load_info` WHERE company_name IN (:companyNames) GROUP BY company_name"
;
let
and
=
[];
and
.
push
(
"company_name IN (:companyNames)"
);
if
(
sign_body
)
{
and
.
push
(
"AND sign_body = :sign_body"
);
}
var
sql
=
`SELECT company_name, COUNT(1) AS num FROM load_info WHERE
${
and
.
join
(
" "
)}
GROUP BY company_name`
;
let
list
=
await
this
.
customQuery
(
sql
,
{
companyNames
:
companyNames
});
let
list
=
await
this
.
customQuery
(
sql
,
{
companyNames
:
companyNames
,
sign_body
:
sign_body
});
if
(
!
list
||
list
.
length
==
0
)
{
return
result
;
...
...
bpo-stat/app/base/db/impl/all/merchantaccountDao.js
0 → 100644
View file @
221f00aa
const
system
=
require
(
"../../../system"
);
const
Dao
=
require
(
"../../dao.base"
);
class
MerchantAccountDao
extends
Dao
{
constructor
()
{
super
(
Dao
.
getModelName
(
MerchantAccountDao
));
}
async
listByIds
(
ids
,
attrs
)
{
if
(
!
ids
||
ids
.
length
==
0
)
{
return
[];
}
var
sql
=
[];
sql
.
push
(
"SELECT"
);
sql
.
push
(
attrs
||
"*"
);
sql
.
push
(
"FROM"
);
sql
.
push
(
this
.
model
.
tableName
);
sql
.
push
(
"WHERE id IN (:ids)"
);
return
await
this
.
customQuery
(
sql
.
join
(
" "
),
{
ids
:
ids
})
||
[];
}
async
mapByIds
(
ids
,
attrs
)
{
var
result
=
{};
if
(
!
ids
||
ids
.
length
==
0
)
{
return
result
;
}
var
list
=
await
this
.
listByIds
(
ids
,
attrs
);
if
(
!
list
||
list
.
length
==
0
)
{
return
result
;
}
for
(
var
item
of
list
)
{
result
[
item
.
id
]
=
item
;
}
return
result
;
}
}
module
.
exports
=
MerchantAccountDao
;
\ No newline at end of file
bpo-stat/app/base/db/impl/all/recruitDao.js
View file @
221f00aa
...
...
@@ -6,14 +6,20 @@ class RecruitDao extends Dao {
super
(
Dao
.
getModelName
(
RecruitDao
));
}
async
statCount
(
companyNames
)
{
async
statCount
(
companyNames
,
sign_body
)
{
var
result
=
{};
if
(
!
companyNames
||
companyNames
.
length
==
0
)
{
return
result
;
}
var
sql
=
"SELECT company_name, COUNT(1) AS num FROM `recruit_info` WHERE company_name IN (:companyNames) GROUP BY company_name"
;
let
list
=
await
this
.
customQuery
(
sql
,
{
companyNames
:
companyNames
});
let
and
=
[];
and
.
push
(
"company_name IN (:companyNames)"
);
if
(
sign_body
)
{
and
.
push
(
"AND sign_body = :sign_body"
);
}
var
sql
=
`SELECT company_name, COUNT(1) AS num FROM recruit_info WHERE
${
and
.
join
(
" "
)}
GROUP BY company_name `
;
let
list
=
await
this
.
customQuery
(
sql
,
{
companyNames
:
companyNames
,
sign_body
:
sign_body
});
if
(
!
list
||
list
.
length
==
0
)
{
return
result
;
...
...
bpo-stat/app/base/db/impl/all/taxinfoDao.js
View file @
221f00aa
...
...
@@ -5,14 +5,21 @@ class TaxinfoDao extends Dao {
constructor
()
{
super
(
Dao
.
getModelName
(
TaxinfoDao
));
}
async
statCount
(
companyNames
)
{
async
statCount
(
companyNames
,
sign_body
)
{
var
result
=
{};
if
(
!
companyNames
||
companyNames
.
length
==
0
)
{
return
result
;
}
var
sql
=
"SELECT company_name, COUNT(1) AS num FROM `tax_info` WHERE company_name IN (:companyNames) GROUP BY company_name"
;
let
list
=
await
this
.
customQuery
(
sql
,
{
companyNames
:
companyNames
});
let
and
=
[];
and
.
push
(
"company_name IN (:companyNames)"
);
if
(
sign_body
)
{
and
.
push
(
"AND sign_body = :sign_body"
);
}
var
sql
=
`SELECT company_name, COUNT(1) AS num FROM tax_info WHERE
${
and
.
join
(
" "
)}
GROUP BY company_name`
;
let
list
=
await
this
.
customQuery
(
sql
,
{
companyNames
:
companyNames
,
sign_body
:
sign_body
});
if
(
!
list
||
list
.
length
==
0
)
{
return
result
;
...
...
@@ -23,14 +30,19 @@ class TaxinfoDao extends Dao {
}
return
result
;
}
async
statCounts
(
companyNames
)
{
async
statCounts
(
companyNames
,
sign_body
)
{
var
result
=
{};
if
(
!
companyNames
||
companyNames
.
length
==
0
)
{
return
result
;
}
var
sql
=
"SELECT company_name, SUM(income_tax) AS num FROM `tax_info` WHERE company_name IN (:companyNames) GROUP BY company_name"
;
let
and
=
[];
and
.
push
(
"company_name IN (:companyNames)"
);
if
(
sign_body
)
{
and
.
push
(
"AND sign_body = :sign_body"
);
}
var
sql
=
`SELECT company_name, SUM(income_tax) AS num FROM tax_info WHERE
${
and
.
join
(
" "
)}
GROUP BY company_name`
;
let
list
=
await
this
.
customQuery
(
sql
,
{
companyNames
:
companyNames
});
let
list
=
await
this
.
customQuery
(
sql
,
{
companyNames
:
companyNames
,
sign_body
:
sign_body
});
if
(
!
list
||
list
.
length
==
0
)
{
return
result
;
...
...
@@ -66,7 +78,7 @@ class TaxinfoDao extends Dao {
if
(
!
inno
||
inno
.
length
==
0
)
{
return
result
;
}
var
sql
=
"SELECT id_no, SUM(
actual_amount
) AS num FROM `tax_info` WHERE company_name IN (:inno) GROUP BY name"
;
var
sql
=
"SELECT id_no, SUM(
income_tax
) AS num FROM `tax_info` WHERE company_name IN (:inno) GROUP BY name"
;
let
list
=
await
this
.
customQuery
(
sql
,
{
inno
:
inno
});
...
...
bpo-stat/app/base/db/impl/all/transactioninDao.js
View file @
221f00aa
...
...
@@ -5,14 +5,21 @@ class TransactioninDao extends Dao {
constructor
()
{
super
(
Dao
.
getModelName
(
TransactioninDao
));
}
async
statCount
(
companyNames
)
{
async
statCount
(
companyNames
,
sign_body
)
{
var
result
=
{};
if
(
!
companyNames
||
companyNames
.
length
==
0
)
{
return
result
;
}
var
sql
=
"SELECT company_name, COUNT(1) AS num FROM `transaction_info` WHERE company_name IN (:companyNames) GROUP BY company_name"
;
let
list
=
await
this
.
customQuery
(
sql
,
{
companyNames
:
companyNames
});
let
and
=
[];
and
.
push
(
"company_name IN (:companyNames)"
);
if
(
sign_body
)
{
and
.
push
(
"AND sign_body = :sign_body"
);
}
var
sql
=
`SELECT company_name, COUNT(1) AS num FROM transaction_info WHERE
${
and
.
join
(
" "
)}
GROUP BY company_name`
;
let
list
=
await
this
.
customQuery
(
sql
,
{
companyNames
:
companyNames
,
sign_body
:
sign_body
});
if
(
!
list
||
list
.
length
==
0
)
{
return
result
;
...
...
@@ -24,14 +31,19 @@ class TransactioninDao extends Dao {
return
result
;
}
async
statCounts
(
companyNames
)
{
async
statCounts
(
companyNames
,
sign_body
)
{
var
result
=
{};
if
(
!
companyNames
||
companyNames
.
length
==
0
)
{
return
result
;
}
var
sql
=
"SELECT company_name, SUM(actual_amount) amount FROM `transaction_info` WHERE company_name IN (:companyNames) GROUP BY company_name"
;
let
and
=
[];
and
.
push
(
"company_name IN (:companyNames)"
);
if
(
sign_body
)
{
and
.
push
(
"AND sign_body = :sign_body"
);
}
let
list
=
await
this
.
customQuery
(
sql
,
{
companyNames
:
companyNames
});
var
sql
=
`SELECT company_name, SUM(actual_amount) amount FROM transaction_info WHERE
${
and
.
join
(
" "
)}
GROUP BY company_name`
;
let
list
=
await
this
.
customQuery
(
sql
,
{
companyNames
:
companyNames
,
sign_body
:
sign_body
});
if
(
!
list
||
list
.
length
==
0
)
{
return
result
;
...
...
bpo-stat/app/base/db/models/all/merchantaccount.js
0 → 100644
View file @
221f00aa
/* jshint indent: 2 */
module
.
exports
=
function
(
sequelize
,
DataTypes
)
{
return
sequelize
.
define
(
'merchantaccount'
,
{
merchant_id
:
DataTypes
.
INTEGER
,
account_name
:
DataTypes
.
STRING
,
account_no
:
DataTypes
.
STRING
,
account_bank
:
DataTypes
.
STRING
,
legal_name
:
DataTypes
.
STRING
,
base_no
:
DataTypes
.
STRING
,
},
{
tableName
:
'merchant_account'
,
paranoid
:
true
,
//假的删除
underscored
:
true
,
version
:
false
,
freezeTableName
:
true
,
//freezeTableName: true,
// define the table's name
validate
:
{},
indexes
:
[
// Create a unique index on email
// {
// unique: true,
// fields: ['email']
// },
//
// // Creates a gin index on data with the jsonb_path_ops operator
// {
// fields: ['data'],
// using: 'gin',
// operator: 'jsonb_path_ops'
// },
//
// // By default index name will be [table]_[fields]
// // Creates a multi column partial index
// {
// name: 'public_by_author',
// fields: ['author', 'status'],
// where: {
// status: 'public'
// }
// },
//
// // A BTREE index with a ordered field
// {
// name: 'title_index',
// method: 'BTREE',
// fields: ['author', {attribute: 'title', collate: 'en_US', order: 'DESC', length: 5}]
// }
]
});
};
bpo-stat/app/base/db/models/all/transactionin.js
View file @
221f00aa
...
...
@@ -44,6 +44,10 @@ module.exports = function(sequelize, DataTypes) {
type
:
DataTypes
.
STRING
,
allowNull
:
true
},
merchant_account_id
:
{
type
:
DataTypes
.
INTEGER
,
allowNull
:
true
},
created_at
:
{
type
:
DataTypes
.
DATE
,
allowNull
:
true
...
...
bpo-stat/app/base/service/impl/all/merchantSve.js
View file @
221f00aa
...
...
@@ -16,6 +16,7 @@ class MerchantService extends ServiceBase {
this
.
loadSve
=
system
.
getObject
(
"service.all.loadSve"
);
this
.
taxinfoSve
=
system
.
getObject
(
"service.all.taxinfoSve"
);
this
.
transactioninSve
=
system
.
getObject
(
"service.all.transactioninSve"
);
this
.
merchantaccountSve
=
system
.
getObject
(
"service.all.merchantaccountSve"
);
}
async
signPage
(
params
)
{
...
...
@@ -196,23 +197,23 @@ class MerchantService extends ServiceBase {
companyNames
.
push
(
row
.
company_name
);
}
// 电子签约数量 company_name --> num
let
electronMap
=
await
this
.
electroniccontractDao
.
statCount
(
companyNames
);
let
electronMap
=
await
this
.
electroniccontractDao
.
statCount
(
companyNames
,
params
.
sign_body
);
// 招工需求
let
recruitMap
=
await
this
.
recruitDao
.
statCount
(
companyNames
);
let
recruitMap
=
await
this
.
recruitDao
.
statCount
(
companyNames
,
params
.
sign_body
);
// 工作量确认单
let
loadMap
=
await
this
.
loadDao
.
statCount
(
companyNames
);
let
loadMap
=
await
this
.
loadDao
.
statCount
(
companyNames
,
params
.
sign_body
);
// 交易笔数、交易金额
let
traMap
=
await
this
.
transactioninDao
.
statCount
(
companyNames
);
let
traMap
=
await
this
.
transactioninDao
.
statCount
(
companyNames
,
params
.
sign_body
);
//交易金额
let
traSUm
=
await
this
.
transactioninDao
.
statCounts
(
companyNames
);
let
traSUm
=
await
this
.
transactioninDao
.
statCounts
(
companyNames
,
params
.
sign_body
);
// 完税人次
let
taxMap
=
await
this
.
taxinfoDao
.
statCount
(
companyNames
);
let
taxMap
=
await
this
.
taxinfoDao
.
statCount
(
companyNames
,
params
.
sign_body
);
// 完税金额
let
taxSUm
=
await
this
.
taxinfoDao
.
statCounts
(
companyNames
);
let
taxSUm
=
await
this
.
taxinfoDao
.
statCounts
(
companyNames
,
params
.
sign_body
);
for
(
var
row
of
rows
)
{
row
.
dzCount
=
electronMap
[
row
.
company_name
]
||
0
;
...
...
@@ -252,6 +253,7 @@ class MerchantService extends ServiceBase {
firlt
=
"transaction_time"
;
this
.
doTimeCondition
(
params
,
[
"signBegin"
,
"signEnd"
]);
page
=
await
this
.
transactioninSve
.
signPage
(
params
);
await
this
.
merchantaccountSve
.
setAccount
(
page
.
rows
);
}
else
{
//完税
db
=
"tax_info"
;
firlt
=
"tax_time"
;
...
...
@@ -304,7 +306,7 @@ class MerchantService extends ServiceBase {
// 完税人次
let
taxMap
=
await
this
.
taxinfoDao
.
sCount
(
companyNames
);
// 完税金额
let
taxSUm
=
await
this
.
taxinfoDao
.
s
tatCounts
(
companyNames
);
let
taxSUm
=
await
this
.
taxinfoDao
.
s
Count
(
companyNames
);
for
(
var
row
of
rows
)
{
row
.
dzCount
=
electronMap
[
row
.
id_no
]
||
0
;
...
...
@@ -338,6 +340,7 @@ class MerchantService extends ServiceBase {
firlt
=
"transaction_time"
;
this
.
doTimeCondition
(
params
,
[
"signBegin"
,
"signEnd"
]);
page
=
await
this
.
transactioninSve
.
signPage
(
params
);
await
this
.
merchantaccountSve
.
setAccount
(
page
.
rows
);
}
else
{
//完税
db
=
"tax_info"
;
firlt
=
"tax_time"
;
...
...
@@ -355,6 +358,9 @@ class MerchantService extends ServiceBase {
if
(
params
.
idno
){
sql
=
sql
+
" AND id_no = '"
+
params
.
idno
+
"'"
;
}
if
(
params
.
id_no
){
sql
=
sql
+
" AND id_no = '"
+
params
.
id_no
+
"'"
;
}
sql
=
sql
+
" GROUP BY days ORDER BY days ASC"
;
var
charts
=
[[],
[]];
...
...
bpo-stat/app/base/service/impl/all/merchantaccountSve.js
0 → 100644
View file @
221f00aa
const
system
=
require
(
"../../../system"
);
const
ServiceBase
=
require
(
"../../sve.base"
);
const
settings
=
require
(
"../../../../config/settings"
);
/**
* 发票列表
*/
class
MerchantAccountService
extends
ServiceBase
{
constructor
()
{
super
(
"all"
,
ServiceBase
.
getDaoName
(
MerchantAccountService
));
}
async
setAccount
(
list
,
options
)
{
if
(
!
list
||
list
.
length
==
0
)
{
return
;
}
options
=
options
||
{};
let
field
=
options
.
field
||
"merchant_account_id"
;
let
attrs
=
options
.
attrs
||
"id, merchant_id, account_name, account_no, account_bank, legal_name, base_no"
;
let
ids
=
[
-
1
];
for
(
let
item
of
list
)
{
if
(
!
item
||
!
item
[
field
])
{
continue
;
}
ids
.
push
(
Number
(
item
[
field
]));
}
let
map
=
await
this
.
dao
.
mapByIds
(
ids
,
attrs
)
||
{};
for
(
let
item
of
list
)
{
item
.
merchant_account
=
map
[
item
[
field
]]
||
{};
}
}
}
module
.
exports
=
MerchantAccountService
;
\ No newline at end of file
bpo-stat/app/base/service/impl/all/transactioninSve.js
View file @
221f00aa
...
...
@@ -43,7 +43,7 @@ class TransactioninService extends ServiceBase {
[
"id"
,
'desc'
]
];
var
attributes
=
[
`id`
,
`company_name`
,
`id_name`
,
`id_no`
,
`bank_no`
,
`invoiceId`
,
`actual_amount`
,
`deduct_amt`
,
`transaction_time`
,
`sign_body`
,
`order_item_id`
,
`channel_rsp_no`
];
var
attributes
=
[
`id`
,
`company_name`
,
`id_name`
,
`id_no`
,
`bank_no`
,
`invoiceId`
,
`actual_amount`
,
`deduct_amt`
,
`transaction_time`
,
`sign_body`
,
`order_item_id`
,
`channel_rsp_no`
,
`merchant_account_id`
];
var
page
=
await
this
.
getPageList
(
currentPage
,
pageSize
,
where
,
orderby
,
attributes
);
if
(
page
&&
page
.
rows
)
{
for
(
var
row
of
page
.
rows
)
{
...
...
bpo-stat/app/config/environment.js
View file @
221f00aa
...
...
@@ -30,6 +30,7 @@ module.exports = function (app) {
res
.
header
(
'Access-Control-Allow-Headers'
,
'Content-Type, Content-Length, Authorization, Accept, X-Requested-With , yourHeaderFeild, bpostatsid'
);
res
.
header
(
'Access-Control-Allow-Methods'
,
'PUT, POST, GET, DELETE, OPTIONS'
);
// res.header('Access-Control-Allow-Credentials', 'true');
res
.
header
(
'content-type'
,
'text/html;charset=UTF-8'
);
if
(
req
.
method
==
'OPTIONS'
)
{
res
.
send
(
200
);
//让options请求快速返回/
}
...
...
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